Passed
Push — add/multiplan ( e46fc7...0a2963 )
by Warwick
04:26 queued 12s
created
classes/admin/class-settings-theme.php 1 patch
Indentation   +176 added lines, -176 removed lines patch added patch discarded remove patch
@@ -10,186 +10,186 @@  discard block
 block discarded – undo
10 10
  */
11 11
 class Settings_Theme {
12 12
 
13
-	/**
14
-	 * Holds class instance
15
-	 *
16
-	 * @since 1.0.0
17
-	 *
18
-	 * @var      object \lsx_health_plan\classes\admin\Settings_Theme()
19
-	 */
20
-	protected static $instance = null;
13
+     /**
14
+      * Holds class instance
15
+      *
16
+      * @since 1.0.0
17
+      *
18
+      * @var      object \lsx_health_plan\classes\admin\Settings_Theme()
19
+      */
20
+     protected static $instance = null;
21 21
 
22
-	/**
23
-	 * Will return true if this is the LSX Search settings page.
24
-	 *
25
-	 * @var array
26
-	 */
27
-	public $is_options_page = false;
22
+     /**
23
+      * Will return true if this is the LSX Search settings page.
24
+      *
25
+      * @var array
26
+      */
27
+     public $is_options_page = false;
28 28
 
29
-	/**
30
-	 * Holds the id and labels for the navigation.
31
-	 *
32
-	 * @var array
33
-	 */
34
-	public $navigation = array();
29
+     /**
30
+      * Holds the id and labels for the navigation.
31
+      *
32
+      * @var array
33
+      */
34
+     public $navigation = array();
35 35
 
36
-	/**
37
-	 * Contructor
38
-	 */
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 );
48
-	}
36
+     /**
37
+      * Contructor
38
+      */
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 );
48
+     }
49 49
 
50
-	/**
51
-	 * Return an instance of this class.
52
-	 *
53
-	 * @since 1.0.0
54
-	 *
55
-	 * @return    object \lsx_health_plan\classes\admin\Settings_Theme()    A single instance of this class.
56
-	 */
57
-	public static function get_instance() {
58
-		// If the single instance hasn't been set, set it now.
59
-		if ( null == self::$instance ) {
60
-			self::$instance = new self();
61
-		}
62
-		return self::$instance;
63
-	}
50
+     /**
51
+      * Return an instance of this class.
52
+      *
53
+      * @since 1.0.0
54
+      *
55
+      * @return    object \lsx_health_plan\classes\admin\Settings_Theme()    A single instance of this class.
56
+      */
57
+     public static function get_instance() {
58
+          // If the single instance hasn't been set, set it now.
59
+          if ( null == self::$instance ) {
60
+               self::$instance = new self();
61
+          }
62
+          return self::$instance;
63
+     }
64 64
 
65
-	/**
66
-	 * Disable CMB2 styles on front end forms.
67
-	 *
68
-	 * @return bool $enabled Whether to enable (enqueue) styles.
69
-	 */
70
-	public function disable_cmb2_styles( $enabled ) {
71
-		if ( is_admin() ) {
72
-			$current_screen = get_current_screen();
73
-			if ( is_object( $current_screen ) && 'plan_page_lsx_health_plan_options' === $current_screen->id ) {
74
-				$enabled = false;
75
-			}
76
-		}
77
-		return $enabled;
78
-	}
65
+     /**
66
+      * Disable CMB2 styles on front end forms.
67
+      *
68
+      * @return bool $enabled Whether to enable (enqueue) styles.
69
+      */
70
+     public function disable_cmb2_styles( $enabled ) {
71
+          if ( is_admin() ) {
72
+               $current_screen = get_current_screen();
73
+               if ( is_object( $current_screen ) && 'plan_page_lsx_health_plan_options' === $current_screen->id ) {
74
+                    $enabled = false;
75
+               }
76
+          }
77
+          return $enabled;
78
+     }
79 79
 
80
-	/**
81
-	 * Generates the tabbed navigation for the settings page.
82
-	 *
83
-	 * @param string $cmb_id
84
-	 * @param string $object_id
85
-	 * @param string $object_type
86
-	 * @param object $cmb2_obj
87
-	 * @return void
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 ) {
91
-			$this->navigation      = array();
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'];
97
-					}
98
-				}
99
-			}
100
-			$this->output_navigation();
101
-		}
102
-	}
80
+     /**
81
+      * Generates the tabbed navigation for the settings page.
82
+      *
83
+      * @param string $cmb_id
84
+      * @param string $object_id
85
+      * @param string $object_type
86
+      * @param object $cmb2_obj
87
+      * @return void
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 ) {
91
+               $this->navigation      = array();
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'];
97
+                         }
98
+                    }
99
+               }
100
+               $this->output_navigation();
101
+          }
102
+     }
103 103
 
104
-	/**
105
-	 * Outputs the WP style navigation for the Settings page.
106
-	 *
107
-	 * @return void
108
-	 */
109
-	public function output_navigation() {
110
-		if ( ! empty( $this->navigation ) ) {
111
-			?>
104
+     /**
105
+      * Outputs the WP style navigation for the Settings page.
106
+      *
107
+      * @return void
108
+      */
109
+     public function output_navigation() {
110
+          if ( ! empty( $this->navigation ) ) {
111
+               ?>
112 112
 			<div class="wp-filter hide-if-no-js">
113 113
 				<ul class="filter-links">
114 114
 					<?php
115
-					$first_tab    = true;
116
-					$total        = count( $this->navigation );
117
-					$count        = 0;
118
-					$separator    = ' |';
119
-					$selected_tab = '';
120
-					if ( isset( $_GET['cmb_tab'] ) && '' !== $_GET['cmb_tab'] ) {
121
-						$selected_tab  = sanitize_text_field( $_GET['cmb_tab'] );
122
-						$selected_tab  = 'settings_' . $selected_tab;
123
-					}
124
-					foreach ( $this->navigation as $key => $label ) {
125
-						$count++;
126
-						$current_css = '';
127
-						if ( ( true === $first_tab && '' === $selected_tab ) || $key === $selected_tab ) {
128
-							$first_tab   = false;
129
-							$current_css = 'current';
130
-						}
131
-						if ( $count === $total ) {
132
-							$separator = '';
133
-						}
134
-						?>
115
+                         $first_tab    = true;
116
+                         $total        = count( $this->navigation );
117
+                         $count        = 0;
118
+                         $separator    = ' |';
119
+                         $selected_tab = '';
120
+                         if ( isset( $_GET['cmb_tab'] ) && '' !== $_GET['cmb_tab'] ) {
121
+                              $selected_tab  = sanitize_text_field( $_GET['cmb_tab'] );
122
+                              $selected_tab  = 'settings_' . $selected_tab;
123
+                         }
124
+                         foreach ( $this->navigation as $key => $label ) {
125
+                              $count++;
126
+                              $current_css = '';
127
+                              if ( ( true === $first_tab && '' === $selected_tab ) || $key === $selected_tab ) {
128
+                                   $first_tab   = false;
129
+                                   $current_css = 'current';
130
+                              }
131
+                              if ( $count === $total ) {
132
+                                   $separator = '';
133
+                              }
134
+                              ?>
135 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
-					}
138
-					?>
137
+                         }
138
+                         ?>
139 139
 				</ul>
140 140
 			</div>
141 141
 			<?php
142
-		}
143
-	}
142
+          }
143
+     }
144 144
 
145
-	/**
146
-	 * Outputs the opening tab div.
147
-	 *
148
-	 * @param object $field CMB2_Field();
149
-	 * @return void
150
-	 */
151
-	public function output_tab_open_div( $field ) {
152
-		if ( true === $this->is_options_page && isset( $field->args['type'] ) && 'title' === $field->args['type'] ) {
153
-			?>
145
+     /**
146
+      * Outputs the opening tab div.
147
+      *
148
+      * @param object $field CMB2_Field();
149
+      * @return void
150
+      */
151
+     public function output_tab_open_div( $field ) {
152
+          if ( true === $this->is_options_page && isset( $field->args['type'] ) && 'title' === $field->args['type'] ) {
153
+               ?>
154 154
 			<div id="<?php echo esc_attr( $field->args['id'] ); ?>_tab" class="tab tab-nav hidden">
155 155
 			<?php
156
-		}
157
-	}
156
+          }
157
+     }
158 158
 
