mirror of
https://github.com/monstra-cms/monstra.git
synced 2025-08-04 04:07:59 +02:00
PagesPlugin: add ability to get content for specific page.
This commit is contained in:
@@ -256,10 +256,30 @@
|
|||||||
*
|
*
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public static function content() {
|
public static function content($slug = '') {
|
||||||
|
|
||||||
|
if ( ! empty($slug)) {
|
||||||
|
|
||||||
|
$page = Table::factory('pages')->select('[slug="'.$slug.'"]', null);
|
||||||
|
|
||||||
|
if ( ! empty($page)) {
|
||||||
|
|
||||||
|
$content = Text::toHtml(File::getContent(STORAGE . DS . 'pages' . DS . $page['id'] . '.page.txt'));
|
||||||
|
|
||||||
|
$content = Filter::apply('content', $content);
|
||||||
|
|
||||||
|
return $content;
|
||||||
|
|
||||||
|
} else {
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
return Text::toHtml(File::getContent(STORAGE . DS . 'pages' . DS . Pages::$page['id'] . '.page.txt'));
|
return Text::toHtml(File::getContent(STORAGE . DS . 'pages' . DS . Pages::$page['id'] . '.page.txt'));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get pages title
|
* Get pages title
|
||||||
|
Reference in New Issue
Block a user