1. function nggGetGallery( $galleryID, $template = '', $images = false ) {
  2.    
  3.     global $nggRewrite;
  4.  
  5.     $ngg_options = nggGallery::get_option('ngg_options');
  6.    
  7.     //Set sort order value, if not used (upgrade issue)
  8.     $ngg_options['galSort'] = ($ngg_options['galSort']) ? $ngg_options['galSort'] : 'pid';
  9.     $ngg_options['galSortDir'] = ($ngg_options['galSortDir'] == 'DESC') ? 'DESC' : 'ASC';
  10.    
  11.     // get gallery values
  12.     //TODO: Use pagination limits here to reduce memory needs
  13.     $picturelist = nggdb::get_gallery($galleryID, $ngg_options['galSort'], $ngg_options['galSortDir']);
  14.     return $picturelist;
  15. }