<?php
/**
* RIT Core Plugin
* @package RIT Core
* @version 0.1
* @author CleverSoft
* @link http://cleversoft.co
* @copyright Copyright (c) 2015 CleverSoft
* @license GPL v2
*/
if (!class_exists('RIT_Customize')) {
class RIT_Customize
{
public $customizers = array();
public $panels = array();
public function init()
{
$this->customizer();
add_action('customize_controls_enqueue_scripts', array($this, 'rit_customizer_script'));
add_action('customize_controls_print_scripts', array($this, 'rit_customizer_controls_print_scripts'));
add_action('customize_register', array($this, 'rit_register_theme_customizer'));
add_action('customize_register', array($this, 'remove_default_customize_section'), 20);
RIT_Customize_Import_Export::getInstance();
}
public static function &getInstance()
{
static $instance;
if (!isset($instance)) {
$instance = new RIT_Customize();
}
return $instance;
}
protected function customizer()
{
$this->panels = array(
'woo_panel' => array(
'title' => 'Woocommerces',
'description' => '',
'priority' => 99,
),
'page_panel' => array(
'title' => 'Page',
'description' => '',
'priority' => 97,
),
'blog_panel' => array(
'title' => 'Blog',
'description' => '',
'priority' => 98,
),
'site_panel' => array(
'title' => 'Site Setting',
'description' => 'Site Setting >',
'priority' => 4,
),
);
$this->customizers = array(
//Woocommerces
'rit_woo_product_list' => array(
'title' => __('Product List', RIT_TEXT_DOMAIN),
'description' => 'This option affects your shop page, product category and product tag pages. ',
'priority' => 0,
'panel' => 'woo_panel',
'settings' => array(
'rit_woo_list_sidebar_left' => array(
'type' => 'checkbox',
'label' => __('Display Left Sidebar', RIT_TEXT_DOMAIN),
'priority' => 0,
'params' => array(
'default' => false,
),
),
'rit_woo_list_sidebar_left_inner' => array(
'class'=> 'sidebar',
'label' => __('Choose Left Sidebar', RIT_TEXT_DOMAIN),
'priority' => 1,
'description' => '',
),
'rit_woo_list_sidebar_right' => array(
'type' => 'checkbox',
'label' => __('Display Right Sidebar', RIT_TEXT_DOMAIN),
'priority' => 2,
'params' => array(
'default' => false,
),
),
'rit_woo_list_sidebar_right_inner' => array(
'class'=> 'sidebar',
'label' => __('Choose Right Sidebar', RIT_TEXT_DOMAIN),
'priority' => 3,
'description' => '',
),
'rit_woo_product_hover' => array(
'type' => 'select',
'label' => __('Enable Image Hover Effect', RIT_TEXT_DOMAIN),
'params' => array(
'default' => 'on',
),
'choices' => array(
'on' => __('Yes', RIT_TEXT_DOMAIN),
'off' => __('No', RIT_TEXT_DOMAIN),
),
),
'rit_woo_product_style' => array(
'type' => 'select',
'label' => __('Style products', RIT_TEXT_DOMAIN),
'params' => array(
'default' => 'default',
),
'choices' => array(
'default' => __('default', RIT_TEXT_DOMAIN),
'border' => __('border', RIT_TEXT_DOMAIN),
),
),
),
),
'rit_woo_product_single' => array(
'title' => __('Single Product', RIT_TEXT_DOMAIN),
'description' => 'This option affects your single product pages. ',
'priority' => 1,
'panel' => 'woo_panel',
'settings' => array(
'rit_woo_single_sidebar_left' => array(
'type' => 'checkbox',
'label' => __('Display Left Sidebar', RIT_TEXT_DOMAIN),
'priority' => 0,
'params' => array(
'default' => false,
),
),
'rit_woo_single_sidebar_left_inner' => array(
'class' => 'sidebar',
'label' => __('Choose Left Sidebar', RIT_TEXT_DOMAIN),
'priority' => 1,
'description' => '',
),
'rit_woo_single_sidebar_right' => array(
'type' => 'checkbox',
'label' => __('Display Right Sidebar', RIT_TEXT_DOMAIN),
'priority' => 2,
'params' => array(
'default' => false,
),
),
'rit_woo_single_sidebar_right_inner' => array(
'class' => 'sidebar',
'label' => __('Choose Left Sidebar', RIT_TEXT_DOMAIN),
'priority' => 3,
'description' => '',
),
'rit_woo_related_products' => array(
'type' => 'checkbox',
'label' => __('Display Related Products', RIT_TEXT_DOMAIN),
'priority' => 4,
'params' => array(
'default' => true,
),
),
'rit_woo_number_related_products' => array(
'type' => 'select',
'label' => __('Number Products Show', RIT_TEXT_DOMAIN),
'description' => '',
'priority' => 5,
'choices' => array(
'2' => '2',
'3' => '3',
'4' => '4',
'5' => '5'
),
'params' => array(
'default' => '4',
),
),
),
),
//PAGE config
'rit_page_sidebar' => array(
'title' => __('Sidebar Page ', RIT_TEXT_DOMAIN),
'description' => 'This option sidebar your Page',
'priority' => 0,
'panel' => 'page_panel',
'settings' => array(
'sidebar_page_left' => array(
'type' => 'checkbox',
'label' => __('Display Left Sidebar', RIT_TEXT_DOMAIN),
'priority' => 0,
'params' => array(
'default' => false,
),
),
'sidebar_page_left_inner' => array(
'class' => 'sidebar',
'label' => __('Choose Left Sidebar', RIT_TEXT_DOMAIN),
'priority' => 1,
'description' => '',
),
'sidebar_page_right' => array(
'type' => 'checkbox',
'label' => __('Display Right Sidebar', RIT_TEXT_DOMAIN),
'priority' => 2,
'params' => array(
'default' => false,
),
),
'sidebar_page_right_inner' => array(
'class' => 'sidebar',
'label' => __('Choose Right Sidebar', RIT_TEXT_DOMAIN),
'priority' => 3,
'description' => '',
),
),
),
//BLOG config
'rit_archive_sidebar' => array(
'title' => __('Blog Archive ', RIT_TEXT_DOMAIN),
'description' => 'This option your Archive blog',
'priority' => 0,
'panel' => 'blog_panel',
'settings' => array(
'sidebar_cat_left' => array(
'type' => 'checkbox',
'label' => __('Display Left Sidebar', RIT_TEXT_DOMAIN),
'priority' => 0,
'params' => array(
'default' => false,
),
),
'sidebar_cat_left_inner' => array(
'class'=> 'sidebar',
'label' => __('Choose Left Sidebar', RIT_TEXT_DOMAIN),
'priority' => 1,
'description' => 'This option sidebar your Archive blog',
),
'sidebar_cat_right' => array(
'type' => 'checkbox',
'label' => __('Display Right Sidebar', RIT_TEXT_DOMAIN),
'priority' => 2,
'params' => array(
'default' => false,
),
),
'sidebar_cat_right_inner' => array(
'class'=> 'sidebar',
'label' => __('Choose Right Sidebar', RIT_TEXT_DOMAIN),
'priority' => 3,
'description' => 'This option sidebar your Archive blog',
),
),
),
'rit_single_sidebar' => array(
'title' => __('Blog Single ', RIT_TEXT_DOMAIN),
'description' => 'This option your single blog',
'priority' => 0,
'panel' => 'blog_panel',
'settings' => array(
'sidebar_single_left' => array(
'type' => 'checkbox',
'label' => __('Display Left Sidebar', RIT_TEXT_DOMAIN),
'priority' => 0,
'params' => array(
'default' => false,
),
),
'sidebar_single_left_inner' => array(
'class'=> 'sidebar',
'label' => __('Choose Left Sidebar', RIT_TEXT_DOMAIN),
'priority' => 1,
'description' => 'This option default sidebar your single blog',
),
'sidebar_single_right' => array(
'type' => 'checkbox',
'label' => __('Display Right Sidebar', RIT_TEXT_DOMAIN),
'priority' => 2,
'params' => array(
'default' => false,
),
),
'sidebar_single_right_inner' => array(
'class'=> 'sidebar',
'label' => __('Choose Right Sidebar', RIT_TEXT_DOMAIN),
'priority' => 3,
'description' => 'This option default sidebar your single blog',
),
),
),
//Header >
'rit_new_section_header' => array(
'title' => __('Header Options', RIT_TEXT_DOMAIN),
'description' => '',
'priority' => 1,
'settings' => array(
'rit_topbar_config' => array(
'type' => 'checkbox',
'label' => __('Enable Topbar', RIT_TEXT_DOMAIN),
'description' => __('Enable/Disable Topbar', RIT_TEXT_DOMAIN),
'priority' => 1,
'params' => array(
'default' => false,
),
),
'rit_menu_config' => array(
'type' => 'checkbox',
'label' => __('Menu full width', RIT_TEXT_DOMAIN),
'description' => __('Menu config', RIT_TEXT_DOMAIN),
'priority' => 2,
'params' => array(
'default' => false,
),
),
'rit_menu_keep' => array(
'type' => 'checkbox',
'label' => __('Enable Menu keep', RIT_TEXT_DOMAIN),
'description' => __('Menu Keep', RIT_TEXT_DOMAIN),
'priority' =>3,
'params' => array(
'default' => false,
),
),
'rit_default_header' => array(
'type' => 'select',
'label' => __('Choose Header Style', RIT_TEXT_DOMAIN),
'description' => '',
'priority' => 0,
'choices' => array(
'1' => __('Header 1', RIT_TEXT_DOMAIN),
'2' => __('Header 2', RIT_TEXT_DOMAIN),
'3' => __('Header 3', RIT_TEXT_DOMAIN),
'4' => __('Header 4', RIT_TEXT_DOMAIN),
'5' => __('Header 5', RIT_TEXT_DOMAIN),
'full' => __('Header Full', RIT_TEXT_DOMAIN)
),
'params' => array(
'default' => '1',
),
),
'rit_logo' => array(
'class' => 'image',
'label' => __('Logo', RIT_TEXT_DOMAIN),
'description' => __('Upload Logo Image', RIT_TEXT_DOMAIN),
'priority' => 2
),
'rit_show_tagline' => array(
'type' => 'radio',
'label' => __('Show Tagline', RIT_TEXT_DOMAIN),
'priority' => 3,
'choices' => array(
'1' => __('Yes', RIT_TEXT_DOMAIN),
'0' => __('No', RIT_TEXT_DOMAIN)
),
'params' => array(
'default' => '1',
),
)
)
),
//Footer >
'rit_new_section_footer' => array(
'title' => __('Footer Options', RIT_TEXT_DOMAIN),
'description' => '',
'priority' => 2,
'settings' => array(
'rit_default_footer' => array(
'type' => 'select',
'label' => __('Choose Footer Style', RIT_TEXT_DOMAIN),
'description' => '',
'priority' => -1,
'choices' => array(
'1' => __('Footer 1', RIT_TEXT_DOMAIN),
'2' => __('Footer 2', RIT_TEXT_DOMAIN)
),
'params' => array(
'default' => '1',
),
),
'rit_enable_footer' => array(
'type' => 'checkbox',
'label' => __('Enable Footer', RIT_TEXT_DOMAIN),
'description' => '',
'priority' => 0,
'params' => array(
'default' => '1',
),
),
'rit_enable_menu_footer' => array(
'type' => 'checkbox',
'label' => __('Enable Menu Footer', RIT_TEXT_DOMAIN),
'description' => '',
'priority' => 0,
'params' => array(
'default' => '1',
),
),
'rit_logo_footer' => array(
'class' => 'image',
'label' => __('Logo', RIT_TEXT_DOMAIN),
'description' => __('Upload Logo Image', RIT_TEXT_DOMAIN),
'priority' => 2
),
'rit_enable_copyright' => array(
'type' => 'checkbox',
'label' => __('Enable Copyright', RIT_TEXT_DOMAIN),
'description' => '',
'priority' => 0,
'params' => array(
'default' => '1',
),
),
'rit_copyright_text' => array(
'type' => 'textarea',
'label' => __('Footer Copyright Text', RIT_TEXT_DOMAIN),
'description' => '',
'priority' => 0
)
)
),
//Font >
'rit_new_section_font_size' => array(
'title' => __('Font', RIT_TEXT_DOMAIN),
'description' => 'Font Option',
'priority' => 3,
'settings' => array(
'rit_body_font_google' => array(
'type' => 'select',
'label' => __('Body', RIT_TEXT_DOMAIN),
'choices' => rit_googlefont(),
'priority' => 0,
'params' => array(
'default' => 'Lato',
),
),
'rit_body_font_standard' => array(
'type' => 'select',
'label' => esc_html__('Body Standard Font', 'colias'),
'description' => '',
'priority' => -3,
'choices' => array(
'Arial' => esc_html__('Arial', 'colias'),
'Courier New' => esc_html__('Courier New', 'colias'),
'Georgia' => esc_html__('Georgia', 'colias'),
'Helvetica' => esc_html__('Helvetica', 'colias'),
'Lucida Sans' => esc_html__('Lucida Sans', 'colias'),
'Lucida Sans Unicode' => esc_html__('Lucida Sans Unicode', 'colias'),
'Myriad Pro' => esc_html__('Myriad Pro', 'colias'),
'Palatino Linotype' => esc_html__('Palatino Linotype', 'colias'),
'Tahoma' => esc_html__('Tahoma', 'colias'),
'Times New Roman' => esc_html__('Times New Roman', 'colias'),
'Trebuchet MS' => esc_html__('Trebuchet MS', 'colias'),
'Verdana' => esc_html__('Verdana', 'colias')
),
'params' => array(
'default' => 'Arial',
),
),
'rit_enable_body_font_size' => array(
'type' => 'number',
'label' => __('Body Font Size', RIT_TEXT_DOMAIN),
'description' => '',
'priority' => 1,
'params' => array(
'default' => '14',
),
),
'rit_enable_menu_font_size' => array(
'type' => 'number',
'label' => __('Menu Font Size', RIT_TEXT_DOMAIN),
'description' => '',
'priority' =>3,
'params' => array(
'default' => '18',
),
),
'rit_enable_title_font_size' => array(
'type' => 'number',
'label' => __('Title Font Size', RIT_TEXT_DOMAIN),
'description' => '',
'priority' =>4,
'params' => array(
'default' => '20',
),
),
)
),
// //Site Setting > rtl
// 'rit_setting_rtl' => array(
// 'title' => __('LTR - RTL ', RIT_TEXT_DOMAIN),
// 'description' => 'This option right to left of site',
// 'priority' => 0,
// 'panel' => 'site_panel',
// 'settings' => array(
// 'rit_site_rtl' => array(
// 'type' => 'select',
// 'label' => __('Choose:', RIT_TEXT_DOMAIN),
// 'description' => '',
// 'priority' => 0,
// 'choices' => array(
// 'rit_ltr' => __('Left to right', RIT_TEXT_DOMAIN),
// 'rit_rtl' => __('Right to left', RIT_TEXT_DOMAIN),
// ),
// 'params' => array(
// 'default' => 'rit_ltr',
// ),
// ),
// )
// ),
//Site Setting > color
'rit_setting_color' => array(
'title' => __('Color ', RIT_TEXT_DOMAIN),
'description' => 'Site Setting > color',
'priority' => 1,
'panel' => 'site_panel',
'settings' => array(
//body
'rit_bg_body' => array(
'label' => __('Background - Body', RIT_TEXT_DOMAIN),
'description' => '',
'class' => 'color',
'priority' => 0,
'params' => array(
'default' => '#FFFFFF',
),
),
'rit_bg_image' => array(
'class' => 'image',
'label' => __('Background Image - Body', RIT_TEXT_DOMAIN),
'priority' => 1
),
//topbar
'rit_bg_topbar' => array(
'label' => __('Background - Top bar', RIT_TEXT_DOMAIN),
'description' => '',
'class' => 'color',
'priority' => 2,
'params' => array(
'default' => '',
),
),
'rit_color_topbar' => array(
'label' => __('Color - Top bar', RIT_TEXT_DOMAIN),
'description' => '',
'class' => 'color',
'priority' => 3,
'params' => array(
'default' => '',
),
),
//header
'rit_bg_header' => array(
'label' => __('Background - Header', RIT_TEXT_DOMAIN),
'description' => '',
'class' => 'color',
'priority' => 4,
'params' => array(
'default' => '#FFF',
),
),
'rit_color_header' => array(
'label' => __('Color - Header', RIT_TEXT_DOMAIN),
'description' => '',
'class' => 'color',
'priority' => 5,
),
//Menu
'rit_bg_menu' => array(
'label' => __('Background - Menu', RIT_TEXT_DOMAIN),
'description' => '',
'class' => 'color',
'priority' => 6,
),
'rit_color_menu' => array(
'label' => __('Color - Menu', RIT_TEXT_DOMAIN),
'description' => '',
'class' => 'color',
'priority' => 7,
'params' => array(
'default' => '#353535',
),
),
'rit_color_hover_menu' => array(
'label' => __('Color hover - Menu', RIT_TEXT_DOMAIN),
'description' => '',
'class' => 'color',
'priority' => 7,
'params' => array(
'default' => '#FD754B',
),
),
//title
'rit_color_title' => array(
'label' => __('Color - Title', RIT_TEXT_DOMAIN),
'description' => '',
'class' => 'color',
'priority' => 8,
),
// footer
'rit_bg_footer_top' => array(
'label' => __('Background - Footer-Top', RIT_TEXT_DOMAIN),
'description' => '',
'class' => 'color',
'priority' => 9,
'params' => array(
'default' => '',
),
),
'rit_color_footer_top' => array(
'label' => __('Color - Footer-Top', RIT_TEXT_DOMAIN),
'description' => '',
'class' => 'color',
'priority' => 10,
'params' => array(
'default' => '',
),
),
'rit_bg_footer' => array(
'label' => __('Background - Footer', RIT_TEXT_DOMAIN),
'description' => '',
'class' => 'color',
'priority' => 11,
'params' => array(
'default' => '#F3F3F3',
),
),
'rit_color_footer' => array(
'label' => __('Color - Footer', RIT_TEXT_DOMAIN),
'description' => '',
'class' => 'color',
'priority' => 12,
'params' => array(
'default' => '#4e4d4d',
),
),
'rit_color_hover_footer' => array(
'label' => __('Link hover - Footer', RIT_TEXT_DOMAIN),
'description' => '',
'class' => 'color',
'priority' => 13,
'params' => array(
'default' => '#F56032',
),
),
)
),
//Site Setting > style sidebar
'rit_setting_style_sidebar' => array(
'title' => __('Style Sidebar ', RIT_TEXT_DOMAIN),
'description' => 'This option style sidebar',
'priority' => 3,
'panel' => 'site_panel',
'settings' => array(
'rit_site_style_sidebar' => array(
'type' => 'select',
'label' => __('Choose:', RIT_TEXT_DOMAIN),
'description' => '',
'priority' => 0,
'choices' => array(
'style_default' => __('Default', RIT_TEXT_DOMAIN),
'style_box' => __('Box', RIT_TEXT_DOMAIN),
),
'params' => array(
'default' => 'style_default',
),
),
'rit_site_box_bg' => array(
'label' => __('Background - Box', RIT_TEXT_DOMAIN),
'description' => '',
'class' => 'color',
'priority' => 1,
'params' => array(
'default' => '#FFFFFF',
),
),
'rit_site_box_color' => array(
'label' => __('Color Text - Box', RIT_TEXT_DOMAIN),
'description' => '',
'class' => 'color',
'priority' => 2,
'params' => array(
'default' => '#353535',
),
),
)
),
//Site Setting > Skins
'rit_setting_skins' => array(
'title' => __('Skins ', RIT_TEXT_DOMAIN),
'description' => 'Site Setting > Skins',
'priority' => 2,
'panel' => 'site_panel',
'settings' => array(
'rit_skins' => array(
'type' => 'select',
'label' => __('Choose:', RIT_TEXT_DOMAIN),
'description' => '',
'priority' => 0,
'choices' => array(
'style-default' => __('Default', RIT_TEXT_DOMAIN),
'style-white' => __('White', RIT_TEXT_DOMAIN),
'style-black' => __('Black', RIT_TEXT_DOMAIN),
'style-gold' => __('Gold', RIT_TEXT_DOMAIN),
'style-red' => __('Red', RIT_TEXT_DOMAIN),
'style-aqua' => __('Aqua', RIT_TEXT_DOMAIN),
'style-green' => __('Green', RIT_TEXT_DOMAIN),
'style-brown' => __('Brown', RIT_TEXT_DOMAIN),
),
'params' => array(
'default' => 'style-default',
),
),
)
),
//Social >
'rit_new_section_social' => array(
'title' => __('Social Profiles', RIT_TEXT_DOMAIN),
'description' => '',
'priority' => 99,
'settings' => array(
'rit_social_twitter' => array(
'type' => 'text',
'label' => __('Twitter', RIT_TEXT_DOMAIN),
'description' => 'Your Twitter username (no @).',
'priority' => 0,
'params' => array(
'default' => 'username',
),
),
'rit_social_facebook' => array(
'type' => 'text',
'label' => __('Facebook', RIT_TEXT_DOMAIN),
'description' => 'Your facebook page/profile url',
'priority' => 1,
'params' => array(
'default' => 'page/profile-url',
),
),
'rit_social_dribbble' => array(
'type' => 'text',
'label' => __('Dribbble', RIT_TEXT_DOMAIN),
'description' => 'Your Dribbble username',
'priority' => 2,
'params' => array(
'default' => 'username',
),
),
'rit_social_vimeo' => array(
'type' => 'text',
'label' => __('Vimeo', RIT_TEXT_DOMAIN),
'description' => 'Your Vimeo username',
'priority' => 3,
'params' => array(
'default' => 'username',
),
),
'rit_social_tumblr' => array(
'type' => 'text',
'label' => __('Tumblr', RIT_TEXT_DOMAIN),
'description' => 'Your Tumblr username',
'priority' => 4,
'params' => array(
'default' => 'username',
),
),
'rit_social_skype' => array(
'type' => 'text',
'label' => __('Skype', RIT_TEXT_DOMAIN),
'description' => 'Your Skype username',
'priority' => 5,
'params' => array(
'default' => 'username',
),
),
'rit_social_linkedin' => array(
'type' => 'text',
'label' => __('LinkedIn', RIT_TEXT_DOMAIN),
'description' => 'Your LinkedIn page/profile url',
'priority' => 6,
'params' => array(
'default' => 'page/profile-url',
),
),
'rit_social_googleplus' => array(
'type' => 'text',
'label' => __('Google+', RIT_TEXT_DOMAIN),
'description' => 'Your Google+ page/profile URL',
'priority' => 7,
'params' => array(
'default' => 'page/profile-url',
),
),
'rit_social_flickr' => array(
'type' => 'text',
'label' => __('Flickr', RIT_TEXT_DOMAIN),
'description' => 'Your Flickr page url',
'priority' => 8,
'params' => array(
'default' => 'page-url',
),
),
'rit_social_youTube' => array(
'type' => 'text',
'label' => __('YouTube', RIT_TEXT_DOMAIN),
'description' => 'Your YouTube URL',
'priority' => 9,
'params' => array(
'default' => 'youtube-url',
),
),
'rit_social_pinterest' => array(
'type' => 'text',
'label' => __('Pinterest', RIT_TEXT_DOMAIN),
'description' => 'Your Pinterest username',
'priority' => 10,
'params' => array(
'default' => 'username',
),
),
'rit_social_foursquare' => array(
'type' => 'text',
'label' => __('Foursquare', RIT_TEXT_DOMAIN),
'description' => 'Your Foursqaure URL',
'priority' => 11,
'params' => array(
'default' => 'url',
),
),
'rit_social_instagram' => array(
'type' => 'text',
'label' => __('Instagram', RIT_TEXT_DOMAIN),
'description' => 'Your Instagram username',
'priority' => 12,
'params' => array(
'default' => 'username',
),
),
'rit_social_github' => array(
'type' => 'text',
'label' => __('GitHub', RIT_TEXT_DOMAIN),
'description' => 'Your GitHub URL',
'priority' => 13,
'params' => array(
'default' => 'url',
),
),
'rit_social_xing' => array(
'type' => 'text',
'label' => __('Xing', RIT_TEXT_DOMAIN),
'description' => 'Your Xing URL',
'priority' => 14,
'params' => array(
'default' => 'url',
),
),
)
),
'rit_new_section_export_import' => array(
'title' => __('Export/Import', 'customizer-export-import'),
'priority' => 5,
'settings' => array(
'rit-setting' => array(
'class' => 'cei',
'priority' => 1
)
),
),
);
}
public function rit_customizer_script()
{
// Register
wp_enqueue_style('rit-customize-css', RIT_PLUGIN_URL . 'inc/customize/assets/css/customizer.css', array(), RIT_VERSION);
wp_enqueue_script('rit-customize-js', RIT_PLUGIN_URL . 'inc/customize/assets/js/customizer.js', array('jquery'), RIT_VERSION, true);
// Localize
wp_localize_script('rit-customize-js', 'RIT_Customize_Import_Export_l10n', array(
'emptyImport' => __('Please choose a file to import.', RIT_TEXT_DOMAIN)
));
// Config
wp_localize_script('rit-customize-js', 'RIT_Customize_Import_Export_Config', array(
'customizerURL' => admin_url('customize.php'),
'exportNonce' => wp_create_nonce('rit-exporting')
));
}
/**
* @method controls_print_scripts
*/
public function rit_customizer_controls_print_scripts()
{
global $cei_error;
if ($cei_error) {
echo '<script> alert("' . $cei_error . '"); </script>';
}
}
public function add_customize($customizers) {
$this->customizers = array_merge($this->customizers, $customizers);
}
public function rit_register_theme_customizer()
{
global $wp_customize;
foreach ($this->customizers as $section => $section_params) {
//add section
$wp_customize->add_section($section, $section_params);
if (isset($section_params['settings']) && count($section_params['settings']) > 0) {
foreach ($section_params['settings'] as $setting => $params) {
//add setting
$setting_params = array();
if (isset($params['params'])) {
$setting_params = $params['params'];
unset($params['params']);
}
$wp_customize->add_setting($setting, $setting_params);
//Get class control
$class = 'WP_Customize_Control';
if (isset($params['class']) && !empty($params['class'])) {
$class = 'WP_Customize_' . ucfirst($params['class']) . '_Control';
unset($params['class']);
}
//add params section and settings
$params['section'] = $section;
$params['settings'] = $setting;
//add controll
$wp_customize->add_control(
new $class($wp_customize, $setting, $params)
);
}
}
}
foreach($this->panels as $key => $panel){
$wp_customize->add_panel($key, $panel);
}
return;
}
public function remove_default_customize_section()
{
global $wp_customize;
// // Remove Sections
// $wp_customize->remove_section('title_tagline');
$wp_customize->remove_section('header_image');
$wp_customize->remove_section('nav');
$wp_customize->remove_section('static_front_page');
$wp_customize->remove_section('colors');
$wp_customize->remove_section('background_image');
}
}
}