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


PHP in_context函数代码示例

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


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


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