@@ -27,7 +27,7 @@ discard block |
||
27 | 27 | */ |
28 | 28 | public function __construct() { |
29 | 29 | $this->load_classes(); |
30 | - add_filter( 'facetwp_facet_sources', array( $this, 'register_sources' ) ); |
|
30 | + add_filter('facetwp_facet_sources', array($this, 'register_sources')); |
|
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; |
@@ -59,9 +59,9 @@ discard block |
||
59 | 59 | * @param array $sources |
60 | 60 | * @return array |
61 | 61 | */ |
62 | - public function register_sources( $sources ) { |
|
62 | + public function register_sources($sources) { |
|
63 | 63 | $sources['lsx_health_plan'] = array( |
64 | - 'label' => __( 'LSX Health Plan', 'lsx-health-plan' ), |
|
64 | + 'label' => __('LSX Health Plan', 'lsx-health-plan'), |
|
65 | 65 | 'choices' => array( |
66 | 66 | 'lsx_hp/connected_plans' => 'Connected Plans', |
67 | 67 | ), |
@@ -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 | - * Contructor |
|
27 | - */ |
|
28 | - public function __construct() { |
|
29 | - $this->load_classes(); |
|
30 | - add_filter( 'facetwp_facet_sources', array( $this, 'register_sources' ) ); |
|
31 | - } |
|
25 | + /** |
|
26 | + * Contructor |
|
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 | } |
@@ -67,7 +67,7 @@ |
||
67 | 67 | */ |
68 | 68 | public static function get_instance() { |
69 | 69 | // If the single instance hasn't been set, set it now. |
70 | - if ( null === self::$instance ) { |
|
70 | + if (null === self::$instance) { |
|
71 | 71 | self::$instance = new self(); |
72 | 72 | } |
73 | 73 | return self::$instance; |
@@ -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 | - * Contructor |
|
55 | - */ |
|
56 | - public function __construct() { |
|
57 | - $this->load_classes(); |
|
58 | - $this->load_includes(); |
|
59 | - } |
|
53 | + /** |
|
54 | + * Contructor |
|
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 | } |
@@ -20,13 +20,13 @@ 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( 'cmb2_admin_init', array( $this, 'related_team_metabox' ) ); |
|
29 | + add_action('cmb2_admin_init', array($this, 'related_team_metabox')); |
|
30 | 30 | } |
31 | 31 | |
32 | 32 | /** |
@@ -38,7 +38,7 @@ discard block |
||
38 | 38 | */ |
39 | 39 | public static function get_instance() { |
40 | 40 | // If the single instance hasn't been set, set it now. |
41 | - if ( null === self::$instance ) { |
|
41 | + if (null === self::$instance) { |
|
42 | 42 | self::$instance = new self(); |
43 | 43 | } |
44 | 44 | return self::$instance; |
@@ -48,12 +48,12 @@ discard block |
||
48 | 48 | * Define the related team member metabox and field configurations. |
49 | 49 | */ |
50 | 50 | public function related_team_metabox() { |
51 | - foreach ( $this->default_types as $type => $default_type ) { |
|
51 | + foreach ($this->default_types as $type => $default_type) { |
|
52 | 52 | $cmb = new_cmb2_box( |
53 | 53 | array( |
54 | 54 | 'id' => $default_type . '_related_team_member__metabox', |
55 | - 'title' => __( 'Related Team Member', 'lsx-health-plan' ), |
|
56 | - 'object_types' => array( $default_type ), // Post type. |
|
55 | + 'title' => __('Related Team Member', 'lsx-health-plan'), |
|
56 | + 'object_types' => array($default_type), // Post type. |
|
57 | 57 | 'context' => 'normal', |
58 | 58 | 'priority' => 'low', |
59 | 59 | 'show_names' => true, |
@@ -62,15 +62,15 @@ discard block |
||
62 | 62 | |
63 | 63 | $cmb->add_field( |
64 | 64 | array( |
65 | - 'name' => __( 'Related Team Member', 'lsx-health-plan' ), |
|
66 | - 'desc' => __( 'Connect the related team member that applies to this ', 'lsx-health-plan' ) . $default_type, |
|
65 | + 'name' => __('Related Team Member', 'lsx-health-plan'), |
|
66 | + 'desc' => __('Connect the related team member that applies to this ', 'lsx-health-plan') . $default_type, |
|
67 | 67 | 'id' => $default_type . '_connected_team_member', |
68 | 68 | 'type' => 'post_search_ajax', |
69 | - 'limit' => 4, // Limit selection to X items only (default 1). |
|
69 | + 'limit' => 4, // Limit selection to X items only (default 1). |
|
70 | 70 | 'sortable' => true, // Allow selected items to be sortable (default false). |
71 | 71 | 'query_args' => array( |
72 | - 'post_type' => array( 'team' ), |
|
73 | - 'post_status' => array( 'publish' ), |
|
72 | + 'post_type' => array('team'), |
|
73 | + 'post_status' => array('publish'), |
|
74 | 74 | 'posts_per_page' => -1, |
75 | 75 | ), |
76 | 76 | ) |
@@ -8,75 +8,75 @@ |
||
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( 'cmb2_admin_init', array( $this, 'related_team_metabox' ) ); |
|
30 | - } |
|
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( 'cmb2_admin_init', array( $this, 'related_team_metabox' ) ); |
|
30 | + } |
|
31 | 31 | |
32 | - /** |
|
33 | - * Return an instance of this class. |
|
34 | - * |
|
35 | - * @since 1.0.0 |
|
36 | - * |
|
37 | - * @return object \lsx_health_plan\classes\LSX_Team() A single instance of this class. |
|
38 | - */ |
|
39 | - public static function get_instance() { |
|
40 | - // If the single instance hasn't been set, set it now. |
|
41 | - if ( null === self::$instance ) { |
|
42 | - self::$instance = new self(); |
|
43 | - } |
|
44 | - return self::$instance; |
|
45 | - } |
|
32 | + /** |
|
33 | + * Return an instance of this class. |
|
34 | + * |
|
35 | + * @since 1.0.0 |
|
36 | + * |
|
37 | + * @return object \lsx_health_plan\classes\LSX_Team() A single instance of this class. |
|
38 | + */ |
|
39 | + public static function get_instance() { |
|
40 | + // If the single instance hasn't been set, set it now. |
|
41 | + if ( null === self::$instance ) { |
|
42 | + self::$instance = new self(); |
|
43 | + } |
|
44 | + return self::$instance; |
|
45 | + } |
|
46 | 46 | |
47 | - /** |
|
48 | - * Define the related team member metabox and field configurations. |
|
49 | - */ |
|
50 | - public function related_team_metabox() { |
|
51 | - foreach ( $this->default_types as $type => $default_type ) { |
|
52 | - $cmb = new_cmb2_box( |
|
53 | - array( |
|
54 | - 'id' => $default_type . '_related_team_member__metabox', |
|
55 | - 'title' => __( 'Related Team Member', 'lsx-health-plan' ), |
|
56 | - 'object_types' => array( $default_type ), // Post type. |
|
57 | - 'context' => 'normal', |
|
58 | - 'priority' => 'low', |
|
59 | - 'show_names' => true, |
|
60 | - ) |
|
61 | - ); |
|
47 | + /** |
|
48 | + * Define the related team member metabox and field configurations. |
|
49 | + */ |
|
50 | + public function related_team_metabox() { |
|
51 | + foreach ( $this->default_types as $type => $default_type ) { |
|
52 | + $cmb = new_cmb2_box( |
|
53 | + array( |
|
54 | + 'id' => $default_type . '_related_team_member__metabox', |
|
55 | + 'title' => __( 'Related Team Member', 'lsx-health-plan' ), |
|
56 | + 'object_types' => array( $default_type ), // Post type. |
|
57 | + 'context' => 'normal', |
|
58 | + 'priority' => 'low', |
|
59 | + 'show_names' => true, |
|
60 | + ) |
|
61 | + ); |
|
62 | 62 | |
63 | - $cmb->add_field( |
|
64 | - array( |
|
65 | - 'name' => __( 'Related Team Member', 'lsx-health-plan' ), |
|
66 | - 'desc' => __( 'Connect the related team member that applies to this ', 'lsx-health-plan' ) . $default_type, |
|
67 | - 'id' => $default_type . '_connected_team_member', |
|
68 | - 'type' => 'post_search_ajax', |
|
69 | - 'limit' => 4, // Limit selection to X items only (default 1). |
|
70 | - 'sortable' => true, // Allow selected items to be sortable (default false). |
|
71 | - 'query_args' => array( |
|
72 | - 'post_type' => array( 'team' ), |
|
73 | - 'post_status' => array( 'publish' ), |
|
74 | - 'posts_per_page' => -1, |
|
75 | - ), |
|
76 | - ) |
|
77 | - ); |
|
78 | - } |
|
63 | + $cmb->add_field( |
|
64 | + array( |
|
65 | + 'name' => __( 'Related Team Member', 'lsx-health-plan' ), |
|
66 | + 'desc' => __( 'Connect the related team member that applies to this ', 'lsx-health-plan' ) . $default_type, |
|
67 | + 'id' => $default_type . '_connected_team_member', |
|
68 | + 'type' => 'post_search_ajax', |
|
69 | + 'limit' => 4, // Limit selection to X items only (default 1). |
|
70 | + 'sortable' => true, // Allow selected items to be sortable (default false). |
|
71 | + 'query_args' => array( |
|
72 | + 'post_type' => array( 'team' ), |
|
73 | + 'post_status' => array( 'publish' ), |
|
74 | + 'posts_per_page' => -1, |
|
75 | + ), |
|
76 | + ) |
|
77 | + ); |
|
78 | + } |
|
79 | 79 | |
80 | - } |
|
80 | + } |
|
81 | 81 | |
82 | 82 | } |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | */ |
30 | 30 | public function __construct() { |
31 | 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 ); |
|
32 | + add_filter('facetwp_indexer_post_facet', array($this, 'facetwp_indexer_post_facet'), 10, 2); |
|
33 | 33 | } |
34 | 34 | |
35 | 35 | /** |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | */ |
42 | 42 | public static function get_instance() { |
43 | 43 | // If the single instance hasn't been set, set it now. |
44 | - if ( null === self::$instance ) { |
|
44 | + if (null === self::$instance) { |
|
45 | 45 | self::$instance = new self(); |
46 | 46 | } |
47 | 47 | return self::$instance; |
@@ -54,24 +54,24 @@ discard block |
||
54 | 54 | * @param array $params |
55 | 55 | * @return array |
56 | 56 | */ |
57 | - public function facetwp_indexer_post_facet( $return, $params ) { |
|
57 | + public function facetwp_indexer_post_facet($return, $params) { |
|
58 | 58 | $facet = $params['facet']; |
59 | - $source = isset( $facet['source'] ) ? $facet['source'] : ''; |
|
59 | + $source = isset($facet['source']) ? $facet['source'] : ''; |
|
60 | 60 | |
61 | - if ( 'lsx_hp/connected_plans' === $source ) { |
|
62 | - $post_type = get_post_type( $params['defaults']['post_id'] ); |
|
63 | - switch ( $post_type ) { |
|
61 | + if ('lsx_hp/connected_plans' === $source) { |
|
62 | + $post_type = get_post_type($params['defaults']['post_id']); |
|
63 | + switch ($post_type) { |
|
64 | 64 | case 'workout': |
65 | - $return = $this->index_connected_plans( $params['defaults'] ); |
|
66 | - $this->index_exercises( $params['defaults'] ); |
|
65 | + $return = $this->index_connected_plans($params['defaults']); |
|
66 | + $this->index_exercises($params['defaults']); |
|
67 | 67 | break; |
68 | 68 | |
69 | 69 | case 'recipe': |
70 | - $return = $this->index_connected_plans( $params['defaults'] ); |
|
70 | + $return = $this->index_connected_plans($params['defaults']); |
|
71 | 71 | break; |
72 | 72 | |
73 | 73 | case 'meal': |
74 | - $return = $this->index_connected_plans( $params['defaults'] ); |
|
74 | + $return = $this->index_connected_plans($params['defaults']); |
|
75 | 75 | break; |
76 | 76 | |
77 | 77 | default: |
@@ -91,29 +91,29 @@ discard block |
||
91 | 91 | * @param array $params |
92 | 92 | * @return boolean |
93 | 93 | */ |
94 | - public function index_connected_plans( $row ) { |
|
94 | + public function index_connected_plans($row) { |
|
95 | 95 | $indexed = false; |
96 | 96 | $top_level_plans = array(); |
97 | 97 | // Get meals this exercise is connected to. |
98 | - $plans = get_post_meta( $row['post_id'], 'connected_plans', true ); |
|
98 | + $plans = get_post_meta($row['post_id'], 'connected_plans', true); |
|
99 | 99 | |
100 | - if ( ! empty( $plans ) ) { |
|
101 | - $plan = end( $plans ); |
|
102 | - $has_parent = wp_get_post_parent_id( $plan ); |
|
103 | - if ( 0 === $has_parent ) { |
|
100 | + if ( ! empty($plans)) { |
|
101 | + $plan = end($plans); |
|
102 | + $has_parent = wp_get_post_parent_id($plan); |
|
103 | + if (0 === $has_parent) { |
|
104 | 104 | $top_level_plans[] = $plan; |
105 | - } elseif ( false !== $top_level_plans ) { |
|
105 | + } elseif (false !== $top_level_plans) { |
|
106 | 106 | $top_level_plans[] = $has_parent; |
107 | 107 | } |
108 | 108 | } |
109 | - if ( ! empty( $top_level_plans ) && ( '' !== $top_level_plans ) ) { |
|
110 | - $top_level_plans = array_unique( $top_level_plans ); |
|
109 | + if ( ! empty($top_level_plans) && ('' !== $top_level_plans)) { |
|
110 | + $top_level_plans = array_unique($top_level_plans); |
|
111 | 111 | $this->current_plan_ids = $top_level_plans; |
112 | 112 | $indexed = true; |
113 | - foreach ( $top_level_plans as $plan_id ) { |
|
113 | + foreach ($top_level_plans as $plan_id) { |
|
114 | 114 | $row['facet_value'] = $plan_id; |
115 | - $row['facet_display_value'] = get_the_title( $plan_id ); |
|
116 | - FWP()->indexer->index_row( $row ); |
|
115 | + $row['facet_display_value'] = get_the_title($plan_id); |
|
116 | + FWP()->indexer->index_row($row); |
|
117 | 117 | } |
118 | 118 | } |
119 | 119 | return $indexed; |
@@ -126,41 +126,41 @@ discard block |
||
126 | 126 | * @param array $params |
127 | 127 | * @return void |
128 | 128 | */ |
129 | - public function index_exercises( $row ) { |
|
130 | - if ( empty( $this->current_plan_ids ) ) { |
|
129 | + public function index_exercises($row) { |
|
130 | + if (empty($this->current_plan_ids)) { |
|
131 | 131 | return; |
132 | 132 | } |
133 | 133 | $i = 1; |
134 | 134 | $section_counter = 6; |
135 | 135 | $unique_connections = array(); |
136 | 136 | |
137 | - while ( $i <= $section_counter ) { |
|
137 | + while ($i <= $section_counter) { |
|
138 | 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'] ) { |
|
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 | 143 | |
144 | - if ( ! is_array( $group['connected_exercises'] ) ) { |
|
145 | - $group['connected_exercises'] = array( $group['connected_exercises'] ); |
|
144 | + if ( ! is_array($group['connected_exercises'])) { |
|
145 | + $group['connected_exercises'] = array($group['connected_exercises']); |
|
146 | 146 | } |
147 | 147 | |
148 | 148 | // Loop through each exercise and add it to the plan. |
149 | - foreach ( $group['connected_exercises'] as $eid ) { |
|
149 | + foreach ($group['connected_exercises'] as $eid) { |
|
150 | 150 | $exercise_default = $row; |
151 | 151 | $exercise_default['post_id'] = $eid; |
152 | 152 | |
153 | - foreach ( $this->current_plan_ids as $plan_id ) { |
|
153 | + foreach ($this->current_plan_ids as $plan_id) { |
|
154 | 154 | // Check to see if this connection has been added already. |
155 | - if ( isset( $unique_connections[ $eid . '_' . $plan_id ] ) ) { |
|
155 | + if (isset($unique_connections[$eid . '_' . $plan_id])) { |
|
156 | 156 | continue; |
157 | 157 | } |
158 | 158 | |
159 | - $title = get_the_title( $plan_id ); |
|
160 | - if ( ! empty( $title ) ) { |
|
159 | + $title = get_the_title($plan_id); |
|
160 | + if ( ! empty($title)) { |
|
161 | 161 | $exercise_default['facet_value'] = $plan_id; |
162 | 162 | $exercise_default['facet_display_value'] = $title; |
163 | - $unique_connections[ $eid . '_' . $plan_id ] = $exercise_default; |
|
163 | + $unique_connections[$eid . '_' . $plan_id] = $exercise_default; |
|
164 | 164 | } |
165 | 165 | } |
166 | 166 | } |
@@ -171,9 +171,9 @@ discard block |
||
171 | 171 | } |
172 | 172 | |
173 | 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 ); |
|
174 | + if ( ! empty($unique_connections)) { |
|
175 | + foreach ($unique_connections as $unique_row) { |
|
176 | + FWP()->indexer->index_row($unique_row); |
|
177 | 177 | } |
178 | 178 | } |
179 | 179 | } |
@@ -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 | - * Contructor |
|
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 | + * Contructor |
|
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 | } |
@@ -22,9 +22,9 @@ discard block |
||
22 | 22 | */ |
23 | 23 | public function __construct() { |
24 | 24 | // Lost Password fields |
25 | - add_action( 'woocommerce_before_lost_password_form', array( $this, 'lost_password_page_title' ), 10 ); |
|
25 | + add_action('woocommerce_before_lost_password_form', array($this, 'lost_password_page_title'), 10); |
|
26 | 26 | |
27 | - add_action( 'wp', array( $this, 'allow_reset_password_page' ), 9 ); |
|
27 | + add_action('wp', array($this, 'allow_reset_password_page'), 9); |
|
28 | 28 | } |
29 | 29 | |
30 | 30 | /** |
@@ -36,7 +36,7 @@ discard block |
||
36 | 36 | */ |
37 | 37 | public static function get_instance() { |
38 | 38 | // If the single instance hasn't been set, set it now. |
39 | - if ( null === self::$instance ) { |
|
39 | + if (null === self::$instance) { |
|
40 | 40 | self::$instance = new self(); |
41 | 41 | } |
42 | 42 | return self::$instance; |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | |
45 | 45 | public function lost_password_page_title() { |
46 | 46 | ?> |
47 | - <h1 class="lost-your-password-title"><?php esc_html_e( 'Lost your password?', 'lsx-health-plan' ); ?></h1> |
|
47 | + <h1 class="lost-your-password-title"><?php esc_html_e('Lost your password?', 'lsx-health-plan'); ?></h1> |
|
48 | 48 | <?php |
49 | 49 | } |
50 | 50 | |
@@ -54,13 +54,13 @@ discard block |
||
54 | 54 | * @return void |
55 | 55 | */ |
56 | 56 | public function allow_reset_password_page() { |
57 | - if ( ! is_user_logged_in() && function_exists( 'wc_memberships' ) && is_wc_endpoint_url( 'lost-password' ) ) { |
|
57 | + if ( ! is_user_logged_in() && function_exists('wc_memberships') && is_wc_endpoint_url('lost-password')) { |
|
58 | 58 | |
59 | 59 | $members_instance = wc_memberships(); |
60 | 60 | $restriction_instance = $members_instance->get_restrictions_instance(); |
61 | 61 | $post_restrictions_instance = $restriction_instance->get_posts_restrictions_instance(); |
62 | - remove_action( 'wp', array( $post_restrictions_instance, 'handle_restriction_modes' ), 10, 1 ); |
|
63 | - add_action( 'body_class', array( $this, 'remove_body_classes' ) ); |
|
62 | + remove_action('wp', array($post_restrictions_instance, 'handle_restriction_modes'), 10, 1); |
|
63 | + add_action('body_class', array($this, 'remove_body_classes')); |
|
64 | 64 | } |
65 | 65 | } |
66 | 66 | |
@@ -70,11 +70,11 @@ discard block |
||
70 | 70 | * @param array $classes |
71 | 71 | * @return void |
72 | 72 | */ |
73 | - public function remove_body_classes( $classes = array() ) { |
|
74 | - if ( ! empty( $classes ) ) { |
|
75 | - foreach ( $classes as $class_key => $class_value ) { |
|
76 | - if ( 'gutenberg-compatible-template' === $class_value || 'using-gutenberg' === $class_value ) { |
|
77 | - unset( $classes[ $class_key ] ); |
|
73 | + public function remove_body_classes($classes = array()) { |
|
74 | + if ( ! empty($classes)) { |
|
75 | + foreach ($classes as $class_key => $class_value) { |
|
76 | + if ('gutenberg-compatible-template' === $class_value || 'using-gutenberg' === $class_value) { |
|
77 | + unset($classes[$class_key]); |
|
78 | 78 | } |
79 | 79 | } |
80 | 80 | } |
@@ -8,76 +8,76 @@ |
||
8 | 8 | */ |
9 | 9 | class Login { |
10 | 10 | |
11 | - /** |
|
12 | - * Holds class instance |
|
13 | - * |
|
14 | - * @since 1.0.0 |
|
15 | - * |
|
16 | - * @var object \lsx_health_plan\classes\integrations\woocommerce\Login() |
|
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\Login() |
|
17 | + */ |
|
18 | + protected static $instance = null; |
|
19 | 19 | |
20 | - /** |
|
21 | - * Contructor |
|
22 | - */ |
|
23 | - public function __construct() { |
|
24 | - // Lost Password fields |
|
25 | - add_action( 'woocommerce_before_lost_password_form', array( $this, 'lost_password_page_title' ), 10 ); |
|
20 | + /** |
|
21 | + * Contructor |
|
22 | + */ |
|
23 | + public function __construct() { |
|
24 | + // Lost Password fields |
|
25 | + add_action( 'woocommerce_before_lost_password_form', array( $this, 'lost_password_page_title' ), 10 ); |
|
26 | 26 | |
27 | - add_action( 'wp', array( $this, 'allow_reset_password_page' ), 9 ); |
|
28 | - } |
|
27 | + add_action( 'wp', array( $this, 'allow_reset_password_page' ), 9 ); |
|
28 | + } |
|
29 | 29 | |
30 | - /** |
|
31 | - * Return an instance of this class. |
|
32 | - * |
|
33 | - * @since 1.0.0 |
|
34 | - * |
|
35 | - * @return object \lsx_health_plan\classes\integrations\woocommerce\Login() A single instance of this class. |
|
36 | - */ |
|
37 | - public static function get_instance() { |
|
38 | - // If the single instance hasn't been set, set it now. |
|
39 | - if ( null === self::$instance ) { |
|
40 | - self::$instance = new self(); |
|
41 | - } |
|
42 | - return self::$instance; |
|
43 | - } |
|
30 | + /** |
|
31 | + * Return an instance of this class. |
|
32 | + * |
|
33 | + * @since 1.0.0 |
|
34 | + * |
|
35 | + * @return object \lsx_health_plan\classes\integrations\woocommerce\Login() A single instance of this class. |
|
36 | + */ |
|
37 | + public static function get_instance() { |
|
38 | + // If the single instance hasn't been set, set it now. |
|
39 | + if ( null === self::$instance ) { |
|
40 | + self::$instance = new self(); |
|
41 | + } |
|
42 | + return self::$instance; |
|
43 | + } |
|
44 | 44 | |
45 | - public function lost_password_page_title() { |
|
46 | - ?> |
|
45 | + public function lost_password_page_title() { |
|
46 | + ?> |
|
47 | 47 | <h1 class="lost-your-password-title"><?php esc_html_e( 'Lost your password?', 'lsx-health-plan' ); ?></h1> |
48 | 48 | <?php |
49 | - } |
|
49 | + } |
|
50 | 50 | |
51 | - /** |
|
52 | - * Removes the content restriction class to allow the password page to show. |
|
53 | - * |
|
54 | - * @return void |
|
55 | - */ |
|
56 | - public function allow_reset_password_page() { |
|
57 | - if ( ! is_user_logged_in() && function_exists( 'wc_memberships' ) && is_wc_endpoint_url( 'lost-password' ) ) { |
|
51 | + /** |
|
52 | + * Removes the content restriction class to allow the password page to show. |
|
53 | + * |
|
54 | + * @return void |
|
55 | + */ |
|
56 | + public function allow_reset_password_page() { |
|
57 | + if ( ! is_user_logged_in() && function_exists( 'wc_memberships' ) && is_wc_endpoint_url( 'lost-password' ) ) { |
|
58 | 58 | |
59 | - $members_instance = wc_memberships(); |
|
60 | - $restriction_instance = $members_instance->get_restrictions_instance(); |
|
61 | - $post_restrictions_instance = $restriction_instance->get_posts_restrictions_instance(); |
|
62 | - remove_action( 'wp', array( $post_restrictions_instance, 'handle_restriction_modes' ), 10, 1 ); |
|
63 | - add_action( 'body_class', array( $this, 'remove_body_classes' ) ); |
|
64 | - } |
|
65 | - } |
|
59 | + $members_instance = wc_memberships(); |
|
60 | + $restriction_instance = $members_instance->get_restrictions_instance(); |
|
61 | + $post_restrictions_instance = $restriction_instance->get_posts_restrictions_instance(); |
|
62 | + remove_action( 'wp', array( $post_restrictions_instance, 'handle_restriction_modes' ), 10, 1 ); |
|
63 | + add_action( 'body_class', array( $this, 'remove_body_classes' ) ); |
|
64 | + } |
|
65 | + } |
|
66 | 66 | |
67 | - /** |
|
68 | - * Remove the gutenberg classes from the lost password page. |
|
69 | - * |
|
70 | - * @param array $classes |
|
71 | - * @return void |
|
72 | - */ |
|
73 | - public function remove_body_classes( $classes = array() ) { |
|
74 | - if ( ! empty( $classes ) ) { |
|
75 | - foreach ( $classes as $class_key => $class_value ) { |
|
76 | - if ( 'gutenberg-compatible-template' === $class_value || 'using-gutenberg' === $class_value ) { |
|
77 | - unset( $classes[ $class_key ] ); |
|
78 | - } |
|
79 | - } |
|
80 | - } |
|
81 | - return $classes; |
|
82 | - } |
|
67 | + /** |
|
68 | + * Remove the gutenberg classes from the lost password page. |
|
69 | + * |
|
70 | + * @param array $classes |
|
71 | + * @return void |
|
72 | + */ |
|
73 | + public function remove_body_classes( $classes = array() ) { |
|
74 | + if ( ! empty( $classes ) ) { |
|
75 | + foreach ( $classes as $class_key => $class_value ) { |
|
76 | + if ( 'gutenberg-compatible-template' === $class_value || 'using-gutenberg' === $class_value ) { |
|
77 | + unset( $classes[ $class_key ] ); |
|
78 | + } |
|
79 | + } |
|
80 | + } |
|
81 | + return $classes; |
|
82 | + } |
|
83 | 83 | } |
@@ -21,7 +21,7 @@ discard block |
||
21 | 21 | * Contructor |
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,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 | - * Contructor |
|
22 | - */ |
|
23 | - public function __construct() { |
|
24 | - add_action( 'cmb2_admin_init', array( $this, 'products_metaboxes' ), 5 ); |
|
25 | - } |
|
20 | + /** |
|
21 | + * Contructor |
|
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 | } |
@@ -43,16 +43,16 @@ discard block |
||
43 | 43 | */ |
44 | 44 | public function __construct() { |
45 | 45 | // Remove the default restrictions, as we will add our own. |
46 | - add_action( 'wp', array( $this, 'set_screen' ), 1 ); |
|
47 | - add_action( 'wp', array( $this, 'disable_parent_plan_restrictions' ), 2 ); |
|
48 | - add_action( 'wp', array( $this, 'child_plan_redirect_restrictions' ), 2 ); |
|
46 | + add_action('wp', array($this, 'set_screen'), 1); |
|
47 | + add_action('wp', array($this, 'disable_parent_plan_restrictions'), 2); |
|
48 | + add_action('wp', array($this, 'child_plan_redirect_restrictions'), 2); |
|
49 | 49 | |
50 | 50 | // Initiate the WP Head functions. |
51 | - add_action( 'wp_head', array( $this, 'set_screen' ) ); |
|
52 | - add_action( 'lsx_content_top', 'lsx_hp_single_plan_products' ); |
|
51 | + add_action('wp_head', array($this, 'set_screen')); |
|
52 | + add_action('lsx_content_top', 'lsx_hp_single_plan_products'); |
|
53 | 53 | |
54 | 54 | // Plan Archive Actions. |
55 | - add_action( 'lsx_entry_before', array( $this, 'set_product_ids' ) ); |
|
55 | + add_action('lsx_entry_before', array($this, 'set_product_ids')); |
|
56 | 56 | } |
57 | 57 | |
58 | 58 | /** |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | */ |
65 | 65 | public static function get_instance() { |
66 | 66 | // If the single instance hasn't been set, set it now. |
67 | - if ( null === self::$instance ) { |
|
67 | + if (null === self::$instance) { |
|
68 | 68 | self::$instance = new self(); |
69 | 69 | } |
70 | 70 | return self::$instance; |
@@ -74,19 +74,19 @@ discard block |
||
74 | 74 | * Define the product metabox on the plan post type |
75 | 75 | */ |
76 | 76 | public function set_screen() { |
77 | - if ( is_singular( 'plan' ) ) { |
|
78 | - $this->parent_id = wp_get_post_parent_id( get_the_ID() ); |
|
79 | - if ( 0 === $this->parent_id ) { |
|
77 | + if (is_singular('plan')) { |
|
78 | + $this->parent_id = wp_get_post_parent_id(get_the_ID()); |
|
79 | + if (0 === $this->parent_id) { |
|
80 | 80 | $this->screen = 'parent_plan'; |
81 | 81 | } else { |
82 | 82 | $this->screen = 'child_plan'; |
83 | 83 | } |
84 | - $product_ids = get_post_meta( get_the_ID(), 'plan_product', true ); |
|
85 | - if ( false !== $product_ids && ! empty( $product_ids ) ) { |
|
84 | + $product_ids = get_post_meta(get_the_ID(), 'plan_product', true); |
|
85 | + if (false !== $product_ids && ! empty($product_ids)) { |
|
86 | 86 | $this->product_ids = $product_ids; |
87 | 87 | } |
88 | 88 | } |
89 | - if ( is_post_type_archive( 'plan' ) ) { |
|
89 | + if (is_post_type_archive('plan')) { |
|
90 | 90 | $this->screen = 'plan_archive'; |
91 | 91 | } |
92 | 92 | } |
@@ -98,9 +98,9 @@ discard block |
||
98 | 98 | */ |
99 | 99 | public function set_product_ids() { |
100 | 100 | $this->product_ids = false; |
101 | - if ( 'plan' === get_post_type() ) { |
|
102 | - $product_ids = get_post_meta( get_the_ID(), 'plan_product', true ); |
|
103 | - if ( false !== $product_ids && ! empty( $product_ids ) ) { |
|
101 | + if ('plan' === get_post_type()) { |
|
102 | + $product_ids = get_post_meta(get_the_ID(), 'plan_product', true); |
|
103 | + if (false !== $product_ids && ! empty($product_ids)) { |
|
104 | 104 | $this->product_ids = $product_ids; |
105 | 105 | } |
106 | 106 | } |
@@ -111,11 +111,11 @@ discard block |
||
111 | 111 | * restriction functionality elsewhere. |
112 | 112 | */ |
113 | 113 | public function disable_parent_plan_restrictions() { |
114 | - if ( '' === $this->screen ) { |
|
114 | + if ('' === $this->screen) { |
|
115 | 115 | return; |
116 | 116 | } |
117 | 117 | $restrictions = wc_memberships()->get_restrictions_instance()->get_posts_restrictions_instance(); |
118 | - remove_action( 'wp', array( $restrictions, 'handle_restriction_modes' ) ); |
|
118 | + remove_action('wp', array($restrictions, 'handle_restriction_modes')); |
|
119 | 119 | } |
120 | 120 | |
121 | 121 | /** |
@@ -123,12 +123,12 @@ discard block |
||
123 | 123 | * restriction functionality elsewhere. |
124 | 124 | */ |
125 | 125 | public function child_plan_redirect_restrictions() { |
126 | - if ( ! is_singular( 'plan' ) || 'child_plan' !== $this->screen || ! function_exists( 'wc_memberships_is_post_content_restricted' ) ) { |
|
126 | + if ( ! is_singular('plan') || 'child_plan' !== $this->screen || ! function_exists('wc_memberships_is_post_content_restricted')) { |
|
127 | 127 | return; |
128 | 128 | } |
129 | - $restricted = wc_memberships_is_post_content_restricted() && ! current_user_can( 'wc_memberships_view_restricted_post_content', get_the_ID() ); |
|
130 | - if ( true === $restricted ) { |
|
131 | - wp_redirect( get_permalink( $this->parent_id ) ); |
|
129 | + $restricted = wc_memberships_is_post_content_restricted() && ! current_user_can('wc_memberships_view_restricted_post_content', get_the_ID()); |
|
130 | + if (true === $restricted) { |
|
131 | + wp_redirect(get_permalink($this->parent_id)); |
|
132 | 132 | exit; |
133 | 133 | } |
134 | 134 | } |
@@ -8,137 +8,137 @@ |
||
8 | 8 | */ |
9 | 9 | class Plans { |
10 | 10 | |
11 | - /** |
|
12 | - * Holds class instance |
|
13 | - * |
|
14 | - * @since 1.0.0 |
|
15 | - * |
|
16 | - * @var object \lsx_health_plan\classes\integrations\woocommerce\Plans() |
|
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\Plans() |
|
17 | + */ |
|
18 | + protected static $instance = null; |
|
19 | 19 | |
20 | - /** |
|
21 | - * Holds the current screen var if it is active. |
|
22 | - * |
|
23 | - * @var string |
|
24 | - */ |
|
25 | - public $screen = ''; |
|
20 | + /** |
|
21 | + * Holds the current screen var if it is active. |
|
22 | + * |
|
23 | + * @var string |
|
24 | + */ |
|
25 | + public $screen = ''; |
|
26 | 26 | |
27 | - /** |
|
28 | - * Holds the current array of product IDS. |
|
29 | - * |
|
30 | - * @var array |
|
31 | - */ |
|
32 | - public $product_ids = array(); |
|
27 | + /** |
|
28 | + * Holds the current array of product IDS. |
|
29 | + * |
|
30 | + * @var array |
|
31 | + */ |
|
32 | + public $product_ids = array(); |
|
33 | 33 | |
34 | - /** |
|
35 | - * Holds the curret parent ID. |
|
36 | - * |
|
37 | - * @var int |
|
38 | - */ |
|
39 | - public $parent_id = 0; |
|
34 | + /** |
|
35 | + * Holds the curret parent ID. |
|
36 | + * |
|
37 | + * @var int |
|
38 | + */ |
|
39 | + public $parent_id = 0; |
|
40 | 40 | |
41 | - /** |
|
42 | - * Contructor |
|
43 | - */ |
|
44 | - public function __construct() { |
|
45 | - // Remove the default restrictions, as we will add our own. |
|
46 | - add_action( 'wp', array( $this, 'set_screen' ), 1 ); |
|
47 | - add_action( 'wp', array( $this, 'disable_parent_plan_restrictions' ), 2 ); |
|
48 | - add_action( 'wp', array( $this, 'child_plan_redirect_restrictions' ), 2 ); |
|
41 | + /** |
|
42 | + * Contructor |
|
43 | + */ |
|
44 | + public function __construct() { |
|
45 | + // Remove the default restrictions, as we will add our own. |
|
46 | + add_action( 'wp', array( $this, 'set_screen' ), 1 ); |
|
47 | + add_action( 'wp', array( $this, 'disable_parent_plan_restrictions' ), 2 ); |
|
48 | + add_action( 'wp', array( $this, 'child_plan_redirect_restrictions' ), 2 ); |
|
49 | 49 | |
50 | - // Initiate the WP Head functions. |
|
51 | - add_action( 'wp_head', array( $this, 'set_screen' ) ); |
|
52 | - add_action( 'lsx_content_top', 'lsx_hp_single_plan_products' ); |
|
50 | + // Initiate the WP Head functions. |
|
51 | + add_action( 'wp_head', array( $this, 'set_screen' ) ); |
|
52 | + add_action( 'lsx_content_top', 'lsx_hp_single_plan_products' ); |
|
53 | 53 | |
54 | - // Plan Archive Actions. |
|
55 | - add_action( 'lsx_entry_before', array( $this, 'set_product_ids' ) ); |
|
56 | - } |
|
54 | + // Plan Archive Actions. |
|
55 | + add_action( 'lsx_entry_before', array( $this, 'set_product_ids' ) ); |
|
56 | + } |
|
57 | 57 | |
58 | - /** |
|
59 | - * Return an instance of this class. |
|
60 | - * |
|
61 | - * @since 1.0.0 |
|
62 | - * |
|
63 | - * @return object \lsx_health_plan\classes\integrations\woocommerce\Plans() A single instance of this class. |
|
64 | - */ |
|
65 | - public static function get_instance() { |
|
66 | - // If the single instance hasn't been set, set it now. |
|
67 | - if ( null === self::$instance ) { |
|
68 | - self::$instance = new self(); |
|
69 | - } |
|
70 | - return self::$instance; |
|
71 | - } |
|
58 | + /** |
|
59 | + * Return an instance of this class. |
|
60 | + * |
|
61 | + * @since 1.0.0 |
|
62 | + * |
|
63 | + * @return object \lsx_health_plan\classes\integrations\woocommerce\Plans() A single instance of this class. |
|
64 | + */ |
|
65 | + public static function get_instance() { |
|
66 | + // If the single instance hasn't been set, set it now. |
|
67 | + if ( null === self::$instance ) { |
|
68 | + self::$instance = new self(); |
|
69 | + } |
|
70 | + return self::$instance; |
|
71 | + } |
|
72 | 72 | |
73 | - /** |
|
74 | - * Define the product metabox on the plan post type |
|
75 | - */ |
|
76 | - public function set_screen() { |
|
77 | - if ( is_singular( 'plan' ) ) { |
|
78 | - $this->parent_id = wp_get_post_parent_id( get_the_ID() ); |
|
79 | - if ( 0 === $this->parent_id ) { |
|
80 | - $this->screen = 'parent_plan'; |
|
81 | - } else { |
|
82 | - $this->screen = 'child_plan'; |
|
83 | - } |
|
84 | - $product_ids = get_post_meta( get_the_ID(), 'plan_product', true ); |
|
85 | - if ( false !== $product_ids && ! empty( $product_ids ) ) { |
|
86 | - $this->product_ids = $product_ids; |
|
87 | - } |
|
88 | - } |
|
89 | - if ( is_post_type_archive( 'plan' ) ) { |
|
90 | - $this->screen = 'plan_archive'; |
|
91 | - } |
|
92 | - } |
|
73 | + /** |
|
74 | + * Define the product metabox on the plan post type |
|
75 | + */ |
|
76 | + public function set_screen() { |
|
77 | + if ( is_singular( 'plan' ) ) { |
|
78 | + $this->parent_id = wp_get_post_parent_id( get_the_ID() ); |
|
79 | + if ( 0 === $this->parent_id ) { |
|
80 | + $this->screen = 'parent_plan'; |
|
81 | + } else { |
|
82 | + $this->screen = 'child_plan'; |
|
83 | + } |
|
84 | + $product_ids = get_post_meta( get_the_ID(), 'plan_product', true ); |
|
85 | + if ( false !== $product_ids && ! empty( $product_ids ) ) { |
|
86 | + $this->product_ids = $product_ids; |
|
87 | + } |
|
88 | + } |
|
89 | + if ( is_post_type_archive( 'plan' ) ) { |
|
90 | + $this->screen = 'plan_archive'; |
|
91 | + } |
|
92 | + } |
|
93 | 93 | |
94 | - /** |
|
95 | - * Sets the post type archive product ids. |
|
96 | - * |
|
97 | - * @return void |
|
98 | - */ |
|
99 | - public function set_product_ids() { |
|
100 | - $this->product_ids = false; |
|
101 | - if ( 'plan' === get_post_type() ) { |
|
102 | - $product_ids = get_post_meta( get_the_ID(), 'plan_product', true ); |
|
103 | - if ( false !== $product_ids && ! empty( $product_ids ) ) { |
|
104 | - $this->product_ids = $product_ids; |
|
105 | - } |
|
106 | - } |
|
107 | - } |
|
94 | + /** |
|
95 | + * Sets the post type archive product ids. |
|
96 | + * |
|
97 | + * @return void |
|
98 | + */ |
|
99 | + public function set_product_ids() { |
|
100 | + $this->product_ids = false; |
|
101 | + if ( 'plan' === get_post_type() ) { |
|
102 | + $product_ids = get_post_meta( get_the_ID(), 'plan_product', true ); |
|
103 | + if ( false !== $product_ids && ! empty( $product_ids ) ) { |
|
104 | + $this->product_ids = $product_ids; |
|
105 | + } |
|
106 | + } |
|
107 | + } |
|
108 | 108 | |
109 | - /** |
|
110 | - * Disable WC Memberships restrictions for plan parents. We add our own custom |
|
111 | - * restriction functionality elsewhere. |
|
112 | - */ |
|
113 | - public function disable_parent_plan_restrictions() { |
|
114 | - if ( '' === $this->screen ) { |
|
115 | - return; |
|
116 | - } |
|
117 | - $restrictions = wc_memberships()->get_restrictions_instance()->get_posts_restrictions_instance(); |
|
118 | - remove_action( 'wp', array( $restrictions, 'handle_restriction_modes' ) ); |
|
119 | - } |
|
109 | + /** |
|
110 | + * Disable WC Memberships restrictions for plan parents. We add our own custom |
|
111 | + * restriction functionality elsewhere. |
|
112 | + */ |
|
113 | + public function disable_parent_plan_restrictions() { |
|
114 | + if ( '' === $this->screen ) { |
|
115 | + return; |
|
116 | + } |
|
117 | + $restrictions = wc_memberships()->get_restrictions_instance()->get_posts_restrictions_instance(); |
|
118 | + remove_action( 'wp', array( $restrictions, 'handle_restriction_modes' ) ); |
|
119 | + } |
|
120 | 120 | |
121 | - /** |
|
122 | - * Disable WC Memberships restrictions for plan parents. We add our own custom |
|
123 | - * restriction functionality elsewhere. |
|
124 | - */ |
|
125 | - public function child_plan_redirect_restrictions() { |
|
126 | - if ( ! is_singular( 'plan' ) || 'child_plan' !== $this->screen || ! function_exists( 'wc_memberships_is_post_content_restricted' ) ) { |
|
127 | - return; |
|
128 | - } |
|
129 | - $restricted = wc_memberships_is_post_content_restricted() && ! current_user_can( 'wc_memberships_view_restricted_post_content', get_the_ID() ); |
|
130 | - if ( true === $restricted ) { |
|
131 | - wp_redirect( get_permalink( $this->parent_id ) ); |
|
132 | - exit; |
|
133 | - } |
|
134 | - } |
|
121 | + /** |
|
122 | + * Disable WC Memberships restrictions for plan parents. We add our own custom |
|
123 | + * restriction functionality elsewhere. |
|
124 | + */ |
|
125 | + public function child_plan_redirect_restrictions() { |
|
126 | + if ( ! is_singular( 'plan' ) || 'child_plan' !== $this->screen || ! function_exists( 'wc_memberships_is_post_content_restricted' ) ) { |
|
127 | + return; |
|
128 | + } |
|
129 | + $restricted = wc_memberships_is_post_content_restricted() && ! current_user_can( 'wc_memberships_view_restricted_post_content', get_the_ID() ); |
|
130 | + if ( true === $restricted ) { |
|
131 | + wp_redirect( get_permalink( $this->parent_id ) ); |
|
132 | + exit; |
|
133 | + } |
|
134 | + } |
|
135 | 135 | |
136 | - /** |
|
137 | - * Returns the ids of the attached products. |
|
138 | - * |
|
139 | - * @return array |
|
140 | - */ |
|
141 | - public function get_products() { |
|
142 | - return $this->product_ids; |
|
143 | - } |
|
136 | + /** |
|
137 | + * Returns the ids of the attached products. |
|
138 | + * |
|
139 | + * @return array |
|
140 | + */ |
|
141 | + public function get_products() { |
|
142 | + return $this->product_ids; |
|
143 | + } |
|
144 | 144 | } |
@@ -26,17 +26,17 @@ discard block |
||
26 | 26 | * Contructor |
27 | 27 | */ |
28 | 28 | public function __construct() { |
29 | - add_filter( 'woocommerce_order_button_text', array( $this, 'checkout_button_text' ), 10, 1 ); |
|
29 | + add_filter('woocommerce_order_button_text', array($this, 'checkout_button_text'), 10, 1); |
|
30 | 30 | |
31 | 31 | // Checkout. |
32 | - add_action( 'woocommerce_after_checkout_form', array( $this, 'payment_gateway_logos' ) ); |
|
33 | - add_action( 'body_class', array( $this, 'hp_wc_add_body_classes' ) ); |
|
34 | - add_action( 'lsx_nav_before', array( $this, 'hp_link_lsx_navbar_header' ), 99 ); |
|
35 | - add_action( 'wp_head', array( $this, 'hp_simple_checkout' ), 99 ); |
|
32 | + add_action('woocommerce_after_checkout_form', array($this, 'payment_gateway_logos')); |
|
33 | + add_action('body_class', array($this, 'hp_wc_add_body_classes')); |
|
34 | + add_action('lsx_nav_before', array($this, 'hp_link_lsx_navbar_header'), 99); |
|
35 | + add_action('wp_head', array($this, 'hp_simple_checkout'), 99); |
|
36 | 36 | |
37 | 37 | // Cart Messages. |
38 | - add_action( 'lsx_content_wrap_before', array( $this, 'cart_notices' ) ); |
|
39 | - add_filter( 'wc_add_to_cart_message_html', array( $this, 'add_to_cart_message' ), 10, 3 ); |
|
38 | + add_action('lsx_content_wrap_before', array($this, 'cart_notices')); |
|
39 | + add_filter('wc_add_to_cart_message_html', array($this, 'add_to_cart_message'), 10, 3); |
|
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; |
@@ -60,8 +60,8 @@ discard block |
||
60 | 60 | * @param string $label |
61 | 61 | * @return void |
62 | 62 | */ |
63 | - public function checkout_button_text( $label = '' ) { |
|
64 | - $label = __( 'Place order', 'lsx-health-plan' ); |
|
63 | + public function checkout_button_text($label = '') { |
|
64 | + $label = __('Place order', 'lsx-health-plan'); |
|
65 | 65 | return $label; |
66 | 66 | } |
67 | 67 | |
@@ -71,9 +71,9 @@ discard block |
||
71 | 71 | * @return void |
72 | 72 | */ |
73 | 73 | public function hp_link_lsx_navbar_header() { |
74 | - if ( is_checkout() ) { |
|
75 | - $home_ulr = '<nav class="checkout-navbar"><ul class="nav navbar-nav"><li><a href="' . home_url() . '">' . __( 'Home', 'lsx-health-plan' ) . '</a></li></ul></nav>'; |
|
76 | - echo wp_kses_post( $home_ulr ); |
|
74 | + if (is_checkout()) { |
|
75 | + $home_ulr = '<nav class="checkout-navbar"><ul class="nav navbar-nav"><li><a href="' . home_url() . '">' . __('Home', 'lsx-health-plan') . '</a></li></ul></nav>'; |
|
76 | + echo wp_kses_post($home_ulr); |
|
77 | 77 | } |
78 | 78 | } |
79 | 79 | |
@@ -83,9 +83,9 @@ discard block |
||
83 | 83 | * @param array $classes |
84 | 84 | * @return void |
85 | 85 | */ |
86 | - public function hp_wc_add_body_classes( $classes = array() ) { |
|
86 | + public function hp_wc_add_body_classes($classes = array()) { |
|
87 | 87 | global $post; |
88 | - if ( is_checkout() ) { |
|
88 | + if (is_checkout()) { |
|
89 | 89 | $classes[] = 'lsx-hp-simple-checkout'; |
90 | 90 | } |
91 | 91 | return $classes; |
@@ -98,8 +98,8 @@ discard block |
||
98 | 98 | * @return void |
99 | 99 | */ |
100 | 100 | public function hp_simple_checkout() { |
101 | - if ( is_checkout() ) { |
|
102 | - remove_action( 'lsx_footer_before', 'lsx_add_footer_sidebar_area' ); |
|
101 | + if (is_checkout()) { |
|
102 | + remove_action('lsx_footer_before', 'lsx_add_footer_sidebar_area'); |
|
103 | 103 | } |
104 | 104 | } |
105 | 105 | |
@@ -114,16 +114,16 @@ discard block |
||
114 | 114 | ?> |
115 | 115 | <div class="row text-center vertical-align lsx-full-width-base-small checkout-cta-bottom"> |
116 | 116 | <div class="col-md-12 img-payfast"> |
117 | - <img loading="lazy" src="<?php echo esc_url( $payfast_image ); ?>" alt="payfast"/> |
|
117 | + <img loading="lazy" src="<?php echo esc_url($payfast_image); ?>" alt="payfast"/> |
|
118 | 118 | </div> |
119 | 119 | <div class="col-md-12 img-payments hidden-xs"> |
120 | - <img loading="lazy" src="<?php echo esc_url( $payment_logos ); ?>" alt="payments"/> |
|
120 | + <img loading="lazy" src="<?php echo esc_url($payment_logos); ?>" alt="payments"/> |
|
121 | 121 | </div> |
122 | 122 | <div class="col-md-12 img-payments hidden-sm hidden-md hidden-lg"> |
123 | - <img loading="lazy" src="<?php echo esc_url( $payment_logos_mobile ); ?>" alt="payments"/> |
|
123 | + <img loading="lazy" src="<?php echo esc_url($payment_logos_mobile); ?>" alt="payments"/> |
|
124 | 124 | </div> |
125 | 125 | <div class="col-md-12 img-encrypt"> |
126 | - <img loading="lazy" src="<?php echo esc_url( $encript_image ); ?>" alt="lets_encrypt"/> |
|
126 | + <img loading="lazy" src="<?php echo esc_url($encript_image); ?>" alt="lets_encrypt"/> |
|
127 | 127 | </div> |
128 | 128 | </div> |
129 | 129 | |
@@ -138,9 +138,9 @@ discard block |
||
138 | 138 | * @param string $variation_id |
139 | 139 | * @return void |
140 | 140 | */ |
141 | - public function add_plan_id_to_cart( $cart_item_data, $product_id, $variation_id ) { |
|
142 | - $plan_id = filter_input( INPUT_GET, 'plan_id' ); |
|
143 | - if ( empty( $plan_id ) || '' === $plan_id ) { |
|
141 | + public function add_plan_id_to_cart($cart_item_data, $product_id, $variation_id) { |
|
142 | + $plan_id = filter_input(INPUT_GET, 'plan_id'); |
|
143 | + if (empty($plan_id) || '' === $plan_id) { |
|
144 | 144 | return $cart_item_data; |
145 | 145 | } |
146 | 146 | $cart_item_data['plan_id'] = $plan_id; |
@@ -153,10 +153,10 @@ discard block |
||
153 | 153 | * @return void |
154 | 154 | */ |
155 | 155 | public function cart_notices() { |
156 | - if ( function_exists( 'woocommerce_output_all_notices' ) && is_post_type_archive( 'plan' ) ) { |
|
157 | - echo wp_kses_post( '<div class="col-md-12 col-sm-12 woocommerce-notices-wrapper">' ); |
|
156 | + if (function_exists('woocommerce_output_all_notices') && is_post_type_archive('plan')) { |
|
157 | + echo wp_kses_post('<div class="col-md-12 col-sm-12 woocommerce-notices-wrapper">'); |
|
158 | 158 | wc_print_notices(); |
159 | - echo wp_kses_post( '</div>' ); |
|
159 | + echo wp_kses_post('</div>'); |
|
160 | 160 | } |
161 | 161 | } |
162 | 162 | |
@@ -168,19 +168,19 @@ discard block |
||
168 | 168 | * @param boolean $show_qty |
169 | 169 | * @return string |
170 | 170 | */ |
171 | - public function add_to_cart_message( $message, $products, $show_qty ) { |
|
172 | - if ( isset( $_GET['plan_id'] ) ) { // @codingStandardsIgnoreLine. |
|
173 | - $this->plan_id = sanitize_text_field( wp_slash( $_GET['plan_id'] ) ); // @codingStandardsIgnoreLine. |
|
171 | + public function add_to_cart_message($message, $products, $show_qty) { |
|
172 | + if (isset($_GET['plan_id'])) { // @codingStandardsIgnoreLine. |
|
173 | + $this->plan_id = sanitize_text_field(wp_slash($_GET['plan_id'])); // @codingStandardsIgnoreLine. |
|
174 | 174 | |
175 | - $title = '<strong>' . get_the_title( $this->plan_id ) . '</strong>'; |
|
176 | - $title = sprintf( _n( '%s has been added to your cart.', '%s have been added to your cart.', 1, 'lsx-health-plan' ), $title ); |
|
175 | + $title = '<strong>' . get_the_title($this->plan_id) . '</strong>'; |
|
176 | + $title = sprintf(_n('%s has been added to your cart.', '%s have been added to your cart.', 1, 'lsx-health-plan'), $title); |
|
177 | 177 | |
178 | 178 | // Output success messages. |
179 | - if ( 'yes' === get_option( 'woocommerce_cart_redirect_after_add' ) ) { |
|
180 | - $return_to = apply_filters( 'woocommerce_continue_shopping_redirect', wc_get_raw_referer() ? wp_validate_redirect( wc_get_raw_referer(), false ) : wc_get_page_permalink( 'shop' ) ); |
|
181 | - $message = sprintf( '<a href="%s" tabindex="1" class="btn button wc-forward">%s</a> %s', esc_url( $return_to ), esc_html__( 'Continue shopping', 'lsx-health-plan' ), $title ); |
|
179 | + if ('yes' === get_option('woocommerce_cart_redirect_after_add')) { |
|
180 | + $return_to = apply_filters('woocommerce_continue_shopping_redirect', wc_get_raw_referer() ? wp_validate_redirect(wc_get_raw_referer(), false) : wc_get_page_permalink('shop')); |
|
181 | + $message = sprintf('<a href="%s" tabindex="1" class="btn button wc-forward">%s</a> %s', esc_url($return_to), esc_html__('Continue shopping', 'lsx-health-plan'), $title); |
|
182 | 182 | } else { |
183 | - $message = sprintf( '<a href="%s" tabindex="1" class="btn button wc-forward">%s</a> %s', esc_url( wc_get_cart_url() ), esc_html__( 'View cart', 'lsx-health-plan' ), $title ); |
|
183 | + $message = sprintf('<a href="%s" tabindex="1" class="btn button wc-forward">%s</a> %s', esc_url(wc_get_cart_url()), esc_html__('View cart', 'lsx-health-plan'), $title); |
|
184 | 184 | } |
185 | 185 | } |
186 | 186 | return $message; |
@@ -8,110 +8,110 @@ discard block |
||
8 | 8 | */ |
9 | 9 | class Checkout { |
10 | 10 | |
11 | - /** |
|
12 | - * Holds class instance |
|
13 | - * |
|
14 | - * @since 1.0.0 |
|
15 | - * |
|
16 | - * @var object \lsx_health_plan\classes\integrations\woocommerce\Checkout() |
|
17 | - */ |
|
18 | - protected static $instance = null; |
|
19 | - |
|
20 | - /** |
|
21 | - * @var string |
|
22 | - */ |
|
23 | - public $plan_id = ''; |
|
24 | - |
|
25 | - /** |
|
26 | - * Contructor |
|
27 | - */ |
|
28 | - public function __construct() { |
|
29 | - add_filter( 'woocommerce_order_button_text', array( $this, 'checkout_button_text' ), 10, 1 ); |
|
30 | - |
|
31 | - // Checkout. |
|
32 | - add_action( 'woocommerce_after_checkout_form', array( $this, 'payment_gateway_logos' ) ); |
|
33 | - add_action( 'body_class', array( $this, 'hp_wc_add_body_classes' ) ); |
|
34 | - add_action( 'lsx_nav_before', array( $this, 'hp_link_lsx_navbar_header' ), 99 ); |
|
35 | - add_action( 'wp_head', array( $this, 'hp_simple_checkout' ), 99 ); |
|
36 | - |
|
37 | - // Cart Messages. |
|
38 | - add_action( 'lsx_content_wrap_before', array( $this, 'cart_notices' ) ); |
|
39 | - add_filter( 'wc_add_to_cart_message_html', array( $this, 'add_to_cart_message' ), 10, 3 ); |
|
40 | - } |
|
41 | - |
|
42 | - /** |
|
43 | - * Return an instance of this class. |
|
44 | - * |
|
45 | - * @since 1.0.0 |
|
46 | - * |
|
47 | - * @return object \lsx_health_plan\classes\integrations\woocommerce\Checkout() 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 | - * Return the Place Order Text |
|
59 | - * |
|
60 | - * @param string $label |
|
61 | - * @return void |
|
62 | - */ |
|
63 | - public function checkout_button_text( $label = '' ) { |
|
64 | - $label = __( 'Place order', 'lsx-health-plan' ); |
|
65 | - return $label; |
|
66 | - } |
|
67 | - |
|
68 | - /** |
|
69 | - * Adding the 'Home' link to the checkout. |
|
70 | - * |
|
71 | - * @return void |
|
72 | - */ |
|
73 | - public function hp_link_lsx_navbar_header() { |
|
74 | - if ( is_checkout() ) { |
|
75 | - $home_ulr = '<nav class="checkout-navbar"><ul class="nav navbar-nav"><li><a href="' . home_url() . '">' . __( 'Home', 'lsx-health-plan' ) . '</a></li></ul></nav>'; |
|
76 | - echo wp_kses_post( $home_ulr ); |
|
77 | - } |
|
78 | - } |
|
79 | - |
|
80 | - /** |
|
81 | - * Add 'lsx-simple-checkout' class to body if it is woocommerce checkout page. |
|
82 | - * |
|
83 | - * @param array $classes |
|
84 | - * @return void |
|
85 | - */ |
|
86 | - public function hp_wc_add_body_classes( $classes = array() ) { |
|
87 | - global $post; |
|
88 | - if ( is_checkout() ) { |
|
89 | - $classes[] = 'lsx-hp-simple-checkout'; |
|
90 | - } |
|
91 | - return $classes; |
|
92 | - } |
|
93 | - |
|
94 | - /** |
|
95 | - * Remove unnecessary items for simple woocommerce checkout page. |
|
96 | - * |
|
97 | - * @param array $classes |
|
98 | - * @return void |
|
99 | - */ |
|
100 | - public function hp_simple_checkout() { |
|
101 | - if ( is_checkout() ) { |
|
102 | - remove_action( 'lsx_footer_before', 'lsx_add_footer_sidebar_area' ); |
|
103 | - } |
|
104 | - } |
|
105 | - |
|
106 | - /** |
|
107 | - * Add Lets Enrypt and PayFast logos to cart. |
|
108 | - **/ |
|
109 | - public function payment_gateway_logos() { |
|
110 | - $encript_image = LSX_HEALTH_PLAN_URL . 'assets/images/lets-encript.svg'; |
|
111 | - $payfast_image = LSX_HEALTH_PLAN_URL . 'assets/images/payfast-footer-logo.svg'; |
|
112 | - $payment_logos = LSX_HEALTH_PLAN_URL . 'assets/images/payment-logos.svg'; |
|
113 | - $payment_logos_mobile = LSX_HEALTH_PLAN_URL . 'assets/images/payment-logos-mobile.svg'; |
|
114 | - ?> |
|
11 | + /** |
|
12 | + * Holds class instance |
|
13 | + * |
|
14 | + * @since 1.0.0 |
|
15 | + * |
|
16 | + * @var object \lsx_health_plan\classes\integrations\woocommerce\Checkout() |
|
17 | + */ |
|
18 | + protected static $instance = null; |
|
19 | + |
|
20 | + /** |
|
21 | + * @var string |
|
22 | + */ |
|
23 | + public $plan_id = ''; |
|
24 | + |
|
25 | + /** |
|
26 | + * Contructor |
|
27 | + */ |
|
28 | + public function __construct() { |
|
29 | + add_filter( 'woocommerce_order_button_text', array( $this, 'checkout_button_text' ), 10, 1 ); |
|
30 | + |
|
31 | + // Checkout. |
|
32 | + add_action( 'woocommerce_after_checkout_form', array( $this, 'payment_gateway_logos' ) ); |
|
33 | + add_action( 'body_class', array( $this, 'hp_wc_add_body_classes' ) ); |
|
34 | + add_action( 'lsx_nav_before', array( $this, 'hp_link_lsx_navbar_header' ), 99 ); |
|
35 | + add_action( 'wp_head', array( $this, 'hp_simple_checkout' ), 99 ); |
|
36 | + |
|
37 | + // Cart Messages. |
|
38 | + add_action( 'lsx_content_wrap_before', array( $this, 'cart_notices' ) ); |
|
39 | + add_filter( 'wc_add_to_cart_message_html', array( $this, 'add_to_cart_message' ), 10, 3 ); |
|
40 | + } |
|
41 | + |
|
42 | + /** |
|
43 | + * Return an instance of this class. |
|
44 | + * |
|
45 | + * @since 1.0.0 |
|
46 | + * |
|
47 | + * @return object \lsx_health_plan\classes\integrations\woocommerce\Checkout() 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 | + * Return the Place Order Text |
|
59 | + * |
|
60 | + * @param string $label |
|
61 | + * @return void |
|
62 | + */ |
|
63 | + public function checkout_button_text( $label = '' ) { |
|
64 | + $label = __( 'Place order', 'lsx-health-plan' ); |
|
65 | + return $label; |
|
66 | + } |
|
67 | + |
|
68 | + /** |
|
69 | + * Adding the 'Home' link to the checkout. |
|
70 | + * |
|
71 | + * @return void |
|
72 | + */ |
|
73 | + public function hp_link_lsx_navbar_header() { |
|
74 | + if ( is_checkout() ) { |
|
75 | + $home_ulr = '<nav class="checkout-navbar"><ul class="nav navbar-nav"><li><a href="' . home_url() . '">' . __( 'Home', 'lsx-health-plan' ) . '</a></li></ul></nav>'; |
|
76 | + echo wp_kses_post( $home_ulr ); |
|
77 | + } |
|
78 | + } |
|
79 | + |
|
80 | + /** |
|
81 | + * Add 'lsx-simple-checkout' class to body if it is woocommerce checkout page. |
|
82 | + * |
|
83 | + * @param array $classes |
|
84 | + * @return void |
|
85 | + */ |
|
86 | + public function hp_wc_add_body_classes( $classes = array() ) { |
|
87 | + global $post; |
|
88 | + if ( is_checkout() ) { |
|
89 | + $classes[] = 'lsx-hp-simple-checkout'; |
|
90 | + } |
|
91 | + return $classes; |
|
92 | + } |
|
93 | + |
|
94 | + /** |
|
95 | + * Remove unnecessary items for simple woocommerce checkout page. |
|
96 | + * |
|
97 | + * @param array $classes |
|
98 | + * @return void |
|
99 | + */ |
|
100 | + public function hp_simple_checkout() { |
|
101 | + if ( is_checkout() ) { |
|
102 | + remove_action( 'lsx_footer_before', 'lsx_add_footer_sidebar_area' ); |
|
103 | + } |
|
104 | + } |
|
105 | + |
|
106 | + /** |
|
107 | + * Add Lets Enrypt and PayFast logos to cart. |
|
108 | + **/ |
|
109 | + public function payment_gateway_logos() { |
|
110 | + $encript_image = LSX_HEALTH_PLAN_URL . 'assets/images/lets-encript.svg'; |
|
111 | + $payfast_image = LSX_HEALTH_PLAN_URL . 'assets/images/payfast-footer-logo.svg'; |
|
112 | + $payment_logos = LSX_HEALTH_PLAN_URL . 'assets/images/payment-logos.svg'; |
|
113 | + $payment_logos_mobile = LSX_HEALTH_PLAN_URL . 'assets/images/payment-logos-mobile.svg'; |
|
114 | + ?> |
|
115 | 115 | <div class="row text-center vertical-align lsx-full-width-base-small checkout-cta-bottom"> |
116 | 116 | <div class="col-md-12 img-payfast"> |
117 | 117 | <img loading="lazy" src="<?php echo esc_url( $payfast_image ); ?>" alt="payfast"/> |
@@ -128,61 +128,61 @@ discard block |
||
128 | 128 | </div> |
129 | 129 | |
130 | 130 | <?php |
131 | - } |
|
132 | - |
|
133 | - /** |
|
134 | - * Saves the Plan ID to the cart data, so we can attach it to the order later. |
|
135 | - * |
|
136 | - * @param array $cart_item_data |
|
137 | - * @param string $product_id |
|
138 | - * @param string $variation_id |
|
139 | - * @return void |
|
140 | - */ |
|
141 | - public function add_plan_id_to_cart( $cart_item_data, $product_id, $variation_id ) { |
|
142 | - $plan_id = filter_input( INPUT_GET, 'plan_id' ); |
|
143 | - if ( empty( $plan_id ) || '' === $plan_id ) { |
|
144 | - return $cart_item_data; |
|
145 | - } |
|
146 | - $cart_item_data['plan_id'] = $plan_id; |
|
147 | - return $cart_item_data; |
|
148 | - } |
|
149 | - |
|
150 | - /** |
|
151 | - * Output the WooCommerce Cart Notices. |
|
152 | - * |
|
153 | - * @return void |
|
154 | - */ |
|
155 | - public function cart_notices() { |
|
156 | - if ( function_exists( 'woocommerce_output_all_notices' ) && is_post_type_archive( 'plan' ) ) { |
|
157 | - echo wp_kses_post( '<div class="col-md-12 col-sm-12 woocommerce-notices-wrapper">' ); |
|
158 | - wc_print_notices(); |
|
159 | - echo wp_kses_post( '</div>' ); |
|
160 | - } |
|
161 | - } |
|
162 | - |
|
163 | - /** |
|
164 | - * Changes the add to cart message and adds our course name. |
|
165 | - * |
|
166 | - * @param string $message |
|
167 | - * @param array $products |
|
168 | - * @param boolean $show_qty |
|
169 | - * @return string |
|
170 | - */ |
|
171 | - public function add_to_cart_message( $message, $products, $show_qty ) { |
|
172 | - if ( isset( $_GET['plan_id'] ) ) { // @codingStandardsIgnoreLine. |
|
173 | - $this->plan_id = sanitize_text_field( wp_slash( $_GET['plan_id'] ) ); // @codingStandardsIgnoreLine. |
|
174 | - |
|
175 | - $title = '<strong>' . get_the_title( $this->plan_id ) . '</strong>'; |
|
176 | - $title = sprintf( _n( '%s has been added to your cart.', '%s have been added to your cart.', 1, 'lsx-health-plan' ), $title ); |
|
177 | - |
|
178 | - // Output success messages. |
|
179 | - if ( 'yes' === get_option( 'woocommerce_cart_redirect_after_add' ) ) { |
|
180 | - $return_to = apply_filters( 'woocommerce_continue_shopping_redirect', wc_get_raw_referer() ? wp_validate_redirect( wc_get_raw_referer(), false ) : wc_get_page_permalink( 'shop' ) ); |
|
181 | - $message = sprintf( '<a href="%s" tabindex="1" class="btn button wc-forward">%s</a> %s', esc_url( $return_to ), esc_html__( 'Continue shopping', 'lsx-health-plan' ), $title ); |
|
182 | - } else { |
|
183 | - $message = sprintf( '<a href="%s" tabindex="1" class="btn button wc-forward">%s</a> %s', esc_url( wc_get_cart_url() ), esc_html__( 'View cart', 'lsx-health-plan' ), $title ); |
|
184 | - } |
|
185 | - } |
|
186 | - return $message; |
|
187 | - } |
|
131 | + } |
|
132 | + |
|
133 | + /** |
|
134 | + * Saves the Plan ID to the cart data, so we can attach it to the order later. |
|
135 | + * |
|
136 | + * @param array $cart_item_data |
|
137 | + * @param string $product_id |
|
138 | + * @param string $variation_id |
|
139 | + * @return void |
|
140 | + */ |
|
141 | + public function add_plan_id_to_cart( $cart_item_data, $product_id, $variation_id ) { |
|
142 | + $plan_id = filter_input( INPUT_GET, 'plan_id' ); |
|
143 | + if ( empty( $plan_id ) || '' === $plan_id ) { |
|
144 | + return $cart_item_data; |
|
145 | + } |
|
146 | + $cart_item_data['plan_id'] = $plan_id; |
|
147 | + return $cart_item_data; |
|
148 | + } |
|
149 | + |
|
150 | + /** |
|
151 | + * Output the WooCommerce Cart Notices. |
|
152 | + * |
|
153 | + * @return void |
|
154 | + */ |
|
155 | + public function cart_notices() { |
|
156 | + if ( function_exists( 'woocommerce_output_all_notices' ) && is_post_type_archive( 'plan' ) ) { |
|
157 | + echo wp_kses_post( '<div class="col-md-12 col-sm-12 woocommerce-notices-wrapper">' ); |
|
158 | + wc_print_notices(); |
|
159 | + echo wp_kses_post( '</div>' ); |
|
160 | + } |
|
161 | + } |
|
162 | + |
|
163 | + /** |
|
164 | + * Changes the add to cart message and adds our course name. |
|
165 | + * |
|
166 | + * @param string $message |
|
167 | + * @param array $products |
|
168 | + * @param boolean $show_qty |
|
169 | + * @return string |
|
170 | + */ |
|
171 | + public function add_to_cart_message( $message, $products, $show_qty ) { |
|
172 | + if ( isset( $_GET['plan_id'] ) ) { // @codingStandardsIgnoreLine. |
|
173 | + $this->plan_id = sanitize_text_field( wp_slash( $_GET['plan_id'] ) ); // @codingStandardsIgnoreLine. |
|
174 | + |
|
175 | + $title = '<strong>' . get_the_title( $this->plan_id ) . '</strong>'; |
|
176 | + $title = sprintf( _n( '%s has been added to your cart.', '%s have been added to your cart.', 1, 'lsx-health-plan' ), $title ); |
|
177 | + |
|
178 | + // Output success messages. |
|
179 | + if ( 'yes' === get_option( 'woocommerce_cart_redirect_after_add' ) ) { |
|
180 | + $return_to = apply_filters( 'woocommerce_continue_shopping_redirect', wc_get_raw_referer() ? wp_validate_redirect( wc_get_raw_referer(), false ) : wc_get_page_permalink( 'shop' ) ); |
|
181 | + $message = sprintf( '<a href="%s" tabindex="1" class="btn button wc-forward">%s</a> %s', esc_url( $return_to ), esc_html__( 'Continue shopping', 'lsx-health-plan' ), $title ); |
|
182 | + } else { |
|
183 | + $message = sprintf( '<a href="%s" tabindex="1" class="btn button wc-forward">%s</a> %s', esc_url( wc_get_cart_url() ), esc_html__( 'View cart', 'lsx-health-plan' ), $title ); |
|
184 | + } |
|
185 | + } |
|
186 | + return $message; |
|
187 | + } |
|
188 | 188 | } |
@@ -27,13 +27,13 @@ discard block |
||
27 | 27 | */ |
28 | 28 | public function __construct() { |
29 | 29 | $this->default_types = array( |
30 | - \lsx_health_plan\functions\get_option( 'endpoint_meal', 'meal' ), |
|
31 | - \lsx_health_plan\functions\get_option( 'endpoint_exercise_single', 'exercise' ), |
|
32 | - \lsx_health_plan\functions\get_option( 'endpoint_recipe_single', 'recipe' ), |
|
33 | - \lsx_health_plan\functions\get_option( 'endpoint_workout', 'workout' ), |
|
34 | - \lsx_health_plan\functions\get_option( 'endpoint_plan', 'plan' ), |
|
30 | + \lsx_health_plan\functions\get_option('endpoint_meal', 'meal'), |
|
31 | + \lsx_health_plan\functions\get_option('endpoint_exercise_single', 'exercise'), |
|
32 | + \lsx_health_plan\functions\get_option('endpoint_recipe_single', 'recipe'), |
|
33 | + \lsx_health_plan\functions\get_option('endpoint_workout', 'workout'), |
|
34 | + \lsx_health_plan\functions\get_option('endpoint_plan', 'plan'), |
|
35 | 35 | ); |
36 | - add_action( 'cmb2_admin_init', array( $this, 'related_articles_metabox' ) ); |
|
36 | + add_action('cmb2_admin_init', array($this, 'related_articles_metabox')); |
|
37 | 37 | } |
38 | 38 | |
39 | 39 | /** |
@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | */ |
46 | 46 | public static function get_instance() { |
47 | 47 | // If the single instance hasn't been set, set it now. |
48 | - if ( null === self::$instance ) { |
|
48 | + if (null === self::$instance) { |
|
49 | 49 | self::$instance = new self(); |
50 | 50 | } |
51 | 51 | return self::$instance; |
@@ -55,12 +55,12 @@ discard block |
||
55 | 55 | * Define the related articles member metabox and field configurations. |
56 | 56 | */ |
57 | 57 | public function related_articles_metabox() { |
58 | - foreach ( $this->default_types as $type => $default_type ) { |
|
58 | + foreach ($this->default_types as $type => $default_type) { |
|
59 | 59 | $cmb = new_cmb2_box( |
60 | 60 | array( |
61 | 61 | 'id' => $default_type . '_related_articles_metabox', |
62 | - 'title' => __( 'Related Articles', 'lsx-health-plan' ), |
|
63 | - 'object_types' => array( $default_type ), // Post type. |
|
62 | + 'title' => __('Related Articles', 'lsx-health-plan'), |
|
63 | + 'object_types' => array($default_type), // Post type. |
|
64 | 64 | 'context' => 'normal', |
65 | 65 | 'priority' => 'low', |
66 | 66 | 'show_names' => true, |
@@ -69,15 +69,15 @@ discard block |
||
69 | 69 | |
70 | 70 | $cmb->add_field( |
71 | 71 | array( |
72 | - 'name' => __( 'Related Articles', 'lsx-health-plan' ), |
|
73 | - 'desc' => __( 'Connect the related articles that applies to this ', 'lsx-health-plan' ) . $default_type, |
|
72 | + 'name' => __('Related Articles', 'lsx-health-plan'), |
|
73 | + 'desc' => __('Connect the related articles that applies to this ', 'lsx-health-plan') . $default_type, |
|
74 | 74 | 'id' => $default_type . '_connected_articles', |
75 | 75 | 'type' => 'post_search_ajax', |
76 | - 'limit' => 3, // Limit selection to X items only (default 1). |
|
76 | + 'limit' => 3, // Limit selection to X items only (default 1). |
|
77 | 77 | 'sortable' => true, // Allow selected items to be sortable (default false). |
78 | 78 | 'query_args' => array( |
79 | - 'post_type' => array( 'post' ), |
|
80 | - 'post_status' => array( 'publish' ), |
|
79 | + 'post_type' => array('post'), |
|
80 | + 'post_status' => array('publish'), |
|
81 | 81 | 'posts_per_page' => -1, |
82 | 82 | ), |
83 | 83 | ) |
@@ -8,82 +8,82 @@ |
||
8 | 8 | */ |
9 | 9 | class Articles { |
10 | 10 | |
11 | - /** |
|
12 | - * Holds class instance |
|
13 | - * |
|
14 | - * @var object \lsx_health_plan\classes\Articles() |
|
15 | - */ |
|
16 | - protected static $instance = null; |
|
11 | + /** |
|
12 | + * Holds class instance |
|
13 | + * |
|
14 | + * @var object \lsx_health_plan\classes\Articles() |
|
15 | + */ |
|
16 | + protected static $instance = null; |
|
17 | 17 | |
18 | - /** |
|
19 | - * An array of the post types for the Global Defaults field. |
|
20 | - * |
|
21 | - * @var array |
|
22 | - */ |
|
23 | - //public $default_types = array( 'exercise', 'recipe', 'meal', 'workout', 'plan' ); |
|
18 | + /** |
|
19 | + * An array of the post types for the Global Defaults field. |
|
20 | + * |
|
21 | + * @var array |
|
22 | + */ |
|
23 | + //public $default_types = array( 'exercise', 'recipe', 'meal', 'workout', 'plan' ); |
|
24 | 24 | |
25 | - /** |
|
26 | - * Constructor. |
|
27 | - */ |
|
28 | - public function __construct() { |
|
29 | - $this->default_types = array( |
|
30 | - \lsx_health_plan\functions\get_option( 'endpoint_meal', 'meal' ), |
|
31 | - \lsx_health_plan\functions\get_option( 'endpoint_exercise_single', 'exercise' ), |
|
32 | - \lsx_health_plan\functions\get_option( 'endpoint_recipe_single', 'recipe' ), |
|
33 | - \lsx_health_plan\functions\get_option( 'endpoint_workout', 'workout' ), |
|
34 | - \lsx_health_plan\functions\get_option( 'endpoint_plan', 'plan' ), |
|
35 | - ); |
|
36 | - add_action( 'cmb2_admin_init', array( $this, 'related_articles_metabox' ) ); |
|
37 | - } |
|
25 | + /** |
|
26 | + * Constructor. |
|
27 | + */ |
|
28 | + public function __construct() { |
|
29 | + $this->default_types = array( |
|
30 | + \lsx_health_plan\functions\get_option( 'endpoint_meal', 'meal' ), |
|
31 | + \lsx_health_plan\functions\get_option( 'endpoint_exercise_single', 'exercise' ), |
|
32 | + \lsx_health_plan\functions\get_option( 'endpoint_recipe_single', 'recipe' ), |
|
33 | + \lsx_health_plan\functions\get_option( 'endpoint_workout', 'workout' ), |
|
34 | + \lsx_health_plan\functions\get_option( 'endpoint_plan', 'plan' ), |
|
35 | + ); |
|
36 | + add_action( 'cmb2_admin_init', array( $this, 'related_articles_metabox' ) ); |
|
37 | + } |
|
38 | 38 | |
39 | - /** |
|
40 | - * Return an instance of this class. |
|
41 | - * |
|
42 | - * @since 1.0.0 |
|
43 | - * |
|
44 | - * @return object \lsx_health_plan\classes\Articles() A single instance of this class. |
|
45 | - */ |
|
46 | - public static function get_instance() { |
|
47 | - // If the single instance hasn't been set, set it now. |
|
48 | - if ( null === self::$instance ) { |
|
49 | - self::$instance = new self(); |
|
50 | - } |
|
51 | - return self::$instance; |
|
52 | - } |
|
39 | + /** |
|
40 | + * Return an instance of this class. |
|
41 | + * |
|
42 | + * @since 1.0.0 |
|
43 | + * |
|
44 | + * @return object \lsx_health_plan\classes\Articles() A single instance of this class. |
|
45 | + */ |
|
46 | + public static function get_instance() { |
|
47 | + // If the single instance hasn't been set, set it now. |
|
48 | + if ( null === self::$instance ) { |
|
49 | + self::$instance = new self(); |
|
50 | + } |
|
51 | + return self::$instance; |
|
52 | + } |
|
53 | 53 | |
54 | - /** |
|
55 | - * Define the related articles member metabox and field configurations. |
|
56 | - */ |
|
57 | - public function related_articles_metabox() { |
|
58 | - foreach ( $this->default_types as $type => $default_type ) { |
|
59 | - $cmb = new_cmb2_box( |
|
60 | - array( |
|
61 | - 'id' => $default_type . '_related_articles_metabox', |
|
62 | - 'title' => __( 'Related Articles', 'lsx-health-plan' ), |
|
63 | - 'object_types' => array( $default_type ), // Post type. |
|
64 | - 'context' => 'normal', |
|
65 | - 'priority' => 'low', |
|
66 | - 'show_names' => true, |
|
67 | - ) |
|
68 | - ); |
|
54 | + /** |
|
55 | + * Define the related articles member metabox and field configurations. |
|
56 | + */ |
|
57 | + public function related_articles_metabox() { |
|
58 | + foreach ( $this->default_types as $type => $default_type ) { |
|
59 | + $cmb = new_cmb2_box( |
|
60 | + array( |
|
61 | + 'id' => $default_type . '_related_articles_metabox', |
|
62 | + 'title' => __( 'Related Articles', 'lsx-health-plan' ), |
|
63 | + 'object_types' => array( $default_type ), // Post type. |
|
64 | + 'context' => 'normal', |
|
65 | + 'priority' => 'low', |
|
66 | + 'show_names' => true, |
|
67 | + ) |
|
68 | + ); |
|
69 | 69 | |
70 | - $cmb->add_field( |
|
71 | - array( |
|
72 | - 'name' => __( 'Related Articles', 'lsx-health-plan' ), |
|
73 | - 'desc' => __( 'Connect the related articles that applies to this ', 'lsx-health-plan' ) . $default_type, |
|
74 | - 'id' => $default_type . '_connected_articles', |
|
75 | - 'type' => 'post_search_ajax', |
|
76 | - 'limit' => 3, // Limit selection to X items only (default 1). |
|
77 | - 'sortable' => true, // Allow selected items to be sortable (default false). |
|
78 | - 'query_args' => array( |
|
79 | - 'post_type' => array( 'post' ), |
|
80 | - 'post_status' => array( 'publish' ), |
|
81 | - 'posts_per_page' => -1, |
|
82 | - ), |
|
83 | - ) |
|
84 | - ); |
|
85 | - } |
|
70 | + $cmb->add_field( |
|
71 | + array( |
|
72 | + 'name' => __( 'Related Articles', 'lsx-health-plan' ), |
|
73 | + 'desc' => __( 'Connect the related articles that applies to this ', 'lsx-health-plan' ) . $default_type, |
|
74 | + 'id' => $default_type . '_connected_articles', |
|
75 | + 'type' => 'post_search_ajax', |
|
76 | + 'limit' => 3, // Limit selection to X items only (default 1). |
|
77 | + 'sortable' => true, // Allow selected items to be sortable (default false). |
|
78 | + 'query_args' => array( |
|
79 | + 'post_type' => array( 'post' ), |
|
80 | + 'post_status' => array( 'publish' ), |
|
81 | + 'posts_per_page' => -1, |
|
82 | + ), |
|
83 | + ) |
|
84 | + ); |
|
85 | + } |
|
86 | 86 | |
87 | - } |
|
87 | + } |
|
88 | 88 | |
89 | 89 | } |