@param Page

@return string
@throws \Exception
16694
public function getText(Page $page = null)
    {
        $text                = '';
        $sections            = $this->getSectionsText($this->content);
        $current_font = null;

        foreach ($this->document->getObjects() as $obj) {
            if ($obj instanceof Font) {
                $current_font = $obj;
                break;
            }
        }

        if ($current_font === null) {
            $current_font = new Font($this->document);
        }

        $current_position_td = array('x' => false, 'y' => false);
        $current_position_tm = array('x' => false, 'y' => false);

        array_push(self::$recursionStack, $this->getUniqueId());

        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':
                        $args = preg_split('/\s/s', $command[self::COMMAND]);
                        $y    = array_pop($args);
                        $x    = array_pop($args);
                        if ((floatval($x) <= 0) ||
                            ($current_position_td['y'] !== false && floatval($y) < floatval($current_position_td['y']))
                        ) {
                            // vertical offset
                            $text .= "\n";
                        } elseif ($current_position_td['x'] !== false && floatval($x) > floatval(
                                $current_position_td['x']
                            )
                        ) {
                            // horizontal offset
                            $text .= ' ';
                        }
                        $current_position_td = array('x' => $x, 'y' => $y);
                        break;

                    // move text current point and set leading
                    case 'TD':
                        $args = preg_split('/\s/s', $command[self::COMMAND]);
                        $y    = array_pop($args);
                        $x    = array_pop($args);
                        if (floatval($y) < 0) {
                            $text .= "\n";
                        } elseif (floatval($x) <= 0) {
                            $text .= ' ';
                        }
                        break;

                    case 'Tf':
                        list($id,) = preg_split('/\s/s', $command[self::COMMAND]);
                        $id           = trim($id, '/');
                        if (!is_null($page)) {
                            $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':
                        $text .= ' ';
                        break;

                    case 'Tm':
                        $args = preg_split('/\s/s', $command[self::COMMAND]);
                        $y    = array_pop($args);
                        $x    = array_pop($args);
                        if ($current_position_tm['x'] !== false) {
                            $delta = abs(floatval($x) - floatval($current_position_tm['x']));
                            if ($delta > 10) {
                                $text .= "\t";
                            }
                        }
                        if ($current_position_tm['y'] !== false) {
                            $delta = abs(floatval($y) - floatval($current_position_tm['y']));
                            if ($delta > 10) {
                                $text .= "\n";
                            }
                        }
                        $current_position_tm = array('x' => $x, 'y' => $y);
                        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), '/ ');
                            $xobject = $page->getXObject($id);


                             // @todo $xobject could be a ElementXRef object, which would then throw an error
                             if ( is_object($xobject) && $xobject instanceof PDFObject && !in_array($xobject->getUniqueId(), self::$recursionStack) ) {
                                // Not a circular reference.
                                $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:
                }
            }
        }

        array_pop(self::$recursionStack);

        return $text . ' ';
    }
729793
public static function setHomepage()
    {
        if(!self::$homepage) {
            $findHomePage = null;
            if (settings('homepageID')) {
                $findHomePage = (new Post())->setTable("post_pages")
                    ->where('postID', settings('homepageID'))
                    ->first();
            }

            // get the first found page if no homepage is defined
            if (!$findHomePage) {
                $findHomePage = (new Post())->setTable("post_pages")->first();
            }

            if(!$findHomePage) {
                throw new \Exception("No homepage found. Please add a page post!");
            }
            self::$homepage = $findHomePage;

        }

        return self::$homepage;
    }
374558
protected function _getPaginatedUrl($page)
    {
        $url = $this->_getSortUrl();

        if ($page > 1) {
            if (!isset($url['?'])) {
                $url['?'] = [];
            }
            $url['?']['p'] = $page;
        }

        return $url;
    }
