code
stringlengths
31
1.39M
docstring
stringlengths
23
16.8k
func_name
stringlengths
1
126
language
stringclasses
1 value
repo
stringlengths
7
63
path
stringlengths
7
166
url
stringlengths
50
220
license
stringclasses
7 values
public function displayItem() { $controller = new PageRelations(); $controller->setPageObject($this->page); return $controller->canAccessPanel(); }
Determine whether item should be displayed @return bool
displayItem
php
concretecms/concretecms
concrete/src/Page/Relation/Menu/Item/RelationListController.php
https://github.com/concretecms/concretecms/blob/master/concrete/src/Page/Relation/Menu/Item/RelationListController.php
MIT
public static function getCollectionVersionStatus($c) { $cvStatus = ''; $app = Application::getFacadeApplication(); $now = $app->make('date')->getOverridableNow(); $vObj = $c->getVersionObject(); if ($vObj) { if ($vObj->isApproved() && (!$vObj->getPublishDate() || $vObj->getPublishDate() <= $now) && (!$vObj->getPublishEndDate() || $vObj->getPublishEndDate() >= $now)) { $cvStatus = t('Approved'); } elseif ($vObj->isApproved() && ($vObj->getPublishDate() && $vObj->getPublishDate() > $now)) { $cvStatus = t('Scheduled'); } elseif (!$vObj->isApproved()) { $cvStatus = t('Unapproved'); } } return $cvStatus; }
@see \Concrete\Core\Page\Collection\Version\Version::get() @param \Concrete\Core\Page\Page $c @return string
getCollectionVersionStatus
php
concretecms/concretecms
concrete/src/Page/Search/ColumnSet/Available.php
https://github.com/concretecms/concretecms/blob/master/concrete/src/Page/Search/ColumnSet/Available.php
MIT
public function getColumnValue($page) { $template = $page->getPageTemplateObject(); if ($template) { return $template->getPageTemplateDisplayName(); } return ''; }
@param Page $page @return false|mixed|void
getColumnValue
php
concretecms/concretecms
concrete/src/Page/Search/ColumnSet/Column/PageTemplateColumn.php
https://github.com/concretecms/concretecms/blob/master/concrete/src/Page/Search/ColumnSet/Column/PageTemplateColumn.php
MIT
public function getColumnValue($page) { $path = $page->getCollectionPath(); return $path; }
@param Page $page @return false|mixed|void
getColumnValue
php
concretecms/concretecms
concrete/src/Page/Search/ColumnSet/Column/UrlPathColumn.php
https://github.com/concretecms/concretecms/blob/master/concrete/src/Page/Search/ColumnSet/Column/UrlPathColumn.php
MIT
public function filterList(ItemList $list) { if ($this->getData('includeAliases') === '1') { $list->includeAliases(); } }
@param \Concrete\Core\Page\PageList $list
filterList
php
concretecms/concretecms
concrete/src/Page/Search/Field/Field/IncludePageAliasesField.php
https://github.com/concretecms/concretecms/blob/master/concrete/src/Page/Search/Field/Field/IncludePageAliasesField.php
MIT
public function filterList(ItemList $list) { if ($this->getData('includeSystemPages') === '1') { $list->includeSystemPages(); } }
@param \Concrete\Core\Page\PageList $list
filterList
php
concretecms/concretecms
concrete/src/Page/Search/Field/Field/IncludeSystemPagesField.php
https://github.com/concretecms/concretecms/blob/master/concrete/src/Page/Search/Field/Field/IncludeSystemPagesField.php
MIT
public function getKey() { return 'site_locale'; }
{@inheritdoc} @see \Concrete\Core\Search\Field\FieldInterface::getKey()
getKey
php
concretecms/concretecms
concrete/src/Page/Search/Field/Field/SiteLocaleField.php
https://github.com/concretecms/concretecms/blob/master/concrete/src/Page/Search/Field/Field/SiteLocaleField.php
MIT
public function getDisplayName() { return t('Locale'); }
{@inheritdoc} @see \Concrete\Core\Search\Field\FieldInterface::getDisplayName()
getDisplayName
php
concretecms/concretecms
concrete/src/Page/Search/Field/Field/SiteLocaleField.php
https://github.com/concretecms/concretecms/blob/master/concrete/src/Page/Search/Field/Field/SiteLocaleField.php
MIT
public function filterList(ItemList $list) { $localeID = $this->getData('localeID'); $app = Facade::getFacadeApplication(); if (isset($this->data['localeID']) && $this->getData('localeID') !== '') { $em = $app->make(EntityManager::class); $selectedLocale = $em->find(Locale::class, $this->getData('localeID')); $list->setSiteTreeObject($selectedLocale->getSiteTree()); } }
{@inheritdoc} @see \Concrete\Core\Search\Field\FieldInterface::filterList()
filterList
php
concretecms/concretecms
concrete/src/Page/Search/Field/Field/SiteLocaleField.php
https://github.com/concretecms/concretecms/blob/master/concrete/src/Page/Search/Field/Field/SiteLocaleField.php
MIT
public function renderSearchField() { $app = Facade::getFacadeApplication(); $selectedLocale = null; if (isset($this->data['localeID']) && $this->getData('localeID') !== '') { $em = $app->make(EntityManager::class); $selectedLocale = $em->find(Locale::class, $this->getData('localeID')); } $site = $app->make('site')->getActiveSiteForEditing(); $selector = new SiteLocaleSelector(); print $selector->selectLocale('localeID', $site, $selectedLocale); }
{@inheritdoc} @see \Concrete\Core\Search\Field\AbstractField::renderSearchField()
renderSearchField
php
concretecms/concretecms
concrete/src/Page/Search/Field/Field/SiteLocaleField.php
https://github.com/concretecms/concretecms/blob/master/concrete/src/Page/Search/Field/Field/SiteLocaleField.php
MIT
public function clear() { // Truncate the existing search index $database = $this->app['database']->connection(); if ($database->tableExists('PageSearchIndex')) { $database->Execute('truncate table PageSearchIndex'); } if ($database->tableExists('CollectionSearchIndexAttributes')) { $database->Execute('truncate table CollectionSearchIndexAttributes'); } }
Clear out all indexed items @return void
clear
php
concretecms/concretecms
concrete/src/Page/Search/Index/PageIndex.php
https://github.com/concretecms/concretecms/blob/master/concrete/src/Page/Search/Index/PageIndex.php
MIT
public function __construct(IndexedSearch $search) { $this->search = $search; }
DefaultPageDriver constructor. @param \Concrete\Core\Page\Search\IndexedSearch $search
__construct
php
concretecms/concretecms
concrete/src/Page/Search/Index/PageIndexer.php
https://github.com/concretecms/concretecms/blob/master/concrete/src/Page/Search/Index/PageIndexer.php
MIT
public function index($page) { if ($page = $this->getPage($page)) { $this->search->reindexPage($page); } return false; }
Add a page to the index @param string|int|Page $page Page to index. String is path, int is cID @return bool Success or fail
index
php
concretecms/concretecms
concrete/src/Page/Search/Index/PageIndexer.php
https://github.com/concretecms/concretecms/blob/master/concrete/src/Page/Search/Index/PageIndexer.php
MIT
public function forget($page) { if ($page = $this->getPage($page)) { /** @todo Implement forgetting pages completely */ /** @var Connection $database */ $database = $this->app['database']->connection(); $database->executeQuery('DELETE FROM PageSearchIndex WHERE cID=?', [$page->getCollectionID()]); } return false; }
Remove a page from the index @param string|int|Page $page. String is path, int is cID @return bool Success or fail
forget
php
concretecms/concretecms
concrete/src/Page/Search/Index/PageIndexer.php
https://github.com/concretecms/concretecms/blob/master/concrete/src/Page/Search/Index/PageIndexer.php
MIT
protected function getPage($page) { // Handle passed cID if (is_numeric($page)) { return Page::getByID($page, 'ACTIVE'); } // Handle passed /path/to/collection if (is_string($page)) { return Page::getByPath($page, 'ACTIVE'); } // If it's a page, just return the page if ($page instanceof Page) { return $page; } // If it's not a page, but it's a collection, lets try getting a page by id if ($page instanceof Collection) { return $this->getPage($page->getCollectionID()); } return null; }
Get a page based on criteria @param string|int|Page|Collection $page @return \Concrete\Core\Page\Page|null
getPage
php
concretecms/concretecms
concrete/src/Page/Search/Index/PageIndexer.php
https://github.com/concretecms/concretecms/blob/master/concrete/src/Page/Search/Index/PageIndexer.php
MIT
public function canIncludePageInSitemap(Page $page) { $dc = $this->deprecatedChecker; return $dc($page, $this->getInstances()); }
{@inheritdoc} @see \Concrete\Core\Page\Sitemap\PageListGenerator::canIncludePageInSitemap()
canIncludePageInSitemap
php
concretecms/concretecms
concrete/src/Page/Sitemap/DeprecatedPageListGenerator.php
https://github.com/concretecms/concretecms/blob/master/concrete/src/Page/Sitemap/DeprecatedPageListGenerator.php
MIT
public function __construct(Application $app, Request $request) { $this->app = $app; $this->request = $request; $this->initializeDragMode(); $this->initializeDestinationPages(); $this->initializeOriginalPages(); }
@param Request $request @param Application $app @throws \Concrete\Core\Error\UserMessageException
__construct
php
concretecms/concretecms
concrete/src/Page/Sitemap/DragRequestData.php
https://github.com/concretecms/concretecms/blob/master/concrete/src/Page/Sitemap/DragRequestData.php
MIT
public function getDestinationSibling() { return $this->destinationSibling; }
@return \Concrete\Core\Page\Page|null
getDestinationSibling
php
concretecms/concretecms
concrete/src/Page/Sitemap/DragRequestData.php
https://github.com/concretecms/concretecms/blob/master/concrete/src/Page/Sitemap/DragRequestData.php
MIT
public function getSingleOriginalPage() { $originalPages = $this->getOriginalPages(); return count($originalPages) === 1 ? $originalPages[0] : null; }
Get a Page instance if and only if there's just one original page. @return \Concrete\Core\Page\Page|null
getSingleOriginalPage
php
concretecms/concretecms
concrete/src/Page/Sitemap/DragRequestData.php
https://github.com/concretecms/concretecms/blob/master/concrete/src/Page/Sitemap/DragRequestData.php
MIT
public function canDo($operation) { return $this->whyCantDo($operation) === ''; }
Check if an operation can be performed. @param string $operation The value of one of the OPERATION_... constants @return bool
canDo
php
concretecms/concretecms
concrete/src/Page/Sitemap/DragRequestData.php
https://github.com/concretecms/concretecms/blob/master/concrete/src/Page/Sitemap/DragRequestData.php
MIT
public function canDoAnyOf(array $operations) { foreach ($operations as $operation) { if ($this->canDo($operation)) { return true; } } return false; }
Check if at least one operation can be performed. @param string[] $operations The values of one of the OPERATION_... constants @return bool
canDoAnyOf
php
concretecms/concretecms
concrete/src/Page/Sitemap/DragRequestData.php
https://github.com/concretecms/concretecms/blob/master/concrete/src/Page/Sitemap/DragRequestData.php
MIT
public function whyCantDo($operation) { if (!is_string($operation)) { return 'Invalid $operation'; } if (!isset($this->operationErrors[$operation])) { switch ($operation) { case static::OPERATION_MOVE: $error = $this->whyCantMove(); break; case static::OPERATION_ALIAS: $error = $this->whyCantAlias(); break; case static::OPERATION_COPY: $error = $this->whyCantCopy(); break; case static::OPERATION_COPYALL: $error = $this->whyCantDo(static::OPERATION_COPY); if ($error === '') { $error = $this->whyCantCopyAll(); } break; case static::OPERATION_COPYVERSION: $error = $this->whyCantCopyVersion(); break; default: return 'Invalid $operation'; } $this->operationErrors[$operation] = $error; } return $this->operationErrors[$operation]; }
Get the reason why an operation can't be performed. @param string $operation The value of one of the OPERATION_... constants. @return string empty string if the operation CAN be performed
whyCantDo
php
concretecms/concretecms
concrete/src/Page/Sitemap/DragRequestData.php
https://github.com/concretecms/concretecms/blob/master/concrete/src/Page/Sitemap/DragRequestData.php
MIT
protected function whyCantMove() { $destinationPageChecker = new Checker($this->getDestinationPage()); $destinationPageID = $this->getDestinationPage()->getCollectionID(); foreach ($this->getOriginalPages() as $originalPage) { if ($originalPage->getCollectionParentID() == $destinationPageID) { return t('"%1$s" is already the parent page of "%2$s".', $this->getDestinationPage()->getCollectionName(), $originalPage->getCollectionName()); } $originalPageChecker = new Checker($originalPage); if (!$originalPageChecker->canMoveOrCopyPage()) { return t('You don\'t have the permission move the page "%s".', $originalPage->getCollectionName()); } if ($originalPage->getCollectionID() == $destinationPageID) { return t('It\'s not possible to move the page "%s" under itself.', $originalPage->getCollectionName()); } if (in_array($destinationPageID, $originalPage->getCollectionChildrenArray())) { return t('It\'s not possible to move the page "%s" under one of its child pages.', $originalPage->getCollectionName()); } $originalPageType = $originalPage->getPageTypeObject(); if (!$destinationPageChecker->canAddSubpage($originalPageType)) { return t('You do not have sufficient privileges to move the page "%1$s" under "%2$s".', $originalPage->getCollectionName(), $this->getDestinationPage()->getCollectionName()); } } return ''; }
Get the reason why the move operation can't be performed. @return string empty string if the operation CAN be performed
whyCantMove
php
concretecms/concretecms
concrete/src/Page/Sitemap/DragRequestData.php
https://github.com/concretecms/concretecms/blob/master/concrete/src/Page/Sitemap/DragRequestData.php
MIT
protected function whyCantAlias() { if ($this->isSomeOriginalPageAnAlias()) { return t('It\'s not possible to create aliases of aliases.'); } if ($this->isSomeOriginalPageAnExternalLink()) { return t('It\'s not possible to create aliases of external links. Just create a new external link in the new location.'); } $destinationPageChecker = new Checker($this->getDestinationPage()); foreach ($this->getOriginalPages() as $originalPage) { $originalPageChecker = new Checker($originalPage); if (!$originalPageChecker->canMoveOrCopyPage()) { return t('You don\'t have the permission to create an alias of the page "%s".', $originalPage->getCollectionName()); } $originalPageType = $originalPage->getPageTypeObject(); if (!$destinationPageChecker->canAddSubpage($originalPageType)) { return t('You do not have sufficient privileges to alias the page "%1$s" under "%2$s".', $originalPage->getCollectionName(), $this->getDestinationPage()->getCollectionName()); } } return ''; }
Get the reason why the alias operation can't be performed. @return string empty string if the operation CAN be performed
whyCantAlias
php
concretecms/concretecms
concrete/src/Page/Sitemap/DragRequestData.php
https://github.com/concretecms/concretecms/blob/master/concrete/src/Page/Sitemap/DragRequestData.php
MIT
protected function whyCantCopy() { $destinationPageChecker = new Checker($this->getDestinationPage()); foreach ($this->getOriginalPages() as $originalPage) { $originalPageChecker = new Checker($originalPage); if (!$originalPageChecker->canMoveOrCopyPage()) { return t('You don\'t have the permission copy the page "%s".', $originalPage->getCollectionName()); } $originalPageType = $originalPage->getPageTypeObject(); if (!$destinationPageChecker->canAddSubpage($originalPageType)) { return t('You do not have sufficient privileges to copy the page "%1$s" under "%2$s".', $originalPage->getCollectionName(), $this->getDestinationPage()->getCollectionName()); } } return ''; }
Get the reason why the copy operation can't be performed. @return string empty string if the operation CAN be performed
whyCantCopy
php
concretecms/concretecms
concrete/src/Page/Sitemap/DragRequestData.php
https://github.com/concretecms/concretecms/blob/master/concrete/src/Page/Sitemap/DragRequestData.php
MIT
protected function whyCantCopyAll() { $u = $this->app->make(User::class); if (!$u->isSuperUser() && $this->isSomeOriginalPageAnAlias()) { return t('Only the administrator can copy aliased pages.'); } $destinationPageID = $this->getDestinationPage()->getCollectionID(); $somePageWithChildren = false; foreach ($this->getOriginalPages() as $originalPage) { if ($originalPage->getCollectionID() == $destinationPageID) { return t('It\'s not possible to copy the page "%s" and its child pages under the page itself.', $originalPage->getCollectionName()); } if (in_array($destinationPageID, $originalPage->getCollectionChildrenArray())) { return t('It\'s not possible to copy the page "%s" and its child pages under one of its child pages.', $originalPage->getCollectionName()); } if ($somePageWithChildren === false && !$originalPage->isAliasPageOrExternalLink() && $originalPage->getNumChildrenDirect() > 0) { $somePageWithChildren = true; } } if ($somePageWithChildren === false) { return count($this->getOriginalPages()) === 1 ? t("The page doesn't have any child pages.") : t("The pages don't have any child pages."); } return ''; }
Get the reason why the copy-all operation can't be performed (NOTE: this DOES NOT include the checks performed in the whyCantCopy() method). @return string empty string if the operation CAN be performed
whyCantCopyAll
php
concretecms/concretecms
concrete/src/Page/Sitemap/DragRequestData.php
https://github.com/concretecms/concretecms/blob/master/concrete/src/Page/Sitemap/DragRequestData.php
MIT
protected function whyCantCopyVersion() { $originalPage = $this->getSingleOriginalPage(); if ($originalPage === null) { return t("It's possible to copy just one page version at a time."); } if ($originalPage->isExternalLink()) { return t("It's not possible to copy the page version of an external URL."); } if ($originalPage->isAliasPage()) { return t("It's not possible to copy the page version of aliases."); } $destinationPage = $this->getDestinationPage(); if ($destinationPage->getCollectionID() == $originalPage->getCollectionID()) { return t("It's not possible to copy the page version of a page to the page itself."); } $pc = new Checker($destinationPage); if (!$pc->canWrite()) { return t('You don\'t have the permission to edit the contents of "%s".', $destinationPage->getCollectionName()); } return ''; }
Get the reason why the copy-version operation can't be performed. @return string empty string if the operation CAN be performed
whyCantCopyVersion
php
concretecms/concretecms
concrete/src/Page/Sitemap/DragRequestData.php
https://github.com/concretecms/concretecms/blob/master/concrete/src/Page/Sitemap/DragRequestData.php
MIT
public function __construct(Application $app) { $this->app = $app; }
Initialize the instance. @param Application $app
__construct
php
concretecms/concretecms
concrete/src/Page/Sitemap/PageListGenerator.php
https://github.com/concretecms/concretecms/blob/master/concrete/src/Page/Sitemap/PageListGenerator.php
MIT
public function getApproximatePageCount() { $siteTreeIDList = array_merge([0], $this->getSiteTreesIDList()); $connection = $this->getConnection(); $result = $connection->fetchColumn('select count(*) from Pages where siteTreeID is null or siteTreeID in (' . implode(', ', $siteTreeIDList) . ')'); return $result ?: 0; }
Get the approximage numnber of pages that will be included in the sitemap (the actual value can be lower than it). @return int
getApproximatePageCount
php
concretecms/concretecms
concrete/src/Page/Sitemap/PageListGenerator.php
https://github.com/concretecms/concretecms/blob/master/concrete/src/Page/Sitemap/PageListGenerator.php
MIT
public function generatePageList() { $this->now = new DateTime(); $siteTreeIDList = array_merge([0], $this->getSiteTreesIDList()); $connection = $this->getConnection(); $rs = $connection->executeQuery('select cID from Pages where siteTreeID is null or siteTreeID in (' . implode(', ', $siteTreeIDList) . ')'); while (($cID = $rs->fetchColumn()) !== false) { $page = Page::getByID($cID, 'ACTIVE'); if ($page && $this->canIncludePageInSitemap($page)) { yield $page; } } }
Generate the list of pages that should be included in the sitemap. @return \Concrete\Core\Page\Page|\Generator
generatePageList
php
concretecms/concretecms
concrete/src/Page/Sitemap/PageListGenerator.php
https://github.com/concretecms/concretecms/blob/master/concrete/src/Page/Sitemap/PageListGenerator.php
MIT
public function isMultilingualEnabled() { if ($this->isMultilingualEnabled === null) { $this->isMultilingualEnabled = count($this->getMultilingualSections()) > 1; } return $this->isMultilingualEnabled; }
Check if the current site has more than one multilingual section. @return bool
isMultilingualEnabled
php
concretecms/concretecms
concrete/src/Page/Sitemap/PageListGenerator.php
https://github.com/concretecms/concretecms/blob/master/concrete/src/Page/Sitemap/PageListGenerator.php
MIT
public function getMultilingualSectionForPage(Page $page) { $result = null; $siteTree = $page->getSiteTreeObject(); if ($siteTree !== null) { $homeID = $siteTree->getSiteHomePageID(); if ($homeID) { $mlSections = $this->getMultilingualSections(); if (isset($mlSections[$homeID])) { $result = $mlSections[$homeID]; } } } return $result; }
Get the multilingual section where a page resides (if any). @param \Concrete\Core\Page\Page $page @return \Concrete\Core\Multilingual\Page\Section\Section|null
getMultilingualSectionForPage
php
concretecms/concretecms
concrete/src/Page/Sitemap/PageListGenerator.php
https://github.com/concretecms/concretecms/blob/master/concrete/src/Page/Sitemap/PageListGenerator.php
MIT
public function getMultilingualSections() { if ($this->multilingualSections === null) { $site = $this->getSite(); if ($site === null) { $this->multilingualSections = []; } else { $list = []; foreach (MultilingualSection::getList($site) as $section) { $list[$section->getCollectionID()] = $section; } $this->multilingualSections = $list; } } return $this->multilingualSections; }
Get the list of multilingual sections defined for the current site. @return \Concrete\Core\Multilingual\Page\Section\Section[]
getMultilingualSections
php
concretecms/concretecms
concrete/src/Page/Sitemap/PageListGenerator.php
https://github.com/concretecms/concretecms/blob/master/concrete/src/Page/Sitemap/PageListGenerator.php
MIT
public function canIncludePageInSitemap(Page $page) { $result = false; if ($this->isPageStandard($page)) { if ($this->isPagePublished($page)) { if (!$this->isPageExcludedFromSitemap($page)) { if ($this->isPageAccessible($page)) { $result = true; } } } } return $result; }
Should a page be included in the sitemap? @param Page $page @return bool
canIncludePageInSitemap
php
concretecms/concretecms
concrete/src/Page/Sitemap/PageListGenerator.php
https://github.com/concretecms/concretecms/blob/master/concrete/src/Page/Sitemap/PageListGenerator.php
MIT
public function getSite() { if ($this->site === false) { $this->site = $this->app->make('site')->getDefault(); } return $this->site; }
Get the currently used site. @return \Concrete\Core\Entity\Site\Site|null
getSite
php
concretecms/concretecms
concrete/src/Page/Sitemap/PageListGenerator.php
https://github.com/concretecms/concretecms/blob/master/concrete/src/Page/Sitemap/PageListGenerator.php
MIT
public function setSite(Site $site) { if ($this->site !== $site) { $this->site = $site; $this->multilingualSections = null; $this->isMultilingualEnabled = null; } return $this; }
Set the currently used site. @param Site $site @return $this
setSite
php
concretecms/concretecms
concrete/src/Page/Sitemap/PageListGenerator.php
https://github.com/concretecms/concretecms/blob/master/concrete/src/Page/Sitemap/PageListGenerator.php
MIT
protected function getExcludeFromSiteMapAttributeKey() { if ($this->excludeFromSiteMapAttributeKey === false) { $category = $this->app->make(PageCategory::class); $this->excludeFromSiteMapAttributeKey = $category->getAttributeKeyByHandle('exclude_sitemapxml'); } return $this->excludeFromSiteMapAttributeKey; }
@return \Concrete\Core\Entity\Attribute\Key\PageKey|null
getExcludeFromSiteMapAttributeKey
php
concretecms/concretecms
concrete/src/Page/Sitemap/PageListGenerator.php
https://github.com/concretecms/concretecms/blob/master/concrete/src/Page/Sitemap/PageListGenerator.php
MIT
protected function getViewPagePermissionKey() { if ($this->viewPagePermissionKey === false) { $this->viewPagePermissionKey = PermissionKey::getByHandle('view_page'); } return $this->viewPagePermissionKey; }
@return \Concrete\Core\Permission\Key\PageKey|null
getViewPagePermissionKey
php
concretecms/concretecms
concrete/src/Page/Sitemap/PageListGenerator.php
https://github.com/concretecms/concretecms/blob/master/concrete/src/Page/Sitemap/PageListGenerator.php
MIT
protected function getVisitorsUserGroup() { if ($this->visitorsUserGroup === false) { $this->visitorsUserGroup = Group::getByID(GUEST_GROUP_ID); } return $this->visitorsUserGroup; }
@return \Concrete\Core\User\Group\Group|null
getVisitorsUserGroup
php
concretecms/concretecms
concrete/src/Page/Sitemap/PageListGenerator.php
https://github.com/concretecms/concretecms/blob/master/concrete/src/Page/Sitemap/PageListGenerator.php
MIT
protected function getVisitorsUserGroupAccessEntity() { if ($this->visitorsUserGroupAccessEntity === false) { $visitorsUserGroup = $this->getVisitorsUserGroup(); $ae = $visitorsUserGroup === null ? null : GroupPermissionAccessEntity::getOrCreate($visitorsUserGroup); $this->visitorsUserGroupAccessEntity = $ae ?: null; } return $this->visitorsUserGroupAccessEntity; }
@return \Concrete\Core\Permission\Access\Entity\GroupEntity|null
getVisitorsUserGroupAccessEntity
php
concretecms/concretecms
concrete/src/Page/Sitemap/PageListGenerator.php
https://github.com/concretecms/concretecms/blob/master/concrete/src/Page/Sitemap/PageListGenerator.php
MIT
protected function getConnection() { if ($this->connection === null) { $this->connection = $this->app->make(Connection::class); } return $this->connection; }
@return \Concrete\Core\Database\Connection\Connection
getConnection
php
concretecms/concretecms
concrete/src/Page/Sitemap/PageListGenerator.php
https://github.com/concretecms/concretecms/blob/master/concrete/src/Page/Sitemap/PageListGenerator.php
MIT
protected function getDashboardHelper() { if ($this->dashboardHelper === null) { $this->dashboardHelper = $this->app->make('helper/concrete/dashboard'); } return $this->dashboardHelper; }
@return \Concrete\Core\Application\Service\Dashboard
getDashboardHelper
php
concretecms/concretecms
concrete/src/Page/Sitemap/PageListGenerator.php
https://github.com/concretecms/concretecms/blob/master/concrete/src/Page/Sitemap/PageListGenerator.php
MIT
public function __construct(Application $app, Repository $config) { $this->app = $app; $this->config = $config; }
Initialize the instance. @param \Concrete\Core\Application\Application $app @param \Concrete\Core\Config\Repository\Repository $config
__construct
php
concretecms/concretecms
concrete/src/Page/Sitemap/SitemapGenerator.php
https://github.com/concretecms/concretecms/blob/master/concrete/src/Page/Sitemap/SitemapGenerator.php
MIT
public function getPageListGenerator() { if ($this->pageListGenerator === null) { $this->pageListGenerator = $this->app->make(PageListGenerator::class); } return $this->pageListGenerator; }
@return \Concrete\Core\Page\Sitemap\PageListGenerator
getPageListGenerator
php
concretecms/concretecms
concrete/src/Page/Sitemap/SitemapGenerator.php
https://github.com/concretecms/concretecms/blob/master/concrete/src/Page/Sitemap/SitemapGenerator.php
MIT
public function setPageListGenerator(PageListGenerator $pageListGenerator) { $this->pageListGenerator = $pageListGenerator; return $this; }
@param \Concrete\Core\Page\Sitemap\PageListGenerator $pageListGenerator @return $this;
setPageListGenerator
php
concretecms/concretecms
concrete/src/Page/Sitemap/SitemapGenerator.php
https://github.com/concretecms/concretecms/blob/master/concrete/src/Page/Sitemap/SitemapGenerator.php
MIT
public function getResolverManager() { if ($this->resolverManager === null) { $this->resolverManager = $this->app->make(ResolverManagerInterface::class); } return $this->resolverManager; }
@return \Concrete\Core\Url\Resolver\Manager\ResolverManagerInterface
getResolverManager
php
concretecms/concretecms
concrete/src/Page/Sitemap/SitemapGenerator.php
https://github.com/concretecms/concretecms/blob/master/concrete/src/Page/Sitemap/SitemapGenerator.php
MIT
public function setResolverManager(ResolverManagerInterface $resolverManager) { $this->pageListGenerator = $resolverManager; return $this; }
@param \Concrete\Core\Url\Resolver\Manager\ResolverManagerInterface $resolverManager @return $this;
setResolverManager
php
concretecms/concretecms
concrete/src/Page/Sitemap/SitemapGenerator.php
https://github.com/concretecms/concretecms/blob/master/concrete/src/Page/Sitemap/SitemapGenerator.php
MIT
public function generateContents() { $pageListGenerator = $this->getPageListGenerator(); $customCanonicalUrl = $this->getCustomSiteCanonicalUrl(); if ($customCanonicalUrl !== '') { $siteConfig = $pageListGenerator->getSite()->getConfigRepository(); $originalSiteCanonicalUrl = $siteConfig->get('seo.canonical_url'); $siteConfig->set('seo.canonical_url', $customCanonicalUrl); } try { Cache::disableAll(); $multilingualEnabled = $pageListGenerator->isMultilingualEnabled(); yield $this->app->make(SitemapHeader::class, ['isMultilingual' => $multilingualEnabled]); foreach ($pageListGenerator->generatePageList() as $page) { yield $this->createSitemapPage($page, $multilingualEnabled); } yield new SitemapFooter(); } finally { if ($customCanonicalUrl !== '') { $siteConfig->set('seo.canonical_url', $originalSiteCanonicalUrl); } Cache::enableAll(); } }
@return \Concrete\Core\Page\Sitemap\Element\SitemapElement[]|\Generator
generateContents
php
concretecms/concretecms
concrete/src/Page/Sitemap/SitemapGenerator.php
https://github.com/concretecms/concretecms/blob/master/concrete/src/Page/Sitemap/SitemapGenerator.php
MIT
public function getSiteCanonicalUrl() { $site = $this->getPageListGenerator()->getSite(); if ($site === null) { $result = ''; } else { $result = (string) $site->getConfigRepository()->get('seo.canonical_url'); } return $result; }
Get the currently configured canonical URL of the site. @return string
getSiteCanonicalUrl
php
concretecms/concretecms
concrete/src/Page/Sitemap/SitemapGenerator.php
https://github.com/concretecms/concretecms/blob/master/concrete/src/Page/Sitemap/SitemapGenerator.php
MIT
public function getCustomSiteCanonicalUrl() { return $this->customSiteCanonicalUrl; }
Get the custom canonical URL for the site. @return string
getCustomSiteCanonicalUrl
php
concretecms/concretecms
concrete/src/Page/Sitemap/SitemapGenerator.php
https://github.com/concretecms/concretecms/blob/master/concrete/src/Page/Sitemap/SitemapGenerator.php
MIT
public function setCustomSiteCanonicalUrl($customSiteCanonicalUrl) { $this->customSiteCanonicalUrl = (string) $customSiteCanonicalUrl; return $this; }
Set the custom canonical URL for the site. @param string $customSiteCanonicalUrl @return $this
setCustomSiteCanonicalUrl
php
concretecms/concretecms
concrete/src/Page/Sitemap/SitemapGenerator.php
https://github.com/concretecms/concretecms/blob/master/concrete/src/Page/Sitemap/SitemapGenerator.php
MIT
public function resolveUrl(string $sitemapFile) { $siteConfig = $this->getPageListGenerator()->getSite()->getConfigRepository(); $canonicalUrl = $this->getCustomSiteCanonicalUrl(); if (!$canonicalUrl) { $canonicalUrl = $siteConfig->get('seo.canonical_url'); } if ($canonicalUrl) { return rtrim($canonicalUrl, '/') . $sitemapFile; } else { return $sitemapFile; } }
Resolve an URL using the custom site canonical URL (if set). @param array $args @return \League\URL\URLInterface
resolveUrl
php
concretecms/concretecms
concrete/src/Page/Sitemap/SitemapGenerator.php
https://github.com/concretecms/concretecms/blob/master/concrete/src/Page/Sitemap/SitemapGenerator.php
MIT
protected function getSitemapChangeFrequencyAttributeKey() { if ($this->sitemapChangeFrequencyAttributeKey === false) { $category = $this->app->make(PageCategory::class); $this->sitemapChangeFrequencyAttributeKey = $category->getAttributeKeyByHandle('sitemap_changefreq'); } return $this->sitemapChangeFrequencyAttributeKey; }
@return \Concrete\Core\Entity\Attribute\Key\PageKey|null
getSitemapChangeFrequencyAttributeKey
php
concretecms/concretecms
concrete/src/Page/Sitemap/SitemapGenerator.php
https://github.com/concretecms/concretecms/blob/master/concrete/src/Page/Sitemap/SitemapGenerator.php
MIT
protected function getSitemapPriorityAttributeKey() { if ($this->sitemapPriorityAttributeKey === false) { $category = $this->app->make(PageCategory::class); $this->sitemapPriorityAttributeKey = $category->getAttributeKeyByHandle('sitemap_priority'); } return $this->sitemapPriorityAttributeKey; }
@return \Concrete\Core\Entity\Attribute\Key\PageKey|null
getSitemapPriorityAttributeKey
php
concretecms/concretecms
concrete/src/Page/Sitemap/SitemapGenerator.php
https://github.com/concretecms/concretecms/blob/master/concrete/src/Page/Sitemap/SitemapGenerator.php
MIT
protected function getPageUrl(Page $page) { return $this->getResolverManager()->resolve([$page]); }
@param \Concrete\Core\Page\Page $page @return \League\URL\URLInterface
getPageUrl
php
concretecms/concretecms
concrete/src/Page/Sitemap/SitemapGenerator.php
https://github.com/concretecms/concretecms/blob/master/concrete/src/Page/Sitemap/SitemapGenerator.php
MIT
protected function getPageChangeFrequency(Page $page) { $result = ''; $ak = $this->getSitemapChangeFrequencyAttributeKey(); if ($ak !== null) { $result = (string) $page->getAttribute($ak); } if ($result === '') { $result = $this->getDefaultChangeFrequency(); } return $result; }
@param \Concrete\Core\Page\Page $page @return string
getPageChangeFrequency
php
concretecms/concretecms
concrete/src/Page/Sitemap/SitemapGenerator.php
https://github.com/concretecms/concretecms/blob/master/concrete/src/Page/Sitemap/SitemapGenerator.php
MIT
protected function getPagePriority(Page $page) { $result = ''; $ak = $this->getSitemapPriorityAttributeKey(); if ($ak !== null) { $result = (string) $page->getAttribute($ak); } if ($result === '') { $result = $this->getDefaultPriority(); } return $result; }
@param \Concrete\Core\Page\Page $page @return string
getPagePriority
php
concretecms/concretecms
concrete/src/Page/Sitemap/SitemapGenerator.php
https://github.com/concretecms/concretecms/blob/master/concrete/src/Page/Sitemap/SitemapGenerator.php
MIT
protected function createSitemapPage(Page $page, $multilingualEnabled) { $result = new SitemapPage($page, $this->getPageUrl($page)); $lasMod = $page->getCollectionDateLastModified(); if ($lasMod) { $result->setLastModifiedAt(new DateTime($lasMod)); } $result ->setChangeFrequency($this->getPageChangeFrequency($page)) ->setPriority($this->getPagePriority($page)) ; if ($multilingualEnabled) { $this->populateLanguageAlternatives($result); } return $result; }
@param \Concrete\Core\Page\Page $page @param bool $multilingualEnabled @return \Concrete\Core\Page\Sitemap\Element\SitemapPage
createSitemapPage
php
concretecms/concretecms
concrete/src/Page/Sitemap/SitemapGenerator.php
https://github.com/concretecms/concretecms/blob/master/concrete/src/Page/Sitemap/SitemapGenerator.php
MIT
protected function populateLanguageAlternatives(SitemapPage $sitemapPage) { $pageListGenerator = $this->getPageListGenerator(); $page = $sitemapPage->getPage(); $pageSection = $pageListGenerator->getMultilingualSectionForPage($page); if ($pageSection !== null) { $addThisPage = false; foreach ($pageListGenerator->getMultilingualSections() as $relatedSection) { if ($relatedSection !== $pageSection) { $relatedPageID = $relatedSection->getTranslatedPageID($page); if ($relatedPageID) { $relatedPage = Page::getByID($relatedPageID); if ($relatedPage && $pageListGenerator->canIncludePageInSitemap($relatedPage)) { $relatedUrl = $this->getPageUrl($relatedPage); $sitemapPage->addAlternativeLanguage(new SitemapPageAlternativeLanguage($relatedSection, $relatedPage, $relatedUrl)); $addThisPage = true; } } } } if ($addThisPage) { $sitemapPage->addAlternativeLanguage(new SitemapPageAlternativeLanguage($pageSection, $page, clone $sitemapPage->getUrl())); } } }
@param \Concrete\Core\Page\Sitemap\Element\SitemapPage $sitemapPage
populateLanguageAlternatives
php
concretecms/concretecms
concrete/src/Page/Sitemap/SitemapGenerator.php
https://github.com/concretecms/concretecms/blob/master/concrete/src/Page/Sitemap/SitemapGenerator.php
MIT
public function getMode() { return $this->mode; }
Get the write mode. @return int One of the SitemapWriter::MODE_... constants.
getMode
php
concretecms/concretecms
concrete/src/Page/Sitemap/SitemapWriter.php
https://github.com/concretecms/concretecms/blob/master/concrete/src/Page/Sitemap/SitemapWriter.php
MIT
public function setMode($mode) { $this->mode = (int) $mode; return $this; }
Set the write mode. @param int $mode One of the SitemapWriter::MODE_... constants. @return $this
setMode
php
concretecms/concretecms
concrete/src/Page/Sitemap/SitemapWriter.php
https://github.com/concretecms/concretecms/blob/master/concrete/src/Page/Sitemap/SitemapWriter.php
MIT
public function getIndenter() { return $this->indenter; }
Get the string used to indent the XML when the mode is set to MODE_LOWMEMORY. @return string
getIndenter
php
concretecms/concretecms
concrete/src/Page/Sitemap/SitemapWriter.php
https://github.com/concretecms/concretecms/blob/master/concrete/src/Page/Sitemap/SitemapWriter.php
MIT
public function setIndenter($indenter) { $this->indenter = (string) $indenter; return $this; }
Set the string used to indent the XML when the mode is set to MODE_LOWMEMORY. @param string $indenter @return $this
setIndenter
php
concretecms/concretecms
concrete/src/Page/Sitemap/SitemapWriter.php
https://github.com/concretecms/concretecms/blob/master/concrete/src/Page/Sitemap/SitemapWriter.php
MIT
public function getLineTerminator() { return $this->lineTerminator; }
Get the string used as new-line terminator in the XML when the mode is set to MODE_LOWMEMORY. @return string
getLineTerminator
php
concretecms/concretecms
concrete/src/Page/Sitemap/SitemapWriter.php
https://github.com/concretecms/concretecms/blob/master/concrete/src/Page/Sitemap/SitemapWriter.php
MIT
public function setLineTerminator($lineTerminator) { $this->lineTerminator = (string) $lineTerminator; return $this; }
Get the string used as new-line terminator in the XML when the mode is set to MODE_LOWMEMORY. @param string $lineTerminator @return $this
setLineTerminator
php
concretecms/concretecms
concrete/src/Page/Sitemap/SitemapWriter.php
https://github.com/concretecms/concretecms/blob/master/concrete/src/Page/Sitemap/SitemapWriter.php
MIT
public function getSitemapGenerator() { if ($this->sitemapGenerator === null) { $this->sitemapGenerator = $this->app->make(SitemapGenerator::class); } return $this->sitemapGenerator; }
Get the SitemapGenerator instance to be used. @return \Concrete\Core\Page\Sitemap\SitemapGenerator
getSitemapGenerator
php
concretecms/concretecms
concrete/src/Page/Sitemap/SitemapWriter.php
https://github.com/concretecms/concretecms/blob/master/concrete/src/Page/Sitemap/SitemapWriter.php
MIT
public function setSitemapGenerator(SitemapGenerator $sitemapGenerator) { $this->sitemapGenerator = $sitemapGenerator; return $this; }
Set the SitemapGenerator instance to be used. @param SitemapGenerator $sitemapGenerator @return $this
setSitemapGenerator
php
concretecms/concretecms
concrete/src/Page/Sitemap/SitemapWriter.php
https://github.com/concretecms/concretecms/blob/master/concrete/src/Page/Sitemap/SitemapWriter.php
MIT
public function setOutputFilename($outputFilename) { $this->outputFilename = (string) $outputFilename; return $this; }
Set the path to the sitemap to be generated. @param string $outputFilename @return $this
setOutputFilename
php
concretecms/concretecms
concrete/src/Page/Sitemap/SitemapWriter.php
https://github.com/concretecms/concretecms/blob/master/concrete/src/Page/Sitemap/SitemapWriter.php
MIT
public function getOutputFilename() { $result = $this->outputFilename; if ($result === '') { $config = $this->app->make('config'); $relativeName = '/' . ltrim(str_replace(DIRECTORY_SEPARATOR, '/', (string) $config->get('concrete.sitemap_xml.file')), '/'); if ($relativeName === '/') { $relativeName = '/sitemap.xml'; } $result = rtrim(DIR_BASE, '/') . $relativeName; } return $result; }
Get the path to the sitemap to be generated. @return string
getOutputFilename
php
concretecms/concretecms
concrete/src/Page/Sitemap/SitemapWriter.php
https://github.com/concretecms/concretecms/blob/master/concrete/src/Page/Sitemap/SitemapWriter.php
MIT
public function getSitemapUrl() { $outputFilename = $this->getOutputFilename(); if (strpos($outputFilename, DIR_BASE . '/') === 0) { $result = (string) $this->getSitemapGenerator()->resolveUrl(substr($outputFilename, strlen(DIR_BASE))); } else { $result = ''; } return $result; }
Get the URL of the sitemap corresponding to the output file name. @return string returns an empty string if the output file name is not under the web root
getSitemapUrl
php
concretecms/concretecms
concrete/src/Page/Sitemap/SitemapWriter.php
https://github.com/concretecms/concretecms/blob/master/concrete/src/Page/Sitemap/SitemapWriter.php
MIT
public function generate(?callable $pulse = null) { $indenter = $this->getIndenter(); $lineTerminator = $this->getLineTerminator(); $dispatchElementReady = $this->director->hasListeners(static::EVENTNAME_ELEMENTREADY); $dispatchPageReadyDeprecated = $this->director->hasListeners(static::EVENTNAME_PAGEREADY_DEPRECATED); $dispatchXmlReady = $this->director->hasListeners(static::EVENTNAME_XMLREADY); $mode = $this->getMode(); if ($mode !== static::MODE_HIGHMEMORY && $mode !== static::MODE_LOWMEMORY) { $mode = ($dispatchPageReadyDeprecated || $dispatchXmlReady) ? static::MODE_HIGHMEMORY : static::MODE_LOWMEMORY; } $outputFilename = $this->getOutputFilename(); $this->checkOutputFilename($outputFilename); $fd = null; $fdDest = null; $tempFilename = @tempnam($this->getTemporaryDirectory(), 'sitemap'); if ($tempFilename === false) { throw new UserMessageException(t('Unable to create a temporary file.')); } try { // fopen/fwrite/fclose is one order of magnitude faster than $this->filesystem->append $fd = fopen($tempFilename, 'wb+'); $xmlDocument = null; foreach ($this->getSitemapGenerator()->generateContents() as $element) { if ($pulse !== null) { $pulse($element); } if ($dispatchElementReady) { $event = new Event\ElementReadyEvent($element); $this->director->dispatch(static::EVENTNAME_ELEMENTREADY, $event); $element = $event->getElement(); unset($event); if ($element === null) { continue; } } if ($mode === static::MODE_HIGHMEMORY) { if ($element instanceof SitemapHeader) { $xmlDocument = $element->toXmlElement(); } else { $xmlNode = $element->toXmlElement($xmlDocument); if ($dispatchPageReadyDeprecated && $element instanceof SitemapPage) { $event = new Event\DeprecatedPageReadyEvent($element->getPage(), $xmlNode); $this->director->dispatch(static::EVENTNAME_PAGEREADY_DEPRECATED, $event); $xmlNode = $event->getNode(); unset($event); if ($xmlNode === null) { continue; } } } } else { $lines = $element->toXmlLines($indenter); if ($lines !== null) { $lines = implode($lineTerminator, $lines) . $lineTerminator; if (@fwrite($fd, $lines) === false) { throw new UserMessageException(t('Failed to write to a temporary file.')); } } } } if ($mode === static::MODE_HIGHMEMORY) { if ($dispatchXmlReady) { $event = new Event\XmlReadyEvent($xmlDocument); $this->director->dispatch(static::EVENTNAME_XMLREADY, $event); $xmlDocument = $event->getDocument(); unset($event); } $dom = dom_import_simplexml($xmlDocument)->ownerDocument; unset($xmlDocument); $dom->formatOutput = true; if (@fwrite($fd, $dom->saveXML()) === false) { throw new UserMessageException(t('Failed to write to a temporary file.')); } } fflush($fd); fseek($fd, 0, SEEK_SET); $updatechmod = !$this->filesystem->isFile($outputFilename); $fdDest = @fopen($outputFilename, 'wb'); if (@stream_copy_to_stream($fd, $fdDest) === false) { throw new UserMessageException(t('Failed to create the sitemap file.')); } fflush($fdDest); fclose($fdDest); $fdDest = null; fclose($fd); $fd = null; if ($updatechmod) { @chmod($outputFilename, 0644); } } finally { if ($fdDest !== null) { @fclose($fdDest); $fdDest = null; } if ($fd !== null) { @fclose($fd); $fd = null; } $this->filesystem->delete([$tempFilename]); } }
Generate the sitemap. @param callable|null $pulse a callback function to be called every time a new sitemap element will be processed
generate
php
concretecms/concretecms
concrete/src/Page/Sitemap/SitemapWriter.php
https://github.com/concretecms/concretecms/blob/master/concrete/src/Page/Sitemap/SitemapWriter.php
MIT
protected function getTemporaryDirectory() { $result = $this->temporaryDirectory; if ($result === '') { $fileHelper = $this->app->make('helper/file'); $temporaryDirectory = (string) $fileHelper->getTemporaryDirectory(); if ($temporaryDirectory === '' || !$this->filesystem->isDirectory($temporaryDirectory)) { throw new UserMessageException(t('Unable to determine the temporary directory.')); } $this->temporaryDirectory = $temporaryDirectory; } return $this->temporaryDirectory; }
Get the temporary directory to be used during the sitemap generation. @return string
getTemporaryDirectory
php
concretecms/concretecms
concrete/src/Page/Sitemap/SitemapWriter.php
https://github.com/concretecms/concretecms/blob/master/concrete/src/Page/Sitemap/SitemapWriter.php
MIT
protected function getXmlMetaHeader() { return '<?xml version="1.0" encoding="' . APP_CHARSET . '"?>'; }
Get the XML meta-header. @return string
getXmlMetaHeader
php
concretecms/concretecms
concrete/src/Page/Sitemap/Element/SitemapElement.php
https://github.com/concretecms/concretecms/blob/master/concrete/src/Page/Sitemap/Element/SitemapElement.php
MIT
public function toXmlLines($indenter = ' ') { return ['</urlset>']; }
{@inheritdoc} @see \Concrete\Core\Page\Sitemap\Element\SitemapElement::toXmlLines()
toXmlLines
php
concretecms/concretecms
concrete/src/Page/Sitemap/Element/SitemapFooter.php
https://github.com/concretecms/concretecms/blob/master/concrete/src/Page/Sitemap/Element/SitemapFooter.php
MIT
public function __construct($isMultilingual) { $this->setIsMultilingual($isMultilingual); }
Initialize the instance. @param bool $isMultilingual Is multilingual supported?
__construct
php
concretecms/concretecms
concrete/src/Page/Sitemap/Element/SitemapHeader.php
https://github.com/concretecms/concretecms/blob/master/concrete/src/Page/Sitemap/Element/SitemapHeader.php
MIT
public function setIsMultilingual($isMultilingual) { $this->isMultilingual = (bool) $isMultilingual; return $this; }
Is multilingual supported? @param bool $isMultilingual @return $this
setIsMultilingual
php
concretecms/concretecms
concrete/src/Page/Sitemap/Element/SitemapHeader.php
https://github.com/concretecms/concretecms/blob/master/concrete/src/Page/Sitemap/Element/SitemapHeader.php
MIT
public function toXmlLines($indenter = ' ') { return [ $this->getXmlMetaHeader(), $this->getUrlset(false), ]; }
{@inheritdoc} @see \Concrete\Core\Page\Sitemap\Element\SitemapElement::toXmlLines()
toXmlLines
php
concretecms/concretecms
concrete/src/Page/Sitemap/Element/SitemapHeader.php
https://github.com/concretecms/concretecms/blob/master/concrete/src/Page/Sitemap/Element/SitemapHeader.php
MIT
public function toXmlElement(?SimpleXMLElement $parentElement = null) { if ($parentElement !== null) { throw new UserMessageException(t('The sitemap XML header should be the first element.')); } return new SimpleXMLElement($this->getXmlMetaHeader() . $this->getUrlset(true)); }
{@inheritdoc} @see \Concrete\Core\Page\Sitemap\Element\SitemapElement::toXmlElement()
toXmlElement
php
concretecms/concretecms
concrete/src/Page/Sitemap/Element/SitemapHeader.php
https://github.com/concretecms/concretecms/blob/master/concrete/src/Page/Sitemap/Element/SitemapHeader.php
MIT
public function __construct(Page $page, UrlInterface $url, ?DateTime $lastModifiedAt = null, $changeFrequency = '', $priority = '') { $this->page = $page; $this->setUrl($url); $this->setLastModifiedAt($lastModifiedAt); $this->setChangeFrequency($changeFrequency); $this->setPriority($priority); }
@param Page $page the page @param UrlInterface $url the URL of the page @param \DateTime|null $lastModifiedAt the last modification date/time @param string $changeFrequency the page change frequency (one of the SitemapPage::CHANGEFREQUENCY_... constants, or an empty string in unavailable) @param string $priority the page priority
__construct
php
concretecms/concretecms
concrete/src/Page/Sitemap/Element/SitemapPage.php
https://github.com/concretecms/concretecms/blob/master/concrete/src/Page/Sitemap/Element/SitemapPage.php
MIT
public function getPage() { return $this->page; }
Get the page. @return \Concrete\Core\Page\Page
getPage
php
concretecms/concretecms
concrete/src/Page/Sitemap/Element/SitemapPage.php
https://github.com/concretecms/concretecms/blob/master/concrete/src/Page/Sitemap/Element/SitemapPage.php
MIT
public function getUrl() { return $this->url; }
Get the URL of the page. @return \League\Url\UrlInterface
getUrl
php
concretecms/concretecms
concrete/src/Page/Sitemap/Element/SitemapPage.php
https://github.com/concretecms/concretecms/blob/master/concrete/src/Page/Sitemap/Element/SitemapPage.php
MIT
public function setUrl(UrlInterface $url) { $this->url = $url; return $this; }
Set the URL of the page. @param \League\Url\UrlInterface $url @return $this
setUrl
php
concretecms/concretecms
concrete/src/Page/Sitemap/Element/SitemapPage.php
https://github.com/concretecms/concretecms/blob/master/concrete/src/Page/Sitemap/Element/SitemapPage.php
MIT
public function getLastModifiedAt() { return $this->lastModifiedAt; }
Get the last modification date/time. @return \DateTime|null
getLastModifiedAt
php
concretecms/concretecms
concrete/src/Page/Sitemap/Element/SitemapPage.php
https://github.com/concretecms/concretecms/blob/master/concrete/src/Page/Sitemap/Element/SitemapPage.php
MIT
public function setLastModifiedAt(?DateTime $lastModifiedAt = null) { $this->lastModifiedAt = $lastModifiedAt; return $this; }
Set the last modification date/time. @param \DateTime|null $lastModifiedAt @return $this
setLastModifiedAt
php
concretecms/concretecms
concrete/src/Page/Sitemap/Element/SitemapPage.php
https://github.com/concretecms/concretecms/blob/master/concrete/src/Page/Sitemap/Element/SitemapPage.php
MIT
public function getChangeFrequency() { return $this->changeFrequency; }
Get the page change frequency (one of the SitemapPage::CHANGEFREQUENCY_... constants, or an empty string in unavailable). @return string
getChangeFrequency
php
concretecms/concretecms
concrete/src/Page/Sitemap/Element/SitemapPage.php
https://github.com/concretecms/concretecms/blob/master/concrete/src/Page/Sitemap/Element/SitemapPage.php
MIT
public function setChangeFrequency($changeFrequency) { $this->changeFrequency = (string) $changeFrequency; return $this; }
Set the page change frequency. @param string $changeFrequency one of the SitemapPage::CHANGEFREQUENCY_... constants, or an empty string in unavailable @return $this
setChangeFrequency
php
concretecms/concretecms
concrete/src/Page/Sitemap/Element/SitemapPage.php
https://github.com/concretecms/concretecms/blob/master/concrete/src/Page/Sitemap/Element/SitemapPage.php
MIT
public function getPriority() { return $this->priority; }
Get the page priority. @return string
getPriority
php
concretecms/concretecms
concrete/src/Page/Sitemap/Element/SitemapPage.php
https://github.com/concretecms/concretecms/blob/master/concrete/src/Page/Sitemap/Element/SitemapPage.php
MIT
public function setPriority($priority) { $this->priority = (string) $priority; return $this; }
Set the page priority. @param string $priority @return $this
setPriority
php
concretecms/concretecms
concrete/src/Page/Sitemap/Element/SitemapPage.php
https://github.com/concretecms/concretecms/blob/master/concrete/src/Page/Sitemap/Element/SitemapPage.php
MIT
public function getAlternativeLanguages() { return $this->alternativeLanguages; }
Get the pages in alternative languages mapped to this page. @return \Concrete\Core\Page\Sitemap\Element\SitemapPageAlternativeLanguage[]
getAlternativeLanguages
php
concretecms/concretecms
concrete/src/Page/Sitemap/Element/SitemapPage.php
https://github.com/concretecms/concretecms/blob/master/concrete/src/Page/Sitemap/Element/SitemapPage.php
MIT
public function addAlternativeLanguage(SitemapPageAlternativeLanguage $alternative) { $this->alternativeLanguages[] = $alternative; return $this; }
Add a page in an alternative language that's mapped to this page. @param \Concrete\Core\Page\Sitemap\Element\SitemapPageAlternativeLanguage $alternative @return $this
addAlternativeLanguage
php
concretecms/concretecms
concrete/src/Page/Sitemap/Element/SitemapPage.php
https://github.com/concretecms/concretecms/blob/master/concrete/src/Page/Sitemap/Element/SitemapPage.php
MIT
public function isSkip() { return $this->skip; }
Should this page be skipped? @return bool
isSkip
php
concretecms/concretecms
concrete/src/Page/Sitemap/Element/SitemapPage.php
https://github.com/concretecms/concretecms/blob/master/concrete/src/Page/Sitemap/Element/SitemapPage.php
MIT
public function setSkip($skip) { $this->skip = (bool) $skip; return $this; }
Should this page be skipped? @param bool $skip @return $this
setSkip
php
concretecms/concretecms
concrete/src/Page/Sitemap/Element/SitemapPage.php
https://github.com/concretecms/concretecms/blob/master/concrete/src/Page/Sitemap/Element/SitemapPage.php
MIT
public function toXmlLines($indenter = ' ') { if ($this->isSkip()) { $result = null; } else { if ($indenter) { $prefix = $indenter; $prefix2 = $indenter . $indenter; } else { $prefix = ''; $prefix2 = ''; } $loc = h((string) $this->getUrl()); $result = [ "{$prefix}<url>", "{$prefix2}<loc>{$loc}</loc>", ]; $lastModifiedAt = $this->getLastModifiedAt(); if ($lastModifiedAt !== null) { $lastModifiedAt = $lastModifiedAt->format(DateTime::ATOM); $result[] = "{$prefix2}<lastmod>{$lastModifiedAt}</lastmod>"; } $changeFrequency = $this->getChangeFrequency(); if ($changeFrequency !== '') { $result[] = "{$prefix2}<changefreq>{$changeFrequency}</changefreq>"; } $priority = $this->getPriority(); if ($priority !== '') { $result[] = "{$prefix2}<priority>{$priority}</priority>"; } foreach ($this->getAlternativeLanguages() as $alternativeLanguage) { $result = array_merge($result, $alternativeLanguage->toXmlLines($indenter)); } $result[] = "{$prefix}</url>"; } return $result; }
{@inheritdoc} @see \Concrete\Core\Page\Sitemap\Element\SitemapElement::toXmlLines()
toXmlLines
php
concretecms/concretecms
concrete/src/Page/Sitemap/Element/SitemapPage.php
https://github.com/concretecms/concretecms/blob/master/concrete/src/Page/Sitemap/Element/SitemapPage.php
MIT
public function toXmlElement(?SimpleXMLElement $parentElement = null) { if ($parentElement === null) { throw new UserMessageException(t('The sitemap XML page should not be the first element.')); } $result = $parentElement->addChild('url'); $result->addChild('loc', (string) $this->getUrl()); $lastModifiedAt = $this->getLastModifiedAt(); if ($lastModifiedAt !== null) { $result->addChild('lastmod', $lastModifiedAt->format(DateTime::ATOM)); } $changeFrequency = $this->getChangeFrequency(); if ($changeFrequency !== '') { $result->addChild('changefreq', $changeFrequency); } $priority = $this->getPriority(); if ($priority !== '') { $result->addChild('priority', $priority); } foreach ($this->getAlternativeLanguages() as $alternativeLanguage) { $alternativeLanguage->toXmlElement($result); } return $result; }
{@inheritdoc} @see \Concrete\Core\Page\Sitemap\Element\SitemapElement::toXmlElement()
toXmlElement
php
concretecms/concretecms
concrete/src/Page/Sitemap/Element/SitemapPage.php
https://github.com/concretecms/concretecms/blob/master/concrete/src/Page/Sitemap/Element/SitemapPage.php
MIT
public function __construct(Section $section, Page $page, UrlInterface $url) { $this->section = $section; $this->page = $page; $this->url = $url; }
@param \Concrete\Core\Multilingual\Page\Section\Section $section @param \Concrete\Core\Page\Page $page @param \League\Url\UrlInterface $url
__construct
php
concretecms/concretecms
concrete/src/Page/Sitemap/Element/SitemapPageAlternativeLanguage.php
https://github.com/concretecms/concretecms/blob/master/concrete/src/Page/Sitemap/Element/SitemapPageAlternativeLanguage.php
MIT
public function getSection() { return $this->section; }
Get the multilingual section associated to this alternative page. @return \Concrete\Core\Multilingual\Page\Section\Section
getSection
php
concretecms/concretecms
concrete/src/Page/Sitemap/Element/SitemapPageAlternativeLanguage.php
https://github.com/concretecms/concretecms/blob/master/concrete/src/Page/Sitemap/Element/SitemapPageAlternativeLanguage.php
MIT
public function getPage() { return $this->page; }
Get the alternative page in the alternative language. @return \Concrete\Core\Page\Page
getPage
php
concretecms/concretecms
concrete/src/Page/Sitemap/Element/SitemapPageAlternativeLanguage.php
https://github.com/concretecms/concretecms/blob/master/concrete/src/Page/Sitemap/Element/SitemapPageAlternativeLanguage.php
MIT
public function getUrl() { return $this->url; }
Get the URL of the alternative page. @return \League\Url\UrlInterface
getUrl
php
concretecms/concretecms
concrete/src/Page/Sitemap/Element/SitemapPageAlternativeLanguage.php
https://github.com/concretecms/concretecms/blob/master/concrete/src/Page/Sitemap/Element/SitemapPageAlternativeLanguage.php
MIT
public function setUrl(UrlInterface $url) { $this->url = $url; return $this; }
Set the URL of the alternative page. @param \League\Url\UrlInterface $url @return $this
setUrl
php
concretecms/concretecms
concrete/src/Page/Sitemap/Element/SitemapPageAlternativeLanguage.php
https://github.com/concretecms/concretecms/blob/master/concrete/src/Page/Sitemap/Element/SitemapPageAlternativeLanguage.php
MIT
public function isSkip() { return $this->skip; }
Should this alternative be skipped? @return bool
isSkip
php
concretecms/concretecms
concrete/src/Page/Sitemap/Element/SitemapPageAlternativeLanguage.php
https://github.com/concretecms/concretecms/blob/master/concrete/src/Page/Sitemap/Element/SitemapPageAlternativeLanguage.php
MIT