mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 11:28:25 +00:00
6baaa1120f
Adding empty directories where overrides for the core views can be placed. Adding an empty directory for elements [1127] Adding directory to hold core inflection files [1128] More work on the new inflector. This still is not completed but should be soon [1130] Documentation strings, du jour. [1131] Docstringed and ready. Inflector lacks one docstring. It is noted in its todo [1132] Incomplete documentation, and some corrections to previous documentation. Gwoo noted that there'll be more changes in the Helpers soon, so I back off here. [1134] Adding before filters back to code. Commented out a regex in Inflector::pluralize(); that os causing problems. Removed a duplicate define in index.php. Removed the bare array being set automatically when using requestAction(). With this change you must use requestAction(); like this. $object->requestAction('/bare/controller/action/param'); Added GOTCHAS file with links to problems people may have with CakePHP. Some more work done on new Inflector. [1135] Added a check when trying to access a private method of a controller. This will now display an error page informing user that this is not allowed. [1137] Fixed a few undefined variable errors in the code Corrected problem with double layout display when an error is returned and caught. git-svn-id: https://svn.cakephp.org/repo/trunk/cake@1138 3807eeeb-6ff5-0310-8944-8be069107fe0
145 lines
No EOL
3.4 KiB
PHP
145 lines
No EOL
3.4 KiB
PHP
<?php
|
|
/* SVN FILE: $Id$ */
|
|
|
|
/**
|
|
* Object class, allowing __construct and __destruct in PHP4.
|
|
*
|
|
* Also includes methods for logging and the special method RequestAction,
|
|
* to call other Controllers' Actions from anywhere.
|
|
*
|
|
* PHP versions 4 and 5
|
|
*
|
|
* CakePHP : Rapid Development Framework <http://www.cakephp.org/>
|
|
* Copyright (c) 2005, CakePHP Authors/Developers
|
|
*
|
|
* 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>
|
|
*
|
|
* Licensed under The MIT License
|
|
* Redistributions of files must retain the above copyright notice.
|
|
*
|
|
* @filesource
|
|
* @author CakePHP Authors/Developers
|
|
* @copyright Copyright (c) 2005, CakePHP Authors/Developers
|
|
* @link https://trac.cakephp.org/wiki/Authors Authors/Developers
|
|
* @package cake
|
|
* @subpackage cake.cake.libs
|
|
* @since CakePHP v 0.2.9
|
|
* @version $Revision$
|
|
* @modifiedby $LastChangedBy$
|
|
* @lastmodified $Date$
|
|
* @license http://www.opensource.org/licenses/mit-license.php The MIT License
|
|
*/
|
|
|
|
/**
|
|
* Included libraries.
|
|
*/
|
|
uses('log');
|
|
|
|
/**
|
|
* Object class, allowing __construct and __destruct in PHP4.
|
|
*
|
|
* Also includes methods for logging and the special method RequestAction,
|
|
* to call other Controllers' Actions from anywhere.
|
|
*
|
|
* @package cake
|
|
* @subpackage cake.cake.libs
|
|
* @since CakePHP v 0.2.9
|
|
*/
|
|
class Object
|
|
{
|
|
|
|
/**
|
|
* Log object
|
|
*
|
|
* @var object
|
|
*/
|
|
var $_log = null;
|
|
|
|
/**
|
|
* A hack to support __construct() on PHP 4
|
|
* Hint: descendant classes have no PHP4 class_name() constructors,
|
|
* so this constructor gets called first and calls the top-layer __construct()
|
|
* which (if present) should call parent::__construct()
|
|
*
|
|
* @return Object
|
|
*/
|
|
function Object()
|
|
{
|
|
$args = func_get_args();
|
|
register_shutdown_function(array(&$this, '__destruct'));
|
|
call_user_func_array(array(&$this, '__construct'), $args);
|
|
}
|
|
|
|
/**
|
|
* Class constructor, overridden in descendant classes.
|
|
*/
|
|
function __construct()
|
|
{
|
|
}
|
|
|
|
/**
|
|
* Class destructor, overridden in descendant classes.
|
|
*/
|
|
function __destruct()
|
|
{
|
|
}
|
|
|
|
/**
|
|
* Object-to-string conversion.
|
|
* Each class can override this method as necessary.
|
|
*
|
|
* @return string The name of this class
|
|
*/
|
|
function toString()
|
|
{
|
|
return get_class($this);
|
|
}
|
|
|
|
/**
|
|
* Calls a controller's method from any location.
|
|
*
|
|
* @param string $url URL in the form of Cake URL ("/controller/method/parameter")
|
|
* @param array $extra If array includes the key "render" it sets the AutoRender to true.
|
|
* @return boolean Success
|
|
*/
|
|
function requestAction ($url, $extra = array())
|
|
{
|
|
if(in_array('render', $extra))
|
|
{
|
|
$extra['render'] = 0;
|
|
}
|
|
else
|
|
{
|
|
$extra['render'] = 1;
|
|
}
|
|
//$extra = array_merge($extra, array('bare'=>1));
|
|
$dispatcher =& new Dispatcher();
|
|
return $dispatcher->dispatch($url, $extra);
|
|
}
|
|
|
|
/**
|
|
* API for logging events.
|
|
*
|
|
* @param string $msg Log message
|
|
* @param int $type Error type constant. Defined in /libs/log.php.
|
|
*/
|
|
function log ($msg, $type=LOG_ERROR)
|
|
{
|
|
if (is_null($this->_log))
|
|
{
|
|
$this->_log = new Log ();
|
|
}
|
|
|
|
switch ($type)
|
|
{
|
|
case LOG_DEBUG:
|
|
return $this->_log->write('debug', $msg);
|
|
default:
|
|
return $this->_log->write('error', $msg);
|
|
}
|
|
}
|
|
}
|
|
|
|
?>
|