You are here

function _photos_order_value in Album Photos 7.3

Same name and namespace in other branches
  1. 6.2 photos.module \_photos_order_value()

Query helper: sort order and limit.

9 calls to _photos_order_value()
photos_album_page in inc/photos.album.inc
Album view.
photos_data_album in inc/photos.data.inc
Album slideshow data.
photos_page_image in inc/photos.page.inc
Latest images page.
photos_share in inc/photos.page.inc
Share photos.
photos_sub_album_page in inc/photos.album.inc
Sub album view.

... See full list

File

./photos.module, line 2364
Implementation of photos.module.

Code

function _photos_order_value($field, $sort, $limit, $default = 0) {

  // @todo update default to check album default!
  if (!$field && !$sort) {
    $t['order'] = !$default ? array(
      'column' => 'f.fid',
      'sort' => 'desc',
    ) : $default;
  }
  else {
    if (!($t['order'] = _photos_order_value_change($field, $sort))) {
      $t['order'] = !$default ? array(
        'column' => 'f.fid',
        'sort' => 'desc',
      ) : $default;
    }
  }
  if ($limit) {
    if (isset($_GET['limit']) && !($show = intval($_GET['limit']))) {
      if ($_GET['destination']) {
        $str = urldecode($_GET['destination']);
        if (preg_match('/.*limit=(\\d*).*/i', $str, $mat)) {
          $show = intval($mat[1]);
        }
      }
    }
    $t['limit'] = isset($show) ? $show : $limit;
  }
  return $t;
}