PluginProbe
Meow Gallery / 4.2.2
Meow Gallery v4.2.2
5.5.5 5.5.4 5.5.3 5.5.2 5.5.1 5.5.0 5.4.9 5.4.8 5.4.7 4.1.5 4.1.6 4.1.7 4.1.8 4.1.9 4.2.0 4.2.1 4.2.2 4.2.3 4.2.4 4.2.5 4.2.6 4.2.7 4.2.8 4.2.9 4.3.0 All 157 releases
← All changes | classes/orderby.php +8 -42 5.5.2 → 4.2.2 View file →
@@ -5,52 +5,18 @@
5 5 public $admin = null;
6 6
7 7 static function run( $images, $orderby = null, $order = 'asc' ) {
8 8 $sqlOrderBy = '';
9 - $order = strtolower( $order );
10 9
11 10 // Check params
12 - switch ( $orderby ) {
13 - case 'ids':
14 - $order === 'asc' ? sort( $images ) : rsort( $images );
15 - break;
16 -
17 - case 'random':
18 - shuffle( $images );
19 - return $images;
20 - break;
21 -
22 - case 'date':
23 - $sqlOrderBy = $order === 'asc'
24 - ? ' ORDER BY p.post_date ASC'
25 - : ' ORDER BY p.post_date DESC';
26 - break;
27 -
28 - case 'modified':
29 - $sqlOrderBy = $order === 'asc'
30 - ? ' ORDER BY p.post_modified ASC'
31 - : ' ORDER BY p.post_modified DESC';
32 - break;
33 -
34 - case 'filename':
35 - case 'title':
36 - $sqlOrderBy = $order === 'asc'
37 - ? ' ORDER BY p.post_title ASC'
38 - : ' ORDER BY p.post_title DESC';
39 - break;
40 -
41 - case 'menu':
42 - $sqlOrderBy = $order === 'asc'
43 - ? ' ORDER BY p.menu_order ASC'
44 - : ' ORDER BY p.menu_order DESC';
45 - break;
46 -
47 - case 'none':
48 - return $images;
49 -
50 - default:
51 - // no ordering
52 - break;
11 + if ( $orderby === 'ids' ) {
12 + $images = $order === 'asc' ? sort( $images ) : rsort( $images );
13 + }
14 + else if ( $orderby === 'title' ) {
15 + $sqlOrderBy = $order === 'asc' ? ' ORDER BY p.post_title ASC' : ' ORDER BY p.post_title DESC';
16 + }
17 + else if ( $orderby === 'date' ) {
18 + $sqlOrderBy = $order === 'asc' ? ' ORDER BY p.post_date ASC' : ' ORDER BY p.post_date DESC';
53 19 }
54 20
55 21 // Apply sort
56 22 if ( !empty( $sqlOrderBy ) ) {