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


PHP shortenContent函数代码示例

本文整理汇总了PHP中shortenContent函数的典型用法代码示例。如果您正苦于以下问题:PHP shortenContent函数的具体用法?PHP shortenContent怎么用?PHP shortenContent使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: getItemNews

 /**
  * Gets the feed item data in a Zenpage news feed
  *
  * @param array $item Titlelink a Zenpage article or filename of an image if a combined feed
  * @return array
  */
 protected function getItemNews($item)
 {
     $categories = '';
     $feeditem['enclosure'] = '';
     $obj = newArticle($item['titlelink']);
     $title = $feeditem['title'] = get_language_string($obj->getTitle('all'), $this->locale);
     $link = $obj->getLink();
     $count2 = 0;
     $plaincategories = $obj->getCategories();
     $categories = '';
     foreach ($plaincategories as $cat) {
         $catobj = newCategory($cat['titlelink']);
         $categories .= get_language_string($catobj->getTitle('all'), $this->locale) . ', ';
     }
     $categories = rtrim($categories, ', ');
     $feeditem['desc'] = shortenContent($obj->getContent($this->locale), getOption('RSS_truncate_length'), '...');
     if (!empty($categories)) {
         $feeditem['category'] = html_encode($categories);
         $feeditem['title'] = $title . ' (' . $categories . ')';
     }
     $feeditem['link'] = PROTOCOL . '://' . $this->host . $link;
     $feeditem['media_content'] = '';
     $feeditem['media_thumbnail'] = '';
     $feeditem['pubdate'] = date("r", strtotime($item['date']));
     return $feeditem;
 }
开发者ID:ariep,项目名称:ZenPhoto20-DEV,代码行数:32,代码来源:rss.php

示例2: printNestedMenu

/**
 * Prints a context sensitive menu of all pages as a unordered html list
 *
 * @param string $option The mode for the menu:
 * 												"list" context sensitive toplevel plus sublevel pages,
 * 												"list-top" only top level pages,
 * 												"omit-top" only sub level pages
 * 												"list-sub" lists only the current pages direct offspring
 * @param string $mode 'pages' or 'categories'
 * @param bool $counter Only $mode = 'categories': Count the articles in each category
 * @param string $css_id CSS id of the top level list
 * @param string $css_class_topactive class of the active item in the top level list
 * @param string $css_class CSS class of the sub level list(s)
 * @param string $$css_class_active CSS class of the sub level list(s)
 * @param string $indexname insert the name (default "Gallery Index") how you want to call the link to the gallery index, insert "" (default) if you don't use it, it is not printed then.
 * @param int $showsubs Set to depth of sublevels that should be shown always. 0 by default. To show all, set to a true! Only valid if option=="list".
 * @param bool $startlist set to true to output the UL tab (false automatically if you use 'omit-top' or 'list-sub')
 * @param int $limit truncation limit display strings
 * @return string
 */
