@@ -223,10 +223,11 @@ discard block |
||
223 | 223 | <input type="hidden" id="<?php echo $map_canvas_name;?>_jason_enabled" value="0"/> |
224 | 224 | <?php } |
225 | 225 | |
226 | - if (!$geodir_map_options['enable_text_search'] && !$geodir_map_options['enable_cat_filters']) |
|
227 | - $show_entire_cat_panel = "none"; |
|
228 | - else |
|
229 | - $show_entire_cat_panel = "''"; |
|
226 | + if (!$geodir_map_options['enable_text_search'] && !$geodir_map_options['enable_cat_filters']) { |
|
227 | + $show_entire_cat_panel = "none"; |
|
228 | + } else { |
|
229 | + $show_entire_cat_panel = "''"; |
|
230 | + } |
|
230 | 231 | ?> |
231 | 232 | |
232 | 233 | <?php if ($geodir_map_options['enable_map_direction']) { ?> |
@@ -288,8 +289,9 @@ discard block |
||
288 | 289 | } |
289 | 290 | |
290 | 291 | $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'; |
|
292 | + if (empty($geodir_default_map_search_pt)) { |
|
293 | + $geodir_default_map_search_pt = 'gd_place'; |
|
294 | + } |
|
293 | 295 | |
294 | 296 | /** |
295 | 297 | * Filter the post type to retrive data for map |
@@ -129,12 +129,12 @@ discard block |
||
129 | 129 | |
130 | 130 | if (strpos($geodir_map_options['height'], '%') !== false || strpos($geodir_map_options['height'], 'px') !== false || strpos($geodir_map_options['height'], 'vh') !== false) { |
131 | 131 | } else { |
132 | - $geodir_map_options['height'] = $geodir_map_options['height'] . 'px'; |
|
132 | + $geodir_map_options['height'] = $geodir_map_options['height'].'px'; |
|
133 | 133 | } |
134 | 134 | |
135 | 135 | if (strpos($geodir_map_options['width'], '%') !== false || strpos($geodir_map_options['width'], 'px') !== false) { |
136 | 136 | } else { |
137 | - $geodir_map_options['width'] = $geodir_map_options['width'] . 'px'; |
|
137 | + $geodir_map_options['width'] = $geodir_map_options['width'].'px'; |
|
138 | 138 | } |
139 | 139 | |
140 | 140 | /** |
@@ -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,41 +188,41 @@ 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 | - <div id="<?php echo $map_canvas_name;?>_map_notloaded" |
|
213 | + <div id="<?php echo $map_canvas_name; ?>_map_notloaded" |
|
214 | 214 | class="advmap_notloaded"><?php _e('<h3>Google Map Not Loaded</h3><p>Sorry, unable to load Google Maps API.', 'geodirectory'); ?></div> |
215 | 215 | </div> |
216 | 216 | <!-- new map end --> |
217 | 217 | </div> |
218 | - <div class="<?php echo $map_canvas_name;?>_BottomLeft BottomLeft"></div> |
|
218 | + <div class="<?php echo $map_canvas_name; ?>_BottomLeft BottomLeft"></div> |
|
219 | 219 | </div> |
220 | 220 | </div> |
221 | 221 | <?php if ($geodir_map_options['enable_jason_on_load']) { ?> |
222 | - <input type="hidden" id="<?php echo $map_canvas_name;?>_jason_enabled" value="1"/> |
|
222 | + <input type="hidden" id="<?php echo $map_canvas_name; ?>_jason_enabled" value="1"/> |
|
223 | 223 | <?php } else { |
224 | 224 | ?> |
225 | - <input type="hidden" id="<?php echo $map_canvas_name;?>_jason_enabled" value="0"/> |
|
225 | + <input type="hidden" id="<?php echo $map_canvas_name; ?>_jason_enabled" value="0"/> |
|
226 | 226 | <?php } |
227 | 227 | |
228 | 228 | if (!$geodir_map_options['enable_text_search'] && !$geodir_map_options['enable_cat_filters']) |
@@ -242,7 +242,7 @@ discard block |
||
242 | 242 | onclick="calcRoute('<?php echo $map_canvas_name; ?>')"/> |
243 | 243 | |
244 | 244 | <script> |
245 | - <?php if(geodir_is_page('detail')){?> |
|
245 | + <?php if (geodir_is_page('detail')) {?> |
|
246 | 246 | jQuery(function () { |
247 | 247 | gd_initialize_ac(); |
248 | 248 | }); |
@@ -253,7 +253,7 @@ discard block |
||
253 | 253 | // Create the autocomplete object, restricting the search |
254 | 254 | // to geographical location types. |
255 | 255 | autocomplete = new google.maps.places.Autocomplete( |
256 | - /** @type {HTMLInputElement} */(document.getElementById('<?php echo $map_canvas_name;?>_fromAddress')), |
|
256 | + /** @type {HTMLInputElement} */(document.getElementById('<?php echo $map_canvas_name; ?>_fromAddress')), |
|
257 | 257 | {types: ['geocode']}); |
258 | 258 | // When the user selects an address from the dropdown, |
259 | 259 | // populate the address fields in the form. |
@@ -266,7 +266,7 @@ discard block |
||
266 | 266 | |
267 | 267 | if (window.gdMaps == 'osm') { |
268 | 268 | window.setTimeout(function() { |
269 | - calcRoute('<?php echo $map_canvas_name;?>'); |
|
269 | + calcRoute('<?php echo $map_canvas_name; ?>'); |
|
270 | 270 | }, 1000); |
271 | 271 | } |
272 | 272 | } |
@@ -320,7 +320,7 @@ discard block |
||
320 | 320 | */ |
321 | 321 | $map_search_pt = apply_filters('geodir_default_map_search_pt', $geodir_default_map_search_pt); |
322 | 322 | ?> |
323 | - <div class="map-category-listing-main" style="display:<?php echo $show_entire_cat_panel;?>"> |
|
323 | + <div class="map-category-listing-main" style="display:<?php echo $show_entire_cat_panel; ?>"> |
|
324 | 324 | <?php |
325 | 325 | $exclude_post_types = get_option('geodir_exclude_post_type_on_map'); |
326 | 326 | $geodir_available_pt_on_map = count(geodir_get_posttypes('array')) - count($exclude_post_types); |
@@ -330,12 +330,12 @@ discard block |
||
330 | 330 | } |
331 | 331 | ?> |
332 | 332 | <div |
333 | - class="map-category-listing<?php echo $map_cat_class;?>"> |
|
333 | + class="map-category-listing<?php echo $map_cat_class; ?>"> |
|
334 | 334 | <div class="trigger triggeroff"><i class="fa fa-compress"></i><i class="fa fa-expand"></i></div> |
335 | - <div id="<?php echo $map_canvas_name;?>_cat" |
|
336 | - class="<?php echo $map_canvas_name;?>_map_category map_category" |
|
337 | - <?php if ($child_collapse){ ?>checked="checked" <?php }?> |
|
338 | - style="max-height:<?php echo $geodir_map_options['height'];?>;"> |
|
335 | + <div id="<?php echo $map_canvas_name; ?>_cat" |
|
336 | + class="<?php echo $map_canvas_name; ?>_map_category map_category" |
|
337 | + <?php if ($child_collapse) { ?>checked="checked" <?php }?> |
|
338 | + style="max-height:<?php echo $geodir_map_options['height']; ?>;"> |
|
339 | 339 | <input |
340 | 340 | onkeydown="if(event.keyCode == 13){build_map_ajax_search_param('<?php echo $map_canvas_name; ?>', false)}" |
341 | 341 | type="text" |
@@ -347,11 +347,11 @@ discard block |
||
347 | 347 | <input type="hidden" id="<?php echo $map_canvas_name; ?>_child_collapse" value="1"/> |
348 | 348 | <?php } else {$child_collapse = "0"; |
349 | 349 | ?> |
350 | - <input type="hidden" id="<?php echo $map_canvas_name;?>_child_collapse" value="0"/> |
|
350 | + <input type="hidden" id="<?php echo $map_canvas_name; ?>_child_collapse" value="0"/> |
|
351 | 351 | <?php } ?> |
352 | 352 | <input type="hidden" id="<?php echo $map_canvas_name; ?>_cat_enabled" value="1"/> |
353 | 353 | <div class="toggle"> |
354 | - <?php echo home_map_taxonomy_walker(array($map_search_pt.'category'),0,true,0,$map_canvas_name,$child_collapse,true); ?> |
|
354 | + <?php echo home_map_taxonomy_walker(array($map_search_pt.'category'), 0, true, 0, $map_canvas_name, $child_collapse, true); ?> |
|
355 | 355 | <script>jQuery( document ).ready(function() { |
356 | 356 | geodir_show_sub_cat_collapse_button(); |
357 | 357 | });</script> |
@@ -379,21 +379,21 @@ discard block |
||
379 | 379 | $city = $country != 'me' ? $city : ''; |
380 | 380 | $gd_neighbourhood = isset($_REQUEST['gd_neighbourhood']) ? sanitize_text_field($_REQUEST['gd_neighbourhood']) : ''; |
381 | 381 | ?> |
382 | - <input type="hidden" id="<?php echo $map_canvas_name;?>_location_enabled" value="1"/> |
|
383 | - <input type="hidden" id="<?php echo $map_canvas_name;?>_country" name="gd_country" |
|
384 | - value="<?php echo $country;?>"/> |
|
385 | - <input type="hidden" id="<?php echo $map_canvas_name;?>_region" name="gd_region" |
|
386 | - value="<?php echo $region;?>"/> |
|
387 | - <input type="hidden" id="<?php echo $map_canvas_name;?>_city" name="gd_city" |
|
388 | - value="<?php echo $city;?>"/> |
|
389 | - <input type="hidden" id="<?php echo $map_canvas_name;?>_neighbourhood" name="gd_neighbourhood" |
|
390 | - value="<?php echo $gd_neighbourhood;?>"/> |
|
382 | + <input type="hidden" id="<?php echo $map_canvas_name; ?>_location_enabled" value="1"/> |
|
383 | + <input type="hidden" id="<?php echo $map_canvas_name; ?>_country" name="gd_country" |
|
384 | + value="<?php echo $country; ?>"/> |
|
385 | + <input type="hidden" id="<?php echo $map_canvas_name; ?>_region" name="gd_region" |
|
386 | + value="<?php echo $region; ?>"/> |
|
387 | + <input type="hidden" id="<?php echo $map_canvas_name; ?>_city" name="gd_city" |
|
388 | + value="<?php echo $city; ?>"/> |
|
389 | + <input type="hidden" id="<?php echo $map_canvas_name; ?>_neighbourhood" name="gd_neighbourhood" |
|
390 | + value="<?php echo $gd_neighbourhood; ?>"/> |
|
391 | 391 | <?php } else { //end of location filter |
392 | 392 | ?> |
393 | - <input type="hidden" id="<?php echo $map_canvas_name;?>_location_enabled" value="0"/> |
|
393 | + <input type="hidden" id="<?php echo $map_canvas_name; ?>_location_enabled" value="0"/> |
|
394 | 394 | <?php }?> |
395 | 395 | |
396 | - <input type="hidden" id="<?php echo $map_canvas_name;?>_posttype" name="gd_posttype" value="<?php echo $map_search_pt;?>"/> |
|
396 | + <input type="hidden" id="<?php echo $map_canvas_name; ?>_posttype" name="gd_posttype" value="<?php echo $map_search_pt; ?>"/> |
|
397 | 397 | |
398 | 398 | <input type="hidden" name="limitstart" value=""/> |
399 | 399 | |
@@ -401,10 +401,10 @@ discard block |
||
401 | 401 | |
402 | 402 | <?php if ($geodir_map_options['enable_post_type_filters']) { |
403 | 403 | $post_types = geodir_get_posttypes('object'); |
404 | - if (count((array)($post_types)) > 1) { |
|
404 | + if (count((array) ($post_types)) > 1) { |
|
405 | 405 | ?> |
406 | - <div class="map-places-listing" id="<?php echo $map_canvas_name;?>_posttype_menu" |
|
407 | - style="max-width:<?php echo $map_width;?>!important;"> |
|
406 | + <div class="map-places-listing" id="<?php echo $map_canvas_name; ?>_posttype_menu" |
|
407 | + style="max-width:<?php echo $map_width; ?>!important;"> |
|
408 | 408 | |
409 | 409 | <?php if (isset($geodir_map_options['is_geodir_home_map_widget']) && $map_args['is_geodir_home_map_widget']) { ?> |
410 | 410 | <div class="geodir-map-posttype-list"><?php } ?> |
@@ -415,7 +415,7 @@ discard block |
||
415 | 415 | foreach ($post_types as $post_type => $args) { |
416 | 416 | if (!in_array($post_type, $exclude_post_types)) { |
417 | 417 | $class = $map_search_pt == $post_type ? 'class="gd-map-search-pt"' : ''; |
418 | - 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>'; |
|
418 | + 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>'; |
|
419 | 419 | } |
420 | 420 | } |
421 | 421 | ?> |
@@ -440,9 +440,9 @@ discard block |
||
440 | 440 | <script type="text/javascript"> |
441 | 441 | |
442 | 442 | jQuery(document).ready(function () { |
443 | - //initMap('<?php echo $map_canvas_name;?>'); // depreciated, no need to load this twice |
|
444 | - build_map_ajax_search_param('<?php echo $map_canvas_name;?>', false); |
|
445 | - map_sticky('<?php echo $map_canvas_name;?>'); |
|
443 | + //initMap('<?php echo $map_canvas_name; ?>'); // depreciated, no need to load this twice |
|
444 | + build_map_ajax_search_param('<?php echo $map_canvas_name; ?>', false); |
|
445 | + map_sticky('<?php echo $map_canvas_name; ?>'); |
|
446 | 446 | }); |
447 | 447 | |
448 | 448 | </script> |
@@ -453,18 +453,18 @@ discard block |
||
453 | 453 | <script> |
454 | 454 | (function () { |
455 | 455 | var screenH = jQuery(window).height(); |
456 | - var heightVH = "<?php echo str_replace("vh", "", $geodir_map_options['height']);?>"; |
|
456 | + var heightVH = "<?php echo str_replace("vh", "", $geodir_map_options['height']); ?>"; |
|
457 | 457 | |
458 | 458 | var ptypeH = ''; |
459 | - if (jQuery("#<?php echo $map_canvas_name;?>_posttype_menu").length) { |
|
460 | - ptypeH = jQuery("#<?php echo $map_canvas_name;?>_posttype_menu").outerHeight(); |
|
459 | + if (jQuery("#<?php echo $map_canvas_name; ?>_posttype_menu").length) { |
|
460 | + ptypeH = jQuery("#<?php echo $map_canvas_name; ?>_posttype_menu").outerHeight(); |
|
461 | 461 | } |
462 | 462 | |
463 | - jQuery("#sticky_map_<?php echo $map_canvas_name;?>").css("min-height", screenH * (heightVH / 100) + 'px'); |
|
464 | - jQuery("#<?php echo $map_canvas_name;?>_wrapper").height(screenH * (heightVH / 100) + 'px'); |
|
465 | - jQuery("#<?php echo $map_canvas_name;?>").height(screenH * (heightVH / 100) + 'px'); |
|
466 | - jQuery("#<?php echo $map_canvas_name;?>_loading_div").height(screenH * (heightVH / 100) + 'px'); |
|
467 | - jQuery("#<?php echo $map_canvas_name;?>_cat").css("max-height", (screenH * (heightVH / 100)) - ptypeH + 'px'); |
|
463 | + jQuery("#sticky_map_<?php echo $map_canvas_name; ?>").css("min-height", screenH * (heightVH / 100) + 'px'); |
|
464 | + jQuery("#<?php echo $map_canvas_name; ?>_wrapper").height(screenH * (heightVH / 100) + 'px'); |
|
465 | + jQuery("#<?php echo $map_canvas_name; ?>").height(screenH * (heightVH / 100) + 'px'); |
|
466 | + jQuery("#<?php echo $map_canvas_name; ?>_loading_div").height(screenH * (heightVH / 100) + 'px'); |
|
467 | + jQuery("#<?php echo $map_canvas_name; ?>_cat").css("max-height", (screenH * (heightVH / 100)) - ptypeH + 'px'); |
|
468 | 468 | |
469 | 469 | }()); |
470 | 470 | </script> |
@@ -476,13 +476,13 @@ discard block |
||
476 | 476 | <script> |
477 | 477 | (function () { |
478 | 478 | var screenH = jQuery(window).height(); |
479 | - var heightVH = "<?php echo str_replace("px", "", $geodir_map_options['height']);?>"; |
|
479 | + var heightVH = "<?php echo str_replace("px", "", $geodir_map_options['height']); ?>"; |
|
480 | 480 | var ptypeH = ''; |
481 | - if (jQuery("#<?php echo $map_canvas_name;?>_posttype_menu").length) { |
|
482 | - ptypeH = jQuery("#<?php echo $map_canvas_name;?>_posttype_menu").outerHeight(); |
|
481 | + if (jQuery("#<?php echo $map_canvas_name; ?>_posttype_menu").length) { |
|
482 | + ptypeH = jQuery("#<?php echo $map_canvas_name; ?>_posttype_menu").outerHeight(); |
|
483 | 483 | } |
484 | 484 | |
485 | - jQuery("#<?php echo $map_canvas_name;?>_cat").css("max-height", heightVH - ptypeH + 'px'); |
|
485 | + jQuery("#<?php echo $map_canvas_name; ?>_cat").css("max-height", heightVH - ptypeH + 'px'); |
|
486 | 486 | |
487 | 487 | }()); |
488 | 488 | </script> |
@@ -497,7 +497,7 @@ discard block |
||
497 | 497 | * @param array $geodir_map_options Array of map settings. |
498 | 498 | * @param string $map_canvas_name The canvas name and ID for the map. |
499 | 499 | */ |
500 | - do_action('geodir_map_after_render',$geodir_map_options,$map_canvas_name); |
|
500 | + do_action('geodir_map_after_render', $geodir_map_options, $map_canvas_name); |
|
501 | 501 | |
502 | 502 | |
503 | 503 | endif; // Exclude posttypes if end |
@@ -67,77 +67,77 @@ discard block |
||
67 | 67 | */ |
68 | 68 | function geodir_draw_map($map_args = array()) |
69 | 69 | { |
70 | - global $map_canvas_arr; |
|
71 | - $map_canvas_name = (!empty($map_args) && $map_args['map_canvas_name'] != '') ? $map_args['map_canvas_name'] : 'home_map_canvas'; |
|
72 | - $map_class_name = (!empty($map_args) && isset($map_args['map_class_name'])) ? $map_args['map_class_name'] : ''; |
|
73 | - |
|
74 | - $default_location = geodir_get_default_location(); |
|
75 | - |
|
76 | - $map_default_lat = isset($default_location->city_latitude) ? $default_location->city_latitude : ''; |
|
77 | - $map_default_lng = isset($default_location->city_longitude) ? $default_location->city_longitude : ''; |
|
78 | - $map_default_zoom = 12; |
|
79 | - // map options default values |
|
80 | - $width = 950; |
|
81 | - $height = 450; |
|
82 | - $child_collapse = '0'; |
|
83 | - $sticky = ''; |
|
84 | - $enable_cat_filters = false; |
|
85 | - $enable_text_search = false; |
|
86 | - $enable_post_type_filters = false; |
|
87 | - $enable_location_filters = false; |
|
88 | - $enable_jason_on_load = false; |
|
89 | - $enable_map_direction = false; |
|
90 | - $enable_marker_cluster = false; |
|
91 | - $enable_map_resize_button = false; |
|
92 | - $maptype = 'ROADMAP'; |
|
93 | - |
|
94 | - $geodir_map_options = array( |
|
95 | - 'width' => $width, |
|
96 | - 'height' => $height, |
|
97 | - 'child_collapse' => $child_collapse, |
|
98 | - 'sticky' => $sticky, |
|
99 | - 'enable_map_resize_button' => $enable_map_resize_button, |
|
100 | - 'enable_cat_filters' => $enable_cat_filters, |
|
101 | - 'enable_text_search' => $enable_text_search, |
|
102 | - 'enable_post_type_filters' => $enable_post_type_filters, |
|
103 | - 'enable_location_filters' => $enable_location_filters, |
|
104 | - 'enable_jason_on_load' => $enable_jason_on_load, |
|
105 | - 'enable_map_direction' => $enable_map_direction, |
|
106 | - 'enable_marker_cluster' => $enable_marker_cluster, |
|
107 | - 'ajax_url' => geodir_get_ajax_url(), |
|
108 | - 'map_canvas_name' => $map_canvas_name, |
|
109 | - 'inputText' => __('Title or Keyword', 'geodirectory'), |
|
110 | - 'latitude' => $map_default_lat, |
|
111 | - 'longitude' => $map_default_lng, |
|
112 | - 'zoom' => $map_default_zoom, |
|
113 | - 'scrollwheel' => true, |
|
114 | - 'streetViewControl' => true, |
|
115 | - 'maptype' => $maptype, |
|
116 | - 'showPreview' => '0', |
|
117 | - 'maxZoom' => 21, |
|
118 | - 'autozoom' => true, |
|
119 | - 'bubble_size' => 'small', |
|
120 | - 'token' => '68f48005e256696074e1da9bf9f67f06', |
|
121 | - 'navigationControlOptions' => array('position' => 'TOP_LEFT', 'style' => 'ZOOM_PAN') |
|
122 | - ); |
|
123 | - |
|
124 | - if (!empty($map_args)) { |
|
125 | - foreach ($map_args as $map_option_key => $map_option_value) { |
|
126 | - $geodir_map_options[$map_option_key] = $map_option_value; |
|
127 | - } |
|
128 | - } |
|
129 | - |
|
130 | - if (strpos($geodir_map_options['height'], '%') !== false || strpos($geodir_map_options['height'], 'px') !== false || strpos($geodir_map_options['height'], 'vh') !== false) { |
|
131 | - } else { |
|
132 | - $geodir_map_options['height'] = $geodir_map_options['height'] . 'px'; |
|
133 | - } |
|
134 | - |
|
135 | - if (strpos($geodir_map_options['width'], '%') !== false || strpos($geodir_map_options['width'], 'px') !== false) { |
|
136 | - } else { |
|
137 | - $geodir_map_options['width'] = $geodir_map_options['width'] . 'px'; |
|
138 | - } |
|
139 | - |
|
140 | - /** |
|
70 | + global $map_canvas_arr; |
|
71 | + $map_canvas_name = (!empty($map_args) && $map_args['map_canvas_name'] != '') ? $map_args['map_canvas_name'] : 'home_map_canvas'; |
|
72 | + $map_class_name = (!empty($map_args) && isset($map_args['map_class_name'])) ? $map_args['map_class_name'] : ''; |
|
73 | + |
|
74 | + $default_location = geodir_get_default_location(); |
|
75 | + |
|
76 | + $map_default_lat = isset($default_location->city_latitude) ? $default_location->city_latitude : ''; |
|
77 | + $map_default_lng = isset($default_location->city_longitude) ? $default_location->city_longitude : ''; |
|
78 | + $map_default_zoom = 12; |
|
79 | + // map options default values |
|
80 | + $width = 950; |
|
81 | + $height = 450; |
|
82 | + $child_collapse = '0'; |
|
83 | + $sticky = ''; |
|
84 | + $enable_cat_filters = false; |
|
85 | + $enable_text_search = false; |
|
86 | + $enable_post_type_filters = false; |
|
87 | + $enable_location_filters = false; |
|
88 | + $enable_jason_on_load = false; |
|
89 | + $enable_map_direction = false; |
|
90 | + $enable_marker_cluster = false; |
|
91 | + $enable_map_resize_button = false; |
|
92 | + $maptype = 'ROADMAP'; |
|
93 | + |
|
94 | + $geodir_map_options = array( |
|
95 | + 'width' => $width, |
|
96 | + 'height' => $height, |
|
97 | + 'child_collapse' => $child_collapse, |
|
98 | + 'sticky' => $sticky, |
|
99 | + 'enable_map_resize_button' => $enable_map_resize_button, |
|
100 | + 'enable_cat_filters' => $enable_cat_filters, |
|
101 | + 'enable_text_search' => $enable_text_search, |
|
102 | + 'enable_post_type_filters' => $enable_post_type_filters, |
|
103 | + 'enable_location_filters' => $enable_location_filters, |
|
104 | + 'enable_jason_on_load' => $enable_jason_on_load, |
|
105 | + 'enable_map_direction' => $enable_map_direction, |
|
106 | + 'enable_marker_cluster' => $enable_marker_cluster, |
|
107 | + 'ajax_url' => geodir_get_ajax_url(), |
|
108 | + 'map_canvas_name' => $map_canvas_name, |
|
109 | + 'inputText' => __('Title or Keyword', 'geodirectory'), |
|
110 | + 'latitude' => $map_default_lat, |
|
111 | + 'longitude' => $map_default_lng, |
|
112 | + 'zoom' => $map_default_zoom, |
|
113 | + 'scrollwheel' => true, |
|
114 | + 'streetViewControl' => true, |
|
115 | + 'maptype' => $maptype, |
|
116 | + 'showPreview' => '0', |
|
117 | + 'maxZoom' => 21, |
|
118 | + 'autozoom' => true, |
|
119 | + 'bubble_size' => 'small', |
|
120 | + 'token' => '68f48005e256696074e1da9bf9f67f06', |
|
121 | + 'navigationControlOptions' => array('position' => 'TOP_LEFT', 'style' => 'ZOOM_PAN') |
|
122 | + ); |
|
123 | + |
|
124 | + if (!empty($map_args)) { |
|
125 | + foreach ($map_args as $map_option_key => $map_option_value) { |
|
126 | + $geodir_map_options[$map_option_key] = $map_option_value; |
|
127 | + } |
|
128 | + } |
|
129 | + |
|
130 | + if (strpos($geodir_map_options['height'], '%') !== false || strpos($geodir_map_options['height'], 'px') !== false || strpos($geodir_map_options['height'], 'vh') !== false) { |
|
131 | + } else { |
|
132 | + $geodir_map_options['height'] = $geodir_map_options['height'] . 'px'; |
|
133 | + } |
|
134 | + |
|
135 | + if (strpos($geodir_map_options['width'], '%') !== false || strpos($geodir_map_options['width'], 'px') !== false) { |
|
136 | + } else { |
|
137 | + $geodir_map_options['width'] = $geodir_map_options['width'] . 'px'; |
|
138 | + } |
|
139 | + |
|
140 | + /** |
|
141 | 141 | * Filter the options to use in google map. |
142 | 142 | * |
143 | 143 | * @since 1.0.0 |
@@ -146,9 +146,9 @@ discard block |
||
146 | 146 | */ |
147 | 147 | $geodir_map_options = apply_filters("geodir_map_options_{$map_canvas_name}", $geodir_map_options); |
148 | 148 | |
149 | - $map_canvas_arr[$map_canvas_name] = array(); |
|
149 | + $map_canvas_arr[$map_canvas_name] = array(); |
|
150 | 150 | |
151 | - /** |
|
151 | + /** |
|
152 | 152 | * Filter the post types to display data on map. |
153 | 153 | * |
154 | 154 | * @since 1.0.0 |
@@ -166,20 +166,20 @@ 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)): |
|
170 | - // Set default map options |
|
169 | + if (count((array)$post_types) != count($exclude_post_types) || ($enable_jason_on_load)): |
|
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 | - wp_localize_script('geodir-map-widget', $map_canvas_name, $geodir_map_options); |
|
174 | + wp_localize_script('geodir-map-widget', $map_canvas_name, $geodir_map_options); |
|
175 | 175 | |
176 | - if ($map_canvas_name == 'detail_page_map_canvas' || $map_canvas_name == 'preview_map_canvas') { |
|
177 | - $map_width = '100%'; |
|
178 | - } else { |
|
179 | - $map_width = $geodir_map_options['width']; |
|
180 | - } |
|
176 | + if ($map_canvas_name == 'detail_page_map_canvas' || $map_canvas_name == 'preview_map_canvas') { |
|
177 | + $map_width = '100%'; |
|
178 | + } else { |
|
179 | + $map_width = $geodir_map_options['width']; |
|
180 | + } |
|
181 | 181 | |
182 | - /** |
|
182 | + /** |
|
183 | 183 | * Filter the width of map. |
184 | 184 | * |
185 | 185 | * @since 1.0.0 |
@@ -187,7 +187,7 @@ discard block |
||
187 | 187 | * @param int $map_width Width of map box, eg: gd_place. |
188 | 188 | */ |
189 | 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"> |
193 | 193 | <div class="trigger_sticky triggeroff_sticky"></div> |
@@ -221,15 +221,15 @@ discard block |
||
221 | 221 | <?php if ($geodir_map_options['enable_jason_on_load']) { ?> |
222 | 222 | <input type="hidden" id="<?php echo $map_canvas_name;?>_jason_enabled" value="1"/> |
223 | 223 | <?php } else { |
224 | - ?> |
|
224 | + ?> |
|
225 | 225 | <input type="hidden" id="<?php echo $map_canvas_name;?>_jason_enabled" value="0"/> |
226 | 226 | <?php } |
227 | 227 | |
228 | - if (!$geodir_map_options['enable_text_search'] && !$geodir_map_options['enable_cat_filters']) |
|
229 | - $show_entire_cat_panel = "none"; |
|
230 | - else |
|
231 | - $show_entire_cat_panel = "''"; |
|
232 | - ?> |
|
228 | + if (!$geodir_map_options['enable_text_search'] && !$geodir_map_options['enable_cat_filters']) |
|
229 | + $show_entire_cat_panel = "none"; |
|
230 | + else |
|
231 | + $show_entire_cat_panel = "''"; |
|
232 | + ?> |
|
233 | 233 | |
234 | 234 | <?php if ($geodir_map_options['enable_map_direction']) { ?> |
235 | 235 | |
@@ -291,8 +291,8 @@ discard block |
||
291 | 291 | <select id="travel-units" onchange="calcRoute('<?php echo $map_canvas_name; ?>')"> |
292 | 292 | <option value="miles"><?php _e('Miles', 'geodirectory'); ?></option> |
293 | 293 | <option <?php if (get_option('geodir_search_dist_1') == 'km') { |
294 | - echo 'selected="selected"'; |
|
295 | - } ?> value="kilometers"><?php _e('Kilometers', 'geodirectory'); ?></option> |
|
294 | + echo 'selected="selected"'; |
|
295 | + } ?> value="kilometers"><?php _e('Kilometers', 'geodirectory'); ?></option> |
|
296 | 296 | </select> |
297 | 297 | </div> |
298 | 298 | |
@@ -304,12 +304,12 @@ discard block |
||
304 | 304 | if (empty($geodir_default_map_search_pt)) |
305 | 305 | $geodir_default_map_search_pt = 'gd_place'; |
306 | 306 | |
307 | - global $gd_session; |
|
308 | - $homemap_catlist_ptype = $gd_session->get('homemap_catlist_ptype'); |
|
307 | + global $gd_session; |
|
308 | + $homemap_catlist_ptype = $gd_session->get('homemap_catlist_ptype'); |
|
309 | 309 | |
310 | - if ($homemap_catlist_ptype) { |
|
311 | - $geodir_default_map_search_pt = $homemap_catlist_ptype; |
|
312 | - } |
|
310 | + if ($homemap_catlist_ptype) { |
|
311 | + $geodir_default_map_search_pt = $homemap_catlist_ptype; |
|
312 | + } |
|
313 | 313 | |
314 | 314 | /** |
315 | 315 | * Filter the post type to retrieve data for map |
@@ -322,13 +322,13 @@ discard block |
||
322 | 322 | ?> |
323 | 323 | <div class="map-category-listing-main" style="display:<?php echo $show_entire_cat_panel;?>"> |
324 | 324 | <?php |
325 | - $exclude_post_types = get_option('geodir_exclude_post_type_on_map'); |
|
326 | - $geodir_available_pt_on_map = count(geodir_get_posttypes('array')) - count($exclude_post_types); |
|
325 | + $exclude_post_types = get_option('geodir_exclude_post_type_on_map'); |
|
326 | + $geodir_available_pt_on_map = count(geodir_get_posttypes('array')) - count($exclude_post_types); |
|
327 | 327 | $map_cat_class = ''; |
328 | 328 | if ($geodir_map_options['enable_post_type_filters']) { |
329 | 329 | $map_cat_class = $geodir_available_pt_on_map > 1 ? ' map-cat-ptypes' : ' map-cat-floor'; |
330 | 330 | } |
331 | - ?> |
|
331 | + ?> |
|
332 | 332 | <div |
333 | 333 | class="map-category-listing<?php echo $map_cat_class;?>"> |
334 | 334 | <div class="trigger triggeroff"><i class="fa fa-compress"></i><i class="fa fa-expand"></i></div> |
@@ -346,7 +346,7 @@ discard block |
||
346 | 346 | <?php if ($geodir_map_options['child_collapse']) { $child_collapse = "1"; ?> |
347 | 347 | <input type="hidden" id="<?php echo $map_canvas_name; ?>_child_collapse" value="1"/> |
348 | 348 | <?php } else {$child_collapse = "0"; |
349 | - ?> |
|
349 | + ?> |
|
350 | 350 | <input type="hidden" id="<?php echo $map_canvas_name;?>_child_collapse" value="0"/> |
351 | 351 | <?php } ?> |
352 | 352 | <input type="hidden" id="<?php echo $map_canvas_name; ?>_cat_enabled" value="1"/> |
@@ -368,17 +368,17 @@ discard block |
||
368 | 368 | <!-- map-category-listings--> |
369 | 369 | |
370 | 370 | <?php |
371 | - if ($geodir_map_options['enable_location_filters']) { |
|
371 | + if ($geodir_map_options['enable_location_filters']) { |
|
372 | 372 | $country = get_query_var('gd_country'); |
373 | 373 | $region = get_query_var('gd_region'); |
374 | 374 | $city = get_query_var('gd_city'); |
375 | 375 | |
376 | - //fix for location/me page |
|
377 | - $country = $country != 'me' ? $country : ''; |
|
376 | + //fix for location/me page |
|
377 | + $country = $country != 'me' ? $country : ''; |
|
378 | 378 | $region = $region != 'me' ? $region : ''; |
379 | 379 | $city = $country != 'me' ? $city : ''; |
380 | - $gd_neighbourhood = isset($_REQUEST['gd_neighbourhood']) ? sanitize_text_field($_REQUEST['gd_neighbourhood']) : ''; |
|
381 | - ?> |
|
380 | + $gd_neighbourhood = isset($_REQUEST['gd_neighbourhood']) ? sanitize_text_field($_REQUEST['gd_neighbourhood']) : ''; |
|
381 | + ?> |
|
382 | 382 | <input type="hidden" id="<?php echo $map_canvas_name;?>_location_enabled" value="1"/> |
383 | 383 | <input type="hidden" id="<?php echo $map_canvas_name;?>_country" name="gd_country" |
384 | 384 | value="<?php echo $country;?>"/> |
@@ -389,7 +389,7 @@ discard block |
||
389 | 389 | <input type="hidden" id="<?php echo $map_canvas_name;?>_neighbourhood" name="gd_neighbourhood" |
390 | 390 | value="<?php echo $gd_neighbourhood;?>"/> |
391 | 391 | <?php } else { //end of location filter |
392 | - ?> |
|
392 | + ?> |
|
393 | 393 | <input type="hidden" id="<?php echo $map_canvas_name;?>_location_enabled" value="0"/> |
394 | 394 | <?php }?> |
395 | 395 | |
@@ -400,9 +400,9 @@ discard block |
||
400 | 400 | |
401 | 401 | |
402 | 402 | <?php if ($geodir_map_options['enable_post_type_filters']) { |
403 | - $post_types = geodir_get_posttypes('object'); |
|
404 | - if (count((array)($post_types)) > 1) { |
|
405 | - ?> |
|
403 | + $post_types = geodir_get_posttypes('object'); |
|
404 | + if (count((array)($post_types)) > 1) { |
|
405 | + ?> |
|
406 | 406 | <div class="map-places-listing" id="<?php echo $map_canvas_name;?>_posttype_menu" |
407 | 407 | style="max-width:<?php echo $map_width;?>!important;"> |
408 | 408 | |
@@ -410,15 +410,15 @@ discard block |
||
410 | 410 | <div class="geodir-map-posttype-list"><?php } ?> |
411 | 411 | <ul class="clearfix place-list"> |
412 | 412 | <?php |
413 | - $exclude_post_types = get_option('geodir_exclude_post_type_on_map'); |
|
413 | + $exclude_post_types = get_option('geodir_exclude_post_type_on_map'); |
|
414 | 414 | |
415 | - foreach ($post_types as $post_type => $args) { |
|
416 | - if (!in_array($post_type, $exclude_post_types)) { |
|
417 | - $class = $map_search_pt == $post_type ? 'class="gd-map-search-pt"' : ''; |
|
415 | + foreach ($post_types as $post_type => $args) { |
|
416 | + if (!in_array($post_type, $exclude_post_types)) { |
|
417 | + $class = $map_search_pt == $post_type ? 'class="gd-map-search-pt"' : ''; |
|
418 | 418 | 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>'; |
419 | - } |
|
420 | - } |
|
421 | - ?> |
|
419 | + } |
|
420 | + } |
|
421 | + ?> |
|
422 | 422 | </ul> |
423 | 423 | <?php if (isset($geodir_map_options['is_geodir_home_map_widget']) && $map_args['is_geodir_home_map_widget']) { ?> |
424 | 424 | </div><?php } ?> |
@@ -432,8 +432,8 @@ discard block |
||
432 | 432 | |
433 | 433 | </div> <!-- map-places-listings--> |
434 | 434 | <?php } |
435 | - } // end of post type filter if |
|
436 | - ?> |
|
435 | + } // end of post type filter if |
|
436 | + ?> |
|
437 | 437 | |
438 | 438 | </div> |
439 | 439 | </div> <!--end of stick trigger container--> |
@@ -448,8 +448,8 @@ discard block |
||
448 | 448 | </script> |
449 | 449 | <?php |
450 | 450 | |
451 | - if (strpos($geodir_map_options['height'], 'vh')) { |
|
452 | - ?> |
|
451 | + if (strpos($geodir_map_options['height'], 'vh')) { |
|
452 | + ?> |
|
453 | 453 | <script> |
454 | 454 | (function () { |
455 | 455 | var screenH = jQuery(window).height(); |
@@ -471,8 +471,8 @@ discard block |
||
471 | 471 | |
472 | 472 | <?php |
473 | 473 | |
474 | - } elseif (strpos($geodir_map_options['height'], 'px')) { |
|
475 | - ?> |
|
474 | + } elseif (strpos($geodir_map_options['height'], 'px')) { |
|
475 | + ?> |
|
476 | 476 | <script> |
477 | 477 | (function () { |
478 | 478 | var screenH = jQuery(window).height(); |
@@ -487,20 +487,20 @@ discard block |
||
487 | 487 | }()); |
488 | 488 | </script> |
489 | 489 | <?php |
490 | - } |
|
490 | + } |
|
491 | 491 | |
492 | - /** |
|
493 | - * Action that runs after all the map code has been output; |
|
494 | - * |
|
495 | - * @since 1.5.3 |
|
496 | - * |
|
497 | - * @param array $geodir_map_options Array of map settings. |
|
498 | - * @param string $map_canvas_name The canvas name and ID for the map. |
|
499 | - */ |
|
500 | - do_action('geodir_map_after_render',$geodir_map_options,$map_canvas_name); |
|
492 | + /** |
|
493 | + * Action that runs after all the map code has been output; |
|
494 | + * |
|
495 | + * @since 1.5.3 |
|
496 | + * |
|
497 | + * @param array $geodir_map_options Array of map settings. |
|
498 | + * @param string $map_canvas_name The canvas name and ID for the map. |
|
499 | + */ |
|
500 | + do_action('geodir_map_after_render',$geodir_map_options,$map_canvas_name); |
|
501 | 501 | |
502 | 502 | |
503 | - endif; // Exclude posttypes if end |
|
503 | + endif; // Exclude posttypes if end |
|
504 | 504 | } |
505 | 505 | |
506 | 506 | /** |
@@ -16,8 +16,9 @@ |
||
16 | 16 | * the visitor has not yet entered the password we will |
17 | 17 | * return early without loading the comments. |
18 | 18 | */ |
19 | -if (post_password_required()) |
|
20 | - return; |
|
19 | +if (post_password_required()) { |
|
20 | + return; |
|
21 | +} |
|
21 | 22 | ?> |
22 | 23 | |
23 | 24 | <div id="comments" class="comments-area"> |
@@ -17,7 +17,7 @@ discard block |
||
17 | 17 | * return early without loading the comments. |
18 | 18 | */ |
19 | 19 | if (post_password_required()) |
20 | - return; |
|
20 | + return; |
|
21 | 21 | ?> |
22 | 22 | |
23 | 23 | <div id="comments" class="comments-area"> |
@@ -25,35 +25,35 @@ discard block |
||
25 | 25 | <?php // You can start editing here -- including this comment! ?> |
26 | 26 | |
27 | 27 | <?php |
28 | - /** |
|
29 | - * Called before displaying reviews. |
|
30 | - * |
|
31 | - * If you would like to wrap reviews inside a div this is the place to print your open div. @see geodir_before_review_form to print your closing div. |
|
32 | - * |
|
33 | - * @since 1.5.7 |
|
34 | - */ |
|
35 | - do_action('geodir_before_review_list'); ?> |
|
28 | + /** |
|
29 | + * Called before displaying reviews. |
|
30 | + * |
|
31 | + * If you would like to wrap reviews inside a div this is the place to print your open div. @see geodir_before_review_form to print your closing div. |
|
32 | + * |
|
33 | + * @since 1.5.7 |
|
34 | + */ |
|
35 | + do_action('geodir_before_review_list'); ?> |
|
36 | 36 | |
37 | 37 | <?php if (have_comments()) : ?> |
38 | 38 | <h2 class="comments-title"> |
39 | 39 | <?php |
40 | - printf(_n('1 Review <span class="r-title-on">on</span> <span class="r-title">“%2$s”</span>', '%1$s Reviews <span>on</span> <span class="r-title"> “%2$s”</span>', get_comments_number(), 'geodirectory'), |
|
41 | - number_format_i18n(get_comments_number()), get_the_title()); |
|
42 | - ?> |
|
40 | + printf(_n('1 Review <span class="r-title-on">on</span> <span class="r-title">“%2$s”</span>', '%1$s Reviews <span>on</span> <span class="r-title"> “%2$s”</span>', get_comments_number(), 'geodirectory'), |
|
41 | + number_format_i18n(get_comments_number()), get_the_title()); |
|
42 | + ?> |
|
43 | 43 | </h2> |
44 | 44 | |
45 | 45 | <?php |
46 | - /** |
|
47 | - * Called after displaying review listing title. |
|
48 | - * |
|
49 | - * @since 1.5.7 |
|
50 | - */ |
|
51 | - do_action('geodir_after_review_list_title'); ?> |
|
46 | + /** |
|
47 | + * Called after displaying review listing title. |
|
48 | + * |
|
49 | + * @since 1.5.7 |
|
50 | + */ |
|
51 | + do_action('geodir_after_review_list_title'); ?> |
|
52 | 52 | |
53 | 53 | <ol class="commentlist"> |
54 | 54 | <?php $reverse_top_level = is_plugin_active('geodir_review_rating_manager/geodir_review_rating_manager.php') ? false : null; ?> |
55 | 55 | <?php wp_list_comments(array('callback' => 'geodir_comment', 'reverse_top_level' => $reverse_top_level, 'style' => 'ol')); |
56 | - ?> |
|
56 | + ?> |
|
57 | 57 | </ol><!-- .commentlist --> |
58 | 58 | |
59 | 59 | <?php if (get_comment_pages_count() > 1 && get_option('page_comments')) : // are there comments to navigate through ?> |
@@ -68,51 +68,51 @@ discard block |
||
68 | 68 | <?php endif; // check for comment navigation ?> |
69 | 69 | |
70 | 70 | <?php |
71 | - /* If there are no comments and comments are closed, let's leave a note. |
|
71 | + /* If there are no comments and comments are closed, let's leave a note. |
|
72 | 72 | * But we only want the note on posts and pages that had comments in the first place. |
73 | 73 | */ |
74 | - if (!comments_open() && get_comments_number()) : ?> |
|
74 | + if (!comments_open() && get_comments_number()) : ?> |
|
75 | 75 | <p class="nocomments"><?php _e('Reviews are closed.', 'geodirectory'); ?></p> |
76 | 76 | <?php endif; ?> |
77 | 77 | |
78 | 78 | <?php endif; // have_comments() ?> |
79 | 79 | |
80 | 80 | <?php |
81 | - /** |
|
82 | - * Called before displaying "Leave a review form". |
|
83 | - * |
|
84 | - * If you would like to wrap "review form" inside a div this is the best place to hook your open div. @see geodir_after_review_form to print your closing div. |
|
85 | - * Also If you would like to wrap "reviews" inside a div this is the best place to print your closing div. @see geodir_before_review_list to print your open div. |
|
86 | - * |
|
87 | - * @since 1.5.7 |
|
88 | - */ |
|
89 | - do_action('geodir_before_review_form'); ?> |
|
81 | + /** |
|
82 | + * Called before displaying "Leave a review form". |
|
83 | + * |
|
84 | + * If you would like to wrap "review form" inside a div this is the best place to hook your open div. @see geodir_after_review_form to print your closing div. |
|
85 | + * Also If you would like to wrap "reviews" inside a div this is the best place to print your closing div. @see geodir_before_review_list to print your open div. |
|
86 | + * |
|
87 | + * @since 1.5.7 |
|
88 | + */ |
|
89 | + do_action('geodir_before_review_form'); ?> |
|
90 | 90 | |
91 | 91 | <?php |
92 | - /** |
|
93 | - * Filters comment form args |
|
94 | - * |
|
95 | - * If you would like to modify your comment form args, use this filter. @see https://codex.wordpress.org/Function_Reference/comment_form for accepted args. |
|
96 | - * |
|
97 | - * @since 1.0.0 |
|
98 | - */ |
|
99 | - $args = apply_filters('geodir_review_form_args', array( |
|
100 | - 'title_reply' => __('Leave a Review', 'geodirectory'), |
|
101 | - 'label_submit' => __('Post Review', 'geodirectory'), |
|
102 | - 'comment_field' => '<p class="comment-form-comment"><label for="comment">' . __('Review text', 'geodirectory') . '</label><textarea id="comment" name="comment" cols="45" rows="8" aria-required="true"></textarea></p>', |
|
103 | - 'must_log_in' => '<p class="must-log-in">' . sprintf(__('You must be <a href="%s">logged in</a> to post a comment.', 'geodirectory'), geodir_login_url()) . '</p>' |
|
104 | - )); |
|
105 | - comment_form($args); |
|
106 | - ?> |
|
92 | + /** |
|
93 | + * Filters comment form args |
|
94 | + * |
|
95 | + * If you would like to modify your comment form args, use this filter. @see https://codex.wordpress.org/Function_Reference/comment_form for accepted args. |
|
96 | + * |
|
97 | + * @since 1.0.0 |
|
98 | + */ |
|
99 | + $args = apply_filters('geodir_review_form_args', array( |
|
100 | + 'title_reply' => __('Leave a Review', 'geodirectory'), |
|
101 | + 'label_submit' => __('Post Review', 'geodirectory'), |
|
102 | + 'comment_field' => '<p class="comment-form-comment"><label for="comment">' . __('Review text', 'geodirectory') . '</label><textarea id="comment" name="comment" cols="45" rows="8" aria-required="true"></textarea></p>', |
|
103 | + 'must_log_in' => '<p class="must-log-in">' . sprintf(__('You must be <a href="%s">logged in</a> to post a comment.', 'geodirectory'), geodir_login_url()) . '</p>' |
|
104 | + )); |
|
105 | + comment_form($args); |
|
106 | + ?> |
|
107 | 107 | |
108 | 108 | <?php |
109 | - /** |
|
110 | - * Called after displaying "Leave a review form". |
|
111 | - * |
|
112 | - * If you would like to wrap "review form" inside a div this is the best place to print your closing div. @see geodir_before_review_form to print your open div. |
|
113 | - * |
|
114 | - * @since 1.5.7 |
|
115 | - */ |
|
116 | - do_action('geodir_after_review_form'); ?> |
|
109 | + /** |
|
110 | + * Called after displaying "Leave a review form". |
|
111 | + * |
|
112 | + * If you would like to wrap "review form" inside a div this is the best place to print your closing div. @see geodir_before_review_form to print your open div. |
|
113 | + * |
|
114 | + * @since 1.5.7 |
|
115 | + */ |
|
116 | + do_action('geodir_after_review_form'); ?> |
|
117 | 117 | |
118 | 118 | </div><!-- #comments .comments-area --> |
119 | 119 | \ No newline at end of file |
@@ -99,8 +99,8 @@ |
||
99 | 99 | $args = apply_filters('geodir_review_form_args', array( |
100 | 100 | 'title_reply' => __('Leave a Review', 'geodirectory'), |
101 | 101 | 'label_submit' => __('Post Review', 'geodirectory'), |
102 | - 'comment_field' => '<p class="comment-form-comment"><label for="comment">' . __('Review text', 'geodirectory') . '</label><textarea id="comment" name="comment" cols="45" rows="8" aria-required="true"></textarea></p>', |
|
103 | - 'must_log_in' => '<p class="must-log-in">' . sprintf(__('You must be <a href="%s">logged in</a> to post a comment.', 'geodirectory'), geodir_login_url()) . '</p>' |
|
102 | + 'comment_field' => '<p class="comment-form-comment"><label for="comment">'.__('Review text', 'geodirectory').'</label><textarea id="comment" name="comment" cols="45" rows="8" aria-required="true"></textarea></p>', |
|
103 | + 'must_log_in' => '<p class="must-log-in">'.sprintf(__('You must be <a href="%s">logged in</a> to post a comment.', 'geodirectory'), geodir_login_url()).'</p>' |
|
104 | 104 | )); |
105 | 105 | comment_form($args); |
106 | 106 | ?> |
@@ -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 | * Return the current cache expire setting. |
@@ -36,10 +36,10 @@ discard block |
||
36 | 36 | * |
37 | 37 | * @param string $data |
38 | 38 | */ |
39 | -function wp_session_decode( $data ) { |
|
39 | +function wp_session_decode($data) { |
|
40 | 40 | $wp_session = WP_Session::get_instance(); |
41 | 41 | |
42 | - return $wp_session->json_in( $data ); |
|
42 | + return $wp_session->json_in($data); |
|
43 | 43 | } |
44 | 44 | |
45 | 45 | /** |
@@ -60,10 +60,10 @@ discard block |
||
60 | 60 | * |
61 | 61 | * @return bool |
62 | 62 | */ |
63 | -function wp_session_regenerate_id( $delete_old_session = false ) { |
|
63 | +function wp_session_regenerate_id($delete_old_session = false) { |
|
64 | 64 | $wp_session = WP_Session::get_instance(); |
65 | 65 | |
66 | - $wp_session->regenerate_id( $delete_old_session ); |
|
66 | + $wp_session->regenerate_id($delete_old_session); |
|
67 | 67 | |
68 | 68 | return true; |
69 | 69 | } |
@@ -77,11 +77,11 @@ discard block |
||
77 | 77 | */ |
78 | 78 | function wp_session_start() { |
79 | 79 | $wp_session = WP_Session::get_instance(); |
80 | - do_action( 'wp_session_start' ); |
|
80 | + do_action('wp_session_start'); |
|
81 | 81 | |
82 | 82 | return $wp_session->session_started(); |
83 | 83 | } |
84 | -add_action( 'plugins_loaded', 'wp_session_start' ); |
|
84 | +add_action('plugins_loaded', 'wp_session_start'); |
|
85 | 85 | |
86 | 86 | /** |
87 | 87 | * Return the current session status. |
@@ -91,7 +91,7 @@ discard block |
||
91 | 91 | function wp_session_status() { |
92 | 92 | $wp_session = WP_Session::get_instance(); |
93 | 93 | |
94 | - if ( $wp_session->session_started() ) { |
|
94 | + if ($wp_session->session_started()) { |
|
95 | 95 | return PHP_SESSION_ACTIVE; |
96 | 96 | } |
97 | 97 | |
@@ -114,9 +114,9 @@ discard block |
||
114 | 114 | $wp_session = WP_Session::get_instance(); |
115 | 115 | |
116 | 116 | $wp_session->write_data(); |
117 | - do_action( 'wp_session_commit' ); |
|
117 | + do_action('wp_session_commit'); |
|
118 | 118 | } |
119 | -add_action( 'shutdown', 'wp_session_write_close' ); |
|
119 | +add_action('shutdown', 'wp_session_write_close'); |
|
120 | 120 | |
121 | 121 | /** |
122 | 122 | * Clean up expired sessions by removing data and their expiration entries from |
@@ -128,51 +128,51 @@ discard block |
||
128 | 128 | function wp_session_cleanup() { |
129 | 129 | global $wpdb; |
130 | 130 | |
131 | - if ( defined( 'WP_SETUP_CONFIG' ) ) { |
|
131 | + if (defined('WP_SETUP_CONFIG')) { |
|
132 | 132 | return; |
133 | 133 | } |
134 | 134 | |
135 | - if ( ! defined( 'WP_INSTALLING' ) ) { |
|
136 | - $expiration_keys = $wpdb->get_results( "SELECT option_name, option_value FROM $wpdb->options WHERE option_name LIKE '_wp_session_expires_%'" ); |
|
135 | + if (!defined('WP_INSTALLING')) { |
|
136 | + $expiration_keys = $wpdb->get_results("SELECT option_name, option_value FROM $wpdb->options WHERE option_name LIKE '_wp_session_expires_%'"); |
|
137 | 137 | |
138 | - $now = current_time( 'timestamp' ); |
|
138 | + $now = current_time('timestamp'); |
|
139 | 139 | $expired_sessions = array(); |
140 | 140 | |
141 | - foreach( $expiration_keys as $expiration ) { |
|
141 | + foreach ($expiration_keys as $expiration) { |
|
142 | 142 | |
143 | 143 | // If the session has expired |
144 | - if ( $now > intval( $expiration->option_value ) ) { |
|
144 | + if ($now > intval($expiration->option_value)) { |
|
145 | 145 | |
146 | 146 | // Get the session ID by parsing the option_name |
147 | - $session_id = substr( $expiration->option_name, 20 ); |
|
147 | + $session_id = substr($expiration->option_name, 20); |
|
148 | 148 | |
149 | - if( (int) -1 === (int) $session_id || ! preg_match( '/^[a-f0-9]{32}$/', $session_id ) ) { |
|
149 | + if ((int) -1 === (int) $session_id || !preg_match('/^[a-f0-9]{32}$/', $session_id)) { |
|
150 | 150 | continue; |
151 | 151 | } |
152 | 152 | |
153 | 153 | $expired_sessions[] = $expiration->option_name; |
154 | - $expired_sessions[] = esc_sql( "_wp_session_$session_id" ); |
|
154 | + $expired_sessions[] = esc_sql("_wp_session_$session_id"); |
|
155 | 155 | } |
156 | 156 | } |
157 | 157 | |
158 | 158 | // Delete all expired sessions in a single query |
159 | - if ( ! empty( $expired_sessions ) ) { |
|
160 | - $option_names = implode( "','", $expired_sessions ); |
|
161 | - $wpdb->query( "DELETE FROM $wpdb->options WHERE option_name IN ('$option_names')" ); |
|
159 | + if (!empty($expired_sessions)) { |
|
160 | + $option_names = implode("','", $expired_sessions); |
|
161 | + $wpdb->query("DELETE FROM $wpdb->options WHERE option_name IN ('$option_names')"); |
|
162 | 162 | } |
163 | 163 | } |
164 | 164 | |
165 | 165 | // Allow other plugins to hook in to the garbage collection process. |
166 | - do_action( 'wp_session_cleanup' ); |
|
166 | + do_action('wp_session_cleanup'); |
|
167 | 167 | } |
168 | -add_action( 'wp_session_garbage_collection', 'wp_session_cleanup' ); |
|
168 | +add_action('wp_session_garbage_collection', 'wp_session_cleanup'); |
|
169 | 169 | |
170 | 170 | /** |
171 | 171 | * Register the garbage collector as a twice daily event. |
172 | 172 | */ |
173 | 173 | function wp_session_register_garbage_collection() { |
174 | - if ( ! wp_next_scheduled( 'wp_session_garbage_collection' ) ) { |
|
175 | - wp_schedule_event( current_time( 'timestamp' ), 'twicedaily', 'wp_session_garbage_collection' ); |
|
174 | + if (!wp_next_scheduled('wp_session_garbage_collection')) { |
|
175 | + wp_schedule_event(current_time('timestamp'), 'twicedaily', 'wp_session_garbage_collection'); |
|
176 | 176 | } |
177 | 177 | } |
178 | -add_action( 'wp', 'wp_session_register_garbage_collection' ); |
|
178 | +add_action('wp', 'wp_session_register_garbage_collection'); |
@@ -11,7 +11,9 @@ |
||
11 | 11 | */ |
12 | 12 | |
13 | 13 | // Exit if accessed directly |
14 | -if ( ! defined( 'ABSPATH' ) ) exit; |
|
14 | +if ( ! defined( 'ABSPATH' ) ) { |
|
15 | + exit; |
|
16 | +} |
|
15 | 17 | |
16 | 18 | /** |
17 | 19 | * Return the current cache expire setting. |
@@ -54,8 +54,9 @@ |
||
54 | 54 | echo "<p class=\"error_msg\"> " . INVALID_USER_PW_MSG . " </p>"; |
55 | 55 | } |
56 | 56 | |
57 | - if (isset($_REQUEST['checkemail']) && $_REQUEST['checkemail'] == 'confirm') |
|
58 | - echo '<p class="sucess_msg">' . PW_SEND_CONFIRM_MSG . '</p>'; |
|
57 | + if (isset($_REQUEST['checkemail']) && $_REQUEST['checkemail'] == 'confirm') { |
|
58 | + echo '<p class="sucess_msg">' . PW_SEND_CONFIRM_MSG . '</p>'; |
|
59 | + } |
|
59 | 60 | |
60 | 61 | ?> |
61 | 62 | <form name="cus_loginform" id="cus_loginform" action="<?php echo esc_url(geodir_curPageURL()); ?>" |
@@ -49,13 +49,13 @@ |
||
49 | 49 | </h4> |
50 | 50 | <?php |
51 | 51 | if (isset($_REQUEST['emsg']) && $_REQUEST['emsg'] == 'fw') { |
52 | - echo "<p class=\"error_msg\"> " . INVALID_USER_FPW_MSG . " </p>"; |
|
52 | + echo "<p class=\"error_msg\"> ".INVALID_USER_FPW_MSG." </p>"; |
|
53 | 53 | } elseif (isset($_REQUEST['logemsg']) && $_REQUEST['logemsg'] == 1) { |
54 | - echo "<p class=\"error_msg\"> " . INVALID_USER_PW_MSG . " </p>"; |
|
54 | + echo "<p class=\"error_msg\"> ".INVALID_USER_PW_MSG." </p>"; |
|
55 | 55 | } |
56 | 56 | |
57 | 57 | if (isset($_REQUEST['checkemail']) && $_REQUEST['checkemail'] == 'confirm') |
58 | - echo '<p class="sucess_msg">' . PW_SEND_CONFIRM_MSG . '</p>'; |
|
58 | + echo '<p class="sucess_msg">'.PW_SEND_CONFIRM_MSG.'</p>'; |
|
59 | 59 | |
60 | 60 | ?> |
61 | 61 | <form name="cus_loginform" id="cus_loginform" action="<?php echo esc_url(geodir_curPageURL()); ?>" |
@@ -10,13 +10,13 @@ discard block |
||
10 | 10 | */ |
11 | 11 | |
12 | 12 | if (isset($_GET['redirect_to']) && $_GET['redirect_to'] != '') { |
13 | - $redirect_to = $_GET['redirect_to']; |
|
13 | + $redirect_to = $_GET['redirect_to']; |
|
14 | 14 | } else { |
15 | - //echo $_SERVER['HTTP_HOST'] ; |
|
16 | - $redirect_to = isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : ''; |
|
17 | - if (strpos($redirect_to, $_SERVER['HTTP_HOST']) === false) { |
|
18 | - $redirect_to = home_url(); |
|
19 | - } |
|
15 | + //echo $_SERVER['HTTP_HOST'] ; |
|
16 | + $redirect_to = isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : ''; |
|
17 | + if (strpos($redirect_to, $_SERVER['HTTP_HOST']) === false) { |
|
18 | + $redirect_to = home_url(); |
|
19 | + } |
|
20 | 20 | |
21 | 21 | } |
22 | 22 | |
@@ -38,37 +38,37 @@ discard block |
||
38 | 38 | <h4> |
39 | 39 | <?php |
40 | 40 | |
41 | - /** |
|
42 | - * Filter the `SIGN_IN_PAGE_TITLE` title text on login form template. |
|
43 | - * |
|
44 | - * @since 1.0.0 |
|
45 | - */ |
|
46 | - echo apply_filters('geodir_login_page_title', SIGN_IN_PAGE_TITLE); |
|
41 | + /** |
|
42 | + * Filter the `SIGN_IN_PAGE_TITLE` title text on login form template. |
|
43 | + * |
|
44 | + * @since 1.0.0 |
|
45 | + */ |
|
46 | + echo apply_filters('geodir_login_page_title', SIGN_IN_PAGE_TITLE); |
|
47 | 47 | |
48 | - ?> |
|
48 | + ?> |
|
49 | 49 | </h4> |
50 | 50 | <?php |
51 | - if (isset($_REQUEST['emsg']) && $_REQUEST['emsg'] == 'fw') { |
|
52 | - echo "<p class=\"error_msg\"> " . INVALID_USER_FPW_MSG . " </p>"; |
|
53 | - } elseif (isset($_REQUEST['logemsg']) && $_REQUEST['logemsg'] == 1) { |
|
54 | - echo "<p class=\"error_msg\"> " . INVALID_USER_PW_MSG . " </p>"; |
|
55 | - } |
|
51 | + if (isset($_REQUEST['emsg']) && $_REQUEST['emsg'] == 'fw') { |
|
52 | + echo "<p class=\"error_msg\"> " . INVALID_USER_FPW_MSG . " </p>"; |
|
53 | + } elseif (isset($_REQUEST['logemsg']) && $_REQUEST['logemsg'] == 1) { |
|
54 | + echo "<p class=\"error_msg\"> " . INVALID_USER_PW_MSG . " </p>"; |
|
55 | + } |
|
56 | 56 | |
57 | - if (isset($_REQUEST['checkemail']) && $_REQUEST['checkemail'] == 'confirm') |
|
58 | - echo '<p class="sucess_msg">' . PW_SEND_CONFIRM_MSG . '</p>'; |
|
57 | + if (isset($_REQUEST['checkemail']) && $_REQUEST['checkemail'] == 'confirm') |
|
58 | + echo '<p class="sucess_msg">' . PW_SEND_CONFIRM_MSG . '</p>'; |
|
59 | 59 | |
60 | - do_action('geodir_login_error_messages'); |
|
60 | + do_action('geodir_login_error_messages'); |
|
61 | 61 | |
62 | - ?> |
|
62 | + ?> |
|
63 | 63 | <form name="cus_loginform" id="cus_loginform" method="post"> |
64 | 64 | |
65 | 65 | <div class="form_row clearfix"> |
66 | 66 | <input placeholder='<?php echo USERNAME_TEXT; ?>' type="text" name="log" id="user_login" |
67 | 67 | value="<?php global $user_login; |
68 | - if (!isset($user_login)) { |
|
69 | - $user_login = ''; |
|
70 | - } |
|
71 | - echo esc_attr($user_login); ?>" size="20" class="textfield"/> |
|
68 | + if (!isset($user_login)) { |
|
69 | + $user_login = ''; |
|
70 | + } |
|
71 | + echo esc_attr($user_login); ?>" size="20" class="textfield"/> |
|
72 | 72 | <span class="user_loginInfo"></span> |
73 | 73 | </div> |
74 | 74 | |
@@ -79,14 +79,14 @@ discard block |
||
79 | 79 | </div> |
80 | 80 | |
81 | 81 | <?php |
82 | - /** |
|
83 | - * This is a default WordPress action that calls any additional elements needed for any login forms. |
|
84 | - * |
|
85 | - * We use this action before the remember me checkbox on the sigin form. |
|
86 | - * |
|
87 | - * @since 1.0.0 |
|
88 | - */ |
|
89 | - do_action('login_form'); ?> |
|
82 | + /** |
|
83 | + * This is a default WordPress action that calls any additional elements needed for any login forms. |
|
84 | + * |
|
85 | + * We use this action before the remember me checkbox on the sigin form. |
|
86 | + * |
|
87 | + * @since 1.0.0 |
|
88 | + */ |
|
89 | + do_action('login_form'); ?> |
|
90 | 90 | <p class="rember"> |
91 | 91 | <input name="rememberme" type="checkbox" id="rememberme" value="forever" class="fl"/> |
92 | 92 | <?php echo REMEMBER_ON_COMPUTER_TEXT; ?> |
@@ -110,12 +110,12 @@ discard block |
||
110 | 110 | <input placeholder='<?php echo USERNAME_EMAIL_TEXT; ?>' type="text" name="user_login" |
111 | 111 | value="<?php echo esc_attr($user_login); ?>" size="20" class="user_login1 textfield"/> |
112 | 112 | <?php |
113 | - /** |
|
114 | - * Called before the get new password button in the login box template. |
|
115 | - * |
|
116 | - * @since 1.0.0 |
|
117 | - */ |
|
118 | - do_action('lostpassword_form'); ?> |
|
113 | + /** |
|
114 | + * Called before the get new password button in the login box template. |
|
115 | + * |
|
116 | + * @since 1.0.0 |
|
117 | + */ |
|
118 | + do_action('lostpassword_form'); ?> |
|
119 | 119 | </div> |
120 | 120 | <input type="submit" name="get_new_password" value="<?php echo GET_NEW_PW_TEXT; ?>" class="geodir_button"/> |
121 | 121 | </form> |
@@ -61,10 +61,11 @@ |
||
61 | 61 | ob_start(); |
62 | 62 | echo '<h5 class="geodir_information">'; |
63 | 63 | |
64 | - if (!isset($_REQUEST['pid'])) |
|
65 | - printf(GOING_TO_FREE_MSG, $type_title, $alive_days); |
|
66 | - else |
|
67 | - printf(GOING_TO_UPDATE_MSG, $type_title, $alive_days); |
|
64 | + if (!isset($_REQUEST['pid'])) { |
|
65 | + printf(GOING_TO_FREE_MSG, $type_title, $alive_days); |
|
66 | + } else { |
|
67 | + printf(GOING_TO_UPDATE_MSG, $type_title, $alive_days); |
|
68 | + } |
|
68 | 69 | |
69 | 70 | echo '</h5>'; |
70 | 71 | $publish_listing_form_message = ob_get_clean(); |
@@ -15,9 +15,9 @@ discard block |
||
15 | 15 | $post_type = $post->listing_type; |
16 | 16 | |
17 | 17 | if (isset($_REQUEST['preview']) && $_REQUEST['preview'] && isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') { |
18 | - $form_action_url = geodir_get_ajax_url() . '&geodir_ajax=add_listing&ajax_action=update&listing_type=' . $post_type; |
|
18 | + $form_action_url = geodir_get_ajax_url() . '&geodir_ajax=add_listing&ajax_action=update&listing_type=' . $post_type; |
|
19 | 19 | } elseif (isset($_REQUEST['preview']) && $_REQUEST['preview']) { |
20 | - $form_action_url = geodir_get_ajax_url() . '&geodir_ajax=add_listing&ajax_action=publish&listing_type=' . $post_type; |
|
20 | + $form_action_url = geodir_get_ajax_url() . '&geodir_ajax=add_listing&ajax_action=publish&listing_type=' . $post_type; |
|
21 | 21 | } |
22 | 22 | |
23 | 23 | /** |
@@ -45,48 +45,48 @@ discard block |
||
45 | 45 | <form action="<?php echo $form_action_url; ?>" name="publish_listing" id="publish_listing" method="post"> |
46 | 46 | <div class="clearfix"> |
47 | 47 | <input type="hidden" name="pid" value="<?php if (isset($post->pid)) { |
48 | - echo $post->pid; |
|
49 | - } ?>"> |
|
48 | + echo $post->pid; |
|
49 | + } ?>"> |
|
50 | 50 | <?php |
51 | - /** |
|
52 | - * Called on the add listing preview page inside the publish listings form, before the publish message. |
|
53 | - * |
|
54 | - * @since 1.0.0 |
|
55 | - * @see 'geodir_publish_listing_form_after_msg' |
|
56 | - */ |
|
57 | - do_action('geodir_publish_listing_form_before_msg'); ?> |
|
51 | + /** |
|
52 | + * Called on the add listing preview page inside the publish listings form, before the publish message. |
|
53 | + * |
|
54 | + * @since 1.0.0 |
|
55 | + * @see 'geodir_publish_listing_form_after_msg' |
|
56 | + */ |
|
57 | + do_action('geodir_publish_listing_form_before_msg'); ?> |
|
58 | 58 | <?php |
59 | - $alive_days = UNLIMITED; |
|
60 | - $type_title = ''; |
|
61 | - ob_start(); |
|
62 | - echo '<h5 class="geodir_information">'; |
|
63 | - |
|
64 | - if (!isset($_REQUEST['pid'])) |
|
65 | - printf(GOING_TO_FREE_MSG, $type_title, $alive_days); |
|
66 | - else |
|
67 | - printf(GOING_TO_UPDATE_MSG, $type_title, $alive_days); |
|
68 | - |
|
69 | - echo '</h5>'; |
|
70 | - $publish_listing_form_message = ob_get_clean(); |
|
71 | - /** |
|
72 | - * Filter the publish listing message on the preview page. |
|
73 | - * |
|
74 | - * @since 1.0.0 |
|
75 | - * @param string $publish_listing_form_message The message to be filtered. |
|
76 | - */ |
|
77 | - $publish_listing_form_message = apply_filters('geodir_publish_listing_form_message', $publish_listing_form_message); |
|
78 | - echo $publish_listing_form_message; |
|
79 | - |
|
80 | - /** |
|
81 | - * Called on the add listing preview page inside the publish listings form, after the publish message. |
|
82 | - * |
|
83 | - * @since 1.0.0 |
|
84 | - * @see 'geodir_publish_listing_form_before_msg' |
|
85 | - */ |
|
86 | - do_action('geodir_publish_listing_form_after_msg'); |
|
87 | - |
|
88 | - ob_start(); // start action button buffering |
|
89 | - ?> |
|
59 | + $alive_days = UNLIMITED; |
|
60 | + $type_title = ''; |
|
61 | + ob_start(); |
|
62 | + echo '<h5 class="geodir_information">'; |
|
63 | + |
|
64 | + if (!isset($_REQUEST['pid'])) |
|
65 | + printf(GOING_TO_FREE_MSG, $type_title, $alive_days); |
|
66 | + else |
|
67 | + printf(GOING_TO_UPDATE_MSG, $type_title, $alive_days); |
|
68 | + |
|
69 | + echo '</h5>'; |
|
70 | + $publish_listing_form_message = ob_get_clean(); |
|
71 | + /** |
|
72 | + * Filter the publish listing message on the preview page. |
|
73 | + * |
|
74 | + * @since 1.0.0 |
|
75 | + * @param string $publish_listing_form_message The message to be filtered. |
|
76 | + */ |
|
77 | + $publish_listing_form_message = apply_filters('geodir_publish_listing_form_message', $publish_listing_form_message); |
|
78 | + echo $publish_listing_form_message; |
|
79 | + |
|
80 | + /** |
|
81 | + * Called on the add listing preview page inside the publish listings form, after the publish message. |
|
82 | + * |
|
83 | + * @since 1.0.0 |
|
84 | + * @see 'geodir_publish_listing_form_before_msg' |
|
85 | + */ |
|
86 | + do_action('geodir_publish_listing_form_after_msg'); |
|
87 | + |
|
88 | + ob_start(); // start action button buffering |
|
89 | + ?> |
|
90 | 90 | <?php if (isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') { ?> |
91 | 91 | |
92 | 92 | <input type="submit" name="Submit and Pay" value="<?php echo PRO_UPDATE_BUTTON; ?>" |
@@ -95,46 +95,46 @@ discard block |
||
95 | 95 | <input type="submit" name="Submit and Pay" value="<?php echo PRO_SUBMIT_BUTTON; ?>" |
96 | 96 | class=" geodir_button geodir_publish_button"/> |
97 | 97 | <?php |
98 | - } |
|
99 | - $publish_listing_form_button = ob_get_clean(); |
|
100 | - /** |
|
101 | - * Filter the HTML button for publishing the listing on the preview page. |
|
102 | - * |
|
103 | - * @since 1.0.0 |
|
104 | - * @param string $publish_listing_form_button The HTML for the submit button. |
|
105 | - */ |
|
106 | - $publish_listing_form_button = apply_filters('geodir_publish_listing_form_button', $publish_listing_form_button); |
|
107 | - echo $publish_listing_form_button; |
|
108 | - |
|
109 | - $post_id = ''; |
|
110 | - if (isset($post->pid)) { |
|
111 | - $post_id = $post->pid; |
|
112 | - } else if (isset($_REQUEST['pid'])) { |
|
113 | - $post_id = (int)$_REQUEST['pid']; |
|
114 | - } |
|
115 | - |
|
116 | - $postlink = get_permalink(geodir_add_listing_page_id()); |
|
117 | - $postlink = geodir_getlink($postlink, array('pid' => $post_id, 'backandedit' => '1', 'listing_type' => $post_type), false); |
|
118 | - |
|
119 | - ob_start(); // start go back and edit / cancel buffering |
|
120 | - ?> |
|
98 | + } |
|
99 | + $publish_listing_form_button = ob_get_clean(); |
|
100 | + /** |
|
101 | + * Filter the HTML button for publishing the listing on the preview page. |
|
102 | + * |
|
103 | + * @since 1.0.0 |
|
104 | + * @param string $publish_listing_form_button The HTML for the submit button. |
|
105 | + */ |
|
106 | + $publish_listing_form_button = apply_filters('geodir_publish_listing_form_button', $publish_listing_form_button); |
|
107 | + echo $publish_listing_form_button; |
|
108 | + |
|
109 | + $post_id = ''; |
|
110 | + if (isset($post->pid)) { |
|
111 | + $post_id = $post->pid; |
|
112 | + } else if (isset($_REQUEST['pid'])) { |
|
113 | + $post_id = (int)$_REQUEST['pid']; |
|
114 | + } |
|
115 | + |
|
116 | + $postlink = get_permalink(geodir_add_listing_page_id()); |
|
117 | + $postlink = geodir_getlink($postlink, array('pid' => $post_id, 'backandedit' => '1', 'listing_type' => $post_type), false); |
|
118 | + |
|
119 | + ob_start(); // start go back and edit / cancel buffering |
|
120 | + ?> |
|
121 | 121 | <a href="<?php echo esc_url($postlink); ?>" class="geodir_goback"><?php echo PRO_BACK_AND_EDIT_TEXT; ?></a> |
122 | 122 | <input type="button" name="Cancel" value="<?php echo(PRO_CANCEL_BUTTON); ?>" |
123 | 123 | class="geodir_button geodir_cancle_button" |
124 | 124 | onclick="window.location.href='<?php echo geodir_get_ajax_url() . '&geodir_ajax=add_listing&ajax_action=cancel&pid=' . $post_id . '&listing_type=' . $post_type; ?>'"/> |
125 | 125 | <?php |
126 | 126 | |
127 | - $publish_listing_form_go_back = ob_get_clean(); |
|
128 | - /** |
|
129 | - * Filter the cancel and go back and edit HTML on the preview page. |
|
130 | - * |
|
131 | - * @since 1.0.0 |
|
132 | - * @param string $publish_listing_form_go_back The HTML for the cancel and go back and edit button/link. |
|
133 | - */ |
|
134 | - $publish_listing_form_go_back = apply_filters('geodir_publish_listing_form_go_back', $publish_listing_form_go_back); |
|
135 | - echo $publish_listing_form_go_back; |
|
136 | - |
|
137 | - ?> |
|
127 | + $publish_listing_form_go_back = ob_get_clean(); |
|
128 | + /** |
|
129 | + * Filter the cancel and go back and edit HTML on the preview page. |
|
130 | + * |
|
131 | + * @since 1.0.0 |
|
132 | + * @param string $publish_listing_form_go_back The HTML for the cancel and go back and edit button/link. |
|
133 | + */ |
|
134 | + $publish_listing_form_go_back = apply_filters('geodir_publish_listing_form_go_back', $publish_listing_form_go_back); |
|
135 | + echo $publish_listing_form_go_back; |
|
136 | + |
|
137 | + ?> |
|
138 | 138 | </div> |
139 | 139 | </form> |
140 | 140 | </div> |
@@ -15,9 +15,9 @@ discard block |
||
15 | 15 | $post_type = $post->listing_type; |
16 | 16 | |
17 | 17 | if (isset($_REQUEST['preview']) && $_REQUEST['preview'] && isset($_REQUEST['pid']) && $_REQUEST['pid'] != '') { |
18 | - $form_action_url = geodir_get_ajax_url() . '&geodir_ajax=add_listing&ajax_action=update&listing_type=' . $post_type; |
|
18 | + $form_action_url = geodir_get_ajax_url().'&geodir_ajax=add_listing&ajax_action=update&listing_type='.$post_type; |
|
19 | 19 | } elseif (isset($_REQUEST['preview']) && $_REQUEST['preview']) { |
20 | - $form_action_url = geodir_get_ajax_url() . '&geodir_ajax=add_listing&ajax_action=publish&listing_type=' . $post_type; |
|
20 | + $form_action_url = geodir_get_ajax_url().'&geodir_ajax=add_listing&ajax_action=publish&listing_type='.$post_type; |
|
21 | 21 | } |
22 | 22 | |
23 | 23 | /** |
@@ -110,7 +110,7 @@ discard block |
||
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()); |
@@ -121,7 +121,7 @@ discard block |
||
121 | 121 | <a href="<?php echo esc_url($postlink); ?>" class="geodir_goback"><?php echo PRO_BACK_AND_EDIT_TEXT; ?></a> |
122 | 122 | <input type="button" name="Cancel" value="<?php echo(PRO_CANCEL_BUTTON); ?>" |
123 | 123 | class="geodir_button geodir_cancle_button" |
124 | - onclick="window.location.href='<?php echo geodir_get_ajax_url() . '&geodir_ajax=add_listing&ajax_action=cancel&pid=' . $post_id . '&listing_type=' . $post_type; ?>'"/> |
|
124 | + onclick="window.location.href='<?php echo geodir_get_ajax_url().'&geodir_ajax=add_listing&ajax_action=cancel&pid='.$post_id.'&listing_type='.$post_type; ?>'"/> |
|
125 | 125 | <?php |
126 | 126 | |
127 | 127 | $publish_listing_form_go_back = ob_get_clean(); |
@@ -353,7 +353,7 @@ |
||
353 | 353 | |
354 | 354 | if(!$cpt_left){ |
355 | 355 | $cpt_left = "gd-cpt-flat"; |
356 | - }else{ |
|
356 | + } else{ |
|
357 | 357 | $cpt_left = ''; |
358 | 358 | } |
359 | 359 |
@@ -13,241 +13,241 @@ discard block |
||
13 | 13 | */ |
14 | 14 | class geodir_cpt_categories_widget extends WP_Widget { |
15 | 15 | |
16 | - /** |
|
17 | - * Register the cpt categories with WordPress. |
|
18 | - * |
|
19 | - * @since 1.5.4 |
|
20 | - */ |
|
21 | - public function __construct() { |
|
22 | - $widget_ops = array('classname' => 'geodir_cpt_categories_widget', 'description' => __('A list of GeoDirectory CPT categories.', 'geodirectory')); |
|
23 | - parent::__construct('geodir_cpt_categories_widget', __('GD > CPT Categories', 'geodirectory'), $widget_ops); |
|
24 | - } |
|
25 | - |
|
26 | - /** |
|
27 | - * Front-end display content for cpt categories widget. |
|
28 | - * |
|
29 | - * @since 1.5.4 |
|
30 | - * @since 1.6.6 New parameters $no_cpt_filter &no_cat_filter added. |
|
31 | - * |
|
32 | - * @param array $args Widget arguments. |
|
33 | - * @param array $instance Saved values from database. |
|
34 | - */ |
|
35 | - public function widget($args, $instance) { |
|
36 | - $params = array(); |
|
37 | - /** |
|
38 | - * Filter the widget title. |
|
39 | - * |
|
40 | - * @since 1.5.4 |
|
41 | - * |
|
42 | - * @param string $title The widget title. Default empty. |
|
43 | - * @param array $instance An array of the widget's settings. |
|
44 | - * @param mixed $id_base The widget ID. |
|
45 | - */ |
|
46 | - $params['title'] = apply_filters('geodir_cpt_categories_widget_title', empty($instance['title']) ? '' : $instance['title'], $instance, $this->id_base); |
|
47 | - |
|
48 | - /** |
|
49 | - * Filter the widget setting post type. |
|
50 | - * |
|
51 | - * @since 1.5.4 |
|
52 | - * |
|
53 | - * @param array $post_type The post types to display categories. |
|
54 | - * @param array $instance An array of the widget's settings. |
|
55 | - * @param mixed $id_base The widget ID. |
|
56 | - */ |
|
57 | - $params['post_type'] = apply_filters('geodir_cpt_categories_widget_post_type', empty($instance['post_type']) ? array() : $instance['post_type'], $instance, $this->id_base); |
|
58 | - |
|
59 | - /** |
|
60 | - * Filter the widget setting to hide empty categories. |
|
61 | - * |
|
62 | - * @since 1.5.4 |
|
63 | - * |
|
64 | - * @param bool $hide_empty If true then empty category will be not displayed. |
|
65 | - * @param array $instance An array of the widget's settings. |
|
66 | - * @param mixed $id_base The widget ID. |
|
67 | - */ |
|
68 | - $params['hide_empty'] = apply_filters('geodir_cpt_categories_widget_hide_empty', empty($instance['hide_empty']) ? 0 : 1, $instance, $this->id_base); |
|
69 | - |
|
70 | - /** |
|
71 | - * Filter the widget setting to show/hide category count. |
|
72 | - * |
|
73 | - * @since 1.5.4 |
|
74 | - * |
|
75 | - * @param bool $show_count If true then category count will be displayed. |
|
76 | - * @param array $instance An array of the widget's settings. |
|
77 | - * @param mixed $id_base The widget ID. |
|
78 | - */ |
|
79 | - $params['show_count'] = apply_filters('geodir_cpt_categories_widget_show_count', empty($instance['show_count']) ? 0 : 1, $instance, $this->id_base); |
|
80 | - |
|
81 | - /** |
|
82 | - * Filter the widget setting to show/hide category icon. |
|
83 | - * |
|
84 | - * @since 1.5.4 |
|
85 | - * |
|
86 | - * @param bool $hide_icon If true then category icon will be not displayed. |
|
87 | - * @param array $instance An array of the widget's settings. |
|
88 | - * @param mixed $id_base The widget ID. |
|
89 | - */ |
|
90 | - $params['hide_icon'] = apply_filters('geodir_cpt_categories_widget_hide_icon', empty($instance['hide_icon']) ? 0 : 1, $instance, $this->id_base); |
|
91 | - |
|
92 | - /** |
|
93 | - * Filter the widget setting to show CPT inline or not. |
|
94 | - * |
|
95 | - * @since 1.5.4 |
|
96 | - * |
|
97 | - * @param bool $cpt_left If true then CPT will be displayed inline. |
|
98 | - * @param array $instance An array of the widget's settings. |
|
99 | - * @param mixed $id_base The widget ID. |
|
100 | - */ |
|
101 | - $params['cpt_left'] = apply_filters('geodir_cpt_categories_widget_cpt_left', empty($instance['cpt_left']) ? 0 : 1, $instance, $this->id_base); |
|
102 | - |
|
103 | - /** |
|
104 | - * Filter the widget categories sorting order settings. |
|
105 | - * |
|
106 | - * @since 1.5.4 |
|
107 | - * |
|
108 | - * @param string $max_count Widget max no of sub-categories count. Default 'count'. |
|
109 | - * @param array $instance An array of the widget's settings. |
|
110 | - * @param mixed $id_base The widget ID. |
|
111 | - */ |
|
112 | - $params['sort_by'] = apply_filters('geodir_cpt_categories_widget_sort_by', isset($instance['sort_by']) && in_array($instance['sort_by'], array('az', 'count')) ? $instance['sort_by'] : 'count', $instance, $this->id_base); |
|
113 | - |
|
114 | - /** |
|
115 | - * Filter the widget max no of sub-categories count. |
|
116 | - * |
|
117 | - * @since 1.5.4 |
|
118 | - * |
|
119 | - * @param bool|string $max_count Widget max no of sub-categories count. |
|
120 | - * @param array $instance An array of the widget's settings. |
|
121 | - * @param mixed $id_base The widget ID. |
|
122 | - */ |
|
123 | - $params['max_count'] = apply_filters('geodir_cpt_categories_widget_max_count', !isset($instance['max_count']) ? 'all' : strip_tags($instance['max_count']), $instance, $this->id_base); |
|
124 | - |
|
125 | - /** |
|
126 | - * Filter the widget max sub-categories depth. |
|
127 | - * |
|
128 | - * @since 1.5.4 |
|
129 | - * |
|
130 | - * @param bool|string $max_level Widget max sub-categories depth. |
|
131 | - * @param array $instance An array of the widget's settings. |
|
132 | - * @param mixed $id_base The widget ID. |
|
133 | - */ |
|
134 | - $params['max_level'] = apply_filters('geodir_cpt_categories_widget_max_level', !isset($instance['max_level']) ? 'all' : strip_tags($instance['max_level']), $instance, $this->id_base); |
|
16 | + /** |
|
17 | + * Register the cpt categories with WordPress. |
|
18 | + * |
|
19 | + * @since 1.5.4 |
|
20 | + */ |
|
21 | + public function __construct() { |
|
22 | + $widget_ops = array('classname' => 'geodir_cpt_categories_widget', 'description' => __('A list of GeoDirectory CPT categories.', 'geodirectory')); |
|
23 | + parent::__construct('geodir_cpt_categories_widget', __('GD > CPT Categories', 'geodirectory'), $widget_ops); |
|
24 | + } |
|
25 | + |
|
26 | + /** |
|
27 | + * Front-end display content for cpt categories widget. |
|
28 | + * |
|
29 | + * @since 1.5.4 |
|
30 | + * @since 1.6.6 New parameters $no_cpt_filter &no_cat_filter added. |
|
31 | + * |
|
32 | + * @param array $args Widget arguments. |
|
33 | + * @param array $instance Saved values from database. |
|
34 | + */ |
|
35 | + public function widget($args, $instance) { |
|
36 | + $params = array(); |
|
37 | + /** |
|
38 | + * Filter the widget title. |
|
39 | + * |
|
40 | + * @since 1.5.4 |
|
41 | + * |
|
42 | + * @param string $title The widget title. Default empty. |
|
43 | + * @param array $instance An array of the widget's settings. |
|
44 | + * @param mixed $id_base The widget ID. |
|
45 | + */ |
|
46 | + $params['title'] = apply_filters('geodir_cpt_categories_widget_title', empty($instance['title']) ? '' : $instance['title'], $instance, $this->id_base); |
|
47 | + |
|
48 | + /** |
|
49 | + * Filter the widget setting post type. |
|
50 | + * |
|
51 | + * @since 1.5.4 |
|
52 | + * |
|
53 | + * @param array $post_type The post types to display categories. |
|
54 | + * @param array $instance An array of the widget's settings. |
|
55 | + * @param mixed $id_base The widget ID. |
|
56 | + */ |
|
57 | + $params['post_type'] = apply_filters('geodir_cpt_categories_widget_post_type', empty($instance['post_type']) ? array() : $instance['post_type'], $instance, $this->id_base); |
|
58 | + |
|
59 | + /** |
|
60 | + * Filter the widget setting to hide empty categories. |
|
61 | + * |
|
62 | + * @since 1.5.4 |
|
63 | + * |
|
64 | + * @param bool $hide_empty If true then empty category will be not displayed. |
|
65 | + * @param array $instance An array of the widget's settings. |
|
66 | + * @param mixed $id_base The widget ID. |
|
67 | + */ |
|
68 | + $params['hide_empty'] = apply_filters('geodir_cpt_categories_widget_hide_empty', empty($instance['hide_empty']) ? 0 : 1, $instance, $this->id_base); |
|
69 | + |
|
70 | + /** |
|
71 | + * Filter the widget setting to show/hide category count. |
|
72 | + * |
|
73 | + * @since 1.5.4 |
|
74 | + * |
|
75 | + * @param bool $show_count If true then category count will be displayed. |
|
76 | + * @param array $instance An array of the widget's settings. |
|
77 | + * @param mixed $id_base The widget ID. |
|
78 | + */ |
|
79 | + $params['show_count'] = apply_filters('geodir_cpt_categories_widget_show_count', empty($instance['show_count']) ? 0 : 1, $instance, $this->id_base); |
|
80 | + |
|
81 | + /** |
|
82 | + * Filter the widget setting to show/hide category icon. |
|
83 | + * |
|
84 | + * @since 1.5.4 |
|
85 | + * |
|
86 | + * @param bool $hide_icon If true then category icon will be not displayed. |
|
87 | + * @param array $instance An array of the widget's settings. |
|
88 | + * @param mixed $id_base The widget ID. |
|
89 | + */ |
|
90 | + $params['hide_icon'] = apply_filters('geodir_cpt_categories_widget_hide_icon', empty($instance['hide_icon']) ? 0 : 1, $instance, $this->id_base); |
|
91 | + |
|
92 | + /** |
|
93 | + * Filter the widget setting to show CPT inline or not. |
|
94 | + * |
|
95 | + * @since 1.5.4 |
|
96 | + * |
|
97 | + * @param bool $cpt_left If true then CPT will be displayed inline. |
|
98 | + * @param array $instance An array of the widget's settings. |
|
99 | + * @param mixed $id_base The widget ID. |
|
100 | + */ |
|
101 | + $params['cpt_left'] = apply_filters('geodir_cpt_categories_widget_cpt_left', empty($instance['cpt_left']) ? 0 : 1, $instance, $this->id_base); |
|
102 | + |
|
103 | + /** |
|
104 | + * Filter the widget categories sorting order settings. |
|
105 | + * |
|
106 | + * @since 1.5.4 |
|
107 | + * |
|
108 | + * @param string $max_count Widget max no of sub-categories count. Default 'count'. |
|
109 | + * @param array $instance An array of the widget's settings. |
|
110 | + * @param mixed $id_base The widget ID. |
|
111 | + */ |
|
112 | + $params['sort_by'] = apply_filters('geodir_cpt_categories_widget_sort_by', isset($instance['sort_by']) && in_array($instance['sort_by'], array('az', 'count')) ? $instance['sort_by'] : 'count', $instance, $this->id_base); |
|
113 | + |
|
114 | + /** |
|
115 | + * Filter the widget max no of sub-categories count. |
|
116 | + * |
|
117 | + * @since 1.5.4 |
|
118 | + * |
|
119 | + * @param bool|string $max_count Widget max no of sub-categories count. |
|
120 | + * @param array $instance An array of the widget's settings. |
|
121 | + * @param mixed $id_base The widget ID. |
|
122 | + */ |
|
123 | + $params['max_count'] = apply_filters('geodir_cpt_categories_widget_max_count', !isset($instance['max_count']) ? 'all' : strip_tags($instance['max_count']), $instance, $this->id_base); |
|
124 | + |
|
125 | + /** |
|
126 | + * Filter the widget max sub-categories depth. |
|
127 | + * |
|
128 | + * @since 1.5.4 |
|
129 | + * |
|
130 | + * @param bool|string $max_level Widget max sub-categories depth. |
|
131 | + * @param array $instance An array of the widget's settings. |
|
132 | + * @param mixed $id_base The widget ID. |
|
133 | + */ |
|
134 | + $params['max_level'] = apply_filters('geodir_cpt_categories_widget_max_level', !isset($instance['max_level']) ? 'all' : strip_tags($instance['max_level']), $instance, $this->id_base); |
|
135 | 135 | |
136 | - /** |
|
137 | - * Filter the widget setting to disable filter current viewing post type. |
|
138 | - * |
|
139 | - * @since 1.6.6 |
|
140 | - * |
|
141 | - * @param bool $no_cpt_filter If true then it doesn't filter current viewing post type. |
|
142 | - * @param array $instance An array of the widget's settings. |
|
143 | - * @param mixed $id_base The widget ID. |
|
144 | - */ |
|
145 | - $params['no_cpt_filter'] = apply_filters('geodir_cpt_categories_widget_no_cpt_filter', empty($instance['no_cpt_filter']) ? 0 : 1, $instance, $this->id_base); |
|
136 | + /** |
|
137 | + * Filter the widget setting to disable filter current viewing post type. |
|
138 | + * |
|
139 | + * @since 1.6.6 |
|
140 | + * |
|
141 | + * @param bool $no_cpt_filter If true then it doesn't filter current viewing post type. |
|
142 | + * @param array $instance An array of the widget's settings. |
|
143 | + * @param mixed $id_base The widget ID. |
|
144 | + */ |
|
145 | + $params['no_cpt_filter'] = apply_filters('geodir_cpt_categories_widget_no_cpt_filter', empty($instance['no_cpt_filter']) ? 0 : 1, $instance, $this->id_base); |
|
146 | 146 | |
147 | - /** |
|
148 | - * Filter the widget setting to disable current viewing category. |
|
149 | - * |
|
150 | - * @since 1.6.6 |
|
151 | - * |
|
152 | - * @param bool $no_cat_filter If true then it doesn't filter current viewing category. |
|
153 | - * @param array $instance An array of the widget's settings. |
|
154 | - * @param mixed $id_base The widget ID. |
|
155 | - */ |
|
156 | - $params['no_cat_filter'] = apply_filters('geodir_cpt_categories_widget_no_cat_filter', empty($instance['no_cat_filter']) ? 0 : 1, $instance, $this->id_base); |
|
157 | - |
|
158 | - /** |
|
159 | - * Filter the widget parameters. |
|
160 | - * |
|
161 | - * @since 1.5.4 |
|
162 | - * |
|
163 | - * @param array $params The widget parameters. |
|
164 | - * @param array $instance An array of the widget's settings. |
|
165 | - * @param mixed $id_base The widget ID. |
|
166 | - */ |
|
167 | - $params = apply_filters('geodir_cpt_categories_widget_params', $params, $instance, $this->id_base); |
|
168 | - |
|
169 | - $output = geodir_cpt_categories_output($params); |
|
170 | - |
|
171 | - echo $args['before_widget']; |
|
172 | - if ( $params['title'] ) { |
|
173 | - echo '<div class="geodir_list_heading clearfix">'; |
|
174 | - echo $args['before_title'] . $params['title'] . $args['after_title']; |
|
175 | - echo '</div>'; |
|
176 | - } |
|
177 | - echo '<div class="gd-cptcats-widget">'; |
|
178 | - echo $output; |
|
179 | - echo '</div>'; |
|
180 | - echo $args['after_widget']; |
|
181 | - } |
|
182 | - |
|
183 | - /** |
|
184 | - * Sanitize cpt categories widget values as they are saved. |
|
185 | - * |
|
186 | - * @since 1.5.4 |
|
187 | - * @since 1.6.6 New parameters $no_cpt_filter &no_cat_filter added. |
|
188 | - * |
|
189 | - * @param array $new_instance Values just sent to be saved. |
|
190 | - * @param array $old_instance Previously saved values from database. |
|
191 | - * |
|
192 | - * @return array Updated safe values to be saved. |
|
193 | - */ |
|
194 | - public function update($new_instance, $old_instance) { |
|
195 | - $new_instance['post_type'] = is_array($new_instance['post_type']) && in_array('0', $new_instance['post_type']) ? array('0') : $new_instance['post_type']; |
|
196 | - $instance = $old_instance; |
|
197 | - $instance['title'] = strip_tags($new_instance['title']); |
|
198 | - $instance['post_type'] = isset($new_instance['post_type']) ? $new_instance['post_type'] : array('0'); |
|
199 | - $instance['hide_empty'] = !empty($new_instance['hide_empty']) ? 1 : 0; |
|
200 | - $instance['show_count'] = !empty($new_instance['show_count']) ? 1 : 0; |
|
201 | - $instance['hide_icon'] = !empty($new_instance['hide_icon']) ? 1 : 0; |
|
202 | - $instance['cpt_left'] = !empty($new_instance['cpt_left']) ? 1 : 0; |
|
203 | - $instance['sort_by'] = isset($new_instance['sort_by']) && in_array($new_instance['sort_by'], array('az', 'count')) ? $new_instance['sort_by'] : 'count'; |
|
204 | - $instance['max_count'] = strip_tags($new_instance['max_count']); |
|
205 | - $instance['max_level'] = strip_tags($new_instance['max_level']); |
|
206 | - $instance['no_cpt_filter'] = !empty($new_instance['no_cpt_filter']) ? 1 : 0; |
|
207 | - $instance['no_cat_filter'] = !empty($new_instance['no_cat_filter']) ? 1 : 0; |
|
208 | - |
|
209 | - return $instance; |
|
210 | - } |
|
211 | - |
|
212 | - /** |
|
213 | - * Back-end cpt categories settings form. |
|
214 | - * |
|
215 | - * @since 1.5.4 |
|
216 | - * @since 1.6.6 New parameters $no_cpt_filter &no_cat_filter added. |
|
217 | - * |
|
218 | - * @param array $instance Previously saved values from database. |
|
219 | - */ |
|
220 | - public function form($instance) { |
|
221 | - $instance = wp_parse_args( (array)$instance, |
|
222 | - array( |
|
223 | - 'title' => '', |
|
224 | - 'post_type' => array(), // NULL for all |
|
225 | - 'hide_empty' => '', |
|
226 | - 'show_count' => '', |
|
227 | - 'hide_icon' => '', |
|
228 | - 'cpt_left' => '', |
|
229 | - 'sort_by' => 'count', |
|
230 | - 'max_count' => 'all', |
|
231 | - 'max_level' => '1', |
|
232 | - 'no_cpt_filter' => '', |
|
233 | - 'no_cat_filter' => '', |
|
234 | - ) |
|
235 | - ); |
|
236 | - |
|
237 | - $title = strip_tags($instance['title']); |
|
238 | - $post_type = $instance['post_type']; |
|
239 | - $hide_empty = !empty($instance['hide_empty']) ? true : false; |
|
240 | - $show_count = !empty($instance['show_count']) ? true : false; |
|
241 | - $hide_icon = !empty($instance['hide_icon']) ? true : false; |
|
242 | - $cpt_left = !empty($instance['cpt_left']) ? true : false; |
|
243 | - $max_count = strip_tags($instance['max_count']); |
|
244 | - $max_level = strip_tags($instance['max_level']); |
|
245 | - $sort_by = isset($instance['sort_by']) && in_array($instance['sort_by'], array('az', 'count')) ? $instance['sort_by'] : 'count'; |
|
246 | - $no_cpt_filter = !empty($instance['no_cpt_filter']) ? true : false; |
|
247 | - $no_cat_filter = !empty($instance['no_cat_filter']) ? true : false; |
|
248 | - |
|
249 | - $post_type_options = geodir_get_posttypes('options'); |
|
250 | - ?> |
|
147 | + /** |
|
148 | + * Filter the widget setting to disable current viewing category. |
|
149 | + * |
|
150 | + * @since 1.6.6 |
|
151 | + * |
|
152 | + * @param bool $no_cat_filter If true then it doesn't filter current viewing category. |
|
153 | + * @param array $instance An array of the widget's settings. |
|
154 | + * @param mixed $id_base The widget ID. |
|
155 | + */ |
|
156 | + $params['no_cat_filter'] = apply_filters('geodir_cpt_categories_widget_no_cat_filter', empty($instance['no_cat_filter']) ? 0 : 1, $instance, $this->id_base); |
|
157 | + |
|
158 | + /** |
|
159 | + * Filter the widget parameters. |
|
160 | + * |
|
161 | + * @since 1.5.4 |
|
162 | + * |
|
163 | + * @param array $params The widget parameters. |
|
164 | + * @param array $instance An array of the widget's settings. |
|
165 | + * @param mixed $id_base The widget ID. |
|
166 | + */ |
|
167 | + $params = apply_filters('geodir_cpt_categories_widget_params', $params, $instance, $this->id_base); |
|
168 | + |
|
169 | + $output = geodir_cpt_categories_output($params); |
|
170 | + |
|
171 | + echo $args['before_widget']; |
|
172 | + if ( $params['title'] ) { |
|
173 | + echo '<div class="geodir_list_heading clearfix">'; |
|
174 | + echo $args['before_title'] . $params['title'] . $args['after_title']; |
|
175 | + echo '</div>'; |
|
176 | + } |
|
177 | + echo '<div class="gd-cptcats-widget">'; |
|
178 | + echo $output; |
|
179 | + echo '</div>'; |
|
180 | + echo $args['after_widget']; |
|
181 | + } |
|
182 | + |
|
183 | + /** |
|
184 | + * Sanitize cpt categories widget values as they are saved. |
|
185 | + * |
|
186 | + * @since 1.5.4 |
|
187 | + * @since 1.6.6 New parameters $no_cpt_filter &no_cat_filter added. |
|
188 | + * |
|
189 | + * @param array $new_instance Values just sent to be saved. |
|
190 | + * @param array $old_instance Previously saved values from database. |
|
191 | + * |
|
192 | + * @return array Updated safe values to be saved. |
|
193 | + */ |
|
194 | + public function update($new_instance, $old_instance) { |
|
195 | + $new_instance['post_type'] = is_array($new_instance['post_type']) && in_array('0', $new_instance['post_type']) ? array('0') : $new_instance['post_type']; |
|
196 | + $instance = $old_instance; |
|
197 | + $instance['title'] = strip_tags($new_instance['title']); |
|
198 | + $instance['post_type'] = isset($new_instance['post_type']) ? $new_instance['post_type'] : array('0'); |
|
199 | + $instance['hide_empty'] = !empty($new_instance['hide_empty']) ? 1 : 0; |
|
200 | + $instance['show_count'] = !empty($new_instance['show_count']) ? 1 : 0; |
|
201 | + $instance['hide_icon'] = !empty($new_instance['hide_icon']) ? 1 : 0; |
|
202 | + $instance['cpt_left'] = !empty($new_instance['cpt_left']) ? 1 : 0; |
|
203 | + $instance['sort_by'] = isset($new_instance['sort_by']) && in_array($new_instance['sort_by'], array('az', 'count')) ? $new_instance['sort_by'] : 'count'; |
|
204 | + $instance['max_count'] = strip_tags($new_instance['max_count']); |
|
205 | + $instance['max_level'] = strip_tags($new_instance['max_level']); |
|
206 | + $instance['no_cpt_filter'] = !empty($new_instance['no_cpt_filter']) ? 1 : 0; |
|
207 | + $instance['no_cat_filter'] = !empty($new_instance['no_cat_filter']) ? 1 : 0; |
|
208 | + |
|
209 | + return $instance; |
|
210 | + } |
|
211 | + |
|
212 | + /** |
|
213 | + * Back-end cpt categories settings form. |
|
214 | + * |
|
215 | + * @since 1.5.4 |
|
216 | + * @since 1.6.6 New parameters $no_cpt_filter &no_cat_filter added. |
|
217 | + * |
|
218 | + * @param array $instance Previously saved values from database. |
|
219 | + */ |
|
220 | + public function form($instance) { |
|
221 | + $instance = wp_parse_args( (array)$instance, |
|
222 | + array( |
|
223 | + 'title' => '', |
|
224 | + 'post_type' => array(), // NULL for all |
|
225 | + 'hide_empty' => '', |
|
226 | + 'show_count' => '', |
|
227 | + 'hide_icon' => '', |
|
228 | + 'cpt_left' => '', |
|
229 | + 'sort_by' => 'count', |
|
230 | + 'max_count' => 'all', |
|
231 | + 'max_level' => '1', |
|
232 | + 'no_cpt_filter' => '', |
|
233 | + 'no_cat_filter' => '', |
|
234 | + ) |
|
235 | + ); |
|
236 | + |
|
237 | + $title = strip_tags($instance['title']); |
|
238 | + $post_type = $instance['post_type']; |
|
239 | + $hide_empty = !empty($instance['hide_empty']) ? true : false; |
|
240 | + $show_count = !empty($instance['show_count']) ? true : false; |
|
241 | + $hide_icon = !empty($instance['hide_icon']) ? true : false; |
|
242 | + $cpt_left = !empty($instance['cpt_left']) ? true : false; |
|
243 | + $max_count = strip_tags($instance['max_count']); |
|
244 | + $max_level = strip_tags($instance['max_level']); |
|
245 | + $sort_by = isset($instance['sort_by']) && in_array($instance['sort_by'], array('az', 'count')) ? $instance['sort_by'] : 'count'; |
|
246 | + $no_cpt_filter = !empty($instance['no_cpt_filter']) ? true : false; |
|
247 | + $no_cat_filter = !empty($instance['no_cat_filter']) ? true : false; |
|
248 | + |
|
249 | + $post_type_options = geodir_get_posttypes('options'); |
|
250 | + ?> |
|
251 | 251 | <p><label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title:', 'geodirectory'); ?></label> <input class="widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" type="text" value="<?php echo esc_attr($title); ?>" /></p> |
252 | 252 | <p> |
253 | 253 | <label for="<?php echo $this->get_field_id('post_type'); ?>"><?php _e('Select CPT:', 'geodirectory'); ?></label> |
@@ -298,7 +298,7 @@ discard block |
||
298 | 298 | <label for="<?php echo $this->get_field_id('no_cat_filter'); ?>"><?php _e( 'Don\'t filter for current viewing category', 'geodirectory' ); ?></label> |
299 | 299 | </p> |
300 | 300 | <?php |
301 | - } |
|
301 | + } |
|
302 | 302 | } // class geodir_cpt_categories_widget |
303 | 303 | |
304 | 304 | register_widget('geodir_cpt_categories_widget'); |
@@ -313,153 +313,153 @@ discard block |
||
313 | 313 | * @return string CPT categories content. |
314 | 314 | */ |
315 | 315 | function geodir_cpt_categories_output($params) { |
316 | - $args = wp_parse_args((array)$params, |
|
317 | - array( |
|
318 | - 'title' => '', |
|
319 | - 'post_type' => array(), // NULL for all |
|
320 | - 'hide_empty' => '', |
|
321 | - 'show_count' => '', |
|
322 | - 'hide_icon' => '', |
|
323 | - 'cpt_left' => '', |
|
324 | - 'sort_by' => 'count', |
|
325 | - 'max_count' => 'all', |
|
326 | - 'max_level' => '1', |
|
327 | - 'no_cpt_filter' => '', |
|
328 | - 'no_cat_filter' => '', |
|
329 | - ) |
|
330 | - ); |
|
331 | - |
|
332 | - $sort_by = isset($args['sort_by']) && in_array($args['sort_by'], array('az', 'count')) ? $args['sort_by'] : 'count'; |
|
333 | - $cpt_filter = empty($args['no_cpt_filter']) ? true : false; |
|
334 | - $cat_filter = empty($args['no_cat_filter']) ? true : false; |
|
335 | - |
|
336 | - $gd_post_types = geodir_get_posttypes('array'); |
|
337 | - |
|
338 | - $post_type_arr = !is_array($args['post_type']) ? explode(',', $args['post_type']) : $args['post_type']; |
|
339 | - $current_posttype = geodir_get_current_posttype(); |
|
340 | - |
|
341 | - $is_listing = false; |
|
342 | - $is_category = false; |
|
343 | - if (geodir_is_page('listing')) { |
|
344 | - $current_posttype = geodir_get_current_posttype(); |
|
345 | - |
|
346 | - if ($current_posttype != '' && isset($gd_post_types[$current_posttype])) { |
|
347 | - $is_listing = true; |
|
348 | - |
|
349 | - if (is_tax()) { // category page |
|
350 | - $current_term_id = get_queried_object_id(); |
|
351 | - $current_taxonomy = get_query_var('taxonomy'); |
|
352 | - $current_posttype = geodir_get_current_posttype(); |
|
353 | - |
|
354 | - if ($current_term_id && $current_posttype && get_query_var('taxonomy') == $current_posttype . 'category') { |
|
355 | - $is_category = true; |
|
356 | - } |
|
357 | - } |
|
358 | - } |
|
359 | - } |
|
360 | - |
|
361 | - $parent_category = 0; |
|
362 | - if ($is_listing && $cpt_filter) { |
|
363 | - $post_type_arr = array($current_posttype); |
|
364 | - } |
|
365 | - |
|
366 | - $post_types = array(); |
|
367 | - if (!empty($post_type_arr)) { |
|
368 | - if (in_array('0', $post_type_arr)) { |
|
369 | - $post_types = $gd_post_types; |
|
370 | - } else { |
|
371 | - foreach ($post_type_arr as $cpt) { |
|
372 | - if (isset($gd_post_types[$cpt])) { |
|
373 | - $post_types[$cpt] = $gd_post_types[$cpt]; |
|
374 | - } |
|
375 | - } |
|
376 | - } |
|
377 | - } |
|
378 | - |
|
379 | - if (empty($post_type_arr)) { |
|
380 | - $post_types = $gd_post_types; |
|
381 | - } |
|
382 | - |
|
383 | - $hide_empty = !empty($args['hide_empty']) ? true : false; |
|
384 | - $max_count = strip_tags($args['max_count']); |
|
385 | - $all_childs = $max_count == 'all' ? true : false; |
|
386 | - $max_count = $max_count > 0 ? (int)$max_count : 0; |
|
387 | - $max_level = strip_tags($args['max_level']); |
|
388 | - $show_count = !empty($args['show_count']) ? true : false; |
|
389 | - $hide_icon = !empty($args['hide_icon']) ? true : false; |
|
390 | - $cpt_left = !empty($args['cpt_left']) ? true : false; |
|
391 | - |
|
392 | - if(!$cpt_left){ |
|
393 | - $cpt_left = "gd-cpt-flat"; |
|
394 | - }else{ |
|
395 | - $cpt_left = ''; |
|
396 | - } |
|
397 | - |
|
398 | - $orderby = 'count'; |
|
399 | - $order = 'DESC'; |
|
400 | - if ($sort_by == 'az') { |
|
401 | - $orderby = 'name'; |
|
402 | - $order = 'ASC'; |
|
403 | - } |
|
404 | - |
|
405 | - $output = ''; |
|
406 | - if (!empty($post_types)) { |
|
407 | - foreach ($post_types as $cpt => $cpt_info) { |
|
408 | - $parent_category = ($is_category && $cat_filter && $cpt == $current_posttype) ? $current_term_id : 0; |
|
409 | - $cat_taxonomy = $cpt . 'category'; |
|
410 | - $categories = get_terms($cat_taxonomy, array('orderby' => $orderby, 'order' => $order, 'hide_empty' => $hide_empty, 'parent' => $parent_category)); |
|
411 | - if ($hide_empty) { |
|
412 | - $categories = geodir_filter_empty_terms($categories); |
|
413 | - } |
|
414 | - if ($sort_by == 'count') { |
|
415 | - $categories = geodir_sort_terms($categories, 'count'); |
|
416 | - } |
|
417 | - |
|
418 | - if (!empty($categories)) { |
|
419 | - $term_icons = !$hide_icon ? geodir_get_term_icon() : array(); |
|
420 | - $row_class = ''; |
|
421 | - |
|
422 | - if ($is_listing) { |
|
423 | - $row_class = $is_category ? ' gd-cptcat-categ' : ' gd-cptcat-listing'; |
|
424 | - } |
|
425 | - $cpt_row = '<div class="gd-cptcat-row gd-cptcat-' . $cpt . $row_class . ' '.$cpt_left.'">'; |
|
426 | - |
|
427 | - if ($is_category && $cat_filter && $cpt == $current_posttype) { |
|
428 | - $term_info = get_term($current_term_id, $cat_taxonomy); |
|
429 | - |
|
430 | - $term_icon_url = !empty($term_icons) && isset($term_icons[$term_info->term_id]) ? $term_icons[$term_info->term_id] : ''; |
|
431 | - $term_icon_url = $term_icon_url != '' ? '<img alt="' . esc_attr($term_info->name) . ' icon" src="' . $term_icon_url . '" /> ' : ''; |
|
432 | - |
|
433 | - $count = $show_count ? ' <span class="gd-cptcat-count">(' . $term_info->count . ')</span>' : ''; |
|
434 | - $cpt_row .= '<h2 class="gd-cptcat-title">' . $term_icon_url . $term_info->name . $count . '</h2>'; |
|
435 | - } else { |
|
436 | - $cpt_row .= '<h2 class="gd-cptcat-title">' . __($cpt_info['labels']['name'], 'geodirectory') . '</h2>'; |
|
437 | - } |
|
438 | - foreach ($categories as $category) { |
|
439 | - $term_icon_url = !empty($term_icons) && isset($term_icons[$category->term_id]) ? $term_icons[$category->term_id] : ''; |
|
440 | - $term_icon_url = $term_icon_url != '' ? '<img alt="' . esc_attr($category->name) . ' icon" src="' . $term_icon_url . '" /> ' : ''; |
|
441 | - |
|
442 | - $term_link = get_term_link( $category, $category->taxonomy ); |
|
443 | - /** Filter documented in geodirectory-functions/general_functions.php **/ |
|
444 | - $term_link = apply_filters( 'geodir_category_term_link', $term_link, $category->term_id, $cpt ); |
|
445 | - |
|
446 | - $cpt_row .= '<ul class="gd-cptcat-ul gd-cptcat-parent '.$cpt_left.'">'; |
|
447 | - $cpt_row .= '<li class="gd-cptcat-li gd-cptcat-li-main">'; |
|
448 | - $count = $show_count ? ' <span class="gd-cptcat-count">(' . $category->count . ')</span>' : ''; |
|
449 | - $cpt_row .= '<h3 class="gd-cptcat-cat"><a href="' . esc_url($term_link) . '" title="' . esc_attr($category->name) . '">' .$term_icon_url . $category->name . $count . '</a></h3>'; |
|
450 | - if (($all_childs || $max_count > 0) && ($max_level == 'all' || (int)$max_level > 0)) { |
|
451 | - $cpt_row .= geodir_cpt_categories_child_cats($category->term_id, $cpt, $hide_empty, $show_count, $sort_by, $max_count, $max_level, $term_icons); |
|
452 | - } |
|
453 | - $cpt_row .= '</li>'; |
|
454 | - $cpt_row .= '</ul>'; |
|
455 | - } |
|
456 | - $cpt_row .= '</ul></div>'; |
|
457 | - |
|
458 | - $output .= $cpt_row; |
|
459 | - } |
|
460 | - } |
|
461 | - } |
|
462 | - return $output; |
|
316 | + $args = wp_parse_args((array)$params, |
|
317 | + array( |
|
318 | + 'title' => '', |
|
319 | + 'post_type' => array(), // NULL for all |
|
320 | + 'hide_empty' => '', |
|
321 | + 'show_count' => '', |
|
322 | + 'hide_icon' => '', |
|
323 | + 'cpt_left' => '', |
|
324 | + 'sort_by' => 'count', |
|
325 | + 'max_count' => 'all', |
|
326 | + 'max_level' => '1', |
|
327 | + 'no_cpt_filter' => '', |
|
328 | + 'no_cat_filter' => '', |
|
329 | + ) |
|
330 | + ); |
|
331 | + |
|
332 | + $sort_by = isset($args['sort_by']) && in_array($args['sort_by'], array('az', 'count')) ? $args['sort_by'] : 'count'; |
|
333 | + $cpt_filter = empty($args['no_cpt_filter']) ? true : false; |
|
334 | + $cat_filter = empty($args['no_cat_filter']) ? true : false; |
|
335 | + |
|
336 | + $gd_post_types = geodir_get_posttypes('array'); |
|
337 | + |
|
338 | + $post_type_arr = !is_array($args['post_type']) ? explode(',', $args['post_type']) : $args['post_type']; |
|
339 | + $current_posttype = geodir_get_current_posttype(); |
|
340 | + |
|
341 | + $is_listing = false; |
|
342 | + $is_category = false; |
|
343 | + if (geodir_is_page('listing')) { |
|
344 | + $current_posttype = geodir_get_current_posttype(); |
|
345 | + |
|
346 | + if ($current_posttype != '' && isset($gd_post_types[$current_posttype])) { |
|
347 | + $is_listing = true; |
|
348 | + |
|
349 | + if (is_tax()) { // category page |
|
350 | + $current_term_id = get_queried_object_id(); |
|
351 | + $current_taxonomy = get_query_var('taxonomy'); |
|
352 | + $current_posttype = geodir_get_current_posttype(); |
|
353 | + |
|
354 | + if ($current_term_id && $current_posttype && get_query_var('taxonomy') == $current_posttype . 'category') { |
|
355 | + $is_category = true; |
|
356 | + } |
|
357 | + } |
|
358 | + } |
|
359 | + } |
|
360 | + |
|
361 | + $parent_category = 0; |
|
362 | + if ($is_listing && $cpt_filter) { |
|
363 | + $post_type_arr = array($current_posttype); |
|
364 | + } |
|
365 | + |
|
366 | + $post_types = array(); |
|
367 | + if (!empty($post_type_arr)) { |
|
368 | + if (in_array('0', $post_type_arr)) { |
|
369 | + $post_types = $gd_post_types; |
|
370 | + } else { |
|
371 | + foreach ($post_type_arr as $cpt) { |
|
372 | + if (isset($gd_post_types[$cpt])) { |
|
373 | + $post_types[$cpt] = $gd_post_types[$cpt]; |
|
374 | + } |
|
375 | + } |
|
376 | + } |
|
377 | + } |
|
378 | + |
|
379 | + if (empty($post_type_arr)) { |
|
380 | + $post_types = $gd_post_types; |
|
381 | + } |
|
382 | + |
|
383 | + $hide_empty = !empty($args['hide_empty']) ? true : false; |
|
384 | + $max_count = strip_tags($args['max_count']); |
|
385 | + $all_childs = $max_count == 'all' ? true : false; |
|
386 | + $max_count = $max_count > 0 ? (int)$max_count : 0; |
|
387 | + $max_level = strip_tags($args['max_level']); |
|
388 | + $show_count = !empty($args['show_count']) ? true : false; |
|
389 | + $hide_icon = !empty($args['hide_icon']) ? true : false; |
|
390 | + $cpt_left = !empty($args['cpt_left']) ? true : false; |
|
391 | + |
|
392 | + if(!$cpt_left){ |
|
393 | + $cpt_left = "gd-cpt-flat"; |
|
394 | + }else{ |
|
395 | + $cpt_left = ''; |
|
396 | + } |
|
397 | + |
|
398 | + $orderby = 'count'; |
|
399 | + $order = 'DESC'; |
|
400 | + if ($sort_by == 'az') { |
|
401 | + $orderby = 'name'; |
|
402 | + $order = 'ASC'; |
|
403 | + } |
|
404 | + |
|
405 | + $output = ''; |
|
406 | + if (!empty($post_types)) { |
|
407 | + foreach ($post_types as $cpt => $cpt_info) { |
|
408 | + $parent_category = ($is_category && $cat_filter && $cpt == $current_posttype) ? $current_term_id : 0; |
|
409 | + $cat_taxonomy = $cpt . 'category'; |
|
410 | + $categories = get_terms($cat_taxonomy, array('orderby' => $orderby, 'order' => $order, 'hide_empty' => $hide_empty, 'parent' => $parent_category)); |
|
411 | + if ($hide_empty) { |
|
412 | + $categories = geodir_filter_empty_terms($categories); |
|
413 | + } |
|
414 | + if ($sort_by == 'count') { |
|
415 | + $categories = geodir_sort_terms($categories, 'count'); |
|
416 | + } |
|
417 | + |
|
418 | + if (!empty($categories)) { |
|
419 | + $term_icons = !$hide_icon ? geodir_get_term_icon() : array(); |
|
420 | + $row_class = ''; |
|
421 | + |
|
422 | + if ($is_listing) { |
|
423 | + $row_class = $is_category ? ' gd-cptcat-categ' : ' gd-cptcat-listing'; |
|
424 | + } |
|
425 | + $cpt_row = '<div class="gd-cptcat-row gd-cptcat-' . $cpt . $row_class . ' '.$cpt_left.'">'; |
|
426 | + |
|
427 | + if ($is_category && $cat_filter && $cpt == $current_posttype) { |
|
428 | + $term_info = get_term($current_term_id, $cat_taxonomy); |
|
429 | + |
|
430 | + $term_icon_url = !empty($term_icons) && isset($term_icons[$term_info->term_id]) ? $term_icons[$term_info->term_id] : ''; |
|
431 | + $term_icon_url = $term_icon_url != '' ? '<img alt="' . esc_attr($term_info->name) . ' icon" src="' . $term_icon_url . '" /> ' : ''; |
|
432 | + |
|
433 | + $count = $show_count ? ' <span class="gd-cptcat-count">(' . $term_info->count . ')</span>' : ''; |
|
434 | + $cpt_row .= '<h2 class="gd-cptcat-title">' . $term_icon_url . $term_info->name . $count . '</h2>'; |
|
435 | + } else { |
|
436 | + $cpt_row .= '<h2 class="gd-cptcat-title">' . __($cpt_info['labels']['name'], 'geodirectory') . '</h2>'; |
|
437 | + } |
|
438 | + foreach ($categories as $category) { |
|
439 | + $term_icon_url = !empty($term_icons) && isset($term_icons[$category->term_id]) ? $term_icons[$category->term_id] : ''; |
|
440 | + $term_icon_url = $term_icon_url != '' ? '<img alt="' . esc_attr($category->name) . ' icon" src="' . $term_icon_url . '" /> ' : ''; |
|
441 | + |
|
442 | + $term_link = get_term_link( $category, $category->taxonomy ); |
|
443 | + /** Filter documented in geodirectory-functions/general_functions.php **/ |
|
444 | + $term_link = apply_filters( 'geodir_category_term_link', $term_link, $category->term_id, $cpt ); |
|
445 | + |
|
446 | + $cpt_row .= '<ul class="gd-cptcat-ul gd-cptcat-parent '.$cpt_left.'">'; |
|
447 | + $cpt_row .= '<li class="gd-cptcat-li gd-cptcat-li-main">'; |
|
448 | + $count = $show_count ? ' <span class="gd-cptcat-count">(' . $category->count . ')</span>' : ''; |
|
449 | + $cpt_row .= '<h3 class="gd-cptcat-cat"><a href="' . esc_url($term_link) . '" title="' . esc_attr($category->name) . '">' .$term_icon_url . $category->name . $count . '</a></h3>'; |
|
450 | + if (($all_childs || $max_count > 0) && ($max_level == 'all' || (int)$max_level > 0)) { |
|
451 | + $cpt_row .= geodir_cpt_categories_child_cats($category->term_id, $cpt, $hide_empty, $show_count, $sort_by, $max_count, $max_level, $term_icons); |
|
452 | + } |
|
453 | + $cpt_row .= '</li>'; |
|
454 | + $cpt_row .= '</ul>'; |
|
455 | + } |
|
456 | + $cpt_row .= '</ul></div>'; |
|
457 | + |
|
458 | + $output .= $cpt_row; |
|
459 | + } |
|
460 | + } |
|
461 | + } |
|
462 | + return $output; |
|
463 | 463 | } |
464 | 464 | |
465 | 465 | /** |
@@ -479,48 +479,48 @@ discard block |
||
479 | 479 | * @return string Html content. |
480 | 480 | */ |
481 | 481 | function geodir_cpt_categories_child_cats($parent_id, $cpt, $hide_empty, $show_count, $sort_by, $max_count, $max_level, $term_icons, $depth = 1) { |
482 | - $cat_taxonomy = $cpt . 'category'; |
|
483 | - |
|
484 | - $orderby = 'count'; |
|
485 | - $order = 'DESC'; |
|
486 | - if ($sort_by == 'az') { |
|
487 | - $orderby = 'name'; |
|
488 | - $order = 'ASC'; |
|
489 | - } |
|
490 | - |
|
491 | - if ($max_level != 'all' && $depth > (int)$max_level ) { |
|
492 | - return ''; |
|
493 | - } |
|
494 | - |
|
495 | - $child_cats = get_terms($cat_taxonomy, array('orderby' => $orderby, 'order' => $order, 'hide_empty' => $hide_empty, 'parent' => $parent_id, 'number' => $max_count)); |
|
496 | - if ($hide_empty) { |
|
497 | - $child_cats = geodir_filter_empty_terms($child_cats); |
|
498 | - } |
|
499 | - |
|
500 | - if (empty($child_cats)) { |
|
501 | - return ''; |
|
502 | - } |
|
503 | - |
|
504 | - if ($sort_by == 'count') { |
|
505 | - $child_cats = geodir_sort_terms($child_cats, 'count'); |
|
506 | - } |
|
507 | - |
|
508 | - $content = '<li class="gd-cptcat-li gd-cptcat-li-sub"><ul class="gd-cptcat-ul gd-cptcat-sub gd-cptcat-sub-' . $depth . '">'; |
|
509 | - $depth++; |
|
510 | - foreach ($child_cats as $category) { |
|
511 | - $term_icon_url = !empty($term_icons) && isset($term_icons[$category->term_id]) ? $term_icons[$category->term_id] : ''; |
|
512 | - $term_icon_url = $term_icon_url != '' ? '<img alt="' . esc_attr($category->name) . ' icon" src="' . $term_icon_url . '" /> ' : ''; |
|
513 | - $term_link = get_term_link( $category, $category->taxonomy ); |
|
514 | - /** Filter documented in geodirectory-functions/general_functions.php **/ |
|
515 | - $term_link = apply_filters( 'geodir_category_term_link', $term_link, $category->term_id, $cpt ); |
|
516 | - $count = $show_count ? ' <span class="gd-cptcat-count">(' . $category->count . ')</span>' : ''; |
|
517 | - |
|
518 | - $content .= '<li class="gd-cptcat-li gd-cptcat-li-sub">'; |
|
519 | - $content .= '<a href="' . esc_url($term_link) . '" title="' . esc_attr($category->name) . '">' . $term_icon_url . $category->name . $count . '</a></li>'; |
|
520 | - $content .= geodir_cpt_categories_child_cats($category->term_id, $cpt, $hide_empty, $show_count, $sort_by, $max_count, $max_level, $term_icons, $depth); |
|
521 | - } |
|
522 | - $content .= '</li></ul>'; |
|
523 | - |
|
524 | - return $content; |
|
482 | + $cat_taxonomy = $cpt . 'category'; |
|
483 | + |
|
484 | + $orderby = 'count'; |
|
485 | + $order = 'DESC'; |
|
486 | + if ($sort_by == 'az') { |
|
487 | + $orderby = 'name'; |
|
488 | + $order = 'ASC'; |
|
489 | + } |
|
490 | + |
|
491 | + if ($max_level != 'all' && $depth > (int)$max_level ) { |
|
492 | + return ''; |
|
493 | + } |
|
494 | + |
|
495 | + $child_cats = get_terms($cat_taxonomy, array('orderby' => $orderby, 'order' => $order, 'hide_empty' => $hide_empty, 'parent' => $parent_id, 'number' => $max_count)); |
|
496 | + if ($hide_empty) { |
|
497 | + $child_cats = geodir_filter_empty_terms($child_cats); |
|
498 | + } |
|
499 | + |
|
500 | + if (empty($child_cats)) { |
|
501 | + return ''; |
|
502 | + } |
|
503 | + |
|
504 | + if ($sort_by == 'count') { |
|
505 | + $child_cats = geodir_sort_terms($child_cats, 'count'); |
|
506 | + } |
|
507 | + |
|
508 | + $content = '<li class="gd-cptcat-li gd-cptcat-li-sub"><ul class="gd-cptcat-ul gd-cptcat-sub gd-cptcat-sub-' . $depth . '">'; |
|
509 | + $depth++; |
|
510 | + foreach ($child_cats as $category) { |
|
511 | + $term_icon_url = !empty($term_icons) && isset($term_icons[$category->term_id]) ? $term_icons[$category->term_id] : ''; |
|
512 | + $term_icon_url = $term_icon_url != '' ? '<img alt="' . esc_attr($category->name) . ' icon" src="' . $term_icon_url . '" /> ' : ''; |
|
513 | + $term_link = get_term_link( $category, $category->taxonomy ); |
|
514 | + /** Filter documented in geodirectory-functions/general_functions.php **/ |
|
515 | + $term_link = apply_filters( 'geodir_category_term_link', $term_link, $category->term_id, $cpt ); |
|
516 | + $count = $show_count ? ' <span class="gd-cptcat-count">(' . $category->count . ')</span>' : ''; |
|
517 | + |
|
518 | + $content .= '<li class="gd-cptcat-li gd-cptcat-li-sub">'; |
|
519 | + $content .= '<a href="' . esc_url($term_link) . '" title="' . esc_attr($category->name) . '">' . $term_icon_url . $category->name . $count . '</a></li>'; |
|
520 | + $content .= geodir_cpt_categories_child_cats($category->term_id, $cpt, $hide_empty, $show_count, $sort_by, $max_count, $max_level, $term_icons, $depth); |
|
521 | + } |
|
522 | + $content .= '</li></ul>'; |
|
523 | + |
|
524 | + return $content; |
|
525 | 525 | } |
526 | 526 | ?> |
527 | 527 | \ No newline at end of file |
@@ -169,9 +169,9 @@ discard block |
||
169 | 169 | $output = geodir_cpt_categories_output($params); |
170 | 170 | |
171 | 171 | echo $args['before_widget']; |
172 | - if ( $params['title'] ) { |
|
172 | + if ($params['title']) { |
|
173 | 173 | echo '<div class="geodir_list_heading clearfix">'; |
174 | - echo $args['before_title'] . $params['title'] . $args['after_title']; |
|
174 | + echo $args['before_title'].$params['title'].$args['after_title']; |
|
175 | 175 | echo '</div>'; |
176 | 176 | } |
177 | 177 | echo '<div class="gd-cptcats-widget">'; |
@@ -218,7 +218,7 @@ discard block |
||
218 | 218 | * @param array $instance Previously saved values from database. |
219 | 219 | */ |
220 | 220 | public function form($instance) { |
221 | - $instance = wp_parse_args( (array)$instance, |
|
221 | + $instance = wp_parse_args((array) $instance, |
|
222 | 222 | array( |
223 | 223 | 'title' => '', |
224 | 224 | 'post_type' => array(), // NULL for all |
@@ -252,50 +252,50 @@ discard block |
||
252 | 252 | <p> |
253 | 253 | <label for="<?php echo $this->get_field_id('post_type'); ?>"><?php _e('Select CPT:', 'geodirectory'); ?></label> |
254 | 254 | <select name="<?php echo $this->get_field_name('post_type'); ?>[]" id="<?php echo $this->get_field_id('post_type'); ?>" class="widefat" multiple="multiple"> |
255 | - <option value="0" <?php selected( (empty($post_type) || (is_array($post_type) && in_array('0', $post_type))), true ); ?>><?php _e('All', 'geodirectory'); ?></option> |
|
255 | + <option value="0" <?php selected((empty($post_type) || (is_array($post_type) && in_array('0', $post_type))), true); ?>><?php _e('All', 'geodirectory'); ?></option> |
|
256 | 256 | <?php foreach ($post_type_options as $name => $title) { ?> |
257 | - <option value="<?php echo $name;?>" <?php selected( is_array($post_type) && in_array($name, $post_type), true ); ?>><?php echo $title; ?></option> |
|
257 | + <option value="<?php echo $name; ?>" <?php selected(is_array($post_type) && in_array($name, $post_type), true); ?>><?php echo $title; ?></option> |
|
258 | 258 | <?php } ?> |
259 | 259 | </select> |
260 | 260 | </p> |
261 | - <p><input type="checkbox" class="checkbox" id="<?php echo $this->get_field_id('hide_empty'); ?>" name="<?php echo $this->get_field_name('hide_empty'); ?>"<?php checked( $hide_empty ); ?> value="1" /> |
|
262 | - <label for="<?php echo $this->get_field_id('hide_empty'); ?>"><?php _e( 'Hide empty categories', 'geodirectory' ); ?></label><br /> |
|
263 | - <input type="checkbox" class="checkbox" id="<?php echo $this->get_field_id('show_count'); ?>" name="<?php echo $this->get_field_name('show_count'); ?>"<?php checked( $show_count ); ?> value="1" /> |
|
264 | - <label for="<?php echo $this->get_field_id('show_count'); ?>"><?php _e( 'Show category count' ); ?></label> <small><?php _e( '( Enabling will slow down page loading for big directories. )', 'geodirectory' ); ?></small><br /> |
|
265 | - <input type="checkbox" class="checkbox" id="<?php echo $this->get_field_id('hide_icon'); ?>" name="<?php echo $this->get_field_name('hide_icon'); ?>"<?php checked( $hide_icon ); ?> value="1" /> |
|
266 | - <label for="<?php echo $this->get_field_id('hide_icon'); ?>"><?php _e( 'Hide category icon', 'geodirectory' ); ?></label><br /> |
|
267 | - <input type="checkbox" class="checkbox" id="<?php echo $this->get_field_id('cpt_left'); ?>" name="<?php echo $this->get_field_name('cpt_left'); ?>"<?php checked( $cpt_left ); ?> value="1" /> |
|
268 | - <label for="<?php echo $this->get_field_id('cpt_left'); ?>"><?php _e( 'Show CPT on same line', 'geodirectory' ); ?></label> |
|
261 | + <p><input type="checkbox" class="checkbox" id="<?php echo $this->get_field_id('hide_empty'); ?>" name="<?php echo $this->get_field_name('hide_empty'); ?>"<?php checked($hide_empty); ?> value="1" /> |
|
262 | + <label for="<?php echo $this->get_field_id('hide_empty'); ?>"><?php _e('Hide empty categories', 'geodirectory'); ?></label><br /> |
|
263 | + <input type="checkbox" class="checkbox" id="<?php echo $this->get_field_id('show_count'); ?>" name="<?php echo $this->get_field_name('show_count'); ?>"<?php checked($show_count); ?> value="1" /> |
|
264 | + <label for="<?php echo $this->get_field_id('show_count'); ?>"><?php _e('Show category count'); ?></label> <small><?php _e('( Enabling will slow down page loading for big directories. )', 'geodirectory'); ?></small><br /> |
|
265 | + <input type="checkbox" class="checkbox" id="<?php echo $this->get_field_id('hide_icon'); ?>" name="<?php echo $this->get_field_name('hide_icon'); ?>"<?php checked($hide_icon); ?> value="1" /> |
|
266 | + <label for="<?php echo $this->get_field_id('hide_icon'); ?>"><?php _e('Hide category icon', 'geodirectory'); ?></label><br /> |
|
267 | + <input type="checkbox" class="checkbox" id="<?php echo $this->get_field_id('cpt_left'); ?>" name="<?php echo $this->get_field_name('cpt_left'); ?>"<?php checked($cpt_left); ?> value="1" /> |
|
268 | + <label for="<?php echo $this->get_field_id('cpt_left'); ?>"><?php _e('Show CPT on same line', 'geodirectory'); ?></label> |
|
269 | 269 | <p> |
270 | 270 | <label for="<?php echo $this->get_field_id('sort_by'); ?>"><?php _e('Sort by:', 'geodirectory'); ?></label> |
271 | 271 | <select name="<?php echo $this->get_field_name('sort_by'); ?>" id="<?php echo $this->get_field_id('sort_by'); ?>" class="widefat"> |
272 | - <option value="az" <?php selected( $sort_by, 'az' ); ?>><?php _e('A-Z', 'geodirectory'); ?></option> |
|
273 | - <option value="count" <?php selected( $sort_by, 'count' ); ?>><?php _e('Count', 'geodirectory'); ?></option> |
|
272 | + <option value="az" <?php selected($sort_by, 'az'); ?>><?php _e('A-Z', 'geodirectory'); ?></option> |
|
273 | + <option value="count" <?php selected($sort_by, 'count'); ?>><?php _e('Count', 'geodirectory'); ?></option> |
|
274 | 274 | </select> |
275 | 275 | </p> |
276 | 276 | <p> |
277 | 277 | <label for="<?php echo $this->get_field_id('max_count'); ?>"><?php _e('Max no of sub-categories:', 'geodirectory'); ?></label> |
278 | 278 | <select name="<?php echo $this->get_field_name('max_count'); ?>" id="<?php echo $this->get_field_id('max_count'); ?>" class="widefat"> |
279 | - <option value="all" <?php selected( $max_count, 'all' ); ?>><?php _e('All', 'geodirectory'); ?></option> |
|
279 | + <option value="all" <?php selected($max_count, 'all'); ?>><?php _e('All', 'geodirectory'); ?></option> |
|
280 | 280 | <?php for ($n = 10; $n >= 0; $n--) { ?> |
281 | - <option value="<?php echo $n;?>" <?php selected( $max_count, $n ); ?>><?php echo $n; ?></option> |
|
281 | + <option value="<?php echo $n; ?>" <?php selected($max_count, $n); ?>><?php echo $n; ?></option> |
|
282 | 282 | <?php } ?> |
283 | 283 | </select> |
284 | 284 | </p> |
285 | 285 | <p> |
286 | 286 | <label for="<?php echo $this->get_field_id('max_level'); ?>"><?php _e('Show max sub-categories depth:', 'geodirectory'); ?></label> |
287 | 287 | <select name="<?php echo $this->get_field_name('max_level'); ?>" id="<?php echo $this->get_field_id('max_level'); ?>" class="widefat"> |
288 | - <option value="all" <?php selected( $max_level, 'all' ); ?>><?php _e('All', 'geodirectory'); ?></option> |
|
288 | + <option value="all" <?php selected($max_level, 'all'); ?>><?php _e('All', 'geodirectory'); ?></option> |
|
289 | 289 | <?php for ($n = 0; $n <= 10; $n++) { ?> |
290 | - <option value="<?php echo $n;?>" <?php selected( $max_level, $n ); ?>><?php echo $n; ?></option> |
|
290 | + <option value="<?php echo $n; ?>" <?php selected($max_level, $n); ?>><?php echo $n; ?></option> |
|
291 | 291 | <?php } ?> |
292 | 292 | </select> |
293 | 293 | </p> |
294 | 294 | <p> |
295 | - <input type="checkbox" class="checkbox" id="<?php echo $this->get_field_id('no_cpt_filter'); ?>" name="<?php echo $this->get_field_name('no_cpt_filter'); ?>"<?php checked( $no_cpt_filter ); ?> value="1" /> |
|
296 | - <label for="<?php echo $this->get_field_id('no_cpt_filter'); ?>"><?php _e( 'Don\'t filter for current viewing post type', 'geodirectory' ); ?></label> |
|
297 | - <input type="checkbox" class="checkbox" id="<?php echo $this->get_field_id('no_cat_filter'); ?>" name="<?php echo $this->get_field_name('no_cat_filter'); ?>"<?php checked( $no_cat_filter ); ?> value="1" /> |
|
298 | - <label for="<?php echo $this->get_field_id('no_cat_filter'); ?>"><?php _e( 'Don\'t filter for current viewing category', 'geodirectory' ); ?></label> |
|
295 | + <input type="checkbox" class="checkbox" id="<?php echo $this->get_field_id('no_cpt_filter'); ?>" name="<?php echo $this->get_field_name('no_cpt_filter'); ?>"<?php checked($no_cpt_filter); ?> value="1" /> |
|
296 | + <label for="<?php echo $this->get_field_id('no_cpt_filter'); ?>"><?php _e('Don\'t filter for current viewing post type', 'geodirectory'); ?></label> |
|
297 | + <input type="checkbox" class="checkbox" id="<?php echo $this->get_field_id('no_cat_filter'); ?>" name="<?php echo $this->get_field_name('no_cat_filter'); ?>"<?php checked($no_cat_filter); ?> value="1" /> |
|
298 | + <label for="<?php echo $this->get_field_id('no_cat_filter'); ?>"><?php _e('Don\'t filter for current viewing category', 'geodirectory'); ?></label> |
|
299 | 299 | </p> |
300 | 300 | <?php |
301 | 301 | } |
@@ -313,7 +313,7 @@ discard block |
||
313 | 313 | * @return string CPT categories content. |
314 | 314 | */ |
315 | 315 | function geodir_cpt_categories_output($params) { |
316 | - $args = wp_parse_args((array)$params, |
|
316 | + $args = wp_parse_args((array) $params, |
|
317 | 317 | array( |
318 | 318 | 'title' => '', |
319 | 319 | 'post_type' => array(), // NULL for all |
@@ -351,7 +351,7 @@ discard block |
||
351 | 351 | $current_taxonomy = get_query_var('taxonomy'); |
352 | 352 | $current_posttype = geodir_get_current_posttype(); |
353 | 353 | |
354 | - if ($current_term_id && $current_posttype && get_query_var('taxonomy') == $current_posttype . 'category') { |
|
354 | + if ($current_term_id && $current_posttype && get_query_var('taxonomy') == $current_posttype.'category') { |
|
355 | 355 | $is_category = true; |
356 | 356 | } |
357 | 357 | } |
@@ -383,15 +383,15 @@ discard block |
||
383 | 383 | $hide_empty = !empty($args['hide_empty']) ? true : false; |
384 | 384 | $max_count = strip_tags($args['max_count']); |
385 | 385 | $all_childs = $max_count == 'all' ? true : false; |
386 | - $max_count = $max_count > 0 ? (int)$max_count : 0; |
|
386 | + $max_count = $max_count > 0 ? (int) $max_count : 0; |
|
387 | 387 | $max_level = strip_tags($args['max_level']); |
388 | 388 | $show_count = !empty($args['show_count']) ? true : false; |
389 | 389 | $hide_icon = !empty($args['hide_icon']) ? true : false; |
390 | 390 | $cpt_left = !empty($args['cpt_left']) ? true : false; |
391 | 391 | |
392 | - if(!$cpt_left){ |
|
392 | + if (!$cpt_left) { |
|
393 | 393 | $cpt_left = "gd-cpt-flat"; |
394 | - }else{ |
|
394 | + } else { |
|
395 | 395 | $cpt_left = ''; |
396 | 396 | } |
397 | 397 | |
@@ -406,7 +406,7 @@ discard block |
||
406 | 406 | if (!empty($post_types)) { |
407 | 407 | foreach ($post_types as $cpt => $cpt_info) { |
408 | 408 | $parent_category = ($is_category && $cat_filter && $cpt == $current_posttype) ? $current_term_id : 0; |
409 | - $cat_taxonomy = $cpt . 'category'; |
|
409 | + $cat_taxonomy = $cpt.'category'; |
|
410 | 410 | $categories = get_terms($cat_taxonomy, array('orderby' => $orderby, 'order' => $order, 'hide_empty' => $hide_empty, 'parent' => $parent_category)); |
411 | 411 | if ($hide_empty) { |
412 | 412 | $categories = geodir_filter_empty_terms($categories); |
@@ -422,32 +422,32 @@ discard block |
||
422 | 422 | if ($is_listing) { |
423 | 423 | $row_class = $is_category ? ' gd-cptcat-categ' : ' gd-cptcat-listing'; |
424 | 424 | } |
425 | - $cpt_row = '<div class="gd-cptcat-row gd-cptcat-' . $cpt . $row_class . ' '.$cpt_left.'">'; |
|
425 | + $cpt_row = '<div class="gd-cptcat-row gd-cptcat-'.$cpt.$row_class.' '.$cpt_left.'">'; |
|
426 | 426 | |
427 | 427 | if ($is_category && $cat_filter && $cpt == $current_posttype) { |
428 | 428 | $term_info = get_term($current_term_id, $cat_taxonomy); |
429 | 429 | |
430 | 430 | $term_icon_url = !empty($term_icons) && isset($term_icons[$term_info->term_id]) ? $term_icons[$term_info->term_id] : ''; |
431 | - $term_icon_url = $term_icon_url != '' ? '<img alt="' . esc_attr($term_info->name) . ' icon" src="' . $term_icon_url . '" /> ' : ''; |
|
431 | + $term_icon_url = $term_icon_url != '' ? '<img alt="'.esc_attr($term_info->name).' icon" src="'.$term_icon_url.'" /> ' : ''; |
|
432 | 432 | |
433 | - $count = $show_count ? ' <span class="gd-cptcat-count">(' . $term_info->count . ')</span>' : ''; |
|
434 | - $cpt_row .= '<h2 class="gd-cptcat-title">' . $term_icon_url . $term_info->name . $count . '</h2>'; |
|
433 | + $count = $show_count ? ' <span class="gd-cptcat-count">('.$term_info->count.')</span>' : ''; |
|
434 | + $cpt_row .= '<h2 class="gd-cptcat-title">'.$term_icon_url.$term_info->name.$count.'</h2>'; |
|
435 | 435 | } else { |
436 | - $cpt_row .= '<h2 class="gd-cptcat-title">' . __($cpt_info['labels']['name'], 'geodirectory') . '</h2>'; |
|
436 | + $cpt_row .= '<h2 class="gd-cptcat-title">'.__($cpt_info['labels']['name'], 'geodirectory').'</h2>'; |
|
437 | 437 | } |
438 | 438 | foreach ($categories as $category) { |
439 | 439 | $term_icon_url = !empty($term_icons) && isset($term_icons[$category->term_id]) ? $term_icons[$category->term_id] : ''; |
440 | - $term_icon_url = $term_icon_url != '' ? '<img alt="' . esc_attr($category->name) . ' icon" src="' . $term_icon_url . '" /> ' : ''; |
|
440 | + $term_icon_url = $term_icon_url != '' ? '<img alt="'.esc_attr($category->name).' icon" src="'.$term_icon_url.'" /> ' : ''; |
|
441 | 441 | |
442 | - $term_link = get_term_link( $category, $category->taxonomy ); |
|
442 | + $term_link = get_term_link($category, $category->taxonomy); |
|
443 | 443 | /** Filter documented in geodirectory-functions/general_functions.php **/ |
444 | - $term_link = apply_filters( 'geodir_category_term_link', $term_link, $category->term_id, $cpt ); |
|
444 | + $term_link = apply_filters('geodir_category_term_link', $term_link, $category->term_id, $cpt); |
|
445 | 445 | |
446 | 446 | $cpt_row .= '<ul class="gd-cptcat-ul gd-cptcat-parent '.$cpt_left.'">'; |
447 | 447 | $cpt_row .= '<li class="gd-cptcat-li gd-cptcat-li-main">'; |
448 | - $count = $show_count ? ' <span class="gd-cptcat-count">(' . $category->count . ')</span>' : ''; |
|
449 | - $cpt_row .= '<h3 class="gd-cptcat-cat"><a href="' . esc_url($term_link) . '" title="' . esc_attr($category->name) . '">' .$term_icon_url . $category->name . $count . '</a></h3>'; |
|
450 | - if (($all_childs || $max_count > 0) && ($max_level == 'all' || (int)$max_level > 0)) { |
|
448 | + $count = $show_count ? ' <span class="gd-cptcat-count">('.$category->count.')</span>' : ''; |
|
449 | + $cpt_row .= '<h3 class="gd-cptcat-cat"><a href="'.esc_url($term_link).'" title="'.esc_attr($category->name).'">'.$term_icon_url.$category->name.$count.'</a></h3>'; |
|
450 | + if (($all_childs || $max_count > 0) && ($max_level == 'all' || (int) $max_level > 0)) { |
|
451 | 451 | $cpt_row .= geodir_cpt_categories_child_cats($category->term_id, $cpt, $hide_empty, $show_count, $sort_by, $max_count, $max_level, $term_icons); |
452 | 452 | } |
453 | 453 | $cpt_row .= '</li>'; |
@@ -479,7 +479,7 @@ discard block |
||
479 | 479 | * @return string Html content. |
480 | 480 | */ |
481 | 481 | function geodir_cpt_categories_child_cats($parent_id, $cpt, $hide_empty, $show_count, $sort_by, $max_count, $max_level, $term_icons, $depth = 1) { |
482 | - $cat_taxonomy = $cpt . 'category'; |
|
482 | + $cat_taxonomy = $cpt.'category'; |
|
483 | 483 | |
484 | 484 | $orderby = 'count'; |
485 | 485 | $order = 'DESC'; |
@@ -488,7 +488,7 @@ discard block |
||
488 | 488 | $order = 'ASC'; |
489 | 489 | } |
490 | 490 | |
491 | - if ($max_level != 'all' && $depth > (int)$max_level ) { |
|
491 | + if ($max_level != 'all' && $depth > (int) $max_level) { |
|
492 | 492 | return ''; |
493 | 493 | } |
494 | 494 | |
@@ -505,18 +505,18 @@ discard block |
||
505 | 505 | $child_cats = geodir_sort_terms($child_cats, 'count'); |
506 | 506 | } |
507 | 507 | |
508 | - $content = '<li class="gd-cptcat-li gd-cptcat-li-sub"><ul class="gd-cptcat-ul gd-cptcat-sub gd-cptcat-sub-' . $depth . '">'; |
|
508 | + $content = '<li class="gd-cptcat-li gd-cptcat-li-sub"><ul class="gd-cptcat-ul gd-cptcat-sub gd-cptcat-sub-'.$depth.'">'; |
|
509 | 509 | $depth++; |
510 | 510 | foreach ($child_cats as $category) { |
511 | 511 | $term_icon_url = !empty($term_icons) && isset($term_icons[$category->term_id]) ? $term_icons[$category->term_id] : ''; |
512 | - $term_icon_url = $term_icon_url != '' ? '<img alt="' . esc_attr($category->name) . ' icon" src="' . $term_icon_url . '" /> ' : ''; |
|
513 | - $term_link = get_term_link( $category, $category->taxonomy ); |
|
512 | + $term_icon_url = $term_icon_url != '' ? '<img alt="'.esc_attr($category->name).' icon" src="'.$term_icon_url.'" /> ' : ''; |
|
513 | + $term_link = get_term_link($category, $category->taxonomy); |
|
514 | 514 | /** Filter documented in geodirectory-functions/general_functions.php **/ |
515 | - $term_link = apply_filters( 'geodir_category_term_link', $term_link, $category->term_id, $cpt ); |
|
516 | - $count = $show_count ? ' <span class="gd-cptcat-count">(' . $category->count . ')</span>' : ''; |
|
515 | + $term_link = apply_filters('geodir_category_term_link', $term_link, $category->term_id, $cpt); |
|
516 | + $count = $show_count ? ' <span class="gd-cptcat-count">('.$category->count.')</span>' : ''; |
|
517 | 517 | |
518 | 518 | $content .= '<li class="gd-cptcat-li gd-cptcat-li-sub">'; |
519 | - $content .= '<a href="' . esc_url($term_link) . '" title="' . esc_attr($category->name) . '">' . $term_icon_url . $category->name . $count . '</a></li>'; |
|
519 | + $content .= '<a href="'.esc_url($term_link).'" title="'.esc_attr($category->name).'">'.$term_icon_url.$category->name.$count.'</a></li>'; |
|
520 | 520 | $content .= geodir_cpt_categories_child_cats($category->term_id, $cpt, $hide_empty, $show_count, $sort_by, $max_count, $max_level, $term_icons, $depth); |
521 | 521 | } |
522 | 522 | $content .= '</li></ul>'; |
@@ -137,7 +137,7 @@ discard block |
||
137 | 137 | public function form($instance) |
138 | 138 | { |
139 | 139 | //widgetform in backend |
140 | - $instance = wp_parse_args((array)$instance, |
|
140 | + $instance = wp_parse_args((array) $instance, |
|
141 | 141 | array('title' => '', |
142 | 142 | 'list_sort' => '', |
143 | 143 | 'list_order' => '', |
@@ -169,7 +169,7 @@ discard block |
||
169 | 169 | |
170 | 170 | ?> |
171 | 171 | <p> |
172 | - <label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title:', 'geodirectory');?> |
|
172 | + <label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title:', 'geodirectory'); ?> |
|
173 | 173 | |
174 | 174 | <input class="widefat" id="<?php echo $this->get_field_id('title'); ?>" |
175 | 175 | name="<?php echo $this->get_field_name('title'); ?>" type="text" |
@@ -178,7 +178,7 @@ discard block |
||
178 | 178 | </p> |
179 | 179 | <p> |
180 | 180 | <label |
181 | - for="<?php echo $this->get_field_id('list_sort'); ?>"><?php _e('Sort by:', 'geodirectory');?> |
|
181 | + for="<?php echo $this->get_field_id('list_sort'); ?>"><?php _e('Sort by:', 'geodirectory'); ?> |
|
182 | 182 | |
183 | 183 | <select class="widefat" id="<?php echo $this->get_field_id('list_sort'); ?>" |
184 | 184 | name="<?php echo $this->get_field_name('list_sort'); ?>"> |
@@ -208,7 +208,7 @@ discard block |
||
208 | 208 | </p> |
209 | 209 | <p> |
210 | 210 | <label |
211 | - for="<?php echo $this->get_field_id('post_number'); ?>"><?php _e('Number of posts:', 'geodirectory');?> |
|
211 | + for="<?php echo $this->get_field_id('post_number'); ?>"><?php _e('Number of posts:', 'geodirectory'); ?> |
|
212 | 212 | |
213 | 213 | <input class="widefat" id="<?php echo $this->get_field_id('post_number'); ?>" |
214 | 214 | name="<?php echo $this->get_field_name('post_number'); ?>" type="text" |
@@ -217,7 +217,7 @@ discard block |
||
217 | 217 | </p> |
218 | 218 | <p> |
219 | 219 | <label for="<?php echo $this->get_field_id('relate_to'); ?>"> |
220 | - <?php _e('Relate to:', 'geodirectory');?> |
|
220 | + <?php _e('Relate to:', 'geodirectory'); ?> |
|
221 | 221 | <select class="widefat" id="<?php echo $this->get_field_id('relate_to'); ?>" |
222 | 222 | name="<?php echo $this->get_field_name('relate_to'); ?>"> |
223 | 223 | <option <?php if ($relate_to == 'category') { |
@@ -232,7 +232,7 @@ discard block |
||
232 | 232 | <p> |
233 | 233 | <p> |
234 | 234 | <label for="<?php echo $this->get_field_id('layout'); ?>"> |
235 | - <?php _e('Layout:', 'geodirectory');?> |
|
235 | + <?php _e('Layout:', 'geodirectory'); ?> |
|
236 | 236 | <select class="widefat" id="<?php echo $this->get_field_id('layout'); ?>" |
237 | 237 | name="<?php echo $this->get_field_name('layout'); ?>"> |
238 | 238 | <option <?php if ($layout == 'gridview_onehalf') { |
@@ -260,7 +260,7 @@ discard block |
||
260 | 260 | </p> |
261 | 261 | <p> |
262 | 262 | <label |
263 | - for="<?php echo $this->get_field_id('listing_width'); ?>"><?php _e('Listing width:', 'geodirectory');?> |
|
263 | + for="<?php echo $this->get_field_id('listing_width'); ?>"><?php _e('Listing width:', 'geodirectory'); ?> |
|
264 | 264 | |
265 | 265 | <input class="widefat" id="<?php echo $this->get_field_id('listing_width'); ?>" |
266 | 266 | name="<?php echo $this->get_field_name('listing_width'); ?>" type="text" |
@@ -269,7 +269,7 @@ discard block |
||
269 | 269 | </p> |
270 | 270 | <p> |
271 | 271 | <label |
272 | - for="<?php echo $this->get_field_id('character_count'); ?>"><?php _e('Post Content excerpt character count :', 'geodirectory');?> |
|
272 | + for="<?php echo $this->get_field_id('character_count'); ?>"><?php _e('Post Content excerpt character count :', 'geodirectory'); ?> |
|
273 | 273 | <input class="widefat" id="<?php echo $this->get_field_id('character_count'); ?>" |
274 | 274 | name="<?php echo $this->get_field_name('character_count'); ?>" type="text" |
275 | 275 | value="<?php echo esc_attr($character_count); ?>"/> |
@@ -277,9 +277,9 @@ discard block |
||
277 | 277 | </p> |
278 | 278 | <p> |
279 | 279 | <label for="<?php echo $this->get_field_id('add_location_filter'); ?>"> |
280 | - <?php _e('Enable Location Filter:', 'geodirectory');?> |
|
280 | + <?php _e('Enable Location Filter:', 'geodirectory'); ?> |
|
281 | 281 | <input type="checkbox" id="<?php echo $this->get_field_id('add_location_filter'); ?>" |
282 | - name="<?php echo $this->get_field_name('add_location_filter'); ?>" <?php if ($add_location_filter) echo 'checked="checked"';?> |
|
282 | + name="<?php echo $this->get_field_name('add_location_filter'); ?>" <?php if ($add_location_filter) echo 'checked="checked"'; ?> |
|
283 | 283 | value="1"/> |
284 | 284 | </label> |
285 | 285 | </p> |
@@ -14,160 +14,160 @@ discard block |
||
14 | 14 | */ |
15 | 15 | class geodir_related_listing_postview extends WP_Widget |
16 | 16 | { |
17 | - /** |
|
17 | + /** |
|
18 | 18 | * Register the related listing widget. |
19 | 19 | * |
20 | 20 | * @since 1.0.0 |
21 | - * @since 1.5.1 Changed from PHP4 style constructors to PHP5 __construct. |
|
21 | + * @since 1.5.1 Changed from PHP4 style constructors to PHP5 __construct. |
|
22 | 22 | */ |
23 | - public function __construct() { |
|
24 | - $widget_ops = array('classname' => 'geodir_related_listing_post_view', 'description' => __('GD > Related Listing', 'geodirectory')); |
|
25 | - parent::__construct( |
|
26 | - 'post_related_listing', // Base ID |
|
27 | - __('GD > Related Listing', 'geodirectory'), // Name |
|
28 | - $widget_ops// Args |
|
29 | - ); |
|
30 | - } |
|
23 | + public function __construct() { |
|
24 | + $widget_ops = array('classname' => 'geodir_related_listing_post_view', 'description' => __('GD > Related Listing', 'geodirectory')); |
|
25 | + parent::__construct( |
|
26 | + 'post_related_listing', // Base ID |
|
27 | + __('GD > Related Listing', 'geodirectory'), // Name |
|
28 | + $widget_ops// Args |
|
29 | + ); |
|
30 | + } |
|
31 | 31 | |
32 | 32 | /** |
33 | 33 | * Front-end display content for related listing widget. |
34 | 34 | * |
35 | 35 | * @since 1.0.0 |
36 | - * @since 1.5.1 Declare function public. |
|
36 | + * @since 1.5.1 Declare function public. |
|
37 | 37 | * |
38 | 38 | * @param array $args Widget arguments. |
39 | 39 | * @param array $instance Saved values from database. |
40 | 40 | */ |
41 | - public function widget($args, $instance) |
|
42 | - { |
|
41 | + public function widget($args, $instance) |
|
42 | + { |
|
43 | 43 | |
44 | - // prints the widget |
|
45 | - extract($args, EXTR_SKIP); |
|
44 | + // prints the widget |
|
45 | + extract($args, EXTR_SKIP); |
|
46 | 46 | |
47 | - /** This filter is documented in geodirectory_widgets.php */ |
|
48 | - $title = empty($instance['title']) ? __('Related Listing', 'geodirectory') : apply_filters('widget_title', __($instance['title'], 'geodirectory')); |
|
47 | + /** This filter is documented in geodirectory_widgets.php */ |
|
48 | + $title = empty($instance['title']) ? __('Related Listing', 'geodirectory') : apply_filters('widget_title', __($instance['title'], 'geodirectory')); |
|
49 | 49 | |
50 | - /** This filter is documented in geodirectory-functions/general_functions.php */ |
|
50 | + /** This filter is documented in geodirectory-functions/general_functions.php */ |
|
51 | 51 | $post_number = empty($instance['post_number']) ? '5' : apply_filters('widget_post_number', $instance['post_number']); |
52 | 52 | |
53 | - /** |
|
54 | - * Filter the relation type to get related listing. |
|
55 | - * |
|
56 | - * @since 1.0.0 |
|
57 | - * @param string $instance['relate_to'] Can be tags or category. |
|
58 | - */ |
|
53 | + /** |
|
54 | + * Filter the relation type to get related listing. |
|
55 | + * |
|
56 | + * @since 1.0.0 |
|
57 | + * @param string $instance['relate_to'] Can be tags or category. |
|
58 | + */ |
|
59 | 59 | $relate_to = empty($instance['relate_to']) ? 'category' : apply_filters('widget_relate_to', $instance['relate_to']); |
60 | 60 | |
61 | - /** This filter is documented in geodirectory-functions/general_functions.php */ |
|
61 | + /** This filter is documented in geodirectory-functions/general_functions.php */ |
|
62 | 62 | $layout = empty($instance['layout']) ? 'gridview_onehalf' : apply_filters('widget_layout', $instance['layout']); |
63 | 63 | |
64 | - /** This filter is documented in geodirectory-functions/general_functions.php */ |
|
64 | + /** This filter is documented in geodirectory-functions/general_functions.php */ |
|
65 | 65 | $add_location_filter = empty($instance['add_location_filter']) ? '0' : apply_filters('widget_add_location_filter', $instance['add_location_filter']); |
66 | 66 | |
67 | - /** This filter is documented in geodirectory-functions/general_functions.php */ |
|
67 | + /** This filter is documented in geodirectory-functions/general_functions.php */ |
|
68 | 68 | $listing_width = empty($instance['listing_width']) ? '' : apply_filters('widget_listing_width', $instance['listing_width']); |
69 | 69 | |
70 | - /** This filter is documented in geodirectory-functions/general_functions.php */ |
|
70 | + /** This filter is documented in geodirectory-functions/general_functions.php */ |
|
71 | 71 | $list_sort = empty($instance['list_sort']) ? 'latest' : apply_filters('widget_list_sort', $instance['list_sort']); |
72 | 72 | |
73 | - /** This filter is documented in geodirectory-functions/general_functions.php */ |
|
73 | + /** This filter is documented in geodirectory-functions/general_functions.php */ |
|
74 | 74 | $character_count = empty($instance['character_count']) ? 20 : apply_filters('widget_list_character_count', $instance['character_count']); |
75 | 75 | |
76 | - $arr = array( |
|
77 | - 'before_title' => $before_title, |
|
78 | - 'after_title' => $after_title, |
|
79 | - 'title' => $title, |
|
80 | - 'post_number' => $post_number, |
|
81 | - 'relate_to' => $relate_to, |
|
82 | - 'layout' => $layout, |
|
83 | - 'add_location_filter' => $add_location_filter, |
|
84 | - 'listing_width' => $listing_width, |
|
85 | - 'list_sort' => $list_sort, |
|
86 | - 'character_count' => $character_count, |
|
87 | - 'is_widget' => '1' |
|
88 | - ); |
|
89 | - |
|
90 | - if ($widget_display = geodir_related_posts_display($arr)) { |
|
91 | - |
|
92 | - echo $before_widget; |
|
93 | - echo $widget_display; |
|
94 | - echo $after_widget; |
|
95 | - } |
|
96 | - } |
|
76 | + $arr = array( |
|
77 | + 'before_title' => $before_title, |
|
78 | + 'after_title' => $after_title, |
|
79 | + 'title' => $title, |
|
80 | + 'post_number' => $post_number, |
|
81 | + 'relate_to' => $relate_to, |
|
82 | + 'layout' => $layout, |
|
83 | + 'add_location_filter' => $add_location_filter, |
|
84 | + 'listing_width' => $listing_width, |
|
85 | + 'list_sort' => $list_sort, |
|
86 | + 'character_count' => $character_count, |
|
87 | + 'is_widget' => '1' |
|
88 | + ); |
|
89 | + |
|
90 | + if ($widget_display = geodir_related_posts_display($arr)) { |
|
91 | + |
|
92 | + echo $before_widget; |
|
93 | + echo $widget_display; |
|
94 | + echo $after_widget; |
|
95 | + } |
|
96 | + } |
|
97 | 97 | |
98 | 98 | /** |
99 | 99 | * Sanitize related listing widget form values as they are saved. |
100 | 100 | * |
101 | 101 | * @since 1.0.0 |
102 | - * @since 1.5.1 Declare function public. |
|
102 | + * @since 1.5.1 Declare function public. |
|
103 | 103 | * |
104 | 104 | * @param array $new_instance Values just sent to be saved. |
105 | 105 | * @param array $old_instance Previously saved values from database. |
106 | 106 | * |
107 | 107 | * @return array Updated safe values to be saved. |
108 | 108 | */ |
109 | - public function update($new_instance, $old_instance) |
|
110 | - { |
|
111 | - //save the widget |
|
112 | - $instance = $old_instance; |
|
113 | - |
|
114 | - $instance['title'] = strip_tags($new_instance['title']); |
|
115 | - $instance['post_number'] = strip_tags($new_instance['post_number']); |
|
116 | - $instance['relate_to'] = strip_tags($new_instance['relate_to']); |
|
117 | - $instance['layout'] = strip_tags($new_instance['layout']); |
|
118 | - $instance['listing_width'] = strip_tags($new_instance['listing_width']); |
|
119 | - $instance['list_sort'] = strip_tags($new_instance['list_sort']); |
|
120 | - $instance['character_count'] = $new_instance['character_count']; |
|
121 | - if (isset($new_instance['add_location_filter']) && $new_instance['add_location_filter'] != '') |
|
122 | - $instance['add_location_filter'] = strip_tags($new_instance['add_location_filter']); |
|
123 | - else |
|
124 | - $instance['add_location_filter'] = '0'; |
|
125 | - |
|
126 | - return $instance; |
|
127 | - } |
|
109 | + public function update($new_instance, $old_instance) |
|
110 | + { |
|
111 | + //save the widget |
|
112 | + $instance = $old_instance; |
|
113 | + |
|
114 | + $instance['title'] = strip_tags($new_instance['title']); |
|
115 | + $instance['post_number'] = strip_tags($new_instance['post_number']); |
|
116 | + $instance['relate_to'] = strip_tags($new_instance['relate_to']); |
|
117 | + $instance['layout'] = strip_tags($new_instance['layout']); |
|
118 | + $instance['listing_width'] = strip_tags($new_instance['listing_width']); |
|
119 | + $instance['list_sort'] = strip_tags($new_instance['list_sort']); |
|
120 | + $instance['character_count'] = $new_instance['character_count']; |
|
121 | + if (isset($new_instance['add_location_filter']) && $new_instance['add_location_filter'] != '') |
|
122 | + $instance['add_location_filter'] = strip_tags($new_instance['add_location_filter']); |
|
123 | + else |
|
124 | + $instance['add_location_filter'] = '0'; |
|
125 | + |
|
126 | + return $instance; |
|
127 | + } |
|
128 | 128 | |
129 | 129 | /** |
130 | 130 | * Back-end related listing widget settings form. |
131 | 131 | * |
132 | 132 | * @since 1.0.0 |
133 | - * @since 1.5.1 Declare function public. |
|
133 | + * @since 1.5.1 Declare function public. |
|
134 | 134 | * |
135 | 135 | * @param array $instance Previously saved values from database. |
136 | 136 | */ |
137 | - public function form($instance) |
|
138 | - { |
|
139 | - //widgetform in backend |
|
140 | - $instance = wp_parse_args((array)$instance, |
|
141 | - array('title' => '', |
|
142 | - 'list_sort' => '', |
|
143 | - 'list_order' => '', |
|
144 | - 'post_number' => '5', |
|
145 | - 'relate_to' => '', |
|
146 | - 'layout' => 'gridview_onehalf', |
|
147 | - 'listing_width' => '', |
|
148 | - 'add_location_filter' => '1', |
|
149 | - 'character_count' => '20') |
|
150 | - ); |
|
137 | + public function form($instance) |
|
138 | + { |
|
139 | + //widgetform in backend |
|
140 | + $instance = wp_parse_args((array)$instance, |
|
141 | + array('title' => '', |
|
142 | + 'list_sort' => '', |
|
143 | + 'list_order' => '', |
|
144 | + 'post_number' => '5', |
|
145 | + 'relate_to' => '', |
|
146 | + 'layout' => 'gridview_onehalf', |
|
147 | + 'listing_width' => '', |
|
148 | + 'add_location_filter' => '1', |
|
149 | + 'character_count' => '20') |
|
150 | + ); |
|
151 | 151 | |
152 | - $title = strip_tags($instance['title']); |
|
152 | + $title = strip_tags($instance['title']); |
|
153 | 153 | |
154 | - $list_sort = strip_tags($instance['list_sort']); |
|
154 | + $list_sort = strip_tags($instance['list_sort']); |
|
155 | 155 | |
156 | - $list_order = strip_tags($instance['list_order']); |
|
156 | + $list_order = strip_tags($instance['list_order']); |
|
157 | 157 | |
158 | - $post_number = strip_tags($instance['post_number']); |
|
158 | + $post_number = strip_tags($instance['post_number']); |
|
159 | 159 | |
160 | - $relate_to = strip_tags($instance['relate_to']); |
|
160 | + $relate_to = strip_tags($instance['relate_to']); |
|
161 | 161 | |
162 | - $layout = strip_tags($instance['layout']); |
|
162 | + $layout = strip_tags($instance['layout']); |
|
163 | 163 | |
164 | - $listing_width = strip_tags($instance['listing_width']); |
|
164 | + $listing_width = strip_tags($instance['listing_width']); |
|
165 | 165 | |
166 | - $add_location_filter = strip_tags($instance['add_location_filter']); |
|
166 | + $add_location_filter = strip_tags($instance['add_location_filter']); |
|
167 | 167 | |
168 | - $character_count = $instance['character_count']; |
|
168 | + $character_count = $instance['character_count']; |
|
169 | 169 | |
170 | - ?> |
|
170 | + ?> |
|
171 | 171 | <p> |
172 | 172 | <label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title:', 'geodirectory');?> |
173 | 173 | |
@@ -184,24 +184,24 @@ discard block |
||
184 | 184 | name="<?php echo $this->get_field_name('list_sort'); ?>"> |
185 | 185 | |
186 | 186 | <option <?php if ($list_sort == 'latest') { |
187 | - echo 'selected="selected"'; |
|
188 | - } ?> value="latest"><?php _e('Latest', 'geodirectory'); ?></option> |
|
187 | + echo 'selected="selected"'; |
|
188 | + } ?> value="latest"><?php _e('Latest', 'geodirectory'); ?></option> |
|
189 | 189 | |
190 | 190 | <option <?php if ($list_sort == 'featured') { |
191 | - echo 'selected="selected"'; |
|
192 | - } ?> value="featured"><?php _e('Featured', 'geodirectory'); ?></option> |
|
191 | + echo 'selected="selected"'; |
|
192 | + } ?> value="featured"><?php _e('Featured', 'geodirectory'); ?></option> |
|
193 | 193 | |
194 | 194 | <option <?php if ($list_sort == 'high_review') { |
195 | - echo 'selected="selected"'; |
|
196 | - } ?> value="high_review"><?php _e('Review', 'geodirectory'); ?></option> |
|
195 | + echo 'selected="selected"'; |
|
196 | + } ?> value="high_review"><?php _e('Review', 'geodirectory'); ?></option> |
|
197 | 197 | |
198 | 198 | <option <?php if ($list_sort == 'high_rating') { |
199 | - echo 'selected="selected"'; |
|
200 | - } ?> value="high_rating"><?php _e('Rating', 'geodirectory'); ?></option> |
|
199 | + echo 'selected="selected"'; |
|
200 | + } ?> value="high_rating"><?php _e('Rating', 'geodirectory'); ?></option> |
|
201 | 201 | |
202 | 202 | <option <?php if ($list_sort == 'random') { |
203 | - echo 'selected="selected"'; |
|
204 | - } ?> value="random"><?php _e('Random', 'geodirectory'); ?></option> |
|
203 | + echo 'selected="selected"'; |
|
204 | + } ?> value="random"><?php _e('Random', 'geodirectory'); ?></option> |
|
205 | 205 | |
206 | 206 | </select> |
207 | 207 | </label> |
@@ -221,11 +221,11 @@ discard block |
||
221 | 221 | <select class="widefat" id="<?php echo $this->get_field_id('relate_to'); ?>" |
222 | 222 | name="<?php echo $this->get_field_name('relate_to'); ?>"> |
223 | 223 | <option <?php if ($relate_to == 'category') { |
224 | - echo 'selected="selected"'; |
|
225 | - } ?> value="category"><?php _e('Categories', 'geodirectory'); ?></option> |
|
224 | + echo 'selected="selected"'; |
|
225 | + } ?> value="category"><?php _e('Categories', 'geodirectory'); ?></option> |
|
226 | 226 | <option <?php if ($relate_to == 'tags') { |
227 | - echo 'selected="selected"'; |
|
228 | - } ?> value="tags"><?php _e('Tags', 'geodirectory'); ?></option> |
|
227 | + echo 'selected="selected"'; |
|
228 | + } ?> value="tags"><?php _e('Tags', 'geodirectory'); ?></option> |
|
229 | 229 | </select> |
230 | 230 | </label> |
231 | 231 | </p> |
@@ -236,24 +236,24 @@ discard block |
||
236 | 236 | <select class="widefat" id="<?php echo $this->get_field_id('layout'); ?>" |
237 | 237 | name="<?php echo $this->get_field_name('layout'); ?>"> |
238 | 238 | <option <?php if ($layout == 'gridview_onehalf') { |
239 | - echo 'selected="selected"'; |
|
240 | - } ?> |
|
239 | + echo 'selected="selected"'; |
|
240 | + } ?> |
|
241 | 241 | value="gridview_onehalf"><?php _e('Grid View (Two Columns)', 'geodirectory'); ?></option> |
242 | 242 | <option <?php if ($layout == 'gridview_onethird') { |
243 | - echo 'selected="selected"'; |
|
244 | - } ?> |
|
243 | + echo 'selected="selected"'; |
|
244 | + } ?> |
|
245 | 245 | value="gridview_onethird"><?php _e('Grid View (Three Columns)', 'geodirectory'); ?></option> |
246 | 246 | <option <?php if ($layout == 'gridview_onefourth') { |
247 | - echo 'selected="selected"'; |
|
248 | - } ?> |
|
247 | + echo 'selected="selected"'; |
|
248 | + } ?> |
|
249 | 249 | value="gridview_onefourth"><?php _e('Grid View (Four Columns)', 'geodirectory'); ?></option> |
250 | 250 | <option <?php if ($layout == 'gridview_onefifth') { |
251 | - echo 'selected="selected"'; |
|
252 | - } ?> |
|
251 | + echo 'selected="selected"'; |
|
252 | + } ?> |
|
253 | 253 | value="gridview_onefifth"><?php _e('Grid View (Five Columns)', 'geodirectory'); ?></option> |
254 | 254 | <option <?php if ($layout == 'list') { |
255 | - echo 'selected="selected"'; |
|
256 | - } ?> value="list"><?php _e('List view', 'geodirectory'); ?></option> |
|
255 | + echo 'selected="selected"'; |
|
256 | + } ?> value="list"><?php _e('List view', 'geodirectory'); ?></option> |
|
257 | 257 | |
258 | 258 | </select> |
259 | 259 | </label> |
@@ -285,7 +285,7 @@ discard block |
||
285 | 285 | </p> |
286 | 286 | |
287 | 287 | <?php |
288 | - } |
|
288 | + } |
|
289 | 289 | } // class geodir_related_listing_postview |
290 | 290 | |
291 | 291 | register_widget('geodir_related_listing_postview'); |
292 | 292 | \ No newline at end of file |
@@ -118,10 +118,11 @@ discard block |
||
118 | 118 | $instance['listing_width'] = strip_tags($new_instance['listing_width']); |
119 | 119 | $instance['list_sort'] = strip_tags($new_instance['list_sort']); |
120 | 120 | $instance['character_count'] = $new_instance['character_count']; |
121 | - if (isset($new_instance['add_location_filter']) && $new_instance['add_location_filter'] != '') |
|
122 | - $instance['add_location_filter'] = strip_tags($new_instance['add_location_filter']); |
|
123 | - else |
|
124 | - $instance['add_location_filter'] = '0'; |
|
121 | + if (isset($new_instance['add_location_filter']) && $new_instance['add_location_filter'] != '') { |
|
122 | + $instance['add_location_filter'] = strip_tags($new_instance['add_location_filter']); |
|
123 | + } else { |
|
124 | + $instance['add_location_filter'] = '0'; |
|
125 | + } |
|
125 | 126 | |
126 | 127 | return $instance; |
127 | 128 | } |
@@ -279,7 +280,10 @@ discard block |
||
279 | 280 | <label for="<?php echo $this->get_field_id('add_location_filter'); ?>"> |
280 | 281 | <?php _e('Enable Location Filter:', 'geodirectory');?> |
281 | 282 | <input type="checkbox" id="<?php echo $this->get_field_id('add_location_filter'); ?>" |
282 | - name="<?php echo $this->get_field_name('add_location_filter'); ?>" <?php if ($add_location_filter) echo 'checked="checked"';?> |
|
283 | + name="<?php echo $this->get_field_name('add_location_filter'); ?>" <?php if ($add_location_filter) { |
|
284 | + echo 'checked="checked"'; |
|
285 | +} |
|
286 | +?> |
|
283 | 287 | value="1"/> |
284 | 288 | </label> |
285 | 289 | </p> |
@@ -192,8 +192,9 @@ |
||
192 | 192 | |
193 | 193 | foreach ($map_zoom_level as $level) { |
194 | 194 | $selected = ''; |
195 | - if ($level == $zoom) |
|
196 | - $selected = 'selected="selected"'; |
|
195 | + if ($level == $zoom) { |
|
196 | + $selected = 'selected="selected"'; |
|
197 | + } |
|
197 | 198 | |
198 | 199 | echo '<option ' . $selected . ' value="' . $level . '">' . $level . '</option>'; |
199 | 200 |
@@ -16,126 +16,126 @@ discard block |
||
16 | 16 | */ |
17 | 17 | class geodir_homepage_map extends WP_Widget |
18 | 18 | { |
19 | - /** |
|
19 | + /** |
|
20 | 20 | * Register the home page map widget. |
21 | 21 | * |
22 | 22 | * @since 1.0.0 |
23 | - * @since 1.5.1 Changed from PHP4 style constructors to PHP5 __construct. |
|
23 | + * @since 1.5.1 Changed from PHP4 style constructors to PHP5 __construct. |
|
24 | 24 | */ |
25 | - public function __construct() { |
|
26 | - $widget_ops = array('classname' => 'widget Google Map in Home page', 'description' => __('Google Map in Home page. It will show you google map V3 for Home page with category checkbox selection.', 'geodirectory')); |
|
27 | - parent::__construct( |
|
28 | - 'geodir_map_v3_home_map', // Base ID |
|
29 | - __('GD > GMap - Home page', 'geodirectory'), // Name |
|
30 | - $widget_ops// Args |
|
31 | - ); |
|
32 | - } |
|
25 | + public function __construct() { |
|
26 | + $widget_ops = array('classname' => 'widget Google Map in Home page', 'description' => __('Google Map in Home page. It will show you google map V3 for Home page with category checkbox selection.', 'geodirectory')); |
|
27 | + parent::__construct( |
|
28 | + 'geodir_map_v3_home_map', // Base ID |
|
29 | + __('GD > GMap - Home page', 'geodirectory'), // Name |
|
30 | + $widget_ops// Args |
|
31 | + ); |
|
32 | + } |
|
33 | 33 | |
34 | 34 | /** |
35 | 35 | * Front-end display content for home page map widget. |
36 | 36 | * |
37 | 37 | * @since 1.0.0 |
38 | - * @since 1.5.1 Declare function public. |
|
38 | + * @since 1.5.1 Declare function public. |
|
39 | 39 | * |
40 | 40 | * @param array $args Widget arguments. |
41 | 41 | * @param array $instance Saved values from database. |
42 | 42 | */ |
43 | - public function widget($args, $instance) |
|
44 | - { |
|
45 | - extract($args, EXTR_SKIP); |
|
46 | - /** This action is documented in geodirectory_shortcodes.php */ |
|
47 | - $width = empty($instance['width']) ? '100%' : apply_filters('widget_width', $instance['width']); |
|
48 | - /** This action is documented in geodirectory_shortcodes.php */ |
|
49 | - $height = empty($instance['heigh']) ? '425' : apply_filters('widget_heigh', $instance['heigh']); |
|
50 | - /** This action is documented in geodirectory_shortcodes.php */ |
|
51 | - $maptype = empty($instance['maptype']) ? 'ROADMAP' : apply_filters('widget_maptype', $instance['maptype']); |
|
52 | - /** This action is documented in geodirectory_shortcodes.php */ |
|
53 | - $zoom = empty($instance['zoom']) ? '13' : apply_filters('widget_zoom', $instance['zoom']); |
|
54 | - /** This action is documented in geodirectory_shortcodes.php */ |
|
55 | - $autozoom = empty($instance['autozoom']) ? '' : apply_filters('widget_autozoom', $instance['autozoom']); |
|
56 | - /** This action is documented in geodirectory_shortcodes.php */ |
|
57 | - $child_collapse = empty($instance['child_collapse']) ? '0' : apply_filters('widget_child_collapse', $instance['child_collapse']); |
|
58 | - /** This action is documented in geodirectory_shortcodes.php */ |
|
59 | - $scrollwheel = empty($instance['scrollwheel']) ? '0' : apply_filters('widget_scrollwheel', $instance['scrollwheel']); |
|
43 | + public function widget($args, $instance) |
|
44 | + { |
|
45 | + extract($args, EXTR_SKIP); |
|
46 | + /** This action is documented in geodirectory_shortcodes.php */ |
|
47 | + $width = empty($instance['width']) ? '100%' : apply_filters('widget_width', $instance['width']); |
|
48 | + /** This action is documented in geodirectory_shortcodes.php */ |
|
49 | + $height = empty($instance['heigh']) ? '425' : apply_filters('widget_heigh', $instance['heigh']); |
|
50 | + /** This action is documented in geodirectory_shortcodes.php */ |
|
51 | + $maptype = empty($instance['maptype']) ? 'ROADMAP' : apply_filters('widget_maptype', $instance['maptype']); |
|
52 | + /** This action is documented in geodirectory_shortcodes.php */ |
|
53 | + $zoom = empty($instance['zoom']) ? '13' : apply_filters('widget_zoom', $instance['zoom']); |
|
54 | + /** This action is documented in geodirectory_shortcodes.php */ |
|
55 | + $autozoom = empty($instance['autozoom']) ? '' : apply_filters('widget_autozoom', $instance['autozoom']); |
|
56 | + /** This action is documented in geodirectory_shortcodes.php */ |
|
57 | + $child_collapse = empty($instance['child_collapse']) ? '0' : apply_filters('widget_child_collapse', $instance['child_collapse']); |
|
58 | + /** This action is documented in geodirectory_shortcodes.php */ |
|
59 | + $scrollwheel = empty($instance['scrollwheel']) ? '0' : apply_filters('widget_scrollwheel', $instance['scrollwheel']); |
|
60 | 60 | |
61 | - $map_args = array(); |
|
62 | - $map_args['map_canvas_name'] = str_replace('-', '_', $args['widget_id']); //'home_map_canvas'.$str ; |
|
63 | - $map_args['width'] = $width; |
|
64 | - $map_args['height'] = $height; |
|
65 | - $map_args['maptype'] = $maptype; |
|
66 | - $map_args['scrollwheel'] = $scrollwheel; |
|
67 | - $map_args['zoom'] = $zoom; |
|
68 | - $map_args['autozoom'] = $autozoom; |
|
69 | - $map_args['child_collapse'] = $child_collapse; |
|
70 | - $map_args['enable_cat_filters'] = true; |
|
71 | - $map_args['enable_text_search'] = true; |
|
72 | - $map_args['enable_post_type_filters'] = true; |
|
73 | - /** This action is documented in geodirectory_shortcodes.php */ |
|
74 | - $map_args['enable_location_filters'] = apply_filters('geodir_home_map_enable_location_filters', false); |
|
75 | - $map_args['enable_jason_on_load'] = false; |
|
76 | - $map_args['enable_marker_cluster'] = false; |
|
77 | - $map_args['enable_map_resize_button'] = true; |
|
78 | - $map_args['map_class_name'] = 'geodir-map-home-page'; |
|
61 | + $map_args = array(); |
|
62 | + $map_args['map_canvas_name'] = str_replace('-', '_', $args['widget_id']); //'home_map_canvas'.$str ; |
|
63 | + $map_args['width'] = $width; |
|
64 | + $map_args['height'] = $height; |
|
65 | + $map_args['maptype'] = $maptype; |
|
66 | + $map_args['scrollwheel'] = $scrollwheel; |
|
67 | + $map_args['zoom'] = $zoom; |
|
68 | + $map_args['autozoom'] = $autozoom; |
|
69 | + $map_args['child_collapse'] = $child_collapse; |
|
70 | + $map_args['enable_cat_filters'] = true; |
|
71 | + $map_args['enable_text_search'] = true; |
|
72 | + $map_args['enable_post_type_filters'] = true; |
|
73 | + /** This action is documented in geodirectory_shortcodes.php */ |
|
74 | + $map_args['enable_location_filters'] = apply_filters('geodir_home_map_enable_location_filters', false); |
|
75 | + $map_args['enable_jason_on_load'] = false; |
|
76 | + $map_args['enable_marker_cluster'] = false; |
|
77 | + $map_args['enable_map_resize_button'] = true; |
|
78 | + $map_args['map_class_name'] = 'geodir-map-home-page'; |
|
79 | 79 | |
80 | - $is_geodir_home_map_widget = true; |
|
81 | - $map_args['is_geodir_home_map_widget'] = $is_geodir_home_map_widget; |
|
80 | + $is_geodir_home_map_widget = true; |
|
81 | + $map_args['is_geodir_home_map_widget'] = $is_geodir_home_map_widget; |
|
82 | 82 | |
83 | - geodir_draw_map($map_args); |
|
83 | + geodir_draw_map($map_args); |
|
84 | 84 | |
85 | - /* home map post type slider */ |
|
86 | - if ($is_geodir_home_map_widget) { |
|
87 | - add_action('wp_footer', array($this, 'geodir_home_map_add_script'), 100); |
|
88 | - } |
|
85 | + /* home map post type slider */ |
|
86 | + if ($is_geodir_home_map_widget) { |
|
87 | + add_action('wp_footer', array($this, 'geodir_home_map_add_script'), 100); |
|
88 | + } |
|
89 | 89 | |
90 | - } |
|
90 | + } |
|
91 | 91 | |
92 | 92 | /** |
93 | 93 | * Sanitize home page map widget form values as they are saved. |
94 | 94 | * |
95 | 95 | * @since 1.0.0 |
96 | - * @since 1.5.1 Declare function public. |
|
96 | + * @since 1.5.1 Declare function public. |
|
97 | 97 | * |
98 | 98 | * @param array $new_instance Values just sent to be saved. |
99 | 99 | * @param array $old_instance Previously saved values from database. |
100 | 100 | * |
101 | 101 | * @return array Updated safe values to be saved. |
102 | 102 | */ |
103 | - public function update($new_instance, $old_instance) |
|
104 | - { |
|
105 | - //save the widget |
|
106 | - $instance = $old_instance; |
|
107 | - $instance['width'] = strip_tags($new_instance['width']); |
|
108 | - $instance['heigh'] = ($new_instance['heigh']); |
|
109 | - $instance['maptype'] = ($new_instance['maptype']); |
|
110 | - $instance['zoom'] = ($new_instance['zoom']); |
|
111 | - $instance['autozoom'] = isset($new_instance['autozoom']) ? $new_instance['autozoom'] : ''; |
|
112 | - $instance['child_collapse'] = isset($new_instance['child_collapse']) ? ($new_instance['child_collapse']) : ''; |
|
113 | - $instance['scrollwheel'] = isset($new_instance['scrollwheel']) ? ($new_instance['scrollwheel']) : ''; |
|
103 | + public function update($new_instance, $old_instance) |
|
104 | + { |
|
105 | + //save the widget |
|
106 | + $instance = $old_instance; |
|
107 | + $instance['width'] = strip_tags($new_instance['width']); |
|
108 | + $instance['heigh'] = ($new_instance['heigh']); |
|
109 | + $instance['maptype'] = ($new_instance['maptype']); |
|
110 | + $instance['zoom'] = ($new_instance['zoom']); |
|
111 | + $instance['autozoom'] = isset($new_instance['autozoom']) ? $new_instance['autozoom'] : ''; |
|
112 | + $instance['child_collapse'] = isset($new_instance['child_collapse']) ? ($new_instance['child_collapse']) : ''; |
|
113 | + $instance['scrollwheel'] = isset($new_instance['scrollwheel']) ? ($new_instance['scrollwheel']) : ''; |
|
114 | 114 | |
115 | - return $instance; |
|
116 | - } |
|
115 | + return $instance; |
|
116 | + } |
|
117 | 117 | |
118 | 118 | /** |
119 | 119 | * Back-end home page map widget settings form. |
120 | 120 | * |
121 | 121 | * @since 1.0.0 |
122 | - * @since 1.5.1 Declare function public. |
|
122 | + * @since 1.5.1 Declare function public. |
|
123 | 123 | * |
124 | 124 | * @param array $instance Previously saved values from database. |
125 | 125 | */ |
126 | - public function form($instance) |
|
127 | - { |
|
128 | - //widgetform in backend |
|
126 | + public function form($instance) |
|
127 | + { |
|
128 | + //widgetform in backend |
|
129 | 129 | |
130 | - $instance = wp_parse_args((array)$instance, array('width' => '', 'heigh' => '', 'maptype' => '', 'zoom' => '', 'autozoom' => '', 'child_collapse' => '0', 'scrollwheel' => '0')); |
|
131 | - $width = strip_tags($instance['width']); |
|
132 | - $heigh = strip_tags($instance['heigh']); |
|
133 | - $maptype = strip_tags($instance['maptype']); |
|
134 | - $zoom = strip_tags($instance['zoom']); |
|
135 | - $autozoom = strip_tags($instance['autozoom']); |
|
136 | - $child_collapse = strip_tags($instance['child_collapse']); |
|
137 | - $scrollwheel = strip_tags($instance['scrollwheel']); |
|
138 | - ?> |
|
130 | + $instance = wp_parse_args((array)$instance, array('width' => '', 'heigh' => '', 'maptype' => '', 'zoom' => '', 'autozoom' => '', 'child_collapse' => '0', 'scrollwheel' => '0')); |
|
131 | + $width = strip_tags($instance['width']); |
|
132 | + $heigh = strip_tags($instance['heigh']); |
|
133 | + $maptype = strip_tags($instance['maptype']); |
|
134 | + $zoom = strip_tags($instance['zoom']); |
|
135 | + $autozoom = strip_tags($instance['autozoom']); |
|
136 | + $child_collapse = strip_tags($instance['child_collapse']); |
|
137 | + $scrollwheel = strip_tags($instance['scrollwheel']); |
|
138 | + ?> |
|
139 | 139 | |
140 | 140 | <p> |
141 | 141 | <label |
@@ -164,14 +164,14 @@ discard block |
||
164 | 164 | name="<?php echo $this->get_field_name('maptype'); ?>"> |
165 | 165 | |
166 | 166 | <option <?php if (isset($maptype) && $maptype == 'ROADMAP') { |
167 | - echo 'selected="selected"'; |
|
168 | - } ?> value="ROADMAP"><?php _e('Road Map', 'geodirectory'); ?></option> |
|
167 | + echo 'selected="selected"'; |
|
168 | + } ?> value="ROADMAP"><?php _e('Road Map', 'geodirectory'); ?></option> |
|
169 | 169 | <option <?php if (isset($maptype) && $maptype == 'SATELLITE') { |
170 | - echo 'selected="selected"'; |
|
171 | - } ?> value="SATELLITE"><?php _e('Satellite Map', 'geodirectory'); ?></option> |
|
170 | + echo 'selected="selected"'; |
|
171 | + } ?> value="SATELLITE"><?php _e('Satellite Map', 'geodirectory'); ?></option> |
|
172 | 172 | <option <?php if (isset($maptype) && $maptype == 'HYBRID') { |
173 | - echo 'selected="selected"'; |
|
174 | - } ?> value="HYBRID"><?php _e('Hybrid Map', 'geodirectory'); ?></option> |
|
173 | + echo 'selected="selected"'; |
|
174 | + } ?> value="HYBRID"><?php _e('Hybrid Map', 'geodirectory'); ?></option> |
|
175 | 175 | <option <?php selected($maptype, 'TERRAIN');?> |
176 | 176 | value="TERRAIN"><?php _e('Terrain Map', 'geodirectory'); ?></option> |
177 | 177 | </select> |
@@ -179,8 +179,8 @@ discard block |
||
179 | 179 | </p> |
180 | 180 | |
181 | 181 | <?php |
182 | - $map_zoom_level = geodir_map_zoom_level(); |
|
183 | - ?> |
|
182 | + $map_zoom_level = geodir_map_zoom_level(); |
|
183 | + ?> |
|
184 | 184 | |
185 | 185 | <p> |
186 | 186 | <label |
@@ -189,14 +189,14 @@ discard block |
||
189 | 189 | <select class="widefat" id="<?php echo $this->get_field_id('zoom'); ?>" |
190 | 190 | name="<?php echo $this->get_field_name('zoom'); ?>"> <?php |
191 | 191 | |
192 | - foreach ($map_zoom_level as $level) { |
|
193 | - $selected = ''; |
|
194 | - if ($level == $zoom) |
|
195 | - $selected = 'selected="selected"'; |
|
192 | + foreach ($map_zoom_level as $level) { |
|
193 | + $selected = ''; |
|
194 | + if ($level == $zoom) |
|
195 | + $selected = 'selected="selected"'; |
|
196 | 196 | |
197 | - echo '<option ' . $selected . ' value="' . $level . '">' . $level . '</option>'; |
|
197 | + echo '<option ' . $selected . ' value="' . $level . '">' . $level . '</option>'; |
|
198 | 198 | |
199 | - } ?> |
|
199 | + } ?> |
|
200 | 200 | |
201 | 201 | </select> |
202 | 202 | </label> |
@@ -209,8 +209,8 @@ discard block |
||
209 | 209 | : |
210 | 210 | <input type="checkbox" class="checkbox" id="<?php echo $this->get_field_id('autozoom'); ?>" |
211 | 211 | name="<?php echo $this->get_field_name('autozoom'); ?>"<?php if ($autozoom) { |
212 | - echo 'checked="checked"'; |
|
213 | - } ?> /></label> |
|
212 | + echo 'checked="checked"'; |
|
213 | + } ?> /></label> |
|
214 | 214 | </p> |
215 | 215 | |
216 | 216 | <p> |
@@ -234,17 +234,17 @@ discard block |
||
234 | 234 | </p> |
235 | 235 | |
236 | 236 | <?php |
237 | - } |
|
237 | + } |
|
238 | 238 | |
239 | - /** |
|
239 | + /** |
|
240 | 240 | * Adds the javascript in the footer for home page map widget. |
241 | 241 | * |
242 | 242 | * @since 1.0.0 |
243 | - * @since 1.5.1 Declare function public. |
|
243 | + * @since 1.5.1 Declare function public. |
|
244 | 244 | */ |
245 | - public function geodir_home_map_add_script() |
|
246 | - { |
|
247 | - ?> |
|
245 | + public function geodir_home_map_add_script() |
|
246 | + { |
|
247 | + ?> |
|
248 | 248 | <script type="text/javascript"> |
249 | 249 | jQuery(document).ready(function () { |
250 | 250 | geoDirMapSlide(); |
@@ -317,7 +317,7 @@ discard block |
||
317 | 317 | } |
318 | 318 | </script> |
319 | 319 | <?php |
320 | - } |
|
320 | + } |
|
321 | 321 | } // class geodir_homepage_map |
322 | 322 | |
323 | 323 | register_widget('geodir_homepage_map'); |
@@ -127,7 +127,7 @@ discard block |
||
127 | 127 | { |
128 | 128 | //widgetform in backend |
129 | 129 | |
130 | - $instance = wp_parse_args((array)$instance, array('width' => '', 'heigh' => '', 'maptype' => '', 'zoom' => '', 'autozoom' => '', 'child_collapse' => '0', 'scrollwheel' => '0')); |
|
130 | + $instance = wp_parse_args((array) $instance, array('width' => '', 'heigh' => '', 'maptype' => '', 'zoom' => '', 'autozoom' => '', 'child_collapse' => '0', 'scrollwheel' => '0')); |
|
131 | 131 | $width = strip_tags($instance['width']); |
132 | 132 | $heigh = strip_tags($instance['heigh']); |
133 | 133 | $maptype = strip_tags($instance['maptype']); |
@@ -172,7 +172,7 @@ discard block |
||
172 | 172 | <option <?php if (isset($maptype) && $maptype == 'HYBRID') { |
173 | 173 | echo 'selected="selected"'; |
174 | 174 | } ?> value="HYBRID"><?php _e('Hybrid Map', 'geodirectory'); ?></option> |
175 | - <option <?php selected($maptype, 'TERRAIN');?> |
|
175 | + <option <?php selected($maptype, 'TERRAIN'); ?> |
|
176 | 176 | value="TERRAIN"><?php _e('Terrain Map', 'geodirectory'); ?></option> |
177 | 177 | </select> |
178 | 178 | </label> |
@@ -194,7 +194,7 @@ discard block |
||
194 | 194 | if ($level == $zoom) |
195 | 195 | $selected = 'selected="selected"'; |
196 | 196 | |
197 | - echo '<option ' . $selected . ' value="' . $level . '">' . $level . '</option>'; |
|
197 | + echo '<option '.$selected.' value="'.$level.'">'.$level.'</option>'; |
|
198 | 198 | |
199 | 199 | } ?> |
200 | 200 | |
@@ -219,7 +219,7 @@ discard block |
||
219 | 219 | : |
220 | 220 | <input id="<?php echo $this->get_field_id('child_collapse'); ?>" |
221 | 221 | name="<?php echo $this->get_field_name('child_collapse'); ?>" type="checkbox" value="1" |
222 | - <?php if ($child_collapse){ ?>checked="checked" <?php } ?> /> |
|
222 | + <?php if ($child_collapse) { ?>checked="checked" <?php } ?> /> |
|
223 | 223 | </label> |
224 | 224 | </p> |
225 | 225 | |
@@ -229,7 +229,7 @@ discard block |
||
229 | 229 | : |
230 | 230 | <input id="<?php echo $this->get_field_id('scrollwheel'); ?>" |
231 | 231 | name="<?php echo $this->get_field_name('scrollwheel'); ?>" type="checkbox" value="1" |
232 | - <?php if ($scrollwheel){ ?>checked="checked" <?php } ?> /> |
|
232 | + <?php if ($scrollwheel) { ?>checked="checked" <?php } ?> /> |
|
233 | 233 | </label> |
234 | 234 | </p> |
235 | 235 |
@@ -113,7 +113,7 @@ |
||
113 | 113 | * @since 1.0.0 |
114 | 114 | * @package GeoDirectory |
115 | 115 | * @param array $classes Class array. |
116 | - * @return array Modified class array. |
|
116 | + * @return string[] Modified class array. |
|
117 | 117 | */ |
118 | 118 | function geodir_x_body_class($classes) |
119 | 119 | { |
@@ -18,7 +18,7 @@ discard block |
||
18 | 18 | */ |
19 | 19 | function gd_strip_breadcrumb_wrappers($breadcrumb) |
20 | 20 | { |
21 | - $breadcrumb = str_replace(array("<li>","</li>"), "", $breadcrumb); |
|
21 | + $breadcrumb = str_replace(array("<li>", "</li>"), "", $breadcrumb); |
|
22 | 22 | $breadcrumb = str_replace('<div class="geodir-breadcrumb clearfix"><ul id="breadcrumbs">', '<ul class="fusion-breadcrumbs"><li>', $breadcrumb); |
23 | 23 | $breadcrumb = str_replace('</ul></div>', '</li></ul>', $breadcrumb); |
24 | 24 | return $breadcrumb; |
@@ -39,7 +39,7 @@ discard block |
||
39 | 39 | return $separator; |
40 | 40 | } |
41 | 41 | |
42 | -add_action('avada_override_current_page_title_bar','gd_avada_current_page_title_bar_change'); |
|
42 | +add_action('avada_override_current_page_title_bar', 'gd_avada_current_page_title_bar_change'); |
|
43 | 43 | /** |
44 | 44 | * new title bar functions for gd pages. |
45 | 45 | * |
@@ -51,8 +51,8 @@ discard block |
||
51 | 51 | { |
52 | 52 | if (geodir_is_geodir_page()) { |
53 | 53 | gd_avada_current_page_title_bar(); |
54 | - }else{ |
|
55 | - avada_current_page_title_bar( $c_pageID ); |
|
54 | + } else { |
|
55 | + avada_current_page_title_bar($c_pageID); |
|
56 | 56 | } |
57 | 57 | |
58 | 58 | } |
@@ -96,7 +96,7 @@ discard block |
||
96 | 96 | |
97 | 97 | |
98 | 98 | if (geodir_is_page('detail') || geodir_is_page('preview')) { |
99 | - if ( $title = get_post_meta( get_the_ID(), 'pyre_page_title_custom_text', true ) ) {} |
|
99 | + if ($title = get_post_meta(get_the_ID(), 'pyre_page_title_custom_text', true)) {} |
|
100 | 100 | else { |
101 | 101 | $title = get_the_title(); |
102 | 102 | } |
@@ -242,12 +242,12 @@ discard block |
||
242 | 242 | gd_compat_php_avada(); |
243 | 243 | |
244 | 244 | // Avada sets the search page to use wither post or page, we need it to be 'any' |
245 | -function gd_avada_search_filter( $query ) { |
|
246 | - if ( geodir_is_page('search') && is_search() && $query->is_search) { |
|
245 | +function gd_avada_search_filter($query) { |
|
246 | + if (geodir_is_page('search') && is_search() && $query->is_search) { |
|
247 | 247 | $query->set('post_type', 'any'); |
248 | 248 | } |
249 | 249 | return $query; |
250 | 250 | } |
251 | -if ( ! is_admin() ) { |
|
252 | - add_filter( 'pre_get_posts', 'gd_avada_search_filter',11 ); |
|
251 | +if (!is_admin()) { |
|
252 | + add_filter('pre_get_posts', 'gd_avada_search_filter', 11); |
|
253 | 253 | } |
254 | 254 | \ No newline at end of file |
@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | { |
52 | 52 | if (geodir_is_geodir_page()) { |
53 | 53 | gd_avada_current_page_title_bar(); |
54 | - }else{ |
|
54 | + } else{ |
|
55 | 55 | avada_current_page_title_bar( $c_pageID ); |
56 | 56 | } |
57 | 57 | |
@@ -96,8 +96,7 @@ discard block |
||
96 | 96 | |
97 | 97 | |
98 | 98 | if (geodir_is_page('detail') || geodir_is_page('preview')) { |
99 | - if ( $title = get_post_meta( get_the_ID(), 'pyre_page_title_custom_text', true ) ) {} |
|
100 | - else { |
|
99 | + if ( $title = get_post_meta( get_the_ID(), 'pyre_page_title_custom_text', true ) ) {} else { |
|
101 | 100 | $title = get_the_title(); |
102 | 101 | } |
103 | 102 | avada_page_title_bar($title, $subtitle, $secondary_content); |
@@ -18,10 +18,10 @@ discard block |
||
18 | 18 | */ |
19 | 19 | function gd_strip_breadcrumb_wrappers($breadcrumb) |
20 | 20 | { |
21 | - $breadcrumb = str_replace(array("<li>","</li>"), "", $breadcrumb); |
|
22 | - $breadcrumb = str_replace('<div class="geodir-breadcrumb clearfix"><ul id="breadcrumbs">', '<ul class="fusion-breadcrumbs"><li>', $breadcrumb); |
|
23 | - $breadcrumb = str_replace('</ul></div>', '</li></ul>', $breadcrumb); |
|
24 | - return $breadcrumb; |
|
21 | + $breadcrumb = str_replace(array("<li>","</li>"), "", $breadcrumb); |
|
22 | + $breadcrumb = str_replace('<div class="geodir-breadcrumb clearfix"><ul id="breadcrumbs">', '<ul class="fusion-breadcrumbs"><li>', $breadcrumb); |
|
23 | + $breadcrumb = str_replace('</ul></div>', '</li></ul>', $breadcrumb); |
|
24 | + return $breadcrumb; |
|
25 | 25 | } |
26 | 26 | |
27 | 27 | add_filter('geodir_breadcrumb_separator', 'gd_change_breadcrumb_separator'); |
@@ -35,8 +35,8 @@ discard block |
||
35 | 35 | */ |
36 | 36 | function gd_change_breadcrumb_separator($separator) |
37 | 37 | { |
38 | - $separator = ' / '; |
|
39 | - return $separator; |
|
38 | + $separator = ' / '; |
|
39 | + return $separator; |
|
40 | 40 | } |
41 | 41 | |
42 | 42 | add_action('avada_override_current_page_title_bar','gd_avada_current_page_title_bar_change'); |
@@ -49,11 +49,11 @@ discard block |
||
49 | 49 | */ |
50 | 50 | function gd_avada_current_page_title_bar_change($c_pageID) |
51 | 51 | { |
52 | - if (geodir_is_geodir_page()) { |
|
53 | - gd_avada_current_page_title_bar(); |
|
54 | - }else{ |
|
55 | - avada_current_page_title_bar( $c_pageID ); |
|
56 | - } |
|
52 | + if (geodir_is_geodir_page()) { |
|
53 | + gd_avada_current_page_title_bar(); |
|
54 | + }else{ |
|
55 | + avada_current_page_title_bar( $c_pageID ); |
|
56 | + } |
|
57 | 57 | |
58 | 58 | } |
59 | 59 | |
@@ -65,50 +65,50 @@ discard block |
||
65 | 65 | */ |
66 | 66 | function gd_avada_current_page_title_bar() |
67 | 67 | { |
68 | - ob_start(); |
|
69 | - geodir_breadcrumb(); |
|
70 | - $secondary_content = ob_get_contents(); |
|
71 | - ob_get_clean(); |
|
72 | - |
|
73 | - $title = ''; |
|
74 | - $subtitle = ''; |
|
75 | - |
|
76 | - if (geodir_is_page('listing')) { |
|
77 | - ob_start(); // Start buffering; |
|
78 | - geodir_action_listings_title(); |
|
79 | - $title = ob_get_clean(); |
|
80 | - avada_page_title_bar($title, $subtitle, $secondary_content); |
|
81 | - } |
|
82 | - |
|
83 | - if (geodir_is_page('add-listing')) { |
|
84 | - ob_start(); // Start buffering; |
|
85 | - geodir_action_add_listing_page_title(); |
|
86 | - $title = ob_get_clean(); |
|
87 | - avada_page_title_bar($title, $subtitle, $secondary_content); |
|
88 | - } |
|
89 | - |
|
90 | - if (geodir_is_page('author')) { |
|
91 | - ob_start(); // Start buffering; |
|
92 | - geodir_action_author_page_title(); |
|
93 | - $title = ob_get_clean(); |
|
94 | - avada_page_title_bar($title, $subtitle, $secondary_content); |
|
95 | - } |
|
96 | - |
|
97 | - |
|
98 | - if (geodir_is_page('detail') || geodir_is_page('preview')) { |
|
99 | - if ( $title = get_post_meta( get_the_ID(), 'pyre_page_title_custom_text', true ) ) {} |
|
100 | - else { |
|
101 | - $title = get_the_title(); |
|
102 | - } |
|
103 | - avada_page_title_bar($title, $subtitle, $secondary_content); |
|
104 | - } |
|
105 | - |
|
106 | - if (geodir_is_page('search')) { |
|
107 | - ob_start(); // Start buffering; |
|
108 | - geodir_action_search_page_title(); |
|
109 | - $title = ob_get_clean(); |
|
110 | - avada_page_title_bar($title, $subtitle, $secondary_content); |
|
111 | - } |
|
68 | + ob_start(); |
|
69 | + geodir_breadcrumb(); |
|
70 | + $secondary_content = ob_get_contents(); |
|
71 | + ob_get_clean(); |
|
72 | + |
|
73 | + $title = ''; |
|
74 | + $subtitle = ''; |
|
75 | + |
|
76 | + if (geodir_is_page('listing')) { |
|
77 | + ob_start(); // Start buffering; |
|
78 | + geodir_action_listings_title(); |
|
79 | + $title = ob_get_clean(); |
|
80 | + avada_page_title_bar($title, $subtitle, $secondary_content); |
|
81 | + } |
|
82 | + |
|
83 | + if (geodir_is_page('add-listing')) { |
|
84 | + ob_start(); // Start buffering; |
|
85 | + geodir_action_add_listing_page_title(); |
|
86 | + $title = ob_get_clean(); |
|
87 | + avada_page_title_bar($title, $subtitle, $secondary_content); |
|
88 | + } |
|
89 | + |
|
90 | + if (geodir_is_page('author')) { |
|
91 | + ob_start(); // Start buffering; |
|
92 | + geodir_action_author_page_title(); |
|
93 | + $title = ob_get_clean(); |
|
94 | + avada_page_title_bar($title, $subtitle, $secondary_content); |
|
95 | + } |
|
96 | + |
|
97 | + |
|
98 | + if (geodir_is_page('detail') || geodir_is_page('preview')) { |
|
99 | + if ( $title = get_post_meta( get_the_ID(), 'pyre_page_title_custom_text', true ) ) {} |
|
100 | + else { |
|
101 | + $title = get_the_title(); |
|
102 | + } |
|
103 | + avada_page_title_bar($title, $subtitle, $secondary_content); |
|
104 | + } |
|
105 | + |
|
106 | + if (geodir_is_page('search')) { |
|
107 | + ob_start(); // Start buffering; |
|
108 | + geodir_action_search_page_title(); |
|
109 | + $title = ob_get_clean(); |
|
110 | + avada_page_title_bar($title, $subtitle, $secondary_content); |
|
111 | + } |
|
112 | 112 | } |
113 | 113 | |
114 | 114 | /** |
@@ -119,34 +119,34 @@ discard block |
||
119 | 119 | */ |
120 | 120 | function gd_compat_php_avada() |
121 | 121 | { |
122 | - // change widget wrappers |
|
123 | - //add_filter( 'geodir_before_widget', 'geodir_before_widget_compat',10,1 ); |
|
124 | - //add_filter( 'geodir_after_widget', 'geodir_after_widget_compat',10,1 ); |
|
125 | - |
|
126 | - // REMOVE BREADCRUMB |
|
127 | - remove_action('geodir_detail_before_main_content', 'geodir_breadcrumb', 20); |
|
128 | - remove_action('geodir_listings_before_main_content', 'geodir_breadcrumb', 20); |
|
129 | - remove_action('geodir_author_before_main_content', 'geodir_breadcrumb', 20); |
|
130 | - remove_action('geodir_search_before_main_content', 'geodir_breadcrumb', 20); |
|
131 | - remove_action('geodir_home_before_main_content', 'geodir_breadcrumb', 20); |
|
132 | - remove_action('geodir_location_before_main_content', 'geodir_breadcrumb', 20); |
|
133 | - |
|
134 | - // REMOVE PAGE TITLES |
|
135 | - remove_action('geodir_listings_page_title', 'geodir_action_listings_title', 10); |
|
136 | - remove_action('geodir_add_listing_page_title', 'geodir_action_add_listing_page_title', 10); |
|
137 | - remove_action('geodir_details_main_content', 'geodir_action_page_title', 20); |
|
138 | - remove_action('geodir_search_page_title', 'geodir_action_search_page_title', 10); |
|
139 | - remove_action('geodir_author_page_title', 'geodir_action_author_page_title', 10); |
|
140 | - |
|
141 | - // make top section wide |
|
142 | - remove_action('geodir_home_before_main_content', 'geodir_action_geodir_sidebar_home_top', 10); |
|
143 | - remove_action('geodir_location_before_main_content', 'geodir_action_geodir_sidebar_home_top', 10); |
|
144 | - remove_action('geodir_author_before_main_content', 'geodir_action_geodir_sidebar_author_top', 10); |
|
145 | - remove_action('geodir_search_before_main_content', 'geodir_action_geodir_sidebar_search_top', 10); |
|
146 | - remove_action('geodir_detail_before_main_content', 'geodir_action_geodir_sidebar_detail_top', 10); |
|
147 | - remove_action('geodir_listings_before_main_content', 'geodir_action_geodir_sidebar_listings_top', 10); |
|
148 | - |
|
149 | - //gd_compat_add_top_section_back(); |
|
122 | + // change widget wrappers |
|
123 | + //add_filter( 'geodir_before_widget', 'geodir_before_widget_compat',10,1 ); |
|
124 | + //add_filter( 'geodir_after_widget', 'geodir_after_widget_compat',10,1 ); |
|
125 | + |
|
126 | + // REMOVE BREADCRUMB |
|
127 | + remove_action('geodir_detail_before_main_content', 'geodir_breadcrumb', 20); |
|
128 | + remove_action('geodir_listings_before_main_content', 'geodir_breadcrumb', 20); |
|
129 | + remove_action('geodir_author_before_main_content', 'geodir_breadcrumb', 20); |
|
130 | + remove_action('geodir_search_before_main_content', 'geodir_breadcrumb', 20); |
|
131 | + remove_action('geodir_home_before_main_content', 'geodir_breadcrumb', 20); |
|
132 | + remove_action('geodir_location_before_main_content', 'geodir_breadcrumb', 20); |
|
133 | + |
|
134 | + // REMOVE PAGE TITLES |
|
135 | + remove_action('geodir_listings_page_title', 'geodir_action_listings_title', 10); |
|
136 | + remove_action('geodir_add_listing_page_title', 'geodir_action_add_listing_page_title', 10); |
|
137 | + remove_action('geodir_details_main_content', 'geodir_action_page_title', 20); |
|
138 | + remove_action('geodir_search_page_title', 'geodir_action_search_page_title', 10); |
|
139 | + remove_action('geodir_author_page_title', 'geodir_action_author_page_title', 10); |
|
140 | + |
|
141 | + // make top section wide |
|
142 | + remove_action('geodir_home_before_main_content', 'geodir_action_geodir_sidebar_home_top', 10); |
|
143 | + remove_action('geodir_location_before_main_content', 'geodir_action_geodir_sidebar_home_top', 10); |
|
144 | + remove_action('geodir_author_before_main_content', 'geodir_action_geodir_sidebar_author_top', 10); |
|
145 | + remove_action('geodir_search_before_main_content', 'geodir_action_geodir_sidebar_search_top', 10); |
|
146 | + remove_action('geodir_detail_before_main_content', 'geodir_action_geodir_sidebar_detail_top', 10); |
|
147 | + remove_action('geodir_listings_before_main_content', 'geodir_action_geodir_sidebar_listings_top', 10); |
|
148 | + |
|
149 | + //gd_compat_add_top_section_back(); |
|
150 | 150 | |
151 | 151 | } |
152 | 152 | |
@@ -158,17 +158,17 @@ discard block |
||
158 | 158 | * @package GeoDirectory |
159 | 159 | */ |
160 | 160 | function gd_compat_add_top_section_back() { |
161 | - if (geodir_is_page('home') || geodir_is_page('location')) { |
|
162 | - geodir_action_geodir_sidebar_home_top(); |
|
163 | - } elseif (geodir_is_page('listing')) { |
|
164 | - geodir_action_geodir_sidebar_listings_top(); |
|
165 | - } elseif (geodir_is_page('detail')) { |
|
166 | - geodir_action_geodir_sidebar_detail_top(); |
|
167 | - } elseif (geodir_is_page('search')) { |
|
168 | - geodir_action_geodir_sidebar_search_top(); |
|
169 | - } elseif (geodir_is_page('author')) { |
|
170 | - geodir_action_geodir_sidebar_author_top(); |
|
171 | - } |
|
161 | + if (geodir_is_page('home') || geodir_is_page('location')) { |
|
162 | + geodir_action_geodir_sidebar_home_top(); |
|
163 | + } elseif (geodir_is_page('listing')) { |
|
164 | + geodir_action_geodir_sidebar_listings_top(); |
|
165 | + } elseif (geodir_is_page('detail')) { |
|
166 | + geodir_action_geodir_sidebar_detail_top(); |
|
167 | + } elseif (geodir_is_page('search')) { |
|
168 | + geodir_action_geodir_sidebar_search_top(); |
|
169 | + } elseif (geodir_is_page('author')) { |
|
170 | + geodir_action_geodir_sidebar_author_top(); |
|
171 | + } |
|
172 | 172 | } |
173 | 173 | |
174 | 174 | add_filter('body_class', 'gd_compat_body_class'); |
@@ -182,12 +182,12 @@ discard block |
||
182 | 182 | */ |
183 | 183 | function gd_compat_body_class($classes) |
184 | 184 | { |
185 | - if (geodir_is_geodir_page()) { |
|
186 | - $classes[] = 'wpgeo-avada'; |
|
187 | - } else { |
|
188 | - $classes[] = ''; |
|
189 | - } |
|
190 | - return $classes; |
|
185 | + if (geodir_is_geodir_page()) { |
|
186 | + $classes[] = 'wpgeo-avada'; |
|
187 | + } else { |
|
188 | + $classes[] = ''; |
|
189 | + } |
|
190 | + return $classes; |
|
191 | 191 | } |
192 | 192 | |
193 | 193 | |
@@ -201,7 +201,7 @@ discard block |
||
201 | 201 | */ |
202 | 202 | function geodir_before_widget_compat($var) |
203 | 203 | { |
204 | - return '<div id="%1$s" class="geodir-widget %2$s">'; |
|
204 | + return '<div id="%1$s" class="geodir-widget %2$s">'; |
|
205 | 205 | } |
206 | 206 | |
207 | 207 | /** |
@@ -214,7 +214,7 @@ discard block |
||
214 | 214 | */ |
215 | 215 | function geodir_after_widget_compat($var) |
216 | 216 | { |
217 | - return '</div>'; |
|
217 | + return '</div>'; |
|
218 | 218 | } |
219 | 219 | |
220 | 220 | add_filter('geodir_search_form_class', 'geodir_search_form_class_avada'); |
@@ -228,8 +228,8 @@ discard block |
||
228 | 228 | */ |
229 | 229 | function geodir_search_form_class_avada($class) |
230 | 230 | { |
231 | - $class .= ' search'; |
|
232 | - return $class; |
|
231 | + $class .= ' search'; |
|
232 | + return $class; |
|
233 | 233 | } |
234 | 234 | |
235 | 235 | |
@@ -238,11 +238,11 @@ discard block |
||
238 | 238 | |
239 | 239 | // Avada sets the search page to use wither post or page, we need it to be 'any' |
240 | 240 | function gd_avada_search_filter( $query ) { |
241 | - if ( geodir_is_page('search') && is_search() && $query->is_search) { |
|
242 | - $query->set('post_type', 'any'); |
|
243 | - } |
|
244 | - return $query; |
|
241 | + if ( geodir_is_page('search') && is_search() && $query->is_search) { |
|
242 | + $query->set('post_type', 'any'); |
|
243 | + } |
|
244 | + return $query; |
|
245 | 245 | } |
246 | 246 | if ( ! is_admin() ) { |
247 | - add_filter( 'pre_get_posts', 'gd_avada_search_filter',11 ); |
|
247 | + add_filter( 'pre_get_posts', 'gd_avada_search_filter',11 ); |
|
248 | 248 | } |
249 | 249 | \ No newline at end of file |