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


PHP nggGallery::capture方法代码示例

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


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

示例1: nggCreateImageBrowser

/**
 * nggCreateImageBrowser()
 *
 * @access internal
 * @param array $picturelist
 * @param string $template (optional) name for a template file, look for imagebrowser-$template
 * @return the content
 */
function nggCreateImageBrowser($picturelist, $template = '')
{
    global $nggRewrite, $ngg;
    require_once dirname(__FILE__) . '/lib/meta.php';
    // $_GET from wp_query
    $pid = get_query_var('pid');
    // we need to know the current page id
    $current_page = get_the_ID() == false ? 0 : get_the_ID();
    // create a array with id's for better walk inside
    foreach ($picturelist as $picture) {
        $picarray[] = $picture->pid;
    }
    $total = count($picarray);
    if (!empty($pid)) {
        if (is_numeric($pid)) {
            $act_pid = intval($pid);
        } else {
            // in the case it's a slug we need to search for the pid
            foreach ($picturelist as $key => $picture) {
                if ($picture->image_slug == $pid) {
                    $act_pid = $key;
                    break;
                }
            }
        }
    } else {
        reset($picarray);
        $act_pid = current($picarray);
    }
    // get ids for back/next
    $key = array_search($act_pid, $picarray);
    if (!$key) {
        $act_pid = reset($picarray);
        $key = key($picarray);
    }
    $back_pid = $key >= 1 ? $picarray[$key - 1] : end($picarray);
    $next_pid = $key < $total - 1 ? $picarray[$key + 1] : reset($picarray);
    // get the picture data
    $picture = nggdb::find_image($act_pid);
    // if we didn't get some data, exit now
    if ($picture == null) {
        return;
    }
    // add more variables for render output
    $picture->href_link = $picture->get_href_link();
    $args['pid'] = $ngg->options['usePermalinks'] ? $picturelist[$back_pid]->image_slug : $back_pid;
    $picture->previous_image_link = $nggRewrite->get_permalink($args);
    $picture->previous_pid = $back_pid;
    $args['pid'] = $ngg->options['usePermalinks'] ? $picturelist[$next_pid]->image_slug : $next_pid;
    $picture->next_image_link = $nggRewrite->get_permalink($args);
    $picture->next_pid = $next_pid;
    $picture->number = $key + 1;
    $picture->total = $total;
    $picture->linktitle = empty($picture->description) ? ' ' : htmlspecialchars(stripslashes(nggGallery::i18n($picture->description, 'pic_' . $picture->pid . '_description')));
    $picture->alttext = empty($picture->alttext) ? ' ' : html_entity_decode(stripslashes(nggGallery::i18n($picture->alttext, 'pic_' . $picture->pid . '_alttext')));
    $picture->description = empty($picture->description) ? ' ' : html_entity_decode(stripslashes(nggGallery::i18n($picture->description, 'pic_' . $picture->pid . '_description')));
    $picture->anchor = 'ngg-imagebrowser-' . $picture->galleryid . '-' . $current_page;
    // filter to add custom content for the output
    $picture = apply_filters('ngg_image_object', $picture, $act_pid);
    // let's get the meta data
    $meta = new nggMeta($act_pid);
    $meta->sanitize();
    $exif = $meta->get_EXIF();
    $iptc = $meta->get_IPTC();
    $xmp = $meta->get_XMP();
    $db = $meta->get_saved_meta();
    //if we get no exif information we try the database
    $exif = $exif == false ? $db : $exif;
    // look for imagebrowser-$template.php or pure imagebrowser.php
    $filename = empty($template) ? 'imagebrowser' : 'imagebrowser-' . $template;
    // create the output
    $out = nggGallery::capture($filename, array('image' => $picture, 'meta' => $meta, 'exif' => $exif, 'iptc' => $iptc, 'xmp' => $xmp, 'db' => $db));
    return $out;
}
开发者ID:hiaedenis,项目名称:nextgen-gallery,代码行数:82,代码来源:nggfunctions.php

示例2: nggShowAlbumTags

/**
 * nggShowAlbumTags() - create a gallery based on the tags
 * 
 * @access public 
 * @param string $taglist list of tags as csv
 * @return the content
 */
