protected function _build_controls()
 {
     $this->_add_control('_header', ['description' => $this->description, 'label' => $this->label], 'Header');
     $this->manager->add_setting("{$this->id}[post_id]", ['type' => 'option', 'transport' => 'postMessage']);
     add_action("customize_save_{$this->_panel}", function ($setting) {
         if ($setting->id == "{$this->id}[post_id]") {
             $this->_save_post_id($setting);
         }
     });
     $control = new \WP_Customize_Control($this->manager, "{$this->id}[post_id]", ['type' => 'hidden', 'section' => $this->section, 'input_attrs' => ['style' => 'width: 100%;', 'data-post_type' => isset($this->post_type) ? $this->post_type : 'post', 'data-placeholder' => __('— Select —')]]);
     $control->input_attrs['data-value'] = get_the_title($control->value());
     $this->manager->add_control($control);
 }
 /**
  * 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;
 }
 /**
  * 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;
 }
 /**
  * This function enqueues scripts and styles
  */
 public function enqueue()
 {
     wp_enqueue_script('sds-theme-options-customizer-color-scheme', SDS_Theme_Options::sds_core_url() . '/js/customizer-sds-theme-options-color-scheme.js', array('customize-base', 'customize-controls'), SDS_Theme_Options::get_version());
     wp_localize_script('sds-theme-options-customizer-color-scheme', 'sds_color_schemes_customizer', array('color_schemes' => sds_color_schemes(), 'controls' => $this->color_controls));
     // Call the parent enqueue method here
     parent::enqueue();
 }
 public function __construct($manager, $id, $args = array())
 {
     if (isset($args['taxonomy']) && in_array($args['taxonomy'], get_taxonomies())) {
         $this->taxonomy = $args['taxonomy'];
     }
     parent::__construct($manager, $id, $args);
 }
 /**
  * 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);
         }
     }
 }
 /**
  * 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'));
 }
 public function __construct($manager, $id, $args = array())
 {
     parent::__construct($manager, $id, $args);
     if ($this->font_set_filter) {
         $this->font_set = apply_filters($this->font_set_filter, $this->font_set, $this->id);
     }
 }
 /**
  * Constructor.
  *
  * @since 3.4.0
  * @uses WP_Customize_Control::__construct()
  *
  * @param WP_Customize_Manager $manager
  * @param string $id
  * @param array $args
  */
 public function __construct($manager, $id, $args = array())
 {
     parent::__construct($manager, $id, $args);
     if (!empty($args['choices'])) {
         $this->colours = $args['choices'];
     }
 }
 public function to_json()
 {
     parent::to_json();
     $this->json['value'] = $this->value();
     $this->json['choices'] = $this->choices;
     $this->json['link'] = $this->get_link();
 }
 /**
  * Constructor for our custom control.
  *
  * @param object $wp_customize
  * @param string $control_id
  * @param array $args
  * @uses Site_Logo_Image_Control::l10n()
  */
 public function __construct($wp_customize, $control_id, $args = array())
 {
     // declare these first so they can be overridden
     $this->l10n = array('upload' => __('Add logo', 'layerswp'), 'set' => __('Set as logo', 'layerswp'), 'choose' => __('Choose logo', 'layerswp'), 'change' => __('Change logo', 'layerswp'), 'remove' => __('Remove logo', 'layerswp'), 'placeholder' => __('No logo set', 'layerswp'));
     $this->directory_uri = LAYERS_TEMPLATE_URI . '/core/third-party/site-logo/';
     parent::__construct($wp_customize, $control_id, $args);
 }
 public function __construct($manager, $id, $args = array())
 {
     parent::__construct($manager, $id, $args);
     if (!empty($args['llorix_one_lite_message'])) {
         $this->message = $args['llorix_one_lite_message'];
     }
 }
 public function __construct($manager, $id, $args = array())
 {
     parent::__construct($manager, $id, $args);
     if (!empty($args['parallax_message'])) {
         $this->message = $args['parallax_message'];
     }
 }
 public function __construct($manager, $id, $args = array())
 {
     $_opt_prefix = TC_wfc::$instance->plug_option_prefix;
     $this->customs = get_option("{$_opt_prefix}_customs_" . TC_wfc::$theme_name);
     $this->lang_domain = TC_wfc::$instance->plug_lang;
     $this->selector_settings = TC_wfc::$instance->tc_get_selector_list();
     parent::__construct($manager, $id, $args);
 }
 /**
  * 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;
 }
 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};
     }
 }
 public function enqueue()
 {
     parent::enqueue();
     $suffix = defined('SCRIPT_DEBUG') && SCRIPT_DEBUG ? '' : '.min';
     wp_enqueue_style('switchery', get_template_directory_uri() . "/lib/framework/customizer/controls/assets/plugins/switchery/switchery{$suffix}.css", array(), '0.7.0', 'screen');
     wp_enqueue_script('switchery', get_template_directory_uri() . "/lib/framework/customizer/controls/assets/plugins/switchery/switchery{$suffix}.js", array(), '0.7.0', true);
     wp_enqueue_script('youxi-switch-control', get_template_directory_uri() . "/lib/framework/customizer/controls/assets/js/switch-control.js", array('switchery'), YOUXI_CUSTOMIZER_VERSION, true);
 }
 public function __construct($manager, $id, $args = array())
 {
     parent::__construct($manager, $id, $args);
     if (empty($args['psu_args']) || !is_array($args['psu_args'])) {
         $args['psu_args'] = array();
     }
     $this->psu_args = $args['psu_args'];
 }
Beispiel #19
0
 public function enqueue()
 {
     wp_register_style('zerowp-customizer-ui-slider-styles', plugin_dir_url(__FILE__) . 'assets/styles.css');
     wp_enqueue_style('zerowp-customizer-ui-slider-styles');
     wp_register_script('zerowp-customizer-ui-slider-scripts', plugin_dir_url(__FILE__) . 'assets/scripts.js', array('jquery', 'jquery-ui-core'), false, true);
     wp_enqueue_script('zerowp-customizer-ui-slider-scripts');
     parent::enqueue();
 }
 /**
  * Test WP_Customize_Control::check_capabilities().
  *
  * @see WP_Customize_Control::check_capabilities()
  */
 function test_check_capabilities()
 {
     do_action('customize_register', $this->wp_customize);
     $control = new WP_Customize_Control($this->wp_customize, 'blogname', array('settings' => array('blogname')));
     $this->assertTrue($control->check_capabilities());
     $control = new WP_Customize_Control($this->wp_customize, 'blogname', array('settings' => array('blogname', 'non_existing')));
     $this->assertFalse($control->check_capabilities());
     $this->wp_customize->add_setting('top_secret_message', array('capability' => 'top_secret_clearance'));
     $control = new WP_Customize_Control($this->wp_customize, 'blogname', array('settings' => array('blogname', 'top_secret_clearance')));
     $this->assertFalse($control->check_capabilities());
     $control = new WP_Customize_Control($this->wp_customize, 'no_setting', array('settings' => array()));
     $this->assertTrue($control->check_capabilities());
     $control = new WP_Customize_Control($this->wp_customize, 'no_setting', array('settings' => array(), 'capability' => 'top_secret_clearance'));
     $this->assertFalse($control->check_capabilities());
     $control = new WP_Customize_Control($this->wp_customize, 'no_setting', array('settings' => array(), 'capability' => 'edit_theme_options'));
     $this->assertTrue($control->check_capabilities());
 }
 public function __construct($wp_customize, $id, $args, $field)
 {
     if (isset($args['type'])) {
         $args['type'] = 'wpdlib_' . $args['type'];
     }
     parent::__construct($wp_customize, $id, $args);
     $this->_field = $field;
 }
 public function enqueue()
 {
     parent::enqueue();
     $suffix = defined('SCRIPT_DEBUG') && SCRIPT_DEBUG ? '' : '.min';
     if (!wp_script_is('youxi-multicheck-control')) {
         wp_enqueue_script('youxi-multicheck-control', get_template_directory_uri() . "/lib/framework/customizer/controls/assets/js/multicheck-control{$suffix}.js", array('jquery'), YOUXI_CUSTOMIZER_VERSION, true);
     }
 }
 /**
  * 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};
     }
 }
Beispiel #24
0
 public function enqueue()
 {
     wp_register_style('zerowp-customizer-font-styles', plugin_dir_url(__FILE__) . 'assets/style.css');
     wp_enqueue_style('zerowp-customizer-font-styles');
     wp_register_script('zerowp-customizer-font-scripts', plugin_dir_url(__FILE__) . 'assets/scripts.js', 'jquery', false, true);
     wp_enqueue_script('zerowp-customizer-font-scripts');
     parent::enqueue();
 }
 public function __construct($manager, $id, $args = array())
 {
     parent::__construct($manager, $id, $args);
     $this->section = $args['element']['section'];
     $this->label = isset($args['element']['title']) ? $args['element']['title'] : "";
     $this->description = isset($args['element']['description']) ? $args['element']['description'] : '';
     $this->type = $args['element']['type'];
     $this->element['custom_attrs'] = array();
 }
 /**
  * Test WP_Customize_Control::check_capabilities().
  *
  * @see WP_Customize_Control::check_capabilities()
  */
 function test_check_capabilities()
 {
     wp_set_current_user(self::factory()->user->create(array('role' => 'administrator')));
     do_action('customize_register', $this->wp_customize);
     $control = new WP_Customize_Control($this->wp_customize, 'blogname', array('settings' => array('blogname')));
     $this->assertTrue($control->check_capabilities());
     $control = new WP_Customize_Control($this->wp_customize, 'blogname', array('settings' => array('blogname', 'non_existing')));
     $this->assertFalse($control->check_capabilities());
     $this->wp_customize->add_setting('top_secret_message', array('capability' => 'top_secret_clearance'));
     $control = new WP_Customize_Control($this->wp_customize, 'blogname', array('settings' => array('blogname', 'top_secret_clearance')));
     $this->assertFalse($control->check_capabilities());
     $control = new WP_Customize_Control($this->wp_customize, 'no_setting', array('settings' => array()));
     $this->assertTrue($control->check_capabilities());
     $control = new WP_Customize_Control($this->wp_customize, 'no_setting', array('settings' => array(), 'capability' => 'top_secret_clearance'));
     $this->assertFalse($control->check_capabilities());
     $control = new WP_Customize_Control($this->wp_customize, 'no_setting', array('settings' => array(), 'capability' => 'edit_theme_options'));
     $this->assertTrue($control->check_capabilities());
 }
Beispiel #27
0
 public function __construct($manager, $id, $args = array())
 {
     parent::__construct($manager, $id, $args);
     $this->choices = array();
     $post_types = \Morepress\Post_Type::find(array(), 'object');
     foreach ($post_types as $key => $item) {
         $this->choices[$key] = $item->labels->name;
     }
 }
 /**
  * This function enqueues scripts and styles
  */
 public function enqueue()
 {
     // Stylesheets
     // TODO
     // Scripts
     // TODO
     // Call the parent enqueue method here
     parent::enqueue();
 }
 public function enqueue()
 {
     parent::enqueue();
     $suffix = defined('SCRIPT_DEBUG') && SCRIPT_DEBUG ? '' : '.min';
     if (!wp_script_is('youxi-google-font-control')) {
         wp_enqueue_script('youxi-google-font-control', get_template_directory_uri() . "/lib/framework/customizer/controls/assets/js/google-font-control{$suffix}.js", array('jquery'), YOUXI_CUSTOMIZER_VERSION, true);
         wp_localize_script('youxi-google-font-control', '_youxiCustomizeGoogleFonts', Youxi_Google_Font::fetch());
     }
 }
 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();
 }