2005-05-15 21:41:38 +00:00
|
|
|
<?PHP
|
|
|
|
//////////////////////////////////////////////////////////////////////////
|
|
|
|
// + $Id$
|
|
|
|
// +------------------------------------------------------------------+ //
|
2005-05-16 00:52:42 +00:00
|
|
|
// + Cake <https://developers.nextco.com/cake/> + //
|
2005-05-17 21:27:56 +00:00
|
|
|
// + Copyright: (c) 2005, Cake Authors/Developers + //
|
2005-05-16 00:52:42 +00:00
|
|
|
// + Author(s): Michal Tatarynowicz aka Pies <tatarynowicz@gmail.com> + //
|
|
|
|
// + Larry E. Masters aka PhpNut <nut@phpnut.com> + //
|
|
|
|
// + Kamil Dzielinski aka Brego <brego.dk@gmail.com> + //
|
2005-05-15 21:41:38 +00:00
|
|
|
// +------------------------------------------------------------------+ //
|
2005-05-16 00:52:42 +00:00
|
|
|
// + Licensed under The MIT License + //
|
|
|
|
// + Redistributions of files must retain the above copyright notice. + //
|
2005-05-17 21:27:56 +00:00
|
|
|
// + See: http://www.opensource.org/licenses/mit-license.php + //
|
2005-05-15 21:41:38 +00:00
|
|
|
//////////////////////////////////////////////////////////////////////////
|
|
|
|
|
2005-05-21 22:40:51 +00:00
|
|
|
uses('log');
|
|
|
|
|
2005-05-15 21:41:38 +00:00
|
|
|
/**
|
|
|
|
* Purpose: Object
|
2005-05-21 22:40:51 +00:00
|
|
|
* Allows for __construct to be used in PHP4.
|
2005-05-15 21:41:38 +00:00
|
|
|
*
|
|
|
|
* @filesource
|
2005-05-17 21:27:56 +00:00
|
|
|
* @author Cake Authors/Developers
|
2005-05-16 00:52:42 +00:00
|
|
|
* @copyright Copyright (c) 2005, Cake Authors/Developers
|
|
|
|
* @link https://developers.nextco.com/cake/wiki/Authors Authors/Developers
|
2005-05-15 21:41:38 +00:00
|
|
|
* @package cake
|
|
|
|
* @subpackage cake.libs
|
|
|
|
* @since Cake v 0.2.9
|
|
|
|
* @version $Revision$
|
2005-05-16 00:52:42 +00:00
|
|
|
* @modifiedby $LastChangedBy$
|
|
|
|
* @lastmodified $Date$
|
|
|
|
* @license http://www.opensource.org/licenses/mit-license.php The MIT License
|
2005-05-15 21:41:38 +00:00
|
|
|
*/
|
2005-05-22 23:24:09 +00:00
|
|
|
|
|
|
|
uses('log');
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Enter description here...
|
|
|
|
*
|
|
|
|
* @package cake
|
|
|
|
* @subpackage cake.libs
|
|
|
|
* @since Cake v 0.2.9
|
|
|
|
*/
|
2005-05-15 21:41:38 +00:00
|
|
|
class Object {
|
2005-05-21 22:40:51 +00:00
|
|
|
|
2005-05-15 21:41:38 +00:00
|
|
|
/**
|
2005-05-21 22:40:51 +00:00
|
|
|
* A hack to support __construct() on PHP 4
|
|
|
|
* Hint: descendant classes have no PHP4 class_name() constructors,
|
|
|
|
* so this one gets called first and calls the top-layer __construct()
|
|
|
|
* which (if present) should call parent::__construct()
|
2005-05-15 21:41:38 +00:00
|
|
|
*
|
|
|
|
* @return Object
|
|
|
|
*/
|
2005-05-16 23:14:37 +00:00
|
|
|
function Object() {
|
2005-05-21 22:40:51 +00:00
|
|
|
$args = func_get_args();
|
|
|
|
register_shutdown_function(array(&$this, '__destruct'));
|
2005-05-16 23:14:37 +00:00
|
|
|
call_user_func_array(array(&$this, '__construct'), $args);
|
|
|
|
}
|
2005-05-15 21:41:38 +00:00
|
|
|
|
|
|
|
/**
|
2005-05-21 22:40:51 +00:00
|
|
|
* Class constructor, overriden in descendant classes
|
|
|
|
*/
|
|
|
|
function __construct() {
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Class destructor, overriden in descendant classes
|
|
|
|
*/
|
|
|
|
function __destruct() {
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Object-to-string conversion
|
|
|
|
* Each class can override it as necessary
|
2005-05-15 21:41:38 +00:00
|
|
|
*
|
2005-05-21 22:40:51 +00:00
|
|
|
* @return string this class' name
|
2005-05-15 21:41:38 +00:00
|
|
|
*/
|
2005-05-21 22:40:51 +00:00
|
|
|
function toString () {
|
|
|
|
return get_class($this);
|
2005-05-16 23:14:37 +00:00
|
|
|
}
|
2005-05-21 22:40:51 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* API for logging events
|
|
|
|
*
|
|
|
|
* @param string $msg
|
|
|
|
* @param string $type
|
|
|
|
*/
|
2005-05-21 22:51:26 +00:00
|
|
|
function log ($msg, $type=LOG_ERROR) {
|
2005-05-21 22:40:51 +00:00
|
|
|
if (!$this->_log)
|
|
|
|
$this->_log = new Log ();
|
|
|
|
|
|
|
|
switch ($type) {
|
|
|
|
case LOG_DEBUG:
|
|
|
|
return $this->_log->write('debug', $msg);
|
|
|
|
default:
|
|
|
|
return $this->_log->write('error', $msg);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2005-05-15 21:41:38 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
?>
|