@@ -6,11 +6,11 @@ discard block |
||
| 6 | 6 | * @subpackage welcome-page |
| 7 | 7 | */ |
| 8 | 8 | |
| 9 | -if ( ! defined( 'ABSPATH' ) ) { |
|
| 9 | +if ( ! defined('ABSPATH')) { |
|
| 10 | 10 | exit; |
| 11 | 11 | } |
| 12 | 12 | |
| 13 | -if ( ! function_exists( 'lsx_activation_admin_notice_dismiss' ) ) : |
|
| 13 | +if ( ! function_exists('lsx_activation_admin_notice_dismiss')) : |
|
| 14 | 14 | |
| 15 | 15 | /** |
| 16 | 16 | * Dismiss the admin notice (successful activation). |
@@ -19,15 +19,15 @@ discard block |
||
| 19 | 19 | * @subpackage welcome-page |
| 20 | 20 | */ |
| 21 | 21 | function lsx_activation_admin_notice_dismiss() { |
| 22 | - update_option( 'lsx-notice-dismissed', '1' ); |
|
| 22 | + update_option('lsx-notice-dismissed', '1'); |
|
| 23 | 23 | wp_die(); |
| 24 | 24 | } |
| 25 | 25 | |
| 26 | 26 | endif; |
| 27 | 27 | |
| 28 | -add_action( 'wp_ajax_lsx_dismiss_theme_notice', 'lsx_activation_admin_notice_dismiss' ); |
|
| 28 | +add_action('wp_ajax_lsx_dismiss_theme_notice', 'lsx_activation_admin_notice_dismiss'); |
|
| 29 | 29 | |
| 30 | -if ( ! function_exists( 'lsx_activation_admin_notice' ) ) : |
|
| 30 | +if ( ! function_exists('lsx_activation_admin_notice')) : |
|
| 31 | 31 | |
| 32 | 32 | /** |
| 33 | 33 | * Adds an admin notice upon successful activation. |
@@ -36,16 +36,16 @@ discard block |
||
| 36 | 36 | * @subpackage welcome-page |
| 37 | 37 | */ |
| 38 | 38 | function lsx_activation_admin_notice() { |
| 39 | - if ( empty( get_option( 'lsx-notice-dismissed' ) ) ) { |
|
| 40 | - add_action( 'admin_notices', 'lsx_welcome_admin_notice', 99 ); |
|
| 39 | + if (empty(get_option('lsx-notice-dismissed'))) { |
|
| 40 | + add_action('admin_notices', 'lsx_welcome_admin_notice', 99); |
|
| 41 | 41 | } |
| 42 | 42 | } |
| 43 | 43 | |
| 44 | 44 | endif; |
| 45 | 45 | |
| 46 | -add_action( 'admin_notices', 'lsx_activation_admin_notice' ); |
|
| 46 | +add_action('admin_notices', 'lsx_activation_admin_notice'); |
|
| 47 | 47 | |
| 48 | -if ( ! function_exists( 'lsx_welcome_admin_notice' ) ) : |
|
| 48 | +if ( ! function_exists('lsx_welcome_admin_notice')) : |
|
| 49 | 49 | |
| 50 | 50 | /** |
| 51 | 51 | * Display an admin notice linking to the welcome screen. |
@@ -60,20 +60,20 @@ discard block |
||
| 60 | 60 | <?php |
| 61 | 61 | printf( |
| 62 | 62 | /* Translators: 1: HTML open tag link, 2: HTML close tag link */ |
| 63 | - esc_html__( 'Thanks for choosing LSX! You can read hints and tips on how get the most out of your new theme on the %1$swelcome screen%2$s.', 'lsx' ), |
|
| 64 | - '<a href="' . esc_url( admin_url( 'themes.php?page=lsx-welcome' ) ) . '">', |
|
| 63 | + esc_html__('Thanks for choosing LSX! You can read hints and tips on how get the most out of your new theme on the %1$swelcome screen%2$s.', 'lsx'), |
|
| 64 | + '<a href="' . esc_url(admin_url('themes.php?page=lsx-welcome')) . '">', |
|
| 65 | 65 | '</a>' |
| 66 | 66 | ); |
| 67 | 67 | ?> |
| 68 | 68 | </p> |
| 69 | - <p><a href="<?php echo esc_url( admin_url( 'themes.php?page=lsx-welcome' ) ); ?>" class="button" style="text-decoration: none;"><?php esc_attr_e( 'Get started with LSX', 'lsx' ); ?></a></p> |
|
| 69 | + <p><a href="<?php echo esc_url(admin_url('themes.php?page=lsx-welcome')); ?>" class="button" style="text-decoration: none;"><?php esc_attr_e('Get started with LSX', 'lsx'); ?></a></p> |
|
| 70 | 70 | </div> |
| 71 | 71 | <?php |
| 72 | 72 | } |
| 73 | 73 | |
| 74 | 74 | endif; |
| 75 | 75 | |
| 76 | -if ( ! function_exists( 'lsx_welcome_style' ) ) : |
|
| 76 | +if ( ! function_exists('lsx_welcome_style')) : |
|
| 77 | 77 | |
| 78 | 78 | /** |
| 79 | 79 | * Load welcome screen css. |
@@ -83,19 +83,19 @@ discard block |
||
| 83 | 83 | * |
| 84 | 84 | * @param string $hook_suffix the current page hook suffix. |
| 85 | 85 | */ |
| 86 | - function lsx_welcome_style( $hook_suffix ) { |
|
| 87 | - if ( 'appearance_page_lsx-welcome' === $hook_suffix ) { |
|
| 88 | - wp_enqueue_style( 'lsx-welcome-screen-mailchimp', '//cdn-images.mailchimp.com/embedcode/classic-10_7.css', array(), LSX_VERSION ); |
|
| 89 | - wp_enqueue_style( 'lsx-welcome-screen', get_template_directory_uri() . '/assets/css/admin/welcome.css', array( 'lsx-welcome-screen-mailchimp' ), LSX_VERSION ); |
|
| 90 | - wp_style_add_data( 'lsx-welcome-screen', 'rtl', 'replace' ); |
|
| 86 | + function lsx_welcome_style($hook_suffix) { |
|
| 87 | + if ('appearance_page_lsx-welcome' === $hook_suffix) { |
|
| 88 | + wp_enqueue_style('lsx-welcome-screen-mailchimp', '//cdn-images.mailchimp.com/embedcode/classic-10_7.css', array(), LSX_VERSION); |
|
| 89 | + wp_enqueue_style('lsx-welcome-screen', get_template_directory_uri() . '/assets/css/admin/welcome.css', array('lsx-welcome-screen-mailchimp'), LSX_VERSION); |
|
| 90 | + wp_style_add_data('lsx-welcome-screen', 'rtl', 'replace'); |
|
| 91 | 91 | } |
| 92 | 92 | } |
| 93 | 93 | |
| 94 | 94 | endif; |
| 95 | 95 | |
| 96 | -add_action( 'admin_enqueue_scripts', 'lsx_welcome_style' ); |
|
| 96 | +add_action('admin_enqueue_scripts', 'lsx_welcome_style'); |
|
| 97 | 97 | |
| 98 | -if ( ! function_exists( 'lsx_welcome_register_menu' ) ) : |
|
| 98 | +if ( ! function_exists('lsx_welcome_register_menu')) : |
|
| 99 | 99 | |
| 100 | 100 | /** |
| 101 | 101 | * Creates the dashboard page. |
@@ -104,14 +104,14 @@ discard block |
||
| 104 | 104 | * @subpackage welcome-page |
| 105 | 105 | */ |
| 106 | 106 | function lsx_welcome_register_menu() { |
| 107 | - add_theme_page( 'LSX', 'LSX', 'activate_plugins', 'lsx-welcome', 'lsx_welcome_screen' ); |
|
| 107 | + add_theme_page('LSX', 'LSX', 'activate_plugins', 'lsx-welcome', 'lsx_welcome_screen'); |
|
| 108 | 108 | } |
| 109 | 109 | |
| 110 | 110 | endif; |
| 111 | 111 | |
| 112 | -add_action( 'admin_menu', 'lsx_welcome_register_menu' ); |
|
| 112 | +add_action('admin_menu', 'lsx_welcome_register_menu'); |
|
| 113 | 113 | |
| 114 | -if ( ! function_exists( 'lsx_welcome_screen' ) ) : |
|
| 114 | +if ( ! function_exists('lsx_welcome_screen')) : |
|
| 115 | 115 | |
| 116 | 116 | /** |
| 117 | 117 | * The welcome screen. |
@@ -133,7 +133,7 @@ discard block |
||
| 133 | 133 | * @hooked lsx_welcome_enhance - 20 |
| 134 | 134 | * @hooked lsx_welcome_footer - 30 |
| 135 | 135 | */ |
| 136 | - do_action( 'lsx_welcome' ); |
|
| 136 | + do_action('lsx_welcome'); |
|
| 137 | 137 | ?> |
| 138 | 138 | </div> |
| 139 | 139 | <?php |
@@ -141,7 +141,7 @@ discard block |
||
| 141 | 141 | |
| 142 | 142 | endif; |
| 143 | 143 | |
| 144 | -if ( ! function_exists( 'lsx_welcome_header' ) ) : |
|
| 144 | +if ( ! function_exists('lsx_welcome_header')) : |
|
| 145 | 145 | |
| 146 | 146 | /** |
| 147 | 147 | * Welcome screen intro. |
@@ -155,9 +155,9 @@ discard block |
||
| 155 | 155 | |
| 156 | 156 | endif; |
| 157 | 157 | |
| 158 | -add_action( 'lsx_welcome', 'lsx_welcome_header', 10 ); |
|
| 158 | +add_action('lsx_welcome', 'lsx_welcome_header', 10); |
|
| 159 | 159 | |
| 160 | -if ( ! function_exists( 'lsx_welcome_enhance' ) ) : |
|
| 160 | +if ( ! function_exists('lsx_welcome_enhance')) : |
|
| 161 | 161 | |
| 162 | 162 | /** |
| 163 | 163 | * Welcome screen enhance section. |
@@ -171,9 +171,9 @@ discard block |
||
| 171 | 171 | |
| 172 | 172 | endif; |
| 173 | 173 | |
| 174 | -add_action( 'lsx_welcome', 'lsx_welcome_enhance', 20 ); |
|
| 174 | +add_action('lsx_welcome', 'lsx_welcome_enhance', 20); |
|
| 175 | 175 | |
| 176 | -if ( ! function_exists( 'lsx_welcome_footer' ) ) : |
|
| 176 | +if ( ! function_exists('lsx_welcome_footer')) : |
|
| 177 | 177 | |
| 178 | 178 | /** |
| 179 | 179 | * Welcome screen contribute section. |
@@ -187,4 +187,4 @@ discard block |
||
| 187 | 187 | |
| 188 | 188 | endif; |
| 189 | 189 | |
| 190 | -add_action( 'lsx_welcome', 'lsx_welcome_footer', 30 ); |
|
| 190 | +add_action('lsx_welcome', 'lsx_welcome_footer', 30); |
|
@@ -6,7 +6,7 @@ discard block |
||
| 6 | 6 | * @subpackage sensei |
| 7 | 7 | */ |
| 8 | 8 | |
| 9 | -if ( ! defined( 'ABSPATH' ) ) { |
|
| 9 | +if ( ! defined('ABSPATH')) { |
|
| 10 | 10 | exit; // Exit if accessed directly. |
| 11 | 11 | } |
| 12 | 12 | |
@@ -26,7 +26,7 @@ discard block |
||
| 26 | 26 | * Constructor. |
| 27 | 27 | */ |
| 28 | 28 | public function __construct() { |
| 29 | - add_action( 'init', array( $this, 'init' ) ); |
|
| 29 | + add_action('init', array($this, 'init')); |
|
| 30 | 30 | } // End __construct() |
| 31 | 31 | |
| 32 | 32 | /** |
@@ -35,7 +35,7 @@ discard block |
||
| 35 | 35 | * @return self |
| 36 | 36 | */ |
| 37 | 37 | public static function instance() { |
| 38 | - if ( ! self::$instance ) { |
|
| 38 | + if ( ! self::$instance) { |
|
| 39 | 39 | self::$instance = new self(); |
| 40 | 40 | } |
| 41 | 41 | return self::$instance; |
@@ -49,32 +49,32 @@ discard block |
||
| 49 | 49 | global $woothemes_sensei; |
| 50 | 50 | |
| 51 | 51 | // Switching the course filters and the headers around. |
| 52 | - remove_action( 'sensei_archive_before_course_loop', array( 'Sensei_Course', 'archive_header' ), 10, 0 ); |
|
| 53 | - remove_action( 'sensei_archive_before_course_loop', array( 'Sensei_Course', 'course_archive_sorting' ) ); |
|
| 54 | - remove_action( 'sensei_archive_before_course_loop', array( 'Sensei_Course', 'course_archive_filters' ) ); |
|
| 55 | - add_action( 'sensei_archive_before_course_loop', array( 'Sensei_Course', 'archive_header' ), 11, 0 ); |
|
| 56 | - add_action( 'sensei_archive_before_course_loop', array( 'Sensei_Course', 'course_archive_sorting' ), 12 ); |
|
| 57 | - add_action( 'sensei_archive_before_course_loop', array( 'Sensei_Course', 'course_archive_filters' ), 12 ); |
|
| 52 | + remove_action('sensei_archive_before_course_loop', array('Sensei_Course', 'archive_header'), 10, 0); |
|
| 53 | + remove_action('sensei_archive_before_course_loop', array('Sensei_Course', 'course_archive_sorting')); |
|
| 54 | + remove_action('sensei_archive_before_course_loop', array('Sensei_Course', 'course_archive_filters')); |
|
| 55 | + add_action('sensei_archive_before_course_loop', array('Sensei_Course', 'archive_header'), 11, 0); |
|
| 56 | + add_action('sensei_archive_before_course_loop', array('Sensei_Course', 'course_archive_sorting'), 12); |
|
| 57 | + add_action('sensei_archive_before_course_loop', array('Sensei_Course', 'course_archive_filters'), 12); |
|
| 58 | 58 | |
| 59 | 59 | // First add the thumbnail. |
| 60 | - add_action( 'sensei_course_content_inside_before', array( $this, 'get_course_thumbnail' ), 1 ); |
|
| 60 | + add_action('sensei_course_content_inside_before', array($this, 'get_course_thumbnail'), 1); |
|
| 61 | 61 | |
| 62 | 62 | // This is for our wrapper, we run it on 2, after the thumbnail we added. |
| 63 | - add_action( 'sensei_course_content_inside_before', array( $this, 'course_body_div_open' ), 1 ); |
|
| 64 | - add_action( 'sensei_course_content_inside_after', array( $this, 'course_body_div_close' ), 50 ); |
|
| 63 | + add_action('sensei_course_content_inside_before', array($this, 'course_body_div_open'), 1); |
|
| 64 | + add_action('sensei_course_content_inside_after', array($this, 'course_body_div_close'), 50); |
|
| 65 | 65 | |
| 66 | 66 | // This is for our wrapper, we run it on 2, after the thumbnail we added. |
| 67 | - add_action( 'sensei_course_content_inside_before', array( $this, 'course_body_div_results_open' ), 20 ); |
|
| 68 | - add_action( 'sensei_course_content_inside_after', array( $this, 'course_body_div_results_close' ), 49 ); |
|
| 67 | + add_action('sensei_course_content_inside_before', array($this, 'course_body_div_results_open'), 20); |
|
| 68 | + add_action('sensei_course_content_inside_after', array($this, 'course_body_div_results_close'), 49); |
|
| 69 | 69 | |
| 70 | - add_action( 'sensei_single_course_content_inside_before', array( $this, 'display_course_amount' ), 20 ); |
|
| 70 | + add_action('sensei_single_course_content_inside_before', array($this, 'display_course_amount'), 20); |
|
| 71 | 71 | |
| 72 | 72 | // removes the course image above the content. |
| 73 | - remove_action( 'sensei_course_content_inside_before', array( $woothemes_sensei->course, 'course_image' ), 30, 1 ); |
|
| 73 | + remove_action('sensei_course_content_inside_before', array($woothemes_sensei->course, 'course_image'), 30, 1); |
|
| 74 | 74 | // add the course image to the left of the content. |
| 75 | - add_action( 'lsx_sensei_course_content_inside_before', array( $woothemes_sensei->course, 'course_image' ), 30, 1 ); |
|
| 75 | + add_action('lsx_sensei_course_content_inside_before', array($woothemes_sensei->course, 'course_image'), 30, 1); |
|
| 76 | 76 | |
| 77 | - add_filter( 'attach_shortcode_hooks', 'lsx_attach_shortcode_hooks', 10, 1 ); |
|
| 77 | + add_filter('attach_shortcode_hooks', 'lsx_attach_shortcode_hooks', 10, 1); |
|
| 78 | 78 | |
| 79 | 79 | } |
| 80 | 80 | |
@@ -86,7 +86,7 @@ discard block |
||
| 86 | 86 | public function get_course_thumbnail() { |
| 87 | 87 | ?> |
| 88 | 88 | <div class="course-thumbnail"> |
| 89 | - <?php do_action( 'lsx_sensei_course_content_inside_before', get_the_ID() ); ?> |
|
| 89 | + <?php do_action('lsx_sensei_course_content_inside_before', get_the_ID()); ?> |
|
| 90 | 90 | </div> |
| 91 | 91 | <?php |
| 92 | 92 | } |
@@ -98,13 +98,13 @@ discard block |
||
| 98 | 98 | */ |
| 99 | 99 | public function course_body_div_open() { |
| 100 | 100 | global $post, $current_user; |
| 101 | - $is_user_taking_course = Sensei_Utils::user_started_course( $post->ID, $current_user->ID ); |
|
| 101 | + $is_user_taking_course = Sensei_Utils::user_started_course($post->ID, $current_user->ID); |
|
| 102 | 102 | $user_taking_course_class = ''; |
| 103 | - if ( ! empty( $is_user_taking_course ) ) { |
|
| 103 | + if ( ! empty($is_user_taking_course)) { |
|
| 104 | 104 | $user_taking_course_class = 'currently-in-course'; |
| 105 | 105 | } |
| 106 | 106 | ?> |
| 107 | - <div class="course-body <?php echo esc_html( $user_taking_course_class ); ?>"> |
|
| 107 | + <div class="course-body <?php echo esc_html($user_taking_course_class); ?>"> |
|
| 108 | 108 | <?php |
| 109 | 109 | } |
| 110 | 110 | |
@@ -148,16 +148,16 @@ discard block |
||
| 148 | 148 | */ |
| 149 | 149 | public function display_course_amount() { |
| 150 | 150 | global $post, $current_user; |
| 151 | - $is_user_taking_course = Sensei_Utils::user_started_course( $post->ID, $current_user->ID ); |
|
| 152 | - $wc_post_id = absint( get_post_meta( $post->ID, '_course_woocommerce_product', true ) ); |
|
| 153 | - if ( class_exists( 'Sensei_WC' ) ) { |
|
| 154 | - $course_purchasable = Sensei_WC::is_course_purchasable( $post->ID ); |
|
| 151 | + $is_user_taking_course = Sensei_Utils::user_started_course($post->ID, $current_user->ID); |
|
| 152 | + $wc_post_id = absint(get_post_meta($post->ID, '_course_woocommerce_product', true)); |
|
| 153 | + if (class_exists('Sensei_WC')) { |
|
| 154 | + $course_purchasable = Sensei_WC::is_course_purchasable($post->ID); |
|
| 155 | 155 | $currency = get_woocommerce_currency_symbol(); |
| 156 | - $product = new WC_Product( $wc_post_id ); |
|
| 157 | - if ( ( ! empty( $product->price ) ) && ( ! $is_user_taking_course ) ) { |
|
| 158 | - echo '<span class="course-product-price price"><span>' . esc_html( $currency ) . ' </span>' . sprintf( '%0.2f', esc_html( $product->price ) ) . '</span>'; |
|
| 159 | - } elseif ( ( '' === $product->get_price() || 0 == $product->get_price() ) && $course_purchasable ) { |
|
| 160 | - echo '<span class="course-product-price price">' . wp_kses_post( 'Free!', 'lsx' ) . '</span>'; |
|
| 156 | + $product = new WC_Product($wc_post_id); |
|
| 157 | + if (( ! empty($product->price)) && ( ! $is_user_taking_course)) { |
|
| 158 | + echo '<span class="course-product-price price"><span>' . esc_html($currency) . ' </span>' . sprintf('%0.2f', esc_html($product->price)) . '</span>'; |
|
| 159 | + } elseif (('' === $product->get_price() || 0 == $product->get_price()) && $course_purchasable) { |
|
| 160 | + echo '<span class="course-product-price price">' . wp_kses_post('Free!', 'lsx') . '</span>'; |
|
| 161 | 161 | } |
| 162 | 162 | } |
| 163 | 163 | } |
@@ -6,7 +6,7 @@ discard block |
||
| 6 | 6 | * @subpackage sensei |
| 7 | 7 | */ |
| 8 | 8 | |
| 9 | -if ( ! defined( 'ABSPATH' ) ) { |
|
| 9 | +if ( ! defined('ABSPATH')) { |
|
| 10 | 10 | exit; // Exit if accessed directly. |
| 11 | 11 | } |
| 12 | 12 | |
@@ -26,9 +26,9 @@ discard block |
||
| 26 | 26 | * Constructor. |
| 27 | 27 | */ |
| 28 | 28 | public function __construct() { |
| 29 | - add_action( 'init', array( $this, 'init' ) ); |
|
| 30 | - add_action( 'widgets_init', array( $this, 'lsx_widget_area_sensei_init' ), 100 ); |
|
| 31 | - add_filter( 'body_class', array( $this, 'lsx_widget_area_sensei_is_active' ) ); |
|
| 29 | + add_action('init', array($this, 'init')); |
|
| 30 | + add_action('widgets_init', array($this, 'lsx_widget_area_sensei_init'), 100); |
|
| 31 | + add_filter('body_class', array($this, 'lsx_widget_area_sensei_is_active')); |
|
| 32 | 32 | } // End __construct() |
| 33 | 33 | |
| 34 | 34 | /** |
@@ -37,7 +37,7 @@ discard block |
||
| 37 | 37 | * @return self |
| 38 | 38 | */ |
| 39 | 39 | public static function instance() { |
| 40 | - if ( ! self::$instance ) { |
|
| 40 | + if ( ! self::$instance) { |
|
| 41 | 41 | self::$instance = new self(); |
| 42 | 42 | } |
| 43 | 43 | return self::$instance; |
@@ -47,7 +47,7 @@ discard block |
||
| 47 | 47 | * Run our changes. |
| 48 | 48 | */ |
| 49 | 49 | public function init() { |
| 50 | - add_action( 'lsx_content_top', array( $this, 'lsx_sensei_lesson_sidebar' ) ); |
|
| 50 | + add_action('lsx_content_top', array($this, 'lsx_sensei_lesson_sidebar')); |
|
| 51 | 51 | |
| 52 | 52 | } |
| 53 | 53 | |
@@ -57,15 +57,15 @@ discard block |
||
| 57 | 57 | * @return void |
| 58 | 58 | */ |
| 59 | 59 | public function lsx_widget_area_sensei_init() { |
| 60 | - if ( class_exists( 'Sensei_Course_Participants' ) || class_exists( 'Sensei_Course_Progress' ) ) { |
|
| 61 | - register_sidebar( array( |
|
| 62 | - 'name' => esc_html__( 'LSX Sensei Sidebar', 'lsx' ), |
|
| 60 | + if (class_exists('Sensei_Course_Participants') || class_exists('Sensei_Course_Progress')) { |
|
| 61 | + register_sidebar(array( |
|
| 62 | + 'name' => esc_html__('LSX Sensei Sidebar', 'lsx'), |
|
| 63 | 63 | 'id' => 'lsx-sensei-sidebar', |
| 64 | 64 | 'before_widget' => '<aside id="%1$s" class="widget %2$s">', |
| 65 | 65 | 'after_widget' => '</aside>', |
| 66 | 66 | 'before_title' => '<h3 class="widget-title">', |
| 67 | 67 | 'after_title' => '</h3>', |
| 68 | - ) ); |
|
| 68 | + )); |
|
| 69 | 69 | } |
| 70 | 70 | } |
| 71 | 71 | |
@@ -75,9 +75,9 @@ discard block |
||
| 75 | 75 | * @param [type] $classes |
| 76 | 76 | * @return classes |
| 77 | 77 | */ |
| 78 | - public function lsx_widget_area_sensei_is_active( $classes ) { |
|
| 78 | + public function lsx_widget_area_sensei_is_active($classes) { |
|
| 79 | 79 | |
| 80 | - if ( class_exists( 'Sensei_Lesson' ) && is_active_sidebar( 'lsx-sensei-sidebar' ) ) { |
|
| 80 | + if (class_exists('Sensei_Lesson') && is_active_sidebar('lsx-sensei-sidebar')) { |
|
| 81 | 81 | $classes[] = 'lsx-sensei-sidebar-active'; |
| 82 | 82 | } |
| 83 | 83 | |
@@ -90,11 +90,11 @@ discard block |
||
| 90 | 90 | * @return void |
| 91 | 91 | */ |
| 92 | 92 | public function lsx_sensei_lesson_sidebar() { |
| 93 | - if ( class_exists( 'Sensei_Lesson' ) && ( class_exists( 'Sensei_Course_Participants' ) || class_exists( 'Sensei_Course_Progress' ) ) ) { |
|
| 94 | - if ( ( is_single() && ( is_singular( 'lesson' ) ) ) || ( is_single() && ( is_singular( 'quiz' ) ) ) ) { |
|
| 95 | - if ( is_active_sidebar( 'lsx-sensei-sidebar' ) ) { |
|
| 93 | + if (class_exists('Sensei_Lesson') && (class_exists('Sensei_Course_Participants') || class_exists('Sensei_Course_Progress'))) { |
|
| 94 | + if ((is_single() && (is_singular('lesson'))) || (is_single() && (is_singular('quiz')))) { |
|
| 95 | + if (is_active_sidebar('lsx-sensei-sidebar')) { |
|
| 96 | 96 | echo '<div id="secondary" class="widget-area lsx-sensei-sidebar">'; |
| 97 | - dynamic_sidebar( 'lsx-sensei-sidebar' ); |
|
| 97 | + dynamic_sidebar('lsx-sensei-sidebar'); |
|
| 98 | 98 | echo '</div>'; |
| 99 | 99 | } |
| 100 | 100 | } |
@@ -7,15 +7,15 @@ discard block |
||
| 7 | 7 | * @category core |
| 8 | 8 | */ |
| 9 | 9 | |
| 10 | -if ( ! defined( 'ABSPATH' ) ) { |
|
| 10 | +if ( ! defined('ABSPATH')) { |
|
| 11 | 11 | exit; |
| 12 | 12 | } |
| 13 | 13 | |
| 14 | -if ( ! class_exists( 'WP_Customize_Control' ) ) { |
|
| 14 | +if ( ! class_exists('WP_Customize_Control')) { |
|
| 15 | 15 | return; |
| 16 | 16 | } |
| 17 | 17 | |
| 18 | -if ( ! class_exists( 'LSX_Customize_Core_Control' ) ) : |
|
| 18 | +if ( ! class_exists('LSX_Customize_Core_Control')) : |
|
| 19 | 19 | |
| 20 | 20 | /** |
| 21 | 21 | * LSX_Customize_Core_Control Class |
@@ -35,16 +35,16 @@ discard block |
||
| 35 | 35 | ?> |
| 36 | 36 | <label> |
| 37 | 37 | <?php |
| 38 | - if ( ! empty( $this->label ) ) { |
|
| 38 | + if ( ! empty($this->label)) { |
|
| 39 | 39 | ?> |
| 40 | - <span class="customize-control-title"><?php echo esc_html( $this->label ); ?></span> |
|
| 40 | + <span class="customize-control-title"><?php echo esc_html($this->label); ?></span> |
|
| 41 | 41 | <?php |
| 42 | 42 | } |
| 43 | - if ( ! empty( $this->description ) ) { |
|
| 43 | + if ( ! empty($this->description)) { |
|
| 44 | 44 | ?> |
| 45 | - <span class="description customize-control-description"><?php echo esc_html( $this->description ); ?></span> |
|
| 45 | + <span class="description customize-control-description"><?php echo esc_html($this->description); ?></span> |
|
| 46 | 46 | <?php } ?> |
| 47 | - <input <?php $this->link(); ?> type="checkbox" value="<?php echo esc_attr( $this->value() ); ?>" <?php $this->input_attrs(); ?>> |
|
| 47 | + <input <?php $this->link(); ?> type="checkbox" value="<?php echo esc_attr($this->value()); ?>" <?php $this->input_attrs(); ?>> |
|
| 48 | 48 | </label> |
| 49 | 49 | <?php |
| 50 | 50 | } |
@@ -6,11 +6,11 @@ discard block |
||
| 6 | 6 | * @subpackage customizer |
| 7 | 7 | */ |
| 8 | 8 | |
| 9 | -if ( ! defined( 'ABSPATH' ) ) { |
|
| 9 | +if ( ! defined('ABSPATH')) { |
|
| 10 | 10 | exit; |
| 11 | 11 | } |
| 12 | 12 | |
| 13 | -if ( ! class_exists( 'LSX_Theme_Customizer' ) ) : |
|
| 13 | +if ( ! class_exists('LSX_Theme_Customizer')) : |
|
| 14 | 14 | |
| 15 | 15 | /** |
| 16 | 16 | * Customizer Configuration File |
@@ -26,22 +26,22 @@ discard block |
||
| 26 | 26 | /** |
| 27 | 27 | * Initialize the plugin by setting localization and loading public scripts and styles. |
| 28 | 28 | */ |
| 29 | - public function __construct( $controls ) { |
|
| 29 | + public function __construct($controls) { |
|
| 30 | 30 | require get_template_directory() . '/includes/classes/class-lsx-customize-core-control.php'; |
| 31 | 31 | require get_template_directory() . '/includes/classes/class-lsx-customize-layout-control.php'; |
| 32 | 32 | require get_template_directory() . '/includes/classes/class-lsx-customize-header-layout-control.php'; |
| 33 | 33 | |
| 34 | 34 | $this->controls = $controls; |
| 35 | 35 | |
| 36 | - add_action( 'customize_preview_init', array( $this, 'customize_preview_js' ), 20 ); |
|
| 37 | - add_action( 'customize_register', array( $this, 'customizer' ), 11 ); |
|
| 36 | + add_action('customize_preview_init', array($this, 'customize_preview_js'), 20); |
|
| 37 | + add_action('customize_register', array($this, 'customizer'), 11); |
|
| 38 | 38 | } |
| 39 | 39 | |
| 40 | 40 | /** |
| 41 | 41 | * Binds JS handlers to make Theme Customizer preview reload changes asynchronously. |
| 42 | 42 | */ |
| 43 | 43 | public function customize_preview_js() { |
| 44 | - wp_enqueue_script( 'lsx_customizer', get_template_directory_uri() . '/assets/js/admin/customizer.js', array( 'customize-preview' ), LSX_VERSION, true ); |
|
| 44 | + wp_enqueue_script('lsx_customizer', get_template_directory_uri() . '/assets/js/admin/customizer.js', array('customize-preview'), LSX_VERSION, true); |
|
| 45 | 45 | |
| 46 | 46 | wp_localize_script( |
| 47 | 47 | 'lsx_customizer', |
@@ -55,52 +55,52 @@ discard block |
||
| 55 | 55 | /** |
| 56 | 56 | * Create customiser controls. |
| 57 | 57 | */ |
| 58 | - public function customizer( $wp_customize ) { |
|
| 58 | + public function customizer($wp_customize) { |
|
| 59 | 59 | // Start panels. |
| 60 | - if ( ! empty( $this->controls['panels'] ) ) { |
|
| 61 | - foreach ( $this->controls['panels'] as $panel_slug => $args ) { |
|
| 62 | - $this->add_panel( $panel_slug, $args, $wp_customize ); |
|
| 60 | + if ( ! empty($this->controls['panels'])) { |
|
| 61 | + foreach ($this->controls['panels'] as $panel_slug => $args) { |
|
| 62 | + $this->add_panel($panel_slug, $args, $wp_customize); |
|
| 63 | 63 | } |
| 64 | 64 | } |
| 65 | 65 | |
| 66 | 66 | // Start sections. |
| 67 | - if ( ! empty( $this->controls['sections'] ) ) { |
|
| 68 | - foreach ( $this->controls['sections'] as $section_slug => $args ) { |
|
| 69 | - $this->add_section( $section_slug, $args, $wp_customize ); |
|
| 67 | + if ( ! empty($this->controls['sections'])) { |
|
| 68 | + foreach ($this->controls['sections'] as $section_slug => $args) { |
|
| 69 | + $this->add_section($section_slug, $args, $wp_customize); |
|
| 70 | 70 | } |
| 71 | 71 | } |
| 72 | 72 | |
| 73 | 73 | // Start settings. |
| 74 | - if ( ! empty( $this->controls['settings'] ) ) { |
|
| 75 | - foreach ( $this->controls['settings'] as $settings_slug => $args ) { |
|
| 76 | - $this->add_setting( $settings_slug, $args, $wp_customize ); |
|
| 74 | + if ( ! empty($this->controls['settings'])) { |
|
| 75 | + foreach ($this->controls['settings'] as $settings_slug => $args) { |
|
| 76 | + $this->add_setting($settings_slug, $args, $wp_customize); |
|
| 77 | 77 | } |
| 78 | 78 | } |
| 79 | 79 | |
| 80 | 80 | // Start fields. |
| 81 | - if ( ! empty( $this->controls['fields'] ) ) { |
|
| 82 | - foreach ( $this->controls['fields'] as $field_slug => $args ) { |
|
| 83 | - $this->add_control( $field_slug, $args, $wp_customize ); |
|
| 81 | + if ( ! empty($this->controls['fields'])) { |
|
| 82 | + foreach ($this->controls['fields'] as $field_slug => $args) { |
|
| 83 | + $this->add_control($field_slug, $args, $wp_customize); |
|
| 84 | 84 | } |
| 85 | 85 | } |
| 86 | 86 | |
| 87 | 87 | // Start selective refresh. |
| 88 | - if ( ! empty( $this->controls['selective_refresh'] ) ) { |
|
| 89 | - foreach ( $this->controls['selective_refresh'] as $field_slug => $args ) { |
|
| 90 | - $this->add_selective_refresh( $field_slug, $args, $wp_customize ); |
|
| 88 | + if ( ! empty($this->controls['selective_refresh'])) { |
|
| 89 | + foreach ($this->controls['selective_refresh'] as $field_slug => $args) { |
|
| 90 | + $this->add_selective_refresh($field_slug, $args, $wp_customize); |
|
| 91 | 91 | } |
| 92 | 92 | } |
| 93 | 93 | |
| 94 | - $wp_customize->get_setting( 'blogname' )->transport = 'postMessage'; |
|
| 95 | - $wp_customize->get_setting( 'blogdescription' )->transport = 'postMessage'; |
|
| 96 | - $wp_customize->get_setting( 'background_color' )->transport = 'postMessage'; |
|
| 94 | + $wp_customize->get_setting('blogname')->transport = 'postMessage'; |
|
| 95 | + $wp_customize->get_setting('blogdescription')->transport = 'postMessage'; |
|
| 96 | + $wp_customize->get_setting('background_color')->transport = 'postMessage'; |
|
| 97 | 97 | |
| 98 | 98 | $wp_customize->selective_refresh->add_partial( |
| 99 | 99 | 'blogname', |
| 100 | 100 | array( |
| 101 | 101 | 'selector' => 'h1.site-title a', |
| 102 | 102 | 'render_callback' => function() { |
| 103 | - bloginfo( 'name' ); |
|
| 103 | + bloginfo('name'); |
|
| 104 | 104 | }, |
| 105 | 105 | ) |
| 106 | 106 | ); |
@@ -110,7 +110,7 @@ discard block |
||
| 110 | 110 | array( |
| 111 | 111 | 'selector' => '.site-description', |
| 112 | 112 | 'render_callback' => function() { |
| 113 | - bloginfo( 'description' ); |
|
| 113 | + bloginfo('description'); |
|
| 114 | 114 | }, |
| 115 | 115 | ) |
| 116 | 116 | ); |
@@ -119,7 +119,7 @@ discard block |
||
| 119 | 119 | /** |
| 120 | 120 | * Create a panel. |
| 121 | 121 | */ |
| 122 | - private function add_panel( $slug, $args, $wp_customize ) { |
|
| 122 | + private function add_panel($slug, $args, $wp_customize) { |
|
| 123 | 123 | $default_args = array( |
| 124 | 124 | 'title' => null, |
| 125 | 125 | 'description' => null, |
@@ -127,26 +127,26 @@ discard block |
||
| 127 | 127 | |
| 128 | 128 | $wp_customize->add_panel( |
| 129 | 129 | $slug, |
| 130 | - array_merge( $default_args, $args ) |
|
| 130 | + array_merge($default_args, $args) |
|
| 131 | 131 | ); |
| 132 | 132 | } |
| 133 | 133 | |
| 134 | 134 | /** |
| 135 | 135 | * Create a section. |
| 136 | 136 | */ |
| 137 | - private function add_section( $slug, $args, $wp_customize ) { |
|
| 137 | + private function add_section($slug, $args, $wp_customize) { |
|
| 138 | 138 | $default_args = array( |
| 139 | 139 | 'capability' => 'edit_theme_options', |
| 140 | 140 | 'description' => null, |
| 141 | 141 | ); |
| 142 | 142 | |
| 143 | - $wp_customize->add_section( $slug, array_merge( $default_args, $args ) ); |
|
| 143 | + $wp_customize->add_section($slug, array_merge($default_args, $args)); |
|
| 144 | 144 | } |
| 145 | 145 | |
| 146 | 146 | /** |
| 147 | 147 | * Create a setting. |
| 148 | 148 | */ |
| 149 | - private function add_setting( $slug, $args, $wp_customize ) { |
|
| 149 | + private function add_setting($slug, $args, $wp_customize) { |
|
| 150 | 150 | $wp_customize->add_setting( |
| 151 | 151 | $slug, |
| 152 | 152 | array_merge( |
@@ -165,23 +165,23 @@ discard block |
||
| 165 | 165 | /** |
| 166 | 166 | * Create a control. |
| 167 | 167 | */ |
| 168 | - private function add_control( $slug, $args, $wp_customize ) { |
|
| 168 | + private function add_control($slug, $args, $wp_customize) { |
|
| 169 | 169 | $default_args = array(); |
| 170 | 170 | |
| 171 | - if ( isset( $args['control'] ) && class_exists( $args['control'] ) ) { |
|
| 171 | + if (isset($args['control']) && class_exists($args['control'])) { |
|
| 172 | 172 | $control_class = $args['control']; |
| 173 | - unset( $args['control'] ); |
|
| 173 | + unset($args['control']); |
|
| 174 | 174 | |
| 175 | - $control = new $control_class( $wp_customize, $slug, array_merge( $default_args, $args ) ); |
|
| 176 | - $wp_customize->add_control( $control ); |
|
| 175 | + $control = new $control_class($wp_customize, $slug, array_merge($default_args, $args)); |
|
| 176 | + $wp_customize->add_control($control); |
|
| 177 | 177 | } else { |
| 178 | - if ( isset( $args['control'] ) ) { |
|
| 179 | - unset( $args['control'] ); |
|
| 178 | + if (isset($args['control'])) { |
|
| 179 | + unset($args['control']); |
|
| 180 | 180 | } |
| 181 | 181 | |
| 182 | 182 | $wp_customize->add_control( |
| 183 | 183 | $slug, |
| 184 | - array_merge( $default_args, $args ) |
|
| 184 | + array_merge($default_args, $args) |
|
| 185 | 185 | ); |
| 186 | 186 | } |
| 187 | 187 | } |
@@ -189,7 +189,7 @@ discard block |
||
| 189 | 189 | /** |
| 190 | 190 | * Create a selective refresh. |
| 191 | 191 | */ |
| 192 | - private function add_selective_refresh( $slug, $args, $wp_customize ) { |
|
| 192 | + private function add_selective_refresh($slug, $args, $wp_customize) { |
|
| 193 | 193 | $default_args = array( |
| 194 | 194 | 'selector' => null, |
| 195 | 195 | 'render_callback' => null, |
@@ -197,23 +197,23 @@ discard block |
||
| 197 | 197 | |
| 198 | 198 | $wp_customize->selective_refresh->add_partial( |
| 199 | 199 | $slug, |
| 200 | - array_merge( $default_args, $args ) |
|
| 200 | + array_merge($default_args, $args) |
|
| 201 | 201 | ); |
| 202 | 202 | } |
| 203 | 203 | |
| 204 | 204 | /** |
| 205 | 205 | * Returns a registered field. |
| 206 | 206 | */ |
| 207 | - public function get_control( $id ) { |
|
| 208 | - $field = $this->controls['fields'][ $id ]; |
|
| 207 | + public function get_control($id) { |
|
| 208 | + $field = $this->controls['fields'][$id]; |
|
| 209 | 209 | return $field; |
| 210 | 210 | } |
| 211 | 211 | |
| 212 | 212 | /** |
| 213 | 213 | * Returns a registered setting. |
| 214 | 214 | */ |
| 215 | - public function get_setting( $id ) { |
|
| 216 | - $setting = $this->controls['settings'][ $id ]; |
|
| 215 | + public function get_setting($id) { |
|
| 216 | + $setting = $this->controls['settings'][$id]; |
|
| 217 | 217 | return $setting; |
| 218 | 218 | } |
| 219 | 219 | |
@@ -7,15 +7,15 @@ discard block |
||
| 7 | 7 | * @category bootstrap-navigation-walker |
| 8 | 8 | */ |
| 9 | 9 | |
| 10 | -if ( ! defined( 'ABSPATH' ) ) { |
|
| 10 | +if ( ! defined('ABSPATH')) { |
|
| 11 | 11 | exit; |
| 12 | 12 | } |
| 13 | 13 | |
| 14 | -if ( ! class_exists( 'Walker_Nav_Menu' ) ) { |
|
| 14 | +if ( ! class_exists('Walker_Nav_Menu')) { |
|
| 15 | 15 | return; |
| 16 | 16 | } |
| 17 | 17 | |
| 18 | -if ( ! class_exists( 'LSX_Bootstrap_Navwalker' ) ) : |
|
| 18 | +if ( ! class_exists('LSX_Bootstrap_Navwalker')) : |
|
| 19 | 19 | |
| 20 | 20 | /** |
| 21 | 21 | * Cleaner Bootstrap walker |
@@ -35,8 +35,8 @@ discard block |
||
| 35 | 35 | * @param string $output Passed by reference. Used to append additional content. |
| 36 | 36 | * @param int $depth Depth of page. Used for padding. |
| 37 | 37 | */ |
| 38 | - public function start_lvl( &$output, $depth = 0, $args = array() ) { |
|
| 39 | - $indent = str_repeat( "\t", $depth ); |
|
| 38 | + public function start_lvl(&$output, $depth = 0, $args = array()) { |
|
| 39 | + $indent = str_repeat("\t", $depth); |
|
| 40 | 40 | $output .= "\n$indent<ul role=\"menu\" class=\" dropdown-menu\">\n"; |
| 41 | 41 | } |
| 42 | 42 | |
@@ -44,7 +44,7 @@ discard block |
||
| 44 | 44 | * Used to append additional content. |
| 45 | 45 | * @param string $item Passed by reference. |
| 46 | 46 | */ |
| 47 | - public function filter_default_pages( &$item ) { |
|
| 47 | + public function filter_default_pages(&$item) { |
|
| 48 | 48 | return $item; |
| 49 | 49 | } |
| 50 | 50 | |
@@ -58,14 +58,14 @@ discard block |
||
| 58 | 58 | * @param int $current_page Menu item ID. |
| 59 | 59 | * @param object $args |
| 60 | 60 | */ |
| 61 | - public function start_el( &$output, $item, $depth = 0, $args = array(), $id = 0 ) { |
|
| 62 | - $indent = ( $depth ) ? str_repeat( "\t", $depth ) : ''; |
|
| 61 | + public function start_el(&$output, $item, $depth = 0, $args = array(), $id = 0) { |
|
| 62 | + $indent = ($depth) ? str_repeat("\t", $depth) : ''; |
|
| 63 | 63 | |
| 64 | 64 | /** |
| 65 | 65 | * If this is a default menu being called we need to fix |
| 66 | 66 | * the item object thats coming through. |
| 67 | 67 | */ |
| 68 | - if ( ! isset( $item->title ) ) { |
|
| 68 | + if ( ! isset($item->title)) { |
|
| 69 | 69 | return; |
| 70 | 70 | } |
| 71 | 71 | |
@@ -77,63 +77,63 @@ discard block |
||
| 77 | 77 | * comparison that is not case sensitive. The strcasecmp() function returns |
| 78 | 78 | * a 0 if the strings are equal. |
| 79 | 79 | */ |
| 80 | - if ( 0 == strcasecmp( $item->attr_title, 'divider' ) && 1 === $depth ) { |
|
| 80 | + if (0 == strcasecmp($item->attr_title, 'divider') && 1 === $depth) { |
|
| 81 | 81 | $output .= $indent . '<li role="presentation" class="divider">'; |
| 82 | - } elseif ( 0 == strcasecmp( $item->title, 'divider' ) && 1 === $depth ) { |
|
| 82 | + } elseif (0 == strcasecmp($item->title, 'divider') && 1 === $depth) { |
|
| 83 | 83 | $output .= $indent . '<li role="presentation" class="divider">'; |
| 84 | - } elseif ( 0 == strcasecmp( $item->attr_title, 'dropdown-header' ) && 1 === $depth ) { |
|
| 85 | - $output .= $indent . '<li role="presentation" class="dropdown-header">' . esc_attr( $item->title ); |
|
| 86 | - } elseif ( 0 == strcasecmp( $item->attr_title, 'disabled' ) ) { |
|
| 87 | - $output .= $indent . '<li role="presentation" class="disabled"><a href="#">' . esc_attr( $item->title ) . '</a>'; |
|
| 84 | + } elseif (0 == strcasecmp($item->attr_title, 'dropdown-header') && 1 === $depth) { |
|
| 85 | + $output .= $indent . '<li role="presentation" class="dropdown-header">' . esc_attr($item->title); |
|
| 86 | + } elseif (0 == strcasecmp($item->attr_title, 'disabled')) { |
|
| 87 | + $output .= $indent . '<li role="presentation" class="disabled"><a href="#">' . esc_attr($item->title) . '</a>'; |
|
| 88 | 88 | } else { |
| 89 | 89 | $class_names = ''; |
| 90 | 90 | $value = ''; |
| 91 | 91 | |
| 92 | - $classes = empty( $item->classes ) ? array() : (array) $item->classes; |
|
| 92 | + $classes = empty($item->classes) ? array() : (array) $item->classes; |
|
| 93 | 93 | $classes[] = 'menu-item-' . $item->ID; |
| 94 | 94 | |
| 95 | - $classes = apply_filters( 'lsx_nav_menu_css_class', array_filter( $classes ), $item, $args, $depth ); |
|
| 95 | + $classes = apply_filters('lsx_nav_menu_css_class', array_filter($classes), $item, $args, $depth); |
|
| 96 | 96 | |
| 97 | - $class_names = join( ' ', $classes ); |
|
| 97 | + $class_names = join(' ', $classes); |
|
| 98 | 98 | |
| 99 | - if ( $args->has_children ) |
|
| 99 | + if ($args->has_children) |
|
| 100 | 100 | $class_names .= ' dropdown'; |
| 101 | 101 | |
| 102 | - if ( in_array( 'current-menu-item', $classes ) ) |
|
| 102 | + if (in_array('current-menu-item', $classes)) |
|
| 103 | 103 | $class_names .= ' active'; |
| 104 | 104 | |
| 105 | - if ( in_array( 'current-menu-parent', $classes ) ) |
|
| 105 | + if (in_array('current-menu-parent', $classes)) |
|
| 106 | 106 | $class_names .= ' active'; |
| 107 | 107 | |
| 108 | 108 | //Check if this is ment to be a "social" type menu |
| 109 | - $class_names = $class_names ? ' class="' . esc_attr( $class_names ) . '"' : ''; |
|
| 109 | + $class_names = $class_names ? ' class="' . esc_attr($class_names) . '"' : ''; |
|
| 110 | 110 | |
| 111 | - $id = apply_filters( 'nav_menu_item_id', 'menu-item-' . $item->ID, $item, $args ); |
|
| 112 | - $id = $id ? ' id="' . esc_attr( $id ) . '"' : ''; |
|
| 111 | + $id = apply_filters('nav_menu_item_id', 'menu-item-' . $item->ID, $item, $args); |
|
| 112 | + $id = $id ? ' id="' . esc_attr($id) . '"' : ''; |
|
| 113 | 113 | |
| 114 | 114 | $output .= $indent . '<li' . $id . $value . $class_names . '>'; |
| 115 | 115 | |
| 116 | 116 | $atts = array(); |
| 117 | - $atts['title'] = ! empty( $item->attr_title ) ? $item->attr_title : $item->title; |
|
| 118 | - $atts['target'] = ! empty( $item->target ) ? $item->target : ''; |
|
| 119 | - $atts['rel'] = ! empty( $item->xfn ) ? $item->xfn : ''; |
|
| 117 | + $atts['title'] = ! empty($item->attr_title) ? $item->attr_title : $item->title; |
|
| 118 | + $atts['target'] = ! empty($item->target) ? $item->target : ''; |
|
| 119 | + $atts['rel'] = ! empty($item->xfn) ? $item->xfn : ''; |
|
| 120 | 120 | |
| 121 | 121 | // If item has_children add atts to a. |
| 122 | - if ( $args->has_children ) { |
|
| 123 | - $atts['href'] = ! empty( $item->url ) ? $item->url : ''; |
|
| 122 | + if ($args->has_children) { |
|
| 123 | + $atts['href'] = ! empty($item->url) ? $item->url : ''; |
|
| 124 | 124 | $atts['data-toggle'] = 'dropdown'; |
| 125 | 125 | $atts['class'] = 'dropdown-toggle'; |
| 126 | 126 | $atts['aria-haspopup'] = 'true'; |
| 127 | 127 | } else { |
| 128 | - $atts['href'] = ! empty( $item->url ) ? $item->url : ''; |
|
| 128 | + $atts['href'] = ! empty($item->url) ? $item->url : ''; |
|
| 129 | 129 | } |
| 130 | 130 | |
| 131 | - $atts = apply_filters( 'nav_menu_link_attributes', $atts, $item, $args ); |
|
| 131 | + $atts = apply_filters('nav_menu_link_attributes', $atts, $item, $args); |
|
| 132 | 132 | |
| 133 | 133 | $attributes = ''; |
| 134 | - foreach ( $atts as $attr => $value ) { |
|
| 135 | - if ( ! empty( $value ) ) { |
|
| 136 | - $value = ( 'href' === $attr ) ? esc_url( $value ) : esc_attr( $value ); |
|
| 134 | + foreach ($atts as $attr => $value) { |
|
| 135 | + if ( ! empty($value)) { |
|
| 136 | + $value = ('href' === $attr) ? esc_url($value) : esc_attr($value); |
|
| 137 | 137 | $attributes .= ' ' . $attr . '="' . $value . '"'; |
| 138 | 138 | } |
| 139 | 139 | } |
@@ -141,11 +141,11 @@ discard block |
||
| 141 | 141 | $item_output = $args->before; |
| 142 | 142 | |
| 143 | 143 | $item_output .= '<a' . $attributes . '>'; |
| 144 | - $item_output .= $args->link_before . apply_filters( 'the_title', $item->title, $item->ID ) . $args->link_after; |
|
| 145 | - $item_output .= ( $args->has_children && 0 === $depth ) ? ' <span class="caret"></span></a>' : '</a>'; |
|
| 144 | + $item_output .= $args->link_before . apply_filters('the_title', $item->title, $item->ID) . $args->link_after; |
|
| 145 | + $item_output .= ($args->has_children && 0 === $depth) ? ' <span class="caret"></span></a>' : '</a>'; |
|
| 146 | 146 | $item_output .= $args->after; |
| 147 | 147 | |
| 148 | - $output .= apply_filters( 'walker_nav_menu_start_el', $item_output, $item, $depth, $args ); |
|
| 148 | + $output .= apply_filters('walker_nav_menu_start_el', $item_output, $item, $depth, $args); |
|
| 149 | 149 | } |
| 150 | 150 | } |
| 151 | 151 | |
@@ -169,18 +169,18 @@ discard block |
||
| 169 | 169 | * @param string $output Passed by reference. Used to append additional content. |
| 170 | 170 | * @return null Null on failure with no changes to parameters. |
| 171 | 171 | */ |
| 172 | - public function display_element( $element, &$children_elements, $max_depth, $depth, $args, &$output ) { |
|
| 173 | - if ( ! $element ) { |
|
| 172 | + public function display_element($element, &$children_elements, $max_depth, $depth, $args, &$output) { |
|
| 173 | + if ( ! $element) { |
|
| 174 | 174 | return; |
| 175 | 175 | } |
| 176 | 176 | |
| 177 | 177 | $id_field = $this->db_fields['id']; |
| 178 | 178 | |
| 179 | - if ( is_object( $args[0] ) ) { |
|
| 180 | - $args[0]->has_children = ! empty( $children_elements[ $element->$id_field ] ); |
|
| 179 | + if (is_object($args[0])) { |
|
| 180 | + $args[0]->has_children = ! empty($children_elements[$element->$id_field]); |
|
| 181 | 181 | } |
| 182 | 182 | |
| 183 | - parent::display_element( $element, $children_elements, $max_depth, $depth, $args, $output ); |
|
| 183 | + parent::display_element($element, $children_elements, $max_depth, $depth, $args, $output); |
|
| 184 | 184 | } |
| 185 | 185 | |
| 186 | 186 | /** |
@@ -194,18 +194,18 @@ discard block |
||
| 194 | 194 | * @param array $args passed from the wp_nav_menu function. |
| 195 | 195 | * |
| 196 | 196 | */ |
| 197 | - public static function fallback( $args ) { |
|
| 198 | - if ( current_user_can( 'manage_options' ) ) { |
|
| 197 | + public static function fallback($args) { |
|
| 198 | + if (current_user_can('manage_options')) { |
|
| 199 | 199 | $fb_output = null; |
| 200 | 200 | |
| 201 | - if ( $args['container'] ) { |
|
| 201 | + if ($args['container']) { |
|
| 202 | 202 | $fb_output = '<' . $args['container']; |
| 203 | 203 | |
| 204 | - if ( $args['container_id'] ) { |
|
| 204 | + if ($args['container_id']) { |
|
| 205 | 205 | $fb_output .= ' id="' . $args['container_id'] . '"'; |
| 206 | 206 | } |
| 207 | 207 | |
| 208 | - if ( $args['container_class'] ) { |
|
| 208 | + if ($args['container_class']) { |
|
| 209 | 209 | $fb_output .= ' class="' . $args['container_class'] . '"'; |
| 210 | 210 | } |
| 211 | 211 | |
@@ -214,23 +214,23 @@ discard block |
||
| 214 | 214 | |
| 215 | 215 | $fb_output .= '<ul'; |
| 216 | 216 | |
| 217 | - if ( $args['menu_id'] ) { |
|
| 217 | + if ($args['menu_id']) { |
|
| 218 | 218 | $fb_output .= ' id="' . $args['menu_id'] . '"'; |
| 219 | 219 | } |
| 220 | 220 | |
| 221 | - if ( $args['menu_class'] ) { |
|
| 221 | + if ($args['menu_class']) { |
|
| 222 | 222 | $fb_output .= ' class="' . $args['menu_class'] . '"'; |
| 223 | 223 | } |
| 224 | 224 | |
| 225 | 225 | $fb_output .= '>'; |
| 226 | - $fb_output .= '<li><a href="' . esc_url( admin_url( 'nav-menus.php' ) ) . '">' . esc_html__( 'Add a menu', 'lsx' ) . '</a></li>'; |
|
| 226 | + $fb_output .= '<li><a href="' . esc_url(admin_url('nav-menus.php')) . '">' . esc_html__('Add a menu', 'lsx') . '</a></li>'; |
|
| 227 | 227 | $fb_output .= '</ul>'; |
| 228 | 228 | |
| 229 | - if ( $args['container'] ) { |
|
| 229 | + if ($args['container']) { |
|
| 230 | 230 | $fb_output .= '</' . $args['container'] . '>'; |
| 231 | 231 | } |
| 232 | 232 | |
| 233 | - echo wp_kses_post( $fb_output ); |
|
| 233 | + echo wp_kses_post($fb_output); |
|
| 234 | 234 | } |
| 235 | 235 | } |
| 236 | 236 | |
@@ -7,15 +7,15 @@ discard block |
||
| 7 | 7 | * @category header-layout |
| 8 | 8 | */ |
| 9 | 9 | |
| 10 | -if ( ! defined( 'ABSPATH' ) ) { |
|
| 10 | +if ( ! defined('ABSPATH')) { |
|
| 11 | 11 | exit; |
| 12 | 12 | } |
| 13 | 13 | |
| 14 | -if ( ! class_exists( 'WP_Customize_Control' ) ) { |
|
| 14 | +if ( ! class_exists('WP_Customize_Control')) { |
|
| 15 | 15 | return; |
| 16 | 16 | } |
| 17 | 17 | |
| 18 | -if ( ! class_exists( 'LSX_Customize_Header_Layout_Control' ) ) : |
|
| 18 | +if ( ! class_exists('LSX_Customize_Header_Layout_Control')) : |
|
| 19 | 19 | |
| 20 | 20 | /** |
| 21 | 21 | * LSX_Customize_Header_Layout_Control Class |
@@ -30,10 +30,10 @@ discard block |
||
| 30 | 30 | public $statuses; |
| 31 | 31 | public $layouts = array(); |
| 32 | 32 | |
| 33 | - public function __construct( $manager, $id, $args = array() ) { |
|
| 34 | - parent::__construct( $manager, $id, $args ); |
|
| 33 | + public function __construct($manager, $id, $args = array()) { |
|
| 34 | + parent::__construct($manager, $id, $args); |
|
| 35 | 35 | |
| 36 | - if ( ! empty( $args['choices'] ) ) { |
|
| 36 | + if ( ! empty($args['choices'])) { |
|
| 37 | 37 | $this->layouts = $args['choices']; |
| 38 | 38 | } |
| 39 | 39 | } |
@@ -42,39 +42,39 @@ discard block |
||
| 42 | 42 | * Enqueue scripts/styles for the color picker. |
| 43 | 43 | */ |
| 44 | 44 | public function enqueue() { |
| 45 | - wp_enqueue_script( 'lsx-header-layout-control', get_template_directory_uri() . '/assets/js/admin/customizer-header-layout.js', array( 'jquery' ), LSX_VERSION, true ); |
|
| 45 | + wp_enqueue_script('lsx-header-layout-control', get_template_directory_uri() . '/assets/js/admin/customizer-header-layout.js', array('jquery'), LSX_VERSION, true); |
|
| 46 | 46 | } |
| 47 | 47 | |
| 48 | 48 | /** |
| 49 | 49 | * Render output. |
| 50 | 50 | */ |
| 51 | 51 | public function render_content() { |
| 52 | - $post_id = 'customize-control-' . str_replace( '[', '-', str_replace( ']', '', $this->id ) ); |
|
| 52 | + $post_id = 'customize-control-' . str_replace('[', '-', str_replace(']', '', $this->id)); |
|
| 53 | 53 | $class = 'customize-control customize-control-' . $this->type; |
| 54 | 54 | $value = $this->value(); |
| 55 | 55 | ?> |
| 56 | 56 | <label> |
| 57 | 57 | <?php |
| 58 | - if ( ! empty( $this->label ) ) { |
|
| 58 | + if ( ! empty($this->label)) { |
|
| 59 | 59 | ?> |
| 60 | - <span class="customize-control-title"><?php echo esc_html( $this->label ); ?></span> |
|
| 60 | + <span class="customize-control-title"><?php echo esc_html($this->label); ?></span> |
|
| 61 | 61 | <?php |
| 62 | 62 | } |
| 63 | - if ( ! empty( $this->description ) ) { |
|
| 63 | + if ( ! empty($this->description)) { |
|
| 64 | 64 | ?> |
| 65 | - <span class="description customize-control-description"><?php echo esc_html( $this->description ); ?></span> |
|
| 65 | + <span class="description customize-control-description"><?php echo esc_html($this->description); ?></span> |
|
| 66 | 66 | <?php } ?> |
| 67 | 67 | <div class="header-layouts-selector"> |
| 68 | 68 | <?php |
| 69 | - foreach ( $this->layouts as $layout ) { |
|
| 69 | + foreach ($this->layouts as $layout) { |
|
| 70 | 70 | $sel = 'border: 1px solid transparent;'; |
| 71 | - if ( $value === $layout ) { |
|
| 71 | + if ($value === $layout) { |
|
| 72 | 72 | $sel = 'border: 1px solid rgb(43, 166, 203);'; |
| 73 | 73 | } |
| 74 | - echo '<img class="header-layout-button" style="padding:2px;' . esc_attr( $sel ) . '" src="' . esc_attr( get_template_directory_uri() ) . '/assets/images/admin/header-' . esc_attr( $layout ) . '.png" data-option="' . esc_attr( $layout ) . '">'; |
|
| 74 | + echo '<img class="header-layout-button" style="padding:2px;' . esc_attr($sel) . '" src="' . esc_attr(get_template_directory_uri()) . '/assets/images/admin/header-' . esc_attr($layout) . '.png" data-option="' . esc_attr($layout) . '">'; |
|
| 75 | 75 | } |
| 76 | 76 | ?> |
| 77 | - <input <?php $this->link(); ?> class="selected-header-layout <?php echo esc_attr( $class ); ?>" id="<?php echo esc_attr( $post_id ); ?>" type="hidden" value="<?php echo esc_attr( $value ); ?>" <?php $this->input_attrs(); ?>> |
|
| 77 | + <input <?php $this->link(); ?> class="selected-header-layout <?php echo esc_attr($class); ?>" id="<?php echo esc_attr($post_id); ?>" type="hidden" value="<?php echo esc_attr($value); ?>" <?php $this->input_attrs(); ?>> |
|
| 78 | 78 | </div> |
| 79 | 79 | </label> |
| 80 | 80 | <?php |
@@ -5,35 +5,35 @@ discard block |
||
| 5 | 5 | * @package lsx |
| 6 | 6 | */ |
| 7 | 7 | |
| 8 | -if ( post_password_required() ) { |
|
| 8 | +if (post_password_required()) { |
|
| 9 | 9 | return; |
| 10 | 10 | } |
| 11 | 11 | |
| 12 | 12 | $commenter = wp_get_current_commenter(); |
| 13 | -$req = get_option( 'require_name_email' ); |
|
| 14 | -$aria_req = ( $req ? " aria-required='true'" : '' ); |
|
| 15 | -$html_req = ( $req ? " required='required'" : '' ); |
|
| 13 | +$req = get_option('require_name_email'); |
|
| 14 | +$aria_req = ($req ? " aria-required='true'" : ''); |
|
| 15 | +$html_req = ($req ? " required='required'" : ''); |
|
| 16 | 16 | |
| 17 | 17 | $comment_form_args = array( |
| 18 | - 'comment_field' => '<p class="comment-form-comment"><textarea placeholder="' . esc_html__( 'Comment', 'lsx' ) . '" id="comment" class="form-control" name="comment" cols="45" rows="8"' . $aria_req . $html_req . '></textarea></p>', |
|
| 18 | + 'comment_field' => '<p class="comment-form-comment"><textarea placeholder="' . esc_html__('Comment', 'lsx') . '" id="comment" class="form-control" name="comment" cols="45" rows="8"' . $aria_req . $html_req . '></textarea></p>', |
|
| 19 | 19 | |
| 20 | 20 | 'fields' => array( |
| 21 | - 'author' => '<p class="comment-form-author"><label for="author">' . esc_html__( 'Name', 'lsx' ) . '</label> ' . |
|
| 22 | - ( $req ? '<span class="required">*</span>' : '' ) . |
|
| 23 | - '<input class="form-control" placeholder="' . esc_html__( 'Name', 'lsx' ) . '" id="author" name="author" type="text" value="' . esc_attr( $commenter['comment_author'] ) . '" size="30"' . $aria_req . $html_req . '></p>', |
|
| 21 | + 'author' => '<p class="comment-form-author"><label for="author">' . esc_html__('Name', 'lsx') . '</label> ' . |
|
| 22 | + ($req ? '<span class="required">*</span>' : '') . |
|
| 23 | + '<input class="form-control" placeholder="' . esc_html__('Name', 'lsx') . '" id="author" name="author" type="text" value="' . esc_attr($commenter['comment_author']) . '" size="30"' . $aria_req . $html_req . '></p>', |
|
| 24 | 24 | |
| 25 | - 'email' => '<p class="comment-form-email"><label for="email">' . esc_html__( 'Email', 'lsx' ) . '</label> ' . |
|
| 26 | - ( $req ? '<span class="required">*</span>' : '' ) . |
|
| 27 | - '<input class="form-control" placeholder="' . esc_html__( 'Email', 'lsx' ) . '" id="email" name="email" type="text" value="' . esc_attr( $commenter['comment_author_email'] ) . '" size="30"' . $aria_req . $html_req . '></p>', |
|
| 25 | + 'email' => '<p class="comment-form-email"><label for="email">' . esc_html__('Email', 'lsx') . '</label> ' . |
|
| 26 | + ($req ? '<span class="required">*</span>' : '') . |
|
| 27 | + '<input class="form-control" placeholder="' . esc_html__('Email', 'lsx') . '" id="email" name="email" type="text" value="' . esc_attr($commenter['comment_author_email']) . '" size="30"' . $aria_req . $html_req . '></p>', |
|
| 28 | 28 | |
| 29 | - 'url' => '<p class="comment-form-url"><label for="url">' . esc_html__( 'Website', 'lsx' ) . '</label>' . |
|
| 30 | - '<input class="form-control" placeholder="' . esc_html__( 'Website', 'lsx' ) . '" id="url" name="url" type="text" value="' . esc_attr( $commenter['comment_author_url'] ) . '" size="30"></p>', |
|
| 29 | + 'url' => '<p class="comment-form-url"><label for="url">' . esc_html__('Website', 'lsx') . '</label>' . |
|
| 30 | + '<input class="form-control" placeholder="' . esc_html__('Website', 'lsx') . '" id="url" name="url" type="text" value="' . esc_attr($commenter['comment_author_url']) . '" size="30"></p>', |
|
| 31 | 31 | ), |
| 32 | 32 | ); |
| 33 | 33 | |
| 34 | -comment_form( $comment_form_args ); |
|
| 34 | +comment_form($comment_form_args); |
|
| 35 | 35 | |
| 36 | -if ( have_comments() ) : ?> |
|
| 36 | +if (have_comments()) : ?> |
|
| 37 | 37 | |
| 38 | 38 | <?php lsx_comments_before(); ?> |
| 39 | 39 | |
@@ -42,10 +42,10 @@ discard block |
||
| 42 | 42 | <?php |
| 43 | 43 | $comments_number = get_comments_number(); |
| 44 | 44 | |
| 45 | - if ( '1' === $comments_number ) { |
|
| 45 | + if ('1' === $comments_number) { |
|
| 46 | 46 | printf( |
| 47 | 47 | /* Translators: %s: post title */ |
| 48 | - esc_html_x( 'One Response to “%s”', 'comments.php', 'lsx' ), |
|
| 48 | + esc_html_x('One Response to “%s”', 'comments.php', 'lsx'), |
|
| 49 | 49 | get_the_title() |
| 50 | 50 | ); |
| 51 | 51 | } else { |
@@ -60,7 +60,7 @@ discard block |
||
| 60 | 60 | 'lsx' |
| 61 | 61 | ) |
| 62 | 62 | ), |
| 63 | - esc_html( number_format_i18n( $comments_number ) ), |
|
| 63 | + esc_html(number_format_i18n($comments_number)), |
|
| 64 | 64 | get_the_title() |
| 65 | 65 | ); |
| 66 | 66 | } |
@@ -79,24 +79,24 @@ discard block |
||
| 79 | 79 | |
| 80 | 80 | <?php |
| 81 | 81 | $comment_pages_count = get_comment_pages_count(); |
| 82 | - if ( $comment_pages_count > 1 && get_option( 'page_comments' ) ) : |
|
| 82 | + if ($comment_pages_count > 1 && get_option('page_comments')) : |
|
| 83 | 83 | ?> |
| 84 | 84 | <nav> |
| 85 | 85 | <ul class="pager"> |
| 86 | - <?php if ( get_previous_comments_link() ) : ?> |
|
| 87 | - <li class="previous"><?php previous_comments_link( esc_html__( '← Older comments', 'lsx' ) ); ?></li> |
|
| 86 | + <?php if (get_previous_comments_link()) : ?> |
|
| 87 | + <li class="previous"><?php previous_comments_link(esc_html__('← Older comments', 'lsx')); ?></li> |
|
| 88 | 88 | <?php endif; ?> |
| 89 | 89 | |
| 90 | - <?php if ( get_next_comments_link() ) : ?> |
|
| 91 | - <li class="next"><?php next_comments_link( esc_html__( 'Newer comments →', 'lsx' ) ); ?></li> |
|
| 90 | + <?php if (get_next_comments_link()) : ?> |
|
| 91 | + <li class="next"><?php next_comments_link(esc_html__('Newer comments →', 'lsx')); ?></li> |
|
| 92 | 92 | <?php endif; ?> |
| 93 | 93 | </ul> |
| 94 | 94 | </nav> |
| 95 | 95 | <?php endif; ?> |
| 96 | 96 | |
| 97 | - <?php if ( ! comments_open() && ! is_page() && post_type_supports( get_post_type(), 'comments' ) ) : ?> |
|
| 97 | + <?php if ( ! comments_open() && ! is_page() && post_type_supports(get_post_type(), 'comments')) : ?> |
|
| 98 | 98 | <div class="alert alert-warning"> |
| 99 | - <?php esc_html_e( 'Comments are closed.', 'lsx' ); ?> |
|
| 99 | + <?php esc_html_e('Comments are closed.', 'lsx'); ?> |
|
| 100 | 100 | </div> |
| 101 | 101 | <?php endif; ?> |
| 102 | 102 | </section><!-- /#comments --> |
@@ -105,11 +105,11 @@ discard block |
||
| 105 | 105 | |
| 106 | 106 | <?php endif; ?> |
| 107 | 107 | |
| 108 | -<?php if ( ! have_comments() && ! comments_open() && post_type_supports( get_post_type(), 'comments' ) ) : ?> |
|
| 108 | +<?php if ( ! have_comments() && ! comments_open() && post_type_supports(get_post_type(), 'comments')) : ?> |
|
| 109 | 109 | |
| 110 | 110 | <section id="comments"> |
| 111 | 111 | <div class="alert alert-warning"> |
| 112 | - <?php esc_html_e( 'Comments are closed.', 'lsx' ); ?> |
|
| 112 | + <?php esc_html_e('Comments are closed.', 'lsx'); ?> |
|
| 113 | 113 | </div> |
| 114 | 114 | </section><!-- /#comments --> |
| 115 | 115 | |
@@ -6,11 +6,11 @@ discard block |
||
| 6 | 6 | * @subpackage woocommerce |
| 7 | 7 | */ |
| 8 | 8 | |
| 9 | -if ( ! defined( 'ABSPATH' ) ) { |
|
| 9 | +if ( ! defined('ABSPATH')) { |
|
| 10 | 10 | exit; |
| 11 | 11 | } |
| 12 | 12 | |
| 13 | -if ( ! function_exists( 'lsx_wc_support' ) ) : |
|
| 13 | +if ( ! function_exists('lsx_wc_support')) : |
|
| 14 | 14 | |
| 15 | 15 | /** |
| 16 | 16 | * WooCommerce support. |
@@ -19,17 +19,17 @@ discard block |
||
| 19 | 19 | * @subpackage woocommerce |
| 20 | 20 | */ |
| 21 | 21 | function lsx_wc_support() { |
| 22 | - add_theme_support( 'woocommerce' ); |
|
| 23 | - add_theme_support( 'wc-product-gallery-zoom' ); |
|
| 24 | - add_theme_support( 'wc-product-gallery-lightbox' ); |
|
| 25 | - add_theme_support( 'wc-product-gallery-slider' ); |
|
| 22 | + add_theme_support('woocommerce'); |
|
| 23 | + add_theme_support('wc-product-gallery-zoom'); |
|
| 24 | + add_theme_support('wc-product-gallery-lightbox'); |
|
| 25 | + add_theme_support('wc-product-gallery-slider'); |
|
| 26 | 26 | } |
| 27 | 27 | |
| 28 | - add_action( 'after_setup_theme', 'lsx_wc_support' ); |
|
| 28 | + add_action('after_setup_theme', 'lsx_wc_support'); |
|
| 29 | 29 | |
| 30 | 30 | endif; |
| 31 | 31 | |
| 32 | -if ( ! function_exists( 'lsx_wc_scripts_add_styles' ) ) : |
|
| 32 | +if ( ! function_exists('lsx_wc_scripts_add_styles')) : |
|
| 33 | 33 | |
| 34 | 34 | /** |
| 35 | 35 | * WooCommerce enqueue styles. |
@@ -38,18 +38,18 @@ discard block |
||
| 38 | 38 | * @subpackage woocommerce |
| 39 | 39 | */ |
| 40 | 40 | function lsx_wc_scripts_add_styles() { |
| 41 | - wp_enqueue_style( 'woocommerce-lsx', get_template_directory_uri() . '/assets/css/woocommerce/woocommerce.css', array( 'lsx_main' ), LSX_VERSION ); |
|
| 42 | - wp_style_add_data( 'woocommerce-lsx', 'rtl', 'replace' ); |
|
| 41 | + wp_enqueue_style('woocommerce-lsx', get_template_directory_uri() . '/assets/css/woocommerce/woocommerce.css', array('lsx_main'), LSX_VERSION); |
|
| 42 | + wp_style_add_data('woocommerce-lsx', 'rtl', 'replace'); |
|
| 43 | 43 | |
| 44 | 44 | // Remove WC Shipping Multiple Addresses specific script causing issues on checkout. |
| 45 | - wp_dequeue_script( 'wcms-country-select' ); |
|
| 45 | + wp_dequeue_script('wcms-country-select'); |
|
| 46 | 46 | } |
| 47 | 47 | |
| 48 | - add_action( 'wp_enqueue_scripts', 'lsx_wc_scripts_add_styles' ); |
|
| 48 | + add_action('wp_enqueue_scripts', 'lsx_wc_scripts_add_styles'); |
|
| 49 | 49 | |
| 50 | 50 | endif; |
| 51 | 51 | |
| 52 | -if ( ! function_exists( 'lsx_wc_form_field_args' ) ) : |
|
| 52 | +if ( ! function_exists('lsx_wc_form_field_args')) : |
|
| 53 | 53 | |
| 54 | 54 | /** |
| 55 | 55 | * WooCommerce form fields. |
@@ -57,17 +57,17 @@ discard block |
||
| 57 | 57 | * @package lsx |
| 58 | 58 | * @subpackage woocommerce |
| 59 | 59 | */ |
| 60 | - function lsx_wc_form_field_args( $args, $key, $value ) { |
|
| 60 | + function lsx_wc_form_field_args($args, $key, $value) { |
|
| 61 | 61 | $args['input_class'][] = 'form-control'; |
| 62 | 62 | |
| 63 | 63 | return $args; |
| 64 | 64 | } |
| 65 | 65 | |
| 66 | - add_action( 'woocommerce_form_field_args', 'lsx_wc_form_field_args', 10, 3 ); |
|
| 66 | + add_action('woocommerce_form_field_args', 'lsx_wc_form_field_args', 10, 3); |
|
| 67 | 67 | |
| 68 | 68 | endif; |
| 69 | 69 | |
| 70 | -if ( ! function_exists( 'lsx_wc_theme_wrapper_start' ) ) : |
|
| 70 | +if ( ! function_exists('lsx_wc_theme_wrapper_start')) : |
|
| 71 | 71 | |
| 72 | 72 | /** |
| 73 | 73 | * WooCommerce wrapper start. |
@@ -77,18 +77,18 @@ discard block |
||
| 77 | 77 | */ |
| 78 | 78 | function lsx_wc_theme_wrapper_start() { |
| 79 | 79 | lsx_content_wrap_before(); |
| 80 | - echo '<div id="primary" class="content-area ' . esc_attr( lsx_main_class() ) . '">'; |
|
| 80 | + echo '<div id="primary" class="content-area ' . esc_attr(lsx_main_class()) . '">'; |
|
| 81 | 81 | lsx_content_before(); |
| 82 | 82 | echo '<main id="main" class="site-main" role="main">'; |
| 83 | 83 | lsx_content_top(); |
| 84 | 84 | } |
| 85 | 85 | |
| 86 | - remove_action( 'woocommerce_before_main_content', 'woocommerce_output_content_wrapper', 10 ); |
|
| 87 | - add_action( 'woocommerce_before_main_content', 'lsx_wc_theme_wrapper_start' ); |
|
| 86 | + remove_action('woocommerce_before_main_content', 'woocommerce_output_content_wrapper', 10); |
|
| 87 | + add_action('woocommerce_before_main_content', 'lsx_wc_theme_wrapper_start'); |
|
| 88 | 88 | |
| 89 | 89 | endif; |
| 90 | 90 | |
| 91 | -if ( ! function_exists( 'lsx_wc_theme_wrapper_end' ) ) : |
|
| 91 | +if ( ! function_exists('lsx_wc_theme_wrapper_end')) : |
|
| 92 | 92 | |
| 93 | 93 | /** |
| 94 | 94 | * WooCommerce wrapper end. |
@@ -104,12 +104,12 @@ discard block |
||
| 104 | 104 | lsx_content_wrap_after(); |
| 105 | 105 | } |
| 106 | 106 | |
| 107 | - remove_action( 'woocommerce_after_main_content', 'woocommerce_output_content_wrapper_end', 10 ); |
|
| 108 | - add_action( 'woocommerce_after_main_content', 'lsx_wc_theme_wrapper_end' ); |
|
| 107 | + remove_action('woocommerce_after_main_content', 'woocommerce_output_content_wrapper_end', 10); |
|
| 108 | + add_action('woocommerce_after_main_content', 'lsx_wc_theme_wrapper_end'); |
|
| 109 | 109 | |
| 110 | 110 | endif; |
| 111 | 111 | |
| 112 | -if ( ! function_exists( 'lsx_wc_disable_lsx_banner_plugin' ) ) : |
|
| 112 | +if ( ! function_exists('lsx_wc_disable_lsx_banner_plugin')) : |
|
| 113 | 113 | |
| 114 | 114 | /** |
| 115 | 115 | * Disable LSX Banners plugin in some WC pages. |
@@ -117,21 +117,21 @@ discard block |
||
| 117 | 117 | * @package lsx |
| 118 | 118 | * @subpackage woocommerce |
| 119 | 119 | */ |
| 120 | - function lsx_wc_disable_lsx_banner_plugin( $disabled ) { |
|
| 120 | + function lsx_wc_disable_lsx_banner_plugin($disabled) { |
|
| 121 | 121 | global $post; |
| 122 | 122 | |
| 123 | - if ( $post && class_exists( 'WC_Wishlists_Pages' ) && WC_Wishlists_Pages::is_wishlist_page( $post->post_name ) ) { |
|
| 123 | + if ($post && class_exists('WC_Wishlists_Pages') && WC_Wishlists_Pages::is_wishlist_page($post->post_name)) { |
|
| 124 | 124 | $disabled = true; |
| 125 | 125 | } |
| 126 | 126 | |
| 127 | 127 | return $disabled; |
| 128 | 128 | } |
| 129 | 129 | |
| 130 | - add_filter( 'lsx_banner_plugin_disable', 'lsx_wc_disable_lsx_banner_plugin' ); |
|
| 130 | + add_filter('lsx_banner_plugin_disable', 'lsx_wc_disable_lsx_banner_plugin'); |
|
| 131 | 131 | |
| 132 | 132 | endif; |
| 133 | 133 | |
| 134 | -if ( ! function_exists( 'lsx_wc_disable_lsx_banner' ) ) : |
|
| 134 | +if ( ! function_exists('lsx_wc_disable_lsx_banner')) : |
|
| 135 | 135 | |
| 136 | 136 | /** |
| 137 | 137 | * Disable LSX Banners banner in some WC pages. |
@@ -139,41 +139,41 @@ discard block |
||
| 139 | 139 | * @package lsx |
| 140 | 140 | * @subpackage woocommerce |
| 141 | 141 | */ |
| 142 | - function lsx_wc_disable_lsx_banner( $disabled ) { |
|
| 143 | - if ( is_shop() || is_product_category() || is_product_tag() || is_product() ) { |
|
| 142 | + function lsx_wc_disable_lsx_banner($disabled) { |
|
| 143 | + if (is_shop() || is_product_category() || is_product_tag() || is_product()) { |
|
| 144 | 144 | $disabled = true; |
| 145 | 145 | } |
| 146 | 146 | |
| 147 | 147 | return $disabled; |
| 148 | 148 | } |
| 149 | 149 | |
| 150 | - add_filter( 'lsx_banner_disable', 'lsx_wc_disable_lsx_banner' ); |
|
| 150 | + add_filter('lsx_banner_disable', 'lsx_wc_disable_lsx_banner'); |
|
| 151 | 151 | |
| 152 | 152 | endif; |
| 153 | 153 | |
| 154 | -if ( ! function_exists( 'lsx_wc_categories_breadcrumb_filter' ) ) : |
|
| 154 | +if ( ! function_exists('lsx_wc_categories_breadcrumb_filter')) : |
|
| 155 | 155 | /** |
| 156 | 156 | * Improves the category and taxonomy breadcrumbs for woocommerce. |
| 157 | 157 | * |
| 158 | 158 | * @package lsx |
| 159 | 159 | * @subpackage woocommerce |
| 160 | 160 | */ |
| 161 | - function lsx_wc_categories_breadcrumb_filter( $crumbs ) { |
|
| 161 | + function lsx_wc_categories_breadcrumb_filter($crumbs) { |
|
| 162 | 162 | |
| 163 | - $shop_page_url = get_permalink( wc_get_page_id( 'shop' ) ); |
|
| 163 | + $shop_page_url = get_permalink(wc_get_page_id('shop')); |
|
| 164 | 164 | |
| 165 | - if ( is_product_category() || is_product_tag() ) { |
|
| 165 | + if (is_product_category() || is_product_tag()) { |
|
| 166 | 166 | $new_crumbs = array(); |
| 167 | 167 | $new_crumbs[0] = $crumbs[0]; |
| 168 | 168 | |
| 169 | - if ( function_exists( 'woocommerce_breadcrumb' ) ) { |
|
| 169 | + if (function_exists('woocommerce_breadcrumb')) { |
|
| 170 | 170 | $new_crumbs[1] = array( |
| 171 | - 0 => __( 'Shop', 'lsx' ), |
|
| 171 | + 0 => __('Shop', 'lsx'), |
|
| 172 | 172 | 1 => $shop_page_url, |
| 173 | 173 | ); |
| 174 | 174 | } else { |
| 175 | 175 | $new_crumbs[1] = array( |
| 176 | - 'text' => __( 'Shop', 'lsx' ), |
|
| 176 | + 'text' => __('Shop', 'lsx'), |
|
| 177 | 177 | 'url' => $shop_page_url, |
| 178 | 178 | ); |
| 179 | 179 | } |
@@ -184,12 +184,12 @@ discard block |
||
| 184 | 184 | } |
| 185 | 185 | return $crumbs; |
| 186 | 186 | } |
| 187 | - add_filter( 'wpseo_breadcrumb_links', 'lsx_wc_categories_breadcrumb_filter', 30, 1 ); |
|
| 188 | - add_filter( 'woocommerce_get_breadcrumb', 'lsx_wc_categories_breadcrumb_filter', 30, 1 ); |
|
| 187 | + add_filter('wpseo_breadcrumb_links', 'lsx_wc_categories_breadcrumb_filter', 30, 1); |
|
| 188 | + add_filter('woocommerce_get_breadcrumb', 'lsx_wc_categories_breadcrumb_filter', 30, 1); |
|
| 189 | 189 | |
| 190 | 190 | endif; |
| 191 | 191 | |
| 192 | -if ( ! function_exists( 'lsx_wc_add_cart' ) ) : |
|
| 192 | +if ( ! function_exists('lsx_wc_add_cart')) : |
|
| 193 | 193 | |
| 194 | 194 | /** |
| 195 | 195 | * Adds WC cart to the header. |
@@ -197,34 +197,34 @@ discard block |
||
| 197 | 197 | * @package lsx |
| 198 | 198 | * @subpackage template-tags |
| 199 | 199 | */ |
| 200 | - function lsx_wc_add_cart( $items, $args ) { |
|
| 201 | - $cart_menu_item_position = apply_filters( 'lsx_wc_cart_menu_item_position', 'primary' ); |
|
| 200 | + function lsx_wc_add_cart($items, $args) { |
|
| 201 | + $cart_menu_item_position = apply_filters('lsx_wc_cart_menu_item_position', 'primary'); |
|
| 202 | 202 | |
| 203 | 203 | $cart_logged_out_position = $cart_menu_item_position . '_logged_out'; |
| 204 | 204 | |
| 205 | - if ( $cart_menu_item_position === $args->theme_location || $cart_logged_out_position === $args->theme_location ) { |
|
| 206 | - $customizer_option = get_theme_mod( 'lsx_header_wc_cart', false ); |
|
| 205 | + if ($cart_menu_item_position === $args->theme_location || $cart_logged_out_position === $args->theme_location) { |
|
| 206 | + $customizer_option = get_theme_mod('lsx_header_wc_cart', false); |
|
| 207 | 207 | |
| 208 | - if ( ! empty( $customizer_option ) ) { |
|
| 208 | + if ( ! empty($customizer_option)) { |
|
| 209 | 209 | ob_start(); |
| 210 | - the_widget( 'WC_Widget_Cart', 'title=' ); |
|
| 210 | + the_widget('WC_Widget_Cart', 'title='); |
|
| 211 | 211 | $widget = ob_get_clean(); |
| 212 | 212 | |
| 213 | - if ( is_cart() ) { |
|
| 213 | + if (is_cart()) { |
|
| 214 | 214 | $class = 'current-menu-item'; |
| 215 | 215 | } else { |
| 216 | 216 | $class = ''; |
| 217 | 217 | } |
| 218 | 218 | |
| 219 | 219 | $item_class = 'menu-item menu-item-type-custom menu-item-object-custom menu-item-has-children dropdown lsx-wc-cart-menu-item ' . $class; |
| 220 | - $item_class = apply_filters( 'lsx_wc_cart_menu_item_class', $item_class ); |
|
| 220 | + $item_class = apply_filters('lsx_wc_cart_menu_item_class', $item_class); |
|
| 221 | 221 | |
| 222 | 222 | $item = '<li class="' . $item_class . '">' . |
| 223 | - '<a title="' . esc_attr__( 'View your shopping cart', 'lsx' ) . '" href="' . esc_url( wc_get_cart_url() ) . '" data-toggle="dropdown" class="dropdown-toggle" aria-haspopup="true">' . |
|
| 224 | - '<span class="lsx-wc-cart-amount">' . wp_kses_data( WC()->cart->get_cart_subtotal() ) . '</span>' . |
|
| 223 | + '<a title="' . esc_attr__('View your shopping cart', 'lsx') . '" href="' . esc_url(wc_get_cart_url()) . '" data-toggle="dropdown" class="dropdown-toggle" aria-haspopup="true">' . |
|
| 224 | + '<span class="lsx-wc-cart-amount">' . wp_kses_data(WC()->cart->get_cart_subtotal()) . '</span>' . |
|
| 225 | 225 | /* Translators: %s: items quantity */ |
| 226 | - '<span class="lsx-wc-cart-count">' . wp_kses_data( sprintf( _n( '%d item', '%d items', WC()->cart->get_cart_contents_count(), 'lsx' ), WC()->cart->get_cart_contents_count() ) ) . '</span>' . |
|
| 227 | - ( ! empty( WC()->cart->get_cart_contents_count() ) ? '<span class="lsx-wc-cart-count-badge">' . wp_kses_data( WC()->cart->get_cart_contents_count() ) . '</span>' : '' ) . |
|
| 226 | + '<span class="lsx-wc-cart-count">' . wp_kses_data(sprintf(_n('%d item', '%d items', WC()->cart->get_cart_contents_count(), 'lsx'), WC()->cart->get_cart_contents_count())) . '</span>' . |
|
| 227 | + ( ! empty(WC()->cart->get_cart_contents_count()) ? '<span class="lsx-wc-cart-count-badge">' . wp_kses_data(WC()->cart->get_cart_contents_count()) . '</span>' : '') . |
|
| 228 | 228 | '</a>' . |
| 229 | 229 | '<ul role="menu" class=" dropdown-menu lsx-wc-cart-sub-menu">' . |
| 230 | 230 | '<li>' . |
@@ -233,7 +233,7 @@ discard block |
||
| 233 | 233 | '</ul>' . |
| 234 | 234 | '</li>'; |
| 235 | 235 | |
| 236 | - if ( 'top-menu' === $args->theme_location ) { |
|
| 236 | + if ('top-menu' === $args->theme_location) { |
|
| 237 | 237 | $items = $item . $items; |
| 238 | 238 | } else { |
| 239 | 239 | $items = $items . $item; |
@@ -244,11 +244,11 @@ discard block |
||
| 244 | 244 | return $items; |
| 245 | 245 | } |
| 246 | 246 | |
| 247 | - add_filter( 'wp_nav_menu_items', 'lsx_wc_add_cart', 10, 2 ); |
|
| 247 | + add_filter('wp_nav_menu_items', 'lsx_wc_add_cart', 10, 2); |
|
| 248 | 248 | |
| 249 | 249 | endif; |
| 250 | 250 | |
| 251 | -if ( ! function_exists( 'lsx_wc_products_widget_wrapper_before' ) ) : |
|
| 251 | +if ( ! function_exists('lsx_wc_products_widget_wrapper_before')) : |
|
| 252 | 252 | |
| 253 | 253 | /** |
| 254 | 254 | * Change WC products widget wrapper (before). |
@@ -256,16 +256,16 @@ discard block |
||
| 256 | 256 | * @package lsx |
| 257 | 257 | * @subpackage woocommerce |
| 258 | 258 | */ |
| 259 | - function lsx_wc_products_widget_wrapper_before( $html ) { |
|
| 259 | + function lsx_wc_products_widget_wrapper_before($html) { |
|
| 260 | 260 | $html = '<div class="lsx-woocommerce-slider lsx-woocommerce-shortcode">'; |
| 261 | 261 | return $html; |
| 262 | 262 | } |
| 263 | 263 | |
| 264 | - add_filter( 'woocommerce_before_widget_product_list', 'lsx_wc_products_widget_wrapper_before', 15 ); |
|
| 264 | + add_filter('woocommerce_before_widget_product_list', 'lsx_wc_products_widget_wrapper_before', 15); |
|
| 265 | 265 | |
| 266 | 266 | endif; |
| 267 | 267 | |
| 268 | -if ( ! function_exists( 'lsx_wc_products_widget_wrapper_after' ) ) : |
|
| 268 | +if ( ! function_exists('lsx_wc_products_widget_wrapper_after')) : |
|
| 269 | 269 | |
| 270 | 270 | /** |
| 271 | 271 | * Change WC products widget wrapper (after). |
@@ -273,16 +273,16 @@ discard block |
||
| 273 | 273 | * @package lsx |
| 274 | 274 | * @subpackage woocommerce |
| 275 | 275 | */ |
| 276 | - function lsx_wc_products_widget_wrapper_after( $html ) { |
|
| 276 | + function lsx_wc_products_widget_wrapper_after($html) { |
|
| 277 | 277 | $html = '</div>'; |
| 278 | 278 | return $html; |
| 279 | 279 | } |
| 280 | 280 | |
| 281 | - add_filter( 'woocommerce_after_widget_product_list', 'lsx_wc_products_widget_wrapper_after', 15 ); |
|
| 281 | + add_filter('woocommerce_after_widget_product_list', 'lsx_wc_products_widget_wrapper_after', 15); |
|
| 282 | 282 | |
| 283 | 283 | endif; |
| 284 | 284 | |
| 285 | -if ( ! function_exists( 'lsx_wc_reviews_widget_override' ) ) : |
|
| 285 | +if ( ! function_exists('lsx_wc_reviews_widget_override')) : |
|
| 286 | 286 | |
| 287 | 287 | /** |
| 288 | 288 | * Override WC ewviews widget. |
@@ -291,18 +291,18 @@ discard block |
||
| 291 | 291 | * @subpackage woocommerce |
| 292 | 292 | */ |
| 293 | 293 | function lsx_wc_reviews_widget_override() { |
| 294 | - if ( class_exists( 'WC_Widget_Recent_Reviews' ) ) { |
|
| 295 | - unregister_widget( 'WC_Widget_Recent_Reviews' ); |
|
| 294 | + if (class_exists('WC_Widget_Recent_Reviews')) { |
|
| 295 | + unregister_widget('WC_Widget_Recent_Reviews'); |
|
| 296 | 296 | require get_template_directory() . '/includes/classes/class-lsx-wc-widget-recent-reviews.php'; |
| 297 | - register_widget( 'LSX_WC_Widget_Recent_Reviews' ); |
|
| 297 | + register_widget('LSX_WC_Widget_Recent_Reviews'); |
|
| 298 | 298 | } |
| 299 | 299 | } |
| 300 | 300 | |
| 301 | - add_action( 'widgets_init', 'lsx_wc_reviews_widget_override', 15 ); |
|
| 301 | + add_action('widgets_init', 'lsx_wc_reviews_widget_override', 15); |
|
| 302 | 302 | |
| 303 | 303 | endif; |
| 304 | 304 | |
| 305 | -if ( ! function_exists( 'lsx_wc_change_price_html' ) ) : |
|
| 305 | +if ( ! function_exists('lsx_wc_change_price_html')) : |
|
| 306 | 306 | |
| 307 | 307 | /** |
| 308 | 308 | * Change WC ZERO price to "free". |
@@ -314,30 +314,30 @@ discard block |
||
| 314 | 314 | * @param $product WC_Product |
| 315 | 315 | * @return string |
| 316 | 316 | */ |
| 317 | - function lsx_wc_change_price_html( $price, $product ) { |
|
| 318 | - if ( empty( $product->get_price() ) ) { |
|
| 319 | - if ( $product->is_on_sale() && $product->get_regular_price() ) { |
|
| 320 | - $regular_price = wc_get_price_to_display( $product, |
|
| 317 | + function lsx_wc_change_price_html($price, $product) { |
|
| 318 | + if (empty($product->get_price())) { |
|
| 319 | + if ($product->is_on_sale() && $product->get_regular_price()) { |
|
| 320 | + $regular_price = wc_get_price_to_display($product, |
|
| 321 | 321 | array( |
| 322 | 322 | 'qty' => 1, |
| 323 | 323 | 'price' => $product->get_regular_price(), |
| 324 | 324 | ) |
| 325 | 325 | ); |
| 326 | 326 | |
| 327 | - $price = wc_format_price_range( $regular_price, esc_html__( 'Free!', 'lsx' ) ); |
|
| 327 | + $price = wc_format_price_range($regular_price, esc_html__('Free!', 'lsx')); |
|
| 328 | 328 | } else { |
| 329 | - $price = '<span class="amount">' . esc_html__( 'Free!', 'lsx' ) . '</span>'; |
|
| 329 | + $price = '<span class="amount">' . esc_html__('Free!', 'lsx') . '</span>'; |
|
| 330 | 330 | } |
| 331 | 331 | } |
| 332 | 332 | |
| 333 | 333 | return $price; |
| 334 | 334 | } |
| 335 | 335 | |
| 336 | - add_filter( 'woocommerce_get_price_html', 'lsx_wc_change_price_html', 15, 2 ); |
|
| 336 | + add_filter('woocommerce_get_price_html', 'lsx_wc_change_price_html', 15, 2); |
|
| 337 | 337 | |
| 338 | 338 | endif; |
| 339 | 339 | |
| 340 | -if ( ! function_exists( 'lsx_wc_cart_link_fragment' ) ) : |
|
| 340 | +if ( ! function_exists('lsx_wc_cart_link_fragment')) : |
|
| 341 | 341 | |
| 342 | 342 | /** |
| 343 | 343 | * Cart Fragments. |
@@ -346,7 +346,7 @@ discard block |
||
| 346 | 346 | * @package lsx |
| 347 | 347 | * @subpackage woocommerce |
| 348 | 348 | */ |
| 349 | - function lsx_wc_cart_link_fragment( $fragments ) { |
|
| 349 | + function lsx_wc_cart_link_fragment($fragments) { |
|
| 350 | 350 | global $woocommerce; |
| 351 | 351 | |
| 352 | 352 | ob_start(); |
@@ -357,8 +357,8 @@ discard block |
||
| 357 | 357 | lsx_wc_items_counter(); |
| 358 | 358 | $items_counter = ob_get_clean(); |
| 359 | 359 | |
| 360 | - if ( ! empty( $items_counter ) ) { |
|
| 361 | - $fragments['div.widget_shopping_cart_content'] = preg_replace( '/(.+)(<\/ul>)[\s\n]*(<p class="woocommerce-mini-cart__total)(.+)/', '$1' . $items_counter . '$2$3$4', $fragments['div.widget_shopping_cart_content'] ); |
|
| 360 | + if ( ! empty($items_counter)) { |
|
| 361 | + $fragments['div.widget_shopping_cart_content'] = preg_replace('/(.+)(<\/ul>)[\s\n]*(<p class="woocommerce-mini-cart__total)(.+)/', '$1' . $items_counter . '$2$3$4', $fragments['div.widget_shopping_cart_content']); |
|
| 362 | 362 | } |
| 363 | 363 | |
| 364 | 364 | return $fragments; |
@@ -366,7 +366,7 @@ discard block |
||
| 366 | 366 | |
| 367 | 367 | endif; |
| 368 | 368 | |
| 369 | -if ( ! function_exists( 'lsx_wc_cart_link' ) ) : |
|
| 369 | +if ( ! function_exists('lsx_wc_cart_link')) : |
|
| 370 | 370 | |
| 371 | 371 | /** |
| 372 | 372 | * Cart Link. |
@@ -377,14 +377,14 @@ discard block |
||
| 377 | 377 | */ |
| 378 | 378 | function lsx_wc_cart_link() { |
| 379 | 379 | ?> |
| 380 | - <a title="<?php esc_attr_e( 'View your shopping cart', 'lsx' ); ?>" href="<?php echo esc_url( wc_get_cart_url() ); ?>" data-toggle="dropdown" class="dropdown-toggle" aria-haspopup="true"> |
|
| 381 | - <span class="lsx-wc-cart-amount"><?php echo wp_kses_data( WC()->cart->get_cart_subtotal() ); ?></span> |
|
| 380 | + <a title="<?php esc_attr_e('View your shopping cart', 'lsx'); ?>" href="<?php echo esc_url(wc_get_cart_url()); ?>" data-toggle="dropdown" class="dropdown-toggle" aria-haspopup="true"> |
|
| 381 | + <span class="lsx-wc-cart-amount"><?php echo wp_kses_data(WC()->cart->get_cart_subtotal()); ?></span> |
|
| 382 | 382 | |
| 383 | 383 | <?php /* Translators: %s: items quantity */ ?> |
| 384 | - <span class="lsx-wc-cart-count"><?php echo wp_kses_data( sprintf( _n( '%d item', '%d items', WC()->cart->get_cart_contents_count(), 'lsx' ), WC()->cart->get_cart_contents_count() ) ); ?></span> |
|
| 384 | + <span class="lsx-wc-cart-count"><?php echo wp_kses_data(sprintf(_n('%d item', '%d items', WC()->cart->get_cart_contents_count(), 'lsx'), WC()->cart->get_cart_contents_count())); ?></span> |
|
| 385 | 385 | |
| 386 | - <?php if ( ! empty( WC()->cart->get_cart_contents_count() ) ) : ?> |
|
| 387 | - <span class="lsx-wc-cart-count-badge"><?php echo wp_kses_data( WC()->cart->get_cart_contents_count() ); ?></span> |
|
| 386 | + <?php if ( ! empty(WC()->cart->get_cart_contents_count())) : ?> |
|
| 387 | + <span class="lsx-wc-cart-count-badge"><?php echo wp_kses_data(WC()->cart->get_cart_contents_count()); ?></span> |
|
| 388 | 388 | <?php endif; ?> |
| 389 | 389 | </a> |
| 390 | 390 | <?php |
@@ -392,7 +392,7 @@ discard block |
||
| 392 | 392 | |
| 393 | 393 | endif; |
| 394 | 394 | |
| 395 | -if ( ! function_exists( 'lsx_wc_items_counter' ) ) : |
|
| 395 | +if ( ! function_exists('lsx_wc_items_counter')) : |
|
| 396 | 396 | |
| 397 | 397 | /** |
| 398 | 398 | * Add car item hidden items counter. |
@@ -404,21 +404,21 @@ discard block |
||
| 404 | 404 | $count = (int) WC()->cart->get_cart_contents_count(); |
| 405 | 405 | $items_counter = ''; |
| 406 | 406 | |
| 407 | - if ( ! empty( $count ) ) { |
|
| 407 | + if ( ! empty($count)) { |
|
| 408 | 408 | $count -= 3; |
| 409 | 409 | |
| 410 | - if ( 1 === $count ) { |
|
| 411 | - $items_counter = esc_html__( '1 other item in cart', 'lsx' ); |
|
| 412 | - } elseif ( $count > 1 ) { |
|
| 410 | + if (1 === $count) { |
|
| 411 | + $items_counter = esc_html__('1 other item in cart', 'lsx'); |
|
| 412 | + } elseif ($count > 1) { |
|
| 413 | 413 | /* Translators: %s: items counter */ |
| 414 | - $items_counter = sprintf( esc_html__( '%s other items in cart', 'lsx' ), $count ); |
|
| 414 | + $items_counter = sprintf(esc_html__('%s other items in cart', 'lsx'), $count); |
|
| 415 | 415 | } |
| 416 | 416 | } |
| 417 | - $cart_url = function_exists( 'wc_get_cart_url' ) ? wc_get_cart_url() : WC()->cart->get_cart_url(); |
|
| 418 | - if ( ! empty( $items_counter ) ) : |
|
| 417 | + $cart_url = function_exists('wc_get_cart_url') ? wc_get_cart_url() : WC()->cart->get_cart_url(); |
|
| 418 | + if ( ! empty($items_counter)) : |
|
| 419 | 419 | ?> |
| 420 | 420 | <li class="woocommerce-mini-cart-item mini_cart_item" style="display: block;"> |
| 421 | - <a href="<?php echo esc_url( $cart_url ); ?>"><?php echo esc_html( $items_counter ); ?></a> |
|
| 421 | + <a href="<?php echo esc_url($cart_url); ?>"><?php echo esc_html($items_counter); ?></a> |
|
| 422 | 422 | </li> |
| 423 | 423 | <?php |
| 424 | 424 | endif; |
@@ -426,7 +426,7 @@ discard block |
||
| 426 | 426 | |
| 427 | 427 | endif; |
| 428 | 428 | |
| 429 | -if ( ! function_exists( 'lsx_wc_loop_shop_per_page' ) ) : |
|
| 429 | +if ( ! function_exists('lsx_wc_loop_shop_per_page')) : |
|
| 430 | 430 | |
| 431 | 431 | /** |
| 432 | 432 | * Changes the number of products to display on shop. |
@@ -434,16 +434,16 @@ discard block |
||
| 434 | 434 | * @package lsx |
| 435 | 435 | * @subpackage woocommerce |
| 436 | 436 | */ |
| 437 | - function lsx_wc_loop_shop_per_page( $items ) { |
|
| 437 | + function lsx_wc_loop_shop_per_page($items) { |
|
| 438 | 438 | $items = 12; |
| 439 | 439 | return $items; |
| 440 | 440 | } |
| 441 | 441 | |
| 442 | - add_filter( 'loop_shop_per_page', 'lsx_wc_loop_shop_per_page', 20 ); |
|
| 442 | + add_filter('loop_shop_per_page', 'lsx_wc_loop_shop_per_page', 20); |
|
| 443 | 443 | |
| 444 | 444 | endif; |
| 445 | 445 | |
| 446 | -if ( ! function_exists( 'lsx_wc_add_to_cart_message_html' ) ) : |
|
| 446 | +if ( ! function_exists('lsx_wc_add_to_cart_message_html')) : |
|
| 447 | 447 | |
| 448 | 448 | /** |
| 449 | 449 | * Changes the "added to cart" message HTML. |
@@ -451,39 +451,39 @@ discard block |
||
| 451 | 451 | * @package lsx |
| 452 | 452 | * @subpackage woocommerce |
| 453 | 453 | */ |
| 454 | - function lsx_wc_add_to_cart_message_html( $message, $products ) { |
|
| 454 | + function lsx_wc_add_to_cart_message_html($message, $products) { |
|
| 455 | 455 | $message = '<div class="woocommerce-message-added-to-cart">' . $message . '</div>'; |
| 456 | 456 | return $message; |
| 457 | 457 | } |
| 458 | 458 | |
| 459 | - add_filter( 'wc_add_to_cart_message_html', 'lsx_wc_add_to_cart_message_html', 20, 2 ); |
|
| 459 | + add_filter('wc_add_to_cart_message_html', 'lsx_wc_add_to_cart_message_html', 20, 2); |
|
| 460 | 460 | |
| 461 | 461 | endif; |
| 462 | 462 | |
| 463 | -if ( defined( 'WC_VERSION' ) && version_compare( WC_VERSION, '2.3', '>=' ) ) { |
|
| 464 | - add_filter( 'woocommerce_add_to_cart_fragments', 'lsx_wc_cart_link_fragment' ); |
|
| 463 | +if (defined('WC_VERSION') && version_compare(WC_VERSION, '2.3', '>=')) { |
|
| 464 | + add_filter('woocommerce_add_to_cart_fragments', 'lsx_wc_cart_link_fragment'); |
|
| 465 | 465 | } else { |
| 466 | - add_filter( 'add_to_cart_fragments', 'lsx_wc_cart_link_fragment' ); |
|
| 466 | + add_filter('add_to_cart_fragments', 'lsx_wc_cart_link_fragment'); |
|
| 467 | 467 | } |
| 468 | 468 | |
| 469 | -remove_action( 'woocommerce_after_shop_loop', 'woocommerce_pagination', 10 ); |
|
| 469 | +remove_action('woocommerce_after_shop_loop', 'woocommerce_pagination', 10); |
|
| 470 | 470 | |
| 471 | -add_action( 'woocommerce_after_shop_loop', 'lsx_wc_sorting_wrapper', 9 ); |
|
| 472 | -add_action( 'woocommerce_after_shop_loop', 'woocommerce_catalog_ordering', 10 ); |
|
| 473 | -add_action( 'woocommerce_after_shop_loop', 'woocommerce_result_count', 20 ); |
|
| 474 | -add_action( 'woocommerce_after_shop_loop', 'woocommerce_pagination', 30 ); |
|
| 475 | -add_action( 'woocommerce_after_shop_loop', 'lsx_wc_sorting_wrapper_close', 31 ); |
|
| 471 | +add_action('woocommerce_after_shop_loop', 'lsx_wc_sorting_wrapper', 9); |
|
| 472 | +add_action('woocommerce_after_shop_loop', 'woocommerce_catalog_ordering', 10); |
|
| 473 | +add_action('woocommerce_after_shop_loop', 'woocommerce_result_count', 20); |
|
| 474 | +add_action('woocommerce_after_shop_loop', 'woocommerce_pagination', 30); |
|
| 475 | +add_action('woocommerce_after_shop_loop', 'lsx_wc_sorting_wrapper_close', 31); |
|
| 476 | 476 | |
| 477 | -remove_action( 'woocommerce_before_shop_loop', 'woocommerce_result_count', 20 ); |
|
| 478 | -remove_action( 'woocommerce_before_shop_loop', 'woocommerce_catalog_ordering', 30 ); |
|
| 477 | +remove_action('woocommerce_before_shop_loop', 'woocommerce_result_count', 20); |
|
| 478 | +remove_action('woocommerce_before_shop_loop', 'woocommerce_catalog_ordering', 30); |
|
| 479 | 479 | |
| 480 | -add_action( 'woocommerce_before_shop_loop', 'lsx_wc_sorting_wrapper', 9 ); |
|
| 481 | -add_action( 'woocommerce_before_shop_loop', 'woocommerce_catalog_ordering', 10 ); |
|
| 482 | -add_action( 'woocommerce_before_shop_loop', 'woocommerce_result_count', 20 ); |
|
| 483 | -add_action( 'woocommerce_before_shop_loop', 'lsx_wc_woocommerce_pagination', 30 ); |
|
| 484 | -add_action( 'woocommerce_before_shop_loop', 'lsx_wc_sorting_wrapper_close', 31 ); |
|
| 480 | +add_action('woocommerce_before_shop_loop', 'lsx_wc_sorting_wrapper', 9); |
|
| 481 | +add_action('woocommerce_before_shop_loop', 'woocommerce_catalog_ordering', 10); |
|
| 482 | +add_action('woocommerce_before_shop_loop', 'woocommerce_result_count', 20); |
|
| 483 | +add_action('woocommerce_before_shop_loop', 'lsx_wc_woocommerce_pagination', 30); |
|
| 484 | +add_action('woocommerce_before_shop_loop', 'lsx_wc_sorting_wrapper_close', 31); |
|
| 485 | 485 | |
| 486 | -if ( ! function_exists( 'lsx_wc_sorting_wrapper' ) ) : |
|
| 486 | +if ( ! function_exists('lsx_wc_sorting_wrapper')) : |
|
| 487 | 487 | |
| 488 | 488 | /** |
| 489 | 489 | * Sorting wrapper. |
@@ -497,7 +497,7 @@ discard block |
||
| 497 | 497 | |
| 498 | 498 | endif; |
| 499 | 499 | |
| 500 | -if ( ! function_exists( 'lsx_wc_sorting_wrapper_close' ) ) : |
|
| 500 | +if ( ! function_exists('lsx_wc_sorting_wrapper_close')) : |
|
| 501 | 501 | |
| 502 | 502 | /** |
| 503 | 503 | * Sorting wrapper close. |
@@ -511,7 +511,7 @@ discard block |
||
| 511 | 511 | |
| 512 | 512 | endif; |
| 513 | 513 | |
| 514 | -if ( ! function_exists( 'lsx_wc_product_columns_wrapper_close' ) ) : |
|
| 514 | +if ( ! function_exists('lsx_wc_product_columns_wrapper_close')) : |
|
| 515 | 515 | |
| 516 | 516 | /** |
| 517 | 517 | * Product columns wrapper close. |
@@ -525,7 +525,7 @@ discard block |
||
| 525 | 525 | |
| 526 | 526 | endif; |
| 527 | 527 | |
| 528 | -if ( ! function_exists( 'lsx_wc_woocommerce_pagination' ) ) : |
|
| 528 | +if ( ! function_exists('lsx_wc_woocommerce_pagination')) : |
|
| 529 | 529 | |
| 530 | 530 | /** |
| 531 | 531 | * LSX WooCommerce Pagination |
@@ -537,14 +537,14 @@ discard block |
||
| 537 | 537 | * @subpackage woocommerce |
| 538 | 538 | */ |
| 539 | 539 | function lsx_wc_woocommerce_pagination() { |
| 540 | - if ( woocommerce_products_will_display() ) { |
|
| 540 | + if (woocommerce_products_will_display()) { |
|
| 541 | 541 | woocommerce_pagination(); |
| 542 | 542 | } |
| 543 | 543 | } |
| 544 | 544 | |
| 545 | 545 | endif; |
| 546 | 546 | |
| 547 | -if ( ! function_exists( 'lsx_customizer_wc_controls' ) ) : |
|
| 547 | +if ( ! function_exists('lsx_customizer_wc_controls')) : |
|
| 548 | 548 | |
| 549 | 549 | /** |
| 550 | 550 | * Returns an array of the core panel. |
@@ -554,10 +554,10 @@ discard block |
||
| 554 | 554 | * |
| 555 | 555 | * @return $lsx_controls array() |
| 556 | 556 | */ |
| 557 | - function lsx_customizer_wc_controls( $lsx_controls ) { |
|
| 557 | + function lsx_customizer_wc_controls($lsx_controls) { |
|
| 558 | 558 | $lsx_controls['panels']['lsx-wc'] = array( |
| 559 | - 'title' => esc_html__( 'WooCommerce', 'lsx' ), |
|
| 560 | - 'description' => esc_html__( 'Change the WooCommerce settings.', 'lsx' ), |
|
| 559 | + 'title' => esc_html__('WooCommerce', 'lsx'), |
|
| 560 | + 'description' => esc_html__('Change the WooCommerce settings.', 'lsx'), |
|
| 561 | 561 | 'priority' => 23, |
| 562 | 562 | ); |
| 563 | 563 | |
@@ -566,8 +566,8 @@ discard block |
||
| 566 | 566 | */ |
| 567 | 567 | |
| 568 | 568 | $lsx_controls['sections']['lsx-wc-global'] = array( |
| 569 | - 'title' => esc_html__( 'Global', 'lsx' ), |
|
| 570 | - 'description' => esc_html__( 'Change the WooCommerce global settings.', 'lsx' ), |
|
| 569 | + 'title' => esc_html__('Global', 'lsx'), |
|
| 570 | + 'description' => esc_html__('Change the WooCommerce global settings.', 'lsx'), |
|
| 571 | 571 | 'panel' => 'lsx-wc', |
| 572 | 572 | 'priority' => 1, |
| 573 | 573 | ); |
@@ -578,8 +578,8 @@ discard block |
||
| 578 | 578 | ); |
| 579 | 579 | |
| 580 | 580 | $lsx_controls['fields']['lsx_wc_mobile_footer_bar_status'] = array( |
| 581 | - 'label' => esc_html__( 'Footer Bar', 'lsx' ), |
|
| 582 | - 'description' => esc_html__( 'Enable the mobile footer bar.', 'lsx' ), |
|
| 581 | + 'label' => esc_html__('Footer Bar', 'lsx'), |
|
| 582 | + 'description' => esc_html__('Enable the mobile footer bar.', 'lsx'), |
|
| 583 | 583 | 'section' => 'lsx-wc-global', |
| 584 | 584 | 'type' => 'checkbox', |
| 585 | 585 | 'priority' => 1, |
@@ -590,8 +590,8 @@ discard block |
||
| 590 | 590 | */ |
| 591 | 591 | |
| 592 | 592 | $lsx_controls['sections']['lsx-wc-cart'] = array( |
| 593 | - 'title' => esc_html__( 'Cart', 'lsx' ), |
|
| 594 | - 'description' => esc_html__( 'Change the WooCommerce cart settings.', 'lsx' ), |
|
| 593 | + 'title' => esc_html__('Cart', 'lsx'), |
|
| 594 | + 'description' => esc_html__('Change the WooCommerce cart settings.', 'lsx'), |
|
| 595 | 595 | 'panel' => 'lsx-wc', |
| 596 | 596 | 'priority' => 2, |
| 597 | 597 | ); |
@@ -602,8 +602,8 @@ discard block |
||
| 602 | 602 | ); |
| 603 | 603 | |
| 604 | 604 | $lsx_controls['fields']['lsx_header_wc_cart'] = array( |
| 605 | - 'label' => esc_html__( 'Menu Item', 'lsx' ), |
|
| 606 | - 'description' => esc_html__( 'Enable the cart menu item.', 'lsx' ), |
|
| 605 | + 'label' => esc_html__('Menu Item', 'lsx'), |
|
| 606 | + 'description' => esc_html__('Enable the cart menu item.', 'lsx'), |
|
| 607 | 607 | 'section' => 'lsx-wc-cart', |
| 608 | 608 | 'type' => 'checkbox', |
| 609 | 609 | 'priority' => 1, |
@@ -612,11 +612,11 @@ discard block |
||
| 612 | 612 | return $lsx_controls; |
| 613 | 613 | } |
| 614 | 614 | |
| 615 | - add_filter( 'lsx_customizer_controls', 'lsx_customizer_wc_controls' ); |
|
| 615 | + add_filter('lsx_customizer_controls', 'lsx_customizer_wc_controls'); |
|
| 616 | 616 | |
| 617 | 617 | endif; |
| 618 | 618 | |
| 619 | -if ( ! function_exists( 'lsx_wc_global_header_title' ) ) : |
|
| 619 | +if ( ! function_exists('lsx_wc_global_header_title')) : |
|
| 620 | 620 | |
| 621 | 621 | /** |
| 622 | 622 | * Move the shop title into the global header |
@@ -624,21 +624,21 @@ discard block |
||
| 624 | 624 | * @package lsx |
| 625 | 625 | * @subpackage the-events-calendar |
| 626 | 626 | */ |
| 627 | - function lsx_wc_global_header_title( $title ) { |
|
| 627 | + function lsx_wc_global_header_title($title) { |
|
| 628 | 628 | |
| 629 | - if ( is_woocommerce() && is_shop() ) { |
|
| 629 | + if (is_woocommerce() && is_shop()) { |
|
| 630 | 630 | |
| 631 | - $title = __( 'Shop', 'lsx' ); |
|
| 631 | + $title = __('Shop', 'lsx'); |
|
| 632 | 632 | } |
| 633 | 633 | |
| 634 | 634 | return $title; |
| 635 | 635 | } |
| 636 | - add_filter( 'lsx_global_header_title', 'lsx_wc_global_header_title', 200, 1 ); |
|
| 636 | + add_filter('lsx_global_header_title', 'lsx_wc_global_header_title', 200, 1); |
|
| 637 | 637 | |
| 638 | 638 | endif; |
| 639 | 639 | |
| 640 | 640 | |
| 641 | -if ( ! function_exists( 'lsx_wc_footer_bar' ) ) : |
|
| 641 | +if ( ! function_exists('lsx_wc_footer_bar')) : |
|
| 642 | 642 | |
| 643 | 643 | /** |
| 644 | 644 | * Display WC footer bar. |
@@ -647,47 +647,47 @@ discard block |
||
| 647 | 647 | * @subpackage woocommerce |
| 648 | 648 | */ |
| 649 | 649 | function lsx_wc_footer_bar() { |
| 650 | - $cart_url = function_exists( 'wc_get_cart_url' ) ? wc_get_cart_url() : WC()->cart->get_cart_url(); |
|
| 651 | - if ( ! empty( get_theme_mod( 'lsx_wc_mobile_footer_bar_status', '1' ) ) ) : |
|
| 650 | + $cart_url = function_exists('wc_get_cart_url') ? wc_get_cart_url() : WC()->cart->get_cart_url(); |
|
| 651 | + if ( ! empty(get_theme_mod('lsx_wc_mobile_footer_bar_status', '1'))) : |
|
| 652 | 652 | ?> |
| 653 | 653 | <div class="lsx-wc-footer-bar"> |
| 654 | - <form role="search" method="get" action="<?php echo esc_url( home_url() ); ?>" class="lsx-wc-footer-bar-form"> |
|
| 654 | + <form role="search" method="get" action="<?php echo esc_url(home_url()); ?>" class="lsx-wc-footer-bar-form"> |
|
| 655 | 655 | <fieldset> |
| 656 | - <legend class="screen-reader-text"><?php esc_html_e( 'Search products', 'lsx' ); ?></legend> |
|
| 657 | - <input type="search" name="s" placeholder="<?php esc_attr_e( 'Search products...', 'lsx' ); ?>" class="form-control"> |
|
| 656 | + <legend class="screen-reader-text"><?php esc_html_e('Search products', 'lsx'); ?></legend> |
|
| 657 | + <input type="search" name="s" placeholder="<?php esc_attr_e('Search products...', 'lsx'); ?>" class="form-control"> |
|
| 658 | 658 | </fieldset> |
| 659 | 659 | </form> |
| 660 | 660 | |
| 661 | 661 | <ul class="lsx-wc-footer-bar-items"> |
| 662 | 662 | <li class="lsx-wc-footer-bar-item"> |
| 663 | - <a href="<?php echo esc_url( home_url() ); ?>" class="lsx-wc-footer-bar-link"> |
|
| 663 | + <a href="<?php echo esc_url(home_url()); ?>" class="lsx-wc-footer-bar-link"> |
|
| 664 | 664 | <i class="fa fa-home" aria-hidden="true"></i> |
| 665 | - <span><?php esc_html_e( 'Home', 'lsx' ); ?></span> |
|
| 665 | + <span><?php esc_html_e('Home', 'lsx'); ?></span> |
|
| 666 | 666 | </a> |
| 667 | 667 | </li> |
| 668 | 668 | |
| 669 | 669 | <li class="lsx-wc-footer-bar-item"> |
| 670 | - <a href="<?php echo esc_url( get_permalink( get_option( 'woocommerce_myaccount_page_id' ) ) ); ?>" class="lsx-wc-footer-bar-link"> |
|
| 670 | + <a href="<?php echo esc_url(get_permalink(get_option('woocommerce_myaccount_page_id'))); ?>" class="lsx-wc-footer-bar-link"> |
|
| 671 | 671 | <i class="fa fa-user" aria-hidden="true"></i> |
| 672 | - <span><?php esc_html_e( 'Account', 'lsx' ); ?></span> |
|
| 672 | + <span><?php esc_html_e('Account', 'lsx'); ?></span> |
|
| 673 | 673 | </a> |
| 674 | 674 | </li> |
| 675 | 675 | |
| 676 | 676 | <li class="lsx-wc-footer-bar-item"> |
| 677 | 677 | <a href="#" class="lsx-wc-footer-bar-link lsx-wc-footer-bar-link-toogle"> |
| 678 | 678 | <i class="fa fa-search" aria-hidden="true"></i> |
| 679 | - <span><?php esc_html_e( 'Search', 'lsx' ); ?></span> |
|
| 679 | + <span><?php esc_html_e('Search', 'lsx'); ?></span> |
|
| 680 | 680 | </a> |
| 681 | 681 | </li> |
| 682 | 682 | |
| 683 | 683 | <li class="lsx-wc-footer-bar-item"> |
| 684 | - <a href="<?php echo esc_url( $cart_url ); ?>" class="lsx-wc-footer-bar-link"> |
|
| 684 | + <a href="<?php echo esc_url($cart_url); ?>" class="lsx-wc-footer-bar-link"> |
|
| 685 | 685 | <i class="fa fa-shopping-basket" aria-hidden="true"></i> |
| 686 | 686 | <?php $count = WC()->cart->get_cart_contents_count(); ?> |
| 687 | - <?php if ( ! empty( $count ) ) : ?> |
|
| 688 | - <span class="lsx-wc-footer-bar-count"><?php echo wp_kses_data( $count ); ?></span> |
|
| 687 | + <?php if ( ! empty($count)) : ?> |
|
| 688 | + <span class="lsx-wc-footer-bar-count"><?php echo wp_kses_data($count); ?></span> |
|
| 689 | 689 | <?php endif; ?> |
| 690 | - <span><?php esc_html_e( 'Cart', 'lsx' ); ?></span> |
|
| 690 | + <span><?php esc_html_e('Cart', 'lsx'); ?></span> |
|
| 691 | 691 | </a> |
| 692 | 692 | </li> |
| 693 | 693 | </ul> |
@@ -696,11 +696,11 @@ discard block |
||
| 696 | 696 | endif; |
| 697 | 697 | } |
| 698 | 698 | |
| 699 | - add_action( 'lsx_body_bottom', 'lsx_wc_footer_bar', 15 ); |
|
| 699 | + add_action('lsx_body_bottom', 'lsx_wc_footer_bar', 15); |
|
| 700 | 700 | |
| 701 | 701 | endif; |
| 702 | 702 | |
| 703 | -if ( ! function_exists( 'lsx_wc_body_class' ) ) : |
|
| 703 | +if ( ! function_exists('lsx_wc_body_class')) : |
|
| 704 | 704 | |
| 705 | 705 | /** |
| 706 | 706 | * Changes body class. |
@@ -708,25 +708,25 @@ discard block |
||
| 708 | 708 | * @package lsx |
| 709 | 709 | * @subpackage woocommerce |
| 710 | 710 | */ |
| 711 | - function lsx_wc_body_class( $classes ) { |
|
| 711 | + function lsx_wc_body_class($classes) { |
|
| 712 | 712 | global $post; |
| 713 | 713 | |
| 714 | - if ( $post && class_exists( 'WC_Wishlists_Pages' ) && WC_Wishlists_Pages::is_wishlist_page( $post->post_name ) ) { |
|
| 714 | + if ($post && class_exists('WC_Wishlists_Pages') && WC_Wishlists_Pages::is_wishlist_page($post->post_name)) { |
|
| 715 | 715 | $classes[] = 'woocommerce-page woocommerce-wishlist'; |
| 716 | 716 | } |
| 717 | 717 | |
| 718 | - if ( ! empty( get_theme_mod( 'lsx_wc_mobile_footer_bar_status', '1' ) ) ) { |
|
| 718 | + if ( ! empty(get_theme_mod('lsx_wc_mobile_footer_bar_status', '1'))) { |
|
| 719 | 719 | $classes[] = 'lsx-wc-has-footer-bar'; |
| 720 | 720 | } |
| 721 | 721 | |
| 722 | 722 | return $classes; |
| 723 | 723 | } |
| 724 | 724 | |
| 725 | - add_filter( 'body_class', 'lsx_wc_body_class', 2999 ); |
|
| 725 | + add_filter('body_class', 'lsx_wc_body_class', 2999); |
|
| 726 | 726 | |
| 727 | 727 | endif; |
| 728 | 728 | |
| 729 | -if ( ! function_exists( 'lsx_wc_downloadable_products' ) ) : |
|
| 729 | +if ( ! function_exists('lsx_wc_downloadable_products')) : |
|
| 730 | 730 | |
| 731 | 731 | /** |
| 732 | 732 | * Changes downloads "download" button text. |
@@ -734,19 +734,19 @@ discard block |
||
| 734 | 734 | * @package lsx |
| 735 | 735 | * @subpackage woocommerce |
| 736 | 736 | */ |
| 737 | - function lsx_wc_downloadable_products( $downloads ) { |
|
| 738 | - foreach ( $downloads as $i => $download ) { |
|
| 739 | - $downloads[ $i ]['download_name'] = esc_html__( 'Download', 'lsx' ); |
|
| 737 | + function lsx_wc_downloadable_products($downloads) { |
|
| 738 | + foreach ($downloads as $i => $download) { |
|
| 739 | + $downloads[$i]['download_name'] = esc_html__('Download', 'lsx'); |
|
| 740 | 740 | } |
| 741 | 741 | |
| 742 | 742 | return $downloads; |
| 743 | 743 | } |
| 744 | 744 | |
| 745 | - add_filter( 'woocommerce_customer_get_downloadable_products', 'lsx_wc_downloadable_products', 2999 ); |
|
| 745 | + add_filter('woocommerce_customer_get_downloadable_products', 'lsx_wc_downloadable_products', 2999); |
|
| 746 | 746 | |
| 747 | 747 | endif; |
| 748 | 748 | |
| 749 | -if ( ! function_exists( 'lsx_wc_move_bundle_products' ) ) : |
|
| 749 | +if ( ! function_exists('lsx_wc_move_bundle_products')) : |
|
| 750 | 750 | |
| 751 | 751 | /** |
| 752 | 752 | * WooCommerce - Move the bundle products to a tab. |
@@ -754,46 +754,46 @@ discard block |
||
| 754 | 754 | * @package lsx |
| 755 | 755 | * @subpackage woocommerce |
| 756 | 756 | */ |
| 757 | - function lsx_wc_move_bundle_products( $tabs ) { |
|
| 757 | + function lsx_wc_move_bundle_products($tabs) { |
|
| 758 | 758 | global $product, $post; |
| 759 | 759 | |
| 760 | - if ( method_exists( $product, 'get_bundled_items' ) ) { |
|
| 760 | + if (method_exists($product, 'get_bundled_items')) { |
|
| 761 | 761 | $bundled_items = $product->get_bundled_items(); |
| 762 | 762 | |
| 763 | - if ( ! empty( $bundled_items ) ) { |
|
| 763 | + if ( ! empty($bundled_items)) { |
|
| 764 | 764 | $tabs['bundled_products'] = array( |
| 765 | - 'title' => __( 'Included Products', 'lsx' ), |
|
| 765 | + 'title' => __('Included Products', 'lsx'), |
|
| 766 | 766 | 'priority' => 10, |
| 767 | 767 | 'callback' => 'lsx_wc_bundle_products', |
| 768 | 768 | ); |
| 769 | 769 | } |
| 770 | 770 | } |
| 771 | 771 | |
| 772 | - if ( isset( $tabs['description'] ) ) { |
|
| 772 | + if (isset($tabs['description'])) { |
|
| 773 | 773 | $tabs['description']['priority'] = 5; |
| 774 | 774 | } |
| 775 | 775 | |
| 776 | - if ( isset( $tabs['reviews'] ) ) { |
|
| 776 | + if (isset($tabs['reviews'])) { |
|
| 777 | 777 | $tabs['reviews']['priority'] = 15; |
| 778 | 778 | } |
| 779 | 779 | |
| 780 | - if ( isset( $tabs['product_enquiry'] ) ) { |
|
| 780 | + if (isset($tabs['product_enquiry'])) { |
|
| 781 | 781 | $tabs['product_enquiry']['priority'] = 20; |
| 782 | 782 | } |
| 783 | 783 | |
| 784 | 784 | return $tabs; |
| 785 | 785 | } |
| 786 | 786 | |
| 787 | - add_action( 'woocommerce_product_tabs', 'lsx_wc_move_bundle_products', 50 ); |
|
| 787 | + add_action('woocommerce_product_tabs', 'lsx_wc_move_bundle_products', 50); |
|
| 788 | 788 | |
| 789 | 789 | endif; |
| 790 | 790 | |
| 791 | -if ( ! function_exists( 'lsx_wc_bundle_products' ) ) : |
|
| 791 | +if ( ! function_exists('lsx_wc_bundle_products')) : |
|
| 792 | 792 | |
| 793 | 793 | function lsx_wc_bundle_products() { |
| 794 | 794 | global $product, $post; |
| 795 | 795 | |
| 796 | - if ( method_exists( $product, 'get_bundled_items' ) ) { |
|
| 796 | + if (method_exists($product, 'get_bundled_items')) { |
|
| 797 | 797 | $bundled_items = $product->get_bundled_items(); |
| 798 | 798 | |
| 799 | 799 | // do_action( 'woocommerce_before_bundled_items', $product ); |
@@ -809,16 +809,16 @@ discard block |
||
| 809 | 809 | // $this->widget_start( $args, $instance ); |
| 810 | 810 | |
| 811 | 811 | // @codingStandardsIgnoreLine |
| 812 | - echo apply_filters( 'woocommerce_before_widget_product_list', '<ul class="product_list_widget">' ); |
|
| 812 | + echo apply_filters('woocommerce_before_widget_product_list', '<ul class="product_list_widget">'); |
|
| 813 | 813 | |
| 814 | - foreach ( $bundled_items as $bundled_item ) { |
|
| 815 | - $product = wc_get_product( $bundled_item->item_data['product_id'] ); |
|
| 816 | - wc_get_template( 'content-widget-product.php' ); |
|
| 814 | + foreach ($bundled_items as $bundled_item) { |
|
| 815 | + $product = wc_get_product($bundled_item->item_data['product_id']); |
|
| 816 | + wc_get_template('content-widget-product.php'); |
|
| 817 | 817 | $product = $product_original; |
| 818 | 818 | } |
| 819 | 819 | |
| 820 | 820 | // @codingStandardsIgnoreLine |
| 821 | - echo apply_filters( 'woocommerce_after_widget_product_list', '</ul>' ); |
|
| 821 | + echo apply_filters('woocommerce_after_widget_product_list', '</ul>'); |
|
| 822 | 822 | } |
| 823 | 823 | |
| 824 | 824 | // $this->widget_end( $args ); |
@@ -827,7 +827,7 @@ discard block |
||
| 827 | 827 | endif; |
| 828 | 828 | |
| 829 | 829 | |
| 830 | -if ( ! function_exists( 'lsx_wc_product_searchform' ) ) : |
|
| 830 | +if ( ! function_exists('lsx_wc_product_searchform')) : |
|
| 831 | 831 | /** |
| 832 | 832 | * woo_custom_product_searchform |
| 833 | 833 | * |
@@ -835,7 +835,7 @@ discard block |
||
| 835 | 835 | * @since 1.0 |
| 836 | 836 | * @return void |
| 837 | 837 | */ |
| 838 | - function lsx_wc_product_searchform( $form ) { |
|
| 838 | + function lsx_wc_product_searchform($form) { |
|
| 839 | 839 | |
| 840 | 840 | $form = ' |
| 841 | 841 | <form role="search" method="get" class="search-form form-inline" id="searchform" action="<?php echo esc_url( home_url( \'/\' ) ); ?>"> |
@@ -856,42 +856,42 @@ discard block |
||
| 856 | 856 | |
| 857 | 857 | } |
| 858 | 858 | endif; |
| 859 | -add_filter( 'get_product_search_form', 'lsx_wc_product_searchform', 10, 1 ); |
|
| 859 | +add_filter('get_product_search_form', 'lsx_wc_product_searchform', 10, 1); |
|
| 860 | 860 | |
| 861 | 861 | /** |
| 862 | 862 | * Output the pagination. |
| 863 | 863 | */ |
| 864 | 864 | function woocommerce_pagination() { |
| 865 | - if ( ! wc_get_loop_prop( 'is_paginated' ) || ! woocommerce_products_will_display() ) { |
|
| 865 | + if ( ! wc_get_loop_prop('is_paginated') || ! woocommerce_products_will_display()) { |
|
| 866 | 866 | return; |
| 867 | 867 | } |
| 868 | 868 | $args = array( |
| 869 | - 'total' => wc_get_loop_prop( 'total_pages' ), |
|
| 870 | - 'current' => wc_get_loop_prop( 'current_page' ), |
|
| 869 | + 'total' => wc_get_loop_prop('total_pages'), |
|
| 870 | + 'current' => wc_get_loop_prop('current_page'), |
|
| 871 | 871 | ); |
| 872 | 872 | |
| 873 | - if ( wc_get_loop_prop( 'is_shortcode' ) ) { |
|
| 874 | - $args['base'] = esc_url_raw( add_query_arg( 'product-page', '%#%', false ) ); |
|
| 873 | + if (wc_get_loop_prop('is_shortcode')) { |
|
| 874 | + $args['base'] = esc_url_raw(add_query_arg('product-page', '%#%', false)); |
|
| 875 | 875 | $args['format'] = '?product-page = %#%'; |
| 876 | 876 | } else { |
| 877 | - $args['base'] = esc_url_raw( str_replace( 999999999, '%#%', remove_query_arg( 'add-to-cart', get_pagenum_link( 999999999, false ) ) ) ); |
|
| 877 | + $args['base'] = esc_url_raw(str_replace(999999999, '%#%', remove_query_arg('add-to-cart', get_pagenum_link(999999999, false)))); |
|
| 878 | 878 | $args['format'] = ''; |
| 879 | 879 | } |
| 880 | 880 | |
| 881 | - echo wp_kses_post( '<div class="lsx-pagination-wrapper">' ); |
|
| 882 | - $template = wc_get_template_html( 'loop/pagination.php', $args ); |
|
| 883 | - $template = str_replace( 'woocommerce-pagination', 'lsx-pagination', $template ); |
|
| 884 | - echo wp_kses_post( $template ); |
|
| 885 | - echo wp_kses_post( '</div>' ); |
|
| 881 | + echo wp_kses_post('<div class="lsx-pagination-wrapper">'); |
|
| 882 | + $template = wc_get_template_html('loop/pagination.php', $args); |
|
| 883 | + $template = str_replace('woocommerce-pagination', 'lsx-pagination', $template); |
|
| 884 | + echo wp_kses_post($template); |
|
| 885 | + echo wp_kses_post('</div>'); |
|
| 886 | 886 | } |
| 887 | 887 | |
| 888 | -function lsx_wc_pagination_args( $args ) { |
|
| 889 | - $args['prev_text'] = '<span class="meta-nav">←</span> ' . esc_html__( 'Previous', 'lsx' ); |
|
| 890 | - $args['next_text'] = esc_html__( 'Next', 'lsx' ) . ' <span class="meta-nav">→</span>'; |
|
| 888 | +function lsx_wc_pagination_args($args) { |
|
| 889 | + $args['prev_text'] = '<span class="meta-nav">←</span> ' . esc_html__('Previous', 'lsx'); |
|
| 890 | + $args['next_text'] = esc_html__('Next', 'lsx') . ' <span class="meta-nav">→</span>'; |
|
| 891 | 891 | $args['type'] = 'plain'; |
| 892 | 892 | return $args; |
| 893 | 893 | } |
| 894 | -add_filter( 'woocommerce_pagination_args', 'lsx_wc_pagination_args', 10, 1 ); |
|
| 894 | +add_filter('woocommerce_pagination_args', 'lsx_wc_pagination_args', 10, 1); |
|
| 895 | 895 | |
| 896 | 896 | |
| 897 | 897 | /** |
@@ -902,19 +902,19 @@ discard block |
||
| 902 | 902 | * |
| 903 | 903 | * @return array |
| 904 | 904 | */ |
| 905 | -function lsx_wc_product_widget_template( $located, $template_name ) { |
|
| 906 | - if ( 'content-widget-product.php' === $template_name || 'content-widget-review.php' === $template_name ) { |
|
| 905 | +function lsx_wc_product_widget_template($located, $template_name) { |
|
| 906 | + if ('content-widget-product.php' === $template_name || 'content-widget-review.php' === $template_name) { |
|
| 907 | 907 | |
| 908 | 908 | $new_location = get_stylesheet_directory() . '/partials/' . $template_name; |
| 909 | - if ( file_exists( $new_location ) ) { |
|
| 909 | + if (file_exists($new_location)) { |
|
| 910 | 910 | $located = $new_location; |
| 911 | 911 | } else { |
| 912 | 912 | $new_location = get_parent_theme_file_path() . '/partials/' . $template_name; |
| 913 | - if ( file_exists( $new_location ) ) { |
|
| 913 | + if (file_exists($new_location)) { |
|
| 914 | 914 | $located = $new_location; |
| 915 | 915 | } |
| 916 | 916 | } |
| 917 | 917 | } |
| 918 | 918 | return $located; |
| 919 | 919 | } |
| 920 | -add_filter( 'wc_get_template', 'lsx_wc_product_widget_template', 90, 2 ); |
|
| 920 | +add_filter('wc_get_template', 'lsx_wc_product_widget_template', 90, 2); |
|