/**
 * A wrapper function to register control settings
 *
 * @param WP_Customize $wp_customize
 * @param string $section
 * @param array $controls
 * @param string $type
 *
 * @return null
 */
function wp_add_settings_and_controls($wp_customize, $section, $controls, $type)
{
    foreach ($controls as $control => $label) {
        $wp_customize->add_setting($control);
        $wp_customize->add_control(new WP_Customize_Control($wp_customize, $control . '_control', array('label' => $label, 'section' => $section, 'settings' => $control, 'type' => $type)));
    }
}
/**
 * Registers the theme setting controls with the Theme Customizer
 * 
 * @author	Konstantin Obenland
 * @since	1.4.0 - 05.05.2012
 * 
 * @param	WP_Customize	$wp_customize
 * 
 * @return	void
 */
function the_bootstrap_customize_register($wp_customize)
{
    $wp_customize->add_section('the_bootstrap_theme_options', array('title' => __('Theme Options', 'the-bootstrap'), 'priority' => 99));
    // Add settings
    foreach (array_keys(the_bootstrap_get_default_theme_options()) as $setting) {
        $wp_customize->add_setting("the_bootstrap_theme_options[{$setting}]", array('default' => the_bootstrap_options()->{$setting}, 'type' => 'option', 'transport' => 'postMessage'));
    }
    // Theme Layout
    $wp_customize->add_control('the_bootstrap_theme_layout', array('label' => __('Default Layout', 'the-bootstrap'), 'section' => 'the_bootstrap_theme_options', 'settings' => 'the_bootstrap_theme_options[theme_layout]', 'type' => 'radio', 'choices' => array('content-sidebar' => __('Content on left', 'the-bootstrap'), 'sidebar-content' => __('Content on right', 'the-bootstrap'))));
    // Sitename in Navbar
    $wp_customize->add_control('the_bootstrap_navbar_site_name', array('label' => __('Add site name to navigation bar.', 'the-bootstrap'), 'section' => 'the_bootstrap_theme_options', 'settings' => 'the_bootstrap_theme_options[navbar_site_name]', 'type' => 'checkbox'));
    // Searchform in Navbar
    $wp_customize->add_control('the_bootstrap_navbar_searchform', array('label' => __('Add searchform to navigation bar.', 'the-bootstrap'), 'section' => 'the_bootstrap_theme_options', 'settings' => 'the_bootstrap_theme_options[navbar_searchform]', 'type' => 'checkbox'));
    // Navbar Position
    $wp_customize->add_control('the_bootstrap_navbar_position', array('label' => __('Navigation Bar Position', 'the-bootstrap'), 'section' => 'the_bootstrap_theme_options', 'settings' => 'the_bootstrap_theme_options[navbar_position]', 'type' => 'radio', 'choices' => array('static' => __('Static.', 'the-bootstrap'), 'navbar-fixed-top' => __('Fixed on top.', 'the-bootstrap'), 'navbar-fixed-bottom' => __('Fixed at bottom.', 'the-bootstrap'))));
}
 /**
  * Display for theme customizer
  *
  * @param WP_Customize             $wp_customize The customizer object.
  * @param TitanFrameworkCustomizer $section      The customizer section.
  * @param int                      $priority     The display priority of the control.
  */
 public function registerCustomizerControl($wp_customize, $section, $priority = 1)
 {
     $wp_customize->add_control(new TitanFrameworkOptionIframeControl($wp_customize, $this->getID(), array('label' => $this->settings['name'], 'section' => $section->settings['id'], 'type' => 'select', 'settings' => $this->getID(), 'priority' => $priority, 'optionSettings' => $this->settings)));
 }
/**
 * Registers the theme setting controls with the Theme Customizer
 * 
 * @author	Konstantin Obenland
 * @since	1.4.0 - 05.05.2012
 * 
 * @param	WP_Customize	$wp_customize
 * 
 * @return	void
 */
