@@ -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 | } |
@@ -322,7 +322,7 @@ discard block |
||
322 | 322 | |
323 | 323 | $gd_use_query_vars = geodir_is_page('detail') ? true : false; |
324 | 324 | |
325 | - $args = wp_parse_args((array)$params, |
|
325 | + $args = wp_parse_args((array) $params, |
|
326 | 326 | array( |
327 | 327 | 'title' => '', |
328 | 328 | 'post_type' => array(), // NULL for all |
@@ -359,7 +359,7 @@ discard block |
||
359 | 359 | if ($current_posttype != '' && isset($gd_post_types[$current_posttype])) { |
360 | 360 | if ($is_detail_page) { |
361 | 361 | $is_detail = true; |
362 | - $post_ID = is_object($post) && !empty($post->ID) ? (int)$post->ID : 0; |
|
362 | + $post_ID = is_object($post) && !empty($post->ID) ? (int) $post->ID : 0; |
|
363 | 363 | } else { |
364 | 364 | $is_listing = true; |
365 | 365 | if (is_tax()) { // category page |
@@ -367,7 +367,7 @@ discard block |
||
367 | 367 | $current_taxonomy = get_query_var('taxonomy'); |
368 | 368 | $current_posttype = geodir_get_current_posttype(); |
369 | 369 | |
370 | - if ($current_term_id && $current_posttype && get_query_var('taxonomy') == $current_posttype . 'category') { |
|
370 | + if ($current_term_id && $current_posttype && get_query_var('taxonomy') == $current_posttype.'category') { |
|
371 | 371 | $is_category = true; |
372 | 372 | } |
373 | 373 | } |
@@ -400,15 +400,15 @@ discard block |
||
400 | 400 | $hide_empty = !empty($args['hide_empty']) ? true : false; |
401 | 401 | $max_count = strip_tags($args['max_count']); |
402 | 402 | $all_childs = $max_count == 'all' ? true : false; |
403 | - $max_count = $max_count > 0 ? (int)$max_count : 0; |
|
403 | + $max_count = $max_count > 0 ? (int) $max_count : 0; |
|
404 | 404 | $max_level = strip_tags($args['max_level']); |
405 | 405 | $show_count = !empty($args['show_count']) ? true : false; |
406 | 406 | $hide_icon = !empty($args['hide_icon']) ? true : false; |
407 | 407 | $cpt_left = !empty($args['cpt_left']) ? true : false; |
408 | 408 | |
409 | - if(!$cpt_left){ |
|
409 | + if (!$cpt_left) { |
|
410 | 410 | $cpt_left = "gd-cpt-flat"; |
411 | - }else{ |
|
411 | + } else { |
|
412 | 412 | $cpt_left = ''; |
413 | 413 | } |
414 | 414 | |
@@ -423,7 +423,7 @@ discard block |
||
423 | 423 | if (!empty($post_types)) { |
424 | 424 | foreach ($post_types as $cpt => $cpt_info) { |
425 | 425 | $parent_category = ($is_category && $cat_filter && $cpt == $current_posttype) ? $current_term_id : 0; |
426 | - $cat_taxonomy = $cpt . 'category'; |
|
426 | + $cat_taxonomy = $cpt.'category'; |
|
427 | 427 | $skip_childs = false; |
428 | 428 | if ($cat_filter && $cpt == $current_posttype && $is_detail && $post_ID) { |
429 | 429 | $skip_childs = true; |
@@ -446,32 +446,32 @@ discard block |
||
446 | 446 | if ($is_listing) { |
447 | 447 | $row_class = $is_category ? ' gd-cptcat-categ' : ' gd-cptcat-listing'; |
448 | 448 | } |
449 | - $cpt_row = '<div class="gd-cptcat-row gd-cptcat-' . $cpt . $row_class . ' '.$cpt_left.'">'; |
|
449 | + $cpt_row = '<div class="gd-cptcat-row gd-cptcat-'.$cpt.$row_class.' '.$cpt_left.'">'; |
|
450 | 450 | |
451 | 451 | if ($is_category && $cat_filter && $cpt == $current_posttype) { |
452 | 452 | $term_info = get_term($current_term_id, $cat_taxonomy); |
453 | 453 | |
454 | 454 | $term_icon_url = !empty($term_icons) && isset($term_icons[$term_info->term_id]) ? $term_icons[$term_info->term_id] : ''; |
455 | - $term_icon_url = $term_icon_url != '' ? '<img alt="' . esc_attr($term_info->name) . ' icon" src="' . $term_icon_url . '" /> ' : ''; |
|
455 | + $term_icon_url = $term_icon_url != '' ? '<img alt="'.esc_attr($term_info->name).' icon" src="'.$term_icon_url.'" /> ' : ''; |
|
456 | 456 | |
457 | - $count = $show_count ? ' <span class="gd-cptcat-count">(' . $term_info->count . ')</span>' : ''; |
|
458 | - $cpt_row .= '<h2 class="gd-cptcat-title">' . $term_icon_url . $term_info->name . $count . '</h2>'; |
|
457 | + $count = $show_count ? ' <span class="gd-cptcat-count">('.$term_info->count.')</span>' : ''; |
|
458 | + $cpt_row .= '<h2 class="gd-cptcat-title">'.$term_icon_url.$term_info->name.$count.'</h2>'; |
|
459 | 459 | } else { |
460 | - $cpt_row .= '<h2 class="gd-cptcat-title">' . __($cpt_info['labels']['name'], 'geodirectory') . '</h2>'; |
|
460 | + $cpt_row .= '<h2 class="gd-cptcat-title">'.__($cpt_info['labels']['name'], 'geodirectory').'</h2>'; |
|
461 | 461 | } |
462 | 462 | foreach ($categories as $category) { |
463 | 463 | $term_icon_url = !empty($term_icons) && isset($term_icons[$category->term_id]) ? $term_icons[$category->term_id] : ''; |
464 | - $term_icon_url = $term_icon_url != '' ? '<img alt="' . esc_attr($category->name) . ' icon" src="' . $term_icon_url . '" /> ' : ''; |
|
464 | + $term_icon_url = $term_icon_url != '' ? '<img alt="'.esc_attr($category->name).' icon" src="'.$term_icon_url.'" /> ' : ''; |
|
465 | 465 | |
466 | - $term_link = get_term_link( $category, $category->taxonomy ); |
|
466 | + $term_link = get_term_link($category, $category->taxonomy); |
|
467 | 467 | /** Filter documented in geodirectory-functions/general_functions.php **/ |
468 | - $term_link = apply_filters( 'geodir_category_term_link', $term_link, $category->term_id, $cpt ); |
|
468 | + $term_link = apply_filters('geodir_category_term_link', $term_link, $category->term_id, $cpt); |
|
469 | 469 | |
470 | 470 | $cpt_row .= '<ul class="gd-cptcat-ul gd-cptcat-parent '.$cpt_left.'">'; |
471 | 471 | $cpt_row .= '<li class="gd-cptcat-li gd-cptcat-li-main">'; |
472 | - $count = $show_count ? ' <span class="gd-cptcat-count">(' . $category->count . ')</span>' : ''; |
|
473 | - $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>'; |
|
474 | - if (!$skip_childs && ($all_childs || $max_count > 0) && ($max_level == 'all' || (int)$max_level > 0)) { |
|
472 | + $count = $show_count ? ' <span class="gd-cptcat-count">('.$category->count.')</span>' : ''; |
|
473 | + $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>'; |
|
474 | + if (!$skip_childs && ($all_childs || $max_count > 0) && ($max_level == 'all' || (int) $max_level > 0)) { |
|
475 | 475 | $cpt_row .= geodir_cpt_categories_child_cats($category->term_id, $cpt, $hide_empty, $show_count, $sort_by, $max_count, $max_level, $term_icons); |
476 | 476 | } |
477 | 477 | $cpt_row .= '</li>'; |
@@ -506,7 +506,7 @@ discard block |
||
506 | 506 | * @return string Html content. |
507 | 507 | */ |
508 | 508 | function geodir_cpt_categories_child_cats($parent_id, $cpt, $hide_empty, $show_count, $sort_by, $max_count, $max_level, $term_icons, $depth = 1) { |
509 | - $cat_taxonomy = $cpt . 'category'; |
|
509 | + $cat_taxonomy = $cpt.'category'; |
|
510 | 510 | |
511 | 511 | $orderby = 'count'; |
512 | 512 | $order = 'DESC'; |
@@ -515,7 +515,7 @@ discard block |
||
515 | 515 | $order = 'ASC'; |
516 | 516 | } |
517 | 517 | |
518 | - if ($max_level != 'all' && $depth > (int)$max_level ) { |
|
518 | + if ($max_level != 'all' && $depth > (int) $max_level) { |
|
519 | 519 | return ''; |
520 | 520 | } |
521 | 521 | |
@@ -532,18 +532,18 @@ discard block |
||
532 | 532 | $child_cats = geodir_sort_terms($child_cats, 'count'); |
533 | 533 | } |
534 | 534 | |
535 | - $content = '<li class="gd-cptcat-li gd-cptcat-li-sub"><ul class="gd-cptcat-ul gd-cptcat-sub gd-cptcat-sub-' . $depth . '">'; |
|
535 | + $content = '<li class="gd-cptcat-li gd-cptcat-li-sub"><ul class="gd-cptcat-ul gd-cptcat-sub gd-cptcat-sub-'.$depth.'">'; |
|
536 | 536 | $depth++; |
537 | 537 | foreach ($child_cats as $category) { |
538 | 538 | $term_icon_url = !empty($term_icons) && isset($term_icons[$category->term_id]) ? $term_icons[$category->term_id] : ''; |
539 | - $term_icon_url = $term_icon_url != '' ? '<img alt="' . esc_attr($category->name) . ' icon" src="' . $term_icon_url . '" /> ' : ''; |
|
540 | - $term_link = get_term_link( $category, $category->taxonomy ); |
|
539 | + $term_icon_url = $term_icon_url != '' ? '<img alt="'.esc_attr($category->name).' icon" src="'.$term_icon_url.'" /> ' : ''; |
|
540 | + $term_link = get_term_link($category, $category->taxonomy); |
|
541 | 541 | /** Filter documented in geodirectory-functions/general_functions.php **/ |
542 | - $term_link = apply_filters( 'geodir_category_term_link', $term_link, $category->term_id, $cpt ); |
|
543 | - $count = $show_count ? ' <span class="gd-cptcat-count">(' . $category->count . ')</span>' : ''; |
|
542 | + $term_link = apply_filters('geodir_category_term_link', $term_link, $category->term_id, $cpt); |
|
543 | + $count = $show_count ? ' <span class="gd-cptcat-count">('.$category->count.')</span>' : ''; |
|
544 | 544 | |
545 | 545 | $content .= '<li class="gd-cptcat-li gd-cptcat-li-sub">'; |
546 | - $content .= '<a href="' . esc_url($term_link) . '" title="' . esc_attr($category->name) . '">' . $term_icon_url . $category->name . $count . '</a></li>'; |
|
546 | + $content .= '<a href="'.esc_url($term_link).'" title="'.esc_attr($category->name).'">'.$term_icon_url.$category->name.$count.'</a></li>'; |
|
547 | 547 | $content .= geodir_cpt_categories_child_cats($category->term_id, $cpt, $hide_empty, $show_count, $sort_by, $max_count, $max_level, $term_icons, $depth); |
548 | 548 | } |
549 | 549 | $content .= '</li></ul>'; |