875996
public function getPlans($page = '')
    {
        $planObjects = [];
        $plans = $this->getPlanResource()->getAll($page);

        if ($plans instanceof \Exception) {
            throw $plans;
        }

        foreach ($plans as $plan) {
            $planObject = new Plan($this->getPlanResource());
            $planObjects[] = $planObject->_setAttributes($plan);
        }

        return $planObjects;
    }
806515
public function getPageTemplates(HasPageTemplateInterface $page)
    {
        $pageTemplates = [];
        foreach ($page->getPageTemplates() as $pageTemplate) {
            if (is_string($pageTemplate)) {
                $pt = $this->parser->parse($pageTemplate);
            } elseif ($pageTemplate instanceof PageTemplateInterface) {
                $pt = $pageTemplate;
            } else {
                throw new \Exception("don't know how to handle the pageTemplate " . get_class($pageTemplate));
            }

            $pageTemplates[$pt->getName()] = $pt;
        }

        return $pageTemplates;
    }
2740
public function getTranslatedPageID($page)
    {
        $ids = static::getIDList();
        if (in_array($page->getCollectionID(), $ids)) {
            return $this->locale->getSiteTree()->getSiteHomePageID();
        }

        $mpRelationID = self::getMultilingualPageRelationID($page->getCollectionID());

        if ($mpRelationID) {
            $cID = self::getCollectionIDForLocale($mpRelationID, $this->getLocale());

            return $cID;
        }
    }
556596
public function page($page = null)
    {
        if (isset($page)) {
            $this->setPage($page);

            return $this;
        }

        return $this->getPage();
    }
165627
public function getTemplate(Page $page)
    {
        $this->authorize('editTemplate', $page);

        return view("$this->viewPrefix.template", [
            'current'   => $page->getTemplate(),
            'templates' => TemplateFacade::findValid(),
        ]);
    }
866552
protected function url($page)
    {
        if ($page <= 0) {
            $page = 1;
        }

        if (strpos($this->options['path'], '[PAGE]') === false) {
            $parameters = [$this->options['var_page'] => $page];
            $path       = $this->options['path'];
        } else {
            $parameters = [];
            $path       = str_replace('[PAGE]', $page, $this->options['path']);
        }

        if (count($this->options['query']) > 0) {
            $parameters = array_merge($this->options['query'], $parameters);
        }

        $url = $path;
        if (!empty($parameters)) {
            $url .= '?' . urldecode(http_build_query($parameters, null, '&'));
        }

        return $url . $this->buildFragment();
    }
280918
function Render()
    {
        self::$currentPage = $this->page;
        self::$Title = self::$currentPage->GetTitle();
        self::$Description = self::$currentPage->GetDescription();
        self::$Keywords = self::$currentPage->GetKeywords();
        if ($this->page->GetType() == (string)PageType::NotFound())
        {
            header('HTTP/1.0 404 Not Found');
        }
        else if ($this->page->GetType() !== (string)PageType::Normal())
        {
            throw new \Exception('Internal phine error: not normal page called');
        }
        ob_start();
        require PathUtil::LayoutTemplate($this->layout);
        $result = ob_get_clean();
        $replacer = new Replacer();
        return $replacer->RealizeVariables($result);
    }
1033565
public function getText(Page $page = null)
    {
        $header   = new Header(array(), $this->document);
        $contents = new PDFObject($this->document, $header, $this->content);

        return $contents->getText($this);
    }
22731
public function getUrl($page)
	{
		$parameters = array(
			$this->env->getPageName() => $page,
		);

		// If we have any extra query string key / value pairs that need to be added
		// onto the URL, we will put them in query string form and then attach it
		// to the URL. This allows for extra information like sortings storage.
		if (count($this->query) > 0)
		{
			$parameters = array_merge($parameters, $this->query);
		}

		$fragment = $this->buildFragment();

		return $this->env->getCurrentUrl().'?'.http_build_query($parameters, null, '&').$fragment;
	}
