Loads a source file.

@param string $page The page to load.
@return SourceFile
8344
public function getSourceFile($page)
    {
        $path = realpath($this->generator->getInputDirectory() . '/' . $page . '.xml');

        return new SourceFile($page, $path);
    }
1153172
public function load($url)
    {
        if (file_exists($url)) {
            return $this->validate($url);
        }

        if (preg_match('#^(https?|spdy)://#', $url)) {

            if ($file = $this->loadRemoteFile($url)) {
                return $this->validate($file);
            }
        }

        throw new ImageResourceLoaderException(sprintf('Invalid Source URL: %s', $url));
    }
801929
public static function page($page = null)
    {
        if ($page !== null) {
            self::$_page = $page;
        }
        return self::$_page;
    }
530748
function page($page, $limit = null, $offset = 0) {
		if ($page === null || $limit === null) {
			// retrieve all rows
			$this->num(':offset', $offset);
			$this->num(':count', PHP_INT_MAX);
		}
		else { // $page != null
			$this->num(':offset', $limit * ($page - 1) + $offset);
			$this->num(':count', $limit);
		}

		return $this;
	}
323069
public function getPageUrl($page){
        $qs = '';
        if($_SERVER['QUERY_STRING']){
            $qs = '?' . $_SERVER['QUERY_STRING'];
        }//if
        return str_replace($this->fromFormat($this->currentPage),$this->fromFormat($page),$this->uri) . $qs;
    }
742628
public static function startPage($page = null)
    {
        if ($page !== null) {
            self::$_startPage = $page;
        }
        return self::$_startPage;
    }
757896
public function getFeedNew($page = 1)
    {
        $this->checkPageNumber($page);

        return $this->adapter->get(sprintf('/feed/new?page=%d', $page));
    }
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];
    }
845239
public function loadString($source, $url = null)
    {
        $name = crc32($url ?: $source);

        if(!$file = $this->isCached($name))
        {
            //Compile the template
            $source = $this->_compile($source);

            if($source === false) {
                throw new RuntimeException(sprintf('The template content cannot be compiled.'));
            }

            $file = $this->cache($name, $source);
        }

        $this->_source = $file;

        //Push the template on the stack
        array_push($this->_stack, $url);

        //Store the location
        if($url) {
            $this->_locations[$url] = $file;
        }

        return $this;
    }
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();
    }
1346763
public function base($page) {
        if (!$this->urls) {
            $urls = [];
            if ($this->ogpath) {
                $urls [0] = implode('', [WWWROOT_DIR, $this->ogpath, '/', $this->ogname]);
            } else {
                $urls [0] = implode('', [WWWROOT_DIR, $this->ogname]);
            }
            $urls [1] = '';
            $suffix   = [];
            if ($this->ext) {
                $suffix [] = '.';
                $suffix [] = $this->ext;
            }
            if ($this->params) {
                $suffix [] = '?';
                $suffix [] = http_build_query($this->params, 'n');
            }
            if ($suffix) {
                $urls[2] = implode('', $suffix);
            }
            $this->urls = $urls;
        }
        if ($page > 1 || $page == 'all') {
            $this->urls [1] = '_' . $page;
        }
        $url            = implode('', $this->urls);
        $this->urls [1] = '';

        return $url;
    }
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'];
	}
447688
protected function _load($url)
    {
        $file = $this->_locate($url);
        $type = pathinfo($file, PATHINFO_EXTENSION);

        if(in_array($type, $this->getFileTypes()))
        {
            if(!$this->_source = file_get_contents($file)) {
                throw new RuntimeException(sprintf('The template "%s" cannot be loaded.', $file));
            }
        }
        else $this->_source = $this->getTemplate()->loadFile($file)->render($this->getData());

        return $this->_source;
    }
174274
public function getText(Page $page = null)
    {
        if ($contents = $this->get('Contents')) {

            if ($contents instanceof ElementMissing) {
                return '';
			} elseif ($contents instanceof ElementNull) {
				return '';
            } elseif ($contents instanceof PDFObject) {
                $elements = $contents->getHeader()->getElements();

                if (is_numeric(key($elements))) {
                    $new_content = '';

                    foreach ($elements as $element) {
                        if ($element instanceof ElementXRef) {
                            $new_content .= $element->getObject()->getContent();
                        } else {
                            $new_content .= $element->getContent();
                        }
                    }

                    $header   = new Header(array(), $this->document);
                    $contents = new PDFObject($this->document, $header, $new_content);
                }
            } elseif ($contents instanceof ElementArray) {
                // Create a virtual global content.
                $new_content = '';

                foreach ($contents->getContent() as $content) {
                    $new_content .= $content->getContent() . "\n";
                }

                $header   = new Header(array(), $this->document);
                $contents = new PDFObject($this->document, $header, $new_content);
            }

            return $contents->getText($this);
        }

        return '';
    }
1295041
public function get($page = 1)
    {
        $index = $page - 1;

        if (!isset($this->pages[$index])) {
            throw new RuntimeException(sprintf('Invalid page %s of %s', $page, $this->count()));
        }

        return $this->pages[$index];
    }
799020
public function setApplicationPage($page)
    {
        if (null !== $page) {
            Assert::string($page, 'The application page must be a string or null. Got: %s');
            Assert::notEmpty($page, 'The application page must not be empty.');
        }

        $this->applicationPage = $page;
    }
915107
public function load()
    {
        // NOTE: ALL THE LOCAL VARIABLES ARE USED INSIDE INCLUDED FILE, DO NOT REMOVE THEM!
        $grav = $this->grav;
        $config = $this->config;
        $name = $this->current();

        /** @var UniformResourceLocator $locator */
        $locator = $grav['locator'];
        $file = $locator('theme://theme.php') ?: $locator("theme://{$name}.php");

        $inflector = $grav['inflector'];

        if ($file) {
            // Local variables available in the file: $grav, $config, $name, $file
            $class = include $file;

            if (!is_object($class)) {
                $themeClassFormat = [
                    'Grav\\Theme\\' . ucfirst($name),
                    'Grav\\Theme\\' . $inflector->camelize($name)
                ];

                foreach ($themeClassFormat as $themeClass) {
                    if (class_exists($themeClass)) {
                        $themeClassName = $themeClass;
                        $class = new $themeClassName($grav, $config, $name);
                        break;
                    }
                }
            }
        } elseif (!$locator('theme://') && !defined('GRAV_CLI')) {
            exit("Theme '$name' does not exist, unable to display page.");
        }

        $this->config->set('theme', $config->get('themes.' . $name));

        if (empty($class)) {
            $class = new Theme($grav, $config, $name);
        }

        return $class;
    }