本文整理汇总了PHP中nggdb::find_last_images方法的典型用法代码示例。如果您正苦于以下问题:PHP nggdb::find_last_images方法的具体用法?PHP nggdb::find_last_images怎么用?PHP nggdb::find_last_images使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类nggdb
的用法示例。
在下文中一共展示了nggdb::find_last_images方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: get_last_pictures_mrss
/**
* Get the XML <rss> node corresponding to the last pictures registered
*
* @param page The current page (defaults to 0)
* @param show The number of pictures to include in one field (default 30)
*/
function get_last_pictures_mrss($page = 0, $show = 30)
{
$images = nggdb::find_last_images($page, $show);
$title = stripslashes(get_option('blogname'));
$description = stripslashes(get_option('blogdescription'));
$link = site_url();
$prev_link = $page > 0 ? nggMediaRss::get_last_pictures_mrss_url($page - 1, $show) : '';
$next_link = count($images) != 0 ? nggMediaRss::get_last_pictures_mrss_url($page + 1, $show) : '';
return nggMediaRss::get_mrss_root_node($title, $description, $link, $prev_link, $next_link, $images);
}
示例2: nggShowRandomRecent
/**
* nggShowRandomRecent($type, $maxImages, $template, $galleryId) - return recent or random images
*
* @access public
* @param string $type 'id' (for latest addition to DB), 'date' (for image with the latest date), 'sort' (for image sorted by user order) or 'random'
* @param integer $maxImages of images
* @param string $template (optional) name for a template file, look for gallery-$template
* @param int $galleryId Limit to a specific gallery
* @return the content
*/
function nggShowRandomRecent($type, $maxImages, $template = '', $galleryId = 0)
{
// $_GET from wp_query
$pid = get_query_var('pid');
$pageid = get_query_var('pageid');
// get now the recent or random images
switch ($type) {
case 'random':
$picturelist = nggdb::get_random_images($maxImages, $galleryId);
break;
case 'id':
$picturelist = nggdb::find_last_images(0, $maxImages, true, $galleryId, 'id');
break;
case 'date':
$picturelist = nggdb::find_last_images(0, $maxImages, true, $galleryId, 'date');
break;
case 'sort':
$picturelist = nggdb::find_last_images(0, $maxImages, true, $galleryId, 'sort');
break;
default:
// default is by pid
$picturelist = nggdb::find_last_images(0, $maxImages, true, $galleryId, 'id');
}
// look for ImageBrowser if we have a $_GET('pid')
if ($pageid == get_the_ID() || !is_home()) {
if (!empty($pid)) {
$out = nggCreateImageBrowser($picturelist);
return $out;
}
}
// go on if not empty
if (empty($picturelist)) {
return;
}
// show gallery
if (is_array($picturelist)) {
$out = nggCreateGallery($picturelist, false, $template);
}
$out = apply_filters('ngg_show_images_content', $out, $picturelist);
return $out;
}
示例3: 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';
}
示例4: array
<?php
//引入图片插件入口文件
require_once './wp-content/plugins/nextgen-gallery/ngg-config.php';
require_once './inc/php/cfg.php';
$fotos = nggdb::find_last_images(0, 50);
//var_dump($fotos);
//取图片tags
$foto_ids = array();
foreach ($fotos as $foto) {
$foto_ids[] = $foto->pid;
}
$args = array('orderby' => 'name', 'order' => 'ASC', 'fields' => 'all_with_object_id');
$tags = wp_get_object_terms($foto_ids, 'ngg_tag', $args);
$tags_arr = array();
foreach ($tags as $tag) {
$tags_arr[$tag->object_id][] = array('term_id' => $tag->term_id, 'name' => $tag->name, 'slug' => $tag->slug);
}
header('Content-Type: text/xml; charset=' . get_option('blog_charset'), true);
echo '<?xml version="1.0" encoding="' . get_option('blog_charset') . '"?' . '>';
?>
<rss version="2.0"
xmlns:content="http://purl.org/rss/1.0/modules/content/"
xmlns:wfw="http://wellformedweb.org/CommentAPI/"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:atom="http://www.w3.org/2005/Atom"
xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
>
<channel>
示例5: tab_watermark
/**
* Show watermark related settings.
*/
private function tab_watermark()
{
global $ngg;
// take the first image as sample
$image_array = nggdb::find_last_images(0, 1);
$ngg_image = $image_array[0];
$imageID = $ngg_image->pid;
?>
<h3><?php
_e('Watermark', 'nggallery');
?>
</h3>
<p><?php
_e('Please note : you can only activate the watermark under -> Manage Galleries. This action cannot be undone.', 'nggallery');
?>
</p>
<form name="watermarkform" method="POST" action="<?php
echo $this->filepath . '#watermark';
?>
">
<?php
wp_nonce_field('ngg_settings');
?>
<input type="hidden" name="page_options" value="wmPos,wmXpos,wmYpos,wmType,wmPath,wmFont,wmSize,wmColor,wmText,wmOpaque" />
<div id="wm-preview">
<h3><?php
esc_html_e('Preview', 'nggallery');
?>
</h3>
<label for="wm-preview-select"><?php
_e('Select an image', 'nggallery');
?>
</label>
<select id="wm-preview-select" name="wm-preview-img" style="width: 200px">
<?php
echo '<option value="' . $ngg_image->pid . '">' . $ngg_image->pid . ' - ' . $ngg_image->alttext . '</option>';
?>
</select>
<div id="wm-preview-container">
<a id="wm-preview-image-url" href="<?php
echo home_url('index.php');
?>
?callback=image&pid=<?php
echo intval($imageID);
?>
&mode=watermark" target="_blank" title="<?php
_e("View full image", 'nggallery');
?>
">
<img id="wm-preview-image" src="<?php
echo home_url('index.php');
?>
?callback=image&pid=<?php
echo intval($imageID);
?>
&mode=watermark" />
</a>
</div>
<h3><?php
_e('Position', 'nggallery');
?>
</h3>
<table id="wm-position">
<tr>
<td>
<strong><?php
_e('Position', 'nggallery');
?>
</strong>
<table>
<tr>
<td><input type="radio" name="wmPos" value="topLeft" <?php
checked('topLeft', $ngg->options['wmPos']);
?>
/></td>
<td><input type="radio" name="wmPos" value="topCenter" <?php
checked('topCenter', $ngg->options['wmPos']);
?>
/></td>
<td><input type="radio" name="wmPos" value="topRight" <?php
checked('topRight', $ngg->options['wmPos']);
?>
/></td>
</tr>
<tr>
<td><input type="radio" name="wmPos" value="midLeft" <?php
checked('midLeft', $ngg->options['wmPos']);
?>
/></td>
<td><input type="radio" name="wmPos" value="midCenter" <?php
checked('midCenter', $ngg->options['wmPos']);
?>
/></td>
<td><input type="radio" name="wmPos" value="midRight" <?php
checked('midRight', $ngg->options['wmPos']);
?>
/></td>
//.........这里部分代码省略.........