Current File : /home/kelaby89/diamondtiptiling.com/wp-content/plugins/floens-addon/includes/Customizer.php
<?php

namespace Layerdrops\Floens;

class Customizer
{
    public function __construct()
    {
        add_action("customize_register", [$this, 'floens_customizer']);
    }
    public function floens_customizer($wp_customize)
    {

        // add panel
        $wp_customize->add_panel(
            'floens_theme_opt',
            array(
                'title'      => esc_html__('Floens Options', 'floens-addon'),
                'description' => esc_html__('Floens Theme options panel', 'floens-addon'),
                'priority'   => 220,
                'capability' => 'edit_theme_options',
            )
        );

        // General Settings
        $wp_customize->add_section('floens_theme_general', array(
            'title' => __('General Settings', 'floens-addon'),
            'description' => esc_html__('Floens General Settings.', 'floens-addon'),
            'priority' => 10,
            'capability' => 'edit_theme_options',
            'panel'      => 'floens_theme_opt'
        ));

        $this->customize_type_radio(
            $wp_customize,
            esc_html__(' Enable Dark Mode?', 'floens-addon'),
            'floens_theme_general',
            'floens_dark_mode',
            'no',
            array(
                'yes' => esc_html__('Yes', 'floens-addon'),
                'no' => esc_html__('No', 'floens-addon'),
            )
        );

        $this->customize_type_radio(
            $wp_customize,
            esc_html__(' Enable Boxed Mode?', 'floens-addon'),
            'floens_theme_general',
            'floens_boxed_mode',
            'no',
            array(
                'yes' => esc_html__('Yes', 'floens-addon'),
                'no' => esc_html__('No', 'floens-addon'),
            )
        );

        $this->customize_type_radio(
            $wp_customize,
            esc_html__(' Enable Rtl Mode?', 'floens-addon'),
            'floens_theme_general',
            'floens_rtl_mode',
            'no',
            array(
                'yes' => esc_html__('Yes', 'floens-addon'),
                'no' => esc_html__('No', 'floens-addon'),
            )
        );

        $this->customize_type_radio(
            $wp_customize,
            esc_html__(' Enable Custom Cursor', 'floens-addon'),
            'floens_theme_general',
            'custom_cursor',
            'yes',
            array(
                'yes' => esc_html__('Yes', 'floens-addon'),
                'no' => esc_html__('No', 'floens-addon'),
            )
        );

        $this->customize_type_radio(
            $wp_customize,
            esc_html__(' Enable Back to top?', 'floens-addon'),
            'floens_theme_general',
            'scroll_to_top',
            'yes',
            array(
                'yes' => esc_html__('Yes', 'floens-addon'),
                'no' => esc_html__('No', 'floens-addon'),
            )
        );

        $this->customize_type_text(
            $wp_customize,
            esc_html__('Select Back to top text', 'floens-addon'),
            'floens_theme_general',
            'scroll_to_top_text',
            'back to top',
            function () {
                return (get_theme_mod('scroll_to_top', 'no') == 'yes' ? true : false);
            }
        );

        $this->customize_type_radio(
            $wp_customize,
            esc_html__(' Enable Preloader?', 'floens-addon'),
            'floens_theme_general',
            'preloader',
            'yes',
            array(
                'yes' => esc_html__('Yes', 'floens-addon'),
                'no' => esc_html__('No', 'floens-addon'),
            )
        );

        $this->customize_type_image(
            $wp_customize,
            esc_html__('Custom Preloader Image', 'floens-addon'),
            'floens_theme_general',
            'preloader_image',
            '',
            function () {
                return (get_theme_mod('preloader', 'no') == 'yes' ? true : false);
            }
        );

        $this->customize_type_image(
            $wp_customize,
            esc_html__('Page Header Image', 'floens-addon'),
            'floens_theme_general',
            'page_header_bg_image'
        );

        $this->customize_type_image(
            $wp_customize,
            esc_html__('Page Header Shape One', 'floens-addon'),
            'floens_theme_general',
            'page_header_shape_one'
        );

        $this->customize_type_image(
            $wp_customize,
            esc_html__('Page Header Shape Two', 'floens-addon'),
            'floens_theme_general',
            'page_header_shape_two'
        );

        $this->customize_type_image(
            $wp_customize,
            esc_html__('Page Header Shape Three', 'floens-addon'),
            'floens_theme_general',
            'page_header_shape_three'
        );

        // Color Settings
        $wp_customize->add_section('floens_theme_color', array(
            'title' => __('Color Settings', 'floens-addon'),
            'description' => esc_html__('Floens Color Settings.', 'floens-addon'),
            'priority' => 10,
            'capability' => 'edit_theme_options',
            'panel'      => 'floens_theme_opt'
        ));

        floens_source_color_meta('set_customizer', $wp_customize, $this);

        // Blog Layout
        $wp_customize->add_section('floens_blog_layout_settings', array(
            'title' => __('Blog Layout', 'floens-addon'),
            'description' => esc_html__('Floens Blog Layout', 'floens-addon'),
            'priority' => 20,
            'capability' => 'edit_theme_options',
            'panel'      => 'floens_theme_opt'
        ));

        $this->customize_type_select(
            $wp_customize,
            'Select Sidebar position',
            'floens_blog_layout_settings',
            'floens_blog_layout',
            'right-align',
            array(
                'left-align' => esc_html__('Left Align', 'floens-addon'),
                'right-align' => esc_html__('Right Align', 'floens-addon'),
                'full-width' => esc_html__('Full Width', 'floens-addon'),
            )
        );

        // Shop Layout
        $wp_customize->add_section('floens_shop_layout_settings', array(
            'title' => __('Shop Layout', 'floens-addon'),
            'description' => esc_html__('floens Shop Layout', 'floens-addon'),
            'priority' => 20,
            'capability' => 'edit_theme_options',
            'panel'      => 'floens_theme_opt'
        ));


        $this->customize_type_select(
            $wp_customize,
            'Select Shop Column',
            'floens_shop_layout_settings',
            'floens_shop_column',
            '3',
            array(
                '2' => esc_html__('2 Column', 'floens-addon'),
                '3' => esc_html__('3 Column', 'floens-addon'),
                '4' => esc_html__('4 Column', 'floens-addon'),
            )
        );

        $this->customize_type_select(
            $wp_customize,
            'Select Shop Sidebar position',
            'floens_shop_layout_settings',
            'floens_shop_layout',
            'left-align',
            array(
                'left-align' => esc_html__('Left Align', 'floens-addon'),
                'right-align' => esc_html__('Right Align', 'floens-addon'),
                'full-width' => esc_html__('Full Width', 'floens-addon'),
            )
        );

        $this->customize_type_text(
            $wp_customize,
            esc_html__('Shop Product Per page', 'floens-addon'),
            'floens_shop_layout_settings',
            'product_per_page',
            esc_html(12)
        );

        // Header options
        $wp_customize->add_section('floens_theme_header', array(
            'title' => __('Header Settings', 'floens-addon'),
            'description' => esc_html__('Floens Header Settings', 'floens-addon'),
            'priority' => 20,
            'capability' => 'edit_theme_options',
            'panel'      => 'floens_theme_opt'
        ));

        $this->customize_type_text(
            $wp_customize,
            esc_html__('Add Logo size in px', 'floens-addon'),
            'floens_theme_header',
            'header_logo_width',
            esc_html(198)
        );

        $this->customize_type_radio(
            $wp_customize,
            esc_html__('Enable Sticky Header?', 'floens-addon'),
            'floens_theme_header',
            'header_sticky_menu',
            'yes',
            array(
                'yes' => esc_html__('Yes', 'floens-addon'),
                'no' => esc_html__('No', 'floens-addon'),
            )
        );

        $this->customize_type_radio(
            $wp_customize,
            esc_html__(' Enable Breadcrumb?', 'floens-addon'),
            'floens_theme_header',
            'breadcrumb_opt',
            'yes',
            array(
                'yes' => esc_html__('Yes', 'floens-addon'),
                'no' => esc_html__('No', 'floens-addon'),
            )
        );

        $this->customize_type_radio(
            $wp_customize,
            esc_html__('Enable Custom Header?', 'floens-addon'),
            'floens_theme_header',
            'header_custom',
            'no',
            array(
                'yes' => esc_html__('Yes', 'floens-addon'),
                'no' => esc_html__('No', 'floens-addon'),
            )
        );

        $this->customize_type_select(
            $wp_customize,
            esc_html__('Select Header Type', 'floens-addon'),
            'floens_theme_header',
            'header_custom_post',
            '',
            floens_post_query('header'),
            function () {
                return (get_theme_mod('header_custom', 'no') == 'yes' ? true : false);
            }
        );

        //  Mobile Menu
        $wp_customize->add_section('floens_theme_mobile_menu', array(
            'title' => esc_html__('Mobile Menu Settings', 'floens-addon'),
            'description' => esc_html__('Floens Header Settings', 'floens-addon'),
            'priority' => 20,
            'capability' => 'edit_theme_options',
            'panel'      => 'floens_theme_opt'
        ));

        $this->customize_type_text(
            $wp_customize,
            esc_html__('Mobile Menu Email', 'floens-addon'),
            'floens_theme_mobile_menu',
            'floens_mobile_menu_email',
            esc_html__('[email protected]', 'floens-addon')
        );

        $this->customize_type_text(
            $wp_customize,
            esc_html__('Mobile Menu Phone', 'floens-addon'),
            'floens_theme_mobile_menu',
            'floens_mobile_menu_phone',
            esc_html__('666 888 0000', 'floens-addon')
        );

        $this->customize_type_text(
            $wp_customize,
            esc_html__('Facebook url', 'floens-addon'),
            'floens_theme_mobile_menu',
            'facebook_url',
            esc_html('#')
        );

        $this->customize_type_text(
            $wp_customize,
            esc_html__('Twitter url', 'floens-addon'),
            'floens_theme_mobile_menu',
            'twitter_url',
            esc_html('#')
        );

        $this->customize_type_text(
            $wp_customize,
            esc_html__('Linkedin url', 'floens-addon'),
            'floens_theme_mobile_menu',
            'linkedin_url',
            esc_html('#')
        );

        $this->customize_type_text(
            $wp_customize,
            esc_html__('Pinterest url', 'floens-addon'),
            'floens_theme_mobile_menu',
            'pinterest_url',
            esc_html('#')
        );

        $this->customize_type_text(
            $wp_customize,
            esc_html__('Youtube url', 'floens-addon'),
            'floens_theme_mobile_menu',
            'youtube_url',
        );


        $this->customize_type_text(
            $wp_customize,
            esc_html__('dribbble url', 'floens-addon'),
            'floens_theme_mobile_menu',
            'dribble_url',
        );

        $this->customize_type_text(
            $wp_customize,
            esc_html__('Instagram url', 'floens-addon'),
            'floens_theme_mobile_menu',
            'instagram_url',
        );

        $this->customize_type_text(
            $wp_customize,
            esc_html__('Reddit url', 'floens-addon'),
            'floens_theme_mobile_menu',
            'reddit_url',
        );

        // Footer options
        $wp_customize->add_section('floens_theme_footer', array(
            'title' => esc_html__('Footer Settings', 'floens-addon'),
            'description' => esc_html__('Floens Footer Settings.', 'floens-addon'),
            'priority' => 20,
            'capability' => 'edit_theme_options',
            'panel'      => 'floens_theme_opt'
        ));

        $this->customize_type_text(
            $wp_customize,
            esc_html__('Footer Text', 'floens-addon'),
            'floens_theme_footer',
            'footer_copytext',
            esc_html__('&copy; All right reserved', 'floens'),
            function () {
                return (get_theme_mod('footer_custom', 'no') == 'yes' ? false : true);
            }
        );

        $this->customize_type_radio(
            $wp_customize,
            esc_html__('Enable Custom Footer ?', 'floens-addon'),
            'floens_theme_footer',
            'footer_custom',
            'no',
            array(
                'yes' => esc_html__('Yes', 'floens-addon'),
                'no' => esc_html__('No', 'floens-addon'),
            )
        );

        $this->customize_type_select(
            $wp_customize,
            esc_html__('Select Footer Type', 'floens-addon'),
            'floens_theme_footer',
            'footer_custom_post',
            '',
            floens_post_query('footer'),
            function () {
                return (get_theme_mod('footer_custom', 'no') == 'yes' ? true : false);
            }
        );

        // register
        $wp_customize->add_section('floens_login_settings', array(
            'title' => __('Login/Register Settings', 'floens-addon'),
            'description' => esc_html__('Login/Register Settings', 'floens-addon'),
            'priority' => 20,
            'capability' => 'edit_theme_options',
            'panel'      => 'floens_theme_opt'
        ));

        $this->customize_type_text(
            $wp_customize,
            esc_html__('Redirect url After Login', 'floens-addon'),
            'floens_login_settings',
            'login_redirect_url',
        );

        $this->customize_type_text(
            $wp_customize,
            esc_html__('Redirect url After Registration', 'floens-addon'),
            'floens_login_settings',
            'registration_redirect_url',
        );

        $this->customize_type_text(
            $wp_customize,
            esc_html__('Redirect url After Log Out', 'floens-addon'),
            'floens_login_settings',
            'logout_redirect_url',
        );

        // error page
        $wp_customize->add_section('floens_error_page_settings', array(
            'title' => __('404 Settings', 'floens-addon'),
            'description' => esc_html__('Change 404 Text', 'floens-addon'),
            'priority' => 20,
            'capability' => 'edit_theme_options',
            'panel'      => 'floens_theme_opt'
        ));

        $this->customize_type_radio(
            $wp_customize,
            esc_html__('Enable Custom 404 ?', 'floens-addon'),
            'floens_error_page_settings',
            'error_custom',
            'no',
            array(
                'yes' => esc_html__('Yes', 'floens-addon'),
                'no' => esc_html__('No', 'floens-addon'),
            )
        );

        $this->customize_type_select(
            $wp_customize,
            esc_html__('Select 404 Page', 'floens-addon'),
            'floens_error_page_settings',
            'error_custom_post',
            '',
            floens_post_query('page'),
            function () {
                return (get_theme_mod('error_custom', 'no') == 'yes' ? true : false);
            }
        );

        $this->customize_type_image(
            $wp_customize,
            esc_html__('404 Page Shape One', 'floens-addon'),
            'floens_error_page_settings',
            '404_page_shape_one'
        );

        $this->customize_type_image(
            $wp_customize,
            esc_html__('404 Page Shape Two', 'floens-addon'),
            'floens_error_page_settings',
            '404_page_shape_two'
        );

        $this->customize_type_image(
            $wp_customize,
            esc_html__('404 Page Shape Three', 'floens-addon'),
            'floens_error_page_settings',
            '404_page_shape_three'
        );

        $this->customize_type_image(
            $wp_customize,
            esc_html__('404 Page Shape Four', 'floens-addon'),
            'floens_error_page_settings',
            '404_page_shape_four'
        );

        $this->customize_type_image(
            $wp_customize,
            esc_html__('404 Page Shape Five', 'floens-addon'),
            'floens_error_page_settings',
            '404_page_shape_five'
        );

        $this->customize_type_image(
            $wp_customize,
            esc_html__('404 Page Shape Six ', 'floens-addon'),
            'floens_error_page_settings',
            '404_page_shape_six'
        );

        $this->customize_type_image(
            $wp_customize,
            esc_html__('404 Page Shape Seven', 'floens-addon'),
            'floens_error_page_settings',
            '404_page_shape_seven'
        );

        $this->customize_type_image(
            $wp_customize,
            esc_html__('404 Page Shape Eight', 'floens-addon'),
            'floens_error_page_settings',
            '404_page_shape_eight'
        );

        $this->customize_type_image(
            $wp_customize,
            esc_html__('404 Page Shape Nine', 'floens-addon'),
            'floens_error_page_settings',
            '404_page_shape_nine'
        );
    }

