• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP in_context函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: editInPlace_handle_request

function editInPlace_handle_request($context = '', $field = '', $value = '', $orig_value = '')
{
    // Cannot edit when context not set in current page (should happen only when editing in place from index.php page)
    if (!in_context(ZP_IMAGE) && !in_context(ZP_ALBUM) && !in_context(ZP_ZENPAGE_PAGE) && !in_context(ZP_ZENPAGE_NEWS_ARTICLE)) {
        die($orig_value . '<script type="text/javascript">alert("' . gettext('Oops.. Cannot edit from this page') . '");</script>');
    }
    // Make a copy of context object
    switch ($context) {
        case 'image':
            global $_zp_current_image;
            $object = $_zp_current_image;
            break;
        case 'album':
            global $_zp_current_album;
            $object = $_zp_current_album;
            break;
        case 'zenpage_page':
            global $_zp_current_zenpage_page;
            $object = $_zp_current_zenpage_page;
            break;
        case 'zenpage_news':
            global $_zp_current_zenpage_news;
            $object = $_zp_current_zenpage_news;
            break;
        default:
            die(gettext('Error: malformed Ajax POST'));
    }
    // Dates need to be handled before stored
    if ($field == 'date') {
        $value = date('Y-m-d H:i:s', strtotime($value));
    }
    // Sanitize new value
    switch ($field) {
        case 'desc':
            $level = 1;
            break;
        case 'title':
            $level = 2;
            break;
        default:
            $level = 3;
    }
    $value = str_replace("\n", '<br />', sanitize($value, $level));
    // note: not using nl2br() here because it adds an extra "\n"
    // Write new value
    if ($field == '_update_tags') {
        $value = trim($value, ', ');
        $object->setTags($value);
    } else {
        $object->set($field, $value);
    }
    $result = $object->save();
    if ($result !== false) {
        echo $value;
    } else {
        echo '<script type="text/javascript">alert("' . gettext('Could not save!') . '");</script>' . $orig_value;
    }
    zp_error(gettext('Front_end_edit could not save changes!'));
}
开发者ID:Imagenomad,项目名称:Unsupported,代码行数:59,代码来源:front_end_edit.php


示例2: isAlbumClass

/**
 * Returns true if the object is a zenphoto 'album'
 *
 * @param object $album
 * @return bool
 */
function isAlbumClass($album = NULL)
{
    global $_zp_current_album;
    if (is_null($album)) {
        if (!in_context(ZP_ALBUM)) {
            return false;
        }
        $album = $_zp_current_album;
    }
    return is_object($album) && $album->table == 'albums';
}
开发者ID:JoniWeiss,项目名称:JoniWebGirl,代码行数:17,代码来源:class-album.php


示例3: getCommentsAllowed

/**
 * @deprecated
 * @since 1.4.6
 */
function getCommentsAllowed()
{
    global $_zp_current_image, $_zp_current_album;
    deprecated_functions::notify(gettext("use the object’s getCommentsAllowed() method"));
    if (in_context(ZP_IMAGE)) {
        if (is_null($_zp_current_image)) {
            return false;
        }
        return $_zp_current_image->getCommentsAllowed();
    } else {
        return $_zp_current_album->getCommentsAllowed();
    }
}
开发者ID:rb26,项目名称:zenphoto,代码行数:17,代码来源:deprecated-functions.php


示例4: getCustomAlbumDesc

function getCustomAlbumDesc()
{
    if (!in_context(ZP_ALBUM)) {
        return false;
    }
    global $_zp_current_album;
    $desc = $_zp_current_album->getDesc();
    if (strlen($desc) == 0) {
        $desc = $_zp_current_album->getTitle();
    } else {
        $desc = $_zp_current_album->getTitle() . "\n" . $desc;
    }
    return $desc;
}
开发者ID:ItsHaden,项目名称:epicLanBootstrap,代码行数:14,代码来源:customfunctions.php


示例5: isset

<?php

