本文整理汇总了PHP中PageModel::findPublishedRootPages方法的典型用法代码示例。如果您正苦于以下问题:PHP PageModel::findPublishedRootPages方法的具体用法?PHP PageModel::findPublishedRootPages怎么用?PHP PageModel::findPublishedRootPages使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PageModel
的用法示例。
在下文中一共展示了PageModel::findPublishedRootPages方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getDomains
/**
* Retreives all available domains in this installation (plus empty selection)
*
* @return array
*/
public function getDomains()
{
// options array
$options = array('' => $GLOBALS['TL_LANG']['tl_short_urls']['noDomain']);
// get the root pages and their dns settings
if (version_compare(VERSION, '3.5', '>=')) {
if (($objPages = \PageModel::findPublishedRootPages()) !== null) {
while ($objPages->next()) {
if ($objPages->dns) {
$options[$objPages->id] = $objPages->dns;
}
}
}
} else {
$t = \PageModel::getTable();
$arrColumns = array("{$t}.type=?");
if (!BE_USER_LOGGED_IN) {
$time = time();
$arrColumns[] = "({$t}.start='' OR {$t}.start<='{$time}') AND ({$t}.stop='' OR {$t}.stop>'" . ($time + 60) . "') AND {$t}.published='1'";
}
$objPages = \PageModel::findBy($arrColumns, 'root');
if ($objPages !== null) {
while ($objPages->next()) {
if ($objPages->dns) {
$options[$objPages->id] = $objPages->dns;
}
}
}
}
// return the options
return $options;
}
示例2: generateConfigCache
/**
* Create the config cache files
*/
public function generateConfigCache()
{
// Generate the class/template laoder cache file
$objCacheFile = new \File('system/cache/config/autoload.php', true);
$objCacheFile->write('<?php ');
// add one space to prevent the "unexpected $end" error
foreach (\ModuleLoader::getActive() as $strModule) {
$strFile = 'system/modules/' . $strModule . '/config/autoload.php';
if (file_exists(TL_ROOT . '/' . $strFile)) {
$objCacheFile->append(static::readPhpFileWithoutTags($strFile));
}
}
// Close the file (moves it to its final destination)
$objCacheFile->close();
// Generate the module loader cache file
$objCacheFile = new \File('system/cache/config/modules.php', true);
$objCacheFile->write("<?php\n\n");
$objCacheFile->append(sprintf("static::\$active = %s;\n", var_export(\ModuleLoader::getActive(), true)));
$objCacheFile->append(sprintf("static::\$disabled = %s;", var_export(\ModuleLoader::getDisabled(), true)));
// Close the file (moves it to its final destination)
$objCacheFile->close();
// Generate the config cache file
$objCacheFile = new \File('system/cache/config/config.php', true);
$objCacheFile->write('<?php ');
// add one space to prevent the "unexpected $end" error
foreach (\ModuleLoader::getActive() as $strModule) {
$strFile = 'system/modules/' . $strModule . '/config/config.php';
if (file_exists(TL_ROOT . '/' . $strFile)) {
$objCacheFile->append(static::readPhpFileWithoutTags($strFile));
}
}
// Close the file (moves it to its final destination)
$objCacheFile->close();
// Generate the page mapping array
$arrMapper = array();
$objPages = \PageModel::findPublishedRootPages();
if ($objPages !== null) {
while ($objPages->next()) {
$strBase = $objPages->dns ?: '*';
if ($objPages->fallback) {
$arrMapper[$strBase . '/empty.fallback'] = $strBase . '/empty.' . $objPages->language;
}
$arrMapper[$strBase . '/empty.' . $objPages->language] = $strBase . '/empty.' . $objPages->language;
}
}
// Generate the page mapper file
$objCacheFile = new \File('system/cache/config/mapping.php', true);
$objCacheFile->write(sprintf("<?php\n\nreturn %s;\n", var_export($arrMapper, true)));
$objCacheFile->close();
// Add a log entry
$this->log('Generated the config cache', __METHOD__, TL_CRON);
}
示例3: getSearchablePages
public function getSearchablePages($arrPages, $intRootId = null, $bln = true, $strLanguage = null)
{
if (!$intRootId) {
$objRoots = \PageModel::findPublishedRootPages();
if (!$objRoots) {
\System::log("Can't get any root page", __METHOD__, TL_ERROR);
return $arrPages;
}
while ($objRoots->next()) {
$arrPages = $this->getSearchablePages($arrPages, $objRoots->id, $bln, $objRoots->language);
}
return $arrPages;
}
// get the root page object
$objRoot = \PageModel::findByPk($intRootId);
if (!$objRoot) {
\System::log("Can't get the root page", __METHOD__, TL_ERROR);
return $arrPages;
}
// check for sitemap enabled
if (!$objRoot->anystores_sitemap) {
return $arrPages;
}
// get the domain
$strDomain = ($objRoot->useSSL ? 'https://' : 'http://') . ($objRoot->dns ?: \Environment::get('host')) . TL_PATH . '/';
// get the details page
$objPage = \PageModel::findByPk($objRoot->anystores_detailPage);
if (!$objPage) {
\System::log("Can't find the details page", __METHOD__, TL_ERROR);
return $arrPages;
}
// get the locations
$objLocations = AnyStoresModel::findPublishedByCategory(deserialize($objRoot->anystores_categories));
if (!$objLocations) {
\System::log("Can't get the published locations", __METHOD__, TL_ERROR);
return $arrPages;
}
while ($objLocations->next()) {
$strAlias = \Controller::generateFrontendUrl($objLocations->row(), null, $strLanguage);
$arrPages[] = $strDomain . $objPage->alias . '/' . $strAlias;
}
return $arrPages;
}