当前位置: 首页>>代码示例>>PHP>>正文


PHP nggdb::find_album方法代码示例

本文整理汇总了PHP中nggdb::find_album方法的典型用法代码示例。如果您正苦于以下问题:PHP nggdb::find_album方法的具体用法?PHP nggdb::find_album怎么用?PHP nggdb::find_album使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在nggdb的用法示例。


在下文中一共展示了nggdb::find_album方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: nggShowAlbum

/**
 * 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;
}
开发者ID:popovdenis,项目名称:kmst,代码行数:50,代码来源:nggfunctions.php

示例2: next

            // two step forward... Could be easier ? How ?
            next($galleries);
            $next_gallery = next($galleries);
        }
        $rss = nggMediaRss::get_gallery_mrss($gallery, $prev_gallery, $next_gallery);
    } else {
        if ($mode == 'album') {
            // Get additional parameters
            $aid = isset($_GET['aid']) ? (int) $_GET['aid'] : 0;
            if ($aid == 0) {
                header('content-type:text/plain;charset=utf-8');
                _e("No album ID has been provided as parameter", "nggallery");
                exit;
            }
            // Get the album object
            $album = nggdb::find_album($aid);
            if (!isset($album) || $album == null) {
                header('content-type:text/plain;charset=utf-8');
                echo sprintf(__("The album ID=%s does not exist.", "nggallery"), intval($aid));
                exit;
            }
            $rss = nggMediaRss::get_album_mrss($album);
        } else {
            header('content-type:text/plain;charset=utf-8');
            echo __('Invalid MediaRSS command', 'nggallery');
            exit;
        }
    }
}
// Output header for media RSS
header("content-type:text/xml;charset=utf-8");
开发者ID:albinmartinsson91,项目名称:ux_blog,代码行数:31,代码来源:media-rss.php

示例3: find_images_in_album

 /**
  * Get all the images from a given album
  *
  * @param object|int $album The album object or the id
  * @param string $order_by
  * @param string $order_dir
  * @param bool $exclude
  * @return An array containing the nggImage objects representing the images in the album.
  */
 static function find_images_in_album($album, $order_by = 'galleryid', $order_dir = 'ASC', $exclude = true)
 {
     global $wpdb;
     if (!is_object($album)) {
         $album = nggdb::find_album($album);
     }
     // Get gallery list
     $gallery_list = implode(',', $album->gallery_ids);
     // Check for the exclude setting
     $exclude_clause = $exclude ? ' AND tt.exclude<>1 ' : '';
     // Say no to any other value
     $order_dir = $order_dir == 'DESC' ? 'DESC' : 'ASC';
     $order_by = empty($order_by) ? 'galleryid' : $order_by;
     $result = $wpdb->get_results("SELECT t.*, tt.* FROM {$wpdb->nggallery} AS t INNER JOIN {$wpdb->nggpictures} AS tt ON t.gid = tt.galleryid WHERE tt.galleryid IN ({$gallery_list}) {$exclude_clause} ORDER BY tt.{$order_by} {$order_dir}");
     // Return the object from the query result
     if ($result) {
         foreach ($result as $image) {
             $images[] = new nggImage($image);
         }
         return $images;
     }
     return null;
 }
开发者ID:valerol,项目名称:korpus,代码行数:32,代码来源:ngg-db.php

示例4: deleteAlbum

 /**
  * Method "ngg.deleteAlbum"
  * Delete a album from the database
  * 
  * @since 1.7.0
  * 
  * @param array $args Method parameters.
  * 			- int blog_id
  *	    	- string username
  *	    	- string password
  *	    	- int album id 
  * @return true
  */
 function deleteAlbum($args)
 {
     global $nggdb;
     $this->escape($args);
     $blog_ID = (int) $args[0];
     $username = $args[1];
     $password = $args[2];
     $id = (int) $args[3];
     if (!($user = $this->login($username, $password))) {
         return $this->error;
     }
     if (!($album = nggdb::find_album($id))) {
         return new IXR_Error(404, __("Invalid album ID"));
     }
     if (!current_user_can('NextGEN Edit album') && !nggGallery::current_user_can('NextGEN Add/Delete album')) {
         return new IXR_Error(401, __('Sorry, you must be able to manage albums'));
     }
     $nggdb->delete_album($id);
     return true;
 }
开发者ID:rtgibbons,项目名称:bya.org,代码行数:33,代码来源:xmlrpc.php

