From 315c5176984bf94e179a5b1e16c410230a1901e2 Mon Sep 17 00:00:00 2001 From: Awilum Date: Tue, 6 Mar 2018 00:36:09 +0300 Subject: [PATCH] #431 general structure changes --- index.php | 17 ++++++++++++++++- monstra/Monstra.php | 8 ++++---- monstra/Themes.php | 7 +++++++ 3 files changed, 27 insertions(+), 5 deletions(-) diff --git a/index.php b/index.php index 7b4df47..2579013 100755 --- a/index.php +++ b/index.php @@ -1,8 +1,23 @@ + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + namespace Monstra; // Register the auto-loader. -$loader = require __DIR__ . '/vendor/autoload.php'; +$autoload = __DIR__ . '/vendor/autoload.php'; + +// Ensure vendor libraries exist +!is_file($autoload) and exit("Please run: composer install"); + +// Register the auto-loader. +$loader = require_once $autoload; // Check PHP Version version_compare($ver = PHP_VERSION, $req = '7.1.3', '<') and exit(sprintf('You are running PHP %s, but Monstra needs at least PHP %s to run.', $ver, $req)); diff --git a/monstra/Monstra.php b/monstra/Monstra.php index fdaab6d..673ec3c 100755 --- a/monstra/Monstra.php +++ b/monstra/Monstra.php @@ -62,10 +62,6 @@ class Monstra extends Container // Start the session //\Session::start(); - $container['markdown'] = function ($c) { - return new ParsedownExtra(); - }; - $container['events'] = function ($c) { return new EventDispatcher(); }; @@ -80,6 +76,10 @@ class Monstra extends Container $container['plugins']->init(); + $container['markdown'] = function ($c) { + return new ParsedownExtra(); + }; + $container['pages'] = function ($c) { return new Pages($c); }; diff --git a/monstra/Themes.php b/monstra/Themes.php index d884c10..c083023 100644 --- a/monstra/Themes.php +++ b/monstra/Themes.php @@ -25,4 +25,11 @@ class Themes $this->monstra = $c; } + public function getTemplate($template_name) + { + $template_ext = '.php'; + + include THEMES_PATH . '/' . $this->monstra['config']->get('site.theme') . '/' . $template_name . $template_ext; + } + }