@@ -1,22 +1,22 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | -if ( ! defined( 'ABSPATH' ) ) return; // Exit if accessed directly |
|
| 2 | +if ( ! defined('ABSPATH')) return; // Exit if accessed directly |
|
| 3 | 3 | |
| 4 | 4 | /** |
| 5 | 5 | * Transform SCSS to CSS |
| 6 | 6 | */ |
| 7 | -function lsx_customizer_colour__scss_to_css( $scss ) { |
|
| 7 | +function lsx_customizer_colour__scss_to_css($scss) { |
|
| 8 | 8 | $css = ''; |
| 9 | - $scssphp_file = get_template_directory() .'/vendor/leafo/scssphp/scss.inc.php'; |
|
| 9 | + $scssphp_file = get_template_directory() . '/vendor/leafo/scssphp/scss.inc.php'; |
|
| 10 | 10 | |
| 11 | - if ( ! empty( $scss ) && file_exists( $scssphp_file ) ) { |
|
| 11 | + if ( ! empty($scss) && file_exists($scssphp_file)) { |
|
| 12 | 12 | require_once $scssphp_file; |
| 13 | 13 | |
| 14 | 14 | $compiler = new \Leafo\ScssPhp\Compiler(); |
| 15 | - $compiler->setFormatter( 'Leafo\ScssPhp\Formatter\Compact' ); |
|
| 15 | + $compiler->setFormatter('Leafo\ScssPhp\Formatter\Compact'); |
|
| 16 | 16 | |
| 17 | 17 | try { |
| 18 | - $css = $compiler->compile( $scss ); |
|
| 19 | - } catch ( Exception $e ) { |
|
| 18 | + $css = $compiler->compile($scss); |
|
| 19 | + } catch (Exception $e) { |
|
| 20 | 20 | $error = $e->getMessage(); |
| 21 | 21 | return "/*\n\n\$error:\n\n{$error}\n\n\$scss:\n\n{$scss} */"; |
| 22 | 22 | } |
@@ -29,9 +29,9 @@ discard block |
||
| 29 | 29 | * |
| 30 | 30 | */ |
| 31 | 31 | function lsx_customizer_colour__add_footer_styles() { |
| 32 | - wp_enqueue_style( 'lsx_customizer_colour', get_stylesheet_uri() ); |
|
| 32 | + wp_enqueue_style('lsx_customizer_colour', get_stylesheet_uri()); |
|
| 33 | 33 | } |
| 34 | -add_action( 'wp_enqueue_scripts', 'lsx_customizer_colour__add_footer_styles', 999 ); |
|
| 34 | +add_action('wp_enqueue_scripts', 'lsx_customizer_colour__add_footer_styles', 999); |
|
| 35 | 35 | |
| 36 | 36 | /** |
| 37 | 37 | * Outputs an Underscore template for generating CSS for the color scheme. |
@@ -41,28 +41,28 @@ discard block |
||
| 41 | 41 | |
| 42 | 42 | $colors = array(); |
| 43 | 43 | |
| 44 | - foreach ( $customizer_colour_names as $key => $value ) { |
|
| 45 | - $colors[$key] = 'unquote("{{ data.'.$key.' }}")'; |
|
| 44 | + foreach ($customizer_colour_names as $key => $value) { |
|
| 45 | + $colors[$key] = 'unquote("{{ data.' . $key . ' }}")'; |
|
| 46 | 46 | } |
| 47 | 47 | ?> |
| 48 | 48 | <script type="text/html" id="tmpl-lsx-color-scheme"> |
| 49 | - <?php echo esc_html( lsx_customizer_colour__top_menu_get_css( $colors ) ) ?> |
|
| 50 | - <?php echo esc_html( lsx_customizer_colour__header_get_css( $colors ) ) ?> |
|
| 51 | - <?php echo esc_html( lsx_customizer_colour__main_menu_get_css( $colors ) ) ?> |
|
| 49 | + <?php echo esc_html(lsx_customizer_colour__top_menu_get_css($colors)) ?> |
|
| 50 | + <?php echo esc_html(lsx_customizer_colour__header_get_css($colors)) ?> |
|
| 51 | + <?php echo esc_html(lsx_customizer_colour__main_menu_get_css($colors)) ?> |
|
| 52 | 52 | |
| 53 | - <?php echo esc_html( lsx_customizer_colour__banner_get_css( $colors ) ) ?> |
|
| 54 | - <?php echo esc_html( lsx_customizer_colour__body_get_css( $colors ) ) ?> |
|
| 53 | + <?php echo esc_html(lsx_customizer_colour__banner_get_css($colors)) ?> |
|
| 54 | + <?php echo esc_html(lsx_customizer_colour__body_get_css($colors)) ?> |
|
| 55 | 55 | |
| 56 | - <?php echo esc_html( lsx_customizer_colour__footer_cta_get_css( $colors ) ) ?> |
|
| 57 | - <?php echo esc_html( lsx_customizer_colour__footer_widgets_get_css( $colors ) ) ?> |
|
| 58 | - <?php echo esc_html( lsx_customizer_colour__footer_get_css( $colors ) ) ?> |
|
| 56 | + <?php echo esc_html(lsx_customizer_colour__footer_cta_get_css($colors)) ?> |
|
| 57 | + <?php echo esc_html(lsx_customizer_colour__footer_widgets_get_css($colors)) ?> |
|
| 58 | + <?php echo esc_html(lsx_customizer_colour__footer_get_css($colors)) ?> |
|
| 59 | 59 | |
| 60 | - <?php echo esc_html( lsx_customizer_colour__button_get_css( $colors ) ) ?> |
|
| 61 | - <?php echo esc_html( lsx_customizer_colour__button_cta_get_css( $colors ) ) ?> |
|
| 60 | + <?php echo esc_html(lsx_customizer_colour__button_get_css($colors)) ?> |
|
| 61 | + <?php echo esc_html(lsx_customizer_colour__button_cta_get_css($colors)) ?> |
|
| 62 | 62 | </script> |
| 63 | 63 | <?php |
| 64 | 64 | } |
| 65 | -add_action( 'customize_controls_print_footer_scripts', 'lsx_customizer_colour__color_scheme_css_template' ); |
|
| 65 | +add_action('customize_controls_print_footer_scripts', 'lsx_customizer_colour__color_scheme_css_template'); |
|
| 66 | 66 | |
| 67 | 67 | /** |
| 68 | 68 | * Retrieves the current color scheme. |
@@ -70,11 +70,11 @@ discard block |
||
| 70 | 70 | function lsx_customizer_colour__get_color_scheme() { |
| 71 | 71 | global $customizer_colour_choices; |
| 72 | 72 | |
| 73 | - $color_scheme_option = get_theme_mod( 'color_scheme', 'default' ); |
|
| 73 | + $color_scheme_option = get_theme_mod('color_scheme', 'default'); |
|
| 74 | 74 | $color_schemes = $customizer_colour_choices; |
| 75 | 75 | |
| 76 | - if ( array_key_exists( $color_scheme_option, $color_schemes ) ) { |
|
| 77 | - return $color_schemes[ $color_scheme_option ]['colors']; |
|
| 76 | + if (array_key_exists($color_scheme_option, $color_schemes)) { |
|
| 77 | + return $color_schemes[$color_scheme_option]['colors']; |
|
| 78 | 78 | } |
| 79 | 79 | |
| 80 | 80 | return $color_schemes['default']['colors']; |
@@ -83,22 +83,22 @@ discard block |
||
| 83 | 83 | /** |
| 84 | 84 | * Converts a HEX value to RGB. |
| 85 | 85 | */ |
| 86 | -function lsx_customizer_colour__hex2rgb( $color ) { |
|
| 87 | - $color = trim( $color, '#' ); |
|
| 88 | - |
|
| 89 | - if ( strlen( $color ) === 3 ) { |
|
| 90 | - $r = hexdec( substr( $color, 0, 1 ).substr( $color, 0, 1 ) ); |
|
| 91 | - $g = hexdec( substr( $color, 1, 1 ).substr( $color, 1, 1 ) ); |
|
| 92 | - $b = hexdec( substr( $color, 2, 1 ).substr( $color, 2, 1 ) ); |
|
| 93 | - } else if ( strlen( $color ) === 6 ) { |
|
| 94 | - $r = hexdec( substr( $color, 0, 2 ) ); |
|
| 95 | - $g = hexdec( substr( $color, 2, 2 ) ); |
|
| 96 | - $b = hexdec( substr( $color, 4, 2 ) ); |
|
| 86 | +function lsx_customizer_colour__hex2rgb($color) { |
|
| 87 | + $color = trim($color, '#'); |
|
| 88 | + |
|
| 89 | + if (strlen($color) === 3) { |
|
| 90 | + $r = hexdec(substr($color, 0, 1) . substr($color, 0, 1)); |
|
| 91 | + $g = hexdec(substr($color, 1, 1) . substr($color, 1, 1)); |
|
| 92 | + $b = hexdec(substr($color, 2, 1) . substr($color, 2, 1)); |
|
| 93 | + } else if (strlen($color) === 6) { |
|
| 94 | + $r = hexdec(substr($color, 0, 2)); |
|
| 95 | + $g = hexdec(substr($color, 2, 2)); |
|
| 96 | + $b = hexdec(substr($color, 4, 2)); |
|
| 97 | 97 | } else { |
| 98 | 98 | return array(); |
| 99 | 99 | } |
| 100 | 100 | |
| 101 | - return array( 'red' => $r, 'green' => $g, 'blue' => $b ); |
|
| 101 | + return array('red' => $r, 'green' => $g, 'blue' => $b); |
|
| 102 | 102 | } |
| 103 | 103 | |
| 104 | 104 | /* ################################################################################# */ |
@@ -109,33 +109,33 @@ discard block |
||
| 109 | 109 | */ |
| 110 | 110 | function lsx_customizer_colour__button_set_theme_mod() { |
| 111 | 111 | $theme_mods = lsx_customizer_colour__button_get_theme_mods(); |
| 112 | - $styles = lsx_customizer_colour__button_get_css( $theme_mods ); |
|
| 112 | + $styles = lsx_customizer_colour__button_get_css($theme_mods); |
|
| 113 | 113 | |
| 114 | - set_theme_mod( 'lsx_customizer_colour__button_theme_mod', $styles ); |
|
| 114 | + set_theme_mod('lsx_customizer_colour__button_theme_mod', $styles); |
|
| 115 | 115 | } |
| 116 | -add_action( 'after_switch_theme', 'lsx_customizer_colour__button_set_theme_mod' ); |
|
| 117 | -add_action( 'customize_save_after', 'lsx_customizer_colour__button_set_theme_mod' ); |
|
| 116 | +add_action('after_switch_theme', 'lsx_customizer_colour__button_set_theme_mod'); |
|
| 117 | +add_action('customize_save_after', 'lsx_customizer_colour__button_set_theme_mod'); |
|
| 118 | 118 | |
| 119 | 119 | /** |
| 120 | 120 | * Enqueues front-end CSS for the button. |
| 121 | 121 | */ |
| 122 | 122 | function lsx_customizer_colour__button_css() { |
| 123 | - $styles_from_theme_mod = get_theme_mod( 'lsx_customizer_colour__button_theme_mod' ); |
|
| 123 | + $styles_from_theme_mod = get_theme_mod('lsx_customizer_colour__button_theme_mod'); |
|
| 124 | 124 | |
| 125 | - if ( is_customize_preview() || false === $styles_from_theme_mod ) { |
|
| 125 | + if (is_customize_preview() || false === $styles_from_theme_mod) { |
|
| 126 | 126 | $theme_mods = lsx_customizer_colour__button_get_theme_mods(); |
| 127 | - $styles = lsx_customizer_colour__button_get_css( $theme_mods ); |
|
| 127 | + $styles = lsx_customizer_colour__button_get_css($theme_mods); |
|
| 128 | 128 | |
| 129 | - if ( false === $styles_from_theme_mod ) { |
|
| 130 | - set_theme_mod( 'lsx_customizer_colour__button_theme_mod', $styles ); |
|
| 129 | + if (false === $styles_from_theme_mod) { |
|
| 130 | + set_theme_mod('lsx_customizer_colour__button_theme_mod', $styles); |
|
| 131 | 131 | } |
| 132 | 132 | } else { |
| 133 | 133 | $styles = $styles_from_theme_mod; |
| 134 | 134 | } |
| 135 | 135 | |
| 136 | - wp_add_inline_style( 'lsx_customizer_colour', $styles ); |
|
| 136 | + wp_add_inline_style('lsx_customizer_colour', $styles); |
|
| 137 | 137 | } |
| 138 | -add_action( 'wp_enqueue_scripts', 'lsx_customizer_colour__button_css', 9999 ); |
|
| 138 | +add_action('wp_enqueue_scripts', 'lsx_customizer_colour__button_css', 9999); |
|
| 139 | 139 | |
| 140 | 140 | /** |
| 141 | 141 | * Get button CSS theme mods. |
@@ -147,32 +147,32 @@ discard block |
||
| 147 | 147 | $colors = array(); |
| 148 | 148 | $counter = 0; |
| 149 | 149 | |
| 150 | - foreach ( $customizer_colour_names as $key => $value ) { |
|
| 150 | + foreach ($customizer_colour_names as $key => $value) { |
|
| 151 | 151 | $colors[$key] = $color_scheme[$counter]; |
| 152 | 152 | $counter++; |
| 153 | 153 | } |
| 154 | 154 | |
| 155 | 155 | return array( |
| 156 | - 'button_background_color' => get_theme_mod( 'button_background_color', $colors['button_background_color'] ), |
|
| 157 | - 'button_background_hover_color' => get_theme_mod( 'button_background_hover_color', $colors['button_background_hover_color'] ), |
|
| 158 | - 'button_text_color' => get_theme_mod( 'button_text_color', $colors['button_text_color'] ), |
|
| 159 | - 'button_text_color_hover' => get_theme_mod( 'button_text_color_hover', $colors['button_text_color_hover'] ) |
|
| 156 | + 'button_background_color' => get_theme_mod('button_background_color', $colors['button_background_color']), |
|
| 157 | + 'button_background_hover_color' => get_theme_mod('button_background_hover_color', $colors['button_background_hover_color']), |
|
| 158 | + 'button_text_color' => get_theme_mod('button_text_color', $colors['button_text_color']), |
|
| 159 | + 'button_text_color_hover' => get_theme_mod('button_text_color_hover', $colors['button_text_color_hover']) |
|
| 160 | 160 | ); |
| 161 | 161 | } |
| 162 | 162 | |
| 163 | 163 | /** |
| 164 | 164 | * Returns CSS for the button. |
| 165 | 165 | */ |
| 166 | -function lsx_customizer_colour__button_get_css( $colors ) { |
|
| 166 | +function lsx_customizer_colour__button_get_css($colors) { |
|
| 167 | 167 | global $customizer_colour_names; |
| 168 | 168 | |
| 169 | 169 | $colors_template = array(); |
| 170 | 170 | |
| 171 | - foreach ( $customizer_colour_names as $key => $value ) { |
|
| 171 | + foreach ($customizer_colour_names as $key => $value) { |
|
| 172 | 172 | $colors_template[$key] = ''; |
| 173 | 173 | } |
| 174 | 174 | |
| 175 | - $colors = wp_parse_args( $colors, $colors_template ); |
|
| 175 | + $colors = wp_parse_args($colors, $colors_template); |
|
| 176 | 176 | |
| 177 | 177 | $css = <<<CSS |
| 178 | 178 | /* |
@@ -370,8 +370,8 @@ discard block |
||
| 370 | 370 | } |
| 371 | 371 | CSS; |
| 372 | 372 | |
| 373 | - $css = apply_filters( 'lsx_customizer_colour_selectors_button', $css, $colors ); |
|
| 374 | - $css = lsx_customizer_colour__scss_to_css( $css ); |
|
| 373 | + $css = apply_filters('lsx_customizer_colour_selectors_button', $css, $colors); |
|
| 374 | + $css = lsx_customizer_colour__scss_to_css($css); |
|
| 375 | 375 | return $css; |
| 376 | 376 | } |
| 377 | 377 | |
@@ -384,33 +384,33 @@ discard block |
||
| 384 | 384 | */ |
| 385 | 385 | function lsx_customizer_colour__button_cta_set_theme_mod() { |
| 386 | 386 | $theme_mods = lsx_customizer_colour__button_cta_get_theme_mods(); |
| 387 | - $styles = lsx_customizer_colour__button_cta_get_css( $theme_mods ); |
|
| 387 | + $styles = lsx_customizer_colour__button_cta_get_css($theme_mods); |
|
| 388 | 388 | |
| 389 | - set_theme_mod( 'lsx_customizer_colour__button_cta_theme_mod', $styles ); |
|
| 389 | + set_theme_mod('lsx_customizer_colour__button_cta_theme_mod', $styles); |
|
| 390 | 390 | } |
| 391 | -add_action( 'after_switch_theme', 'lsx_customizer_colour__button_cta_set_theme_mod' ); |
|
| 392 | -add_action( 'customize_save_after', 'lsx_customizer_colour__button_cta_set_theme_mod' ); |
|
| 391 | +add_action('after_switch_theme', 'lsx_customizer_colour__button_cta_set_theme_mod'); |
|
| 392 | +add_action('customize_save_after', 'lsx_customizer_colour__button_cta_set_theme_mod'); |
|
| 393 | 393 | |
| 394 | 394 | /** |
| 395 | 395 | * Enqueues front-end CSS for the button cta. |
| 396 | 396 | */ |
| 397 | 397 | function lsx_customizer_colour__button_cta_css() { |
| 398 | - $styles_from_theme_mod = get_theme_mod( 'lsx_customizer_colour__button_cta_theme_mod' ); |
|
| 398 | + $styles_from_theme_mod = get_theme_mod('lsx_customizer_colour__button_cta_theme_mod'); |
|
| 399 | 399 | |
| 400 | - if ( is_customize_preview() || false === $styles_from_theme_mod ) { |
|
| 400 | + if (is_customize_preview() || false === $styles_from_theme_mod) { |
|
| 401 | 401 | $theme_mods = lsx_customizer_colour__button_cta_get_theme_mods(); |
| 402 | - $styles = lsx_customizer_colour__button_cta_get_css( $theme_mods ); |
|
| 402 | + $styles = lsx_customizer_colour__button_cta_get_css($theme_mods); |
|
| 403 | 403 | |
| 404 | - if ( false === $styles_from_theme_mod ) { |
|
| 405 | - set_theme_mod( 'lsx_customizer_colour__button_cta_theme_mod', $styles ); |
|
| 404 | + if (false === $styles_from_theme_mod) { |
|
| 405 | + set_theme_mod('lsx_customizer_colour__button_cta_theme_mod', $styles); |
|
| 406 | 406 | } |
| 407 | 407 | } else { |
| 408 | 408 | $styles = $styles_from_theme_mod; |
| 409 | 409 | } |
| 410 | 410 | |
| 411 | - wp_add_inline_style( 'lsx_customizer_colour', $styles ); |
|
| 411 | + wp_add_inline_style('lsx_customizer_colour', $styles); |
|
| 412 | 412 | } |
| 413 | -add_action( 'wp_enqueue_scripts', 'lsx_customizer_colour__button_cta_css', 9999 ); |
|
| 413 | +add_action('wp_enqueue_scripts', 'lsx_customizer_colour__button_cta_css', 9999); |
|
| 414 | 414 | |
| 415 | 415 | /** |
| 416 | 416 | * Get button cta CSS theme mods. |
@@ -422,32 +422,32 @@ discard block |
||
| 422 | 422 | $colors = array(); |
| 423 | 423 | $counter = 0; |
| 424 | 424 | |
| 425 | - foreach ( $customizer_colour_names as $key => $value ) { |
|
| 425 | + foreach ($customizer_colour_names as $key => $value) { |
|
| 426 | 426 | $colors[$key] = $color_scheme[$counter]; |
| 427 | 427 | $counter++; |
| 428 | 428 | } |
| 429 | 429 | |
| 430 | 430 | return array( |
| 431 | - 'button_cta_background_color' => get_theme_mod( 'button_cta_background_color', $colors['button_cta_background_color'] ), |
|
| 432 | - 'button_cta_background_hover_color' => get_theme_mod( 'button_cta_background_hover_color', $colors['button_cta_background_hover_color'] ), |
|
| 433 | - 'button_cta_text_color' => get_theme_mod( 'button_cta_text_color', $colors['button_cta_text_color'] ), |
|
| 434 | - 'button_cta_text_color_hover' => get_theme_mod( 'button_cta_text_color_hover', $colors['button_cta_text_color_hover'] ) |
|
| 431 | + 'button_cta_background_color' => get_theme_mod('button_cta_background_color', $colors['button_cta_background_color']), |
|
| 432 | + 'button_cta_background_hover_color' => get_theme_mod('button_cta_background_hover_color', $colors['button_cta_background_hover_color']), |
|
| 433 | + 'button_cta_text_color' => get_theme_mod('button_cta_text_color', $colors['button_cta_text_color']), |
|
| 434 | + 'button_cta_text_color_hover' => get_theme_mod('button_cta_text_color_hover', $colors['button_cta_text_color_hover']) |
|
| 435 | 435 | ); |
| 436 | 436 | } |
| 437 | 437 | |
| 438 | 438 | /** |
| 439 | 439 | * Returns CSS for the button cta. |
| 440 | 440 | */ |
| 441 | -function lsx_customizer_colour__button_cta_get_css( $colors ) { |
|
| 441 | +function lsx_customizer_colour__button_cta_get_css($colors) { |
|
| 442 | 442 | global $customizer_colour_names; |
| 443 | 443 | |
| 444 | 444 | $colors_template = array(); |
| 445 | 445 | |
| 446 | - foreach ( $customizer_colour_names as $key => $value ) { |
|
| 446 | + foreach ($customizer_colour_names as $key => $value) { |
|
| 447 | 447 | $colors_template[$key] = ''; |
| 448 | 448 | } |
| 449 | 449 | |
| 450 | - $colors = wp_parse_args( $colors, $colors_template ); |
|
| 450 | + $colors = wp_parse_args($colors, $colors_template); |
|
| 451 | 451 | |
| 452 | 452 | $css = <<<CSS |
| 453 | 453 | /* |
@@ -582,8 +582,8 @@ discard block |
||
| 582 | 582 | } |
| 583 | 583 | CSS; |
| 584 | 584 | |
| 585 | - $css = apply_filters( 'lsx_customizer_colour_selectors_button_cta', $css, $colors ); |
|
| 586 | - $css = lsx_customizer_colour__scss_to_css( $css ); |
|
| 585 | + $css = apply_filters('lsx_customizer_colour_selectors_button_cta', $css, $colors); |
|
| 586 | + $css = lsx_customizer_colour__scss_to_css($css); |
|
| 587 | 587 | return $css; |
| 588 | 588 | } |
| 589 | 589 | |
@@ -596,33 +596,33 @@ discard block |
||
| 596 | 596 | */ |
| 597 | 597 | function lsx_customizer_colour__top_menu_set_theme_mod() { |
| 598 | 598 | $theme_mods = lsx_customizer_colour__top_menu_get_theme_mods(); |
| 599 | - $styles = lsx_customizer_colour__top_menu_get_css( $theme_mods ); |
|
| 599 | + $styles = lsx_customizer_colour__top_menu_get_css($theme_mods); |
|
| 600 | 600 | |
| 601 | - set_theme_mod( 'lsx_customizer_colour__top_menu_theme_mod', $styles ); |
|
| 601 | + set_theme_mod('lsx_customizer_colour__top_menu_theme_mod', $styles); |
|
| 602 | 602 | } |
| 603 | -add_action( 'after_switch_theme', 'lsx_customizer_colour__top_menu_set_theme_mod' ); |
|
| 604 | -add_action( 'customize_save_after', 'lsx_customizer_colour__top_menu_set_theme_mod' ); |
|
| 603 | +add_action('after_switch_theme', 'lsx_customizer_colour__top_menu_set_theme_mod'); |
|
| 604 | +add_action('customize_save_after', 'lsx_customizer_colour__top_menu_set_theme_mod'); |
|
| 605 | 605 | |
| 606 | 606 | /** |
| 607 | 607 | * Enqueues front-end CSS for the top menu. |
| 608 | 608 | */ |
| 609 | 609 | function lsx_customizer_colour__top_menu_css() { |
| 610 | - $styles_from_theme_mod = get_theme_mod( 'lsx_customizer_colour__top_menu_theme_mod' ); |
|
| 610 | + $styles_from_theme_mod = get_theme_mod('lsx_customizer_colour__top_menu_theme_mod'); |
|
| 611 | 611 | |
| 612 | - if ( is_customize_preview() || false === $styles_from_theme_mod ) { |
|
| 612 | + if (is_customize_preview() || false === $styles_from_theme_mod) { |
|
| 613 | 613 | $theme_mods = lsx_customizer_colour__top_menu_get_theme_mods(); |
| 614 | - $styles = lsx_customizer_colour__top_menu_get_css( $theme_mods ); |
|
| 614 | + $styles = lsx_customizer_colour__top_menu_get_css($theme_mods); |
|
| 615 | 615 | |
| 616 | - if ( false === $styles_from_theme_mod ) { |
|
| 617 | - set_theme_mod( 'lsx_customizer_colour__top_menu_theme_mod', $styles ); |
|
| 616 | + if (false === $styles_from_theme_mod) { |
|
| 617 | + set_theme_mod('lsx_customizer_colour__top_menu_theme_mod', $styles); |
|
| 618 | 618 | } |
| 619 | 619 | } else { |
| 620 | 620 | $styles = $styles_from_theme_mod; |
| 621 | 621 | } |
| 622 | 622 | |
| 623 | - wp_add_inline_style( 'lsx_customizer_colour', $styles ); |
|
| 623 | + wp_add_inline_style('lsx_customizer_colour', $styles); |
|
| 624 | 624 | } |
| 625 | -add_action( 'wp_enqueue_scripts', 'lsx_customizer_colour__top_menu_css', 9999 ); |
|
| 625 | +add_action('wp_enqueue_scripts', 'lsx_customizer_colour__top_menu_css', 9999); |
|
| 626 | 626 | |
| 627 | 627 | /** |
| 628 | 628 | * Get top menu CSS theme mods. |
@@ -634,31 +634,31 @@ discard block |
||
| 634 | 634 | $colors = array(); |
| 635 | 635 | $counter = 0; |
| 636 | 636 | |
| 637 | - foreach ( $customizer_colour_names as $key => $value ) { |
|
| 637 | + foreach ($customizer_colour_names as $key => $value) { |
|
| 638 | 638 | $colors[$key] = $color_scheme[$counter]; |
| 639 | 639 | $counter++; |
| 640 | 640 | } |
| 641 | 641 | |
| 642 | 642 | return array( |
| 643 | - 'top_menu_background_color' => get_theme_mod( 'top_menu_background_color', $colors['top_menu_background_color'] ), |
|
| 644 | - 'top_menu_text_color' => get_theme_mod( 'top_menu_text_color', $colors['top_menu_text_color'] ), |
|
| 645 | - 'top_menu_text_hover_color' => get_theme_mod( 'top_menu_text_hover_color', $colors['top_menu_text_hover_color'] ) |
|
| 643 | + 'top_menu_background_color' => get_theme_mod('top_menu_background_color', $colors['top_menu_background_color']), |
|
| 644 | + 'top_menu_text_color' => get_theme_mod('top_menu_text_color', $colors['top_menu_text_color']), |
|
| 645 | + 'top_menu_text_hover_color' => get_theme_mod('top_menu_text_hover_color', $colors['top_menu_text_hover_color']) |
|
| 646 | 646 | ); |
| 647 | 647 | } |
| 648 | 648 | |
| 649 | 649 | /** |
| 650 | 650 | * Returns CSS for the top menu. |
| 651 | 651 | */ |
| 652 | -function lsx_customizer_colour__top_menu_get_css( $colors ) { |
|
| 652 | +function lsx_customizer_colour__top_menu_get_css($colors) { |
|
| 653 | 653 | global $customizer_colour_names; |
| 654 | 654 | |
| 655 | 655 | $colors_template = array(); |
| 656 | 656 | |
| 657 | - foreach ( $customizer_colour_names as $key => $value ) { |
|
| 657 | + foreach ($customizer_colour_names as $key => $value) { |
|
| 658 | 658 | $colors_template[$key] = ''; |
| 659 | 659 | } |
| 660 | 660 | |
| 661 | - $colors = wp_parse_args( $colors, $colors_template ); |
|
| 661 | + $colors = wp_parse_args($colors, $colors_template); |
|
| 662 | 662 | |
| 663 | 663 | $css = <<<CSS |
| 664 | 664 | /* |
@@ -717,8 +717,8 @@ discard block |
||
| 717 | 717 | } |
| 718 | 718 | CSS; |
| 719 | 719 | |
| 720 | - $css = apply_filters( 'lsx_customizer_colour_selectors_top_menu', $css, $colors ); |
|
| 721 | - $css = lsx_customizer_colour__scss_to_css( $css ); |
|
| 720 | + $css = apply_filters('lsx_customizer_colour_selectors_top_menu', $css, $colors); |
|
| 721 | + $css = lsx_customizer_colour__scss_to_css($css); |
|
| 722 | 722 | return $css; |
| 723 | 723 | } |
| 724 | 724 | |
@@ -731,33 +731,33 @@ discard block |
||
| 731 | 731 | */ |
| 732 | 732 | function lsx_customizer_colour__header_set_theme_mod() { |
| 733 | 733 | $theme_mods = lsx_customizer_colour__header_get_theme_mods(); |
| 734 | - $styles = lsx_customizer_colour__header_get_css( $theme_mods ); |
|
| 734 | + $styles = lsx_customizer_colour__header_get_css($theme_mods); |
|
| 735 | 735 | |
| 736 | - set_theme_mod( 'lsx_customizer_colour__header_theme_mod', $styles ); |
|
| 736 | + set_theme_mod('lsx_customizer_colour__header_theme_mod', $styles); |
|
| 737 | 737 | } |
| 738 | -add_action( 'after_switch_theme', 'lsx_customizer_colour__header_set_theme_mod' ); |
|
| 739 | -add_action( 'customize_save_after', 'lsx_customizer_colour__header_set_theme_mod' ); |
|
| 738 | +add_action('after_switch_theme', 'lsx_customizer_colour__header_set_theme_mod'); |
|
| 739 | +add_action('customize_save_after', 'lsx_customizer_colour__header_set_theme_mod'); |
|
| 740 | 740 | |
| 741 | 741 | /** |
| 742 | 742 | * Enqueues front-end CSS for the header. |
| 743 | 743 | */ |
| 744 | 744 | function lsx_customizer_colour__header_css() { |
| 745 | - $styles_from_theme_mod = get_theme_mod( 'lsx_customizer_colour__header_theme_mod' ); |
|
| 745 | + $styles_from_theme_mod = get_theme_mod('lsx_customizer_colour__header_theme_mod'); |
|
| 746 | 746 | |
| 747 | - if ( is_customize_preview() || false === $styles_from_theme_mod ) { |
|
| 747 | + if (is_customize_preview() || false === $styles_from_theme_mod) { |
|
| 748 | 748 | $theme_mods = lsx_customizer_colour__header_get_theme_mods(); |
| 749 | - $styles = lsx_customizer_colour__header_get_css( $theme_mods ); |
|
| 749 | + $styles = lsx_customizer_colour__header_get_css($theme_mods); |
|
| 750 | 750 | |
| 751 | - if ( false === $styles_from_theme_mod ) { |
|
| 752 | - set_theme_mod( 'lsx_customizer_colour__header_theme_mod', $styles ); |
|
| 751 | + if (false === $styles_from_theme_mod) { |
|
| 752 | + set_theme_mod('lsx_customizer_colour__header_theme_mod', $styles); |
|
| 753 | 753 | } |
| 754 | 754 | } else { |
| 755 | 755 | $styles = $styles_from_theme_mod; |
| 756 | 756 | } |
| 757 | 757 | |
| 758 | - wp_add_inline_style( 'lsx_customizer_colour', $styles ); |
|
| 758 | + wp_add_inline_style('lsx_customizer_colour', $styles); |
|
| 759 | 759 | } |
| 760 | -add_action( 'wp_enqueue_scripts', 'lsx_customizer_colour__header_css', 9999 ); |
|
| 760 | +add_action('wp_enqueue_scripts', 'lsx_customizer_colour__header_css', 9999); |
|
| 761 | 761 | |
| 762 | 762 | /** |
| 763 | 763 | * Get header CSS theme mods. |
@@ -769,32 +769,32 @@ discard block |
||
| 769 | 769 | $colors = array(); |
| 770 | 770 | $counter = 0; |
| 771 | 771 | |
| 772 | - foreach ( $customizer_colour_names as $key => $value ) { |
|
| 772 | + foreach ($customizer_colour_names as $key => $value) { |
|
| 773 | 773 | $colors[$key] = $color_scheme[$counter]; |
| 774 | 774 | $counter++; |
| 775 | 775 | } |
| 776 | 776 | |
| 777 | 777 | return array( |
| 778 | - 'header_background_color' => get_theme_mod( 'header_background_color', $colors['header_background_color'] ), |
|
| 779 | - 'header_title_color' => get_theme_mod( 'header_title_color', $colors['header_title_color'] ), |
|
| 780 | - 'header_title_hover_color' => get_theme_mod( 'header_title_hover_color', $colors['header_title_hover_color'] ), |
|
| 781 | - 'header_description_color' => get_theme_mod( 'header_description_color', $colors['header_description_color'] ) |
|
| 778 | + 'header_background_color' => get_theme_mod('header_background_color', $colors['header_background_color']), |
|
| 779 | + 'header_title_color' => get_theme_mod('header_title_color', $colors['header_title_color']), |
|
| 780 | + 'header_title_hover_color' => get_theme_mod('header_title_hover_color', $colors['header_title_hover_color']), |
|
| 781 | + 'header_description_color' => get_theme_mod('header_description_color', $colors['header_description_color']) |
|
| 782 | 782 | ); |
| 783 | 783 | } |
| 784 | 784 | |
| 785 | 785 | /** |
| 786 | 786 | * Returns CSS for the header. |
| 787 | 787 | */ |
| 788 | -function lsx_customizer_colour__header_get_css( $colors ) { |
|
| 788 | +function lsx_customizer_colour__header_get_css($colors) { |
|
| 789 | 789 | global $customizer_colour_names; |
| 790 | 790 | |
| 791 | 791 | $colors_template = array(); |
| 792 | 792 | |
| 793 | - foreach ( $customizer_colour_names as $key => $value ) { |
|
| 793 | + foreach ($customizer_colour_names as $key => $value) { |
|
| 794 | 794 | $colors_template[$key] = ''; |
| 795 | 795 | } |
| 796 | 796 | |
| 797 | - $colors = wp_parse_args( $colors, $colors_template ); |
|
| 797 | + $colors = wp_parse_args($colors, $colors_template); |
|
| 798 | 798 | |
| 799 | 799 | $css = <<<CSS |
| 800 | 800 | /* |
@@ -831,8 +831,8 @@ discard block |
||
| 831 | 831 | } |
| 832 | 832 | CSS; |
| 833 | 833 | |
| 834 | - $css = apply_filters( 'lsx_customizer_colour_selectors_header', $css, $colors ); |
|
| 835 | - $css = lsx_customizer_colour__scss_to_css( $css ); |
|
| 834 | + $css = apply_filters('lsx_customizer_colour_selectors_header', $css, $colors); |
|
| 835 | + $css = lsx_customizer_colour__scss_to_css($css); |
|
| 836 | 836 | return $css; |
| 837 | 837 | } |
| 838 | 838 | |
@@ -845,33 +845,33 @@ discard block |
||
| 845 | 845 | */ |
| 846 | 846 | function lsx_customizer_colour__main_menu_set_theme_mod() { |
| 847 | 847 | $theme_mods = lsx_customizer_colour__main_menu_get_theme_mods(); |
| 848 | - $styles = lsx_customizer_colour__main_menu_get_css( $theme_mods ); |
|
| 848 | + $styles = lsx_customizer_colour__main_menu_get_css($theme_mods); |
|
| 849 | 849 | |
| 850 | - set_theme_mod( 'lsx_customizer_colour__main_menu_theme_mod', $styles ); |
|
| 850 | + set_theme_mod('lsx_customizer_colour__main_menu_theme_mod', $styles); |
|
| 851 | 851 | } |
| 852 | -add_action( 'after_switch_theme', 'lsx_customizer_colour__main_menu_set_theme_mod' ); |
|
| 853 | -add_action( 'customize_save_after', 'lsx_customizer_colour__main_menu_set_theme_mod' ); |
|
| 852 | +add_action('after_switch_theme', 'lsx_customizer_colour__main_menu_set_theme_mod'); |
|
| 853 | +add_action('customize_save_after', 'lsx_customizer_colour__main_menu_set_theme_mod'); |
|
| 854 | 854 | |
| 855 | 855 | /** |
| 856 | 856 | * Enqueues front-end CSS for the main menu. |
| 857 | 857 | */ |
| 858 | 858 | function lsx_customizer_colour__main_menu_css() { |
| 859 | - $styles_from_theme_mod = get_theme_mod( 'lsx_customizer_colour__main_menu_theme_mod' ); |
|
| 859 | + $styles_from_theme_mod = get_theme_mod('lsx_customizer_colour__main_menu_theme_mod'); |
|
| 860 | 860 | |
| 861 | - if ( is_customize_preview() || false === $styles_from_theme_mod ) { |
|
| 861 | + if (is_customize_preview() || false === $styles_from_theme_mod) { |
|
| 862 | 862 | $theme_mods = lsx_customizer_colour__main_menu_get_theme_mods(); |
| 863 | - $styles = lsx_customizer_colour__main_menu_get_css( $theme_mods ); |
|
| 863 | + $styles = lsx_customizer_colour__main_menu_get_css($theme_mods); |
|
| 864 | 864 | |
| 865 | - if ( false === $styles_from_theme_mod ) { |
|
| 866 | - set_theme_mod( 'lsx_customizer_colour__main_menu_theme_mod', $styles ); |
|
| 865 | + if (false === $styles_from_theme_mod) { |
|
| 866 | + set_theme_mod('lsx_customizer_colour__main_menu_theme_mod', $styles); |
|
| 867 | 867 | } |
| 868 | 868 | } else { |
| 869 | 869 | $styles = $styles_from_theme_mod; |
| 870 | 870 | } |
| 871 | 871 | |
| 872 | - wp_add_inline_style( 'lsx_customizer_colour', $styles ); |
|
| 872 | + wp_add_inline_style('lsx_customizer_colour', $styles); |
|
| 873 | 873 | } |
| 874 | -add_action( 'wp_enqueue_scripts', 'lsx_customizer_colour__main_menu_css', 9999 ); |
|
| 874 | +add_action('wp_enqueue_scripts', 'lsx_customizer_colour__main_menu_css', 9999); |
|
| 875 | 875 | |
| 876 | 876 | /** |
| 877 | 877 | * Get main menu CSS theme mods. |
@@ -883,33 +883,33 @@ discard block |
||
| 883 | 883 | $colors = array(); |
| 884 | 884 | $counter = 0; |
| 885 | 885 | |
| 886 | - foreach ( $customizer_colour_names as $key => $value ) { |
|
| 886 | + foreach ($customizer_colour_names as $key => $value) { |
|
| 887 | 887 | $colors[$key] = $color_scheme[$counter]; |
| 888 | 888 | $counter++; |
| 889 | 889 | } |
| 890 | 890 | |
| 891 | 891 | return array( |
| 892 | - 'main_menu_background_hover1_color' => get_theme_mod( 'main_menu_background_hover1_color', $colors['main_menu_background_hover1_color'] ), |
|
| 893 | - 'main_menu_background_hover2_color' => get_theme_mod( 'main_menu_background_hover2_color', $colors['main_menu_background_hover2_color'] ), |
|
| 894 | - 'main_menu_text_color' => get_theme_mod( 'main_menu_text_color', $colors['main_menu_text_color'] ), |
|
| 895 | - 'main_menu_text_hover1_color' => get_theme_mod( 'main_menu_text_hover1_color', $colors['main_menu_text_hover1_color'] ), |
|
| 896 | - 'main_menu_text_hover2_color' => get_theme_mod( 'main_menu_text_hover2_color', $colors['main_menu_text_hover2_color'] ) |
|
| 892 | + 'main_menu_background_hover1_color' => get_theme_mod('main_menu_background_hover1_color', $colors['main_menu_background_hover1_color']), |
|
| 893 | + 'main_menu_background_hover2_color' => get_theme_mod('main_menu_background_hover2_color', $colors['main_menu_background_hover2_color']), |
|
| 894 | + 'main_menu_text_color' => get_theme_mod('main_menu_text_color', $colors['main_menu_text_color']), |
|
| 895 | + 'main_menu_text_hover1_color' => get_theme_mod('main_menu_text_hover1_color', $colors['main_menu_text_hover1_color']), |
|
| 896 | + 'main_menu_text_hover2_color' => get_theme_mod('main_menu_text_hover2_color', $colors['main_menu_text_hover2_color']) |
|
| 897 | 897 | ); |
| 898 | 898 | } |
| 899 | 899 | |
| 900 | 900 | /** |
| 901 | 901 | * Returns CSS for the main menu. |
| 902 | 902 | */ |
| 903 | -function lsx_customizer_colour__main_menu_get_css( $colors ) { |
|
| 903 | +function lsx_customizer_colour__main_menu_get_css($colors) { |
|
| 904 | 904 | global $customizer_colour_names; |
| 905 | 905 | |
| 906 | 906 | $colors_template = array(); |
| 907 | 907 | |
| 908 | - foreach ( $customizer_colour_names as $key => $value ) { |
|
| 908 | + foreach ($customizer_colour_names as $key => $value) { |
|
| 909 | 909 | $colors_template[$key] = ''; |
| 910 | 910 | } |
| 911 | 911 | |
| 912 | - $colors = wp_parse_args( $colors, $colors_template ); |
|
| 912 | + $colors = wp_parse_args($colors, $colors_template); |
|
| 913 | 913 | |
| 914 | 914 | $css = <<<CSS |
| 915 | 915 | /* |
@@ -999,8 +999,8 @@ discard block |
||
| 999 | 999 | } |
| 1000 | 1000 | CSS; |
| 1001 | 1001 | |
| 1002 | - $css = apply_filters( 'lsx_customizer_colour_selectors_main_menu', $css, $colors ); |
|
| 1003 | - $css = lsx_customizer_colour__scss_to_css( $css ); |
|
| 1002 | + $css = apply_filters('lsx_customizer_colour_selectors_main_menu', $css, $colors); |
|
| 1003 | + $css = lsx_customizer_colour__scss_to_css($css); |
|
| 1004 | 1004 | return $css; |
| 1005 | 1005 | } |
| 1006 | 1006 | |
@@ -1013,33 +1013,33 @@ discard block |
||
| 1013 | 1013 | */ |
| 1014 | 1014 | function lsx_customizer_colour__banner_set_theme_mod() { |
| 1015 | 1015 | $theme_mods = lsx_customizer_colour__banner_get_theme_mods(); |
| 1016 | - $styles = lsx_customizer_colour__banner_get_css( $theme_mods ); |
|
| 1016 | + $styles = lsx_customizer_colour__banner_get_css($theme_mods); |
|
| 1017 | 1017 | |
| 1018 | - set_theme_mod( 'lsx_customizer_colour__banner_theme_mod', $styles ); |
|
| 1018 | + set_theme_mod('lsx_customizer_colour__banner_theme_mod', $styles); |
|
| 1019 | 1019 | } |
| 1020 | -add_action( 'after_switch_theme', 'lsx_customizer_colour__banner_set_theme_mod' ); |
|
| 1021 | -add_action( 'customize_save_after', 'lsx_customizer_colour__banner_set_theme_mod' ); |
|
| 1020 | +add_action('after_switch_theme', 'lsx_customizer_colour__banner_set_theme_mod'); |
|
| 1021 | +add_action('customize_save_after', 'lsx_customizer_colour__banner_set_theme_mod'); |
|
| 1022 | 1022 | |
| 1023 | 1023 | /** |
| 1024 | 1024 | * Enqueues front-end CSS for the banner. |
| 1025 | 1025 | */ |
| 1026 | 1026 | function lsx_customizer_colour__banner_css() { |
| 1027 | - $styles_from_theme_mod = get_theme_mod( 'lsx_customizer_colour__banner_theme_mod' ); |
|
| 1027 | + $styles_from_theme_mod = get_theme_mod('lsx_customizer_colour__banner_theme_mod'); |
|
| 1028 | 1028 | |
| 1029 | - if ( is_customize_preview() || false === $styles_from_theme_mod ) { |
|
| 1029 | + if (is_customize_preview() || false === $styles_from_theme_mod) { |
|
| 1030 | 1030 | $theme_mods = lsx_customizer_colour__banner_get_theme_mods(); |
| 1031 | - $styles = lsx_customizer_colour__banner_get_css( $theme_mods ); |
|
| 1031 | + $styles = lsx_customizer_colour__banner_get_css($theme_mods); |
|
| 1032 | 1032 | |
| 1033 | - if ( false === $styles_from_theme_mod ) { |
|
| 1034 | - set_theme_mod( 'lsx_customizer_colour__banner_theme_mod', $styles ); |
|
| 1033 | + if (false === $styles_from_theme_mod) { |
|
| 1034 | + set_theme_mod('lsx_customizer_colour__banner_theme_mod', $styles); |
|
| 1035 | 1035 | } |
| 1036 | 1036 | } else { |
| 1037 | 1037 | $styles = $styles_from_theme_mod; |
| 1038 | 1038 | } |
| 1039 | 1039 | |
| 1040 | - wp_add_inline_style( 'lsx_customizer_colour', $styles ); |
|
| 1040 | + wp_add_inline_style('lsx_customizer_colour', $styles); |
|
| 1041 | 1041 | } |
| 1042 | -add_action( 'wp_enqueue_scripts', 'lsx_customizer_colour__banner_css', 9999 ); |
|
| 1042 | +add_action('wp_enqueue_scripts', 'lsx_customizer_colour__banner_css', 9999); |
|
| 1043 | 1043 | |
| 1044 | 1044 | /** |
| 1045 | 1045 | * Get banner CSS theme mods. |
@@ -1051,31 +1051,31 @@ discard block |
||
| 1051 | 1051 | $colors = array(); |
| 1052 | 1052 | $counter = 0; |
| 1053 | 1053 | |
| 1054 | - foreach ( $customizer_colour_names as $key => $value ) { |
|
| 1054 | + foreach ($customizer_colour_names as $key => $value) { |
|
| 1055 | 1055 | $colors[$key] = $color_scheme[$counter]; |
| 1056 | 1056 | $counter++; |
| 1057 | 1057 | } |
| 1058 | 1058 | |
| 1059 | 1059 | return array( |
| 1060 | - 'banner_background_color' => get_theme_mod( 'banner_background_color', $colors['banner_background_color'] ), |
|
| 1061 | - 'banner_text_color' => get_theme_mod( 'banner_text_color', $colors['banner_text_color'] ), |
|
| 1062 | - 'banner_text_image_color' => get_theme_mod( 'banner_text_image_color', $colors['banner_text_image_color'] ) |
|
| 1060 | + 'banner_background_color' => get_theme_mod('banner_background_color', $colors['banner_background_color']), |
|
| 1061 | + 'banner_text_color' => get_theme_mod('banner_text_color', $colors['banner_text_color']), |
|
| 1062 | + 'banner_text_image_color' => get_theme_mod('banner_text_image_color', $colors['banner_text_image_color']) |
|
| 1063 | 1063 | ); |
| 1064 | 1064 | } |
| 1065 | 1065 | |
| 1066 | 1066 | /** |
| 1067 | 1067 | * Returns CSS for the banner. |
| 1068 | 1068 | */ |
| 1069 | -function lsx_customizer_colour__banner_get_css( $colors ) { |
|
| 1069 | +function lsx_customizer_colour__banner_get_css($colors) { |
|
| 1070 | 1070 | global $customizer_colour_names; |
| 1071 | 1071 | |
| 1072 | 1072 | $colors_template = array(); |
| 1073 | 1073 | |
| 1074 | - foreach ( $customizer_colour_names as $key => $value ) { |
|
| 1074 | + foreach ($customizer_colour_names as $key => $value) { |
|
| 1075 | 1075 | $colors_template[$key] = ''; |
| 1076 | 1076 | } |
| 1077 | 1077 | |
| 1078 | - $colors = wp_parse_args( $colors, $colors_template ); |
|
| 1078 | + $colors = wp_parse_args($colors, $colors_template); |
|
| 1079 | 1079 | |
| 1080 | 1080 | $css = <<<CSS |
| 1081 | 1081 | /* |
@@ -1104,8 +1104,8 @@ discard block |
||
| 1104 | 1104 | } |
| 1105 | 1105 | CSS; |
| 1106 | 1106 | |
| 1107 | - $css = apply_filters( 'lsx_customizer_colour_selectors_banner', $css, $colors ); |
|
| 1108 | - $css = lsx_customizer_colour__scss_to_css( $css ); |
|
| 1107 | + $css = apply_filters('lsx_customizer_colour_selectors_banner', $css, $colors); |
|
| 1108 | + $css = lsx_customizer_colour__scss_to_css($css); |
|
| 1109 | 1109 | return $css; |
| 1110 | 1110 | } |
| 1111 | 1111 | |
@@ -1118,33 +1118,33 @@ discard block |
||
| 1118 | 1118 | */ |
| 1119 | 1119 | function lsx_customizer_colour__body_set_theme_mod() { |
| 1120 | 1120 | $theme_mods = lsx_customizer_colour__body_get_theme_mods(); |
| 1121 | - $styles = lsx_customizer_colour__body_get_css( $theme_mods ); |
|
| 1121 | + $styles = lsx_customizer_colour__body_get_css($theme_mods); |
|
| 1122 | 1122 | |
| 1123 | - set_theme_mod( 'lsx_customizer_colour__body_theme_mod', $styles ); |
|
| 1123 | + set_theme_mod('lsx_customizer_colour__body_theme_mod', $styles); |
|
| 1124 | 1124 | } |
| 1125 | -add_action( 'after_switch_theme', 'lsx_customizer_colour__body_set_theme_mod' ); |
|
| 1126 | -add_action( 'customize_save_after', 'lsx_customizer_colour__body_set_theme_mod' ); |
|
| 1125 | +add_action('after_switch_theme', 'lsx_customizer_colour__body_set_theme_mod'); |
|
| 1126 | +add_action('customize_save_after', 'lsx_customizer_colour__body_set_theme_mod'); |
|
| 1127 | 1127 | |
| 1128 | 1128 | /** |
| 1129 | 1129 | * Enqueues front-end CSS for the body. |
| 1130 | 1130 | */ |
| 1131 | 1131 | function lsx_customizer_colour__body_css() { |
| 1132 | - $styles_from_theme_mod = get_theme_mod( 'lsx_customizer_colour__body_theme_mod' ); |
|
| 1132 | + $styles_from_theme_mod = get_theme_mod('lsx_customizer_colour__body_theme_mod'); |
|
| 1133 | 1133 | |
| 1134 | - if ( is_customize_preview() || false === $styles_from_theme_mod ) { |
|
| 1134 | + if (is_customize_preview() || false === $styles_from_theme_mod) { |
|
| 1135 | 1135 | $theme_mods = lsx_customizer_colour__body_get_theme_mods(); |
| 1136 | - $styles = lsx_customizer_colour__body_get_css( $theme_mods ); |
|
| 1136 | + $styles = lsx_customizer_colour__body_get_css($theme_mods); |
|
| 1137 | 1137 | |
| 1138 | - if ( false === $styles_from_theme_mod ) { |
|
| 1139 | - set_theme_mod( 'lsx_customizer_colour__body_theme_mod', $styles ); |
|
| 1138 | + if (false === $styles_from_theme_mod) { |
|
| 1139 | + set_theme_mod('lsx_customizer_colour__body_theme_mod', $styles); |
|
| 1140 | 1140 | } |
| 1141 | 1141 | } else { |
| 1142 | 1142 | $styles = $styles_from_theme_mod; |
| 1143 | 1143 | } |
| 1144 | 1144 | |
| 1145 | - wp_add_inline_style( 'lsx_customizer_colour', $styles ); |
|
| 1145 | + wp_add_inline_style('lsx_customizer_colour', $styles); |
|
| 1146 | 1146 | } |
| 1147 | -add_action( 'wp_enqueue_scripts', 'lsx_customizer_colour__body_css', 9999 ); |
|
| 1147 | +add_action('wp_enqueue_scripts', 'lsx_customizer_colour__body_css', 9999); |
|
| 1148 | 1148 | |
| 1149 | 1149 | /** |
| 1150 | 1150 | * Get body CSS theme mods. |
@@ -1156,41 +1156,41 @@ discard block |
||
| 1156 | 1156 | $colors = array(); |
| 1157 | 1157 | $counter = 0; |
| 1158 | 1158 | |
| 1159 | - foreach ( $customizer_colour_names as $key => $value ) { |
|
| 1159 | + foreach ($customizer_colour_names as $key => $value) { |
|
| 1160 | 1160 | $colors[$key] = $color_scheme[$counter]; |
| 1161 | 1161 | $counter++; |
| 1162 | 1162 | } |
| 1163 | 1163 | |
| 1164 | 1164 | return array( |
| 1165 | - 'body_background_color' => get_theme_mod( 'body_background_color', $colors['body_background_color'] ), |
|
| 1166 | - 'body_line_color' => get_theme_mod( 'body_line_color', $colors['body_line_color'] ), |
|
| 1167 | - 'body_text_heading_color' => get_theme_mod( 'body_text_heading_color', $colors['body_text_heading_color'] ), |
|
| 1168 | - 'body_text_color' => get_theme_mod( 'body_text_color', $colors['body_text_color'] ), |
|
| 1169 | - 'body_link_color' => get_theme_mod( 'body_link_color', $colors['body_link_color'] ), |
|
| 1170 | - 'body_link_hover_color' => get_theme_mod( 'body_link_hover_color', $colors['body_link_hover_color'] ), |
|
| 1171 | - |
|
| 1172 | - 'body_section_full_background_color' => get_theme_mod( 'body_section_full_background_color', $colors['body_section_full_background_color'] ), |
|
| 1173 | - 'body_section_full_text_color' => get_theme_mod( 'body_section_full_text_color', $colors['body_section_full_text_color'] ), |
|
| 1174 | - 'body_section_full_cta_background_color' => get_theme_mod( 'body_section_full_cta_background_color', $colors['body_section_full_cta_background_color'] ), |
|
| 1175 | - 'body_section_full_cta_text_color' => get_theme_mod( 'body_section_full_cta_text_color', $colors['body_section_full_cta_text_color'] ) |
|
| 1165 | + 'body_background_color' => get_theme_mod('body_background_color', $colors['body_background_color']), |
|
| 1166 | + 'body_line_color' => get_theme_mod('body_line_color', $colors['body_line_color']), |
|
| 1167 | + 'body_text_heading_color' => get_theme_mod('body_text_heading_color', $colors['body_text_heading_color']), |
|
| 1168 | + 'body_text_color' => get_theme_mod('body_text_color', $colors['body_text_color']), |
|
| 1169 | + 'body_link_color' => get_theme_mod('body_link_color', $colors['body_link_color']), |
|
| 1170 | + 'body_link_hover_color' => get_theme_mod('body_link_hover_color', $colors['body_link_hover_color']), |
|
| 1171 | + |
|
| 1172 | + 'body_section_full_background_color' => get_theme_mod('body_section_full_background_color', $colors['body_section_full_background_color']), |
|
| 1173 | + 'body_section_full_text_color' => get_theme_mod('body_section_full_text_color', $colors['body_section_full_text_color']), |
|
| 1174 | + 'body_section_full_cta_background_color' => get_theme_mod('body_section_full_cta_background_color', $colors['body_section_full_cta_background_color']), |
|
| 1175 | + 'body_section_full_cta_text_color' => get_theme_mod('body_section_full_cta_text_color', $colors['body_section_full_cta_text_color']) |
|
| 1176 | 1176 | ); |
| 1177 | 1177 | } |
| 1178 | 1178 | |
| 1179 | 1179 | /** |
| 1180 | 1180 | * Returns CSS for the body. |
| 1181 | 1181 | */ |
| 1182 | -function lsx_customizer_colour__body_get_css( $colors ) { |
|
| 1182 | +function lsx_customizer_colour__body_get_css($colors) { |
|
| 1183 | 1183 | global $customizer_colour_names; |
| 1184 | 1184 | |
| 1185 | 1185 | $colors_template = array(); |
| 1186 | 1186 | |
| 1187 | - foreach ( $customizer_colour_names as $key => $value ) { |
|
| 1187 | + foreach ($customizer_colour_names as $key => $value) { |
|
| 1188 | 1188 | $colors_template[$key] = ''; |
| 1189 | 1189 | } |
| 1190 | 1190 | |
| 1191 | - $colors = wp_parse_args( $colors, $colors_template ); |
|
| 1191 | + $colors = wp_parse_args($colors, $colors_template); |
|
| 1192 | 1192 | |
| 1193 | - $rgb = lsx_customizer_colour__hex2rgb( $colors['body_line_color'] ); |
|
| 1193 | + $rgb = lsx_customizer_colour__hex2rgb($colors['body_line_color']); |
|
| 1194 | 1194 | $colors['body_line_color_rgba'] = "rgba({$rgb['red']}, {$rgb['green']}, {$rgb['blue']}, 0.5)"; |
| 1195 | 1195 | |
| 1196 | 1196 | $css = <<<CSS |
@@ -1471,8 +1471,8 @@ discard block |
||
| 1471 | 1471 | } |
| 1472 | 1472 | CSS; |
| 1473 | 1473 | |
| 1474 | - $css = apply_filters( 'lsx_customizer_colour_selectors_body', $css, $colors ); |
|
| 1475 | - $css = lsx_customizer_colour__scss_to_css( $css ); |
|
| 1474 | + $css = apply_filters('lsx_customizer_colour_selectors_body', $css, $colors); |
|
| 1475 | + $css = lsx_customizer_colour__scss_to_css($css); |
|
| 1476 | 1476 | return $css; |
| 1477 | 1477 | } |
| 1478 | 1478 | |
@@ -1485,33 +1485,33 @@ discard block |
||
| 1485 | 1485 | */ |
| 1486 | 1486 | function lsx_customizer_colour__footer_cta_set_theme_mod() { |
| 1487 | 1487 | $theme_mods = lsx_customizer_colour__footer_cta_get_theme_mods(); |
| 1488 | - $styles = lsx_customizer_colour__footer_cta_get_css( $theme_mods ); |
|
| 1488 | + $styles = lsx_customizer_colour__footer_cta_get_css($theme_mods); |
|
| 1489 | 1489 | |
| 1490 | - set_theme_mod( 'lsx_customizer_colour__footer_cta_theme_mod', $styles ); |
|
| 1490 | + set_theme_mod('lsx_customizer_colour__footer_cta_theme_mod', $styles); |
|
| 1491 | 1491 | } |
| 1492 | -add_action( 'after_switch_theme', 'lsx_customizer_colour__footer_cta_set_theme_mod' ); |
|
| 1493 | -add_action( 'customize_save_after', 'lsx_customizer_colour__footer_cta_set_theme_mod' ); |
|
| 1492 | +add_action('after_switch_theme', 'lsx_customizer_colour__footer_cta_set_theme_mod'); |
|
| 1493 | +add_action('customize_save_after', 'lsx_customizer_colour__footer_cta_set_theme_mod'); |
|
| 1494 | 1494 | |
| 1495 | 1495 | /** |
| 1496 | 1496 | * Enqueues front-end CSS for the footer cta. |
| 1497 | 1497 | */ |
| 1498 | 1498 | function lsx_customizer_colour__footer_cta_css() { |
| 1499 | - $styles_from_theme_mod = get_theme_mod( 'lsx_customizer_colour__footer_cta_theme_mod' ); |
|
| 1499 | + $styles_from_theme_mod = get_theme_mod('lsx_customizer_colour__footer_cta_theme_mod'); |
|
| 1500 | 1500 | |
| 1501 | - if ( is_customize_preview() || false === $styles_from_theme_mod ) { |
|
| 1501 | + if (is_customize_preview() || false === $styles_from_theme_mod) { |
|
| 1502 | 1502 | $theme_mods = lsx_customizer_colour__footer_cta_get_theme_mods(); |
| 1503 | - $styles = lsx_customizer_colour__footer_cta_get_css( $theme_mods ); |
|
| 1503 | + $styles = lsx_customizer_colour__footer_cta_get_css($theme_mods); |
|
| 1504 | 1504 | |
| 1505 | - if ( false === $styles_from_theme_mod ) { |
|
| 1506 | - set_theme_mod( 'lsx_customizer_colour__footer_cta_theme_mod', $styles ); |
|
| 1505 | + if (false === $styles_from_theme_mod) { |
|
| 1506 | + set_theme_mod('lsx_customizer_colour__footer_cta_theme_mod', $styles); |
|
| 1507 | 1507 | } |
| 1508 | 1508 | } else { |
| 1509 | 1509 | $styles = $styles_from_theme_mod; |
| 1510 | 1510 | } |
| 1511 | 1511 | |
| 1512 | - wp_add_inline_style( 'lsx_customizer_colour', $styles ); |
|
| 1512 | + wp_add_inline_style('lsx_customizer_colour', $styles); |
|
| 1513 | 1513 | } |
| 1514 | -add_action( 'wp_enqueue_scripts', 'lsx_customizer_colour__footer_cta_css', 9999 ); |
|
| 1514 | +add_action('wp_enqueue_scripts', 'lsx_customizer_colour__footer_cta_css', 9999); |
|
| 1515 | 1515 | |
| 1516 | 1516 | /** |
| 1517 | 1517 | * Get footer cta CSS theme mods. |
@@ -1523,32 +1523,32 @@ discard block |
||
| 1523 | 1523 | $colors = array(); |
| 1524 | 1524 | $counter = 0; |
| 1525 | 1525 | |
| 1526 | - foreach ( $customizer_colour_names as $key => $value ) { |
|
| 1526 | + foreach ($customizer_colour_names as $key => $value) { |
|
| 1527 | 1527 | $colors[$key] = $color_scheme[$counter]; |
| 1528 | 1528 | $counter++; |
| 1529 | 1529 | } |
| 1530 | 1530 | |
| 1531 | 1531 | return array( |
| 1532 | - 'footer_cta_background_color' => get_theme_mod( 'footer_cta_background_color', $colors['footer_cta_background_color'] ), |
|
| 1533 | - 'footer_cta_text_color' => get_theme_mod( 'footer_cta_text_color', $colors['footer_cta_text_color'] ), |
|
| 1534 | - 'footer_cta_link_color' => get_theme_mod( 'footer_cta_link_color', $colors['footer_cta_link_color'] ), |
|
| 1535 | - 'footer_cta_link_hover_color' => get_theme_mod( 'footer_cta_link_hover_color', $colors['footer_cta_link_hover_color'] ) |
|
| 1532 | + 'footer_cta_background_color' => get_theme_mod('footer_cta_background_color', $colors['footer_cta_background_color']), |
|
| 1533 | + 'footer_cta_text_color' => get_theme_mod('footer_cta_text_color', $colors['footer_cta_text_color']), |
|
| 1534 | + 'footer_cta_link_color' => get_theme_mod('footer_cta_link_color', $colors['footer_cta_link_color']), |
|
| 1535 | + 'footer_cta_link_hover_color' => get_theme_mod('footer_cta_link_hover_color', $colors['footer_cta_link_hover_color']) |
|
| 1536 | 1536 | ); |
| 1537 | 1537 | } |
| 1538 | 1538 | |
| 1539 | 1539 | /** |
| 1540 | 1540 | * Returns CSS for the footer cta. |
| 1541 | 1541 | */ |
| 1542 | -function lsx_customizer_colour__footer_cta_get_css( $colors ) { |
|
| 1542 | +function lsx_customizer_colour__footer_cta_get_css($colors) { |
|
| 1543 | 1543 | global $customizer_colour_names; |
| 1544 | 1544 | |
| 1545 | 1545 | $colors_template = array(); |
| 1546 | 1546 | |
| 1547 | - foreach ( $customizer_colour_names as $key => $value ) { |
|
| 1547 | + foreach ($customizer_colour_names as $key => $value) { |
|
| 1548 | 1548 | $colors_template[$key] = ''; |
| 1549 | 1549 | } |
| 1550 | 1550 | |
| 1551 | - $colors = wp_parse_args( $colors, $colors_template ); |
|
| 1551 | + $colors = wp_parse_args($colors, $colors_template); |
|
| 1552 | 1552 | |
| 1553 | 1553 | $css = <<<CSS |
| 1554 | 1554 | /* |
@@ -1583,8 +1583,8 @@ discard block |
||
| 1583 | 1583 | } |
| 1584 | 1584 | CSS; |
| 1585 | 1585 | |
| 1586 | - $css = apply_filters( 'lsx_customizer_colour_selectors_footer_cta', $css, $colors ); |
|
| 1587 | - $css = lsx_customizer_colour__scss_to_css( $css ); |
|
| 1586 | + $css = apply_filters('lsx_customizer_colour_selectors_footer_cta', $css, $colors); |
|
| 1587 | + $css = lsx_customizer_colour__scss_to_css($css); |
|
| 1588 | 1588 | return $css; |
| 1589 | 1589 | } |
| 1590 | 1590 | |
@@ -1596,33 +1596,33 @@ discard block |
||
| 1596 | 1596 | */ |
| 1597 | 1597 | function lsx_customizer_colour__footer_widgets_set_theme_mod() { |
| 1598 | 1598 | $theme_mods = lsx_customizer_colour__footer_widgets_get_theme_mods(); |
| 1599 | - $styles = lsx_customizer_colour__footer_widgets_get_css( $theme_mods ); |
|
| 1599 | + $styles = lsx_customizer_colour__footer_widgets_get_css($theme_mods); |
|
| 1600 | 1600 | |
| 1601 | - set_theme_mod( 'lsx_customizer_colour__footer_widgets_theme_mod', $styles ); |
|
| 1601 | + set_theme_mod('lsx_customizer_colour__footer_widgets_theme_mod', $styles); |
|
| 1602 | 1602 | } |
| 1603 | -add_action( 'after_switch_theme', 'lsx_customizer_colour__footer_widgets_set_theme_mod' ); |
|
| 1604 | -add_action( 'customize_save_after', 'lsx_customizer_colour__footer_widgets_set_theme_mod' ); |
|
| 1603 | +add_action('after_switch_theme', 'lsx_customizer_colour__footer_widgets_set_theme_mod'); |
|
| 1604 | +add_action('customize_save_after', 'lsx_customizer_colour__footer_widgets_set_theme_mod'); |
|
| 1605 | 1605 | |
| 1606 | 1606 | /** |
| 1607 | 1607 | * Enqueues front-end CSS for the footer widgets. |
| 1608 | 1608 | */ |
| 1609 | 1609 | function lsx_customizer_colour__footer_widgets_css() { |
| 1610 | - $styles_from_theme_mod = get_theme_mod( 'lsx_customizer_colour__footer_widgets_theme_mod' ); |
|
| 1610 | + $styles_from_theme_mod = get_theme_mod('lsx_customizer_colour__footer_widgets_theme_mod'); |
|
| 1611 | 1611 | |
| 1612 | - if ( is_customize_preview() || false === $styles_from_theme_mod ) { |
|
| 1612 | + if (is_customize_preview() || false === $styles_from_theme_mod) { |
|
| 1613 | 1613 | $theme_mods = lsx_customizer_colour__footer_widgets_get_theme_mods(); |
| 1614 | - $styles = lsx_customizer_colour__footer_widgets_get_css( $theme_mods ); |
|
| 1614 | + $styles = lsx_customizer_colour__footer_widgets_get_css($theme_mods); |
|
| 1615 | 1615 | |
| 1616 | - if ( false === $styles_from_theme_mod ) { |
|
| 1617 | - set_theme_mod( 'lsx_customizer_colour__footer_widgets_theme_mod', $styles ); |
|
| 1616 | + if (false === $styles_from_theme_mod) { |
|
| 1617 | + set_theme_mod('lsx_customizer_colour__footer_widgets_theme_mod', $styles); |
|
| 1618 | 1618 | } |
| 1619 | 1619 | } else { |
| 1620 | 1620 | $styles = $styles_from_theme_mod; |
| 1621 | 1621 | } |
| 1622 | 1622 | |
| 1623 | - wp_add_inline_style( 'lsx_customizer_colour', $styles ); |
|
| 1623 | + wp_add_inline_style('lsx_customizer_colour', $styles); |
|
| 1624 | 1624 | } |
| 1625 | -add_action( 'wp_enqueue_scripts', 'lsx_customizer_colour__footer_widgets_css', 9999 ); |
|
| 1625 | +add_action('wp_enqueue_scripts', 'lsx_customizer_colour__footer_widgets_css', 9999); |
|
| 1626 | 1626 | |
| 1627 | 1627 | /** |
| 1628 | 1628 | * Get footer widgets CSS theme mods. |
@@ -1634,32 +1634,32 @@ discard block |
||
| 1634 | 1634 | $colors = array(); |
| 1635 | 1635 | $counter = 0; |
| 1636 | 1636 | |
| 1637 | - foreach ( $customizer_colour_names as $key => $value ) { |
|
| 1637 | + foreach ($customizer_colour_names as $key => $value) { |
|
| 1638 | 1638 | $colors[$key] = $color_scheme[$counter]; |
| 1639 | 1639 | $counter++; |
| 1640 | 1640 | } |
| 1641 | 1641 | |
| 1642 | 1642 | return array( |
| 1643 | - 'footer_widgets_background_color' => get_theme_mod( 'footer_widgets_background_color', $colors['footer_widgets_background_color'] ), |
|
| 1644 | - 'footer_widgets_text_color' => get_theme_mod( 'footer_widgets_text_color', $colors['footer_widgets_text_color'] ), |
|
| 1645 | - 'footer_widgets_link_color' => get_theme_mod( 'footer_widgets_link_color', $colors['footer_widgets_link_color'] ), |
|
| 1646 | - 'footer_widgets_link_hover_color' => get_theme_mod( 'footer_widgets_link_hover_color', $colors['footer_widgets_link_hover_color'] ) |
|
| 1643 | + 'footer_widgets_background_color' => get_theme_mod('footer_widgets_background_color', $colors['footer_widgets_background_color']), |
|
| 1644 | + 'footer_widgets_text_color' => get_theme_mod('footer_widgets_text_color', $colors['footer_widgets_text_color']), |
|
| 1645 | + 'footer_widgets_link_color' => get_theme_mod('footer_widgets_link_color', $colors['footer_widgets_link_color']), |
|
| 1646 | + 'footer_widgets_link_hover_color' => get_theme_mod('footer_widgets_link_hover_color', $colors['footer_widgets_link_hover_color']) |
|
| 1647 | 1647 | ); |
| 1648 | 1648 | } |
| 1649 | 1649 | |
| 1650 | 1650 | /** |
| 1651 | 1651 | * Returns CSS for the footer widgets. |
| 1652 | 1652 | */ |
| 1653 | -function lsx_customizer_colour__footer_widgets_get_css( $colors ) { |
|
| 1653 | +function lsx_customizer_colour__footer_widgets_get_css($colors) { |
|
| 1654 | 1654 | global $customizer_colour_names; |
| 1655 | 1655 | |
| 1656 | 1656 | $colors_template = array(); |
| 1657 | 1657 | |
| 1658 | - foreach ( $customizer_colour_names as $key => $value ) { |
|
| 1658 | + foreach ($customizer_colour_names as $key => $value) { |
|
| 1659 | 1659 | $colors_template[$key] = ''; |
| 1660 | 1660 | } |
| 1661 | 1661 | |
| 1662 | - $colors = wp_parse_args( $colors, $colors_template ); |
|
| 1662 | + $colors = wp_parse_args($colors, $colors_template); |
|
| 1663 | 1663 | |
| 1664 | 1664 | $css = <<<CSS |
| 1665 | 1665 | /* |
@@ -1698,8 +1698,8 @@ discard block |
||
| 1698 | 1698 | } |
| 1699 | 1699 | CSS; |
| 1700 | 1700 | |
| 1701 | - $css = apply_filters( 'lsx_customizer_colour_selectors_footer_widgets', $css, $colors ); |
|
| 1702 | - $css = lsx_customizer_colour__scss_to_css( $css ); |
|
| 1701 | + $css = apply_filters('lsx_customizer_colour_selectors_footer_widgets', $css, $colors); |
|
| 1702 | + $css = lsx_customizer_colour__scss_to_css($css); |
|
| 1703 | 1703 | return $css; |
| 1704 | 1704 | } |
| 1705 | 1705 | |
@@ -1711,33 +1711,33 @@ discard block |
||
| 1711 | 1711 | */ |
| 1712 | 1712 | function lsx_customizer_colour__footer_set_theme_mod() { |
| 1713 | 1713 | $theme_mods = lsx_customizer_colour__footer_get_theme_mods(); |
| 1714 | - $styles = lsx_customizer_colour__footer_get_css( $theme_mods ); |
|
| 1714 | + $styles = lsx_customizer_colour__footer_get_css($theme_mods); |
|
| 1715 | 1715 | |
| 1716 | - set_theme_mod( 'lsx_customizer_colour__footer_theme_mod', $styles ); |
|
| 1716 | + set_theme_mod('lsx_customizer_colour__footer_theme_mod', $styles); |
|
| 1717 | 1717 | } |
| 1718 | -add_action( 'after_switch_theme', 'lsx_customizer_colour__footer_set_theme_mod' ); |
|
| 1719 | -add_action( 'customize_save_after', 'lsx_customizer_colour__footer_set_theme_mod' ); |
|
| 1718 | +add_action('after_switch_theme', 'lsx_customizer_colour__footer_set_theme_mod'); |
|
| 1719 | +add_action('customize_save_after', 'lsx_customizer_colour__footer_set_theme_mod'); |
|
| 1720 | 1720 | |
| 1721 | 1721 | /** |
| 1722 | 1722 | * Enqueues front-end CSS for the footer. |
| 1723 | 1723 | */ |
| 1724 | 1724 | function lsx_customizer_colour__footer_css() { |
| 1725 | - $styles_from_theme_mod = get_theme_mod( 'lsx_customizer_colour__footer_theme_mod' ); |
|
| 1725 | + $styles_from_theme_mod = get_theme_mod('lsx_customizer_colour__footer_theme_mod'); |
|
| 1726 | 1726 | |
| 1727 | - if ( is_customize_preview() || false === $styles_from_theme_mod ) { |
|
| 1727 | + if (is_customize_preview() || false === $styles_from_theme_mod) { |
|
| 1728 | 1728 | $theme_mods = lsx_customizer_colour__footer_get_theme_mods(); |
| 1729 | - $styles = lsx_customizer_colour__footer_get_css( $theme_mods ); |
|
| 1729 | + $styles = lsx_customizer_colour__footer_get_css($theme_mods); |
|
| 1730 | 1730 | |
| 1731 | - if ( false === $styles_from_theme_mod ) { |
|
| 1732 | - set_theme_mod( 'lsx_customizer_colour__footer_theme_mod', $styles ); |
|
| 1731 | + if (false === $styles_from_theme_mod) { |
|
| 1732 | + set_theme_mod('lsx_customizer_colour__footer_theme_mod', $styles); |
|
| 1733 | 1733 | } |
| 1734 | 1734 | } else { |
| 1735 | 1735 | $styles = $styles_from_theme_mod; |
| 1736 | 1736 | } |
| 1737 | 1737 | |
| 1738 | - wp_add_inline_style( 'lsx_customizer_colour', $styles ); |
|
| 1738 | + wp_add_inline_style('lsx_customizer_colour', $styles); |
|
| 1739 | 1739 | } |
| 1740 | -add_action( 'wp_enqueue_scripts', 'lsx_customizer_colour__footer_css', 9999 ); |
|
| 1740 | +add_action('wp_enqueue_scripts', 'lsx_customizer_colour__footer_css', 9999); |
|
| 1741 | 1741 | |
| 1742 | 1742 | /** |
| 1743 | 1743 | * Get footer CSS theme mods. |
@@ -1749,32 +1749,32 @@ discard block |
||
| 1749 | 1749 | $colors = array(); |
| 1750 | 1750 | $counter = 0; |
| 1751 | 1751 | |
| 1752 | - foreach ( $customizer_colour_names as $key => $value ) { |
|
| 1752 | + foreach ($customizer_colour_names as $key => $value) { |
|
| 1753 | 1753 | $colors[$key] = $color_scheme[$counter]; |
| 1754 | 1754 | $counter++; |
| 1755 | 1755 | } |
| 1756 | 1756 | |
| 1757 | 1757 | return array( |
| 1758 | - 'footer_background_color' => get_theme_mod( 'footer_background_color', $colors['footer_background_color'] ), |
|
| 1759 | - 'footer_text_color' => get_theme_mod( 'footer_text_color', $colors['footer_text_color'] ), |
|
| 1760 | - 'footer_link_color' => get_theme_mod( 'footer_link_color', $colors['footer_link_color'] ), |
|
| 1761 | - 'footer_link_hover_color' => get_theme_mod( 'footer_link_hover_color', $colors['footer_link_hover_color'] ) |
|
| 1758 | + 'footer_background_color' => get_theme_mod('footer_background_color', $colors['footer_background_color']), |
|
| 1759 | + 'footer_text_color' => get_theme_mod('footer_text_color', $colors['footer_text_color']), |
|
| 1760 | + 'footer_link_color' => get_theme_mod('footer_link_color', $colors['footer_link_color']), |
|
| 1761 | + 'footer_link_hover_color' => get_theme_mod('footer_link_hover_color', $colors['footer_link_hover_color']) |
|
| 1762 | 1762 | ); |
| 1763 | 1763 | } |
| 1764 | 1764 | |
| 1765 | 1765 | /** |
| 1766 | 1766 | * Returns CSS for the footer. |
| 1767 | 1767 | */ |
| 1768 | -function lsx_customizer_colour__footer_get_css( $colors ) { |
|
| 1768 | +function lsx_customizer_colour__footer_get_css($colors) { |
|
| 1769 | 1769 | global $customizer_colour_names; |
| 1770 | 1770 | |
| 1771 | 1771 | $colors_template = array(); |
| 1772 | 1772 | |
| 1773 | - foreach ( $customizer_colour_names as $key => $value ) { |
|
| 1773 | + foreach ($customizer_colour_names as $key => $value) { |
|
| 1774 | 1774 | $colors_template[$key] = ''; |
| 1775 | 1775 | } |
| 1776 | 1776 | |
| 1777 | - $colors = wp_parse_args( $colors, $colors_template ); |
|
| 1777 | + $colors = wp_parse_args($colors, $colors_template); |
|
| 1778 | 1778 | |
| 1779 | 1779 | $css = <<<CSS |
| 1780 | 1780 | /* |
@@ -1814,8 +1814,8 @@ discard block |
||
| 1814 | 1814 | } |
| 1815 | 1815 | CSS; |
| 1816 | 1816 | |
| 1817 | - $css = apply_filters( 'lsx_customizer_colour_selectors_footer', $css, $colors ); |
|
| 1818 | - $css = lsx_customizer_colour__scss_to_css( $css ); |
|
| 1817 | + $css = apply_filters('lsx_customizer_colour_selectors_footer', $css, $colors); |
|
| 1818 | + $css = lsx_customizer_colour__scss_to_css($css); |
|
| 1819 | 1819 | return $css; |
| 1820 | 1820 | } |
| 1821 | 1821 | |
@@ -1827,7 +1827,7 @@ discard block |
||
| 1827 | 1827 | * Customize Colour Control Class |
| 1828 | 1828 | */ |
| 1829 | 1829 | |
| 1830 | -if ( ! class_exists( 'WP_Customize_Control' ) ) { |
|
| 1830 | +if ( ! class_exists('WP_Customize_Control')) { |
|
| 1831 | 1831 | return; |
| 1832 | 1832 | } |
| 1833 | 1833 | |
@@ -1837,37 +1837,37 @@ discard block |
||
| 1837 | 1837 | * Enqueue control related scripts/styles. |
| 1838 | 1838 | */ |
| 1839 | 1839 | public function enqueue() { |
| 1840 | - wp_enqueue_script( 'lsx-colour-control', get_template_directory_uri() .'/js/customizer-colour.js', array( 'customize-controls', 'iris', 'underscore', 'wp-util' ), null, true ); |
|
| 1841 | - wp_localize_script( 'lsx-colour-control', 'colorScheme', $this->choices ); |
|
| 1840 | + wp_enqueue_script('lsx-colour-control', get_template_directory_uri() . '/js/customizer-colour.js', array('customize-controls', 'iris', 'underscore', 'wp-util'), null, true); |
|
| 1841 | + wp_localize_script('lsx-colour-control', 'colorScheme', $this->choices); |
|
| 1842 | 1842 | |
| 1843 | 1843 | global $customizer_colour_names; |
| 1844 | 1844 | $colors = array(); |
| 1845 | - foreach ( $customizer_colour_names as $key => $value ) { |
|
| 1845 | + foreach ($customizer_colour_names as $key => $value) { |
|
| 1846 | 1846 | $colors[] = $key; |
| 1847 | 1847 | } |
| 1848 | - wp_localize_script( 'lsx-colour-control', 'colorSchemeKeys', $colors ); |
|
| 1848 | + wp_localize_script('lsx-colour-control', 'colorSchemeKeys', $colors); |
|
| 1849 | 1849 | } |
| 1850 | 1850 | |
| 1851 | 1851 | /** |
| 1852 | 1852 | * Render the control's content. |
| 1853 | 1853 | */ |
| 1854 | 1854 | public function render_content() { |
| 1855 | - if ( empty( $this->choices ) ) { |
|
| 1855 | + if (empty($this->choices)) { |
|
| 1856 | 1856 | return; |
| 1857 | 1857 | } |
| 1858 | 1858 | |
| 1859 | 1859 | ?> |
| 1860 | 1860 | <label> |
| 1861 | - <?php if ( ! empty( $this->label ) ) { ?> |
|
| 1862 | - <span class="customize-control-title"><?php echo esc_html( $this->label ) ?></span> |
|
| 1861 | + <?php if ( ! empty($this->label)) { ?> |
|
| 1862 | + <span class="customize-control-title"><?php echo esc_html($this->label) ?></span> |
|
| 1863 | 1863 | <?php } |
| 1864 | - if ( ! empty( $this->description ) ) { ?> |
|
| 1865 | - <span class="description customize-control-description"><?php echo esc_html( $this->description ) ?></span> |
|
| 1864 | + if ( ! empty($this->description)) { ?> |
|
| 1865 | + <span class="description customize-control-description"><?php echo esc_html($this->description) ?></span> |
|
| 1866 | 1866 | <?php } ?> |
| 1867 | 1867 | <select <?php $this->link() ?>> |
| 1868 | 1868 | <?php |
| 1869 | - foreach ( $this->choices as $value => $label ) { |
|
| 1870 | - echo '<option value="'. esc_attr( $value ) .'"'. selected( $this->value(), $value, false ) .'>'. esc_html( $label['label'] ) .'</option>'; |
|
| 1869 | + foreach ($this->choices as $value => $label) { |
|
| 1870 | + echo '<option value="' . esc_attr($value) . '"' . selected($this->value(), $value, false) . '>' . esc_html($label['label']) . '</option>'; |
|
| 1871 | 1871 | } |
| 1872 | 1872 | ?> |
| 1873 | 1873 | </select> |