lib/Pico.php
protected function readPages()
    {
        $contentDir = $this->getConfig('content_dir');
        $contentExt = $this->getConfig('content_ext');

        $this->pages = array();
        $files = $this->getFiles($contentDir, $contentExt, self::SORT_NONE);
        foreach ($files as $i => $file) {
            // skip 404 page
            if (basename($file) === '404' . $contentExt) {
                unset($files[$i]);
                continue;
            }

            $id = substr($file, strlen($contentDir), -strlen($contentExt));

            // trigger onSinglePageLoading event
            // skip inaccessible pages (e.g. drop "sub.md" if "sub/index.md" exists) by default
            $conflictFile = $contentDir . $id . '/index' . $contentExt;
            $skipFile = in_array($conflictFile, $files, true) ?: null;
            $this->triggerEvent('onSinglePageLoading', array($id, &$skipFile));

            if ($skipFile) {
                continue;
            }

            $url = $this->getPageUrl($id);
            if ($file !== $this->requestFile) {
                $rawContent = $this->loadFileContent($file);

                // trigger onSinglePageContent event
                $this->triggerEvent('onSinglePageContent', array($id, &$rawContent));

                $headers = $this->getMetaHeaders();
                try {
                    $meta = $this->parseFileMeta($rawContent, $headers);
                } catch (\Symfony\Component\Yaml\Exception\ParseException $e) {
                    $meta = $this->parseFileMeta('', $headers);
                    $meta['YAML_ParseError'] = $e->getMessage();
                }
            } else {
                $rawContent = &$this->rawContent;
                $meta = &$this->meta;
            }

            // build page data
            // title, description, author and date are assumed to be pretty basic data
            // everything else is accessible through $page['meta']
            $page = array(
                'id' => $id,
                'url' => $url,
                'title' => &$meta['title'],
                'description' => &$meta['description'],
                'author' => &$meta['author'],
                'time' => &$meta['time'],
                'date' => &$meta['date'],
                'date_formatted' => &$meta['date_formatted'],
                'hidden' => (preg_match('/(?:^|\/)_/', $id) || $meta['hidden']),
                'raw_content' => &$rawContent,
                'meta' => &$meta
            );

            if ($file === $this->requestFile) {
                $page['content'] = &$this->content;
            }

            unset($rawContent, $meta);

            // trigger onSinglePageLoaded event
            $this->triggerEvent('onSinglePageLoaded', array(&$page));

            if ($page !== null) {
                $this->pages[$id] = $page;
            }
        }
    }
protected function readPages()
    {
        $contentDir = $this->getConfig('content_dir');
        $contentExt = $this->getConfig('content_ext');

        $this->pages = array();
        $files = $this->getFiles($contentDir, $contentExt, self::SORT_NONE);
        foreach ($files as $i => $file) {
            // skip 404 page
            if (basename($file) === '404' . $contentExt) {
                unset($files[$i]);
                continue;
            }

            $id = substr($file, strlen($contentDir), -strlen($contentExt));

            // trigger onSinglePageLoading event
            // skip inaccessible pages (e.g. drop "sub.md" if "sub/index.md" exists) by default
            $conflictFile = $contentDir . $id . '/index' . $contentExt;
            $skipFile = in_array($conflictFile, $files, true) ?: null;
            $this->triggerEvent('onSinglePageLoading', array($id, &$skipFile));

            if ($skipFile) {
                continue;
            }

            $url = $this->getPageUrl($id);
            if ($file !== $this->requestFile) {
                $rawContent = $this->loadFileContent($file);

                // trigger onSinglePageContent event
                $this->triggerEvent('onSinglePageContent', array($id, &$rawContent));

                $headers = $this->getMetaHeaders();
                try {
                    $meta = $this->parseFileMeta($rawContent, $headers);
                } catch (\Symfony\Component\Yaml\Exception\ParseException $e) {
                    $meta = $this->parseFileMeta('', $headers);
                    $meta['YAML_ParseError'] = $e->getMessage();
                }
            } else {
                $rawContent = &$this->rawContent;
                $meta = &$this->meta;
            }

            // build page data
            // title, description, author and date are assumed to be pretty basic data
            // everything else is accessible through $page['meta']
            $page = array(
                'id' => $id,
                'url' => $url,
                'title' => &$meta['title'],
                'description' => &$meta['description'],
                'author' => &$meta['author'],
                'time' => &$meta['time'],
                'date' => &$meta['date'],
                'date_formatted' => &$meta['date_formatted'],
                'hidden' => (preg_match('/(?:^|\/)_/', $id) || $meta['hidden']),
                'raw_content' => &$rawContent,
                'meta' => &$meta
            );

            if ($file === $this->requestFile) {
                $page['content'] = &$this->content;
            }

            unset($rawContent, $meta);

            // trigger onSinglePageLoaded event
            $this->triggerEvent('onSinglePageLoaded', array(&$page));

            if ($page !== null) {
                $this->pages[$id] = $page;
            }
        }
    }
