File manager - Edit - /home/verseaumee/TF89388/wp-content/plugins/noisa-toolkit/includes/class-customizer.php
Back
<?php /** * Rascals Customizer * * Register slider post type * * @author Rascals Themes * @category Core * @package Noisa Toolkit * @version 1.0.0 */ if ( ! defined( 'ABSPATH' ) ) { exit; // Exit if accessed diCustomizer } class RascalsCustomizer { /** * Social Media Array * @var array */ public $social_media_a = array( 'twitter' => 'Twitter', 'facebook' => 'Facebook', 'youtube' => 'Youtube', 'instagram' => 'Instagram', 'soundcloud' => 'Soundcloud', 'mixcloud' => 'Mixcloud', 'bandcamp' => 'Bandcamp', 'Beatport' => 'Beatport', 'spotify' => 'Spotify', 'itunes-filled' => 'iTunes', 'lastfm' => 'lastfm', 'vimeo' => 'Vimeo', 'vk' => 'VK', 'flickr' => 'Flickr', 'snapchat-ghost' => 'Snapchat', 'dribbble' => 'Dribbble', 'deviantart' => 'Deviantart', 'github' => 'Github', 'blogger' => 'Blogger', 'yahoo' => 'Yahoo', 'finder' => 'Finder', 'skype' => 'Skype', 'reddit' => 'Reddit', 'linkedin' => 'Linkedin', 'amazon' => 'Amazon', 'telegram' => 'Telegram', 'qq' => 'QQ', 'weibo' => 'Weibo', 'wechat' => 'Wechat', ); /** * Rascals Customizer Constructor. * @return void */ public function __construct() { add_action( 'plugins_loaded', array( $this, 'init' ) ); } /** * Initialize class * @return void */ public function init() { if ( ! class_exists( 'Kirki' ) ) { return; } // Config Kirki Kirki::add_config( 'rascals_customizer', array( 'capability' => 'edit_theme_options', 'option_type' => 'theme_mod', ) ); // Load customizer style add_action( 'customize_controls_print_styles', array( $this, 'registerStyles' ) ); // Kirki styling add_action( 'kirki/config', array( $this, 'configurationSampleStyling' ) ); // Remove a pre exising customizer setting. add_action( 'customize_register', array( $this, 'removeCustomizeRegister' ) ); // Load Custom JS $js = get_theme_mod( 'custom_js', '' ); if ( $js !== '' && is_string( $js ) ) { add_action( 'wp_enqueue_scripts', array( $this, 'addCustomJS' ) ); } // Add Kirki Options $this->addOptions(); } /** * Get default options depend on theme skin * @return string */ public function getDefault( $option = '' ) { if ( get_theme_mod( 'noisa_skin', 'dark' ) === 'light' ) { $defaults = array( 'headings_color' => '#111111', 'body_bg_color' => '#ffffff', 'text_color' => '#444444', 'noisa_loading_layer_color' => '#000000' ); } else { $defaults = array( 'headings_color' => '#ffffff', 'body_bg_color' => '#0b0b0c', 'text_color' => '#eeeeee', 'noisa_loading_layer_color' => '#000000' ); } // return if ( isset( $defaults[$option] ) ) { return $defaults[$option]; } else { return $option; } } /** * Kriki Options * @return void */ public function addOptions() { $default_logo_img = get_template_directory_uri() . '/images/logo.png'; ////////////////////////// // Panel: Personalizing // ////////////////////////// Kirki::add_panel( 'personalizing', array( 'priority' => 1, 'title' => esc_html__( 'Personalizing', 'noisa-toolkit' ), 'description' => esc_html__( 'This panel will provide all the options of the personalizing.', 'noisa-toolkit' ), ) ); /** * Section: Colors */ Kirki::add_section( 'colors', array( 'title' => esc_html__( 'Colors', 'noisa-toolkit' ), 'description' => false, 'panel' => 'personalizing', 'priority' => 1, 'capability' => 'edit_theme_options', 'theme_supports' => '', ) ); /** * Control: Theme Skin */ Kirki::add_field( 'rascals_customizer', array( 'label' => esc_html__( 'Theme Skin', 'noisa-toolkit' ), 'section' => 'colors', 'settings' => 'noisa_skin', 'type' => 'select', 'priority' => 1, 'multiple' => 1, 'default' => 'dark', 'description' => esc_html__( 'Change the template skin. PLEASE NOTE: If you don\'t see any changes then click the "Save & Publish" button and refresh the browser window.', 'noisa-toolkit' ), 'choices' => array( 'light' => esc_html__( 'Light', 'noisa-toolkit' ), 'dark' => esc_html__( 'Dark', 'noisa-toolkit' ), ), ) ); /** * Control: Accent Color */ Kirki::add_field( 'rascals_customizer', array( 'label' => esc_html__( 'Accent Color', 'noisa-toolkit' ), 'section' => 'colors', 'settings' => 'accent_color', 'type' => 'color', 'priority' => 2, 'default' => '#E82561', 'choices' => array( 'alpha' => false, ), 'output' => array( array( 'property' => 'color', 'element' => array( 'a', 'a > *', 'blockquote cite a', 'blockquote cite a:hover', 'blockquote cite a', 'blockquote cite a:hover', '#searchform #searchsubmit i:hover', '.color', '#slidebar header a:hover', '#slidebar header a:hover span', '.format-quote .quote-text cite', '.format-quote .quote-text cite a', '.more-link', '.more-link-excerpt', '.grid-cats a:hover', '.grid-share-buttons a:hover .icon', '.thumb-event .event-day', '.logged-in-as a:hover', '#footer-note p a:hover', '.widget a:hover', '.widget-title a:hover', '.content-sidebar .widget a:hover', '.widget table#wp-calendar #next a:hover', '.widget table#wp-calendar #prev a:hover', '.tweets-widget li a:hover:before', '.tweets-widget li .date a', '.widget_noisa_recent_posts .rp-caption .rp-date', '.sp-time-elapsed', '#scamp_player.sp-show-list .sp-buttons-container a.sp-queue-button:before', '.circle-button:hover i.icon', '.track-button:hover', '.track-button:hover i.icon', '.icon_column .text-holder a:hover', '.icon_column:hover .icon_column_title', '.icon_column:hover .icon' ) ), array( 'property' => 'background-color', 'element' => array( '.spinner', '#nav ul ul a:hover', '#nav ul ul .hover > a', '#nav ul ul .current > a', '#nav ul ul .current > a:hover', '#nav ul ul a.selected', '.post-navigation a:hover', '.meta-cats a', '.meta-col .meta-comments a', '.meta-tags a:hover', '.masonry-list .event-li.selected .date', '.masonry-list .event-li:hover .date', '.grid-content:after', '.section-title:after', '.comment .reply a:hover', '#scroll-button:hover', '.widget button', '.widget .button', '.widget input[type="button"]', '.widget input[type="reset"]', '.widget input[type="submit"]', '.widget_tag_cloud .tagcloud a:hover', '.tweets-widget li:hover:before', '.badge.color', '.badge.soundcloud', 'input[type="submit"]', 'button', '.btn', '.widget .btn', '.pill-btn', '.sp-progress .sp-position', '#scamp_player.paused .sp-position', '.sp-progress .sp-position:after', '.sp-volume-position', '.sp-volume-position:after', '.tweets li:hover:before', 'ol.tracklist.simple li .simple-track.sp-play', 'ol.tracklist.simple li .simple-track.sp-pause', 'ol.tracklist.simple li .simple-track.sp-loading', 'ol.tracklist.simple li .simple-track:hover', '#icon-nav #shop-link .shop-items-count', '.circle-btn:hover', '.share-buttons .circle-btn:hover', '#header.show-bg #icon-nav #shop-link .shop-items-count', '.ajax-loader' ) ), array( 'property' => 'background', 'element' => array( '::selection' ) ), array( 'property' => 'border-color', 'element' => array( '.intro-tabs-wrap a:hover', '.intro-tabs-wrap.intro-tabs-before-init a:first-child', '.intro-tabs-wrap a.active', '.direction-l .flag:before', '.direction-r .flag:before', '.price-table-inner.important-price', '.dark-bg .price-table-inner:hover', '.price-table-inner:hover' ) ), array( 'property' => 'border-left-color', 'element' => array( '.meta-col .meta-comments a:after', ) ) ) ) ); /** * Control: Headings Color */ Kirki::add_field( 'rascals_customizer', array( 'label' => esc_html__( 'Headings Color', 'noisa-toolkit' ), 'section' => 'colors', 'settings' => 'headings_color', 'type' => 'color', 'priority' => 3, 'default' => $this->getDefault( 'headings_color' ), 'choices' => array( 'alpha' => false, ), 'output' => array( array( 'property' => 'color', 'element' => array( 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', '.widget .widget-title', '#reply-title', '.article-title', '.article-title a' ) ), ) ) ); /** * Control: Background Color */ Kirki::add_field( 'rascals_customizer', array( 'label' => esc_html__( 'Background Color', 'noisa-toolkit' ), 'section' => 'colors', 'settings' => 'body_bg_color', 'type' => 'color', 'priority' => 4, 'default' => $this->getDefault( 'body_bg_color' ), 'choices' => array( 'alpha' => false, ), 'output' => array( array( 'property' => 'background', 'element' => array( 'body', '.masonry-item', '.masonry-anim .masonry-item:after' ) ), ) ) ); /** * Control: Text Color */ Kirki::add_field( 'rascals_customizer', array( 'label' => esc_html__( 'Text Color', 'noisa-toolkit' ), 'section' => 'colors', 'settings' => 'text_color', 'type' => 'color', 'priority' => 5, 'default' => $this->getDefault( 'text_color' ), 'choices' => array( 'alpha' => false, ), 'output' => array( array( 'property' => 'color', 'element' => array( 'body' ) ), ) ) ); /** * Control: Loading Layer Color */ Kirki::add_field( 'rascals_customizer', array( 'label' => esc_html__( 'Loading Layer Color', 'noisa-toolkit' ), 'section' => 'colors', 'settings' => 'noisa_loading_layer_color', 'type' => 'color', 'priority' => 6, 'default' => $this->getDefault( 'noisa_loading_layer_color' ), 'choices' => array( 'alpha' => false, ), 'output' => array( array( 'property' => 'background-color', 'element' => array( '#WPAjaxLoader', '#loading-layer' ) ), ) ) ); /////////////////// // Panel: Header // /////////////////// Kirki::add_panel( 'header', array( 'priority' => 2, 'title' => esc_html__( 'Header', 'noisa-toolkit' ), 'description' => esc_html__( 'This panel will provide all the options of the header.', 'noisa-toolkit' ), ) ); /** * Section: logo * */ Kirki::add_section( 'header_logo', array( 'title' => esc_html__( 'Logo', 'noisa-toolkit' ), 'description' => false, 'panel' => 'header', 'priority' => 1, 'capability' => 'edit_theme_options', 'theme_supports' => '', ) ); /** * Control: Logo */ Kirki::add_field( 'rascals_customizer', array( 'label' => esc_html__( 'Logo Image (Light)', 'noisa-toolkit' ), 'section' => 'header_logo', 'settings' => 'noisa_logo', 'type' => 'image', 'priority' => 1, 'default' => get_template_directory_uri() . '/images/logo-dark.png', ) ); /** * Control: Logo Alternative */ Kirki::add_field( 'rascals_customizer', array( 'label' => esc_html__( 'Logo Image (Dark)', 'noisa-toolkit' ), 'section' => 'header_logo', 'settings' => 'noisa_logo_dark', 'type' => 'image', 'priority' => 1, 'default' => '', 'description' => esc_html__( 'Add dark logo to the header. Please note: Logo is displayed only when "Light Skin" is selected..', 'noisa-toolkit' ), ) ); /** * Section: Header Buttons * */ Kirki::add_section( 'header_buttons', array( 'title' => esc_html__( 'Cart Button', 'noisa-toolkit' ), 'description' => false, 'panel' => 'header', 'priority' => 2, 'capability' => 'edit_theme_options', 'theme_supports' => '', ) ); /** * Control: Cart Button */ Kirki::add_field( 'rascals_customizer', array( 'label' => esc_html__( 'Display Cart', 'noisa-toolkit' ), 'section' => 'header_buttons', 'settings' => 'noisa_cart_button', 'type' => 'toggle', 'priority' => 1, 'default' => 1 ) ); /** * Control: Cart link */ Kirki::add_field( 'rascals_customizer', array( 'label' => esc_html__( 'Cart Link', 'noisa-toolkit' ), 'section' => 'header_buttons', 'settings' => 'noisa_cart_link', 'type' => 'select', 'priority' => 2, 'multiple' => 1, 'default' => 'shop', 'choices' => array( 'shop' => esc_html__( 'Shop page', 'noisa-toolkit' ), 'cart' => esc_html__( 'Cart', 'noisa-toolkit' ), ), ) ); /** * Section: Header Social Icons * */ Kirki::add_section( 'header_socials', array( 'title' => esc_html__( 'Social Buttons', 'noisa-toolkit' ), 'description' => false, 'panel' => 'header', 'priority' => 3, 'capability' => 'edit_theme_options', 'theme_supports' => '', ) ); /** * Control: Social Buttons */ Kirki::add_field( 'rascals_customizer', array( 'label' => esc_html__( 'Social Buttons', 'noisa-toolkit' ), 'section' => 'header_socials', 'settings' => 'header_social_buttons', 'type' => 'repeater', 'priority' => 6, 'row_label' => array( 'type' => 'field', 'value' => esc_html__( 'Social Button:', 'noisa-toolkit' ), 'field' => 'social_type', ), 'default' => array(), 'fields' => array( 'social_type' => array( 'type' => 'select', 'label' => esc_html__( 'Social Media', 'noisa-toolkit' ), 'description' => esc_html__( 'Select your social media button', 'noisa-toolkit' ), 'default' => '', 'choices' => $this->social_media_a, ), 'social_link' => array( 'type' => 'text', 'label' => esc_html__( 'Link', 'noisa-toolkit' ), 'description' => esc_html__( 'Type your social link', 'noisa-toolkit' ), 'default' => '', ), ), ) ); /** * Section: Options * */ Kirki::add_section( 'header_additional', array( 'title' => esc_html__( 'Additional Options', 'noisa-toolkit' ), 'description' => false, 'panel' => 'header', 'priority' => 4, 'capability' => 'edit_theme_options', 'theme_supports' => '', ) ); /** * Control: Header Visible */ Kirki::add_field( 'rascals_customizer', array( 'label' => esc_html__( 'Always Show Header', 'noisa-toolkit' ), 'section' => 'header_additional', 'settings' => 'noisa_always_show_header', 'type' => 'toggle', 'priority' => 8, 'default' => false, 'description' => esc_html__( 'Always show header regardless of scroll direction.', 'noisa-toolkit' ), ) ); ////////////////////////// // Section: Slide Panel // ////////////////////////// Kirki::add_section( 'slidepanel', array( 'title' => esc_html__( 'Slide Panel', 'noisa-toolkit' ), 'description' => false, 'priority' => 3, 'capability' => 'edit_theme_options', 'theme_supports' => '', ) ); /** * Control: Background Image */ Kirki::add_field( 'rascals_customizer', array( 'label' => esc_html__( 'Background Image', 'noisa-toolkit' ), 'section' => 'slidepanel', 'settings' => 'noisa_slidepanel_image', 'type' => 'image', 'priority' => 1, 'default' => '' ) ); /** * Control: Search */ Kirki::add_field( 'rascals_customizer', array( 'label' => esc_html__( 'Display Search', 'noisa-toolkit' ), 'section' => 'slidepanel', 'settings' => 'noisa_slidepanel_search', 'type' => 'toggle', 'priority' => 2, 'default' => 1, ) ); /////////////////// // Panel: Footer // /////////////////// Kirki::add_panel( 'footer', array( 'priority' => 4, 'title' => esc_html__( 'Footer', 'noisa-toolkit' ), 'description' => esc_html__( 'This panel will provide all the options of the footer.', 'noisa-toolkit' ), ) ); /** * Section: Widgets * */ Kirki::add_section( 'footer_widgets', array( 'title' => esc_html__( 'Widgets', 'noisa-toolkit' ), 'description' => false, 'panel' => 'footer', 'priority' => 1, 'capability' => 'edit_theme_options', 'theme_supports' => '', ) ); /** * Control: Display footer widgets */ Kirki::add_field( 'rascals_customizer', array( 'label' => esc_html__( 'Display Footer Widgets', 'noisa-toolkit' ), 'section' => 'footer_widgets', 'settings' => 'noisa_footer_widgets', 'type' => 'toggle', 'priority' => 1, 'default' => false, ) ); /** * Section: Copyright Text * */ Kirki::add_section( 'footer_copyright', array( 'title' => esc_html__( 'Copyright Text', 'noisa-toolkit' ), 'description' => false, 'panel' => 'footer', 'priority' => 2, 'capability' => 'edit_theme_options', 'theme_supports' => '', ) ); /** * Control: Copyright */ Kirki::add_field( 'rascals_customizer', array( 'label' => esc_html__( 'Copyright Text', 'noisa-toolkit' ), 'section' => 'footer_copyright', 'settings' => 'noisa_copyright_note', 'type' => 'textarea', 'priority' => 1, 'default' => '© Copyright 2019 NOISA. Powered by <a href="#" target="_blank">Rascals Themes</a>. Handcrafted in Europe.', ) ); ///////////////////// // Panel: Sections // ///////////////////// Kirki::add_panel( 'sections', array( 'priority' => 5, 'title' => esc_html__( 'Sections', 'noisa-toolkit' ), 'description' => esc_html__( 'This panel will provide all the options of the theme sections.', 'noisa-toolkit' ), ) ); /** * Section: Intro */ Kirki::add_section( 'section_intro', array( 'title' => esc_html__( 'Intro', 'noisa-toolkit' ), 'description' => false, 'panel' => 'sections', 'priority' => 3, 'capability' => 'edit_theme_options', 'theme_supports' => '', ) ); /** * Control: Page Title BG */ Kirki::add_field( 'rascals_customizer', array( 'label' => esc_html__( 'Page Title Image', 'noisa-toolkit' ), 'section' => 'section_intro', 'settings' => 'noisa_page_title_bg', 'type' => 'image', 'priority' => 1, 'default' => get_template_directory_uri() . '/images/bg.png', 'description' => esc_html__( 'Select default background for Page Title section (category, tag...).', 'noisa-toolkit' ), 'output' => array( array( 'property' => 'background-image', 'element' => array( '.intro-page-title' ) ), ) ) ); /** * Control: Page Title Animations */ Kirki::add_field( 'rascals_customizer', array( 'label' => esc_html__( 'Page Title Animations', 'noisa-toolkit' ), 'section' => 'section_intro', 'settings' => 'noisa_page_title_animations', 'type' => 'toggle', 'priority' => 2, 'default' => 1, ) ); /** * Control: Quick Scroll */ Kirki::add_field( 'rascals_customizer', array( 'label' => esc_html__( 'Quick Scroll ', 'noisa-toolkit' ), 'section' => 'section_intro', 'settings' => 'noisa_quick_scroll', 'type' => 'toggle', 'priority' => 3, 'default' => 0, 'description' => esc_html__( 'Quick jump between header intro and content with animations.', 'noisa-toolkit' ) ) ); //////////////////////// // Section: Custom JS // //////////////////////// Kirki::add_section( 'custom_js', array( 'title' => esc_html__( 'Additional JS', 'noisa-toolkit' ), 'description' => false, 'priority' => 150, 'capability' => 'edit_theme_options', 'theme_supports' => '', 'description' => esc_html__( 'You can add your own JavaScript here. If you want to your code will be reloaded, put it in ajax_reload function:', 'noisa-toolkit' ). 'var ajax_reload = function() { /* Your Code Here */ }' ) ); /** * Control: JS Code */ Kirki::add_field( 'rascals_customizer', array( 'section' => 'custom_js', 'settings' => 'custom_js', 'type' => 'textarea', 'priority' => 1, 'default' => '', ) ); } /** * Kriki styling * @return void */ public function configurationSampleStyling( $config ) { return wp_parse_args( array( 'logo_image' => false, 'description' => false, 'color_accent' => '#f86239', 'color_back' => '#ffffff', ), $config ); } /** * Register styles only on customizer page * @return void */ public function registerStyles() { wp_enqueue_style( 'rascals-customizer-layout', esc_url( RASCALS_TOOLKIT_URL ) . '/assets/css/admin-customizer.css' ); } /** * Register styles only on customizer page * @return void */ public function removeCustomizeRegister( $wp_customize ) {; $wp_customize->remove_section("active_theme"); } /** * Add custom JS if is available * @return void */ function addCustomJS() { $js = get_theme_mod( 'custom_js' ); wp_add_inline_script( 'custom-scripts', $js ); } }
| ver. 1.4 |
Github
|
.
| PHP 8.5.7 | Generation time: 0 |
proxy
|
phpinfo
|
Settings