159
-	/**
160
-	 * Outputs the opening closing div.
161
-	 *
162
-	 * @param object $field CMB2_Field();
163
-	 * @return void
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'] ) {
167
-			?>
159
+     /**
160
+      * Outputs the opening closing div.
161
+      *
162
+      * @param object $field CMB2_Field();
163
+      * @return void
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'] ) {
167
+               ?>
168 168
 			</div>
169 169
 			<?php
170
-		}
171
-	}
170
+          }
171
+     }
172 172
 
173
-	public function cmb2_render_callback_for_tab_closing( $field, $escaped_value, $object_id, $object_type, $field_type_object ) {
174
-		return;
175
-	}
173
+     public function cmb2_render_callback_for_tab_closing( $field, $escaped_value, $object_id, $object_type, $field_type_object ) {
174
+          return;
175
+     }
176 176
 
177
-	public function cmb2_sanitize_tab_closing_callback( $override_value, $value ) {
178
-		return '';
179
-	}
177
+     public function cmb2_sanitize_tab_closing_callback( $override_value, $value ) {
178
+          return '';
179
+     }
180 180
 
181
-	/**
182
-	 * Outputs the Script for the tabbed navigation.
183
-	 *
184
-	 * @param string $cmb_id
185
-	 * @param string $object_id
186
-	 * @param string $object_type
187
-	 * @param object $cmb2_obj
188
-	 * @return void
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 ) {
192
-			?>
181
+     /**
182
+      * Outputs the Script for the tabbed navigation.
183
+      *
184
+      * @param string $cmb_id
185
+      * @param string $object_id
186
+      * @param string $object_type
187
+      * @param object $cmb2_obj
188
+      * @return void
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 ) {
192
+               ?>
193 193
 			<script>
194 194
 				var LSX_HP_CMB2 = Object.create( null );
195 195
 
@@ -261,25 +261,25 @@  discard block
 block discarded – undo
261 261
 				} )( jQuery, window, document );
262 262
 			</script>
263 263
 			<?php
264
-		}
265
-	}
264
+          }
265
+     }
266 266
 
267
-	/**
268
-	 * This will add the tab selection to the url.
269
-	 *
270
-	 * @param string $url
271
-	 * @return void
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 );
279
-			} else {
280
-				$url = remove_query_arg( 'cmb_tab', $url );
281
-			}
282
-		}
283
-		return $url;
284
-	}
267
+     /**
268
+      * This will add the tab selection to the url.
269
+      *
270
+      * @param string $url
271
+      * @return void
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 );
279
+               } else {
280
+                    $url = remove_query_arg( 'cmb_tab', $url );
281
+               }
282
+          }
283
+          return $url;
284
+     }
285 285
 }
Please login to merge, or discard this patch.
classes/admin/class-help-page.php 1 patch
Indentation   +119 added lines, -119 removed lines patch added patch discarded remove patch
@@ -12,125 +12,125 @@  discard block
 block discarded – undo
12 12
  */
13 13
 class Help_Page {
14 14
 
15
-	/**
16
-	 * Holds class instance
17
-	 *
18
-	 * @since 1.0.0
19
-	 *
20
-	 * @var      object \lsx_health_plan\classes\admin\Help_Page()
21
-	 */
22
-	protected static $instance = null;
23
-
24
-	/**
25
-	 * Option key, and option page slug
26
-	 *
27
-	 * @var string
28
-	 */
29
-	protected $screen_id = 'lsx_hp_help';
30
-
31
-	/**
32
-	 * Contructor
33
-	 */
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 );
40
-	}
41
-
42
-	/**
43
-	 * Return an instance of this class.
44
-	 *
45
-	 * @since 1.0.0
46
-	 *
47
-	 * @return    object \lsx_health_plan\classes\admin\Help_Page()    A single instance of this class.
48
-	 */
49
-	public static function get_instance() {
50
-		// If the single instance hasn't been set, set it now.
51
-		if ( null === self::$instance ) {
52
-			self::$instance = new self();
53
-		}
54
-		return self::$instance;
55
-	}
56
-
57
-
58
-
59
-	/**
60
-	 * Load hp_help screen css.
61
-	 *
62
-	 * @package    lsx
63
-	 * @subpackage hp-help-page
64
-	 *
65
-	 * @param string $hook_suffix the current page hook suffix.
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' );
71
-		}
72
-	}
73
-
74
-	/**
75
-	 * Creates the dashboard page.
76
-	 *
77
-	 * @package    lsx
78
-	 * @subpackage hp-help-page
79
-	 */
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' ) );
82
-	}
83
-
84
-
85
-	/**
86
-	 * The help screen.
87
-	 *
88
-	 * @package    lsx
89
-	 * @subpackage hp-help-page
90
-	 */
91
-	public function screen() {
92
-		require_once ABSPATH . 'wp-load.php';
93
-		require_once ABSPATH . 'wp-admin/admin.php';
94
-		require_once ABSPATH . 'wp-admin/admin-header.php';
95
-		?>
15
+     /**
16
+      * Holds class instance
17
+      *
18
+      * @since 1.0.0
19
+      *
20
+      * @var      object \lsx_health_plan\classes\admin\Help_Page()
21
+      */
22
+     protected static $instance = null;
23
+
24
+     /**
25
+      * Option key, and option page slug
26
+      *
27
+      * @var string
28
+      */
29
+     protected $screen_id = 'lsx_hp_help';
30
+
31
+     /**
32
+      * Contructor
33
+      */
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 );
40
+     }
41
+
42
+     /**
43
+      * Return an instance of this class.
44
+      *
45
+      * @since 1.0.0
46
+      *
47
+      * @return    object \lsx_health_plan\classes\admin\Help_Page()    A single instance of this class.
48
+      */
49
+     public static function get_instance() {
50
+          // If the single instance hasn't been set, set it now.
51
+          if ( null === self::$instance ) {
52
+               self::$instance = new self();
53
+          }
54
+          return self::$instance;
55
+     }
56
+
57
+
58
+
59
+     /**
60
+      * Load hp_help screen css.
61
+      *
62
+      * @package    lsx
63
+      * @subpackage hp-help-page
64
+      *
65
+      * @param string $hook_suffix the current page hook suffix.
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' );
71
+          }
72
+     }
73
+
74
+     /**
75
+      * Creates the dashboard page.
76
+      *
77
+      * @package    lsx
78
+      * @subpackage hp-help-page
79
+      */
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' ) );
82
+     }
83
+
84
+
85
+     /**
86
+      * The help screen.
87
+      *
88
+      * @package    lsx
89
+      * @subpackage hp-help-page
90
+      */
91
+     public function screen() {
92
+          require_once ABSPATH . 'wp-load.php';
93
+          require_once ABSPATH . 'wp-admin/admin.php';
94
+          require_once ABSPATH . 'wp-admin/admin-header.php';
95
+          ?>
96 96
 		<div class="wrap about-wrap">
97 97
 			<?php
98
-			/**
99
-			 * Functions hooked into lsx_hp_help action
100
-			 *
101
-			 * @hooked lsx_hp_help_header  - 10
102
-			 * @hooked lsx_hp_help_body - 20
103
-			 * @hooked lsx_hp_help_footer  - 30
104
-			 */
105
-			do_action( 'lsx_hp_help' );
106
-			?>
98
+               /**
99
+                * Functions hooked into lsx_hp_help action
100
+                *
101
+                * @hooked lsx_hp_help_header  - 10
102
+                * @hooked lsx_hp_help_body - 20
103
+                * @hooked lsx_hp_help_footer  - 30
104
+                */
105
+               do_action( 'lsx_hp_help' );
106
+               ?>
107 107
 		</div>
108 108
 		<?php
109
-	}
110
-
111
-	/**
112
-	 * Help screen intro.
113
-	 *
114
-	 * @package    lsx
115
-	 * @subpackage hp-help-page
116
-	 */
117
-	public function header() {
118
-		?>
109
+     }
110
+
111
+     /**
112
+      * Help screen intro.
113
+      *
114
+      * @package    lsx
115
+      * @subpackage hp-help-page
116
+      */
117
+     public function header() {
118
+          ?>
119 119
 		<div class="box enrich">
120 120
 			<h2><?php esc_html_e( 'Built to enrich your WordPress experience.', 'lsx-health-plan' ); ?></h2>
121 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
-	}
125
-
126
-	/**
127
-	 * Help screen body section.
128
-	 *
129
-	 * @package    lsx
130
-	 * @subpackage hp-help-page
131
-	 */
132
-	public function body() {
133
-		?>
124
+     }
125
+
126
+     /**
127
+      * Help screen body section.
128
+      *
129
+      * @package    lsx
130
+      * @subpackage hp-help-page
131
+      */
132
+     public function body() {
133
+          ?>
134 134
 		<div>
135 135
 			<ul>
136 136
 				<li>Getting started: Setup a new Health Plan site from scratch.</li>
@@ -153,15 +153,15 @@  discard block
 block discarded – undo
153 153
 			</ul>
154 154
 		</div>
155 155
 		<?php
156
-	}
156
+     }
157 157
 
