1
0
mirror of https://github.com/flextype/flextype.git synced 2025-08-12 08:04:05 +02:00

Using Flextype Components

This commit is contained in:
Awilum
2018-04-13 13:26:07 +03:00
parent cba253fe84
commit 5b1baae8ff
2 changed files with 12 additions and 13 deletions

View File

@@ -19,14 +19,13 @@
"php": ">=7.1.3",
"erusev/parsedown": "1.7.0",
"erusev/parsedown-extra": "0.7.1",
"doctrine/cache": "1.7.1",
"symfony/yaml": "4.0.4",
"symfony/filesystem": "4.0.4",
"symfony/finder": "4.0.4",
"thunderer/shortcode": "0.6.5",
"doctrine/cache": "1.*",
"symfony/yaml": "4.*",
"thunderer/shortcode": "0.*",
"flextype-components/arr" : "1.*",
"flextype-components/http" : "1.*",
"flextype-components/token" : "1.*"
"flextype-components/token" : "1.*",
"flextype-components/filesystem" : "1.*"
},
"autoload": {
"classmap": [

View File

@@ -12,7 +12,7 @@
namespace Flextype;
use Flextype\Component\{Arr\Arr, Http\Http};
use Flextype\Component\{Arr\Arr, Http\Http, Filesystem\Filesystem};
use Symfony\Component\Yaml\Yaml;
class Pages
@@ -86,7 +86,7 @@ class Pages
}
// Get 404 page if file not exists
if (Flextype::filesystem()->exists($file)) {
if (Filesystem::fileExists($file)) {
$file = $file;
} else {
$file = PAGES_PATH . '/404/index.md';
@@ -106,7 +106,7 @@ class Pages
$site_theme = Config::get('site.theme');
$template_path = THEMES_PATH . '/' . $site_theme . '/' . $template_name . $template_ext;
if (Flextype::filesystem()->exists($template_path)) {
if (Filesystem::fileExists($template_path)) {
include $template_path;
} else {
throw new RuntimeException("Template {$template_name} does not exist.");
@@ -118,7 +118,7 @@ class Pages
*/
public static function parseFile(string $file) : array
{
$page = trim(file_get_contents($file));
$page = trim(Filesystem::getFileContent($file));
$page = explode('---', $page, 3);
$frontmatter = Shortcodes::driver()->process($page[1]);
@@ -162,7 +162,7 @@ class Pages
$file = static::finder($url, $url_abs);
if ($raw) {
$page = trim(file_get_contents($file));
$page = trim(Filesystem::getFileContent($file));
static::$page = $page;
Events::dispatch('onPageContentRawAfter');
} else {
@@ -202,7 +202,7 @@ class Pages
if ($url == '') {
// Get pages list
$pages_list = Flextype::finder()->files()->name('*.md')->in(PAGES_PATH);
$pages_list = Filesystem::getFilesList(PAGES_PATH, 'md');
// Create pages array from pages list
foreach ($pages_list as $key => $page) {
@@ -212,7 +212,7 @@ class Pages
} else {
// Get pages list
$pages_list = Flextype::finder()->files()->name('*.md')->in(PAGES_PATH . '/' . $url);
$pages_list = Filesystem::getFilesList(PAGES_PATH . '/' . $url, 'md');
// Create pages array from pages list and ignore current requested page
foreach ($pages_list as $key => $page) {