function printNestedMenu($option = 'list', $mode = NULL, $counter = TRUE, $css_id = NULL, $css_class_topactive = NULL, $css_class = NULL, $css_class_active = NULL, $indexname = NULL, $showsubs = 0, $startlist = true, $limit = NULL)
{
    global $_zp_zenpage, $_zp_gallery_page, $_zp_current_zenpage_news, $_zp_current_zenpage_page, $_zp_current_category;
    if (is_null($limit)) {
        $limit = MENU_TRUNCATE_STRING;
    }
    if ($css_id != "") {
        $css_id = " id='" . $css_id . "'";
    }
    if ($css_class_topactive != "") {
        $css_class_topactive = " class='" . $css_class_topactive . "'";
    }
    if ($css_class != "") {
        $css_class = " class='" . $css_class . "'";
    }
    if ($css_class_active != "") {
        $css_class_active = " class='" . $css_class_active . "'";
    }
    if ($showsubs === true) {
        $showsubs = 9999999999.0;
    }
    switch ($mode) {
        case 'pages':
            $items = $_zp_zenpage->getPages();
            $currentitem_id = getPageID();
            if (is_object($_zp_current_zenpage_page)) {
                $currentitem_parentid = $_zp_current_zenpage_page->getParentID();
            } else {
                $currentitem_parentid = NULL;
            }
            $currentitem_sortorder = getPageSortorder();
            break;
        case 'categories':
        case 'allcategories':
            $items = $_zp_zenpage->getAllCategories();
            if (is_object($_zp_current_category) && $mode == 'categories') {
                $currentitem_sortorder = $_zp_current_category->getSortOrder();
                $currentitem_id = $_zp_current_category->getID();
                $currentitem_parentid = $_zp_current_category->getParentID();
            } else {
                $currentitem_sortorder = NULL;
                $currentitem_id = NULL;
                $currentitem_parentid = NULL;
            }
            break;
    }
    // don't highlight current pages or foldout if in search mode as next_page() sets page context
    if (in_context(ZP_SEARCH) && $mode == 'pages') {
        // categories are not searched
        $css_class_topactive = "";
        $css_class_active = "";
        rem_context(ZP_ZENPAGE_PAGE);
    }
    if (0 == count($items) + (int) ($mode == 'allcategories')) {
        return;
    }
    // nothing to do
    $startlist = $startlist && !($option == 'omit-top' || $option == 'list-sub');
    if ($startlist) {
        echo "<ul{$css_id}>";
    }
    // if index link and if if with count
    if (!empty($indexname)) {
        if ($limit) {
            $display = shortenContent($indexname, $limit, MENU_TRUNCATE_INDICATOR);
        } else {
            $display = $indexname;
        }
        switch ($mode) {
            case 'pages':
                if ($_zp_gallery_page == "index.php") {
                    echo "<li {$css_class_topactive}>" . html_encode($display) . "</li>";
                } else {
                    echo "<li><a href='" . html_encode(getGalleryIndexURL()) . "' title='" . html_encode($indexname) . "'>" . html_encode($display) . "</a></li>";
                }
                break;
            case 'categories':
            case 'allcategories':
                if ($_zp_gallery_page == "news.php" && !is_NewsCategory() && !is_NewsArchive() && !is_NewsArticle()) {
                    echo "<li {$css_class_topactive}>" . html_encode($display);
//.........这里部分代码省略.........
开发者ID:rauldobrota,项目名称:zenphoto,代码行数:101,代码来源:zenpage-template-functions.php

示例3: while

</small></h5>
					<ul class="searchresults">
						<?php 
        while (next_news()) {
            $c++;
            ?>
							<li<?php 
            printZDToggleClass('news', $c, $number_to_show);
            ?>
>
								<h6><?php 
            printNewsURL();
            ?>
</h6>
								<p class="zenpageexcerpt"><?php 
            echo html_encodeTagged(shortenContent(strip_tags(getNewsContent()), 80, getOption("zenpage_textshorten_indicator")));
            ?>
</p>
							</li>
					<?php 
        }
        ?>
					</ul>
					<hr />
			<?php 
    }
    ?>
			</div>
				<?php 
}
?>
开发者ID:ariep,项目名称:ZenPhoto20-DEV,代码行数:31,代码来源:search.php

示例4: printAlbumMenuListAlbum

/**
 * Handles an album for printAlbumMenuList
 *
 * @param array $albums albums array
 * @param string $folder
 * @param string $option see printAlbumMenuList
 * @param string $showcount see printAlbumMenuList
 * @param int $showsubs see printAlbumMenuList
 * @param string $css_class see printAlbumMenuList
 * @param string $css_class_topactive see printAlbumMenuList
 * @param string $css_class_active see printAlbumMenuList
 * @param bool $firstimagelink If set to TRUE and if the album has images the link will point to page of the first image instead the album thumbnail page
 * @param bool $keeptopactive If set to TRUE the toplevel album entry will stay marked as active if within its subalbums ("list" only)
 * @param int $limit truncation of display text
 */
function printAlbumMenuListAlbum($albums, $folder, $option, $showcount, $showsubs, $css_class, $css_class_topactive, $css_class_active, $firstimagelink, $keeptopactive, $limit = NULL)
{
    global $_zp_gallery, $_zp_current_album, $_zp_current_search, $_recursion_limiter;
    if (is_null($limit)) {
        $limit = MENU_TRUNCATE_STRING;
    }
    if (is_null($showcount)) {
        $showcount = ALBUM_MENU_COUNT;
    }
    if (is_null($showsubs)) {
        $showsubs = ALBUM_MENU_SHOWSUBS;
    }
    if ($showsubs && !is_numeric($showsubs)) {
        $showsubs = 9999999999.0;
    }
    $pagelevel = count(explode('/', $folder));
    $currenturalbumname = "";
    foreach ($albums as $album) {
        $level = count(explode('/', $album));
        $process = $level < $showsubs && $option == "list" || $option != 'list-top' && strpos($folder, $album) === 0 && $level <= $pagelevel;
        if ($process && hasDynamicAlbumSuffix($album) && !is_dir(ALBUM_FOLDER_SERVERPATH . $album)) {
            if (in_array($album, $_recursion_limiter)) {
                $process = false;
            }
            // skip already seen dynamic albums
        }
        $topalbum = newAlbum($album, true);
        if ($level > 1 || $option != 'omit-top') {
            // listing current level album
            if ($level == 1) {
                $css_class_t = $css_class_topactive;
            } else {
                $css_class_t = $css_class_active;
            }
            if ($keeptopactive) {
                if (isset($_zp_current_album) && is_object($_zp_current_album)) {
                    $currenturalbum = getUrAlbum($_zp_current_album);
                    $currenturalbumname = $currenturalbum->name;
                }
            }
            $count = "";
            if ($showcount) {
                $toplevelsubalbums = $topalbum->getAlbums();
                $toplevelsubalbums = count($toplevelsubalbums);
                $topalbumnumimages = $topalbum->getNumImages();
                if ($topalbumnumimages + $toplevelsubalbums > 0) {
                    $count = ' <span style="white-space:nowrap;"><small>(';
                    if ($toplevelsubalbums > 0) {
                        $count .= sprintf(ngettext('%u album', '%u albums', $toplevelsubalbums), $toplevelsubalbums);
                    }
                    if ($topalbumnumimages > 0) {
                        if ($toplevelsubalbums) {
                            $count .= ' ';
                        }
                        $count .= sprintf(ngettext('%u image', '%u images', $topalbumnumimages), $topalbumnumimages);
                    }
                    $count .= ')</small></span>';
                }
            }
            if (in_context(ZP_ALBUM) && !in_context(ZP_SEARCH_LINKED) && (@$_zp_current_album->getID() == $topalbum->getID() || $topalbum->name == $currenturalbumname) || in_context(ZP_SEARCH_LINKED) && ($a = $_zp_current_search->getDynamicAlbum()) && $a->name == $topalbum->name) {
                $current = $css_class_t . ' ';
            } else {
                $current = "";
            }
            $title = $topalbum->getTitle();
            if ($limit) {
                $display = shortenContent($title, $limit, MENU_TRUNCATE_INDICATOR);
            } else {
                $display = $title;
            }
            if ($firstimagelink && $topalbum->getNumImages() != 0) {
                $link = "<li><a " . $current . "href='" . html_encode($topalbum->getImage(0)->getLink()) . "' title='" . html_encode($title) . "'>" . html_encode($display) . "</a>" . $count;
            } else {
                $link = "<li><a " . $current . "href='" . html_encode($topalbum->getLink(1)) . "' title='" . html_encode($title) . "'>" . html_encode($display) . "</a>" . $count;
            }
            echo $link;
        }
        if ($process) {
            // listing subalbums
            $subalbums = $topalbum->getAlbums();
            if (!empty($subalbums)) {
                echo "\n<ul" . $css_class . ">\n";
                array_push($_recursion_limiter, $album);
                printAlbumMenuListAlbum($subalbums, $folder, $option, $showcount, $showsubs, $css_class, $css_class_topactive, $css_class_active, $firstimagelink, false, $limit);
                array_pop($_recursion_limiter);
//.........这里部分代码省略.........
开发者ID:rauldobrota,项目名称:zenphoto,代码行数:101,代码来源:print_album_menu.php

示例5: while

</small></div>
					<ul class="searchresults news">
					<?php 
        while (next_news()) {
            $c++;
            ?>
						<li<?php 
            printZDToggleClass('news', $c, $number_to_show);
            ?>
>
						<h4><?php 
            printNewsURL();
            ?>
</h4>
							<p class="zenpageexcerpt"><?php 
            echo shortenContent(strip_tags(getNewsContent()), 80, getOption("zenpage_textshorten_indicator"));
            ?>
</p>
						</li>
						<?php 
        }
        ?>
					</ul>
				<?php 
    }
}
?>
			<h3 class="searchheader imgresults">
			<?php 
$alb = 'album';
$imgs = 'image';
开发者ID:Imagenomad,项目名称:Unsupported,代码行数:31,代码来源:search.php

示例6: exerpt

function exerpt($content, $length)
{
    return shortenContent(getBare($content), $length, getOption("zenpage_textshorten_indicator"));
}
开发者ID:rb26,项目名称:zenphoto,代码行数:4,代码来源:functions.php

示例7: getItemNews

 /**
  * Gets the feed item data in a Zenpage news feed
  *
  * @param array $item Titlelink a Zenpage article or filename of an image if a combined feed
  * @return array
  */
 protected function getItemNews($item)
 {
     $categories = '';
     $feeditem['enclosure'] = '';
     $obj = new ZenpageNews($item['titlelink']);
     $title = $feeditem['title'] = get_language_string($obj->getTitle('all'), $this->locale);
     $link = $obj->getLink();
     $count2 = 0;
     $plaincategories = $obj->getCategories();
     $categories = '';
     foreach ($plaincategories as $cat) {
         $catobj = new ZenpageCategory($cat['titlelink']);
         $categories .= get_language_string($catobj->getTitle('all'), $this->locale) . ', ';
     }
     $categories = rtrim($categories, ', ');
     $desc = $obj->getContent($this->locale);
     $desc = str_replace('//<![CDATA[', '', $desc);
     $desc = str_replace('//]]>', '', $desc);
     $feeditem['desc'] = shortenContent($desc, getOption('externalFeed_truncate_length'), '...');
     if (!empty($categories)) {
         $feeditem['category'] = html_encode($categories);
         $feeditem['title'] = $title . ' (' . $categories . ')';
     }
     $feeditem['link'] = $link;
     $feeditem['media_content'] = '';
     $feeditem['media_thumbnail'] = '';
     $feeditem['pubdate'] = date("r", strtotime($obj->getDateTime()));
     return $feeditem;
 }
开发者ID:JoniWeiss,项目名称:JoniWebGirl,代码行数:35,代码来源:externalFeed.php

示例8: printRelatedItems


//.........这里部分代码省略.........
                    $obj = new ZenpagePage($item['name']);
                    $url = $obj->getLink();
                    $text = $obj->getContent();
                    $category = gettext('Page');
                    break;
            }
            ?>
					<?php 
            if ($thumb) {
                $thumburl = false;
                switch ($item['type']) {
                    case 'albums':
                        $thumburl = $obj->getThumb();
                        break;
                    case 'images':
                        $thumburl = $obj->getThumb();
                        break;
                }
                if ($thumburl) {
                    ?>
							<a href="<?php 
                    echo html_encode(pathurlencode($url));
                    ?>
" title="<?php 
                    echo html_encode($obj->getTitle());
                    ?>
" class="relateditems_thumb">
								<img src="<?php 
                    echo html_encode(pathurlencode($thumburl));
                    ?>
" alt="<?php 
                    echo html_encode($obj->getTitle());
                    ?>
" />
							</a>
							<?php 
                }
            }
            ?>
					<h4><a href="<?php 
            echo html_encode(pathurlencode($url));
            ?>
" title="<?php 
            echo html_encode($obj->getTitle());
            ?>
"><?php 
            echo html_encode($obj->getTitle());
            ?>
</a>
						<?php 
            if ($date) {
                switch ($item['type']) {
                    case 'albums':
                    case 'images':
                        $d = $obj->getDateTime();
                        break;
                    case 'news':
                    case 'pages':
                        $d = $obj->getDateTime();
                        break;
                }
                ?>
							<span class="relateditems_date">
								<?php 
                echo zpFormattedDate(DATE_FORMAT, strtotime($d));
                ?>
							</span>
							<?php 
            }
            ?>
						<?php 
            if ($type == 'all') {
                ?>
 (<small><?php 
                echo $category;
                ?>
</small>)<?php 
            }
            ?>

					</h4>
					<?php 
            if ($excerpt) {
                echo shortenContent($text, $excerpt, '...', true);
            }
            ?>
				</li>
				<?php 
            if ($count == $number) {
                break;
            }
        }
        // foreach
        if ($count) {
            ?>
			</ul>
			<?php 
        }
    }
}
开发者ID:rb26,项目名称:zenphoto,代码行数:101,代码来源:related_items.php