158
-	/**
159
-	 * Help screen contribute section.
160
-	 *
161
-	 * @package    lsx
162
-	 * @subpackage hp-help-page
163
-	 */
164
-	public function footer() {
158
+     /**
159
+      * Help screen contribute section.
160
+      *
161
+      * @package    lsx
162
+      * @subpackage hp-help-page
163
+      */
164
+     public function footer() {
165 165
 
166
-	}
166
+     }
167 167
 }
Please login to merge, or discard this patch.
classes/class-scpo-engine.php 1 patch
Indentation   +431 added lines, -431 removed lines patch added patch discarded remove patch
@@ -4,194 +4,194 @@  discard block
 block discarded – undo
4 4
 
5 5
 class SCPO_Engine {
6 6
 
7
-	/**
8
-	 * Holds class instance
9
-	 *
10
-	 * @since 1.0.0
11
-	 *
12
-	 * @var      object \lsx_health_plan\classes\SCPO_Engine()
13
-	 */
14
-	protected static $instance = null;
15
-
16
-	/**
17
-	 * Return an instance of this class.
18
-	 *
19
-	 * @since 1.0.0
20
-	 *
21
-	 * @return    object \lsx_health_plan\classes\SCPO_Engine()    A single instance of this class.
22
-	 */
23
-	public static function get_instance() {
24
-		// If the single instance hasn't been set, set it now.
25
-		if ( null == self::$instance ) {
26
-			self::$instance = new self;
27
-		}
28
-		return self::$instance;
29
-	}
30
-
31
-	public function __construct() {
32
-		if ( ! get_option( 'lsx_to_scporder_install' ) ) {
33
-			$this->lsx_to_scporder_install();
34
-		}
35
-
36
-		add_action( 'admin_init', array( $this, 'refresh' ) );
37
-		add_action( 'admin_init', array( $this, 'load_script_css' ) );
38
-
39
-		add_action( 'wp_ajax_update-menu-order', array(
40
-			$this,
41
-			'update_menu_order',
42
-		) );
43
-		add_action( 'wp_ajax_update-menu-order-tags', array(
44
-			$this,
45
-			'update_menu_order_tags',
46
-		) );
47
-
48
-		add_action( 'pre_get_posts', array(
49
-			$this,
50
-			'lsx_to_scporder_pre_get_posts',
51
-		) );
52
-
53
-		add_filter( 'get_previous_post_where', array(
54
-			$this,
55
-			'lsx_to_scporder_previous_post_where',
56
-		) );
57
-		add_filter( 'get_previous_post_sort', array(
58
-			$this,
59
-			'lsx_to_scporder_previous_post_sort',
60
-		) );
61
-		add_filter( 'get_next_post_where', array(
62
-			$this,
63
-			'lsx_to_scporder_next_post_where',
64
-		) );
65
-		add_filter( 'get_next_post_sort', array(
66
-			$this,
67
-			'lsx_to_scporder_next_post_sort',
68
-		) );
69
-
70
-		add_filter( 'get_terms_orderby', array(
71
-			$this,
72
-			'lsx_to_scporder_get_terms_orderby',
73
-		), 10, 3 );
74
-		add_filter( 'wp_get_object_terms', array(
75
-			$this,
76
-			'lsx_to_scporder_get_object_terms',
77
-		), 10, 4 );
78
-		add_filter( 'get_terms', array(
79
-			$this,
80
-			'lsx_to_scporder_get_object_terms',
81
-		), 10, 4 );
82
-	}
83
-
84
-	public function lsx_to_scporder_install() {
85
-		global $wpdb;
86
-		$result = $wpdb->query( "DESCRIBE $wpdb->terms `lsx_to_term_order`" );
87
-
88
-		if ( ! $result ) {
89
-			$result = $wpdb->query( "ALTER TABLE $wpdb->terms ADD `lsx_to_term_order` INT(4) NULL DEFAULT '0'" );
90
-		}
91
-
92
-		update_option( 'lsx_to_scporder_install', 1 );
93
-	}
94
-
95
-	public function _check_load_script_css() {
96
-		$active = false;
97
-
98
-		$objects = $this->get_to_scporder_options_objects();
99
-		$tags    = $this->get_to_scporder_options_tags();
100
-
101
-		if ( empty( $objects ) && empty( $tags ) ) {
102
-			return false;
103
-		}
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' ) ) {
106
-			return false;
107
-		}
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
111
-				$active = true;
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
114
-				$active = true;
115
-			}
116
-		}
117
-
118
-		if ( ! empty( $tags ) ) {
119
-			if ( isset( $_GET['taxonomy'] ) && array_key_exists( sanitize_text_field( $_GET['taxonomy'] ), $tags ) ) {
120
-				$active = true;
121
-			}
122
-		}
123
-
124
-		return $active;
125
-	}
126
-
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 );
130
-
131
-			$scporderjs_params = array(
132
-				'ajax_url'   => admin_url( 'admin-ajax.php' ),
133
-				'ajax_nonce' => wp_create_nonce( 'scporder' ),
134
-			);
135
-
136
-			wp_localize_script( 'scporderjs', 'scporderjs_params', $scporderjs_params );
137
-
138
-			wp_enqueue_style( 'scporder', LSX_HEALTH_PLAN_URL . '/assets/css/scporder.css', array(), null );
139
-			wp_style_add_data( 'scporder', 'rtl', 'replace' );
140
-		}
141
-	}
142
-
143
-	public function refresh() {
144
-		global $wpdb;
145
-		$objects = $this->get_to_scporder_options_objects();
146
-		$tags    = $this->get_to_scporder_options_tags();
147
-
148
-		if ( ! empty( $objects ) ) {
149
-			foreach ( $objects as $object => $object_data ) {
150
-				$result = $wpdb->get_results( $wpdb->prepare( "
7
+     /**
8
+      * Holds class instance
9
+      *
10
+      * @since 1.0.0
11
+      *
12
+      * @var      object \lsx_health_plan\classes\SCPO_Engine()
13
+      */
14
+     protected static $instance = null;
15
+
16
+     /**
17
+      * Return an instance of this class.
18
+      *
19
+      * @since 1.0.0
20
+      *
21
+      * @return    object \lsx_health_plan\classes\SCPO_Engine()    A single instance of this class.
22
+      */
23
+     public static function get_instance() {
24
+          // If the single instance hasn't been set, set it now.
25
+          if ( null == self::$instance ) {
26
+               self::$instance = new self;
27
+          }
28
+          return self::$instance;
29
+     }
30
+
31
+     public function __construct() {
32
+          if ( ! get_option( 'lsx_to_scporder_install' ) ) {
33
+               $this->lsx_to_scporder_install();
34
+          }
35
+
36
+          add_action( 'admin_init', array( $this, 'refresh' ) );
37
+          add_action( 'admin_init', array( $this, 'load_script_css' ) );
38
+
39
+          add_action( 'wp_ajax_update-menu-order', array(
40
+               $this,
41
+               'update_menu_order',
42
+          ) );
43
+          add_action( 'wp_ajax_update-menu-order-tags', array(
44
+               $this,
45
+               'update_menu_order_tags',
46
+          ) );
47
+
48
+          add_action( 'pre_get_posts', array(
49
+               $this,
50
+               'lsx_to_scporder_pre_get_posts',
51
+          ) );
52
+
53
+          add_filter( 'get_previous_post_where', array(
54
+               $this,
55
+               'lsx_to_scporder_previous_post_where',
56
+          ) );
57
+          add_filter( 'get_previous_post_sort', array(
58
+               $this,
59
+               'lsx_to_scporder_previous_post_sort',
60
+          ) );
61
+          add_filter( 'get_next_post_where', array(
62
+               $this,
63
+               'lsx_to_scporder_next_post_where',
64
+          ) );
65
+          add_filter( 'get_next_post_sort', array(
66
+               $this,
67
+               'lsx_to_scporder_next_post_sort',
68
+          ) );
69
+
70
+          add_filter( 'get_terms_orderby', array(
71
+               $this,
72
+               'lsx_to_scporder_get_terms_orderby',
73
+          ), 10, 3 );
74
+          add_filter( 'wp_get_object_terms', array(
75
+               $this,
76
+               'lsx_to_scporder_get_object_terms',
77
+          ), 10, 4 );
78
+          add_filter( 'get_terms', array(
79
+               $this,
80
+               'lsx_to_scporder_get_object_terms',
81
+          ), 10, 4 );
82
+     }
83
+
84
+     public function lsx_to_scporder_install() {
85
+          global $wpdb;
86
+          $result = $wpdb->query( "DESCRIBE $wpdb->terms `lsx_to_term_order`" );
87
+
88
+          if ( ! $result ) {
89
+               $result = $wpdb->query( "ALTER TABLE $wpdb->terms ADD `lsx_to_term_order` INT(4) NULL DEFAULT '0'" );
90
+          }
91
+
92
+          update_option( 'lsx_to_scporder_install', 1 );
93
+     }
94
+
95
+     public function _check_load_script_css() {
96
+          $active = false;
97
+
98
+          $objects = $this->get_to_scporder_options_objects();
99
+          $tags    = $this->get_to_scporder_options_tags();
100
+
101
+          if ( empty( $objects ) && empty( $tags ) ) {
102
+               return false;
103
+          }
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' ) ) {
106
+               return false;
107
+          }
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
111
+                    $active = true;
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
114
+                    $active = true;
115
+               }
116
+          }
117
+
118
+          if ( ! empty( $tags ) ) {
119
+               if ( isset( $_GET['taxonomy'] ) && array_key_exists( sanitize_text_field( $_GET['taxonomy'] ), $tags ) ) {
120
+                    $active = true;
121
+               }
122
+          }
123
+
124
+          return $active;
125
+     }
126
+
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 );
130
+
131
+               $scporderjs_params = array(
132
+                    'ajax_url'   => admin_url( 'admin-ajax.php' ),
133
+                    'ajax_nonce' => wp_create_nonce( 'scporder' ),
134
+               );
135
+
136
+               wp_localize_script( 'scporderjs', 'scporderjs_params', $scporderjs_params );
137
+
138
+               wp_enqueue_style( 'scporder', LSX_HEALTH_PLAN_URL . '/assets/css/scporder.css', array(), null );
139
+               wp_style_add_data( 'scporder', 'rtl', 'replace' );
140
+          }
141
+     }
142
+
143
+     public function refresh() {
144
+          global $wpdb;
145
+          $objects = $this->get_to_scporder_options_objects();
146
+          $tags    = $this->get_to_scporder_options_tags();
147
+
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 154
 				", $object ) );
155 155
 
156
-				if ( 0 == $result[0]->cnt || $result[0]->cnt == $result[0]->max ) {
157
-					continue;
158
-				}
156
+                    if ( 0 == $result[0]->cnt || $result[0]->cnt == $result[0]->max ) {
157
+                         continue;
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 165
 				", $object ) );
166 166
 
167
-				foreach ( $results as $key => $result ) {
168
-					$wpdb->update(
169
-						$wpdb->posts,
170
-						array(
171
-							'menu_order' => $key + 1,
172
-						),
173
-						array(
174
-							'ID' => $result->ID,
175
-						)
176
-					);
177
-				}
178
-			}
179
-		}
180
-
181
-		if ( ! empty( $tags ) ) {
182
-			foreach ( $tags as $taxonomy => $taxonomy_data ) {
183
-				$result = $wpdb->get_results( $wpdb->prepare( "
167
+                    foreach ( $results as $key => $result ) {
168
+                         $wpdb->update(
169
+                              $wpdb->posts,
170
+                              array(
171
+                                   'menu_order' => $key + 1,
172
+                              ),
173
+                              array(
174
+                                   'ID' => $result->ID,
175
+                              )
176
+                         );
177
+                    }
178
+               }
179
+          }
180
+
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 188
 				", $taxonomy ) );
189 189
 
190
-				if ( 0 == $result[0]->cnt || $result[0]->cnt == $result[0]->max ) {
191
-					continue;
192
-				}
190
+                    if ( 0 == $result[0]->cnt || $result[0]->cnt == $result[0]->max ) {
191
+                         continue;
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 )
@@ -199,33 +199,33 @@  discard block
 block discarded – undo
199 199
 					ORDER BY lsx_to_term_order ASC
200 200
 				", $taxonomy ) );
201 201
 
202
-				foreach ( $results as $key => $result ) {
203
-					$wpdb->update(
204
-						$wpdb->terms,
205
-						array(
206
-							'lsx_to_term_order' => $key + 1,
207
-						),
208
-						array(
209
-							'term_id' => $result->term_id,
210
-						)
211
-					);
212
-				}
213
-			}
214
-		}
215
-	}
202
+                    foreach ( $results as $key => $result ) {
203
+                         $wpdb->update(
204
+                              $wpdb->terms,
205
+                              array(
206
+                                   'lsx_to_term_order' => $key + 1,
207
+                              ),
208
+                              array(
209
+                                   'term_id' => $result->term_id,
210
+                              )
211
+                         );
212
+                    }
213
+               }
214
+          }
215
+     }
216 216
 
