[user_privacy_settings_form]
[ga_optout]
/** * Dots Navigation class * Class Onepress_Dots_Navigation * * @since 2.1.0 */ class Onepress_Dots_Navigation { static $_instance = null; private $key = 'onepress_sections_nav_'; /** * Get instance * * @return null|Onepress_Dots_Navigation */ static function get_instance() { if (is_null(self::$_instance)) { self::$_instance = new self(); } return self::$_instance; } /** * Get sections * * @return array */ function get_sections() { /** * @since 2.1.1 */ $new = Onepress_Config::get_sections(); // Filter to add more custom sections here return apply_filters('onepress_sections_navigation_get_sections', $new); } /** * Get setting name * * @param string $id * * @return string */ function get_name($id) { return $this->key . $id; } /** * Add customize config * * @param WP_Customize_Manager $wp_customize * @param string $section_id */ function add_customize($wp_customize, $section_id) { $wp_customize->add_setting( $this->get_name('__enable'), array( 'sanitize_callback' => 'onepress_sanitize_text', 'default' => false, ) ); $wp_customize->add_control( $this->get_name('__enable'), array( 'label' => __('Enable in section navigation', 'onepress'), 'section' => $section_id, 'type' => 'checkbox', ) ); $wp_customize->add_setting( $this->get_name('__disable_mobile'), array( 'sanitize_callback' => 'onepress_sanitize_text', 'default' => false, ) ); $wp_customize->add_control( $this->get_name('__disable_mobile'), array( 'label' => __('Disable the section navigation on mobile', 'onepress'), 'section' => $section_id, 'type' => 'checkbox', ) ); $wp_customize->add_setting( $this->get_name('__enable_label'), array( 'sanitize_callback' => 'onepress_sanitize_text', 'default' => 1, ) ); $wp_customize->add_control( $this->get_name('__enable_label'), array( 'label' => __('Enable navigation labels', 'onepress'), 'description' => __('By default navigation label is section title.', 'onepress'), 'section' => $section_id, 'type' => 'checkbox', ) ); // Color Settings. $wp_customize->add_setting( $this->get_name('__color'), array( 'sanitize_callback' => 'sanitize_hex_color_no_hash', 'sanitize_js_callback' => 'maybe_hash_hex_color', 'default' => '', ) ); $wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, $this->get_name('__color'), array( 'label' => esc_html__('Dots color', 'onepress'), 'section' => $section_id, 'description' => '', ) ) ); // Color Settings. $wp_customize->add_setting( $this->get_name('__color2'), array( 'sanitize_callback' => 'sanitize_hex_color_no_hash', 'sanitize_js_callback' => 'maybe_hash_hex_color', 'default' => '', ) ); $wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, $this->get_name('__color2'), array( 'label' => esc_html__('Dots inverse color', 'onepress'), 'section' => $section_id, 'description' => '', ) ) ); // Color Settings. $wp_customize->add_setting( $this->get_name('__label_bg'), array( 'sanitize_callback' => 'onepress_sanitize_color_alpha', 'default' => '', ) ); $wp_customize->add_control( new OnePress_Alpha_Color_Control( $wp_customize, $this->get_name('__label_bg'), array( 'label' => esc_html__('Label Background', 'onepress'), 'section' => $section_id, 'description' => '', ) ) ); // Color Settings. $wp_customize->add_setting( $this->get_name('__label_color'), array( 'sanitize_callback' => 'onepress_sanitize_color_alpha', 'default' => '', ) ); $wp_customize->add_control( new OnePress_Alpha_Color_Control( $wp_customize, $this->get_name('__label_color'), array( 'label' => esc_html__('Label Color', 'onepress'), 'section' => $section_id, 'description' => '', ) ) ); // Section Settings. foreach ($this->get_sections() as $id => $args) { /** * @since 2.1.1 */ if (Onepress_Config::is_section_active($id)) { $name = $this->get_name($id); $wp_customize->add_setting( $id . '_em', array( 'sanitize_callback' => 'onepress_sanitize_text', ) ); $wp_customize->add_control( new OnePress_Misc_Control( $wp_customize, $id . '_em', array( 'type' => 'custom_message', 'section' => $section_id, 'description' => '