mirror of
https://github.com/flextype/flextype.git
synced 2025-08-13 08:34:19 +02:00
Code cleanup and refactoring #5
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
<?php namespace Flextype;
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @package Flextype
|
||||
@@ -9,6 +9,8 @@
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Flextype;
|
||||
|
||||
class Cache
|
||||
{
|
||||
|
@@ -1,7 +1,4 @@
|
||||
<?php namespace Flextype;
|
||||
|
||||
use Arr;
|
||||
use Symfony\Component\Yaml\Yaml;
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @package Flextype
|
||||
@@ -12,6 +9,11 @@ use Symfony\Component\Yaml\Yaml;
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Flextype;
|
||||
|
||||
use Arr;
|
||||
use Symfony\Component\Yaml\Yaml;
|
||||
|
||||
class Config
|
||||
{
|
||||
|
@@ -1,6 +1,4 @@
|
||||
<?php namespace Flextype;
|
||||
|
||||
use Arr;
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @package Flextype
|
||||
@@ -11,6 +9,10 @@ use Arr;
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Flextype;
|
||||
|
||||
use Arr;
|
||||
|
||||
class Events
|
||||
{
|
||||
|
@@ -1,4 +1,4 @@
|
||||
<?php namespace Flextype;
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @package Flextype
|
||||
@@ -10,6 +10,8 @@
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Flextype;
|
||||
|
||||
class Filters
|
||||
{
|
||||
|
||||
|
@@ -1,20 +1,22 @@
|
||||
<?php namespace Flextype;
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @package Flextype
|
||||
*
|
||||
* @author Romanenko Sergey / Awilum <awilum@yandex.ru>
|
||||
* @link http://flextype.org
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Flextype;
|
||||
|
||||
use Symfony\Component\Filesystem\Filesystem;
|
||||
use Symfony\Component\Finder\Finder;
|
||||
use Url;
|
||||
use Session;
|
||||
|
||||
/**
|
||||
* @package Flextype
|
||||
*
|
||||
* @author Romanenko Sergey / Awilum <awilum@yandex.ru>
|
||||
* @link http://flextype.org
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
class Flextype
|
||||
{
|
||||
/**
|
||||
@@ -26,7 +28,7 @@ class Flextype
|
||||
protected static $instance = null;
|
||||
|
||||
/**
|
||||
* Filesystem
|
||||
* Filesystem object
|
||||
*
|
||||
* @var object
|
||||
* @access public
|
||||
@@ -34,7 +36,7 @@ class Flextype
|
||||
public static $filesystem = null;
|
||||
|
||||
/**
|
||||
* Finder
|
||||
* Finder object
|
||||
*
|
||||
* @var object
|
||||
* @access public
|
||||
@@ -65,8 +67,20 @@ class Flextype
|
||||
*/
|
||||
protected function __construct()
|
||||
{
|
||||
static::app();
|
||||
}
|
||||
|
||||
/**
|
||||
* Application.
|
||||
*
|
||||
* @access protected
|
||||
*/
|
||||
protected static function app()
|
||||
{
|
||||
// Init Finder
|
||||
static::$finder = new Finder();
|
||||
|
||||
// Init Filesystem
|
||||
static::$filesystem = new Filesystem();
|
||||
|
||||
// Init Config
|
||||
@@ -115,20 +129,38 @@ class Flextype
|
||||
// Init Plugins
|
||||
Plugins::init();
|
||||
|
||||
// Render current page
|
||||
// Init Pages
|
||||
Pages::init();
|
||||
|
||||
// Flush (send) the output buffer and turn off output buffering
|
||||
ob_end_flush();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns filesystem object
|
||||
*
|
||||
* @access public
|
||||
* @return object
|
||||
*/
|
||||
public static function filesystem()
|
||||
{
|
||||
return static::$filesystem;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns finder object
|
||||
*
|
||||
* @access public
|
||||
* @return object
|
||||
*/
|
||||
public static function finder()
|
||||
{
|
||||
return static::$finder;
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialize Flextype Application
|
||||
*
|
||||
* <code>
|
||||
* Rawium::init();
|
||||
* </code>
|
||||
*
|
||||
* @access public
|
||||
* @return object
|
||||
*/
|
||||
|
@@ -1,6 +1,4 @@
|
||||
<?php namespace Flextype;
|
||||
|
||||
use Symfony\Component\Yaml\Yaml;
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @package Flextype
|
||||
@@ -12,6 +10,10 @@ use Symfony\Component\Yaml\Yaml;
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Flextype;
|
||||
|
||||
use Symfony\Component\Yaml\Yaml;
|
||||
|
||||
class I18n
|
||||
{
|
||||
/**
|
||||
|
@@ -1,6 +1,4 @@
|
||||
<?php namespace Flextype;
|
||||
|
||||
use ParsedownExtra;
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @package Flextype
|
||||
@@ -12,6 +10,10 @@ use ParsedownExtra;
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Flextype;
|
||||
|
||||
use ParsedownExtra;
|
||||
|
||||
class Markdown
|
||||
{
|
||||
/**
|
||||
|
@@ -1,9 +1,4 @@
|
||||
<?php namespace Flextype;
|
||||
|
||||
use Arr;
|
||||
use Url;
|
||||
use Response;
|
||||
use Symfony\Component\Yaml\Yaml;
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @package Flextype
|
||||
@@ -14,6 +9,13 @@ use Symfony\Component\Yaml\Yaml;
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Flextype;
|
||||
|
||||
use Arr;
|
||||
use Url;
|
||||
use Response;
|
||||
use Symfony\Component\Yaml\Yaml;
|
||||
|
||||
class Pages
|
||||
{
|
||||
|
@@ -1,6 +1,4 @@
|
||||
<?php namespace Flextype;
|
||||
|
||||
use Symfony\Component\Yaml\Yaml;
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @package Flextype
|
||||
@@ -11,6 +9,10 @@ use Symfony\Component\Yaml\Yaml;
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Flextype;
|
||||
|
||||
use Symfony\Component\Yaml\Yaml;
|
||||
|
||||
class Plugins
|
||||
{
|
||||
|
@@ -1,7 +1,4 @@
|
||||
<?php namespace Flextype;
|
||||
|
||||
use Thunder\Shortcode\ShortcodeFacade;
|
||||
use Url;
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @package Flextype
|
||||
@@ -13,6 +10,11 @@ use Url;
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Flextype;
|
||||
|
||||
use Thunder\Shortcode\ShortcodeFacade;
|
||||
use Url;
|
||||
|
||||
class Shortcodes
|
||||
{
|
||||
|
||||
|
@@ -1,4 +1,4 @@
|
||||
<?php namespace Flextype;
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @package Flextype
|
||||
@@ -10,6 +10,8 @@
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Flextype;
|
||||
|
||||
class Templates
|
||||
{
|
||||
|
||||
@@ -38,7 +40,7 @@ class Templates
|
||||
|
||||
$template_path = THEMES_PATH . '/' . Config::get('site.theme') . '/' . $template_name . $template_ext;
|
||||
|
||||
if (Flextype::$filesystem->exists($template_path)) {
|
||||
if (Flextype::filesystem()->exists($template_path)) {
|
||||
include $template_path;
|
||||
} else {
|
||||
throw new RuntimeException("Template {$template_name} does not exist.");
|
||||
|
@@ -1,6 +1,4 @@
|
||||
<?php namespace Flextype;
|
||||
|
||||
use Symfony\Component\Yaml\Yaml;
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @package Flextype
|
||||
@@ -12,6 +10,10 @@ use Symfony\Component\Yaml\Yaml;
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Flextype;
|
||||
|
||||
use Symfony\Component\Yaml\Yaml;
|
||||
|
||||
class Themes
|
||||
{
|
||||
/**
|
||||
@@ -44,10 +46,6 @@ class Themes
|
||||
/**
|
||||
* Initialize Flextype Themes
|
||||
*
|
||||
* <code>
|
||||
* Themes::init();
|
||||
* </code>
|
||||
*
|
||||
* @access public
|
||||
* @return object
|
||||
*/
|
||||
|
@@ -1,4 +1,4 @@
|
||||
<?php namespace Flextype;
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @package Flextype
|
||||
@@ -10,6 +10,8 @@
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Flextype;
|
||||
|
||||
// Define the path to the root directory (without trailing slash).
|
||||
define('ROOT_DIR', str_replace(DIRECTORY_SEPARATOR, '/', getcwd()));
|
||||
|
||||
|
Reference in New Issue
Block a user