当前位置: 首页>>代码示例>>PHP>>正文


PHP WP_Customize_Control::to_json方法代码示例

本文整理汇总了PHP中WP_Customize_Control::to_json方法的典型用法代码示例。如果您正苦于以下问题:PHP WP_Customize_Control::to_json方法的具体用法?PHP WP_Customize_Control::to_json怎么用?PHP WP_Customize_Control::to_json使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在WP_Customize_Control的用法示例。


在下文中一共展示了WP_Customize_Control::to_json方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: to_json

 /**
  * Refresh the parameters passed to the JavaScript via JSON.
  *
  * @see WP_Customize_Media_Control::to_json()
  * @since 0.1
  */
 public function to_json()
 {
     parent::to_json();
     $clc = CLC_Content_Layout_Control();
     $this->json['components'] = array_intersect($this->components, array_keys($clc->components));
     $this->json['i18n'] = $this->i18n;
 }
开发者ID:NateWr,项目名称:content-layout-control,代码行数:13,代码来源:CLC_WP_Customize_Content_Layout_Control.php

示例2: to_json

 /**
  * Refresh the parameters passed to the JavaScript via JSON.
  *
  * @since 3.4.0
  * @since 4.2.0 Moved from WP_Customize_Upload_Control.
  *
  * @see WP_Customize_Control::to_json()
  */
 public function to_json()
 {
     parent::to_json();
     $this->json['label'] = html_entity_decode($this->label, ENT_QUOTES, get_bloginfo('charset'));
     $this->json['mime_type'] = $this->mime_type;
     $this->json['button_labels'] = $this->button_labels;
     $this->json['canUpload'] = current_user_can('upload_files');
     $value = $this->value();
     if (is_object($this->setting)) {
         if ($this->setting->default) {
             // Fake an attachment model - needs all fields used by template.
             // Note that the default value must be a URL, NOT an attachment ID.
             $type = in_array(substr($this->setting->default, -3), array('jpg', 'png', 'gif', 'bmp')) ? 'image' : 'document';
             $default_attachment = array('id' => 1, 'url' => $this->setting->default, 'type' => $type, 'icon' => wp_mime_type_icon($type), 'title' => basename($this->setting->default));
             if ('image' === $type) {
                 $default_attachment['sizes'] = array('full' => array('url' => $this->setting->default));
             }
             $this->json['defaultAttachment'] = $default_attachment;
         }
         if ($value && $this->setting->default && $value === $this->setting->default) {
             // Set the default as the attachment.
             $this->json['attachment'] = $this->json['defaultAttachment'];
         } elseif ($value) {
             $this->json['attachment'] = wp_prepare_attachment_for_js($value);
         }
     }
 }
开发者ID:itspriddle,项目名称:wordpress-playground,代码行数:35,代码来源:class-wp-customize-media-control.php

示例3: to_json

 /**
  * Refresh the parameters passed to the JavaScript via JSON.
  *
  * @since 3.4.0
  * @uses WP_Customize_Control::to_json()
  */
 public function to_json()
 {
     parent::to_json();
     $this->json['statuses'] = $this->statuses;
     $this->json['defaultValue'] = $this->setting->default;
     $this->json['mode'] = $this->mode;
 }
开发者ID:johnpbloch,项目名称:wordpress,代码行数:13,代码来源:class-wp-customize-color-control.php

示例4: to_json

 /**
  * Refresh the parameters passed to the JavaScript via JSON.
  *
  * @since 3.1.0
  * @uses WP_Customize_Control::to_json()
  */
 public function to_json()
 {
     parent::to_json();
     $this->json['posts'] = $this->get_posts();
     $this->json['postTypes'] = $this->post_types;
     $this->json['l10n'] = array('responseError' => __('An error has occurred. Please reload the page and try again.', 'huesos'));
 }
开发者ID:TyRichards,项目名称:ty_the_band,代码行数:13,代码来源:class-cedaro-theme-customize-control-featuredcontent.php

示例5: to_json

 public function to_json()
 {
     parent::to_json();
     $this->json['value'] = $this->value();
     $this->json['choices'] = $this->choices;
     $this->json['link'] = $this->get_link();
 }
开发者ID:Wordpress-Development,项目名称:ornea,代码行数:7,代码来源:class-kirki-controls-number-control.php

示例6: to_json

 public function to_json()
 {
     parent::to_json();
     $exported_properties = array('widget_id', 'widget_id_base', 'sidebar_id', 'width', 'height', 'is_wide', 'is_live_previewable');
     foreach ($exported_properties as $key) {
         $this->json[$key] = $this->{$key};
     }
 }
开发者ID:niceit,项目名称:rockets,代码行数:8,代码来源:class-widget-form-wp-customize-control.php

示例7: to_json

 /**
  * Refreshes the parameters passed to the JavaScript via JSON.
  *
  * @since 3.9.0
  * @access public
  */
 public function to_json()
 {
     parent::to_json();
     $exported_properties = array('sidebar_id');
     foreach ($exported_properties as $key) {
         $this->json[$key] = $this->{$key};
     }
 }
