예제 #1
0
/**
 * nggShowAlbum() - return a album based on the id
 * 
 * @access public 
 * @param int | string $albumID
 * @param string (optional) $template
 * @param string (optional) $gallery_template
 * @return the content
 */
function nggShowAlbum($albumID, $template = 'extend', $gallery_template = '')
{
    // $_GET from wp_query
    $gallery = get_query_var('gallery');
    $album = get_query_var('album');
    // in the case somebody uses the '0', it should be 'all' to show all galleries
    $albumID = $albumID == 0 ? 'all' : $albumID;
    // first look for gallery variable
    if (!empty($gallery)) {
        // subalbum support only one instance, you can't use more of them in one post
        //TODO: causes problems with SFC plugin, due to a second filter callback
        if (isset($GLOBALS['subalbum']) || isset($GLOBALS['nggShowGallery'])) {
            return;
        }
        // if gallery is submit , then show the gallery instead
        $out = nggShowGallery($gallery, $gallery_template);
        $GLOBALS['nggShowGallery'] = true;
        return $out;
    }
    if (empty($gallery) && isset($GLOBALS['subalbum'])) {
        return;
    }
    //redirect to subalbum only one time
    if (!empty($album)) {
        $GLOBALS['subalbum'] = true;
        $albumID = $album;
    }
    // lookup in the database
    $album = nggdb::find_album($albumID);
    // still no success ? , die !
    if (!$album) {
        return __('[Album not found]', 'nggallery');
    }
    // ensure to set the slug for "all" albums
    $album->slug = $albumID == 'all' ? $album->id : $album->slug;
    if (is_array($album->gallery_ids)) {
        $out = nggCreateAlbum($album->gallery_ids, $template, $album);
    }
    $out = apply_filters('ngg_show_album_content', $out, $album->id);
    return $out;
}
예제 #2
0
 /**
  * Function to show a thumbnail or a set of thumbnails with shortcode of type:
  * 
  * [gallery id="1,2,4,5,..." template="filename" images="number of images per page" /]
  * where 
  * - id of a gallery
  * - images is the number of images per page (optional), 0 will show all images
  * - template is a name for a gallery template, which is located in themefolder/nggallery or plugins/nextgen-gallery/view
  * 
  * @param array $atts
  * @return the_content
  */
 function show_gallery($atts)
 {
     global $wpdb;
     extract(shortcode_atts(array('id' => 0, 'template' => '', 'images' => false), $atts));
     // backward compat for user which uses the name instead, still deprecated
     if (!is_numeric($id)) {
         $id = $wpdb->get_var($wpdb->prepare("SELECT gid FROM {$wpdb->nggallery} WHERE name = '%s' ", $id));
     }
     $out = nggShowGallery($id, $template, $images);
     return $out;
 }
예제 #3
0
 function show_gallery($atts)
 {
     extract(shortcode_atts(array('id' => 0, 'template' => ''), $atts));
     $out = nggShowGallery($id, $template);
     return $out;
 }
예제 #4
0
파일: nggajax.php 프로젝트: alx/SimplePress
<?php

require_once 'ngg-config.php';
// check if we have all needed parameter
if (!isset($_GET['galleryid']) || !is_numeric($_GET['galleryid']) || (!isset($_GET['p']) || !is_numeric($_GET['p'])) || !isset($_GET['type'])) {
    die('Insufficient parameters.');
}
switch ($_GET['type']) {
    case 'gallery':
        // get the navigation page
        set_query_var('nggpage', intval($_GET['nggpage']));
        // get the current page/post id
        set_query_var('pageid', intval($_GET['p']));
        set_query_var('show', 'gallery');
        $GLOBALS['id'] = intval($_GET['p']);
        echo nggShowGallery(intval($_GET['galleryid']));
        break;
    case 'browser':
        // which image should be shown ?
        set_query_var('pid', intval($_GET['pid']));
        // get the current page/post id
        set_query_var('pageid', intval($_GET['p']));
        $GLOBALS['id'] = intval($_GET['p']);
        echo nggShowImageBrowser(intval($_GET['galleryid']));
        break;
    default:
        echo 'Wrong request type specified.';
}
예제 #5
0
/**
 * nggShowAlbum() - return a album based on the id
 * 
 * @access public 
 * @param int | string $albumID
 * @param string (optional) $template
 * @return the content
 */
function nggShowAlbum($albumID, $template = 'extend')
{
    // $_GET from wp_query
    $gallery = get_query_var('gallery');
    $album = get_query_var('album');
    // in the case somebody uses the 'all' keyword, it should be '0' to show all galleries
    $albumID = $albumID == 'all' ? 0 : $albumID;
    // first look for gallery variable
    if (!empty($gallery)) {
        if ($albumID != $album && $albumID != 0) {
            return;
        }
        // if gallery is is submit , then show the gallery instead
        $galleryID = (int) $gallery;
        $out = nggShowGallery($galleryID);
        return $out;
    }
    // lookup in the database
    $album = nggdb::find_album($albumID);
    // still no success ? , die !
    if (!$album) {
        return __('[Album not found]', 'nggallery');
    }
    $mode = ltrim($mode, ',');
    if (is_array($album->gallery_ids)) {
        $out = nggCreateAlbum($album->gallery_ids, $template, $album);
    }
    $out = apply_filters('ngg_show_album_content', $out, intval($album->id));
    return $out;
}
예제 #6
0
 /**
  * Function to show a thumbnail or a set of thumbnails with shortcode of type:
  * 
  * [gallery id="1,2,4,5,..." template="filename" images="number of images per page" /]
  * where 
  * - id of a gallery
  * - images is the number of images per page (optional), 0 will show all images
  * - template is a name for a gallery template, which is located in themefolder/nggallery or plugins/nextgen-gallery/view
  * 
  * @param array $atts
  * @return the_content
  */
 function show_gallery($atts)
 {
     extract(shortcode_atts(array('id' => 0, 'template' => '', 'images' => false), $atts));
     $out = nggShowGallery($id, $template, $images);
     return $out;
 }