'GV F| XYlA (GV ^;1 RlA P P GV w`cnA GV _-EcnA GV [)KkcnA GV PdnA 0 'V `GV `GV [H `GV `GV [H `GV a `GV [H `GV 1 ]GV `GV PGV ߢ>b mA GV I$بnA PGV vs ~nA GV ¨ mA pGV Try mA GV "roPmA GV -x mA GV t)h_nA GV ܞΙIw_nA @GV =d`nA мGV `nA `GV iҸanA GV D{ZpǖXnA GV 1m]5xLnA GV LRnA GV 6AUqtnA GV [H `GV 1Y ;.V 4/V HmA PGV GV GV 9Y .V 4/V mA `GV GV V IW .V 4/V xmA `GV GV `GV V YW `.V 4/V @ mA `GV GV V aW .V 4/V _nA `GV GV V qW .V 4/V ` _nA `GV `GV V yW `.V 4/V 0`nA `GV GV V W .V 4/V `nA `GV GV V W .V 4/V anA `GV !GV V W .V 4/V XnA `GV 0#GV V W .V 4/V 0 LnA `GV `#GV V W .V 4/V ! RnA `GV $GV V W p.V 4/V P tnA `GV &GV V W z.V 4/V @param WP_Customize_Manager $wp_customize instance of WP_Customize_Manager. * @param array $configs All customize controls configs. * * @return void */ public function customize_controls_register_configs( $wp_customize, $configs ) { foreach ( $configs as $config ) { if ( ! is_object( $config ) ) { return; } if ( isset( $config->panel ) && is_array( $config->panel ) ) { $this->add_panel( $wp_customize, $config->panel['id'], $config->panel['args'] ); } if ( isset( $config->section ) && is_array( $config->section ) ) { $this->add_section( $wp_customize, $config->section['id'], $config->section['args'] ); } if ( isset( $config->setting ) && is_array( $config->setting ) ) { $this->add_settings( $wp_customize, $config->setting ); } if ( isset( $config->control ) && is_array( $config->control ) ) { $this->add_controls( $wp_customize, $config->control ); } } } /** * Register Customizer panel. * * @since 1.4.0 * * @param WP_Customize_Manager $wp_customize instance of WP_Customize_Manager. * @param string $panel_id Panel id. * @param array $panel_args Panel arguments. * @return void */ public function add_panel( WP_Customize_Manager $wp_customize, $panel_id, $panel_args ) { if ( ! $panel_id || ! is_array( $panel_args ) ) { return; } self::$panels[ $panel_id ] = $panel_args; // Add panel. $wp_customize->add_panel( $panel_id, $panel_args ); } /** * Register Customizer section. * * @since 1.4.0 * * @param WP_Customize_Manager $wp_customize instance of WP_Customize_Manager. * @param string $section_id Section id. * @param array $section_args Section arguments. * @return void */ public function add_section( WP_Customize_Manager $wp_customize, $section_id, $section_args ) { if ( ! $section_id || ! is_array( $section_args ) ) { return; } self::$sections[ $section_id ] = $section_args; // Add section. $wp_customize->add_section( $section_id, $section_args ); } /** * Register Customizer setttings. * * @param WP_Customize_Manager $wp_customize instance of WP_Customize_Manager. * @param array $settings Settings array. * @return void */ private function add_settings( WP_Customize_Manager $wp_customize, $settings ) { if ( ! is_array( $settings ) ) { return; } $defaults = array( 'type' => 'theme_mod', 'capability' => 'edit_theme_options', 'theme_supports' => '', 'default' => '', 'transport' => 'postMessage', 'sanitize_callback' => '', 'sanitize_js_callback' => '', ); // Is not multidimensional array. if ( isset( $settings['id'] ) && isset( $settings['args'] ) ) { $setting_id = $settings['id']; $setting_args = wp_parse_args( $settings['args'], $defaults ); self::$settings[ $setting_id ] = $setting_args; // Add the setting arguments inline so Theme Check can verify the presence of sanitize_callback. $wp_customize->add_setting( $setting_id, array( 'type' => $setting_args['type'], 'capability' => $setting_args['capability'], 'theme_supports' => $setting_args['theme_supports'], 'default' => $setting_args['default'], 'transport' => $setting_args['transport'], 'sanitize_callback' => $setting_args['sanitize_callback'], 'sanitize_js_callback' => $setting_args['sanitize_js_callback'], ) ); } else { foreach ( $settings as $setting ) { $setting_id = $setting['id']; $setting_args = wp_parse_args( $setting['args'], $defaults ); self::$settings[ $setting_id ] = $setting_args; // Add the setting arguments inline so Theme Check can verify the presence of sanitize_callback. $wp_customize->add_setting( $setting_id, array( 'type' => $setting_args['type'], 'capability' => $setting_args['capability'], 'theme_supports' => $setting_args['theme_supports'], 'default' => $setting_args['default'], 'transport' => $setting_args['transport'], 'sanitize_callback' => $setting_args['sanitize_callback'], 'sanitize_js_callback' => $setting_args['sanitize_js_callback'], ) ); } } } /** * Register Customizer controls. * * @param WP_Customize_Manager $wp_customize instance of WP_Customize_Manager. * @param array $controls Controls array. * @return void */ private function add_controls( WP_Customize_Manager $wp_customize, $controls ) { if ( ! is_array( $controls ) ) { return; } // Is not multidimensional array. if ( isset( $controls['id'] ) && isset( $controls['args'] ) ) { $control_id = $controls['id']; $control_args = $controls['args']; // Custom callback to get choices for control. if ( isset( $controls['callable_choices'] ) ) { /* callable_choices: callable function, function parameters */ $control_args['choices'] = call_user_func_array( $controls['callable_choices'][0], $controls['callable_choices'][1] ); } self::$controls[ $control_id ] = $control_args; // Check for a specialized control class. if ( isset( $controls['control_type'] ) ) { $class = $controls['control_type']; self::$controls[ $control_id ]['control_type'] = $class; // Attempt to autoload the class. $reflection = new ReflectionClass( $class ); // If the class successfully loaded, create an instance in a PHP 5.2 compatible way. if ( class_exists( $class ) ) { // Dynamically generate a new class instance. $class_instance = $reflection->newInstanceArgs( array( $wp_customize, $control_id, $control_args ) ); $wp_customize->add_control( $class_instance ); } } else { $wp_customize->add_control( $control_id, $control_args ); } } else { foreach ( $controls as $control ) { $control_id = $control['id']; $control_args = $control['args']; // Custom callback to get choices for control. if ( isset( $control['callable_choices'] ) ) { /* callable_choices: callable function, function parameters */ $control_args['choices'] = call_user_func_array( $control['callable_choices'][0], $control['callable_choices'][1] ); } self::$controls[ $control_id ] = $control_args; // Check for a specialized control class. if ( isset( $control['control_type'] ) ) { $class = $control['control_type']; self::$controls[ $control_id ]['control_type'] = $class; // Attempt to autoload the class. $reflection = new ReflectionClass( $class ); // If the class successfully loaded, create an instance in a PHP 5.2 compatible way. if ( class_exists( $class ) ) { // Dynamically generate a new class instance. $class_instance = $reflection->newInstanceArgs( array( $wp_customize, $control_id, $control_args ) ); $wp_customize->add_control( $class_instance ); } } else { $wp_customize->add_control( $control_id, $control_args ); } } } } } } new Inspiro_Customizer_Control_Base();