@@ -1,10 +1,10 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | /** |
3 | - * All map related templates used by the plugin |
|
4 | - * |
|
5 | - * @since 1.0.0 |
|
6 | - * @package GeoDirectory |
|
7 | - */ |
|
3 | + * All map related templates used by the plugin |
|
4 | + * |
|
5 | + * @since 1.0.0 |
|
6 | + * @package GeoDirectory |
|
7 | + */ |
|
8 | 8 | |
9 | 9 | /** |
10 | 10 | * Contains all map related functions. |
@@ -138,33 +138,33 @@ discard block |
||
138 | 138 | } |
139 | 139 | |
140 | 140 | /** |
141 | - * Filter the options to use in google map. |
|
142 | - * |
|
143 | - * @since 1.0.0 |
|
144 | - * |
|
145 | - * @param array $geodir_map_options {@see geodir_draw_map()} docblock. |
|
146 | - */ |
|
147 | - $geodir_map_options = apply_filters("geodir_map_options_{$map_canvas_name}", $geodir_map_options); |
|
141 | + * Filter the options to use in google map. |
|
142 | + * |
|
143 | + * @since 1.0.0 |
|
144 | + * |
|
145 | + * @param array $geodir_map_options {@see geodir_draw_map()} docblock. |
|
146 | + */ |
|
147 | + $geodir_map_options = apply_filters("geodir_map_options_{$map_canvas_name}", $geodir_map_options); |
|
148 | 148 | |
149 | 149 | $map_canvas_arr[$map_canvas_name] = array(); |
150 | 150 | |
151 | 151 | /** |
152 | - * Filter the post types to display data on map. |
|
153 | - * |
|
154 | - * @since 1.0.0 |
|
155 | - * |
|
156 | - * @param object $object Objects of post types. |
|
157 | - */ |
|
158 | - $post_types = apply_filters("geodir_map_post_type_list_{$map_canvas_name}", geodir_get_posttypes('object')); |
|
152 | + * Filter the post types to display data on map. |
|
153 | + * |
|
154 | + * @since 1.0.0 |
|
155 | + * |
|
156 | + * @param object $object Objects of post types. |
|
157 | + */ |
|
158 | + $post_types = apply_filters("geodir_map_post_type_list_{$map_canvas_name}", geodir_get_posttypes('object')); |
|
159 | 159 | |
160 | - /** |
|
161 | - * Filter the post types to exclude to display data on map. |
|
162 | - * |
|
163 | - * @since 1.0.0 |
|
164 | - * |
|
165 | - * @param array Array of post types to exclude to display data on map. |
|
166 | - */ |
|
167 | - $exclude_post_types = apply_filters("geodir_exclude_post_type_on_map_{$map_canvas_name}", get_option('geodir_exclude_post_type_on_map')); |
|
160 | + /** |
|
161 | + * Filter the post types to exclude to display data on map. |
|
162 | + * |
|
163 | + * @since 1.0.0 |
|
164 | + * |
|
165 | + * @param array Array of post types to exclude to display data on map. |
|
166 | + */ |
|
167 | + $exclude_post_types = apply_filters("geodir_exclude_post_type_on_map_{$map_canvas_name}", get_option('geodir_exclude_post_type_on_map')); |
|
168 | 168 | |
169 | 169 | if (count((array)$post_types) != count($exclude_post_types) || ($enable_jason_on_load)): |
170 | 170 | // Set default map options |
@@ -180,13 +180,13 @@ discard block |
||
180 | 180 | } |
181 | 181 | |
182 | 182 | /** |
183 | - * Filter the width of map. |
|
184 | - * |
|
185 | - * @since 1.0.0 |
|
186 | - * |
|
187 | - * @param int $map_width Width of map box, eg: gd_place. |
|
188 | - */ |
|
189 | - $map_width = apply_filters('geodir_change_map_width', $map_width); |
|
183 | + * Filter the width of map. |
|
184 | + * |
|
185 | + * @since 1.0.0 |
|
186 | + * |
|
187 | + * @param int $map_width Width of map box, eg: gd_place. |
|
188 | + */ |
|
189 | + $map_width = apply_filters('geodir_change_map_width', $map_width); |
|
190 | 190 | ?> |
191 | 191 | <div id="catcher_<?php echo $map_canvas_name;?>"></div> |
192 | 192 | <div class="stick_trigger_container"> |
@@ -285,29 +285,29 @@ discard block |
||
285 | 285 | |
286 | 286 | <div id="<?php echo $map_canvas_name; ?>_directionsPanel" style="width:auto;"></div> |
287 | 287 | <?php |
288 | - } |
|
288 | + } |
|
289 | 289 | |
290 | - $geodir_default_map_search_pt = get_option('geodir_default_map_search_pt'); |
|
291 | - if (empty($geodir_default_map_search_pt)) |
|
292 | - $geodir_default_map_search_pt = 'gd_place'; |
|
293 | - |
|
294 | - /** |
|
295 | - * Filter the post type to retrive data for map |
|
296 | - * |
|
297 | - * @since 1.0.0 |
|
298 | - * |
|
299 | - * @param string $geodir_default_map_search_pt Post type, eg: gd_place. |
|
300 | - */ |
|
301 | - $map_search_pt = apply_filters('geodir_default_map_search_pt', $geodir_default_map_search_pt); |
|
302 | - ?> |
|
290 | + $geodir_default_map_search_pt = get_option('geodir_default_map_search_pt'); |
|
291 | + if (empty($geodir_default_map_search_pt)) |
|
292 | + $geodir_default_map_search_pt = 'gd_place'; |
|
293 | + |
|
294 | + /** |
|
295 | + * Filter the post type to retrive data for map |
|
296 | + * |
|
297 | + * @since 1.0.0 |
|
298 | + * |
|
299 | + * @param string $geodir_default_map_search_pt Post type, eg: gd_place. |
|
300 | + */ |
|
301 | + $map_search_pt = apply_filters('geodir_default_map_search_pt', $geodir_default_map_search_pt); |
|
302 | + ?> |
|
303 | 303 | <div class="map-category-listing-main" style="display:<?php echo $show_entire_cat_panel;?>"> |
304 | 304 | <?php |
305 | 305 | $exclude_post_types = get_option('geodir_exclude_post_type_on_map'); |
306 | 306 | $geodir_available_pt_on_map = count(geodir_get_posttypes('array')) - count($exclude_post_types); |
307 | - $map_cat_class = ''; |
|
308 | - if ($geodir_map_options['enable_post_type_filters']) { |
|
309 | - $map_cat_class = $geodir_available_pt_on_map > 1 ? ' map-cat-ptypes' : ' map-cat-floor'; |
|
310 | - } |
|
307 | + $map_cat_class = ''; |
|
308 | + if ($geodir_map_options['enable_post_type_filters']) { |
|
309 | + $map_cat_class = $geodir_available_pt_on_map > 1 ? ' map-cat-ptypes' : ' map-cat-floor'; |
|
310 | + } |
|
311 | 311 | ?> |
312 | 312 | <div |
313 | 313 | class="map-category-listing<?php echo $map_cat_class;?>"> |
@@ -350,14 +350,14 @@ discard block |
||
350 | 350 | |
351 | 351 | <?php |
352 | 352 | if ($geodir_map_options['enable_location_filters']) { |
353 | - $country = get_query_var('gd_country'); |
|
354 | - $region = get_query_var('gd_region'); |
|
355 | - $city = get_query_var('gd_city'); |
|
353 | + $country = get_query_var('gd_country'); |
|
354 | + $region = get_query_var('gd_region'); |
|
355 | + $city = get_query_var('gd_city'); |
|
356 | 356 | |
357 | 357 | //fix for location/me page |
358 | 358 | $country = $country != 'me' ? $country : ''; |
359 | - $region = $region != 'me' ? $region : ''; |
|
360 | - $city = $country != 'me' ? $city : ''; |
|
359 | + $region = $region != 'me' ? $region : ''; |
|
360 | + $city = $country != 'me' ? $city : ''; |
|
361 | 361 | $gd_neighbourhood = isset($_REQUEST['gd_neighbourhood']) ? sanitize_text_field($_REQUEST['gd_neighbourhood']) : ''; |
362 | 362 | ?> |
363 | 363 | <input type="hidden" id="<?php echo $map_canvas_name;?>_location_enabled" value="1"/> |
@@ -396,7 +396,7 @@ discard block |
||
396 | 396 | foreach ($post_types as $post_type => $args) { |
397 | 397 | if (!in_array($post_type, $exclude_post_types)) { |
398 | 398 | $class = $map_search_pt == $post_type ? 'class="gd-map-search-pt"' : ''; |
399 | - echo '<li id="' . $post_type . '" ' . $class . '><a href="javascript:void(0);" onclick="jQuery(\'#' . $map_canvas_name . '_posttype\').val(\'' . $post_type . '\');build_map_ajax_search_param(\'' . $map_canvas_name . '\', true)">' . __(ucfirst($args->labels->name), 'geodirectory') . '</a></li>'; |
|
399 | + echo '<li id="' . $post_type . '" ' . $class . '><a href="javascript:void(0);" onclick="jQuery(\'#' . $map_canvas_name . '_posttype\').val(\'' . $post_type . '\');build_map_ajax_search_param(\'' . $map_canvas_name . '\', true)">' . __(ucfirst($args->labels->name), 'geodirectory') . '</a></li>'; |
|
400 | 400 | } |
401 | 401 | } |
402 | 402 | ?> |
@@ -166,10 +166,10 @@ discard block |
||
166 | 166 | */ |
167 | 167 | $exclude_post_types = apply_filters("geodir_exclude_post_type_on_map_{$map_canvas_name}", get_option('geodir_exclude_post_type_on_map')); |
168 | 168 | |
169 | - if (count((array)$post_types) != count($exclude_post_types) || ($enable_jason_on_load)): |
|
169 | + if (count((array) $post_types) != count($exclude_post_types) || ($enable_jason_on_load)): |
|
170 | 170 | // Set default map options |
171 | 171 | |
172 | - wp_enqueue_script('geodir-map-widget', geodir_plugin_url() . '/geodirectory-functions/map-functions/js/map.min.js',array(),false,true); |
|
172 | + wp_enqueue_script('geodir-map-widget', geodir_plugin_url() . '/geodirectory-functions/map-functions/js/map.min.js', array(), false, true); |
|
173 | 173 | |
174 | 174 | wp_localize_script('geodir-map-widget', $map_canvas_name, $geodir_map_options); |
175 | 175 | |
@@ -188,39 +188,39 @@ discard block |
||
188 | 188 | */ |
189 | 189 | $map_width = apply_filters('geodir_change_map_width', $map_width); |
190 | 190 | ?> |
191 | - <div id="catcher_<?php echo $map_canvas_name;?>"></div> |
|
191 | + <div id="catcher_<?php echo $map_canvas_name; ?>"></div> |
|
192 | 192 | <div class="stick_trigger_container"> |
193 | 193 | <div class="trigger_sticky triggeroff_sticky"></div> |
194 | - <div class="top_banner_section geodir_map_container <?php echo $map_class_name;?>" |
|
195 | - id="sticky_map_<?php echo $map_canvas_name;?>" |
|
196 | - style="min-height:<?php echo $geodir_map_options['height'];?>;width:<?php echo $map_width;?>;"> |
|
194 | + <div class="top_banner_section geodir_map_container <?php echo $map_class_name; ?>" |
|
195 | + id="sticky_map_<?php echo $map_canvas_name; ?>" |
|
196 | + style="min-height:<?php echo $geodir_map_options['height']; ?>;width:<?php echo $map_width; ?>;"> |
|
197 | 197 | |
198 | 198 | <div class="map_background"> |
199 | 199 | <div class="top_banner_section_in clearfix"> |
200 | - <div class="<?php echo $map_canvas_name;?>_TopLeft TopLeft"><span class="triggermap" id="<?php echo $map_canvas_name;?>_triggermap" <?php if (!$geodir_map_options['enable_map_resize_button']) { ?> <?php }?>><i class="fa fa-arrows-alt"></i></span></div> |
|
201 | - <div class="<?php echo $map_canvas_name;?>_TopRight TopRight"></div> |
|
202 | - <div id="<?php echo $map_canvas_name;?>_wrapper" class="main_map_wrapper" |
|
203 | - style="height:<?php echo $geodir_map_options['height'];?>;width:<?php echo $map_width;?>;"> |
|
200 | + <div class="<?php echo $map_canvas_name; ?>_TopLeft TopLeft"><span class="triggermap" id="<?php echo $map_canvas_name; ?>_triggermap" <?php if (!$geodir_map_options['enable_map_resize_button']) { ?> <?php }?>><i class="fa fa-arrows-alt"></i></span></div> |
|
201 | + <div class="<?php echo $map_canvas_name; ?>_TopRight TopRight"></div> |
|
202 | + <div id="<?php echo $map_canvas_name; ?>_wrapper" class="main_map_wrapper" |
|
203 | + style="height:<?php echo $geodir_map_options['height']; ?>;width:<?php echo $map_width; ?>;"> |
|
204 | 204 | <!-- new map start --> |
205 | 205 | <div class="iprelative"> |
206 | - <div class="geodir_marker_cluster" id="<?php echo $map_canvas_name;?>" |
|
207 | - style="height:<?php echo $geodir_map_options['height'];?>;width:<?php echo $map_width;?>;"></div> |
|
208 | - <div id="<?php echo $map_canvas_name;?>_loading_div" class="loading_div" |
|
209 | - style=" height:<?php echo $geodir_map_options['height'];?>;width:<?php echo $map_width;?>;"></div> |
|
206 | + <div class="geodir_marker_cluster" id="<?php echo $map_canvas_name; ?>" |
|
207 | + style="height:<?php echo $geodir_map_options['height']; ?>;width:<?php echo $map_width; ?>;"></div> |
|
208 | + <div id="<?php echo $map_canvas_name; ?>_loading_div" class="loading_div" |
|
209 | + style=" height:<?php echo $geodir_map_options['height']; ?>;width:<?php echo $map_width; ?>;"></div> |
|
210 | 210 | <!--<div id="home_map_counter"></div> --> |
211 | - <div id="<?php echo $map_canvas_name;?>_map_nofound" |
|
211 | + <div id="<?php echo $map_canvas_name; ?>_map_nofound" |
|
212 | 212 | class="advmap_nofound"><?php echo MAP_NO_RESULTS; ?></div> |
213 | 213 | </div> |
214 | 214 | <!-- new map end --> |
215 | 215 | </div> |
216 | - <div class="<?php echo $map_canvas_name;?>_BottomLeft BottomLeft"></div> |
|
216 | + <div class="<?php echo $map_canvas_name; ?>_BottomLeft BottomLeft"></div> |
|
217 | 217 | </div> |
218 | 218 | </div> |
219 | 219 | <?php if ($geodir_map_options['enable_jason_on_load']) { ?> |
220 | - <input type="hidden" id="<?php echo $map_canvas_name;?>_jason_enabled" value="1"/> |
|
220 | + <input type="hidden" id="<?php echo $map_canvas_name; ?>_jason_enabled" value="1"/> |
|
221 | 221 | <?php } else { |
222 | 222 | ?> |
223 | - <input type="hidden" id="<?php echo $map_canvas_name;?>_jason_enabled" value="0"/> |
|
223 | + <input type="hidden" id="<?php echo $map_canvas_name; ?>_jason_enabled" value="0"/> |
|
224 | 224 | <?php } |
225 | 225 | |
226 | 226 | if (!$geodir_map_options['enable_text_search'] && !$geodir_map_options['enable_cat_filters']) |
@@ -240,7 +240,7 @@ discard block |
||
240 | 240 | onclick="calcRoute('<?php echo $map_canvas_name; ?>')"/> |
241 | 241 | |
242 | 242 | <script> |
243 | - <?php if(geodir_is_page('detail')){?> |
|
243 | + <?php if (geodir_is_page('detail')) {?> |
|
244 | 244 | jQuery(function () { |
245 | 245 | gd_initialize_ac(); |
246 | 246 | }); |
@@ -250,7 +250,7 @@ discard block |
||
250 | 250 | // Create the autocomplete object, restricting the search |
251 | 251 | // to geographical location types. |
252 | 252 | autocomplete = new google.maps.places.Autocomplete( |
253 | - /** @type {HTMLInputElement} */(document.getElementById('<?php echo $map_canvas_name;?>_fromAddress')), |
|
253 | + /** @type {HTMLInputElement} */(document.getElementById('<?php echo $map_canvas_name; ?>_fromAddress')), |
|
254 | 254 | {types: ['geocode']}); |
255 | 255 | // When the user selects an address from the dropdown, |
256 | 256 | // populate the address fields in the form. |
@@ -300,7 +300,7 @@ discard block |
||
300 | 300 | */ |
301 | 301 | $map_search_pt = apply_filters('geodir_default_map_search_pt', $geodir_default_map_search_pt); |
302 | 302 | ?> |
303 | - <div class="map-category-listing-main" style="display:<?php echo $show_entire_cat_panel;?>"> |
|
303 | + <div class="map-category-listing-main" style="display:<?php echo $show_entire_cat_panel; ?>"> |
|
304 | 304 | <?php |
305 | 305 | $exclude_post_types = get_option('geodir_exclude_post_type_on_map'); |
306 | 306 | $geodir_available_pt_on_map = count(geodir_get_posttypes('array')) - count($exclude_post_types); |
@@ -310,12 +310,12 @@ discard block |
||
310 | 310 | } |
311 | 311 | ?> |
312 | 312 | <div |
313 | - class="map-category-listing<?php echo $map_cat_class;?>"> |
|
313 | + class="map-category-listing<?php echo $map_cat_class; ?>"> |
|
314 | 314 | <div class="trigger triggeroff"><i class="fa fa-compress"></i><i class="fa fa-expand"></i></div> |
315 | - <div id="<?php echo $map_canvas_name;?>_cat" |
|
316 | - class="<?php echo $map_canvas_name;?>_map_category map_category" |
|
317 | - <?php if ($child_collapse){ ?>checked="checked" <?php }?> |
|
318 | - style="max-height:<?php echo $geodir_map_options['height'];?>;"> |
|
315 | + <div id="<?php echo $map_canvas_name; ?>_cat" |
|
316 | + class="<?php echo $map_canvas_name; ?>_map_category map_category" |
|
317 | + <?php if ($child_collapse) { ?>checked="checked" <?php }?> |
|
318 | + style="max-height:<?php echo $geodir_map_options['height']; ?>;"> |
|
319 | 319 | <input |
320 | 320 | onkeydown="if(event.keyCode == 13){build_map_ajax_search_param('<?php echo $map_canvas_name; ?>', false)}" |
321 | 321 | type="text" |
@@ -327,11 +327,11 @@ discard block |
||
327 | 327 | <input type="hidden" id="<?php echo $map_canvas_name; ?>_child_collapse" value="1"/> |
328 | 328 | <?php } else {$child_collapse = "0"; |
329 | 329 | ?> |
330 | - <input type="hidden" id="<?php echo $map_canvas_name;?>_child_collapse" value="0"/> |
|
330 | + <input type="hidden" id="<?php echo $map_canvas_name; ?>_child_collapse" value="0"/> |
|
331 | 331 | <?php } ?> |
332 | 332 | <input type="hidden" id="<?php echo $map_canvas_name; ?>_cat_enabled" value="1"/> |
333 | 333 | <div class="toggle"> |
334 | - <?php echo home_map_taxonomy_walker(array($map_search_pt.'category'),0,true,0,$map_canvas_name,$child_collapse,true); ?> |
|
334 | + <?php echo home_map_taxonomy_walker(array($map_search_pt . 'category'), 0, true, 0, $map_canvas_name, $child_collapse, true); ?> |
|
335 | 335 | <script>jQuery( document ).ready(function() { |
336 | 336 | geodir_show_sub_cat_collapse_button(); |
337 | 337 | });</script> |
@@ -360,21 +360,21 @@ discard block |
||
360 | 360 | $city = $country != 'me' ? $city : ''; |
361 | 361 | $gd_neighbourhood = isset($_REQUEST['gd_neighbourhood']) ? sanitize_text_field($_REQUEST['gd_neighbourhood']) : ''; |
362 | 362 | ?> |
363 | - <input type="hidden" id="<?php echo $map_canvas_name;?>_location_enabled" value="1"/> |
|
364 | - <input type="hidden" id="<?php echo $map_canvas_name;?>_country" name="gd_country" |
|
365 | - value="<?php echo $country;?>"/> |
|
366 | - <input type="hidden" id="<?php echo $map_canvas_name;?>_region" name="gd_region" |
|
367 | - value="<?php echo $region;?>"/> |
|
368 | - <input type="hidden" id="<?php echo $map_canvas_name;?>_city" name="gd_city" |
|
369 | - value="<?php echo $city;?>"/> |
|
370 | - <input type="hidden" id="<?php echo $map_canvas_name;?>_neighbourhood" name="gd_neighbourhood" |
|
371 | - value="<?php echo $gd_neighbourhood;?>"/> |
|
363 | + <input type="hidden" id="<?php echo $map_canvas_name; ?>_location_enabled" value="1"/> |
|
364 | + <input type="hidden" id="<?php echo $map_canvas_name; ?>_country" name="gd_country" |
|
365 | + value="<?php echo $country; ?>"/> |
|
366 | + <input type="hidden" id="<?php echo $map_canvas_name; ?>_region" name="gd_region" |
|
367 | + value="<?php echo $region; ?>"/> |
|
368 | + <input type="hidden" id="<?php echo $map_canvas_name; ?>_city" name="gd_city" |
|
369 | + value="<?php echo $city; ?>"/> |
|
370 | + <input type="hidden" id="<?php echo $map_canvas_name; ?>_neighbourhood" name="gd_neighbourhood" |
|
371 | + value="<?php echo $gd_neighbourhood; ?>"/> |
|
372 | 372 | <?php } else { //end of location filter |
373 | 373 | ?> |
374 | - <input type="hidden" id="<?php echo $map_canvas_name;?>_location_enabled" value="0"/> |
|
374 | + <input type="hidden" id="<?php echo $map_canvas_name; ?>_location_enabled" value="0"/> |
|
375 | 375 | <?php }?> |
376 | 376 | |
377 | - <input type="hidden" id="<?php echo $map_canvas_name;?>_posttype" name="gd_posttype" value="<?php echo $map_search_pt;?>"/> |
|
377 | + <input type="hidden" id="<?php echo $map_canvas_name; ?>_posttype" name="gd_posttype" value="<?php echo $map_search_pt; ?>"/> |
|
378 | 378 | |
379 | 379 | <input type="hidden" name="limitstart" value=""/> |
380 | 380 | |
@@ -382,10 +382,10 @@ discard block |
||
382 | 382 | |
383 | 383 | <?php if ($geodir_map_options['enable_post_type_filters']) { |
384 | 384 | $post_types = geodir_get_posttypes('object'); |
385 | - if (count((array)($post_types)) > 1) { |
|
385 | + if (count((array) ($post_types)) > 1) { |
|
386 | 386 | ?> |
387 | - <div class="map-places-listing" id="<?php echo $map_canvas_name;?>_posttype_menu" |
|
388 | - style="max-width:<?php echo $map_width;?>!important;"> |
|
387 | + <div class="map-places-listing" id="<?php echo $map_canvas_name; ?>_posttype_menu" |
|
388 | + style="max-width:<?php echo $map_width; ?>!important;"> |
|
389 | 389 | |
390 | 390 | <?php if (isset($geodir_map_options['is_geodir_home_map_widget']) && $map_args['is_geodir_home_map_widget']) { ?> |
391 | 391 | <div class="geodir-map-posttype-list"><?php } ?> |
@@ -421,9 +421,9 @@ discard block |
||
421 | 421 | <script type="text/javascript"> |
422 | 422 | |
423 | 423 | jQuery(document).ready(function () { |
424 | - //initMap('<?php echo $map_canvas_name;?>'); // depreciated, no need to load this twice |
|
425 | - build_map_ajax_search_param('<?php echo $map_canvas_name;?>', false); |
|
426 | - map_sticky('<?php echo $map_canvas_name;?>'); |
|
424 | + //initMap('<?php echo $map_canvas_name; ?>'); // depreciated, no need to load this twice |
|
425 | + build_map_ajax_search_param('<?php echo $map_canvas_name; ?>', false); |
|
426 | + map_sticky('<?php echo $map_canvas_name; ?>'); |
|
427 | 427 | }); |
428 | 428 | |
429 | 429 | </script> |
@@ -434,18 +434,18 @@ discard block |
||
434 | 434 | <script> |
435 | 435 | (function () { |
436 | 436 | var screenH = jQuery(window).height(); |
437 | - var heightVH = "<?php echo str_replace("vh", "", $geodir_map_options['height']);?>"; |
|
437 | + var heightVH = "<?php echo str_replace("vh", "", $geodir_map_options['height']); ?>"; |
|
438 | 438 | |
439 | 439 | var ptypeH = ''; |
440 | - if (jQuery("#<?php echo $map_canvas_name;?>_posttype_menu").length) { |
|
441 | - ptypeH = jQuery("#<?php echo $map_canvas_name;?>_posttype_menu").outerHeight(); |
|
440 | + if (jQuery("#<?php echo $map_canvas_name; ?>_posttype_menu").length) { |
|
441 | + ptypeH = jQuery("#<?php echo $map_canvas_name; ?>_posttype_menu").outerHeight(); |
|
442 | 442 | } |
443 | 443 | |
444 | - jQuery("#sticky_map_<?php echo $map_canvas_name;?>").css("min-height", screenH * (heightVH / 100) + 'px'); |
|
445 | - jQuery("#<?php echo $map_canvas_name;?>_wrapper").height(screenH * (heightVH / 100) + 'px'); |
|
446 | - jQuery("#<?php echo $map_canvas_name;?>").height(screenH * (heightVH / 100) + 'px'); |
|
447 | - jQuery("#<?php echo $map_canvas_name;?>_loading_div").height(screenH * (heightVH / 100) + 'px'); |
|
448 | - jQuery("#<?php echo $map_canvas_name;?>_cat").css("max-height", (screenH * (heightVH / 100)) - ptypeH + 'px'); |
|
444 | + jQuery("#sticky_map_<?php echo $map_canvas_name; ?>").css("min-height", screenH * (heightVH / 100) + 'px'); |
|
445 | + jQuery("#<?php echo $map_canvas_name; ?>_wrapper").height(screenH * (heightVH / 100) + 'px'); |
|
446 | + jQuery("#<?php echo $map_canvas_name; ?>").height(screenH * (heightVH / 100) + 'px'); |
|
447 | + jQuery("#<?php echo $map_canvas_name; ?>_loading_div").height(screenH * (heightVH / 100) + 'px'); |
|
448 | + jQuery("#<?php echo $map_canvas_name; ?>_cat").css("max-height", (screenH * (heightVH / 100)) - ptypeH + 'px'); |
|
449 | 449 | |
450 | 450 | }()); |
451 | 451 | </script> |
@@ -457,13 +457,13 @@ discard block |
||
457 | 457 | <script> |
458 | 458 | (function () { |
459 | 459 | var screenH = jQuery(window).height(); |
460 | - var heightVH = "<?php echo str_replace("px", "", $geodir_map_options['height']);?>"; |
|
460 | + var heightVH = "<?php echo str_replace("px", "", $geodir_map_options['height']); ?>"; |
|
461 | 461 | var ptypeH = ''; |
462 | - if (jQuery("#<?php echo $map_canvas_name;?>_posttype_menu").length) { |
|
463 | - ptypeH = jQuery("#<?php echo $map_canvas_name;?>_posttype_menu").outerHeight(); |
|
462 | + if (jQuery("#<?php echo $map_canvas_name; ?>_posttype_menu").length) { |
|
463 | + ptypeH = jQuery("#<?php echo $map_canvas_name; ?>_posttype_menu").outerHeight(); |
|
464 | 464 | } |
465 | 465 | |
466 | - jQuery("#<?php echo $map_canvas_name;?>_cat").css("max-height", heightVH - ptypeH + 'px'); |
|
466 | + jQuery("#<?php echo $map_canvas_name; ?>_cat").css("max-height", heightVH - ptypeH + 'px'); |
|
467 | 467 | |
468 | 468 | }()); |
469 | 469 | </script> |
@@ -478,7 +478,7 @@ discard block |
||
478 | 478 | * @param array $geodir_map_options Array of map settings. |
479 | 479 | * @param string $map_canvas_name The canvas name and ID for the map. |
480 | 480 | */ |
481 | - do_action('geodir_map_after_render',$geodir_map_options,$map_canvas_name); |
|
481 | + do_action('geodir_map_after_render', $geodir_map_options, $map_canvas_name); |
|
482 | 482 | |
483 | 483 | |
484 | 484 | endif; // Exclude posttypes if end |
@@ -445,16 +445,16 @@ discard block |
||
445 | 445 | case 'Array': |
446 | 446 | $post_types = (array)$post_types; |
447 | 447 | break; |
448 | - case 'options': |
|
448 | + case 'options': |
|
449 | 449 | $post_types = (array)$post_types; |
450 | 450 | |
451 | - $options = array(); |
|
452 | - if (!empty($post_types)) { |
|
453 | - foreach ($post_types as $key => $info) { |
|
454 | - $options[$key] = __($info['labels']['singular_name'], 'geodirectory'); |
|
455 | - } |
|
456 | - } |
|
457 | - $post_types = $options; |
|
451 | + $options = array(); |
|
452 | + if (!empty($post_types)) { |
|
453 | + foreach ($post_types as $key => $info) { |
|
454 | + $options[$key] = __($info['labels']['singular_name'], 'geodirectory'); |
|
455 | + } |
|
456 | + } |
|
457 | + $post_types = $options; |
|
458 | 458 | break; |
459 | 459 | default: |
460 | 460 | $post_types = array_keys($post_types); |
@@ -1064,7 +1064,7 @@ discard block |
||
1064 | 1064 | if (is_array($post_cat_array)) { |
1065 | 1065 | $post_cat_array = array_unique( $post_cat_array ); |
1066 | 1066 | |
1067 | - foreach ($post_cat_array as $post_cat_html) { |
|
1067 | + foreach ($post_cat_array as $post_cat_html) { |
|
1068 | 1068 | |
1069 | 1069 | $post_cat_info = explode(":", $post_cat_html); |
1070 | 1070 | $post_maincat_str = $post_cat_info[0]; |
@@ -1429,21 +1429,21 @@ discard block |
||
1429 | 1429 | } |
1430 | 1430 | } |
1431 | 1431 | |
1432 | - // Fix slug problem when slug matches part of host or base url/ Ex: url -> www.abcxyz.com & slug -> xyz. |
|
1432 | + // Fix slug problem when slug matches part of host or base url/ Ex: url -> www.abcxyz.com & slug -> xyz. |
|
1433 | 1433 | $site_url = trailingslashit(get_bloginfo('url')); |
1434 | 1434 | |
1435 | - $fix_url = strpos($post_link, $site_url) === 0 ? true : false; |
|
1436 | - if ($fix_url) { |
|
1437 | - $post_link = str_replace($site_url, '', $post_link); |
|
1438 | - } |
|
1435 | + $fix_url = strpos($post_link, $site_url) === 0 ? true : false; |
|
1436 | + if ($fix_url) { |
|
1437 | + $post_link = str_replace($site_url, '', $post_link); |
|
1438 | + } |
|
1439 | 1439 | |
1440 | 1440 | $post_link = trailingslashit( |
1441 | 1441 | preg_replace( "/" . preg_quote( $slug, "/" ) . "/", $slug ."/%gd_taxonomy%",$post_link, 1 ) |
1442 | 1442 | ); |
1443 | 1443 | |
1444 | - if ($fix_url) { |
|
1445 | - $post_link = $site_url . $post_link; |
|
1446 | - } |
|
1444 | + if ($fix_url) { |
|
1445 | + $post_link = $site_url . $post_link; |
|
1446 | + } |
|
1447 | 1447 | |
1448 | 1448 | if (isset($comment_post_cache[$post->ID])) { |
1449 | 1449 | $post = $comment_post_cache[$post->ID]; |
@@ -1531,23 +1531,23 @@ discard block |
||
1531 | 1531 | |
1532 | 1532 | if (!empty($post_location)) { |
1533 | 1533 | $country_slug = isset($post_location->country_slug) ? $post_location->country_slug : ''; |
1534 | - $region_slug = isset($post_location->region_slug) ? $post_location->region_slug : ''; |
|
1535 | - $city_slug = isset($post_location->city_slug) ? $post_location->city_slug : ''; |
|
1534 | + $region_slug = isset($post_location->region_slug) ? $post_location->region_slug : ''; |
|
1535 | + $city_slug = isset($post_location->city_slug) ? $post_location->city_slug : ''; |
|
1536 | 1536 | |
1537 | - $geodir_show_location_url = get_option('geodir_show_location_url'); |
|
1537 | + $geodir_show_location_url = get_option('geodir_show_location_url'); |
|
1538 | 1538 | |
1539 | - $location_slug = array(); |
|
1540 | - if ($geodir_show_location_url == 'all') { |
|
1541 | - $location_slug[] = $country_slug; |
|
1542 | - $location_slug[] = $region_slug; |
|
1543 | - } else if ($geodir_show_location_url == 'country_city') { |
|
1544 | - $location_slug[] = $country_slug; |
|
1545 | - } else if ($geodir_show_location_url == 'region_city') { |
|
1546 | - $location_slug[] = $region_slug; |
|
1547 | - } |
|
1548 | - $location_slug[] = $city_slug; |
|
1539 | + $location_slug = array(); |
|
1540 | + if ($geodir_show_location_url == 'all') { |
|
1541 | + $location_slug[] = $country_slug; |
|
1542 | + $location_slug[] = $region_slug; |
|
1543 | + } else if ($geodir_show_location_url == 'country_city') { |
|
1544 | + $location_slug[] = $country_slug; |
|
1545 | + } else if ($geodir_show_location_url == 'region_city') { |
|
1546 | + $location_slug[] = $region_slug; |
|
1547 | + } |
|
1548 | + $location_slug[] = $city_slug; |
|
1549 | 1549 | |
1550 | - $location_request .= implode('/', $location_slug) . '/'; |
|
1550 | + $location_request .= implode('/', $location_slug) . '/'; |
|
1551 | 1551 | } |
1552 | 1552 | } |
1553 | 1553 | |
@@ -1655,19 +1655,19 @@ discard block |
||
1655 | 1655 | if ($include_location) { |
1656 | 1656 | global $post; |
1657 | 1657 | |
1658 | - $location_manager = defined('POST_LOCATION_TABLE') ? true : false; |
|
1659 | - $neighbourhood_active = $location_manager && get_option('location_neighbourhoods') ? true : false; |
|
1658 | + $location_manager = defined('POST_LOCATION_TABLE') ? true : false; |
|
1659 | + $neighbourhood_active = $location_manager && get_option('location_neighbourhoods') ? true : false; |
|
1660 | 1660 | |
1661 | - if(geodir_is_page('detail') && isset($post->country_slug)){ |
|
1661 | + if(geodir_is_page('detail') && isset($post->country_slug)){ |
|
1662 | 1662 | $location_terms = array( |
1663 | 1663 | 'gd_country' => $post->country_slug, |
1664 | 1664 | 'gd_region' => $post->region_slug, |
1665 | 1665 | 'gd_city' => $post->city_slug |
1666 | 1666 | ); |
1667 | 1667 | |
1668 | - if ($neighbourhood_active && !empty($location_terms['gd_city']) && $gd_ses_neighbourhood = $gd_session->get('gd_neighbourhood')) { |
|
1669 | - $location_terms['gd_neighbourhood'] = $gd_ses_neighbourhood; |
|
1670 | - } |
|
1668 | + if ($neighbourhood_active && !empty($location_terms['gd_city']) && $gd_ses_neighbourhood = $gd_session->get('gd_neighbourhood')) { |
|
1669 | + $location_terms['gd_neighbourhood'] = $gd_ses_neighbourhood; |
|
1670 | + } |
|
1671 | 1671 | } else { |
1672 | 1672 | $location_terms = geodir_get_current_location_terms('query_vars'); |
1673 | 1673 | } |
@@ -1703,7 +1703,7 @@ discard block |
||
1703 | 1703 | if(function_exists('icl_object_id')){ |
1704 | 1704 | $post_types = get_option('geodir_post_types'); |
1705 | 1705 | $post_type = str_replace("category","",$taxonomy); |
1706 | - $post_type = str_replace("_tags","",$post_type); |
|
1706 | + $post_type = str_replace("_tags","",$post_type); |
|
1707 | 1707 | $slug = $post_types[$post_type]['rewrite']['slug']; |
1708 | 1708 | if ( gd_wpml_slug_translation_turned_on( $post_type )) { |
1709 | 1709 | |
@@ -1751,13 +1751,13 @@ discard block |
||
1751 | 1751 | * @return string The modified link. |
1752 | 1752 | */ |
1753 | 1753 | function geodir_posttype_link($link, $post_type) { |
1754 | - global $geodir_add_location_url, $post, $gd_session; |
|
1754 | + global $geodir_add_location_url, $post, $gd_session; |
|
1755 | 1755 | |
1756 | - $location_terms = array(); |
|
1756 | + $location_terms = array(); |
|
1757 | 1757 | |
1758 | - if (in_array($post_type, geodir_get_posttypes())) { |
|
1759 | - if (get_option('geodir_add_location_url') && $gd_session->get('gd_multi_location') == 1) { |
|
1760 | - if(geodir_is_page('detail') && !empty($post) && isset($post->country_slug)) { |
|
1758 | + if (in_array($post_type, geodir_get_posttypes())) { |
|
1759 | + if (get_option('geodir_add_location_url') && $gd_session->get('gd_multi_location') == 1) { |
|
1760 | + if(geodir_is_page('detail') && !empty($post) && isset($post->country_slug)) { |
|
1761 | 1761 | $location_terms = array( |
1762 | 1762 | 'gd_country' => $post->country_slug, |
1763 | 1763 | 'gd_region' => $post->region_slug, |
@@ -1767,22 +1767,22 @@ discard block |
||
1767 | 1767 | $location_terms = geodir_get_current_location_terms('query_vars'); |
1768 | 1768 | } |
1769 | 1769 | |
1770 | - $location_terms = geodir_remove_location_terms($location_terms); |
|
1770 | + $location_terms = geodir_remove_location_terms($location_terms); |
|
1771 | 1771 | |
1772 | - if (!empty($location_terms)) { |
|
1773 | - if (get_option('permalink_structure') != '') { |
|
1774 | - $location_terms = implode("/", $location_terms); |
|
1775 | - $location_terms = rtrim($location_terms, '/'); |
|
1772 | + if (!empty($location_terms)) { |
|
1773 | + if (get_option('permalink_structure') != '') { |
|
1774 | + $location_terms = implode("/", $location_terms); |
|
1775 | + $location_terms = rtrim($location_terms, '/'); |
|
1776 | 1776 | |
1777 | - $link .= urldecode($location_terms) . '/'; |
|
1778 | - } else { |
|
1779 | - $link = geodir_getlink($link, $location_terms); |
|
1780 | - } |
|
1781 | - } |
|
1782 | - } |
|
1783 | - } |
|
1777 | + $link .= urldecode($location_terms) . '/'; |
|
1778 | + } else { |
|
1779 | + $link = geodir_getlink($link, $location_terms); |
|
1780 | + } |
|
1781 | + } |
|
1782 | + } |
|
1783 | + } |
|
1784 | 1784 | |
1785 | - return $link; |
|
1785 | + return $link; |
|
1786 | 1786 | } |
1787 | 1787 | |
1788 | 1788 | /** |
@@ -188,7 +188,7 @@ discard block |
||
188 | 188 | $cpt_name = __($args->labels->singular_name, 'geodirectory'); |
189 | 189 | $items .= '<li class="' . $li_class . '"> |
190 | 190 | <a href="' . geodir_get_addlisting_link($post_type) . '" class="' . $a_class . '"> |
191 | - ' . sprintf( __('Add %s', 'geodirectory'), $cpt_name ) . ' |
|
191 | + ' . sprintf(__('Add %s', 'geodirectory'), $cpt_name) . ' |
|
192 | 192 | </a> |
193 | 193 | </li>'; |
194 | 194 | } |
@@ -267,7 +267,7 @@ discard block |
||
267 | 267 | $cpt_name = __($args->labels->singular_name, 'geodirectory'); |
268 | 268 | $items .= '<li class="' . $li_class . '"> |
269 | 269 | <a href="' . geodir_get_addlisting_link($post_type) . '" class="' . $sub_a_class . '"> |
270 | - ' . sprintf( __('Add %s', 'geodirectory'), $cpt_name ) . ' |
|
270 | + ' . sprintf(__('Add %s', 'geodirectory'), $cpt_name) . ' |
|
271 | 271 | </a> |
272 | 272 | </li>'; |
273 | 273 | } |
@@ -399,7 +399,7 @@ discard block |
||
399 | 399 | |
400 | 400 | if (geodir_is_page('add-listing') || geodir_is_page('preview')) { |
401 | 401 | if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') |
402 | - $geodir_post_type = get_post_type((int)$_REQUEST['pid']); |
|
402 | + $geodir_post_type = get_post_type((int) $_REQUEST['pid']); |
|
403 | 403 | elseif (isset($_REQUEST['listing_type'])) |
404 | 404 | $geodir_post_type = sanitize_text_field($_REQUEST['listing_type']); |
405 | 405 | } |
@@ -439,14 +439,14 @@ discard block |
||
439 | 439 | switch ($output): |
440 | 440 | case 'object': |
441 | 441 | case 'Object': |
442 | - $post_types = json_decode(json_encode($post_types), FALSE);//(object)$post_types; |
|
442 | + $post_types = json_decode(json_encode($post_types), FALSE); //(object)$post_types; |
|
443 | 443 | break; |
444 | 444 | case 'array': |
445 | 445 | case 'Array': |
446 | - $post_types = (array)$post_types; |
|
446 | + $post_types = (array) $post_types; |
|
447 | 447 | break; |
448 | 448 | case 'options': |
449 | - $post_types = (array)$post_types; |
|
449 | + $post_types = (array) $post_types; |
|
450 | 450 | |
451 | 451 | $options = array(); |
452 | 452 | if (!empty($post_types)) { |
@@ -640,7 +640,7 @@ discard block |
||
640 | 640 | } elseif (isset($wp_query->tax_query->queries)) { |
641 | 641 | $tax_arr = $wp_query->tax_query->queries; |
642 | 642 | //if tax query has 'relation' set then it will break wp_list_pluck so we remove it |
643 | - if(isset( $tax_arr['relation'])){unset( $tax_arr['relation']);} |
|
643 | + if (isset($tax_arr['relation'])) {unset($tax_arr['relation']); } |
|
644 | 644 | $taxonomies = wp_list_pluck($tax_arr, 'taxonomy'); |
645 | 645 | } |
646 | 646 | |
@@ -763,7 +763,7 @@ discard block |
||
763 | 763 | $cat_exclude = serialize($exclude_cats); |
764 | 764 | |
765 | 765 | if (isset($_REQUEST['backandedit'])) { |
766 | - $post = (object)$gd_session->get('listing'); |
|
766 | + $post = (object) $gd_session->get('listing'); |
|
767 | 767 | |
768 | 768 | if (!is_array($post->post_category[$cat_taxonomy])) |
769 | 769 | $post_category = $post->post_category[$cat_taxonomy]; |
@@ -841,14 +841,14 @@ discard block |
||
841 | 841 | |
842 | 842 | function show_subcatlist(main_cat, catObj) { |
843 | 843 | if (main_cat != '') { |
844 | - var url = '<?php echo geodir_get_ajax_url();?>'; |
|
845 | - var cat_taxonomy = '<?php echo $cat_taxonomy;?>'; |
|
846 | - var cat_exclude = '<?php echo base64_encode($cat_exclude);?>'; |
|
844 | + var url = '<?php echo geodir_get_ajax_url(); ?>'; |
|
845 | + var cat_taxonomy = '<?php echo $cat_taxonomy; ?>'; |
|
846 | + var cat_exclude = '<?php echo base64_encode($cat_exclude); ?>'; |
|
847 | 847 | var cat_limit = jQuery('#' + cat_taxonomy).find('#cat_limit').val(); |
848 | - <?php if ((int)$cat_limit > 0) { ?> |
|
848 | + <?php if ((int) $cat_limit > 0) { ?> |
|
849 | 849 | var selected = parseInt(jQuery('#' + cat_taxonomy).find('.cat_sublist > div.post_catlist_item').length); |
850 | 850 | if (cat_limit != '' && selected > 0 && selected >= cat_limit && cat_limit != 0) { |
851 | - alert("<?php echo esc_attr(wp_sprintf(__('You have reached category limit of %d categories.', 'geodirectory'), (int)$cat_limit));?>"); |
|
851 | + alert("<?php echo esc_attr(wp_sprintf(__('You have reached category limit of %d categories.', 'geodirectory'), (int) $cat_limit)); ?>"); |
|
852 | 852 | return false; |
853 | 853 | } |
854 | 854 | <?php } ?> |
@@ -887,7 +887,7 @@ discard block |
||
887 | 887 | } |
888 | 888 | |
889 | 889 | function update_listing_cat(el) { |
890 | - var cat_taxonomy = '<?php echo $cat_taxonomy;?>'; |
|
890 | + var cat_taxonomy = '<?php echo $cat_taxonomy; ?>'; |
|
891 | 891 | var cat_ids = ''; |
892 | 892 | var main_cat = ''; |
893 | 893 | var sub_cat = ''; |
@@ -968,7 +968,7 @@ discard block |
||
968 | 968 | <div class="main_cat_list" style=" <?php if (isset($style)) { |
969 | 969 | echo $style; |
970 | 970 | }?> "> |
971 | - <?php geodir_get_catlist($cat_taxonomy, 0); // print main categories list |
|
971 | + <?php geodir_get_catlist($cat_taxonomy, 0); // print main categories list |
|
972 | 972 | ?> |
973 | 973 | </div> |
974 | 974 | <?php |
@@ -995,9 +995,9 @@ discard block |
||
995 | 995 | if ($exclude != '') { |
996 | 996 | $exclude_cats = maybe_unserialize(base64_decode($exclude)); |
997 | 997 | print_r($exclude_cats); |
998 | - if(is_array( $exclude_cats)){ |
|
999 | - $exclude_cats = array_map( 'intval', $exclude_cats ); |
|
1000 | - }else{ |
|
998 | + if (is_array($exclude_cats)) { |
|
999 | + $exclude_cats = array_map('intval', $exclude_cats); |
|
1000 | + } else { |
|
1001 | 1001 | $exclude_cats = intval($exclude_cats); |
1002 | 1002 | } |
1003 | 1003 | |
@@ -1011,25 +1011,25 @@ discard block |
||
1011 | 1011 | <?php $main_cat = get_term($parrent, $request_taxonomy); ?> |
1012 | 1012 | |
1013 | 1013 | <div class="post_catlist_item" style="border:1px solid #CCCCCC; margin:5px auto; padding:5px;"> |
1014 | - <img alt="move icon" src="<?php echo geodir_plugin_url() . '/geodirectory-assets/images/move.png';?>" |
|
1014 | + <img alt="move icon" src="<?php echo geodir_plugin_url() . '/geodirectory-assets/images/move.png'; ?>" |
|
1015 | 1015 | onclick="jQuery(this).closest('div').remove();update_listing_cat(this);" align="right"/> |
1016 | 1016 | <?php /* ?> |
1017 | 1017 | <img src="<?php echo geodir_plugin_url().'/geodirectory-assets/images/move.png';?>" onclick="jQuery(this).closest('div').remove();show_subcatlist();" align="right" /> |
1018 | 1018 | <?php */ ?> |
1019 | 1019 | |
1020 | - <input type="checkbox" value="<?php echo $main_cat->term_id;?>" class="listing_main_cat" |
|
1020 | + <input type="checkbox" value="<?php echo $main_cat->term_id; ?>" class="listing_main_cat" |
|
1021 | 1021 | onchange="if(jQuery(this).is(':checked')){jQuery(this).closest('div').find('.post_default_category').prop('checked',false).show();}else{jQuery(this).closest('div').find('.post_default_category').prop('checked',false).hide();};update_listing_cat()" |
1022 | 1022 | checked="checked" disabled="disabled"/> |
1023 | 1023 | <span> |
1024 | - <?php printf(__('Add listing in %s category', 'geodirectory'), geodir_ucwords($main_cat->name));?> |
|
1024 | + <?php printf(__('Add listing in %s category', 'geodirectory'), geodir_ucwords($main_cat->name)); ?> |
|
1025 | 1025 | </span> |
1026 | 1026 | <br/> |
1027 | 1027 | |
1028 | 1028 | <div class="post_default_category"> |
1029 | - <input type="radio" name="post_default_category" value="<?php echo $main_cat->term_id;?>" |
|
1030 | - onchange="update_listing_cat()" <?php if ($default) echo ' checked="checked" ';?> /> |
|
1029 | + <input type="radio" name="post_default_category" value="<?php echo $main_cat->term_id; ?>" |
|
1030 | + onchange="update_listing_cat()" <?php if ($default) echo ' checked="checked" '; ?> /> |
|
1031 | 1031 | <span> |
1032 | - <?php printf(__('Set %s as default category', 'geodirectory'), geodir_ucwords($main_cat->name));?> |
|
1032 | + <?php printf(__('Set %s as default category', 'geodirectory'), geodir_ucwords($main_cat->name)); ?> |
|
1033 | 1033 | </span> |
1034 | 1034 | </div> |
1035 | 1035 | |
@@ -1062,7 +1062,7 @@ discard block |
||
1062 | 1062 | $post_cat_str = $post_categories[$request_taxonomy]; |
1063 | 1063 | $post_cat_array = explode("#", $post_cat_str); |
1064 | 1064 | if (is_array($post_cat_array)) { |
1065 | - $post_cat_array = array_unique( $post_cat_array ); |
|
1065 | + $post_cat_array = array_unique($post_cat_array); |
|
1066 | 1066 | |
1067 | 1067 | foreach ($post_cat_array as $post_cat_html) { |
1068 | 1068 | |
@@ -1077,7 +1077,7 @@ discard block |
||
1077 | 1077 | } |
1078 | 1078 | $post_sub_catid = ''; |
1079 | 1079 | if (isset($post_cat_info[1]) && !empty($post_cat_info[1])) { |
1080 | - $post_sub_catid = (int)$post_cat_info[1]; |
|
1080 | + $post_sub_catid = (int) $post_cat_info[1]; |
|
1081 | 1081 | } |
1082 | 1082 | |
1083 | 1083 | geodir_addpost_categories_html($request_taxonomy, $post_maincat_id, $post_sub_catid, $post_maincat_selected, $post_maincat_default); |
@@ -1098,7 +1098,7 @@ discard block |
||
1098 | 1098 | } |
1099 | 1099 | |
1100 | 1100 | if (isset($post_cat_info[1]) && !empty($post_cat_info[1])) { |
1101 | - $post_sub_catid = (int)$post_cat_info[1]; |
|
1101 | + $post_sub_catid = (int) $post_cat_info[1]; |
|
1102 | 1102 | } |
1103 | 1103 | |
1104 | 1104 | geodir_addpost_categories_html($request_taxonomy, $post_maincat_id, $post_sub_catid, $post_maincat_selected, $post_maincat_default); |
@@ -1140,8 +1140,8 @@ discard block |
||
1140 | 1140 | $option_selected = ' selected="selected" '; |
1141 | 1141 | |
1142 | 1142 | // Count child terms |
1143 | - $child_terms = get_terms( $cat_taxonomy, array( 'parent' => $cat_term->term_id, 'hide_empty' => false, 'exclude' => $exclude_cats, 'number' => 1 ) ); |
|
1144 | - $has_child = !empty( $child_terms ) ? 't' : 'f'; |
|
1143 | + $child_terms = get_terms($cat_taxonomy, array('parent' => $cat_term->term_id, 'hide_empty' => false, 'exclude' => $exclude_cats, 'number' => 1)); |
|
1144 | + $has_child = !empty($child_terms) ? 't' : 'f'; |
|
1145 | 1145 | |
1146 | 1146 | echo '<option ' . $option_selected . ' alt="' . $cat_term->taxonomy . '" title="' . ucfirst($cat_term->name) . '" value="' . $cat_term->term_id . '" _hc="' . $has_child . '" >' . ucfirst($cat_term->name) . '</option>'; |
1147 | 1147 | } |
@@ -1174,7 +1174,7 @@ discard block |
||
1174 | 1174 | 2 => __('Custom field updated.', 'geodirectory'), |
1175 | 1175 | 3 => __('Custom field deleted.', 'geodirectory'), |
1176 | 1176 | 4 => sprintf(__('%s updated.', 'geodirectory'), $post_object->labels->singular_name), |
1177 | - 5 => isset($_GET['revision']) ? sprintf(__('%s restored to revision from %s', 'geodirectory'), $post_object->labels->singular_name, wp_post_revision_title((int)$_GET['revision'], false)) : false, |
|
1177 | + 5 => isset($_GET['revision']) ? sprintf(__('%s restored to revision from %s', 'geodirectory'), $post_object->labels->singular_name, wp_post_revision_title((int) $_GET['revision'], false)) : false, |
|
1178 | 1178 | 6 => sprintf(__('%s published. <a href="%s">View %s</a>', 'geodirectory'), $post_object->labels->singular_name, esc_url(get_permalink($post_ID)), $post_object->labels->singular_name), |
1179 | 1179 | 7 => sprintf(__('%s saved.', 'geodirectory'), $post_object->labels->singular_name), |
1180 | 1180 | 8 => sprintf(__('%s submitted. <a target="_blank" href="%s">Preview %s</a>', 'geodirectory'), $post_object->labels->singular_name, esc_url(add_query_arg('preview', 'true', get_permalink($post_ID))), $post_object->labels->singular_name), |
@@ -1311,7 +1311,7 @@ discard block |
||
1311 | 1311 | 'menu_icon' => $menu_icon, |
1312 | 1312 | 'public' => true, |
1313 | 1313 | 'query_var' => true, |
1314 | - 'rewrite' => array('slug' => $listing_slug , 'with_front' => false, 'hierarchical' => true), |
|
1314 | + 'rewrite' => array('slug' => $listing_slug, 'with_front' => false, 'hierarchical' => true), |
|
1315 | 1315 | 'supports' => array('title', 'editor', 'author', 'thumbnail', 'excerpt', 'custom-fields', 'comments', /*'revisions', 'post-formats'*/), |
1316 | 1316 | 'taxonomies' => array('gd_placecategory', 'gd_place_tags')); |
1317 | 1317 | |
@@ -1333,25 +1333,25 @@ discard block |
||
1333 | 1333 | } |
1334 | 1334 | |
1335 | 1335 | $gd_wpml_get_languages = ""; |
1336 | -function gd_wpml_get_lang_from_url($url){ |
|
1336 | +function gd_wpml_get_lang_from_url($url) { |
|
1337 | 1337 | |
1338 | 1338 | global $gd_wpml_get_languages; |
1339 | - if(isset($_REQUEST['lang']) && $_REQUEST['lang']){return $_REQUEST['lang'];} |
|
1339 | + if (isset($_REQUEST['lang']) && $_REQUEST['lang']) {return $_REQUEST['lang']; } |
|
1340 | 1340 | |
1341 | 1341 | |
1342 | 1342 | // |
1343 | - $url = str_replace(array("http://","https://"),"",$url); |
|
1344 | - $site_url = str_replace(array("http://","https://"),"",get_bloginfo('url')); |
|
1343 | + $url = str_replace(array("http://", "https://"), "", $url); |
|
1344 | + $site_url = str_replace(array("http://", "https://"), "", get_bloginfo('url')); |
|
1345 | 1345 | |
1346 | - $url = str_replace($site_url,"",$url); |
|
1346 | + $url = str_replace($site_url, "", $url); |
|
1347 | 1347 | |
1348 | 1348 | |
1349 | 1349 | $segments = explode('/', trim($url, '/')); |
1350 | 1350 | |
1351 | 1351 | //print_r( $segments); |
1352 | - if($gd_wpml_get_languages){ |
|
1352 | + if ($gd_wpml_get_languages) { |
|
1353 | 1353 | $langs = $gd_wpml_get_languages; |
1354 | - }else{ |
|
1354 | + } else { |
|
1355 | 1355 | global $sitepress; |
1356 | 1356 | $gd_wpml_get_languages = $sitepress->get_active_languages(); |
1357 | 1357 | } |
@@ -1414,17 +1414,17 @@ discard block |
||
1414 | 1414 | $slug = $post_types[$post->post_type]['rewrite']['slug']; |
1415 | 1415 | |
1416 | 1416 | // Alter the CPT slug if WPML is set to do so |
1417 | - if(function_exists('icl_object_id')){ |
|
1418 | - if ( gd_wpml_slug_translation_turned_on( $post->post_type ) && $language_code = gd_wpml_get_lang_from_url($post_link)) { |
|
1417 | + if (function_exists('icl_object_id')) { |
|
1418 | + if (gd_wpml_slug_translation_turned_on($post->post_type) && $language_code = gd_wpml_get_lang_from_url($post_link)) { |
|
1419 | 1419 | |
1420 | 1420 | $org_slug = $slug; |
1421 | - $slug = apply_filters( 'wpml_translate_single_string', |
|
1421 | + $slug = apply_filters('wpml_translate_single_string', |
|
1422 | 1422 | $slug, |
1423 | 1423 | 'WordPress', |
1424 | 1424 | 'URL slug: ' . $slug, |
1425 | 1425 | $language_code); |
1426 | 1426 | |
1427 | - if(!$slug){$slug = $org_slug;} |
|
1427 | + if (!$slug) {$slug = $org_slug; } |
|
1428 | 1428 | |
1429 | 1429 | } |
1430 | 1430 | } |
@@ -1438,7 +1438,7 @@ discard block |
||
1438 | 1438 | } |
1439 | 1439 | |
1440 | 1440 | $post_link = trailingslashit( |
1441 | - preg_replace( "/" . preg_quote( $slug, "/" ) . "/", $slug ."/%gd_taxonomy%",$post_link, 1 ) |
|
1441 | + preg_replace("/" . preg_quote($slug, "/") . "/", $slug . "/%gd_taxonomy%", $post_link, 1) |
|
1442 | 1442 | ); |
1443 | 1443 | |
1444 | 1444 | if ($fix_url) { |
@@ -1466,7 +1466,7 @@ discard block |
||
1466 | 1466 | ) |
1467 | 1467 | ); |
1468 | 1468 | |
1469 | - $post = (object)array_merge((array)$post, (array)$post2); |
|
1469 | + $post = (object) array_merge((array) $post, (array) $post2); |
|
1470 | 1470 | |
1471 | 1471 | $comment_post_cache[$post->ID] = $post; |
1472 | 1472 | } |
@@ -1475,7 +1475,7 @@ discard block |
||
1475 | 1475 | |
1476 | 1476 | if (false !== strpos($post_link, '%gd_taxonomy%')) { |
1477 | 1477 | |
1478 | - if ( apply_filters("geodir_add_location_url_to_url",get_option('geodir_add_location_url'),$post->post_type,$post)) { |
|
1478 | + if (apply_filters("geodir_add_location_url_to_url", get_option('geodir_add_location_url'), $post->post_type, $post)) { |
|
1479 | 1479 | $location_request = ''; |
1480 | 1480 | |
1481 | 1481 | |
@@ -1489,7 +1489,7 @@ discard block |
||
1489 | 1489 | $post->country_slug = str_replace('[', '', $geodir_arr_locations[2]); |
1490 | 1490 | $post->country_slug = str_replace(']', '', $post->country_slug); |
1491 | 1491 | |
1492 | - $post_location = (object)array('country_slug' => $post->country_slug, |
|
1492 | + $post_location = (object) array('country_slug' => $post->country_slug, |
|
1493 | 1493 | 'region_slug' => $post->region_slug, |
1494 | 1494 | 'city_slug' => $post->city_slug |
1495 | 1495 | ); |
@@ -1518,7 +1518,7 @@ discard block |
||
1518 | 1518 | $post->country_slug = str_replace('[', '', $geodir_arr_locations[2]); |
1519 | 1519 | $post->country_slug = str_replace(']', '', $post->country_slug); |
1520 | 1520 | |
1521 | - $post_location = (object)array('country_slug' => $post->country_slug, |
|
1521 | + $post_location = (object) array('country_slug' => $post->country_slug, |
|
1522 | 1522 | 'region_slug' => $post->region_slug, |
1523 | 1523 | 'city_slug' => $post->city_slug |
1524 | 1524 | ); |
@@ -1658,7 +1658,7 @@ discard block |
||
1658 | 1658 | $location_manager = defined('POST_LOCATION_TABLE') ? true : false; |
1659 | 1659 | $neighbourhood_active = $location_manager && get_option('location_neighbourhoods') ? true : false; |
1660 | 1660 | |
1661 | - if(geodir_is_page('detail') && isset($post->country_slug)){ |
|
1661 | + if (geodir_is_page('detail') && isset($post->country_slug)) { |
|
1662 | 1662 | $location_terms = array( |
1663 | 1663 | 'gd_country' => $post->country_slug, |
1664 | 1664 | 'gd_region' => $post->region_slug, |
@@ -1677,7 +1677,7 @@ discard block |
||
1677 | 1677 | |
1678 | 1678 | if (!empty($location_terms)) { |
1679 | 1679 | |
1680 | - $url_separator = '';//get_option('geodir_listingurl_separator'); |
|
1680 | + $url_separator = ''; //get_option('geodir_listingurl_separator'); |
|
1681 | 1681 | |
1682 | 1682 | if (get_option('permalink_structure') != '') { |
1683 | 1683 | $old_listing_slug = '/' . $listing_slug . '/'; |
@@ -1700,31 +1700,31 @@ discard block |
||
1700 | 1700 | }*/ |
1701 | 1701 | |
1702 | 1702 | // Alter the CPT slug if WPML is set to do so |
1703 | - if(function_exists('icl_object_id')){ |
|
1703 | + if (function_exists('icl_object_id')) { |
|
1704 | 1704 | $post_types = get_option('geodir_post_types'); |
1705 | - $post_type = str_replace("category","",$taxonomy); |
|
1706 | - $post_type = str_replace("_tags","",$post_type); |
|
1705 | + $post_type = str_replace("category", "", $taxonomy); |
|
1706 | + $post_type = str_replace("_tags", "", $post_type); |
|
1707 | 1707 | $slug = $post_types[$post_type]['rewrite']['slug']; |
1708 | - if ( gd_wpml_slug_translation_turned_on( $post_type )) { |
|
1708 | + if (gd_wpml_slug_translation_turned_on($post_type)) { |
|
1709 | 1709 | |
1710 | 1710 | global $sitepress; |
1711 | 1711 | $default_lang = $sitepress->get_default_language(); |
1712 | 1712 | $language_code = gd_wpml_get_lang_from_url($termlink); |
1713 | - if(!$language_code ){$language_code = $default_lang;} |
|
1713 | + if (!$language_code) {$language_code = $default_lang; } |
|
1714 | 1714 | |
1715 | 1715 | $org_slug = $slug; |
1716 | - $slug = apply_filters( 'wpml_translate_single_string', |
|
1716 | + $slug = apply_filters('wpml_translate_single_string', |
|
1717 | 1717 | $slug, |
1718 | 1718 | 'WordPress', |
1719 | 1719 | 'URL slug: ' . $slug, |
1720 | 1720 | $language_code); |
1721 | 1721 | |
1722 | 1722 | |
1723 | - if(!$slug){$slug = $org_slug;} |
|
1723 | + if (!$slug) {$slug = $org_slug; } |
|
1724 | 1724 | |
1725 | 1725 | $termlink = trailingslashit( |
1726 | 1726 | |
1727 | - preg_replace( "/" . preg_quote( $org_slug, "/" ) . "/", $slug ,$termlink, 1 ) |
|
1727 | + preg_replace("/" . preg_quote($org_slug, "/") . "/", $slug, $termlink, 1) |
|
1728 | 1728 | ); |
1729 | 1729 | |
1730 | 1730 | } |
@@ -1757,7 +1757,7 @@ discard block |
||
1757 | 1757 | |
1758 | 1758 | if (in_array($post_type, geodir_get_posttypes())) { |
1759 | 1759 | if (get_option('geodir_add_location_url') && $gd_session->get('gd_multi_location') == 1) { |
1760 | - if(geodir_is_page('detail') && !empty($post) && isset($post->country_slug)) { |
|
1760 | + if (geodir_is_page('detail') && !empty($post) && isset($post->country_slug)) { |
|
1761 | 1761 | $location_terms = array( |
1762 | 1762 | 'gd_country' => $post->country_slug, |
1763 | 1763 | 'gd_region' => $post->region_slug, |
@@ -1870,7 +1870,7 @@ discard block |
||
1870 | 1870 | |
1871 | 1871 | $where_fields = array($slug); |
1872 | 1872 | if (!empty($taxonomy)) { |
1873 | - $parent = (int)$parent; |
|
1873 | + $parent = (int) $parent; |
|
1874 | 1874 | if ($parent > 0) { |
1875 | 1875 | $where_fields[] = $parent; |
1876 | 1876 | $else_where_fields[] = $parent; |
@@ -1939,7 +1939,7 @@ discard block |
||
1939 | 1939 | $terms = $wpdb->get_results("SELECT * FROM $wpdb->term_taxonomy WHERE taxonomy IN ($tax_c)"); |
1940 | 1940 | //$terms = get_terms( $taxonomy ); |
1941 | 1941 | |
1942 | - if($terms) { |
|
1942 | + if ($terms) { |
|
1943 | 1943 | foreach ($terms as $term) { |
1944 | 1944 | $post_type = str_replace("category", "", $term->taxonomy); |
1945 | 1945 | $a_terms[$post_type][] = $term; |
@@ -1947,7 +1947,7 @@ discard block |
||
1947 | 1947 | } |
1948 | 1948 | } |
1949 | 1949 | |
1950 | - if($a_terms) { |
|
1950 | + if ($a_terms) { |
|
1951 | 1951 | foreach ($a_terms as $pt => $t2) { |
1952 | 1952 | |
1953 | 1953 | foreach ($t2 as $term) { |
@@ -1972,7 +1972,7 @@ discard block |
||
1972 | 1972 | } |
1973 | 1973 | |
1974 | 1974 | if (is_ssl()) { |
1975 | - $terms_icons = str_replace("http:","https:",$terms_icons ); |
|
1975 | + $terms_icons = str_replace("http:", "https:", $terms_icons); |
|
1976 | 1976 | } |
1977 | 1977 | |
1978 | 1978 | return $terms_icons; |
@@ -39,8 +39,9 @@ discard block |
||
39 | 39 | if (get_option('geodir_show_listing_nav')) { |
40 | 40 | |
41 | 41 | $menu_class = ''; |
42 | - if (geodir_is_page('listing')) |
|
43 | - $menu_class = 'current-menu-item'; |
|
42 | + if (geodir_is_page('listing')) { |
|
43 | + $menu_class = 'current-menu-item'; |
|
44 | + } |
|
44 | 45 | |
45 | 46 | |
46 | 47 | //SHOW LISTING OF POST TYPE IN MAIN NAVIGATION |
@@ -52,8 +53,9 @@ discard block |
||
52 | 53 | if (in_array($post_type, $show_post_type_main_nav)) { |
53 | 54 | if (get_post_type_archive_link($post_type)) { |
54 | 55 | $menu_class = ''; |
55 | - if (geodir_get_current_posttype() == $post_type && geodir_is_page('listing')) |
|
56 | - $menu_class = 'current-menu-item'; |
|
56 | + if (geodir_get_current_posttype() == $post_type && geodir_is_page('listing')) { |
|
57 | + $menu_class = 'current-menu-item'; |
|
58 | + } |
|
57 | 59 | /** |
58 | 60 | * Filter the menu li class. |
59 | 61 | * |
@@ -130,8 +132,9 @@ discard block |
||
130 | 132 | if (get_post_type_archive_link($post_type)) { |
131 | 133 | |
132 | 134 | $menu_class = ''; |
133 | - if (geodir_get_current_posttype() == $post_type && geodir_is_page('listing')) |
|
134 | - $menu_class = 'current-menu-item'; |
|
135 | + if (geodir_get_current_posttype() == $post_type && geodir_is_page('listing')) { |
|
136 | + $menu_class = 'current-menu-item'; |
|
137 | + } |
|
135 | 138 | |
136 | 139 | $items .= '<li class="' . $sub_li_class . '"> |
137 | 140 | <a href="' . get_post_type_archive_link($post_type) . '" class="' . $sub_a_class . '"> |
@@ -153,8 +156,9 @@ discard block |
||
153 | 156 | if (get_option('geodir_show_addlisting_nav')) { |
154 | 157 | |
155 | 158 | $menu_class = ''; |
156 | - if (geodir_is_page('add-listing')) |
|
157 | - $menu_class = 'current-menu-item'; |
|
159 | + if (geodir_is_page('add-listing')) { |
|
160 | + $menu_class = 'current-menu-item'; |
|
161 | + } |
|
158 | 162 | |
159 | 163 | //SHOW ADD LISTING POST TYPE IN MAIN NAVIGATION |
160 | 164 | $post_types = geodir_get_posttypes('object'); |
@@ -170,8 +174,9 @@ discard block |
||
170 | 174 | if (geodir_get_addlisting_link($post_type)) { |
171 | 175 | |
172 | 176 | $menu_class = ''; |
173 | - if (geodir_get_current_posttype() == $post_type && geodir_is_page('add-listing')) |
|
174 | - $menu_class = 'current-menu-item'; |
|
177 | + if (geodir_get_current_posttype() == $post_type && geodir_is_page('add-listing')) { |
|
178 | + $menu_class = 'current-menu-item'; |
|
179 | + } |
|
175 | 180 | /** |
176 | 181 | * Filter the menu li class. |
177 | 182 | * |
@@ -255,8 +260,9 @@ discard block |
||
255 | 260 | if (geodir_get_addlisting_link($post_type)) { |
256 | 261 | |
257 | 262 | $menu_class = ''; |
258 | - if (geodir_get_current_posttype() == $post_type && geodir_is_page('add-listing')) |
|
259 | - $menu_class = 'current-menu-item'; |
|
263 | + if (geodir_get_current_posttype() == $post_type && geodir_is_page('add-listing')) { |
|
264 | + $menu_class = 'current-menu-item'; |
|
265 | + } |
|
260 | 266 | /** |
261 | 267 | * Filter the menu li class. |
262 | 268 | * |
@@ -311,8 +317,9 @@ discard block |
||
311 | 317 | } |
312 | 318 | //else if(empty($geodir_theme_location)) // It means 'Show geodirectory navigation in selected menu locations' is not set yet. |
313 | 319 | // $menu = str_replace("</ul></div>",geodir_add_nav_menu_items()."</ul></div>",$menu); |
314 | - else if (is_array($geodir_theme_location) && isset($args['theme_location']) && in_array($args['theme_location'], $geodir_theme_location)) |
|
315 | - $menu = str_replace("</ul></div>", geodir_add_nav_menu_items() . "</ul></div>", $menu); |
|
320 | + else if (is_array($geodir_theme_location) && isset($args['theme_location']) && in_array($args['theme_location'], $geodir_theme_location)) { |
|
321 | + $menu = str_replace("</ul></div>", geodir_add_nav_menu_items() . "</ul></div>", $menu); |
|
322 | + } |
|
316 | 323 | |
317 | 324 | return $menu; |
318 | 325 | |
@@ -398,24 +405,28 @@ discard block |
||
398 | 405 | $geodir_post_type = get_query_var('post_type'); |
399 | 406 | |
400 | 407 | if (geodir_is_page('add-listing') || geodir_is_page('preview')) { |
401 | - if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') |
|
402 | - $geodir_post_type = get_post_type((int)$_REQUEST['pid']); |
|
403 | - elseif (isset($_REQUEST['listing_type'])) |
|
404 | - $geodir_post_type = sanitize_text_field($_REQUEST['listing_type']); |
|
408 | + if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') { |
|
409 | + $geodir_post_type = get_post_type((int)$_REQUEST['pid']); |
|
410 | + } elseif (isset($_REQUEST['listing_type'])) { |
|
411 | + $geodir_post_type = sanitize_text_field($_REQUEST['listing_type']); |
|
412 | + } |
|
405 | 413 | } |
406 | 414 | |
407 | - if ((geodir_is_page('search') || geodir_is_page('author')) && isset($_REQUEST['stype'])) |
|
408 | - $geodir_post_type = sanitize_text_field($_REQUEST['stype']); |
|
415 | + if ((geodir_is_page('search') || geodir_is_page('author')) && isset($_REQUEST['stype'])) { |
|
416 | + $geodir_post_type = sanitize_text_field($_REQUEST['stype']); |
|
417 | + } |
|
409 | 418 | |
410 | - if (is_tax()) |
|
411 | - $geodir_post_type = geodir_get_taxonomy_posttype(); |
|
419 | + if (is_tax()) { |
|
420 | + $geodir_post_type = geodir_get_taxonomy_posttype(); |
|
421 | + } |
|
412 | 422 | |
413 | 423 | |
414 | 424 | $all_postypes = geodir_get_posttypes(); |
415 | 425 | $all_postypes = stripslashes_deep($all_postypes); |
416 | 426 | |
417 | - if (is_array($all_postypes) && !in_array($geodir_post_type, $all_postypes)) |
|
418 | - $geodir_post_type = ''; |
|
427 | + if (is_array($all_postypes) && !in_array($geodir_post_type, $all_postypes)) { |
|
428 | + $geodir_post_type = ''; |
|
429 | + } |
|
419 | 430 | |
420 | 431 | |
421 | 432 | return $geodir_post_type; |
@@ -462,11 +473,12 @@ discard block |
||
462 | 473 | endswitch; |
463 | 474 | } |
464 | 475 | |
465 | - if (!empty($post_types)) |
|
466 | - return $post_types; |
|
467 | - else |
|
468 | - return array(); |
|
469 | -} |
|
476 | + if (!empty($post_types)) { |
|
477 | + return $post_types; |
|
478 | + } else { |
|
479 | + return array(); |
|
480 | + } |
|
481 | + } |
|
470 | 482 | |
471 | 483 | /** |
472 | 484 | * Get Custom Post Type info. |
@@ -483,9 +495,10 @@ discard block |
||
483 | 495 | $post_types = stripslashes_deep($post_types); |
484 | 496 | if (!empty($post_types) && $post_type != '') { |
485 | 497 | return $post_types[$post_type]; |
486 | - } else |
|
487 | - return false; |
|
488 | -} |
|
498 | + } else { |
|
499 | + return false; |
|
500 | + } |
|
501 | + } |
|
489 | 502 | |
490 | 503 | if (!function_exists('geodir_get_taxonomies')) { |
491 | 504 | /** |
@@ -509,18 +522,21 @@ discard block |
||
509 | 522 | $gd_taxonomies = array_keys($taxonomies); |
510 | 523 | |
511 | 524 | |
512 | - if ($post_type != '') |
|
513 | - $gd_taxonomies = array(); |
|
525 | + if ($post_type != '') { |
|
526 | + $gd_taxonomies = array(); |
|
527 | + } |
|
514 | 528 | |
515 | 529 | $i = 0; |
516 | 530 | foreach ($taxonomies as $taxonomy => $args) { |
517 | 531 | |
518 | - if ($post_type != '' && $args['object_type'] == $post_type) |
|
519 | - $gd_taxonomies[] = $taxonomy; |
|
532 | + if ($post_type != '' && $args['object_type'] == $post_type) { |
|
533 | + $gd_taxonomies[] = $taxonomy; |
|
534 | + } |
|
520 | 535 | |
521 | 536 | if ($tages_taxonomies === false && strpos($taxonomy, '_tag') !== false) { |
522 | - if (array_search($taxonomy, $gd_taxonomies) !== false) |
|
523 | - unset($gd_taxonomies[array_search($taxonomy, $gd_taxonomies)]); |
|
537 | + if (array_search($taxonomy, $gd_taxonomies) !== false) { |
|
538 | + unset($gd_taxonomies[array_search($taxonomy, $gd_taxonomies)]); |
|
539 | + } |
|
524 | 540 | } |
525 | 541 | |
526 | 542 | } |
@@ -575,10 +591,11 @@ discard block |
||
575 | 591 | . ucfirst($category_obj->name) . '</option>'; |
576 | 592 | } |
577 | 593 | |
578 | - if ($echo) |
|
579 | - echo $html; |
|
580 | - else |
|
581 | - return $html; |
|
594 | + if ($echo) { |
|
595 | + echo $html; |
|
596 | + } else { |
|
597 | + return $html; |
|
598 | + } |
|
582 | 599 | } |
583 | 600 | } |
584 | 601 | |
@@ -612,11 +629,12 @@ discard block |
||
612 | 629 | |
613 | 630 | } |
614 | 631 | |
615 | - if (!empty($listing_slug)) |
|
616 | - return $listing_slug; |
|
617 | - else |
|
618 | - return false; |
|
619 | -} |
|
632 | + if (!empty($listing_slug)) { |
|
633 | + return $listing_slug; |
|
634 | + } else { |
|
635 | + return false; |
|
636 | + } |
|
637 | + } |
|
620 | 638 | |
621 | 639 | |
622 | 640 | /** |
@@ -647,16 +665,18 @@ discard block |
||
647 | 665 | if (!empty($taxonomies)) { |
648 | 666 | foreach (geodir_get_posttypes() as $pt) { |
649 | 667 | $object_taxonomies = $pt === 'attachment' ? get_taxonomies_for_attachments() : get_object_taxonomies($pt); |
650 | - if (array_intersect($taxonomies, $object_taxonomies)) |
|
651 | - $post_type[] = $pt; |
|
668 | + if (array_intersect($taxonomies, $object_taxonomies)) { |
|
669 | + $post_type[] = $pt; |
|
670 | + } |
|
652 | 671 | } |
653 | 672 | } |
654 | 673 | |
655 | - if (!empty($post_type)) |
|
656 | - return $post_type[0]; |
|
657 | - else |
|
658 | - return false; |
|
659 | -} |
|
674 | + if (!empty($post_type)) { |
|
675 | + return $post_type[0]; |
|
676 | + } else { |
|
677 | + return false; |
|
678 | + } |
|
679 | + } |
|
660 | 680 | |
661 | 681 | if (!function_exists('geodir_custom_taxonomy_walker')) { |
662 | 682 | /** |
@@ -712,18 +732,18 @@ discard block |
||
712 | 732 | $checked = ''; |
713 | 733 | |
714 | 734 | if (in_array($cat_term->term_id, $search_terms)) { |
715 | - if ($cat_display == 'select' || $cat_display == 'multiselect') |
|
716 | - $checked = 'selected="selected"'; |
|
717 | - else |
|
718 | - $checked = 'checked="checked"'; |
|
735 | + if ($cat_display == 'select' || $cat_display == 'multiselect') { |
|
736 | + $checked = 'selected="selected"'; |
|
737 | + } else { |
|
738 | + $checked = 'checked="checked"'; |
|
739 | + } |
|
719 | 740 | } |
720 | 741 | |
721 | - if ($cat_display == 'radio') |
|
722 | - $out .= '<span style="display:block" ><input type="radio" field_type="radio" name="post_category[' . $cat_term->taxonomy . '][]" ' . $main_list_class . ' alt="' . $cat_term->taxonomy . '" title="' . ucfirst($cat_term->name) . '" value="' . $cat_term->term_id . '" ' . $checked . $onchange . ' id="gd-cat-' . $cat_term->term_id . '" >' . $term_check . ucfirst($cat_term->name) . '</span>'; |
|
723 | - elseif ($cat_display == 'select' || $cat_display == 'multiselect') |
|
724 | - $out .= '<option ' . $main_list_class . ' style="margin-left:' . $p . 'px;" alt="' . $cat_term->taxonomy . '" title="' . ucfirst($cat_term->name) . '" value="' . $cat_term->term_id . '" ' . $checked . $onchange . ' >' . $term_check . ucfirst($cat_term->name) . '</option>'; |
|
725 | - |
|
726 | - else { |
|
742 | + if ($cat_display == 'radio') { |
|
743 | + $out .= '<span style="display:block" ><input type="radio" field_type="radio" name="post_category[' . $cat_term->taxonomy . '][]" ' . $main_list_class . ' alt="' . $cat_term->taxonomy . '" title="' . ucfirst($cat_term->name) . '" value="' . $cat_term->term_id . '" ' . $checked . $onchange . ' id="gd-cat-' . $cat_term->term_id . '" >' . $term_check . ucfirst($cat_term->name) . '</span>'; |
|
744 | + } elseif ($cat_display == 'select' || $cat_display == 'multiselect') { |
|
745 | + $out .= '<option ' . $main_list_class . ' style="margin-left:' . $p . 'px;" alt="' . $cat_term->taxonomy . '" title="' . ucfirst($cat_term->name) . '" value="' . $cat_term->term_id . '" ' . $checked . $onchange . ' >' . $term_check . ucfirst($cat_term->name) . '</option>'; |
|
746 | + } else { |
|
727 | 747 | $out .= '<span style="display:block"><input style="display:inline-block" type="checkbox" field_type="checkbox" name="post_category[' . $cat_term->taxonomy . '][]" ' . $main_list_class . ' alt="' . $cat_term->taxonomy . '" title="' . ucfirst($cat_term->name) . '" value="' . $cat_term->term_id . '" ' . $checked . $onchange . ' id="gd-cat-' . $cat_term->term_id . '" >' . $term_check . ucfirst($cat_term->name) . '</span>'; |
728 | 748 | } |
729 | 749 | |
@@ -732,8 +752,9 @@ discard block |
||
732 | 752 | |
733 | 753 | } |
734 | 754 | |
735 | - if ($cat_display == 'checkbox' || $cat_display == 'radio') |
|
736 | - $out .= '</div>'; |
|
755 | + if ($cat_display == 'checkbox' || $cat_display == 'radio') { |
|
756 | + $out .= '</div>'; |
|
757 | + } |
|
737 | 758 | |
738 | 759 | return $out; |
739 | 760 | } |
@@ -759,18 +780,21 @@ discard block |
||
759 | 780 | global $exclude_cats, $gd_session; |
760 | 781 | |
761 | 782 | $cat_exclude = ''; |
762 | - if (is_array($exclude_cats) && !empty($exclude_cats)) |
|
763 | - $cat_exclude = serialize($exclude_cats); |
|
783 | + if (is_array($exclude_cats) && !empty($exclude_cats)) { |
|
784 | + $cat_exclude = serialize($exclude_cats); |
|
785 | + } |
|
764 | 786 | |
765 | 787 | if (isset($_REQUEST['backandedit'])) { |
766 | 788 | $post = (object)$gd_session->get('listing'); |
767 | 789 | |
768 | - if (!is_array($post->post_category[$cat_taxonomy])) |
|
769 | - $post_category = $post->post_category[$cat_taxonomy]; |
|
790 | + if (!is_array($post->post_category[$cat_taxonomy])) { |
|
791 | + $post_category = $post->post_category[$cat_taxonomy]; |
|
792 | + } |
|
770 | 793 | |
771 | 794 | $post_categories = $post->post_category_str; |
772 | - if (!empty($post_categories) && array_key_exists($cat_taxonomy, $post_categories)) |
|
773 | - $post_category_str = $post_categories[$cat_taxonomy]; |
|
795 | + if (!empty($post_categories) && array_key_exists($cat_taxonomy, $post_categories)) { |
|
796 | + $post_category_str = $post_categories[$cat_taxonomy]; |
|
797 | + } |
|
774 | 798 | |
775 | 799 | } elseif ((geodir_is_page('add-listing') && isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') || (is_admin())) { |
776 | 800 | global $post; |
@@ -961,8 +985,9 @@ discard block |
||
961 | 985 | if (!empty($post_categories) && array_key_exists($cat_taxonomy, $post_categories)) { |
962 | 986 | $post_cat_str = $post_categories[$cat_taxonomy]; |
963 | 987 | $post_cat_array = explode("#", $post_cat_str); |
964 | - if (count($post_cat_array) >= $cat_limit && $cat_limit != 0) |
|
965 | - $style = "display:none;"; |
|
988 | + if (count($post_cat_array) >= $cat_limit && $cat_limit != 0) { |
|
989 | + $style = "display:none;"; |
|
990 | + } |
|
966 | 991 | } |
967 | 992 | ?> |
968 | 993 | <div class="main_cat_list" style=" <?php if (isset($style)) { |
@@ -997,7 +1022,7 @@ discard block |
||
997 | 1022 | print_r($exclude_cats); |
998 | 1023 | if(is_array( $exclude_cats)){ |
999 | 1024 | $exclude_cats = array_map( 'intval', $exclude_cats ); |
1000 | - }else{ |
|
1025 | + } else{ |
|
1001 | 1026 | $exclude_cats = intval($exclude_cats); |
1002 | 1027 | } |
1003 | 1028 | |
@@ -1027,7 +1052,10 @@ discard block |
||
1027 | 1052 | |
1028 | 1053 | <div class="post_default_category"> |
1029 | 1054 | <input type="radio" name="post_default_category" value="<?php echo $main_cat->term_id;?>" |
1030 | - onchange="update_listing_cat()" <?php if ($default) echo ' checked="checked" ';?> /> |
|
1055 | + onchange="update_listing_cat()" <?php if ($default) { |
|
1056 | + echo ' checked="checked" '; |
|
1057 | +} |
|
1058 | +?> /> |
|
1031 | 1059 | <span> |
1032 | 1060 | <?php printf(__('Set %s as default category', 'geodirectory'), geodir_ucwords($main_cat->name));?> |
1033 | 1061 | </span> |
@@ -1127,8 +1155,9 @@ discard block |
||
1127 | 1155 | $onchange = ' onchange="show_subcatlist(this.value, this)" '; |
1128 | 1156 | |
1129 | 1157 | $option_selected = ''; |
1130 | - if (!$selected) |
|
1131 | - $option_slected = ' selected="selected" '; |
|
1158 | + if (!$selected) { |
|
1159 | + $option_slected = ' selected="selected" '; |
|
1160 | + } |
|
1132 | 1161 | |
1133 | 1162 | echo '<select field_type="select" id="' . sanitize_text_field($cat_taxonomy) . '" class="chosen_select" ' . $onchange . ' option-ajaxChosen="false" >'; |
1134 | 1163 | |
@@ -1136,8 +1165,9 @@ discard block |
||
1136 | 1165 | |
1137 | 1166 | foreach ($cat_terms as $cat_term) { |
1138 | 1167 | $option_selected = ''; |
1139 | - if ($selected == $cat_term->term_id) |
|
1140 | - $option_selected = ' selected="selected" '; |
|
1168 | + if ($selected == $cat_term->term_id) { |
|
1169 | + $option_selected = ' selected="selected" '; |
|
1170 | + } |
|
1141 | 1171 | |
1142 | 1172 | // Count child terms |
1143 | 1173 | $child_terms = get_terms( $cat_taxonomy, array( 'parent' => $cat_term->term_id, 'hide_empty' => false, 'exclude' => $exclude_cats, 'number' => 1 ) ); |
@@ -1202,8 +1232,9 @@ discard block |
||
1202 | 1232 | |
1203 | 1233 | $menu_icon = geodir_plugin_url() . '/geodirectory-assets/images/favicon.ico'; |
1204 | 1234 | |
1205 | - if (!$listing_slug = get_option('geodir_listing_prefix')) |
|
1206 | - $listing_slug = 'places'; |
|
1235 | + if (!$listing_slug = get_option('geodir_listing_prefix')) { |
|
1236 | + $listing_slug = 'places'; |
|
1237 | + } |
|
1207 | 1238 | |
1208 | 1239 | /** |
1209 | 1240 | * Taxonomies |
@@ -1351,7 +1382,7 @@ discard block |
||
1351 | 1382 | //print_r( $segments); |
1352 | 1383 | if($gd_wpml_get_languages){ |
1353 | 1384 | $langs = $gd_wpml_get_languages; |
1354 | - }else{ |
|
1385 | + } else{ |
|
1355 | 1386 | global $sitepress; |
1356 | 1387 | $gd_wpml_get_languages = $sitepress->get_active_languages(); |
1357 | 1388 | } |
@@ -1494,8 +1525,9 @@ discard block |
||
1494 | 1525 | 'city_slug' => $post->city_slug |
1495 | 1526 | ); |
1496 | 1527 | |
1497 | - } else |
|
1498 | - $post_location = geodir_get_location(); |
|
1528 | + } else { |
|
1529 | + $post_location = geodir_get_location(); |
|
1530 | + } |
|
1499 | 1531 | |
1500 | 1532 | |
1501 | 1533 | } else { |
@@ -1524,8 +1556,9 @@ discard block |
||
1524 | 1556 | ); |
1525 | 1557 | |
1526 | 1558 | } |
1527 | - } else |
|
1528 | - $post_location = geodir_get_location(); |
|
1559 | + } else { |
|
1560 | + $post_location = geodir_get_location(); |
|
1561 | + } |
|
1529 | 1562 | } |
1530 | 1563 | |
1531 | 1564 | |
@@ -1568,8 +1601,9 @@ discard block |
||
1568 | 1601 | $post_terms = $post_terms[0]; |
1569 | 1602 | } |
1570 | 1603 | |
1571 | - if (!$post_terms) |
|
1572 | - $post_terms = geodir_get_post_meta($post->ID, 'default_category', true); |
|
1604 | + if (!$post_terms) { |
|
1605 | + $post_terms = geodir_get_post_meta($post->ID, 'default_category', true); |
|
1606 | + } |
|
1573 | 1607 | |
1574 | 1608 | if (!$post_terms) { |
1575 | 1609 | $post_terms = geodir_get_post_meta($post->ID, $taxonomies, true); |
@@ -1583,8 +1617,9 @@ discard block |
||
1583 | 1617 | |
1584 | 1618 | $term = get_term_by('id', $post_terms, $taxonomies); |
1585 | 1619 | |
1586 | - if (!empty($term)) |
|
1587 | - $term_request = $term->slug; |
|
1620 | + if (!empty($term)) { |
|
1621 | + $term_request = $term->slug; |
|
1622 | + } |
|
1588 | 1623 | //$term_request = $term->slug.'/'; |
1589 | 1624 | } |
1590 | 1625 | |
@@ -1599,15 +1634,20 @@ discard block |
||
1599 | 1634 | $request_term .= $term_request; |
1600 | 1635 | |
1601 | 1636 | } else { |
1602 | - if (isset($location_request) && $location_request != '') $request_term = $location_request; |
|
1637 | + if (isset($location_request) && $location_request != '') { |
|
1638 | + $request_term = $location_request; |
|
1639 | + } |
|
1603 | 1640 | |
1604 | - if (isset($term_request) && $term_request != '') $request_term .= $term_request; |
|
1641 | + if (isset($term_request) && $term_request != '') { |
|
1642 | + $request_term .= $term_request; |
|
1643 | + } |
|
1605 | 1644 | } |
1606 | 1645 | $request_term = trim($request_term, '/'); |
1607 | - if (!empty($request_term)) |
|
1608 | - $post_link = str_replace('%gd_taxonomy%', $request_term . $detailurl_separator, $post_link); |
|
1609 | - else |
|
1610 | - $post_link = str_replace('/%gd_taxonomy%', $request_term . $detailurl_separator, $post_link); |
|
1646 | + if (!empty($request_term)) { |
|
1647 | + $post_link = str_replace('%gd_taxonomy%', $request_term . $detailurl_separator, $post_link); |
|
1648 | + } else { |
|
1649 | + $post_link = str_replace('/%gd_taxonomy%', $request_term . $detailurl_separator, $post_link); |
|
1650 | + } |
|
1611 | 1651 | //echo $post_link ; |
1612 | 1652 | } |
1613 | 1653 | // temp cache the permalink |
@@ -1649,8 +1689,9 @@ discard block |
||
1649 | 1689 | if ($geodir_add_location_url && get_option('geodir_add_location_url')) { |
1650 | 1690 | $include_location = true; |
1651 | 1691 | } |
1652 | - } elseif (get_option('geodir_add_location_url') && $gd_session->get('gd_multi_location') == 1) |
|
1653 | - $include_location = true; |
|
1692 | + } elseif (get_option('geodir_add_location_url') && $gd_session->get('gd_multi_location') == 1) { |
|
1693 | + $include_location = true; |
|
1694 | + } |
|
1654 | 1695 | |
1655 | 1696 | if ($include_location) { |
1656 | 1697 | global $post; |
@@ -1800,10 +1841,11 @@ discard block |
||
1800 | 1841 | if (!is_object($obj_post_type)) { |
1801 | 1842 | return; |
1802 | 1843 | } |
1803 | - if ($echo) |
|
1804 | - echo $obj_post_type->labels->singular_name; |
|
1805 | - else |
|
1806 | - return $obj_post_type->labels->singular_name; |
|
1844 | + if ($echo) { |
|
1845 | + echo $obj_post_type->labels->singular_name; |
|
1846 | + } else { |
|
1847 | + return $obj_post_type->labels->singular_name; |
|
1848 | + } |
|
1807 | 1849 | |
1808 | 1850 | } |
1809 | 1851 | |
@@ -1820,14 +1862,16 @@ discard block |
||
1820 | 1862 | { |
1821 | 1863 | $all_postypes = geodir_get_posttypes(); |
1822 | 1864 | |
1823 | - if (!in_array($post_type, $all_postypes)) |
|
1824 | - return false; |
|
1865 | + if (!in_array($post_type, $all_postypes)) { |
|
1866 | + return false; |
|
1867 | + } |
|
1825 | 1868 | |
1826 | 1869 | $obj_post_type = get_post_type_object($post_type); |
1827 | - if ($echo) |
|
1828 | - echo $obj_post_type->labels->name; |
|
1829 | - else |
|
1830 | - return $obj_post_type->labels->name; |
|
1870 | + if ($echo) { |
|
1871 | + echo $obj_post_type->labels->name; |
|
1872 | + } else { |
|
1873 | + return $obj_post_type->labels->name; |
|
1874 | + } |
|
1831 | 1875 | |
1832 | 1876 | } |
1833 | 1877 | |
@@ -1852,19 +1896,22 @@ discard block |
||
1852 | 1896 | $tax_select = "SELECT tt.term_id, tt.term_taxonomy_id FROM $wpdb->terms AS t INNER JOIN $wpdb->term_taxonomy as tt ON tt.term_id = t.term_id WHERE "; |
1853 | 1897 | |
1854 | 1898 | if (is_int($term)) { |
1855 | - if (0 == $term) |
|
1856 | - return 0; |
|
1899 | + if (0 == $term) { |
|
1900 | + return 0; |
|
1901 | + } |
|
1857 | 1902 | $where = 't.term_id = %d'; |
1858 | - if (!empty($taxonomy)) |
|
1859 | - return $wpdb->get_row($wpdb->prepare($tax_select . $where . " AND tt.taxonomy = %s", $term, $taxonomy), ARRAY_A); |
|
1860 | - else |
|
1861 | - return $wpdb->get_var($wpdb->prepare($select . $where, $term)); |
|
1903 | + if (!empty($taxonomy)) { |
|
1904 | + return $wpdb->get_row($wpdb->prepare($tax_select . $where . " AND tt.taxonomy = %s", $term, $taxonomy), ARRAY_A); |
|
1905 | + } else { |
|
1906 | + return $wpdb->get_var($wpdb->prepare($select . $where, $term)); |
|
1907 | + } |
|
1862 | 1908 | } |
1863 | 1909 | |
1864 | 1910 | $term = trim(wp_unslash($term)); |
1865 | 1911 | |
1866 | - if ('' === $slug = sanitize_title($term)) |
|
1867 | - return 0; |
|
1912 | + if ('' === $slug = sanitize_title($term)) { |
|
1913 | + return 0; |
|
1914 | + } |
|
1868 | 1915 | |
1869 | 1916 | $where = 't.slug = %s'; |
1870 | 1917 | |
@@ -1881,14 +1928,16 @@ discard block |
||
1881 | 1928 | $where_fields[] = $taxonomy; |
1882 | 1929 | |
1883 | 1930 | |
1884 | - if ($result = $wpdb->get_row($wpdb->prepare("SELECT tt.term_id, tt.term_taxonomy_id FROM $wpdb->terms AS t INNER JOIN $wpdb->term_taxonomy as tt ON tt.term_id = t.term_id WHERE $where AND tt.taxonomy = %s", $where_fields), ARRAY_A)) |
|
1885 | - return $result; |
|
1931 | + if ($result = $wpdb->get_row($wpdb->prepare("SELECT tt.term_id, tt.term_taxonomy_id FROM $wpdb->terms AS t INNER JOIN $wpdb->term_taxonomy as tt ON tt.term_id = t.term_id WHERE $where AND tt.taxonomy = %s", $where_fields), ARRAY_A)) { |
|
1932 | + return $result; |
|
1933 | + } |
|
1886 | 1934 | |
1887 | 1935 | return false; |
1888 | 1936 | } |
1889 | 1937 | |
1890 | - if ($result = $wpdb->get_var($wpdb->prepare("SELECT term_id FROM $wpdb->terms as t WHERE $where", $where_fields))) |
|
1891 | - return $result; |
|
1938 | + if ($result = $wpdb->get_var($wpdb->prepare("SELECT term_id FROM $wpdb->terms as t WHERE $where", $where_fields))) { |
|
1939 | + return $result; |
|
1940 | + } |
|
1892 | 1941 | |
1893 | 1942 | return false; |
1894 | 1943 | } |
@@ -1,14 +1,14 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | /** |
3 | - * WordPress session managment. |
|
4 | - * |
|
5 | - * Standardizes WordPress session data using database-backed options for storage. |
|
6 | - * for storing user session information. |
|
7 | - * |
|
8 | - * @package WordPress |
|
9 | - * @subpackage Session |
|
10 | - * @since 3.7.0 |
|
11 | - */ |
|
3 | + * WordPress session managment. |
|
4 | + * |
|
5 | + * Standardizes WordPress session data using database-backed options for storage. |
|
6 | + * for storing user session information. |
|
7 | + * |
|
8 | + * @package WordPress |
|
9 | + * @subpackage Session |
|
10 | + * @since 3.7.0 |
|
11 | + */ |
|
12 | 12 | |
13 | 13 | // Exit if accessed directly |
14 | 14 | if ( ! defined( 'ABSPATH' ) ) exit; |
@@ -20,317 +20,317 @@ discard block |
||
20 | 20 | * @since 3.7.0 |
21 | 21 | */ |
22 | 22 | final class WP_Session extends Recursive_ArrayAccess implements Iterator, Countable { |
23 | - /** |
|
24 | - * ID of the current session. |
|
25 | - * |
|
26 | - * @var string |
|
27 | - */ |
|
28 | - public $session_id; |
|
29 | - |
|
30 | - /** |
|
31 | - * Unix timestamp when session expires. |
|
32 | - * |
|
33 | - * @var int |
|
34 | - */ |
|
35 | - protected $expires; |
|
36 | - |
|
37 | - /** |
|
38 | - * Unix timestamp indicating when the expiration time needs to be reset. |
|
39 | - * |
|
40 | - * @var int |
|
41 | - */ |
|
42 | - protected $exp_variant; |
|
43 | - |
|
44 | - /** |
|
45 | - * Singleton instance. |
|
46 | - * |
|
47 | - * @var bool|WP_Session |
|
48 | - */ |
|
49 | - private static $instance = false; |
|
50 | - |
|
51 | - /** |
|
52 | - * Retrieve the current session instance. |
|
53 | - * |
|
54 | - * @param bool $session_id Session ID from which to populate data. |
|
55 | - * |
|
56 | - * @return bool|WP_Session |
|
57 | - */ |
|
58 | - public static function get_instance() { |
|
59 | - if ( ! self::$instance ) { |
|
60 | - self::$instance = new self(); |
|
61 | - } |
|
62 | - |
|
63 | - return self::$instance; |
|
64 | - } |
|
65 | - |
|
66 | - /** |
|
67 | - * Default constructor. |
|
68 | - * Will rebuild the session collection from the given session ID if it exists. Otherwise, will |
|
69 | - * create a new session with that ID. |
|
70 | - * |
|
71 | - * @param $session_id |
|
72 | - * @uses apply_filters Calls `wp_session_expiration` to determine how long until sessions expire. |
|
73 | - */ |
|
74 | - protected function __construct() { |
|
75 | - if ( isset( $_COOKIE[WP_SESSION_COOKIE] ) ) { |
|
76 | - $cookie = stripslashes( $_COOKIE[WP_SESSION_COOKIE] ); |
|
77 | - $cookie_crumbs = explode( '||', $cookie ); |
|
78 | - |
|
79 | - if( $this->is_valid_md5( $cookie_crumbs[0] ) ) { |
|
80 | - |
|
81 | - $this->session_id = $cookie_crumbs[0]; |
|
82 | - |
|
83 | - } else { |
|
84 | - |
|
85 | - $this->regenerate_id( true ); |
|
86 | - |
|
87 | - } |
|
88 | - |
|
89 | - $this->expires = $cookie_crumbs[1]; |
|
90 | - $this->exp_variant = $cookie_crumbs[2]; |
|
91 | - |
|
92 | - // Update the session expiration if we're past the variant time |
|
93 | - if ( time() > $this->exp_variant ) { |
|
94 | - $this->set_expiration(); |
|
95 | - delete_option( "_wp_session_expires_{$this->session_id}" ); |
|
96 | - add_option( "_wp_session_expires_{$this->session_id}", $this->expires, '', 'no' ); |
|
97 | - } |
|
98 | - } else { |
|
99 | - $this->session_id = $this->generate_id(); |
|
100 | - $this->set_expiration(); |
|
101 | - } |
|
102 | - |
|
103 | - $this->read_data(); |
|
104 | - |
|
105 | - $this->set_cookie(); |
|
106 | - |
|
107 | - } |
|
108 | - |
|
109 | - /** |
|
110 | - * Set both the expiration time and the expiration variant. |
|
111 | - * |
|
112 | - * If the current time is below the variant, we don't update the session's expiration time. If it's |
|
113 | - * greater than the variant, then we update the expiration time in the database. This prevents |
|
114 | - * writing to the database on every page load for active sessions and only updates the expiration |
|
115 | - * time if we're nearing when the session actually expires. |
|
116 | - * |
|
117 | - * By default, the expiration time is set to 30 minutes. |
|
118 | - * By default, the expiration variant is set to 24 minutes. |
|
119 | - * |
|
120 | - * As a result, the session expiration time - at a maximum - will only be written to the database once |
|
121 | - * every 24 minutes. After 30 minutes, the session will have been expired. No cookie will be sent by |
|
122 | - * the browser, and the old session will be queued for deletion by the garbage collector. |
|
123 | - * |
|
124 | - * @uses apply_filters Calls `wp_session_expiration_variant` to get the max update window for session data. |
|
125 | - * @uses apply_filters Calls `wp_session_expiration` to get the standard expiration time for sessions. |
|
126 | - */ |
|
127 | - protected function set_expiration() { |
|
128 | - $this->exp_variant = time() + (int) apply_filters( 'wp_session_expiration_variant', 24 * 60 ); |
|
129 | - $this->expires = time() + (int) apply_filters( 'wp_session_expiration', 30 * 60 ); |
|
130 | - } |
|
131 | - |
|
132 | - /** |
|
133 | - * Set the session cookie |
|
134 | - */ |
|
135 | - protected function set_cookie() { |
|
136 | - try { |
|
23 | + /** |
|
24 | + * ID of the current session. |
|
25 | + * |
|
26 | + * @var string |
|
27 | + */ |
|
28 | + public $session_id; |
|
29 | + |
|
30 | + /** |
|
31 | + * Unix timestamp when session expires. |
|
32 | + * |
|
33 | + * @var int |
|
34 | + */ |
|
35 | + protected $expires; |
|
36 | + |
|
37 | + /** |
|
38 | + * Unix timestamp indicating when the expiration time needs to be reset. |
|
39 | + * |
|
40 | + * @var int |
|
41 | + */ |
|
42 | + protected $exp_variant; |
|
43 | + |
|
44 | + /** |
|
45 | + * Singleton instance. |
|
46 | + * |
|
47 | + * @var bool|WP_Session |
|
48 | + */ |
|
49 | + private static $instance = false; |
|
50 | + |
|
51 | + /** |
|
52 | + * Retrieve the current session instance. |
|
53 | + * |
|
54 | + * @param bool $session_id Session ID from which to populate data. |
|
55 | + * |
|
56 | + * @return bool|WP_Session |
|
57 | + */ |
|
58 | + public static function get_instance() { |
|
59 | + if ( ! self::$instance ) { |
|
60 | + self::$instance = new self(); |
|
61 | + } |
|
62 | + |
|
63 | + return self::$instance; |
|
64 | + } |
|
65 | + |
|
66 | + /** |
|
67 | + * Default constructor. |
|
68 | + * Will rebuild the session collection from the given session ID if it exists. Otherwise, will |
|
69 | + * create a new session with that ID. |
|
70 | + * |
|
71 | + * @param $session_id |
|
72 | + * @uses apply_filters Calls `wp_session_expiration` to determine how long until sessions expire. |
|
73 | + */ |
|
74 | + protected function __construct() { |
|
75 | + if ( isset( $_COOKIE[WP_SESSION_COOKIE] ) ) { |
|
76 | + $cookie = stripslashes( $_COOKIE[WP_SESSION_COOKIE] ); |
|
77 | + $cookie_crumbs = explode( '||', $cookie ); |
|
78 | + |
|
79 | + if( $this->is_valid_md5( $cookie_crumbs[0] ) ) { |
|
80 | + |
|
81 | + $this->session_id = $cookie_crumbs[0]; |
|
82 | + |
|
83 | + } else { |
|
84 | + |
|
85 | + $this->regenerate_id( true ); |
|
86 | + |
|
87 | + } |
|
88 | + |
|
89 | + $this->expires = $cookie_crumbs[1]; |
|
90 | + $this->exp_variant = $cookie_crumbs[2]; |
|
91 | + |
|
92 | + // Update the session expiration if we're past the variant time |
|
93 | + if ( time() > $this->exp_variant ) { |
|
94 | + $this->set_expiration(); |
|
95 | + delete_option( "_wp_session_expires_{$this->session_id}" ); |
|
96 | + add_option( "_wp_session_expires_{$this->session_id}", $this->expires, '', 'no' ); |
|
97 | + } |
|
98 | + } else { |
|
99 | + $this->session_id = $this->generate_id(); |
|
100 | + $this->set_expiration(); |
|
101 | + } |
|
102 | + |
|
103 | + $this->read_data(); |
|
104 | + |
|
105 | + $this->set_cookie(); |
|
106 | + |
|
107 | + } |
|
108 | + |
|
109 | + /** |
|
110 | + * Set both the expiration time and the expiration variant. |
|
111 | + * |
|
112 | + * If the current time is below the variant, we don't update the session's expiration time. If it's |
|
113 | + * greater than the variant, then we update the expiration time in the database. This prevents |
|
114 | + * writing to the database on every page load for active sessions and only updates the expiration |
|
115 | + * time if we're nearing when the session actually expires. |
|
116 | + * |
|
117 | + * By default, the expiration time is set to 30 minutes. |
|
118 | + * By default, the expiration variant is set to 24 minutes. |
|
119 | + * |
|
120 | + * As a result, the session expiration time - at a maximum - will only be written to the database once |
|
121 | + * every 24 minutes. After 30 minutes, the session will have been expired. No cookie will be sent by |
|
122 | + * the browser, and the old session will be queued for deletion by the garbage collector. |
|
123 | + * |
|
124 | + * @uses apply_filters Calls `wp_session_expiration_variant` to get the max update window for session data. |
|
125 | + * @uses apply_filters Calls `wp_session_expiration` to get the standard expiration time for sessions. |
|
126 | + */ |
|
127 | + protected function set_expiration() { |
|
128 | + $this->exp_variant = time() + (int) apply_filters( 'wp_session_expiration_variant', 24 * 60 ); |
|
129 | + $this->expires = time() + (int) apply_filters( 'wp_session_expiration', 30 * 60 ); |
|
130 | + } |
|
131 | + |
|
132 | + /** |
|
133 | + * Set the session cookie |
|
134 | + */ |
|
135 | + protected function set_cookie() { |
|
136 | + try { |
|
137 | 137 | setcookie( WP_SESSION_COOKIE, $this->session_id . '||' . $this->expires . '||' . $this->exp_variant , $this->expires, COOKIEPATH, COOKIE_DOMAIN ); |
138 | 138 | } catch(Exception $e) { |
139 | 139 | error_log( 'Set Cookie Error: ' . $e->getMessage() ); |
140 | 140 | } |
141 | - } |
|
142 | - |
|
143 | - /** |
|
144 | - * Generate a cryptographically strong unique ID for the session token. |
|
145 | - * |
|
146 | - * @return string |
|
147 | - */ |
|
148 | - protected function generate_id() { |
|
149 | - require_once( ABSPATH . 'wp-includes/class-phpass.php'); |
|
150 | - $hasher = new PasswordHash( 8, false ); |
|
151 | - |
|
152 | - return md5( $hasher->get_random_bytes( 32 ) ); |
|
153 | - } |
|
154 | - |
|
155 | - /** |
|
156 | - * Checks if is valid md5 string |
|
157 | - * |
|
158 | - * @param string $md5 |
|
159 | - * @return int |
|
160 | - */ |
|
161 | - protected function is_valid_md5( $md5 = '' ){ |
|
162 | - return preg_match( '/^[a-f0-9]{32}$/', $md5 ); |
|
163 | - } |
|
164 | - |
|
165 | - /** |
|
166 | - * Read data from a transient for the current session. |
|
167 | - * |
|
168 | - * Automatically resets the expiration time for the session transient to some time in the future. |
|
169 | - * |
|
170 | - * @return array |
|
171 | - */ |
|
172 | - protected function read_data() { |
|
173 | - $this->container = get_option( "_wp_session_{$this->session_id}", array() ); |
|
174 | - |
|
175 | - return $this->container; |
|
176 | - } |
|
177 | - |
|
178 | - /** |
|
179 | - * Write the data from the current session to the data storage system. |
|
180 | - */ |
|
181 | - public function write_data() { |
|
182 | - $option_key = "_wp_session_{$this->session_id}"; |
|
183 | - |
|
184 | - // Only write the collection to the DB if it's changed. |
|
185 | - if ( $this->dirty ) { |
|
186 | - if ( false === get_option( $option_key ) ) { |
|
187 | - add_option( "_wp_session_{$this->session_id}", $this->container, '', 'no' ); |
|
188 | - add_option( "_wp_session_expires_{$this->session_id}", $this->expires, '', 'no' ); |
|
189 | - } else { |
|
190 | - delete_option( "_wp_session_{$this->session_id}" ); |
|
191 | - add_option( "_wp_session_{$this->session_id}", $this->container, '', 'no' ); |
|
192 | - } |
|
193 | - } |
|
194 | - } |
|
195 | - |
|
196 | - /** |
|
197 | - * Output the current container contents as a JSON-encoded string. |
|
198 | - * |
|
199 | - * @return string |
|
200 | - */ |
|
201 | - public function json_out() { |
|
202 | - return json_encode( $this->container ); |
|
203 | - } |
|
204 | - |
|
205 | - /** |
|
206 | - * Decodes a JSON string and, if the object is an array, overwrites the session container with its contents. |
|
207 | - * |
|
208 | - * @param string $data |
|
209 | - * |
|
210 | - * @return bool |
|
211 | - */ |
|
212 | - public function json_in( $data ) { |
|
213 | - $array = json_decode( $data ); |
|
214 | - |
|
215 | - if ( is_array( $array ) ) { |
|
216 | - $this->container = $array; |
|
217 | - return true; |
|
218 | - } |
|
219 | - |
|
220 | - return false; |
|
221 | - } |
|
222 | - |
|
223 | - /** |
|
224 | - * Regenerate the current session's ID. |
|
225 | - * |
|
226 | - * @param bool $delete_old Flag whether or not to delete the old session data from the server. |
|
227 | - */ |
|
228 | - public function regenerate_id( $delete_old = false ) { |
|
229 | - if ( $delete_old ) { |
|
230 | - delete_option( "_wp_session_{$this->session_id}" ); |
|
231 | - } |
|
232 | - |
|
233 | - $this->session_id = $this->generate_id(); |
|
234 | - |
|
235 | - $this->set_cookie(); |
|
236 | - } |
|
237 | - |
|
238 | - /** |
|
239 | - * Check if a session has been initialized. |
|
240 | - * |
|
241 | - * @return bool |
|
242 | - */ |
|
243 | - public function session_started() { |
|
244 | - return !!self::$instance; |
|
245 | - } |
|
246 | - |
|
247 | - /** |
|
248 | - * Return the read-only cache expiration value. |
|
249 | - * |
|
250 | - * @return int |
|
251 | - */ |
|
252 | - public function cache_expiration() { |
|
253 | - return $this->expires; |
|
254 | - } |
|
255 | - |
|
256 | - /** |
|
257 | - * Flushes all session variables. |
|
258 | - */ |
|
259 | - public function reset() { |
|
260 | - $this->container = array(); |
|
261 | - } |
|
262 | - |
|
263 | - /*****************************************************************/ |
|
264 | - /* Iterator Implementation */ |
|
265 | - /*****************************************************************/ |
|
266 | - |
|
267 | - /** |
|
268 | - * Current position of the array. |
|
269 | - * |
|
270 | - * @link http://php.net/manual/en/iterator.current.php |
|
271 | - * |
|
272 | - * @return mixed |
|
273 | - */ |
|
274 | - public function current() { |
|
275 | - return current( $this->container ); |
|
276 | - } |
|
277 | - |
|
278 | - /** |
|
279 | - * Key of the current element. |
|
280 | - * |
|
281 | - * @link http://php.net/manual/en/iterator.key.php |
|
282 | - * |
|
283 | - * @return mixed |
|
284 | - */ |
|
285 | - public function key() { |
|
286 | - return key( $this->container ); |
|
287 | - } |
|
288 | - |
|
289 | - /** |
|
290 | - * Move the internal point of the container array to the next item |
|
291 | - * |
|
292 | - * @link http://php.net/manual/en/iterator.next.php |
|
293 | - * |
|
294 | - * @return void |
|
295 | - */ |
|
296 | - public function next() { |
|
297 | - next( $this->container ); |
|
298 | - } |
|
299 | - |
|
300 | - /** |
|
301 | - * Rewind the internal point of the container array. |
|
302 | - * |
|
303 | - * @link http://php.net/manual/en/iterator.rewind.php |
|
304 | - * |
|
305 | - * @return void |
|
306 | - */ |
|
307 | - public function rewind() { |
|
308 | - reset( $this->container ); |
|
309 | - } |
|
310 | - |
|
311 | - /** |
|
312 | - * Is the current key valid? |
|
313 | - * |
|
314 | - * @link http://php.net/manual/en/iterator.rewind.php |
|
315 | - * |
|
316 | - * @return bool |
|
317 | - */ |
|
318 | - public function valid() { |
|
319 | - return $this->offsetExists( $this->key() ); |
|
320 | - } |
|
321 | - |
|
322 | - /*****************************************************************/ |
|
323 | - /* Countable Implementation */ |
|
324 | - /*****************************************************************/ |
|
325 | - |
|
326 | - /** |
|
327 | - * Get the count of elements in the container array. |
|
328 | - * |
|
329 | - * @link http://php.net/manual/en/countable.count.php |
|
330 | - * |
|
331 | - * @return int |
|
332 | - */ |
|
333 | - public function count() { |
|
334 | - return count( $this->container ); |
|
335 | - } |
|
141 | + } |
|
142 | + |
|
143 | + /** |
|
144 | + * Generate a cryptographically strong unique ID for the session token. |
|
145 | + * |
|
146 | + * @return string |
|
147 | + */ |
|
148 | + protected function generate_id() { |
|
149 | + require_once( ABSPATH . 'wp-includes/class-phpass.php'); |
|
150 | + $hasher = new PasswordHash( 8, false ); |
|
151 | + |
|
152 | + return md5( $hasher->get_random_bytes( 32 ) ); |
|
153 | + } |
|
154 | + |
|
155 | + /** |
|
156 | + * Checks if is valid md5 string |
|
157 | + * |
|
158 | + * @param string $md5 |
|
159 | + * @return int |
|
160 | + */ |
|
161 | + protected function is_valid_md5( $md5 = '' ){ |
|
162 | + return preg_match( '/^[a-f0-9]{32}$/', $md5 ); |
|
163 | + } |
|
164 | + |
|
165 | + /** |
|
166 | + * Read data from a transient for the current session. |
|
167 | + * |
|
168 | + * Automatically resets the expiration time for the session transient to some time in the future. |
|
169 | + * |
|
170 | + * @return array |
|
171 | + */ |
|
172 | + protected function read_data() { |
|
173 | + $this->container = get_option( "_wp_session_{$this->session_id}", array() ); |
|
174 | + |
|
175 | + return $this->container; |
|
176 | + } |
|
177 | + |
|
178 | + /** |
|
179 | + * Write the data from the current session to the data storage system. |
|
180 | + */ |
|
181 | + public function write_data() { |
|
182 | + $option_key = "_wp_session_{$this->session_id}"; |
|
183 | + |
|
184 | + // Only write the collection to the DB if it's changed. |
|
185 | + if ( $this->dirty ) { |
|
186 | + if ( false === get_option( $option_key ) ) { |
|
187 | + add_option( "_wp_session_{$this->session_id}", $this->container, '', 'no' ); |
|
188 | + add_option( "_wp_session_expires_{$this->session_id}", $this->expires, '', 'no' ); |
|
189 | + } else { |
|
190 | + delete_option( "_wp_session_{$this->session_id}" ); |
|
191 | + add_option( "_wp_session_{$this->session_id}", $this->container, '', 'no' ); |
|
192 | + } |
|
193 | + } |
|
194 | + } |
|
195 | + |
|
196 | + /** |
|
197 | + * Output the current container contents as a JSON-encoded string. |
|
198 | + * |
|
199 | + * @return string |
|
200 | + */ |
|
201 | + public function json_out() { |
|
202 | + return json_encode( $this->container ); |
|
203 | + } |
|
204 | + |
|
205 | + /** |
|
206 | + * Decodes a JSON string and, if the object is an array, overwrites the session container with its contents. |
|
207 | + * |
|
208 | + * @param string $data |
|
209 | + * |
|
210 | + * @return bool |
|
211 | + */ |
|
212 | + public function json_in( $data ) { |
|
213 | + $array = json_decode( $data ); |
|
214 | + |
|
215 | + if ( is_array( $array ) ) { |
|
216 | + $this->container = $array; |
|
217 | + return true; |
|
218 | + } |
|
219 | + |
|
220 | + return false; |
|
221 | + } |
|
222 | + |
|
223 | + /** |
|
224 | + * Regenerate the current session's ID. |
|
225 | + * |
|
226 | + * @param bool $delete_old Flag whether or not to delete the old session data from the server. |
|
227 | + */ |
|
228 | + public function regenerate_id( $delete_old = false ) { |
|
229 | + if ( $delete_old ) { |
|
230 | + delete_option( "_wp_session_{$this->session_id}" ); |
|
231 | + } |
|
232 | + |
|
233 | + $this->session_id = $this->generate_id(); |
|
234 | + |
|
235 | + $this->set_cookie(); |
|
236 | + } |
|
237 | + |
|
238 | + /** |
|
239 | + * Check if a session has been initialized. |
|
240 | + * |
|
241 | + * @return bool |
|
242 | + */ |
|
243 | + public function session_started() { |
|
244 | + return !!self::$instance; |
|
245 | + } |
|
246 | + |
|
247 | + /** |
|
248 | + * Return the read-only cache expiration value. |
|
249 | + * |
|
250 | + * @return int |
|
251 | + */ |
|
252 | + public function cache_expiration() { |
|
253 | + return $this->expires; |
|
254 | + } |
|
255 | + |
|
256 | + /** |
|
257 | + * Flushes all session variables. |
|
258 | + */ |
|
259 | + public function reset() { |
|
260 | + $this->container = array(); |
|
261 | + } |
|
262 | + |
|
263 | + /*****************************************************************/ |
|
264 | + /* Iterator Implementation */ |
|
265 | + /*****************************************************************/ |
|
266 | + |
|
267 | + /** |
|
268 | + * Current position of the array. |
|
269 | + * |
|
270 | + * @link http://php.net/manual/en/iterator.current.php |
|
271 | + * |
|
272 | + * @return mixed |
|
273 | + */ |
|
274 | + public function current() { |
|
275 | + return current( $this->container ); |
|
276 | + } |
|
277 | + |
|
278 | + /** |
|
279 | + * Key of the current element. |
|
280 | + * |
|
281 | + * @link http://php.net/manual/en/iterator.key.php |
|
282 | + * |
|
283 | + * @return mixed |
|
284 | + */ |
|
285 | + public function key() { |
|
286 | + return key( $this->container ); |
|
287 | + } |
|
288 | + |
|
289 | + /** |
|
290 | + * Move the internal point of the container array to the next item |
|
291 | + * |
|
292 | + * @link http://php.net/manual/en/iterator.next.php |
|
293 | + * |
|
294 | + * @return void |
|
295 | + */ |
|
296 | + public function next() { |
|
297 | + next( $this->container ); |
|
298 | + } |
|
299 | + |
|
300 | + /** |
|
301 | + * Rewind the internal point of the container array. |
|
302 | + * |
|
303 | + * @link http://php.net/manual/en/iterator.rewind.php |
|
304 | + * |
|
305 | + * @return void |
|
306 | + */ |
|
307 | + public function rewind() { |
|
308 | + reset( $this->container ); |
|
309 | + } |
|
310 | + |
|
311 | + /** |
|
312 | + * Is the current key valid? |
|
313 | + * |
|
314 | + * @link http://php.net/manual/en/iterator.rewind.php |
|
315 | + * |
|
316 | + * @return bool |
|
317 | + */ |
|
318 | + public function valid() { |
|
319 | + return $this->offsetExists( $this->key() ); |
|
320 | + } |
|
321 | + |
|
322 | + /*****************************************************************/ |
|
323 | + /* Countable Implementation */ |
|
324 | + /*****************************************************************/ |
|
325 | + |
|
326 | + /** |
|
327 | + * Get the count of elements in the container array. |
|
328 | + * |
|
329 | + * @link http://php.net/manual/en/countable.count.php |
|
330 | + * |
|
331 | + * @return int |
|
332 | + */ |
|
333 | + public function count() { |
|
334 | + return count( $this->container ); |
|
335 | + } |
|
336 | 336 | } |
@@ -11,7 +11,7 @@ discard block |
||
11 | 11 | */ |
12 | 12 | |
13 | 13 | // Exit if accessed directly |
14 | -if ( ! defined( 'ABSPATH' ) ) exit; |
|
14 | +if (!defined('ABSPATH')) exit; |
|
15 | 15 | |
16 | 16 | /** |
17 | 17 | * WordPress Session class for managing user session data. |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | * @return bool|WP_Session |
57 | 57 | */ |
58 | 58 | public static function get_instance() { |
59 | - if ( ! self::$instance ) { |
|
59 | + if (!self::$instance) { |
|
60 | 60 | self::$instance = new self(); |
61 | 61 | } |
62 | 62 | |
@@ -72,17 +72,17 @@ discard block |
||
72 | 72 | * @uses apply_filters Calls `wp_session_expiration` to determine how long until sessions expire. |
73 | 73 | */ |
74 | 74 | protected function __construct() { |
75 | - if ( isset( $_COOKIE[WP_SESSION_COOKIE] ) ) { |
|
76 | - $cookie = stripslashes( $_COOKIE[WP_SESSION_COOKIE] ); |
|
77 | - $cookie_crumbs = explode( '||', $cookie ); |
|
75 | + if (isset($_COOKIE[WP_SESSION_COOKIE])) { |
|
76 | + $cookie = stripslashes($_COOKIE[WP_SESSION_COOKIE]); |
|
77 | + $cookie_crumbs = explode('||', $cookie); |
|
78 | 78 | |
79 | - if( $this->is_valid_md5( $cookie_crumbs[0] ) ) { |
|
79 | + if ($this->is_valid_md5($cookie_crumbs[0])) { |
|
80 | 80 | |
81 | 81 | $this->session_id = $cookie_crumbs[0]; |
82 | 82 | |
83 | 83 | } else { |
84 | 84 | |
85 | - $this->regenerate_id( true ); |
|
85 | + $this->regenerate_id(true); |
|
86 | 86 | |
87 | 87 | } |
88 | 88 | |
@@ -90,10 +90,10 @@ discard block |
||
90 | 90 | $this->exp_variant = $cookie_crumbs[2]; |
91 | 91 | |
92 | 92 | // Update the session expiration if we're past the variant time |
93 | - if ( time() > $this->exp_variant ) { |
|
93 | + if (time() > $this->exp_variant) { |
|
94 | 94 | $this->set_expiration(); |
95 | - delete_option( "_wp_session_expires_{$this->session_id}" ); |
|
96 | - add_option( "_wp_session_expires_{$this->session_id}", $this->expires, '', 'no' ); |
|
95 | + delete_option("_wp_session_expires_{$this->session_id}"); |
|
96 | + add_option("_wp_session_expires_{$this->session_id}", $this->expires, '', 'no'); |
|
97 | 97 | } |
98 | 98 | } else { |
99 | 99 | $this->session_id = $this->generate_id(); |
@@ -125,8 +125,8 @@ discard block |
||
125 | 125 | * @uses apply_filters Calls `wp_session_expiration` to get the standard expiration time for sessions. |
126 | 126 | */ |
127 | 127 | protected function set_expiration() { |
128 | - $this->exp_variant = time() + (int) apply_filters( 'wp_session_expiration_variant', 24 * 60 ); |
|
129 | - $this->expires = time() + (int) apply_filters( 'wp_session_expiration', 30 * 60 ); |
|
128 | + $this->exp_variant = time() + (int) apply_filters('wp_session_expiration_variant', 24 * 60); |
|
129 | + $this->expires = time() + (int) apply_filters('wp_session_expiration', 30 * 60); |
|
130 | 130 | } |
131 | 131 | |
132 | 132 | /** |
@@ -134,9 +134,9 @@ discard block |
||
134 | 134 | */ |
135 | 135 | protected function set_cookie() { |
136 | 136 | try { |
137 | - setcookie( WP_SESSION_COOKIE, $this->session_id . '||' . $this->expires . '||' . $this->exp_variant , $this->expires, COOKIEPATH, COOKIE_DOMAIN ); |
|
138 | - } catch(Exception $e) { |
|
139 | - error_log( 'Set Cookie Error: ' . $e->getMessage() ); |
|
137 | + setcookie(WP_SESSION_COOKIE, $this->session_id . '||' . $this->expires . '||' . $this->exp_variant, $this->expires, COOKIEPATH, COOKIE_DOMAIN); |
|
138 | + } catch (Exception $e) { |
|
139 | + error_log('Set Cookie Error: ' . $e->getMessage()); |
|
140 | 140 | } |
141 | 141 | } |
142 | 142 | |
@@ -146,10 +146,10 @@ discard block |
||
146 | 146 | * @return string |
147 | 147 | */ |
148 | 148 | protected function generate_id() { |
149 | - require_once( ABSPATH . 'wp-includes/class-phpass.php'); |
|
150 | - $hasher = new PasswordHash( 8, false ); |
|
149 | + require_once(ABSPATH . 'wp-includes/class-phpass.php'); |
|
150 | + $hasher = new PasswordHash(8, false); |
|
151 | 151 | |
152 | - return md5( $hasher->get_random_bytes( 32 ) ); |
|
152 | + return md5($hasher->get_random_bytes(32)); |
|
153 | 153 | } |
154 | 154 | |
155 | 155 | /** |
@@ -158,8 +158,8 @@ discard block |
||
158 | 158 | * @param string $md5 |
159 | 159 | * @return int |
160 | 160 | */ |
161 | - protected function is_valid_md5( $md5 = '' ){ |
|
162 | - return preg_match( '/^[a-f0-9]{32}$/', $md5 ); |
|
161 | + protected function is_valid_md5($md5 = '') { |
|
162 | + return preg_match('/^[a-f0-9]{32}$/', $md5); |
|
163 | 163 | } |
164 | 164 | |
165 | 165 | /** |
@@ -170,7 +170,7 @@ discard block |
||
170 | 170 | * @return array |
171 | 171 | */ |
172 | 172 | protected function read_data() { |
173 | - $this->container = get_option( "_wp_session_{$this->session_id}", array() ); |
|
173 | + $this->container = get_option("_wp_session_{$this->session_id}", array()); |
|
174 | 174 | |
175 | 175 | return $this->container; |
176 | 176 | } |
@@ -182,13 +182,13 @@ discard block |
||
182 | 182 | $option_key = "_wp_session_{$this->session_id}"; |
183 | 183 | |
184 | 184 | // Only write the collection to the DB if it's changed. |
185 | - if ( $this->dirty ) { |
|
186 | - if ( false === get_option( $option_key ) ) { |
|
187 | - add_option( "_wp_session_{$this->session_id}", $this->container, '', 'no' ); |
|
188 | - add_option( "_wp_session_expires_{$this->session_id}", $this->expires, '', 'no' ); |
|
185 | + if ($this->dirty) { |
|
186 | + if (false === get_option($option_key)) { |
|
187 | + add_option("_wp_session_{$this->session_id}", $this->container, '', 'no'); |
|
188 | + add_option("_wp_session_expires_{$this->session_id}", $this->expires, '', 'no'); |
|
189 | 189 | } else { |
190 | - delete_option( "_wp_session_{$this->session_id}" ); |
|
191 | - add_option( "_wp_session_{$this->session_id}", $this->container, '', 'no' ); |
|
190 | + delete_option("_wp_session_{$this->session_id}"); |
|
191 | + add_option("_wp_session_{$this->session_id}", $this->container, '', 'no'); |
|
192 | 192 | } |
193 | 193 | } |
194 | 194 | } |
@@ -199,7 +199,7 @@ discard block |
||
199 | 199 | * @return string |
200 | 200 | */ |
201 | 201 | public function json_out() { |
202 | - return json_encode( $this->container ); |
|
202 | + return json_encode($this->container); |
|
203 | 203 | } |
204 | 204 | |
205 | 205 | /** |
@@ -209,10 +209,10 @@ discard block |
||
209 | 209 | * |
210 | 210 | * @return bool |
211 | 211 | */ |
212 | - public function json_in( $data ) { |
|
213 | - $array = json_decode( $data ); |
|
212 | + public function json_in($data) { |
|
213 | + $array = json_decode($data); |
|
214 | 214 | |
215 | - if ( is_array( $array ) ) { |
|
215 | + if (is_array($array)) { |
|
216 | 216 | $this->container = $array; |
217 | 217 | return true; |
218 | 218 | } |
@@ -225,9 +225,9 @@ discard block |
||
225 | 225 | * |
226 | 226 | * @param bool $delete_old Flag whether or not to delete the old session data from the server. |
227 | 227 | */ |
228 | - public function regenerate_id( $delete_old = false ) { |
|
229 | - if ( $delete_old ) { |
|
230 | - delete_option( "_wp_session_{$this->session_id}" ); |
|
228 | + public function regenerate_id($delete_old = false) { |
|
229 | + if ($delete_old) { |
|
230 | + delete_option("_wp_session_{$this->session_id}"); |
|
231 | 231 | } |
232 | 232 | |
233 | 233 | $this->session_id = $this->generate_id(); |
@@ -272,7 +272,7 @@ discard block |
||
272 | 272 | * @return mixed |
273 | 273 | */ |
274 | 274 | public function current() { |
275 | - return current( $this->container ); |
|
275 | + return current($this->container); |
|
276 | 276 | } |
277 | 277 | |
278 | 278 | /** |
@@ -283,7 +283,7 @@ discard block |
||
283 | 283 | * @return mixed |
284 | 284 | */ |
285 | 285 | public function key() { |
286 | - return key( $this->container ); |
|
286 | + return key($this->container); |
|
287 | 287 | } |
288 | 288 | |
289 | 289 | /** |
@@ -294,7 +294,7 @@ discard block |
||
294 | 294 | * @return void |
295 | 295 | */ |
296 | 296 | public function next() { |
297 | - next( $this->container ); |
|
297 | + next($this->container); |
|
298 | 298 | } |
299 | 299 | |
300 | 300 | /** |
@@ -305,7 +305,7 @@ discard block |
||
305 | 305 | * @return void |
306 | 306 | */ |
307 | 307 | public function rewind() { |
308 | - reset( $this->container ); |
|
308 | + reset($this->container); |
|
309 | 309 | } |
310 | 310 | |
311 | 311 | /** |
@@ -316,7 +316,7 @@ discard block |
||
316 | 316 | * @return bool |
317 | 317 | */ |
318 | 318 | public function valid() { |
319 | - return $this->offsetExists( $this->key() ); |
|
319 | + return $this->offsetExists($this->key()); |
|
320 | 320 | } |
321 | 321 | |
322 | 322 | /*****************************************************************/ |
@@ -331,6 +331,6 @@ discard block |
||
331 | 331 | * @return int |
332 | 332 | */ |
333 | 333 | public function count() { |
334 | - return count( $this->container ); |
|
334 | + return count($this->container); |
|
335 | 335 | } |
336 | 336 | } |
@@ -110,7 +110,7 @@ |
||
110 | 110 | if (isset($post->pid)) { |
111 | 111 | $post_id = $post->pid; |
112 | 112 | } else if (isset($_REQUEST['pid'])) { |
113 | - $post_id = (int)$_REQUEST['pid']; |
|
113 | + $post_id = (int) $_REQUEST['pid']; |
|
114 | 114 | } |
115 | 115 | |
116 | 116 | $postlink = get_permalink(geodir_add_listing_page_id()); |
@@ -1095,9 +1095,9 @@ discard block |
||
1095 | 1095 | $html .= '<div class="average-review" itemscope itemtype="http://data-vocabulary.org/Review-aggregate">'; |
1096 | 1096 | $post_avgratings = (is_float($post_avgratings) || (strpos($post_avgratings, ".", 1) == 1 && strlen($post_avgratings) > 3)) ? number_format($post_avgratings, 1, '.', '') : $post_avgratings; |
1097 | 1097 | |
1098 | - $reviews_text = $comment_count > 1 ? __("reviews", 'geodirectory') : __("review", 'geodirectory'); |
|
1098 | + $reviews_text = $comment_count > 1 ? __("reviews", 'geodirectory') : __("review", 'geodirectory'); |
|
1099 | 1099 | |
1100 | - $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 />'; |
|
1100 | + $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 />'; |
|
1101 | 1101 | |
1102 | 1102 | $html .= '<span class="item">'; |
1103 | 1103 | $html .= '<span class="fn" itemprop="itemreviewed">' . $post->post_title . '</span>'; |
@@ -1211,13 +1211,13 @@ discard block |
||
1211 | 1211 | $ajax_url = str_replace("http", "https", admin_url('admin-ajax.php')); |
1212 | 1212 | } |
1213 | 1213 | |
1214 | - /** |
|
1215 | - * Filter the allowed image type extensions for post images. |
|
1216 | - * |
|
1217 | - * @since 1.4.7.1 |
|
1218 | - * @param string $allowed_img_types The image type extensions array. |
|
1219 | - */ |
|
1220 | - $allowed_img_types = apply_filters('geodir_allowed_post_image_exts', array('jpg', 'jpeg', 'jpe', 'gif', 'png')); |
|
1214 | + /** |
|
1215 | + * Filter the allowed image type extensions for post images. |
|
1216 | + * |
|
1217 | + * @since 1.4.7.1 |
|
1218 | + * @param string $allowed_img_types The image type extensions array. |
|
1219 | + */ |
|
1220 | + $allowed_img_types = apply_filters('geodir_allowed_post_image_exts', array('jpg', 'jpeg', 'jpe', 'gif', 'png')); |
|
1221 | 1221 | |
1222 | 1222 | $arr_alert_msg = array( |
1223 | 1223 | 'geodir_plugin_url' => geodir_plugin_url(), |
@@ -1265,13 +1265,13 @@ discard block |
||
1265 | 1265 | 'geodir_err_file_upload_limit' => __('You have reached your upload limit of %s files.', 'geodirectory'), |
1266 | 1266 | 'geodir_err_pkg_upload_limit' => __('You may only upload %s files with this package, please try again.', 'geodirectory'), |
1267 | 1267 | 'geodir_action_remove' => __('Remove', 'geodirectory'), |
1268 | - 'geodir_txt_all_files' => __('Allowed files', 'geodirectory'), |
|
1269 | - 'geodir_err_file_type' => __('File type error. Allowed file types: %s', 'geodirectory'), |
|
1270 | - 'gd_allowed_img_types' => !empty($allowed_img_types) ? implode(',', $allowed_img_types) : '', |
|
1271 | - 'geodir_txt_form_wait' => __('Wait...', 'geodirectory'), |
|
1272 | - 'geodir_txt_form_searching' => __('Searching...', 'geodirectory'), |
|
1273 | - 'fa_rating' => (int)get_option('geodir_reviewrating_enable_font_awesome') == 1 ? 1 : '', |
|
1274 | - 'reviewrating' => defined('GEODIRREVIEWRATING_VERSION') ? 1 : '', |
|
1268 | + 'geodir_txt_all_files' => __('Allowed files', 'geodirectory'), |
|
1269 | + 'geodir_err_file_type' => __('File type error. Allowed file types: %s', 'geodirectory'), |
|
1270 | + 'gd_allowed_img_types' => !empty($allowed_img_types) ? implode(',', $allowed_img_types) : '', |
|
1271 | + 'geodir_txt_form_wait' => __('Wait...', 'geodirectory'), |
|
1272 | + 'geodir_txt_form_searching' => __('Searching...', 'geodirectory'), |
|
1273 | + 'fa_rating' => (int)get_option('geodir_reviewrating_enable_font_awesome') == 1 ? 1 : '', |
|
1274 | + 'reviewrating' => defined('GEODIRREVIEWRATING_VERSION') ? 1 : '', |
|
1275 | 1275 | ); |
1276 | 1276 | |
1277 | 1277 | /** |
@@ -1457,7 +1457,7 @@ discard block |
||
1457 | 1457 | * @global object $gd_session GeoDirectory Session object. |
1458 | 1458 | */ |
1459 | 1459 | function geodir_after_main_form_fields() { |
1460 | - global $gd_session; |
|
1460 | + global $gd_session; |
|
1461 | 1461 | |
1462 | 1462 | if (get_option('geodir_accept_term_condition')) { |
1463 | 1463 | global $post; |
@@ -1530,13 +1530,13 @@ discard block |
||
1530 | 1530 | $is_display = (geodir_is_page('detail')) ? true : false; |
1531 | 1531 | |
1532 | 1532 | if ($tab == 'related_listing') { |
1533 | - $message = __('No listings found which match your selection.', 'geodirectory'); |
|
1533 | + $message = __('No listings found which match your selection.', 'geodirectory'); |
|
1534 | 1534 | |
1535 | - /** This action is documented in geodirectory-functions/template_functions.php */ |
|
1536 | - $message = apply_filters('geodir_message_listing_not_found', $message, 'listing-listview', false); |
|
1535 | + /** This action is documented in geodirectory-functions/template_functions.php */ |
|
1536 | + $message = apply_filters('geodir_message_listing_not_found', $message, 'listing-listview', false); |
|
1537 | 1537 | |
1538 | - $is_display = ((strpos($related_listing, $message) !== false || $related_listing == '' || !geodir_is_page('detail'))) ? false : true; |
|
1539 | - } |
|
1538 | + $is_display = ((strpos($related_listing, $message) !== false || $related_listing == '' || !geodir_is_page('detail'))) ? false : true; |
|
1539 | + } |
|
1540 | 1540 | |
1541 | 1541 | |
1542 | 1542 | return $is_display; |
@@ -1583,12 +1583,12 @@ discard block |
||
1583 | 1583 | function geodir_changes_in_custom_fields_table() { |
1584 | 1584 | global $wpdb, $plugin_prefix; |
1585 | 1585 | |
1586 | - // Remove unused virtual page |
|
1587 | - $listings_page_id = (int)get_option('geodir_listing_page'); |
|
1588 | - if ($listings_page_id) { |
|
1589 | - $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'))); |
|
1586 | + // Remove unused virtual page |
|
1587 | + $listings_page_id = (int)get_option('geodir_listing_page'); |
|
1588 | + if ($listings_page_id) { |
|
1589 | + $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'))); |
|
1590 | 1590 | delete_option('geodir_listing_page'); |
1591 | - } |
|
1591 | + } |
|
1592 | 1592 | |
1593 | 1593 | // updated custom field table(add field to show custom field as a tab) |
1594 | 1594 | /*if (!$wpdb->get_var("SHOW COLUMNS FROM ".GEODIR_CUSTOM_FIELDS_TABLE." WHERE field = 'show_as_tab'")) { |
@@ -1756,26 +1756,26 @@ discard block |
||
1756 | 1756 | |
1757 | 1757 | } |
1758 | 1758 | |
1759 | - // Update tag in detail table. |
|
1760 | - $taxonomy_obj = get_taxonomy($taxonomy); |
|
1761 | - $post_type = !empty($taxonomy_obj) ? $taxonomy_obj->object_type[0] : NULL; |
|
1759 | + // Update tag in detail table. |
|
1760 | + $taxonomy_obj = get_taxonomy($taxonomy); |
|
1761 | + $post_type = !empty($taxonomy_obj) ? $taxonomy_obj->object_type[0] : NULL; |
|
1762 | 1762 | |
1763 | - $post_types = geodir_get_posttypes(); |
|
1764 | - if ($post_type && in_array($post_type, $post_types) && $post_type . '_tags' == $taxonomy) { |
|
1765 | - $posts_obj = $wpdb->get_results($wpdb->prepare("SELECT object_id FROM " . $wpdb->term_relationships . " WHERE term_taxonomy_id = %d", array($tt_id))); |
|
1763 | + $post_types = geodir_get_posttypes(); |
|
1764 | + if ($post_type && in_array($post_type, $post_types) && $post_type . '_tags' == $taxonomy) { |
|
1765 | + $posts_obj = $wpdb->get_results($wpdb->prepare("SELECT object_id FROM " . $wpdb->term_relationships . " WHERE term_taxonomy_id = %d", array($tt_id))); |
|
1766 | 1766 | |
1767 | - if (!empty($posts_obj)) { |
|
1768 | - foreach ($posts_obj as $post_obj) { |
|
1769 | - $post_id = $post_obj->object_id; |
|
1767 | + if (!empty($posts_obj)) { |
|
1768 | + foreach ($posts_obj as $post_obj) { |
|
1769 | + $post_id = $post_obj->object_id; |
|
1770 | 1770 | |
1771 | - $raw_tags = wp_get_object_terms($post_id, $post_type . '_tags', array('fields' => 'names')); |
|
1772 | - $post_tags = !empty($raw_tags) ? implode(',', $raw_tags) : ''; |
|
1771 | + $raw_tags = wp_get_object_terms($post_id, $post_type . '_tags', array('fields' => 'names')); |
|
1772 | + $post_tags = !empty($raw_tags) ? implode(',', $raw_tags) : ''; |
|
1773 | 1773 | |
1774 | - $listing_table = $plugin_prefix . $post_type . '_detail'; |
|
1775 | - $wpdb->query($wpdb->prepare("UPDATE " . $listing_table . " SET post_tags=%s WHERE post_id =%d", array($post_tags, $post_id))); |
|
1776 | - } |
|
1777 | - } |
|
1778 | - } |
|
1774 | + $listing_table = $plugin_prefix . $post_type . '_detail'; |
|
1775 | + $wpdb->query($wpdb->prepare("UPDATE " . $listing_table . " SET post_tags=%s WHERE post_id =%d", array($post_tags, $post_id))); |
|
1776 | + } |
|
1777 | + } |
|
1778 | + } |
|
1779 | 1779 | } |
1780 | 1780 | |
1781 | 1781 | |
@@ -1998,14 +1998,14 @@ discard block |
||
1998 | 1998 | add_filter('posts_results', 'geodir_set_status_draft_to_publish_for_own_post'); |
1999 | 1999 | } |
2000 | 2000 | /** |
2001 | - * Set status from draft to publish. |
|
2002 | - * |
|
2003 | - * @since 1.0.0 |
|
2004 | - * @package GeoDirectory |
|
2005 | - * @global object $wp WordPress object. |
|
2006 | - * @param object $post Post object. |
|
2007 | - * @return object Modified post object. |
|
2008 | - */ |
|
2001 | + * Set status from draft to publish. |
|
2002 | + * |
|
2003 | + * @since 1.0.0 |
|
2004 | + * @package GeoDirectory |
|
2005 | + * @global object $wp WordPress object. |
|
2006 | + * @param object $post Post object. |
|
2007 | + * @return object Modified post object. |
|
2008 | + */ |
|
2009 | 2009 | function geodir_set_status_draft_to_publish_for_own_post($post) |
2010 | 2010 | { |
2011 | 2011 | global $wp; |
@@ -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 */ |
@@ -177,7 +177,7 @@ discard block |
||
177 | 177 | //////////////////////// |
178 | 178 | |
179 | 179 | add_action('geodir_update_postrating', 'geodir_term_review_count_force_update', 100); |
180 | -add_action('transition_post_status', 'geodir_term_review_count_force_update', 100,3); |
|
180 | +add_action('transition_post_status', 'geodir_term_review_count_force_update', 100, 3); |
|
181 | 181 | add_action('created_term', 'geodir_term_review_count_force_update', 100); |
182 | 182 | add_action('edited_term', 'geodir_term_review_count_force_update', 100); |
183 | 183 | add_action('delete_term', 'geodir_term_review_count_force_update', 100); |
@@ -319,8 +319,8 @@ discard block |
||
319 | 319 | |
320 | 320 | /////// GEO DIRECOTORY CUSTOM HOOKS /// |
321 | 321 | |
322 | -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 |
|
323 | -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 |
|
322 | +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 |
|
323 | +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 |
|
324 | 324 | |
325 | 325 | // Detail page sidebar content |
326 | 326 | add_action('geodir_detail_page_sidebar', 'geodir_detail_page_sidebar_content_sorting', 1); |
@@ -422,7 +422,7 @@ discard block |
||
422 | 422 | $content_html = ob_get_clean(); |
423 | 423 | if (trim($content_html) != '') |
424 | 424 | $content_html = '<div class="geodir-company_info geodir-details-sidebar-social-sharing">' . $content_html . '</div>'; |
425 | - if ((int)get_option('geodir_disable_tfg_buttons_section') != 1) { |
|
425 | + if ((int) get_option('geodir_disable_tfg_buttons_section') != 1) { |
|
426 | 426 | /** |
427 | 427 | * Filter the geodir_social_sharing_buttons() function content. |
428 | 428 | * |
@@ -469,7 +469,7 @@ discard block |
||
469 | 469 | $content_html = ob_get_clean(); |
470 | 470 | if (trim($content_html) != '') |
471 | 471 | $content_html = '<div class="geodir-company_info geodir-details-sidebar-sharethis">' . $content_html . '</div>'; |
472 | - if ((int)get_option('geodir_disable_sharethis_button_section') != 1) { |
|
472 | + if ((int) get_option('geodir_disable_sharethis_button_section') != 1) { |
|
473 | 473 | /** |
474 | 474 | * Filter the geodir_share_this_button() function content. |
475 | 475 | * |
@@ -511,7 +511,7 @@ discard block |
||
511 | 511 | $post_id = $post->ID; |
512 | 512 | if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') { |
513 | 513 | |
514 | - $post_id = (int)$_REQUEST['pid']; |
|
514 | + $post_id = (int) $_REQUEST['pid']; |
|
515 | 515 | } |
516 | 516 | |
517 | 517 | $postlink = get_permalink(geodir_add_listing_page_id()); |
@@ -528,7 +528,7 @@ discard block |
||
528 | 528 | $content_html = ob_get_clean(); |
529 | 529 | if (trim($content_html) != '') |
530 | 530 | $content_html = '<div class="geodir-company_info geodir-details-sidebar-user-links">' . $content_html . '</div>'; |
531 | - if ((int)get_option('geodir_disable_user_links_section') != 1) { |
|
531 | + if ((int) get_option('geodir_disable_user_links_section') != 1) { |
|
532 | 532 | /** |
533 | 533 | * Filter the geodir_edit_post_link() function content. |
534 | 534 | * |
@@ -569,7 +569,7 @@ discard block |
||
569 | 569 | */ |
570 | 570 | do_action('geodir_before_google_analytics'); |
571 | 571 | |
572 | - if (get_option('geodir_ga_stats') && 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' )) ) { |
|
572 | + if (get_option('geodir_ga_stats') && 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'))) { |
|
573 | 573 | $page_url = urlencode($_SERVER['REQUEST_URI']); |
574 | 574 | ?> |
575 | 575 | <script type="text/javascript"> |
@@ -593,34 +593,34 @@ discard block |
||
593 | 593 | }); |
594 | 594 | |
595 | 595 | function gdga_weekVSweek() { |
596 | - jQuery.ajax({url: "<?php echo get_bloginfo('url').'/?ptype=ga&ga_page='.$page_url; ?>&ga_type=thisweek", success: function(result){ |
|
596 | + jQuery.ajax({url: "<?php echo get_bloginfo('url') . '/?ptype=ga&ga_page=' . $page_url; ?>&ga_type=thisweek", success: function(result){ |
|
597 | 597 | ga_data1 = jQuery.parseJSON(result); |
598 | 598 | if(ga_data1.error){jQuery('#ga_stats').html(result);return;} |
599 | 599 | gd_renderWeekOverWeekChart(); |
600 | 600 | }}); |
601 | 601 | |
602 | - jQuery.ajax({url: "<?php echo get_bloginfo('url').'/?ptype=ga&ga_page='.$page_url; ?>&ga_type=lastweek", success: function(result){ |
|
602 | + jQuery.ajax({url: "<?php echo get_bloginfo('url') . '/?ptype=ga&ga_page=' . $page_url; ?>&ga_type=lastweek", success: function(result){ |
|
603 | 603 | ga_data2 = jQuery.parseJSON(result); |
604 | 604 | gd_renderWeekOverWeekChart(); |
605 | 605 | }}); |
606 | 606 | } |
607 | 607 | |
608 | 608 | function gdga_yearVSyear() { |
609 | - jQuery.ajax({url: "<?php echo get_bloginfo('url').'/?ptype=ga&ga_page='.$page_url; ?>&ga_type=thisyear", success: function(result){ |
|
609 | + jQuery.ajax({url: "<?php echo get_bloginfo('url') . '/?ptype=ga&ga_page=' . $page_url; ?>&ga_type=thisyear", success: function(result){ |
|
610 | 610 | ga_data3 = jQuery.parseJSON(result); |
611 | 611 | if(ga_data3.error){jQuery('#ga_stats').html(result);return;} |
612 | 612 | |
613 | 613 | gd_renderYearOverYearChart() |
614 | 614 | }}); |
615 | 615 | |
616 | - jQuery.ajax({url: "<?php echo get_bloginfo('url').'/?ptype=ga&ga_page='.$page_url; ?>&ga_type=lastyear", success: function(result){ |
|
616 | + jQuery.ajax({url: "<?php echo get_bloginfo('url') . '/?ptype=ga&ga_page=' . $page_url; ?>&ga_type=lastyear", success: function(result){ |
|
617 | 617 | ga_data4 = jQuery.parseJSON(result); |
618 | 618 | gd_renderYearOverYearChart() |
619 | 619 | }}); |
620 | 620 | } |
621 | 621 | |
622 | 622 | function gdga_country() { |
623 | - jQuery.ajax({url: "<?php echo get_bloginfo('url').'/?ptype=ga&ga_page='.$page_url; ?>&ga_type=country", success: function(result){ |
|
623 | + jQuery.ajax({url: "<?php echo get_bloginfo('url') . '/?ptype=ga&ga_page=' . $page_url; ?>&ga_type=country", success: function(result){ |
|
624 | 624 | ga_data5 = jQuery.parseJSON(result); |
625 | 625 | if(ga_data5.error){jQuery('#ga_stats').html(result);return;} |
626 | 626 | gd_renderTopCountriesChart(); |
@@ -628,7 +628,7 @@ discard block |
||
628 | 628 | } |
629 | 629 | |
630 | 630 | function gdga_realtime() { |
631 | - jQuery.ajax({url: "<?php echo get_bloginfo('url').'/?ptype=ga&ga_page='.$page_url; ?>&ga_type=realtime", success: function(result){ |
|
631 | + jQuery.ajax({url: "<?php echo get_bloginfo('url') . '/?ptype=ga&ga_page=' . $page_url; ?>&ga_type=realtime", success: function(result){ |
|
632 | 632 | ga_data6 = jQuery.parseJSON(result); |
633 | 633 | if(ga_data6.error){jQuery('#ga_stats').html(result);return;} |
634 | 634 | gd_renderRealTime(); |
@@ -694,7 +694,7 @@ discard block |
||
694 | 694 | } |
695 | 695 | |
696 | 696 | function gdga_noResults() { |
697 | - jQuery('#gdga-chart-container').html('<?php _e('No results available','geodirectory');?>'); |
|
697 | + jQuery('#gdga-chart-container').html('<?php _e('No results available', 'geodirectory'); ?>'); |
|
698 | 698 | jQuery('#gdga-legend-container').html(''); |
699 | 699 | } |
700 | 700 | |
@@ -726,18 +726,18 @@ discard block |
||
726 | 726 | var data2 = results[1].rows.map(function(row) { return +row[2]; }); |
727 | 727 | //var labelsN = results[0].rows.map(function(row) { return +row[1]; }); |
728 | 728 | |
729 | - var labels = ['<?php _e('Jan', 'geodirectory');?>', |
|
730 | - '<?php _e('Feb', 'geodirectory');?>', |
|
731 | - '<?php _e('Mar', 'geodirectory');?>', |
|
732 | - '<?php _e('Apr', 'geodirectory');?>', |
|
733 | - '<?php _e('May', 'geodirectory');?>', |
|
734 | - '<?php _e('Jun', 'geodirectory');?>', |
|
735 | - '<?php _e('Jul', 'geodirectory');?>', |
|
736 | - '<?php _e('Aug', 'geodirectory');?>', |
|
737 | - '<?php _e('Sep', 'geodirectory');?>', |
|
738 | - '<?php _e('Oct', 'geodirectory');?>', |
|
739 | - '<?php _e('Nov', 'geodirectory');?>', |
|
740 | - '<?php _e('Dec', 'geodirectory');?>']; |
|
729 | + var labels = ['<?php _e('Jan', 'geodirectory'); ?>', |
|
730 | + '<?php _e('Feb', 'geodirectory'); ?>', |
|
731 | + '<?php _e('Mar', 'geodirectory'); ?>', |
|
732 | + '<?php _e('Apr', 'geodirectory'); ?>', |
|
733 | + '<?php _e('May', 'geodirectory'); ?>', |
|
734 | + '<?php _e('Jun', 'geodirectory'); ?>', |
|
735 | + '<?php _e('Jul', 'geodirectory'); ?>', |
|
736 | + '<?php _e('Aug', 'geodirectory'); ?>', |
|
737 | + '<?php _e('Sep', 'geodirectory'); ?>', |
|
738 | + '<?php _e('Oct', 'geodirectory'); ?>', |
|
739 | + '<?php _e('Nov', 'geodirectory'); ?>', |
|
740 | + '<?php _e('Dec', 'geodirectory'); ?>']; |
|
741 | 741 | |
742 | 742 | // Ensure the data arrays are at least as long as the labels array. |
743 | 743 | // Chart.js bar charts don't (yet) accept sparse datasets. |
@@ -750,13 +750,13 @@ discard block |
||
750 | 750 | labels : labels, |
751 | 751 | datasets : [ |
752 | 752 | { |
753 | - label: '<?php _e('Last Year', 'geodirectory');?>', |
|
753 | + label: '<?php _e('Last Year', 'geodirectory'); ?>', |
|
754 | 754 | fillColor : "rgba(220,220,220,0.5)", |
755 | 755 | strokeColor : "rgba(220,220,220,1)", |
756 | 756 | data : data2 |
757 | 757 | }, |
758 | 758 | { |
759 | - label: '<?php _e('This Year', 'geodirectory');?>', |
|
759 | + label: '<?php _e('This Year', 'geodirectory'); ?>', |
|
760 | 760 | fillColor : "rgba(151,187,205,0.5)", |
761 | 761 | strokeColor : "rgba(151,187,205,1)", |
762 | 762 | data : data1 |
@@ -801,30 +801,30 @@ discard block |
||
801 | 801 | |
802 | 802 | <?php |
803 | 803 | // Here we list the shorthand days of the week so it can be used in translation. |
804 | - __("Mon",'geodirectory'); |
|
805 | - __("Tue",'geodirectory'); |
|
806 | - __("Wed",'geodirectory'); |
|
807 | - __("Thu",'geodirectory'); |
|
808 | - __("Fri",'geodirectory'); |
|
809 | - __("Sat",'geodirectory'); |
|
810 | - __("Sun",'geodirectory'); |
|
804 | + __("Mon", 'geodirectory'); |
|
805 | + __("Tue", 'geodirectory'); |
|
806 | + __("Wed", 'geodirectory'); |
|
807 | + __("Thu", 'geodirectory'); |
|
808 | + __("Fri", 'geodirectory'); |
|
809 | + __("Sat", 'geodirectory'); |
|
810 | + __("Sun", 'geodirectory'); |
|
811 | 811 | ?> |
812 | 812 | |
813 | 813 | labels = [ |
814 | - "<?php _e(date('D', strtotime("+1 day")),'geodirectory'); ?>", |
|
815 | - "<?php _e(date('D', strtotime("+2 day")),'geodirectory'); ?>", |
|
816 | - "<?php _e(date('D', strtotime("+3 day")),'geodirectory'); ?>", |
|
817 | - "<?php _e(date('D', strtotime("+4 day")),'geodirectory'); ?>", |
|
818 | - "<?php _e(date('D', strtotime("+5 day")),'geodirectory'); ?>", |
|
819 | - "<?php _e(date('D', strtotime("+6 day")),'geodirectory'); ?>", |
|
820 | - "<?php _e(date('D', strtotime("+7 day")),'geodirectory'); ?>" |
|
814 | + "<?php _e(date('D', strtotime("+1 day")), 'geodirectory'); ?>", |
|
815 | + "<?php _e(date('D', strtotime("+2 day")), 'geodirectory'); ?>", |
|
816 | + "<?php _e(date('D', strtotime("+3 day")), 'geodirectory'); ?>", |
|
817 | + "<?php _e(date('D', strtotime("+4 day")), 'geodirectory'); ?>", |
|
818 | + "<?php _e(date('D', strtotime("+5 day")), 'geodirectory'); ?>", |
|
819 | + "<?php _e(date('D', strtotime("+6 day")), 'geodirectory'); ?>", |
|
820 | + "<?php _e(date('D', strtotime("+7 day")), 'geodirectory'); ?>" |
|
821 | 821 | ]; |
822 | 822 | |
823 | 823 | var data = { |
824 | 824 | labels : labels, |
825 | 825 | datasets : [ |
826 | 826 | { |
827 | - label: '<?php _e('Last Week', 'geodirectory');?>', |
|
827 | + label: '<?php _e('Last Week', 'geodirectory'); ?>', |
|
828 | 828 | fillColor : "rgba(220,220,220,0.5)", |
829 | 829 | strokeColor : "rgba(220,220,220,1)", |
830 | 830 | pointColor : "rgba(220,220,220,1)", |
@@ -832,7 +832,7 @@ discard block |
||
832 | 832 | data : data2 |
833 | 833 | }, |
834 | 834 | { |
835 | - label: '<?php _e('This Week', 'geodirectory');?>', |
|
835 | + label: '<?php _e('This Week', 'geodirectory'); ?>', |
|
836 | 836 | fillColor : "rgba(151,187,205,0.5)", |
837 | 837 | strokeColor : "rgba(151,187,205,1)", |
838 | 838 | pointColor : "rgba(151,187,205,1)", |
@@ -1014,18 +1014,18 @@ discard block |
||
1014 | 1014 | |
1015 | 1015 | |
1016 | 1016 | <span id="ga_stats"> |
1017 | - <div id="ga-analytics-title"><?php _e("Analytics", 'geodirectory');?></div> |
|
1017 | + <div id="ga-analytics-title"><?php _e("Analytics", 'geodirectory'); ?></div> |
|
1018 | 1018 | |
1019 | 1019 | <div id="gd-active-users-container"> |
1020 | - <div class="gd-ActiveUsers"><?php _e("Active Users:", 'geodirectory');?> |
|
1020 | + <div class="gd-ActiveUsers"><?php _e("Active Users:", 'geodirectory'); ?> |
|
1021 | 1021 | <b class="gd-ActiveUsers-value">0</b> |
1022 | 1022 | </div> |
1023 | 1023 | </div> |
1024 | 1024 | |
1025 | 1025 | <select id="gdga-select-analytic" onchange="gdga_select_option();" style="display: none;"> |
1026 | - <option value="weeks"><?php _e("Last Week vs This Week", 'geodirectory');?></option> |
|
1027 | - <option value="years"><?php _e("This Year vs Last Year", 'geodirectory');?></option> |
|
1028 | - <option value="country"><?php _e("Top Countries", 'geodirectory');?></option> |
|
1026 | + <option value="weeks"><?php _e("Last Week vs This Week", 'geodirectory'); ?></option> |
|
1027 | + <option value="years"><?php _e("This Year vs Last Year", 'geodirectory'); ?></option> |
|
1028 | + <option value="country"><?php _e("Top Countries", 'geodirectory'); ?></option> |
|
1029 | 1029 | </select> |
1030 | 1030 | <img alt="loader icon" id="gdga-loader-icon" src="<?php echo geodir_plugin_url() . '/geodirectory-assets/images/ajax-loader.gif'; ?>" /> |
1031 | 1031 | <div class="Chartjs-figure" id="gdga-chart-container"></div> |
@@ -1043,7 +1043,7 @@ discard block |
||
1043 | 1043 | $content_html = ob_get_clean(); |
1044 | 1044 | if (trim($content_html) != '') |
1045 | 1045 | $content_html = '<div class="geodir-company_info geodir-details-sidebar-google-analytics">' . $content_html . '</div>'; |
1046 | - if ((int)get_option('geodir_disable_google_analytics_section') != 1) { |
|
1046 | + if ((int) get_option('geodir_disable_google_analytics_section') != 1) { |
|
1047 | 1047 | /** |
1048 | 1048 | * Filter the geodir_edit_post_link() function content. |
1049 | 1049 | * |
@@ -1139,7 +1139,7 @@ discard block |
||
1139 | 1139 | if (trim($content_html) != '') { |
1140 | 1140 | $content_html = '<div class="geodir-company_info geodir-details-sidebar-rating">' . $content_html . '</div>'; |
1141 | 1141 | } |
1142 | - if ((int)get_option('geodir_disable_rating_info_section') != 1) { |
|
1142 | + if ((int) get_option('geodir_disable_rating_info_section') != 1) { |
|
1143 | 1143 | /** |
1144 | 1144 | * Filter the geodir_detail_page_review_rating() function content. |
1145 | 1145 | * |
@@ -1179,7 +1179,7 @@ discard block |
||
1179 | 1179 | $content_html = ob_get_clean(); |
1180 | 1180 | if (trim($content_html) != '') |
1181 | 1181 | $content_html = '<div class="geodir-company_info geodir-details-sidebar-listing-info">' . $content_html . '</div>'; |
1182 | - if ((int)get_option('geodir_disable_listing_info_section') != 1) { |
|
1182 | + if ((int) get_option('geodir_disable_listing_info_section') != 1) { |
|
1183 | 1183 | /** |
1184 | 1184 | * Filter the output html for function geodir_detail_page_more_info(). |
1185 | 1185 | * |
@@ -1270,7 +1270,7 @@ discard block |
||
1270 | 1270 | 'gd_allowed_img_types' => !empty($allowed_img_types) ? implode(',', $allowed_img_types) : '', |
1271 | 1271 | 'geodir_txt_form_wait' => __('Wait...', 'geodirectory'), |
1272 | 1272 | 'geodir_txt_form_searching' => __('Searching...', 'geodirectory'), |
1273 | - 'fa_rating' => (int)get_option('geodir_reviewrating_enable_font_awesome') == 1 ? 1 : '', |
|
1273 | + 'fa_rating' => (int) get_option('geodir_reviewrating_enable_font_awesome') == 1 ? 1 : '', |
|
1274 | 1274 | 'reviewrating' => defined('GEODIRREVIEWRATING_VERSION') ? 1 : '', |
1275 | 1275 | ); |
1276 | 1276 | |
@@ -1287,7 +1287,7 @@ discard block |
||
1287 | 1287 | foreach ($arr_alert_msg as $key => $value) { |
1288 | 1288 | if (!is_scalar($value)) |
1289 | 1289 | continue; |
1290 | - $arr_alert_msg[$key] = html_entity_decode((string)$value, ENT_QUOTES, 'UTF-8'); |
|
1290 | + $arr_alert_msg[$key] = html_entity_decode((string) $value, ENT_QUOTES, 'UTF-8'); |
|
1291 | 1291 | } |
1292 | 1292 | |
1293 | 1293 | $script = "var geodir_all_js_msg = " . json_encode($arr_alert_msg) . ';'; |
@@ -1463,7 +1463,7 @@ discard block |
||
1463 | 1463 | global $post; |
1464 | 1464 | $term_condition = ''; |
1465 | 1465 | if (isset($_REQUEST['backandedit'])) { |
1466 | - $post = (object)$gd_session->get('listing'); |
|
1466 | + $post = (object) $gd_session->get('listing'); |
|
1467 | 1467 | $term_condition = isset($post->geodir_accept_term_condition) ? $post->geodir_accept_term_condition : ''; |
1468 | 1468 | } |
1469 | 1469 | |
@@ -1477,7 +1477,7 @@ discard block |
||
1477 | 1477 | echo 'checked="checked"'; |
1478 | 1478 | } ?> field_type="checkbox" name="geodir_accept_term_condition" id="geodir_accept_term_condition" |
1479 | 1479 | class="geodir_textfield" value="1" |
1480 | - 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> |
|
1480 | + 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> |
|
1481 | 1481 | </span> |
1482 | 1482 | </div> |
1483 | 1483 | <span class="geodir_message_error"><?php if (isset($required_msg)) { |
@@ -1584,7 +1584,7 @@ discard block |
||
1584 | 1584 | global $wpdb, $plugin_prefix; |
1585 | 1585 | |
1586 | 1586 | // Remove unused virtual page |
1587 | - $listings_page_id = (int)get_option('geodir_listing_page'); |
|
1587 | + $listings_page_id = (int) get_option('geodir_listing_page'); |
|
1588 | 1588 | if ($listings_page_id) { |
1589 | 1589 | $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'))); |
1590 | 1590 | delete_option('geodir_listing_page'); |
@@ -1846,43 +1846,43 @@ discard block |
||
1846 | 1846 | |
1847 | 1847 | |
1848 | 1848 | $gd_page = ''; |
1849 | - if(geodir_is_page('home')){ |
|
1849 | + if (geodir_is_page('home')) { |
|
1850 | 1850 | $gd_page = 'home'; |
1851 | 1851 | $title = (get_option('geodir_meta_title_homepage')) ? get_option('geodir_meta_title_homepage') : $title; |
1852 | 1852 | } |
1853 | - elseif(geodir_is_page('detail')){ |
|
1853 | + elseif (geodir_is_page('detail')) { |
|
1854 | 1854 | $gd_page = 'detail'; |
1855 | 1855 | $title = (get_option('geodir_meta_title_detail')) ? get_option('geodir_meta_title_detail') : $title; |
1856 | 1856 | } |
1857 | - elseif(geodir_is_page('pt')){ |
|
1857 | + elseif (geodir_is_page('pt')) { |
|
1858 | 1858 | $gd_page = 'pt'; |
1859 | 1859 | $title = (get_option('geodir_meta_title_pt')) ? get_option('geodir_meta_title_pt') : $title; |
1860 | 1860 | } |
1861 | - elseif(geodir_is_page('listing')){ |
|
1861 | + elseif (geodir_is_page('listing')) { |
|
1862 | 1862 | $gd_page = 'listing'; |
1863 | 1863 | $title = (get_option('geodir_meta_title_listing')) ? get_option('geodir_meta_title_listing') : $title; |
1864 | 1864 | } |
1865 | - elseif(geodir_is_page('location')){ |
|
1865 | + elseif (geodir_is_page('location')) { |
|
1866 | 1866 | $gd_page = 'location'; |
1867 | 1867 | $title = (get_option('geodir_meta_title_location')) ? get_option('geodir_meta_title_location') : $title; |
1868 | 1868 | } |
1869 | - elseif(geodir_is_page('search')){ |
|
1869 | + elseif (geodir_is_page('search')) { |
|
1870 | 1870 | $gd_page = 'search'; |
1871 | 1871 | $title = (get_option('geodir_meta_title_search')) ? get_option('geodir_meta_title_search') : $title; |
1872 | 1872 | } |
1873 | - elseif(geodir_is_page('add-listing')){ |
|
1873 | + elseif (geodir_is_page('add-listing')) { |
|
1874 | 1874 | $gd_page = 'add-listing'; |
1875 | 1875 | $title = (get_option('geodir_meta_title_add-listing')) ? get_option('geodir_meta_title_add-listing') : $title; |
1876 | 1876 | } |
1877 | - elseif(geodir_is_page('author')){ |
|
1877 | + elseif (geodir_is_page('author')) { |
|
1878 | 1878 | $gd_page = 'author'; |
1879 | 1879 | $title = (get_option('geodir_meta_title_author')) ? get_option('geodir_meta_title_author') : $title; |
1880 | 1880 | } |
1881 | - elseif(geodir_is_page('login')){ |
|
1881 | + elseif (geodir_is_page('login')) { |
|
1882 | 1882 | $gd_page = 'login'; |
1883 | 1883 | $title = (get_option('geodir_meta_title_login')) ? get_option('geodir_meta_title_login') : $title; |
1884 | 1884 | } |
1885 | - elseif(geodir_is_page('listing-success')){ |
|
1885 | + elseif (geodir_is_page('listing-success')) { |
|
1886 | 1886 | $gd_page = 'listing-success'; |
1887 | 1887 | $title = (get_option('geodir_meta_title_listing-success')) ? get_option('geodir_meta_title_listing-success') : $title; |
1888 | 1888 | } |
@@ -2146,7 +2146,7 @@ discard block |
||
2146 | 2146 | */ |
2147 | 2147 | function geodir_remove_template_redirect_actions() |
2148 | 2148 | { |
2149 | - if (geodir_is_page('login')){ |
|
2149 | + if (geodir_is_page('login')) { |
|
2150 | 2150 | remove_all_actions('template_redirect'); |
2151 | 2151 | remove_action('init', 'avia_modify_front', 10); |
2152 | 2152 | } |
@@ -2593,8 +2593,8 @@ discard block |
||
2593 | 2593 | $date_format = $date_format['date_format']; |
2594 | 2594 | } |
2595 | 2595 | |
2596 | - $search = array('dd','d','DD','mm','m','MM','yy'); //jQuery UI datepicker format |
|
2597 | - $replace = array('d','j','l','m','n','F','Y');//PHP date format |
|
2596 | + $search = array('dd', 'd', 'DD', 'mm', 'm', 'MM', 'yy'); //jQuery UI datepicker format |
|
2597 | + $replace = array('d', 'j', 'l', 'm', 'n', 'F', 'Y'); //PHP date format |
|
2598 | 2598 | |
2599 | 2599 | $date_format = str_replace($search, $replace, $date_format); |
2600 | 2600 | |
@@ -2689,7 +2689,7 @@ discard block |
||
2689 | 2689 | $html_var = $type['htmlvar_name']; |
2690 | 2690 | $html_val = $type['htmlvar_name']; |
2691 | 2691 | |
2692 | - if ((int)$post->$html_var == 1) { |
|
2692 | + if ((int) $post->$html_var == 1) { |
|
2693 | 2693 | |
2694 | 2694 | if ($post->$type['htmlvar_name'] == '1') { |
2695 | 2695 | $html_val = __('Yes', 'geodirectory'); |
@@ -2865,7 +2865,7 @@ discard block |
||
2865 | 2865 | |
2866 | 2866 | if (!empty($files)) { |
2867 | 2867 | $extra_fields = !empty($type['extra_fields']) ? maybe_unserialize($type['extra_fields']) : NULL; |
2868 | - $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'] : ''; |
|
2868 | + $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'] : ''; |
|
2869 | 2869 | |
2870 | 2870 | $file_paths = ''; |
2871 | 2871 | foreach ($files as $file) { |
@@ -2893,7 +2893,7 @@ discard block |
||
2893 | 2893 | // If the uploaded file is image |
2894 | 2894 | if (in_array($uploaded_file_type, $image_file_types)) { |
2895 | 2895 | $file_paths .= '<div class="geodir-custom-post-gallery" class="clearfix">'; |
2896 | - $file_paths .= '<a href="'.$file.'">'; |
|
2896 | + $file_paths .= '<a href="' . $file . '">'; |
|
2897 | 2897 | $file_paths .= geodir_show_image(array('src' => $file), 'thumbnail', false, false); |
2898 | 2898 | $file_paths .= '</a>'; |
2899 | 2899 | $file_paths .= '</div>'; |
@@ -3243,7 +3243,7 @@ discard block |
||
3243 | 3243 | * @return array Translation texts. |
3244 | 3244 | */ |
3245 | 3245 | function geodir_load_gd_options_text_translation($translation_texts = array()) { |
3246 | - $translation_texts = !empty( $translation_texts ) && is_array( $translation_texts ) ? $translation_texts : array(); |
|
3246 | + $translation_texts = !empty($translation_texts) && is_array($translation_texts) ? $translation_texts : array(); |
|
3247 | 3247 | |
3248 | 3248 | $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_friend_subject', 'geodir_email_friend_content', 'geodir_email_enquiry_subject', 'geodir_email_enquiry_content', 'geodir_post_added_success_msg_content'); |
3249 | 3249 |
@@ -1,10 +1,10 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | /** |
3 | - * Template functions that affect the output of most GeoDirectory pages |
|
4 | - * |
|
5 | - * @since 1.0.0 |
|
6 | - * @package GeoDirectory |
|
7 | - */ |
|
3 | + * Template functions that affect the output of most GeoDirectory pages |
|
4 | + * |
|
5 | + * @since 1.0.0 |
|
6 | + * @package GeoDirectory |
|
7 | + */ |
|
8 | 8 | ############################################### |
9 | 9 | ########### DYNAMIC CONTENT ################### |
10 | 10 | ############################################### |
@@ -1197,9 +1197,9 @@ discard block |
||
1197 | 1197 | } else { |
1198 | 1198 | $post_term = $post->$post_taxonomy; |
1199 | 1199 | |
1200 | - if ($preview && !$is_backend_preview) { |
|
1201 | - $post_term = geodir_add_parent_terms($post_term, $post_taxonomy); |
|
1202 | - } |
|
1200 | + if ($preview && !$is_backend_preview) { |
|
1201 | + $post_term = geodir_add_parent_terms($post_term, $post_taxonomy); |
|
1202 | + } |
|
1203 | 1203 | } |
1204 | 1204 | |
1205 | 1205 | $post_term = array_unique($post_term); |
@@ -676,7 +676,7 @@ discard block |
||
676 | 676 | } |
677 | 677 | } |
678 | 678 | |
679 | - $post = (object)$_REQUEST; |
|
679 | + $post = (object) $_REQUEST; |
|
680 | 680 | |
681 | 681 | |
682 | 682 | if (isset($post->video)) { |
@@ -1019,7 +1019,7 @@ discard block |
||
1019 | 1019 | $height = !empty($sizes) && isset($sizes[1]) ? $sizes[1] : 0; |
1020 | 1020 | |
1021 | 1021 | if ($image && $width && $height) { |
1022 | - $image = (object)array('src' => $image, 'width' => $width, 'height' => $height); |
|
1022 | + $image = (object) array('src' => $image, 'width' => $width, 'height' => $height); |
|
1023 | 1023 | } |
1024 | 1024 | |
1025 | 1025 | if (isset($image->src)) { |
@@ -1052,9 +1052,9 @@ discard block |
||
1052 | 1052 | } else { |
1053 | 1053 | $spacer_height = ((400 - $image->height) / 2); |
1054 | 1054 | } |
1055 | - $caption = '';//(!empty($image->caption)) ? '<p class="flex-caption">'.$image->caption.'</p>' : ''; |
|
1055 | + $caption = ''; //(!empty($image->caption)) ? '<p class="flex-caption">'.$image->caption.'</p>' : ''; |
|
1056 | 1056 | $main_slides .= '<li><img src="' . geodir_plugin_url() . "/geodirectory-assets/images/spacer.gif" . '" alt="' . $image->title . '" title="' . $image->title . '" style="max-height:' . $spacer_height . 'px;margin:0 auto;" />'; |
1057 | - $main_slides .= '<img src="' . $image->src . '" alt="' . $image->title . '" title="' . $image->title . '" style="max-height:400px;margin:0 auto;" />'.$caption.'</li>'; |
|
1057 | + $main_slides .= '<img src="' . $image->src . '" alt="' . $image->title . '" title="' . $image->title . '" style="max-height:400px;margin:0 auto;" />' . $caption . '</li>'; |
|
1058 | 1058 | $nav_slides .= '<li><img src="' . $image->src . '" alt="' . $image->title . '" title="' . $image->title . '" style="max-height:48px;margin:0 auto;" /></li>'; |
1059 | 1059 | $slides++; |
1060 | 1060 | } |
@@ -1090,7 +1090,7 @@ discard block |
||
1090 | 1090 | */ |
1091 | 1091 | function geodir_action_details_taxonomies() |
1092 | 1092 | { |
1093 | - global $preview, $post;?> |
|
1093 | + global $preview, $post; ?> |
|
1094 | 1094 | <p class="geodir_post_taxomomies clearfix"> |
1095 | 1095 | <?php |
1096 | 1096 | $taxonomies = array(); |
@@ -1168,12 +1168,12 @@ discard block |
||
1168 | 1168 | * @param string $tag_link The tag link html. |
1169 | 1169 | * @param object $term The tag term object. |
1170 | 1170 | */ |
1171 | - $tag_link = apply_filters('geodir_details_taxonomies_tag_link',$tag_link,$term); |
|
1171 | + $tag_link = apply_filters('geodir_details_taxonomies_tag_link', $tag_link, $term); |
|
1172 | 1172 | $links[] = $tag_link; |
1173 | 1173 | } else { |
1174 | 1174 | $tag_link = "<a href='" . esc_attr(get_term_link($term->term_id, $term->taxonomy)) . "'>$term->name</a>"; |
1175 | 1175 | /** This action is documented in geodirectory-template_actions.php */ |
1176 | - $tag_link = apply_filters('geodir_details_taxonomies_tag_link',$tag_link,$term); |
|
1176 | + $tag_link = apply_filters('geodir_details_taxonomies_tag_link', $tag_link, $term); |
|
1177 | 1177 | $links[] = $tag_link; |
1178 | 1178 | } |
1179 | 1179 | $terms[] = $term; |
@@ -1183,7 +1183,7 @@ discard block |
||
1183 | 1183 | if (!isset($listing_label)) { |
1184 | 1184 | $listing_label = ''; |
1185 | 1185 | } |
1186 | - $taxonomies[$post_type . '_tags'] = wp_sprintf('%s: %l', geodir_ucwords($listing_label . ' ' . __('Tags', 'geodirectory')), $links, (object)$terms); |
|
1186 | + $taxonomies[$post_type . '_tags'] = wp_sprintf('%s: %l', geodir_ucwords($listing_label . ' ' . __('Tags', 'geodirectory')), $links, (object) $terms); |
|
1187 | 1187 | endif; |
1188 | 1188 | |
1189 | 1189 | } |
@@ -1219,7 +1219,7 @@ discard block |
||
1219 | 1219 | * @param string $term_link The link html to the category. |
1220 | 1220 | * @param object $term The category term object. |
1221 | 1221 | */ |
1222 | - $term_link = apply_filters('geodir_details_taxonomies_cat_link',$term_link,$term); |
|
1222 | + $term_link = apply_filters('geodir_details_taxonomies_cat_link', $term_link, $term); |
|
1223 | 1223 | $links[] = $term_link; |
1224 | 1224 | $terms[] = $term; |
1225 | 1225 | } |
@@ -1237,7 +1237,7 @@ discard block |
||
1237 | 1237 | if (!isset($listing_label)) { |
1238 | 1238 | $listing_label = ''; |
1239 | 1239 | } |
1240 | - $taxonomies[$post_taxonomy] = wp_sprintf('%s: %l', geodir_ucwords($listing_label . ' ' . __('Category', 'geodirectory')), $links, (object)$terms); |
|
1240 | + $taxonomies[$post_taxonomy] = wp_sprintf('%s: %l', geodir_ucwords($listing_label . ' ' . __('Category', 'geodirectory')), $links, (object) $terms); |
|
1241 | 1241 | |
1242 | 1242 | } |
1243 | 1243 | |
@@ -1268,11 +1268,11 @@ discard block |
||
1268 | 1268 | * @param object $post Optional. The post object or blank. |
1269 | 1269 | * @package GeoDirectory |
1270 | 1270 | */ |
1271 | -function geodir_action_details_micordata($post='') |
|
1271 | +function geodir_action_details_micordata($post = '') |
|
1272 | 1272 | { |
1273 | 1273 | |
1274 | 1274 | global $preview; |
1275 | - if(empty($post)){global $post;} |
|
1275 | + if (empty($post)) {global $post; } |
|
1276 | 1276 | if ($preview || !geodir_is_page('detail')) { |
1277 | 1277 | return; |
1278 | 1278 | } |
@@ -1293,7 +1293,7 @@ discard block |
||
1293 | 1293 | "description" => $review->comment_content, |
1294 | 1294 | "reviewRating" => array( |
1295 | 1295 | "@type" => "Rating", |
1296 | - "bestRating" => "5",// @todo this will need to be filtered for review manager if user changes the score. |
|
1296 | + "bestRating" => "5", // @todo this will need to be filtered for review manager if user changes the score. |
|
1297 | 1297 | "ratingValue" => geodir_get_commentoverall($review->comment_ID), |
1298 | 1298 | "worstRating" => "1" |
1299 | 1299 | ) |
@@ -1321,13 +1321,13 @@ discard block |
||
1321 | 1321 | } |
1322 | 1322 | //print_r($post); |
1323 | 1323 | // external links |
1324 | - $external_links = array(); |
|
1324 | + $external_links = array(); |
|
1325 | 1325 | $external_links[] = $post->geodir_website; |
1326 | 1326 | $external_links[] = $post->geodir_twitter; |
1327 | 1327 | $external_links[] = $post->geodir_facebook; |
1328 | 1328 | $external_links = array_filter($external_links); |
1329 | 1329 | |
1330 | - if(!empty($external_links)){ |
|
1330 | + if (!empty($external_links)) { |
|
1331 | 1331 | $external_links = array_values($external_links); |
1332 | 1332 | } |
1333 | 1333 | |
@@ -1337,16 +1337,16 @@ discard block |
||
1337 | 1337 | |
1338 | 1338 | // schema type |
1339 | 1339 | $schema_type = 'LocalBusiness'; |
1340 | - if(isset($post->default_category) && $post->default_category){ |
|
1340 | + if (isset($post->default_category) && $post->default_category) { |
|
1341 | 1341 | $schema_type = get_tax_meta($post->default_category, 'ct_cat_schema', false, $post->post_type); |
1342 | - if(!$schema_type && $post->post_type=='gd_event'){$schema_type = 'Event';} |
|
1342 | + if (!$schema_type && $post->post_type == 'gd_event') {$schema_type = 'Event'; } |
|
1343 | 1343 | } |
1344 | 1344 | |
1345 | 1345 | $schema = array(); |
1346 | 1346 | $schema['@context'] = "http://schema.org"; |
1347 | 1347 | $schema['@type'] = $schema_type; |
1348 | 1348 | $schema['name'] = $post->post_name; |
1349 | - $schema['description'] = wp_strip_all_tags( $post->post_content, true ); |
|
1349 | + $schema['description'] = wp_strip_all_tags($post->post_content, true); |
|
1350 | 1350 | $schema['telephone'] = $post->geodir_contact; |
1351 | 1351 | $schema['url'] = $c_url; |
1352 | 1352 | $schema['sameAs'] = $external_links; |
@@ -1360,7 +1360,7 @@ discard block |
||
1360 | 1360 | "postalCode" => $post->post_zip |
1361 | 1361 | ); |
1362 | 1362 | |
1363 | - if($post->post_latitude && $post->post_longitude) { |
|
1363 | + if ($post->post_latitude && $post->post_longitude) { |
|
1364 | 1364 | $schema['geo'] = array( |
1365 | 1365 | "@type" => "GeoCoordinates", |
1366 | 1366 | "latitude" => $post->post_latitude, |
@@ -1368,7 +1368,7 @@ discard block |
||
1368 | 1368 | ); |
1369 | 1369 | } |
1370 | 1370 | |
1371 | - if($post_avgratings) { |
|
1371 | + if ($post_avgratings) { |
|
1372 | 1372 | $schema['aggregateRating'] = array( |
1373 | 1373 | "@type" => "AggregateRating", |
1374 | 1374 | "ratingValue" => $post_avgratings, |
@@ -1387,7 +1387,7 @@ discard block |
||
1387 | 1387 | * @param array $schema The array of schema data to be filtered. |
1388 | 1388 | * @param object $post The post object. |
1389 | 1389 | */ |
1390 | - $schema = apply_filters('geodir_details_schema', $schema,$post); |
|
1390 | + $schema = apply_filters('geodir_details_schema', $schema, $post); |
|
1391 | 1391 | |
1392 | 1392 | |
1393 | 1393 | echo '<script type="application/ld+json">' . json_encode($schema) . '</script>'; |
@@ -1595,26 +1595,26 @@ discard block |
||
1595 | 1595 | |
1596 | 1596 | |
1597 | 1597 | $title = $list_title; |
1598 | - if(geodir_is_page('pt')){ |
|
1598 | + if (geodir_is_page('pt')) { |
|
1599 | 1599 | $gd_page = 'pt'; |
1600 | - $title = (get_option('geodir_page_title_pt')) ? get_option('geodir_page_title_pt') : $title; |
|
1600 | + $title = (get_option('geodir_page_title_pt')) ? get_option('geodir_page_title_pt') : $title; |
|
1601 | 1601 | } |
1602 | - elseif(geodir_is_page('listing')){ |
|
1602 | + elseif (geodir_is_page('listing')) { |
|
1603 | 1603 | $gd_page = 'listing'; |
1604 | 1604 | global $wp_query; |
1605 | 1605 | $current_term = $wp_query->get_queried_object(); |
1606 | - if (strpos($current_term->taxonomy,'_tags') !== false) { |
|
1606 | + if (strpos($current_term->taxonomy, '_tags') !== false) { |
|
1607 | 1607 | $title = (get_option('geodir_page_title_tag-listing')) ? get_option('geodir_page_title_tag-listing') : $title; |
1608 | - }else{ |
|
1608 | + } else { |
|
1609 | 1609 | $title = (get_option('geodir_page_title_cat-listing')) ? get_option('geodir_page_title_cat-listing') : $title; |
1610 | 1610 | } |
1611 | 1611 | |
1612 | 1612 | } |
1613 | - elseif(geodir_is_page('author')){ |
|
1613 | + elseif (geodir_is_page('author')) { |
|
1614 | 1614 | $gd_page = 'author'; |
1615 | - if(isset($_REQUEST['list']) && $_REQUEST['list']=='favourite'){ |
|
1615 | + if (isset($_REQUEST['list']) && $_REQUEST['list'] == 'favourite') { |
|
1616 | 1616 | $title = (get_option('geodir_page_title_favorite')) ? get_option('geodir_page_title_favorite') : $title; |
1617 | - }else{ |
|
1617 | + } else { |
|
1618 | 1618 | $title = (get_option('geodir_page_title_author')) ? get_option('geodir_page_title_author') : $title; |
1619 | 1619 | } |
1620 | 1620 | |
@@ -1628,7 +1628,7 @@ discard block |
||
1628 | 1628 | * @param string $title The page title including variables. |
1629 | 1629 | * @param string $gd_page The GeoDirectory page type if any. |
1630 | 1630 | */ |
1631 | - $title = apply_filters('geodir_seo_page_title', __($title, 'geodirectory'), $gd_page); |
|
1631 | + $title = apply_filters('geodir_seo_page_title', __($title, 'geodirectory'), $gd_page); |
|
1632 | 1632 | |
1633 | 1633 | echo '<header class="' . $class_header . '"><h1 class="' . $class . '">' . |
1634 | 1634 | /** |
@@ -1673,7 +1673,7 @@ discard block |
||
1673 | 1673 | if ($cat_description) { |
1674 | 1674 | ?> |
1675 | 1675 | |
1676 | - <div class="term_description"><?php echo $cat_description;?></div> <?php |
|
1676 | + <div class="term_description"><?php echo $cat_description; ?></div> <?php |
|
1677 | 1677 | } |
1678 | 1678 | |
1679 | 1679 | } |
@@ -1958,7 +1958,7 @@ discard block |
||
1958 | 1958 | */ |
1959 | 1959 | do_action('geodir_main_content_open', 'listings-page', 'geodir-main-content', 'listings-page'); |
1960 | 1960 | $extra_class = apply_filters('geodir_before_listing_wrapper_extra_class', '', 'listings-page'); |
1961 | - echo '<div class="clearfix '.$extra_class.'">'; |
|
1961 | + echo '<div class="clearfix ' . $extra_class . '">'; |
|
1962 | 1962 | /** |
1963 | 1963 | * Called before the listings page content, inside the outer wrapper. Used on listings pages and search and author pages. |
1964 | 1964 | * |
@@ -2034,11 +2034,11 @@ discard block |
||
2034 | 2034 | |
2035 | 2035 | $title = apply_filters('geodir_add_listing_page_title_text', get_the_title()); |
2036 | 2036 | |
2037 | - if(geodir_is_page('add-listing')){ |
|
2037 | + if (geodir_is_page('add-listing')) { |
|
2038 | 2038 | $gd_page = 'add-listing'; |
2039 | - if(isset($_REQUEST['pid']) && $_REQUEST['pid'] != ''){ |
|
2039 | + if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') { |
|
2040 | 2040 | $title = (get_option('geodir_page_title_edit-listing')) ? get_option('geodir_page_title_edit-listing') : $title; |
2041 | - }elseif(isset($listing_type)){ |
|
2041 | + }elseif (isset($listing_type)) { |
|
2042 | 2042 | $title = (get_option('geodir_page_title_add-listing')) ? get_option('geodir_page_title_add-listing') : $title; |
2043 | 2043 | } |
2044 | 2044 | |
@@ -2052,7 +2052,7 @@ discard block |
||
2052 | 2052 | * @param string $title The page title including variables. |
2053 | 2053 | * @param string $gd_page The GeoDirectory page type if any. |
2054 | 2054 | */ |
2055 | - $title = apply_filters('geodir_seo_page_title', __($title, 'geodirectory'), $gd_page); |
|
2055 | + $title = apply_filters('geodir_seo_page_title', __($title, 'geodirectory'), $gd_page); |
|
2056 | 2056 | |
2057 | 2057 | echo '<header class="' . $class_header . '"><h1 class="' . $class . '">'; |
2058 | 2058 | echo $title; |
@@ -2068,7 +2068,7 @@ discard block |
||
2068 | 2068 | */ |
2069 | 2069 | function geodir_action_add_listing_page_mandatory() |
2070 | 2070 | {?> |
2071 | - <p class="geodir-note "><span class="geodir-required">*</span> <?php echo INDICATES_MANDATORY_FIELDS_TEXT;?></p> |
|
2071 | + <p class="geodir-note "><span class="geodir-required">*</span> <?php echo INDICATES_MANDATORY_FIELDS_TEXT; ?></p> |
|
2072 | 2072 | <?php |
2073 | 2073 | } |
2074 | 2074 | |
@@ -2103,7 +2103,7 @@ discard block |
||
2103 | 2103 | |
2104 | 2104 | if (isset($_REQUEST['backandedit'])) { |
2105 | 2105 | global $post; |
2106 | - $post = (object)$gd_session->get('listing'); |
|
2106 | + $post = (object) $gd_session->get('listing'); |
|
2107 | 2107 | $listing_type = $post->listing_type; |
2108 | 2108 | $title = $post->post_title; |
2109 | 2109 | $desc = $post->post_desc; |
@@ -2145,10 +2145,10 @@ discard block |
||
2145 | 2145 | |
2146 | 2146 | |
2147 | 2147 | ?> |
2148 | - <form name="propertyform" id="propertyform" action="<?php echo get_page_link(geodir_preview_page_id());?>" |
|
2148 | + <form name="propertyform" id="propertyform" action="<?php echo get_page_link(geodir_preview_page_id()); ?>" |
|
2149 | 2149 | method="post" enctype="multipart/form-data"> |
2150 | - <input type="hidden" name="preview" value="<?php echo sanitize_text_field($listing_type);?>"/> |
|
2151 | - <input type="hidden" name="listing_type" value="<?php echo sanitize_text_field($listing_type);?>"/> |
|
2150 | + <input type="hidden" name="preview" value="<?php echo sanitize_text_field($listing_type); ?>"/> |
|
2151 | + <input type="hidden" name="listing_type" value="<?php echo sanitize_text_field($listing_type); ?>"/> |
|
2152 | 2152 | <?php if ($page_id) { ?><input type="hidden" name="add_listing_page_id" |
2153 | 2153 | value="<?php echo $page_id; ?>" /><?php }?> |
2154 | 2154 | <?php if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') { ?> |
@@ -2165,9 +2165,9 @@ discard block |
||
2165 | 2165 | * |
2166 | 2166 | * @since 1.0.0 |
2167 | 2167 | */ |
2168 | - do_action('geodir_before_detail_fields');?> |
|
2168 | + do_action('geodir_before_detail_fields'); ?> |
|
2169 | 2169 | |
2170 | - <h5 id="geodir_fieldset_details" class="geodir-fieldset-row" gd-fieldset="details"><?php echo LISTING_DETAILS_TEXT;?></h5> |
|
2170 | + <h5 id="geodir_fieldset_details" class="geodir-fieldset-row" gd-fieldset="details"><?php echo LISTING_DETAILS_TEXT; ?></h5> |
|
2171 | 2171 | |
2172 | 2172 | <?php |
2173 | 2173 | /** |
@@ -2177,13 +2177,13 @@ discard block |
||
2177 | 2177 | * |
2178 | 2178 | * @since 1.0.0 |
2179 | 2179 | */ |
2180 | - do_action('geodir_before_main_form_fields');?> |
|
2180 | + do_action('geodir_before_main_form_fields'); ?> |
|
2181 | 2181 | |
2182 | 2182 | <div id="geodir_post_title_row" class="required_field geodir_form_row clearfix gd-fieldset-details"> |
2183 | - <label><?php echo PLACE_TITLE_TEXT;?><span>*</span> </label> |
|
2183 | + <label><?php echo PLACE_TITLE_TEXT; ?><span>*</span> </label> |
|
2184 | 2184 | <input type="text" field_type="text" name="post_title" id="post_title" class="geodir_textfield" |
2185 | 2185 | value="<?php echo esc_attr(stripslashes($title)); ?>"/> |
2186 | - <span class="geodir_message_error"><?php _e($required_msg, 'geodirectory');?></span> |
|
2186 | + <span class="geodir_message_error"><?php _e($required_msg, 'geodirectory'); ?></span> |
|
2187 | 2187 | </div> |
2188 | 2188 | |
2189 | 2189 | <?php |
@@ -2228,20 +2228,20 @@ discard block |
||
2228 | 2228 | <div id="geodir_post_desc_row" class="<?php if ($desc_limit != '0') { |
2229 | 2229 | echo 'required_field'; |
2230 | 2230 | }?> geodir_form_row clearfix gd-fieldset-details"> |
2231 | - <label><?php echo PLACE_DESC_TEXT;?><span><?php if ($desc_limit != '0') { |
|
2231 | + <label><?php echo PLACE_DESC_TEXT; ?><span><?php if ($desc_limit != '0') { |
|
2232 | 2232 | echo '*'; |
2233 | 2233 | }?></span> </label> |
2234 | 2234 | <?php |
2235 | 2235 | if (!empty($show_editor) && in_array($listing_type, $show_editor)) { |
2236 | 2236 | |
2237 | - $editor_settings = array('media_buttons' => false, 'textarea_rows' => 10);?> |
|
2237 | + $editor_settings = array('media_buttons' => false, 'textarea_rows' => 10); ?> |
|
2238 | 2238 | |
2239 | 2239 | <div class="editor" field_id="post_desc" field_type="editor"> |
2240 | 2240 | <?php wp_editor($desc, "post_desc", $editor_settings); ?> |
2241 | 2241 | </div> |
2242 | 2242 | <?php if ($desc_limit != '') { ?> |
2243 | 2243 | <script |
2244 | - type="text/javascript">jQuery('textarea#post_desc').attr('maxlength', "<?php echo $desc_limit;?>");</script> |
|
2244 | + type="text/javascript">jQuery('textarea#post_desc').attr('maxlength', "<?php echo $desc_limit; ?>");</script> |
|
2245 | 2245 | <?php } ?> |
2246 | 2246 | <?php } else { ?> |
2247 | 2247 | <textarea field_type="textarea" name="post_desc" id="post_desc" class="geodir_textarea" |
@@ -2250,7 +2250,7 @@ discard block |
||
2250 | 2250 | <?php if ($desc_limit_msg != '') { ?> |
2251 | 2251 | <span class="geodir_message_note"><?php echo $desc_limit_msg; ?></span> |
2252 | 2252 | <?php } ?> |
2253 | - <span class="geodir_message_error"><?php echo _e($required_msg, 'geodirectory');?></span> |
|
2253 | + <span class="geodir_message_error"><?php echo _e($required_msg, 'geodirectory'); ?></span> |
|
2254 | 2254 | </div> |
2255 | 2255 | <?php |
2256 | 2256 | /** |
@@ -2300,8 +2300,8 @@ discard block |
||
2300 | 2300 | <div id="geodir_post_tags_row" class="geodir_form_row clearfix gd-fieldset-details"> |
2301 | 2301 | <label><?php echo TAGKW_TEXT; ?></label> |
2302 | 2302 | <input name="post_tags" id="post_tags" value="<?php echo $kw_tags; ?>" type="text" class="geodir_textfield" |
2303 | - maxlength="<?php echo $kw_tags_count;?>"/> |
|
2304 | - <span class="geodir_message_note"><?php echo $kw_tags_msg;?></span> |
|
2303 | + maxlength="<?php echo $kw_tags_count; ?>"/> |
|
2304 | + <span class="geodir_message_note"><?php echo $kw_tags_msg; ?></span> |
|
2305 | 2305 | </div> |
2306 | 2306 | <?php |
2307 | 2307 | /** |
@@ -2318,7 +2318,7 @@ discard block |
||
2318 | 2318 | |
2319 | 2319 | $package_info = geodir_post_package_info($package_info, $post); |
2320 | 2320 | |
2321 | - geodir_get_custom_fields_html($package_info->pid, 'all', $listing_type);?> |
|
2321 | + geodir_get_custom_fields_html($package_info->pid, 'all', $listing_type); ?> |
|
2322 | 2322 | |
2323 | 2323 | |
2324 | 2324 | <?php |
@@ -2334,7 +2334,7 @@ discard block |
||
2334 | 2334 | $thumb_img_arr = array(); |
2335 | 2335 | $totImg = 0; |
2336 | 2336 | if (isset($_REQUEST['backandedit']) && empty($_REQUEST['pid'])) { |
2337 | - $post = (object)$gd_session->get('listing'); |
|
2337 | + $post = (object) $gd_session->get('listing'); |
|
2338 | 2338 | if (isset($post->post_images)) |
2339 | 2339 | $curImages = trim($post->post_images, ","); |
2340 | 2340 | |
@@ -2347,7 +2347,7 @@ discard block |
||
2347 | 2347 | $listing_type = $post->listing_type; |
2348 | 2348 | |
2349 | 2349 | } elseif (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') { |
2350 | - $post = geodir_get_post_info((int)$_REQUEST['pid']); |
|
2350 | + $post = geodir_get_post_info((int) $_REQUEST['pid']); |
|
2351 | 2351 | $listing_type = $post->post_type; |
2352 | 2352 | $thumb_img_arr = geodir_get_images($_REQUEST['pid']); |
2353 | 2353 | |
@@ -2361,7 +2361,7 @@ discard block |
||
2361 | 2361 | //$curImages = $img->src.","; |
2362 | 2362 | } |
2363 | 2363 | |
2364 | - $totImg = count((array)$thumb_img_arr); |
|
2364 | + $totImg = count((array) $thumb_img_arr); |
|
2365 | 2365 | } |
2366 | 2366 | |
2367 | 2367 | if ($curImages != '') |
@@ -2382,7 +2382,7 @@ discard block |
||
2382 | 2382 | if ($show_image_input_box) { |
2383 | 2383 | ?> |
2384 | 2384 | |
2385 | - <h5 id="geodir_form_title_row" class="geodir-form_title"> <?php echo PRO_PHOTO_TEXT;?> |
|
2385 | + <h5 id="geodir_form_title_row" class="geodir-form_title"> <?php echo PRO_PHOTO_TEXT; ?> |
|
2386 | 2386 | <?php if ($image_limit == 1) { |
2387 | 2387 | echo '<br /><small>(' . __('You can upload', 'geodirectory') . ' ' . $image_limit . ' ' . __('image with this package', 'geodirectory') . ')</small>'; |
2388 | 2388 | } ?> |
@@ -2405,7 +2405,7 @@ discard block |
||
2405 | 2405 | <div |
2406 | 2406 | class="plupload-upload-uic hide-if-no-js <?php if ($multiple): ?>plupload-upload-uic-multiple<?php endif; ?>" |
2407 | 2407 | id="<?php echo $id; ?>plupload-upload-ui"> |
2408 | - <h4><?php _e('Drop files to upload', 'geodirectory');?></h4><br/> |
|
2408 | + <h4><?php _e('Drop files to upload', 'geodirectory'); ?></h4><br/> |
|
2409 | 2409 | <input id="<?php echo $id; ?>plupload-browse-button" type="button" |
2410 | 2410 | value="<?php esc_attr_e('Select Files', 'geodirectory'); ?>" class="geodir_button"/> |
2411 | 2411 | <span class="ajaxnonceplu" |
@@ -2422,7 +2422,7 @@ discard block |
||
2422 | 2422 | id="<?php echo $id; ?>plupload-thumbs" style="border-top:1px solid #ccc; padding-top:10px;"> |
2423 | 2423 | </div> |
2424 | 2424 | <span |
2425 | - id="upload-msg"><?php _e('Please drag & drop the images to rearrange the order', 'geodirectory');?></span> |
|
2425 | + id="upload-msg"><?php _e('Please drag & drop the images to rearrange the order', 'geodirectory'); ?></span> |
|
2426 | 2426 | <span id="<?php echo $id; ?>upload-error" style="display:none"></span> |
2427 | 2427 | </div> |
2428 | 2428 | |
@@ -2434,7 +2434,7 @@ discard block |
||
2434 | 2434 | * |
2435 | 2435 | * @since 1.0.0 |
2436 | 2436 | */ |
2437 | - do_action('geodir_after_main_form_fields');?> |
|
2437 | + do_action('geodir_after_main_form_fields'); ?> |
|
2438 | 2438 | |
2439 | 2439 | |
2440 | 2440 | <!-- add captcha code --> |
@@ -2445,7 +2445,7 @@ discard block |
||
2445 | 2445 | </script> |
2446 | 2446 | <noscript> |
2447 | 2447 | <div> |
2448 | - <label><?php _e('Type 64 into this box', 'geodirectory');?></label> |
|
2448 | + <label><?php _e('Type 64 into this box', 'geodirectory'); ?></label> |
|
2449 | 2449 | <input type="text" id="geodir_spamblocker_top_form" name="geodir_spamblocker" value="" maxlength="10"/> |
2450 | 2450 | </div> |
2451 | 2451 | </noscript> |
@@ -2455,10 +2455,10 @@ discard block |
||
2455 | 2455 | <!-- end captcha code --> |
2456 | 2456 | |
2457 | 2457 | <div id="geodir-add-listing-submit" class="geodir_form_row clear_both" style="padding:2px;text-align:center;"> |
2458 | - <input type="submit" value="<?php echo PRO_PREVIEW_BUTTON;?>" |
|
2459 | - class="geodir_button" <?php echo $submit_button;?>/> |
|
2458 | + <input type="submit" value="<?php echo PRO_PREVIEW_BUTTON; ?>" |
|
2459 | + class="geodir_button" <?php echo $submit_button; ?>/> |
|
2460 | 2460 | <span class="geodir_message_note" |
2461 | - style="padding-left:0px;"> <?php _e('Note: You will be able to see a preview in the next page', 'geodirectory');?></span> |
|
2461 | + style="padding-left:0px;"> <?php _e('Note: You will be able to see a preview in the next page', 'geodirectory'); ?></span> |
|
2462 | 2462 | </div> |
2463 | 2463 | |
2464 | 2464 | </form> |
@@ -2520,7 +2520,7 @@ discard block |
||
2520 | 2520 | class="<?php |
2521 | 2521 | /** This action is documented in geodirectory_template_actions.php */ |
2522 | 2522 | echo apply_filters('geodir_full_page_class', 'geodir_full_page clearfix', 'Reg/Login Top Section'); ?>"> |
2523 | - <?php dynamic_sidebar('Reg/Login Top Section');?> |
|
2523 | + <?php dynamic_sidebar('Reg/Login Top Section'); ?> |
|
2524 | 2524 | </div><!-- clearfix ends here--> |
2525 | 2525 | <?php |
2526 | 2526 | } |
@@ -2542,7 +2542,7 @@ discard block |
||
2542 | 2542 | |
2543 | 2543 | ?> |
2544 | 2544 | <script type="text/javascript"> |
2545 | - <?php if ( $user_login ) { ?> |
|
2545 | + <?php if ($user_login) { ?> |
|
2546 | 2546 | setTimeout(function () { |
2547 | 2547 | try { |
2548 | 2548 | d = document.getElementById('user_pass'); |
@@ -2559,7 +2559,7 @@ discard block |
||
2559 | 2559 | <?php } ?> |
2560 | 2560 | </script> |
2561 | 2561 | <script type="text/javascript"> |
2562 | - <?php if ( $user_login ) { ?> |
|
2562 | + <?php if ($user_login) { ?> |
|
2563 | 2563 | setTimeout(function () { |
2564 | 2564 | try { |
2565 | 2565 | d = document.getElementById('user_pass'); |
@@ -2697,11 +2697,11 @@ discard block |
||
2697 | 2697 | $class_header = apply_filters('geodir_page_title_header_class', 'entry-header'); |
2698 | 2698 | |
2699 | 2699 | $title = $list_title; |
2700 | - if(geodir_is_page('author')){ |
|
2700 | + if (geodir_is_page('author')) { |
|
2701 | 2701 | $gd_page = 'author'; |
2702 | - if(isset($_REQUEST['list']) && $_REQUEST['list']=='favourite'){ |
|
2702 | + if (isset($_REQUEST['list']) && $_REQUEST['list'] == 'favourite') { |
|
2703 | 2703 | $title = (get_option('geodir_page_title_favorite')) ? get_option('geodir_page_title_favorite') : $title; |
2704 | - }else{ |
|
2704 | + } else { |
|
2705 | 2705 | $title = (get_option('geodir_page_title_author')) ? get_option('geodir_page_title_author') : $title; |
2706 | 2706 | } |
2707 | 2707 | |
@@ -2715,7 +2715,7 @@ discard block |
||
2715 | 2715 | * @param string $title The page title including variables. |
2716 | 2716 | * @param string $gd_page The GeoDirectory page type if any. |
2717 | 2717 | */ |
2718 | - $title = apply_filters('geodir_seo_page_title', __($title, 'geodirectory'), $gd_page); |
|
2718 | + $title = apply_filters('geodir_seo_page_title', __($title, 'geodirectory'), $gd_page); |
|
2719 | 2719 | |
2720 | 2720 | echo '<header class="' . $class_header . '"><h1 class="' . $class . '">' . |
2721 | 2721 | /** |
@@ -2929,7 +2929,7 @@ discard block |
||
2929 | 2929 | $post_type_info = get_post_type_object($gd_post_type); |
2930 | 2930 | |
2931 | 2931 | $pt_name = ''; |
2932 | - if(isset($post_type_info->labels->name)){$pt_name=$post_type_info->labels->name;} |
|
2932 | + if (isset($post_type_info->labels->name)) {$pt_name = $post_type_info->labels->name; } |
|
2933 | 2933 | |
2934 | 2934 | if (is_search()) { |
2935 | 2935 | $list_title = __('Search', 'geodirectory') . ' ' . __($pt_name, 'geodirectory') . __(' For :', 'geodirectory') . " '" . get_search_query() . "'"; |
@@ -714,8 +714,9 @@ discard block |
||
714 | 714 | |
715 | 715 | if (isset($post->post_default_category) && $post->post_default_category == $cat_id) { |
716 | 716 | if ($term_icon_url = get_tax_meta($cat_id, 'ct_cat_icon', false, $post_type)) { |
717 | - if (isset($term_icon_url['src']) && $term_icon_url['src'] != '') |
|
718 | - $term_icon = $term_icon_url['src']; |
|
717 | + if (isset($term_icon_url['src']) && $term_icon_url['src'] != '') { |
|
718 | + $term_icon = $term_icon_url['src']; |
|
719 | + } |
|
719 | 720 | break; |
720 | 721 | } |
721 | 722 | } |
@@ -1246,8 +1247,9 @@ discard block |
||
1246 | 1247 | echo '<span class="geodir-category">' . $taxonomies[$post_taxonomy] . '</span>'; |
1247 | 1248 | } |
1248 | 1249 | |
1249 | - if (isset($taxonomies[$post_type . '_tags'])) |
|
1250 | - echo '<span class="geodir-tags">' . $taxonomies[$post_type . '_tags'] . '</span>'; |
|
1250 | + if (isset($taxonomies[$post_type . '_tags'])) { |
|
1251 | + echo '<span class="geodir-tags">' . $taxonomies[$post_type . '_tags'] . '</span>'; |
|
1252 | + } |
|
1251 | 1253 | |
1252 | 1254 | ?> |
1253 | 1255 | </p><?php |
@@ -1598,23 +1600,21 @@ discard block |
||
1598 | 1600 | if(geodir_is_page('pt')){ |
1599 | 1601 | $gd_page = 'pt'; |
1600 | 1602 | $title = (get_option('geodir_page_title_pt')) ? get_option('geodir_page_title_pt') : $title; |
1601 | - } |
|
1602 | - elseif(geodir_is_page('listing')){ |
|
1603 | + } elseif(geodir_is_page('listing')){ |
|
1603 | 1604 | $gd_page = 'listing'; |
1604 | 1605 | global $wp_query; |
1605 | 1606 | $current_term = $wp_query->get_queried_object(); |
1606 | 1607 | if (strpos($current_term->taxonomy,'_tags') !== false) { |
1607 | 1608 | $title = (get_option('geodir_page_title_tag-listing')) ? get_option('geodir_page_title_tag-listing') : $title; |
1608 | - }else{ |
|
1609 | + } else{ |
|
1609 | 1610 | $title = (get_option('geodir_page_title_cat-listing')) ? get_option('geodir_page_title_cat-listing') : $title; |
1610 | 1611 | } |
1611 | 1612 | |
1612 | - } |
|
1613 | - elseif(geodir_is_page('author')){ |
|
1613 | + } elseif(geodir_is_page('author')){ |
|
1614 | 1614 | $gd_page = 'author'; |
1615 | 1615 | if(isset($_REQUEST['list']) && $_REQUEST['list']=='favourite'){ |
1616 | 1616 | $title = (get_option('geodir_page_title_favorite')) ? get_option('geodir_page_title_favorite') : $title; |
1617 | - }else{ |
|
1617 | + } else{ |
|
1618 | 1618 | $title = (get_option('geodir_page_title_author')) ? get_option('geodir_page_title_author') : $title; |
1619 | 1619 | } |
1620 | 1620 | |
@@ -2025,8 +2025,9 @@ discard block |
||
2025 | 2025 | */ |
2026 | 2026 | function geodir_action_add_listing_page_title() |
2027 | 2027 | { |
2028 | - if (isset($_REQUEST['listing_type']) && $_REQUEST['listing_type'] != '') |
|
2029 | - $listing_type = sanitize_text_field($_REQUEST['listing_type']); |
|
2028 | + if (isset($_REQUEST['listing_type']) && $_REQUEST['listing_type'] != '') { |
|
2029 | + $listing_type = sanitize_text_field($_REQUEST['listing_type']); |
|
2030 | + } |
|
2030 | 2031 | /** This action is documented in geodirectory_template_actions.php */ |
2031 | 2032 | $class = apply_filters('geodir_page_title_class', 'entry-title fn'); |
2032 | 2033 | /** This action is documented in geodirectory_template_actions.php */ |
@@ -2038,7 +2039,7 @@ discard block |
||
2038 | 2039 | $gd_page = 'add-listing'; |
2039 | 2040 | if(isset($_REQUEST['pid']) && $_REQUEST['pid'] != ''){ |
2040 | 2041 | $title = (get_option('geodir_page_title_edit-listing')) ? get_option('geodir_page_title_edit-listing') : $title; |
2041 | - }elseif(isset($listing_type)){ |
|
2042 | + } elseif(isset($listing_type)){ |
|
2042 | 2043 | $title = (get_option('geodir_page_title_add-listing')) ? get_option('geodir_page_title_add-listing') : $title; |
2043 | 2044 | } |
2044 | 2045 | |
@@ -2096,7 +2097,11 @@ discard block |
||
2096 | 2097 | $required_msg = ''; |
2097 | 2098 | $submit_button = ''; |
2098 | 2099 | |
2099 | - if (isset($_REQUEST['ajax_action'])) $ajax_action = $_REQUEST['ajax_action']; else $ajax_action = 'add'; |
|
2100 | + if (isset($_REQUEST['ajax_action'])) { |
|
2101 | + $ajax_action = $_REQUEST['ajax_action']; |
|
2102 | + } else { |
|
2103 | + $ajax_action = 'add'; |
|
2104 | + } |
|
2100 | 2105 | |
2101 | 2106 | $thumb_img_arr = array(); |
2102 | 2107 | $curImages = ''; |
@@ -2335,8 +2340,9 @@ discard block |
||
2335 | 2340 | $totImg = 0; |
2336 | 2341 | if (isset($_REQUEST['backandedit']) && empty($_REQUEST['pid'])) { |
2337 | 2342 | $post = (object)$gd_session->get('listing'); |
2338 | - if (isset($post->post_images)) |
|
2339 | - $curImages = trim($post->post_images, ","); |
|
2343 | + if (isset($post->post_images)) { |
|
2344 | + $curImages = trim($post->post_images, ","); |
|
2345 | + } |
|
2340 | 2346 | |
2341 | 2347 | |
2342 | 2348 | if ($curImages != '') { |
@@ -2364,10 +2370,13 @@ discard block |
||
2364 | 2370 | $totImg = count((array)$thumb_img_arr); |
2365 | 2371 | } |
2366 | 2372 | |
2367 | - if ($curImages != '') |
|
2368 | - $svalue = $curImages; // this will be initial value of the above form field. Image urls. |
|
2369 | - else |
|
2370 | - $svalue = ''; |
|
2373 | + if ($curImages != '') { |
|
2374 | + $svalue = $curImages; |
|
2375 | + } |
|
2376 | + // this will be initial value of the above form field. Image urls. |
|
2377 | + else { |
|
2378 | + $svalue = ''; |
|
2379 | + } |
|
2371 | 2380 | |
2372 | 2381 | $image_limit = $package_info->image_limit; |
2373 | 2382 | $show_image_input_box = ($image_limit != '0'); |
@@ -2577,8 +2586,9 @@ discard block |
||
2577 | 2586 | </script><?php |
2578 | 2587 | |
2579 | 2588 | global $errors; |
2580 | - if (isset($_REQUEST['msg']) && $_REQUEST['msg'] == 'claim') |
|
2581 | - $errors->add('claim_login', LOGIN_CLAIM); |
|
2589 | + if (isset($_REQUEST['msg']) && $_REQUEST['msg'] == 'claim') { |
|
2590 | + $errors->add('claim_login', LOGIN_CLAIM); |
|
2591 | + } |
|
2582 | 2592 | |
2583 | 2593 | if (!empty($errors)) { |
2584 | 2594 | foreach ($errors as $errorsObj) { |
@@ -2682,8 +2692,9 @@ discard block |
||
2682 | 2692 | |
2683 | 2693 | if (!empty($term)) { |
2684 | 2694 | $current_term = get_term_by('slug', $term, $taxonomy[0]); |
2685 | - if (!empty($current_term)) |
|
2686 | - $list_title .= __(' in', 'geodirectory') . " '" . geodir_ucwords($current_term->name) . "'"; |
|
2695 | + if (!empty($current_term)) { |
|
2696 | + $list_title .= __(' in', 'geodirectory') . " '" . geodir_ucwords($current_term->name) . "'"; |
|
2697 | + } |
|
2687 | 2698 | } |
2688 | 2699 | |
2689 | 2700 | |
@@ -2701,7 +2712,7 @@ discard block |
||
2701 | 2712 | $gd_page = 'author'; |
2702 | 2713 | if(isset($_REQUEST['list']) && $_REQUEST['list']=='favourite'){ |
2703 | 2714 | $title = (get_option('geodir_page_title_favorite')) ? get_option('geodir_page_title_favorite') : $title; |
2704 | - }else{ |
|
2715 | + } else{ |
|
2705 | 2716 | $title = (get_option('geodir_page_title_author')) ? get_option('geodir_page_title_author') : $title; |
2706 | 2717 | } |
2707 | 2718 |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | } |
48 | 48 | |
49 | 49 | |
50 | - add_action('init', 'gd_fix_cpt_rewrite_slug', 11);// this needs to be kept for a few versions |
|
50 | + add_action('init', 'gd_fix_cpt_rewrite_slug', 11); // this needs to be kept for a few versions |
|
51 | 51 | |
52 | 52 | update_option('geodirectory' . '_db_version', GEODIRECTORY_VERSION); |
53 | 53 | |
@@ -84,7 +84,7 @@ discard block |
||
84 | 84 | * @since 1.0.0 |
85 | 85 | * @package GeoDirectory |
86 | 86 | */ |
87 | -function geodir_upgrade_146(){ |
|
87 | +function geodir_upgrade_146() { |
|
88 | 88 | gd_convert_virtual_pages(); |
89 | 89 | } |
90 | 90 | |
@@ -94,7 +94,7 @@ discard block |
||
94 | 94 | * @since 1.5.0 |
95 | 95 | * @package GeoDirectory |
96 | 96 | */ |
97 | -function geodir_upgrade_150(){ |
|
97 | +function geodir_upgrade_150() { |
|
98 | 98 | gd_fix_cpt_rewrite_slug(); |
99 | 99 | } |
100 | 100 | |
@@ -106,12 +106,12 @@ discard block |
||
106 | 106 | * @since 1.4.8 |
107 | 107 | * @package GeoDirectory |
108 | 108 | */ |
109 | -function geodir_upgrade_148(){ |
|
109 | +function geodir_upgrade_148() { |
|
110 | 110 | /* |
111 | 111 | * Blank the users google password if present as we now use oAuth 2.0 |
112 | 112 | */ |
113 | - update_option('geodir_ga_pass',''); |
|
114 | - update_option('geodir_ga_user',''); |
|
113 | + update_option('geodir_ga_pass', ''); |
|
114 | + update_option('geodir_ga_user', ''); |
|
115 | 115 | |
116 | 116 | } |
117 | 117 | |
@@ -122,7 +122,7 @@ discard block |
||
122 | 122 | * @since 1.5.3 |
123 | 123 | * @package GeoDirectory |
124 | 124 | */ |
125 | -function geodir_upgrade_153(){ |
|
125 | +function geodir_upgrade_153() { |
|
126 | 126 | geodir_create_page(esc_sql(_x('gd-info', 'page_slug', 'geodirectory')), 'geodir_info_page', __('Info', 'geodirectory'), ''); |
127 | 127 | geodir_create_page(esc_sql(_x('gd-login', 'page_slug', 'geodirectory')), 'geodir_login_page', __('Login', 'geodirectory'), ''); |
128 | 128 | } |
@@ -133,7 +133,7 @@ discard block |
||
133 | 133 | * @since 1.5.3 |
134 | 134 | * @package GeoDirectory |
135 | 135 | */ |
136 | -function geodir_upgrade_154(){ |
|
136 | +function geodir_upgrade_154() { |
|
137 | 137 | geodir_create_page(esc_sql(_x('gd-home', 'page_slug', 'geodirectory')), 'geodir_home_page', __('GD Home page', 'geodirectory'), ''); |
138 | 138 | } |
139 | 139 | |
@@ -143,7 +143,7 @@ discard block |
||
143 | 143 | * @since 1.5.2 |
144 | 144 | * @package GeoDirectory |
145 | 145 | */ |
146 | -function geodir_upgrade_152(){ |
|
146 | +function geodir_upgrade_152() { |
|
147 | 147 | gd_fix_address_detail_table_limit(); |
148 | 148 | } |
149 | 149 | |
@@ -641,7 +641,7 @@ discard block |
||
641 | 641 | |
642 | 642 | update_option('gd_theme_compats', $theme_compat); |
643 | 643 | |
644 | - gd_set_theme_compat();// set the compat pack if avail |
|
644 | + gd_set_theme_compat(); // set the compat pack if avail |
|
645 | 645 | } |
646 | 646 | |
647 | 647 | |
@@ -652,7 +652,7 @@ discard block |
||
652 | 652 | * @package GeoDirectory |
653 | 653 | * @global object $wpdb WordPress Database object. |
654 | 654 | */ |
655 | -function gd_convert_virtual_pages(){ |
|
655 | +function gd_convert_virtual_pages() { |
|
656 | 656 | global $wpdb; |
657 | 657 | |
658 | 658 | // Update the add listing page settings |
@@ -663,9 +663,9 @@ discard block |
||
663 | 663 | ) |
664 | 664 | ); |
665 | 665 | |
666 | - if($add_listing_page){ |
|
667 | - wp_update_post( array('ID' => $add_listing_page, 'post_status' => 'publish') ); |
|
668 | - update_option( 'geodir_add_listing_page', $add_listing_page); |
|
666 | + if ($add_listing_page) { |
|
667 | + wp_update_post(array('ID' => $add_listing_page, 'post_status' => 'publish')); |
|
668 | + update_option('geodir_add_listing_page', $add_listing_page); |
|
669 | 669 | } |
670 | 670 | |
671 | 671 | // Update the listing preview page settings |
@@ -676,9 +676,9 @@ discard block |
||
676 | 676 | ) |
677 | 677 | ); |
678 | 678 | |
679 | - if($listing_preview_page){ |
|
680 | - wp_update_post( array('ID' => $listing_preview_page, 'post_status' => 'publish') ); |
|
681 | - update_option( 'geodir_preview_page', $listing_preview_page); |
|
679 | + if ($listing_preview_page) { |
|
680 | + wp_update_post(array('ID' => $listing_preview_page, 'post_status' => 'publish')); |
|
681 | + update_option('geodir_preview_page', $listing_preview_page); |
|
682 | 682 | } |
683 | 683 | |
684 | 684 | // Update the listing success page settings |
@@ -689,9 +689,9 @@ discard block |
||
689 | 689 | ) |
690 | 690 | ); |
691 | 691 | |
692 | - if($listing_success_page){ |
|
693 | - wp_update_post( array('ID' => $listing_success_page, 'post_status' => 'publish') ); |
|
694 | - update_option( 'geodir_success_page', $listing_success_page); |
|
692 | + if ($listing_success_page) { |
|
693 | + wp_update_post(array('ID' => $listing_success_page, 'post_status' => 'publish')); |
|
694 | + update_option('geodir_success_page', $listing_success_page); |
|
695 | 695 | } |
696 | 696 | |
697 | 697 | // Update the listing success page settings |
@@ -702,11 +702,11 @@ discard block |
||
702 | 702 | ) |
703 | 703 | ); |
704 | 704 | |
705 | - if($location_page){ |
|
705 | + if ($location_page) { |
|
706 | 706 | $location_slug = get_option('geodir_location_prefix'); |
707 | - if(!$location_slug ){$location_slug = 'location';} |
|
708 | - wp_update_post( array('ID' => $location_page, 'post_status' => 'publish','post_name' => $location_slug) ); |
|
709 | - update_option( 'geodir_location_page', $location_page); |
|
707 | + if (!$location_slug) {$location_slug = 'location'; } |
|
708 | + wp_update_post(array('ID' => $location_page, 'post_status' => 'publish', 'post_name' => $location_slug)); |
|
709 | + update_option('geodir_location_page', $location_page); |
|
710 | 710 | } |
711 | 711 | |
712 | 712 | } |
@@ -725,13 +725,13 @@ discard block |
||
725 | 725 | $post_types = get_option('geodir_post_types'); |
726 | 726 | |
727 | 727 | |
728 | - if (is_array($post_types)){ |
|
728 | + if (is_array($post_types)) { |
|
729 | 729 | |
730 | 730 | foreach ($post_types as $post_type => $args) { |
731 | 731 | |
732 | 732 | |
733 | - if(isset($args['rewrite']['slug'])){ |
|
734 | - $args['rewrite']['slug'] = str_replace("/%gd_taxonomy%","",$args['rewrite']['slug']); |
|
733 | + if (isset($args['rewrite']['slug'])) { |
|
734 | + $args['rewrite']['slug'] = str_replace("/%gd_taxonomy%", "", $args['rewrite']['slug']); |
|
735 | 735 | } |
736 | 736 | |
737 | 737 | $alt_post_types[$post_type] = $args; |
@@ -739,8 +739,8 @@ discard block |
||
739 | 739 | } |
740 | 740 | } |
741 | 741 | |
742 | - if(!empty($alt_post_types)) { |
|
743 | - update_option('geodir_post_types',$alt_post_types); |
|
742 | + if (!empty($alt_post_types)) { |
|
743 | + update_option('geodir_post_types', $alt_post_types); |
|
744 | 744 | } |
745 | 745 | |
746 | 746 | |
@@ -767,8 +767,8 @@ discard block |
||
767 | 767 | // update each GD CTP |
768 | 768 | try { |
769 | 769 | $wpdb->query("ALTER TABLE " . $wpdb->prefix . "geodir_" . $key . "_detail MODIFY post_city VARCHAR( 50 ) NULL,MODIFY post_region VARCHAR( 50 ) NULL,MODIFY post_country VARCHAR( 50 ) NULL"); |
770 | - } catch(Exception $e) { |
|
771 | - error_log( 'Error: ' . $e->getMessage() ); |
|
770 | + } catch (Exception $e) { |
|
771 | + error_log('Error: ' . $e->getMessage()); |
|
772 | 772 | } |
773 | 773 | } |
774 | 774 | } |