本文整理匯總了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;
}