@@ -26,17 +26,17 @@ discard block |
||
26 | 26 | * Contructor |
27 | 27 | */ |
28 | 28 | public function __construct() { |
29 | - add_filter( 'woocommerce_order_button_text', array( $this, 'checkout_button_text' ), 10, 1 ); |
|
29 | + add_filter('woocommerce_order_button_text', array($this, 'checkout_button_text'), 10, 1); |
|
30 | 30 | |
31 | 31 | // Checkout. |
32 | - add_action( 'woocommerce_after_checkout_form', array( $this, 'payment_gateway_logos' ) ); |
|
33 | - add_action( 'body_class', array( $this, 'hp_wc_add_body_classes' ) ); |
|
34 | - add_action( 'lsx_nav_before', array( $this, 'hp_link_lsx_navbar_header' ), 99 ); |
|
35 | - add_action( 'wp_head', array( $this, 'hp_simple_checkout' ), 99 ); |
|
32 | + add_action('woocommerce_after_checkout_form', array($this, 'payment_gateway_logos')); |
|
33 | + add_action('body_class', array($this, 'hp_wc_add_body_classes')); |
|
34 | + add_action('lsx_nav_before', array($this, 'hp_link_lsx_navbar_header'), 99); |
|
35 | + add_action('wp_head', array($this, 'hp_simple_checkout'), 99); |
|
36 | 36 | |
37 | 37 | // Cart Messages. |
38 | - add_action( 'lsx_content_wrap_before', array( $this, 'cart_notices' ) ); |
|
39 | - add_filter( 'wc_add_to_cart_message_html', array( $this, 'add_to_cart_message' ), 10, 3 ); |
|
38 | + add_action('lsx_content_wrap_before', array($this, 'cart_notices')); |
|
39 | + add_filter('wc_add_to_cart_message_html', array($this, 'add_to_cart_message'), 10, 3); |
|
40 | 40 | } |
41 | 41 | |
42 | 42 | /** |
@@ -48,7 +48,7 @@ discard block |
||
48 | 48 | */ |
49 | 49 | public static function get_instance() { |
50 | 50 | // If the single instance hasn't been set, set it now. |
51 | - if ( null === self::$instance ) { |
|
51 | + if (null === self::$instance) { |
|
52 | 52 | self::$instance = new self(); |
53 | 53 | } |
54 | 54 | return self::$instance; |
@@ -60,8 +60,8 @@ discard block |
||
60 | 60 | * @param string $label |
61 | 61 | * @return void |
62 | 62 | */ |
63 | - public function checkout_button_text( $label = '' ) { |
|
64 | - $label = __( 'Place order', 'lsx-health-plan' ); |
|
63 | + public function checkout_button_text($label = '') { |
|
64 | + $label = __('Place order', 'lsx-health-plan'); |
|
65 | 65 | return $label; |
66 | 66 | } |
67 | 67 | |
@@ -71,9 +71,9 @@ discard block |
||
71 | 71 | * @return void |
72 | 72 | */ |
73 | 73 | public function hp_link_lsx_navbar_header() { |
74 | - if ( is_checkout() ) { |
|
75 | - $home_ulr = '<nav class="checkout-navbar"><ul class="nav navbar-nav"><li><a href="' . home_url() . '">' . __( 'Home', 'lsx-health-plan' ) . '</a></li></ul></nav>'; |
|
76 | - echo wp_kses_post( $home_ulr ); |
|
74 | + if (is_checkout()) { |
|
75 | + $home_ulr = '<nav class="checkout-navbar"><ul class="nav navbar-nav"><li><a href="' . home_url() . '">' . __('Home', 'lsx-health-plan') . '</a></li></ul></nav>'; |
|
76 | + echo wp_kses_post($home_ulr); |
|
77 | 77 | } |
78 | 78 | } |
79 | 79 | |
@@ -83,9 +83,9 @@ discard block |
||
83 | 83 | * @param array $classes |
84 | 84 | * @return void |
85 | 85 | */ |
86 | - public function hp_wc_add_body_classes( $classes = array() ) { |
|
86 | + public function hp_wc_add_body_classes($classes = array()) { |
|
87 | 87 | global $post; |
88 | - if ( is_checkout() ) { |
|
88 | + if (is_checkout()) { |
|
89 | 89 | $classes[] = 'lsx-hp-simple-checkout'; |
90 | 90 | } |
91 | 91 | return $classes; |
@@ -98,8 +98,8 @@ discard block |
||
98 | 98 | * @return void |
99 | 99 | */ |
100 | 100 | public function hp_simple_checkout() { |
101 | - if ( is_checkout() ) { |
|
102 | - remove_action( 'lsx_footer_before', 'lsx_add_footer_sidebar_area' ); |
|
101 | + if (is_checkout()) { |
|
102 | + remove_action('lsx_footer_before', 'lsx_add_footer_sidebar_area'); |
|
103 | 103 | } |
104 | 104 | } |
105 | 105 | |
@@ -114,16 +114,16 @@ discard block |
||
114 | 114 | ?> |
115 | 115 | <div class="row text-center vertical-align lsx-full-width-base-small checkout-cta-bottom"> |
116 | 116 | <div class="col-md-12 img-payfast"> |
117 | - <img loading="lazy" src="<?php echo esc_url( $payfast_image ); ?>" alt="payfast"/> |
|
117 | + <img loading="lazy" src="<?php echo esc_url($payfast_image); ?>" alt="payfast"/> |
|
118 | 118 | </div> |
119 | 119 | <div class="col-md-12 img-payments hidden-xs"> |
120 | - <img loading="lazy" src="<?php echo esc_url( $payment_logos ); ?>" alt="payments"/> |
|
120 | + <img loading="lazy" src="<?php echo esc_url($payment_logos); ?>" alt="payments"/> |
|
121 | 121 | </div> |
122 | 122 | <div class="col-md-12 img-payments hidden-sm hidden-md hidden-lg"> |
123 | - <img loading="lazy" src="<?php echo esc_url( $payment_logos_mobile ); ?>" alt="payments"/> |
|
123 | + <img loading="lazy" src="<?php echo esc_url($payment_logos_mobile); ?>" alt="payments"/> |
|
124 | 124 | </div> |
125 | 125 | <div class="col-md-12 img-encrypt"> |
126 | - <img loading="lazy" src="<?php echo esc_url( $encript_image ); ?>" alt="lets_encrypt"/> |
|
126 | + <img loading="lazy" src="<?php echo esc_url($encript_image); ?>" alt="lets_encrypt"/> |
|
127 | 127 | </div> |
128 | 128 | </div> |
129 | 129 | |
@@ -138,9 +138,9 @@ discard block |
||
138 | 138 | * @param string $variation_id |
139 | 139 | * @return void |
140 | 140 | */ |
141 | - public function add_plan_id_to_cart( $cart_item_data, $product_id, $variation_id ) { |
|
142 | - $plan_id = filter_input( INPUT_GET, 'plan_id' ); |
|
143 | - if ( empty( $plan_id ) || '' === $plan_id ) { |
|
141 | + public function add_plan_id_to_cart($cart_item_data, $product_id, $variation_id) { |
|
142 | + $plan_id = filter_input(INPUT_GET, 'plan_id'); |
|
143 | + if (empty($plan_id) || '' === $plan_id) { |
|
144 | 144 | return $cart_item_data; |
145 | 145 | } |
146 | 146 | $cart_item_data['plan_id'] = $plan_id; |
@@ -153,10 +153,10 @@ discard block |
||
153 | 153 | * @return void |
154 | 154 | */ |
155 | 155 | public function cart_notices() { |
156 | - if ( function_exists( 'woocommerce_output_all_notices' ) && is_post_type_archive( 'plan' ) ) { |
|
157 | - echo wp_kses_post( '<div class="col-md-12 col-sm-12 woocommerce-notices-wrapper">' ); |
|
156 | + if (function_exists('woocommerce_output_all_notices') && is_post_type_archive('plan')) { |
|
157 | + echo wp_kses_post('<div class="col-md-12 col-sm-12 woocommerce-notices-wrapper">'); |
|
158 | 158 | wc_print_notices(); |
159 | - echo wp_kses_post( '</div>' ); |
|
159 | + echo wp_kses_post('</div>'); |
|
160 | 160 | } |
161 | 161 | } |
162 | 162 | |
@@ -168,19 +168,19 @@ discard block |
||
168 | 168 | * @param boolean $show_qty |
169 | 169 | * @return string |
170 | 170 | */ |
171 | - public function add_to_cart_message( $message, $products, $show_qty ) { |
|
172 | - if ( isset( $_GET['plan_id'] ) ) { // @codingStandardsIgnoreLine. |
|
173 | - $this->plan_id = sanitize_text_field( wp_slash( $_GET['plan_id'] ) ); // @codingStandardsIgnoreLine. |
|
171 | + public function add_to_cart_message($message, $products, $show_qty) { |
|
172 | + if (isset($_GET['plan_id'])) { // @codingStandardsIgnoreLine. |
|
173 | + $this->plan_id = sanitize_text_field(wp_slash($_GET['plan_id'])); // @codingStandardsIgnoreLine. |
|
174 | 174 | |
175 | - $title = '<strong>' . get_the_title( $this->plan_id ) . '</strong>'; |
|
176 | - $title = sprintf( _n( '%s has been added to your cart.', '%s have been added to your cart.', 1, 'lsx-health-plan' ), $title ); |
|
175 | + $title = '<strong>' . get_the_title($this->plan_id) . '</strong>'; |
|
176 | + $title = sprintf(_n('%s has been added to your cart.', '%s have been added to your cart.', 1, 'lsx-health-plan'), $title); |
|
177 | 177 | |
178 | 178 | // Output success messages. |
179 | - if ( 'yes' === get_option( 'woocommerce_cart_redirect_after_add' ) ) { |
|
180 | - $return_to = apply_filters( 'woocommerce_continue_shopping_redirect', wc_get_raw_referer() ? wp_validate_redirect( wc_get_raw_referer(), false ) : wc_get_page_permalink( 'shop' ) ); |
|
181 | - $message = sprintf( '<a href="%s" tabindex="1" class="btn button wc-forward">%s</a> %s', esc_url( $return_to ), esc_html__( 'Continue shopping', 'lsx-health-plan' ), $title ); |
|
179 | + if ('yes' === get_option('woocommerce_cart_redirect_after_add')) { |
|
180 | + $return_to = apply_filters('woocommerce_continue_shopping_redirect', wc_get_raw_referer() ? wp_validate_redirect(wc_get_raw_referer(), false) : wc_get_page_permalink('shop')); |
|
181 | + $message = sprintf('<a href="%s" tabindex="1" class="btn button wc-forward">%s</a> %s', esc_url($return_to), esc_html__('Continue shopping', 'lsx-health-plan'), $title); |
|
182 | 182 | } else { |
183 | - $message = sprintf( '<a href="%s" tabindex="1" class="btn button wc-forward">%s</a> %s', esc_url( wc_get_cart_url() ), esc_html__( 'View cart', 'lsx-health-plan' ), $title ); |
|
183 | + $message = sprintf('<a href="%s" tabindex="1" class="btn button wc-forward">%s</a> %s', esc_url(wc_get_cart_url()), esc_html__('View cart', 'lsx-health-plan'), $title); |
|
184 | 184 | } |
185 | 185 | } |
186 | 186 | return $message; |
@@ -27,13 +27,13 @@ discard block |
||
27 | 27 | */ |
28 | 28 | public function __construct() { |
29 | 29 | $this->default_types = array( |
30 | - \lsx_health_plan\functions\get_option( 'endpoint_meal', 'meal' ), |
|
31 | - \lsx_health_plan\functions\get_option( 'endpoint_exercise_single', 'exercise' ), |
|
32 | - \lsx_health_plan\functions\get_option( 'endpoint_recipe_single', 'recipe' ), |
|
33 | - \lsx_health_plan\functions\get_option( 'endpoint_workout', 'workout' ), |
|
34 | - \lsx_health_plan\functions\get_option( 'endpoint_plan', 'plan' ), |
|
30 | + \lsx_health_plan\functions\get_option('endpoint_meal', 'meal'), |
|
31 | + \lsx_health_plan\functions\get_option('endpoint_exercise_single', 'exercise'), |
|
32 | + \lsx_health_plan\functions\get_option('endpoint_recipe_single', 'recipe'), |
|
33 | + \lsx_health_plan\functions\get_option('endpoint_workout', 'workout'), |
|
34 | + \lsx_health_plan\functions\get_option('endpoint_plan', 'plan'), |
|
35 | 35 | ); |
36 | - add_action( 'cmb2_admin_init', array( $this, 'related_articles_metabox' ) ); |
|
36 | + add_action('cmb2_admin_init', array($this, 'related_articles_metabox')); |
|
37 | 37 | } |
38 | 38 | |
39 | 39 | /** |
@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | */ |
46 | 46 | public static function get_instance() { |
47 | 47 | // If the single instance hasn't been set, set it now. |
48 | - if ( null === self::$instance ) { |
|
48 | + if (null === self::$instance) { |
|
49 | 49 | self::$instance = new self(); |
50 | 50 | } |
51 | 51 | return self::$instance; |
@@ -55,12 +55,12 @@ discard block |
||
55 | 55 | * Define the related articles member metabox and field configurations. |
56 | 56 | */ |
57 | 57 | public function related_articles_metabox() { |
58 | - foreach ( $this->default_types as $type => $default_type ) { |
|
58 | + foreach ($this->default_types as $type => $default_type) { |
|
59 | 59 | $cmb = new_cmb2_box( |
60 | 60 | array( |
61 | 61 | 'id' => $default_type . '_related_articles_metabox', |
62 | - 'title' => __( 'Related Articles', 'lsx-health-plan' ), |
|
63 | - 'object_types' => array( $default_type ), // Post type. |
|
62 | + 'title' => __('Related Articles', 'lsx-health-plan'), |
|
63 | + 'object_types' => array($default_type), // Post type. |
|
64 | 64 | 'context' => 'normal', |
65 | 65 | 'priority' => 'low', |
66 | 66 | 'show_names' => true, |
@@ -69,15 +69,15 @@ discard block |
||
69 | 69 | |
70 | 70 | $cmb->add_field( |
71 | 71 | array( |
72 | - 'name' => __( 'Related Articles', 'lsx-health-plan' ), |
|
73 | - 'desc' => __( 'Connect the related articles that applies to this ', 'lsx-health-plan' ) . $default_type, |
|
72 | + 'name' => __('Related Articles', 'lsx-health-plan'), |
|
73 | + 'desc' => __('Connect the related articles that applies to this ', 'lsx-health-plan') . $default_type, |
|
74 | 74 | 'id' => $default_type . '_connected_articles', |
75 | 75 | 'type' => 'post_search_ajax', |
76 | - 'limit' => 3, // Limit selection to X items only (default 1). |
|
76 | + 'limit' => 3, // Limit selection to X items only (default 1). |
|
77 | 77 | 'sortable' => true, // Allow selected items to be sortable (default false). |
78 | 78 | 'query_args' => array( |
79 | - 'post_type' => array( 'post' ), |
|
80 | - 'post_status' => array( 'publish' ), |
|
79 | + 'post_type' => array('post'), |
|
80 | + 'post_status' => array('publish'), |
|
81 | 81 | 'posts_per_page' => -1, |
82 | 82 | ), |
83 | 83 | ) |
@@ -26,8 +26,8 @@ discard block |
||
26 | 26 | * Contructor |
27 | 27 | */ |
28 | 28 | public function __construct() { |
29 | - add_action( 'init', array( $this, 'load_plugin_textdomain' ) ); |
|
30 | - add_action( 'wp_head', array( $this, 'load_shortcodes' ) ); |
|
29 | + add_action('init', array($this, 'load_plugin_textdomain')); |
|
30 | + add_action('wp_head', array($this, 'load_shortcodes')); |
|
31 | 31 | $this->load_classes(); |
32 | 32 | } |
33 | 33 | |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | public static function get_instance() { |
42 | 42 | |
43 | 43 | // If the single instance hasn't been set, set it now. |
44 | - if ( null === self::$instance ) { |
|
44 | + if (null === self::$instance) { |
|
45 | 45 | self::$instance = new self(); |
46 | 46 | } |
47 | 47 | |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | * Adds text domain. |
54 | 54 | */ |
55 | 55 | public function load_plugin_textdomain() { |
56 | - load_plugin_textdomain( 'lsx-health-plan', false, basename( LSX_HEALTH_PLAN_PATH ) . '/languages' ); |
|
56 | + load_plugin_textdomain('lsx-health-plan', false, basename(LSX_HEALTH_PLAN_PATH) . '/languages'); |
|
57 | 57 | } |
58 | 58 | |
59 | 59 | /** |
@@ -72,22 +72,22 @@ discard block |
||
72 | 72 | * @return void |
73 | 73 | */ |
74 | 74 | public function load_shortcodes() { |
75 | - add_shortcode( 'lsx_health_plan_restricted_content', '\lsx_health_plan\shortcodes\restricted_content' ); |
|
76 | - add_shortcode( 'lsx_health_plan_my_profile_tabs', '\lsx_health_plan\shortcodes\my_profile_tabs' ); |
|
77 | - add_shortcode( 'lsx_health_plan_my_profile_block', '\lsx_health_plan\shortcodes\my_profile_box' ); |
|
78 | - add_shortcode( 'lsx_health_plan_all_plans_block', '\lsx_health_plan\shortcodes\all_plans_box' ); |
|
79 | - add_shortcode( 'lsx_health_plan_day_plan_block', '\lsx_health_plan\shortcodes\day_plan_box' ); |
|
80 | - add_shortcode( 'lsx_health_plan_account_notices', '\lsx_health_plan\shortcodes\account_notices' ); |
|
75 | + add_shortcode('lsx_health_plan_restricted_content', '\lsx_health_plan\shortcodes\restricted_content'); |
|
76 | + add_shortcode('lsx_health_plan_my_profile_tabs', '\lsx_health_plan\shortcodes\my_profile_tabs'); |
|
77 | + add_shortcode('lsx_health_plan_my_profile_block', '\lsx_health_plan\shortcodes\my_profile_box'); |
|
78 | + add_shortcode('lsx_health_plan_all_plans_block', '\lsx_health_plan\shortcodes\all_plans_box'); |
|
79 | + add_shortcode('lsx_health_plan_day_plan_block', '\lsx_health_plan\shortcodes\day_plan_box'); |
|
80 | + add_shortcode('lsx_health_plan_account_notices', '\lsx_health_plan\shortcodes\account_notices'); |
|
81 | 81 | |
82 | - if ( post_type_exists( 'video' ) ) { |
|
83 | - add_shortcode( 'lsx_health_plan_featured_video_block', '\lsx_health_plan\shortcodes\feature_video_box' ); |
|
82 | + if (post_type_exists('video')) { |
|
83 | + add_shortcode('lsx_health_plan_featured_video_block', '\lsx_health_plan\shortcodes\feature_video_box'); |
|
84 | 84 | } |
85 | - if ( post_type_exists( 'recipe' ) ) { |
|
86 | - add_shortcode( 'lsx_health_plan_featured_recipes_block', '\lsx_health_plan\shortcodes\feature_recipes_box' ); |
|
85 | + if (post_type_exists('recipe')) { |
|
86 | + add_shortcode('lsx_health_plan_featured_recipes_block', '\lsx_health_plan\shortcodes\feature_recipes_box'); |
|
87 | 87 | } |
88 | - if ( post_type_exists( 'tip' ) ) { |
|
89 | - add_shortcode( 'lsx_health_plan_featured_tips_block', '\lsx_health_plan\shortcodes\feature_tips_box' ); |
|
88 | + if (post_type_exists('tip')) { |
|
89 | + add_shortcode('lsx_health_plan_featured_tips_block', '\lsx_health_plan\shortcodes\feature_tips_box'); |
|
90 | 90 | } |
91 | - add_shortcode( 'lsx_health_plan_items', '\lsx_health_plan\shortcodes\exercise_box' ); |
|
91 | + add_shortcode('lsx_health_plan_items', '\lsx_health_plan\shortcodes\exercise_box'); |
|
92 | 92 | } |
93 | 93 | } |
@@ -6,10 +6,10 @@ discard block |
||
6 | 6 | */ |
7 | 7 | |
8 | 8 | // Getting translated endpoint. |
9 | -$meal = \lsx_health_plan\functions\get_option( 'endpoint_meal', 'meal' ); |
|
9 | +$meal = \lsx_health_plan\functions\get_option('endpoint_meal', 'meal'); |
|
10 | 10 | |
11 | -$connected_members = get_post_meta( get_the_ID(), ( $meal . '_connected_team_member' ), true ); |
|
12 | -$connected_articles = get_post_meta( get_the_ID(), ( $meal . '_connected_articles' ), true ); |
|
11 | +$connected_members = get_post_meta(get_the_ID(), ($meal . '_connected_team_member'), true); |
|
12 | +$connected_articles = get_post_meta(get_the_ID(), ($meal . '_connected_articles'), true); |
|
13 | 13 | |
14 | 14 | ?> |
15 | 15 | |
@@ -24,16 +24,16 @@ discard block |
||
24 | 24 | <div class="entry-content"> |
25 | 25 | <div class="single-plan-inner meal-content"> |
26 | 26 | <?php |
27 | - if ( is_singular( 'meal' ) ) { ?> |
|
27 | + if (is_singular('meal')) { ?> |
|
28 | 28 | <div class="single-plan-section-title meal-plan title-lined"> |
29 | - <?php lsx_get_svg_icon( 'meal.svg' ); ?> |
|
29 | + <?php lsx_get_svg_icon('meal.svg'); ?> |
|
30 | 30 | <h2><?php the_title(); ?></h2> |
31 | 31 | |
32 | 32 | </div> |
33 | 33 | <?php } else { ?> |
34 | 34 | <div class="single-plan-section-title meal-plan title-lined"> |
35 | - <?php lsx_get_svg_icon( 'meal.svg' ); ?> |
|
36 | - <h2><?php esc_html_e( 'My Meal Plan', 'lsx-health-plan' ); ?> <?php the_title(); ?></h2> |
|
35 | + <?php lsx_get_svg_icon('meal.svg'); ?> |
|
36 | + <h2><?php esc_html_e('My Meal Plan', 'lsx-health-plan'); ?> <?php the_title(); ?></h2> |
|
37 | 37 | </div> |
38 | 38 | <?php } ?> |
39 | 39 | |
@@ -46,8 +46,8 @@ discard block |
||
46 | 46 | </article><!-- #post-## --> |
47 | 47 | |
48 | 48 | <?php |
49 | -if ( ! empty( $connected_articles ) ) { |
|
50 | - lsx_hp_single_related( $connected_articles, __( 'Related articles', 'lsx-health-plan' ) ); |
|
49 | +if ( ! empty($connected_articles)) { |
|
50 | + lsx_hp_single_related($connected_articles, __('Related articles', 'lsx-health-plan')); |
|
51 | 51 | } |
52 | 52 | ?> |
53 | 53 |
@@ -12,13 +12,13 @@ discard block |
||
12 | 12 | */ |
13 | 13 | |
14 | 14 | // If this file is called directly, abort. |
15 | -if ( ! defined( 'WPINC' ) ) { |
|
15 | +if ( ! defined('WPINC')) { |
|
16 | 16 | die; |
17 | 17 | } |
18 | -define( 'LSX_HEALTH_PLAN_PATH', plugin_dir_path( __FILE__ ) ); |
|
19 | -define( 'LSX_HEALTH_PLAN_CORE', __FILE__ ); |
|
20 | -define( 'LSX_HEALTH_PLAN_URL', plugin_dir_url( __FILE__ ) ); |
|
21 | -define( 'LSX_HEALTH_PLAN_VER', '1.4.0' ); |
|
18 | +define('LSX_HEALTH_PLAN_PATH', plugin_dir_path(__FILE__)); |
|
19 | +define('LSX_HEALTH_PLAN_CORE', __FILE__); |
|
20 | +define('LSX_HEALTH_PLAN_URL', plugin_dir_url(__FILE__)); |
|
21 | +define('LSX_HEALTH_PLAN_VER', '1.4.0'); |
|
22 | 22 | |
23 | 23 | /* ======================= Below is the Plugin Class init ========================= */ |
24 | 24 | |
@@ -31,13 +31,13 @@ discard block |
||
31 | 31 | */ |
32 | 32 | function lsx_remove_extra_meta_box() { |
33 | 33 | global $wp_meta_boxes; |
34 | - $all_post_types = [ 'plan', 'video', 'workout', 'tip', 'recipe', 'meal' ]; |
|
34 | + $all_post_types = ['plan', 'video', 'workout', 'tip', 'recipe', 'meal']; |
|
35 | 35 | //remove_meta_box( 'wpseo_meta', $all_post_types, 'normal' ); |
36 | - remove_meta_box( 'commentsdiv', $all_post_types, 'normal' ); |
|
37 | - remove_meta_box( 'commentstatusdiv', $all_post_types, 'normal' ); |
|
38 | - remove_meta_box( 'lsx_blocks_title_meta', $all_post_types, 'side' ); |
|
36 | + remove_meta_box('commentsdiv', $all_post_types, 'normal'); |
|
37 | + remove_meta_box('commentstatusdiv', $all_post_types, 'normal'); |
|
38 | + remove_meta_box('lsx_blocks_title_meta', $all_post_types, 'side'); |
|
39 | 39 | } |
40 | -add_action( 'add_meta_boxes', 'lsx_remove_extra_meta_box', 100 ); |
|
40 | +add_action('add_meta_boxes', 'lsx_remove_extra_meta_box', 100); |
|
41 | 41 | |
42 | 42 | /** |
43 | 43 | * Redirect user after login or redirect |
@@ -45,13 +45,13 @@ discard block |
||
45 | 45 | * @return void |
46 | 46 | */ |
47 | 47 | function lsx_login_redirect() { |
48 | - $plan_slug = \lsx_health_plan\functions\get_option( 'my_plan_slug', false ); |
|
49 | - if ( false === $plan_slug ) { |
|
48 | + $plan_slug = \lsx_health_plan\functions\get_option('my_plan_slug', false); |
|
49 | + if (false === $plan_slug) { |
|
50 | 50 | $plan_slug = 'my-plan'; |
51 | 51 | } |
52 | - return home_url( $plan_slug ); |
|
52 | + return home_url($plan_slug); |
|
53 | 53 | } |
54 | -add_filter( 'woocommerce_login_redirect', 'lsx_login_redirect' ); |
|
54 | +add_filter('woocommerce_login_redirect', 'lsx_login_redirect'); |
|
55 | 55 | |
56 | 56 | /** |
57 | 57 | * Undocumented function |
@@ -68,10 +68,10 @@ discard block |
||
68 | 68 | * |
69 | 69 | * @return void |
70 | 70 | */ |
71 | -function lsx_get_svg_icon( $icon ) { |
|
71 | +function lsx_get_svg_icon($icon) { |
|
72 | 72 | $path = '/assets/images/'; |
73 | 73 | |
74 | - if ( file_exists( LSX_HEALTH_PLAN_PATH . $path . $icon ) ) { |
|
74 | + if (file_exists(LSX_HEALTH_PLAN_PATH . $path . $icon)) { |
|
75 | 75 | // Load and return the contents of the file |
76 | 76 | return include LSX_HEALTH_PLAN_PATH . $path . $icon; |
77 | 77 | } |
@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | * Contructor |
26 | 26 | */ |
27 | 27 | public function __construct() { |
28 | - add_action( 'lsx_hp_settings_page_plan_top', array( $this, 'settings' ), 1, 1 ); |
|
28 | + add_action('lsx_hp_settings_page_plan_top', array($this, 'settings'), 1, 1); |
|
29 | 29 | } |
30 | 30 | |
31 | 31 | /** |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | */ |
38 | 38 | public static function get_instance() { |
39 | 39 | // If the single instance hasn't been set, set it now. |
40 | - if ( null === self::$instance ) { |
|
40 | + if (null === self::$instance) { |
|
41 | 41 | self::$instance = new self(); |
42 | 42 | } |
43 | 43 | return self::$instance; |
@@ -49,15 +49,15 @@ discard block |
||
49 | 49 | * @param object $cmb new_cmb2_box(). |
50 | 50 | * @return void |
51 | 51 | */ |
52 | - public function settings( $cmb ) { |
|
52 | + public function settings($cmb) { |
|
53 | 53 | $cmb->add_field( |
54 | 54 | array( |
55 | - 'name' => __( 'Plan Filters', 'lsx-health-plan' ), |
|
55 | + 'name' => __('Plan Filters', 'lsx-health-plan'), |
|
56 | 56 | 'id' => 'plan_filters_disabled', |
57 | 57 | 'type' => 'checkbox', |
58 | 58 | 'value' => 1, |
59 | 59 | 'default' => 0, |
60 | - 'description' => __( 'Toggle the display of the tab filters on the post type archive.', 'lsx-health-plan' ), |
|
60 | + 'description' => __('Toggle the display of the tab filters on the post type archive.', 'lsx-health-plan'), |
|
61 | 61 | ) |
62 | 62 | ); |
63 | 63 | } |
@@ -22,13 +22,13 @@ discard block |
||
22 | 22 | */ |
23 | 23 | public function __construct() { |
24 | 24 | // Before Output. |
25 | - add_action( 'wp_enqueue_scripts', array( $this, 'assets' ), 5 ); |
|
26 | - add_filter( 'wp_kses_allowed_html', array( $this, 'allow_html_tags_attributes' ), 100, 2 ); |
|
25 | + add_action('wp_enqueue_scripts', array($this, 'assets'), 5); |
|
26 | + add_filter('wp_kses_allowed_html', array($this, 'allow_html_tags_attributes'), 100, 2); |
|
27 | 27 | |
28 | 28 | // Output. |
29 | - add_action( 'body_class', array( $this, 'body_classes' ) ); |
|
30 | - add_filter( 'lsx_global_header_title', array( $this, 'single_title' ), 200, 1 ); |
|
31 | - add_action( 'wp_head', array( $this, 'remove_single_footer' ), 99 ); |
|
29 | + add_action('body_class', array($this, 'body_classes')); |
|
30 | + add_filter('lsx_global_header_title', array($this, 'single_title'), 200, 1); |
|
31 | + add_action('wp_head', array($this, 'remove_single_footer'), 99); |
|
32 | 32 | } |
33 | 33 | |
34 | 34 | /** |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | */ |
41 | 41 | public static function get_instance() { |
42 | 42 | // If the single instance hasn't been set, set it now. |
43 | - if ( null === self::$instance ) { |
|
43 | + if (null === self::$instance) { |
|
44 | 44 | self::$instance = new self(); |
45 | 45 | } |
46 | 46 | return self::$instance; |
@@ -53,21 +53,21 @@ discard block |
||
53 | 53 | */ |
54 | 54 | public function assets() { |
55 | 55 | |
56 | - if ( is_post_type_archive( 'plan' ) && false === \lsx_health_plan\functions\plan\is_filters_disabled() ) { |
|
57 | - wp_enqueue_script( 'isotope', LSX_HEALTH_PLAN_URL . 'assets/js/vendor/isotope.pkgd.min.js', array( 'jquery' ), null, LSX_HEALTH_PLAN_URL, true ); |
|
56 | + if (is_post_type_archive('plan') && false === \lsx_health_plan\functions\plan\is_filters_disabled()) { |
|
57 | + wp_enqueue_script('isotope', LSX_HEALTH_PLAN_URL . 'assets/js/vendor/isotope.pkgd.min.js', array('jquery'), null, LSX_HEALTH_PLAN_URL, true); |
|
58 | 58 | } |
59 | 59 | |
60 | - wp_enqueue_style( 'lsx-health-plan', LSX_HEALTH_PLAN_URL . 'assets/css/lsx-health-plan.css', array(), LSX_HEALTH_PLAN_VER ); |
|
61 | - wp_style_add_data( 'lsx-health-plan', 'rtl', 'replace' ); |
|
62 | - wp_enqueue_script( 'lsx-health-plan-scripts', LSX_HEALTH_PLAN_URL . 'assets/js/src/lsx-health-plan-admin.js', array( 'jquery' ) ); |
|
60 | + wp_enqueue_style('lsx-health-plan', LSX_HEALTH_PLAN_URL . 'assets/css/lsx-health-plan.css', array(), LSX_HEALTH_PLAN_VER); |
|
61 | + wp_style_add_data('lsx-health-plan', 'rtl', 'replace'); |
|
62 | + wp_enqueue_script('lsx-health-plan-scripts', LSX_HEALTH_PLAN_URL . 'assets/js/src/lsx-health-plan-admin.js', array('jquery')); |
|
63 | 63 | |
64 | 64 | } |
65 | 65 | |
66 | 66 | /** |
67 | 67 | * Adds the iframe and the progress HTML tags to the allowed WordPress list. |
68 | 68 | */ |
69 | - public function allow_html_tags_attributes( $tags, $context ) { |
|
70 | - if ( 'post' === $context ) { |
|
69 | + public function allow_html_tags_attributes($tags, $context) { |
|
70 | + if ('post' === $context) { |
|
71 | 71 | $tags['iframe'] = array( |
72 | 72 | 'src' => true, |
73 | 73 | 'height' => true, |
@@ -90,31 +90,31 @@ discard block |
||
90 | 90 | * @param array $classes |
91 | 91 | * @return void |
92 | 92 | */ |
93 | - public function body_classes( $classes = array() ) { |
|
93 | + public function body_classes($classes = array()) { |
|
94 | 94 | global $post; |
95 | 95 | |
96 | - if ( isset( $post->post_content ) && has_shortcode( $post->post_content, 'lsx_health_plan_my_profile_block' ) ) { |
|
96 | + if (isset($post->post_content) && has_shortcode($post->post_content, 'lsx_health_plan_my_profile_block')) { |
|
97 | 97 | $classes[] = 'my-plan-shortcode'; |
98 | 98 | } |
99 | 99 | |
100 | - if ( is_single() && is_singular( 'plan' ) ) { |
|
100 | + if (is_single() && is_singular('plan')) { |
|
101 | 101 | $args = array( |
102 | 102 | 'post_parent' => get_the_ID(), |
103 | 103 | 'post_type' => 'plan', |
104 | 104 | ); |
105 | 105 | |
106 | 106 | $post_id = get_the_ID(); |
107 | - $has_children = get_children( $args ); |
|
108 | - $has_parent = wp_get_post_parent_id( $post_id ); |
|
107 | + $has_children = get_children($args); |
|
108 | + $has_parent = wp_get_post_parent_id($post_id); |
|
109 | 109 | |
110 | - if ( ! empty( $has_children ) ) { |
|
110 | + if ( ! empty($has_children)) { |
|
111 | 111 | $plan_type_class = 'parent-plan-page'; |
112 | - if ( 0 !== $has_parent ) { |
|
112 | + if (0 !== $has_parent) { |
|
113 | 113 | $plan_type_class = 'parent-sub-plan-page'; |
114 | 114 | } |
115 | 115 | } else { |
116 | 116 | $plan_type_class = 'unique-plan-page'; |
117 | - if ( 0 !== $has_parent ) { |
|
117 | + if (0 !== $has_parent) { |
|
118 | 118 | $plan_type_class = 'child-plan-page'; |
119 | 119 | } |
120 | 120 | } |
@@ -126,16 +126,16 @@ discard block |
||
126 | 126 | /** |
127 | 127 | * Remove the single recipe and exercise title |
128 | 128 | */ |
129 | - public function single_title( $title ) { |
|
129 | + public function single_title($title) { |
|
130 | 130 | |
131 | - if ( is_single() && is_singular( 'recipe' ) ) { |
|
131 | + if (is_single() && is_singular('recipe')) { |
|
132 | 132 | |
133 | - $title = __( 'Recipe', 'lsx-health-plan' ); |
|
133 | + $title = __('Recipe', 'lsx-health-plan'); |
|
134 | 134 | } |
135 | 135 | |
136 | - if ( is_single() && is_singular( 'exercise' ) ) { |
|
136 | + if (is_single() && is_singular('exercise')) { |
|
137 | 137 | |
138 | - $title = __( 'Exercise', 'lsx-health-plan' ); |
|
138 | + $title = __('Exercise', 'lsx-health-plan'); |
|
139 | 139 | } |
140 | 140 | |
141 | 141 | return $title; |
@@ -147,8 +147,8 @@ discard block |
||
147 | 147 | * @return void |
148 | 148 | */ |
149 | 149 | public function remove_single_footer() { |
150 | - if ( is_single() && is_singular( array( 'exercise', 'recipe', 'workout', 'meal' ) ) ) { |
|
151 | - remove_action( 'lsx_footer_before', 'lsx_add_footer_sidebar_area' ); |
|
150 | + if (is_single() && is_singular(array('exercise', 'recipe', 'workout', 'meal'))) { |
|
151 | + remove_action('lsx_footer_before', 'lsx_add_footer_sidebar_area'); |
|
152 | 152 | } |
153 | 153 | } |
154 | 154 | } |
@@ -21,9 +21,9 @@ discard block |
||
21 | 21 | * Contructor |
22 | 22 | */ |
23 | 23 | public function __construct() { |
24 | - add_filter( 'template_include', array( $this, 'archive_template_include' ), 99 ); |
|
25 | - add_filter( 'template_include', array( $this, 'single_template_include' ), 99 ); |
|
26 | - add_filter( 'template_include', array( $this, 'taxonomy_template_include' ), 99 ); |
|
24 | + add_filter('template_include', array($this, 'archive_template_include'), 99); |
|
25 | + add_filter('template_include', array($this, 'single_template_include'), 99); |
|
26 | + add_filter('template_include', array($this, 'taxonomy_template_include'), 99); |
|
27 | 27 | } |
28 | 28 | |
29 | 29 | /** |
@@ -35,7 +35,7 @@ discard block |
||
35 | 35 | */ |
36 | 36 | public static function get_instance() { |
37 | 37 | // If the single instance hasn't been set, set it now. |
38 | - if ( null === self::$instance ) { |
|
38 | + if (null === self::$instance) { |
|
39 | 39 | self::$instance = new self(); |
40 | 40 | } |
41 | 41 | return self::$instance; |
@@ -44,11 +44,11 @@ discard block |
||
44 | 44 | /** |
45 | 45 | * Archive template. |
46 | 46 | */ |
47 | - public function archive_template_include( $template ) { |
|
48 | - $applicable_post_types = apply_filters( 'lsx_health_plan_archive_template', array() ); |
|
49 | - if ( ! empty( $applicable_post_types ) && is_main_query() && is_post_type_archive( $applicable_post_types ) ) { |
|
47 | + public function archive_template_include($template) { |
|
48 | + $applicable_post_types = apply_filters('lsx_health_plan_archive_template', array()); |
|
49 | + if ( ! empty($applicable_post_types) && is_main_query() && is_post_type_archive($applicable_post_types)) { |
|
50 | 50 | $post_type = get_post_type(); |
51 | - if ( empty( locate_template( array( 'archive-' . $post_type . '.php' ) ) ) && file_exists( LSX_HEALTH_PLAN_PATH . 'templates/archive-' . $post_type . '.php' ) ) { |
|
51 | + if (empty(locate_template(array('archive-' . $post_type . '.php'))) && file_exists(LSX_HEALTH_PLAN_PATH . 'templates/archive-' . $post_type . '.php')) { |
|
52 | 52 | $template = LSX_HEALTH_PLAN_PATH . 'templates/archive-' . $post_type . '.php'; |
53 | 53 | } |
54 | 54 | } |
@@ -58,11 +58,11 @@ discard block |
||
58 | 58 | /** |
59 | 59 | * Single template. |
60 | 60 | */ |
61 | - public function single_template_include( $template ) { |
|
62 | - $applicable_post_types = apply_filters( 'lsx_health_plan_single_template', array() ); |
|
63 | - if ( ! empty( $applicable_post_types ) && is_main_query() && is_singular( $applicable_post_types ) ) { |
|
61 | + public function single_template_include($template) { |
|
62 | + $applicable_post_types = apply_filters('lsx_health_plan_single_template', array()); |
|
63 | + if ( ! empty($applicable_post_types) && is_main_query() && is_singular($applicable_post_types)) { |
|
64 | 64 | $post_type = get_post_type(); |
65 | - if ( empty( locate_template( array( 'single-' . $post_type . '.php' ) ) ) && file_exists( LSX_HEALTH_PLAN_PATH . 'templates/single-' . $post_type . '.php' ) ) { |
|
65 | + if (empty(locate_template(array('single-' . $post_type . '.php'))) && file_exists(LSX_HEALTH_PLAN_PATH . 'templates/single-' . $post_type . '.php')) { |
|
66 | 66 | $template = LSX_HEALTH_PLAN_PATH . 'templates/single-' . $post_type . '.php'; |
67 | 67 | } |
68 | 68 | } |
@@ -75,11 +75,11 @@ discard block |
||
75 | 75 | * @param $template string |
76 | 76 | * @return string |
77 | 77 | */ |
78 | - public function taxonomy_template_include( $template ) { |
|
79 | - $applicable_taxonomies = apply_filters( 'lsx_health_plan_taxonomies_template', array() ); |
|
80 | - if ( is_main_query() && is_tax( $applicable_taxonomies ) ) { |
|
81 | - $current_taxonomy = get_query_var( 'taxonomy' ); |
|
82 | - if ( '' === locate_template( array( 'taxonomy-' . $current_taxonomy . '.php' ) ) && file_exists( LSX_HEALTH_PLAN_PATH . 'templates/taxonomy-' . $current_taxonomy . '.php' ) ) { |
|
78 | + public function taxonomy_template_include($template) { |
|
79 | + $applicable_taxonomies = apply_filters('lsx_health_plan_taxonomies_template', array()); |
|
80 | + if (is_main_query() && is_tax($applicable_taxonomies)) { |
|
81 | + $current_taxonomy = get_query_var('taxonomy'); |
|
82 | + if ('' === locate_template(array('taxonomy-' . $current_taxonomy . '.php')) && file_exists(LSX_HEALTH_PLAN_PATH . 'templates/taxonomy-' . $current_taxonomy . '.php')) { |
|
83 | 83 | $template = LSX_HEALTH_PLAN_PATH . 'templates/taxonomy-' . $current_taxonomy . '.php'; |
84 | 84 | } |
85 | 85 | } |
@@ -21,7 +21,7 @@ discard block |
||
21 | 21 | * Contructor |
22 | 22 | */ |
23 | 23 | public function __construct() { |
24 | - add_action( 'init', array( $this, 'handle_day_action' ), 100 ); |
|
24 | + add_action('init', array($this, 'handle_day_action'), 100); |
|
25 | 25 | } |
26 | 26 | |
27 | 27 | /** |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | */ |
34 | 34 | public static function get_instance() { |
35 | 35 | // If the single instance hasn't been set, set it now. |
36 | - if ( null === self::$instance ) { |
|
36 | + if (null === self::$instance) { |
|
37 | 37 | self::$instance = new self(); |
38 | 38 | } |
39 | 39 | return self::$instance; |
@@ -43,18 +43,18 @@ discard block |
||
43 | 43 | * Registers the rewrites. |
44 | 44 | */ |
45 | 45 | public function handle_day_action() { |
46 | - if ( isset( $_POST['lsx-health-plan-actions'] ) && wp_verify_nonce( $_POST['lsx-health-plan-actions'], 'complete' ) ) { |
|
47 | - update_user_meta( get_current_user_id(), 'day_' . sanitize_key( $_POST['lsx-health-plan-id'] ) . '_complete', true ); |
|
48 | - $plan_id = sanitize_key( $_POST['lsx-health-plan-id'] ); |
|
49 | - $plan_parent = wp_get_post_parent_id( $plan_id ); |
|
50 | - if ( 0 !== $plan_parent ) { |
|
46 | + if (isset($_POST['lsx-health-plan-actions']) && wp_verify_nonce($_POST['lsx-health-plan-actions'], 'complete')) { |
|
47 | + update_user_meta(get_current_user_id(), 'day_' . sanitize_key($_POST['lsx-health-plan-id']) . '_complete', true); |
|
48 | + $plan_id = sanitize_key($_POST['lsx-health-plan-id']); |
|
49 | + $plan_parent = wp_get_post_parent_id($plan_id); |
|
50 | + if (0 !== $plan_parent) { |
|
51 | 51 | $plan_id = $plan_parent; |
52 | 52 | } |
53 | - wp_safe_redirect( get_permalink( $plan_id ) ); |
|
53 | + wp_safe_redirect(get_permalink($plan_id)); |
|
54 | 54 | } |
55 | 55 | |
56 | - if ( isset( $_POST['lsx-health-plan-actions'] ) && wp_verify_nonce( $_POST['lsx-health-plan-actions'], 'unlock' ) ) { |
|
57 | - delete_user_meta( get_current_user_id(), 'day_' . sanitize_key( $_POST['lsx-health-plan-id'] ) . '_complete' ); |
|
56 | + if (isset($_POST['lsx-health-plan-actions']) && wp_verify_nonce($_POST['lsx-health-plan-actions'], 'unlock')) { |
|
57 | + delete_user_meta(get_current_user_id(), 'day_' . sanitize_key($_POST['lsx-health-plan-id']) . '_complete'); |
|
58 | 58 | } |
59 | 59 | } |
60 | 60 | } |