Test Setup Failed
Branch master (ac4436)
by Ashley
05:32
created
classes/admin/class-settings-theme.php 1 patch
Spacing   +42 added lines, -42 removed lines patch added patch discarded remove patch
@@ -37,14 +37,14 @@  discard block
 block discarded – undo
37 37
 	 * Contructor
38 38
 	 */
39 39
 	public function __construct() {
40
-		add_filter( 'cmb2_enqueue_css', array( $this, 'disable_cmb2_styles' ), 1, 1 );
41
-		add_action( 'cmb2_before_form', array( $this, 'generate_navigation' ), 10, 4 );
42
-		add_action( 'cmb2_before_title_field_row', array( $this, 'output_tab_open_div' ), 10, 1 );
43
-		add_action( 'cmb2_after_tab_closing_field_row', array( $this, 'output_tab_closing_div' ), 10, 1 );
44
-		add_action( 'cmb2_render_tab_closing', array( $this, 'cmb2_render_callback_for_tab_closing' ), 10, 5 );
45
-		add_filter( 'cmb2_sanitize_tab_closing', array( $this, 'cmb2_sanitize_tab_closing_callback' ), 10, 2 );
46
-		add_action( 'cmb2_after_form', array( $this, 'navigation_js' ), 10, 4 );
47
-		add_filter( 'cmb2_options_page_redirect_url', array( $this, 'add_tab_argument' ), 10, 1 );
40
+		add_filter('cmb2_enqueue_css', array($this, 'disable_cmb2_styles'), 1, 1);
41
+		add_action('cmb2_before_form', array($this, 'generate_navigation'), 10, 4);
42
+		add_action('cmb2_before_title_field_row', array($this, 'output_tab_open_div'), 10, 1);
43
+		add_action('cmb2_after_tab_closing_field_row', array($this, 'output_tab_closing_div'), 10, 1);
44
+		add_action('cmb2_render_tab_closing', array($this, 'cmb2_render_callback_for_tab_closing'), 10, 5);
45
+		add_filter('cmb2_sanitize_tab_closing', array($this, 'cmb2_sanitize_tab_closing_callback'), 10, 2);
46
+		add_action('cmb2_after_form', array($this, 'navigation_js'), 10, 4);
47
+		add_filter('cmb2_options_page_redirect_url', array($this, 'add_tab_argument'), 10, 1);
48 48
 	}
49 49
 
50 50
 	/**
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
 	 */