global $_zp_themeroot, $_zp_current_search, $_highlight_image, $_zp_current_image;
$imageCount = isset($_zp_current_search) ? count($_zp_current_search->getImages()) : 0;
AlbumUtil::setAlbumPage(false);
ThemeUtil::$script .= "isAlbumPage = false;\n";
ThemeUtil::$script .= "var images = [], initialImageThumbSelection = 0;\n";
$cls = $isAlbumPage ? 'album-page' : 'left image-page';
?>

<div id="album-nav" class="left opa60">
	<div class="nav-cell filler"><span>&nbsp;</span></div>
	<?php 
$prevText = "<div id='image-nav-prev' class='image-nav-scroll opa60'><img src='{$_zp_themeroot}/resources/images/arrow_up.png' width='16' height='16'/></div>";
$nextText = "<div id='image-nav-next' class='image-nav-scroll opa60 {$cls}'><img src='{$_zp_themeroot}/resources/images/arrow_down.png' width='16' height='16'/></div>";
if (!in_context(ZP_SEARCH)) {
    $_zp_current_search = new SearchEngine();
    set_context(ZP_SEARCH);
}
$prevNext = AlbumUtil::printNavigation($prevText, $nextText, false, 7, true);
?>
	<div class="nav-cell filler end"><span>&nbsp;</span></div>
</div>

<div style="padding-left: 1px;">
	<div id="album-menu" class="opa60">
		<div id="album-thumb">
			<img src="<?php 
echo getRandomImages()->getCustomImage(NULL, 192, 48, 192, 48, NULL, null, false);
?>
" width="195" height="48"/>
开发者ID:Imagenomad,项目名称:Unsupported,代码行数:31,代码来源:left.php


示例6: gettext

    ?>
				<?php 
}
?>
	
			</ul>
			<?php 
if (getOption('RSS_items_albums') || getOption('RSS_zenpage_items')) {
    ?>
			<div id="rsslinks">
				<span><?php 
    echo gettext('Subscribe: ');
    ?>
</span>
				<?php 
    if (in_context(ZP_ALBUM) && getOption('RSS_album_image')) {
        printRSSLink("Collection", "", gettext('This Album'), "  |  ", false, "rsslink");
    }
    if (getOption('RSS_items_albums')) {
        printRSSLink("Gallery", "", gettext('Gallery Images'), "", false, "rsslink");
    }
    if (function_exists('getBarePageTitle') && getOption('RSS_zenpage_items')) {
        printRSSLink("News", ' | ', gettext('News'), '', false);
    }
    ?>
			</div>
			<br />
			<?php 
}
?>
			<?php 
开发者ID:Imagenomad,项目名称:Unsupported,代码行数:31,代码来源:inc-footer.php


示例7: zp_side_bar

function zp_side_bar()
{
    ?>
	<div id="sidebar">
		<?php 
    //-------------If you are in the Image Page
    if (in_context(ZP_IMAGE)) {
        ?>
				<div class="imgnav">
					<?php 
        if (hasPrevImage()) {
            ?>
					<div class="imgprevious"><a href="<?php 
            echo getPrevImageURL();
            ?>
" title="Previous Image"><img src="<?php 
            echo getPrevImageThumb();
            ?>
" /><br /><small>&laquo; prev  |</small></a></div>
					<?php 
        }
        if (hasNextImage()) {
            ?>
					<div class="imgnext"><a href="<?php 
            echo getNextImageURL();
            ?>
" title="Next Image"><img src="<?php 
            echo getNextImageThumb();
            ?>
" /><br /><small>| next &raquo;</small></a></div>
					<?php 
        }
        ?>
				</div> 
		<div id="sbinfo">
			<b>Album Name:</b> <?php 
        printAlbumTitle(true);
        ?>
<br />
			<b>Number of Photos:</b> <?php 
        echo getNumImages();
        ?>
<br />
			<b>Album Date:</b> <?php 
        printAlbumDate($before = "Date: ", $format = "%F");
        ?>
<br />
			<b>Album Description:</b> <?php 
        printAlbumDesc(true);
        ?>
<br />
			<b>Image Name:</b> <?php 
        echo getImageTitle();
        ?>
<br />
			<b>Image Description:</b> <?php 
        printImageDesc(true);
        ?>
<br />
		</div>
			<?php 
        //--------------- If you are in the Album Page
    } else {
        if (in_context(ZP_ALBUM)) {
            ?>
		<b>Album Name:</b> <?php 
            printAlbumTitle(true);
            ?>
<br />
		<b>Number of Pictures:</b> <?php 
            echo getNumImages();
            ?>
<br />
		<b>Album Date:</b> <?php 
            printAlbumDate($before = "Date: ", $format = "%F");
            ?>
<br /> 
		<b>Album Description:</b> <?php 
            printAlbumDesc(true);
            ?>
<br />		
<?php 
            //--------------- If you are in the Index Page
        } else {
            if (in_context(ZP_INDEX)) {
            }
        }
    }
    ?>

</div>
<?php 
}
开发者ID:Imagenomad,项目名称:Unsupported,代码行数:93,代码来源:functions.php


