Esempio n. 1
0
/**
 * Gets links to Zenpage news categories incl. pagination
 *
 * @return string
 */
function getSitemapZenpageNewsCategories()
{
    global $_zp_zenpage, $sitemap_number;
    //TODO not splitted into several sitemaps yet
    if ($sitemap_number == 1) {
        $data = '';
        $sitemap_locales = generateLanguageList();
        $changefreq = getOption('sitemap_changefreq_newscats');
        $newscats = $_zp_zenpage->getAllCategories();
        if ($newscats) {
            $data .= sitemap_echonl('<?xml version="1.0" encoding="UTF-8"?>');
            $data .= sitemap_echonl('<urlset xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9 http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd" xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">');
            foreach ($newscats as $newscat) {
                $catobj = new ZenpageCategory($newscat['titlelink']);
                if (!$catobj->isProtected()) {
                    switch (SITEMAP_LOCALE_TYPE) {
                        case 1:
                            foreach ($sitemap_locales as $locale) {
                                $url = seo_locale::localePath(true, $locale) . '/' . _CATEGORY_ . '/' . urlencode($catobj->getTitlelink()) . '/1';
                                $data .= sitemap_echonl("\t<url>\n\t\t<loc>" . $url . "</loc>\n\t\t<changefreq>" . $changefreq . "</changefreq>\n\t\t<priority>0.9</priority>\n\t</url>");
                            }
                            break;
                        case 2:
                            foreach ($sitemap_locales as $locale) {
                                $url = rewrite_path(_CATEGORY_ . '/' . urlencode($catobj->getTitlelink()) . '/1', '?p=news&amp;category=' . urlencode($catobj->getTitlelink()) . '&amp;page=1', dynamic_locale::fullHostPath($locale));
                                $data .= sitemap_echonl("\t<url>\n\t\t<loc>" . $url . "</loc>\n\t\t<changefreq>" . $changefreq . "</changefreq>\n\t\t<priority>0.9</priority>\n\t</url>");
                            }
                            break;
                        default:
                            $url = rewrite_path(_CATEGORY_ . '/' . urlencode($catobj->getTitlelink()) . '/1', '?p=news&amp;category=' . urlencode($catobj->getTitlelink()) . '&amp;page=1', FULLWEBPATH);
                            $data .= sitemap_echonl("\t<url>\n\t\t<loc>" . $url . "</loc>\n\t\t<changefreq>" . $changefreq . "</changefreq>\n\t\t<priority>0.9</priority>\n\t</url>");
                            break;
                    }
                    // getting pages for the categories
                    /*
                    					  if(!empty($articlesperpage)) {
                    					  $zenpage_articles_per_page = sanitize_numeric($articlesperpage);
                    					  } else {
                    					  $zenpage_articles_per_page = ZP_ARTICLES_PER_PAGE;
                    					  } */
                    $zenpage_articles_per_page = ZP_ARTICLES_PER_PAGE;
                    $articlecount = count($catobj->getArticles());
                    $catpages = ceil($articlecount / $zenpage_articles_per_page);
                    if ($catpages > 1) {
                        for ($x = 2; $x <= $catpages; $x++) {
                            switch (SITEMAP_LOCALE_TYPE) {
                                case 1:
                                    foreach ($sitemap_locales as $locale) {
                                        $url = seo_locale::localePath(true, $locale) . '/' . _CATEGORY_ . '/' . urlencode($catobj->getTitlelink()) . '/' . $x;
                                        $data .= sitemap_echonl("\t<url>\n\t\t<loc>" . $url . "</loc>\n\t\t<changefreq>" . $changefreq . "</changefreq>\n\t\t<priority>0.9</priority>\n\t</url>");
                                    }
                                    break;
                                case 2:
                                    foreach ($sitemap_locales as $locale) {
                                        $url = rewrite_path(_CATEGORY_ . '/' . urlencode($catobj->getTitlelink()) . '/' . $x, '?p=news&amp;category=' . urlencode($catobj->getTitlelink()) . '&amp;page=' . $x, dynamic_locale::fullHostPath($locale));
                                        $data .= sitemap_echonl("\t<url>\n\t\t<loc>" . $url . "</loc>\n\t\t<changefreq>" . $changefreq . "</changefreq>\n\t\t<priority>0.9</priority>\n\t</url>");
                                    }
                                    break;
                                default:
                                    $url = rewrite_path(_CATEGORY_ . '/' . urlencode($catobj->getTitlelink()) . '/' . $x, '?p=news&amp;category=' . urlencode($catobj->getTitlelink()) . '&amp;page=' . $x, FULLWEBPATH);
                                    $data .= sitemap_echonl("\t<url>\n\t\t<loc>" . $url . "</loc>\n\t\t<changefreq>" . $changefreq . "</changefreq>\n\t\t<priority>0.9</priority>\n\t</url>");
                                    break;
                            }
                        }
                    }
                }
            }
            $data .= sitemap_echonl('</urlset>');
            // End off the <urlset> tag
        }
        return $data;
    }
}
/**
 * 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";
    }
}
/**
 * Prints the dropdown menu for the category selector for the news articles list
 *
 */
