Code style consistency improvements

This commit is contained in:
Timothy Warren 2012-05-18 13:52:12 -04:00
parent 134d1091a9
commit 8e97f37fe0
13 changed files with 96 additions and 96 deletions

View File

@ -131,3 +131,5 @@ define('DEFAULT_CSS_GROUP', "css");
| |
*/ */
define('DEFAULT_JS_GROUP', "js"); define('DEFAULT_JS_GROUP', "js");
// End of config.php

View File

@ -33,3 +33,5 @@ $db_conf = [
'file' => '', 'file' => '',
] ]
]; ];
// End of db.php

View File

@ -18,7 +18,7 @@
* *
* 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'
* *
* To route a special 404 page, set '404_route' to the "module/controller/method" you wish to use * To route a special 404 page, set '404_route' to the "module/controller/method" you wish to use
@ -35,3 +35,5 @@ return [
'default_module' => 'welcome', 'default_module' => 'welcome',
'404_route' => '', '404_route' => '',
]; ];
// End of routes.php

View File

@ -55,4 +55,5 @@ class Welcome extends MM_Controller {
$this->page->set_output($output); $this->page->set_output($output);
} }
} }
// End of welcome.php // End of welcome.php

View File

@ -28,3 +28,5 @@ class Welcome_Model extends MM_Model{
parent::__construct(); parent::__construct();
} }
} }
// End of welcome_model.php

View File

@ -184,4 +184,5 @@ header("Expires: ".gmdate('D, d M Y H:i:s', (filemtime($this_file) + 691200))."
echo $js; echo $js;
ob_end_flush(); ob_end_flush();
//end of js.php //end of js.php

View File

@ -21,7 +21,7 @@
*/ */
class DB extends Query_Builder { class DB extends Query_Builder {
use JSObject; use Generic;
/** /**
* DB connection instances * DB connection instances
@ -62,33 +62,6 @@ class DB extends Query_Builder {
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------
/**
* Constructor to override JSObject trait
*
* @param array $params
*/
public function __construct(array $params=[])
{
// Let's try connecting now!
parent::__construct($params);
}
// --------------------------------------------------------------------------
/**
* Override __call in trait to call __call in Query Builder...lol
*
* @param string $name
* @param array $params
* @return mixed
*/
public function __call($name, $params=[])
{
return parent::__call($name, $params);
}
// --------------------------------------------------------------------------
/** /**
* Returns the last error from the database * Returns the last error from the database
* *

View File

@ -420,7 +420,9 @@ class MM_Page extends MM_Output {
$js_file = "{$path}/js/{$js}.js"; $js_file = "{$path}/js/{$js}.js";
if ($domain == FALSE) if ($domain == FALSE)
{
$js_file = $js; $js_file = $js;
}
$tag = '<script src="' . $js_file . '"></script>'; $tag = '<script src="' . $js_file . '"></script>';

View File

@ -12,50 +12,16 @@
*/ */
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------
// ! JSObject Trait // ! Generic Trait
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------
/** /**
* Parent trait of base class, contains much of the magic * Simple Trait to include the toString() magic method
* *
* @package miniMVC * @package miniMVC
* @subpackage System * @subpackage System
*/ */
trait JSObject { trait Generic {
/**
* Constructor for creating the objects
*
* @param array $members
* @return void
*/
public function __construct($members = [])
{
// Add the passed parameters to the object
foreach($members as $name => &$value)
{
$this->$name = $value;
}
}
// --------------------------------------------------------------------------
/**
* PHP magic method to facilitate dynamic methods
*
* @param string $name
* @param array $params
*/
public function __call($name, $params = [])
{
if(is_callable($this->$name))
{
//Call the dynamic function
return call_user_func_array($this->$name, $params);
}
}
// --------------------------------------------------------------------------
/** /**
* Prints out the contents of the object when used as a string * Prints out the contents of the object when used as a string
@ -103,6 +69,53 @@ trait JSObject {
return ''; return '';
} }
} }
}
// --------------------------------------------------------------------------
// ! JSObject Trait
// --------------------------------------------------------------------------
/**
* Parent trait of base class, contains much of the magic
*
* @package miniMVC
* @subpackage System
*/
trait JSObject {
use Generic;
/**
* Constructor for creating the objects
*
* @param array $members
* @return void
*/
public function __construct($members = [])
{
// Add the passed parameters to the object
foreach($members as $name => &$value)
{
$this->$name = $value;
}
}
// --------------------------------------------------------------------------
/**
* PHP magic method to facilitate dynamic methods
*
* @param string $name
* @param array $params
*/
public function __call($name, $params = [])
{
if (is_callable($this->$name))
{
//Call the dynamic function
return call_user_func_array($this->$name, $params);
}
}
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------
@ -130,6 +143,8 @@ trait JSObject {
*/ */
trait Singleton { trait Singleton {
use Generic;
/** /**
* Singleton object * Singleton object
* *