@@ -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 | } |
@@ -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 | } |
@@ -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(); |
@@ -12,115 +12,115 @@ |
||
| 12 | 12 | */ |
| 13 | 13 | class Workout { |
| 14 | 14 | |
| 15 | - /** |
|
| 16 | - * Holds class instance |
|
| 17 | - * |
|
| 18 | - * @since 1.0.0 |
|
| 19 | - * |
|
| 20 | - * @var object \lsx_health_plan\classes\admin\Workout() |
|
| 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\Workout() |
|
| 21 | + */ |
|
| 22 | + protected static $instance = null; |
|
| 23 | 23 | |
| 24 | - /** |
|
| 25 | - * Constructor |
|
| 26 | - */ |
|
| 27 | - public function __construct() { |
|
| 28 | - add_action( 'lsx_hp_settings_page_workout_top', array( $this, 'settings' ), 1, 1 ); |
|
| 29 | - } |
|
| 24 | + /** |
|
| 25 | + * Constructor |
|
| 26 | + */ |
|
| 27 | + public function __construct() { |
|
| 28 | + add_action( 'lsx_hp_settings_page_workout_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\Workout() 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\Workout() 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' => 'workout_tab_layout', |
|
| 56 | - 'type' => 'select', |
|
| 57 | - 'name' => __( 'Workout Tab Layout', 'lsx-health-plan' ), |
|
| 58 | - 'description' => __( 'Choose the layout for the workouts.', 'lsx-health-plan' ), |
|
| 59 | - 'options' => array( |
|
| 60 | - 'table' => __( 'Table', 'lsx-health-plan' ), |
|
| 61 | - 'list' => __( 'List', 'lsx-health-plan' ), |
|
| 62 | - 'grid' => __( 'Grid', 'lsx-health-plan' ), |
|
| 63 | - ), |
|
| 64 | - ) |
|
| 65 | - ); |
|
| 66 | - $cmb->add_field( |
|
| 67 | - array( |
|
| 68 | - 'id' => 'workout_tab_link', |
|
| 69 | - 'type' => 'select', |
|
| 70 | - 'name' => __( 'Workout Tab Link', 'lsx-health-plan' ), |
|
| 71 | - 'description' => __( 'Choose to show the excerpt, full content or nothing.', 'lsx-health-plan' ), |
|
| 72 | - 'options' => array( |
|
| 73 | - '' => __( 'None', 'lsx-health-plan' ), |
|
| 74 | - 'single' => __( 'Single', 'lsx-health-plan' ), |
|
| 75 | - 'modal' => __( 'Modal', 'lsx-health-plan' ), |
|
| 76 | - ), |
|
| 77 | - 'default' => 'modal', |
|
| 78 | - ) |
|
| 79 | - ); |
|
| 80 | - $cmb->add_field( |
|
| 81 | - array( |
|
| 82 | - 'id' => 'workout_tab_modal_content', |
|
| 83 | - 'type' => 'select', |
|
| 84 | - 'name' => __( 'Modal Content', 'lsx-health-plan' ), |
|
| 85 | - 'description' => __( 'Choose to show the excerpt, full content or nothing. For the modal content only', 'lsx-health-plan' ), |
|
| 86 | - 'options' => array( |
|
| 87 | - '' => __( 'None', 'lsx-health-plan' ), |
|
| 88 | - 'excerpt' => __( 'Excerpt', 'lsx-health-plan' ), |
|
| 89 | - 'full' => __( 'Full Content', 'lsx-health-plan' ), |
|
| 90 | - ), |
|
| 91 | - 'default' => '', |
|
| 92 | - ) |
|
| 93 | - ); |
|
| 94 | - $cmb->add_field( |
|
| 95 | - array( |
|
| 96 | - 'id' => 'workout_tab_columns', |
|
| 97 | - 'type' => 'select', |
|
| 98 | - 'name' => __( 'Grid Columns', 'lsx-health-plan' ), |
|
| 99 | - 'description' => __( 'If you are displaying a grid, set the amount of columns you want to use.', 'lsx-health-plan' ), |
|
| 100 | - 'options' => array( |
|
| 101 | - '12' => __( '1', 'lsx-health-plan' ), |
|
| 102 | - '6' => __( '2', 'lsx-health-plan' ), |
|
| 103 | - '4' => __( '3', 'lsx-health-plan' ), |
|
| 104 | - '3' => __( '4', 'lsx-health-plan' ), |
|
| 105 | - '2' => __( '6', 'lsx-health-plan' ), |
|
| 106 | - ), |
|
| 107 | - 'default' => '4', |
|
| 108 | - ) |
|
| 109 | - ); |
|
| 110 | - $cmb->add_field( |
|
| 111 | - array( |
|
| 112 | - 'id' => 'workout_tab_content', |
|
| 113 | - 'type' => 'select', |
|
| 114 | - 'name' => __( 'Grid Content', 'lsx-health-plan' ), |
|
| 115 | - 'description' => __( 'Choose to show the excerpt, full content or nothing. For the grid layout only', 'lsx-health-plan' ), |
|
| 116 | - 'options' => array( |
|
| 117 | - '' => __( 'None', 'lsx-health-plan' ), |
|
| 118 | - 'excerpt' => __( 'Excerpt', 'lsx-health-plan' ), |
|
| 119 | - 'full' => __( 'Full Content', 'lsx-health-plan' ), |
|
| 120 | - ), |
|
| 121 | - 'default' => '', |
|
| 122 | - ) |
|
| 123 | - ); |
|
| 124 | - } |
|
| 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' => 'workout_tab_layout', |
|
| 56 | + 'type' => 'select', |
|
| 57 | + 'name' => __( 'Workout Tab Layout', 'lsx-health-plan' ), |
|
| 58 | + 'description' => __( 'Choose the layout for the workouts.', 'lsx-health-plan' ), |
|
| 59 | + 'options' => array( |
|
| 60 | + 'table' => __( 'Table', 'lsx-health-plan' ), |
|
| 61 | + 'list' => __( 'List', 'lsx-health-plan' ), |
|
| 62 | + 'grid' => __( 'Grid', 'lsx-health-plan' ), |
|
| 63 | + ), |
|
| 64 | + ) |
|
| 65 | + ); |
|
| 66 | + $cmb->add_field( |
|
| 67 | + array( |
|
| 68 | + 'id' => 'workout_tab_link', |
|
| 69 | + 'type' => 'select', |
|
| 70 | + 'name' => __( 'Workout Tab Link', 'lsx-health-plan' ), |
|
| 71 | + 'description' => __( 'Choose to show the excerpt, full content or nothing.', 'lsx-health-plan' ), |
|
| 72 | + 'options' => array( |
|
| 73 | + '' => __( 'None', 'lsx-health-plan' ), |
|
| 74 | + 'single' => __( 'Single', 'lsx-health-plan' ), |
|
| 75 | + 'modal' => __( 'Modal', 'lsx-health-plan' ), |
|
| 76 | + ), |
|
| 77 | + 'default' => 'modal', |
|
| 78 | + ) |
|
| 79 | + ); |
|
| 80 | + $cmb->add_field( |
|
| 81 | + array( |
|
| 82 | + 'id' => 'workout_tab_modal_content', |
|
| 83 | + 'type' => 'select', |
|
| 84 | + 'name' => __( 'Modal Content', 'lsx-health-plan' ), |
|
| 85 | + 'description' => __( 'Choose to show the excerpt, full content or nothing. For the modal content only', 'lsx-health-plan' ), |
|
| 86 | + 'options' => array( |
|
| 87 | + '' => __( 'None', 'lsx-health-plan' ), |
|
| 88 | + 'excerpt' => __( 'Excerpt', 'lsx-health-plan' ), |
|
| 89 | + 'full' => __( 'Full Content', 'lsx-health-plan' ), |
|
| 90 | + ), |
|
| 91 | + 'default' => '', |
|
| 92 | + ) |
|
| 93 | + ); |
|
| 94 | + $cmb->add_field( |
|
| 95 | + array( |
|
| 96 | + 'id' => 'workout_tab_columns', |
|
| 97 | + 'type' => 'select', |
|
| 98 | + 'name' => __( 'Grid Columns', 'lsx-health-plan' ), |
|
| 99 | + 'description' => __( 'If you are displaying a grid, set the amount of columns you want to use.', 'lsx-health-plan' ), |
|
| 100 | + 'options' => array( |
|
| 101 | + '12' => __( '1', 'lsx-health-plan' ), |
|
| 102 | + '6' => __( '2', 'lsx-health-plan' ), |
|
| 103 | + '4' => __( '3', 'lsx-health-plan' ), |
|
| 104 | + '3' => __( '4', 'lsx-health-plan' ), |
|
| 105 | + '2' => __( '6', 'lsx-health-plan' ), |
|
| 106 | + ), |
|
| 107 | + 'default' => '4', |
|
| 108 | + ) |
|
| 109 | + ); |
|
| 110 | + $cmb->add_field( |
|
| 111 | + array( |
|
| 112 | + 'id' => 'workout_tab_content', |
|
| 113 | + 'type' => 'select', |
|
| 114 | + 'name' => __( 'Grid Content', 'lsx-health-plan' ), |
|
| 115 | + 'description' => __( 'Choose to show the excerpt, full content or nothing. For the grid layout only', 'lsx-health-plan' ), |
|
| 116 | + 'options' => array( |
|
| 117 | + '' => __( 'None', 'lsx-health-plan' ), |
|
| 118 | + 'excerpt' => __( 'Excerpt', 'lsx-health-plan' ), |
|
| 119 | + 'full' => __( 'Full Content', 'lsx-health-plan' ), |
|
| 120 | + ), |
|
| 121 | + 'default' => '', |
|
| 122 | + ) |
|
| 123 | + ); |
|
| 124 | + } |
|
| 125 | 125 | } |
| 126 | 126 | Workout::get_instance(); |
@@ -12,52 +12,52 @@ |
||
| 12 | 12 | */ |
| 13 | 13 | class Recipe { |
| 14 | 14 | |
| 15 | - /** |
|
| 16 | - * Holds class instance |
|
| 17 | - * |
|
| 18 | - * @since 1.0.0 |
|
| 19 | - * |
|
| 20 | - * @var object \lsx_health_plan\classes\admin\Recipe() |
|
| 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\Recipe() |
|
| 21 | + */ |
|
| 22 | + protected static $instance = null; |
|
| 23 | 23 | |
| 24 | - /** |
|
| 25 | - * Constructor |
|
| 26 | - */ |
|
| 27 | - public function __construct() { |
|
| 28 | - add_action( 'lsx_hp_settings_page_recipe_top', array( $this, 'settings' ), 1, 1 ); |
|
| 29 | - } |
|
| 24 | + /** |
|
| 25 | + * Constructor |
|
| 26 | + */ |
|
| 27 | + public function __construct() { |
|
| 28 | + add_action( 'lsx_hp_settings_page_recipe_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\Recipe() 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\Recipe() 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' => 'recipe_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' => 'recipe_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 | Recipe::get_instance(); |
@@ -12,54 +12,54 @@ |
||
| 12 | 12 | */ |
| 13 | 13 | class Plan { |
| 14 | 14 | |
| 15 | - /** |
|
| 16 | - * Holds class instance |
|
| 17 | - * |
|
| 18 | - * @since 1.0.0 |
|
| 19 | - * |
|
| 20 | - * @var object \lsx_health_plan\classes\admin\Plan() |
|
| 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\Plan() |
|
| 21 | + */ |
|
| 22 | + protected static $instance = null; |
|
| 23 | 23 | |
| 24 | - /** |
|
| 25 | - * Constructor |
|
| 26 | - */ |
|
| 27 | - public function __construct() { |
|
| 28 | - add_action( 'lsx_hp_settings_page_plan_top', array( $this, 'settings' ), 1, 1 ); |
|
| 29 | - } |
|
| 24 | + /** |
|
| 25 | + * Constructor |
|
| 26 | + */ |
|
| 27 | + public function __construct() { |
|
| 28 | + add_action( 'lsx_hp_settings_page_plan_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\Plan() 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\Plan() A single instance of this class. |
|
| 37 | + */ |
|
| 38 | + public static function get_instance() { |
|
| 39 | + // If the single instance hasn't been set, set it now. |
|
| 40 | + if ( null === self::$instance ) { |
|
| 41 | + self::$instance = new self(); |
|
| 42 | + } |
|
| 43 | + return self::$instance; |
|
| 44 | + } |
|
| 45 | 45 | |
| 46 | - /** |
|
| 47 | - * Registers the general settings. |
|
| 48 | - * |
|
| 49 | - * @param object $cmb new_cmb2_box(). |
|
| 50 | - * @return void |
|
| 51 | - */ |
|
| 52 | - public function settings( $cmb ) { |
|
| 53 | - $cmb->add_field( |
|
| 54 | - array( |
|
| 55 | - 'name' => __( 'Plan Filters', 'lsx-health-plan' ), |
|
| 56 | - 'id' => 'plan_filters_disabled', |
|
| 57 | - 'type' => 'checkbox', |
|
| 58 | - 'value' => 1, |
|
| 59 | - 'default' => 0, |
|
| 60 | - 'description' => __( 'Toggle the display of the tab filters on the post type archive.', 'lsx-health-plan' ), |
|
| 61 | - ) |
|
| 62 | - ); |
|
| 63 | - } |
|
| 46 | + /** |
|
| 47 | + * Registers the general settings. |
|
| 48 | + * |
|
| 49 | + * @param object $cmb new_cmb2_box(). |
|
| 50 | + * @return void |
|
| 51 | + */ |
|
| 52 | + public function settings( $cmb ) { |
|
| 53 | + $cmb->add_field( |
|
| 54 | + array( |
|
| 55 | + 'name' => __( 'Plan Filters', 'lsx-health-plan' ), |
|
| 56 | + 'id' => 'plan_filters_disabled', |
|
| 57 | + 'type' => 'checkbox', |
|
| 58 | + 'value' => 1, |
|
| 59 | + 'default' => 0, |
|
| 60 | + 'description' => __( 'Toggle the display of the tab filters on the post type archive.', 'lsx-health-plan' ), |
|
| 61 | + ) |
|
| 62 | + ); |
|
| 63 | + } |
|
| 64 | 64 | } |
| 65 | 65 | Plan::get_instance(); |