Esempio n. 1
0
} 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 
Esempio n. 2
0
/**
 * Returns the News category title or catlink (name) or the mode (all news or category only) for the Zenpage news feed.
 *
 * @param string $arrayfield "catlink", "catttitle" or "option"
 * @return string
 */
function getRSSNewsCatOptions($arrayfield)
{
    $arrayfield = sanitize($arrayfield);
    if (!empty($arrayfield)) {
        if (isset($_GET['category'])) {
            $catlink = sanitize($_GET['category']);
            $catobj = new ZenpageCategory($catlink);
            $cattitle = html_encode($catobj->getTitle());
            $option = "category";
        } else {
            $catlink = "";
            $cattitle = "";
            $option = "news";
        }
        $array = array("catlink" => $catlink, "cattitle" => $cattitle, "option" => $option);
        return $array[$arrayfield];
    }
}
/**
 * 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 
}
/**
 * Gets the category title of a category
 *
 * @param string $catlink the categorylink of the category
 * @return string
 * @deprecated
 */
function getCategoryTitle($catlink)
{
    deprecated_function_notify(gettext('Use instead the Zenpage category class method getTitle().'), E_USER_NOTICE);
    $catobj = new ZenpageCategory($catlink);
    return $catobj->getTitle();
}
Esempio n. 5
0
            printf(gettext('Page <em>%s</em> not found'), html_encode(sanitize($_GET['titlelink'])));
            ?>
