/**
  * Constructor
  *
  * @since	1.4
  */
 function __construct($settings, $owner)
 {
     parent::__construct($settings, $owner);
     tf_add_action_once('admin_enqueue_scripts', array($this, 'enqueueSlider'));
     tf_add_action_once('customize_controls_enqueue_scripts', array($this, 'enqueueSlider'));
     add_action('admin_head', array(__CLASS__, 'createSliderScript'));
 }
 /**
  * Constructor
  *
  * @param array  $settings Option settings
  * @param string $owner    Namespace
  *
  * @since    1.9.3
  */
 function __construct($settings, $owner)
 {
     parent::__construct($settings, $owner);
     tf_add_action_once('admin_enqueue_scripts', array($this, 'load_select_scripts'));
     tf_add_action_once('customize_controls_enqueue_scripts', array($this, 'load_select_scripts'));
     tf_add_action_once('admin_head', array($this, 'init_select_script'));
     tf_add_action_once('customize_controls_print_footer_scripts', array($this, 'init_select_script'));
 }
 /**
  * Constructor
  *
  * @since	1.4
  */
 function __construct($settings, $owner)
 {
     parent::__construct($settings, $owner);
     tf_add_action_once('admin_enqueue_scripts', array($this, 'enqueueDatepicker'));
     tf_add_action_once('customize_controls_enqueue_scripts', array($this, 'enqueueDatepicker'));
     add_action('admin_head', array(__CLASS__, 'createCalendarScript'));
     if (empty(self::$date_epoch)) {
         self::$date_epoch = date('Y-m-d', 0);
     }
 }
 /**
  * Constructor
  *
  * @return	void
  * @since	1.4
  */
 function __construct($settings, $owner)
 {
     parent::__construct($settings, $owner);
     tf_add_action_once('admin_enqueue_scripts', array($this, 'loadAdminScripts'));
     tf_add_action_once('customize_controls_enqueue_scripts', array($this, 'loadAdminScripts'));
     tf_add_action_once('admin_head', array(__CLASS__, 'createFontScript'));
     tf_add_action_once('wp_enqueue_scripts', array($this, 'enqueueGooglefonts'));
     add_filter('tf_generate_css_font_' . $this->getOptionNamespace(), array($this, 'generateCSS'), 10, 2);
     // Customizer preview handling
     tf_add_action_once('tf_generate_customizer_preview_js', array($this, 'generateCustomizerPreviewJS'));
     tf_add_filter_once('tf_generate_customizer_preview_css_' . $this->getOptionNamespace(), array($this, 'generateCustomizerPreviewCSS'));
     if ($this->settings['enqueue']) {
         self::$optionsToEnqueue[] = $this;
     }
 }
Exemplo n.º 5
0
 public function register($wp_customize)
 {
     add_action('wp_head', array($this, 'printPreviewCSS'), 1000);
     // Create the panel
     if (!empty($this->settings['panel_id'])) {
         $existingPanels = $wp_customize->panels();
         if (!array_key_exists($this->settings['panel_id'], $existingPanels)) {
             $wp_customize->add_panel($this->settings['panel_id'], array('title' => $this->settings['panel'], 'priority' => $this->settings['position'], 'capability' => $this->settings['capability'], 'description' => !empty($this->settings['panel_desc']) ? $this->settings['panel_desc'] : ''));
         }
     }
     // Create the section
     $existingSections = $wp_customize->sections();
     if (!array_key_exists($this->settings['id'], $existingSections)) {
         $wp_customize->add_section($this->settings['id'], array('title' => $this->settings['name'], 'priority' => $this->settings['position'], 'description' => $this->settings['desc'], 'capability' => $this->settings['capability'], 'panel' => empty($this->settings['panel_id']) ? '' : $this->settings['panel_id']));
     }
     // Unfortunately we have to call each option's register from here
     foreach ($this->options as $index => $option) {
         if (!empty($option->settings['id'])) {
             $namespace = $this->owner->optionNamespace;
             $option_type = $option->settings['type'];
             $transport = empty($option->settings['livepreview']) && empty($option->settings['css']) ? 'refresh' : 'postMessage';
             /**
              * Allow options to override the transport mode of an option in the customizer
              *
              * @since 1.9.2
              */
             $transport = apply_filters("tf_customizer_transport_{$option_type}_{$namespace}", $transport, $option);
             $wp_customize->add_setting($option->getID(), array('default' => $option->settings['default'], 'transport' => $transport));
         }
         // We add the index here, this will be used to order the controls because of this minor bug:
         // https://core.trac.wordpress.org/ticket/20733
         $option->registerCustomizerControl($wp_customize, $this, $index + 100);
     }
     add_action('wp_footer', array($this, 'livePreview'));
     tf_add_action_once('wp_footer', array($this, 'livePreviewMainScript'));
 }
 function __construct($settings, $owner)
 {
     parent::__construct($settings, $owner);
     tf_add_action_once('admin_enqueue_scripts', array($this, 'enqueueColorPickerScript'));
     tf_add_action_once('admin_footer', array($this, 'startColorPicker'));
 }