diff --git a/flextype/Flextype.php b/flextype/Flextype.php index ad68e4c2..6c962074 100755 --- a/flextype/Flextype.php +++ b/flextype/Flextype.php @@ -13,7 +13,7 @@ namespace Flextype; use Symfony\Component\{Filesystem\Filesystem, Finder\Finder}; -use Flextype\Component\{Url\Url, Session\Session}; +use Flextype\Component\{Http\Http, Session\Session}; class Flextype { @@ -157,12 +157,13 @@ class Flextype } /** - * Initialize Flextype Application - * - * @access public - * @return object - */ - public static function init() + * Return the Flextype instance. + * Create it if it's not already created. + * + * @access public + * @return object + */ + public static function instance() { return !isset(self::$instance) and self::$instance = new Flextype(); } diff --git a/flextype/Pages.php b/flextype/Pages.php index df09bf68..ca502f62 100755 --- a/flextype/Pages.php +++ b/flextype/Pages.php @@ -12,7 +12,7 @@ namespace Flextype; -use Flextype\Component\{Arr\Arr, Url\Url, Response\Response}; +use Flextype\Component\{Arr\Arr, Http\Http}; use Symfony\Component\Yaml\Yaml; class Pages @@ -53,7 +53,7 @@ class Pages Events::dispatch('onPageBeforeRender'); // Get current page - static::$page = static::getPage(Url::getUriString()); + static::$page = static::getPage(Http::getUriString()); // Display page for current requested url static::renderPage(static::$page); @@ -90,7 +90,7 @@ class Pages $file = $file; } else { $file = PAGES_PATH . '/404/index.md'; - Response::status(404); + Http::setResponseStatus(404); } return $file; @@ -125,7 +125,7 @@ class Pages $result_page = Yaml::parse($frontmatter); // Get page url - $url = str_replace(PAGES_PATH, Url::getBase(), $file); + $url = str_replace(PAGES_PATH, Http::getBaseUrl(), $file); $url = str_replace('index.md', '', $url); $url = str_replace('.md', '', $url); $url = str_replace('\\', '/', $url); @@ -138,10 +138,10 @@ class Pages $result_page['url'] = $url; // Get page slug - $url = str_replace(Url::getBase(), '', $url); + $url = str_replace(Http::getBaseUrl(), '', $url); $url = ltrim($url, '/'); $url = rtrim($url, '/'); - $result_page['slug'] = str_replace(Url::getBase(), '', $url); + $result_page['slug'] = str_replace(Http::getBaseUrl(), '', $url); // Set page date $result_page['date'] = $result_page['date'] ?? date(Config::get('site.date_format'), filemtime($file)); diff --git a/flextype/Shortcodes.php b/flextype/Shortcodes.php index 80bd0747..7b8036d4 100644 --- a/flextype/Shortcodes.php +++ b/flextype/Shortcodes.php @@ -13,7 +13,7 @@ namespace Flextype; use Thunder\Shortcode\ShortcodeFacade; -use Flextype\Component\Url\Url; +use Flextype\Component\Http\Http; class Shortcodes { @@ -76,7 +76,7 @@ class Shortcodes protected static function registerDefaultShortcodes() : void { static::driver()->addHandler('site_url', function() { - return Url::getBase(); + return Http::getBaseUrl(); }); } diff --git a/index.php b/index.php index 4ab0274a..39414efe 100755 --- a/index.php +++ b/index.php @@ -25,4 +25,4 @@ version_compare($ver = PHP_VERSION, $req = FLEXTYPE_MINIMUM_PHP, '<') and exit(s $loader = require_once $autoload; // Init Flextype -Flextype::init(); +Flextype::instance(); diff --git a/site/pages/home/index.md b/site/pages/home/index.md index f06c5911..3d033ea7 100755 --- a/site/pages/home/index.md +++ b/site/pages/home/index.md @@ -26,4 +26,5 @@ Creating a new page is very simple in Flextype. 2. Save this file in the `/site/pages/my-new-page/` folder as `index.md` and its will be available by this url: [site_url]/my-new-page + That is it! diff --git a/site/themes/default/partials/head.php b/site/themes/default/partials/head.php index cfad5c37..b0ca5a6e 100755 --- a/site/themes/default/partials/head.php +++ b/site/themes/default/partials/head.php @@ -13,13 +13,12 @@ - + - +