示例9: printf

        ?>
		<div>
			<ul class="search-item"><li><?php 
        printf(gettext('Pages (%s)'), $numpages);
        ?>
</li></ul>
		<?php 
        while (next_page()) {
            ?>
				<div class="news-truncate clearfix">
					<h3 class="search-title"><?php 
            printPageURL();
            ?>
</h3>
					<div class="search-content clearfix">
			<?php 
            echo html_encodeTagged(shortenContent(getBare(getPageContent()), 100, getOption("zenpage_textshorten_indicator")));
            ?>
					</div>
				</div>
		<?php 
        }
        ?>
		</div>
		<?php 
    }
}
?>

<?php 
include 'inc_footer.php';
开发者ID:ariep,项目名称:ZenPhoto20-DEV,代码行数:31,代码来源:search.php

示例10: printImageStatistic

/**
 * Prints image statistic according to $option as an unordered HTML list
 * A css id is attached by default named accordingly'$option'
 *
 * @param string $number the number of albums to get
 * @param string $option "popular" for the most popular images,
 *                       "latest" for the latest uploaded,
 *                       "latest-date" for the latest uploaded, but fetched by date,
 * 											 "latest-mtime" for the latest uploaded, but fetched by mtime,
 *                       "mostrated" for the most voted,
 *                       "toprated" for the best voted
 * @param string $albumfolder foldername of an specific album
 * @param bool $showtitle if the image title should be shown
 * @param bool $showdate if the image date should be shown
 * @param bool $showdesc if the image description should be shown
 * @param integer $desclength the length of the description to be shown
 * @param string $showstatistic "hitcounter" for showing the hitcounter (views),
 * 															"rating" for rating,
 * 															"rating+hitcounter" for both.
 * @param integer $width the width/cropwidth of the thumb if crop=true else $width is longest size. (Default 85px)
 * @param integer $height the height/cropheight of the thumb if crop=true else not used.  (Default 85px)
 * @param bool $crop 'true' (default) if the thumb should be cropped, 'false' if not
 * @param bool $collection only if $albumfolder is set: true if you want to get statistics from this album and all of its subalbums
 *
 * @return string
 */
