本文整理汇总了PHP中PageModel::isPublished方法的典型用法代码示例。如果您正苦于以下问题:PHP PageModel::isPublished方法的具体用法?PHP PageModel::isPublished怎么用?PHP PageModel::isPublished使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PageModel
的用法示例。
在下文中一共展示了PageModel::isPublished方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: sitemap
public function sitemap(){
$view = $this->getView();
$req = $this->getPageRequest();
// Give me every registered (public) page!
$factory = new ModelFactory('PageModel');
$factory->where('indexable = 1');
$factory->order('title');
// Multisite?
if(Core::IsComponentAvailable('multisite') && MultiSiteHelper::IsEnabled()){
$factory->whereGroup(
'OR',
array(
'site = ' . MultiSiteHelper::GetCurrentSiteID(),
'site = -1'
)
);
$site = MultiSiteHelper::GetCurrentSiteID();
}
else{
$site = null;
}
// Run this through the streamer, just in case there are a lot of pages...
$stream = new \Core\Datamodel\DatasetStream($factory->getDataset());
$user = \Core\user();
$toshow = array();
while(($record = $stream->getRecord())){
if(!$user->checkAccess( $record['access'] )){
// Skip any further operations if the user does not have access to this page
continue;
}
if($record['published_status'] != 'published'){
// Skip any further operations if the page isn't even marked as published.
continue;
}
$page = new PageModel();
$page->_loadFromRecord($record);
if(!$page->isPublished()){
// Skip out if the page is not marked as published.
// This has extended checks other than simply if the status is set as "published",
// such as publish date and expiration date.
continue;
}
$toshow[] = $page;
}
// Anything else?
$extra = HookHandler::DispatchHook('/sitemap/getlisting');
$toshow = array_merge($toshow, $extra);
// This page allows for a few content types.
switch($req->ctype){
case View::CTYPE_XML:
$view->contenttype = View::CTYPE_XML;
break;
case View::CTYPE_HTML:
$view->contenttype = View::CTYPE_HTML;
break;
}
$view->title = 'Sitemap';
$view->assign('pages', $toshow);
$view->assign('site', $site);
}