Exemplo n.º 1
0
function printThemeMenu()
{
    echo '<ul class="menu main">';
    if (getMainSiteName() != '') {
        echo '<li><a href="' . getMainSiteURL() . '" title="' . getMainSiteName() . '">' . getMainSiteName() . '</a></li>';
    }
    echo '<li><a href="' . getGalleryIndexURL() . '" title="' . getGalleryTitle() . '">' . getGalleryTitle() . '</a></li>';
    if (function_exists('printNewsIndexURL')) {
        echo '<li><a href="' . getNewsIndexURL() . '" title="' . gettext('News') . '">' . gettext('News') . '</a></li>';
    }
    if (function_exists("printPageMenu")) {
        printPageMenu("list-top", "", "menu-active", "", "", '', 0, false, '');
    }
    echo '<li><a href="' . getCustomPageURL('archive') . '">' . gettext('Archives') . '</a></li>';
    echo '</ul>';
}
Exemplo n.º 2
0
 /**
  * Returns the full path of the news index page (news page 1) or if the "news on zp index" option is set a link to the gallery index.
  *
  * @return string
  */
 function getNewsIndexURL()
 {
     Zenpage_internal_deprecations::getNewsIndexURL();
     return getNewsIndexURL();
 }
/**
 * 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);
                } else {
                    echo "<li><a href=\"" . html_encode(getNewsIndexURL()) . "\" title=\"" . html_encode($indexname) . "\">" . html_encode($display) . "</a>";
                }
                if ($counter) {
                    if (in_context(ZP_ZENPAGE_NEWS_CATEGORY) && $mode == 'categories') {
                        $totalcount = count($_zp_current_category->getArticles(0));
                    } else {
                        save_context();
                        rem_context(ZP_ZENPAGE_NEWS_DATE);
                        $totalcount = count($_zp_zenpage->getArticles(0));
                        restore_context();
                    }
                    echo ' <span style="white-space:nowrap;"><small>(' . sprintf(ngettext('%u article', '%u articles', $totalcount), $totalcount) . ')</small></span>';
                }
                echo "</li>\n";
                break;
        }
    }
    $baseindent = max(1, count(explode("-", $currentitem_sortorder)));
    $indent = 1;
    $open = array($indent => 0);
    $parents = array(NULL);
    $order = explode('-', $currentitem_sortorder);
    $mylevel = count($order);
    $myparentsort = array_shift($order);
    for ($c = 0; $c <= $mylevel; $c++) {
        $parents[$c] = NULL;
    }
    foreach ($items as $item) {
        switch ($mode) {
            case 'pages':
                $catcount = 1;
                //	so page items all show.
                $pageobj = new ZenpagePage($item['titlelink']);
                $itemtitle = $pageobj->getTitle();
                $itemsortorder = $pageobj->getSortOrder();
                $itemid = $pageobj->getID();
                $itemparentid = $pageobj->getParentID();
                $itemtitlelink = $pageobj->getTitlelink();
                $itemurl = $pageobj->getLink();
                $count = '';
                break;
            case 'categories':
            case 'allcategories':
                $catobj = new ZenpageCategory($item['titlelink']);
                $itemtitle = $catobj->getTitle();
                $itemsortorder = $catobj->getSortOrder();
                $itemid = $catobj->getID();
                $itemparentid = $catobj->getParentID();
                $itemtitlelink = $catobj->getTitlelink();
                $itemurl = $catobj->getLink();
                $catcount = count($catobj->getArticles());
                if ($counter) {
                    $count = ' <span style="white-space:nowrap;"><small>(' . sprintf(ngettext('%u article', '%u articles', $catcount), $catcount) . ')</small></span>';
                } else {
                    $count = '';
                }
                break;
        }
        if ($catcount) {
            $level = max(1, count(explode('-', $itemsortorder)));
            $process = $level <= $showsubs && $option == "list" || ($option == 'list' || $option == 'list-top') && $level == 1 || ($option == 'list' || $option == 'omit-top' && $level > 1) && ($itemid == $currentitem_id || $itemparentid == $currentitem_id || $level < $mylevel && $level > 1 && strpos($itemsortorder, $myparentsort) === 0 || $level == $mylevel && $currentitem_parentid == $itemparentid) || $option == 'list-sub' && $itemparentid == $currentitem_id;
            if ($process) {
                if ($level > $indent) {
                    echo "\n" . str_pad("\t", $indent, "\t") . "<ul{$css_class}>\n";
                    $indent++;
                    $parents[$indent] = NULL;
                    $open[$indent] = 0;
                } else {
                    if ($level < $indent) {
                        $parents[$indent] = NULL;
                        while ($indent > $level) {
                            if ($open[$indent]) {
                                $open[$indent]--;
                                echo "</li>\n";
                            }
                            $indent--;
                            echo str_pad("\t", $indent, "\t") . "</ul>\n";
                        }
                    } else {
                        // level == indent, have not changed
                        if ($open[$indent]) {
                            // level = indent
                            echo str_pad("\t", $indent, "\t") . "</li>\n";
                            $open[$indent]--;
                        } else {
                            echo "\n";
                        }
                    }
                }
                if ($open[$indent]) {
                    // close an open LI if it exists
                    echo "</li>\n";
                    $open[$indent]--;
                }
                echo str_pad("\t", $indent - 1, "\t");
                $open[$indent]++;
                $parents[$indent] = $itemid;
                if ($level == 1) {
                    // top level
                    $class = $css_class_topactive;
                } else {
                    $class = $css_class_active;
                }
                if (!is_null($_zp_current_zenpage_page)) {
                    $gettitle = $_zp_current_zenpage_page->getTitle();
                    $getname = $_zp_current_zenpage_page->getTitlelink();
                } else {
                    if (!is_null($_zp_current_category)) {
                        $gettitle = $_zp_current_category->getTitle();
                        $getname = $_zp_current_category->getTitlelink();
                    } else {
                        $gettitle = '';
                        $getname = '';
                    }
                }
                $current = "";
                if ($itemtitlelink == $getname && !in_context(ZP_SEARCH)) {
                    switch ($mode) {
                        case 'pages':
                            if ($_zp_gallery_page == 'pages.php') {
                                $current = $class;
                            }
                            break;
                        case 'categories':
                        case 'allcategories':
                            if ($_zp_gallery_page == 'news.php') {
                                $current = $class;
                            }
                            break;
                    }
                }
                if ($limit) {
                    $itemtitle = shortenContent($itemtitle, $limit, MENU_TRUNCATE_INDICATOR);
                }
                echo "<li><a {$current} href=\"" . html_encode($itemurl) . "\" title=\"" . html_encode(getBare($itemtitle)) . "\">" . html_encode($itemtitle) . "</a>" . $count;
            }
        }
    }
    // cleanup any hanging list elements
    while ($indent > 1) {
        if ($open[$indent]) {
            echo "</li>\n";
            $open[$indent]--;
        }
        $indent--;
        echo str_pad("\t", $indent, "\t") . "</ul>";
    }
    if ($open[$indent]) {
        echo "</li>\n";
        $open[$indent]--;
    } else {
        echo "\n";
    }
    if ($startlist) {
        echo "</ul>\n";
    }
}
Exemplo n.º 4
0
			<h2 id="logo"><a href="<?php 
    echo getGalleryIndexURL();
    ?>
"><?php 
    echo getBareGalleryTitle();
    ?>
</a></h2>
			<?php 
}
?>
			
			<?php 
if ($zenpage && $zpfocus_spotlight == 'latest' && getLatestNews()) {
    ?>
			<a id="latest-news-link" href="<?php 
    echo getNewsIndexURL();
    ?>
"><?php 
    echo gettext('Latest News');
    ?>
</a>
			<?php 
    printLatestNewsCustom(1, '', true, true, 500, true);
    ?>
			<?php 
}
?>
			<?php 
if ($zpfocus_spotlight == 'manual') {
    ?>
<div id="manual-spotlight"><?php 
Exemplo n.º 5
0
    /**
     * Prints html meta data to be used in the <head> section of a page
     *
     */
    static function getHTMLMetaData()
    {
        global $_zp_gallery, $_zp_galley_page, $_zp_current_album, $_zp_current_image, $_zp_current_zenpage_news, $_zp_current_zenpage_page, $_zp_gallery_page, $_zp_current_category, $_zp_authority, $_zp_conf_vars, $_myFavorites, $htmlmetatags_need_cache, $_zp_page;
        zp_register_filter('image_processor_uri', 'htmlmetatags::ipURI');
        $host = sanitize("http://" . $_SERVER['HTTP_HOST']);
        $url = $host . getRequestURI();
        // Convert locale shorttag to allowed html meta format
        $locale = str_replace("_", "-", getUserLocale());
        $canonicalurl = '';
        // generate page title, get date
        $pagetitle = "";
        // for gallery index setup below switch
        $date = strftime(DATE_FORMAT);
        // if we don't have a item date use current date
        $desc = getBareGalleryDesc();
        $thumb = '';
        if (getOption('htmlmeta_sitelogo')) {
            $thumb = getOption('htmlmeta_sitelogo');
        }
        if (getOption('htmlmeta_og-image') || getOption('htmlmeta_twittercard')) {
            $ogimage_width = getOption('htmlmeta_ogimage_width');
            $ogimage_height = getOption('htmlmeta_ogimage_height');
            if (empty($ogimage_width)) {
                $ogimage_width = 1280;
            }
            if (empty($ogimage_height)) {
                $ogimage_height = 900;
            }
        }
        $type = 'article';
        switch ($_zp_gallery_page) {
            case 'index.php':
                $desc = getBareGalleryDesc();
                //$canonicalurl = $host . getGalleryIndexURL();
                $canonicalurl = $host . getPageNumURL($_zp_page);
                $type = 'website';
                break;
            case 'album.php':
                $pagetitle = getBareAlbumTitle() . " - ";
                $date = getAlbumDate();
                $desc = getBareAlbumDesc();
                $canonicalurl = $host . getPageNumURL($_zp_page);
                if (getOption('htmlmeta_og-image') || getOption('htmlmeta_twittercard')) {
                    $thumbimg = $_zp_current_album->getAlbumThumbImage();
                    getMaxSpaceContainer($ogimage_width, $ogimage_height, $thumbimg, false);
                    $thumb = $host . html_encode(pathurlencode($thumbimg->getCustomImage(NULL, $ogimage_width, $ogimage_height, NULL, NULL, NULL, NULL, false, NULL)));
                }
                break;
            case 'image.php':
                $pagetitle = getBareImageTitle() . " (" . getBareAlbumTitle() . ") - ";
                $date = getImageDate();
                $desc = getBareImageDesc();
                $canonicalurl = $host . getImageURL();
                if (getOption('htmlmeta_og-image') || getOption('htmlmeta_twittercard')) {
                    $thumb = $host . html_encode(pathurlencode(getCustomSizedImageMaxSpace($ogimage_width, $ogimage_height)));
                }
                break;
            case 'news.php':
                if (function_exists("is_NewsArticle")) {
                    if (is_NewsArticle()) {
                        $pagetitle = getBareNewsTitle() . " - ";
                        $date = getNewsDate();
                        $desc = trim(getBare(getNewsContent()));
                        $canonicalurl = $host . $_zp_current_zenpage_news->getLink();
                    } else {
                        if (is_NewsCategory()) {
                            $pagetitle = $_zp_current_category->getTitlelink() . " - ";
                            $date = strftime(DATE_FORMAT);
                            $desc = trim(getBare($_zp_current_category->getDesc()));
                            $canonicalurl = $host . $_zp_current_category->getLink();
                            $type = 'category';
                        } else {
                            $pagetitle = gettext('News') . " - ";
                            $desc = '';
                            $canonicalurl = $host . getNewsIndexURL();
                            $type = 'website';
                        }
                    }
                    if ($_zp_page != 1) {
                        $canonicalurl .= '/' . $_zp_page;
                    }
                }
                break;
            case 'pages.php':
                $pagetitle = getBarePageTitle() . " - ";
                $date = getPageDate();
                $desc = trim(getBare(getPageContent()));
                $canonicalurl = $host . $_zp_current_zenpage_page->getLink();
                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)) {
                    $pagetitle = $standard[$custompage] . " - ";
                } else {
                    $pagetitle = $custompage . " - ";
                }
                $desc = '';
                $canonicalurl = $host . getCustomPageURL($custompage);
                if ($_zp_page != 1) {
                    $canonicalurl .= '/' . $_zp_page;
                }
                break;
        }
        // shorten desc to the allowed 200 characters if necesssary.
        $desc = html_encode(trim(substr(getBare($desc), 0, 160)));
        $pagetitle = $pagetitle . getBareGalleryTitle();
        // get master admin
        $admin = $_zp_authority->getMasterUser();
        $author = $admin->getName();
        $meta = '';
        if (getOption('htmlmeta_http-equiv-cache-control')) {
            $meta .= '<meta http-equiv="Cache-control" content="' . getOption("htmlmeta_cache_control") . '">' . "\n";
        }
        if (getOption('htmlmeta_http-equiv-pragma')) {
            $meta .= '<meta http-equiv="pragma" content="' . getOption("htmlmeta_pragma") . '">' . "\n";
        }
        if (getOption('htmlmeta_name-keywords')) {
            $meta .= '<meta name="keywords" content="' . htmlmetatags::getMetaKeywords() . '">' . "\n";
        }
        if (getOption('htmlmeta_name-description')) {
            $meta .= '<meta name="description" content="' . $desc . '">' . "\n";
        }
        if (getOption('htmlmeta_name-page-topic')) {
            $meta .= '<meta name="page-topic" content="' . $desc . '">' . "\n";
        }
        if (getOption('htmlmeta_name-robots')) {
            $meta .= '<meta name="robots" content="' . getOption("htmlmeta_robots") . '">' . "\n";
        }
        if (getOption('htmlmeta_name-publisher')) {
            $meta .= '<meta name="publisher" content="' . FULLWEBPATH . '">' . "\n";
        }
        if (getOption('htmlmeta_name-creator')) {
            $meta .= '<meta name="creator" content="' . FULLWEBPATH . '">' . "\n";
        }
        if (getOption('htmlmeta_name-author')) {
            $meta .= '<meta name="author" content="' . $author . '">' . "\n";
        }
        if (getOption('htmlmeta_name-copyright')) {
            $meta .= '<meta name="copyright" content=" (c) ' . FULLWEBPATH . ' - ' . $author . '">' . "\n";
        }
        if (getOption('htmlmeta_name-rights')) {
            $meta .= '<meta name="rights" content="' . $author . '">' . "\n";
        }
        if (getOption('htmlmeta_name-generator')) {
            $meta .= '<meta name="generator" content="Zenphoto ' . ZENPHOTO_VERSION . '">' . "\n";
        }
        if (getOption('htmlmeta_name-revisit-after')) {
            $meta .= '<meta name="revisit-after" content="' . getOption("htmlmeta_revisit_after") . '">' . "\n";
        }
        if (getOption('htmlmeta_name-expires')) {
            $expires = getOption("htmlmeta_expires");
            if ($expires == (int) $expires) {
                $expires = preg_replace('|\\s\\-\\d+|', '', date('r', time() + $expires)) . ' GMT';
            }
            $meta .= '<meta name="expires" content="' . $expires . '">' . "\n";
        }
        // OpenGraph meta
        if (getOption('htmlmeta_og-title')) {
            $meta .= '<meta property="og:title" content="' . $pagetitle . '">' . "\n";
        }
        if (getOption('htmlmeta_og-image') && !empty($thumb)) {
            $meta .= '<meta property="og:image" content="' . $thumb . '">' . "\n";
        }
        if (getOption('htmlmeta_og-description')) {
            $meta .= '<meta property="og:description" content="' . $desc . '">' . "\n";
        }
        if (getOption('htmlmeta_og-url')) {
            $meta .= '<meta property="og:url" content="' . html_encode($url) . '">' . "\n";
        }
        if (getOption('htmlmeta_og-type')) {
            $meta .= '<meta property="og:type" content="' . $type . '">' . "\n";
        }
        // Social network extras
        if (getOption('htmlmeta_name-pinterest')) {
            $meta .= '<meta name="pinterest" content="nopin">' . "\n";
        }
        // dissalow users to pin images on Pinterest
        // Twitter card
        $twittername = getOption('htmlmeta_twittername');
        if (getOption('htmlmeta_twittercard') || !empty($twittername)) {
            $meta .= '<meta property="twitter:creator" content="' . $twittername . '">' . "\n";
            $meta .= '<meta property="twitter:site" content="' . $twittername . '">' . "\n";
            $meta .= '<meta property="twitter:card" content="summary">' . "\n";
            $meta .= '<meta property="twitter:title" content="' . $pagetitle . '">' . "\n";
            $meta .= '<meta property="twitter:description" content="' . $desc . '">' . "\n";
            if (!empty($thumb)) {
                $meta .= '<meta property="twitter:image" content="' . $thumb . '">' . "\n";
            }
        }
        // Canonical url
        if (getOption('htmlmeta_canonical-url')) {
            $meta .= '<link rel="canonical" href="' . $canonicalurl . '">' . "\n";
            if (METATAG_LOCALE_TYPE) {
                $langs = generateLanguageList();
                if (count($langs) != 1) {
                    foreach ($langs as $text => $lang) {
                        $langcheck = zpFunctions::getLanguageText($lang, '-');
                        //	for hreflang we need en-US
                        if ($langcheck != $locale) {
                            switch (METATAG_LOCALE_TYPE) {
                                case 1:
                                    $altlink = seo_locale::localePath(true, $lang);
                                    break;
                                case 2:
                                    $altlink = dynamic_locale::fullHostPath($lang);
                                    break;
                            }
                            switch ($_zp_gallery_page) {
                                case 'index.php':
                                    $altlink .= '/';
                                    break;
                                case 'gallery.php':
                                    $altlink .= '/' . _PAGE_ . '/gallery';
                                    break;
                                case 'album.php':
                                    $altlink .= '/' . html_encode($_zp_current_album->name) . '/';
                                    break;
                                case 'image.php':
                                    $altlink .= '/' . html_encode($_zp_current_album->name) . '/' . html_encode($_zp_current_image->filename) . IM_SUFFIX;
                                    break;
                                case 'news.php':
                                    if (function_exists("is_NewsArticle")) {
                                        if (is_NewsArticle()) {
                                            $altlink .= '/' . _NEWS_ . '/' . html_encode($_zp_current_zenpage_news->getTitlelink());
                                        } else {
                                            if (is_NewsCategory()) {
                                                $altlink .= '/' . _NEWS_ . '/' . html_encode($_zp_current_category->getTitlelink());
                                            } else {
                                                $altlink .= '/' . _NEWS_;
                                            }
                                        }
                                    }
                                    break;
                                case 'pages.php':
                                    $altlink .= '/' . _PAGES_ . '/' . html_encode($_zp_current_zenpage_page->getTitlelink());
                                    break;
                                case 'archive.php':
                                    $altlink .= '/' . _ARCHIVE_;
                                    break;
                                case 'search.php':
                                    $altlink .= '/' . _SEARCH_ . '/';
                                    break;
                                case 'contact.php':
                                    $altlink .= '/' . _CONTACT_ . '/';
                                    break;
                                default:
                                    // for all other possible none standard custom pages
                                    $altlink .= '/' . _PAGE_ . '/' . html_encode($pagetitle);
                                    break;
                            }
                            // switch
                            //append page number if needed
                            switch ($_zp_gallery_page) {
                                case 'index.php':
                                case 'album.php':
                                    if ($_zp_page != 1) {
                                        $altlink .= _PAGE_ . '/' . $_zp_page . '/';
                                    }
                                    break;
                                case 'gallery.php':
                                case 'news.php':
                                    if ($_zp_page != 1) {
                                        $altlink .= '/' . $_zp_page;
                                    }
                                    break;
                            }
                            $meta .= '<link rel="alternate" hreflang="' . $langcheck . '" href="' . $altlink . '">' . "\n";
                        }
                        // if lang
                    }
                    // foreach
                }
                // if count
            }
            // if option
        }
        // if canonical
        if (!empty($htmlmetatags_need_cache)) {
            $meta .= '<script type="text/javascript">' . "\n";
            $meta .= 'var caches = ["' . implode('","', $htmlmetatags_need_cache) . '"];' . "\n";
            $meta .= '
					window.onload = function() {
						var index,value;
						for (index in caches) {
								value = caches[index];
								$.ajax({
									cache: false,
									type: "GET",
									url: value
								});
						}
					}
					';
            $meta .= '</script>' . "\n";
        }
        zp_remove_filter('image_processor_uri', 'htmlmetatags::ipURI');
        echo $meta;
    }