function printImageStatistic($number, $option, $albumfolder = '', $showtitle = false, $showdate = false, $showdesc = false, $desclength = 40, $showstatistic = '', $width = 85, $height = 85, $crop = true, $collection = false)
{
    $images = getImageStatistic($number, $option, $albumfolder, $collection);
    echo "\n<div id=\"{$option}\">\n";
    echo "<ul>";
    foreach ($images as $image) {
        echo "<li><a href=\"" . html_encode($image->getImageLink()) . "\" title=\"" . html_encode($image->getTitle()) . "\">\n";
        if ($crop) {
            echo "<img src=\"" . html_encode($image->getCustomImage(NULL, $width, $height, $width, $height, NULL, NULL, TRUE)) . "\" alt=\"" . html_encode($image->getTitle()) . "\" /></a>\n";
        } else {
            echo "<img src=\"" . html_encode($image->getCustomImage($width, NULL, NULL, NULL, NULL, NULL, NULL, TRUE)) . "\" alt=\"" . html_encode($image->getTitle()) . "\" /></a>\n";
        }
        if ($showtitle) {
            echo "<h3><a href=\"" . html_encode($image->getImageLink()) . "\" title=\"" . html_encode($image->getTitle()) . "\">\n";
            echo $image->getTitle() . "</a></h3>\n";
        }
        if ($showdate) {
            echo "<p>" . zpFormattedDate(DATE_FORMAT, strtotime($image->getDateTime())) . "</p>";
        }
        if ($showstatistic === "rating" or $showstatistic === "rating+hitcounter") {
            $votes = $image->get("total_votes");
            $value = $image->get("total_value");
            if ($votes != 0) {
                $rating = round($value / $votes, 1);
            }
            echo "<p>" . sprintf(gettext('Rating: %1$u (Votes: %2$u)'), $rating, $votes) . "</p>";
        }
        if ($showstatistic === "hitcounter" or $showstatistic === "rating+hitcounter") {
            $hitcounter = $image->get("hitcounter");
            if (empty($hitcounter)) {
                $hitcounter = "0";
            }
            echo "<p>" . sprintf(gettext("Views: %u"), $hitcounter) . "</p>";
        }
        if ($showdesc) {
            echo shortenContent($image->getDesc(), $desclength, ' (...)');
        }
        echo "</li>";
    }
    echo "</ul></div>\n";
}
开发者ID:hatone,项目名称:zenphoto-1.4.1.4,代码行数:67,代码来源:image_album_statistics.php