示例5: start_process

 function start_process()
 {
     global $ngg;
     if (!$this->valid_access()) {
         return;
     }
     switch ($this->method) {
         case 'search':
             //search for some images
             $this->result['images'] = array_merge((array) nggdb::search_for_images($this->term), (array) nggTags::find_images_for_tags($this->term, 'ASC'));
             break;
         case 'album':
             //search for some album  //TODO : Get images for each gallery, could end in a big db query
             $this->result['album'] = nggdb::find_album($this->id);
             break;
         case 'gallery':
             //search for some gallery
             $this->result['images'] = $this->id == 0 ? nggdb::find_last_images(0, 100) : nggdb::get_gallery($this->id, $ngg->options['galSort'], $ngg->options['galSortDir'], true, 0, 0, true);
             break;
         case 'image':
             //search for some image
             $this->result['images'] = nggdb::find_image($this->id);
             break;
         case 'tag':
             //search for images based on tags
             $this->result['images'] = nggTags::find_images_for_tags($this->term, 'ASC');
             break;
         case 'recent':
             //search for images based on tags
             $this->result['images'] = nggdb::find_last_images(0, $this->limit);
             break;
         case 'autocomplete':
             //return images, galleries or albums for autocomplete drop down list
             return $this->autocomplete();
             break;
         case 'version':
             $this->result = array('stat' => 'ok', 'version' => $ngg->version);
             return;
             break;
         default:
             $this->result = array('stat' => 'fail', 'code' => '98', 'message' => 'Method not known.');
             return false;
             break;
     }
     // result should be fine
     $this->result['stat'] = 'ok';
 }
开发者ID:BGCX261,项目名称:zhibeifw-in-tibetan-svn-to-git,代码行数:47,代码来源:json.php

示例6: nggCreateAlbum

/**
 * create a gallery overview output
 *
 * @access internal
 * @param array $galleriesID
 * @param string (optional) $template name for a template file, look for album-$template
 * @param object (optional) $album result from the db
 * @return the content
 */