217
-	public function update_menu_order() {
218
-		check_ajax_referer( 'scporder', 'security' );
217
+     public function update_menu_order() {
218
+          check_ajax_referer( 'scporder', 'security' );
219 219
 
220
-		global $wpdb;
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 ) ) {
225
-			return false;
226
-		}
224
+          if ( ! is_array( $data ) ) {
225
+               return false;
226
+          }
227 227
 
228
-		/*$id_arr = array();
228
+          /*$id_arr = array();
229 229
 
230 230
 		foreach ( $data as $key => $values ) {
231 231
 			foreach ( $values as $position => $id ) {
@@ -244,38 +244,38 @@  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 ) {
249
-				$wpdb->update(
250
-					$wpdb->posts,
251
-					array(
252
-						'menu_order' => $position,
253
-					),
254
-					array(
255
-						'ID' => intval( $id ),
256
-					)
257
-				);
258
-			}
259
-		}
260
-	}
261
-
262
-	public function update_menu_order_tags() {
263
-		check_ajax_referer( 'scporder', 'security' );
264
-
265
-		global $wpdb;
266
-
267
-		parse_str( sanitize_text_field( $_POST['order'] ), $data );
268
-
269
-		if ( ! is_array( $data ) ) {
270
-			return false;
271
-		}
272
-
273
-		/*$current_user = wp_get_current_user();
247
+          foreach ( $data as $key => $values ) {
248
+               foreach ( $values as $position => $id ) {
249
+                    $wpdb->update(
250
+                         $wpdb->posts,
251
+                         array(
252
+                              'menu_order' => $position,
253
+                         ),
254
+                         array(
255
+                              'ID' => intval( $id ),
256
+                         )
257
+                    );
258
+               }
259
+          }
260
+     }
261
+
262
+     public function update_menu_order_tags() {
263
+          check_ajax_referer( 'scporder', 'security' );
264
+
265
+          global $wpdb;
266
+
267
+          parse_str( sanitize_text_field( $_POST['order'] ), $data );
268
+
269
+          if ( ! is_array( $data ) ) {
270
+               return false;
271
+          }
272
+
273
+          /*$current_user = wp_get_current_user();
274 274
 		if ( false === $current_user || 'lightspeed' !== $current_user->data->user_login ) {
275 275
 			return false;
276 276
 		}*/
277 277
 
278
-		/*$id_arr = array();
278
+          /*$id_arr = array();
279 279
 
280 280
 		foreach ( $data as $key => $values ) {
281 281
 			foreach ( $values as $position => $id ) {
@@ -294,217 +294,217 @@  discard block
 block discarded – undo
294 294
 
295 295
 		sort( $menu_order_arr );*/
296 296
 
