@@ -8,66 +8,66 @@ |
||
| 8 | 8 | */ |
| 9 | 9 | class Admin { |
| 10 | 10 | |
| 11 | - /** |
|
| 12 | - * Holds class instance |
|
| 13 | - * |
|
| 14 | - * @since 1.0.0 |
|
| 15 | - * |
|
| 16 | - * @var object \lsx_health_plan\classes\integrations\woocommerce\Admin() |
|
| 17 | - */ |
|
| 18 | - protected static $instance = null; |
|
| 11 | + /** |
|
| 12 | + * Holds class instance |
|
| 13 | + * |
|
| 14 | + * @since 1.0.0 |
|
| 15 | + * |
|
| 16 | + * @var object \lsx_health_plan\classes\integrations\woocommerce\Admin() |
|
| 17 | + */ |
|
| 18 | + protected static $instance = null; |
|
| 19 | 19 | |
| 20 | - /** |
|
| 21 | - * Constructor |
|
| 22 | - */ |
|
| 23 | - public function __construct() { |
|
| 24 | - add_action( 'cmb2_admin_init', array( $this, 'products_metaboxes' ), 5 ); |
|
| 25 | - } |
|
| 20 | + /** |
|
| 21 | + * Constructor |
|
| 22 | + */ |
|
| 23 | + public function __construct() { |
|
| 24 | + add_action( 'cmb2_admin_init', array( $this, 'products_metaboxes' ), 5 ); |
|
| 25 | + } |
|
| 26 | 26 | |
| 27 | - /** |
|
| 28 | - * Return an instance of this class. |
|
| 29 | - * |
|
| 30 | - * @since 1.0.0 |
|
| 31 | - * |
|
| 32 | - * @return object \lsx_health_plan\classes\integrations\woocommerce\Admin() A single instance of this class. |
|
| 33 | - */ |
|
| 34 | - public static function get_instance() { |
|
| 35 | - // If the single instance hasn't been set, set it now. |
|
| 36 | - if ( null === self::$instance ) { |
|
| 37 | - self::$instance = new self(); |
|
| 38 | - } |
|
| 39 | - return self::$instance; |
|
| 40 | - } |
|
| 27 | + /** |
|
| 28 | + * Return an instance of this class. |
|
| 29 | + * |
|
| 30 | + * @since 1.0.0 |
|
| 31 | + * |
|
| 32 | + * @return object \lsx_health_plan\classes\integrations\woocommerce\Admin() A single instance of this class. |
|
| 33 | + */ |
|
| 34 | + public static function get_instance() { |
|
| 35 | + // If the single instance hasn't been set, set it now. |
|
| 36 | + if ( null === self::$instance ) { |
|
| 37 | + self::$instance = new self(); |
|
| 38 | + } |
|
| 39 | + return self::$instance; |
|
| 40 | + } |
|
| 41 | 41 | |
| 42 | - /** |
|
| 43 | - * Define the product metabox on the plan post type |
|
| 44 | - */ |
|
| 45 | - public function products_metaboxes() { |
|
| 46 | - $cmb = new_cmb2_box( |
|
| 47 | - array( |
|
| 48 | - 'id' => 'plan_product_metabox', |
|
| 49 | - 'title' => __( 'Products', 'lsx-health-plan' ), |
|
| 50 | - 'object_types' => array( 'plan' ), // Post type. |
|
| 51 | - 'context' => 'side', |
|
| 52 | - 'priority' => 'low', |
|
| 53 | - 'show_names' => true, |
|
| 54 | - ) |
|
| 55 | - ); |
|
| 42 | + /** |
|
| 43 | + * Define the product metabox on the plan post type |
|
| 44 | + */ |
|
| 45 | + public function products_metaboxes() { |
|
| 46 | + $cmb = new_cmb2_box( |
|
| 47 | + array( |
|
| 48 | + 'id' => 'plan_product_metabox', |
|
| 49 | + 'title' => __( 'Products', 'lsx-health-plan' ), |
|
| 50 | + 'object_types' => array( 'plan' ), // Post type. |
|
| 51 | + 'context' => 'side', |
|
| 52 | + 'priority' => 'low', |
|
| 53 | + 'show_names' => true, |
|
| 54 | + ) |
|
| 55 | + ); |
|
| 56 | 56 | |
| 57 | - $cmb->add_field( |
|
| 58 | - array( |
|
| 59 | - 'name' => __( 'Search your products', 'lsx-health-plan' ), |
|
| 60 | - 'desc' => __( 'Connect the product(s) which sell access to this plan.', 'lsx-health-plan' ), |
|
| 61 | - 'id' => 'plan_product', |
|
| 62 | - 'type' => 'post_search_ajax', |
|
| 63 | - 'limit' => 5, // Limit selection to X items only (default 1). |
|
| 64 | - 'sortable' => false, // Allow selected items to be sortable (default false). |
|
| 65 | - 'query_args' => array( |
|
| 66 | - 'post_type' => 'product', |
|
| 67 | - 'post_status' => array( 'publish' ), |
|
| 68 | - 'posts_per_page' => -1, |
|
| 69 | - ), |
|
| 70 | - ) |
|
| 71 | - ); |
|
| 72 | - } |
|
| 57 | + $cmb->add_field( |
|
| 58 | + array( |
|
| 59 | + 'name' => __( 'Search your products', 'lsx-health-plan' ), |
|
| 60 | + 'desc' => __( 'Connect the product(s) which sell access to this plan.', 'lsx-health-plan' ), |
|
| 61 | + 'id' => 'plan_product', |
|
| 62 | + 'type' => 'post_search_ajax', |
|
| 63 | + 'limit' => 5, // Limit selection to X items only (default 1). |
|
| 64 | + 'sortable' => false, // Allow selected items to be sortable (default false). |
|
| 65 | + 'query_args' => array( |
|
| 66 | + 'post_type' => 'product', |
|
| 67 | + 'post_status' => array( 'publish' ), |
|
| 68 | + 'posts_per_page' => -1, |
|
| 69 | + ), |
|
| 70 | + ) |
|
| 71 | + ); |
|
| 72 | + } |
|
| 73 | 73 | } |
@@ -21,7 +21,7 @@ discard block |
||
| 21 | 21 | * Constructor |
| 22 | 22 | */ |
| 23 | 23 | public function __construct() { |
| 24 | - add_action( 'cmb2_admin_init', array( $this, 'products_metaboxes' ), 5 ); |
|
| 24 | + add_action('cmb2_admin_init', array($this, 'products_metaboxes'), 5); |
|
| 25 | 25 | } |
| 26 | 26 | |
| 27 | 27 | /** |
@@ -33,7 +33,7 @@ discard block |
||
| 33 | 33 | */ |
| 34 | 34 | public static function get_instance() { |
| 35 | 35 | // If the single instance hasn't been set, set it now. |
| 36 | - if ( null === self::$instance ) { |
|
| 36 | + if (null === self::$instance) { |
|
| 37 | 37 | self::$instance = new self(); |
| 38 | 38 | } |
| 39 | 39 | return self::$instance; |
@@ -46,8 +46,8 @@ discard block |
||
| 46 | 46 | $cmb = new_cmb2_box( |
| 47 | 47 | array( |
| 48 | 48 | 'id' => 'plan_product_metabox', |
| 49 | - 'title' => __( 'Products', 'lsx-health-plan' ), |
|
| 50 | - 'object_types' => array( 'plan' ), // Post type. |
|
| 49 | + 'title' => __('Products', 'lsx-health-plan'), |
|
| 50 | + 'object_types' => array('plan'), // Post type. |
|
| 51 | 51 | 'context' => 'side', |
| 52 | 52 | 'priority' => 'low', |
| 53 | 53 | 'show_names' => true, |
@@ -56,15 +56,15 @@ discard block |
||
| 56 | 56 | |
| 57 | 57 | $cmb->add_field( |
| 58 | 58 | array( |
| 59 | - 'name' => __( 'Search your products', 'lsx-health-plan' ), |
|
| 60 | - 'desc' => __( 'Connect the product(s) which sell access to this plan.', 'lsx-health-plan' ), |
|
| 59 | + 'name' => __('Search your products', 'lsx-health-plan'), |
|
| 60 | + 'desc' => __('Connect the product(s) which sell access to this plan.', 'lsx-health-plan'), |
|
| 61 | 61 | 'id' => 'plan_product', |
| 62 | 62 | 'type' => 'post_search_ajax', |
| 63 | - 'limit' => 5, // Limit selection to X items only (default 1). |
|
| 63 | + 'limit' => 5, // Limit selection to X items only (default 1). |
|
| 64 | 64 | 'sortable' => false, // Allow selected items to be sortable (default false). |
| 65 | 65 | 'query_args' => array( |
| 66 | 66 | 'post_type' => 'product', |
| 67 | - 'post_status' => array( 'publish' ), |
|
| 67 | + 'post_status' => array('publish'), |
|
| 68 | 68 | 'posts_per_page' => -1, |
| 69 | 69 | ), |
| 70 | 70 | ) |
@@ -8,87 +8,87 @@ |
||
| 8 | 8 | */ |
| 9 | 9 | class LSX_Team { |
| 10 | 10 | |
| 11 | - /** |
|
| 12 | - * Holds class instance |
|
| 13 | - * |
|
| 14 | - * @var object \lsx_health_plan\classes\LSX_Team() |
|
| 15 | - */ |
|
| 16 | - protected static $instance = null; |
|
| 11 | + /** |
|
| 12 | + * Holds class instance |
|
| 13 | + * |
|
| 14 | + * @var object \lsx_health_plan\classes\LSX_Team() |
|
| 15 | + */ |
|
| 16 | + protected static $instance = null; |
|
| 17 | 17 | |
| 18 | - /** |
|
| 19 | - * Constructor. |
|
| 20 | - */ |
|
| 21 | - public function __construct() { |
|
| 22 | - $this->default_types = array( |
|
| 23 | - \lsx_health_plan\functions\get_option( 'endpoint_meal', 'meal' ), |
|
| 24 | - \lsx_health_plan\functions\get_option( 'endpoint_exercise_single', 'exercise' ), |
|
| 25 | - \lsx_health_plan\functions\get_option( 'endpoint_recipe_single', 'recipe' ), |
|
| 26 | - \lsx_health_plan\functions\get_option( 'endpoint_workout', 'workout' ), |
|
| 27 | - \lsx_health_plan\functions\get_option( 'endpoint_plan', 'plan' ), |
|
| 28 | - ); |
|
| 29 | - add_action( 'wp_enqueue_scripts', array( $this, 'assets' ), 5 ); |
|
| 30 | - add_action( 'cmb2_admin_init', array( $this, 'related_team_metabox' ) ); |
|
| 31 | - } |
|
| 18 | + /** |
|
| 19 | + * Constructor. |
|
| 20 | + */ |
|
| 21 | + public function __construct() { |
|
| 22 | + $this->default_types = array( |
|
| 23 | + \lsx_health_plan\functions\get_option( 'endpoint_meal', 'meal' ), |
|
| 24 | + \lsx_health_plan\functions\get_option( 'endpoint_exercise_single', 'exercise' ), |
|
| 25 | + \lsx_health_plan\functions\get_option( 'endpoint_recipe_single', 'recipe' ), |
|
| 26 | + \lsx_health_plan\functions\get_option( 'endpoint_workout', 'workout' ), |
|
| 27 | + \lsx_health_plan\functions\get_option( 'endpoint_plan', 'plan' ), |
|
| 28 | + ); |
|
| 29 | + add_action( 'wp_enqueue_scripts', array( $this, 'assets' ), 5 ); |
|
| 30 | + add_action( 'cmb2_admin_init', array( $this, 'related_team_metabox' ) ); |
|
| 31 | + } |
|
| 32 | 32 | |
| 33 | - /** |
|
| 34 | - * Return an instance of this class. |
|
| 35 | - * |
|
| 36 | - * @since 1.0.0 |
|
| 37 | - * |
|
| 38 | - * @return object \lsx_health_plan\classes\LSX_Team() A single instance of this class. |
|
| 39 | - */ |
|
| 40 | - public static function get_instance() { |
|
| 41 | - // If the single instance hasn't been set, set it now. |
|
| 42 | - if ( null === self::$instance ) { |
|
| 43 | - self::$instance = new self(); |
|
| 44 | - } |
|
| 45 | - return self::$instance; |
|
| 46 | - } |
|
| 33 | + /** |
|
| 34 | + * Return an instance of this class. |
|
| 35 | + * |
|
| 36 | + * @since 1.0.0 |
|
| 37 | + * |
|
| 38 | + * @return object \lsx_health_plan\classes\LSX_Team() A single instance of this class. |
|
| 39 | + */ |
|
| 40 | + public static function get_instance() { |
|
| 41 | + // If the single instance hasn't been set, set it now. |
|
| 42 | + if ( null === self::$instance ) { |
|
| 43 | + self::$instance = new self(); |
|
| 44 | + } |
|
| 45 | + return self::$instance; |
|
| 46 | + } |
|
| 47 | 47 | |
| 48 | - /** |
|
| 49 | - * Load lsx team related css. |
|
| 50 | - * |
|
| 51 | - * @package lsx |
|
| 52 | - * @subpackage lsx-health-plan |
|
| 53 | - * |
|
| 54 | - */ |
|
| 55 | - public function assets() { |
|
| 56 | - wp_enqueue_style( 'lsx-health-plan-team', LSX_HEALTH_PLAN_URL . 'assets/css/lsx-health-plan-team.css', array(), LSX_HEALTH_PLAN_VER ); |
|
| 57 | - } |
|
| 48 | + /** |
|
| 49 | + * Load lsx team related css. |
|
| 50 | + * |
|
| 51 | + * @package lsx |
|
| 52 | + * @subpackage lsx-health-plan |
|
| 53 | + * |
|
| 54 | + */ |
|
| 55 | + public function assets() { |
|
| 56 | + wp_enqueue_style( 'lsx-health-plan-team', LSX_HEALTH_PLAN_URL . 'assets/css/lsx-health-plan-team.css', array(), LSX_HEALTH_PLAN_VER ); |
|
| 57 | + } |
|
| 58 | 58 | |
| 59 | - /** |
|
| 60 | - * Define the related team member metabox and field configurations. |
|
| 61 | - */ |
|
| 62 | - public function related_team_metabox() { |
|
| 63 | - foreach ( $this->default_types as $type => $default_type ) { |
|
| 64 | - $cmb = new_cmb2_box( |
|
| 65 | - array( |
|
| 66 | - 'id' => $default_type . '_related_team_member__metabox', |
|
| 67 | - 'title' => __( 'Related Team Member', 'lsx-health-plan' ), |
|
| 68 | - 'object_types' => array( $default_type ), // Post type. |
|
| 69 | - 'context' => 'normal', |
|
| 70 | - 'priority' => 'low', |
|
| 71 | - 'show_names' => true, |
|
| 72 | - ) |
|
| 73 | - ); |
|
| 59 | + /** |
|
| 60 | + * Define the related team member metabox and field configurations. |
|
| 61 | + */ |
|
| 62 | + public function related_team_metabox() { |
|
| 63 | + foreach ( $this->default_types as $type => $default_type ) { |
|
| 64 | + $cmb = new_cmb2_box( |
|
| 65 | + array( |
|
| 66 | + 'id' => $default_type . '_related_team_member__metabox', |
|
| 67 | + 'title' => __( 'Related Team Member', 'lsx-health-plan' ), |
|
| 68 | + 'object_types' => array( $default_type ), // Post type. |
|
| 69 | + 'context' => 'normal', |
|
| 70 | + 'priority' => 'low', |
|
| 71 | + 'show_names' => true, |
|
| 72 | + ) |
|
| 73 | + ); |
|
| 74 | 74 | |
| 75 | - $cmb->add_field( |
|
| 76 | - array( |
|
| 77 | - 'name' => __( 'Related Team Member', 'lsx-health-plan' ), |
|
| 78 | - 'desc' => __( 'Connect the related team member that applies to this ', 'lsx-health-plan' ) . $default_type, |
|
| 79 | - 'id' => $default_type . '_connected_team_member', |
|
| 80 | - 'type' => 'post_search_ajax', |
|
| 81 | - 'limit' => 4, // Limit selection to X items only (default 1). |
|
| 82 | - 'sortable' => true, // Allow selected items to be sortable (default false). |
|
| 83 | - 'query_args' => array( |
|
| 84 | - 'post_type' => array( 'team' ), |
|
| 85 | - 'post_status' => array( 'publish' ), |
|
| 86 | - 'posts_per_page' => -1, |
|
| 87 | - ), |
|
| 88 | - ) |
|
| 89 | - ); |
|
| 90 | - } |
|
| 75 | + $cmb->add_field( |
|
| 76 | + array( |
|
| 77 | + 'name' => __( 'Related Team Member', 'lsx-health-plan' ), |
|
| 78 | + 'desc' => __( 'Connect the related team member that applies to this ', 'lsx-health-plan' ) . $default_type, |
|
| 79 | + 'id' => $default_type . '_connected_team_member', |
|
| 80 | + 'type' => 'post_search_ajax', |
|
| 81 | + 'limit' => 4, // Limit selection to X items only (default 1). |
|
| 82 | + 'sortable' => true, // Allow selected items to be sortable (default false). |
|
| 83 | + 'query_args' => array( |
|
| 84 | + 'post_type' => array( 'team' ), |
|
| 85 | + 'post_status' => array( 'publish' ), |
|
| 86 | + 'posts_per_page' => -1, |
|
| 87 | + ), |
|
| 88 | + ) |
|
| 89 | + ); |
|
| 90 | + } |
|
| 91 | 91 | |
| 92 | - } |
|
| 92 | + } |
|
| 93 | 93 | |
| 94 | 94 | } |
@@ -20,14 +20,14 @@ discard block |
||
| 20 | 20 | */ |
| 21 | 21 | public function __construct() { |
| 22 | 22 | $this->default_types = array( |
| 23 | - \lsx_health_plan\functions\get_option( 'endpoint_meal', 'meal' ), |
|
| 24 | - \lsx_health_plan\functions\get_option( 'endpoint_exercise_single', 'exercise' ), |
|
| 25 | - \lsx_health_plan\functions\get_option( 'endpoint_recipe_single', 'recipe' ), |
|
| 26 | - \lsx_health_plan\functions\get_option( 'endpoint_workout', 'workout' ), |
|
| 27 | - \lsx_health_plan\functions\get_option( 'endpoint_plan', 'plan' ), |
|
| 23 | + \lsx_health_plan\functions\get_option('endpoint_meal', 'meal'), |
|
| 24 | + \lsx_health_plan\functions\get_option('endpoint_exercise_single', 'exercise'), |
|
| 25 | + \lsx_health_plan\functions\get_option('endpoint_recipe_single', 'recipe'), |
|
| 26 | + \lsx_health_plan\functions\get_option('endpoint_workout', 'workout'), |
|
| 27 | + \lsx_health_plan\functions\get_option('endpoint_plan', 'plan'), |
|
| 28 | 28 | ); |
| 29 | - add_action( 'wp_enqueue_scripts', array( $this, 'assets' ), 5 ); |
|
| 30 | - add_action( 'cmb2_admin_init', array( $this, 'related_team_metabox' ) ); |
|
| 29 | + add_action('wp_enqueue_scripts', array($this, 'assets'), 5); |
|
| 30 | + add_action('cmb2_admin_init', array($this, 'related_team_metabox')); |
|
| 31 | 31 | } |
| 32 | 32 | |
| 33 | 33 | /** |
@@ -39,7 +39,7 @@ discard block |
||
| 39 | 39 | */ |
| 40 | 40 | public static function get_instance() { |
| 41 | 41 | // If the single instance hasn't been set, set it now. |
| 42 | - if ( null === self::$instance ) { |
|
| 42 | + if (null === self::$instance) { |
|
| 43 | 43 | self::$instance = new self(); |
| 44 | 44 | } |
| 45 | 45 | return self::$instance; |
@@ -53,19 +53,19 @@ discard block |
||
| 53 | 53 | * |
| 54 | 54 | */ |
| 55 | 55 | public function assets() { |
| 56 | - wp_enqueue_style( 'lsx-health-plan-team', LSX_HEALTH_PLAN_URL . 'assets/css/lsx-health-plan-team.css', array(), LSX_HEALTH_PLAN_VER ); |
|
| 56 | + wp_enqueue_style('lsx-health-plan-team', LSX_HEALTH_PLAN_URL . 'assets/css/lsx-health-plan-team.css', array(), LSX_HEALTH_PLAN_VER); |
|
| 57 | 57 | } |
| 58 | 58 | |
| 59 | 59 | /** |
| 60 | 60 | * Define the related team member metabox and field configurations. |
| 61 | 61 | */ |
| 62 | 62 | public function related_team_metabox() { |
| 63 | - foreach ( $this->default_types as $type => $default_type ) { |
|
| 63 | + foreach ($this->default_types as $type => $default_type) { |
|
| 64 | 64 | $cmb = new_cmb2_box( |
| 65 | 65 | array( |
| 66 | 66 | 'id' => $default_type . '_related_team_member__metabox', |
| 67 | - 'title' => __( 'Related Team Member', 'lsx-health-plan' ), |
|
| 68 | - 'object_types' => array( $default_type ), // Post type. |
|
| 67 | + 'title' => __('Related Team Member', 'lsx-health-plan'), |
|
| 68 | + 'object_types' => array($default_type), // Post type. |
|
| 69 | 69 | 'context' => 'normal', |
| 70 | 70 | 'priority' => 'low', |
| 71 | 71 | 'show_names' => true, |
@@ -74,15 +74,15 @@ discard block |
||
| 74 | 74 | |
| 75 | 75 | $cmb->add_field( |
| 76 | 76 | array( |
| 77 | - 'name' => __( 'Related Team Member', 'lsx-health-plan' ), |
|
| 78 | - 'desc' => __( 'Connect the related team member that applies to this ', 'lsx-health-plan' ) . $default_type, |
|
| 77 | + 'name' => __('Related Team Member', 'lsx-health-plan'), |
|
| 78 | + 'desc' => __('Connect the related team member that applies to this ', 'lsx-health-plan') . $default_type, |
|
| 79 | 79 | 'id' => $default_type . '_connected_team_member', |
| 80 | 80 | 'type' => 'post_search_ajax', |
| 81 | - 'limit' => 4, // Limit selection to X items only (default 1). |
|
| 81 | + 'limit' => 4, // Limit selection to X items only (default 1). |
|
| 82 | 82 | 'sortable' => true, // Allow selected items to be sortable (default false). |
| 83 | 83 | 'query_args' => array( |
| 84 | - 'post_type' => array( 'team' ), |
|
| 85 | - 'post_status' => array( 'publish' ), |
|
| 84 | + 'post_type' => array('team'), |
|
| 85 | + 'post_status' => array('publish'), |
|
| 86 | 86 | 'posts_per_page' => -1, |
| 87 | 87 | ), |
| 88 | 88 | ) |
@@ -8,46 +8,46 @@ |
||
| 8 | 8 | */ |
| 9 | 9 | class WP_User_Avatar { |
| 10 | 10 | |
| 11 | - /** |
|
| 12 | - * Holds class instance |
|
| 13 | - * |
|
| 14 | - * @since 1.0.0 |
|
| 15 | - * |
|
| 16 | - * @var object \lsx_health_plan\classes\Woocommerce() |
|
| 17 | - */ |
|
| 18 | - protected static $instance = null; |
|
| 11 | + /** |
|
| 12 | + * Holds class instance |
|
| 13 | + * |
|
| 14 | + * @since 1.0.0 |
|
| 15 | + * |
|
| 16 | + * @var object \lsx_health_plan\classes\Woocommerce() |
|
| 17 | + */ |
|
| 18 | + protected static $instance = null; |
|
| 19 | 19 | |
| 20 | - /** |
|
| 21 | - * Constructor |
|
| 22 | - */ |
|
| 23 | - public function __construct() { |
|
| 24 | - add_filter( 'wpua_profile_title', array( $this, 'profile_title' ), 10, 1 ); |
|
| 25 | - } |
|
| 20 | + /** |
|
| 21 | + * Constructor |
|
| 22 | + */ |
|
| 23 | + public function __construct() { |
|
| 24 | + add_filter( 'wpua_profile_title', array( $this, 'profile_title' ), 10, 1 ); |
|
| 25 | + } |
|
| 26 | 26 | |
| 27 | - /** |
|
| 28 | - * Return an instance of this class. |
|
| 29 | - * |
|
| 30 | - * @since 1.0.0 |
|
| 31 | - * |
|
| 32 | - * @return object \lsx_health_plan\classes\Woocommerce() A single instance of this class. |
|
| 33 | - */ |
|
| 34 | - public static function get_instance() { |
|
| 35 | - // If the single instance hasn't been set, set it now. |
|
| 36 | - if ( null === self::$instance ) { |
|
| 37 | - self::$instance = new self(); |
|
| 38 | - } |
|
| 39 | - return self::$instance; |
|
| 40 | - } |
|
| 27 | + /** |
|
| 28 | + * Return an instance of this class. |
|
| 29 | + * |
|
| 30 | + * @since 1.0.0 |
|
| 31 | + * |
|
| 32 | + * @return object \lsx_health_plan\classes\Woocommerce() A single instance of this class. |
|
| 33 | + */ |
|
| 34 | + public static function get_instance() { |
|
| 35 | + // If the single instance hasn't been set, set it now. |
|
| 36 | + if ( null === self::$instance ) { |
|
| 37 | + self::$instance = new self(); |
|
| 38 | + } |
|
| 39 | + return self::$instance; |
|
| 40 | + } |
|
| 41 | 41 | |
| 42 | - /** |
|
| 43 | - * Changes the profile title |
|
| 44 | - * |
|
| 45 | - * @param string $title |
|
| 46 | - * @return string |
|
| 47 | - */ |
|
| 48 | - public function profile_title( $title ) { |
|
| 49 | - $title = '<h3>' . __( 'My Profile', 'lsx-health-plan' ) . '</h3>'; |
|
| 50 | - $title .= '<p class="tagline">' . __( 'Please upload an image of yourself in .jpeg format. Images should be square, to best fit the cropping area, and files sizes kept below 500kb.', 'lsx-health-plan' ) . '</p>'; |
|
| 51 | - return $title; |
|
| 52 | - } |
|
| 42 | + /** |
|
| 43 | + * Changes the profile title |
|
| 44 | + * |
|
| 45 | + * @param string $title |
|
| 46 | + * @return string |
|
| 47 | + */ |
|
| 48 | + public function profile_title( $title ) { |
|
| 49 | + $title = '<h3>' . __( 'My Profile', 'lsx-health-plan' ) . '</h3>'; |
|
| 50 | + $title .= '<p class="tagline">' . __( 'Please upload an image of yourself in .jpeg format. Images should be square, to best fit the cropping area, and files sizes kept below 500kb.', 'lsx-health-plan' ) . '</p>'; |
|
| 51 | + return $title; |
|
| 52 | + } |
|
| 53 | 53 | } |
@@ -21,7 +21,7 @@ discard block |
||
| 21 | 21 | * Constructor |
| 22 | 22 | */ |
| 23 | 23 | public function __construct() { |
| 24 | - add_filter( 'wpua_profile_title', array( $this, 'profile_title' ), 10, 1 ); |
|
| 24 | + add_filter('wpua_profile_title', array($this, 'profile_title'), 10, 1); |
|
| 25 | 25 | } |
| 26 | 26 | |
| 27 | 27 | /** |
@@ -33,7 +33,7 @@ discard block |
||
| 33 | 33 | */ |
| 34 | 34 | public static function get_instance() { |
| 35 | 35 | // If the single instance hasn't been set, set it now. |
| 36 | - if ( null === self::$instance ) { |
|
| 36 | + if (null === self::$instance) { |
|
| 37 | 37 | self::$instance = new self(); |
| 38 | 38 | } |
| 39 | 39 | return self::$instance; |
@@ -45,9 +45,9 @@ discard block |
||
| 45 | 45 | * @param string $title |
| 46 | 46 | * @return string |
| 47 | 47 | */ |
| 48 | - public function profile_title( $title ) { |
|
| 49 | - $title = '<h3>' . __( 'My Profile', 'lsx-health-plan' ) . '</h3>'; |
|
| 50 | - $title .= '<p class="tagline">' . __( 'Please upload an image of yourself in .jpeg format. Images should be square, to best fit the cropping area, and files sizes kept below 500kb.', 'lsx-health-plan' ) . '</p>'; |
|
| 48 | + public function profile_title($title) { |
|
| 49 | + $title = '<h3>' . __('My Profile', 'lsx-health-plan') . '</h3>'; |
|
| 50 | + $title .= '<p class="tagline">' . __('Please upload an image of yourself in .jpeg format. Images should be square, to best fit the cropping area, and files sizes kept below 500kb.', 'lsx-health-plan') . '</p>'; |
|
| 51 | 51 | return $title; |
| 52 | 52 | } |
| 53 | 53 | } |
@@ -8,65 +8,65 @@ |
||
| 8 | 8 | */ |
| 9 | 9 | class FacetWP { |
| 10 | 10 | |
| 11 | - /** |
|
| 12 | - * Holds class instance |
|
| 13 | - * |
|
| 14 | - * @var object \lsx_health_plan\classes\FacetWP() |
|
| 15 | - */ |
|
| 16 | - protected static $instance = null; |
|
| 11 | + /** |
|
| 12 | + * Holds class instance |
|
| 13 | + * |
|
| 14 | + * @var object \lsx_health_plan\classes\FacetWP() |
|
| 15 | + */ |
|
| 16 | + protected static $instance = null; |
|
| 17 | 17 | |
| 18 | - /** |
|
| 19 | - * Holds the indexer filters for the workouts. |
|
| 20 | - * |
|
| 21 | - * @var object \lsx_health_plan\classes\integrations\FacetWP\Workouts_Indexer() |
|
| 22 | - */ |
|
| 23 | - public $workouts = null; |
|
| 18 | + /** |
|
| 19 | + * Holds the indexer filters for the workouts. |
|
| 20 | + * |
|
| 21 | + * @var object \lsx_health_plan\classes\integrations\FacetWP\Workouts_Indexer() |
|
| 22 | + */ |
|
| 23 | + public $workouts = null; |
|
| 24 | 24 | |
| 25 | - /** |
|
| 26 | - * Constructor |
|
| 27 | - */ |
|
| 28 | - public function __construct() { |
|
| 29 | - $this->load_classes(); |
|
| 30 | - add_filter( 'facetwp_facet_sources', array( $this, 'register_sources' ) ); |
|
| 31 | - } |
|
| 25 | + /** |
|
| 26 | + * Constructor |
|
| 27 | + */ |
|
| 28 | + public function __construct() { |
|
| 29 | + $this->load_classes(); |
|
| 30 | + add_filter( 'facetwp_facet_sources', array( $this, 'register_sources' ) ); |
|
| 31 | + } |
|
| 32 | 32 | |
| 33 | - /** |
|
| 34 | - * Return an instance of this class. |
|
| 35 | - * |
|
| 36 | - * @since 1.0.0 |
|
| 37 | - * |
|
| 38 | - * @return object \lsx_health_plan\classes\FacetWP() A single instance of this class. |
|
| 39 | - */ |
|
| 40 | - public static function get_instance() { |
|
| 41 | - // If the single instance hasn't been set, set it now. |
|
| 42 | - if ( null === self::$instance ) { |
|
| 43 | - self::$instance = new self(); |
|
| 44 | - } |
|
| 45 | - return self::$instance; |
|
| 46 | - } |
|
| 33 | + /** |
|
| 34 | + * Return an instance of this class. |
|
| 35 | + * |
|
| 36 | + * @since 1.0.0 |
|
| 37 | + * |
|
| 38 | + * @return object \lsx_health_plan\classes\FacetWP() A single instance of this class. |
|
| 39 | + */ |
|
| 40 | + public static function get_instance() { |
|
| 41 | + // If the single instance hasn't been set, set it now. |
|
| 42 | + if ( null === self::$instance ) { |
|
| 43 | + self::$instance = new self(); |
|
| 44 | + } |
|
| 45 | + return self::$instance; |
|
| 46 | + } |
|
| 47 | 47 | |
| 48 | - /** |
|
| 49 | - * Loads the variable classes and the static classes. |
|
| 50 | - */ |
|
| 51 | - private function load_classes() { |
|
| 52 | - require_once LSX_HEALTH_PLAN_PATH . 'classes/integrations/facetwp/class-connected-plans.php'; |
|
| 53 | - $this->connected_plans = integrations\facetwp\Connected_Plans::get_instance(); |
|
| 54 | - } |
|
| 48 | + /** |
|
| 49 | + * Loads the variable classes and the static classes. |
|
| 50 | + */ |
|
| 51 | + private function load_classes() { |
|
| 52 | + require_once LSX_HEALTH_PLAN_PATH . 'classes/integrations/facetwp/class-connected-plans.php'; |
|
| 53 | + $this->connected_plans = integrations\facetwp\Connected_Plans::get_instance(); |
|
| 54 | + } |
|
| 55 | 55 | |
| 56 | - /** |
|
| 57 | - * Registers the custom sources. |
|
| 58 | - * |
|
| 59 | - * @param array $sources |
|
| 60 | - * @return array |
|
| 61 | - */ |
|
| 62 | - public function register_sources( $sources ) { |
|
| 63 | - $sources['lsx_health_plan'] = array( |
|
| 64 | - 'label' => __( 'LSX Health Plan', 'lsx-health-plan' ), |
|
| 65 | - 'choices' => array( |
|
| 66 | - 'lsx_hp/connected_plans' => 'Connected Plans', |
|
| 67 | - ), |
|
| 68 | - ); |
|
| 56 | + /** |
|
| 57 | + * Registers the custom sources. |
|
| 58 | + * |
|
| 59 | + * @param array $sources |
|
| 60 | + * @return array |
|
| 61 | + */ |
|
| 62 | + public function register_sources( $sources ) { |
|
| 63 | + $sources['lsx_health_plan'] = array( |
|
| 64 | + 'label' => __( 'LSX Health Plan', 'lsx-health-plan' ), |
|
| 65 | + 'choices' => array( |
|
| 66 | + 'lsx_hp/connected_plans' => 'Connected Plans', |
|
| 67 | + ), |
|
| 68 | + ); |
|
| 69 | 69 | |
| 70 | - return $sources; |
|
| 71 | - } |
|
| 70 | + return $sources; |
|
| 71 | + } |
|
| 72 | 72 | } |
@@ -8,95 +8,95 @@ |
||
| 8 | 8 | */ |
| 9 | 9 | class Woocommerce { |
| 10 | 10 | |
| 11 | - /** |
|
| 12 | - * Holds class instance |
|
| 13 | - * |
|
| 14 | - * @var object \lsx_health_plan\classes\Woocommerce() |
|
| 15 | - */ |
|
| 16 | - protected static $instance = null; |
|
| 11 | + /** |
|
| 12 | + * Holds class instance |
|
| 13 | + * |
|
| 14 | + * @var object \lsx_health_plan\classes\Woocommerce() |
|
| 15 | + */ |
|
| 16 | + protected static $instance = null; |
|
| 17 | 17 | |
| 18 | - /** |
|
| 19 | - * Holds class Account functionality |
|
| 20 | - * |
|
| 21 | - * @var object \lsx_health_plan\classes\integrations\woocommerce\Admin() |
|
| 22 | - */ |
|
| 23 | - public $admin = null; |
|
| 18 | + /** |
|
| 19 | + * Holds class Account functionality |
|
| 20 | + * |
|
| 21 | + * @var object \lsx_health_plan\classes\integrations\woocommerce\Admin() |
|
| 22 | + */ |
|
| 23 | + public $admin = null; |
|
| 24 | 24 | |
| 25 | - /** |
|
| 26 | - * Holds class Account functionality |
|
| 27 | - * |
|
| 28 | - * @var object \lsx_health_plan\classes\integrations\woocommerce\Account() |
|
| 29 | - */ |
|
| 30 | - public $account = null; |
|
| 25 | + /** |
|
| 26 | + * Holds class Account functionality |
|
| 27 | + * |
|
| 28 | + * @var object \lsx_health_plan\classes\integrations\woocommerce\Account() |
|
| 29 | + */ |
|
| 30 | + public $account = null; |
|
| 31 | 31 | |
| 32 | - /** |
|
| 33 | - * Holds class Plans functionality |
|
| 34 | - * |
|
| 35 | - * @var object \lsx_health_plan\classes\integrations\woocommerce\Plans() |
|
| 36 | - */ |
|
| 37 | - public $plans = null; |
|
| 32 | + /** |
|
| 33 | + * Holds class Plans functionality |
|
| 34 | + * |
|
| 35 | + * @var object \lsx_health_plan\classes\integrations\woocommerce\Plans() |
|
| 36 | + */ |
|
| 37 | + public $plans = null; |
|
| 38 | 38 | |
| 39 | - /** |
|
| 40 | - * Holds class Login functionality |
|
| 41 | - * |
|
| 42 | - * @var object \lsx_health_plan\classes\integrations\woocommerce\Login() |
|
| 43 | - */ |
|
| 44 | - public $login = null; |
|
| 39 | + /** |
|
| 40 | + * Holds class Login functionality |
|
| 41 | + * |
|
| 42 | + * @var object \lsx_health_plan\classes\integrations\woocommerce\Login() |
|
| 43 | + */ |
|
| 44 | + public $login = null; |
|
| 45 | 45 | |
| 46 | - /** |
|
| 47 | - * Holds class Checkout functionality |
|
| 48 | - * |
|
| 49 | - * @var object \lsx_health_plan\classes\integrations\woocommerce\Checkout() |
|
| 50 | - */ |
|
| 51 | - public $checkout = null; |
|
| 46 | + /** |
|
| 47 | + * Holds class Checkout functionality |
|
| 48 | + * |
|
| 49 | + * @var object \lsx_health_plan\classes\integrations\woocommerce\Checkout() |
|
| 50 | + */ |
|
| 51 | + public $checkout = null; |
|
| 52 | 52 | |
| 53 | - /** |
|
| 54 | - * Constructor |
|
| 55 | - */ |
|
| 56 | - public function __construct() { |
|
| 57 | - $this->load_classes(); |
|
| 58 | - $this->load_includes(); |
|
| 59 | - } |
|
| 53 | + /** |
|
| 54 | + * Constructor |
|
| 55 | + */ |
|
| 56 | + public function __construct() { |
|
| 57 | + $this->load_classes(); |
|
| 58 | + $this->load_includes(); |
|
| 59 | + } |
|
| 60 | 60 | |
| 61 | - /** |
|
| 62 | - * Return an instance of this class. |
|
| 63 | - * |
|
| 64 | - * @since 1.0.0 |
|
| 65 | - * |
|
| 66 | - * @return object \lsx_health_plan\classes\Woocommerce() A single instance of this class. |
|
| 67 | - */ |
|
| 68 | - public static function get_instance() { |
|
| 69 | - // If the single instance hasn't been set, set it now. |
|
| 70 | - if ( null === self::$instance ) { |
|
| 71 | - self::$instance = new self(); |
|
| 72 | - } |
|
| 73 | - return self::$instance; |
|
| 74 | - } |
|
| 61 | + /** |
|
| 62 | + * Return an instance of this class. |
|
| 63 | + * |
|
| 64 | + * @since 1.0.0 |
|
| 65 | + * |
|
| 66 | + * @return object \lsx_health_plan\classes\Woocommerce() A single instance of this class. |
|
| 67 | + */ |
|
| 68 | + public static function get_instance() { |
|
| 69 | + // If the single instance hasn't been set, set it now. |
|
| 70 | + if ( null === self::$instance ) { |
|
| 71 | + self::$instance = new self(); |
|
| 72 | + } |
|
| 73 | + return self::$instance; |
|
| 74 | + } |
|
| 75 | 75 | |
| 76 | - /** |
|
| 77 | - * Loads the variable classes and the static classes. |
|
| 78 | - */ |
|
| 79 | - private function load_classes() { |
|
| 80 | - require_once LSX_HEALTH_PLAN_PATH . 'classes/integrations/woocommerce/class-admin.php'; |
|
| 81 | - $this->admin = integrations\woocommerce\Admin::get_instance(); |
|
| 76 | + /** |
|
| 77 | + * Loads the variable classes and the static classes. |
|
| 78 | + */ |
|
| 79 | + private function load_classes() { |
|
| 80 | + require_once LSX_HEALTH_PLAN_PATH . 'classes/integrations/woocommerce/class-admin.php'; |
|
| 81 | + $this->admin = integrations\woocommerce\Admin::get_instance(); |
|
| 82 | 82 | |
| 83 | - require_once LSX_HEALTH_PLAN_PATH . 'classes/integrations/woocommerce/class-account.php'; |
|
| 84 | - $this->account = integrations\woocommerce\Account::get_instance(); |
|
| 83 | + require_once LSX_HEALTH_PLAN_PATH . 'classes/integrations/woocommerce/class-account.php'; |
|
| 84 | + $this->account = integrations\woocommerce\Account::get_instance(); |
|
| 85 | 85 | |
| 86 | - require_once LSX_HEALTH_PLAN_PATH . 'classes/integrations/woocommerce/class-plans.php'; |
|
| 87 | - $this->plans = integrations\woocommerce\Plans::get_instance(); |
|
| 86 | + require_once LSX_HEALTH_PLAN_PATH . 'classes/integrations/woocommerce/class-plans.php'; |
|
| 87 | + $this->plans = integrations\woocommerce\Plans::get_instance(); |
|
| 88 | 88 | |
| 89 | - require_once LSX_HEALTH_PLAN_PATH . 'classes/integrations/woocommerce/class-login.php'; |
|
| 90 | - $this->login = integrations\woocommerce\Login::get_instance(); |
|
| 89 | + require_once LSX_HEALTH_PLAN_PATH . 'classes/integrations/woocommerce/class-login.php'; |
|
| 90 | + $this->login = integrations\woocommerce\Login::get_instance(); |
|
| 91 | 91 | |
| 92 | - require_once LSX_HEALTH_PLAN_PATH . 'classes/integrations/woocommerce/class-checkout.php'; |
|
| 93 | - $this->checkout = integrations\woocommerce\Checkout::get_instance(); |
|
| 94 | - } |
|
| 95 | - /** |
|
| 96 | - * Loads the includes |
|
| 97 | - */ |
|
| 98 | - private function load_includes() { |
|
| 99 | - require_once LSX_HEALTH_PLAN_PATH . 'includes/functions/woocommerce.php'; |
|
| 100 | - require_once LSX_HEALTH_PLAN_PATH . 'includes/template-tags/woocommerce.php'; |
|
| 101 | - } |
|
| 92 | + require_once LSX_HEALTH_PLAN_PATH . 'classes/integrations/woocommerce/class-checkout.php'; |
|
| 93 | + $this->checkout = integrations\woocommerce\Checkout::get_instance(); |
|
| 94 | + } |
|
| 95 | + /** |
|
| 96 | + * Loads the includes |
|
| 97 | + */ |
|
| 98 | + private function load_includes() { |
|
| 99 | + require_once LSX_HEALTH_PLAN_PATH . 'includes/functions/woocommerce.php'; |
|
| 100 | + require_once LSX_HEALTH_PLAN_PATH . 'includes/template-tags/woocommerce.php'; |
|
| 101 | + } |
|
| 102 | 102 | } |
@@ -8,173 +8,173 @@ |
||
| 8 | 8 | */ |
| 9 | 9 | class Connected_Plans { |
| 10 | 10 | |
| 11 | - /** |
|
| 12 | - * Holds class instance |
|
| 13 | - * |
|
| 14 | - * @since 1.0.0 |
|
| 15 | - * |
|
| 16 | - * @var object \lsx_health_plan\classes\integrations\facetwp\Connected_Plans() |
|
| 17 | - */ |
|
| 18 | - protected static $instance = null; |
|
| 19 | - |
|
| 20 | - /** |
|
| 21 | - * This hold the current plan IDS, in case they need to be used in additional functions. |
|
| 22 | - * |
|
| 23 | - * @var array |
|
| 24 | - */ |
|
| 25 | - public $current_plan_ids = array(); |
|
| 26 | - |
|
| 27 | - /** |
|
| 28 | - * Constructor |
|
| 29 | - */ |
|
| 30 | - public function __construct() { |
|
| 31 | - //add_filter( 'facetwp_index_row', array( $this, 'facetwp_index_row' ), 10, 2 ); |
|
| 32 | - add_filter( 'facetwp_indexer_post_facet', array( $this, 'facetwp_indexer_post_facet' ), 10, 2 ); |
|
| 33 | - } |
|
| 34 | - |
|
| 35 | - /** |
|
| 36 | - * Return an instance of this class. |
|
| 37 | - * |
|
| 38 | - * @since 1.0.0 |
|
| 39 | - * |
|
| 40 | - * @return object \lsx_health_plan\classes\integration\facetwp\Connected_Plans() A single instance of this class. |
|
| 41 | - */ |
|
| 42 | - public static function get_instance() { |
|
| 43 | - // If the single instance hasn't been set, set it now. |
|
| 44 | - if ( null === self::$instance ) { |
|
| 45 | - self::$instance = new self(); |
|
| 46 | - } |
|
| 47 | - return self::$instance; |
|
| 48 | - } |
|
| 49 | - |
|
| 50 | - /** |
|
| 51 | - * Index the connected plan |
|
| 52 | - * |
|
| 53 | - * @param array $return |
|
| 54 | - * @param array $params |
|
| 55 | - * @return array |
|
| 56 | - */ |
|
| 57 | - public function facetwp_indexer_post_facet( $return, $params ) { |
|
| 58 | - $facet = $params['facet']; |
|
| 59 | - $source = isset( $facet['source'] ) ? $facet['source'] : ''; |
|
| 60 | - |
|
| 61 | - if ( 'lsx_hp/connected_plans' === $source ) { |
|
| 62 | - $post_type = get_post_type( $params['defaults']['post_id'] ); |
|
| 63 | - switch ( $post_type ) { |
|
| 64 | - case 'workout': |
|
| 65 | - $return = $this->index_connected_plans( $params['defaults'] ); |
|
| 66 | - $this->index_exercises( $params['defaults'] ); |
|
| 67 | - break; |
|
| 68 | - |
|
| 69 | - case 'recipe': |
|
| 70 | - $return = $this->index_connected_plans( $params['defaults'] ); |
|
| 71 | - break; |
|
| 72 | - |
|
| 73 | - case 'meal': |
|
| 74 | - $return = $this->index_connected_plans( $params['defaults'] ); |
|
| 75 | - break; |
|
| 76 | - |
|
| 77 | - default: |
|
| 78 | - break; |
|
| 79 | - } |
|
| 80 | - } |
|
| 81 | - |
|
| 82 | - // Reset the current plan ids array. |
|
| 83 | - $this->current_plan_ids = array(); |
|
| 84 | - return $return; |
|
| 85 | - } |
|
| 86 | - |
|
| 87 | - /** |
|
| 88 | - * Adds the connected plan to the list of rows. |
|
| 89 | - * |
|
| 90 | - * @param array $rows |
|
| 91 | - * @param array $params |
|
| 92 | - * @return boolean |
|
| 93 | - */ |
|
| 94 | - public function index_connected_plans( $row ) { |
|
| 95 | - $indexed = false; |
|
| 96 | - $top_level_plans = array(); |
|
| 97 | - // Get meals this exercise is connected to. |
|
| 98 | - $plans = get_post_meta( $row['post_id'], 'connected_plans', true ); |
|
| 99 | - |
|
| 100 | - if ( ! empty( $plans ) ) { |
|
| 101 | - $plan = end( $plans ); |
|
| 102 | - $has_parent = wp_get_post_parent_id( $plan ); |
|
| 103 | - if ( 0 === $has_parent ) { |
|
| 104 | - $top_level_plans[] = $plan; |
|
| 105 | - } elseif ( false !== $top_level_plans ) { |
|
| 106 | - $top_level_plans[] = $has_parent; |
|
| 107 | - } |
|
| 108 | - } |
|
| 109 | - if ( ! empty( $top_level_plans ) && ( '' !== $top_level_plans ) ) { |
|
| 110 | - $top_level_plans = array_unique( $top_level_plans ); |
|
| 111 | - $this->current_plan_ids = $top_level_plans; |
|
| 112 | - $indexed = true; |
|
| 113 | - foreach ( $top_level_plans as $plan_id ) { |
|
| 114 | - $row['facet_value'] = $plan_id; |
|
| 115 | - $row['facet_display_value'] = get_the_title( $plan_id ); |
|
| 116 | - FWP()->indexer->index_row( $row ); |
|
| 117 | - } |
|
| 118 | - } |
|
| 119 | - return $indexed; |
|
| 120 | - } |
|
| 121 | - |
|
| 122 | - /** |
|
| 123 | - * We index the exercises from the workouts. |
|
| 124 | - * |
|
| 125 | - * @param array $rows |
|
| 126 | - * @param array $params |
|
| 127 | - * @return void |
|
| 128 | - */ |
|
| 129 | - public function index_exercises( $row ) { |
|
| 130 | - if ( empty( $this->current_plan_ids ) ) { |
|
| 131 | - return; |
|
| 132 | - } |
|
| 133 | - $i = 1; |
|
| 134 | - $section_counter = 6; |
|
| 135 | - $unique_connections = array(); |
|
| 136 | - |
|
| 137 | - while ( $i <= $section_counter ) { |
|
| 138 | - // Here we grab the exercises and we add them to the index with the plan IDS. |
|
| 139 | - $groups = get_post_meta( $row['post_id'], 'workout_section_' . $i, true ); |
|
| 140 | - if ( ! empty( $groups ) ) { |
|
| 141 | - foreach ( $groups as $group ) { |
|
| 142 | - if ( isset( $group['connected_exercises'] ) && '' !== $group['connected_exercises'] ) { |
|
| 143 | - |
|
| 144 | - if ( ! is_array( $group['connected_exercises'] ) ) { |
|
| 145 | - $group['connected_exercises'] = array( $group['connected_exercises'] ); |
|
| 146 | - } |
|
| 147 | - |
|
| 148 | - // Loop through each exercise and add it to the plan. |
|
| 149 | - foreach ( $group['connected_exercises'] as $eid ) { |
|
| 150 | - $exercise_default = $row; |
|
| 151 | - $exercise_default['post_id'] = $eid; |
|
| 152 | - |
|
| 153 | - foreach ( $this->current_plan_ids as $plan_id ) { |
|
| 154 | - // Check to see if this connection has been added already. |
|
| 155 | - if ( isset( $unique_connections[ $eid . '_' . $plan_id ] ) ) { |
|
| 156 | - continue; |
|
| 157 | - } |
|
| 158 | - |
|
| 159 | - $title = get_the_title( $plan_id ); |
|
| 160 | - if ( ! empty( $title ) ) { |
|
| 161 | - $exercise_default['facet_value'] = $plan_id; |
|
| 162 | - $exercise_default['facet_display_value'] = $title; |
|
| 163 | - $unique_connections[ $eid . '_' . $plan_id ] = $exercise_default; |
|
| 164 | - } |
|
| 165 | - } |
|
| 166 | - } |
|
| 167 | - } |
|
| 168 | - } |
|
| 169 | - } |
|
| 170 | - $i++; |
|
| 171 | - } |
|
| 172 | - |
|
| 173 | - // If we have some unique connections, we index them. |
|
| 174 | - if ( ! empty( $unique_connections ) ) { |
|
| 175 | - foreach ( $unique_connections as $unique_row ) { |
|
| 176 | - FWP()->indexer->index_row( $unique_row ); |
|
| 177 | - } |
|
| 178 | - } |
|
| 179 | - } |
|
| 11 | + /** |
|
| 12 | + * Holds class instance |
|
| 13 | + * |
|
| 14 | + * @since 1.0.0 |
|
| 15 | + * |
|
| 16 | + * @var object \lsx_health_plan\classes\integrations\facetwp\Connected_Plans() |
|
| 17 | + */ |
|
| 18 | + protected static $instance = null; |
|
| 19 | + |
|
| 20 | + /** |
|
| 21 | + * This hold the current plan IDS, in case they need to be used in additional functions. |
|
| 22 | + * |
|
| 23 | + * @var array |
|
| 24 | + */ |
|
| 25 | + public $current_plan_ids = array(); |
|
| 26 | + |
|
| 27 | + /** |
|
| 28 | + * Constructor |
|
| 29 | + */ |
|
| 30 | + public function __construct() { |
|
| 31 | + //add_filter( 'facetwp_index_row', array( $this, 'facetwp_index_row' ), 10, 2 ); |
|
| 32 | + add_filter( 'facetwp_indexer_post_facet', array( $this, 'facetwp_indexer_post_facet' ), 10, 2 ); |
|
| 33 | + } |
|
| 34 | + |
|
| 35 | + /** |
|
| 36 | + * Return an instance of this class. |
|
| 37 | + * |
|
| 38 | + * @since 1.0.0 |
|
| 39 | + * |
|
| 40 | + * @return object \lsx_health_plan\classes\integration\facetwp\Connected_Plans() A single instance of this class. |
|
| 41 | + */ |
|
| 42 | + public static function get_instance() { |
|
| 43 | + // If the single instance hasn't been set, set it now. |
|
| 44 | + if ( null === self::$instance ) { |
|
| 45 | + self::$instance = new self(); |
|
| 46 | + } |
|
| 47 | + return self::$instance; |
|
| 48 | + } |
|
| 49 | + |
|
| 50 | + /** |
|
| 51 | + * Index the connected plan |
|
| 52 | + * |
|
| 53 | + * @param array $return |
|
| 54 | + * @param array $params |
|
| 55 | + * @return array |
|
| 56 | + */ |
|
| 57 | + public function facetwp_indexer_post_facet( $return, $params ) { |
|
| 58 | + $facet = $params['facet']; |
|
| 59 | + $source = isset( $facet['source'] ) ? $facet['source'] : ''; |
|
| 60 | + |
|
| 61 | + if ( 'lsx_hp/connected_plans' === $source ) { |
|
| 62 | + $post_type = get_post_type( $params['defaults']['post_id'] ); |
|
| 63 | + switch ( $post_type ) { |
|
| 64 | + case 'workout': |
|
| 65 | + $return = $this->index_connected_plans( $params['defaults'] ); |
|
| 66 | + $this->index_exercises( $params['defaults'] ); |
|
| 67 | + break; |
|
| 68 | + |
|
| 69 | + case 'recipe': |
|
| 70 | + $return = $this->index_connected_plans( $params['defaults'] ); |
|
| 71 | + break; |
|
| 72 | + |
|
| 73 | + case 'meal': |
|
| 74 | + $return = $this->index_connected_plans( $params['defaults'] ); |
|
| 75 | + break; |
|
| 76 | + |
|
| 77 | + default: |
|
| 78 | + break; |
|
| 79 | + } |
|
| 80 | + } |
|
| 81 | + |
|
| 82 | + // Reset the current plan ids array. |
|
| 83 | + $this->current_plan_ids = array(); |
|
| 84 | + return $return; |
|
| 85 | + } |
|
| 86 | + |
|
| 87 | + /** |
|
| 88 | + * Adds the connected plan to the list of rows. |
|
| 89 | + * |
|
| 90 | + * @param array $rows |
|
| 91 | + * @param array $params |
|
| 92 | + * @return boolean |
|
| 93 | + */ |
|
| 94 | + public function index_connected_plans( $row ) { |
|
| 95 | + $indexed = false; |
|
| 96 | + $top_level_plans = array(); |
|
| 97 | + // Get meals this exercise is connected to. |
|
| 98 | + $plans = get_post_meta( $row['post_id'], 'connected_plans', true ); |
|
| 99 | + |
|
| 100 | + if ( ! empty( $plans ) ) { |
|
| 101 | + $plan = end( $plans ); |
|
| 102 | + $has_parent = wp_get_post_parent_id( $plan ); |
|
| 103 | + if ( 0 === $has_parent ) { |
|
| 104 | + $top_level_plans[] = $plan; |
|
| 105 | + } elseif ( false !== $top_level_plans ) { |
|
| 106 | + $top_level_plans[] = $has_parent; |
|
| 107 | + } |
|
| 108 | + } |
|
| 109 | + if ( ! empty( $top_level_plans ) && ( '' !== $top_level_plans ) ) { |
|
| 110 | + $top_level_plans = array_unique( $top_level_plans ); |
|
| 111 | + $this->current_plan_ids = $top_level_plans; |
|
| 112 | + $indexed = true; |
|
| 113 | + foreach ( $top_level_plans as $plan_id ) { |
|
| 114 | + $row['facet_value'] = $plan_id; |
|
| 115 | + $row['facet_display_value'] = get_the_title( $plan_id ); |
|
| 116 | + FWP()->indexer->index_row( $row ); |
|
| 117 | + } |
|
| 118 | + } |
|
| 119 | + return $indexed; |
|
| 120 | + } |
|
| 121 | + |
|
| 122 | + /** |
|
| 123 | + * We index the exercises from the workouts. |
|
| 124 | + * |
|
| 125 | + * @param array $rows |
|
| 126 | + * @param array $params |
|
| 127 | + * @return void |
|
| 128 | + */ |
|
| 129 | + public function index_exercises( $row ) { |
|
| 130 | + if ( empty( $this->current_plan_ids ) ) { |
|
| 131 | + return; |
|
| 132 | + } |
|
| 133 | + $i = 1; |
|
| 134 | + $section_counter = 6; |
|
| 135 | + $unique_connections = array(); |
|
| 136 | + |
|
| 137 | + while ( $i <= $section_counter ) { |
|
| 138 | + // Here we grab the exercises and we add them to the index with the plan IDS. |
|
| 139 | + $groups = get_post_meta( $row['post_id'], 'workout_section_' . $i, true ); |
|
| 140 | + if ( ! empty( $groups ) ) { |
|
| 141 | + foreach ( $groups as $group ) { |
|
| 142 | + if ( isset( $group['connected_exercises'] ) && '' !== $group['connected_exercises'] ) { |
|
| 143 | + |
|
| 144 | + if ( ! is_array( $group['connected_exercises'] ) ) { |
|
| 145 | + $group['connected_exercises'] = array( $group['connected_exercises'] ); |
|
| 146 | + } |
|
| 147 | + |
|
| 148 | + // Loop through each exercise and add it to the plan. |
|
| 149 | + foreach ( $group['connected_exercises'] as $eid ) { |
|
| 150 | + $exercise_default = $row; |
|
| 151 | + $exercise_default['post_id'] = $eid; |
|
| 152 | + |
|
| 153 | + foreach ( $this->current_plan_ids as $plan_id ) { |
|
| 154 | + // Check to see if this connection has been added already. |
|
| 155 | + if ( isset( $unique_connections[ $eid . '_' . $plan_id ] ) ) { |
|
| 156 | + continue; |
|
| 157 | + } |
|
| 158 | + |
|
| 159 | + $title = get_the_title( $plan_id ); |
|
| 160 | + if ( ! empty( $title ) ) { |
|
| 161 | + $exercise_default['facet_value'] = $plan_id; |
|
| 162 | + $exercise_default['facet_display_value'] = $title; |
|
| 163 | + $unique_connections[ $eid . '_' . $plan_id ] = $exercise_default; |
|
| 164 | + } |
|
| 165 | + } |
|
| 166 | + } |
|
| 167 | + } |
|
| 168 | + } |
|
| 169 | + } |
|
| 170 | + $i++; |
|
| 171 | + } |
|
| 172 | + |
|
| 173 | + // If we have some unique connections, we index them. |
|
| 174 | + if ( ! empty( $unique_connections ) ) { |
|
| 175 | + foreach ( $unique_connections as $unique_row ) { |
|
| 176 | + FWP()->indexer->index_row( $unique_row ); |
|
| 177 | + } |
|
| 178 | + } |
|
| 179 | + } |
|
| 180 | 180 | } |
@@ -10,186 +10,186 @@ discard block |
||
| 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 | - * Constructor |
|
| 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 | + * Constructor |
|
| 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 |
||
| 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 | } |
@@ -37,14 +37,14 @@ discard block |
||
| 37 | 37 | * Constructor |
| 38 | 38 | */ |
| 39 | 39 | public function __construct() { |
| 40 | - add_filter( 'cmb2_enqueue_css', array( $this, 'disable_cmb2_styles' ), 1, 1 ); |
|
| 41 | - add_action( 'cmb2_before_form', array( $this, 'generate_navigation' ), 10, 4 ); |
|
| 42 | - add_action( 'cmb2_before_title_field_row', array( $this, 'output_tab_open_div' ), 10, 1 ); |
|
| 43 | - add_action( 'cmb2_after_tab_closing_field_row', array( $this, 'output_tab_closing_div' ), 10, 1 ); |
|
| 44 | - add_action( 'cmb2_render_tab_closing', array( $this, 'cmb2_render_callback_for_tab_closing' ), 10, 5 ); |
|
| 45 | - add_filter( 'cmb2_sanitize_tab_closing', array( $this, 'cmb2_sanitize_tab_closing_callback' ), 10, 2 ); |
|
| 46 | - add_action( 'cmb2_after_form', array( $this, 'navigation_js' ), 10, 4 ); |
|
| 47 | - add_filter( 'cmb2_options_page_redirect_url', array( $this, 'add_tab_argument' ), 10, 1 ); |
|
| 40 | + add_filter('cmb2_enqueue_css', array($this, 'disable_cmb2_styles'), 1, 1); |
|
| 41 | + add_action('cmb2_before_form', array($this, 'generate_navigation'), 10, 4); |
|
| 42 | + add_action('cmb2_before_title_field_row', array($this, 'output_tab_open_div'), 10, 1); |
|
| 43 | + add_action('cmb2_after_tab_closing_field_row', array($this, 'output_tab_closing_div'), 10, 1); |
|
| 44 | + add_action('cmb2_render_tab_closing', array($this, 'cmb2_render_callback_for_tab_closing'), 10, 5); |
|
| 45 | + add_filter('cmb2_sanitize_tab_closing', array($this, 'cmb2_sanitize_tab_closing_callback'), 10, 2); |
|
| 46 | + add_action('cmb2_after_form', array($this, 'navigation_js'), 10, 4); |
|
| 47 | + add_filter('cmb2_options_page_redirect_url', array($this, 'add_tab_argument'), 10, 1); |
|
| 48 | 48 | } |
| 49 | 49 | |
| 50 | 50 | /** |
@@ -56,7 +56,7 @@ discard block |
||
| 56 | 56 | */ |
| 57 | 57 | public static function get_instance() { |
| 58 | 58 | // If the single instance hasn't been set, set it now. |
| 59 | - if ( null == self::$instance ) { |
|
| 59 | + if (null == self::$instance) { |
|
| 60 | 60 | self::$instance = new self(); |
| 61 | 61 | } |
| 62 | 62 | return self::$instance; |
@@ -67,10 +67,10 @@ discard block |
||
| 67 | 67 | * |
| 68 | 68 | * @return bool $enabled Whether to enable (enqueue) styles. |
| 69 | 69 | */ |
| 70 | - public function disable_cmb2_styles( $enabled ) { |
|
| 71 | - if ( is_admin() ) { |
|
| 70 | + public function disable_cmb2_styles($enabled) { |
|
| 71 | + if (is_admin()) { |
|
| 72 | 72 | $current_screen = get_current_screen(); |
| 73 | - if ( is_object( $current_screen ) && 'plan_page_lsx_health_plan_options' === $current_screen->id ) { |
|
| 73 | + if (is_object($current_screen) && 'plan_page_lsx_health_plan_options' === $current_screen->id) { |
|
| 74 | 74 | $enabled = false; |
| 75 | 75 | } |
| 76 | 76 | } |
@@ -86,14 +86,14 @@ discard block |
||
| 86 | 86 | * @param object $cmb2_obj |
| 87 | 87 | * @return void |
| 88 | 88 | */ |
| 89 | - public function generate_navigation( $cmb_id, $object_id, $object_type, $cmb2_obj ) { |
|
| 90 | - if ( 'lsx_health_plan_settings' === $cmb_id && 'lsx_health_plan_options' === $object_id && 'options-page' === $object_type ) { |
|
| 89 | + public function generate_navigation($cmb_id, $object_id, $object_type, $cmb2_obj) { |
|
| 90 | + if ('lsx_health_plan_settings' === $cmb_id && 'lsx_health_plan_options' === $object_id && 'options-page' === $object_type) { |
|
| 91 | 91 | $this->navigation = array(); |
| 92 | 92 | $this->is_options_page = true; |
| 93 | - if ( isset( $cmb2_obj->meta_box['fields'] ) && ! empty( $cmb2_obj->meta_box['fields'] ) ) { |
|
| 94 | - foreach ( $cmb2_obj->meta_box['fields'] as $field_index => $field ) { |
|
| 95 | - if ( 'title' === $field['type'] ) { |
|
| 96 | - $this->navigation[ $field_index ] = $field['name']; |
|
| 93 | + if (isset($cmb2_obj->meta_box['fields']) && ! empty($cmb2_obj->meta_box['fields'])) { |
|
| 94 | + foreach ($cmb2_obj->meta_box['fields'] as $field_index => $field) { |
|
| 95 | + if ('title' === $field['type']) { |
|
| 96 | + $this->navigation[$field_index] = $field['name']; |
|
| 97 | 97 | } |
| 98 | 98 | } |
| 99 | 99 | } |
@@ -107,32 +107,32 @@ discard block |
||
| 107 | 107 | * @return void |
| 108 | 108 | */ |
| 109 | 109 | public function output_navigation() { |
| 110 | - if ( ! empty( $this->navigation ) ) { |
|
| 110 | + if ( ! empty($this->navigation)) { |
|
| 111 | 111 | ?> |
| 112 | 112 | <div class="wp-filter hide-if-no-js"> |
| 113 | 113 | <ul class="filter-links"> |
| 114 | 114 | <?php |
| 115 | 115 | $first_tab = true; |
| 116 | - $total = count( $this->navigation ); |
|
| 116 | + $total = count($this->navigation); |
|
| 117 | 117 | $count = 0; |
| 118 | 118 | $separator = ' |'; |
| 119 | 119 | $selected_tab = ''; |
| 120 | - if ( isset( $_GET['cmb_tab'] ) && '' !== $_GET['cmb_tab'] ) { |
|
| 121 | - $selected_tab = sanitize_text_field( $_GET['cmb_tab'] ); |
|
| 120 | + if (isset($_GET['cmb_tab']) && '' !== $_GET['cmb_tab']) { |
|
| 121 | + $selected_tab = sanitize_text_field($_GET['cmb_tab']); |
|
| 122 | 122 | $selected_tab = 'settings_' . $selected_tab; |
| 123 | 123 | } |
| 124 | - foreach ( $this->navigation as $key => $label ) { |
|
| 124 | + foreach ($this->navigation as $key => $label) { |
|
| 125 | 125 | $count++; |
| 126 | 126 | $current_css = ''; |
| 127 | - if ( ( true === $first_tab && '' === $selected_tab ) || $key === $selected_tab ) { |
|
| 127 | + if ((true === $first_tab && '' === $selected_tab) || $key === $selected_tab) { |
|
| 128 | 128 | $first_tab = false; |
| 129 | 129 | $current_css = 'current'; |
| 130 | 130 | } |
| 131 | - if ( $count === $total ) { |
|
| 131 | + if ($count === $total) { |
|
| 132 | 132 | $separator = ''; |
| 133 | 133 | } |
| 134 | 134 | ?> |
| 135 | - <li><a href="#" class="<?php echo esc_attr( $current_css ); ?>" data-sort="<?php echo esc_attr( $key ); ?>_tab"><?php echo esc_attr( $label ); ?></a><?php echo esc_attr( $separator ); ?></li> |
|
| 135 | + <li><a href="#" class="<?php echo esc_attr($current_css); ?>" data-sort="<?php echo esc_attr($key); ?>_tab"><?php echo esc_attr($label); ?></a><?php echo esc_attr($separator); ?></li> |
|
| 136 | 136 | <?php |
| 137 | 137 | } |
| 138 | 138 | ?> |
@@ -148,10 +148,10 @@ discard block |
||
| 148 | 148 | * @param object $field CMB2_Field(); |
| 149 | 149 | * @return void |
| 150 | 150 | */ |
| 151 | - public function output_tab_open_div( $field ) { |
|
| 152 | - if ( true === $this->is_options_page && isset( $field->args['type'] ) && 'title' === $field->args['type'] ) { |
|
| 151 | + public function output_tab_open_div($field) { |
|
| 152 | + if (true === $this->is_options_page && isset($field->args['type']) && 'title' === $field->args['type']) { |
|
| 153 | 153 | ?> |
| 154 | - <div id="<?php echo esc_attr( $field->args['id'] ); ?>_tab" class="tab tab-nav hidden"> |
|
| 154 | + <div id="<?php echo esc_attr($field->args['id']); ?>_tab" class="tab tab-nav hidden"> |
|
| 155 | 155 | <?php |
| 156 | 156 | } |
| 157 | 157 | } |
@@ -162,19 +162,19 @@ discard block |
||
| 162 | 162 | * @param object $field CMB2_Field(); |
| 163 | 163 | * @return void |
| 164 | 164 | */ |
| 165 | - public function output_tab_closing_div( $field ) { |
|
| 166 | - if ( true === $this->is_options_page && isset( $field->args['type'] ) && 'tab_closing' === $field->args['type'] ) { |
|
| 165 | + public function output_tab_closing_div($field) { |
|
| 166 | + if (true === $this->is_options_page && isset($field->args['type']) && 'tab_closing' === $field->args['type']) { |
|
| 167 | 167 | ?> |
| 168 | 168 | </div> |
| 169 | 169 | <?php |
| 170 | 170 | } |
| 171 | 171 | } |
| 172 | 172 | |
| 173 | - public function cmb2_render_callback_for_tab_closing( $field, $escaped_value, $object_id, $object_type, $field_type_object ) { |
|
| 173 | + public function cmb2_render_callback_for_tab_closing($field, $escaped_value, $object_id, $object_type, $field_type_object) { |
|
| 174 | 174 | return; |
| 175 | 175 | } |
| 176 | 176 | |
| 177 | - public function cmb2_sanitize_tab_closing_callback( $override_value, $value ) { |
|
| 177 | + public function cmb2_sanitize_tab_closing_callback($override_value, $value) { |
|
| 178 | 178 | return ''; |
| 179 | 179 | } |
| 180 | 180 | |
@@ -187,8 +187,8 @@ discard block |
||
| 187 | 187 | * @param object $cmb2_obj |
| 188 | 188 | * @return void |
| 189 | 189 | */ |
| 190 | - public function navigation_js( $cmb_id, $object_id, $object_type, $cmb2_obj ) { |
|
| 191 | - if ( 'lsx_health_plan_settings' === $cmb_id && 'lsx_health_plan_options' === $object_id && 'options-page' === $object_type ) { |
|
| 190 | + public function navigation_js($cmb_id, $object_id, $object_type, $cmb2_obj) { |
|
| 191 | + if ('lsx_health_plan_settings' === $cmb_id && 'lsx_health_plan_options' === $object_id && 'options-page' === $object_type) { |
|
| 192 | 192 | ?> |
| 193 | 193 | <script> |
| 194 | 194 | var LSX_HP_CMB2 = Object.create( null ); |
@@ -270,14 +270,14 @@ discard block |
||
| 270 | 270 | * @param string $url |
| 271 | 271 | * @return void |
| 272 | 272 | */ |
| 273 | - public function add_tab_argument( $url ) { |
|
| 274 | - if ( isset( $_POST['cmb_tab'] ) && '' !== $_POST['cmb_tab'] ) { // @codingStandardsIgnoreLine |
|
| 275 | - $tab_selection = sanitize_text_field( $_POST['cmb_tab'] ); // @codingStandardsIgnoreLine |
|
| 276 | - $tab_selection = str_replace( array( 'settings_', '_tab' ), '', $tab_selection ); // @codingStandardsIgnoreLine |
|
| 277 | - if ( 'single' !== $tab_selection ) { |
|
| 278 | - $url = add_query_arg( 'cmb_tab', $tab_selection, $url ); |
|
| 273 | + public function add_tab_argument($url) { |
|
| 274 | + if (isset($_POST['cmb_tab']) && '' !== $_POST['cmb_tab']) { // @codingStandardsIgnoreLine |
|
| 275 | + $tab_selection = sanitize_text_field($_POST['cmb_tab']); // @codingStandardsIgnoreLine |
|
| 276 | + $tab_selection = str_replace(array('settings_', '_tab'), '', $tab_selection); // @codingStandardsIgnoreLine |
|
| 277 | + if ('single' !== $tab_selection) { |
|
| 278 | + $url = add_query_arg('cmb_tab', $tab_selection, $url); |
|
| 279 | 279 | } else { |
| 280 | - $url = remove_query_arg( 'cmb_tab', $url ); |
|
| 280 | + $url = remove_query_arg('cmb_tab', $url); |
|
| 281 | 281 | } |
| 282 | 282 | } |
| 283 | 283 | return $url; |
@@ -12,125 +12,125 @@ discard block |
||
| 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 | - * Constructor |
|
| 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 | + * Constructor |
|
| 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 |
||
| 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 | } |
@@ -32,11 +32,11 @@ discard block |
||
| 32 | 32 | * Constructor |
| 33 | 33 | */ |
| 34 | 34 | public function __construct() { |
| 35 | - add_action( 'admin_enqueue_scripts', array( $this, 'assets' ) ); |
|
| 36 | - add_action( 'admin_menu', array( $this, 'register_menu' ) ); |
|
| 37 | - add_action( 'lsx_hp_help', array( $this, 'header' ), 10 ); |
|
| 38 | - add_action( 'lsx_hp_help', array( $this, 'body' ), 20 ); |
|
| 39 | - add_action( 'lsx_hp_help', array( $this, 'footer' ), 30 ); |
|
| 35 | + add_action('admin_enqueue_scripts', array($this, 'assets')); |
|
| 36 | + add_action('admin_menu', array($this, 'register_menu')); |
|
| 37 | + add_action('lsx_hp_help', array($this, 'header'), 10); |
|
| 38 | + add_action('lsx_hp_help', array($this, 'body'), 20); |
|
| 39 | + add_action('lsx_hp_help', array($this, 'footer'), 30); |
|
| 40 | 40 | } |
| 41 | 41 | |
| 42 | 42 | /** |
@@ -48,7 +48,7 @@ discard block |
||
| 48 | 48 | */ |
| 49 | 49 | public static function get_instance() { |
| 50 | 50 | // If the single instance hasn't been set, set it now. |
| 51 | - if ( null === self::$instance ) { |
|
| 51 | + if (null === self::$instance) { |
|
| 52 | 52 | self::$instance = new self(); |
| 53 | 53 | } |
| 54 | 54 | return self::$instance; |
@@ -64,10 +64,10 @@ discard block |
||
| 64 | 64 | * |
| 65 | 65 | * @param string $hook_suffix the current page hook suffix. |
| 66 | 66 | */ |
| 67 | - public function assets( $hook_suffix ) { |
|
| 68 | - if ( 'plan_page_help' === $hook_suffix ) { |
|
| 69 | - wp_enqueue_style( 'lsx-hp-help-screen', get_template_directory_uri() . '/assets/css/admin/help.css', array(), LSX_VERSION ); |
|
| 70 | - wp_style_add_data( 'lsx-hp-help-screen', 'rtl', 'replace' ); |
|
| 67 | + public function assets($hook_suffix) { |
|
| 68 | + if ('plan_page_help' === $hook_suffix) { |
|
| 69 | + wp_enqueue_style('lsx-hp-help-screen', get_template_directory_uri() . '/assets/css/admin/help.css', array(), LSX_VERSION); |
|
| 70 | + wp_style_add_data('lsx-hp-help-screen', 'rtl', 'replace'); |
|
| 71 | 71 | } |
| 72 | 72 | } |
| 73 | 73 | |
@@ -78,7 +78,7 @@ discard block |
||
| 78 | 78 | * @subpackage hp-help-page |
| 79 | 79 | */ |
| 80 | 80 | public function register_menu() { |
| 81 | - add_submenu_page( 'edit.php?post_type=plan', __( 'Help', 'lsx-health-plan' ), __( 'Help', 'lsx-health-plan' ), 'manage_options', 'help', array( $this, 'screen' ) ); |
|
| 81 | + add_submenu_page('edit.php?post_type=plan', __('Help', 'lsx-health-plan'), __('Help', 'lsx-health-plan'), 'manage_options', 'help', array($this, 'screen')); |
|
| 82 | 82 | } |
| 83 | 83 | |
| 84 | 84 | |
@@ -102,7 +102,7 @@ discard block |
||
| 102 | 102 | * @hooked lsx_hp_help_body - 20 |
| 103 | 103 | * @hooked lsx_hp_help_footer - 30 |
| 104 | 104 | */ |
| 105 | - do_action( 'lsx_hp_help' ); |
|
| 105 | + do_action('lsx_hp_help'); |
|
| 106 | 106 | ?> |
| 107 | 107 | </div> |
| 108 | 108 | <?php |
@@ -117,8 +117,8 @@ discard block |
||
| 117 | 117 | public function header() { |
| 118 | 118 | ?> |
| 119 | 119 | <div class="box enrich"> |
| 120 | - <h2><?php esc_html_e( 'Built to enrich your WordPress experience.', 'lsx-health-plan' ); ?></h2> |
|
| 121 | - <p><?php esc_html_e( 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Mauris iaculis feugiat consectetur. Integer mollis ex lacus, sed ultrices felis mollis vitae.', 'lsx-health-plan' ); ?></p> |
|
| 120 | + <h2><?php esc_html_e('Built to enrich your WordPress experience.', 'lsx-health-plan'); ?></h2> |
|
| 121 | + <p><?php esc_html_e('Lorem ipsum dolor sit amet, consectetur adipiscing elit. Mauris iaculis feugiat consectetur. Integer mollis ex lacus, sed ultrices felis mollis vitae.', 'lsx-health-plan'); ?></p> |
|
| 122 | 122 | </div> |
| 123 | 123 | <?php |
| 124 | 124 | } |
@@ -12,52 +12,52 @@ |
||
| 12 | 12 | */ |
| 13 | 13 | class Exercise { |
| 14 | 14 | |
| 15 | - /** |
|
| 16 | - * Holds class instance |
|
| 17 | - * |
|
| 18 | - * @since 1.0.0 |
|
| 19 | - * |
|
| 20 | - * @var object \lsx_health_plan\classes\admin\Exercise() |
|
| 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\Exercise() |
|
| 21 | + */ |
|
| 22 | + protected static $instance = null; |
|
| 23 | 23 | |
| 24 | - /** |
|
| 25 | - * Constructor |
|
| 26 | - */ |
|
| 27 | - public function __construct() { |
|
| 28 | - add_action( 'lsx_hp_settings_page_exercise_top', array( $this, 'settings' ), 1, 1 ); |
|
| 29 | - } |
|
| 24 | + /** |
|
| 25 | + * Constructor |
|
| 26 | + */ |
|
| 27 | + public function __construct() { |
|
| 28 | + add_action( 'lsx_hp_settings_page_exercise_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\Exercise() 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\Exercise() 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 | - 'id' => 'exercise_archive_description', |
|
| 56 | - 'type' => 'wysiwyg', |
|
| 57 | - 'name' => __( 'Archive Description', 'lsx-health-plan' ), |
|
| 58 | - 'description' => __( 'This will show up on the post type archive.', 'lsx-health-plan' ), |
|
| 59 | - ) |
|
| 60 | - ); |
|
| 61 | - } |
|
| 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 | + 'id' => 'exercise_archive_description', |
|
| 56 | + 'type' => 'wysiwyg', |
|
| 57 | + 'name' => __( 'Archive Description', 'lsx-health-plan' ), |
|
| 58 | + 'description' => __( 'This will show up on the post type archive.', 'lsx-health-plan' ), |
|
| 59 | + ) |
|
| 60 | + ); |
|
| 61 | + } |
|
| 62 | 62 | } |
| 63 | 63 | Exercise::get_instance(); |
@@ -25,7 +25,7 @@ discard block |
||
| 25 | 25 | * Constructor |
| 26 | 26 | */ |
| 27 | 27 | public function __construct() { |
| 28 | - add_action( 'lsx_hp_settings_page_exercise_top', array( $this, 'settings' ), 1, 1 ); |
|
| 28 | + add_action('lsx_hp_settings_page_exercise_top', array($this, 'settings'), 1, 1); |
|
| 29 | 29 | } |
| 30 | 30 | |
| 31 | 31 | /** |
@@ -37,7 +37,7 @@ discard block |
||
| 37 | 37 | */ |
| 38 | 38 | public static function get_instance() { |
| 39 | 39 | // If the single instance hasn't been set, set it now. |
| 40 | - if ( null === self::$instance ) { |
|
| 40 | + if (null === self::$instance) { |
|
| 41 | 41 | self::$instance = new self(); |
| 42 | 42 | } |
| 43 | 43 | return self::$instance; |
@@ -49,13 +49,13 @@ discard block |
||
| 49 | 49 | * @param object $cmb new_cmb2_box(). |
| 50 | 50 | * @return void |
| 51 | 51 | */ |
| 52 | - public function settings( $cmb ) { |
|
| 52 | + public function settings($cmb) { |
|
| 53 | 53 | $cmb->add_field( |
| 54 | 54 | array( |
| 55 | 55 | 'id' => 'exercise_archive_description', |
| 56 | 56 | 'type' => 'wysiwyg', |
| 57 | - 'name' => __( 'Archive Description', 'lsx-health-plan' ), |
|
| 58 | - 'description' => __( 'This will show up on the post type archive.', 'lsx-health-plan' ), |
|
| 57 | + 'name' => __('Archive Description', 'lsx-health-plan'), |
|
| 58 | + 'description' => __('This will show up on the post type archive.', 'lsx-health-plan'), |
|
| 59 | 59 | ) |
| 60 | 60 | ); |
| 61 | 61 | } |