function printCategoryDropdown()
{
    global $_zp_zenpage;
    $currentpage = $_zp_zenpage->getCurrentAdminNewsPage();
    $result = $_zp_zenpage->getAllCategories(false);
    if (isset($_GET['date'])) {
        $datelink = "&amp;date=" . $_GET['date'];
        $datelinkall = "?date=" . $_GET['date'];
    } else {
        $datelink = "";
        $datelinkall = "";
    }
    if (isset($_GET['category'])) {
        $selected = '';
        $category = sanitize($_GET['category']);
    } else {
        $selected = "selected='selected'";
        $category = "";
    }
    ?>
	<form name ="AutoListBox2" id="categorydropdown" style="float:left" action="#" >
	<select name="ListBoxURL" size="1" onchange="gotoLink(this.form)">
		<?php 
    echo "<option {$selected} value='admin-news-articles.php?pagenr=" . $currentpage . getNewsAdminOptionPath(false, true, true) . "'>" . gettext("All categories") . "</option>\n";
    foreach ($result as $cat) {
        $catobj = new ZenpageCategory($cat['titlelink']);
        // check if there are articles in this category. If not don't list the category.
        $count = count($catobj->getArticles(0, 'all'));
        $count = " (" . $count . ")";
        if ($category == $cat['titlelink']) {
            $selected = "selected='selected'";
        } else {
            $selected = "";
        }
        //This is much easier than hacking the nested list function to work with this
        $getparents = $catobj->getParents();
        $levelmark = '';
        foreach ($getparents as $parent) {
            $levelmark .= '&raquo; ';
        }
        $title = $catobj->getTitle();
        if (empty($title)) {
            $title = '*' . $catobj->getTitlelink() . '*';
        }
        if ($count != " (0)") {
            echo "<option {$selected} value='admin-news-articles.php?pagenr=" . $currentpage . "&amp;category=" . $catobj->getTitlelink() . getNewsAdminOptionPath(false, true, true) . "'>" . $levelmark . $title . $count . "</option>\n";
        }
    }
    ?>
	</select>
	<script language="JavaScript" type="text/javascript" >
		// <!-- <![CDATA[
		function gotoLink(form) {
		var OptionIndex=form.ListBoxURL.selectedIndex;
		parent.location = form.ListBoxURL.options[OptionIndex].value;}
		// ]]> -->
</script>
</form>
<?php 
}
Esempio n. 4
0
/**
 * Prints a context sensitive menu of all pages as a unordered html list
 *
 * @param string $menuset the menu tree to output
 * @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 $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 $counter TRUE (FALSE default) if you want the count of articles for Zenpage news categories or images/subalbums for albums.
 * @return string
 */
