@deprecated BC implementation of deprecated canIncludePageInSitemap method: use the new classes in the Concrete\Core\Page\Sitemap namespace

@param \Concrete\Core\Page\Page $page
@param array $instances
182612
private static function _canIncludePageInSitemap($page, $instances)
    {
        static $generator;
        if ($generator === null) {
            $generator = \Core::make(PageListGenerator::class);
        }

        return $generator->canIncludePageInSitemap($page);
    }
66253
public function editPage($args)
    {
        // Get dependencies
        $pageMapper = ($this->container->dataMapper)('PageMapper');
        $pageElementMapper = ($this->container->dataMapper)('PageElementMapper');
        $collectionMapper = ($this->container->dataMapper)('CollectionMapper');
        $pageSettingMapper = ($this->container->dataMapper)('PageSettingMapper');
        $json = $this->container->json;

        // Fetch page, or create new page
        if (isset($args['id']) && is_numeric($args['id'])) {
            // Existing page
            $page = $pageMapper->findPageById($args['id']);
            $page->elements = $pageElementMapper->findElementsByPageId($args['id']);
            $page->settings = $pageSettingMapper->findPageSettings($args['id']);
        } else {
            // Get query params
            $definionParam = $this->request->getQueryParam('definition');
            $collectionIdParam = $this->request->getQueryParam('collection_id');

            // Validate that we have a proper definition file name
            if (null === $definionParam || 1 !== preg_match('/^[a-zA-Z0-9]+\.json$/', $definionParam)) {
                throw new Exception("PitonCMS: Invalid query parameter for 'definition': $definionParam");
            }

            // New page object
            $page = $pageMapper->make();
            $page->definition = $definionParam;

            // Is this request for a collection detail page?
            if (null !== $collectionIdParam) {
                if (1 !== preg_match('/^\d+$/', $collectionIdParam)) {
                    throw new Exception("PitonCMS: Invalid query parameter for 'collection_id': $collectionIdParam");
                }

                $collection = $collectionMapper->findById($collectionIdParam);
                $page->collection_id = $collectionIdParam;
                $page->collection_slug = $collection->slug;
            }
        }

        // Path to JSON definition file
        $jsonPath = ROOT_DIR . "structure/definitions/pages/{$page->definition}";
        if (null === $page->json = $json->getJson($jsonPath, 'page')) {
            $this->setAlert('danger', 'Page JSON Definition Error', $json->getErrorMessages());
        }

        // Merge saved page settnigs with settings from page JSON definition
        if (isset($page->json->settings)) {
            $page->settings = $this->mergeSettings($page->settings, $page->json->settings);
        }

        return $this->render('editPage.html', $page);
    }
671631
private function _loadPage($page, $variables = false)
	{
		// Start the output buffer captain
		ob_start();

		// Store the page
		$this->page = $page;

		// Load the page that was requested
		$this->_loadFile($this->page, 'page', $variables);

		// If a template was set we need to get the page content and pass it to the template
		if ($this->template !== null) {
			// Set the template content var
			$this->_template_content = ob_get_clean();

			// Restart the buffer
			ob_start();

			// Load the template with any template vars that were passed in earlier
			// from the page
			$this->_loadFile($this->template, 'template', $this->_template_vars);
		}

		// And finally output everything in the buffer
		ob_end_flush();
	}
653349
protected function ensureMethodExists($instance, $method) {
        if ( ! method_exists($instance, $method)) {
            throw new InvalidControllerMethod(
                s('Method "%s" is not defined on controller "%s".',
                    $method, get_type($instance))
            );
        }
    }
1225428
public function hasPageParts(HasPagePartsInterface $page, $context = 'main')
    {
        return $this->em->getRepository(PagePartRef::class)->hasPageParts($page, $context);
    }
637560
public function canUpdateSitePage(
        \Rcm\Entity\Page $page
    ) {
        try {
            $this->assertCanUpdateSitePage(
                $page
            );
        } catch (PageException $exception) {
            return false;
        }

        return true;
    }
933704
public function getPageParts(HasPagePartsInterface $page, $context = 'main')
    {
        /** @var $entityRepository PagePartRefRepository */
        $entityRepository = $this->em->getRepository('KunstmaanPagePartBundle:PagePartRef');
        $pageparts = $entityRepository->getPageParts($page, $context);

        return $pageparts;
    }
1045088
public function page($page,$listRows=null){
        if(is_null($listRows) && strpos($page,',')){
            list($page,$listRows)   =   explode(',',$page);
        }
        $this->options['page']      =   array(intval($page),intval($listRows));
        return $this;
    }
