|
@@ 2191-2211 (lines=21) @@
|
| 2188 |
|
return 0; |
| 2189 |
|
} |
| 2190 |
|
|
| 2191 |
|
if ( isset( $params['orderby'] ) && ! empty( $params['orderby'] ) ) { |
| 2192 |
|
if ( is_array( $params['orderby'] ) ) { |
| 2193 |
|
foreach ( $params['orderby'] as $orderby => $dir ) { |
| 2194 |
|
$dir = strtoupper( $dir ); |
| 2195 |
|
|
| 2196 |
|
if ( ! in_array( $dir, array( 'ASC', 'DESC' ), true ) ) { |
| 2197 |
|
continue; |
| 2198 |
|
} |
| 2199 |
|
|
| 2200 |
|
if ( 'ASC' === $dir ) { |
| 2201 |
|
$params['orderby'][ $orderby ] = 'DESC'; |
| 2202 |
|
} else { |
| 2203 |
|
$params['orderby'][ $orderby ] = 'ASC'; |
| 2204 |
|
} |
| 2205 |
|
} |
| 2206 |
|
|
| 2207 |
|
$params['orderby'][ $this->data->field_id ] = 'DESC'; |
| 2208 |
|
} elseif ( "`t`.`{$this->data->field_id}` DESC" !== $params['orderby'] ) { |
| 2209 |
|
$params['orderby'] .= ", `t`.`{$this->data->field_id}` DESC"; |
| 2210 |
|
} |
| 2211 |
|
} |
| 2212 |
|
|
| 2213 |
|
$params['select'] = "`t`.`{$this->data->field_id}`"; |
| 2214 |
|
$params['limit'] = 1; |
|
@@ 2377-2397 (lines=21) @@
|
| 2374 |
|
$params['offset'] = $this->total_found() - 1; |
| 2375 |
|
} |
| 2376 |
|
|
| 2377 |
|
if ( isset( $params['orderby'] ) && ! empty( $params['orderby'] ) ) { |
| 2378 |
|
if ( is_array( $params['orderby'] ) ) { |
| 2379 |
|
foreach ( $params['orderby'] as $orderby => $dir ) { |
| 2380 |
|
$dir = strtoupper( $dir ); |
| 2381 |
|
|
| 2382 |
|
if ( ! in_array( $dir, array( 'ASC', 'DESC' ), true ) ) { |
| 2383 |
|
continue; |
| 2384 |
|
} |
| 2385 |
|
|
| 2386 |
|
if ( 'ASC' === $dir ) { |
| 2387 |
|
$params['orderby'][ $orderby ] = 'DESC'; |
| 2388 |
|
} else { |
| 2389 |
|
$params['orderby'][ $orderby ] = 'ASC'; |
| 2390 |
|
} |
| 2391 |
|
} |
| 2392 |
|
|
| 2393 |
|
$params['orderby'][ $this->data->field_id ] = 'DESC'; |
| 2394 |
|
} elseif ( "`t`.`{$this->data->field_id}` DESC" !== $params['orderby'] ) { |
| 2395 |
|
$params['orderby'] .= ", `t`.`{$this->data->field_id}` DESC"; |
| 2396 |
|
} |
| 2397 |
|
} |
| 2398 |
|
|
| 2399 |
|
$params['select'] = "`t`.`{$this->data->field_id}`"; |
| 2400 |
|
$params['limit'] = 1; |