Exemplo n.º 6
0
    /**
     *
     * places a link on the theme page to switch to or from the mobile theme
     * @param string $text link text
     */
    static function controlLink($text = NULL, $before = NULL, $after = Null)
    {
        $detect = new mobile();
        if ($detect->isMobile()) {
            if (zp_getCookie('mobileTheme_disable')) {
                if (is_null($text)) {
                    $text = gettext('View the mobile gallery');
                }
                $enable = 'on';
            } else {
                if (is_null($text)) {
                    $text = gettext('View the normal gallery');
                }
                $enable = 'off';
            }
            if ($before) {
                echo '<span class="beforetext">' . html_encode($before) . '</span>';
            }
            if (MOD_REWRITE) {
                $link = '?mobileTheme=' . $enable;
            } else {
                global $_zp_gallery_page, $_zp_current_images, $_zp_current_album, $_zp_current_zenpage_news, $_zp_current_category, $_zp_current_zenpage_page;
                switch ($_zp_gallery_page) {
                    case 'index.php':
                        $link = 'index.php?mobileTheme=' . $enable;
                        break;
                    case 'gallery.php':
                        $link = 'index.php?p=gallery&amp;mobileTheme=' . $enable;
                        break;
                    case 'album.php':
                        $link = pathurlencode($_zp_current_album->getLink(null)) . '&amp;mobileTheme=' . $enable;
                        break;
                    case 'image.php':
                        $link = pathurlencode($_zp_current_image->getLink(null)) . '&amp;mobileTheme=' . $enable;
                        break;
                    case 'news.php':
                        if (is_NewsArticle()) {
                            $link = html_encode($_zp_current_zenpage_news->getLink(null)) . '&amp;mobileTheme=' . $enable;
                        } else {
                            if (is_NewsCategory()) {
                                $link = html_encode($_zp_current_category->getLink(null)) . '&amp;mobileTheme=' . $enable;
                            } else {
                                $link = html_encode(getNewsIndexURL()) . '&amp;mobileTheme=' . $enable;
                            }
                        }
                        break;
                    case 'pages.php':
                        $link = html_encode($_zp_current_zenpage_page->getLink()) . '&amp;mobileTheme=' . $enable;
                        break;
                    default:
                        $link = html_encode($_zp_gallery_page) . '?mobileTheme=' . $enable;
                        break;
                }
            }
            ?>
			<span class="mobileThemeControlLink">
				
				<a href="<?php 
            echo $link;
            ?>
" rel="external">
					<?php 
            echo html_encode($text);
            ?>
				</a>
			</span>
			<?php 
            if ($after) {
                echo '<span class="aftertext">' . html_encode($after) . '</span>';
            }
        }
    }