297
-		foreach ( $data as $key => $values ) {
298
-			$term_ids = array();
299
-			foreach ( $values as $position => $id ) {
300
-				$wpdb->update(
301
-					$wpdb->terms,
302
-					array(
303
-						'lsx_to_term_order' => $position + 1,
304
-					),
305
-					array(
306
-						'term_id' => intval( $id ),
307
-					)
308
-				);
309
-				$term_ids[] = intval( $id );
310
-			}
311
-			clean_term_cache( $term_ids );
312
-		}
313
-	}
314
-
315
-	public function lsx_to_scporder_previous_post_where( $where ) {
316
-		global $post;
317
-		$objects = $this->get_to_scporder_options_objects();
318
-
319
-		if ( empty( $objects ) ) {
320
-			return $where;
321
-		}
322
-
323
-		if ( isset( $post->post_type ) && array_key_exists( $post->post_type, $objects ) ) {
324
-			$current_menu_order = $post->menu_order;
325
-			$where              = "WHERE p.menu_order > '" . $current_menu_order . "' AND p.post_type = '" . $post->post_type . "' AND p.post_status = 'publish'";
326
-		}
327
-
328
-		return $where;
329
-	}
330
-
331
-	public function lsx_to_scporder_previous_post_sort( $orderby ) {
332
-		global $post;
333
-		$objects = $this->get_to_scporder_options_objects();
334
-
335
-		if ( empty( $objects ) ) {
336
-			return $orderby;
337
-		}
338
-
339
-		if ( isset( $post->post_type ) && array_key_exists( $post->post_type, $objects ) ) {
340
-			$orderby = 'ORDER BY p.menu_order ASC LIMIT 1';
341
-		}
342
-
343
-		return $orderby;
344
-	}
345
-
346
-	public function lsx_to_scporder_next_post_where( $where ) {
347
-		global $post;
348
-		$objects = $this->get_to_scporder_options_objects();
349
-
350
-		if ( empty( $objects ) ) {
351
-			return $where;
352
-		}
353
-
354
-		if ( isset( $post->post_type ) && array_key_exists( $post->post_type, $objects ) ) {
355
-			$current_menu_order = $post->menu_order;
356
-			$where              = "WHERE p.menu_order < '" . $current_menu_order . "' AND p.post_type = '" . $post->post_type . "' AND p.post_status = 'publish'";
357
-		}
358
-
359
-		return $where;
360
-	}
361
-
362
-	public function lsx_to_scporder_next_post_sort( $orderby ) {
363
-		global $post;
364
-		$objects = $this->get_to_scporder_options_objects();
365
-
366
-		if ( empty( $objects ) ) {
367
-			return $orderby;
368
-		}
369
-
370
-		if ( isset( $post->post_type ) && array_key_exists( $post->post_type, $objects ) ) {
371
-			$orderby = 'ORDER BY p.menu_order DESC LIMIT 1';
372
-		}
373
-
374
-		return $orderby;
375
-	}
376
-
377
-	public function lsx_to_scporder_pre_get_posts( $wp_query ) {
378
-		$objects = $this->get_to_scporder_options_objects();
379
-
380
-		if ( empty( $objects ) ) {
381
-			return false;
382
-		}
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' );
389
-				}
390
-			}
391
-		} else {
392
-			$active = false;
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 ) ) {
397
-						$active = true;
398
-					}
399
-				}
400
-			} else {
401
-				if ( array_key_exists( 'post', $objects ) ) {
402
-					$active = true;
403
-				}
404
-			}
405
-
406
-			if ( ! $active ) {
407
-				return false;
408
-			}
409
-
410
-			if ( isset( $wp_query->query['disabled_custom_post_order'] ) ) {
411
-				return false;
412
-			}
413
-
414
-			if ( isset( $wp_query->query['suppress_filters'] ) ) {
415
-				if ( $wp_query->get( 'orderby' ) == 'date' ) {
416
-					$wp_query->set( 'orderby', 'menu_order' );
417
-				}
418
-				if ( $wp_query->get( 'order' ) == 'DESC' ) {
419
-					$wp_query->set( 'order', 'ASC' );
420
-				}
421
-			} else {
422
-				if ( ! $wp_query->get( 'orderby' ) ) {
423
-					$wp_query->set( 'orderby', 'menu_order' );
424
-				}
425
-				if ( ! $wp_query->get( 'order' ) ) {
426
-					$wp_query->set( 'order', 'ASC' );
427
-				}
428
-			}
429
-		}
430
-	}
431
-
432
-	public function lsx_to_scporder_get_terms_orderby( $orderby, $args ) {
433
-
434
-		if ( is_admin() ) {
435
-			return $orderby;
436
-		}
437
-
438
-		if ( isset( $args['disabled_custom_post_order'] ) ) {
439
-			return $orderby;
440
-		}
441
-
442
-		$tags = $this->get_to_scporder_options_tags();
443
-
444
-		if ( ! isset( $args['taxonomy'] ) ) {
445
-			return $orderby;
446
-		}
447
-
448
-		$taxonomy = $args['taxonomy'];
449
-		if ( is_array( $taxonomy ) && count( $taxonomy ) == 1 ) {
450
-			$taxonomy = $taxonomy[0];
451
-		}
452
-		if ( ! is_array( $taxonomy ) && ! array_key_exists( $taxonomy, $tags ) ) {
453
-			return $orderby;
454
-		}
455
-
456
-		$orderby = 't.lsx_to_term_order';
457
-
458
-		return $orderby;
459
-	}
460
-
461
-	public function lsx_to_scporder_get_object_terms( $terms, $not_used, $args_1, $args_2 = null ) {
462
-		$tags = $this->get_to_scporder_options_tags();
463
-
464
-		if ( is_admin() && isset( $_GET['orderby'] ) ) {
465
-			return $terms;
466
-		}
467
-
468
-		$args = is_null( $args_2 ) || ! is_array( $args_2 ) ? $args_1 : $args_2;
469
-
470
-		if ( isset( $args['disabled_custom_post_order'] ) ) {
471
-			return $terms;
472
-		}
473
-
474
-		foreach ( $terms as $key => $term ) {
475
-			if ( is_object( $term ) && isset( $term->taxonomy ) ) {
476
-				$taxonomy = $term->taxonomy;
477
-				if ( ! array_key_exists( $taxonomy, $tags ) ) {
478
-					return $terms;
479
-				}
480
-			} else {
481
-				return $terms;
482
-			}
483
-		}
484
-		usort( $terms, array( $this, 'taxcmp' ) );
485
-		return $terms;
486
-	}
487
-
488
-	public function taxcmp( $a, $b ) {
489
-		if ( $a->lsx_to_term_order == $b->lsx_to_term_order ) {
490
-			return 0;
491
-		}
492
-		return ( $a->lsx_to_term_order < $b->lsx_to_term_order ) ? - 1 : 1;
493
-	}
494
-
495
-	public function get_to_scporder_options_objects() {
496
-		$ordering = array(
497
-			'plan' => 'plan',
498
-		);
499
-		return $ordering;
500
-	}
501
-
502
-	public function get_to_scporder_options_tags() {
503
-		$ordering = array(
504
-			'week' => 'week',
505
-			'recipe-type' => 'recipe-type',
506
-		);
507
-		return $ordering;
508
-	}
297
+          foreach ( $data as $key => $values ) {
298
+               $term_ids = array();
299
+               foreach ( $values as $position => $id ) {
300
+                    $wpdb->update(
301
+                         $wpdb->terms,
302
+                         array(
303
+                              'lsx_to_term_order' => $position + 1,
304
+                         ),
305
+                         array(
306
+                              'term_id' => intval( $id ),
307
+                         )
308
+                    );
309
+                    $term_ids[] = intval( $id );
310
+               }
311
+               clean_term_cache( $term_ids );
312
+          }
313
+     }
314
+
315
+     public function lsx_to_scporder_previous_post_where( $where ) {
316
+          global $post;
317
+          $objects = $this->get_to_scporder_options_objects();
318
+
319
+          if ( empty( $objects ) ) {
320
+               return $where;
321
+          }
322
+
323
+          if ( isset( $post->post_type ) && array_key_exists( $post->post_type, $objects ) ) {
324
+               $current_menu_order = $post->menu_order;
325
+               $where              = "WHERE p.menu_order > '" . $current_menu_order . "' AND p.post_type = '" . $post->post_type . "' AND p.post_status = 'publish'";
326
+          }
327
+
328
+          return $where;
329
+     }
330
+
331
+     public function lsx_to_scporder_previous_post_sort( $orderby ) {
332
+          global $post;
333
+          $objects = $this->get_to_scporder_options_objects();
334
+
335
+          if ( empty( $objects ) ) {
336
+               return $orderby;
337
+          }
338
+
339
+          if ( isset( $post->post_type ) && array_key_exists( $post->post_type, $objects ) ) {
340
+               $orderby = 'ORDER BY p.menu_order ASC LIMIT 1';
341
+          }
342
+
343
+          return $orderby;
344
+     }
345
+
346
+     public function lsx_to_scporder_next_post_where( $where ) {
347
+          global $post;
348
+          $objects = $this->get_to_scporder_options_objects();
349
+
350
+          if ( empty( $objects ) ) {
351
+               return $where;
352
+          }
353
+
354
+          if ( isset( $post->post_type ) && array_key_exists( $post->post_type, $objects ) ) {
355
+               $current_menu_order = $post->menu_order;
356
+               $where              = "WHERE p.menu_order < '" . $current_menu_order . "' AND p.post_type = '" . $post->post_type . "' AND p.post_status = 'publish'";
357
+          }
358
+
359
+          return $where;
360
+     }
361
+
362
+     public function lsx_to_scporder_next_post_sort( $orderby ) {
363
+          global $post;
364
+          $objects = $this->get_to_scporder_options_objects();
365
+
366
+          if ( empty( $objects ) ) {
367
+               return $orderby;
368
+          }
369
+
370
+          if ( isset( $post->post_type ) && array_key_exists( $post->post_type, $objects ) ) {
371
+               $orderby = 'ORDER BY p.menu_order DESC LIMIT 1';
372
+          }
373
+
374
+          return $orderby;
375
+     }
376
+
377
+     public function lsx_to_scporder_pre_get_posts( $wp_query ) {
378
+          $objects = $this->get_to_scporder_options_objects();
379
+
380
+          if ( empty( $objects ) ) {
381
+               return false;
382
+          }
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' );
389
+                    }
390
+               }
391
+          } else {
392
+               $active = false;
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 ) ) {
397
+                              $active = true;
398
+                         }
399
+                    }
400
+               } else {
401
+                    if ( array_key_exists( 'post', $objects ) ) {
402
+                         $active = true;
403
+                    }
404
+               }
405
+
406
+               if ( ! $active ) {
407
+                    return false;
408
+               }
409
+
410
+               if ( isset( $wp_query->query['disabled_custom_post_order'] ) ) {
411
+                    return false;
412
+               }
413
+
414
+               if ( isset( $wp_query->query['suppress_filters'] ) ) {
415
+                    if ( $wp_query->get( 'orderby' ) == 'date' ) {
416
+                         $wp_query->set( 'orderby', 'menu_order' );
417
+                    }
418
+                    if ( $wp_query->get( 'order' ) == 'DESC' ) {
419
+                         $wp_query->set( 'order', 'ASC' );
420
+                    }
421
+               } else {
422
+                    if ( ! $wp_query->get( 'orderby' ) ) {
423
+                         $wp_query->set( 'orderby', 'menu_order' );
424
+                    }
425
+                    if ( ! $wp_query->get( 'order' ) ) {
426
+                         $wp_query->set( 'order', 'ASC' );
427
+                    }
428
+               }
429
+          }
430
+     }
431
+
432
+     public function lsx_to_scporder_get_terms_orderby( $orderby, $args ) {
433
+
434
+          if ( is_admin() ) {
435
+               return $orderby;
436
+          }
437
+
438
+          if ( isset( $args['disabled_custom_post_order'] ) ) {
439
+               return $orderby;
440
+          }
441
+
442
+          $tags = $this->get_to_scporder_options_tags();
443
+
444
+          if ( ! isset( $args['taxonomy'] ) ) {
445
+               return $orderby;
446
+          }
447
+
448
+          $taxonomy = $args['taxonomy'];
449
+          if ( is_array( $taxonomy ) && count( $taxonomy ) == 1 ) {
450
+               $taxonomy = $taxonomy[0];
451
+          }
452
+          if ( ! is_array( $taxonomy ) && ! array_key_exists( $taxonomy, $tags ) ) {
453
+               return $orderby;
454
+          }
455
+
456
+          $orderby = 't.lsx_to_term_order';
457
+
458
+          return $orderby;
459
+     }
460
+
461
+     public function lsx_to_scporder_get_object_terms( $terms, $not_used, $args_1, $args_2 = null ) {
462
+          $tags = $this->get_to_scporder_options_tags();
463
+
464
+          if ( is_admin() && isset( $_GET['orderby'] ) ) {
465
+               return $terms;
466
+          }
467
+
468
+          $args = is_null( $args_2 ) || ! is_array( $args_2 ) ? $args_1 : $args_2;
469
+
470
+          if ( isset( $args['disabled_custom_post_order'] ) ) {
471
+               return $terms;
472
+          }
473
+
474
+          foreach ( $terms as $key => $term ) {
475
+               if ( is_object( $term ) && isset( $term->taxonomy ) ) {
476
+                    $taxonomy = $term->taxonomy;
477
+                    if ( ! array_key_exists( $taxonomy, $tags ) ) {
478
+                         return $terms;
479
+                    }
480
+               } else {
481
+                    return $terms;
482
+               }
483
+          }
484
+          usort( $terms, array( $this, 'taxcmp' ) );
485
+          return $terms;
486
+     }
487
+
488
+     public function taxcmp( $a, $b ) {
489
+          if ( $a->lsx_to_term_order == $b->lsx_to_term_order ) {
490
+               return 0;
491
+          }
492
+          return ( $a->lsx_to_term_order < $b->lsx_to_term_order ) ? - 1 : 1;
493
+     }
494
+
495
+     public function get_to_scporder_options_objects() {
496
+          $ordering = array(
497
+               'plan' => 'plan',
498
+          );
499
+          return $ordering;
500
+     }
501
+
502
+     public function get_to_scporder_options_tags() {
503
+          $ordering = array(
504
+               'week' => 'week',
505
+               'recipe-type' => 'recipe-type',
506
+          );
507
+          return $ordering;
508
+     }
509 509
 }
