<?php } else { echo gettext('No unpublished articles'); } ?> </fieldset> <?php $visible = $report == 'pages'; $items = $_zp_zenpage->getPages(false); $output = ''; $c = 0; foreach ($items as $key => $item) { $itemobj = new ZenpagePage($item['titlelink']); if (!$itemobj->getShow()) { $c++; $output .= '<li><label><input type="checkbox" name="' . $item['titlelink'] . '" value="' . $item['titlelink'] . '" class="pagecheck" />' . $itemobj->getTitle() . '</label><a href="' . html_encode($itemobj->getLink()) . '" title="' . html_encode($itemobj->getTitle()) . '"> (' . gettext('View') . ')</a></li>'; } } ?> <br class="clearall" /> <fieldset class="smallbox"> <legend><?php reveal('pagebox', $visible); echo gettext('Pages not published'); ?> </legend> <?php if ($report == 'pages') { ?> <div class="messagebox fade-message"> <h2><?php
/** * Prints excerpts of the direct subpages (1 level) of a page for a kind of overview. The setup is: * <div class='pageexcerpt'> * <h4>page title</h3> * <p>page content excerpt</p> * <p>read more</p> * </div> * * @param int $excerptlength The length of the page content, if nothing specifically set, the plugin option value for 'news article text length' is used * @param string $readmore The text for the link to the full page. If empty the read more setting from the options is used. * @param string $shortenindicator The optional placeholder that indicates that the content is shortened, if this is not set the plugin option "news article text shorten indicator" is used. * @return string */ function printSubPagesExcerpts($excerptlength = NULL, $readmore = NULL, $shortenindicator = NULL) { global $_zp_current_zenpage_page; if (is_null($readmore)) { $readmore = get_language_string(ZP_READ_MORE); } $pages = $_zp_current_zenpage_page->getPages(); $subcount = 0; if (is_null($excerptlength)) { $excerptlength = ZP_SHORTEN_LENGTH; } foreach ($pages as $page) { $pageobj = new ZenpagePage($page['titlelink']); if ($pageobj->getParentID() == $_zp_current_zenpage_page->getID()) { $subcount++; $pagetitle = html_encode($pageobj->getTitle()); $pagecontent = $pageobj->getContent(); if ($pageobj->checkAccess()) { $pagecontent = getContentShorten($pagecontent, $excerptlength, $shortenindicator, $readmore, $pageobj->getLink()); } else { $pagecontent = '<p><em>' . gettext('This page is password protected') . '</em></p>'; } echo '<div class="pageexcerpt">'; echo '<h4><a href="' . html_encode($pageobj->getLink()) . '" title="' . getBare($pagetitle) . '">' . $pagetitle . '</a></h4>'; echo $pagecontent; echo '</div>'; } } }
$item = sanitize($_GET['news']); $obj = new ZenpageNews($item); $cats = $obj->getCategories(); $categories = gettext('Categories: '); $count = ''; if ($cats) { foreach ($cats as $cat) { $count++; $catobj = new ZenpageCategory($cat['titlelink']); if ($count != 1) { $categories .= ', '; } $categories .= $catobj->getTitle(); } } } elseif (isset($_GET['pages'])) { $item = sanitize($_GET['pages']); $obj = new ZenpagePage($item); $categories = ''; } echo '<h3>' . $obj->getTitle() . '</h3>'; echo '<p><small>' . $obj->getDatetime() . '</small></p>'; echo $obj->getContent(); echo $categories; echo '</div>'; } ?> </div><!-- main div --> </body> </html>
/** * Function to create the page title to be used within the html <head> <title></title> element. * Usefull if you use one header.php for the header of all theme pages instead of individual ones on the theme pages * It returns the title and site name in reversed breadcrumb order: * <title of current page> | <parent item if present> | <gallery title> * It supports standard gallery pages as well a custom and Zenpage news articles, categories and pages. * * @param string $separator How you wish the parts to be separated * @param bool $listparentalbums If the parent albums should be printed in reversed order before the current * @param bool $listparentpage If the parent Zenpage pages should be printed in reversed order before the current page */ function getHeadTitle($separator = ' | ', $listparentalbums = true, $listparentpages = true) { global $_zp_gallery, $_zp_current_album, $_zp_current_image, $_zp_current_zenpage_news, $_zp_current_zenpage_page, $_zp_gallery_page, $_zp_current_category, $_zp_page, $_myFavorites; $mainsitetitle = html_encode(getBare(getMainSiteName())); $separator = html_encode($separator); if ($mainsitetitle) { $mainsitetitle = $separator . $mainsitetitle; } $gallerytitle = html_encode(getBareGalleryTitle()); if ($_zp_page > 1) { $pagenumber = ' (' . $_zp_page . ')'; } else { $pagenumber = ''; } switch ($_zp_gallery_page) { case 'index.php': return $gallerytitle . $mainsitetitle . $pagenumber; break; case 'album.php': case 'image.php': if ($listparentalbums) { $parents = getParentAlbums(); $parentalbums = ''; if (count($parents) != 0) { $parents = array_reverse($parents); foreach ($parents as $parent) { $parentalbums .= html_encode(getBare($parent->getTitle())) . $separator; } } } else { $parentalbums = ''; } $albumtitle = html_encode(getBareAlbumTitle()) . $pagenumber . $separator . $parentalbums . $gallerytitle . $mainsitetitle; switch ($_zp_gallery_page) { case 'album.php': return $albumtitle; break; case 'image.php': return html_encode(getBareImageTitle()) . $separator . $albumtitle; break; } break; case 'news.php': if (function_exists("is_NewsArticle")) { if (is_NewsArticle()) { return html_encode(getBareNewsTitle()) . $pagenumber . $separator . gettext('News') . $separator . $gallerytitle . $mainsitetitle; } else { if (is_NewsCategory()) { return html_encode(getBare($_zp_current_category->getTitle())) . $pagenumber . $separator . gettext('News') . $separator . $gallerytitle . $mainsitetitle; } else { return gettext('News') . $pagenumber . $separator . $gallerytitle . $mainsitetitle; } } } break; case 'pages.php': if ($listparentpages) { $parents = $_zp_current_zenpage_page->getParents(); $parentpages = ''; if (count($parents) != 0) { $parents = array_reverse($parents); foreach ($parents as $parent) { $obj = new ZenpagePage($parent); $parentpages .= html_encode(getBare($obj->getTitle())) . $separator; } } } else { $parentpages = ''; } return html_encode(getBarePageTitle()) . $pagenumber . $separator . $parentpages . $gallerytitle . $mainsitetitle; break; case '404.php': return gettext('Object not found') . $separator . $gallerytitle . $mainsitetitle; break; default: // for all other possible static custom pages $custompage = stripSuffix($_zp_gallery_page); $standard = array('contact' => gettext('Contact'), 'register' => gettext('Register'), 'search' => gettext('Search'), 'archive' => gettext('Archive view'), 'password' => gettext('Password required')); if (is_object($_myFavorites)) { $standard['favorites'] = gettext('My favorites'); } if (array_key_exists($custompage, $standard)) { return $standard[$custompage] . $pagenumber . $separator . $gallerytitle . $mainsitetitle; } else { return $custompage . $pagenumber . $separator . $gallerytitle . $mainsitetitle; } break; } }
/** * Prints all available pages in Zenpage * * @param string $current set to the page selected (if any) * * @return string */ function printZenpagePagesSelector($current) { global $_zp_gallery, $_zp_zenpage; ?> <select id="pageselector" name="pageselect"> <?php $pages = $_zp_zenpage->getPages(false); foreach ($pages as $key => $page) { if ($page['titlelink'] == $current) { $selected = ' selected= "selected "'; } else { $selected = ''; } $pageobj = new ZenpagePage($page['titlelink']); $level = substr_count($pageobj->getSortOrder(), "-"); $arrow = ""; for ($count = 1; $count <= $level; $count++) { $arrow .= "» "; } echo "<option value = '" . html_encode($pageobj->getTitlelink()) . "'" . $selected . '>'; echo $arrow . $pageobj->getTitle() . unpublishedZenphotoItemCheck($pageobj) . "</option>"; } ?> </select> <?php }
/** * 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 getitemPages($item, $len) { $obj = new ZenpagePage($item['titlelink']); $feeditem['title'] = $feeditem['title'] = get_language_string($obj->getTitle('all'), $this->locale); $feeditem['link'] = $obj->getLink(); $desc = $obj->getContent($this->locale); $desc = str_replace('//<![CDATA[', '', $desc); $desc = str_replace('//]]>', '', $desc); $feeditem['desc'] = shortenContent($desc, $len, '...'); $feeditem['enclosure'] = ''; $feeditem['category'] = ''; $feeditem['media_content'] = ''; $feeditem['media_thumbnail'] = ''; $feeditem['pubdate'] = date("r", strtotime($obj->getDatetime())); return $feeditem; }
/** * Gets the title, url and name of a menu item * * @return array */ function getItemTitleAndURL($item) { global $_zp_gallery; $themename = $_zp_gallery->getCurrentTheme(); $array = array("title" => '', "url" => '', "name" => '', 'protected' => false, 'theme' => $themename); $valid = true; $title = get_language_string($item['title']); switch ($item['type']) { case "galleryindex": $array = array("title" => get_language_string($item['title']), "url" => WEBPATH, "name" => WEBPATH, 'protected' => false, 'theme' => $themename); break; case "album": $folderFS = internalToFilesystem($item['link']); $localpath = ALBUM_FOLDER_SERVERPATH . $folderFS; $dynamic = hasDynamicAlbumSuffix($folderFS) && !is_dir($folderFS); $valid = file_exists($localpath) && ($dynamic || is_dir($localpath)); if (!$valid || strpos($localpath, '..') !== false) { $valid = false; $url = ''; $protected = 0; } else { $obj = newAlbum($item['link']); $url = $obj->getLink(0); $protected = $obj->isProtected(); $title = $obj->getTitle(); } $array = array("title" => $title, "url" => $url, "name" => $item['link'], 'protected' => $protected, 'theme' => $themename); break; case "zenpagepage": if (class_exists('zenpage')) { $sql = 'SELECT * FROM ' . prefix('pages') . ' WHERE `titlelink`="' . $item['link'] . '"'; $result = query_single_row($sql); if (is_array($result)) { $obj = new ZenpagePage($item['link']); $url = $obj->getLink(0); $protected = $obj->isProtected(); $title = $obj->getTitle(); } else { $valid = false; $url = ''; $protected = 0; } $array = array("title" => $title, "url" => $url, "name" => $item['link'], 'protected' => $protected, 'theme' => $themename); } break; case "zenpagenewsindex": if (class_exists('zenpage')) { $url = getNewsIndexURL(); $array = array("title" => get_language_string($item['title']), "url" => $url, "name" => $url, 'protected' => false); } break; case "zenpagecategory": if (class_exists('zenpage')) { $sql = "SELECT title FROM " . prefix('news_categories') . " WHERE titlelink = '" . $item['link'] . "'"; $obj = query_single_row($sql, false); if ($obj) { $obj = new ZenpageCategory($item['link']); $title = $obj->getTitle(); $protected = $obj->isProtected(); $url = $obj->getLink(0); } else { $valid = false; $url = ''; $protected = 0; } $array = array("title" => $title, "url" => $url, "name" => $item['link'], 'protected' => $protected, 'theme' => $themename); } break; case "custompage": $root = SERVERPATH . '/' . THEMEFOLDER . '/' . $themename . '/'; if (file_exists($root . $item['link'] . '.php')) { $url = zp_apply_filter('getLink', rewrite_path(_PAGE_ . '/' . $item['link'], "/index.php?p=" . $item['link']), $item['link'] . '.php', NULL); } else { $valid = false; $url = ''; } $array = array("title" => $title, "url" => $url, "name" => $item['link'], 'protected' => false, 'theme' => $themename); break; case "customlink": $array = array("title" => get_language_string($item['title']), "url" => $item['link'], "name" => $item['link'], 'protected' => false, 'theme' => $themename); break; case 'menulabel': $array = array("title" => get_language_string($item['title']), "url" => NULL, 'name' => $item['title'], 'protected' => false, 'theme' => $themename); break; default: $array = array("title" => get_language_string($item['title']), "url" => $item['link'], "name" => $item['link'], 'protected' => false, 'theme' => $themename); break; } $limit = MENU_TRUNCATE_STRING; $array['valid'] = $valid; if ($limit) { $array['title'] = shortenContent($array['title'], $limit, MENU_TRUNCATE_INDICATOR); } return $array; }
/** * Prints the x related articles based on a tag search * * @param int $number Number of items to get * @param string $type 'albums', 'images','news','pages', "all" for all combined. * @param string $specific If $type = 'albums' or 'images' name of album * @param bool $excerpt If a text excerpt (gallery items: description; Zenpage items: content) should be shown. NULL for none or number of length * @param bool $thumb For $type = 'albums' or 'images' if a thumb should be shown (default size as set on the options) */ function printRelatedItems($number = 5, $type = 'news', $specific = NULL, $excerpt = NULL, $thumb = false, $date = false) { global $_zp_gallery, $_zp_current_album, $_zp_current_image, $_zp_current_zenpage_page, $_zp_current_zenpage_news; $label = array('albums' => gettext('Albums'), 'images' => gettext('Images'), 'news' => gettext('News'), 'pages' => gettext('Pages')); $result = getRelatedItems($type, $specific); $resultcount = count($result); if ($resultcount != 0) { ?> <h3 class="relateditems"> <?php printf(gettext('Related %s'), $type); ?> </h3> <ul id="relateditems"> <?php $count = 0; foreach ($result as $item) { $count++; ?> <li class="<?php echo $item['type']; ?> "> <?php $category = ''; switch ($item['type']) { case 'albums': $obj = newAlbum($item['name']); $url = $obj->getLink(); $text = $obj->getDesc(); $category = gettext('Album'); break; case 'images': $alb = newAlbum($item['album']); $obj = newImage($alb, $item['name']); $url = $obj->getLink(); $text = $obj->getDesc(); $category = gettext('Image'); break; case 'news': $obj = new ZenpageNews($item['name']); $url = $obj->getLink(); $text = $obj->getContent(); $category = gettext('News'); break; case 'pages': $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 } } }
<?php printPageContent(); printCodeblock(1); $subpages = $_zp_current_zenpage_page->getPages(); if ($subpages) { ?> <ul data-role="listview" data-inset="true" data-theme="a" class="ui-listview ui-group-theme-a"> <?php foreach ($subpages as $subpage) { $obj = new ZenpagePage($subpage['titlelink']); ?> <li><a href="<?php echo html_encode($obj->getLink()); ?> " title="<?php echo html_encode($obj->getTitle()); ?> "><?php echo html_encode($obj->getTitle()); ?> </a></li> <?php } ?> </ul> <?php } printTags('links', gettext('<strong>Tags:</strong>') . ' ', 'taglist', ', '); ?> <?php if (function_exists('printCommentForm')) {