示例11: shortenContent

</h1>
					<?php 
}
?>
				</div>
			</div>
			
			<div id="home-bar">
				<div id="gal-desc-wrap">
					<?php 
if (getGalleryDesc()) {
    ?>
					<div id="gal-desc">
						<div class="inner pad">
							<div><?php 
    echo shortenContent(getGalleryDesc(), 400, '...');
    ?>
</div>
						</div>
					</div>
					<?php 
}
?>
					<div class="inner pad">
						<div id="cbp-bicontrols" class="cbp-bicontrols">	
							<span class="cbp-biprev"></span>
							<span class="cbp-bipause"></span>
							<span class="cbp-binext"></span>
						</div>
					</div>
				</div>
开发者ID:ckfreeman,项目名称:libratus,代码行数:31,代码来源:index.php

示例12: while

        }
    }
    if ($numnews > 0) {
        while (next_news()) {
            ?>
						<div class="one-half column">
							<div class="news-clip">
								<div class="bold-header"><?php 
            printNewsURL();
            ?>
 <small><em><i title="<?php 
            echo gettext('News Result');
            ?>
" class="fa fa-newspaper-o fa-fw"></i></em></small></div>
								<div class="search-excerpt"><?php 
            echo shortenContent(strip_tags(getNewsContent()), 200, getOption('zenpage_textshorten_indicator'));
            ?>
</div>
							</div>
						</div>
					<?php 
            $c++;
            if ($c == 2) {
                echo '</div><div class="row">';
                $c = 0;
            }
        }
    }
    ?>
					</div>
					<?php 
