@@ -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,53 +1,53 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | if ( ! class_exists( 'LSX_Customizer_Core' ) ) { |
| 3 | 3 | |
| 4 | - /** |
|
| 5 | - * LSX Customizer Core Class |
|
| 6 | - * |
|
| 7 | - * @package LSX Customizer |
|
| 8 | - * @author LightSpeed |
|
| 9 | - * @license GPL3 |
|
| 10 | - * @link |
|
| 11 | - * @copyright 2016 LightSpeed |
|
| 12 | - */ |
|
| 13 | - class LSX_Customizer_Core extends LSX_Customizer { |
|
| 4 | + /** |
|
| 5 | + * LSX Customizer Core Class |
|
| 6 | + * |
|
| 7 | + * @package LSX Customizer |
|
| 8 | + * @author LightSpeed |
|
| 9 | + * @license GPL3 |
|
| 10 | + * @link |
|
| 11 | + * @copyright 2016 LightSpeed |
|
| 12 | + */ |
|
| 13 | + class LSX_Customizer_Core extends LSX_Customizer { |
|
| 14 | 14 | |
| 15 | - /** |
|
| 16 | - * Constructor. |
|
| 17 | - * |
|
| 18 | - * @since 1.0.0 |
|
| 19 | - */ |
|
| 20 | - public function __construct() { |
|
| 21 | - add_action( 'customize_register', array( $this, 'customize_register' ), 20 ); |
|
| 22 | - } |
|
| 15 | + /** |
|
| 16 | + * Constructor. |
|
| 17 | + * |
|
| 18 | + * @since 1.0.0 |
|
| 19 | + */ |
|
| 20 | + public function __construct() { |
|
| 21 | + add_action( 'customize_register', array( $this, 'customize_register' ), 20 ); |
|
| 22 | + } |
|
| 23 | 23 | |
| 24 | - /** |
|
| 25 | - * Customizer Controls and Settings. |
|
| 26 | - * |
|
| 27 | - * @param WP_Customize_Manager $wp_customize Theme Customizer object. |
|
| 28 | - * @since 1.0.0 |
|
| 29 | - */ |
|
| 30 | - public function customize_register( $wp_customize ) { |
|
| 31 | - /** |
|
| 32 | - * Core section: Theme Credit |
|
| 33 | - */ |
|
| 34 | - $wp_customize->add_setting( 'lsx_theme_credit_status', array( |
|
| 35 | - 'default' => true, |
|
| 36 | - 'sanitize_callback' => array( $this, 'sanitize_checkbox' ), |
|
| 37 | - ) ); |
|
| 24 | + /** |
|
| 25 | + * Customizer Controls and Settings. |
|
| 26 | + * |
|
| 27 | + * @param WP_Customize_Manager $wp_customize Theme Customizer object. |
|
| 28 | + * @since 1.0.0 |
|
| 29 | + */ |
|
| 30 | + public function customize_register( $wp_customize ) { |
|
| 31 | + /** |
|
| 32 | + * Core section: Theme Credit |
|
| 33 | + */ |
|
| 34 | + $wp_customize->add_setting( 'lsx_theme_credit_status', array( |
|
| 35 | + 'default' => true, |
|
| 36 | + 'sanitize_callback' => array( $this, 'sanitize_checkbox' ), |
|
| 37 | + ) ); |
|
| 38 | 38 | |
| 39 | - $wp_customize->add_control( new WP_Customize_Control( $wp_customize, 'lsx_theme_credit_status', array( |
|
| 40 | - 'label' => esc_html__( 'Theme Credit', 'lsx-customizer' ), |
|
| 41 | - // 'description' => esc_html__( 'Displays theme credit in footer.', 'lsx-customizer' ), |
|
| 42 | - 'section' => 'lsx-core', |
|
| 43 | - 'settings' => 'lsx_theme_credit_status', |
|
| 44 | - 'type' => 'checkbox', |
|
| 45 | - 'priority' => 10, |
|
| 46 | - ) ) ); |
|
| 47 | - } |
|
| 39 | + $wp_customize->add_control( new WP_Customize_Control( $wp_customize, 'lsx_theme_credit_status', array( |
|
| 40 | + 'label' => esc_html__( 'Theme Credit', 'lsx-customizer' ), |
|
| 41 | + // 'description' => esc_html__( 'Displays theme credit in footer.', 'lsx-customizer' ), |
|
| 42 | + 'section' => 'lsx-core', |
|
| 43 | + 'settings' => 'lsx_theme_credit_status', |
|
| 44 | + 'type' => 'checkbox', |
|
| 45 | + 'priority' => 10, |
|
| 46 | + ) ) ); |
|
| 47 | + } |
|
| 48 | 48 | |
| 49 | - } |
|
| 49 | + } |
|
| 50 | 50 | |
| 51 | - new LSX_Customizer_Core; |
|
| 51 | + new LSX_Customizer_Core; |
|
| 52 | 52 | |
| 53 | 53 | } |
@@ -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,63 +1,63 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | if ( ! class_exists( 'LSX_Customizer_Frontend' ) ) { |
| 3 | 3 | |
| 4 | - /** |
|
| 5 | - * LSX Customizer Frontend Class |
|
| 6 | - * |
|
| 7 | - * @package LSX Customizer |
|
| 8 | - * @author LightSpeed |
|
| 9 | - * @license GPL3 |
|
| 10 | - * @link |
|
| 11 | - * @copyright 2016 LightSpeed |
|
| 12 | - */ |
|
| 13 | - class LSX_Customizer_Frontend extends LSX_Customizer { |
|
| 14 | - |
|
| 15 | - /** |
|
| 16 | - * Constructor. |
|
| 17 | - * |
|
| 18 | - * @since 1.0.0 |
|
| 19 | - */ |
|
| 20 | - public function __construct() { |
|
| 21 | - add_action( 'wp_enqueue_scripts', array( $this, 'assets' ), 2999 ); |
|
| 22 | - add_action( 'wp_enqueue_scripts', array( $this, 'lsx_customizer_color_palette_css' ), 2999 ); |
|
| 23 | - add_action( 'wp', array( $this, 'layout' ), 2999 ); |
|
| 24 | - add_action( 'wp', array( $this, 'lsx_distraction_free_checkout' ), 2999 ); |
|
| 25 | - add_action( 'wp', array( $this, 'lsx_customizer_two_step_checkout' ) ); |
|
| 26 | - add_action( 'after_setup_theme', array( $this, 'lsx_customizer_color_palette_setup' ), 100 ); |
|
| 27 | - } |
|
| 28 | - |
|
| 29 | - /** |
|
| 30 | - * Enques the assets. |
|
| 31 | - * |
|
| 32 | - * @since 1.0.0 |
|
| 33 | - */ |
|
| 34 | - public function assets() { |
|
| 35 | - wp_enqueue_script( 'lsx-customizer', LSX_CUSTOMIZER_URL . 'assets/js/lsx-customizer.min.js', array( 'jquery' ), LSX_CUSTOMIZER_VER, true ); |
|
| 36 | - |
|
| 37 | - $params = apply_filters( 'lsx_customizer_js_params', array( |
|
| 38 | - 'ajax_url' => admin_url( 'admin-ajax.php' ), |
|
| 39 | - )); |
|
| 40 | - |
|
| 41 | - wp_localize_script( 'lsx-customizer', 'lsx_customizer_params', $params ); |
|
| 42 | - |
|
| 43 | - wp_enqueue_style( 'lsx-customizer', LSX_CUSTOMIZER_URL . 'assets/css/lsx-customizer.css', array(), LSX_CUSTOMIZER_VER ); |
|
| 44 | - wp_style_add_data( 'lsx-customizer', 'rtl', 'replace' ); |
|
| 45 | - |
|
| 46 | - $two_step_checkout = get_theme_mod( 'lsx_two_step_checkout', false ); |
|
| 47 | - if ( is_checkout() && ! empty( $two_step_checkout ) ) { |
|
| 48 | - |
|
| 49 | - wp_enqueue_script( 'flexslider', LSX_CUSTOMIZER_URL . 'assets/js/jquery.flexslider.min.js', array( 'jquery' ), '2.5.0' ); |
|
| 50 | - } |
|
| 51 | - |
|
| 52 | - } |
|
| 53 | - |
|
| 54 | - /** |
|
| 55 | - * Enqueues front-end colour palette CSS. |
|
| 56 | - * |
|
| 57 | - * @since 1.0.0 |
|
| 58 | - */ |
|
| 59 | - public function lsx_customizer_color_palette_css() { |
|
| 60 | - $styles = ' |
|
| 4 | + /** |
|
| 5 | + * LSX Customizer Frontend Class |
|
| 6 | + * |
|
| 7 | + * @package LSX Customizer |
|
| 8 | + * @author LightSpeed |
|
| 9 | + * @license GPL3 |
|
| 10 | + * @link |
|
| 11 | + * @copyright 2016 LightSpeed |
|
| 12 | + */ |
|
| 13 | + class LSX_Customizer_Frontend extends LSX_Customizer { |
|
| 14 | + |
|
| 15 | + /** |
|
| 16 | + * Constructor. |
|
| 17 | + * |
|
| 18 | + * @since 1.0.0 |
|
| 19 | + */ |
|
| 20 | + public function __construct() { |
|
| 21 | + add_action( 'wp_enqueue_scripts', array( $this, 'assets' ), 2999 ); |
|
| 22 | + add_action( 'wp_enqueue_scripts', array( $this, 'lsx_customizer_color_palette_css' ), 2999 ); |
|
| 23 | + add_action( 'wp', array( $this, 'layout' ), 2999 ); |
|
| 24 | + add_action( 'wp', array( $this, 'lsx_distraction_free_checkout' ), 2999 ); |
|
| 25 | + add_action( 'wp', array( $this, 'lsx_customizer_two_step_checkout' ) ); |
|
| 26 | + add_action( 'after_setup_theme', array( $this, 'lsx_customizer_color_palette_setup' ), 100 ); |
|
| 27 | + } |
|
| 28 | + |
|
| 29 | + /** |
|
| 30 | + * Enques the assets. |
|
| 31 | + * |
|
| 32 | + * @since 1.0.0 |
|
| 33 | + */ |
|
| 34 | + public function assets() { |
|
| 35 | + wp_enqueue_script( 'lsx-customizer', LSX_CUSTOMIZER_URL . 'assets/js/lsx-customizer.min.js', array( 'jquery' ), LSX_CUSTOMIZER_VER, true ); |
|
| 36 | + |
|
| 37 | + $params = apply_filters( 'lsx_customizer_js_params', array( |
|
| 38 | + 'ajax_url' => admin_url( 'admin-ajax.php' ), |
|
| 39 | + )); |
|
| 40 | + |
|
| 41 | + wp_localize_script( 'lsx-customizer', 'lsx_customizer_params', $params ); |
|
| 42 | + |
|
| 43 | + wp_enqueue_style( 'lsx-customizer', LSX_CUSTOMIZER_URL . 'assets/css/lsx-customizer.css', array(), LSX_CUSTOMIZER_VER ); |
|
| 44 | + wp_style_add_data( 'lsx-customizer', 'rtl', 'replace' ); |
|
| 45 | + |
|
| 46 | + $two_step_checkout = get_theme_mod( 'lsx_two_step_checkout', false ); |
|
| 47 | + if ( is_checkout() && ! empty( $two_step_checkout ) ) { |
|
| 48 | + |
|
| 49 | + wp_enqueue_script( 'flexslider', LSX_CUSTOMIZER_URL . 'assets/js/jquery.flexslider.min.js', array( 'jquery' ), '2.5.0' ); |
|
| 50 | + } |
|
| 51 | + |
|
| 52 | + } |
|
| 53 | + |
|
| 54 | + /** |
|
| 55 | + * Enqueues front-end colour palette CSS. |
|
| 56 | + * |
|
| 57 | + * @since 1.0.0 |
|
| 58 | + */ |
|
| 59 | + public function lsx_customizer_color_palette_css() { |
|
| 60 | + $styles = ' |
|
| 61 | 61 | .container #primary.content-area .has-primary-color-background-color { |
| 62 | 62 | background-color:' . get_theme_mod( 'primary_color', '#428bca' ) . '; |
| 63 | 63 | } |
@@ -136,132 +136,132 @@ discard block |
||
| 136 | 136 | } |
| 137 | 137 | |
| 138 | 138 | '; |
| 139 | - wp_add_inline_style( 'lsx-customizer', $styles ); |
|
| 140 | - } |
|
| 141 | - |
|
| 142 | - /** |
|
| 143 | - * Layout. |
|
| 144 | - * |
|
| 145 | - * @since 1.0.0 |
|
| 146 | - */ |
|
| 147 | - public function layout() { |
|
| 148 | - $theme_credit = get_theme_mod( 'lsx_theme_credit_status', true ); |
|
| 149 | - |
|
| 150 | - if ( false == $theme_credit ) { |
|
| 151 | - add_filter( 'lsx_credit_link', '__return_false' ); |
|
| 152 | - } |
|
| 153 | - } |
|
| 154 | - |
|
| 155 | - /** |
|
| 156 | - * Create the distraction free checkout. |
|
| 157 | - * |
|
| 158 | - * @since 1.0.0 |
|
| 159 | - * @return void |
|
| 160 | - */ |
|
| 161 | - public function lsx_distraction_free_checkout() { |
|
| 162 | - |
|
| 163 | - $distraction_free = get_theme_mod( 'lsx_distraction_free_checkout', false ); |
|
| 164 | - |
|
| 165 | - if ( is_checkout() && ! empty( $distraction_free ) ) { |
|
| 166 | - remove_action( 'lsx_body_bottom', 'lsx_wc_footer_bar', 15 ); |
|
| 167 | - |
|
| 168 | - } |
|
| 169 | - } |
|
| 170 | - |
|
| 171 | - /** |
|
| 172 | - * Create the two step checkout. |
|
| 173 | - * |
|
| 174 | - * @since 1.0.0 |
|
| 175 | - * @return void |
|
| 176 | - */ |
|
| 177 | - public function lsx_customizer_two_step_checkout() { |
|
| 178 | - $two_step_checkout = get_theme_mod( 'lsx_two_step_checkout', false ); |
|
| 179 | - |
|
| 180 | - if ( is_checkout() && ! empty( $two_step_checkout ) ) { |
|
| 181 | - add_action( 'woocommerce_checkout_before_customer_details', 'lsx_customizer_checkout_form_wrapper_div', 1 ); |
|
| 182 | - add_action( 'woocommerce_checkout_before_customer_details', 'lsx_customizer_checkout_form_wrapper', 2 ); |
|
| 183 | - add_action( 'woocommerce_checkout_order_review', 'lsx_customizer_close_div', 30 ); |
|
| 184 | - add_action( 'woocommerce_checkout_order_review', 'lsx_customizer_close_ul', 30 ); |
|
| 185 | - add_action( 'woocommerce_checkout_before_customer_details', 'lsx_customizer_address_wrapper', 5 ); |
|
| 186 | - add_action( 'woocommerce_checkout_after_customer_details', 'lsx_customizer_close_li' ); |
|
| 187 | - add_action( 'wp_footer', 'lsx_customizer_fire_flexslider' ); |
|
| 188 | - add_action( 'woocommerce_checkout_before_order_review', 'lsx_customizer_order_review_wrap', 1 ); |
|
| 189 | - add_action( 'woocommerce_checkout_after_order_review', 'lsx_customizer_close_li', 40 ); |
|
| 190 | - } |
|
| 191 | - } |
|
| 192 | - |
|
| 193 | - /** |
|
| 194 | - * Editor color palette. |
|
| 195 | - * |
|
| 196 | - * @return void |
|
| 197 | - */ |
|
| 198 | - public function lsx_customizer_color_palette_setup() { |
|
| 199 | - add_theme_support( 'editor-color-palette', array( |
|
| 200 | - array( |
|
| 201 | - 'name' => esc_html__( 'Primary Color', 'lsx-customizer' ), |
|
| 202 | - 'slug' => 'primary-color', |
|
| 203 | - 'color' => get_theme_mod( 'primary_color', '#428bca' ), |
|
| 204 | - ), |
|
| 205 | - array( |
|
| 206 | - 'name' => esc_html__( 'Strong Primary Color', 'lsx-customizer' ), |
|
| 207 | - 'slug' => 'strong-primary-color', |
|
| 208 | - 'color' => get_theme_mod( 'strong_primary_color', '#2a6496' ), |
|
| 209 | - ), |
|
| 210 | - array( |
|
| 211 | - 'name' => esc_html__( 'CTA Color', 'lsx-customizer' ), |
|
| 212 | - 'slug' => 'cta-color', |
|
| 213 | - 'color' => get_theme_mod( 'call_to_action_color', '#f7941d' ), |
|
| 214 | - ), |
|
| 215 | - array( |
|
| 216 | - 'name' => esc_html__( 'Strong CTA Color', 'lsx-customizer' ), |
|
| 217 | - 'slug' => 'strong-cta-color', |
|
| 218 | - 'color' => get_theme_mod( 'strong_cta_color', '#f7741d' ), |
|
| 219 | - ), |
|
| 220 | - array( |
|
| 221 | - 'name' => esc_html__( 'Secondary Color', 'lsx-customizer' ), |
|
| 222 | - 'slug' => 'secondary-color', |
|
| 223 | - 'color' => get_theme_mod( 'secondary_color', '#eaeaea' ), |
|
| 224 | - ), |
|
| 225 | - array( |
|
| 226 | - 'name' => esc_html__( 'Strong Secondary Color', 'lsx-customizer' ), |
|
| 227 | - 'slug' => 'strong-secondary-color', |
|
| 228 | - 'color' => get_theme_mod( 'strong_secondary_color', '#c4c4c4' ), |
|
| 229 | - ), |
|
| 230 | - array( |
|
| 231 | - 'name' => esc_html__( 'Tertiary Color', 'lsx-customizer' ), |
|
| 232 | - 'slug' => 'tertiary-color', |
|
| 233 | - 'color' => get_theme_mod( 'tertiary_color', '#6BA913' ), |
|
| 234 | - ), |
|
| 235 | - array( |
|
| 236 | - 'name' => esc_html__( 'Strong Tertiary Color', 'lsx-customizer' ), |
|
| 237 | - 'slug' => 'strong-tertiary-color', |
|
| 238 | - 'color' => get_theme_mod( 'strong_tertiary_color', '#3F640B' ), |
|
| 239 | - ), |
|
| 240 | - array( |
|
| 241 | - 'name' => esc_html__( 'Heading Color', 'lsx-customizer' ), |
|
| 242 | - 'slug' => 'heading-color', |
|
| 243 | - 'color' => get_theme_mod( 'heading_color_color', '#4a4a4a' ), |
|
| 244 | - ), |
|
| 245 | - array( |
|
| 246 | - 'name' => esc_html__( 'Body Color', 'lsx-customizer' ), |
|
| 247 | - 'slug' => 'body-color', |
|
| 248 | - 'color' => get_theme_mod( 'body_text_color_color', '#444444' ), |
|
| 249 | - ), |
|
| 250 | - array( |
|
| 251 | - 'name' => esc_html__( 'White', 'lsx-customizer' ), |
|
| 252 | - 'slug' => 'white', |
|
| 253 | - 'color' => '#ffffff', |
|
| 254 | - ), |
|
| 255 | - array( |
|
| 256 | - 'name' => esc_html__( 'Black', 'lsx-customizer' ), |
|
| 257 | - 'slug' => 'black', |
|
| 258 | - 'color' => '#000000', |
|
| 259 | - ), |
|
| 260 | - )); |
|
| 261 | - } |
|
| 262 | - |
|
| 263 | - } |
|
| 264 | - |
|
| 265 | - new LSX_Customizer_Frontend; |
|
| 139 | + wp_add_inline_style( 'lsx-customizer', $styles ); |
|
| 140 | + } |
|
| 141 | + |
|
| 142 | + /** |
|
| 143 | + * Layout. |
|
| 144 | + * |
|
| 145 | + * @since 1.0.0 |
|
| 146 | + */ |
|
| 147 | + public function layout() { |
|
| 148 | + $theme_credit = get_theme_mod( 'lsx_theme_credit_status', true ); |
|
| 149 | + |
|
| 150 | + if ( false == $theme_credit ) { |
|
| 151 | + add_filter( 'lsx_credit_link', '__return_false' ); |
|
| 152 | + } |
|
| 153 | + } |
|
| 154 | + |
|
| 155 | + /** |
|
| 156 | + * Create the distraction free checkout. |
|
| 157 | + * |
|
| 158 | + * @since 1.0.0 |
|
| 159 | + * @return void |
|
| 160 | + */ |
|
| 161 | + public function lsx_distraction_free_checkout() { |
|
| 162 | + |
|
| 163 | + $distraction_free = get_theme_mod( 'lsx_distraction_free_checkout', false ); |
|
| 164 | + |
|
| 165 | + if ( is_checkout() && ! empty( $distraction_free ) ) { |
|
| 166 | + remove_action( 'lsx_body_bottom', 'lsx_wc_footer_bar', 15 ); |
|
| 167 | + |
|
| 168 | + } |
|
| 169 | + } |
|
| 170 | + |
|
| 171 | + /** |
|
| 172 | + * Create the two step checkout. |
|
| 173 | + * |
|
| 174 | + * @since 1.0.0 |
|
| 175 | + * @return void |
|
| 176 | + */ |
|
| 177 | + public function lsx_customizer_two_step_checkout() { |
|
| 178 | + $two_step_checkout = get_theme_mod( 'lsx_two_step_checkout', false ); |
|
| 179 | + |
|
| 180 | + if ( is_checkout() && ! empty( $two_step_checkout ) ) { |
|
| 181 | + add_action( 'woocommerce_checkout_before_customer_details', 'lsx_customizer_checkout_form_wrapper_div', 1 ); |
|
| 182 | + add_action( 'woocommerce_checkout_before_customer_details', 'lsx_customizer_checkout_form_wrapper', 2 ); |
|
| 183 | + add_action( 'woocommerce_checkout_order_review', 'lsx_customizer_close_div', 30 ); |
|
| 184 | + add_action( 'woocommerce_checkout_order_review', 'lsx_customizer_close_ul', 30 ); |
|
| 185 | + add_action( 'woocommerce_checkout_before_customer_details', 'lsx_customizer_address_wrapper', 5 ); |
|
| 186 | + add_action( 'woocommerce_checkout_after_customer_details', 'lsx_customizer_close_li' ); |
|
| 187 | + add_action( 'wp_footer', 'lsx_customizer_fire_flexslider' ); |
|
| 188 | + add_action( 'woocommerce_checkout_before_order_review', 'lsx_customizer_order_review_wrap', 1 ); |
|
| 189 | + add_action( 'woocommerce_checkout_after_order_review', 'lsx_customizer_close_li', 40 ); |
|
| 190 | + } |
|
| 191 | + } |
|
| 192 | + |
|
| 193 | + /** |
|
| 194 | + * Editor color palette. |
|
| 195 | + * |
|
| 196 | + * @return void |
|
| 197 | + */ |
|
| 198 | + public function lsx_customizer_color_palette_setup() { |
|
| 199 | + add_theme_support( 'editor-color-palette', array( |
|
| 200 | + array( |
|
| 201 | + 'name' => esc_html__( 'Primary Color', 'lsx-customizer' ), |
|
| 202 | + 'slug' => 'primary-color', |
|
| 203 | + 'color' => get_theme_mod( 'primary_color', '#428bca' ), |
|
| 204 | + ), |
|
| 205 | + array( |
|
| 206 | + 'name' => esc_html__( 'Strong Primary Color', 'lsx-customizer' ), |
|
| 207 | + 'slug' => 'strong-primary-color', |
|
| 208 | + 'color' => get_theme_mod( 'strong_primary_color', '#2a6496' ), |
|
| 209 | + ), |
|
| 210 | + array( |
|
| 211 | + 'name' => esc_html__( 'CTA Color', 'lsx-customizer' ), |
|
| 212 | + 'slug' => 'cta-color', |
|
| 213 | + 'color' => get_theme_mod( 'call_to_action_color', '#f7941d' ), |
|
| 214 | + ), |
|
| 215 | + array( |
|
| 216 | + 'name' => esc_html__( 'Strong CTA Color', 'lsx-customizer' ), |
|
| 217 | + 'slug' => 'strong-cta-color', |
|
| 218 | + 'color' => get_theme_mod( 'strong_cta_color', '#f7741d' ), |
|
| 219 | + ), |
|
| 220 | + array( |
|
| 221 | + 'name' => esc_html__( 'Secondary Color', 'lsx-customizer' ), |
|
| 222 | + 'slug' => 'secondary-color', |
|
| 223 | + 'color' => get_theme_mod( 'secondary_color', '#eaeaea' ), |
|
| 224 | + ), |
|
| 225 | + array( |
|
| 226 | + 'name' => esc_html__( 'Strong Secondary Color', 'lsx-customizer' ), |
|
| 227 | + 'slug' => 'strong-secondary-color', |
|
| 228 | + 'color' => get_theme_mod( 'strong_secondary_color', '#c4c4c4' ), |
|
| 229 | + ), |
|
| 230 | + array( |
|
| 231 | + 'name' => esc_html__( 'Tertiary Color', 'lsx-customizer' ), |
|
| 232 | + 'slug' => 'tertiary-color', |
|
| 233 | + 'color' => get_theme_mod( 'tertiary_color', '#6BA913' ), |
|
| 234 | + ), |
|
| 235 | + array( |
|
| 236 | + 'name' => esc_html__( 'Strong Tertiary Color', 'lsx-customizer' ), |
|
| 237 | + 'slug' => 'strong-tertiary-color', |
|
| 238 | + 'color' => get_theme_mod( 'strong_tertiary_color', '#3F640B' ), |
|
| 239 | + ), |
|
| 240 | + array( |
|
| 241 | + 'name' => esc_html__( 'Heading Color', 'lsx-customizer' ), |
|
| 242 | + 'slug' => 'heading-color', |
|
| 243 | + 'color' => get_theme_mod( 'heading_color_color', '#4a4a4a' ), |
|
| 244 | + ), |
|
| 245 | + array( |
|
| 246 | + 'name' => esc_html__( 'Body Color', 'lsx-customizer' ), |
|
| 247 | + 'slug' => 'body-color', |
|
| 248 | + 'color' => get_theme_mod( 'body_text_color_color', '#444444' ), |
|
| 249 | + ), |
|
| 250 | + array( |
|
| 251 | + 'name' => esc_html__( 'White', 'lsx-customizer' ), |
|
| 252 | + 'slug' => 'white', |
|
| 253 | + 'color' => '#ffffff', |
|
| 254 | + ), |
|
| 255 | + array( |
|
| 256 | + 'name' => esc_html__( 'Black', 'lsx-customizer' ), |
|
| 257 | + 'slug' => 'black', |
|
| 258 | + 'color' => '#000000', |
|
| 259 | + ), |
|
| 260 | + )); |
|
| 261 | + } |
|
| 262 | + |
|
| 263 | + } |
|
| 264 | + |
|
| 265 | + new LSX_Customizer_Frontend; |
|
| 266 | 266 | |
| 267 | 267 | } |
@@ -1,66 +1,66 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | if ( ! class_exists( 'LSX_Customizer_Colour_Control' ) ) { |
| 3 | 3 | |
| 4 | - /** |
|
| 5 | - * LSX Customizer Colour Control Class |
|
| 6 | - * |
|
| 7 | - * @package LSX Customizer |
|
| 8 | - * @author LightSpeed |
|
| 9 | - * @license GPL3 |
|
| 10 | - * @link |
|
| 11 | - * @copyright 2016 LightSpeed |
|
| 12 | - */ |
|
| 13 | - class LSX_Customizer_Colour_Control extends WP_Customize_Control { |
|
| 4 | + /** |
|
| 5 | + * LSX Customizer Colour Control Class |
|
| 6 | + * |
|
| 7 | + * @package LSX Customizer |
|
| 8 | + * @author LightSpeed |
|
| 9 | + * @license GPL3 |
|
| 10 | + * @link |
|
| 11 | + * @copyright 2016 LightSpeed |
|
| 12 | + */ |
|
| 13 | + class LSX_Customizer_Colour_Control extends WP_Customize_Control { |
|
| 14 | 14 | |
| 15 | - /** |
|
| 16 | - * Enqueue control related scripts/styles. |
|
| 17 | - * |
|
| 18 | - * @since 1.0.0 |
|
| 19 | - */ |
|
| 20 | - public function enqueue() { |
|
| 21 | - wp_enqueue_script( 'lsx_customizer_colour_admin', LSX_CUSTOMIZER_URL . 'assets/js/lsx-customizer-colour-admin.min.js', array( 'customize-controls', 'iris', 'underscore', 'wp-util' ), LSX_CUSTOMIZER_VER, true ); |
|
| 22 | - wp_localize_script( 'lsx_customizer_colour_admin', 'color_scheme', $this->choices ); |
|
| 15 | + /** |
|
| 16 | + * Enqueue control related scripts/styles. |
|
| 17 | + * |
|
| 18 | + * @since 1.0.0 |
|
| 19 | + */ |
|
| 20 | + public function enqueue() { |
|
| 21 | + wp_enqueue_script( 'lsx_customizer_colour_admin', LSX_CUSTOMIZER_URL . 'assets/js/lsx-customizer-colour-admin.min.js', array( 'customize-controls', 'iris', 'underscore', 'wp-util' ), LSX_CUSTOMIZER_VER, true ); |
|
| 22 | + wp_localize_script( 'lsx_customizer_colour_admin', 'color_scheme', $this->choices ); |
|
| 23 | 23 | |
| 24 | - global $customizer_colour_names; |
|
| 25 | - $colors = array(); |
|
| 26 | - foreach ( $customizer_colour_names as $key => $value ) { |
|
| 27 | - $colors[] = $key; |
|
| 28 | - } |
|
| 29 | - wp_localize_script( 'lsx_customizer_colour_admin', 'color_scheme_keys', $colors ); |
|
| 30 | - } |
|
| 24 | + global $customizer_colour_names; |
|
| 25 | + $colors = array(); |
|
| 26 | + foreach ( $customizer_colour_names as $key => $value ) { |
|
| 27 | + $colors[] = $key; |
|
| 28 | + } |
|
| 29 | + wp_localize_script( 'lsx_customizer_colour_admin', 'color_scheme_keys', $colors ); |
|
| 30 | + } |
|
| 31 | 31 | |
| 32 | - /** |
|
| 33 | - * Render the control's content. |
|
| 34 | - * |
|
| 35 | - * @since 1.0.0 |
|
| 36 | - */ |
|
| 37 | - public function render_content() { |
|
| 38 | - if ( empty( $this->choices ) ) { |
|
| 39 | - return; |
|
| 40 | - } |
|
| 32 | + /** |
|
| 33 | + * Render the control's content. |
|
| 34 | + * |
|
| 35 | + * @since 1.0.0 |
|
| 36 | + */ |
|
| 37 | + public function render_content() { |
|
| 38 | + if ( empty( $this->choices ) ) { |
|
| 39 | + return; |
|
| 40 | + } |
|
| 41 | 41 | |
| 42 | - ?> |
|
| 42 | + ?> |
|
| 43 | 43 | <label> |
| 44 | 44 | <?php if ( ! empty( $this->label ) ) { ?> |
| 45 | 45 | <span class="customize-control-title"><?php echo esc_html( $this->label ); ?></span> |
| 46 | 46 | <?php |
| 47 | 47 | } |
| 48 | 48 | if ( ! empty( $this->description ) ) { |
| 49 | - ?> |
|
| 49 | + ?> |
|
| 50 | 50 | <span class="description customize-control-description"><?php echo esc_html( $this->description ); ?></span> |
| 51 | 51 | <?php } ?> |
| 52 | 52 | <select <?php $this->link(); ?>> |
| 53 | 53 | <?php |
| 54 | - foreach ( $this->choices as $value => $label ) { |
|
| 55 | - echo '<option value="' . esc_attr( $value ) . '"' . selected( $this->value(), $value, false ) . '>' . esc_html( $label['label'] ) . '</option>'; |
|
| 56 | - } |
|
| 57 | - ?> |
|
| 54 | + foreach ( $this->choices as $value => $label ) { |
|
| 55 | + echo '<option value="' . esc_attr( $value ) . '"' . selected( $this->value(), $value, false ) . '>' . esc_html( $label['label'] ) . '</option>'; |
|
| 56 | + } |
|
| 57 | + ?> |
|
| 58 | 58 | </select> |
| 59 | 59 | </label> |
| 60 | 60 | <?php |
| 61 | - } |
|
| 61 | + } |
|
| 62 | 62 | |
| 63 | - } |
|
| 63 | + } |
|
| 64 | 64 | |
| 65 | 65 | } |
| 66 | 66 | |
@@ -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,62 +1,62 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | if ( ! class_exists( 'LSX_Customizer_Admin' ) ) { |
| 3 | 3 | |
| 4 | - /** |
|
| 5 | - * LSX Customizer Admin Class |
|
| 6 | - * |
|
| 7 | - * @package LSX Customizer |
|
| 8 | - * @author LightSpeed |
|
| 9 | - * @license GPL3 |
|
| 10 | - * @link |
|
| 11 | - * @copyright 2016 LightSpeed |
|
| 12 | - */ |
|
| 13 | - class LSX_Customizer_Admin extends LSX_Customizer { |
|
| 4 | + /** |
|
| 5 | + * LSX Customizer Admin Class |
|
| 6 | + * |
|
| 7 | + * @package LSX Customizer |
|
| 8 | + * @author LightSpeed |
|
| 9 | + * @license GPL3 |
|
| 10 | + * @link |
|
| 11 | + * @copyright 2016 LightSpeed |
|
| 12 | + */ |
|
| 13 | + class LSX_Customizer_Admin extends LSX_Customizer { |
|
| 14 | 14 | |
| 15 | - /** |
|
| 16 | - * Constructor. |
|
| 17 | - * |
|
| 18 | - * @since 1.0.0 |
|
| 19 | - */ |
|
| 20 | - public function __construct() { |
|
| 21 | - add_action( 'customize_preview_init', array( $this, 'assets' ), 9999 ); |
|
| 22 | - add_action( 'customize_controls_enqueue_scripts', array( $this, 'assets_wysiwyg_editor' ), 9999 ); |
|
| 15 | + /** |
|
| 16 | + * Constructor. |
|
| 17 | + * |
|
| 18 | + * @since 1.0.0 |
|
| 19 | + */ |
|
| 20 | + public function __construct() { |
|
| 21 | + add_action( 'customize_preview_init', array( $this, 'assets' ), 9999 ); |
|
| 22 | + add_action( 'customize_controls_enqueue_scripts', array( $this, 'assets_wysiwyg_editor' ), 9999 ); |
|
| 23 | 23 | |
| 24 | - if ( is_admin() ) { |
|
| 25 | - add_filter( 'lsx_customizer_colour_selectors_body', array( $this, 'customizer_body_colours_handler' ), 15, 2 ); |
|
| 26 | - } |
|
| 27 | - } |
|
| 24 | + if ( is_admin() ) { |
|
| 25 | + add_filter( 'lsx_customizer_colour_selectors_body', array( $this, 'customizer_body_colours_handler' ), 15, 2 ); |
|
| 26 | + } |
|
| 27 | + } |
|
| 28 | 28 | |
| 29 | - /** |
|
| 30 | - * Enques the assets. |
|
| 31 | - * |
|
| 32 | - * @since 1.0.0 |
|
| 33 | - */ |
|
| 34 | - public function assets() { |
|
| 35 | - wp_enqueue_script( 'lsx_customizer_admin', LSX_CUSTOMIZER_URL . 'assets/js/lsx-customizer-admin.min.js', array( 'jquery' ), LSX_CUSTOMIZER_VER, true ); |
|
| 29 | + /** |
|
| 30 | + * Enques the assets. |
|
| 31 | + * |
|
| 32 | + * @since 1.0.0 |
|
| 33 | + */ |
|
| 34 | + public function assets() { |
|
| 35 | + wp_enqueue_script( 'lsx_customizer_admin', LSX_CUSTOMIZER_URL . 'assets/js/lsx-customizer-admin.min.js', array( 'jquery' ), LSX_CUSTOMIZER_VER, true ); |
|
| 36 | 36 | |
| 37 | - $params = apply_filters( 'lsx_customizer_admin_js_params', array( |
|
| 38 | - 'ajax_url' => admin_url( 'admin-ajax.php' ), |
|
| 39 | - )); |
|
| 37 | + $params = apply_filters( 'lsx_customizer_admin_js_params', array( |
|
| 38 | + 'ajax_url' => admin_url( 'admin-ajax.php' ), |
|
| 39 | + )); |
|
| 40 | 40 | |
| 41 | - wp_localize_script( 'lsx_customizer_admin', 'lsx_customizer_params', $params ); |
|
| 41 | + wp_localize_script( 'lsx_customizer_admin', 'lsx_customizer_params', $params ); |
|
| 42 | 42 | |
| 43 | - wp_enqueue_style( 'lsx_customizer_admin', LSX_CUSTOMIZER_URL . 'assets/css/lsx-customizer-admin.css', array(), LSX_CUSTOMIZER_VER ); |
|
| 44 | - } |
|
| 43 | + wp_enqueue_style( 'lsx_customizer_admin', LSX_CUSTOMIZER_URL . 'assets/css/lsx-customizer-admin.css', array(), LSX_CUSTOMIZER_VER ); |
|
| 44 | + } |
|
| 45 | 45 | |
| 46 | - /** |
|
| 47 | - * Enques the assets for editor. |
|
| 48 | - * |
|
| 49 | - * @since 1.1.1 |
|
| 50 | - */ |
|
| 51 | - public function assets_wysiwyg_editor() { |
|
| 52 | - wp_enqueue_script( 'lsx_customizer_editor', LSX_CUSTOMIZER_URL . 'assets/js/lsx-customizer-editor.min.js', array( 'jquery' ), LSX_CUSTOMIZER_VER, true ); |
|
| 53 | - } |
|
| 46 | + /** |
|
| 47 | + * Enques the assets for editor. |
|
| 48 | + * |
|
| 49 | + * @since 1.1.1 |
|
| 50 | + */ |
|
| 51 | + public function assets_wysiwyg_editor() { |
|
| 52 | + wp_enqueue_script( 'lsx_customizer_editor', LSX_CUSTOMIZER_URL . 'assets/js/lsx-customizer-editor.min.js', array( 'jquery' ), LSX_CUSTOMIZER_VER, true ); |
|
| 53 | + } |
|
| 54 | 54 | |
| 55 | - /** |
|
| 56 | - * Handle body colours that might be change by LSX Customiser. |
|
| 57 | - */ |
|
| 58 | - public function customizer_body_colours_handler( $css, $colors ) { |
|
| 59 | - $css .= ' |
|
| 55 | + /** |
|
| 56 | + * Handle body colours that might be change by LSX Customiser. |
|
| 57 | + */ |
|
| 58 | + public function customizer_body_colours_handler( $css, $colors ) { |
|
| 59 | + $css .= ' |
|
| 60 | 60 | @import "' . LSX_CUSTOMIZER_PATH . '/assets/css/scss/customizer-customizer-body-colours"; |
| 61 | 61 | |
| 62 | 62 | /** |
@@ -73,11 +73,11 @@ discard block |
||
| 73 | 73 | ); |
| 74 | 74 | '; |
| 75 | 75 | |
| 76 | - return $css; |
|
| 77 | - } |
|
| 76 | + return $css; |
|
| 77 | + } |
|
| 78 | 78 | |
| 79 | - } |
|
| 79 | + } |
|
| 80 | 80 | |
| 81 | - new LSX_Customizer_Admin(); |
|
| 81 | + new LSX_Customizer_Admin(); |
|
| 82 | 82 | |
| 83 | 83 | } |
@@ -1,103 +1,103 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | if ( ! class_exists( 'LSX_Customizer_Colour_Footer_Widgets' ) ) { |
| 3 | 3 | |
| 4 | - /** |
|
| 5 | - * LSX Customizer Colour Footer Widgets 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_Widgets 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_widgets_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_widgets_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_widgets_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_widgets', array( |
|
| 70 | - 'footer_widgets_background_color' => get_theme_mod( 'footer_widgets_background_color', $colors['footer_widgets_background_color'] ), |
|
| 71 | - 'footer_widgets_text_color' => get_theme_mod( 'footer_widgets_text_color', $colors['footer_widgets_text_color'] ), |
|
| 72 | - 'footer_widgets_link_color' => get_theme_mod( 'footer_widgets_link_color', $colors['footer_widgets_link_color'] ), |
|
| 73 | - 'footer_widgets_link_hover_color' => get_theme_mod( 'footer_widgets_link_hover_color', $colors['footer_widgets_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_widgets_background_color'] ) |
|
| 94 | - || empty( $colors['footer_widgets_text_color'] ) |
|
| 95 | - || empty( $colors['footer_widgets_link_color'] ) |
|
| 96 | - || empty( $colors['footer_widgets_link_hover_color'] ) ) { |
|
| 97 | - return ''; |
|
| 98 | - } |
|
| 99 | - |
|
| 100 | - $css = ' |
|
| 4 | + /** |
|
| 5 | + * LSX Customizer Colour Footer Widgets 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_Widgets 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_widgets_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_widgets_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_widgets_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_widgets', array( |
|
| 70 | + 'footer_widgets_background_color' => get_theme_mod( 'footer_widgets_background_color', $colors['footer_widgets_background_color'] ), |
|
| 71 | + 'footer_widgets_text_color' => get_theme_mod( 'footer_widgets_text_color', $colors['footer_widgets_text_color'] ), |
|
| 72 | + 'footer_widgets_link_color' => get_theme_mod( 'footer_widgets_link_color', $colors['footer_widgets_link_color'] ), |
|
| 73 | + 'footer_widgets_link_hover_color' => get_theme_mod( 'footer_widgets_link_hover_color', $colors['footer_widgets_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_widgets_background_color'] ) |
|
| 94 | + || empty( $colors['footer_widgets_text_color'] ) |
|
| 95 | + || empty( $colors['footer_widgets_link_color'] ) |
|
| 96 | + || empty( $colors['footer_widgets_link_hover_color'] ) ) { |
|
| 97 | + return ''; |
|
| 98 | + } |
|
| 99 | + |
|
| 100 | + $css = ' |
|
| 101 | 101 | @import "' . get_template_directory() . '/assets/css/scss/global/mixins/footer-widgets"; |
| 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_widgets', $css, $colors ); |
|
| 115 | - $css = parent::scss_to_css( $css ); |
|
| 114 | + $css = apply_filters( 'lsx_customizer_colour_selectors_footer_widgets', $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,57 +1,57 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | if ( ! class_exists( 'LSX_Customizer_Wysiwyg_Control' ) ) { |
| 3 | 3 | |
| 4 | - /** |
|
| 5 | - * LSX Customizer Wysiwyg Control Class |
|
| 6 | - * |
|
| 7 | - * @package LSX Customizer |
|
| 8 | - * @author LightSpeed |
|
| 9 | - * @license GPL3 |
|
| 10 | - * @link |
|
| 11 | - * @copyright 2016 LightSpeed |
|
| 12 | - */ |
|
| 13 | - class LSX_Customizer_Wysiwyg_Control extends WP_Customize_Control { |
|
| 14 | - |
|
| 15 | - public $type = 'wysiwyg'; |
|
| 16 | - |
|
| 17 | - /** |
|
| 18 | - * Render the control's content. |
|
| 19 | - * |
|
| 20 | - * @since 1.1.1 |
|
| 21 | - */ |
|
| 22 | - public function render_content() { |
|
| 23 | - ?> |
|
| 4 | + /** |
|
| 5 | + * LSX Customizer Wysiwyg Control Class |
|
| 6 | + * |
|
| 7 | + * @package LSX Customizer |
|
| 8 | + * @author LightSpeed |
|
| 9 | + * @license GPL3 |
|
| 10 | + * @link |
|
| 11 | + * @copyright 2016 LightSpeed |
|
| 12 | + */ |
|
| 13 | + class LSX_Customizer_Wysiwyg_Control extends WP_Customize_Control { |
|
| 14 | + |
|
| 15 | + public $type = 'wysiwyg'; |
|
| 16 | + |
|
| 17 | + /** |
|
| 18 | + * Render the control's content. |
|
| 19 | + * |
|
| 20 | + * @since 1.1.1 |
|
| 21 | + */ |
|
| 22 | + public function render_content() { |
|
| 23 | + ?> |
|
| 24 | 24 | <label> |
| 25 | 25 | <?php if ( ! empty( $this->label ) ) { ?> |
| 26 | 26 | <span class="customize-control-title"><?php echo esc_html( $this->label ) ?></span> |
| 27 | 27 | <?php } ?> |
| 28 | 28 | <?php |
| 29 | - $settings = array( |
|
| 30 | - 'media_buttons' => false, |
|
| 31 | - 'teeny' => true, |
|
| 32 | - ); |
|
| 33 | - |
|
| 34 | - $this->filter_editor_setting_link(); |
|
| 35 | - wp_editor( $this->value(), $this->id, $settings ); |
|
| 36 | - ?> |
|
| 29 | + $settings = array( |
|
| 30 | + 'media_buttons' => false, |
|
| 31 | + 'teeny' => true, |
|
| 32 | + ); |
|
| 33 | + |
|
| 34 | + $this->filter_editor_setting_link(); |
|
| 35 | + wp_editor( $this->value(), $this->id, $settings ); |
|
| 36 | + ?> |
|
| 37 | 37 | </label> |
| 38 | 38 | <?php |
| 39 | - do_action( 'admin_footer' ); |
|
| 40 | - do_action( 'admin_print_footer_scripts' ); |
|
| 41 | - } |
|
| 42 | - |
|
| 43 | - /** |
|
| 44 | - * Filter editor setting link. |
|
| 45 | - * |
|
| 46 | - * @since 1.1.1 |
|
| 47 | - */ |
|
| 48 | - private function filter_editor_setting_link() { |
|
| 49 | - add_filter( 'the_editor', function( $output ) { |
|
| 50 | - return preg_replace( '/<textarea/', '<textarea ' . $this->get_link(), $output, 1 ); |
|
| 51 | - } ); |
|
| 52 | - } |
|
| 53 | - |
|
| 54 | - } |
|
| 39 | + do_action( 'admin_footer' ); |
|
| 40 | + do_action( 'admin_print_footer_scripts' ); |
|
| 41 | + } |
|
| 42 | + |
|
| 43 | + /** |
|
| 44 | + * Filter editor setting link. |
|
| 45 | + * |
|
| 46 | + * @since 1.1.1 |
|
| 47 | + */ |
|
| 48 | + private function filter_editor_setting_link() { |
|
| 49 | + add_filter( 'the_editor', function( $output ) { |
|
| 50 | + return preg_replace( '/<textarea/', '<textarea ' . $this->get_link(), $output, 1 ); |
|
| 51 | + } ); |
|
| 52 | + } |
|
| 53 | + |
|
| 54 | + } |
|
| 55 | 55 | |
| 56 | 56 | } |
| 57 | 57 | |