Code Duplication    Length = 16-22 lines in 2 locations

geodirectory_hooks_actions.php 1 location

@@ 2719-2734 (lines=16) @@
2716
 * @param string $post_type The post type.
2717
 * @return array Modified sort options array.
2718
 */
2719
function geodir_no_rating_get_sort_options($options, $post_type = '')
2720
{
2721
    $new_options = array();
2722
    if (!empty($options)) {
2723
        foreach ($options as $option) {
2724
            if (is_object($option) && isset($option->htmlvar_name) && $option->htmlvar_name == 'overall_rating') {
2725
                continue;
2726
            }
2727
            $new_options[] = $option;
2728
        }
2729
2730
        $options = $new_options;
2731
    }
2732
2733
    return $options;
2734
}
2735
2736
add_filter('geodir_all_js_msg', 'geodir_all_js_msg_no_rating', 100);
2737
/**

geodirectory-functions/general_functions.php 1 location

@@ 5093-5114 (lines=22) @@
5090
 *
5091
 * @return array Terms.
5092
 */
5093
function geodir_filter_empty_terms( $terms ) {
5094
	if ( empty( $terms ) ) {
5095
		return $terms;
5096
	}
5097
5098
	$return = array();
5099
	foreach ( $terms as $term ) {
5100
		if ( isset( $term->count ) && $term->count > 0 ) {
5101
			$return[] = $term;
5102
		} else {
5103
			/**
5104
			 * Allow to filter terms with no count.
5105
			 *
5106
			 * @since 1.6.6
5107
			 *
5108
			 * @param array $return The array of terms to return.
5109
			 * @param object $term  The term object.
5110
			 */
5111
			$return = apply_filters( 'geodir_filter_empty_terms_filter', $return, $term );
5112
		}
5113
	}
5114
5115
	return $return;
5116
}
5117