Changeset 5521 for trunk/wp-includes/category.php
- Timestamp:
- 05/23/2007 03:57:20 AM (19 years ago)
- File:
-
- 1 edited
-
trunk/wp-includes/category.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/category.php
r5444 r5521 354 354 global $wpdb, $category_links; 355 355 356 $defaults = array('orderby' => 'name', 'order' => 'ASC',357 'hide_empty' => true, 'exclude' => '', 'include' => '',358 'number' => '');359 $args = wp_parse_args( $args, $defaults );360 if ( 'count' == $args['orderby'] )361 $args['orderby'] = 'tag_count';362 else363 $args['orderby'] = "cat_" . $args['orderby']; // restricts order by to cat_ID and cat_name fields364 $args['number'] = (int) $args['number'];365 extract($args);366 367 356 $key = md5( serialize( $args ) ); 368 357 if ( $cache = wp_cache_get( 'get_tags', 'category' ) ) … … 370 359 return apply_filters('get_tags', $cache[$key], $args); 371 360 372 $where = 'cat_ID > 0'; 373 $inclusions = ''; 374 if ( !empty($include) ) { 375 $child_of = 0; //ignore child_of and exclude params if using include 376 $exclude = ''; 377 $incategories = preg_split('/[\s,]+/',$include); 378 if ( count($incategories) ) { 379 foreach ( $incategories as $incat ) { 380 if (empty($inclusions)) 381 $inclusions = ' AND ( cat_ID = ' . intval($incat) . ' '; 382 else 383 $inclusions .= ' OR cat_ID = ' . intval($incat) . ' '; 384 } 385 } 386 } 387 388 if (!empty($inclusions)) 389 $inclusions .= ')'; 390 $where .= $inclusions; 391 392 $exclusions = ''; 393 if ( !empty($exclude) ) { 394 $excategories = preg_split('/[\s,]+/',$exclude); 395 if ( count($excategories) ) { 396 foreach ( $excategories as $excat ) { 397 if (empty($exclusions)) 398 $exclusions = ' AND ( cat_ID <> ' . intval($excat) . ' '; 399 else 400 $exclusions .= ' AND cat_ID <> ' . intval($excat) . ' '; 401 } 402 } 403 } 404 405 if (!empty($exclusions)) 406 $exclusions .= ')'; 407 $exclusions = apply_filters('list_tags_exclusions', $exclusions, $args ); 408 $where .= $exclusions; 409 410 if ( $hide_empty ) 411 $where .= ' AND tag_count > 0'; 412 413 $where .= ' AND ( type & ' . TAXONOMY_TAG . ' != 0 ) '; 414 415 if ( !empty($number) ) 416 $number = 'LIMIT ' . $number; 417 else 418 $number = ''; 419 420 $tags = $wpdb->get_results("SELECT * FROM $wpdb->categories WHERE $where ORDER BY $orderby $order $number"); 361 362 $tags = get_terms('post_tag'); 421 363 422 364 if ( empty($tags) )
Note: See TracChangeset
for help on using the changeset viewer.