Passed
Push — add/multiplan ( cc23c7...ff384a )
by Warwick
04:08
created
includes/template-tags/team.php 1 patch
Spacing   +37 added lines, -37 removed lines patch added patch discarded remove patch
@@ -3,24 +3,24 @@  discard block
 block discarded – undo
3 3
 $tabs = array();
4 4
 
5 5
 // Tab Experience
6
-$tab_experience['title']     = esc_html__( 'Experience', 'lsx-team' );
7
-$tab_experience['content']   = get_post_meta( get_the_ID(), 'team_member_experience', true );
6
+$tab_experience['title']     = esc_html__('Experience', 'lsx-team');
7
+$tab_experience['content']   = get_post_meta(get_the_ID(), 'team_member_experience', true);
8 8
 $tab_experience['shortcode'] = '';
9
-if ( ! empty( $tab_experience['content'] ) ) {
9
+if ( ! empty($tab_experience['content'])) {
10 10
 	$tabs[] = $tab_experience;
11 11
 }
12 12
 
13 13
 // Tab Featured plan
14
-$tab_plans['title']     = esc_html__( 'Featured Plans', 'lsx-team' );
15
-$tab_plans['posts']     = get_post_meta( get_the_ID(), 'connected_team_member_plan', true );
14
+$tab_plans['title']     = esc_html__('Featured Plans', 'lsx-team');
15
+$tab_plans['posts']     = get_post_meta(get_the_ID(), 'connected_team_member_plan', true);
16 16
 $tab_plans['content']   = '';
17 17
 $tab_plans['shortcode'] = '';
18 18
 
19
-if ( ! empty( $tab_plans['posts'] ) ) {
19
+if ( ! empty($tab_plans['posts'])) {
20 20
 
21 21
 	$plan_content = '';
22 22
 
23
-	$include = implode( ',', $tab_plans['posts'] );
23
+	$include = implode(',', $tab_plans['posts']);
24 24
 	$args = array(
25 25
 		'orderby'        => 'menu_order',
26 26
 		'order'          => 'ASC',
@@ -32,49 +32,49 @@  discard block
 block discarded – undo
32 32
 	$plan_content = '<div class="all-plans-block plan-grid block-all-plans-block team-member-plans">
33 33
 	<div class="row">';
34 34
 
35
-	foreach ( $tab_plans['posts'] as $index => $post ) {
35
+	foreach ($tab_plans['posts'] as $index => $post) {
36 36
 
37
-		do_action( 'lsx_entry_before' );
37
+		do_action('lsx_entry_before');
38 38
 
39 39
 		$plan_content .= '<div class="col-xs-12 col-sm-6 col-md-4">';
40 40
 		$plan_content .= '<article class="lsx-slot lsx-hp-shadow">';
41 41
 		$plan_content .= '<div class="plan-feature-img">';
42
-		$plan_content .= '<a href="' . get_permalink( $post ) . '">';
42
+		$plan_content .= '<a href="' . get_permalink($post) . '">';
43 43
 
44 44
 		$linked_product  = false;
45 45
 		$restricted      = false;
46 46
 		$product         = null;
47
-		if ( \lsx_health_plan\functions\woocommerce\plan_has_products( $post ) ) {
48
-			$products       = \lsx_health_plan\functions\woocommerce\get_plan_products( $post );
49
-			$linked_product = wc_get_product( $products[0] );
47
+		if (\lsx_health_plan\functions\woocommerce\plan_has_products($post)) {
48
+			$products       = \lsx_health_plan\functions\woocommerce\get_plan_products($post);
49
+			$linked_product = wc_get_product($products[0]);
50 50
 			$product        = $linked_product;
51 51
 		}
52
-		if ( function_exists( 'wc_memberships_is_post_content_restricted' ) ) {
53
-			$restricted = wc_memberships_is_post_content_restricted( get_the_ID() ) && ! current_user_can( 'wc_memberships_view_restricted_post_content', get_the_ID() );
52
+		if (function_exists('wc_memberships_is_post_content_restricted')) {
53
+			$restricted = wc_memberships_is_post_content_restricted(get_the_ID()) && ! current_user_can('wc_memberships_view_restricted_post_content', get_the_ID());
54 54
 		}
55 55
 
56
-		$featured_image = get_the_post_thumbnail( $post );
57
-		if ( ! empty( $featured_image ) && '' !== $featured_image ) {
56
+		$featured_image = get_the_post_thumbnail($post);
57
+		if ( ! empty($featured_image) && '' !== $featured_image) {
58 58
 			$plan_content .= $featured_image;
59 59
 		} else {
60
-			$plan_content .= '<img loading="lazy" class="placeholder" src="' . plugin_dir_url( __DIR__ ) . '../assets/images/placeholder.jpg' . '">';
60
+			$plan_content .= '<img loading="lazy" class="placeholder" src="' . plugin_dir_url(__DIR__) . '../assets/images/placeholder.jpg' . '">';
61 61
 		}
62 62
 		$plan_content .= '</a>';
63 63
 		$plan_content .= '</div>';
64 64
 
65 65
 		$plan_content .= '<div class="content-box plan-content-box">';
66
-		$plan_content .= '<h3 class="plan"><a href="' . get_permalink( $post ) . '">' . get_the_title( $post ) . '</a></h3>';
66
+		$plan_content .= '<h3 class="plan"><a href="' . get_permalink($post) . '">' . get_the_title($post) . '</a></h3>';
67 67
 
68
-		if ( false !== $linked_product && false !== $restricted ) {
68
+		if (false !== $linked_product && false !== $restricted) {
69 69
 			$plan_content .= $linked_product->get_price_html();
70 70
 		}
71 71
 
72 72
 		$plan_content .= '<div class="excerpt">';
73
-		if ( ! has_excerpt( $post ) ) {
74
-			$content = wp_trim_words( get_the_content( $post ), 20 );
73
+		if ( ! has_excerpt($post)) {
74
+			$content = wp_trim_words(get_the_content($post), 20);
75 75
 			$plan_content .= '<p>' . $content . '</p>';
76 76
 		} else {
77
-			$plan_content .= apply_filters( 'the_excerpt', get_the_excerpt( $post ) );
77
+			$plan_content .= apply_filters('the_excerpt', get_the_excerpt($post));
78 78
 		}
79 79
 		$plan_content .= '</div>';
80 80
 
@@ -87,42 +87,42 @@  discard block
 block discarded – undo
87 87
 
88 88
 	$tab_plans['content'] = $plan_content;
89 89
 }
90
-if ( ! empty( $tab_plans['content'] ) ) {
90
+if ( ! empty($tab_plans['content'])) {
91 91
 	$tabs[] = $tab_plans;
92 92
 }
93 93
 
94 94
 
95 95
 // Tab Testimonials
96 96
 $tab_testimonial['post_type'] = 'testimonial';
97
-$tab_testimonial['title']     = esc_html__( 'Testimonials', 'lsx-team' );
98
-$tab_testimonial['posts']     = get_post_meta( get_the_ID(), 'testimonial_to_team', true );
97
+$tab_testimonial['title']     = esc_html__('Testimonials', 'lsx-team');
98
+$tab_testimonial['posts']     = get_post_meta(get_the_ID(), 'testimonial_to_team', true);
99 99
 $tab_testimonial['content']   = '';
100 100
 
101
-if ( is_plugin_active( 'lsx-testimonials/lsx-testimonials.php' ) && ( ! empty( $tab_testimonial['posts'] ) ) ) {
102
-	if ( count( $tab_testimonial['posts'] ) <= 2 ) {
103
-		$columns = count( $tab_testimonial['posts'] );
101
+if (is_plugin_active('lsx-testimonials/lsx-testimonials.php') && ( ! empty($tab_testimonial['posts']))) {
102
+	if (count($tab_testimonial['posts']) <= 2) {
103
+		$columns = count($tab_testimonial['posts']);
104 104
 	} else {
105 105
 		$columns = 3;
106 106
 	}
107 107
 
108
-	$post_ids = join( ',', $tab_testimonial['posts'] );
108
+	$post_ids = join(',', $tab_testimonial['posts']);
109 109
 	$tab_testimonial['shortcode'] = '[lsx_testimonials columns="' . $columns . '" include="' . $post_ids . '" orderby="date" order="DESC" display="excerpt"]';
110 110
 	$tabs[] = $tab_testimonial;
111 111
 }
112 112
 
113
-if ( count( $tabs ) > 0 ) : ?>
113
+if (count($tabs) > 0) : ?>
114 114
 	<div class="entry-tabs hp-entry-tabs">
115 115
 		<ul class="nav nav-tabs">
116
-			<?php foreach ( $tabs as $i => $tab ) : ?>
117
-				<li<?php if ( 0 === $i ) echo ' class="active"'; ?>><a data-toggle="tab" href="#<?php echo esc_attr( sanitize_title( $tab['title'] ) ); ?>"><?php echo esc_html( $tab['title'] ); ?></a></li>
116
+			<?php foreach ($tabs as $i => $tab) : ?>
117
+				<li<?php if (0 === $i) echo ' class="active"'; ?>><a data-toggle="tab" href="#<?php echo esc_attr(sanitize_title($tab['title'])); ?>"><?php echo esc_html($tab['title']); ?></a></li>
118 118
 			<?php endforeach; ?>
119 119
 		</ul>
120 120
 
121 121
 		<div class="tab-content">
122
-			<?php foreach ( $tabs as $i => $tab ) : ?>
123
-				<div id="<?php echo esc_attr( sanitize_title( $tab['title'] ) ); ?>" class="tab-pane fade<?php if ( 0 === $i ) echo ' in active'; ?>">
124
-					<?php echo do_shortcode( $tab['shortcode'] ); ?>
125
-					<?php echo wp_kses_post( $tab['content'] ); ?>
122
+			<?php foreach ($tabs as $i => $tab) : ?>
123
+				<div id="<?php echo esc_attr(sanitize_title($tab['title'])); ?>" class="tab-pane fade<?php if (0 === $i) echo ' in active'; ?>">
124
+					<?php echo do_shortcode($tab['shortcode']); ?>
125
+					<?php echo wp_kses_post($tab['content']); ?>
126 126
 				</div>
127 127
 			<?php endforeach; ?>
128 128
 		</div>
Please login to merge, or discard this patch.
classes/integrations/class-lsx-team.php 1 patch
Spacing   +27 added lines, -27 removed lines patch added patch discarded remove patch
@@ -20,16 +20,16 @@  discard block
 block discarded – undo
20 20
 	 */
21 21
 	public function __construct() {
22 22
 		$this->default_types = array(
23
-			\lsx_health_plan\functions\get_option( 'endpoint_meal', 'meal' ),
24
-			\lsx_health_plan\functions\get_option( 'endpoint_exercise_single', 'exercise' ),
25
-			\lsx_health_plan\functions\get_option( 'endpoint_recipe_single', 'recipe' ),
26
-			\lsx_health_plan\functions\get_option( 'endpoint_workout', 'workout' ),
27
-			\lsx_health_plan\functions\get_option( 'endpoint_plan', 'plan' ),
23
+			\lsx_health_plan\functions\get_option('endpoint_meal', 'meal'),
24
+			\lsx_health_plan\functions\get_option('endpoint_exercise_single', 'exercise'),
25
+			\lsx_health_plan\functions\get_option('endpoint_recipe_single', 'recipe'),
26
+			\lsx_health_plan\functions\get_option('endpoint_workout', 'workout'),
27
+			\lsx_health_plan\functions\get_option('endpoint_plan', 'plan'),
28 28
 		);
29
-		add_action( 'wp_enqueue_scripts', array( $this, 'assets' ), 5 );
30
-		add_action( 'cmb2_admin_init', array( $this, 'related_team_metabox' ) );
31
-		add_action( 'cmb2_admin_init', array( $this, 'additional_single_team_metabox' ) );
32
-		add_action( 'lsx_entry_bottom', array( $this, 'hp_team_member_tabs' ) );
29
+		add_action('wp_enqueue_scripts', array($this, 'assets'), 5);
30
+		add_action('cmb2_admin_init', array($this, 'related_team_metabox'));
31
+		add_action('cmb2_admin_init', array($this, 'additional_single_team_metabox'));
32
+		add_action('lsx_entry_bottom', array($this, 'hp_team_member_tabs'));
33 33
 	}
34 34
 
35 35
 	/**
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
 	 */
42 42
 	public static function get_instance() {
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
 		return self::$instance;
@@ -55,19 +55,19 @@  discard block
 block discarded – undo
55 55
 	 *
56 56
 	 */
57 57
 	public function assets() {
58
-		wp_enqueue_style( 'lsx-health-plan-team', LSX_HEALTH_PLAN_URL . 'assets/css/lsx-health-plan-team.css', array(), LSX_HEALTH_PLAN_VER );
58
+		wp_enqueue_style('lsx-health-plan-team', LSX_HEALTH_PLAN_URL . 'assets/css/lsx-health-plan-team.css', array(), LSX_HEALTH_PLAN_VER);
59 59
 	}
60 60
 
61 61
 	/**
62 62
 	 * Define the related team member metabox and field configurations.
63 63
 	 */
64 64
 	public function related_team_metabox() {
65
-		foreach ( $this->default_types as $type => $default_type ) {
65
+		foreach ($this->default_types as $type => $default_type) {
66 66
 			$cmb = new_cmb2_box(
67 67
 				array(
68 68
 					'id'           => $default_type . '_related_team_member__metabox',
69
-					'title'        => __( 'Related Team Member', 'lsx-health-plan' ),
70
-					'object_types' => array( $default_type ), // Post type.
69
+					'title'        => __('Related Team Member', 'lsx-health-plan'),
70
+					'object_types' => array($default_type), // Post type.
71 71
 					'context'      => 'normal',
72 72
 					'priority'     => 'low',
73 73
 					'show_names'   => true,
@@ -76,15 +76,15 @@  discard block
 block discarded – undo
76 76
 
77 77
 			$cmb->add_field(
78 78
 				array(
79
-					'name'       => __( 'Related Team Member', 'lsx-health-plan' ),
80
-					'desc'       => __( 'Connect the related team member that applies to this ', 'lsx-health-plan' ) . $default_type,
79
+					'name'       => __('Related Team Member', 'lsx-health-plan'),
80
+					'desc'       => __('Connect the related team member that applies to this ', 'lsx-health-plan') . $default_type,
81 81
 					'id'         => $default_type . '_connected_team_member',
82 82
 					'type'       => 'post_search_ajax',
83
-					'limit'      => 4,  // Limit selection to X items only (default 1).
83
+					'limit'      => 4, // Limit selection to X items only (default 1).
84 84
 					'sortable'   => true, // Allow selected items to be sortable (default false).
85 85
 					'query_args' => array(
86
-						'post_type'      => array( 'team' ),
87
-						'post_status'    => array( 'publish' ),
86
+						'post_type'      => array('team'),
87
+						'post_status'    => array('publish'),
88 88
 						'posts_per_page' => -1,
89 89
 					),
90 90
 				)
@@ -101,7 +101,7 @@  discard block
 block discarded – undo
101 101
 			array(
102 102
 				'id'           => 'lsx__team',
103 103
 				'title'        => '',
104
-				'object_types' => array( 'team' ), // Post type.
104
+				'object_types' => array('team'), // Post type.
105 105
 				'context'      => 'normal',
106 106
 				'priority'     => 'high',
107 107
 				'show_names'   => true,
@@ -110,8 +110,8 @@  discard block
 block discarded – undo
110 110
 
111 111
 		$cmb->add_field(
112 112
 			array(
113
-				'name'       => __( 'Team Member Experience', 'lsx-health-plan' ),
114
-				'desc'       => __( 'Add additional experience to this team member', 'lsx-health-plan' ),
113
+				'name'       => __('Team Member Experience', 'lsx-health-plan'),
114
+				'desc'       => __('Add additional experience to this team member', 'lsx-health-plan'),
115 115
 				'id'         => 'team_member_experience',
116 116
 				'type'       => 'wysiwyg',
117 117
 			)
@@ -119,15 +119,15 @@  discard block
 block discarded – undo
119 119
 
120 120
 		$cmb->add_field(
121 121
 			array(
122
-				'name'       => __( 'Featured Plans', 'lsx-health-plan' ),
123
-				'desc'       => __( 'Connect the related plans to this team member', 'lsx-health-plan' ),
122
+				'name'       => __('Featured Plans', 'lsx-health-plan'),
123
+				'desc'       => __('Connect the related plans to this team member', 'lsx-health-plan'),
124 124
 				'id'         => 'connected_team_member_plan',
125 125
 				'type'       => 'post_search_ajax',
126 126
 				'limit'      => 3,
127 127
 				'sortable'   => true,
128 128
 				'query_args' => array(
129
-					'post_type'      => array( 'plan' ),
130
-					'post_status'    => array( 'publish' ),
129
+					'post_type'      => array('plan'),
130
+					'post_status'    => array('publish'),
131 131
 					'posts_per_page' => -1,
132 132
 				),
133 133
 			)
@@ -141,7 +141,7 @@  discard block
 block discarded – undo
141 141
 	 * @return void
142 142
 	 */
143 143
 	public function hp_team_member_tabs() {
144
-		if ( is_single() && is_singular( 'team' ) ) {
144
+		if (is_single() && is_singular('team')) {
145 145
 			require_once LSX_HEALTH_PLAN_PATH . '/includes/template-tags/team.php';
146 146
 		}
147 147
 	}
Please login to merge, or discard this patch.
classes/class-integrations.php 1 patch
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -66,13 +66,13 @@  discard block
 block discarded – undo
66 66
 	 * Constructor
67 67
 	 */
68 68
 	public function __construct() {
69
-		add_action( 'init', array( $this, 'cmb2_post_search_ajax' ) );
70
-		add_action( 'init', array( $this, 'download_monitor_init' ) );
71
-		add_action( 'init', array( $this, 'woocommerce_init' ) );
72
-		add_action( 'init', array( $this, 'wp_user_avatar_init' ) );
73
-		add_action( 'init', array( $this, 'facetwp_init' ) );
74
-		add_action( 'init', array( $this, 'lsx_team_init' ) );
75
-		add_action( 'init', array( $this, 'lsx_article_init' ) );
69
+		add_action('init', array($this, 'cmb2_post_search_ajax'));
70
+		add_action('init', array($this, 'download_monitor_init'));
71
+		add_action('init', array($this, 'woocommerce_init'));
72
+		add_action('init', array($this, 'wp_user_avatar_init'));
73
+		add_action('init', array($this, 'facetwp_init'));
74
+		add_action('init', array($this, 'lsx_team_init'));
75
+		add_action('init', array($this, 'lsx_article_init'));
76 76
 	}
77 77
 
78 78
 	/**
@@ -84,7 +84,7 @@  discard block
 block discarded – undo
84 84
 	 */
85 85
 	public static function get_instance() {
86 86
 		// If the single instance hasn't been set, set it now.
87
-		if ( null === self::$instance ) {
87
+		if (null === self::$instance) {
88 88
 			self::$instance = new self();
89 89
 		}
90 90
 		return self::$instance;
@@ -97,7 +97,7 @@  discard block
 block discarded – undo
97 97
 	 */
98 98
 	public function cmb2_post_search_ajax() {
99 99
 		require_once LSX_HEALTH_PLAN_PATH . 'vendor/lsx-field-post-search-ajax/cmb-field-post-search-ajax.php';
100
-		if ( method_exists( 'MAG_CMB2_Field_Post_Search_Ajax', 'get_instance' ) ) {
100
+		if (method_exists('MAG_CMB2_Field_Post_Search_Ajax', 'get_instance')) {
101 101
 			$this->cmb2_post_search_ajax = \MAG_CMB2_Field_Post_Search_Ajax::get_instance();
102 102
 		}
103 103
 	}
@@ -108,7 +108,7 @@  discard block
 block discarded – undo
108 108
 	 * @return void
109 109
 	 */
110 110
 	public function download_monitor_init() {
111
-		if ( function_exists( 'download_monitor' ) ) {
111
+		if (function_exists('download_monitor')) {
112 112
 			require_once LSX_HEALTH_PLAN_PATH . 'classes/integrations/class-download-monitor.php';
113 113
 			$this->download_monitor = Download_Monitor::get_instance();
114 114
 		}
@@ -120,7 +120,7 @@  discard block
 block discarded – undo
120 120
 	 * @return void
121 121
 	 */
122 122
 	public function woocommerce_init() {
123
-		if ( function_exists( 'WC' ) ) {
123
+		if (function_exists('WC')) {
124 124
 			require_once LSX_HEALTH_PLAN_PATH . 'classes/integrations/class-woocommerce.php';
125 125
 			$this->woocommerce = Woocommerce::get_instance();
126 126
 		}
@@ -132,7 +132,7 @@  discard block
 block discarded – undo
132 132
 	 * @return void
133 133
 	 */
134 134
 	public function wp_user_avatar_init() {
135
-		if ( class_exists( 'WP_User_Avatar_Setup' ) ) {
135
+		if (class_exists('WP_User_Avatar_Setup')) {
136 136
 			require_once LSX_HEALTH_PLAN_PATH . 'classes/integrations/class-wp-user-avatar.php';
137 137
 			$this->wp_user_avatar = WP_User_Avatar::get_instance();
138 138
 		}
@@ -144,7 +144,7 @@  discard block
 block discarded – undo
144 144
 	 * @return void
145 145
 	 */
146 146
 	public function facetwp_init() {
147
-		if ( class_exists( 'FacetWP' ) ) {
147
+		if (class_exists('FacetWP')) {
148 148
 			require_once LSX_HEALTH_PLAN_PATH . 'classes/integrations/class-facetwp.php';
149 149
 			$this->facetwp = FacetWP::get_instance();
150 150
 		}
@@ -156,7 +156,7 @@  discard block
 block discarded – undo
156 156
 	 * @return void
157 157
 	 */
158 158
 	public function lsx_team_init() {
159
-		if ( class_exists( 'LSX_Team' ) ) {
159
+		if (class_exists('LSX_Team')) {
160 160
 			require_once LSX_HEALTH_PLAN_PATH . 'classes/integrations/class-lsx-team.php';
161 161
 			$this->team = LSX_Team::get_instance();
162 162
 		}
@@ -168,7 +168,7 @@  discard block
 block discarded – undo
168 168
 	 * @return void
169 169
 	 */
170 170
 	public function lsx_article_init() {
171
-		if ( wp_count_posts()->publish > 0 ) {
171
+		if (wp_count_posts()->publish > 0) {
172 172
 			require_once LSX_HEALTH_PLAN_PATH . 'classes/integrations/class-articles.php';
173 173
 			$this->article = Articles::get_instance();
174 174
 		}
Please login to merge, or discard this patch.