@@ -737,7 +737,7 @@ |
||
737 | 737 | |
738 | 738 | /** |
739 | 739 | * Add Lets Enrypt and PayFast logos to cart. |
740 | - **/ |
|
740 | + **/ |
|
741 | 741 | public function payment_gateway_logos() { |
742 | 742 | $encript_image = LSX_HEALTH_PLAN_URL . 'assets/images/lets-encript.svg'; |
743 | 743 | $payfast_image = LSX_HEALTH_PLAN_URL . 'assets/images/payfast-footer-logo.svg'; |
@@ -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 | } |
@@ -7,12 +7,12 @@ |
||
7 | 7 | |
8 | 8 | lsx_entry_before(); |
9 | 9 | $tip_id = get_the_id(); |
10 | -$featured_image = get_the_post_thumbnail( $tip_id, array( 600, 300 ) ); |
|
10 | +$featured_image = get_the_post_thumbnail($tip_id, array(600, 300)); |
|
11 | 11 | ?> |
12 | 12 | <div class="content-box diet-tip-wrapper quick-tip"> |
13 | 13 | <div class="row"> |
14 | 14 | <div class="col-lg-1 col-md-1 col-sm-1 col-xs-2"> |
15 | - <?php lsx_get_svg_icon( 'tips-icon.svg' ); ?> |
|
15 | + <?php lsx_get_svg_icon('tips-icon.svg'); ?> |
|
16 | 16 | </div> |
17 | 17 | <div class="col-lg-11 col-md-11 col-sm-11 col-xs-10"> |
18 | 18 | <h3 class="tip-title"><?php the_title(); ?></h3> |
@@ -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 |
@@ -30,12 +30,12 @@ discard block |
||
30 | 30 | * Contructor |
31 | 31 | */ |
32 | 32 | public function __construct() { |
33 | - add_action( 'init', array( $this, 'register_post_type' ) ); |
|
33 | + add_action('init', array($this, 'register_post_type')); |
|
34 | 34 | |
35 | - add_filter( 'lsx_health_plan_single_template', array( $this, 'enable_post_type' ), 10, 1 ); |
|
36 | - add_filter( 'lsx_health_plan_connections', array( $this, 'enable_connections' ), 10, 1 ); |
|
35 | + add_filter('lsx_health_plan_single_template', array($this, 'enable_post_type'), 10, 1); |
|
36 | + add_filter('lsx_health_plan_connections', array($this, 'enable_connections'), 10, 1); |
|
37 | 37 | |
38 | - add_action( 'cmb2_admin_init', array( $this, 'details_metaboxes' ) ); |
|
38 | + add_action('cmb2_admin_init', array($this, 'details_metaboxes')); |
|
39 | 39 | } |
40 | 40 | |
41 | 41 | /** |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | */ |
48 | 48 | public static function get_instance() { |
49 | 49 | // If the single instance hasn't been set, set it now. |
50 | - if ( null === self::$instance ) { |
|
50 | + if (null === self::$instance) { |
|
51 | 51 | self::$instance = new self(); |
52 | 52 | } |
53 | 53 | return self::$instance; |
@@ -57,21 +57,21 @@ discard block |
||
57 | 57 | */ |
58 | 58 | public function register_post_type() { |
59 | 59 | $labels = array( |
60 | - 'name' => esc_html__( 'Meals', 'lsx-health-plan' ), |
|
61 | - 'singular_name' => esc_html__( 'Meal', 'lsx-health-plan' ), |
|
62 | - 'add_new' => esc_html_x( 'Add New', 'post type general name', 'lsx-health-plan' ), |
|
63 | - 'add_new_item' => esc_html__( 'Add New', 'lsx-health-plan' ), |
|
64 | - 'edit_item' => esc_html__( 'Edit', 'lsx-health-plan' ), |
|
65 | - 'new_item' => esc_html__( 'New', 'lsx-health-plan' ), |
|
66 | - 'all_items' => esc_html__( 'All Meals', 'lsx-health-plan' ), |
|
67 | - 'view_item' => esc_html__( 'View', 'lsx-health-plan' ), |
|
68 | - 'search_items' => esc_html__( 'Search', 'lsx-health-plan' ), |
|
69 | - 'not_found' => esc_html__( 'None found', 'lsx-health-plan' ), |
|
70 | - 'not_found_in_trash' => esc_html__( 'None found in Trash', 'lsx-health-plan' ), |
|
60 | + 'name' => esc_html__('Meals', 'lsx-health-plan'), |
|
61 | + 'singular_name' => esc_html__('Meal', 'lsx-health-plan'), |
|
62 | + 'add_new' => esc_html_x('Add New', 'post type general name', 'lsx-health-plan'), |
|
63 | + 'add_new_item' => esc_html__('Add New', 'lsx-health-plan'), |
|
64 | + 'edit_item' => esc_html__('Edit', 'lsx-health-plan'), |
|
65 | + 'new_item' => esc_html__('New', 'lsx-health-plan'), |
|
66 | + 'all_items' => esc_html__('All Meals', 'lsx-health-plan'), |
|
67 | + 'view_item' => esc_html__('View', 'lsx-health-plan'), |
|
68 | + 'search_items' => esc_html__('Search', 'lsx-health-plan'), |
|
69 | + 'not_found' => esc_html__('None found', 'lsx-health-plan'), |
|
70 | + 'not_found_in_trash' => esc_html__('None found in Trash', 'lsx-health-plan'), |
|
71 | 71 | 'parent_item_colon' => '', |
72 | - 'menu_name' => esc_html__( 'Meals', 'lsx-health-plan' ), |
|
72 | + 'menu_name' => esc_html__('Meals', 'lsx-health-plan'), |
|
73 | 73 | ); |
74 | - $args = array( |
|
74 | + $args = array( |
|
75 | 75 | 'labels' => $labels, |
76 | 76 | 'public' => true, |
77 | 77 | 'publicly_queryable' => true, |
@@ -81,10 +81,10 @@ discard block |
||
81 | 81 | 'menu_icon' => 'dashicons-carrot', |
82 | 82 | 'query_var' => true, |
83 | 83 | 'rewrite' => array( |
84 | - 'slug' => \lsx_health_plan\functions\get_option( 'meal_single_slug', 'meal' ), |
|
84 | + 'slug' => \lsx_health_plan\functions\get_option('meal_single_slug', 'meal'), |
|
85 | 85 | ), |
86 | 86 | 'capability_type' => 'post', |
87 | - 'has_archive' => \lsx_health_plan\functions\get_option( 'endpoint_meal_archive', 'meals' ), |
|
87 | + 'has_archive' => \lsx_health_plan\functions\get_option('endpoint_meal_archive', 'meals'), |
|
88 | 88 | 'hierarchical' => true, |
89 | 89 | 'menu_position' => null, |
90 | 90 | 'supports' => array( |
@@ -95,7 +95,7 @@ discard block |
||
95 | 95 | 'custom-fields', |
96 | 96 | ), |
97 | 97 | ); |
98 | - register_post_type( 'meal', $args ); |
|
98 | + register_post_type('meal', $args); |
|
99 | 99 | } |
100 | 100 | |
101 | 101 | /** |
@@ -104,7 +104,7 @@ discard block |
||
104 | 104 | * @param array $post_types |
105 | 105 | * @return array |
106 | 106 | */ |
107 | - public function enable_post_type( $post_types = array() ) { |
|
107 | + public function enable_post_type($post_types = array()) { |
|
108 | 108 | $post_types[] = $this->slug; |
109 | 109 | return $post_types; |
110 | 110 | } |
@@ -115,7 +115,7 @@ discard block |
||
115 | 115 | * @param array $connections |
116 | 116 | * @return void |
117 | 117 | */ |
118 | - public function enable_connections( $connections = array() ) { |
|
118 | + public function enable_connections($connections = array()) { |
|
119 | 119 | $connections['meal']['connected_plans'] = 'connected_meals'; |
120 | 120 | $connections['plan']['connected_meals'] = 'connected_plans'; |
121 | 121 | return $connections; |
@@ -125,66 +125,66 @@ discard block |
||
125 | 125 | * Define the metabox and field configurations. |
126 | 126 | */ |
127 | 127 | public function details_metaboxes() { |
128 | - $cmb = new_cmb2_box( array( |
|
128 | + $cmb = new_cmb2_box(array( |
|
129 | 129 | 'id' => $this->slug . '_shopping_list_metabox', |
130 | - 'title' => __( 'Shopping List', 'lsx-health-plan' ), |
|
131 | - 'object_types' => array( $this->slug ), // Post type |
|
130 | + 'title' => __('Shopping List', 'lsx-health-plan'), |
|
131 | + 'object_types' => array($this->slug), // Post type |
|
132 | 132 | 'context' => 'normal', |
133 | 133 | 'priority' => 'high', |
134 | 134 | 'show_names' => true, |
135 | - ) ); |
|
136 | - $cmb->add_field( array( |
|
137 | - 'name' => __( 'Shopping List', 'lsx-health-plan' ), |
|
138 | - 'desc' => __( 'Connect the shopping list page that applies to this meal by entering the name of the page in the field provided.' ), |
|
135 | + )); |
|
136 | + $cmb->add_field(array( |
|
137 | + 'name' => __('Shopping List', 'lsx-health-plan'), |
|
138 | + 'desc' => __('Connect the shopping list page that applies to this meal by entering the name of the page in the field provided.'), |
|
139 | 139 | 'id' => $this->slug . '_shopping_list', |
140 | 140 | 'type' => 'post_search_ajax', |
141 | 141 | // Optional : |
142 | - 'limit' => 1, // Limit selection to X items only (default 1) |
|
142 | + 'limit' => 1, // Limit selection to X items only (default 1) |
|
143 | 143 | 'sortable' => true, // Allow selected items to be sortable (default false) |
144 | 144 | 'query_args' => array( |
145 | - 'post_type' => array( 'page' ), |
|
146 | - 'post_status' => array( 'publish' ), |
|
145 | + 'post_type' => array('page'), |
|
146 | + 'post_status' => array('publish'), |
|
147 | 147 | 'posts_per_page' => -1, |
148 | 148 | ), |
149 | - ) ); |
|
150 | - $cmb = new_cmb2_box( array( |
|
149 | + )); |
|
150 | + $cmb = new_cmb2_box(array( |
|
151 | 151 | 'id' => $this->slug . '_details_metabox', |
152 | - 'title' => __( 'Meal Details', 'lsx-health-plan' ), |
|
153 | - 'object_types' => array( $this->slug ), // Post type |
|
152 | + 'title' => __('Meal Details', 'lsx-health-plan'), |
|
153 | + 'object_types' => array($this->slug), // Post type |
|
154 | 154 | 'context' => 'normal', |
155 | 155 | 'priority' => 'high', |
156 | 156 | 'show_names' => true, |
157 | - ) ); |
|
157 | + )); |
|
158 | 158 | |
159 | - $cmb->add_field( array( |
|
160 | - 'name' => __( 'Meal Short Description', 'lsx-health-plan' ), |
|
159 | + $cmb->add_field(array( |
|
160 | + 'name' => __('Meal Short Description', 'lsx-health-plan'), |
|
161 | 161 | 'id' => $this->slug . '_short_description', |
162 | 162 | 'type' => 'textarea_small', |
163 | - 'desc' => __( 'Add a small description for this meal (optional)', 'lsx-health-plan' ), |
|
164 | - ) ); |
|
163 | + 'desc' => __('Add a small description for this meal (optional)', 'lsx-health-plan'), |
|
164 | + )); |
|
165 | 165 | |
166 | - $cmb->add_field( array( |
|
167 | - 'name' => __( 'Pre Breakfast Snack', 'lsx-health-plan' ), |
|
166 | + $cmb->add_field(array( |
|
167 | + 'name' => __('Pre Breakfast Snack', 'lsx-health-plan'), |
|
168 | 168 | 'id' => $this->slug . '_pre_breakfast_snack', |
169 | 169 | 'type' => 'wysiwyg', |
170 | 170 | 'show_on_cb' => 'cmb2_hide_if_no_cats', |
171 | 171 | 'options' => array( |
172 | 172 | 'textarea_rows' => 5, |
173 | 173 | ), |
174 | - ) ); |
|
175 | - $cmb->add_field( array( |
|
176 | - 'name' => __( 'Breakfast', 'lsx-health-plan' ), |
|
174 | + )); |
|
175 | + $cmb->add_field(array( |
|
176 | + 'name' => __('Breakfast', 'lsx-health-plan'), |
|
177 | 177 | 'id' => $this->slug . '_breakfast', |
178 | 178 | 'type' => 'wysiwyg', |
179 | 179 | 'show_on_cb' => 'cmb2_hide_if_no_cats', |
180 | 180 | 'options' => array( |
181 | 181 | 'textarea_rows' => 5, |
182 | 182 | ), |
183 | - ) ); |
|
183 | + )); |
|
184 | 184 | |
185 | 185 | $cmb->add_field( |
186 | 186 | array( |
187 | - 'name' => __( 'Post Breakfast Snack', 'lsx-health-plan' ), |
|
187 | + 'name' => __('Post Breakfast Snack', 'lsx-health-plan'), |
|
188 | 188 | 'id' => $this->slug . '_breakfast_snack', |
189 | 189 | 'type' => 'wysiwyg', |
190 | 190 | 'show_on_cb' => 'cmb2_hide_if_no_cats', |
@@ -194,19 +194,19 @@ discard block |
||
194 | 194 | ) |
195 | 195 | ); |
196 | 196 | |
197 | - if ( post_type_exists( 'recipe' ) ) { |
|
197 | + if (post_type_exists('recipe')) { |
|
198 | 198 | $cmb->add_field( |
199 | 199 | array( |
200 | - 'name' => __( 'Breakfast Recipes', 'lsx-health-plan' ), |
|
201 | - 'desc' => __( 'Connect additional recipes options for breakfast.', 'lsx-health-plan' ), |
|
200 | + 'name' => __('Breakfast Recipes', 'lsx-health-plan'), |
|
201 | + 'desc' => __('Connect additional recipes options for breakfast.', 'lsx-health-plan'), |
|
202 | 202 | 'id' => 'breakfast_recipes', |
203 | 203 | 'type' => 'post_search_ajax', |
204 | 204 | // Optional : |
205 | - 'limit' => 15, // Limit selection to X items only (default 1) |
|
205 | + 'limit' => 15, // Limit selection to X items only (default 1) |
|
206 | 206 | 'sortable' => true, // Allow selected items to be sortable (default false) |
207 | 207 | 'query_args' => array( |
208 | - 'post_type' => array( 'recipe' ), |
|
209 | - 'post_status' => array( 'publish' ), |
|
208 | + 'post_type' => array('recipe'), |
|
209 | + 'post_status' => array('publish'), |
|
210 | 210 | 'posts_per_page' => -1, |
211 | 211 | ), |
212 | 212 | ) |
@@ -215,7 +215,7 @@ discard block |
||
215 | 215 | |
216 | 216 | $cmb->add_field( |
217 | 217 | array( |
218 | - 'name' => __( 'Pre Lunch Snack', 'lsx-health-plan' ), |
|
218 | + 'name' => __('Pre Lunch Snack', 'lsx-health-plan'), |
|
219 | 219 | 'id' => $this->slug . '_pre_lunch_snack', |
220 | 220 | 'type' => 'wysiwyg', |
221 | 221 | 'show_on_cb' => 'cmb2_hide_if_no_cats', |
@@ -226,7 +226,7 @@ discard block |
||
226 | 226 | ); |
227 | 227 | $cmb->add_field( |
228 | 228 | array( |
229 | - 'name' => __( 'Lunch', 'lsx-health-plan' ), |
|
229 | + 'name' => __('Lunch', 'lsx-health-plan'), |
|
230 | 230 | 'id' => $this->slug . '_lunch', |
231 | 231 | 'type' => 'wysiwyg', |
232 | 232 | 'show_on_cb' => 'cmb2_hide_if_no_cats', |
@@ -237,7 +237,7 @@ discard block |
||
237 | 237 | ); |
238 | 238 | $cmb->add_field( |
239 | 239 | array( |
240 | - 'name' => __( 'Post Lunch Snack', 'lsx-health-plan' ), |
|
240 | + 'name' => __('Post Lunch Snack', 'lsx-health-plan'), |
|
241 | 241 | 'id' => $this->slug . '_lunch_snack', |
242 | 242 | 'type' => 'wysiwyg', |
243 | 243 | 'show_on_cb' => 'cmb2_hide_if_no_cats', |
@@ -247,19 +247,19 @@ discard block |
||
247 | 247 | ) |
248 | 248 | ); |
249 | 249 | |
250 | - if ( post_type_exists( 'recipe' ) ) { |
|
250 | + if (post_type_exists('recipe')) { |
|
251 | 251 | $cmb->add_field( |
252 | 252 | array( |
253 | - 'name' => __( 'Lunch Recipes', 'lsx-health-plan' ), |
|
254 | - 'desc' => __( 'Connect additional recipes options for lunch.', 'lsx-health-plan' ), |
|
253 | + 'name' => __('Lunch Recipes', 'lsx-health-plan'), |
|
254 | + 'desc' => __('Connect additional recipes options for lunch.', 'lsx-health-plan'), |
|
255 | 255 | 'id' => 'lunch_recipes', |
256 | 256 | 'type' => 'post_search_ajax', |
257 | 257 | // Optional : |
258 | - 'limit' => 15, // Limit selection to X items only (default 1) |
|
258 | + 'limit' => 15, // Limit selection to X items only (default 1) |
|
259 | 259 | 'sortable' => true, // Allow selected items to be sortable (default false) |
260 | 260 | 'query_args' => array( |
261 | - 'post_type' => array( 'recipe' ), |
|
262 | - 'post_status' => array( 'publish' ), |
|
261 | + 'post_type' => array('recipe'), |
|
262 | + 'post_status' => array('publish'), |
|
263 | 263 | 'posts_per_page' => -1, |
264 | 264 | ), |
265 | 265 | ) |
@@ -268,7 +268,7 @@ discard block |
||
268 | 268 | |
269 | 269 | $cmb->add_field( |
270 | 270 | array( |
271 | - 'name' => __( 'Pre Dinner Snack', 'lsx-health-plan' ), |
|
271 | + 'name' => __('Pre Dinner Snack', 'lsx-health-plan'), |
|
272 | 272 | 'id' => $this->slug . '_pre_dinner_snack', |
273 | 273 | 'type' => 'wysiwyg', |
274 | 274 | 'show_on_cb' => 'cmb2_hide_if_no_cats', |
@@ -279,7 +279,7 @@ discard block |
||
279 | 279 | ); |
280 | 280 | $cmb->add_field( |
281 | 281 | array( |
282 | - 'name' => __( 'Dinner', 'lsx-health-plan' ), |
|
282 | + 'name' => __('Dinner', 'lsx-health-plan'), |
|
283 | 283 | 'id' => $this->slug . '_dinner', |
284 | 284 | 'type' => 'wysiwyg', |
285 | 285 | 'show_on_cb' => 'cmb2_hide_if_no_cats', |
@@ -290,7 +290,7 @@ discard block |
||
290 | 290 | ); |
291 | 291 | $cmb->add_field( |
292 | 292 | array( |
293 | - 'name' => __( 'Post Dinner Snack', 'lsx-health-plan' ), |
|
293 | + 'name' => __('Post Dinner Snack', 'lsx-health-plan'), |
|
294 | 294 | 'id' => $this->slug . '_dinner_snack', |
295 | 295 | 'type' => 'wysiwyg', |
296 | 296 | 'show_on_cb' => 'cmb2_hide_if_no_cats', |
@@ -300,19 +300,19 @@ discard block |
||
300 | 300 | ) |
301 | 301 | ); |
302 | 302 | |
303 | - if ( post_type_exists( 'recipe' ) ) { |
|
303 | + if (post_type_exists('recipe')) { |
|
304 | 304 | $cmb->add_field( |
305 | 305 | array( |
306 | - 'name' => __( 'Dinner Recipes', 'lsx-health-plan' ), |
|
307 | - 'desc' => __( 'Connect additional recipes options for dinner.', 'lsx-health-plan' ), |
|
306 | + 'name' => __('Dinner Recipes', 'lsx-health-plan'), |
|
307 | + 'desc' => __('Connect additional recipes options for dinner.', 'lsx-health-plan'), |
|
308 | 308 | 'id' => 'dinner_recipes', |
309 | 309 | 'type' => 'post_search_ajax', |
310 | 310 | // Optional : |
311 | - 'limit' => 15, // Limit selection to X items only (default 1) |
|
311 | + 'limit' => 15, // Limit selection to X items only (default 1) |
|
312 | 312 | 'sortable' => true, // Allow selected items to be sortable (default false) |
313 | 313 | 'query_args' => array( |
314 | - 'post_type' => array( 'recipe' ), |
|
315 | - 'post_status' => array( 'publish' ), |
|
314 | + 'post_type' => array('recipe'), |
|
315 | + 'post_status' => array('publish'), |
|
316 | 316 | 'posts_per_page' => -1, |
317 | 317 | ), |
318 | 318 | ) |
@@ -32,16 +32,16 @@ discard block |
||
32 | 32 | * Contructor |
33 | 33 | */ |
34 | 34 | public function __construct() { |
35 | - add_action( 'init', array( $this, 'register_post_type' ) ); |
|
36 | - add_filter( 'lsx_health_plan_single_template', array( $this, 'enable_post_type' ), 10, 1 ); |
|
37 | - add_action( 'init', array( $this, 'recipe_type_taxonomy_setup' ) ); |
|
38 | - add_filter( 'lsx_health_plan_connections', array( $this, 'enable_connections' ), 10, 1 ); |
|
39 | - add_action( 'cmb2_admin_init', array( $this, 'details_metaboxes' ) ); |
|
40 | - add_action( 'lsx_hp_settings_page', array( $this, 'register_settings' ), 8, 1 ); |
|
41 | - add_filter( 'get_the_archive_title', array( $this, 'get_the_archive_title' ), 100 ); |
|
35 | + add_action('init', array($this, 'register_post_type')); |
|
36 | + add_filter('lsx_health_plan_single_template', array($this, 'enable_post_type'), 10, 1); |
|
37 | + add_action('init', array($this, 'recipe_type_taxonomy_setup')); |
|
38 | + add_filter('lsx_health_plan_connections', array($this, 'enable_connections'), 10, 1); |
|
39 | + add_action('cmb2_admin_init', array($this, 'details_metaboxes')); |
|
40 | + add_action('lsx_hp_settings_page', array($this, 'register_settings'), 8, 1); |
|
41 | + add_filter('get_the_archive_title', array($this, 'get_the_archive_title'), 100); |
|
42 | 42 | |
43 | 43 | // Template Redirects. |
44 | - add_filter( 'lsx_health_plan_archive_template', array( $this, 'enable_post_type' ), 10, 1 ); |
|
44 | + add_filter('lsx_health_plan_archive_template', array($this, 'enable_post_type'), 10, 1); |
|
45 | 45 | } |
46 | 46 | |
47 | 47 | /** |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | */ |
54 | 54 | public static function get_instance() { |
55 | 55 | // If the single instance hasn't been set, set it now. |
56 | - if ( null === self::$instance ) { |
|
56 | + if (null === self::$instance) { |
|
57 | 57 | self::$instance = new self(); |
58 | 58 | } |
59 | 59 | return self::$instance; |
@@ -63,19 +63,19 @@ discard block |
||
63 | 63 | */ |
64 | 64 | public function register_post_type() { |
65 | 65 | $labels = array( |
66 | - 'name' => esc_html__( 'Workouts', 'lsx-health-plan' ), |
|
67 | - 'singular_name' => esc_html__( 'Workout', 'lsx-health-plan' ), |
|
68 | - 'add_new' => esc_html_x( 'Add New', 'post type general name', 'lsx-health-plan' ), |
|
69 | - 'add_new_item' => esc_html__( 'Add New', 'lsx-health-plan' ), |
|
70 | - 'edit_item' => esc_html__( 'Edit', 'lsx-health-plan' ), |
|
71 | - 'new_item' => esc_html__( 'New', 'lsx-health-plan' ), |
|
72 | - 'all_items' => esc_html__( 'All Workouts', 'lsx-health-plan' ), |
|
73 | - 'view_item' => esc_html__( 'View', 'lsx-health-plan' ), |
|
74 | - 'search_items' => esc_html__( 'Search', 'lsx-health-plan' ), |
|
75 | - 'not_found' => esc_html__( 'None found', 'lsx-health-plan' ), |
|
76 | - 'not_found_in_trash' => esc_html__( 'None found in Trash', 'lsx-health-plan' ), |
|
66 | + 'name' => esc_html__('Workouts', 'lsx-health-plan'), |
|
67 | + 'singular_name' => esc_html__('Workout', 'lsx-health-plan'), |
|
68 | + 'add_new' => esc_html_x('Add New', 'post type general name', 'lsx-health-plan'), |
|
69 | + 'add_new_item' => esc_html__('Add New', 'lsx-health-plan'), |
|
70 | + 'edit_item' => esc_html__('Edit', 'lsx-health-plan'), |
|
71 | + 'new_item' => esc_html__('New', 'lsx-health-plan'), |
|
72 | + 'all_items' => esc_html__('All Workouts', 'lsx-health-plan'), |
|
73 | + 'view_item' => esc_html__('View', 'lsx-health-plan'), |
|
74 | + 'search_items' => esc_html__('Search', 'lsx-health-plan'), |
|
75 | + 'not_found' => esc_html__('None found', 'lsx-health-plan'), |
|
76 | + 'not_found_in_trash' => esc_html__('None found in Trash', 'lsx-health-plan'), |
|
77 | 77 | 'parent_item_colon' => '', |
78 | - 'menu_name' => esc_html__( 'Workouts', 'lsx-health-plan' ), |
|
78 | + 'menu_name' => esc_html__('Workouts', 'lsx-health-plan'), |
|
79 | 79 | ); |
80 | 80 | $args = array( |
81 | 81 | 'labels' => $labels, |
@@ -87,10 +87,10 @@ discard block |
||
87 | 87 | 'menu_icon' => 'dashicons-universal-access', |
88 | 88 | 'query_var' => true, |
89 | 89 | 'rewrite' => array( |
90 | - 'slug' => \lsx_health_plan\functions\get_option( 'endpoint_workout', 'workout' ), |
|
90 | + 'slug' => \lsx_health_plan\functions\get_option('endpoint_workout', 'workout'), |
|
91 | 91 | ), |
92 | 92 | 'capability_type' => 'page', |
93 | - 'has_archive' => \lsx_health_plan\functions\get_option( 'endpoint_workout_archive', 'workouts' ), |
|
93 | + 'has_archive' => \lsx_health_plan\functions\get_option('endpoint_workout_archive', 'workouts'), |
|
94 | 94 | 'hierarchical' => true, |
95 | 95 | 'menu_position' => null, |
96 | 96 | 'supports' => array( |
@@ -102,7 +102,7 @@ discard block |
||
102 | 102 | 'custom-fields', |
103 | 103 | ), |
104 | 104 | ); |
105 | - register_post_type( 'workout', $args ); |
|
105 | + register_post_type('workout', $args); |
|
106 | 106 | } |
107 | 107 | |
108 | 108 | /** |
@@ -110,17 +110,17 @@ discard block |
||
110 | 110 | */ |
111 | 111 | public function recipe_type_taxonomy_setup() { |
112 | 112 | $labels = array( |
113 | - 'name' => esc_html_x( 'Workout Type', 'taxonomy general name', 'lsx-health-plan' ), |
|
114 | - 'singular_name' => esc_html_x( 'Workout Type', 'taxonomy singular name', 'lsx-health-plan' ), |
|
115 | - 'search_items' => esc_html__( 'Search', 'lsx-health-plan' ), |
|
116 | - 'all_items' => esc_html__( 'All', 'lsx-health-plan' ), |
|
117 | - 'parent_item' => esc_html__( 'Parent', 'lsx-health-plan' ), |
|
118 | - 'parent_item_colon' => esc_html__( 'Parent:', 'lsx-health-plan' ), |
|
119 | - 'edit_item' => esc_html__( 'Edit', 'lsx-health-plan' ), |
|
120 | - 'update_item' => esc_html__( 'Update', 'lsx-health-plan' ), |
|
121 | - 'add_new_item' => esc_html__( 'Add New', 'lsx-health-plan' ), |
|
122 | - 'new_item_name' => esc_html__( 'New Name', 'lsx-health-plan' ), |
|
123 | - 'menu_name' => esc_html__( 'Workout Types', 'lsx-health-plan' ), |
|
113 | + 'name' => esc_html_x('Workout Type', 'taxonomy general name', 'lsx-health-plan'), |
|
114 | + 'singular_name' => esc_html_x('Workout Type', 'taxonomy singular name', 'lsx-health-plan'), |
|
115 | + 'search_items' => esc_html__('Search', 'lsx-health-plan'), |
|
116 | + 'all_items' => esc_html__('All', 'lsx-health-plan'), |
|
117 | + 'parent_item' => esc_html__('Parent', 'lsx-health-plan'), |
|
118 | + 'parent_item_colon' => esc_html__('Parent:', 'lsx-health-plan'), |
|
119 | + 'edit_item' => esc_html__('Edit', 'lsx-health-plan'), |
|
120 | + 'update_item' => esc_html__('Update', 'lsx-health-plan'), |
|
121 | + 'add_new_item' => esc_html__('Add New', 'lsx-health-plan'), |
|
122 | + 'new_item_name' => esc_html__('New Name', 'lsx-health-plan'), |
|
123 | + 'menu_name' => esc_html__('Workout Types', 'lsx-health-plan'), |
|
124 | 124 | ); |
125 | 125 | |
126 | 126 | $args = array( |
@@ -134,7 +134,7 @@ discard block |
||
134 | 134 | ), |
135 | 135 | ); |
136 | 136 | |
137 | - register_taxonomy( 'workout-type', array( 'workout' ), $args ); |
|
137 | + register_taxonomy('workout-type', array('workout'), $args); |
|
138 | 138 | } |
139 | 139 | |
140 | 140 | /** |
@@ -143,7 +143,7 @@ discard block |
||
143 | 143 | * @param array $post_types |
144 | 144 | * @return array |
145 | 145 | */ |
146 | - public function enable_post_type( $post_types = array() ) { |
|
146 | + public function enable_post_type($post_types = array()) { |
|
147 | 147 | $post_types[] = $this->slug; |
148 | 148 | return $post_types; |
149 | 149 | } |
@@ -154,7 +154,7 @@ discard block |
||
154 | 154 | * @param array $connections |
155 | 155 | * @return void |
156 | 156 | */ |
157 | - public function enable_connections( $connections = array() ) { |
|
157 | + public function enable_connections($connections = array()) { |
|
158 | 158 | $connections['workout']['connected_plans'] = 'connected_workouts'; |
159 | 159 | $connections['plan']['connected_workouts'] = 'connected_plans'; |
160 | 160 | |
@@ -172,9 +172,9 @@ discard block |
||
172 | 172 | * @param string $title the term title. |
173 | 173 | * @return string |
174 | 174 | */ |
175 | - public function get_the_archive_title( $title ) { |
|
176 | - if ( is_post_type_archive( 'workout' ) ) { |
|
177 | - $title = __( 'Workouts', 'lsx-health-plan' ); |
|
175 | + public function get_the_archive_title($title) { |
|
176 | + if (is_post_type_archive('workout')) { |
|
177 | + $title = __('Workouts', 'lsx-health-plan'); |
|
178 | 178 | } |
179 | 179 | return $title; |
180 | 180 | } |
@@ -184,43 +184,43 @@ discard block |
||
184 | 184 | */ |
185 | 185 | public function details_metaboxes() { |
186 | 186 | |
187 | - $cmb = new_cmb2_box( array( |
|
187 | + $cmb = new_cmb2_box(array( |
|
188 | 188 | 'id' => $this->slug . '_details_metabox', |
189 | - 'title' => __( 'Workout Details', 'lsx-health-plan' ), |
|
190 | - 'object_types' => array( $this->slug ), // Post type |
|
189 | + 'title' => __('Workout Details', 'lsx-health-plan'), |
|
190 | + 'object_types' => array($this->slug), // Post type |
|
191 | 191 | 'context' => 'normal', |
192 | 192 | 'priority' => 'high', |
193 | 193 | 'show_names' => true, |
194 | - ) ); |
|
194 | + )); |
|
195 | 195 | |
196 | - $cmb->add_field( array( |
|
197 | - 'name' => __( 'Workout Short Description', 'lsx-health-plan' ), |
|
196 | + $cmb->add_field(array( |
|
197 | + 'name' => __('Workout Short Description', 'lsx-health-plan'), |
|
198 | 198 | 'id' => $this->slug . '_short_description', |
199 | 199 | 'type' => 'textarea_small', |
200 | - 'desc' => __( 'Add a small description for this workout (optional)', 'lsx-health-plan' ), |
|
201 | - ) ); |
|
200 | + 'desc' => __('Add a small description for this workout (optional)', 'lsx-health-plan'), |
|
201 | + )); |
|
202 | 202 | |
203 | - $workout_sections = apply_filters( 'lsx_health_plan_workout_sections_amount', 6 ); |
|
204 | - if ( false !== $workout_sections && null !== $workout_sections ) { |
|
203 | + $workout_sections = apply_filters('lsx_health_plan_workout_sections_amount', 6); |
|
204 | + if (false !== $workout_sections && null !== $workout_sections) { |
|
205 | 205 | $i = 1; |
206 | - while ( $i <= $workout_sections ) { |
|
206 | + while ($i <= $workout_sections) { |
|
207 | 207 | |
208 | - $cmb_group = new_cmb2_box( array( |
|
208 | + $cmb_group = new_cmb2_box(array( |
|
209 | 209 | 'id' => $this->slug . '_section_' . $i . '_metabox', |
210 | - 'title' => esc_html__( 'Exercise Group ', 'lsx-health-plan' ) . $i, |
|
211 | - 'object_types' => array( $this->slug ), |
|
212 | - ) ); |
|
210 | + 'title' => esc_html__('Exercise Group ', 'lsx-health-plan') . $i, |
|
211 | + 'object_types' => array($this->slug), |
|
212 | + )); |
|
213 | 213 | |
214 | - $cmb_group->add_field( array( |
|
215 | - 'name' => __( 'Title', 'lsx-health-plan' ), |
|
214 | + $cmb_group->add_field(array( |
|
215 | + 'name' => __('Title', 'lsx-health-plan'), |
|
216 | 216 | 'id' => $this->slug . '_section_' . $i . '_title', |
217 | 217 | 'type' => 'text', |
218 | 218 | 'show_on_cb' => 'cmb2_hide_if_no_cats', |
219 | - ) ); |
|
219 | + )); |
|
220 | 220 | |
221 | 221 | $cmb_group->add_field( |
222 | 222 | array( |
223 | - 'name' => __( 'Description', 'lsx-health-plan' ), |
|
223 | + 'name' => __('Description', 'lsx-health-plan'), |
|
224 | 224 | 'id' => $this->slug . '_section_' . $i . '_description', |
225 | 225 | 'type' => 'wysiwyg', |
226 | 226 | 'show_on_cb' => 'cmb2_hide_if_no_cats', |
@@ -239,27 +239,27 @@ discard block |
||
239 | 239 | 'id' => $this->slug . '_section_' . $i, |
240 | 240 | 'type' => 'group', |
241 | 241 | 'options' => array( |
242 | - 'group_title' => esc_html__( 'Exercise {#}', 'lsx-health-plan' ), // {#} gets replaced by row number |
|
243 | - 'add_button' => esc_html__( 'Add New', 'lsx-health-plan' ), |
|
244 | - 'remove_button' => esc_html__( 'Delete', 'lsx-health-plan' ), |
|
242 | + 'group_title' => esc_html__('Exercise {#}', 'lsx-health-plan'), // {#} gets replaced by row number |
|
243 | + 'add_button' => esc_html__('Add New', 'lsx-health-plan'), |
|
244 | + 'remove_button' => esc_html__('Delete', 'lsx-health-plan'), |
|
245 | 245 | 'sortable' => true, |
246 | 246 | ), |
247 | 247 | ) |
248 | 248 | ); |
249 | 249 | |
250 | - if ( false !== \lsx_health_plan\functions\get_option( 'exercise_enabled', false ) ) { |
|
250 | + if (false !== \lsx_health_plan\functions\get_option('exercise_enabled', false)) { |
|
251 | 251 | $cmb_group->add_group_field( |
252 | 252 | $group_field_id, |
253 | 253 | array( |
254 | - 'name' => __( 'Exercise related to this workout', 'lsx-health-plan' ), |
|
254 | + 'name' => __('Exercise related to this workout', 'lsx-health-plan'), |
|
255 | 255 | 'id' => 'connected_exercises', |
256 | 256 | 'type' => 'post_search_ajax', |
257 | 257 | // Optional : |
258 | 258 | 'limit' => 1, // Limit selection to X items only (default 1) |
259 | - 'sortable' => true, // Allow selected items to be sortable (default false) |
|
259 | + 'sortable' => true, // Allow selected items to be sortable (default false) |
|
260 | 260 | 'query_args' => array( |
261 | - 'post_type' => array( 'exercise' ), |
|
262 | - 'post_status' => array( 'publish' ), |
|
261 | + 'post_type' => array('exercise'), |
|
262 | + 'post_status' => array('publish'), |
|
263 | 263 | 'posts_per_page' => -1, |
264 | 264 | ), |
265 | 265 | ) |
@@ -268,15 +268,15 @@ discard block |
||
268 | 268 | $cmb_group->add_group_field( |
269 | 269 | $group_field_id, |
270 | 270 | array( |
271 | - 'name' => __( 'Video related to this workout', 'lsx-health-plan' ), |
|
271 | + 'name' => __('Video related to this workout', 'lsx-health-plan'), |
|
272 | 272 | 'id' => 'connected_videos', |
273 | 273 | 'type' => 'post_search_ajax', |
274 | 274 | // Optional : |
275 | 275 | 'limit' => 1, // Limit selection to X items only (default 1) |
276 | - 'sortable' => true, // Allow selected items to be sortable (default false) |
|
276 | + 'sortable' => true, // Allow selected items to be sortable (default false) |
|
277 | 277 | 'query_args' => array( |
278 | - 'post_type' => array( 'video' ), |
|
279 | - 'post_status' => array( 'publish' ), |
|
278 | + 'post_type' => array('video'), |
|
279 | + 'post_status' => array('publish'), |
|
280 | 280 | 'posts_per_page' => -1, |
281 | 281 | ), |
282 | 282 | ) |
@@ -284,7 +284,7 @@ discard block |
||
284 | 284 | $cmb_group->add_group_field( |
285 | 285 | $group_field_id, |
286 | 286 | array( |
287 | - 'name' => esc_html__( 'Workout Name', 'lsx-health-plan' ), |
|
287 | + 'name' => esc_html__('Workout Name', 'lsx-health-plan'), |
|
288 | 288 | 'id' => 'name', |
289 | 289 | 'type' => 'text', |
290 | 290 | // 'repeatable' => true, // Repeatable fields are supported w/in repeatable groups (for most types) |
@@ -294,7 +294,7 @@ discard block |
||
294 | 294 | $cmb_group->add_group_field( |
295 | 295 | $group_field_id, |
296 | 296 | array( |
297 | - 'name' => __( 'Description', 'lsx-health-plan' ), |
|
297 | + 'name' => __('Description', 'lsx-health-plan'), |
|
298 | 298 | 'id' => 'description', |
299 | 299 | 'type' => 'wysiwyg', |
300 | 300 | 'options' => array( |
@@ -307,7 +307,7 @@ discard block |
||
307 | 307 | $cmb_group->add_group_field( |
308 | 308 | $group_field_id, |
309 | 309 | array( |
310 | - 'name' => esc_html__( 'Exercise title (Optional)', 'lsx-health-plan' ), |
|
310 | + 'name' => esc_html__('Exercise title (Optional)', 'lsx-health-plan'), |
|
311 | 311 | 'id' => 'alt_title', |
312 | 312 | 'type' => 'text', |
313 | 313 | ) |
@@ -315,7 +315,7 @@ discard block |
||
315 | 315 | $cmb_group->add_group_field( |
316 | 316 | $group_field_id, |
317 | 317 | array( |
318 | - 'name' => esc_html__( 'Exercise Description (Optional)', 'lsx-health-plan' ), |
|
318 | + 'name' => esc_html__('Exercise Description (Optional)', 'lsx-health-plan'), |
|
319 | 319 | 'id' => 'alt_description', |
320 | 320 | 'type' => 'textarea_small', |
321 | 321 | ) |
@@ -323,7 +323,7 @@ discard block |
||
323 | 323 | $cmb_group->add_group_field( |
324 | 324 | $group_field_id, |
325 | 325 | array( |
326 | - 'name' => esc_html__( 'Reps / Time / Distance', 'lsx-health-plan' ), |
|
326 | + 'name' => esc_html__('Reps / Time / Distance', 'lsx-health-plan'), |
|
327 | 327 | 'id' => 'reps', |
328 | 328 | 'type' => 'text', |
329 | 329 | // 'repeatable' => true, // Repeatable fields are supported w/in repeatable groups (for most types) |
@@ -332,13 +332,13 @@ discard block |
||
332 | 332 | $cmb_group->add_group_field( |
333 | 333 | $group_field_id, |
334 | 334 | array( |
335 | - 'name' => __( 'Exercise Image (Optional)', 'lsx-health-plan' ), |
|
335 | + 'name' => __('Exercise Image (Optional)', 'lsx-health-plan'), |
|
336 | 336 | 'id' => 'exercise_alt_thumbnail', |
337 | 337 | 'type' => 'file', |
338 | 338 | 'text' => array( |
339 | - 'add_upload_file_text' => __( 'Add File', 'lsx-health-plan' ), |
|
339 | + 'add_upload_file_text' => __('Add File', 'lsx-health-plan'), |
|
340 | 340 | ), |
341 | - 'desc' => __( 'Upload an image 300px x 300px in size.', 'lsx-health-plan' ), |
|
341 | + 'desc' => __('Upload an image 300px x 300px in size.', 'lsx-health-plan'), |
|
342 | 342 | 'query_args' => array( |
343 | 343 | 'type' => array( |
344 | 344 | 'image/gif', |
@@ -362,14 +362,14 @@ discard block |
||
362 | 362 | * @param object $cmb new_cmb2_box(). |
363 | 363 | * @return void |
364 | 364 | */ |
365 | - public function register_settings( $cmb ) { |
|
366 | - if ( false !== \lsx_health_plan\functions\get_option( 'exercise_enabled', false ) ) { |
|
365 | + public function register_settings($cmb) { |
|
366 | + if (false !== \lsx_health_plan\functions\get_option('exercise_enabled', false)) { |
|
367 | 367 | $cmb->add_field( |
368 | 368 | array( |
369 | 369 | 'id' => 'workout_settings_title', |
370 | 370 | 'type' => 'title', |
371 | - 'name' => __( 'Workout Settings', 'lsx-health-plan' ), |
|
372 | - 'description' => __( 'Choose the layout, content and link settings for your exercises.', 'lsx-health-plan' ), |
|
371 | + 'name' => __('Workout Settings', 'lsx-health-plan'), |
|
372 | + 'description' => __('Choose the layout, content and link settings for your exercises.', 'lsx-health-plan'), |
|
373 | 373 | ) |
374 | 374 | ); |
375 | 375 | |
@@ -377,12 +377,12 @@ discard block |
||
377 | 377 | array( |
378 | 378 | 'id' => 'workout_tab_layout', |
379 | 379 | 'type' => 'select', |
380 | - 'name' => __( 'Workout Tab Layout', 'lsx-health-plan' ), |
|
381 | - 'description' => __( 'Choose the layout for the workouts.', 'lsx-health-plan' ), |
|
380 | + 'name' => __('Workout Tab Layout', 'lsx-health-plan'), |
|
381 | + 'description' => __('Choose the layout for the workouts.', 'lsx-health-plan'), |
|
382 | 382 | 'options' => array( |
383 | - 'table' => __( 'Table', 'lsx-health-plan' ), |
|
384 | - 'list' => __( 'List', 'lsx-health-plan' ), |
|
385 | - 'grid' => __( 'Grid', 'lsx-health-plan' ), |
|
383 | + 'table' => __('Table', 'lsx-health-plan'), |
|
384 | + 'list' => __('List', 'lsx-health-plan'), |
|
385 | + 'grid' => __('Grid', 'lsx-health-plan'), |
|
386 | 386 | ), |
387 | 387 | ) |
388 | 388 | ); |
@@ -390,12 +390,12 @@ discard block |
||
390 | 390 | array( |
391 | 391 | 'id' => 'workout_tab_link', |
392 | 392 | 'type' => 'select', |
393 | - 'name' => __( 'Workout Tab Link', 'lsx-health-plan' ), |
|
394 | - 'description' => __( 'Choose to show the excerpt, full content or nothing.', 'lsx-health-plan' ), |
|
393 | + 'name' => __('Workout Tab Link', 'lsx-health-plan'), |
|
394 | + 'description' => __('Choose to show the excerpt, full content or nothing.', 'lsx-health-plan'), |
|
395 | 395 | 'options' => array( |
396 | - '' => __( 'None', 'lsx-health-plan' ), |
|
397 | - 'single' => __( 'Single', 'lsx-health-plan' ), |
|
398 | - 'modal' => __( 'Modal', 'lsx-health-plan' ), |
|
396 | + '' => __('None', 'lsx-health-plan'), |
|
397 | + 'single' => __('Single', 'lsx-health-plan'), |
|
398 | + 'modal' => __('Modal', 'lsx-health-plan'), |
|
399 | 399 | ), |
400 | 400 | 'default' => 'modal', |
401 | 401 | ) |
@@ -404,12 +404,12 @@ discard block |
||
404 | 404 | array( |
405 | 405 | 'id' => 'workout_tab_modal_content', |
406 | 406 | 'type' => 'select', |
407 | - 'name' => __( 'Modal Content', 'lsx-health-plan' ), |
|
408 | - 'description' => __( 'Choose to show the excerpt, full content or nothing. For the modal content only', 'lsx-health-plan' ), |
|
407 | + 'name' => __('Modal Content', 'lsx-health-plan'), |
|
408 | + 'description' => __('Choose to show the excerpt, full content or nothing. For the modal content only', 'lsx-health-plan'), |
|
409 | 409 | 'options' => array( |
410 | - '' => __( 'None', 'lsx-health-plan' ), |
|
411 | - 'excerpt' => __( 'Excerpt', 'lsx-health-plan' ), |
|
412 | - 'full' => __( 'Full Content', 'lsx-health-plan' ), |
|
410 | + '' => __('None', 'lsx-health-plan'), |
|
411 | + 'excerpt' => __('Excerpt', 'lsx-health-plan'), |
|
412 | + 'full' => __('Full Content', 'lsx-health-plan'), |
|
413 | 413 | ), |
414 | 414 | 'default' => '', |
415 | 415 | ) |
@@ -418,14 +418,14 @@ discard block |
||
418 | 418 | array( |
419 | 419 | 'id' => 'workout_tab_columns', |
420 | 420 | 'type' => 'select', |
421 | - 'name' => __( 'Grid Columns', 'lsx-health-plan' ), |
|
422 | - 'description' => __( 'If you are displaying a grid, set the amount of columns you want to use.', 'lsx-health-plan' ), |
|
421 | + 'name' => __('Grid Columns', 'lsx-health-plan'), |
|
422 | + 'description' => __('If you are displaying a grid, set the amount of columns you want to use.', 'lsx-health-plan'), |
|
423 | 423 | 'options' => array( |
424 | - '12' => __( '1', 'lsx-health-plan' ), |
|
425 | - '6' => __( '2', 'lsx-health-plan' ), |
|
426 | - '4' => __( '3', 'lsx-health-plan' ), |
|
427 | - '3' => __( '4', 'lsx-health-plan' ), |
|
428 | - '2' => __( '6', 'lsx-health-plan' ), |
|
424 | + '12' => __('1', 'lsx-health-plan'), |
|
425 | + '6' => __('2', 'lsx-health-plan'), |
|
426 | + '4' => __('3', 'lsx-health-plan'), |
|
427 | + '3' => __('4', 'lsx-health-plan'), |
|
428 | + '2' => __('6', 'lsx-health-plan'), |
|
429 | 429 | ), |
430 | 430 | 'default' => '4', |
431 | 431 | ) |
@@ -434,18 +434,18 @@ discard block |
||
434 | 434 | array( |
435 | 435 | 'id' => 'workout_tab_content', |
436 | 436 | 'type' => 'select', |
437 | - 'name' => __( 'Grid Content', 'lsx-health-plan' ), |
|
438 | - 'description' => __( 'Choose to show the excerpt, full content or nothing. For the grid layout only', 'lsx-health-plan' ), |
|
437 | + 'name' => __('Grid Content', 'lsx-health-plan'), |
|
438 | + 'description' => __('Choose to show the excerpt, full content or nothing. For the grid layout only', 'lsx-health-plan'), |
|
439 | 439 | 'options' => array( |
440 | - '' => __( 'None', 'lsx-health-plan' ), |
|
441 | - 'excerpt' => __( 'Excerpt', 'lsx-health-plan' ), |
|
442 | - 'full' => __( 'Full Content', 'lsx-health-plan' ), |
|
440 | + '' => __('None', 'lsx-health-plan'), |
|
441 | + 'excerpt' => __('Excerpt', 'lsx-health-plan'), |
|
442 | + 'full' => __('Full Content', 'lsx-health-plan'), |
|
443 | 443 | ), |
444 | 444 | 'default' => '', |
445 | 445 | ) |
446 | 446 | ); |
447 | 447 | |
448 | - do_action( 'lsx_hp_workout_settings_page', $cmb ); |
|
448 | + do_action('lsx_hp_workout_settings_page', $cmb); |
|
449 | 449 | |
450 | 450 | $cmb->add_field( |
451 | 451 | array( |
@@ -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 | } |
@@ -33,35 +33,35 @@ discard block |
||
33 | 33 | */ |
34 | 34 | public function __construct() { |
35 | 35 | |
36 | - add_action( 'init', array( $this, 'register_post_type' ) ); |
|
37 | - add_action( 'init', array( $this, 'plan_type_taxonomy_setup' ) ); |
|
38 | - add_action( 'init', array( $this, 'week_taxonomy_setup' ) ); |
|
36 | + add_action('init', array($this, 'register_post_type')); |
|
37 | + add_action('init', array($this, 'plan_type_taxonomy_setup')); |
|
38 | + add_action('init', array($this, 'week_taxonomy_setup')); |
|
39 | 39 | |
40 | 40 | // Icons for the plan types. |
41 | - add_action( 'create_term', array( $this, 'save_meta' ), 10, 2 ); |
|
42 | - add_action( 'edit_term', array( $this, 'save_meta' ), 10, 2 ); |
|
41 | + add_action('create_term', array($this, 'save_meta'), 10, 2); |
|
42 | + add_action('edit_term', array($this, 'save_meta'), 10, 2); |
|
43 | 43 | $prefix_taxonomy = 'plan-type'; |
44 | - add_action( sprintf( '%s_edit_form_fields', $prefix_taxonomy ), array( $this, 'add_thumbnail_form_field' ), 3, 1 ); |
|
44 | + add_action(sprintf('%s_edit_form_fields', $prefix_taxonomy), array($this, 'add_thumbnail_form_field'), 3, 1); |
|
45 | 45 | |
46 | 46 | // Register the Metaboxes. |
47 | - add_action( 'cmb2_admin_init', array( $this, 'featured_metabox' ), 5 ); |
|
48 | - add_action( 'cmb2_admin_init', array( $this, 'details_metaboxes' ), 5 ); |
|
49 | - add_action( 'cmb2_admin_init', array( $this, 'plan_connections' ), 5 ); |
|
50 | - add_action( 'cmb2_admin_init', array( $this, 'sections_metabox_loop' ), 1 ); |
|
47 | + add_action('cmb2_admin_init', array($this, 'featured_metabox'), 5); |
|
48 | + add_action('cmb2_admin_init', array($this, 'details_metaboxes'), 5); |
|
49 | + add_action('cmb2_admin_init', array($this, 'plan_connections'), 5); |
|
50 | + add_action('cmb2_admin_init', array($this, 'sections_metabox_loop'), 1); |
|
51 | 51 | |
52 | - add_filter( 'get_the_archive_title', array( $this, 'get_the_archive_title' ), 100 ); |
|
52 | + add_filter('get_the_archive_title', array($this, 'get_the_archive_title'), 100); |
|
53 | 53 | //add_filter( 'lsx_global_header_title', array( $this, 'hp_recipe_header_title' ), 200, 1 ); |
54 | 54 | |
55 | 55 | // Template Redirects. |
56 | - add_filter( 'lsx_health_plan_archive_template', array( $this, 'enable_post_type' ), 10, 1 ); |
|
57 | - add_filter( 'lsx_health_plan_single_template', array( $this, 'enable_post_type' ), 10, 1 ); |
|
56 | + add_filter('lsx_health_plan_archive_template', array($this, 'enable_post_type'), 10, 1); |
|
57 | + add_filter('lsx_health_plan_single_template', array($this, 'enable_post_type'), 10, 1); |
|
58 | 58 | |
59 | 59 | // Plan Archive Actions. |
60 | - add_action( 'pre_get_posts', array( $this, 'set_parent_only' ), 10, 1 ); |
|
61 | - add_filter( 'get_the_archive_title', array( $this, 'get_the_archive_title' ), 100 ); |
|
62 | - add_action( 'lsx_content_top', 'lsx_hp_plan_archive_filters', 10, 1 ); |
|
63 | - add_filter( 'lsx_hp_disable_plan_archive_filters', '\lsx_health_plan\functions\plan\is_search_enabled', 10, 1 ); |
|
64 | - add_filter( 'lsx_hp_disable_plan_archive_filters', '\lsx_health_plan\functions\plan\is_filters_disabled', 10, 1 ); |
|
60 | + add_action('pre_get_posts', array($this, 'set_parent_only'), 10, 1); |
|
61 | + add_filter('get_the_archive_title', array($this, 'get_the_archive_title'), 100); |
|
62 | + add_action('lsx_content_top', 'lsx_hp_plan_archive_filters', 10, 1); |
|
63 | + add_filter('lsx_hp_disable_plan_archive_filters', '\lsx_health_plan\functions\plan\is_search_enabled', 10, 1); |
|
64 | + add_filter('lsx_hp_disable_plan_archive_filters', '\lsx_health_plan\functions\plan\is_filters_disabled', 10, 1); |
|
65 | 65 | } |
66 | 66 | |
67 | 67 | /** |
@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | */ |
74 | 74 | public static function get_instance() { |
75 | 75 | // If the single instance hasn't been set, set it now. |
76 | - if ( null === self::$instance ) { |
|
76 | + if (null === self::$instance) { |
|
77 | 77 | self::$instance = new self(); |
78 | 78 | } |
79 | 79 | return self::$instance; |
@@ -83,21 +83,21 @@ discard block |
||
83 | 83 | */ |
84 | 84 | public function register_post_type() { |
85 | 85 | $labels = array( |
86 | - 'name' => esc_html__( 'Plans', 'lsx-health-plan' ), |
|
87 | - 'singular_name' => esc_html__( 'Plan', 'lsx-health-plan' ), |
|
88 | - 'add_new' => esc_html_x( 'Add New', 'post type general name', 'lsx-health-plan' ), |
|
89 | - 'add_new_item' => esc_html__( 'Add New', 'lsx-health-plan' ), |
|
90 | - 'edit_item' => esc_html__( 'Edit', 'lsx-health-plan' ), |
|
91 | - 'new_item' => esc_html__( 'New', 'lsx-health-plan' ), |
|
92 | - 'all_items' => esc_html__( 'All Plans', 'lsx-health-plan' ), |
|
93 | - 'view_item' => esc_html__( 'View', 'lsx-health-plan' ), |
|
94 | - 'search_items' => esc_html__( 'Search', 'lsx-health-plan' ), |
|
95 | - 'not_found' => esc_html__( 'None found', 'lsx-health-plan' ), |
|
96 | - 'not_found_in_trash' => esc_html__( 'None found in Trash', 'lsx-health-plan' ), |
|
86 | + 'name' => esc_html__('Plans', 'lsx-health-plan'), |
|
87 | + 'singular_name' => esc_html__('Plan', 'lsx-health-plan'), |
|
88 | + 'add_new' => esc_html_x('Add New', 'post type general name', 'lsx-health-plan'), |
|
89 | + 'add_new_item' => esc_html__('Add New', 'lsx-health-plan'), |
|
90 | + 'edit_item' => esc_html__('Edit', 'lsx-health-plan'), |
|
91 | + 'new_item' => esc_html__('New', 'lsx-health-plan'), |
|
92 | + 'all_items' => esc_html__('All Plans', 'lsx-health-plan'), |
|
93 | + 'view_item' => esc_html__('View', 'lsx-health-plan'), |
|
94 | + 'search_items' => esc_html__('Search', 'lsx-health-plan'), |
|
95 | + 'not_found' => esc_html__('None found', 'lsx-health-plan'), |
|
96 | + 'not_found_in_trash' => esc_html__('None found in Trash', 'lsx-health-plan'), |
|
97 | 97 | 'parent_item_colon' => '', |
98 | - 'menu_name' => esc_html__( 'Plans', 'lsx-health-plan' ), |
|
98 | + 'menu_name' => esc_html__('Plans', 'lsx-health-plan'), |
|
99 | 99 | ); |
100 | - $args = array( |
|
100 | + $args = array( |
|
101 | 101 | 'labels' => $labels, |
102 | 102 | 'public' => true, |
103 | 103 | 'publicly_queryable' => true, |
@@ -107,10 +107,10 @@ discard block |
||
107 | 107 | 'menu_icon' => 'dashicons-welcome-write-blog', |
108 | 108 | 'query_var' => true, |
109 | 109 | 'rewrite' => array( |
110 | - 'slug' => \lsx_health_plan\functions\get_option( 'plan_single_slug', 'plan' ), |
|
110 | + 'slug' => \lsx_health_plan\functions\get_option('plan_single_slug', 'plan'), |
|
111 | 111 | ), |
112 | 112 | 'capability_type' => 'page', |
113 | - 'has_archive' => \lsx_health_plan\functions\get_option( 'endpoint_plan_archive', 'plans' ), |
|
113 | + 'has_archive' => \lsx_health_plan\functions\get_option('endpoint_plan_archive', 'plans'), |
|
114 | 114 | 'hierarchical' => false, |
115 | 115 | 'menu_position' => null, |
116 | 116 | 'supports' => array( |
@@ -121,7 +121,7 @@ discard block |
||
121 | 121 | 'custom-fields', |
122 | 122 | ), |
123 | 123 | ); |
124 | - register_post_type( 'plan', $args ); |
|
124 | + register_post_type('plan', $args); |
|
125 | 125 | } |
126 | 126 | |
127 | 127 | /** |
@@ -129,17 +129,17 @@ discard block |
||
129 | 129 | */ |
130 | 130 | public function plan_type_taxonomy_setup() { |
131 | 131 | $labels = array( |
132 | - 'name' => esc_html_x( 'Plan Type', 'taxonomy general name', 'lsx-health-plan' ), |
|
133 | - 'singular_name' => esc_html_x( 'Plan Type', 'taxonomy singular name', 'lsx-health-plan' ), |
|
134 | - 'search_items' => esc_html__( 'Search', 'lsx-health-plan' ), |
|
135 | - 'all_items' => esc_html__( 'All', 'lsx-health-plan' ), |
|
136 | - 'parent_item' => esc_html__( 'Parent', 'lsx-health-plan' ), |
|
137 | - 'parent_item_colon' => esc_html__( 'Parent:', 'lsx-health-plan' ), |
|
138 | - 'edit_item' => esc_html__( 'Edit', 'lsx-health-plan' ), |
|
139 | - 'update_item' => esc_html__( 'Update', 'lsx-health-plan' ), |
|
140 | - 'add_new_item' => esc_html__( 'Add New', 'lsx-health-plan' ), |
|
141 | - 'new_item_name' => esc_html__( 'New Name', 'lsx-health-plan' ), |
|
142 | - 'menu_name' => esc_html__( 'Plan Types', 'lsx-health-plan' ), |
|
132 | + 'name' => esc_html_x('Plan Type', 'taxonomy general name', 'lsx-health-plan'), |
|
133 | + 'singular_name' => esc_html_x('Plan Type', 'taxonomy singular name', 'lsx-health-plan'), |
|
134 | + 'search_items' => esc_html__('Search', 'lsx-health-plan'), |
|
135 | + 'all_items' => esc_html__('All', 'lsx-health-plan'), |
|
136 | + 'parent_item' => esc_html__('Parent', 'lsx-health-plan'), |
|
137 | + 'parent_item_colon' => esc_html__('Parent:', 'lsx-health-plan'), |
|
138 | + 'edit_item' => esc_html__('Edit', 'lsx-health-plan'), |
|
139 | + 'update_item' => esc_html__('Update', 'lsx-health-plan'), |
|
140 | + 'add_new_item' => esc_html__('Add New', 'lsx-health-plan'), |
|
141 | + 'new_item_name' => esc_html__('New Name', 'lsx-health-plan'), |
|
142 | + 'menu_name' => esc_html__('Plan Types', 'lsx-health-plan'), |
|
143 | 143 | ); |
144 | 144 | |
145 | 145 | $args = array( |
@@ -153,7 +153,7 @@ discard block |
||
153 | 153 | ), |
154 | 154 | ); |
155 | 155 | |
156 | - register_taxonomy( 'plan-type', array( 'plan' ), $args ); |
|
156 | + register_taxonomy('plan-type', array('plan'), $args); |
|
157 | 157 | } |
158 | 158 | |
159 | 159 | /** |
@@ -161,17 +161,17 @@ discard block |
||
161 | 161 | */ |
162 | 162 | public function week_taxonomy_setup() { |
163 | 163 | $labels = array( |
164 | - 'name' => esc_html_x( 'Week', 'taxonomy general name', 'lsx-health-plan' ), |
|
165 | - 'singular_name' => esc_html_x( 'Week', 'taxonomy singular name', 'lsx-health-plan' ), |
|
166 | - 'search_items' => esc_html__( 'Search', 'lsx-health-plan' ), |
|
167 | - 'all_items' => esc_html__( 'All', 'lsx-health-plan' ), |
|
168 | - 'parent_item' => esc_html__( 'Parent', 'lsx-health-plan' ), |
|
169 | - 'parent_item_colon' => esc_html__( 'Parent:', 'lsx-health-plan' ), |
|
170 | - 'edit_item' => esc_html__( 'Edit', 'lsx-health-plan' ), |
|
171 | - 'update_item' => esc_html__( 'Update', 'lsx-health-plan' ), |
|
172 | - 'add_new_item' => esc_html__( 'Add New', 'lsx-health-plan' ), |
|
173 | - 'new_item_name' => esc_html__( 'New Name', 'lsx-health-plan' ), |
|
174 | - 'menu_name' => esc_html__( 'Weeks', 'lsx-health-plan' ), |
|
164 | + 'name' => esc_html_x('Week', 'taxonomy general name', 'lsx-health-plan'), |
|
165 | + 'singular_name' => esc_html_x('Week', 'taxonomy singular name', 'lsx-health-plan'), |
|
166 | + 'search_items' => esc_html__('Search', 'lsx-health-plan'), |
|
167 | + 'all_items' => esc_html__('All', 'lsx-health-plan'), |
|
168 | + 'parent_item' => esc_html__('Parent', 'lsx-health-plan'), |
|
169 | + 'parent_item_colon' => esc_html__('Parent:', 'lsx-health-plan'), |
|
170 | + 'edit_item' => esc_html__('Edit', 'lsx-health-plan'), |
|
171 | + 'update_item' => esc_html__('Update', 'lsx-health-plan'), |
|
172 | + 'add_new_item' => esc_html__('Add New', 'lsx-health-plan'), |
|
173 | + 'new_item_name' => esc_html__('New Name', 'lsx-health-plan'), |
|
174 | + 'menu_name' => esc_html__('Weeks', 'lsx-health-plan'), |
|
175 | 175 | ); |
176 | 176 | |
177 | 177 | $args = array( |
@@ -186,7 +186,7 @@ discard block |
||
186 | 186 | ), |
187 | 187 | ); |
188 | 188 | |
189 | - register_taxonomy( 'week', array( 'plan' ), $args ); |
|
189 | + register_taxonomy('week', array('plan'), $args); |
|
190 | 190 | } |
191 | 191 | |
192 | 192 | /** |
@@ -194,13 +194,13 @@ discard block |
||
194 | 194 | * |
195 | 195 | * @since 0.1.0 |
196 | 196 | */ |
197 | - public function add_thumbnail_form_field( $term = false ) { |
|
198 | - if ( is_object( $term ) ) { |
|
199 | - $value = get_term_meta( $term->term_id, 'thumbnail', true ); |
|
200 | - $image_preview = wp_get_attachment_image_src( $value, 'thumbnail' ); |
|
197 | + public function add_thumbnail_form_field($term = false) { |
|
198 | + if (is_object($term)) { |
|
199 | + $value = get_term_meta($term->term_id, 'thumbnail', true); |
|
200 | + $image_preview = wp_get_attachment_image_src($value, 'thumbnail'); |
|
201 | 201 | |
202 | - if ( is_array( $image_preview ) ) { |
|
203 | - $image_preview = '<img style="height: 50px; width: 50px;" src="' . esc_url( $image_preview[0] ) . '" width="' . $image_preview[1] . '" height="' . $image_preview[2] . '" class="alignnone size-thumbnail d wp-image-' . $value . '" />'; |
|
202 | + if (is_array($image_preview)) { |
|
203 | + $image_preview = '<img style="height: 50px; width: 50px;" src="' . esc_url($image_preview[0]) . '" width="' . $image_preview[1] . '" height="' . $image_preview[2] . '" class="alignnone size-thumbnail d wp-image-' . $value . '" />'; |
|
204 | 204 | } |
205 | 205 | } else { |
206 | 206 | $image_preview = false; |
@@ -208,15 +208,15 @@ discard block |
||
208 | 208 | } |
209 | 209 | ?> |
210 | 210 | <tr class="form-field form-required term-thumbnail-wrap"> |
211 | - <th scope="row"><label for="thumbnail"><?php esc_html_e( 'Icon Image', 'lsx-health-plan' ); ?></label></th> |
|
211 | + <th scope="row"><label for="thumbnail"><?php esc_html_e('Icon Image', 'lsx-health-plan'); ?></label></th> |
|
212 | 212 | <td> |
213 | - <input class="input_image_id" type="hidden" name="thumbnail" value="<?php echo wp_kses_post( $value ); ?>"> |
|
213 | + <input class="input_image_id" type="hidden" name="thumbnail" value="<?php echo wp_kses_post($value); ?>"> |
|
214 | 214 | <div class="thumbnail-preview"> |
215 | - <?php echo wp_kses_post( $image_preview ); ?> |
|
215 | + <?php echo wp_kses_post($image_preview); ?> |
|
216 | 216 | </div> |
217 | - <a style="<?php if ( '' !== $value && false !== $value ) { ?>display:none;<?php } ?>" class="button-secondary lsx-thumbnail-image-add"><?php esc_html_e( 'Choose Image', 'lsx-health-plan' ); ?></a> |
|
218 | - <a style="<?php if ( '' === $value || false === $value ) { ?>display:none;<?php } ?>" class="button-secondary lsx-thumbnail-image-remove"><?php esc_html_e( 'Remove Image', 'lsx-health-plan' ); ?></a> |
|
219 | - <?php wp_nonce_field( 'lsx_hp_term_thumbnail_nonce', 'lsx_hp_term_thumbnail_nonce' ); ?> |
|
217 | + <a style="<?php if ('' !== $value && false !== $value) { ?>display:none;<?php } ?>" class="button-secondary lsx-thumbnail-image-add"><?php esc_html_e('Choose Image', 'lsx-health-plan'); ?></a> |
|
218 | + <a style="<?php if ('' === $value || false === $value) { ?>display:none;<?php } ?>" class="button-secondary lsx-thumbnail-image-remove"><?php esc_html_e('Remove Image', 'lsx-health-plan'); ?></a> |
|
219 | + <?php wp_nonce_field('lsx_hp_term_thumbnail_nonce', 'lsx_hp_term_thumbnail_nonce'); ?> |
|
220 | 220 | </td> |
221 | 221 | </tr> |
222 | 222 | <?php |
@@ -230,27 +230,27 @@ discard block |
||
230 | 230 | * @param int $term_id |
231 | 231 | * @param string $taxonomy |
232 | 232 | */ |
233 | - public function save_meta( $term_id = 0, $taxonomy = '' ) { |
|
234 | - if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) { |
|
233 | + public function save_meta($term_id = 0, $taxonomy = '') { |
|
234 | + if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE) { |
|
235 | 235 | return; |
236 | 236 | } |
237 | 237 | |
238 | - if ( ! isset( $_POST['thumbnail'] ) ) { |
|
238 | + if ( ! isset($_POST['thumbnail'])) { |
|
239 | 239 | return; |
240 | 240 | } |
241 | 241 | |
242 | - if ( check_admin_referer( 'lsx_hp_term_thumbnail_nonce', 'lsx_hp_term_thumbnail_nonce' ) ) { |
|
243 | - if ( ! isset( $_POST['thumbnail'] ) ) { |
|
242 | + if (check_admin_referer('lsx_hp_term_thumbnail_nonce', 'lsx_hp_term_thumbnail_nonce')) { |
|
243 | + if ( ! isset($_POST['thumbnail'])) { |
|
244 | 244 | return; |
245 | 245 | } |
246 | 246 | |
247 | - $thumbnail_meta = sanitize_text_field( $_POST['thumbnail'] ); |
|
248 | - $thumbnail_meta = ! empty( $thumbnail_meta ) ? $thumbnail_meta : ''; |
|
247 | + $thumbnail_meta = sanitize_text_field($_POST['thumbnail']); |
|
248 | + $thumbnail_meta = ! empty($thumbnail_meta) ? $thumbnail_meta : ''; |
|
249 | 249 | |
250 | - if ( empty( $thumbnail_meta ) ) { |
|
251 | - delete_term_meta( $term_id, 'thumbnail' ); |
|
250 | + if (empty($thumbnail_meta)) { |
|
251 | + delete_term_meta($term_id, 'thumbnail'); |
|
252 | 252 | } else { |
253 | - update_term_meta( $term_id, 'thumbnail', $thumbnail_meta ); |
|
253 | + update_term_meta($term_id, 'thumbnail', $thumbnail_meta); |
|
254 | 254 | } |
255 | 255 | } |
256 | 256 | } |
@@ -259,33 +259,33 @@ discard block |
||
259 | 259 | * Define the metabox and field configurations. |
260 | 260 | */ |
261 | 261 | public function details_metaboxes() { |
262 | - $cmb = new_cmb2_box( array( |
|
262 | + $cmb = new_cmb2_box(array( |
|
263 | 263 | 'id' => $this->slug . '_details_metabox', |
264 | - 'title' => __( 'Details', 'lsx-health-plan' ), |
|
265 | - 'object_types' => array( $this->slug ), // Post type |
|
264 | + 'title' => __('Details', 'lsx-health-plan'), |
|
265 | + 'object_types' => array($this->slug), // Post type |
|
266 | 266 | 'context' => 'normal', |
267 | 267 | 'priority' => 'high', |
268 | 268 | 'show_names' => true, |
269 | - ) ); |
|
269 | + )); |
|
270 | 270 | |
271 | 271 | $warmup_type = 'page'; |
272 | - if ( false !== \lsx_health_plan\functions\get_option( 'exercise_enabled', false ) ) { |
|
273 | - $warmup_type = array( 'page', 'workout' ); |
|
272 | + if (false !== \lsx_health_plan\functions\get_option('exercise_enabled', false)) { |
|
273 | + $warmup_type = array('page', 'workout'); |
|
274 | 274 | } |
275 | - $cmb->add_field( array( |
|
276 | - 'name' => __( 'Warmup', 'lsx-health-plan' ), |
|
277 | - 'desc' => __( 'Connect the warm up page that applies to this day plan using the field provided.', 'lsx-health-plan' ), |
|
275 | + $cmb->add_field(array( |
|
276 | + 'name' => __('Warmup', 'lsx-health-plan'), |
|
277 | + 'desc' => __('Connect the warm up page that applies to this day plan using the field provided.', 'lsx-health-plan'), |
|
278 | 278 | 'id' => $this->slug . '_warmup', |
279 | 279 | 'type' => 'post_search_ajax', |
280 | 280 | // Optional : |
281 | - 'limit' => 3, // Limit selection to X items only (default 1) |
|
281 | + 'limit' => 3, // Limit selection to X items only (default 1) |
|
282 | 282 | 'sortable' => true, // Allow selected items to be sortable (default false) |
283 | 283 | 'query_args' => array( |
284 | 284 | 'post_type' => $warmup_type, |
285 | - 'post_status' => array( 'publish' ), |
|
285 | + 'post_status' => array('publish'), |
|
286 | 286 | 'posts_per_page' => -1, |
287 | 287 | ), |
288 | - ) ); |
|
288 | + )); |
|
289 | 289 | } |
290 | 290 | |
291 | 291 | /** |
@@ -294,7 +294,7 @@ discard block |
||
294 | 294 | * @param array $post_types |
295 | 295 | * @return array |
296 | 296 | */ |
297 | - public function enable_post_type( $post_types = array() ) { |
|
297 | + public function enable_post_type($post_types = array()) { |
|
298 | 298 | $post_types[] = $this->slug; |
299 | 299 | return $post_types; |
300 | 300 | } |
@@ -308,8 +308,8 @@ discard block |
||
308 | 308 | $cmb = new_cmb2_box( |
309 | 309 | array( |
310 | 310 | 'id' => $this->slug . '_connections_metabox', |
311 | - 'title' => __( 'Plans', 'lsx-health-plan' ), |
|
312 | - 'object_types' => array( 'workout', 'meal', 'tip', 'recipe' ), |
|
311 | + 'title' => __('Plans', 'lsx-health-plan'), |
|
312 | + 'object_types' => array('workout', 'meal', 'tip', 'recipe'), |
|
313 | 313 | 'context' => 'normal', |
314 | 314 | 'priority' => 'high', |
315 | 315 | 'show_names' => true, |
@@ -317,15 +317,15 @@ discard block |
||
317 | 317 | ); |
318 | 318 | $cmb->add_field( |
319 | 319 | array( |
320 | - 'name' => __( 'Plan', 'lsx-health-plan' ), |
|
320 | + 'name' => __('Plan', 'lsx-health-plan'), |
|
321 | 321 | 'id' => 'connected_plans', |
322 | - 'desc' => __( 'Connect this to the day plan it applies to, using the field provided.', 'lsx-health-plan' ), |
|
322 | + 'desc' => __('Connect this to the day plan it applies to, using the field provided.', 'lsx-health-plan'), |
|
323 | 323 | 'type' => 'post_search_ajax', |
324 | 324 | 'limit' => 15, |
325 | 325 | 'sortable' => true, |
326 | 326 | 'query_args' => array( |
327 | - 'post_type' => array( 'plan' ), |
|
328 | - 'post_status' => array( 'publish' ), |
|
327 | + 'post_type' => array('plan'), |
|
328 | + 'post_status' => array('publish'), |
|
329 | 329 | 'posts_per_page' => -1, |
330 | 330 | ), |
331 | 331 | ) |
@@ -338,9 +338,9 @@ discard block |
||
338 | 338 | * @param string $title the term title. |
339 | 339 | * @return string |
340 | 340 | */ |
341 | - public function get_the_archive_title( $title ) { |
|
342 | - if ( is_post_type_archive( 'plan' ) ) { |
|
343 | - $title = __( 'Our health plans', 'lsx-health-plan' ); |
|
341 | + public function get_the_archive_title($title) { |
|
342 | + if (is_post_type_archive('plan')) { |
|
343 | + $title = __('Our health plans', 'lsx-health-plan'); |
|
344 | 344 | } |
345 | 345 | return $title; |
346 | 346 | } |
@@ -351,9 +351,9 @@ discard block |
||
351 | 351 | * @param object $wp_query |
352 | 352 | * @return array |
353 | 353 | */ |
354 | - public function set_parent_only( $wp_query ) { |
|
355 | - if ( ! is_admin() && $wp_query->is_main_query() && ( $wp_query->is_post_type_archive( 'plan' ) || $wp_query->is_tax( 'plan-type' ) ) ) { |
|
356 | - $wp_query->set( 'post_parent', '0' ); |
|
354 | + public function set_parent_only($wp_query) { |
|
355 | + if ( ! is_admin() && $wp_query->is_main_query() && ($wp_query->is_post_type_archive('plan') || $wp_query->is_tax('plan-type'))) { |
|
356 | + $wp_query->set('post_parent', '0'); |
|
357 | 357 | } |
358 | 358 | } |
359 | 359 | |
@@ -364,8 +364,8 @@ discard block |
||
364 | 364 | $cmb = new_cmb2_box( |
365 | 365 | array( |
366 | 366 | 'id' => $this->slug . '_featured_metabox_plan', |
367 | - 'title' => __( 'Featured Plan', 'lsx-health-plan' ), |
|
368 | - 'object_types' => array( $this->slug ), // Post type |
|
367 | + 'title' => __('Featured Plan', 'lsx-health-plan'), |
|
368 | + 'object_types' => array($this->slug), // Post type |
|
369 | 369 | 'context' => 'side', |
370 | 370 | 'priority' => 'high', |
371 | 371 | 'show_names' => true, |
@@ -373,8 +373,8 @@ discard block |
||
373 | 373 | ); |
374 | 374 | $cmb->add_field( |
375 | 375 | array( |
376 | - 'name' => __( 'Featured Plan', 'lsx-health-plan' ), |
|
377 | - 'desc' => __( 'Enable a featured plan' ), |
|
376 | + 'name' => __('Featured Plan', 'lsx-health-plan'), |
|
377 | + 'desc' => __('Enable a featured plan'), |
|
378 | 378 | 'id' => $this->slug . '_featured_plan', |
379 | 379 | 'type' => 'checkbox', |
380 | 380 | 'show_on_cb' => 'cmb2_hide_if_no_cats', |
@@ -389,8 +389,8 @@ discard block |
||
389 | 389 | $cmb = new_cmb2_box( |
390 | 390 | array( |
391 | 391 | 'id' => $this->slug . '_sections_metabox', |
392 | - 'title' => __( 'Sections', 'lsx-health-plan' ), |
|
393 | - 'object_types' => array( $this->slug ), // Post type. |
|
392 | + 'title' => __('Sections', 'lsx-health-plan'), |
|
393 | + 'object_types' => array($this->slug), // Post type. |
|
394 | 394 | 'context' => 'normal', |
395 | 395 | 'priority' => 'low', |
396 | 396 | 'show_names' => true, |
@@ -406,9 +406,9 @@ discard block |
||
406 | 406 | 'id' => $this->slug . '_sections', |
407 | 407 | 'type' => 'group', |
408 | 408 | 'options' => array( |
409 | - 'group_title' => __( 'Section', 'lsx-health-plan' ) . ' {#}', // {#} gets replaced by row number |
|
410 | - 'add_button' => __( 'Add section', 'lsx-health-plan' ), |
|
411 | - 'remove_button' => __( 'Remove section', 'lsx-health-plan' ), |
|
409 | + 'group_title' => __('Section', 'lsx-health-plan') . ' {#}', // {#} gets replaced by row number |
|
410 | + 'add_button' => __('Add section', 'lsx-health-plan'), |
|
411 | + 'remove_button' => __('Remove section', 'lsx-health-plan'), |
|
412 | 412 | 'sortable' => true, |
413 | 413 | 'closed' => true, // true to have the groups closed by default |
414 | 414 | ), |
@@ -420,10 +420,10 @@ discard block |
||
420 | 420 | $cmb->add_group_field( |
421 | 421 | $group, |
422 | 422 | array( |
423 | - 'name' => __( 'Title', 'lsx-health-plan' ), |
|
423 | + 'name' => __('Title', 'lsx-health-plan'), |
|
424 | 424 | 'id' => 'title', |
425 | 425 | 'type' => 'text', |
426 | - 'desc' => __( 'e.g Day 1 / Week 1', 'lsx-health-plan' ), |
|
426 | + 'desc' => __('e.g Day 1 / Week 1', 'lsx-health-plan'), |
|
427 | 427 | 'classes' => 'lsx-field-col lsx-field-col-50', |
428 | 428 | ) |
429 | 429 | ); |
@@ -431,10 +431,10 @@ discard block |
||
431 | 431 | $cmb->add_group_field( |
432 | 432 | $group, |
433 | 433 | array( |
434 | - 'name' => __( 'Group', 'lsx-health-plan' ), |
|
434 | + 'name' => __('Group', 'lsx-health-plan'), |
|
435 | 435 | 'id' => 'group', |
436 | 436 | 'type' => 'text', |
437 | - 'desc' => __( 'e.g Week 1 / January', 'lsx-health-plan' ), |
|
437 | + 'desc' => __('e.g Week 1 / January', 'lsx-health-plan'), |
|
438 | 438 | 'classes' => 'lsx-field-col lsx-field-col-50', |
439 | 439 | ) |
440 | 440 | ); |
@@ -442,25 +442,25 @@ discard block |
||
442 | 442 | $cmb->add_group_field( |
443 | 443 | $group, |
444 | 444 | array( |
445 | - 'name' => __( 'Overview', 'lsx-health-plan' ), |
|
445 | + 'name' => __('Overview', 'lsx-health-plan'), |
|
446 | 446 | 'id' => 'description', |
447 | 447 | 'type' => 'wysiwyg', |
448 | 448 | ) |
449 | 449 | ); |
450 | 450 | |
451 | - if ( post_type_exists( 'workout' ) ) { |
|
451 | + if (post_type_exists('workout')) { |
|
452 | 452 | $cmb->add_group_field( |
453 | 453 | $group, |
454 | 454 | array( |
455 | - 'name' => __( 'Workouts', 'lsx-health-plan' ), |
|
455 | + 'name' => __('Workouts', 'lsx-health-plan'), |
|
456 | 456 | 'id' => 'connected_workouts', |
457 | - 'desc' => __( 'Connect the workout(s) that apply to this section.', 'lsx-health-plan' ), |
|
457 | + 'desc' => __('Connect the workout(s) that apply to this section.', 'lsx-health-plan'), |
|
458 | 458 | 'type' => 'post_search_ajax', |
459 | 459 | 'limit' => 15, |
460 | 460 | 'sortable' => true, |
461 | 461 | 'query_args' => array( |
462 | - 'post_type' => array( 'workout' ), |
|
463 | - 'post_status' => array( 'publish' ), |
|
462 | + 'post_type' => array('workout'), |
|
463 | + 'post_status' => array('publish'), |
|
464 | 464 | 'posts_per_page' => -1, |
465 | 465 | ), |
466 | 466 | 'classes' => 'lsx-field-col lsx-field-add-field lsx-field-col-33', |
@@ -468,40 +468,40 @@ discard block |
||
468 | 468 | ); |
469 | 469 | } |
470 | 470 | |
471 | - if ( post_type_exists( 'meal' ) ) { |
|
471 | + if (post_type_exists('meal')) { |
|
472 | 472 | $cmb->add_group_field( |
473 | 473 | $group, |
474 | 474 | array( |
475 | - 'name' => __( 'Meals', 'lsx-health-plan' ), |
|
476 | - 'desc' => __( 'Connect the meal(s) that apply to this section.', 'lsx-health-plan' ), |
|
475 | + 'name' => __('Meals', 'lsx-health-plan'), |
|
476 | + 'desc' => __('Connect the meal(s) that apply to this section.', 'lsx-health-plan'), |
|
477 | 477 | 'id' => 'connected_meals', |
478 | 478 | 'type' => 'post_search_ajax', |
479 | 479 | // Optional : |
480 | 480 | 'limit' => 15, // Limit selection to X items only (default 1) |
481 | 481 | 'sortable' => true, // Allow selected items to be sortable (default false) |
482 | 482 | 'query_args' => array( |
483 | - 'post_type' => array( 'meal' ), |
|
484 | - 'post_status' => array( 'publish' ), |
|
483 | + 'post_type' => array('meal'), |
|
484 | + 'post_status' => array('publish'), |
|
485 | 485 | 'posts_per_page' => -1, |
486 | 486 | ), |
487 | 487 | 'classes' => 'lsx-field-col lsx-field-add-field lsx-field-col-33', |
488 | 488 | ) |
489 | 489 | ); |
490 | 490 | } |
491 | - if ( post_type_exists( 'tip' ) ) { |
|
491 | + if (post_type_exists('tip')) { |
|
492 | 492 | $cmb->add_group_field( |
493 | 493 | $group, |
494 | 494 | array( |
495 | - 'name' => __( 'Tips', 'lsx-health-plan' ), |
|
495 | + 'name' => __('Tips', 'lsx-health-plan'), |
|
496 | 496 | 'id' => 'connected_tips', |
497 | - 'desc' => __( 'Connect the tip(s) that apply to this section.', 'lsx-health-plan' ), |
|
497 | + 'desc' => __('Connect the tip(s) that apply to this section.', 'lsx-health-plan'), |
|
498 | 498 | 'type' => 'post_search_ajax', |
499 | 499 | // Optional : |
500 | - 'limit' => 15, // Limit selection to X items only (default 1) |
|
501 | - 'sortable' => true, // Allow selected items to be sortable (default false) |
|
500 | + 'limit' => 15, // Limit selection to X items only (default 1) |
|
501 | + 'sortable' => true, // Allow selected items to be sortable (default false) |
|
502 | 502 | 'query_args' => array( |
503 | - 'post_type' => array( 'tip' ), |
|
504 | - 'post_status' => array( 'publish' ), |
|
503 | + 'post_type' => array('tip'), |
|
504 | + 'post_status' => array('publish'), |
|
505 | 505 | 'posts_per_page' => -1, |
506 | 506 | ), |
507 | 507 | 'classes' => 'lsx-field-col lsx-field-add-field lsx-field-col-33', |