    //type text
    public function customize_type_text($wp_customize, $label, $section_id, $name,  $default = "", $callback = null)
    {
        // add settings
        $wp_customize->add_setting($name, array(
            'default'  => $default,
            'type'     => 'theme_mod'
        ));

        $wp_customize->add_control(new \WP_Customize_Control(
            $wp_customize,
            $name,
            array(
                "label" => $label,
                "section" => $section_id,
                "settings" => $name,
                "type" => "text",
                "active_callback" => $callback,
            )
        ));
    }


    //type color
    //type color
    public function customize_type_color($wp_customize, $section_id, $name,  $default = false)
    {
        $prefix_name = str_replace("-", "_", $name);
        // add settings
        $wp_customize->add_setting($prefix_name, array(
            'default'  => sanitize_hex_color($default),
            'type'     => 'theme_mod'
        ));

        // Add control
        $wp_customize->add_control(new \WP_Customize_Color_Control($wp_customize, $prefix_name, array(
            'label'    => ucwords(str_replace("-", " ", $name)),
            'section'  => $section_id,
            'setting' => $prefix_name,
            'priority' => 1
        )));
    }

    // type checkbox
    public function customize_type_checkbox($wp_customize, $label, $section_id, $name,  $default, $callback = null)
    {
        $wp_customize->add_setting($name, array(
            "default" => $default,
            "transport" => "refresh",

        ));

        $wp_customize->add_control(new \WP_Customize_Control(
            $wp_customize,
            $name,
            array(
                "label" => $label,
                "section" => $section_id,
                "settings" => $name,
                "type" => "checkbox",
                "active_callback" => $callback,
            )
        ));
    }

