1
0
mirror of https://github.com/flextype/flextype.git synced 2025-08-10 07:06:45 +02:00

Pages class refactoring

This commit is contained in:
Awilum
2018-03-10 01:46:26 +03:00
parent a697b8315d
commit 5f605b2d2d

View File

@@ -22,6 +22,9 @@ class Pages
*/
protected $rawilum;
/**
* @var Page
*/
public $page;
/**
@@ -32,28 +35,6 @@ class Pages
$this->rawilum = $c;
}
/**
* Get page
*/
public function getPage($url = '', $raw = false, $url_abs = false)
{
$file = $this->finder($url, $url_abs);
if ($raw) {
$page = trim(file_get_contents($file));
$this->page = $page;
$this->rawilum['events']->dispatch('onPageContentRawAfter');
} else {
$page = $this->parse($file);
$this->page = $page;
$this->page['content'] = $this->rawilum['filters']->dispatch('content', $this->rawilum['markdown']->text($this->page['content']));
$this->rawilum['events']->dispatch('onPageContentAfter');
}
return $this->page;
}
/**
* Page finder
*/
@@ -128,6 +109,29 @@ class Pages
return ['frontmatter' => $frontmatter, 'content' => $content];
}
/**
* Get page
*/
public function getPage($url = '', $raw = false, $url_abs = false)
{
$file = $this->finder($url, $url_abs);
if ($raw) {
$page = trim(file_get_contents($file));
$this->page = $page;
$this->rawilum['events']->dispatch('onPageContentRawAfter');
} else {
$page = $this->parse($file);
$this->page = $page;
$this->page['content'] = $this->rawilum['filters']->dispatch('content', $this->rawilum['markdown']->text($this->page['content']));
$this->rawilum['events']->dispatch('onPageContentAfter');
}
return $this->page;
}
/**
* getPage
*/