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( 'WeaverA_Customize_Plus_Section' ); // Register sections. // figure out what to show on top bar // !aweaver_getopt('_disable_customizer') $cur_vers = aweaver_wp_version(); $content = ''; if ( false ) { // !@@@@@@@@@ if (function_exists('aweaverplus_plugin_installed')) { $manager->add_section( new WeaverA_Customize_Plus_Section( $manager, 'aweaver_plus_section', array( 'title' => esc_html__( 'Thanks for installing Absolute Weaver Plus.', 'absolute-weaver' ), 'pro_description' => $content ) ) ); } else { $manager->add_section( new WeaverA_Customize_Plus_Section( $manager, 'aweaver_plus_section', array( 'title' => esc_html__( 'Absolute Weaver Plus', 'absolute-weaver' ), 'pro_text' => esc_html__( 'Get Plus', 'absolute-weaver' ), 'pro_url' => 'http://shop.weavertheme.com', 'pro_url_title' => __('Add over 100 new features to Absolute Weaver with the Absolute Wweaver Plus plugin!', 'absolute-weaver'), '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 WeaverA_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.pro_description }}}
<# } #>