510 510
 
Please login to merge, or discard this patch.
classes/class-post-type.php 1 patch
Indentation   +73 added lines, -73 removed lines patch added patch discarded remove patch
@@ -9,83 +9,83 @@
 block discarded – undo
9 9
  */
10 10
 class Post_Type {
11 11
 
12
-	/**
13
-	 * Holds class instance
14
-	 *
15
-	 * @since 1.0.0
16
-	 *
17
-	 * @var      object \lsx_health_plan\classes\Post_Type()
18
-	 */
19
-	protected static $instance = null;
12
+     /**
13
+      * Holds class instance
14
+      *
15
+      * @since 1.0.0
16
+      *
17
+      * @var      object \lsx_health_plan\classes\Post_Type()
18
+      */
19
+     protected static $instance = null;
20 20
 
21
-	/**
22
-	 * The post types available
23
-	 *
24
-	 * @var array
25
-	 */
26
-	public $post_types = array();
21
+     /**
22
+      * The post types available
23
+      *
24
+      * @var array
25
+      */
26
+     public $post_types = array();
27 27
 
28
-	/**
29
-	 * The related post type connections
30
-	 *
31
-	 * @var array
32
-	 */
33
-	public $connections = array();
28
+     /**
29
+      * The related post type connections
30
+      *
31
+      * @var array
32
+      */
33
+     public $connections = array();
34 34
 
35
-	/**
36
-	 * Contructor
37
-	 */
38
-	public function __construct() {
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 );
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 ) ) {
45
-				$is_disabled = true;
46
-			}
35
+     /**
36
+      * Contructor
37
+      */
38
+     public function __construct() {
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 );
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 ) ) {
45
+                    $is_disabled = true;
46
+               }
47 47
 
48
-			if ( true === $is_disabled || 1 === $is_disabled || 'on' === $is_disabled ) {
49
-				unset( $this->post_types[ $index ] );
50
-			} else {
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() );
54
-			}
55
-		}
56
-	}
48
+               if ( true === $is_disabled || 1 === $is_disabled || 'on' === $is_disabled ) {
49
+                    unset( $this->post_types[ $index ] );
50
+               } else {
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() );
54
+               }
55
+          }
56
+     }
57 57
 
58
-	/**
59
-	 * Return an instance of this class.
60
-	 *
61
-	 * @since 1.0.0
62
-	 *
63
-	 * @return    object \lsx_health_plan\classes\Post_Type()    A single instance of this class.
64
-	 */
65
-	public static function get_instance() {
66
-		// If the single instance hasn't been set, set it now.
67
-		if ( null === self::$instance ) {
68
-			self::$instance = new self();
69
-		}
70
-		return self::$instance;
71
-	}
58
+     /**
59
+      * Return an instance of this class.
60
+      *
61
+      * @since 1.0.0
62
+      *
63
+      * @return    object \lsx_health_plan\classes\Post_Type()    A single instance of this class.
64
+      */
65
+     public static function get_instance() {
66
+          // If the single instance hasn't been set, set it now.
67
+          if ( null === self::$instance ) {
68
+               self::$instance = new self();
69
+          }
70
+          return self::$instance;
71
+     }
72 72
 
73
-	/**
74
-	 * Enable our post types
75
-	 *
76
-	 * @return void
77
-	 */
78
-	public function enable_post_types( $post_types = array() ) {
79
-		$post_types       = array(
80
-			'plan',
81
-			'workout',
82
-			'meal',
83
-			'recipe',
84
-			'tip',
85
-			'video',
86
-			'exercise',
87
-		);
88
-		$this->post_types = $post_types;
89
-		return $post_types;
90
-	}
73
+     /**
74
+      * Enable our post types
75
+      *
76
+      * @return void
77
+      */
78
+     public function enable_post_types( $post_types = array() ) {
79
+          $post_types       = array(
80
+               'plan',
81
+               'workout',
82
+               'meal',
83
+               'recipe',
84
+               'tip',
85
+               'video',
86
+               'exercise',
87
+          );
88
+          $this->post_types = $post_types;
89
+          return $post_types;
90
+     }
91 91
 }
Please login to merge, or discard this patch.
templates/page-template-my-plan.php 1 patch
Indentation   +31 added lines, -31 removed lines patch added patch discarded remove patch
@@ -32,37 +32,37 @@
 block discarded – undo
32 32
 
33 33
 					<div class="entry-content">
34 34
 						<?php