57 57
 	public static function get_instance() {
58 58
 		// If the single instance hasn't been set, set it now.
59
-		if ( null == self::$instance ) {
59
+		if (null == self::$instance) {
60 60
 			self::$instance = new self();
61 61
 		}
62 62
 		return self::$instance;
@@ -67,10 +67,10 @@  discard block
 block discarded – undo
67 67
 	 *
68 68
 	 * @return bool $enabled Whether to enable (enqueue) styles.
69 69
 	 */
70
-	public function disable_cmb2_styles( $enabled ) {
71
-		if ( is_admin() ) {
70
+	public function disable_cmb2_styles($enabled) {
71
+		if (is_admin()) {
72 72
 			$current_screen = get_current_screen();
73
-			if ( is_object( $current_screen ) && 'plan_page_lsx_health_plan_options' === $current_screen->id ) {
73
+			if (is_object($current_screen) && 'plan_page_lsx_health_plan_options' === $current_screen->id) {
74 74
 				$enabled = false;
75 75
 			}
76 76
 		}
@@ -86,14 +86,14 @@  discard block
 block discarded – undo
86 86
 	 * @param object $cmb2_obj
87 87
 	 * @return void
88 88
 	 */
89
-	public function generate_navigation( $cmb_id, $object_id, $object_type, $cmb2_obj ) {
90
-		if ( 'lsx_health_plan_settings' === $cmb_id && 'lsx_health_plan_options' === $object_id && 'options-page' === $object_type ) {
89
+	public function generate_navigation($cmb_id, $object_id, $object_type, $cmb2_obj) {
90
+		if ('lsx_health_plan_settings' === $cmb_id && 'lsx_health_plan_options' === $object_id && 'options-page' === $object_type) {
91 91
 			$this->navigation      = array();
92 92
 			$this->is_options_page = true;
93
-			if ( isset( $cmb2_obj->meta_box['fields'] ) && ! empty( $cmb2_obj->meta_box['fields'] ) ) {
94
-				foreach ( $cmb2_obj->meta_box['fields'] as $field_index => $field ) {
95
-					if ( 'title' === $field['type'] ) {
96
-						$this->navigation[ $field_index ] = $field['name'];
93
+			if (isset($cmb2_obj->meta_box['fields']) && ! empty($cmb2_obj->meta_box['fields'])) {
94
+				foreach ($cmb2_obj->meta_box['fields'] as $field_index => $field) {
95
+					if ('title' === $field['type']) {
96
+						$this->navigation[$field_index] = $field['name'];
97 97
 					}
98 98
 				}
99 99
 			}
@@ -107,32 +107,32 @@  discard block
 block discarded – undo
107 107
 	 * @return void
108 108
 	 */
109 109
 	public function output_navigation() {
110
-		if ( ! empty( $this->navigation ) ) {
110
+		if ( ! empty($this->navigation)) {
111 111
 			?>
112 112
 			<div class="wp-filter hide-if-no-js">
113 113
 				<ul class="filter-links">
114 114
 					<?php
115 115
 					$first_tab    = true;
116
-					$total        = count( $this->navigation );
116
+					$total        = count($this->navigation);
117 117
 					$count        = 0;
118 118
 					$separator    = ' |';
119 119
 					$selected_tab = '';
120
-					if ( isset( $_GET['cmb_tab'] ) && '' !== $_GET['cmb_tab'] ) {
121
-						$selected_tab  = sanitize_text_field( $_GET['cmb_tab'] );
120
+					if (isset($_GET['cmb_tab']) && '' !== $_GET['cmb_tab']) {
121
+						$selected_tab  = sanitize_text_field($_GET['cmb_tab']);
122 122
 						$selected_tab  = 'settings_' . $selected_tab;
123 123
 					}
124
-					foreach ( $this->navigation as $key => $label ) {
124
+					foreach ($this->navigation as $key => $label) {
125 125
 						$count++;
126 126
 						$current_css = '';
127
-						if ( ( true === $first_tab && '' === $selected_tab ) || $key === $selected_tab ) {
127
+						if ((true === $first_tab && '' === $selected_tab) || $key === $selected_tab) {
128 128
 							$first_tab   = false;
129 129
 							$current_css = 'current';
130 130
 						}
131
-						if ( $count === $total ) {
131
+						if ($count === $total) {
132 132
 							$separator = '';
133 133
 						}
134 134
 						?>
135
-							<li><a href="#" class="<?php echo esc_attr( $current_css ); ?>" data-sort="<?php echo esc_attr( $key ); ?>_tab"><?php echo esc_attr( $label ); ?></a><?php echo esc_attr( $separator ); ?></li>
135
+							<li><a href="#" class="<?php echo esc_attr($current_css); ?>" data-sort="<?php echo esc_attr($key); ?>_tab"><?php echo esc_attr($label); ?></a><?php echo esc_attr($separator); ?></li>
136 136
 						<?php
137 137
 					}
138 138
 					?>
@@ -148,10 +148,10 @@  discard block
 block discarded – undo
148 148
 	 * @param object $field CMB2_Field();
149 149
 	 * @return void
150 150
 	 */
151
-	public function output_tab_open_div( $field ) {
152
-		if ( true === $this->is_options_page && isset( $field->args['type'] ) && 'title' === $field->args['type'] ) {
151
+	public function output_tab_open_div($field) {
152
+		if (true === $this->is_options_page && isset($field->args['type']) && 'title' === $field->args['type']) {
153 153
 			?>
154
-			<div id="<?php echo esc_attr( $field->args['id'] ); ?>_tab" class="tab tab-nav hidden">
154
+			<div id="<?php echo esc_attr($field->args['id']); ?>_tab" class="tab tab-nav hidden">
155 155
 			<?php
156 156
 		}
157 157
 	}
@@ -162,19 +162,19 @@  discard block
 block discarded – undo
162 162
 	 * @param object $field CMB2_Field();
163 163
 	 * @return void
164 164
 	 */
165
-	public function output_tab_closing_div( $field ) {
166
-		if ( true === $this->is_options_page && isset( $field->args['type'] ) && 'tab_closing' === $field->args['type'] ) {
165
+	public function output_tab_closing_div($field) {
166
+		if (true === $this->is_options_page && isset($field->args['type']) && 'tab_closing' === $field->args['type']) {
167 167
 			?>
168 168
 			</div>
169 169
 			<?php
170 170
 		}
171 171
 	}
172 172
 
173
-	public function cmb2_render_callback_for_tab_closing( $field, $escaped_value, $object_id, $object_type, $field_type_object ) {
173
+	public function cmb2_render_callback_for_tab_closing($field, $escaped_value, $object_id, $object_type, $field_type_object) {
174 174
 		return;
175 175
 	}
176 176
 
177
-	public function cmb2_sanitize_tab_closing_callback( $override_value, $value ) {
177
+	public function cmb2_sanitize_tab_closing_callback($override_value, $value) {
178 178
 		return '';
179 179
 	}
180 180
 
@@ -187,8 +187,8 @@  discard block
 block discarded – undo
187 187
 	 * @param object $cmb2_obj
188 188
 	 * @return void
189 189
 	 */
190
-	public function navigation_js( $cmb_id, $object_id, $object_type, $cmb2_obj ) {
191
-		if ( 'lsx_health_plan_settings' === $cmb_id && 'lsx_health_plan_options' === $object_id && 'options-page' === $object_type ) {
190
+	public function navigation_js($cmb_id, $object_id, $object_type, $cmb2_obj) {
191
+		if ('lsx_health_plan_settings' === $cmb_id && 'lsx_health_plan_options' === $object_id && 'options-page' === $object_type) {
192 192
 			?>
193 193
 			<script>
194 194
 				var LSX_HP_CMB2 = Object.create( null );
@@ -270,14 +270,14 @@  discard block
 block discarded – undo
270 270
 	 * @param string $url
271 271
 	 * @return void
272 272
 	 */
273
-	public function add_tab_argument( $url ) {
274
-		if ( isset( $_POST['cmb_tab'] ) && '' !== $_POST['cmb_tab'] ) { // @codingStandardsIgnoreLine
275
-			$tab_selection = sanitize_text_field( $_POST['cmb_tab'] ); // @codingStandardsIgnoreLine
276
-			$tab_selection = str_replace( array( 'settings_', '_tab' ), '', $tab_selection ); // @codingStandardsIgnoreLine
277
-			if ( 'single' !== $tab_selection ) {
278
-				$url = add_query_arg( 'cmb_tab', $tab_selection, $url );
273
+	public function add_tab_argument($url) {
274
+		if (isset($_POST['cmb_tab']) && '' !== $_POST['cmb_tab']) { // @codingStandardsIgnoreLine
275
+			$tab_selection = sanitize_text_field($_POST['cmb_tab']); // @codingStandardsIgnoreLine
276
+			$tab_selection = str_replace(array('settings_', '_tab'), '', $tab_selection); // @codingStandardsIgnoreLine
277
+			if ('single' !== $tab_selection) {
278
+				$url = add_query_arg('cmb_tab', $tab_selection, $url);
279 279
 			} else {
280
-				$url = remove_query_arg( 'cmb_tab', $url );
280
+				$url = remove_query_arg('cmb_tab', $url);
281 281
 			}
282 282
 		}
283 283
 		return $url;
Please login to merge, or discard this patch.
classes/admin/class-settings.php 1 patch
Spacing   +114 added lines, -114 removed lines patch added patch discarded remove patch
@@ -53,14 +53,14 @@  discard block
 block discarded – undo
53 53
 	 * Contructor
54 54
 	 */
55 55
 	public function __construct() {
56
-		add_action( 'cmb2_admin_init', array( $this, 'register_settings_page' ) );
57
-		add_action( 'lsx_hp_settings_page', array( $this, 'general_settings' ), 1, 1 );
58
-		add_action( 'lsx_hp_settings_page', array( $this, 'global_defaults' ), 3, 1 );
59
-		add_action( 'lsx_hp_settings_page', array( $this, 'global_downloads' ), 5, 1 );
60
-		add_action( 'lsx_hp_settings_page', array( $this, 'stat_disable' ), 6, 1 );
61
-		add_action( 'lsx_hp_settings_page', array( $this, 'endpoint_translations' ), 7, 1 );
62
-		add_action( 'lsx_hp_settings_page', array( $this, 'exercise_translations' ), 7, 1 );
63
-		add_action( 'lsx_hp_settings_page', array( $this, 'post_type_toggles' ), 9, 1 );
56
+		add_action('cmb2_admin_init', array($this, 'register_settings_page'));
57
+		add_action('lsx_hp_settings_page', array($this, 'general_settings'), 1, 1);
58
+		add_action('lsx_hp_settings_page', array($this, 'global_defaults'), 3, 1);
59
+		add_action('lsx_hp_settings_page', array($this, 'global_downloads'), 5, 1);
60
+		add_action('lsx_hp_settings_page', array($this, 'stat_disable'), 6, 1);
61
+		add_action('lsx_hp_settings_page', array($this, 'endpoint_translations'), 7, 1);
62
+		add_action('lsx_hp_settings_page', array($this, 'exercise_translations'), 7, 1);
63
+		add_action('lsx_hp_settings_page', array($this, 'post_type_toggles'), 9, 1);
64 64
 	}
65 65
 
66 66
 	/**
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 72
 	 */
73 73
 	public static function get_instance() {
74 74
 		// If the single instance hasn't been set, set it now.
75
-		if ( null === self::$instance ) {
75
+		if (null === self::$instance) {
76 76
 			self::$instance = new self();
77 77
 		}
78 78
 		return self::$instance;
@@ -85,115 +85,115 @@  discard block
 block discarded – undo
85 85
 	 */
86 86
 	public function set_vars() {
87 87
 
88
-		$this->default_types  = array(
88
+		$this->default_types = array(
89 89
 			'page' => array(
90
-				'title'       => __( 'Warm Up', 'lsx-health-plan' ),
91
-				'description' => __( 'Set a default warm up routine.', 'lsx-health-plan' ),
90
+				'title'       => __('Warm Up', 'lsx-health-plan'),
91
+				'description' => __('Set a default warm up routine.', 'lsx-health-plan'),
92 92
 				'limit'       => 1,
93 93
 				'id'          => 'plan_warmup',
94 94
 			),
95 95
 		);
96 96
 		$this->download_types = array(
97 97
 			'page' => array(
98
-				'title'       => __( 'Warm Up', 'lsx-health-plan' ),
99
-				'description' => __( 'Set a default warm up routine.', 'lsx-health-plan' ),
98
+				'title'       => __('Warm Up', 'lsx-health-plan'),
99
+				'description' => __('Set a default warm up routine.', 'lsx-health-plan'),
100 100
 				'limit'       => 1,
101 101
 			),
102 102
 		);
103
-		$this->endpoints      = array(
103
+		$this->endpoints = array(
104 104
 			'endpoint_warm_up' => array(
105
-				'title'       => __( 'Warm Up Endpoint', 'lsx-health-plan' ),
105
+				'title'       => __('Warm Up Endpoint', 'lsx-health-plan'),
106 106
 				'default'     => 'warm-up',
107 107
 			),
108 108
 		);
109 109
 
110
-		if ( post_type_exists( 'meal' ) ) {
111
-			$this->download_types['meal']     = array(
112
-				'title'       => __( 'Meal Plan', 'lsx-health-plan' ),
113
-				'description' => __( 'Set a default meal plan.', 'lsx-health-plan' ),
110
+		if (post_type_exists('meal')) {
111
+			$this->download_types['meal'] = array(
112
+				'title'       => __('Meal Plan', 'lsx-health-plan'),
113
+				'description' => __('Set a default meal plan.', 'lsx-health-plan'),
114 114
 			);
115
-			$this->default_types['meal']      = array(
116
-				'title'       => __( 'Meal Plan', 'lsx-health-plan' ),
117
-				'description' => __( 'Set a default meal plan.', 'lsx-health-plan' ),
115
+			$this->default_types['meal'] = array(
116
+				'title'       => __('Meal Plan', 'lsx-health-plan'),
117
+				'description' => __('Set a default meal plan.', 'lsx-health-plan'),
118 118
 				'id'          => 'connected_meals',
119 119
 			);
120 120
 			$this->endpoints['endpoint_meal'] = array(
121
-				'title'   => __( 'Meal Endpoint', 'lsx-health-plan' ),
121
+				'title'   => __('Meal Endpoint', 'lsx-health-plan'),
122 122
 				'default' => 'meal',
123 123
 			);
124 124
 		}
125
-		if ( post_type_exists( 'recipe' ) ) {
125
+		if (post_type_exists('recipe')) {
126 126
 			$this->download_types['recipe'] = array(
127
-				'title'       => __( 'Recipe', 'lsx-health-plan' ),
128
-				'description' => __( 'Set a default recipe.', 'lsx-health-plan' ),
127
+				'title'       => __('Recipe', 'lsx-health-plan'),
128
+				'description' => __('Set a default recipe.', 'lsx-health-plan'),
129 129
 			);
130 130
 			$this->default_types['recipe'] = array(
131
-				'title'       => __( 'Recipe', 'lsx-health-plan' ),
132
-				'description' => __( 'Set a default recipe.', 'lsx-health-plan' ),
131
+				'title'       => __('Recipe', 'lsx-health-plan'),
132
+				'description' => __('Set a default recipe.', 'lsx-health-plan'),
133 133
 				'id'          => 'connected_recipes',
134 134
 			);
135 135
 			$this->endpoints['endpoint_recipe'] = array(
136
-				'title'   => __( 'Recipes Endpoint', 'lsx-health-plan' ),
136
+				'title'   => __('Recipes Endpoint', 'lsx-health-plan'),
137 137
 				'default' => 'recipe',
138 138
 			);
139 139
 		}
140
-		if ( post_type_exists( 'workout' ) ) {
140
+		if (post_type_exists('workout')) {
141 141
 			$this->download_types['workout'] = array(
142
-				'title'       => __( 'Workout', 'lsx-health-plan' ),
143
-				'description' => __( 'Set a default workout routine PDF.', 'lsx-health-plan' ),
142
+				'title'       => __('Workout', 'lsx-health-plan'),
143
+				'description' => __('Set a default workout routine PDF.', 'lsx-health-plan'),
144 144
 			);
145 145
 			$this->default_types['workout'] = array(
146
-				'title'       => __( 'Workout', 'lsx-health-plan' ),
147
-				'description' => __( 'Set a default workout routine.', 'lsx-health-plan' ),
146
+				'title'       => __('Workout', 'lsx-health-plan'),
147
+				'description' => __('Set a default workout routine.', 'lsx-health-plan'),
148 148
 				'id'          => 'connected_workouts',
149 149
 			);
150 150
 			$this->endpoints['endpoint_workout_archive'] = array(
151
-				'title'   => __( 'Workouts Archive Endpoint', 'lsx-health-plan' ),
151
+				'title'   => __('Workouts Archive Endpoint', 'lsx-health-plan'),
152 152
 				'default' => '',
153 153
 			);
154 154
 			$this->endpoints['endpoint_workout'] = array(
155
-				'title'   => __( 'Single Workout Endpoint', 'lsx-health-plan' ),
155
+				'title'   => __('Single Workout Endpoint', 'lsx-health-plan'),
156 156
 				'default' => 'workout',
157 157
 			);
158 158
 		}
159 159
 
160 160
 		$this->endpoints['login_slug'] = array(
161
-			'title'   => __( 'Login Slug', 'lsx-health-plan' ),
161
+			'title'   => __('Login Slug', 'lsx-health-plan'),
162 162
 			'default' => 'login',
163 163
 		);
164 164
 		$this->endpoints['my_plan_slug'] = array(
165
-			'title'   => __( 'My Plan Slug', 'lsx-health-plan' ),
165
+			'title'   => __('My Plan Slug', 'lsx-health-plan'),
166 166
 			'default' => 'my-plan',
167 167
 		);
168 168
 		$this->endpoints['plan_single_slug'] = array(
169
-			'title'   => __( 'Single Plan Slug', 'lsx-health-plan' ),
169
+			'title'   => __('Single Plan Slug', 'lsx-health-plan'),
170 170
 			'default' => 'plan',
171 171
 		);
172 172
 		$this->endpoints['endpoint_plan_archive'] = array(
173
-			'title'   => __( 'Plans Archive Endpoint', 'lsx-health-plan' ),
173
+			'title'   => __('Plans Archive Endpoint', 'lsx-health-plan'),
174 174
 			'default' => 'plans',
175 175
 		);
176 176
 
177
-		if ( false !== \lsx_health_plan\functions\get_option( 'exercise_enabled', false ) ) {
177
+		if (false !== \lsx_health_plan\functions\get_option('exercise_enabled', false)) {
178 178
 			$this->endpoints['exercise'] = array(
179 179
 				'exercise_single' => array(
180
-					'title'   => __( 'Single Exercise Slug', 'lsx-health-plan' ),
180
+					'title'   => __('Single Exercise Slug', 'lsx-health-plan'),
181 181
 					'default' => 'exercise',
182 182
 				),
183 183
 				'exercise_archive' => array(
184
-					'title'   => __( 'Archive Exercise Slug', 'lsx-health-plan' ),
184
+					'title'   => __('Archive Exercise Slug', 'lsx-health-plan'),
185 185
 					'default' => 'exercises',
186 186
 				),
187 187
 				'exercise_type' => array(
188
-					'title'   => __( 'Exercise Type Slug', 'lsx-health-plan' ),
188
+					'title'   => __('Exercise Type Slug', 'lsx-health-plan'),
189 189
 					'default' => 'exercise-type',
190 190
 				),
191 191
 				'exercise_equipment' => array(
192
-					'title'   => __( 'Equipment Slug', 'lsx-health-plan' ),
192
+					'title'   => __('Equipment Slug', 'lsx-health-plan'),
193 193
 					'default' => 'equipment',
194 194
 				),
195 195
 				'exercise_musclegroup' => array(
196
-					'title'   => __( 'Muscle Group Slug', 'lsx-health-plan' ),
196
+					'title'   => __('Muscle Group Slug', 'lsx-health-plan'),
197 197
 					'default' => 'muscle-group',
198 198
 				),
199 199
 			);
@@ -208,14 +208,14 @@  discard block
 block discarded – undo
208 208
 		$cmb = new_cmb2_box(
209 209
 			array(
210 210
 				'id'           => $this->screen_id,
211
-				'title'        => esc_html__( 'Settings', 'lsx-health-plan' ),
212
-				'object_types' => array( 'options-page' ),
211
+				'title'        => esc_html__('Settings', 'lsx-health-plan'),
212
+				'object_types' => array('options-page'),
213 213
 				'option_key'   => 'lsx_health_plan_options', // The option key and admin menu page slug.
214 214
 				'parent_slug'  => 'edit.php?post_type=plan', // Make options page a submenu item of the themes menu.
215 215
 				'capability'   => 'manage_options', // Cap required to view options-page.
216 216
 			)
217 217
 		);
218
-		do_action( 'lsx_hp_settings_page', $cmb );
218
+		do_action('lsx_hp_settings_page', $cmb);
219 219
 	}
220 220
 
221 221
 	/**
@@ -224,25 +224,25 @@  discard block
 block discarded – undo
224 224
 	 * @param object $cmb new_cmb2_box().
225 225
 	 * @return void
226 226
 	 */
227
-	public function general_settings( $cmb ) {
227
+	public function general_settings($cmb) {
228 228
 		$cmb->add_field(
229 229
 			array(
230 230
 				'id'      => 'settings_general_title',
231 231
 				'type'    => 'title',
232
-				'name'    => __( 'General', 'lsx-health-plan' ),
233
-				'default' => __( 'General', 'lsx-health-plan' ),
232
+				'name'    => __('General', 'lsx-health-plan'),
233
+				'default' => __('General', 'lsx-health-plan'),
234 234
 			)
235 235
 		);
236 236
 		$cmb->add_field(
237 237
 			array(
238
-				'name'       => __( 'Membership Product', 'lsx-health-plan' ),
238
+				'name'       => __('Membership Product', 'lsx-health-plan'),
239 239
 				'id'         => 'membership_product',
240 240
 				'type'       => 'post_search_ajax',
241 241
 				'limit'      => 1,
242 242
 				'sortable'   => false,
243 243
 				'query_args' => array(
244
-					'post_type'      => array( 'product' ),
245
-					'post_status'    => array( 'publish' ),
244
+					'post_type'      => array('product'),
245
+					'post_status'    => array('publish'),
246 246
 					'posts_per_page' => -1,
247 247
 				),
248 248
 			)
@@ -250,43 +250,43 @@  discard block
 block discarded – undo
250 250
 
251 251
 		$cmb->add_field(
252 252
 			array(
253
-				'name'    => __( 'Your Warm-up Intro', 'lsx-health-plan' ),
253
+				'name'    => __('Your Warm-up Intro', 'lsx-health-plan'),
254 254
 				'id'      => 'warmup_intro',
255 255
 				'type'    => 'textarea',
256 256
 				'value'   => '',
257
-				'default' => __( "Don't forget your warm-up! It's a vital part of your daily workout routine.", 'lsx-health-plan' ),
257
+				'default' => __("Don't forget your warm-up! It's a vital part of your daily workout routine.", 'lsx-health-plan'),
258 258
 			)
259 259
 		);
260
-		if ( post_type_exists( 'workout' ) ) {
260
+		if (post_type_exists('workout')) {
261 261
 			$cmb->add_field(
262 262
 				array(
263
-					'name'    => __( 'Your Workout Intro', 'lsx-health-plan' ),
263
+					'name'    => __('Your Workout Intro', 'lsx-health-plan'),
264 264
 					'id'      => 'workout_intro',
265 265
 					'type'    => 'textarea',
266 266
 					'value'   => '',
267
-					'default' => __( "Let's do this! Smash your daily workout and reach your fitness goals.", 'lsx-health-plan' ),
267
+					'default' => __("Let's do this! Smash your daily workout and reach your fitness goals.", 'lsx-health-plan'),
268 268
 				)
269 269
 			);
270 270
 		}
271
-		if ( post_type_exists( 'meal' ) ) {
271
+		if (post_type_exists('meal')) {
272 272
 			$cmb->add_field(
273 273
 				array(
274
-					'name'    => __( 'Your Meal Plan Intro', 'lsx-health-plan' ),
274
+					'name'    => __('Your Meal Plan Intro', 'lsx-health-plan'),
275 275
 					'id'      => 'meal_plan_intro',
276 276
 					'type'    => 'textarea',
277 277
 					'value'   => '',
278
-					'default' => __( 'Get the right mix of nutrients to keep muscles strong & healthy.', 'lsx-health-plan' ),
278
+					'default' => __('Get the right mix of nutrients to keep muscles strong & healthy.', 'lsx-health-plan'),
279 279
 				)
280 280
 			);
281 281
 		}
282
-		if ( post_type_exists( 'recipe' ) ) {
282
+		if (post_type_exists('recipe')) {
283 283
 			$cmb->add_field(
284 284
 				array(
285
-					'name'    => __( 'Recipes Intro', 'lsx-health-plan' ),
285
+					'name'    => __('Recipes Intro', 'lsx-health-plan'),
286 286
 					'id'      => 'recipes_intro',
287 287
 					'type'    => 'textarea',
288 288
 					'value'   => '',
289
-					'default' => __( "Let's get cooking! Delicious and easy to follow recipes.", 'lsx-health-plan' ),
289
+					'default' => __("Let's get cooking! Delicious and easy to follow recipes.", 'lsx-health-plan'),
290 290
 				)
291 291
 			);
292 292
 		}
@@ -304,26 +304,26 @@  discard block
 block discarded – undo
304 304
 	 * @param object $cmb new_cmb2_box().
305 305
 	 * @return void
306 306
 	 */
307
-	public function global_defaults( $cmb ) {
307
+	public function global_defaults($cmb) {
308 308
 		$cmb->add_field(
309 309
 			array(
310 310
 				'id'      => 'global_defaults_title',
311 311
 				'type'    => 'title',
312
-				'name'    => __( 'Global Defaults', 'lsx-health-plan' ),
313
-				'default' => __( 'Global Defaults', 'lsx-health-plan' ),
312
+				'name'    => __('Global Defaults', 'lsx-health-plan'),
313
+				'default' => __('Global Defaults', 'lsx-health-plan'),
314 314
 			)
315 315
 		);
316 316
 
317
-		foreach ( $this->default_types as $type => $default_type ) {
317
+		foreach ($this->default_types as $type => $default_type) {
318 318
 			$limit    = 5;
319 319
 			$sortable = false;
320
-			if ( isset( $default_type['limit'] ) ) {
320
+			if (isset($default_type['limit'])) {
321 321
 				$limit    = $default_type['limit'];
322 322
 				$sortable = true;
323 323
 			}
324 324
 
325
-			if ( 'page' === $type && false !== \lsx_health_plan\functions\get_option( 'exercise_enabled', false ) ) {
326
-				$type = array( 'page', 'workout' );
325
+			if ('page' === $type && false !== \lsx_health_plan\functions\get_option('exercise_enabled', false)) {
326
+				$type = array('page', 'workout');
327 327
 			}
328 328
 
329 329
 			$cmb->add_field(
@@ -336,7 +336,7 @@  discard block
 block discarded – undo
336 336
 					'sortable'   => $sortable,
337 337
 					'query_args' => array(
338 338
 						'post_type'      => $type,
339
-						'post_status'    => array( 'publish' ),
339
+						'post_status'    => array('publish'),
340 340
 						'posts_per_page' => -1,
341 341
 					),
342 342
 				)
@@ -357,20 +357,20 @@  discard block
 block discarded – undo
357 357
 	 * @param object $cmb new_cmb2_box().
358 358
 	 * @return void
359 359
 	 */
360
-	public function global_downloads( $cmb ) {
360
+	public function global_downloads($cmb) {
361 361
 		$cmb->add_field(
362 362
 			array(
363 363
 				'id'      => 'global_downloads_title',
364 364
 				'type'    => 'title',
365
-				'name'    => __( 'Global Downloads', 'lsx-health-plan' ),
366
-				'default' => __( 'Global Downloads', 'lsx-health-plan' ),
365
+				'name'    => __('Global Downloads', 'lsx-health-plan'),
366
+				'default' => __('Global Downloads', 'lsx-health-plan'),
367 367
 			)
368 368
 		);
369 369
 
370
-		foreach ( $this->download_types as $type => $download_type ) {
370
+		foreach ($this->download_types as $type => $download_type) {
371 371
 			$limit    = 5;
372 372
 			$sortable = false;
373
-			if ( isset( $download_type['limit'] ) ) {
373
+			if (isset($download_type['limit'])) {
374 374
 				$limit    = $download_type['limit'];
375 375
 				$sortable = true;
376 376
 			}
@@ -383,8 +383,8 @@  discard block
 block discarded – undo
383 383
 					'limit'      => $limit,
384 384
 					'sortable'   => $sortable,
385 385
 					'query_args' => array(
386
-						'post_type'      => array( 'dlm_download' ),
387
-						'post_status'    => array( 'publish' ),
386
+						'post_type'      => array('dlm_download'),
387
+						'post_status'    => array('publish'),
388 388
 						'posts_per_page' => -1,
389 389
 					),
390 390
 				)
@@ -404,18 +404,18 @@  discard block
 block discarded – undo
404 404
 	 * @param object $cmb new_cmb2_box().
405 405
 	 * @return void
406 406
 	 */
407
-	public function endpoint_translations( $cmb ) {
407
+	public function endpoint_translations($cmb) {
408 408
 		$cmb->add_field(
409 409
 			array(
410 410
 				'id'          => 'endpoints_title',
411 411
 				'type'        => 'title',
412
-				'name'        => __( 'Set Endpoint Translations', 'lsx-health-plan' ),
413
-				'default'     => __( 'Set Endpoint Translations', 'lsx-health-plan' ),
414
-				'description' => __( 'You need to resave your permalinks after changing the endpoint settings.', 'lsx-health-plan' ),
412
+				'name'        => __('Set Endpoint Translations', 'lsx-health-plan'),
413
+				'default'     => __('Set Endpoint Translations', 'lsx-health-plan'),
414
+				'description' => __('You need to resave your permalinks after changing the endpoint settings.', 'lsx-health-plan'),
415 415
 			)
416 416
 		);
417
-		foreach ( $this->endpoints as $slug => $endpoint_vars ) {
418
-			if ( 'exercise' === $slug ) {
417
+		foreach ($this->endpoints as $slug => $endpoint_vars) {
418
+			if ('exercise' === $slug) {
419 419
 				continue;
420 420
 			}
421 421
 
@@ -443,19 +443,19 @@  discard block
 block discarded – undo
443 443
 	 * @param object $cmb new_cmb2_box().
444 444
 	 * @return void
445 445
 	 */
446
-	public function exercise_translations( $cmb ) {
447
-		if ( isset( $this->endpoints['exercise'] ) && '' !== $this->endpoints['exercise'] && ! empty( $this->endpoints['exercise'] ) ) {
446
+	public function exercise_translations($cmb) {
447
+		if (isset($this->endpoints['exercise']) && '' !== $this->endpoints['exercise'] && ! empty($this->endpoints['exercise'])) {
448 448
 			$cmb->add_field(
449 449
 				array(
450 450
 					'id'          => 'exercise_endpoints_title',
451 451
 					'type'        => 'title',
452
-					'name'        => __( 'Set Exercise Translations', 'lsx-health-plan' ),
453
-					'default'     => __( 'Set Exercise Translations', 'lsx-health-plan' ),
454
-					'description' => __( 'You need to resave your permalinks after changing the endpoint settings.', 'lsx-health-plan' ),
452
+					'name'        => __('Set Exercise Translations', 'lsx-health-plan'),
453
+					'default'     => __('Set Exercise Translations', 'lsx-health-plan'),
454
+					'description' => __('You need to resave your permalinks after changing the endpoint settings.', 'lsx-health-plan'),
455 455
 				)
456 456
 			);
457 457
 
458
-			foreach ( $this->endpoints['exercise'] as $slug => $endpoint_vars ) {
458
+			foreach ($this->endpoints['exercise'] as $slug => $endpoint_vars) {
459 459
 				$cmb->add_field(
460 460
 					array(
461 461
 						'name'    => $endpoint_vars['title'],
@@ -481,27 +481,27 @@  discard block
 block discarded – undo
481 481
 	 * @param object $cmb new_cmb2_box().
482 482
 	 * @return void
483 483
 	 */
484
-	public function post_type_toggles( $cmb ) {
485
-		$post_types = apply_filters( 'lsx_health_plan_post_types', isset( $this->post_types ) );
484
+	public function post_type_toggles($cmb) {
485
+		$post_types = apply_filters('lsx_health_plan_post_types', isset($this->post_types));
486 486
 
487 487
 		$cmb->add_field(
488 488
 			array(
489 489
 				'id'          => 'post_type_toggles_title',
490 490
 				'type'        => 'title',
491
-				'name'        => __( 'Disable Post Types', 'lsx-health-plan' ),
492
-				'default'     => __( 'Disable Post Types', 'lsx-health-plan' ),
493
-				'description' => __( 'Disable post types if you are wanting a minimal site.', 'lsx-health-plan' ),
491
+				'name'        => __('Disable Post Types', 'lsx-health-plan'),
492
+				'default'     => __('Disable Post Types', 'lsx-health-plan'),
493
+				'description' => __('Disable post types if you are wanting a minimal site.', 'lsx-health-plan'),
494 494
 			)
495 495
 		);
496 496
 
497
-		foreach ( $post_types as $post_type ) {
498
-			if ( 'plan' === $post_type || 'exercise' === $post_type || ( 'video' === $post_type && false !== \lsx_health_plan\functions\get_option( 'exercise_enabled', false ) ) ) {
497
+		foreach ($post_types as $post_type) {
498
+			if ('plan' === $post_type || 'exercise' === $post_type || ('video' === $post_type && false !== \lsx_health_plan\functions\get_option('exercise_enabled', false))) {
499 499
 				continue;
500 500
 			}
501 501
 
502 502
 			$cmb->add_field(
503 503
 				array(
504
-					'name'    => ucwords( $post_type ),
504
+					'name'    => ucwords($post_type),
505 505
 					'id'      => $post_type . '_disabled',
506 506
 					'type'    => 'checkbox',
507 507
 					'value'   => 1,
@@ -521,19 +521,19 @@  discard block
 block discarded – undo
521 521
 			array(
522 522
 				'id'          => 'post_type_toggles_enable_title',
523 523
 				'type'        => 'title',
524
-				'name'        => __( 'Enable Post Types', 'lsx-health-plan' ),
525
-				'default'     => __( 'Enable Post Types', 'lsx-health-plan' ),
526
-				'description' => __( 'Enable new functionailty like the "exercise" post type.', 'lsx-health-plan' ),
524
+				'name'        => __('Enable Post Types', 'lsx-health-plan'),
525
+				'default'     => __('Enable Post Types', 'lsx-health-plan'),
526
+				'description' => __('Enable new functionailty like the "exercise" post type.', 'lsx-health-plan'),
527 527
 			)
528 528
 		);
529 529
 		$cmb->add_field(
530 530
 			array(
531
-				'name'        => __( 'Exercises', 'lsx-health-plan' ),
531
+				'name'        => __('Exercises', 'lsx-health-plan'),
532 532
 				'id'          => 'exercise_enabled',
533 533
 				'type'        => 'checkbox',
534 534
 				'value'       => 1,
535 535
 				'default'     => 0,
536
-				'description' => __( 'Enabling the exercise post type will automatically replace the Video post type.', 'lsx-health-plan' ),
536
+				'description' => __('Enabling the exercise post type will automatically replace the Video post type.', 'lsx-health-plan'),
537 537
 			)
538 538
 		);
539 539
 		$cmb->add_field(
@@ -550,18 +550,18 @@  discard block
 block discarded – undo
550 550
 	 * @return void
551 551
 	 */
552 552
 
553
-	public function stat_disable( $cmb ) {
553
+	public function stat_disable($cmb) {
554 554
 		$cmb->add_field(
555 555
 			array(
556 556
 				'id'      => 'stat_disable_title',
557 557
 				'type'    => 'title',
558
-				'name'    => __( 'Disable Profile Stats', 'lsx-health-plan' ),
559
-				'default' => __( 'Disable Profile Stats', 'lsx-health-plan' ),
558
+				'name'    => __('Disable Profile Stats', 'lsx-health-plan'),
559
+				'default' => __('Disable Profile Stats', 'lsx-health-plan'),
560 560
 			)
561 561
 		);
562 562
 		$cmb->add_field(
563 563
 			array(
564
-				'name'    => __( 'Disable All Stats', 'lsx-health-plan' ),
564
+				'name'    => __('Disable All Stats', 'lsx-health-plan'),
565 565
 				'desc'    => 'Disable All Stats',
566 566
 				'id'      => 'disable_all_stats',
567 567
 				'type'    => 'checkbox',
@@ -571,7 +571,7 @@  discard block
 block discarded – undo
571 571
 		);
572 572
 		$cmb->add_field(
573 573
 			array(
574
-				'name'    => __( 'Disable Weight', 'lsx-health-plan' ),
574
+				'name'    => __('Disable Weight', 'lsx-health-plan'),
575 575
 				'id'      => 'disable_weight_checkbox',
576 576
 				'type'    => 'checkbox',
577 577
 				'value'   => 1,
@@ -580,7 +580,7 @@  discard block
 block discarded – undo
580 580
 		);
581 581
 		$cmb->add_field(
582 582
 			array(
583
-				'name'    => __( 'Disable Waist', 'lsx-health-plan' ),
583
+				'name'    => __('Disable Waist', 'lsx-health-plan'),
584 584
 				'id'      => 'disable_waist_checkbox',
585 585
 				'type'    => 'checkbox',
586 586
 				'value'   => 1,
@@ -589,7 +589,7 @@  discard block
 block discarded – undo
589 589
 		);
590 590
 		$cmb->add_field(
591 591
 			array(
592
-				'name'    => __( 'Disable Fitness', 'lsx-health-plan' ),
592
+				'name'    => __('Disable Fitness', 'lsx-health-plan'),
593 593
 				'id'      => 'disable_fitness_checkbox',
594 594
 				'type'    => 'checkbox',
595 595
 				'value'   => 1,
Please login to merge, or discard this patch.
classes/admin/class-help-page.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -32,11 +32,11 @@  discard block
 block discarded – undo
32 32
 	 * Contructor
33 33
 	 */
34 34
 	public function __construct() {
35
-		add_action( 'admin_enqueue_scripts', array( $this, 'assets' ) );
36
-		add_action( 'admin_menu', array( $this, 'register_menu' ) );
37
-		add_action( 'lsx_hp_help', array( $this, 'header' ), 10 );
38
-		add_action( 'lsx_hp_help', array( $this, 'body' ), 20 );
39
-		add_action( 'lsx_hp_help', array( $this, 'footer' ), 30 );
35
+		add_action('admin_enqueue_scripts', array($this, 'assets'));
36
+		add_action('admin_menu', array($this, 'register_menu'));
37
+		add_action('lsx_hp_help', array($this, 'header'), 10);
38
+		add_action('lsx_hp_help', array($this, 'body'), 20);
39
+		add_action('lsx_hp_help', array($this, 'footer'), 30);
40 40
 	}
41 41
 
42 42
 	/**
@@ -48,7 +48,7 @@  discard block
 block discarded – undo
48 48
 	 */
49 49
 	public static function get_instance() {
50 50
 		// If the single instance hasn't been set, set it now.
51
-		if ( null === self::$instance ) {
51
+		if (null === self::$instance) {
52 52
 			self::$instance = new self();
53 53
 		}
54 54
 		return self::$instance;
@@ -64,10 +64,10 @@  discard block
 block discarded – undo
64 64
 	 *
65 65
 	 * @param string $hook_suffix the current page hook suffix.
66 66
 	 */
67
-	public function assets( $hook_suffix ) {
68
-		if ( 'plan_page_help' === $hook_suffix ) {
69
-			wp_enqueue_style( 'lsx-hp-help-screen', get_template_directory_uri() . '/assets/css/admin/help.css', array(), LSX_VERSION );
70
-			wp_style_add_data( 'lsx-hp-help-screen', 'rtl', 'replace' );
67
+	public function assets($hook_suffix) {
68
+		if ('plan_page_help' === $hook_suffix) {
69
+			wp_enqueue_style('lsx-hp-help-screen', get_template_directory_uri() . '/assets/css/admin/help.css', array(), LSX_VERSION);
70
+			wp_style_add_data('lsx-hp-help-screen', 'rtl', 'replace');
71 71
 		}
72 72
 	}
73 73
 
@@ -78,7 +78,7 @@  discard block
 block discarded – undo
78 78
 	 * @subpackage hp-help-page
79 79
 	 */
80 80
 	public function register_menu() {
81
-		add_submenu_page( 'edit.php?post_type=plan', __( 'Help', 'lsx-health-plan' ), __( 'Help', 'lsx-health-plan' ), 'manage_options', 'help', array( $this, 'screen' ) );
81
+		add_submenu_page('edit.php?post_type=plan', __('Help', 'lsx-health-plan'), __('Help', 'lsx-health-plan'), 'manage_options', 'help', array($this, 'screen'));
82 82
 	}
83 83
 
84 84
 
@@ -102,7 +102,7 @@  discard block
 block discarded – undo
102 102
 			 * @hooked lsx_hp_help_body - 20
103 103
 			 * @hooked lsx_hp_help_footer  - 30
104 104
 			 */
105
-			do_action( 'lsx_hp_help' );
105
+			do_action('lsx_hp_help');
106 106
 			?>
107 107
 		</div>
108 108
 		<?php
@@ -117,8 +117,8 @@  discard block
 block discarded – undo
117 117
 	public function header() {
118 118
 		?>
119 119
 		<div class="box enrich">
120
-			<h2><?php esc_html_e( 'Built to enrich your WordPress experience.', 'lsx-health-plan' ); ?></h2>
121
-			<p><?php esc_html_e( 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Mauris iaculis feugiat consectetur. Integer mollis ex lacus, sed ultrices felis mollis vitae.', 'lsx-health-plan' ); ?></p>
120
+			<h2><?php esc_html_e('Built to enrich your WordPress experience.', 'lsx-health-plan'); ?></h2>
121
+			<p><?php esc_html_e('Lorem ipsum dolor sit amet, consectetur adipiscing elit. Mauris iaculis feugiat consectetur. Integer mollis ex lacus, sed ultrices felis mollis vitae.', 'lsx-health-plan'); ?></p>
122 122
 		</div>
123 123
 		<?php
124 124
 	}
Please login to merge, or discard this patch.
classes/class-scpo-engine.php 1 patch
Spacing   +123 added lines, -123 removed lines patch added patch discarded remove patch
@@ -22,74 +22,74 @@  discard block
 block discarded – undo
22 22
 	 */
23 23
 	public static function get_instance() {
24 24
 		// If the single instance hasn't been set, set it now.
25
-		if ( null == self::$instance ) {
25
+		if (null == self::$instance) {
26 26
 			self::$instance = new self;
27 27
 		}
28 28
 		return self::$instance;
29 29
 	}
30 30
 
31 31
 	public function __construct() {
32
-		if ( ! get_option( 'lsx_to_scporder_install' ) ) {
32
+		if ( ! get_option('lsx_to_scporder_install')) {
33 33
 			$this->lsx_to_scporder_install();
34 34
 		}
35 35
 
36
-		add_action( 'admin_init', array( $this, 'refresh' ) );
37
-		add_action( 'admin_init', array( $this, 'load_script_css' ) );
36
+		add_action('admin_init', array($this, 'refresh'));
37
+		add_action('admin_init', array($this, 'load_script_css'));
38 38
 
39
-		add_action( 'wp_ajax_update-menu-order', array(
39
+		add_action('wp_ajax_update-menu-order', array(
40 40
 			$this,
41 41
 			'update_menu_order',
42
-		) );
43
-		add_action( 'wp_ajax_update-menu-order-tags', array(
42
+		));
43
+		add_action('wp_ajax_update-menu-order-tags', array(
44 44
 			$this,
45 45
 			'update_menu_order_tags',
46
-		) );
46
+		));
47 47
 
48
-		add_action( 'pre_get_posts', array(
48
+		add_action('pre_get_posts', array(
49 49
 			$this,
50 50
 			'lsx_to_scporder_pre_get_posts',
51
-		) );
51
+		));
52 52
 
53
-		add_filter( 'get_previous_post_where', array(
53
+		add_filter('get_previous_post_where', array(
54 54
 			$this,
55 55
 			'lsx_to_scporder_previous_post_where',
56
-		) );
57
-		add_filter( 'get_previous_post_sort', array(
56
+		));
57
+		add_filter('get_previous_post_sort', array(
58 58
 			$this,
59 59
 			'lsx_to_scporder_previous_post_sort',
60
-		) );
61
-		add_filter( 'get_next_post_where', array(
60
+		));
61
+		add_filter('get_next_post_where', array(
62 62
 			$this,
63 63
 			'lsx_to_scporder_next_post_where',
64
-		) );
65
-		add_filter( 'get_next_post_sort', array(
64
+		));
65
+		add_filter('get_next_post_sort', array(
66 66
 			$this,
67 67
 			'lsx_to_scporder_next_post_sort',
68
-		) );
68
+		));
69 69
 
70
-		add_filter( 'get_terms_orderby', array(
70
+		add_filter('get_terms_orderby', array(
71 71
 			$this,
72 72
 			'lsx_to_scporder_get_terms_orderby',
73
-		), 10, 3 );
74
-		add_filter( 'wp_get_object_terms', array(
73
+		), 10, 3);
74
+		add_filter('wp_get_object_terms', array(
75 75
 			$this,
76 76
 			'lsx_to_scporder_get_object_terms',
77
-		), 10, 4 );
78
-		add_filter( 'get_terms', array(
77
+		), 10, 4);
78
+		add_filter('get_terms', array(
79 79
 			$this,
80 80
 			'lsx_to_scporder_get_object_terms',
81
-		), 10, 4 );
81
+		), 10, 4);
82 82
 	}
83 83
 
84 84
 	public function lsx_to_scporder_install() {
85 85
 		global $wpdb;
86
-		$result = $wpdb->query( "DESCRIBE $wpdb->terms `lsx_to_term_order`" );
86
+		$result = $wpdb->query("DESCRIBE $wpdb->terms `lsx_to_term_order`");
87 87
 
88
-		if ( ! $result ) {
89
-			$result = $wpdb->query( "ALTER TABLE $wpdb->terms ADD `lsx_to_term_order` INT(4) NULL DEFAULT '0'" );
88
+		if ( ! $result) {
89
+			$result = $wpdb->query("ALTER TABLE $wpdb->terms ADD `lsx_to_term_order` INT(4) NULL DEFAULT '0'");
90 90
 		}
91 91
 
92
-		update_option( 'lsx_to_scporder_install', 1 );
92
+		update_option('lsx_to_scporder_install', 1);
93 93
 	}
94 94
 
95 95
 	public function _check_load_script_css() {
@@ -98,25 +98,25 @@  discard block
 block discarded – undo
98 98
 		$objects = $this->get_to_scporder_options_objects();
99 99
 		$tags    = $this->get_to_scporder_options_tags();
100 100
 
101
-		if ( empty( $objects ) && empty( $tags ) ) {
101
+		if (empty($objects) && empty($tags)) {
102 102
 			return false;
103 103
 		}
104 104
 
105
-		if ( isset( $_GET['orderby'] ) || strstr( sanitize_text_field( $_SERVER['REQUEST_URI'] ), 'action=edit' ) || strstr( sanitize_text_field( $_SERVER['REQUEST_URI'] ), 'wp-admin/post-new.php' ) ) {
105
+		if (isset($_GET['orderby']) || strstr(sanitize_text_field($_SERVER['REQUEST_URI']), 'action=edit') || strstr(sanitize_text_field($_SERVER['REQUEST_URI']), 'wp-admin/post-new.php')) {
106 106
 			return false;
107 107
 		}
108 108
 
109
-		if ( ! empty( $objects ) ) {
110
-			if ( isset( $_GET['post_type'] ) && ! isset( $_GET['taxonomy'] ) && array_key_exists( sanitize_text_field( $_GET['post_type'] ), $objects ) ) { // if page or custom post types
109
+		if ( ! empty($objects)) {
110
+			if (isset($_GET['post_type']) && ! isset($_GET['taxonomy']) && array_key_exists(sanitize_text_field($_GET['post_type']), $objects)) { // if page or custom post types
111 111
 				$active = true;
112 112
 			}
113
-			if ( ! isset( $_GET['post_type'] ) && strstr( sanitize_text_field( $_SERVER['REQUEST_URI'] ), 'wp-admin/edit.php' ) && array_key_exists( 'post', $objects ) ) { // if post
113
+			if ( ! isset($_GET['post_type']) && strstr(sanitize_text_field($_SERVER['REQUEST_URI']), 'wp-admin/edit.php') && array_key_exists('post', $objects)) { // if post
114 114
 				$active = true;
115 115
 			}
116 116
 		}
117 117
 
118
-		if ( ! empty( $tags ) ) {
119
-			if ( isset( $_GET['taxonomy'] ) && array_key_exists( sanitize_text_field( $_GET['taxonomy'] ), $tags ) ) {
118
+		if ( ! empty($tags)) {
119
+			if (isset($_GET['taxonomy']) && array_key_exists(sanitize_text_field($_GET['taxonomy']), $tags)) {
120 120
 				$active = true;
121 121
 			}
122 122
 		}
@@ -125,18 +125,18 @@  discard block
 block discarded – undo
125 125
 	}
126 126
 
127 127
 	public function load_script_css() {
128
-		if ( $this->_check_load_script_css() ) {
129
-			wp_enqueue_script( 'scporderjs', LSX_HEALTH_PLAN_URL . '/assets/js/scporder.min.js', array( 'jquery', 'jquery-ui-sortable' ), null, true );
128
+		if ($this->_check_load_script_css()) {
129
+			wp_enqueue_script('scporderjs', LSX_HEALTH_PLAN_URL . '/assets/js/scporder.min.js', array('jquery', 'jquery-ui-sortable'), null, true);
130 130
 
131 131
 			$scporderjs_params = array(
132
-				'ajax_url'   => admin_url( 'admin-ajax.php' ),
133
-				'ajax_nonce' => wp_create_nonce( 'scporder' ),
132
+				'ajax_url'   => admin_url('admin-ajax.php'),
133
+				'ajax_nonce' => wp_create_nonce('scporder'),
134 134
 			);
135 135
 
136
-			wp_localize_script( 'scporderjs', 'scporderjs_params', $scporderjs_params );
136
+			wp_localize_script('scporderjs', 'scporderjs_params', $scporderjs_params);
137 137
 
138
-			wp_enqueue_style( 'scporder', LSX_HEALTH_PLAN_URL . '/assets/css/scporder.css', array(), null );
139
-			wp_style_add_data( 'scporder', 'rtl', 'replace' );
138
+			wp_enqueue_style('scporder', LSX_HEALTH_PLAN_URL . '/assets/css/scporder.css', array(), null);
139
+			wp_style_add_data('scporder', 'rtl', 'replace');
140 140
 		}
141 141
 	}
142 142
 
@@ -145,26 +145,26 @@  discard block
 block discarded – undo
145 145
 		$objects = $this->get_to_scporder_options_objects();
146 146
 		$tags    = $this->get_to_scporder_options_tags();
147 147
 
148
-		if ( ! empty( $objects ) ) {
149
-			foreach ( $objects as $object => $object_data ) {
150
-				$result = $wpdb->get_results( $wpdb->prepare( "
148
+		if ( ! empty($objects)) {
149
+			foreach ($objects as $object => $object_data) {
150
+				$result = $wpdb->get_results($wpdb->prepare("
151 151
 					SELECT count(*) as cnt, max(menu_order) as max, min(menu_order) as min
152 152
 					FROM $wpdb->posts
153 153
 					WHERE post_type = '%s' AND post_status IN ('publish', 'pending', 'draft', 'private', 'future')
154
-				", $object ) );
154
+				", $object));
155 155
 
156
-				if ( 0 == $result[0]->cnt || $result[0]->cnt == $result[0]->max ) {
156
+				if (0 == $result[0]->cnt || $result[0]->cnt == $result[0]->max) {
157 157
 					continue;
158 158
 				}
159 159
 
160
-				$results = $wpdb->get_results( $wpdb->prepare( "
160
+				$results = $wpdb->get_results($wpdb->prepare("
161 161
 					SELECT ID
162 162
 					FROM $wpdb->posts
163 163
 					WHERE post_type = '%s' AND post_status IN ('publish', 'pending', 'draft', 'private', 'future')
164 164
 					ORDER BY menu_order ASC
165
-				", $object ) );
165
+				", $object));
166 166
 
167
-				foreach ( $results as $key => $result ) {
167
+				foreach ($results as $key => $result) {
168 168
 					$wpdb->update(
169 169
 						$wpdb->posts,
170 170
 						array(
@@ -178,28 +178,28 @@  discard block
 block discarded – undo
178 178
 			}
179 179
 		}
180 180
 
181
-		if ( ! empty( $tags ) ) {
182
-			foreach ( $tags as $taxonomy => $taxonomy_data ) {
183
-				$result = $wpdb->get_results( $wpdb->prepare( "
181
+		if ( ! empty($tags)) {
182
+			foreach ($tags as $taxonomy => $taxonomy_data) {
183
+				$result = $wpdb->get_results($wpdb->prepare("
184 184
 					SELECT count(*) as cnt, max(lsx_to_term_order) as max, min(lsx_to_term_order) as min
185 185
 					FROM $wpdb->terms AS terms
186 186
 					INNER JOIN $wpdb->term_taxonomy AS term_taxonomy ON ( terms.term_id = term_taxonomy.term_id )
187 187
 					WHERE term_taxonomy.taxonomy = '%s'
188
-				", $taxonomy ) );
188
+				", $taxonomy));
189 189
 
190
-				if ( 0 == $result[0]->cnt || $result[0]->cnt == $result[0]->max ) {
190
+				if (0 == $result[0]->cnt || $result[0]->cnt == $result[0]->max) {
191 191
 					continue;
192 192
 				}
193 193
 
194
-				$results = $wpdb->get_results( $wpdb->prepare( "
194
+				$results = $wpdb->get_results($wpdb->prepare("
195 195
 					SELECT terms.term_id
196 196
 					FROM $wpdb->terms AS terms
197 197
 					INNER JOIN $wpdb->term_taxonomy AS term_taxonomy ON ( terms.term_id = term_taxonomy.term_id )
198 198
 					WHERE term_taxonomy.taxonomy = '%s'
199 199
 					ORDER BY lsx_to_term_order ASC
200
-				", $taxonomy ) );
200
+				", $taxonomy));
201 201
 
202
-				foreach ( $results as $key => $result ) {
202
+				foreach ($results as $key => $result) {
203 203
 					$wpdb->update(
204 204
 						$wpdb->terms,
205 205
 						array(
@@ -215,13 +215,13 @@  discard block
 block discarded – undo
215 215
 	}
216 216
 
217 217
 	public function update_menu_order() {
218
-		check_ajax_referer( 'scporder', 'security' );
218
+		check_ajax_referer('scporder', 'security');
219 219
 
220 220
 		global $wpdb;
221 221
 
222
-		parse_str( sanitize_text_field( $_POST['order'] ), $data );
222
+		parse_str(sanitize_text_field($_POST['order']), $data);
223 223
 
224
-		if ( ! is_array( $data ) ) {
224
+		if ( ! is_array($data)) {
225 225
 			return false;
226 226
 		}
227 227
 
@@ -244,15 +244,15 @@  discard block
 block discarded – undo
244 244
 
245 245
 		sort( $menu_order_arr );*/
246 246
 
247
-		foreach ( $data as $key => $values ) {
248
-			foreach ( $values as $position => $id ) {
247
+		foreach ($data as $key => $values) {
248
+			foreach ($values as $position => $id) {
249 249
 				$wpdb->update(
250 250
 					$wpdb->posts,
251 251
 					array(
252 252
 						'menu_order' => $position,
253 253
 					),
254 254
 					array(
255
-						'ID' => intval( $id ),
255
+						'ID' => intval($id),
256 256
 					)
257 257
 				);
258 258
 			}
@@ -260,13 +260,13 @@  discard block
 block discarded – undo
260 260
 	}
261 261
 
262 262
 	public function update_menu_order_tags() {
263
-		check_ajax_referer( 'scporder', 'security' );
263
+		check_ajax_referer('scporder', 'security');
264 264
 
265 265
 		global $wpdb;
266 266
 
267
-		parse_str( sanitize_text_field( $_POST['order'] ), $data );
267
+		parse_str(sanitize_text_field($_POST['order']), $data);
268 268
 
269
-		if ( ! is_array( $data ) ) {
269
+		if ( ! is_array($data)) {
270 270
 			return false;
271 271
 		}
272 272
 
@@ -294,33 +294,33 @@  discard block
 block discarded – undo
294 294
 
295 295
 		sort( $menu_order_arr );*/
296 296
 
297
-		foreach ( $data as $key => $values ) {
297
+		foreach ($data as $key => $values) {
298 298
 			$term_ids = array();
299
-			foreach ( $values as $position => $id ) {
299
+			foreach ($values as $position => $id) {
300 300
 				$wpdb->update(
301 301
 					$wpdb->terms,
302 302
 					array(
303 303
 						'lsx_to_term_order' => $position + 1,
304 304
 					),
305 305
 					array(
306
-						'term_id' => intval( $id ),
306
+						'term_id' => intval($id),
307 307
 					)
308 308
 				);
309
-				$term_ids[] = intval( $id );
309
+				$term_ids[] = intval($id);
310 310
 			}
311
-			clean_term_cache( $term_ids );
311
+			clean_term_cache($term_ids);
312 312
 		}
313 313
 	}
314 314
 
315
-	public function lsx_to_scporder_previous_post_where( $where ) {
315
+	public function lsx_to_scporder_previous_post_where($where) {
316 316
 		global $post;
317 317
 		$objects = $this->get_to_scporder_options_objects();
318 318
 
319
-		if ( empty( $objects ) ) {
319
+		if (empty($objects)) {
320 320
 			return $where;
321 321
 		}
322 322
 
323
-		if ( isset( $post->post_type ) && array_key_exists( $post->post_type, $objects ) ) {
323
+		if (isset($post->post_type) && array_key_exists($post->post_type, $objects)) {
324 324
 			$current_menu_order = $post->menu_order;
325 325
 			$where              = "WHERE p.menu_order > '" . $current_menu_order . "' AND p.post_type = '" . $post->post_type . "' AND p.post_status = 'publish'";
326 326
 		}
@@ -328,30 +328,30 @@  discard block
 block discarded – undo
328 328
 		return $where;
329 329
 	}
330 330
 
331
-	public function lsx_to_scporder_previous_post_sort( $orderby ) {
331
+	public function lsx_to_scporder_previous_post_sort($orderby) {
332 332
 		global $post;
333 333
 		$objects = $this->get_to_scporder_options_objects();
334 334
 
335
-		if ( empty( $objects ) ) {
335
+		if (empty($objects)) {
336 336
 			return $orderby;
337 337
 		}
338 338
 
339
-		if ( isset( $post->post_type ) && array_key_exists( $post->post_type, $objects ) ) {
339
+		if (isset($post->post_type) && array_key_exists($post->post_type, $objects)) {
340 340
 			$orderby = 'ORDER BY p.menu_order ASC LIMIT 1';
341 341
 		}
342 342
 
343 343
 		return $orderby;
344 344
 	}
345 345
 
346
-	public function lsx_to_scporder_next_post_where( $where ) {
346
+	public function lsx_to_scporder_next_post_where($where) {
347 347
 		global $post;
348 348
 		$objects = $this->get_to_scporder_options_objects();
349 349
 
350
-		if ( empty( $objects ) ) {
350
+		if (empty($objects)) {
351 351
 			return $where;
352 352
 		}
353 353
 
354
-		if ( isset( $post->post_type ) && array_key_exists( $post->post_type, $objects ) ) {
354
+		if (isset($post->post_type) && array_key_exists($post->post_type, $objects)) {
355 355
 			$current_menu_order = $post->menu_order;
356 356
 			$where              = "WHERE p.menu_order < '" . $current_menu_order . "' AND p.post_type = '" . $post->post_type . "' AND p.post_status = 'publish'";
357 357
 		}
@@ -359,97 +359,97 @@  discard block
 block discarded – undo
359 359
 		return $where;
360 360
 	}
361 361
 
362
-	public function lsx_to_scporder_next_post_sort( $orderby ) {
362
+	public function lsx_to_scporder_next_post_sort($orderby) {
363 363
 		global $post;
364 364
 		$objects = $this->get_to_scporder_options_objects();
365 365
 
366
-		if ( empty( $objects ) ) {
366
+		if (empty($objects)) {
367 367
 			return $orderby;
368 368
 		}
369 369
 
370
-		if ( isset( $post->post_type ) && array_key_exists( $post->post_type, $objects ) ) {
370
+		if (isset($post->post_type) && array_key_exists($post->post_type, $objects)) {
371 371
 			$orderby = 'ORDER BY p.menu_order DESC LIMIT 1';
372 372
 		}
373 373
 
374 374
 		return $orderby;
375 375
 	}
376 376
 
377
-	public function lsx_to_scporder_pre_get_posts( $wp_query ) {
377
+	public function lsx_to_scporder_pre_get_posts($wp_query) {
378 378
 		$objects = $this->get_to_scporder_options_objects();
379 379
 
380
-		if ( empty( $objects ) ) {
380
+		if (empty($objects)) {
381 381
 			return false;
382 382
 		}
383 383
 
384
-		if ( is_admin() ) {
385
-			if ( isset( $wp_query->query['post_type'] ) && ! isset( $_GET['orderby'] ) ) {
386
-				if ( array_key_exists( $wp_query->query['post_type'], $objects ) ) {
387
-					$wp_query->set( 'orderby', 'menu_order' );
388
-					$wp_query->set( 'order', 'ASC' );
384
+		if (is_admin()) {
385
+			if (isset($wp_query->query['post_type']) && ! isset($_GET['orderby'])) {
386
+				if (array_key_exists($wp_query->query['post_type'], $objects)) {
387
+					$wp_query->set('orderby', 'menu_order');
388
+					$wp_query->set('order', 'ASC');
389 389
 				}
390 390
 			}
391 391
 		} else {
392 392
 			$active = false;
393 393
 
394
-			if ( isset( $wp_query->query['post_type'] ) ) {
395
-				if ( ! is_array( $wp_query->query['post_type'] ) ) {
396
-					if ( array_key_exists( $wp_query->query['post_type'], $objects ) ) {
394
+			if (isset($wp_query->query['post_type'])) {
395
+				if ( ! is_array($wp_query->query['post_type'])) {
396
+					if (array_key_exists($wp_query->query['post_type'], $objects)) {
397 397
 						$active = true;
398 398
 					}
399 399
 				}
400 400
 			} else {
401
-				if ( array_key_exists( 'post', $objects ) ) {
401
+				if (array_key_exists('post', $objects)) {
402 402
 					$active = true;
403 403
 				}
404 404
 			}
405 405
 
406
-			if ( ! $active ) {
406
+			if ( ! $active) {
407 407
 				return false;
408 408
 			}
409 409
 
410
-			if ( isset( $wp_query->query['disabled_custom_post_order'] ) ) {
410
+			if (isset($wp_query->query['disabled_custom_post_order'])) {
411 411
 				return false;
412 412
 			}
413 413
 
414
-			if ( isset( $wp_query->query['suppress_filters'] ) ) {
415
-				if ( $wp_query->get( 'orderby' ) == 'date' ) {
416
-					$wp_query->set( 'orderby', 'menu_order' );
414
+			if (isset($wp_query->query['suppress_filters'])) {
415
+				if ($wp_query->get('orderby') == 'date') {
416
+					$wp_query->set('orderby', 'menu_order');
417 417
 				}
418
-				if ( $wp_query->get( 'order' ) == 'DESC' ) {
419
-					$wp_query->set( 'order', 'ASC' );
418
+				if ($wp_query->get('order') == 'DESC') {
419
+					$wp_query->set('order', 'ASC');
420 420
 				}
421 421
 			} else {
422
-				if ( ! $wp_query->get( 'orderby' ) ) {
423
-					$wp_query->set( 'orderby', 'menu_order' );
422
+				if ( ! $wp_query->get('orderby')) {
423
+					$wp_query->set('orderby', 'menu_order');
424 424
 				}
425
-				if ( ! $wp_query->get( 'order' ) ) {
426
-					$wp_query->set( 'order', 'ASC' );
425
+				if ( ! $wp_query->get('order')) {
426
+					$wp_query->set('order', 'ASC');
427 427
 				}
428 428
 			}
429 429
 		}
430 430
 	}
431 431
 
432
-	public function lsx_to_scporder_get_terms_orderby( $orderby, $args ) {
432
+	public function lsx_to_scporder_get_terms_orderby($orderby, $args) {
433 433
 
434
-		if ( is_admin() ) {
434
+		if (is_admin()) {
435 435
 			return $orderby;
436 436
 		}
437 437
 
438
-		if ( isset( $args['disabled_custom_post_order'] ) ) {
438
+		if (isset($args['disabled_custom_post_order'])) {
439 439
 			return $orderby;
440 440
 		}
441 441
 
442 442
 		$tags = $this->get_to_scporder_options_tags();
443 443
 
444
-		if ( ! isset( $args['taxonomy'] ) ) {
444
+		if ( ! isset($args['taxonomy'])) {
445 445
 			return $orderby;
446 446
 		}
447 447
 
448 448
 		$taxonomy = $args['taxonomy'];
449
-		if ( is_array( $taxonomy ) && count( $taxonomy ) == 1 ) {
449
+		if (is_array($taxonomy) && count($taxonomy) == 1) {
450 450
 			$taxonomy = $taxonomy[0];
451 451
 		}
452
-		if ( ! is_array( $taxonomy ) && ! array_key_exists( $taxonomy, $tags ) ) {
452
+		if ( ! is_array($taxonomy) && ! array_key_exists($taxonomy, $tags)) {
453 453
 			return $orderby;
454 454
 		}
455 455
 
@@ -458,38 +458,38 @@  discard block
 block discarded – undo
458 458
 		return $orderby;
459 459
 	}
460 460
 
461
-	public function lsx_to_scporder_get_object_terms( $terms, $not_used, $args_1, $args_2 = null ) {
461
+	public function lsx_to_scporder_get_object_terms($terms, $not_used, $args_1, $args_2 = null) {
462 462
 		$tags = $this->get_to_scporder_options_tags();
463 463
 
464
-		if ( is_admin() && isset( $_GET['orderby'] ) ) {
464
+		if (is_admin() && isset($_GET['orderby'])) {
465 465
 			return $terms;
466 466
 		}
467 467
 
468
-		$args = is_null( $args_2 ) || ! is_array( $args_2 ) ? $args_1 : $args_2;
468
+		$args = is_null($args_2) || ! is_array($args_2) ? $args_1 : $args_2;
469 469
 
470
-		if ( isset( $args['disabled_custom_post_order'] ) ) {
470
+		if (isset($args['disabled_custom_post_order'])) {
471 471
 			return $terms;
472 472
 		}
473 473
 
474
-		foreach ( $terms as $key => $term ) {
475
-			if ( is_object( $term ) && isset( $term->taxonomy ) ) {
474
+		foreach ($terms as $key => $term) {
475
+			if (is_object($term) && isset($term->taxonomy)) {
476 476
 				$taxonomy = $term->taxonomy;
477
-				if ( ! array_key_exists( $taxonomy, $tags ) ) {
477
+				if ( ! array_key_exists($taxonomy, $tags)) {
478 478
 					return $terms;
479 479
 				}
480 480
 			} else {
481 481
 				return $terms;
482 482
 			}
483 483
 		}
484
-		usort( $terms, array( $this, 'taxcmp' ) );
484
+		usort($terms, array($this, 'taxcmp'));
485 485
 		return $terms;
486 486
 	}
487 487
 
488
-	public function taxcmp( $a, $b ) {
489
-		if ( $a->lsx_to_term_order == $b->lsx_to_term_order ) {
488
+	public function taxcmp($a, $b) {
489
+		if ($a->lsx_to_term_order == $b->lsx_to_term_order) {
490 490
 			return 0;
491 491
 		}
492
-		return ( $a->lsx_to_term_order < $b->lsx_to_term_order ) ? - 1 : 1;
492
+		return ($a->lsx_to_term_order < $b->lsx_to_term_order) ? -1 : 1;
493 493
 	}
494 494
 
495 495
 	public function get_to_scporder_options_objects() {
Please login to merge, or discard this patch.
classes/class-integrations.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -57,10 +57,10 @@  discard block
 block discarded – undo
57 57
 	 * Contructor
58 58
 	 */
59 59
 	public function __construct() {
60
-		add_action( 'init', array( $this, 'cmb2_post_search_ajax' ) );
61
-		add_action( 'init', array( $this, 'download_monitor_init' ) );
62
-		add_action( 'init', array( $this, 'woocommerce_init' ) );
63
-		add_action( 'init', array( $this, 'wp_user_avatar_init' ) );
60
+		add_action('init', array($this, 'cmb2_post_search_ajax'));
61
+		add_action('init', array($this, 'download_monitor_init'));
62
+		add_action('init', array($this, 'woocommerce_init'));
63
+		add_action('init', array($this, 'wp_user_avatar_init'));
64 64
 	}
65 65
 
66 66
 	/**
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 72
 	 */
73 73
 	public static function get_instance() {
74 74
 		// If the single instance hasn't been set, set it now.
75
-		if ( null === self::$instance ) {
75
+		if (null === self::$instance) {
76 76
 			self::$instance = new self();
77 77
 		}
78 78
 		return self::$instance;
@@ -94,7 +94,7 @@  discard block
 block discarded – undo
94 94
 	 * @return void
95 95
 	 */
96 96
 	public function download_monitor_init() {
97
-		if ( function_exists( 'download_monitor' ) ) {
97
+		if (function_exists('download_monitor')) {
98 98
 			require_once LSX_HEALTH_PLAN_PATH . 'classes/integrations/class-download-monitor.php';
99 99
 			$this->download_monitor = Download_Monitor::get_instance();
100 100
 		}
@@ -106,7 +106,7 @@  discard block
 block discarded – undo
106 106
 	 * @return void
107 107
 	 */
108 108
 	public function woocommerce_init() {
109
-		if ( function_exists( 'WC' ) ) {
109
+		if (function_exists('WC')) {
110 110
 			require_once LSX_HEALTH_PLAN_PATH . 'classes/integrations/class-woocommerce.php';
111 111
 			$this->woocommerce = Woocommerce::get_instance();
112 112
 		}
@@ -118,7 +118,7 @@  discard block
 block discarded – undo
118 118
 	 * @return void
119 119
 	 */
120 120
 	public function wp_user_avatar_init() {
121
-		if ( class_exists( 'WP_User_Avatar_Setup' ) ) {
121
+		if (class_exists('WP_User_Avatar_Setup')) {
122 122
 			require_once LSX_HEALTH_PLAN_PATH . 'classes/integrations/class-wp-user-avatar.php';
123 123
 			$this->wp_user_avatar = WP_User_Avatar::get_instance();
124 124
 		}
Please login to merge, or discard this patch.
classes/class-admin.php 1 patch
Spacing   +88 added lines, -88 removed lines patch added patch discarded remove patch
@@ -53,12 +53,12 @@  discard block
 block discarded – undo
53 53
 	 */
54 54
 	public function __construct() {
55 55
 		$this->load_classes();
56
-		add_action( 'admin_menu', array( $this, 'order_menus' ), 200 );
57
-		add_action( 'admin_enqueue_scripts', array( $this, 'assets' ) );
58
-		add_filter( 'cmb2_override_meta_save', array( $this, 'save_previous_values' ), 20, 4 );
59
-		add_filter( 'cmb2_override_meta_remove', array( $this, 'save_previous_values' ), 20, 4 );
60
-		add_action( 'cmb2_save_field', array( $this, 'post_relations' ), 20, 4 );
61
-		add_action( 'before_delete_post', array( $this, 'delete_post_meta_connections' ), 20, 1 );
56
+		add_action('admin_menu', array($this, 'order_menus'), 200);
57
+		add_action('admin_enqueue_scripts', array($this, 'assets'));
58
+		add_filter('cmb2_override_meta_save', array($this, 'save_previous_values'), 20, 4);
59
+		add_filter('cmb2_override_meta_remove', array($this, 'save_previous_values'), 20, 4);
60
+		add_action('cmb2_save_field', array($this, 'post_relations'), 20, 4);
61
+		add_action('before_delete_post', array($this, 'delete_post_meta_connections'), 20, 1);
62 62
 	}
63 63
 
64 64
 	/**
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
 	 */
69 69
 	public static function get_instance() {
70 70
 		// If the single instance hasn't been set, set it now.
71
-		if ( null === self::$instance ) {
71
+		if (null === self::$instance) {
72 72
 			self::$instance = new self();
73 73
 		}
74 74
 		return self::$instance;
@@ -95,57 +95,57 @@  discard block
 block discarded – undo
95 95
 	 */
96 96
 	public function order_menus() {
97 97
 		global $menu, $submenu;
98
-		if ( ! empty( $submenu ) ) {
98
+		if ( ! empty($submenu)) {
99 99
 			$parent_check = array(
100 100
 				'edit.php?post_type=plan',
101 101
 				'edit.php?post_type=workout',
102 102
 				'edit.php?post_type=meal',
103 103
 			);
104
-			foreach ( $submenu as $menu_id => $menu_values ) {
105
-				if ( in_array( $menu_id, $parent_check ) ) {
106
-					foreach ( $menu_values as $sub_menu_key => $sub_menu_values ) {
107
-						switch ( $sub_menu_values[0] ) {
104
+			foreach ($submenu as $menu_id => $menu_values) {
105
+				if (in_array($menu_id, $parent_check)) {
106
+					foreach ($menu_values as $sub_menu_key => $sub_menu_values) {
107
+						switch ($sub_menu_values[0]) {
108 108
 
109
-							case __( 'Add New', 'lsx-health-plan' ):
110
-								unset( $submenu[ $menu_id ][ $sub_menu_key ] );
109
+							case __('Add New', 'lsx-health-plan'):
110
+								unset($submenu[$menu_id][$sub_menu_key]);
111 111
 								break;
112 112
 
113
-							case __( 'All', 'lsx-health-plan' ):
113
+							case __('All', 'lsx-health-plan'):
114 114
 								$title = $sub_menu_values[0];
115 115
 								// Check and change the label.
116
-								switch ( $sub_menu_values[2] ) {
116
+								switch ($sub_menu_values[2]) {
117 117
 									case 'edit.php?post_type=meal':
118
-										$title = esc_attr__( 'Meals', 'lsx-health-plan' );
118
+										$title = esc_attr__('Meals', 'lsx-health-plan');
119 119
 										break;
120 120
 
121 121
 									case 'edit.php?post_type=recipe':
122
-										$title = esc_attr__( 'Recipes', 'lsx-health-plan' );
122
+										$title = esc_attr__('Recipes', 'lsx-health-plan');
123 123
 										break;
124 124
 
125 125
 									case 'edit.php?post_type=workout':
126
-										$title = esc_attr__( 'Workouts', 'lsx-health-plan' );
126
+										$title = esc_attr__('Workouts', 'lsx-health-plan');
127 127
 										break;
128 128
 
129 129
 									case 'edit.php?post_type=plan':
130
-										$title = esc_attr__( 'Plans', 'lsx-health-plan' );
130
+										$title = esc_attr__('Plans', 'lsx-health-plan');
131 131
 										break;
132 132
 
133 133
 									case 'edit.php?post_type=video':
134
-										$title = esc_attr__( 'Videos', 'lsx-health-plan' );
134
+										$title = esc_attr__('Videos', 'lsx-health-plan');
135 135
 										break;
136 136
 
137 137
 									case 'edit.php?post_type=exercise':
138
-										$title = esc_attr__( 'Exercises', 'lsx-health-plan' );
138
+										$title = esc_attr__('Exercises', 'lsx-health-plan');
139 139
 										break;
140 140
 
141 141
 									case 'edit.php?post_type=tip':
142
-										$title = esc_attr__( 'Tips', 'lsx-health-plan' );
142
+										$title = esc_attr__('Tips', 'lsx-health-plan');
143 143
 										break;
144 144
 
145 145
 									default:
146 146
 										break;
147 147
 								}
148
-								$submenu[ $menu_id ][ $sub_menu_key ][0] = $title; // @codingStandardsIgnoreLine
148
+								$submenu[$menu_id][$sub_menu_key][0] = $title; // @codingStandardsIgnoreLine
149 149
 								break;
150 150
 
151 151
 							default:
@@ -163,12 +163,12 @@  discard block
 block discarded – undo
163 163
 	 * @return void
164 164
 	 */
165 165
 	public function assets() {
166
-		wp_enqueue_script( 'media-upload' );
167
-		wp_enqueue_script( 'thickbox' );
168
-		wp_enqueue_style( 'thickbox' );
166
+		wp_enqueue_script('media-upload');
167
+		wp_enqueue_script('thickbox');
168
+		wp_enqueue_style('thickbox');
169 169
 
170
-		wp_enqueue_script( 'lsx-health-plan-admin', LSX_HEALTH_PLAN_URL . 'assets/js/lsx-health-plan-admin.min.js', array( 'jquery' ), LSX_HEALTH_PLAN_VER, true );
171
-		wp_enqueue_style( 'lsx-health-plan-admin', LSX_HEALTH_PLAN_URL . 'assets/css/lsx-health-plan-admin.css', array(), LSX_HEALTH_PLAN_VER );
170
+		wp_enqueue_script('lsx-health-plan-admin', LSX_HEALTH_PLAN_URL . 'assets/js/lsx-health-plan-admin.min.js', array('jquery'), LSX_HEALTH_PLAN_VER, true);
171
+		wp_enqueue_style('lsx-health-plan-admin', LSX_HEALTH_PLAN_URL . 'assets/css/lsx-health-plan-admin.css', array(), LSX_HEALTH_PLAN_VER);
172 172
 	}
173 173
 
174 174
 	/**
@@ -177,7 +177,7 @@  discard block
 block discarded – undo
177 177
 	 * @return void
178 178
 	 */
179 179
 	public function get_connections() {
180
-		return apply_filters( 'lsx_health_plan_connections', $this->connections );
180
+		return apply_filters('lsx_health_plan_connections', $this->connections);
181 181
 	}
182 182
 
183 183
 	/**
@@ -189,13 +189,13 @@  discard block
 block discarded – undo
189 189
 	 * @param [type] $cmb2
190 190
 	 * @return void
191 191
 	 */
192
-	public function save_previous_values( $value_to_save, $a, $args, $cmb2 ) {
193
-		if ( isset( $cmb2->data_to_save['ID'] ) ) {
192
+	public function save_previous_values($value_to_save, $a, $args, $cmb2) {
193
+		if (isset($cmb2->data_to_save['ID'])) {
194 194
 			$connections = $this->get_connections();
195
-			$post_type   = get_post_type( $cmb2->data_to_save['ID'] );
196
-			if ( isset( $connections[ $post_type ] ) && array_key_exists( $a['field_id'], $connections[ $post_type ] ) ) {
195
+			$post_type   = get_post_type($cmb2->data_to_save['ID']);
196
+			if (isset($connections[$post_type]) && array_key_exists($a['field_id'], $connections[$post_type])) {
197 197
 				// Get the previous values if the field, so we can run through them and remove the current ID from them later.
198
-				$this->previous_values = get_post_meta( $a['id'], $a['field_id'], true );
198
+				$this->previous_values = get_post_meta($a['id'], $a['field_id'], true);
199 199
 			}
200 200
 		}
201 201
 		return $value_to_save;
@@ -206,30 +206,30 @@  discard block
 block discarded – undo
206 206
 	 *
207 207
 	 * @return    void
208 208
 	 */
209
-	public function post_relations( $field_id, $updated, $action, $cmb2 ) {
209
+	public function post_relations($field_id, $updated, $action, $cmb2) {
210 210
 		// If the connections are empty then skip this function.
211 211
 		$connections = $this->get_connections();
212
-		if ( empty( $connections ) ) {
212
+		if (empty($connections)) {
213 213
 			return;
214 214
 		}
215 215
 
216 216
 		// If the field has been updated.
217
-		if ( isset( $cmb2->data_to_save['ID'] ) ) {
218
-			$post_type = get_post_type( $cmb2->data_to_save['ID'] );
219
-			if ( isset( $connections[ $post_type ] ) && array_key_exists( $field_id, $connections[ $post_type ] ) ) {
220
-				$saved_values = get_post_meta( $cmb2->data_to_save['ID'], $field_id, true );
217
+		if (isset($cmb2->data_to_save['ID'])) {
218
+			$post_type = get_post_type($cmb2->data_to_save['ID']);
219
+			if (isset($connections[$post_type]) && array_key_exists($field_id, $connections[$post_type])) {
220
+				$saved_values = get_post_meta($cmb2->data_to_save['ID'], $field_id, true);
221 221
 
222
-				if ( 'updated' === $action ) {
223
-					$this->add_connected_posts( $saved_values, $cmb2->data_to_save['ID'], $connections[ $post_type ][ $field_id ] );
222
+				if ('updated' === $action) {
223
+					$this->add_connected_posts($saved_values, $cmb2->data_to_save['ID'], $connections[$post_type][$field_id]);
224 224
 					// Check if any posts have been removed.
225
-					if ( count( $this->previous_values ) > count( $saved_values ) ) {
226
-						$posts_to_remove = array_diff( $this->previous_values, $saved_values );
227
-						if ( ! empty( $posts_to_remove ) ) {
228
-							$this->remove_connected_posts( $posts_to_remove, $cmb2->data_to_save['ID'], $connections[ $post_type ][ $field_id ] );
225
+					if (count($this->previous_values) > count($saved_values)) {
226
+						$posts_to_remove = array_diff($this->previous_values, $saved_values);
227
+						if ( ! empty($posts_to_remove)) {
228
+							$this->remove_connected_posts($posts_to_remove, $cmb2->data_to_save['ID'], $connections[$post_type][$field_id]);
229 229
 						}
230 230
 					}
231
-				} else if ( 'removed' === $action && ! empty( $this->previous_values ) ) {
232
-					$this->remove_connected_posts( $this->previous_values, $cmb2->data_to_save['ID'], $connections[ $post_type ][ $field_id ] );
231
+				} else if ('removed' === $action && ! empty($this->previous_values)) {
232
+					$this->remove_connected_posts($this->previous_values, $cmb2->data_to_save['ID'], $connections[$post_type][$field_id]);
233 233
 				}
234 234
 			}
235 235
 		}
@@ -243,26 +243,26 @@  discard block
 block discarded – undo
243 243
 	 * @param [type] $connected_key
244 244
 	 * @return void
245 245
 	 */
246
-	public function add_connected_posts( $values, $current_id, $connected_key ) {
247
-		foreach ( $values as $value ) {
248
-			$current_post_array = get_post_meta( $value, $connected_key, true );
246
+	public function add_connected_posts($values, $current_id, $connected_key) {
247
+		foreach ($values as $value) {
248
+			$current_post_array = get_post_meta($value, $connected_key, true);
249 249
 			$previous_values    = $current_post_array;
250 250
 
251
-			if ( ! empty( $current_post_array ) ) {
252
-				$current_post_array = array_map( 'strval', $current_post_array );
253
-				array_unique( $current_post_array );
251
+			if ( ! empty($current_post_array)) {
252
+				$current_post_array = array_map('strval', $current_post_array);
253
+				array_unique($current_post_array);
254 254
 			}
255 255
 
256 256
 			// If the current connected post has no saved connections then we create it.
257
-			if ( false === $current_post_array || empty( $current_post_array ) ) {
258
-				$current_post_array = array( $current_id );
259
-			} elseif ( ! in_array( (string) $current_id, $current_post_array, true ) ) {
257
+			if (false === $current_post_array || empty($current_post_array)) {
258
+				$current_post_array = array($current_id);
259
+			} elseif ( ! in_array((string) $current_id, $current_post_array, true)) {
260 260
 				$current_post_array[] = $current_id;
261 261
 			}
262 262
 
263 263
 			// Check if the values are empty, if not update them.
264
-			if ( ! empty( $current_post_array ) ) {
265
-				update_post_meta( $value, $connected_key, $current_post_array, $previous_values );
264
+			if ( ! empty($current_post_array)) {
265
+				update_post_meta($value, $connected_key, $current_post_array, $previous_values);
266 266
 			}
267 267
 		}
268 268
 	}
@@ -275,25 +275,25 @@  discard block
 block discarded – undo
275 275
 	 * @param [type] $connected_key
276 276
 	 * @return void
277 277
 	 */
278
-	public function remove_connected_posts( $values, $current_ID, $connected_key ) {
279
-		foreach ( $values as $value ) {
280
-			$current_post_array = get_post_meta( $value, $connected_key, true );
278
+	public function remove_connected_posts($values, $current_ID, $connected_key) {
279
+		foreach ($values as $value) {
280
+			$current_post_array = get_post_meta($value, $connected_key, true);
281 281
 			$new_array          = array();
282 282
 			// Loop through only if the current ID has been saved against the post.
283
-			if ( in_array( $current_ID, $current_post_array, false ) ) {
283
+			if (in_array($current_ID, $current_post_array, false)) {
284 284
 
285 285
 				// Loop through all the connected saved IDS.
286
-				foreach ( $current_post_array as $cpa ) {
287
-					if ( (int) $cpa !== (int) $current_ID ) {
286
+				foreach ($current_post_array as $cpa) {
287
+					if ((int) $cpa !== (int) $current_ID) {
288 288
 						$new_array[] = $cpa;
289 289
 					}
290 290
 				}
291
-				if ( ! empty( $new_array ) ) {
292
-					$new_array = array_unique( $new_array );
293
-					delete_post_meta( $value, $connected_key );
294
-					add_post_meta( $value, $connected_key, $new_array, true );
291
+				if ( ! empty($new_array)) {
292
+					$new_array = array_unique($new_array);
293
+					delete_post_meta($value, $connected_key);
294
+					add_post_meta($value, $connected_key, $new_array, true);
295 295
 				} else {
296
-					delete_post_meta( $value, $connected_key );
296
+					delete_post_meta($value, $connected_key);
297 297
 				}
298 298
 			}
299 299
 		}
@@ -305,13 +305,13 @@  discard block
 block discarded – undo
305 305
 	 * @param string $item_id
306 306
 	 * @return void
307 307
 	 */
308
-	public function delete_post_meta_connections( $item_id = '' ) {
309
-		if ( '' !== $item_id ) {
310
-			$post_type   = get_post_type( $item_id );
308
+	public function delete_post_meta_connections($item_id = '') {
309
+		if ('' !== $item_id) {
310
+			$post_type   = get_post_type($item_id);
311 311
 			$connections = $this->get_connections();
312
-			if ( isset( $connections[ $post_type ] ) && ! empty( $connections[ $post_type ] ) && is_array( $connections[ $post_type ] ) ) {
313
-				foreach ( $connections[ $post_type ] as $this_key => $connected_key ) {
314
-					$this->delete_connected_items( $item_id, $this_key, $connected_key );
312
+			if (isset($connections[$post_type]) && ! empty($connections[$post_type]) && is_array($connections[$post_type])) {
313
+				foreach ($connections[$post_type] as $this_key => $connected_key) {
314
+					$this->delete_connected_items($item_id, $this_key, $connected_key);
315 315
 				}
316 316
 			}
317 317
 		}
@@ -325,23 +325,23 @@  discard block
 block discarded – undo
325 325
 	 * @param string $connected_key
326 326
 	 * @return void
327 327
 	 */
328
-	public function delete_connected_items( $item_id = '', $this_key, $connected_key ) {
329
-		if ( '' !== $item_id ) {
330
-			$connected_items = get_post_meta( $item_id, $this_key, true );
331
-			if ( ! empty( $connected_items ) ) {
332
-				foreach ( $connected_items as $con_id ) {
328
+	public function delete_connected_items($item_id = '', $this_key, $connected_key) {
329
+		if ('' !== $item_id) {
330
+			$connected_items = get_post_meta($item_id, $this_key, true);
331
+			if ( ! empty($connected_items)) {
332
+				foreach ($connected_items as $con_id) {
333 333
 					// Get the connected item array from the connected item.
334
-					$their_connections = get_post_meta( $con_id, $connected_key, true );
335
-					if ( ! empty( $their_connections ) ) {
334
+					$their_connections = get_post_meta($con_id, $connected_key, true);
335
+					if ( ! empty($their_connections)) {
336 336
 						$new_connections = $their_connections;
337 337
 						// Run through the array and remove the post to be deleteds ID.
338
-						foreach ( $their_connections as $ckey => $cvalue ) {
339
-							if ( (int) $item_id === (int) $cvalue ) {
340
-								unset( $new_connections[ $ckey ] );
338
+						foreach ($their_connections as $ckey => $cvalue) {
339
+							if ((int) $item_id === (int) $cvalue) {
340
+								unset($new_connections[$ckey]);
341 341
 							}
342 342
 						}
343 343
 						// Now we save the field.
344
-						update_post_meta( $con_id, $connected_key, $new_connections, $their_connections );
344
+						update_post_meta($con_id, $connected_key, $new_connections, $their_connections);
345 345
 					}
346 346
 				}
347 347
 			}
Please login to merge, or discard this patch.
classes/class-post-type.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -37,20 +37,20 @@  discard block
 block discarded – undo
37 37
 	 */
38 38
 	public function __construct() {
39 39
 		$this->enable_post_types();
40
-		add_filter( 'lsx_health_plan_post_types', array( $this, 'enable_post_types' ) );
41
-		foreach ( $this->post_types as $index => $post_type ) {
42
-			$is_disabled = \lsx_health_plan\functions\get_option( $post_type . '_disabled', false );
40
+		add_filter('lsx_health_plan_post_types', array($this, 'enable_post_types'));
41
+		foreach ($this->post_types as $index => $post_type) {
42
+			$is_disabled = \lsx_health_plan\functions\get_option($post_type . '_disabled', false);
43 43
 			// Check if exercises is enabled, if so disable the videos.
44
-			if ( 'video' === $post_type && false !== \lsx_health_plan\functions\get_option( 'exercise_enabled', false ) ) {
44
+			if ('video' === $post_type && false !== \lsx_health_plan\functions\get_option('exercise_enabled', false)) {
45 45
 				$is_disabled = true;
46 46
 			}
47 47
 
48
-			if ( true === $is_disabled || 1 === $is_disabled || 'on' === $is_disabled ) {
49
-				unset( $this->post_types[ $index ] );
48
+			if (true === $is_disabled || 1 === $is_disabled || 'on' === $is_disabled) {
49
+				unset($this->post_types[$index]);
50 50
 			} else {
51 51
 				require_once LSX_HEALTH_PLAN_PATH . 'classes/post-types/class-' . $post_type . '.php';
52
-				$classname        = ucwords( $post_type );
53
-				$this->$post_type = call_user_func_array( '\\lsx_health_plan\classes\\' . $classname . '::get_instance', array() );
52
+				$classname        = ucwords($post_type);
53
+				$this->$post_type = call_user_func_array('\\lsx_health_plan\classes\\' . $classname . '::get_instance', array());
54 54
 			}
55 55
 		}
56 56
 	}
@@ -64,7 +64,7 @@  discard block
 block discarded – undo
64 64
 	 */
65 65
 	public static function get_instance() {
66 66
 		// If the single instance hasn't been set, set it now.
67
-		if ( null === self::$instance ) {
67
+		if (null === self::$instance) {
68 68
 			self::$instance = new self();
69 69
 		}
70 70
 		return self::$instance;
@@ -75,8 +75,8 @@  discard block
 block discarded – undo
75 75
 	 *
76 76
 	 * @return void
77 77
 	 */
78
-	public function enable_post_types( $post_types = array() ) {
79
-		$post_types       = array(
78
+	public function enable_post_types($post_types = array()) {
79
+		$post_types = array(
80 80
 			'plan',
81 81
 			'workout',
82 82
 			'meal',
Please login to merge, or discard this patch.
classes/class-setup.php 1 patch
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -26,8 +26,8 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 }
Please login to merge, or discard this patch.
lsx-health-plan.php 1 patch
Spacing   +42 added lines, -42 removed lines patch added patch discarded remove patch
@@ -12,13 +12,13 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
Please login to merge, or discard this patch.