Exemplo n.º 7
0
?>
			</div>
			<div id="menu">
				<?php 
printThemeMenu();
?>
			</div>
			<div id="breadcrumb">
				<ul>
				<?php 
getFormattedMainSiteName('<li class="page">', '</li><li class="chevron"> > </li>');
echo '<li><a href="' . getGalleryIndexURL() . '" class="activ">' . getBareGalleryTitle() . '</a></li>';
echo '<li class="chevron"><a> &gt; </a></li>';
echo '<li><a';
if (is_NewsArticle()) {
    echo ' href="' . getNewsIndexURL() . '">News</a></li><li class="chevron"><a> &gt; </a></li><li><a>' . strip_tags(getNewsTitle());
} else {
    echo '>News';
}
echo '</a></li>';
?>
				</ul>
			</div>
			<div id="content">
				<?php 
if (is_NewsArticle()) {
    // Affichage d'une news particulière
    ?>
				<div class="description">
					<div class="title">
						<h3><?php 
Exemplo n.º 8
0
/**
 * Prints the image/subalbum count for the album loop
 */
function jqm_printMainHeaderNav()
{
    global $_zp_gallery_page, $_zp_zenpage, $_zp_current_album, $_zp_themeroot;
    ?>
	<div data-role="header" data-position="inline" data-theme="b">
		<h1><?php 
    printGalleryTitle();
    ?>
</h1>
		<a href="<?php 
    echo html_encode(getSiteHomeURL());
    ?>
" data-icon="home" data-iconpos="notext"><?php 
    echo gettext('Home');
    ?>
</a>
		<?php 
    if (getOption('Allow_search')) {
        ?>
			<a href="<?php 
        echo getCustomPageURL('search');
        ?>
" data-icon="search" data-iconpos="notext"><?php 
        echo gettext('Search');
        ?>
</a>
		<?php 
    }
    ?>
		<div data-role="navbar">
			<ul>
				<li><a href="<?php 
    echo getCustomPageURL('gallery');
    ?>
"><?php 
    echo gettext('Gallery');
    ?>
</a></li>
				<?php 
    if (extensionEnabled('zenpage') && ZP_NEWS_ENABLED) {
        ?>
					<li><a href="<?php 
        echo getNewsIndexURL();
        ?>
"><?php 
        echo gettext('News');
        ?>
</a></li>
    <?php 
        if (extensionEnabled('zenpage') && ZP_PAGES_ENABLED) {
            ?>
					<li><a href="<?php 
            echo getPagesLink();
            ?>
"><?php 
            echo gettext('Pages');
            ?>
</a></li>
    <?php 
        }
        ?>
				<?php 
    }
    ?>
				<li><a href="<?php 
    echo getCustomPageURL('archive');
    ?>
"><?php 
    echo gettext('Archive');
    ?>
</a></li>
			</ul>
		</div><!-- /navbar -->
	</div><!-- /header -->
	<?php 
}
/**
 * Adds an menu item set via POST
 *
 * @return array
 */
function addItem(&$reports)
{
    $menuset = checkChosenMenuset();
    $result['type'] = sanitize($_POST['type']);
    $result['show'] = getCheckboxState('show');
    $result['include_li'] = getCheckboxState('include_li');
    $result['id'] = 0;
    if (getCheckboxState('span')) {
        $result['span_id'] = sanitize($_POST['span_id']);
        $result['span_class'] = sanitize($_POST['span_class']);
    } else {
        $result['span_id'] = '';
        $result['span_class'] = '';
    }
    switch ($result['type']) {
        case 'all_items':
            query("INSERT INTO " . prefix('menu') . " (`title`,`link`,`type`,`show`,`menuset`,`sort_order`) " . "VALUES ('" . gettext('Home') . "', '" . WEBPATH . '/' . "','galleryindex','1'," . db_quote($menuset) . ",'000')", true);
            addAlbumsToDatabase($menuset);
            if (extensionEnabled('zenpage')) {
                query("INSERT INTO " . prefix('menu') . " (`title`,`link`,`type`,`show`,`menuset`,`sort_order`) " . "VALUES ('" . gettext('News index') . "', '" . getNewsIndexURL() . "', 'zenpagenewsindex', '1', " . db_quote($menuset) . ", '001')", true);
                addPagesToDatabase($menuset);
                addCategoriesToDatabase($menuset);
            }
            $reports[] = "<p class = 'messagebox fade-message'>" . gettext("Menu items for all Zenphoto objects added.") . " </p>";
            return NULL;
        case 'all_albums':
            addAlbumsToDatabase($menuset);
            $reports[] = "<p class = 'messagebox fade-message'>" . gettext("Menu items for all albums added.") . " </p>";
            return NULL;
        case 'all_zenpagepages':
            addPagesToDatabase($menuset);
            $reports[] = "<p class = 'messagebox fade-message'>" . gettext("Menu items for all Zenpage pages added.") . " </p>";
            return NULL;
        case 'all_zenpagecategorys':
            addCategoriesToDatabase($menuset);
            $reports[] = "<p class = 'messagebox fade-message'>" . gettext("Menu items for all Zenpage categories added.") . " </p>";
            return NULL;
        case 'album':
            $result['title'] = $result['link'] = sanitize($_POST['albumselect']);
            if (empty($result['link'])) {
                $reports[] = "<p class = 'errorbox fade-message'>" . gettext("You forgot to select an album.") . " </p>";
                return $result;
            }
            $successmsg = sprintf(gettext("Album menu item <em>%s</em> added"), $result['link']);
            break;
        case 'galleryindex':
            $result['title'] = process_language_string_save("title", 2);
            $result['link'] = NULL;
            if (empty($result['title'])) {
                $reports[] = "<p class = 'errorbox fade-message'>" . gettext("You forgot to give your menu item a <strong>title</strong>!") . " </p>";
                return $result;
            }
            $successmsg = sprintf(gettext("Gallery index menu item <em>%s</em> added"), $result['link']);
            break;
        case 'zenpagepage':
            $result['title'] = NULL;
            $result['link'] = sanitize($_POST['pageselect']);
            if (empty($result['link'])) {
                $reports[] = "<p class = 'errorbox fade-message'>" . gettext("You forgot to give your menu item a <strong>link</strong>!") . " </p>";
                return $result;
            }
            $successmsg = sprintf(gettext("Zenpage page menu item <em>%s</em> added"), $result['link']);
            break;
        case 'zenpagenewsindex':
            $result['title'] = process_language_string_save("title", 2);
            $result['link'] = NULL;
            if (empty($result['title'])) {
                $reports[] = "<p class = 'errorbox fade-message'>" . gettext("You forgot to give your menu item a <strong>title</strong>!") . " </p>";
                return $result;
            }
            $successmsg = sprintf(gettext("Zenpage news index menu item <em>%s</em> added"), $result['link']);
            break;
        case 'zenpagecategory':
            $result['title'] = NULL;
            $result['link'] = sanitize($_POST['categoryselect']);
            if (empty($result['link'])) {
                $reports[] = "<p class = 'errorbox fade-message'>" . gettext("You forgot to give your menu item a <strong>link</strong>!") . " </p>";
                return $result;
            }
            $successmsg = sprintf(gettext("Zenpage news category menu item <em>%s</em> added"), $result['link']);
            break;
        case 'custompage':
            $result['title'] = process_language_string_save("title", 2);
            $result['link'] = sanitize($_POST['custompageselect']);
            if (empty($result['title'])) {
                $reports[] = "<p class = 'errorbox fade-message'>" . gettext("You forgot to give your menu item a <strong>title</strong>!") . " </p>";
                return $result;
            }
            $successmsg = sprintf(gettext("Custom page menu item <em>%s</em> added"), $result['link']);
            break;
        case 'customlink':
            $result['title'] = process_language_string_save("title", 2);
            if (empty($result['title'])) {
                $reports[] = "<p class = 'errorbox fade-message'>" . gettext("You forgot to give your menu item a <strong>title</strong>!") . " </p>";
                return $result;
            }
            $result['link'] = sanitize($_POST['link']);
            if (empty($result['link'])) {
                $reports[] = "<p class = 'errorbox fade-message'>" . gettext("You forgot to provide a <strong>function</strong>!") . " </p>";
                return $result;
            }
            $successmsg = sprintf(gettext("Custom page menu item <em>%s</em> added"), $result['link']);
            break;
        case 'menulabel':
            $result['title'] = process_language_string_save("title", 2);
            $result['link'] = NULL;
            if (empty($result['title'])) {
                $reports[] = "<p class = 'errorbox fade-message'>" . gettext("You forgot to give your menu item a <strong>title</strong>!") . " </p>";
                return $result;
            }
            $successmsg = gettext("Custom label added");
            break;
        case 'menufunction':
            $result['title'] = process_language_string_save("title", 2);
            if (empty($result['title'])) {
                $reports[] = "<p class = 'errorbox fade-message'>" . gettext("You forgot to give your menu item a <strong>title</strong>!") . " </p>";
                return $result;
            }
            $result['link'] = sanitize($_POST['link'], 4);
            if (empty($result['link'])) {
                $reports[] = "<p class = 'errorbox fade-message'>" . gettext("You forgot to provide a <strong>function</strong>!") . " </p>";
                return $result;
            }
            $successmsg = sprintf(gettext("Function menu item <em>%s</em> added"), $result['link']);
            break;
        case 'html':
            $result['title'] = process_language_string_save("title", 2);
            if (empty($result['title'])) {
                $reports[] = "<p class = 'errorbox fade-message'>" . gettext("You forgot to give your menu item a <strong>title</strong>!") . " </p>";
                return $result;
            }
            $result['link'] = sanitize($_POST['link'], 4);
            if (empty($result['link'])) {
                $reports[] = "<p class = 'errorbox fade-message'>" . gettext("You forgot to provide a <strong>function</strong>!") . " </p>";
                return $result;
            }
            $successmsg = gettext("<em>HTML</em> added");
            break;
        default:
            break;
    }
    $count = db_count('menu', 'WHERE menuset=' . db_quote($menuset));
    $order = sprintf('%03u', $count);
    $sql = "INSERT INTO " . prefix('menu') . " ( `title`, `link`, `type`, `show`, `menuset`, `sort_order`, `include_li`, `span_id`, `span_class`) " . "VALUES (" . db_quote($result['title']) . ", " . db_quote($result['link']) . ", " . db_quote($result['type']) . ", " . $result['show'] . ", " . db_quote($menuset) . ", " . db_quote($order) . ", " . $result['include_li'] . ", " . db_quote($result['span_id']) . ", " . db_quote($result['span_class']) . ")";
    if (query($sql, true)) {
        $reports[] = "<p class = 'messagebox fade-message'>" . $successmsg . "</p>";
        //echo "<pre>"; print_r($result); echo "</pre>";
        $result['id'] = db_insert_id();
        return $result;
    } else {
        if (empty($result['link'])) {
            $reports[] = "<p class = 'errorbox fade-message'>" . sprintf(gettext('A <em>%1$s</em> item already exists in <em>%2$s </em>!'), $result['type'], $menuset) . "</p>";
        } else {
            $reports[] = "<p class = 'errorbox fade-message'>" . sprintf(gettext('A <em>%1$s</em> item with the link <em>%2$s</em> already exists in <em>%3$s </em>!'), $result['type'], $result['link'], $menuset) . "</p>";
        }
        return NULL;
    }
}
Exemplo n.º 10
0
/**
 * Creates a menu set from the items passed. But only if the menu set does not already exist
 * @param array $menuitems items for the menuset
 * 		array elements:
 * 			'type'=>menuset type
 * 			'title'=>title for the menu item
 * 			'link'=>URL or other data for the item link
 * 			'show'=>set to 1:"visible" or 0:"hidden",
 * 			'nesting'=>nesting level of this item in the menu heirarchy
 *
 * @param string $menuset current menuset
 */
function createMenuIfNotExists($menuitems, $menuset = 'default')
{
    $count = db_count('menu', 'WHERE menuset=' . db_quote($menuset));
    if ($count == 0) {
        // there was not an existing menu set
        require_once dirname(__FILE__) . '/menu_manager/menu_manager-admin-functions.php';
        $success = 1;
        $orders = array();
        foreach ($menuitems as $key => $result) {
            if (array_key_exists('nesting', $result)) {
                $nesting = $result['nesting'];
            } else {
                $nesting = 0;
            }
            while ($nesting + 1 < count($orders)) {
                array_pop($orders);
            }
            while ($nesting + 1 > count($orders)) {
                array_push($orders, -1);
            }
            $result['id'] = 0;
            if (isset($result['include_li'])) {
                $includeli = $result['include_li'];
            } else {
                $includeli = 1;
            }
            $type = $result['type'];
            switch ($type) {
                case 'all_items':
                    $orders[$nesting]++;
                    query("INSERT INTO " . prefix('menu') . " (`title`,`link`,`type`,`show`,`menuset`,`sort_order`) " . "VALUES ('" . gettext('Home') . "', '" . WEBPATH . '/' . "','galleryindex','1'," . db_quote($menuset) . ',' . db_quote($orders), true);
                    $orders[$nesting] = addAlbumsToDatabase($menuset, $orders);
                    if (extensionEnabled('zenpage')) {
                        $orders[$nesting]++;
                        query("INSERT INTO " . prefix('menu') . " (title`,`link`,`type`,`show`,`menuset`,`sort_order`) " . "VALUES ('" . gettext('News index') . "', '" . getNewsIndexURL() . "','newsindex','1'," . db_quote($menuset) . ',' . db_quote(sprintf('%03u', $base + 1)), true);
                        $orders[$nesting] = addPagesToDatabase($menuset, $orders) + 1;
                        $orders[$nesting] = addCategoriesToDatabase($menuset, $orders);
                    }
                    $type = false;
                    break;
                case 'all_albums':
                    $orders[$nesting]++;
                    $orders[$nesting] = addAlbumsToDatabase($menuset, $orders);
                    $type = false;
                    break;
                case 'all_Pages':
                    $orders[$nesting]++;
                    $orders[$nesting] = addPagesToDatabase($menuset, $orders);
                    $type = false;
                    break;
                case 'all_categorys':
                    $orders[$nesting]++;
                    $orders[$nesting] = addCategoriesToDatabase($menuset, $orders);
                    $type = false;
                    break;
                case 'album':
                    $result['title'] = NULL;
                    if (empty($result['link'])) {
                        $success = -1;
                        debugLog(sprintf(gettext('createMenuIfNotExists item %s has an empty link.'), $key));
                    }
                    break;
                case 'galleryindex':
                    $result['link'] = NULL;
                    if (empty($result['title'])) {
                        $success = -1;
                        debugLog(sprintf(gettext('createMenuIfNotExists item %s has an empty title.'), $key));
                    }
                    break;
                case 'Page':
                    $result['title'] = NULL;
                    if (empty($result['link'])) {
                        $success = -1;
                        debugLog(sprintf(gettext('createMenuIfNotExists item %s has an empty link.'), $key));
                    }
                    break;
                case 'newsindex':
                    $result['link'] = NULL;
                    if (empty($result['title'])) {
                        $success = -1;
                        debugLog(sprintf(gettext('createMenuIfNotExists item %s has an empty title.'), $key));
                    }
                    break;
                case 'category':
                    $result['title'] = NULL;
                    if (empty($result['link'])) {
                        $success = -1;
                        debugLog(sprintf(gettext('createMenuIfNotExists item %s has an empty link.'), $key));
                    }
                    break;
                case 'custompage':
                    if (empty($result['title']) || empty($result['link'])) {
                        $success = -1;
                        debugLog(sprintf(gettext('createMenuIfNotExists item %s has an empty title or link.'), $key));
                    }
                    break;
                case 'customlink':
                    if (empty($result['title'])) {
                        $success = -1;
                        debugLog(sprintf(gettext('createMenuIfNotExists item %s has an empty title.'), $key));
                    } else {
                        if (empty($result['link'])) {
                            $result['link'] = seoFriendly(get_language_string($result['title']));
                        }
                    }
                    break;
                case 'menulabel':
                    if (empty($result['title'])) {
                        $success = -1;
                        debugLog(sprintf(gettext('createMenuIfNotExists item %s has an empty title.'), $key));
                    }
                    $result['link'] = sha1($result['title']);
                    break;
                case 'menufunction':
                    if (empty($result['title']) || empty($result['link'])) {
                        $success = -1;
                        debugLog(sprintf(gettext('createMenuIfNotExists item %s has an empty title or link.'), $key));
                    }
                    break;
                case 'html':
                    if (empty($result['title']) || empty($result['link'])) {
                        $success = -1;
                        debugLog(sprintf(gettext('createMenuIfNotExists item %s has an empty title or link.'), $key));
                    }
                    break;
                default:
                    $success = -1;
                    debugLog(sprintf(gettext('createMenuIfNotExists item %s has an invalid type.'), $key));
                    break;
            }
            if ($success > 0 && $type) {
                $orders[$nesting]++;
                $sort_order = '';
                for ($i = 0; $i < count($orders); $i++) {
                    $sort_order .= sprintf('%03u', $orders[$i]) . '-';
                }
                $sort_order = substr($sort_order, 0, -1);
                $sql = "INSERT INTO " . prefix('menu') . " (`title`,`link`,`type`,`show`,`menuset`,`sort_order`,`include_li`) " . "VALUES (" . db_quote($result['title']) . ", " . db_quote($result['link']) . "," . db_quote($result['type']) . "," . $result['show'] . "," . db_quote($menuset) . "," . db_quote($sort_order) . ",{$includeli})";
                if (!query($sql, false)) {
                    $success = -2;
                    debugLog(sprintf(gettext('createMenuIfNotExists item %1$s query (%2$s) failed: %3$s.'), $key, $sql, db_error()));
                }
            }
        }
    } else {
        $success = 0;
    }
    if ($success < 0) {
        zp_error(gettext('createMenuIfNotExists has posted processing errors to your debug log.'), E_USER_NOTICE);
    }
    return $success;
}
Exemplo n.º 11
0
/**
 * Prints the image/subalbum count for the album loop
 */
function jqm_printMainHeaderNav()
{
    global $_zp_gallery_page, $_zp_current_album, $_zp_themeroot;
    ?>
	<div data-role="header" data-position="inline" data-theme="b">
		<h1><?php 
    printGalleryTitle();
    ?>
</h1>
		<a href="<?php 
    echo WEBPATH;
    ?>
/" data-icon="home" data-iconpos="notext"><?php 
    echo gettext('Home');
    ?>
</a>
		<?php 
    if (getOption('Allow_search') && $_zp_gallery_page != 'search.php') {
        ?>
			<a href="<?php 
        echo getCustomPageURL('search');
        ?>
" data-icon="search" data-iconpos="notext"><?php 
        echo gettext('Search');
        ?>
</a>
		<?php 
    }
    ?>
		<div data-role="navbar">
			<ul>
				<li><a href="<?php 
    echo getCustomPageURL('gallery');
    ?>
"><?php 
    echo gettext('Gallery');
    ?>
</a></li>
				<?php 
    if (extensionEnabled('zenpage') && getNumNews(true)) {
        ?>
					<li><a href="<?php 
        echo getNewsIndexURL();
        ?>
"><?php 
        echo gettext('News');
        ?>
</a></li>
					<?php 
    }
    if (extensionEnabled('zenpage') && getNumPages(true)) {
        ?>
					<li><a href="<?php 
        echo getCustomPageURL('pagelist');
        ?>
"><?php 
        echo gettext('Pages');
        ?>
</a></li>
					<?php 
    }
    ?>
				<li><a href="<?php 
    echo getCustomPageURL('archive');
    ?>
"><?php 
    echo gettext('Archive');
    ?>
</a></li>
			</ul>
		</div><!-- /navbar -->
	</div><!-- /header -->
	<?php 
}