@@ -8,169 +8,169 @@ |
||
8 | 8 | */ |
9 | 9 | class General { |
10 | 10 | |
11 | - /** |
|
12 | - * Holds class instance |
|
13 | - * |
|
14 | - * @since 1.0.0 |
|
15 | - * |
|
16 | - * @var object \lsx_health_plan\classes\frontend\General() |
|
17 | - */ |
|
18 | - protected static $instance = null; |
|
19 | - |
|
20 | - /** |
|
21 | - * Constructor |
|
22 | - */ |
|
23 | - public function __construct() { |
|
24 | - // Before Output. |
|
25 | - add_action( 'wp_enqueue_scripts', array( $this, 'assets' ), 5 ); |
|
26 | - add_filter( 'wp_kses_allowed_html', array( $this, 'allow_html_tags_attributes' ), 100, 2 ); |
|
27 | - |
|
28 | - // Output. |
|
29 | - add_action( 'body_class', array( $this, 'body_classes' ) ); |
|
30 | - add_filter( 'lsx_global_header_title', array( $this, 'single_title' ), 200, 1 ); |
|
31 | - add_action( 'wp_head', array( $this, 'remove_single_footer' ), 99 ); |
|
32 | - add_filter( 'get_the_archive_title', array( $this, 'get_the_archive_title' ), 9 ); |
|
33 | - } |
|
34 | - |
|
35 | - /** |
|
36 | - * Return an instance of this class. |
|
37 | - * |
|
38 | - * @since 1.0.0 |
|
39 | - * |
|
40 | - * @return object \lsx_health_plan\classes\frontend\General() 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 | - * Registers the plugin frontend assets |
|
52 | - * |
|
53 | - * @return void |
|
54 | - */ |
|
55 | - public function assets() { |
|
56 | - |
|
57 | - if ( is_post_type_archive( 'plan' ) && false === \lsx_health_plan\functions\plan\is_filters_disabled() ) { |
|
58 | - wp_enqueue_script( 'isotope', LSX_HEALTH_PLAN_URL . 'assets/js/vendor/isotope.pkgd.min.js', array( 'jquery' ), null, LSX_HEALTH_PLAN_URL, true ); |
|
59 | - } |
|
60 | - |
|
61 | - wp_enqueue_style( 'lsx-health-plan', LSX_HEALTH_PLAN_URL . 'assets/css/lsx-health-plan.css', array(), LSX_HEALTH_PLAN_VER ); |
|
62 | - wp_style_add_data( 'lsx-health-plan', 'rtl', 'replace' ); |
|
63 | - wp_enqueue_script( 'lsx-health-plan-scripts', LSX_HEALTH_PLAN_URL . 'assets/js/src/lsx-health-plan-admin.js', array( 'jquery' ) ); |
|
64 | - |
|
65 | - } |
|
66 | - |
|
67 | - /** |
|
68 | - * Adds the iframe and the progress HTML tags to the allowed WordPress list. |
|
69 | - */ |
|
70 | - public function allow_html_tags_attributes( $tags, $context ) { |
|
71 | - if ( 'post' === $context ) { |
|
72 | - $tags['iframe'] = array( |
|
73 | - 'src' => true, |
|
74 | - 'height' => true, |
|
75 | - 'width' => true, |
|
76 | - 'frameborder' => true, |
|
77 | - 'allowfullscreen' => true, |
|
78 | - ); |
|
79 | - } |
|
80 | - $tags['progress'] = array( |
|
81 | - 'id' => true, |
|
82 | - 'value' => true, |
|
83 | - 'max' => true, |
|
84 | - ); |
|
85 | - return $tags; |
|
86 | - } |
|
87 | - |
|
88 | - /** |
|
89 | - * Add body classes to body. |
|
90 | - * |
|
91 | - * @param array $classes |
|
92 | - * @return void |
|
93 | - */ |
|
94 | - public function body_classes( $classes = array() ) { |
|
95 | - global $post; |
|
96 | - |
|
97 | - if ( isset( $post->post_content ) && has_shortcode( $post->post_content, 'lsx_health_plan_my_profile_block' ) ) { |
|
98 | - $classes[] = 'my-plan-shortcode'; |
|
99 | - } |
|
100 | - |
|
101 | - if ( is_single() && is_singular( 'plan' ) ) { |
|
102 | - $args = array( |
|
103 | - 'post_parent' => get_the_ID(), |
|
104 | - 'post_type' => 'plan', |
|
105 | - ); |
|
106 | - |
|
107 | - $post_id = get_the_ID(); |
|
108 | - $has_children = get_children( $args ); |
|
109 | - $has_parent = wp_get_post_parent_id( $post_id ); |
|
110 | - |
|
111 | - if ( ! empty( $has_children ) ) { |
|
112 | - $plan_type_class = 'parent-plan-page'; |
|
113 | - if ( 0 !== $has_parent ) { |
|
114 | - $plan_type_class = 'parent-sub-plan-page'; |
|
115 | - } |
|
116 | - } else { |
|
117 | - $plan_type_class = 'unique-plan-page'; |
|
118 | - if ( 0 !== $has_parent ) { |
|
119 | - $plan_type_class = 'child-plan-page'; |
|
120 | - } |
|
121 | - } |
|
122 | - $classes[] = $plan_type_class; |
|
123 | - } |
|
124 | - return $classes; |
|
125 | - } |
|
126 | - |
|
127 | - /** |
|
128 | - * Remove the single recipe and exercise title |
|
129 | - */ |
|
130 | - public function single_title( $title ) { |
|
131 | - |
|
132 | - if ( is_single() && is_singular( 'recipe' ) ) { |
|
133 | - |
|
134 | - $title = __( 'Recipe', 'lsx-health-plan' ); |
|
135 | - } |
|
136 | - |
|
137 | - if ( is_single() && is_singular( 'exercise' ) ) { |
|
138 | - |
|
139 | - $title = __( 'Exercise', 'lsx-health-plan' ); |
|
140 | - } |
|
141 | - |
|
142 | - return $title; |
|
143 | - } |
|
144 | - |
|
145 | - /** |
|
146 | - * Removing footer for HP single pages. |
|
147 | - * |
|
148 | - * @return void |
|
149 | - */ |
|
150 | - public function remove_single_footer() { |
|
151 | - if ( is_single() && is_singular( array( 'exercise', 'recipe', 'workout', 'meal' ) ) ) { |
|
152 | - remove_action( 'lsx_footer_before', 'lsx_add_footer_sidebar_area' ); |
|
153 | - } |
|
154 | - } |
|
155 | - /** |
|
156 | - * Remove the "Archives:" from the post type recipes. |
|
157 | - * |
|
158 | - * @param string $title the term title. |
|
159 | - * @return string |
|
160 | - */ |
|
161 | - public function get_the_archive_title( $title ) { |
|
162 | - if ( is_post_type_archive( 'recipe' ) ) { |
|
163 | - $title = __( 'Recipes', 'lsx-health-plan' ); |
|
164 | - } |
|
165 | - if ( is_post_type_archive( 'exercise' ) ) { |
|
166 | - $title = __( 'Exercises', 'lsx-health-plan' ); |
|
167 | - } |
|
168 | - if ( is_tax() ) { |
|
169 | - $queried_object = get_queried_object(); |
|
170 | - if ( isset( $queried_object->name ) ) { |
|
171 | - $title = $queried_object->name; |
|
172 | - } |
|
173 | - } |
|
174 | - return $title; |
|
175 | - } |
|
11 | + /** |
|
12 | + * Holds class instance |
|
13 | + * |
|
14 | + * @since 1.0.0 |
|
15 | + * |
|
16 | + * @var object \lsx_health_plan\classes\frontend\General() |
|
17 | + */ |
|
18 | + protected static $instance = null; |
|
19 | + |
|
20 | + /** |
|
21 | + * Constructor |
|
22 | + */ |
|
23 | + public function __construct() { |
|
24 | + // Before Output. |
|
25 | + add_action( 'wp_enqueue_scripts', array( $this, 'assets' ), 5 ); |
|
26 | + add_filter( 'wp_kses_allowed_html', array( $this, 'allow_html_tags_attributes' ), 100, 2 ); |
|
27 | + |
|
28 | + // Output. |
|
29 | + add_action( 'body_class', array( $this, 'body_classes' ) ); |
|
30 | + add_filter( 'lsx_global_header_title', array( $this, 'single_title' ), 200, 1 ); |
|
31 | + add_action( 'wp_head', array( $this, 'remove_single_footer' ), 99 ); |
|
32 | + add_filter( 'get_the_archive_title', array( $this, 'get_the_archive_title' ), 9 ); |
|
33 | + } |
|
34 | + |
|
35 | + /** |
|
36 | + * Return an instance of this class. |
|
37 | + * |
|
38 | + * @since 1.0.0 |
|
39 | + * |
|
40 | + * @return object \lsx_health_plan\classes\frontend\General() 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 | + * Registers the plugin frontend assets |
|
52 | + * |
|
53 | + * @return void |
|
54 | + */ |
|
55 | + public function assets() { |
|
56 | + |
|
57 | + if ( is_post_type_archive( 'plan' ) && false === \lsx_health_plan\functions\plan\is_filters_disabled() ) { |
|
58 | + wp_enqueue_script( 'isotope', LSX_HEALTH_PLAN_URL . 'assets/js/vendor/isotope.pkgd.min.js', array( 'jquery' ), null, LSX_HEALTH_PLAN_URL, true ); |
|
59 | + } |
|
60 | + |
|
61 | + wp_enqueue_style( 'lsx-health-plan', LSX_HEALTH_PLAN_URL . 'assets/css/lsx-health-plan.css', array(), LSX_HEALTH_PLAN_VER ); |
|
62 | + wp_style_add_data( 'lsx-health-plan', 'rtl', 'replace' ); |
|
63 | + wp_enqueue_script( 'lsx-health-plan-scripts', LSX_HEALTH_PLAN_URL . 'assets/js/src/lsx-health-plan-admin.js', array( 'jquery' ) ); |
|
64 | + |
|
65 | + } |
|
66 | + |
|
67 | + /** |
|
68 | + * Adds the iframe and the progress HTML tags to the allowed WordPress list. |
|
69 | + */ |
|
70 | + public function allow_html_tags_attributes( $tags, $context ) { |
|
71 | + if ( 'post' === $context ) { |
|
72 | + $tags['iframe'] = array( |
|
73 | + 'src' => true, |
|
74 | + 'height' => true, |
|
75 | + 'width' => true, |
|
76 | + 'frameborder' => true, |
|
77 | + 'allowfullscreen' => true, |
|
78 | + ); |
|
79 | + } |
|
80 | + $tags['progress'] = array( |
|
81 | + 'id' => true, |
|
82 | + 'value' => true, |
|
83 | + 'max' => true, |
|
84 | + ); |
|
85 | + return $tags; |
|
86 | + } |
|
87 | + |
|
88 | + /** |
|
89 | + * Add body classes to body. |
|
90 | + * |
|
91 | + * @param array $classes |
|
92 | + * @return void |
|
93 | + */ |
|
94 | + public function body_classes( $classes = array() ) { |
|
95 | + global $post; |
|
96 | + |
|
97 | + if ( isset( $post->post_content ) && has_shortcode( $post->post_content, 'lsx_health_plan_my_profile_block' ) ) { |
|
98 | + $classes[] = 'my-plan-shortcode'; |
|
99 | + } |
|
100 | + |
|
101 | + if ( is_single() && is_singular( 'plan' ) ) { |
|
102 | + $args = array( |
|
103 | + 'post_parent' => get_the_ID(), |
|
104 | + 'post_type' => 'plan', |
|
105 | + ); |
|
106 | + |
|
107 | + $post_id = get_the_ID(); |
|
108 | + $has_children = get_children( $args ); |
|
109 | + $has_parent = wp_get_post_parent_id( $post_id ); |
|
110 | + |
|
111 | + if ( ! empty( $has_children ) ) { |
|
112 | + $plan_type_class = 'parent-plan-page'; |
|
113 | + if ( 0 !== $has_parent ) { |
|
114 | + $plan_type_class = 'parent-sub-plan-page'; |
|
115 | + } |
|
116 | + } else { |
|
117 | + $plan_type_class = 'unique-plan-page'; |
|
118 | + if ( 0 !== $has_parent ) { |
|
119 | + $plan_type_class = 'child-plan-page'; |
|
120 | + } |
|
121 | + } |
|
122 | + $classes[] = $plan_type_class; |
|
123 | + } |
|
124 | + return $classes; |
|
125 | + } |
|
126 | + |
|
127 | + /** |
|
128 | + * Remove the single recipe and exercise title |
|
129 | + */ |
|
130 | + public function single_title( $title ) { |
|
131 | + |
|
132 | + if ( is_single() && is_singular( 'recipe' ) ) { |
|
133 | + |
|
134 | + $title = __( 'Recipe', 'lsx-health-plan' ); |
|
135 | + } |
|
136 | + |
|
137 | + if ( is_single() && is_singular( 'exercise' ) ) { |
|
138 | + |
|
139 | + $title = __( 'Exercise', 'lsx-health-plan' ); |
|
140 | + } |
|
141 | + |
|
142 | + return $title; |
|
143 | + } |
|
144 | + |
|
145 | + /** |
|
146 | + * Removing footer for HP single pages. |
|
147 | + * |
|
148 | + * @return void |
|
149 | + */ |
|
150 | + public function remove_single_footer() { |
|
151 | + if ( is_single() && is_singular( array( 'exercise', 'recipe', 'workout', 'meal' ) ) ) { |
|
152 | + remove_action( 'lsx_footer_before', 'lsx_add_footer_sidebar_area' ); |
|
153 | + } |
|
154 | + } |
|
155 | + /** |
|
156 | + * Remove the "Archives:" from the post type recipes. |
|
157 | + * |
|
158 | + * @param string $title the term title. |
|
159 | + * @return string |
|
160 | + */ |
|
161 | + public function get_the_archive_title( $title ) { |
|
162 | + if ( is_post_type_archive( 'recipe' ) ) { |
|
163 | + $title = __( 'Recipes', 'lsx-health-plan' ); |
|
164 | + } |
|
165 | + if ( is_post_type_archive( 'exercise' ) ) { |
|
166 | + $title = __( 'Exercises', 'lsx-health-plan' ); |
|
167 | + } |
|
168 | + if ( is_tax() ) { |
|
169 | + $queried_object = get_queried_object(); |
|
170 | + if ( isset( $queried_object->name ) ) { |
|
171 | + $title = $queried_object->name; |
|
172 | + } |
|
173 | + } |
|
174 | + return $title; |
|
175 | + } |
|
176 | 176 | } |
@@ -22,14 +22,14 @@ discard block |
||
22 | 22 | */ |
23 | 23 | public function __construct() { |
24 | 24 | // Before Output. |
25 | - add_action( 'wp_enqueue_scripts', array( $this, 'assets' ), 5 ); |
|
26 | - add_filter( 'wp_kses_allowed_html', array( $this, 'allow_html_tags_attributes' ), 100, 2 ); |
|
25 | + add_action('wp_enqueue_scripts', array($this, 'assets'), 5); |
|
26 | + add_filter('wp_kses_allowed_html', array($this, 'allow_html_tags_attributes'), 100, 2); |
|
27 | 27 | |
28 | 28 | // Output. |
29 | - add_action( 'body_class', array( $this, 'body_classes' ) ); |
|
30 | - add_filter( 'lsx_global_header_title', array( $this, 'single_title' ), 200, 1 ); |
|
31 | - add_action( 'wp_head', array( $this, 'remove_single_footer' ), 99 ); |
|
32 | - add_filter( 'get_the_archive_title', array( $this, 'get_the_archive_title' ), 9 ); |
|
29 | + add_action('body_class', array($this, 'body_classes')); |
|
30 | + add_filter('lsx_global_header_title', array($this, 'single_title'), 200, 1); |
|
31 | + add_action('wp_head', array($this, 'remove_single_footer'), 99); |
|
32 | + add_filter('get_the_archive_title', array($this, 'get_the_archive_title'), 9); |
|
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,21 +54,21 @@ discard block |
||
54 | 54 | */ |
55 | 55 | public function assets() { |
56 | 56 | |
57 | - if ( is_post_type_archive( 'plan' ) && false === \lsx_health_plan\functions\plan\is_filters_disabled() ) { |
|
58 | - wp_enqueue_script( 'isotope', LSX_HEALTH_PLAN_URL . 'assets/js/vendor/isotope.pkgd.min.js', array( 'jquery' ), null, LSX_HEALTH_PLAN_URL, true ); |
|
57 | + if (is_post_type_archive('plan') && false === \lsx_health_plan\functions\plan\is_filters_disabled()) { |
|
58 | + wp_enqueue_script('isotope', LSX_HEALTH_PLAN_URL . 'assets/js/vendor/isotope.pkgd.min.js', array('jquery'), null, LSX_HEALTH_PLAN_URL, true); |
|
59 | 59 | } |
60 | 60 | |
61 | - wp_enqueue_style( 'lsx-health-plan', LSX_HEALTH_PLAN_URL . 'assets/css/lsx-health-plan.css', array(), LSX_HEALTH_PLAN_VER ); |
|
62 | - wp_style_add_data( 'lsx-health-plan', 'rtl', 'replace' ); |
|
63 | - wp_enqueue_script( 'lsx-health-plan-scripts', LSX_HEALTH_PLAN_URL . 'assets/js/src/lsx-health-plan-admin.js', array( 'jquery' ) ); |
|
61 | + wp_enqueue_style('lsx-health-plan', LSX_HEALTH_PLAN_URL . 'assets/css/lsx-health-plan.css', array(), LSX_HEALTH_PLAN_VER); |
|
62 | + wp_style_add_data('lsx-health-plan', 'rtl', 'replace'); |
|
63 | + wp_enqueue_script('lsx-health-plan-scripts', LSX_HEALTH_PLAN_URL . 'assets/js/src/lsx-health-plan-admin.js', array('jquery')); |
|
64 | 64 | |
65 | 65 | } |
66 | 66 | |
67 | 67 | /** |
68 | 68 | * Adds the iframe and the progress HTML tags to the allowed WordPress list. |
69 | 69 | */ |
70 | - public function allow_html_tags_attributes( $tags, $context ) { |
|
71 | - if ( 'post' === $context ) { |
|
70 | + public function allow_html_tags_attributes($tags, $context) { |
|
71 | + if ('post' === $context) { |
|
72 | 72 | $tags['iframe'] = array( |
73 | 73 | 'src' => true, |
74 | 74 | 'height' => true, |
@@ -91,31 +91,31 @@ discard block |
||
91 | 91 | * @param array $classes |
92 | 92 | * @return void |
93 | 93 | */ |
94 | - public function body_classes( $classes = array() ) { |
|
94 | + public function body_classes($classes = array()) { |
|
95 | 95 | global $post; |
96 | 96 | |
97 | - if ( isset( $post->post_content ) && has_shortcode( $post->post_content, 'lsx_health_plan_my_profile_block' ) ) { |
|
97 | + if (isset($post->post_content) && has_shortcode($post->post_content, 'lsx_health_plan_my_profile_block')) { |
|
98 | 98 | $classes[] = 'my-plan-shortcode'; |
99 | 99 | } |
100 | 100 | |
101 | - if ( is_single() && is_singular( 'plan' ) ) { |
|
101 | + if (is_single() && is_singular('plan')) { |
|
102 | 102 | $args = array( |
103 | 103 | 'post_parent' => get_the_ID(), |
104 | 104 | 'post_type' => 'plan', |
105 | 105 | ); |
106 | 106 | |
107 | 107 | $post_id = get_the_ID(); |
108 | - $has_children = get_children( $args ); |
|
109 | - $has_parent = wp_get_post_parent_id( $post_id ); |
|
108 | + $has_children = get_children($args); |
|
109 | + $has_parent = wp_get_post_parent_id($post_id); |
|
110 | 110 | |
111 | - if ( ! empty( $has_children ) ) { |
|
111 | + if ( ! empty($has_children)) { |
|
112 | 112 | $plan_type_class = 'parent-plan-page'; |
113 | - if ( 0 !== $has_parent ) { |
|
113 | + if (0 !== $has_parent) { |
|
114 | 114 | $plan_type_class = 'parent-sub-plan-page'; |
115 | 115 | } |
116 | 116 | } else { |
117 | 117 | $plan_type_class = 'unique-plan-page'; |
118 | - if ( 0 !== $has_parent ) { |
|
118 | + if (0 !== $has_parent) { |
|
119 | 119 | $plan_type_class = 'child-plan-page'; |
120 | 120 | } |
121 | 121 | } |
@@ -127,16 +127,16 @@ discard block |
||
127 | 127 | /** |
128 | 128 | * Remove the single recipe and exercise title |
129 | 129 | */ |
130 | - public function single_title( $title ) { |
|
130 | + public function single_title($title) { |
|
131 | 131 | |
132 | - if ( is_single() && is_singular( 'recipe' ) ) { |
|
132 | + if (is_single() && is_singular('recipe')) { |
|
133 | 133 | |
134 | - $title = __( 'Recipe', 'lsx-health-plan' ); |
|
134 | + $title = __('Recipe', 'lsx-health-plan'); |
|
135 | 135 | } |
136 | 136 | |
137 | - if ( is_single() && is_singular( 'exercise' ) ) { |
|
137 | + if (is_single() && is_singular('exercise')) { |
|
138 | 138 | |
139 | - $title = __( 'Exercise', 'lsx-health-plan' ); |
|
139 | + $title = __('Exercise', 'lsx-health-plan'); |
|
140 | 140 | } |
141 | 141 | |
142 | 142 | return $title; |
@@ -148,8 +148,8 @@ discard block |
||
148 | 148 | * @return void |
149 | 149 | */ |
150 | 150 | public function remove_single_footer() { |
151 | - if ( is_single() && is_singular( array( 'exercise', 'recipe', 'workout', 'meal' ) ) ) { |
|
152 | - remove_action( 'lsx_footer_before', 'lsx_add_footer_sidebar_area' ); |
|
151 | + if (is_single() && is_singular(array('exercise', 'recipe', 'workout', 'meal'))) { |
|
152 | + remove_action('lsx_footer_before', 'lsx_add_footer_sidebar_area'); |
|
153 | 153 | } |
154 | 154 | } |
155 | 155 | /** |
@@ -158,16 +158,16 @@ discard block |
||
158 | 158 | * @param string $title the term title. |
159 | 159 | * @return string |
160 | 160 | */ |
161 | - public function get_the_archive_title( $title ) { |
|
162 | - if ( is_post_type_archive( 'recipe' ) ) { |
|
163 | - $title = __( 'Recipes', 'lsx-health-plan' ); |
|
161 | + public function get_the_archive_title($title) { |
|
162 | + if (is_post_type_archive('recipe')) { |
|
163 | + $title = __('Recipes', 'lsx-health-plan'); |
|
164 | 164 | } |
165 | - if ( is_post_type_archive( 'exercise' ) ) { |
|
166 | - $title = __( 'Exercises', 'lsx-health-plan' ); |
|
165 | + if (is_post_type_archive('exercise')) { |
|
166 | + $title = __('Exercises', 'lsx-health-plan'); |
|
167 | 167 | } |
168 | - if ( is_tax() ) { |
|
168 | + if (is_tax()) { |
|
169 | 169 | $queried_object = get_queried_object(); |
170 | - if ( isset( $queried_object->name ) ) { |
|
170 | + if (isset($queried_object->name)) { |
|
171 | 171 | $title = $queried_object->name; |
172 | 172 | } |
173 | 173 | } |