1000182
public function getModelDataTable($instances, $model, $totalCount, $page = 1) {
		$adminRoute = $this->controller->_getBaseRoute ();
		$files = $this->controller->_getFiles ();
		$dataTable = $this->getDataTableInstance ( $instances, $model, $totalCount, $page );
		$attributes = $this->controller->_getAdminData ()->getFieldNames ( $model );
		$this->setDataTableAttributes ( $dataTable, $attributes, $model, $instances );
		$dataTable->setCaptions ( $this->getCaptions ( $attributes, $model ) );

		$dataTable->addClass ( "small very compact" );
		$lbl = new HtmlLabel ( "search-query", "<span id='search-query-content'></span>" );
		$icon = $lbl->addIcon ( "delete", false );
		$lbl->wrap ( "<span>", "</span>" );
		$lbl->setProperty ( "style", "display: none;" );
		$icon->getOnClick ( $adminRoute . $files->getRouteRefreshTable (), "#lv", [ "jqueryDone" => "replaceWith","hasLoader" => "internal" ] );

		$dataTable->addItemInToolbar ( $lbl );
		$dataTable->addSearchInToolbar ();
		$dataTable->setToolbarPosition ( PositionInTable::FOOTER );
		$dataTable->getToolbar ()->setSecondary ();
		return $dataTable;
	}
131067
private function readPage($page) {
        if (isset($page[1][1]['/Kids'])) {
            // Nested pages!
            foreach ($page[1][1]['/Kids'][1] as $subref) {
                $subpage = $this->getObjectVal($subref);
                $this->readPage($subpage);
            }
        } else {
            $this->pages[] = $page;
        }
    }
56024
public function updateSeoByEntity(BasePage $page, $entity)
    {
        //if no entity is provided
        if ($entity === null) {
            //we look for the entity of the page
            if ($page->getBusinessEntity() !== null) {
                $entity = $page->getBusinessEntity();
            }
        }

        //only if we have an entity instance
        if ($entity !== null) {
            //the page seo
            $pageSeo = $page->getSeo();

            //the page seo might not exist yet
            if ($pageSeo !== null) {
                $businessEntity = $this->businessEntityHelper->findByEntityInstance($entity);

                if ($businessEntity !== null) {
                    $businessProperties = $businessEntity->getBusinessPropertiesByType('seoable');

                    //parse the business properties
                    foreach ($businessProperties as $businessProperty) {
                        //parse of seo attributes
                        foreach ($this->pageSeoAttributes as $seoAttribute) {
                            $value = $this->getEntityAttributeValue($pageSeo, $seoAttribute);
                            // we only update value if its a string and (if its a VBP or its a BP where value is not defined)
                            if (is_string($value) && ($page instanceof VirtualBusinessPage || ($page instanceof BusinessPage && $value == null))) {
                                $value = $this->parameterConverter->setBusinessPropertyInstance(
                                    $value,
                                    $businessProperty,
                                    $entity
                                );
                            }
                            $this->setEntityAttributeValue($pageSeo, $seoAttribute, $value);
                        }
                    }
                }
            }
        }
    }
1345193
public function removePage(\CampaignChain\Location\FacebookBundle\Entity\Page $pages)
    {
        $this->pages->removeElement($pages);
    }
1290428
static function PageUrl(Page $page, array $params = array(), $fragment = '')
    {
        $siteUrl = $page->GetSite()->GetUrl();
        $pageUrl = $page->GetUrl();
        if ($pageUrl == 'index.html') {
            $url = $siteUrl;
        }
        else {
            $url = Path::Combine($siteUrl, $pageUrl);
        }

        $oblParams = self::GatherParams($url);
        $urlObl = self::AttachObligatoryParams($url, $oblParams, $params);

        $urlAllParams = self::AttachMoreParams($urlObl, $oblParams, $params);
        return $fragment ? $urlAllParams . '#' . $fragment : $urlAllParams;
    }
6662
public static function multiPage(int $page ,array $C , int $pagesize = 10 ):array
    {
        if(!self::is_indexArray($C)){
            throw new \Exception('Tools multiPage throw : $C must is indexed array!');
        }
        //区间数组
        $scopeC = array();
        //区间指针记录
        $scopePointInteger = 0;
        //记录在数轴上个区间位置
        foreach($C as $k => $v){
            $scopeC[$k] = array($scopePointInteger ,$scopePointInteger + $v);
            $scopePointInteger += intval($v);
        }

//        if($scopePointInteger <= 0 ){
//            throw new \Exception('Tools multiPage throw : sum value of array $C must be greater than 0!');
//        }

        $count = $scopePointInteger;
        //print_r($scopeC);
        //最大页数
        $maxPage = ceil($count / $pagesize);
        //实际分页数据区间
        $OriginScopeL = ($page - 1) * $pagesize;
        $OriginScopeR = $OriginScopeL + $pagesize;

        //初始化limit 数组 , 使其下标同 $C一致
        $ScopeLimit = array();
        for($i=0;$i < count($C);$i++){
            $ScopeLimit[$i] = false;
        }
        foreach ($scopeC as $key => $value) {
            if($value[1] <= $OriginScopeL){
                //不取 0 ~ 起始点的数据
                //$ScopeLimit[$key] = false;
            }else{
                //起始点以后的数据
                //获取起始点位置 , 起始点大于阶段的起始点的时候需要借位 ， 反之等于当前区间的第一位 针对limit 等于 0 , ?
                $start = $value[0] > $OriginScopeL ? 0 : $OriginScopeL - $value[0];
                //该区间的结束点 针对Limit
                $maxEnd = $C[$key] - $start;
                //获取结束点 位置 , 看结束点是否大于区间结束点
                if($OriginScopeR > $value[1]){
                    $end = $maxEnd;
                    $ScopeLimit[$key] = ' limit '.$start.','.$end;
                }else{
                    //反之 等于本区间结束点
                    //取差值
                    $Borrow = $value[1] - $OriginScopeR;
                    //取剩余数
                    $end = $maxEnd - $Borrow;
                    $ScopeLimit[$key] = ' limit '.$start.','.$end;
                    //echo $ScopeLimit[$key];
                    break;
                }
            }
        }

        return [
            'page' => $page,
            'pagesize' => $pagesize,
            'count' => $count,
            'maxpage' => $maxPage,
            'limit' => $ScopeLimit
        ];

    }
