Functions

_()

_($string) 
package PHP

Parameters

$string

Autoloader compatibility callback.

__autoload(string $classname) 
package PHP
since 4.6.0

Parameters

$classname

string

Class to attempt autoloading.

_json_decode_object_helper()

_json_decode_object_helper(object $data) : array
package PHP

Parameters

$data

object

Returns

array

PHP-agnostic version of {@link array_replace_recursive()}.

array_replace_recursive(array $base = array(), array $replacements = array()) : array

The array_replace_recursive() function is a PHP 5.3 function. WordPress currently supports down to PHP 5.2, so this method is a workaround for PHP 5.2.

Note: array_replace_recursive() supports infinite arguments, but for our use- case, we only need to support two arguments.

Subject to removal once WordPress makes PHP 5.3.0 the minimum requirement.

package PHP
since 4.5.3
see

Parameters

$base

array

Array with keys needing to be replaced.

$replacements

array

Array with the replaced keys.

Returns

array

Timing attack safe string comparison

hash_equals(string $a, string $b) : boolean

Compares two strings using the same time whether they're equal or not.

This function was added in PHP 5.6.

Note: It can leak the length of a string when arguments of differing length are supplied.

package PHP
since 3.9.2

Parameters

$a

string

Expected string.

$b

string

Actual, user supplied, string.

Returns

booleanWhether strings are equal.

Polyfill for is_countable() function added in PHP 7.3.

is_countable(mixed $var) : boolean

Verify that the content of a variable is an array or an object implementing the Countable interface.

package PHP
since 4.9.6

Parameters

$var

mixed

The value to check.

Returns

booleanTrue if `$var` is countable, false otherwise.

Polyfill for is_iterable() function added in PHP 7.1.

is_iterable(mixed $var) : boolean

Verify that the content of a variable is an array or an object implementing the Traversable interface.

package PHP
since 4.9.6

Parameters

$var

mixed

The value to check.

Returns

booleanTrue if `$var` is iterable, false otherwise.

json_decode()

json_decode(string $string, boolean $assoc_array = false) : object | array
package PHP
global Services_JSON $wp_json

Parameters

$string

string

$assoc_array

boolean

Returns

objectarray

json_encode()

json_encode($string) 
package PHP

Parameters

$string

Retrieves the registered autoloader functions.

spl_autoload_functions() : array
package PHP
since 4.6.0

Returns

arrayList of autoloader functions.

Registers a function to be autoloaded.

spl_autoload_register(callable $autoload_function, boolean $throw = true, boolean $prepend = false
package PHP
since 4.6.0

Parameters

$autoload_function

callable

The function to register.

$throw

boolean

Optional. Whether the function should throw an exception if the function isn't callable. Default true.

$prepend

boolean

Whether the function should be prepended to the stack. Default false.

Unregisters an autoloader function.

spl_autoload_unregister(callable $function) : boolean
package PHP
since 4.6.0

Parameters

$function

callable

The function to unregister.

Returns

booleanTrue if the function was unregistered, false if it could not be.

Classes, interfaces, and traits

JsonSerializable

JsonSerializable interface.

« More »

Constants

 

JSON_PRETTY_PRINT

JSON_PRETTY_PRINT = 128 
package PHP
 

WP_JSON_SERIALIZE_COMPATIBLE

WP_JSON_SERIALIZE_COMPATIBLE = true 
package PHP