示例8: gettext

<div class="left">

	<?php 
if ($zpfocus_showrandom != 'none') {
    if ($zpfocus_showrandom == 'single') {
        $sscount = 1;
    } else {
        $sscount = 5;
    }
    if (in_context(ZP_ALBUM) || in_context(ZP_IMAGE)) {
        $sstype = 'album';
        $ssalbum = $_zp_current_album;
        $sstitle = gettext('Random Album Image');
    } else {
        $sstype = 'all';
        $ssalbum = null;
        $sstitle = gettext('Random Gallery Image');
    }
    ?>
		<div id="random-wrap">
			<?php 
    printRandomImages($sscount, '', $sstype, $ssalbum, 300, 300, true);
    ?>
			<div id="random-title">
				<?php 
    echo $sstitle;
    ?>
			</div>
		</div>
	<?php 
}
开发者ID:ariep,项目名称:ZenPhoto20-DEV,代码行数:31,代码来源:inc-sidebar.php


示例9: inventMenuItem

/**
 * "invents" a menu item for the current page (for when one does not exist)
 * Adds the item to the current menuset and modifies its "parent" as needed
 *
 * returns a contrived sort_order for the item.
 *
 * @param string $menuset
 * @param string $visibility
 * return string
 */
function inventMenuItem($menuset, $visibility)
{
    global $_zp_gallery_page, $_zp_current_album, $_zp_current_image, $_zp_current_search, $_menu_manager_items, $_zp_current_article, $_zp_current_page;
    $currentkey = $insertpoint = NULL;
    $newitems = array();
    switch ($_zp_gallery_page) {
        case 'image.php':
            $name = '';
            if (in_context(ZP_SEARCH_LINKED) && !in_context(ZP_ALBUM_LINKED)) {
                $dynamic = $_zp_current_search->getDynamicAlbum();
                if (empty($dynamic)) {
                    //	smple search
                    foreach ($_menu_manager_items[$menuset][$visibility] as $key => $item) {
                        if ($item['type'] == 'custompage' && $item['link'] == 'search') {
                            $insertpoint = $item['sort_order'];
                            $currentkey = $insertpoint . '-9999';
                            break;
                        }
                    }
                }
            } else {
                $name = $_zp_current_album->name;
            }
            if (!empty($name)) {
                foreach ($_menu_manager_items[$menuset][$visibility] as $key => $item) {
                    if ($item['type'] == 'album' && $item['title'] == $name) {
                        $insertpoint = $item['sort_order'];
                        $currentkey = $insertpoint . '-9999';
                        break;
                    }
                }
            }
            if (!empty($currentkey)) {
                $item = array('id' => 9999, 'sort_order' => $currentkey, 'parentid' => $item['id'], 'type' => 'image', 'include_li' => true, 'title' => $_zp_current_image->getTitle(), 'show' => 1, 'link' => '', 'menuset' => $menuset);
            }
            break;
        case 'news.php':
            if (in_context(ZP_SEARCH_LINKED)) {
                foreach ($_menu_manager_items[$menuset][$visibility] as $key => $item) {
                    if ($item['type'] == 'custompage' && $item['link'] == 'search') {
                        $insertpoint = $item['sort_order'];
                        $currentkey = $insertpoint . '-9999';
                        break;
                    }
                }
            } else {
                foreach ($_menu_manager_items[$menuset][$visibility] as $key => $item) {
                    if ($item['type'] == 'newsindex') {
                        $insertpoint = $item['sort_order'];
                        $currentkey = $insertpoint . '-9999';
                        break;
                    }
                }
            }
            if (!empty($currentkey)) {
                if (is_NewsArticle()) {
                    $item = array('id' => 9999, 'sort_order' => $currentkey, 'parentid' => $item['id'], 'type' => 'article', 'include_li' => true, 'title' => $_zp_current_article->getTitle(), 'show' => 1, 'link' => '', 'menuset' => $menuset);
                } else {
                    $currentkey = false;
                    // not a news page, must be the index?
                }
            }
            break;
        case 'pages.php':
            if (in_context(ZP_SEARCH_LINKED)) {
                foreach ($_menu_manager_items[$menuset][$visibility] as $key => $item) {
                    if ($item['type'] == 'custompage' && $item['link'] == 'search') {
                        $insertpoint = $item['sort_order'];
                        $currentkey = $insertpoint . '-9999';
                        $item = array('id' => 9999, 'sort_order' => $currentkey, 'parentid' => $item['id'], 'type' => 'page', 'include_li' => true, 'title' => $_zp_current_page->getTitle(), 'show' => 1, 'link' => '', 'menuset' => $menuset);
                        break;
                    }
                }
            }
            break;
    }
    if (!empty($currentkey)) {
        foreach ($_menu_manager_items[$menuset][$visibility] as $key => $olditem) {
            $newitems[$key] = $olditem;
            if ($olditem['sort_order'] == $insertpoint) {
                $newitems[$currentkey] = $item;
            }
        }
        $_menu_manager_items[$menuset][$visibility] = $newitems;
    }
    return $currentkey;
}
开发者ID:ariep,项目名称:ZenPhoto20-DEV,代码行数:97,代码来源:menu_manager.php