35
-						if ( function_exists( 'is_wc_endpoint_url' ) && is_wc_endpoint_url( 'edit-account' ) ) {
36
-							$classes = get_body_class();
37
-							if ( in_array( 'has-block-banner', $classes ) ) {
38
-								$blocks = parse_blocks( get_the_content() );
39
-								foreach ( $blocks as $block ) {
40
-									if ( 'lsx-blocks/lsx-banner-box' === $block['blockName'] ) {
41
-										echo wp_kses_post( $block['innerHTML'] );
42
-									}
43
-								}
44
-							} elseif ( in_array( 'has-block-cover', $classes ) ) {
45
-								$blocks = parse_blocks( get_the_content() );
46
-								foreach ( $blocks as $block ) {
47
-									//print( '<pre>' . print_r( $block, true ) . '</pre>' );
48
-									if ( 'core/cover' === $block['blockName'] ) {
49
-										echo wp_kses_post( render_block( $block ) );
50
-									}
51
-								}
52
-							} else {
53
-								$my_plan_string = esc_html__( 'My Plan', 'lsx-health-plan' );
54
-								echo wp_kses_post( '<div class="lsx-health-plan my-profile-block wp-block-cover alignfull"><div class="wp-block-cover__inner-container"><h2>' . $my_plan_string . '</h2></div></div>' );
55
-							}
56
-
57
-							$my_profile_string  = esc_html__( 'My Profile', 'lsx-health-plan' );
58
-							$my_profile_tagline = esc_html__( 'Update your details below', 'lsx-health-plan' );
59
-							echo do_shortcode( '<div id="edit-account-tab">[lsx_health_plan_my_profile_tabs]<div class="edit-account-section"><h2 class="title-lined">' . $my_profile_string . '</h2><p>' . $my_profile_tagline . '</p>[woocommerce_my_account]</div></div>' );
60
-						} else if ( function_exists( 'is_wc_endpoint_url' ) && is_wc_endpoint_url( 'lost-password' ) ) {
61
-							echo do_shortcode( '[woocommerce_my_account]' );
62
-						} else {
63
-							the_content();
64
-						}
65
-						?>
35
+                              if ( function_exists( 'is_wc_endpoint_url' ) && is_wc_endpoint_url( 'edit-account' ) ) {
36
+                                   $classes = get_body_class();
37
+                                   if ( in_array( 'has-block-banner', $classes ) ) {
38
+                                        $blocks = parse_blocks( get_the_content() );
39
+                                        foreach ( $blocks as $block ) {
40
+                                             if ( 'lsx-blocks/lsx-banner-box' === $block['blockName'] ) {
41
+                                                  echo wp_kses_post( $block['innerHTML'] );
42
+                                             }
43
+                                        }
44
+                                   } elseif ( in_array( 'has-block-cover', $classes ) ) {
45
+                                        $blocks = parse_blocks( get_the_content() );
46
+                                        foreach ( $blocks as $block ) {
47
+                                             //print( '<pre>' . print_r( $block, true ) . '</pre>' );
48
+                                             if ( 'core/cover' === $block['blockName'] ) {
49
+                                                  echo wp_kses_post( render_block( $block ) );
50
+                                             }
51
+                                        }
52
+                                   } else {
53
+                                        $my_plan_string = esc_html__( 'My Plan', 'lsx-health-plan' );
54
+                                        echo wp_kses_post( '<div class="lsx-health-plan my-profile-block wp-block-cover alignfull"><div class="wp-block-cover__inner-container"><h2>' . $my_plan_string . '</h2></div></div>' );
55
+                                   }
56
+
57
+                                   $my_profile_string  = esc_html__( 'My Profile', 'lsx-health-plan' );
58
+                                   $my_profile_tagline = esc_html__( 'Update your details below', 'lsx-health-plan' );
59
+                                   echo do_shortcode( '<div id="edit-account-tab">[lsx_health_plan_my_profile_tabs]<div class="edit-account-section"><h2 class="title-lined">' . $my_profile_string . '</h2><p>' . $my_profile_tagline . '</p>[woocommerce_my_account]</div></div>' );
60
+                              } else if ( function_exists( 'is_wc_endpoint_url' ) && is_wc_endpoint_url( 'lost-password' ) ) {
61
+                                   echo do_shortcode( '[woocommerce_my_account]' );
62
+                              } else {
63
+                                   the_content();
64
+                              }
65
+                              ?>
66 66
 					</div><!-- .entry-content -->
67 67
 
68 68
 					<?php lsx_entry_bottom(); ?>
Please login to merge, or discard this patch.
templates/content-archive-plan.php 1 patch
Indentation   +77 added lines, -77 removed lines patch added patch discarded remove patch
@@ -18,51 +18,51 @@  discard block
 block discarded – undo
18 18
 $linked_product  = false;
19 19
 $restricted      = '';
20 20
 if ( \lsx_health_plan\functions\woocommerce\plan_has_products() ) {
21
-	$products       = \lsx_health_plan\functions\woocommerce\get_plan_products();
22
-	$linked_product = wc_get_product( $products[0] );
23
-	$product        = $linked_product;
21
+     $products       = \lsx_health_plan\functions\woocommerce\get_plan_products();
22
+     $linked_product = wc_get_product( $products[0] );
23
+     $product        = $linked_product;
24 24
 
25
-	if ( function_exists( 'wc_memberships_is_post_content_restricted' ) && wc_memberships_is_post_content_restricted( get_the_ID() ) ) {
26
-		$restricted = ! current_user_can( 'wc_memberships_view_restricted_post_content', get_the_ID() );
27
-	}
25
+     if ( function_exists( 'wc_memberships_is_post_content_restricted' ) && wc_memberships_is_post_content_restricted( get_the_ID() ) ) {
26
+          $restricted = ! current_user_can( 'wc_memberships_view_restricted_post_content', get_the_ID() );
27
+     }
28 28
 }
29 29
 
30 30
 // Check for shortcode overrides.
31 31
 if ( null !== $shortcode_args ) {
32
-	if ( isset( $shortcode_args['columns'] ) ) {
33
-		$column_class = $shortcode_args['columns'];
34
-		$column_class = \lsx_health_plan\functions\column_class( $column_class );
35
-	}
36
-	if ( isset( $shortcode_args['link'] ) ) {
37
-		$link_setting = $shortcode_args['link'];
38
-		// Setup our link and content.
39
-		switch ( $link_setting ) {
40
-			case 'single':
41
-				$link_html  = '<a href="' . get_permalink( $group['connected_plans'] ) . '">';
42
-				$link_close = '</a>';
43
-				break;
32
+     if ( isset( $shortcode_args['columns'] ) ) {
33
+          $column_class = $shortcode_args['columns'];
34
+          $column_class = \lsx_health_plan\functions\column_class( $column_class );
35
+     }
36
+     if ( isset( $shortcode_args['link'] ) ) {
37
+          $link_setting = $shortcode_args['link'];
38
+          // Setup our link and content.
39
+          switch ( $link_setting ) {
40
+               case 'single':
41
+                    $link_html  = '<a href="' . get_permalink( $group['connected_plans'] ) . '">';
42
+                    $link_close = '</a>';
43
+                    break;
44 44
 
45
-			case 'modal':
46
-				$link_html  = '<a data-toggle="modal" href="#workout-plan-modal-' . $group['connected_plans'] . '">';
47
-				$link_close = '</a>';
48
-				$modal_content_setting = \lsx_health_plan\functions\get_option( 'workout_tab_modal_content', 'excerpt' );
49
-				$modal_args = array(
50
-					'modal_content' => $modal_content_setting,
51
-				);
52
-				// We call the button to register the modal, but we do not output it.
53
-				lsx_health_plan_workout_plan_button( $group['connected_plans'], $group, false, $modal_args );
54
-				break;
45
+               case 'modal':
46
+                    $link_html  = '<a data-toggle="modal" href="#workout-plan-modal-' . $group['connected_plans'] . '">';
47
+                    $link_close = '</a>';
48
+                    $modal_content_setting = \lsx_health_plan\functions\get_option( 'workout_tab_modal_content', 'excerpt' );
49
+                    $modal_args = array(
50
+                         'modal_content' => $modal_content_setting,
51
+                    );
52
+                    // We call the button to register the modal, but we do not output it.
53
+                    lsx_health_plan_workout_plan_button( $group['connected_plans'], $group, false, $modal_args );
54
+                    break;
55 55
 
56
-			case 'none':
57
-			default:
58
-				$link_html  = '';
59
-				$link_close = '';
60
-				break;
61
-		}
62
-	}
63
-	if ( isset( $shortcode_args['description'] ) ) {
64
-		$content_setting = $shortcode_args['description'];
65
-	}
56
+               case 'none':
57
+               default:
58
+                    $link_html  = '';
59
+                    $link_close = '';
60
+                    break;
61
+          }
62
+     }
63
+     if ( isset( $shortcode_args['description'] ) ) {
64
+          $content_setting = $shortcode_args['description'];
65
+     }
66 66
 }
67 67
 
68 68
 $featured      = get_post_meta( get_the_ID(), 'plan_featured_plan', true );