protected function readPages ( ) { $ contentDir = $ this -> getConfig ( 'content_dir' ) ; $ contentExt = $ this -> getConfig ( 'content_ext' ) ; $ this -> pages = array ( ) ; $ files = $ this -> getFiles ( $ contentDir , $ contentExt , self :: SORT_NONE ) ; foreach ( $ files as $ i => $ file ) { // skip 404 page if ( basename ( $ file ) === '404' . $ contentExt ) { unset ( $ files [ $ i ] ) ; continue ; } $ id = substr ( $ file , strlen ( $ contentDir ) , - strlen ( $ contentExt ) ) ; // trigger onSinglePageLoading event // skip inaccessible pages (e.g. drop "sub.md" if "sub/index.md" exists) by default $ conflictFile = $ contentDir . $ id . '/index' . $ contentExt ; $ skipFile = in_array ( $ conflictFile , $ files , true ) ? : null ; $ this -> triggerEvent ( 'onSinglePageLoading' , array ( $ id , & $ skipFile ) ) ; if ( $ skipFile ) { continue ; } $ url = $ this -> getPageUrl ( $ id ) ; if ( $ file !== $ this -> requestFile ) { $ rawContent = $ this -> loadFileContent ( $ file ) ; // trigger onSinglePageContent event $ this -> triggerEvent ( 'onSinglePageContent' , array ( $ id , & $ rawContent ) ) ; $ headers = $ this -> getMetaHeaders ( ) ; try { $ meta = $ this -> parseFileMeta ( $ rawContent , $ headers ) ; } catch ( \ Symfony \ Component \ Yaml \ Exception \ ParseException $ e ) { $ meta = $ this -> parseFileMeta ( '' , $ headers ) ; $ meta [ 'YAML_ParseError' ] = $ e -> getMessage ( ) ; } } else { $ rawContent = & $ this -> rawContent ; $ meta = & $ this -> meta ; } // build page data // title, description, author and date are assumed to be pretty basic data // everything else is accessible through $page['meta'] $ page = array ( 'id' => $ id , 'url' => $ url , 'title' => & $ meta [ 'title' ] , 'description' => & $ meta [ 'description' ] , 'author' => & $ meta [ 'author' ] , 'time' => & $ meta [ 'time' ] , 'date' => & $ meta [ 'date' ] , 'date_formatted' => & $ meta [ 'date_formatted' ] , 'hidden' => ( preg_match ( '/(?:^|\/)_/' , $ id ) || $ meta [ 'hidden' ] ) , 'raw_content' => & $ rawContent , 'meta' => & $ meta ) ; if ( $ file === $ this -> requestFile ) { $ page [ 'content' ] = & $ this -> content ; } unset ( $ rawContent , $ meta ) ; // trigger onSinglePageLoaded event $ this -> triggerEvent ( 'onSinglePageLoaded' , array ( & $ page ) ) ; if ( $ page !== null ) { $ this -> pages [ $ id ] = $ page ; } } }
Reads the data of all pages known to Pico

The page data will be an array containing the following values:

| Array key      | Type     | Description                              |
| -------------- | -------  | ---------------------------------------- |
| id             | string   | relative path to the content file        |
| url            | string   | URL to the page                          |
| title          | string   | title of the page (YAML header)          |
| description    | string   | description of the page (YAML header)    |
| author         | string   | author of the page (YAML header)         |
| time           | int      | timestamp derived from the Date header   |
| date           | string   | date of the page (YAML header)           |
| date_formatted | string   | formatted date of the page               |
| hidden         | bool     | this page shouldn't be visible           |
| raw_content    | string   | raw, not yet parsed contents of the page |
| meta           | string[] | parsed meta data of the page             |
| previous_page  | &array[] | reference to the previous page           |
| next_page      | &array[] | reference to the next page               |
| tree_node      | &array[] | reference to the page's tree node        |

Please note that the `previous_page` and `next_page` keys don't
exist until the `onCurrentPageDiscovered` event is triggered
({@see Pico::discoverPageSiblings()}). The `tree_node` key doesn't
exit until the `onPageTreeBuilt` event is triggered
({@see Pico::buildPageTree()}).

@see Pico::sortPages()
@see Pico::discoverPageSiblings()
@see Pico::getPages()

@return void
Reads the data of all pages known to Pico