示例10: 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


示例11: printjPlayerPlaylist

    /**
     * Prints a playlist using jPlayer. Several playlists per page supported.
     *
     * The playlist is meant to replace the 'next_image()' loop on a theme's album.php.
     * It can be used with a special 'album theme' that can be assigned to media albums with with .flv/.mp4/.mp3s, although Flowplayer 3 also supports images
     * Replace the entire 'next_image()' loop on album.php with this:
     * <?php printjPlayerPlaylist("playlist"); ?> or <?php printjPlayerPlaylist("playlist-audio"); ?>
     *
     * @param string $option "playlist" use for pure video and mixed video/audio playlists or if you want to show the poster/videothumb with audio only playlists,
     * 											 "playlist-audio" use for pure audio playlists (m4a,mp3,fla supported only) if you don't need the poster/videothumb to be shown only.
     * @param string $albumfolder album name to get a playlist from directly
     */
    function printjPlayerPlaylist($option = "playlist", $albumfolder = "")
    {
        global $_zp_current_album, $_zp_current_search;
        if (empty($albumfolder)) {
            if (in_context(ZP_SEARCH)) {
                $albumobj = $_zp_current_search;
            } else {
                $albumobj = $_zp_current_album;
            }
        } else {
            $albumobj = newAlbum($albumfolder);
        }
        $entries = $albumobj->getImages(0);
        if (($numimages = count($entries)) != 0) {
            switch ($option) {
                case 'playlist':
                    $suffixes = array('m4a', 'm4v', 'mp3', 'mp4', 'flv', 'fla');
                    break;
                case 'playlist-audio':
                    $suffixes = array('m4a', 'mp3', 'fla');
                    break;
                default:
                    //	an invalid option parameter!
                    return;
            }
            $id = $albumobj->getID();
            ?>
			<script type="text/javascript">
								//<![CDATA[
								$(document).ready(function(){
				new jPlayerPlaylist({
				jPlayer: "#jquery_jplayer_<?php 
            echo $id;
            ?>
",
								cssSelectorAncestor: "#jp_container_<?php 
            echo $id;
            ?>
"
				}, [
			<?php 
            $count = '';
            $number = '';
            foreach ($entries as $entry) {
                $count++;
                if (is_array($entry)) {
                    $ext = getSuffix($entry['filename']);
                } else {
                    $ext = getSuffix($entry);
                }
                $numbering = '';
                if (in_array($ext, $suffixes)) {
                    $number++;
                    if (getOption('jplayer_playlist_numbered')) {
                        $numbering = '<span>' . $number . '</span>';
                    }
                    $video = newImage($albumobj, $entry);
                    $videoThumb = '';
                    $this->setModeAndSuppliedFormat($ext);
                    if ($option == 'playlist' && getOption('jplayer_poster')) {
                        $videoThumb = ',poster:"' . $video->getCustomImage(null, $this->width, $this->height, $this->width, $this->height, null, null, true) . '"';
                    }
                    $playtime = '';
                    if (getOption('jplayer_playlist_playtime')) {
                        $playtime = ' (' . $video->get('VideoPlaytime') . ')';
                    }
                    ?>
						{
						title:"<?php 
                    echo $numbering . html_encode($video->getTitle()) . $playtime;
                    ?>
",
					<?php 
                    if (getOption('jplayer_download')) {
                        ?>
							free:true,
					<?php 
                    }
                    ?>
					<?php 
                    echo $this->supplied;
                    ?>
:"<?php 
                    echo html_encode(pathurlencode($url = $video->getFullImageURL(FULLWEBPATH)));
                    ?>
"
					<?php 
                    echo $this->getCounterpartFiles($url, $ext);
//.........这里部分代码省略.........
开发者ID:ariep,项目名称:ZenPhoto20-DEV,代码行数:101,代码来源:jplayer.php


示例12: getTitleBreadcrumb

function getTitleBreadcrumb($before = ' ( ', $between = ' | ', $after = ' ) ')
{
    global $_zp_gallery, $_zp_current_search, $_zp_current_album, $_zp_last_album;
    $titlebreadcrumb = '';
    if (in_context(ZP_SEARCH_LINKED)) {
        $dynamic_album = $_zp_current_search->getDynamicAlbum();
        if (empty($dynamic_album)) {
            $titlebreadcrumb .= $before . gettext("Search Result") . $after;
            if (is_null($_zp_current_album)) {
                return;
            } else {
                $parents = getParentAlbums();
            }
        } else {
            $album = new Album($_zp_gallery, $dynamic_album);
            $parents = getParentAlbums($album);
            if (in_context(ZP_ALBUM_LINKED)) {
                array_push($parents, $album);
            }
        }
    } else {
        $parents = getParentAlbums();
    }
    $n = count($parents);
    if ($n > 0) {
        $titlebreadcrumb .= $before;
        $i = 0;
        foreach ($parents as $parent) {
            if ($i > 0) {
                $titlebreadcrumb .= $between;
            }
            $titlebreadcrumb .= $parent->getTitle();
            $i++;
        }
        $titlebreadcrumb .= $after;
    }
    return $titlebreadcrumb;
}
开发者ID:Imagenomad,项目名称:Unsupported,代码行数:38,代码来源:functions.php


示例13: countArticles

/**
 * Counts news articles, either all or by category or archive date, published or un-published
 *
 * @param string $category The categorylink of the category to count
 * @param string $published "published" for an published articles,
 * 													"unpublished" for an unpublised articles,
 * 													"all" for all articles
 * @return array
 */
function countArticles($category = '', $published = 'published', $count_subcat_articles = true)
{
    deprecated_function_notify(gettext('Count the articles instead.'));
    global $_zp_post_date;
    if (zp_loggedin(ZENPAGE_NEWS_RIGHTS)) {
        $published = "all";
    } else {
        $published = "published";
    }
    $show = "";
    if (empty($category)) {
        switch ($published) {
            case "published":
                $show = " WHERE `show` = 1 AND date <= '" . date('Y-m-d H:i:s') . "'";
                break;
            case "unpublished":
                $show = " WHERE `show` = 0 AND date <= '" . date('Y-m-d H:i:s') . "'";
                break;
            case "all":
                $show = "";
                break;
        }
        // date archive query addition
        if (in_context(ZP_ZENPAGE_NEWS_DATE)) {
            $postdate = $_zp_post_date;
            if (empty($show)) {
                $and = " WHERE ";
            } else {
                $and = " AND ";
            }
            $datesearch = $and . "date LIKE '{$postdate}%'";
        } else {
            $datesearch = "";
        }
        $result = query("SELECT COUNT(*) FROM " . prefix('news') . $show . $datesearch);
        $row = db_fetch_row($result);
        $count = $row[0];
        return $count;
    } else {
        $catobj = new ZenpageCategory($category);
        switch ($published) {
            case "published":
                $show = " AND news.show = 1 AND news.date <= '" . date('Y-m-d H:i:s') . "'";
                break;
            case "unpublished":
                $show = " AND news.show = 0 AND news.date <= '" . date('Y-m-d H:i:s') . "'";
                break;
            case "all":
                $show = "";
                break;
        }
        if ($count_subcat_articles) {
            $subcats = $catobj->getSubCategories();
        }
        if ($subcats && $count_subcat_articles) {
            $cat = " (cat.cat_id = '" . $catobj->getID() . "'";
            foreach ($subcats as $subcat) {
                $subcatobj = new ZenpageCategory($subcat);
                $cat .= "OR cat.cat_id = '" . $subcatobj->getID() . "' ";
            }
            $cat .= ") AND cat.news_id = news.id ";
        } else {
            $cat = " cat.cat_id = '" . $catobj->getID() . "' AND cat.news_id = news.id ";
        }
        $result = query_full_array("SELECT DISTINCT news.titlelink FROM " . prefix('news2cat') . " as cat, " . prefix('news') . " as news WHERE " . $cat . $show);
        $count = count($result);
        return $count;
    }
}
开发者ID:hatone,项目名称:zenphoto-1.4.1.4,代码行数:78,代码来源:deprecated-functions.php


示例14: areaMatch

 protected function areaMatch()
 {
     return in_context(ZP_ZENPAGE_PAGE) && getPageTitleLink() == $this->pageName;
 }
开发者ID:Imagenomad,项目名称:Unsupported,代码行数:4,代码来源:Menu.php


示例15: commonNewsLoop

function commonNewsLoop($paged)
{
    $newstypes = array('album' => gettext('album'), 'image' => gettext('image'), 'video' => gettext('video'), 'news' => gettext('news'));
    while (next_news()) {
        $newstypedisplay = gettext('news');
        if (stickyNews()) {
            $newstypedisplay .= ' <small><em>' . gettext('sticky') . '</em></small>';
        }
        ?>
		<div class="newsarticle<?php 
        if (stickyNews()) {
            echo ' sticky';
        }
        ?>
">
			<h3><?php 
        printNewsURL();
        echo " <span class='newstype'>[" . $newstypedisplay . "]</span>";
        ?>
</h3>
			<div class="newsarticlecredit">
				<span class="newsarticlecredit-left">
					<?php 
        $count = @call_user_func('getCommentCount');
        $cat = getNewsCategories();
        printNewsDate();
        if ($count > 0) {
            echo ' | ';
            printf(gettext("Comments: %d"), $count);
        }
        ?>
				</span>
				<?php 
        if (!empty($cat) && !in_context(ZP_ZENPAGE_NEWS_CATEGORY)) {
            echo ' | ';
            printNewsCategories(", ", gettext("Categories: "), "newscategories");
        }
        ?>
			</div> <!-- newsarticlecredit -->
			<br class="clearall" />
			<?php 
        printCodeblock(1);
        ?>
			<?php 
        printNewsContent();
        ?>
			<?php 
        printCodeblock(2);
        ?>
			<br class="clearall" />
		</div>
		<?php 
    }
    if ($paged) {
        printNewsPageListWithNav(gettext('next »'), gettext('« prev'), true, 'pagelist', true);
    }
}
开发者ID:rb26,项目名称:zenphoto,代码行数:57,代码来源:functions.php


示例16: commonNewsLoop

function commonNewsLoop($paged)
{
    $newstypes = array('album' => gettext('album'), 'image' => gettext('image'), 'video' => gettext('video'), 'news' => gettext('news'));
    while (next_news()) {
        $newstype = getNewsType();
        $newstypedisplay = $newstypes[$newstype];
        if (stickyNews()) {
            $newstypedisplay .= ' <small><em>' . gettext('sticky') . '</em></small>';
        }
        ?>
		<div class="newsarticle<?php 
        if (stickyNews()) {
            echo ' sticky';
        }
        ?>
">
			<h3><?php 
        printNewsTitleLink();
        echo " <span class='newstype'>[" . $newstypedisplay . "]</span>";
        ?>
</h3>
			<div class="newsarticlecredit">
				<span class="newsarticlecredit-left">
					<?php 
        $count = getCommentCount();
        $cat = getNewsCategories();
        printNewsDate();
        if ($count > 0) {
            echo ' | ';
            printf(gettext("Comments: %d"), $count);
        }
        ?>
				</span>
				<?php 
        if (is_GalleryNewsType()) {
            echo ' | ' . gettext("Album:") . " <a href='" . getNewsAlbumURL() . "' title='" . getBareNewsAlbumTitle() . "'>" . getNewsAlbumTitle() . "</a>";
        } else {
            if (!empty($cat) && !in_context(ZP_ZENPAGE_NEWS_CATEGORY)) {
                echo ' | ';
                printNewsCategories(", ", gettext("Categories: "), "newscategories");
            }
        }
        ?>
			</div> <!-- newsarticlecredit -->
			<br clear="all" />
			<?php 
        printCodeblock(1);
        ?>
			<?php 
        printNewsContent();
        ?>
			<?php 
        printCodeblock(2);
        ?>
			<br clear="all" />
			</div>
	<?php 
    }
    if ($paged) {
        printNewsPageListWithNav(gettext('next &raquo;'), gettext('&laquo; prev'), true, 'pagelist', true);
    }
}
开发者ID:hatone,项目名称:zenphoto-1.4.1.4,代码行数:62,代码来源:functions.php


示例17: printThumbNav

    /** Prints the jQuery jCarousel HTML setup to be replaced by JS
     *
     * @param int $minitems The minimum number of thumbs to be visible always if resized regarding responsiveness.
     * @param int $maxitems not supported
     * @param int $width Width Set to NULL if you want to use the backend plugin options.
     * @param int $height Height Set to NULL if you want to use the backend plugin options.
     * @param int $cropw Crop width Set to NULL if you want to use the backend plugin options.
     * @param int $croph Crop heigth Set to NULL if you want to use the backend plugin options.
     * @param bool $crop TRUE for cropped thumbs, FALSE for un-cropped thumbs. $width and $height then will be used as maxspace. Set to NULL if you want to use the backend plugin options.
     * @param bool $fullimagelink Set to TRUE if you want the thumb link to link to the full image instead of the image page. Set to NULL if you want to use the backend plugin options.
     * @param string $vertical 'horizontal','vertical', 'fade'
     * @param int $speed not supported
     */
    function printThumbNav($minitems = NULL, $maxitems = NULL, $width = NULL, $height = NULL, $cropw = NULL, $croph = NULL, $fullimagelink = NULL, $vertical = NULL, $speed = NULL, $thumbscroll = NULL)
    {
        global $_zp_gallery, $_zp_current_album, $_zp_current_image, $_zp_current_search, $_zp_gallery_page;
        //	Just incase the theme has not set the option, at least second try will work!
        setOptionDefault('slideshow_' . $_zp_gallery->getCurrentTheme() . '_' . stripSuffix($_zp_gallery_page), 1);
        $items = "";
        if (is_object($_zp_current_album) && $_zp_current_album->getNumImages() >= 2) {
            if (is_null($thumbscroll)) {
                $thumbscroll = getOption('jcarousel_scroll');
            } else {
                $thumbscroll = sanitize_numeric($thumbscroll);
            }
            if (is_null($width)) {
                $width = getOption('jcarousel_width');
            } else {
                $width = sanitize_numeric($width);
            }
            if (is_null($height)) {
                $height = getOption('jcarousel_height');
            } else {
                $height = sanitize_numeric($height);
            }
            if (is_null($cropw)) {
                $cropw = getOption('jcarousel_cropw');
            } else {
                $cropw = sanitize_numeric($cropw);
            }
            if (is_null($croph)) {
                $croph = getOption('jcarousel_croph');
            } else {
                $croph = sanitize_numeric($croph);
            }
            if (is_null($fullimagelink)) {
                $fullimagelink = getOption('jcarousel_fullimagelink');
            } else {
                $fullimagelink = sanitize($fullimagelink);
            }
            if (is_null($vertical)) {
                $vertical = getOption('jcarousel_vertical');
            } else {
                $vertical = sanitize($vertical);
            }
            if ($vertical) {
                $vertical = 'true';
            } else {
                $vertical = 'false';
            }
            if (in_context(ZP_SEARCH_LINKED)) {
                if ($_zp_current_search->getNumImages() === 0) {
                    $searchimages = false;
                } else {
                    $searchimages = true;
                }
            } else {
                $searchimages = false;
            }
            if (in_context(ZP_SEARCH_LINKED) && $searchimages) {
                $jcarousel_items = $_zp_current_search->getImages();
            } else {
                $jcarousel_items = $_zp_current_album->getImages();
            }
            if (count($jcarousel_items) >= 2) {
                foreach ($jcarousel_items as $item) {
                    if (is_array($item)) {
                        $imgobj = newImage($_zp_current_album, $item['filename']);
                    } else {
                        $imgobj = newImage($_zp_current_album, $item);
                    }
                    if ($fullimagelink) {
                        $link = $imgobj->getFullImageURL();
                    } else {
                        $link = $imgobj->getLink();
                    }
                    if (!is_null($_zp_current_image)) {
                        if ($_zp_current_album->isDynamic()) {
                            if ($_zp_current_image->filename == $imgobj->filename && $_zp_current_image->getAlbum()->name == $imgobj->getAlbum()->name) {
                                $active = 'active';
                            } else {
                                $active = '';
                            }
                        } else {
                            if ($_zp_current_image->filename == $imgobj->filename) {
                                $active = 'active';
                            } else {
                                $active = '';
                            }
                        }
//.........这里部分代码省略.........
开发者ID:rb26,项目名称:zenphoto,代码行数:101,代码来源:jcarousel_thumb_nav.php


示例18: getHitcounter

/**
 * returns the hitcounter for the current page or for the object passed
 *
 * @param object $obj the album or page object for which the hitcount is desired
 * @return string
 */
function getHitcounter($obj = NULL)
{
    global $_zp_current_album, $_zp_current_image, $_zp_gallery_page, $_zp_current_article, $_zp_current_page, $_zp_current_category;
    if (is_null($obj)) {
        switch ($_zp_gallery_page) {
            case 'album.php':
                $obj = $_zp_current_album;
                break;
            case 'image.php':
                $obj = $_zp_current_image;
                break;
            case 'pages.php':
                $obj = $_zp_current_page;
                break;
            case 'news.php':
                if (in_context(ZP_ZENPAGE_NEWS_CATEGORY)) {
                    $obj = $_zp_current_category;
                } else {
                    $obj = $_zp_current_article;
                    if (is_null($obj)) {
                        return 0;
                    }
                }
                break;
            case 'search.php':
                return NULL;
            default:
                $page = stripSuffix($_zp_gallery_page);
                return getOption('Page-Hitcounter-' . $page);
        }
    }
    return $obj->getHitcounter();
}
开发者ID:ariep,项目名称:ZenPhoto20-DEV,代码行数:39,代码来源:hitcounter.php


示例19: getLayout

该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP in_coventry函数代码示例发布时间:2022-05-15
下一篇:
PHP in_category函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap