/** * Prints the parent items breadcrumb navigation for pages or categories * * @param string $before Text to place before the breadcrumb item * @param string $after Text to place after the breadcrumb item */ function printZenpageItemsBreadcrumb($before = NULL, $after = NULL) { global $_zp_current_zenpage_page, $_zp_current_category; $parentitems = array(); if (is_Pages()) { //$parentid = $_zp_current_zenpage_page->getParentID(); $parentitems = $_zp_current_zenpage_page->getParents(); } if (is_NewsCategory()) { //$parentid = $_zp_current_category->getParentID(); $parentitems = $_zp_current_category->getParents(); } foreach ($parentitems as $item) { if (is_Pages()) { $pageobj = new ZenpagePage($item); $parentitemurl = html_encode($pageobj->getLink()); $parentitemtitle = $pageobj->getTitle(); } if (is_NewsCategory()) { $catobj = new ZenpageCategory($item); $parentitemurl = $catobj->getLink(); $parentitemtitle = $catobj->getTitle(); } if ($before) { echo '<span class="beforetext">' . html_encode($before) . '</span>'; } echo "<a href='" . $parentitemurl . "'>" . html_encode($parentitemtitle) . "</a>"; if ($after) { echo '<span class="aftertext">' . html_encode($after) . '</span>'; } } }
} else { echo gettext('No images meet the criteria.'); } ?> </fieldset> <?php if (class_exists('Zenpage')) { $visible = $report == 'categories'; $items = $_zp_zenpage->getAllCategories(false); $output = ''; $c = 0; foreach ($items as $key => $item) { $itemobj = new ZenpageCategory($item['titlelink']); if (!$itemobj->getShow()) { $c++; $output .= '<li><label><input type="checkbox" name="' . $item['titlelink'] . '" value="' . $item['titlelink'] . '" class="catcheck" />' . $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('catbox', $visible); echo gettext('Categories not published'); ?> </legend> <?php if ($output) { echo sprintf(ngettext('%u unpublished category', '%u unpublished categories', $c), $c); ?> <div id="catbox"<?php
/** * 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; }
/** * Creates a "REWRITE" url given the query parameters that represent the link * * @param type $query * @return string */ function zpRewriteURL($query) { $redirectURL = ''; if (isset($query['p'])) { sanitize($query); switch ($query['p']) { case 'news': $redirectURL = _NEWS_; if (isset($query['category'])) { $obj = new ZenpageCategory($query['category'], false); if (!$obj->loaded) { return ''; } $redirectURL = $obj->getLink(); unset($query['category']); } else { if (isset($query['date'])) { $redirectURL = _NEWS_ARCHIVE_ . '/' . $query['date']; unset($query['date']); } } if (isset($query['title'])) { $obj = new ZenpageNews($query['title'], false); if (!$obj->loaded) { return ''; } $redirectURL = $obj->getLink(); unset($query['title']); } break; case 'pages': $redirectURL = _PAGES_; if (isset($query['title'])) { $obj = new ZenpagePage($query['title'], false); if (!$obj->loaded) { return ''; } $redirectURL = $obj->getLink(); unset($query['title']); } break; case 'search': $redirectURL = _SEARCH_; if (isset($query['date'])) { $redirectURL = _ARCHIVE_ . '/' . $query['date']; unset($query['date']); } else { if (isset($query['searchfields']) && $query['searchfields'] == 'tags') { $redirectURL = _TAGS_; unset($query['searchfields']); } } if (isset($query['words'])) { $redirectURL .= '/' . $query['words']; unset($query['words']); } break; default: $redirectURL = getCustomPageURL($query['p']); break; } unset($query['p']); $redirectURL = preg_replace('~^' . WEBPATH . '/~', '', $redirectURL); if (isset($query['page'])) { $redirectURL .= '/' . $query['page']; unset($query['page']); } $q = http_build_query($query); if ($q) { $redirectURL .= '?' . $q; } } else { if (isset($query['album'])) { if (isset($query['image'])) { $obj = newImage(NULL, array('folder' => $query['album'], 'filename' => $query['image']), true); unset($query['image']); } else { $obj = newAlbum($query['album'], NULL, true); } unset($query['album']); if (!$obj->exists) { return ''; } $redirectURL = preg_replace('~^' . WEBPATH . '/~', '', $obj->getLink()); $q = http_build_query($query); if ($q) { $redirectURL .= '?' . $q; } } } return $redirectURL; }
/** * @deprecated * @since 1.4.6 */ function getNewsCategoryPath($category, $page) { deprecated_functions::notify(gettext('Create an object and use the object getLink')); $obj = new ZenpageCategory($category); return $obj->getLink($page); }