function the_bootstrap_customize_register($wp_customize)
{
    $wp_customize->get_setting('blogname')->transport = 'postMessage';
    $wp_customize->get_setting('blogdescription')->transport = 'postMessage';
    $wp_customize->add_section('the_bootstrap_theme_layout', array('title' => __('Layout', 'the-bootstrap'), 'priority' => 99));
    $wp_customize->add_section('the_bootstrap_navbar_options', array('title' => __('Navbar Options', 'the-bootstrap'), 'priority' => 101));
    // Add settings
    foreach (array_keys(the_bootstrap_get_default_theme_options()) as $setting) {
        $wp_customize->add_setting("the_bootstrap_theme_options[{$setting}]", array('default' => the_bootstrap_options()->{$setting}, 'type' => 'option', 'transport' => 'postMessage'));
    }
    // New special settings <ir> #########################################################
    $wp_customize->add_setting('special_background_color', array('default' => '#FFFFFF', 'transport' => 'refresh'));
    // New special settings <ir> #########################################################
    $wp_customize->add_setting('special_menu_color', array('default' => '#1B1B1B', 'transport' => 'refresh'));
    // New special settings <ir> #########################################################
    $wp_customize->add_setting('special_title_align', array('default' => '#left', 'transport' => 'refresh'));
    // New special settings <ir> #########################################################
    $wp_customize->add_setting('special_menu_align', array('default' => '#left', 'transport' => 'refresh'));
    // New special settings <ir> #########################################################
    $wp_customize->add_setting('special_sidebar', array('default' => 'true', 'transport' => 'refresh'));
    // Theme Layout
    $wp_customize->add_control('the_bootstrap_theme_layout', array('label' => __('Default Layout', 'the-bootstrap'), 'section' => 'the_bootstrap_theme_layout', 'settings' => 'the_bootstrap_theme_options[theme_layout]', 'type' => 'radio', 'choices' => array('content-sidebar' => __('Content on left', 'the-bootstrap'), 'sidebar-content' => __('Content on right', 'the-bootstrap'))));
    // Sitename in Navbar
    $wp_customize->add_control('the_bootstrap_navbar_site_name', array('label' => __('Add site name to navigation bar.', 'the-bootstrap'), 'section' => 'the_bootstrap_navbar_options', 'settings' => 'the_bootstrap_theme_options[navbar_site_name]', 'type' => 'checkbox'));
    // Searchform in Navbar
    $wp_customize->add_control('the_bootstrap_navbar_searchform', array('label' => __('Add searchform to navigation bar.', 'the-bootstrap'), 'section' => 'the_bootstrap_navbar_options', 'settings' => 'the_bootstrap_theme_options[navbar_searchform]', 'type' => 'checkbox'));
    // Navbar Colors
    $wp_customize->add_control('the_bootstrap_navbar_inverse', array('label' => __('Use inverse color on navigation bar.', 'the-bootstrap'), 'section' => 'the_bootstrap_navbar_options', 'settings' => 'the_bootstrap_theme_options[navbar_inverse]', 'type' => 'checkbox'));
    // Navbar Position
    $wp_customize->add_control('the_bootstrap_navbar_position', array('label' => __('Navigation Bar Position', 'the-bootstrap'), 'section' => 'the_bootstrap_navbar_options', 'settings' => 'the_bootstrap_theme_options[navbar_position]', 'type' => 'radio', 'choices' => array('static' => __('Static.', 'the-bootstrap'), 'navbar-fixed-top' => __('Fixed on top.', 'the-bootstrap'), 'navbar-fixed-bottom' => __('Fixed at bottom.', 'the-bootstrap'))));
    // New special control <ir> ##########################################################
    $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'link_color', array('label' => __('Color del fondo', 'the_bootstrap'), 'section' => 'colors', 'settings' => 'special_background_color')));
    // New special control <ir> ##########################################################
    $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'link_color2', array('label' => __('Color del menú', 'the_bootstrap'), 'section' => 'colors', 'settings' => 'special_menu_color')));
    // New special control <ir> ##########################################################
    $wp_customize->add_control('special_title_align', array('choices' => array('left' => 'Izquierda', 'center' => 'Centrar', 'right' => 'Derecha'), 'label' => __('Alineación del título'), 'section' => 'title_tagline', 'type' => 'select'));
    // New special control <ir> ##########################################################
    $wp_customize->add_control('special_menu_align', array('choices' => array('left' => 'Izquierda', 'center' => 'Centrar', 'right' => 'Derecha'), 'label' => __('Alineación del menú principal'), 'section' => 'the_bootstrap_navbar_options', 'type' => 'select'));
    // New special control <ir> ##########################################################
    $wp_customize->add_control('special_sidebar', array('label' => __('Barra lateral'), 'section' => 'the_bootstrap_theme_layout', 'type' => 'checkbox'));
}
 /**
  * Display for theme customizer
  *
  * @param WP_Customize             $wp_customize The customizer object.
  * @param TitanFrameworkCustomizer $section      The customizer section.
  * @param int                      $priority     The display priority of the control.
  */
 public function registerCustomizerControl($wp_customize, $section, $priority = 1)
 {
     $wp_customize->add_control(new TitanFrameworkCustomizeControl($wp_customize, $this->getID(), array('label' => $this->settings['name'], 'section' => $section->settings['id'], 'settings' => $this->getID(), 'description' => $this->settings['desc'], 'priority' => $priority)));
 }
 /**
  * Display for theme customizer
  *
  * @since 1.0
  *
  * @param WP_Customize             $wp_customize
  * @param ParadoxTitanFrameworkCustomizer $section
  * @param int                      $priority The location/priority of this option inside the section.
  *
  * @return void
  */
 public function registerCustomizerControl($wp_customize, $section, $priority = 1)
 {
     $wp_customize->add_control(new ParadoxTitanFrameworkOptionColorControl($wp_customize, $this->getID(), array('label' => $this->settings['name'], 'section' => $section->getID(), 'settings' => $this->getID(), 'description' => $this->settings['desc'], 'priority' => $priority, 'alpha' => $this->settings['alpha'])));
 }
 /**
  * Register the theme customizations.
  *
  * @param WP_Customize $wp_customize The theme customization object.
  * @return void
  */
 public function register($wp_customize)
 {
     foreach ($this->_sections as $section) {
         $wp_customize->add_section($section['id'], array('title' => $section['label'], 'priority' => $section['priority']));
         foreach ($section['settings'] as $setting) {
             $value = get_theme_mod($setting['key']);
             $wp_customize->add_setting($setting['key'], array('default' => $setting['default'], 'transport' => $setting['transport']));
             $wp_customize->add_control(new $setting['type']($wp_customize, $setting['key'], array('label' => $setting['label'], 'section' => $section['id'], 'settings' => $setting['key'], 'priority' => $setting['priority'])));
         }
     }
     $this->appendCustomizerScripts($wp_customize);
 }