setup_actions(); } return $instance; } /** * Constructor method. * * @since 1.0.0 * @access private * @return void */ private function __construct() {} /** * Sets up initial actions. * * @since 1.0.0 * @access private * @return void */ private function setup_actions() { // Register panels, sections, settings, controls, and partials. add_action( 'customize_register', array( $this, 'sections' ) ); // Register scripts and styles for the controls. add_action( 'customize_controls_enqueue_scripts', array( $this, 'enqueue_control_scripts' ), 0 ); } /** * Sets up the customizer sections. * * @since 1.0.0 * @access public * @param object $manager * @return void */ public function sections( $manager ) { // Load custom sections. //require_once( trailingslashit( get_template_directory() ) . 'trt-customize-pro/weaver-x-plus/section-pro.php' ); // Register custom section types. $manager->register_section_type( 'WeaverX_Customize_Plus_Section' ); // Register sections. // figure out what to show on top bar // !weaverx_getopt('_disable_customizer') $cur_vers = weaverx_wp_version(); $content = ''; if (version_compare($cur_vers, '4.5', '<')) { $msgpost = __('The Site Preview window will refresh much faster after you update to the latest WP version.','weaver-xtreme'); $content .= "{$msgpost}
')"; } $level = weaverx_options_level(); if ( weaverx_getopt('_disable_customizer') ) { $content .= "" . __('Weaver Xtreme Customizer Options Disabled','weaver-xtreme') . ""; } else if ($level == 0) { // not set yet... $content .= "Please set the Options Interface Level"; } else { switch ($level) { case WEAVERX_LEVEL_ADVANCED: $msgpost = '' . __('Full','weaver-xtreme') . ''; break; case WEAVERX_LEVEL_INTERMEDIATE: $msgpost = '' . __('Standard', 'weaver-xtreme') . ''; break; case WEAVERX_LEVEL_BEGINNER: default: $msgpost = '' . __('Basic', 'weaver-xtreme') . ''; break; } // add guide link? // Weaver Xtreme Online Guide $content .= "Weaver Interface Level: {$msgpost}"; } if (function_exists('weaverxplus_plugin_installed')) { $manager->add_section( new WeaverX_Customize_Plus_Section( $manager, 'weaverx_plus_section', array( 'title' => esc_html__( 'Thanks for installing Xtreme Plus.', 'weaver-xtreme' ), 'pro_description' => $content ) ) ); } else { $manager->add_section( new WeaverX_Customize_Plus_Section( $manager, 'weaverx_plus_section', array( 'title' => esc_html__( 'Weaver Xtreme Plus', 'weaver-xtreme' ), 'pro_text' => esc_html__( 'Get Plus', 'weaver-xtreme' ), 'pro_url' => 'http://shop.weavertheme.com', 'pro_url_title' => __('Add over 100 new features to Weaver Xtreme with the Xtreme Plus plugin!', 'weaver-xtreme'), 'pro_description' => $content ) ) ); } } /** * Loads theme customizer CSS. * * @since 1.0.0 * @access public * @return void */ public function enqueue_control_scripts() { wp_enqueue_script( 'weaver-x-plus-customize-controls', trailingslashit( get_template_directory_uri() ) . 'admin/customizer/trt-customize-pro/customize-controls.js', array( 'customize-controls' ) ); wp_enqueue_style( 'weaver-x-plus-customize-controls', trailingslashit( get_template_directory_uri() ) . 'admin/customizer/trt-customize-pro/customize-controls.css' ); } } /** * Pro customizer section. * Based on trt-customize-pro * * @since 1.0.0 * @access public */ if (class_exists('WP_Customize_Section')) { class WeaverX_Customize_Plus_Section extends WP_Customize_Section { /** * The type of customize section being rendered. * * @since 1.0.0 * @access public * @var string */ public $type = 'weaverx-plus-add'; /** * Custom button text to output. * * @since 1.0.0 * @access public * @var string */ public $pro_text = ''; /** * Custom pro button URL. * * @since 1.0.0 * @access public * @var string */ public $pro_url = ''; public $pro_url_title = ''; public $pro_description = ''; /** * Add custom parameters to pass to the JS via JSON. * * @since 1.0.0 * @access public * @return void */ public function json() { $json = parent::json(); $json['pro_text'] = $this->pro_text; $json['pro_url'] = esc_url( $this->pro_url ); $json['pro_url_title'] = $this->pro_url_title; $json['pro_description'] = $this->pro_description; return $json; } /** * Outputs the Underscore.js template. * * @since 1.0.0 * @access public * @return void */ protected function render_template() { ?>
  • {{ data.title }} <# if ( data.pro_text && data.pro_url ) { #> {{ data.pro_text }} <# } #>

    <# if ( data.pro_description ) { #>

    {{{ data.pro_description }}}

    <# } #>
  • is_theme_active() ) return WEAVERX_LEVEL_BEGINNER; else return get_theme_mod('_options_level'); } endif; ?>