@@ -1,5 +1,5 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | -if ( ! class_exists( 'LSX_Customizer_Colour_Header' ) ) { |
|
| 2 | +if ( ! class_exists('LSX_Customizer_Colour_Header')) { |
|
| 3 | 3 | |
| 4 | 4 | /** |
| 5 | 5 | * LSX Customizer Colour Header Class |
@@ -18,10 +18,10 @@ discard block |
||
| 18 | 18 | * @since 1.0.0 |
| 19 | 19 | */ |
| 20 | 20 | public function __construct() { |
| 21 | - add_action( 'after_switch_theme', array( $this, 'set_theme_mod' ) ); |
|
| 22 | - add_action( 'customize_save_after', array( $this, 'set_theme_mod' ) ); |
|
| 21 | + add_action('after_switch_theme', array($this, 'set_theme_mod')); |
|
| 22 | + add_action('customize_save_after', array($this, 'set_theme_mod')); |
|
| 23 | 23 | |
| 24 | - add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_css' ), 2999 ); |
|
| 24 | + add_action('wp_enqueue_scripts', array($this, 'enqueue_css'), 2999); |
|
| 25 | 25 | } |
| 26 | 26 | |
| 27 | 27 | /** |
@@ -31,9 +31,9 @@ discard block |
||
| 31 | 31 | */ |
| 32 | 32 | public function set_theme_mod() { |
| 33 | 33 | $theme_mods = $this->get_theme_mods(); |
| 34 | - $styles = $this->get_css( $theme_mods ); |
|
| 34 | + $styles = $this->get_css($theme_mods); |
|
| 35 | 35 | |
| 36 | - set_theme_mod( 'lsx_customizer_colour__header_theme_mod', $styles ); |
|
| 36 | + set_theme_mod('lsx_customizer_colour__header_theme_mod', $styles); |
|
| 37 | 37 | } |
| 38 | 38 | |
| 39 | 39 | /** |
@@ -42,20 +42,20 @@ discard block |
||
| 42 | 42 | * @since 1.0.0 |
| 43 | 43 | */ |
| 44 | 44 | public function enqueue_css() { |
| 45 | - $styles_from_theme_mod = get_theme_mod( 'lsx_customizer_colour__header_theme_mod' ); |
|
| 45 | + $styles_from_theme_mod = get_theme_mod('lsx_customizer_colour__header_theme_mod'); |
|
| 46 | 46 | |
| 47 | - if ( is_customize_preview() || false === $styles_from_theme_mod ) { |
|
| 47 | + if (is_customize_preview() || false === $styles_from_theme_mod) { |
|
| 48 | 48 | $theme_mods = $this->get_theme_mods(); |
| 49 | - $styles = $this->get_css( $theme_mods ); |
|
| 49 | + $styles = $this->get_css($theme_mods); |
|
| 50 | 50 | |
| 51 | - if ( false === $styles_from_theme_mod ) { |
|
| 52 | - set_theme_mod( 'lsx_customizer_colour__header_theme_mod', $styles ); |
|
| 51 | + if (false === $styles_from_theme_mod) { |
|
| 52 | + set_theme_mod('lsx_customizer_colour__header_theme_mod', $styles); |
|
| 53 | 53 | } |
| 54 | 54 | } else { |
| 55 | 55 | $styles = $styles_from_theme_mod; |
| 56 | 56 | } |
| 57 | 57 | |
| 58 | - wp_add_inline_style( 'lsx-customizer', $styles ); |
|
| 58 | + wp_add_inline_style('lsx-customizer', $styles); |
|
| 59 | 59 | } |
| 60 | 60 | |
| 61 | 61 | /** |
@@ -66,12 +66,12 @@ discard block |
||
| 66 | 66 | public function get_theme_mods() { |
| 67 | 67 | $colors = parent::get_color_scheme(); |
| 68 | 68 | |
| 69 | - return apply_filters( 'lsx_customizer_colours_header', array( |
|
| 70 | - 'header_background_color' => get_theme_mod( 'header_background_color', $colors['header_background_color'] ), |
|
| 71 | - 'header_link_color' => get_theme_mod( 'header_link_color', $colors['header_link_color'] ), |
|
| 72 | - 'header_link_hover_color' => get_theme_mod( 'header_link_hover_color', $colors['header_link_hover_color'] ), |
|
| 73 | - 'header_description_color' => get_theme_mod( 'header_description_color', $colors['header_description_color'] ), |
|
| 74 | - ) ); |
|
| 69 | + return apply_filters('lsx_customizer_colours_header', array( |
|
| 70 | + 'header_background_color' => get_theme_mod('header_background_color', $colors['header_background_color']), |
|
| 71 | + 'header_link_color' => get_theme_mod('header_link_color', $colors['header_link_color']), |
|
| 72 | + 'header_link_hover_color' => get_theme_mod('header_link_hover_color', $colors['header_link_hover_color']), |
|
| 73 | + 'header_description_color' => get_theme_mod('header_description_color', $colors['header_description_color']), |
|
| 74 | + )); |
|
| 75 | 75 | } |
| 76 | 76 | |
| 77 | 77 | /** |
@@ -79,21 +79,21 @@ discard block |
||
| 79 | 79 | * |
| 80 | 80 | * @since 1.0.0 |
| 81 | 81 | */ |
| 82 | - function get_css( $colors ) { |
|
| 82 | + function get_css($colors) { |
|
| 83 | 83 | global $customizer_colour_names; |
| 84 | 84 | |
| 85 | 85 | $colors_template = array(); |
| 86 | 86 | |
| 87 | - foreach ( $customizer_colour_names as $key => $value ) { |
|
| 88 | - $colors_template[ $key ] = ''; |
|
| 87 | + foreach ($customizer_colour_names as $key => $value) { |
|
| 88 | + $colors_template[$key] = ''; |
|
| 89 | 89 | } |
| 90 | 90 | |
| 91 | - $colors = wp_parse_args( $colors, $colors_template ); |
|
| 91 | + $colors = wp_parse_args($colors, $colors_template); |
|
| 92 | 92 | |
| 93 | - if ( empty( $colors['header_background_color'] ) |
|
| 94 | - || empty( $colors['header_link_color'] ) |
|
| 95 | - || empty( $colors['header_link_hover_color'] ) |
|
| 96 | - || empty( $colors['header_description_color'] ) ) { |
|
| 93 | + if (empty($colors['header_background_color']) |
|
| 94 | + || empty($colors['header_link_color']) |
|
| 95 | + || empty($colors['header_link_hover_color']) |
|
| 96 | + || empty($colors['header_description_color'])) { |
|
| 97 | 97 | return ''; |
| 98 | 98 | } |
| 99 | 99 | |
@@ -111,8 +111,8 @@ discard block |
||
| 111 | 111 | ); |
| 112 | 112 | '; |
| 113 | 113 | |
| 114 | - $css = apply_filters( 'lsx_customizer_colour_selectors_header', $css, $colors ); |
|
| 115 | - $css = parent::scss_to_css( $css ); |
|
| 114 | + $css = apply_filters('lsx_customizer_colour_selectors_header', $css, $colors); |
|
| 115 | + $css = parent::scss_to_css($css); |
|
| 116 | 116 | |
| 117 | 117 | return $css; |
| 118 | 118 | } |
@@ -1,103 +1,103 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | if ( ! class_exists( 'LSX_Customizer_Colour_Header' ) ) { |
| 3 | 3 | |
| 4 | - /** |
|
| 5 | - * LSX Customizer Colour Header Class |
|
| 6 | - * |
|
| 7 | - * @package LSX Customizer |
|
| 8 | - * @author LightSpeed |
|
| 9 | - * @license GPL3 |
|
| 10 | - * @link |
|
| 11 | - * @copyright 2016 LightSpeed |
|
| 12 | - */ |
|
| 13 | - class LSX_Customizer_Colour_Header extends LSX_Customizer_Colour { |
|
| 14 | - |
|
| 15 | - /** |
|
| 16 | - * Constructor. |
|
| 17 | - * |
|
| 18 | - * @since 1.0.0 |
|
| 19 | - */ |
|
| 20 | - public function __construct() { |
|
| 21 | - add_action( 'after_switch_theme', array( $this, 'set_theme_mod' ) ); |
|
| 22 | - add_action( 'customize_save_after', array( $this, 'set_theme_mod' ) ); |
|
| 23 | - |
|
| 24 | - add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_css' ), 2999 ); |
|
| 25 | - } |
|
| 26 | - |
|
| 27 | - /** |
|
| 28 | - * Assign CSS to theme mod. |
|
| 29 | - * |
|
| 30 | - * @since 1.0.0 |
|
| 31 | - */ |
|
| 32 | - public function set_theme_mod() { |
|
| 33 | - $theme_mods = $this->get_theme_mods(); |
|
| 34 | - $styles = $this->get_css( $theme_mods ); |
|
| 35 | - |
|
| 36 | - set_theme_mod( 'lsx_customizer_colour__header_theme_mod', $styles ); |
|
| 37 | - } |
|
| 38 | - |
|
| 39 | - /** |
|
| 40 | - * Enqueues front-end CSS. |
|
| 41 | - * |
|
| 42 | - * @since 1.0.0 |
|
| 43 | - */ |
|
| 44 | - public function enqueue_css() { |
|
| 45 | - $styles_from_theme_mod = get_theme_mod( 'lsx_customizer_colour__header_theme_mod' ); |
|
| 46 | - |
|
| 47 | - if ( is_customize_preview() || false === $styles_from_theme_mod ) { |
|
| 48 | - $theme_mods = $this->get_theme_mods(); |
|
| 49 | - $styles = $this->get_css( $theme_mods ); |
|
| 50 | - |
|
| 51 | - if ( false === $styles_from_theme_mod ) { |
|
| 52 | - set_theme_mod( 'lsx_customizer_colour__header_theme_mod', $styles ); |
|
| 53 | - } |
|
| 54 | - } else { |
|
| 55 | - $styles = $styles_from_theme_mod; |
|
| 56 | - } |
|
| 57 | - |
|
| 58 | - wp_add_inline_style( 'lsx-customizer', $styles ); |
|
| 59 | - } |
|
| 60 | - |
|
| 61 | - /** |
|
| 62 | - * Get CSS theme mods. |
|
| 63 | - * |
|
| 64 | - * @since 1.0.0 |
|
| 65 | - */ |
|
| 66 | - public function get_theme_mods() { |
|
| 67 | - $colors = parent::get_color_scheme(); |
|
| 68 | - |
|
| 69 | - return apply_filters( 'lsx_customizer_colours_header', array( |
|
| 70 | - 'header_background_color' => get_theme_mod( 'header_background_color', $colors['header_background_color'] ), |
|
| 71 | - 'header_link_color' => get_theme_mod( 'header_link_color', $colors['header_link_color'] ), |
|
| 72 | - 'header_link_hover_color' => get_theme_mod( 'header_link_hover_color', $colors['header_link_hover_color'] ), |
|
| 73 | - 'header_description_color' => get_theme_mod( 'header_description_color', $colors['header_description_color'] ), |
|
| 74 | - ) ); |
|
| 75 | - } |
|
| 76 | - |
|
| 77 | - /** |
|
| 78 | - * Returns CSS. |
|
| 79 | - * |
|
| 80 | - * @since 1.0.0 |
|
| 81 | - */ |
|
| 82 | - function get_css( $colors ) { |
|
| 83 | - global $customizer_colour_names; |
|
| 84 | - |
|
| 85 | - $colors_template = array(); |
|
| 86 | - |
|
| 87 | - foreach ( $customizer_colour_names as $key => $value ) { |
|
| 88 | - $colors_template[ $key ] = ''; |
|
| 89 | - } |
|
| 90 | - |
|
| 91 | - $colors = wp_parse_args( $colors, $colors_template ); |
|
| 92 | - |
|
| 93 | - if ( empty( $colors['header_background_color'] ) |
|
| 94 | - || empty( $colors['header_link_color'] ) |
|
| 95 | - || empty( $colors['header_link_hover_color'] ) |
|
| 96 | - || empty( $colors['header_description_color'] ) ) { |
|
| 97 | - return ''; |
|
| 98 | - } |
|
| 99 | - |
|
| 100 | - $css = ' |
|
| 4 | + /** |
|
| 5 | + * LSX Customizer Colour Header Class |
|
| 6 | + * |
|
| 7 | + * @package LSX Customizer |
|
| 8 | + * @author LightSpeed |
|
| 9 | + * @license GPL3 |
|
| 10 | + * @link |
|
| 11 | + * @copyright 2016 LightSpeed |
|
| 12 | + */ |
|
| 13 | + class LSX_Customizer_Colour_Header extends LSX_Customizer_Colour { |
|
| 14 | + |
|
| 15 | + /** |
|
| 16 | + * Constructor. |
|
| 17 | + * |
|
| 18 | + * @since 1.0.0 |
|
| 19 | + */ |
|
| 20 | + public function __construct() { |
|
| 21 | + add_action( 'after_switch_theme', array( $this, 'set_theme_mod' ) ); |
|
| 22 | + add_action( 'customize_save_after', array( $this, 'set_theme_mod' ) ); |
|
| 23 | + |
|
| 24 | + add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_css' ), 2999 ); |
|
| 25 | + } |
|
| 26 | + |
|
| 27 | + /** |
|
| 28 | + * Assign CSS to theme mod. |
|
| 29 | + * |
|
| 30 | + * @since 1.0.0 |
|
| 31 | + */ |
|
| 32 | + public function set_theme_mod() { |
|
| 33 | + $theme_mods = $this->get_theme_mods(); |
|
| 34 | + $styles = $this->get_css( $theme_mods ); |
|
| 35 | + |
|
| 36 | + set_theme_mod( 'lsx_customizer_colour__header_theme_mod', $styles ); |
|
| 37 | + } |
|
| 38 | + |
|
| 39 | + /** |
|
| 40 | + * Enqueues front-end CSS. |
|
| 41 | + * |
|
| 42 | + * @since 1.0.0 |
|
| 43 | + */ |
|
| 44 | + public function enqueue_css() { |
|
| 45 | + $styles_from_theme_mod = get_theme_mod( 'lsx_customizer_colour__header_theme_mod' ); |
|
| 46 | + |
|
| 47 | + if ( is_customize_preview() || false === $styles_from_theme_mod ) { |
|
| 48 | + $theme_mods = $this->get_theme_mods(); |
|
| 49 | + $styles = $this->get_css( $theme_mods ); |
|
| 50 | + |
|
| 51 | + if ( false === $styles_from_theme_mod ) { |
|
| 52 | + set_theme_mod( 'lsx_customizer_colour__header_theme_mod', $styles ); |
|
| 53 | + } |
|
| 54 | + } else { |
|
| 55 | + $styles = $styles_from_theme_mod; |
|
| 56 | + } |
|
| 57 | + |
|
| 58 | + wp_add_inline_style( 'lsx-customizer', $styles ); |
|
| 59 | + } |
|
| 60 | + |
|
| 61 | + /** |
|
| 62 | + * Get CSS theme mods. |
|
| 63 | + * |
|
| 64 | + * @since 1.0.0 |
|
| 65 | + */ |
|
| 66 | + public function get_theme_mods() { |
|
| 67 | + $colors = parent::get_color_scheme(); |
|
| 68 | + |
|
| 69 | + return apply_filters( 'lsx_customizer_colours_header', array( |
|
| 70 | + 'header_background_color' => get_theme_mod( 'header_background_color', $colors['header_background_color'] ), |
|
| 71 | + 'header_link_color' => get_theme_mod( 'header_link_color', $colors['header_link_color'] ), |
|
| 72 | + 'header_link_hover_color' => get_theme_mod( 'header_link_hover_color', $colors['header_link_hover_color'] ), |
|
| 73 | + 'header_description_color' => get_theme_mod( 'header_description_color', $colors['header_description_color'] ), |
|
| 74 | + ) ); |
|
| 75 | + } |
|
| 76 | + |
|
| 77 | + /** |
|
| 78 | + * Returns CSS. |
|
| 79 | + * |
|
| 80 | + * @since 1.0.0 |
|
| 81 | + */ |
|
| 82 | + function get_css( $colors ) { |
|
| 83 | + global $customizer_colour_names; |
|
| 84 | + |
|
| 85 | + $colors_template = array(); |
|
| 86 | + |
|
| 87 | + foreach ( $customizer_colour_names as $key => $value ) { |
|
| 88 | + $colors_template[ $key ] = ''; |
|
| 89 | + } |
|
| 90 | + |
|
| 91 | + $colors = wp_parse_args( $colors, $colors_template ); |
|
| 92 | + |
|
| 93 | + if ( empty( $colors['header_background_color'] ) |
|
| 94 | + || empty( $colors['header_link_color'] ) |
|
| 95 | + || empty( $colors['header_link_hover_color'] ) |
|
| 96 | + || empty( $colors['header_description_color'] ) ) { |
|
| 97 | + return ''; |
|
| 98 | + } |
|
| 99 | + |
|
| 100 | + $css = ' |
|
| 101 | 101 | @import "' . get_template_directory() . '/assets/css/scss/global/mixins/header"; |
| 102 | 102 | |
| 103 | 103 | /** |
@@ -111,12 +111,12 @@ discard block |
||
| 111 | 111 | ); |
| 112 | 112 | '; |
| 113 | 113 | |
| 114 | - $css = apply_filters( 'lsx_customizer_colour_selectors_header', $css, $colors ); |
|
| 115 | - $css = parent::scss_to_css( $css ); |
|
| 114 | + $css = apply_filters( 'lsx_customizer_colour_selectors_header', $css, $colors ); |
|
| 115 | + $css = parent::scss_to_css( $css ); |
|
| 116 | 116 | |
| 117 | - return $css; |
|
| 118 | - } |
|
| 117 | + return $css; |
|
| 118 | + } |
|
| 119 | 119 | |
| 120 | - } |
|
| 120 | + } |
|
| 121 | 121 | |
| 122 | 122 | } |
@@ -1,5 +1,5 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | -if ( ! class_exists( 'LSX_Customizer_Colour_Footer_CTA' ) ) { |
|
| 2 | +if ( ! class_exists('LSX_Customizer_Colour_Footer_CTA')) { |
|
| 3 | 3 | |
| 4 | 4 | /** |
| 5 | 5 | * LSX Customizer Colour Footer CTA Class |
@@ -18,10 +18,10 @@ discard block |
||
| 18 | 18 | * @since 1.0.0 |
| 19 | 19 | */ |
| 20 | 20 | public function __construct() { |
| 21 | - add_action( 'after_switch_theme', array( $this, 'set_theme_mod' ) ); |
|
| 22 | - add_action( 'customize_save_after', array( $this, 'set_theme_mod' ) ); |
|
| 21 | + add_action('after_switch_theme', array($this, 'set_theme_mod')); |
|
| 22 | + add_action('customize_save_after', array($this, 'set_theme_mod')); |
|
| 23 | 23 | |
| 24 | - add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_css' ), 2999 ); |
|
| 24 | + add_action('wp_enqueue_scripts', array($this, 'enqueue_css'), 2999); |
|
| 25 | 25 | } |
| 26 | 26 | |
| 27 | 27 | /** |
@@ -31,9 +31,9 @@ discard block |
||
| 31 | 31 | */ |
| 32 | 32 | public function set_theme_mod() { |
| 33 | 33 | $theme_mods = $this->get_theme_mods(); |
| 34 | - $styles = $this->get_css( $theme_mods ); |
|
| 34 | + $styles = $this->get_css($theme_mods); |
|
| 35 | 35 | |
| 36 | - set_theme_mod( 'lsx_customizer_colour__footer_cta_theme_mod', $styles ); |
|
| 36 | + set_theme_mod('lsx_customizer_colour__footer_cta_theme_mod', $styles); |
|
| 37 | 37 | } |
| 38 | 38 | |
| 39 | 39 | /** |
@@ -42,20 +42,20 @@ discard block |
||
| 42 | 42 | * @since 1.0.0 |
| 43 | 43 | */ |
| 44 | 44 | public function enqueue_css() { |
| 45 | - $styles_from_theme_mod = get_theme_mod( 'lsx_customizer_colour__footer_cta_theme_mod' ); |
|
| 45 | + $styles_from_theme_mod = get_theme_mod('lsx_customizer_colour__footer_cta_theme_mod'); |
|
| 46 | 46 | |
| 47 | - if ( is_customize_preview() || false === $styles_from_theme_mod ) { |
|
| 47 | + if (is_customize_preview() || false === $styles_from_theme_mod) { |
|
| 48 | 48 | $theme_mods = $this->get_theme_mods(); |
| 49 | - $styles = $this->get_css( $theme_mods ); |
|
| 49 | + $styles = $this->get_css($theme_mods); |
|
| 50 | 50 | |
| 51 | - if ( false === $styles_from_theme_mod ) { |
|
| 52 | - set_theme_mod( 'lsx_customizer_colour__footer_cta_theme_mod', $styles ); |
|
| 51 | + if (false === $styles_from_theme_mod) { |
|
| 52 | + set_theme_mod('lsx_customizer_colour__footer_cta_theme_mod', $styles); |
|
| 53 | 53 | } |
| 54 | 54 | } else { |
| 55 | 55 | $styles = $styles_from_theme_mod; |
| 56 | 56 | } |
| 57 | 57 | |
| 58 | - wp_add_inline_style( 'lsx-customizer', $styles ); |
|
| 58 | + wp_add_inline_style('lsx-customizer', $styles); |
|
| 59 | 59 | } |
| 60 | 60 | |
| 61 | 61 | /** |
@@ -66,12 +66,12 @@ discard block |
||
| 66 | 66 | public function get_theme_mods() { |
| 67 | 67 | $colors = parent::get_color_scheme(); |
| 68 | 68 | |
| 69 | - return apply_filters( 'lsx_customizer_colours_footer_cta', array( |
|
| 70 | - 'footer_cta_background_color' => get_theme_mod( 'footer_cta_background_color', $colors['footer_cta_background_color'] ), |
|
| 71 | - 'footer_cta_text_color' => get_theme_mod( 'footer_cta_text_color', $colors['footer_cta_text_color'] ), |
|
| 72 | - 'footer_cta_link_color' => get_theme_mod( 'footer_cta_link_color', $colors['footer_cta_link_color'] ), |
|
| 73 | - 'footer_cta_link_hover_color' => get_theme_mod( 'footer_cta_link_hover_color', $colors['footer_cta_link_hover_color'] ), |
|
| 74 | - ) ); |
|
| 69 | + return apply_filters('lsx_customizer_colours_footer_cta', array( |
|
| 70 | + 'footer_cta_background_color' => get_theme_mod('footer_cta_background_color', $colors['footer_cta_background_color']), |
|
| 71 | + 'footer_cta_text_color' => get_theme_mod('footer_cta_text_color', $colors['footer_cta_text_color']), |
|
| 72 | + 'footer_cta_link_color' => get_theme_mod('footer_cta_link_color', $colors['footer_cta_link_color']), |
|
| 73 | + 'footer_cta_link_hover_color' => get_theme_mod('footer_cta_link_hover_color', $colors['footer_cta_link_hover_color']), |
|
| 74 | + )); |
|
| 75 | 75 | } |
| 76 | 76 | |
| 77 | 77 | /** |
@@ -79,21 +79,21 @@ discard block |
||
| 79 | 79 | * |
| 80 | 80 | * @since 1.0.0 |
| 81 | 81 | */ |
| 82 | - function get_css( $colors ) { |
|
| 82 | + function get_css($colors) { |
|
| 83 | 83 | global $customizer_colour_names; |
| 84 | 84 | |
| 85 | 85 | $colors_template = array(); |
| 86 | 86 | |
| 87 | - foreach ( $customizer_colour_names as $key => $value ) { |
|
| 88 | - $colors_template[ $key ] = ''; |
|
| 87 | + foreach ($customizer_colour_names as $key => $value) { |
|
| 88 | + $colors_template[$key] = ''; |
|
| 89 | 89 | } |
| 90 | 90 | |
| 91 | - $colors = wp_parse_args( $colors, $colors_template ); |
|
| 91 | + $colors = wp_parse_args($colors, $colors_template); |
|
| 92 | 92 | |
| 93 | - if ( empty( $colors['footer_cta_background_color'] ) |
|
| 94 | - || empty( $colors['footer_cta_text_color'] ) |
|
| 95 | - || empty( $colors['footer_cta_link_color'] ) |
|
| 96 | - || empty( $colors['footer_cta_link_hover_color'] ) ) { |
|
| 93 | + if (empty($colors['footer_cta_background_color']) |
|
| 94 | + || empty($colors['footer_cta_text_color']) |
|
| 95 | + || empty($colors['footer_cta_link_color']) |
|
| 96 | + || empty($colors['footer_cta_link_hover_color'])) { |
|
| 97 | 97 | return ''; |
| 98 | 98 | } |
| 99 | 99 | |
@@ -111,8 +111,8 @@ discard block |
||
| 111 | 111 | ); |
| 112 | 112 | '; |
| 113 | 113 | |
| 114 | - $css = apply_filters( 'lsx_customizer_colour_selectors_footer_cta', $css, $colors ); |
|
| 115 | - $css = parent::scss_to_css( $css ); |
|
| 114 | + $css = apply_filters('lsx_customizer_colour_selectors_footer_cta', $css, $colors); |
|
| 115 | + $css = parent::scss_to_css($css); |
|
| 116 | 116 | return $css; |
| 117 | 117 | } |
| 118 | 118 | |
@@ -1,103 +1,103 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | if ( ! class_exists( 'LSX_Customizer_Colour_Footer_CTA' ) ) { |
| 3 | 3 | |
| 4 | - /** |
|
| 5 | - * LSX Customizer Colour Footer CTA Class |
|
| 6 | - * |
|
| 7 | - * @package LSX Customizer |
|
| 8 | - * @author LightSpeed |
|
| 9 | - * @license GPL3 |
|
| 10 | - * @link |
|
| 11 | - * @copyright 2016 LightSpeed |
|
| 12 | - */ |
|
| 13 | - class LSX_Customizer_Colour_Footer_CTA extends LSX_Customizer_Colour { |
|
| 14 | - |
|
| 15 | - /** |
|
| 16 | - * Constructor. |
|
| 17 | - * |
|
| 18 | - * @since 1.0.0 |
|
| 19 | - */ |
|
| 20 | - public function __construct() { |
|
| 21 | - add_action( 'after_switch_theme', array( $this, 'set_theme_mod' ) ); |
|
| 22 | - add_action( 'customize_save_after', array( $this, 'set_theme_mod' ) ); |
|
| 23 | - |
|
| 24 | - add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_css' ), 2999 ); |
|
| 25 | - } |
|
| 26 | - |
|
| 27 | - /** |
|
| 28 | - * Assign CSS to theme mod. |
|
| 29 | - * |
|
| 30 | - * @since 1.0.0 |
|
| 31 | - */ |
|
| 32 | - public function set_theme_mod() { |
|
| 33 | - $theme_mods = $this->get_theme_mods(); |
|
| 34 | - $styles = $this->get_css( $theme_mods ); |
|
| 35 | - |
|
| 36 | - set_theme_mod( 'lsx_customizer_colour__footer_cta_theme_mod', $styles ); |
|
| 37 | - } |
|
| 38 | - |
|
| 39 | - /** |
|
| 40 | - * Enqueues front-end CSS. |
|
| 41 | - * |
|
| 42 | - * @since 1.0.0 |
|
| 43 | - */ |
|
| 44 | - public function enqueue_css() { |
|
| 45 | - $styles_from_theme_mod = get_theme_mod( 'lsx_customizer_colour__footer_cta_theme_mod' ); |
|
| 46 | - |
|
| 47 | - if ( is_customize_preview() || false === $styles_from_theme_mod ) { |
|
| 48 | - $theme_mods = $this->get_theme_mods(); |
|
| 49 | - $styles = $this->get_css( $theme_mods ); |
|
| 50 | - |
|
| 51 | - if ( false === $styles_from_theme_mod ) { |
|
| 52 | - set_theme_mod( 'lsx_customizer_colour__footer_cta_theme_mod', $styles ); |
|
| 53 | - } |
|
| 54 | - } else { |
|
| 55 | - $styles = $styles_from_theme_mod; |
|
| 56 | - } |
|
| 57 | - |
|
| 58 | - wp_add_inline_style( 'lsx-customizer', $styles ); |
|
| 59 | - } |
|
| 60 | - |
|
| 61 | - /** |
|
| 62 | - * Get CSS theme mods. |
|
| 63 | - * |
|
| 64 | - * @since 1.0.0 |
|
| 65 | - */ |
|
| 66 | - public function get_theme_mods() { |
|
| 67 | - $colors = parent::get_color_scheme(); |
|
| 68 | - |
|
| 69 | - return apply_filters( 'lsx_customizer_colours_footer_cta', array( |
|
| 70 | - 'footer_cta_background_color' => get_theme_mod( 'footer_cta_background_color', $colors['footer_cta_background_color'] ), |
|
| 71 | - 'footer_cta_text_color' => get_theme_mod( 'footer_cta_text_color', $colors['footer_cta_text_color'] ), |
|
| 72 | - 'footer_cta_link_color' => get_theme_mod( 'footer_cta_link_color', $colors['footer_cta_link_color'] ), |
|
| 73 | - 'footer_cta_link_hover_color' => get_theme_mod( 'footer_cta_link_hover_color', $colors['footer_cta_link_hover_color'] ), |
|
| 74 | - ) ); |
|
| 75 | - } |
|
| 76 | - |
|
| 77 | - /** |
|
| 78 | - * Returns CSS. |
|
| 79 | - * |
|
| 80 | - * @since 1.0.0 |
|
| 81 | - */ |
|
| 82 | - function get_css( $colors ) { |
|
| 83 | - global $customizer_colour_names; |
|
| 84 | - |
|
| 85 | - $colors_template = array(); |
|
| 86 | - |
|
| 87 | - foreach ( $customizer_colour_names as $key => $value ) { |
|
| 88 | - $colors_template[ $key ] = ''; |
|
| 89 | - } |
|
| 90 | - |
|
| 91 | - $colors = wp_parse_args( $colors, $colors_template ); |
|
| 92 | - |
|
| 93 | - if ( empty( $colors['footer_cta_background_color'] ) |
|
| 94 | - || empty( $colors['footer_cta_text_color'] ) |
|
| 95 | - || empty( $colors['footer_cta_link_color'] ) |
|
| 96 | - || empty( $colors['footer_cta_link_hover_color'] ) ) { |
|
| 97 | - return ''; |
|
| 98 | - } |
|
| 99 | - |
|
| 100 | - $css = ' |
|
| 4 | + /** |
|
| 5 | + * LSX Customizer Colour Footer CTA Class |
|
| 6 | + * |
|
| 7 | + * @package LSX Customizer |
|
| 8 | + * @author LightSpeed |
|
| 9 | + * @license GPL3 |
|
| 10 | + * @link |
|
| 11 | + * @copyright 2016 LightSpeed |
|
| 12 | + */ |
|
| 13 | + class LSX_Customizer_Colour_Footer_CTA extends LSX_Customizer_Colour { |
|
| 14 | + |
|
| 15 | + /** |
|
| 16 | + * Constructor. |
|
| 17 | + * |
|
| 18 | + * @since 1.0.0 |
|
| 19 | + */ |
|
| 20 | + public function __construct() { |
|
| 21 | + add_action( 'after_switch_theme', array( $this, 'set_theme_mod' ) ); |
|
| 22 | + add_action( 'customize_save_after', array( $this, 'set_theme_mod' ) ); |
|
| 23 | + |
|
| 24 | + add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_css' ), 2999 ); |
|
| 25 | + } |
|
| 26 | + |
|
| 27 | + /** |
|
| 28 | + * Assign CSS to theme mod. |
|
| 29 | + * |
|
| 30 | + * @since 1.0.0 |
|
| 31 | + */ |
|
| 32 | + public function set_theme_mod() { |
|
| 33 | + $theme_mods = $this->get_theme_mods(); |
|
| 34 | + $styles = $this->get_css( $theme_mods ); |
|
| 35 | + |
|
| 36 | + set_theme_mod( 'lsx_customizer_colour__footer_cta_theme_mod', $styles ); |
|
| 37 | + } |
|
| 38 | + |
|
| 39 | + /** |
|
| 40 | + * Enqueues front-end CSS. |
|
| 41 | + * |
|
| 42 | + * @since 1.0.0 |
|
| 43 | + */ |
|
| 44 | + public function enqueue_css() { |
|
| 45 | + $styles_from_theme_mod = get_theme_mod( 'lsx_customizer_colour__footer_cta_theme_mod' ); |
|
| 46 | + |
|
| 47 | + if ( is_customize_preview() || false === $styles_from_theme_mod ) { |
|
| 48 | + $theme_mods = $this->get_theme_mods(); |
|
| 49 | + $styles = $this->get_css( $theme_mods ); |
|
| 50 | + |
|
| 51 | + if ( false === $styles_from_theme_mod ) { |
|
| 52 | + set_theme_mod( 'lsx_customizer_colour__footer_cta_theme_mod', $styles ); |
|
| 53 | + } |
|
| 54 | + } else { |
|
| 55 | + $styles = $styles_from_theme_mod; |
|
| 56 | + } |
|
| 57 | + |
|
| 58 | + wp_add_inline_style( 'lsx-customizer', $styles ); |
|
| 59 | + } |
|
| 60 | + |
|
| 61 | + /** |
|
| 62 | + * Get CSS theme mods. |
|
| 63 | + * |
|
| 64 | + * @since 1.0.0 |
|
| 65 | + */ |
|
| 66 | + public function get_theme_mods() { |
|
| 67 | + $colors = parent::get_color_scheme(); |
|
| 68 | + |
|
| 69 | + return apply_filters( 'lsx_customizer_colours_footer_cta', array( |
|
| 70 | + 'footer_cta_background_color' => get_theme_mod( 'footer_cta_background_color', $colors['footer_cta_background_color'] ), |
|
| 71 | + 'footer_cta_text_color' => get_theme_mod( 'footer_cta_text_color', $colors['footer_cta_text_color'] ), |
|
| 72 | + 'footer_cta_link_color' => get_theme_mod( 'footer_cta_link_color', $colors['footer_cta_link_color'] ), |
|
| 73 | + 'footer_cta_link_hover_color' => get_theme_mod( 'footer_cta_link_hover_color', $colors['footer_cta_link_hover_color'] ), |
|
| 74 | + ) ); |
|
| 75 | + } |
|
| 76 | + |
|
| 77 | + /** |
|
| 78 | + * Returns CSS. |
|
| 79 | + * |
|
| 80 | + * @since 1.0.0 |
|
| 81 | + */ |
|
| 82 | + function get_css( $colors ) { |
|
| 83 | + global $customizer_colour_names; |
|
| 84 | + |
|
| 85 | + $colors_template = array(); |
|
| 86 | + |
|
| 87 | + foreach ( $customizer_colour_names as $key => $value ) { |
|
| 88 | + $colors_template[ $key ] = ''; |
|
| 89 | + } |
|
| 90 | + |
|
| 91 | + $colors = wp_parse_args( $colors, $colors_template ); |
|
| 92 | + |
|
| 93 | + if ( empty( $colors['footer_cta_background_color'] ) |
|
| 94 | + || empty( $colors['footer_cta_text_color'] ) |
|
| 95 | + || empty( $colors['footer_cta_link_color'] ) |
|
| 96 | + || empty( $colors['footer_cta_link_hover_color'] ) ) { |
|
| 97 | + return ''; |
|
| 98 | + } |
|
| 99 | + |
|
| 100 | + $css = ' |
|
| 101 | 101 | @import "' . get_template_directory() . '/assets/css/scss/global/mixins/footer-cta"; |
| 102 | 102 | |
| 103 | 103 | /** |
@@ -111,11 +111,11 @@ discard block |
||
| 111 | 111 | ); |
| 112 | 112 | '; |
| 113 | 113 | |
| 114 | - $css = apply_filters( 'lsx_customizer_colour_selectors_footer_cta', $css, $colors ); |
|
| 115 | - $css = parent::scss_to_css( $css ); |
|
| 116 | - return $css; |
|
| 117 | - } |
|
| 114 | + $css = apply_filters( 'lsx_customizer_colour_selectors_footer_cta', $css, $colors ); |
|
| 115 | + $css = parent::scss_to_css( $css ); |
|
| 116 | + return $css; |
|
| 117 | + } |
|
| 118 | 118 | |
| 119 | - } |
|
| 119 | + } |
|
| 120 | 120 | |
| 121 | 121 | } |
@@ -1,5 +1,5 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | -if ( ! class_exists( 'LSX_Customizer_Colour_Body' ) ) { |
|
| 2 | +if ( ! class_exists('LSX_Customizer_Colour_Body')) { |
|
| 3 | 3 | |
| 4 | 4 | /** |
| 5 | 5 | * LSX Customizer Colour Body Class |
@@ -18,10 +18,10 @@ discard block |
||
| 18 | 18 | * @since 1.0.0 |
| 19 | 19 | */ |
| 20 | 20 | public function __construct() { |
| 21 | - add_action( 'after_switch_theme', array( $this, 'set_theme_mod' ) ); |
|
| 22 | - add_action( 'customize_save_after', array( $this, 'set_theme_mod' ) ); |
|
| 21 | + add_action('after_switch_theme', array($this, 'set_theme_mod')); |
|
| 22 | + add_action('customize_save_after', array($this, 'set_theme_mod')); |
|
| 23 | 23 | |
| 24 | - add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_css' ), 2999 ); |
|
| 24 | + add_action('wp_enqueue_scripts', array($this, 'enqueue_css'), 2999); |
|
| 25 | 25 | } |
| 26 | 26 | |
| 27 | 27 | /** |
@@ -31,9 +31,9 @@ discard block |
||
| 31 | 31 | */ |
| 32 | 32 | public function set_theme_mod() { |
| 33 | 33 | $theme_mods = $this->get_theme_mods(); |
| 34 | - $styles = $this->get_css( $theme_mods ); |
|
| 34 | + $styles = $this->get_css($theme_mods); |
|
| 35 | 35 | |
| 36 | - set_theme_mod( 'lsx_customizer_colour__body_theme_mod', $styles ); |
|
| 36 | + set_theme_mod('lsx_customizer_colour__body_theme_mod', $styles); |
|
| 37 | 37 | } |
| 38 | 38 | |
| 39 | 39 | /** |
@@ -42,20 +42,20 @@ discard block |
||
| 42 | 42 | * @since 1.0.0 |
| 43 | 43 | */ |
| 44 | 44 | public function enqueue_css() { |
| 45 | - $styles_from_theme_mod = get_theme_mod( 'lsx_customizer_colour__body_theme_mod' ); |
|
| 45 | + $styles_from_theme_mod = get_theme_mod('lsx_customizer_colour__body_theme_mod'); |
|
| 46 | 46 | |
| 47 | - if ( is_customize_preview() || false === $styles_from_theme_mod ) { |
|
| 47 | + if (is_customize_preview() || false === $styles_from_theme_mod) { |
|
| 48 | 48 | $theme_mods = $this->get_theme_mods(); |
| 49 | - $styles = $this->get_css( $theme_mods ); |
|
| 49 | + $styles = $this->get_css($theme_mods); |
|
| 50 | 50 | |
| 51 | - if ( false === $styles_from_theme_mod ) { |
|
| 52 | - set_theme_mod( 'lsx_customizer_colour__body_theme_mod', $styles ); |
|
| 51 | + if (false === $styles_from_theme_mod) { |
|
| 52 | + set_theme_mod('lsx_customizer_colour__body_theme_mod', $styles); |
|
| 53 | 53 | } |
| 54 | 54 | } else { |
| 55 | 55 | $styles = $styles_from_theme_mod; |
| 56 | 56 | } |
| 57 | 57 | |
| 58 | - wp_add_inline_style( 'lsx-customizer', $styles ); |
|
| 58 | + wp_add_inline_style('lsx-customizer', $styles); |
|
| 59 | 59 | } |
| 60 | 60 | |
| 61 | 61 | /** |
@@ -66,30 +66,30 @@ discard block |
||
| 66 | 66 | public function get_theme_mods() { |
| 67 | 67 | $colors = parent::get_color_scheme(); |
| 68 | 68 | |
| 69 | - $background_color = get_theme_mod( 'background_color', $colors['background_color'] ); |
|
| 69 | + $background_color = get_theme_mod('background_color', $colors['background_color']); |
|
| 70 | 70 | |
| 71 | - if ( '#' !== substr( $background_color, 0, 1 ) ) { |
|
| 71 | + if ('#' !== substr($background_color, 0, 1)) { |
|
| 72 | 72 | $background_color = '#' . $background_color; |
| 73 | 73 | } |
| 74 | 74 | |
| 75 | - return apply_filters( 'lsx_customizer_colours_body', array( |
|
| 75 | + return apply_filters('lsx_customizer_colours_body', array( |
|
| 76 | 76 | 'background_color' => $background_color, |
| 77 | - 'body_line_color' => get_theme_mod( 'body_line_color', $colors['body_line_color'] ), |
|
| 78 | - 'body_text_heading_color' => get_theme_mod( 'body_text_heading_color', $colors['body_text_heading_color'] ), |
|
| 79 | - 'body_text_small_color' => get_theme_mod( 'body_text_small_color', $colors['body_text_small_color'] ), |
|
| 80 | - 'body_text_color' => get_theme_mod( 'body_text_color', $colors['body_text_color'] ), |
|
| 81 | - 'body_link_color' => get_theme_mod( 'body_link_color', $colors['body_link_color'] ), |
|
| 82 | - 'body_link_hover_color' => get_theme_mod( 'body_link_hover_color', $colors['body_link_hover_color'] ), |
|
| 83 | - 'body_section_full_background_color' => get_theme_mod( 'body_section_full_background_color', $colors['body_section_full_background_color'] ), |
|
| 84 | - 'body_section_full_text_color' => get_theme_mod( 'body_section_full_text_color', $colors['body_section_full_text_color'] ), |
|
| 85 | - 'body_section_full_link_color' => get_theme_mod( 'body_section_full_link_color', $colors['body_section_full_link_color'] ), |
|
| 86 | - 'body_section_full_link_hover_color' => get_theme_mod( 'body_section_full_link_hover_color', $colors['body_section_full_link_hover_color'] ), |
|
| 87 | - 'body_section_full_cta_background_color' => get_theme_mod( 'body_section_full_cta_background_color', $colors['body_section_full_cta_background_color'] ), |
|
| 88 | - 'body_section_full_cta_text_color' => get_theme_mod( 'body_section_full_cta_text_color', $colors['body_section_full_cta_text_color'] ), |
|
| 89 | - 'body_section_full_cta_link_color' => get_theme_mod( 'body_section_full_cta_link_color', $colors['body_section_full_cta_link_color'] ), |
|
| 90 | - 'body_section_full_cta_link_hover_color' => get_theme_mod( 'body_section_full_cta_link_hover_color', $colors['body_section_full_cta_link_hover_color'] ), |
|
| 91 | - 'primary_color' => get_theme_mod( 'primary_color', $colors['primary_color'] ), |
|
| 92 | - ) ); |
|
| 77 | + 'body_line_color' => get_theme_mod('body_line_color', $colors['body_line_color']), |
|
| 78 | + 'body_text_heading_color' => get_theme_mod('body_text_heading_color', $colors['body_text_heading_color']), |
|
| 79 | + 'body_text_small_color' => get_theme_mod('body_text_small_color', $colors['body_text_small_color']), |
|
| 80 | + 'body_text_color' => get_theme_mod('body_text_color', $colors['body_text_color']), |
|
| 81 | + 'body_link_color' => get_theme_mod('body_link_color', $colors['body_link_color']), |
|
| 82 | + 'body_link_hover_color' => get_theme_mod('body_link_hover_color', $colors['body_link_hover_color']), |
|
| 83 | + 'body_section_full_background_color' => get_theme_mod('body_section_full_background_color', $colors['body_section_full_background_color']), |
|
| 84 | + 'body_section_full_text_color' => get_theme_mod('body_section_full_text_color', $colors['body_section_full_text_color']), |
|
| 85 | + 'body_section_full_link_color' => get_theme_mod('body_section_full_link_color', $colors['body_section_full_link_color']), |
|
| 86 | + 'body_section_full_link_hover_color' => get_theme_mod('body_section_full_link_hover_color', $colors['body_section_full_link_hover_color']), |
|
| 87 | + 'body_section_full_cta_background_color' => get_theme_mod('body_section_full_cta_background_color', $colors['body_section_full_cta_background_color']), |
|
| 88 | + 'body_section_full_cta_text_color' => get_theme_mod('body_section_full_cta_text_color', $colors['body_section_full_cta_text_color']), |
|
| 89 | + 'body_section_full_cta_link_color' => get_theme_mod('body_section_full_cta_link_color', $colors['body_section_full_cta_link_color']), |
|
| 90 | + 'body_section_full_cta_link_hover_color' => get_theme_mod('body_section_full_cta_link_hover_color', $colors['body_section_full_cta_link_hover_color']), |
|
| 91 | + 'primary_color' => get_theme_mod('primary_color', $colors['primary_color']), |
|
| 92 | + )); |
|
| 93 | 93 | } |
| 94 | 94 | |
| 95 | 95 | /** |
@@ -97,32 +97,32 @@ discard block |
||
| 97 | 97 | * |
| 98 | 98 | * @since 1.0.0 |
| 99 | 99 | */ |
| 100 | - function get_css( $colors ) { |
|
| 100 | + function get_css($colors) { |
|
| 101 | 101 | global $customizer_colour_names; |
| 102 | 102 | |
| 103 | 103 | $colors_template = array(); |
| 104 | 104 | |
| 105 | - foreach ( $customizer_colour_names as $key => $value ) { |
|
| 106 | - $colors_template[ $key ] = ''; |
|
| 105 | + foreach ($customizer_colour_names as $key => $value) { |
|
| 106 | + $colors_template[$key] = ''; |
|
| 107 | 107 | } |
| 108 | 108 | |
| 109 | - $colors = wp_parse_args( $colors, $colors_template ); |
|
| 110 | - |
|
| 111 | - if ( empty( $colors['background_color'] ) |
|
| 112 | - || empty( $colors['body_line_color'] ) |
|
| 113 | - || empty( $colors['body_text_heading_color'] ) |
|
| 114 | - || empty( $colors['body_text_color'] ) |
|
| 115 | - || empty( $colors['body_link_color'] ) |
|
| 116 | - || empty( $colors['body_link_hover_color'] ) |
|
| 117 | - || empty( $colors['body_text_small_color'] ) |
|
| 118 | - || empty( $colors['body_section_full_background_color'] ) |
|
| 119 | - || empty( $colors['body_section_full_text_color'] ) |
|
| 120 | - || empty( $colors['body_section_full_link_color'] ) |
|
| 121 | - || empty( $colors['body_section_full_link_hover_color'] ) |
|
| 122 | - || empty( $colors['body_section_full_cta_background_color'] ) |
|
| 123 | - || empty( $colors['body_section_full_cta_text_color'] ) |
|
| 124 | - || empty( $colors['body_section_full_cta_link_color'] ) |
|
| 125 | - || empty( $colors['body_section_full_cta_link_hover_color'] ) ) { |
|
| 109 | + $colors = wp_parse_args($colors, $colors_template); |
|
| 110 | + |
|
| 111 | + if (empty($colors['background_color']) |
|
| 112 | + || empty($colors['body_line_color']) |
|
| 113 | + || empty($colors['body_text_heading_color']) |
|
| 114 | + || empty($colors['body_text_color']) |
|
| 115 | + || empty($colors['body_link_color']) |
|
| 116 | + || empty($colors['body_link_hover_color']) |
|
| 117 | + || empty($colors['body_text_small_color']) |
|
| 118 | + || empty($colors['body_section_full_background_color']) |
|
| 119 | + || empty($colors['body_section_full_text_color']) |
|
| 120 | + || empty($colors['body_section_full_link_color']) |
|
| 121 | + || empty($colors['body_section_full_link_hover_color']) |
|
| 122 | + || empty($colors['body_section_full_cta_background_color']) |
|
| 123 | + || empty($colors['body_section_full_cta_text_color']) |
|
| 124 | + || empty($colors['body_section_full_cta_link_color']) |
|
| 125 | + || empty($colors['body_section_full_cta_link_hover_color'])) { |
|
| 126 | 126 | return ''; |
| 127 | 127 | } |
| 128 | 128 | |
@@ -152,8 +152,8 @@ discard block |
||
| 152 | 152 | ); |
| 153 | 153 | '; |
| 154 | 154 | |
| 155 | - $css = apply_filters( 'lsx_customizer_colour_selectors_body', $css, $colors ); |
|
| 156 | - $css = parent::scss_to_css( $css ); |
|
| 155 | + $css = apply_filters('lsx_customizer_colour_selectors_body', $css, $colors); |
|
| 156 | + $css = parent::scss_to_css($css); |
|
| 157 | 157 | |
| 158 | 158 | return $css; |
| 159 | 159 | } |
@@ -1,132 +1,132 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | if ( ! class_exists( 'LSX_Customizer_Colour_Body' ) ) { |
| 3 | 3 | |
| 4 | - /** |
|
| 5 | - * LSX Customizer Colour Body Class |
|
| 6 | - * |
|
| 7 | - * @package LSX Customizer |
|
| 8 | - * @author LightSpeed |
|
| 9 | - * @license GPL3 |
|
| 10 | - * @link |
|
| 11 | - * @copyright 2016 LightSpeed |
|
| 12 | - */ |
|
| 13 | - class LSX_Customizer_Colour_Body extends LSX_Customizer_Colour { |
|
| 14 | - |
|
| 15 | - /** |
|
| 16 | - * Constructor. |
|
| 17 | - * |
|
| 18 | - * @since 1.0.0 |
|
| 19 | - */ |
|
| 20 | - public function __construct() { |
|
| 21 | - add_action( 'after_switch_theme', array( $this, 'set_theme_mod' ) ); |
|
| 22 | - add_action( 'customize_save_after', array( $this, 'set_theme_mod' ) ); |
|
| 23 | - |
|
| 24 | - add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_css' ), 2999 ); |
|
| 25 | - } |
|
| 26 | - |
|
| 27 | - /** |
|
| 28 | - * Assign CSS to theme mod. |
|
| 29 | - * |
|
| 30 | - * @since 1.0.0 |
|
| 31 | - */ |
|
| 32 | - public function set_theme_mod() { |
|
| 33 | - $theme_mods = $this->get_theme_mods(); |
|
| 34 | - $styles = $this->get_css( $theme_mods ); |
|
| 35 | - |
|
| 36 | - set_theme_mod( 'lsx_customizer_colour__body_theme_mod', $styles ); |
|
| 37 | - } |
|
| 38 | - |
|
| 39 | - /** |
|
| 40 | - * Enqueues front-end CSS. |
|
| 41 | - * |
|
| 42 | - * @since 1.0.0 |
|
| 43 | - */ |
|
| 44 | - public function enqueue_css() { |
|
| 45 | - $styles_from_theme_mod = get_theme_mod( 'lsx_customizer_colour__body_theme_mod' ); |
|
| 46 | - |
|
| 47 | - if ( is_customize_preview() || false === $styles_from_theme_mod ) { |
|
| 48 | - $theme_mods = $this->get_theme_mods(); |
|
| 49 | - $styles = $this->get_css( $theme_mods ); |
|
| 50 | - |
|
| 51 | - if ( false === $styles_from_theme_mod ) { |
|
| 52 | - set_theme_mod( 'lsx_customizer_colour__body_theme_mod', $styles ); |
|
| 53 | - } |
|
| 54 | - } else { |
|
| 55 | - $styles = $styles_from_theme_mod; |
|
| 56 | - } |
|
| 57 | - |
|
| 58 | - wp_add_inline_style( 'lsx-customizer', $styles ); |
|
| 59 | - } |
|
| 60 | - |
|
| 61 | - /** |
|
| 62 | - * Get CSS theme mods. |
|
| 63 | - * |
|
| 64 | - * @since 1.0.0 |
|
| 65 | - */ |
|
| 66 | - public function get_theme_mods() { |
|
| 67 | - $colors = parent::get_color_scheme(); |
|
| 68 | - |
|
| 69 | - $background_color = get_theme_mod( 'background_color', $colors['background_color'] ); |
|
| 70 | - |
|
| 71 | - if ( '#' !== substr( $background_color, 0, 1 ) ) { |
|
| 72 | - $background_color = '#' . $background_color; |
|
| 73 | - } |
|
| 74 | - |
|
| 75 | - return apply_filters( 'lsx_customizer_colours_body', array( |
|
| 76 | - 'background_color' => $background_color, |
|
| 77 | - 'body_line_color' => get_theme_mod( 'body_line_color', $colors['body_line_color'] ), |
|
| 78 | - 'body_text_heading_color' => get_theme_mod( 'body_text_heading_color', $colors['body_text_heading_color'] ), |
|
| 79 | - 'body_text_small_color' => get_theme_mod( 'body_text_small_color', $colors['body_text_small_color'] ), |
|
| 80 | - 'body_text_color' => get_theme_mod( 'body_text_color', $colors['body_text_color'] ), |
|
| 81 | - 'body_link_color' => get_theme_mod( 'body_link_color', $colors['body_link_color'] ), |
|
| 82 | - 'body_link_hover_color' => get_theme_mod( 'body_link_hover_color', $colors['body_link_hover_color'] ), |
|
| 83 | - 'body_section_full_background_color' => get_theme_mod( 'body_section_full_background_color', $colors['body_section_full_background_color'] ), |
|
| 84 | - 'body_section_full_text_color' => get_theme_mod( 'body_section_full_text_color', $colors['body_section_full_text_color'] ), |
|
| 85 | - 'body_section_full_link_color' => get_theme_mod( 'body_section_full_link_color', $colors['body_section_full_link_color'] ), |
|
| 86 | - 'body_section_full_link_hover_color' => get_theme_mod( 'body_section_full_link_hover_color', $colors['body_section_full_link_hover_color'] ), |
|
| 87 | - 'body_section_full_cta_background_color' => get_theme_mod( 'body_section_full_cta_background_color', $colors['body_section_full_cta_background_color'] ), |
|
| 88 | - 'body_section_full_cta_text_color' => get_theme_mod( 'body_section_full_cta_text_color', $colors['body_section_full_cta_text_color'] ), |
|
| 89 | - 'body_section_full_cta_link_color' => get_theme_mod( 'body_section_full_cta_link_color', $colors['body_section_full_cta_link_color'] ), |
|
| 90 | - 'body_section_full_cta_link_hover_color' => get_theme_mod( 'body_section_full_cta_link_hover_color', $colors['body_section_full_cta_link_hover_color'] ), |
|
| 91 | - 'primary_color' => get_theme_mod( 'primary_color', $colors['primary_color'] ), |
|
| 92 | - ) ); |
|
| 93 | - } |
|
| 94 | - |
|
| 95 | - /** |
|
| 96 | - * Returns CSS. |
|
| 97 | - * |
|
| 98 | - * @since 1.0.0 |
|
| 99 | - */ |
|
| 100 | - function get_css( $colors ) { |
|
| 101 | - global $customizer_colour_names; |
|
| 102 | - |
|
| 103 | - $colors_template = array(); |
|
| 104 | - |
|
| 105 | - foreach ( $customizer_colour_names as $key => $value ) { |
|
| 106 | - $colors_template[ $key ] = ''; |
|
| 107 | - } |
|
| 108 | - |
|
| 109 | - $colors = wp_parse_args( $colors, $colors_template ); |
|
| 110 | - |
|
| 111 | - if ( empty( $colors['background_color'] ) |
|
| 112 | - || empty( $colors['body_line_color'] ) |
|
| 113 | - || empty( $colors['body_text_heading_color'] ) |
|
| 114 | - || empty( $colors['body_text_color'] ) |
|
| 115 | - || empty( $colors['body_link_color'] ) |
|
| 116 | - || empty( $colors['body_link_hover_color'] ) |
|
| 117 | - || empty( $colors['body_text_small_color'] ) |
|
| 118 | - || empty( $colors['body_section_full_background_color'] ) |
|
| 119 | - || empty( $colors['body_section_full_text_color'] ) |
|
| 120 | - || empty( $colors['body_section_full_link_color'] ) |
|
| 121 | - || empty( $colors['body_section_full_link_hover_color'] ) |
|
| 122 | - || empty( $colors['body_section_full_cta_background_color'] ) |
|
| 123 | - || empty( $colors['body_section_full_cta_text_color'] ) |
|
| 124 | - || empty( $colors['body_section_full_cta_link_color'] ) |
|
| 125 | - || empty( $colors['body_section_full_cta_link_hover_color'] ) ) { |
|
| 126 | - return ''; |
|
| 127 | - } |
|
| 128 | - |
|
| 129 | - $css = ' |
|
| 4 | + /** |
|
| 5 | + * LSX Customizer Colour Body Class |
|
| 6 | + * |
|
| 7 | + * @package LSX Customizer |
|
| 8 | + * @author LightSpeed |
|
| 9 | + * @license GPL3 |
|
| 10 | + * @link |
|
| 11 | + * @copyright 2016 LightSpeed |
|
| 12 | + */ |
|
| 13 | + class LSX_Customizer_Colour_Body extends LSX_Customizer_Colour { |
|
| 14 | + |
|
| 15 | + /** |
|
| 16 | + * Constructor. |
|
| 17 | + * |
|
| 18 | + * @since 1.0.0 |
|
| 19 | + */ |
|
| 20 | + public function __construct() { |
|
| 21 | + add_action( 'after_switch_theme', array( $this, 'set_theme_mod' ) ); |
|
| 22 | + add_action( 'customize_save_after', array( $this, 'set_theme_mod' ) ); |
|
| 23 | + |
|
| 24 | + add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_css' ), 2999 ); |
|
| 25 | + } |
|
| 26 | + |
|
| 27 | + /** |
|
| 28 | + * Assign CSS to theme mod. |
|
| 29 | + * |
|
| 30 | + * @since 1.0.0 |
|
| 31 | + */ |
|
| 32 | + public function set_theme_mod() { |
|
| 33 | + $theme_mods = $this->get_theme_mods(); |
|
| 34 | + $styles = $this->get_css( $theme_mods ); |
|
| 35 | + |
|
| 36 | + set_theme_mod( 'lsx_customizer_colour__body_theme_mod', $styles ); |
|
| 37 | + } |
|
| 38 | + |
|
| 39 | + /** |
|
| 40 | + * Enqueues front-end CSS. |
|
| 41 | + * |
|
| 42 | + * @since 1.0.0 |
|
| 43 | + */ |
|
| 44 | + public function enqueue_css() { |
|
| 45 | + $styles_from_theme_mod = get_theme_mod( 'lsx_customizer_colour__body_theme_mod' ); |
|
| 46 | + |
|
| 47 | + if ( is_customize_preview() || false === $styles_from_theme_mod ) { |
|
| 48 | + $theme_mods = $this->get_theme_mods(); |
|
| 49 | + $styles = $this->get_css( $theme_mods ); |
|
| 50 | + |
|
| 51 | + if ( false === $styles_from_theme_mod ) { |
|
| 52 | + set_theme_mod( 'lsx_customizer_colour__body_theme_mod', $styles ); |
|
| 53 | + } |
|
| 54 | + } else { |
|
| 55 | + $styles = $styles_from_theme_mod; |
|
| 56 | + } |
|
| 57 | + |
|
| 58 | + wp_add_inline_style( 'lsx-customizer', $styles ); |
|
| 59 | + } |
|
| 60 | + |
|
| 61 | + /** |
|
| 62 | + * Get CSS theme mods. |
|
| 63 | + * |
|
| 64 | + * @since 1.0.0 |
|
| 65 | + */ |
|
| 66 | + public function get_theme_mods() { |
|
| 67 | + $colors = parent::get_color_scheme(); |
|
| 68 | + |
|
| 69 | + $background_color = get_theme_mod( 'background_color', $colors['background_color'] ); |
|
| 70 | + |
|
| 71 | + if ( '#' !== substr( $background_color, 0, 1 ) ) { |
|
| 72 | + $background_color = '#' . $background_color; |
|
| 73 | + } |
|
| 74 | + |
|
| 75 | + return apply_filters( 'lsx_customizer_colours_body', array( |
|
| 76 | + 'background_color' => $background_color, |
|
| 77 | + 'body_line_color' => get_theme_mod( 'body_line_color', $colors['body_line_color'] ), |
|
| 78 | + 'body_text_heading_color' => get_theme_mod( 'body_text_heading_color', $colors['body_text_heading_color'] ), |
|
| 79 | + 'body_text_small_color' => get_theme_mod( 'body_text_small_color', $colors['body_text_small_color'] ), |
|
| 80 | + 'body_text_color' => get_theme_mod( 'body_text_color', $colors['body_text_color'] ), |
|
| 81 | + 'body_link_color' => get_theme_mod( 'body_link_color', $colors['body_link_color'] ), |
|
| 82 | + 'body_link_hover_color' => get_theme_mod( 'body_link_hover_color', $colors['body_link_hover_color'] ), |
|
| 83 | + 'body_section_full_background_color' => get_theme_mod( 'body_section_full_background_color', $colors['body_section_full_background_color'] ), |
|
| 84 | + 'body_section_full_text_color' => get_theme_mod( 'body_section_full_text_color', $colors['body_section_full_text_color'] ), |
|
| 85 | + 'body_section_full_link_color' => get_theme_mod( 'body_section_full_link_color', $colors['body_section_full_link_color'] ), |
|
| 86 | + 'body_section_full_link_hover_color' => get_theme_mod( 'body_section_full_link_hover_color', $colors['body_section_full_link_hover_color'] ), |
|
| 87 | + 'body_section_full_cta_background_color' => get_theme_mod( 'body_section_full_cta_background_color', $colors['body_section_full_cta_background_color'] ), |
|
| 88 | + 'body_section_full_cta_text_color' => get_theme_mod( 'body_section_full_cta_text_color', $colors['body_section_full_cta_text_color'] ), |
|
| 89 | + 'body_section_full_cta_link_color' => get_theme_mod( 'body_section_full_cta_link_color', $colors['body_section_full_cta_link_color'] ), |
|
| 90 | + 'body_section_full_cta_link_hover_color' => get_theme_mod( 'body_section_full_cta_link_hover_color', $colors['body_section_full_cta_link_hover_color'] ), |
|
| 91 | + 'primary_color' => get_theme_mod( 'primary_color', $colors['primary_color'] ), |
|
| 92 | + ) ); |
|
| 93 | + } |
|
| 94 | + |
|
| 95 | + /** |
|
| 96 | + * Returns CSS. |
|
| 97 | + * |
|
| 98 | + * @since 1.0.0 |
|
| 99 | + */ |
|
| 100 | + function get_css( $colors ) { |
|
| 101 | + global $customizer_colour_names; |
|
| 102 | + |
|
| 103 | + $colors_template = array(); |
|
| 104 | + |
|
| 105 | + foreach ( $customizer_colour_names as $key => $value ) { |
|
| 106 | + $colors_template[ $key ] = ''; |
|
| 107 | + } |
|
| 108 | + |
|
| 109 | + $colors = wp_parse_args( $colors, $colors_template ); |
|
| 110 | + |
|
| 111 | + if ( empty( $colors['background_color'] ) |
|
| 112 | + || empty( $colors['body_line_color'] ) |
|
| 113 | + || empty( $colors['body_text_heading_color'] ) |
|
| 114 | + || empty( $colors['body_text_color'] ) |
|
| 115 | + || empty( $colors['body_link_color'] ) |
|
| 116 | + || empty( $colors['body_link_hover_color'] ) |
|
| 117 | + || empty( $colors['body_text_small_color'] ) |
|
| 118 | + || empty( $colors['body_section_full_background_color'] ) |
|
| 119 | + || empty( $colors['body_section_full_text_color'] ) |
|
| 120 | + || empty( $colors['body_section_full_link_color'] ) |
|
| 121 | + || empty( $colors['body_section_full_link_hover_color'] ) |
|
| 122 | + || empty( $colors['body_section_full_cta_background_color'] ) |
|
| 123 | + || empty( $colors['body_section_full_cta_text_color'] ) |
|
| 124 | + || empty( $colors['body_section_full_cta_link_color'] ) |
|
| 125 | + || empty( $colors['body_section_full_cta_link_hover_color'] ) ) { |
|
| 126 | + return ''; |
|
| 127 | + } |
|
| 128 | + |
|
| 129 | + $css = ' |
|
| 130 | 130 | @import "' . get_template_directory() . '/assets/css/scss/global/mixins/content"; |
| 131 | 131 | |
| 132 | 132 | /** |
@@ -152,12 +152,12 @@ discard block |
||
| 152 | 152 | ); |
| 153 | 153 | '; |
| 154 | 154 | |
| 155 | - $css = apply_filters( 'lsx_customizer_colour_selectors_body', $css, $colors ); |
|
| 156 | - $css = parent::scss_to_css( $css ); |
|
| 155 | + $css = apply_filters( 'lsx_customizer_colour_selectors_body', $css, $colors ); |
|
| 156 | + $css = parent::scss_to_css( $css ); |
|
| 157 | 157 | |
| 158 | - return $css; |
|
| 159 | - } |
|
| 158 | + return $css; |
|
| 159 | + } |
|
| 160 | 160 | |
| 161 | - } |
|
| 161 | + } |
|
| 162 | 162 | |
| 163 | 163 | } |
@@ -1,5 +1,5 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | -if ( ! class_exists( 'LSX_Customizer' ) ) { |
|
| 2 | +if ( ! class_exists('LSX_Customizer')) { |
|
| 3 | 3 | |
| 4 | 4 | /** |
| 5 | 5 | * LSX Customizer Main Class |
@@ -26,15 +26,15 @@ discard block |
||
| 26 | 26 | * @since 1.0.0 |
| 27 | 27 | */ |
| 28 | 28 | public function __construct() { |
| 29 | - require_once( LSX_CUSTOMIZER_PATH . 'classes/class-lsx-customizer-admin.php' ); |
|
| 30 | - require_once( LSX_CUSTOMIZER_PATH . 'classes/class-lsx-customizer-frontend.php' ); |
|
| 31 | - require_once( LSX_CUSTOMIZER_PATH . 'classes/class-lsx-customizer-core.php' ); |
|
| 32 | - require_once( LSX_CUSTOMIZER_PATH . 'classes/class-lsx-customizer-colour.php' ); |
|
| 33 | - require_once( LSX_CUSTOMIZER_PATH . 'classes/class-lsx-customizer-login.php' ); |
|
| 29 | + require_once(LSX_CUSTOMIZER_PATH . 'classes/class-lsx-customizer-admin.php'); |
|
| 30 | + require_once(LSX_CUSTOMIZER_PATH . 'classes/class-lsx-customizer-frontend.php'); |
|
| 31 | + require_once(LSX_CUSTOMIZER_PATH . 'classes/class-lsx-customizer-core.php'); |
|
| 32 | + require_once(LSX_CUSTOMIZER_PATH . 'classes/class-lsx-customizer-colour.php'); |
|
| 33 | + require_once(LSX_CUSTOMIZER_PATH . 'classes/class-lsx-customizer-login.php'); |
|
| 34 | 34 | |
| 35 | - add_action( 'plugins_loaded', array( $this, 'woocommerce' ) ); |
|
| 36 | - add_action( 'after_setup_theme', array( $this, 'wysiwyg_editor_control' ), 20 ); |
|
| 37 | - add_filter( 'login_headerurl', array( $this, 'custom_login_url' ) ); |
|
| 35 | + add_action('plugins_loaded', array($this, 'woocommerce')); |
|
| 36 | + add_action('after_setup_theme', array($this, 'wysiwyg_editor_control'), 20); |
|
| 37 | + add_filter('login_headerurl', array($this, 'custom_login_url')); |
|
| 38 | 38 | } |
| 39 | 39 | |
| 40 | 40 | /** |
@@ -43,8 +43,8 @@ discard block |
||
| 43 | 43 | * @since 1.1.1 |
| 44 | 44 | */ |
| 45 | 45 | public function woocommerce() { |
| 46 | - if ( class_exists( 'WooCommerce' ) ) { |
|
| 47 | - require_once( LSX_CUSTOMIZER_PATH . 'classes/class-lsx-customizer-woocommerce.php' ); |
|
| 46 | + if (class_exists('WooCommerce')) { |
|
| 47 | + require_once(LSX_CUSTOMIZER_PATH . 'classes/class-lsx-customizer-woocommerce.php'); |
|
| 48 | 48 | } |
| 49 | 49 | } |
| 50 | 50 | |
@@ -55,8 +55,8 @@ discard block |
||
| 55 | 55 | * @since 1.1.1 |
| 56 | 56 | */ |
| 57 | 57 | public function wysiwyg_editor_control() { |
| 58 | - if ( class_exists( 'WP_Customize_Control' ) ) { |
|
| 59 | - require_once( LSX_CUSTOMIZER_PATH . 'classes/class-lsx-customizer-wysiwyg-control.php' ); |
|
| 58 | + if (class_exists('WP_Customize_Control')) { |
|
| 59 | + require_once(LSX_CUSTOMIZER_PATH . 'classes/class-lsx-customizer-wysiwyg-control.php'); |
|
| 60 | 60 | } |
| 61 | 61 | } |
| 62 | 62 | |
@@ -65,8 +65,8 @@ discard block |
||
| 65 | 65 | * |
| 66 | 66 | * @since 1.0.0 |
| 67 | 67 | */ |
| 68 | - public function sanitize_checkbox( $input ) { |
|
| 69 | - return ( 1 === absint( $input ) ) ? 1 : 0; |
|
| 68 | + public function sanitize_checkbox($input) { |
|
| 69 | + return (1 === absint($input)) ? 1 : 0; |
|
| 70 | 70 | } |
| 71 | 71 | |
| 72 | 72 | /** |
@@ -74,8 +74,8 @@ discard block |
||
| 74 | 74 | * |
| 75 | 75 | * @since 1.1.1 |
| 76 | 76 | */ |
| 77 | - public function sanitize_select( $input ) { |
|
| 78 | - if ( is_string( $input ) || is_integer( $input ) || is_bool( $input ) ) { |
|
| 77 | + public function sanitize_select($input) { |
|
| 78 | + if (is_string($input) || is_integer($input) || is_bool($input)) { |
|
| 79 | 79 | return $input; |
| 80 | 80 | } else { |
| 81 | 81 | return ''; |
@@ -87,8 +87,8 @@ discard block |
||
| 87 | 87 | * |
| 88 | 88 | * @since 1.1.1 |
| 89 | 89 | */ |
| 90 | - public function sanitize_textarea( $input ) { |
|
| 91 | - return wp_kses_post( $input ); |
|
| 90 | + public function sanitize_textarea($input) { |
|
| 91 | + return wp_kses_post($input); |
|
| 92 | 92 | } |
| 93 | 93 | |
| 94 | 94 | function custom_login_url() { |
@@ -1,102 +1,102 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | if ( ! class_exists( 'LSX_Customizer' ) ) { |
| 3 | 3 | |
| 4 | - /** |
|
| 5 | - * LSX Customizer Main Class |
|
| 6 | - * |
|
| 7 | - * @package LSX Customizer |
|
| 8 | - * @author LightSpeed |
|
| 9 | - * @license GPL3 |
|
| 10 | - * @link |
|
| 11 | - * @copyright 2016 LightSpeed |
|
| 12 | - */ |
|
| 13 | - class LSX_Customizer { |
|
| 4 | + /** |
|
| 5 | + * LSX Customizer Main Class |
|
| 6 | + * |
|
| 7 | + * @package LSX Customizer |
|
| 8 | + * @author LightSpeed |
|
| 9 | + * @license GPL3 |
|
| 10 | + * @link |
|
| 11 | + * @copyright 2016 LightSpeed |
|
| 12 | + */ |
|
| 13 | + class LSX_Customizer { |
|
| 14 | 14 | |
| 15 | - /** |
|
| 16 | - * Plugin slug. |
|
| 17 | - * |
|
| 18 | - * @var string |
|
| 19 | - * @since 1.0.0 |
|
| 20 | - */ |
|
| 21 | - public $plugin_slug = 'lsx-customizer'; |
|
| 15 | + /** |
|
| 16 | + * Plugin slug. |
|
| 17 | + * |
|
| 18 | + * @var string |
|
| 19 | + * @since 1.0.0 |
|
| 20 | + */ |
|
| 21 | + public $plugin_slug = 'lsx-customizer'; |
|
| 22 | 22 | |
| 23 | - /** |
|
| 24 | - * Constructor. |
|
| 25 | - * |
|
| 26 | - * @since 1.0.0 |
|
| 27 | - */ |
|
| 28 | - public function __construct() { |
|
| 29 | - require_once( LSX_CUSTOMIZER_PATH . 'classes/class-lsx-customizer-admin.php' ); |
|
| 30 | - require_once( LSX_CUSTOMIZER_PATH . 'classes/class-lsx-customizer-frontend.php' ); |
|
| 31 | - require_once( LSX_CUSTOMIZER_PATH . 'classes/class-lsx-customizer-core.php' ); |
|
| 32 | - require_once( LSX_CUSTOMIZER_PATH . 'classes/class-lsx-customizer-colour.php' ); |
|
| 33 | - require_once( LSX_CUSTOMIZER_PATH . 'classes/class-lsx-customizer-login.php' ); |
|
| 23 | + /** |
|
| 24 | + * Constructor. |
|
| 25 | + * |
|
| 26 | + * @since 1.0.0 |
|
| 27 | + */ |
|
| 28 | + public function __construct() { |
|
| 29 | + require_once( LSX_CUSTOMIZER_PATH . 'classes/class-lsx-customizer-admin.php' ); |
|
| 30 | + require_once( LSX_CUSTOMIZER_PATH . 'classes/class-lsx-customizer-frontend.php' ); |
|
| 31 | + require_once( LSX_CUSTOMIZER_PATH . 'classes/class-lsx-customizer-core.php' ); |
|
| 32 | + require_once( LSX_CUSTOMIZER_PATH . 'classes/class-lsx-customizer-colour.php' ); |
|
| 33 | + require_once( LSX_CUSTOMIZER_PATH . 'classes/class-lsx-customizer-login.php' ); |
|
| 34 | 34 | |
| 35 | - add_action( 'plugins_loaded', array( $this, 'woocommerce' ) ); |
|
| 36 | - add_action( 'after_setup_theme', array( $this, 'wysiwyg_editor_control' ), 20 ); |
|
| 37 | - add_filter( 'login_headerurl', array( $this, 'custom_login_url' ) ); |
|
| 38 | - } |
|
| 35 | + add_action( 'plugins_loaded', array( $this, 'woocommerce' ) ); |
|
| 36 | + add_action( 'after_setup_theme', array( $this, 'wysiwyg_editor_control' ), 20 ); |
|
| 37 | + add_filter( 'login_headerurl', array( $this, 'custom_login_url' ) ); |
|
| 38 | + } |
|
| 39 | 39 | |
| 40 | - /** |
|
| 41 | - * Check if WooCommerce is installed to load the related file. |
|
| 42 | - * |
|
| 43 | - * @since 1.1.1 |
|
| 44 | - */ |
|
| 45 | - public function woocommerce() { |
|
| 46 | - if ( class_exists( 'WooCommerce' ) ) { |
|
| 47 | - require_once( LSX_CUSTOMIZER_PATH . 'classes/class-lsx-customizer-woocommerce.php' ); |
|
| 48 | - } |
|
| 49 | - } |
|
| 40 | + /** |
|
| 41 | + * Check if WooCommerce is installed to load the related file. |
|
| 42 | + * |
|
| 43 | + * @since 1.1.1 |
|
| 44 | + */ |
|
| 45 | + public function woocommerce() { |
|
| 46 | + if ( class_exists( 'WooCommerce' ) ) { |
|
| 47 | + require_once( LSX_CUSTOMIZER_PATH . 'classes/class-lsx-customizer-woocommerce.php' ); |
|
| 48 | + } |
|
| 49 | + } |
|
| 50 | 50 | |
| 51 | - /** |
|
| 52 | - * Customizer Controls and Settings. |
|
| 53 | - * |
|
| 54 | - * @param WP_Customize_Manager $wp_customize Theme Customizer object. |
|
| 55 | - * @since 1.1.1 |
|
| 56 | - */ |
|
| 57 | - public function wysiwyg_editor_control() { |
|
| 58 | - if ( class_exists( 'WP_Customize_Control' ) ) { |
|
| 59 | - require_once( LSX_CUSTOMIZER_PATH . 'classes/class-lsx-customizer-wysiwyg-control.php' ); |
|
| 60 | - } |
|
| 61 | - } |
|
| 51 | + /** |
|
| 52 | + * Customizer Controls and Settings. |
|
| 53 | + * |
|
| 54 | + * @param WP_Customize_Manager $wp_customize Theme Customizer object. |
|
| 55 | + * @since 1.1.1 |
|
| 56 | + */ |
|
| 57 | + public function wysiwyg_editor_control() { |
|
| 58 | + if ( class_exists( 'WP_Customize_Control' ) ) { |
|
| 59 | + require_once( LSX_CUSTOMIZER_PATH . 'classes/class-lsx-customizer-wysiwyg-control.php' ); |
|
| 60 | + } |
|
| 61 | + } |
|
| 62 | 62 | |
| 63 | - /** |
|
| 64 | - * Sanitize checkbox. |
|
| 65 | - * |
|
| 66 | - * @since 1.0.0 |
|
| 67 | - */ |
|
| 68 | - public function sanitize_checkbox( $input ) { |
|
| 69 | - return ( 1 === absint( $input ) ) ? 1 : 0; |
|
| 70 | - } |
|
| 63 | + /** |
|
| 64 | + * Sanitize checkbox. |
|
| 65 | + * |
|
| 66 | + * @since 1.0.0 |
|
| 67 | + */ |
|
| 68 | + public function sanitize_checkbox( $input ) { |
|
| 69 | + return ( 1 === absint( $input ) ) ? 1 : 0; |
|
| 70 | + } |
|
| 71 | 71 | |
| 72 | - /** |
|
| 73 | - * Sanitize select. |
|
| 74 | - * |
|
| 75 | - * @since 1.1.1 |
|
| 76 | - */ |
|
| 77 | - public function sanitize_select( $input ) { |
|
| 78 | - if ( is_string( $input ) || is_integer( $input ) || is_bool( $input ) ) { |
|
| 79 | - return $input; |
|
| 80 | - } else { |
|
| 81 | - return ''; |
|
| 82 | - } |
|
| 83 | - } |
|
| 72 | + /** |
|
| 73 | + * Sanitize select. |
|
| 74 | + * |
|
| 75 | + * @since 1.1.1 |
|
| 76 | + */ |
|
| 77 | + public function sanitize_select( $input ) { |
|
| 78 | + if ( is_string( $input ) || is_integer( $input ) || is_bool( $input ) ) { |
|
| 79 | + return $input; |
|
| 80 | + } else { |
|
| 81 | + return ''; |
|
| 82 | + } |
|
| 83 | + } |
|
| 84 | 84 | |
| 85 | - /** |
|
| 86 | - * Sanitize textarea. |
|
| 87 | - * |
|
| 88 | - * @since 1.1.1 |
|
| 89 | - */ |
|
| 90 | - public function sanitize_textarea( $input ) { |
|
| 91 | - return wp_kses_post( $input ); |
|
| 92 | - } |
|
| 85 | + /** |
|
| 86 | + * Sanitize textarea. |
|
| 87 | + * |
|
| 88 | + * @since 1.1.1 |
|
| 89 | + */ |
|
| 90 | + public function sanitize_textarea( $input ) { |
|
| 91 | + return wp_kses_post( $input ); |
|
| 92 | + } |
|
| 93 | 93 | |
| 94 | - function custom_login_url() { |
|
| 95 | - return home_url(); |
|
| 96 | - } |
|
| 94 | + function custom_login_url() { |
|
| 95 | + return home_url(); |
|
| 96 | + } |
|
| 97 | 97 | |
| 98 | - } |
|
| 98 | + } |
|
| 99 | 99 | |
| 100 | - new LSX_Customizer(); |
|
| 100 | + new LSX_Customizer(); |
|
| 101 | 101 | |
| 102 | 102 | } |
@@ -1,5 +1,5 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | -if ( ! class_exists( 'LSX_Customizer_Colour_Banner' ) ) { |
|
| 2 | +if ( ! class_exists('LSX_Customizer_Colour_Banner')) { |
|
| 3 | 3 | |
| 4 | 4 | /** |
| 5 | 5 | * LSX Customizer Colour Banner Class |
@@ -18,10 +18,10 @@ discard block |
||
| 18 | 18 | * @since 1.0.0 |
| 19 | 19 | */ |
| 20 | 20 | public function __construct() { |
| 21 | - add_action( 'after_switch_theme', array( $this, 'set_theme_mod' ) ); |
|
| 22 | - add_action( 'customize_save_after', array( $this, 'set_theme_mod' ) ); |
|
| 21 | + add_action('after_switch_theme', array($this, 'set_theme_mod')); |
|
| 22 | + add_action('customize_save_after', array($this, 'set_theme_mod')); |
|
| 23 | 23 | |
| 24 | - add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_css' ), 2999 ); |
|
| 24 | + add_action('wp_enqueue_scripts', array($this, 'enqueue_css'), 2999); |
|
| 25 | 25 | } |
| 26 | 26 | |
| 27 | 27 | /** |
@@ -31,9 +31,9 @@ discard block |
||
| 31 | 31 | */ |
| 32 | 32 | public function set_theme_mod() { |
| 33 | 33 | $theme_mods = $this->get_theme_mods(); |
| 34 | - $styles = $this->get_css( $theme_mods ); |
|
| 34 | + $styles = $this->get_css($theme_mods); |
|
| 35 | 35 | |
| 36 | - set_theme_mod( 'lsx_customizer_colour__banner_theme_mod', $styles ); |
|
| 36 | + set_theme_mod('lsx_customizer_colour__banner_theme_mod', $styles); |
|
| 37 | 37 | } |
| 38 | 38 | |
| 39 | 39 | /** |
@@ -42,20 +42,20 @@ discard block |
||
| 42 | 42 | * @since 1.0.0 |
| 43 | 43 | */ |
| 44 | 44 | public function enqueue_css() { |
| 45 | - $styles_from_theme_mod = get_theme_mod( 'lsx_customizer_colour__banner_theme_mod' ); |
|
| 45 | + $styles_from_theme_mod = get_theme_mod('lsx_customizer_colour__banner_theme_mod'); |
|
| 46 | 46 | |
| 47 | - if ( is_customize_preview() || false === $styles_from_theme_mod ) { |
|
| 47 | + if (is_customize_preview() || false === $styles_from_theme_mod) { |
|
| 48 | 48 | $theme_mods = $this->get_theme_mods(); |
| 49 | - $styles = $this->get_css( $theme_mods ); |
|
| 49 | + $styles = $this->get_css($theme_mods); |
|
| 50 | 50 | |
| 51 | - if ( false === $styles_from_theme_mod ) { |
|
| 52 | - set_theme_mod( 'lsx_customizer_colour__banner_theme_mod', $styles ); |
|
| 51 | + if (false === $styles_from_theme_mod) { |
|
| 52 | + set_theme_mod('lsx_customizer_colour__banner_theme_mod', $styles); |
|
| 53 | 53 | } |
| 54 | 54 | } else { |
| 55 | 55 | $styles = $styles_from_theme_mod; |
| 56 | 56 | } |
| 57 | 57 | |
| 58 | - wp_add_inline_style( 'lsx-customizer', $styles ); |
|
| 58 | + wp_add_inline_style('lsx-customizer', $styles); |
|
| 59 | 59 | } |
| 60 | 60 | |
| 61 | 61 | /** |
@@ -66,14 +66,14 @@ discard block |
||
| 66 | 66 | public function get_theme_mods() { |
| 67 | 67 | $colors = parent::get_color_scheme(); |
| 68 | 68 | |
| 69 | - return apply_filters( 'lsx_customizer_colours_banner', array( |
|
| 70 | - 'banner_background_color' => get_theme_mod( 'banner_background_color', $colors['banner_background_color'] ), |
|
| 71 | - 'banner_text_color' => get_theme_mod( 'banner_text_color', $colors['banner_text_color'] ), |
|
| 72 | - 'banner_text_image_color' => get_theme_mod( 'banner_text_image_color', $colors['banner_text_image_color'] ), |
|
| 73 | - 'banner_breadcrumb_background_color' => get_theme_mod( 'banner_breadcrumb_background_color', $colors['banner_breadcrumb_background_color'] ), |
|
| 74 | - 'banner_breadcrumb_text_color' => get_theme_mod( 'banner_breadcrumb_text_color', $colors['banner_breadcrumb_text_color'] ), |
|
| 75 | - 'banner_breadcrumb_text_selected_color' => get_theme_mod( 'banner_breadcrumb_text_selected_color', $colors['banner_breadcrumb_text_selected_color'] ), |
|
| 76 | - ) ); |
|
| 69 | + return apply_filters('lsx_customizer_colours_banner', array( |
|
| 70 | + 'banner_background_color' => get_theme_mod('banner_background_color', $colors['banner_background_color']), |
|
| 71 | + 'banner_text_color' => get_theme_mod('banner_text_color', $colors['banner_text_color']), |
|
| 72 | + 'banner_text_image_color' => get_theme_mod('banner_text_image_color', $colors['banner_text_image_color']), |
|
| 73 | + 'banner_breadcrumb_background_color' => get_theme_mod('banner_breadcrumb_background_color', $colors['banner_breadcrumb_background_color']), |
|
| 74 | + 'banner_breadcrumb_text_color' => get_theme_mod('banner_breadcrumb_text_color', $colors['banner_breadcrumb_text_color']), |
|
| 75 | + 'banner_breadcrumb_text_selected_color' => get_theme_mod('banner_breadcrumb_text_selected_color', $colors['banner_breadcrumb_text_selected_color']), |
|
| 76 | + )); |
|
| 77 | 77 | } |
| 78 | 78 | |
| 79 | 79 | /** |
@@ -81,23 +81,23 @@ discard block |
||
| 81 | 81 | * |
| 82 | 82 | * @since 1.0.0 |
| 83 | 83 | */ |
| 84 | - function get_css( $colors ) { |
|
| 84 | + function get_css($colors) { |
|
| 85 | 85 | global $customizer_colour_names; |
| 86 | 86 | |
| 87 | 87 | $colors_template = array(); |
| 88 | 88 | |
| 89 | - foreach ( $customizer_colour_names as $key => $value ) { |
|
| 90 | - $colors_template[ $key ] = ''; |
|
| 89 | + foreach ($customizer_colour_names as $key => $value) { |
|
| 90 | + $colors_template[$key] = ''; |
|
| 91 | 91 | } |
| 92 | 92 | |
| 93 | - $colors = wp_parse_args( $colors, $colors_template ); |
|
| 93 | + $colors = wp_parse_args($colors, $colors_template); |
|
| 94 | 94 | |
| 95 | - if ( empty( $colors['banner_background_color'] ) |
|
| 96 | - || empty( $colors['banner_text_color'] ) |
|
| 97 | - || empty( $colors['banner_text_image_color'] ) |
|
| 98 | - || empty( $colors['banner_breadcrumb_background_color'] ) |
|
| 99 | - || empty( $colors['banner_breadcrumb_text_color'] ) |
|
| 100 | - || empty( $colors['banner_breadcrumb_text_selected_color'] ) ) { |
|
| 95 | + if (empty($colors['banner_background_color']) |
|
| 96 | + || empty($colors['banner_text_color']) |
|
| 97 | + || empty($colors['banner_text_image_color']) |
|
| 98 | + || empty($colors['banner_breadcrumb_background_color']) |
|
| 99 | + || empty($colors['banner_breadcrumb_text_color']) |
|
| 100 | + || empty($colors['banner_breadcrumb_text_selected_color'])) { |
|
| 101 | 101 | return ''; |
| 102 | 102 | } |
| 103 | 103 | |
@@ -117,8 +117,8 @@ discard block |
||
| 117 | 117 | ); |
| 118 | 118 | '; |
| 119 | 119 | |
| 120 | - $css = apply_filters( 'lsx_customizer_colour_selectors_banner', $css, $colors ); |
|
| 121 | - $css = parent::scss_to_css( $css ); |
|
| 120 | + $css = apply_filters('lsx_customizer_colour_selectors_banner', $css, $colors); |
|
| 121 | + $css = parent::scss_to_css($css); |
|
| 122 | 122 | |
| 123 | 123 | return $css; |
| 124 | 124 | } |
@@ -1,107 +1,107 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | if ( ! class_exists( 'LSX_Customizer_Colour_Banner' ) ) { |
| 3 | 3 | |
| 4 | - /** |
|
| 5 | - * LSX Customizer Colour Banner Class |
|
| 6 | - * |
|
| 7 | - * @package LSX Customizer |
|
| 8 | - * @author LightSpeed |
|
| 9 | - * @license GPL3 |
|
| 10 | - * @link |
|
| 11 | - * @copyright 2016 LightSpeed |
|
| 12 | - */ |
|
| 13 | - class LSX_Customizer_Colour_Banner extends LSX_Customizer_Colour { |
|
| 14 | - |
|
| 15 | - /** |
|
| 16 | - * Constructor. |
|
| 17 | - * |
|
| 18 | - * @since 1.0.0 |
|
| 19 | - */ |
|
| 20 | - public function __construct() { |
|
| 21 | - add_action( 'after_switch_theme', array( $this, 'set_theme_mod' ) ); |
|
| 22 | - add_action( 'customize_save_after', array( $this, 'set_theme_mod' ) ); |
|
| 23 | - |
|
| 24 | - add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_css' ), 2999 ); |
|
| 25 | - } |
|
| 26 | - |
|
| 27 | - /** |
|
| 28 | - * Assign CSS to theme mod. |
|
| 29 | - * |
|
| 30 | - * @since 1.0.0 |
|
| 31 | - */ |
|
| 32 | - public function set_theme_mod() { |
|
| 33 | - $theme_mods = $this->get_theme_mods(); |
|
| 34 | - $styles = $this->get_css( $theme_mods ); |
|
| 35 | - |
|
| 36 | - set_theme_mod( 'lsx_customizer_colour__banner_theme_mod', $styles ); |
|
| 37 | - } |
|
| 38 | - |
|
| 39 | - /** |
|
| 40 | - * Enqueues front-end CSS. |
|
| 41 | - * |
|
| 42 | - * @since 1.0.0 |
|
| 43 | - */ |
|
| 44 | - public function enqueue_css() { |
|
| 45 | - $styles_from_theme_mod = get_theme_mod( 'lsx_customizer_colour__banner_theme_mod' ); |
|
| 46 | - |
|
| 47 | - if ( is_customize_preview() || false === $styles_from_theme_mod ) { |
|
| 48 | - $theme_mods = $this->get_theme_mods(); |
|
| 49 | - $styles = $this->get_css( $theme_mods ); |
|
| 50 | - |
|
| 51 | - if ( false === $styles_from_theme_mod ) { |
|
| 52 | - set_theme_mod( 'lsx_customizer_colour__banner_theme_mod', $styles ); |
|
| 53 | - } |
|
| 54 | - } else { |
|
| 55 | - $styles = $styles_from_theme_mod; |
|
| 56 | - } |
|
| 57 | - |
|
| 58 | - wp_add_inline_style( 'lsx-customizer', $styles ); |
|
| 59 | - } |
|
| 60 | - |
|
| 61 | - /** |
|
| 62 | - * Get CSS theme mods. |
|
| 63 | - * |
|
| 64 | - * @since 1.0.0 |
|
| 65 | - */ |
|
| 66 | - public function get_theme_mods() { |
|
| 67 | - $colors = parent::get_color_scheme(); |
|
| 68 | - |
|
| 69 | - return apply_filters( 'lsx_customizer_colours_banner', array( |
|
| 70 | - 'banner_background_color' => get_theme_mod( 'banner_background_color', $colors['banner_background_color'] ), |
|
| 71 | - 'banner_text_color' => get_theme_mod( 'banner_text_color', $colors['banner_text_color'] ), |
|
| 72 | - 'banner_text_image_color' => get_theme_mod( 'banner_text_image_color', $colors['banner_text_image_color'] ), |
|
| 73 | - 'banner_breadcrumb_background_color' => get_theme_mod( 'banner_breadcrumb_background_color', $colors['banner_breadcrumb_background_color'] ), |
|
| 74 | - 'banner_breadcrumb_text_color' => get_theme_mod( 'banner_breadcrumb_text_color', $colors['banner_breadcrumb_text_color'] ), |
|
| 75 | - 'banner_breadcrumb_text_selected_color' => get_theme_mod( 'banner_breadcrumb_text_selected_color', $colors['banner_breadcrumb_text_selected_color'] ), |
|
| 76 | - ) ); |
|
| 77 | - } |
|
| 78 | - |
|
| 79 | - /** |
|
| 80 | - * Returns CSS. |
|
| 81 | - * |
|
| 82 | - * @since 1.0.0 |
|
| 83 | - */ |
|
| 84 | - function get_css( $colors ) { |
|
| 85 | - global $customizer_colour_names; |
|
| 86 | - |
|
| 87 | - $colors_template = array(); |
|
| 88 | - |
|
| 89 | - foreach ( $customizer_colour_names as $key => $value ) { |
|
| 90 | - $colors_template[ $key ] = ''; |
|
| 91 | - } |
|
| 92 | - |
|
| 93 | - $colors = wp_parse_args( $colors, $colors_template ); |
|
| 94 | - |
|
| 95 | - if ( empty( $colors['banner_background_color'] ) |
|
| 96 | - || empty( $colors['banner_text_color'] ) |
|
| 97 | - || empty( $colors['banner_text_image_color'] ) |
|
| 98 | - || empty( $colors['banner_breadcrumb_background_color'] ) |
|
| 99 | - || empty( $colors['banner_breadcrumb_text_color'] ) |
|
| 100 | - || empty( $colors['banner_breadcrumb_text_selected_color'] ) ) { |
|
| 101 | - return ''; |
|
| 102 | - } |
|
| 103 | - |
|
| 104 | - $css = ' |
|
| 4 | + /** |
|
| 5 | + * LSX Customizer Colour Banner Class |
|
| 6 | + * |
|
| 7 | + * @package LSX Customizer |
|
| 8 | + * @author LightSpeed |
|
| 9 | + * @license GPL3 |
|
| 10 | + * @link |
|
| 11 | + * @copyright 2016 LightSpeed |
|
| 12 | + */ |
|
| 13 | + class LSX_Customizer_Colour_Banner extends LSX_Customizer_Colour { |
|
| 14 | + |
|
| 15 | + /** |
|
| 16 | + * Constructor. |
|
| 17 | + * |
|
| 18 | + * @since 1.0.0 |
|
| 19 | + */ |
|
| 20 | + public function __construct() { |
|
| 21 | + add_action( 'after_switch_theme', array( $this, 'set_theme_mod' ) ); |
|
| 22 | + add_action( 'customize_save_after', array( $this, 'set_theme_mod' ) ); |
|
| 23 | + |
|
| 24 | + add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_css' ), 2999 ); |
|
| 25 | + } |
|
| 26 | + |
|
| 27 | + /** |
|
| 28 | + * Assign CSS to theme mod. |
|
| 29 | + * |
|
| 30 | + * @since 1.0.0 |
|
| 31 | + */ |
|
| 32 | + public function set_theme_mod() { |
|
| 33 | + $theme_mods = $this->get_theme_mods(); |
|
| 34 | + $styles = $this->get_css( $theme_mods ); |
|
| 35 | + |
|
| 36 | + set_theme_mod( 'lsx_customizer_colour__banner_theme_mod', $styles ); |
|
| 37 | + } |
|
| 38 | + |
|
| 39 | + /** |
|
| 40 | + * Enqueues front-end CSS. |
|
| 41 | + * |
|
| 42 | + * @since 1.0.0 |
|
| 43 | + */ |
|
| 44 | + public function enqueue_css() { |
|
| 45 | + $styles_from_theme_mod = get_theme_mod( 'lsx_customizer_colour__banner_theme_mod' ); |
|
| 46 | + |
|
| 47 | + if ( is_customize_preview() || false === $styles_from_theme_mod ) { |
|
| 48 | + $theme_mods = $this->get_theme_mods(); |
|
| 49 | + $styles = $this->get_css( $theme_mods ); |
|
| 50 | + |
|
| 51 | + if ( false === $styles_from_theme_mod ) { |
|
| 52 | + set_theme_mod( 'lsx_customizer_colour__banner_theme_mod', $styles ); |
|
| 53 | + } |
|
| 54 | + } else { |
|
| 55 | + $styles = $styles_from_theme_mod; |
|
| 56 | + } |
|
| 57 | + |
|
| 58 | + wp_add_inline_style( 'lsx-customizer', $styles ); |
|
| 59 | + } |
|
| 60 | + |
|
| 61 | + /** |
|
| 62 | + * Get CSS theme mods. |
|
| 63 | + * |
|
| 64 | + * @since 1.0.0 |
|
| 65 | + */ |
|
| 66 | + public function get_theme_mods() { |
|
| 67 | + $colors = parent::get_color_scheme(); |
|
| 68 | + |
|
| 69 | + return apply_filters( 'lsx_customizer_colours_banner', array( |
|
| 70 | + 'banner_background_color' => get_theme_mod( 'banner_background_color', $colors['banner_background_color'] ), |
|
| 71 | + 'banner_text_color' => get_theme_mod( 'banner_text_color', $colors['banner_text_color'] ), |
|
| 72 | + 'banner_text_image_color' => get_theme_mod( 'banner_text_image_color', $colors['banner_text_image_color'] ), |
|
| 73 | + 'banner_breadcrumb_background_color' => get_theme_mod( 'banner_breadcrumb_background_color', $colors['banner_breadcrumb_background_color'] ), |
|
| 74 | + 'banner_breadcrumb_text_color' => get_theme_mod( 'banner_breadcrumb_text_color', $colors['banner_breadcrumb_text_color'] ), |
|
| 75 | + 'banner_breadcrumb_text_selected_color' => get_theme_mod( 'banner_breadcrumb_text_selected_color', $colors['banner_breadcrumb_text_selected_color'] ), |
|
| 76 | + ) ); |
|
| 77 | + } |
|
| 78 | + |
|
| 79 | + /** |
|
| 80 | + * Returns CSS. |
|
| 81 | + * |
|
| 82 | + * @since 1.0.0 |
|
| 83 | + */ |
|
| 84 | + function get_css( $colors ) { |
|
| 85 | + global $customizer_colour_names; |
|
| 86 | + |
|
| 87 | + $colors_template = array(); |
|
| 88 | + |
|
| 89 | + foreach ( $customizer_colour_names as $key => $value ) { |
|
| 90 | + $colors_template[ $key ] = ''; |
|
| 91 | + } |
|
| 92 | + |
|
| 93 | + $colors = wp_parse_args( $colors, $colors_template ); |
|
| 94 | + |
|
| 95 | + if ( empty( $colors['banner_background_color'] ) |
|
| 96 | + || empty( $colors['banner_text_color'] ) |
|
| 97 | + || empty( $colors['banner_text_image_color'] ) |
|
| 98 | + || empty( $colors['banner_breadcrumb_background_color'] ) |
|
| 99 | + || empty( $colors['banner_breadcrumb_text_color'] ) |
|
| 100 | + || empty( $colors['banner_breadcrumb_text_selected_color'] ) ) { |
|
| 101 | + return ''; |
|
| 102 | + } |
|
| 103 | + |
|
| 104 | + $css = ' |
|
| 105 | 105 | @import "' . get_template_directory() . '/assets/css/scss/global/mixins/banner"; |
| 106 | 106 | |
| 107 | 107 | /** |
@@ -117,12 +117,12 @@ discard block |
||
| 117 | 117 | ); |
| 118 | 118 | '; |
| 119 | 119 | |
| 120 | - $css = apply_filters( 'lsx_customizer_colour_selectors_banner', $css, $colors ); |
|
| 121 | - $css = parent::scss_to_css( $css ); |
|
| 120 | + $css = apply_filters( 'lsx_customizer_colour_selectors_banner', $css, $colors ); |
|
| 121 | + $css = parent::scss_to_css( $css ); |
|
| 122 | 122 | |
| 123 | - return $css; |
|
| 124 | - } |
|
| 123 | + return $css; |
|
| 124 | + } |
|
| 125 | 125 | |
| 126 | - } |
|
| 126 | + } |
|
| 127 | 127 | |
| 128 | 128 | } |
@@ -1,5 +1,5 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | -if ( ! class_exists( 'LSX_Customizer_Colour_Button' ) ) { |
|
| 2 | +if ( ! class_exists('LSX_Customizer_Colour_Button')) { |
|
| 3 | 3 | |
| 4 | 4 | /** |
| 5 | 5 | * LSX Customizer Colour Button Class |
@@ -18,10 +18,10 @@ discard block |
||
| 18 | 18 | * @since 1.0.0 |
| 19 | 19 | */ |
| 20 | 20 | public function __construct() { |
| 21 | - add_action( 'after_switch_theme', array( $this, 'set_theme_mod' ) ); |
|
| 22 | - add_action( 'customize_save_after', array( $this, 'set_theme_mod' ) ); |
|
| 21 | + add_action('after_switch_theme', array($this, 'set_theme_mod')); |
|
| 22 | + add_action('customize_save_after', array($this, 'set_theme_mod')); |
|
| 23 | 23 | |
| 24 | - add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_css' ), 2999 ); |
|
| 24 | + add_action('wp_enqueue_scripts', array($this, 'enqueue_css'), 2999); |
|
| 25 | 25 | } |
| 26 | 26 | |
| 27 | 27 | /** |
@@ -31,9 +31,9 @@ discard block |
||
| 31 | 31 | */ |
| 32 | 32 | public function set_theme_mod() { |
| 33 | 33 | $theme_mods = $this->get_theme_mods(); |
| 34 | - $styles = $this->get_css( $theme_mods ); |
|
| 34 | + $styles = $this->get_css($theme_mods); |
|
| 35 | 35 | |
| 36 | - set_theme_mod( 'lsx_customizer_colour__button_theme_mod', $styles ); |
|
| 36 | + set_theme_mod('lsx_customizer_colour__button_theme_mod', $styles); |
|
| 37 | 37 | } |
| 38 | 38 | |
| 39 | 39 | /** |
@@ -42,20 +42,20 @@ discard block |
||
| 42 | 42 | * @since 1.0.0 |
| 43 | 43 | */ |
| 44 | 44 | public function enqueue_css() { |
| 45 | - $styles_from_theme_mod = get_theme_mod( 'lsx_customizer_colour__button_theme_mod' ); |
|
| 45 | + $styles_from_theme_mod = get_theme_mod('lsx_customizer_colour__button_theme_mod'); |
|
| 46 | 46 | |
| 47 | - if ( is_customize_preview() || false === $styles_from_theme_mod ) { |
|
| 47 | + if (is_customize_preview() || false === $styles_from_theme_mod) { |
|
| 48 | 48 | $theme_mods = $this->get_theme_mods(); |
| 49 | - $styles = $this->get_css( $theme_mods ); |
|
| 49 | + $styles = $this->get_css($theme_mods); |
|
| 50 | 50 | |
| 51 | - if ( false === $styles_from_theme_mod ) { |
|
| 52 | - set_theme_mod( 'lsx_customizer_colour__button_theme_mod', $styles ); |
|
| 51 | + if (false === $styles_from_theme_mod) { |
|
| 52 | + set_theme_mod('lsx_customizer_colour__button_theme_mod', $styles); |
|
| 53 | 53 | } |
| 54 | 54 | } else { |
| 55 | 55 | $styles = $styles_from_theme_mod; |
| 56 | 56 | } |
| 57 | 57 | |
| 58 | - wp_add_inline_style( 'lsx-customizer', $styles ); |
|
| 58 | + wp_add_inline_style('lsx-customizer', $styles); |
|
| 59 | 59 | } |
| 60 | 60 | |
| 61 | 61 | /** |
@@ -66,13 +66,13 @@ discard block |
||
| 66 | 66 | public function get_theme_mods() { |
| 67 | 67 | $colors = parent::get_color_scheme(); |
| 68 | 68 | |
| 69 | - return apply_filters( 'lsx_customizer_colours_button', array( |
|
| 70 | - 'button_background_color' => get_theme_mod( 'button_background_color', $colors['button_background_color'] ), |
|
| 71 | - 'button_background_hover_color' => get_theme_mod( 'button_background_hover_color', $colors['button_background_hover_color'] ), |
|
| 72 | - 'button_text_color' => get_theme_mod( 'button_text_color', $colors['button_text_color'] ), |
|
| 73 | - 'button_text_color_hover' => get_theme_mod( 'button_text_color_hover', $colors['button_text_color_hover'] ), |
|
| 74 | - 'button_shadow' => get_theme_mod( 'button_shadow', $colors['button_shadow'] ), |
|
| 75 | - ) ); |
|
| 69 | + return apply_filters('lsx_customizer_colours_button', array( |
|
| 70 | + 'button_background_color' => get_theme_mod('button_background_color', $colors['button_background_color']), |
|
| 71 | + 'button_background_hover_color' => get_theme_mod('button_background_hover_color', $colors['button_background_hover_color']), |
|
| 72 | + 'button_text_color' => get_theme_mod('button_text_color', $colors['button_text_color']), |
|
| 73 | + 'button_text_color_hover' => get_theme_mod('button_text_color_hover', $colors['button_text_color_hover']), |
|
| 74 | + 'button_shadow' => get_theme_mod('button_shadow', $colors['button_shadow']), |
|
| 75 | + )); |
|
| 76 | 76 | } |
| 77 | 77 | |
| 78 | 78 | /** |
@@ -80,22 +80,22 @@ discard block |
||
| 80 | 80 | * |
| 81 | 81 | * @since 1.0.0 |
| 82 | 82 | */ |
| 83 | - function get_css( $colors ) { |
|
| 83 | + function get_css($colors) { |
|
| 84 | 84 | global $customizer_colour_names; |
| 85 | 85 | |
| 86 | 86 | $colors_template = array(); |
| 87 | 87 | |
| 88 | - foreach ( $customizer_colour_names as $key => $value ) { |
|
| 89 | - $colors_template[ $key ] = ''; |
|
| 88 | + foreach ($customizer_colour_names as $key => $value) { |
|
| 89 | + $colors_template[$key] = ''; |
|
| 90 | 90 | } |
| 91 | 91 | |
| 92 | - $colors = wp_parse_args( $colors, $colors_template ); |
|
| 92 | + $colors = wp_parse_args($colors, $colors_template); |
|
| 93 | 93 | |
| 94 | - if ( empty( $colors['button_text_color'] ) |
|
| 95 | - || empty( $colors['button_text_color_hover'] ) |
|
| 96 | - || empty( $colors['button_background_color'] ) |
|
| 97 | - || empty( $colors['button_background_hover_color'] ) |
|
| 98 | - || empty( $colors['button_shadow'] ) ) { |
|
| 94 | + if (empty($colors['button_text_color']) |
|
| 95 | + || empty($colors['button_text_color_hover']) |
|
| 96 | + || empty($colors['button_background_color']) |
|
| 97 | + || empty($colors['button_background_hover_color']) |
|
| 98 | + || empty($colors['button_shadow'])) { |
|
| 99 | 99 | return ''; |
| 100 | 100 | } |
| 101 | 101 | |
@@ -114,8 +114,8 @@ discard block |
||
| 114 | 114 | ); |
| 115 | 115 | '; |
| 116 | 116 | |
| 117 | - $css = apply_filters( 'lsx_customizer_colour_selectors_button', $css, $colors ); |
|
| 118 | - $css = parent::scss_to_css( $css ); |
|
| 117 | + $css = apply_filters('lsx_customizer_colour_selectors_button', $css, $colors); |
|
| 118 | + $css = parent::scss_to_css($css); |
|
| 119 | 119 | |
| 120 | 120 | return $css; |
| 121 | 121 | } |
@@ -1,105 +1,105 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | if ( ! class_exists( 'LSX_Customizer_Colour_Button' ) ) { |
| 3 | 3 | |
| 4 | - /** |
|
| 5 | - * LSX Customizer Colour Button Class |
|
| 6 | - * |
|
| 7 | - * @package LSX Customizer |
|
| 8 | - * @author LightSpeed |
|
| 9 | - * @license GPL3 |
|
| 10 | - * @link |
|
| 11 | - * @copyright 2016 LightSpeed |
|
| 12 | - */ |
|
| 13 | - class LSX_Customizer_Colour_Button extends LSX_Customizer_Colour { |
|
| 14 | - |
|
| 15 | - /** |
|
| 16 | - * Constructor. |
|
| 17 | - * |
|
| 18 | - * @since 1.0.0 |
|
| 19 | - */ |
|
| 20 | - public function __construct() { |
|
| 21 | - add_action( 'after_switch_theme', array( $this, 'set_theme_mod' ) ); |
|
| 22 | - add_action( 'customize_save_after', array( $this, 'set_theme_mod' ) ); |
|
| 23 | - |
|
| 24 | - add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_css' ), 2999 ); |
|
| 25 | - } |
|
| 26 | - |
|
| 27 | - /** |
|
| 28 | - * Assign CSS to theme mod. |
|
| 29 | - * |
|
| 30 | - * @since 1.0.0 |
|
| 31 | - */ |
|
| 32 | - public function set_theme_mod() { |
|
| 33 | - $theme_mods = $this->get_theme_mods(); |
|
| 34 | - $styles = $this->get_css( $theme_mods ); |
|
| 35 | - |
|
| 36 | - set_theme_mod( 'lsx_customizer_colour__button_theme_mod', $styles ); |
|
| 37 | - } |
|
| 38 | - |
|
| 39 | - /** |
|
| 40 | - * Enqueues front-end CSS. |
|
| 41 | - * |
|
| 42 | - * @since 1.0.0 |
|
| 43 | - */ |
|
| 44 | - public function enqueue_css() { |
|
| 45 | - $styles_from_theme_mod = get_theme_mod( 'lsx_customizer_colour__button_theme_mod' ); |
|
| 46 | - |
|
| 47 | - if ( is_customize_preview() || false === $styles_from_theme_mod ) { |
|
| 48 | - $theme_mods = $this->get_theme_mods(); |
|
| 49 | - $styles = $this->get_css( $theme_mods ); |
|
| 50 | - |
|
| 51 | - if ( false === $styles_from_theme_mod ) { |
|
| 52 | - set_theme_mod( 'lsx_customizer_colour__button_theme_mod', $styles ); |
|
| 53 | - } |
|
| 54 | - } else { |
|
| 55 | - $styles = $styles_from_theme_mod; |
|
| 56 | - } |
|
| 57 | - |
|
| 58 | - wp_add_inline_style( 'lsx-customizer', $styles ); |
|
| 59 | - } |
|
| 60 | - |
|
| 61 | - /** |
|
| 62 | - * Get CSS theme mods. |
|
| 63 | - * |
|
| 64 | - * @since 1.0.0 |
|
| 65 | - */ |
|
| 66 | - public function get_theme_mods() { |
|
| 67 | - $colors = parent::get_color_scheme(); |
|
| 68 | - |
|
| 69 | - return apply_filters( 'lsx_customizer_colours_button', array( |
|
| 70 | - 'button_background_color' => get_theme_mod( 'button_background_color', $colors['button_background_color'] ), |
|
| 71 | - 'button_background_hover_color' => get_theme_mod( 'button_background_hover_color', $colors['button_background_hover_color'] ), |
|
| 72 | - 'button_text_color' => get_theme_mod( 'button_text_color', $colors['button_text_color'] ), |
|
| 73 | - 'button_text_color_hover' => get_theme_mod( 'button_text_color_hover', $colors['button_text_color_hover'] ), |
|
| 74 | - 'button_shadow' => get_theme_mod( 'button_shadow', $colors['button_shadow'] ), |
|
| 75 | - ) ); |
|
| 76 | - } |
|
| 77 | - |
|
| 78 | - /** |
|
| 79 | - * Returns CSS. |
|
| 80 | - * |
|
| 81 | - * @since 1.0.0 |
|
| 82 | - */ |
|
| 83 | - function get_css( $colors ) { |
|
| 84 | - global $customizer_colour_names; |
|
| 85 | - |
|
| 86 | - $colors_template = array(); |
|
| 87 | - |
|
| 88 | - foreach ( $customizer_colour_names as $key => $value ) { |
|
| 89 | - $colors_template[ $key ] = ''; |
|
| 90 | - } |
|
| 91 | - |
|
| 92 | - $colors = wp_parse_args( $colors, $colors_template ); |
|
| 93 | - |
|
| 94 | - if ( empty( $colors['button_text_color'] ) |
|
| 95 | - || empty( $colors['button_text_color_hover'] ) |
|
| 96 | - || empty( $colors['button_background_color'] ) |
|
| 97 | - || empty( $colors['button_background_hover_color'] ) |
|
| 98 | - || empty( $colors['button_shadow'] ) ) { |
|
| 99 | - return ''; |
|
| 100 | - } |
|
| 101 | - |
|
| 102 | - $css = ' |
|
| 4 | + /** |
|
| 5 | + * LSX Customizer Colour Button Class |
|
| 6 | + * |
|
| 7 | + * @package LSX Customizer |
|
| 8 | + * @author LightSpeed |
|
| 9 | + * @license GPL3 |
|
| 10 | + * @link |
|
| 11 | + * @copyright 2016 LightSpeed |
|
| 12 | + */ |
|
| 13 | + class LSX_Customizer_Colour_Button extends LSX_Customizer_Colour { |
|
| 14 | + |
|
| 15 | + /** |
|
| 16 | + * Constructor. |
|
| 17 | + * |
|
| 18 | + * @since 1.0.0 |
|
| 19 | + */ |
|
| 20 | + public function __construct() { |
|
| 21 | + add_action( 'after_switch_theme', array( $this, 'set_theme_mod' ) ); |
|
| 22 | + add_action( 'customize_save_after', array( $this, 'set_theme_mod' ) ); |
|
| 23 | + |
|
| 24 | + add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_css' ), 2999 ); |
|
| 25 | + } |
|
| 26 | + |
|
| 27 | + /** |
|
| 28 | + * Assign CSS to theme mod. |
|
| 29 | + * |
|
| 30 | + * @since 1.0.0 |
|
| 31 | + */ |
|
| 32 | + public function set_theme_mod() { |
|
| 33 | + $theme_mods = $this->get_theme_mods(); |
|
| 34 | + $styles = $this->get_css( $theme_mods ); |
|
| 35 | + |
|
| 36 | + set_theme_mod( 'lsx_customizer_colour__button_theme_mod', $styles ); |
|
| 37 | + } |
|
| 38 | + |
|
| 39 | + /** |
|
| 40 | + * Enqueues front-end CSS. |
|
| 41 | + * |
|
| 42 | + * @since 1.0.0 |
|
| 43 | + */ |
|
| 44 | + public function enqueue_css() { |
|
| 45 | + $styles_from_theme_mod = get_theme_mod( 'lsx_customizer_colour__button_theme_mod' ); |
|
| 46 | + |
|
| 47 | + if ( is_customize_preview() || false === $styles_from_theme_mod ) { |
|
| 48 | + $theme_mods = $this->get_theme_mods(); |
|
| 49 | + $styles = $this->get_css( $theme_mods ); |
|
| 50 | + |
|
| 51 | + if ( false === $styles_from_theme_mod ) { |
|
| 52 | + set_theme_mod( 'lsx_customizer_colour__button_theme_mod', $styles ); |
|
| 53 | + } |
|
| 54 | + } else { |
|
| 55 | + $styles = $styles_from_theme_mod; |
|
| 56 | + } |
|
| 57 | + |
|
| 58 | + wp_add_inline_style( 'lsx-customizer', $styles ); |
|
| 59 | + } |
|
| 60 | + |
|
| 61 | + /** |
|
| 62 | + * Get CSS theme mods. |
|
| 63 | + * |
|
| 64 | + * @since 1.0.0 |
|
| 65 | + */ |
|
| 66 | + public function get_theme_mods() { |
|
| 67 | + $colors = parent::get_color_scheme(); |
|
| 68 | + |
|
| 69 | + return apply_filters( 'lsx_customizer_colours_button', array( |
|
| 70 | + 'button_background_color' => get_theme_mod( 'button_background_color', $colors['button_background_color'] ), |
|
| 71 | + 'button_background_hover_color' => get_theme_mod( 'button_background_hover_color', $colors['button_background_hover_color'] ), |
|
| 72 | + 'button_text_color' => get_theme_mod( 'button_text_color', $colors['button_text_color'] ), |
|
| 73 | + 'button_text_color_hover' => get_theme_mod( 'button_text_color_hover', $colors['button_text_color_hover'] ), |
|
| 74 | + 'button_shadow' => get_theme_mod( 'button_shadow', $colors['button_shadow'] ), |
|
| 75 | + ) ); |
|
| 76 | + } |
|
| 77 | + |
|
| 78 | + /** |
|
| 79 | + * Returns CSS. |
|
| 80 | + * |
|
| 81 | + * @since 1.0.0 |
|
| 82 | + */ |
|
| 83 | + function get_css( $colors ) { |
|
| 84 | + global $customizer_colour_names; |
|
| 85 | + |
|
| 86 | + $colors_template = array(); |
|
| 87 | + |
|
| 88 | + foreach ( $customizer_colour_names as $key => $value ) { |
|
| 89 | + $colors_template[ $key ] = ''; |
|
| 90 | + } |
|
| 91 | + |
|
| 92 | + $colors = wp_parse_args( $colors, $colors_template ); |
|
| 93 | + |
|
| 94 | + if ( empty( $colors['button_text_color'] ) |
|
| 95 | + || empty( $colors['button_text_color_hover'] ) |
|
| 96 | + || empty( $colors['button_background_color'] ) |
|
| 97 | + || empty( $colors['button_background_hover_color'] ) |
|
| 98 | + || empty( $colors['button_shadow'] ) ) { |
|
| 99 | + return ''; |
|
| 100 | + } |
|
| 101 | + |
|
| 102 | + $css = ' |
|
| 103 | 103 | @import "' . get_template_directory() . '/assets/css/scss/global/mixins/button"; |
| 104 | 104 | |
| 105 | 105 | /** |
@@ -114,12 +114,12 @@ discard block |
||
| 114 | 114 | ); |
| 115 | 115 | '; |
| 116 | 116 | |
| 117 | - $css = apply_filters( 'lsx_customizer_colour_selectors_button', $css, $colors ); |
|
| 118 | - $css = parent::scss_to_css( $css ); |
|
| 117 | + $css = apply_filters( 'lsx_customizer_colour_selectors_button', $css, $colors ); |
|
| 118 | + $css = parent::scss_to_css( $css ); |
|
| 119 | 119 | |
| 120 | - return $css; |
|
| 121 | - } |
|
| 120 | + return $css; |
|
| 121 | + } |
|
| 122 | 122 | |
| 123 | - } |
|
| 123 | + } |
|
| 124 | 124 | |
| 125 | 125 | } |
@@ -1,5 +1,5 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | -if ( ! class_exists( 'LSX_Customizer_Colour_Footer' ) ) { |
|
| 2 | +if ( ! class_exists('LSX_Customizer_Colour_Footer')) { |
|
| 3 | 3 | |
| 4 | 4 | /** |
| 5 | 5 | * LSX Customizer Colour Footer Class |
@@ -18,10 +18,10 @@ discard block |
||
| 18 | 18 | * @since 1.0.0 |
| 19 | 19 | */ |
| 20 | 20 | public function __construct() { |
| 21 | - add_action( 'after_switch_theme', array( $this, 'set_theme_mod' ) ); |
|
| 22 | - add_action( 'customize_save_after', array( $this, 'set_theme_mod' ) ); |
|
| 21 | + add_action('after_switch_theme', array($this, 'set_theme_mod')); |
|
| 22 | + add_action('customize_save_after', array($this, 'set_theme_mod')); |
|
| 23 | 23 | |
| 24 | - add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_css' ), 2999 ); |
|
| 24 | + add_action('wp_enqueue_scripts', array($this, 'enqueue_css'), 2999); |
|
| 25 | 25 | } |
| 26 | 26 | |
| 27 | 27 | /** |
@@ -31,9 +31,9 @@ discard block |
||
| 31 | 31 | */ |
| 32 | 32 | public function set_theme_mod() { |
| 33 | 33 | $theme_mods = $this->get_theme_mods(); |
| 34 | - $styles = $this->get_css( $theme_mods ); |
|
| 34 | + $styles = $this->get_css($theme_mods); |
|
| 35 | 35 | |
| 36 | - set_theme_mod( 'lsx_customizer_colour__footer_theme_mod', $styles ); |
|
| 36 | + set_theme_mod('lsx_customizer_colour__footer_theme_mod', $styles); |
|
| 37 | 37 | } |
| 38 | 38 | |
| 39 | 39 | /** |
@@ -42,20 +42,20 @@ discard block |
||
| 42 | 42 | * @since 1.0.0 |
| 43 | 43 | */ |
| 44 | 44 | public function enqueue_css() { |
| 45 | - $styles_from_theme_mod = get_theme_mod( 'lsx_customizer_colour__footer_theme_mod' ); |
|
| 45 | + $styles_from_theme_mod = get_theme_mod('lsx_customizer_colour__footer_theme_mod'); |
|
| 46 | 46 | |
| 47 | - if ( is_customize_preview() || false === $styles_from_theme_mod ) { |
|
| 47 | + if (is_customize_preview() || false === $styles_from_theme_mod) { |
|
| 48 | 48 | $theme_mods = $this->get_theme_mods(); |
| 49 | - $styles = $this->get_css( $theme_mods ); |
|
| 49 | + $styles = $this->get_css($theme_mods); |
|
| 50 | 50 | |
| 51 | - if ( false === $styles_from_theme_mod ) { |
|
| 52 | - set_theme_mod( 'lsx_customizer_colour__footer_theme_mod', $styles ); |
|
| 51 | + if (false === $styles_from_theme_mod) { |
|
| 52 | + set_theme_mod('lsx_customizer_colour__footer_theme_mod', $styles); |
|
| 53 | 53 | } |
| 54 | 54 | } else { |
| 55 | 55 | $styles = $styles_from_theme_mod; |
| 56 | 56 | } |
| 57 | 57 | |
| 58 | - wp_add_inline_style( 'lsx-customizer', $styles ); |
|
| 58 | + wp_add_inline_style('lsx-customizer', $styles); |
|
| 59 | 59 | } |
| 60 | 60 | |
| 61 | 61 | /** |
@@ -66,12 +66,12 @@ discard block |
||
| 66 | 66 | public function get_theme_mods() { |
| 67 | 67 | $colors = parent::get_color_scheme(); |
| 68 | 68 | |
| 69 | - return apply_filters( 'lsx_customizer_colours_footer', array( |
|
| 70 | - 'footer_background_color' => get_theme_mod( 'footer_background_color', $colors['footer_background_color'] ), |
|
| 71 | - 'footer_text_color' => get_theme_mod( 'footer_text_color', $colors['footer_text_color'] ), |
|
| 72 | - 'footer_link_color' => get_theme_mod( 'footer_link_color', $colors['footer_link_color'] ), |
|
| 73 | - 'footer_link_hover_color' => get_theme_mod( 'footer_link_hover_color', $colors['footer_link_hover_color'] ), |
|
| 74 | - ) ); |
|
| 69 | + return apply_filters('lsx_customizer_colours_footer', array( |
|
| 70 | + 'footer_background_color' => get_theme_mod('footer_background_color', $colors['footer_background_color']), |
|
| 71 | + 'footer_text_color' => get_theme_mod('footer_text_color', $colors['footer_text_color']), |
|
| 72 | + 'footer_link_color' => get_theme_mod('footer_link_color', $colors['footer_link_color']), |
|
| 73 | + 'footer_link_hover_color' => get_theme_mod('footer_link_hover_color', $colors['footer_link_hover_color']), |
|
| 74 | + )); |
|
| 75 | 75 | } |
| 76 | 76 | |
| 77 | 77 | /** |
@@ -79,21 +79,21 @@ discard block |
||
| 79 | 79 | * |
| 80 | 80 | * @since 1.0.0 |
| 81 | 81 | */ |
| 82 | - function get_css( $colors ) { |
|
| 82 | + function get_css($colors) { |
|
| 83 | 83 | global $customizer_colour_names; |
| 84 | 84 | |
| 85 | 85 | $colors_template = array(); |
| 86 | 86 | |
| 87 | - foreach ( $customizer_colour_names as $key => $value ) { |
|
| 88 | - $colors_template[ $key ] = ''; |
|
| 87 | + foreach ($customizer_colour_names as $key => $value) { |
|
| 88 | + $colors_template[$key] = ''; |
|
| 89 | 89 | } |
| 90 | 90 | |
| 91 | - $colors = wp_parse_args( $colors, $colors_template ); |
|
| 91 | + $colors = wp_parse_args($colors, $colors_template); |
|
| 92 | 92 | |
| 93 | - if ( empty( $colors['footer_background_color'] ) |
|
| 94 | - || empty( $colors['footer_text_color'] ) |
|
| 95 | - || empty( $colors['footer_link_color'] ) |
|
| 96 | - || empty( $colors['footer_link_hover_color'] ) ) { |
|
| 93 | + if (empty($colors['footer_background_color']) |
|
| 94 | + || empty($colors['footer_text_color']) |
|
| 95 | + || empty($colors['footer_link_color']) |
|
| 96 | + || empty($colors['footer_link_hover_color'])) { |
|
| 97 | 97 | return ''; |
| 98 | 98 | } |
| 99 | 99 | |
@@ -111,8 +111,8 @@ discard block |
||
| 111 | 111 | ); |
| 112 | 112 | '; |
| 113 | 113 | |
| 114 | - $css = apply_filters( 'lsx_customizer_colour_selectors_footer', $css, $colors ); |
|
| 115 | - $css = parent::scss_to_css( $css ); |
|
| 114 | + $css = apply_filters('lsx_customizer_colour_selectors_footer', $css, $colors); |
|
| 115 | + $css = parent::scss_to_css($css); |
|
| 116 | 116 | |
| 117 | 117 | return $css; |
| 118 | 118 | } |
@@ -1,103 +1,103 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | if ( ! class_exists( 'LSX_Customizer_Colour_Footer' ) ) { |
| 3 | 3 | |
| 4 | - /** |
|
| 5 | - * LSX Customizer Colour Footer Class |
|
| 6 | - * |
|
| 7 | - * @package LSX Customizer |
|
| 8 | - * @author LightSpeed |
|
| 9 | - * @license GPL3 |
|
| 10 | - * @link |
|
| 11 | - * @copyright 2016 LightSpeed |
|
| 12 | - */ |
|
| 13 | - class LSX_Customizer_Colour_Footer extends LSX_Customizer_Colour { |
|
| 14 | - |
|
| 15 | - /** |
|
| 16 | - * Constructor. |
|
| 17 | - * |
|
| 18 | - * @since 1.0.0 |
|
| 19 | - */ |
|
| 20 | - public function __construct() { |
|
| 21 | - add_action( 'after_switch_theme', array( $this, 'set_theme_mod' ) ); |
|
| 22 | - add_action( 'customize_save_after', array( $this, 'set_theme_mod' ) ); |
|
| 23 | - |
|
| 24 | - add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_css' ), 2999 ); |
|
| 25 | - } |
|
| 26 | - |
|
| 27 | - /** |
|
| 28 | - * Assign CSS to theme mod. |
|
| 29 | - * |
|
| 30 | - * @since 1.0.0 |
|
| 31 | - */ |
|
| 32 | - public function set_theme_mod() { |
|
| 33 | - $theme_mods = $this->get_theme_mods(); |
|
| 34 | - $styles = $this->get_css( $theme_mods ); |
|
| 35 | - |
|
| 36 | - set_theme_mod( 'lsx_customizer_colour__footer_theme_mod', $styles ); |
|
| 37 | - } |
|
| 38 | - |
|
| 39 | - /** |
|
| 40 | - * Enqueues front-end CSS. |
|
| 41 | - * |
|
| 42 | - * @since 1.0.0 |
|
| 43 | - */ |
|
| 44 | - public function enqueue_css() { |
|
| 45 | - $styles_from_theme_mod = get_theme_mod( 'lsx_customizer_colour__footer_theme_mod' ); |
|
| 46 | - |
|
| 47 | - if ( is_customize_preview() || false === $styles_from_theme_mod ) { |
|
| 48 | - $theme_mods = $this->get_theme_mods(); |
|
| 49 | - $styles = $this->get_css( $theme_mods ); |
|
| 50 | - |
|
| 51 | - if ( false === $styles_from_theme_mod ) { |
|
| 52 | - set_theme_mod( 'lsx_customizer_colour__footer_theme_mod', $styles ); |
|
| 53 | - } |
|
| 54 | - } else { |
|
| 55 | - $styles = $styles_from_theme_mod; |
|
| 56 | - } |
|
| 57 | - |
|
| 58 | - wp_add_inline_style( 'lsx-customizer', $styles ); |
|
| 59 | - } |
|
| 60 | - |
|
| 61 | - /** |
|
| 62 | - * Get CSS theme mods. |
|
| 63 | - * |
|
| 64 | - * @since 1.0.0 |
|
| 65 | - */ |
|
| 66 | - public function get_theme_mods() { |
|
| 67 | - $colors = parent::get_color_scheme(); |
|
| 68 | - |
|
| 69 | - return apply_filters( 'lsx_customizer_colours_footer', array( |
|
| 70 | - 'footer_background_color' => get_theme_mod( 'footer_background_color', $colors['footer_background_color'] ), |
|
| 71 | - 'footer_text_color' => get_theme_mod( 'footer_text_color', $colors['footer_text_color'] ), |
|
| 72 | - 'footer_link_color' => get_theme_mod( 'footer_link_color', $colors['footer_link_color'] ), |
|
| 73 | - 'footer_link_hover_color' => get_theme_mod( 'footer_link_hover_color', $colors['footer_link_hover_color'] ), |
|
| 74 | - ) ); |
|
| 75 | - } |
|
| 76 | - |
|
| 77 | - /** |
|
| 78 | - * Returns CSS. |
|
| 79 | - * |
|
| 80 | - * @since 1.0.0 |
|
| 81 | - */ |
|
| 82 | - function get_css( $colors ) { |
|
| 83 | - global $customizer_colour_names; |
|
| 84 | - |
|
| 85 | - $colors_template = array(); |
|
| 86 | - |
|
| 87 | - foreach ( $customizer_colour_names as $key => $value ) { |
|
| 88 | - $colors_template[ $key ] = ''; |
|
| 89 | - } |
|
| 90 | - |
|
| 91 | - $colors = wp_parse_args( $colors, $colors_template ); |
|
| 92 | - |
|
| 93 | - if ( empty( $colors['footer_background_color'] ) |
|
| 94 | - || empty( $colors['footer_text_color'] ) |
|
| 95 | - || empty( $colors['footer_link_color'] ) |
|
| 96 | - || empty( $colors['footer_link_hover_color'] ) ) { |
|
| 97 | - return ''; |
|
| 98 | - } |
|
| 99 | - |
|
| 100 | - $css = ' |
|
| 4 | + /** |
|
| 5 | + * LSX Customizer Colour Footer Class |
|
| 6 | + * |
|
| 7 | + * @package LSX Customizer |
|
| 8 | + * @author LightSpeed |
|
| 9 | + * @license GPL3 |
|
| 10 | + * @link |
|
| 11 | + * @copyright 2016 LightSpeed |
|
| 12 | + */ |
|
| 13 | + class LSX_Customizer_Colour_Footer extends LSX_Customizer_Colour { |
|
| 14 | + |
|
| 15 | + /** |
|
| 16 | + * Constructor. |
|
| 17 | + * |
|
| 18 | + * @since 1.0.0 |
|
| 19 | + */ |
|
| 20 | + public function __construct() { |
|
| 21 | + add_action( 'after_switch_theme', array( $this, 'set_theme_mod' ) ); |
|
| 22 | + add_action( 'customize_save_after', array( $this, 'set_theme_mod' ) ); |
|
| 23 | + |
|
| 24 | + add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_css' ), 2999 ); |
|
| 25 | + } |
|
| 26 | + |
|
| 27 | + /** |
|
| 28 | + * Assign CSS to theme mod. |
|
| 29 | + * |
|
| 30 | + * @since 1.0.0 |
|
| 31 | + */ |
|
| 32 | + public function set_theme_mod() { |
|
| 33 | + $theme_mods = $this->get_theme_mods(); |
|
| 34 | + $styles = $this->get_css( $theme_mods ); |
|
| 35 | + |
|
| 36 | + set_theme_mod( 'lsx_customizer_colour__footer_theme_mod', $styles ); |
|
| 37 | + } |
|
| 38 | + |
|
| 39 | + /** |
|
| 40 | + * Enqueues front-end CSS. |
|
| 41 | + * |
|
| 42 | + * @since 1.0.0 |
|
| 43 | + */ |
|
| 44 | + public function enqueue_css() { |
|
| 45 | + $styles_from_theme_mod = get_theme_mod( 'lsx_customizer_colour__footer_theme_mod' ); |
|
| 46 | + |
|
| 47 | + if ( is_customize_preview() || false === $styles_from_theme_mod ) { |
|
| 48 | + $theme_mods = $this->get_theme_mods(); |
|
| 49 | + $styles = $this->get_css( $theme_mods ); |
|
| 50 | + |
|
| 51 | + if ( false === $styles_from_theme_mod ) { |
|
| 52 | + set_theme_mod( 'lsx_customizer_colour__footer_theme_mod', $styles ); |
|
| 53 | + } |
|
| 54 | + } else { |
|
| 55 | + $styles = $styles_from_theme_mod; |
|
| 56 | + } |
|
| 57 | + |
|
| 58 | + wp_add_inline_style( 'lsx-customizer', $styles ); |
|
| 59 | + } |
|
| 60 | + |
|
| 61 | + /** |
|
| 62 | + * Get CSS theme mods. |
|
| 63 | + * |
|
| 64 | + * @since 1.0.0 |
|
| 65 | + */ |
|
| 66 | + public function get_theme_mods() { |
|
| 67 | + $colors = parent::get_color_scheme(); |
|
| 68 | + |
|
| 69 | + return apply_filters( 'lsx_customizer_colours_footer', array( |
|
| 70 | + 'footer_background_color' => get_theme_mod( 'footer_background_color', $colors['footer_background_color'] ), |
|
| 71 | + 'footer_text_color' => get_theme_mod( 'footer_text_color', $colors['footer_text_color'] ), |
|
| 72 | + 'footer_link_color' => get_theme_mod( 'footer_link_color', $colors['footer_link_color'] ), |
|
| 73 | + 'footer_link_hover_color' => get_theme_mod( 'footer_link_hover_color', $colors['footer_link_hover_color'] ), |
|
| 74 | + ) ); |
|
| 75 | + } |
|
| 76 | + |
|
| 77 | + /** |
|
| 78 | + * Returns CSS. |
|
| 79 | + * |
|
| 80 | + * @since 1.0.0 |
|
| 81 | + */ |
|
| 82 | + function get_css( $colors ) { |
|
| 83 | + global $customizer_colour_names; |
|
| 84 | + |
|
| 85 | + $colors_template = array(); |
|
| 86 | + |
|
| 87 | + foreach ( $customizer_colour_names as $key => $value ) { |
|
| 88 | + $colors_template[ $key ] = ''; |
|
| 89 | + } |
|
| 90 | + |
|
| 91 | + $colors = wp_parse_args( $colors, $colors_template ); |
|
| 92 | + |
|
| 93 | + if ( empty( $colors['footer_background_color'] ) |
|
| 94 | + || empty( $colors['footer_text_color'] ) |
|
| 95 | + || empty( $colors['footer_link_color'] ) |
|
| 96 | + || empty( $colors['footer_link_hover_color'] ) ) { |
|
| 97 | + return ''; |
|
| 98 | + } |
|
| 99 | + |
|
| 100 | + $css = ' |
|
| 101 | 101 | @import "' . get_template_directory() . '/assets/css/scss/global/mixins/footer"; |
| 102 | 102 | |
| 103 | 103 | /** |
@@ -111,12 +111,12 @@ discard block |
||
| 111 | 111 | ); |
| 112 | 112 | '; |
| 113 | 113 | |
| 114 | - $css = apply_filters( 'lsx_customizer_colour_selectors_footer', $css, $colors ); |
|
| 115 | - $css = parent::scss_to_css( $css ); |
|
| 114 | + $css = apply_filters( 'lsx_customizer_colour_selectors_footer', $css, $colors ); |
|
| 115 | + $css = parent::scss_to_css( $css ); |
|
| 116 | 116 | |
| 117 | - return $css; |
|
| 118 | - } |
|
| 117 | + return $css; |
|
| 118 | + } |
|
| 119 | 119 | |
| 120 | - } |
|
| 120 | + } |
|
| 121 | 121 | |
| 122 | 122 | } |
@@ -1,5 +1,5 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | -if ( ! class_exists( 'LSX_Customizer_Colour_Button_Secondary' ) ) { |
|
| 2 | +if ( ! class_exists('LSX_Customizer_Colour_Button_Secondary')) { |
|
| 3 | 3 | |
| 4 | 4 | /** |
| 5 | 5 | * LSX Customizer Colour Button Secondary Class |
@@ -18,10 +18,10 @@ discard block |
||
| 18 | 18 | * @since 1.0.0 |
| 19 | 19 | */ |
| 20 | 20 | public function __construct() { |
| 21 | - add_action( 'after_switch_theme', array( $this, 'set_theme_mod' ) ); |
|
| 22 | - add_action( 'customize_save_after', array( $this, 'set_theme_mod' ) ); |
|
| 21 | + add_action('after_switch_theme', array($this, 'set_theme_mod')); |
|
| 22 | + add_action('customize_save_after', array($this, 'set_theme_mod')); |
|
| 23 | 23 | |
| 24 | - add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_css' ), 2999 ); |
|
| 24 | + add_action('wp_enqueue_scripts', array($this, 'enqueue_css'), 2999); |
|
| 25 | 25 | } |
| 26 | 26 | |
| 27 | 27 | /** |
@@ -31,9 +31,9 @@ discard block |
||
| 31 | 31 | */ |
| 32 | 32 | public function set_theme_mod() { |
| 33 | 33 | $theme_mods = $this->get_theme_mods(); |
| 34 | - $styles = $this->get_css( $theme_mods ); |
|
| 34 | + $styles = $this->get_css($theme_mods); |
|
| 35 | 35 | |
| 36 | - set_theme_mod( 'lsx_customizer_colour__button_secondary_theme_mod', $styles ); |
|
| 36 | + set_theme_mod('lsx_customizer_colour__button_secondary_theme_mod', $styles); |
|
| 37 | 37 | } |
| 38 | 38 | |
| 39 | 39 | /** |
@@ -42,20 +42,20 @@ discard block |
||
| 42 | 42 | * @since 1.0.0 |
| 43 | 43 | */ |
| 44 | 44 | public function enqueue_css() { |
| 45 | - $styles_from_theme_mod = get_theme_mod( 'lsx_customizer_colour__button_secondary_theme_mod' ); |
|
| 45 | + $styles_from_theme_mod = get_theme_mod('lsx_customizer_colour__button_secondary_theme_mod'); |
|
| 46 | 46 | |
| 47 | - if ( is_customize_preview() || false === $styles_from_theme_mod ) { |
|
| 47 | + if (is_customize_preview() || false === $styles_from_theme_mod) { |
|
| 48 | 48 | $theme_mods = $this->get_theme_mods(); |
| 49 | - $styles = $this->get_css( $theme_mods ); |
|
| 49 | + $styles = $this->get_css($theme_mods); |
|
| 50 | 50 | |
| 51 | - if ( false === $styles_from_theme_mod ) { |
|
| 52 | - set_theme_mod( 'lsx_customizer_colour__button_secondary_theme_mod', $styles ); |
|
| 51 | + if (false === $styles_from_theme_mod) { |
|
| 52 | + set_theme_mod('lsx_customizer_colour__button_secondary_theme_mod', $styles); |
|
| 53 | 53 | } |
| 54 | 54 | } else { |
| 55 | 55 | $styles = $styles_from_theme_mod; |
| 56 | 56 | } |
| 57 | 57 | |
| 58 | - wp_add_inline_style( 'lsx-customizer', $styles ); |
|
| 58 | + wp_add_inline_style('lsx-customizer', $styles); |
|
| 59 | 59 | } |
| 60 | 60 | |
| 61 | 61 | /** |
@@ -66,13 +66,13 @@ discard block |
||
| 66 | 66 | public function get_theme_mods() { |
| 67 | 67 | $colors = parent::get_color_scheme(); |
| 68 | 68 | |
| 69 | - return apply_filters( 'lsx_customizer_colours_button_secondary', array( |
|
| 70 | - 'button_secondary_background_color' => get_theme_mod( 'button_secondary_background_color', $colors['button_secondary_background_color'] ), |
|
| 71 | - 'button_secondary_background_hover_color' => get_theme_mod( 'button_secondary_background_hover_color', $colors['button_secondary_background_hover_color'] ), |
|
| 72 | - 'button_secondary_text_color' => get_theme_mod( 'button_secondary_text_color', $colors['button_secondary_text_color'] ), |
|
| 73 | - 'button_secondary_text_color_hover' => get_theme_mod( 'button_secondary_text_color_hover', $colors['button_secondary_text_color_hover'] ), |
|
| 74 | - 'button_secondary_shadow' => get_theme_mod( 'button_secondary_shadow', $colors['button_secondary_shadow'] ), |
|
| 75 | - ) ); |
|
| 69 | + return apply_filters('lsx_customizer_colours_button_secondary', array( |
|
| 70 | + 'button_secondary_background_color' => get_theme_mod('button_secondary_background_color', $colors['button_secondary_background_color']), |
|
| 71 | + 'button_secondary_background_hover_color' => get_theme_mod('button_secondary_background_hover_color', $colors['button_secondary_background_hover_color']), |
|
| 72 | + 'button_secondary_text_color' => get_theme_mod('button_secondary_text_color', $colors['button_secondary_text_color']), |
|
| 73 | + 'button_secondary_text_color_hover' => get_theme_mod('button_secondary_text_color_hover', $colors['button_secondary_text_color_hover']), |
|
| 74 | + 'button_secondary_shadow' => get_theme_mod('button_secondary_shadow', $colors['button_secondary_shadow']), |
|
| 75 | + )); |
|
| 76 | 76 | } |
| 77 | 77 | |
| 78 | 78 | /** |
@@ -80,22 +80,22 @@ discard block |
||
| 80 | 80 | * |
| 81 | 81 | * @since 1.0.0 |
| 82 | 82 | */ |
| 83 | - function get_css( $colors ) { |
|
| 83 | + function get_css($colors) { |
|
| 84 | 84 | global $customizer_colour_names; |
| 85 | 85 | |
| 86 | 86 | $colors_template = array(); |
| 87 | 87 | |
| 88 | - foreach ( $customizer_colour_names as $key => $value ) { |
|
| 89 | - $colors_template[ $key ] = ''; |
|
| 88 | + foreach ($customizer_colour_names as $key => $value) { |
|
| 89 | + $colors_template[$key] = ''; |
|
| 90 | 90 | } |
| 91 | 91 | |
| 92 | - $colors = wp_parse_args( $colors, $colors_template ); |
|
| 92 | + $colors = wp_parse_args($colors, $colors_template); |
|
| 93 | 93 | |
| 94 | - if ( empty( $colors['button_secondary_text_color'] ) |
|
| 95 | - || empty( $colors['button_secondary_text_color_hover'] ) |
|
| 96 | - || empty( $colors['button_secondary_background_color'] ) |
|
| 97 | - || empty( $colors['button_secondary_background_hover_color'] ) |
|
| 98 | - || empty( $colors['button_secondary_shadow'] ) ) { |
|
| 94 | + if (empty($colors['button_secondary_text_color']) |
|
| 95 | + || empty($colors['button_secondary_text_color_hover']) |
|
| 96 | + || empty($colors['button_secondary_background_color']) |
|
| 97 | + || empty($colors['button_secondary_background_hover_color']) |
|
| 98 | + || empty($colors['button_secondary_shadow'])) { |
|
| 99 | 99 | return ''; |
| 100 | 100 | } |
| 101 | 101 | |
@@ -114,8 +114,8 @@ discard block |
||
| 114 | 114 | ); |
| 115 | 115 | '; |
| 116 | 116 | |
| 117 | - $css = apply_filters( 'lsx_customizer_colour_selectors_button_secondary', $css, $colors ); |
|
| 118 | - $css = parent::scss_to_css( $css ); |
|
| 117 | + $css = apply_filters('lsx_customizer_colour_selectors_button_secondary', $css, $colors); |
|
| 118 | + $css = parent::scss_to_css($css); |
|
| 119 | 119 | |
| 120 | 120 | return $css; |
| 121 | 121 | } |
@@ -1,105 +1,105 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | if ( ! class_exists( 'LSX_Customizer_Colour_Button_Secondary' ) ) { |
| 3 | 3 | |
| 4 | - /** |
|
| 5 | - * LSX Customizer Colour Button Secondary Class |
|
| 6 | - * |
|
| 7 | - * @package LSX Customizer |
|
| 8 | - * @author LightSpeed |
|
| 9 | - * @license GPL3 |
|
| 10 | - * @link |
|
| 11 | - * @copyright 2016 LightSpeed |
|
| 12 | - */ |
|
| 13 | - class LSX_Customizer_Colour_Button_Secondary extends LSX_Customizer_Colour { |
|
| 14 | - |
|
| 15 | - /** |
|
| 16 | - * Constructor. |
|
| 17 | - * |
|
| 18 | - * @since 1.0.0 |
|
| 19 | - */ |
|
| 20 | - public function __construct() { |
|
| 21 | - add_action( 'after_switch_theme', array( $this, 'set_theme_mod' ) ); |
|
| 22 | - add_action( 'customize_save_after', array( $this, 'set_theme_mod' ) ); |
|
| 23 | - |
|
| 24 | - add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_css' ), 2999 ); |
|
| 25 | - } |
|
| 26 | - |
|
| 27 | - /** |
|
| 28 | - * Assign CSS to theme mod. |
|
| 29 | - * |
|
| 30 | - * @since 1.0.0 |
|
| 31 | - */ |
|
| 32 | - public function set_theme_mod() { |
|
| 33 | - $theme_mods = $this->get_theme_mods(); |
|
| 34 | - $styles = $this->get_css( $theme_mods ); |
|
| 35 | - |
|
| 36 | - set_theme_mod( 'lsx_customizer_colour__button_secondary_theme_mod', $styles ); |
|
| 37 | - } |
|
| 38 | - |
|
| 39 | - /** |
|
| 40 | - * Enqueues front-end CSS. |
|
| 41 | - * |
|
| 42 | - * @since 1.0.0 |
|
| 43 | - */ |
|
| 44 | - public function enqueue_css() { |
|
| 45 | - $styles_from_theme_mod = get_theme_mod( 'lsx_customizer_colour__button_secondary_theme_mod' ); |
|
| 46 | - |
|
| 47 | - if ( is_customize_preview() || false === $styles_from_theme_mod ) { |
|
| 48 | - $theme_mods = $this->get_theme_mods(); |
|
| 49 | - $styles = $this->get_css( $theme_mods ); |
|
| 50 | - |
|
| 51 | - if ( false === $styles_from_theme_mod ) { |
|
| 52 | - set_theme_mod( 'lsx_customizer_colour__button_secondary_theme_mod', $styles ); |
|
| 53 | - } |
|
| 54 | - } else { |
|
| 55 | - $styles = $styles_from_theme_mod; |
|
| 56 | - } |
|
| 57 | - |
|
| 58 | - wp_add_inline_style( 'lsx-customizer', $styles ); |
|
| 59 | - } |
|
| 60 | - |
|
| 61 | - /** |
|
| 62 | - * Get CSS theme mods. |
|
| 63 | - * |
|
| 64 | - * @since 1.0.0 |
|
| 65 | - */ |
|
| 66 | - public function get_theme_mods() { |
|
| 67 | - $colors = parent::get_color_scheme(); |
|
| 68 | - |
|
| 69 | - return apply_filters( 'lsx_customizer_colours_button_secondary', array( |
|
| 70 | - 'button_secondary_background_color' => get_theme_mod( 'button_secondary_background_color', $colors['button_secondary_background_color'] ), |
|
| 71 | - 'button_secondary_background_hover_color' => get_theme_mod( 'button_secondary_background_hover_color', $colors['button_secondary_background_hover_color'] ), |
|
| 72 | - 'button_secondary_text_color' => get_theme_mod( 'button_secondary_text_color', $colors['button_secondary_text_color'] ), |
|
| 73 | - 'button_secondary_text_color_hover' => get_theme_mod( 'button_secondary_text_color_hover', $colors['button_secondary_text_color_hover'] ), |
|
| 74 | - 'button_secondary_shadow' => get_theme_mod( 'button_secondary_shadow', $colors['button_secondary_shadow'] ), |
|
| 75 | - ) ); |
|
| 76 | - } |
|
| 77 | - |
|
| 78 | - /** |
|
| 79 | - * Returns CSS. |
|
| 80 | - * |
|
| 81 | - * @since 1.0.0 |
|
| 82 | - */ |
|
| 83 | - function get_css( $colors ) { |
|
| 84 | - global $customizer_colour_names; |
|
| 85 | - |
|
| 86 | - $colors_template = array(); |
|
| 87 | - |
|
| 88 | - foreach ( $customizer_colour_names as $key => $value ) { |
|
| 89 | - $colors_template[ $key ] = ''; |
|
| 90 | - } |
|
| 91 | - |
|
| 92 | - $colors = wp_parse_args( $colors, $colors_template ); |
|
| 93 | - |
|
| 94 | - if ( empty( $colors['button_secondary_text_color'] ) |
|
| 95 | - || empty( $colors['button_secondary_text_color_hover'] ) |
|
| 96 | - || empty( $colors['button_secondary_background_color'] ) |
|
| 97 | - || empty( $colors['button_secondary_background_hover_color'] ) |
|
| 98 | - || empty( $colors['button_secondary_shadow'] ) ) { |
|
| 99 | - return ''; |
|
| 100 | - } |
|
| 101 | - |
|
| 102 | - $css = ' |
|
| 4 | + /** |
|
| 5 | + * LSX Customizer Colour Button Secondary Class |
|
| 6 | + * |
|
| 7 | + * @package LSX Customizer |
|
| 8 | + * @author LightSpeed |
|
| 9 | + * @license GPL3 |
|
| 10 | + * @link |
|
| 11 | + * @copyright 2016 LightSpeed |
|
| 12 | + */ |
|
| 13 | + class LSX_Customizer_Colour_Button_Secondary extends LSX_Customizer_Colour { |
|
| 14 | + |
|
| 15 | + /** |
|
| 16 | + * Constructor. |
|
| 17 | + * |
|
| 18 | + * @since 1.0.0 |
|
| 19 | + */ |
|
| 20 | + public function __construct() { |
|
| 21 | + add_action( 'after_switch_theme', array( $this, 'set_theme_mod' ) ); |
|
| 22 | + add_action( 'customize_save_after', array( $this, 'set_theme_mod' ) ); |
|
| 23 | + |
|
| 24 | + add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_css' ), 2999 ); |
|
| 25 | + } |
|
| 26 | + |
|
| 27 | + /** |
|
| 28 | + * Assign CSS to theme mod. |
|
| 29 | + * |
|
| 30 | + * @since 1.0.0 |
|
| 31 | + */ |
|
| 32 | + public function set_theme_mod() { |
|
| 33 | + $theme_mods = $this->get_theme_mods(); |
|
| 34 | + $styles = $this->get_css( $theme_mods ); |
|
| 35 | + |
|
| 36 | + set_theme_mod( 'lsx_customizer_colour__button_secondary_theme_mod', $styles ); |
|
| 37 | + } |
|
| 38 | + |
|
| 39 | + /** |
|
| 40 | + * Enqueues front-end CSS. |
|
| 41 | + * |
|
| 42 | + * @since 1.0.0 |
|
| 43 | + */ |
|
| 44 | + public function enqueue_css() { |
|
| 45 | + $styles_from_theme_mod = get_theme_mod( 'lsx_customizer_colour__button_secondary_theme_mod' ); |
|
| 46 | + |
|
| 47 | + if ( is_customize_preview() || false === $styles_from_theme_mod ) { |
|
| 48 | + $theme_mods = $this->get_theme_mods(); |
|
| 49 | + $styles = $this->get_css( $theme_mods ); |
|
| 50 | + |
|
| 51 | + if ( false === $styles_from_theme_mod ) { |
|
| 52 | + set_theme_mod( 'lsx_customizer_colour__button_secondary_theme_mod', $styles ); |
|
| 53 | + } |
|
| 54 | + } else { |
|
| 55 | + $styles = $styles_from_theme_mod; |
|
| 56 | + } |
|
| 57 | + |
|
| 58 | + wp_add_inline_style( 'lsx-customizer', $styles ); |
|
| 59 | + } |
|
| 60 | + |
|
| 61 | + /** |
|
| 62 | + * Get CSS theme mods. |
|
| 63 | + * |
|
| 64 | + * @since 1.0.0 |
|
| 65 | + */ |
|
| 66 | + public function get_theme_mods() { |
|
| 67 | + $colors = parent::get_color_scheme(); |
|
| 68 | + |
|
| 69 | + return apply_filters( 'lsx_customizer_colours_button_secondary', array( |
|
| 70 | + 'button_secondary_background_color' => get_theme_mod( 'button_secondary_background_color', $colors['button_secondary_background_color'] ), |
|
| 71 | + 'button_secondary_background_hover_color' => get_theme_mod( 'button_secondary_background_hover_color', $colors['button_secondary_background_hover_color'] ), |
|
| 72 | + 'button_secondary_text_color' => get_theme_mod( 'button_secondary_text_color', $colors['button_secondary_text_color'] ), |
|
| 73 | + 'button_secondary_text_color_hover' => get_theme_mod( 'button_secondary_text_color_hover', $colors['button_secondary_text_color_hover'] ), |
|
| 74 | + 'button_secondary_shadow' => get_theme_mod( 'button_secondary_shadow', $colors['button_secondary_shadow'] ), |
|
| 75 | + ) ); |
|
| 76 | + } |
|
| 77 | + |
|
| 78 | + /** |
|
| 79 | + * Returns CSS. |
|
| 80 | + * |
|
| 81 | + * @since 1.0.0 |
|
| 82 | + */ |
|
| 83 | + function get_css( $colors ) { |
|
| 84 | + global $customizer_colour_names; |
|
| 85 | + |
|
| 86 | + $colors_template = array(); |
|
| 87 | + |
|
| 88 | + foreach ( $customizer_colour_names as $key => $value ) { |
|
| 89 | + $colors_template[ $key ] = ''; |
|
| 90 | + } |
|
| 91 | + |
|
| 92 | + $colors = wp_parse_args( $colors, $colors_template ); |
|
| 93 | + |
|
| 94 | + if ( empty( $colors['button_secondary_text_color'] ) |
|
| 95 | + || empty( $colors['button_secondary_text_color_hover'] ) |
|
| 96 | + || empty( $colors['button_secondary_background_color'] ) |
|
| 97 | + || empty( $colors['button_secondary_background_hover_color'] ) |
|
| 98 | + || empty( $colors['button_secondary_shadow'] ) ) { |
|
| 99 | + return ''; |
|
| 100 | + } |
|
| 101 | + |
|
| 102 | + $css = ' |
|
| 103 | 103 | @import "' . get_template_directory() . '/assets/css/scss/global/mixins/button"; |
| 104 | 104 | |
| 105 | 105 | /** |
@@ -114,12 +114,12 @@ discard block |
||
| 114 | 114 | ); |
| 115 | 115 | '; |
| 116 | 116 | |
| 117 | - $css = apply_filters( 'lsx_customizer_colour_selectors_button_secondary', $css, $colors ); |
|
| 118 | - $css = parent::scss_to_css( $css ); |
|
| 117 | + $css = apply_filters( 'lsx_customizer_colour_selectors_button_secondary', $css, $colors ); |
|
| 118 | + $css = parent::scss_to_css( $css ); |
|
| 119 | 119 | |
| 120 | - return $css; |
|
| 121 | - } |
|
| 120 | + return $css; |
|
| 121 | + } |
|
| 122 | 122 | |
| 123 | - } |
|
| 123 | + } |
|
| 124 | 124 | |
| 125 | 125 | } |
@@ -12,6 +12,6 @@ |
||
| 12 | 12 | /** |
| 13 | 13 | * Converts a HEX value to RGB. |
| 14 | 14 | */ |
| 15 | -function lsx_customizer_colour__hex2rgb( $color ) { |
|
| 16 | - return LSX_Customizer_Colour::hex2rgb( $color ); |
|
| 15 | +function lsx_customizer_colour__hex2rgb($color) { |
|
| 16 | + return LSX_Customizer_Colour::hex2rgb($color); |
|
| 17 | 17 | } |
@@ -13,5 +13,5 @@ |
||
| 13 | 13 | * Converts a HEX value to RGB. |
| 14 | 14 | */ |
| 15 | 15 | function lsx_customizer_colour__hex2rgb( $color ) { |
| 16 | - return LSX_Customizer_Colour::hex2rgb( $color ); |
|
| 16 | + return LSX_Customizer_Colour::hex2rgb( $color ); |
|
| 17 | 17 | } |