Returns computed metadata from provided $page.

@param  Page|NULL $page

@return MetaDataBag
428054
public function resolve(Page $page = null)
    {
        if (null === $page || (null === $metadataBag = $page->getMetaData())) {
            $metadataBag = new MetaDataBag();
        }

        if (!is_array($this->definitions)) {
            return $metadataBag;
        }

        foreach ($this->definitions as $name => $definition) {
            if (!is_array($definition)) {
                continue;
            }

            if (null === $metadata = $metadataBag->get($name)) {
                $metadata = new MetaData($name);
                $metadataBag->add($metadata);
            }

            $this->parseDefinition($definition, $metadata, $page);
        }

        return clone $metadataBag;
    }
202136
public function getTextArray(Page $page = null)
	{
		$text                = array();
		$sections            = $this->getSectionsText($this->content);
		$current_font        = new Font($this->document);

		foreach ($sections as $section) {

			$commands = $this->getCommandsText($section);

			foreach ($commands as $command) {

				switch ($command[self::OPERATOR]) {
					// set character spacing
					case 'Tc':
						break;

					// move text current point
					case 'Td':
						break;

					// move text current point and set leading
					case 'TD':
						break;

					case 'Tf':
						list($id,) = preg_split('/\s/s', $command[self::COMMAND]);
						$id           = trim($id, '/');
						$current_font = $page->getFont($id);
						break;

					case "'":
					case 'Tj':
						$command[self::COMMAND] = array($command);
					case 'TJ':
						// Skip if not previously defined, should never happened.
						if (is_null($current_font)) {
							// Fallback
							// TODO : Improve
							$text[] = $command[self::COMMAND][0][self::COMMAND];
							break;
						}

						$sub_text = $current_font->decodeText($command[self::COMMAND]);
						$text[] = $sub_text;
						break;

					// set leading
					case 'TL':
						break;

					case 'Tm':
						break;

					// set super/subscripting text rise
					case 'Ts':
						break;

					// set word spacing
					case 'Tw':
						break;

					// set horizontal scaling
					case 'Tz':
						//$text .= "\n";
						break;

					// move to start of next line
					case 'T*':
						//$text .= "\n";
						break;

					case 'Da':
						break;

					case 'Do':
						if (!is_null($page)) {
							$args = preg_split('/\s/s', $command[self::COMMAND]);
							$id   = trim(array_pop($args), '/ ');
							if ($xobject = $page->getXObject($id)) {
								$text[] = $xobject->getText($page);
							}
						}
						break;

					case 'rg':
					case 'RG':
						break;

					case 're':
						break;

					case 'co':
						break;

					case 'cs':
						break;

					case 'gs':
						break;

					case 'en':
						break;

					case 'sc':
					case 'SC':
						break;

					case 'g':
					case 'G':
						break;

					case 'V':
						break;

					case 'vo':
					case 'Vo':
						break;

					default:
				}
			}
		}

		return $text;
	}
1117326
private function getPageByPost($page, $data = null)
    {
        $url = $this->url . $page;
        // The new API allows JSON, so we can pass
        // PHP data structures instead of old school POST
        $json = json_encode($data);

        // cURL init & config
        $handle = curl_init();
        curl_setopt($handle, CURLOPT_URL, $url);
        curl_setopt($handle, CURLOPT_RETURNTRANSFER, true);
        curl_setopt($handle, CURLOPT_POST, 1);
        curl_setopt($handle, CURLOPT_USERAGENT, $this->userAgent);
        curl_setopt($handle, CURLOPT_VERBOSE, $this->verbose);
        curl_setopt($handle, CURLOPT_FOLLOWLOCATION, 1);
        curl_setopt($handle, CURLOPT_USERPWD, $this->authToken . ':x');
        curl_setopt($handle, CURLOPT_HTTPHEADER, array("Content-type: application/json"));
        curl_setopt($handle, CURLOPT_COOKIEFILE, $this->cookie);

        curl_setopt($handle, CURLOPT_POSTFIELDS, $json);
        $output = curl_exec($handle);

        curl_close($handle);

        // We tend to get one space with an otherwise blank response
        $output = trim($output);

        if (strlen($output)) {
            /* Responses are JSON. Decode it to a data structure */
            return json_decode($output);
        }

        // Simple 200 OK response (such as for joining a room)
        return true;
    }
1285778
public function get($pages = 0)
    {
        $endpoint = $this->getEndpoint();
        $params = $this->getParams();
        $list = $this->getClient()->request($endpoint, 'GET', $params);

        $i = 1;
        while ($list['metadata']['continue']) {
            if ($pages > 0 && $pages >= $i) {
                return $list;
            }
            $params['continue'] = $list['metadata']['continue'];
            $i_list = $this->getClient()->request($endpoint, 'GET', $params);
            $i_list['items'] = array_merge($list['items'], $i_list['items']);
            $list = $i_list;
            unset($i_list);
            $i++;
        }

        return $list;
    }
1189929
private function addMeta($page, $key, $value)
    {
        $meta = new PageMeta();
        $meta->setMetaKey($key);
        $meta->setMetaValue($value);
        $meta->setPage($page);
        return $meta;
    }
302708
public function getMentions($page = 1)
    {
        $this->checkPageNumber($page);

        return $this->adapter->get(sprintf('/tracker/mentions?page=%d', $page));
    }
