@@ -6,7 +6,7 @@ discard block |
||
6 | 6 | * @package GeoDirectory |
7 | 7 | */ |
8 | 8 | |
9 | -defined( 'ABSPATH' ) || exit; |
|
9 | +defined('ABSPATH') || exit; |
|
10 | 10 | |
11 | 11 | /** |
12 | 12 | * GeoDir_Privacy_Exporters Class. |
@@ -23,32 +23,32 @@ discard block |
||
23 | 23 | * @param int $page Page. |
24 | 24 | * @return array An array of personal data in name value pairs |
25 | 25 | */ |
26 | - public static function post_data_exporter( $email_address, $page ) { |
|
27 | - $post_type = GeoDir_Privacy::exporter_post_type(); |
|
26 | + public static function post_data_exporter($email_address, $page) { |
|
27 | + $post_type = GeoDir_Privacy::exporter_post_type(); |
|
28 | 28 | |
29 | 29 | $done = false; |
30 | 30 | $page = (int) $page; |
31 | 31 | $data_to_export = array(); |
32 | 32 | |
33 | - $posts = self::posts_by_author( $email_address, $post_type, $page ); |
|
33 | + $posts = self::posts_by_author($email_address, $post_type, $page); |
|
34 | 34 | |
35 | - if ( 0 < count( $posts ) ) { |
|
36 | - $obj_post_type = get_post_type_object( $post_type ); |
|
35 | + if (0 < count($posts)) { |
|
36 | + $obj_post_type = get_post_type_object($post_type); |
|
37 | 37 | |
38 | - foreach ( $posts as $post_ID ) { |
|
39 | - $gd_post = geodir_get_post_info( $post_ID ); |
|
40 | - if ( empty( $gd_post ) ) { |
|
38 | + foreach ($posts as $post_ID) { |
|
39 | + $gd_post = geodir_get_post_info($post_ID); |
|
40 | + if (empty($gd_post)) { |
|
41 | 41 | continue; |
42 | 42 | } |
43 | 43 | |
44 | 44 | $data_to_export[] = array( |
45 | - 'group_id' => 'geodirectory-post-' . $post_type, |
|
46 | - 'group_label' => __( $obj_post_type->labels->name, 'geodirectory' ), |
|
47 | - 'item_id' => 'post-' . $post_ID, |
|
48 | - 'data' => self::get_post_personal_data( $gd_post ), |
|
45 | + 'group_id' => 'geodirectory-post-'.$post_type, |
|
46 | + 'group_label' => __($obj_post_type->labels->name, 'geodirectory'), |
|
47 | + 'item_id' => 'post-'.$post_ID, |
|
48 | + 'data' => self::get_post_personal_data($gd_post), |
|
49 | 49 | ); |
50 | 50 | } |
51 | - $done = 10 > count( $posts ); |
|
51 | + $done = 10 > count($posts); |
|
52 | 52 | } else { |
53 | 53 | $done = true; |
54 | 54 | } |
@@ -66,24 +66,24 @@ discard block |
||
66 | 66 | * @param WP_Post $gd_post The post object. |
67 | 67 | * @return array |
68 | 68 | */ |
69 | - protected static function get_post_personal_data( $gd_post ) { |
|
69 | + protected static function get_post_personal_data($gd_post) { |
|
70 | 70 | $post_categories = array(); |
71 | 71 | $post_tags = array(); |
72 | 72 | $default_category = ''; |
73 | 73 | |
74 | - $cat_taxonomy = $gd_post->post_type . 'category'; |
|
75 | - $tag_taxonomy = $gd_post->post_type . '_tags'; |
|
74 | + $cat_taxonomy = $gd_post->post_type.'category'; |
|
75 | + $tag_taxonomy = $gd_post->post_type.'_tags'; |
|
76 | 76 | |
77 | - $post_terms = wp_get_post_terms( $gd_post->ID, array( $cat_taxonomy, $tag_taxonomy ) ); |
|
78 | - if ( ! empty( $post_terms ) && ! is_wp_error( $post_terms ) ) { |
|
79 | - foreach ( $post_terms as $term ) { |
|
80 | - if ( $term->taxonomy == $cat_taxonomy ) { |
|
77 | + $post_terms = wp_get_post_terms($gd_post->ID, array($cat_taxonomy, $tag_taxonomy)); |
|
78 | + if (!empty($post_terms) && !is_wp_error($post_terms)) { |
|
79 | + foreach ($post_terms as $term) { |
|
80 | + if ($term->taxonomy == $cat_taxonomy) { |
|
81 | 81 | $post_categories[] = $term->name; |
82 | 82 | } else { |
83 | 83 | $post_tags[] = $term->name; |
84 | 84 | } |
85 | 85 | |
86 | - if ( $gd_post->default_category == $term->term_id ) { |
|
86 | + if ($gd_post->default_category == $term->term_id) { |
|
87 | 87 | $default_category = $term->name; |
88 | 88 | } |
89 | 89 | } |
@@ -91,189 +91,189 @@ discard block |
||
91 | 91 | |
92 | 92 | $personal_data = array(); |
93 | 93 | $personal_data[] = array( |
94 | - 'name' => __( 'Post ID', 'geodirectory' ), |
|
94 | + 'name' => __('Post ID', 'geodirectory'), |
|
95 | 95 | 'value' => $gd_post->ID, |
96 | 96 | ); |
97 | 97 | $personal_data[] = array( |
98 | - 'name' => __( 'Post Title', 'geodirectory' ), |
|
98 | + 'name' => __('Post Title', 'geodirectory'), |
|
99 | 99 | 'value' => $gd_post->post_title, |
100 | 100 | ); |
101 | 101 | $personal_data[] = array( |
102 | - 'name' => __( 'Post Description', 'geodirectory' ), |
|
102 | + 'name' => __('Post Description', 'geodirectory'), |
|
103 | 103 | 'value' => $gd_post->post_content, |
104 | 104 | ); |
105 | 105 | $personal_data[] = array( |
106 | - 'name' => __( 'Post Date', 'geodirectory' ), |
|
106 | + 'name' => __('Post Date', 'geodirectory'), |
|
107 | 107 | 'value' => $gd_post->post_date, |
108 | 108 | ); |
109 | - if ( ! empty( $gd_post->post_modified ) && $gd_post->post_modified != '0000-00-00 00:00:00' ) { |
|
109 | + if (!empty($gd_post->post_modified) && $gd_post->post_modified != '0000-00-00 00:00:00') { |
|
110 | 110 | $personal_data[] = array( |
111 | - 'name' => __( 'Post Modified Date', 'geodirectory' ), |
|
111 | + 'name' => __('Post Modified Date', 'geodirectory'), |
|
112 | 112 | 'value' => $gd_post->post_modified, |
113 | 113 | ); |
114 | 114 | } |
115 | 115 | $personal_data[] = array( |
116 | - 'name' => __( 'Post Status', 'geodirectory' ), |
|
116 | + 'name' => __('Post Status', 'geodirectory'), |
|
117 | 117 | 'value' => $gd_post->post_status, |
118 | 118 | ); |
119 | - if ( ! empty( $gd_post->submit_ip ) ) { |
|
119 | + if (!empty($gd_post->submit_ip)) { |
|
120 | 120 | $personal_data[] = array( |
121 | - 'name' => __( 'Submit IP', 'geodirectory' ), |
|
121 | + 'name' => __('Submit IP', 'geodirectory'), |
|
122 | 122 | 'value' => $gd_post->submit_ip, |
123 | 123 | ); |
124 | 124 | } |
125 | 125 | $personal_data[] = array( |
126 | - 'name' => __( 'Post Categories', 'geodirectory' ), |
|
127 | - 'value' => ( ! empty( $post_categories ) ? implode( ', ', $post_categories ) : '' ), |
|
126 | + 'name' => __('Post Categories', 'geodirectory'), |
|
127 | + 'value' => (!empty($post_categories) ? implode(', ', $post_categories) : ''), |
|
128 | 128 | ); |
129 | - if ( $default_category ) { |
|
129 | + if ($default_category) { |
|
130 | 130 | $personal_data[] = array( |
131 | - 'name' => __( 'Default Category', 'geodirectory' ), |
|
131 | + 'name' => __('Default Category', 'geodirectory'), |
|
132 | 132 | 'value' => $default_category, |
133 | 133 | ); |
134 | 134 | } |
135 | - if ( ! empty( $post_tags ) ) { |
|
135 | + if (!empty($post_tags)) { |
|
136 | 136 | $personal_data[] = array( |
137 | - 'name' => __( 'Post Tags', 'geodirectory' ), |
|
138 | - 'value' => implode( ', ', $post_tags ), |
|
137 | + 'name' => __('Post Tags', 'geodirectory'), |
|
138 | + 'value' => implode(', ', $post_tags), |
|
139 | 139 | ); |
140 | 140 | } |
141 | 141 | $personal_data[] = array( |
142 | - 'name' => __( 'Post URL', 'geodirectory' ), |
|
143 | - 'value' => get_permalink( $gd_post->ID ), |
|
142 | + 'name' => __('Post URL', 'geodirectory'), |
|
143 | + 'value' => get_permalink($gd_post->ID), |
|
144 | 144 | ); |
145 | 145 | |
146 | 146 | // Post Images |
147 | - $post_images = geodir_get_images( $gd_post->ID ); |
|
148 | - if ( ! empty( $post_images ) ) { |
|
147 | + $post_images = geodir_get_images($gd_post->ID); |
|
148 | + if (!empty($post_images)) { |
|
149 | 149 | $images = array(); |
150 | - foreach ( $post_images as $key => $post_image ) { |
|
151 | - if ( ! empty( $post_image->src ) ) { |
|
150 | + foreach ($post_images as $key => $post_image) { |
|
151 | + if (!empty($post_image->src)) { |
|
152 | 152 | $images[] = $post_image->src; |
153 | 153 | } |
154 | 154 | } |
155 | 155 | |
156 | - if ( ! empty( $images ) ) { |
|
156 | + if (!empty($images)) { |
|
157 | 157 | $personal_data[] = array( |
158 | - 'name' => __( 'Post Images', 'geodirectory' ), |
|
159 | - 'value' => self::parse_files_value( $images ), |
|
158 | + 'name' => __('Post Images', 'geodirectory'), |
|
159 | + 'value' => self::parse_files_value($images), |
|
160 | 160 | ); |
161 | 161 | } |
162 | 162 | } |
163 | 163 | |
164 | 164 | // Post Rating |
165 | - $post_rating = geodir_get_post_rating( $gd_post->ID ); |
|
166 | - if ( $post_rating > 0 ) { |
|
167 | - $post_rating = ( is_float( $post_rating) || ( strpos( $post_rating, ".", 1 ) == 1 && strlen( $post_rating ) > 3 ) ) ? number_format( $post_rating, 1, '.', '' ) : $post_rating; |
|
165 | + $post_rating = geodir_get_post_rating($gd_post->ID); |
|
166 | + if ($post_rating > 0) { |
|
167 | + $post_rating = (is_float($post_rating) || (strpos($post_rating, ".", 1) == 1 && strlen($post_rating) > 3)) ? number_format($post_rating, 1, '.', '') : $post_rating; |
|
168 | 168 | $personal_data[] = array( |
169 | - 'name' => __( 'Post Rating', 'geodirectory' ), |
|
170 | - 'value' => $post_rating . ' / 5', |
|
169 | + 'name' => __('Post Rating', 'geodirectory'), |
|
170 | + 'value' => $post_rating.' / 5', |
|
171 | 171 | ); |
172 | 172 | } |
173 | 173 | |
174 | 174 | // Post Reviews |
175 | - $post_reviews = geodir_get_review_count_total( $gd_post->ID ); |
|
176 | - if ( $post_reviews > 0 ) { |
|
175 | + $post_reviews = geodir_get_review_count_total($gd_post->ID); |
|
176 | + if ($post_reviews > 0) { |
|
177 | 177 | $personal_data[] = array( |
178 | - 'name' => __( 'Post Reviews', 'geodirectory' ), |
|
178 | + 'name' => __('Post Reviews', 'geodirectory'), |
|
179 | 179 | 'value' => $post_reviews, |
180 | 180 | ); |
181 | 181 | } |
182 | 182 | |
183 | - if ( ! empty( $gd_post->is_featured ) ) { |
|
183 | + if (!empty($gd_post->is_featured)) { |
|
184 | 184 | $personal_data[] = array( |
185 | - 'name' => __( 'Post Featured', 'geodirectory' ), |
|
186 | - 'value' => __( 'Yes', 'geodirectory' ), |
|
185 | + 'name' => __('Post Featured', 'geodirectory'), |
|
186 | + 'value' => __('Yes', 'geodirectory'), |
|
187 | 187 | ); |
188 | 188 | } |
189 | 189 | |
190 | - $custom_fields = geodir_post_custom_fields( $gd_post->package_id, 'all', $gd_post->post_type ); |
|
191 | - $post_fields = array_keys( (array) $gd_post ); |
|
190 | + $custom_fields = geodir_post_custom_fields($gd_post->package_id, 'all', $gd_post->post_type); |
|
191 | + $post_fields = array_keys((array) $gd_post); |
|
192 | 192 | |
193 | - foreach ( $custom_fields as $key => $field ) { |
|
194 | - $field_name = ! empty( $field['htmlvar_name'] ) ? $field['htmlvar_name'] : ''; |
|
195 | - if ( empty( $field_name ) ) { |
|
193 | + foreach ($custom_fields as $key => $field) { |
|
194 | + $field_name = !empty($field['htmlvar_name']) ? $field['htmlvar_name'] : ''; |
|
195 | + if (empty($field_name)) { |
|
196 | 196 | continue; |
197 | 197 | } |
198 | 198 | |
199 | - $field = stripslashes_deep( $field ); |
|
199 | + $field = stripslashes_deep($field); |
|
200 | 200 | |
201 | - $extra_fields = ! empty( $field['extra_fields'] ) ? $field['extra_fields'] : array(); |
|
201 | + $extra_fields = !empty($field['extra_fields']) ? $field['extra_fields'] : array(); |
|
202 | 202 | $data_type = $field['data_type']; |
203 | 203 | $field_type = $field['field_type']; |
204 | - $field_title = $field['site_title']; |
|
205 | - if ( $field_name == 'post' ) { |
|
204 | + $field_title = $field['site_title']; |
|
205 | + if ($field_name == 'post') { |
|
206 | 206 | $field_name = 'post_address'; |
207 | 207 | } |
208 | 208 | |
209 | - if ( ! in_array( $field_name, $post_fields ) ) { |
|
209 | + if (!in_array($field_name, $post_fields)) { |
|
210 | 210 | continue; |
211 | 211 | } |
212 | 212 | |
213 | 213 | $name = $field_title; |
214 | 214 | $value = ''; |
215 | - switch ( $field_type ) { |
|
215 | + switch ($field_type) { |
|
216 | 216 | case 'address': |
217 | - $location_allowed = function_exists( 'geodir_cpt_no_location' ) && geodir_cpt_no_location( $gd_post->post_type ) ? false : true; |
|
218 | - if ( $location_allowed && ! empty( $gd_post->post_country ) && ! empty( $gd_post->post_region ) && ! empty( $gd_post->post_city ) ) { |
|
217 | + $location_allowed = function_exists('geodir_cpt_no_location') && geodir_cpt_no_location($gd_post->post_type) ? false : true; |
|
218 | + if ($location_allowed && !empty($gd_post->post_country) && !empty($gd_post->post_region) && !empty($gd_post->post_city)) { |
|
219 | 219 | $personal_data[] = array( |
220 | - 'name' => __( 'Post Address', 'geodirectory' ), |
|
220 | + 'name' => __('Post Address', 'geodirectory'), |
|
221 | 221 | 'value' => $gd_post->post_address, |
222 | 222 | ); |
223 | 223 | $personal_data[] = array( |
224 | - 'name' => __( 'Post City', 'geodirectory' ), |
|
224 | + 'name' => __('Post City', 'geodirectory'), |
|
225 | 225 | 'value' => $gd_post->post_city, |
226 | 226 | ); |
227 | 227 | $personal_data[] = array( |
228 | - 'name' => __( 'Post Region', 'geodirectory' ), |
|
228 | + 'name' => __('Post Region', 'geodirectory'), |
|
229 | 229 | 'value' => $gd_post->post_region, |
230 | 230 | ); |
231 | 231 | $personal_data[] = array( |
232 | - 'name' => __( 'Post Country', 'geodirectory' ), |
|
232 | + 'name' => __('Post Country', 'geodirectory'), |
|
233 | 233 | 'value' => $gd_post->post_country, |
234 | 234 | ); |
235 | 235 | $personal_data[] = array( |
236 | - 'name' => __( 'Post Zip', 'geodirectory' ), |
|
236 | + 'name' => __('Post Zip', 'geodirectory'), |
|
237 | 237 | 'value' => $gd_post->post_zip, |
238 | 238 | ); |
239 | 239 | $personal_data[] = array( |
240 | - 'name' => __( 'Post Latitude', 'geodirectory' ), |
|
240 | + 'name' => __('Post Latitude', 'geodirectory'), |
|
241 | 241 | 'value' => $gd_post->post_latitude, |
242 | 242 | ); |
243 | 243 | $personal_data[] = array( |
244 | - 'name' => __( 'Post Longitude', 'geodirectory' ), |
|
244 | + 'name' => __('Post Longitude', 'geodirectory'), |
|
245 | 245 | 'value' => $gd_post->post_longitude, |
246 | 246 | ); |
247 | - if ( ! empty( $gd_post->post_neighbourhood ) ) { |
|
247 | + if (!empty($gd_post->post_neighbourhood)) { |
|
248 | 248 | $personal_data[] = array( |
249 | - 'name' => __( 'Post Neighbourhood', 'geodirectory' ), |
|
249 | + 'name' => __('Post Neighbourhood', 'geodirectory'), |
|
250 | 250 | 'value' => $gd_post->post_neighbourhood, |
251 | 251 | ); |
252 | 252 | } |
253 | 253 | } |
254 | 254 | break; |
255 | 255 | case 'checkbox': |
256 | - if ( ! empty( $gd_post->{$field_name} ) ) { |
|
257 | - $value = __( 'Yes', 'geodirectory' ); |
|
256 | + if (!empty($gd_post->{$field_name} )) { |
|
257 | + $value = __('Yes', 'geodirectory'); |
|
258 | 258 | } else { |
259 | - $value = __( 'No', 'geodirectory' ); |
|
259 | + $value = __('No', 'geodirectory'); |
|
260 | 260 | } |
261 | 261 | break; |
262 | 262 | case 'datepicker': |
263 | 263 | $value = $gd_post->{$field_name} != '0000-00-00' ? $gd_post->{$field_name} : ''; |
264 | 264 | break; |
265 | 265 | case 'radio': |
266 | - if ( $gd_post->{$field_name} !== '' ) { |
|
267 | - if ( $gd_post->{$field_name} == 'f' || $gd_post->{$field_name} == '0') { |
|
268 | - $value = __( 'No', 'geodirectory' ); |
|
269 | - } else if ( $gd_post->{$field_name} == 't' || $gd_post->{$field_name} == '1') { |
|
270 | - $value = __( 'Yes', 'geodirectory' ); |
|
266 | + if ($gd_post->{$field_name} !== '') { |
|
267 | + if ($gd_post->{$field_name} == 'f' || $gd_post->{$field_name} == '0') { |
|
268 | + $value = __('No', 'geodirectory'); |
|
269 | + } else if ($gd_post->{$field_name} == 't' || $gd_post->{$field_name} == '1') { |
|
270 | + $value = __('Yes', 'geodirectory'); |
|
271 | 271 | } else { |
272 | - if ( !empty( $field['option_values'] ) ) { |
|
273 | - $cf_option_values = geodir_string_values_to_options(stripslashes_deep( $field['option_values'] ), true ); |
|
274 | - if ( ! empty( $cf_option_values ) ) { |
|
275 | - foreach ( $cf_option_values as $cf_option_value ) { |
|
276 | - if ( isset( $cf_option_value['value'] ) && $cf_option_value['value'] == $gd_post->{$field_name} ) { |
|
272 | + if (!empty($field['option_values'])) { |
|
273 | + $cf_option_values = geodir_string_values_to_options(stripslashes_deep($field['option_values']), true); |
|
274 | + if (!empty($cf_option_values)) { |
|
275 | + foreach ($cf_option_values as $cf_option_value) { |
|
276 | + if (isset($cf_option_value['value']) && $cf_option_value['value'] == $gd_post->{$field_name} ) { |
|
277 | 277 | $value = $cf_option_value['label']; |
278 | 278 | } |
279 | 279 | } |
@@ -283,12 +283,12 @@ discard block |
||
283 | 283 | } |
284 | 284 | break; |
285 | 285 | case 'select': |
286 | - $value = __( $gd_post->{$field_name}, 'geodirectory'); |
|
287 | - if ( !empty( $field['option_values'] ) ) { |
|
288 | - $cf_option_values = geodir_string_values_to_options(stripslashes_deep( $field['option_values'] ), true ); |
|
289 | - if ( ! empty( $cf_option_values ) ) { |
|
290 | - foreach ( $cf_option_values as $cf_option_value ) { |
|
291 | - if ( isset( $cf_option_value['value'] ) && $cf_option_value['value'] == $gd_post->{$field_name} ) { |
|
286 | + $value = __($gd_post->{$field_name}, 'geodirectory'); |
|
287 | + if (!empty($field['option_values'])) { |
|
288 | + $cf_option_values = geodir_string_values_to_options(stripslashes_deep($field['option_values']), true); |
|
289 | + if (!empty($cf_option_values)) { |
|
290 | + foreach ($cf_option_values as $cf_option_value) { |
|
291 | + if (isset($cf_option_value['value']) && $cf_option_value['value'] == $gd_post->{$field_name} ) { |
|
292 | 292 | $value = $cf_option_value['label']; |
293 | 293 | } |
294 | 294 | } |
@@ -296,23 +296,23 @@ discard block |
||
296 | 296 | } |
297 | 297 | break; |
298 | 298 | case 'multiselect': |
299 | - $field_values = explode( ',', trim( $gd_post->{$field_name}, "," ) ); |
|
300 | - if ( is_array( $field_values ) ) { |
|
301 | - $field_values = array_map( 'trim', $field_values ); |
|
299 | + $field_values = explode(',', trim($gd_post->{$field_name}, ",")); |
|
300 | + if (is_array($field_values)) { |
|
301 | + $field_values = array_map('trim', $field_values); |
|
302 | 302 | } |
303 | 303 | $values = array(); |
304 | - if ( ! empty( $field['option_values'] ) ) { |
|
305 | - $cf_option_values = geodir_string_values_to_options(stripslashes_deep( $field['option_values'] ), true ); |
|
304 | + if (!empty($field['option_values'])) { |
|
305 | + $cf_option_values = geodir_string_values_to_options(stripslashes_deep($field['option_values']), true); |
|
306 | 306 | |
307 | - if ( ! empty( $cf_option_values ) ) { |
|
308 | - foreach ( $cf_option_values as $cf_option_value ) { |
|
309 | - if ( isset( $cf_option_value['value'] ) && in_array( $cf_option_value['value'], $field_values ) ) { |
|
307 | + if (!empty($cf_option_values)) { |
|
308 | + foreach ($cf_option_values as $cf_option_value) { |
|
309 | + if (isset($cf_option_value['value']) && in_array($cf_option_value['value'], $field_values)) { |
|
310 | 310 | $values[] = $cf_option_value['label']; |
311 | 311 | } |
312 | 312 | } |
313 | 313 | } |
314 | 314 | } |
315 | - $value = ! empty( $values ) ? implode( ', ', $values ) : ''; |
|
315 | + $value = !empty($values) ? implode(', ', $values) : ''; |
|
316 | 316 | break; |
317 | 317 | case 'time': |
318 | 318 | $value = $gd_post->{$field_name} != '00:00:00' ? $gd_post->{$field_name} : ''; |
@@ -326,70 +326,70 @@ discard block |
||
326 | 326 | $value = $gd_post->{$field_name} ? $gd_post->{$field_name} : ''; |
327 | 327 | break; |
328 | 328 | case 'file': |
329 | - $files = explode( ",", $gd_post->{$field_name} ); |
|
330 | - if ( ! empty( $files ) ) { |
|
331 | - $allowed_file_types = !empty( $extra_fields['gd_file_types'] ) && is_array( $extra_fields['gd_file_types'] ) && !in_array( "*", $extra_fields['gd_file_types'] ) ? $extra_fields['gd_file_types'] : ''; |
|
329 | + $files = explode(",", $gd_post->{$field_name} ); |
|
330 | + if (!empty($files)) { |
|
331 | + $allowed_file_types = !empty($extra_fields['gd_file_types']) && is_array($extra_fields['gd_file_types']) && !in_array("*", $extra_fields['gd_file_types']) ? $extra_fields['gd_file_types'] : ''; |
|
332 | 332 | |
333 | 333 | $file_urls = array(); |
334 | - foreach ( $files as $file ) { |
|
335 | - if ( ! empty( $file ) ) { |
|
336 | - $image_name_arr = explode( '/', $file ); |
|
337 | - $curr_img_dir = $image_name_arr[ count( $image_name_arr ) - 2]; |
|
334 | + foreach ($files as $file) { |
|
335 | + if (!empty($file)) { |
|
336 | + $image_name_arr = explode('/', $file); |
|
337 | + $curr_img_dir = $image_name_arr[count($image_name_arr) - 2]; |
|
338 | 338 | $filename = end($image_name_arr); |
339 | 339 | $img_name_arr = explode('.', $filename); |
340 | 340 | |
341 | - $arr_file_type = wp_check_filetype( $filename ); |
|
342 | - if ( empty( $arr_file_type['ext'] ) || empty( $arr_file_type['type'] ) ) { |
|
341 | + $arr_file_type = wp_check_filetype($filename); |
|
342 | + if (empty($arr_file_type['ext']) || empty($arr_file_type['type'])) { |
|
343 | 343 | continue; |
344 | 344 | } |
345 | 345 | |
346 | 346 | $uploaded_file_type = $arr_file_type['type']; |
347 | 347 | $uploaded_file_ext = $arr_file_type['ext']; |
348 | 348 | |
349 | - if ( ! empty( $allowed_file_types ) && !in_array( $uploaded_file_ext, $allowed_file_types ) ) { |
|
349 | + if (!empty($allowed_file_types) && !in_array($uploaded_file_ext, $allowed_file_types)) { |
|
350 | 350 | continue; // Invalid file type. |
351 | 351 | } |
352 | - $image_file_types = array( 'image/jpg', 'image/jpeg', 'image/gif', 'image/png', 'image/bmp', 'image/x-icon' ); |
|
353 | - $audio_file_types = array( 'audio/mpeg', 'audio/ogg', 'audio/mp4', 'audio/vnd.wav', 'audio/basic', 'audio/mid' ); |
|
352 | + $image_file_types = array('image/jpg', 'image/jpeg', 'image/gif', 'image/png', 'image/bmp', 'image/x-icon'); |
|
353 | + $audio_file_types = array('audio/mpeg', 'audio/ogg', 'audio/mp4', 'audio/vnd.wav', 'audio/basic', 'audio/mid'); |
|
354 | 354 | |
355 | 355 | // If the uploaded file is image |
356 | - if ( in_array( $uploaded_file_type, $image_file_types ) ) { |
|
356 | + if (in_array($uploaded_file_type, $image_file_types)) { |
|
357 | 357 | $file_urls[] = $file; |
358 | 358 | } |
359 | 359 | } |
360 | 360 | } |
361 | - $value = ! empty( $file_urls ) ? self::parse_files_value( $file_urls ) : ''; |
|
361 | + $value = !empty($file_urls) ? self::parse_files_value($file_urls) : ''; |
|
362 | 362 | } |
363 | 363 | break; |
364 | 364 | } |
365 | 365 | |
366 | - if ( ! empty( $name ) && $value !== '' ) { |
|
366 | + if (!empty($name) && $value !== '') { |
|
367 | 367 | $personal_data[] = array( |
368 | - 'name' => __( $name, 'geodirectory' ), |
|
368 | + 'name' => __($name, 'geodirectory'), |
|
369 | 369 | 'value' => $value, |
370 | 370 | ); |
371 | 371 | } |
372 | 372 | } |
373 | 373 | |
374 | - if ( ! empty( $gd_post->geodir_link_business ) && ( $post_type = get_post_type( (int)$gd_post->geodir_link_business ) ) ) { |
|
374 | + if (!empty($gd_post->geodir_link_business) && ($post_type = get_post_type((int) $gd_post->geodir_link_business))) { |
|
375 | 375 | $personal_data[] = array( |
376 | - 'name' => __( 'Link Business Title', 'geodirectory' ), |
|
377 | - 'value' => get_the_title( (int)$gd_post->geodir_link_business ), |
|
376 | + 'name' => __('Link Business Title', 'geodirectory'), |
|
377 | + 'value' => get_the_title((int) $gd_post->geodir_link_business), |
|
378 | 378 | ); |
379 | 379 | $personal_data[] = array( |
380 | - 'name' => __( 'Link Business URL', 'geodirectory' ), |
|
381 | - 'value' => get_permalink( (int)$gd_post->geodir_link_business ), |
|
380 | + 'name' => __('Link Business URL', 'geodirectory'), |
|
381 | + 'value' => get_permalink((int) $gd_post->geodir_link_business), |
|
382 | 382 | ); |
383 | 383 | } |
384 | - if ( defined( 'GEODIR_FRANCHISE_VERSION' ) ) { |
|
385 | - if ( ! empty( $gd_post->franchise ) && ( $post_type = get_post_type( (int)$gd_post->franchise ) ) ) { |
|
384 | + if (defined('GEODIR_FRANCHISE_VERSION')) { |
|
385 | + if (!empty($gd_post->franchise) && ($post_type = get_post_type((int) $gd_post->franchise))) { |
|
386 | 386 | $personal_data[] = array( |
387 | - 'name' => __( 'Main Listing Title', 'geodirectory' ), |
|
388 | - 'value' => get_the_title( (int)$gd_post->franchise ), |
|
387 | + 'name' => __('Main Listing Title', 'geodirectory'), |
|
388 | + 'value' => get_the_title((int) $gd_post->franchise), |
|
389 | 389 | ); |
390 | 390 | $personal_data[] = array( |
391 | - 'name' => __( 'Main Listing URL', 'geodirectory' ), |
|
392 | - 'value' => get_permalink( (int)$gd_post->franchise ), |
|
391 | + 'name' => __('Main Listing URL', 'geodirectory'), |
|
392 | + 'value' => get_permalink((int) $gd_post->franchise), |
|
393 | 393 | ); |
394 | 394 | } |
395 | 395 | } |
@@ -401,28 +401,28 @@ discard block |
||
401 | 401 | * @param array $personal_data Array of name value pairs to expose in the export. |
402 | 402 | * @param WP_Post $gd_post The post object. |
403 | 403 | */ |
404 | - $personal_data = apply_filters( 'geodir_privacy_export_post_personal_data', $personal_data, $gd_post ); |
|
404 | + $personal_data = apply_filters('geodir_privacy_export_post_personal_data', $personal_data, $gd_post); |
|
405 | 405 | |
406 | 406 | return $personal_data; |
407 | 407 | } |
408 | 408 | |
409 | - public static function posts_by_author( $email_address, $post_type, $page ) { |
|
410 | - if ( empty( $email_address ) || empty( $post_type ) || empty( $page ) ) { |
|
409 | + public static function posts_by_author($email_address, $post_type, $page) { |
|
410 | + if (empty($email_address) || empty($post_type) || empty($page)) { |
|
411 | 411 | return array(); |
412 | 412 | } |
413 | 413 | |
414 | - $user = get_user_by( 'email', $email_address ); |
|
415 | - if ( empty( $user ) ) { |
|
414 | + $user = get_user_by('email', $email_address); |
|
415 | + if (empty($user)) { |
|
416 | 416 | return array(); |
417 | 417 | } |
418 | 418 | |
419 | - $statuses = array_keys( get_post_statuses() ); |
|
419 | + $statuses = array_keys(get_post_statuses()); |
|
420 | 420 | $skip_statuses = geodir_imex_export_skip_statuses(); |
421 | - if ( ! empty( $skip_statuses ) ) { |
|
422 | - $statuses = array_diff( $statuses, $skip_statuses ); |
|
421 | + if (!empty($skip_statuses)) { |
|
422 | + $statuses = array_diff($statuses, $skip_statuses); |
|
423 | 423 | } |
424 | 424 | |
425 | - $query_args = array( |
|
425 | + $query_args = array( |
|
426 | 426 | 'post_type' => $post_type, |
427 | 427 | 'post_status' => $statuses, |
428 | 428 | 'fields' => 'ids', |
@@ -433,66 +433,66 @@ discard block |
||
433 | 433 | 'order' => 'ASC' |
434 | 434 | ); |
435 | 435 | |
436 | - $query_args = apply_filters( 'geodir_privacy_post_data_exporter_post_query', $query_args, $post_type, $email_address, $page ); |
|
436 | + $query_args = apply_filters('geodir_privacy_post_data_exporter_post_query', $query_args, $post_type, $email_address, $page); |
|
437 | 437 | |
438 | - $posts = get_posts( $query_args ); |
|
438 | + $posts = get_posts($query_args); |
|
439 | 439 | |
440 | - return apply_filters( 'geodir_privacy_post_data_exporter_posts', $posts, $query_args, $post_type, $email_address, $page ); |
|
440 | + return apply_filters('geodir_privacy_post_data_exporter_posts', $posts, $query_args, $post_type, $email_address, $page); |
|
441 | 441 | } |
442 | 442 | |
443 | - public static function review_data_exporter( $response, $exporter_index, $email_address, $page, $request_id, $send_as_email, $exporter_key ) { |
|
443 | + public static function review_data_exporter($response, $exporter_index, $email_address, $page, $request_id, $send_as_email, $exporter_key) { |
|
444 | 444 | global $wpdb; |
445 | 445 | |
446 | 446 | $exporter_key = GeoDir_Privacy::personal_data_exporter_key(); |
447 | 447 | |
448 | - if ( $exporter_key == 'wordpress-comments' && ! empty( $response['data'] ) ) { |
|
449 | - foreach ( $response['data'] as $key => $item ) { |
|
450 | - $comment_id = str_replace( 'comment-', '', $item['item_id'] ); |
|
448 | + if ($exporter_key == 'wordpress-comments' && !empty($response['data'])) { |
|
449 | + foreach ($response['data'] as $key => $item) { |
|
450 | + $comment_id = str_replace('comment-', '', $item['item_id']); |
|
451 | 451 | $data = $item['data']; |
452 | 452 | |
453 | - $review = geodir_get_review( $comment_id ); |
|
454 | - if ( ! empty( $review ) ) { |
|
455 | - if ( ! empty( $review->overall_rating ) ) { |
|
453 | + $review = geodir_get_review($comment_id); |
|
454 | + if (!empty($review)) { |
|
455 | + if (!empty($review->overall_rating)) { |
|
456 | 456 | $data[] = array( |
457 | - 'name' => __( 'Rating (Overall)', 'geodirectory' ), |
|
458 | - 'value' => (float)$review->overall_rating . ' / 5', |
|
457 | + 'name' => __('Rating (Overall)', 'geodirectory'), |
|
458 | + 'value' => (float) $review->overall_rating.' / 5', |
|
459 | 459 | ); |
460 | 460 | } |
461 | - if ( ! empty( $review->post_city ) ) { |
|
461 | + if (!empty($review->post_city)) { |
|
462 | 462 | $data[] = array( |
463 | - 'name' => __( 'Review City', 'geodirectory' ), |
|
463 | + 'name' => __('Review City', 'geodirectory'), |
|
464 | 464 | 'value' => $review->post_city, |
465 | 465 | ); |
466 | 466 | } |
467 | - if ( ! empty( $review->post_region ) ) { |
|
467 | + if (!empty($review->post_region)) { |
|
468 | 468 | $data[] = array( |
469 | - 'name' => __( 'Review Region', 'geodirectory' ), |
|
469 | + 'name' => __('Review Region', 'geodirectory'), |
|
470 | 470 | 'value' => $review->post_region, |
471 | 471 | ); |
472 | 472 | } |
473 | - if ( ! empty( $review->post_country ) ) { |
|
473 | + if (!empty($review->post_country)) { |
|
474 | 474 | $data[] = array( |
475 | - 'name' => __( 'Review Country', 'geodirectory' ), |
|
475 | + 'name' => __('Review Country', 'geodirectory'), |
|
476 | 476 | 'value' => $review->post_country, |
477 | 477 | ); |
478 | 478 | } |
479 | - if ( ! empty( $review->post_latitude ) ) { |
|
479 | + if (!empty($review->post_latitude)) { |
|
480 | 480 | $data[] = array( |
481 | - 'name' => __( 'Review Latitude', 'geodirectory' ), |
|
481 | + 'name' => __('Review Latitude', 'geodirectory'), |
|
482 | 482 | 'value' => $review->post_latitude, |
483 | 483 | ); |
484 | 484 | } |
485 | - if ( ! empty( $review->post_longitude ) ) { |
|
485 | + if (!empty($review->post_longitude)) { |
|
486 | 486 | $data[] = array( |
487 | - 'name' => __( 'Review Longitude', 'geodirectory' ), |
|
487 | + 'name' => __('Review Longitude', 'geodirectory'), |
|
488 | 488 | 'value' => $review->post_longitude, |
489 | 489 | ); |
490 | 490 | } |
491 | 491 | |
492 | - $data = apply_filters( 'geodir_privacy_export_review_data', $data, $review, $email_address ); |
|
492 | + $data = apply_filters('geodir_privacy_export_review_data', $data, $review, $email_address); |
|
493 | 493 | |
494 | - if ( ! empty( $data ) ) { |
|
495 | - $response['data'][ $key ]['data'] = $data; |
|
494 | + if (!empty($data)) { |
|
495 | + $response['data'][$key]['data'] = $data; |
|
496 | 496 | } |
497 | 497 | } |
498 | 498 | } |
@@ -508,36 +508,36 @@ discard block |
||
508 | 508 | * @param int $page Page. |
509 | 509 | * @return array An array of personal data in name value pairs |
510 | 510 | */ |
511 | - public static function favorites_data_exporter( $email_address, $page ) { |
|
511 | + public static function favorites_data_exporter($email_address, $page) { |
|
512 | 512 | $done = true; |
513 | 513 | $page = (int) $page; |
514 | 514 | $data_to_export = array(); |
515 | 515 | |
516 | - $items = GeoDir_Privacy::favorites_by_user( $email_address, $page ); |
|
516 | + $items = GeoDir_Privacy::favorites_by_user($email_address, $page); |
|
517 | 517 | |
518 | - if ( 0 < count( $items ) ) { |
|
519 | - foreach ( $items as $item ) { |
|
520 | - $gd_post = geodir_get_post_info( $item ); |
|
521 | - if ( empty( $gd_post ) ) { |
|
518 | + if (0 < count($items)) { |
|
519 | + foreach ($items as $item) { |
|
520 | + $gd_post = geodir_get_post_info($item); |
|
521 | + if (empty($gd_post)) { |
|
522 | 522 | continue; |
523 | 523 | } |
524 | 524 | |
525 | 525 | $data_to_export[] = array( |
526 | 526 | 'group_id' => 'geodirectory-post-favorites', |
527 | - 'group_label' => __( 'GeoDirectory Favorite Listings', 'geodirectory' ), |
|
528 | - 'item_id' => 'gd-favorite-' . $gd_post->ID, |
|
527 | + 'group_label' => __('GeoDirectory Favorite Listings', 'geodirectory'), |
|
528 | + 'item_id' => 'gd-favorite-'.$gd_post->ID, |
|
529 | 529 | 'data' => array( |
530 | 530 | array( |
531 | - 'name' => __( 'Post ID', 'geodirectory' ), |
|
531 | + 'name' => __('Post ID', 'geodirectory'), |
|
532 | 532 | 'value' => $gd_post->ID, |
533 | 533 | ), |
534 | 534 | array( |
535 | - 'name' => __( 'Post Title', 'geodirectory' ), |
|
535 | + 'name' => __('Post Title', 'geodirectory'), |
|
536 | 536 | 'value' => $gd_post->post_title, |
537 | 537 | ), |
538 | 538 | array( |
539 | - 'name' => __( 'Post URL', 'geodirectory' ), |
|
540 | - 'value' => get_permalink( $gd_post->ID ), |
|
539 | + 'name' => __('Post URL', 'geodirectory'), |
|
540 | + 'value' => get_permalink($gd_post->ID), |
|
541 | 541 | ) |
542 | 542 | ), |
543 | 543 | ); |
@@ -550,27 +550,27 @@ discard block |
||
550 | 550 | ); |
551 | 551 | } |
552 | 552 | |
553 | - public static function parse_files_value( $files ) { |
|
554 | - if ( empty( $files ) ) { |
|
553 | + public static function parse_files_value($files) { |
|
554 | + if (empty($files)) { |
|
555 | 555 | return ''; |
556 | 556 | } |
557 | 557 | |
558 | - if ( ! is_array( $files ) ) { |
|
558 | + if (!is_array($files)) { |
|
559 | 559 | return $files; |
560 | 560 | } |
561 | 561 | |
562 | - if ( count( $files ) == 1 ) { |
|
562 | + if (count($files) == 1) { |
|
563 | 563 | return $files[0]; |
564 | 564 | } |
565 | 565 | |
566 | 566 | $links = array(); |
567 | - foreach ( $files as $file ) { |
|
568 | - if ( false === strpos( $file, ' ' ) && ( 0 === strpos( $file, 'http://' ) || 0 === strpos( $file, 'https://' ) ) ) { |
|
569 | - $file = '<a href="' . esc_url( $file ) . '">' . esc_html( $file ) . '</a>'; |
|
567 | + foreach ($files as $file) { |
|
568 | + if (false === strpos($file, ' ') && (0 === strpos($file, 'http://') || 0 === strpos($file, 'https://'))) { |
|
569 | + $file = '<a href="'.esc_url($file).'">'.esc_html($file).'</a>'; |
|
570 | 570 | } |
571 | 571 | $links[] = $file; |
572 | 572 | } |
573 | - $links = ! empty( $links ) ? implode( ' <br> ', $links ) : ''; |
|
573 | + $links = !empty($links) ? implode(' <br> ', $links) : ''; |
|
574 | 574 | |
575 | 575 | return $links; |
576 | 576 | } |
@@ -19,7 +19,7 @@ discard block |
||
19 | 19 | */ |
20 | 20 | function geodir_get_ajax_url() |
21 | 21 | { |
22 | - return admin_url('admin-ajax.php?action=geodir_ajax_action'); |
|
22 | + return admin_url('admin-ajax.php?action=geodir_ajax_action'); |
|
23 | 23 | } |
24 | 24 | |
25 | 25 | ///////////////////// |
@@ -87,7 +87,7 @@ discard block |
||
87 | 87 | add_filter('query_vars', 'geodir_add_geodir_page_var'); |
88 | 88 | add_action('wp', 'geodir_add_page_id_in_query_var'); // problem fix in wordpress 3.8 |
89 | 89 | if (get_option('permalink_structure') != '') |
90 | - add_filter('parse_request', 'geodir_set_location_var_in_session_in_core'); |
|
90 | + add_filter('parse_request', 'geodir_set_location_var_in_session_in_core'); |
|
91 | 91 | |
92 | 92 | add_filter('parse_query', 'geodir_modified_query'); |
93 | 93 | |
@@ -154,14 +154,14 @@ discard block |
||
154 | 154 | /* POST AND LOOP ACTIONS */ |
155 | 155 | //////////////////////// |
156 | 156 | if (!is_admin()) { |
157 | - add_action('pre_get_posts', 'geodir_exclude_page', 100); /// Will help to exclude virtual page from everywhere |
|
158 | - add_filter('wp_list_pages_excludes', 'exclude_from_wp_list_pages', 100); |
|
159 | - /** Exclude Virtual Pages From Pages List **/ |
|
160 | - add_action('pre_get_posts', 'set_listing_request', 0); |
|
161 | - add_action('pre_get_posts', 'geodir_listing_loop_filter', 1); |
|
162 | - add_filter('excerpt_more', 'geodir_excerpt_more', 1000); |
|
163 | - add_filter('excerpt_length', 'geodir_excerpt_length', 1000); |
|
164 | - add_action('the_post', 'create_marker_jason_of_posts'); // Add marker in json array, Map related filter |
|
157 | + add_action('pre_get_posts', 'geodir_exclude_page', 100); /// Will help to exclude virtual page from everywhere |
|
158 | + add_filter('wp_list_pages_excludes', 'exclude_from_wp_list_pages', 100); |
|
159 | + /** Exclude Virtual Pages From Pages List **/ |
|
160 | + add_action('pre_get_posts', 'set_listing_request', 0); |
|
161 | + add_action('pre_get_posts', 'geodir_listing_loop_filter', 1); |
|
162 | + add_filter('excerpt_more', 'geodir_excerpt_more', 1000); |
|
163 | + add_filter('excerpt_length', 'geodir_excerpt_length', 1000); |
|
164 | + add_action('the_post', 'create_marker_jason_of_posts'); // Add marker in json array, Map related filter |
|
165 | 165 | } |
166 | 166 | |
167 | 167 | |
@@ -223,12 +223,12 @@ discard block |
||
223 | 223 | */ |
224 | 224 | function geodir_unset_prev_theme_nav_location($newname) |
225 | 225 | { |
226 | - $geodir_theme_location = get_option('geodir_theme_location_nav_' . $newname); |
|
227 | - if ($geodir_theme_location) { |
|
228 | - update_option('geodir_theme_location_nav', $geodir_theme_location); |
|
229 | - } else { |
|
230 | - update_option('geodir_theme_location_nav', ''); |
|
231 | - } |
|
226 | + $geodir_theme_location = get_option('geodir_theme_location_nav_' . $newname); |
|
227 | + if ($geodir_theme_location) { |
|
228 | + update_option('geodir_theme_location_nav', $geodir_theme_location); |
|
229 | + } else { |
|
230 | + update_option('geodir_theme_location_nav', ''); |
|
231 | + } |
|
232 | 232 | } |
233 | 233 | |
234 | 234 | /// add action for theme switch to blank previous theme navigation location setting |
@@ -249,42 +249,42 @@ discard block |
||
249 | 249 | */ |
250 | 250 | function geodir_add_post_filters() |
251 | 251 | { |
252 | - /** |
|
253 | - * Contains all function for filtering listing. |
|
254 | - * |
|
255 | - * @since 1.0.0 |
|
256 | - * @package GeoDirectory |
|
257 | - */ |
|
258 | - include_once('geodirectory-functions/listing_filters.php'); |
|
252 | + /** |
|
253 | + * Contains all function for filtering listing. |
|
254 | + * |
|
255 | + * @since 1.0.0 |
|
256 | + * @package GeoDirectory |
|
257 | + */ |
|
258 | + include_once('geodirectory-functions/listing_filters.php'); |
|
259 | 259 | |
260 | - // Theme My Login compatibility fix |
|
261 | - if ( isset( $_REQUEST['geodir_search'] ) && class_exists( 'Theme_My_Login' ) ) { |
|
262 | - remove_action( 'pre_get_posts', array( Theme_My_Login::get_object(), 'pre_get_posts' ) ); |
|
263 | - } |
|
260 | + // Theme My Login compatibility fix |
|
261 | + if ( isset( $_REQUEST['geodir_search'] ) && class_exists( 'Theme_My_Login' ) ) { |
|
262 | + remove_action( 'pre_get_posts', array( Theme_My_Login::get_object(), 'pre_get_posts' ) ); |
|
263 | + } |
|
264 | 264 | |
265 | - if ( isset( $_REQUEST['geodir_search'] ) ) { |
|
266 | - add_filter( 'geodir_filter_widget_listings_fields', 'geodir_search_widget_location_filter_fields', 100, 3 ); |
|
267 | - add_filter( 'geodir_filter_widget_listings_orderby', 'geodir_search_widget_location_filter_orderby', 100, 3 ); |
|
268 | - } |
|
265 | + if ( isset( $_REQUEST['geodir_search'] ) ) { |
|
266 | + add_filter( 'geodir_filter_widget_listings_fields', 'geodir_search_widget_location_filter_fields', 100, 3 ); |
|
267 | + add_filter( 'geodir_filter_widget_listings_orderby', 'geodir_search_widget_location_filter_orderby', 100, 3 ); |
|
268 | + } |
|
269 | 269 | } |
270 | 270 | |
271 | 271 | |
272 | 272 | if (!function_exists('geodir_init_defaults')) { |
273 | - /** |
|
274 | - * Calls the function to register the GeoDirectory default CPT and taxonomies. |
|
275 | - * |
|
276 | - * @since 1.0.0 |
|
277 | - * @package GeoDirectory |
|
278 | - */ |
|
279 | - function geodir_init_defaults() |
|
280 | - { |
|
281 | - if (function_exists('geodir_register_defaults')) { |
|
273 | + /** |
|
274 | + * Calls the function to register the GeoDirectory default CPT and taxonomies. |
|
275 | + * |
|
276 | + * @since 1.0.0 |
|
277 | + * @package GeoDirectory |
|
278 | + */ |
|
279 | + function geodir_init_defaults() |
|
280 | + { |
|
281 | + if (function_exists('geodir_register_defaults')) { |
|
282 | 282 | |
283 | - geodir_register_defaults(); |
|
283 | + geodir_register_defaults(); |
|
284 | 284 | |
285 | - } |
|
285 | + } |
|
286 | 286 | |
287 | - } |
|
287 | + } |
|
288 | 288 | } |
289 | 289 | |
290 | 290 | |
@@ -306,26 +306,26 @@ discard block |
||
306 | 306 | // CALLED ON 'sidebars_widgets' FILTER |
307 | 307 | |
308 | 308 | if (!function_exists('geodir_restrict_widget')) { |
309 | - /** |
|
310 | - * Sets global values to be able to tell if the current page is a GeoDirectory listing page or a GeoDirectory details page. |
|
311 | - * |
|
312 | - * @global bool $is_listing Sets the global value to true if on a GD category page. False if not. |
|
313 | - * @global bool $is_single_place Sets the global value to true if on a GD details (post) page. False if not. |
|
314 | - * @since 1.0.0 |
|
315 | - * @package GeoDirectory |
|
316 | - */ |
|
317 | - function geodir_restrict_widget() |
|
318 | - { |
|
319 | - global $is_listing, $is_single_place; |
|
309 | + /** |
|
310 | + * Sets global values to be able to tell if the current page is a GeoDirectory listing page or a GeoDirectory details page. |
|
311 | + * |
|
312 | + * @global bool $is_listing Sets the global value to true if on a GD category page. False if not. |
|
313 | + * @global bool $is_single_place Sets the global value to true if on a GD details (post) page. False if not. |
|
314 | + * @since 1.0.0 |
|
315 | + * @package GeoDirectory |
|
316 | + */ |
|
317 | + function geodir_restrict_widget() |
|
318 | + { |
|
319 | + global $is_listing, $is_single_place; |
|
320 | 320 | |
321 | - // set is listing |
|
322 | - (geodir_is_page('listing')) ? $is_listing = true : $is_listing = false; |
|
321 | + // set is listing |
|
322 | + (geodir_is_page('listing')) ? $is_listing = true : $is_listing = false; |
|
323 | 323 | |
324 | - // set is single place |
|
325 | - (geodir_is_page('place')) ? $is_single_place = true : $is_single_place = false; |
|
324 | + // set is single place |
|
325 | + (geodir_is_page('place')) ? $is_single_place = true : $is_single_place = false; |
|
326 | 326 | |
327 | 327 | |
328 | - } |
|
328 | + } |
|
329 | 329 | } |
330 | 330 | |
331 | 331 | |
@@ -346,31 +346,31 @@ discard block |
||
346 | 346 | */ |
347 | 347 | function geodir_detail_page_sidebar_content_sorting() |
348 | 348 | { |
349 | - $arr_detail_page_sidebar_content = |
|
350 | - /** |
|
351 | - * An array of functions to be called to be displayed on the details (post) page sidebar. |
|
352 | - * |
|
353 | - * This filter can be used to remove sections of the details page sidebar, |
|
354 | - * add new sections or rearrange the order of the sections. |
|
355 | - * |
|
356 | - * @param array array('geodir_social_sharing_buttons','geodir_share_this_button','geodir_detail_page_google_analytics','geodir_edit_post_link','geodir_detail_page_review_rating','geodir_detail_page_more_info') The array of functions that will be called. |
|
357 | - * @since 1.0.0 |
|
358 | - */ |
|
359 | - apply_filters('geodir_detail_page_sidebar_content', |
|
360 | - array('geodir_social_sharing_buttons', |
|
361 | - 'geodir_detail_page_google_analytics', |
|
362 | - 'geodir_edit_post_link', |
|
363 | - 'geodir_detail_page_review_rating', |
|
364 | - 'geodir_detail_page_more_info' |
|
365 | - ) // end of array |
|
366 | - ); // end of apply filter |
|
367 | - if (!empty($arr_detail_page_sidebar_content)) { |
|
368 | - foreach ($arr_detail_page_sidebar_content as $content_function) { |
|
369 | - if (function_exists($content_function)) { |
|
370 | - add_action('geodir_detail_page_sidebar', $content_function); |
|
371 | - } |
|
372 | - } |
|
373 | - } |
|
349 | + $arr_detail_page_sidebar_content = |
|
350 | + /** |
|
351 | + * An array of functions to be called to be displayed on the details (post) page sidebar. |
|
352 | + * |
|
353 | + * This filter can be used to remove sections of the details page sidebar, |
|
354 | + * add new sections or rearrange the order of the sections. |
|
355 | + * |
|
356 | + * @param array array('geodir_social_sharing_buttons','geodir_share_this_button','geodir_detail_page_google_analytics','geodir_edit_post_link','geodir_detail_page_review_rating','geodir_detail_page_more_info') The array of functions that will be called. |
|
357 | + * @since 1.0.0 |
|
358 | + */ |
|
359 | + apply_filters('geodir_detail_page_sidebar_content', |
|
360 | + array('geodir_social_sharing_buttons', |
|
361 | + 'geodir_detail_page_google_analytics', |
|
362 | + 'geodir_edit_post_link', |
|
363 | + 'geodir_detail_page_review_rating', |
|
364 | + 'geodir_detail_page_more_info' |
|
365 | + ) // end of array |
|
366 | + ); // end of apply filter |
|
367 | + if (!empty($arr_detail_page_sidebar_content)) { |
|
368 | + foreach ($arr_detail_page_sidebar_content as $content_function) { |
|
369 | + if (function_exists($content_function)) { |
|
370 | + add_action('geodir_detail_page_sidebar', $content_function); |
|
371 | + } |
|
372 | + } |
|
373 | + } |
|
374 | 374 | } |
375 | 375 | |
376 | 376 | add_action('geodir_after_edit_post_link', 'geodir_add_to_favourite_link', 1); |
@@ -385,14 +385,14 @@ discard block |
||
385 | 385 | */ |
386 | 386 | function geodir_add_to_favourite_link() |
387 | 387 | { |
388 | - global $post, $preview; |
|
389 | - if (!$preview && geodir_is_page('detail')) { |
|
390 | - ?> |
|
388 | + global $post, $preview; |
|
389 | + if (!$preview && geodir_is_page('detail')) { |
|
390 | + ?> |
|
391 | 391 | <p class="edit_link"> |
392 | 392 | <?php geodir_favourite_html($post->post_author, $post->ID); ?> |
393 | 393 | </p> |
394 | 394 | <?php |
395 | - } |
|
395 | + } |
|
396 | 396 | } |
397 | 397 | |
398 | 398 | /** |
@@ -406,41 +406,41 @@ discard block |
||
406 | 406 | */ |
407 | 407 | function geodir_social_sharing_buttons() |
408 | 408 | { |
409 | - global $preview; |
|
410 | - ob_start(); // Start buffering; |
|
411 | - /** |
|
412 | - * This action is called before the social buttons twitter,facebook and google plus are output in a containing div. |
|
413 | - * |
|
414 | - * @since 1.0.0 |
|
415 | - */ |
|
416 | - do_action('geodir_before_social_sharing_buttons'); |
|
417 | - if (!$preview) { |
|
418 | - ?> |
|
409 | + global $preview; |
|
410 | + ob_start(); // Start buffering; |
|
411 | + /** |
|
412 | + * This action is called before the social buttons twitter,facebook and google plus are output in a containing div. |
|
413 | + * |
|
414 | + * @since 1.0.0 |
|
415 | + */ |
|
416 | + do_action('geodir_before_social_sharing_buttons'); |
|
417 | + if (!$preview) { |
|
418 | + ?> |
|
419 | 419 | <div class="likethis"> |
420 | 420 | <?php geodir_twitter_tweet_button(); ?> |
421 | 421 | <?php geodir_fb_like_button(); ?> |
422 | 422 | <?php geodir_google_plus_button(); ?> |
423 | 423 | </div> |
424 | 424 | <?php |
425 | - }// end of if, if its a preview or not |
|
426 | - |
|
427 | - /** |
|
428 | - * This action is called after the social buttons twitter,facebook and google plus are output in a containing div. |
|
429 | - * |
|
430 | - * @since 1.0.0 |
|
431 | - */ |
|
432 | - do_action('geodir_after_social_sharing_buttons'); |
|
433 | - $content_html = ob_get_clean(); |
|
434 | - if (trim($content_html) != '') |
|
435 | - $content_html = '<div class="geodir-company_info geodir-details-sidebar-social-sharing">' . $content_html . '</div>'; |
|
436 | - if ((int)get_option('geodir_disable_tfg_buttons_section') != 1) { |
|
437 | - /** |
|
438 | - * Filter the geodir_social_sharing_buttons() function content. |
|
439 | - * |
|
440 | - * @param string $content_html The output html of the geodir_social_sharing_buttons() function. |
|
441 | - */ |
|
442 | - echo $content_html = apply_filters('geodir_social_sharing_buttons_html', $content_html); |
|
443 | - } |
|
425 | + }// end of if, if its a preview or not |
|
426 | + |
|
427 | + /** |
|
428 | + * This action is called after the social buttons twitter,facebook and google plus are output in a containing div. |
|
429 | + * |
|
430 | + * @since 1.0.0 |
|
431 | + */ |
|
432 | + do_action('geodir_after_social_sharing_buttons'); |
|
433 | + $content_html = ob_get_clean(); |
|
434 | + if (trim($content_html) != '') |
|
435 | + $content_html = '<div class="geodir-company_info geodir-details-sidebar-social-sharing">' . $content_html . '</div>'; |
|
436 | + if ((int)get_option('geodir_disable_tfg_buttons_section') != 1) { |
|
437 | + /** |
|
438 | + * Filter the geodir_social_sharing_buttons() function content. |
|
439 | + * |
|
440 | + * @param string $content_html The output html of the geodir_social_sharing_buttons() function. |
|
441 | + */ |
|
442 | + echo $content_html = apply_filters('geodir_social_sharing_buttons_html', $content_html); |
|
443 | + } |
|
444 | 444 | |
445 | 445 | |
446 | 446 | } |
@@ -458,46 +458,46 @@ discard block |
||
458 | 458 | */ |
459 | 459 | function geodir_edit_post_link() |
460 | 460 | { |
461 | - global $post, $preview; |
|
462 | - ob_start(); // Start buffering; |
|
463 | - /** |
|
464 | - * This is called before the edit post link html in the function geodir_edit_post_link() |
|
465 | - * |
|
466 | - * @since 1.0.0 |
|
467 | - */ |
|
468 | - do_action('geodir_before_edit_post_link'); |
|
469 | - if (!$preview) { |
|
470 | - $is_current_user_owner = geodir_listing_belong_to_current_user(); |
|
461 | + global $post, $preview; |
|
462 | + ob_start(); // Start buffering; |
|
463 | + /** |
|
464 | + * This is called before the edit post link html in the function geodir_edit_post_link() |
|
465 | + * |
|
466 | + * @since 1.0.0 |
|
467 | + */ |
|
468 | + do_action('geodir_before_edit_post_link'); |
|
469 | + if (!$preview) { |
|
470 | + $is_current_user_owner = geodir_listing_belong_to_current_user(); |
|
471 | 471 | |
472 | - if ($is_current_user_owner) { |
|
473 | - $post_id = $post->ID; |
|
472 | + if ($is_current_user_owner) { |
|
473 | + $post_id = $post->ID; |
|
474 | 474 | |
475 | - if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') { |
|
476 | - $post_id = (int)$_REQUEST['pid']; |
|
477 | - } |
|
475 | + if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') { |
|
476 | + $post_id = (int)$_REQUEST['pid']; |
|
477 | + } |
|
478 | 478 | |
479 | - $postlink = get_permalink(geodir_add_listing_page_id()); |
|
480 | - $editlink = geodir_getlink($postlink, array('pid' => $post_id), false); |
|
481 | - echo ' <p class="edit_link"><i class="fa fa-pencil"></i> <a href="' . esc_url($editlink) . '">' . __('Edit this Post', 'geodirectory') . '</a></p>'; |
|
482 | - } |
|
483 | - }// end of if, if its a preview or not |
|
484 | - /** |
|
485 | - * This is called after the edit post link html in the function geodir_edit_post_link() |
|
486 | - * |
|
487 | - * @since 1.0.0 |
|
488 | - */ |
|
489 | - do_action('geodir_after_edit_post_link'); |
|
490 | - $content_html = ob_get_clean(); |
|
491 | - if (trim($content_html) != '') |
|
492 | - $content_html = '<div class="geodir-company_info geodir-details-sidebar-user-links">' . $content_html . '</div>'; |
|
493 | - if ((int)get_option('geodir_disable_user_links_section') != 1) { |
|
494 | - /** |
|
495 | - * Filter the geodir_edit_post_link() function content. |
|
496 | - * |
|
497 | - * @param string $content_html The output html of the geodir_edit_post_link() function. |
|
498 | - */ |
|
499 | - echo $content_html = apply_filters('geodir_edit_post_link_html', $content_html); |
|
500 | - } |
|
479 | + $postlink = get_permalink(geodir_add_listing_page_id()); |
|
480 | + $editlink = geodir_getlink($postlink, array('pid' => $post_id), false); |
|
481 | + echo ' <p class="edit_link"><i class="fa fa-pencil"></i> <a href="' . esc_url($editlink) . '">' . __('Edit this Post', 'geodirectory') . '</a></p>'; |
|
482 | + } |
|
483 | + }// end of if, if its a preview or not |
|
484 | + /** |
|
485 | + * This is called after the edit post link html in the function geodir_edit_post_link() |
|
486 | + * |
|
487 | + * @since 1.0.0 |
|
488 | + */ |
|
489 | + do_action('geodir_after_edit_post_link'); |
|
490 | + $content_html = ob_get_clean(); |
|
491 | + if (trim($content_html) != '') |
|
492 | + $content_html = '<div class="geodir-company_info geodir-details-sidebar-user-links">' . $content_html . '</div>'; |
|
493 | + if ((int)get_option('geodir_disable_user_links_section') != 1) { |
|
494 | + /** |
|
495 | + * Filter the geodir_edit_post_link() function content. |
|
496 | + * |
|
497 | + * @param string $content_html The output html of the geodir_edit_post_link() function. |
|
498 | + */ |
|
499 | + echo $content_html = apply_filters('geodir_edit_post_link_html', $content_html); |
|
500 | + } |
|
501 | 501 | } |
502 | 502 | |
503 | 503 | /** |
@@ -511,45 +511,45 @@ discard block |
||
511 | 511 | */ |
512 | 512 | function geodir_detail_page_google_analytics() |
513 | 513 | { |
514 | - if ( ! get_option( 'geodir_ga_stats' ) ) { |
|
514 | + if ( ! get_option( 'geodir_ga_stats' ) ) { |
|
515 | 515 | return; |
516 | 516 | } |
517 | 517 | global $post,$preview; |
518 | - if($preview){return '';} |
|
519 | - $package_info = array(); |
|
520 | - $package_info = geodir_post_package_info($package_info, $post); |
|
518 | + if($preview){return '';} |
|
519 | + $package_info = array(); |
|
520 | + $package_info = geodir_post_package_info($package_info, $post); |
|
521 | 521 | |
522 | - $id = trim(get_option('geodir_ga_account_id')); |
|
522 | + $id = trim(get_option('geodir_ga_account_id')); |
|
523 | 523 | |
524 | - if (!$id) { |
|
525 | - return; //if no Google Analytics ID then bail. |
|
526 | - } |
|
524 | + if (!$id) { |
|
525 | + return; //if no Google Analytics ID then bail. |
|
526 | + } |
|
527 | 527 | |
528 | - ob_start(); // Start buffering; |
|
529 | - /** |
|
530 | - * This is called before the edit post link html in the function geodir_detail_page_google_analytics() |
|
531 | - * |
|
532 | - * @since 1.0.0 |
|
533 | - */ |
|
534 | - do_action('geodir_before_google_analytics'); |
|
528 | + ob_start(); // Start buffering; |
|
529 | + /** |
|
530 | + * This is called before the edit post link html in the function geodir_detail_page_google_analytics() |
|
531 | + * |
|
532 | + * @since 1.0.0 |
|
533 | + */ |
|
534 | + do_action('geodir_before_google_analytics'); |
|
535 | 535 | |
536 | - $refresh_time = get_option('geodir_ga_refresh_time', 5); |
|
537 | - /** |
|
538 | - * Filter the time interval to check & refresh new users results. |
|
539 | - * |
|
540 | - * @since 1.5.9 |
|
541 | - * |
|
542 | - * @param int $refresh_time Time interval to check & refresh new users results. |
|
543 | - */ |
|
544 | - $refresh_time = apply_filters('geodir_google_analytics_refresh_time', $refresh_time); |
|
545 | - $refresh_time = absint($refresh_time * 1000); |
|
536 | + $refresh_time = get_option('geodir_ga_refresh_time', 5); |
|
537 | + /** |
|
538 | + * Filter the time interval to check & refresh new users results. |
|
539 | + * |
|
540 | + * @since 1.5.9 |
|
541 | + * |
|
542 | + * @param int $refresh_time Time interval to check & refresh new users results. |
|
543 | + */ |
|
544 | + $refresh_time = apply_filters('geodir_google_analytics_refresh_time', $refresh_time); |
|
545 | + $refresh_time = absint($refresh_time * 1000); |
|
546 | 546 | |
547 | - $hide_refresh = get_option('geodir_ga_auto_refresh'); |
|
547 | + $hide_refresh = get_option('geodir_ga_auto_refresh'); |
|
548 | 548 | |
549 | - $auto_refresh = $hide_refresh && $refresh_time && $refresh_time > 0 ? 1 : 0; |
|
550 | - if (is_user_logged_in() && (isset($package_info->google_analytics) && $package_info->google_analytics == '1') && (get_current_user_id()==$post->post_author || current_user_can( 'manage_options' )) ) { |
|
551 | - $page_url = urlencode($_SERVER['REQUEST_URI']); |
|
552 | - ?> |
|
549 | + $auto_refresh = $hide_refresh && $refresh_time && $refresh_time > 0 ? 1 : 0; |
|
550 | + if (is_user_logged_in() && (isset($package_info->google_analytics) && $package_info->google_analytics == '1') && (get_current_user_id()==$post->post_author || current_user_can( 'manage_options' )) ) { |
|
551 | + $page_url = urlencode($_SERVER['REQUEST_URI']); |
|
552 | + ?> |
|
553 | 553 | <script type="text/javascript"> |
554 | 554 | var gd_gaTimeOut; |
555 | 555 | var gd_gaTime = parseInt('<?php echo $refresh_time;?>'); |
@@ -801,15 +801,15 @@ discard block |
||
801 | 801 | var labels = results[1].rows.map(function(row) { return +row[0]; }); |
802 | 802 | |
803 | 803 | <?php |
804 | - // Here we list the shorthand days of the week so it can be used in translation. |
|
805 | - __("Mon",'geodirectory'); |
|
806 | - __("Tue",'geodirectory'); |
|
807 | - __("Wed",'geodirectory'); |
|
808 | - __("Thu",'geodirectory'); |
|
809 | - __("Fri",'geodirectory'); |
|
810 | - __("Sat",'geodirectory'); |
|
811 | - __("Sun",'geodirectory'); |
|
812 | - ?> |
|
804 | + // Here we list the shorthand days of the week so it can be used in translation. |
|
805 | + __("Mon",'geodirectory'); |
|
806 | + __("Tue",'geodirectory'); |
|
807 | + __("Wed",'geodirectory'); |
|
808 | + __("Thu",'geodirectory'); |
|
809 | + __("Fri",'geodirectory'); |
|
810 | + __("Sat",'geodirectory'); |
|
811 | + __("Sun",'geodirectory'); |
|
812 | + ?> |
|
813 | 813 | |
814 | 814 | labels = [ |
815 | 815 | "<?php _e(date('D', strtotime("+1 day")),'geodirectory'); ?>", |
@@ -1058,24 +1058,24 @@ discard block |
||
1058 | 1058 | </span> |
1059 | 1059 | |
1060 | 1060 | <?php |
1061 | - } |
|
1062 | - /** |
|
1063 | - * This is called after the edit post link html in the function geodir_detail_page_google_analytics() |
|
1064 | - * |
|
1065 | - * @since 1.0.0 |
|
1066 | - */ |
|
1067 | - do_action('geodir_after_google_analytics'); |
|
1068 | - $content_html = ob_get_clean(); |
|
1069 | - if (trim($content_html) != '') |
|
1070 | - $content_html = '<div class="geodir-company_info geodir-details-sidebar-google-analytics">' . $content_html . '</div>'; |
|
1071 | - if ((int)get_option('geodir_disable_google_analytics_section') != 1) { |
|
1072 | - /** |
|
1073 | - * Filter the geodir_edit_post_link() function content. |
|
1074 | - * |
|
1075 | - * @param string $content_html The output html of the geodir_edit_post_link() function. |
|
1076 | - */ |
|
1077 | - echo $content_html = apply_filters('geodir_google_analytic_html', $content_html); |
|
1078 | - } |
|
1061 | + } |
|
1062 | + /** |
|
1063 | + * This is called after the edit post link html in the function geodir_detail_page_google_analytics() |
|
1064 | + * |
|
1065 | + * @since 1.0.0 |
|
1066 | + */ |
|
1067 | + do_action('geodir_after_google_analytics'); |
|
1068 | + $content_html = ob_get_clean(); |
|
1069 | + if (trim($content_html) != '') |
|
1070 | + $content_html = '<div class="geodir-company_info geodir-details-sidebar-google-analytics">' . $content_html . '</div>'; |
|
1071 | + if ((int)get_option('geodir_disable_google_analytics_section') != 1) { |
|
1072 | + /** |
|
1073 | + * Filter the geodir_edit_post_link() function content. |
|
1074 | + * |
|
1075 | + * @param string $content_html The output html of the geodir_edit_post_link() function. |
|
1076 | + */ |
|
1077 | + echo $content_html = apply_filters('geodir_google_analytic_html', $content_html); |
|
1078 | + } |
|
1079 | 1079 | } |
1080 | 1080 | |
1081 | 1081 | /** |
@@ -1092,94 +1092,94 @@ discard block |
||
1092 | 1092 | */ |
1093 | 1093 | function geodir_detail_page_review_rating() |
1094 | 1094 | { |
1095 | - global $post, $preview, $post_images; |
|
1095 | + global $post, $preview, $post_images; |
|
1096 | 1096 | |
1097 | - if (!empty($post->ID) && geodir_cpt_has_rating_disabled((int)$post->ID)) { |
|
1098 | - return; |
|
1099 | - } |
|
1100 | - ob_start(); // Start buffering; |
|
1101 | - /** |
|
1102 | - * This is called before the rating html in the function geodir_detail_page_review_rating(). |
|
1103 | - * |
|
1104 | - * This is called outside the check for an actual rating and the check for preview page. |
|
1105 | - * |
|
1106 | - * @since 1.0.0 |
|
1107 | - */ |
|
1108 | - do_action('geodir_before_detail_page_review_rating'); |
|
1109 | - |
|
1110 | - $comment_count = geodir_get_review_count_total($post->ID); |
|
1111 | - $post_avgratings = geodir_get_post_rating($post->ID); |
|
1112 | - |
|
1113 | - if ($post_avgratings != 0 && !$preview) { |
|
1114 | - /** |
|
1115 | - * This is called before the rating html in the function geodir_detail_page_review_rating(). |
|
1116 | - * |
|
1117 | - * This is called inside the check for an actual rating and the check for preview page. |
|
1118 | - * |
|
1119 | - * @since 1.0.0 |
|
1120 | - * @param float $post_avgratings Average rating for the current post. |
|
1121 | - * @param int $post->ID Current post ID. |
|
1122 | - */ |
|
1123 | - do_action('geodir_before_review_rating_stars_on_detail', $post_avgratings, $post->ID); |
|
1124 | - |
|
1125 | - $html = '<p style=" float:left;">'; |
|
1126 | - $html .= geodir_get_rating_stars($post_avgratings, $post->ID); |
|
1127 | - $html .= '<div class="average-review" itemscope itemtype="http://data-vocabulary.org/Review-aggregate">'; |
|
1128 | - $post_avgratings = (is_float($post_avgratings) || (strpos($post_avgratings, ".", 1) == 1 && strlen($post_avgratings) > 3)) ? number_format($post_avgratings, 1, '.', '') : $post_avgratings; |
|
1097 | + if (!empty($post->ID) && geodir_cpt_has_rating_disabled((int)$post->ID)) { |
|
1098 | + return; |
|
1099 | + } |
|
1100 | + ob_start(); // Start buffering; |
|
1101 | + /** |
|
1102 | + * This is called before the rating html in the function geodir_detail_page_review_rating(). |
|
1103 | + * |
|
1104 | + * This is called outside the check for an actual rating and the check for preview page. |
|
1105 | + * |
|
1106 | + * @since 1.0.0 |
|
1107 | + */ |
|
1108 | + do_action('geodir_before_detail_page_review_rating'); |
|
1109 | + |
|
1110 | + $comment_count = geodir_get_review_count_total($post->ID); |
|
1111 | + $post_avgratings = geodir_get_post_rating($post->ID); |
|
1112 | + |
|
1113 | + if ($post_avgratings != 0 && !$preview) { |
|
1114 | + /** |
|
1115 | + * This is called before the rating html in the function geodir_detail_page_review_rating(). |
|
1116 | + * |
|
1117 | + * This is called inside the check for an actual rating and the check for preview page. |
|
1118 | + * |
|
1119 | + * @since 1.0.0 |
|
1120 | + * @param float $post_avgratings Average rating for the current post. |
|
1121 | + * @param int $post->ID Current post ID. |
|
1122 | + */ |
|
1123 | + do_action('geodir_before_review_rating_stars_on_detail', $post_avgratings, $post->ID); |
|
1124 | + |
|
1125 | + $html = '<p style=" float:left;">'; |
|
1126 | + $html .= geodir_get_rating_stars($post_avgratings, $post->ID); |
|
1127 | + $html .= '<div class="average-review" itemscope itemtype="http://data-vocabulary.org/Review-aggregate">'; |
|
1128 | + $post_avgratings = (is_float($post_avgratings) || (strpos($post_avgratings, ".", 1) == 1 && strlen($post_avgratings) > 3)) ? number_format($post_avgratings, 1, '.', '') : $post_avgratings; |
|
1129 | 1129 | |
1130 | 1130 | $reviews_text = $comment_count > 1 ? __("reviews", 'geodirectory') : __("review", 'geodirectory'); |
1131 | 1131 | |
1132 | 1132 | $html .= '<span itemprop="rating" itemscope itemtype="http://data-vocabulary.org/Rating"><span class="rating" itemprop="average" content="' . $post_avgratings . '">' . $post_avgratings . '</span> / <span itemprop="best" content="5">5</span> ' . __("based on", 'geodirectory') . ' </span><span class="count" itemprop="count" content="' . $comment_count . '">' . $comment_count . ' ' . $reviews_text . '</span><br />'; |
1133 | 1133 | |
1134 | - $html .= '<span class="item">'; |
|
1135 | - $html .= '<span class="fn" itemprop="itemreviewed">' . $post->post_title . '</span>'; |
|
1134 | + $html .= '<span class="item">'; |
|
1135 | + $html .= '<span class="fn" itemprop="itemreviewed">' . $post->post_title . '</span>'; |
|
1136 | 1136 | |
1137 | - if ($post_images) { |
|
1138 | - foreach ($post_images as $img) { |
|
1139 | - $post_img = $img->src; |
|
1140 | - break; |
|
1141 | - } |
|
1142 | - } |
|
1143 | - |
|
1144 | - if (isset($post_img) && $post_img) { |
|
1145 | - $html .= '<br /><img src="' . $post_img . '" class="photo" alt="' . esc_attr($post->post_title) . '" itemprop="photo" content="' . $post_img . '" class="photo" />'; |
|
1146 | - } |
|
1147 | - |
|
1148 | - $html .= '</span>'; |
|
1149 | - |
|
1150 | - echo $html .= '</div>'; |
|
1151 | - /** |
|
1152 | - * This is called after the rating html in the function geodir_detail_page_review_rating(). |
|
1153 | - * |
|
1154 | - * This is called inside the check for an actual rating and the check for preview page. |
|
1155 | - * |
|
1156 | - * @since 1.0.0 |
|
1157 | - * @param float $post_avgratings Average rating for the current post. |
|
1158 | - * @param int $post->ID Current post ID. |
|
1159 | - */ |
|
1160 | - do_action('geodir_after_review_rating_stars_on_detail', $post_avgratings, $post->ID); |
|
1161 | - } |
|
1162 | - /** |
|
1163 | - * This is called before the rating html in the function geodir_detail_page_review_rating(). |
|
1164 | - * |
|
1165 | - * This is called outside the check for an actual rating and the check for preview page. |
|
1166 | - * |
|
1167 | - * @since 1.0.0 |
|
1168 | - */ |
|
1169 | - do_action('geodir_after_detail_page_review_rating'); |
|
1170 | - $content_html = ob_get_clean(); |
|
1171 | - if (trim($content_html) != '') { |
|
1172 | - $content_html = '<div class="geodir-company_info geodir-details-sidebar-rating">' . $content_html . '</div>'; |
|
1173 | - } |
|
1174 | - if ((int)get_option('geodir_disable_rating_info_section') != 1) { |
|
1175 | - /** |
|
1176 | - * Filter the geodir_detail_page_review_rating() function content. |
|
1177 | - * |
|
1178 | - * @since 1.0.0 |
|
1179 | - * @param string $content_html The output html of the geodir_detail_page_review_rating() function. |
|
1180 | - */ |
|
1181 | - echo $content_html = apply_filters('geodir_detail_page_review_rating_html', $content_html); |
|
1182 | - } |
|
1137 | + if ($post_images) { |
|
1138 | + foreach ($post_images as $img) { |
|
1139 | + $post_img = $img->src; |
|
1140 | + break; |
|
1141 | + } |
|
1142 | + } |
|
1143 | + |
|
1144 | + if (isset($post_img) && $post_img) { |
|
1145 | + $html .= '<br /><img src="' . $post_img . '" class="photo" alt="' . esc_attr($post->post_title) . '" itemprop="photo" content="' . $post_img . '" class="photo" />'; |
|
1146 | + } |
|
1147 | + |
|
1148 | + $html .= '</span>'; |
|
1149 | + |
|
1150 | + echo $html .= '</div>'; |
|
1151 | + /** |
|
1152 | + * This is called after the rating html in the function geodir_detail_page_review_rating(). |
|
1153 | + * |
|
1154 | + * This is called inside the check for an actual rating and the check for preview page. |
|
1155 | + * |
|
1156 | + * @since 1.0.0 |
|
1157 | + * @param float $post_avgratings Average rating for the current post. |
|
1158 | + * @param int $post->ID Current post ID. |
|
1159 | + */ |
|
1160 | + do_action('geodir_after_review_rating_stars_on_detail', $post_avgratings, $post->ID); |
|
1161 | + } |
|
1162 | + /** |
|
1163 | + * This is called before the rating html in the function geodir_detail_page_review_rating(). |
|
1164 | + * |
|
1165 | + * This is called outside the check for an actual rating and the check for preview page. |
|
1166 | + * |
|
1167 | + * @since 1.0.0 |
|
1168 | + */ |
|
1169 | + do_action('geodir_after_detail_page_review_rating'); |
|
1170 | + $content_html = ob_get_clean(); |
|
1171 | + if (trim($content_html) != '') { |
|
1172 | + $content_html = '<div class="geodir-company_info geodir-details-sidebar-rating">' . $content_html . '</div>'; |
|
1173 | + } |
|
1174 | + if ((int)get_option('geodir_disable_rating_info_section') != 1) { |
|
1175 | + /** |
|
1176 | + * Filter the geodir_detail_page_review_rating() function content. |
|
1177 | + * |
|
1178 | + * @since 1.0.0 |
|
1179 | + * @param string $content_html The output html of the geodir_detail_page_review_rating() function. |
|
1180 | + */ |
|
1181 | + echo $content_html = apply_filters('geodir_detail_page_review_rating_html', $content_html); |
|
1182 | + } |
|
1183 | 1183 | } |
1184 | 1184 | |
1185 | 1185 | /** |
@@ -1191,35 +1191,35 @@ discard block |
||
1191 | 1191 | */ |
1192 | 1192 | function geodir_detail_page_more_info() |
1193 | 1193 | { |
1194 | - ob_start(); // Start buffering; |
|
1195 | - /** |
|
1196 | - * This is called before the info section html. |
|
1197 | - * |
|
1198 | - * @since 1.0.0 |
|
1199 | - */ |
|
1200 | - do_action('geodir_before_detail_page_more_info'); |
|
1201 | - if ($geodir_post_detail_fields = geodir_show_listing_info('detail')) { |
|
1202 | - echo $geodir_post_detail_fields; |
|
1203 | - } |
|
1204 | - /** |
|
1205 | - * This is called after the info section html. |
|
1206 | - * |
|
1207 | - * @since 1.0.0 |
|
1208 | - */ |
|
1209 | - do_action('geodir_after_detail_page_more_info'); |
|
1210 | - |
|
1211 | - $content_html = ob_get_clean(); |
|
1212 | - if (trim($content_html) != '') |
|
1213 | - $content_html = '<div class="geodir-company_info geodir-details-sidebar-listing-info">' . $content_html . '</div>'; |
|
1214 | - if ((int)get_option('geodir_disable_listing_info_section') != 1) { |
|
1215 | - /** |
|
1216 | - * Filter the output html for function geodir_detail_page_more_info(). |
|
1217 | - * |
|
1218 | - * @since 1.0.0 |
|
1219 | - * @param string $content_html The output html of the geodir_detail_page_more_info() function. |
|
1220 | - */ |
|
1221 | - echo $content_html = apply_filters('geodir_detail_page_more_info_html', $content_html); |
|
1222 | - } |
|
1194 | + ob_start(); // Start buffering; |
|
1195 | + /** |
|
1196 | + * This is called before the info section html. |
|
1197 | + * |
|
1198 | + * @since 1.0.0 |
|
1199 | + */ |
|
1200 | + do_action('geodir_before_detail_page_more_info'); |
|
1201 | + if ($geodir_post_detail_fields = geodir_show_listing_info('detail')) { |
|
1202 | + echo $geodir_post_detail_fields; |
|
1203 | + } |
|
1204 | + /** |
|
1205 | + * This is called after the info section html. |
|
1206 | + * |
|
1207 | + * @since 1.0.0 |
|
1208 | + */ |
|
1209 | + do_action('geodir_after_detail_page_more_info'); |
|
1210 | + |
|
1211 | + $content_html = ob_get_clean(); |
|
1212 | + if (trim($content_html) != '') |
|
1213 | + $content_html = '<div class="geodir-company_info geodir-details-sidebar-listing-info">' . $content_html . '</div>'; |
|
1214 | + if ((int)get_option('geodir_disable_listing_info_section') != 1) { |
|
1215 | + /** |
|
1216 | + * Filter the output html for function geodir_detail_page_more_info(). |
|
1217 | + * |
|
1218 | + * @since 1.0.0 |
|
1219 | + * @param string $content_html The output html of the geodir_detail_page_more_info() function. |
|
1220 | + */ |
|
1221 | + echo $content_html = apply_filters('geodir_detail_page_more_info_html', $content_html); |
|
1222 | + } |
|
1223 | 1223 | } |
1224 | 1224 | |
1225 | 1225 | |
@@ -1233,15 +1233,15 @@ discard block |
||
1233 | 1233 | */ |
1234 | 1234 | function geodir_localize_all_js_msg() |
1235 | 1235 | {// check_ajax_referer function is used to make sure no files are uploaded remotely but it will fail if used between https and non https so we do the check below of the urls |
1236 | - if (str_replace("https", "http", admin_url('admin-ajax.php')) && !empty($_SERVER['HTTPS'])) { |
|
1237 | - $ajax_url = admin_url('admin-ajax.php'); |
|
1238 | - } elseif (!str_replace("https", "http", admin_url('admin-ajax.php')) && empty($_SERVER['HTTPS'])) { |
|
1239 | - $ajax_url = admin_url('admin-ajax.php'); |
|
1240 | - } elseif (str_replace("https", "http", admin_url('admin-ajax.php')) && empty($_SERVER['HTTPS'])) { |
|
1241 | - $ajax_url = str_replace("https", "http", admin_url('admin-ajax.php')); |
|
1242 | - } elseif (!str_replace("https", "http", admin_url('admin-ajax.php')) && !empty($_SERVER['HTTPS'])) { |
|
1243 | - $ajax_url = str_replace("http", "https", admin_url('admin-ajax.php')); |
|
1244 | - } |
|
1236 | + if (str_replace("https", "http", admin_url('admin-ajax.php')) && !empty($_SERVER['HTTPS'])) { |
|
1237 | + $ajax_url = admin_url('admin-ajax.php'); |
|
1238 | + } elseif (!str_replace("https", "http", admin_url('admin-ajax.php')) && empty($_SERVER['HTTPS'])) { |
|
1239 | + $ajax_url = admin_url('admin-ajax.php'); |
|
1240 | + } elseif (str_replace("https", "http", admin_url('admin-ajax.php')) && empty($_SERVER['HTTPS'])) { |
|
1241 | + $ajax_url = str_replace("https", "http", admin_url('admin-ajax.php')); |
|
1242 | + } elseif (!str_replace("https", "http", admin_url('admin-ajax.php')) && !empty($_SERVER['HTTPS'])) { |
|
1243 | + $ajax_url = str_replace("http", "https", admin_url('admin-ajax.php')); |
|
1244 | + } |
|
1245 | 1245 | |
1246 | 1246 | /** |
1247 | 1247 | * Filter the allowed image type extensions for post images. |
@@ -1251,62 +1251,62 @@ discard block |
||
1251 | 1251 | */ |
1252 | 1252 | $allowed_img_types = apply_filters('geodir_allowed_post_image_exts', array('jpg', 'jpeg', 'jpe', 'gif', 'png')); |
1253 | 1253 | |
1254 | - $default_marker_icon = get_option('geodir_default_marker_icon'); |
|
1255 | - $default_marker_size = geodir_get_marker_size($default_marker_icon, array('w' => 20, 'h' => 34)); |
|
1256 | - $default_marker_width = $default_marker_size['w']; |
|
1257 | - $default_marker_height = $default_marker_size['h']; |
|
1254 | + $default_marker_icon = get_option('geodir_default_marker_icon'); |
|
1255 | + $default_marker_size = geodir_get_marker_size($default_marker_icon, array('w' => 20, 'h' => 34)); |
|
1256 | + $default_marker_width = $default_marker_size['w']; |
|
1257 | + $default_marker_height = $default_marker_size['h']; |
|
1258 | 1258 | |
1259 | - $arr_alert_msg = array( |
|
1260 | - 'geodir_plugin_url' => geodir_plugin_url(), |
|
1261 | - 'geodir_admin_ajax_url' => $ajax_url, |
|
1262 | - 'custom_field_not_blank_var' => __('HTML Variable Name must not be blank', 'geodirectory'), |
|
1263 | - 'custom_field_not_special_char' => __('Please do not use special character and spaces in HTML Variable Name.', 'geodirectory'), |
|
1264 | - 'custom_field_unique_name' => __('HTML Variable Name should be a unique name.', 'geodirectory'), |
|
1265 | - 'custom_field_delete' => __('Are you wish to delete this field?', 'geodirectory'), |
|
1266 | - //start not show alert msg |
|
1267 | - 'tax_meta_class_succ_del_msg' => __('File has been successfully deleted.', 'geodirectory'), |
|
1268 | - 'tax_meta_class_not_permission_to_del_msg' => __('You do NOT have permission to delete this file.', 'geodirectory'), |
|
1269 | - 'tax_meta_class_order_save_msg' => __('Order saved!', 'geodirectory'), |
|
1270 | - 'tax_meta_class_not_permission_record_img_msg' => __('You do not have permission to reorder images.', 'geodirectory'), |
|
1271 | - 'address_not_found_on_map_msg' => __('Address not found for:', 'geodirectory'), |
|
1272 | - // end not show alert msg |
|
1273 | - 'my_place_listing_del' => __('Are you sure you wish to delete this listing?', 'geodirectory'), |
|
1274 | - 'my_main_listing_del' => __('Deleting the main listing of a franchise will turn all franchises in regular listings. Are you sure wish to delete this main listing?', 'geodirectory'), |
|
1275 | - //start not show alert msg |
|
1276 | - 'rating_error_msg' => __('Error : please retry', 'geodirectory'), |
|
1277 | - 'listing_url_prefix_msg' => __('Please enter listing url prefix', 'geodirectory'), |
|
1278 | - 'invalid_listing_prefix_msg' => __('Invalid character in listing url prefix', 'geodirectory'), |
|
1279 | - 'location_url_prefix_msg' => __('Please enter location url prefix', 'geodirectory'), |
|
1280 | - 'invalid_location_prefix_msg' => __('Invalid character in location url prefix', 'geodirectory'), |
|
1281 | - 'location_and_cat_url_separator_msg' => __('Please enter location and category url separator', 'geodirectory'), |
|
1282 | - 'invalid_char_and_cat_url_separator_msg' => __('Invalid character in location and category url separator', 'geodirectory'), |
|
1283 | - 'listing_det_url_separator_msg' => __('Please enter listing detail url separator', 'geodirectory'), |
|
1284 | - 'invalid_char_listing_det_url_separator_msg' => __('Invalid character in listing detail url separator', 'geodirectory'), |
|
1285 | - 'loading_listing_error_favorite' => __('Error loading listing.', 'geodirectory'), |
|
1286 | - 'geodir_field_id_required' => __('This field is required.', 'geodirectory'), |
|
1287 | - 'geodir_valid_email_address_msg' => __('Please enter valid email address.', 'geodirectory'), |
|
1288 | - 'geodir_default_marker_icon' => $default_marker_icon, |
|
1289 | - 'geodir_default_marker_w' => $default_marker_width, |
|
1290 | - 'geodir_default_marker_h' => $default_marker_height, |
|
1291 | - 'geodir_latitude_error_msg' => GEODIR_LATITUDE_ERROR_MSG, |
|
1292 | - 'geodir_longgitude_error_msg' => GEODIR_LOGNGITUDE_ERROR_MSG, |
|
1293 | - 'geodir_default_rating_star_icon' => get_option('geodir_default_rating_star_icon'), |
|
1294 | - 'gd_cmt_btn_post_reply' => __('Post Reply', 'geodirectory'), |
|
1295 | - 'gd_cmt_btn_reply_text' => __('Reply text', 'geodirectory'), |
|
1296 | - 'gd_cmt_btn_post_review' => __('Post Review', 'geodirectory'), |
|
1297 | - 'gd_cmt_btn_review_text' => __('Review text', 'geodirectory'), |
|
1298 | - 'gd_cmt_err_no_rating' => __("Please select star rating, you can't leave a review without stars.", 'geodirectory'), |
|
1299 | - 'err_empty_review' => __('Please type a review.', 'geodirectory'), |
|
1300 | - 'err_empty_reply' => __('Please type a reply.', 'geodirectory'), |
|
1301 | - /* on/off dragging for phone devices */ |
|
1302 | - 'geodir_onoff_dragging' => get_option('geodir_map_onoff_dragging') ? true : false, |
|
1303 | - 'geodir_is_mobile' => wp_is_mobile() ? true : false, |
|
1304 | - 'geodir_on_dragging_text' => __('Enable Dragging', 'geodirectory'), |
|
1305 | - 'geodir_off_dragging_text' => __('Disable Dragging', 'geodirectory'), |
|
1306 | - 'geodir_err_max_file_size' => __('File size error : You tried to upload a file over %s', 'geodirectory'), |
|
1307 | - 'geodir_err_file_upload_limit' => __('You have reached your upload limit of %s files.', 'geodirectory'), |
|
1308 | - 'geodir_err_pkg_upload_limit' => __('You may only upload %s files with this package, please try again.', 'geodirectory'), |
|
1309 | - 'geodir_action_remove' => __('Remove', 'geodirectory'), |
|
1259 | + $arr_alert_msg = array( |
|
1260 | + 'geodir_plugin_url' => geodir_plugin_url(), |
|
1261 | + 'geodir_admin_ajax_url' => $ajax_url, |
|
1262 | + 'custom_field_not_blank_var' => __('HTML Variable Name must not be blank', 'geodirectory'), |
|
1263 | + 'custom_field_not_special_char' => __('Please do not use special character and spaces in HTML Variable Name.', 'geodirectory'), |
|
1264 | + 'custom_field_unique_name' => __('HTML Variable Name should be a unique name.', 'geodirectory'), |
|
1265 | + 'custom_field_delete' => __('Are you wish to delete this field?', 'geodirectory'), |
|
1266 | + //start not show alert msg |
|
1267 | + 'tax_meta_class_succ_del_msg' => __('File has been successfully deleted.', 'geodirectory'), |
|
1268 | + 'tax_meta_class_not_permission_to_del_msg' => __('You do NOT have permission to delete this file.', 'geodirectory'), |
|
1269 | + 'tax_meta_class_order_save_msg' => __('Order saved!', 'geodirectory'), |
|
1270 | + 'tax_meta_class_not_permission_record_img_msg' => __('You do not have permission to reorder images.', 'geodirectory'), |
|
1271 | + 'address_not_found_on_map_msg' => __('Address not found for:', 'geodirectory'), |
|
1272 | + // end not show alert msg |
|
1273 | + 'my_place_listing_del' => __('Are you sure you wish to delete this listing?', 'geodirectory'), |
|
1274 | + 'my_main_listing_del' => __('Deleting the main listing of a franchise will turn all franchises in regular listings. Are you sure wish to delete this main listing?', 'geodirectory'), |
|
1275 | + //start not show alert msg |
|
1276 | + 'rating_error_msg' => __('Error : please retry', 'geodirectory'), |
|
1277 | + 'listing_url_prefix_msg' => __('Please enter listing url prefix', 'geodirectory'), |
|
1278 | + 'invalid_listing_prefix_msg' => __('Invalid character in listing url prefix', 'geodirectory'), |
|
1279 | + 'location_url_prefix_msg' => __('Please enter location url prefix', 'geodirectory'), |
|
1280 | + 'invalid_location_prefix_msg' => __('Invalid character in location url prefix', 'geodirectory'), |
|
1281 | + 'location_and_cat_url_separator_msg' => __('Please enter location and category url separator', 'geodirectory'), |
|
1282 | + 'invalid_char_and_cat_url_separator_msg' => __('Invalid character in location and category url separator', 'geodirectory'), |
|
1283 | + 'listing_det_url_separator_msg' => __('Please enter listing detail url separator', 'geodirectory'), |
|
1284 | + 'invalid_char_listing_det_url_separator_msg' => __('Invalid character in listing detail url separator', 'geodirectory'), |
|
1285 | + 'loading_listing_error_favorite' => __('Error loading listing.', 'geodirectory'), |
|
1286 | + 'geodir_field_id_required' => __('This field is required.', 'geodirectory'), |
|
1287 | + 'geodir_valid_email_address_msg' => __('Please enter valid email address.', 'geodirectory'), |
|
1288 | + 'geodir_default_marker_icon' => $default_marker_icon, |
|
1289 | + 'geodir_default_marker_w' => $default_marker_width, |
|
1290 | + 'geodir_default_marker_h' => $default_marker_height, |
|
1291 | + 'geodir_latitude_error_msg' => GEODIR_LATITUDE_ERROR_MSG, |
|
1292 | + 'geodir_longgitude_error_msg' => GEODIR_LOGNGITUDE_ERROR_MSG, |
|
1293 | + 'geodir_default_rating_star_icon' => get_option('geodir_default_rating_star_icon'), |
|
1294 | + 'gd_cmt_btn_post_reply' => __('Post Reply', 'geodirectory'), |
|
1295 | + 'gd_cmt_btn_reply_text' => __('Reply text', 'geodirectory'), |
|
1296 | + 'gd_cmt_btn_post_review' => __('Post Review', 'geodirectory'), |
|
1297 | + 'gd_cmt_btn_review_text' => __('Review text', 'geodirectory'), |
|
1298 | + 'gd_cmt_err_no_rating' => __("Please select star rating, you can't leave a review without stars.", 'geodirectory'), |
|
1299 | + 'err_empty_review' => __('Please type a review.', 'geodirectory'), |
|
1300 | + 'err_empty_reply' => __('Please type a reply.', 'geodirectory'), |
|
1301 | + /* on/off dragging for phone devices */ |
|
1302 | + 'geodir_onoff_dragging' => get_option('geodir_map_onoff_dragging') ? true : false, |
|
1303 | + 'geodir_is_mobile' => wp_is_mobile() ? true : false, |
|
1304 | + 'geodir_on_dragging_text' => __('Enable Dragging', 'geodirectory'), |
|
1305 | + 'geodir_off_dragging_text' => __('Disable Dragging', 'geodirectory'), |
|
1306 | + 'geodir_err_max_file_size' => __('File size error : You tried to upload a file over %s', 'geodirectory'), |
|
1307 | + 'geodir_err_file_upload_limit' => __('You have reached your upload limit of %s files.', 'geodirectory'), |
|
1308 | + 'geodir_err_pkg_upload_limit' => __('You may only upload %s files with this package, please try again.', 'geodirectory'), |
|
1309 | + 'geodir_action_remove' => __('Remove', 'geodirectory'), |
|
1310 | 1310 | 'geodir_txt_all_files' => __('Allowed files', 'geodirectory'), |
1311 | 1311 | 'geodir_err_file_type' => __('File type error. Allowed file types: %s', 'geodirectory'), |
1312 | 1312 | 'gd_allowed_img_types' => !empty($allowed_img_types) ? implode(',', $allowed_img_types) : '', |
@@ -1314,41 +1314,41 @@ discard block |
||
1314 | 1314 | 'geodir_txt_form_searching' => __('Searching...', 'geodirectory'), |
1315 | 1315 | 'fa_rating' => (int)get_option('geodir_reviewrating_enable_font_awesome') == 1 ? 1 : '', |
1316 | 1316 | 'reviewrating' => defined('GEODIRREVIEWRATING_VERSION') ? 1 : '', |
1317 | - 'multirating' => defined('GEODIRREVIEWRATING_VERSION') && get_option('geodir_reviewrating_enable_rating') ? true : false, |
|
1318 | - 'geodir_map_name' => geodir_map_name(), |
|
1319 | - 'osmStart' => __('Start', 'geodirectory'), |
|
1320 | - 'osmVia' => __('Via {viaNumber}', 'geodirectory'), |
|
1321 | - 'osmEnd' => __('Enter Your Location', 'geodirectory'), |
|
1322 | - 'ga_delete_check' => __('Do you wish to Deauthorize and break Analytics?', 'geodirectory'), |
|
1323 | - 'geoMyLocation' => __('My Location', 'geodirectory'), |
|
1324 | - 'geoErrUNKNOWN_ERROR' => addslashes(__('Unable to find your location', 'geodirectory')), |
|
1325 | - 'geoErrPERMISSION_DENINED' => addslashes(__('Permission denied in finding your location', 'geodirectory')), |
|
1326 | - 'geoErrPOSITION_UNAVAILABLE' => addslashes(__('Your location is currently unknown', 'geodirectory')), |
|
1327 | - 'geoErrBREAK' => addslashes(__('Attempt to find location took too long', 'geodirectory')), |
|
1328 | - 'geoErrDEFAULT' => addslashes(__('Location detection not supported in browser', 'geodirectory')), |
|
1317 | + 'multirating' => defined('GEODIRREVIEWRATING_VERSION') && get_option('geodir_reviewrating_enable_rating') ? true : false, |
|
1318 | + 'geodir_map_name' => geodir_map_name(), |
|
1319 | + 'osmStart' => __('Start', 'geodirectory'), |
|
1320 | + 'osmVia' => __('Via {viaNumber}', 'geodirectory'), |
|
1321 | + 'osmEnd' => __('Enter Your Location', 'geodirectory'), |
|
1322 | + 'ga_delete_check' => __('Do you wish to Deauthorize and break Analytics?', 'geodirectory'), |
|
1323 | + 'geoMyLocation' => __('My Location', 'geodirectory'), |
|
1324 | + 'geoErrUNKNOWN_ERROR' => addslashes(__('Unable to find your location', 'geodirectory')), |
|
1325 | + 'geoErrPERMISSION_DENINED' => addslashes(__('Permission denied in finding your location', 'geodirectory')), |
|
1326 | + 'geoErrPOSITION_UNAVAILABLE' => addslashes(__('Your location is currently unknown', 'geodirectory')), |
|
1327 | + 'geoErrBREAK' => addslashes(__('Attempt to find location took too long', 'geodirectory')), |
|
1328 | + 'geoErrDEFAULT' => addslashes(__('Location detection not supported in browser', 'geodirectory')), |
|
1329 | 1329 | 'mapLanguage' => geodir_get_map_default_language() |
1330 | - ); |
|
1331 | - |
|
1332 | - /** |
|
1333 | - * Filters the translated JS strings from function geodir_localize_all_js_msg(). |
|
1334 | - * |
|
1335 | - * With this filter you can add, remove or change translated JS strings. |
|
1336 | - * You should add your own translations to this if you are building an addon rather than adding another script block. |
|
1337 | - * |
|
1338 | - * @since 1.0.0 |
|
1339 | - */ |
|
1340 | - $arr_alert_msg = apply_filters('geodir_all_js_msg', $arr_alert_msg); |
|
1341 | - |
|
1342 | - foreach ($arr_alert_msg as $key => $value) { |
|
1343 | - if (!is_scalar($value)) |
|
1344 | - continue; |
|
1345 | - $arr_alert_msg[$key] = html_entity_decode((string)$value, ENT_QUOTES, 'UTF-8'); |
|
1346 | - } |
|
1330 | + ); |
|
1331 | + |
|
1332 | + /** |
|
1333 | + * Filters the translated JS strings from function geodir_localize_all_js_msg(). |
|
1334 | + * |
|
1335 | + * With this filter you can add, remove or change translated JS strings. |
|
1336 | + * You should add your own translations to this if you are building an addon rather than adding another script block. |
|
1337 | + * |
|
1338 | + * @since 1.0.0 |
|
1339 | + */ |
|
1340 | + $arr_alert_msg = apply_filters('geodir_all_js_msg', $arr_alert_msg); |
|
1347 | 1341 | |
1348 | - $script = "var geodir_all_js_msg = " . json_encode($arr_alert_msg) . ';'; |
|
1349 | - echo '<script>'; |
|
1350 | - echo $script; |
|
1351 | - echo '</script>'; |
|
1342 | + foreach ($arr_alert_msg as $key => $value) { |
|
1343 | + if (!is_scalar($value)) |
|
1344 | + continue; |
|
1345 | + $arr_alert_msg[$key] = html_entity_decode((string)$value, ENT_QUOTES, 'UTF-8'); |
|
1346 | + } |
|
1347 | + |
|
1348 | + $script = "var geodir_all_js_msg = " . json_encode($arr_alert_msg) . ';'; |
|
1349 | + echo '<script>'; |
|
1350 | + echo $script; |
|
1351 | + echo '</script>'; |
|
1352 | 1352 | } |
1353 | 1353 | |
1354 | 1354 | add_action('admin_bar_menu', 'geodir_admin_bar_site_menu', 31); |
@@ -1364,11 +1364,11 @@ discard block |
||
1364 | 1364 | */ |
1365 | 1365 | function geodir_admin_bar_site_menu($wp_admin_bar) |
1366 | 1366 | { |
1367 | - if (get_option("geodir_installed")) { |
|
1368 | - if (current_user_can('manage_options')) { |
|
1369 | - $wp_admin_bar->add_menu(array('parent' => 'appearance', 'id' => 'geodirectory', 'title' => __('GeoDirectory', 'geodirectory'), 'href' => admin_url('?page=geodirectory'))); |
|
1370 | - } |
|
1371 | - } |
|
1367 | + if (get_option("geodir_installed")) { |
|
1368 | + if (current_user_can('manage_options')) { |
|
1369 | + $wp_admin_bar->add_menu(array('parent' => 'appearance', 'id' => 'geodirectory', 'title' => __('GeoDirectory', 'geodirectory'), 'href' => admin_url('?page=geodirectory'))); |
|
1370 | + } |
|
1371 | + } |
|
1372 | 1372 | } |
1373 | 1373 | |
1374 | 1374 | add_action('geodir_before_listing', 'geodir_display_sort_options'); /*function in custom_functions.php*/ |
@@ -1394,25 +1394,25 @@ discard block |
||
1394 | 1394 | */ |
1395 | 1395 | function geodir_store_sidebars() |
1396 | 1396 | { |
1397 | - global $geodir_sidebars; |
|
1398 | - global $sidebars_widgets; |
|
1399 | - |
|
1400 | - if (!is_array($sidebars_widgets)) |
|
1401 | - $sidebars_widgets = wp_get_sidebars_widgets(); |
|
1402 | - $geodir_old_sidebars = array(); |
|
1403 | - |
|
1404 | - if (is_array($geodir_sidebars)) { |
|
1405 | - foreach ($geodir_sidebars as $val) { |
|
1406 | - if (is_array($sidebars_widgets)) { |
|
1407 | - if (array_key_exists($val, $sidebars_widgets)) |
|
1408 | - $geodir_old_sidebars[$val] = $sidebars_widgets[$val]; |
|
1409 | - else |
|
1410 | - $geodir_old_sidebars[$val] = array(); |
|
1411 | - } |
|
1412 | - } |
|
1413 | - } |
|
1414 | - update_option('geodir_sidebars', $geodir_old_sidebars); |
|
1415 | - geodir_option_version_backup('geodir_sidebars'); |
|
1397 | + global $geodir_sidebars; |
|
1398 | + global $sidebars_widgets; |
|
1399 | + |
|
1400 | + if (!is_array($sidebars_widgets)) |
|
1401 | + $sidebars_widgets = wp_get_sidebars_widgets(); |
|
1402 | + $geodir_old_sidebars = array(); |
|
1403 | + |
|
1404 | + if (is_array($geodir_sidebars)) { |
|
1405 | + foreach ($geodir_sidebars as $val) { |
|
1406 | + if (is_array($sidebars_widgets)) { |
|
1407 | + if (array_key_exists($val, $sidebars_widgets)) |
|
1408 | + $geodir_old_sidebars[$val] = $sidebars_widgets[$val]; |
|
1409 | + else |
|
1410 | + $geodir_old_sidebars[$val] = array(); |
|
1411 | + } |
|
1412 | + } |
|
1413 | + } |
|
1414 | + update_option('geodir_sidebars', $geodir_old_sidebars); |
|
1415 | + geodir_option_version_backup('geodir_sidebars'); |
|
1416 | 1416 | |
1417 | 1417 | } |
1418 | 1418 | |
@@ -1426,28 +1426,28 @@ discard block |
||
1426 | 1426 | */ |
1427 | 1427 | function geodir_restore_sidebars() |
1428 | 1428 | { |
1429 | - global $sidebars_widgets; |
|
1430 | - |
|
1431 | - if (!is_array($sidebars_widgets)) |
|
1432 | - $sidebars_widgets = wp_get_sidebars_widgets(); |
|
1433 | - |
|
1434 | - if (is_array($sidebars_widgets)) { |
|
1435 | - $geodir_old_sidebars = get_option('geodir_sidebars'); |
|
1436 | - if (is_array($geodir_old_sidebars)) { |
|
1437 | - foreach ($geodir_old_sidebars as $key => $val) { |
|
1438 | - if(0 === strpos($key, 'geodir_'))// if gd widget |
|
1439 | - { |
|
1440 | - $sidebars_widgets[$key] = $geodir_old_sidebars[$key]; |
|
1441 | - } |
|
1429 | + global $sidebars_widgets; |
|
1442 | 1430 | |
1431 | + if (!is_array($sidebars_widgets)) |
|
1432 | + $sidebars_widgets = wp_get_sidebars_widgets(); |
|
1443 | 1433 | |
1444 | - } |
|
1445 | - } |
|
1434 | + if (is_array($sidebars_widgets)) { |
|
1435 | + $geodir_old_sidebars = get_option('geodir_sidebars'); |
|
1436 | + if (is_array($geodir_old_sidebars)) { |
|
1437 | + foreach ($geodir_old_sidebars as $key => $val) { |
|
1438 | + if(0 === strpos($key, 'geodir_'))// if gd widget |
|
1439 | + { |
|
1440 | + $sidebars_widgets[$key] = $geodir_old_sidebars[$key]; |
|
1441 | + } |
|
1446 | 1442 | |
1447 | - } |
|
1448 | 1443 | |
1449 | - update_option('sidebars_widgets', $sidebars_widgets); |
|
1450 | - update_option('geodir_sidebars', ''); |
|
1444 | + } |
|
1445 | + } |
|
1446 | + |
|
1447 | + } |
|
1448 | + |
|
1449 | + update_option('sidebars_widgets', $sidebars_widgets); |
|
1450 | + update_option('geodir_sidebars', ''); |
|
1451 | 1451 | } |
1452 | 1452 | |
1453 | 1453 | add_action('geodir_after_listing_post_gridview', 'geodir_after_listing_post_gridview'); |
@@ -1460,9 +1460,9 @@ discard block |
||
1460 | 1460 | */ |
1461 | 1461 | function geodir_after_listing_post_gridview() |
1462 | 1462 | { |
1463 | - global $gridview_columns; |
|
1463 | + global $gridview_columns; |
|
1464 | 1464 | |
1465 | - $gridview_columns = ''; |
|
1465 | + $gridview_columns = ''; |
|
1466 | 1466 | |
1467 | 1467 | } |
1468 | 1468 | |
@@ -1490,11 +1490,11 @@ discard block |
||
1490 | 1490 | */ |
1491 | 1491 | function so_handle_038($url, $original_url, $_context) |
1492 | 1492 | { |
1493 | - if (strstr($url, "maps.google.com/maps/api/js") !== false) { |
|
1494 | - $url = str_replace("&", "&", $url); // or $url = $original_url |
|
1495 | - } |
|
1493 | + if (strstr($url, "maps.google.com/maps/api/js") !== false) { |
|
1494 | + $url = str_replace("&", "&", $url); // or $url = $original_url |
|
1495 | + } |
|
1496 | 1496 | |
1497 | - return $url; |
|
1497 | + return $url; |
|
1498 | 1498 | } |
1499 | 1499 | |
1500 | 1500 | |
@@ -1510,34 +1510,34 @@ discard block |
||
1510 | 1510 | function geodir_after_main_form_fields() { |
1511 | 1511 | global $gd_session; |
1512 | 1512 | |
1513 | - if (get_option('geodir_accept_term_condition')) { |
|
1514 | - global $post; |
|
1515 | - $term_condition = ''; |
|
1516 | - if (isset($_REQUEST['backandedit'])) { |
|
1517 | - $post = (object)$gd_session->get('listing'); |
|
1518 | - $term_condition = isset($post->geodir_accept_term_condition) ? $post->geodir_accept_term_condition : ''; |
|
1519 | - } |
|
1520 | - |
|
1521 | - ?> |
|
1513 | + if (get_option('geodir_accept_term_condition')) { |
|
1514 | + global $post; |
|
1515 | + $term_condition = ''; |
|
1516 | + if (isset($_REQUEST['backandedit'])) { |
|
1517 | + $post = (object)$gd_session->get('listing'); |
|
1518 | + $term_condition = isset($post->geodir_accept_term_condition) ? $post->geodir_accept_term_condition : ''; |
|
1519 | + } |
|
1520 | + |
|
1521 | + ?> |
|
1522 | 1522 | <div id="geodir_accept_term_condition_row" class="required_field geodir_form_row clearfix"> |
1523 | 1523 | <label> </label> |
1524 | 1524 | |
1525 | 1525 | <div class="geodir_taxonomy_field" style="float:left; width:70%;"> |
1526 | 1526 | <span style="display:block"> |
1527 | 1527 | <input class="main_list_selecter" type="checkbox" <?php if ($term_condition == '1') { |
1528 | - echo 'checked="checked"'; |
|
1529 | - } ?> field_type="checkbox" name="geodir_accept_term_condition" id="geodir_accept_term_condition" |
|
1528 | + echo 'checked="checked"'; |
|
1529 | + } ?> field_type="checkbox" name="geodir_accept_term_condition" id="geodir_accept_term_condition" |
|
1530 | 1530 | class="geodir_textfield" value="1" |
1531 | 1531 | style="display:inline-block"/><a href="<?php $terms_page = get_option('geodir_term_condition_page'); if($terms_page){ echo get_permalink($terms_page);}?>" target="_blank"><?php _e('Please accept our terms and conditions', 'geodirectory'); ?></a> |
1532 | 1532 | </span> |
1533 | 1533 | </div> |
1534 | 1534 | <span class="geodir_message_error"><?php if (isset($required_msg)) { |
1535 | - _e($required_msg, 'geodirectory'); |
|
1536 | - } ?></span> |
|
1535 | + _e($required_msg, 'geodirectory'); |
|
1536 | + } ?></span> |
|
1537 | 1537 | </div> |
1538 | 1538 | <?php |
1539 | 1539 | |
1540 | - } |
|
1540 | + } |
|
1541 | 1541 | } |
1542 | 1542 | |
1543 | 1543 | |
@@ -1562,42 +1562,42 @@ discard block |
||
1562 | 1562 | */ |
1563 | 1563 | function geodir_detail_page_tab_is_display($is_display, $tab) |
1564 | 1564 | { |
1565 | - global $post, $post_images, $video, $special_offers, $related_listing, $geodir_post_detail_fields; |
|
1565 | + global $post, $post_images, $video, $special_offers, $related_listing, $geodir_post_detail_fields; |
|
1566 | 1566 | |
1567 | - if ($tab == 'post_profile') { |
|
1568 | - /** This action is documented in geodirectory_template_actions.php */ |
|
1569 | - $desc_limit = apply_filters('geodir_description_field_desc_limit', ''); |
|
1567 | + if ($tab == 'post_profile') { |
|
1568 | + /** This action is documented in geodirectory_template_actions.php */ |
|
1569 | + $desc_limit = apply_filters('geodir_description_field_desc_limit', ''); |
|
1570 | 1570 | |
1571 | - if (!($desc_limit === '' || (int)$desc_limit > 0)) { |
|
1572 | - $is_display = false; |
|
1573 | - } |
|
1574 | - } |
|
1571 | + if (!($desc_limit === '' || (int)$desc_limit > 0)) { |
|
1572 | + $is_display = false; |
|
1573 | + } |
|
1574 | + } |
|
1575 | 1575 | |
1576 | - if ($tab == 'post_info') |
|
1577 | - $is_display = (!empty($geodir_post_detail_fields)) ? true : false; |
|
1576 | + if ($tab == 'post_info') |
|
1577 | + $is_display = (!empty($geodir_post_detail_fields)) ? true : false; |
|
1578 | 1578 | |
1579 | - if ($tab == 'post_images') |
|
1580 | - $is_display = (!empty($post_images)) ? true : false; |
|
1579 | + if ($tab == 'post_images') |
|
1580 | + $is_display = (!empty($post_images)) ? true : false; |
|
1581 | 1581 | |
1582 | - if ($tab == 'post_video') |
|
1583 | - $is_display = (!empty($video)) ? true : false; |
|
1582 | + if ($tab == 'post_video') |
|
1583 | + $is_display = (!empty($video)) ? true : false; |
|
1584 | 1584 | |
1585 | - if ($tab == 'special_offers') |
|
1586 | - $is_display = (!empty($special_offers)) ? true : false; |
|
1585 | + if ($tab == 'special_offers') |
|
1586 | + $is_display = (!empty($special_offers)) ? true : false; |
|
1587 | 1587 | |
1588 | - if ($tab == 'reviews') |
|
1589 | - $is_display = (geodir_is_page('detail')) ? true : false; |
|
1588 | + if ($tab == 'reviews') |
|
1589 | + $is_display = (geodir_is_page('detail')) ? true : false; |
|
1590 | 1590 | |
1591 | - if ($tab == 'related_listing') { |
|
1592 | - $message = __('No listings found which match your selection.', 'geodirectory'); |
|
1591 | + if ($tab == 'related_listing') { |
|
1592 | + $message = __('No listings found which match your selection.', 'geodirectory'); |
|
1593 | 1593 | |
1594 | - /** This action is documented in geodirectory-functions/template_functions.php */ |
|
1595 | - $message = apply_filters('geodir_message_listing_not_found', $message, 'listing-listview', false); |
|
1594 | + /** This action is documented in geodirectory-functions/template_functions.php */ |
|
1595 | + $message = apply_filters('geodir_message_listing_not_found', $message, 'listing-listview', false); |
|
1596 | 1596 | |
1597 | - $is_display = ((strpos($related_listing, $message) !== false || $related_listing == '' || !geodir_is_page('detail'))) ? false : true; |
|
1598 | - } |
|
1597 | + $is_display = ((strpos($related_listing, $message) !== false || $related_listing == '' || !geodir_is_page('detail'))) ? false : true; |
|
1598 | + } |
|
1599 | 1599 | |
1600 | - return $is_display; |
|
1600 | + return $is_display; |
|
1601 | 1601 | } |
1602 | 1602 | |
1603 | 1603 | |
@@ -1613,69 +1613,69 @@ discard block |
||
1613 | 1613 | * @global string $plugin_prefix Geodirectory plugin table prefix. |
1614 | 1614 | */ |
1615 | 1615 | function geodir_changes_in_custom_fields_table() { |
1616 | - global $wpdb, $plugin_prefix; |
|
1616 | + global $wpdb, $plugin_prefix; |
|
1617 | 1617 | |
1618 | 1618 | // Remove unused virtual page |
1619 | 1619 | $listings_page_id = (int)get_option('geodir_listing_page'); |
1620 | 1620 | if ($listings_page_id) { |
1621 | 1621 | $wpdb->query($wpdb->prepare("DELETE FROM " . $wpdb->posts . " WHERE ID=%d AND post_name = %s AND post_type=%s", array($listings_page_id, 'listings', 'page'))); |
1622 | - delete_option('geodir_listing_page'); |
|
1622 | + delete_option('geodir_listing_page'); |
|
1623 | 1623 | } |
1624 | 1624 | |
1625 | - if (!get_option('geodir_changes_in_custom_fields_table')) { |
|
1626 | - $wpdb->query( |
|
1627 | - $wpdb->prepare( |
|
1628 | - "UPDATE " . GEODIR_CUSTOM_FIELDS_TABLE . " SET is_default=%s, is_admin=%s WHERE is_default=%s", |
|
1629 | - array('1', '1', 'admin') |
|
1630 | - ) |
|
1631 | - ); |
|
1625 | + if (!get_option('geodir_changes_in_custom_fields_table')) { |
|
1626 | + $wpdb->query( |
|
1627 | + $wpdb->prepare( |
|
1628 | + "UPDATE " . GEODIR_CUSTOM_FIELDS_TABLE . " SET is_default=%s, is_admin=%s WHERE is_default=%s", |
|
1629 | + array('1', '1', 'admin') |
|
1630 | + ) |
|
1631 | + ); |
|
1632 | 1632 | |
1633 | 1633 | |
1634 | - /* --- terms meta value set --- */ |
|
1634 | + /* --- terms meta value set --- */ |
|
1635 | 1635 | |
1636 | - update_option('geodir_default_marker_icon', geodir_plugin_url() . '/geodirectory-functions/map-functions/icons/pin.png'); |
|
1636 | + update_option('geodir_default_marker_icon', geodir_plugin_url() . '/geodirectory-functions/map-functions/icons/pin.png'); |
|
1637 | 1637 | |
1638 | - $options_data = $wpdb->get_results($wpdb->prepare("SELECT * FROM " . $wpdb->prefix . "options WHERE option_name LIKE %s", array('%tax_meta_%'))); |
|
1638 | + $options_data = $wpdb->get_results($wpdb->prepare("SELECT * FROM " . $wpdb->prefix . "options WHERE option_name LIKE %s", array('%tax_meta_%'))); |
|
1639 | 1639 | |
1640 | - if (!empty($options_data)) { |
|
1640 | + if (!empty($options_data)) { |
|
1641 | 1641 | |
1642 | - foreach ($options_data as $optobj) { |
|
1642 | + foreach ($options_data as $optobj) { |
|
1643 | 1643 | |
1644 | - $option_val = str_replace('tax_meta_', '', $optobj->option_name); |
|
1644 | + $option_val = str_replace('tax_meta_', '', $optobj->option_name); |
|
1645 | 1645 | |
1646 | - $taxonomies_data = $wpdb->get_results($wpdb->prepare("SELECT taxonomy FROM " . $wpdb->prefix . "term_taxonomy WHERE taxonomy LIKE %s AND term_id=%d", array('%category%', $option_val))); |
|
1646 | + $taxonomies_data = $wpdb->get_results($wpdb->prepare("SELECT taxonomy FROM " . $wpdb->prefix . "term_taxonomy WHERE taxonomy LIKE %s AND term_id=%d", array('%category%', $option_val))); |
|
1647 | 1647 | |
1648 | - if (!empty($taxonomies_data)) { |
|
1648 | + if (!empty($taxonomies_data)) { |
|
1649 | 1649 | |
1650 | - foreach ($taxonomies_data as $taxobj) { |
|
1650 | + foreach ($taxonomies_data as $taxobj) { |
|
1651 | 1651 | |
1652 | - $taxObject = get_taxonomy($taxobj->taxonomy); |
|
1653 | - $post_type = $taxObject->object_type[0]; |
|
1652 | + $taxObject = get_taxonomy($taxobj->taxonomy); |
|
1653 | + $post_type = $taxObject->object_type[0]; |
|
1654 | 1654 | |
1655 | - $opt_value = 'tax_meta_' . $post_type . '_' . $option_val; |
|
1655 | + $opt_value = 'tax_meta_' . $post_type . '_' . $option_val; |
|
1656 | 1656 | |
1657 | - $duplicate_data = $wpdb->get_var($wpdb->prepare("SELECT option_id FROM " . $wpdb->prefix . "options WHERE option_name=%s", array('tax_meta_' . $option_val))); |
|
1657 | + $duplicate_data = $wpdb->get_var($wpdb->prepare("SELECT option_id FROM " . $wpdb->prefix . "options WHERE option_name=%s", array('tax_meta_' . $option_val))); |
|
1658 | 1658 | |
1659 | - if ($duplicate_data) { |
|
1659 | + if ($duplicate_data) { |
|
1660 | 1660 | |
1661 | - $wpdb->query($wpdb->prepare("UPDATE " . $wpdb->prefix . "options SET option_name=%s WHERE option_id=%d", array($opt_value, $optobj->option_id))); |
|
1661 | + $wpdb->query($wpdb->prepare("UPDATE " . $wpdb->prefix . "options SET option_name=%s WHERE option_id=%d", array($opt_value, $optobj->option_id))); |
|
1662 | 1662 | |
1663 | - } else { |
|
1663 | + } else { |
|
1664 | 1664 | |
1665 | - $wpdb->query($wpdb->prepare("INSERT INTO " . $wpdb->prefix . "options (option_name,option_value,autoload) VALUES (%s, %s, %s)", array($opt_value, $optobj->option_value, $optobj->autoload))); |
|
1665 | + $wpdb->query($wpdb->prepare("INSERT INTO " . $wpdb->prefix . "options (option_name,option_value,autoload) VALUES (%s, %s, %s)", array($opt_value, $optobj->option_value, $optobj->autoload))); |
|
1666 | 1666 | |
1667 | - } |
|
1667 | + } |
|
1668 | 1668 | |
1669 | - } |
|
1669 | + } |
|
1670 | 1670 | |
1671 | - } |
|
1671 | + } |
|
1672 | 1672 | |
1673 | - } |
|
1674 | - } |
|
1673 | + } |
|
1674 | + } |
|
1675 | 1675 | |
1676 | - update_option('geodir_changes_in_custom_fields_table', '1'); |
|
1676 | + update_option('geodir_changes_in_custom_fields_table', '1'); |
|
1677 | 1677 | |
1678 | - } |
|
1678 | + } |
|
1679 | 1679 | |
1680 | 1680 | } |
1681 | 1681 | |
@@ -1694,24 +1694,24 @@ discard block |
||
1694 | 1694 | function geodir_location_slug_check($slug) |
1695 | 1695 | { |
1696 | 1696 | |
1697 | - global $wpdb, $table_prefix; |
|
1697 | + global $wpdb, $table_prefix; |
|
1698 | 1698 | |
1699 | - $slug_exists = $wpdb->get_var($wpdb->prepare("SELECT slug FROM " . $table_prefix . "terms WHERE slug=%s", array($slug))); |
|
1699 | + $slug_exists = $wpdb->get_var($wpdb->prepare("SELECT slug FROM " . $table_prefix . "terms WHERE slug=%s", array($slug))); |
|
1700 | 1700 | |
1701 | - if ($slug_exists) { |
|
1701 | + if ($slug_exists) { |
|
1702 | 1702 | |
1703 | - $suffix = 1; |
|
1704 | - do { |
|
1705 | - $alt_location_name = _truncate_post_slug($slug, 200 - (strlen($suffix) + 1)) . "-$suffix"; |
|
1706 | - $location_slug_check = $wpdb->get_var($wpdb->prepare("SELECT slug FROM " . $table_prefix . "terms WHERE slug=%s", array($alt_location_name))); |
|
1707 | - $suffix++; |
|
1708 | - } while ($location_slug_check && $suffix < 100); |
|
1703 | + $suffix = 1; |
|
1704 | + do { |
|
1705 | + $alt_location_name = _truncate_post_slug($slug, 200 - (strlen($suffix) + 1)) . "-$suffix"; |
|
1706 | + $location_slug_check = $wpdb->get_var($wpdb->prepare("SELECT slug FROM " . $table_prefix . "terms WHERE slug=%s", array($alt_location_name))); |
|
1707 | + $suffix++; |
|
1708 | + } while ($location_slug_check && $suffix < 100); |
|
1709 | 1709 | |
1710 | - $slug = $alt_location_name; |
|
1710 | + $slug = $alt_location_name; |
|
1711 | 1711 | |
1712 | - } |
|
1712 | + } |
|
1713 | 1713 | |
1714 | - return $slug; |
|
1714 | + return $slug; |
|
1715 | 1715 | |
1716 | 1716 | } |
1717 | 1717 | |
@@ -1736,42 +1736,42 @@ discard block |
||
1736 | 1736 | function geodir_update_term_slug($term_id, $tt_id, $taxonomy) |
1737 | 1737 | { |
1738 | 1738 | |
1739 | - global $wpdb, $plugin_prefix, $table_prefix; |
|
1739 | + global $wpdb, $plugin_prefix, $table_prefix; |
|
1740 | 1740 | |
1741 | - $tern_data = get_term_by('id', $term_id, $taxonomy); |
|
1741 | + $tern_data = get_term_by('id', $term_id, $taxonomy); |
|
1742 | 1742 | |
1743 | - $slug = $tern_data->slug; |
|
1743 | + $slug = $tern_data->slug; |
|
1744 | 1744 | |
1745 | - /** |
|
1746 | - * Filter if a term slug exists. |
|
1747 | - * |
|
1748 | - * @since 1.0.0 |
|
1749 | - * @package GeoDirectory |
|
1750 | - * @param bool $bool Default: false. |
|
1751 | - * @param string $slug The term slug. |
|
1752 | - * @param int $term_id The term ID. |
|
1753 | - */ |
|
1754 | - $slug_exists = apply_filters('geodir_term_slug_is_exists', false, $slug, $term_id); |
|
1745 | + /** |
|
1746 | + * Filter if a term slug exists. |
|
1747 | + * |
|
1748 | + * @since 1.0.0 |
|
1749 | + * @package GeoDirectory |
|
1750 | + * @param bool $bool Default: false. |
|
1751 | + * @param string $slug The term slug. |
|
1752 | + * @param int $term_id The term ID. |
|
1753 | + */ |
|
1754 | + $slug_exists = apply_filters('geodir_term_slug_is_exists', false, $slug, $term_id); |
|
1755 | 1755 | |
1756 | - if ($slug_exists) { |
|
1756 | + if ($slug_exists) { |
|
1757 | 1757 | |
1758 | - $suffix = 1; |
|
1759 | - do { |
|
1760 | - $new_slug = _truncate_post_slug($slug, 200 - (strlen($suffix) + 1)) . "-$suffix"; |
|
1758 | + $suffix = 1; |
|
1759 | + do { |
|
1760 | + $new_slug = _truncate_post_slug($slug, 200 - (strlen($suffix) + 1)) . "-$suffix"; |
|
1761 | 1761 | |
1762 | - /** This action is documented in geodirectory_hooks_actions.php */ |
|
1763 | - $term_slug_check = apply_filters('geodir_term_slug_is_exists', false, $new_slug, $term_id); |
|
1762 | + /** This action is documented in geodirectory_hooks_actions.php */ |
|
1763 | + $term_slug_check = apply_filters('geodir_term_slug_is_exists', false, $new_slug, $term_id); |
|
1764 | 1764 | |
1765 | - $suffix++; |
|
1766 | - } while ($term_slug_check && $suffix < 100); |
|
1765 | + $suffix++; |
|
1766 | + } while ($term_slug_check && $suffix < 100); |
|
1767 | 1767 | |
1768 | - $slug = $new_slug; |
|
1768 | + $slug = $new_slug; |
|
1769 | 1769 | |
1770 | - //wp_update_term( $term_id, $taxonomy, array('slug' => $slug) ); |
|
1770 | + //wp_update_term( $term_id, $taxonomy, array('slug' => $slug) ); |
|
1771 | 1771 | |
1772 | - $wpdb->query($wpdb->prepare("UPDATE " . $table_prefix . "terms SET slug=%s WHERE term_id=%d", array($slug, $term_id))); |
|
1772 | + $wpdb->query($wpdb->prepare("UPDATE " . $table_prefix . "terms SET slug=%s WHERE term_id=%d", array($slug, $term_id))); |
|
1773 | 1773 | |
1774 | - } |
|
1774 | + } |
|
1775 | 1775 | |
1776 | 1776 | // Update tag in detail table. |
1777 | 1777 | $taxonomy_obj = get_taxonomy($taxonomy); |
@@ -1812,21 +1812,21 @@ discard block |
||
1812 | 1812 | function geodir_term_slug_is_exists($slug_exists, $slug, $term_id) |
1813 | 1813 | { |
1814 | 1814 | |
1815 | - global $wpdb, $table_prefix; |
|
1815 | + global $wpdb, $table_prefix; |
|
1816 | 1816 | |
1817 | - $default_location = geodir_get_default_location(); |
|
1817 | + $default_location = geodir_get_default_location(); |
|
1818 | 1818 | |
1819 | - $country_slug = $default_location->country_slug; |
|
1820 | - $region_slug = $default_location->region_slug; |
|
1821 | - $city_slug = $default_location->city_slug; |
|
1819 | + $country_slug = $default_location->country_slug; |
|
1820 | + $region_slug = $default_location->region_slug; |
|
1821 | + $city_slug = $default_location->city_slug; |
|
1822 | 1822 | |
1823 | - if ($country_slug == $slug || $region_slug == $slug || $city_slug == $slug) |
|
1824 | - return $slug_exists = true; |
|
1823 | + if ($country_slug == $slug || $region_slug == $slug || $city_slug == $slug) |
|
1824 | + return $slug_exists = true; |
|
1825 | 1825 | |
1826 | - if ($wpdb->get_var($wpdb->prepare("SELECT slug FROM " . $table_prefix . "terms WHERE slug=%s AND term_id != %d", array($slug, $term_id)))) |
|
1827 | - return $slug_exists = true; |
|
1826 | + if ($wpdb->get_var($wpdb->prepare("SELECT slug FROM " . $table_prefix . "terms WHERE slug=%s AND term_id != %d", array($slug, $term_id)))) |
|
1827 | + return $slug_exists = true; |
|
1828 | 1828 | |
1829 | - return $slug_exists; |
|
1829 | + return $slug_exists; |
|
1830 | 1830 | } |
1831 | 1831 | |
1832 | 1832 | |
@@ -1846,75 +1846,75 @@ discard block |
||
1846 | 1846 | */ |
1847 | 1847 | function geodir_custom_page_title($title = '', $sep = '') |
1848 | 1848 | { |
1849 | - global $wp; |
|
1850 | - if ((class_exists('WPSEO_Frontend') || class_exists('All_in_One_SEO_Pack')) && !geodir_disable_yoast_seo_metas()) { |
|
1851 | - return $title; |
|
1852 | - } |
|
1849 | + global $wp; |
|
1850 | + if ((class_exists('WPSEO_Frontend') || class_exists('All_in_One_SEO_Pack')) && !geodir_disable_yoast_seo_metas()) { |
|
1851 | + return $title; |
|
1852 | + } |
|
1853 | 1853 | |
1854 | - if ($sep == '') { |
|
1855 | - /** |
|
1856 | - * Filter the page title separator. |
|
1857 | - * |
|
1858 | - * @since 1.0.0 |
|
1859 | - * @package GeoDirectory |
|
1860 | - * @param string $sep The separator, default: `|`. |
|
1861 | - */ |
|
1862 | - $sep = apply_filters('geodir_page_title_separator', '|'); |
|
1863 | - } |
|
1854 | + if ($sep == '') { |
|
1855 | + /** |
|
1856 | + * Filter the page title separator. |
|
1857 | + * |
|
1858 | + * @since 1.0.0 |
|
1859 | + * @package GeoDirectory |
|
1860 | + * @param string $sep The separator, default: `|`. |
|
1861 | + */ |
|
1862 | + $sep = apply_filters('geodir_page_title_separator', '|'); |
|
1863 | + } |
|
1864 | 1864 | |
1865 | 1865 | |
1866 | - $gd_page = ''; |
|
1867 | - if(geodir_is_page('home')){ |
|
1868 | - $gd_page = 'home'; |
|
1869 | - $title = (get_option('geodir_meta_title_homepage')) ? get_option('geodir_meta_title_homepage') : $title; |
|
1870 | - } |
|
1871 | - elseif(geodir_is_page('detail')){ |
|
1872 | - $gd_page = 'detail'; |
|
1873 | - $title = (get_option('geodir_meta_title_detail')) ? get_option('geodir_meta_title_detail') : $title; |
|
1874 | - } |
|
1875 | - elseif(geodir_is_page('pt')){ |
|
1876 | - $gd_page = 'pt'; |
|
1877 | - $title = (get_option('geodir_meta_title_pt')) ? get_option('geodir_meta_title_pt') : $title; |
|
1878 | - } |
|
1879 | - elseif(geodir_is_page('listing')){ |
|
1880 | - $gd_page = 'listing'; |
|
1881 | - $title = (get_option('geodir_meta_title_listing')) ? get_option('geodir_meta_title_listing') : $title; |
|
1882 | - } |
|
1883 | - elseif(geodir_is_page('location')){ |
|
1884 | - $gd_page = 'location'; |
|
1885 | - $title = (get_option('geodir_meta_title_location')) ? get_option('geodir_meta_title_location') : $title; |
|
1886 | - } |
|
1887 | - elseif(geodir_is_page('search')){ |
|
1888 | - $gd_page = 'search'; |
|
1889 | - $title = (get_option('geodir_meta_title_search')) ? get_option('geodir_meta_title_search') : $title; |
|
1890 | - } |
|
1891 | - elseif(geodir_is_page('add-listing')){ |
|
1892 | - $gd_page = 'add-listing'; |
|
1893 | - $title = (get_option('geodir_meta_title_add-listing')) ? get_option('geodir_meta_title_add-listing') : $title; |
|
1894 | - } |
|
1895 | - elseif(geodir_is_page('author')){ |
|
1896 | - $gd_page = 'author'; |
|
1897 | - $title = (get_option('geodir_meta_title_author')) ? get_option('geodir_meta_title_author') : $title; |
|
1898 | - } |
|
1899 | - elseif(geodir_is_page('login')){ |
|
1900 | - $gd_page = 'login'; |
|
1901 | - $title = (get_option('geodir_meta_title_login')) ? get_option('geodir_meta_title_login') : $title; |
|
1902 | - } |
|
1903 | - elseif(geodir_is_page('listing-success')){ |
|
1904 | - $gd_page = 'listing-success'; |
|
1905 | - $title = (get_option('geodir_meta_title_listing-success')) ? get_option('geodir_meta_title_listing-success') : $title; |
|
1906 | - } |
|
1866 | + $gd_page = ''; |
|
1867 | + if(geodir_is_page('home')){ |
|
1868 | + $gd_page = 'home'; |
|
1869 | + $title = (get_option('geodir_meta_title_homepage')) ? get_option('geodir_meta_title_homepage') : $title; |
|
1870 | + } |
|
1871 | + elseif(geodir_is_page('detail')){ |
|
1872 | + $gd_page = 'detail'; |
|
1873 | + $title = (get_option('geodir_meta_title_detail')) ? get_option('geodir_meta_title_detail') : $title; |
|
1874 | + } |
|
1875 | + elseif(geodir_is_page('pt')){ |
|
1876 | + $gd_page = 'pt'; |
|
1877 | + $title = (get_option('geodir_meta_title_pt')) ? get_option('geodir_meta_title_pt') : $title; |
|
1878 | + } |
|
1879 | + elseif(geodir_is_page('listing')){ |
|
1880 | + $gd_page = 'listing'; |
|
1881 | + $title = (get_option('geodir_meta_title_listing')) ? get_option('geodir_meta_title_listing') : $title; |
|
1882 | + } |
|
1883 | + elseif(geodir_is_page('location')){ |
|
1884 | + $gd_page = 'location'; |
|
1885 | + $title = (get_option('geodir_meta_title_location')) ? get_option('geodir_meta_title_location') : $title; |
|
1886 | + } |
|
1887 | + elseif(geodir_is_page('search')){ |
|
1888 | + $gd_page = 'search'; |
|
1889 | + $title = (get_option('geodir_meta_title_search')) ? get_option('geodir_meta_title_search') : $title; |
|
1890 | + } |
|
1891 | + elseif(geodir_is_page('add-listing')){ |
|
1892 | + $gd_page = 'add-listing'; |
|
1893 | + $title = (get_option('geodir_meta_title_add-listing')) ? get_option('geodir_meta_title_add-listing') : $title; |
|
1894 | + } |
|
1895 | + elseif(geodir_is_page('author')){ |
|
1896 | + $gd_page = 'author'; |
|
1897 | + $title = (get_option('geodir_meta_title_author')) ? get_option('geodir_meta_title_author') : $title; |
|
1898 | + } |
|
1899 | + elseif(geodir_is_page('login')){ |
|
1900 | + $gd_page = 'login'; |
|
1901 | + $title = (get_option('geodir_meta_title_login')) ? get_option('geodir_meta_title_login') : $title; |
|
1902 | + } |
|
1903 | + elseif(geodir_is_page('listing-success')){ |
|
1904 | + $gd_page = 'listing-success'; |
|
1905 | + $title = (get_option('geodir_meta_title_listing-success')) ? get_option('geodir_meta_title_listing-success') : $title; |
|
1906 | + } |
|
1907 | 1907 | |
1908 | 1908 | |
1909 | - /** |
|
1910 | - * Filter page meta title to replace variables. |
|
1911 | - * |
|
1912 | - * @since 1.5.4 |
|
1913 | - * @param string $title The page title including variables. |
|
1914 | - * @param string $gd_page The GeoDirectory page type if any. |
|
1915 | - * @param string $sep The title separator symbol. |
|
1916 | - */ |
|
1917 | - return apply_filters('geodir_seo_meta_title', __($title, 'geodirectory'), $gd_page, $sep); |
|
1909 | + /** |
|
1910 | + * Filter page meta title to replace variables. |
|
1911 | + * |
|
1912 | + * @since 1.5.4 |
|
1913 | + * @param string $title The page title including variables. |
|
1914 | + * @param string $gd_page The GeoDirectory page type if any. |
|
1915 | + * @param string $sep The title separator symbol. |
|
1916 | + */ |
|
1917 | + return apply_filters('geodir_seo_meta_title', __($title, 'geodirectory'), $gd_page, $sep); |
|
1918 | 1918 | |
1919 | 1919 | } |
1920 | 1920 | |
@@ -1930,36 +1930,36 @@ discard block |
||
1930 | 1930 | function geodir_set_post_attachment() |
1931 | 1931 | { |
1932 | 1932 | |
1933 | - if (!get_option('geodir_set_post_attachments')) { |
|
1933 | + if (!get_option('geodir_set_post_attachments')) { |
|
1934 | 1934 | |
1935 | - require_once(ABSPATH . 'wp-admin/includes/image.php'); |
|
1936 | - require_once(ABSPATH . 'wp-admin/includes/file.php'); |
|
1935 | + require_once(ABSPATH . 'wp-admin/includes/image.php'); |
|
1936 | + require_once(ABSPATH . 'wp-admin/includes/file.php'); |
|
1937 | 1937 | |
1938 | - $all_postypes = geodir_get_posttypes(); |
|
1938 | + $all_postypes = geodir_get_posttypes(); |
|
1939 | 1939 | |
1940 | - foreach($all_postypes as $post_type){ |
|
1941 | - $args = array( |
|
1942 | - 'posts_per_page' => -1, |
|
1943 | - 'post_type' => $post_type, |
|
1944 | - 'post_status' => 'publish'); |
|
1940 | + foreach($all_postypes as $post_type){ |
|
1941 | + $args = array( |
|
1942 | + 'posts_per_page' => -1, |
|
1943 | + 'post_type' => $post_type, |
|
1944 | + 'post_status' => 'publish'); |
|
1945 | 1945 | |
1946 | - $posts_array = get_posts($args); |
|
1946 | + $posts_array = get_posts($args); |
|
1947 | 1947 | |
1948 | - if (!empty($posts_array)) { |
|
1948 | + if (!empty($posts_array)) { |
|
1949 | 1949 | |
1950 | - foreach ($posts_array as $post) { |
|
1950 | + foreach ($posts_array as $post) { |
|
1951 | 1951 | |
1952 | - geodir_set_wp_featured_image($post->ID); |
|
1952 | + geodir_set_wp_featured_image($post->ID); |
|
1953 | 1953 | |
1954 | - } |
|
1954 | + } |
|
1955 | 1955 | |
1956 | - } |
|
1957 | - } |
|
1956 | + } |
|
1957 | + } |
|
1958 | 1958 | |
1959 | 1959 | |
1960 | - update_option('geodir_set_post_attachments', '1'); |
|
1960 | + update_option('geodir_set_post_attachments', '1'); |
|
1961 | 1961 | |
1962 | - } |
|
1962 | + } |
|
1963 | 1963 | |
1964 | 1964 | } |
1965 | 1965 | |
@@ -1976,19 +1976,19 @@ discard block |
||
1976 | 1976 | function geodir_remove_url_seperator() |
1977 | 1977 | { |
1978 | 1978 | |
1979 | - if (!get_option('geodir_remove_url_seperator')) { |
|
1979 | + if (!get_option('geodir_remove_url_seperator')) { |
|
1980 | 1980 | |
1981 | - if (get_option('geodir_listingurl_separator')) |
|
1982 | - delete_option('geodir_listingurl_separator'); |
|
1981 | + if (get_option('geodir_listingurl_separator')) |
|
1982 | + delete_option('geodir_listingurl_separator'); |
|
1983 | 1983 | |
1984 | - if (get_option('geodir_detailurl_separator')) |
|
1985 | - delete_option('geodir_detailurl_separator'); |
|
1984 | + if (get_option('geodir_detailurl_separator')) |
|
1985 | + delete_option('geodir_detailurl_separator'); |
|
1986 | 1986 | |
1987 | - flush_rewrite_rules(false); |
|
1987 | + flush_rewrite_rules(false); |
|
1988 | 1988 | |
1989 | - update_option('geodir_remove_url_seperator', '1'); |
|
1989 | + update_option('geodir_remove_url_seperator', '1'); |
|
1990 | 1990 | |
1991 | - } |
|
1991 | + } |
|
1992 | 1992 | |
1993 | 1993 | } |
1994 | 1994 | |
@@ -2004,19 +2004,19 @@ discard block |
||
2004 | 2004 | */ |
2005 | 2005 | function geodir_remove_url_seperator_form_permalink_settings($permalink_arr) |
2006 | 2006 | { |
2007 | - foreach ($permalink_arr as $key => $value) { |
|
2007 | + foreach ($permalink_arr as $key => $value) { |
|
2008 | 2008 | |
2009 | - if ($value['id'] == 'geodir_listingurl_separator' || $value['id'] == 'geodir_detailurl_separator') |
|
2010 | - unset($permalink_arr[$key]); |
|
2009 | + if ($value['id'] == 'geodir_listingurl_separator' || $value['id'] == 'geodir_detailurl_separator') |
|
2010 | + unset($permalink_arr[$key]); |
|
2011 | 2011 | |
2012 | - } |
|
2012 | + } |
|
2013 | 2013 | |
2014 | - return $permalink_arr; |
|
2014 | + return $permalink_arr; |
|
2015 | 2015 | |
2016 | 2016 | } |
2017 | 2017 | |
2018 | 2018 | if (!is_admin()) { |
2019 | - add_filter('posts_results', 'geodir_set_status_draft_to_publish_for_own_post'); |
|
2019 | + add_filter('posts_results', 'geodir_set_status_draft_to_publish_for_own_post'); |
|
2020 | 2020 | } |
2021 | 2021 | /** |
2022 | 2022 | * Set status from draft to publish. |
@@ -2029,16 +2029,16 @@ discard block |
||
2029 | 2029 | */ |
2030 | 2030 | function geodir_set_status_draft_to_publish_for_own_post($post) |
2031 | 2031 | { |
2032 | - $user_id = get_current_user_id(); |
|
2032 | + $user_id = get_current_user_id(); |
|
2033 | 2033 | |
2034 | - if(!$user_id){return $post;} |
|
2034 | + if(!$user_id){return $post;} |
|
2035 | 2035 | |
2036 | - $gd_post_types = geodir_get_posttypes(); |
|
2036 | + $gd_post_types = geodir_get_posttypes(); |
|
2037 | 2037 | |
2038 | - if (!empty($post) && $post[0]->post_author == $user_id && in_array($post[0]->post_type, $gd_post_types) && !isset($_REQUEST['fl_builder'])) { |
|
2039 | - $post[0]->post_status = 'publish'; |
|
2040 | - } |
|
2041 | - return $post; |
|
2038 | + if (!empty($post) && $post[0]->post_author == $user_id && in_array($post[0]->post_type, $gd_post_types) && !isset($_REQUEST['fl_builder'])) { |
|
2039 | + $post[0]->post_status = 'publish'; |
|
2040 | + } |
|
2041 | + return $post; |
|
2042 | 2042 | } |
2043 | 2043 | |
2044 | 2044 | |
@@ -2130,33 +2130,33 @@ discard block |
||
2130 | 2130 | */ |
2131 | 2131 | function geodir_detail_page_tab_headings_change($tabs_arr) |
2132 | 2132 | { |
2133 | - global $wpdb; |
|
2133 | + global $wpdb; |
|
2134 | 2134 | |
2135 | - $post_type = geodir_get_current_posttype(); |
|
2135 | + $post_type = geodir_get_current_posttype(); |
|
2136 | 2136 | |
2137 | - $all_postypes = geodir_get_posttypes(); |
|
2137 | + $all_postypes = geodir_get_posttypes(); |
|
2138 | 2138 | |
2139 | - if (!empty($tabs_arr) && $post_type != '' && in_array($post_type, $all_postypes)) { |
|
2139 | + if (!empty($tabs_arr) && $post_type != '' && in_array($post_type, $all_postypes)) { |
|
2140 | 2140 | |
2141 | - if (array_key_exists('post_video', $tabs_arr)) { |
|
2141 | + if (array_key_exists('post_video', $tabs_arr)) { |
|
2142 | 2142 | |
2143 | - $field_title = $wpdb->get_var($wpdb->prepare("select site_title from " . GEODIR_CUSTOM_FIELDS_TABLE . " where htmlvar_name = %s and post_type = %s ", array('geodir_video', $post_type))); |
|
2143 | + $field_title = $wpdb->get_var($wpdb->prepare("select site_title from " . GEODIR_CUSTOM_FIELDS_TABLE . " where htmlvar_name = %s and post_type = %s ", array('geodir_video', $post_type))); |
|
2144 | 2144 | |
2145 | - if (isset($tabs_arr['post_video']['heading_text']) && $field_title != '') |
|
2146 | - $tabs_arr['post_video']['heading_text'] = $field_title; |
|
2147 | - } |
|
2145 | + if (isset($tabs_arr['post_video']['heading_text']) && $field_title != '') |
|
2146 | + $tabs_arr['post_video']['heading_text'] = $field_title; |
|
2147 | + } |
|
2148 | 2148 | |
2149 | - if (array_key_exists('special_offers', $tabs_arr)) { |
|
2149 | + if (array_key_exists('special_offers', $tabs_arr)) { |
|
2150 | 2150 | |
2151 | - $field_title = $wpdb->get_var($wpdb->prepare("select site_title from " . GEODIR_CUSTOM_FIELDS_TABLE . " where htmlvar_name = %s and post_type = %s ", array('geodir_special_offers', $post_type))); |
|
2151 | + $field_title = $wpdb->get_var($wpdb->prepare("select site_title from " . GEODIR_CUSTOM_FIELDS_TABLE . " where htmlvar_name = %s and post_type = %s ", array('geodir_special_offers', $post_type))); |
|
2152 | 2152 | |
2153 | - if (isset($tabs_arr['special_offers']['heading_text']) && $field_title != '') |
|
2154 | - $tabs_arr['special_offers']['heading_text'] = $field_title; |
|
2155 | - } |
|
2153 | + if (isset($tabs_arr['special_offers']['heading_text']) && $field_title != '') |
|
2154 | + $tabs_arr['special_offers']['heading_text'] = $field_title; |
|
2155 | + } |
|
2156 | 2156 | |
2157 | - } |
|
2157 | + } |
|
2158 | 2158 | |
2159 | - return $tabs_arr; |
|
2159 | + return $tabs_arr; |
|
2160 | 2160 | |
2161 | 2161 | } |
2162 | 2162 | |
@@ -2169,10 +2169,10 @@ discard block |
||
2169 | 2169 | */ |
2170 | 2170 | function geodir_remove_template_redirect_actions() |
2171 | 2171 | { |
2172 | - if (geodir_is_page('login')){ |
|
2173 | - remove_all_actions('template_redirect'); |
|
2174 | - remove_action('init', 'avia_modify_front', 10); |
|
2175 | - } |
|
2172 | + if (geodir_is_page('login')){ |
|
2173 | + remove_all_actions('template_redirect'); |
|
2174 | + remove_action('init', 'avia_modify_front', 10); |
|
2175 | + } |
|
2176 | 2176 | } |
2177 | 2177 | |
2178 | 2178 | |
@@ -2194,51 +2194,51 @@ discard block |
||
2194 | 2194 | function geodirectory_before_featured_image_delete($attachment_id) |
2195 | 2195 | { |
2196 | 2196 | |
2197 | - global $wpdb, $plugin_prefix; |
|
2197 | + global $wpdb, $plugin_prefix; |
|
2198 | 2198 | |
2199 | - $post_id = get_post_field('post_parent', $attachment_id); |
|
2199 | + $post_id = get_post_field('post_parent', $attachment_id); |
|
2200 | 2200 | |
2201 | - $attachment_url = wp_get_attachment_url($attachment_id); |
|
2201 | + $attachment_url = wp_get_attachment_url($attachment_id); |
|
2202 | 2202 | |
2203 | - if ($post_id > 0 && (isset($_REQUEST['action']) && $_REQUEST['action'] == 'delete')) { |
|
2203 | + if ($post_id > 0 && (isset($_REQUEST['action']) && $_REQUEST['action'] == 'delete')) { |
|
2204 | 2204 | |
2205 | - $post_type = get_post_type($post_id); |
|
2205 | + $post_type = get_post_type($post_id); |
|
2206 | 2206 | |
2207 | - $all_postypes = geodir_get_posttypes(); |
|
2207 | + $all_postypes = geodir_get_posttypes(); |
|
2208 | 2208 | |
2209 | - if (!in_array($post_type, $all_postypes) || !is_admin()) |
|
2210 | - return false; |
|
2209 | + if (!in_array($post_type, $all_postypes) || !is_admin()) |
|
2210 | + return false; |
|
2211 | 2211 | |
2212 | - $uploads = wp_upload_dir(); |
|
2212 | + $uploads = wp_upload_dir(); |
|
2213 | 2213 | |
2214 | - $split_img_path = explode($uploads['baseurl'], $attachment_url); |
|
2214 | + $split_img_path = explode($uploads['baseurl'], $attachment_url); |
|
2215 | 2215 | |
2216 | - $split_img_file_path = isset($split_img_path[1]) ? $split_img_path[1] : ''; |
|
2216 | + $split_img_file_path = isset($split_img_path[1]) ? $split_img_path[1] : ''; |
|
2217 | 2217 | |
2218 | - $wpdb->query( |
|
2219 | - $wpdb->prepare("DELETE FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE post_id = %d AND file=%s ", |
|
2220 | - array($post_id, $split_img_file_path) |
|
2221 | - ) |
|
2222 | - ); |
|
2218 | + $wpdb->query( |
|
2219 | + $wpdb->prepare("DELETE FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE post_id = %d AND file=%s ", |
|
2220 | + array($post_id, $split_img_file_path) |
|
2221 | + ) |
|
2222 | + ); |
|
2223 | 2223 | |
2224 | - $attachment_data = $wpdb->get_row( |
|
2225 | - $wpdb->prepare("SELECT ID, MIN(`menu_order`) FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE post_id=%d", |
|
2226 | - array($post_id) |
|
2227 | - ) |
|
2228 | - ); |
|
2224 | + $attachment_data = $wpdb->get_row( |
|
2225 | + $wpdb->prepare("SELECT ID, MIN(`menu_order`) FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE post_id=%d", |
|
2226 | + array($post_id) |
|
2227 | + ) |
|
2228 | + ); |
|
2229 | 2229 | |
2230 | - if (!empty($attachment_data)) { |
|
2231 | - $wpdb->query("UPDATE " . GEODIR_ATTACHMENT_TABLE . " SET menu_order=1 WHERE ID=" . $attachment_data->ID); |
|
2232 | - } |
|
2230 | + if (!empty($attachment_data)) { |
|
2231 | + $wpdb->query("UPDATE " . GEODIR_ATTACHMENT_TABLE . " SET menu_order=1 WHERE ID=" . $attachment_data->ID); |
|
2232 | + } |
|
2233 | 2233 | |
2234 | 2234 | |
2235 | - $table_name = $plugin_prefix . $post_type . '_detail'; |
|
2235 | + $table_name = $plugin_prefix . $post_type . '_detail'; |
|
2236 | 2236 | |
2237 | - $wpdb->query("UPDATE " . $table_name . " SET featured_image='' WHERE post_id =" . $post_id); |
|
2237 | + $wpdb->query("UPDATE " . $table_name . " SET featured_image='' WHERE post_id =" . $post_id); |
|
2238 | 2238 | |
2239 | - geodir_set_wp_featured_image($post_id); |
|
2239 | + geodir_set_wp_featured_image($post_id); |
|
2240 | 2240 | |
2241 | - } |
|
2241 | + } |
|
2242 | 2242 | |
2243 | 2243 | } |
2244 | 2244 | |
@@ -2256,79 +2256,79 @@ discard block |
||
2256 | 2256 | function geodir_temp_set_post_attachment() |
2257 | 2257 | { |
2258 | 2258 | |
2259 | - global $wpdb, $plugin_prefix; |
|
2259 | + global $wpdb, $plugin_prefix; |
|
2260 | 2260 | |
2261 | - $all_postypes = geodir_get_posttypes(); |
|
2261 | + $all_postypes = geodir_get_posttypes(); |
|
2262 | 2262 | |
2263 | - foreach ($all_postypes as $posttype) { |
|
2263 | + foreach ($all_postypes as $posttype) { |
|
2264 | 2264 | |
2265 | - $tablename = $plugin_prefix . $posttype . '_detail'; |
|
2265 | + $tablename = $plugin_prefix . $posttype . '_detail'; |
|
2266 | 2266 | |
2267 | - $get_post_data = $wpdb->get_results("SELECT post_id FROM " . $tablename); |
|
2267 | + $get_post_data = $wpdb->get_results("SELECT post_id FROM " . $tablename); |
|
2268 | 2268 | |
2269 | - if (!empty($get_post_data)) { |
|
2269 | + if (!empty($get_post_data)) { |
|
2270 | 2270 | |
2271 | - foreach ($get_post_data as $data) { |
|
2271 | + foreach ($get_post_data as $data) { |
|
2272 | 2272 | |
2273 | - $post_id = $data->post_id; |
|
2273 | + $post_id = $data->post_id; |
|
2274 | 2274 | |
2275 | - $attachment_data = $wpdb->get_results("SELECT * FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE post_id =" . $post_id . " AND file!=''"); |
|
2275 | + $attachment_data = $wpdb->get_results("SELECT * FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE post_id =" . $post_id . " AND file!=''"); |
|
2276 | 2276 | |
2277 | - if (!empty($attachment_data)) { |
|
2277 | + if (!empty($attachment_data)) { |
|
2278 | 2278 | |
2279 | - foreach ($attachment_data as $attach) { |
|
2279 | + foreach ($attachment_data as $attach) { |
|
2280 | 2280 | |
2281 | - $file_info = pathinfo($attach->file); |
|
2281 | + $file_info = pathinfo($attach->file); |
|
2282 | 2282 | |
2283 | - $sub_dir = ''; |
|
2284 | - if ($file_info['dirname'] != '.' && $file_info['dirname'] != '..') |
|
2285 | - $sub_dir = stripslashes_deep($file_info['dirname']); |
|
2283 | + $sub_dir = ''; |
|
2284 | + if ($file_info['dirname'] != '.' && $file_info['dirname'] != '..') |
|
2285 | + $sub_dir = stripslashes_deep($file_info['dirname']); |
|
2286 | 2286 | |
2287 | - $uploads = wp_upload_dir(trim($sub_dir, '/')); // Array of key => value pairs |
|
2288 | - $uploads_path = $uploads['basedir']; |
|
2287 | + $uploads = wp_upload_dir(trim($sub_dir, '/')); // Array of key => value pairs |
|
2288 | + $uploads_path = $uploads['basedir']; |
|
2289 | 2289 | |
2290 | - $file_name = $file_info['basename']; |
|
2290 | + $file_name = $file_info['basename']; |
|
2291 | 2291 | |
2292 | - $img_arr['path'] = $uploads_path . $sub_dir . '/' . $file_name; |
|
2292 | + $img_arr['path'] = $uploads_path . $sub_dir . '/' . $file_name; |
|
2293 | 2293 | |
2294 | - if (!file_exists($img_arr['path'])) { |
|
2294 | + if (!file_exists($img_arr['path'])) { |
|
2295 | 2295 | |
2296 | - $wpdb->query("DELETE FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE ID=" . $attach->ID); |
|
2296 | + $wpdb->query("DELETE FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE ID=" . $attach->ID); |
|
2297 | 2297 | |
2298 | - } |
|
2298 | + } |
|
2299 | 2299 | |
2300 | - } |
|
2300 | + } |
|
2301 | 2301 | |
2302 | - $attachment_data = $wpdb->get_row("SELECT ID, MIN(`menu_order`) FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE post_id=" . $post_id . " GROUP BY post_id"); |
|
2302 | + $attachment_data = $wpdb->get_row("SELECT ID, MIN(`menu_order`) FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE post_id=" . $post_id . " GROUP BY post_id"); |
|
2303 | 2303 | |
2304 | - if (!empty($attachment_data)) { |
|
2304 | + if (!empty($attachment_data)) { |
|
2305 | 2305 | |
2306 | - if ($attachment_data->ID) |
|
2307 | - $wpdb->query("UPDATE " . GEODIR_ATTACHMENT_TABLE . " SET menu_order=1 WHERE ID=" . $attachment_data->ID); |
|
2306 | + if ($attachment_data->ID) |
|
2307 | + $wpdb->query("UPDATE " . GEODIR_ATTACHMENT_TABLE . " SET menu_order=1 WHERE ID=" . $attachment_data->ID); |
|
2308 | 2308 | |
2309 | - } else { |
|
2309 | + } else { |
|
2310 | 2310 | |
2311 | - if (has_post_thumbnail($post_id)) { |
|
2311 | + if (has_post_thumbnail($post_id)) { |
|
2312 | 2312 | |
2313 | - $post_thumbnail_id = get_post_thumbnail_id($post_id); |
|
2313 | + $post_thumbnail_id = get_post_thumbnail_id($post_id); |
|
2314 | 2314 | |
2315 | - wp_delete_attachment($post_thumbnail_id); |
|
2315 | + wp_delete_attachment($post_thumbnail_id); |
|
2316 | 2316 | |
2317 | - } |
|
2317 | + } |
|
2318 | 2318 | |
2319 | - } |
|
2319 | + } |
|
2320 | 2320 | |
2321 | - $wpdb->query("UPDATE " . $tablename . " SET featured_image='' WHERE post_id =" . $post_id); |
|
2321 | + $wpdb->query("UPDATE " . $tablename . " SET featured_image='' WHERE post_id =" . $post_id); |
|
2322 | 2322 | |
2323 | - geodir_set_wp_featured_image($post_id); |
|
2323 | + geodir_set_wp_featured_image($post_id); |
|
2324 | 2324 | |
2325 | - } |
|
2325 | + } |
|
2326 | 2326 | |
2327 | - } |
|
2327 | + } |
|
2328 | 2328 | |
2329 | - } |
|
2329 | + } |
|
2330 | 2330 | |
2331 | - } |
|
2331 | + } |
|
2332 | 2332 | |
2333 | 2333 | } |
2334 | 2334 | |
@@ -2346,9 +2346,9 @@ discard block |
||
2346 | 2346 | function geodir_default_rating_star_icon() |
2347 | 2347 | { |
2348 | 2348 | |
2349 | - if (!get_option('geodir_default_rating_star_icon')) { |
|
2350 | - update_option('geodir_default_rating_star_icon', geodir_plugin_url() . '/geodirectory-assets/images/stars.png'); |
|
2351 | - } |
|
2349 | + if (!get_option('geodir_default_rating_star_icon')) { |
|
2350 | + update_option('geodir_default_rating_star_icon', geodir_plugin_url() . '/geodirectory-assets/images/stars.png'); |
|
2351 | + } |
|
2352 | 2352 | |
2353 | 2353 | } |
2354 | 2354 | |
@@ -2366,25 +2366,25 @@ discard block |
||
2366 | 2366 | */ |
2367 | 2367 | function geodir_user_post_listing_count($user_id = 0) |
2368 | 2368 | { |
2369 | - global $wpdb, $plugin_prefix, $current_user; |
|
2370 | - if(!$user_id){ |
|
2371 | - $user_id = $current_user->ID; |
|
2372 | - } |
|
2369 | + global $wpdb, $plugin_prefix, $current_user; |
|
2370 | + if(!$user_id){ |
|
2371 | + $user_id = $current_user->ID; |
|
2372 | + } |
|
2373 | 2373 | |
2374 | - $all_posts = get_option('geodir_listing_link_user_dashboard'); |
|
2374 | + $all_posts = get_option('geodir_listing_link_user_dashboard'); |
|
2375 | 2375 | |
2376 | - $user_listing = array(); |
|
2377 | - if ($user_id && is_array($all_posts) && !empty($all_posts)) { |
|
2378 | - foreach ($all_posts as $ptype) { |
|
2379 | - $total_posts = $wpdb->get_var("SELECT count( ID ) FROM " . $wpdb->prefix . "posts WHERE post_author=" . $user_id . " AND post_type='" . $ptype . "' AND ( post_status = 'publish' OR post_status = 'draft' OR post_status = 'private' OR post_status = 'pending' )"); |
|
2376 | + $user_listing = array(); |
|
2377 | + if ($user_id && is_array($all_posts) && !empty($all_posts)) { |
|
2378 | + foreach ($all_posts as $ptype) { |
|
2379 | + $total_posts = $wpdb->get_var("SELECT count( ID ) FROM " . $wpdb->prefix . "posts WHERE post_author=" . $user_id . " AND post_type='" . $ptype . "' AND ( post_status = 'publish' OR post_status = 'draft' OR post_status = 'private' OR post_status = 'pending' )"); |
|
2380 | 2380 | |
2381 | - if ($total_posts > 0) { |
|
2382 | - $user_listing[$ptype] = $total_posts; |
|
2383 | - } |
|
2384 | - } |
|
2385 | - } |
|
2381 | + if ($total_posts > 0) { |
|
2382 | + $user_listing[$ptype] = $total_posts; |
|
2383 | + } |
|
2384 | + } |
|
2385 | + } |
|
2386 | 2386 | |
2387 | - return $user_listing; |
|
2387 | + return $user_listing; |
|
2388 | 2388 | } |
2389 | 2389 | |
2390 | 2390 | |
@@ -2404,189 +2404,189 @@ discard block |
||
2404 | 2404 | */ |
2405 | 2405 | function geodir_detail_page_custom_field_tab($tabs_arr) |
2406 | 2406 | { |
2407 | - global $post; |
|
2408 | - |
|
2409 | - $post_type = geodir_get_current_posttype(); |
|
2410 | - $all_postypes = geodir_get_posttypes(); |
|
2411 | - |
|
2412 | - if (!empty($tabs_arr) && $post_type != '' && in_array($post_type, $all_postypes) && (geodir_is_page('detail') || geodir_is_page('preview'))) { |
|
2413 | - $package_info = array(); |
|
2414 | - $package_info = geodir_post_package_info($package_info, $post); |
|
2415 | - $post_package_id = !empty($package_info->pid) ? $package_info->pid : ''; |
|
2416 | - $fields_location = 'owntab'; |
|
2417 | - |
|
2418 | - $custom_fields = geodir_post_custom_fields($post_package_id, 'all', $post_type, $fields_location); |
|
2419 | - //remove video and special offers if it is already set to show |
|
2420 | - if(isset($tabs_arr['post_video']['is_display']) && $tabs_arr['post_video']['is_display']){ |
|
2421 | - $unset_video = true; |
|
2422 | - } |
|
2423 | - |
|
2424 | - if(isset($tabs_arr['special_offers']['is_display']) && $tabs_arr['special_offers']['is_display']){ |
|
2425 | - $unset_special_offers = true; |
|
2426 | - } |
|
2427 | - if(isset($unset_video) || isset($unset_special_offers) && !empty($custom_fields)){ |
|
2428 | - foreach($custom_fields as $key => $custom_field){ |
|
2429 | - if($custom_field['name']=='geodir_video' && isset($unset_video)){ |
|
2430 | - unset($custom_fields[$key]); |
|
2431 | - } |
|
2432 | - if($custom_field['name']=='geodir_special_offers' && isset($unset_special_offers)){ |
|
2433 | - unset($custom_fields[$key]); |
|
2434 | - } |
|
2435 | - } |
|
2436 | - } |
|
2437 | - |
|
2438 | - |
|
2439 | - if (!empty($custom_fields)) { |
|
2440 | - $parse_custom_fields = array(); |
|
2441 | - foreach ($custom_fields as $field) { |
|
2442 | - $field = stripslashes_deep($field); // strip slashes |
|
2443 | - $type = $field; |
|
2444 | - $field_name = $field['htmlvar_name']; |
|
2445 | - if (empty($geodir_post_info) && geodir_is_page('preview') && $field_name != '' && !isset($post->{$field_name}) && isset($_REQUEST[$field_name])) { |
|
2446 | - $post->{$field_name} = $_REQUEST[$field_name]; |
|
2447 | - } |
|
2407 | + global $post; |
|
2448 | 2408 | |
2449 | - if (isset($field['show_in']) && strpos($field['show_in'], '[owntab]') !== false && ((isset($post->{$field_name}) && $post->{$field_name} != '') || $field['type'] == 'fieldset' || $field['type'] == 'address') && in_array($field['type'], array('text', 'datepicker', 'textarea', 'time', 'phone', 'email', 'select', 'multiselect', 'url', 'html', 'fieldset', 'radio', 'checkbox', 'file','address','taxonomy'))) { |
|
2450 | - if ($type['type'] == 'datepicker' && ($post->{$type['htmlvar_name']} == '' || $post->{$type['htmlvar_name']} == '0000-00-00')) { |
|
2451 | - continue; |
|
2452 | - } |
|
2409 | + $post_type = geodir_get_current_posttype(); |
|
2410 | + $all_postypes = geodir_get_posttypes(); |
|
2453 | 2411 | |
2454 | - $parse_custom_fields[] = $field; |
|
2455 | - } |
|
2456 | - } |
|
2457 | - $custom_fields = $parse_custom_fields; |
|
2458 | - } |
|
2459 | - //print_r($custom_fields); |
|
2460 | - if (!empty($custom_fields)) { |
|
2412 | + if (!empty($tabs_arr) && $post_type != '' && in_array($post_type, $all_postypes) && (geodir_is_page('detail') || geodir_is_page('preview'))) { |
|
2413 | + $package_info = array(); |
|
2414 | + $package_info = geodir_post_package_info($package_info, $post); |
|
2415 | + $post_package_id = !empty($package_info->pid) ? $package_info->pid : ''; |
|
2416 | + $fields_location = 'owntab'; |
|
2461 | 2417 | |
2462 | - global $field_set_start; |
|
2418 | + $custom_fields = geodir_post_custom_fields($post_package_id, 'all', $post_type, $fields_location); |
|
2419 | + //remove video and special offers if it is already set to show |
|
2420 | + if(isset($tabs_arr['post_video']['is_display']) && $tabs_arr['post_video']['is_display']){ |
|
2421 | + $unset_video = true; |
|
2422 | + } |
|
2463 | 2423 | |
2464 | - $post = stripslashes_deep($post); // strip slashes |
|
2465 | - |
|
2466 | - $field_set_start = 0; |
|
2467 | - $fieldset_count = 0; |
|
2468 | - $fieldset = ''; |
|
2469 | - $total_fields = count($custom_fields); |
|
2470 | - $count_field = 0; |
|
2471 | - $fieldset_arr = array(); |
|
2472 | - $i = 0; |
|
2473 | - $geodir_post_info = isset($post->ID) && !empty($post->ID) ? geodir_get_post_info($post->ID) : NULL; |
|
2474 | - |
|
2475 | - foreach ($custom_fields as $field) { |
|
2476 | - $count_field++; |
|
2477 | - $field_name = $field['htmlvar_name']; |
|
2478 | - if (empty($geodir_post_info) && geodir_is_page('preview') && $field_name != '' && !isset($post->{$field_name}) && isset($_REQUEST[$field_name])) { |
|
2479 | - $post->{$field_name} = $_REQUEST[$field_name]; |
|
2480 | - } |
|
2424 | + if(isset($tabs_arr['special_offers']['is_display']) && $tabs_arr['special_offers']['is_display']){ |
|
2425 | + $unset_special_offers = true; |
|
2426 | + } |
|
2427 | + if(isset($unset_video) || isset($unset_special_offers) && !empty($custom_fields)){ |
|
2428 | + foreach($custom_fields as $key => $custom_field){ |
|
2429 | + if($custom_field['name']=='geodir_video' && isset($unset_video)){ |
|
2430 | + unset($custom_fields[$key]); |
|
2431 | + } |
|
2432 | + if($custom_field['name']=='geodir_special_offers' && isset($unset_special_offers)){ |
|
2433 | + unset($custom_fields[$key]); |
|
2434 | + } |
|
2435 | + } |
|
2436 | + } |
|
2481 | 2437 | |
2482 | - if (isset($field['show_in']) && strpos($field['show_in'], '[owntab]') !== false && ((isset($post->{$field_name}) && $post->{$field_name} != '') || $field['type'] == 'fieldset' || $field['type'] == 'address') && in_array($field['type'], array('text', 'datepicker', 'textarea', 'time', 'phone', 'email', 'select', 'multiselect', 'url', 'html', 'fieldset', 'radio', 'checkbox', 'file','address','taxonomy'))) { |
|
2483 | - $label = $field['site_title'] != '' ? $field['site_title'] : $field['admin_title']; |
|
2484 | - $site_title = trim($field['site_title']); |
|
2485 | - $type = $field; |
|
2486 | - $variables_array = array(); |
|
2487 | 2438 | |
2488 | - if ($type['type'] == 'datepicker' && ($post->{$type['htmlvar_name']} == '' || $post->{$type['htmlvar_name']} == '0000-00-00')) { |
|
2489 | - continue; |
|
2490 | - } |
|
2439 | + if (!empty($custom_fields)) { |
|
2440 | + $parse_custom_fields = array(); |
|
2441 | + foreach ($custom_fields as $field) { |
|
2442 | + $field = stripslashes_deep($field); // strip slashes |
|
2443 | + $type = $field; |
|
2444 | + $field_name = $field['htmlvar_name']; |
|
2445 | + if (empty($geodir_post_info) && geodir_is_page('preview') && $field_name != '' && !isset($post->{$field_name}) && isset($_REQUEST[$field_name])) { |
|
2446 | + $post->{$field_name} = $_REQUEST[$field_name]; |
|
2447 | + } |
|
2491 | 2448 | |
2492 | - if ($type['type'] != 'fieldset') { |
|
2493 | - $i++; |
|
2494 | - $variables_array['post_id'] = $post->ID; |
|
2495 | - $variables_array['label'] = __($type['site_title'], 'geodirectory'); |
|
2496 | - $variables_array['value'] = isset($post->{$type['htmlvar_name']}) ? $post->{$type['htmlvar_name']} : ''; |
|
2497 | - |
|
2498 | - }else{ |
|
2499 | - $i = 0; |
|
2500 | - $fieldset_count++; |
|
2501 | - $field_set_start = 1; |
|
2502 | - $fieldset_arr[$fieldset_count]['htmlvar_name'] = 'gd_tab_' . $fieldset_count; |
|
2503 | - $fieldset_arr[$fieldset_count]['label'] = $label; |
|
2504 | - } |
|
2449 | + if (isset($field['show_in']) && strpos($field['show_in'], '[owntab]') !== false && ((isset($post->{$field_name}) && $post->{$field_name} != '') || $field['type'] == 'fieldset' || $field['type'] == 'address') && in_array($field['type'], array('text', 'datepicker', 'textarea', 'time', 'phone', 'email', 'select', 'multiselect', 'url', 'html', 'fieldset', 'radio', 'checkbox', 'file','address','taxonomy'))) { |
|
2450 | + if ($type['type'] == 'datepicker' && ($post->{$type['htmlvar_name']} == '' || $post->{$type['htmlvar_name']} == '0000-00-00')) { |
|
2451 | + continue; |
|
2452 | + } |
|
2505 | 2453 | |
2454 | + $parse_custom_fields[] = $field; |
|
2455 | + } |
|
2456 | + } |
|
2457 | + $custom_fields = $parse_custom_fields; |
|
2458 | + } |
|
2459 | + //print_r($custom_fields); |
|
2460 | + if (!empty($custom_fields)) { |
|
2506 | 2461 | |
2507 | - if(isset($type['extra_fields'])){$extra_fields= $type['extra_fields'];} |
|
2508 | - $type = stripslashes_deep($type); // strip slashes |
|
2509 | - if(isset($type['extra_fields'])){$type['extra_fields'] = $extra_fields;} |
|
2510 | - $html = ''; |
|
2511 | - $html_var = isset($type['htmlvar_name']) ? $type['htmlvar_name'] : ''; |
|
2512 | - if($html_var=='post'){$html_var='post_address';} |
|
2513 | - $field_icon = geodir_field_icon_proccess($type); |
|
2514 | - $filed_type = $type['type']; |
|
2515 | - |
|
2516 | - /** |
|
2517 | - * Filter the output for custom fields. |
|
2518 | - * |
|
2519 | - * Here we can remove or add new functions depending on the field type. |
|
2520 | - * |
|
2521 | - * @param string $html The html to be filtered (blank). |
|
2522 | - * @param string $fields_location The location the field is to be show. |
|
2523 | - * @param array $type The array of field values. |
|
2524 | - */ |
|
2525 | - $html = apply_filters("geodir_custom_field_output_{$filed_type}",$html,$fields_location,$type); |
|
2526 | - |
|
2527 | - |
|
2528 | - /** |
|
2529 | - * Filter custom field output in tab. |
|
2530 | - * |
|
2531 | - * @since 1.5.6 |
|
2532 | - * |
|
2533 | - * @param string $html_var The HTML variable name for the field. |
|
2534 | - * @param string $html Custom field unfiltered HTML. |
|
2535 | - * @param array $variables_array Custom field variables array. |
|
2536 | - */ |
|
2537 | - $html = apply_filters("geodir_tab_show_{$html_var}", $html, $variables_array); |
|
2538 | - |
|
2539 | - $fieldset_html = ''; |
|
2540 | - if ($field_set_start == 1) { |
|
2541 | - $add_html = false; |
|
2542 | - if ($type['type'] == 'fieldset' && $fieldset_count > 1) { |
|
2543 | - if ($fieldset != '') { |
|
2544 | - $add_html = true; |
|
2545 | - $label = $fieldset_arr[$fieldset_count - 1]['label']; |
|
2546 | - $htmlvar_name = $fieldset_arr[$fieldset_count - 1]['htmlvar_name']; |
|
2547 | - } |
|
2548 | - $fieldset_html = $fieldset; |
|
2549 | - $fieldset = ''; |
|
2550 | - } else { |
|
2551 | - $fieldset .= $html; |
|
2552 | - if ($total_fields == $count_field && $fieldset != '') { |
|
2553 | - $add_html = true; |
|
2554 | - $label = $fieldset_arr[$fieldset_count]['label']; |
|
2555 | - $htmlvar_name = $fieldset_arr[$fieldset_count]['htmlvar_name']; |
|
2556 | - $fieldset_html = $fieldset; |
|
2557 | - } |
|
2558 | - } |
|
2462 | + global $field_set_start; |
|
2559 | 2463 | |
2560 | - if ($add_html) { |
|
2561 | - $tabs_arr[$htmlvar_name] = array( |
|
2562 | - 'heading_text' => __($label, 'geodirectory'), |
|
2563 | - 'is_active_tab' => false, |
|
2564 | - /** |
|
2565 | - * Filter if a custom field should be displayed on the details page tab. |
|
2566 | - * |
|
2567 | - * @since 1.0.0 |
|
2568 | - * @param string $htmlvar_name The field HTML var name. |
|
2569 | - */ |
|
2570 | - 'is_display' => apply_filters('geodir_detail_page_tab_is_display', true, $htmlvar_name), |
|
2571 | - 'tab_content' => '<div class="geodir-company_info field-group xxx">' . $fieldset_html . '</div>' |
|
2572 | - ); |
|
2573 | - } |
|
2574 | - } else { |
|
2575 | - if ($html != '') { |
|
2576 | - $tabs_arr[$html_var] = array( |
|
2577 | - 'heading_text' => __($label, 'geodirectory'), |
|
2578 | - 'is_active_tab' => false, |
|
2579 | - /** This action is documented in geodirectory_hooks_actions.php */ |
|
2580 | - 'is_display' => apply_filters('geodir_detail_page_tab_is_display', true, $field['htmlvar_name']), |
|
2581 | - 'tab_content' => $html |
|
2582 | - ); |
|
2583 | - } |
|
2584 | - } |
|
2585 | - } |
|
2586 | - } |
|
2587 | - } |
|
2588 | - } |
|
2589 | - return $tabs_arr; |
|
2464 | + $post = stripslashes_deep($post); // strip slashes |
|
2465 | + |
|
2466 | + $field_set_start = 0; |
|
2467 | + $fieldset_count = 0; |
|
2468 | + $fieldset = ''; |
|
2469 | + $total_fields = count($custom_fields); |
|
2470 | + $count_field = 0; |
|
2471 | + $fieldset_arr = array(); |
|
2472 | + $i = 0; |
|
2473 | + $geodir_post_info = isset($post->ID) && !empty($post->ID) ? geodir_get_post_info($post->ID) : NULL; |
|
2474 | + |
|
2475 | + foreach ($custom_fields as $field) { |
|
2476 | + $count_field++; |
|
2477 | + $field_name = $field['htmlvar_name']; |
|
2478 | + if (empty($geodir_post_info) && geodir_is_page('preview') && $field_name != '' && !isset($post->{$field_name}) && isset($_REQUEST[$field_name])) { |
|
2479 | + $post->{$field_name} = $_REQUEST[$field_name]; |
|
2480 | + } |
|
2481 | + |
|
2482 | + if (isset($field['show_in']) && strpos($field['show_in'], '[owntab]') !== false && ((isset($post->{$field_name}) && $post->{$field_name} != '') || $field['type'] == 'fieldset' || $field['type'] == 'address') && in_array($field['type'], array('text', 'datepicker', 'textarea', 'time', 'phone', 'email', 'select', 'multiselect', 'url', 'html', 'fieldset', 'radio', 'checkbox', 'file','address','taxonomy'))) { |
|
2483 | + $label = $field['site_title'] != '' ? $field['site_title'] : $field['admin_title']; |
|
2484 | + $site_title = trim($field['site_title']); |
|
2485 | + $type = $field; |
|
2486 | + $variables_array = array(); |
|
2487 | + |
|
2488 | + if ($type['type'] == 'datepicker' && ($post->{$type['htmlvar_name']} == '' || $post->{$type['htmlvar_name']} == '0000-00-00')) { |
|
2489 | + continue; |
|
2490 | + } |
|
2491 | + |
|
2492 | + if ($type['type'] != 'fieldset') { |
|
2493 | + $i++; |
|
2494 | + $variables_array['post_id'] = $post->ID; |
|
2495 | + $variables_array['label'] = __($type['site_title'], 'geodirectory'); |
|
2496 | + $variables_array['value'] = isset($post->{$type['htmlvar_name']}) ? $post->{$type['htmlvar_name']} : ''; |
|
2497 | + |
|
2498 | + }else{ |
|
2499 | + $i = 0; |
|
2500 | + $fieldset_count++; |
|
2501 | + $field_set_start = 1; |
|
2502 | + $fieldset_arr[$fieldset_count]['htmlvar_name'] = 'gd_tab_' . $fieldset_count; |
|
2503 | + $fieldset_arr[$fieldset_count]['label'] = $label; |
|
2504 | + } |
|
2505 | + |
|
2506 | + |
|
2507 | + if(isset($type['extra_fields'])){$extra_fields= $type['extra_fields'];} |
|
2508 | + $type = stripslashes_deep($type); // strip slashes |
|
2509 | + if(isset($type['extra_fields'])){$type['extra_fields'] = $extra_fields;} |
|
2510 | + $html = ''; |
|
2511 | + $html_var = isset($type['htmlvar_name']) ? $type['htmlvar_name'] : ''; |
|
2512 | + if($html_var=='post'){$html_var='post_address';} |
|
2513 | + $field_icon = geodir_field_icon_proccess($type); |
|
2514 | + $filed_type = $type['type']; |
|
2515 | + |
|
2516 | + /** |
|
2517 | + * Filter the output for custom fields. |
|
2518 | + * |
|
2519 | + * Here we can remove or add new functions depending on the field type. |
|
2520 | + * |
|
2521 | + * @param string $html The html to be filtered (blank). |
|
2522 | + * @param string $fields_location The location the field is to be show. |
|
2523 | + * @param array $type The array of field values. |
|
2524 | + */ |
|
2525 | + $html = apply_filters("geodir_custom_field_output_{$filed_type}",$html,$fields_location,$type); |
|
2526 | + |
|
2527 | + |
|
2528 | + /** |
|
2529 | + * Filter custom field output in tab. |
|
2530 | + * |
|
2531 | + * @since 1.5.6 |
|
2532 | + * |
|
2533 | + * @param string $html_var The HTML variable name for the field. |
|
2534 | + * @param string $html Custom field unfiltered HTML. |
|
2535 | + * @param array $variables_array Custom field variables array. |
|
2536 | + */ |
|
2537 | + $html = apply_filters("geodir_tab_show_{$html_var}", $html, $variables_array); |
|
2538 | + |
|
2539 | + $fieldset_html = ''; |
|
2540 | + if ($field_set_start == 1) { |
|
2541 | + $add_html = false; |
|
2542 | + if ($type['type'] == 'fieldset' && $fieldset_count > 1) { |
|
2543 | + if ($fieldset != '') { |
|
2544 | + $add_html = true; |
|
2545 | + $label = $fieldset_arr[$fieldset_count - 1]['label']; |
|
2546 | + $htmlvar_name = $fieldset_arr[$fieldset_count - 1]['htmlvar_name']; |
|
2547 | + } |
|
2548 | + $fieldset_html = $fieldset; |
|
2549 | + $fieldset = ''; |
|
2550 | + } else { |
|
2551 | + $fieldset .= $html; |
|
2552 | + if ($total_fields == $count_field && $fieldset != '') { |
|
2553 | + $add_html = true; |
|
2554 | + $label = $fieldset_arr[$fieldset_count]['label']; |
|
2555 | + $htmlvar_name = $fieldset_arr[$fieldset_count]['htmlvar_name']; |
|
2556 | + $fieldset_html = $fieldset; |
|
2557 | + } |
|
2558 | + } |
|
2559 | + |
|
2560 | + if ($add_html) { |
|
2561 | + $tabs_arr[$htmlvar_name] = array( |
|
2562 | + 'heading_text' => __($label, 'geodirectory'), |
|
2563 | + 'is_active_tab' => false, |
|
2564 | + /** |
|
2565 | + * Filter if a custom field should be displayed on the details page tab. |
|
2566 | + * |
|
2567 | + * @since 1.0.0 |
|
2568 | + * @param string $htmlvar_name The field HTML var name. |
|
2569 | + */ |
|
2570 | + 'is_display' => apply_filters('geodir_detail_page_tab_is_display', true, $htmlvar_name), |
|
2571 | + 'tab_content' => '<div class="geodir-company_info field-group xxx">' . $fieldset_html . '</div>' |
|
2572 | + ); |
|
2573 | + } |
|
2574 | + } else { |
|
2575 | + if ($html != '') { |
|
2576 | + $tabs_arr[$html_var] = array( |
|
2577 | + 'heading_text' => __($label, 'geodirectory'), |
|
2578 | + 'is_active_tab' => false, |
|
2579 | + /** This action is documented in geodirectory_hooks_actions.php */ |
|
2580 | + 'is_display' => apply_filters('geodir_detail_page_tab_is_display', true, $field['htmlvar_name']), |
|
2581 | + 'tab_content' => $html |
|
2582 | + ); |
|
2583 | + } |
|
2584 | + } |
|
2585 | + } |
|
2586 | + } |
|
2587 | + } |
|
2588 | + } |
|
2589 | + return $tabs_arr; |
|
2590 | 2590 | } |
2591 | 2591 | |
2592 | 2592 | /* display add listing page for wpml */ |
@@ -2610,41 +2610,41 @@ discard block |
||
2610 | 2610 | */ |
2611 | 2611 | function geodir_add_post_status_author_page() |
2612 | 2612 | { |
2613 | - global $wpdb, $post; |
|
2614 | - |
|
2615 | - $html = ''; |
|
2616 | - if (get_current_user_id()) { |
|
2617 | - |
|
2618 | - $is_author_page = apply_filters('geodir_post_status_is_author_page', geodir_is_page('author')); |
|
2619 | - if ($is_author_page && !empty($post) && isset($post->post_author) && $post->post_author == get_current_user_id()) { |
|
2620 | - |
|
2621 | - // we need to query real status direct as we dynamically change the status for author on author page so even non author status can view them. |
|
2622 | - $real_status = $wpdb->get_var("SELECT post_status from $wpdb->posts WHERE ID=$post->ID"); |
|
2623 | - $status = "<strong>("; |
|
2624 | - $status_icon = '<i class="fa fa-play"></i>'; |
|
2625 | - if ($real_status == 'publish') { |
|
2626 | - $status .= __('Published', 'geodirectory'); |
|
2627 | - }elseif ($real_status == 'pending') { |
|
2628 | - $status .= __('Awaiting Review', 'geodirectory'); |
|
2629 | - } else { |
|
2630 | - $status .= __('Not published', 'geodirectory'); |
|
2631 | - $status_icon = '<i class="fa fa-pause"></i>'; |
|
2632 | - } |
|
2633 | - $status .= ")</strong>"; |
|
2613 | + global $wpdb, $post; |
|
2614 | + |
|
2615 | + $html = ''; |
|
2616 | + if (get_current_user_id()) { |
|
2617 | + |
|
2618 | + $is_author_page = apply_filters('geodir_post_status_is_author_page', geodir_is_page('author')); |
|
2619 | + if ($is_author_page && !empty($post) && isset($post->post_author) && $post->post_author == get_current_user_id()) { |
|
2620 | + |
|
2621 | + // we need to query real status direct as we dynamically change the status for author on author page so even non author status can view them. |
|
2622 | + $real_status = $wpdb->get_var("SELECT post_status from $wpdb->posts WHERE ID=$post->ID"); |
|
2623 | + $status = "<strong>("; |
|
2624 | + $status_icon = '<i class="fa fa-play"></i>'; |
|
2625 | + if ($real_status == 'publish') { |
|
2626 | + $status .= __('Published', 'geodirectory'); |
|
2627 | + }elseif ($real_status == 'pending') { |
|
2628 | + $status .= __('Awaiting Review', 'geodirectory'); |
|
2629 | + } else { |
|
2630 | + $status .= __('Not published', 'geodirectory'); |
|
2631 | + $status_icon = '<i class="fa fa-pause"></i>'; |
|
2632 | + } |
|
2633 | + $status .= ")</strong>"; |
|
2634 | 2634 | |
2635 | - $html = '<span class="geodir-post-status">' . $status_icon . ' <font class="geodir-status-label">' . __('Status: ', 'geodirectory') . '</font>' . $status . '</span>'; |
|
2636 | - } |
|
2637 | - } |
|
2635 | + $html = '<span class="geodir-post-status">' . $status_icon . ' <font class="geodir-status-label">' . __('Status: ', 'geodirectory') . '</font>' . $status . '</span>'; |
|
2636 | + } |
|
2637 | + } |
|
2638 | 2638 | |
2639 | - if ($html != '') { |
|
2640 | - /** |
|
2641 | - * Filter the post status text on the author page. |
|
2642 | - * |
|
2643 | - * @since 1.0.0 |
|
2644 | - * @param string $html The HTML of the status. |
|
2645 | - */ |
|
2646 | - echo apply_filters('geodir_filter_status_text_on_author_page', $html); |
|
2647 | - } |
|
2639 | + if ($html != '') { |
|
2640 | + /** |
|
2641 | + * Filter the post status text on the author page. |
|
2642 | + * |
|
2643 | + * @since 1.0.0 |
|
2644 | + * @param string $html The HTML of the status. |
|
2645 | + */ |
|
2646 | + echo apply_filters('geodir_filter_status_text_on_author_page', $html); |
|
2647 | + } |
|
2648 | 2648 | |
2649 | 2649 | |
2650 | 2650 | } |
@@ -2658,9 +2658,9 @@ discard block |
||
2658 | 2658 | * @package GeoDirectory |
2659 | 2659 | */ |
2660 | 2660 | function geodir_init_no_rating() { |
2661 | - if (geodir_rating_disabled_post_types()) { |
|
2662 | - add_filter('geodir_get_sort_options', 'geodir_no_rating_get_sort_options', 100, 2); |
|
2663 | - } |
|
2661 | + if (geodir_rating_disabled_post_types()) { |
|
2662 | + add_filter('geodir_get_sort_options', 'geodir_no_rating_get_sort_options', 100, 2); |
|
2663 | + } |
|
2664 | 2664 | } |
2665 | 2665 | |
2666 | 2666 | /** |
@@ -2674,22 +2674,22 @@ discard block |
||
2674 | 2674 | * @return array Modified sort options array. |
2675 | 2675 | */ |
2676 | 2676 | function geodir_no_rating_get_sort_options($options, $post_type = '') { |
2677 | - if (!empty($post_type) && geodir_cpt_has_rating_disabled($post_type)) { |
|
2678 | - $new_options = array(); |
|
2677 | + if (!empty($post_type) && geodir_cpt_has_rating_disabled($post_type)) { |
|
2678 | + $new_options = array(); |
|
2679 | 2679 | |
2680 | - if (!empty($options)) { |
|
2681 | - foreach ($options as $option) { |
|
2682 | - if (is_object($option) && isset($option->htmlvar_name) && $option->htmlvar_name == 'overall_rating') { |
|
2683 | - continue; |
|
2684 | - } |
|
2685 | - $new_options[] = $option; |
|
2686 | - } |
|
2680 | + if (!empty($options)) { |
|
2681 | + foreach ($options as $option) { |
|
2682 | + if (is_object($option) && isset($option->htmlvar_name) && $option->htmlvar_name == 'overall_rating') { |
|
2683 | + continue; |
|
2684 | + } |
|
2685 | + $new_options[] = $option; |
|
2686 | + } |
|
2687 | 2687 | |
2688 | - $options = $new_options; |
|
2689 | - } |
|
2690 | - } |
|
2688 | + $options = $new_options; |
|
2689 | + } |
|
2690 | + } |
|
2691 | 2691 | |
2692 | - return $options; |
|
2692 | + return $options; |
|
2693 | 2693 | } |
2694 | 2694 | |
2695 | 2695 | /** |
@@ -2701,9 +2701,9 @@ discard block |
||
2701 | 2701 | * @return array Modified class array. |
2702 | 2702 | */ |
2703 | 2703 | function geodir_body_class_active_map($classes = array()) { |
2704 | - $classes[] = 'gd-map-' . geodir_map_name(); |
|
2704 | + $classes[] = 'gd-map-' . geodir_map_name(); |
|
2705 | 2705 | |
2706 | - return $classes; |
|
2706 | + return $classes; |
|
2707 | 2707 | } |
2708 | 2708 | add_filter('body_class', 'geodir_body_class_active_map', 100); |
2709 | 2709 | |
@@ -2716,9 +2716,9 @@ discard block |
||
2716 | 2716 | * @return string Modified class string. |
2717 | 2717 | */ |
2718 | 2718 | function geodir_admin_body_class_active_map($class = '') { |
2719 | - $class .= ' gd-map-' . geodir_map_name(); |
|
2719 | + $class .= ' gd-map-' . geodir_map_name(); |
|
2720 | 2720 | |
2721 | - return $class; |
|
2721 | + return $class; |
|
2722 | 2722 | } |
2723 | 2723 | add_filter('admin_body_class', 'geodir_admin_body_class_active_map', 100); |
2724 | 2724 | |
@@ -2736,36 +2736,36 @@ discard block |
||
2736 | 2736 | * @return array Translation texts. |
2737 | 2737 | */ |
2738 | 2738 | function geodir_load_gd_options_text_translation($translation_texts = array()) { |
2739 | - $translation_texts = !empty( $translation_texts ) && is_array( $translation_texts ) ? $translation_texts : array(); |
|
2740 | - |
|
2741 | - $gd_options = array('geodir_post_submited_success_email_subject_admin', 'geodir_post_submited_success_email_content_admin', 'geodir_post_submited_success_email_subject', 'geodir_post_submited_success_email_content', 'geodir_forgot_password_subject', 'geodir_forgot_password_content', 'geodir_registration_success_email_subject', 'geodir_registration_success_email_content', 'geodir_post_published_email_subject', 'geodir_post_published_email_content', 'geodir_email_enquiry_subject', 'geodir_email_enquiry_content', 'geodir_post_added_success_msg_content', 'geodir_post_edited_email_subject_admin', 'geodir_post_edited_email_content_admin'); |
|
2742 | - |
|
2743 | - /** |
|
2744 | - * Filters the geodirectory option names that requires to add for translation. |
|
2745 | - * |
|
2746 | - * @since 1.5.7 |
|
2747 | - * @package GeoDirectory |
|
2748 | - * |
|
2749 | - * @param array $gd_options Array of option names. |
|
2750 | - */ |
|
2751 | - $gd_options = apply_filters('geodir_gd_options_for_translation', $gd_options); |
|
2752 | - $gd_options = array_unique($gd_options); |
|
2753 | - |
|
2754 | - if (!empty($gd_options)) { |
|
2755 | - foreach ($gd_options as $gd_option) { |
|
2756 | - if ($gd_option != '' && $option_value = get_option($gd_option)) { |
|
2757 | - $option_value = is_string($option_value) ? stripslashes_deep($option_value) : ''; |
|
2739 | + $translation_texts = !empty( $translation_texts ) && is_array( $translation_texts ) ? $translation_texts : array(); |
|
2740 | + |
|
2741 | + $gd_options = array('geodir_post_submited_success_email_subject_admin', 'geodir_post_submited_success_email_content_admin', 'geodir_post_submited_success_email_subject', 'geodir_post_submited_success_email_content', 'geodir_forgot_password_subject', 'geodir_forgot_password_content', 'geodir_registration_success_email_subject', 'geodir_registration_success_email_content', 'geodir_post_published_email_subject', 'geodir_post_published_email_content', 'geodir_email_enquiry_subject', 'geodir_email_enquiry_content', 'geodir_post_added_success_msg_content', 'geodir_post_edited_email_subject_admin', 'geodir_post_edited_email_content_admin'); |
|
2742 | + |
|
2743 | + /** |
|
2744 | + * Filters the geodirectory option names that requires to add for translation. |
|
2745 | + * |
|
2746 | + * @since 1.5.7 |
|
2747 | + * @package GeoDirectory |
|
2748 | + * |
|
2749 | + * @param array $gd_options Array of option names. |
|
2750 | + */ |
|
2751 | + $gd_options = apply_filters('geodir_gd_options_for_translation', $gd_options); |
|
2752 | + $gd_options = array_unique($gd_options); |
|
2753 | + |
|
2754 | + if (!empty($gd_options)) { |
|
2755 | + foreach ($gd_options as $gd_option) { |
|
2756 | + if ($gd_option != '' && $option_value = get_option($gd_option)) { |
|
2757 | + $option_value = is_string($option_value) ? stripslashes_deep($option_value) : ''; |
|
2758 | 2758 | |
2759 | - if ($option_value != '' && !in_array($option_value, $translation_texts)) { |
|
2760 | - $translation_texts[] = stripslashes_deep($option_value); |
|
2761 | - } |
|
2762 | - } |
|
2763 | - } |
|
2764 | - } |
|
2759 | + if ($option_value != '' && !in_array($option_value, $translation_texts)) { |
|
2760 | + $translation_texts[] = stripslashes_deep($option_value); |
|
2761 | + } |
|
2762 | + } |
|
2763 | + } |
|
2764 | + } |
|
2765 | 2765 | |
2766 | - $translation_texts = !empty($translation_texts) ? array_unique($translation_texts) : $translation_texts; |
|
2766 | + $translation_texts = !empty($translation_texts) ? array_unique($translation_texts) : $translation_texts; |
|
2767 | 2767 | |
2768 | - return $translation_texts; |
|
2768 | + return $translation_texts; |
|
2769 | 2769 | } |
2770 | 2770 | |
2771 | 2771 | add_filter('geodir_load_db_language', 'geodir_load_gd_options_text_translation'); |
@@ -2779,15 +2779,15 @@ discard block |
||
2779 | 2779 | |
2780 | 2780 | add_filter('get_comments_link', 'gd_get_comments_link', 10, 2); |
2781 | 2781 | function gd_get_comments_link($comments_link, $post_id) { |
2782 | - $post_type = get_post_type($post_id); |
|
2782 | + $post_type = get_post_type($post_id); |
|
2783 | 2783 | |
2784 | - $all_postypes = geodir_get_posttypes(); |
|
2785 | - if (in_array($post_type, $all_postypes)) { |
|
2786 | - $comments_link = str_replace('#comments', '#reviews', $comments_link); |
|
2787 | - $comments_link = str_replace('#respond', '#reviews', $comments_link); |
|
2788 | - } |
|
2784 | + $all_postypes = geodir_get_posttypes(); |
|
2785 | + if (in_array($post_type, $all_postypes)) { |
|
2786 | + $comments_link = str_replace('#comments', '#reviews', $comments_link); |
|
2787 | + $comments_link = str_replace('#respond', '#reviews', $comments_link); |
|
2788 | + } |
|
2789 | 2789 | |
2790 | - return $comments_link; |
|
2790 | + return $comments_link; |
|
2791 | 2791 | } |
2792 | 2792 | |
2793 | 2793 | |
@@ -2805,11 +2805,11 @@ discard block |
||
2805 | 2805 | function geodir_add_nav_menu_class( $args ) |
2806 | 2806 | { |
2807 | 2807 | |
2808 | - if(isset($args['menu_class'])){ |
|
2809 | - $args['menu_class'] = $args['menu_class']." gd-menu-z"; |
|
2810 | - } |
|
2808 | + if(isset($args['menu_class'])){ |
|
2809 | + $args['menu_class'] = $args['menu_class']." gd-menu-z"; |
|
2810 | + } |
|
2811 | 2811 | |
2812 | - return $args; |
|
2812 | + return $args; |
|
2813 | 2813 | } |
2814 | 2814 | |
2815 | 2815 | add_filter( 'wp_nav_menu_args', 'geodir_add_nav_menu_class' ); |
@@ -2826,15 +2826,15 @@ discard block |
||
2826 | 2826 | * @return string Filtered locale ID. |
2827 | 2827 | */ |
2828 | 2828 | function geodir_wpml_filter_locale($locale) { |
2829 | - global $sitepress; |
|
2829 | + global $sitepress; |
|
2830 | 2830 | |
2831 | - $post_type = !empty($_REQUEST['post_type']) ? $_REQUEST['post_type'] : (!empty($_REQUEST['post']) ? get_post_type($_REQUEST['post']) : ''); |
|
2831 | + $post_type = !empty($_REQUEST['post_type']) ? $_REQUEST['post_type'] : (!empty($_REQUEST['post']) ? get_post_type($_REQUEST['post']) : ''); |
|
2832 | 2832 | |
2833 | - if (!empty($sitepress) && $sitepress->is_post_edit_screen() && $post_type && in_array($post_type, geodir_get_posttypes()) && $current_lang = $sitepress->get_current_language()) { |
|
2834 | - $locale = $sitepress->get_locale($current_lang); |
|
2835 | - } |
|
2833 | + if (!empty($sitepress) && $sitepress->is_post_edit_screen() && $post_type && in_array($post_type, geodir_get_posttypes()) && $current_lang = $sitepress->get_current_language()) { |
|
2834 | + $locale = $sitepress->get_locale($current_lang); |
|
2835 | + } |
|
2836 | 2836 | |
2837 | - return $locale; |
|
2837 | + return $locale; |
|
2838 | 2838 | } |
2839 | 2839 | |
2840 | 2840 | /** |
@@ -2844,20 +2844,20 @@ discard block |
||
2844 | 2844 | * @package GeoDirectory |
2845 | 2845 | */ |
2846 | 2846 | function geodir_wpml_set_filter() { |
2847 | - if (geodir_is_wpml()) { |
|
2848 | - global $sitepress; |
|
2847 | + if (geodir_is_wpml()) { |
|
2848 | + global $sitepress; |
|
2849 | 2849 | |
2850 | - if ($sitepress->get_setting('sync_comments_on_duplicates')) { |
|
2851 | - add_action('comment_post', 'gepdir_wpml_sync_comment', 100, 1); |
|
2852 | - } |
|
2850 | + if ($sitepress->get_setting('sync_comments_on_duplicates')) { |
|
2851 | + add_action('comment_post', 'gepdir_wpml_sync_comment', 100, 1); |
|
2852 | + } |
|
2853 | 2853 | |
2854 | - add_action('geodir_after_save_listing', 'geodir_wpml_duplicate_listing', 100, 2); |
|
2855 | - add_action( 'geodir_edit_post_link_html', 'geodir_wpml_frontend_duplicate_listing', 0, 1 ); |
|
2854 | + add_action('geodir_after_save_listing', 'geodir_wpml_duplicate_listing', 100, 2); |
|
2855 | + add_action( 'geodir_edit_post_link_html', 'geodir_wpml_frontend_duplicate_listing', 0, 1 ); |
|
2856 | 2856 | add_action( 'geodir_after_search_form', 'geodir_wpml_add_language_input_field' ); |
2857 | - if (is_admin()) { |
|
2858 | - add_filter( 'geodir_design_settings', 'geodir_wpml_duplicate_settings', 10, 1 ); |
|
2859 | - } |
|
2860 | - } |
|
2857 | + if (is_admin()) { |
|
2858 | + add_filter( 'geodir_design_settings', 'geodir_wpml_duplicate_settings', 10, 1 ); |
|
2859 | + } |
|
2860 | + } |
|
2861 | 2861 | } |
2862 | 2862 | add_filter('plugins_loaded', 'geodir_wpml_set_filter'); |
2863 | 2863 | |
@@ -2870,38 +2870,38 @@ discard block |
||
2870 | 2870 | * @return array Filtered languages. |
2871 | 2871 | */ |
2872 | 2872 | function geodir_wpml_filter_ls_languages($languages) { |
2873 | - if (geodir_is_geodir_page()) { |
|
2874 | - $keep_vars = array(); |
|
2873 | + if (geodir_is_geodir_page()) { |
|
2874 | + $keep_vars = array(); |
|
2875 | 2875 | |
2876 | - if (geodir_is_page('add-listing')) { |
|
2877 | - $keep_vars = array('listing_type', 'package_id'); |
|
2878 | - } else if (geodir_is_page('search')) { |
|
2879 | - $keep_vars = array('geodir_search', 'stype', 'snear', 'set_location_type', 'set_location_val', 'sgeo_lat', 'sgeo_lon'); |
|
2880 | - } else if (geodir_is_page('author')) { |
|
2881 | - $keep_vars = array('geodir_dashbord', 'stype', 'list'); |
|
2882 | - } else if (geodir_is_page('login')) { |
|
2883 | - $keep_vars = array('forgot', 'signup'); |
|
2884 | - } |
|
2876 | + if (geodir_is_page('add-listing')) { |
|
2877 | + $keep_vars = array('listing_type', 'package_id'); |
|
2878 | + } else if (geodir_is_page('search')) { |
|
2879 | + $keep_vars = array('geodir_search', 'stype', 'snear', 'set_location_type', 'set_location_val', 'sgeo_lat', 'sgeo_lon'); |
|
2880 | + } else if (geodir_is_page('author')) { |
|
2881 | + $keep_vars = array('geodir_dashbord', 'stype', 'list'); |
|
2882 | + } else if (geodir_is_page('login')) { |
|
2883 | + $keep_vars = array('forgot', 'signup'); |
|
2884 | + } |
|
2885 | 2885 | |
2886 | - if (!empty($keep_vars)) { |
|
2887 | - foreach ( $languages as $code => $url) { |
|
2888 | - $filter_url = $url['url']; |
|
2886 | + if (!empty($keep_vars)) { |
|
2887 | + foreach ( $languages as $code => $url) { |
|
2888 | + $filter_url = $url['url']; |
|
2889 | 2889 | |
2890 | - foreach ($keep_vars as $var) { |
|
2891 | - if (isset($_GET[$var]) && !is_array($_GET[$var])) { |
|
2892 | - $filter_url = remove_query_arg(array($var), $filter_url); |
|
2893 | - $filter_url = add_query_arg(array($var => $_GET[$var]), $filter_url); |
|
2894 | - } |
|
2895 | - } |
|
2890 | + foreach ($keep_vars as $var) { |
|
2891 | + if (isset($_GET[$var]) && !is_array($_GET[$var])) { |
|
2892 | + $filter_url = remove_query_arg(array($var), $filter_url); |
|
2893 | + $filter_url = add_query_arg(array($var => $_GET[$var]), $filter_url); |
|
2894 | + } |
|
2895 | + } |
|
2896 | 2896 | |
2897 | - if ($filter_url != $url['url']) { |
|
2898 | - $languages[$code]['url'] = $filter_url; |
|
2899 | - } |
|
2900 | - } |
|
2901 | - } |
|
2902 | - } |
|
2897 | + if ($filter_url != $url['url']) { |
|
2898 | + $languages[$code]['url'] = $filter_url; |
|
2899 | + } |
|
2900 | + } |
|
2901 | + } |
|
2902 | + } |
|
2903 | 2903 | |
2904 | - return $languages; |
|
2904 | + return $languages; |
|
2905 | 2905 | } |
2906 | 2906 | add_filter( 'icl_ls_languages', 'geodir_wpml_filter_ls_languages', 11, 1 ); |
2907 | 2907 | |
@@ -2912,18 +2912,18 @@ discard block |
||
2912 | 2912 | * |
2913 | 2913 | */ |
2914 | 2914 | function geodir_remove_yoast_seo_metas(){ |
2915 | - if ( class_exists( 'WPSEO_Frontend' ) && geodir_is_geodir_page() && geodir_disable_yoast_seo_metas() ) { |
|
2916 | - $wpseo = WPSEO_Frontend::get_instance(); |
|
2915 | + if ( class_exists( 'WPSEO_Frontend' ) && geodir_is_geodir_page() && geodir_disable_yoast_seo_metas() ) { |
|
2916 | + $wpseo = WPSEO_Frontend::get_instance(); |
|
2917 | 2917 | |
2918 | - remove_action( 'wp_head', array( $wpseo, 'metadesc' ), 6 ); |
|
2919 | - remove_action( 'wp_head', array( $wpseo, 'metakeywords' ), 11 ); |
|
2920 | - remove_filter( 'pre_get_document_title', array( $wpseo, 'title' ), 15 ); |
|
2921 | - remove_filter( 'wp_title', array( $wpseo, 'title' ), 15, 3 ); |
|
2922 | - remove_filter( 'thematic_doctitle', array( $wpseo, 'title' ), 15 ); |
|
2923 | - remove_filter( 'woo_title', array( $wpseo, 'fix_woo_title' ), 99 ); |
|
2918 | + remove_action( 'wp_head', array( $wpseo, 'metadesc' ), 6 ); |
|
2919 | + remove_action( 'wp_head', array( $wpseo, 'metakeywords' ), 11 ); |
|
2920 | + remove_filter( 'pre_get_document_title', array( $wpseo, 'title' ), 15 ); |
|
2921 | + remove_filter( 'wp_title', array( $wpseo, 'title' ), 15, 3 ); |
|
2922 | + remove_filter( 'thematic_doctitle', array( $wpseo, 'title' ), 15 ); |
|
2923 | + remove_filter( 'woo_title', array( $wpseo, 'fix_woo_title' ), 99 ); |
|
2924 | 2924 | |
2925 | - remove_action( 'template_redirect', 'wpseo_frontend_head_init', 999 ); |
|
2926 | - } |
|
2925 | + remove_action( 'template_redirect', 'wpseo_frontend_head_init', 999 ); |
|
2926 | + } |
|
2927 | 2927 | } |
2928 | 2928 | |
2929 | 2929 | /** |
@@ -2937,20 +2937,20 @@ discard block |
||
2937 | 2937 | * |
2938 | 2938 | */ |
2939 | 2939 | function geodir_wpml_ajax_set_guest_lang() { |
2940 | - if ( geodir_is_wpml() && wpml_is_ajax() && !is_user_logged_in() ) { |
|
2941 | - if ( empty( $_GET['lang'] ) && !( !empty( $_SERVER['REQUEST_URI'] ) && preg_match( '@\.(css|js|png|jpg|gif|jpeg|bmp)@i', basename( preg_replace( '@\?.*$@', '', $_SERVER['REQUEST_URI'] ) ) ) ) ) { |
|
2942 | - global $sitepress; |
|
2940 | + if ( geodir_is_wpml() && wpml_is_ajax() && !is_user_logged_in() ) { |
|
2941 | + if ( empty( $_GET['lang'] ) && !( !empty( $_SERVER['REQUEST_URI'] ) && preg_match( '@\.(css|js|png|jpg|gif|jpeg|bmp)@i', basename( preg_replace( '@\?.*$@', '', $_SERVER['REQUEST_URI'] ) ) ) ) ) { |
|
2942 | + global $sitepress; |
|
2943 | 2943 | |
2944 | - $referer = wp_get_referer(); |
|
2944 | + $referer = wp_get_referer(); |
|
2945 | 2945 | |
2946 | - $current_lang = $sitepress->get_current_language(); |
|
2947 | - $referrer_lang = $sitepress->get_language_from_url( $referer ); |
|
2946 | + $current_lang = $sitepress->get_current_language(); |
|
2947 | + $referrer_lang = $sitepress->get_language_from_url( $referer ); |
|
2948 | 2948 | |
2949 | - if ( $referrer_lang && $current_lang != $referrer_lang ) { |
|
2950 | - $_GET['lang'] = $referrer_lang; |
|
2951 | - } |
|
2952 | - } |
|
2953 | - } |
|
2949 | + if ( $referrer_lang && $current_lang != $referrer_lang ) { |
|
2950 | + $_GET['lang'] = $referrer_lang; |
|
2951 | + } |
|
2952 | + } |
|
2953 | + } |
|
2954 | 2954 | } |
2955 | 2955 | add_action( 'plugins_loaded', 'geodir_wpml_ajax_set_guest_lang', -1 ); |
2956 | 2956 | |
@@ -2962,36 +2962,36 @@ discard block |
||
2962 | 2962 | * @param object $wp The WordPress object. |
2963 | 2963 | */ |
2964 | 2964 | function geodir_check_redirect($wp) { |
2965 | - if (is_404() || (!empty($wp->query_vars['error']) && $wp->query_vars['error'] == '404')) { |
|
2966 | - $current_url = geodir_curPageURL(); |
|
2967 | - $search = 'czech-republic'; |
|
2968 | - $replace = 'czechia'; |
|
2965 | + if (is_404() || (!empty($wp->query_vars['error']) && $wp->query_vars['error'] == '404')) { |
|
2966 | + $current_url = geodir_curPageURL(); |
|
2967 | + $search = 'czech-republic'; |
|
2968 | + $replace = 'czechia'; |
|
2969 | 2969 | |
2970 | - $has_slash = substr($current_url, -1); |
|
2971 | - if ($has_slash != "/") { |
|
2972 | - $current_url .= '/'; |
|
2973 | - } |
|
2970 | + $has_slash = substr($current_url, -1); |
|
2971 | + if ($has_slash != "/") { |
|
2972 | + $current_url .= '/'; |
|
2973 | + } |
|
2974 | 2974 | |
2975 | - $redirect = false; |
|
2976 | - if (strpos($current_url, '/' . $search . '/') !== false) { |
|
2977 | - $redirect = true; |
|
2978 | - $current_url = preg_replace('/\/' . $search . '\//', '/' . $replace . '/', $current_url, 1); |
|
2979 | - } |
|
2975 | + $redirect = false; |
|
2976 | + if (strpos($current_url, '/' . $search . '/') !== false) { |
|
2977 | + $redirect = true; |
|
2978 | + $current_url = preg_replace('/\/' . $search . '\//', '/' . $replace . '/', $current_url, 1); |
|
2979 | + } |
|
2980 | 2980 | |
2981 | - if ($has_slash != "/") { |
|
2982 | - $current_url = trim($current_url, '/'); |
|
2983 | - } |
|
2981 | + if ($has_slash != "/") { |
|
2982 | + $current_url = trim($current_url, '/'); |
|
2983 | + } |
|
2984 | 2984 | |
2985 | - if (strpos($current_url, 'gd_country=' . $search) !== false) { |
|
2986 | - $redirect = true; |
|
2987 | - $current_url = str_replace('gd_country=' . $search, 'gd_country=' . $replace, $current_url); |
|
2988 | - } |
|
2989 | - |
|
2990 | - if ($redirect) { |
|
2991 | - wp_redirect($current_url); |
|
2992 | - exit; |
|
2993 | - } |
|
2994 | - } |
|
2985 | + if (strpos($current_url, 'gd_country=' . $search) !== false) { |
|
2986 | + $redirect = true; |
|
2987 | + $current_url = str_replace('gd_country=' . $search, 'gd_country=' . $replace, $current_url); |
|
2988 | + } |
|
2989 | + |
|
2990 | + if ($redirect) { |
|
2991 | + wp_redirect($current_url); |
|
2992 | + exit; |
|
2993 | + } |
|
2994 | + } |
|
2995 | 2995 | } |
2996 | 2996 | add_action('parse_request', 'geodir_check_redirect', 101, 1); |
2997 | 2997 | |
@@ -3011,50 +3011,50 @@ discard block |
||
3011 | 3011 | * @param string $original_slug The original post slug. |
3012 | 3012 | */ |
3013 | 3013 | function geodir_check_post_to_term_slug( $slug, $post_ID, $post_status, $post_type, $post_parent, $original_slug ) { |
3014 | - global $wpdb, $sitepress; |
|
3014 | + global $wpdb, $sitepress; |
|
3015 | 3015 | |
3016 | - if ( $post_type && strpos( $post_type, 'gd_' ) === 0 ) { |
|
3017 | - $wpml_post_join = ""; |
|
3018 | - $wpml_post_where = ""; |
|
3019 | - $wpml_term_join = ""; |
|
3020 | - $wpml_term_where = ""; |
|
3016 | + if ( $post_type && strpos( $post_type, 'gd_' ) === 0 ) { |
|
3017 | + $wpml_post_join = ""; |
|
3018 | + $wpml_post_where = ""; |
|
3019 | + $wpml_term_join = ""; |
|
3020 | + $wpml_term_where = ""; |
|
3021 | 3021 | |
3022 | - if (geodir_wpml_is_post_type_translated($post_type)) { |
|
3023 | - $post_language = $post_ID ? $sitepress->post_translations()->get_element_lang_code($post_ID) : $sitepress->get_current_language(); |
|
3024 | - $post_language = $post_language ? $post_language : $sitepress->post_translations()->get_save_post_lang($post_ID, $sitepress); |
|
3025 | - if (!$post_language) { |
|
3026 | - $post_language = $sitepress->get_current_language(); |
|
3027 | - } |
|
3022 | + if (geodir_wpml_is_post_type_translated($post_type)) { |
|
3023 | + $post_language = $post_ID ? $sitepress->post_translations()->get_element_lang_code($post_ID) : $sitepress->get_current_language(); |
|
3024 | + $post_language = $post_language ? $post_language : $sitepress->post_translations()->get_save_post_lang($post_ID, $sitepress); |
|
3025 | + if (!$post_language) { |
|
3026 | + $post_language = $sitepress->get_current_language(); |
|
3027 | + } |
|
3028 | 3028 | |
3029 | - $wpml_post_join = " JOIN {$wpdb->prefix}icl_translations AS icl_t ON p.ID = icl_t.element_id AND icl_t.element_type = CONCAT('post_', p.post_type)"; |
|
3030 | - $wpml_post_where = " AND icl_t.language_code = '" . $post_language ."'"; |
|
3029 | + $wpml_post_join = " JOIN {$wpdb->prefix}icl_translations AS icl_t ON p.ID = icl_t.element_id AND icl_t.element_type = CONCAT('post_', p.post_type)"; |
|
3030 | + $wpml_post_where = " AND icl_t.language_code = '" . $post_language ."'"; |
|
3031 | 3031 | |
3032 | - $wpml_term_join = " JOIN {$wpdb->prefix}icl_translations AS icl_t ON icl_t.element_id = tt.term_taxonomy_id AND icl_t.element_type = CONCAT('tax_', tt.taxonomy)"; |
|
3033 | - $wpml_term_where = " AND icl_t.language_code = '" . $post_language ."'"; |
|
3034 | - } |
|
3032 | + $wpml_term_join = " JOIN {$wpdb->prefix}icl_translations AS icl_t ON icl_t.element_id = tt.term_taxonomy_id AND icl_t.element_type = CONCAT('tax_', tt.taxonomy)"; |
|
3033 | + $wpml_term_where = " AND icl_t.language_code = '" . $post_language ."'"; |
|
3034 | + } |
|
3035 | 3035 | |
3036 | - $term_slug_check = $wpdb->get_var( $wpdb->prepare( "SELECT t.slug FROM $wpdb->terms AS t LEFT JOIN $wpdb->term_taxonomy AS tt ON tt.term_id = t.term_id {$wpml_term_join} WHERE t.slug = '%s' AND ( tt.taxonomy = '" . $post_type . "category' OR tt.taxonomy = '" . $post_type . "_tags' ) {$wpml_term_where} LIMIT 1", $slug ) ); |
|
3036 | + $term_slug_check = $wpdb->get_var( $wpdb->prepare( "SELECT t.slug FROM $wpdb->terms AS t LEFT JOIN $wpdb->term_taxonomy AS tt ON tt.term_id = t.term_id {$wpml_term_join} WHERE t.slug = '%s' AND ( tt.taxonomy = '" . $post_type . "category' OR tt.taxonomy = '" . $post_type . "_tags' ) {$wpml_term_where} LIMIT 1", $slug ) ); |
|
3037 | 3037 | |
3038 | - if ( $term_slug_check ) { |
|
3039 | - $suffix = 1; |
|
3038 | + if ( $term_slug_check ) { |
|
3039 | + $suffix = 1; |
|
3040 | 3040 | |
3041 | - do { |
|
3042 | - $alt_slug = _truncate_post_slug( $original_slug, 200 - ( strlen( $suffix ) + 1 ) ) . "-$suffix"; |
|
3041 | + do { |
|
3042 | + $alt_slug = _truncate_post_slug( $original_slug, 200 - ( strlen( $suffix ) + 1 ) ) . "-$suffix"; |
|
3043 | 3043 | |
3044 | - $term_check = $wpdb->get_var( $wpdb->prepare( "SELECT t.slug FROM $wpdb->terms AS t LEFT JOIN $wpdb->term_taxonomy AS tt ON tt.term_id = t.term_id {$wpml_term_join} WHERE t.slug = '%s' AND ( tt.taxonomy = '" . $post_type . "category' OR tt.taxonomy = '" . $post_type . "_tags' ) {$wpml_term_where} LIMIT 1", $alt_slug ) ); |
|
3044 | + $term_check = $wpdb->get_var( $wpdb->prepare( "SELECT t.slug FROM $wpdb->terms AS t LEFT JOIN $wpdb->term_taxonomy AS tt ON tt.term_id = t.term_id {$wpml_term_join} WHERE t.slug = '%s' AND ( tt.taxonomy = '" . $post_type . "category' OR tt.taxonomy = '" . $post_type . "_tags' ) {$wpml_term_where} LIMIT 1", $alt_slug ) ); |
|
3045 | 3045 | |
3046 | - $post_check = !$term_check && $wpdb->get_var( $wpdb->prepare( "SELECT p.post_name FROM $wpdb->posts p {$wpml_post_join} WHERE p.post_name = %s AND p.post_type = %s AND p.ID != %d {$wpml_term_where} LIMIT 1", $alt_slug, $post_type, $post_ID ) ); |
|
3046 | + $post_check = !$term_check && $wpdb->get_var( $wpdb->prepare( "SELECT p.post_name FROM $wpdb->posts p {$wpml_post_join} WHERE p.post_name = %s AND p.post_type = %s AND p.ID != %d {$wpml_term_where} LIMIT 1", $alt_slug, $post_type, $post_ID ) ); |
|
3047 | 3047 | |
3048 | - $term_slug_check = $term_check || $post_check; |
|
3048 | + $term_slug_check = $term_check || $post_check; |
|
3049 | 3049 | |
3050 | - $suffix++; |
|
3051 | - } while ( $term_slug_check ); |
|
3050 | + $suffix++; |
|
3051 | + } while ( $term_slug_check ); |
|
3052 | 3052 | |
3053 | - $slug = $alt_slug; |
|
3054 | - } |
|
3055 | - } |
|
3053 | + $slug = $alt_slug; |
|
3054 | + } |
|
3055 | + } |
|
3056 | 3056 | |
3057 | - return $slug; |
|
3057 | + return $slug; |
|
3058 | 3058 | } |
3059 | 3059 | add_filter( 'wp_unique_post_slug', 'geodir_check_post_to_term_slug', 101, 6 ); |
3060 | 3060 | |
@@ -3074,48 +3074,48 @@ discard block |
||
3074 | 3074 | * @return bool true when exists. false when not exists. |
3075 | 3075 | */ |
3076 | 3076 | function geodir_check_term_to_post_slug( $slug_exists, $slug, $term_id ) { |
3077 | - global $wpdb, $gd_term_post_type, $gd_term_taxonomy, $sitepress; |
|
3077 | + global $wpdb, $gd_term_post_type, $gd_term_taxonomy, $sitepress; |
|
3078 | 3078 | |
3079 | - if ( $slug_exists ) { |
|
3080 | - return $slug_exists; |
|
3081 | - } |
|
3079 | + if ( $slug_exists ) { |
|
3080 | + return $slug_exists; |
|
3081 | + } |
|
3082 | 3082 | |
3083 | - if ( !empty( $gd_term_taxonomy ) && isset($gd_term_taxonomy[$term_id]) ) { |
|
3084 | - $taxonomy = $gd_term_taxonomy[$term_id]; |
|
3085 | - } else { |
|
3086 | - $taxonomy = $wpdb->get_var( $wpdb->prepare( "SELECT taxonomy FROM $wpdb->term_taxonomy WHERE term_id = %d LIMIT 1", $term_id ) ); |
|
3087 | - $gd_term_taxonomy[$term_id] = $taxonomy; |
|
3088 | - } |
|
3083 | + if ( !empty( $gd_term_taxonomy ) && isset($gd_term_taxonomy[$term_id]) ) { |
|
3084 | + $taxonomy = $gd_term_taxonomy[$term_id]; |
|
3085 | + } else { |
|
3086 | + $taxonomy = $wpdb->get_var( $wpdb->prepare( "SELECT taxonomy FROM $wpdb->term_taxonomy WHERE term_id = %d LIMIT 1", $term_id ) ); |
|
3087 | + $gd_term_taxonomy[$term_id] = $taxonomy; |
|
3088 | + } |
|
3089 | 3089 | |
3090 | - if ( empty($taxonomy) ) { |
|
3091 | - return $slug_exists; |
|
3092 | - } |
|
3090 | + if ( empty($taxonomy) ) { |
|
3091 | + return $slug_exists; |
|
3092 | + } |
|
3093 | 3093 | |
3094 | - if ( !empty( $gd_term_post_type ) && $gd_term_post_type[$term_id] ) { |
|
3095 | - $post_type = $gd_term_post_type[$term_id]; |
|
3096 | - } else { |
|
3097 | - $taxonomy_obj = get_taxonomy( $taxonomy ); |
|
3098 | - $post_type = !empty( $taxonomy_obj->object_type ) ? $taxonomy_obj->object_type[0] : NULL; |
|
3099 | - } |
|
3094 | + if ( !empty( $gd_term_post_type ) && $gd_term_post_type[$term_id] ) { |
|
3095 | + $post_type = $gd_term_post_type[$term_id]; |
|
3096 | + } else { |
|
3097 | + $taxonomy_obj = get_taxonomy( $taxonomy ); |
|
3098 | + $post_type = !empty( $taxonomy_obj->object_type ) ? $taxonomy_obj->object_type[0] : NULL; |
|
3099 | + } |
|
3100 | 3100 | |
3101 | - $wpml_post_join = ""; |
|
3102 | - $wpml_post_where = ""; |
|
3101 | + $wpml_post_join = ""; |
|
3102 | + $wpml_post_where = ""; |
|
3103 | 3103 | |
3104 | - if (geodir_wpml_is_taxonomy_translated($taxonomy) || geodir_wpml_is_post_type_translated($post_type)) { |
|
3105 | - $term_language = $term_id ? geodir_get_language_for_element($term_id, 'tax_' . $taxonomy) : $sitepress->get_current_language(); |
|
3106 | - if (!$term_language) { |
|
3107 | - $term_language = $sitepress->get_current_language(); |
|
3108 | - } |
|
3104 | + if (geodir_wpml_is_taxonomy_translated($taxonomy) || geodir_wpml_is_post_type_translated($post_type)) { |
|
3105 | + $term_language = $term_id ? geodir_get_language_for_element($term_id, 'tax_' . $taxonomy) : $sitepress->get_current_language(); |
|
3106 | + if (!$term_language) { |
|
3107 | + $term_language = $sitepress->get_current_language(); |
|
3108 | + } |
|
3109 | 3109 | |
3110 | - $wpml_post_join = " JOIN {$wpdb->prefix}icl_translations AS icl_t ON p.ID = icl_t.element_id AND icl_t.element_type = CONCAT('post_', p.post_type)"; |
|
3111 | - $wpml_post_where = " AND icl_t.language_code = '" . $term_language ."'"; |
|
3112 | - } |
|
3110 | + $wpml_post_join = " JOIN {$wpdb->prefix}icl_translations AS icl_t ON p.ID = icl_t.element_id AND icl_t.element_type = CONCAT('post_', p.post_type)"; |
|
3111 | + $wpml_post_where = " AND icl_t.language_code = '" . $term_language ."'"; |
|
3112 | + } |
|
3113 | 3113 | |
3114 | - if ( $post_type && $wpdb->get_var( $wpdb->prepare( "SELECT p.post_name FROM $wpdb->posts p {$wpml_post_join} WHERE p.post_name = %s AND p.post_type = %s {$wpml_post_where} LIMIT 1", $slug, $post_type ) ) ) { |
|
3115 | - $slug_exists = true; |
|
3116 | - } |
|
3114 | + if ( $post_type && $wpdb->get_var( $wpdb->prepare( "SELECT p.post_name FROM $wpdb->posts p {$wpml_post_join} WHERE p.post_name = %s AND p.post_type = %s {$wpml_post_where} LIMIT 1", $slug, $post_type ) ) ) { |
|
3115 | + $slug_exists = true; |
|
3116 | + } |
|
3117 | 3117 | |
3118 | - return $slug_exists; |
|
3118 | + return $slug_exists; |
|
3119 | 3119 | } |
3120 | 3120 | add_filter( 'geodir_term_slug_is_exists', 'geodir_check_term_to_post_slug', 10, 3 ); |
3121 | 3121 |
@@ -136,7 +136,7 @@ discard block |
||
136 | 136 | /* ON TEMPLATE INCLUDE */ |
137 | 137 | ///////////////////////// |
138 | 138 | |
139 | -add_filter('template_include', 'geodir_template_loader',9); |
|
139 | +add_filter('template_include', 'geodir_template_loader', 9); |
|
140 | 140 | |
141 | 141 | ///////////////////////// |
142 | 142 | /* CATEGORY / TAXONOMY / CUSTOM POST ACTIONS */ |
@@ -176,9 +176,9 @@ discard block |
||
176 | 176 | /* WP REVIEW COUNT ACTIONS */ |
177 | 177 | //////////////////////// |
178 | 178 | |
179 | -add_action('geodir_update_postrating', 'geodir_term_review_count_force_update_single_post', 100,1); |
|
179 | +add_action('geodir_update_postrating', 'geodir_term_review_count_force_update_single_post', 100, 1); |
|
180 | 180 | //add_action('geodir_update_postrating', 'geodir_term_review_count_force_update', 100); |
181 | -add_action('transition_post_status', 'geodir_term_review_count_force_update', 100,3); |
|
181 | +add_action('transition_post_status', 'geodir_term_review_count_force_update', 100, 3); |
|
182 | 182 | //add_action('created_term', 'geodir_term_review_count_force_update', 100); |
183 | 183 | add_action('edited_term', 'geodir_term_review_count_force_update', 100); |
184 | 184 | add_action('delete_term', 'geodir_term_review_count_force_update', 100); |
@@ -223,7 +223,7 @@ discard block |
||
223 | 223 | */ |
224 | 224 | function geodir_unset_prev_theme_nav_location($newname) |
225 | 225 | { |
226 | - $geodir_theme_location = get_option('geodir_theme_location_nav_' . $newname); |
|
226 | + $geodir_theme_location = get_option('geodir_theme_location_nav_'.$newname); |
|
227 | 227 | if ($geodir_theme_location) { |
228 | 228 | update_option('geodir_theme_location_nav', $geodir_theme_location); |
229 | 229 | } else { |
@@ -258,13 +258,13 @@ discard block |
||
258 | 258 | include_once('geodirectory-functions/listing_filters.php'); |
259 | 259 | |
260 | 260 | // Theme My Login compatibility fix |
261 | - if ( isset( $_REQUEST['geodir_search'] ) && class_exists( 'Theme_My_Login' ) ) { |
|
262 | - remove_action( 'pre_get_posts', array( Theme_My_Login::get_object(), 'pre_get_posts' ) ); |
|
261 | + if (isset($_REQUEST['geodir_search']) && class_exists('Theme_My_Login')) { |
|
262 | + remove_action('pre_get_posts', array(Theme_My_Login::get_object(), 'pre_get_posts')); |
|
263 | 263 | } |
264 | 264 | |
265 | - if ( isset( $_REQUEST['geodir_search'] ) ) { |
|
266 | - add_filter( 'geodir_filter_widget_listings_fields', 'geodir_search_widget_location_filter_fields', 100, 3 ); |
|
267 | - add_filter( 'geodir_filter_widget_listings_orderby', 'geodir_search_widget_location_filter_orderby', 100, 3 ); |
|
265 | + if (isset($_REQUEST['geodir_search'])) { |
|
266 | + add_filter('geodir_filter_widget_listings_fields', 'geodir_search_widget_location_filter_fields', 100, 3); |
|
267 | + add_filter('geodir_filter_widget_listings_orderby', 'geodir_search_widget_location_filter_orderby', 100, 3); |
|
268 | 268 | } |
269 | 269 | } |
270 | 270 | |
@@ -331,8 +331,8 @@ discard block |
||
331 | 331 | |
332 | 332 | /////// GEO DIRECOTORY CUSTOM HOOKS /// |
333 | 333 | |
334 | -add_action('geodir_before_tab_content', 'geodir_before_tab_content');// this function is in custom_functions.php and it is used to wrap detail page tab content |
|
335 | -add_action('geodir_after_tab_content', 'geodir_after_tab_content');// this function is in custom_functions.php and it is used to wrap detail page tab content |
|
334 | +add_action('geodir_before_tab_content', 'geodir_before_tab_content'); // this function is in custom_functions.php and it is used to wrap detail page tab content |
|
335 | +add_action('geodir_after_tab_content', 'geodir_after_tab_content'); // this function is in custom_functions.php and it is used to wrap detail page tab content |
|
336 | 336 | |
337 | 337 | // Detail page sidebar content |
338 | 338 | add_action('geodir_detail_page_sidebar', 'geodir_detail_page_sidebar_content_sorting', 1); |
@@ -432,8 +432,8 @@ discard block |
||
432 | 432 | do_action('geodir_after_social_sharing_buttons'); |
433 | 433 | $content_html = ob_get_clean(); |
434 | 434 | if (trim($content_html) != '') |
435 | - $content_html = '<div class="geodir-company_info geodir-details-sidebar-social-sharing">' . $content_html . '</div>'; |
|
436 | - if ((int)get_option('geodir_disable_tfg_buttons_section') != 1) { |
|
435 | + $content_html = '<div class="geodir-company_info geodir-details-sidebar-social-sharing">'.$content_html.'</div>'; |
|
436 | + if ((int) get_option('geodir_disable_tfg_buttons_section') != 1) { |
|
437 | 437 | /** |
438 | 438 | * Filter the geodir_social_sharing_buttons() function content. |
439 | 439 | * |
@@ -473,12 +473,12 @@ discard block |
||
473 | 473 | $post_id = $post->ID; |
474 | 474 | |
475 | 475 | if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') { |
476 | - $post_id = (int)$_REQUEST['pid']; |
|
476 | + $post_id = (int) $_REQUEST['pid']; |
|
477 | 477 | } |
478 | 478 | |
479 | 479 | $postlink = get_permalink(geodir_add_listing_page_id()); |
480 | 480 | $editlink = geodir_getlink($postlink, array('pid' => $post_id), false); |
481 | - echo ' <p class="edit_link"><i class="fa fa-pencil"></i> <a href="' . esc_url($editlink) . '">' . __('Edit this Post', 'geodirectory') . '</a></p>'; |
|
481 | + echo ' <p class="edit_link"><i class="fa fa-pencil"></i> <a href="'.esc_url($editlink).'">'.__('Edit this Post', 'geodirectory').'</a></p>'; |
|
482 | 482 | } |
483 | 483 | }// end of if, if its a preview or not |
484 | 484 | /** |
@@ -489,8 +489,8 @@ discard block |
||
489 | 489 | do_action('geodir_after_edit_post_link'); |
490 | 490 | $content_html = ob_get_clean(); |
491 | 491 | if (trim($content_html) != '') |
492 | - $content_html = '<div class="geodir-company_info geodir-details-sidebar-user-links">' . $content_html . '</div>'; |
|
493 | - if ((int)get_option('geodir_disable_user_links_section') != 1) { |
|
492 | + $content_html = '<div class="geodir-company_info geodir-details-sidebar-user-links">'.$content_html.'</div>'; |
|
493 | + if ((int) get_option('geodir_disable_user_links_section') != 1) { |
|
494 | 494 | /** |
495 | 495 | * Filter the geodir_edit_post_link() function content. |
496 | 496 | * |
@@ -511,11 +511,11 @@ discard block |
||
511 | 511 | */ |
512 | 512 | function geodir_detail_page_google_analytics() |
513 | 513 | { |
514 | - if ( ! get_option( 'geodir_ga_stats' ) ) { |
|
514 | + if (!get_option('geodir_ga_stats')) { |
|
515 | 515 | return; |
516 | 516 | } |
517 | - global $post,$preview; |
|
518 | - if($preview){return '';} |
|
517 | + global $post, $preview; |
|
518 | + if ($preview) {return ''; } |
|
519 | 519 | $package_info = array(); |
520 | 520 | $package_info = geodir_post_package_info($package_info, $post); |
521 | 521 | |
@@ -547,14 +547,14 @@ discard block |
||
547 | 547 | $hide_refresh = get_option('geodir_ga_auto_refresh'); |
548 | 548 | |
549 | 549 | $auto_refresh = $hide_refresh && $refresh_time && $refresh_time > 0 ? 1 : 0; |
550 | - if (is_user_logged_in() && (isset($package_info->google_analytics) && $package_info->google_analytics == '1') && (get_current_user_id()==$post->post_author || current_user_can( 'manage_options' )) ) { |
|
550 | + if (is_user_logged_in() && (isset($package_info->google_analytics) && $package_info->google_analytics == '1') && (get_current_user_id() == $post->post_author || current_user_can('manage_options'))) { |
|
551 | 551 | $page_url = urlencode($_SERVER['REQUEST_URI']); |
552 | 552 | ?> |
553 | 553 | <script type="text/javascript"> |
554 | 554 | var gd_gaTimeOut; |
555 | - var gd_gaTime = parseInt('<?php echo $refresh_time;?>'); |
|
556 | - var gd_gaHideRefresh = <?php echo (int)$hide_refresh;?>; |
|
557 | - var gd_gaAutoRefresh = <?php echo $auto_refresh;?>; |
|
555 | + var gd_gaTime = parseInt('<?php echo $refresh_time; ?>'); |
|
556 | + var gd_gaHideRefresh = <?php echo (int) $hide_refresh; ?>; |
|
557 | + var gd_gaAutoRefresh = <?php echo $auto_refresh; ?>; |
|
558 | 558 | ga_data1 = false; |
559 | 559 | ga_data2 = false; |
560 | 560 | ga_data3 = false; |
@@ -695,7 +695,7 @@ discard block |
||
695 | 695 | } |
696 | 696 | |
697 | 697 | function gdga_noResults() { |
698 | - jQuery('#gdga-chart-container').html('<?php _e('No results available','geodirectory');?>'); |
|
698 | + jQuery('#gdga-chart-container').html('<?php _e('No results available', 'geodirectory'); ?>'); |
|
699 | 699 | jQuery('#gdga-legend-container').html(''); |
700 | 700 | } |
701 | 701 | |
@@ -727,18 +727,18 @@ discard block |
||
727 | 727 | var data2 = results[1].rows.map(function(row) { return +row[2]; }); |
728 | 728 | //var labelsN = results[0].rows.map(function(row) { return +row[1]; }); |
729 | 729 | |
730 | - var labels = ['<?php _e('Jan', 'geodirectory');?>', |
|
731 | - '<?php _e('Feb', 'geodirectory');?>', |
|
732 | - '<?php _e('Mar', 'geodirectory');?>', |
|
733 | - '<?php _e('Apr', 'geodirectory');?>', |
|
734 | - '<?php _e('May', 'geodirectory');?>', |
|
735 | - '<?php _e('Jun', 'geodirectory');?>', |
|
736 | - '<?php _e('Jul', 'geodirectory');?>', |
|
737 | - '<?php _e('Aug', 'geodirectory');?>', |
|
738 | - '<?php _e('Sep', 'geodirectory');?>', |
|
739 | - '<?php _e('Oct', 'geodirectory');?>', |
|
740 | - '<?php _e('Nov', 'geodirectory');?>', |
|
741 | - '<?php _e('Dec', 'geodirectory');?>']; |
|
730 | + var labels = ['<?php _e('Jan', 'geodirectory'); ?>', |
|
731 | + '<?php _e('Feb', 'geodirectory'); ?>', |
|
732 | + '<?php _e('Mar', 'geodirectory'); ?>', |
|
733 | + '<?php _e('Apr', 'geodirectory'); ?>', |
|
734 | + '<?php _e('May', 'geodirectory'); ?>', |
|
735 | + '<?php _e('Jun', 'geodirectory'); ?>', |
|
736 | + '<?php _e('Jul', 'geodirectory'); ?>', |
|
737 | + '<?php _e('Aug', 'geodirectory'); ?>', |
|
738 | + '<?php _e('Sep', 'geodirectory'); ?>', |
|
739 | + '<?php _e('Oct', 'geodirectory'); ?>', |
|
740 | + '<?php _e('Nov', 'geodirectory'); ?>', |
|
741 | + '<?php _e('Dec', 'geodirectory'); ?>']; |
|
742 | 742 | |
743 | 743 | // Ensure the data arrays are at least as long as the labels array. |
744 | 744 | // Chart.js bar charts don't (yet) accept sparse datasets. |
@@ -751,13 +751,13 @@ discard block |
||
751 | 751 | labels : labels, |
752 | 752 | datasets : [ |
753 | 753 | { |
754 | - label: '<?php _e('Last Year', 'geodirectory');?>', |
|
754 | + label: '<?php _e('Last Year', 'geodirectory'); ?>', |
|
755 | 755 | fillColor : "rgba(220,220,220,0.5)", |
756 | 756 | strokeColor : "rgba(220,220,220,1)", |
757 | 757 | data : data2 |
758 | 758 | }, |
759 | 759 | { |
760 | - label: '<?php _e('This Year', 'geodirectory');?>', |
|
760 | + label: '<?php _e('This Year', 'geodirectory'); ?>', |
|
761 | 761 | fillColor : "rgba(151,187,205,0.5)", |
762 | 762 | strokeColor : "rgba(151,187,205,1)", |
763 | 763 | data : data1 |
@@ -802,30 +802,30 @@ discard block |
||
802 | 802 | |
803 | 803 | <?php |
804 | 804 | // Here we list the shorthand days of the week so it can be used in translation. |
805 | - __("Mon",'geodirectory'); |
|
806 | - __("Tue",'geodirectory'); |
|
807 | - __("Wed",'geodirectory'); |
|
808 | - __("Thu",'geodirectory'); |
|
809 | - __("Fri",'geodirectory'); |
|
810 | - __("Sat",'geodirectory'); |
|
811 | - __("Sun",'geodirectory'); |
|
805 | + __("Mon", 'geodirectory'); |
|
806 | + __("Tue", 'geodirectory'); |
|
807 | + __("Wed", 'geodirectory'); |
|
808 | + __("Thu", 'geodirectory'); |
|
809 | + __("Fri", 'geodirectory'); |
|
810 | + __("Sat", 'geodirectory'); |
|
811 | + __("Sun", 'geodirectory'); |
|
812 | 812 | ?> |
813 | 813 | |
814 | 814 | labels = [ |
815 | - "<?php _e(date('D', strtotime("+1 day")),'geodirectory'); ?>", |
|
816 | - "<?php _e(date('D', strtotime("+2 day")),'geodirectory'); ?>", |
|
817 | - "<?php _e(date('D', strtotime("+3 day")),'geodirectory'); ?>", |
|
818 | - "<?php _e(date('D', strtotime("+4 day")),'geodirectory'); ?>", |
|
819 | - "<?php _e(date('D', strtotime("+5 day")),'geodirectory'); ?>", |
|
820 | - "<?php _e(date('D', strtotime("+6 day")),'geodirectory'); ?>", |
|
821 | - "<?php _e(date('D', strtotime("+7 day")),'geodirectory'); ?>" |
|
815 | + "<?php _e(date('D', strtotime("+1 day")), 'geodirectory'); ?>", |
|
816 | + "<?php _e(date('D', strtotime("+2 day")), 'geodirectory'); ?>", |
|
817 | + "<?php _e(date('D', strtotime("+3 day")), 'geodirectory'); ?>", |
|
818 | + "<?php _e(date('D', strtotime("+4 day")), 'geodirectory'); ?>", |
|
819 | + "<?php _e(date('D', strtotime("+5 day")), 'geodirectory'); ?>", |
|
820 | + "<?php _e(date('D', strtotime("+6 day")), 'geodirectory'); ?>", |
|
821 | + "<?php _e(date('D', strtotime("+7 day")), 'geodirectory'); ?>" |
|
822 | 822 | ]; |
823 | 823 | |
824 | 824 | var data = { |
825 | 825 | labels : labels, |
826 | 826 | datasets : [ |
827 | 827 | { |
828 | - label: '<?php _e('Last Week', 'geodirectory');?>', |
|
828 | + label: '<?php _e('Last Week', 'geodirectory'); ?>', |
|
829 | 829 | fillColor : "rgba(220,220,220,0.5)", |
830 | 830 | strokeColor : "rgba(220,220,220,1)", |
831 | 831 | pointColor : "rgba(220,220,220,1)", |
@@ -833,7 +833,7 @@ discard block |
||
833 | 833 | data : data2 |
834 | 834 | }, |
835 | 835 | { |
836 | - label: '<?php _e('This Week', 'geodirectory');?>', |
|
836 | + label: '<?php _e('This Week', 'geodirectory'); ?>', |
|
837 | 837 | fillColor : "rgba(151,187,205,0.5)", |
838 | 838 | strokeColor : "rgba(151,187,205,1)", |
839 | 839 | pointColor : "rgba(151,187,205,1)", |
@@ -1040,18 +1040,18 @@ discard block |
||
1040 | 1040 | </style> |
1041 | 1041 | <script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/1.0.2/Chart.min.js"></script> |
1042 | 1042 | <script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.10.2/moment.min.js"></script> |
1043 | - <button type="button" class="gdga-show-analytics"><?php _e('Show Google Analytics', 'geodirectory');?></button> |
|
1043 | + <button type="button" class="gdga-show-analytics"><?php _e('Show Google Analytics', 'geodirectory'); ?></button> |
|
1044 | 1044 | <span id="ga_stats" class="gdga-analytics-box" style="display:none"> |
1045 | - <div id="ga-analytics-title"><?php _e("Analytics", 'geodirectory');?></div> |
|
1045 | + <div id="ga-analytics-title"><?php _e("Analytics", 'geodirectory'); ?></div> |
|
1046 | 1046 | <div id="gd-active-users-container"> |
1047 | - <div class="gd-ActiveUsers"><i id="gdga-loader-icon" class="fa fa-refresh fa-spin" title="<?php esc_attr_e("Refresh", 'geodirectory');?>"></i><?php _e("Active Users:", 'geodirectory');?> |
|
1047 | + <div class="gd-ActiveUsers"><i id="gdga-loader-icon" class="fa fa-refresh fa-spin" title="<?php esc_attr_e("Refresh", 'geodirectory'); ?>"></i><?php _e("Active Users:", 'geodirectory'); ?> |
|
1048 | 1048 | <b class="gd-ActiveUsers-value">0</b> |
1049 | 1049 | </div> |
1050 | 1050 | </div> |
1051 | 1051 | <select id="gdga-select-analytic" onchange="gdga_select_option();" style="display: none;"> |
1052 | - <option value="weeks"><?php _e("Last Week vs This Week", 'geodirectory');?></option> |
|
1053 | - <option value="years"><?php _e("This Year vs Last Year", 'geodirectory');?></option> |
|
1054 | - <option value="country"><?php _e("Top Countries", 'geodirectory');?></option> |
|
1052 | + <option value="weeks"><?php _e("Last Week vs This Week", 'geodirectory'); ?></option> |
|
1053 | + <option value="years"><?php _e("This Year vs Last Year", 'geodirectory'); ?></option> |
|
1054 | + <option value="country"><?php _e("Top Countries", 'geodirectory'); ?></option> |
|
1055 | 1055 | </select> |
1056 | 1056 | <div class="Chartjs-figure" id="gdga-chart-container"></div> |
1057 | 1057 | <ol class="Chartjs-legend" id="gdga-legend-container"></ol> |
@@ -1067,8 +1067,8 @@ discard block |
||
1067 | 1067 | do_action('geodir_after_google_analytics'); |
1068 | 1068 | $content_html = ob_get_clean(); |
1069 | 1069 | if (trim($content_html) != '') |
1070 | - $content_html = '<div class="geodir-company_info geodir-details-sidebar-google-analytics">' . $content_html . '</div>'; |
|
1071 | - if ((int)get_option('geodir_disable_google_analytics_section') != 1) { |
|
1070 | + $content_html = '<div class="geodir-company_info geodir-details-sidebar-google-analytics">'.$content_html.'</div>'; |
|
1071 | + if ((int) get_option('geodir_disable_google_analytics_section') != 1) { |
|
1072 | 1072 | /** |
1073 | 1073 | * Filter the geodir_edit_post_link() function content. |
1074 | 1074 | * |
@@ -1094,7 +1094,7 @@ discard block |
||
1094 | 1094 | { |
1095 | 1095 | global $post, $preview, $post_images; |
1096 | 1096 | |
1097 | - if (!empty($post->ID) && geodir_cpt_has_rating_disabled((int)$post->ID)) { |
|
1097 | + if (!empty($post->ID) && geodir_cpt_has_rating_disabled((int) $post->ID)) { |
|
1098 | 1098 | return; |
1099 | 1099 | } |
1100 | 1100 | ob_start(); // Start buffering; |
@@ -1129,10 +1129,10 @@ discard block |
||
1129 | 1129 | |
1130 | 1130 | $reviews_text = $comment_count > 1 ? __("reviews", 'geodirectory') : __("review", 'geodirectory'); |
1131 | 1131 | |
1132 | - $html .= '<span itemprop="rating" itemscope itemtype="http://data-vocabulary.org/Rating"><span class="rating" itemprop="average" content="' . $post_avgratings . '">' . $post_avgratings . '</span> / <span itemprop="best" content="5">5</span> ' . __("based on", 'geodirectory') . ' </span><span class="count" itemprop="count" content="' . $comment_count . '">' . $comment_count . ' ' . $reviews_text . '</span><br />'; |
|
1132 | + $html .= '<span itemprop="rating" itemscope itemtype="http://data-vocabulary.org/Rating"><span class="rating" itemprop="average" content="'.$post_avgratings.'">'.$post_avgratings.'</span> / <span itemprop="best" content="5">5</span> '.__("based on", 'geodirectory').' </span><span class="count" itemprop="count" content="'.$comment_count.'">'.$comment_count.' '.$reviews_text.'</span><br />'; |
|
1133 | 1133 | |
1134 | 1134 | $html .= '<span class="item">'; |
1135 | - $html .= '<span class="fn" itemprop="itemreviewed">' . $post->post_title . '</span>'; |
|
1135 | + $html .= '<span class="fn" itemprop="itemreviewed">'.$post->post_title.'</span>'; |
|
1136 | 1136 | |
1137 | 1137 | if ($post_images) { |
1138 | 1138 | foreach ($post_images as $img) { |
@@ -1142,7 +1142,7 @@ discard block |
||
1142 | 1142 | } |
1143 | 1143 | |
1144 | 1144 | if (isset($post_img) && $post_img) { |
1145 | - $html .= '<br /><img src="' . $post_img . '" class="photo" alt="' . esc_attr($post->post_title) . '" itemprop="photo" content="' . $post_img . '" class="photo" />'; |
|
1145 | + $html .= '<br /><img src="'.$post_img.'" class="photo" alt="'.esc_attr($post->post_title).'" itemprop="photo" content="'.$post_img.'" class="photo" />'; |
|
1146 | 1146 | } |
1147 | 1147 | |
1148 | 1148 | $html .= '</span>'; |
@@ -1169,9 +1169,9 @@ discard block |
||
1169 | 1169 | do_action('geodir_after_detail_page_review_rating'); |
1170 | 1170 | $content_html = ob_get_clean(); |
1171 | 1171 | if (trim($content_html) != '') { |
1172 | - $content_html = '<div class="geodir-company_info geodir-details-sidebar-rating">' . $content_html . '</div>'; |
|
1172 | + $content_html = '<div class="geodir-company_info geodir-details-sidebar-rating">'.$content_html.'</div>'; |
|
1173 | 1173 | } |
1174 | - if ((int)get_option('geodir_disable_rating_info_section') != 1) { |
|
1174 | + if ((int) get_option('geodir_disable_rating_info_section') != 1) { |
|
1175 | 1175 | /** |
1176 | 1176 | * Filter the geodir_detail_page_review_rating() function content. |
1177 | 1177 | * |
@@ -1210,8 +1210,8 @@ discard block |
||
1210 | 1210 | |
1211 | 1211 | $content_html = ob_get_clean(); |
1212 | 1212 | if (trim($content_html) != '') |
1213 | - $content_html = '<div class="geodir-company_info geodir-details-sidebar-listing-info">' . $content_html . '</div>'; |
|
1214 | - if ((int)get_option('geodir_disable_listing_info_section') != 1) { |
|
1213 | + $content_html = '<div class="geodir-company_info geodir-details-sidebar-listing-info">'.$content_html.'</div>'; |
|
1214 | + if ((int) get_option('geodir_disable_listing_info_section') != 1) { |
|
1215 | 1215 | /** |
1216 | 1216 | * Filter the output html for function geodir_detail_page_more_info(). |
1217 | 1217 | * |
@@ -1312,7 +1312,7 @@ discard block |
||
1312 | 1312 | 'gd_allowed_img_types' => !empty($allowed_img_types) ? implode(',', $allowed_img_types) : '', |
1313 | 1313 | 'geodir_txt_form_wait' => __('Wait...', 'geodirectory'), |
1314 | 1314 | 'geodir_txt_form_searching' => __('Searching...', 'geodirectory'), |
1315 | - 'fa_rating' => (int)get_option('geodir_reviewrating_enable_font_awesome') == 1 ? 1 : '', |
|
1315 | + 'fa_rating' => (int) get_option('geodir_reviewrating_enable_font_awesome') == 1 ? 1 : '', |
|
1316 | 1316 | 'reviewrating' => defined('GEODIRREVIEWRATING_VERSION') ? 1 : '', |
1317 | 1317 | 'multirating' => defined('GEODIRREVIEWRATING_VERSION') && get_option('geodir_reviewrating_enable_rating') ? true : false, |
1318 | 1318 | 'geodir_map_name' => geodir_map_name(), |
@@ -1342,10 +1342,10 @@ discard block |
||
1342 | 1342 | foreach ($arr_alert_msg as $key => $value) { |
1343 | 1343 | if (!is_scalar($value)) |
1344 | 1344 | continue; |
1345 | - $arr_alert_msg[$key] = html_entity_decode((string)$value, ENT_QUOTES, 'UTF-8'); |
|
1345 | + $arr_alert_msg[$key] = html_entity_decode((string) $value, ENT_QUOTES, 'UTF-8'); |
|
1346 | 1346 | } |
1347 | 1347 | |
1348 | - $script = "var geodir_all_js_msg = " . json_encode($arr_alert_msg) . ';'; |
|
1348 | + $script = "var geodir_all_js_msg = ".json_encode($arr_alert_msg).';'; |
|
1349 | 1349 | echo '<script>'; |
1350 | 1350 | echo $script; |
1351 | 1351 | echo '</script>'; |
@@ -1435,7 +1435,7 @@ discard block |
||
1435 | 1435 | $geodir_old_sidebars = get_option('geodir_sidebars'); |
1436 | 1436 | if (is_array($geodir_old_sidebars)) { |
1437 | 1437 | foreach ($geodir_old_sidebars as $key => $val) { |
1438 | - if(0 === strpos($key, 'geodir_'))// if gd widget |
|
1438 | + if (0 === strpos($key, 'geodir_'))// if gd widget |
|
1439 | 1439 | { |
1440 | 1440 | $sidebars_widgets[$key] = $geodir_old_sidebars[$key]; |
1441 | 1441 | } |
@@ -1514,7 +1514,7 @@ discard block |
||
1514 | 1514 | global $post; |
1515 | 1515 | $term_condition = ''; |
1516 | 1516 | if (isset($_REQUEST['backandedit'])) { |
1517 | - $post = (object)$gd_session->get('listing'); |
|
1517 | + $post = (object) $gd_session->get('listing'); |
|
1518 | 1518 | $term_condition = isset($post->geodir_accept_term_condition) ? $post->geodir_accept_term_condition : ''; |
1519 | 1519 | } |
1520 | 1520 | |
@@ -1528,7 +1528,7 @@ discard block |
||
1528 | 1528 | echo 'checked="checked"'; |
1529 | 1529 | } ?> field_type="checkbox" name="geodir_accept_term_condition" id="geodir_accept_term_condition" |
1530 | 1530 | class="geodir_textfield" value="1" |
1531 | - style="display:inline-block"/><a href="<?php $terms_page = get_option('geodir_term_condition_page'); if($terms_page){ echo get_permalink($terms_page);}?>" target="_blank"><?php _e('Please accept our terms and conditions', 'geodirectory'); ?></a> |
|
1531 | + style="display:inline-block"/><a href="<?php $terms_page = get_option('geodir_term_condition_page'); if ($terms_page) { echo get_permalink($terms_page); }?>" target="_blank"><?php _e('Please accept our terms and conditions', 'geodirectory'); ?></a> |
|
1532 | 1532 | </span> |
1533 | 1533 | </div> |
1534 | 1534 | <span class="geodir_message_error"><?php if (isset($required_msg)) { |
@@ -1568,7 +1568,7 @@ discard block |
||
1568 | 1568 | /** This action is documented in geodirectory_template_actions.php */ |
1569 | 1569 | $desc_limit = apply_filters('geodir_description_field_desc_limit', ''); |
1570 | 1570 | |
1571 | - if (!($desc_limit === '' || (int)$desc_limit > 0)) { |
|
1571 | + if (!($desc_limit === '' || (int) $desc_limit > 0)) { |
|
1572 | 1572 | $is_display = false; |
1573 | 1573 | } |
1574 | 1574 | } |
@@ -1616,16 +1616,16 @@ discard block |
||
1616 | 1616 | global $wpdb, $plugin_prefix; |
1617 | 1617 | |
1618 | 1618 | // Remove unused virtual page |
1619 | - $listings_page_id = (int)get_option('geodir_listing_page'); |
|
1619 | + $listings_page_id = (int) get_option('geodir_listing_page'); |
|
1620 | 1620 | if ($listings_page_id) { |
1621 | - $wpdb->query($wpdb->prepare("DELETE FROM " . $wpdb->posts . " WHERE ID=%d AND post_name = %s AND post_type=%s", array($listings_page_id, 'listings', 'page'))); |
|
1621 | + $wpdb->query($wpdb->prepare("DELETE FROM ".$wpdb->posts." WHERE ID=%d AND post_name = %s AND post_type=%s", array($listings_page_id, 'listings', 'page'))); |
|
1622 | 1622 | delete_option('geodir_listing_page'); |
1623 | 1623 | } |
1624 | 1624 | |
1625 | 1625 | if (!get_option('geodir_changes_in_custom_fields_table')) { |
1626 | 1626 | $wpdb->query( |
1627 | 1627 | $wpdb->prepare( |
1628 | - "UPDATE " . GEODIR_CUSTOM_FIELDS_TABLE . " SET is_default=%s, is_admin=%s WHERE is_default=%s", |
|
1628 | + "UPDATE ".GEODIR_CUSTOM_FIELDS_TABLE." SET is_default=%s, is_admin=%s WHERE is_default=%s", |
|
1629 | 1629 | array('1', '1', 'admin') |
1630 | 1630 | ) |
1631 | 1631 | ); |
@@ -1633,9 +1633,9 @@ discard block |
||
1633 | 1633 | |
1634 | 1634 | /* --- terms meta value set --- */ |
1635 | 1635 | |
1636 | - update_option('geodir_default_marker_icon', geodir_plugin_url() . '/geodirectory-functions/map-functions/icons/pin.png'); |
|
1636 | + update_option('geodir_default_marker_icon', geodir_plugin_url().'/geodirectory-functions/map-functions/icons/pin.png'); |
|
1637 | 1637 | |
1638 | - $options_data = $wpdb->get_results($wpdb->prepare("SELECT * FROM " . $wpdb->prefix . "options WHERE option_name LIKE %s", array('%tax_meta_%'))); |
|
1638 | + $options_data = $wpdb->get_results($wpdb->prepare("SELECT * FROM ".$wpdb->prefix."options WHERE option_name LIKE %s", array('%tax_meta_%'))); |
|
1639 | 1639 | |
1640 | 1640 | if (!empty($options_data)) { |
1641 | 1641 | |
@@ -1643,7 +1643,7 @@ discard block |
||
1643 | 1643 | |
1644 | 1644 | $option_val = str_replace('tax_meta_', '', $optobj->option_name); |
1645 | 1645 | |
1646 | - $taxonomies_data = $wpdb->get_results($wpdb->prepare("SELECT taxonomy FROM " . $wpdb->prefix . "term_taxonomy WHERE taxonomy LIKE %s AND term_id=%d", array('%category%', $option_val))); |
|
1646 | + $taxonomies_data = $wpdb->get_results($wpdb->prepare("SELECT taxonomy FROM ".$wpdb->prefix."term_taxonomy WHERE taxonomy LIKE %s AND term_id=%d", array('%category%', $option_val))); |
|
1647 | 1647 | |
1648 | 1648 | if (!empty($taxonomies_data)) { |
1649 | 1649 | |
@@ -1652,17 +1652,17 @@ discard block |
||
1652 | 1652 | $taxObject = get_taxonomy($taxobj->taxonomy); |
1653 | 1653 | $post_type = $taxObject->object_type[0]; |
1654 | 1654 | |
1655 | - $opt_value = 'tax_meta_' . $post_type . '_' . $option_val; |
|
1655 | + $opt_value = 'tax_meta_'.$post_type.'_'.$option_val; |
|
1656 | 1656 | |
1657 | - $duplicate_data = $wpdb->get_var($wpdb->prepare("SELECT option_id FROM " . $wpdb->prefix . "options WHERE option_name=%s", array('tax_meta_' . $option_val))); |
|
1657 | + $duplicate_data = $wpdb->get_var($wpdb->prepare("SELECT option_id FROM ".$wpdb->prefix."options WHERE option_name=%s", array('tax_meta_'.$option_val))); |
|
1658 | 1658 | |
1659 | 1659 | if ($duplicate_data) { |
1660 | 1660 | |
1661 | - $wpdb->query($wpdb->prepare("UPDATE " . $wpdb->prefix . "options SET option_name=%s WHERE option_id=%d", array($opt_value, $optobj->option_id))); |
|
1661 | + $wpdb->query($wpdb->prepare("UPDATE ".$wpdb->prefix."options SET option_name=%s WHERE option_id=%d", array($opt_value, $optobj->option_id))); |
|
1662 | 1662 | |
1663 | 1663 | } else { |
1664 | 1664 | |
1665 | - $wpdb->query($wpdb->prepare("INSERT INTO " . $wpdb->prefix . "options (option_name,option_value,autoload) VALUES (%s, %s, %s)", array($opt_value, $optobj->option_value, $optobj->autoload))); |
|
1665 | + $wpdb->query($wpdb->prepare("INSERT INTO ".$wpdb->prefix."options (option_name,option_value,autoload) VALUES (%s, %s, %s)", array($opt_value, $optobj->option_value, $optobj->autoload))); |
|
1666 | 1666 | |
1667 | 1667 | } |
1668 | 1668 | |
@@ -1696,14 +1696,14 @@ discard block |
||
1696 | 1696 | |
1697 | 1697 | global $wpdb, $table_prefix; |
1698 | 1698 | |
1699 | - $slug_exists = $wpdb->get_var($wpdb->prepare("SELECT slug FROM " . $table_prefix . "terms WHERE slug=%s", array($slug))); |
|
1699 | + $slug_exists = $wpdb->get_var($wpdb->prepare("SELECT slug FROM ".$table_prefix."terms WHERE slug=%s", array($slug))); |
|
1700 | 1700 | |
1701 | 1701 | if ($slug_exists) { |
1702 | 1702 | |
1703 | 1703 | $suffix = 1; |
1704 | 1704 | do { |
1705 | - $alt_location_name = _truncate_post_slug($slug, 200 - (strlen($suffix) + 1)) . "-$suffix"; |
|
1706 | - $location_slug_check = $wpdb->get_var($wpdb->prepare("SELECT slug FROM " . $table_prefix . "terms WHERE slug=%s", array($alt_location_name))); |
|
1705 | + $alt_location_name = _truncate_post_slug($slug, 200 - (strlen($suffix) + 1))."-$suffix"; |
|
1706 | + $location_slug_check = $wpdb->get_var($wpdb->prepare("SELECT slug FROM ".$table_prefix."terms WHERE slug=%s", array($alt_location_name))); |
|
1707 | 1707 | $suffix++; |
1708 | 1708 | } while ($location_slug_check && $suffix < 100); |
1709 | 1709 | |
@@ -1757,7 +1757,7 @@ discard block |
||
1757 | 1757 | |
1758 | 1758 | $suffix = 1; |
1759 | 1759 | do { |
1760 | - $new_slug = _truncate_post_slug($slug, 200 - (strlen($suffix) + 1)) . "-$suffix"; |
|
1760 | + $new_slug = _truncate_post_slug($slug, 200 - (strlen($suffix) + 1))."-$suffix"; |
|
1761 | 1761 | |
1762 | 1762 | /** This action is documented in geodirectory_hooks_actions.php */ |
1763 | 1763 | $term_slug_check = apply_filters('geodir_term_slug_is_exists', false, $new_slug, $term_id); |
@@ -1769,7 +1769,7 @@ discard block |
||
1769 | 1769 | |
1770 | 1770 | //wp_update_term( $term_id, $taxonomy, array('slug' => $slug) ); |
1771 | 1771 | |
1772 | - $wpdb->query($wpdb->prepare("UPDATE " . $table_prefix . "terms SET slug=%s WHERE term_id=%d", array($slug, $term_id))); |
|
1772 | + $wpdb->query($wpdb->prepare("UPDATE ".$table_prefix."terms SET slug=%s WHERE term_id=%d", array($slug, $term_id))); |
|
1773 | 1773 | |
1774 | 1774 | } |
1775 | 1775 | |
@@ -1778,18 +1778,18 @@ discard block |
||
1778 | 1778 | $post_type = !empty($taxonomy_obj) ? $taxonomy_obj->object_type[0] : NULL; |
1779 | 1779 | |
1780 | 1780 | $post_types = geodir_get_posttypes(); |
1781 | - if ($post_type && in_array($post_type, $post_types) && $post_type . '_tags' == $taxonomy) { |
|
1782 | - $posts_obj = $wpdb->get_results($wpdb->prepare("SELECT object_id FROM " . $wpdb->term_relationships . " WHERE term_taxonomy_id = %d", array($tt_id))); |
|
1781 | + if ($post_type && in_array($post_type, $post_types) && $post_type.'_tags' == $taxonomy) { |
|
1782 | + $posts_obj = $wpdb->get_results($wpdb->prepare("SELECT object_id FROM ".$wpdb->term_relationships." WHERE term_taxonomy_id = %d", array($tt_id))); |
|
1783 | 1783 | |
1784 | 1784 | if (!empty($posts_obj)) { |
1785 | 1785 | foreach ($posts_obj as $post_obj) { |
1786 | 1786 | $post_id = $post_obj->object_id; |
1787 | 1787 | |
1788 | - $raw_tags = wp_get_object_terms($post_id, $post_type . '_tags', array('fields' => 'names')); |
|
1788 | + $raw_tags = wp_get_object_terms($post_id, $post_type.'_tags', array('fields' => 'names')); |
|
1789 | 1789 | $post_tags = !empty($raw_tags) ? implode(',', $raw_tags) : ''; |
1790 | 1790 | |
1791 | - $listing_table = $plugin_prefix . $post_type . '_detail'; |
|
1792 | - $wpdb->query($wpdb->prepare("UPDATE " . $listing_table . " SET post_tags=%s WHERE post_id =%d", array($post_tags, $post_id))); |
|
1791 | + $listing_table = $plugin_prefix.$post_type.'_detail'; |
|
1792 | + $wpdb->query($wpdb->prepare("UPDATE ".$listing_table." SET post_tags=%s WHERE post_id =%d", array($post_tags, $post_id))); |
|
1793 | 1793 | } |
1794 | 1794 | } |
1795 | 1795 | } |
@@ -1823,7 +1823,7 @@ discard block |
||
1823 | 1823 | if ($country_slug == $slug || $region_slug == $slug || $city_slug == $slug) |
1824 | 1824 | return $slug_exists = true; |
1825 | 1825 | |
1826 | - if ($wpdb->get_var($wpdb->prepare("SELECT slug FROM " . $table_prefix . "terms WHERE slug=%s AND term_id != %d", array($slug, $term_id)))) |
|
1826 | + if ($wpdb->get_var($wpdb->prepare("SELECT slug FROM ".$table_prefix."terms WHERE slug=%s AND term_id != %d", array($slug, $term_id)))) |
|
1827 | 1827 | return $slug_exists = true; |
1828 | 1828 | |
1829 | 1829 | return $slug_exists; |
@@ -1864,43 +1864,43 @@ discard block |
||
1864 | 1864 | |
1865 | 1865 | |
1866 | 1866 | $gd_page = ''; |
1867 | - if(geodir_is_page('home')){ |
|
1867 | + if (geodir_is_page('home')) { |
|
1868 | 1868 | $gd_page = 'home'; |
1869 | 1869 | $title = (get_option('geodir_meta_title_homepage')) ? get_option('geodir_meta_title_homepage') : $title; |
1870 | 1870 | } |
1871 | - elseif(geodir_is_page('detail')){ |
|
1871 | + elseif (geodir_is_page('detail')) { |
|
1872 | 1872 | $gd_page = 'detail'; |
1873 | 1873 | $title = (get_option('geodir_meta_title_detail')) ? get_option('geodir_meta_title_detail') : $title; |
1874 | 1874 | } |
1875 | - elseif(geodir_is_page('pt')){ |
|
1875 | + elseif (geodir_is_page('pt')) { |
|
1876 | 1876 | $gd_page = 'pt'; |
1877 | 1877 | $title = (get_option('geodir_meta_title_pt')) ? get_option('geodir_meta_title_pt') : $title; |
1878 | 1878 | } |
1879 | - elseif(geodir_is_page('listing')){ |
|
1879 | + elseif (geodir_is_page('listing')) { |
|
1880 | 1880 | $gd_page = 'listing'; |
1881 | 1881 | $title = (get_option('geodir_meta_title_listing')) ? get_option('geodir_meta_title_listing') : $title; |
1882 | 1882 | } |
1883 | - elseif(geodir_is_page('location')){ |
|
1883 | + elseif (geodir_is_page('location')) { |
|
1884 | 1884 | $gd_page = 'location'; |
1885 | 1885 | $title = (get_option('geodir_meta_title_location')) ? get_option('geodir_meta_title_location') : $title; |
1886 | 1886 | } |
1887 | - elseif(geodir_is_page('search')){ |
|
1887 | + elseif (geodir_is_page('search')) { |
|
1888 | 1888 | $gd_page = 'search'; |
1889 | 1889 | $title = (get_option('geodir_meta_title_search')) ? get_option('geodir_meta_title_search') : $title; |
1890 | 1890 | } |
1891 | - elseif(geodir_is_page('add-listing')){ |
|
1891 | + elseif (geodir_is_page('add-listing')) { |
|
1892 | 1892 | $gd_page = 'add-listing'; |
1893 | 1893 | $title = (get_option('geodir_meta_title_add-listing')) ? get_option('geodir_meta_title_add-listing') : $title; |
1894 | 1894 | } |
1895 | - elseif(geodir_is_page('author')){ |
|
1895 | + elseif (geodir_is_page('author')) { |
|
1896 | 1896 | $gd_page = 'author'; |
1897 | 1897 | $title = (get_option('geodir_meta_title_author')) ? get_option('geodir_meta_title_author') : $title; |
1898 | 1898 | } |
1899 | - elseif(geodir_is_page('login')){ |
|
1899 | + elseif (geodir_is_page('login')) { |
|
1900 | 1900 | $gd_page = 'login'; |
1901 | 1901 | $title = (get_option('geodir_meta_title_login')) ? get_option('geodir_meta_title_login') : $title; |
1902 | 1902 | } |
1903 | - elseif(geodir_is_page('listing-success')){ |
|
1903 | + elseif (geodir_is_page('listing-success')) { |
|
1904 | 1904 | $gd_page = 'listing-success'; |
1905 | 1905 | $title = (get_option('geodir_meta_title_listing-success')) ? get_option('geodir_meta_title_listing-success') : $title; |
1906 | 1906 | } |
@@ -1932,12 +1932,12 @@ discard block |
||
1932 | 1932 | |
1933 | 1933 | if (!get_option('geodir_set_post_attachments')) { |
1934 | 1934 | |
1935 | - require_once(ABSPATH . 'wp-admin/includes/image.php'); |
|
1936 | - require_once(ABSPATH . 'wp-admin/includes/file.php'); |
|
1935 | + require_once(ABSPATH.'wp-admin/includes/image.php'); |
|
1936 | + require_once(ABSPATH.'wp-admin/includes/file.php'); |
|
1937 | 1937 | |
1938 | 1938 | $all_postypes = geodir_get_posttypes(); |
1939 | 1939 | |
1940 | - foreach($all_postypes as $post_type){ |
|
1940 | + foreach ($all_postypes as $post_type) { |
|
1941 | 1941 | $args = array( |
1942 | 1942 | 'posts_per_page' => -1, |
1943 | 1943 | 'post_type' => $post_type, |
@@ -2031,7 +2031,7 @@ discard block |
||
2031 | 2031 | { |
2032 | 2032 | $user_id = get_current_user_id(); |
2033 | 2033 | |
2034 | - if(!$user_id){return $post;} |
|
2034 | + if (!$user_id) {return $post; } |
|
2035 | 2035 | |
2036 | 2036 | $gd_post_types = geodir_get_posttypes(); |
2037 | 2037 | |
@@ -2140,7 +2140,7 @@ discard block |
||
2140 | 2140 | |
2141 | 2141 | if (array_key_exists('post_video', $tabs_arr)) { |
2142 | 2142 | |
2143 | - $field_title = $wpdb->get_var($wpdb->prepare("select site_title from " . GEODIR_CUSTOM_FIELDS_TABLE . " where htmlvar_name = %s and post_type = %s ", array('geodir_video', $post_type))); |
|
2143 | + $field_title = $wpdb->get_var($wpdb->prepare("select site_title from ".GEODIR_CUSTOM_FIELDS_TABLE." where htmlvar_name = %s and post_type = %s ", array('geodir_video', $post_type))); |
|
2144 | 2144 | |
2145 | 2145 | if (isset($tabs_arr['post_video']['heading_text']) && $field_title != '') |
2146 | 2146 | $tabs_arr['post_video']['heading_text'] = $field_title; |
@@ -2148,7 +2148,7 @@ discard block |
||
2148 | 2148 | |
2149 | 2149 | if (array_key_exists('special_offers', $tabs_arr)) { |
2150 | 2150 | |
2151 | - $field_title = $wpdb->get_var($wpdb->prepare("select site_title from " . GEODIR_CUSTOM_FIELDS_TABLE . " where htmlvar_name = %s and post_type = %s ", array('geodir_special_offers', $post_type))); |
|
2151 | + $field_title = $wpdb->get_var($wpdb->prepare("select site_title from ".GEODIR_CUSTOM_FIELDS_TABLE." where htmlvar_name = %s and post_type = %s ", array('geodir_special_offers', $post_type))); |
|
2152 | 2152 | |
2153 | 2153 | if (isset($tabs_arr['special_offers']['heading_text']) && $field_title != '') |
2154 | 2154 | $tabs_arr['special_offers']['heading_text'] = $field_title; |
@@ -2169,7 +2169,7 @@ discard block |
||
2169 | 2169 | */ |
2170 | 2170 | function geodir_remove_template_redirect_actions() |
2171 | 2171 | { |
2172 | - if (geodir_is_page('login')){ |
|
2172 | + if (geodir_is_page('login')) { |
|
2173 | 2173 | remove_all_actions('template_redirect'); |
2174 | 2174 | remove_action('init', 'avia_modify_front', 10); |
2175 | 2175 | } |
@@ -2216,25 +2216,25 @@ discard block |
||
2216 | 2216 | $split_img_file_path = isset($split_img_path[1]) ? $split_img_path[1] : ''; |
2217 | 2217 | |
2218 | 2218 | $wpdb->query( |
2219 | - $wpdb->prepare("DELETE FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE post_id = %d AND file=%s ", |
|
2219 | + $wpdb->prepare("DELETE FROM ".GEODIR_ATTACHMENT_TABLE." WHERE post_id = %d AND file=%s ", |
|
2220 | 2220 | array($post_id, $split_img_file_path) |
2221 | 2221 | ) |
2222 | 2222 | ); |
2223 | 2223 | |
2224 | 2224 | $attachment_data = $wpdb->get_row( |
2225 | - $wpdb->prepare("SELECT ID, MIN(`menu_order`) FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE post_id=%d", |
|
2225 | + $wpdb->prepare("SELECT ID, MIN(`menu_order`) FROM ".GEODIR_ATTACHMENT_TABLE." WHERE post_id=%d", |
|
2226 | 2226 | array($post_id) |
2227 | 2227 | ) |
2228 | 2228 | ); |
2229 | 2229 | |
2230 | 2230 | if (!empty($attachment_data)) { |
2231 | - $wpdb->query("UPDATE " . GEODIR_ATTACHMENT_TABLE . " SET menu_order=1 WHERE ID=" . $attachment_data->ID); |
|
2231 | + $wpdb->query("UPDATE ".GEODIR_ATTACHMENT_TABLE." SET menu_order=1 WHERE ID=".$attachment_data->ID); |
|
2232 | 2232 | } |
2233 | 2233 | |
2234 | 2234 | |
2235 | - $table_name = $plugin_prefix . $post_type . '_detail'; |
|
2235 | + $table_name = $plugin_prefix.$post_type.'_detail'; |
|
2236 | 2236 | |
2237 | - $wpdb->query("UPDATE " . $table_name . " SET featured_image='' WHERE post_id =" . $post_id); |
|
2237 | + $wpdb->query("UPDATE ".$table_name." SET featured_image='' WHERE post_id =".$post_id); |
|
2238 | 2238 | |
2239 | 2239 | geodir_set_wp_featured_image($post_id); |
2240 | 2240 | |
@@ -2262,9 +2262,9 @@ discard block |
||
2262 | 2262 | |
2263 | 2263 | foreach ($all_postypes as $posttype) { |
2264 | 2264 | |
2265 | - $tablename = $plugin_prefix . $posttype . '_detail'; |
|
2265 | + $tablename = $plugin_prefix.$posttype.'_detail'; |
|
2266 | 2266 | |
2267 | - $get_post_data = $wpdb->get_results("SELECT post_id FROM " . $tablename); |
|
2267 | + $get_post_data = $wpdb->get_results("SELECT post_id FROM ".$tablename); |
|
2268 | 2268 | |
2269 | 2269 | if (!empty($get_post_data)) { |
2270 | 2270 | |
@@ -2272,7 +2272,7 @@ discard block |
||
2272 | 2272 | |
2273 | 2273 | $post_id = $data->post_id; |
2274 | 2274 | |
2275 | - $attachment_data = $wpdb->get_results("SELECT * FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE post_id =" . $post_id . " AND file!=''"); |
|
2275 | + $attachment_data = $wpdb->get_results("SELECT * FROM ".GEODIR_ATTACHMENT_TABLE." WHERE post_id =".$post_id." AND file!=''"); |
|
2276 | 2276 | |
2277 | 2277 | if (!empty($attachment_data)) { |
2278 | 2278 | |
@@ -2289,22 +2289,22 @@ discard block |
||
2289 | 2289 | |
2290 | 2290 | $file_name = $file_info['basename']; |
2291 | 2291 | |
2292 | - $img_arr['path'] = $uploads_path . $sub_dir . '/' . $file_name; |
|
2292 | + $img_arr['path'] = $uploads_path.$sub_dir.'/'.$file_name; |
|
2293 | 2293 | |
2294 | 2294 | if (!file_exists($img_arr['path'])) { |
2295 | 2295 | |
2296 | - $wpdb->query("DELETE FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE ID=" . $attach->ID); |
|
2296 | + $wpdb->query("DELETE FROM ".GEODIR_ATTACHMENT_TABLE." WHERE ID=".$attach->ID); |
|
2297 | 2297 | |
2298 | 2298 | } |
2299 | 2299 | |
2300 | 2300 | } |
2301 | 2301 | |
2302 | - $attachment_data = $wpdb->get_row("SELECT ID, MIN(`menu_order`) FROM " . GEODIR_ATTACHMENT_TABLE . " WHERE post_id=" . $post_id . " GROUP BY post_id"); |
|
2302 | + $attachment_data = $wpdb->get_row("SELECT ID, MIN(`menu_order`) FROM ".GEODIR_ATTACHMENT_TABLE." WHERE post_id=".$post_id." GROUP BY post_id"); |
|
2303 | 2303 | |
2304 | 2304 | if (!empty($attachment_data)) { |
2305 | 2305 | |
2306 | 2306 | if ($attachment_data->ID) |
2307 | - $wpdb->query("UPDATE " . GEODIR_ATTACHMENT_TABLE . " SET menu_order=1 WHERE ID=" . $attachment_data->ID); |
|
2307 | + $wpdb->query("UPDATE ".GEODIR_ATTACHMENT_TABLE." SET menu_order=1 WHERE ID=".$attachment_data->ID); |
|
2308 | 2308 | |
2309 | 2309 | } else { |
2310 | 2310 | |
@@ -2318,7 +2318,7 @@ discard block |
||
2318 | 2318 | |
2319 | 2319 | } |
2320 | 2320 | |
2321 | - $wpdb->query("UPDATE " . $tablename . " SET featured_image='' WHERE post_id =" . $post_id); |
|
2321 | + $wpdb->query("UPDATE ".$tablename." SET featured_image='' WHERE post_id =".$post_id); |
|
2322 | 2322 | |
2323 | 2323 | geodir_set_wp_featured_image($post_id); |
2324 | 2324 | |
@@ -2347,7 +2347,7 @@ discard block |
||
2347 | 2347 | { |
2348 | 2348 | |
2349 | 2349 | if (!get_option('geodir_default_rating_star_icon')) { |
2350 | - update_option('geodir_default_rating_star_icon', geodir_plugin_url() . '/geodirectory-assets/images/stars.png'); |
|
2350 | + update_option('geodir_default_rating_star_icon', geodir_plugin_url().'/geodirectory-assets/images/stars.png'); |
|
2351 | 2351 | } |
2352 | 2352 | |
2353 | 2353 | } |
@@ -2367,7 +2367,7 @@ discard block |
||
2367 | 2367 | function geodir_user_post_listing_count($user_id = 0) |
2368 | 2368 | { |
2369 | 2369 | global $wpdb, $plugin_prefix, $current_user; |
2370 | - if(!$user_id){ |
|
2370 | + if (!$user_id) { |
|
2371 | 2371 | $user_id = $current_user->ID; |
2372 | 2372 | } |
2373 | 2373 | |
@@ -2376,7 +2376,7 @@ discard block |
||
2376 | 2376 | $user_listing = array(); |
2377 | 2377 | if ($user_id && is_array($all_posts) && !empty($all_posts)) { |
2378 | 2378 | foreach ($all_posts as $ptype) { |
2379 | - $total_posts = $wpdb->get_var("SELECT count( ID ) FROM " . $wpdb->prefix . "posts WHERE post_author=" . $user_id . " AND post_type='" . $ptype . "' AND ( post_status = 'publish' OR post_status = 'draft' OR post_status = 'private' OR post_status = 'pending' )"); |
|
2379 | + $total_posts = $wpdb->get_var("SELECT count( ID ) FROM ".$wpdb->prefix."posts WHERE post_author=".$user_id." AND post_type='".$ptype."' AND ( post_status = 'publish' OR post_status = 'draft' OR post_status = 'private' OR post_status = 'pending' )"); |
|
2380 | 2380 | |
2381 | 2381 | if ($total_posts > 0) { |
2382 | 2382 | $user_listing[$ptype] = $total_posts; |
@@ -2417,19 +2417,19 @@ discard block |
||
2417 | 2417 | |
2418 | 2418 | $custom_fields = geodir_post_custom_fields($post_package_id, 'all', $post_type, $fields_location); |
2419 | 2419 | //remove video and special offers if it is already set to show |
2420 | - if(isset($tabs_arr['post_video']['is_display']) && $tabs_arr['post_video']['is_display']){ |
|
2420 | + if (isset($tabs_arr['post_video']['is_display']) && $tabs_arr['post_video']['is_display']) { |
|
2421 | 2421 | $unset_video = true; |
2422 | 2422 | } |
2423 | 2423 | |
2424 | - if(isset($tabs_arr['special_offers']['is_display']) && $tabs_arr['special_offers']['is_display']){ |
|
2424 | + if (isset($tabs_arr['special_offers']['is_display']) && $tabs_arr['special_offers']['is_display']) { |
|
2425 | 2425 | $unset_special_offers = true; |
2426 | 2426 | } |
2427 | - if(isset($unset_video) || isset($unset_special_offers) && !empty($custom_fields)){ |
|
2428 | - foreach($custom_fields as $key => $custom_field){ |
|
2429 | - if($custom_field['name']=='geodir_video' && isset($unset_video)){ |
|
2427 | + if (isset($unset_video) || isset($unset_special_offers) && !empty($custom_fields)) { |
|
2428 | + foreach ($custom_fields as $key => $custom_field) { |
|
2429 | + if ($custom_field['name'] == 'geodir_video' && isset($unset_video)) { |
|
2430 | 2430 | unset($custom_fields[$key]); |
2431 | 2431 | } |
2432 | - if($custom_field['name']=='geodir_special_offers' && isset($unset_special_offers)){ |
|
2432 | + if ($custom_field['name'] == 'geodir_special_offers' && isset($unset_special_offers)) { |
|
2433 | 2433 | unset($custom_fields[$key]); |
2434 | 2434 | } |
2435 | 2435 | } |
@@ -2446,7 +2446,7 @@ discard block |
||
2446 | 2446 | $post->{$field_name} = $_REQUEST[$field_name]; |
2447 | 2447 | } |
2448 | 2448 | |
2449 | - if (isset($field['show_in']) && strpos($field['show_in'], '[owntab]') !== false && ((isset($post->{$field_name}) && $post->{$field_name} != '') || $field['type'] == 'fieldset' || $field['type'] == 'address') && in_array($field['type'], array('text', 'datepicker', 'textarea', 'time', 'phone', 'email', 'select', 'multiselect', 'url', 'html', 'fieldset', 'radio', 'checkbox', 'file','address','taxonomy'))) { |
|
2449 | + if (isset($field['show_in']) && strpos($field['show_in'], '[owntab]') !== false && ((isset($post->{$field_name}) && $post->{$field_name} != '') || $field['type'] == 'fieldset' || $field['type'] == 'address') && in_array($field['type'], array('text', 'datepicker', 'textarea', 'time', 'phone', 'email', 'select', 'multiselect', 'url', 'html', 'fieldset', 'radio', 'checkbox', 'file', 'address', 'taxonomy'))) { |
|
2450 | 2450 | if ($type['type'] == 'datepicker' && ($post->{$type['htmlvar_name']} == '' || $post->{$type['htmlvar_name']} == '0000-00-00')) { |
2451 | 2451 | continue; |
2452 | 2452 | } |
@@ -2479,7 +2479,7 @@ discard block |
||
2479 | 2479 | $post->{$field_name} = $_REQUEST[$field_name]; |
2480 | 2480 | } |
2481 | 2481 | |
2482 | - if (isset($field['show_in']) && strpos($field['show_in'], '[owntab]') !== false && ((isset($post->{$field_name}) && $post->{$field_name} != '') || $field['type'] == 'fieldset' || $field['type'] == 'address') && in_array($field['type'], array('text', 'datepicker', 'textarea', 'time', 'phone', 'email', 'select', 'multiselect', 'url', 'html', 'fieldset', 'radio', 'checkbox', 'file','address','taxonomy'))) { |
|
2482 | + if (isset($field['show_in']) && strpos($field['show_in'], '[owntab]') !== false && ((isset($post->{$field_name}) && $post->{$field_name} != '') || $field['type'] == 'fieldset' || $field['type'] == 'address') && in_array($field['type'], array('text', 'datepicker', 'textarea', 'time', 'phone', 'email', 'select', 'multiselect', 'url', 'html', 'fieldset', 'radio', 'checkbox', 'file', 'address', 'taxonomy'))) { |
|
2483 | 2483 | $label = $field['site_title'] != '' ? $field['site_title'] : $field['admin_title']; |
2484 | 2484 | $site_title = trim($field['site_title']); |
2485 | 2485 | $type = $field; |
@@ -2495,21 +2495,21 @@ discard block |
||
2495 | 2495 | $variables_array['label'] = __($type['site_title'], 'geodirectory'); |
2496 | 2496 | $variables_array['value'] = isset($post->{$type['htmlvar_name']}) ? $post->{$type['htmlvar_name']} : ''; |
2497 | 2497 | |
2498 | - }else{ |
|
2498 | + } else { |
|
2499 | 2499 | $i = 0; |
2500 | 2500 | $fieldset_count++; |
2501 | 2501 | $field_set_start = 1; |
2502 | - $fieldset_arr[$fieldset_count]['htmlvar_name'] = 'gd_tab_' . $fieldset_count; |
|
2502 | + $fieldset_arr[$fieldset_count]['htmlvar_name'] = 'gd_tab_'.$fieldset_count; |
|
2503 | 2503 | $fieldset_arr[$fieldset_count]['label'] = $label; |
2504 | 2504 | } |
2505 | 2505 | |
2506 | 2506 | |
2507 | - if(isset($type['extra_fields'])){$extra_fields= $type['extra_fields'];} |
|
2507 | + if (isset($type['extra_fields'])) {$extra_fields = $type['extra_fields']; } |
|
2508 | 2508 | $type = stripslashes_deep($type); // strip slashes |
2509 | - if(isset($type['extra_fields'])){$type['extra_fields'] = $extra_fields;} |
|
2509 | + if (isset($type['extra_fields'])) {$type['extra_fields'] = $extra_fields; } |
|
2510 | 2510 | $html = ''; |
2511 | 2511 | $html_var = isset($type['htmlvar_name']) ? $type['htmlvar_name'] : ''; |
2512 | - if($html_var=='post'){$html_var='post_address';} |
|
2512 | + if ($html_var == 'post') {$html_var = 'post_address'; } |
|
2513 | 2513 | $field_icon = geodir_field_icon_proccess($type); |
2514 | 2514 | $filed_type = $type['type']; |
2515 | 2515 | |
@@ -2522,7 +2522,7 @@ discard block |
||
2522 | 2522 | * @param string $fields_location The location the field is to be show. |
2523 | 2523 | * @param array $type The array of field values. |
2524 | 2524 | */ |
2525 | - $html = apply_filters("geodir_custom_field_output_{$filed_type}",$html,$fields_location,$type); |
|
2525 | + $html = apply_filters("geodir_custom_field_output_{$filed_type}", $html, $fields_location, $type); |
|
2526 | 2526 | |
2527 | 2527 | |
2528 | 2528 | /** |
@@ -2568,7 +2568,7 @@ discard block |
||
2568 | 2568 | * @param string $htmlvar_name The field HTML var name. |
2569 | 2569 | */ |
2570 | 2570 | 'is_display' => apply_filters('geodir_detail_page_tab_is_display', true, $htmlvar_name), |
2571 | - 'tab_content' => '<div class="geodir-company_info field-group xxx">' . $fieldset_html . '</div>' |
|
2571 | + 'tab_content' => '<div class="geodir-company_info field-group xxx">'.$fieldset_html.'</div>' |
|
2572 | 2572 | ); |
2573 | 2573 | } |
2574 | 2574 | } else { |
@@ -2632,7 +2632,7 @@ discard block |
||
2632 | 2632 | } |
2633 | 2633 | $status .= ")</strong>"; |
2634 | 2634 | |
2635 | - $html = '<span class="geodir-post-status">' . $status_icon . ' <font class="geodir-status-label">' . __('Status: ', 'geodirectory') . '</font>' . $status . '</span>'; |
|
2635 | + $html = '<span class="geodir-post-status">'.$status_icon.' <font class="geodir-status-label">'.__('Status: ', 'geodirectory').'</font>'.$status.'</span>'; |
|
2636 | 2636 | } |
2637 | 2637 | } |
2638 | 2638 | |
@@ -2701,7 +2701,7 @@ discard block |
||
2701 | 2701 | * @return array Modified class array. |
2702 | 2702 | */ |
2703 | 2703 | function geodir_body_class_active_map($classes = array()) { |
2704 | - $classes[] = 'gd-map-' . geodir_map_name(); |
|
2704 | + $classes[] = 'gd-map-'.geodir_map_name(); |
|
2705 | 2705 | |
2706 | 2706 | return $classes; |
2707 | 2707 | } |
@@ -2716,7 +2716,7 @@ discard block |
||
2716 | 2716 | * @return string Modified class string. |
2717 | 2717 | */ |
2718 | 2718 | function geodir_admin_body_class_active_map($class = '') { |
2719 | - $class .= ' gd-map-' . geodir_map_name(); |
|
2719 | + $class .= ' gd-map-'.geodir_map_name(); |
|
2720 | 2720 | |
2721 | 2721 | return $class; |
2722 | 2722 | } |
@@ -2736,7 +2736,7 @@ discard block |
||
2736 | 2736 | * @return array Translation texts. |
2737 | 2737 | */ |
2738 | 2738 | function geodir_load_gd_options_text_translation($translation_texts = array()) { |
2739 | - $translation_texts = !empty( $translation_texts ) && is_array( $translation_texts ) ? $translation_texts : array(); |
|
2739 | + $translation_texts = !empty($translation_texts) && is_array($translation_texts) ? $translation_texts : array(); |
|
2740 | 2740 | |
2741 | 2741 | $gd_options = array('geodir_post_submited_success_email_subject_admin', 'geodir_post_submited_success_email_content_admin', 'geodir_post_submited_success_email_subject', 'geodir_post_submited_success_email_content', 'geodir_forgot_password_subject', 'geodir_forgot_password_content', 'geodir_registration_success_email_subject', 'geodir_registration_success_email_content', 'geodir_post_published_email_subject', 'geodir_post_published_email_content', 'geodir_email_enquiry_subject', 'geodir_email_enquiry_content', 'geodir_post_added_success_msg_content', 'geodir_post_edited_email_subject_admin', 'geodir_post_edited_email_content_admin'); |
2742 | 2742 | |
@@ -2802,17 +2802,17 @@ discard block |
||
2802 | 2802 | * @param array $args The array of menu arguments. |
2803 | 2803 | * @return array The modified arguments. |
2804 | 2804 | */ |
2805 | -function geodir_add_nav_menu_class( $args ) |
|
2805 | +function geodir_add_nav_menu_class($args) |
|
2806 | 2806 | { |
2807 | 2807 | |
2808 | - if(isset($args['menu_class'])){ |
|
2808 | + if (isset($args['menu_class'])) { |
|
2809 | 2809 | $args['menu_class'] = $args['menu_class']." gd-menu-z"; |
2810 | 2810 | } |
2811 | 2811 | |
2812 | 2812 | return $args; |
2813 | 2813 | } |
2814 | 2814 | |
2815 | -add_filter( 'wp_nav_menu_args', 'geodir_add_nav_menu_class' ); |
|
2815 | +add_filter('wp_nav_menu_args', 'geodir_add_nav_menu_class'); |
|
2816 | 2816 | |
2817 | 2817 | /** |
2818 | 2818 | * Filters WordPress locale ID. |
@@ -2852,10 +2852,10 @@ discard block |
||
2852 | 2852 | } |
2853 | 2853 | |
2854 | 2854 | add_action('geodir_after_save_listing', 'geodir_wpml_duplicate_listing', 100, 2); |
2855 | - add_action( 'geodir_edit_post_link_html', 'geodir_wpml_frontend_duplicate_listing', 0, 1 ); |
|
2856 | - add_action( 'geodir_after_search_form', 'geodir_wpml_add_language_input_field' ); |
|
2855 | + add_action('geodir_edit_post_link_html', 'geodir_wpml_frontend_duplicate_listing', 0, 1); |
|
2856 | + add_action('geodir_after_search_form', 'geodir_wpml_add_language_input_field'); |
|
2857 | 2857 | if (is_admin()) { |
2858 | - add_filter( 'geodir_design_settings', 'geodir_wpml_duplicate_settings', 10, 1 ); |
|
2858 | + add_filter('geodir_design_settings', 'geodir_wpml_duplicate_settings', 10, 1); |
|
2859 | 2859 | } |
2860 | 2860 | } |
2861 | 2861 | } |
@@ -2884,7 +2884,7 @@ discard block |
||
2884 | 2884 | } |
2885 | 2885 | |
2886 | 2886 | if (!empty($keep_vars)) { |
2887 | - foreach ( $languages as $code => $url) { |
|
2887 | + foreach ($languages as $code => $url) { |
|
2888 | 2888 | $filter_url = $url['url']; |
2889 | 2889 | |
2890 | 2890 | foreach ($keep_vars as $var) { |
@@ -2903,7 +2903,7 @@ discard block |
||
2903 | 2903 | |
2904 | 2904 | return $languages; |
2905 | 2905 | } |
2906 | -add_filter( 'icl_ls_languages', 'geodir_wpml_filter_ls_languages', 11, 1 ); |
|
2906 | +add_filter('icl_ls_languages', 'geodir_wpml_filter_ls_languages', 11, 1); |
|
2907 | 2907 | |
2908 | 2908 | /** |
2909 | 2909 | * Remove Yoast SEO hook if disabled on GD pages. |
@@ -2911,18 +2911,18 @@ discard block |
||
2911 | 2911 | * @since 1.6.18 |
2912 | 2912 | * |
2913 | 2913 | */ |
2914 | -function geodir_remove_yoast_seo_metas(){ |
|
2915 | - if ( class_exists( 'WPSEO_Frontend' ) && geodir_is_geodir_page() && geodir_disable_yoast_seo_metas() ) { |
|
2914 | +function geodir_remove_yoast_seo_metas() { |
|
2915 | + if (class_exists('WPSEO_Frontend') && geodir_is_geodir_page() && geodir_disable_yoast_seo_metas()) { |
|
2916 | 2916 | $wpseo = WPSEO_Frontend::get_instance(); |
2917 | 2917 | |
2918 | - remove_action( 'wp_head', array( $wpseo, 'metadesc' ), 6 ); |
|
2919 | - remove_action( 'wp_head', array( $wpseo, 'metakeywords' ), 11 ); |
|
2920 | - remove_filter( 'pre_get_document_title', array( $wpseo, 'title' ), 15 ); |
|
2921 | - remove_filter( 'wp_title', array( $wpseo, 'title' ), 15, 3 ); |
|
2922 | - remove_filter( 'thematic_doctitle', array( $wpseo, 'title' ), 15 ); |
|
2923 | - remove_filter( 'woo_title', array( $wpseo, 'fix_woo_title' ), 99 ); |
|
2918 | + remove_action('wp_head', array($wpseo, 'metadesc'), 6); |
|
2919 | + remove_action('wp_head', array($wpseo, 'metakeywords'), 11); |
|
2920 | + remove_filter('pre_get_document_title', array($wpseo, 'title'), 15); |
|
2921 | + remove_filter('wp_title', array($wpseo, 'title'), 15, 3); |
|
2922 | + remove_filter('thematic_doctitle', array($wpseo, 'title'), 15); |
|
2923 | + remove_filter('woo_title', array($wpseo, 'fix_woo_title'), 99); |
|
2924 | 2924 | |
2925 | - remove_action( 'template_redirect', 'wpseo_frontend_head_init', 999 ); |
|
2925 | + remove_action('template_redirect', 'wpseo_frontend_head_init', 999); |
|
2926 | 2926 | } |
2927 | 2927 | } |
2928 | 2928 | |
@@ -2937,22 +2937,22 @@ discard block |
||
2937 | 2937 | * |
2938 | 2938 | */ |
2939 | 2939 | function geodir_wpml_ajax_set_guest_lang() { |
2940 | - if ( geodir_is_wpml() && wpml_is_ajax() && !is_user_logged_in() ) { |
|
2941 | - if ( empty( $_GET['lang'] ) && !( !empty( $_SERVER['REQUEST_URI'] ) && preg_match( '@\.(css|js|png|jpg|gif|jpeg|bmp)@i', basename( preg_replace( '@\?.*$@', '', $_SERVER['REQUEST_URI'] ) ) ) ) ) { |
|
2940 | + if (geodir_is_wpml() && wpml_is_ajax() && !is_user_logged_in()) { |
|
2941 | + if (empty($_GET['lang']) && !(!empty($_SERVER['REQUEST_URI']) && preg_match('@\.(css|js|png|jpg|gif|jpeg|bmp)@i', basename(preg_replace('@\?.*$@', '', $_SERVER['REQUEST_URI']))))) { |
|
2942 | 2942 | global $sitepress; |
2943 | 2943 | |
2944 | 2944 | $referer = wp_get_referer(); |
2945 | 2945 | |
2946 | 2946 | $current_lang = $sitepress->get_current_language(); |
2947 | - $referrer_lang = $sitepress->get_language_from_url( $referer ); |
|
2947 | + $referrer_lang = $sitepress->get_language_from_url($referer); |
|
2948 | 2948 | |
2949 | - if ( $referrer_lang && $current_lang != $referrer_lang ) { |
|
2949 | + if ($referrer_lang && $current_lang != $referrer_lang) { |
|
2950 | 2950 | $_GET['lang'] = $referrer_lang; |
2951 | 2951 | } |
2952 | 2952 | } |
2953 | 2953 | } |
2954 | 2954 | } |
2955 | -add_action( 'plugins_loaded', 'geodir_wpml_ajax_set_guest_lang', -1 ); |
|
2955 | +add_action('plugins_loaded', 'geodir_wpml_ajax_set_guest_lang', -1); |
|
2956 | 2956 | |
2957 | 2957 | /** |
2958 | 2958 | * Change country slug czech-republic to czechia and redirect. |
@@ -2973,18 +2973,18 @@ discard block |
||
2973 | 2973 | } |
2974 | 2974 | |
2975 | 2975 | $redirect = false; |
2976 | - if (strpos($current_url, '/' . $search . '/') !== false) { |
|
2976 | + if (strpos($current_url, '/'.$search.'/') !== false) { |
|
2977 | 2977 | $redirect = true; |
2978 | - $current_url = preg_replace('/\/' . $search . '\//', '/' . $replace . '/', $current_url, 1); |
|
2978 | + $current_url = preg_replace('/\/'.$search.'\//', '/'.$replace.'/', $current_url, 1); |
|
2979 | 2979 | } |
2980 | 2980 | |
2981 | 2981 | if ($has_slash != "/") { |
2982 | 2982 | $current_url = trim($current_url, '/'); |
2983 | 2983 | } |
2984 | 2984 | |
2985 | - if (strpos($current_url, 'gd_country=' . $search) !== false) { |
|
2985 | + if (strpos($current_url, 'gd_country='.$search) !== false) { |
|
2986 | 2986 | $redirect = true; |
2987 | - $current_url = str_replace('gd_country=' . $search, 'gd_country=' . $replace, $current_url); |
|
2987 | + $current_url = str_replace('gd_country='.$search, 'gd_country='.$replace, $current_url); |
|
2988 | 2988 | } |
2989 | 2989 | |
2990 | 2990 | if ($redirect) { |
@@ -3010,10 +3010,10 @@ discard block |
||
3010 | 3010 | * @param int $post_parent Post parent ID |
3011 | 3011 | * @param string $original_slug The original post slug. |
3012 | 3012 | */ |
3013 | -function geodir_check_post_to_term_slug( $slug, $post_ID, $post_status, $post_type, $post_parent, $original_slug ) { |
|
3013 | +function geodir_check_post_to_term_slug($slug, $post_ID, $post_status, $post_type, $post_parent, $original_slug) { |
|
3014 | 3014 | global $wpdb, $sitepress; |
3015 | 3015 | |
3016 | - if ( $post_type && strpos( $post_type, 'gd_' ) === 0 ) { |
|
3016 | + if ($post_type && strpos($post_type, 'gd_') === 0) { |
|
3017 | 3017 | $wpml_post_join = ""; |
3018 | 3018 | $wpml_post_where = ""; |
3019 | 3019 | $wpml_term_join = ""; |
@@ -3027,28 +3027,28 @@ discard block |
||
3027 | 3027 | } |
3028 | 3028 | |
3029 | 3029 | $wpml_post_join = " JOIN {$wpdb->prefix}icl_translations AS icl_t ON p.ID = icl_t.element_id AND icl_t.element_type = CONCAT('post_', p.post_type)"; |
3030 | - $wpml_post_where = " AND icl_t.language_code = '" . $post_language ."'"; |
|
3030 | + $wpml_post_where = " AND icl_t.language_code = '".$post_language."'"; |
|
3031 | 3031 | |
3032 | 3032 | $wpml_term_join = " JOIN {$wpdb->prefix}icl_translations AS icl_t ON icl_t.element_id = tt.term_taxonomy_id AND icl_t.element_type = CONCAT('tax_', tt.taxonomy)"; |
3033 | - $wpml_term_where = " AND icl_t.language_code = '" . $post_language ."'"; |
|
3033 | + $wpml_term_where = " AND icl_t.language_code = '".$post_language."'"; |
|
3034 | 3034 | } |
3035 | 3035 | |
3036 | - $term_slug_check = $wpdb->get_var( $wpdb->prepare( "SELECT t.slug FROM $wpdb->terms AS t LEFT JOIN $wpdb->term_taxonomy AS tt ON tt.term_id = t.term_id {$wpml_term_join} WHERE t.slug = '%s' AND ( tt.taxonomy = '" . $post_type . "category' OR tt.taxonomy = '" . $post_type . "_tags' ) {$wpml_term_where} LIMIT 1", $slug ) ); |
|
3036 | + $term_slug_check = $wpdb->get_var($wpdb->prepare("SELECT t.slug FROM $wpdb->terms AS t LEFT JOIN $wpdb->term_taxonomy AS tt ON tt.term_id = t.term_id {$wpml_term_join} WHERE t.slug = '%s' AND ( tt.taxonomy = '".$post_type."category' OR tt.taxonomy = '".$post_type."_tags' ) {$wpml_term_where} LIMIT 1", $slug)); |
|
3037 | 3037 | |
3038 | - if ( $term_slug_check ) { |
|
3038 | + if ($term_slug_check) { |
|
3039 | 3039 | $suffix = 1; |
3040 | 3040 | |
3041 | 3041 | do { |
3042 | - $alt_slug = _truncate_post_slug( $original_slug, 200 - ( strlen( $suffix ) + 1 ) ) . "-$suffix"; |
|
3042 | + $alt_slug = _truncate_post_slug($original_slug, 200 - (strlen($suffix) + 1))."-$suffix"; |
|
3043 | 3043 | |
3044 | - $term_check = $wpdb->get_var( $wpdb->prepare( "SELECT t.slug FROM $wpdb->terms AS t LEFT JOIN $wpdb->term_taxonomy AS tt ON tt.term_id = t.term_id {$wpml_term_join} WHERE t.slug = '%s' AND ( tt.taxonomy = '" . $post_type . "category' OR tt.taxonomy = '" . $post_type . "_tags' ) {$wpml_term_where} LIMIT 1", $alt_slug ) ); |
|
3044 | + $term_check = $wpdb->get_var($wpdb->prepare("SELECT t.slug FROM $wpdb->terms AS t LEFT JOIN $wpdb->term_taxonomy AS tt ON tt.term_id = t.term_id {$wpml_term_join} WHERE t.slug = '%s' AND ( tt.taxonomy = '".$post_type."category' OR tt.taxonomy = '".$post_type."_tags' ) {$wpml_term_where} LIMIT 1", $alt_slug)); |
|
3045 | 3045 | |
3046 | - $post_check = !$term_check && $wpdb->get_var( $wpdb->prepare( "SELECT p.post_name FROM $wpdb->posts p {$wpml_post_join} WHERE p.post_name = %s AND p.post_type = %s AND p.ID != %d {$wpml_term_where} LIMIT 1", $alt_slug, $post_type, $post_ID ) ); |
|
3046 | + $post_check = !$term_check && $wpdb->get_var($wpdb->prepare("SELECT p.post_name FROM $wpdb->posts p {$wpml_post_join} WHERE p.post_name = %s AND p.post_type = %s AND p.ID != %d {$wpml_term_where} LIMIT 1", $alt_slug, $post_type, $post_ID)); |
|
3047 | 3047 | |
3048 | 3048 | $term_slug_check = $term_check || $post_check; |
3049 | 3049 | |
3050 | 3050 | $suffix++; |
3051 | - } while ( $term_slug_check ); |
|
3051 | + } while ($term_slug_check); |
|
3052 | 3052 | |
3053 | 3053 | $slug = $alt_slug; |
3054 | 3054 | } |
@@ -3056,7 +3056,7 @@ discard block |
||
3056 | 3056 | |
3057 | 3057 | return $slug; |
3058 | 3058 | } |
3059 | -add_filter( 'wp_unique_post_slug', 'geodir_check_post_to_term_slug', 101, 6 ); |
|
3059 | +add_filter('wp_unique_post_slug', 'geodir_check_post_to_term_slug', 101, 6); |
|
3060 | 3060 | |
3061 | 3061 | /** |
3062 | 3062 | * Check whether a post name with slug exists or not. |
@@ -3073,51 +3073,51 @@ discard block |
||
3073 | 3073 | * @param int $term_id The term ID. |
3074 | 3074 | * @return bool true when exists. false when not exists. |
3075 | 3075 | */ |
3076 | -function geodir_check_term_to_post_slug( $slug_exists, $slug, $term_id ) { |
|
3076 | +function geodir_check_term_to_post_slug($slug_exists, $slug, $term_id) { |
|
3077 | 3077 | global $wpdb, $gd_term_post_type, $gd_term_taxonomy, $sitepress; |
3078 | 3078 | |
3079 | - if ( $slug_exists ) { |
|
3079 | + if ($slug_exists) { |
|
3080 | 3080 | return $slug_exists; |
3081 | 3081 | } |
3082 | 3082 | |
3083 | - if ( !empty( $gd_term_taxonomy ) && isset($gd_term_taxonomy[$term_id]) ) { |
|
3083 | + if (!empty($gd_term_taxonomy) && isset($gd_term_taxonomy[$term_id])) { |
|
3084 | 3084 | $taxonomy = $gd_term_taxonomy[$term_id]; |
3085 | 3085 | } else { |
3086 | - $taxonomy = $wpdb->get_var( $wpdb->prepare( "SELECT taxonomy FROM $wpdb->term_taxonomy WHERE term_id = %d LIMIT 1", $term_id ) ); |
|
3086 | + $taxonomy = $wpdb->get_var($wpdb->prepare("SELECT taxonomy FROM $wpdb->term_taxonomy WHERE term_id = %d LIMIT 1", $term_id)); |
|
3087 | 3087 | $gd_term_taxonomy[$term_id] = $taxonomy; |
3088 | 3088 | } |
3089 | 3089 | |
3090 | - if ( empty($taxonomy) ) { |
|
3090 | + if (empty($taxonomy)) { |
|
3091 | 3091 | return $slug_exists; |
3092 | 3092 | } |
3093 | 3093 | |
3094 | - if ( !empty( $gd_term_post_type ) && $gd_term_post_type[$term_id] ) { |
|
3094 | + if (!empty($gd_term_post_type) && $gd_term_post_type[$term_id]) { |
|
3095 | 3095 | $post_type = $gd_term_post_type[$term_id]; |
3096 | 3096 | } else { |
3097 | - $taxonomy_obj = get_taxonomy( $taxonomy ); |
|
3098 | - $post_type = !empty( $taxonomy_obj->object_type ) ? $taxonomy_obj->object_type[0] : NULL; |
|
3097 | + $taxonomy_obj = get_taxonomy($taxonomy); |
|
3098 | + $post_type = !empty($taxonomy_obj->object_type) ? $taxonomy_obj->object_type[0] : NULL; |
|
3099 | 3099 | } |
3100 | 3100 | |
3101 | 3101 | $wpml_post_join = ""; |
3102 | 3102 | $wpml_post_where = ""; |
3103 | 3103 | |
3104 | 3104 | if (geodir_wpml_is_taxonomy_translated($taxonomy) || geodir_wpml_is_post_type_translated($post_type)) { |
3105 | - $term_language = $term_id ? geodir_get_language_for_element($term_id, 'tax_' . $taxonomy) : $sitepress->get_current_language(); |
|
3105 | + $term_language = $term_id ? geodir_get_language_for_element($term_id, 'tax_'.$taxonomy) : $sitepress->get_current_language(); |
|
3106 | 3106 | if (!$term_language) { |
3107 | 3107 | $term_language = $sitepress->get_current_language(); |
3108 | 3108 | } |
3109 | 3109 | |
3110 | 3110 | $wpml_post_join = " JOIN {$wpdb->prefix}icl_translations AS icl_t ON p.ID = icl_t.element_id AND icl_t.element_type = CONCAT('post_', p.post_type)"; |
3111 | - $wpml_post_where = " AND icl_t.language_code = '" . $term_language ."'"; |
|
3111 | + $wpml_post_where = " AND icl_t.language_code = '".$term_language."'"; |
|
3112 | 3112 | } |
3113 | 3113 | |
3114 | - if ( $post_type && $wpdb->get_var( $wpdb->prepare( "SELECT p.post_name FROM $wpdb->posts p {$wpml_post_join} WHERE p.post_name = %s AND p.post_type = %s {$wpml_post_where} LIMIT 1", $slug, $post_type ) ) ) { |
|
3114 | + if ($post_type && $wpdb->get_var($wpdb->prepare("SELECT p.post_name FROM $wpdb->posts p {$wpml_post_join} WHERE p.post_name = %s AND p.post_type = %s {$wpml_post_where} LIMIT 1", $slug, $post_type))) { |
|
3115 | 3115 | $slug_exists = true; |
3116 | 3116 | } |
3117 | 3117 | |
3118 | 3118 | return $slug_exists; |
3119 | 3119 | } |
3120 | -add_filter( 'geodir_term_slug_is_exists', 'geodir_check_term_to_post_slug', 10, 3 ); |
|
3120 | +add_filter('geodir_term_slug_is_exists', 'geodir_check_term_to_post_slug', 10, 3); |
|
3121 | 3121 | |
3122 | 3122 | /** |
3123 | 3123 | * Add hidden WPML language input field. |
@@ -3131,7 +3131,7 @@ discard block |
||
3131 | 3131 | function geodir_wpml_add_language_input_field() { |
3132 | 3132 | global $sitepress; |
3133 | 3133 | |
3134 | - if ( function_exists( 'wpml_add_language_form_field_action' ) && WPML_LANGUAGE_NEGOTIATION_TYPE_PARAMETER === (int) $sitepress->get_setting( 'language_negotiation_type' ) ) { |
|
3134 | + if (function_exists('wpml_add_language_form_field_action') && WPML_LANGUAGE_NEGOTIATION_TYPE_PARAMETER === (int) $sitepress->get_setting('language_negotiation_type')) { |
|
3135 | 3135 | wpml_add_language_form_field_action(); |
3136 | 3136 | } |
3137 | 3137 | } |
3138 | 3138 | \ No newline at end of file |
@@ -36,175 +36,175 @@ discard block |
||
36 | 36 | */ |
37 | 37 | function geodir_templates_scripts() |
38 | 38 | { |
39 | - $is_detail_page = false; |
|
40 | - $geodir_map_name = geodir_map_name(); |
|
39 | + $is_detail_page = false; |
|
40 | + $geodir_map_name = geodir_map_name(); |
|
41 | 41 | |
42 | - if((is_single() && geodir_is_geodir_page()) || (is_page() && geodir_is_page('preview') )) { |
|
43 | - $is_detail_page = true; |
|
44 | - } |
|
45 | - |
|
46 | - wp_enqueue_script('jquery'); |
|
47 | - |
|
48 | - wp_register_script('geodirectory-script', geodir_plugin_url() . '/geodirectory-assets/js/geodirectory.min.js', array(), GEODIRECTORY_VERSION); |
|
49 | - wp_enqueue_script('geodirectory-script'); |
|
50 | - |
|
51 | - $geodir_vars_data = array( |
|
52 | - 'siteurl' => get_option('siteurl'), |
|
53 | - 'geodir_plugin_url' => geodir_plugin_url(), |
|
54 | - 'geodir_lazy_load' => get_option('geodir_lazy_load',1), |
|
55 | - 'geodir_ajax_url' => geodir_get_ajax_url(), |
|
56 | - 'geodir_gd_modal' => (int)get_option('geodir_disable_gb_modal'), |
|
57 | - 'is_rtl' => is_rtl() ? 1 : 0 // fix rtl issue |
|
58 | - ); |
|
59 | - |
|
60 | - /** |
|
61 | - * Filter the `geodir_var` data array that outputs the wp_localize_script() translations and variables. |
|
62 | - * |
|
63 | - * This is used by addons to add JS translatable variables. |
|
64 | - * |
|
65 | - * @since 1.4.4 |
|
66 | - * @param array $geodir_vars_data { |
|
67 | - * geodir var data used by addons to add JS translatable variables. |
|
68 | - * |
|
69 | - * @type string $siteurl Site url. |
|
70 | - * @type string $geodir_plugin_url Geodirectory core plugin url. |
|
71 | - * @type string $geodir_ajax_url Geodirectory plugin ajax url. |
|
72 | - * @type int $geodir_gd_modal Disable GD modal that displays slideshow images in popup?. |
|
73 | - * @type int $is_rtl Checks if current locale is RTL. |
|
74 | - * |
|
75 | - * } |
|
76 | - */ |
|
77 | - $geodir_vars_data = apply_filters('geodir_vars_data',$geodir_vars_data); |
|
78 | - |
|
79 | - wp_localize_script('geodirectory-script', 'geodir_var', $geodir_vars_data); |
|
80 | - |
|
81 | - wp_register_script('geodirectory-jquery-flexslider-js', geodir_plugin_url() . '/geodirectory-assets/js/jquery.flexslider.min.js', array(), GEODIRECTORY_VERSION,true); |
|
82 | - if($is_detail_page){wp_enqueue_script('geodirectory-jquery-flexslider-js');} |
|
83 | - |
|
84 | - wp_register_script('geodirectory-lightbox-jquery', geodir_plugin_url() . '/geodirectory-assets/js/jquery.lightbox-0.5.min.js', array(), GEODIRECTORY_VERSION,true); |
|
85 | - wp_enqueue_script('geodirectory-lightbox-jquery'); |
|
42 | + if((is_single() && geodir_is_geodir_page()) || (is_page() && geodir_is_page('preview') )) { |
|
43 | + $is_detail_page = true; |
|
44 | + } |
|
86 | 45 | |
87 | - wp_register_script('geodirectory-jquery-simplemodal', geodir_plugin_url() . '/geodirectory-assets/js/jquery.simplemodal.min.js', array(), GEODIRECTORY_VERSION,true); |
|
88 | - if ($is_detail_page) { |
|
89 | - wp_enqueue_script('geodirectory-jquery-simplemodal'); |
|
90 | - } |
|
46 | + wp_enqueue_script('jquery'); |
|
47 | + |
|
48 | + wp_register_script('geodirectory-script', geodir_plugin_url() . '/geodirectory-assets/js/geodirectory.min.js', array(), GEODIRECTORY_VERSION); |
|
49 | + wp_enqueue_script('geodirectory-script'); |
|
50 | + |
|
51 | + $geodir_vars_data = array( |
|
52 | + 'siteurl' => get_option('siteurl'), |
|
53 | + 'geodir_plugin_url' => geodir_plugin_url(), |
|
54 | + 'geodir_lazy_load' => get_option('geodir_lazy_load',1), |
|
55 | + 'geodir_ajax_url' => geodir_get_ajax_url(), |
|
56 | + 'geodir_gd_modal' => (int)get_option('geodir_disable_gb_modal'), |
|
57 | + 'is_rtl' => is_rtl() ? 1 : 0 // fix rtl issue |
|
58 | + ); |
|
59 | + |
|
60 | + /** |
|
61 | + * Filter the `geodir_var` data array that outputs the wp_localize_script() translations and variables. |
|
62 | + * |
|
63 | + * This is used by addons to add JS translatable variables. |
|
64 | + * |
|
65 | + * @since 1.4.4 |
|
66 | + * @param array $geodir_vars_data { |
|
67 | + * geodir var data used by addons to add JS translatable variables. |
|
68 | + * |
|
69 | + * @type string $siteurl Site url. |
|
70 | + * @type string $geodir_plugin_url Geodirectory core plugin url. |
|
71 | + * @type string $geodir_ajax_url Geodirectory plugin ajax url. |
|
72 | + * @type int $geodir_gd_modal Disable GD modal that displays slideshow images in popup?. |
|
73 | + * @type int $is_rtl Checks if current locale is RTL. |
|
74 | + * |
|
75 | + * } |
|
76 | + */ |
|
77 | + $geodir_vars_data = apply_filters('geodir_vars_data',$geodir_vars_data); |
|
78 | + |
|
79 | + wp_localize_script('geodirectory-script', 'geodir_var', $geodir_vars_data); |
|
80 | + |
|
81 | + wp_register_script('geodirectory-jquery-flexslider-js', geodir_plugin_url() . '/geodirectory-assets/js/jquery.flexslider.min.js', array(), GEODIRECTORY_VERSION,true); |
|
82 | + if($is_detail_page){wp_enqueue_script('geodirectory-jquery-flexslider-js');} |
|
83 | + |
|
84 | + wp_register_script('geodirectory-lightbox-jquery', geodir_plugin_url() . '/geodirectory-assets/js/jquery.lightbox-0.5.min.js', array(), GEODIRECTORY_VERSION,true); |
|
85 | + wp_enqueue_script('geodirectory-lightbox-jquery'); |
|
86 | + |
|
87 | + wp_register_script('geodirectory-jquery-simplemodal', geodir_plugin_url() . '/geodirectory-assets/js/jquery.simplemodal.min.js', array(), GEODIRECTORY_VERSION,true); |
|
88 | + if ($is_detail_page) { |
|
89 | + wp_enqueue_script('geodirectory-jquery-simplemodal'); |
|
90 | + } |
|
91 | 91 | |
92 | - if (in_array($geodir_map_name, array('auto', 'google'))) { |
|
93 | - $map_lang = "&language=" . geodir_get_map_default_language(); |
|
94 | - $map_key = "&key=" . geodir_get_map_api_key(); |
|
95 | - /** |
|
96 | - * Filter the variables that are added to the end of the google maps script call. |
|
97 | - * |
|
98 | - * This i used to change things like google maps language etc. |
|
99 | - * |
|
100 | - * @since 1.0.0 |
|
101 | - * @param string $var The string to filter, default is empty string. |
|
102 | - */ |
|
103 | - $map_extra = apply_filters('geodir_googlemap_script_extra', ''); |
|
104 | - wp_enqueue_script('google-maps-api', 'https://maps.google.com/maps/api/js?' . $map_lang . $map_key . $map_extra , '', NULL); |
|
92 | + if (in_array($geodir_map_name, array('auto', 'google'))) { |
|
93 | + $map_lang = "&language=" . geodir_get_map_default_language(); |
|
94 | + $map_key = "&key=" . geodir_get_map_api_key(); |
|
95 | + /** |
|
96 | + * Filter the variables that are added to the end of the google maps script call. |
|
97 | + * |
|
98 | + * This i used to change things like google maps language etc. |
|
99 | + * |
|
100 | + * @since 1.0.0 |
|
101 | + * @param string $var The string to filter, default is empty string. |
|
102 | + */ |
|
103 | + $map_extra = apply_filters('geodir_googlemap_script_extra', ''); |
|
104 | + wp_enqueue_script('google-maps-api', 'https://maps.google.com/maps/api/js?' . $map_lang . $map_key . $map_extra , '', NULL); |
|
105 | 105 | |
106 | - // Overlapping Marker Spiderfier |
|
107 | - wp_register_script('geodirectory-g-overlappingmarker-script', geodir_plugin_url() . '/geodirectory-assets/jawj/oms.min.js', array(), GEODIRECTORY_VERSION); |
|
108 | - wp_enqueue_script('geodirectory-g-overlappingmarker-script'); |
|
109 | - } |
|
106 | + // Overlapping Marker Spiderfier |
|
107 | + wp_register_script('geodirectory-g-overlappingmarker-script', geodir_plugin_url() . '/geodirectory-assets/jawj/oms.min.js', array(), GEODIRECTORY_VERSION); |
|
108 | + wp_enqueue_script('geodirectory-g-overlappingmarker-script'); |
|
109 | + } |
|
110 | 110 | |
111 | - if ($geodir_map_name == 'osm') { |
|
112 | - // Leaflet OpenStreetMap |
|
113 | - wp_register_style('geodirectory-leaflet-style', geodir_plugin_url() . '/geodirectory-assets/leaflet/leaflet.css', array(), GEODIRECTORY_VERSION); |
|
114 | - wp_enqueue_style('geodirectory-leaflet-style'); |
|
111 | + if ($geodir_map_name == 'osm') { |
|
112 | + // Leaflet OpenStreetMap |
|
113 | + wp_register_style('geodirectory-leaflet-style', geodir_plugin_url() . '/geodirectory-assets/leaflet/leaflet.css', array(), GEODIRECTORY_VERSION); |
|
114 | + wp_enqueue_style('geodirectory-leaflet-style'); |
|
115 | 115 | |
116 | - wp_register_script('geodirectory-leaflet-script', geodir_plugin_url() . '/geodirectory-assets/leaflet/leaflet.min.js', array(), GEODIRECTORY_VERSION); |
|
117 | - wp_enqueue_script('geodirectory-leaflet-script'); |
|
116 | + wp_register_script('geodirectory-leaflet-script', geodir_plugin_url() . '/geodirectory-assets/leaflet/leaflet.min.js', array(), GEODIRECTORY_VERSION); |
|
117 | + wp_enqueue_script('geodirectory-leaflet-script'); |
|
118 | 118 | |
119 | - wp_register_script('geodirectory-leaflet-geo-script', geodir_plugin_url() . '/geodirectory-assets/leaflet/osm.geocode.min.js', array(), GEODIRECTORY_VERSION); |
|
120 | - wp_enqueue_script('geodirectory-leaflet-geo-script'); |
|
119 | + wp_register_script('geodirectory-leaflet-geo-script', geodir_plugin_url() . '/geodirectory-assets/leaflet/osm.geocode.min.js', array(), GEODIRECTORY_VERSION); |
|
120 | + wp_enqueue_script('geodirectory-leaflet-geo-script'); |
|
121 | 121 | |
122 | - if ($is_detail_page) { |
|
123 | - wp_register_style('geodirectory-leaflet-routing-style', geodir_plugin_url() . '/geodirectory-assets/leaflet/routing/leaflet-routing-machine.css', array(), GEODIRECTORY_VERSION); |
|
124 | - wp_enqueue_style('geodirectory-leaflet-routing-style'); |
|
122 | + if ($is_detail_page) { |
|
123 | + wp_register_style('geodirectory-leaflet-routing-style', geodir_plugin_url() . '/geodirectory-assets/leaflet/routing/leaflet-routing-machine.css', array(), GEODIRECTORY_VERSION); |
|
124 | + wp_enqueue_style('geodirectory-leaflet-routing-style'); |
|
125 | 125 | |
126 | - wp_register_script('geodirectory-leaflet-routing-script', geodir_plugin_url() . '/geodirectory-assets/leaflet/routing/leaflet-routing-machine.min.js', array(), GEODIRECTORY_VERSION); |
|
127 | - wp_enqueue_script('geodirectory-leaflet-routing-script'); |
|
128 | - } |
|
126 | + wp_register_script('geodirectory-leaflet-routing-script', geodir_plugin_url() . '/geodirectory-assets/leaflet/routing/leaflet-routing-machine.min.js', array(), GEODIRECTORY_VERSION); |
|
127 | + wp_enqueue_script('geodirectory-leaflet-routing-script'); |
|
128 | + } |
|
129 | 129 | |
130 | - // Overlapping Marker Spiderfier Leaflet |
|
131 | - wp_register_script('geodirectory-o-overlappingmarker-script', geodir_plugin_url() . '/geodirectory-assets/jawj/oms-leaflet.min.js', array(), GEODIRECTORY_VERSION); |
|
132 | - wp_enqueue_script('geodirectory-o-overlappingmarker-script'); |
|
133 | - } |
|
134 | - wp_enqueue_script( 'jquery-ui-autocomplete' ); |
|
130 | + // Overlapping Marker Spiderfier Leaflet |
|
131 | + wp_register_script('geodirectory-o-overlappingmarker-script', geodir_plugin_url() . '/geodirectory-assets/jawj/oms-leaflet.min.js', array(), GEODIRECTORY_VERSION); |
|
132 | + wp_enqueue_script('geodirectory-o-overlappingmarker-script'); |
|
133 | + } |
|
134 | + wp_enqueue_script( 'jquery-ui-autocomplete' ); |
|
135 | 135 | |
136 | - wp_register_script('geodirectory-goMap-script', geodir_plugin_url() . '/geodirectory-assets/js/goMap.min.js', array(), GEODIRECTORY_VERSION, true); |
|
137 | - wp_enqueue_script('geodirectory-goMap-script'); |
|
138 | - |
|
139 | - wp_register_script('chosen', geodir_plugin_url() . '/geodirectory-assets/js/chosen.jquery.min.js', array(), GEODIRECTORY_VERSION); |
|
140 | - wp_enqueue_script('chosen'); |
|
141 | - |
|
142 | - wp_register_script('geodirectory-choose-ajax', geodir_plugin_url() . '/geodirectory-assets/js/ajax-chosen.min.js', array(), GEODIRECTORY_VERSION); |
|
143 | - wp_enqueue_script('geodirectory-choose-ajax'); |
|
144 | - |
|
145 | - wp_enqueue_script('geodirectory-jquery-ui-timepicker-js', geodir_plugin_url() . '/geodirectory-assets/js/jquery.ui.timepicker.min.js', array('jquery-ui-datepicker', 'jquery-ui-slider', 'jquery-effects-core', 'jquery-effects-slide'), '', true); |
|
146 | - |
|
147 | - if (is_page() && geodir_is_page('add-listing')) { |
|
148 | - // SCRIPT FOR UPLOAD |
|
149 | - wp_enqueue_script('plupload-all'); |
|
150 | - wp_enqueue_script('jquery-ui-sortable'); |
|
151 | - |
|
152 | - wp_register_script('geodirectory-plupload-script', geodir_plugin_url() . '/geodirectory-assets/js/geodirectory-plupload.min.js#asyncload', array(), GEODIRECTORY_VERSION,true); |
|
153 | - wp_enqueue_script('geodirectory-plupload-script'); |
|
154 | - // SCRIPT FOR UPLOAD END |
|
155 | - |
|
156 | - // check_ajax_referer function is used to make sure no files are uplaoded remotly but it will fail if used between https and non https so we do the check below of the urls |
|
157 | - if (str_replace("https", "http", admin_url('admin-ajax.php')) && !empty($_SERVER['HTTPS'])) { |
|
158 | - $ajax_url = admin_url('admin-ajax.php'); |
|
159 | - } elseif (!str_replace("https", "http", admin_url('admin-ajax.php')) && empty($_SERVER['HTTPS'])) { |
|
160 | - $ajax_url = admin_url('admin-ajax.php'); |
|
161 | - } elseif (str_replace("https", "http", admin_url('admin-ajax.php')) && empty($_SERVER['HTTPS'])) { |
|
162 | - $ajax_url = str_replace("https", "http", admin_url('admin-ajax.php')); |
|
163 | - } elseif (!str_replace("https", "http", admin_url('admin-ajax.php')) && !empty($_SERVER['HTTPS'])) { |
|
164 | - $ajax_url = str_replace("http", "https", admin_url('admin-ajax.php')); |
|
165 | - } else { |
|
166 | - $ajax_url = admin_url('admin-ajax.php'); |
|
167 | - } |
|
136 | + wp_register_script('geodirectory-goMap-script', geodir_plugin_url() . '/geodirectory-assets/js/goMap.min.js', array(), GEODIRECTORY_VERSION, true); |
|
137 | + wp_enqueue_script('geodirectory-goMap-script'); |
|
138 | + |
|
139 | + wp_register_script('chosen', geodir_plugin_url() . '/geodirectory-assets/js/chosen.jquery.min.js', array(), GEODIRECTORY_VERSION); |
|
140 | + wp_enqueue_script('chosen'); |
|
141 | + |
|
142 | + wp_register_script('geodirectory-choose-ajax', geodir_plugin_url() . '/geodirectory-assets/js/ajax-chosen.min.js', array(), GEODIRECTORY_VERSION); |
|
143 | + wp_enqueue_script('geodirectory-choose-ajax'); |
|
144 | + |
|
145 | + wp_enqueue_script('geodirectory-jquery-ui-timepicker-js', geodir_plugin_url() . '/geodirectory-assets/js/jquery.ui.timepicker.min.js', array('jquery-ui-datepicker', 'jquery-ui-slider', 'jquery-effects-core', 'jquery-effects-slide'), '', true); |
|
146 | + |
|
147 | + if (is_page() && geodir_is_page('add-listing')) { |
|
148 | + // SCRIPT FOR UPLOAD |
|
149 | + wp_enqueue_script('plupload-all'); |
|
150 | + wp_enqueue_script('jquery-ui-sortable'); |
|
151 | + |
|
152 | + wp_register_script('geodirectory-plupload-script', geodir_plugin_url() . '/geodirectory-assets/js/geodirectory-plupload.min.js#asyncload', array(), GEODIRECTORY_VERSION,true); |
|
153 | + wp_enqueue_script('geodirectory-plupload-script'); |
|
154 | + // SCRIPT FOR UPLOAD END |
|
155 | + |
|
156 | + // check_ajax_referer function is used to make sure no files are uplaoded remotly but it will fail if used between https and non https so we do the check below of the urls |
|
157 | + if (str_replace("https", "http", admin_url('admin-ajax.php')) && !empty($_SERVER['HTTPS'])) { |
|
158 | + $ajax_url = admin_url('admin-ajax.php'); |
|
159 | + } elseif (!str_replace("https", "http", admin_url('admin-ajax.php')) && empty($_SERVER['HTTPS'])) { |
|
160 | + $ajax_url = admin_url('admin-ajax.php'); |
|
161 | + } elseif (str_replace("https", "http", admin_url('admin-ajax.php')) && empty($_SERVER['HTTPS'])) { |
|
162 | + $ajax_url = str_replace("https", "http", admin_url('admin-ajax.php')); |
|
163 | + } elseif (!str_replace("https", "http", admin_url('admin-ajax.php')) && !empty($_SERVER['HTTPS'])) { |
|
164 | + $ajax_url = str_replace("http", "https", admin_url('admin-ajax.php')); |
|
165 | + } else { |
|
166 | + $ajax_url = admin_url('admin-ajax.php'); |
|
167 | + } |
|
168 | 168 | |
169 | - // place js config array for plupload |
|
170 | - $plupload_init = array( |
|
171 | - 'runtimes' => 'html5,silverlight,browserplus,gears,html4', |
|
172 | - 'browse_button' => 'plupload-browse-button', // will be adjusted per uploader |
|
173 | - 'container' => 'plupload-upload-ui', // will be adjusted per uploader |
|
174 | - 'drop_element' => 'dropbox', // will be adjusted per uploader |
|
175 | - 'file_data_name' => 'async-upload', // will be adjusted per uploader |
|
176 | - 'multiple_queues' => true, |
|
177 | - 'max_file_size' => geodir_max_upload_size(), |
|
178 | - 'url' => $ajax_url, |
|
179 | - 'flash_swf_url' => includes_url('js/plupload/plupload.flash.swf'), |
|
180 | - 'silverlight_xap_url' => includes_url('js/plupload/plupload.silverlight.xap'), |
|
181 | - 'filters' => array(array('title' => __('Allowed Files', 'geodirectory'), 'extensions' => '*')), |
|
182 | - 'multipart' => true, |
|
183 | - 'urlstream_upload' => true, |
|
184 | - 'multi_selection' => false, // will be added per uploader |
|
185 | - // additional post data to send to our ajax hook |
|
186 | - 'multipart_params' => array( |
|
187 | - '_ajax_nonce' => "", // will be added per uploader |
|
188 | - 'action' => 'plupload_action', // the ajax action name |
|
189 | - 'imgid' => 0 // will be added per uploader |
|
190 | - ) |
|
191 | - ); |
|
192 | - $base_plupload_config = json_encode($plupload_init); |
|
193 | - |
|
194 | - $gd_plupload_init = array('base_plupload_config' => $base_plupload_config, |
|
195 | - 'upload_img_size' => geodir_max_upload_size()); |
|
196 | - |
|
197 | - wp_localize_script('geodirectory-plupload-script', 'gd_plupload', $gd_plupload_init); |
|
198 | - |
|
199 | - wp_enqueue_script('geodirectory-listing-validation-script', geodir_plugin_url() . '/geodirectory-assets/js/listing_validation.min.js#asyncload'); |
|
200 | - } // End if for add place page |
|
201 | - |
|
202 | - wp_register_script('geodirectory-post-custom-js', geodir_plugin_url() . '/geodirectory-assets/js/post.custom.min.js#asyncload', array(), GEODIRECTORY_VERSION, true); |
|
203 | - if ($is_detail_page) { |
|
169 | + // place js config array for plupload |
|
170 | + $plupload_init = array( |
|
171 | + 'runtimes' => 'html5,silverlight,browserplus,gears,html4', |
|
172 | + 'browse_button' => 'plupload-browse-button', // will be adjusted per uploader |
|
173 | + 'container' => 'plupload-upload-ui', // will be adjusted per uploader |
|
174 | + 'drop_element' => 'dropbox', // will be adjusted per uploader |
|
175 | + 'file_data_name' => 'async-upload', // will be adjusted per uploader |
|
176 | + 'multiple_queues' => true, |
|
177 | + 'max_file_size' => geodir_max_upload_size(), |
|
178 | + 'url' => $ajax_url, |
|
179 | + 'flash_swf_url' => includes_url('js/plupload/plupload.flash.swf'), |
|
180 | + 'silverlight_xap_url' => includes_url('js/plupload/plupload.silverlight.xap'), |
|
181 | + 'filters' => array(array('title' => __('Allowed Files', 'geodirectory'), 'extensions' => '*')), |
|
182 | + 'multipart' => true, |
|
183 | + 'urlstream_upload' => true, |
|
184 | + 'multi_selection' => false, // will be added per uploader |
|
185 | + // additional post data to send to our ajax hook |
|
186 | + 'multipart_params' => array( |
|
187 | + '_ajax_nonce' => "", // will be added per uploader |
|
188 | + 'action' => 'plupload_action', // the ajax action name |
|
189 | + 'imgid' => 0 // will be added per uploader |
|
190 | + ) |
|
191 | + ); |
|
192 | + $base_plupload_config = json_encode($plupload_init); |
|
193 | + |
|
194 | + $gd_plupload_init = array('base_plupload_config' => $base_plupload_config, |
|
195 | + 'upload_img_size' => geodir_max_upload_size()); |
|
196 | + |
|
197 | + wp_localize_script('geodirectory-plupload-script', 'gd_plupload', $gd_plupload_init); |
|
198 | + |
|
199 | + wp_enqueue_script('geodirectory-listing-validation-script', geodir_plugin_url() . '/geodirectory-assets/js/listing_validation.min.js#asyncload'); |
|
200 | + } // End if for add place page |
|
201 | + |
|
202 | + wp_register_script('geodirectory-post-custom-js', geodir_plugin_url() . '/geodirectory-assets/js/post.custom.min.js#asyncload', array(), GEODIRECTORY_VERSION, true); |
|
203 | + if ($is_detail_page) { |
|
204 | 204 | wp_enqueue_script('geodirectory-post-custom-js'); |
205 | 205 | } |
206 | 206 | |
207 | - // font awesome rating script |
|
207 | + // font awesome rating script |
|
208 | 208 | if (get_option('geodir_reviewrating_enable_font_awesome')) { |
209 | 209 | wp_register_script('geodir-barrating-js', geodir_plugin_url() . '/geodirectory-assets/js/jquery.barrating.min.js', array(), GEODIRECTORY_VERSION, true); |
210 | 210 | wp_enqueue_script('geodir-barrating-js'); |
@@ -213,11 +213,11 @@ discard block |
||
213 | 213 | wp_enqueue_script('geodir-jRating-js'); |
214 | 214 | } |
215 | 215 | |
216 | - wp_register_script('geodir-on-document-load', geodir_plugin_url() . '/geodirectory-assets/js/on_document_load.min.js#asyncload', array(), GEODIRECTORY_VERSION, true); |
|
217 | - wp_enqueue_script('geodir-on-document-load'); |
|
216 | + wp_register_script('geodir-on-document-load', geodir_plugin_url() . '/geodirectory-assets/js/on_document_load.min.js#asyncload', array(), GEODIRECTORY_VERSION, true); |
|
217 | + wp_enqueue_script('geodir-on-document-load'); |
|
218 | 218 | |
219 | - wp_register_script('google-geometa', geodir_plugin_url() . '/geodirectory-assets/js/geometa.min.js#asyncload', array(), GEODIRECTORY_VERSION, true); |
|
220 | - wp_enqueue_script('google-geometa'); |
|
219 | + wp_register_script('google-geometa', geodir_plugin_url() . '/geodirectory-assets/js/geometa.min.js#asyncload', array(), GEODIRECTORY_VERSION, true); |
|
220 | + wp_enqueue_script('google-geometa'); |
|
221 | 221 | } |
222 | 222 | |
223 | 223 | /** |
@@ -231,8 +231,8 @@ discard block |
||
231 | 231 | */ |
232 | 232 | function geodir_header_scripts() |
233 | 233 | { |
234 | - echo '<style>' . stripslashes(get_option('geodir_coustem_css')) . '</style>'; |
|
235 | - echo stripslashes(get_option('geodir_header_scripts')); |
|
234 | + echo '<style>' . stripslashes(get_option('geodir_coustem_css')) . '</style>'; |
|
235 | + echo stripslashes(get_option('geodir_header_scripts')); |
|
236 | 236 | } |
237 | 237 | |
238 | 238 | /** |
@@ -245,7 +245,7 @@ discard block |
||
245 | 245 | */ |
246 | 246 | function geodir_google_analytics_tracking_code() |
247 | 247 | { |
248 | - if(get_option('geodir_ga_add_tracking_code') && get_option('geodir_ga_account_id')){?> |
|
248 | + if(get_option('geodir_ga_add_tracking_code') && get_option('geodir_ga_account_id')){?> |
|
249 | 249 | |
250 | 250 | <script> |
251 | 251 | (function(i,s,o,g,r,a,m){ i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){ |
@@ -260,9 +260,9 @@ discard block |
||
260 | 260 | </script> |
261 | 261 | |
262 | 262 | <?php |
263 | - }elseif( get_option('geodir_ga_add_tracking_code') && get_option('geodir_ga_tracking_code') && !get_option('geodir_ga_account_id')){ |
|
264 | - echo stripslashes(get_option('geodir_ga_tracking_code')); |
|
265 | - } |
|
263 | + }elseif( get_option('geodir_ga_add_tracking_code') && get_option('geodir_ga_tracking_code') && !get_option('geodir_ga_account_id')){ |
|
264 | + echo stripslashes(get_option('geodir_ga_tracking_code')); |
|
265 | + } |
|
266 | 266 | } |
267 | 267 | |
268 | 268 | /** |
@@ -276,16 +276,16 @@ discard block |
||
276 | 276 | function geodir_footer_scripts() |
277 | 277 | { |
278 | 278 | |
279 | - echo stripslashes(get_option('geodir_footer_scripts')); |
|
279 | + echo stripslashes(get_option('geodir_footer_scripts')); |
|
280 | 280 | |
281 | - /* |
|
281 | + /* |
|
282 | 282 | * Apple suck and can't/won't fix bugs: https://bugs.webkit.org/show_bug.cgi?id=136041 |
283 | 283 | * |
284 | 284 | * Flexbox wont wrap on ios for search form items |
285 | 285 | */ |
286 | - if ( !empty( $_SERVER['HTTP_USER_AGENT'] ) && preg_match( '/iPad|iPod|iPhone|Safari/', $_SERVER['HTTP_USER_AGENT'] ) ) { |
|
287 | - echo "<style>body .geodir-listing-search.gd-search-bar-style .geodir-loc-bar .clearfix.geodir-loc-bar-in .geodir-search .gd-search-input-wrapper{flex:50 1 auto !important;min-width: initial !important;width:auto !important;}.geodir-filter-container .geodir-filter-cat{width:auto !important;}</style>"; |
|
288 | - } |
|
286 | + if ( !empty( $_SERVER['HTTP_USER_AGENT'] ) && preg_match( '/iPad|iPod|iPhone|Safari/', $_SERVER['HTTP_USER_AGENT'] ) ) { |
|
287 | + echo "<style>body .geodir-listing-search.gd-search-bar-style .geodir-loc-bar .clearfix.geodir-loc-bar-in .geodir-search .gd-search-input-wrapper{flex:50 1 auto !important;min-width: initial !important;width:auto !important;}.geodir-filter-container .geodir-filter-cat{width:auto !important;}</style>"; |
|
288 | + } |
|
289 | 289 | } |
290 | 290 | |
291 | 291 | |
@@ -299,12 +299,12 @@ discard block |
||
299 | 299 | */ |
300 | 300 | function geodir_add_async_forscript($url) |
301 | 301 | { |
302 | - if (strpos($url, '#asyncload')===false) |
|
303 | - return $url; |
|
304 | - else if (is_admin()) |
|
305 | - return str_replace('#asyncload', '', $url); |
|
306 | - else |
|
307 | - return str_replace('#asyncload', '', $url)."' async='async"; |
|
302 | + if (strpos($url, '#asyncload')===false) |
|
303 | + return $url; |
|
304 | + else if (is_admin()) |
|
305 | + return str_replace('#asyncload', '', $url); |
|
306 | + else |
|
307 | + return str_replace('#asyncload', '', $url)."' async='async"; |
|
308 | 308 | } |
309 | 309 | add_filter('clean_url', 'geodir_add_async_forscript', 11, 1); |
310 | 310 | |
@@ -317,17 +317,17 @@ discard block |
||
317 | 317 | function geodir_templates_styles() |
318 | 318 | { |
319 | 319 | |
320 | - wp_register_style('geodir-core-scss', geodir_plugin_url() . '/geodirectory-assets/css/gd_core_frontend.css', array(), GEODIRECTORY_VERSION); |
|
321 | - wp_enqueue_style('geodir-core-scss'); |
|
322 | - wp_register_style('geodir-core-scss-footer', geodir_plugin_url() . '/geodirectory-assets/css/gd_core_frontend_footer.css', array(), GEODIRECTORY_VERSION); |
|
320 | + wp_register_style('geodir-core-scss', geodir_plugin_url() . '/geodirectory-assets/css/gd_core_frontend.css', array(), GEODIRECTORY_VERSION); |
|
321 | + wp_enqueue_style('geodir-core-scss'); |
|
322 | + wp_register_style('geodir-core-scss-footer', geodir_plugin_url() . '/geodirectory-assets/css/gd_core_frontend_footer.css', array(), GEODIRECTORY_VERSION); |
|
323 | 323 | |
324 | - if(is_rtl()){ |
|
325 | - wp_register_style('geodirectory-frontend-rtl-style', geodir_plugin_url() . '/geodirectory-assets/css/rtl-frontend.css', array(), GEODIRECTORY_VERSION); |
|
326 | - wp_enqueue_style('geodirectory-frontend-rtl-style'); |
|
327 | - } |
|
324 | + if(is_rtl()){ |
|
325 | + wp_register_style('geodirectory-frontend-rtl-style', geodir_plugin_url() . '/geodirectory-assets/css/rtl-frontend.css', array(), GEODIRECTORY_VERSION); |
|
326 | + wp_enqueue_style('geodirectory-frontend-rtl-style'); |
|
327 | + } |
|
328 | 328 | |
329 | - wp_register_style('font-awesome', '//maxcdn.bootstrapcdn.com/font-awesome/4.6.3/css/font-awesome.min.css', array(), GEODIRECTORY_VERSION); |
|
330 | - wp_enqueue_style('font-awesome'); |
|
329 | + wp_register_style('font-awesome', '//maxcdn.bootstrapcdn.com/font-awesome/4.6.3/css/font-awesome.min.css', array(), GEODIRECTORY_VERSION); |
|
330 | + wp_enqueue_style('font-awesome'); |
|
331 | 331 | |
332 | 332 | |
333 | 333 | } |
@@ -341,7 +341,7 @@ discard block |
||
341 | 341 | */ |
342 | 342 | function geodir_get_sidebar() |
343 | 343 | { |
344 | - get_sidebar('geodirectory'); |
|
344 | + get_sidebar('geodirectory'); |
|
345 | 345 | } |
346 | 346 | |
347 | 347 | /** |
@@ -360,122 +360,122 @@ discard block |
||
360 | 360 | * @param bool $always_show Do you want to show the pagination always? Default: false. |
361 | 361 | */ |
362 | 362 | function geodir_pagination($before = '', $after = '', $prelabel = '', $nxtlabel = '', $pages_to_show = 5, $always_show = false) { |
363 | - global $wp_query, $posts_per_page, $wpdb, $paged, $blog_id; |
|
363 | + global $wp_query, $posts_per_page, $wpdb, $paged, $blog_id; |
|
364 | 364 | |
365 | - if (empty($prelabel)) { |
|
366 | - $prelabel = '<strong><</strong>'; |
|
367 | - } |
|
365 | + if (empty($prelabel)) { |
|
366 | + $prelabel = '<strong><</strong>'; |
|
367 | + } |
|
368 | 368 | |
369 | - if (empty($nxtlabel)) { |
|
370 | - $nxtlabel = '<strong>></strong>'; |
|
371 | - } |
|
369 | + if (empty($nxtlabel)) { |
|
370 | + $nxtlabel = '<strong>></strong>'; |
|
371 | + } |
|
372 | 372 | |
373 | - $half_pages_to_show = round($pages_to_show / 2); |
|
373 | + $half_pages_to_show = round($pages_to_show / 2); |
|
374 | 374 | |
375 | - if (geodir_is_page('home')) // dont apply default pagination for geodirectory home page. |
|
376 | - return; |
|
375 | + if (geodir_is_page('home')) // dont apply default pagination for geodirectory home page. |
|
376 | + return; |
|
377 | 377 | |
378 | - if (!is_single()) { |
|
379 | - if (function_exists('geodir_location_geo_home_link')) { |
|
380 | - remove_filter('home_url', 'geodir_location_geo_home_link', 100000); |
|
381 | - } |
|
382 | - $numposts = $wp_query->found_posts; |
|
378 | + if (!is_single()) { |
|
379 | + if (function_exists('geodir_location_geo_home_link')) { |
|
380 | + remove_filter('home_url', 'geodir_location_geo_home_link', 100000); |
|
381 | + } |
|
382 | + $numposts = $wp_query->found_posts; |
|
383 | 383 | |
384 | - $max_page = ceil($numposts / $posts_per_page); |
|
384 | + $max_page = ceil($numposts / $posts_per_page); |
|
385 | 385 | |
386 | - if (empty($paged)) { |
|
387 | - $paged = 1; |
|
388 | - } |
|
386 | + if (empty($paged)) { |
|
387 | + $paged = 1; |
|
388 | + } |
|
389 | 389 | |
390 | - $post_type = geodir_get_current_posttype(); |
|
391 | - $listing_type_name = get_post_type_plural_label($post_type); |
|
392 | - if (geodir_is_page('listing') || geodir_is_page('search')) { |
|
393 | - $term = array(); |
|
390 | + $post_type = geodir_get_current_posttype(); |
|
391 | + $listing_type_name = get_post_type_plural_label($post_type); |
|
392 | + if (geodir_is_page('listing') || geodir_is_page('search')) { |
|
393 | + $term = array(); |
|
394 | 394 | |
395 | - if (is_tax()) { |
|
396 | - $term_id = get_queried_object_id(); |
|
397 | - $taxonomy = get_query_var('taxonomy'); |
|
395 | + if (is_tax()) { |
|
396 | + $term_id = get_queried_object_id(); |
|
397 | + $taxonomy = get_query_var('taxonomy'); |
|
398 | 398 | |
399 | - if ($term_id && $post_type && get_query_var('taxonomy') == $post_type . 'category' ) { |
|
400 | - $term = get_term($term_id, $post_type . 'category'); |
|
401 | - } |
|
402 | - } |
|
399 | + if ($term_id && $post_type && get_query_var('taxonomy') == $post_type . 'category' ) { |
|
400 | + $term = get_term($term_id, $post_type . 'category'); |
|
401 | + } |
|
402 | + } |
|
403 | 403 | |
404 | - if (geodir_is_page('search') && !empty($_REQUEST['s' . $post_type . 'category'])) { |
|
405 | - $taxonomy_search = $_REQUEST['s' . $post_type . 'category']; |
|
404 | + if (geodir_is_page('search') && !empty($_REQUEST['s' . $post_type . 'category'])) { |
|
405 | + $taxonomy_search = $_REQUEST['s' . $post_type . 'category']; |
|
406 | 406 | |
407 | - if (!is_array($taxonomy_search)) { |
|
408 | - $term = get_term((int)$taxonomy_search, $post_type . 'category'); |
|
409 | - } else if(is_array($taxonomy_search) && count($taxonomy_search) == 1) { // single category search |
|
410 | - $term = get_term((int)$taxonomy_search[0], $post_type . 'category'); |
|
411 | - } |
|
412 | - } |
|
407 | + if (!is_array($taxonomy_search)) { |
|
408 | + $term = get_term((int)$taxonomy_search, $post_type . 'category'); |
|
409 | + } else if(is_array($taxonomy_search) && count($taxonomy_search) == 1) { // single category search |
|
410 | + $term = get_term((int)$taxonomy_search[0], $post_type . 'category'); |
|
411 | + } |
|
412 | + } |
|
413 | 413 | |
414 | - if (!empty($term) && !is_wp_error($term)) { |
|
415 | - $listing_type_name = $term->name; |
|
416 | - } |
|
417 | - } |
|
414 | + if (!empty($term) && !is_wp_error($term)) { |
|
415 | + $listing_type_name = $term->name; |
|
416 | + } |
|
417 | + } |
|
418 | 418 | |
419 | - if ($max_page > 1 || $always_show) { |
|
420 | - // Extra pagination info |
|
421 | - $geodir_pagination_more_info = get_option('geodir_pagination_advance_info'); |
|
422 | - $start_no = ( $paged - 1 ) * $posts_per_page + 1; |
|
423 | - $end_no = min($paged * $posts_per_page, $numposts); |
|
419 | + if ($max_page > 1 || $always_show) { |
|
420 | + // Extra pagination info |
|
421 | + $geodir_pagination_more_info = get_option('geodir_pagination_advance_info'); |
|
422 | + $start_no = ( $paged - 1 ) * $posts_per_page + 1; |
|
423 | + $end_no = min($paged * $posts_per_page, $numposts); |
|
424 | 424 | |
425 | - if ($geodir_pagination_more_info != '') { |
|
426 | - if ($listing_type_name) { |
|
427 | - $listing_type_name = __($listing_type_name, 'geodirectory'); |
|
428 | - $pegination_desc = wp_sprintf(__('Showing %s %d-%d of %d', 'geodirectory'), $listing_type_name, $start_no, $end_no, $numposts); |
|
429 | - } else { |
|
430 | - $pegination_desc = wp_sprintf(__('Showing listings %d-%d of %d', 'geodirectory'), $start_no, $end_no, $numposts); |
|
431 | - } |
|
432 | - $pagination_info = '<div class="gd-pagination-details">' . $pegination_desc . '</div>'; |
|
433 | - /** |
|
434 | - * Adds an extra pagination info above/under pagination. |
|
435 | - * |
|
436 | - * @since 1.5.9 |
|
437 | - * |
|
438 | - * @param string $pagination_info Extra pagination info content. |
|
439 | - * @param string $listing_type_name Listing results type. |
|
440 | - * @param string $start_no First result number. |
|
441 | - * @param string $end_no Last result number. |
|
442 | - * @param string $numposts Total number of listings. |
|
443 | - * @param string $post_type The post type. |
|
444 | - */ |
|
445 | - $pagination_info = apply_filters('geodir_pagination_advance_info', $pagination_info, $listing_type_name, $start_no, $end_no, $numposts, $post_type); |
|
425 | + if ($geodir_pagination_more_info != '') { |
|
426 | + if ($listing_type_name) { |
|
427 | + $listing_type_name = __($listing_type_name, 'geodirectory'); |
|
428 | + $pegination_desc = wp_sprintf(__('Showing %s %d-%d of %d', 'geodirectory'), $listing_type_name, $start_no, $end_no, $numposts); |
|
429 | + } else { |
|
430 | + $pegination_desc = wp_sprintf(__('Showing listings %d-%d of %d', 'geodirectory'), $start_no, $end_no, $numposts); |
|
431 | + } |
|
432 | + $pagination_info = '<div class="gd-pagination-details">' . $pegination_desc . '</div>'; |
|
433 | + /** |
|
434 | + * Adds an extra pagination info above/under pagination. |
|
435 | + * |
|
436 | + * @since 1.5.9 |
|
437 | + * |
|
438 | + * @param string $pagination_info Extra pagination info content. |
|
439 | + * @param string $listing_type_name Listing results type. |
|
440 | + * @param string $start_no First result number. |
|
441 | + * @param string $end_no Last result number. |
|
442 | + * @param string $numposts Total number of listings. |
|
443 | + * @param string $post_type The post type. |
|
444 | + */ |
|
445 | + $pagination_info = apply_filters('geodir_pagination_advance_info', $pagination_info, $listing_type_name, $start_no, $end_no, $numposts, $post_type); |
|
446 | 446 | |
447 | - if ($geodir_pagination_more_info == 'before') { |
|
448 | - $before = $before . $pagination_info; |
|
449 | - } else if ($geodir_pagination_more_info == 'after') { |
|
450 | - $after = $pagination_info . $after; |
|
451 | - } |
|
452 | - } |
|
447 | + if ($geodir_pagination_more_info == 'before') { |
|
448 | + $before = $before . $pagination_info; |
|
449 | + } else if ($geodir_pagination_more_info == 'after') { |
|
450 | + $after = $pagination_info . $after; |
|
451 | + } |
|
452 | + } |
|
453 | 453 | |
454 | - echo "$before <div class='Navi gd-navi'>"; |
|
455 | - if ($paged >= ($pages_to_show - 1)) { |
|
456 | - echo '<a href="' . str_replace('&paged', '&paged', get_pagenum_link()) . '">«</a>'; |
|
457 | - } |
|
458 | - previous_posts_link($prelabel); |
|
459 | - for ($i = $paged - $half_pages_to_show; $i <= $paged + $half_pages_to_show; $i++) { |
|
460 | - if ($i >= 1 && $i <= $max_page) { |
|
461 | - if ($i == $paged) { |
|
462 | - echo "<strong class='on'>$i</strong>"; |
|
463 | - } else { |
|
464 | - echo ' <a href="' . str_replace('&paged', '&paged', get_pagenum_link($i)) . '">' . $i . '</a> '; |
|
465 | - } |
|
466 | - } |
|
467 | - } |
|
468 | - next_posts_link($nxtlabel, $max_page); |
|
469 | - if (($paged + $half_pages_to_show) < ($max_page)) { |
|
470 | - echo '<a href="' . str_replace('&paged', '&paged', get_pagenum_link($max_page)) . '">»</a>'; |
|
471 | - } |
|
472 | - echo "</div> $after"; |
|
473 | - } |
|
454 | + echo "$before <div class='Navi gd-navi'>"; |
|
455 | + if ($paged >= ($pages_to_show - 1)) { |
|
456 | + echo '<a href="' . str_replace('&paged', '&paged', get_pagenum_link()) . '">«</a>'; |
|
457 | + } |
|
458 | + previous_posts_link($prelabel); |
|
459 | + for ($i = $paged - $half_pages_to_show; $i <= $paged + $half_pages_to_show; $i++) { |
|
460 | + if ($i >= 1 && $i <= $max_page) { |
|
461 | + if ($i == $paged) { |
|
462 | + echo "<strong class='on'>$i</strong>"; |
|
463 | + } else { |
|
464 | + echo ' <a href="' . str_replace('&paged', '&paged', get_pagenum_link($i)) . '">' . $i . '</a> '; |
|
465 | + } |
|
466 | + } |
|
467 | + } |
|
468 | + next_posts_link($nxtlabel, $max_page); |
|
469 | + if (($paged + $half_pages_to_show) < ($max_page)) { |
|
470 | + echo '<a href="' . str_replace('&paged', '&paged', get_pagenum_link($max_page)) . '">»</a>'; |
|
471 | + } |
|
472 | + echo "</div> $after"; |
|
473 | + } |
|
474 | 474 | |
475 | - if (function_exists('geodir_location_geo_home_link')) { |
|
476 | - add_filter('home_url', 'geodir_location_geo_home_link', 100000, 2); |
|
477 | - } |
|
478 | - } |
|
475 | + if (function_exists('geodir_location_geo_home_link')) { |
|
476 | + add_filter('home_url', 'geodir_location_geo_home_link', 100000, 2); |
|
477 | + } |
|
478 | + } |
|
479 | 479 | } |
480 | 480 | |
481 | 481 | /** |
@@ -486,20 +486,20 @@ discard block |
||
486 | 486 | */ |
487 | 487 | function geodir_listingsearch_scripts() |
488 | 488 | { |
489 | - if (get_option('gd_search_dist') != '') { |
|
490 | - $dist = get_option('gd_search_dist'); |
|
491 | - } else { |
|
492 | - $dist = 500; |
|
493 | - } |
|
494 | - $dist_dif = 1000; |
|
495 | - |
|
496 | - if ($dist <= 5000) $dist_dif = 500; |
|
497 | - if ($dist <= 1000) $dist_dif = 100; |
|
498 | - if ($dist <= 500) $dist_dif = 50; |
|
499 | - if ($dist <= 100) $dist_dif = 10; |
|
500 | - if ($dist <= 50) $dist_dif = 5; |
|
501 | - |
|
502 | - ?> |
|
489 | + if (get_option('gd_search_dist') != '') { |
|
490 | + $dist = get_option('gd_search_dist'); |
|
491 | + } else { |
|
492 | + $dist = 500; |
|
493 | + } |
|
494 | + $dist_dif = 1000; |
|
495 | + |
|
496 | + if ($dist <= 5000) $dist_dif = 500; |
|
497 | + if ($dist <= 1000) $dist_dif = 100; |
|
498 | + if ($dist <= 500) $dist_dif = 50; |
|
499 | + if ($dist <= 100) $dist_dif = 10; |
|
500 | + if ($dist <= 50) $dist_dif = 5; |
|
501 | + |
|
502 | + ?> |
|
503 | 503 | <script type="text/javascript"> |
504 | 504 | |
505 | 505 | jQuery(function ($) { |
@@ -557,20 +557,20 @@ discard block |
||
557 | 557 | * @package GeoDirectory |
558 | 558 | */ |
559 | 559 | function geodir_add_sharelocation_scripts() { |
560 | - $default_search_for_text = SEARCH_FOR_TEXT; |
|
561 | - if (get_option('geodir_search_field_default_text')) |
|
562 | - $default_search_for_text = __(get_option('geodir_search_field_default_text'), 'geodirectory'); |
|
560 | + $default_search_for_text = SEARCH_FOR_TEXT; |
|
561 | + if (get_option('geodir_search_field_default_text')) |
|
562 | + $default_search_for_text = __(get_option('geodir_search_field_default_text'), 'geodirectory'); |
|
563 | 563 | |
564 | - $default_near_text = NEAR_TEXT; |
|
565 | - if (get_option('geodir_near_field_default_text')) |
|
566 | - $default_near_text = __(get_option('geodir_near_field_default_text'), 'geodirectory'); |
|
564 | + $default_near_text = NEAR_TEXT; |
|
565 | + if (get_option('geodir_near_field_default_text')) |
|
566 | + $default_near_text = __(get_option('geodir_near_field_default_text'), 'geodirectory'); |
|
567 | 567 | |
568 | - $search_location = geodir_get_default_location(); |
|
568 | + $search_location = geodir_get_default_location(); |
|
569 | 569 | |
570 | - $default_search_for_text = addslashes(stripslashes($default_search_for_text)); |
|
571 | - $default_near_text = addslashes(stripslashes($default_near_text)); |
|
572 | - $city = !empty($search_location) ? addslashes(stripslashes($search_location->city)) : ''; |
|
573 | - ?> |
|
570 | + $default_search_for_text = addslashes(stripslashes($default_search_for_text)); |
|
571 | + $default_near_text = addslashes(stripslashes($default_near_text)); |
|
572 | + $city = !empty($search_location) ? addslashes(stripslashes($search_location->city)) : ''; |
|
573 | + ?> |
|
574 | 574 | <script type="text/javascript"> |
575 | 575 | var default_location = '<?php echo $city ;?>'; |
576 | 576 | var latlng; |
@@ -651,14 +651,14 @@ discard block |
||
651 | 651 | initialise2(); |
652 | 652 | } else { |
653 | 653 | <?php |
654 | - $near_add = get_option('geodir_search_near_addition'); |
|
655 | - /** |
|
656 | - * Adds any extra info to the near search box query when trying to geolocate it via google api. |
|
657 | - * |
|
658 | - * @since 1.0.0 |
|
659 | - */ |
|
660 | - $near_add2 = apply_filters('geodir_search_near_addition', ''); |
|
661 | - ?> |
|
654 | + $near_add = get_option('geodir_search_near_addition'); |
|
655 | + /** |
|
656 | + * Adds any extra info to the near search box query when trying to geolocate it via google api. |
|
657 | + * |
|
658 | + * @since 1.0.0 |
|
659 | + */ |
|
660 | + $near_add2 = apply_filters('geodir_search_near_addition', ''); |
|
661 | + ?> |
|
662 | 662 | if (window.gdMaps === 'google') { |
663 | 663 | Sgeocoder.geocode({'address': address<?php echo ($near_add ? '+", ' . $near_add . '"' : '') . $near_add2;?>}, |
664 | 664 | function (results, status) { |
@@ -772,32 +772,32 @@ discard block |
||
772 | 772 | */ |
773 | 773 | function geodir_show_badges_on_image($which, $post, $link) |
774 | 774 | { |
775 | - $return = ''; |
|
776 | - switch ($which) { |
|
777 | - case 'featured': |
|
778 | - /** |
|
779 | - * Filter the featured image badge html that appears in the listings pages over the thumbnail. |
|
780 | - * |
|
781 | - * @since 1.0.0 |
|
782 | - * @param object $post The post object. |
|
783 | - * @param string $link The link to the post. |
|
784 | - */ |
|
785 | - $return = apply_filters('geodir_featured_badge_on_image', '<a href="' . $link . '"><span class="geodir_featured_img"> </span></a>',$post,$link); |
|
786 | - break; |
|
787 | - case 'new' : |
|
788 | - /** |
|
789 | - * Filter the new image badge html that appears in the listings pages over the thumbnail. |
|
790 | - * |
|
791 | - * @since 1.0.0 |
|
792 | - * @param object $post The post object. |
|
793 | - * @param string $link The link to the post. |
|
794 | - */ |
|
795 | - $return = apply_filters('geodir_new_badge_on_image', '<a href="' . $link . '"><span class="geodir_new_listing"> </span></a>',$post,$link); |
|
796 | - break; |
|
797 | - |
|
798 | - } |
|
775 | + $return = ''; |
|
776 | + switch ($which) { |
|
777 | + case 'featured': |
|
778 | + /** |
|
779 | + * Filter the featured image badge html that appears in the listings pages over the thumbnail. |
|
780 | + * |
|
781 | + * @since 1.0.0 |
|
782 | + * @param object $post The post object. |
|
783 | + * @param string $link The link to the post. |
|
784 | + */ |
|
785 | + $return = apply_filters('geodir_featured_badge_on_image', '<a href="' . $link . '"><span class="geodir_featured_img"> </span></a>',$post,$link); |
|
786 | + break; |
|
787 | + case 'new' : |
|
788 | + /** |
|
789 | + * Filter the new image badge html that appears in the listings pages over the thumbnail. |
|
790 | + * |
|
791 | + * @since 1.0.0 |
|
792 | + * @param object $post The post object. |
|
793 | + * @param string $link The link to the post. |
|
794 | + */ |
|
795 | + $return = apply_filters('geodir_new_badge_on_image', '<a href="' . $link . '"><span class="geodir_new_listing"> </span></a>',$post,$link); |
|
796 | + break; |
|
797 | + |
|
798 | + } |
|
799 | 799 | |
800 | - return $return; |
|
800 | + return $return; |
|
801 | 801 | } |
802 | 802 | |
803 | 803 | /** |
@@ -806,8 +806,8 @@ discard block |
||
806 | 806 | * @since 1.6.22 |
807 | 807 | */ |
808 | 808 | function geodir_fix_script_conflict() { |
809 | - if ( wp_script_is( 'flexslider', 'enqueued' ) && wp_script_is( 'geodirectory-jquery-flexslider-js', 'enqueued' ) ) { |
|
810 | - wp_dequeue_script( 'flexslider' ); |
|
811 | - } |
|
809 | + if ( wp_script_is( 'flexslider', 'enqueued' ) && wp_script_is( 'geodirectory-jquery-flexslider-js', 'enqueued' ) ) { |
|
810 | + wp_dequeue_script( 'flexslider' ); |
|
811 | + } |
|
812 | 812 | } |
813 | 813 | add_action( 'wp_enqueue_scripts', 'geodir_fix_script_conflict', 100 ); |
814 | 814 | \ No newline at end of file |
@@ -39,21 +39,21 @@ discard block |
||
39 | 39 | $is_detail_page = false; |
40 | 40 | $geodir_map_name = geodir_map_name(); |
41 | 41 | |
42 | - if((is_single() && geodir_is_geodir_page()) || (is_page() && geodir_is_page('preview') )) { |
|
42 | + if ((is_single() && geodir_is_geodir_page()) || (is_page() && geodir_is_page('preview'))) { |
|
43 | 43 | $is_detail_page = true; |
44 | 44 | } |
45 | 45 | |
46 | 46 | wp_enqueue_script('jquery'); |
47 | 47 | |
48 | - wp_register_script('geodirectory-script', geodir_plugin_url() . '/geodirectory-assets/js/geodirectory.min.js', array(), GEODIRECTORY_VERSION); |
|
48 | + wp_register_script('geodirectory-script', geodir_plugin_url().'/geodirectory-assets/js/geodirectory.min.js', array(), GEODIRECTORY_VERSION); |
|
49 | 49 | wp_enqueue_script('geodirectory-script'); |
50 | 50 | |
51 | 51 | $geodir_vars_data = array( |
52 | 52 | 'siteurl' => get_option('siteurl'), |
53 | 53 | 'geodir_plugin_url' => geodir_plugin_url(), |
54 | - 'geodir_lazy_load' => get_option('geodir_lazy_load',1), |
|
54 | + 'geodir_lazy_load' => get_option('geodir_lazy_load', 1), |
|
55 | 55 | 'geodir_ajax_url' => geodir_get_ajax_url(), |
56 | - 'geodir_gd_modal' => (int)get_option('geodir_disable_gb_modal'), |
|
56 | + 'geodir_gd_modal' => (int) get_option('geodir_disable_gb_modal'), |
|
57 | 57 | 'is_rtl' => is_rtl() ? 1 : 0 // fix rtl issue |
58 | 58 | ); |
59 | 59 | |
@@ -74,24 +74,24 @@ discard block |
||
74 | 74 | * |
75 | 75 | * } |
76 | 76 | */ |
77 | - $geodir_vars_data = apply_filters('geodir_vars_data',$geodir_vars_data); |
|
77 | + $geodir_vars_data = apply_filters('geodir_vars_data', $geodir_vars_data); |
|
78 | 78 | |
79 | 79 | wp_localize_script('geodirectory-script', 'geodir_var', $geodir_vars_data); |
80 | 80 | |
81 | - wp_register_script('geodirectory-jquery-flexslider-js', geodir_plugin_url() . '/geodirectory-assets/js/jquery.flexslider.min.js', array(), GEODIRECTORY_VERSION,true); |
|
82 | - if($is_detail_page){wp_enqueue_script('geodirectory-jquery-flexslider-js');} |
|
81 | + wp_register_script('geodirectory-jquery-flexslider-js', geodir_plugin_url().'/geodirectory-assets/js/jquery.flexslider.min.js', array(), GEODIRECTORY_VERSION, true); |
|
82 | + if ($is_detail_page) {wp_enqueue_script('geodirectory-jquery-flexslider-js'); } |
|
83 | 83 | |
84 | - wp_register_script('geodirectory-lightbox-jquery', geodir_plugin_url() . '/geodirectory-assets/js/jquery.lightbox-0.5.min.js', array(), GEODIRECTORY_VERSION,true); |
|
84 | + wp_register_script('geodirectory-lightbox-jquery', geodir_plugin_url().'/geodirectory-assets/js/jquery.lightbox-0.5.min.js', array(), GEODIRECTORY_VERSION, true); |
|
85 | 85 | wp_enqueue_script('geodirectory-lightbox-jquery'); |
86 | 86 | |
87 | - wp_register_script('geodirectory-jquery-simplemodal', geodir_plugin_url() . '/geodirectory-assets/js/jquery.simplemodal.min.js', array(), GEODIRECTORY_VERSION,true); |
|
87 | + wp_register_script('geodirectory-jquery-simplemodal', geodir_plugin_url().'/geodirectory-assets/js/jquery.simplemodal.min.js', array(), GEODIRECTORY_VERSION, true); |
|
88 | 88 | if ($is_detail_page) { |
89 | 89 | wp_enqueue_script('geodirectory-jquery-simplemodal'); |
90 | 90 | } |
91 | 91 | |
92 | 92 | if (in_array($geodir_map_name, array('auto', 'google'))) { |
93 | - $map_lang = "&language=" . geodir_get_map_default_language(); |
|
94 | - $map_key = "&key=" . geodir_get_map_api_key(); |
|
93 | + $map_lang = "&language=".geodir_get_map_default_language(); |
|
94 | + $map_key = "&key=".geodir_get_map_api_key(); |
|
95 | 95 | /** |
96 | 96 | * Filter the variables that are added to the end of the google maps script call. |
97 | 97 | * |
@@ -101,55 +101,55 @@ discard block |
||
101 | 101 | * @param string $var The string to filter, default is empty string. |
102 | 102 | */ |
103 | 103 | $map_extra = apply_filters('geodir_googlemap_script_extra', ''); |
104 | - wp_enqueue_script('google-maps-api', 'https://maps.google.com/maps/api/js?' . $map_lang . $map_key . $map_extra , '', NULL); |
|
104 | + wp_enqueue_script('google-maps-api', 'https://maps.google.com/maps/api/js?'.$map_lang.$map_key.$map_extra, '', NULL); |
|
105 | 105 | |
106 | 106 | // Overlapping Marker Spiderfier |
107 | - wp_register_script('geodirectory-g-overlappingmarker-script', geodir_plugin_url() . '/geodirectory-assets/jawj/oms.min.js', array(), GEODIRECTORY_VERSION); |
|
107 | + wp_register_script('geodirectory-g-overlappingmarker-script', geodir_plugin_url().'/geodirectory-assets/jawj/oms.min.js', array(), GEODIRECTORY_VERSION); |
|
108 | 108 | wp_enqueue_script('geodirectory-g-overlappingmarker-script'); |
109 | 109 | } |
110 | 110 | |
111 | 111 | if ($geodir_map_name == 'osm') { |
112 | 112 | // Leaflet OpenStreetMap |
113 | - wp_register_style('geodirectory-leaflet-style', geodir_plugin_url() . '/geodirectory-assets/leaflet/leaflet.css', array(), GEODIRECTORY_VERSION); |
|
113 | + wp_register_style('geodirectory-leaflet-style', geodir_plugin_url().'/geodirectory-assets/leaflet/leaflet.css', array(), GEODIRECTORY_VERSION); |
|
114 | 114 | wp_enqueue_style('geodirectory-leaflet-style'); |
115 | 115 | |
116 | - wp_register_script('geodirectory-leaflet-script', geodir_plugin_url() . '/geodirectory-assets/leaflet/leaflet.min.js', array(), GEODIRECTORY_VERSION); |
|
116 | + wp_register_script('geodirectory-leaflet-script', geodir_plugin_url().'/geodirectory-assets/leaflet/leaflet.min.js', array(), GEODIRECTORY_VERSION); |
|
117 | 117 | wp_enqueue_script('geodirectory-leaflet-script'); |
118 | 118 | |
119 | - wp_register_script('geodirectory-leaflet-geo-script', geodir_plugin_url() . '/geodirectory-assets/leaflet/osm.geocode.min.js', array(), GEODIRECTORY_VERSION); |
|
119 | + wp_register_script('geodirectory-leaflet-geo-script', geodir_plugin_url().'/geodirectory-assets/leaflet/osm.geocode.min.js', array(), GEODIRECTORY_VERSION); |
|
120 | 120 | wp_enqueue_script('geodirectory-leaflet-geo-script'); |
121 | 121 | |
122 | 122 | if ($is_detail_page) { |
123 | - wp_register_style('geodirectory-leaflet-routing-style', geodir_plugin_url() . '/geodirectory-assets/leaflet/routing/leaflet-routing-machine.css', array(), GEODIRECTORY_VERSION); |
|
123 | + wp_register_style('geodirectory-leaflet-routing-style', geodir_plugin_url().'/geodirectory-assets/leaflet/routing/leaflet-routing-machine.css', array(), GEODIRECTORY_VERSION); |
|
124 | 124 | wp_enqueue_style('geodirectory-leaflet-routing-style'); |
125 | 125 | |
126 | - wp_register_script('geodirectory-leaflet-routing-script', geodir_plugin_url() . '/geodirectory-assets/leaflet/routing/leaflet-routing-machine.min.js', array(), GEODIRECTORY_VERSION); |
|
126 | + wp_register_script('geodirectory-leaflet-routing-script', geodir_plugin_url().'/geodirectory-assets/leaflet/routing/leaflet-routing-machine.min.js', array(), GEODIRECTORY_VERSION); |
|
127 | 127 | wp_enqueue_script('geodirectory-leaflet-routing-script'); |
128 | 128 | } |
129 | 129 | |
130 | 130 | // Overlapping Marker Spiderfier Leaflet |
131 | - wp_register_script('geodirectory-o-overlappingmarker-script', geodir_plugin_url() . '/geodirectory-assets/jawj/oms-leaflet.min.js', array(), GEODIRECTORY_VERSION); |
|
131 | + wp_register_script('geodirectory-o-overlappingmarker-script', geodir_plugin_url().'/geodirectory-assets/jawj/oms-leaflet.min.js', array(), GEODIRECTORY_VERSION); |
|
132 | 132 | wp_enqueue_script('geodirectory-o-overlappingmarker-script'); |
133 | 133 | } |
134 | - wp_enqueue_script( 'jquery-ui-autocomplete' ); |
|
134 | + wp_enqueue_script('jquery-ui-autocomplete'); |
|
135 | 135 | |
136 | - wp_register_script('geodirectory-goMap-script', geodir_plugin_url() . '/geodirectory-assets/js/goMap.min.js', array(), GEODIRECTORY_VERSION, true); |
|
136 | + wp_register_script('geodirectory-goMap-script', geodir_plugin_url().'/geodirectory-assets/js/goMap.min.js', array(), GEODIRECTORY_VERSION, true); |
|
137 | 137 | wp_enqueue_script('geodirectory-goMap-script'); |
138 | 138 | |
139 | - wp_register_script('chosen', geodir_plugin_url() . '/geodirectory-assets/js/chosen.jquery.min.js', array(), GEODIRECTORY_VERSION); |
|
139 | + wp_register_script('chosen', geodir_plugin_url().'/geodirectory-assets/js/chosen.jquery.min.js', array(), GEODIRECTORY_VERSION); |
|
140 | 140 | wp_enqueue_script('chosen'); |
141 | 141 | |
142 | - wp_register_script('geodirectory-choose-ajax', geodir_plugin_url() . '/geodirectory-assets/js/ajax-chosen.min.js', array(), GEODIRECTORY_VERSION); |
|
142 | + wp_register_script('geodirectory-choose-ajax', geodir_plugin_url().'/geodirectory-assets/js/ajax-chosen.min.js', array(), GEODIRECTORY_VERSION); |
|
143 | 143 | wp_enqueue_script('geodirectory-choose-ajax'); |
144 | 144 | |
145 | - wp_enqueue_script('geodirectory-jquery-ui-timepicker-js', geodir_plugin_url() . '/geodirectory-assets/js/jquery.ui.timepicker.min.js', array('jquery-ui-datepicker', 'jquery-ui-slider', 'jquery-effects-core', 'jquery-effects-slide'), '', true); |
|
145 | + wp_enqueue_script('geodirectory-jquery-ui-timepicker-js', geodir_plugin_url().'/geodirectory-assets/js/jquery.ui.timepicker.min.js', array('jquery-ui-datepicker', 'jquery-ui-slider', 'jquery-effects-core', 'jquery-effects-slide'), '', true); |
|
146 | 146 | |
147 | 147 | if (is_page() && geodir_is_page('add-listing')) { |
148 | 148 | // SCRIPT FOR UPLOAD |
149 | 149 | wp_enqueue_script('plupload-all'); |
150 | 150 | wp_enqueue_script('jquery-ui-sortable'); |
151 | 151 | |
152 | - wp_register_script('geodirectory-plupload-script', geodir_plugin_url() . '/geodirectory-assets/js/geodirectory-plupload.min.js#asyncload', array(), GEODIRECTORY_VERSION,true); |
|
152 | + wp_register_script('geodirectory-plupload-script', geodir_plugin_url().'/geodirectory-assets/js/geodirectory-plupload.min.js#asyncload', array(), GEODIRECTORY_VERSION, true); |
|
153 | 153 | wp_enqueue_script('geodirectory-plupload-script'); |
154 | 154 | // SCRIPT FOR UPLOAD END |
155 | 155 | |
@@ -196,27 +196,27 @@ discard block |
||
196 | 196 | |
197 | 197 | wp_localize_script('geodirectory-plupload-script', 'gd_plupload', $gd_plupload_init); |
198 | 198 | |
199 | - wp_enqueue_script('geodirectory-listing-validation-script', geodir_plugin_url() . '/geodirectory-assets/js/listing_validation.min.js#asyncload'); |
|
199 | + wp_enqueue_script('geodirectory-listing-validation-script', geodir_plugin_url().'/geodirectory-assets/js/listing_validation.min.js#asyncload'); |
|
200 | 200 | } // End if for add place page |
201 | 201 | |
202 | - wp_register_script('geodirectory-post-custom-js', geodir_plugin_url() . '/geodirectory-assets/js/post.custom.min.js#asyncload', array(), GEODIRECTORY_VERSION, true); |
|
202 | + wp_register_script('geodirectory-post-custom-js', geodir_plugin_url().'/geodirectory-assets/js/post.custom.min.js#asyncload', array(), GEODIRECTORY_VERSION, true); |
|
203 | 203 | if ($is_detail_page) { |
204 | 204 | wp_enqueue_script('geodirectory-post-custom-js'); |
205 | 205 | } |
206 | 206 | |
207 | 207 | // font awesome rating script |
208 | 208 | if (get_option('geodir_reviewrating_enable_font_awesome')) { |
209 | - wp_register_script('geodir-barrating-js', geodir_plugin_url() . '/geodirectory-assets/js/jquery.barrating.min.js', array(), GEODIRECTORY_VERSION, true); |
|
209 | + wp_register_script('geodir-barrating-js', geodir_plugin_url().'/geodirectory-assets/js/jquery.barrating.min.js', array(), GEODIRECTORY_VERSION, true); |
|
210 | 210 | wp_enqueue_script('geodir-barrating-js'); |
211 | 211 | } else { // default rating script |
212 | - wp_register_script('geodir-jRating-js', geodir_plugin_url() . '/geodirectory-assets/js/jRating.jquery.min.js', array(), GEODIRECTORY_VERSION, true); |
|
212 | + wp_register_script('geodir-jRating-js', geodir_plugin_url().'/geodirectory-assets/js/jRating.jquery.min.js', array(), GEODIRECTORY_VERSION, true); |
|
213 | 213 | wp_enqueue_script('geodir-jRating-js'); |
214 | 214 | } |
215 | 215 | |
216 | - wp_register_script('geodir-on-document-load', geodir_plugin_url() . '/geodirectory-assets/js/on_document_load.min.js#asyncload', array(), GEODIRECTORY_VERSION, true); |
|
216 | + wp_register_script('geodir-on-document-load', geodir_plugin_url().'/geodirectory-assets/js/on_document_load.min.js#asyncload', array(), GEODIRECTORY_VERSION, true); |
|
217 | 217 | wp_enqueue_script('geodir-on-document-load'); |
218 | 218 | |
219 | - wp_register_script('google-geometa', geodir_plugin_url() . '/geodirectory-assets/js/geometa.min.js#asyncload', array(), GEODIRECTORY_VERSION, true); |
|
219 | + wp_register_script('google-geometa', geodir_plugin_url().'/geodirectory-assets/js/geometa.min.js#asyncload', array(), GEODIRECTORY_VERSION, true); |
|
220 | 220 | wp_enqueue_script('google-geometa'); |
221 | 221 | } |
222 | 222 | |
@@ -231,7 +231,7 @@ discard block |
||
231 | 231 | */ |
232 | 232 | function geodir_header_scripts() |
233 | 233 | { |
234 | - echo '<style>' . stripslashes(get_option('geodir_coustem_css')) . '</style>'; |
|
234 | + echo '<style>'.stripslashes(get_option('geodir_coustem_css')).'</style>'; |
|
235 | 235 | echo stripslashes(get_option('geodir_header_scripts')); |
236 | 236 | } |
237 | 237 | |
@@ -245,7 +245,7 @@ discard block |
||
245 | 245 | */ |
246 | 246 | function geodir_google_analytics_tracking_code() |
247 | 247 | { |
248 | - if(get_option('geodir_ga_add_tracking_code') && get_option('geodir_ga_account_id')){?> |
|
248 | + if (get_option('geodir_ga_add_tracking_code') && get_option('geodir_ga_account_id')) {?> |
|
249 | 249 | |
250 | 250 | <script> |
251 | 251 | (function(i,s,o,g,r,a,m){ i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){ |
@@ -253,14 +253,14 @@ discard block |
||
253 | 253 | m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m) |
254 | 254 | })(window,document,'script','https://www.google-analytics.com/analytics.js','ga'); |
255 | 255 | |
256 | - ga('create', '<?php echo esc_attr(get_option('geodir_ga_account_id'));?>', 'auto'); |
|
257 | - <?php if(get_option('geodir_ga_anonymize_ip')){echo "ga('set', 'anonymizeIP', true);";}?> |
|
256 | + ga('create', '<?php echo esc_attr(get_option('geodir_ga_account_id')); ?>', 'auto'); |
|
257 | + <?php if (get_option('geodir_ga_anonymize_ip')) {echo "ga('set', 'anonymizeIP', true);"; }?> |
|
258 | 258 | ga('send', 'pageview'); |
259 | 259 | |
260 | 260 | </script> |
261 | 261 | |
262 | 262 | <?php |
263 | - }elseif( get_option('geodir_ga_add_tracking_code') && get_option('geodir_ga_tracking_code') && !get_option('geodir_ga_account_id')){ |
|
263 | + }elseif (get_option('geodir_ga_add_tracking_code') && get_option('geodir_ga_tracking_code') && !get_option('geodir_ga_account_id')) { |
|
264 | 264 | echo stripslashes(get_option('geodir_ga_tracking_code')); |
265 | 265 | } |
266 | 266 | } |
@@ -283,7 +283,7 @@ discard block |
||
283 | 283 | * |
284 | 284 | * Flexbox wont wrap on ios for search form items |
285 | 285 | */ |
286 | - if ( !empty( $_SERVER['HTTP_USER_AGENT'] ) && preg_match( '/iPad|iPod|iPhone|Safari/', $_SERVER['HTTP_USER_AGENT'] ) ) { |
|
286 | + if (!empty($_SERVER['HTTP_USER_AGENT']) && preg_match('/iPad|iPod|iPhone|Safari/', $_SERVER['HTTP_USER_AGENT'])) { |
|
287 | 287 | echo "<style>body .geodir-listing-search.gd-search-bar-style .geodir-loc-bar .clearfix.geodir-loc-bar-in .geodir-search .gd-search-input-wrapper{flex:50 1 auto !important;min-width: initial !important;width:auto !important;}.geodir-filter-container .geodir-filter-cat{width:auto !important;}</style>"; |
288 | 288 | } |
289 | 289 | } |
@@ -299,7 +299,7 @@ discard block |
||
299 | 299 | */ |
300 | 300 | function geodir_add_async_forscript($url) |
301 | 301 | { |
302 | - if (strpos($url, '#asyncload')===false) |
|
302 | + if (strpos($url, '#asyncload') === false) |
|
303 | 303 | return $url; |
304 | 304 | else if (is_admin()) |
305 | 305 | return str_replace('#asyncload', '', $url); |
@@ -317,12 +317,12 @@ discard block |
||
317 | 317 | function geodir_templates_styles() |
318 | 318 | { |
319 | 319 | |
320 | - wp_register_style('geodir-core-scss', geodir_plugin_url() . '/geodirectory-assets/css/gd_core_frontend.css', array(), GEODIRECTORY_VERSION); |
|
320 | + wp_register_style('geodir-core-scss', geodir_plugin_url().'/geodirectory-assets/css/gd_core_frontend.css', array(), GEODIRECTORY_VERSION); |
|
321 | 321 | wp_enqueue_style('geodir-core-scss'); |
322 | - wp_register_style('geodir-core-scss-footer', geodir_plugin_url() . '/geodirectory-assets/css/gd_core_frontend_footer.css', array(), GEODIRECTORY_VERSION); |
|
322 | + wp_register_style('geodir-core-scss-footer', geodir_plugin_url().'/geodirectory-assets/css/gd_core_frontend_footer.css', array(), GEODIRECTORY_VERSION); |
|
323 | 323 | |
324 | - if(is_rtl()){ |
|
325 | - wp_register_style('geodirectory-frontend-rtl-style', geodir_plugin_url() . '/geodirectory-assets/css/rtl-frontend.css', array(), GEODIRECTORY_VERSION); |
|
324 | + if (is_rtl()) { |
|
325 | + wp_register_style('geodirectory-frontend-rtl-style', geodir_plugin_url().'/geodirectory-assets/css/rtl-frontend.css', array(), GEODIRECTORY_VERSION); |
|
326 | 326 | wp_enqueue_style('geodirectory-frontend-rtl-style'); |
327 | 327 | } |
328 | 328 | |
@@ -396,18 +396,18 @@ discard block |
||
396 | 396 | $term_id = get_queried_object_id(); |
397 | 397 | $taxonomy = get_query_var('taxonomy'); |
398 | 398 | |
399 | - if ($term_id && $post_type && get_query_var('taxonomy') == $post_type . 'category' ) { |
|
400 | - $term = get_term($term_id, $post_type . 'category'); |
|
399 | + if ($term_id && $post_type && get_query_var('taxonomy') == $post_type.'category') { |
|
400 | + $term = get_term($term_id, $post_type.'category'); |
|
401 | 401 | } |
402 | 402 | } |
403 | 403 | |
404 | - if (geodir_is_page('search') && !empty($_REQUEST['s' . $post_type . 'category'])) { |
|
405 | - $taxonomy_search = $_REQUEST['s' . $post_type . 'category']; |
|
404 | + if (geodir_is_page('search') && !empty($_REQUEST['s'.$post_type.'category'])) { |
|
405 | + $taxonomy_search = $_REQUEST['s'.$post_type.'category']; |
|
406 | 406 | |
407 | 407 | if (!is_array($taxonomy_search)) { |
408 | - $term = get_term((int)$taxonomy_search, $post_type . 'category'); |
|
409 | - } else if(is_array($taxonomy_search) && count($taxonomy_search) == 1) { // single category search |
|
410 | - $term = get_term((int)$taxonomy_search[0], $post_type . 'category'); |
|
408 | + $term = get_term((int) $taxonomy_search, $post_type.'category'); |
|
409 | + } else if (is_array($taxonomy_search) && count($taxonomy_search) == 1) { // single category search |
|
410 | + $term = get_term((int) $taxonomy_search[0], $post_type.'category'); |
|
411 | 411 | } |
412 | 412 | } |
413 | 413 | |
@@ -419,7 +419,7 @@ discard block |
||
419 | 419 | if ($max_page > 1 || $always_show) { |
420 | 420 | // Extra pagination info |
421 | 421 | $geodir_pagination_more_info = get_option('geodir_pagination_advance_info'); |
422 | - $start_no = ( $paged - 1 ) * $posts_per_page + 1; |
|
422 | + $start_no = ($paged - 1) * $posts_per_page + 1; |
|
423 | 423 | $end_no = min($paged * $posts_per_page, $numposts); |
424 | 424 | |
425 | 425 | if ($geodir_pagination_more_info != '') { |
@@ -429,7 +429,7 @@ discard block |
||
429 | 429 | } else { |
430 | 430 | $pegination_desc = wp_sprintf(__('Showing listings %d-%d of %d', 'geodirectory'), $start_no, $end_no, $numposts); |
431 | 431 | } |
432 | - $pagination_info = '<div class="gd-pagination-details">' . $pegination_desc . '</div>'; |
|
432 | + $pagination_info = '<div class="gd-pagination-details">'.$pegination_desc.'</div>'; |
|
433 | 433 | /** |
434 | 434 | * Adds an extra pagination info above/under pagination. |
435 | 435 | * |
@@ -445,15 +445,15 @@ discard block |
||
445 | 445 | $pagination_info = apply_filters('geodir_pagination_advance_info', $pagination_info, $listing_type_name, $start_no, $end_no, $numposts, $post_type); |
446 | 446 | |
447 | 447 | if ($geodir_pagination_more_info == 'before') { |
448 | - $before = $before . $pagination_info; |
|
448 | + $before = $before.$pagination_info; |
|
449 | 449 | } else if ($geodir_pagination_more_info == 'after') { |
450 | - $after = $pagination_info . $after; |
|
450 | + $after = $pagination_info.$after; |
|
451 | 451 | } |
452 | 452 | } |
453 | 453 | |
454 | 454 | echo "$before <div class='Navi gd-navi'>"; |
455 | 455 | if ($paged >= ($pages_to_show - 1)) { |
456 | - echo '<a href="' . str_replace('&paged', '&paged', get_pagenum_link()) . '">«</a>'; |
|
456 | + echo '<a href="'.str_replace('&paged', '&paged', get_pagenum_link()).'">«</a>'; |
|
457 | 457 | } |
458 | 458 | previous_posts_link($prelabel); |
459 | 459 | for ($i = $paged - $half_pages_to_show; $i <= $paged + $half_pages_to_show; $i++) { |
@@ -461,13 +461,13 @@ discard block |
||
461 | 461 | if ($i == $paged) { |
462 | 462 | echo "<strong class='on'>$i</strong>"; |
463 | 463 | } else { |
464 | - echo ' <a href="' . str_replace('&paged', '&paged', get_pagenum_link($i)) . '">' . $i . '</a> '; |
|
464 | + echo ' <a href="'.str_replace('&paged', '&paged', get_pagenum_link($i)).'">'.$i.'</a> '; |
|
465 | 465 | } |
466 | 466 | } |
467 | 467 | } |
468 | 468 | next_posts_link($nxtlabel, $max_page); |
469 | 469 | if (($paged + $half_pages_to_show) < ($max_page)) { |
470 | - echo '<a href="' . str_replace('&paged', '&paged', get_pagenum_link($max_page)) . '">»</a>'; |
|
470 | + echo '<a href="'.str_replace('&paged', '&paged', get_pagenum_link($max_page)).'">»</a>'; |
|
471 | 471 | } |
472 | 472 | echo "</div> $after"; |
473 | 473 | } |
@@ -505,7 +505,7 @@ discard block |
||
505 | 505 | jQuery(function ($) { |
506 | 506 | $("#distance_slider").slider({ |
507 | 507 | range: true, |
508 | - values: [0, <?php echo ($_REQUEST['sdist']!='') ? sanitize_text_field($_REQUEST['sdist']) : "0"; ?>], |
|
508 | + values: [0, <?php echo ($_REQUEST['sdist'] != '') ? sanitize_text_field($_REQUEST['sdist']) : "0"; ?>], |
|
509 | 509 | min: 0, |
510 | 510 | max: <?php echo $dist; ?>, |
511 | 511 | step: <?php echo $dist_dif; ?>, |
@@ -572,7 +572,7 @@ discard block |
||
572 | 572 | $city = !empty($search_location) ? addslashes(stripslashes($search_location->city)) : ''; |
573 | 573 | ?> |
574 | 574 | <script type="text/javascript"> |
575 | - var default_location = '<?php echo $city ;?>'; |
|
575 | + var default_location = '<?php echo $city; ?>'; |
|
576 | 576 | var latlng; |
577 | 577 | var address; |
578 | 578 | var dist = 0; |
@@ -588,7 +588,7 @@ discard block |
||
588 | 588 | var $form = jQuery(this).closest('form'); |
589 | 589 | |
590 | 590 | if (jQuery("#sdist input[type='radio']:checked").length != 0) dist = jQuery("#sdist input[type='radio']:checked").val(); |
591 | - if (jQuery('.search_text', $form).val() == '' || jQuery('.search_text', $form).val() == '<?php echo $default_search_for_text;?>') jQuery('.search_text', $form).val(s); |
|
591 | + if (jQuery('.search_text', $form).val() == '' || jQuery('.search_text', $form).val() == '<?php echo $default_search_for_text; ?>') jQuery('.search_text', $form).val(s); |
|
592 | 592 | |
593 | 593 | // Disable location based search for disabled location post type. |
594 | 594 | if (jQuery('.search_by_post', $form).val() != '' && typeof gd_cpt_no_location == 'function') { |
@@ -602,7 +602,7 @@ discard block |
||
602 | 602 | } |
603 | 603 | } |
604 | 604 | |
605 | - if (dist > 0 || (jQuery('select[name="sort_by"]').val() == 'nearest' || jQuery('select[name="sort_by"]', $form).val() == 'farthest') || (jQuery(".snear", $form).val() != '' && jQuery(".snear", $form).val() != '<?php echo $default_near_text;?>')) { |
|
605 | + if (dist > 0 || (jQuery('select[name="sort_by"]').val() == 'nearest' || jQuery('select[name="sort_by"]', $form).val() == 'farthest') || (jQuery(".snear", $form).val() != '' && jQuery(".snear", $form).val() != '<?php echo $default_near_text; ?>')) { |
|
606 | 606 | geodir_setsearch($form); |
607 | 607 | } else { |
608 | 608 | jQuery(".snear", $form).val(''); |
@@ -620,7 +620,7 @@ discard block |
||
620 | 620 | }); |
621 | 621 | |
622 | 622 | function geodir_setsearch($form) { |
623 | - if ((dist > 0 || (jQuery('select[name="sort_by"]', $form).val() == 'nearest' || jQuery('select[name="sort_by"]', $form).val() == 'farthest')) && (jQuery(".snear", $form).val() == '' || jQuery(".snear", $form).val() == '<?php echo $default_near_text;?>')) jQuery(".snear", $form).val(default_location); |
|
623 | + if ((dist > 0 || (jQuery('select[name="sort_by"]', $form).val() == 'nearest' || jQuery('select[name="sort_by"]', $form).val() == 'farthest')) && (jQuery(".snear", $form).val() == '' || jQuery(".snear", $form).val() == '<?php echo $default_near_text; ?>')) jQuery(".snear", $form).val(default_location); |
|
624 | 624 | geocodeAddress($form); |
625 | 625 | } |
626 | 626 | |
@@ -639,15 +639,15 @@ discard block |
||
639 | 639 | // Call the geocode function |
640 | 640 | Sgeocoder = window.gdMaps == 'google' ? new google.maps.Geocoder() : null; |
641 | 641 | |
642 | - if (jQuery('.snear', $form).val() == '' || ( jQuery('.sgeo_lat').val() != '' && jQuery('.sgeo_lon').val() != '' ) || jQuery('.snear', $form).val().match("^<?php _e('In:','geodirectory');?>")) { |
|
643 | - if (jQuery('.snear', $form).val().match("^<?php _e('In:','geodirectory');?>")) { |
|
642 | + if (jQuery('.snear', $form).val() == '' || ( jQuery('.sgeo_lat').val() != '' && jQuery('.sgeo_lon').val() != '' ) || jQuery('.snear', $form).val().match("^<?php _e('In:', 'geodirectory'); ?>")) { |
|
643 | + if (jQuery('.snear', $form).val().match("^<?php _e('In:', 'geodirectory'); ?>")) { |
|
644 | 644 | jQuery(".snear", $form).val(''); |
645 | 645 | } |
646 | 646 | jQuery($form).submit(); |
647 | 647 | } else { |
648 | 648 | var address = jQuery(".snear", $form).val(); |
649 | 649 | |
650 | - if (jQuery('.snear', $form).val() == '<?php echo $default_near_text;?>') { |
|
650 | + if (jQuery('.snear', $form).val() == '<?php echo $default_near_text; ?>') { |
|
651 | 651 | initialise2(); |
652 | 652 | } else { |
653 | 653 | <?php |
@@ -660,12 +660,12 @@ discard block |
||
660 | 660 | $near_add2 = apply_filters('geodir_search_near_addition', ''); |
661 | 661 | ?> |
662 | 662 | if (window.gdMaps === 'google') { |
663 | - Sgeocoder.geocode({'address': address<?php echo ($near_add ? '+", ' . $near_add . '"' : '') . $near_add2;?>}, |
|
663 | + Sgeocoder.geocode({'address': address<?php echo ($near_add ? '+", '.$near_add.'"' : '').$near_add2; ?>}, |
|
664 | 664 | function (results, status) { |
665 | 665 | if (status == google.maps.GeocoderStatus.OK) { |
666 | 666 | updateSearchPosition(results[0].geometry.location, $form); |
667 | 667 | } else { |
668 | - alert("<?php esc_attr_e('Search was not successful for the following reason :', 'geodirectory');?>" + status); |
|
668 | + alert("<?php esc_attr_e('Search was not successful for the following reason :', 'geodirectory'); ?>" + status); |
|
669 | 669 | } |
670 | 670 | }); |
671 | 671 | } else if (window.gdMaps === 'osm') { |
@@ -674,7 +674,7 @@ discard block |
||
674 | 674 | if (typeof geo !== 'undefined' && geo.lat && geo.lon) { |
675 | 675 | updateSearchPosition(geo, $form); |
676 | 676 | } else { |
677 | - alert("<?php esc_attr_e('Search was not successful for the requested address.', 'geodirectory');?>"); |
|
677 | + alert("<?php esc_attr_e('Search was not successful for the requested address.', 'geodirectory'); ?>"); |
|
678 | 678 | } |
679 | 679 | }); |
680 | 680 | } else { |
@@ -720,19 +720,19 @@ discard block |
||
720 | 720 | var msg; |
721 | 721 | switch (err.code) { |
722 | 722 | case err.UNKNOWN_ERROR: |
723 | - msg = "<?php _e('Unable to find your location','geodirectory');?>"; |
|
723 | + msg = "<?php _e('Unable to find your location', 'geodirectory'); ?>"; |
|
724 | 724 | break; |
725 | 725 | case err.PERMISSION_DENINED: |
726 | - msg = "<?php _e('Permission denied in finding your location','geodirectory');?>"; |
|
726 | + msg = "<?php _e('Permission denied in finding your location', 'geodirectory'); ?>"; |
|
727 | 727 | break; |
728 | 728 | case err.POSITION_UNAVAILABLE: |
729 | - msg = "<?php _e('Your location is currently unknown','geodirectory');?>"; |
|
729 | + msg = "<?php _e('Your location is currently unknown', 'geodirectory'); ?>"; |
|
730 | 730 | break; |
731 | 731 | case err.BREAK: |
732 | - msg = "<?php _e('Attempt to find location took too long','geodirectory');?>"; |
|
732 | + msg = "<?php _e('Attempt to find location took too long', 'geodirectory'); ?>"; |
|
733 | 733 | break; |
734 | 734 | default: |
735 | - msg = "<?php _e('Location detection not supported in browser','geodirectory');?>"; |
|
735 | + msg = "<?php _e('Location detection not supported in browser', 'geodirectory'); ?>"; |
|
736 | 736 | } |
737 | 737 | jQuery('#info').html(msg); |
738 | 738 | } |
@@ -782,7 +782,7 @@ discard block |
||
782 | 782 | * @param object $post The post object. |
783 | 783 | * @param string $link The link to the post. |
784 | 784 | */ |
785 | - $return = apply_filters('geodir_featured_badge_on_image', '<a href="' . $link . '"><span class="geodir_featured_img"> </span></a>',$post,$link); |
|
785 | + $return = apply_filters('geodir_featured_badge_on_image', '<a href="'.$link.'"><span class="geodir_featured_img"> </span></a>', $post, $link); |
|
786 | 786 | break; |
787 | 787 | case 'new' : |
788 | 788 | /** |
@@ -792,7 +792,7 @@ discard block |
||
792 | 792 | * @param object $post The post object. |
793 | 793 | * @param string $link The link to the post. |
794 | 794 | */ |
795 | - $return = apply_filters('geodir_new_badge_on_image', '<a href="' . $link . '"><span class="geodir_new_listing"> </span></a>',$post,$link); |
|
795 | + $return = apply_filters('geodir_new_badge_on_image', '<a href="'.$link.'"><span class="geodir_new_listing"> </span></a>', $post, $link); |
|
796 | 796 | break; |
797 | 797 | |
798 | 798 | } |
@@ -806,8 +806,8 @@ discard block |
||
806 | 806 | * @since 1.6.22 |
807 | 807 | */ |
808 | 808 | function geodir_fix_script_conflict() { |
809 | - if ( wp_script_is( 'flexslider', 'enqueued' ) && wp_script_is( 'geodirectory-jquery-flexslider-js', 'enqueued' ) ) { |
|
810 | - wp_dequeue_script( 'flexslider' ); |
|
809 | + if (wp_script_is('flexslider', 'enqueued') && wp_script_is('geodirectory-jquery-flexslider-js', 'enqueued')) { |
|
810 | + wp_dequeue_script('flexslider'); |
|
811 | 811 | } |
812 | 812 | } |
813 | -add_action( 'wp_enqueue_scripts', 'geodir_fix_script_conflict', 100 ); |
|
814 | 813 | \ No newline at end of file |
814 | +add_action('wp_enqueue_scripts', 'geodir_fix_script_conflict', 100); |
|
815 | 815 | \ No newline at end of file |
@@ -260,7 +260,7 @@ discard block |
||
260 | 260 | </script> |
261 | 261 | |
262 | 262 | <?php |
263 | - }elseif( get_option('geodir_ga_add_tracking_code') && get_option('geodir_ga_tracking_code') && !get_option('geodir_ga_account_id')){ |
|
263 | + } elseif( get_option('geodir_ga_add_tracking_code') && get_option('geodir_ga_tracking_code') && !get_option('geodir_ga_account_id')){ |
|
264 | 264 | echo stripslashes(get_option('geodir_ga_tracking_code')); |
265 | 265 | } |
266 | 266 | } |
@@ -299,13 +299,14 @@ discard block |
||
299 | 299 | */ |
300 | 300 | function geodir_add_async_forscript($url) |
301 | 301 | { |
302 | - if (strpos($url, '#asyncload')===false) |
|
303 | - return $url; |
|
304 | - else if (is_admin()) |
|
305 | - return str_replace('#asyncload', '', $url); |
|
306 | - else |
|
307 | - return str_replace('#asyncload', '', $url)."' async='async"; |
|
308 | -} |
|
302 | + if (strpos($url, '#asyncload')===false) { |
|
303 | + return $url; |
|
304 | + } else if (is_admin()) { |
|
305 | + return str_replace('#asyncload', '', $url); |
|
306 | + } else { |
|
307 | + return str_replace('#asyncload', '', $url)."' async='async"; |
|
308 | + } |
|
309 | + } |
|
309 | 310 | add_filter('clean_url', 'geodir_add_async_forscript', 11, 1); |
310 | 311 | |
311 | 312 | /** |
@@ -372,8 +373,10 @@ discard block |
||
372 | 373 | |
373 | 374 | $half_pages_to_show = round($pages_to_show / 2); |
374 | 375 | |
375 | - if (geodir_is_page('home')) // dont apply default pagination for geodirectory home page. |
|
376 | - return; |
|
376 | + if (geodir_is_page('home')) { |
|
377 | + // dont apply default pagination for geodirectory home page. |
|
378 | + return; |
|
379 | + } |
|
377 | 380 | |
378 | 381 | if (!is_single()) { |
379 | 382 | if (function_exists('geodir_location_geo_home_link')) { |
@@ -493,11 +496,21 @@ discard block |
||
493 | 496 | } |
494 | 497 | $dist_dif = 1000; |
495 | 498 | |
496 | - if ($dist <= 5000) $dist_dif = 500; |
|
497 | - if ($dist <= 1000) $dist_dif = 100; |
|
498 | - if ($dist <= 500) $dist_dif = 50; |
|
499 | - if ($dist <= 100) $dist_dif = 10; |
|
500 | - if ($dist <= 50) $dist_dif = 5; |
|
499 | + if ($dist <= 5000) { |
|
500 | + $dist_dif = 500; |
|
501 | + } |
|
502 | + if ($dist <= 1000) { |
|
503 | + $dist_dif = 100; |
|
504 | + } |
|
505 | + if ($dist <= 500) { |
|
506 | + $dist_dif = 50; |
|
507 | + } |
|
508 | + if ($dist <= 100) { |
|
509 | + $dist_dif = 10; |
|
510 | + } |
|
511 | + if ($dist <= 50) { |
|
512 | + $dist_dif = 5; |
|
513 | + } |
|
501 | 514 | |
502 | 515 | ?> |
503 | 516 | <script type="text/javascript"> |
@@ -558,12 +571,14 @@ discard block |
||
558 | 571 | */ |
559 | 572 | function geodir_add_sharelocation_scripts() { |
560 | 573 | $default_search_for_text = SEARCH_FOR_TEXT; |
561 | - if (get_option('geodir_search_field_default_text')) |
|
562 | - $default_search_for_text = __(get_option('geodir_search_field_default_text'), 'geodirectory'); |
|
574 | + if (get_option('geodir_search_field_default_text')) { |
|
575 | + $default_search_for_text = __(get_option('geodir_search_field_default_text'), 'geodirectory'); |
|
576 | + } |
|
563 | 577 | |
564 | 578 | $default_near_text = NEAR_TEXT; |
565 | - if (get_option('geodir_near_field_default_text')) |
|
566 | - $default_near_text = __(get_option('geodir_near_field_default_text'), 'geodirectory'); |
|
579 | + if (get_option('geodir_near_field_default_text')) { |
|
580 | + $default_near_text = __(get_option('geodir_near_field_default_text'), 'geodirectory'); |
|
581 | + } |
|
567 | 582 | |
568 | 583 | $search_location = geodir_get_default_location(); |
569 | 584 |