开发者ID:SayenkoDesign,项目名称:ividf,代码行数:14,代码来源:class-wp-widget-area-customize-control.php

示例8: to_json

 /**
  * Add custom parameters to pass to the JS via JSON.
  *
  * @since  3.0.0
  * @access public
  * @return void
  */
 public function to_json()
 {
     parent::to_json();
     $this->json['value'] = !is_array($this->value()) ? explode(',', $this->value()) : $this->value();
     $this->json['choices'] = $this->choices;
     $this->json['link'] = $this->get_link();
     $this->json['id'] = $this->id;
 }
开发者ID:lagrezd,项目名称:dx-coding-standards,代码行数:15,代码来源:control-checkbox-multiple.php

示例9: to_json

 public function to_json()
 {
     parent::to_json();
     if (is_array($this->togglable)) {
         $valid_togglables = array_intersect_key(array_flip($this->togglable), $this->choices);
         $this->json['togglable'] = !empty($valid_togglables);
     } else {
         $this->json['togglable'] = (bool) $this->togglable;
     }
 }
开发者ID:yemingyuen,项目名称:mingsg,代码行数:10,代码来源:class-sortable-control.php

示例10: to_json

 public function to_json()
 {
     parent::to_json();
     $this->json['value'] = $this->value();
     $this->json['choices'] = $this->choices;
     $this->json['link'] = $this->get_link();
     $this->json['numeric_value'] = $this->numeric_value();
     $this->json['unit_value'] = $this->unit_value();
     $this->json['available_units'] = $this->get_units();
 }
开发者ID:apurbajnu,项目名称:kirki,代码行数:10,代码来源:class-kirki-controls-dimension-control.php

示例11: to_json

 public function to_json()
 {
     parent::to_json();
     $this->json['value'] = $this->value();
     $this->json['choices'] = $this->choices;
     $this->json['link'] = $this->get_link();
     $this->json['choices'] = is_array($this->choices) ? array('top' => in_array('top', $this->choices) ? true : false, 'bottom' => in_array('bottom', $this->choices) ? true : false, 'left' => in_array('left', $this->choices) ? true : false, 'right' => in_array('right', $this->choices) ? true : false, 'units' => isset($this->choices['units']) ? $this->choices['units'] : false) : array();
     $i18n = Kirki_Toolkit::i18n();
     $this->json['l10n'] = array('top' => $i18n['top'], 'bottom' => $i18n['bottom'], 'left' => $i18n['left'], 'right' => $i18n['right']);
 }
开发者ID:Wordpress-Development,项目名称:ornea,代码行数:10,代码来源:class-kirki-controls-spacing-control.php

示例12: to_json

 /**
  * Refresh the parameters passed to the JavaScript via JSON.
  *
  * @since 3.4.0
  * @uses WP_Customize_Control::to_json()
  */
 public function to_json()
 {
     parent::to_json();
     $this->json['removed'] = $this->removed;
     if ($this->context) {
         $this->json['context'] = $this->context;
     }
     if ($this->extensions) {
         $this->json['extensions'] = implode(',', $this->extensions);
     }
 }
开发者ID:MatthewEppelsheimer,项目名称:truss,代码行数:17,代码来源:class-Kirki_Customize_Upload_Control.php

示例13: to_json

 public function to_json()
 {
     parent::to_json();
     $this->json['item_title'] = $this->item_title;
     $this->json['item_fields'] = $this->item_fields;
     $this->json['item_key'] = $this->item_key();
     $this->json['item_defaults'] = array();
     foreach ($this->item_fields as $key => $field) {
         $this->json['item_defaults'][$key] = isset($field['std']) ? $field['std'] : '';
     }
 }
开发者ID:yemingyuen,项目名称:mingsg,代码行数:11,代码来源:class-repeater-control.php

示例14: to_json

 public function to_json()
 {
     parent::to_json();
     $this->json['value'] = $this->value();
     $this->json['choices'] = $this->choices;
     $this->json['link'] = $this->get_link();
     $this->json['default'] = $this->setting->default;
     $this->json['choices']['min'] = isset($this->choices['min']) ? $this->choices['min'] : '0';
     $this->json['choices']['max'] = isset($this->choices['max']) ? $this->choices['max'] : '100';
     $this->json['choices']['step'] = isset($this->choices['step']) ? $this->choices['step'] : '1';
 }
开发者ID:Wordpress-Development,项目名称:ornea,代码行数:11,代码来源:class-kirki-controls-slider-control.php

示例15: to_json

 public function to_json()
 {
     parent::to_json();
     $this->json['value'] = $this->value();
     $this->json['link'] = $this->get_link();
     $this->json['description'] = $this->description;
     $this->json['subtitle'] = $this->subtitle;
     $this->json['defaultValue'] = $this->setting->default;
     $this->json['choices'] = $this->choices;
     $this->json['id'] = $this->id;
 }
开发者ID:CantoThemes,项目名称:StarterTheme,代码行数:11,代码来源:CustomizeControl.class.php


注:本文中的WP_Customize_Control::to_json方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。