diff options
author | Zach van Rijn <me@zv.io> | 2021-07-21 16:19:29 -0500 |
---|---|---|
committer | Zach van Rijn <me@zv.io> | 2021-07-21 16:19:29 -0500 |
commit | 69c17f9c1942fd0d6a5ea941636e87723b8a6fe2 (patch) | |
tree | e1d0212147048204b0eede0aa6ff79849ed479da /inc/customizer/custom-controls | |
parent | 74a7109a2a5ab0d191f26c917ae69e46f0d83b32 (diff) | |
download | blog-ng-69c17f9c1942fd0d6a5ea941636e87723b8a6fe2.tar.gz blog-ng-69c17f9c1942fd0d6a5ea941636e87723b8a6fe2.tar.bz2 blog-ng-69c17f9c1942fd0d6a5ea941636e87723b8a6fe2.tar.xz blog-ng-69c17f9c1942fd0d6a5ea941636e87723b8a6fe2.zip |
dos2unix on all .php files, begin paring down admin page and site branding.
Diffstat (limited to 'inc/customizer/custom-controls')
6 files changed, 571 insertions, 571 deletions
diff --git a/inc/customizer/custom-controls/class-astra-customizer-control-base.php b/inc/customizer/custom-controls/class-astra-customizer-control-base.php index 8af15db..da1d0ae 100644 --- a/inc/customizer/custom-controls/class-astra-customizer-control-base.php +++ b/inc/customizer/custom-controls/class-astra-customizer-control-base.php @@ -1,238 +1,238 @@ -<?php
-/**
- * Astra Theme Customizer Configuration Base.
- *
- * @package Astra
- * @author Astra
- * @copyright Copyright (c) 2020, Astra
- * @link https://wpastra.com/
- * @since Astra 1.4.3
- */
-
-// No direct access, please.
-if ( ! defined( 'ABSPATH' ) ) {
- exit;
-}
-
-/**
- * Base Class for Registering Customizer Controls.
- *
- * @since 1.4.3
- */
-if ( ! class_exists( 'Astra_Customizer_Control_Base' ) ) {
-
- /**
- * Customizer Sanitizes Initial setup
- */
- class Astra_Customizer_Control_Base {
-
- /**
- * Registered Controls.
- *
- * @since 1.4.3
- * @var Array
- */
- private static $controls;
-
- /**
- * Constructor
- */
- public function __construct() {
-
- add_action( 'customize_controls_enqueue_scripts', array( $this, 'enqueue_scripts' ) );
- }
-
- /**
- * Enqueue Admin Scripts
- *
- * @since 1.4.3
- */
- public function enqueue_scripts() {
-
- $dir_name = ( SCRIPT_DEBUG ) ? 'unminified' : 'minified';
- $file_prefix = ( SCRIPT_DEBUG ) ? '' : '.min';
- $file_rtl = ( is_rtl() ) ? '-rtl' : '';
- $css_uri = ASTRA_THEME_URI . 'inc/customizer/custom-controls/assets/css/' . $dir_name . '/';
- $js_uri = ASTRA_THEME_URI . 'inc/customizer/custom-controls/assets/js/' . $dir_name . '/';
-
- wp_enqueue_style( 'astra-custom-control-style' . $file_rtl, $css_uri . 'custom-controls' . $file_prefix . $file_rtl . '.css', null, ASTRA_THEME_VERSION );
-
- if ( ! SCRIPT_DEBUG ) {
-
- // Enqueue Customizer script.
- $custom_controls_deps = array(
- 'jquery',
- 'customize-base',
- 'jquery-ui-tabs',
- 'jquery-ui-sortable',
- 'wp-i18n',
- 'wp-components',
- 'wp-element',
- 'wp-media-utils',
- 'wp-block-editor',
- );
-
- wp_enqueue_script( 'astra-custom-control-script', $js_uri . 'custom-controls' . $file_prefix . '.js', $custom_controls_deps, ASTRA_THEME_VERSION, true );
-
- $css_uri = ASTRA_THEME_URI . 'inc/customizer/custom-controls/typography/';
-
- wp_enqueue_style( 'astra-select-woo-style', $css_uri . 'selectWoo.css', null, ASTRA_THEME_VERSION );
-
- $astra_typo_localize = array(
- '100' => __( 'Thin 100', 'astra' ),
- '100italic' => __( '100 Italic', 'astra' ),
- '200' => __( 'Extra-Light 200', 'astra' ),
- '200italic' => __( '200 Italic', 'astra' ),
- '300' => __( 'Light 300', 'astra' ),
- '300italic' => __( '300 Italic', 'astra' ),
- '400' => __( 'Normal 400', 'astra' ),
- 'italic' => __( '400 Italic', 'astra' ),
- '500' => __( 'Medium 500', 'astra' ),
- '500italic' => __( '500 Italic', 'astra' ),
- '600' => __( 'Semi-Bold 600', 'astra' ),
- '600italic' => __( '600 Italic', 'astra' ),
- '700' => __( 'Bold 700', 'astra' ),
- '700italic' => __( '700 Italic', 'astra' ),
- '800' => __( 'Extra-Bold 800', 'astra' ),
- '800italic' => __( '800 Italic', 'astra' ),
- '900' => __( 'Ultra-Bold 900', 'astra' ),
- '900italic' => __( '900 Italic', 'astra' ),
- );
-
- wp_localize_script( 'astra-custom-control-script', 'astraTypo', $astra_typo_localize );
- $localize_array = array(
- 'colors' => astra_color_palette(),
- );
-
- wp_localize_script( 'astra-custom-control-script', 'astColorPalette', $localize_array );
-
- } else {
-
- // Enqueue Customizer Plain script.
- $custom_controls_plain_deps = array(
- 'jquery',
- 'customize-base',
- 'jquery-ui-tabs',
- 'jquery-ui-sortable',
- );
- wp_enqueue_script( 'astra-custom-control-plain-script', $js_uri . 'custom-controls-plain' . $file_prefix . '.js', $custom_controls_plain_deps, ASTRA_THEME_VERSION, true );
-
- // Enqueue Customizer React.JS script.
- $custom_controls_react_deps = array(
- 'astra-custom-control-plain-script',
- 'wp-i18n',
- 'wp-components',
- 'wp-element',
- 'wp-media-utils',
- 'wp-block-editor',
- );
-
- $css_uri = ASTRA_THEME_URI . 'inc/customizer/custom-controls/typography/';
-
- wp_enqueue_style( 'astra-select-woo-style', $css_uri . 'selectWoo.css', null, ASTRA_THEME_VERSION );
-
- wp_enqueue_script( 'astra-custom-control-react-script', ASTRA_THEME_URI . 'inc/customizer/extend-custom-controls/build/index.js', $custom_controls_react_deps, ASTRA_THEME_VERSION, true );
-
- $localize_array = array(
- 'colors' => astra_color_palette(),
- );
-
- $astra_typo_localize = array(
- '100' => __( 'Thin 100', 'astra' ),
- '100italic' => __( '100 Italic', 'astra' ),
- '200' => __( 'Extra-Light 200', 'astra' ),
- '200italic' => __( '200 Italic', 'astra' ),
- '300' => __( 'Light 300', 'astra' ),
- '300italic' => __( '300 Italic', 'astra' ),
- '400' => __( 'Normal 400', 'astra' ),
- 'italic' => __( '400 Italic', 'astra' ),
- '500' => __( 'Medium 500', 'astra' ),
- '500italic' => __( '500 Italic', 'astra' ),
- '600' => __( 'Semi-Bold 600', 'astra' ),
- '600italic' => __( '600 Italic', 'astra' ),
- '700' => __( 'Bold 700', 'astra' ),
- '700italic' => __( '700 Italic', 'astra' ),
- '800' => __( 'Extra-Bold 800', 'astra' ),
- '800italic' => __( '800 Italic', 'astra' ),
- '900' => __( 'Ultra-Bold 900', 'astra' ),
- '900italic' => __( '900 Italic', 'astra' ),
- );
-
- wp_localize_script( 'astra-custom-control-react-script', 'astColorPalette', $localize_array );
- wp_localize_script( 'astra-custom-control-react-script', 'astraTypo', $astra_typo_localize );
- }
- }
-
- /**
- * Add Control to self::$controls and Register control to WordPress Customizer.
- *
- * @param String $name Slug for the control.
- * @param Array $atts Control Attributes.
- * @return void
- */
- public static function add_control( $name, $atts ) {
- global $wp_customize;
- self::$controls[ $name ] = $atts;
-
- if ( isset( $atts['callback'] ) ) {
- /**
- * Register controls
- */
- $wp_customize->register_control_type( $atts['callback'] );
- }
- }
-
- /**
- * Returns control instance
- *
- * @param string $control_type control type.
- * @since 1.4.3
- * @return string
- */
- public static function get_control_instance( $control_type ) {
- $control_class = self::get_control( $control_type );
-
- if ( isset( $control_class['callback'] ) ) {
- return class_exists( $control_class['callback'] ) ? $control_class['callback'] : false;
- }
-
- return false;
- }
-
- /**
- * Returns control and its attributes
- *
- * @param string $control_type control type.
- * @since 1.4.3
- * @return array
- */
- public static function get_control( $control_type ) {
- if ( isset( self::$controls[ $control_type ] ) ) {
- return self::$controls[ $control_type ];
- }
-
- return array();
- }
-
- /**
- * Returns Santize callback for control
- *
- * @param string $control control.
- * @since 1.4.3
- * @return string
- */
- public static function get_sanitize_call( $control ) {
-
- if ( isset( self::$controls[ $control ]['sanitize_callback'] ) ) {
- return self::$controls[ $control ]['sanitize_callback'];
- }
-
- return false;
- }
- }
-}
-
-/**
- * Kicking this off by calling 'get_instance()' method
- */
-new Astra_Customizer_Control_Base();
+<?php +/** + * Astra Theme Customizer Configuration Base. + * + * @package Astra + * @author Astra + * @copyright Copyright (c) 2020, Astra + * @link https://wpastra.com/ + * @since Astra 1.4.3 + */ + +// No direct access, please. +if ( ! defined( 'ABSPATH' ) ) { + exit; +} + +/** + * Base Class for Registering Customizer Controls. + * + * @since 1.4.3 + */ +if ( ! class_exists( 'Astra_Customizer_Control_Base' ) ) { + + /** + * Customizer Sanitizes Initial setup + */ + class Astra_Customizer_Control_Base { + + /** + * Registered Controls. + * + * @since 1.4.3 + * @var Array + */ + private static $controls; + + /** + * Constructor + */ + public function __construct() { + + add_action( 'customize_controls_enqueue_scripts', array( $this, 'enqueue_scripts' ) ); + } + + /** + * Enqueue Admin Scripts + * + * @since 1.4.3 + */ + public function enqueue_scripts() { + + $dir_name = ( SCRIPT_DEBUG ) ? 'unminified' : 'minified'; + $file_prefix = ( SCRIPT_DEBUG ) ? '' : '.min'; + $file_rtl = ( is_rtl() ) ? '-rtl' : ''; + $css_uri = ASTRA_THEME_URI . 'inc/customizer/custom-controls/assets/css/' . $dir_name . '/'; + $js_uri = ASTRA_THEME_URI . 'inc/customizer/custom-controls/assets/js/' . $dir_name . '/'; + + wp_enqueue_style( 'astra-custom-control-style' . $file_rtl, $css_uri . 'custom-controls' . $file_prefix . $file_rtl . '.css', null, ASTRA_THEME_VERSION ); + + if ( ! SCRIPT_DEBUG ) { + + // Enqueue Customizer script. + $custom_controls_deps = array( + 'jquery', + 'customize-base', + 'jquery-ui-tabs', + 'jquery-ui-sortable', + 'wp-i18n', + 'wp-components', + 'wp-element', + 'wp-media-utils', + 'wp-block-editor', + ); + + wp_enqueue_script( 'astra-custom-control-script', $js_uri . 'custom-controls' . $file_prefix . '.js', $custom_controls_deps, ASTRA_THEME_VERSION, true ); + + $css_uri = ASTRA_THEME_URI . 'inc/customizer/custom-controls/typography/'; + + wp_enqueue_style( 'astra-select-woo-style', $css_uri . 'selectWoo.css', null, ASTRA_THEME_VERSION ); + + $astra_typo_localize = array( + '100' => __( 'Thin 100', 'astra' ), + '100italic' => __( '100 Italic', 'astra' ), + '200' => __( 'Extra-Light 200', 'astra' ), + '200italic' => __( '200 Italic', 'astra' ), + '300' => __( 'Light 300', 'astra' ), + '300italic' => __( '300 Italic', 'astra' ), + '400' => __( 'Normal 400', 'astra' ), + 'italic' => __( '400 Italic', 'astra' ), + '500' => __( 'Medium 500', 'astra' ), + '500italic' => __( '500 Italic', 'astra' ), + '600' => __( 'Semi-Bold 600', 'astra' ), + '600italic' => __( '600 Italic', 'astra' ), + '700' => __( 'Bold 700', 'astra' ), + '700italic' => __( '700 Italic', 'astra' ), + '800' => __( 'Extra-Bold 800', 'astra' ), + '800italic' => __( '800 Italic', 'astra' ), + '900' => __( 'Ultra-Bold 900', 'astra' ), + '900italic' => __( '900 Italic', 'astra' ), + ); + + wp_localize_script( 'astra-custom-control-script', 'astraTypo', $astra_typo_localize ); + $localize_array = array( + 'colors' => astra_color_palette(), + ); + + wp_localize_script( 'astra-custom-control-script', 'astColorPalette', $localize_array ); + + } else { + + // Enqueue Customizer Plain script. + $custom_controls_plain_deps = array( + 'jquery', + 'customize-base', + 'jquery-ui-tabs', + 'jquery-ui-sortable', + ); + wp_enqueue_script( 'astra-custom-control-plain-script', $js_uri . 'custom-controls-plain' . $file_prefix . '.js', $custom_controls_plain_deps, ASTRA_THEME_VERSION, true ); + + // Enqueue Customizer React.JS script. + $custom_controls_react_deps = array( + 'astra-custom-control-plain-script', + 'wp-i18n', + 'wp-components', + 'wp-element', + 'wp-media-utils', + 'wp-block-editor', + ); + + $css_uri = ASTRA_THEME_URI . 'inc/customizer/custom-controls/typography/'; + + wp_enqueue_style( 'astra-select-woo-style', $css_uri . 'selectWoo.css', null, ASTRA_THEME_VERSION ); + + wp_enqueue_script( 'astra-custom-control-react-script', ASTRA_THEME_URI . 'inc/customizer/extend-custom-controls/build/index.js', $custom_controls_react_deps, ASTRA_THEME_VERSION, true ); + + $localize_array = array( + 'colors' => astra_color_palette(), + ); + + $astra_typo_localize = array( + '100' => __( 'Thin 100', 'astra' ), + '100italic' => __( '100 Italic', 'astra' ), + '200' => __( 'Extra-Light 200', 'astra' ), + '200italic' => __( '200 Italic', 'astra' ), + '300' => __( 'Light 300', 'astra' ), + '300italic' => __( '300 Italic', 'astra' ), + '400' => __( 'Normal 400', 'astra' ), + 'italic' => __( '400 Italic', 'astra' ), + '500' => __( 'Medium 500', 'astra' ), + '500italic' => __( '500 Italic', 'astra' ), + '600' => __( 'Semi-Bold 600', 'astra' ), + '600italic' => __( '600 Italic', 'astra' ), + '700' => __( 'Bold 700', 'astra' ), + '700italic' => __( '700 Italic', 'astra' ), + '800' => __( 'Extra-Bold 800', 'astra' ), + '800italic' => __( '800 Italic', 'astra' ), + '900' => __( 'Ultra-Bold 900', 'astra' ), + '900italic' => __( '900 Italic', 'astra' ), + ); + + wp_localize_script( 'astra-custom-control-react-script', 'astColorPalette', $localize_array ); + wp_localize_script( 'astra-custom-control-react-script', 'astraTypo', $astra_typo_localize ); + } + } + + /** + * Add Control to self::$controls and Register control to WordPress Customizer. + * + * @param String $name Slug for the control. + * @param Array $atts Control Attributes. + * @return void + */ + public static function add_control( $name, $atts ) { + global $wp_customize; + self::$controls[ $name ] = $atts; + + if ( isset( $atts['callback'] ) ) { + /** + * Register controls + */ + $wp_customize->register_control_type( $atts['callback'] ); + } + } + + /** + * Returns control instance + * + * @param string $control_type control type. + * @since 1.4.3 + * @return string + */ + public static function get_control_instance( $control_type ) { + $control_class = self::get_control( $control_type ); + + if ( isset( $control_class['callback'] ) ) { + return class_exists( $control_class['callback'] ) ? $control_class['callback'] : false; + } + + return false; + } + + /** + * Returns control and its attributes + * + * @param string $control_type control type. + * @since 1.4.3 + * @return array + */ + public static function get_control( $control_type ) { + if ( isset( self::$controls[ $control_type ] ) ) { + return self::$controls[ $control_type ]; + } + + return array(); + } + + /** + * Returns Santize callback for control + * + * @param string $control control. + * @since 1.4.3 + * @return string + */ + public static function get_sanitize_call( $control ) { + + if ( isset( self::$controls[ $control ]['sanitize_callback'] ) ) { + return self::$controls[ $control ]['sanitize_callback']; + } + + return false; + } + } +} + +/** + * Kicking this off by calling 'get_instance()' method + */ +new Astra_Customizer_Control_Base(); diff --git a/inc/customizer/custom-controls/customizer-link/class-astra-control-customizer-link.php b/inc/customizer/custom-controls/customizer-link/class-astra-control-customizer-link.php index a1af417..14ce81a 100644 --- a/inc/customizer/custom-controls/customizer-link/class-astra-control-customizer-link.php +++ b/inc/customizer/custom-controls/customizer-link/class-astra-control-customizer-link.php @@ -1,69 +1,69 @@ -<?php
-/**
- * Customizer Control: Customizer Link
- *
- * @package Astra
- * @author Astra
- * @copyright Copyright (c) 2020, Astra
- * @link https://wpastra.com/
- * @since 1.0.0
- */
-
-// Exit if accessed directly.
-if ( ! defined( 'ABSPATH' ) ) {
- exit;
-}
-
-/**
- * A text control with validation for CSS units.
- */
-class Astra_Control_Customizer_Link extends WP_Customize_Control {
-
- /**
- * The control type.
- *
- * @access public
- * @var string
- */
- public $type = 'ast-customizer-link';
-
- /**
- * Link text to be added inside the anchor tag.
- *
- * @var string
- */
- public $link_text = '';
-
- /**
- * Linked customizer section.
- *
- * @var string
- */
- public $linked = '';
-
- /**
- * Linked customizer section.
- *
- * @var string
- */
- public $link_type = '';
-
- /**
- * Refresh the parameters passed to the JavaScript via JSON.
- *
- * @see WP_Customize_Control::to_json()
- */
- public function to_json() {
- parent::to_json();
- $this->json['link_text'] = $this->link_text;
- $this->json['linked'] = $this->linked;
- $this->json['link_type'] = $this->link_type;
- }
-
- /**
- * Render the control's content.
- *
- * @see WP_Customize_Control::render_content()
- */
- protected function render_content() {}
-}
+<?php +/** + * Customizer Control: Customizer Link + * + * @package Astra + * @author Astra + * @copyright Copyright (c) 2020, Astra + * @link https://wpastra.com/ + * @since 1.0.0 + */ + +// Exit if accessed directly. +if ( ! defined( 'ABSPATH' ) ) { + exit; +} + +/** + * A text control with validation for CSS units. + */ +class Astra_Control_Customizer_Link extends WP_Customize_Control { + + /** + * The control type. + * + * @access public + * @var string + */ + public $type = 'ast-customizer-link'; + + /** + * Link text to be added inside the anchor tag. + * + * @var string + */ + public $link_text = ''; + + /** + * Linked customizer section. + * + * @var string + */ + public $linked = ''; + + /** + * Linked customizer section. + * + * @var string + */ + public $link_type = ''; + + /** + * Refresh the parameters passed to the JavaScript via JSON. + * + * @see WP_Customize_Control::to_json() + */ + public function to_json() { + parent::to_json(); + $this->json['link_text'] = $this->link_text; + $this->json['linked'] = $this->linked; + $this->json['link_type'] = $this->link_type; + } + + /** + * Render the control's content. + * + * @see WP_Customize_Control::render_content() + */ + protected function render_content() {} +} diff --git a/inc/customizer/custom-controls/description/class-astra-control-description.php b/inc/customizer/custom-controls/description/class-astra-control-description.php index dd38119..66edf42 100644 --- a/inc/customizer/custom-controls/description/class-astra-control-description.php +++ b/inc/customizer/custom-controls/description/class-astra-control-description.php @@ -1,57 +1,57 @@ -<?php
-/**
- * Customizer Control: description
- *
- * @package Astra
- * @author Astra
- * @copyright Copyright (c) 2020, Astra
- * @link https://wpastra.com/
- * @since 1.0.0
- */
-
-// Exit if accessed directly.
-if ( ! defined( 'ABSPATH' ) ) {
- exit;
-}
-
-/**
- * A text control with validation for CSS units.
- */
-class Astra_Control_Description extends WP_Customize_Control {
-
- /**
- * The control type.
- *
- * @access public
- * @var string
- */
- public $type = 'ast-description';
-
- /**
- * The control type.
- *
- * @access public
- * @var string
- */
- public $help = '';
-
- /**
- * 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;
- $this->json['help'] = $this->help;
- }
-
- /**
- * Render the control's content.
- *
- * @see WP_Customize_Control::render_content()
- */
- protected function render_content() {}
-}
+<?php +/** + * Customizer Control: description + * + * @package Astra + * @author Astra + * @copyright Copyright (c) 2020, Astra + * @link https://wpastra.com/ + * @since 1.0.0 + */ + +// Exit if accessed directly. +if ( ! defined( 'ABSPATH' ) ) { + exit; +} + +/** + * A text control with validation for CSS units. + */ +class Astra_Control_Description extends WP_Customize_Control { + + /** + * The control type. + * + * @access public + * @var string + */ + public $type = 'ast-description'; + + /** + * The control type. + * + * @access public + * @var string + */ + public $help = ''; + + /** + * 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; + $this->json['help'] = $this->help; + } + + /** + * Render the control's content. + * + * @see WP_Customize_Control::render_content() + */ + protected function render_content() {} +} diff --git a/inc/customizer/custom-controls/index.php b/inc/customizer/custom-controls/index.php index 8b96815..820bcb9 100644 --- a/inc/customizer/custom-controls/index.php +++ b/inc/customizer/custom-controls/index.php @@ -1,9 +1,9 @@ -<?php
-/**
- * Index file
- *
- * @package Astra
- * @since Astra 1.0.0
- */
-
-/* Silence is golden, and we agree. */
+<?php +/** + * Index file + * + * @package Astra + * @since Astra 1.0.0 + */ + +/* Silence is golden, and we agree. */ diff --git a/inc/customizer/custom-controls/typography/class-astra-control-typography.php b/inc/customizer/custom-controls/typography/class-astra-control-typography.php index a7cace3..ac1d2ed 100644 --- a/inc/customizer/custom-controls/typography/class-astra-control-typography.php +++ b/inc/customizer/custom-controls/typography/class-astra-control-typography.php @@ -1,189 +1,189 @@ -<?php
-/**
- * Customizer Control: typography.
- *
- * @package Astra
- * @author Astra
- * @copyright Copyright (c) 2020, Astra
- * @link https://wpastra.com/
- * @since 1.0.0
- */
-
-// Exit if accessed directly.
-if ( ! defined( 'ABSPATH' ) ) {
- exit;
-}
-
-/**
- * Typography control.
- */
-final class Astra_Control_Typography extends WP_Customize_Control {
-
- /**
- * Used to connect controls to each other.
- *
- * @since 1.0.0
- * @var bool $connect
- */
- public $connect = false;
-
- /**
- * Option name.
- *
- * @since 1.0.0
- * @var string $name
- */
- public $name = '';
-
- /**
- * Option label.
- *
- * @since 1.0.0
- * @var string $label
- */
- public $label = '';
-
- /**
- * Option description.
- *
- * @since 1.0.0
- * @var string $description
- */
- public $description = '';
-
- /**
- * Control type.
- *
- * @since 1.0.0
- * @var string $type
- */
- public $type = 'ast-font';
-
- /**
- * Used to connect variant controls to each other.
- *
- * @since 1.5.2
- * @var bool $variant
- */
- public $variant = false;
-
- /**
- * Used to set the mode for code controls.
- *
- * @since 1.0.0
- * @var bool $mode
- */
- public $mode = 'html';
-
- /**
- * Used to set the default font options.
- *
- * @since 1.0.8
- * @var string $ast_inherit
- */
- public $ast_inherit = '';
-
- /**
- * All font weights
- *
- * @since 1.0.8
- * @var string $ast_inherit
- */
- public $ast_all_font_weight = array();
-
- /**
- * If true, the preview button for a control will be rendered.
- *
- * @since 1.0.0
- * @var bool $preview_button
- */
- public $preview_button = false;
-
- /**
- * Set the default font options.
- *
- * @since 1.0.8
- * @param WP_Customize_Manager $manager Customizer bootstrap instance.
- * @param string $id Control ID.
- * @param array $args Default parent's arguments.
- */
- public function __construct( $manager, $id, $args = array() ) {
- $this->ast_inherit = __( 'Inherit', 'astra' );
- $this->ast_all_font_weight = array(
- '100' => __( 'Thin 100', 'astra' ),
- '100italic' => __( '100 Italic', 'astra' ),
- '200' => __( 'Extra-Light 200', 'astra' ),
- '200italic' => __( '200 Italic', 'astra' ),
- '300' => __( 'Light 300', 'astra' ),
- '300italic' => __( '300 Italic', 'astra' ),
- '400' => __( 'Normal 400', 'astra' ),
- 'italic' => __( '400 Italic', 'astra' ),
- '500' => __( 'Medium 500', 'astra' ),
- '500italic' => __( '500 Italic', 'astra' ),
- '600' => __( 'Semi-Bold 600', 'astra' ),
- '600italic' => __( '600 Italic', 'astra' ),
- '700' => __( 'Bold 700', 'astra' ),
- '700italic' => __( '700 Italic', 'astra' ),
- '800' => __( 'Extra-Bold 800', 'astra' ),
- '800italic' => __( '800 Italic', 'astra' ),
- '900' => __( 'Ultra-Bold 900', 'astra' ),
- '900italic' => __( '900 Italic', 'astra' ),
- );
- parent::__construct( $manager, $id, $args );
- }
-
- /**
- * 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;
- $this->json['name'] = $this->name;
- $this->json['value'] = $this->value();
- $this->json['connect'] = $this->connect;
- $this->json['variant'] = $this->variant;
- $this->json['link'] = $this->get_link();
- $this->json['ast_all_font_weight'] = $this->ast_all_font_weight;
- }
-
- /**
- * 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()
- *
- * @access protected
- */
- protected function content_template() {
-
- ?>
-
- <label>
- <# if ( data.label ) { #>
- <span class="customize-control-title">{{{data.label}}}</span>
- <# } #>
-
- </label>
- <select data-inherit="<?php echo esc_attr( $this->ast_inherit ); ?>" <?php $this->link(); ?> class={{ data.font_type }} data-name={{ data.name }}
- data-value="{{data.value}}"
-
- <# if ( data.connect ) { #>
- data-connected-control={{ data.connect }}
- <# } #>
- <# if ( data.variant ) { #>
- data-connected-variant="{{data.variant}}";
- <# } #>
-
- >
- </select>
-
- <?php
- }
-}
+<?php +/** + * Customizer Control: typography. + * + * @package Astra + * @author Astra + * @copyright Copyright (c) 2020, Astra + * @link https://wpastra.com/ + * @since 1.0.0 + */ + +// Exit if accessed directly. +if ( ! defined( 'ABSPATH' ) ) { + exit; +} + +/** + * Typography control. + */ +final class Astra_Control_Typography extends WP_Customize_Control { + + /** + * Used to connect controls to each other. + * + * @since 1.0.0 + * @var bool $connect + */ + public $connect = false; + + /** + * Option name. + * + * @since 1.0.0 + * @var string $name + */ + public $name = ''; + + /** + * Option label. + * + * @since 1.0.0 + * @var string $label + */ + public $label = ''; + + /** + * Option description. + * + * @since 1.0.0 + * @var string $description + */ + public $description = ''; + + /** + * Control type. + * + * @since 1.0.0 + * @var string $type + */ + public $type = 'ast-font'; + + /** + * Used to connect variant controls to each other. + * + * @since 1.5.2 + * @var bool $variant + */ + public $variant = false; + + /** + * Used to set the mode for code controls. + * + * @since 1.0.0 + * @var bool $mode + */ + public $mode = 'html'; + + /** + * Used to set the default font options. + * + * @since 1.0.8 + * @var string $ast_inherit + */ + public $ast_inherit = ''; + + /** + * All font weights + * + * @since 1.0.8 + * @var string $ast_inherit + */ + public $ast_all_font_weight = array(); + + /** + * If true, the preview button for a control will be rendered. + * + * @since 1.0.0 + * @var bool $preview_button + */ + public $preview_button = false; + + /** + * Set the default font options. + * + * @since 1.0.8 + * @param WP_Customize_Manager $manager Customizer bootstrap instance. + * @param string $id Control ID. + * @param array $args Default parent's arguments. + */ + public function __construct( $manager, $id, $args = array() ) { + $this->ast_inherit = __( 'Inherit', 'astra' ); + $this->ast_all_font_weight = array( + '100' => __( 'Thin 100', 'astra' ), + '100italic' => __( '100 Italic', 'astra' ), + '200' => __( 'Extra-Light 200', 'astra' ), + '200italic' => __( '200 Italic', 'astra' ), + '300' => __( 'Light 300', 'astra' ), + '300italic' => __( '300 Italic', 'astra' ), + '400' => __( 'Normal 400', 'astra' ), + 'italic' => __( '400 Italic', 'astra' ), + '500' => __( 'Medium 500', 'astra' ), + '500italic' => __( '500 Italic', 'astra' ), + '600' => __( 'Semi-Bold 600', 'astra' ), + '600italic' => __( '600 Italic', 'astra' ), + '700' => __( 'Bold 700', 'astra' ), + '700italic' => __( '700 Italic', 'astra' ), + '800' => __( 'Extra-Bold 800', 'astra' ), + '800italic' => __( '800 Italic', 'astra' ), + '900' => __( 'Ultra-Bold 900', 'astra' ), + '900italic' => __( '900 Italic', 'astra' ), + ); + parent::__construct( $manager, $id, $args ); + } + + /** + * 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; + $this->json['name'] = $this->name; + $this->json['value'] = $this->value(); + $this->json['connect'] = $this->connect; + $this->json['variant'] = $this->variant; + $this->json['link'] = $this->get_link(); + $this->json['ast_all_font_weight'] = $this->ast_all_font_weight; + } + + /** + * 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() + * + * @access protected + */ + protected function content_template() { + + ?> + + <label> + <# if ( data.label ) { #> + <span class="customize-control-title">{{{data.label}}}</span> + <# } #> + + </label> + <select data-inherit="<?php echo esc_attr( $this->ast_inherit ); ?>" <?php $this->link(); ?> class={{ data.font_type }} data-name={{ data.name }} + data-value="{{data.value}}" + + <# if ( data.connect ) { #> + data-connected-control={{ data.connect }} + <# } #> + <# if ( data.variant ) { #> + data-connected-variant="{{data.variant}}"; + <# } #> + + > + </select> + + <?php + } +} diff --git a/inc/customizer/custom-controls/typography/index.php b/inc/customizer/custom-controls/typography/index.php index 8b96815..820bcb9 100644 --- a/inc/customizer/custom-controls/typography/index.php +++ b/inc/customizer/custom-controls/typography/index.php @@ -1,9 +1,9 @@ -<?php
-/**
- * Index file
- *
- * @package Astra
- * @since Astra 1.0.0
- */
-
-/* Silence is golden, and we agree. */
+<?php +/** + * Index file + * + * @package Astra + * @since Astra 1.0.0 + */ + +/* Silence is golden, and we agree. */ |