846463
public function setPage($page = null)
    {
        // The following argument formats are supported:
        //
        // null = set current page
        // '.' = set current page
        // 'page' = sets webroot/page.html
        // './page' = set page relatively to current page
        // '..' = parent page
        // '../page' = page besides our own (foo/bar -> foo/page)
        // 'index' = properly points to the index page defined in APP
        // '/admin/' = will not be converted

        /** @type $this->app App_Web */

        $destination = '';

        if (is_null($page)) {
            $page = '.';
        }

        foreach (explode('/', $page) as $component) {
            if ($component == '') {
                continue;
            }
            if ($component == '.' && $destination == '') {
                if ($this->app->page == 'index') {
                    continue;
                }
                $destination = str_replace('_', '/', $this->app->page);
                continue;
            }

            if ($component == '..') {
                if (!$destination) {
                    $destination = str_replace('_', '/', $this->app->page);
                }
                $tmp = explode('/', $destination);
                array_pop($tmp);
                $destination = implode('/', $tmp);
                continue;
            }

            if ($component == 'index' && $destination == '') {
                $destination = $this->app->index_page;
                continue;
            }

            $destination = $destination ? $destination.'/'.$component : $component;
        }
        if ($destination === '') {
            $destination = @$this->app->index_page;
        }

        $this->page = $destination;

        // check if it's current page
        list($p, $ap) = str_replace('/', '_', array($this->page, $this->app->page));
        $this->_current = ($p == $ap); // page exactly match
        $this->_current_sub = ($p == substr($ap, 0, strlen($p)) && isset($ap[strlen($p)]) && $ap[strlen($p)] == '_'); // first part of page match followed by separator

        return $this;
    }
684599
public function makePageSnapshot(PageInterface $page)
    {
        foreach ($page->getLayoutBlock() as $layoutBlock) {
            $layoutBlockContent = $this->registry->getManagerForClass($layoutBlock->getClassType())->getRepository($layoutBlock->getClassType())->find(
                $layoutBlock->getObjectId()
            );
            $layoutBlock->takeSnapshot($this->serializer->serialize($layoutBlockContent, 'json'));
        }

        $pageSnapshotClass = $this->pageSnapshotManager->getClassName();

        /** @var \Networking\InitCmsBundle\Model\PageSnapshotInterface $pageSnapshot */
        $pageSnapshot = new $pageSnapshotClass($page);
        $pageSnapshot->setVersionedData($this->serializer->serialize($page, 'json'))
            ->setPage($page);

        if ($oldPageSnapshot = $page->getSnapshot()) {
            $snapshotContentRoute = $oldPageSnapshot->getContentRoute();
        } else {
            $contentRouteClass = $this->contentRouteManager->getClassName();
            /** @var \Networking\InitCmsBundle\Model\ContentRouteInterface $snapshotContentRoute */
            $snapshotContentRoute = new $contentRouteClass();
        }

        $pageSnapshot->setContentRoute($snapshotContentRoute);
        $pageSnapshot->setPath(self::getPageRoutePath($page->getPath()));

        $om = $this->registry->getManagerForClass($pageSnapshotClass);
        $om->persist($pageSnapshot);
        $om->flush();

        $snapshotContentRoute->setPath(self::getPageRoutePath($page->getPath()));
        $snapshotContentRoute->setObjectId($pageSnapshot->getId());

        if ($oldPageSnapshot && ($oldPageSnapshot->getPath() != self::getPageRoutePath($page->getPath()))) {
            $this->phpCache->clean();
        }

        $om = $this->registry->getManagerForClass(get_class($snapshotContentRoute));
        $om->persist($snapshotContentRoute);
        $om->flush();
    }
1025614
public function allowChildren(Page $page)
    {
        $models = $this->container->getParameter('fulgurio_light_cms.models');
        return $models[$page->getModel()]['allow_children'];
    }