</h1>
								<?php 
        }
        ?>
						</div>
						<?php 
    } else {
        if (is_AdminEditPage('newsarticle')) {
            ?>
							<h1><?php 
            echo gettext('Edit Article:');
            ?>
 <em><?php 
            checkForEmptyTitle($result->getTitle(), 'news', false);
            ?>
</em></h1>
							<?php 
            if ($result->getDatetime() >= date('Y-m-d H:i:s')) {
                echo '<small><strong id="scheduldedpublishing">' . gettext('(Article scheduled for publishing)') . '</strong></small>';
                if ($result->getShow() != 1) {
                    echo '<p class="scheduledate"><small>' . gettext('<strong>Note:</strong> Scheduled publishing is not active unless the article is also set to <em>published</em>') . '</small></p>';
                }
            }
            if ($result->inProtectedCategory()) {
                echo '<p class="notebox">' . gettext('<strong>Note:</strong> This article belongs to a password protected category.') . '</p>';
            }
        }
        if (is_AdminEditPage('newscategory')) {
            ?>
Esempio n. 6
0
/**
 * Prints the categories of current article as a unordered html list WITHOUT links
 *
 * @param string $separator A separator to be shown between the category names if you choose to style the list inline
 */
function jqm_printNewsCategories($separator = '', $class = '')
{
    $categories = getNewsCategories();
    $catcount = count($categories);
    if ($catcount != 0) {
        echo "<ul class=\"{$class}\">\n";
        $count = 0;
        foreach ($categories as $cat) {
            $count++;
            $catobj = new ZenpageCategory($cat['titlelink']);
            if ($count >= $catcount) {
                $separator = "";
            }
            echo "<li>" . $catobj->getTitle() . "</li>\n";
        }
        echo "</ul>\n";
    }
}
Esempio n. 7
0
} else {
    echo "<div style='text-align: left; width 450px; font-size:0.8em'>";
    if (isset($_GET['news'])) {
        $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 -->
/**
 * Prints all available pages or categories in Zenpage
 *
 * @return string
 */
function printAllNestedList()
{
    global $_zp_zenpage, $host;
    if (isset($_GET['zenpage']) && ($_GET['zenpage'] == "pages" || $_GET['zenpage'] == "categories")) {
        $mode = sanitize($_GET['zenpage']);
        switch ($mode) {
            case 'pages':
                $items = $_zp_zenpage->getPages(false);
                $listtitle = gettext('Pages');
                break;
            case 'categories':
                $items = $_zp_zenpage->getAllCategories(false);
                $listtitle = gettext('Categories');
                break;
        }
        echo "<h3 style='margin-bottom:10px;'>Zenpage: <em>" . html_encode($listtitle) . "</em> <small> " . gettext("(Click on article title to include a link)") . "</small></h3>";
        echo "<ul style='list-style: none; margin: 5px 0px 0px -10px;'>";
        $indent = 1;
        $open = array(1 => 0);
        $rslt = false;
        foreach ($items as $key => $item) {
            $itemcss = "padding: 5px 0px 5px 0px;";
            switch ($mode) {
                case 'pages':
                    $obj = new ZenpagePage($item['titlelink']);
                    $itemcontent = truncate_string(strip_tags($obj->getContent()), 300);
                    $zenpagepage = 'pages/' . $item['titlelink'];
                    $unpublished = unpublishedZenpageItemCheck($obj);
                    $counter = '';
                    break;
                case 'categories':
                    $obj = new ZenpageCategory($item['titlelink']);
                    $itemcontent = $obj->getTitle();
                    $zenpagepage = "news/category/" . $item['titlelink'];
                    $unpublished = unpublishedZenpageItemCheck($obj);
                    $counter = ' (' . count($obj->getArticles()) . ') ';
                    break;
            }
            $itemsortorder = $obj->getSortOrder();
            $itemtitlelink = $obj->getTitlelink();
            $itemtitle = $obj->getTitle();
            $itemid = $obj->getID();
            $order = explode('-', $itemsortorder);
            $level = max(1, count($order));
            if ($toodeep = $level > 1 && $order[$level - 1] === '') {
                $rslt = true;
            }
            if ($level > $indent) {
                echo "\n" . str_pad("\t", $indent, "\t") . "<ul style='margin:6px 0px 0px -10px;'>\n";
                $indent++;
                $open[$indent] = 0;
            } else {
                if ($level < $indent) {
                    while ($indent > $level) {
                        $open[$indent]--;
                        $indent--;
                        echo "</li>\n" . str_pad("\t", $indent, "\t") . "</ul>\n";
                    }
                } else {
                    // indent == level
                    if ($open[$indent]) {
                        echo str_pad("\t", $indent, "\t") . "</li>\n";
                        $open[$indent]--;
                    } else {
                        echo "\n";
                    }
                }
            }
            if ($open[$indent]) {
                echo str_pad("\t", $indent, "\t") . "</li>\n";
                $open[$indent]--;
            }
            echo "<li id='" . $itemid . "' style='list-style: none; padding: 4px 0px 4px 0px;border-top: 1px dotted gray'>";
            echo "<a href=\"javascript:ZenpageDialog.insert('" . $zenpagepage . "','" . $itemtitlelink . "','" . html_encode($itemtitle) . "','','','" . $mode . "','','','','');\" title='" . html_encode($itemcontent) . "'>" . html_encode($itemtitle) . $unpublished . $counter . "</a> <small><em>" . $obj->getDatetime() . "</em></small>";
            if ($mode == 'pages') {
                echo " <a href='zoom.php?pages=" . urlencode($itemtitlelink) . "' title='Zoom' class='colorbox' style='outline: none;'><img src='img/magnify.png' alt='' style='border: 0' /></a>";
            }
            $open[$indent]++;
        }
        while ($indent > 1) {
            echo "</li>\n";
            $open[$indent]--;
            $indent--;
            echo str_pad("\t", $indent, "\t") . "</ul>";
        }
        if ($open[$indent]) {
            echo "</li>\n";
        } else {
            echo "\n";
        }
        echo "</ul>\n";
    }
}
Esempio n. 9
0
 function __construct($options)
 {
     $this->options = $options;
     if (isset($this->options['lang'])) {
         $this->locale = $this->options['lang'];
     } else {
         $this->locale = getOption('locale');
     }
     $this->locale_xml = strtr($this->locale, '_', '-');
     if (isset($this->options['sortdir'])) {
         $this->sortdirection = strtolower($this->options['sortdir']) != 'asc';
     } else {
         $this->sortdirection = true;
     }
     if (isset($this->options['sortorder'])) {
         $this->sortorder = $this->options['sortorder'];
     } else {
         $this->sortorder = NULL;
     }
     switch ($this->feedtype) {
         case 'comments':
             if (isset($this->options['type'])) {
                 $this->commentfeedtype = $this->options['type'];
             } else {
                 $this->commentfeedtype = 'all';
             }
             if (isset($this->options['id'])) {
                 $this->id = (int) $this->options['id'];
             }
             break;
         case 'gallery':
             if (isset($this->options['albumsmode'])) {
                 $this->mode = 'albums';
             }
             if (isset($this->options['folder'])) {
                 $this->albumfolder = $this->options['folder'];
                 $this->collection = true;
             } else {
                 if (isset($this->options['albumname'])) {
                     $this->albumfolder = $this->options['albumname'];
                     $this->collection = false;
                 } else {
                     $this->collection = false;
                 }
             }
             if (is_null($this->sortorder)) {
                 if ($this->mode == "albums") {
                     $this->sortorder = getOption($this->feed . "_sortorder_albums");
                 } else {
                     $this->sortorder = getOption($this->feed . "_sortorder");
                 }
             }
             break;
         case 'news':
             if ($this->sortorder == 'latest') {
                 $this->sortorder = NULL;
             }
             if (isset($this->options['category'])) {
                 $this->catlink = $this->options['category'];
                 $catobj = new ZenpageCategory($this->catlink);
                 $this->cattitle = $catobj->getTitle();
                 $this->newsoption = 'category';
             } else {
                 $this->catlink = '';
                 $this->cattitle = '';
                 $this->newsoption = 'news';
             }
             break;
         case 'pages':
             break;
         case 'null':
             //we just want the class instantiated
             return;
     }
     if (isset($this->options['itemnumber'])) {
         $this->itemnumber = (int) $this->options['itemnumber'];
     } else {
         $this->itemnumber = getOption($this->feed . '_items');
     }
 }
/**
* Prints all available articles or categories in Zenpage
*
* @param string $current

 set to category selected (if any)
*
* @return string
*/
function printZenpageNewsCategorySelector($current)
{
    global $_zp_gallery, $_zp_zenpage;
    ?>
	<select id="categoryselector" name="categoryselect">
		<?php 
    $cats = $_zp_zenpage->getAllCategories(false);
    foreach ($cats as $cat) {
        if ($cat['titlelink'] == $current) {
            $selected = ' selected="selected"';
        } else {
            $selected = '';
        }
        $catobj = new ZenpageCategory($cat['titlelink']);
        //This is much easier than hacking the nested list function to work with this
        $getparents = $catobj->getParents();
        $levelmark = '';
        foreach ($getparents as $parent) {
            $levelmark .= '» ';
        }
        echo "<option value = '" . html_encode($catobj->getTitlelink()) . "'" . $selected . '>';
        echo $levelmark . $catobj->getTitle() . "</option>";
    }
    ?>
	</select>
	<?php 
}
Esempio n. 11
0
/**
 * 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 parent items breadcrumb navigation for pages or categories
 *
 * @param string $mode '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(getPageLinkURL($item));
            $parentitemtitle = $pageobj->getTitle();
        }
        if (is_NewsCategory()) {
            $catobj = new ZenpageCategory($item);
            $parentitemurl = getNewsCategoryURL($item);
            $parentitemtitle = $catobj->getTitle();
        }
        echo $before . "<a href='" . $parentitemurl . "'>" . $parentitemtitle . "</a>" . $after;
    }
}
Esempio n. 13
0
        ?>
"><?php 
        echo $h4;
        ?>
</a></li>
		<?php 
    } else {
        unset($cats[$key]);
    }
}
?>
</ol>
<?php 
foreach ($cats as $cat) {
    $catobj = new ZenpageCategory($cat);
    $h4 = $catobj->getTitle();
    ?>
	<h4><a name="<?php 
    echo $catobj->getTitlelink();
    ?>
"></a><?php 
    echo $h4;
    ?>
</h4>
	<?php 
    listArticles($catobj);
}
function listArticles($cat)
{
    global $counter;
    global $_zp_current_category;
Esempio n. 14
0
 /**
  * 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 getItemNews($item)
 {
     $categories = '';
     $feeditem['enclosure'] = '';
     $obj = new ZenpageNews($item['titlelink']);
     $title = $feeditem['title'] = get_language_string($obj->getTitle('all'), $this->locale);
     $link = $obj->getLink();
     $count2 = 0;
     $plaincategories = $obj->getCategories();
     $categories = '';
     foreach ($plaincategories as $cat) {
         $catobj = new ZenpageCategory($cat['titlelink']);
         $categories .= get_language_string($catobj->getTitle('all'), $this->locale) . ', ';
     }
     $categories = rtrim($categories, ', ');
     $desc = $obj->getContent($this->locale);
     $desc = str_replace('//<![CDATA[', '', $desc);
     $desc = str_replace('//]]>', '', $desc);
     $feeditem['desc'] = shortenContent($desc, getOption('externalFeed_truncate_length'), '...');
     if (!empty($categories)) {
         $feeditem['category'] = html_encode($categories);
         $feeditem['title'] = $title . ' (' . $categories . ')';
     }
     $feeditem['link'] = $link;
     $feeditem['media_content'] = '';
     $feeditem['media_thumbnail'] = '';
     $feeditem['pubdate'] = date("r", strtotime($obj->getDateTime()));
     return $feeditem;
 }
Esempio n. 15
0
    if (is_AdminEditPage('page')) {
        ?>
			<h1><?php 
        echo gettext('New Page');
        ?>
</h1>
		<?php 
    }
} else {
    if (is_AdminEditPage('newsarticle')) {
        ?>
			<h1><?php 
        echo gettext('Edit Article:');
        ?>
 <em><?php 
        checkForEmptyTitle($result->getTitle(), 'news', false);
        ?>
</em></h1>
			<?php 
        if ($result->getDatetime() >= date('Y-m-d H:i:s')) {
            echo '<small><strong id="scheduldedpublishing">' . gettext('(Article scheduled for publishing)') . '</strong></small>';
            if ($result->getShow() != 1) {
                echo '<p class="scheduledate"><small>' . gettext('<strong>Note:</strong> Scheduled publishing is not active unless the article is also set to <em>published</em>') . '</small></p>';
            }
        }
        if ($result->inProtectedCategory() && GALLERY_SECURITY != 'private') {
            echo '<p class="notebox">' . gettext('<strong>Note:</strong> This article belongs to a password protected category.') . '</p>';
        }
    }
    if (is_AdminEditPage('category')) {
        ?>
/**
 * 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>';
        }
    }
}
Esempio n. 17
0
function printLatestNewsCustom($number = 5, $category = '', $showdate = true, $showcontent = true, $contentlength = 70, $showcat = true)
{
    global $_zp_gallery, $_zp_current_zenpage_news;
    $latest = getLatestNews($number, $category);
    echo "\n<div class=\"latestnews-spotlight\">\n";
    $count = "";
    foreach ($latest as $item) {
        $count++;
        $category = "";
        $categories = "";
        $obj = new ZenpageNews($item['titlelink']);
        $title = htmlspecialchars($obj->getTitle());
        $link = getNewsURL($item['titlelink']);
        $count2 = 0;
        $category = $obj->getCategories();
        foreach ($category as $cat) {
            $catobj = new ZenpageCategory($cat['titlelink']);
            $count2++;
            if ($count2 != 1) {
                $categories = $categories . "; ";
            }
            $categories = $categories . $catobj->getTitle();
        }
        $content = strip_tags($obj->getContent());
        $date = zpFormattedDate(getOption('date_format'), strtotime($item['date']));
        $type = 'news';
        echo "<div>";
        echo "<h3><a href=\"" . $link . "\" title=\"" . strip_tags(htmlspecialchars($title, ENT_QUOTES)) . "\">" . htmlspecialchars($title) . "</a></h3>\n";
        echo "<div class=\"newsarticlecredit\">\n";
        echo "<span class=\"latestnews-date\">" . $date . "</span>\n";
        echo "<span class=\"latestnews-cats\">| Posted in " . $categories . "</span>\n";
        echo "</div>\n";
        echo "<p class=\"latestnews-desc\">" . html_encode(getContentShorten($content, $contentlength, '(...)', null, null)) . "</p>\n";
        echo "</div>\n";
        if ($count == $number) {
            break;
        }
    }
    echo "</div>\n";
}