Formatting cleanup
This commit is contained in:
parent
0026ca7470
commit
f666915536
@ -8,7 +8,7 @@
|
|||||||
* @author Timothy J. Warren
|
* @author Timothy J. Warren
|
||||||
* @copyright Copyright (c) 2011 - 2012
|
* @copyright Copyright (c) 2011 - 2012
|
||||||
* @link https://github.com/aviat4ion/miniMVC
|
* @link https://github.com/aviat4ion/miniMVC
|
||||||
* @license http://philsturgeon.co.uk/code/dbad-license
|
* @license http://philsturgeon.co.uk/code/dbad-license
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// --------------------------------------------------------------------------
|
// --------------------------------------------------------------------------
|
||||||
@ -19,8 +19,8 @@
|
|||||||
* @package miniMVC
|
* @package miniMVC
|
||||||
* @subpackage App
|
* @subpackage App
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// --------------------------------------------------------------------------
|
// --------------------------------------------------------------------------
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|--------------------------------------------------------------------------
|
|--------------------------------------------------------------------------
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
* @author Timothy J. Warren
|
* @author Timothy J. Warren
|
||||||
* @copyright Copyright (c) 2011 - 2012
|
* @copyright Copyright (c) 2011 - 2012
|
||||||
* @link https://github.com/aviat4ion/miniMVC
|
* @link https://github.com/aviat4ion/miniMVC
|
||||||
* @license http://philsturgeon.co.uk/code/dbad-license
|
* @license http://philsturgeon.co.uk/code/dbad-license
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// --------------------------------------------------------------------------
|
// --------------------------------------------------------------------------
|
||||||
@ -19,7 +19,7 @@
|
|||||||
* @package miniMVC
|
* @package miniMVC
|
||||||
* @subpackage App
|
* @subpackage App
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// --------------------------------------------------------------------------
|
// --------------------------------------------------------------------------
|
||||||
|
|
||||||
$db_conf = array(
|
$db_conf = array(
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
* @author Timothy J. Warren
|
* @author Timothy J. Warren
|
||||||
* @copyright Copyright (c) 2011 - 2012
|
* @copyright Copyright (c) 2011 - 2012
|
||||||
* @link https://github.com/aviat4ion/miniMVC
|
* @link https://github.com/aviat4ion/miniMVC
|
||||||
* @license http://philsturgeon.co.uk/code/dbad-license
|
* @license http://philsturgeon.co.uk/code/dbad-license
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// --------------------------------------------------------------------------
|
// --------------------------------------------------------------------------
|
||||||
@ -16,7 +16,7 @@
|
|||||||
/**
|
/**
|
||||||
* File to configure routes
|
* File to configure routes
|
||||||
*
|
*
|
||||||
* Routes work on simple/regex matching.
|
* Routes work on simple/regex matching.
|
||||||
*
|
*
|
||||||
* For a route mapping http://example.com/blog to the blog controller in the blog module:
|
* For a route mapping http://example.com/blog to the blog controller in the blog module:
|
||||||
* 'blog' => 'blog/blog/index'
|
* 'blog' => 'blog/blog/index'
|
||||||
@ -26,7 +26,7 @@
|
|||||||
* @package miniMVC
|
* @package miniMVC
|
||||||
* @subpackage App
|
* @subpackage App
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// --------------------------------------------------------------------------
|
// --------------------------------------------------------------------------
|
||||||
|
|
||||||
return array(
|
return array(
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
* @author Timothy J. Warren
|
* @author Timothy J. Warren
|
||||||
* @copyright Copyright (c) 2011 - 2012
|
* @copyright Copyright (c) 2011 - 2012
|
||||||
* @link https://github.com/aviat4ion/miniMVC
|
* @link https://github.com/aviat4ion/miniMVC
|
||||||
* @license http://philsturgeon.co.uk/code/dbad-license
|
* @license http://philsturgeon.co.uk/code/dbad-license
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// --------------------------------------------------------------------------
|
// --------------------------------------------------------------------------
|
||||||
@ -16,7 +16,7 @@
|
|||||||
/**
|
/**
|
||||||
* Example Controller Class
|
* Example Controller Class
|
||||||
*/
|
*/
|
||||||
class Welcome extends miniMVC\Controller {
|
class welcome extends miniMVC\Controller {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initialize the constructor
|
* Initialize the constructor
|
||||||
@ -27,7 +27,7 @@ class Welcome extends miniMVC\Controller {
|
|||||||
{
|
{
|
||||||
parent::__construct();
|
parent::__construct();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Default route for the controller
|
* Default route for the controller
|
||||||
*
|
*
|
||||||
@ -39,7 +39,7 @@ class Welcome extends miniMVC\Controller {
|
|||||||
$output = $this->page->set_message('info', "This is just a test message");
|
$output = $this->page->set_message('info', "This is just a test message");
|
||||||
$this->page->build_footer();
|
$this->page->build_footer();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* welcome/php route
|
* welcome/php route
|
||||||
*
|
*
|
||||||
@ -51,7 +51,7 @@ class Welcome extends miniMVC\Controller {
|
|||||||
phpinfo();
|
phpinfo();
|
||||||
$output = ob_get_contents();
|
$output = ob_get_contents();
|
||||||
ob_end_clean();
|
ob_end_clean();
|
||||||
|
|
||||||
$this->page->set_output($output);
|
$this->page->set_output($output);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
* @author Timothy J. Warren
|
* @author Timothy J. Warren
|
||||||
* @copyright Copyright (c) 2011 - 2012
|
* @copyright Copyright (c) 2011 - 2012
|
||||||
* @link https://github.com/aviat4ion/miniMVC
|
* @link https://github.com/aviat4ion/miniMVC
|
||||||
* @license http://philsturgeon.co.uk/code/dbad-license
|
* @license http://philsturgeon.co.uk/code/dbad-license
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// --------------------------------------------------------------------------
|
// --------------------------------------------------------------------------
|
||||||
@ -23,7 +23,7 @@ class Welcome_Model extends miniMVC\Model{
|
|||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
parent::__construct();
|
parent::__construct();
|
||||||
}
|
}
|
||||||
|
@ -11,9 +11,9 @@
|
|||||||
<?php if (isset($title)) : ?>
|
<?php if (isset($title)) : ?>
|
||||||
<h1><?= $title ?></h1>
|
<h1><?= $title ?></h1>
|
||||||
<?php endif ?>
|
<?php endif ?>
|
||||||
|
|
||||||
<?= $message; ?>
|
<?= $message; ?>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
@ -1,6 +1,6 @@
|
|||||||
<div style="position:relative; margin:0.5em auto; padding:0.5em; width:95%; border:1px solid #924949; background: #f3e6e6;">
|
<div style="position:relative; margin:0.5em auto; padding:0.5em; width:95%; border:1px solid #924949; background: #f3e6e6;">
|
||||||
<h4>A Database Error was encountered</h4>
|
<h4>A Database Error was encountered</h4>
|
||||||
|
|
||||||
<p>Code: <?= $code ?></p>
|
<p>Code: <?= $code ?></p>
|
||||||
<p>Driver Code: <?= $driver_code ?></p>
|
<p>Driver Code: <?= $driver_code ?></p>
|
||||||
<p>Message: <?= $message ?></p>
|
<p>Message: <?= $message ?></p>
|
||||||
|
@ -11,9 +11,9 @@
|
|||||||
<?php if (isset($title)) : ?>
|
<?php if (isset($title)) : ?>
|
||||||
<h1><?= $title ?></h1>
|
<h1><?= $title ?></h1>
|
||||||
<?php endif ?>
|
<?php endif ?>
|
||||||
|
|
||||||
<?= $message; ?>
|
<?= $message; ?>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
@ -1,13 +1,13 @@
|
|||||||
<div style="position:relative; margin:0.5em auto; padding:0.5em; width:95%; border:1px solid #924949; background: #f3e6e6;">
|
<div style="position:relative; margin:0.5em auto; padding:0.5em; width:95%; border:1px solid #924949; background: #f3e6e6;">
|
||||||
<h4>An uncaught exception was thrown.</h4>
|
<h4>An uncaught exception was thrown.</h4>
|
||||||
|
|
||||||
<p>Message: <?= $message; ?></p>
|
<p>Message: <?= $message; ?></p>
|
||||||
|
|
||||||
<?php if (defined('SHOW_DEBUG_BACKTRACE') && SHOW_DEBUG_BACKTRACE === TRUE): ?>
|
<?php if (defined('SHOW_DEBUG_BACKTRACE') && SHOW_DEBUG_BACKTRACE === TRUE): ?>
|
||||||
|
|
||||||
<p>Backtrace: </p>
|
<p>Backtrace: </p>
|
||||||
<?php foreach($exception->getTrace() as $error): ?>
|
<?php foreach($exception->getTrace() as $error): ?>
|
||||||
|
|
||||||
<?php if (isset($error['file']) && ! stristr($error['file'], MM_SYS_PATH)): ?>
|
<?php if (isset($error['file']) && ! stristr($error['file'], MM_SYS_PATH)): ?>
|
||||||
<p style="margin-left:10px">
|
<p style="margin-left:10px">
|
||||||
File: <?= str_replace(MM_BASE_PATH, "", $error['file']) ?><br />
|
File: <?= str_replace(MM_BASE_PATH, "", $error['file']) ?><br />
|
||||||
@ -15,8 +15,8 @@
|
|||||||
Function: <?= $error['function'] ?>
|
Function: <?= $error['function'] ?>
|
||||||
</p>
|
</p>
|
||||||
<?php endif ?>
|
<?php endif ?>
|
||||||
|
|
||||||
<?php endforeach ?></p>
|
<?php endforeach ?></p>
|
||||||
|
|
||||||
<?php endif ?>
|
<?php endif ?>
|
||||||
</div>
|
</div>
|
@ -8,7 +8,7 @@
|
|||||||
* @author Timothy J. Warren
|
* @author Timothy J. Warren
|
||||||
* @copyright Copyright (c) 2011 - 2012
|
* @copyright Copyright (c) 2011 - 2012
|
||||||
* @link https://github.com/aviat4ion/miniMVC
|
* @link https://github.com/aviat4ion/miniMVC
|
||||||
* @license http://philsturgeon.co.uk/code/dbad-license
|
* @license http://philsturgeon.co.uk/code/dbad-license
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// --------------------------------------------------------------------------
|
// --------------------------------------------------------------------------
|
||||||
@ -25,11 +25,11 @@
|
|||||||
| Document Root
|
| Document Root
|
||||||
|--------------------------------------------------------------------------
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
|
||||||
| The folder where the index of the website exists. In most situations,
|
| The folder where the index of the website exists. In most situations,
|
||||||
| this will not need to be changed.
|
| this will not need to be changed.
|
||||||
|
|
|
|
||||||
| If the website is in a folder off of the domain name, like:
|
| If the website is in a folder off of the domain name, like:
|
||||||
| http://example.com/website/
|
| http://example.com/website/
|
||||||
| you will need to add that folder to the document root.
|
| you will need to add that folder to the document root.
|
||||||
|
|
|
|
||||||
*/
|
*/
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
* @author Timothy J. Warren
|
* @author Timothy J. Warren
|
||||||
* @copyright Copyright (c) 2011 - 2012
|
* @copyright Copyright (c) 2011 - 2012
|
||||||
* @link https://github.com/aviat4ion/miniMVC
|
* @link https://github.com/aviat4ion/miniMVC
|
||||||
* @license http://philsturgeon.co.uk/code/dbad-license
|
* @license http://philsturgeon.co.uk/code/dbad-license
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// --------------------------------------------------------------------------
|
// --------------------------------------------------------------------------
|
||||||
@ -18,15 +18,15 @@
|
|||||||
*/
|
*/
|
||||||
return array(
|
return array(
|
||||||
/*-----
|
/*-----
|
||||||
Css
|
Css
|
||||||
-----*/
|
-----*/
|
||||||
'css' => array(
|
'css' => array(
|
||||||
'message.css'
|
'message.css'
|
||||||
),
|
),
|
||||||
|
|
||||||
/*
|
/*
|
||||||
For each group create an array like so
|
For each group create an array like so
|
||||||
|
|
||||||
'my_group' => [
|
'my_group' => [
|
||||||
'path/to/css/file1.css',
|
'path/to/css/file1.css',
|
||||||
'path/to/css/file2.css'
|
'path/to/css/file2.css'
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
* @author Timothy J. Warren
|
* @author Timothy J. Warren
|
||||||
* @copyright Copyright (c) 2011 - 2012
|
* @copyright Copyright (c) 2011 - 2012
|
||||||
* @link https://github.com/aviat4ion/miniMVC
|
* @link https://github.com/aviat4ion/miniMVC
|
||||||
* @license http://philsturgeon.co.uk/code/dbad-license
|
* @license http://philsturgeon.co.uk/code/dbad-license
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// --------------------------------------------------------------------------
|
// --------------------------------------------------------------------------
|
||||||
@ -16,10 +16,10 @@
|
|||||||
/**
|
/**
|
||||||
* This is the config array for javascript files to concatenate and minify
|
* This is the config array for javascript files to concatenate and minify
|
||||||
*/
|
*/
|
||||||
return [
|
return [
|
||||||
/*
|
/*
|
||||||
For each group create an array like so
|
For each group create an array like so
|
||||||
|
|
||||||
'my_group' => array(
|
'my_group' => array(
|
||||||
'path/to/css/file1.css',
|
'path/to/css/file1.css',
|
||||||
'path/to/css/file2.css'
|
'path/to/css/file2.css'
|
||||||
|
@ -8,12 +8,12 @@
|
|||||||
* @author Timothy J. Warren
|
* @author Timothy J. Warren
|
||||||
* @copyright Copyright (c) 2011 - 2012
|
* @copyright Copyright (c) 2011 - 2012
|
||||||
* @link https://github.com/aviat4ion/miniMVC
|
* @link https://github.com/aviat4ion/miniMVC
|
||||||
* @license http://philsturgeon.co.uk/code/dbad-license
|
* @license http://philsturgeon.co.uk/code/dbad-license
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// --------------------------------------------------------------------------
|
// --------------------------------------------------------------------------
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* CSS Minifier and Cacher
|
* CSS Minifier and Cacher
|
||||||
*
|
*
|
||||||
* @package miniMVC
|
* @package miniMVC
|
||||||
@ -21,10 +21,10 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
//Get config files
|
//Get config files
|
||||||
require('./config/config.php');
|
require './config/config.php';
|
||||||
|
|
||||||
//Include the css groups
|
//Include the css groups
|
||||||
$groups = require("./config/css_groups.php");
|
$groups = require './config/css_groups.php';
|
||||||
|
|
||||||
//The name of this file
|
//The name of this file
|
||||||
$this_file = __FILE__;
|
$this_file = __FILE__;
|
||||||
@ -38,10 +38,10 @@ $this_file = __FILE__;
|
|||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
function compress($buffer) {
|
function compress($buffer) {
|
||||||
|
|
||||||
//Remove CSS comments
|
//Remove CSS comments
|
||||||
$buffer = preg_replace('!/\*[^*]*\*+([^/][^*]*\*+)*/!', '', $buffer);
|
$buffer = preg_replace('!/\*[^*]*\*+([^/][^*]*\*+)*/!', '', $buffer);
|
||||||
|
|
||||||
//Remove tabs, spaces, newlines, etc.
|
//Remove tabs, spaces, newlines, etc.
|
||||||
$buffer = preg_replace('`\s+`', ' ', $buffer);
|
$buffer = preg_replace('`\s+`', ' ', $buffer);
|
||||||
$replace = array(
|
$replace = array(
|
||||||
@ -55,12 +55,12 @@ function compress($buffer) {
|
|||||||
': ' => ':',
|
': ' => ':',
|
||||||
'; ' => ';',
|
'; ' => ';',
|
||||||
);
|
);
|
||||||
|
|
||||||
//Eradicate every last space!
|
//Eradicate every last space!
|
||||||
$buffer = trim(strtr($buffer, $replace));
|
$buffer = trim(strtr($buffer, $replace));
|
||||||
$buffer = str_replace('{ ', '{', $buffer);
|
$buffer = str_replace('{ ', '{', $buffer);
|
||||||
$buffer = str_replace('} ', '}', $buffer);
|
$buffer = str_replace('} ', '}', $buffer);
|
||||||
|
|
||||||
return $buffer;
|
return $buffer;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -77,9 +77,9 @@ while($i < $pia_len)
|
|||||||
{
|
{
|
||||||
$j = $i+1;
|
$j = $i+1;
|
||||||
$j = (isset($pia[$j])) ? $j : $i;
|
$j = (isset($pia[$j])) ? $j : $i;
|
||||||
|
|
||||||
$_GET[$pia[$i]] = $pia[$j];
|
$_GET[$pia[$i]] = $pia[$j];
|
||||||
|
|
||||||
$i = $j + 1;
|
$i = $j + 1;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -103,8 +103,8 @@ $modified[] = filemtime($this_file);
|
|||||||
rsort($modified);
|
rsort($modified);
|
||||||
$last_modified = $modified[0];
|
$last_modified = $modified[0];
|
||||||
|
|
||||||
$requested_time= (isset($_SERVER['HTTP_IF_MODIFIED_SINCE']))
|
$requested_time= (isset($_SERVER['HTTP_IF_MODIFIED_SINCE']))
|
||||||
? strtotime($_SERVER['HTTP_IF_MODIFIED_SINCE'])
|
? strtotime($_SERVER['HTTP_IF_MODIFIED_SINCE'])
|
||||||
: time();
|
: time();
|
||||||
|
|
||||||
if ($last_modified === $requested_time)
|
if ($last_modified === $requested_time)
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
* @author Timothy J. Warren
|
* @author Timothy J. Warren
|
||||||
* @copyright Copyright (c) 2011 - 2012
|
* @copyright Copyright (c) 2011 - 2012
|
||||||
* @link https://github.com/aviat4ion/miniMVC
|
* @link https://github.com/aviat4ion/miniMVC
|
||||||
* @license http://philsturgeon.co.uk/code/dbad-license
|
* @license http://philsturgeon.co.uk/code/dbad-license
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// --------------------------------------------------------------------------
|
// --------------------------------------------------------------------------
|
||||||
@ -21,7 +21,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
//Get config files
|
//Get config files
|
||||||
require('./config/config.php');
|
require './config/config.php';
|
||||||
|
|
||||||
//Include the js groups
|
//Include the js groups
|
||||||
$groups_file = "./config/js_groups.php";
|
$groups_file = "./config/js_groups.php";
|
||||||
@ -34,7 +34,7 @@ $this_file = __FILE__;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Get Files
|
* Get Files
|
||||||
*
|
*
|
||||||
* Concatenates the javascript files for the current
|
* Concatenates the javascript files for the current
|
||||||
* group as a string
|
* group as a string
|
||||||
* @return string
|
* @return string
|
||||||
@ -44,13 +44,13 @@ function get_files()
|
|||||||
global $groups, $js_root;
|
global $groups, $js_root;
|
||||||
|
|
||||||
$js = '';
|
$js = '';
|
||||||
|
|
||||||
foreach ($groups[$_GET['g']] as &$file)
|
foreach ($groups[$_GET['g']] as &$file)
|
||||||
{
|
{
|
||||||
$new_file = realpath($js_root.$file);
|
$new_file = realpath($js_root.$file);
|
||||||
$js .= file_get_contents($new_file);
|
$js .= file_get_contents($new_file);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $js;
|
return $js;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -71,7 +71,7 @@ function google_min($new_file)
|
|||||||
curl_setopt($ch, CURLOPT_POST, 1);
|
curl_setopt($ch, CURLOPT_POST, 1);
|
||||||
curl_setopt($ch, CURLOPT_POSTFIELDS, 'output_info=compiled_code&output_format=text&compilation_level=SIMPLE_OPTIMIZATIONS&js_code=' . urlencode($new_file));
|
curl_setopt($ch, CURLOPT_POSTFIELDS, 'output_info=compiled_code&output_format=text&compilation_level=SIMPLE_OPTIMIZATIONS&js_code=' . urlencode($new_file));
|
||||||
$output = curl_exec($ch);
|
$output = curl_exec($ch);
|
||||||
curl_close($ch);
|
curl_close($ch);
|
||||||
return $output;
|
return $output;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -88,9 +88,9 @@ while ($i < $pia_len)
|
|||||||
{
|
{
|
||||||
$j = $i+1;
|
$j = $i+1;
|
||||||
$j = (isset($pia[$j])) ? $j : $i;
|
$j = (isset($pia[$j])) ? $j : $i;
|
||||||
|
|
||||||
$_GET[$pia[$i]] = $pia[$j];
|
$_GET[$pia[$i]] = $pia[$j];
|
||||||
|
|
||||||
$i = $j + 1;
|
$i = $j + 1;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -103,19 +103,19 @@ $modified = [];
|
|||||||
if (isset($groups[$_GET['g']]))
|
if (isset($groups[$_GET['g']]))
|
||||||
{
|
{
|
||||||
$cache_file = $js_root.'cache/'.$_GET['g'];
|
$cache_file = $js_root.'cache/'.$_GET['g'];
|
||||||
|
|
||||||
foreach ($groups[$_GET['g']] as &$file)
|
foreach ($groups[$_GET['g']] as &$file)
|
||||||
{
|
{
|
||||||
$new_file = realpath($js_root.$file);
|
$new_file = realpath($js_root.$file);
|
||||||
$modified[] = filemtime($new_file);
|
$modified[] = filemtime($new_file);
|
||||||
}
|
}
|
||||||
|
|
||||||
//Add this page too, as well as the groups file
|
//Add this page too, as well as the groups file
|
||||||
$modified[] = filemtime($this_file);
|
$modified[] = filemtime($this_file);
|
||||||
$modified[] = filemtime($groups_file);
|
$modified[] = filemtime($groups_file);
|
||||||
|
|
||||||
$cache_modified = 0;
|
$cache_modified = 0;
|
||||||
|
|
||||||
//Add the cache file
|
//Add the cache file
|
||||||
if (is_file($cache_file))
|
if (is_file($cache_file))
|
||||||
{
|
{
|
||||||
@ -133,11 +133,11 @@ else //Nothing to display? Just exit
|
|||||||
rsort($modified);
|
rsort($modified);
|
||||||
$last_modified = $modified[0];
|
$last_modified = $modified[0];
|
||||||
|
|
||||||
$requested_time=(isset($_SERVER['HTTP_IF_MODIFIED_SINCE']))
|
$requested_time=(isset($_SERVER['HTTP_IF_MODIFIED_SINCE']))
|
||||||
? strtotime($_SERVER['HTTP_IF_MODIFIED_SINCE'])
|
? strtotime($_SERVER['HTTP_IF_MODIFIED_SINCE'])
|
||||||
: time();
|
: time();
|
||||||
|
|
||||||
// If the browser's cached version is up to date,
|
// If the browser's cached version is up to date,
|
||||||
// don't resend the file
|
// don't resend the file
|
||||||
if ($last_modified === $requested_time)
|
if ($last_modified === $requested_time)
|
||||||
{
|
{
|
||||||
@ -152,7 +152,7 @@ if ($cache_modified < $last_modified)
|
|||||||
{
|
{
|
||||||
$js = google_min(get_files());
|
$js = google_min(get_files());
|
||||||
$cs = file_put_contents($cache_file, $js);
|
$cs = file_put_contents($cache_file, $js);
|
||||||
|
|
||||||
//Make sure cache file gets created/updated
|
//Make sure cache file gets created/updated
|
||||||
if ($cs === FALSE)
|
if ($cs === FALSE)
|
||||||
{
|
{
|
||||||
@ -164,7 +164,7 @@ elseif (isset($_GET['debug']))
|
|||||||
$js = get_files();
|
$js = get_files();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$len = filesize($cache_file);
|
$len = filesize($cache_file);
|
||||||
header("Content-Length: {$len}");
|
header("Content-Length: {$len}");
|
||||||
$js = file_get_contents($cache_file);
|
$js = file_get_contents($cache_file);
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
* @author Timothy J. Warren
|
* @author Timothy J. Warren
|
||||||
* @copyright Copyright (c) 2011 - 2012
|
* @copyright Copyright (c) 2011 - 2012
|
||||||
* @link https://github.com/aviat4ion/miniMVC
|
* @link https://github.com/aviat4ion/miniMVC
|
||||||
* @license http://philsturgeon.co.uk/code/dbad-license
|
* @license http://philsturgeon.co.uk/code/dbad-license
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// --------------------------------------------------------------------------
|
// --------------------------------------------------------------------------
|
||||||
@ -19,11 +19,11 @@
|
|||||||
* @package miniMVC
|
* @package miniMVC
|
||||||
* @subpackage App
|
* @subpackage App
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// --------------------------------------------------------------------------
|
// --------------------------------------------------------------------------
|
||||||
|
|
||||||
namespace miniMVC;
|
namespace miniMVC;
|
||||||
|
|
||||||
// Set as either DEVELOPMENT or PRODUCTION
|
// Set as either DEVELOPMENT or PRODUCTION
|
||||||
// DEVELOPMENT enables error reporting
|
// DEVELOPMENT enables error reporting
|
||||||
// PRODUCTION disables error reporting
|
// PRODUCTION disables error reporting
|
||||||
@ -53,4 +53,4 @@ require(MM_SYS_PATH . 'common.php');
|
|||||||
// And away we go!
|
// And away we go!
|
||||||
init();
|
init();
|
||||||
|
|
||||||
// End of index.php
|
// End of index.php
|
@ -8,20 +8,20 @@
|
|||||||
* @author Timothy J. Warren
|
* @author Timothy J. Warren
|
||||||
* @copyright Copyright (c) 2011 - 2012
|
* @copyright Copyright (c) 2011 - 2012
|
||||||
* @link https://github.com/aviat4ion/miniMVC
|
* @link https://github.com/aviat4ion/miniMVC
|
||||||
* @license http://philsturgeon.co.uk/code/dbad-license
|
* @license http://philsturgeon.co.uk/code/dbad-license
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// --------------------------------------------------------------------------
|
// --------------------------------------------------------------------------
|
||||||
|
|
||||||
namespace miniMVC;
|
namespace miniMVC;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Extend PHP's PDO class to add some more functionality
|
* Extend PHP's PDO class to add some more functionality
|
||||||
*
|
*
|
||||||
* @package miniMVC
|
* @package miniMVC
|
||||||
* @subpackage System
|
* @subpackage System
|
||||||
*/
|
*/
|
||||||
class DB extends \Query_Builder {
|
class db extends \Query_Builder {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* DB connection instances
|
* DB connection instances
|
||||||
@ -29,9 +29,9 @@ class DB extends \Query_Builder {
|
|||||||
* @var array
|
* @var array
|
||||||
*/
|
*/
|
||||||
private static $instance = array();
|
private static $instance = array();
|
||||||
|
|
||||||
// --------------------------------------------------------------------------
|
// --------------------------------------------------------------------------
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Indexed singleton method
|
* Indexed singleton method
|
||||||
*
|
*
|
||||||
@ -45,7 +45,7 @@ class DB extends \Query_Builder {
|
|||||||
{
|
{
|
||||||
// Include the database config file
|
// Include the database config file
|
||||||
require_once(MM_APP_PATH.'config/db.php');
|
require_once(MM_APP_PATH.'config/db.php');
|
||||||
|
|
||||||
// Get the correct database in the config file
|
// Get the correct database in the config file
|
||||||
if ( ! is_like_array($db_conf[$dbname]))
|
if ( ! is_like_array($db_conf[$dbname]))
|
||||||
{
|
{
|
||||||
@ -54,16 +54,16 @@ class DB extends \Query_Builder {
|
|||||||
trigger_error("Database does not exist", E_USER_ERROR);
|
trigger_error("Database does not exist", E_USER_ERROR);
|
||||||
die();
|
die();
|
||||||
}
|
}
|
||||||
|
|
||||||
//echo 'Creating new instance of db class.';
|
//echo 'Creating new instance of db class.';
|
||||||
self::$instance[$dbname] = new DB($db_conf[$dbname]);
|
self::$instance[$dbname] = new DB($db_conf[$dbname]);
|
||||||
}
|
}
|
||||||
|
|
||||||
return self::$instance[$dbname];
|
return self::$instance[$dbname];
|
||||||
}
|
}
|
||||||
|
|
||||||
// --------------------------------------------------------------------------
|
// --------------------------------------------------------------------------
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the last error from the database
|
* Returns the last error from the database
|
||||||
*
|
*
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
* @author Timothy J. Warren
|
* @author Timothy J. Warren
|
||||||
* @copyright Copyright (c) 2011 - 2012
|
* @copyright Copyright (c) 2011 - 2012
|
||||||
* @link https://github.com/aviat4ion/miniMVC
|
* @link https://github.com/aviat4ion/miniMVC
|
||||||
* @license http://philsturgeon.co.uk/code/dbad-license
|
* @license http://philsturgeon.co.uk/code/dbad-license
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// --------------------------------------------------------------------------
|
// --------------------------------------------------------------------------
|
||||||
@ -22,24 +22,24 @@ namespace miniMVC;
|
|||||||
* @subpackage Libraries
|
* @subpackage Libraries
|
||||||
*/
|
*/
|
||||||
class Data_Store {
|
class Data_Store {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Settings object represented by the currently loaded JSON file
|
* Settings object represented by the currently loaded JSON file
|
||||||
*/
|
*/
|
||||||
private $current;
|
private $current;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Singleton instance
|
* Singleton instance
|
||||||
*/
|
*/
|
||||||
private static $instance;
|
private static $instance;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create and/or load json file
|
* Create and/or load json file
|
||||||
*/
|
*/
|
||||||
protected function __construct()
|
protected function __construct()
|
||||||
{
|
{
|
||||||
$path = MM_APP_PATH .'config/data_store.json';
|
$path = MM_APP_PATH .'config/data_store.json';
|
||||||
|
|
||||||
if ( ! is_file($path))
|
if ( ! is_file($path))
|
||||||
{
|
{
|
||||||
touch($path);
|
touch($path);
|
||||||
@ -49,12 +49,12 @@ class Data_Store {
|
|||||||
{
|
{
|
||||||
// Load the file
|
// Load the file
|
||||||
$json = file_get_contents($path);
|
$json = file_get_contents($path);
|
||||||
|
|
||||||
// Load the object into the class
|
// Load the object into the class
|
||||||
$this->current = json_decode($json);
|
$this->current = json_decode($json);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// --------------------------------------------------------------------------
|
// --------------------------------------------------------------------------
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -66,9 +66,9 @@ class Data_Store {
|
|||||||
|
|
||||||
file_put_contents(MM_APP_PATH . 'config/data_store.json', $file_string);
|
file_put_contents(MM_APP_PATH . 'config/data_store.json', $file_string);
|
||||||
}
|
}
|
||||||
|
|
||||||
// --------------------------------------------------------------------------
|
// --------------------------------------------------------------------------
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Magic function called when cloning an object
|
* Magic function called when cloning an object
|
||||||
*/
|
*/
|
||||||
@ -76,7 +76,7 @@ class Data_Store {
|
|||||||
{
|
{
|
||||||
trigger_error('Clone is not allowed.', E_USER_ERROR);
|
trigger_error('Clone is not allowed.', E_USER_ERROR);
|
||||||
}
|
}
|
||||||
|
|
||||||
// --------------------------------------------------------------------------
|
// --------------------------------------------------------------------------
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -104,9 +104,9 @@ class Data_Store {
|
|||||||
{
|
{
|
||||||
return $this->current->{$key} = $val;
|
return $this->current->{$key} = $val;
|
||||||
}
|
}
|
||||||
|
|
||||||
// --------------------------------------------------------------------------
|
// --------------------------------------------------------------------------
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Static method to retreive current instance
|
* Static method to retreive current instance
|
||||||
* of the singleton
|
* of the singleton
|
||||||
@ -123,9 +123,9 @@ class Data_Store {
|
|||||||
|
|
||||||
return self::$instance;
|
return self::$instance;
|
||||||
}
|
}
|
||||||
|
|
||||||
// --------------------------------------------------------------------------
|
// --------------------------------------------------------------------------
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Removes a key from the data store
|
* Removes a key from the data store
|
||||||
*
|
*
|
||||||
@ -136,9 +136,9 @@ class Data_Store {
|
|||||||
{
|
{
|
||||||
unset($this->current->{$key});
|
unset($this->current->{$key});
|
||||||
}
|
}
|
||||||
|
|
||||||
// --------------------------------------------------------------------------
|
// --------------------------------------------------------------------------
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the entire data store object
|
* Return the entire data store object
|
||||||
*
|
*
|
||||||
|
@ -29,7 +29,7 @@ class Session {
|
|||||||
* @var array
|
* @var array
|
||||||
*/
|
*/
|
||||||
protected $sess = array();
|
protected $sess = array();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Reference to current instance
|
* Reference to current instance
|
||||||
*
|
*
|
||||||
|
@ -5,32 +5,32 @@
|
|||||||
*/
|
*/
|
||||||
class commonTest extends UnitTestCase {
|
class commonTest extends UnitTestCase {
|
||||||
|
|
||||||
function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
parent::__construct('Common.php Tests');
|
parent::__construct('Common.php Tests');
|
||||||
}
|
}
|
||||||
|
|
||||||
function setUp()
|
public function setUp()
|
||||||
{
|
{
|
||||||
$this->empty = array();
|
$this->empty = array();
|
||||||
$this->object = new stdClass();
|
$this->object = new stdClass();
|
||||||
$this->array_like = new stdClass(array('foo' => 'bar'));
|
$this->array_like = new stdClass(array('foo' => 'bar'));
|
||||||
}
|
}
|
||||||
|
|
||||||
function tearDown()
|
public function tearDown()
|
||||||
{
|
{
|
||||||
unset($this->empty);
|
unset($this->empty);
|
||||||
unset($this->object);
|
unset($this->object);
|
||||||
unset($this->array_like);
|
unset($this->array_like);
|
||||||
}
|
}
|
||||||
|
|
||||||
function testEmptyArrayNotLikeArray()
|
public function testEmptyArrayNotLikeArray()
|
||||||
{
|
{
|
||||||
// Empty is not array like
|
// Empty is not array like
|
||||||
$this->assertFalse(miniMVC\is_like_array($this->empty));
|
$this->assertFalse(miniMVC\is_like_array($this->empty));
|
||||||
}
|
}
|
||||||
|
|
||||||
function testEmptyObjectIsLikeArray()
|
public function testEmptyObjectIsLikeArray()
|
||||||
{
|
{
|
||||||
// Empty object is array like - because objects are truthy
|
// Empty object is array like - because objects are truthy
|
||||||
$this->assertTrue(miniMVC\is_like_array($this->object));
|
$this->assertTrue(miniMVC\is_like_array($this->object));
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
define('ENVIRONMENT', 'DEVELOPMENT');
|
define('ENVIRONMENT', 'DEVELOPMENT');
|
||||||
|
|
||||||
//Include simpletest
|
//Include simpletest
|
||||||
require_once('simpletest/autorun.php');
|
require_once 'simpletest/autorun.php';
|
||||||
|
|
||||||
// Set the default paths
|
// Set the default paths
|
||||||
define('MM_SYS_PATH', '../sys/');
|
define('MM_SYS_PATH', '../sys/');
|
||||||
@ -21,5 +21,5 @@ require_once(MM_SYS_PATH . 'db/tests/index.php');
|
|||||||
require_once(MM_SYS_PATH . 'common.php');
|
require_once(MM_SYS_PATH . 'common.php');
|
||||||
|
|
||||||
//Include test files
|
//Include test files
|
||||||
require_once('commonTest.php');
|
require_once 'commonTest.php';
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user