_WP_Editors::_parse_init()private staticWP 3.3.0

Method of the class: _WP_Editors{}

No Hooks.

Return

String.

Usage

$result = _WP_Editors::_parse_init( $init );
$init(array) (required)
-

Changelog

Since 3.3.0 Introduced.

_WP_Editors::_parse_init() code WP 6.6.2

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, ' ,' ) . '}';
}