@@ -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,21 +72,21 @@ 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_day_plan_block', '\lsx_health_plan\shortcodes\day_plan_box' ); |
|
| 79 | - 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_day_plan_block', '\lsx_health_plan\shortcodes\day_plan_box'); |
|
| 79 | + add_shortcode('lsx_health_plan_account_notices', '\lsx_health_plan\shortcodes\account_notices'); |
|
| 80 | 80 | |
| 81 | - if ( post_type_exists( 'video' ) ) { |
|
| 82 | - add_shortcode( 'lsx_health_plan_featured_video_block', '\lsx_health_plan\shortcodes\feature_video_box' ); |
|
| 81 | + if (post_type_exists('video')) { |
|
| 82 | + add_shortcode('lsx_health_plan_featured_video_block', '\lsx_health_plan\shortcodes\feature_video_box'); |
|
| 83 | 83 | } |
| 84 | - if ( post_type_exists( 'recipe' ) ) { |
|
| 85 | - add_shortcode( 'lsx_health_plan_featured_recipes_block', '\lsx_health_plan\shortcodes\feature_recipes_box' ); |
|
| 84 | + if (post_type_exists('recipe')) { |
|
| 85 | + add_shortcode('lsx_health_plan_featured_recipes_block', '\lsx_health_plan\shortcodes\feature_recipes_box'); |
|
| 86 | 86 | } |
| 87 | - if ( post_type_exists( 'tip' ) ) { |
|
| 88 | - add_shortcode( 'lsx_health_plan_featured_tips_block', '\lsx_health_plan\shortcodes\feature_tips_box' ); |
|
| 87 | + if (post_type_exists('tip')) { |
|
| 88 | + add_shortcode('lsx_health_plan_featured_tips_block', '\lsx_health_plan\shortcodes\feature_tips_box'); |
|
| 89 | 89 | } |
| 90 | - add_shortcode( 'lsx_health_plan_items', '\lsx_health_plan\shortcodes\exercise_box' ); |
|
| 90 | + add_shortcode('lsx_health_plan_items', '\lsx_health_plan\shortcodes\exercise_box'); |
|
| 91 | 91 | } |
| 92 | 92 | } |
@@ -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,22 +31,22 @@ 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 | * Create Login page with woocommerce shortcode if the page is not created |
| 44 | 44 | */ |
| 45 | -if ( ( isset( $_GET['activated'] ) && function_exists( 'wp_verify_nonce' ) && wp_verify_nonce( sanitize_key( $_GET['activated'] ) ) ) && is_admin() ) { |
|
| 45 | +if ((isset($_GET['activated']) && function_exists('wp_verify_nonce') && wp_verify_nonce(sanitize_key($_GET['activated']))) && is_admin()) { |
|
| 46 | 46 | |
| 47 | 47 | $new_page_title = 'Login'; |
| 48 | 48 | // Content to add spacing and woocommerce login shortcode |
| 49 | - $new_page_content = '<!-- wp:lsx-blocks/lsx-container {"containerMaxWidth":600} --> |
|
| 49 | + $new_page_content = '<!-- wp:lsx-blocks/lsx-container {"containerMaxWidth":600} --> |
|
| 50 | 50 | <div style="background-color:transparent;padding-left:3%;padding-right:3%;padding-bottom:3%;padding-top:3%;margin-top:3%;margin-bottom:3%" class="wp-block-lsx-blocks-lsx-container aligncenter lsx-block-container"><div class="lsx-container-inside"><div class="lsx-container-content" style="max-width:600px"><!-- wp:paragraph --> |
| 51 | 51 | <p></p> |
| 52 | 52 | <!-- /wp:paragraph --> |
@@ -57,7 +57,7 @@ discard block |
||
| 57 | 57 | <!-- /wp:lsx-blocks/lsx-container -->'; |
| 58 | 58 | $new_page_template = ''; |
| 59 | 59 | |
| 60 | - $page_check = get_page_by_title( $new_page_title ); |
|
| 60 | + $page_check = get_page_by_title($new_page_title); |
|
| 61 | 61 | $new_page = array( |
| 62 | 62 | 'post_type' => 'page', |
| 63 | 63 | 'post_title' => $new_page_title, |
@@ -65,10 +65,10 @@ discard block |
||
| 65 | 65 | 'post_status' => 'publish', |
| 66 | 66 | 'post_author' => 1, |
| 67 | 67 | ); |
| 68 | - if ( ! isset( $page_check->ID ) ) { |
|
| 69 | - $new_page_id = wp_insert_post( $new_page ); |
|
| 70 | - if ( ! empty( $new_page_template ) ) { |
|
| 71 | - update_post_meta( $new_page_id, '_wp_page_template', $new_page_template ); |
|
| 68 | + if ( ! isset($page_check->ID)) { |
|
| 69 | + $new_page_id = wp_insert_post($new_page); |
|
| 70 | + if ( ! empty($new_page_template)) { |
|
| 71 | + update_post_meta($new_page_id, '_wp_page_template', $new_page_template); |
|
| 72 | 72 | } |
| 73 | 73 | } |
| 74 | 74 | } |
@@ -80,18 +80,18 @@ discard block |
||
| 80 | 80 | * @param [type] $args |
| 81 | 81 | * @return void |
| 82 | 82 | */ |
| 83 | -function lsx_add_login_logout_register_menu( $items, $args ) { |
|
| 84 | - if ( 'primary' === $args->theme_location ) { |
|
| 83 | +function lsx_add_login_logout_register_menu($items, $args) { |
|
| 84 | + if ('primary' === $args->theme_location) { |
|
| 85 | 85 | ob_start(); |
| 86 | - wp_loginout( get_permalink() ); |
|
| 86 | + wp_loginout(get_permalink()); |
|
| 87 | 87 | $loginoutlink = ob_get_contents(); |
| 88 | 88 | ob_end_clean(); |
| 89 | - if ( ! is_user_logged_in() ) { |
|
| 90 | - $login_slug = \lsx_health_plan\functions\get_option( 'login_slug', false ); |
|
| 91 | - if ( false === $login_slug ) { |
|
| 89 | + if ( ! is_user_logged_in()) { |
|
| 90 | + $login_slug = \lsx_health_plan\functions\get_option('login_slug', false); |
|
| 91 | + if (false === $login_slug) { |
|
| 92 | 92 | $login_slug = 'login'; |
| 93 | 93 | } |
| 94 | - $items .= '<li class="my-login menu-item"><a rel="nofollow" href="/' . $login_slug . '/">' . __( 'Login', 'lsx-health-plan' ) . '</a></li>'; |
|
| 94 | + $items .= '<li class="my-login menu-item"><a rel="nofollow" href="/' . $login_slug . '/">' . __('Login', 'lsx-health-plan') . '</a></li>'; |
|
| 95 | 95 | } else { |
| 96 | 96 | $items .= '<li class="my-login menu-item">' . $loginoutlink . '</li>'; |
| 97 | 97 | } |
@@ -100,7 +100,7 @@ discard block |
||
| 100 | 100 | return $items; |
| 101 | 101 | } |
| 102 | 102 | } |
| 103 | -add_filter( 'wp_nav_menu_items', 'lsx_add_login_logout_register_menu', 199, 2 ); |
|
| 103 | +add_filter('wp_nav_menu_items', 'lsx_add_login_logout_register_menu', 199, 2); |
|
| 104 | 104 | |
| 105 | 105 | /** |
| 106 | 106 | * Redirect user after login or redirect |
@@ -108,13 +108,13 @@ discard block |
||
| 108 | 108 | * @return void |
| 109 | 109 | */ |
| 110 | 110 | function lsx_login_redirect() { |
| 111 | - $plan_slug = \lsx_health_plan\functions\get_option( 'my_plan_slug', false ); |
|
| 112 | - if ( false === $plan_slug ) { |
|
| 111 | + $plan_slug = \lsx_health_plan\functions\get_option('my_plan_slug', false); |
|
| 112 | + if (false === $plan_slug) { |
|
| 113 | 113 | $plan_slug = 'my-plan'; |
| 114 | 114 | } |
| 115 | - return home_url( $plan_slug ); |
|
| 115 | + return home_url($plan_slug); |
|
| 116 | 116 | } |
| 117 | -add_filter( 'woocommerce_login_redirect', 'lsx_login_redirect' ); |
|
| 117 | +add_filter('woocommerce_login_redirect', 'lsx_login_redirect'); |
|
| 118 | 118 | |
| 119 | 119 | /** |
| 120 | 120 | * Undocumented function |
@@ -131,10 +131,10 @@ discard block |
||
| 131 | 131 | * |
| 132 | 132 | * @return void |
| 133 | 133 | */ |
| 134 | -function lsx_get_svg_icon( $icon ) { |
|
| 134 | +function lsx_get_svg_icon($icon) { |
|
| 135 | 135 | $path = '/assets/images/'; |
| 136 | 136 | |
| 137 | - if ( file_exists( LSX_HEALTH_PLAN_PATH . $path . $icon ) ) { |
|
| 137 | + if (file_exists(LSX_HEALTH_PLAN_PATH . $path . $icon)) { |
|
| 138 | 138 | // Load and return the contents of the file |
| 139 | 139 | return include LSX_HEALTH_PLAN_PATH . $path . $icon; |
| 140 | 140 | } |
@@ -148,25 +148,25 @@ discard block |
||
| 148 | 148 | * |
| 149 | 149 | * @return void |
| 150 | 150 | */ |
| 151 | -function lsx_workout_snacks( $snack ) { |
|
| 152 | - $workout_snack = get_post_meta( get_the_ID(), $snack . '_workout_snack', true ); |
|
| 153 | - if ( ! empty( $workout_snack ) ) { |
|
| 151 | +function lsx_workout_snacks($snack) { |
|
| 152 | + $workout_snack = get_post_meta(get_the_ID(), $snack . '_workout_snack', true); |
|
| 153 | + if ( ! empty($workout_snack)) { |
|
| 154 | 154 | ?> |
| 155 | - <div class="<?php echo esc_html( $snack ); ?>-workout workout-snacks"> |
|
| 155 | + <div class="<?php echo esc_html($snack); ?>-workout workout-snacks"> |
|
| 156 | 156 | <div class="content-box"> |
| 157 | 157 | <?php |
| 158 | - $snack_title = ucfirst( $snack ); |
|
| 159 | - if ( 'pre' === $snack ) { |
|
| 158 | + $snack_title = ucfirst($snack); |
|
| 159 | + if ('pre' === $snack) { |
|
| 160 | 160 | /* Translators: %s: snack */ |
| 161 | - $title_text = esc_attr_x( 'Pre-Workout Snack', 'pre workout', 'lsx-health-plan' ); |
|
| 161 | + $title_text = esc_attr_x('Pre-Workout Snack', 'pre workout', 'lsx-health-plan'); |
|
| 162 | 162 | } else { |
| 163 | 163 | /* Translators: %s: snack */ |
| 164 | - $title_text = esc_attr_x( 'Post-Workout Snack', 'post workout', 'lsx-health-plan' ); |
|
| 164 | + $title_text = esc_attr_x('Post-Workout Snack', 'post workout', 'lsx-health-plan'); |
|
| 165 | 165 | } |
| 166 | - $title = sprintf( $title_text, $snack_title ); |
|
| 166 | + $title = sprintf($title_text, $snack_title); |
|
| 167 | 167 | ?> |
| 168 | - <h3 class="title-lined"><?php echo esc_html( $title ); ?></h3> |
|
| 169 | - <?php echo wp_kses_post( apply_filters( 'the_content', $workout_snack ) ); ?> |
|
| 168 | + <h3 class="title-lined"><?php echo esc_html($title); ?></h3> |
|
| 169 | + <?php echo wp_kses_post(apply_filters('the_content', $workout_snack)); ?> |
|
| 170 | 170 | </div> |
| 171 | 171 | </div> |
| 172 | 172 | <?php |
@@ -14,13 +14,13 @@ discard block |
||
| 14 | 14 | $redirect = '/content-restricted/?r=' . $page_id . '&wcm_redirect_to=archive&wcm_redirect_id=' . $page_id; |
| 15 | 15 | ?> |
| 16 | 16 | |
| 17 | - <div id="primary" class="content-area <?php echo esc_attr( lsx_main_class() ); ?>"> |
|
| 17 | + <div id="primary" class="content-area <?php echo esc_attr(lsx_main_class()); ?>"> |
|
| 18 | 18 | |
| 19 | 19 | <?php lsx_content_before(); ?> |
| 20 | 20 | |
| 21 | 21 | <!-- Begining restricted content --> |
| 22 | 22 | <?php |
| 23 | - if ( current_user_can( 'wc_memberships_view_restricted_post_content', $post_id ) ) { |
|
| 23 | + if (current_user_can('wc_memberships_view_restricted_post_content', $post_id)) { |
|
| 24 | 24 | ?> |
| 25 | 25 | <main id="main" role="main"> |
| 26 | 26 | |
@@ -28,9 +28,9 @@ discard block |
||
| 28 | 28 | |
| 29 | 29 | <div class="post-wrapper exercise-archive-plan archive-plan"> |
| 30 | 30 | <div class="row"> |
| 31 | - <?php if ( have_posts() ) : ?> |
|
| 31 | + <?php if (have_posts()) : ?> |
|
| 32 | 32 | <?php |
| 33 | - while ( have_posts() ) : |
|
| 33 | + while (have_posts()) : |
|
| 34 | 34 | the_post(); |
| 35 | 35 | ?> |
| 36 | 36 | |
@@ -40,7 +40,7 @@ discard block |
||
| 40 | 40 | |
| 41 | 41 | <?php else : ?> |
| 42 | 42 | |
| 43 | - <?php get_template_part( 'partials/content', 'none' ); ?> |
|
| 43 | + <?php get_template_part('partials/content', 'none'); ?> |
|
| 44 | 44 | |
| 45 | 45 | <?php endif; ?> |
| 46 | 46 | </div> |
@@ -52,7 +52,7 @@ discard block |
||
| 52 | 52 | |
| 53 | 53 | <?php |
| 54 | 54 | } else { |
| 55 | - wp_redirect( $redirect ); |
|
| 55 | + wp_redirect($redirect); |
|
| 56 | 56 | exit; |
| 57 | 57 | } |
| 58 | 58 | ?> |
@@ -14,13 +14,13 @@ discard block |
||
| 14 | 14 | $redirect = '/content-restricted/?r=' . $page_id . '&wcm_redirect_to=archive&wcm_redirect_id=' . $page_id; |
| 15 | 15 | ?> |
| 16 | 16 | |
| 17 | - <div id="primary" class="content-area <?php echo esc_attr( lsx_main_class() ); ?>"> |
|
| 17 | + <div id="primary" class="content-area <?php echo esc_attr(lsx_main_class()); ?>"> |
|
| 18 | 18 | |
| 19 | 19 | <?php lsx_content_before(); ?> |
| 20 | 20 | |
| 21 | 21 | <!-- Begining restricted content --> |
| 22 | 22 | <?php |
| 23 | - if ( current_user_can( 'wc_memberships_view_restricted_post_content', $post_id ) ) { |
|
| 23 | + if (current_user_can('wc_memberships_view_restricted_post_content', $post_id)) { |
|
| 24 | 24 | ?> |
| 25 | 25 | <main id="main" role="main"> |
| 26 | 26 | |
@@ -28,9 +28,9 @@ discard block |
||
| 28 | 28 | |
| 29 | 29 | <div class="post-wrapper exercise-archive-plan archive-plan"> |
| 30 | 30 | <div class="row"> |
| 31 | - <?php if ( have_posts() ) : ?> |
|
| 31 | + <?php if (have_posts()) : ?> |
|
| 32 | 32 | <?php |
| 33 | - while ( have_posts() ) : |
|
| 33 | + while (have_posts()) : |
|
| 34 | 34 | the_post(); |
| 35 | 35 | ?> |
| 36 | 36 | |
@@ -40,7 +40,7 @@ discard block |
||
| 40 | 40 | |
| 41 | 41 | <?php else : ?> |
| 42 | 42 | |
| 43 | - <?php get_template_part( 'partials/content', 'none' ); ?> |
|
| 43 | + <?php get_template_part('partials/content', 'none'); ?> |
|
| 44 | 44 | |
| 45 | 45 | <?php endif; ?> |
| 46 | 46 | </div> |
@@ -52,7 +52,7 @@ discard block |
||
| 52 | 52 | |
| 53 | 53 | <?php |
| 54 | 54 | } else { |
| 55 | - wp_redirect( $redirect ); |
|
| 55 | + wp_redirect($redirect); |
|
| 56 | 56 | exit; |
| 57 | 57 | } |
| 58 | 58 | ?> |
@@ -9,7 +9,7 @@ discard block |
||
| 9 | 9 | |
| 10 | 10 | <?php lsx_content_wrap_before(); ?> |
| 11 | 11 | |
| 12 | -<div id="primary" class="content-area <?php echo esc_attr( lsx_main_class() ); ?>"> |
|
| 12 | +<div id="primary" class="content-area <?php echo esc_attr(lsx_main_class()); ?>"> |
|
| 13 | 13 | |
| 14 | 14 | <?php lsx_content_before(); ?> |
| 15 | 15 | |
@@ -17,10 +17,10 @@ discard block |
||
| 17 | 17 | |
| 18 | 18 | <?php lsx_content_top(); ?> |
| 19 | 19 | |
| 20 | - <?php if ( have_posts() ) : ?> |
|
| 20 | + <?php if (have_posts()) : ?> |
|
| 21 | 21 | |
| 22 | 22 | <?php |
| 23 | - while ( have_posts() ) : |
|
| 23 | + while (have_posts()) : |
|
| 24 | 24 | the_post(); |
| 25 | 25 | ?> |
| 26 | 26 | |
@@ -37,7 +37,7 @@ discard block |
||
| 37 | 37 | <?php lsx_content_after(); ?> |
| 38 | 38 | |
| 39 | 39 | <?php |
| 40 | - if ( is_singular( 'post' ) ) { |
|
| 40 | + if (is_singular('post')) { |
|
| 41 | 41 | lsx_post_nav(); |
| 42 | 42 | } |
| 43 | 43 | ?> |
@@ -79,7 +79,7 @@ discard block |
||
| 79 | 79 | */ |
| 80 | 80 | public static function get_instance() { |
| 81 | 81 | // If the single instance hasn't been set, set it now. |
| 82 | - if ( null === self::$instance ) { |
|
| 82 | + if (null === self::$instance) { |
|
| 83 | 83 | self::$instance = new self(); |
| 84 | 84 | } |
| 85 | 85 | return self::$instance; |
@@ -92,24 +92,24 @@ discard block |
||
| 92 | 92 | * @param string $post_type |
| 93 | 93 | * @return boolean |
| 94 | 94 | */ |
| 95 | - public function has_gallery( $item_id = '', $post_type = '' ) { |
|
| 95 | + public function has_gallery($item_id = '', $post_type = '') { |
|
| 96 | 96 | $this->gallery = array(); |
| 97 | 97 | $this->has_gallery = false; |
| 98 | - if ( '' === $item_id ) { |
|
| 98 | + if ('' === $item_id) { |
|
| 99 | 99 | $this->item_id = get_the_ID(); |
| 100 | 100 | } else { |
| 101 | 101 | $this->item_id = $item_id; |
| 102 | 102 | } |
| 103 | 103 | |
| 104 | - if ( '' === $post_type ) { |
|
| 105 | - $this->post_type = get_post_type( $this->item_id ); |
|
| 104 | + if ('' === $post_type) { |
|
| 105 | + $this->post_type = get_post_type($this->item_id); |
|
| 106 | 106 | } |
| 107 | - $gallery = get_post_meta( $this->item_id, $this->post_type . '_gallery', true ); |
|
| 108 | - if ( ! empty( $gallery ) ) { |
|
| 107 | + $gallery = get_post_meta($this->item_id, $this->post_type . '_gallery', true); |
|
| 108 | + if ( ! empty($gallery)) { |
|
| 109 | 109 | $this->gallery = $gallery; |
| 110 | 110 | $this->has_gallery = true; |
| 111 | - wp_enqueue_script( 'slick', LSX_HEALTH_PLAN_URL . 'assets/js/src/slick.min.js', array( 'jquery' ), LSX_HEALTH_PLAN_VER, true ); |
|
| 112 | - wp_enqueue_script( 'lsx-health-plan-slider', LSX_HEALTH_PLAN_URL . 'assets/js/src/lsx-health-plan-slider.js', array( 'slick' ), LSX_HEALTH_PLAN_VER, true ); |
|
| 111 | + wp_enqueue_script('slick', LSX_HEALTH_PLAN_URL . 'assets/js/src/slick.min.js', array('jquery'), LSX_HEALTH_PLAN_VER, true); |
|
| 112 | + wp_enqueue_script('lsx-health-plan-slider', LSX_HEALTH_PLAN_URL . 'assets/js/src/lsx-health-plan-slider.js', array('slick'), LSX_HEALTH_PLAN_VER, true); |
|
| 113 | 113 | } |
| 114 | 114 | return $this->has_gallery; |
| 115 | 115 | } |
@@ -121,11 +121,11 @@ discard block |
||
| 121 | 121 | * @param string $post_type |
| 122 | 122 | * @return array |
| 123 | 123 | */ |
| 124 | - public function get_defaults( $item_id = '', $post_type = '' ) { |
|
| 125 | - if ( '' === $item_id ) { |
|
| 124 | + public function get_defaults($item_id = '', $post_type = '') { |
|
| 125 | + if ('' === $item_id) { |
|
| 126 | 126 | $item_id = $this->item_id; |
| 127 | 127 | } |
| 128 | - if ( '' === $post_type ) { |
|
| 128 | + if ('' === $post_type) { |
|
| 129 | 129 | $post_type = $this->post_type; |
| 130 | 130 | } |
| 131 | 131 | $this->defaults = array( |
@@ -134,10 +134,10 @@ discard block |
||
| 134 | 134 | 'interval' => false, |
| 135 | 135 | 'css_class' => false, |
| 136 | 136 | ); |
| 137 | - foreach ( $this->defaults as $key => $default ) { |
|
| 138 | - $override = get_post_meta( $item_id, $this->post_type . '_gallery_' . $key, true ); |
|
| 139 | - if ( '' !== $override && false !== $override && ! empty( $override ) ) { |
|
| 140 | - $this->defaults[ $key ] = $override; |
|
| 137 | + foreach ($this->defaults as $key => $default) { |
|
| 138 | + $override = get_post_meta($item_id, $this->post_type . '_gallery_' . $key, true); |
|
| 139 | + if ('' !== $override && false !== $override && ! empty($override)) { |
|
| 140 | + $this->defaults[$key] = $override; |
|
| 141 | 141 | } |
| 142 | 142 | } |
| 143 | 143 | return $this->defaults; |
@@ -150,13 +150,13 @@ discard block |
||
| 150 | 150 | * @param string $post_type |
| 151 | 151 | * @return void |
| 152 | 152 | */ |
| 153 | - public function get_gallery( $item_id = '', $post_type = '', $args = array() ) { |
|
| 153 | + public function get_gallery($item_id = '', $post_type = '', $args = array()) { |
|
| 154 | 154 | $return = ''; |
| 155 | 155 | $this->html = array(); |
| 156 | - $this->args = wp_parse_args( $args, $this->get_defaults( $item_id, $post_type ) ); |
|
| 157 | - if ( ! empty( $this->gallery ) ) { |
|
| 156 | + $this->args = wp_parse_args($args, $this->get_defaults($item_id, $post_type)); |
|
| 157 | + if ( ! empty($this->gallery)) { |
|
| 158 | 158 | $this->args['count'] = 1; |
| 159 | - if ( '' !== $post_type ) { |
|
| 159 | + if ('' !== $post_type) { |
|
| 160 | 160 | $this->args['post_type'] = $post_type; |
| 161 | 161 | } else { |
| 162 | 162 | $this->args['post_type'] = $this->post_type; |
@@ -165,20 +165,20 @@ discard block |
||
| 165 | 165 | // output the opening boostrap row divs. |
| 166 | 166 | $this->before_loop(); |
| 167 | 167 | |
| 168 | - foreach ( $this->gallery as $key => $gallery ) { |
|
| 168 | + foreach ($this->gallery as $key => $gallery) { |
|
| 169 | 169 | |
| 170 | 170 | $this->loop_start(); |
| 171 | 171 | |
| 172 | - if ( isset( $gallery['exercise_gallery_image_id'] ) && ! empty( $gallery['exercise_gallery_image_id'] ) ) { |
|
| 173 | - $this->html[] = '<img alt="' . get_the_title( $gallery['exercise_gallery_image_id'] ) . '" src="' . $gallery['exercise_gallery_image'] . '" />'; |
|
| 174 | - } elseif ( isset( $gallery['exercise_gallery_external'] ) && ! empty( $gallery['exercise_gallery_external'] ) ) { |
|
| 172 | + if (isset($gallery['exercise_gallery_image_id']) && ! empty($gallery['exercise_gallery_image_id'])) { |
|
| 173 | + $this->html[] = '<img alt="' . get_the_title($gallery['exercise_gallery_image_id']) . '" src="' . $gallery['exercise_gallery_image'] . '" />'; |
|
| 174 | + } elseif (isset($gallery['exercise_gallery_external']) && ! empty($gallery['exercise_gallery_external'])) { |
|
| 175 | 175 | $this->html[] = $gallery['exercise_gallery_external']; // WPCS: XSS OK. |
| 176 | - } elseif ( isset( $gallery['exercise_gallery_embed'] ) && ! empty( $gallery['exercise_gallery_embed'] ) ) { |
|
| 176 | + } elseif (isset($gallery['exercise_gallery_embed']) && ! empty($gallery['exercise_gallery_embed'])) { |
|
| 177 | 177 | $embed_args = array( |
| 178 | 178 | 'width' => '530', |
| 179 | 179 | ); |
| 180 | - $embed = wp_oembed_get( $gallery['exercise_gallery_embed'], $embed_args ); |
|
| 181 | - $this->html[] = str_replace( 'width="530"', 'width="100%"', $embed ); // WPCS: XSS OK. |
|
| 180 | + $embed = wp_oembed_get($gallery['exercise_gallery_embed'], $embed_args); |
|
| 181 | + $this->html[] = str_replace('width="530"', 'width="100%"', $embed); // WPCS: XSS OK. |
|
| 182 | 182 | } |
| 183 | 183 | |
| 184 | 184 | $this->loop_end(); |
@@ -191,8 +191,8 @@ discard block |
||
| 191 | 191 | } |
| 192 | 192 | |
| 193 | 193 | // Join the html output if its not empty. |
| 194 | - if ( ! empty( $this->html ) ) { |
|
| 195 | - $return = implode( '', $this->html ); |
|
| 194 | + if ( ! empty($this->html)) { |
|
| 195 | + $return = implode('', $this->html); |
|
| 196 | 196 | } |
| 197 | 197 | return $return; |
| 198 | 198 | } |
@@ -213,8 +213,8 @@ discard block |
||
| 213 | 213 | * Runs just after the if and before the while statement in $this->output() |
| 214 | 214 | */ |
| 215 | 215 | public function before_loop() { |
| 216 | - if ( 'slider' === $this->args['layout'] ) { |
|
| 217 | - $this->carousel_id = wp_rand( 20, 20000 ); |
|
| 216 | + if ('slider' === $this->args['layout']) { |
|
| 217 | + $this->carousel_id = wp_rand(20, 20000); |
|
| 218 | 218 | $this->html[] = "<div class='lsx-hp-widget-items slick-slider slick-dotted slick-has-arrows {$this->args['css_class']} ' data-interval='{$this->args['interval']}' data-slick='{ \"slidesToShow\": {$this->args['columns']}, \"slidesToScroll\": {$this->args['columns']} }'>"; |
| 219 | 219 | } else { |
| 220 | 220 | $this->html[] = "<div class='lsx-hp-widget-items widget-item-grid-layout'>"; |
@@ -226,10 +226,10 @@ discard block |
||
| 226 | 226 | */ |
| 227 | 227 | public function loop_start() { |
| 228 | 228 | // Get the call for the active slide. |
| 229 | - if ( 'slider' === $this->args['layout'] ) { |
|
| 229 | + if ('slider' === $this->args['layout']) { |
|
| 230 | 230 | $this->html[] = "<div class='lsx-hp-widget-item-wrap lsx-{$this->args['post_type']}'>"; |
| 231 | 231 | } else { |
| 232 | - if ( 1 === $this->args['count'] ) { |
|
| 232 | + if (1 === $this->args['count']) { |
|
| 233 | 233 | $this->html[] = "<div class='row'>"; |
| 234 | 234 | } |
| 235 | 235 | $this->html[] = '<div class="' . $this->column_class() . '">'; |
@@ -240,16 +240,16 @@ discard block |
||
| 240 | 240 | * Runs at the very end of the loop before it runs again. |
| 241 | 241 | */ |
| 242 | 242 | public function loop_end() { |
| 243 | - if ( 'slider' !== $this->args['layout'] ) { |
|
| 243 | + if ('slider' !== $this->args['layout']) { |
|
| 244 | 244 | $this->html[] = '</div>'; |
| 245 | 245 | } |
| 246 | 246 | // Close the current slide panel. |
| 247 | - if ( 'slider' === $this->args['layout'] ) { |
|
| 247 | + if ('slider' === $this->args['layout']) { |
|
| 248 | 248 | $this->html[] = '</div>'; |
| 249 | - } elseif ( 0 === $this->args['count'] % $this->args['columns'] || count( $this->gallery ) === $this->args['count'] ) { |
|
| 249 | + } elseif (0 === $this->args['count'] % $this->args['columns'] || count($this->gallery) === $this->args['count']) { |
|
| 250 | 250 | $this->html[] = '</div>'; |
| 251 | 251 | |
| 252 | - if ( $this->args['count'] < count( $this->gallery ) ) { |
|
| 252 | + if ($this->args['count'] < count($this->gallery)) { |
|
| 253 | 253 | $this->html[] = "<div class='row'>"; |
| 254 | 254 | } |
| 255 | 255 | } |
@@ -260,7 +260,7 @@ discard block |
||
| 260 | 260 | */ |
| 261 | 261 | public function after_loop() { |
| 262 | 262 | // Slider output Closing. |
| 263 | - if ( 'slider' === $this->args['layout'] ) { |
|
| 263 | + if ('slider' === $this->args['layout']) { |
|
| 264 | 264 | $this->html[] = '</div>'; |
| 265 | 265 | } else { |
| 266 | 266 | $this->html[] = '</div>'; |
@@ -11,8 +11,8 @@ discard block |
||
| 11 | 11 | * @return exercise_type |
| 12 | 12 | */ |
| 13 | 13 | function lsx_health_plan_exercise_type() { |
| 14 | - $term_obj_list = get_the_term_list( get_the_ID(), 'exercise-type', '', ', ' ); |
|
| 15 | - if ( ! empty( $term_obj_list ) ) { |
|
| 14 | + $term_obj_list = get_the_term_list(get_the_ID(), 'exercise-type', '', ', '); |
|
| 15 | + if ( ! empty($term_obj_list)) { |
|
| 16 | 16 | return $term_obj_list; |
| 17 | 17 | } |
| 18 | 18 | } |
@@ -23,8 +23,8 @@ discard block |
||
| 23 | 23 | * @return muscle_group_equipment |
| 24 | 24 | */ |
| 25 | 25 | function lsx_health_plan_muscle_group_equipment() { |
| 26 | - $term_obj_list = get_the_term_list( get_the_ID(), 'muscle-group', '', ', ' ); |
|
| 27 | - if ( ! empty( $term_obj_list ) ) { |
|
| 26 | + $term_obj_list = get_the_term_list(get_the_ID(), 'muscle-group', '', ', '); |
|
| 27 | + if ( ! empty($term_obj_list)) { |
|
| 28 | 28 | return $term_obj_list; |
| 29 | 29 | } |
| 30 | 30 | } |
@@ -35,8 +35,8 @@ discard block |
||
| 35 | 35 | * @return exercise_equipment |
| 36 | 36 | */ |
| 37 | 37 | function lsx_health_plan_exercise_equipment() { |
| 38 | - $term_obj_list = get_the_term_list( get_the_ID(), 'equipment', '', ', ' ); |
|
| 39 | - if ( ! empty( $term_obj_list ) ) { |
|
| 38 | + $term_obj_list = get_the_term_list(get_the_ID(), 'equipment', '', ', '); |
|
| 39 | + if ( ! empty($term_obj_list)) { |
|
| 40 | 40 | return $term_obj_list; |
| 41 | 41 | } |
| 42 | 42 | } |
@@ -59,61 +59,61 @@ discard block |
||
| 59 | 59 | * @param array $args |
| 60 | 60 | * @return void |
| 61 | 61 | */ |
| 62 | -function lsx_health_plan_workout_exercise_button( $m, $group, $echo = true, $args = array() ) { |
|
| 62 | +function lsx_health_plan_workout_exercise_button($m, $group, $echo = true, $args = array()) { |
|
| 63 | 63 | $defaults = array( |
| 64 | 64 | 'modal_trigger' => 'button', |
| 65 | 65 | 'modal_content' => 'excerpt', |
| 66 | 66 | ); |
| 67 | - $args = wp_parse_args( $args, $defaults ); |
|
| 67 | + $args = wp_parse_args($args, $defaults); |
|
| 68 | 68 | |
| 69 | 69 | $exercise_id = ''; |
| 70 | - if ( isset( $group['connected_exercises'] ) && '' !== $group['connected_exercises'] ) { |
|
| 71 | - $exercise_id = esc_html( $group['connected_exercises'] ); |
|
| 72 | - $content = get_post_field( 'post_content', $exercise_id ); |
|
| 73 | - $url = get_permalink( $exercise_id ); |
|
| 74 | - $equipment_group = get_the_term_list( $exercise_id, 'equipment', '', ', ' ); |
|
| 75 | - $muscle_group = get_the_term_list( $exercise_id, 'muscle-group', '', ', ' ); |
|
| 70 | + if (isset($group['connected_exercises']) && '' !== $group['connected_exercises']) { |
|
| 71 | + $exercise_id = esc_html($group['connected_exercises']); |
|
| 72 | + $content = get_post_field('post_content', $exercise_id); |
|
| 73 | + $url = get_permalink($exercise_id); |
|
| 74 | + $equipment_group = get_the_term_list($exercise_id, 'equipment', '', ', '); |
|
| 75 | + $muscle_group = get_the_term_list($exercise_id, 'muscle-group', '', ', '); |
|
| 76 | 76 | $lsx_hp = lsx_health_plan(); |
| 77 | 77 | |
| 78 | - if ( 'excerpt' === $args['modal_content'] ) { |
|
| 79 | - $content = wp_trim_words( $content, 40 ); |
|
| 78 | + if ('excerpt' === $args['modal_content']) { |
|
| 79 | + $content = wp_trim_words($content, 40); |
|
| 80 | 80 | } |
| 81 | 81 | |
| 82 | - if ( 'link' ) { |
|
| 83 | - $play_button = '<a data-toggle="modal" href="#workout-exercise-modal-' . $m . '">' . get_the_title( $exercise_id ) . '</a>'; |
|
| 82 | + if ('link') { |
|
| 83 | + $play_button = '<a data-toggle="modal" href="#workout-exercise-modal-' . $m . '">' . get_the_title($exercise_id) . '</a>'; |
|
| 84 | 84 | } else { |
| 85 | 85 | $play_button = '<button data-toggle="modal" data-target="#workout-exercise-modal-' . $m . '"><span class="fa fa-play-circle"></span></button>'; |
| 86 | 86 | } |
| 87 | 87 | |
| 88 | - $modal_body = ''; |
|
| 89 | - if ( $lsx_hp->frontend->gallery->has_gallery( $exercise_id ) ) { |
|
| 88 | + $modal_body = ''; |
|
| 89 | + if ($lsx_hp->frontend->gallery->has_gallery($exercise_id)) { |
|
| 90 | 90 | $gallery_args = array( |
| 91 | 91 | 'css_class' => 'modal-slider', |
| 92 | 92 | ); |
| 93 | - $modal_body .= $lsx_hp->frontend->gallery->get_gallery( '', '', $gallery_args ); |
|
| 93 | + $modal_body .= $lsx_hp->frontend->gallery->get_gallery('', '', $gallery_args); |
|
| 94 | 94 | } else { |
| 95 | - $modal_body .= '<div class="modal-image"/>' . get_the_post_thumbnail( $exercise_id, 'large' ) . '</div>'; |
|
| 95 | + $modal_body .= '<div class="modal-image"/>' . get_the_post_thumbnail($exercise_id, 'large') . '</div>'; |
|
| 96 | 96 | } |
| 97 | 97 | |
| 98 | - $modal_body .= '<div class="title-lined exercise-modal"><h5 class="modal-title">' . get_the_title( $exercise_id ) . '</h5>'; |
|
| 98 | + $modal_body .= '<div class="title-lined exercise-modal"><h5 class="modal-title">' . get_the_title($exercise_id) . '</h5>'; |
|
| 99 | 99 | |
| 100 | - if ( ! empty( $equipment_group ) ) { |
|
| 101 | - $modal_body .= '<span class="equipment-terms">' . __( 'Equipment', 'lsx-health-plan' ) . ': ' . $equipment_group . '</span>'; |
|
| 100 | + if ( ! empty($equipment_group)) { |
|
| 101 | + $modal_body .= '<span class="equipment-terms">' . __('Equipment', 'lsx-health-plan') . ': ' . $equipment_group . '</span>'; |
|
| 102 | 102 | } |
| 103 | - if ( ! empty( $muscle_group ) ) { |
|
| 104 | - $modal_body .= '<span class="muscle-terms">' . __( 'Muscle Group', 'lsx-health-plan' ) . ': ' . $muscle_group . '</span>'; |
|
| 103 | + if ( ! empty($muscle_group)) { |
|
| 104 | + $modal_body .= '<span class="muscle-terms">' . __('Muscle Group', 'lsx-health-plan') . ': ' . $muscle_group . '</span>'; |
|
| 105 | 105 | } |
| 106 | 106 | $modal_body .= '</div>'; |
| 107 | - if ( '' !== $args['modal_content'] ) { |
|
| 107 | + if ('' !== $args['modal_content']) { |
|
| 108 | 108 | $modal_body .= '<div class="modal-excerpt"/>' . $content . '</div>'; |
| 109 | 109 | } |
| 110 | - if ( 'excerpt' === $args['modal_content'] ) { |
|
| 111 | - $modal_body .= '<a class="moretag" target="_blank" href="' . $url . '">' . __( 'Read More', 'lsx-health-plan' ) . '</a>'; |
|
| 110 | + if ('excerpt' === $args['modal_content']) { |
|
| 111 | + $modal_body .= '<a class="moretag" target="_blank" href="' . $url . '">' . __('Read More', 'lsx-health-plan') . '</a>'; |
|
| 112 | 112 | } |
| 113 | - \lsx_health_plan\functions\register_modal( 'workout-exercise-modal-' . $m, '', $modal_body ); |
|
| 113 | + \lsx_health_plan\functions\register_modal('workout-exercise-modal-' . $m, '', $modal_body); |
|
| 114 | 114 | |
| 115 | - if ( true === $echo ) { |
|
| 116 | - echo wp_kses_post( $play_button ); |
|
| 115 | + if (true === $echo) { |
|
| 116 | + echo wp_kses_post($play_button); |
|
| 117 | 117 | } else { |
| 118 | 118 | return $play_button; |
| 119 | 119 | } |
@@ -127,39 +127,39 @@ discard block |
||
| 127 | 127 | * @param array $group |
| 128 | 128 | * @return void |
| 129 | 129 | */ |
| 130 | -function lsx_health_plan_shortcode_exercise_button( $m, $content = true ) { |
|
| 131 | - $equipment_group = get_the_term_list( $m, 'equipment', '', ', ' ); |
|
| 132 | - $muscle_group = get_the_term_list( $m, 'muscle-group', '', ', ' ); |
|
| 130 | +function lsx_health_plan_shortcode_exercise_button($m, $content = true) { |
|
| 131 | + $equipment_group = get_the_term_list($m, 'equipment', '', ', '); |
|
| 132 | + $muscle_group = get_the_term_list($m, 'muscle-group', '', ', '); |
|
| 133 | 133 | $title = get_the_title(); |
| 134 | 134 | $lsx_hp = lsx_health_plan(); |
| 135 | - $button = '<a data-toggle="modal" href="#exercise-modal-' . $m . '" data-target="#exercise-modal-' . $m . '"></a>'; |
|
| 135 | + $button = '<a data-toggle="modal" href="#exercise-modal-' . $m . '" data-target="#exercise-modal-' . $m . '"></a>'; |
|
| 136 | 136 | |
| 137 | - if ( true === $content ) { |
|
| 137 | + if (true === $content) { |
|
| 138 | 138 | $content = get_the_content(); |
| 139 | 139 | } |
| 140 | 140 | |
| 141 | 141 | $modal_body = ''; |
| 142 | - if ( $lsx_hp->frontend->gallery->has_gallery( $m ) ) { |
|
| 142 | + if ($lsx_hp->frontend->gallery->has_gallery($m)) { |
|
| 143 | 143 | $gallery_args = array( |
| 144 | 144 | 'css_class' => 'modal-slider', |
| 145 | 145 | ); |
| 146 | - $modal_body .= $lsx_hp->frontend->gallery->get_gallery( '', '', $gallery_args ); |
|
| 146 | + $modal_body .= $lsx_hp->frontend->gallery->get_gallery('', '', $gallery_args); |
|
| 147 | 147 | } else { |
| 148 | - $modal_body .= '<div class="modal-image">' . get_the_post_thumbnail( $m, 'large' ) . '</div>'; |
|
| 148 | + $modal_body .= '<div class="modal-image">' . get_the_post_thumbnail($m, 'large') . '</div>'; |
|
| 149 | 149 | } |
| 150 | 150 | $modal_body .= '<div class="title-lined exercise-modal"><h5 class="modal-title">' . $title . '</h5>'; |
| 151 | 151 | |
| 152 | - if ( ! empty( $equipment_group ) ) { |
|
| 152 | + if ( ! empty($equipment_group)) { |
|
| 153 | 153 | $modal_body .= '<span class="equipment-terms">Equipment: ' . $equipment_group . '</span>'; |
| 154 | 154 | } |
| 155 | - if ( ! empty( $muscle_group ) ) { |
|
| 155 | + if ( ! empty($muscle_group)) { |
|
| 156 | 156 | $modal_body .= '<span class="muscle-terms">Muscle Group: ' . $muscle_group . '</span>'; |
| 157 | 157 | } |
| 158 | 158 | $modal_body .= '</div>'; |
| 159 | 159 | $modal_body .= $content; |
| 160 | - \lsx_health_plan\functions\register_modal( 'exercise-modal-' . $m, '', $modal_body ); |
|
| 160 | + \lsx_health_plan\functions\register_modal('exercise-modal-' . $m, '', $modal_body); |
|
| 161 | 161 | |
| 162 | - return ( $button ); |
|
| 162 | + return ($button); |
|
| 163 | 163 | } |
| 164 | 164 | |
| 165 | 165 | /** |
@@ -170,18 +170,18 @@ discard block |
||
| 170 | 170 | * @param boolean $echo |
| 171 | 171 | * @return string |
| 172 | 172 | */ |
| 173 | -function lsx_health_plan_exercise_title( $before = '', $after = '', $echo = true, $exercise_id = false ) { |
|
| 174 | - if ( false === $exercise_id ) { |
|
| 173 | +function lsx_health_plan_exercise_title($before = '', $after = '', $echo = true, $exercise_id = false) { |
|
| 174 | + if (false === $exercise_id) { |
|
| 175 | 175 | $exercise_id = get_the_ID(); |
| 176 | 176 | } |
| 177 | - $title = get_the_title( $exercise_id ); |
|
| 178 | - $side = get_post_meta( $exercise_id, 'exercise_side', true ); |
|
| 179 | - if ( '' !== $side ) { |
|
| 180 | - $title .= ' - ' . ucwords( $side ); |
|
| 177 | + $title = get_the_title($exercise_id); |
|
| 178 | + $side = get_post_meta($exercise_id, 'exercise_side', true); |
|
| 179 | + if ('' !== $side) { |
|
| 180 | + $title .= ' - ' . ucwords($side); |
|
| 181 | 181 | } |
| 182 | - $title = apply_filters( 'lsx_health_plan_exercise_title', $before . $title . $after, $title, $before, $after, $exercise_id ); |
|
| 183 | - if ( true === $echo ) { |
|
| 184 | - echo wp_kses_post( $title ); |
|
| 182 | + $title = apply_filters('lsx_health_plan_exercise_title', $before . $title . $after, $title, $before, $after, $exercise_id); |
|
| 183 | + if (true === $echo) { |
|
| 184 | + echo wp_kses_post($title); |
|
| 185 | 185 | } else { |
| 186 | 186 | return $title; |
| 187 | 187 | } |
@@ -30,26 +30,26 @@ discard block |
||
| 30 | 30 | * Contructor |
| 31 | 31 | */ |
| 32 | 32 | public function __construct() { |
| 33 | - if ( false !== \lsx_health_plan\functions\get_option( 'exercise_enabled', false ) ) { |
|
| 33 | + if (false !== \lsx_health_plan\functions\get_option('exercise_enabled', false)) { |
|
| 34 | 34 | // Post Type and Taxonomies. |
| 35 | - add_action( 'init', array( $this, 'register_post_type' ) ); |
|
| 36 | - add_action( 'init', array( $this, 'exercise_type_taxonomy_setup' ) ); |
|
| 37 | - add_action( 'init', array( $this, 'equipment_taxonomy_setup' ) ); |
|
| 38 | - add_action( 'init', array( $this, 'muscle_group_taxonomy_setup' ) ); |
|
| 39 | - add_action( 'admin_menu', array( $this, 'register_menus' ) ); |
|
| 35 | + add_action('init', array($this, 'register_post_type')); |
|
| 36 | + add_action('init', array($this, 'exercise_type_taxonomy_setup')); |
|
| 37 | + add_action('init', array($this, 'equipment_taxonomy_setup')); |
|
| 38 | + add_action('init', array($this, 'muscle_group_taxonomy_setup')); |
|
| 39 | + add_action('admin_menu', array($this, 'register_menus')); |
|
| 40 | 40 | |
| 41 | 41 | // Settings. |
| 42 | - add_action( 'lsx_hp_settings_page', array( $this, 'register_settings' ), 10, 1 ); |
|
| 42 | + add_action('lsx_hp_settings_page', array($this, 'register_settings'), 10, 1); |
|
| 43 | 43 | |
| 44 | 44 | // Custom Fields. |
| 45 | - add_action( 'cmb2_admin_init', array( $this, 'exercise_details' ), 8 ); |
|
| 46 | - add_action( 'cmb2_admin_init', array( $this, 'gallery_metabox' ), 9 ); |
|
| 47 | - add_action( 'cmb2_admin_init', array( $this, 'tips_metabox' ) ); |
|
| 48 | - add_filter( 'lsx_health_plan_connections', array( $this, 'enable_connections' ), 10, 1 ); |
|
| 45 | + add_action('cmb2_admin_init', array($this, 'exercise_details'), 8); |
|
| 46 | + add_action('cmb2_admin_init', array($this, 'gallery_metabox'), 9); |
|
| 47 | + add_action('cmb2_admin_init', array($this, 'tips_metabox')); |
|
| 48 | + add_filter('lsx_health_plan_connections', array($this, 'enable_connections'), 10, 1); |
|
| 49 | 49 | |
| 50 | 50 | // Template Redirects. |
| 51 | - add_filter( 'lsx_health_plan_archive_template', array( $this, 'enable_post_type' ), 10, 1 ); |
|
| 52 | - add_filter( 'lsx_health_plan_single_template', array( $this, 'enable_post_type' ), 10, 1 ); |
|
| 51 | + add_filter('lsx_health_plan_archive_template', array($this, 'enable_post_type'), 10, 1); |
|
| 52 | + add_filter('lsx_health_plan_single_template', array($this, 'enable_post_type'), 10, 1); |
|
| 53 | 53 | } |
| 54 | 54 | } |
| 55 | 55 | |
@@ -62,7 +62,7 @@ discard block |
||
| 62 | 62 | */ |
| 63 | 63 | public static function get_instance() { |
| 64 | 64 | // If the single instance hasn't been set, set it now. |
| 65 | - if ( null === self::$instance ) { |
|
| 65 | + if (null === self::$instance) { |
|
| 66 | 66 | self::$instance = new self(); |
| 67 | 67 | } |
| 68 | 68 | return self::$instance; |
@@ -72,21 +72,21 @@ discard block |
||
| 72 | 72 | */ |
| 73 | 73 | public function register_post_type() { |
| 74 | 74 | $labels = array( |
| 75 | - 'name' => esc_html__( 'Exercise', 'lsx-health-plan' ), |
|
| 76 | - 'singular_name' => esc_html__( 'Exercises', 'lsx-health-plan' ), |
|
| 77 | - 'add_new' => esc_html_x( 'Add New', 'post type general name', 'lsx-health-plan' ), |
|
| 78 | - 'add_new_item' => esc_html__( 'Add New', 'lsx-health-plan' ), |
|
| 79 | - 'edit_item' => esc_html__( 'Edit', 'lsx-health-plan' ), |
|
| 80 | - 'new_item' => esc_html__( 'New', 'lsx-health-plan' ), |
|
| 81 | - 'all_items' => esc_html__( 'All', 'lsx-health-plan' ), |
|
| 82 | - 'view_item' => esc_html__( 'View', 'lsx-health-plan' ), |
|
| 83 | - 'search_items' => esc_html__( 'Search', 'lsx-health-plan' ), |
|
| 84 | - 'not_found' => esc_html__( 'None found', 'lsx-health-plan' ), |
|
| 85 | - 'not_found_in_trash' => esc_html__( 'None found in Trash', 'lsx-health-plan' ), |
|
| 75 | + 'name' => esc_html__('Exercise', 'lsx-health-plan'), |
|
| 76 | + 'singular_name' => esc_html__('Exercises', 'lsx-health-plan'), |
|
| 77 | + 'add_new' => esc_html_x('Add New', 'post type general name', 'lsx-health-plan'), |
|
| 78 | + 'add_new_item' => esc_html__('Add New', 'lsx-health-plan'), |
|
| 79 | + 'edit_item' => esc_html__('Edit', 'lsx-health-plan'), |
|
| 80 | + 'new_item' => esc_html__('New', 'lsx-health-plan'), |
|
| 81 | + 'all_items' => esc_html__('All', 'lsx-health-plan'), |
|
| 82 | + 'view_item' => esc_html__('View', 'lsx-health-plan'), |
|
| 83 | + 'search_items' => esc_html__('Search', 'lsx-health-plan'), |
|
| 84 | + 'not_found' => esc_html__('None found', 'lsx-health-plan'), |
|
| 85 | + 'not_found_in_trash' => esc_html__('None found in Trash', 'lsx-health-plan'), |
|
| 86 | 86 | 'parent_item_colon' => '', |
| 87 | - 'menu_name' => esc_html__( 'Exercises', 'lsx-health-plan' ), |
|
| 87 | + 'menu_name' => esc_html__('Exercises', 'lsx-health-plan'), |
|
| 88 | 88 | ); |
| 89 | - $args = array( |
|
| 89 | + $args = array( |
|
| 90 | 90 | 'labels' => $labels, |
| 91 | 91 | 'public' => true, |
| 92 | 92 | 'publicly_queryable' => true, |
@@ -96,10 +96,10 @@ discard block |
||
| 96 | 96 | 'menu_icon' => 'dashicons-universal-access', |
| 97 | 97 | 'query_var' => true, |
| 98 | 98 | 'rewrite' => array( |
| 99 | - 'slug' => \lsx_health_plan\functions\get_option( 'endpoint_exercise_single', 'exercise' ), |
|
| 99 | + 'slug' => \lsx_health_plan\functions\get_option('endpoint_exercise_single', 'exercise'), |
|
| 100 | 100 | ), |
| 101 | 101 | 'capability_type' => 'page', |
| 102 | - 'has_archive' => \lsx_health_plan\functions\get_option( 'endpoint_exercise_archive', 'exercises' ), |
|
| 102 | + 'has_archive' => \lsx_health_plan\functions\get_option('endpoint_exercise_archive', 'exercises'), |
|
| 103 | 103 | 'hierarchical' => false, |
| 104 | 104 | 'menu_position' => null, |
| 105 | 105 | 'supports' => array( |
@@ -109,7 +109,7 @@ discard block |
||
| 109 | 109 | 'excerpt', |
| 110 | 110 | ), |
| 111 | 111 | ); |
| 112 | - register_post_type( 'exercise', $args ); |
|
| 112 | + register_post_type('exercise', $args); |
|
| 113 | 113 | } |
| 114 | 114 | |
| 115 | 115 | /** |
@@ -119,17 +119,17 @@ discard block |
||
| 119 | 119 | */ |
| 120 | 120 | public function exercise_type_taxonomy_setup() { |
| 121 | 121 | $labels = array( |
| 122 | - 'name' => esc_html_x( 'Exercise Type', 'taxonomy general name', 'lsx-health-plan' ), |
|
| 123 | - 'singular_name' => esc_html_x( 'Exercise Type', 'taxonomy singular name', 'lsx-health-plan' ), |
|
| 124 | - 'search_items' => esc_html__( 'Search', 'lsx-health-plan' ), |
|
| 125 | - 'all_items' => esc_html__( 'All', 'lsx-health-plan' ), |
|
| 126 | - 'parent_item' => esc_html__( 'Parent', 'lsx-health-plan' ), |
|
| 127 | - 'parent_item_colon' => esc_html__( 'Parent:', 'lsx-health-plan' ), |
|
| 128 | - 'edit_item' => esc_html__( 'Edit', 'lsx-health-plan' ), |
|
| 129 | - 'update_item' => esc_html__( 'Update', 'lsx-health-plan' ), |
|
| 130 | - 'add_new_item' => esc_html__( 'Add New', 'lsx-health-plan' ), |
|
| 131 | - 'new_item_name' => esc_html__( 'New Name', 'lsx-health-plan' ), |
|
| 132 | - 'menu_name' => esc_html__( 'Exercise Types', 'lsx-health-plan' ), |
|
| 122 | + 'name' => esc_html_x('Exercise Type', 'taxonomy general name', 'lsx-health-plan'), |
|
| 123 | + 'singular_name' => esc_html_x('Exercise Type', 'taxonomy singular name', 'lsx-health-plan'), |
|
| 124 | + 'search_items' => esc_html__('Search', 'lsx-health-plan'), |
|
| 125 | + 'all_items' => esc_html__('All', 'lsx-health-plan'), |
|
| 126 | + 'parent_item' => esc_html__('Parent', 'lsx-health-plan'), |
|
| 127 | + 'parent_item_colon' => esc_html__('Parent:', 'lsx-health-plan'), |
|
| 128 | + 'edit_item' => esc_html__('Edit', 'lsx-health-plan'), |
|
| 129 | + 'update_item' => esc_html__('Update', 'lsx-health-plan'), |
|
| 130 | + 'add_new_item' => esc_html__('Add New', 'lsx-health-plan'), |
|
| 131 | + 'new_item_name' => esc_html__('New Name', 'lsx-health-plan'), |
|
| 132 | + 'menu_name' => esc_html__('Exercise Types', 'lsx-health-plan'), |
|
| 133 | 133 | ); |
| 134 | 134 | |
| 135 | 135 | $args = array( |
@@ -139,12 +139,12 @@ discard block |
||
| 139 | 139 | 'show_admin_column' => true, |
| 140 | 140 | 'query_var' => true, |
| 141 | 141 | 'rewrite' => array( |
| 142 | - 'slug' => \lsx_health_plan\functions\get_option( 'endpoint_exercise_type', 'exercise-type' ), |
|
| 142 | + 'slug' => \lsx_health_plan\functions\get_option('endpoint_exercise_type', 'exercise-type'), |
|
| 143 | 143 | ), |
| 144 | 144 | 'show_in_rest' => true, |
| 145 | 145 | ); |
| 146 | 146 | |
| 147 | - register_taxonomy( 'exercise-type', array( 'exercise' ), $args ); |
|
| 147 | + register_taxonomy('exercise-type', array('exercise'), $args); |
|
| 148 | 148 | } |
| 149 | 149 | |
| 150 | 150 | /** |
@@ -154,17 +154,17 @@ discard block |
||
| 154 | 154 | */ |
| 155 | 155 | public function equipment_taxonomy_setup() { |
| 156 | 156 | $labels = array( |
| 157 | - 'name' => esc_html_x( 'Equipment', 'taxonomy general name', 'lsx-health-plan' ), |
|
| 158 | - 'singular_name' => esc_html_x( 'Equipment', 'taxonomy singular name', 'lsx-health-plan' ), |
|
| 159 | - 'search_items' => esc_html__( 'Search', 'lsx-health-plan' ), |
|
| 160 | - 'all_items' => esc_html__( 'All', 'lsx-health-plan' ), |
|
| 161 | - 'parent_item' => esc_html__( 'Parent', 'lsx-health-plan' ), |
|
| 162 | - 'parent_item_colon' => esc_html__( 'Parent:', 'lsx-health-plan' ), |
|
| 163 | - 'edit_item' => esc_html__( 'Edit', 'lsx-health-plan' ), |
|
| 164 | - 'update_item' => esc_html__( 'Update', 'lsx-health-plan' ), |
|
| 165 | - 'add_new_item' => esc_html__( 'Add New', 'lsx-health-plan' ), |
|
| 166 | - 'new_item_name' => esc_html__( 'New Name', 'lsx-health-plan' ), |
|
| 167 | - 'menu_name' => esc_html__( 'Equipment', 'lsx-health-plan' ), |
|
| 157 | + 'name' => esc_html_x('Equipment', 'taxonomy general name', 'lsx-health-plan'), |
|
| 158 | + 'singular_name' => esc_html_x('Equipment', 'taxonomy singular name', 'lsx-health-plan'), |
|
| 159 | + 'search_items' => esc_html__('Search', 'lsx-health-plan'), |
|
| 160 | + 'all_items' => esc_html__('All', 'lsx-health-plan'), |
|
| 161 | + 'parent_item' => esc_html__('Parent', 'lsx-health-plan'), |
|
| 162 | + 'parent_item_colon' => esc_html__('Parent:', 'lsx-health-plan'), |
|
| 163 | + 'edit_item' => esc_html__('Edit', 'lsx-health-plan'), |
|
| 164 | + 'update_item' => esc_html__('Update', 'lsx-health-plan'), |
|
| 165 | + 'add_new_item' => esc_html__('Add New', 'lsx-health-plan'), |
|
| 166 | + 'new_item_name' => esc_html__('New Name', 'lsx-health-plan'), |
|
| 167 | + 'menu_name' => esc_html__('Equipment', 'lsx-health-plan'), |
|
| 168 | 168 | ); |
| 169 | 169 | |
| 170 | 170 | $args = array( |
@@ -174,12 +174,12 @@ discard block |
||
| 174 | 174 | 'show_admin_column' => true, |
| 175 | 175 | 'query_var' => true, |
| 176 | 176 | 'rewrite' => array( |
| 177 | - 'slug' => \lsx_health_plan\functions\get_option( 'endpoint_exercise_equipment', 'equipment' ), |
|
| 177 | + 'slug' => \lsx_health_plan\functions\get_option('endpoint_exercise_equipment', 'equipment'), |
|
| 178 | 178 | ), |
| 179 | 179 | 'show_in_rest' => true, |
| 180 | 180 | ); |
| 181 | 181 | |
| 182 | - register_taxonomy( 'equipment', array( 'exercise' ), $args ); |
|
| 182 | + register_taxonomy('equipment', array('exercise'), $args); |
|
| 183 | 183 | } |
| 184 | 184 | |
| 185 | 185 | /** |
@@ -189,17 +189,17 @@ discard block |
||
| 189 | 189 | */ |
| 190 | 190 | public function muscle_group_taxonomy_setup() { |
| 191 | 191 | $labels = array( |
| 192 | - 'name' => esc_html_x( 'Muscle Groups', 'taxonomy general name', 'lsx-health-plan' ), |
|
| 193 | - 'singular_name' => esc_html_x( 'Muscle Group', 'taxonomy singular name', 'lsx-health-plan' ), |
|
| 194 | - 'search_items' => esc_html__( 'Search', 'lsx-health-plan' ), |
|
| 195 | - 'all_items' => esc_html__( 'All', 'lsx-health-plan' ), |
|
| 196 | - 'parent_item' => esc_html__( 'Parent', 'lsx-health-plan' ), |
|
| 197 | - 'parent_item_colon' => esc_html__( 'Parent:', 'lsx-health-plan' ), |
|
| 198 | - 'edit_item' => esc_html__( 'Edit', 'lsx-health-plan' ), |
|
| 199 | - 'update_item' => esc_html__( 'Update', 'lsx-health-plan' ), |
|
| 200 | - 'add_new_item' => esc_html__( 'Add New', 'lsx-health-plan' ), |
|
| 201 | - 'new_item_name' => esc_html__( 'New Name', 'lsx-health-plan' ), |
|
| 202 | - 'menu_name' => esc_html__( 'Muscle Groups', 'lsx-health-plan' ), |
|
| 192 | + 'name' => esc_html_x('Muscle Groups', 'taxonomy general name', 'lsx-health-plan'), |
|
| 193 | + 'singular_name' => esc_html_x('Muscle Group', 'taxonomy singular name', 'lsx-health-plan'), |
|
| 194 | + 'search_items' => esc_html__('Search', 'lsx-health-plan'), |
|
| 195 | + 'all_items' => esc_html__('All', 'lsx-health-plan'), |
|
| 196 | + 'parent_item' => esc_html__('Parent', 'lsx-health-plan'), |
|
| 197 | + 'parent_item_colon' => esc_html__('Parent:', 'lsx-health-plan'), |
|
| 198 | + 'edit_item' => esc_html__('Edit', 'lsx-health-plan'), |
|
| 199 | + 'update_item' => esc_html__('Update', 'lsx-health-plan'), |
|
| 200 | + 'add_new_item' => esc_html__('Add New', 'lsx-health-plan'), |
|
| 201 | + 'new_item_name' => esc_html__('New Name', 'lsx-health-plan'), |
|
| 202 | + 'menu_name' => esc_html__('Muscle Groups', 'lsx-health-plan'), |
|
| 203 | 203 | ); |
| 204 | 204 | |
| 205 | 205 | $args = array( |
@@ -209,12 +209,12 @@ discard block |
||
| 209 | 209 | 'show_admin_column' => true, |
| 210 | 210 | 'query_var' => true, |
| 211 | 211 | 'rewrite' => array( |
| 212 | - 'slug' => \lsx_health_plan\functions\get_option( 'endpoint_exercise_musclegroup', 'muscle-group' ), |
|
| 212 | + 'slug' => \lsx_health_plan\functions\get_option('endpoint_exercise_musclegroup', 'muscle-group'), |
|
| 213 | 213 | ), |
| 214 | 214 | 'show_in_rest' => true, |
| 215 | 215 | ); |
| 216 | 216 | |
| 217 | - register_taxonomy( 'muscle-group', array( 'exercise' ), $args ); |
|
| 217 | + register_taxonomy('muscle-group', array('exercise'), $args); |
|
| 218 | 218 | } |
| 219 | 219 | |
| 220 | 220 | /** |
@@ -223,10 +223,10 @@ discard block |
||
| 223 | 223 | * @return void |
| 224 | 224 | */ |
| 225 | 225 | public function register_menus() { |
| 226 | - add_submenu_page( 'edit.php?post_type=workout', esc_html__( 'Exercises', 'lsx-health-plan' ), esc_html__( 'Exercises', 'lsx-health-plan' ), 'edit_posts', 'edit.php?post_type=exercise' ); |
|
| 227 | - add_submenu_page( 'edit.php?post_type=workout', esc_html__( 'Exercise Types', 'lsx-health-plan' ), esc_html__( 'Exercise Types', 'lsx-health-plan' ), 'edit_posts', 'edit-tags.php?taxonomy=exercise-type&post_type=exercise' ); |
|
| 228 | - add_submenu_page( 'edit.php?post_type=workout', esc_html__( 'Equipment', 'lsx-health-plan' ), esc_html__( 'Equipment', 'lsx-health-plan' ), 'edit_posts', 'edit-tags.php?taxonomy=equipment&post_type=exercise' ); |
|
| 229 | - add_submenu_page( 'edit.php?post_type=workout', esc_html__( 'Muscle Groups', 'lsx-health-plan' ), esc_html__( 'Muscle Groups', 'lsx-health-plan' ), 'edit_posts', 'edit-tags.php?taxonomy=muscle-group&post_type=exercise' ); |
|
| 226 | + add_submenu_page('edit.php?post_type=workout', esc_html__('Exercises', 'lsx-health-plan'), esc_html__('Exercises', 'lsx-health-plan'), 'edit_posts', 'edit.php?post_type=exercise'); |
|
| 227 | + add_submenu_page('edit.php?post_type=workout', esc_html__('Exercise Types', 'lsx-health-plan'), esc_html__('Exercise Types', 'lsx-health-plan'), 'edit_posts', 'edit-tags.php?taxonomy=exercise-type&post_type=exercise'); |
|
| 228 | + add_submenu_page('edit.php?post_type=workout', esc_html__('Equipment', 'lsx-health-plan'), esc_html__('Equipment', 'lsx-health-plan'), 'edit_posts', 'edit-tags.php?taxonomy=equipment&post_type=exercise'); |
|
| 229 | + add_submenu_page('edit.php?post_type=workout', esc_html__('Muscle Groups', 'lsx-health-plan'), esc_html__('Muscle Groups', 'lsx-health-plan'), 'edit_posts', 'edit-tags.php?taxonomy=muscle-group&post_type=exercise'); |
|
| 230 | 230 | } |
| 231 | 231 | |
| 232 | 232 | /** |
@@ -236,8 +236,8 @@ discard block |
||
| 236 | 236 | $cmb = new_cmb2_box( |
| 237 | 237 | array( |
| 238 | 238 | 'id' => $this->slug . '_tips_details_metabox', |
| 239 | - 'title' => __( 'Exercise Tips', 'lsx-health-plan' ), |
|
| 240 | - 'object_types' => array( $this->slug ), // Post type |
|
| 239 | + 'title' => __('Exercise Tips', 'lsx-health-plan'), |
|
| 240 | + 'object_types' => array($this->slug), // Post type |
|
| 241 | 241 | 'context' => 'normal', |
| 242 | 242 | 'priority' => 'low', |
| 243 | 243 | 'show_names' => true, |
@@ -250,9 +250,9 @@ discard block |
||
| 250 | 250 | 'id' => $this->slug . '_tips', |
| 251 | 251 | 'type' => 'group', |
| 252 | 252 | 'options' => array( |
| 253 | - 'group_title' => __( 'Tip', 'your-text-domain' ) . ' {#}', // {#} gets replaced by row number |
|
| 254 | - 'add_button' => __( 'Add another tip', 'your-text-domain' ), |
|
| 255 | - 'remove_button' => __( 'Remove tip', 'your-text-domain' ), |
|
| 253 | + 'group_title' => __('Tip', 'your-text-domain') . ' {#}', // {#} gets replaced by row number |
|
| 254 | + 'add_button' => __('Add another tip', 'your-text-domain'), |
|
| 255 | + 'remove_button' => __('Remove tip', 'your-text-domain'), |
|
| 256 | 256 | 'sortable' => true, |
| 257 | 257 | ), |
| 258 | 258 | 'classes' => 'lsx-admin-row', |
@@ -263,13 +263,13 @@ discard block |
||
| 263 | 263 | $cmb->add_group_field( |
| 264 | 264 | $tip_group, |
| 265 | 265 | array( |
| 266 | - 'name' => __( 'Thumbnail', 'your-text-domain' ), |
|
| 266 | + 'name' => __('Thumbnail', 'your-text-domain'), |
|
| 267 | 267 | 'id' => $this->slug . '_tip_thumbnail', |
| 268 | 268 | 'type' => 'file', |
| 269 | 269 | 'text' => array( |
| 270 | - 'add_upload_file_text' => __( 'Add File', 'lsx-health-plan' ), |
|
| 270 | + 'add_upload_file_text' => __('Add File', 'lsx-health-plan'), |
|
| 271 | 271 | ), |
| 272 | - 'desc' => __( 'Upload an image 300px x 300px in size.', 'lsx-health-plan' ), |
|
| 272 | + 'desc' => __('Upload an image 300px x 300px in size.', 'lsx-health-plan'), |
|
| 273 | 273 | 'query_args' => array( |
| 274 | 274 | 'type' => array( |
| 275 | 275 | 'image/gif', |
@@ -285,7 +285,7 @@ discard block |
||
| 285 | 285 | $cmb->add_group_field( |
| 286 | 286 | $tip_group, |
| 287 | 287 | array( |
| 288 | - 'name' => __( 'Description', 'your-text-domain' ), |
|
| 288 | + 'name' => __('Description', 'your-text-domain'), |
|
| 289 | 289 | 'id' => $this->slug . '_tip_content', |
| 290 | 290 | 'type' => 'textarea', |
| 291 | 291 | 'classes' => 'lsx-field-col lsx-field-connect-field lsx-field-col-75', |
@@ -299,7 +299,7 @@ discard block |
||
| 299 | 299 | * @param array $post_types |
| 300 | 300 | * @return array |
| 301 | 301 | */ |
| 302 | - public function enable_post_type( $post_types = array() ) { |
|
| 302 | + public function enable_post_type($post_types = array()) { |
|
| 303 | 303 | $post_types[] = $this->slug; |
| 304 | 304 | return $post_types; |
| 305 | 305 | } |
@@ -310,7 +310,7 @@ discard block |
||
| 310 | 310 | * @param array $connections |
| 311 | 311 | * @return void |
| 312 | 312 | */ |
| 313 | - public function enable_connections( $connections = array() ) { |
|
| 313 | + public function enable_connections($connections = array()) { |
|
| 314 | 314 | $connections['exercise']['connected_workouts'] = 'connected_exercises'; |
| 315 | 315 | $connections['workout']['connected_exercises'] = 'connected_workouts'; |
| 316 | 316 | return $connections; |
@@ -322,24 +322,24 @@ discard block |
||
| 322 | 322 | * @param object $cmb new_cmb2_box(). |
| 323 | 323 | * @return void |
| 324 | 324 | */ |
| 325 | - public function register_settings( $cmb ) { |
|
| 325 | + public function register_settings($cmb) { |
|
| 326 | 326 | $cmb->add_field( |
| 327 | 327 | array( |
| 328 | 328 | 'id' => 'exercise_archive_settings_title', |
| 329 | 329 | 'type' => 'title', |
| 330 | - 'name' => __( 'Exercises Archive', 'lsx-health-plan' ), |
|
| 331 | - 'description' => __( 'All of the settings relating to the exercises post type archive.', 'lsx-health-plan' ), |
|
| 330 | + 'name' => __('Exercises Archive', 'lsx-health-plan'), |
|
| 331 | + 'description' => __('All of the settings relating to the exercises post type archive.', 'lsx-health-plan'), |
|
| 332 | 332 | ) |
| 333 | 333 | ); |
| 334 | 334 | $cmb->add_field( |
| 335 | 335 | array( |
| 336 | 336 | 'id' => 'exercise_archive_description', |
| 337 | 337 | 'type' => 'wysiwyg', |
| 338 | - 'name' => __( 'Archive Description', 'lsx-health-plan' ), |
|
| 339 | - 'description' => __( 'This will show up on the post type archive.', 'lsx-health-plan' ), |
|
| 338 | + 'name' => __('Archive Description', 'lsx-health-plan'), |
|
| 339 | + 'description' => __('This will show up on the post type archive.', 'lsx-health-plan'), |
|
| 340 | 340 | ) |
| 341 | 341 | ); |
| 342 | - do_action( 'lsx_hp_exercise_settings_page', $cmb ); |
|
| 342 | + do_action('lsx_hp_exercise_settings_page', $cmb); |
|
| 343 | 343 | $cmb->add_field( |
| 344 | 344 | array( |
| 345 | 345 | 'id' => 'settings_exercise_archive_closing', |
@@ -355,8 +355,8 @@ discard block |
||
| 355 | 355 | $cmb = new_cmb2_box( |
| 356 | 356 | array( |
| 357 | 357 | 'id' => $this->slug . '_gallery_details_metabox', |
| 358 | - 'title' => __( 'Exercise Gallery', 'lsx-health-plan' ), |
|
| 359 | - 'object_types' => array( $this->slug ), |
|
| 358 | + 'title' => __('Exercise Gallery', 'lsx-health-plan'), |
|
| 359 | + 'object_types' => array($this->slug), |
|
| 360 | 360 | 'context' => 'normal', |
| 361 | 361 | 'priority' => 'low', |
| 362 | 362 | 'show_names' => true, |
@@ -365,19 +365,19 @@ discard block |
||
| 365 | 365 | |
| 366 | 366 | $cmb->add_field( |
| 367 | 367 | array( |
| 368 | - 'name' => __( 'Layout', 'lsx-health-plan' ), |
|
| 368 | + 'name' => __('Layout', 'lsx-health-plan'), |
|
| 369 | 369 | 'id' => $this->slug . '_gallery_layout', |
| 370 | 370 | 'type' => 'radio', |
| 371 | 371 | 'options' => array( |
| 372 | - 'slider' => __( 'Slider', 'your-text-domain' ) . ' {#}', // {#} gets replaced by row number |
|
| 373 | - 'grid' => __( 'Grid', 'your-text-domain' ), |
|
| 372 | + 'slider' => __('Slider', 'your-text-domain') . ' {#}', // {#} gets replaced by row number |
|
| 373 | + 'grid' => __('Grid', 'your-text-domain'), |
|
| 374 | 374 | ), |
| 375 | 375 | ) |
| 376 | 376 | ); |
| 377 | 377 | |
| 378 | 378 | $cmb->add_field( |
| 379 | 379 | array( |
| 380 | - 'name' => __( 'Grid Columns', 'lsx-health-plan' ), |
|
| 380 | + 'name' => __('Grid Columns', 'lsx-health-plan'), |
|
| 381 | 381 | 'id' => $this->slug . '_gallery_columns', |
| 382 | 382 | 'type' => 'text', |
| 383 | 383 | 'default' => '3', |
@@ -390,9 +390,9 @@ discard block |
||
| 390 | 390 | 'id' => $this->slug . '_gallery', |
| 391 | 391 | 'type' => 'group', |
| 392 | 392 | 'options' => array( |
| 393 | - 'group_title' => __( 'Gallery', 'your-text-domain' ) . ' {#}', // {#} gets replaced by row number |
|
| 394 | - 'add_button' => __( 'Add Item', 'your-text-domain' ), |
|
| 395 | - 'remove_button' => __( 'Remove Item', 'your-text-domain' ), |
|
| 393 | + 'group_title' => __('Gallery', 'your-text-domain') . ' {#}', // {#} gets replaced by row number |
|
| 394 | + 'add_button' => __('Add Item', 'your-text-domain'), |
|
| 395 | + 'remove_button' => __('Remove Item', 'your-text-domain'), |
|
| 396 | 396 | 'sortable' => true, |
| 397 | 397 | ), |
| 398 | 398 | 'classes' => 'lsx-admin-row', |
@@ -403,13 +403,13 @@ discard block |
||
| 403 | 403 | $cmb->add_group_field( |
| 404 | 404 | $gallery_group, |
| 405 | 405 | array( |
| 406 | - 'name' => __( 'Image', 'your-text-domain' ), |
|
| 406 | + 'name' => __('Image', 'your-text-domain'), |
|
| 407 | 407 | 'id' => $this->slug . '_gallery_image', |
| 408 | 408 | 'type' => 'file', |
| 409 | 409 | 'text' => array( |
| 410 | - 'add_upload_file_text' => __( 'Add File', 'lsx-health-plan' ), |
|
| 410 | + 'add_upload_file_text' => __('Add File', 'lsx-health-plan'), |
|
| 411 | 411 | ), |
| 412 | - 'desc' => __( 'Upload an image a minimum of 800px x 600px in size.', 'lsx-health-plan' ), |
|
| 412 | + 'desc' => __('Upload an image a minimum of 800px x 600px in size.', 'lsx-health-plan'), |
|
| 413 | 413 | 'query_args' => array( |
| 414 | 414 | 'type' => array( |
| 415 | 415 | 'image/gif', |
@@ -426,10 +426,10 @@ discard block |
||
| 426 | 426 | $cmb->add_group_field( |
| 427 | 427 | $gallery_group, |
| 428 | 428 | array( |
| 429 | - 'name' => __( 'oEmbed', 'your-text-domain' ), |
|
| 429 | + 'name' => __('oEmbed', 'your-text-domain'), |
|
| 430 | 430 | 'id' => $this->slug . '_gallery_embed', |
| 431 | 431 | 'type' => 'text', |
| 432 | - 'desc' => __( 'Drop in the embed url for your video from YouTube, Vimeo or DailyMotion, e.g: "https://www.youtube.com/watch?v=9xwazD5SyVg". A full list of supports formats can be found at <a href="https://make.wordpress.org/support/user-manual/content/media/adding-media-to-your-pages-and-posts/embedding-media-from-other-sites/">WordPress</a>', 'lsx-health-plan' ), |
|
| 432 | + 'desc' => __('Drop in the embed url for your video from YouTube, Vimeo or DailyMotion, e.g: "https://www.youtube.com/watch?v=9xwazD5SyVg". A full list of supports formats can be found at <a href="https://make.wordpress.org/support/user-manual/content/media/adding-media-to-your-pages-and-posts/embedding-media-from-other-sites/">WordPress</a>', 'lsx-health-plan'), |
|
| 433 | 433 | 'classes' => 'lsx-field-col lsx-field-connect-field lsx-field-col-33', |
| 434 | 434 | ) |
| 435 | 435 | ); |
@@ -437,10 +437,10 @@ discard block |
||
| 437 | 437 | $cmb->add_group_field( |
| 438 | 438 | $gallery_group, |
| 439 | 439 | array( |
| 440 | - 'name' => __( 'External Media', 'your-text-domain' ), |
|
| 440 | + 'name' => __('External Media', 'your-text-domain'), |
|
| 441 | 441 | 'id' => $this->slug . '_gallery_external', |
| 442 | 442 | 'type' => 'textarea_code', |
| 443 | - 'desc' => __( 'Drop in the iFrame embed code from Giphy in this field, i.e: <iframe src="https://giphy.com/embed/3o7527Rn1HxXWqgxuo" width="480" height="270" frameborder="0" class="giphy-embed" allowfullscreen></iframe>', 'lsx-health-plan' ), |
|
| 443 | + 'desc' => __('Drop in the iFrame embed code from Giphy in this field, i.e: <iframe src="https://giphy.com/embed/3o7527Rn1HxXWqgxuo" width="480" height="270" frameborder="0" class="giphy-embed" allowfullscreen></iframe>', 'lsx-health-plan'), |
|
| 444 | 444 | 'classes' => 'lsx-field-col lsx-field-connect-field lsx-field-col-33', |
| 445 | 445 | ) |
| 446 | 446 | ); |
@@ -455,8 +455,8 @@ discard block |
||
| 455 | 455 | $cmb = new_cmb2_box( |
| 456 | 456 | array( |
| 457 | 457 | 'id' => $this->slug . '_general_details_metabox', |
| 458 | - 'title' => __( 'Details', 'lsx-health-plan' ), |
|
| 459 | - 'object_types' => array( $this->slug ), |
|
| 458 | + 'title' => __('Details', 'lsx-health-plan'), |
|
| 459 | + 'object_types' => array($this->slug), |
|
| 460 | 460 | 'context' => 'normal', |
| 461 | 461 | 'priority' => 'high', |
| 462 | 462 | 'show_names' => true, |
@@ -465,15 +465,15 @@ discard block |
||
| 465 | 465 | |
| 466 | 466 | $cmb->add_field( |
| 467 | 467 | array( |
| 468 | - 'name' => __( 'Side', 'lsx-health-plan' ), |
|
| 468 | + 'name' => __('Side', 'lsx-health-plan'), |
|
| 469 | 469 | 'id' => $this->slug . '_side', |
| 470 | 470 | 'type' => 'select', |
| 471 | 471 | 'options' => array( |
| 472 | - '' => __( 'Select', 'your-text-domain' ), |
|
| 473 | - 'left' => __( 'Left', 'your-text-domain' ), |
|
| 474 | - 'right' => __( 'Right', 'your-text-domain' ), |
|
| 472 | + '' => __('Select', 'your-text-domain'), |
|
| 473 | + 'left' => __('Left', 'your-text-domain'), |
|
| 474 | + 'right' => __('Right', 'your-text-domain'), |
|
| 475 | 475 | ), |
| 476 | - 'desc' => __( 'Select which side this exercise uses. ', 'lsx-health-plan' ), |
|
| 476 | + 'desc' => __('Select which side this exercise uses. ', 'lsx-health-plan'), |
|
| 477 | 477 | ) |
| 478 | 478 | ); |
| 479 | 479 | } |
@@ -31,7 +31,7 @@ discard block |
||
| 31 | 31 | * Contructor |
| 32 | 32 | */ |
| 33 | 33 | public function __construct() { |
| 34 | - add_action( 'wp_enqueue_scripts', array( $this, 'assets' ), 5 ); |
|
| 34 | + add_action('wp_enqueue_scripts', array($this, 'assets'), 5); |
|
| 35 | 35 | |
| 36 | 36 | require_once LSX_HEALTH_PLAN_PATH . 'classes/frontend/class-endpoints.php'; |
| 37 | 37 | $this->endpoints = Endpoints::get_instance(); |
@@ -42,20 +42,20 @@ discard block |
||
| 42 | 42 | require_once LSX_HEALTH_PLAN_PATH . 'classes/frontend/class-gallery.php'; |
| 43 | 43 | $this->gallery = frontend\Gallery::get_instance(); |
| 44 | 44 | |
| 45 | - if ( is_admin() ) { |
|
| 46 | - add_filter( 'lsx_customizer_colour_selectors_body', array( $this, 'customizer_body_colours_handler' ), 15, 2 ); |
|
| 45 | + if (is_admin()) { |
|
| 46 | + add_filter('lsx_customizer_colour_selectors_body', array($this, 'customizer_body_colours_handler'), 15, 2); |
|
| 47 | 47 | } |
| 48 | 48 | |
| 49 | 49 | // Handle the template redirects. |
| 50 | - add_filter( 'template_include', array( $this, 'archive_template_include' ), 99 ); |
|
| 51 | - add_filter( 'template_include', array( $this, 'single_template_include' ), 99 ); |
|
| 52 | - add_filter( 'template_include', array( $this, 'taxonomy_template_include' ), 99 ); |
|
| 53 | - add_action( 'template_redirect', array( $this, 'redirect' ) ); |
|
| 50 | + add_filter('template_include', array($this, 'archive_template_include'), 99); |
|
| 51 | + add_filter('template_include', array($this, 'single_template_include'), 99); |
|
| 52 | + add_filter('template_include', array($this, 'taxonomy_template_include'), 99); |
|
| 53 | + add_action('template_redirect', array($this, 'redirect')); |
|
| 54 | 54 | |
| 55 | - add_action( 'init', array( $this, 'handle_day_action' ), 100 ); |
|
| 56 | - add_filter( 'wp_kses_allowed_html', array( $this, 'wpkses_post_tags' ), 100, 2 ); |
|
| 55 | + add_action('init', array($this, 'handle_day_action'), 100); |
|
| 56 | + add_filter('wp_kses_allowed_html', array($this, 'wpkses_post_tags'), 100, 2); |
|
| 57 | 57 | |
| 58 | - add_filter( 'get_the_archive_title', array( $this, 'get_the_archive_title' ), 99, 1 ); |
|
| 58 | + add_filter('get_the_archive_title', array($this, 'get_the_archive_title'), 99, 1); |
|
| 59 | 59 | } |
| 60 | 60 | |
| 61 | 61 | /** |
@@ -67,7 +67,7 @@ discard block |
||
| 67 | 67 | */ |
| 68 | 68 | public static function get_instance() { |
| 69 | 69 | // If the single instance hasn't been set, set it now. |
| 70 | - if ( null === self::$instance ) { |
|
| 70 | + if (null === self::$instance) { |
|
| 71 | 71 | self::$instance = new self(); |
| 72 | 72 | } |
| 73 | 73 | return self::$instance; |
@@ -79,15 +79,15 @@ discard block |
||
| 79 | 79 | * @return void |
| 80 | 80 | */ |
| 81 | 81 | public function assets() { |
| 82 | - wp_enqueue_style( 'lsx-health-plan', LSX_HEALTH_PLAN_URL . 'assets/css/lsx-health-plan.css', array(), LSX_HEALTH_PLAN_VER ); |
|
| 83 | - wp_style_add_data( 'lsx-health-plan', 'rtl', 'replace' ); |
|
| 84 | - wp_enqueue_script( 'lsx-health-plan-scripts', LSX_HEALTH_PLAN_URL . 'assets/js/src/lsx-health-plan-admin.js', array( 'jquery' ) ); |
|
| 82 | + wp_enqueue_style('lsx-health-plan', LSX_HEALTH_PLAN_URL . 'assets/css/lsx-health-plan.css', array(), LSX_HEALTH_PLAN_VER); |
|
| 83 | + wp_style_add_data('lsx-health-plan', 'rtl', 'replace'); |
|
| 84 | + wp_enqueue_script('lsx-health-plan-scripts', LSX_HEALTH_PLAN_URL . 'assets/js/src/lsx-health-plan-admin.js', array('jquery')); |
|
| 85 | 85 | } |
| 86 | 86 | |
| 87 | 87 | /** |
| 88 | 88 | * Handle body colours that might be change by LSX Customizer. |
| 89 | 89 | */ |
| 90 | - public function customizer_body_colours_handler( $css, $colors ) { |
|
| 90 | + public function customizer_body_colours_handler($css, $colors) { |
|
| 91 | 91 | $css .= ' |
| 92 | 92 | @import "' . LSX_HEALTH_PLAN_PATH . '/assets/css/scss/partials/customizer-health-plan-body-colours"; |
| 93 | 93 | |
@@ -110,11 +110,11 @@ discard block |
||
| 110 | 110 | /** |
| 111 | 111 | * Archive template. |
| 112 | 112 | */ |
| 113 | - public function archive_template_include( $template ) { |
|
| 114 | - $applicable_post_types = apply_filters( 'lsx_health_plan_archive_template', array() ); |
|
| 115 | - if ( ! empty( $applicable_post_types ) && is_main_query() && is_post_type_archive( $applicable_post_types ) ) { |
|
| 113 | + public function archive_template_include($template) { |
|
| 114 | + $applicable_post_types = apply_filters('lsx_health_plan_archive_template', array()); |
|
| 115 | + if ( ! empty($applicable_post_types) && is_main_query() && is_post_type_archive($applicable_post_types)) { |
|
| 116 | 116 | $post_type = get_post_type(); |
| 117 | - if ( empty( locate_template( array( 'archive-' . $post_type . '.php' ) ) ) && file_exists( LSX_HEALTH_PLAN_PATH . 'templates/archive-' . $post_type . '.php' ) ) { |
|
| 117 | + if (empty(locate_template(array('archive-' . $post_type . '.php'))) && file_exists(LSX_HEALTH_PLAN_PATH . 'templates/archive-' . $post_type . '.php')) { |
|
| 118 | 118 | $template = LSX_HEALTH_PLAN_PATH . 'templates/archive-' . $post_type . '.php'; |
| 119 | 119 | } |
| 120 | 120 | } |
@@ -124,11 +124,11 @@ discard block |
||
| 124 | 124 | /** |
| 125 | 125 | * Single template. |
| 126 | 126 | */ |
| 127 | - public function single_template_include( $template ) { |
|
| 128 | - $applicable_post_types = apply_filters( 'lsx_health_plan_single_template', array() ); |
|
| 129 | - if ( ! empty( $applicable_post_types ) && is_main_query() && is_singular( $applicable_post_types ) ) { |
|
| 127 | + public function single_template_include($template) { |
|
| 128 | + $applicable_post_types = apply_filters('lsx_health_plan_single_template', array()); |
|
| 129 | + if ( ! empty($applicable_post_types) && is_main_query() && is_singular($applicable_post_types)) { |
|
| 130 | 130 | $post_type = get_post_type(); |
| 131 | - if ( empty( locate_template( array( 'single-' . $post_type . '.php' ) ) ) && file_exists( LSX_HEALTH_PLAN_PATH . 'templates/single-' . $post_type . '.php' ) ) { |
|
| 131 | + if (empty(locate_template(array('single-' . $post_type . '.php'))) && file_exists(LSX_HEALTH_PLAN_PATH . 'templates/single-' . $post_type . '.php')) { |
|
| 132 | 132 | $template = LSX_HEALTH_PLAN_PATH . 'templates/single-' . $post_type . '.php'; |
| 133 | 133 | } |
| 134 | 134 | } |
@@ -141,11 +141,11 @@ discard block |
||
| 141 | 141 | * @param $template string |
| 142 | 142 | * @return string |
| 143 | 143 | */ |
| 144 | - public function taxonomy_template_include( $template ) { |
|
| 145 | - $applicable_taxonomies = apply_filters( 'lsx_health_plan_taxonomies_template', array() ); |
|
| 146 | - if ( is_main_query() && is_tax( $applicable_taxonomies ) ) { |
|
| 147 | - $current_taxonomy = get_query_var( 'taxonomy' ); |
|
| 148 | - if ( '' === locate_template( array( 'taxonomy-' . $current_taxonomy . '.php' ) ) && file_exists( LSX_HEALTH_PLAN_PATH . 'templates/taxonomy-' . $current_taxonomy . '.php' ) ) { |
|
| 144 | + public function taxonomy_template_include($template) { |
|
| 145 | + $applicable_taxonomies = apply_filters('lsx_health_plan_taxonomies_template', array()); |
|
| 146 | + if (is_main_query() && is_tax($applicable_taxonomies)) { |
|
| 147 | + $current_taxonomy = get_query_var('taxonomy'); |
|
| 148 | + if ('' === locate_template(array('taxonomy-' . $current_taxonomy . '.php')) && file_exists(LSX_HEALTH_PLAN_PATH . 'templates/taxonomy-' . $current_taxonomy . '.php')) { |
|
| 149 | 149 | $template = LSX_HEALTH_PLAN_PATH . 'templates/taxonomy-' . $current_taxonomy . '.php'; |
| 150 | 150 | } |
| 151 | 151 | } |
@@ -158,17 +158,17 @@ discard block |
||
| 158 | 158 | * @return void |
| 159 | 159 | */ |
| 160 | 160 | public function redirect() { |
| 161 | - if ( ! is_user_logged_in() || ! function_exists( 'wc_get_page_id' ) || is_home() ) { |
|
| 161 | + if ( ! is_user_logged_in() || ! function_exists('wc_get_page_id') || is_home()) { |
|
| 162 | 162 | return; |
| 163 | 163 | } |
| 164 | - if ( lsx_health_plan_user_has_purchase() && ( is_page( wc_get_page_id( 'cart' ) ) || is_page( wc_get_page_id( 'checkout' ) ) ) ) { |
|
| 165 | - wp_redirect( get_permalink( wc_get_page_id( 'myaccount' ) ) ); |
|
| 164 | + if (lsx_health_plan_user_has_purchase() && (is_page(wc_get_page_id('cart')) || is_page(wc_get_page_id('checkout')))) { |
|
| 165 | + wp_redirect(get_permalink(wc_get_page_id('myaccount'))); |
|
| 166 | 166 | die; |
| 167 | 167 | } |
| 168 | 168 | |
| 169 | - $product_id = \lsx_health_plan\functions\get_option( 'membership_product', false ); |
|
| 170 | - if ( false !== $product_id && is_single( $product_id ) ) { |
|
| 171 | - wp_redirect( home_url() ); |
|
| 169 | + $product_id = \lsx_health_plan\functions\get_option('membership_product', false); |
|
| 170 | + if (false !== $product_id && is_single($product_id)) { |
|
| 171 | + wp_redirect(home_url()); |
|
| 172 | 172 | die; |
| 173 | 173 | } |
| 174 | 174 | } |
@@ -177,21 +177,21 @@ discard block |
||
| 177 | 177 | * Registers the rewrites. |
| 178 | 178 | */ |
| 179 | 179 | public function handle_day_action() { |
| 180 | - if ( isset( $_POST['lsx-health-plan-actions'] ) && wp_verify_nonce( $_POST['lsx-health-plan-actions'], 'complete' ) ) { |
|
| 181 | - update_user_meta( get_current_user_id(), 'day_' . sanitize_key( $_POST['lsx-health-plan-id'] ) . '_complete', true ); |
|
| 182 | - wp_safe_redirect( get_permalink( wc_get_page_id( 'myaccount' ) ) ); |
|
| 180 | + if (isset($_POST['lsx-health-plan-actions']) && wp_verify_nonce($_POST['lsx-health-plan-actions'], 'complete')) { |
|
| 181 | + update_user_meta(get_current_user_id(), 'day_' . sanitize_key($_POST['lsx-health-plan-id']) . '_complete', true); |
|
| 182 | + wp_safe_redirect(get_permalink(wc_get_page_id('myaccount'))); |
|
| 183 | 183 | } |
| 184 | 184 | |
| 185 | - if ( isset( $_POST['lsx-health-plan-actions'] ) && wp_verify_nonce( $_POST['lsx-health-plan-actions'], 'unlock' ) ) { |
|
| 186 | - delete_user_meta( get_current_user_id(), 'day_' . sanitize_key( $_POST['lsx-health-plan-id'] ) . '_complete' ); |
|
| 185 | + if (isset($_POST['lsx-health-plan-actions']) && wp_verify_nonce($_POST['lsx-health-plan-actions'], 'unlock')) { |
|
| 186 | + delete_user_meta(get_current_user_id(), 'day_' . sanitize_key($_POST['lsx-health-plan-id']) . '_complete'); |
|
| 187 | 187 | } |
| 188 | 188 | } |
| 189 | 189 | |
| 190 | 190 | /** |
| 191 | 191 | * Registers the rewrites. |
| 192 | 192 | */ |
| 193 | - public function wpkses_post_tags( $tags, $context ) { |
|
| 194 | - if ( 'post' === $context ) { |
|
| 193 | + public function wpkses_post_tags($tags, $context) { |
|
| 194 | + if ('post' === $context) { |
|
| 195 | 195 | $tags['iframe'] = array( |
| 196 | 196 | 'src' => true, |
| 197 | 197 | 'height' => true, |
@@ -208,10 +208,10 @@ discard block |
||
| 208 | 208 | * @param string $title the term title. |
| 209 | 209 | * @return string |
| 210 | 210 | */ |
| 211 | - public function get_the_archive_title( $title ) { |
|
| 212 | - if ( is_tax() ) { |
|
| 211 | + public function get_the_archive_title($title) { |
|
| 212 | + if (is_tax()) { |
|
| 213 | 213 | $queried_object = get_queried_object(); |
| 214 | - if ( isset( $queried_object->name ) ) { |
|
| 214 | + if (isset($queried_object->name)) { |
|
| 215 | 215 | $title = $queried_object->name; |
| 216 | 216 | } |
| 217 | 217 | } |