File manager - Edit - /home/nandedex/public_html/s.nandedexpress.com/inc.zip
Back
PK ���[T�HD HD + customizer/core/colormag-webfont-loader.phpnu �[��� <?php /** * Download webfonts locally. * * @package wptt/font-loader * */ if ( ! class_exists( 'ColorMag_WebFont_Loader' ) ) { /** * Download webfonts locally. */ class ColorMag_WebFont_Loader { /** * The font-format. * * Use "woff" or "woff2". * This will change the user-agent user to make the request. * * @since 1.0.0 * @var string */ protected $font_format = 'woff2'; /** * The remote URL. * * @since 1.1.0 * @var string */ protected $remote_url; /** * Base path. * * @since 1.1.0 * @var string */ protected $base_path; /** * Base URL. * * @since 1.1.0 * @var string */ protected $base_url; /** * Subfolder name. * * @since 1.1.0 * @var string */ protected $subfolder_name; /** * The fonts folder. * * @since 1.1.0 * @var string */ protected $fonts_folder; /** * The local stylesheet's path. * * @since 1.1.0 * @var string */ protected $local_stylesheet_path; /** * The local stylesheet's URL. * * @since 1.1.0 * @var string */ protected $local_stylesheet_url; /** * The remote CSS. * * @since 1.1.0 * @var string */ protected $remote_styles; /** * The final CSS. * * @since 1.1.0 * @var string */ protected $css; /** * Cleanup routine frequency. */ const CLEANUP_FREQUENCY = 'monthly'; /** * Constructor. * * Get a new instance of the object for a new URL. * * @since 1.1.0 * @param string $url The remote URL. */ public function __construct( $url = '' ) { $this->remote_url = $url; // Add a cleanup routine. $this->schedule_cleanup(); add_action( 'delete_fonts_folder', array( $this, 'delete_fonts_folder' ) ); } /** * Get the local URL which contains the styles. * * Fallback to the remote URL if we were unable to write the file locally. * * @since 1.1.0 * @return string */ public function get_url() { // Check if the local stylesheet exists. if ( $this->local_file_exists() ) { // Attempt to update the stylesheet. Return the local URL on success. if ( $this->write_stylesheet() ) { return $this->get_local_stylesheet_url(); } } // If the local file exists, return its URL, with a fallback to the remote URL. return file_exists( $this->get_local_stylesheet_path() ) ? $this->get_local_stylesheet_url() : $this->remote_url; } /** * Get the local stylesheet URL. * * @since 1.1.0 * @return string */ public function get_local_stylesheet_url() { if ( ! $this->local_stylesheet_url ) { $this->local_stylesheet_url = str_replace( $this->get_base_path(), $this->get_base_url(), $this->get_local_stylesheet_path() ); } return $this->local_stylesheet_url; } /** * Get styles with fonts downloaded locally. * * @since 1.0.0 * @return string */ public function get_styles() { // If we already have the local file, return its contents. $local_stylesheet_contents = $this->get_local_stylesheet_contents(); if ( $local_stylesheet_contents ) { return $local_stylesheet_contents; } // Get the remote URL contents. $this->remote_styles = $this->get_remote_url_contents(); // Get an array of locally-hosted files. $files = $this->get_local_files_from_css(); // Convert paths to URLs. foreach ( $files as $remote => $local ) { $files[ $remote ] = str_replace( $this->get_base_path(), $this->get_base_url(), $local ); } $this->css = str_replace( array_keys( $files ), array_values( $files ), $this->remote_styles ); $this->write_stylesheet(); return $this->css; } /** * Get local stylesheet contents. * * @since 1.1.0 * @return string|false Returns the remote URL contents. */ public function get_local_stylesheet_contents() { $local_path = $this->get_local_stylesheet_path(); // Check if the local stylesheet exists. if ( $this->local_file_exists() ) { // Attempt to update the stylesheet. Return false on fail. if ( ! $this->write_stylesheet() ) { return false; } } ob_start(); include $local_path; return ob_get_clean(); } /** * Get remote file contents. * * @since 1.0.0 * @return string Returns the remote URL contents. */ public function get_remote_url_contents() { /** * The user-agent we want to use. * * The default user-agent is the only one compatible with woff (not woff2) * which also supports unicode ranges. */ $user_agent = 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_5) AppleWebKit/603.3.8 (KHTML, like Gecko) Version/10.1.2 Safari/603.3.8'; // Switch to a user-agent supporting woff2 if we don't need to support IE. if ( 'woff2' === $this->font_format ) { $user_agent = 'Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:73.0) Gecko/20100101 Firefox/73.0'; } // Get the response. $response = wp_remote_get( $this->remote_url, array( 'user-agent' => $user_agent ) ); // Early exit if there was an error. if ( is_wp_error( $response ) ) { return ''; } // Get the CSS from our response. $contents = wp_remote_retrieve_body( $response ); return $contents; } /** * Download files mentioned in our CSS locally. * * @since 1.0.0 * @return array Returns an array of remote URLs and their local counterparts. */ public function get_local_files_from_css() { $font_files = $this->get_remote_files_from_css(); $stored = get_site_option( 'downloaded_font_files', array() ); $change = false; // If in the end this is true, we need to update the cache option. if ( ! defined( 'FS_CHMOD_DIR' ) ) { define( 'FS_CHMOD_DIR', ( 0755 & ~ umask() ) ); } // If the fonts folder don't exist, create it. if ( ! file_exists( $this->get_fonts_folder() ) ) { $this->get_filesystem()->mkdir( $this->get_fonts_folder(), FS_CHMOD_DIR ); } foreach ( $font_files as $font_family => $files ) { // The folder path for this font-family. $folder_path = $this->get_fonts_folder() . '/' . $font_family; // If the folder doesn't exist, create it. if ( ! file_exists( $folder_path ) ) { $this->get_filesystem()->mkdir( $folder_path, FS_CHMOD_DIR ); } foreach ( $files as $url ) { // Get the filename. $filename = basename( wp_parse_url( $url, PHP_URL_PATH ) ); $font_path = $folder_path . '/' . $filename; // Check if the file already exists. if ( file_exists( $font_path ) ) { // Skip if already cached. if ( isset( $stored[ $url ] ) ) { continue; } // Add file to the cache and change the $changed var to indicate we need to update the option. $stored[ $url ] = $font_path; $change = true; // Since the file exists we don't need to proceed with downloading it. continue; } /** * If we got this far, we need to download the file. */ // require file.php if the download_url function doesn't exist. if ( ! function_exists( 'download_url' ) ) { require_once wp_normalize_path( ABSPATH . '/wp-admin/includes/file.php' ); } // Download file to temporary location. $tmp_path = download_url( $url ); // Make sure there were no errors. if ( is_wp_error( $tmp_path ) ) { continue; } // Move temp file to final destination. $success = $this->get_filesystem()->move( $tmp_path, $font_path, true ); if ( $success ) { $stored[ $url ] = $font_path; $change = true; } } } // If there were changes, update the option. if ( $change ) { // Cleanup the option and then save it. foreach ( $stored as $url => $path ) { if ( ! file_exists( $path ) ) { unset( $stored[ $url ] ); } } update_site_option( 'downloaded_font_files', $stored ); } return $stored; } /** * Get font files from the CSS. * * @since 1.0.0 * @return array Returns an array of font-families and the font-files used. */ public function get_remote_files_from_css() { $font_faces = explode( '@font-face', $this->remote_styles ); $result = array(); // Loop all our font-face declarations. foreach ( $font_faces as $font_face ) { // Make sure we only process styles inside this declaration. $style = explode( '}', $font_face )[0]; // Sanity check. if ( false === strpos( $style, 'font-family' ) ) { continue; } // Get an array of our font-families. preg_match_all( '/font-family.*?\;/', $style, $matched_font_families ); // Get an array of our font-files. preg_match_all( '/url\(.*?\)/i', $style, $matched_font_files ); // Get the font-family name. $font_family = 'unknown'; if ( isset( $matched_font_families[0] ) && isset( $matched_font_families[0][0] ) ) { $font_family = rtrim( ltrim( $matched_font_families[0][0], 'font-family:' ), ';' ); $font_family = trim( str_replace( array( "'", ';' ), '', $font_family ) ); $font_family = sanitize_key( strtolower( str_replace( ' ', '-', $font_family ) ) ); } // Make sure the font-family is set in our array. if ( ! isset( $result[ $font_family ] ) ) { $result[ $font_family ] = array(); } // Get files for this font-family and add them to the array. foreach ( $matched_font_files as $match ) { // Sanity check. if ( ! isset( $match[0] ) ) { continue; } // Add the file URL. $font_family_url = rtrim( ltrim( $match[0], 'url(' ), ')' ); // Make sure to convert relative URLs to absolute. $font_family_url = $this->get_absolute_path( $font_family_url ); $result[ $font_family ][] = $font_family_url; } // Make sure we have unique items. // We're using array_flip here instead of array_unique for improved performance. $result[ $font_family ] = array_flip( array_flip( $result[ $font_family ] ) ); } return $result; } /** * Write the CSS to the filesystem. * * @since 1.1.0 * @return string|false Returns the absolute path of the file on success, or false on fail. */ protected function write_stylesheet() { $file_path = $this->get_local_stylesheet_path(); $filesystem = $this->get_filesystem(); if ( ! defined( 'FS_CHMOD_DIR' ) ) { define( 'FS_CHMOD_DIR', ( 0755 & ~ umask() ) ); } // If the folder doesn't exist, create it. if ( ! file_exists( $this->get_fonts_folder() ) ) { $this->get_filesystem()->mkdir( $this->get_fonts_folder(), FS_CHMOD_DIR ); } // If the file doesn't exist, create it. Return false if it can not be created. if ( ! $filesystem->exists( $file_path ) && ! $filesystem->touch( $file_path ) ) { return false; } // If we got this far, we need to write the file. // Get the CSS. if ( ! $this->css ) { $this->get_styles(); } // Put the contents in the file. Return false if that fails. if ( ! $filesystem->put_contents( $file_path, $this->css ) ) { return false; } return $file_path; } /** * Get the stylesheet path. * * @since 1.1.0 * @return string */ public function get_local_stylesheet_path() { if ( ! $this->local_stylesheet_path ) { $this->local_stylesheet_path = $this->get_fonts_folder() . '/' . $this->get_local_stylesheet_filename() . '.css'; } return $this->local_stylesheet_path; } /** * Get the local stylesheet filename. * * This is a hash, generated from the site-URL, the wp-content path and the URL. * This way we can avoid issues with sites changing their URL, or the wp-content path etc. * * @since 1.1.0 * @return string */ public function get_local_stylesheet_filename() { return md5( $this->get_base_url() . $this->get_base_path() . $this->remote_url . $this->font_format ); } /** * Set the font-format to be used. * * @since 1.0.0 * @param string $format The format to be used. Use "woff" or "woff2". * @return void */ public function set_font_format( $format = 'woff2' ) { $this->font_format = $format; } /** * Check if the local stylesheet exists. * * @since 1.1.0 * @return bool */ public function local_file_exists() { return ( ! file_exists( $this->get_local_stylesheet_path() ) ); } /** * Get the base path. * * @since 1.1.0 * @return string */ public function get_base_path() { if ( ! $this->base_path ) { /** * Filter for local fonts base path. * * @since 1.0.0 */ $this->base_path = apply_filters( 'colormag_get_local_fonts_base_path', $this->get_filesystem()->wp_content_dir() ); } return $this->base_path; } /** * Get the base URL. * * @since 1.1.0 * @return string */ public function get_base_url() { if ( ! $this->base_url ) { /** * Filter for local fonts base url. * * @since 1.0.0 */ $this->base_url = apply_filters( 'colormag_get_local_fonts_base_url', content_url() ); } return $this->base_url; } /** * Get the subfolder name. * * @since 1.1.0 * @return string */ public function get_subfolder_name() { if ( ! $this->subfolder_name ) { /** * Filter for local fonts subfolder name. * * @since 1.0.0 */ $this->subfolder_name = apply_filters( 'colormag_get_local_fonts_subfolder_name', 'fonts' ); } return $this->subfolder_name; } /** * Get the folder for fonts. * * @return string */ public function get_fonts_folder() { if ( ! $this->fonts_folder ) { $this->fonts_folder = $this->get_base_path(); if ( $this->get_subfolder_name() ) { $this->fonts_folder .= '/' . $this->get_subfolder_name(); } } return $this->fonts_folder; } /** * Schedule a cleanup. * * Deletes the fonts files on a regular basis. * This way font files will get updated regularly, * and we avoid edge cases where unused files remain in the server. * * @since 1.1.0 * @return void */ public function schedule_cleanup() { if ( ! is_multisite() || ( is_multisite() && is_main_site() ) ) { if ( ! wp_next_scheduled( 'delete_fonts_folder' ) && ! wp_installing() ) { wp_schedule_event( time(), self::CLEANUP_FREQUENCY, 'delete_fonts_folder' ); } } } /** * Delete the fonts folder. * * This runs as part of a cleanup routine. * * @since 1.1.0 * @return bool */ public function delete_fonts_folder() { return $this->get_filesystem()->delete( $this->get_fonts_folder(), true ); } /** * Get the filesystem. * * @since 1.0.0 * @return \WP_Filesystem_Base */ protected function get_filesystem() { global $wp_filesystem; // If the filesystem has not been instantiated yet, do it here. if ( ! $wp_filesystem ) { if ( ! function_exists( 'WP_Filesystem' ) ) { require_once wp_normalize_path( ABSPATH . '/wp-admin/includes/file.php' ); } WP_Filesystem(); } return $wp_filesystem; } /** * Get an absolute URL from a relative URL. * * @param string $url The URL. * * @return string */ protected function get_absolute_path( $url ) { // If dealing with a root-relative URL. if ( 0 === stripos( $url, '/' ) ) { $parsed_url = parse_url( $this->remote_url ); return $parsed_url['scheme'] . '://' . $parsed_url['hostname'] . $url; } return $url; } } } if ( ! function_exists( 'colormag_get_webfont_styles' ) ) { /** * Get styles for a webfont. * * This will get the CSS from the remote API, * download any fonts it contains, * replace references to remote URLs with locally-downloaded assets, * and finally return the resulting CSS. * * @since 1.0.0 * * @param string $url The URL of the remote webfont. * @param string $format The font-format. If you need to support IE, change this to "woff". * * @return string Returns the CSS. */ function colormag_get_webfont_styles( $url, $format = 'woff2' ) { $font = new ColorMag_WebFont_Loader( $url ); $font->set_font_format( $format ); return $font->get_styles(); } } if ( ! function_exists( 'colormag_get_webfont_url' ) ) { /** * Get a stylesheet URL for a webfont. * * @since 1.1.0 * * @param string $url The URL of the remote webfont. * @param string $format The font-format. If you need to support IE, change this to "woff". * * @return string Returns the CSS. */ function colormag_get_webfont_url( $url, $format = 'woff2' ) { $font = new ColorMag_WebFont_Loader( $url ); $font->set_font_format( $format ); return $font->get_url(); } } PK ���[{p p ( customizer/core/class-colormag-fonts.phpnu �[��� <?php /** * Helper class for font settings for this theme. * * Class ColorMag_Fonts * * @package ThemeGrill * @subpackage ColorMag * @since ColorMag 3.0.0 */ // Exit if accessed directly. if ( ! defined( 'ABSPATH' ) ) { exit; } /** * Helper class for font settings for this theme. * * Class ColorMag_Fonts */ class ColorMag_Fonts { /** * System Fonts * * @var array */ public static $system_fonts = array(); /** * Google Fonts * * @var array */ public static $google_fonts = array(); /** * Custom Fonts * * @var array */ public static $custom_fonts = array(); /** * Font variants * * @var array */ public static $font_variants = array(); /** * Google font subsets * * @var array */ public static $google_font_subsets = array(); /** * Get system fonts. * * @return mixed|void */ public static function get_system_fonts() { if ( empty( self::$system_fonts ) ) : self::$system_fonts = array( 'default' => array( 'family' => 'default', 'label' => 'Default', ), 'Georgia,Times,"Times New Roman",serif' => array( 'family' => 'Georgia,Times,"Times New Roman",serif', 'label' => 'serif', ), '-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", Helvetica, Arial, sans-serif' => array( 'family' => '-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", Helvetica, Arial, sans-serif', 'label' => 'sans-serif', ), 'Monaco,"Lucida Sans Typewriter","Lucida Typewriter","Courier New",Courier,monospace' => array( 'family' => 'Monaco,"Lucida Sans Typewriter","Lucida Typewriter","Courier New",Courier,monospace', 'label' => 'monospace', ), ); endif; /** * Filter for system fonts. * * @since 1.0.0 */ return apply_filters( 'colormag_system_fonts', self::$system_fonts ); } /** * Get Google fonts. * It's array is generated from the google-fonts.json file. * * @return mixed|void */ public static function get_google_fonts() { if ( empty( self::$google_fonts ) ) : global $wp_filesystem; /** * Filter for google fonts json file. * * @since 1.0.0 */ $google_fonts_file = apply_filters( 'colormag_google_fonts_json_file', dirname( __FILE__ ) . '/custom-controls/typography/google-fonts.json' ); if ( ! file_exists( dirname( __FILE__ ) . '/custom-controls/typography/google-fonts.json' ) ) { return array(); } // Require `file.php` file of WordPress to include filesystem check for getting the file contents. if ( ! $wp_filesystem ) { require_once ABSPATH . '/wp-admin/includes/file.php'; } // Proceed only if the file is readable. if ( is_readable( $google_fonts_file ) ) { WP_Filesystem(); $file_contents = $wp_filesystem->get_contents( $google_fonts_file ); $google_fonts_json = json_decode( $file_contents, 1 ); foreach ( $google_fonts_json['items'] as $key => $font ) { $google_fonts[ $font['family'] ] = array( 'family' => $font['family'], 'label' => $font['family'], 'variants' => $font['variants'], 'subsets' => $font['subsets'], ); self::$google_fonts = $google_fonts; } } endif; /** * Filter for system fonts. * * @since 1.0.0 */ return apply_filters( 'colormag_system_fonts', self::$google_fonts ); } /** * Get custom fonts. * * @return mixed|void */ public static function get_custom_fonts() { /** * Filter for custom fonts. * * @since 1.0.0 */ return apply_filters( 'colormag_custom_fonts', self::$custom_fonts ); } /** * Get font variants. * * @return mixed|void */ public static function get_font_variants() { if ( empty( self::$font_variants ) ) : self::$font_variants = array( '100' => esc_html__( 'Thin 100', 'colormag' ), '100italic' => esc_html__( 'Thin 100 Italic', 'colormag' ), '200' => esc_html__( 'Extra-Light 200', 'colormag' ), '200italic' => esc_html__( 'Extra-Light 200 Italic', 'colormag' ), '300' => esc_html__( 'Light 300', 'colormag' ), '300italic' => esc_html__( 'Light 300 Italic', 'colormag' ), 'regular' => esc_html__( 'Regular 400', 'colormag' ), 'italic' => esc_html__( 'Regular 400 Italic', 'colormag' ), '500' => esc_html__( 'Medium 500', 'colormag' ), '500italic' => esc_html__( 'Medium 500 Italic', 'colormag' ), '600' => esc_html__( 'Semi-Bold 600', 'colormag' ), '600italic' => esc_html__( 'Semi-Bold 600 Italic', 'colormag' ), '700' => esc_html__( 'Bold 700', 'colormag' ), '700italic' => esc_html__( 'Bold 700 Italic', 'colormag' ), '800' => esc_html__( 'Extra-Bold 800', 'colormag' ), '800italic' => esc_html__( 'Extra-Bold 800 Italic', 'colormag' ), '900' => esc_html__( 'Black 900', 'colormag' ), '900italic' => esc_html__( 'Black 900 Italic', 'colormag' ), ); endif; /** * Filter for font variants. * * @since 1.0.0 */ return apply_filters( 'colormag_font_variants', self::$font_variants ); } /** * Get Google font subsets. * * @return mixed|void */ public static function get_google_font_subsets() { if ( empty( self::$google_font_subsets ) ) : self::$google_font_subsets = array( 'arabic' => esc_html__( 'Arabic', 'colormag' ), 'bengali' => esc_html__( 'Bengali', 'colormag' ), 'chinese-hongkong' => esc_html__( 'Chinese (Hong Kong)', 'colormag' ), 'chinese-simplified' => esc_html__( 'Chinese (Simplified)', 'colormag' ), 'chinese-traditional' => esc_html__( 'Chinese (Traditional)', 'colormag' ), 'cyrillic' => esc_html__( 'Cyrillic', 'colormag' ), 'cyrillic-ext' => esc_html__( 'Cyrillic Extended', 'colormag' ), 'devanagari' => esc_html__( 'Devanagari', 'colormag' ), 'greek' => esc_html__( 'Greek', 'colormag' ), 'greek-ext' => esc_html__( 'Greek Extended', 'colormag' ), 'gujarati' => esc_html__( 'Gujarati', 'colormag' ), 'gurmukhi' => esc_html__( 'Gurmukhi', 'colormag' ), 'hebrew' => esc_html__( 'Hebrew', 'colormag' ), 'japanese' => esc_html__( 'Japanese', 'colormag' ), 'kannada' => esc_html__( 'Kannada', 'colormag' ), 'khmer' => esc_html__( 'Khmer', 'colormag' ), 'korean' => esc_html__( 'Korean', 'colormag' ), 'latin' => esc_html__( 'Latin', 'colormag' ), 'latin-ext' => esc_html__( 'Latin Extended', 'colormag' ), 'malayalam' => esc_html__( 'Malayalam', 'colormag' ), 'myanmar' => esc_html__( 'Myanmar', 'colormag' ), 'oriya' => esc_html__( 'Oriya', 'colormag' ), 'sinhala' => esc_html__( 'Sinhala', 'colormag' ), 'tamil' => esc_html__( 'Tamil', 'colormag' ), 'telugu' => esc_html__( 'Telugu', 'colormag' ), 'thai' => esc_html__( 'Thai', 'colormag' ), 'tibetan' => esc_html__( 'Tibetan', 'colormag' ), 'vietnamese' => esc_html__( 'Vietnamese', 'colormag' ), ); endif; /** * Filter for font variants. * * @since 1.0.0 */ return apply_filters( 'colormag_font_variants', self::$google_font_subsets ); } } PK ���[��5� � , customizer/core/custom-controls/date/date.jsnu �[��� ( function ( $ ) { wp.customize.controlConstructor['colormag-date'] = wp.customize.Control.extend( { ready: function() { 'use strict'; var control = this, selector = control.selector, input = $( selector ).find( 'input' ); // Init the datepicker. input.datepicker( { dateFormat : 'yy-mm-dd', changeMonth: true, changeYear : true, showOn : 'button', buttonText : '', beforeShow : function( input, obj ) { $( input ).after( $( input ).datepicker( 'widget' ) ); } } ); // Save the changes. input.on( 'change keyup paste', function() { control.setting.set( $( this ).val() ); } ); }, } ); } )( jQuery ); PK ���[�^!�� � D customizer/core/custom-controls/date/class-colormag-date-control.phpnu �[��� <?php /** * Extend WP_Customize_Control to add the date control. * * Class ColorMag_Date_Control * * @package ThemeGrill * @subpackage ColorMag */ // Exit if accessed directly. if ( ! defined( 'ABSPATH' ) ) { exit; } /** * Class to extend WP_Customize_Control to add the date customize control. * * Class ColorMag_Date_Control */ class ColorMag_Date_Control extends ColorMag_Customize_Base_Additional_Control { /** * Control's Type. * * @var string */ public $type = 'colormag-date'; /** * Refresh the parameters passed to the JavaScript via JSON. * * @see WP_Customize_Control::to_json() */ public function to_json() { parent::to_json(); $this->json['id'] = $this->id; $this->json['label'] = esc_html( $this->label ); $this->json['description'] = $this->description; $this->json['value'] = $this->value(); } /** * An Underscore (JS) template for this control's content (but not its container). * * Class variables for this control class are available in the `data` JS object; * export custom variables by overriding {@see WP_Customize_Control::to_json()}. * * @see WP_Customize_Control::print_template() */ protected function content_template() { ?> <label> <# if ( data.label ) { #><span class="customize-control-label">{{{ data.label }}}</span><# } #> <# if ( data.description ) { #><span class="description customize-control-description">{{{ data.description }}}</span><# } #> <div class="customize-control-content"> <input class="datepicker" type="text" name="_customize-date-{{ data.id }}" value="{{ data.value }}" placeholder="<?php esc_attr_e( 'Select Date', 'colormag' ); ?>" readonly/> </div> </label> <?php } /** * Don't render the control content from PHP, as it's rendered via JS on load. */ public function render_content() { } } PK ���[�6!�' ' H customizer/core/custom-controls/custom/class-colormag-custom-control.phpnu �[��� <?php /** * Extend WP_Customize_Control to add custom control. * * Class ColorMag_Custom_Control * * @package ThemeGrill * @subpackage ColorMag * @since ColorMag 3.0.0 */ // Exit if accessed directly. if ( ! defined( 'ABSPATH' ) ) { exit; } /** * Class to extend WP_Customize_Control to add custom customize control. * * Class ColorMag_Custom_Control */ class ColorMag_Custom_Control extends ColorMag_Customize_Base_Additional_Control { /** * Control's Type. * * @var string */ public $type = 'colormag-custom'; /** * Custom information for this control. * * @var string */ public $info = ''; /** * Custom links for this control. * * @var array */ public $links = array(); /** * Refresh the parameters passed to the JavaScript via JSON. * * @see WP_Customize_Control::to_json() */ public function to_json() { parent::to_json(); $this->json['default'] = $this->setting->default; if ( isset( $this->default ) ) { $this->json['default'] = $this->default; } $this->json['value'] = $this->value(); $this->json['link'] = $this->get_link(); $this->json['id'] = $this->id; $this->json['label'] = esc_html( $this->label ); $this->json['description'] = $this->description; $this->json['info'] = $this->info; $this->json['links'] = $this->links; } /** * An Underscore (JS) template for this control's content (but not its container). * * Class variables for this control class are available in the `data` JS object; * export custom variables by overriding {@see WP_Customize_Control::to_json()}. * * @see WP_Customize_Control::print_template() */ protected function content_template() { ?> <div class="customizer-text"> <# if ( data.label ) { #> <span class="customize-control-label">{{{ data.label }}}</span> <# } #> <# if ( data.description ) { #> <span class="description customize-control-description">{{{ data.description }}}</span> <# } #> </div> <# if ( data.info ) { #> <div class="colormag-custom-info"> {{{ data.info }}} </div> <# } #> <# if ( data.links ) { #> <ul class="colormag-custom-links"> <# _.each( data.links, function( links, id ) { #> <li><a href="{{{ links.url }}}" target="_blank">{{{ links.text }}}</a></li> <# } ) #> </ul> <# } #> <?php } /** * Don't render the control content from PHP, as it's rendered via JS on load. */ public function render_content() { } } PK ���[_�9� H customizer/core/custom-controls/editor/class-colormag-editor-control.phpnu �[��� <?php /** * Extend WP_Customize_Control to add the editor control. * * Class ColorMag_Editor_Control * * @package ThemeGrill * @subpackage ColorMag * @since ColorMag 3.0.0 */ // Exit if accessed directly. if ( ! defined( 'ABSPATH' ) ) { exit; } /** * Class to extend WP_Customize_Control to add the editor customize control. * * Class ColorMag_Editor_Control */ class ColorMag_Editor_Control extends ColorMag_Customize_Base_Additional_Control { /** * Control's Type. * * @var string */ public $type = 'colormag-editor'; /** * Refresh the parameters passed to the JavaScript via JSON. * * @see WP_Customize_Control::to_json() */ public function to_json() { parent::to_json(); $this->json['default'] = $this->setting->default; if ( isset( $this->default ) ) { $this->json['default'] = $this->default; } $this->json['value'] = $this->value(); $this->json['link'] = $this->get_link(); $this->json['id'] = $this->id; $this->json['label'] = esc_html( $this->label ); $this->json['description'] = $this->description; } /** * An Underscore (JS) template for this control's content (but not its container). * * Class variables for this control class are available in the `data` JS object; * export custom variables by overriding {@see WP_Customize_Control::to_json()}. * * @see WP_Customize_Control::print_template() */ protected function content_template() { ?> <div class="customizer-text"> <# if ( data.label ) { #> <span class="customize-control-label">{{{ data.label }}}</span> <# } #> <# if ( data.description ) { #> <span class="description customize-control-description">{{{ data.description }}}</span> <# } #> </div> <textarea id="editor_{{{ data.id }}}" {{{ data.link }}}>{{ data.value }}</textarea> <?php } /** * Don't render the control content from PHP, as it's rendered via JS on load. */ public function render_content() { } } PK ���[Ԡ�H H 0 customizer/core/custom-controls/editor/editor.jsnu �[��� /** * Editor control JS to handle the editor rendering within customize control. * * File `editor.js`. * * @package ColorMag */ wp.customize.controlConstructor[ 'colormag-editor' ] = wp.customize.Control.extend( { ready : function () { 'use strict'; var control = this, id = 'editor_' + control.id; if ( wp.editor && wp.editor.initialize ) { wp.editor.initialize( id, { tinymce: { wpautop: true, setup: function (editor) { editor.on( 'Paste Change input Undo Redo', function() { var content = editor.getContent(); wp.customize.instance( control.id ).set( content ); } ) } }, quicktags: true, mediaButtons: true } ); } }, } ); PK ���[�)�� � H customizer/core/custom-controls/toggle/class-colormag-toggle-control.phpnu �[��� <?php /** * Extend WP_Customize_Control to add the switch toggle control. * * Class ColorMag_Toggle_Control * * @package ThemeGrill * @subpackage ColorMag * @since ColorMag 3.0.0 */ // Exit if accessed directly. if ( ! defined( 'ABSPATH' ) ) { exit; } /** * Class to extend WP_Customize_Control to add the switch toggle customize control. * * Class ColorMag_Toggle_Control */ class ColorMag_Toggle_Control extends ColorMag_Customize_Base_Additional_Control { /** * Control's Type. * * @var string */ public $type = 'colormag-toggle'; /** * Refresh the parameters passed to the JavaScript via JSON. * * @see WP_Customize_Control::to_json() */ public function to_json() { parent::to_json(); $this->json['default'] = $this->setting->default; if ( isset( $this->default ) ) { $this->json['default'] = $this->default; } $this->json['value'] = $this->value(); $this->json['link'] = $this->get_link(); $this->json['id'] = $this->id; $this->json['label'] = esc_html( $this->label ); $this->json['description'] = $this->description; $this->json['inputAttrs'] = ''; foreach ( $this->input_attrs as $attr => $value ) { $this->json['inputAttrs'] .= $attr . '="' . esc_attr( $value ) . '" '; } } /** * An Underscore (JS) template for this control's content (but not its container). * * Class variables for this control class are available in the `data` JS object; * export custom variables by overriding {@see WP_Customize_Control::to_json()}. * * @see WP_Customize_Control::print_template() */ protected function content_template() { ?> <label for="toggle_{{ data.id }}"> <div class="colormag-toggle"> <div class="customizer-text"> <# if ( data.label ) { #> <span class="customize-control-label">{{{ data.label }}}</span> <# } #> <# if ( data.description ) { #> <span class="description customize-control-description">{{{ data.description }}}</span> <# } #> </div> <div class=" colormag-toggle-input <# if ( data.description ) { #>toggle-description<# } #>" > <input {{{ data.inputAttrs }}} class="switch-toggle" type="checkbox" value="{{ data.value }}" name="_customize-toggle-{{ data.id }}" id="toggle_{{ data.id }}" {{{ data.link }}} <# if ( data.value === true ) { #> checked="checked"<# } #> > <span class="switch"></span> </div> </div> </label> <?php } /** * Don't render the control content from PHP, as it's rendered via JS on load. */ public function render_content() { } } PK ���[Z���" " 0 customizer/core/custom-controls/toggle/toggle.jsnu �[��� /** * Switch toggle control JS to handle the toggle of custom customize controls. * * File `toggle.js`. * * @package ColorMag */ wp.customize.controlConstructor['colormag-toggle'] = wp.customize.Control.extend( { ready : function () { 'use strict'; var control = this, value = control.setting._value; // Save the value. this.container.on( 'change', 'input', function () { value = jQuery( this ).is( ':checked' ) ? true : false; control.setting.set( value ); } ); } } ); PK ���[@gJ J J customizer/core/custom-controls/support/class-colormag-support-control.phpnu �[��� <?php /** * Extend WP_Customize_Control to add the title control. * * Class ColorMag_Support_Control * * @package ThemeGrill * @subpackage ColorMag * @since ColorMag 3.0.0 */ // Exit if accessed directly. if ( ! defined( 'ABSPATH' ) ) { exit; } /** * Class to extend WP_Customize_Control to add the title customize control. * * Class ColorMag_Support_Control */ class ColorMag_Support_Control extends ColorMag_Customize_Base_Additional_Control { /** * Control's Type. * * @var string */ public $type = 'colormag-guide'; public $doc = ''; public $youtube = ''; /** * Refresh the parameters passed to the JavaScript via JSON. * * @see WP_Customize_Control::to_json() */ public function to_json() { parent::to_json(); $this->json[ 'label' ] = esc_html( $this->label ); $this->json[ 'doc' ] = esc_url( $this->doc ); $this->json[ 'youtube' ] = esc_url( $this->youtube ); } /** * An Underscore (JS) template for this control's content (but not its container). * * Class variables for this control class are available in the `data` JS object; * export custom variables by overriding {@see WP_Customize_Control::to_json()}. * * @see WP_Customize_Control::print_template() */ protected function content_template() { ?> <div class="colormag-guide-wrapper"> <div class="guide-wrapper"> <# if ( data.label ) { #> <span class="customize-control-label"> {{{ data.label }}} </span> <# } #> <# if ( data.doc ) { #> <span class="doc-url"> <a href= " {{{data.doc}}} " target="_blank">Doc</a> </span> <# } #> <# if ( data.youtube ) { #> <span class="youtube-url"> <a href= " {{{data.youtube}}} " target="_blank"> <svg xmlns="http://www.w3.org/2000/svg" data-name="Layer 1" viewBox="0 0 24 24"> <path d="M21.58 7.17a2.51 2.51 0 0 0-1.77-1.78C18.25 5 12 5 12 5s-6.25 0-7.81.42a2.51 2.51 0 0 0-1.77 1.75A26.19 26.19 0 0 0 2 12a26.28 26.28 0 0 0 .42 4.85 2.47 2.47 0 0 0 1.77 1.75C5.75 19 12 19 12 19s6.25 0 7.81-.42a2.47 2.47 0 0 0 1.77-1.75A26.28 26.28 0 0 0 22 12a26.19 26.19 0 0 0-.42-4.83ZM10 15V9l5.23 3L10 15Z"/> </svg> </a> </span> <# } #> </div> </div> <?php } /** * Don't render the control content from PHP, as it's rendered via JS on load. */ public function render_content() { } } PK ���[�xV�� � 6 customizer/core/custom-controls/buttonset/buttonset.jsnu �[��� /** * Radio buttonset control JS to handle the toggle of radio buttonsets. * * File `buttonset.js`. * * @package ColorMag */ wp.customize.controlConstructor[ 'colormag-buttonset' ] = wp.customize.Control.extend( { ready : function () { 'use strict'; var control = this; // Change the value. this.container.on( 'click', 'input', function () { control.setting.set( jQuery( this ).val() ); } ); } } ); PK ���[�ЫV� � N customizer/core/custom-controls/buttonset/class-colormag-buttonset-control.phpnu �[��� <?php /** * Extend WP_Customize_Control to add the radio buttonset control. * * Class ColorMag_Color_Control * * @package ThemeGrill * @subpackage ColorMag * @since ColorMag 3.0.0 */ // Exit if accessed directly. if ( ! defined( 'ABSPATH' ) ) { exit; } /** * Class to extend WP_Customize_Control to add the radio buttonset customize control. * * Class ColorMag_Buttonset_Control */ class ColorMag_Buttonset_Control extends ColorMag_Customize_Base_Additional_Control { /** * Control's Type. * * @var string */ public $type = 'colormag-buttonset'; /** * Refresh the parameters passed to the JavaScript via JSON. * * @see WP_Customize_Control::to_json() */ public function to_json() { parent::to_json(); $this->json['default'] = $this->setting->default; if ( isset( $this->default ) ) { $this->json['default'] = $this->default; } $this->json['value'] = $this->value(); $this->json['link'] = $this->get_link(); $this->json['id'] = $this->id; $this->json['label'] = esc_html( $this->label ); $this->json['description'] = $this->description; $this->json['choices'] = $this->choices; $this->json['inputAttrs'] = ''; foreach ( $this->input_attrs as $attr => $value ) { $this->json['inputAttrs'] .= $attr . '="' . esc_attr( $value ) . '" '; } } /** * An Underscore (JS) template for this control's content (but not its container). * * Class variables for this control class are available in the `data` JS object; * export custom variables by overriding {@see WP_Customize_Control::to_json()}. * * @see WP_Customize_Control::print_template() */ protected function content_template() { ?> <div class="customizer-text"> <# if ( data.label ) { #> <span class="customize-control-label">{{{ data.label }}}</span> <# } #> <# if ( data.description ) { #> <span class="description customize-control-description">{{{ data.description }}}</span> <# } #> </div> <div id="input_{{ data.id }}" class="buttonset"> <# for ( key in data.choices ) { #> <div class="buttonset-inner"> <input {{{ data.inputAttrs }}} class="input-buttonset" type="radio" value="{{ key }}" name="_customize-radio-{{ data.id }}" id="{{ data.id }}{{ key }}" {{{ data.link }}} <# if ( data.value === key ) { #> checked="checked"<# } #> > <label for="{{ data.id }}{{ key }}" class="colormag-buttonset"> {{{ data.choices[ key ] }}} </label> </div> <# } #> </div> <?php } /** * Don't render the control content from PHP, as it's rendered via JS on load. */ public function render_content() { } } PK ���[\��� � 0 customizer/core/custom-controls/slider/slider.jsnu �[��� /** * Slider control JS to handle the range of the inputs. * * File `slider.js`. * * @package ColorMag */ wp.customize.controlConstructor[ 'colormag-slider' ] = wp.customize.Control.extend( { ready: function () { 'use strict'; let control = this, slider = this.container.find( '.colormag-progress' ), inputValue = this.container.find( '.size input' ), value = inputValue.val(), maxVal = slider.attr( 'max' ), minVal = slider.attr( 'min' ), convertedValue = ( value - minVal ) / ( maxVal - minVal ) * 100; if ( value === '' ) { let sliderValue = `linear-gradient(to right, #ebebeb 0%, #ebebeb ${convertedValue}%, #ebebeb ${convertedValue}%, #ebebeb 100%)`; slider.css( 'background', sliderValue ); } else { let sliderValue = `linear-gradient(to right, #0073AA 0%, #0073AA ${convertedValue}%, #ebebeb ${convertedValue}%, #ebebeb 100%)`; slider.css( 'background', sliderValue ); } // Size setting. control.container.on( 'change keyup paste input', '.size input', function () { let inputValue = jQuery( this ), value = inputValue.val(), maxVal = inputValue.attr( 'max' ), minVal = slider.attr( 'min' ), convertedValue = ( value - minVal ) / ( maxVal - minVal ) * 100, wrapper = jQuery( this ).closest( '.slider-wrapper' ), range = wrapper.find( 'input[type=range]' ), selector = wrapper.find( '.colormag-warning' ), setRangeValue = range.val( value ), sliderValue = `linear-gradient(to right, #0073AA 0%, #0073AA ${convertedValue}%, #ebebeb ${convertedValue}%, #ebebeb 100%)`; range.css( 'background', sliderValue ); let maxValInt = parseFloat( maxVal ), minValInt = parseFloat( minVal ), valInt = parseFloat( value ); if ( minValInt > valInt || maxValInt < valInt ) { selector.html("Value must be between " + minVal + " and " + maxVal) ; selector.addClass( "warning-visible" ); inputValue.addClass( "invalid-color" ); } else { selector.removeClass( "warning-visible" ); inputValue.removeClass( "invalid-color" ); } control.updateSize(); } ); // Range setting. control.container.on( 'change keyup paste input', '.range input', function () { control.updateSize(); } ); // Unit setting. control.container.on( 'change', '.unit-wrapper select', function () { // On unit change update the attribute. control.container.find( '.slider-label' ).each( function () { var controlValue = jQuery( this ).find( '.unit-wrapper select' ).val(); if ( controlValue ) { var attr = control.params.input_attrs.attributes_config[ controlValue ]; if ( attr ) { jQuery( this ).find( 'input' ).each( function () { jQuery( this ).attr( 'min', attr.min ); jQuery( this ).attr( 'max', attr.max ); jQuery( this ).attr( 'step', attr.step ); } ) } } } ); // Update the slider. let wrapper = jQuery( this ).closest( '.slider-label' ), slider = wrapper.find( '.range input' ); wrapper.find( '.size input' ).val( '' ); wrapper.find( '.range input' ).val( '' ); let sliderValue = `linear-gradient(to right, #0073AA 0%, #0073AA 0%, #ebebeb 0%, #ebebeb 100%)`; slider.css( 'background', sliderValue ); control.updateUnit(); } ); this.container.find( 'input[type=range]' ).on( 'input change', function () { let slider = jQuery( this ), value = slider.val(), maxVal = slider.attr( 'max' ), minVal = slider.attr( 'min' ), convertedValue = ( value - minVal ) / ( maxVal - minVal ) * 100, input_number = jQuery( this ).closest( '.slider-wrapper' ).find( '.colormag-range-value .input-wrapper input' ), sliderValue = `linear-gradient(to right, #0073AA 0%, #0073AA ${convertedValue}%, #ebebeb ${convertedValue}%, #ebebeb 100%)`; slider.css( 'background', sliderValue ); input_number.val( value ); input_number.change(); } ); // Handle the reset button. this.container.find( '.colormag-slider-reset' ).click( function () { let wrapper = jQuery( this ).closest( 'li' ).children( '.slider-label' ), input_range = wrapper.find( 'input[type=range]' ), input_number = wrapper.find( '.colormag-range-value input' ), unitSelect = wrapper.find( '.unit-wrapper select' ), default_value = input_range.data( 'reset_value' ), default_unit = input_range.data( 'reset_unit' ); if ( default_unit ) { var attr = control.params.input_attrs.attributes_config[ default_unit ]; if ( attr ) { wrapper.find( 'input' ).each( function () { jQuery( this ).attr( 'min', attr.min ); jQuery( this ).attr( 'max', attr.max ); jQuery( this ).attr( 'step', attr.step ); } ) } } unitSelect.val(default_unit ? default_unit : 'px').change(); // Trigger change event for unitSelect input_range.val(default_value).change(); // Trigger change event for input_range input_number.val(default_value).change(); // Trigger change event for input_number // Save the unitSelect, input_range, and input_number values (optional) var selectedUnit = unitSelect.val(); var inputRangeValue = input_range.val(); var inputValue = input_number.val(); } ); }, updateSize: function () { let control = this, val = control.setting.get(), hiddenValue = control.container.find( '.slider-hidden-value' ), newValue = { 'size': {} }; control.container.find( '.size .input-wrapper' ).each( function () { let controlValue = jQuery( this ).find( 'input' ).val(); newValue[ 'size' ] = controlValue; } ); // Extend/Update the `val` object to include `newValue`'s new data as an object. val = jQuery.extend( val, newValue ); jQuery( hiddenValue ).attr( 'value', JSON.stringify( val ) ).trigger( 'change' ); control.setting.set( val ); }, updateUnit: function () { let control = this, val = control.setting._value, hiddenValue = control.container.find( '.slider-hidden-value' ), newValue = { 'unit': {} }; control.container.find( '.unit-wrapper .input-wrapper' ).each( function () { let controlValue = jQuery( this ).find( 'select' ).val(); newValue[ 'unit' ] = controlValue; } ); // Extend/Update the `val` object to include `newValue`'s new data as an object. val = jQuery.extend( val, newValue ); jQuery( hiddenValue ).attr( 'value', JSON.stringify( val ) ); control.setting.set( val ); }, } ); PK ���[���� � H customizer/core/custom-controls/slider/class-colormag-slider-control.phpnu �[��� <?php /** * Extend WP_Customize_Control to add the slider control. * * Class ColorMag_Slider_Control * * @package ThemeGrill * @subpackage ColorMag * @since ColorMag 3.0.0 */ // Exit if accessed directly. if ( ! defined( 'ABSPATH' ) ) { exit; } /** * Class to extend WP_Customize_Control to add the slider customize control. * * Class ColorMag_Slider_Control */ class ColorMag_Slider_Control extends ColorMag_Customize_Base_Additional_Control { /** * Control's Type. * * @var string */ public $type = 'colormag-slider'; /** * Suffix for slider. * * @var string */ public $suffix = ''; /** * Refresh the parameters passed to the JavaScript via JSON. * * @see WP_Customize_Control::to_json() */ public function to_json() { parent::to_json(); $this->json[ 'default' ] = $this->setting->default; if ( isset( $this->default ) ) { $this->json[ 'default' ] = $this->default; } $this->json[ 'value' ] = $this->value(); $this->json[ 'link' ] = $this->get_link(); $this->json[ 'id' ] = $this->id; $this->json[ 'label' ] = esc_html( $this->label ); $this->json[ 'description' ] = $this->description; $this->json[ 'suffix' ] = $this->suffix; $slider_attribute = $this->input_attrs; $slider_unit = isset( $this->value()['unit'] ) ? $this->value()['unit'] : array_keys( $slider_attribute )[0]; $this->json['input_attrs'] = array_merge( $this->input_attrs, array( 'attributes' => $slider_attribute[ $slider_unit ], 'attributes_config' => $slider_attribute, ) ); } /** * An Underscore (JS) template for this control's content (but not its container). * * Class variables for this control class are available in the `data` JS object; * export custom variables by overriding {@see WP_Customize_Control::to_json()}. * * @see WP_Customize_Control::print_template() */ protected function content_template() { ?> <div class="slider-label"> <# if ( data.label ) { #> <div class="slider-label-unit-wrapper"> <div class="customizer-text"> <div class="label-switcher-wrapper"> <span class="customize-control-label">{{{ data.label }}}</span> </div> <div class="unit-wrapper"> <div class="input-wrapper"> <select class="slider-unit" name="unit" value="" <# if(_.size(data.suffix) === 1) { #> disabled <# } #>> <# _.each(data.suffix, function( suffix ) { #> <option value="{{ suffix }}" <# if ( data.value[ 'unit' ] == suffix ) { #> Selected <# } #> >{{suffix}} </option> <# }) #> </select> <div class="colormag-slider-reset"> <span class="dashicons dashicons-image-rotate" title="<?php esc_attr_e( 'Back to default', 'colormag' ); ?>"> </span> </div> </div> </div> </div> </div> <# } #> <div class="wrapper"> <div class="control slider-wrapper"> <span class="colormag-warning" ></span> <div class="range"> <input type="range" value="{{ data.value[ 'size' ] }}" data-reset_value="{{ data.default[ 'size' ] }}" data-reset_unit="{{ data.default[ 'unit' ] }}" min="{{{ data.input_attrs.attributes['min'] }}}" max="{{{ data.input_attrs.attributes['max'] }}}" step="{{{ data.input_attrs.attributes['step'] }}}" class="colormag-progress" /> </div> <div class="size colormag-range-value"> <div class="input-wrapper"> <input type="number" data-name="{{ data.name }}" min="{{{ data.input_attrs.attributes['min'] }}}" max="{{{ data.input_attrs.attributes['max'] }}}" step="{{{ data.input_attrs.attributes['step'] }}}" <# if ( data.value['size'] ) { #> value="{{ data.value['size'] }}" <# } else { #> value="{{ data.default['size'] }}" <# } #> /> </div> </div> </div> <input class="slider-hidden-value" value="{{ JSON.stringify( data.value ) }}" type="hidden" {{{ data.link }}} > </div> </div> <?php } /** * Don't render the control content from PHP, as it's rendered via JS on load. */ public function render_content() { } } PK ���[Th�� J customizer/core/custom-controls/upgrade/class-colormag-upgrade-control.phpnu �[��� <?php /** * Customize Upgrade control class. * * @package colormag * * @since 1.4.6 * @see WP_Customize_Control */ /** * Class ColorMag_Customize_Heading_Control */ class ColorMag_Upgrade_Control extends ColorMag_Customize_Base_Additional_Control { /** * Customize control type. * * @var string */ public $type = 'colormag-upgrade'; /** * Custom links for this control. * * @var array */ public $url = ''; /** * Refresh the parameters passed to the JavaScript via JSON. * * @see WP_Customize_Control::to_json() */ public function to_json() { parent::to_json(); $this->json['default'] = $this->setting->default; if ( isset( $this->default ) ) { $this->json['default'] = $this->default; } $this->json['url'] = esc_url( $this->url ); } /** * Renders the Underscore template for this control. * * @see WP_Customize_Control::print_template() * @return void */ protected function content_template() { ?> <div class="colormag-upgrade"> <div class="colormag-detail"> <p class="description upgrade-description">{{{ data.description }}}</p> <span> <a href="{{{data.url}}}" class="button button-primary" target="_blank"> {{ data.label }} </a> </span> </div> </div> <?php } /** * Render content is still called, so be sure to override it with an empty function in your subclass as well. */ protected function render_content() { } } PK ���[�^<� L customizer/core/custom-controls/subtitle/class-colormag-subtitle-control.phpnu �[��� <?php /** * Extend WP_Customize_Control to add the title control. * * Class ColorMag_Subtitle_Control * * @package ThemeGrill * @subpackage ColorMag * TODO @since */ // Exit if accessed directly. defined( 'ABSPATH' ) || exit; /** * Class to extend WP_Customize_Control to add the title customize control. * * Class ColorMag_Subtitle_Control */ class ColorMag_Subtitle_Control extends ColorMag_Customize_Base_Additional_Control { /** * Control's Type. * * @var string */ public $type = 'colormag-subtitle'; /** * Refresh the parameters passed to the JavaScript via JSON. * * @see WP_Customize_Control::to_json() */ public function to_json() { parent::to_json(); $this->json['label'] = esc_html( $this->label ); } /** * An Underscore (JS) template for this control's content (but not its container). * * Class variables for this control class are available in the `data` JS object; * export custom variables by overriding {@see WP_Customize_Control::to_json()}. * * @see WP_Customize_Control::print_template() */ protected function content_template() { ?> <div class="colormag-subtitle-wrapper"> <div class="customizer-text"> <# if ( data.label ) { #> <span class="customize-control-subtitle">{{{ data.label }}}</span> <# } #> </div> </div> <?php } /** * Don't render the control content from PHP, as it's rendered via JS on load. */ public function render_content() { } } PK ���[���: : H customizer/core/custom-controls/hidden/class-colormag-hidden-control.phpnu �[��� <?php /** * Extend WP_Customize_Control to include hidden control. * * Class ColorMag_Hidden_Control * * @package ThemeGrill * @subpackage ColorMag * @since ColorMag 3.0.0 */ // Exit if accessed directly. if ( ! defined( 'ABSPATH' ) ) { exit; } /** * Class to extend WP_Customize_Control to add the hidden customize control. * * Class ColorMag_Hidden_Control */ class ColorMag_Hidden_Control extends ColorMag_Customize_Base_Additional_Control { /** * Control's Type. * * @var string */ public $type = 'colormag-hidden'; /** * Refresh the parameters passed to the JavaScript via JSON. * * @see WP_Customize_Control::to_json() */ public function to_json() { parent::to_json(); $this->json['default'] = $this->setting->default; if ( isset( $this->default ) ) { $this->json['default'] = $this->default; } $this->json['value'] = $this->value(); $this->json['link'] = $this->get_link(); $this->json['id'] = $this->id; $this->json['label'] = esc_html( $this->label ); $this->json['description'] = $this->description; } /** * An Underscore (JS) template for this control's content (but not its container). * * Class variables for this control class are available in the `data` JS object; * export custom variables by overriding {@see WP_Customize_Control::to_json()}. * * @see WP_Customize_Control::print_template() */ protected function content_template() { ?> <input type='hidden' class='hidden-field-{{ data.settings.default }}' data-name='{{ data.settings.default }}' value='{{ data.value }}' > <?php } /** * Don't render the control content from PHP, as it's rendered via JS on load. */ public function render_content() { } } PK ���[��fS S T customizer/core/custom-controls/class-colormag-customize-base-additional-control.phpnu �[��� <?php /** * ColorMag customizer base additional control class for theme customize options. * * Class ColorMag_Customize_Base_Additional_Control * * @package ThemeGrill * @subpackage ColorMag * @since ColorMag 3.0.0 */ // Exit if accessed directly. if ( ! defined( 'ABSPATH' ) ) { exit; } /** * Class ColorMag_Customize_Base_Additional_Control */ class ColorMag_Customize_Base_Additional_Control extends WP_Customize_Control { /** * Enqueue control related scripts/styles. */ public function enqueue() { $suffix = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min'; /** * Enqueue required Customize Controls CSS files. */ // SelectWoo CSS library file. wp_enqueue_style( 'selectWoo', $this->get_assets_url() . '/assets/css/selectWoo' . $suffix . '.css', array(), COLORMAG_THEME_VERSION ); wp_enqueue_style( 'jquery-ui', $this->get_assets_url() . '/assets/css/jquery-ui/jquery-ui' . $suffix . '.css', array(), COLORMAG_THEME_VERSION ); wp_style_add_data( 'jquery-ui', 'rtl', 'replace' ); // Main CSS file. wp_enqueue_style( 'colormag-customize-controls', $this->get_assets_url() . '/assets/css/customize-controls' . $suffix . '.css', array( 'wp-color-picker' ), COLORMAG_THEME_VERSION ); wp_style_add_data( 'colormag-customize-controls', 'rtl', 'replace' ); /** * Enqueue required Customize Controls JS files. */ // SelectWoo JS library file. wp_enqueue_script( 'selectWoo', $this->get_assets_url() . '/assets/js/selectWoo' . $suffix . '.js', array(), COLORMAG_THEME_VERSION, true ); // WP Color Picker Alpha JS library file. wp_enqueue_script( 'wp-color-picker-alpha', $this->get_assets_url() . '/assets/js/wp-color-picker-alpha' . $suffix . '.js', array( 'wp-color-picker', ), COLORMAG_THEME_VERSION, true ); // Main JS file. wp_enqueue_script( 'colormag-customize-controls', $this->get_assets_url() . '/assets/js/customize-controls' . $suffix . '.js', array( 'jquery', 'jquery-ui-datepicker', 'wp-tinymce', ), COLORMAG_THEME_VERSION, true ); } public function get_assets_url() { // Get correct URL and path to wp-content. $content_url = untrailingslashit( dirname( dirname( get_stylesheet_directory_uri() ) ) ); $content_dir = wp_normalize_path( untrailingslashit( WP_CONTENT_DIR ) ); $url = str_replace( $content_dir, $content_url, wp_normalize_path( __DIR__ ) ); $url = set_url_scheme( $url ); return $url; } } PK ���[r�� R customizer/core/custom-controls/fontawesome/class-colormag-fontawesome-control.phpnu �[��� <?php /** * Extend WP_Customize_Control to add the fontawesome control. * * Class ColorMag_Fontawesome_Control * * @package ThemeGrill * @subpackage ColorMag * @since ColorMag 3.0.0 */ // Exit if accessed directly. if ( ! defined( 'ABSPATH' ) ) { exit; } /** * Class to extend WP_Customize_Control to add the fontawesome customize control. * * Class ColorMag_Fontawesome_Control */ class ColorMag_Fontawesome_Control extends ColorMag_Customize_Base_Additional_Control { /** * Control's Type. * * @var string */ public $type = 'colormag-fontawesome'; /** * Enqueue control related scripts/styles. */ public function enqueue() { parent::enqueue(); $suffix = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min'; /** * Filter for fontawesome source. * * @since 1.0.0 */ wp_enqueue_style( 'font-awesome', get_template_directory_uri() . apply_filters( 'colormag_fontawesome_src', '/font-awesome/css/font-awesome' ) . $suffix . '.css', false, '4.7.0' ); // Get choices. $fontawesome_array = $this->choices; wp_localize_script( 'colormag-customize-controls', 'ColorMagCustomizerControlFontawesome' . $this->id, $fontawesome_array ); } /** * Refresh the parameters passed to the JavaScript via JSON. * * @see WP_Customize_Control::to_json() */ public function to_json() { parent::to_json(); $this->json['choices'] = $this->choices; $this->json['id'] = $this->id; $this->json['label'] = esc_html( $this->label ); $this->json['description'] = $this->description; $this->json['inputAttrs'] = ''; foreach ( $this->input_attrs as $attr => $value ) { $this->json['inputAttrs'] .= $attr . '="' . esc_attr( $value ) . '" '; } } /** * An Underscore (JS) template for this control's content (but not its container). * * Class variables for this control class are available in the `data` JS object; * export custom variables by overriding {@see WP_Customize_Control::to_json()}. * * @see WP_Customize_Control::print_template() */ protected function content_template() { ?> <label for="_colormag-fontawesome-{{{ data.id }}}"> <# if ( data.label ) { #><span class="customize-control-label">{{{ data.label }}}</span><# } #> <# if ( data.description ) { #><span class="description customize-control-description">{{{ data.description }}}</span><# } #> </label> <div class="colormag-fontawesome-wrapper"> <select {{{ data.inputAttrs }}} id="_colormag-fontawesome-{{{ data.id }}}"></select> </div> <!-- /.colormag-fontawesome-wrapper --> <?php } /** * Don't render the control content from PHP, as it's rendered via JS on load. */ public function render_content() { } } PK ���[�3� : customizer/core/custom-controls/fontawesome/fontawesome.jsnu �[��� /** * Control: FontAwesome. */ ( function ( $ ) { wp.customize.controlConstructor['colormag-fontawesome'] = wp.customize.Control.extend( { ready: function () { 'use strict'; var control = this; control.initColorMagFontawesomeControl(); }, initColorMagFontawesomeControl: function() { var control = this, selector = control.selector, elSelector = $( selector ).find( 'select' ), faData = [], value = control.setting._value, data = window['ColorMagCustomizerControlFontawesome' + this.id], faDataCounter = 0, faSelect; $.each( data, function ( key, value ) { faData[ faDataCounter ] = { id: value, text: value }; faDataCounter++; } ); // Add HTML inside the option element. function formatState( state ) { if ( ! state.id ) { return state.text; } var $state = $( '<span><i class="fa fa-lg ' + state.text + '"></i> ' + state.text + '</span>' ); return $state; }; // Apply selectWoo. faSelect = elSelector.selectWoo( { data: faData, width: '100%', templateResult: formatState, } ); faSelect.val( value ).trigger( 'change' ); faSelect.on( 'change', function () { control.setting.set( elSelector.val() ); } ); }, } ); } )( jQuery ); PK ���[��~ J customizer/core/custom-controls/heading/class-colormag-heading-control.phpnu �[��� <?php /** * Extend WP_Customize_Control to add the heading control. * * Class ColorMag_Heading_Control * * @package ThemeGrill * @subpackage ColorMag * @since ColorMag 3.0.0 */ // Exit if accessed directly. if ( ! defined( 'ABSPATH' ) ) { exit; } /** * Class to extend WP_Customize_Control to add the heading customize control. * * Class ColorMag_Heading_Control */ class ColorMag_Heading_Control extends ColorMag_Customize_Base_Additional_Control { /** * Control's Type. * * @var string */ public $type = 'colormag-heading'; /** * Refresh the parameters passed to the JavaScript via JSON. * * @see WP_Customize_Control::to_json() */ public function to_json() { parent::to_json(); $this->json['label'] = esc_html( $this->label ); $this->json['description'] = $this->description; } /** * An Underscore (JS) template for this control's content (but not its container). * * Class variables for this control class are available in the `data` JS object; * export custom variables by overriding {@see WP_Customize_Control::to_json()}. * * @see WP_Customize_Control::print_template() */ protected function content_template() { ?> <div class="colormag-heading-wrapper"> <label class="customizer-text"> <# if ( data.label ) { #> <span class="customize-control-title wp-ui-text-highlight">{{{ data.label }}}</span> <# } #> <# if ( data.description ) { #> <span class="description customize-control-description">{{{ data.description }}}</span> <# } #> </label> </div> <?php } /** * Don't render the control content from PHP, as it's rendered via JS on load. */ public function render_content() { } } PK ���[�Sq�e e b customizer/core/custom-controls/dropdown-categories/class-colormag-dropdown-categories-control.phpnu �[��� <?php /** * Extend WP_Customize_Control to add dropdown categories control. * * Class ColorMag_Dropdown_Categories_Control * * @package ThemeGrill * @subpackage ColorMag * @since ColorMag 3.0.0 */ // Exit if accessed directly. if ( ! defined( 'ABSPATH' ) ) { exit; } /** * Class to extend WP_Customize_Control to add dropdown categories customize control. * * Class ColorMag_Dropdown_Categories_Control */ class ColorMag_Dropdown_Categories_Control extends ColorMag_Customize_Base_Additional_Control { /** * Control's Type. * * @var string */ public $type = 'colormag-dropdown-categories'; /** * Dropdown categories array for this control. * * @var array */ public $dropdown = array(); /** * Refresh the parameters passed to the JavaScript via JSON. * * @see WP_Customize_Control::to_json() */ public function to_json() { parent::to_json(); $this->json['default'] = $this->setting->default; if ( isset( $this->default ) ) { $this->json['default'] = $this->default; } $this->json['value'] = $this->value(); $this->json['link'] = $this->get_link(); $this->json['id'] = $this->id; $this->json['label'] = esc_html( $this->label ); $this->json['description'] = $this->description; $dropdown = wp_dropdown_categories( array( 'echo' => false, 'name' => '_customize-dropdown-categories-' . esc_attr( $this->id ), 'show_option_none' => ' ', 'option_none_value' => '-1', 'selected' => esc_attr( $this->value() ), ) ); // Add in the data link parameter for dropdown categories. $dropdown = str_replace( '<select', '<select ' . $this->get_link(), $dropdown ); $this->json['dropdown'] = $dropdown; $this->json['inputAttrs'] = ''; foreach ( $this->input_attrs as $attr => $value ) { $this->json['inputAttrs'] .= $attr . '="' . esc_attr( $value ) . '" '; } } /** * An Underscore (JS) template for this control's content (but not its container). * * Class variables for this control class are available in the `data` JS object; * export custom variables by overriding {@see WP_Customize_Control::to_json()}. * * @see WP_Customize_Control::print_template() */ protected function content_template() { ?> <div class="customizer-text"> <# if ( data.label ) { #> <span class="customize-control-label">{{{ data.label }}}</span> <# } #> <# if ( data.description ) { #> <span class="description customize-control-description">{{{ data.description }}}</span> <# } #> </div> <div class="customize-control-content"> {{{ data.dropdown }}} </div> <?php } /** * Don't render the control content from PHP, as it's rendered via JS on load. */ public function render_content() { } } PK ���[��L� � J customizer/core/custom-controls/dropdown-categories/dropdown-categories.jsnu �[��� /** * Dropdown categories control JS to handle the dropdown categories customize control. * * File `dropdown-categorie.js`. * * @package ColorMag */ wp.customize.controlConstructor[ 'colormag-dropdown-categories' ] = wp.customize.Control.extend( { ready : function () { 'use strict'; var control = this; // Change the value. this.container.on( 'change', 'select', function () { control.setting.set( jQuery( this ).val() ); } ); } } ); PK ���[lJ�5o o . customizer/core/custom-controls/color/color.jsnu �[��� /** * Color picker control JS to handle color picker rendering within customize control. * * File `color.js`. * * @package ColorMag */ ( function ( $ ) { $( window ).on( 'load', function () { $( 'html' ).addClass( 'colorpicker-ready' ); } ); wp.customize.controlConstructor[ 'colormag-color' ] = wp.customize.Control.extend( { ready : function () { 'use strict'; var control = this, isHueSlider = ( this.params.mode === 'hue' ), picker = this.container.find( '.colormag-color-picker-alpha' ), color = picker.val().replace( /\s+/g, '' ); picker.wpColorPicker( { change : function ( event, ui ) { var current = ( isHueSlider ? ui.color.h() : picker.iris( 'color' ) ); if ( jQuery( 'html' ).hasClass( 'colorpicker-ready' ) && color !== current.replace( /\s+/g, '' ) ) { control.setting.set( current ); } }, clear: function() { if ( ! control.setting.get() ) { control.setting.set( '' ); } control.setting.set( '' ); } } ); } } ); } )( jQuery ); PK ���[/*�F F F customizer/core/custom-controls/color/class-colormag-color-control.phpnu �[��� <?php /** * Extend WP_Customize_Control to add the color control. * * Class ColorMag_Color_Control * * @package ThemeGrill * @subpackage ColorMag * @since ColorMag 3.0.0 */ // Exit if accessed directly. if ( ! defined( 'ABSPATH' ) ) { exit; } /** * Class to extend WP_Customize_Control to add the color customize control. * * Class ColorMag_Color_Control */ class ColorMag_Color_Control extends ColorMag_Customize_Base_Additional_Control { /** * Control's Type. * * @var string */ public $type = 'colormag-color'; /** * Enqueue control related scripts/styles. */ public function enqueue() { parent::enqueue(); /** * Color picker strings from WordPress. * * Added since WordPress 5.5 has removed them causing alpha color not appearing issue. */ if ( version_compare( $GLOBALS['wp_version'], '5.5', '>=' ) ) { wp_localize_script( 'wp-color-picker', 'wpColorPickerL10n', array( 'clear' => esc_html__( 'Clear', 'colormag' ), 'clearAriaLabel' => esc_html__( 'Clear color', 'colormag' ), 'defaultString' => esc_html__( 'Default', 'colormag' ), 'defaultAriaLabel' => esc_html__( 'Select default color', 'colormag' ), 'pick' => esc_html__( 'Select Color', 'colormag' ), 'defaultLabel' => esc_html__( 'Color value', 'colormag' ), ) ); } } /** * Refresh the parameters passed to the JavaScript via JSON. * * @see WP_Customize_Control::to_json() */ public function to_json() { parent::to_json(); $this->json['default'] = $this->setting->default; if ( isset( $this->default ) ) { $this->json['default'] = $this->default; } $this->json['value'] = $this->value(); $this->json['link'] = $this->get_link(); $this->json['id'] = $this->id; $this->json['label'] = esc_html( $this->label ); $this->json['description'] = $this->description; } /** * An Underscore (JS) template for this control's content (but not its container). * * Class variables for this control class are available in the `data` JS object; * export custom variables by overriding {@see WP_Customize_Control::to_json()}. * * @see WP_Customize_Control::print_template() */ protected function content_template() { ?> <div class="customizer-wrapper"> <div class="customizer-text"> <# if ( data.label ) { #> <span class="customize-control-label">{{{ data.label }}}</span> <# } #> <# if ( data.description ) { #> <span class="description customize-control-description">{{{ data.description }}}</span> <# } #> </div> <div class="customize-control-content"> <input class="colormag-color-picker-alpha color-picker-hex" type="text" data-alpha-enabled="true" data-default-color="{{ data.default }}" value="{{ data.value }}" /> </div> </div> <?php } /** * Don't render the control content from PHP, as it's rendered via JS on load. */ public function render_content() { } } PK ���[��S� � L customizer/core/custom-controls/sortable/class-colormag-sortable-control.phpnu �[��� <?php /** * Extend WP_Customize_Control to add the sortable control. * * Class ColorMag_Sortable_Control * * @package ThemeGrill * @subpackage ColorMag * @since ColorMag 3.0.0 */ // Exit if accessed directly. if ( ! defined( 'ABSPATH' ) ) { exit; } /** * Class to extend WP_Customize_Control to add the sortable customize control. * * Class ColorMag_Sortable_Control */ class ColorMag_Sortable_Control extends ColorMag_Customize_Base_Additional_Control { /** * Control's Type. * * @var string */ public $type = 'colormag-sortable'; public $unsortable = array(); /** * Refresh the parameters passed to the JavaScript via JSON. * * @see WP_Customize_Control::to_json() */ public function to_json() { parent::to_json(); $this->json[ 'default' ] = $this->setting->default; if ( isset( $this->default ) ) { $this->json[ 'default' ] = $this->default; } $this->json[ 'value' ] = $this->value(); $this->json[ 'link' ] = $this->get_link(); $this->json[ 'id' ] = $this->id; $this->json[ 'label' ] = esc_html( $this->label ); $this->json[ 'description' ] = $this->description; $this->json[ 'choices' ] = array(); $this->json[ 'unsortable' ] = array(); $this->json[ 'inputAttrs' ] = ''; foreach ( $this->choices as $key => $value ) { if ( in_array( $key, $this->unsortable, true ) ) { continue; } $this->json[ 'choices' ][ $key ] = $value; } foreach ( $this->unsortable as $item ) { if ( in_array( $item, array_keys( $this->choices ), true ) ) { $this->json[ 'unsortable' ][ $item ] = $this->choices[ $item ]; } } foreach ( $this->input_attrs as $attr => $value ) { $this->json[ 'inputAttrs' ] .= $attr . '="' . esc_attr( $value ) . '" '; } } /** * An Underscore (JS) template for this control's content (but not its container). * * Class variables for this control class are available in the `data` JS object; * export custom variables by overriding {@see WP_Customize_Control::to_json()}. * * @see WP_Customize_Control::print_template() */ protected function content_template() { ?> <div class="customizer-text"> <# if ( data.label ) { #> <span class="customize-control-label">{{{ data.label }}}</span> <# } #> <# if ( data.description ) { #> <span class="description customize-control-description">{{{ data.description }}}</span> <# } #> </div> <ul class="unsortable"> <# _.each( data.unsortable, function( choiceLabel, choiceID ) { #> <# if( _.contains( data.value, choiceID) ){ #> <li {{{ data.inputAttrs }}} class='colormag-sortable-item' data-value='{{ choiceID }}'> <span class="colormag-label">{{{ choiceLabel }}}</span> <span class="switch-wrap"> <span class="switch"></span> </span> </li> <# }else { #> <li {{{ data.inputAttrs }}} class='colormag-sortable-item invisible' data-value='{{ choiceID }}'> <span class="colormag-label">{{{ choiceLabel }}}</span> <span class="switch-wrap"> <span class="switch"></span> </span> </li> <# } #> <# } ); #> </ul> <ul class="sortable"> <# _.each( data.value, function( choiceID ) { #> <# if ( data.choices[ choiceID ] ) { #> <li {{{ data.inputAttrs }}} class='colormag-sortable-item' data-value='{{ choiceID }}'> <span class="colormag-choice"> <i class='dashicons dashicons-menu'></i> <span class="colormag-label"> {{{ data.choices[ choiceID ] }}} </span> </span> <span class="switch-wrap"> <span class="switch"></span> </span> </li> <# } #> <# } ); #> <# _.each( data.choices, function( choiceLabel, choiceID ) { #> <# if ( Array.isArray(data.value) && -1 === data.value.indexOf( choiceID ) ) { #> <li {{{ data.inputAttrs }}} class='colormag-sortable-item invisible' data-value='{{ choiceID }}'> <span class="colormag-choice"> <i class='dashicons dashicons-menu'></i> <span class="colormag-label"> {{{ data.choices[ choiceID ] }}} </span> </span> <span class="switch-wrap"> <span class="switch"></span> </span> </li> <# } #> <# } ); #> </ul> <?php } /** * Don't render the control content from PHP, as it's rendered via JS on load. */ public function render_content() { } } PK ���[�!��� � 4 customizer/core/custom-controls/sortable/sortable.jsnu �[��� /** * Sortable control JS to handle the sortable feature of custom customize controls. * * File `sortable.js`. * * @package ColorMag */ wp.customize.controlConstructor['colormag-sortable'] = wp.customize.Control.extend( { ready : function () { 'use strict'; var control = this; // Set the sortable container. control.sortableContainer = control.container.find( 'ul.sortable' ).first(); control.unsortableContainer = control.container.find( 'ul.unsortable' ).first(); control.unsortableContainer.find( 'li' ).each( function () { jQuery( this ).find( '.switch' ).on( 'click', function() { jQuery( this ).parents( 'li:eq(0)' ).toggleClass( 'invisible' ); } ) } ).click( function () { // Update value on click. control.updateValue(); } ); // Init sortable. control.sortableContainer.sortable( { // Update value when we stop sorting. stop : function () { control.updateValue(); } } ).disableSelection().find( 'li' ).each( function () { // Enable/disable options when we click on the eye of Thundera. jQuery( this ).find( '.switch' ).click( function () { jQuery( this ).parents( 'li:eq(0)' ).toggleClass( 'invisible' ); } ); } ).click( function () { // Update value on click. control.updateValue(); } ); }, updateValue : function () { 'use strict'; var control = this, sortable = [], unsortable =[], newValue = []; this.sortableContainer.find( 'li' ).each( function () { if ( ! jQuery( this ).is( '.invisible' ) ) { sortable.push( jQuery( this ).data( 'value' ) ); } } ); this.unsortableContainer.find( 'li' ).each( function (i) { if ( ! jQuery( this ).is( '.invisible' ) ) { unsortable.push( jQuery( this ).data( 'value' ) ); } } ); newValue = unsortable.concat(sortable); control.setting.set( newValue ); } } ); PK ���[Mxuq�o �o 8 customizer/core/custom-controls/typography/typography.jsnu �[��� /** * Typography control JS to handle the typography customize option. * * File `typography.js`. * * @package ColorMag */ wp.customize.controlConstructor[ 'colormag-typography' ] = wp.customize.Control.extend( { ready: function () { 'use strict'; const control = this; // Font size progress bar setting. control.container.find( '.font-size .control-wrap' ).each( function () { let device = jQuery( this ).find( 'input[type=number]' ).data( 'device' ), slider = jQuery( this ).closest( '.font-size' ).find( '.' + device + ' ' + 'input[type=range]' ), value = slider.val(), maxVal = slider.attr( 'max' ), minVal = slider.attr( 'min' ), convertedValue = ( value - minVal ) / ( maxVal - minVal ) * 100; let sliderValue = `linear-gradient(to right, #0073AA 0%, #0073AA ${convertedValue}%, #ebebeb ${convertedValue}%, #ebebeb 100%)`; slider.css( 'background', sliderValue ); } ); // Line height progress bar setting. control.container.find( '.line-height .control-wrap' ).each( function () { let device = jQuery( this ).find( 'input[type=number]' ).data( 'device' ), slider = jQuery( this ).closest( '.line-height' ).find( '.' + device + ' ' + 'input[type=range]' ), value = slider.val(), maxVal = slider.attr( 'max' ), minVal = slider.attr( 'min' ), convertedValue = ( value - minVal ) / ( maxVal - minVal ) * 100; let sliderValue = `linear-gradient(to right, #0073AA 0%, #0073AA ${convertedValue}%, #ebebeb ${convertedValue}%, #ebebeb 100%)`; slider.css( 'background', sliderValue ); } ); // Letter spacing progress bar setting. control.container.find( '.letter-spacing .control-wrap' ).each( function () { let device = jQuery( this ).find( 'input[type=number]' ).data( 'device' ), slider = jQuery( this ).closest( '.letter-spacing' ).find( '.' + device + ' ' + 'input[type=range]' ), value = slider.val(), maxVal = slider.attr( 'max' ), minVal = slider.attr( 'min' ), convertedValue = ( value - minVal ) / ( maxVal - minVal ) * 100; let sliderValue = `linear-gradient(to right, #0073AA 0%, #0073AA ${convertedValue}%, #ebebeb ${convertedValue}%, #ebebeb 100%)`; slider.css( 'background', sliderValue ); } ); // On customizer load, render the available font options. control.renderFontSelector(); control.renderVariantSelector(); control.renderSubsetSelector(); // Font style setting. control.container.on( 'change', '.font-style select', function () { control.saveValue( 'font-style', jQuery( this ).val() ); } ); // Text transform setting. control.container.on( 'change', '.text-transform select', function () { control.saveValue( 'text-transform', jQuery( this ).val() ); } ); // Text decoration setting. control.container.on( 'change', '.text-decoration select', function () { control.saveValue( 'text-decoration', jQuery( this ).val() ); } ); // Font size setting. control.container.on( 'change keyup', '.font-size .size input', function () { let inputValue = jQuery( this ), value = inputValue.val(), maxVal = inputValue.attr( 'max' ), minVal = inputValue.attr( 'min' ), convertedValue = ( value - minVal ) / ( maxVal - minVal ) * 100, wrapper = jQuery( this ).closest( '.slider-wrapper' ), range = wrapper.find( 'input[type=range]' ), input = wrapper.find( 'input[type=number]' ), device = input.data( 'device' ), selector = wrapper.find( '.colormag-font-size-' + device + '-warning' ), setRangeValue = range.val( value ), sliderValue = `linear-gradient(to right, #0073AA 0%, #0073AA ${convertedValue}%, #ebebeb ${convertedValue}%, #ebebeb 100%)`; range.css( 'background', sliderValue ); let maxValInt = parseFloat( maxVal ), minValInt = parseFloat( minVal ), valInt = parseFloat( value ); if ( minValInt > valInt || maxValInt < valInt ) { selector.html("Value must be between " + minVal + " and " + maxVal) ; selector.addClass( "warning-visible" ); inputValue.addClass( "invalid-color" ); } else { selector.removeClass( "warning-visible" ); inputValue.removeClass( "invalid-color" ); } control.updateFontSize(); } ); // Range setting. control.container.on( 'change keyup paste input', '.font-size .range input', function () { control.updateFontSize(); } ); // On font size range input change. this.container.find( '.font-size input[type=range]' ).on( 'input change', function () { var slider = jQuery( this ), value = slider.val(), input_number = jQuery( this ).closest( '.slider-wrapper' ).find( '.colormag-range-value .input-wrapper input' ); input_number.val( value ); input_number.change(); } ); // On line height range input change. this.container.find( '.line-height input[type=range]' ).on( 'input change', function () { var slider = jQuery( this ), value = slider.val(), maxVal = slider.attr( 'max' ), minVal = slider.attr( 'min' ), convertedValue = ( value - minVal ) / ( maxVal - minVal ) * 100, input_number = jQuery( this ).closest( '.slider-wrapper' ).find( '.colormag-range-value .input-wrapper input' ), sliderValue = `linear - gradient( to right, #0073AA 0 % , #0073AA ${convertedValue} % , #ebebeb ${convertedValue} % , #ebebeb 100 % )`; slider.css( 'background', sliderValue ); input_number.val( value ); input_number.change(); } ); // On letter spacing range input change. this.container.find( '.letter-spacing input[type=range]' ).on( 'input change', function () { var slider = jQuery( this ), value = slider.val(), maxVal = slider.attr( 'max' ), minVal = slider.attr( 'min' ), convertedValue = ( value - minVal ) / ( maxVal - minVal ) * 100, input_number = jQuery( this ).closest( '.slider-wrapper' ).find( '.colormag-range-value .input-wrapper input' ), sliderValue = `linear - gradient( to right, #0073AA 0 % , #0073AA ${convertedValue} % , #ebebeb ${convertedValue} % , #ebebeb 100 % )`; slider.css( 'background', sliderValue ); input_number.val( value ); input_number.change(); } ); // Font size unit setting. control.container.on( 'change', '.font-size-unit', function () { // On unit change update the attribute. control.container.find( '.font-size .control-wrap' ).each( function () { let controlValue = jQuery( this ).find( '.unit-wrapper .font-size-unit' ).val(); if ( controlValue ) { let attr = control.params.input_attrs.attributes_config[ 'font-size' ][ controlValue ]; if ( attr ) { jQuery( this ).find( 'input' ).each( function () { jQuery( this ).attr( 'min', attr.min ); jQuery( this ).attr( 'max', attr.max ); jQuery( this ).attr( 'step', attr.step ); } ) } } } ); let wrapper = jQuery( this ).closest( '.control-wrap' ), slider = wrapper.find( '.range input' ); wrapper.find( '.size input' ).val( '' ); wrapper.find( '.range input' ).val( '' ); let sliderValue = `linear-gradient(to right, #0073AA 0%, #0073AA 0%, #ebebeb 0%, #ebebeb 100%)`; slider.css( 'background', sliderValue ); control.updateFontSizeUnit(); } ); // Reset value. function resetControlValues( controlType ) { control.container.find( `.${controlType} .control-wrap` ).each( function () { const wrapper = jQuery( this ), slider = wrapper.find( '.range input' ), input = wrapper.find( '.size input' ), unit = wrapper.find( '.unit-wrapper select' ), defaultValue = slider.data( 'reset_value' ), defaultUnit = slider.data( 'reset_unit' ); if ( defaultUnit ) { let attr = control.params.input_attrs.attributes_config[ controlType ][ defaultUnit ]; if ( attr ) { jQuery( this ).find( 'input' ).each( function () { jQuery( this ).attr( 'min', attr.min ); jQuery( this ).attr( 'max', attr.max ); jQuery( this ).attr( 'step', attr.step ); } ) } } unit.val(defaultUnit ? defaultUnit : 'px').change(); // Trigger change event for unit slider.val(defaultValue).change(); // Trigger change event for slider input.val(defaultValue).change(); // Trigger change event for inputValue // Save the unit, slider, and inputValue values (optional) var selectedUnit = unit.val(); var inputRangeValue = slider.val(); var inputValue = input.val(); } ); } control.container.on('click', '.colormag-font-size-reset', function () { resetControlValues('font-size'); }); control.container.on('click', '.colormag-line-height-reset', function () { resetControlValues('line-height'); }); control.container.on('click', '.colormag-letter-spacing-reset', function () { resetControlValues('letter-spacing'); }); // Line height setting. control.container.on( 'change keyup paste input', '.line-height input', function () { let inputValue = jQuery( this ), value = inputValue.val(), maxVal = inputValue.attr( 'max' ), minVal = inputValue.attr( 'min' ), convertedValue = ( value - minVal ) / ( maxVal - minVal ) * 100, wrapper = jQuery( this ).closest( '.slider-wrapper' ), range = wrapper.find( 'input[type=range]' ), input = wrapper.find( 'input[type=number]' ), device = input.data( 'device' ), selector = wrapper.find( '.colormag-line-height-' + device + '-warning' ), setRangeValue = range.val( value ), sliderValue = `linear-gradient(to right, #0073AA 0%, #0073AA ${convertedValue}%, #ebebeb ${convertedValue}%, #ebebeb 100%)`; range.css( 'background', sliderValue ); let maxValInt = parseFloat( maxVal ), minValInt = parseFloat( minVal ), valInt = parseFloat( value ); if ( minValInt > valInt || maxValInt < valInt ) { selector.html("Value must be between " + minVal + " and " + maxVal) ; selector.addClass( "warning-visible" ); inputValue.addClass( "invalid-color" ); } else { selector.removeClass( "warning-visible" ); inputValue.removeClass( "invalid-color" ); } control.updateLineHeight(); } ); // Line height unit setting. control.container.on( 'change', '.line-height-unit', function () { control.container.find( '.line-height .control-wrap' ).each( function () { var unitValue = jQuery( this ).find( '.unit-wrapper .line-height-unit' ).val(); if ( unitValue ) { var attr = control.params.input_attrs.attributes_config[ 'line-height' ][ unitValue ]; if ( attr ) { jQuery( this ).find( 'input' ).each( function () { jQuery( this ).attr( 'min', attr.min ); jQuery( this ).attr( 'max', attr.max ); jQuery( this ).attr( 'step', attr.step ); } ) } } } ); let wrapper = jQuery( this ).closest( '.control-wrap' ), slider = wrapper.find( '.range input' ); wrapper.find( '.size input' ).val( '' ); wrapper.find( '.range input' ).val( '' ); let sliderValue = `linear-gradient(to right, #0073AA 0%, #0073AA 0%, #ebebeb 0%, #ebebeb 100%)`; slider.css( 'background', sliderValue ); control.updateLineHeightUnit(); } ); // Letter spacing unit setting. control.container.on( 'change keyup paste input', '.letter-spacing-unit', function () { control.updateLetterSpacingUnit(); } ); // Letter spacing setting. control.container.on( 'change keyup paste input', '.letter-spacing input', function () { var inputValue = jQuery( this ), value = inputValue.val(), maxVal = inputValue.attr( 'max' ), minVal = inputValue.attr( 'min' ), convertedValue = ( value - minVal ) / ( maxVal - minVal ) * 100, wrapper = jQuery( this ).closest( '.slider-wrapper' ), range = wrapper.find( 'input[type=range]' ), input = wrapper.find( 'input[type=number]' ), device = input.data( 'device' ), selector = wrapper.find( '.colormag-letter-spacing-' + device + '-warning' ), setRangeValue = range.val( value ), sliderValue = `linear-gradient(to right, #0073AA 0%, #0073AA ${convertedValue}%, #ebebeb ${convertedValue}%, #ebebeb 100%)`; range.css( 'background', sliderValue ); let maxValInt = parseFloat( maxVal ), minValInt = parseFloat( minVal ), valInt = parseFloat( value ); if ( minValInt > valInt || maxValInt < valInt ) { selector.html("Value must be between " + minVal + " and " + maxVal) ; selector.addClass( "warning-visible" ); inputValue.addClass( "invalid-color" ); } else { selector.removeClass( "warning-visible" ); inputValue.removeClass( "invalid-color" ); } control.updateLetterSpacing(); } ); }, renderFontSelector: function () { var control = this, selector = control.selector + ' .font-family select', standardFonts = [], googleFonts = [], customFonts = [], value = control.setting._value, fonts = control.getFonts(), fontSelect; // Format standard fonts as an array. if ( ! _.isUndefined( fonts.standard ) ) { _.each( fonts.standard, function ( font ) { standardFonts.push( { id: font.family.replace( /"/g, ''' ), text: font.label } ); } ); } // Format Google fonts as an array. if ( ! _.isUndefined( fonts.google ) ) { _.each( fonts.google, function ( font ) { googleFonts.push( { id: font.family, text: font.label } ); } ); } // Combine fonts and build the final data. data = [ { text: fonts.standardfontslabel, children: standardFonts }, { text: fonts.googlefontslabel, children: googleFonts } ]; // Format custom fonts as an array. if ( ! _.isUndefined( fonts.custom ) ) { _.each( fonts.custom, function ( font ) { customFonts.push( { id: font.family, text: font.label } ); } ); // Merge on `data` array. data.push( { text: fonts.customfontslabel, children: customFonts } ); } // Instantiate selectWoo with the data. fontSelect = jQuery( selector ).selectWoo( { data: data, width: '100%' } ); // Set the initial value. if ( value[ 'font-family' ] ) { fontSelect.val( value[ 'font-family' ].replace( /'/g, '"' ) ).trigger( 'change' ); } // When the font option value changes. fontSelect.on( 'change', function () { // Set the value. control.saveValue( 'font-family', jQuery( this ).val() ); // Render new list of selected font options. control.renderVariantSelector(); control.renderSubsetSelector(); } ); }, getFonts: function () { var control = this; if ( ! _.isUndefined( ColorMagCustomizerControlTypography ) ) { return ColorMagCustomizerControlTypography; } return { google: [], standard: [] }; }, renderVariantSelector: function () { var control = this, value = control.setting._value, fontFamily = value[ 'font-family' ], variants = control.getVariants( fontFamily ), selector = control.selector + ' .font-weight select', data = [], isValid = false, variantSelector; if ( false !== variants ) { jQuery( control.selector + ' .font-weight' ).show(); _.each( variants, function ( variant ) { if ( value[ 'font-weight' ] === variant.id ) { isValid = true; } data.push( { id: variant.id, text: variant.label } ); } ); if ( ! isValid ) { value[ 'font-weight' ] = 'regular'; } if ( jQuery( selector ).hasClass( 'select2-hidden-accessible' ) ) { jQuery( selector ).selectWoo( 'destroy' ); jQuery( selector ).empty(); } // Instantiate selectWoo with the data. variantSelector = jQuery( selector ).selectWoo( { data: data, width: '100%' } ); variantSelector.val( value[ 'font-weight' ] ).trigger( 'change' ); variantSelector.on( 'change', function () { control.saveValue( 'font-weight', jQuery( this ).val() ); } ); } else { jQuery( control.selector + ' .font-weight' ).hide(); } }, getVariants: function ( fontFamily ) { var control = this, fonts = control.getFonts(); var variants = false; _.each( fonts.standard, function ( font ) { if ( fontFamily && font.family === fontFamily.replace( /'/g, '"' ) ) { variants = font.variants; return variants; } } ); _.each( fonts.google, function ( font ) { if ( font.family === fontFamily ) { variants = font.variants; return variants; } } ); // For custom fonts. if ( ! _.isUndefined( fonts.custom ) ) { _.each( fonts.custom, function ( font ) { if ( font.custom === fontFamily ) { variants = font.variants; return variants; } } ); } return variants; }, renderSubsetSelector: function () { var control = this, value = control.setting._value, fontFamily = value[ 'font-family' ], subsets = control.getSubsets( fontFamily ), selector = control.selector + ' .subsets select', data = [], validValue = value.subsets, subsetSelector; if ( false !== subsets ) { jQuery( control.selector + ' .subsets' ).show(); _.each( subsets, function ( subset ) { if ( _.isObject( validValue ) ) { if ( -1 === validValue.indexOf( subset.id ) ) { validValue = _.reject( validValue, function ( subValue ) { return subValue === subset.id; } ); } } data.push( { id: subset.id, text: subset.label } ); } ); } else { jQuery( control.selector + ' .subsets' ).hide(); } if ( jQuery( selector ).hasClass( 'select2-hidden-accessible' ) ) { jQuery( selector ).selectWoo( 'destroy' ); jQuery( selector ).empty(); } // Instantiate selectWoo with the data. subsetSelector = jQuery( selector ).selectWoo( { data: data, width: '100%' } ); subsetSelector.val( validValue ).trigger( 'change' ); subsetSelector.on( 'change', function () { control.saveValue( 'subsets', jQuery( this ).val() ); } ); }, getSubsets: function ( fontFamily ) { var control = this, subsets = false, fonts = control.getFonts(); _.each( fonts.google, function ( font ) { if ( font.family === fontFamily ) { subsets = font.subsets; return subsets; } } ); return subsets; }, saveValue: function ( property, value ) { var control = this, input = control.container.find( '.typography-hidden-value' ), val = control.setting._value; val[ property ] = value; jQuery( input ).attr( 'value', JSON.stringify( val ) ).trigger( 'change' ); control.setting.set( val ); }, updateFontSize: function () { var control = this, val = control.setting._value, input = control.container.find( '.typography-hidden-value' ), newValue = { 'font-size': { 'desktop': { 'size': val[ 'font-size' ][ 'desktop' ][ 'size' ], 'unit': val[ 'font-size' ][ 'desktop' ][ 'unit' ] }, 'tablet': { 'size': val[ 'font-size' ][ 'tablet' ][ 'size' ], 'unit': val[ 'font-size' ][ 'tablet' ][ 'unit' ] }, 'mobile': { 'size': val[ 'font-size' ][ 'mobile' ][ 'size' ], 'unit': val[ 'font-size' ][ 'mobile' ][ 'unit' ] } } }; control.container.find( '.font-size .control-wrap' ).each( function () { var controlValue = jQuery( this ).find( 'input[type=number]' ).val(); var device = jQuery( this ).find( 'input[type=number]' ).data( 'device' ); newValue[ 'font-size' ][ device ][ 'size' ] = controlValue; } ); // Extend/Update the `val` object to include `newValue`'s new data as an object. jQuery.extend( val, newValue ); jQuery( input ).attr( 'value', JSON.stringify( val ) ).trigger( 'change' ); control.setting.set( val ); }, updateFontSizeUnit: function () { let control = this, val = control.setting._value, input = control.container.find( '.typography-hidden-value' ), newValue = { 'font-size': { 'desktop': { 'size': val[ 'font-size' ][ 'desktop' ][ 'size' ], 'unit': val[ 'font-size' ][ 'desktop' ][ 'unit' ] }, 'tablet': { 'size': val[ 'font-size' ][ 'tablet' ][ 'size' ], 'unit': val[ 'font-size' ][ 'tablet' ][ 'unit' ] }, 'mobile': { 'size': val[ 'font-size' ][ 'mobile' ][ 'size' ], 'unit': val[ 'font-size' ][ 'mobile' ][ 'unit' ] } } }; control.container.find( '.font-size .control-wrap' ).each( function () { let controlValue = jQuery( this ).find( '.unit-wrapper .font-size-unit' ).val(); let device = jQuery( this ).find( '.unit-wrapper .font-size-unit' ).data( 'device' ); newValue[ 'font-size' ][ device ][ 'unit' ] = controlValue; newValue[ 'font-size' ][ device ][ 'size' ] = ''; } ); // Extend/Update the `val` object to include `newValue`'s new data as an object. jQuery.extend( val, newValue ); jQuery( input ).attr( 'value', JSON.stringify( val ) ).trigger( 'change' ); control.setting.set( val ); }, updateLineHeight: function () { var control = this, val = control.setting._value, input = control.container.find( '.typography-hidden-value' ), newValue = { 'line-height': { 'desktop': { 'size': val[ 'line-height' ][ 'desktop' ][ 'size' ], 'unit': val[ 'line-height' ][ 'desktop' ][ 'unit' ] }, 'tablet': { 'size': val[ 'line-height' ][ 'tablet' ][ 'size' ], 'unit': val[ 'line-height' ][ 'tablet' ][ 'unit' ] }, 'mobile': { 'size': val[ 'line-height' ][ 'mobile' ][ 'size' ], 'unit': val[ 'line-height' ][ 'mobile' ][ 'unit' ] } } }; control.container.find( '.line-height .control-wrap' ).each( function () { var controlValue = jQuery( this ).find( 'input[type=number]' ).val(); var device = jQuery( this ).find( 'input[type=number]' ).data( 'device' ); newValue[ 'line-height' ][ device ][ 'size' ] = controlValue; } ); // Extend/Update the `val` object to include `newValue`'s new data as an object. jQuery.extend( val, newValue ); jQuery( input ).attr( 'value', JSON.stringify( val ) ).trigger( 'change' ); control.setting.set( val ); }, updateLineHeightUnit: function () { var control = this, val = control.setting._value, input = control.container.find( '.typography-hidden-value' ), newValue = { 'line-height': { 'desktop': { 'size': val[ 'line-height' ][ 'desktop' ][ 'size' ], 'unit': val[ 'line-height' ][ 'desktop' ][ 'unit' ] }, 'tablet': { 'size': val[ 'line-height' ][ 'tablet' ][ 'size' ], 'unit': val[ 'line-height' ][ 'tablet' ][ 'unit' ] }, 'mobile': { 'size': val[ 'line-height' ][ 'mobile' ][ 'size' ], 'unit': val[ 'line-height' ][ 'mobile' ][ 'unit' ] } } }; control.container.find( '.line-height .control-wrap' ).each( function () { var unitValue = jQuery( this ).find( '.unit-wrapper .line-height-unit' ).val(); var device = jQuery( this ).find( '.unit-wrapper .line-height-unit' ).data( 'device' ); newValue[ 'line-height' ][ device ][ 'unit' ] = unitValue; } ); // Extend/Update the `val` object to include `newValue`'s new data as an object. jQuery.extend( val, newValue ); jQuery( input ).attr( 'value', JSON.stringify( val ) ).trigger( 'change' ); control.setting.set( val ); }, updateLetterSpacing: function () { var control = this, val = control.setting._value, input = control.container.find( '.typography-hidden-value' ), newValue = { 'letter-spacing': { 'desktop': { 'size': val[ 'letter-spacing' ][ 'desktop' ][ 'size' ], 'unit': val[ 'letter-spacing' ][ 'desktop' ][ 'unit' ] }, 'tablet': { 'size': val[ 'letter-spacing' ][ 'tablet' ][ 'size' ], 'unit': val[ 'letter-spacing' ][ 'tablet' ][ 'unit' ] }, 'mobile': { 'size': val[ 'letter-spacing' ][ 'mobile' ][ 'size' ], 'unit': val[ 'letter-spacing' ][ 'mobile' ][ 'unit' ] } } }; control.container.find( '.letter-spacing .control-wrap' ).each( function () { var controlValue = jQuery( this ).find( 'input[type=number]' ).val(); var device = jQuery( this ).find( 'input[type=number]' ).data( 'device' ); newValue[ 'letter-spacing' ][ device ][ 'size' ] = controlValue; } ); // Extend/Update the `val` object to include `newValue`'s new data as an object. jQuery.extend( val, newValue ); jQuery( input ).attr( 'value', JSON.stringify( val ) ).trigger( 'change' ); control.setting.set( val ); }, updateLetterSpacingUnit: function () { var control = this, val = control.setting._value, input = control.container.find( '.typography-hidden-value' ), newValue = { 'letter-spacing': { 'desktop': { 'size': val[ 'letter-spacing' ][ 'desktop' ][ 'size' ], 'unit': val[ 'letter-spacing' ][ 'desktop' ][ 'unit' ] }, 'tablet': { 'size': val[ 'letter-spacing' ][ 'tablet' ][ 'size' ], 'unit': val[ 'letter-spacing' ][ 'tablet' ][ 'unit' ] }, 'mobile': { 'size': val[ 'letter-spacing' ][ 'mobile' ][ 'size' ], 'unit': val[ 'letter-spacing' ][ 'mobile' ][ 'unit' ] } } }; control.container.find( '.letter-spacing .control-wrap' ).each( function () { var unitValue = jQuery( this ).find( '.unit-wrapper .letter-spacing-unit' ).val(); var device = jQuery( this ).find( '.unit-wrapper .letter-spacing-unit' ).data( 'device' ); newValue[ 'letter-spacing' ][ device ][ 'unit' ] = unitValue; } ); // Extend/Update the `val` object to include `newValue`'s new data as an object. jQuery.extend( val, newValue ); jQuery( input ).attr( 'value', JSON.stringify( val ) ).trigger( 'change' ); control.setting.set( val ); }, } ); PK ���[#���"� "� <