function nggCreateAlbum($galleriesID, $template = 'extend', $album = 0)
{
    global $wpdb, $nggRewrite, $nggdb, $ngg;
    // $_GET from wp_query
    $nggpage = get_query_var('nggpage');
    // Get options
    $ngg_options = $ngg->options;
    //this option can currently only set via the custom fields
    $maxElement = (int) $ngg_options['galPagedGalleries'];
    $sortorder = $galleriesID;
    $galleries = array();
    // get the galleries information
    foreach ($galleriesID as $i => $value) {
        $galleriesID[$i] = addslashes($value);
    }
    $unsort_galleries = $wpdb->get_results('SELECT * FROM ' . $wpdb->nggallery . ' WHERE gid IN (\'' . implode('\',\'', $galleriesID) . '\')', OBJECT_K);
    //TODO: Check this, problem exist when previewpic = 0
    //$galleries = $wpdb->get_results('SELECT t.*, tt.* FROM '.$wpdb->nggallery.' AS t INNER JOIN '.$wpdb->nggpictures.' AS tt ON t.previewpic = tt.pid WHERE t.gid IN (\''.implode('\',\'', $galleriesID).'\')', OBJECT_K);
    // get the counter values
    $picturesCounter = $wpdb->get_results('SELECT galleryid, COUNT(*) as counter FROM ' . $wpdb->nggpictures . ' WHERE galleryid IN (\'' . implode('\',\'', $galleriesID) . '\') AND exclude != 1 GROUP BY galleryid', OBJECT_K);
    if (is_array($picturesCounter)) {
        foreach ($picturesCounter as $key => $value) {
            $unsort_galleries[$key]->counter = $value->counter;
        }
    }
    // get the id's of the preview images
    $imagesID = array();
    if (is_array($unsort_galleries)) {
        foreach ($unsort_galleries as $gallery_row) {
            $imagesID[] = $gallery_row->previewpic;
        }
    }
    $albumPreview = $wpdb->get_results('SELECT pid, filename FROM ' . $wpdb->nggpictures . ' WHERE pid IN (\'' . implode('\',\'', $imagesID) . '\')', OBJECT_K);
    // re-order them and populate some
    foreach ($sortorder as $key) {
        // Create a gallery object
        if (isset($unsort_galleries[$key])) {
            $galleries[$key] = $unsort_galleries[$key];
        } else {
            $galleries[$key] = new stdClass();
        }
        //if we have a prefix 'a' then it's a subalbum, instead a gallery
        if (substr($key, 0, 1) == 'a') {
            if ($subalbum = nggdb::find_album(substr($key, 1))) {
                $galleries[$key]->counter = count($subalbum->gallery_ids);
                if ($subalbum->previewpic > 0) {
                    $image = $nggdb->find_image($subalbum->previewpic);
                    $galleries[$key]->previewurl = isset($image->thumbURL) ? $image->thumbURL : '';
                }
                $galleries[$key]->previewpic = $subalbum->previewpic;
                $galleries[$key]->previewname = $subalbum->name;
                //link to the subalbum
                $args['album'] = $ngg_options['usePermalinks'] ? $subalbum->slug : $subalbum->id;
                $args['gallery'] = false;
                $args['nggpage'] = false;
                $pageid = isset($subalbum->pageid) ? $subalbum->pageid : 0;
                $galleries[$key]->pagelink = $pageid > 0 ? get_permalink($pageid) : $nggRewrite->get_permalink($args);
                $galleries[$key]->galdesc = html_entity_decode(nggGallery::i18n($subalbum->albumdesc));
                $galleries[$key]->title = html_entity_decode(nggGallery::i18n($subalbum->name));
            }
        } elseif (isset($unsort_galleries[$key])) {
            $galleries[$key] = $unsort_galleries[$key];
            // No images found, set counter to 0
            if (!isset($galleries[$key]->counter)) {
                $galleries[$key]->counter = 0;
                $galleries[$key]->previewurl = '';
            }
            // add the file name and the link
            if ($galleries[$key]->previewpic != 0) {
                $galleries[$key]->previewname = $albumPreview[$galleries[$key]->previewpic]->filename;
                $galleries[$key]->previewurl = site_url() . '/' . $galleries[$key]->path . '/thumbs/thumbs_' . $albumPreview[$galleries[$key]->previewpic]->filename;
            } else {
                $first_image = $wpdb->get_row('SELECT * FROM ' . $wpdb->nggpictures . ' WHERE exclude != 1 AND galleryid = ' . $key . ' ORDER by pid DESC limit 0,1');
                if (isset($first_image)) {
                    $galleries[$key]->previewpic = $first_image->pid;
                    $galleries[$key]->previewname = $first_image->filename;
                    $galleries[$key]->previewurl = site_url() . '/' . $galleries[$key]->path . '/thumbs/thumbs_' . $first_image->filename;
                }
            }
            // choose between variable and page link
            if ($ngg_options['galNoPages']) {
                $args['album'] = $ngg_options['usePermalinks'] ? $album->slug : $album->id;
                $args['gallery'] = $ngg_options['usePermalinks'] ? $galleries[$key]->slug : $key;
                $args['nggpage'] = false;
                $galleries[$key]->pagelink = $nggRewrite->get_permalink($args);
            } else {
                $galleries[$key]->pagelink = get_permalink($galleries[$key]->pageid);
            }
            // description can contain HTML tags
            $galleries[$key]->galdesc = html_entity_decode(nggGallery::i18n(stripslashes($galleries[$key]->galdesc), 'gal_' . $galleries[$key]->gid . '_description'));
            // i18n
//.........这里部分代码省略.........
开发者ID:valerol,项目名称:korpus,代码行数:101,代码来源:nggfunctions.php

示例7: nggShowAlbum

/**
 * 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;
}
开发者ID:pravinhirmukhe,项目名称:flow1,代码行数:38,代码来源:nggfunctions.php

示例8: getAlbum

 /**
  * Method "ngg.getAlbum"
  * Return the specified album
  *
  * @since 1.9.2
  *
  * @param array $args Method parameters.
  * 			- int blog_id
  *	    	- string username
  *	    	- string password
  *          - int album_id
  * @return array with the album object
  */
 function getAlbum($args)
 {
     $this->escape($args);
     $blog_ID = (int) $args[0];
     $username = $args[1];
     $password = $args[2];
     $id = (int) $args[3];
     if (!($user = $this->login($username, $password))) {
         return $this->error;
     }
     if (!current_user_can('NextGEN Edit album')) {
         return new IXR_Error(401, __('Sorry, you must be able to manage albums'));
     }
     $album = nggdb::find_album($id);
     return $album;
 }
开发者ID:valerol,项目名称:korpus,代码行数:29,代码来源:xmlrpc.php


注:本文中的nggdb::find_album方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。