@@ -54,10 +54,10 @@ discard block |
||
| 54 | 54 | */ |
| 55 | 55 | public function __construct() { |
| 56 | 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 ); |
|
| 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 ); |
|
| 60 | + add_action('lsx_hp_settings_page_general_top', array($this, 'general_settings'), 1, 1); |
|
| 61 | 61 | } |
| 62 | 62 | |
| 63 | 63 | /** |
@@ -69,7 +69,7 @@ discard block |
||
| 69 | 69 | */ |
| 70 | 70 | public static function get_instance() { |
| 71 | 71 | // If the single instance hasn't been set, set it now. |
| 72 | - if ( null === self::$instance ) { |
|
| 72 | + if (null === self::$instance) { |
|
| 73 | 73 | self::$instance = new self(); |
| 74 | 74 | } |
| 75 | 75 | return self::$instance; |
@@ -89,7 +89,7 @@ discard block |
||
| 89 | 89 | //'tip', |
| 90 | 90 | ); |
| 91 | 91 | |
| 92 | - foreach ( $this->post_types as $post_type ) { |
|
| 92 | + foreach ($this->post_types as $post_type) { |
|
| 93 | 93 | $this->$post_type = require_once LSX_HEALTH_PLAN_PATH . 'classes/admin/settings/class-' . $post_type . '.php'; |
| 94 | 94 | } |
| 95 | 95 | |
@@ -102,14 +102,14 @@ discard block |
||
| 102 | 102 | $cmb = new_cmb2_box( |
| 103 | 103 | array( |
| 104 | 104 | 'id' => $this->screen_id, |
| 105 | - 'title' => esc_html__( 'Settings', 'lsx-health-plan' ), |
|
| 106 | - 'object_types' => array( 'options-page' ), |
|
| 105 | + 'title' => esc_html__('Settings', 'lsx-health-plan'), |
|
| 106 | + 'object_types' => array('options-page'), |
|
| 107 | 107 | 'option_key' => 'lsx_health_plan_options', // The option key and admin menu page slug. |
| 108 | 108 | 'parent_slug' => 'edit.php?post_type=plan', // Make options page a submenu item of the themes menu. |
| 109 | 109 | 'capability' => 'manage_options', // Cap required to view options-page. |
| 110 | 110 | ) |
| 111 | 111 | ); |
| 112 | - do_action( 'lsx_hp_settings_page', $cmb ); |
|
| 112 | + do_action('lsx_hp_settings_page', $cmb); |
|
| 113 | 113 | } |
| 114 | 114 | |
| 115 | 115 | /** |
@@ -118,73 +118,73 @@ discard block |
||
| 118 | 118 | * @param object $cmb new_cmb2_box(). |
| 119 | 119 | * @return void |
| 120 | 120 | */ |
| 121 | - public function general_settings( $cmb ) { |
|
| 122 | - if ( function_exists( 'wc_memberships_is_post_content_restricted' ) ) { |
|
| 121 | + public function general_settings($cmb) { |
|
| 122 | + if (function_exists('wc_memberships_is_post_content_restricted')) { |
|
| 123 | 123 | $cmb->add_field( |
| 124 | 124 | array( |
| 125 | - 'name' => __( 'Membership Product', 'lsx-health-plan' ), |
|
| 125 | + 'name' => __('Membership Product', 'lsx-health-plan'), |
|
| 126 | 126 | 'id' => 'membership_product', |
| 127 | 127 | 'type' => 'post_search_ajax', |
| 128 | 128 | 'limit' => 1, |
| 129 | 129 | 'sortable' => false, |
| 130 | 130 | 'query_args' => array( |
| 131 | - 'post_type' => array( 'product' ), |
|
| 132 | - 'post_status' => array( 'publish' ), |
|
| 131 | + 'post_type' => array('product'), |
|
| 132 | + 'post_status' => array('publish'), |
|
| 133 | 133 | 'posts_per_page' => -1, |
| 134 | 134 | ), |
| 135 | 135 | ) |
| 136 | 136 | ); |
| 137 | 137 | } |
| 138 | 138 | |
| 139 | - if ( false === \lsx_health_plan\functions\get_option( 'exercise_enabled', false ) ) { |
|
| 139 | + if (false === \lsx_health_plan\functions\get_option('exercise_enabled', false)) { |
|
| 140 | 140 | $cmb->add_field( |
| 141 | 141 | array( |
| 142 | - 'name' => __( 'Exercises', 'lsx-health-plan' ), |
|
| 142 | + 'name' => __('Exercises', 'lsx-health-plan'), |
|
| 143 | 143 | 'id' => 'exercise_enabled', |
| 144 | 144 | 'type' => 'checkbox', |
| 145 | 145 | 'value' => 1, |
| 146 | 146 | 'default' => 0, |
| 147 | - 'description' => __( 'Enabling the exercise post type will automatically replace the Video post type.', 'lsx-health-plan' ), |
|
| 147 | + 'description' => __('Enabling the exercise post type will automatically replace the Video post type.', 'lsx-health-plan'), |
|
| 148 | 148 | ) |
| 149 | 149 | ); |
| 150 | 150 | } |
| 151 | 151 | |
| 152 | 152 | |
| 153 | - if ( \lsx_health_plan\functions\get_option( 'workout_disabled' ) ) { |
|
| 153 | + if (\lsx_health_plan\functions\get_option('workout_disabled')) { |
|
| 154 | 154 | $cmb->add_field( |
| 155 | 155 | array( |
| 156 | - 'name' => __( 'Disable Workouts', 'lsx-health-plan' ), |
|
| 156 | + 'name' => __('Disable Workouts', 'lsx-health-plan'), |
|
| 157 | 157 | 'id' => 'workout_disabled', |
| 158 | 158 | 'type' => 'checkbox', |
| 159 | 159 | 'value' => 1, |
| 160 | 160 | 'default' => 0, |
| 161 | - 'description' => __( 'Disable workout post type if you are wanting a minimal site.', 'lsx-health-plan' ), |
|
| 161 | + 'description' => __('Disable workout post type if you are wanting a minimal site.', 'lsx-health-plan'), |
|
| 162 | 162 | ) |
| 163 | 163 | ); |
| 164 | 164 | } |
| 165 | 165 | |
| 166 | - if ( \lsx_health_plan\functions\get_option( 'recipe_disabled' ) ) { |
|
| 166 | + if (\lsx_health_plan\functions\get_option('recipe_disabled')) { |
|
| 167 | 167 | $cmb->add_field( |
| 168 | 168 | array( |
| 169 | - 'name' => __( 'Disable Recipes', 'lsx-health-plan' ), |
|
| 169 | + 'name' => __('Disable Recipes', 'lsx-health-plan'), |
|
| 170 | 170 | 'id' => 'recipe_disabled', |
| 171 | 171 | 'type' => 'checkbox', |
| 172 | 172 | 'value' => 1, |
| 173 | 173 | 'default' => 0, |
| 174 | - 'description' => __( 'Disable recipe post type if you are wanting a minimal site.', 'lsx-health-plan' ), |
|
| 174 | + 'description' => __('Disable recipe post type if you are wanting a minimal site.', 'lsx-health-plan'), |
|
| 175 | 175 | ) |
| 176 | 176 | ); |
| 177 | 177 | } |
| 178 | 178 | |
| 179 | - if ( \lsx_health_plan\functions\get_option( 'meal_disabled' ) ) { |
|
| 179 | + if (\lsx_health_plan\functions\get_option('meal_disabled')) { |
|
| 180 | 180 | $cmb->add_field( |
| 181 | 181 | array( |
| 182 | - 'name' => __( 'Disable Meals', 'lsx-health-plan' ), |
|
| 182 | + 'name' => __('Disable Meals', 'lsx-health-plan'), |
|
| 183 | 183 | 'id' => 'meal_disabled', |
| 184 | 184 | 'type' => 'checkbox', |
| 185 | 185 | 'value' => 1, |
| 186 | 186 | 'default' => 0, |
| 187 | - 'description' => __( 'Disable meal post type if you are wanting a minimal site.', 'lsx-health-plan' ), |
|
| 187 | + 'description' => __('Disable meal post type if you are wanting a minimal site.', 'lsx-health-plan'), |
|
| 188 | 188 | ) |
| 189 | 189 | ); |
| 190 | 190 | } |
@@ -192,12 +192,12 @@ discard block |
||
| 192 | 192 | |
| 193 | 193 | $cmb->add_field( |
| 194 | 194 | array( |
| 195 | - 'name' => __( 'Login Slug', 'lsx-health-plan' ), |
|
| 195 | + 'name' => __('Login Slug', 'lsx-health-plan'), |
|
| 196 | 196 | 'id' => 'login_slug', |
| 197 | 197 | 'type' => 'input', |
| 198 | 198 | 'value' => '', |
| 199 | 199 | 'default' => 'login', |
| 200 | - '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' ), |
|
| 200 | + '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'), |
|
| 201 | 201 | ) |
| 202 | 202 | ); |
| 203 | 203 | |
@@ -210,10 +210,10 @@ discard block |
||
| 210 | 210 | * @param string $section either engine,archive or single. |
| 211 | 211 | * @return void |
| 212 | 212 | */ |
| 213 | - public function generate_tabs( $cmb ) { |
|
| 213 | + public function generate_tabs($cmb) { |
|
| 214 | 214 | $tabs = $this->get_settings_tabs(); |
| 215 | 215 | |
| 216 | - foreach ( $tabs as $tab_key => $tab ) { |
|
| 216 | + foreach ($tabs as $tab_key => $tab) { |
|
| 217 | 217 | $cmb->add_field( |
| 218 | 218 | array( |
| 219 | 219 | 'id' => 'settings_' . $tab_key . '_title', |
@@ -223,11 +223,11 @@ discard block |
||
| 223 | 223 | 'description' => $tab['desc'], |
| 224 | 224 | ) |
| 225 | 225 | ); |
| 226 | - do_action( 'lsx_hp_settings_page_' . $tab_key . '_top', $cmb ); |
|
| 226 | + do_action('lsx_hp_settings_page_' . $tab_key . '_top', $cmb); |
|
| 227 | 227 | |
| 228 | - do_action( 'lsx_hp_settings_page_' . $tab_key . '_middle', $cmb ); |
|
| 228 | + do_action('lsx_hp_settings_page_' . $tab_key . '_middle', $cmb); |
|
| 229 | 229 | |
| 230 | - do_action( 'lsx_hp_settings_page_' . $tab_key . '_bottom', $cmb ); |
|
| 230 | + do_action('lsx_hp_settings_page_' . $tab_key . '_bottom', $cmb); |
|
| 231 | 231 | |
| 232 | 232 | $cmb->add_field( |
| 233 | 233 | array( |
@@ -247,26 +247,26 @@ discard block |
||
| 247 | 247 | public function get_settings_tabs() { |
| 248 | 248 | $tabs = array( |
| 249 | 249 | 'general' => array( |
| 250 | - 'title' => __( 'General', 'lsx-health-plan' ), |
|
| 251 | - 'desc' => __( 'Control the sitewide settings for the LSX HP site.', 'lsx-health-plan' ), |
|
| 250 | + 'title' => __('General', 'lsx-health-plan'), |
|
| 251 | + 'desc' => __('Control the sitewide settings for the LSX HP site.', 'lsx-health-plan'), |
|
| 252 | 252 | ), |
| 253 | 253 | ); |
| 254 | 254 | |
| 255 | - foreach ( $this->post_types as $post_type ) { |
|
| 256 | - switch ( $post_type ) { |
|
| 255 | + foreach ($this->post_types as $post_type) { |
|
| 256 | + switch ($post_type) { |
|
| 257 | 257 | default: |
| 258 | 258 | //if ( ! in_array( $post_type, \lsx\search\includes\get_restricted_post_types() ) ) { |
| 259 | - $temp_post_type = get_post_type_object( $post_type ); |
|
| 260 | - if ( ! is_wp_error( $temp_post_type ) ) { |
|
| 261 | - $page_url = get_post_type_archive_link( $temp_post_type->name ); |
|
| 259 | + $temp_post_type = get_post_type_object($post_type); |
|
| 260 | + if ( ! is_wp_error($temp_post_type)) { |
|
| 261 | + $page_url = get_post_type_archive_link($temp_post_type->name); |
|
| 262 | 262 | $description = sprintf( |
| 263 | 263 | /* translators: %s: The subscription info */ |
| 264 | - __( 'Control the settings for your <a target="_blank" href="%1$s">%2$s</a> archive.', 'lsx-search' ), |
|
| 264 | + __('Control the settings for your <a target="_blank" href="%1$s">%2$s</a> archive.', 'lsx-search'), |
|
| 265 | 265 | $page_url, |
| 266 | 266 | $temp_post_type->label |
| 267 | 267 | ); |
| 268 | 268 | |
| 269 | - $tabs[ $post_type ] = array( |
|
| 269 | + $tabs[$post_type] = array( |
|
| 270 | 270 | 'title' => $temp_post_type->label, |
| 271 | 271 | 'desc' => $description, |
| 272 | 272 | ); |