~canonical-sysadmins/wordpress/3.9.x

« back to all changes in this revision

Viewing changes to wp-includes/bookmark.php

  • Committer: Paul Collins
  • Date: 2011-07-13 02:31:10 UTC
  • Revision ID: paul.collins@canonical.com-20110713023110-rvp7cjj31rsaomkr
import Wordpress 3.2

Show diffs side-by-side

added added

removed removed

Lines of Context:
213
213
 
214
214
        $orderby = strtolower($orderby);
215
215
        $length = '';
216
 
        switch ($orderby) {
 
216
        switch ( $orderby ) {
217
217
                case 'length':
218
218
                        $length = ", CHAR_LENGTH(link_name) AS length";
219
219
                        break;
220
220
                case 'rand':
221
221
                        $orderby = 'rand()';
222
222
                        break;
 
223
                case 'link_id':
 
224
                        $orderby = "$wpdb->links.link_id";
 
225
                        break;
223
226
                default:
224
227
                        $orderparams = array();
225
 
                        foreach ( explode(',', $orderby) as $ordparam )
226
 
                                $orderparams[] = 'link_' . trim($ordparam);
 
228
                        foreach ( explode(',', $orderby) as $ordparam ) {
 
229
                                $ordparam = trim($ordparam);
 
230
                                if ( in_array( $ordparam, array( 'name', 'url', 'visible', 'rating', 'owner', 'updated' ) ) )
 
231
                                        $orderparams[] = 'link_' . $ordparam;
 
232
                        }
227
233
                        $orderby = implode(',', $orderparams);
228
234
        }
229
235
 
230
 
        if ( 'link_id' == $orderby )
231
 
                $orderby = "$wpdb->links.link_id";
 
236
        if ( empty( $orderby ) )
 
237
                $orderby = 'link_name';
 
238
 
 
239
        $order = strtoupper( $order );
 
240
        if ( '' !== $order && !in_array( $order, array( 'ASC', 'DESC' ) ) )
 
241
                $order = 'ASC';
232
242
 
233
243
        $visible = '';
234
244
        if ( $hide_invisible )