diff --git a/.htaccess b/.htaccess index 3e6dba6c..1e7bc8fe 100755 --- a/.htaccess +++ b/.htaccess @@ -12,7 +12,7 @@ RewriteEngine On -RewriteBase /flextype/ +RewriteBase / ## Begin - Exploits # If you experience problems on your site block out the operations listed below @@ -49,9 +49,9 @@ RewriteRule ^(\.git|flextype)/(.*) error [F] # Block access to specific file types for these system folders RewriteRule ^(flextype|vendor)/(.*)\.(txt|xml|md|html|yaml|yml|php|pl|py|cgi|sh|bat)$ error [F] # Block access to specific file types for these user folders -RewriteRule ^(site)/(.*)\.(txt|md|yaml|yml|php|pl|py|cgi|sh|bat)$ error [F] -# Block all direct access to .md files: -RewriteRule \.md$ error [F] +RewriteRule ^(site)/(.*)\.(txt|md|html|yaml|yml|php|pl|py|cgi|sh|bat)$ error [F] +# Block all direct access to .html files: +RewriteRule \.html$ error [F] # Block all direct access to files and folders beginning with a dot RewriteRule (^|/)\.(?!well-known) - [F] # Block access to specific files in the root folder diff --git a/composer.json b/composer.json index cb5d897c..95f0cc7e 100755 --- a/composer.json +++ b/composer.json @@ -2,7 +2,7 @@ "name": "flextype/flextype", "type": "project", "description": "Flextype is The Best Open Source Flat-File Content Management System", - "keywords": ["flextype", "php", "cms", "flat-file cms", "flat cms", "flatfile cms", "markdown"], + "keywords": ["flextype", "php", "cms", "flat-file cms", "flat cms", "flatfile cms", "html"], "homepage": "http://flextype.org", "license": "MIT", "authors": [ @@ -17,8 +17,6 @@ }, "require": { "php": ">=7.1.3", - "erusev/parsedown": "1.7.0", - "erusev/parsedown-extra": "0.7.1", "doctrine/cache": "1.*", "symfony/yaml": "4.*", "thunderer/shortcode": "0.*", diff --git a/flextype/Content.php b/flextype/Content.php index 44ad5b5f..fa8772c4 100755 --- a/flextype/Content.php +++ b/flextype/Content.php @@ -16,7 +16,6 @@ use Flextype\Component\{Arr\Arr, Http\Http, Filesystem\Filesystem, Event\Event, use Symfony\Component\Yaml\Yaml; use Thunder\Shortcode\ShortcodeFacade; use Thunder\Shortcode\Shortcode\ShortcodeInterface; -use ParsedownExtra as Markdown; class Content { @@ -28,14 +27,6 @@ class Content */ protected static $instance = null; - /** - * Markdown Object - * - * @var object - * @access private - */ - private static $markdown = null; - /** * Shortcode object * @@ -142,9 +133,9 @@ class Content { // if $url is empty then set path for defined main page if ($url === '') { - $file_path = PATH['pages'] . '/' . Registry::get('site.pages.main') . '/page.md'; + $file_path = PATH['pages'] . '/' . Registry::get('site.pages.main') . '/page.html'; } else { - $file_path = PATH['pages'] . '/' . $url . '/page.md'; + $file_path = PATH['pages'] . '/' . $url . '/page.html'; } $page_cache_id = ''; @@ -163,7 +154,7 @@ class Content if (Filesystem::fileExists($file_path)) { $file_path = $file_path; } else { - if (Filesystem::fileExists($file_path = PATH['pages'] . '/404/page.md')) { + if (Filesystem::fileExists($file_path = PATH['pages'] . '/404/page.html')) { $file_path = $file_path; Http::setResponseStatus(404); } else { @@ -179,7 +170,7 @@ class Content // Get 404 page if page is not published if (isset($page['published']) && $page['published'] === false) { - if (Filesystem::fileExists($file_path = PATH['pages'] . '/404/page.md')) { + if (Filesystem::fileExists($file_path = PATH['pages'] . '/404/page.html')) { $page = Content::processPage($file_path); Http::setResponseStatus(404); } else { @@ -226,7 +217,7 @@ class Content if ($url === '') { // Get pages list - $pages_list = Filesystem::getFilesList($file_path , 'md'); + $pages_list = Filesystem::getFilesList($file_path , 'html'); // Create pages cached id foreach ($pages_list as $key => $page) { @@ -247,14 +238,14 @@ class Content } else { // Get pages list - $pages_list = Filesystem::getFilesList($file_path, 'md'); + $pages_list = Filesystem::getFilesList($file_path, 'html'); // Create pages cached id foreach ($pages_list as $key => $page) { - if (strpos($page, $url . '/page.md') !== false) { + if (strpos($page, $url . '/page.html') !== false) { // ignore ... } else { - $pages_cache_id .= md5('pages' . $page . filemtime($page) . (($raw === true) ? 'true' : 'false') . $order_by . $order_type . $offset . $length); + $pages_cache_id .= html5('pages' . $page . filemtime($page) . (($raw === true) ? 'true' : 'false') . $order_by . $order_type . $offset . $length); } } @@ -263,7 +254,7 @@ class Content } else { // Create pages array from pages list and ignore current requested page foreach ($pages_list as $key => $page) { - if (strpos($page, $url . '/page.md') !== false) { + if (strpos($page, $url . '/page.html') !== false) { // ignore ... } else { $pages[$key] = Content::processPage($page, $raw); @@ -288,17 +279,6 @@ class Content } - /** - * Returns $markdown object - * - * @access public - * @return object - */ - public static function markdown() : Markdown - { - return Content::$markdown; - } - /** * Returns $shortcode object * @@ -313,7 +293,7 @@ class Content /** * Process page * - * $page = Content::processPage(PATH['pages'] . '/home/page.md'); + * $page = Content::processPage(PATH['pages'] . '/home/page.html'); * * @access public * @param string $file_path File path @@ -343,8 +323,8 @@ class Content // Create page url item $url = str_replace(PATH['pages'] , Http::getBaseUrl(), $file_path); - $url = str_replace('page.md', '', $url); - $url = str_replace('.md', '', $url); + $url = str_replace('page.html', '', $url); + $url = str_replace('.html', '', $url); $url = str_replace('\\', '/', $url); $url = str_replace('///', '/', $url); $url = str_replace('//', '/', $url); @@ -385,20 +365,6 @@ class Content return Content::shortcode()->process($content); } - /** - * Process markdown - * - * $content = Content::processMarkdown($content); - * - * @access public - * @param string $content Content to parse - * @return string - */ - public static function processMarkdown(string $content) : string - { - return Content::$markdown->text($content); - } - /** * Process content with markdown and shortcodes processors * @@ -411,7 +377,6 @@ class Content public static function processContent(string $content) : string { $content = Content::processShortcodes($content); - $content = Content::processMarkdown($content); return $content; } @@ -423,31 +388,10 @@ class Content */ protected static function initParsers() : void { - // Init Markdown - Content::initMarkdown(); - // Init Shortcodes Content::initShortcodes(); } - /** - * Init Markdown - * - * @access protected - * @return void - */ - protected static function initMarkdown() : void - { - // Create Markdown Parser object - Content::$markdown = new Markdown(); - - // Prevents automatic linking of URLs - Content::$markdown->setUrlsLinked(false); - - // Event: Markdown initialized - Event::dispatch('onMarkdownInitialized'); - } - /** * Init Shortcodes * diff --git a/site/pages/404/page.html b/site/pages/404/page.html new file mode 100755 index 00000000..dbdf48ba --- /dev/null +++ b/site/pages/404/page.html @@ -0,0 +1,7 @@ +--- +title: Error 404 +robots: noindex,nofollow +--- + +
We're sorry but the page you are looking for doesn't appear to exist!
diff --git a/site/pages/404/page.md b/site/pages/404/page.md deleted file mode 100755 index dc41754a..00000000 --- a/site/pages/404/page.md +++ /dev/null @@ -1,7 +0,0 @@ ---- -title: Error 404 -robots: noindex,nofollow ---- - -## Error 404 -We're sorry but the page you are looking for doesn't appear to exist! diff --git a/site/pages/home/page.html b/site/pages/home/page.html new file mode 100755 index 00000000..b9d07596 --- /dev/null +++ b/site/pages/home/page.html @@ -0,0 +1,29 @@ +--- +title: Welcome +description: Flextype is a simple and light-weighted Content Management System +template: default +--- + +You can start editing the content and customising your site.
+ +To edit this page, simply go to the folder you installed Flextype, and then browse to the `/site/pages/home/` folder and open the `page.md` file in your editor.
+ +Creating a new page is very simple in Flextype.
+ +
+1. Launch your text editor and paste this sample text:
+
+
+2. Save this file in the
+ ---
+ title: My New Page
+ ---
+ <h1>My New Page!</h1>
+ <p>This is the body of <b>My New Page</b></p>
+
+/site/pages/my-new-page/
folder as page.md
and its will be available by this url: http://your_site_url/my-new-page
+
That is it!
diff --git a/site/pages/home/page.md b/site/pages/home/page.md deleted file mode 100755 index bafb242c..00000000 --- a/site/pages/home/page.md +++ /dev/null @@ -1,30 +0,0 @@ ---- -title: Welcome -description: Flextype is a simple and light-weighted Content Management System -template: default ---- - -## Flextype is succesfully installed! -You can start editing the content and customising your site. - -### Edit this Page -To edit this page, simply go to the folder you installed Flextype, and then browse to the `/site/pages/home/` folder and open the `page.md` file in your editor. - -### Create a New page -Creating a new page is very simple in Flextype. - -1. Launch your text editor and paste this sample text: - - ``` - --- - title: My New Page - --- - # My New Page! - - This is the body of **My New Page** - ``` - -2. Save this file in the `/site/pages/my-new-page/` folder as `page.md` and its will be available by this url: http://your_site_url/my-new-page - - -That is it! diff --git a/site/themes/simple/views/partials/head.php b/site/themes/simple/views/partials/head.php index d6a62563..c34b83bb 100755 --- a/site/themes/simple/views/partials/head.php +++ b/site/themes/simple/views/partials/head.php @@ -1,20 +1,20 @@ - + -