/** * Gets the latest news either only news articles or with the latest images or albums * * NOTE: This function excludes articles that are password protected via a category for not logged in users! * * @param int $number The number of news items to get * @param string $category Optional news articles by category (only "none" option) * @param bool $sticky place sticky articles at the front of the list * @param string $sortdirection 'asc' ascending otherwise descending * @return array */ function getLatestNews($number = 2, $category = '', $sticky = true, $sortdirection = 'desc') { global $_zp_zenpage, $_zp_current_zenpage_news; //check if things are deprecated $args = func_get_args(); $deprecated = array("none", "with_latest_images", "with_latest_images_date", "with_latest_images_mtime", "with_latest_images_publishdate", "with_latest_albums", "with_latest_albums_date", "with_latest_albums_mtime", "with_latest_albums_publishdate", "with_latestupdated_albums"); if (in_array($category, $deprecated)) { // there must be the old options parameter! Zenpage_internal_deprecations::getLatestNews(); list($number, $category, $sticky, $sortdirection) = array_merge($args, array(NULL, NULL, NULL, NULL, NULL)); } $sortdir = strtolower($sortdirection) != 'asc'; if (empty($category)) { $latest = $_zp_zenpage->getArticles($number, NULL, true, NULL, $sortdir, $sticky, NULL); } else { $catobj = new ZenpageCategory($category); $latest = $catobj->getArticles($number, NULL, true, NULL, $sortdir, $sticky); } return $latest; }