    // type Image
    public function customize_type_image($wp_customize, $label, $section_id, $name,  $default = '', $callback = null)
    {
        $wp_customize->add_setting($name, array(
            "default" => $default,
            "transport" => "refresh",

        ));

        $wp_customize->add_control(new \WP_Customize_Upload_Control($wp_customize, $name, array(
            'label'    => $label,
            'section'  => $section_id,
            'setting' => $name,
            'priority' => 20,
            "active_callback" => $callback,
        )));
    }

    public function customize_type_select($wp_customize, $label, $section_id, $name,  $default, $select_value,  $callback = null)
    {
        $wp_customize->add_setting($name, array(
            'default'     => $default,
            "transport" => "refresh",

        ));

        $wp_customize->add_control(new \WP_Customize_Control(
            $wp_customize,
            $name,
            array(
                "label" => $label,
                "section" => $section_id,
                "settings" => $name,
                "type" => "select",
                'choices'     => $select_value,
                "active_callback" => $callback,
            )
        ));
    }

    public function customize_type_radio($wp_customize, $label, $section_id, $name,  $default, $radio_value, $callback = null)
    {
        $wp_customize->add_setting($name, array(
            'default'     => $default,
            "transport" => "refresh",

        ));

        $wp_customize->add_control(new \WP_Customize_Control(
            $wp_customize,
            $name,
            array(
                "label" => $label,
                "section" => $section_id,
                "settings" => $name,
                "type" => "radio",
                'choices'     => $radio_value,
                "active_callback" => $callback,
            )
        ));
    }
}
Page not found – Hello World !