开发者ID:ckfreeman,项目名称:libratus,代码行数:31,代码来源:search.php

示例13: getNextNewsURL

		<?php 
        }
        ?>
			<?php 
        if (getNextNewsURL()) {
            ?>
				<li class="next span6 pull-right">
					<a href="<?php 
            $article_url = getNextNewsURL();
            echo $article_url['link'];
            ?>
" title="<?php 
            echo $article_url['title'];
            ?>
"><?php 
            echo html_encodeTagged(shortenContent($article_url['title'], 30, '(...)'));
            ?>
 &rarr; </a>
				</li>
		<?php 
        }
        ?>
		</ul>
			<?php 
    }
    ?>

	<div class="row">
		<div class="span9">
			<?php 
    include 'inc_print_news.php';
开发者ID:ariep,项目名称:ZenPhoto20-DEV,代码行数:31,代码来源:news.php

示例14: url

<?php

include 'inc-header.php';
?>

		<div id="page-header" class="wrap" style="background-image: linear-gradient(rgba(0, 0, 0, 0.75),rgba(0, 0, 0, 0.75)), url(<?php 
echo $bg;
?>
);">
			<div class="inner">
				<h1><?php 
printAlbumTitle();
?>
</h1>
				<div class="desc"><?php 
echo shortenContent(getAlbumDesc(), 300, '...');
?>
</div>
			</div>
		</div>
		<a id="view"></a>
		
		<div class="bar">
			<div class="inner">
				<?php 
