@@ -14,7 +14,7 @@ |
||
14 | 14 | |
15 | 15 | // If this file is called directly, abort. |
16 | 16 | if ( ! defined( 'WPINC' ) ) { |
17 | - die; |
|
17 | + die; |
|
18 | 18 | } |
19 | 19 | |
20 | 20 | define( 'LSX_ACTIVITIES_PATH', plugin_dir_path( __FILE__ ) ); |
@@ -10,196 +10,196 @@ |
||
10 | 10 | */ |
11 | 11 | |
12 | 12 | $metabox = array( |
13 | - 'title' => esc_html__( 'Tour Operator Plugin', 'lsx-activities' ), |
|
14 | - 'pages' => 'activity', |
|
15 | - 'fields' => array(), |
|
13 | + 'title' => esc_html__( 'Tour Operator Plugin', 'lsx-activities' ), |
|
14 | + 'pages' => 'activity', |
|
15 | + 'fields' => array(), |
|
16 | 16 | ); |
17 | 17 | |
18 | 18 | $metabox['fields'][] = array( |
19 | - 'id' => 'featured', |
|
20 | - 'name' => esc_html__( 'Featured', 'lsx-activities' ), |
|
21 | - 'type' => 'checkbox', |
|
19 | + 'id' => 'featured', |
|
20 | + 'name' => esc_html__( 'Featured', 'lsx-activities' ), |
|
21 | + 'type' => 'checkbox', |
|
22 | 22 | ); |
23 | 23 | |
24 | 24 | $metabox['fields'][] = array( |
25 | - 'id' => 'disable_single', |
|
26 | - 'name' => esc_html__( 'Disable Single', 'to-reviews' ), |
|
27 | - 'type' => 'checkbox', |
|
25 | + 'id' => 'disable_single', |
|
26 | + 'name' => esc_html__( 'Disable Single', 'to-reviews' ), |
|
27 | + 'type' => 'checkbox', |
|
28 | 28 | ); |
29 | 29 | |
30 | 30 | if ( ! class_exists( 'LSX_Banners' ) ) { |
31 | - $metabox['fields'][] = array( |
|
32 | - 'id' => 'tagline', |
|
33 | - 'name' => esc_html__( 'Tagline', 'lsx-activities' ), |
|
34 | - 'type' => 'text', |
|
35 | - ); |
|
31 | + $metabox['fields'][] = array( |
|
32 | + 'id' => 'tagline', |
|
33 | + 'name' => esc_html__( 'Tagline', 'lsx-activities' ), |
|
34 | + 'type' => 'text', |
|
35 | + ); |
|
36 | 36 | } |
37 | 37 | |
38 | 38 | $metabox['fields'][] = array( |
39 | - 'id' => 'friendly', |
|
40 | - 'name' => 'Friendly', |
|
41 | - 'type' => 'select', |
|
42 | - 'multiple' => true, |
|
43 | - 'options' => array( |
|
44 | - 'business' => esc_html__( 'Business', 'lsx-activities' ), |
|
45 | - 'children' => esc_html__( 'Children', 'lsx-activities' ), |
|
46 | - 'disability' => esc_html__( 'Disability', 'lsx-activities' ), |
|
47 | - 'leisure' => esc_html__( 'Leisure', 'lsx-activities' ), |
|
48 | - 'luxury' => esc_html__( 'Luxury', 'lsx-activities' ), |
|
49 | - 'pet' => esc_html__( 'Pet', 'lsx-activities' ), |
|
50 | - 'romance' => esc_html__( 'Romance', 'lsx-activities' ), |
|
51 | - 'vegetarian' => esc_html__( 'Vegetarian', 'lsx-activities' ), |
|
52 | - 'weddings' => esc_html__( 'Weddings', 'lsx-activities' ), |
|
53 | - ), |
|
39 | + 'id' => 'friendly', |
|
40 | + 'name' => 'Friendly', |
|
41 | + 'type' => 'select', |
|
42 | + 'multiple' => true, |
|
43 | + 'options' => array( |
|
44 | + 'business' => esc_html__( 'Business', 'lsx-activities' ), |
|
45 | + 'children' => esc_html__( 'Children', 'lsx-activities' ), |
|
46 | + 'disability' => esc_html__( 'Disability', 'lsx-activities' ), |
|
47 | + 'leisure' => esc_html__( 'Leisure', 'lsx-activities' ), |
|
48 | + 'luxury' => esc_html__( 'Luxury', 'lsx-activities' ), |
|
49 | + 'pet' => esc_html__( 'Pet', 'lsx-activities' ), |
|
50 | + 'romance' => esc_html__( 'Romance', 'lsx-activities' ), |
|
51 | + 'vegetarian' => esc_html__( 'Vegetarian', 'lsx-activities' ), |
|
52 | + 'weddings' => esc_html__( 'Weddings', 'lsx-activities' ), |
|
53 | + ), |
|
54 | 54 | ); |
55 | 55 | |
56 | 56 | if ( class_exists( 'LSX_TO_Team' ) ) { |
57 | - $metabox['fields'][] = array( |
|
58 | - 'id' => 'team_to_activity', |
|
59 | - 'name' => esc_html__( 'Team Member', 'lsx-activities' ), |
|
60 | - 'type' => 'post_select', |
|
61 | - 'use_ajax' => false, |
|
62 | - 'allow_none' => true, |
|
63 | - 'query' => array( |
|
64 | - 'post_type' => 'team', |
|
65 | - 'nopagin' => true, |
|
66 | - 'posts_per_page' => 1000, |
|
67 | - 'orderby' => 'title', |
|
68 | - 'order' => 'ASC', |
|
69 | - ), |
|
70 | - ); |
|
57 | + $metabox['fields'][] = array( |
|
58 | + 'id' => 'team_to_activity', |
|
59 | + 'name' => esc_html__( 'Team Member', 'lsx-activities' ), |
|
60 | + 'type' => 'post_select', |
|
61 | + 'use_ajax' => false, |
|
62 | + 'allow_none' => true, |
|
63 | + 'query' => array( |
|
64 | + 'post_type' => 'team', |
|
65 | + 'nopagin' => true, |
|
66 | + 'posts_per_page' => 1000, |
|
67 | + 'orderby' => 'title', |
|
68 | + 'order' => 'ASC', |
|
69 | + ), |
|
70 | + ); |
|
71 | 71 | } |
72 | 72 | |
73 | 73 | $metabox['fields'][] = array( |
74 | - 'id' => 'price_title', |
|
75 | - 'name' => __( 'Price','lsx-activities' ), |
|
76 | - 'type' => 'title', |
|
74 | + 'id' => 'price_title', |
|
75 | + 'name' => __( 'Price','lsx-activities' ), |
|
76 | + 'type' => 'title', |
|
77 | 77 | ); |
78 | 78 | |
79 | 79 | $metabox['fields'][] = array( |
80 | - 'id' => 'price', |
|
81 | - 'name' => __( 'Price','lsx-activities' ), |
|
82 | - 'type' => 'text', |
|
83 | - 'cols' => 6, |
|
80 | + 'id' => 'price', |
|
81 | + 'name' => __( 'Price','lsx-activities' ), |
|
82 | + 'type' => 'text', |
|
83 | + 'cols' => 6, |
|
84 | 84 | ); |
85 | 85 | |
86 | 86 | $metabox['fields'][] = array( |
87 | - 'id' => 'price_type', |
|
88 | - 'name' => __( 'Price Type','lsx-activities' ), |
|
89 | - 'type' => 'select', |
|
90 | - 'cols' => 6, |
|
91 | - 'options' => array( |
|
92 | - 'none' => 'Select a type', |
|
93 | - 'per_person' => __( 'Per Person','lsx-activities' ), |
|
94 | - 'per_group' => __( 'Per Group','lsx-activities' ), |
|
95 | - ), |
|
87 | + 'id' => 'price_type', |
|
88 | + 'name' => __( 'Price Type','lsx-activities' ), |
|
89 | + 'type' => 'select', |
|
90 | + 'cols' => 6, |
|
91 | + 'options' => array( |
|
92 | + 'none' => 'Select a type', |
|
93 | + 'per_person' => __( 'Per Person','lsx-activities' ), |
|
94 | + 'per_group' => __( 'Per Group','lsx-activities' ), |
|
95 | + ), |
|
96 | 96 | ); |
97 | 97 | |
98 | 98 | if ( class_exists( 'LSX_TO_Maps' ) ) { |
99 | - $tour_operator = tour_operator(); |
|
100 | - $api_key = false; |
|
101 | - |
|
102 | - if ( isset( $tour_operator->options['api']['googlemaps_key'] ) ) { |
|
103 | - $api_key = $tour_operator->options['api']['googlemaps_key']; |
|
104 | - } |
|
105 | - |
|
106 | - $metabox['fields'][] = array( |
|
107 | - 'id' => 'location_title', |
|
108 | - 'name' => esc_html__( 'Location', 'lsx-activities' ), |
|
109 | - 'type' => 'title', |
|
110 | - ); |
|
111 | - |
|
112 | - $metabox['fields'][] = array( |
|
113 | - 'id' => 'location', |
|
114 | - 'name' => esc_html__( 'Location', 'lsx-activities' ), |
|
115 | - 'type' => 'gmap', |
|
116 | - 'google_api_key' => $api_key, |
|
117 | - ); |
|
99 | + $tour_operator = tour_operator(); |
|
100 | + $api_key = false; |
|
101 | + |
|
102 | + if ( isset( $tour_operator->options['api']['googlemaps_key'] ) ) { |
|
103 | + $api_key = $tour_operator->options['api']['googlemaps_key']; |
|
104 | + } |
|
105 | + |
|
106 | + $metabox['fields'][] = array( |
|
107 | + 'id' => 'location_title', |
|
108 | + 'name' => esc_html__( 'Location', 'lsx-activities' ), |
|
109 | + 'type' => 'title', |
|
110 | + ); |
|
111 | + |
|
112 | + $metabox['fields'][] = array( |
|
113 | + 'id' => 'location', |
|
114 | + 'name' => esc_html__( 'Location', 'lsx-activities' ), |
|
115 | + 'type' => 'gmap', |
|
116 | + 'google_api_key' => $api_key, |
|
117 | + ); |
|
118 | 118 | } |
119 | 119 | |
120 | 120 | $metabox['fields'][] = array( |
121 | - 'id' => 'gallery_title', |
|
122 | - 'name' => esc_html__( 'Gallery', 'lsx-activities' ), |
|
123 | - 'type' => 'title', |
|
121 | + 'id' => 'gallery_title', |
|
122 | + 'name' => esc_html__( 'Gallery', 'lsx-activities' ), |
|
123 | + 'type' => 'title', |
|
124 | 124 | ); |
125 | 125 | |
126 | 126 | $metabox['fields'][] = array( |
127 | - 'id' => 'gallery', |
|
128 | - 'name' => esc_html__( 'Gallery', 'lsx-activities' ), |
|
129 | - 'type' => 'image', |
|
130 | - 'repeatable' => true, |
|
131 | - 'show_size' => false, |
|
127 | + 'id' => 'gallery', |
|
128 | + 'name' => esc_html__( 'Gallery', 'lsx-activities' ), |
|
129 | + 'type' => 'image', |
|
130 | + 'repeatable' => true, |
|
131 | + 'show_size' => false, |
|
132 | 132 | ); |
133 | 133 | |
134 | 134 | if ( class_exists( 'Envira_Gallery' ) ) { |
135 | - $metabox['fields'][] = array( |
|
136 | - 'id' => 'envira_title', |
|
137 | - 'name' => esc_html__( 'Envira Gallery', 'lsx-activities' ), |
|
138 | - 'type' => 'title', |
|
139 | - ); |
|
140 | - |
|
141 | - $metabox['fields'][] = array( |
|
142 | - 'id' => 'envira_gallery', |
|
143 | - 'name' => esc_html__( 'Envira Gallery', 'lsx-activities' ), |
|
144 | - 'type' => 'post_select', |
|
145 | - 'use_ajax' => false, |
|
146 | - 'allow_none' => true, |
|
147 | - 'query' => array( |
|
148 | - 'post_type' => 'envira', |
|
149 | - 'nopagin' => true, |
|
150 | - 'posts_per_page' => '-1', |
|
151 | - 'orderby' => 'title', |
|
152 | - 'order' => 'ASC', |
|
153 | - ), |
|
154 | - ); |
|
155 | - |
|
156 | - if ( class_exists( 'Envira_Videos' ) ) { |
|
157 | - $metabox['fields'][] = array( |
|
158 | - 'id' => 'envira_video', |
|
159 | - 'name' => esc_html__( 'Envira Video Gallery', 'lsx-activities' ), |
|
160 | - 'type' => 'post_select', |
|
161 | - 'use_ajax' => false, |
|
162 | - 'allow_none' => true, |
|
163 | - 'query' => array( |
|
164 | - 'post_type' => 'envira', |
|
165 | - 'nopagin' => true, |
|
166 | - 'posts_per_page' => '-1', |
|
167 | - 'orderby' => 'title', |
|
168 | - 'order' => 'ASC', |
|
169 | - ), |
|
170 | - ); |
|
171 | - } |
|
135 | + $metabox['fields'][] = array( |
|
136 | + 'id' => 'envira_title', |
|
137 | + 'name' => esc_html__( 'Envira Gallery', 'lsx-activities' ), |
|
138 | + 'type' => 'title', |
|
139 | + ); |
|
140 | + |
|
141 | + $metabox['fields'][] = array( |
|
142 | + 'id' => 'envira_gallery', |
|
143 | + 'name' => esc_html__( 'Envira Gallery', 'lsx-activities' ), |
|
144 | + 'type' => 'post_select', |
|
145 | + 'use_ajax' => false, |
|
146 | + 'allow_none' => true, |
|
147 | + 'query' => array( |
|
148 | + 'post_type' => 'envira', |
|
149 | + 'nopagin' => true, |
|
150 | + 'posts_per_page' => '-1', |
|
151 | + 'orderby' => 'title', |
|
152 | + 'order' => 'ASC', |
|
153 | + ), |
|
154 | + ); |
|
155 | + |
|
156 | + if ( class_exists( 'Envira_Videos' ) ) { |
|
157 | + $metabox['fields'][] = array( |
|
158 | + 'id' => 'envira_video', |
|
159 | + 'name' => esc_html__( 'Envira Video Gallery', 'lsx-activities' ), |
|
160 | + 'type' => 'post_select', |
|
161 | + 'use_ajax' => false, |
|
162 | + 'allow_none' => true, |
|
163 | + 'query' => array( |
|
164 | + 'post_type' => 'envira', |
|
165 | + 'nopagin' => true, |
|
166 | + 'posts_per_page' => '-1', |
|
167 | + 'orderby' => 'title', |
|
168 | + 'order' => 'ASC', |
|
169 | + ), |
|
170 | + ); |
|
171 | + } |
|
172 | 172 | } |
173 | 173 | |
174 | 174 | $post_types = array( |
175 | - 'post' => esc_html__( 'Posts', 'lsx-activities' ), |
|
176 | - 'accommodation' => esc_html__( 'Accommodation', 'lsx-activities' ), |
|
177 | - 'destination' => esc_html__( 'Destinations', 'lsx-activities' ), |
|
178 | - 'tour' => esc_html__( 'Tours', 'lsx-activities' ), |
|
175 | + 'post' => esc_html__( 'Posts', 'lsx-activities' ), |
|
176 | + 'accommodation' => esc_html__( 'Accommodation', 'lsx-activities' ), |
|
177 | + 'destination' => esc_html__( 'Destinations', 'lsx-activities' ), |
|
178 | + 'tour' => esc_html__( 'Tours', 'lsx-activities' ), |
|
179 | 179 | ); |
180 | 180 | |
181 | 181 | foreach ( $post_types as $slug => $label ) { |
182 | - $metabox['fields'][] = array( |
|
183 | - 'id' => $slug . '_title', |
|
184 | - 'name' => $label, |
|
185 | - 'type' => 'title', |
|
186 | - ); |
|
187 | - |
|
188 | - $metabox['fields'][] = array( |
|
189 | - 'id' => $slug . '_to_activity', |
|
190 | - 'name' => $label . esc_html__( ' related with this activity', 'lsx-activities' ), |
|
191 | - 'type' => 'post_select', |
|
192 | - 'use_ajax' => false, |
|
193 | - 'repeatable' => true, |
|
194 | - 'allow_none' => true, |
|
195 | - 'query' => array( |
|
196 | - 'post_type' => $slug, |
|
197 | - 'nopagin' => true, |
|
198 | - 'posts_per_page' => '-1', |
|
199 | - 'orderby' => 'title', |
|
200 | - 'order' => 'ASC', |
|
201 | - ), |
|
202 | - ); |
|
182 | + $metabox['fields'][] = array( |
|
183 | + 'id' => $slug . '_title', |
|
184 | + 'name' => $label, |
|
185 | + 'type' => 'title', |
|
186 | + ); |
|
187 | + |
|
188 | + $metabox['fields'][] = array( |
|
189 | + 'id' => $slug . '_to_activity', |
|
190 | + 'name' => $label . esc_html__( ' related with this activity', 'lsx-activities' ), |
|
191 | + 'type' => 'post_select', |
|
192 | + 'use_ajax' => false, |
|
193 | + 'repeatable' => true, |
|
194 | + 'allow_none' => true, |
|
195 | + 'query' => array( |
|
196 | + 'post_type' => $slug, |
|
197 | + 'nopagin' => true, |
|
198 | + 'posts_per_page' => '-1', |
|
199 | + 'orderby' => 'title', |
|
200 | + 'order' => 'ASC', |
|
201 | + ), |
|
202 | + ); |
|
203 | 203 | } |
204 | 204 | |
205 | 205 | $metabox['fields'] = apply_filters( 'lsx_to_activity_custom_fields', $metabox['fields'] ); |
@@ -14,19 +14,19 @@ discard block |
||
14 | 14 | * @category activity |
15 | 15 | */ |
16 | 16 | if ( ! function_exists( 'lsx_to_activity_posts' ) ) { |
17 | - function lsx_to_activity_posts() { |
|
18 | - global $lsx_to_archive; |
|
17 | + function lsx_to_activity_posts() { |
|
18 | + global $lsx_to_archive; |
|
19 | 19 | |
20 | - $args = array( |
|
21 | - 'from' => 'post', |
|
22 | - 'to' => 'activity', |
|
23 | - 'column' => '3', |
|
24 | - 'before' => '<section id="posts" class="lsx-to-section lsx-to-collapse-section"><h2 class="lsx-to-section-title lsx-to-collapse-title lsx-title" data-toggle="collapse" data-target="#collapse-posts">' . esc_html__( 'Featured Posts', 'lsx-activities' ) . '</h2><div id="collapse-posts" class="collapse in"><div class="collapse-inner">', |
|
25 | - 'after' => '</div></div></section>', |
|
26 | - ); |
|
20 | + $args = array( |
|
21 | + 'from' => 'post', |
|
22 | + 'to' => 'activity', |
|
23 | + 'column' => '3', |
|
24 | + 'before' => '<section id="posts" class="lsx-to-section lsx-to-collapse-section"><h2 class="lsx-to-section-title lsx-to-collapse-title lsx-title" data-toggle="collapse" data-target="#collapse-posts">' . esc_html__( 'Featured Posts', 'lsx-activities' ) . '</h2><div id="collapse-posts" class="collapse in"><div class="collapse-inner">', |
|
25 | + 'after' => '</div></div></section>', |
|
26 | + ); |
|
27 | 27 | |
28 | - lsx_to_connected_panel_query( $args ); |
|
29 | - } |
|
28 | + lsx_to_connected_panel_query( $args ); |
|
29 | + } |
|
30 | 30 | } |
31 | 31 | |
32 | 32 | /** |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | * @category content |
38 | 38 | */ |
39 | 39 | function lsx_to_activity_content( $slug, $name = null ) { |
40 | - do_action( 'lsx_to_activity_content', $slug, $name ); |
|
40 | + do_action( 'lsx_to_activity_content', $slug, $name ); |
|
41 | 41 | } |
42 | 42 | |
43 | 43 | /** |
@@ -48,22 +48,22 @@ discard block |
||
48 | 48 | * @category activity |
49 | 49 | */ |
50 | 50 | if ( ! function_exists( 'lsx_to_activity_tours' ) ) { |
51 | - function lsx_to_activity_tours() { |
|
52 | - global $wp_query; |
|
51 | + function lsx_to_activity_tours() { |
|
52 | + global $wp_query; |
|
53 | 53 | |
54 | - if ( post_type_exists( 'tour' ) && is_singular( 'activity' ) ) { |
|
55 | - $args = array( |
|
56 | - 'from' => 'tour', |
|
57 | - 'to' => 'activity', |
|
58 | - 'content_part' => 'tour', |
|
59 | - 'column' => '3', |
|
60 | - 'before' => '<section id="tours" class="lsx-to-section lsx-to-collapse-section"><h2 class="lsx-to-section-title lsx-to-collapse-title lsx-title" data-toggle="collapse" data-target="#collapse-tours">' . __( lsx_to_get_post_type_section_title( 'tour', '', 'Featured Tours' ), 'lsx-activities' ) . '</h2><div id="collapse-tours" class="collapse in"><div class="collapse-inner">', |
|
61 | - 'after' => '</div></div></section>', |
|
62 | - ); |
|
54 | + if ( post_type_exists( 'tour' ) && is_singular( 'activity' ) ) { |
|
55 | + $args = array( |
|
56 | + 'from' => 'tour', |
|
57 | + 'to' => 'activity', |
|
58 | + 'content_part' => 'tour', |
|
59 | + 'column' => '3', |
|
60 | + 'before' => '<section id="tours" class="lsx-to-section lsx-to-collapse-section"><h2 class="lsx-to-section-title lsx-to-collapse-title lsx-title" data-toggle="collapse" data-target="#collapse-tours">' . __( lsx_to_get_post_type_section_title( 'tour', '', 'Featured Tours' ), 'lsx-activities' ) . '</h2><div id="collapse-tours" class="collapse in"><div class="collapse-inner">', |
|
61 | + 'after' => '</div></div></section>', |
|
62 | + ); |
|
63 | 63 | |
64 | - lsx_to_connected_panel_query( $args ); |
|
65 | - } |
|
66 | - } |
|
64 | + lsx_to_connected_panel_query( $args ); |
|
65 | + } |
|
66 | + } |
|
67 | 67 | } |
68 | 68 | /** |
69 | 69 | * Outputs the activites accommodation |
@@ -73,22 +73,22 @@ discard block |
||
73 | 73 | * @category activity |
74 | 74 | */ |
75 | 75 | if ( ! function_exists( 'lsx_to_activity_accommodation' ) ) { |
76 | - function lsx_to_activity_accommodation() { |
|
77 | - global $wp_query; |
|
76 | + function lsx_to_activity_accommodation() { |
|
77 | + global $wp_query; |
|
78 | 78 | |
79 | - if ( post_type_exists( 'accommodation' ) && is_singular( 'activity' ) ) { |
|
80 | - $args = array( |
|
81 | - 'from' => 'accommodation', |
|
82 | - 'to' => 'activity', |
|
83 | - 'content_part' => 'accommodation', |
|
84 | - 'column' => '3', |
|
85 | - 'before' => '<section id="accommodation" class="lsx-to-section lsx-to-collapse-section"><h2 class="lsx-to-section-title lsx-to-collapse-title lsx-title" data-toggle="collapse" data-target="#collapse-accommodation">' . __( lsx_to_get_post_type_section_title( 'accommodation', '', 'Featured Accommodations' ), 'lsx-activities' ) . '</h2><div id="collapse-accommodation" class="collapse in"><div class="collapse-inner">', |
|
86 | - 'after' => '</div></div></section>', |
|
87 | - ); |
|
79 | + if ( post_type_exists( 'accommodation' ) && is_singular( 'activity' ) ) { |
|
80 | + $args = array( |
|
81 | + 'from' => 'accommodation', |
|
82 | + 'to' => 'activity', |
|
83 | + 'content_part' => 'accommodation', |
|
84 | + 'column' => '3', |
|
85 | + 'before' => '<section id="accommodation" class="lsx-to-section lsx-to-collapse-section"><h2 class="lsx-to-section-title lsx-to-collapse-title lsx-title" data-toggle="collapse" data-target="#collapse-accommodation">' . __( lsx_to_get_post_type_section_title( 'accommodation', '', 'Featured Accommodations' ), 'lsx-activities' ) . '</h2><div id="collapse-accommodation" class="collapse in"><div class="collapse-inner">', |
|
86 | + 'after' => '</div></div></section>', |
|
87 | + ); |
|
88 | 88 | |
89 | - lsx_to_connected_panel_query( $args ); |
|
90 | - } |
|
91 | - } |
|
89 | + lsx_to_connected_panel_query( $args ); |
|
90 | + } |
|
91 | + } |
|
92 | 92 | } |
93 | 93 | |
94 | 94 | /** |
@@ -104,5 +104,5 @@ discard block |
||
104 | 104 | * @category connections |
105 | 105 | */ |
106 | 106 | function lsx_to_connected_activities( $before = '', $after = '', $echo = true ) { |
107 | - lsx_to_connected_items_query( 'activity', get_post_type(), $before, $after, $echo ); |
|
107 | + lsx_to_connected_items_query( 'activity', get_post_type(), $before, $after, $echo ); |
|
108 | 108 | } |
@@ -9,7 +9,7 @@ discard block |
||
9 | 9 | global $lsx_to_archive, $post; |
10 | 10 | |
11 | 11 | if ( 1 !== $lsx_to_archive ) { |
12 | - $lsx_to_archive = false; |
|
12 | + $lsx_to_archive = false; |
|
13 | 13 | } |
14 | 14 | ?> |
15 | 15 | |
@@ -33,10 +33,10 @@ discard block |
||
33 | 33 | <?php } elseif ( is_search() || empty( tour_operator()->options[ get_post_type() ]['disable_entry_text'] ) ) { ?> |
34 | 34 | |
35 | 35 | <div <?php lsx_to_entry_class( 'entry-content' ); ?>><?php |
36 | - lsx_to_entry_content_top(); |
|
37 | - the_excerpt(); |
|
38 | - lsx_to_entry_content_bottom(); |
|
39 | - ?></div> |
|
36 | + lsx_to_entry_content_top(); |
|
37 | + the_excerpt(); |
|
38 | + lsx_to_entry_content_bottom(); |
|
39 | + ?></div> |
|
40 | 40 | |
41 | 41 | <?php } ?> |
42 | 42 |
@@ -13,10 +13,10 @@ discard block |
||
13 | 13 | $permalink = ''; |
14 | 14 | |
15 | 15 | if ( $has_single ) { |
16 | - $permalink = get_the_permalink(); |
|
16 | + $permalink = get_the_permalink(); |
|
17 | 17 | } elseif ( ! is_post_type_archive( 'activity' ) ) { |
18 | - $has_single = true; |
|
19 | - $permalink = get_post_type_archive_link( 'activity' ) . '#activity-' . $post->post_name; |
|
18 | + $has_single = true; |
|
19 | + $permalink = get_post_type_archive_link( 'activity' ) . '#activity-' . $post->post_name; |
|
20 | 20 | } |
21 | 21 | ?> |
22 | 22 | <article <?php post_class(); ?>> |
@@ -36,35 +36,35 @@ discard block |
||
36 | 36 | </h4> |
37 | 37 | |
38 | 38 | <?php |
39 | - // if ( empty( $disable_text ) ) { |
|
40 | - // lsx_to_tagline( '<p class="lsx-to-widget-tagline text-center">', '</p>' ); |
|
41 | - // } |
|
42 | - ?> |
|
39 | + // if ( empty( $disable_text ) ) { |
|
40 | + // lsx_to_tagline( '<p class="lsx-to-widget-tagline text-center">', '</p>' ); |
|
41 | + // } |
|
42 | + ?> |
|
43 | 43 | |
44 | 44 | <div class="lsx-to-widget-meta-data"> |
45 | 45 | <?php |
46 | - $meta_class = 'lsx-to-meta-data lsx-to-meta-data-'; |
|
46 | + $meta_class = 'lsx-to-meta-data lsx-to-meta-data-'; |
|
47 | 47 | |
48 | - lsx_to_price( '<span class="' . $meta_class . 'price"><span class="lsx-to-meta-data-key">' . esc_html__( 'From price', 'lsx-activities' ) . ':</span> ', '</span>' ); |
|
49 | - lsx_to_connected_destinations( '<span class="' . $meta_class . 'destinations"><span class="lsx-to-meta-data-key">' . __( 'Location', 'lsx-activities' ) . ':</span> ', '</span>' ); |
|
50 | - lsx_to_connected_accommodation( '<span class="' . $meta_class . 'accommodations"><span class="lsx-to-meta-data-key">' . __( 'Accommodation', 'lsx-activities' ) . ':</span> ', '</span>' ); |
|
51 | - lsx_to_connected_tours( '<span class="' . $meta_class . 'tours"><span class="lsx-to-meta-data-key">' . __( 'Tours', 'lsx-activities' ) . ':</span> ', '</span>' ); |
|
52 | - ?> |
|
48 | + lsx_to_price( '<span class="' . $meta_class . 'price"><span class="lsx-to-meta-data-key">' . esc_html__( 'From price', 'lsx-activities' ) . ':</span> ', '</span>' ); |
|
49 | + lsx_to_connected_destinations( '<span class="' . $meta_class . 'destinations"><span class="lsx-to-meta-data-key">' . __( 'Location', 'lsx-activities' ) . ':</span> ', '</span>' ); |
|
50 | + lsx_to_connected_accommodation( '<span class="' . $meta_class . 'accommodations"><span class="lsx-to-meta-data-key">' . __( 'Accommodation', 'lsx-activities' ) . ':</span> ', '</span>' ); |
|
51 | + lsx_to_connected_tours( '<span class="' . $meta_class . 'tours"><span class="lsx-to-meta-data-key">' . __( 'Tours', 'lsx-activities' ) . ':</span> ', '</span>' ); |
|
52 | + ?> |
|
53 | 53 | </div> |
54 | 54 | |
55 | 55 | <?php |
56 | - ob_start(); |
|
57 | - lsx_to_widget_entry_content_top(); |
|
58 | - the_excerpt(); |
|
59 | - lsx_to_widget_entry_content_bottom(); |
|
60 | - $excerpt = ob_get_clean(); |
|
56 | + ob_start(); |
|
57 | + lsx_to_widget_entry_content_top(); |
|
58 | + the_excerpt(); |
|
59 | + lsx_to_widget_entry_content_bottom(); |
|
60 | + $excerpt = ob_get_clean(); |
|
61 | 61 | |
62 | - if ( empty( $disable_text ) && ! empty( $excerpt ) ) { |
|
63 | - echo wp_kses_post( $excerpt ); |
|
64 | - } elseif ( $has_single ) { ?> |
|
62 | + if ( empty( $disable_text ) && ! empty( $excerpt ) ) { |
|
63 | + echo wp_kses_post( $excerpt ); |
|
64 | + } elseif ( $has_single ) { ?> |
|
65 | 65 | <p><a href="<?php echo esc_url( $permalink ); ?>" class="moretag"><?php esc_html_e( 'View more', 'lsx-activities' ); ?></a></p> |
66 | 66 | <?php } |
67 | - ?> |
|
67 | + ?> |
|
68 | 68 | </div> |
69 | 69 | |
70 | 70 | </article> |
@@ -18,99 +18,99 @@ |
||
18 | 18 | |
19 | 19 | class LSX_Activities_Admin extends LSX_Activities { |
20 | 20 | |
21 | - /** |
|
22 | - * Constructor |
|
23 | - */ |
|
24 | - public function __construct() { |
|
25 | - $this->set_vars(); |
|
21 | + /** |
|
22 | + * Constructor |
|
23 | + */ |
|
24 | + public function __construct() { |
|
25 | + $this->set_vars(); |
|
26 | 26 | |
27 | - add_filter( 'lsx_get_post-types_configs', array( $this, 'post_type_config' ), 10, 1 ); |
|
28 | - add_filter( 'lsx_get_metaboxes_configs', array( $this, 'meta_box_config' ), 10, 1 ); |
|
27 | + add_filter( 'lsx_get_post-types_configs', array( $this, 'post_type_config' ), 10, 1 ); |
|
28 | + add_filter( 'lsx_get_metaboxes_configs', array( $this, 'meta_box_config' ), 10, 1 ); |
|
29 | 29 | |
30 | - add_filter( 'lsx_to_destination_custom_fields', array( $this, 'custom_fields' ) ); |
|
31 | - add_filter( 'lsx_to_tour_custom_fields', array( $this, 'custom_fields' ) ); |
|
32 | - add_filter( 'lsx_to_accommodation_custom_fields', array( $this, 'custom_fields' ) ); |
|
30 | + add_filter( 'lsx_to_destination_custom_fields', array( $this, 'custom_fields' ) ); |
|
31 | + add_filter( 'lsx_to_tour_custom_fields', array( $this, 'custom_fields' ) ); |
|
32 | + add_filter( 'lsx_to_accommodation_custom_fields', array( $this, 'custom_fields' ) ); |
|
33 | 33 | |
34 | - add_filter( 'lsx_to_team_custom_fields', array( $this, 'custom_fields' ) ); |
|
35 | - add_filter( 'lsx_to_special_custom_fields', array( $this, 'custom_fields' ) ); |
|
36 | - add_filter( 'lsx_to_review_custom_fields', array( $this, 'custom_fields' ) ); |
|
37 | - } |
|
34 | + add_filter( 'lsx_to_team_custom_fields', array( $this, 'custom_fields' ) ); |
|
35 | + add_filter( 'lsx_to_special_custom_fields', array( $this, 'custom_fields' ) ); |
|
36 | + add_filter( 'lsx_to_review_custom_fields', array( $this, 'custom_fields' ) ); |
|
37 | + } |
|
38 | 38 | |
39 | - /** |
|
40 | - * Register the activity post type config |
|
41 | - * |
|
42 | - * @param $objects |
|
43 | - * @return array |
|
44 | - */ |
|
45 | - public function post_type_config( $objects ) { |
|
46 | - foreach ( $this->post_types as $key => $label ) { |
|
47 | - if ( file_exists( LSX_ACTIVITIES_PATH . 'includes/post-types/config-' . $key . '.php' ) ) { |
|
48 | - $objects[ $key ] = include LSX_ACTIVITIES_PATH . 'includes/post-types/config-' . $key . '.php'; |
|
49 | - } |
|
50 | - } |
|
51 | - return $objects; |
|
52 | - } |
|
39 | + /** |
|
40 | + * Register the activity post type config |
|
41 | + * |
|
42 | + * @param $objects |
|
43 | + * @return array |
|
44 | + */ |
|
45 | + public function post_type_config( $objects ) { |
|
46 | + foreach ( $this->post_types as $key => $label ) { |
|
47 | + if ( file_exists( LSX_ACTIVITIES_PATH . 'includes/post-types/config-' . $key . '.php' ) ) { |
|
48 | + $objects[ $key ] = include LSX_ACTIVITIES_PATH . 'includes/post-types/config-' . $key . '.php'; |
|
49 | + } |
|
50 | + } |
|
51 | + return $objects; |
|
52 | + } |
|
53 | 53 | |
54 | - /** |
|
55 | - * Register the activity metabox config |
|
56 | - * |
|
57 | - * @param $meta_boxes |
|
58 | - * @return array |
|
59 | - */ |
|
60 | - public function meta_box_config( $meta_boxes ) { |
|
61 | - foreach ( $this->post_types as $key => $label ) { |
|
62 | - if ( file_exists( LSX_ACTIVITIES_PATH . 'includes/metaboxes/config-' . $key . '.php' ) ) { |
|
63 | - $meta_boxes[ $key ] = include LSX_ACTIVITIES_PATH . 'includes/metaboxes/config-' . $key . '.php'; |
|
64 | - } |
|
65 | - } |
|
66 | - return $meta_boxes; |
|
67 | - } |
|
54 | + /** |
|
55 | + * Register the activity metabox config |
|
56 | + * |
|
57 | + * @param $meta_boxes |
|
58 | + * @return array |
|
59 | + */ |
|
60 | + public function meta_box_config( $meta_boxes ) { |
|
61 | + foreach ( $this->post_types as $key => $label ) { |
|
62 | + if ( file_exists( LSX_ACTIVITIES_PATH . 'includes/metaboxes/config-' . $key . '.php' ) ) { |
|
63 | + $meta_boxes[ $key ] = include LSX_ACTIVITIES_PATH . 'includes/metaboxes/config-' . $key . '.php'; |
|
64 | + } |
|
65 | + } |
|
66 | + return $meta_boxes; |
|
67 | + } |
|
68 | 68 | |
69 | - /** |
|
70 | - * Adds in the gallery fields to the Tour Operators Post Types. |
|
71 | - */ |
|
72 | - public function custom_fields( $fields ) { |
|
73 | - global $post, $typenow, $current_screen; |
|
69 | + /** |
|
70 | + * Adds in the gallery fields to the Tour Operators Post Types. |
|
71 | + */ |
|
72 | + public function custom_fields( $fields ) { |
|
73 | + global $post, $typenow, $current_screen; |
|
74 | 74 | |
75 | - $post_type = false; |
|
75 | + $post_type = false; |
|
76 | 76 | |
77 | - if ( $post && $post->post_type ) { |
|
78 | - $post_type = $post->post_type; |
|
79 | - } elseif ( $typenow ) { |
|
80 | - $post_type = $typenow; |
|
81 | - } elseif ( $current_screen && $current_screen->post_type ) { |
|
82 | - $post_type = $current_screen->post_type; |
|
83 | - } elseif ( isset( $_REQUEST['post_type'] ) ) { |
|
84 | - $post_type = sanitize_key( $_REQUEST['post_type'] ); |
|
85 | - } elseif ( isset( $_REQUEST['post'] ) ) { |
|
86 | - $post_type = get_post_type( sanitize_key( $_REQUEST['post'] ) ); |
|
87 | - } |
|
77 | + if ( $post && $post->post_type ) { |
|
78 | + $post_type = $post->post_type; |
|
79 | + } elseif ( $typenow ) { |
|
80 | + $post_type = $typenow; |
|
81 | + } elseif ( $current_screen && $current_screen->post_type ) { |
|
82 | + $post_type = $current_screen->post_type; |
|
83 | + } elseif ( isset( $_REQUEST['post_type'] ) ) { |
|
84 | + $post_type = sanitize_key( $_REQUEST['post_type'] ); |
|
85 | + } elseif ( isset( $_REQUEST['post'] ) ) { |
|
86 | + $post_type = get_post_type( sanitize_key( $_REQUEST['post'] ) ); |
|
87 | + } |
|
88 | 88 | |
89 | - if ( false !== $post_type ) { |
|
90 | - $fields[] = array( |
|
91 | - 'id' => 'activity_title', |
|
92 | - 'name' => 'Activities', |
|
93 | - 'type' => 'title', |
|
94 | - 'cols' => 12, |
|
95 | - ); |
|
96 | - $fields[] = array( |
|
97 | - 'id' => 'activity_to_' . $post_type, |
|
98 | - 'name' => 'Activities related with this ' . $post_type, |
|
99 | - 'type' => 'post_select', |
|
100 | - 'use_ajax' => false, |
|
101 | - 'query' => array( |
|
102 | - 'post_type' => 'activity', |
|
103 | - 'nopagin' => true, |
|
104 | - 'posts_per_page' => '-1', |
|
105 | - 'orderby' => 'title', |
|
106 | - 'order' => 'ASC', |
|
107 | - ), |
|
108 | - 'repeatable' => true, |
|
109 | - 'allow_none' => true, |
|
110 | - 'cols' => 12, |
|
111 | - ); |
|
112 | - } |
|
113 | - return $fields; |
|
114 | - } |
|
89 | + if ( false !== $post_type ) { |
|
90 | + $fields[] = array( |
|
91 | + 'id' => 'activity_title', |
|
92 | + 'name' => 'Activities', |
|
93 | + 'type' => 'title', |
|
94 | + 'cols' => 12, |
|
95 | + ); |
|
96 | + $fields[] = array( |
|
97 | + 'id' => 'activity_to_' . $post_type, |
|
98 | + 'name' => 'Activities related with this ' . $post_type, |
|
99 | + 'type' => 'post_select', |
|
100 | + 'use_ajax' => false, |
|
101 | + 'query' => array( |
|
102 | + 'post_type' => 'activity', |
|
103 | + 'nopagin' => true, |
|
104 | + 'posts_per_page' => '-1', |
|
105 | + 'orderby' => 'title', |
|
106 | + 'order' => 'ASC', |
|
107 | + ), |
|
108 | + 'repeatable' => true, |
|
109 | + 'allow_none' => true, |
|
110 | + 'cols' => 12, |
|
111 | + ); |
|
112 | + } |
|
113 | + return $fields; |
|
114 | + } |
|
115 | 115 | } |
116 | 116 | new LSX_Activities_Admin(); |
@@ -17,302 +17,302 @@ discard block |
||
17 | 17 | */ |
18 | 18 | class LSX_Activities_Frontend extends LSX_Activities { |
19 | 19 | |
20 | - /** |
|
21 | - * Holds the $page_links array while its being built on the single activity page. |
|
22 | - * |
|
23 | - * @var array |
|
24 | - */ |
|
25 | - public $page_links = false; |
|
26 | - |
|
27 | - /** |
|
28 | - * Constructor |
|
29 | - */ |
|
30 | - public function __construct() { |
|
31 | - $this->set_vars(); |
|
32 | - |
|
33 | - add_filter( 'lsx_to_entry_class', array( $this, 'entry_class' ) ); |
|
34 | - add_action( 'init',array( $this, 'init' ) ); |
|
35 | - |
|
36 | - if ( ! class_exists( 'LSX_TO_Template_Redirects' ) ) { |
|
37 | - require_once( LSX_ACTIVITIES_PATH . 'classes/class-template-redirects.php' ); |
|
38 | - } |
|
39 | - |
|
40 | - $this->redirects = new LSX_TO_Template_Redirects( LSX_ACTIVITIES_PATH, array_keys( $this->post_types ) ); |
|
41 | - |
|
42 | - add_action( 'lsx_to_activity_content', array( $this->redirects, 'content_part' ), 10 , 2 ); |
|
43 | - |
|
44 | - add_filter( 'lsx_to_page_navigation', array( $this, 'page_links' ) ); |
|
45 | - |
|
46 | - add_action( 'lsx_entry_top', array( $this, 'archive_entry_top' ), 15 ); |
|
47 | - add_action( 'lsx_entry_bottom', array( $this, 'archive_entry_bottom' ) ); |
|
48 | - add_action( 'lsx_content_bottom', array( $this, 'single_content_bottom' ) ); |
|
49 | - add_action( 'lsx_to_fast_facts', array( $this, 'single_fast_facts' ) ); |
|
50 | - } |
|
51 | - |
|
52 | - /** |
|
53 | - * Runs on init after all files have been parsed. |
|
54 | - */ |
|
55 | - public function init() { |
|
56 | - if ( ! class_exists( 'LSX_Currencies' ) ) { |
|
57 | - add_filter( 'lsx_to_custom_field_query',array( $this, 'price_filter' ),5,10 ); |
|
58 | - } |
|
59 | - } |
|
60 | - |
|
61 | - /** |
|
62 | - * A filter to set the content area to a small column on single |
|
63 | - */ |
|
64 | - public function entry_class( $classes ) { |
|
65 | - global $lsx_to_archive; |
|
66 | - |
|
67 | - if ( 1 !== $lsx_to_archive ) { |
|
68 | - $lsx_to_archive = false; |
|
69 | - } |
|
70 | - |
|
71 | - if ( is_main_query() && is_singular( 'activity' ) && false === $lsx_to_archive ) { |
|
72 | - $classes[] = 'col-xs-12 col-sm-12 col-md-6'; |
|
73 | - } |
|
74 | - |
|
75 | - return $classes; |
|
76 | - } |
|
77 | - |
|
78 | - /** |
|
79 | - * Adds in additional info for the price custom field |
|
80 | - */ |
|
81 | - public function price_filter( $html = '', $meta_key = false, $value = false, $before = '', $after = '' ) { |
|
82 | - if ( get_post_type() === 'activity' && 'price' === $meta_key ) { |
|
83 | - $price_type = get_post_meta( get_the_ID(),'price_type',true ); |
|
84 | - $value = preg_replace( '/[^0-9,.]/', '', $value ); |
|
85 | - $value = ltrim( $value, '.' ); |
|
86 | - $value = str_replace( ',','',$value ); |
|
87 | - $value = number_format( (int) $value,2 ); |
|
88 | - $tour_operator = tour_operator(); |
|
89 | - $currency = ''; |
|
90 | - |
|
91 | - if ( is_object( $tour_operator ) && isset( $tour_operator->options['general'] ) && is_array( $tour_operator->options['general'] ) ) { |
|
92 | - if ( isset( $tour_operator->options['general']['currency'] ) && ! empty( $tour_operator->options['general']['currency'] ) ) { |
|
93 | - $currency = $tour_operator->options['general']['currency']; |
|
94 | - $currency = '<span class="currency-icon ' . mb_strtolower( $currency ) . '">' . $currency . '</span>'; |
|
95 | - } |
|
96 | - } |
|
97 | - |
|
98 | - switch ( $price_type ) { |
|
99 | - case 'per_person': |
|
100 | - case 'per_person_per_night': |
|
101 | - case 'per_person_sharing': |
|
102 | - case 'per_person_sharing_per_night': |
|
103 | - $value = $currency . $value . ' ' . ucwords( str_replace( '_',' ',$price_type ) ) . ''; |
|
104 | - $value = str_replace( 'Per Person', 'P/P', $value ); |
|
105 | - break; |
|
106 | - |
|
107 | - case 'total_percentage': |
|
108 | - $value .= '% ' . __( 'Off','to-specials' ) . ''; |
|
109 | - $before = str_replace( 'from price', '', $before ); |
|
110 | - break; |
|
111 | - |
|
112 | - case 'none': |
|
113 | - default: |
|
114 | - $value = $currency . $value; |
|
115 | - break; |
|
116 | - } |
|
117 | - |
|
118 | - $html = $before . $value . $after; |
|
119 | - } |
|
120 | - |
|
121 | - return $html; |
|
122 | - } |
|
123 | - |
|
124 | - /** |
|
125 | - * Adds our navigation links to the activity single post |
|
126 | - * |
|
127 | - * @param $page_links array |
|
128 | - * @return $page_links array |
|
129 | - */ |
|
130 | - public function page_links( $page_links ) { |
|
131 | - if ( is_singular( 'activity' ) ) { |
|
132 | - $this->page_links = $page_links; |
|
133 | - |
|
134 | - $this->get_map_link(); |
|
135 | - $this->get_related_tours_link(); |
|
136 | - $this->get_related_accommodation_link(); |
|
137 | - $this->get_gallery_link(); |
|
138 | - $this->get_videos_link(); |
|
139 | - $this->get_related_posts_link(); |
|
140 | - |
|
141 | - $page_links = $this->page_links; |
|
142 | - } |
|
143 | - |
|
144 | - return $page_links; |
|
145 | - } |
|
146 | - |
|
147 | - /** |
|
148 | - * Tests for the Related Tours and returns a link for the section |
|
149 | - */ |
|
150 | - public function get_related_tours_link() { |
|
151 | - $connected_tours = get_post_meta( get_the_ID(), 'tour_to_activity', false ); |
|
152 | - |
|
153 | - if ( post_type_exists( 'tour' ) && is_array( $connected_tours ) && ! empty( $connected_tours ) ) { |
|
154 | - $connected_tours = new \WP_Query( array( |
|
155 | - 'post_type' => 'tour', |
|
156 | - 'post__in' => $connected_tours, |
|
157 | - 'post_status' => 'publish', |
|
158 | - 'nopagin' => true, |
|
159 | - 'posts_per_page' => '-1', |
|
160 | - 'fields' => 'ids', |
|
161 | - ) ); |
|
162 | - |
|
163 | - $connected_tours = $connected_tours->posts; |
|
164 | - |
|
165 | - if ( is_array( $connected_tours ) && ! empty( $connected_tours ) ) { |
|
166 | - $this->page_links['tours'] = esc_html__( 'Tours', 'lsx-activities' ); |
|
167 | - } |
|
168 | - } |
|
169 | - } |
|
170 | - |
|
171 | - /** |
|
172 | - * Tests for the Related Accommodation and returns a link for the section |
|
173 | - */ |
|
174 | - public function get_related_accommodation_link() { |
|
175 | - $connected_accommodation = get_post_meta( get_the_ID(), 'accommodation_to_activity', false ); |
|
176 | - |
|
177 | - if ( post_type_exists( 'accommodation' ) && is_array( $connected_accommodation ) && ! empty( $connected_accommodation ) ) { |
|
178 | - $connected_accommodation = new \WP_Query( array( |
|
179 | - 'post_type' => 'accommodation', |
|
180 | - 'post__in' => $connected_accommodation, |
|
181 | - 'post_status' => 'publish', |
|
182 | - 'nopagin' => true, |
|
183 | - 'posts_per_page' => '-1', |
|
184 | - 'fields' => 'ids', |
|
185 | - ) ); |
|
186 | - |
|
187 | - $connected_accommodation = $connected_accommodation->posts; |
|
188 | - |
|
189 | - if ( is_array( $connected_accommodation ) && ! empty( $connected_accommodation ) ) { |
|
190 | - $this->page_links['accommodation'] = esc_html__( 'Accommodation', 'lsx-activities' ); |
|
191 | - } |
|
192 | - } |
|
193 | - } |
|
194 | - |
|
195 | - /** |
|
196 | - * Tests for the Google Map and returns a link for the section |
|
197 | - */ |
|
198 | - public function get_map_link() { |
|
199 | - if ( function_exists( 'lsx_to_has_map' ) && lsx_to_has_map() ) { |
|
200 | - $this->page_links['activity-map'] = esc_html__( 'Map', 'lsx-activities' ); |
|
201 | - } |
|
202 | - } |
|
203 | - |
|
204 | - /** |
|
205 | - * Tests for the Gallery and returns a link for the section |
|
206 | - */ |
|
207 | - public function get_gallery_link() { |
|
208 | - $gallery_ids = get_post_meta( get_the_ID(), 'gallery', false ); |
|
209 | - $envira_gallery = get_post_meta( get_the_ID(), 'envira_gallery', true ); |
|
210 | - |
|
211 | - if ( ( ! empty( $gallery_ids ) && is_array( $gallery_ids ) ) || ( function_exists( 'envira_gallery' ) && ! empty( $envira_gallery ) && false === lsx_to_enable_envira_banner() ) ) { |
|
212 | - if ( function_exists( 'envira_gallery' ) && ! empty( $envira_gallery ) && false === lsx_to_enable_envira_banner() ) { |
|
213 | - // Envira Gallery |
|
214 | - $this->page_links['gallery'] = esc_html__( 'Gallery', 'lsx-activities' ); |
|
215 | - return; |
|
216 | - } else { |
|
217 | - if ( function_exists( 'envira_dynamic' ) ) { |
|
218 | - // Envira Gallery - Dynamic |
|
219 | - $this->page_links['gallery'] = esc_html__( 'Gallery', 'lsx-activities' ); |
|
220 | - return; |
|
221 | - } else { |
|
222 | - // WordPress Gallery |
|
223 | - $this->page_links['gallery'] = esc_html__( 'Gallery', 'lsx-activities' ); |
|
224 | - return; |
|
225 | - } |
|
226 | - } |
|
227 | - } |
|
228 | - } |
|
229 | - |
|
230 | - /** |
|
231 | - * Tests for the Videos and returns a link for the section |
|
232 | - */ |
|
233 | - public function get_videos_link() { |
|
234 | - $videos_id = false; |
|
235 | - |
|
236 | - if ( class_exists( 'Envira_Videos' ) ) { |
|
237 | - $videos_id = get_post_meta( get_the_ID(), 'envira_video', true ); |
|
238 | - } |
|
239 | - |
|
240 | - if ( empty( $videos_id ) && function_exists( 'lsx_to_videos' ) ) { |
|
241 | - $videos_id = get_post_meta( get_the_ID(), 'videos', true ); |
|
242 | - } |
|
243 | - |
|
244 | - if ( ! empty( $videos_id ) ) { |
|
245 | - $this->page_links['videos'] = esc_html__( 'Videos', 'lsx-activities' ); |
|
246 | - } |
|
247 | - } |
|
248 | - |
|
249 | - /** |
|
250 | - * Tests for the Related Posts and returns a link for the section |
|
251 | - */ |
|
252 | - public function get_related_posts_link() { |
|
253 | - $connected_posts = get_post_meta( get_the_ID(), 'post_to_activity', false ); |
|
254 | - |
|
255 | - if ( is_array( $connected_posts ) && ! empty( $connected_posts ) ) { |
|
256 | - $connected_posts = new \WP_Query( array( |
|
257 | - 'post_type' => 'post', |
|
258 | - 'post__in' => $connected_posts, |
|
259 | - 'post_status' => 'publish', |
|
260 | - 'nopagin' => true, |
|
261 | - 'posts_per_page' => '-1', |
|
262 | - 'fields' => 'ids', |
|
263 | - ) ); |
|
264 | - |
|
265 | - $connected_posts = $connected_posts->posts; |
|
266 | - |
|
267 | - if ( is_array( $connected_posts ) && ! empty( $connected_posts ) ) { |
|
268 | - $this->page_links['posts'] = esc_html__( 'Posts', 'lsx-activities' ); |
|
269 | - } |
|
270 | - } |
|
271 | - } |
|
272 | - |
|
273 | - /** |
|
274 | - * Adds the template tags to the top of the archive activity |
|
275 | - */ |
|
276 | - public function archive_entry_top() { |
|
277 | - global $lsx_to_archive; |
|
278 | - |
|
279 | - if ( 'activity' === get_post_type() && ( is_archive() || $lsx_to_archive ) ) { |
|
280 | - if ( is_search() || empty( tour_operator()->options[ get_post_type() ]['disable_entry_metadata'] ) ) { ?> |
|
20 | + /** |
|
21 | + * Holds the $page_links array while its being built on the single activity page. |
|
22 | + * |
|
23 | + * @var array |
|
24 | + */ |
|
25 | + public $page_links = false; |
|
26 | + |
|
27 | + /** |
|
28 | + * Constructor |
|
29 | + */ |
|
30 | + public function __construct() { |
|
31 | + $this->set_vars(); |
|
32 | + |
|
33 | + add_filter( 'lsx_to_entry_class', array( $this, 'entry_class' ) ); |
|
34 | + add_action( 'init',array( $this, 'init' ) ); |
|
35 | + |
|
36 | + if ( ! class_exists( 'LSX_TO_Template_Redirects' ) ) { |
|
37 | + require_once( LSX_ACTIVITIES_PATH . 'classes/class-template-redirects.php' ); |
|
38 | + } |
|
39 | + |
|
40 | + $this->redirects = new LSX_TO_Template_Redirects( LSX_ACTIVITIES_PATH, array_keys( $this->post_types ) ); |
|
41 | + |
|
42 | + add_action( 'lsx_to_activity_content', array( $this->redirects, 'content_part' ), 10 , 2 ); |
|
43 | + |
|
44 | + add_filter( 'lsx_to_page_navigation', array( $this, 'page_links' ) ); |
|
45 | + |
|
46 | + add_action( 'lsx_entry_top', array( $this, 'archive_entry_top' ), 15 ); |
|
47 | + add_action( 'lsx_entry_bottom', array( $this, 'archive_entry_bottom' ) ); |
|
48 | + add_action( 'lsx_content_bottom', array( $this, 'single_content_bottom' ) ); |
|
49 | + add_action( 'lsx_to_fast_facts', array( $this, 'single_fast_facts' ) ); |
|
50 | + } |
|
51 | + |
|
52 | + /** |
|
53 | + * Runs on init after all files have been parsed. |
|
54 | + */ |
|
55 | + public function init() { |
|
56 | + if ( ! class_exists( 'LSX_Currencies' ) ) { |
|
57 | + add_filter( 'lsx_to_custom_field_query',array( $this, 'price_filter' ),5,10 ); |
|
58 | + } |
|
59 | + } |
|
60 | + |
|
61 | + /** |
|
62 | + * A filter to set the content area to a small column on single |
|
63 | + */ |
|
64 | + public function entry_class( $classes ) { |
|
65 | + global $lsx_to_archive; |
|
66 | + |
|
67 | + if ( 1 !== $lsx_to_archive ) { |
|
68 | + $lsx_to_archive = false; |
|
69 | + } |
|
70 | + |
|
71 | + if ( is_main_query() && is_singular( 'activity' ) && false === $lsx_to_archive ) { |
|
72 | + $classes[] = 'col-xs-12 col-sm-12 col-md-6'; |
|
73 | + } |
|
74 | + |
|
75 | + return $classes; |
|
76 | + } |
|
77 | + |
|
78 | + /** |
|
79 | + * Adds in additional info for the price custom field |
|
80 | + */ |
|
81 | + public function price_filter( $html = '', $meta_key = false, $value = false, $before = '', $after = '' ) { |
|
82 | + if ( get_post_type() === 'activity' && 'price' === $meta_key ) { |
|
83 | + $price_type = get_post_meta( get_the_ID(),'price_type',true ); |
|
84 | + $value = preg_replace( '/[^0-9,.]/', '', $value ); |
|
85 | + $value = ltrim( $value, '.' ); |
|
86 | + $value = str_replace( ',','',$value ); |
|
87 | + $value = number_format( (int) $value,2 ); |
|
88 | + $tour_operator = tour_operator(); |
|
89 | + $currency = ''; |
|
90 | + |
|
91 | + if ( is_object( $tour_operator ) && isset( $tour_operator->options['general'] ) && is_array( $tour_operator->options['general'] ) ) { |
|
92 | + if ( isset( $tour_operator->options['general']['currency'] ) && ! empty( $tour_operator->options['general']['currency'] ) ) { |
|
93 | + $currency = $tour_operator->options['general']['currency']; |
|
94 | + $currency = '<span class="currency-icon ' . mb_strtolower( $currency ) . '">' . $currency . '</span>'; |
|
95 | + } |
|
96 | + } |
|
97 | + |
|
98 | + switch ( $price_type ) { |
|
99 | + case 'per_person': |
|
100 | + case 'per_person_per_night': |
|
101 | + case 'per_person_sharing': |
|
102 | + case 'per_person_sharing_per_night': |
|
103 | + $value = $currency . $value . ' ' . ucwords( str_replace( '_',' ',$price_type ) ) . ''; |
|
104 | + $value = str_replace( 'Per Person', 'P/P', $value ); |
|
105 | + break; |
|
106 | + |
|
107 | + case 'total_percentage': |
|
108 | + $value .= '% ' . __( 'Off','to-specials' ) . ''; |
|
109 | + $before = str_replace( 'from price', '', $before ); |
|
110 | + break; |
|
111 | + |
|
112 | + case 'none': |
|
113 | + default: |
|
114 | + $value = $currency . $value; |
|
115 | + break; |
|
116 | + } |
|
117 | + |
|
118 | + $html = $before . $value . $after; |
|
119 | + } |
|
120 | + |
|
121 | + return $html; |
|
122 | + } |
|
123 | + |
|
124 | + /** |
|
125 | + * Adds our navigation links to the activity single post |
|
126 | + * |
|
127 | + * @param $page_links array |
|
128 | + * @return $page_links array |
|
129 | + */ |
|
130 | + public function page_links( $page_links ) { |
|
131 | + if ( is_singular( 'activity' ) ) { |
|
132 | + $this->page_links = $page_links; |
|
133 | + |
|
134 | + $this->get_map_link(); |
|
135 | + $this->get_related_tours_link(); |
|
136 | + $this->get_related_accommodation_link(); |
|
137 | + $this->get_gallery_link(); |
|
138 | + $this->get_videos_link(); |
|
139 | + $this->get_related_posts_link(); |
|
140 | + |
|
141 | + $page_links = $this->page_links; |
|
142 | + } |
|
143 | + |
|
144 | + return $page_links; |
|
145 | + } |
|
146 | + |
|
147 | + /** |
|
148 | + * Tests for the Related Tours and returns a link for the section |
|
149 | + */ |
|
150 | + public function get_related_tours_link() { |
|
151 | + $connected_tours = get_post_meta( get_the_ID(), 'tour_to_activity', false ); |
|
152 | + |
|
153 | + if ( post_type_exists( 'tour' ) && is_array( $connected_tours ) && ! empty( $connected_tours ) ) { |
|
154 | + $connected_tours = new \WP_Query( array( |
|
155 | + 'post_type' => 'tour', |
|
156 | + 'post__in' => $connected_tours, |
|
157 | + 'post_status' => 'publish', |
|
158 | + 'nopagin' => true, |
|
159 | + 'posts_per_page' => '-1', |
|
160 | + 'fields' => 'ids', |
|
161 | + ) ); |
|
162 | + |
|
163 | + $connected_tours = $connected_tours->posts; |
|
164 | + |
|
165 | + if ( is_array( $connected_tours ) && ! empty( $connected_tours ) ) { |
|
166 | + $this->page_links['tours'] = esc_html__( 'Tours', 'lsx-activities' ); |
|
167 | + } |
|
168 | + } |
|
169 | + } |
|
170 | + |
|
171 | + /** |
|
172 | + * Tests for the Related Accommodation and returns a link for the section |
|
173 | + */ |
|
174 | + public function get_related_accommodation_link() { |
|
175 | + $connected_accommodation = get_post_meta( get_the_ID(), 'accommodation_to_activity', false ); |
|
176 | + |
|
177 | + if ( post_type_exists( 'accommodation' ) && is_array( $connected_accommodation ) && ! empty( $connected_accommodation ) ) { |
|
178 | + $connected_accommodation = new \WP_Query( array( |
|
179 | + 'post_type' => 'accommodation', |
|
180 | + 'post__in' => $connected_accommodation, |
|
181 | + 'post_status' => 'publish', |
|
182 | + 'nopagin' => true, |
|
183 | + 'posts_per_page' => '-1', |
|
184 | + 'fields' => 'ids', |
|
185 | + ) ); |
|
186 | + |
|
187 | + $connected_accommodation = $connected_accommodation->posts; |
|
188 | + |
|
189 | + if ( is_array( $connected_accommodation ) && ! empty( $connected_accommodation ) ) { |
|
190 | + $this->page_links['accommodation'] = esc_html__( 'Accommodation', 'lsx-activities' ); |
|
191 | + } |
|
192 | + } |
|
193 | + } |
|
194 | + |
|
195 | + /** |
|
196 | + * Tests for the Google Map and returns a link for the section |
|
197 | + */ |
|
198 | + public function get_map_link() { |
|
199 | + if ( function_exists( 'lsx_to_has_map' ) && lsx_to_has_map() ) { |
|
200 | + $this->page_links['activity-map'] = esc_html__( 'Map', 'lsx-activities' ); |
|
201 | + } |
|
202 | + } |
|
203 | + |
|
204 | + /** |
|
205 | + * Tests for the Gallery and returns a link for the section |
|
206 | + */ |
|
207 | + public function get_gallery_link() { |
|
208 | + $gallery_ids = get_post_meta( get_the_ID(), 'gallery', false ); |
|
209 | + $envira_gallery = get_post_meta( get_the_ID(), 'envira_gallery', true ); |
|
210 | + |
|
211 | + if ( ( ! empty( $gallery_ids ) && is_array( $gallery_ids ) ) || ( function_exists( 'envira_gallery' ) && ! empty( $envira_gallery ) && false === lsx_to_enable_envira_banner() ) ) { |
|
212 | + if ( function_exists( 'envira_gallery' ) && ! empty( $envira_gallery ) && false === lsx_to_enable_envira_banner() ) { |
|
213 | + // Envira Gallery |
|
214 | + $this->page_links['gallery'] = esc_html__( 'Gallery', 'lsx-activities' ); |
|
215 | + return; |
|
216 | + } else { |
|
217 | + if ( function_exists( 'envira_dynamic' ) ) { |
|
218 | + // Envira Gallery - Dynamic |
|
219 | + $this->page_links['gallery'] = esc_html__( 'Gallery', 'lsx-activities' ); |
|
220 | + return; |
|
221 | + } else { |
|
222 | + // WordPress Gallery |
|
223 | + $this->page_links['gallery'] = esc_html__( 'Gallery', 'lsx-activities' ); |
|
224 | + return; |
|
225 | + } |
|
226 | + } |
|
227 | + } |
|
228 | + } |
|
229 | + |
|
230 | + /** |
|
231 | + * Tests for the Videos and returns a link for the section |
|
232 | + */ |
|
233 | + public function get_videos_link() { |
|
234 | + $videos_id = false; |
|
235 | + |
|
236 | + if ( class_exists( 'Envira_Videos' ) ) { |
|
237 | + $videos_id = get_post_meta( get_the_ID(), 'envira_video', true ); |
|
238 | + } |
|
239 | + |
|
240 | + if ( empty( $videos_id ) && function_exists( 'lsx_to_videos' ) ) { |
|
241 | + $videos_id = get_post_meta( get_the_ID(), 'videos', true ); |
|
242 | + } |
|
243 | + |
|
244 | + if ( ! empty( $videos_id ) ) { |
|
245 | + $this->page_links['videos'] = esc_html__( 'Videos', 'lsx-activities' ); |
|
246 | + } |
|
247 | + } |
|
248 | + |
|
249 | + /** |
|
250 | + * Tests for the Related Posts and returns a link for the section |
|
251 | + */ |
|
252 | + public function get_related_posts_link() { |
|
253 | + $connected_posts = get_post_meta( get_the_ID(), 'post_to_activity', false ); |
|
254 | + |
|
255 | + if ( is_array( $connected_posts ) && ! empty( $connected_posts ) ) { |
|
256 | + $connected_posts = new \WP_Query( array( |
|
257 | + 'post_type' => 'post', |
|
258 | + 'post__in' => $connected_posts, |
|
259 | + 'post_status' => 'publish', |
|
260 | + 'nopagin' => true, |
|
261 | + 'posts_per_page' => '-1', |
|
262 | + 'fields' => 'ids', |
|
263 | + ) ); |
|
264 | + |
|
265 | + $connected_posts = $connected_posts->posts; |
|
266 | + |
|
267 | + if ( is_array( $connected_posts ) && ! empty( $connected_posts ) ) { |
|
268 | + $this->page_links['posts'] = esc_html__( 'Posts', 'lsx-activities' ); |
|
269 | + } |
|
270 | + } |
|
271 | + } |
|
272 | + |
|
273 | + /** |
|
274 | + * Adds the template tags to the top of the archive activity |
|
275 | + */ |
|
276 | + public function archive_entry_top() { |
|
277 | + global $lsx_to_archive; |
|
278 | + |
|
279 | + if ( 'activity' === get_post_type() && ( is_archive() || $lsx_to_archive ) ) { |
|
280 | + if ( is_search() || empty( tour_operator()->options[ get_post_type() ]['disable_entry_metadata'] ) ) { ?> |
|
281 | 281 | <div class="lsx-to-archive-meta-data lsx-to-archive-meta-data-grid-mode"> |
282 | 282 | <?php |
283 | - $meta_class = 'lsx-to-meta-data lsx-to-meta-data-'; |
|
284 | - |
|
285 | - lsx_to_price( '<span class="' . $meta_class . 'price"><span class="lsx-to-meta-data-key">' . esc_html__( 'From price', 'lsx-activities' ) . ':</span> ', '</span>' ); |
|
286 | - lsx_to_accommodation_activity_friendly( '<span class="' . $meta_class . 'friendly"><span class="lsx-to-meta-data-key">' . __( 'Friendly', 'lsx-activities' ) . ':</span> ', '</span>' ); |
|
287 | - lsx_to_connected_destinations( '<span class="' . $meta_class . 'destinations"><span class="lsx-to-meta-data-key">' . __( 'Location', 'lsx-activities' ) . ':</span> ','</span>' ); |
|
288 | - lsx_to_connected_accommodation( '<span class="' . $meta_class . 'accommodations"><span class="lsx-to-meta-data-key">' . __( 'Accommodation', 'lsx-activities' ) . ':</span> ', '</span>' ); |
|
289 | - lsx_to_connected_tours( '<span class="' . $meta_class . 'tours"><span class="lsx-to-meta-data-key">' . __( 'Tours', 'lsx-activities' ) . ':</span> ', '</span>' ); |
|
290 | - ?> |
|
283 | + $meta_class = 'lsx-to-meta-data lsx-to-meta-data-'; |
|
284 | + |
|
285 | + lsx_to_price( '<span class="' . $meta_class . 'price"><span class="lsx-to-meta-data-key">' . esc_html__( 'From price', 'lsx-activities' ) . ':</span> ', '</span>' ); |
|
286 | + lsx_to_accommodation_activity_friendly( '<span class="' . $meta_class . 'friendly"><span class="lsx-to-meta-data-key">' . __( 'Friendly', 'lsx-activities' ) . ':</span> ', '</span>' ); |
|
287 | + lsx_to_connected_destinations( '<span class="' . $meta_class . 'destinations"><span class="lsx-to-meta-data-key">' . __( 'Location', 'lsx-activities' ) . ':</span> ','</span>' ); |
|
288 | + lsx_to_connected_accommodation( '<span class="' . $meta_class . 'accommodations"><span class="lsx-to-meta-data-key">' . __( 'Accommodation', 'lsx-activities' ) . ':</span> ', '</span>' ); |
|
289 | + lsx_to_connected_tours( '<span class="' . $meta_class . 'tours"><span class="lsx-to-meta-data-key">' . __( 'Tours', 'lsx-activities' ) . ':</span> ', '</span>' ); |
|
290 | + ?> |
|
291 | 291 | </div> |
292 | 292 | <?php } |
293 | - } |
|
294 | - } |
|
293 | + } |
|
294 | + } |
|
295 | 295 | |
296 | - /** |
|
297 | - * Adds the template tags to the bottom of the archive activity |
|
298 | - */ |
|
299 | - public function archive_entry_bottom() { |
|
300 | - global $lsx_to_archive; |
|
296 | + /** |
|
297 | + * Adds the template tags to the bottom of the archive activity |
|
298 | + */ |
|
299 | + public function archive_entry_bottom() { |
|
300 | + global $lsx_to_archive; |
|
301 | 301 | |
302 | - if ( 'activity' === get_post_type() && ( is_archive() || $lsx_to_archive ) ) { ?> |
|
302 | + if ( 'activity' === get_post_type() && ( is_archive() || $lsx_to_archive ) ) { ?> |
|
303 | 303 | </div> |
304 | 304 | |
305 | 305 | <?php if ( is_search() || empty( tour_operator()->options[ get_post_type() ]['disable_entry_metadata'] ) ) { ?> |
306 | 306 | <div class="lsx-to-archive-meta-data lsx-to-archive-meta-data-list-mode"> |
307 | 307 | <?php |
308 | - $meta_class = 'lsx-to-meta-data lsx-to-meta-data-'; |
|
309 | - |
|
310 | - lsx_to_price( '<span class="' . $meta_class . 'price"><span class="lsx-to-meta-data-key">' . esc_html__( 'From price', 'lsx-activities' ) . ':</span> ', '</span>' ); |
|
311 | - lsx_to_accommodation_activity_friendly( '<span class="' . $meta_class . 'friendly"><span class="lsx-to-meta-data-key">' . __( 'Friendly', 'lsx-activities' ) . ':</span> ', '</span>' ); |
|
312 | - lsx_to_connected_destinations( '<span class="' . $meta_class . 'destinations"><span class="lsx-to-meta-data-key">' . __( 'Location', 'lsx-activities' ) . ':</span> ','</span>' ); |
|
313 | - lsx_to_connected_accommodation( '<span class="' . $meta_class . 'accommodations"><span class="lsx-to-meta-data-key">' . __( 'Accommodation', 'lsx-activities' ) . ':</span> ', '</span>' ); |
|
314 | - lsx_to_connected_tours( '<span class="' . $meta_class . 'tours"><span class="lsx-to-meta-data-key">' . __( 'Tours', 'lsx-activities' ) . ':</span> ', '</span>' ); |
|
315 | - ?> |
|
308 | + $meta_class = 'lsx-to-meta-data lsx-to-meta-data-'; |
|
309 | + |
|
310 | + lsx_to_price( '<span class="' . $meta_class . 'price"><span class="lsx-to-meta-data-key">' . esc_html__( 'From price', 'lsx-activities' ) . ':</span> ', '</span>' ); |
|
311 | + lsx_to_accommodation_activity_friendly( '<span class="' . $meta_class . 'friendly"><span class="lsx-to-meta-data-key">' . __( 'Friendly', 'lsx-activities' ) . ':</span> ', '</span>' ); |
|
312 | + lsx_to_connected_destinations( '<span class="' . $meta_class . 'destinations"><span class="lsx-to-meta-data-key">' . __( 'Location', 'lsx-activities' ) . ':</span> ','</span>' ); |
|
313 | + lsx_to_connected_accommodation( '<span class="' . $meta_class . 'accommodations"><span class="lsx-to-meta-data-key">' . __( 'Accommodation', 'lsx-activities' ) . ':</span> ', '</span>' ); |
|
314 | + lsx_to_connected_tours( '<span class="' . $meta_class . 'tours"><span class="lsx-to-meta-data-key">' . __( 'Tours', 'lsx-activities' ) . ':</span> ', '</span>' ); |
|
315 | + ?> |
|
316 | 316 | </div> |
317 | 317 | <?php } ?> |
318 | 318 | </div> |
@@ -323,39 +323,39 @@ discard block |
||
323 | 323 | <a href="<?php the_permalink(); ?>" class="moretag"><?php esc_html_e( 'View more', 'lsx-activities' ); ?></a> |
324 | 324 | <?php endif; ?> |
325 | 325 | <?php } |
326 | - } |
|
326 | + } |
|
327 | 327 | |
328 | - /** |
|
329 | - * Adds the template tags fast facts |
|
330 | - */ |
|
331 | - public function single_fast_facts() { |
|
332 | - if ( is_singular( 'activity' ) ) { ?> |
|
328 | + /** |
|
329 | + * Adds the template tags fast facts |
|
330 | + */ |
|
331 | + public function single_fast_facts() { |
|
332 | + if ( is_singular( 'activity' ) ) { ?> |
|
333 | 333 | <section id="fast-facts"> |
334 | 334 | <div class="lsx-to-section-inner"> |
335 | 335 | <h3 class="lsx-to-section-title"><?php esc_html_e( 'Activity Summary', 'lsx-activities' ); ?></h3> |
336 | 336 | |
337 | 337 | <div class="lsx-to-single-meta-data"> |
338 | 338 | <?php |
339 | - $meta_class = 'lsx-to-meta-data lsx-to-meta-data-'; |
|
340 | - |
|
341 | - // lsx_to_price( '<span class="' . $meta_class . 'price"><span class="lsx-to-meta-data-key">' . esc_html__( 'From price', 'lsx-activities' ) . ':</span> ', '</span>' ); |
|
342 | - lsx_to_accommodation_activity_friendly( '<span class="' . $meta_class . 'friendly"><span class="lsx-to-meta-data-key">' . __( 'Friendly', 'lsx-activities' ) . ':</span> ', '</span>' ); |
|
343 | - lsx_to_connected_destinations( '<span class="' . $meta_class . 'destinations"><span class="lsx-to-meta-data-key">' . __( 'Location', 'lsx-activities' ) . ':</span> ', '</span>' ); |
|
344 | - lsx_to_connected_tours( '<span class="' . $meta_class . 'tours"><span class="lsx-to-meta-data-key">' . __( 'Tours', 'lsx-activities' ) . ':</span> ', '</span>' ); |
|
345 | - lsx_to_connected_accommodation( '<span class="' . $meta_class . 'accommodations"><span class="lsx-to-meta-data-key">' . __( 'Accommodation', 'lsx-activities' ) . ':</span> ', '</span>' ); |
|
346 | - ?> |
|
339 | + $meta_class = 'lsx-to-meta-data lsx-to-meta-data-'; |
|
340 | + |
|
341 | + // lsx_to_price( '<span class="' . $meta_class . 'price"><span class="lsx-to-meta-data-key">' . esc_html__( 'From price', 'lsx-activities' ) . ':</span> ', '</span>' ); |
|
342 | + lsx_to_accommodation_activity_friendly( '<span class="' . $meta_class . 'friendly"><span class="lsx-to-meta-data-key">' . __( 'Friendly', 'lsx-activities' ) . ':</span> ', '</span>' ); |
|
343 | + lsx_to_connected_destinations( '<span class="' . $meta_class . 'destinations"><span class="lsx-to-meta-data-key">' . __( 'Location', 'lsx-activities' ) . ':</span> ', '</span>' ); |
|
344 | + lsx_to_connected_tours( '<span class="' . $meta_class . 'tours"><span class="lsx-to-meta-data-key">' . __( 'Tours', 'lsx-activities' ) . ':</span> ', '</span>' ); |
|
345 | + lsx_to_connected_accommodation( '<span class="' . $meta_class . 'accommodations"><span class="lsx-to-meta-data-key">' . __( 'Accommodation', 'lsx-activities' ) . ':</span> ', '</span>' ); |
|
346 | + ?> |
|
347 | 347 | </div> |
348 | 348 | </div> |
349 | 349 | </section> |
350 | 350 | <?php } |
351 | - } |
|
352 | - |
|
353 | - /** |
|
354 | - * Adds the template tags to the bottom of the single activity |
|
355 | - */ |
|
356 | - public function single_content_bottom() { |
|
357 | - if ( is_singular( 'activity' ) ) { |
|
358 | - if ( function_exists( 'lsx_to_has_map' ) && lsx_to_has_map() ) : ?> |
|
351 | + } |
|
352 | + |
|
353 | + /** |
|
354 | + * Adds the template tags to the bottom of the single activity |
|
355 | + */ |
|
356 | + public function single_content_bottom() { |
|
357 | + if ( is_singular( 'activity' ) ) { |
|
358 | + if ( function_exists( 'lsx_to_has_map' ) && lsx_to_has_map() ) : ?> |
|
359 | 359 | <section id="activity-map" class="lsx-to-section lsx-to-collapse-section"> |
360 | 360 | <h2 class="lsx-to-section-title lsx-to-collapse-title lsx-title hidden-lg" data-toggle="collapse" data-target="#collapse-activity-map"><?php esc_html_e( 'Map', 'lsx-activities' ); ?></h2> |
361 | 361 | |
@@ -366,23 +366,23 @@ discard block |
||
366 | 366 | </div> |
367 | 367 | </section> |
368 | 368 | <?php |
369 | - endif; |
|
369 | + endif; |
|
370 | 370 | |
371 | - lsx_to_activity_tours(); |
|
371 | + lsx_to_activity_tours(); |
|
372 | 372 | |
373 | - lsx_to_activity_accommodation(); |
|
373 | + lsx_to_activity_accommodation(); |
|
374 | 374 | |
375 | - lsx_to_gallery( '<section id="gallery" class="lsx-to-section lsx-to-collapse-section"><h2 class="lsx-to-section-title lsx-to-collapse-title lsx-title" data-toggle="collapse" data-target="#collapse-gallery">' . esc_html__( 'Gallery', 'lsx-activities' ) . '</h2><div id="collapse-gallery" class="collapse in"><div class="collapse-inner">', '</div></div></section>' ); |
|
375 | + lsx_to_gallery( '<section id="gallery" class="lsx-to-section lsx-to-collapse-section"><h2 class="lsx-to-section-title lsx-to-collapse-title lsx-title" data-toggle="collapse" data-target="#collapse-gallery">' . esc_html__( 'Gallery', 'lsx-activities' ) . '</h2><div id="collapse-gallery" class="collapse in"><div class="collapse-inner">', '</div></div></section>' ); |
|
376 | 376 | |
377 | - if ( function_exists( 'lsx_to_videos' ) ) { |
|
378 | - lsx_to_videos( '<section id="videos" class="lsx-to-section lsx-to-collapse-section"><h2 class="lsx-to-section-title lsx-to-collapse-title lsx-title" data-toggle="collapse" data-target="#collapse-videos">' . esc_html__( 'Videos', 'lsx-activities' ) . '</h2><div id="collapse-videos" class="collapse in"><div class="collapse-inner">', '</div></div></section>' ); |
|
379 | - } elseif ( class_exists( 'Envira_Videos' ) ) { |
|
380 | - lsx_to_envira_videos( '<section id="videos" class="lsx-to-section lsx-to-collapse-section"><h2 class="lsx-to-section-title lsx-to-collapse-title lsx-title" data-toggle="collapse" data-target="#collapse-videos">' . esc_html__( 'Videos', 'lsx-activities' ) . '</h2><div id="collapse-videos" class="collapse in"><div class="collapse-inner">', '</div></div></section>' ); |
|
381 | - } |
|
377 | + if ( function_exists( 'lsx_to_videos' ) ) { |
|
378 | + lsx_to_videos( '<section id="videos" class="lsx-to-section lsx-to-collapse-section"><h2 class="lsx-to-section-title lsx-to-collapse-title lsx-title" data-toggle="collapse" data-target="#collapse-videos">' . esc_html__( 'Videos', 'lsx-activities' ) . '</h2><div id="collapse-videos" class="collapse in"><div class="collapse-inner">', '</div></div></section>' ); |
|
379 | + } elseif ( class_exists( 'Envira_Videos' ) ) { |
|
380 | + lsx_to_envira_videos( '<section id="videos" class="lsx-to-section lsx-to-collapse-section"><h2 class="lsx-to-section-title lsx-to-collapse-title lsx-title" data-toggle="collapse" data-target="#collapse-videos">' . esc_html__( 'Videos', 'lsx-activities' ) . '</h2><div id="collapse-videos" class="collapse in"><div class="collapse-inner">', '</div></div></section>' ); |
|
381 | + } |
|
382 | 382 | |
383 | - lsx_to_activity_posts(); |
|
384 | - } |
|
385 | - } |
|
383 | + lsx_to_activity_posts(); |
|
384 | + } |
|
385 | + } |
|
386 | 386 | |
387 | 387 | } |
388 | 388 |
@@ -9,234 +9,234 @@ |
||
9 | 9 | * @copyright 2018 LightSpeedDevelopment |
10 | 10 | */ |
11 | 11 | if (!class_exists( 'LSX_Activities' ) ) { |
12 | - /** |
|
13 | - * Main plugin class. |
|
14 | - * |
|
15 | - * @package LSX_Activities |
|
16 | - * @author LightSpeed |
|
17 | - */ |
|
18 | - class LSX_Activities { |
|
12 | + /** |
|
13 | + * Main plugin class. |
|
14 | + * |
|
15 | + * @package LSX_Activities |
|
16 | + * @author LightSpeed |
|
17 | + */ |
|
18 | + class LSX_Activities { |
|
19 | 19 | |
20 | - /** |
|
21 | - * The plugins id |
|
22 | - */ |
|
23 | - public $plugin_slug = 'lsx-activities'; |
|
24 | - |
|
25 | - /** |
|
26 | - * The post types the plugin registers |
|
27 | - */ |
|
28 | - public $post_types = false; |
|
29 | - |
|
30 | - /** |
|
31 | - * The singular post types the plugin registers |
|
32 | - */ |
|
33 | - public $post_types_singular = false; |
|
34 | - |
|
35 | - /** |
|
36 | - * An array of the post types slugs plugin registers |
|
37 | - */ |
|
38 | - public $post_type_slugs = false; |
|
39 | - |
|
40 | - /** |
|
41 | - * The taxonomies the plugin registers |
|
42 | - */ |
|
43 | - public $taxonomies = false; |
|
44 | - |
|
45 | - /** |
|
46 | - * The taxonomies the plugin registers (plural) |
|
47 | - */ |
|
48 | - public $taxonomies_plural = false; |
|
49 | - |
|
50 | - /** |
|
51 | - * Hold the TO options |
|
52 | - */ |
|
53 | - public $options = array(); |
|
54 | - |
|
55 | - /** |
|
56 | - * Hold the GoogleMaps API key |
|
57 | - */ |
|
58 | - public $api_key = false; |
|
59 | - |
|
60 | - /** |
|
61 | - * Constructor |
|
62 | - */ |
|
63 | - public function __construct() { |
|
64 | - //Set the variables |
|
65 | - $this->set_vars(); |
|
66 | - $this->lsx_to_search_integration(); |
|
67 | - |
|
68 | - // Make TO last plugin to load |
|
69 | - add_action( 'activated_plugin', array( $this, 'activated_plugin' ) ); |
|
20 | + /** |
|
21 | + * The plugins id |
|
22 | + */ |
|
23 | + public $plugin_slug = 'lsx-activities'; |
|
24 | + |
|
25 | + /** |
|
26 | + * The post types the plugin registers |
|
27 | + */ |
|
28 | + public $post_types = false; |
|
29 | + |
|
30 | + /** |
|
31 | + * The singular post types the plugin registers |
|
32 | + */ |
|
33 | + public $post_types_singular = false; |
|
34 | + |
|
35 | + /** |
|
36 | + * An array of the post types slugs plugin registers |
|
37 | + */ |
|
38 | + public $post_type_slugs = false; |
|
39 | + |
|
40 | + /** |
|
41 | + * The taxonomies the plugin registers |
|
42 | + */ |
|
43 | + public $taxonomies = false; |
|
44 | + |
|
45 | + /** |
|
46 | + * The taxonomies the plugin registers (plural) |
|
47 | + */ |
|
48 | + public $taxonomies_plural = false; |
|
49 | + |
|
50 | + /** |
|
51 | + * Hold the TO options |
|
52 | + */ |
|
53 | + public $options = array(); |
|
54 | + |
|
55 | + /** |
|
56 | + * Hold the GoogleMaps API key |
|
57 | + */ |
|
58 | + public $api_key = false; |
|
59 | + |
|
60 | + /** |
|
61 | + * Constructor |
|
62 | + */ |
|
63 | + public function __construct() { |
|
64 | + //Set the variables |
|
65 | + $this->set_vars(); |
|
66 | + $this->lsx_to_search_integration(); |
|
67 | + |
|
68 | + // Make TO last plugin to load |
|
69 | + add_action( 'activated_plugin', array( $this, 'activated_plugin' ) ); |
|
70 | 70 | |
71 | - add_action('init',array($this,'load_plugin_textdomain')); |
|
72 | - |
|
73 | - if(false !== $this->post_types){ |
|
74 | - add_filter( 'lsx_to_framework_post_types', array( $this, 'post_types_filter') ); |
|
75 | - add_filter( 'lsx_to_post_types', array( $this, 'post_types_filter') ); |
|
76 | - add_filter( 'lsx_to_post_types_singular', array( $this, 'post_types_singular_filter') ); |
|
77 | - add_filter('lsx_to_settings_path',array( $this, 'plugin_path'),10,2); |
|
78 | - } |
|
79 | - if(false !== $this->taxonomies){ |
|
80 | - add_filter( 'lsx_to_framework_taxonomies', array( $this, 'taxonomies_filter') ); |
|
81 | - add_filter( 'lsx_to_framework_taxonomies_plural', array( $this, 'taxonomies_plural_filter') ); |
|
82 | - } |
|
83 | - |
|
84 | - require_once(LSX_ACTIVITIES_PATH . '/classes/class-lsx-activities-admin.php'); |
|
85 | - require_once(LSX_ACTIVITIES_PATH . '/classes/class-lsx-activities-frontend.php'); |
|
86 | - require_once(LSX_ACTIVITIES_PATH . '/includes/template-tags.php'); |
|
87 | - |
|
88 | - // flush_rewrite_rules() |
|
89 | - register_activation_hook( LSX_ACTIVITIES_CORE, array( $this, 'register_activation_hook' ) ); |
|
90 | - add_action( 'admin_init', array( $this, 'register_activation_hook_check' ) ); |
|
91 | - } |
|
92 | - |
|
93 | - /** |
|
94 | - * Include the post type for the search integration |
|
95 | - */ |
|
96 | - public function lsx_to_search_integration(){ |
|
97 | - add_filter( 'lsx_to_search_post_types', array( $this, 'post_types_filter') ); |
|
98 | - add_filter( 'lsx_to_search_taxonomies', array( $this, 'taxonomies_filter') ); |
|
99 | - } |
|
71 | + add_action('init',array($this,'load_plugin_textdomain')); |
|
72 | + |
|
73 | + if(false !== $this->post_types){ |
|
74 | + add_filter( 'lsx_to_framework_post_types', array( $this, 'post_types_filter') ); |
|
75 | + add_filter( 'lsx_to_post_types', array( $this, 'post_types_filter') ); |
|
76 | + add_filter( 'lsx_to_post_types_singular', array( $this, 'post_types_singular_filter') ); |
|
77 | + add_filter('lsx_to_settings_path',array( $this, 'plugin_path'),10,2); |
|
78 | + } |
|
79 | + if(false !== $this->taxonomies){ |
|
80 | + add_filter( 'lsx_to_framework_taxonomies', array( $this, 'taxonomies_filter') ); |
|
81 | + add_filter( 'lsx_to_framework_taxonomies_plural', array( $this, 'taxonomies_plural_filter') ); |
|
82 | + } |
|
83 | + |
|
84 | + require_once(LSX_ACTIVITIES_PATH . '/classes/class-lsx-activities-admin.php'); |
|
85 | + require_once(LSX_ACTIVITIES_PATH . '/classes/class-lsx-activities-frontend.php'); |
|
86 | + require_once(LSX_ACTIVITIES_PATH . '/includes/template-tags.php'); |
|
87 | + |
|
88 | + // flush_rewrite_rules() |
|
89 | + register_activation_hook( LSX_ACTIVITIES_CORE, array( $this, 'register_activation_hook' ) ); |
|
90 | + add_action( 'admin_init', array( $this, 'register_activation_hook_check' ) ); |
|
91 | + } |
|
92 | + |
|
93 | + /** |
|
94 | + * Include the post type for the search integration |
|
95 | + */ |
|
96 | + public function lsx_to_search_integration(){ |
|
97 | + add_filter( 'lsx_to_search_post_types', array( $this, 'post_types_filter') ); |
|
98 | + add_filter( 'lsx_to_search_taxonomies', array( $this, 'taxonomies_filter') ); |
|
99 | + } |
|
100 | 100 | |
101 | - /** |
|
102 | - * Load the plugin text domain for translation. |
|
103 | - */ |
|
104 | - public function load_plugin_textdomain() { |
|
105 | - load_plugin_textdomain( 'lsx-activities', FALSE, basename( LSX_ACTIVITIES_PATH ) . '/languages'); |
|
106 | - } |
|
107 | - |
|
108 | - /** |
|
109 | - * Sets the plugins variables |
|
110 | - */ |
|
111 | - public function set_vars() { |
|
112 | - $this->post_types = array( |
|
113 | - 'activity' => __('Activities','lsx-activities') |
|
114 | - ); |
|
115 | - $this->post_types_singular = array( |
|
116 | - 'activity' => __('Activity','lsx-activities') |
|
117 | - ); |
|
118 | - $this->post_type_slugs = array_keys($this->post_types); |
|
119 | - |
|
120 | - $this->options = get_option('_lsx-to_settings',false); |
|
121 | - if((false !== $this->options && isset($this->options['api']['googlemaps_key'])) || defined('GOOGLEMAPS_API_KEY')) { |
|
122 | - |
|
123 | - if (!defined('GOOGLEMAPS_API_KEY')) { |
|
124 | - $this->api_key = $this->options['api']['googlemaps_key']; |
|
125 | - } else { |
|
126 | - $this->api_key = GOOGLEMAPS_API_KEY; |
|
127 | - } |
|
128 | - } |
|
129 | - } |
|
130 | - |
|
131 | - /** |
|
132 | - * Adds our post types to an array via a filter |
|
133 | - */ |
|
134 | - public function plugin_path($path,$post_type){ |
|
135 | - if(false !== $this->post_types && array_key_exists($post_type,$this->post_types)){ |
|
136 | - $path = LSX_ACTIVITIES_PATH; |
|
137 | - } |
|
138 | - return $path; |
|
139 | - } |
|
140 | - |
|
141 | - /** |
|
142 | - * Adds our post types to an array via a filter |
|
143 | - */ |
|
144 | - public function post_types_slugs_filter($post_types){ |
|
145 | - if(is_array($post_types)){ |
|
146 | - $post_types = array_merge($post_types,$this->post_type_slugs); |
|
147 | - }else{ |
|
148 | - $post_types = $this->post_type_slugs; |
|
149 | - } |
|
150 | - return $post_types; |
|
151 | - } |
|
152 | - |
|
153 | - /** |
|
154 | - * Adds our post types to an array via a filter |
|
155 | - */ |
|
156 | - public function post_types_filter($post_types){ |
|
157 | - if(is_array($post_types) && is_array($this->post_types)){ |
|
158 | - $post_types = array_merge($post_types,$this->post_types); |
|
159 | - }elseif(is_array($this->post_types)){ |
|
160 | - $post_types = $this->post_types; |
|
161 | - } |
|
162 | - return $post_types; |
|
163 | - } |
|
164 | - |
|
165 | - /** |
|
166 | - * Adds our post types to an array via a filter |
|
167 | - */ |
|
168 | - public function post_types_singular_filter($post_types_singular){ |
|
169 | - if(is_array($post_types_singular) && is_array($this->post_types_singular)){ |
|
170 | - $post_types_singular = array_merge($post_types_singular,$this->post_types_singular); |
|
171 | - }elseif(is_array($this->post_types_singular)){ |
|
172 | - $post_types_singular = $this->post_types_singular; |
|
173 | - } |
|
174 | - return $post_types_singular; |
|
175 | - } |
|
176 | - |
|
177 | - /** |
|
178 | - * Adds our taxonomies to an array via a filter |
|
179 | - */ |
|
180 | - public function taxonomies_filter($taxonomies){ |
|
181 | - if(is_array($taxonomies) && is_array($this->taxonomies)){ |
|
182 | - $taxonomies = array_merge($taxonomies,$this->taxonomies); |
|
183 | - }elseif(is_array($this->taxonomies)){ |
|
184 | - $taxonomies = $this->taxonomies; |
|
185 | - } |
|
186 | - return $taxonomies; |
|
187 | - } |
|
188 | - |
|
189 | - /** |
|
190 | - * Adds our taxonomies_plural to an array via a filter |
|
191 | - */ |
|
192 | - public function taxonomies_plural_filter($taxonomies_plural){ |
|
193 | - if(is_array($taxonomies_plural) && is_array($this->taxonomies_plural)){ |
|
194 | - $taxonomies_plural = array_merge($taxonomies_plural,$this->taxonomies_plural); |
|
195 | - }elseif(is_array($this->taxonomies_plural)){ |
|
196 | - $taxonomies_plural = $this->taxonomies_plural; |
|
197 | - } |
|
198 | - return $taxonomies_plural; |
|
199 | - } |
|
101 | + /** |
|
102 | + * Load the plugin text domain for translation. |
|
103 | + */ |
|
104 | + public function load_plugin_textdomain() { |
|
105 | + load_plugin_textdomain( 'lsx-activities', FALSE, basename( LSX_ACTIVITIES_PATH ) . '/languages'); |
|
106 | + } |
|
107 | + |
|
108 | + /** |
|
109 | + * Sets the plugins variables |
|
110 | + */ |
|
111 | + public function set_vars() { |
|
112 | + $this->post_types = array( |
|
113 | + 'activity' => __('Activities','lsx-activities') |
|
114 | + ); |
|
115 | + $this->post_types_singular = array( |
|
116 | + 'activity' => __('Activity','lsx-activities') |
|
117 | + ); |
|
118 | + $this->post_type_slugs = array_keys($this->post_types); |
|
119 | + |
|
120 | + $this->options = get_option('_lsx-to_settings',false); |
|
121 | + if((false !== $this->options && isset($this->options['api']['googlemaps_key'])) || defined('GOOGLEMAPS_API_KEY')) { |
|
122 | + |
|
123 | + if (!defined('GOOGLEMAPS_API_KEY')) { |
|
124 | + $this->api_key = $this->options['api']['googlemaps_key']; |
|
125 | + } else { |
|
126 | + $this->api_key = GOOGLEMAPS_API_KEY; |
|
127 | + } |
|
128 | + } |
|
129 | + } |
|
130 | + |
|
131 | + /** |
|
132 | + * Adds our post types to an array via a filter |
|
133 | + */ |
|
134 | + public function plugin_path($path,$post_type){ |
|
135 | + if(false !== $this->post_types && array_key_exists($post_type,$this->post_types)){ |
|
136 | + $path = LSX_ACTIVITIES_PATH; |
|
137 | + } |
|
138 | + return $path; |
|
139 | + } |
|
140 | + |
|
141 | + /** |
|
142 | + * Adds our post types to an array via a filter |
|
143 | + */ |
|
144 | + public function post_types_slugs_filter($post_types){ |
|
145 | + if(is_array($post_types)){ |
|
146 | + $post_types = array_merge($post_types,$this->post_type_slugs); |
|
147 | + }else{ |
|
148 | + $post_types = $this->post_type_slugs; |
|
149 | + } |
|
150 | + return $post_types; |
|
151 | + } |
|
152 | + |
|
153 | + /** |
|
154 | + * Adds our post types to an array via a filter |
|
155 | + */ |
|
156 | + public function post_types_filter($post_types){ |
|
157 | + if(is_array($post_types) && is_array($this->post_types)){ |
|
158 | + $post_types = array_merge($post_types,$this->post_types); |
|
159 | + }elseif(is_array($this->post_types)){ |
|
160 | + $post_types = $this->post_types; |
|
161 | + } |
|
162 | + return $post_types; |
|
163 | + } |
|
164 | + |
|
165 | + /** |
|
166 | + * Adds our post types to an array via a filter |
|
167 | + */ |
|
168 | + public function post_types_singular_filter($post_types_singular){ |
|
169 | + if(is_array($post_types_singular) && is_array($this->post_types_singular)){ |
|
170 | + $post_types_singular = array_merge($post_types_singular,$this->post_types_singular); |
|
171 | + }elseif(is_array($this->post_types_singular)){ |
|
172 | + $post_types_singular = $this->post_types_singular; |
|
173 | + } |
|
174 | + return $post_types_singular; |
|
175 | + } |
|
176 | + |
|
177 | + /** |
|
178 | + * Adds our taxonomies to an array via a filter |
|
179 | + */ |
|
180 | + public function taxonomies_filter($taxonomies){ |
|
181 | + if(is_array($taxonomies) && is_array($this->taxonomies)){ |
|
182 | + $taxonomies = array_merge($taxonomies,$this->taxonomies); |
|
183 | + }elseif(is_array($this->taxonomies)){ |
|
184 | + $taxonomies = $this->taxonomies; |
|
185 | + } |
|
186 | + return $taxonomies; |
|
187 | + } |
|
188 | + |
|
189 | + /** |
|
190 | + * Adds our taxonomies_plural to an array via a filter |
|
191 | + */ |
|
192 | + public function taxonomies_plural_filter($taxonomies_plural){ |
|
193 | + if(is_array($taxonomies_plural) && is_array($this->taxonomies_plural)){ |
|
194 | + $taxonomies_plural = array_merge($taxonomies_plural,$this->taxonomies_plural); |
|
195 | + }elseif(is_array($this->taxonomies_plural)){ |
|
196 | + $taxonomies_plural = $this->taxonomies_plural; |
|
197 | + } |
|
198 | + return $taxonomies_plural; |
|
199 | + } |
|
200 | 200 | |
201 | - /** |
|
202 | - * Make TO last plugin to load. |
|
203 | - */ |
|
204 | - public function activated_plugin() { |
|
205 | - if ( $plugins = get_option( 'active_plugins' ) ) { |
|
206 | - $search = preg_grep( '/.*\/tour-operator\.php/', $plugins ); |
|
207 | - $key = array_search( $search, $plugins ); |
|
208 | - |
|
209 | - if ( is_array( $search ) && count( $search ) ) { |
|
210 | - foreach ( $search as $key => $path ) { |
|
211 | - array_splice( $plugins, $key, 1 ); |
|
212 | - array_push( $plugins, $path ); |
|
213 | - update_option( 'active_plugins', $plugins ); |
|
214 | - } |
|
215 | - } |
|
216 | - } |
|
217 | - } |
|
201 | + /** |
|
202 | + * Make TO last plugin to load. |
|
203 | + */ |
|
204 | + public function activated_plugin() { |
|
205 | + if ( $plugins = get_option( 'active_plugins' ) ) { |
|
206 | + $search = preg_grep( '/.*\/tour-operator\.php/', $plugins ); |
|
207 | + $key = array_search( $search, $plugins ); |
|
208 | + |
|
209 | + if ( is_array( $search ) && count( $search ) ) { |
|
210 | + foreach ( $search as $key => $path ) { |
|
211 | + array_splice( $plugins, $key, 1 ); |
|
212 | + array_push( $plugins, $path ); |
|
213 | + update_option( 'active_plugins', $plugins ); |
|
214 | + } |
|
215 | + } |
|
216 | + } |
|
217 | + } |
|
218 | 218 | |
219 | - /** |
|
220 | - * On plugin activation |
|
221 | - */ |
|
222 | - public function register_activation_hook() { |
|
223 | - if ( ! is_network_admin() && ! isset( $_GET['activate-multi'] ) ) { |
|
224 | - set_transient( '_tour_operators_activities_flush_rewrite_rules', 1, 30 ); |
|
225 | - } |
|
226 | - } |
|
219 | + /** |
|
220 | + * On plugin activation |
|
221 | + */ |
|
222 | + public function register_activation_hook() { |
|
223 | + if ( ! is_network_admin() && ! isset( $_GET['activate-multi'] ) ) { |
|
224 | + set_transient( '_tour_operators_activities_flush_rewrite_rules', 1, 30 ); |
|
225 | + } |
|
226 | + } |
|
227 | 227 | |
228 | - /** |
|
229 | - * On plugin activation (check) |
|
230 | - */ |
|
231 | - public function register_activation_hook_check() { |
|
232 | - if ( ! get_transient( '_tour_operators_activities_flush_rewrite_rules' ) ) { |
|
233 | - return; |
|
234 | - } |
|
235 | - |
|
236 | - delete_transient( '_tour_operators_activities_flush_rewrite_rules' ); |
|
237 | - flush_rewrite_rules(); |
|
238 | - } |
|
239 | - |
|
240 | - } |
|
241 | - new LSX_Activities(); |
|
228 | + /** |
|
229 | + * On plugin activation (check) |
|
230 | + */ |
|
231 | + public function register_activation_hook_check() { |
|
232 | + if ( ! get_transient( '_tour_operators_activities_flush_rewrite_rules' ) ) { |
|
233 | + return; |
|
234 | + } |
|
235 | + |
|
236 | + delete_transient( '_tour_operators_activities_flush_rewrite_rules' ); |
|
237 | + flush_rewrite_rules(); |
|
238 | + } |
|
239 | + |
|
240 | + } |
|
241 | + new LSX_Activities(); |
|
242 | 242 | } |
243 | 243 | \ No newline at end of file |
@@ -10,180 +10,180 @@ |
||
10 | 10 | |
11 | 11 | class LSX_TO_Template_Redirects { |
12 | 12 | |
13 | - /** |
|
14 | - * Plugin Path |
|
15 | - */ |
|
16 | - public $plugin_path = false; |
|
13 | + /** |
|
14 | + * Plugin Path |
|
15 | + */ |
|
16 | + public $plugin_path = false; |
|
17 | 17 | |
18 | - /** |
|
19 | - * Post Types |
|
20 | - */ |
|
21 | - public $post_types = false; |
|
18 | + /** |
|
19 | + * Post Types |
|
20 | + */ |
|
21 | + public $post_types = false; |
|
22 | 22 | |
23 | - /** |
|
24 | - * Taxonomies |
|
25 | - */ |
|
26 | - public $taxonomies = false; |
|
23 | + /** |
|
24 | + * Taxonomies |
|
25 | + */ |
|
26 | + public $taxonomies = false; |
|
27 | 27 | |
28 | - /** |
|
29 | - * Initialize the plugin by setting localization, filters, and administration functions. |
|
30 | - * |
|
31 | - * @param array $post_types an array of the post types to redirect. |
|
32 | - * @param array $taxonomies an array of the taxonomies to redirect. |
|
33 | - */ |
|
34 | - public function __construct($plugin_path=false,$post_types=false,$taxonomies=false) { |
|
35 | - if(false !== $plugin_path){ |
|
36 | - $this->plugin_path = $plugin_path; |
|
28 | + /** |
|
29 | + * Initialize the plugin by setting localization, filters, and administration functions. |
|
30 | + * |
|
31 | + * @param array $post_types an array of the post types to redirect. |
|
32 | + * @param array $taxonomies an array of the taxonomies to redirect. |
|
33 | + */ |
|
34 | + public function __construct($plugin_path=false,$post_types=false,$taxonomies=false) { |
|
35 | + if(false !== $plugin_path){ |
|
36 | + $this->plugin_path = $plugin_path; |
|
37 | 37 | |
38 | - add_filter( 'lsx_to_widget_path', array( $this, 'widget_path'), 10, 2 ); |
|
39 | - add_filter( 'lsx_to_content_path', array( $this, 'content_path'), 10, 3 ); |
|
38 | + add_filter( 'lsx_to_widget_path', array( $this, 'widget_path'), 10, 2 ); |
|
39 | + add_filter( 'lsx_to_content_path', array( $this, 'content_path'), 10, 3 ); |
|
40 | 40 | |
41 | - if(false !== $post_types){ |
|
42 | - $this->post_types = $post_types; |
|
43 | - add_filter( 'template_include', array( $this, 'post_type_archive_template_include'), 99 ); |
|
44 | - add_filter( 'template_include', array( $this, 'post_type_single_template_include'), 99 ); |
|
45 | - add_filter( 'template_include', array( $this, 'search_template_include'), 99 ); |
|
46 | - } |
|
47 | - if(false !== $taxonomies){ |
|
48 | - $this->taxonomies = $taxonomies; |
|
49 | - add_filter( 'template_include', array( $this, 'taxonomy_template_include'), 99 ); |
|
50 | - } |
|
51 | - } |
|
52 | - } |
|
41 | + if(false !== $post_types){ |
|
42 | + $this->post_types = $post_types; |
|
43 | + add_filter( 'template_include', array( $this, 'post_type_archive_template_include'), 99 ); |
|
44 | + add_filter( 'template_include', array( $this, 'post_type_single_template_include'), 99 ); |
|
45 | + add_filter( 'template_include', array( $this, 'search_template_include'), 99 ); |
|
46 | + } |
|
47 | + if(false !== $taxonomies){ |
|
48 | + $this->taxonomies = $taxonomies; |
|
49 | + add_filter( 'template_include', array( $this, 'taxonomy_template_include'), 99 ); |
|
50 | + } |
|
51 | + } |
|
52 | + } |
|
53 | 53 | |
54 | - /** |
|
55 | - * Redirect wordpress to the archive template located in the plugin |
|
56 | - * |
|
57 | - * @param $template |
|
58 | - * @return $template |
|
59 | - */ |
|
60 | - public function post_type_archive_template_include( $template ) { |
|
54 | + /** |
|
55 | + * Redirect wordpress to the archive template located in the plugin |
|
56 | + * |
|
57 | + * @param $template |
|
58 | + * @return $template |
|
59 | + */ |
|
60 | + public function post_type_archive_template_include( $template ) { |
|
61 | 61 | |
62 | - if ( is_main_query() && is_post_type_archive($this->post_types)) { |
|
63 | - $current_post_type = get_post_type(); |
|
64 | - if ( '' == locate_template( array( 'archive-'.$current_post_type.'.php' ) ) && file_exists( $this->plugin_path.'templates/archive-'.$current_post_type.'.php' )) { |
|
65 | - $template = $this->plugin_path.'templates/archive-'.$current_post_type.'.php'; |
|
66 | - } |
|
67 | - } |
|
68 | - return $template; |
|
69 | - } |
|
62 | + if ( is_main_query() && is_post_type_archive($this->post_types)) { |
|
63 | + $current_post_type = get_post_type(); |
|
64 | + if ( '' == locate_template( array( 'archive-'.$current_post_type.'.php' ) ) && file_exists( $this->plugin_path.'templates/archive-'.$current_post_type.'.php' )) { |
|
65 | + $template = $this->plugin_path.'templates/archive-'.$current_post_type.'.php'; |
|
66 | + } |
|
67 | + } |
|
68 | + return $template; |
|
69 | + } |
|
70 | 70 | |
71 | - /** |
|
72 | - * Redirect wordpress to the single template located in the plugin |
|
73 | - * |
|
74 | - * @param $template |
|
75 | - * |
|
76 | - * @return $template |
|
77 | - */ |
|
78 | - public function post_type_single_template_include($template) { |
|
79 | - if ( is_main_query() && is_singular($this->post_types) ) { |
|
80 | - $current_post_type = get_post_type(); |
|
71 | + /** |
|
72 | + * Redirect wordpress to the single template located in the plugin |
|
73 | + * |
|
74 | + * @param $template |
|
75 | + * |
|
76 | + * @return $template |
|
77 | + */ |
|
78 | + public function post_type_single_template_include($template) { |
|
79 | + if ( is_main_query() && is_singular($this->post_types) ) { |
|
80 | + $current_post_type = get_post_type(); |
|
81 | 81 | |
82 | - if ( '' == locate_template( array( 'single-'.$current_post_type.'.php' ) ) && file_exists( $this->plugin_path.'templates/single-'.$current_post_type.'.php') ) { |
|
83 | - $template = $this->plugin_path.'templates/single-'.$current_post_type.'.php'; |
|
84 | - } |
|
85 | - } |
|
86 | - return $template; |
|
87 | - } |
|
82 | + if ( '' == locate_template( array( 'single-'.$current_post_type.'.php' ) ) && file_exists( $this->plugin_path.'templates/single-'.$current_post_type.'.php') ) { |
|
83 | + $template = $this->plugin_path.'templates/single-'.$current_post_type.'.php'; |
|
84 | + } |
|
85 | + } |
|
86 | + return $template; |
|
87 | + } |
|
88 | 88 | |
89 | - /** |
|
90 | - * Redirect wordpress to the taxonomy located in the plugin |
|
91 | - * |
|
92 | - * @param $template |
|
93 | - * |
|
94 | - * @return $template |
|
95 | - */ |
|
96 | - public function taxonomy_template_include($template) { |
|
89 | + /** |
|
90 | + * Redirect wordpress to the taxonomy located in the plugin |
|
91 | + * |
|
92 | + * @param $template |
|
93 | + * |
|
94 | + * @return $template |
|
95 | + */ |
|
96 | + public function taxonomy_template_include($template) { |
|
97 | 97 | |
98 | - if ( is_main_query() && is_tax($this->taxonomies) ) { |
|
99 | - $current_taxonomy = get_query_var('taxonomy'); |
|
98 | + if ( is_main_query() && is_tax($this->taxonomies) ) { |
|
99 | + $current_taxonomy = get_query_var('taxonomy'); |
|
100 | 100 | |
101 | - if ( '' == locate_template( array( 'taxonomy-'.$current_taxonomy.'.php' ) ) && file_exists( $this->plugin_path.'templates/taxonomy-'.$current_taxonomy.'.php') ) { |
|
102 | - $template = $this->plugin_path.'templates/taxonomy-'.$current_taxonomy.'.php'; |
|
103 | - } |
|
104 | - } |
|
105 | - return $template; |
|
106 | - } |
|
101 | + if ( '' == locate_template( array( 'taxonomy-'.$current_taxonomy.'.php' ) ) && file_exists( $this->plugin_path.'templates/taxonomy-'.$current_taxonomy.'.php') ) { |
|
102 | + $template = $this->plugin_path.'templates/taxonomy-'.$current_taxonomy.'.php'; |
|
103 | + } |
|
104 | + } |
|
105 | + return $template; |
|
106 | + } |
|
107 | 107 | |
108 | - /** |
|
109 | - * Redirect wordpress to the search template located in the plugin |
|
110 | - * |
|
111 | - * @param $template |
|
112 | - * |
|
113 | - * @return $template |
|
114 | - */ |
|
115 | - public function search_template_include( $template ) { |
|
108 | + /** |
|
109 | + * Redirect wordpress to the search template located in the plugin |
|
110 | + * |
|
111 | + * @param $template |
|
112 | + * |
|
113 | + * @return $template |
|
114 | + */ |
|
115 | + public function search_template_include( $template ) { |
|
116 | 116 | |
117 | - if ( is_main_query() && is_search() ) { |
|
118 | - if ( file_exists( $this->plugin_path.'templates/search.php' )) { |
|
119 | - $template = $this->plugin_path.'templates/search.php'; |
|
120 | - } |
|
121 | - } |
|
122 | - return $template; |
|
123 | - } |
|
117 | + if ( is_main_query() && is_search() ) { |
|
118 | + if ( file_exists( $this->plugin_path.'templates/search.php' )) { |
|
119 | + $template = $this->plugin_path.'templates/search.php'; |
|
120 | + } |
|
121 | + } |
|
122 | + return $template; |
|
123 | + } |
|
124 | 124 | |
125 | - /** |
|
126 | - * Redirect wordpress to the single template located in the plugin |
|
127 | - * |
|
128 | - * @param $template |
|
129 | - * |
|
130 | - * @return $template |
|
131 | - */ |
|
132 | - public function content_part($slug, $name = null) { |
|
133 | - $template = array(); |
|
134 | - $name = (string) $name; |
|
135 | - if ( '' !== $name ){ |
|
136 | - $template = "{$slug}-{$name}.php"; |
|
137 | - }else{ |
|
138 | - $template = "{$slug}.php"; |
|
139 | - } |
|
140 | - $original_name = $template; |
|
141 | - $path = apply_filters('lsx_to_content_path','',get_post_type()); |
|
125 | + /** |
|
126 | + * Redirect wordpress to the single template located in the plugin |
|
127 | + * |
|
128 | + * @param $template |
|
129 | + * |
|
130 | + * @return $template |
|
131 | + */ |
|
132 | + public function content_part($slug, $name = null) { |
|
133 | + $template = array(); |
|
134 | + $name = (string) $name; |
|
135 | + if ( '' !== $name ){ |
|
136 | + $template = "{$slug}-{$name}.php"; |
|
137 | + }else{ |
|
138 | + $template = "{$slug}.php"; |
|
139 | + } |
|
140 | + $original_name = $template; |
|
141 | + $path = apply_filters('lsx_to_content_path','',get_post_type()); |
|
142 | 142 | |
143 | - if ( '' == locate_template( array( $template ) ) && file_exists( $path.'templates/'.$template) ) { |
|
144 | - $template = $path.'templates/'.$template; |
|
145 | - }elseif(file_exists( get_stylesheet_directory().'/'.$template)){ |
|
146 | - $template = get_stylesheet_directory().'/'.$template; |
|
147 | - }else{ |
|
148 | - $template = false; |
|
149 | - } |
|
143 | + if ( '' == locate_template( array( $template ) ) && file_exists( $path.'templates/'.$template) ) { |
|
144 | + $template = $path.'templates/'.$template; |
|
145 | + }elseif(file_exists( get_stylesheet_directory().'/'.$template)){ |
|
146 | + $template = get_stylesheet_directory().'/'.$template; |
|
147 | + }else{ |
|
148 | + $template = false; |
|
149 | + } |
|
150 | 150 | |
151 | - if(false !== $template){ |
|
152 | - load_template( $template, false ); |
|
153 | - }else { |
|
154 | - echo wp_kses_post('<p>No '.$original_name.' can be found.</p>'); |
|
155 | - } |
|
156 | - } |
|
151 | + if(false !== $template){ |
|
152 | + load_template( $template, false ); |
|
153 | + }else { |
|
154 | + echo wp_kses_post('<p>No '.$original_name.' can be found.</p>'); |
|
155 | + } |
|
156 | + } |
|
157 | 157 | |
158 | - /** |
|
159 | - * Redirect wordpress to the widget template located in the plugin |
|
160 | - * |
|
161 | - * @param $path |
|
162 | - * @param $post_type |
|
163 | - * |
|
164 | - * @return $path |
|
165 | - */ |
|
166 | - public function widget_path($path,$slug) { |
|
167 | - if((false !== $this->post_types && in_array($slug,$this->post_types)) |
|
168 | - || (false !== $this->taxonomies && in_array($slug,$this->taxonomies)) || 'post' === $slug){ |
|
169 | - $path = $this->plugin_path; |
|
170 | - } |
|
171 | - return $path; |
|
172 | - } |
|
158 | + /** |
|
159 | + * Redirect wordpress to the widget template located in the plugin |
|
160 | + * |
|
161 | + * @param $path |
|
162 | + * @param $post_type |
|
163 | + * |
|
164 | + * @return $path |
|
165 | + */ |
|
166 | + public function widget_path($path,$slug) { |
|
167 | + if((false !== $this->post_types && in_array($slug,$this->post_types)) |
|
168 | + || (false !== $this->taxonomies && in_array($slug,$this->taxonomies)) || 'post' === $slug){ |
|
169 | + $path = $this->plugin_path; |
|
170 | + } |
|
171 | + return $path; |
|
172 | + } |
|
173 | 173 | |
174 | - /** |
|
175 | - * Redirect wordpress to the single template located in the plugin |
|
176 | - * |
|
177 | - * @param $path |
|
178 | - * @param $post_type |
|
179 | - * |
|
180 | - * @return $path |
|
181 | - */ |
|
182 | - public function content_path($path,$slug) { |
|
183 | - if((false !== $this->post_types && in_array($slug,$this->post_types)) |
|
184 | - || (false !== $this->taxonomies && in_array($slug,$this->taxonomies)) || 'post' === $slug){ |
|
185 | - $path = $this->plugin_path; |
|
186 | - } |
|
187 | - return $path; |
|
188 | - } |
|
174 | + /** |
|
175 | + * Redirect wordpress to the single template located in the plugin |
|
176 | + * |
|
177 | + * @param $path |
|
178 | + * @param $post_type |
|
179 | + * |
|
180 | + * @return $path |
|
181 | + */ |
|
182 | + public function content_path($path,$slug) { |
|
183 | + if((false !== $this->post_types && in_array($slug,$this->post_types)) |
|
184 | + || (false !== $this->taxonomies && in_array($slug,$this->taxonomies)) || 'post' === $slug){ |
|
185 | + $path = $this->plugin_path; |
|
186 | + } |
|
187 | + return $path; |
|
188 | + } |
|
189 | 189 | } |
190 | 190 | \ No newline at end of file |