function __construct($settings, $owner) { $this->owner = $owner; $this->settings = array_merge($this->defaultSettings, $settings); if (empty($this->settings['name'])) { $this->settings['name'] = __('More Options', TF_I18NDOMAIN); } if (empty($this->settings['id'])) { $this->settings['id'] = $this->owner->optionNamespace . '_' . str_replace(' ', '-', trim(strtolower($this->settings['name']))); } if (empty($this->settings['panel_id'])) { $this->settings['panel_id'] = $this->owner->optionNamespace . '_' . str_replace(' ', '-', trim(strtolower($this->settings['panel']))); } // Register the customizer control. add_action('customize_register', array($this, 'register')); // Enqueue required customizer styles & scripts. tf_add_action_once('customize_controls_enqueue_scripts', array($this, 'loadUploaderScript')); // Clear local storage, we use it for remembering modified customizer values. tf_add_action_once('customize_controls_print_footer_scripts', array($this, 'initLocalStorage')); // Generate the custom CSS for live previews. tf_add_action_once('wp_ajax_tf_generate_customizer_css', array($this, 'ajaxGenerateCustomizerCSS')); // Modify the values of the options for the generation of CSS with the values from the customizer $_POST. global $wp_customize; if (isset($wp_customize)) { tf_add_filter_once('tf_pre_get_value_' . $this->owner->optionNamespace, array($this, 'useCustomizerModifiedValue'), 10, 3); } }
/** * 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; } }