1291910
static function FindPageRights(Page $page)
    {
        $currPage = $page;
        $result = null;
        do 
        {
            $result = $currPage->GetUserGroupRights();
            $currPage = $currPage->GetParent();
        } 
        while (!$result && $currPage);
        if (!$result && $page->GetSite())
        {
            $siteRights = $page->GetSite()->GetUserGroupRights();
            if ($siteRights)
            {
                return $siteRights->GetPageRights();
            }
        }
        return $result;
    }
742628
public static function startPage($page = null)
    {
        if ($page !== null) {
            self::$_startPage = $page;
        }
        return self::$_startPage;
    }
8094
protected function loadStaticPage($page)
    {
        $layout = $this->layout ?: $this;
        try {
            $t = 'page/'.str_replace('_', '/', strtolower($page));
            $this->template->findTemplate($t);

            $this->page_object = $layout->add($this->page_class, $page, 'Content', array($t));
        } catch (Exception_PathFinder $e2) {
            $t = 'page/'.strtolower($page);
            $this->template->findTemplate($t);
            $this->page_object = $layout->add($this->page_class, $page, 'Content', array($t));
        }

        return $this->page_object;
    }
1224182
public static function getBySectionOfSite($page)
    {
        $identifier = sprintf('/multilingual/section/%s', $page->getCollectionID());
        $cache = \Core::make('cache/request');
        $item = $cache->getItem($identifier);
        if (!$item->isMiss()) {
            $returnID = $item->get();
        } else {

            $item->lock();

            $returnID = false;

            if ($page->isPageDraft()) {
                $tree = false;
                if ($page->getPageDraftTargetParentPageID()) {
                    $cParentID = $page->getPageDraftTargetParentPageID();
                    if ($cParentID) {
                        $parent = Page::getByID($cParentID);
                        $tree = $parent->getSiteTreeObject();
                    }
                }
            }

            if (!isset($tree)) {
                $tree = $page->getSiteTreeObject();
            }

            if ($tree instanceof SiteTree) {
                $returnID = $tree->getSiteHomePageID();
            }

            $cache->save($item->set($returnID));
        }

        if ($returnID) {
            return static::getByID($returnID);
        }
    }
1329610
public function getParameters($page = null, $limit = null)
    {
        $params = $this->params;

        $params[$this->pageParam]  = null == $page  ? $this->getPage()  : $page;
        $params[$this->limitParam] = null == $limit ? $this->getLimit() : $limit;

        return $params;
    }
1302000
protected function updatePageMetas(Page $page, array $data)
    {
        $em = $this->doctrine->getManager();
        if (isset($data['meta_keywords']))
        {
            $em->persist($this->initMetaEntity($page, 'meta_keywords', trim($data['meta_keywords'])));
        }
        if (isset($data['meta_description']))
        {
            $em->persist($this->initMetaEntity($page, 'meta_description', trim($data['meta_description'])));
        }
    }
877971
protected function getPage($page)
    {
        // Handle passed cID
        if (is_numeric($page)) {
            return Page::getByID($page);
        }

        // Handle passed /path/to/collection
        if (is_string($page)) {
            return Page::getByPath($page);
        }

        // 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());
        }
    }
704903
protected function getPageItemChangedTime(array $page)
    {
        if (!empty($page['content_from_pid'])) {
            // canonical page, get the original page's last changed time
            return $this->queueItemRepository->getPageItemChangedTimeByPageUid((int)$page['content_from_pid']);
        }
        return $this->queueItemRepository->getPageItemChangedTimeByPageUid((int)$page['uid']);
    }
909229
public function page($page = null) {
        if ($page === null) {
            return $this->page;
        }

        $this->page = (int) $page;

        return $this;
    }
107745
public function putMetadataAction(Page $page, Request $request)
    {
        $metadatas = $this->application
                ->getContainer()
                ->get('nestednode.metadata.resolver')
                ->resolve($page);

        foreach ($request->request->all() as $name => $attributes) {
            if ($metadatas->has($name)) {
                foreach ($attributes as $attr_name => $attr_value) {
                    if ($attr_value !== $metadatas->get($name)->getAttribute($attr_name)) {
                        $metadatas->get($name)->setAttribute($attr_name, $attr_value, null, false);
                    }
                }
            }
        }

        $page->setMetaData($metadatas);
        $this->getApplication()->getEntityManager()->flush();

        return $this->createJsonResponse(null, 204);
    }
668750
public function getOnlinePrevSibling(Page $page)
    {
        $query = $this->createQueryBuilder('p')
                ->andIsSiblingsOf($page, true, ['_leftnode' => 'DESC', '_position' => 'DESC'], 1, 0)
                ->andIsOnline();

        if (true === $page->hasMainSection()) {
            $query->andIsSection()
                    ->andWhere($query->getSectionAlias().'._leftnode < :leftnode')
                    ->setParameter('leftnode', $page->getLeftnode());
        } else {
            $qOR = $query->expr()->orX();
            $qOR->add('p._section != p')
                    ->add($query->getSectionAlias().'._parent = :parent');

            $query->andWhere('p._position < :position')
                    ->andWhere($qOR)
                    ->setParameter('position', $page->getPosition())
                    ->setParameter('parent', $page->getParent()->getSection());
        }

        return $query->getQuery()
                        ->getOneOrNullResult();
    }