function printCustomMenu($menuset = 'default', $option = 'list', $css_id = '', $css_class_topactive = '', $css_class = '', $css_class_active = '', $showsubs = 0, $counter = false)
{
    global $_zp_zenpage, $_zp_gallery_page, $_zp_current_zenpage_page, $_zp_current_category;
    $itemcounter = '';
    if ($css_id != "") {
        $css_id = " id='" . $css_id . "'";
    }
    if ($showsubs === true) {
        $showsubs = 9999999999;
    }
    $sortorder = getCurrentMenuItem($menuset);
    $items = getMenuItems($menuset, getMenuVisibility());
    if (count($items) == 0) {
        return;
    }
    // nothing to do
    $currentitem_parentid = @$items[$sortorder]['parentid'];
    if ($startlist = !($option == 'omit-top' || $option == 'list-sub')) {
        echo "<ul{$css_id}>";
    }
    $pageid = @$items[$sortorder]['id'];
    $baseindent = max(1, count(explode("-", $sortorder)));
    $indent = 1;
    $open = array($indent => 0);
    $parents = array(NULL);
    $order = explode('-', $sortorder);
    $mylevel = count($order);
    $myparentsort = array_shift($order);
    for ($c = 0; $c <= $mylevel; $c++) {
        $parents[$c] = NULL;
    }
    foreach ($items as $item) {
        $itemarray = getItemTitleAndURL($item);
        $itemURL = $itemarray['url'];
        $itemtitle = $itemarray['title'];
        $level = max(1, count(explode('-', $item['sort_order'])));
        $process = $level <= $showsubs && $option == "list" || ($option == 'list' || $option == 'list-top') && $level == 1 || (($option == 'list' || $option == 'omit-top' && $level > 1) && ($item['id'] == $pageid || $item['parentid'] == $pageid || $level < $mylevel && $level > 1 && strpos($item['sort_order'], $myparentsort) === 0) || $level == $mylevel && $currentitem_parentid == $item['parentid']) || $option == 'list-sub' && $item['parentid'] == $pageid;
        if ($process) {
            if ($level > $indent) {
                echo "\n" . str_pad("\t", $indent, "\t") . "<ul class=\"{$css_class} menu_{$item['type']}\">\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] += $item['include_li'];
            $parents[$indent] = $item['id'];
            if ($counter) {
                switch ($item['type']) {
                    case 'album':
                        $albumobj = newAlbum($item['link']);
                        $numimages = $albumobj->getNumImages();
                        $numsubalbums = $albumobj->getNumAlbums();
                        $itemcounter = ' <span style="white-space:nowrap;"><small>(';
                        if ($numsubalbums != 0) {
                            $itemcounter .= sprintf(ngettext('%u album', '%u albums', $numsubalbums), $numsubalbums);
                        }
                        if ($numimages != 0) {
                            if ($numsubalbums != 0) {
                                $itemcounter .= ' ';
                            }
                            $itemcounter .= sprintf(ngettext('%u image', '%u images', $numimages), $numimages);
                        }
                        $itemcounter .= ')</small></span>';
                        break;
                    case 'zenpagecategory':
                        if (zp_loggedin(ZENPAGE_NEWS_RIGHTS | ALL_NEWS_RIGHTS)) {
                            $published = "all";
                        } else {
                            $published = "published";
                        }
                        $catobj = new ZenpageCategory($item['link']);
                        $catcount = count($catobj->getArticles(0, $published));
                        $itemcounter = "<small> (" . $catcount . ")</small>";
                        break;
                }
            }
            if ($item['id'] == $pageid && !is_null($pageid)) {
                if ($level == 1) {
                    // top level
                    $class = $css_class_topactive;
                } else {
                    $class = $css_class_active;
                }
                echo '<li class="menu_' . trim($item['type'] . ' ' . $class) . '">' . $itemtitle . $itemcounter;
            } else {
                if (strpos($sortorder, $item['sort_order']) === 0) {
                    // we are in the heritage chain
                    $class = ' ' . $css_class_active . '-' . ($mylevel - $level);
                } else {
                    $class = '';
                }
                if ($item['include_li']) {
                    echo '<li class="menu_' . $item['type'] . $class . '">';
                }
                if ($item['span_id'] || $item['span_class']) {
                    echo '<span';
                    if ($item['span_id']) {
                        echo ' id="' . $item['span_id'] . '"';
                    }
                    if ($item['span_class']) {
                        echo ' class="' . $item['span_class'] . '"';
                    }
                    echo '>';
                }
                switch ($item['type']) {
                    case 'html':
                        echo $item['link'];
                        break;
                    case 'menufunction':
                        $i = strpos($itemURL, '(');
                        if ($i) {
                            if (function_exists(trim(substr($itemURL, 0, $i)))) {
                                eval($itemURL);
                            }
                        }
                        break;
                    case 'menulabel':
                        echo $itemtitle;
                        break;
                    default:
                        if (empty($itemURL)) {
                            $itemURL = FULLWEBPATH;
                        }
                        echo '<a href="' . $itemURL . '" title="' . getBare($itemtitle) . '">' . $itemtitle . '</a>' . $itemcounter;
                        break;
                }
                if ($item['span_id'] || $item['span_class']) {
                    echo '</span>';
                }
            }
        }
    }
    // 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";
    }
}
    switch ($_GET['published']) {
        case 'no':
            $published = 'unpublished';
            break;
        case 'yes':
            $published = 'published';
            break;
        case 'sticky':
            $published = 'sticky';
    }
} else {
    $published = 'all';
}
if (isset($_GET['category'])) {
    $catobj = new ZenpageCategory(sanitize($_GET['category']));
    $resultU = $catobj->getArticles(0, 'unpublished', false);
    $result = $catobj->getArticles(0, $published, false);
} else {
    $catobj = NULL;
    $resultU = $_zp_zenpage->getNewsArticles(0, 'unpublished', false);
    $result = $_zp_zenpage->getNewsArticles(0, $published, false);
}
foreach ($result as $key => $article) {
    $article = new ZenpageNews($article['titlelink']);
    if (!$article->isMyItem(ZENPAGE_NEWS_RIGHTS)) {
        unset($result[$key]);
    }
}
foreach ($resultU as $key => $article) {
    $article = new ZenpageNews($article['titlelink']);
    if (!$article->isMyItem(ZENPAGE_NEWS_RIGHTS)) {
Esempio n. 6
0
</script>

<p class="buttons"><a href="javascript:accordian()"><span id="show_hide">Expand all</span></a></p>
<br clear="left" />
<?php 
global $_zp_current_category;
$currentcat = $_zp_current_category;
$catobj = new ZenpageCategory('troubleshooting');
$cats = $catobj->getSubCategories();
?>
<ol class="index">
<?php 
foreach ($cats as $key => $cat) {
    $catobj = new ZenpageCategory($cat);
    $_zp_current_category = $catobj;
    $articles = $catobj->getArticles();
    if (!empty($articles)) {
        $h4 = $catobj->getTitle();
        ?>
		<li><a href="#<?php 
        echo $catobj->getTitlelink();
        ?>
"><?php 
        echo $h4;
        ?>
</a></li>
		<?php 
    } else {
        unset($cats[$key]);
    }
}
Esempio n. 7
0
/**
 * @deprecated
 * @since 1.4.1
 */
function getArticles($articles_per_page = '', $category = '', $published = NULL, $ignorepagination = false, $sortorder = "date", $sortdirection = "desc", $sticky = true)
{
    deprecated_functions::notify(gettext('Use the Zenpage class method instead.'));
    global $_zp_zenpage, $_zp_current_category;
    if (!empty($category)) {
        $catobj = new ZenpageCategory($category);
        return $catobj->getArticles($articles_per_page, $category, $published, $ignorepagination, $sortorder, $sortdirection, $sticky);
    } elseif (in_context(ZP_ZENPAGE_NEWS_CATEGORY)) {
        return $_zp_current_category->getArticles($articles_per_page, $category, $published, $ignorepagination, $sortorder, $sortdirection, $sticky);
    } else {
        return $_zp_zenpage->getArticles($articles_per_page, $category, $published, $ignorepagination, $sortorder, $sortdirection, $sticky);
    }
}