Changeset 3655 for trunk/wp-includes/template-functions-bookmarks.php
- Timestamp:
- 03/21/2006 04:26:50 AM (21 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/template-functions-bookmarks.php
r3606 r3655 284 284 285 285 $defaults = array('orderby' => 'name', 'order' => 'ASC', 'limit' => -1, 'category' => -1, 286 'category_name' => '', 'hide_invisible' => 1, 'show_updated' => 0 );286 'category_name' => '', 'hide_invisible' => 1, 'show_updated' => 0, 'include' => '', 'exclude' => ''); 287 287 $r = array_merge($defaults, $r); 288 288 extract($r); 289 289 290 $inclusions = ''; 291 if ( !empty($include) ) { 292 $exclude = ''; //ignore exclude, category, and category_name params if using include 293 $category = -1; 294 $category_name = ''; 295 $inclinks = preg_split('/[\s,]+/',$include); 296 if ( count($inclinks) ) { 297 foreach ( $inclinks as $inclink ) { 298 if (empty($inclusions)) 299 $inclusions = ' AND ( link_id = ' . intval($inclink) . ' '; 300 else 301 $inclusions .= ' OR link_id = ' . intval($inclink) . ' '; 302 } 303 } 304 } 305 if (!empty($inclusions)) 306 $inclusions .= ')'; 307 290 308 $exclusions = ''; 291 309 if ( !empty($exclude) ) { 292 $exlinks = preg_split('/[\s,]+/',$ r['exclude']);310 $exlinks = preg_split('/[\s,]+/',$exclude); 293 311 if ( count($exlinks) ) { 294 312 foreach ( $exlinks as $exlink ) { 295 $exclusions .= ' AND link_id <> ' . intval($exlink) . ' '; 313 if (empty($exclusions)) 314 $exclusions = ' AND ( link_id <> ' . intval($exlink) . ' '; 315 else 316 $exclusions .= ' AND link_id <> ' . intval($exlink) . ' '; 296 317 } 297 318 } 298 319 } 299 320 if (!empty($exclusions)) 321 $exclusions .= ')'; 322 300 323 if ( ! empty($category_name) ) { 301 324 if ( $cat_id = $wpdb->get_var("SELECT cat_ID FROM $wpdb->categories WHERE cat_name='$category_name' LIMIT 1") ) … … 321 344 } 322 345 323 $orderby = strtolower($ r['orderby']);346 $orderby = strtolower($orderby); 324 347 $length = ''; 325 348 switch ($orderby) { … … 342 365 343 366 $query = "SELECT * $length $recently_updated_test $get_updated FROM $wpdb->links $join WHERE 1=1 $visible $category_query"; 367 $query .= " $exclusions $inclusions"; 344 368 $query .= " ORDER BY $orderby $order"; 345 369 if ($limit != -1)
Note:
See TracChangeset
for help on using the changeset viewer.