_WP_Editors::_parse_init() –

You appear to be a bot. Output may be restricted

Description

Usage

$string = _WP_Editors::_parse_init( $init );

Parameters

$init
( array ) required

Returns

string

Source

File name: wordpress/wp-includes/class-wp-editor.php
Lines:

1 to 21 of 21
  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, ' ,' ) . '}';
  }
 

 View on GitHub View on Trac