@@ -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,122 +136,122 @@ 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__( 'White', 'lsx-customizer' ), |
|
| 242 | - 'slug' => 'white', |
|
| 243 | - 'color' => '#ffffff', |
|
| 244 | - ), |
|
| 245 | - array( |
|
| 246 | - 'name' => esc_html__( 'Black', 'lsx-customizer' ), |
|
| 247 | - 'slug' => 'black', |
|
| 248 | - 'color' => '#000000', |
|
| 249 | - ), |
|
| 250 | - )); |
|
| 251 | - } |
|
| 252 | - |
|
| 253 | - } |
|
| 254 | - |
|
| 255 | - 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__( 'White', 'lsx-customizer' ), |
|
| 242 | + 'slug' => 'white', |
|
| 243 | + 'color' => '#ffffff', |
|
| 244 | + ), |
|
| 245 | + array( |
|
| 246 | + 'name' => esc_html__( 'Black', 'lsx-customizer' ), |
|
| 247 | + 'slug' => 'black', |
|
| 248 | + 'color' => '#000000', |
|
| 249 | + ), |
|
| 250 | + )); |
|
| 251 | + } |
|
| 252 | + |
|
| 253 | + } |
|
| 254 | + |
|
| 255 | + new LSX_Customizer_Frontend(); |
|
| 256 | 256 | |
| 257 | 257 | } |
@@ -1,5 +1,5 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | -if ( ! class_exists( 'LSX_Customizer_Frontend' ) ) { |
|
| 2 | +if ( ! class_exists('LSX_Customizer_Frontend')) { |
|
| 3 | 3 | |
| 4 | 4 | /** |
| 5 | 5 | * LSX Customizer Frontend Class |
@@ -18,12 +18,12 @@ discard block |
||
| 18 | 18 | * @since 1.0.0 |
| 19 | 19 | */ |
| 20 | 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 ); |
|
| 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 | 27 | } |
| 28 | 28 | |
| 29 | 29 | /** |
@@ -32,21 +32,21 @@ discard block |
||
| 32 | 32 | * @since 1.0.0 |
| 33 | 33 | */ |
| 34 | 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 ); |
|
| 35 | + wp_enqueue_script('lsx-customizer', LSX_CUSTOMIZER_URL . 'assets/js/lsx-customizer.min.js', array('jquery'), LSX_CUSTOMIZER_VER, true); |
|
| 36 | 36 | |
| 37 | - $params = apply_filters( 'lsx_customizer_js_params', array( |
|
| 38 | - 'ajax_url' => admin_url( 'admin-ajax.php' ), |
|
| 37 | + $params = apply_filters('lsx_customizer_js_params', array( |
|
| 38 | + 'ajax_url' => admin_url('admin-ajax.php'), |
|
| 39 | 39 | )); |
| 40 | 40 | |
| 41 | - wp_localize_script( 'lsx-customizer', 'lsx_customizer_params', $params ); |
|
| 41 | + wp_localize_script('lsx-customizer', 'lsx_customizer_params', $params); |
|
| 42 | 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' ); |
|
| 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 | 45 | |
| 46 | - $two_step_checkout = get_theme_mod( 'lsx_two_step_checkout', false ); |
|
| 47 | - if ( is_checkout() && ! empty( $two_step_checkout ) ) { |
|
| 46 | + $two_step_checkout = get_theme_mod('lsx_two_step_checkout', false); |
|
| 47 | + if (is_checkout() && ! empty($two_step_checkout)) { |
|
| 48 | 48 | |
| 49 | - wp_enqueue_script( 'flexslider', LSX_CUSTOMIZER_URL . 'assets/js/jquery.flexslider.min.js', array( 'jquery' ), '2.5.0' ); |
|
| 49 | + wp_enqueue_script('flexslider', LSX_CUSTOMIZER_URL . 'assets/js/jquery.flexslider.min.js', array('jquery'), '2.5.0'); |
|
| 50 | 50 | } |
| 51 | 51 | |
| 52 | 52 | } |
@@ -59,84 +59,84 @@ discard block |
||
| 59 | 59 | public function lsx_customizer_color_palette_css() { |
| 60 | 60 | $styles = ' |
| 61 | 61 | .container #primary.content-area .has-primary-color-background-color { |
| 62 | - background-color:' . get_theme_mod( 'primary_color', '#428bca' ) . '; |
|
| 62 | + background-color:' . get_theme_mod('primary_color', '#428bca') . '; |
|
| 63 | 63 | } |
| 64 | 64 | .container #primary.content-area .has-primary-color-color { |
| 65 | - color: ' . get_theme_mod( 'primary_color', '#428bca' ) . '; |
|
| 65 | + color: ' . get_theme_mod('primary_color', '#428bca') . '; |
|
| 66 | 66 | } |
| 67 | 67 | |
| 68 | 68 | .container #primary.content-area .has-strong-primary-color-background-color { |
| 69 | - background-color:' . get_theme_mod( 'strong_primary_color', '#2a6496' ) . '; |
|
| 69 | + background-color:' . get_theme_mod('strong_primary_color', '#2a6496') . '; |
|
| 70 | 70 | } |
| 71 | 71 | .container #primary.content-area .has-strong-primary-color-color { |
| 72 | - color: ' . get_theme_mod( 'strong_primary_color', '#2a6496' ) . '; |
|
| 72 | + color: ' . get_theme_mod('strong_primary_color', '#2a6496') . '; |
|
| 73 | 73 | } |
| 74 | 74 | |
| 75 | 75 | .container #primary.content-area .has-cta-color-background-color { |
| 76 | - background-color:' . get_theme_mod( 'call_to_action_color', '#f7941d' ) . '; |
|
| 76 | + background-color:' . get_theme_mod('call_to_action_color', '#f7941d') . '; |
|
| 77 | 77 | } |
| 78 | 78 | .container #primary.content-area .has-cta-color-color { |
| 79 | - color: ' . get_theme_mod( 'call_to_action_color', '#f7941d' ) . '; |
|
| 79 | + color: ' . get_theme_mod('call_to_action_color', '#f7941d') . '; |
|
| 80 | 80 | } |
| 81 | 81 | |
| 82 | 82 | .container #primary.content-area .has-strong-cta-color-background-color { |
| 83 | - background-color:' . get_theme_mod( 'strong_cta_color', '#f7741d' ) . '; |
|
| 83 | + background-color:' . get_theme_mod('strong_cta_color', '#f7741d') . '; |
|
| 84 | 84 | } |
| 85 | 85 | .container #primary.content-area .has-strong-cta-color-color { |
| 86 | - color: ' . get_theme_mod( 'strong_cta_color', '#f7741d' ) . '; |
|
| 86 | + color: ' . get_theme_mod('strong_cta_color', '#f7741d') . '; |
|
| 87 | 87 | } |
| 88 | 88 | |
| 89 | 89 | .container #primary.content-area .has-strong-cta-color-background-color { |
| 90 | - background-color:' . get_theme_mod( 'strong_cta_color', '#f7741d' ) . '; |
|
| 90 | + background-color:' . get_theme_mod('strong_cta_color', '#f7741d') . '; |
|
| 91 | 91 | } |
| 92 | 92 | .container #primary.content-area .has-strong-cta-color-color { |
| 93 | - color: ' . get_theme_mod( 'strong_cta_color', '#f7741d' ) . '; |
|
| 93 | + color: ' . get_theme_mod('strong_cta_color', '#f7741d') . '; |
|
| 94 | 94 | } |
| 95 | 95 | |
| 96 | 96 | .container #primary.content-area .has-secondary-color-background-color { |
| 97 | - background-color:' . get_theme_mod( 'secondary_color', '#eaeaea' ) . '; |
|
| 97 | + background-color:' . get_theme_mod('secondary_color', '#eaeaea') . '; |
|
| 98 | 98 | } |
| 99 | 99 | .container #primary.content-area .has-secondary-color-color { |
| 100 | - color: ' . get_theme_mod( 'secondary_color', '#eaeaea' ) . '; |
|
| 100 | + color: ' . get_theme_mod('secondary_color', '#eaeaea') . '; |
|
| 101 | 101 | } |
| 102 | 102 | |
| 103 | 103 | .container #primary.content-area .has-strong-secondary-color-background-color { |
| 104 | - background-color:' . get_theme_mod( 'strong_secondary_color', '#c4c4c4' ) . '; |
|
| 104 | + background-color:' . get_theme_mod('strong_secondary_color', '#c4c4c4') . '; |
|
| 105 | 105 | } |
| 106 | 106 | .container #primary.content-area .has-strong-secondary-color-color { |
| 107 | - color: ' . get_theme_mod( 'strong_secondary_color', '#c4c4c4' ) . '; |
|
| 107 | + color: ' . get_theme_mod('strong_secondary_color', '#c4c4c4') . '; |
|
| 108 | 108 | } |
| 109 | 109 | |
| 110 | 110 | .container #primary.content-area .has-tertiary-color-background-color { |
| 111 | - background-color:' . get_theme_mod( 'tertiary_color', '#6BA913' ) . '; |
|
| 111 | + background-color:' . get_theme_mod('tertiary_color', '#6BA913') . '; |
|
| 112 | 112 | } |
| 113 | 113 | .container #primary.content-area .has-tertiary-color-color { |
| 114 | - color: ' . get_theme_mod( 'tertiary_color', '#6BA913' ) . '; |
|
| 114 | + color: ' . get_theme_mod('tertiary_color', '#6BA913') . '; |
|
| 115 | 115 | } |
| 116 | 116 | |
| 117 | 117 | .container #primary.content-area .has-strong-tertiary-color-background-color { |
| 118 | - background-color:' . get_theme_mod( 'strong_tertiary_color', '#3F640B' ) . '; |
|
| 118 | + background-color:' . get_theme_mod('strong_tertiary_color', '#3F640B') . '; |
|
| 119 | 119 | } |
| 120 | 120 | .container #primary.content-area .has-strong-tertiary-color-color { |
| 121 | - color: ' . get_theme_mod( 'strong_tertiary_color', '#3F640B' ) . '; |
|
| 121 | + color: ' . get_theme_mod('strong_tertiary_color', '#3F640B') . '; |
|
| 122 | 122 | } |
| 123 | 123 | |
| 124 | 124 | .container #primary.content-area .has-heading-color-background-color { |
| 125 | - background-color:' . get_theme_mod( 'heading_color', '#4a4a4a' ) . '; |
|
| 125 | + background-color:' . get_theme_mod('heading_color', '#4a4a4a') . '; |
|
| 126 | 126 | } |
| 127 | 127 | .container #primary.content-area .has-heading-color-color { |
| 128 | - color: ' . get_theme_mod( 'heading_color', '#4a4a4a' ) . '; |
|
| 128 | + color: ' . get_theme_mod('heading_color', '#4a4a4a') . '; |
|
| 129 | 129 | } |
| 130 | 130 | |
| 131 | 131 | .container #primary.content-area .has-body-color-background-color { |
| 132 | - background-color:' . get_theme_mod( 'body_text_color_color', '#444444' ) . '; |
|
| 132 | + background-color:' . get_theme_mod('body_text_color_color', '#444444') . '; |
|
| 133 | 133 | } |
| 134 | 134 | .container #primary.content-area .has-body-color-color { |
| 135 | - color: ' . get_theme_mod( 'body_text_color_color', '#444444' ) . '; |
|
| 135 | + color: ' . get_theme_mod('body_text_color_color', '#444444') . '; |
|
| 136 | 136 | } |
| 137 | 137 | |
| 138 | 138 | '; |
| 139 | - wp_add_inline_style( 'lsx-customizer', $styles ); |
|
| 139 | + wp_add_inline_style('lsx-customizer', $styles); |
|
| 140 | 140 | } |
| 141 | 141 | |
| 142 | 142 | /** |
@@ -145,10 +145,10 @@ discard block |
||
| 145 | 145 | * @since 1.0.0 |
| 146 | 146 | */ |
| 147 | 147 | public function layout() { |
| 148 | - $theme_credit = get_theme_mod( 'lsx_theme_credit_status', true ); |
|
| 148 | + $theme_credit = get_theme_mod('lsx_theme_credit_status', true); |
|
| 149 | 149 | |
| 150 | - if ( false == $theme_credit ) { |
|
| 151 | - add_filter( 'lsx_credit_link', '__return_false' ); |
|
| 150 | + if (false == $theme_credit) { |
|
| 151 | + add_filter('lsx_credit_link', '__return_false'); |
|
| 152 | 152 | } |
| 153 | 153 | } |
| 154 | 154 | |
@@ -160,10 +160,10 @@ discard block |
||
| 160 | 160 | */ |
| 161 | 161 | public function lsx_distraction_free_checkout() { |
| 162 | 162 | |
| 163 | - $distraction_free = get_theme_mod( 'lsx_distraction_free_checkout', false ); |
|
| 163 | + $distraction_free = get_theme_mod('lsx_distraction_free_checkout', false); |
|
| 164 | 164 | |
| 165 | - if ( is_checkout() && ! empty( $distraction_free ) ) { |
|
| 166 | - remove_action( 'lsx_body_bottom', 'lsx_wc_footer_bar', 15 ); |
|
| 165 | + if (is_checkout() && ! empty($distraction_free)) { |
|
| 166 | + remove_action('lsx_body_bottom', 'lsx_wc_footer_bar', 15); |
|
| 167 | 167 | |
| 168 | 168 | } |
| 169 | 169 | } |
@@ -175,18 +175,18 @@ discard block |
||
| 175 | 175 | * @return void |
| 176 | 176 | */ |
| 177 | 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 ); |
|
| 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 | 190 | } |
| 191 | 191 | } |
| 192 | 192 | |
@@ -196,54 +196,54 @@ discard block |
||
| 196 | 196 | * @return void |
| 197 | 197 | */ |
| 198 | 198 | public function lsx_customizer_color_palette_setup() { |
| 199 | - add_theme_support( 'editor-color-palette', array( |
|
| 199 | + add_theme_support('editor-color-palette', array( |
|
| 200 | 200 | array( |
| 201 | - 'name' => esc_html__( 'Primary Color', 'lsx-customizer' ), |
|
| 201 | + 'name' => esc_html__('Primary Color', 'lsx-customizer'), |
|
| 202 | 202 | 'slug' => 'primary-color', |
| 203 | - 'color' => get_theme_mod( 'primary_color', '#428bca' ), |
|
| 203 | + 'color' => get_theme_mod('primary_color', '#428bca'), |
|
| 204 | 204 | ), |
| 205 | 205 | array( |
| 206 | - 'name' => esc_html__( 'Strong Primary Color', 'lsx-customizer' ), |
|
| 206 | + 'name' => esc_html__('Strong Primary Color', 'lsx-customizer'), |
|
| 207 | 207 | 'slug' => 'strong-primary-color', |
| 208 | - 'color' => get_theme_mod( 'strong_primary_color', '#2a6496' ), |
|
| 208 | + 'color' => get_theme_mod('strong_primary_color', '#2a6496'), |
|
| 209 | 209 | ), |
| 210 | 210 | array( |
| 211 | - 'name' => esc_html__( 'CTA Color', 'lsx-customizer' ), |
|
| 211 | + 'name' => esc_html__('CTA Color', 'lsx-customizer'), |
|
| 212 | 212 | 'slug' => 'cta-color', |
| 213 | - 'color' => get_theme_mod( 'call_to_action_color', '#f7941d' ), |
|
| 213 | + 'color' => get_theme_mod('call_to_action_color', '#f7941d'), |
|
| 214 | 214 | ), |
| 215 | 215 | array( |
| 216 | - 'name' => esc_html__( 'Strong CTA Color', 'lsx-customizer' ), |
|
| 216 | + 'name' => esc_html__('Strong CTA Color', 'lsx-customizer'), |
|
| 217 | 217 | 'slug' => 'strong-cta-color', |
| 218 | - 'color' => get_theme_mod( 'strong_cta_color', '#f7741d' ), |
|
| 218 | + 'color' => get_theme_mod('strong_cta_color', '#f7741d'), |
|
| 219 | 219 | ), |
| 220 | 220 | array( |
| 221 | - 'name' => esc_html__( 'Secondary Color', 'lsx-customizer' ), |
|
| 221 | + 'name' => esc_html__('Secondary Color', 'lsx-customizer'), |
|
| 222 | 222 | 'slug' => 'secondary-color', |
| 223 | - 'color' => get_theme_mod( 'secondary_color', '#eaeaea' ), |
|
| 223 | + 'color' => get_theme_mod('secondary_color', '#eaeaea'), |
|
| 224 | 224 | ), |
| 225 | 225 | array( |
| 226 | - 'name' => esc_html__( 'Strong Secondary Color', 'lsx-customizer' ), |
|
| 226 | + 'name' => esc_html__('Strong Secondary Color', 'lsx-customizer'), |
|
| 227 | 227 | 'slug' => 'strong-secondary-color', |
| 228 | - 'color' => get_theme_mod( 'strong_secondary_color', '#c4c4c4' ), |
|
| 228 | + 'color' => get_theme_mod('strong_secondary_color', '#c4c4c4'), |
|
| 229 | 229 | ), |
| 230 | 230 | array( |
| 231 | - 'name' => esc_html__( 'Tertiary Color', 'lsx-customizer' ), |
|
| 231 | + 'name' => esc_html__('Tertiary Color', 'lsx-customizer'), |
|
| 232 | 232 | 'slug' => 'tertiary-color', |
| 233 | - 'color' => get_theme_mod( 'tertiary_color', '#6BA913' ), |
|
| 233 | + 'color' => get_theme_mod('tertiary_color', '#6BA913'), |
|
| 234 | 234 | ), |
| 235 | 235 | array( |
| 236 | - 'name' => esc_html__( 'Strong Tertiary Color', 'lsx-customizer' ), |
|
| 236 | + 'name' => esc_html__('Strong Tertiary Color', 'lsx-customizer'), |
|
| 237 | 237 | 'slug' => 'strong-tertiary-color', |
| 238 | - 'color' => get_theme_mod( 'strong_tertiary_color', '#3F640B' ), |
|
| 238 | + 'color' => get_theme_mod('strong_tertiary_color', '#3F640B'), |
|
| 239 | 239 | ), |
| 240 | 240 | array( |
| 241 | - 'name' => esc_html__( 'White', 'lsx-customizer' ), |
|
| 241 | + 'name' => esc_html__('White', 'lsx-customizer'), |
|
| 242 | 242 | 'slug' => 'white', |
| 243 | 243 | 'color' => '#ffffff', |
| 244 | 244 | ), |
| 245 | 245 | array( |
| 246 | - 'name' => esc_html__( 'Black', 'lsx-customizer' ), |
|
| 246 | + 'name' => esc_html__('Black', 'lsx-customizer'), |
|
| 247 | 247 | 'slug' => 'black', |
| 248 | 248 | 'color' => '#000000', |
| 249 | 249 | ), |
@@ -1,407 +1,407 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | if ( ! class_exists( 'LSX_Customizer_Colour' ) ) { |
| 3 | 3 | |
| 4 | - /** |
|
| 5 | - * LSX Customizer Colour Class |
|
| 6 | - * |
|
| 7 | - * @package LSX Customizer |
|
| 8 | - * @author LightSpeed |
|
| 9 | - * @license GPL3 |
|
| 10 | - * @link |
|
| 11 | - * @copyright 2016 LightSpeed |
|
| 12 | - */ |
|
| 13 | - class LSX_Customizer_Colour extends LSX_Customizer { |
|
| 14 | - |
|
| 15 | - /** |
|
| 16 | - * Button customizer instance. |
|
| 17 | - * |
|
| 18 | - * @var string |
|
| 19 | - * @since 1.0.0 |
|
| 20 | - */ |
|
| 21 | - public $button; |
|
| 22 | - |
|
| 23 | - /** |
|
| 24 | - * Button CTA customizer instance. |
|
| 25 | - * |
|
| 26 | - * @var string |
|
| 27 | - * @since 1.0.0 |
|
| 28 | - */ |
|
| 29 | - public $button_cta; |
|
| 30 | - |
|
| 31 | - /** |
|
| 32 | - * Button secondary customizer instance. |
|
| 33 | - * |
|
| 34 | - * @var string |
|
| 35 | - * @since 1.1.0 |
|
| 36 | - */ |
|
| 37 | - public $button_secondary; |
|
| 38 | - |
|
| 39 | - /** |
|
| 40 | - * Button tertiary customizer instance. |
|
| 41 | - * |
|
| 42 | - * @var string |
|
| 43 | - * @since 1.1.0 |
|
| 44 | - */ |
|
| 45 | - public $button_tertiary; |
|
| 46 | - |
|
| 47 | - /** |
|
| 48 | - * Top Menu customizer instance. |
|
| 49 | - * |
|
| 50 | - * @var string |
|
| 51 | - * @since 1.0.0 |
|
| 52 | - */ |
|
| 53 | - public $top_menu; |
|
| 54 | - |
|
| 55 | - /** |
|
| 56 | - * Header customizer instance. |
|
| 57 | - * |
|
| 58 | - * @var string |
|
| 59 | - * @since 1.0.0 |
|
| 60 | - */ |
|
| 61 | - public $header; |
|
| 62 | - |
|
| 63 | - /** |
|
| 64 | - * Main menu customizer instance. |
|
| 65 | - * |
|
| 66 | - * @var string |
|
| 67 | - * @since 1.0.0 |
|
| 68 | - */ |
|
| 69 | - public $main_menu; |
|
| 70 | - |
|
| 71 | - /** |
|
| 72 | - * Banner customizer instance. |
|
| 73 | - * |
|
| 74 | - * @var string |
|
| 75 | - * @since 1.0.0 |
|
| 76 | - */ |
|
| 77 | - public $banner; |
|
| 78 | - |
|
| 79 | - /** |
|
| 80 | - * Body customizer instance. |
|
| 81 | - * |
|
| 82 | - * @var string |
|
| 83 | - * @since 1.0.0 |
|
| 84 | - */ |
|
| 85 | - public $body; |
|
| 86 | - |
|
| 87 | - /** |
|
| 88 | - * Footer CTA customizer instance. |
|
| 89 | - * |
|
| 90 | - * @var string |
|
| 91 | - * @since 1.0.0 |
|
| 92 | - */ |
|
| 93 | - public $footer_cta; |
|
| 94 | - |
|
| 95 | - /** |
|
| 96 | - * Footer Widgets customizer instance. |
|
| 97 | - * |
|
| 98 | - * @var string |
|
| 99 | - * @since 1.0.0 |
|
| 100 | - */ |
|
| 101 | - public $footer_widgets; |
|
| 102 | - |
|
| 103 | - /** |
|
| 104 | - * Footer customizer instance. |
|
| 105 | - * |
|
| 106 | - * @var string |
|
| 107 | - * @since 1.0.0 |
|
| 108 | - */ |
|
| 109 | - public $footer; |
|
| 110 | - |
|
| 111 | - /** |
|
| 112 | - * Constructor. |
|
| 113 | - * |
|
| 114 | - * @since 1.0.0 |
|
| 115 | - */ |
|
| 116 | - public function __construct() { |
|
| 117 | - add_action( 'after_setup_theme', array( $this, 'after_setup_theme' ), 20 ); |
|
| 118 | - add_action( 'customize_register', array( $this, 'customize_register' ), 20 ); |
|
| 119 | - add_action( 'customize_controls_print_footer_scripts', array( $this, 'colour_scheme_css_template' ) ); |
|
| 120 | - } |
|
| 121 | - |
|
| 122 | - /** |
|
| 123 | - * Customizer Controls and Settings. |
|
| 124 | - * |
|
| 125 | - * @param WP_Customize_Manager $wp_customize Theme Customizer object. |
|
| 126 | - * @since 1.0.0 |
|
| 127 | - */ |
|
| 128 | - public function after_setup_theme() { |
|
| 129 | - require_once( LSX_CUSTOMIZER_PATH . 'includes/lsx-customizer-colour-options.php' ); |
|
| 130 | - require_once( LSX_CUSTOMIZER_PATH . 'includes/lsx-customizer-colour-deprecated.php' ); |
|
| 131 | - require_once( LSX_CUSTOMIZER_PATH . 'includes/lsx-customizer-templates.php' ); |
|
| 132 | - |
|
| 133 | - if ( class_exists( 'WP_Customize_Control' ) ) { |
|
| 134 | - require_once( LSX_CUSTOMIZER_PATH . 'classes/class-lsx-customizer-colour-control.php' ); |
|
| 135 | - } |
|
| 136 | - |
|
| 137 | - require_once( LSX_CUSTOMIZER_PATH . 'classes/class-lsx-customizer-colour-button.php' ); |
|
| 138 | - $this->button = new LSX_Customizer_Colour_Button(); |
|
| 139 | - |
|
| 140 | - require_once( LSX_CUSTOMIZER_PATH . 'classes/class-lsx-customizer-colour-button-cta.php' ); |
|
| 141 | - $this->button_cta = new LSX_Customizer_Colour_Button_CTA(); |
|
| 142 | - |
|
| 143 | - require_once( LSX_CUSTOMIZER_PATH . 'classes/class-lsx-customizer-colour-button-secondary.php' ); |
|
| 144 | - $this->button_secondary = new LSX_Customizer_Colour_Button_Secondary(); |
|
| 145 | - |
|
| 146 | - require_once( LSX_CUSTOMIZER_PATH . 'classes/class-lsx-customizer-colour-button-tertiary.php' ); |
|
| 147 | - $this->button_tertiary = new LSX_Customizer_Colour_Button_Tertiary(); |
|
| 148 | - |
|
| 149 | - require_once( LSX_CUSTOMIZER_PATH . 'classes/class-lsx-customizer-colour-top-menu.php' ); |
|
| 150 | - $this->top_menu = new LSX_Customizer_Colour_Top_Menu(); |
|
| 151 | - |
|
| 152 | - require_once( LSX_CUSTOMIZER_PATH . 'classes/class-lsx-customizer-colour-header.php' ); |
|
| 153 | - $this->header = new LSX_Customizer_Colour_Header(); |
|
| 154 | - |
|
| 155 | - require_once( LSX_CUSTOMIZER_PATH . 'classes/class-lsx-customizer-colour-main-menu.php' ); |
|
| 156 | - $this->main_menu = new LSX_Customizer_Colour_Main_Menu(); |
|
| 157 | - |
|
| 158 | - require_once( LSX_CUSTOMIZER_PATH . 'classes/class-lsx-customizer-colour-banner.php' ); |
|
| 159 | - $this->banner = new LSX_Customizer_Colour_Banner(); |
|
| 160 | - |
|
| 161 | - require_once( LSX_CUSTOMIZER_PATH . 'classes/class-lsx-customizer-colour-body.php' ); |
|
| 162 | - $this->body = new LSX_Customizer_Colour_Body(); |
|
| 163 | - |
|
| 164 | - require_once( LSX_CUSTOMIZER_PATH . 'classes/class-lsx-customizer-colour-footer-cta.php' ); |
|
| 165 | - $this->footer_cta = new LSX_Customizer_Colour_Footer_CTA(); |
|
| 166 | - |
|
| 167 | - require_once( LSX_CUSTOMIZER_PATH . 'classes/class-lsx-customizer-colour-footer-widgets.php' ); |
|
| 168 | - $this->footer_widgets = new LSX_Customizer_Colour_Footer_Widgets(); |
|
| 169 | - |
|
| 170 | - require_once( LSX_CUSTOMIZER_PATH . 'classes/class-lsx-customizer-colour-footer.php' ); |
|
| 171 | - $this->footer = new LSX_Customizer_Colour_Footer(); |
|
| 172 | - } |
|
| 173 | - |
|
| 174 | - /** |
|
| 175 | - * Customizer Controls and Settings. |
|
| 176 | - * |
|
| 177 | - * @param WP_Customize_Manager $wp_customize Theme Customizer object. |
|
| 178 | - * @since 1.0.0 |
|
| 179 | - */ |
|
| 180 | - public function customize_register( $wp_customize ) { |
|
| 181 | - global $customizer_colour_names; |
|
| 182 | - global $customizer_colour_choices; |
|
| 183 | - |
|
| 184 | - /** |
|
| 185 | - * Colors |
|
| 186 | - */ |
|
| 187 | - $wp_customize->add_panel( 'colors', array( |
|
| 188 | - 'title' => esc_html__( 'Colors', 'lsx-customizer' ), |
|
| 189 | - 'priority' => 60, |
|
| 190 | - ) ); |
|
| 191 | - |
|
| 192 | - /** |
|
| 193 | - * Colors - Sections |
|
| 194 | - */ |
|
| 195 | - $wp_customize->add_section( 'colors-core', array( |
|
| 196 | - 'title' => esc_html__( 'Color Scheme', 'lsx-customizer' ), |
|
| 197 | - 'priority' => 1, |
|
| 198 | - 'panel' => 'colors', |
|
| 199 | - ) ); |
|
| 200 | - |
|
| 201 | - $wp_customize->add_section( 'colors-palette', array( |
|
| 202 | - 'title' => esc_html__( 'Block Editor Color Palette', 'lsx-customizer' ), |
|
| 203 | - 'description' => esc_html__( 'Add colors to use within the Gutenberg editor color palette.', 'lsx-customizer' ), |
|
| 204 | - 'priority' => 2, |
|
| 205 | - 'panel' => 'colors', |
|
| 206 | - ) ); |
|
| 207 | - |
|
| 208 | - $wp_customize->add_section( 'colors-button', array( |
|
| 209 | - 'title' => esc_html__( 'Button', 'lsx-customizer' ), |
|
| 210 | - 'priority' => 3, |
|
| 211 | - 'panel' => 'colors', |
|
| 212 | - ) ); |
|
| 213 | - |
|
| 214 | - $wp_customize->add_section( 'colors-button-cta', array( |
|
| 215 | - 'title' => esc_html__( 'Button CTA', 'lsx-customizer' ), |
|
| 216 | - 'priority' => 4, |
|
| 217 | - 'panel' => 'colors', |
|
| 218 | - ) ); |
|
| 219 | - |
|
| 220 | - $wp_customize->add_section( 'colors-button-secondary', array( |
|
| 221 | - 'title' => esc_html__( 'Button Secondary', 'lsx-customizer' ), |
|
| 222 | - 'priority' => 5, |
|
| 223 | - 'panel' => 'colors', |
|
| 224 | - ) ); |
|
| 225 | - |
|
| 226 | - $wp_customize->add_section( 'colors-button-tertiary', array( |
|
| 227 | - 'title' => esc_html__( 'Button Tertiary', 'lsx-customizer' ), |
|
| 228 | - 'priority' => 6, |
|
| 229 | - 'panel' => 'colors', |
|
| 230 | - ) ); |
|
| 231 | - |
|
| 232 | - $wp_customize->add_section( 'colors-top-menu', array( |
|
| 233 | - 'title' => esc_html__( 'Top Menu', 'lsx-customizer' ), |
|
| 234 | - 'priority' => 7, |
|
| 235 | - 'panel' => 'colors', |
|
| 236 | - ) ); |
|
| 237 | - |
|
| 238 | - $wp_customize->add_section( 'colors-header', array( |
|
| 239 | - 'title' => esc_html__( 'Header', 'lsx-customizer' ), |
|
| 240 | - 'priority' => 8, |
|
| 241 | - 'panel' => 'colors', |
|
| 242 | - ) ); |
|
| 243 | - |
|
| 244 | - $wp_customize->add_section( 'colors-main-menu', array( |
|
| 245 | - 'title' => esc_html__( 'Main Menu', 'lsx-customizer' ), |
|
| 246 | - 'priority' => 9, |
|
| 247 | - 'panel' => 'colors', |
|
| 248 | - ) ); |
|
| 249 | - |
|
| 250 | - $wp_customize->add_section( 'colors-banner', array( |
|
| 251 | - 'title' => esc_html__( 'Banner', 'lsx-customizer' ), |
|
| 252 | - 'priority' => 10, |
|
| 253 | - 'panel' => 'colors', |
|
| 254 | - ) ); |
|
| 255 | - |
|
| 256 | - $wp_customize->add_section( 'colors-body', array( |
|
| 257 | - 'title' => esc_html__( 'Body', 'lsx-customizer' ), |
|
| 258 | - 'priority' => 11, |
|
| 259 | - 'panel' => 'colors', |
|
| 260 | - ) ); |
|
| 261 | - |
|
| 262 | - $wp_customize->add_section( 'colors-footer-cta', array( |
|
| 263 | - 'title' => esc_html__( 'Footer CTA', 'lsx-customizer' ), |
|
| 264 | - 'priority' => 12, |
|
| 265 | - 'panel' => 'colors', |
|
| 266 | - ) ); |
|
| 267 | - |
|
| 268 | - $wp_customize->add_section( 'colors-footer-widgets', array( |
|
| 269 | - 'title' => esc_html__( 'Footer Widgets', 'lsx-customizer' ), |
|
| 270 | - 'priority' => 13, |
|
| 271 | - 'panel' => 'colors', |
|
| 272 | - ) ); |
|
| 273 | - |
|
| 274 | - $wp_customize->add_section( 'colors-footer', array( |
|
| 275 | - 'title' => esc_html__( 'Footer', 'lsx-customizer' ), |
|
| 276 | - 'priority' => 14, |
|
| 277 | - 'panel' => 'colors', |
|
| 278 | - ) ); |
|
| 279 | - |
|
| 280 | - /** |
|
| 281 | - * Color Scheme |
|
| 282 | - */ |
|
| 283 | - $wp_customize->add_setting( 'color_scheme', array( |
|
| 284 | - 'default' => 'default', |
|
| 285 | - 'type' => 'theme_mod', |
|
| 286 | - 'transport' => 'postMessage', |
|
| 287 | - ) ); |
|
| 288 | - |
|
| 289 | - $wp_customize->add_control( new LSX_Customizer_Colour_Control( |
|
| 290 | - $wp_customize, 'color_scheme', array( |
|
| 291 | - 'label' => esc_html__( 'Base Color Scheme', 'lsx-customizer' ), |
|
| 292 | - 'section' => 'colors-core', |
|
| 293 | - 'type' => 'select', |
|
| 294 | - 'priority' => 1, |
|
| 295 | - 'choices' => $customizer_colour_choices, |
|
| 296 | - ) |
|
| 297 | - ) ); |
|
| 298 | - |
|
| 299 | - /** |
|
| 300 | - * Color Palette |
|
| 301 | - */ |
|
| 302 | - $colors = $this->get_color_scheme(); |
|
| 303 | - |
|
| 304 | - $customizer_colour_defaults = array( |
|
| 305 | - __( 'Primary Color', 'lsx-customizer' ) => get_theme_mod( 'button_background_color', $colors['button_background_color'] ), |
|
| 306 | - __( 'Strong Primary Color', 'lsx-button_shadow' ) => get_theme_mod( 'button_shadow', $colors['body_link_color'] ), |
|
| 307 | - __( 'Call To Action Color', 'lsx-customizer' ) => get_theme_mod( 'button_cta_background_color', $colors['button_cta_background_color'] ), |
|
| 308 | - __( 'Strong CTA Color', 'lsx-button_shadow' ) => get_theme_mod( 'button_cta_shadow', $colors['button_cta_shadow'] ), |
|
| 309 | - __( 'Secondary Color', 'lsx-customizer' ) => get_theme_mod( 'button_secondary_background_color', $colors['button_secondary_background_color'] ), |
|
| 310 | - __( 'Strong Secondary Color', 'lsx-button_shadow' ) => get_theme_mod( 'button_secondary_shadow', $colors['button_secondary_shadow'] ), |
|
| 311 | - __( 'Tertiary Color', 'lsx-customizer' ) => get_theme_mod( 'button_tertiary_background_color', $colors['button_tertiary_background_color'] ), |
|
| 312 | - __( 'Strong Tertiary Color', 'lsx-button_shadow' ) => get_theme_mod( 'button_tertiary_shadow', $colors['button_tertiary_shadow'] ), |
|
| 313 | - ); |
|
| 314 | - foreach ( $customizer_colour_defaults as $key => $value ) { |
|
| 315 | - |
|
| 316 | - $color_name = strtolower( str_replace( ' ', '_', $key ) ); |
|
| 317 | - $color_name = $color_name; |
|
| 318 | - |
|
| 319 | - $wp_customize->add_setting( $color_name, array( |
|
| 320 | - 'default' => $value, |
|
| 321 | - 'type' => 'theme_mod', |
|
| 322 | - 'transport' => 'postMessage', |
|
| 323 | - 'sanitize_callback' => 'sanitize_hex_color', |
|
| 324 | - ) ); |
|
| 325 | - $wp_customize->add_control( |
|
| 326 | - new WP_Customize_Color_Control( |
|
| 327 | - $wp_customize, |
|
| 328 | - $color_name, |
|
| 329 | - array( |
|
| 330 | - 'label' => $key, |
|
| 331 | - 'section' => 'colors-palette', |
|
| 332 | - 'settings' => $color_name, |
|
| 333 | - ) |
|
| 334 | - ) |
|
| 335 | - ); |
|
| 336 | - } |
|
| 337 | - |
|
| 338 | - /** |
|
| 339 | - * Colors |
|
| 340 | - */ |
|
| 341 | - foreach ( $customizer_colour_names as $key => $value ) { |
|
| 342 | - $sanitize_callback = 'sanitize_hex_color'; |
|
| 343 | - |
|
| 344 | - if ( 'background_color' === $key ) { |
|
| 345 | - $sanitize_callback = 'sanitize_hex_color_no_hash'; |
|
| 346 | - } |
|
| 347 | - |
|
| 348 | - $section = 'colors-core'; |
|
| 349 | - |
|
| 350 | - if ( preg_match( '/^button_cta_.*/', $key ) ) { |
|
| 351 | - $section = 'colors-button-cta'; |
|
| 352 | - } elseif ( preg_match( '/^button_secondary_.*/', $key ) ) { |
|
| 353 | - $section = 'colors-button-secondary'; |
|
| 354 | - } elseif ( preg_match( '/^button_tertiary_.*/', $key ) ) { |
|
| 355 | - $section = 'colors-button-tertiary'; |
|
| 356 | - } elseif ( preg_match( '/^button_.*/', $key ) ) { |
|
| 357 | - $section = 'colors-button'; |
|
| 358 | - } elseif ( preg_match( '/^top_menu_.*/', $key ) ) { |
|
| 359 | - $section = 'colors-top-menu'; |
|
| 360 | - } elseif ( preg_match( '/^header_.*/', $key ) ) { |
|
| 361 | - $section = 'colors-header'; |
|
| 362 | - } elseif ( preg_match( '/^main_menu_.*/', $key ) ) { |
|
| 363 | - $section = 'colors-main-menu'; |
|
| 364 | - } elseif ( preg_match( '/^banner_.*/', $key ) ) { |
|
| 365 | - $section = 'colors-banner'; |
|
| 366 | - } elseif ( preg_match( '/^body_.*/', $key ) || 'background_color' === $key ) { |
|
| 367 | - $section = 'colors-body'; |
|
| 368 | - } elseif ( preg_match( '/^footer_cta_.*/', $key ) ) { |
|
| 369 | - $section = 'colors-footer-cta'; |
|
| 370 | - } elseif ( preg_match( '/^footer_widgets_.*/', $key ) ) { |
|
| 371 | - $section = 'colors-footer-widgets'; |
|
| 372 | - } elseif ( preg_match( '/^footer_.*/', $key ) ) { |
|
| 373 | - $section = 'colors-footer'; |
|
| 374 | - } |
|
| 375 | - |
|
| 376 | - $wp_customize->add_setting( $key, array( |
|
| 377 | - 'default' => $customizer_colour_choices['default']['colors'][ $key ], |
|
| 378 | - 'type' => 'theme_mod', |
|
| 379 | - 'transport' => 'postMessage', |
|
| 380 | - 'sanitize_callback' => $sanitize_callback, |
|
| 381 | - ) ); |
|
| 382 | - |
|
| 383 | - $wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, $key, array( |
|
| 384 | - 'label' => $value, |
|
| 385 | - 'section' => $section, |
|
| 386 | - 'settings' => $key, |
|
| 387 | - ) ) ); |
|
| 388 | - } |
|
| 389 | - } |
|
| 390 | - |
|
| 391 | - /** |
|
| 392 | - * Outputs an Underscore template for generating CSS for the color scheme. |
|
| 393 | - * |
|
| 394 | - * @since 1.0.0 |
|
| 395 | - */ |
|
| 396 | - public function colour_scheme_css_template() { |
|
| 397 | - global $customizer_colour_names; |
|
| 398 | - |
|
| 399 | - $colors = array(); |
|
| 400 | - |
|
| 401 | - foreach ( $customizer_colour_names as $key => $value ) { |
|
| 402 | - $colors[ $key ] = 'unquote("{{ data.' . $key . ' }}")'; |
|
| 403 | - } |
|
| 404 | - ?> |
|
| 4 | + /** |
|
| 5 | + * LSX Customizer Colour Class |
|
| 6 | + * |
|
| 7 | + * @package LSX Customizer |
|
| 8 | + * @author LightSpeed |
|
| 9 | + * @license GPL3 |
|
| 10 | + * @link |
|
| 11 | + * @copyright 2016 LightSpeed |
|
| 12 | + */ |
|
| 13 | + class LSX_Customizer_Colour extends LSX_Customizer { |
|
| 14 | + |
|
| 15 | + /** |
|
| 16 | + * Button customizer instance. |
|
| 17 | + * |
|
| 18 | + * @var string |
|
| 19 | + * @since 1.0.0 |
|
| 20 | + */ |
|
| 21 | + public $button; |
|
| 22 | + |
|
| 23 | + /** |
|
| 24 | + * Button CTA customizer instance. |
|
| 25 | + * |
|
| 26 | + * @var string |
|
| 27 | + * @since 1.0.0 |
|
| 28 | + */ |
|
| 29 | + public $button_cta; |
|
| 30 | + |
|
| 31 | + /** |
|
| 32 | + * Button secondary customizer instance. |
|
| 33 | + * |
|
| 34 | + * @var string |
|
| 35 | + * @since 1.1.0 |
|
| 36 | + */ |
|
| 37 | + public $button_secondary; |
|
| 38 | + |
|
| 39 | + /** |
|
| 40 | + * Button tertiary customizer instance. |
|
| 41 | + * |
|
| 42 | + * @var string |
|
| 43 | + * @since 1.1.0 |
|
| 44 | + */ |
|
| 45 | + public $button_tertiary; |
|
| 46 | + |
|
| 47 | + /** |
|
| 48 | + * Top Menu customizer instance. |
|
| 49 | + * |
|
| 50 | + * @var string |
|
| 51 | + * @since 1.0.0 |
|
| 52 | + */ |
|
| 53 | + public $top_menu; |
|
| 54 | + |
|
| 55 | + /** |
|
| 56 | + * Header customizer instance. |
|
| 57 | + * |
|
| 58 | + * @var string |
|
| 59 | + * @since 1.0.0 |
|
| 60 | + */ |
|
| 61 | + public $header; |
|
| 62 | + |
|
| 63 | + /** |
|
| 64 | + * Main menu customizer instance. |
|
| 65 | + * |
|
| 66 | + * @var string |
|
| 67 | + * @since 1.0.0 |
|
| 68 | + */ |
|
| 69 | + public $main_menu; |
|
| 70 | + |
|
| 71 | + /** |
|
| 72 | + * Banner customizer instance. |
|
| 73 | + * |
|
| 74 | + * @var string |
|
| 75 | + * @since 1.0.0 |
|
| 76 | + */ |
|
| 77 | + public $banner; |
|
| 78 | + |
|
| 79 | + /** |
|
| 80 | + * Body customizer instance. |
|
| 81 | + * |
|
| 82 | + * @var string |
|
| 83 | + * @since 1.0.0 |
|
| 84 | + */ |
|
| 85 | + public $body; |
|
| 86 | + |
|
| 87 | + /** |
|
| 88 | + * Footer CTA customizer instance. |
|
| 89 | + * |
|
| 90 | + * @var string |
|
| 91 | + * @since 1.0.0 |
|
| 92 | + */ |
|
| 93 | + public $footer_cta; |
|
| 94 | + |
|
| 95 | + /** |
|
| 96 | + * Footer Widgets customizer instance. |
|
| 97 | + * |
|
| 98 | + * @var string |
|
| 99 | + * @since 1.0.0 |
|
| 100 | + */ |
|
| 101 | + public $footer_widgets; |
|
| 102 | + |
|
| 103 | + /** |
|
| 104 | + * Footer customizer instance. |
|
| 105 | + * |
|
| 106 | + * @var string |
|
| 107 | + * @since 1.0.0 |
|
| 108 | + */ |
|
| 109 | + public $footer; |
|
| 110 | + |
|
| 111 | + /** |
|
| 112 | + * Constructor. |
|
| 113 | + * |
|
| 114 | + * @since 1.0.0 |
|
| 115 | + */ |
|
| 116 | + public function __construct() { |
|
| 117 | + add_action( 'after_setup_theme', array( $this, 'after_setup_theme' ), 20 ); |
|
| 118 | + add_action( 'customize_register', array( $this, 'customize_register' ), 20 ); |
|
| 119 | + add_action( 'customize_controls_print_footer_scripts', array( $this, 'colour_scheme_css_template' ) ); |
|
| 120 | + } |
|
| 121 | + |
|
| 122 | + /** |
|
| 123 | + * Customizer Controls and Settings. |
|
| 124 | + * |
|
| 125 | + * @param WP_Customize_Manager $wp_customize Theme Customizer object. |
|
| 126 | + * @since 1.0.0 |
|
| 127 | + */ |
|
| 128 | + public function after_setup_theme() { |
|
| 129 | + require_once( LSX_CUSTOMIZER_PATH . 'includes/lsx-customizer-colour-options.php' ); |
|
| 130 | + require_once( LSX_CUSTOMIZER_PATH . 'includes/lsx-customizer-colour-deprecated.php' ); |
|
| 131 | + require_once( LSX_CUSTOMIZER_PATH . 'includes/lsx-customizer-templates.php' ); |
|
| 132 | + |
|
| 133 | + if ( class_exists( 'WP_Customize_Control' ) ) { |
|
| 134 | + require_once( LSX_CUSTOMIZER_PATH . 'classes/class-lsx-customizer-colour-control.php' ); |
|
| 135 | + } |
|
| 136 | + |
|
| 137 | + require_once( LSX_CUSTOMIZER_PATH . 'classes/class-lsx-customizer-colour-button.php' ); |
|
| 138 | + $this->button = new LSX_Customizer_Colour_Button(); |
|
| 139 | + |
|
| 140 | + require_once( LSX_CUSTOMIZER_PATH . 'classes/class-lsx-customizer-colour-button-cta.php' ); |
|
| 141 | + $this->button_cta = new LSX_Customizer_Colour_Button_CTA(); |
|
| 142 | + |
|
| 143 | + require_once( LSX_CUSTOMIZER_PATH . 'classes/class-lsx-customizer-colour-button-secondary.php' ); |
|
| 144 | + $this->button_secondary = new LSX_Customizer_Colour_Button_Secondary(); |
|
| 145 | + |
|
| 146 | + require_once( LSX_CUSTOMIZER_PATH . 'classes/class-lsx-customizer-colour-button-tertiary.php' ); |
|
| 147 | + $this->button_tertiary = new LSX_Customizer_Colour_Button_Tertiary(); |
|
| 148 | + |
|
| 149 | + require_once( LSX_CUSTOMIZER_PATH . 'classes/class-lsx-customizer-colour-top-menu.php' ); |
|
| 150 | + $this->top_menu = new LSX_Customizer_Colour_Top_Menu(); |
|
| 151 | + |
|
| 152 | + require_once( LSX_CUSTOMIZER_PATH . 'classes/class-lsx-customizer-colour-header.php' ); |
|
| 153 | + $this->header = new LSX_Customizer_Colour_Header(); |
|
| 154 | + |
|
| 155 | + require_once( LSX_CUSTOMIZER_PATH . 'classes/class-lsx-customizer-colour-main-menu.php' ); |
|
| 156 | + $this->main_menu = new LSX_Customizer_Colour_Main_Menu(); |
|
| 157 | + |
|
| 158 | + require_once( LSX_CUSTOMIZER_PATH . 'classes/class-lsx-customizer-colour-banner.php' ); |
|
| 159 | + $this->banner = new LSX_Customizer_Colour_Banner(); |
|
| 160 | + |
|
| 161 | + require_once( LSX_CUSTOMIZER_PATH . 'classes/class-lsx-customizer-colour-body.php' ); |
|
| 162 | + $this->body = new LSX_Customizer_Colour_Body(); |
|
| 163 | + |
|
| 164 | + require_once( LSX_CUSTOMIZER_PATH . 'classes/class-lsx-customizer-colour-footer-cta.php' ); |
|
| 165 | + $this->footer_cta = new LSX_Customizer_Colour_Footer_CTA(); |
|
| 166 | + |
|
| 167 | + require_once( LSX_CUSTOMIZER_PATH . 'classes/class-lsx-customizer-colour-footer-widgets.php' ); |
|
| 168 | + $this->footer_widgets = new LSX_Customizer_Colour_Footer_Widgets(); |
|
| 169 | + |
|
| 170 | + require_once( LSX_CUSTOMIZER_PATH . 'classes/class-lsx-customizer-colour-footer.php' ); |
|
| 171 | + $this->footer = new LSX_Customizer_Colour_Footer(); |
|
| 172 | + } |
|
| 173 | + |
|
| 174 | + /** |
|
| 175 | + * Customizer Controls and Settings. |
|
| 176 | + * |
|
| 177 | + * @param WP_Customize_Manager $wp_customize Theme Customizer object. |
|
| 178 | + * @since 1.0.0 |
|
| 179 | + */ |
|
| 180 | + public function customize_register( $wp_customize ) { |
|
| 181 | + global $customizer_colour_names; |
|
| 182 | + global $customizer_colour_choices; |
|
| 183 | + |
|
| 184 | + /** |
|
| 185 | + * Colors |
|
| 186 | + */ |
|
| 187 | + $wp_customize->add_panel( 'colors', array( |
|
| 188 | + 'title' => esc_html__( 'Colors', 'lsx-customizer' ), |
|
| 189 | + 'priority' => 60, |
|
| 190 | + ) ); |
|
| 191 | + |
|
| 192 | + /** |
|
| 193 | + * Colors - Sections |
|
| 194 | + */ |
|
| 195 | + $wp_customize->add_section( 'colors-core', array( |
|
| 196 | + 'title' => esc_html__( 'Color Scheme', 'lsx-customizer' ), |
|
| 197 | + 'priority' => 1, |
|
| 198 | + 'panel' => 'colors', |
|
| 199 | + ) ); |
|
| 200 | + |
|
| 201 | + $wp_customize->add_section( 'colors-palette', array( |
|
| 202 | + 'title' => esc_html__( 'Block Editor Color Palette', 'lsx-customizer' ), |
|
| 203 | + 'description' => esc_html__( 'Add colors to use within the Gutenberg editor color palette.', 'lsx-customizer' ), |
|
| 204 | + 'priority' => 2, |
|
| 205 | + 'panel' => 'colors', |
|
| 206 | + ) ); |
|
| 207 | + |
|
| 208 | + $wp_customize->add_section( 'colors-button', array( |
|
| 209 | + 'title' => esc_html__( 'Button', 'lsx-customizer' ), |
|
| 210 | + 'priority' => 3, |
|
| 211 | + 'panel' => 'colors', |
|
| 212 | + ) ); |
|
| 213 | + |
|
| 214 | + $wp_customize->add_section( 'colors-button-cta', array( |
|
| 215 | + 'title' => esc_html__( 'Button CTA', 'lsx-customizer' ), |
|
| 216 | + 'priority' => 4, |
|
| 217 | + 'panel' => 'colors', |
|
| 218 | + ) ); |
|
| 219 | + |
|
| 220 | + $wp_customize->add_section( 'colors-button-secondary', array( |
|
| 221 | + 'title' => esc_html__( 'Button Secondary', 'lsx-customizer' ), |
|
| 222 | + 'priority' => 5, |
|
| 223 | + 'panel' => 'colors', |
|
| 224 | + ) ); |
|
| 225 | + |
|
| 226 | + $wp_customize->add_section( 'colors-button-tertiary', array( |
|
| 227 | + 'title' => esc_html__( 'Button Tertiary', 'lsx-customizer' ), |
|
| 228 | + 'priority' => 6, |
|
| 229 | + 'panel' => 'colors', |
|
| 230 | + ) ); |
|
| 231 | + |
|
| 232 | + $wp_customize->add_section( 'colors-top-menu', array( |
|
| 233 | + 'title' => esc_html__( 'Top Menu', 'lsx-customizer' ), |
|
| 234 | + 'priority' => 7, |
|
| 235 | + 'panel' => 'colors', |
|
| 236 | + ) ); |
|
| 237 | + |
|
| 238 | + $wp_customize->add_section( 'colors-header', array( |
|
| 239 | + 'title' => esc_html__( 'Header', 'lsx-customizer' ), |
|
| 240 | + 'priority' => 8, |
|
| 241 | + 'panel' => 'colors', |
|
| 242 | + ) ); |
|
| 243 | + |
|
| 244 | + $wp_customize->add_section( 'colors-main-menu', array( |
|
| 245 | + 'title' => esc_html__( 'Main Menu', 'lsx-customizer' ), |
|
| 246 | + 'priority' => 9, |
|
| 247 | + 'panel' => 'colors', |
|
| 248 | + ) ); |
|
| 249 | + |
|
| 250 | + $wp_customize->add_section( 'colors-banner', array( |
|
| 251 | + 'title' => esc_html__( 'Banner', 'lsx-customizer' ), |
|
| 252 | + 'priority' => 10, |
|
| 253 | + 'panel' => 'colors', |
|
| 254 | + ) ); |
|
| 255 | + |
|
| 256 | + $wp_customize->add_section( 'colors-body', array( |
|
| 257 | + 'title' => esc_html__( 'Body', 'lsx-customizer' ), |
|
| 258 | + 'priority' => 11, |
|
| 259 | + 'panel' => 'colors', |
|
| 260 | + ) ); |
|
| 261 | + |
|
| 262 | + $wp_customize->add_section( 'colors-footer-cta', array( |
|
| 263 | + 'title' => esc_html__( 'Footer CTA', 'lsx-customizer' ), |
|
| 264 | + 'priority' => 12, |
|
| 265 | + 'panel' => 'colors', |
|
| 266 | + ) ); |
|
| 267 | + |
|
| 268 | + $wp_customize->add_section( 'colors-footer-widgets', array( |
|
| 269 | + 'title' => esc_html__( 'Footer Widgets', 'lsx-customizer' ), |
|
| 270 | + 'priority' => 13, |
|
| 271 | + 'panel' => 'colors', |
|
| 272 | + ) ); |
|
| 273 | + |
|
| 274 | + $wp_customize->add_section( 'colors-footer', array( |
|
| 275 | + 'title' => esc_html__( 'Footer', 'lsx-customizer' ), |
|
| 276 | + 'priority' => 14, |
|
| 277 | + 'panel' => 'colors', |
|
| 278 | + ) ); |
|
| 279 | + |
|
| 280 | + /** |
|
| 281 | + * Color Scheme |
|
| 282 | + */ |
|
| 283 | + $wp_customize->add_setting( 'color_scheme', array( |
|
| 284 | + 'default' => 'default', |
|
| 285 | + 'type' => 'theme_mod', |
|
| 286 | + 'transport' => 'postMessage', |
|
| 287 | + ) ); |
|
| 288 | + |
|
| 289 | + $wp_customize->add_control( new LSX_Customizer_Colour_Control( |
|
| 290 | + $wp_customize, 'color_scheme', array( |
|
| 291 | + 'label' => esc_html__( 'Base Color Scheme', 'lsx-customizer' ), |
|
| 292 | + 'section' => 'colors-core', |
|
| 293 | + 'type' => 'select', |
|
| 294 | + 'priority' => 1, |
|
| 295 | + 'choices' => $customizer_colour_choices, |
|
| 296 | + ) |
|
| 297 | + ) ); |
|
| 298 | + |
|
| 299 | + /** |
|
| 300 | + * Color Palette |
|
| 301 | + */ |
|
| 302 | + $colors = $this->get_color_scheme(); |
|
| 303 | + |
|
| 304 | + $customizer_colour_defaults = array( |
|
| 305 | + __( 'Primary Color', 'lsx-customizer' ) => get_theme_mod( 'button_background_color', $colors['button_background_color'] ), |
|
| 306 | + __( 'Strong Primary Color', 'lsx-button_shadow' ) => get_theme_mod( 'button_shadow', $colors['body_link_color'] ), |
|
| 307 | + __( 'Call To Action Color', 'lsx-customizer' ) => get_theme_mod( 'button_cta_background_color', $colors['button_cta_background_color'] ), |
|
| 308 | + __( 'Strong CTA Color', 'lsx-button_shadow' ) => get_theme_mod( 'button_cta_shadow', $colors['button_cta_shadow'] ), |
|
| 309 | + __( 'Secondary Color', 'lsx-customizer' ) => get_theme_mod( 'button_secondary_background_color', $colors['button_secondary_background_color'] ), |
|
| 310 | + __( 'Strong Secondary Color', 'lsx-button_shadow' ) => get_theme_mod( 'button_secondary_shadow', $colors['button_secondary_shadow'] ), |
|
| 311 | + __( 'Tertiary Color', 'lsx-customizer' ) => get_theme_mod( 'button_tertiary_background_color', $colors['button_tertiary_background_color'] ), |
|
| 312 | + __( 'Strong Tertiary Color', 'lsx-button_shadow' ) => get_theme_mod( 'button_tertiary_shadow', $colors['button_tertiary_shadow'] ), |
|
| 313 | + ); |
|
| 314 | + foreach ( $customizer_colour_defaults as $key => $value ) { |
|
| 315 | + |
|
| 316 | + $color_name = strtolower( str_replace( ' ', '_', $key ) ); |
|
| 317 | + $color_name = $color_name; |
|
| 318 | + |
|
| 319 | + $wp_customize->add_setting( $color_name, array( |
|
| 320 | + 'default' => $value, |
|
| 321 | + 'type' => 'theme_mod', |
|
| 322 | + 'transport' => 'postMessage', |
|
| 323 | + 'sanitize_callback' => 'sanitize_hex_color', |
|
| 324 | + ) ); |
|
| 325 | + $wp_customize->add_control( |
|
| 326 | + new WP_Customize_Color_Control( |
|
| 327 | + $wp_customize, |
|
| 328 | + $color_name, |
|
| 329 | + array( |
|
| 330 | + 'label' => $key, |
|
| 331 | + 'section' => 'colors-palette', |
|
| 332 | + 'settings' => $color_name, |
|
| 333 | + ) |
|
| 334 | + ) |
|
| 335 | + ); |
|
| 336 | + } |
|
| 337 | + |
|
| 338 | + /** |
|
| 339 | + * Colors |
|
| 340 | + */ |
|
| 341 | + foreach ( $customizer_colour_names as $key => $value ) { |
|
| 342 | + $sanitize_callback = 'sanitize_hex_color'; |
|
| 343 | + |
|
| 344 | + if ( 'background_color' === $key ) { |
|
| 345 | + $sanitize_callback = 'sanitize_hex_color_no_hash'; |
|
| 346 | + } |
|
| 347 | + |
|
| 348 | + $section = 'colors-core'; |
|
| 349 | + |
|
| 350 | + if ( preg_match( '/^button_cta_.*/', $key ) ) { |
|
| 351 | + $section = 'colors-button-cta'; |
|
| 352 | + } elseif ( preg_match( '/^button_secondary_.*/', $key ) ) { |
|
| 353 | + $section = 'colors-button-secondary'; |
|
| 354 | + } elseif ( preg_match( '/^button_tertiary_.*/', $key ) ) { |
|
| 355 | + $section = 'colors-button-tertiary'; |
|
| 356 | + } elseif ( preg_match( '/^button_.*/', $key ) ) { |
|
| 357 | + $section = 'colors-button'; |
|
| 358 | + } elseif ( preg_match( '/^top_menu_.*/', $key ) ) { |
|
| 359 | + $section = 'colors-top-menu'; |
|
| 360 | + } elseif ( preg_match( '/^header_.*/', $key ) ) { |
|
| 361 | + $section = 'colors-header'; |
|
| 362 | + } elseif ( preg_match( '/^main_menu_.*/', $key ) ) { |
|
| 363 | + $section = 'colors-main-menu'; |
|
| 364 | + } elseif ( preg_match( '/^banner_.*/', $key ) ) { |
|
| 365 | + $section = 'colors-banner'; |
|
| 366 | + } elseif ( preg_match( '/^body_.*/', $key ) || 'background_color' === $key ) { |
|
| 367 | + $section = 'colors-body'; |
|
| 368 | + } elseif ( preg_match( '/^footer_cta_.*/', $key ) ) { |
|
| 369 | + $section = 'colors-footer-cta'; |
|
| 370 | + } elseif ( preg_match( '/^footer_widgets_.*/', $key ) ) { |
|
| 371 | + $section = 'colors-footer-widgets'; |
|
| 372 | + } elseif ( preg_match( '/^footer_.*/', $key ) ) { |
|
| 373 | + $section = 'colors-footer'; |
|
| 374 | + } |
|
| 375 | + |
|
| 376 | + $wp_customize->add_setting( $key, array( |
|
| 377 | + 'default' => $customizer_colour_choices['default']['colors'][ $key ], |
|
| 378 | + 'type' => 'theme_mod', |
|
| 379 | + 'transport' => 'postMessage', |
|
| 380 | + 'sanitize_callback' => $sanitize_callback, |
|
| 381 | + ) ); |
|
| 382 | + |
|
| 383 | + $wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, $key, array( |
|
| 384 | + 'label' => $value, |
|
| 385 | + 'section' => $section, |
|
| 386 | + 'settings' => $key, |
|
| 387 | + ) ) ); |
|
| 388 | + } |
|
| 389 | + } |
|
| 390 | + |
|
| 391 | + /** |
|
| 392 | + * Outputs an Underscore template for generating CSS for the color scheme. |
|
| 393 | + * |
|
| 394 | + * @since 1.0.0 |
|
| 395 | + */ |
|
| 396 | + public function colour_scheme_css_template() { |
|
| 397 | + global $customizer_colour_names; |
|
| 398 | + |
|
| 399 | + $colors = array(); |
|
| 400 | + |
|
| 401 | + foreach ( $customizer_colour_names as $key => $value ) { |
|
| 402 | + $colors[ $key ] = 'unquote("{{ data.' . $key . ' }}")'; |
|
| 403 | + } |
|
| 404 | + ?> |
|
| 405 | 405 | <script type="text/html" id="tmpl-lsx-color-scheme"> |
| 406 | 406 | <?php echo esc_attr( $this->top_menu->get_css( $colors ) ); ?> |
| 407 | 407 | <?php echo esc_attr( $this->header->get_css( $colors ) ); ?> |
@@ -420,89 +420,89 @@ discard block |
||
| 420 | 420 | <?php echo esc_attr( $this->button_tertiary->get_css( $colors ) ); ?> |
| 421 | 421 | </script> |
| 422 | 422 | <?php |
| 423 | - } |
|
| 424 | - |
|
| 425 | - /** |
|
| 426 | - * Transform SCSS to CSS. |
|
| 427 | - * |
|
| 428 | - * @since 1.0.0 |
|
| 429 | - */ |
|
| 430 | - public function scss_to_css( $scss ) { |
|
| 431 | - $css = ''; |
|
| 432 | - $scss_php_file = LSX_CUSTOMIZER_PATH . 'vendor/leafo/scssphp/scss.inc.php'; |
|
| 433 | - $lsx_theme_sass_file = get_template_directory() . '/assets/css/scss/lsx.scss'; |
|
| 434 | - |
|
| 435 | - if ( ! empty( $scss ) && file_exists( $scss_php_file ) && file_exists( $lsx_theme_sass_file ) ) { |
|
| 436 | - require_once $scss_php_file; |
|
| 437 | - |
|
| 438 | - $compiler = new \Leafo\ScssPhp\Compiler(); |
|
| 439 | - $compiler->setFormatter( 'Leafo\ScssPhp\Formatter\Compact' ); |
|
| 440 | - |
|
| 441 | - try { |
|
| 442 | - $scss = ' |
|
| 423 | + } |
|
| 424 | + |
|
| 425 | + /** |
|
| 426 | + * Transform SCSS to CSS. |
|
| 427 | + * |
|
| 428 | + * @since 1.0.0 |
|
| 429 | + */ |
|
| 430 | + public function scss_to_css( $scss ) { |
|
| 431 | + $css = ''; |
|
| 432 | + $scss_php_file = LSX_CUSTOMIZER_PATH . 'vendor/leafo/scssphp/scss.inc.php'; |
|
| 433 | + $lsx_theme_sass_file = get_template_directory() . '/assets/css/scss/lsx.scss'; |
|
| 434 | + |
|
| 435 | + if ( ! empty( $scss ) && file_exists( $scss_php_file ) && file_exists( $lsx_theme_sass_file ) ) { |
|
| 436 | + require_once $scss_php_file; |
|
| 437 | + |
|
| 438 | + $compiler = new \Leafo\ScssPhp\Compiler(); |
|
| 439 | + $compiler->setFormatter( 'Leafo\ScssPhp\Formatter\Compact' ); |
|
| 440 | + |
|
| 441 | + try { |
|
| 442 | + $scss = ' |
|
| 443 | 443 | @import "' . LSX_CUSTOMIZER_PATH . '/assets/css/scss/include-media"; |
| 444 | 444 | @import "' . get_template_directory() . '/assets/css/scss/global/lsx-variables"; |
| 445 | 445 | @import "' . get_template_directory() . '/assets/css/scss/global/mixins/colours-helper"; |
| 446 | 446 | ' . $scss . ' |
| 447 | 447 | '; |
| 448 | 448 | |
| 449 | - $css = $compiler->compile( $scss ); |
|
| 450 | - } catch ( \Exception $e ) { |
|
| 451 | - $error = $e->getMessage(); |
|
| 452 | - return "/*\n\n\$error:\n\n{$error}\n\n\$scss:\n\n{$scss} */"; |
|
| 453 | - } |
|
| 454 | - } |
|
| 455 | - |
|
| 456 | - return $css; |
|
| 457 | - } |
|
| 458 | - |
|
| 459 | - /** |
|
| 460 | - * Converts a HEX value to RGB. |
|
| 461 | - * |
|
| 462 | - * @since 1.0.0 |
|
| 463 | - */ |
|
| 464 | - public static function hex2rgb( $color ) { |
|
| 465 | - $color = trim( $color, '#' ); |
|
| 466 | - |
|
| 467 | - if ( strlen( $color ) === 3 ) { |
|
| 468 | - $r = hexdec( substr( $color, 0, 1 ) . substr( $color, 0, 1 ) ); |
|
| 469 | - $g = hexdec( substr( $color, 1, 1 ) . substr( $color, 1, 1 ) ); |
|
| 470 | - $b = hexdec( substr( $color, 2, 1 ) . substr( $color, 2, 1 ) ); |
|
| 471 | - } elseif ( strlen( $color ) === 6 ) { |
|
| 472 | - $r = hexdec( substr( $color, 0, 2 ) ); |
|
| 473 | - $g = hexdec( substr( $color, 2, 2 ) ); |
|
| 474 | - $b = hexdec( substr( $color, 4, 2 ) ); |
|
| 475 | - } else { |
|
| 476 | - return array(); |
|
| 477 | - } |
|
| 478 | - |
|
| 479 | - return array( |
|
| 480 | - 'red' => $r, |
|
| 481 | - 'green' => $g, |
|
| 482 | - 'blue' => $b, |
|
| 483 | - ); |
|
| 484 | - } |
|
| 485 | - |
|
| 486 | - /** |
|
| 487 | - * Retrieves the current color scheme. |
|
| 488 | - * |
|
| 489 | - * @since 1.0.0 |
|
| 490 | - */ |
|
| 491 | - public function get_color_scheme() { |
|
| 492 | - global $customizer_colour_choices; |
|
| 493 | - |
|
| 494 | - $color_scheme_option = get_theme_mod( 'color_scheme', 'default' ); |
|
| 495 | - $color_schemes = $customizer_colour_choices; |
|
| 496 | - |
|
| 497 | - if ( array_key_exists( $color_scheme_option, $color_schemes ) ) { |
|
| 498 | - return $color_schemes[ $color_scheme_option ]['colors']; |
|
| 499 | - } |
|
| 500 | - |
|
| 501 | - return $color_schemes['default']['colors']; |
|
| 502 | - } |
|
| 503 | - |
|
| 504 | - } |
|
| 505 | - |
|
| 506 | - new LSX_Customizer_Colour(); |
|
| 449 | + $css = $compiler->compile( $scss ); |
|
| 450 | + } catch ( \Exception $e ) { |
|
| 451 | + $error = $e->getMessage(); |
|
| 452 | + return "/*\n\n\$error:\n\n{$error}\n\n\$scss:\n\n{$scss} */"; |
|
| 453 | + } |
|
| 454 | + } |
|
| 455 | + |
|
| 456 | + return $css; |
|
| 457 | + } |
|
| 458 | + |
|
| 459 | + /** |
|
| 460 | + * Converts a HEX value to RGB. |
|
| 461 | + * |
|
| 462 | + * @since 1.0.0 |
|
| 463 | + */ |
|
| 464 | + public static function hex2rgb( $color ) { |
|
| 465 | + $color = trim( $color, '#' ); |
|
| 466 | + |
|
| 467 | + if ( strlen( $color ) === 3 ) { |
|
| 468 | + $r = hexdec( substr( $color, 0, 1 ) . substr( $color, 0, 1 ) ); |
|
| 469 | + $g = hexdec( substr( $color, 1, 1 ) . substr( $color, 1, 1 ) ); |
|
| 470 | + $b = hexdec( substr( $color, 2, 1 ) . substr( $color, 2, 1 ) ); |
|
| 471 | + } elseif ( strlen( $color ) === 6 ) { |
|
| 472 | + $r = hexdec( substr( $color, 0, 2 ) ); |
|
| 473 | + $g = hexdec( substr( $color, 2, 2 ) ); |
|
| 474 | + $b = hexdec( substr( $color, 4, 2 ) ); |
|
| 475 | + } else { |
|
| 476 | + return array(); |
|
| 477 | + } |
|
| 478 | + |
|
| 479 | + return array( |
|
| 480 | + 'red' => $r, |
|
| 481 | + 'green' => $g, |
|
| 482 | + 'blue' => $b, |
|
| 483 | + ); |
|
| 484 | + } |
|
| 485 | + |
|
| 486 | + /** |
|
| 487 | + * Retrieves the current color scheme. |
|
| 488 | + * |
|
| 489 | + * @since 1.0.0 |
|
| 490 | + */ |
|
| 491 | + public function get_color_scheme() { |
|
| 492 | + global $customizer_colour_choices; |
|
| 493 | + |
|
| 494 | + $color_scheme_option = get_theme_mod( 'color_scheme', 'default' ); |
|
| 495 | + $color_schemes = $customizer_colour_choices; |
|
| 496 | + |
|
| 497 | + if ( array_key_exists( $color_scheme_option, $color_schemes ) ) { |
|
| 498 | + return $color_schemes[ $color_scheme_option ]['colors']; |
|
| 499 | + } |
|
| 500 | + |
|
| 501 | + return $color_schemes['default']['colors']; |
|
| 502 | + } |
|
| 503 | + |
|
| 504 | + } |
|
| 505 | + |
|
| 506 | + new LSX_Customizer_Colour(); |
|
| 507 | 507 | |
| 508 | 508 | } |
@@ -1,5 +1,5 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | -if ( ! class_exists( 'LSX_Customizer_Colour' ) ) { |
|
| 2 | +if ( ! class_exists('LSX_Customizer_Colour')) { |
|
| 3 | 3 | |
| 4 | 4 | /** |
| 5 | 5 | * LSX Customizer Colour Class |
@@ -114,9 +114,9 @@ discard block |
||
| 114 | 114 | * @since 1.0.0 |
| 115 | 115 | */ |
| 116 | 116 | public function __construct() { |
| 117 | - add_action( 'after_setup_theme', array( $this, 'after_setup_theme' ), 20 ); |
|
| 118 | - add_action( 'customize_register', array( $this, 'customize_register' ), 20 ); |
|
| 119 | - add_action( 'customize_controls_print_footer_scripts', array( $this, 'colour_scheme_css_template' ) ); |
|
| 117 | + add_action('after_setup_theme', array($this, 'after_setup_theme'), 20); |
|
| 118 | + add_action('customize_register', array($this, 'customize_register'), 20); |
|
| 119 | + add_action('customize_controls_print_footer_scripts', array($this, 'colour_scheme_css_template')); |
|
| 120 | 120 | } |
| 121 | 121 | |
| 122 | 122 | /** |
@@ -126,48 +126,48 @@ discard block |
||
| 126 | 126 | * @since 1.0.0 |
| 127 | 127 | */ |
| 128 | 128 | public function after_setup_theme() { |
| 129 | - require_once( LSX_CUSTOMIZER_PATH . 'includes/lsx-customizer-colour-options.php' ); |
|
| 130 | - require_once( LSX_CUSTOMIZER_PATH . 'includes/lsx-customizer-colour-deprecated.php' ); |
|
| 131 | - require_once( LSX_CUSTOMIZER_PATH . 'includes/lsx-customizer-templates.php' ); |
|
| 129 | + require_once(LSX_CUSTOMIZER_PATH . 'includes/lsx-customizer-colour-options.php'); |
|
| 130 | + require_once(LSX_CUSTOMIZER_PATH . 'includes/lsx-customizer-colour-deprecated.php'); |
|
| 131 | + require_once(LSX_CUSTOMIZER_PATH . 'includes/lsx-customizer-templates.php'); |
|
| 132 | 132 | |
| 133 | - if ( class_exists( 'WP_Customize_Control' ) ) { |
|
| 134 | - require_once( LSX_CUSTOMIZER_PATH . 'classes/class-lsx-customizer-colour-control.php' ); |
|
| 133 | + if (class_exists('WP_Customize_Control')) { |
|
| 134 | + require_once(LSX_CUSTOMIZER_PATH . 'classes/class-lsx-customizer-colour-control.php'); |
|
| 135 | 135 | } |
| 136 | 136 | |
| 137 | - require_once( LSX_CUSTOMIZER_PATH . 'classes/class-lsx-customizer-colour-button.php' ); |
|
| 137 | + require_once(LSX_CUSTOMIZER_PATH . 'classes/class-lsx-customizer-colour-button.php'); |
|
| 138 | 138 | $this->button = new LSX_Customizer_Colour_Button(); |
| 139 | 139 | |
| 140 | - require_once( LSX_CUSTOMIZER_PATH . 'classes/class-lsx-customizer-colour-button-cta.php' ); |
|
| 140 | + require_once(LSX_CUSTOMIZER_PATH . 'classes/class-lsx-customizer-colour-button-cta.php'); |
|
| 141 | 141 | $this->button_cta = new LSX_Customizer_Colour_Button_CTA(); |
| 142 | 142 | |
| 143 | - require_once( LSX_CUSTOMIZER_PATH . 'classes/class-lsx-customizer-colour-button-secondary.php' ); |
|
| 143 | + require_once(LSX_CUSTOMIZER_PATH . 'classes/class-lsx-customizer-colour-button-secondary.php'); |
|
| 144 | 144 | $this->button_secondary = new LSX_Customizer_Colour_Button_Secondary(); |
| 145 | 145 | |
| 146 | - require_once( LSX_CUSTOMIZER_PATH . 'classes/class-lsx-customizer-colour-button-tertiary.php' ); |
|
| 146 | + require_once(LSX_CUSTOMIZER_PATH . 'classes/class-lsx-customizer-colour-button-tertiary.php'); |
|
| 147 | 147 | $this->button_tertiary = new LSX_Customizer_Colour_Button_Tertiary(); |
| 148 | 148 | |
| 149 | - require_once( LSX_CUSTOMIZER_PATH . 'classes/class-lsx-customizer-colour-top-menu.php' ); |
|
| 149 | + require_once(LSX_CUSTOMIZER_PATH . 'classes/class-lsx-customizer-colour-top-menu.php'); |
|
| 150 | 150 | $this->top_menu = new LSX_Customizer_Colour_Top_Menu(); |
| 151 | 151 | |
| 152 | - require_once( LSX_CUSTOMIZER_PATH . 'classes/class-lsx-customizer-colour-header.php' ); |
|
| 152 | + require_once(LSX_CUSTOMIZER_PATH . 'classes/class-lsx-customizer-colour-header.php'); |
|
| 153 | 153 | $this->header = new LSX_Customizer_Colour_Header(); |
| 154 | 154 | |
| 155 | - require_once( LSX_CUSTOMIZER_PATH . 'classes/class-lsx-customizer-colour-main-menu.php' ); |
|
| 155 | + require_once(LSX_CUSTOMIZER_PATH . 'classes/class-lsx-customizer-colour-main-menu.php'); |
|
| 156 | 156 | $this->main_menu = new LSX_Customizer_Colour_Main_Menu(); |
| 157 | 157 | |
| 158 | - require_once( LSX_CUSTOMIZER_PATH . 'classes/class-lsx-customizer-colour-banner.php' ); |
|
| 158 | + require_once(LSX_CUSTOMIZER_PATH . 'classes/class-lsx-customizer-colour-banner.php'); |
|
| 159 | 159 | $this->banner = new LSX_Customizer_Colour_Banner(); |
| 160 | 160 | |
| 161 | - require_once( LSX_CUSTOMIZER_PATH . 'classes/class-lsx-customizer-colour-body.php' ); |
|
| 161 | + require_once(LSX_CUSTOMIZER_PATH . 'classes/class-lsx-customizer-colour-body.php'); |
|
| 162 | 162 | $this->body = new LSX_Customizer_Colour_Body(); |
| 163 | 163 | |
| 164 | - require_once( LSX_CUSTOMIZER_PATH . 'classes/class-lsx-customizer-colour-footer-cta.php' ); |
|
| 164 | + require_once(LSX_CUSTOMIZER_PATH . 'classes/class-lsx-customizer-colour-footer-cta.php'); |
|
| 165 | 165 | $this->footer_cta = new LSX_Customizer_Colour_Footer_CTA(); |
| 166 | 166 | |
| 167 | - require_once( LSX_CUSTOMIZER_PATH . 'classes/class-lsx-customizer-colour-footer-widgets.php' ); |
|
| 167 | + require_once(LSX_CUSTOMIZER_PATH . 'classes/class-lsx-customizer-colour-footer-widgets.php'); |
|
| 168 | 168 | $this->footer_widgets = new LSX_Customizer_Colour_Footer_Widgets(); |
| 169 | 169 | |
| 170 | - require_once( LSX_CUSTOMIZER_PATH . 'classes/class-lsx-customizer-colour-footer.php' ); |
|
| 170 | + require_once(LSX_CUSTOMIZER_PATH . 'classes/class-lsx-customizer-colour-footer.php'); |
|
| 171 | 171 | $this->footer = new LSX_Customizer_Colour_Footer(); |
| 172 | 172 | } |
| 173 | 173 | |
@@ -177,124 +177,124 @@ discard block |
||
| 177 | 177 | * @param WP_Customize_Manager $wp_customize Theme Customizer object. |
| 178 | 178 | * @since 1.0.0 |
| 179 | 179 | */ |
| 180 | - public function customize_register( $wp_customize ) { |
|
| 180 | + public function customize_register($wp_customize) { |
|
| 181 | 181 | global $customizer_colour_names; |
| 182 | 182 | global $customizer_colour_choices; |
| 183 | 183 | |
| 184 | 184 | /** |
| 185 | 185 | * Colors |
| 186 | 186 | */ |
| 187 | - $wp_customize->add_panel( 'colors', array( |
|
| 188 | - 'title' => esc_html__( 'Colors', 'lsx-customizer' ), |
|
| 187 | + $wp_customize->add_panel('colors', array( |
|
| 188 | + 'title' => esc_html__('Colors', 'lsx-customizer'), |
|
| 189 | 189 | 'priority' => 60, |
| 190 | - ) ); |
|
| 190 | + )); |
|
| 191 | 191 | |
| 192 | 192 | /** |
| 193 | 193 | * Colors - Sections |
| 194 | 194 | */ |
| 195 | - $wp_customize->add_section( 'colors-core', array( |
|
| 196 | - 'title' => esc_html__( 'Color Scheme', 'lsx-customizer' ), |
|
| 195 | + $wp_customize->add_section('colors-core', array( |
|
| 196 | + 'title' => esc_html__('Color Scheme', 'lsx-customizer'), |
|
| 197 | 197 | 'priority' => 1, |
| 198 | 198 | 'panel' => 'colors', |
| 199 | - ) ); |
|
| 199 | + )); |
|
| 200 | 200 | |
| 201 | - $wp_customize->add_section( 'colors-palette', array( |
|
| 202 | - 'title' => esc_html__( 'Block Editor Color Palette', 'lsx-customizer' ), |
|
| 203 | - 'description' => esc_html__( 'Add colors to use within the Gutenberg editor color palette.', 'lsx-customizer' ), |
|
| 201 | + $wp_customize->add_section('colors-palette', array( |
|
| 202 | + 'title' => esc_html__('Block Editor Color Palette', 'lsx-customizer'), |
|
| 203 | + 'description' => esc_html__('Add colors to use within the Gutenberg editor color palette.', 'lsx-customizer'), |
|
| 204 | 204 | 'priority' => 2, |
| 205 | 205 | 'panel' => 'colors', |
| 206 | - ) ); |
|
| 206 | + )); |
|
| 207 | 207 | |
| 208 | - $wp_customize->add_section( 'colors-button', array( |
|
| 209 | - 'title' => esc_html__( 'Button', 'lsx-customizer' ), |
|
| 208 | + $wp_customize->add_section('colors-button', array( |
|
| 209 | + 'title' => esc_html__('Button', 'lsx-customizer'), |
|
| 210 | 210 | 'priority' => 3, |
| 211 | 211 | 'panel' => 'colors', |
| 212 | - ) ); |
|
| 212 | + )); |
|
| 213 | 213 | |
| 214 | - $wp_customize->add_section( 'colors-button-cta', array( |
|
| 215 | - 'title' => esc_html__( 'Button CTA', 'lsx-customizer' ), |
|
| 214 | + $wp_customize->add_section('colors-button-cta', array( |
|
| 215 | + 'title' => esc_html__('Button CTA', 'lsx-customizer'), |
|
| 216 | 216 | 'priority' => 4, |
| 217 | 217 | 'panel' => 'colors', |
| 218 | - ) ); |
|
| 218 | + )); |
|
| 219 | 219 | |
| 220 | - $wp_customize->add_section( 'colors-button-secondary', array( |
|
| 221 | - 'title' => esc_html__( 'Button Secondary', 'lsx-customizer' ), |
|
| 220 | + $wp_customize->add_section('colors-button-secondary', array( |
|
| 221 | + 'title' => esc_html__('Button Secondary', 'lsx-customizer'), |
|
| 222 | 222 | 'priority' => 5, |
| 223 | 223 | 'panel' => 'colors', |
| 224 | - ) ); |
|
| 224 | + )); |
|
| 225 | 225 | |
| 226 | - $wp_customize->add_section( 'colors-button-tertiary', array( |
|
| 227 | - 'title' => esc_html__( 'Button Tertiary', 'lsx-customizer' ), |
|
| 226 | + $wp_customize->add_section('colors-button-tertiary', array( |
|
| 227 | + 'title' => esc_html__('Button Tertiary', 'lsx-customizer'), |
|
| 228 | 228 | 'priority' => 6, |
| 229 | 229 | 'panel' => 'colors', |
| 230 | - ) ); |
|
| 230 | + )); |
|
| 231 | 231 | |
| 232 | - $wp_customize->add_section( 'colors-top-menu', array( |
|
| 233 | - 'title' => esc_html__( 'Top Menu', 'lsx-customizer' ), |
|
| 232 | + $wp_customize->add_section('colors-top-menu', array( |
|
| 233 | + 'title' => esc_html__('Top Menu', 'lsx-customizer'), |
|
| 234 | 234 | 'priority' => 7, |
| 235 | 235 | 'panel' => 'colors', |
| 236 | - ) ); |
|
| 236 | + )); |
|
| 237 | 237 | |
| 238 | - $wp_customize->add_section( 'colors-header', array( |
|
| 239 | - 'title' => esc_html__( 'Header', 'lsx-customizer' ), |
|
| 238 | + $wp_customize->add_section('colors-header', array( |
|
| 239 | + 'title' => esc_html__('Header', 'lsx-customizer'), |
|
| 240 | 240 | 'priority' => 8, |
| 241 | 241 | 'panel' => 'colors', |
| 242 | - ) ); |
|
| 242 | + )); |
|
| 243 | 243 | |
| 244 | - $wp_customize->add_section( 'colors-main-menu', array( |
|
| 245 | - 'title' => esc_html__( 'Main Menu', 'lsx-customizer' ), |
|
| 244 | + $wp_customize->add_section('colors-main-menu', array( |
|
| 245 | + 'title' => esc_html__('Main Menu', 'lsx-customizer'), |
|
| 246 | 246 | 'priority' => 9, |
| 247 | 247 | 'panel' => 'colors', |
| 248 | - ) ); |
|
| 248 | + )); |
|
| 249 | 249 | |
| 250 | - $wp_customize->add_section( 'colors-banner', array( |
|
| 251 | - 'title' => esc_html__( 'Banner', 'lsx-customizer' ), |
|
| 250 | + $wp_customize->add_section('colors-banner', array( |
|
| 251 | + 'title' => esc_html__('Banner', 'lsx-customizer'), |
|
| 252 | 252 | 'priority' => 10, |
| 253 | 253 | 'panel' => 'colors', |
| 254 | - ) ); |
|
| 254 | + )); |
|
| 255 | 255 | |
| 256 | - $wp_customize->add_section( 'colors-body', array( |
|
| 257 | - 'title' => esc_html__( 'Body', 'lsx-customizer' ), |
|
| 256 | + $wp_customize->add_section('colors-body', array( |
|
| 257 | + 'title' => esc_html__('Body', 'lsx-customizer'), |
|
| 258 | 258 | 'priority' => 11, |
| 259 | 259 | 'panel' => 'colors', |
| 260 | - ) ); |
|
| 260 | + )); |
|
| 261 | 261 | |
| 262 | - $wp_customize->add_section( 'colors-footer-cta', array( |
|
| 263 | - 'title' => esc_html__( 'Footer CTA', 'lsx-customizer' ), |
|
| 262 | + $wp_customize->add_section('colors-footer-cta', array( |
|
| 263 | + 'title' => esc_html__('Footer CTA', 'lsx-customizer'), |
|
| 264 | 264 | 'priority' => 12, |
| 265 | 265 | 'panel' => 'colors', |
| 266 | - ) ); |
|
| 266 | + )); |
|
| 267 | 267 | |
| 268 | - $wp_customize->add_section( 'colors-footer-widgets', array( |
|
| 269 | - 'title' => esc_html__( 'Footer Widgets', 'lsx-customizer' ), |
|
| 268 | + $wp_customize->add_section('colors-footer-widgets', array( |
|
| 269 | + 'title' => esc_html__('Footer Widgets', 'lsx-customizer'), |
|
| 270 | 270 | 'priority' => 13, |
| 271 | 271 | 'panel' => 'colors', |
| 272 | - ) ); |
|
| 272 | + )); |
|
| 273 | 273 | |
| 274 | - $wp_customize->add_section( 'colors-footer', array( |
|
| 275 | - 'title' => esc_html__( 'Footer', 'lsx-customizer' ), |
|
| 274 | + $wp_customize->add_section('colors-footer', array( |
|
| 275 | + 'title' => esc_html__('Footer', 'lsx-customizer'), |
|
| 276 | 276 | 'priority' => 14, |
| 277 | 277 | 'panel' => 'colors', |
| 278 | - ) ); |
|
| 278 | + )); |
|
| 279 | 279 | |
| 280 | 280 | /** |
| 281 | 281 | * Color Scheme |
| 282 | 282 | */ |
| 283 | - $wp_customize->add_setting( 'color_scheme', array( |
|
| 283 | + $wp_customize->add_setting('color_scheme', array( |
|
| 284 | 284 | 'default' => 'default', |
| 285 | 285 | 'type' => 'theme_mod', |
| 286 | 286 | 'transport' => 'postMessage', |
| 287 | - ) ); |
|
| 287 | + )); |
|
| 288 | 288 | |
| 289 | - $wp_customize->add_control( new LSX_Customizer_Colour_Control( |
|
| 289 | + $wp_customize->add_control(new LSX_Customizer_Colour_Control( |
|
| 290 | 290 | $wp_customize, 'color_scheme', array( |
| 291 | - 'label' => esc_html__( 'Base Color Scheme', 'lsx-customizer' ), |
|
| 291 | + 'label' => esc_html__('Base Color Scheme', 'lsx-customizer'), |
|
| 292 | 292 | 'section' => 'colors-core', |
| 293 | 293 | 'type' => 'select', |
| 294 | 294 | 'priority' => 1, |
| 295 | 295 | 'choices' => $customizer_colour_choices, |
| 296 | 296 | ) |
| 297 | - ) ); |
|
| 297 | + )); |
|
| 298 | 298 | |
| 299 | 299 | /** |
| 300 | 300 | * Color Palette |
@@ -302,26 +302,26 @@ discard block |
||
| 302 | 302 | $colors = $this->get_color_scheme(); |
| 303 | 303 | |
| 304 | 304 | $customizer_colour_defaults = array( |
| 305 | - __( 'Primary Color', 'lsx-customizer' ) => get_theme_mod( 'button_background_color', $colors['button_background_color'] ), |
|
| 306 | - __( 'Strong Primary Color', 'lsx-button_shadow' ) => get_theme_mod( 'button_shadow', $colors['body_link_color'] ), |
|
| 307 | - __( 'Call To Action Color', 'lsx-customizer' ) => get_theme_mod( 'button_cta_background_color', $colors['button_cta_background_color'] ), |
|
| 308 | - __( 'Strong CTA Color', 'lsx-button_shadow' ) => get_theme_mod( 'button_cta_shadow', $colors['button_cta_shadow'] ), |
|
| 309 | - __( 'Secondary Color', 'lsx-customizer' ) => get_theme_mod( 'button_secondary_background_color', $colors['button_secondary_background_color'] ), |
|
| 310 | - __( 'Strong Secondary Color', 'lsx-button_shadow' ) => get_theme_mod( 'button_secondary_shadow', $colors['button_secondary_shadow'] ), |
|
| 311 | - __( 'Tertiary Color', 'lsx-customizer' ) => get_theme_mod( 'button_tertiary_background_color', $colors['button_tertiary_background_color'] ), |
|
| 312 | - __( 'Strong Tertiary Color', 'lsx-button_shadow' ) => get_theme_mod( 'button_tertiary_shadow', $colors['button_tertiary_shadow'] ), |
|
| 305 | + __('Primary Color', 'lsx-customizer') => get_theme_mod('button_background_color', $colors['button_background_color']), |
|
| 306 | + __('Strong Primary Color', 'lsx-button_shadow') => get_theme_mod('button_shadow', $colors['body_link_color']), |
|
| 307 | + __('Call To Action Color', 'lsx-customizer') => get_theme_mod('button_cta_background_color', $colors['button_cta_background_color']), |
|
| 308 | + __('Strong CTA Color', 'lsx-button_shadow') => get_theme_mod('button_cta_shadow', $colors['button_cta_shadow']), |
|
| 309 | + __('Secondary Color', 'lsx-customizer') => get_theme_mod('button_secondary_background_color', $colors['button_secondary_background_color']), |
|
| 310 | + __('Strong Secondary Color', 'lsx-button_shadow') => get_theme_mod('button_secondary_shadow', $colors['button_secondary_shadow']), |
|
| 311 | + __('Tertiary Color', 'lsx-customizer') => get_theme_mod('button_tertiary_background_color', $colors['button_tertiary_background_color']), |
|
| 312 | + __('Strong Tertiary Color', 'lsx-button_shadow') => get_theme_mod('button_tertiary_shadow', $colors['button_tertiary_shadow']), |
|
| 313 | 313 | ); |
| 314 | - foreach ( $customizer_colour_defaults as $key => $value ) { |
|
| 314 | + foreach ($customizer_colour_defaults as $key => $value) { |
|
| 315 | 315 | |
| 316 | - $color_name = strtolower( str_replace( ' ', '_', $key ) ); |
|
| 316 | + $color_name = strtolower(str_replace(' ', '_', $key)); |
|
| 317 | 317 | $color_name = $color_name; |
| 318 | 318 | |
| 319 | - $wp_customize->add_setting( $color_name, array( |
|
| 319 | + $wp_customize->add_setting($color_name, array( |
|
| 320 | 320 | 'default' => $value, |
| 321 | 321 | 'type' => 'theme_mod', |
| 322 | 322 | 'transport' => 'postMessage', |
| 323 | 323 | 'sanitize_callback' => 'sanitize_hex_color', |
| 324 | - ) ); |
|
| 324 | + )); |
|
| 325 | 325 | $wp_customize->add_control( |
| 326 | 326 | new WP_Customize_Color_Control( |
| 327 | 327 | $wp_customize, |
@@ -338,53 +338,53 @@ discard block |
||
| 338 | 338 | /** |
| 339 | 339 | * Colors |
| 340 | 340 | */ |
| 341 | - foreach ( $customizer_colour_names as $key => $value ) { |
|
| 341 | + foreach ($customizer_colour_names as $key => $value) { |
|
| 342 | 342 | $sanitize_callback = 'sanitize_hex_color'; |
| 343 | 343 | |
| 344 | - if ( 'background_color' === $key ) { |
|
| 344 | + if ('background_color' === $key) { |
|
| 345 | 345 | $sanitize_callback = 'sanitize_hex_color_no_hash'; |
| 346 | 346 | } |
| 347 | 347 | |
| 348 | 348 | $section = 'colors-core'; |
| 349 | 349 | |
| 350 | - if ( preg_match( '/^button_cta_.*/', $key ) ) { |
|
| 350 | + if (preg_match('/^button_cta_.*/', $key)) { |
|
| 351 | 351 | $section = 'colors-button-cta'; |
| 352 | - } elseif ( preg_match( '/^button_secondary_.*/', $key ) ) { |
|
| 352 | + } elseif (preg_match('/^button_secondary_.*/', $key)) { |
|
| 353 | 353 | $section = 'colors-button-secondary'; |
| 354 | - } elseif ( preg_match( '/^button_tertiary_.*/', $key ) ) { |
|
| 354 | + } elseif (preg_match('/^button_tertiary_.*/', $key)) { |
|
| 355 | 355 | $section = 'colors-button-tertiary'; |
| 356 | - } elseif ( preg_match( '/^button_.*/', $key ) ) { |
|
| 356 | + } elseif (preg_match('/^button_.*/', $key)) { |
|
| 357 | 357 | $section = 'colors-button'; |
| 358 | - } elseif ( preg_match( '/^top_menu_.*/', $key ) ) { |
|
| 358 | + } elseif (preg_match('/^top_menu_.*/', $key)) { |
|
| 359 | 359 | $section = 'colors-top-menu'; |
| 360 | - } elseif ( preg_match( '/^header_.*/', $key ) ) { |
|
| 360 | + } elseif (preg_match('/^header_.*/', $key)) { |
|
| 361 | 361 | $section = 'colors-header'; |
| 362 | - } elseif ( preg_match( '/^main_menu_.*/', $key ) ) { |
|
| 362 | + } elseif (preg_match('/^main_menu_.*/', $key)) { |
|
| 363 | 363 | $section = 'colors-main-menu'; |
| 364 | - } elseif ( preg_match( '/^banner_.*/', $key ) ) { |
|
| 364 | + } elseif (preg_match('/^banner_.*/', $key)) { |
|
| 365 | 365 | $section = 'colors-banner'; |
| 366 | - } elseif ( preg_match( '/^body_.*/', $key ) || 'background_color' === $key ) { |
|
| 366 | + } elseif (preg_match('/^body_.*/', $key) || 'background_color' === $key) { |
|
| 367 | 367 | $section = 'colors-body'; |
| 368 | - } elseif ( preg_match( '/^footer_cta_.*/', $key ) ) { |
|
| 368 | + } elseif (preg_match('/^footer_cta_.*/', $key)) { |
|
| 369 | 369 | $section = 'colors-footer-cta'; |
| 370 | - } elseif ( preg_match( '/^footer_widgets_.*/', $key ) ) { |
|
| 370 | + } elseif (preg_match('/^footer_widgets_.*/', $key)) { |
|
| 371 | 371 | $section = 'colors-footer-widgets'; |
| 372 | - } elseif ( preg_match( '/^footer_.*/', $key ) ) { |
|
| 372 | + } elseif (preg_match('/^footer_.*/', $key)) { |
|
| 373 | 373 | $section = 'colors-footer'; |
| 374 | 374 | } |
| 375 | 375 | |
| 376 | - $wp_customize->add_setting( $key, array( |
|
| 377 | - 'default' => $customizer_colour_choices['default']['colors'][ $key ], |
|
| 376 | + $wp_customize->add_setting($key, array( |
|
| 377 | + 'default' => $customizer_colour_choices['default']['colors'][$key], |
|
| 378 | 378 | 'type' => 'theme_mod', |
| 379 | 379 | 'transport' => 'postMessage', |
| 380 | 380 | 'sanitize_callback' => $sanitize_callback, |
| 381 | - ) ); |
|
| 381 | + )); |
|
| 382 | 382 | |
| 383 | - $wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, $key, array( |
|
| 383 | + $wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, $key, array( |
|
| 384 | 384 | 'label' => $value, |
| 385 | 385 | 'section' => $section, |
| 386 | 386 | 'settings' => $key, |
| 387 | - ) ) ); |
|
| 387 | + ))); |
|
| 388 | 388 | } |
| 389 | 389 | } |
| 390 | 390 | |
@@ -398,26 +398,26 @@ discard block |
||
| 398 | 398 | |
| 399 | 399 | $colors = array(); |
| 400 | 400 | |
| 401 | - foreach ( $customizer_colour_names as $key => $value ) { |
|
| 402 | - $colors[ $key ] = 'unquote("{{ data.' . $key . ' }}")'; |
|
| 401 | + foreach ($customizer_colour_names as $key => $value) { |
|
| 402 | + $colors[$key] = 'unquote("{{ data.' . $key . ' }}")'; |
|
| 403 | 403 | } |
| 404 | 404 | ?> |
| 405 | 405 | <script type="text/html" id="tmpl-lsx-color-scheme"> |
| 406 | - <?php echo esc_attr( $this->top_menu->get_css( $colors ) ); ?> |
|
| 407 | - <?php echo esc_attr( $this->header->get_css( $colors ) ); ?> |
|
| 408 | - <?php echo esc_attr( $this->main_menu->get_css( $colors ) ); ?> |
|
| 406 | + <?php echo esc_attr($this->top_menu->get_css($colors)); ?> |
|
| 407 | + <?php echo esc_attr($this->header->get_css($colors)); ?> |
|
| 408 | + <?php echo esc_attr($this->main_menu->get_css($colors)); ?> |
|
| 409 | 409 | |
| 410 | - <?php echo esc_attr( $this->banner->get_css( $colors ) ); ?> |
|
| 411 | - <?php echo esc_attr( $this->body->get_css( $colors ) ); ?> |
|
| 410 | + <?php echo esc_attr($this->banner->get_css($colors)); ?> |
|
| 411 | + <?php echo esc_attr($this->body->get_css($colors)); ?> |
|
| 412 | 412 | |
| 413 | - <?php echo esc_attr( $this->footer_cta->get_css( $colors ) ); ?> |
|
| 414 | - <?php echo esc_attr( $this->footer_widgets->get_css( $colors ) ); ?> |
|
| 415 | - <?php echo esc_attr( $this->footer->get_css( $colors ) ); ?> |
|
| 413 | + <?php echo esc_attr($this->footer_cta->get_css($colors)); ?> |
|
| 414 | + <?php echo esc_attr($this->footer_widgets->get_css($colors)); ?> |
|
| 415 | + <?php echo esc_attr($this->footer->get_css($colors)); ?> |
|
| 416 | 416 | |
| 417 | - <?php echo esc_attr( $this->button->get_css( $colors ) ); ?> |
|
| 418 | - <?php echo esc_attr( $this->button_cta->get_css( $colors ) ); ?> |
|
| 419 | - <?php echo esc_attr( $this->button_secondary->get_css( $colors ) ); ?> |
|
| 420 | - <?php echo esc_attr( $this->button_tertiary->get_css( $colors ) ); ?> |
|
| 417 | + <?php echo esc_attr($this->button->get_css($colors)); ?> |
|
| 418 | + <?php echo esc_attr($this->button_cta->get_css($colors)); ?> |
|
| 419 | + <?php echo esc_attr($this->button_secondary->get_css($colors)); ?> |
|
| 420 | + <?php echo esc_attr($this->button_tertiary->get_css($colors)); ?> |
|
| 421 | 421 | </script> |
| 422 | 422 | <?php |
| 423 | 423 | } |
@@ -427,16 +427,16 @@ discard block |
||
| 427 | 427 | * |
| 428 | 428 | * @since 1.0.0 |
| 429 | 429 | */ |
| 430 | - public function scss_to_css( $scss ) { |
|
| 430 | + public function scss_to_css($scss) { |
|
| 431 | 431 | $css = ''; |
| 432 | 432 | $scss_php_file = LSX_CUSTOMIZER_PATH . 'vendor/leafo/scssphp/scss.inc.php'; |
| 433 | 433 | $lsx_theme_sass_file = get_template_directory() . '/assets/css/scss/lsx.scss'; |
| 434 | 434 | |
| 435 | - if ( ! empty( $scss ) && file_exists( $scss_php_file ) && file_exists( $lsx_theme_sass_file ) ) { |
|
| 435 | + if ( ! empty($scss) && file_exists($scss_php_file) && file_exists($lsx_theme_sass_file)) { |
|
| 436 | 436 | require_once $scss_php_file; |
| 437 | 437 | |
| 438 | 438 | $compiler = new \Leafo\ScssPhp\Compiler(); |
| 439 | - $compiler->setFormatter( 'Leafo\ScssPhp\Formatter\Compact' ); |
|
| 439 | + $compiler->setFormatter('Leafo\ScssPhp\Formatter\Compact'); |
|
| 440 | 440 | |
| 441 | 441 | try { |
| 442 | 442 | $scss = ' |
@@ -446,8 +446,8 @@ discard block |
||
| 446 | 446 | ' . $scss . ' |
| 447 | 447 | '; |
| 448 | 448 | |
| 449 | - $css = $compiler->compile( $scss ); |
|
| 450 | - } catch ( \Exception $e ) { |
|
| 449 | + $css = $compiler->compile($scss); |
|
| 450 | + } catch (\Exception $e) { |
|
| 451 | 451 | $error = $e->getMessage(); |
| 452 | 452 | return "/*\n\n\$error:\n\n{$error}\n\n\$scss:\n\n{$scss} */"; |
| 453 | 453 | } |
@@ -461,17 +461,17 @@ discard block |
||
| 461 | 461 | * |
| 462 | 462 | * @since 1.0.0 |
| 463 | 463 | */ |
| 464 | - public static function hex2rgb( $color ) { |
|
| 465 | - $color = trim( $color, '#' ); |
|
| 466 | - |
|
| 467 | - if ( strlen( $color ) === 3 ) { |
|
| 468 | - $r = hexdec( substr( $color, 0, 1 ) . substr( $color, 0, 1 ) ); |
|
| 469 | - $g = hexdec( substr( $color, 1, 1 ) . substr( $color, 1, 1 ) ); |
|
| 470 | - $b = hexdec( substr( $color, 2, 1 ) . substr( $color, 2, 1 ) ); |
|
| 471 | - } elseif ( strlen( $color ) === 6 ) { |
|
| 472 | - $r = hexdec( substr( $color, 0, 2 ) ); |
|
| 473 | - $g = hexdec( substr( $color, 2, 2 ) ); |
|
| 474 | - $b = hexdec( substr( $color, 4, 2 ) ); |
|
| 464 | + public static function hex2rgb($color) { |
|
| 465 | + $color = trim($color, '#'); |
|
| 466 | + |
|
| 467 | + if (strlen($color) === 3) { |
|
| 468 | + $r = hexdec(substr($color, 0, 1) . substr($color, 0, 1)); |
|
| 469 | + $g = hexdec(substr($color, 1, 1) . substr($color, 1, 1)); |
|
| 470 | + $b = hexdec(substr($color, 2, 1) . substr($color, 2, 1)); |
|
| 471 | + } elseif (strlen($color) === 6) { |
|
| 472 | + $r = hexdec(substr($color, 0, 2)); |
|
| 473 | + $g = hexdec(substr($color, 2, 2)); |
|
| 474 | + $b = hexdec(substr($color, 4, 2)); |
|
| 475 | 475 | } else { |
| 476 | 476 | return array(); |
| 477 | 477 | } |
@@ -491,11 +491,11 @@ discard block |
||
| 491 | 491 | public function get_color_scheme() { |
| 492 | 492 | global $customizer_colour_choices; |
| 493 | 493 | |
| 494 | - $color_scheme_option = get_theme_mod( 'color_scheme', 'default' ); |
|
| 494 | + $color_scheme_option = get_theme_mod('color_scheme', 'default'); |
|
| 495 | 495 | $color_schemes = $customizer_colour_choices; |
| 496 | 496 | |
| 497 | - if ( array_key_exists( $color_scheme_option, $color_schemes ) ) { |
|
| 498 | - return $color_schemes[ $color_scheme_option ]['colors']; |
|
| 497 | + if (array_key_exists($color_scheme_option, $color_schemes)) { |
|
| 498 | + return $color_schemes[$color_scheme_option]['colors']; |
|
| 499 | 499 | } |
| 500 | 500 | |
| 501 | 501 | return $color_schemes['default']['colors']; |