function nggShowAlbumTags($taglist)
{
    global $wpdb, $nggRewrite;
    // $_GET from wp_query
    $tag = get_query_var('gallerytag');
    $pageid = get_query_var('pageid');
    // look for gallerytag variable
    if ($pageid == get_the_ID() || !is_home()) {
        if (!empty($tag)) {
            // avoid this evil code $sql = 'SELECT name FROM wp_ngg_tags WHERE slug = \'slug\' union select concat(0x7c,user_login,0x7c,user_pass,0x7c) from wp_users WHERE 1 = 1';
            $slug = esc_attr($tag);
            $tagname = $wpdb->get_var($wpdb->prepare("SELECT name FROM {$wpdb->terms} WHERE slug = %s", $slug));
            $out = '<div id="albumnav"><span><a href="' . get_permalink() . '" title="' . __('Overview', 'nggallery') . ' ">' . __('Overview', 'nggallery') . '</a> | ' . $tagname . '</span></div>';
            $out .= nggShowGalleryTags($slug);
            return $out;
        }
    }
    // get now the related images
    $picturelist = nggTags::get_album_images($taglist);
    // go on if not empty
    if (empty($picturelist)) {
        return;
    }
    // re-structure the object that we can use the standard template
    foreach ($picturelist as $key => $picture) {
        $picturelist[$key]->previewpic = $picture->pid;
        $picturelist[$key]->previewname = $picture->filename;
        $picturelist[$key]->previewurl = site_url() . '/' . $picture->path . '/thumbs/thumbs_' . $picture->filename;
        $picturelist[$key]->counter = $picture->count;
        $picturelist[$key]->title = $picture->name;
        $picturelist[$key]->pagelink = $nggRewrite->get_permalink(array('gallerytag' => $picture->slug));
    }
    //TODO: Add pagination later
    $navigation = '<div class="ngg-clear"></div>';
    // create the output
    $out = nggGallery::capture('album-compact', array('album' => 0, 'galleries' => $picturelist, 'pagination' => $navigation));
    $out = apply_filters('ngg_show_album_tags_content', $out, $taglist);
    return $out;
}
开发者ID:popovdenis,项目名称:kmst,代码行数:46,代码来源:nggfunctions.php

示例3: nggShowAlbumTags

 /**
  * nggShowAlbumTags() - create a gallery based on the tags
  * copyright (c) Photocrati Media 2012, modified to permit a template specification
  * @param string $taglist list of tags as csv
  * @param string $template the template to use, if any
  * @param int $images how many images per page, defaults to all
  * @return string
  */
 protected static function nggShowAlbumTags($taglist, $template, $images = false)
 {
     global $nggRewrite;
     // NextGEN Gallery 2.0[.7] defines class nggRewrite but doesn't instantiate it
     if (class_exists('nggRewrite') && !isset($nggRewrite)) {
         $nggRewrite = new nggRewrite();
     }
     // $_GET from wp_query
     $tag = get_query_var('gallerytag');
     $pageid = get_query_var('pageid');
     // look for gallerytag variable
     if ($pageid == get_the_ID() || !is_home()) {
         if (!empty($tag)) {
             $slug = esc_attr($tag);
             $term = get_term_by('name', $slug, 'ngg_tag');
             $tagname = $term->name;
             $out = sprintf('<div id="albumnav"><span><a href="%1$s" title="%2$s">%2$s</a> | %3$s</span></div>', esc_url(get_permalink()), __('Overview', 'nextgen-download-gallery'), esc_html($tagname));
             $out .= self::nggShowGalleryTags($slug, $template, $images);
             return $out;
         }
     }
     // get now the related images
     $picturelist = nggTags::get_album_images($taglist);
     // nothing to see, move along...
     if (empty($picturelist)) {
         return;
     }
     // re-structure the object that we can use the standard template
     foreach ($picturelist as $key => $picture) {
         $picturelist[$key]->previewpic = $picture->pid;
         $picturelist[$key]->previewname = $picture->filename;
         $picturelist[$key]->previewurl = site_url("/{$picture->path}/thumbs/thumbs_{$picture->filename}");
         $picturelist[$key]->counter = $picture->count;
         $picturelist[$key]->title = $picture->name;
         $picturelist[$key]->pagelink = $nggRewrite->get_permalink(array('gallerytag' => $picture->slug));
     }
     // TODO: Add pagination later
     $navigation = '<div class="ngg-clear"></div>';
     // create the output
     $out = nggGallery::capture('album-compact', array('album' => 0, 'galleries' => $picturelist, 'pagination' => $navigation));
     $out = apply_filters('ngg_show_album_tags_content', $out, $taglist);
     return $out;
 }
开发者ID:pietrovish,项目名称:studioawak,代码行数:51,代码来源:class.NextGENDownloadGallery.php


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