@@ -78,60 +78,60 @@  discard block
 block discarded – undo
78 78
 			<?php } ?>
79 79
 			<a href="<?php echo esc_url( get_permalink() ); ?>">
80 80
 			<?php
81
-			$featured_image = get_the_post_thumbnail();
82
-			if ( ! empty( $featured_image ) && '' !== $featured_image ) {
83
-				the_post_thumbnail( 'lsx-thumbnail', array(
84
-					'class' => 'aligncenter',
85
-				) );
86
-			} else {
87
-				?>
81
+               $featured_image = get_the_post_thumbnail();
82
+               if ( ! empty( $featured_image ) && '' !== $featured_image ) {
83
+                    the_post_thumbnail( 'lsx-thumbnail', array(
84
+                         'class' => 'aligncenter',
85
+                    ) );
86
+               } else {
87
+                    ?>
88 88
 				<img loading="lazy" class="placeholder" src="<?php echo esc_attr( plugin_dir_url( __FILE__ ) . '../assets/images/placeholder.jpg' ); ?>">
89 89
 				<?php
90
-			}
91
-			?>
90
+               }
91
+               ?>
92 92
 			</a>
93 93
 		</div>
94 94
 		<div class="content-box plan-content-box white-bg">
95 95
 			<h3 class="plan id-<?php the_ID(); ?> <?php echo esc_attr( $completed_class ); ?>"><a href="<?php echo esc_url( get_permalink() ); ?>"><?php the_title(); ?></a></h3>
96 96
 			<?php
97
-				echo wp_kses_post( \lsx_health_plan\functions\hp_get_plan_type_meta( $post ) );
98
-			?>
97
+                    echo wp_kses_post( \lsx_health_plan\functions\hp_get_plan_type_meta( $post ) );
98
+               ?>
99 99
 			<?php
100
-			if ( false !== $linked_product ) {
101
-				echo wp_kses_post( $linked_product->get_price_html() );
102
-			}
103
-			?>
100
+               if ( false !== $linked_product ) {
101
+                    echo wp_kses_post( $linked_product->get_price_html() );
102
+               }
103
+               ?>
104 104
 			<div class="excerpt">
105 105
 				<?php
106
-				if ( ! has_excerpt() ) {
107
-					$content = wp_trim_words( get_the_content(), 20 );
108
-					$content = '<p>' . $content . '</p>';
109
-				} else {
110
-					$content = apply_filters( 'the_excerpt', get_the_excerpt() );
111
-				}
112
-				echo wp_kses_post( $content );
113
-				?>
106
+                    if ( ! has_excerpt() ) {
107
+                         $content = wp_trim_words( get_the_content(), 20 );
108
+                         $content = '<p>' . $content . '</p>';
109
+                    } else {
110
+                         $content = apply_filters( 'the_excerpt', get_the_excerpt() );
111
+                    }
112
+                    echo wp_kses_post( $content );
113
+                    ?>
114 114
 			</div>
115 115
 
116 116
 			<?php
117
-			$button_link  = get_permalink();
118
-			$button_text  = __( 'View', 'lsx-health-plan' );
119
-			$button_class = '';
117
+               $button_link  = get_permalink();
118
+               $button_text  = __( 'View', 'lsx-health-plan' );
119
+               $button_class = '';
120 120
 
121
-			if ( true === $restricted ) {
122
-				if ( 1 < count( $products ) ) {
123
-					$button_text = __( 'Select Options', 'lsx-health-plan' );
124
-				} else {
125
-					$button_link = $linked_product->add_to_cart_url() . '&plan_id=' . get_the_ID();
126
-					$button_text = $linked_product->add_to_cart_text();
127
-				}
128
-				?>
121
+               if ( true === $restricted ) {
122
+                    if ( 1 < count( $products ) ) {
123
+                         $button_text = __( 'Select Options', 'lsx-health-plan' );
124
+                    } else {
125
+                         $button_link = $linked_product->add_to_cart_url() . '&plan_id=' . get_the_ID();
126
+                         $button_text = $linked_product->add_to_cart_text();
127
+                    }
128
+                    ?>
129 129
 				<?php
130
-			} elseif ( false === $restricted ) {
131
-				$button_text  = __( 'Already Signed Up', 'lsx-health-plan' );
132
-				$button_class = 'btn-disabled';
133
-			}
134
-			?>
130
+               } elseif ( false === $restricted ) {
131
+                    $button_text  = __( 'Already Signed Up', 'lsx-health-plan' );
132
+                    $button_class = 'btn-disabled';
133
+               }
134
+               ?>
135 135
 			<a class="btn <?php echo esc_attr( $button_class ); ?>" href="<?php echo esc_attr( $button_link ); ?>"><?php echo esc_attr( $button_text ); ?></a>
136 136
 		</div>
137 137
 		<?php lsx_entry_bottom(); ?>
Please login to merge, or discard this patch.
templates/content-plan.php 1 patch
Indentation   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -22,15 +22,15 @@
 block discarded – undo
22 22
 	<div class="entry-content">
23 23
 		<div class="overview">
24 24
 		<?php
25
-			the_content();
26
-
27
-			wp_link_pages( array(
28
-				'before'      => '<div class="lsx-postnav-wrapper"><div class="lsx-postnav">',
29
-				'after'       => '</div></div>',
30
-				'link_before' => '<span>',
31
-				'link_after'  => '</span>',
32
-			) );
33
-		?>
25
+               the_content();
26
+
27
+               wp_link_pages( array(
28
+                    'before'      => '<div class="lsx-postnav-wrapper"><div class="lsx-postnav">',
29
+                    'after'       => '</div></div>',
30
+                    'link_before' => '<span>',
31
+                    'link_after'  => '</span>',
32
+               ) );
33
+          ?>
34 34
 		</div>
35 35
 	</div><!-- .entry-content -->
36 36
 	<?php if ( null === $shortcode_args ) { ?>
Please login to merge, or discard this patch.
templates/single-meal.php 1 patch
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -22,9 +22,9 @@
 block discarded – undo
22 22
 			<div class="post-wrapper">
23 23
 
24 24
 				<?php
25
-				while ( have_posts() ) :
26
-					the_post();
27
-				?>
25
+                    while ( have_posts() ) :
26
+                         the_post();
27
+                    ?>
28 28
 					<div class="meal-content">
29 29
 					<?php the_content(); ?>
30 30
 					</div>
Please login to merge, or discard this patch.
templates/tab-content-plan.php 1 patch
Indentation   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -8,10 +8,10 @@  discard block
 block discarded – undo
8 8
 $section_key  = get_query_var( 'section' );
9 9
 $endpoint_key = get_query_var( 'endpoint' );
10 10
 if ( '' !== $section_key && '' === $endpoint && \lsx_health_plan\functions\plan\has_sections() ) {
11
-	$section_info = \lsx_health_plan\functions\plan\get_section_info( $section_key );
12
-	if ( isset( $section_info['description'] ) && '' !== $section_info['description'] ) {
13
-		global $shortcode_args;
14
-		?>
11
+     $section_info = \lsx_health_plan\functions\plan\get_section_info( $section_key );
12
+     if ( isset( $section_info['description'] ) && '' !== $section_info['description'] ) {
13
+          global $shortcode_args;
14
+          ?>
15 15
 		<?php lsx_entry_before(); ?>
16 16
 
17 17
 		<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
@@ -25,15 +25,15 @@  discard block
 block discarded – undo
25 25
 			<div class="entry-content">
26 26
 				<div class="overview">
27 27
 				<?php
28
-					echo wp_kses_post( apply_filters( 'the_content', $section_info['description'] ) );
29
-
30
-					wp_link_pages( array(
31
-						'before'      => '<div class="lsx-postnav-wrapper"><div class="lsx-postnav">',
32
-						'after'       => '</div></div>',
33
-						'link_before' => '<span>',
34
-						'link_after'  => '</span>',
35
-					) );
36
-				?>
28
+                         echo wp_kses_post( apply_filters( 'the_content', $section_info['description'] ) );
29
+
30
+                         wp_link_pages( array(
31
+                              'before'      => '<div class="lsx-postnav-wrapper"><div class="lsx-postnav">',
32
+                              'after'       => '</div></div>',
33
+                              'link_before' => '<span>',
34
+                              'link_after'  => '</span>',
35
+                         ) );
36
+                    ?>
37 37
 				</div>
38 38
 			</div><!-- .entry-content -->
39 39
 			<?php if ( null === $shortcode_args ) { ?>
@@ -51,7 +51,7 @@  discard block
 block discarded – undo
51 51
 		</article><!-- #post-## -->
52 52
 
53 53
 		<?php
54
-		lsx_entry_after();
55
-	}
54
+          lsx_entry_after();
55
+     }
56 56
 }
57 57
 ?>
Please login to merge, or discard this patch.