echo $quickmenu;
?>
				<div class="pad" id="breadcrumb">
					<a href="<?php 
echo getGalleryIndexURL();
?>
开发者ID:ckfreeman,项目名称:libratus,代码行数:31,代码来源:image.php

示例15: zpArdoise_printImageStatistic

function zpArdoise_printImageStatistic($number, $option, $albumfolder = '', $showtitle = false, $showdate = false, $showdesc = false, $desclength = 40, $showstatistic = '', $width = NULL, $height = NULL, $crop = NULL, $collection = false, $fullimagelink = false, $threshold = 0, $a_class = NULL)
{
    $images = getImageStatistic($number, $option, $albumfolder, $collection, $threshold);
    if (is_null($crop) && is_null($width) && is_null($height)) {
        $crop = 2;
    } else {
        if (is_null($width)) {
            $width = 85;
        }
        if (is_null($height)) {
            $height = 85;
        }
        if (is_null($crop)) {
            $crop = 1;
        } else {
            $crop = (int) $crop && true;
        }
    }
    echo "\n<div id=\"{$option}\">\n";
    echo "<ul>";
    foreach ($images as $image) {
        if ($fullimagelink) {
            $aa_class = ' class="' . $a_class . '"';
            $imagelink = $image->getFullImageURL();
        } else {
            $aa_class = NULL;
            $imagelink = $image->getLink();
        }
        echo "<li><a href=\"" . html_encode(pathurlencode($imagelink)) . "\"" . $aa_class . " title=\"" . html_encode($image->getTitle()) . "\">\n";
        switch ($crop) {
            case 0:
                echo "<img src=\"" . html_encode(pathurlencode($image->getCustomImage($width, NULL, NULL, NULL, NULL, NULL, NULL, TRUE))) . "\" alt=\"" . html_encode($image->getTitle()) . "\" /></a>\n";
                break;
            case 1:
                echo "<img src=\"" . html_encode(pathurlencode($image->getCustomImage(NULL, $width, $height, $width, $height, NULL, NULL, TRUE))) . "\" alt=\"" . html_encode($image->getTitle()) . "\" width=\"" . $width . "\" height=\"" . $height . "\" /></a>\n";
                break;
            case 2:
                echo "<img src=\"" . html_encode(pathurlencode($image->getThumb())) . "\" alt=\"" . html_encode($image->getTitle()) . "\" /></a>\n<br />";
                break;
        }
        if ($showtitle) {
            echo "<h3><a href=\"" . html_encode(pathurlencode($image->getLink())) . "\" title=\"" . html_encode($image->getTitle()) . "\">\n";
            echo $image->getTitle() . "</a></h3>\n";
        }
        if ($showdate) {
            echo "<p>" . zpFormattedDate(DATE_FORMAT, strtotime($image->getDateTime())) . "</p>";
        }
        if ($showstatistic === "rating" or $showstatistic === "rating+hitcounter") {
            $votes = $image->get("total_votes");
            $value = $image->get("total_value");
            if ($votes != 0) {
                $rating = round($value / $votes, 1);
            }
            echo "<p>" . sprintf(gettext('Rating: %1$u (Votes: %2$u)'), $rating, $votes) . "</p>";
        }
        if ($showstatistic === "hitcounter" or $showstatistic === "rating+hitcounter") {
            $hitcounter = $image->get("hitcounter");
            if (empty($hitcounter)) {
                $hitcounter = "0";
            }
            echo "<p>" . sprintf(gettext("Views: %u"), $hitcounter) . "</p>";
        }
        if ($showdesc) {
            echo html_encodeTagged(shortenContent($image->getDesc(), $desclength, ' (...)'));
        }
        echo "</li>";
    }
    echo "</ul></div>\n";
}
开发者ID:ariep,项目名称:ZenPhoto20-DEV,代码行数:69,代码来源:functions.php


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