Example #1
0
 /**
  * Return a JSON coded array of Image ids for a requested gallery
  * 
  * @class nggAdmin
  * @param int $galleryID
  * @return arry (JSON)
  */
 function get_image_ids($galleryID)
 {
     if (!function_exists('json_encode')) {
         return -2;
     }
     $gallery = nggdb::get_ids_from_gallery($galleryID, 'pid', 'ASC', false);
     header('Content-Type: text/plain; charset=' . get_option('blog_charset'), true);
     $output = json_encode($gallery);
     return $output;
 }
Example #2
0
/**
 * nggShowImageBrowser()
 * 
 * @access public 
 * @param int|string $galleryID or gallery name
 * @param string $template (optional) name for a template file, look for imagebrowser-$template
 * @return the content
 */
function nggShowImageBrowser($galleryID, $template = '')
{
    global $wpdb;
    $ngg_options = nggGallery::get_option('ngg_options');
    //Set sort order value, if not used (upgrade issue)
    $ngg_options['galSort'] = $ngg_options['galSort'] ? $ngg_options['galSort'] : 'pid';
    $ngg_options['galSortDir'] = $ngg_options['galSortDir'] == 'DESC' ? 'DESC' : 'ASC';
    // get the pictures
    $picturelist = nggdb::get_ids_from_gallery($galleryID, $ngg_options['galSort'], $ngg_options['galSortDir']);
    if (is_array($picturelist)) {
        $out = nggCreateImageBrowser($picturelist, $template);
    } else {
        $out = __('[Gallery not found]', 'nggallery');
    }
    $out = apply_filters('ngg_show_imagebrowser_content', $out, $galleryID);
    return $out;
}