455532
public function get_page() {

        // unless page was not specifically set through the "set_page" method
        if (!$this->_properties['page_set']) {

            // if
            if (

                // page propagation is SEO friendly
                $this->_properties['method'] == 'url' &&

                // the current page is set in the URL
                preg_match('/\b' . preg_quote($this->_properties['variable_name']) . '([0-9]+)\b/i', $_SERVER['REQUEST_URI'], $matches) > 0

            )

                // set the current page to whatever it is indicated in the URL
                $this->set_page((int)$matches[1]);

            // if page propagation is done through GET and the current page is set in $_GET
            elseif (isset($_GET[$this->_properties['variable_name']]))

                // set the current page to whatever it was set to
                $this->set_page((int)$_GET[$this->_properties['variable_name']]);

        }

        // if showing records in reverse order we must know the total number of records and the number of records per page
        // *before* calling the "get_page" method
        if ($this->_properties['reverse'] && $this->_properties['records'] == '') trigger_error('When showing records in reverse order you must specify the total number of records (by calling the "records" method) *before* the first use of the "get_page" method!', E_USER_ERROR);

        if ($this->_properties['reverse'] && $this->_properties['records_per_page'] == '') trigger_error('When showing records in reverse order you must specify the number of records per page (by calling the "records_per_page" method) *before* the first use of the "get_page" method!', E_USER_ERROR);

        // get the total number of pages
        $this->_properties['total_pages'] = $this->get_pages();

        // if there are any pages
        if ($this->_properties['total_pages'] > 0) {

            // if current page is beyond the total number pages
            /// make the current page be the last page
            if ($this->_properties['page'] > $this->_properties['total_pages']) $this->_properties['page'] = $this->_properties['total_pages'];

            // if current page is smaller than 1
            // make the current page 1
            elseif ($this->_properties['page'] < 1) $this->_properties['page'] = 1;

        }

        // if we're just starting and we have to display links in reverse order
        // set the first to the last one rather then first
        if (!$this->_properties['page_set'] && $this->_properties['reverse']) $this->set_page($this->_properties['total_pages']);

        // return the current page
        return $this->_properties['page'];

    }
565389
public function getSiteNameForPage(\Concrete\Core\Page\Page $page)
    {
        static $multilingual;
        static $defaultLocale;

        if (!isset($multilingual)) {
            $multilingual = $this->app->make('multilingual/detector')->isEnabled();
        }
        if ($multilingual) {
            if (!isset($defaultLocale)) {
                $defaultLocale = $this->app->make('config')->get('concrete.locale') ?: Localization::BASE_LOCALE;
            }
            $section = Section::getBySectionOfSite($page);
            if ($section) {
                $locale = $section->getLocale();
            } else {
                $locale = $defaultLocale;
            }
            $siteName = $this->getSiteNameForLocale($locale);
        } else {
            $siteName = $this->app->make('site')->getSite()->getSiteName();
        }

        return $siteName;
    }
1018109
public function page($page = null) {
		if ($page) {
			$this->_config['page'] = $page = ((integer) $page ?: 1);
			$this->offset(($page - 1) * $this->_config['limit']);
			return $this;
		}
		return $this->_config['page'];
	}
840693
public function getUrl($page)
    {
        $request = Craft::$app->getRequest();

        // Get the query string params without the path or `pattern`
        parse_str($request->getQueryString(), $params);
        $pathParam = Craft::$app->getConfig()->getGeneral()->pathParam;
        unset($params[$pathParam], $params['pattern']);

        // Return the URL with the page param
        $params[$this->pageParam] = $page;
        return UrlHelper::url($request->getPathInfo(), $params);
    }
1272539
public function getPageConfig(string $page)
    {
        if (!array_key_exists($page, $this->config['pages'])) {
            throw new InvalidPageException(
                sprintf(
                    'Page "%s" not found in current configuration. Available pages are: "%s"',
                    $page,
                    implode('", "', array_keys($this->config['pages']))
                )
            );
        }

        return (array) $this->config['pages'][$page];
    }