@@ -12,257 +12,257 @@ |
||
| 12 | 12 | */ |
| 13 | 13 | class Settings { |
| 14 | 14 | |
| 15 | - /** |
|
| 16 | - * Holds class instance |
|
| 17 | - * |
|
| 18 | - * @since 1.0.0 |
|
| 19 | - * |
|
| 20 | - * @var object \lsx_health_plan\classes\admin\Settings() |
|
| 21 | - */ |
|
| 22 | - protected static $instance = null; |
|
| 15 | + /** |
|
| 16 | + * Holds class instance |
|
| 17 | + * |
|
| 18 | + * @since 1.0.0 |
|
| 19 | + * |
|
| 20 | + * @var object \lsx_health_plan\classes\admin\Settings() |
|
| 21 | + */ |
|
| 22 | + protected static $instance = null; |
|
| 23 | 23 | |
| 24 | - /** |
|
| 25 | - * Option key, and option page slug |
|
| 26 | - * |
|
| 27 | - * @var string |
|
| 28 | - */ |
|
| 29 | - protected $screen_id = 'lsx_health_plan_settings'; |
|
| 24 | + /** |
|
| 25 | + * Option key, and option page slug |
|
| 26 | + * |
|
| 27 | + * @var string |
|
| 28 | + */ |
|
| 29 | + protected $screen_id = 'lsx_health_plan_settings'; |
|
| 30 | 30 | |
| 31 | - /** |
|
| 32 | - * An array of the post types for the Global Downloads field. |
|
| 33 | - * |
|
| 34 | - * @var array |
|
| 35 | - */ |
|
| 36 | - public $download_types = array(); |
|
| 31 | + /** |
|
| 32 | + * An array of the post types for the Global Downloads field. |
|
| 33 | + * |
|
| 34 | + * @var array |
|
| 35 | + */ |
|
| 36 | + public $download_types = array(); |
|
| 37 | 37 | |
| 38 | - /** |
|
| 39 | - * An array of the post types for the Global Defaults field. |
|
| 40 | - * |
|
| 41 | - * @var array |
|
| 42 | - */ |
|
| 43 | - //public $default_types = array(); |
|
| 38 | + /** |
|
| 39 | + * An array of the post types for the Global Defaults field. |
|
| 40 | + * |
|
| 41 | + * @var array |
|
| 42 | + */ |
|
| 43 | + //public $default_types = array(); |
|
| 44 | 44 | |
| 45 | - /** |
|
| 46 | - * An array of the endpoints for the Endpoint Translation field. |
|
| 47 | - * |
|
| 48 | - * @var array |
|
| 49 | - */ |
|
| 50 | - public $endpoints = array(); |
|
| 45 | + /** |
|
| 46 | + * An array of the endpoints for the Endpoint Translation field. |
|
| 47 | + * |
|
| 48 | + * @var array |
|
| 49 | + */ |
|
| 50 | + public $endpoints = array(); |
|
| 51 | 51 | |
| 52 | - /** |
|
| 53 | - * Constructor |
|
| 54 | - */ |
|
| 55 | - public function __construct() { |
|
| 56 | - $this->load_classes(); |
|
| 57 | - add_action( 'cmb2_admin_init', array( $this, 'register_settings_page' ) ); |
|
| 58 | - add_action( 'lsx_hp_settings_page', array( $this, 'generate_tabs' ), 1, 1 ); |
|
| 52 | + /** |
|
| 53 | + * Constructor |
|
| 54 | + */ |
|
| 55 | + public function __construct() { |
|
| 56 | + $this->load_classes(); |
|
| 57 | + add_action( 'cmb2_admin_init', array( $this, 'register_settings_page' ) ); |
|
| 58 | + add_action( 'lsx_hp_settings_page', array( $this, 'generate_tabs' ), 1, 1 ); |
|
| 59 | 59 | |
| 60 | - add_action( 'lsx_hp_settings_page_general_top', array( $this, 'general_settings' ), 1, 1 ); |
|
| 61 | - } |
|
| 60 | + add_action( 'lsx_hp_settings_page_general_top', array( $this, 'general_settings' ), 1, 1 ); |
|
| 61 | + } |
|
| 62 | 62 | |
| 63 | - /** |
|
| 64 | - * Return an instance of this class. |
|
| 65 | - * |
|
| 66 | - * @since 1.0.0 |
|
| 67 | - * |
|
| 68 | - * @return object \lsx_health_plan\classes\admin\Settings() A single instance of this class. |
|
| 69 | - */ |
|
| 70 | - public static function get_instance() { |
|
| 71 | - // If the single instance hasn't been set, set it now. |
|
| 72 | - if ( null === self::$instance ) { |
|
| 73 | - self::$instance = new self(); |
|
| 74 | - } |
|
| 75 | - return self::$instance; |
|
| 76 | - } |
|
| 63 | + /** |
|
| 64 | + * Return an instance of this class. |
|
| 65 | + * |
|
| 66 | + * @since 1.0.0 |
|
| 67 | + * |
|
| 68 | + * @return object \lsx_health_plan\classes\admin\Settings() A single instance of this class. |
|
| 69 | + */ |
|
| 70 | + public static function get_instance() { |
|
| 71 | + // If the single instance hasn't been set, set it now. |
|
| 72 | + if ( null === self::$instance ) { |
|
| 73 | + self::$instance = new self(); |
|
| 74 | + } |
|
| 75 | + return self::$instance; |
|
| 76 | + } |
|
| 77 | 77 | |
| 78 | - /** |
|
| 79 | - * Loads the variable classes and the static classes. |
|
| 80 | - */ |
|
| 81 | - private function load_classes() { |
|
| 78 | + /** |
|
| 79 | + * Loads the variable classes and the static classes. |
|
| 80 | + */ |
|
| 81 | + private function load_classes() { |
|
| 82 | 82 | |
| 83 | - $this->post_types = array( |
|
| 84 | - 'my-plans', |
|
| 85 | - 'workout', |
|
| 86 | - 'exercise', |
|
| 87 | - 'meal', |
|
| 88 | - 'recipe', |
|
| 89 | - //'tip', |
|
| 90 | - 'recipe', |
|
| 91 | - ); |
|
| 83 | + $this->post_types = array( |
|
| 84 | + 'my-plans', |
|
| 85 | + 'workout', |
|
| 86 | + 'exercise', |
|
| 87 | + 'meal', |
|
| 88 | + 'recipe', |
|
| 89 | + //'tip', |
|
| 90 | + 'recipe', |
|
| 91 | + ); |
|
| 92 | 92 | |
| 93 | - foreach ( $this->post_types as $post_type ) { |
|
| 94 | - $this->$post_type = require_once LSX_HEALTH_PLAN_PATH . 'classes/admin/settings/class-' . $post_type . '.php'; |
|
| 95 | - } |
|
| 93 | + foreach ( $this->post_types as $post_type ) { |
|
| 94 | + $this->$post_type = require_once LSX_HEALTH_PLAN_PATH . 'classes/admin/settings/class-' . $post_type . '.php'; |
|
| 95 | + } |
|
| 96 | 96 | |
| 97 | - } |
|
| 97 | + } |
|
| 98 | 98 | |
| 99 | - /** |
|
| 100 | - * Hook in and register a submenu options page for the Page post-type menu. |
|
| 101 | - */ |
|
| 102 | - public function register_settings_page() { |
|
| 103 | - $cmb = new_cmb2_box( |
|
| 104 | - array( |
|
| 105 | - 'id' => $this->screen_id, |
|
| 106 | - 'title' => esc_html__( 'Settings', 'lsx-health-plan' ), |
|
| 107 | - 'object_types' => array( 'options-page' ), |
|
| 108 | - 'option_key' => 'lsx_health_plan_options', // The option key and admin menu page slug. |
|
| 109 | - 'parent_slug' => 'edit.php?post_type=plan', // Make options page a submenu item of the themes menu. |
|
| 110 | - 'capability' => 'manage_options', // Cap required to view options-page. |
|
| 111 | - ) |
|
| 112 | - ); |
|
| 113 | - do_action( 'lsx_hp_settings_page', $cmb ); |
|
| 114 | - } |
|
| 99 | + /** |
|
| 100 | + * Hook in and register a submenu options page for the Page post-type menu. |
|
| 101 | + */ |
|
| 102 | + public function register_settings_page() { |
|
| 103 | + $cmb = new_cmb2_box( |
|
| 104 | + array( |
|
| 105 | + 'id' => $this->screen_id, |
|
| 106 | + 'title' => esc_html__( 'Settings', 'lsx-health-plan' ), |
|
| 107 | + 'object_types' => array( 'options-page' ), |
|
| 108 | + 'option_key' => 'lsx_health_plan_options', // The option key and admin menu page slug. |
|
| 109 | + 'parent_slug' => 'edit.php?post_type=plan', // Make options page a submenu item of the themes menu. |
|
| 110 | + 'capability' => 'manage_options', // Cap required to view options-page. |
|
| 111 | + ) |
|
| 112 | + ); |
|
| 113 | + do_action( 'lsx_hp_settings_page', $cmb ); |
|
| 114 | + } |
|
| 115 | 115 | |
| 116 | - /** |
|
| 117 | - * Registers the general settings. |
|
| 118 | - * |
|
| 119 | - * @param object $cmb new_cmb2_box(). |
|
| 120 | - * @return void |
|
| 121 | - */ |
|
| 122 | - public function general_settings( $cmb ) { |
|
| 123 | - $cmb->add_field( |
|
| 124 | - array( |
|
| 125 | - 'name' => __( 'Exercises', 'lsx-health-plan' ), |
|
| 126 | - 'id' => 'exercise_enabled', |
|
| 127 | - 'type' => 'checkbox', |
|
| 128 | - 'value' => 1, |
|
| 129 | - 'default' => 0, |
|
| 130 | - 'description' => __( 'Enabling the exercise post type will automatically replace the Video post type.', 'lsx-health-plan' ), |
|
| 131 | - ) |
|
| 132 | - ); |
|
| 116 | + /** |
|
| 117 | + * Registers the general settings. |
|
| 118 | + * |
|
| 119 | + * @param object $cmb new_cmb2_box(). |
|
| 120 | + * @return void |
|
| 121 | + */ |
|
| 122 | + public function general_settings( $cmb ) { |
|
| 123 | + $cmb->add_field( |
|
| 124 | + array( |
|
| 125 | + 'name' => __( 'Exercises', 'lsx-health-plan' ), |
|
| 126 | + 'id' => 'exercise_enabled', |
|
| 127 | + 'type' => 'checkbox', |
|
| 128 | + 'value' => 1, |
|
| 129 | + 'default' => 0, |
|
| 130 | + 'description' => __( 'Enabling the exercise post type will automatically replace the Video post type.', 'lsx-health-plan' ), |
|
| 131 | + ) |
|
| 132 | + ); |
|
| 133 | 133 | |
| 134 | - $cmb->add_field( |
|
| 135 | - array( |
|
| 136 | - 'name' => __( 'Disable Workouts', 'lsx-health-plan' ), |
|
| 137 | - 'id' => 'workout_disabled', |
|
| 138 | - 'type' => 'checkbox', |
|
| 139 | - 'value' => 1, |
|
| 140 | - 'default' => 0, |
|
| 141 | - 'description' => __( 'Disable workout post type if you are wanting a minimal site.', 'lsx-health-plan' ), |
|
| 142 | - ) |
|
| 143 | - ); |
|
| 134 | + $cmb->add_field( |
|
| 135 | + array( |
|
| 136 | + 'name' => __( 'Disable Workouts', 'lsx-health-plan' ), |
|
| 137 | + 'id' => 'workout_disabled', |
|
| 138 | + 'type' => 'checkbox', |
|
| 139 | + 'value' => 1, |
|
| 140 | + 'default' => 0, |
|
| 141 | + 'description' => __( 'Disable workout post type if you are wanting a minimal site.', 'lsx-health-plan' ), |
|
| 142 | + ) |
|
| 143 | + ); |
|
| 144 | 144 | |
| 145 | - $cmb->add_field( |
|
| 146 | - array( |
|
| 147 | - 'name' => __( 'Disable Recipes', 'lsx-health-plan' ), |
|
| 148 | - 'id' => 'recipe_disabled', |
|
| 149 | - 'type' => 'checkbox', |
|
| 150 | - 'value' => 1, |
|
| 151 | - 'default' => 0, |
|
| 152 | - 'description' => __( 'Disable recipe post type if you are wanting a minimal site.', 'lsx-health-plan' ), |
|
| 153 | - ) |
|
| 154 | - ); |
|
| 145 | + $cmb->add_field( |
|
| 146 | + array( |
|
| 147 | + 'name' => __( 'Disable Recipes', 'lsx-health-plan' ), |
|
| 148 | + 'id' => 'recipe_disabled', |
|
| 149 | + 'type' => 'checkbox', |
|
| 150 | + 'value' => 1, |
|
| 151 | + 'default' => 0, |
|
| 152 | + 'description' => __( 'Disable recipe post type if you are wanting a minimal site.', 'lsx-health-plan' ), |
|
| 153 | + ) |
|
| 154 | + ); |
|
| 155 | 155 | |
| 156 | - $cmb->add_field( |
|
| 157 | - array( |
|
| 158 | - 'name' => __( 'Disable Meals', 'lsx-health-plan' ), |
|
| 159 | - 'id' => 'meal_disabled', |
|
| 160 | - 'type' => 'checkbox', |
|
| 161 | - 'value' => 1, |
|
| 162 | - 'default' => 0, |
|
| 163 | - 'description' => __( 'Disable meal post type if you are wanting a minimal site.', 'lsx-health-plan' ), |
|
| 164 | - ) |
|
| 165 | - ); |
|
| 156 | + $cmb->add_field( |
|
| 157 | + array( |
|
| 158 | + 'name' => __( 'Disable Meals', 'lsx-health-plan' ), |
|
| 159 | + 'id' => 'meal_disabled', |
|
| 160 | + 'type' => 'checkbox', |
|
| 161 | + 'value' => 1, |
|
| 162 | + 'default' => 0, |
|
| 163 | + 'description' => __( 'Disable meal post type if you are wanting a minimal site.', 'lsx-health-plan' ), |
|
| 164 | + ) |
|
| 165 | + ); |
|
| 166 | 166 | |
| 167 | 167 | |
| 168 | - $cmb->add_field( |
|
| 169 | - array( |
|
| 170 | - 'name' => __( 'Login Slug', 'lsx-health-plan' ), |
|
| 171 | - 'id' => 'login_slug', |
|
| 172 | - 'type' => 'input', |
|
| 173 | - 'value' => '', |
|
| 174 | - 'default' => 'login', |
|
| 175 | - 'after_row' => __( '<p style="font-style: italic;">If you have changed any URL slugs, please remember re-save your permalinks in Settings > Permalinks.</p>', 'lsx-health-plan' ), |
|
| 176 | - ) |
|
| 177 | - ); |
|
| 168 | + $cmb->add_field( |
|
| 169 | + array( |
|
| 170 | + 'name' => __( 'Login Slug', 'lsx-health-plan' ), |
|
| 171 | + 'id' => 'login_slug', |
|
| 172 | + 'type' => 'input', |
|
| 173 | + 'value' => '', |
|
| 174 | + 'default' => 'login', |
|
| 175 | + 'after_row' => __( '<p style="font-style: italic;">If you have changed any URL slugs, please remember re-save your permalinks in Settings > Permalinks.</p>', 'lsx-health-plan' ), |
|
| 176 | + ) |
|
| 177 | + ); |
|
| 178 | 178 | |
| 179 | - } |
|
| 179 | + } |
|
| 180 | 180 | |
| 181 | - /** |
|
| 182 | - * Enable Business Directory Search settings only if LSX Search plugin is enabled. |
|
| 183 | - * |
|
| 184 | - * @param object $cmb The CMB2() class. |
|
| 185 | - * @param string $section either engine,archive or single. |
|
| 186 | - * @return void |
|
| 187 | - */ |
|
| 188 | - public function generate_tabs( $cmb ) { |
|
| 189 | - $tabs = $this->get_settings_tabs(); |
|
| 181 | + /** |
|
| 182 | + * Enable Business Directory Search settings only if LSX Search plugin is enabled. |
|
| 183 | + * |
|
| 184 | + * @param object $cmb The CMB2() class. |
|
| 185 | + * @param string $section either engine,archive or single. |
|
| 186 | + * @return void |
|
| 187 | + */ |
|
| 188 | + public function generate_tabs( $cmb ) { |
|
| 189 | + $tabs = $this->get_settings_tabs(); |
|
| 190 | 190 | |
| 191 | - foreach ( $tabs as $tab_key => $tab ) { |
|
| 192 | - $cmb->add_field( |
|
| 193 | - array( |
|
| 194 | - 'id' => 'settings_' . $tab_key . '_title', |
|
| 195 | - 'type' => 'title', |
|
| 196 | - 'name' => $tab['title'], |
|
| 197 | - 'default' => $tab['title'], |
|
| 198 | - 'description' => $tab['desc'], |
|
| 199 | - ) |
|
| 200 | - ); |
|
| 201 | - do_action( 'lsx_hp_settings_page_' . $tab_key . '_top', $cmb ); |
|
| 191 | + foreach ( $tabs as $tab_key => $tab ) { |
|
| 192 | + $cmb->add_field( |
|
| 193 | + array( |
|
| 194 | + 'id' => 'settings_' . $tab_key . '_title', |
|
| 195 | + 'type' => 'title', |
|
| 196 | + 'name' => $tab['title'], |
|
| 197 | + 'default' => $tab['title'], |
|
| 198 | + 'description' => $tab['desc'], |
|
| 199 | + ) |
|
| 200 | + ); |
|
| 201 | + do_action( 'lsx_hp_settings_page_' . $tab_key . '_top', $cmb ); |
|
| 202 | 202 | |
| 203 | - do_action( 'lsx_hp_settings_page_' . $tab_key . '_middle', $cmb ); |
|
| 203 | + do_action( 'lsx_hp_settings_page_' . $tab_key . '_middle', $cmb ); |
|
| 204 | 204 | |
| 205 | - do_action( 'lsx_hp_settings_page_' . $tab_key . '_bottom', $cmb ); |
|
| 205 | + do_action( 'lsx_hp_settings_page_' . $tab_key . '_bottom', $cmb ); |
|
| 206 | 206 | |
| 207 | - $cmb->add_field( |
|
| 208 | - array( |
|
| 209 | - 'id' => 'settings_' . $tab_key . '_closing', |
|
| 210 | - 'type' => 'tab_closing', |
|
| 211 | - ) |
|
| 212 | - ); |
|
| 213 | - } |
|
| 214 | - } |
|
| 207 | + $cmb->add_field( |
|
| 208 | + array( |
|
| 209 | + 'id' => 'settings_' . $tab_key . '_closing', |
|
| 210 | + 'type' => 'tab_closing', |
|
| 211 | + ) |
|
| 212 | + ); |
|
| 213 | + } |
|
| 214 | + } |
|
| 215 | 215 | |
| 216 | 216 | |
| 217 | - /** |
|
| 218 | - * Returns the tabs and their descriptions. |
|
| 219 | - * |
|
| 220 | - * @return array |
|
| 221 | - */ |
|
| 222 | - public function get_settings_tabs() { |
|
| 223 | - $tabs = array( |
|
| 224 | - 'general' => array( |
|
| 225 | - 'title' => __( 'General', 'lsx-health-plan' ), |
|
| 226 | - 'desc' => __( 'Control the sitewide settings for the LSX HP site.', 'lsx-health-plan' ), |
|
| 227 | - ), |
|
| 228 | - ); |
|
| 217 | + /** |
|
| 218 | + * Returns the tabs and their descriptions. |
|
| 219 | + * |
|
| 220 | + * @return array |
|
| 221 | + */ |
|
| 222 | + public function get_settings_tabs() { |
|
| 223 | + $tabs = array( |
|
| 224 | + 'general' => array( |
|
| 225 | + 'title' => __( 'General', 'lsx-health-plan' ), |
|
| 226 | + 'desc' => __( 'Control the sitewide settings for the LSX HP site.', 'lsx-health-plan' ), |
|
| 227 | + ), |
|
| 228 | + ); |
|
| 229 | 229 | |
| 230 | - foreach ( $this->post_types as $post_type ) { |
|
| 231 | - switch ( $post_type ) { |
|
| 232 | - case 'my-plans': |
|
| 233 | - $page_url = get_post_type_archive_link( 'plan' ); |
|
| 234 | - $description = sprintf( |
|
| 235 | - /* translators: %s: The subscription info */ |
|
| 236 | - __( 'Control the settings for your <a target="_blank" href="%1$s">%2$s</a> pages.', 'lsx-search' ), |
|
| 237 | - $page_url, |
|
| 238 | - __( 'plan', 'lsx-health-plan' ) |
|
| 239 | - ); |
|
| 240 | - $tabs[ $post_type ] = array( |
|
| 241 | - 'title' => __( 'My Plans', 'lsx-health-plan' ), |
|
| 242 | - 'desc' => $description, |
|
| 243 | - ); |
|
| 244 | - break; |
|
| 245 | - default: |
|
| 246 | - //if ( ! in_array( $post_type, \lsx\search\includes\get_restricted_post_types() ) ) { |
|
| 247 | - $temp_post_type = get_post_type_object( $post_type ); |
|
| 248 | - if ( ! is_wp_error( $temp_post_type ) ) { |
|
| 249 | - $page_url = get_post_type_archive_link( $temp_post_type->name ); |
|
| 250 | - $description = sprintf( |
|
| 251 | - /* translators: %s: The subscription info */ |
|
| 252 | - __( 'Control the settings for your <a target="_blank" href="%1$s">%2$s</a> archive.', 'lsx-search' ), |
|
| 253 | - $page_url, |
|
| 254 | - $temp_post_type->label |
|
| 255 | - ); |
|
| 230 | + foreach ( $this->post_types as $post_type ) { |
|
| 231 | + switch ( $post_type ) { |
|
| 232 | + case 'my-plans': |
|
| 233 | + $page_url = get_post_type_archive_link( 'plan' ); |
|
| 234 | + $description = sprintf( |
|
| 235 | + /* translators: %s: The subscription info */ |
|
| 236 | + __( 'Control the settings for your <a target="_blank" href="%1$s">%2$s</a> pages.', 'lsx-search' ), |
|
| 237 | + $page_url, |
|
| 238 | + __( 'plan', 'lsx-health-plan' ) |
|
| 239 | + ); |
|
| 240 | + $tabs[ $post_type ] = array( |
|
| 241 | + 'title' => __( 'My Plans', 'lsx-health-plan' ), |
|
| 242 | + 'desc' => $description, |
|
| 243 | + ); |
|
| 244 | + break; |
|
| 245 | + default: |
|
| 246 | + //if ( ! in_array( $post_type, \lsx\search\includes\get_restricted_post_types() ) ) { |
|
| 247 | + $temp_post_type = get_post_type_object( $post_type ); |
|
| 248 | + if ( ! is_wp_error( $temp_post_type ) ) { |
|
| 249 | + $page_url = get_post_type_archive_link( $temp_post_type->name ); |
|
| 250 | + $description = sprintf( |
|
| 251 | + /* translators: %s: The subscription info */ |
|
| 252 | + __( 'Control the settings for your <a target="_blank" href="%1$s">%2$s</a> archive.', 'lsx-search' ), |
|
| 253 | + $page_url, |
|
| 254 | + $temp_post_type->label |
|
| 255 | + ); |
|
| 256 | 256 | |
| 257 | - $tabs[ $post_type ] = array( |
|
| 258 | - 'title' => $temp_post_type->label, |
|
| 259 | - 'desc' => $description, |
|
| 260 | - ); |
|
| 261 | - } |
|
| 262 | - //} |
|
| 263 | - break; |
|
| 264 | - } |
|
| 265 | - } |
|
| 266 | - return $tabs; |
|
| 267 | - } |
|
| 257 | + $tabs[ $post_type ] = array( |
|
| 258 | + 'title' => $temp_post_type->label, |
|
| 259 | + 'desc' => $description, |
|
| 260 | + ); |
|
| 261 | + } |
|
| 262 | + //} |
|
| 263 | + break; |
|
| 264 | + } |
|
| 265 | + } |
|
| 266 | + return $tabs; |
|
| 267 | + } |
|
| 268 | 268 | } |
@@ -12,146 +12,146 @@ |
||
| 12 | 12 | */ |
| 13 | 13 | class Meal { |
| 14 | 14 | |
| 15 | - /** |
|
| 16 | - * Holds class instance |
|
| 17 | - * |
|
| 18 | - * @since 1.0.0 |
|
| 19 | - * |
|
| 20 | - * @var object \lsx_health_plan\classes\admin\Meal() |
|
| 21 | - */ |
|
| 22 | - protected static $instance = null; |
|
| 15 | + /** |
|
| 16 | + * Holds class instance |
|
| 17 | + * |
|
| 18 | + * @since 1.0.0 |
|
| 19 | + * |
|
| 20 | + * @var object \lsx_health_plan\classes\admin\Meal() |
|
| 21 | + */ |
|
| 22 | + protected static $instance = null; |
|
| 23 | 23 | |
| 24 | - /** |
|
| 25 | - * Constructor |
|
| 26 | - */ |
|
| 27 | - public function __construct() { |
|
| 28 | - add_action( 'lsx_hp_settings_page_meal_top', array( $this, 'settings' ), 1, 1 ); |
|
| 29 | - } |
|
| 24 | + /** |
|
| 25 | + * Constructor |
|
| 26 | + */ |
|
| 27 | + public function __construct() { |
|
| 28 | + add_action( 'lsx_hp_settings_page_meal_top', array( $this, 'settings' ), 1, 1 ); |
|
| 29 | + } |
|
| 30 | 30 | |
| 31 | - /** |
|
| 32 | - * Return an instance of this class. |
|
| 33 | - * |
|
| 34 | - * @since 1.0.0 |
|
| 35 | - * |
|
| 36 | - * @return object \lsx_health_plan\classes\admin\Meal() A single instance of this class. |
|
| 37 | - */ |
|
| 38 | - public static function get_instance() { |
|
| 39 | - // If the single instance hasn't been set, set it now. |
|
| 40 | - if ( null === self::$instance ) { |
|
| 41 | - self::$instance = new self(); |
|
| 42 | - } |
|
| 43 | - return self::$instance; |
|
| 44 | - } |
|
| 31 | + /** |
|
| 32 | + * Return an instance of this class. |
|
| 33 | + * |
|
| 34 | + * @since 1.0.0 |
|
| 35 | + * |
|
| 36 | + * @return object \lsx_health_plan\classes\admin\Meal() A single instance of this class. |
|
| 37 | + */ |
|
| 38 | + public static function get_instance() { |
|
| 39 | + // If the single instance hasn't been set, set it now. |
|
| 40 | + if ( null === self::$instance ) { |
|
| 41 | + self::$instance = new self(); |
|
| 42 | + } |
|
| 43 | + return self::$instance; |
|
| 44 | + } |
|
| 45 | 45 | |
| 46 | - /** |
|
| 47 | - * Registers the general settings. |
|
| 48 | - * |
|
| 49 | - * @param object $cmb new_cmb2_box(). |
|
| 50 | - * @return void |
|
| 51 | - */ |
|
| 52 | - public function settings( $cmb ) { |
|
| 53 | - $cmb->add_field( |
|
| 54 | - array( |
|
| 55 | - 'name' => __( 'Disable Meals', 'lsx-health-plan' ), |
|
| 56 | - 'id' => 'meal_disabled', |
|
| 57 | - 'type' => 'checkbox', |
|
| 58 | - 'value' => 1, |
|
| 59 | - 'default' => 0, |
|
| 60 | - 'description' => __( 'Disable meal post type if you are wanting a minimal site.', 'lsx-health-plan' ), |
|
| 61 | - ) |
|
| 62 | - ); |
|
| 46 | + /** |
|
| 47 | + * Registers the general settings. |
|
| 48 | + * |
|
| 49 | + * @param object $cmb new_cmb2_box(). |
|
| 50 | + * @return void |
|
| 51 | + */ |
|
| 52 | + public function settings( $cmb ) { |
|
| 53 | + $cmb->add_field( |
|
| 54 | + array( |
|
| 55 | + 'name' => __( 'Disable Meals', 'lsx-health-plan' ), |
|
| 56 | + 'id' => 'meal_disabled', |
|
| 57 | + 'type' => 'checkbox', |
|
| 58 | + 'value' => 1, |
|
| 59 | + 'default' => 0, |
|
| 60 | + 'description' => __( 'Disable meal post type if you are wanting a minimal site.', 'lsx-health-plan' ), |
|
| 61 | + ) |
|
| 62 | + ); |
|
| 63 | 63 | |
| 64 | - $cmb->add_field( |
|
| 65 | - array( |
|
| 66 | - 'id' => 'meal_archive_description', |
|
| 67 | - 'type' => 'wysiwyg', |
|
| 68 | - 'name' => __( 'Archive Description', 'lsx-health-plan' ), |
|
| 69 | - 'description' => __( 'This will show up on the post type archive.', 'lsx-health-plan' ), |
|
| 70 | - 'options' => array( |
|
| 71 | - 'textarea_rows' => get_option('default_post_edit_rows', 6), |
|
| 72 | - ), |
|
| 73 | - ) |
|
| 74 | - ); |
|
| 64 | + $cmb->add_field( |
|
| 65 | + array( |
|
| 66 | + 'id' => 'meal_archive_description', |
|
| 67 | + 'type' => 'wysiwyg', |
|
| 68 | + 'name' => __( 'Archive Description', 'lsx-health-plan' ), |
|
| 69 | + 'description' => __( 'This will show up on the post type archive.', 'lsx-health-plan' ), |
|
| 70 | + 'options' => array( |
|
| 71 | + 'textarea_rows' => get_option('default_post_edit_rows', 6), |
|
| 72 | + ), |
|
| 73 | + ) |
|
| 74 | + ); |
|
| 75 | 75 | |
| 76 | - $cmb->add_field( |
|
| 77 | - array( |
|
| 78 | - 'name' => __( 'Your Meal Plan Intro', 'lsx-health-plan' ), |
|
| 79 | - 'id' => 'meal_plan_intro', |
|
| 80 | - 'type' => 'textarea_small', |
|
| 81 | - 'value' => '', |
|
| 82 | - 'default' => __( 'Get the right mix of nutrients to keep muscles strong & healthy.', 'lsx-health-plan' ), |
|
| 83 | - ) |
|
| 84 | - ); |
|
| 76 | + $cmb->add_field( |
|
| 77 | + array( |
|
| 78 | + 'name' => __( 'Your Meal Plan Intro', 'lsx-health-plan' ), |
|
| 79 | + 'id' => 'meal_plan_intro', |
|
| 80 | + 'type' => 'textarea_small', |
|
| 81 | + 'value' => '', |
|
| 82 | + 'default' => __( 'Get the right mix of nutrients to keep muscles strong & healthy.', 'lsx-health-plan' ), |
|
| 83 | + ) |
|
| 84 | + ); |
|
| 85 | 85 | |
| 86 | - $cmb->add_field( |
|
| 87 | - array( |
|
| 88 | - 'before_row' => '<h4><b><u>URL Slug Options</u></b></h4><p style="font-style: italic;">If you need to translate the custom slug for this custom post type, do so below.</p>', |
|
| 89 | - 'name' => __( 'Meal Slug', 'lsx-health-plan' ), |
|
| 90 | - 'id' => 'endpoint_meal', |
|
| 91 | - 'type' => 'input', |
|
| 92 | - 'value' => '', |
|
| 93 | - 'default' => 'meal', |
|
| 94 | - ) |
|
| 95 | - ); |
|
| 96 | - $cmb->add_field( |
|
| 97 | - array( |
|
| 98 | - 'name' => __( 'Meals Archive Slug', 'lsx-health-plan' ), |
|
| 99 | - 'id' => 'endpoint_meal_archive', |
|
| 100 | - 'type' => 'input', |
|
| 101 | - 'value' => '', |
|
| 102 | - 'default' => 'meals', |
|
| 103 | - ) |
|
| 104 | - ); |
|
| 105 | - $cmb->add_field( |
|
| 106 | - array( |
|
| 107 | - 'name' => __( 'Single Meal Slug', 'lsx-health-plan' ), |
|
| 108 | - 'id' => 'meal_single_slug', |
|
| 109 | - 'type' => 'input', |
|
| 110 | - 'value' => '', |
|
| 111 | - 'default' => 'meal', |
|
| 112 | - ) |
|
| 113 | - ); |
|
| 86 | + $cmb->add_field( |
|
| 87 | + array( |
|
| 88 | + 'before_row' => '<h4><b><u>URL Slug Options</u></b></h4><p style="font-style: italic;">If you need to translate the custom slug for this custom post type, do so below.</p>', |
|
| 89 | + 'name' => __( 'Meal Slug', 'lsx-health-plan' ), |
|
| 90 | + 'id' => 'endpoint_meal', |
|
| 91 | + 'type' => 'input', |
|
| 92 | + 'value' => '', |
|
| 93 | + 'default' => 'meal', |
|
| 94 | + ) |
|
| 95 | + ); |
|
| 96 | + $cmb->add_field( |
|
| 97 | + array( |
|
| 98 | + 'name' => __( 'Meals Archive Slug', 'lsx-health-plan' ), |
|
| 99 | + 'id' => 'endpoint_meal_archive', |
|
| 100 | + 'type' => 'input', |
|
| 101 | + 'value' => '', |
|
| 102 | + 'default' => 'meals', |
|
| 103 | + ) |
|
| 104 | + ); |
|
| 105 | + $cmb->add_field( |
|
| 106 | + array( |
|
| 107 | + 'name' => __( 'Single Meal Slug', 'lsx-health-plan' ), |
|
| 108 | + 'id' => 'meal_single_slug', |
|
| 109 | + 'type' => 'input', |
|
| 110 | + 'value' => '', |
|
| 111 | + 'default' => 'meal', |
|
| 112 | + ) |
|
| 113 | + ); |
|
| 114 | 114 | |
| 115 | - $cmb->add_field( |
|
| 116 | - array( |
|
| 117 | - 'before_row' => '<h4><b><u>Default Options</u></b></h4>', |
|
| 118 | - 'name' => __( 'Default Meal Plan', 'lsx-health-plan' ), |
|
| 119 | - 'description' => __( 'Set a default meal plan.', 'lsx-health-plan' ), |
|
| 120 | - 'limit' => 1, |
|
| 121 | - 'id' => 'connected_meals', |
|
| 122 | - 'type' => 'post_search_ajax', |
|
| 123 | - 'query_args' => array( |
|
| 124 | - 'post_type' => 'meal', |
|
| 125 | - 'post_status' => array( 'publish' ), |
|
| 126 | - 'posts_per_page' => -1, |
|
| 127 | - ), |
|
| 128 | - ) |
|
| 129 | - ); |
|
| 130 | - if ( function_exists( 'download_monitor' ) ) { |
|
| 131 | - $page_url = 'https://wordpress.org/plugins/download-monitor/'; |
|
| 132 | - $plugin_name = 'Download Monitor'; |
|
| 133 | - $description = sprintf( |
|
| 134 | - /* translators: %s: The subscription info */ |
|
| 135 | - __( 'If you are using <a target="_blank" href="%1$s">%2$s</a> you can set a default download file for your meal here.', 'lsx-search' ), |
|
| 136 | - $page_url, |
|
| 137 | - $plugin_name |
|
| 138 | - ); |
|
| 139 | - $cmb->add_field( |
|
| 140 | - array( |
|
| 141 | - 'name' => __( 'Default Meal Plan PDF', 'lsx-health-plan' ), |
|
| 142 | - 'description' => $description, |
|
| 143 | - 'id' => 'download_meal', |
|
| 144 | - 'type' => 'post_search_ajax', |
|
| 145 | - 'limit' => 1, |
|
| 146 | - 'query_args' => array( |
|
| 147 | - 'post_type' => array( 'dlm_download' ), |
|
| 148 | - 'post_status' => array( 'publish' ), |
|
| 149 | - 'posts_per_page' => -1, |
|
| 150 | - ), |
|
| 151 | - 'after_row' => __( '<p style="font-style: italic;">If you have changed any URL slugs, please remember re-save your permalinks in Settings > Permalinks.</p>', 'lsx-health-plan' ), |
|
| 152 | - ) |
|
| 153 | - ); |
|
| 154 | - } |
|
| 155 | - } |
|
| 115 | + $cmb->add_field( |
|
| 116 | + array( |
|
| 117 | + 'before_row' => '<h4><b><u>Default Options</u></b></h4>', |
|
| 118 | + 'name' => __( 'Default Meal Plan', 'lsx-health-plan' ), |
|
| 119 | + 'description' => __( 'Set a default meal plan.', 'lsx-health-plan' ), |
|
| 120 | + 'limit' => 1, |
|
| 121 | + 'id' => 'connected_meals', |
|
| 122 | + 'type' => 'post_search_ajax', |
|
| 123 | + 'query_args' => array( |
|
| 124 | + 'post_type' => 'meal', |
|
| 125 | + 'post_status' => array( 'publish' ), |
|
| 126 | + 'posts_per_page' => -1, |
|
| 127 | + ), |
|
| 128 | + ) |
|
| 129 | + ); |
|
| 130 | + if ( function_exists( 'download_monitor' ) ) { |
|
| 131 | + $page_url = 'https://wordpress.org/plugins/download-monitor/'; |
|
| 132 | + $plugin_name = 'Download Monitor'; |
|
| 133 | + $description = sprintf( |
|
| 134 | + /* translators: %s: The subscription info */ |
|
| 135 | + __( 'If you are using <a target="_blank" href="%1$s">%2$s</a> you can set a default download file for your meal here.', 'lsx-search' ), |
|
| 136 | + $page_url, |
|
| 137 | + $plugin_name |
|
| 138 | + ); |
|
| 139 | + $cmb->add_field( |
|
| 140 | + array( |
|
| 141 | + 'name' => __( 'Default Meal Plan PDF', 'lsx-health-plan' ), |
|
| 142 | + 'description' => $description, |
|
| 143 | + 'id' => 'download_meal', |
|
| 144 | + 'type' => 'post_search_ajax', |
|
| 145 | + 'limit' => 1, |
|
| 146 | + 'query_args' => array( |
|
| 147 | + 'post_type' => array( 'dlm_download' ), |
|
| 148 | + 'post_status' => array( 'publish' ), |
|
| 149 | + 'posts_per_page' => -1, |
|
| 150 | + ), |
|
| 151 | + 'after_row' => __( '<p style="font-style: italic;">If you have changed any URL slugs, please remember re-save your permalinks in Settings > Permalinks.</p>', 'lsx-health-plan' ), |
|
| 152 | + ) |
|
| 153 | + ); |
|
| 154 | + } |
|
| 155 | + } |
|
| 156 | 156 | } |
| 157 | 157 | Meal::get_instance(); |
@@ -12,167 +12,167 @@ |
||
| 12 | 12 | */ |
| 13 | 13 | class Plan { |
| 14 | 14 | |
| 15 | - /** |
|
| 16 | - * Holds class instance |
|
| 17 | - * |
|
| 18 | - * @since 1.0.0 |
|
| 19 | - * |
|
| 20 | - * @var object \lsx_health_plan\classes\admin\My_Plans() |
|
| 21 | - */ |
|
| 22 | - protected static $instance = null; |
|
| 15 | + /** |
|
| 16 | + * Holds class instance |
|
| 17 | + * |
|
| 18 | + * @since 1.0.0 |
|
| 19 | + * |
|
| 20 | + * @var object \lsx_health_plan\classes\admin\My_Plans() |
|
| 21 | + */ |
|
| 22 | + protected static $instance = null; |
|
| 23 | 23 | |
| 24 | - /** |
|
| 25 | - * Constructor |
|
| 26 | - */ |
|
| 27 | - public function __construct() { |
|
| 28 | - add_action( 'lsx_hp_settings_page_my-plans_top', array( $this, 'settings' ), 1, 1 ); |
|
| 29 | - } |
|
| 24 | + /** |
|
| 25 | + * Constructor |
|
| 26 | + */ |
|
| 27 | + public function __construct() { |
|
| 28 | + add_action( 'lsx_hp_settings_page_my-plans_top', array( $this, 'settings' ), 1, 1 ); |
|
| 29 | + } |
|
| 30 | 30 | |
| 31 | - /** |
|
| 32 | - * Return an instance of this class. |
|
| 33 | - * |
|
| 34 | - * @since 1.0.0 |
|
| 35 | - * |
|
| 36 | - * @return object \lsx_health_plan\classes\admin\My_Plans() A single instance of this class. |
|
| 37 | - */ |
|
| 38 | - public static function get_instance() { |
|
| 39 | - // If the single instance hasn't been set, set it now. |
|
| 40 | - if ( null === self::$instance ) { |
|
| 41 | - self::$instance = new self(); |
|
| 42 | - } |
|
| 43 | - return self::$instance; |
|
| 44 | - } |
|
| 31 | + /** |
|
| 32 | + * Return an instance of this class. |
|
| 33 | + * |
|
| 34 | + * @since 1.0.0 |
|
| 35 | + * |
|
| 36 | + * @return object \lsx_health_plan\classes\admin\My_Plans() A single instance of this class. |
|
| 37 | + */ |
|
| 38 | + public static function get_instance() { |
|
| 39 | + // If the single instance hasn't been set, set it now. |
|
| 40 | + if ( null === self::$instance ) { |
|
| 41 | + self::$instance = new self(); |
|
| 42 | + } |
|
| 43 | + return self::$instance; |
|
| 44 | + } |
|
| 45 | 45 | |
| 46 | - /** |
|
| 47 | - * Registers the general settings. |
|
| 48 | - * |
|
| 49 | - * @param object $cmb new_cmb2_box(). |
|
| 50 | - * @return void |
|
| 51 | - */ |
|
| 52 | - public function settings( $cmb ) { |
|
| 53 | - $cmb->add_field( |
|
| 54 | - array( |
|
| 55 | - 'name' => __( 'Plan Filters', 'lsx-health-plan' ), |
|
| 56 | - 'id' => 'plan_filters_disabled', |
|
| 57 | - 'type' => 'checkbox', |
|
| 58 | - 'value' => 1, |
|
| 59 | - 'default' => 0, |
|
| 60 | - 'description' => __( 'Toggle the display of the tab filters on the post type archive.', 'lsx-health-plan' ), |
|
| 61 | - ) |
|
| 62 | - ); |
|
| 46 | + /** |
|
| 47 | + * Registers the general settings. |
|
| 48 | + * |
|
| 49 | + * @param object $cmb new_cmb2_box(). |
|
| 50 | + * @return void |
|
| 51 | + */ |
|
| 52 | + public function settings( $cmb ) { |
|
| 53 | + $cmb->add_field( |
|
| 54 | + array( |
|
| 55 | + 'name' => __( 'Plan Filters', 'lsx-health-plan' ), |
|
| 56 | + 'id' => 'plan_filters_disabled', |
|
| 57 | + 'type' => 'checkbox', |
|
| 58 | + 'value' => 1, |
|
| 59 | + 'default' => 0, |
|
| 60 | + 'description' => __( 'Toggle the display of the tab filters on the post type archive.', 'lsx-health-plan' ), |
|
| 61 | + ) |
|
| 62 | + ); |
|
| 63 | 63 | |
| 64 | - $cmb->add_field( |
|
| 65 | - array( |
|
| 66 | - 'before_row' => '<h4><b><u>URL Slug Options</u></b></h4><p style="font-style: italic;">If you need to translate the custom slug for this custom post type, do so below.</p>', |
|
| 67 | - 'name' => __( 'My Plan Slug', 'lsx-health-plan' ), |
|
| 68 | - 'description' => __( 'This will be the slug url for redirecting users after login, use the login page slug.', 'lsx-health-plan' ), |
|
| 69 | - 'id' => 'my_plan_slug', |
|
| 70 | - 'type' => 'select', |
|
| 71 | - 'default' => 'my-plan', |
|
| 72 | - 'options' => $this->get_page_options(), |
|
| 73 | - ) |
|
| 74 | - ); |
|
| 64 | + $cmb->add_field( |
|
| 65 | + array( |
|
| 66 | + 'before_row' => '<h4><b><u>URL Slug Options</u></b></h4><p style="font-style: italic;">If you need to translate the custom slug for this custom post type, do so below.</p>', |
|
| 67 | + 'name' => __( 'My Plan Slug', 'lsx-health-plan' ), |
|
| 68 | + 'description' => __( 'This will be the slug url for redirecting users after login, use the login page slug.', 'lsx-health-plan' ), |
|
| 69 | + 'id' => 'my_plan_slug', |
|
| 70 | + 'type' => 'select', |
|
| 71 | + 'default' => 'my-plan', |
|
| 72 | + 'options' => $this->get_page_options(), |
|
| 73 | + ) |
|
| 74 | + ); |
|
| 75 | 75 | |
| 76 | - $cmb->add_field( |
|
| 77 | - array( |
|
| 78 | - 'before_row' => '<h4><b><u>Default Options</u></b></h4>', |
|
| 79 | - 'name' => __( 'Recipe', 'lsx-health-plan' ), |
|
| 80 | - 'description' => __( 'Set a default recipe.', 'lsx-health-plan' ), |
|
| 81 | - 'limit' => 1, |
|
| 82 | - 'id' => 'connected_recipes', |
|
| 83 | - 'type' => 'post_search_ajax', |
|
| 84 | - ) |
|
| 85 | - ); |
|
| 76 | + $cmb->add_field( |
|
| 77 | + array( |
|
| 78 | + 'before_row' => '<h4><b><u>Default Options</u></b></h4>', |
|
| 79 | + 'name' => __( 'Recipe', 'lsx-health-plan' ), |
|
| 80 | + 'description' => __( 'Set a default recipe.', 'lsx-health-plan' ), |
|
| 81 | + 'limit' => 1, |
|
| 82 | + 'id' => 'connected_recipes', |
|
| 83 | + 'type' => 'post_search_ajax', |
|
| 84 | + ) |
|
| 85 | + ); |
|
| 86 | 86 | |
| 87 | - $cmb->add_field( |
|
| 88 | - array( |
|
| 89 | - 'name' => __( 'Single Plan Slug', 'lsx-health-plan' ), |
|
| 90 | - 'id' => 'plan_single_slug', |
|
| 91 | - 'type' => 'input', |
|
| 92 | - 'value' => '', |
|
| 93 | - 'default' => 'plan', |
|
| 94 | - ) |
|
| 95 | - ); |
|
| 96 | - $cmb->add_field( |
|
| 97 | - array( |
|
| 98 | - 'name' => __( 'Plans Archive Slug', 'lsx-health-plan' ), |
|
| 99 | - 'id' => 'endpoint_plan_archive', |
|
| 100 | - 'type' => 'input', |
|
| 101 | - 'value' => '', |
|
| 102 | - 'default' => 'plans', |
|
| 103 | - ) |
|
| 104 | - ); |
|
| 87 | + $cmb->add_field( |
|
| 88 | + array( |
|
| 89 | + 'name' => __( 'Single Plan Slug', 'lsx-health-plan' ), |
|
| 90 | + 'id' => 'plan_single_slug', |
|
| 91 | + 'type' => 'input', |
|
| 92 | + 'value' => '', |
|
| 93 | + 'default' => 'plan', |
|
| 94 | + ) |
|
| 95 | + ); |
|
| 96 | + $cmb->add_field( |
|
| 97 | + array( |
|
| 98 | + 'name' => __( 'Plans Archive Slug', 'lsx-health-plan' ), |
|
| 99 | + 'id' => 'endpoint_plan_archive', |
|
| 100 | + 'type' => 'input', |
|
| 101 | + 'value' => '', |
|
| 102 | + 'default' => 'plans', |
|
| 103 | + ) |
|
| 104 | + ); |
|
| 105 | 105 | |
| 106 | - $cmb->add_field( |
|
| 107 | - array( |
|
| 108 | - 'before_row' => '<h4><b><u>My Stats Options</u></b></h4>', |
|
| 109 | - 'name' => __( 'Disable All Stats', 'lsx-health-plan' ), |
|
| 110 | - 'desc' => 'Disable All Stats', |
|
| 111 | - 'id' => 'disable_all_stats', |
|
| 112 | - 'type' => 'checkbox', |
|
| 113 | - 'value' => 1, |
|
| 114 | - 'default' => 0, |
|
| 115 | - ) |
|
| 116 | - ); |
|
| 117 | - $cmb->add_field( |
|
| 118 | - array( |
|
| 119 | - 'name' => __( 'Disable Weight', 'lsx-health-plan' ), |
|
| 120 | - 'id' => 'disable_weight_checkbox', |
|
| 121 | - 'type' => 'checkbox', |
|
| 122 | - 'value' => 1, |
|
| 123 | - 'default' => 0, |
|
| 124 | - ) |
|
| 125 | - ); |
|
| 126 | - $cmb->add_field( |
|
| 127 | - array( |
|
| 128 | - 'name' => __( 'Disable Height', 'lsx-health-plan' ), |
|
| 129 | - 'id' => 'disable_height_checkbox', |
|
| 130 | - 'type' => 'checkbox', |
|
| 131 | - 'value' => 1, |
|
| 132 | - 'default' => 0, |
|
| 133 | - ) |
|
| 134 | - ); |
|
| 135 | - $cmb->add_field( |
|
| 136 | - array( |
|
| 137 | - 'name' => __( 'Disable Waist', 'lsx-health-plan' ), |
|
| 138 | - 'id' => 'disable_waist_checkbox', |
|
| 139 | - 'type' => 'checkbox', |
|
| 140 | - 'value' => 1, |
|
| 141 | - 'default' => 0, |
|
| 142 | - ) |
|
| 143 | - ); |
|
| 144 | - $cmb->add_field( |
|
| 145 | - array( |
|
| 146 | - 'name' => __( 'Disable BMI', 'lsx-health-plan' ), |
|
| 147 | - 'id' => 'disable_bmi_checkbox', |
|
| 148 | - 'type' => 'checkbox', |
|
| 149 | - 'value' => 1, |
|
| 150 | - 'default' => 0, |
|
| 151 | - 'after_row' => __( '<p style="font-style: italic;">If you have changed any URL slugs, please remember re-save your permalinks in Settings > Permalinks.</p>', 'lsx-health-plan' ), |
|
| 152 | - ) |
|
| 153 | - ); |
|
| 154 | - } |
|
| 106 | + $cmb->add_field( |
|
| 107 | + array( |
|
| 108 | + 'before_row' => '<h4><b><u>My Stats Options</u></b></h4>', |
|
| 109 | + 'name' => __( 'Disable All Stats', 'lsx-health-plan' ), |
|
| 110 | + 'desc' => 'Disable All Stats', |
|
| 111 | + 'id' => 'disable_all_stats', |
|
| 112 | + 'type' => 'checkbox', |
|
| 113 | + 'value' => 1, |
|
| 114 | + 'default' => 0, |
|
| 115 | + ) |
|
| 116 | + ); |
|
| 117 | + $cmb->add_field( |
|
| 118 | + array( |
|
| 119 | + 'name' => __( 'Disable Weight', 'lsx-health-plan' ), |
|
| 120 | + 'id' => 'disable_weight_checkbox', |
|
| 121 | + 'type' => 'checkbox', |
|
| 122 | + 'value' => 1, |
|
| 123 | + 'default' => 0, |
|
| 124 | + ) |
|
| 125 | + ); |
|
| 126 | + $cmb->add_field( |
|
| 127 | + array( |
|
| 128 | + 'name' => __( 'Disable Height', 'lsx-health-plan' ), |
|
| 129 | + 'id' => 'disable_height_checkbox', |
|
| 130 | + 'type' => 'checkbox', |
|
| 131 | + 'value' => 1, |
|
| 132 | + 'default' => 0, |
|
| 133 | + ) |
|
| 134 | + ); |
|
| 135 | + $cmb->add_field( |
|
| 136 | + array( |
|
| 137 | + 'name' => __( 'Disable Waist', 'lsx-health-plan' ), |
|
| 138 | + 'id' => 'disable_waist_checkbox', |
|
| 139 | + 'type' => 'checkbox', |
|
| 140 | + 'value' => 1, |
|
| 141 | + 'default' => 0, |
|
| 142 | + ) |
|
| 143 | + ); |
|
| 144 | + $cmb->add_field( |
|
| 145 | + array( |
|
| 146 | + 'name' => __( 'Disable BMI', 'lsx-health-plan' ), |
|
| 147 | + 'id' => 'disable_bmi_checkbox', |
|
| 148 | + 'type' => 'checkbox', |
|
| 149 | + 'value' => 1, |
|
| 150 | + 'default' => 0, |
|
| 151 | + 'after_row' => __( '<p style="font-style: italic;">If you have changed any URL slugs, please remember re-save your permalinks in Settings > Permalinks.</p>', 'lsx-health-plan' ), |
|
| 152 | + ) |
|
| 153 | + ); |
|
| 154 | + } |
|
| 155 | 155 | |
| 156 | - public function get_page_options() { |
|
| 157 | - $query_args = array( |
|
| 158 | - 'post_type' => 'page', |
|
| 159 | - 'post_status' => array( 'publish' ), |
|
| 160 | - 'posts_per_page' => -1, |
|
| 161 | - 'orderby' => 'title', |
|
| 162 | - 'fields' => array( 'ids' ), |
|
| 163 | - ); |
|
| 164 | - $options = array( |
|
| 165 | - '' => __( 'Select a page', 'lsx-health-plan' ), |
|
| 166 | - ); |
|
| 167 | - $page_query = new \WP_Query( $query_args ); |
|
| 168 | - if ( $page_query->have_posts() ) { |
|
| 169 | - foreach ( $page_query->posts as $pid ) { |
|
| 170 | - $title = get_the_title( $pid ); |
|
| 171 | - $key = sanitize_title( $title ); |
|
| 172 | - $options[ $key ] = $title; |
|
| 173 | - } |
|
| 174 | - } |
|
| 175 | - return $options; |
|
| 176 | - } |
|
| 156 | + public function get_page_options() { |
|
| 157 | + $query_args = array( |
|
| 158 | + 'post_type' => 'page', |
|
| 159 | + 'post_status' => array( 'publish' ), |
|
| 160 | + 'posts_per_page' => -1, |
|
| 161 | + 'orderby' => 'title', |
|
| 162 | + 'fields' => array( 'ids' ), |
|
| 163 | + ); |
|
| 164 | + $options = array( |
|
| 165 | + '' => __( 'Select a page', 'lsx-health-plan' ), |
|
| 166 | + ); |
|
| 167 | + $page_query = new \WP_Query( $query_args ); |
|
| 168 | + if ( $page_query->have_posts() ) { |
|
| 169 | + foreach ( $page_query->posts as $pid ) { |
|
| 170 | + $title = get_the_title( $pid ); |
|
| 171 | + $key = sanitize_title( $title ); |
|
| 172 | + $options[ $key ] = $title; |
|
| 173 | + } |
|
| 174 | + } |
|
| 175 | + return $options; |
|
| 176 | + } |
|
| 177 | 177 | } |
| 178 | 178 | Plan::get_instance(); |
@@ -8,110 +8,110 @@ |
||
| 8 | 8 | */ |
| 9 | 9 | class Frontend { |
| 10 | 10 | |
| 11 | - /** |
|
| 12 | - * Holds class instance |
|
| 13 | - * |
|
| 14 | - * @since 1.0.0 |
|
| 15 | - * |
|
| 16 | - * @var object \lsx_health_plan\classes\Frontend() |
|
| 17 | - */ |
|
| 18 | - protected static $instance = null; |
|
| 19 | - |
|
| 20 | - /** |
|
| 21 | - * @var object \lsx_health_plan\classes\frontend\Endpoints(); |
|
| 22 | - */ |
|
| 23 | - public $endpoints; |
|
| 24 | - |
|
| 25 | - /** |
|
| 26 | - * @var object \lsx_health_plan\classes\frontend\Modals(); |
|
| 27 | - */ |
|
| 28 | - public $modals; |
|
| 29 | - |
|
| 30 | - /** |
|
| 31 | - * @var object \lsx_health_plan\classes\frontend\Gallery(); |
|
| 32 | - */ |
|
| 33 | - public $gallery; |
|
| 34 | - |
|
| 35 | - /** |
|
| 36 | - * @var object \lsx_health_plan\classes\frontend\Plan_Status(); |
|
| 37 | - */ |
|
| 38 | - public $plan_status; |
|
| 39 | - |
|
| 40 | - /** |
|
| 41 | - * @var object \lsx_health_plan\classes\frontend\Plan_Query(); |
|
| 42 | - */ |
|
| 43 | - public $plan_query; |
|
| 44 | - |
|
| 45 | - /** |
|
| 46 | - * @var object \lsx_health_plan\classes\frontend\General(); |
|
| 47 | - */ |
|
| 48 | - public $general; |
|
| 49 | - |
|
| 50 | - /** |
|
| 51 | - * @var object \lsx_health_plan\classes\frontend\Template_Redirects(); |
|
| 52 | - */ |
|
| 53 | - public $template_redirects; |
|
| 54 | - |
|
| 55 | - /** |
|
| 56 | - * Constructor |
|
| 57 | - */ |
|
| 58 | - public function __construct() { |
|
| 59 | - if ( ! is_admin() ) { |
|
| 60 | - $this->load_classes(); |
|
| 61 | - add_action( 'template_redirect', array( $this, 'redirect' ) ); |
|
| 11 | + /** |
|
| 12 | + * Holds class instance |
|
| 13 | + * |
|
| 14 | + * @since 1.0.0 |
|
| 15 | + * |
|
| 16 | + * @var object \lsx_health_plan\classes\Frontend() |
|
| 17 | + */ |
|
| 18 | + protected static $instance = null; |
|
| 19 | + |
|
| 20 | + /** |
|
| 21 | + * @var object \lsx_health_plan\classes\frontend\Endpoints(); |
|
| 22 | + */ |
|
| 23 | + public $endpoints; |
|
| 24 | + |
|
| 25 | + /** |
|
| 26 | + * @var object \lsx_health_plan\classes\frontend\Modals(); |
|
| 27 | + */ |
|
| 28 | + public $modals; |
|
| 29 | + |
|
| 30 | + /** |
|
| 31 | + * @var object \lsx_health_plan\classes\frontend\Gallery(); |
|
| 32 | + */ |
|
| 33 | + public $gallery; |
|
| 34 | + |
|
| 35 | + /** |
|
| 36 | + * @var object \lsx_health_plan\classes\frontend\Plan_Status(); |
|
| 37 | + */ |
|
| 38 | + public $plan_status; |
|
| 39 | + |
|
| 40 | + /** |
|
| 41 | + * @var object \lsx_health_plan\classes\frontend\Plan_Query(); |
|
| 42 | + */ |
|
| 43 | + public $plan_query; |
|
| 44 | + |
|
| 45 | + /** |
|
| 46 | + * @var object \lsx_health_plan\classes\frontend\General(); |
|
| 47 | + */ |
|
| 48 | + public $general; |
|
| 49 | + |
|
| 50 | + /** |
|
| 51 | + * @var object \lsx_health_plan\classes\frontend\Template_Redirects(); |
|
| 52 | + */ |
|
| 53 | + public $template_redirects; |
|
| 54 | + |
|
| 55 | + /** |
|
| 56 | + * Constructor |
|
| 57 | + */ |
|
| 58 | + public function __construct() { |
|
| 59 | + if ( ! is_admin() ) { |
|
| 60 | + $this->load_classes(); |
|
| 61 | + add_action( 'template_redirect', array( $this, 'redirect' ) ); |
|
| 62 | 62 | |
| 63 | - } |
|
| 64 | - } |
|
| 65 | - |
|
| 66 | - /** |
|
| 67 | - * Return an instance of this class. |
|
| 68 | - * |
|
| 69 | - * @since 1.0.0 |
|
| 70 | - * |
|
| 71 | - * @return object \lsx_health_plan\classes\Frontend() A single instance of this class. |
|
| 72 | - */ |
|
| 73 | - public static function get_instance() { |
|
| 74 | - // If the single instance hasn't been set, set it now. |
|
| 75 | - if ( null === self::$instance ) { |
|
| 76 | - self::$instance = new self(); |
|
| 77 | - } |
|
| 78 | - return self::$instance; |
|
| 79 | - } |
|
| 80 | - |
|
| 81 | - /** |
|
| 82 | - * Loads the variable classes and the static classes. |
|
| 83 | - */ |
|
| 84 | - private function load_classes() { |
|
| 85 | - require_once LSX_HEALTH_PLAN_PATH . 'classes/frontend/class-endpoints.php'; |
|
| 86 | - $this->endpoints = frontend\Endpoints::get_instance(); |
|
| 87 | - |
|
| 88 | - require_once LSX_HEALTH_PLAN_PATH . 'classes/frontend/class-modals.php'; |
|
| 89 | - $this->modals = Modals::get_instance(); |
|
| 90 | - |
|
| 91 | - require_once LSX_HEALTH_PLAN_PATH . 'classes/frontend/class-gallery.php'; |
|
| 92 | - $this->gallery = frontend\Gallery::get_instance(); |
|
| 93 | - |
|
| 94 | - require_once LSX_HEALTH_PLAN_PATH . 'classes/frontend/class-plan-status.php'; |
|
| 95 | - $this->plan_status = frontend\Plan_Status::get_instance(); |
|
| 96 | - |
|
| 97 | - require_once LSX_HEALTH_PLAN_PATH . 'classes/frontend/class-plan-query.php'; |
|
| 98 | - $this->plan_query = frontend\Plan_Query::get_instance(); |
|
| 99 | - |
|
| 100 | - require_once LSX_HEALTH_PLAN_PATH . 'classes/frontend/class-general.php'; |
|
| 101 | - $this->general = frontend\General::get_instance(); |
|
| 102 | - |
|
| 103 | - require_once LSX_HEALTH_PLAN_PATH . 'classes/frontend/class-template-redirects.php'; |
|
| 104 | - $this->template_redirects = frontend\Template_Redirects::get_instance(); |
|
| 105 | - } |
|
| 106 | - |
|
| 107 | - /** |
|
| 108 | - * Redirect the user from the cart or checkout page if they have purchased the product already. |
|
| 109 | - * |
|
| 110 | - * @return void |
|
| 111 | - */ |
|
| 112 | - public function redirect() { |
|
| 113 | - if ( ! is_user_logged_in() || ! function_exists( 'wc_get_page_id' ) || is_home() ) { |
|
| 114 | - return; |
|
| 115 | - } |
|
| 116 | - } |
|
| 63 | + } |
|
| 64 | + } |
|
| 65 | + |
|
| 66 | + /** |
|
| 67 | + * Return an instance of this class. |
|
| 68 | + * |
|
| 69 | + * @since 1.0.0 |
|
| 70 | + * |
|
| 71 | + * @return object \lsx_health_plan\classes\Frontend() A single instance of this class. |
|
| 72 | + */ |
|
| 73 | + public static function get_instance() { |
|
| 74 | + // If the single instance hasn't been set, set it now. |
|
| 75 | + if ( null === self::$instance ) { |
|
| 76 | + self::$instance = new self(); |
|
| 77 | + } |
|
| 78 | + return self::$instance; |
|
| 79 | + } |
|
| 80 | + |
|
| 81 | + /** |
|
| 82 | + * Loads the variable classes and the static classes. |
|
| 83 | + */ |
|
| 84 | + private function load_classes() { |
|
| 85 | + require_once LSX_HEALTH_PLAN_PATH . 'classes/frontend/class-endpoints.php'; |
|
| 86 | + $this->endpoints = frontend\Endpoints::get_instance(); |
|
| 87 | + |
|
| 88 | + require_once LSX_HEALTH_PLAN_PATH . 'classes/frontend/class-modals.php'; |
|
| 89 | + $this->modals = Modals::get_instance(); |
|
| 90 | + |
|
| 91 | + require_once LSX_HEALTH_PLAN_PATH . 'classes/frontend/class-gallery.php'; |
|
| 92 | + $this->gallery = frontend\Gallery::get_instance(); |
|
| 93 | + |
|
| 94 | + require_once LSX_HEALTH_PLAN_PATH . 'classes/frontend/class-plan-status.php'; |
|
| 95 | + $this->plan_status = frontend\Plan_Status::get_instance(); |
|
| 96 | + |
|
| 97 | + require_once LSX_HEALTH_PLAN_PATH . 'classes/frontend/class-plan-query.php'; |
|
| 98 | + $this->plan_query = frontend\Plan_Query::get_instance(); |
|
| 99 | + |
|
| 100 | + require_once LSX_HEALTH_PLAN_PATH . 'classes/frontend/class-general.php'; |
|
| 101 | + $this->general = frontend\General::get_instance(); |
|
| 102 | + |
|
| 103 | + require_once LSX_HEALTH_PLAN_PATH . 'classes/frontend/class-template-redirects.php'; |
|
| 104 | + $this->template_redirects = frontend\Template_Redirects::get_instance(); |
|
| 105 | + } |
|
| 106 | + |
|
| 107 | + /** |
|
| 108 | + * Redirect the user from the cart or checkout page if they have purchased the product already. |
|
| 109 | + * |
|
| 110 | + * @return void |
|
| 111 | + */ |
|
| 112 | + public function redirect() { |
|
| 113 | + if ( ! is_user_logged_in() || ! function_exists( 'wc_get_page_id' ) || is_home() ) { |
|
| 114 | + return; |
|
| 115 | + } |
|
| 116 | + } |
|
| 117 | 117 | } |
@@ -12,10 +12,10 @@ discard block |
||
| 12 | 12 | * @return boolean |
| 13 | 13 | */ |
| 14 | 14 | function lsx_health_plan_has_warmup( $post_id = '' ) { |
| 15 | - if ( '' === $post_id ) { |
|
| 16 | - $post_id = get_the_ID(); |
|
| 17 | - } |
|
| 18 | - return \lsx_health_plan\functions\has_attached_post( $post_id, 'plan_warmup' ); |
|
| 15 | + if ( '' === $post_id ) { |
|
| 16 | + $post_id = get_the_ID(); |
|
| 17 | + } |
|
| 18 | + return \lsx_health_plan\functions\has_attached_post( $post_id, 'plan_warmup' ); |
|
| 19 | 19 | } |
| 20 | 20 | |
| 21 | 21 | /** |
@@ -25,25 +25,25 @@ discard block |
||
| 25 | 25 | * @return boolean |
| 26 | 26 | */ |
| 27 | 27 | function lsx_health_plan_has_workout( $post_id = '' ) { |
| 28 | - if ( ! post_type_exists( 'workout' ) ) { |
|
| 29 | - return false; |
|
| 30 | - } |
|
| 31 | - if ( '' === $post_id ) { |
|
| 32 | - $post_id = get_the_ID(); |
|
| 33 | - } |
|
| 34 | - $has_workouts = false; |
|
| 35 | - |
|
| 36 | - $section_key = get_query_var( 'section', false ); |
|
| 37 | - if ( false !== $section_key ) { |
|
| 38 | - $section_info = \lsx_health_plan\functions\plan\get_section_info( $section_key ); |
|
| 39 | - if ( isset( $section_info['connected_workouts'] ) && ! empty( $section_info['connected_workouts'] ) ) { |
|
| 40 | - $has_workouts = true; |
|
| 41 | - } |
|
| 42 | - } elseif ( \lsx_health_plan\functions\has_attached_post( $post_id, 'connected_workouts' ) ) { |
|
| 43 | - $has_workouts = true; |
|
| 44 | - } |
|
| 45 | - |
|
| 46 | - return $has_workouts; |
|
| 28 | + if ( ! post_type_exists( 'workout' ) ) { |
|
| 29 | + return false; |
|
| 30 | + } |
|
| 31 | + if ( '' === $post_id ) { |
|
| 32 | + $post_id = get_the_ID(); |
|
| 33 | + } |
|
| 34 | + $has_workouts = false; |
|
| 35 | + |
|
| 36 | + $section_key = get_query_var( 'section', false ); |
|
| 37 | + if ( false !== $section_key ) { |
|
| 38 | + $section_info = \lsx_health_plan\functions\plan\get_section_info( $section_key ); |
|
| 39 | + if ( isset( $section_info['connected_workouts'] ) && ! empty( $section_info['connected_workouts'] ) ) { |
|
| 40 | + $has_workouts = true; |
|
| 41 | + } |
|
| 42 | + } elseif ( \lsx_health_plan\functions\has_attached_post( $post_id, 'connected_workouts' ) ) { |
|
| 43 | + $has_workouts = true; |
|
| 44 | + } |
|
| 45 | + |
|
| 46 | + return $has_workouts; |
|
| 47 | 47 | } |
| 48 | 48 | |
| 49 | 49 | /** |
@@ -53,14 +53,14 @@ discard block |
||
| 53 | 53 | * @return boolean |
| 54 | 54 | */ |
| 55 | 55 | function lsx_health_plan_has_meal( $post_id = '' ) { |
| 56 | - if ( ! post_type_exists( 'meal' ) ) { |
|
| 57 | - return false; |
|
| 58 | - } |
|
| 59 | - if ( '' === $post_id ) { |
|
| 60 | - $post_id = get_the_ID(); |
|
| 61 | - } |
|
| 62 | - |
|
| 63 | - return \lsx_health_plan\functions\has_attached_post( $post_id, 'connected_meals' ); |
|
| 56 | + if ( ! post_type_exists( 'meal' ) ) { |
|
| 57 | + return false; |
|
| 58 | + } |
|
| 59 | + if ( '' === $post_id ) { |
|
| 60 | + $post_id = get_the_ID(); |
|
| 61 | + } |
|
| 62 | + |
|
| 63 | + return \lsx_health_plan\functions\has_attached_post( $post_id, 'connected_meals' ); |
|
| 64 | 64 | } |
| 65 | 65 | |
| 66 | 66 | /** |
@@ -70,13 +70,13 @@ discard block |
||
| 70 | 70 | * @return boolean |
| 71 | 71 | */ |
| 72 | 72 | function lsx_health_plan_has_recipe( $post_id = '' ) { |
| 73 | - if ( ! post_type_exists( 'recipe' ) ) { |
|
| 74 | - return false; |
|
| 75 | - } |
|
| 76 | - if ( '' === $post_id ) { |
|
| 77 | - $post_id = get_the_ID(); |
|
| 78 | - } |
|
| 79 | - return \lsx_health_plan\functions\has_attached_post( $post_id, 'connected_recipes' ); |
|
| 73 | + if ( ! post_type_exists( 'recipe' ) ) { |
|
| 74 | + return false; |
|
| 75 | + } |
|
| 76 | + if ( '' === $post_id ) { |
|
| 77 | + $post_id = get_the_ID(); |
|
| 78 | + } |
|
| 79 | + return \lsx_health_plan\functions\has_attached_post( $post_id, 'connected_recipes' ); |
|
| 80 | 80 | } |
| 81 | 81 | |
| 82 | 82 | /** |
@@ -86,15 +86,15 @@ discard block |
||
| 86 | 86 | * @return boolean |
| 87 | 87 | */ |
| 88 | 88 | function lsx_health_plan_has_downloads( $post_id = '' ) { |
| 89 | - $has_downloads = false; |
|
| 90 | - if ( '' === $post_id ) { |
|
| 91 | - $post_id = get_the_ID(); |
|
| 92 | - } |
|
| 93 | - $downloads = \lsx_health_plan\functions\get_downloads( 'all', $post_id ); |
|
| 94 | - if ( ! empty( $downloads ) ) { |
|
| 95 | - $has_downloads = true; |
|
| 96 | - } |
|
| 97 | - return $has_downloads; |
|
| 89 | + $has_downloads = false; |
|
| 90 | + if ( '' === $post_id ) { |
|
| 91 | + $post_id = get_the_ID(); |
|
| 92 | + } |
|
| 93 | + $downloads = \lsx_health_plan\functions\get_downloads( 'all', $post_id ); |
|
| 94 | + if ( ! empty( $downloads ) ) { |
|
| 95 | + $has_downloads = true; |
|
| 96 | + } |
|
| 97 | + return $has_downloads; |
|
| 98 | 98 | } |
| 99 | 99 | |
| 100 | 100 | /** |
@@ -104,13 +104,13 @@ discard block |
||
| 104 | 104 | * @return boolean |
| 105 | 105 | */ |
| 106 | 106 | function lsx_health_plan_has_tip( $post_id = '' ) { |
| 107 | - if ( ! post_type_exists( 'tip' ) ) { |
|
| 108 | - return false; |
|
| 109 | - } |
|
| 110 | - if ( '' === $post_id ) { |
|
| 111 | - $post_id = get_the_ID(); |
|
| 112 | - } |
|
| 113 | - return \lsx_health_plan\functions\has_attached_post( $post_id, 'connected_tips' ); |
|
| 107 | + if ( ! post_type_exists( 'tip' ) ) { |
|
| 108 | + return false; |
|
| 109 | + } |
|
| 110 | + if ( '' === $post_id ) { |
|
| 111 | + $post_id = get_the_ID(); |
|
| 112 | + } |
|
| 113 | + return \lsx_health_plan\functions\has_attached_post( $post_id, 'connected_tips' ); |
|
| 114 | 114 | } |
| 115 | 115 | |
| 116 | 116 | /** |
@@ -120,13 +120,13 @@ discard block |
||
| 120 | 120 | * @return boolean |
| 121 | 121 | */ |
| 122 | 122 | function lsx_health_plan_has_video( $post_id = '' ) { |
| 123 | - if ( ! post_type_exists( 'video' ) ) { |
|
| 124 | - return false; |
|
| 125 | - } |
|
| 126 | - if ( '' === $post_id ) { |
|
| 127 | - $post_id = get_the_ID(); |
|
| 128 | - } |
|
| 129 | - return \lsx_health_plan\functions\has_attached_post( $post_id, 'connected_videos' ); |
|
| 123 | + if ( ! post_type_exists( 'video' ) ) { |
|
| 124 | + return false; |
|
| 125 | + } |
|
| 126 | + if ( '' === $post_id ) { |
|
| 127 | + $post_id = get_the_ID(); |
|
| 128 | + } |
|
| 129 | + return \lsx_health_plan\functions\has_attached_post( $post_id, 'connected_videos' ); |
|
| 130 | 130 | } |
| 131 | 131 | |
| 132 | 132 | /** |
@@ -135,8 +135,8 @@ discard block |
||
| 135 | 135 | * @return boolean |
| 136 | 136 | */ |
| 137 | 137 | function lsx_health_plan_user_has_purchase() { |
| 138 | - $valid_order = false; |
|
| 139 | - return $valid_order; |
|
| 138 | + $valid_order = false; |
|
| 139 | + return $valid_order; |
|
| 140 | 140 | } |
| 141 | 141 | |
| 142 | 142 | /** |
@@ -146,18 +146,18 @@ discard block |
||
| 146 | 146 | * @return boolean |
| 147 | 147 | */ |
| 148 | 148 | function lsx_health_plan_is_current_tab( $needle = '' ) { |
| 149 | - $is_tab = false; |
|
| 150 | - $plan_slug = \lsx_health_plan\functions\get_option( 'my_plan_slug', false ); |
|
| 151 | - if ( false === $plan_slug ) { |
|
| 152 | - $plan_slug = 'my-plan'; |
|
| 153 | - } |
|
| 154 | - if ( is_singular( 'plan' ) || is_page( $plan_slug ) ) { |
|
| 155 | - $endpoint = get_query_var( 'endpoint' ); |
|
| 156 | - if ( false !== $endpoint && $needle === $endpoint ) { |
|
| 157 | - $is_tab = true; |
|
| 158 | - } |
|
| 159 | - } |
|
| 160 | - return $is_tab; |
|
| 149 | + $is_tab = false; |
|
| 150 | + $plan_slug = \lsx_health_plan\functions\get_option( 'my_plan_slug', false ); |
|
| 151 | + if ( false === $plan_slug ) { |
|
| 152 | + $plan_slug = 'my-plan'; |
|
| 153 | + } |
|
| 154 | + if ( is_singular( 'plan' ) || is_page( $plan_slug ) ) { |
|
| 155 | + $endpoint = get_query_var( 'endpoint' ); |
|
| 156 | + if ( false !== $endpoint && $needle === $endpoint ) { |
|
| 157 | + $is_tab = true; |
|
| 158 | + } |
|
| 159 | + } |
|
| 160 | + return $is_tab; |
|
| 161 | 161 | } |
| 162 | 162 | |
| 163 | 163 | /** |
@@ -167,22 +167,22 @@ discard block |
||
| 167 | 167 | * @return boolean |
| 168 | 168 | */ |
| 169 | 169 | function lsx_health_plan_is_day_complete( $post_id = '', $section_key = '' ) { |
| 170 | - $is_complete = false; |
|
| 171 | - if ( '' === $post_id ) { |
|
| 172 | - $post_id = get_the_ID(); |
|
| 173 | - } |
|
| 174 | - $key = \lsx_health_plan\functions\plan\generate_section_id( $section_key ); |
|
| 175 | - $is_day_complete = get_user_meta( get_current_user_id(), 'day_' . $key . '_complete', true ); |
|
| 176 | - if ( false !== $is_day_complete && '' !== $is_day_complete ) { |
|
| 177 | - $is_complete = true; |
|
| 178 | - } |
|
| 179 | - |
|
| 180 | - return $is_complete; |
|
| 170 | + $is_complete = false; |
|
| 171 | + if ( '' === $post_id ) { |
|
| 172 | + $post_id = get_the_ID(); |
|
| 173 | + } |
|
| 174 | + $key = \lsx_health_plan\functions\plan\generate_section_id( $section_key ); |
|
| 175 | + $is_day_complete = get_user_meta( get_current_user_id(), 'day_' . $key . '_complete', true ); |
|
| 176 | + if ( false !== $is_day_complete && '' !== $is_day_complete ) { |
|
| 177 | + $is_complete = true; |
|
| 178 | + } |
|
| 179 | + |
|
| 180 | + return $is_complete; |
|
| 181 | 181 | } |
| 182 | 182 | |
| 183 | 183 | function lsx_health_plan_is_plan_complete() { |
| 184 | - $complete = false; |
|
| 185 | - return $complete; |
|
| 184 | + $complete = false; |
|
| 185 | + return $complete; |
|
| 186 | 186 | } |
| 187 | 187 | |
| 188 | 188 | /** |
@@ -192,14 +192,14 @@ discard block |
||
| 192 | 192 | * @return boolean |
| 193 | 193 | */ |
| 194 | 194 | function lsx_health_plan_week_has_downloads( $week = '' ) { |
| 195 | - $has_downloads = false; |
|
| 196 | - if ( '' !== $week ) { |
|
| 197 | - $downloads = \lsx_health_plan\functions\get_weekly_downloads( $week ); |
|
| 198 | - if ( ! empty( $downloads ) ) { |
|
| 199 | - $has_downloads = true; |
|
| 200 | - } |
|
| 201 | - } |
|
| 202 | - return $has_downloads; |
|
| 195 | + $has_downloads = false; |
|
| 196 | + if ( '' !== $week ) { |
|
| 197 | + $downloads = \lsx_health_plan\functions\get_weekly_downloads( $week ); |
|
| 198 | + if ( ! empty( $downloads ) ) { |
|
| 199 | + $has_downloads = true; |
|
| 200 | + } |
|
| 201 | + } |
|
| 202 | + return $has_downloads; |
|
| 203 | 203 | } |
| 204 | 204 | |
| 205 | 205 | /** |
@@ -209,15 +209,15 @@ discard block |
||
| 209 | 209 | * @return boolean |
| 210 | 210 | */ |
| 211 | 211 | function lsx_health_plan_has_tips( $post_id = '' ) { |
| 212 | - $has_tips = false; |
|
| 213 | - if ( '' === $post_id ) { |
|
| 214 | - $post_id = get_the_ID(); |
|
| 215 | - } |
|
| 216 | - $post_type = get_post_type( $post_id ); |
|
| 217 | - $connected_tips = get_post_meta( get_the_ID(), $post_type . '_connected_tips', true ); |
|
| 218 | - $connected_tips = \lsx_health_plan\functions\check_posts_exist( $connected_tips ); |
|
| 219 | - if ( ! empty( $connected_tips ) ) { |
|
| 220 | - $has_tips = true; |
|
| 221 | - } |
|
| 222 | - return $has_tips; |
|
| 212 | + $has_tips = false; |
|
| 213 | + if ( '' === $post_id ) { |
|
| 214 | + $post_id = get_the_ID(); |
|
| 215 | + } |
|
| 216 | + $post_type = get_post_type( $post_id ); |
|
| 217 | + $connected_tips = get_post_meta( get_the_ID(), $post_type . '_connected_tips', true ); |
|
| 218 | + $connected_tips = \lsx_health_plan\functions\check_posts_exist( $connected_tips ); |
|
| 219 | + if ( ! empty( $connected_tips ) ) { |
|
| 220 | + $has_tips = true; |
|
| 221 | + } |
|
| 222 | + return $has_tips; |
|
| 223 | 223 | } |