_WP_Editors::_parse_init() private WP 3.3.0
{} It's a method of the class: _WP_Editors{}
This is an internal function for using it by WP core itself. It's not recommended to use this function in your code.
No Hooks.
Return
String
. Null. Nothing.
Usage
$result = _WP_Editors::_parse_init( $init );
- $init(array) (required)
- -
Changelog
Since 3.3.0 | Introduced. |
Code of _WP_Editors::_parse_init() WP Editors:: parse init WP 5.7
private static function _parse_init( $init ) {
$options = '';
foreach ( $init as $key => $value ) {
if ( is_bool( $value ) ) {
$val = $value ? 'true' : 'false';
$options .= $key . ':' . $val . ',';
continue;
} elseif ( ! empty( $value ) && is_string( $value ) && (
( '{' === $value[0] && '}' === $value[ strlen( $value ) - 1 ] ) ||
( '[' === $value[0] && ']' === $value[ strlen( $value ) - 1 ] ) ||
preg_match( '/^\(?function ?\(/', $value ) ) ) {
$options .= $key . ':' . $value . ',';
continue;
}
$options .= $key . ':"' . $value . '",';
}
return '{' . trim( $options, ' ,' ) . '}';
}