本文整理汇总了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;
}
示例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);
}
}
}
示例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;
}
示例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();
}
示例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};
}
}
示例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};
}
}
示例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;
}
示例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;
}
}
示例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();
}
示例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']);
}
示例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);
}
}
示例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'] : '';
}
}
示例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';
}
示例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;
}