Свойство | Type | Description | |
---|---|---|---|
$config | array | null | Current configuration of this Pico instance | |
$configDir | string | Config directory of this Pico instance | |
$content | string | null | Parsed content being served | |
$currentPage | array | null | Data of the page being served | |
$locked | boolean | Boolean indicating whether Pico started processing yet | |
$meta | array | null | Meta data of the page to serve | |
$nextPage | array | null | Data of the next page relative to the page being served | |
$pages | array[] | null | List of known pages | |
$parsedown | ParsedownExtra | null | Parsedown Extra instance used for markdown parsing | |
$plugins | object[] | null | List of loaded plugins | |
$pluginsDir | string | Plugins directory of this Pico instance | |
$previousPage | array | null | Data of the previous page relative to the page being served | |
$rawContent | string | null | Raw, not yet parsed contents to serve | |
$requestFile | string | null | Absolute path to the content file being served | |
$requestUrl | string | null | Part of the URL describing the requested contents | |
$rootDir | string | Root directory of this Pico instance | |
$themesDir | string | Themes directory of this Pico instance | |
$twig | Twig_Environment | null | Twig instance used for template parsing | |
$twigVariables | array | null | Variables passed to the twig template |
Méthode | Description | |
---|---|---|
__construct ( string $rootDir, string $configDir, string $pluginsDir, string $themesDir ) | Constructs a new Pico instance | |
getAbsolutePath ( string $path ) : string | Makes a relative path absolute to Pico's root dir | |
getBaseUrl ( ) : string | Returns the base URL of this Pico instance | |
getConfig ( string $configName = null ) : mixed | Returns either the value of the specified config variable or the config array | |
getConfigDir ( ) : string | Returns the config directory of this Pico instance | |
getCurrentPage ( ) : array | null | Returns the data of the requested page | |
getFileContent ( ) : string | null | Returns the cached contents of the requested page | |
getFileMeta ( ) : array | null | Returns the parsed meta data of the requested page | |
getMetaHeaders ( ) : string[] | Returns known meta headers and triggers the onMetaHeaders event | |
getNextPage ( ) : array | null | Returns the data of the next page relative to the page being served | |
getPageUrl ( string $page, array | string $queryData = null ) : string | Returns the URL to a given page | |
getPages ( ) : array[] | null | Returns the list of known pages | |
getParsedown ( ) : ParsedownExtra | null | Returns the Parsedown Extra markdown parser | |
getPlugin ( string $pluginName ) : object | Returns the instance of a named plugin | |
getPlugins ( ) : object[] | null | Returns all loaded plugins | |
getPluginsDir ( ) : string | Returns the plugins directory of this Pico instance | |
getPreviousPage ( ) : array | null | Returns the data of the previous page relative to the page being served | |
getRawContent ( ) : string | null | Returns the raw contents, either of the requested or the 404 file | |
getRequestFile ( ) : string | null | Returns the absolute path to the content file to serve | |
getRequestUrl ( ) : string | null | Returns the URL where a user requested the page | |
getRootDir ( ) : string | Returns the root directory of this Pico instance | |
getThemesDir ( ) : string | Returns the themes directory of this Pico instance | |
getTwig ( ) : Twig_Environment | null | Returns the twig template engine | |
isUrlRewritingEnabled ( ) : boolean | Returns true if URL rewriting is enabled | |
load404Content ( string $file ) : string | Returns the raw contents of the first found 404 file when traversing up from the directory the requested file is in | |
loadFileContent ( string $file ) : string | Returns the raw contents of a file | |
parseFileContent ( string $content ) : string | Parses the contents of a page using ParsedownExtra | |
parseFileMeta ( string $rawContent, array $headers ) : array | Parses the file meta from raw file contents | |
prepareFileContent ( string $rawContent, array $meta ) : string | Applies some static preparations to the raw contents of a page, e.g. removing the meta header and replacing %base_url% | |
run ( ) : string | Runs this Pico instance | |
setConfig ( array $config ) : void | Sets Pico's config before calling Pico::run() |
Méthode | Description | |
---|---|---|
discoverCurrentPage ( ) : void | Walks through the list of known pages and discovers the requested page as well as the previous and next page relative to it | |
discoverRequestFile ( ) : void | Uses the request URL to discover the content file to serve | |
evaluateRequestUrl ( ) : void | Evaluates the requested URL | |
getFiles ( string $directory, string $fileExtension = '', integer $order = self::SORT_ASC ) : array | Recursively walks through a directory and returns all containing files matching the specified file extension | |
getTwigVariables ( ) : array | Returns the variables passed to the template | |
loadConfig ( ) : void | Loads the config.php from Pico::$configDir | |
loadPlugins ( ) : void | Loads plugins from Pico::$pluginsDir in alphabetical order | |
readPages ( ) : void | Reads the data of all pages known to Pico | |
registerParsedown ( ) : void | Registers the Parsedown Extra markdown parser | |
registerTwig ( ) : void | Registers the twig template engine | |
sortPages ( ) : void | Sorts all pages known to Pico | |
triggerEvent ( string $eventName, array $params = [] ) : void | Triggers events on plugins which implement PicoPluginInterface |
public __construct ( string $rootDir, string $configDir, string $pluginsDir, string $themesDir ) | ||
$rootDir | string | root directory of this Pico instance |
$configDir | string | config directory of this Pico instance |
$pluginsDir | string | plugins directory of this Pico instance |
$themesDir | string | themes directory of this Pico instance |
protected discoverCurrentPage ( ) : void | ||
Résultat | void |
protected discoverRequestFile ( ) : void | ||
Résultat | void |
protected evaluateRequestUrl ( ) : void | ||
Résultat | void |
public getAbsolutePath ( string $path ) : string | ||
$path | string | relative or absolute path |
Résultat | string | absolute path |
public getBaseUrl ( ) : string | ||
Résultat | string | the base url |
public getConfigDir ( ) : string | ||
Résultat | string | config directory path |
public getCurrentPage ( ) : array | null | ||
Résultat | array | null | page data |
public getFileContent ( ) : string | null | ||
Résultat | string | null | parsed contents |
public getFileMeta ( ) : array | null | ||
Résultat | array | null | parsed meta data |
protected getFiles ( string $directory, string $fileExtension = '', integer $order = self::SORT_ASC ) : array | ||
$directory | string | start directory |
$fileExtension | string | return files with the given file extension only (optional) |
$order | integer | specify whether and how files should be sorted; use Pico::SORT_ASC for a alphabetical ascending order (this is the default behaviour), Pico::SORT_DESC for a descending order or Pico::SORT_NONE to leave the result unsorted |
Résultat | array | list of found files |
public getMetaHeaders ( ) : string[] | ||
Résultat | string[] | known meta headers; the array value specifies the YAML key to search for, the array key is later used to access the found value |
public getNextPage ( ) : array | null | ||
Résultat | array | null | page data |
public getParsedown ( ) : ParsedownExtra | null | ||
Résultat | ParsedownExtra | null | Parsedown Extra markdown parser |
public getPlugins ( ) : object[] | null | ||
Résultat | object[] | null |
public getPluginsDir ( ) : string | ||
Résultat | string | plugins directory path |
public getPreviousPage ( ) : array | null | ||
Résultat | array | null | page data |
public getRawContent ( ) : string | null | ||
Résultat | string | null | raw contents |
public getRequestFile ( ) : string | null | ||
Résultat | string | null | file path |
public getRequestUrl ( ) : string | null | ||
Résultat | string | null | request URL |
public getRootDir ( ) : string | ||
Résultat | string | root directory path |
public getThemesDir ( ) : string | ||
Résultat | string | themes directory path |
protected getTwigVariables ( ) : array | ||
Résultat | array | template variables |
public isUrlRewritingEnabled ( ) : boolean | ||
Résultat | boolean | true if URL rewriting is enabled, false otherwise |
public load404Content ( string $file ) : string | ||
$file | string | path to requested (but not existing) file |
Résultat | string | raw contents of the 404 file |
protected loadConfig ( ) : void | ||
Résultat | void |
public loadFileContent ( string $file ) : string | ||
$file | string | file path |
Résultat | string | raw contents of the file |
protected loadPlugins ( ) : void | ||
Résultat | void |
public parseFileContent ( string $content ) : string | ||
$content | string | raw contents of a page (Markdown) |
Résultat | string | parsed contents (HTML) |
protected registerParsedown ( ) : void | ||
Résultat | void |
protected registerTwig ( ) : void | ||
Résultat | void |
protected string $configDir | ||
Résultat | string |
protected bool $locked | ||
Résultat | boolean |
protected array[]|null $pages | ||
Résultat | array[] | null |
protected ParsedownExtra|null $parsedown | ||
Résultat | ParsedownExtra | null |
protected object[]|null $plugins | ||
Résultat | object[] | null |
protected string $pluginsDir | ||
Résultat | string |
protected string $rootDir | ||
Résultat | string |
protected string $themesDir | ||
Résultat | string |
protected Twig_Environment|null $twig | ||
Résultat | Twig_Environment | null |