added ActiveLog and did some cleanup

This commit is contained in:
2010-01-14 05:31:54 +02:00
parent 5530d124c6
commit 19ea0b8e4f
6 changed files with 78 additions and 29 deletions

View File

@@ -2,7 +2,7 @@
/*
Zynapse Environment
- configure server environments and display modes
- configure server environment
*/

View File

@@ -56,26 +56,10 @@ class ActionBase {
public function __construct () {
}
public function __sleep () {
$blacklist = array_flip(array("env", "view", "log", "locale"));
$save = array();
foreach( $this as $key => $value ) {
if ( !array_key_exists($key, $blacklist) ) {
$save[] = $key;
}
}
return $save;
}
public function __wakeup () {
$this->set_paths();
}
public function init () {
$this->set_paths();
$this->started = true;
}

View File

@@ -52,7 +52,7 @@ class ActionEnvironment {
function __construct () {
$this->set_include_paths();
}
function init () {
@@ -61,11 +61,6 @@ class ActionEnvironment {
$this->started = true;
}
function __wakeup () {
$this->set_include_paths();
$this->define_constants();
}
function load_environment_file () {
require_once(ZNAP_CONFIG."/environment.php");
if ( !empty($enable_host_specific_configuration) ) {

View File

@@ -51,7 +51,6 @@ class ActionView {
}
function init () {
$this->started = true;
}

59
vendor/zynapse/active_log.php vendored Normal file
View File

@@ -0,0 +1,59 @@
<?php
/*
ActiveLog - event logging
http://www.zynapse.org/
Copyright (c) 2010 Jim Myhrberg.
----------
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
----------
*/
class ActiveLog {
public
# Components
$env, // ActionEnvironment
$base, // ActionBase
$view, // ActionView
$locale, // ActiveLocale
$session, // ActiveSession
# Misc.
$started = false;
function __construct () {
}
function init () {
$this->started = true;
}
}
?>

View File

@@ -46,31 +46,40 @@ class Zynapse {
function init () {
require_once(ZNAP_LIB_ROOT."/action_environment.php");
require_once(ZNAP_LIB_ROOT."/active_session.php");
require_once(ZNAP_LIB_ROOT."/action_base.php");
require_once(ZNAP_LIB_ROOT."/action_view.php");
require_once(ZNAP_LIB_ROOT."/active_session.php");
require_once(ZNAP_LIB_ROOT."/active_log.php");
# Create component objects
self::$session = new ActiveSession();
self::$env = new ActionEnvironment();
self::$session = new ActiveSession();
self::$base = new ActionBase();
self::$view = new ActionView();
self::$log = new ActiveLog();
# Assign internal component references
self::$env->session =& self::$session;
self::$env->base =& self::$base;
self::$base->env =& self::$env;
self::$base->view =& self::$view;
// self::$base->log =& self::$log; //TODO Create ActionLog class
self::$base->log =& self::$log;
self::$base->locale =& self::$locale;
self::$base->session =& self::$session;
self::$view->env =& self::$env;
self::$view->base =& self::$base;
// self::$view->log =& self::$log; //TODO Create ActionLog class
self::$view->log =& self::$log;
self::$view->locale =& self::$locale;
self::$view->session =& self::$session;
self::$log->env =& self::$env;
self::$log->base =& self::$base;
self::$log->view =& self::$view;
self::$log->locale =& self::$locale;
self::$log->session =& self::$session;
# Init the environment system (ActionEnvironment)
self::$env->init();
@@ -81,6 +90,9 @@ class Zynapse {
# Init the core controller system (ActionBase)
self::$base->init();
# Init the logging system (ActiveLog)
self::$log->init();
# Init the output and page rendering system (ActionView)
self::$view->init();