Get In Touch
- info@siit jaipur.org
- +91 9828560001
-
Lakhna Road, Via Sanganer Bazar,
Jaipur-302029, Rajasthan.
+ADw?php /+ACoAKg +ACo WordPress implementation for PHP functions either missing from older PHP versions or not included by default. +ACo +ACo +AEA-package PHP +ACo +AEA-access private +ACo-/ // If gettext isn't available if ( +ACE-function+AF8-exists('+AF8') ) +AHs function +AF8(+ACQ-string) +AHs return +ACQ-string+ADs +AH0 +AH0 /+ACoAKg +ACo Returns whether PCRE/u (PCRE+AF8-UTF8 modifier) is available for use. +ACo +ACo +AEA-ignore +ACo +AEA-since 4.2.2 +ACo +AEA-access private +ACo +ACo +AEA-staticvar string +ACQ-utf8+AF8-pcre +ACo +ACo +AEA-param bool +ACQ-set - Used for testing only +ACo null : default - get PCRE/u capability +ACo false : Used for testing - return false for future calls to this function +ACo 'reset': Used for testing - restore default behavior of this function +ACo-/ function +AF8-wp+AF8-can+AF8-use+AF8-pcre+AF8-u( +ACQ-set +AD0 null ) +AHs static +ACQ-utf8+AF8-pcre +AD0 'reset'+ADs if ( null +ACEAPQA9 +ACQ-set ) +AHs +ACQ-utf8+AF8-pcre +AD0 +ACQ-set+ADs +AH0 if ( 'reset' +AD0APQA9 +ACQ-utf8+AF8-pcre ) +AHs +ACQ-utf8+AF8-pcre +AD0 +AEA-preg+AF8-match( '/+AF4./u', 'a' )+ADs +AH0 return +ACQ-utf8+AF8-pcre+ADs +AH0 if ( +ACE function+AF8-exists( 'mb+AF8-substr' ) ) : /+ACoAKg +ACo Compat function to mimic mb+AF8-substr(). +ACo +ACo +AEA-ignore +ACo +AEA-since 3.2.0 +ACo +ACo +AEA-see +AF8-mb+AF8-substr() +ACo +ACo +AEA-param string +ACQ-str The string to extract the substring from. +ACo +AEA-param int +ACQ-start Position to being extraction from in +AGAAJA-str+AGA. +ACo +AEA-param int+AHw-null +ACQ-length Optional. Maximum number of characters to extract from +AGAAJA-str+AGA. +ACo Default null. +ACo +AEA-param string+AHw-null +ACQ-encoding Optional. Character encoding to use. Default null. +ACo +AEA-return string Extracted substring. +ACo-/ function mb+AF8-substr( +ACQ-str, +ACQ-start, +ACQ-length +AD0 null, +ACQ-encoding +AD0 null ) +AHs return +AF8-mb+AF8-substr( +ACQ-str, +ACQ-start, +ACQ-length, +ACQ-encoding )+ADs +AH0 endif+ADs /+ACoAKg +ACo Internal compat function to mimic mb+AF8-substr(). +ACo +ACo Only understands UTF-8 and 8bit. All other character sets will be treated as 8bit. +ACo For +ACQ-encoding +AD0APQA9 UTF-8, the +ACQ-str input is expected to be a valid UTF-8 byte sequence. +ACo The behavior of this function for invalid inputs is undefined. +ACo +ACo +AEA-ignore +ACo +AEA-since 3.2.0 +ACo +ACo +AEA-param string +ACQ-str The string to extract the substring from. +ACo +AEA-param int +ACQ-start Position to being extraction from in +AGAAJA-str+AGA. +ACo +AEA-param int+AHw-null +ACQ-length Optional. Maximum number of characters to extract from +AGAAJA-str+AGA. +ACo Default null. +ACo +AEA-param string+AHw-null +ACQ-encoding Optional. Character encoding to use. Default null. +ACo +AEA-return string Extracted substring. +ACo-/ function +AF8-mb+AF8-substr( +ACQ-str, +ACQ-start, +ACQ-length +AD0 null, +ACQ-encoding +AD0 null ) +AHs if ( null +AD0APQA9 +ACQ-encoding ) +AHs +ACQ-encoding +AD0 get+AF8-option( 'blog+AF8-charset' )+ADs +AH0 /+ACo +ACo The solution below works only for UTF-8, so in case of a different +ACo charset just use built-in substr(). +ACo-/ if ( +ACE in+AF8-array( +ACQ-encoding, array( 'utf8', 'utf-8', 'UTF8', 'UTF-8' ) ) ) +AHs return is+AF8-null( +ACQ-length ) ? substr( +ACQ-str, +ACQ-start ) : substr( +ACQ-str, +ACQ-start, +ACQ-length )+ADs +AH0 if ( +AF8-wp+AF8-can+AF8-use+AF8-pcre+AF8-u() ) +AHs // Use the regex unicode support to separate the UTF-8 characters into an array. preg+AF8-match+AF8-all( '/./us', +ACQ-str, +ACQ-match )+ADs +ACQ-chars +AD0 is+AF8-null( +ACQ-length ) ? array+AF8-slice( +ACQ-match+AFs-0+AF0, +ACQ-start ) : array+AF8-slice( +ACQ-match+AFs-0+AF0, +ACQ-start, +ACQ-length )+ADs return implode( '', +ACQ-chars )+ADs +AH0 +ACQ-regex +AD0 '/( +AFsAXA-x00-+AFw-x7F+AF0 +ACM single-byte sequences 0xxxxxxx +AHw +AFsAXA-xC2-+AFw-xDF+AF0AWwBc-x80-+AFw-xBF+AF0 +ACM double-byte sequences 110xxxxx 10xxxxxx +AHw +AFw-xE0+AFsAXA-xA0-+AFw-xBF+AF0AWwBc-x80-+AFw-xBF+AF0 +ACM triple-byte sequences 1110xxxx 10xxxxxx +ACo 2 +AHw +AFsAXA-xE1-+AFw-xEC+AF0AWwBc-x80-+AFw-xBF+AF0Aew-2+AH0 +AHw +AFw-xED+AFsAXA-x80-+AFw-x9F+AF0AWwBc-x80-+AFw-xBF+AF0 +AHw +AFsAXA-xEE-+AFw-xEF+AF0AWwBc-x80-+AFw-xBF+AF0Aew-2+AH0 +AHw +AFw-xF0+AFsAXA-x90-+AFw-xBF+AF0AWwBc-x80-+AFw-xBF+AF0Aew-2+AH0 +ACM four-byte sequences 11110xxx 10xxxxxx +ACo 3 +AHw +AFsAXA-xF1-+AFw-xF3+AF0AWwBc-x80-+AFw-xBF+AF0Aew-3+AH0 +AHw +AFw-xF4+AFsAXA-x80-+AFw-x8F+AF0AWwBc-x80-+AFw-xBF+AF0Aew-2+AH0 )/x'+ADs // Start with 1 element instead of 0 since the first thing we do is pop. +ACQ-chars +AD0 array( '' )+ADs do +AHs // We had some string left over from the last round, but we counted it in that last round. array+AF8-pop( +ACQ-chars )+ADs /+ACo +ACo Split by UTF-8 character, limit to 1000 characters (last array element will contain +ACo the rest of the string). +ACo-/ +ACQ-pieces +AD0 preg+AF8-split( +ACQ-regex, +ACQ-str, 1000, PREG+AF8-SPLIT+AF8-DELIM+AF8-CAPTURE +AHw PREG+AF8-SPLIT+AF8-NO+AF8-EMPTY )+ADs +ACQ-chars +AD0 array+AF8-merge( +ACQ-chars, +ACQ-pieces )+ADs // If there's anything left over, repeat the loop. +AH0 while ( count( +ACQ-pieces ) +AD4 1 +ACYAJg +ACQ-str +AD0 array+AF8-pop( +ACQ-pieces ) )+ADs return join( '', array+AF8-slice( +ACQ-chars, +ACQ-start, +ACQ-length ) )+ADs +AH0 if ( +ACE function+AF8-exists( 'mb+AF8-strlen' ) ) : /+ACoAKg +ACo Compat function to mimic mb+AF8-strlen(). +ACo +ACo +AEA-ignore +ACo +AEA-since 4.2.0 +ACo +ACo +AEA-see +AF8-mb+AF8-strlen() +ACo +ACo +AEA-param string +ACQ-str The string to retrieve the character length from. +ACo +AEA-param string+AHw-null +ACQ-encoding Optional. Character encoding to use. Default null. +ACo +AEA-return int String length of +AGAAJA-str+AGA. +ACo-/ function mb+AF8-strlen( +ACQ-str, +ACQ-encoding +AD0 null ) +AHs return +AF8-mb+AF8-strlen( +ACQ-str, +ACQ-encoding )+ADs +AH0 endif+ADs /+ACoAKg +ACo Internal compat function to mimic mb+AF8-strlen(). +ACo +ACo Only understands UTF-8 and 8bit. All other character sets will be treated as 8bit. +ACo For +ACQ-encoding +AD0APQA9 UTF-8, the +AGAAJA-str+AGA input is expected to be a valid UTF-8 byte +ACo sequence. The behavior of this function for invalid inputs is undefined. +ACo +ACo +AEA-ignore +ACo +AEA-since 4.2.0 +ACo +ACo +AEA-param string +ACQ-str The string to retrieve the character length from. +ACo +AEA-param string+AHw-null +ACQ-encoding Optional. Character encoding to use. Default null. +ACo +AEA-return int String length of +AGAAJA-str+AGA. +ACo-/ function +AF8-mb+AF8-strlen( +ACQ-str, +ACQ-encoding +AD0 null ) +AHs if ( null +AD0APQA9 +ACQ-encoding ) +AHs +ACQ-encoding +AD0 get+AF8-option( 'blog+AF8-charset' )+ADs +AH0 /+ACo +ACo The solution below works only for UTF-8, so in case of a different charset +ACo just use built-in strlen(). +ACo-/ if ( +ACE in+AF8-array( +ACQ-encoding, array( 'utf8', 'utf-8', 'UTF8', 'UTF-8' ) ) ) +AHs return strlen( +ACQ-str )+ADs +AH0 if ( +AF8-wp+AF8-can+AF8-use+AF8-pcre+AF8-u() ) +AHs // Use the regex unicode support to separate the UTF-8 characters into an array. preg+AF8-match+AF8-all( '/./us', +ACQ-str, +ACQ-match )+ADs return count( +ACQ-match+AFs-0+AF0 )+ADs +AH0 +ACQ-regex +AD0 '/(?: +AFsAXA-x00-+AFw-x7F+AF0 +ACM single-byte sequences 0xxxxxxx +AHw +AFsAXA-xC2-+AFw-xDF+AF0AWwBc-x80-+AFw-xBF+AF0 +ACM double-byte sequences 110xxxxx 10xxxxxx +AHw +AFw-xE0+AFsAXA-xA0-+AFw-xBF+AF0AWwBc-x80-+AFw-xBF+AF0 +ACM triple-byte sequences 1110xxxx 10xxxxxx +ACo 2 +AHw +AFsAXA-xE1-+AFw-xEC+AF0AWwBc-x80-+AFw-xBF+AF0Aew-2+AH0 +AHw +AFw-xED+AFsAXA-x80-+AFw-x9F+AF0AWwBc-x80-+AFw-xBF+AF0 +AHw +AFsAXA-xEE-+AFw-xEF+AF0AWwBc-x80-+AFw-xBF+AF0Aew-2+AH0 +AHw +AFw-xF0+AFsAXA-x90-+AFw-xBF+AF0AWwBc-x80-+AFw-xBF+AF0Aew-2+AH0 +ACM four-byte sequences 11110xxx 10xxxxxx +ACo 3 +AHw +AFsAXA-xF1-+AFw-xF3+AF0AWwBc-x80-+AFw-xBF+AF0Aew-3+AH0 +AHw +AFw-xF4+AFsAXA-x80-+AFw-x8F+AF0AWwBc-x80-+AFw-xBF+AF0Aew-2+AH0 )/x'+ADs // Start at 1 instead of 0 since the first thing we do is decrement. +ACQ-count +AD0 1+ADs do +AHs // We had some string left over from the last round, but we counted it in that last round. +ACQ-count--+ADs /+ACo +ACo Split by UTF-8 character, limit to 1000 characters (last array element will contain +ACo the rest of the string). +ACo-/ +ACQ-pieces +AD0 preg+AF8-split( +ACQ-regex, +ACQ-str, 1000 )+ADs // Increment. +ACQ-count +-+AD0 count( +ACQ-pieces )+ADs // If there's anything left over, repeat the loop. +AH0 while ( +ACQ-str +AD0 array+AF8-pop( +ACQ-pieces ) )+ADs // Fencepost: preg+AF8-split() always returns one extra item in the array. return --+ACQ-count+ADs +AH0 if ( +ACE-function+AF8-exists('hash+AF8-hmac') ): /+ACoAKg +ACo Compat function to mimic hash+AF8-hmac(). +ACo +ACo +AEA-ignore +ACo +AEA-since 3.2.0 +ACo +ACo +AEA-see +AF8-hash+AF8-hmac() +ACo +ACo +AEA-param string +ACQ-algo Hash algorithm. Accepts 'md5' or 'sha1'. +ACo +AEA-param string +ACQ-data Data to be hashed. +ACo +AEA-param string +ACQ-key Secret key to use for generating the hash. +ACo +AEA-param bool +ACQ-raw+AF8-output Optional. Whether to output raw binary data (true), +ACo or lowercase hexits (false). Default false. +ACo +AEA-return string+AHw-false The hash in output determined by +AGAAJA-raw+AF8-output+AGA. False if +AGAAJA-algo+AGA +ACo is unknown or invalid. +ACo-/ function hash+AF8-hmac(+ACQ-algo, +ACQ-data, +ACQ-key, +ACQ-raw+AF8-output +AD0 false) +AHs return +AF8-hash+AF8-hmac(+ACQ-algo, +ACQ-data, +ACQ-key, +ACQ-raw+AF8-output)+ADs +AH0 endif+ADs /+ACoAKg +ACo Internal compat function to mimic hash+AF8-hmac(). +ACo +ACo +AEA-ignore +ACo +AEA-since 3.2.0 +ACo +ACo +AEA-param string +ACQ-algo Hash algorithm. Accepts 'md5' or 'sha1'. +ACo +AEA-param string +ACQ-data Data to be hashed. +ACo +AEA-param string +ACQ-key Secret key to use for generating the hash. +ACo +AEA-param bool +ACQ-raw+AF8-output Optional. Whether to output raw binary data (true), +ACo or lowercase hexits (false). Default false. +ACo +AEA-return string+AHw-false The hash in output determined by +AGAAJA-raw+AF8-output+AGA. False if +AGAAJA-algo+AGA +ACo is unknown or invalid. +ACo-/ function +AF8-hash+AF8-hmac(+ACQ-algo, +ACQ-data, +ACQ-key, +ACQ-raw+AF8-output +AD0 false) +AHs +ACQ-packs +AD0 array('md5' +AD0APg 'H32', 'sha1' +AD0APg 'H40')+ADs if ( +ACE-isset(+ACQ-packs+AFsAJA-algo+AF0) ) return false+ADs +ACQ-pack +AD0 +ACQ-packs+AFsAJA-algo+AF0AOw if (strlen(+ACQ-key) +AD4 64) +ACQ-key +AD0 pack(+ACQ-pack, +ACQ-algo(+ACQ-key))+ADs +ACQ-key +AD0 str+AF8-pad(+ACQ-key, 64, chr(0))+ADs +ACQ-ipad +AD0 (substr(+ACQ-key, 0, 64) +AF4 str+AF8-repeat(chr(0x36), 64))+ADs +ACQ-opad +AD0 (substr(+ACQ-key, 0, 64) +AF4 str+AF8-repeat(chr(0x5C), 64))+ADs +ACQ-hmac +AD0 +ACQ-algo(+ACQ-opad . pack(+ACQ-pack, +ACQ-algo(+ACQ-ipad . +ACQ-data)))+ADs if ( +ACQ-raw+AF8-output ) return pack( +ACQ-pack, +ACQ-hmac )+ADs return +ACQ-hmac+ADs +AH0 if ( +ACE-function+AF8-exists('json+AF8-encode') ) +AHs function json+AF8-encode( +ACQ-string ) +AHs global +ACQ-wp+AF8-json+ADs if ( +ACE ( +ACQ-wp+AF8-json instanceof Services+AF8-JSON ) ) +AHs require+AF8-once( ABSPATH . WPINC . '/class-json.php' )+ADs +ACQ-wp+AF8-json +AD0 new Services+AF8-JSON()+ADs +AH0 return +ACQ-wp+AF8-json-+AD4-encodeUnsafe( +ACQ-string )+ADs +AH0 +AH0 if ( +ACE-function+AF8-exists('json+AF8-decode') ) +AHs /+ACoAKg +ACo +AEA-global Services+AF8-JSON +ACQ-wp+AF8-json +ACo +AEA-param string +ACQ-string +ACo +AEA-param bool +ACQ-assoc+AF8-array +ACo +AEA-return object+AHw-array +ACo-/ function json+AF8-decode( +ACQ-string, +ACQ-assoc+AF8-array +AD0 false ) +AHs global +ACQ-wp+AF8-json+ADs if ( +ACE (+ACQ-wp+AF8-json instanceof Services+AF8-JSON ) ) +AHs require+AF8-once( ABSPATH . WPINC . '/class-json.php' )+ADs +ACQ-wp+AF8-json +AD0 new Services+AF8-JSON()+ADs +AH0 +ACQ-res +AD0 +ACQ-wp+AF8-json-+AD4-decode( +ACQ-string )+ADs if ( +ACQ-assoc+AF8-array ) +ACQ-res +AD0 +AF8-json+AF8-decode+AF8-object+AF8-helper( +ACQ-res )+ADs return +ACQ-res+ADs +AH0 /+ACoAKg +ACo +AEA-param object +ACQ-data +ACo +AEA-return array +ACo-/ function +AF8-json+AF8-decode+AF8-object+AF8-helper(+ACQ-data) +AHs if ( is+AF8-object(+ACQ-data) ) +ACQ-data +AD0 get+AF8-object+AF8-vars(+ACQ-data)+ADs return is+AF8-array(+ACQ-data) ? array+AF8-map(+AF8AXw-FUNCTION+AF8AXw, +ACQ-data) : +ACQ-data+ADs +AH0 +AH0 if ( +ACE function+AF8-exists( 'hash+AF8-equals' ) ) : /+ACoAKg +ACo Timing attack safe string comparison +ACo +ACo Compares two strings using the same time whether they're equal or not. +ACo +ACo This function was added in PHP 5.6. +ACo +ACo Note: It can leak the length of a string when arguments of differing length are supplied. +ACo +ACo +AEA-since 3.9.2 +ACo +ACo +AEA-param string +ACQ-a Expected string. +ACo +AEA-param string +ACQ-b Actual, user supplied, string. +ACo +AEA-return bool Whether strings are equal. +ACo-/ function hash+AF8-equals( +ACQ-a, +ACQ-b ) +AHs +ACQ-a+AF8-length +AD0 strlen( +ACQ-a )+ADs if ( +ACQ-a+AF8-length +ACEAPQA9 strlen( +ACQ-b ) ) +AHs return false+ADs +AH0 +ACQ-result +AD0 0+ADs // Do not attempt to +ACI-optimize+ACI this. for ( +ACQ-i +AD0 0+ADs +ACQ-i +ADw +ACQ-a+AF8-length+ADs +ACQ-i+-+- ) +AHs +ACQ-result +AHwAPQ ord( +ACQ-a+AFs +ACQ-i +AF0 ) +AF4 ord( +ACQ-b+AFs +ACQ-i +AF0 )+ADs +AH0 return +ACQ-result +AD0APQA9 0+ADs +AH0 endif+ADs // JSON+AF8-PRETTY+AF8-PRINT was introduced in PHP 5.4 // Defined here to prevent a notice when using it with wp+AF8-json+AF8-encode() if ( +ACE defined( 'JSON+AF8-PRETTY+AF8-PRINT' ) ) +AHs define( 'JSON+AF8-PRETTY+AF8-PRINT', 128 )+ADs +AH0 if ( +ACE function+AF8-exists( 'json+AF8-last+AF8-error+AF8-msg' ) ) : /+ACoAKg +ACo Retrieves the error string of the last json+AF8-encode() or json+AF8-decode() call. +ACo +ACo +AEA-since 4.4.0 +ACo +ACo +AEA-internal This is a compatibility function for PHP +ADw-5.5 +ACo +ACo +AEA-return bool+AHw-string Returns the error message on success, +ACI-No Error+ACI if no error has occurred, +ACo or false on failure. +ACo-/ function json+AF8-last+AF8-error+AF8-msg() +AHs // See https://core.trac.wordpress.org/ticket/27799. if ( +ACE function+AF8-exists( 'json+AF8-last+AF8-error' ) ) +AHs return false+ADs +AH0 +ACQ-last+AF8-error+AF8-code +AD0 json+AF8-last+AF8-error()+ADs // Just in case JSON+AF8-ERROR+AF8-NONE is not defined. +ACQ-error+AF8-code+AF8-none +AD0 defined( 'JSON+AF8-ERROR+AF8-NONE' ) ? JSON+AF8-ERROR+AF8-NONE : 0+ADs switch ( true ) +AHs case +ACQ-last+AF8-error+AF8-code +AD0APQA9 +ACQ-error+AF8-code+AF8-none: return 'No error'+ADs case defined( 'JSON+AF8-ERROR+AF8-DEPTH' ) +ACYAJg JSON+AF8-ERROR+AF8-DEPTH +AD0APQA9 +ACQ-last+AF8-error+AF8-code: return 'Maximum stack depth exceeded'+ADs case defined( 'JSON+AF8-ERROR+AF8-STATE+AF8-MISMATCH' ) +ACYAJg JSON+AF8-ERROR+AF8-STATE+AF8-MISMATCH +AD0APQA9 +ACQ-last+AF8-error+AF8-code: return 'State mismatch (invalid or malformed JSON)'+ADs case defined( 'JSON+AF8-ERROR+AF8-CTRL+AF8-CHAR' ) +ACYAJg JSON+AF8-ERROR+AF8-CTRL+AF8-CHAR +AD0APQA9 +ACQ-last+AF8-error+AF8-code: return 'Control character error, possibly incorrectly encoded'+ADs case defined( 'JSON+AF8-ERROR+AF8-SYNTAX' ) +ACYAJg JSON+AF8-ERROR+AF8-SYNTAX +AD0APQA9 +ACQ-last+AF8-error+AF8-code: return 'Syntax error'+ADs case defined( 'JSON+AF8-ERROR+AF8-UTF8' ) +ACYAJg JSON+AF8-ERROR+AF8-UTF8 +AD0APQA9 +ACQ-last+AF8-error+AF8-code: return 'Malformed UTF-8 characters, possibly incorrectly encoded'+ADs case defined( 'JSON+AF8-ERROR+AF8-RECURSION' ) +ACYAJg JSON+AF8-ERROR+AF8-RECURSION +AD0APQA9 +ACQ-last+AF8-error+AF8-code: return 'Recursion detected'+ADs case defined( 'JSON+AF8-ERROR+AF8-INF+AF8-OR+AF8-NAN' ) +ACYAJg JSON+AF8-ERROR+AF8-INF+AF8-OR+AF8-NAN +AD0APQA9 +ACQ-last+AF8-error+AF8-code: return 'Inf and NaN cannot be JSON encoded'+ADs case defined( 'JSON+AF8-ERROR+AF8-UNSUPPORTED+AF8-TYPE' ) +ACYAJg JSON+AF8-ERROR+AF8-UNSUPPORTED+AF8-TYPE +AD0APQA9 +ACQ-last+AF8-error+AF8-code: return 'Type is not supported'+ADs default: return 'An unknown error occurred'+ADs +AH0 +AH0 endif+ADs if ( +ACE interface+AF8-exists( 'JsonSerializable' ) ) +AHs define( 'WP+AF8-JSON+AF8-SERIALIZE+AF8-COMPATIBLE', true )+ADs /+ACoAKg +ACo JsonSerializable interface. +ACo +ACo Compatibility shim for PHP +ADw-5.4 +ACo +ACo +AEA-link https://secure.php.net/jsonserializable +ACo +ACo +AEA-since 4.4.0 +ACo-/ interface JsonSerializable +AHs public function jsonSerialize()+ADs +AH0 +AH0 // random+AF8-int was introduced in PHP 7.0 if ( +ACE function+AF8-exists( 'random+AF8-int' ) ) +AHs require ABSPATH . WPINC . '/random+AF8-compat/random.php'+ADs +AH0 if ( +ACE function+AF8-exists( 'array+AF8-replace+AF8-recursive' ) ) : /+ACoAKg +ACo PHP-agnostic version of +AHsAQA-link array+AF8-replace+AF8-recursive()+AH0. +ACo +ACo The array+AF8-replace+AF8-recursive() function is a PHP 5.3 function. WordPress +ACo currently supports down to PHP 5.2, so this method is a workaround +ACo for PHP 5.2. +ACo +ACo Note: array+AF8-replace+AF8-recursive() supports infinite arguments, but for our use- +ACo case, we only need to support two arguments. +ACo +ACo Subject to removal once WordPress makes PHP 5.3.0 the minimum requirement. +ACo +ACo +AEA-since 4.5.3 +ACo +ACo +AEA-see https://secure.php.net/manual/en/function.array-replace-recursive.php+ACM-109390 +ACo +ACo +AEA-param array +ACQ-base Array with keys needing to be replaced. +ACo +AEA-param array +ACQ-replacements Array with the replaced keys. +ACo +ACo +AEA-return array +ACo-/ function array+AF8-replace+AF8-recursive( +ACQ-base +AD0 array(), +ACQ-replacements +AD0 array() ) +AHs foreach ( array+AF8-slice( func+AF8-get+AF8-args(), 1 ) as +ACQ-replacements ) +AHs +ACQ-bref+AF8-stack +AD0 array( +ACYAJA-base )+ADs +ACQ-head+AF8-stack +AD0 array( +ACQ-replacements )+ADs do +AHs end( +ACQ-bref+AF8-stack )+ADs +ACQ-bref +AD0 +ACYAJA-bref+AF8-stack+AFs key( +ACQ-bref+AF8-stack ) +AF0AOw +ACQ-head +AD0 array+AF8-pop( +ACQ-head+AF8-stack )+ADs unset( +ACQ-bref+AF8-stack+AFs key( +ACQ-bref+AF8-stack ) +AF0 )+ADs foreach ( array+AF8-keys( +ACQ-head ) as +ACQ-key ) +AHs if ( isset( +ACQ-key, +ACQ-bref ) +ACYAJg isset( +ACQ-bref+AFs +ACQ-key +AF0 ) +ACYAJg is+AF8-array( +ACQ-bref+AFs +ACQ-key +AF0 ) +ACYAJg isset( +ACQ-head+AFs +ACQ-key +AF0 ) +ACYAJg is+AF8-array( +ACQ-head+AFs +ACQ-key +AF0 ) ) +AHs +ACQ-bref+AF8-stack+AFsAXQ +AD0 +ACYAJA-bref+AFs +ACQ-key +AF0AOw +ACQ-head+AF8-stack+AFsAXQ +AD0 +ACQ-head+AFs +ACQ-key +AF0AOw +AH0 else +AHs +ACQ-bref+AFs +ACQ-key +AF0 +AD0 +ACQ-head+AFs +ACQ-key +AF0AOw +AH0 +AH0 +AH0 while ( count( +ACQ-head+AF8-stack ) )+ADs +AH0 return +ACQ-base+ADs +AH0 endif+ADs // SPL can be disabled on PHP 5.2 if ( +ACE function+AF8-exists( 'spl+AF8-autoload+AF8-register' ) ): +ACQAXw-wp+AF8-spl+AF8-autoloaders +AD0 array()+ADs /+ACoAKg +ACo Autoloader compatibility callback. +ACo +ACo +AEA-since 4.6.0 +ACo +ACo +AEA-param string +ACQ-classname Class to attempt autoloading. +ACo-/ spl+AF8-autoload+AF8-register(function ( +ACQ-classname ) +AHs global +ACQAXw-wp+AF8-spl+AF8-autoloaders+ADs foreach ( +ACQAXw-wp+AF8-spl+AF8-autoloaders as +ACQ-autoloader ) +AHs if ( +ACE is+AF8-callable( +ACQ-autoloader ) ) +AHs // Avoid the extra warning if the autoloader isn't callable. continue+ADs +AH0 call+AF8-user+AF8-func( +ACQ-autoloader, +ACQ-classname )+ADs // If it has been autoloaded, stop processing. if ( class+AF8-exists( +ACQ-classname, false ) ) +AHs return+ADs +AH0 +AH0 +AH0 /+ACoAKg +ACo Registers a function to be autoloaded. +ACo +ACo +AEA-since 4.6.0 +ACo +ACo +AEA-param callable +ACQ-autoload+AF8-function The function to register. +ACo +AEA-param bool +ACQ-throw Optional. Whether the function should throw an exception +ACo if the function isn't callable. Default true. +ACo +AEA-param bool +ACQ-prepend Whether the function should be prepended to the stack. +ACo Default false. +ACo-/ function spl+AF8-autoload+AF8-register( +ACQ-autoload+AF8-function, +ACQ-throw +AD0 true, +ACQ-prepend +AD0 false ) +AHs if ( +ACQ-throw +ACYAJg +ACE is+AF8-callable( +ACQ-autoload+AF8-function ) ) +AHs // String not translated to match PHP core. throw new Exception( 'Function not callable' )+ADs +AH0 global +ACQAXw-wp+AF8-spl+AF8-autoloaders+ADs // Don't allow multiple registration. if ( in+AF8-array( +ACQ-autoload+AF8-function, +ACQAXw-wp+AF8-spl+AF8-autoloaders ) ) +AHs return+ADs +AH0 if ( +ACQ-prepend ) +AHs array+AF8-unshift( +ACQAXw-wp+AF8-spl+AF8-autoloaders, +ACQ-autoload+AF8-function )+ADs +AH0 else +AHs +ACQAXw-wp+AF8-spl+AF8-autoloaders+AFsAXQ +AD0 +ACQ-autoload+AF8-function+ADs +AH0 +AH0 /+ACoAKg +ACo Unregisters an autoloader function. +ACo +ACo +AEA-since 4.6.0 +ACo +ACo +AEA-param callable +ACQ-function The function to unregister. +ACo +AEA-return bool True if the function was unregistered, false if it could not be. +ACo-/ function spl+AF8-autoload+AF8-unregister( +ACQ-function ) +AHs global +ACQAXw-wp+AF8-spl+AF8-autoloaders+ADs foreach ( +ACQAXw-wp+AF8-spl+AF8-autoloaders as +ACYAJA-autoloader ) +AHs if ( +ACQ-autoloader +AD0APQA9 +ACQ-function ) +AHs unset( +ACQ-autoloader )+ADs return true+ADs +AH0 +AH0 return false+ADs +AH0 /+ACoAKg +ACo Retrieves the registered autoloader functions. +ACo +ACo +AEA-since 4.6.0 +ACo +ACo +AEA-return array List of autoloader functions. +ACo-/ function spl+AF8-autoload+AF8-functions() +AHs return +ACQ-GLOBALS+AFs'+AF8-wp+AF8-spl+AF8-autoloaders'+AF0AOw +AH0 endif+ADs