diff --git a/docs/classes/DB.html b/docs/classes/DB.html index 456a5b7..5b6a908 100644 --- a/docs/classes/DB.html +++ b/docs/classes/DB.html @@ -159,7 +159,7 @@
+ generated on 2012-05-18T08:03:49-04:00.
diff --git a/docs/classes/MM.html b/docs/classes/MM.html index 81d3ce1..f5cb354 100644 --- a/docs/classes/MM.html +++ b/docs/classes/MM.html @@ -433,7 +433,7 @@ dynamic methods
+ generated on 2012-05-18T08:03:49-04:00.
diff --git a/docs/classes/MM_Controller.html b/docs/classes/MM_Controller.html index ca390de..9656861 100644 --- a/docs/classes/MM_Controller.html +++ b/docs/classes/MM_Controller.html @@ -757,7 +757,7 @@ dynamic methods
+ generated on 2012-05-18T08:03:49-04:00.
diff --git a/docs/classes/MM_Data_Store.html b/docs/classes/MM_Data_Store.html index dc2569d..c795016 100644 --- a/docs/classes/MM_Data_Store.html +++ b/docs/classes/MM_Data_Store.html @@ -199,7 +199,7 @@ of the singleton
+ generated on 2012-05-18T08:03:49-04:00.
diff --git a/docs/classes/MM_Model.html b/docs/classes/MM_Model.html index 4c86ca4..e3a1aa8 100644 --- a/docs/classes/MM_Model.html +++ b/docs/classes/MM_Model.html @@ -710,7 +710,7 @@ dynamic methods
+ generated on 2012-05-18T08:03:49-04:00.
diff --git a/docs/classes/MM_Output.html b/docs/classes/MM_Output.html index 4b0a4ef..a047c13 100644 --- a/docs/classes/MM_Output.html +++ b/docs/classes/MM_Output.html @@ -639,7 +639,7 @@ Used for outputing HTML
+ generated on 2012-05-18T08:03:49-04:00.
diff --git a/docs/classes/MM_Page.html b/docs/classes/MM_Page.html index e6ee0e1..af36516 100644 --- a/docs/classes/MM_Page.html +++ b/docs/classes/MM_Page.html @@ -1174,7 +1174,7 @@ supports

+ generated on 2012-05-18T08:03:49-04:00.
diff --git a/docs/classes/MM_Session.html b/docs/classes/MM_Session.html index c59ab0a..aa356dc 100644 --- a/docs/classes/MM_Session.html +++ b/docs/classes/MM_Session.html @@ -143,7 +143,7 @@
+ generated on 2012-05-18T08:03:49-04:00.
diff --git a/docs/classes/miniMVC.html b/docs/classes/miniMVC.html index 7778c43..d48d72b 100644 --- a/docs/classes/miniMVC.html +++ b/docs/classes/miniMVC.html @@ -608,7 +608,7 @@ dynamic methods
+ generated on 2012-05-18T08:03:49-04:00.
diff --git a/docs/deprecated.html b/docs/deprecated.html index 87d3cac..8a9873c 100644 --- a/docs/deprecated.html +++ b/docs/deprecated.html @@ -66,7 +66,7 @@
+ generated on 2012-05-18T08:03:49-04:00.
diff --git a/docs/errors.html b/docs/errors.html index 95f8b39..5030e03 100644 --- a/docs/errors.html +++ b/docs/errors.html @@ -81,7 +81,7 @@
+ generated on 2012-05-18T08:03:49-04:00.
diff --git a/docs/graph_class.html b/docs/graph_class.html index 31364a2..9b812a9 100644 --- a/docs/graph_class.html +++ b/docs/graph_class.html @@ -63,7 +63,7 @@
+ generated on 2012-05-18T08:03:49-04:00.
diff --git a/docs/index.html b/docs/index.html index 2db479d..b32d5c3 100644 --- a/docs/index.html +++ b/docs/index.html @@ -78,7 +78,7 @@
+ generated on 2012-05-18T08:03:49-04:00.
diff --git a/docs/markers.html b/docs/markers.html index 292b3cc..7315deb 100644 --- a/docs/markers.html +++ b/docs/markers.html @@ -68,7 +68,7 @@
+ generated on 2012-05-18T08:03:49-04:00.
diff --git a/docs/namespaces/default.html b/docs/namespaces/default.html index b321456..601ecf0 100644 --- a/docs/namespaces/default.html +++ b/docs/namespaces/default.html @@ -184,23 +184,6 @@
bool
-
-

Function to search through the tree to find the necessary file

-
load_file(string $file, string $curr_path) : void
-
-
-

-

Parameters

-
-

$file

-string -
-
-

$curr_path

-string -
-
-

