@@ -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-heal-plan' ) . ': ' . $equipment_group . '</span>'; |
|
| 100 | + if ( ! empty($equipment_group)) { |
|
| 101 | + $modal_body .= '<span class="equipment-terms">' . __('Equipment', 'lsx-heal-plan') . ': ' . $equipment_group . '</span>'; |
|
| 102 | 102 | } |
| 103 | - if ( ! empty( $muscle_group ) ) { |
|
| 104 | - $modal_body .= '<span class="muscle-terms">' . __( 'Muscle Group', 'lsx-heal-plan' ) . ': ' . $muscle_group . '</span>'; |
|
| 103 | + if ( ! empty($muscle_group)) { |
|
| 104 | + $modal_body .= '<span class="muscle-terms">' . __('Muscle Group', 'lsx-heal-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-heal-plan' ) . '</a>'; |
|
| 110 | + if ('excerpt' === $args['modal_content']) { |
|
| 111 | + $modal_body .= '<a class="moretag" target="_blank" href="' . $url . '">' . __('Read More', 'lsx-heal-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 | } |