commit
070cb92661
10
lib/pico.php
10
lib/pico.php
@ -1,4 +1,4 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
class Pico {
|
class Pico {
|
||||||
|
|
||||||
@ -8,12 +8,12 @@ class Pico {
|
|||||||
$url = '';
|
$url = '';
|
||||||
$request_url = (isset($_SERVER['REQUEST_URI'])) ? $_SERVER['REQUEST_URI'] : '';
|
$request_url = (isset($_SERVER['REQUEST_URI'])) ? $_SERVER['REQUEST_URI'] : '';
|
||||||
$script_url = (isset($_SERVER['PHP_SELF'])) ? $_SERVER['PHP_SELF'] : '';
|
$script_url = (isset($_SERVER['PHP_SELF'])) ? $_SERVER['PHP_SELF'] : '';
|
||||||
|
|
||||||
// Get our url path and trim the / of the left and the right
|
// Get our url path and trim the / of the left and the right
|
||||||
if($request_url != $script_url) $url = trim(preg_replace('/'. str_replace('/', '\/', str_replace('index.php', '', $script_url)) .'/', '', $request_url, 1), '/');
|
if($request_url != $script_url) $url = trim(preg_replace('/'. str_replace('/', '\/', str_replace('index.php', '', $script_url)) .'/', '', $request_url, 1), '/');
|
||||||
|
|
||||||
// Get the file path
|
// Get the file path
|
||||||
if($url) $file = strtolower(CONTENT_DIR . $url);
|
if($url) $file = CONTENT_DIR . $url;
|
||||||
else $file = CONTENT_DIR .'index';
|
else $file = CONTENT_DIR .'index';
|
||||||
|
|
||||||
// Load the file
|
// Load the file
|
||||||
@ -34,7 +34,7 @@ class Pico {
|
|||||||
$settings = $this->get_config();
|
$settings = $this->get_config();
|
||||||
$env = array('autoescape' => false);
|
$env = array('autoescape' => false);
|
||||||
if($settings['enable_cache']) $env['cache'] = CACHE_DIR;
|
if($settings['enable_cache']) $env['cache'] = CACHE_DIR;
|
||||||
|
|
||||||
// Load the theme
|
// Load the theme
|
||||||
Twig_Autoloader::register();
|
Twig_Autoloader::register();
|
||||||
$loader = new Twig_Loader_Filesystem(THEMES_DIR . $settings['theme']);
|
$loader = new Twig_Loader_Filesystem(THEMES_DIR . $settings['theme']);
|
||||||
@ -118,4 +118,4 @@ class Pico {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user