Custom error handler

on_error(int $severity, string $message, string $filepath, int $line) : \ErrorException
@@ -421,19 +404,13 @@ display them cleanly

- 
-

Define a session id to namespace sessions

-
Unknown 
-
-

-
+ generated on 2012-05-18T08:03:49-04:00.
diff --git a/docs/packages/.html b/docs/packages/.html index 6ab3b6e..0ecccc9 100644 --- a/docs/packages/.html +++ b/docs/packages/.html @@ -66,7 +66,7 @@
+ generated on 2012-05-18T08:03:49-04:00.
diff --git a/docs/packages/Default.html b/docs/packages/Default.html index f8587e6..22ba211 100644 --- a/docs/packages/Default.html +++ b/docs/packages/Default.html @@ -65,7 +65,6 @@
  • MM_BASE_PATH
    MM_BASE_PATH
  • MM_MOD_PATH
    MM_MOD_PATH
  • MM_SYS_PATH
    MM_SYS_PATH
  • -
  • Define a session id to namespace sessions
    Unknown
  • @@ -102,19 +101,13 @@

    - 
    -

    Define a session id to namespace sessions

    -
    Unknown 
    -
    -

    -
    + generated on 2012-05-18T08:03:49-04:00.
    diff --git a/docs/packages/miniMVC.App.html b/docs/packages/miniMVC.App.html index b60eb43..5569588 100644 --- a/docs/packages/miniMVC.App.html +++ b/docs/packages/miniMVC.App.html @@ -99,7 +99,7 @@
    + generated on 2012-05-18T08:03:49-04:00.
    diff --git a/docs/packages/miniMVC.Libraries.html b/docs/packages/miniMVC.Libraries.html index a49da7a..b138ddb 100644 --- a/docs/packages/miniMVC.Libraries.html +++ b/docs/packages/miniMVC.Libraries.html @@ -96,7 +96,7 @@
    + generated on 2012-05-18T08:03:49-04:00.
    diff --git a/docs/packages/miniMVC.System.html b/docs/packages/miniMVC.System.html index 9682159..8a6c5f5 100644 --- a/docs/packages/miniMVC.System.html +++ b/docs/packages/miniMVC.System.html @@ -136,7 +136,7 @@
    + generated on 2012-05-18T08:03:49-04:00.
    diff --git a/docs/packages/miniMVC.html b/docs/packages/miniMVC.html index 8b68f37..e81c02b 100644 --- a/docs/packages/miniMVC.html +++ b/docs/packages/miniMVC.html @@ -81,7 +81,6 @@
  • Singleton getter function
    get_instance
  • Load required classes for bootstraping
    init
  • Utility function to check if a variable is set, and is an array or object
    is_like_array
  • -
  • Function to search through the tree to find the necessary file
    load_file
  • Custom error handler
    on_error
  • Custom exception handlererror_get_last
    on_exception
  • Calls the appropriate module/controller/function based on the url
    route
  • @@ -219,23 +218,6 @@ display them cleanly
    shutdown
    bool
    -
    -

    Function to search through the tree to find the necessary file

    -
    load_file(string $file, string $curr_path) : void
    -
    -
    -

    -

    Parameters

    -
    -

    $file

    -string -
    -
    -

    $curr_path

    -string -
    -
    -

    Custom error handler

    on_error(int $severity, string $message, string $filepath, int $line) : \ErrorException
    @@ -467,7 +449,7 @@ display them cleanly
    + generated on 2012-05-18T08:03:49-04:00.
    diff --git a/docs/structure.xml b/docs/structure.xml index 49c7de5..2d3c76f 100644 --- a/docs/structure.xml +++ b/docs/structure.xml @@ -1,6 +1,6 @@ - + Convention-based micro-framework for PHP

    ]]>
    @@ -41,7 +41,7 @@
    - + Convention-based micro-framework for PHP

    ]]>
    @@ -155,7 +155,7 @@
    - + Convention-based micro-framework for PHP

    ]]>
    @@ -336,7 +336,7 @@
    - + Convention-based micro-framework for PHP

    ]]>
    @@ -967,7 +967,7 @@ dynamic methods]]>
    - + Convention-based micro-framework for PHP

    ]]>
    @@ -1073,7 +1073,7 @@ dynamic methods]]>
    - + Convention-based micro-framework for PHP

    ]]>
    @@ -1203,7 +1203,7 @@ Used for outputing HTML]]>
    - + Convention-based micro-framework for PHP

    ]]>
    @@ -1348,7 +1348,7 @@ of the singleton]]>
    - + Convention-based micro-framework for PHP

    ]]>
    @@ -1358,103 +1358,95 @@ of the singleton]]>
    - - Unknown - - - - - - - + MM_Session \MM_Session - + - - + + - + $sess - + - + array - + __construct function - + - + __set function - + - + string - + mixed - + void - + $key - + $val - + __get function - + - + string - + mixed - + $key - + destroy function - + - + void
    - + Convention-based micro-framework for PHP

    ]]>
    @@ -1464,270 +1456,243 @@ of the singleton]]>
    - + shutdown function - + - + void - - load_file - function - - - - - string - - - string - - - void - - - - $file - - - - - $curr_path - - - - - + on_error function - + - + int - + string - + string - + int - + \ErrorException - + $severity - + $message - + $filepath - + $line - + on_exception function - + - + \Exception - + void - + $exception - - is_like_array - function - - - - - mixed - - - bool - - - - $var - - - - - + show_404 function - + - + void - + show_error function - + - + string - + int - + $message - + $status_code - + + is_like_array + function + + + + + mixed + + + bool + + + + $var + + + + + controller_methods function - + - + string - + array - + $controller - - route - function - - - - - void - - - - + site_url function - + - + string - + string - + $segment - + to_string function - + - + \object/array - + string - + string - + $data - + $method - + do_include function - + - + string - + void - + $path - + init function - + - + + void + + + + + route + function + + + + void
    - + Convention-based micro-framework for PHP

    ]]>
    @@ -1737,10 +1702,10 @@ display them cleanly]]>
    - + config/config.php - + common.php diff --git a/sys/common.php b/sys/common.php index ca14478..206d77c 100644 --- a/sys/common.php +++ b/sys/common.php @@ -21,6 +21,8 @@ */ // -------------------------------------------------------------------------- +// ! Error handling / messages +// -------------------------------------------------------------------------- /** * Function to run on script shutdown @@ -42,49 +44,15 @@ function shutdown() { $file = str_replace(MM_BASE_PATH, "", $error['file']); - $err_msg = <<Fatal Error: -{$error['message']}

    -File: {$file}

    -Line: {$error['line']} -TXT; + $err_msg = "

    Fatal Error:

    + {$error['message']}

    + File: {$file}

    + Line: {$error['line']}"; + show_error($err_msg); } } -// -------------------------------------------------------------------------- - -/** - * Function to search through the tree to find the necessary file - * - * @param string $file - * @param string $curr_path - * @return void - */ -function load_file($file, $curr_path="") -{ - $path = ""; - - if ($curr_path === "app") - { - $path = MM_APP_PATH."{$file}.php"; - } - else if ($curr_path === "sys") - { - $path = MM_SYS_PATH."{$file}.php"; - } - else - { - $path = MM_MOD_PATH."{$curr_path}/{$file}.php"; - } - - if (is_file($path)) - { - require_once($path); - } -} - - // -------------------------------------------------------------------------- /** @@ -117,7 +85,7 @@ function on_exception($exception) // Contain the content for buffering ob_start(); - include(MM_APP_PATH.'/views/errors/error_php_exception.php'); + include(MM_APP_PATH . '/views/errors/error_php_exception.php'); $buffer = ob_get_contents(); ob_end_clean(); @@ -126,24 +94,6 @@ function on_exception($exception) // -------------------------------------------------------------------------- -/** - * Utility function to check if a variable is set, and is an array or object - * - * @param mixed $var - * @return bool - */ -function is_like_array(&$var) -{ - if ( ! isset($var)) - { - return FALSE; - } - - return (is_array($var) OR is_object($var)) && ( ! empty($var)); -} - -// -------------------------------------------------------------------------- - /** * General 404 function * @@ -159,7 +109,7 @@ function show_404() // This is passed to the error template $message = '404 Not Found'; - include(MM_APP_PATH.'/views/errors/error_404.php'); + include(MM_APP_PATH . '/views/errors/error_404.php'); $buffer = ob_get_contents(); ob_end_clean(); @@ -184,13 +134,33 @@ function show_error($message, $status_code=null) // Contain the content for buffering ob_start(); - include(MM_APP_PATH.'/views/errors/error_general.php'); + include(MM_APP_PATH . '/views/errors/error_general.php'); $buffer = ob_get_contents(); ob_end_clean(); die($buffer); } +// -------------------------------------------------------------------------- +// ! Utility Functions +// -------------------------------------------------------------------------- + +/** + * Utility function to check if a variable is set, and is an array or object + * + * @param mixed $var + * @return bool + */ +function is_like_array(&$var) +{ + if ( ! isset($var)) + { + return FALSE; + } + + return (is_array($var) OR is_object($var)) && ( ! empty($var)); +} + // -------------------------------------------------------------------------- /** @@ -212,6 +182,99 @@ function controller_methods($controller) // -------------------------------------------------------------------------- +/** + * Returns a full url from a url segment + * + * @param string $segment + * @return string + */ +function site_url($segment) +{ + return $url = BASEURL . URL_INDEX_FILE . $segment; +} + +// -------------------------------------------------------------------------- + +/** + * Prints out the contents of the object + * + * @param object/array $data + * @param string $method + * @return string + */ +function to_string($data, $method='print_r') +{ + $output = '
    ';
    +	
    +	if ($method == "var_dump")
    +	{
    +		ob_start();
    +		var_dump($data);
    +		$output .= ob_get_contents();
    +		ob_end_clean();
    +	}
    +	else if ($method == "var_export")
    +	{
    +		ob_start();
    +		var_export($data);
    +		$output .= ob_get_contents();
    +		ob_end_clean();
    +	}	
    +	else
    +	{
    +		$output .= print_r($data, TRUE);
    +	}
    +
    +	return $output . '
    '; +} + +// -------------------------------------------------------------------------- + +/** + * Array_map callback to load a folder of classes at once + * + * @param string $path + * @return void + */ +function do_include($path) +{ + require_once($path); +} + +// -------------------------------------------------------------------------- +// ! Bootstrap functions +// -------------------------------------------------------------------------- + +/** + * Load required classes for bootstraping + * + * @return void + */ +function init() +{ + // Catch fatal errors, don't show them + error_reporting((-1) & ~(E_ERROR | E_PARSE)); + register_shutdown_function('shutdown'); + + //Set error handlers + set_error_handler('on_error'); + set_exception_handler('on_exception'); + + // Load Database classes + require_once(MM_SYS_PATH . 'db/autoload.php'); + + // Load system libraries + require_once(MM_SYS_PATH . 'core/traits.php'); + require_once(MM_SYS_PATH . 'core/MM.php'); + require_once(MM_SYS_PATH . 'core/miniMVC.php'); + array_map('do_include', glob(MM_SYS_PATH . 'core/*.php')); + + // Map to the appropriate module/controller/function + route(); +} + +// -------------------------------------------------------------------------- + /** * Calls the appropriate module/controller/function based on the url * @@ -234,7 +297,7 @@ function route() } // Load the routes config file - $routes = require_once(MM_APP_PATH.'config/routes.php'); + $routes = require_once(MM_APP_PATH . 'config/routes.php'); // Set the default route $module = $routes['default_module']; @@ -315,7 +378,7 @@ function route() } } - $path = MM_MOD_PATH."{$module}/controllers/{$controller}.php"; + $path = MM_MOD_PATH . "{$module}/controllers/{$controller}.php"; if (is_file($path)) { @@ -342,95 +405,4 @@ function route() show_404(); } -// -------------------------------------------------------------------------- - -/** - * Returns a full url from a url segment - * - * @param string $segment - * @return string - */ -function site_url($segment) -{ - return $url = BASEURL . URL_INDEX_FILE . $segment; -} - -// -------------------------------------------------------------------------- - -/** - * Prints out the contents of the object - * - * @param object/array $data - * @param string $method - * @return string - */ -function to_string($data, $method='print_r') -{ - $output = '
    ';
    -	
    -	if ($method == "var_dump")
    -	{
    -		ob_start();
    -		var_dump($data);
    -		$output .= ob_get_contents();
    -		ob_end_clean();
    -	}
    -	else if ($method == "var_export")
    -	{
    -		ob_start();
    -		var_export($data);
    -		$output .= ob_get_contents();
    -		ob_end_clean();
    -	}	
    -	else
    -	{
    -		$output .= print_r($data, TRUE);
    -	}
    -
    -	return $output . '
    '; -} - -// -------------------------------------------------------------------------- - -/** - * Array_map callback to load a folder of classes at once - * - * @param string $path - * @return void - */ -function do_include($path) -{ - require_once($path); -} - -// -------------------------------------------------------------------------- - -/** - * Load required classes for bootstraping - * - * @return void - */ -function init() -{ - // Catch fatal errors, don't show them - error_reporting((-1) & ~(E_ERROR | E_PARSE)); - register_shutdown_function('shutdown'); - - //Set error handlers - set_error_handler('on_error'); - set_exception_handler('on_exception'); - - // Load Database classes - require_once(MM_SYS_PATH.'db/autoload.php'); - - // Load system libraries - require_once(MM_SYS_PATH.'core/traits.php'); - require_once(MM_SYS_PATH.'core/MM.php'); - require_once(MM_SYS_PATH.'core/miniMVC.php'); - array_map('do_include', glob(MM_SYS_PATH.'core/*.php')); - - // Map to the appropriate module/controller/function - route(); -} - // End of common.php \ No newline at end of file