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");
// End of config.php

View File

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

View File

@ -18,7 +18,7 @@
*
* 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'
*
* 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',
'404_route' => '',
];
// End of routes.php

View File

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

View File

@ -28,3 +28,5 @@ class Welcome_Model extends MM_Model{
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;
ob_end_flush();
//end of js.php

View File

@ -21,7 +21,7 @@
*/
class DB extends Query_Builder {
use JSObject;
use Generic;
/**
* 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
*

View File

@ -420,7 +420,9 @@ class MM_Page extends MM_Output {
$js_file = "{$path}/js/{$js}.js";
if ($domain == FALSE)
{
$js_file = $js;
}
$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
* @subpackage System
*/
trait JSObject {
/**
* 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);
}
}
// --------------------------------------------------------------------------
trait Generic {
/**
* Prints out the contents of the object when used as a string
@ -103,6 +69,53 @@ trait JSObject {
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 {
use Generic;
/**
* Singleton object
*