/**
* Get all searchable pages and return them as array
*
* @param integer $pid
* @param string $domain
* @param boolean $blnIsSitemap
*
* @return array
*/
public static function findSearchablePages($pid = 0, $domain = '', $blnIsSitemap = false)
{
$objPages = \PageModel::findPublishedByPid($pid, array('ignoreFePreview' => true));
if ($objPages === null) {
return array();
}
$arrPages = array();
// Recursively walk through all subpages
foreach ($objPages as $objPage) {
if ($objPage->type == 'regular') {
// Searchable and not protected
if ((!$objPage->noSearch || $blnIsSitemap) && (!$objPage->protected || \Config::get('indexProtected') && (!$blnIsSitemap || $objPage->sitemap == 'map_always')) && (!$blnIsSitemap || $objPage->sitemap != 'map_never')) {
$arrPages[] = $objPage->getAbsoluteUrl();
// Get articles with teaser
if (($objArticles = \ArticleModel::findPublishedWithTeaserByPid($objPage->id, array('ignoreFePreview' => true))) !== null) {
foreach ($objArticles as $objArticle) {
$arrPages[] = $objPage->getAbsoluteUrl('/articles/' . ($objArticle->alias ?: $objArticle->id));
}
}
}
}
// Get subpages
if ((!$objPage->protected || \Config::get('indexProtected')) && ($arrSubpages = static::findSearchablePages($objPage->id, $domain, $blnIsSitemap))) {
$arrPages = array_merge($arrPages, $arrSubpages);
}
}
return $arrPages;
}