mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 11:28:25 +00:00
Updating intialiize() callbacks. Moving $this->_set() int Component::__construct as all the core components did it. Updating constructors and including parent calls.
This commit is contained in:
parent
052c81774c
commit
a4e2f7c55f
8 changed files with 13 additions and 35 deletions
|
@ -67,7 +67,7 @@ class Component extends Object {
|
||||||
public function __construct(ComponentCollection $collection, $settings = array()) {
|
public function __construct(ComponentCollection $collection, $settings = array()) {
|
||||||
$this->_Collection = $collection;
|
$this->_Collection = $collection;
|
||||||
$this->settings = $settings;
|
$this->settings = $settings;
|
||||||
|
$this->_set($settings);
|
||||||
if (!empty($this->components)) {
|
if (!empty($this->components)) {
|
||||||
$this->_componentMap = ComponentCollection::normalizeObjectArray($this->components);
|
$this->_componentMap = ComponentCollection::normalizeObjectArray($this->components);
|
||||||
}
|
}
|
||||||
|
|
|
@ -46,7 +46,8 @@ class AclComponent extends Component {
|
||||||
*
|
*
|
||||||
* @throws Exception when Acl.classname could not be loaded.
|
* @throws Exception when Acl.classname could not be loaded.
|
||||||
*/
|
*/
|
||||||
public function __construct() {
|
public function __construct(ComponentCollection $collection, $settings = array()) {
|
||||||
|
parent::__construct($collection, $settings);
|
||||||
$name = Inflector::camelize(strtolower(Configure::read('Acl.classname')));
|
$name = Inflector::camelize(strtolower(Configure::read('Acl.classname')));
|
||||||
if (!class_exists($name)) {
|
if (!class_exists($name)) {
|
||||||
if (App::import('Component', $name)) {
|
if (App::import('Component', $name)) {
|
||||||
|
@ -86,16 +87,6 @@ class AclComponent extends Component {
|
||||||
return $this->_Instance;
|
return $this->_Instance;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Startup is not used
|
|
||||||
*
|
|
||||||
* @param object $controller Controller using this component
|
|
||||||
* @return boolean Proceed with component usage (true), or fail (false)
|
|
||||||
*/
|
|
||||||
public function startup(&$controller) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Pass-thru function for ACL check instance. Check methods
|
* Pass-thru function for ACL check instance. Check methods
|
||||||
* are used to check whether or not an ARO can access an ACO
|
* are used to check whether or not an ARO can access an ACO
|
||||||
|
|
|
@ -268,7 +268,7 @@ class AuthComponent extends Component {
|
||||||
* @param object $controller A reference to the instantiating controller object
|
* @param object $controller A reference to the instantiating controller object
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function initialize(&$controller, $settings = array()) {
|
public function initialize(&$controller) {
|
||||||
$this->params = $controller->params;
|
$this->params = $controller->params;
|
||||||
$crud = array('create', 'read', 'update', 'delete');
|
$crud = array('create', 'read', 'update', 'delete');
|
||||||
$this->actionMap = array_merge($this->actionMap, array_combine($crud, $crud));
|
$this->actionMap = array_merge($this->actionMap, array_combine($crud, $crud));
|
||||||
|
@ -290,8 +290,7 @@ class AuthComponent extends Component {
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$this->_set($settings);
|
if (Configure::read() > 0) {
|
||||||
if (Configure::read('debug') > 0) {
|
|
||||||
App::import('Debugger');
|
App::import('Debugger');
|
||||||
Debugger::checkSecurityKeys();
|
Debugger::checkSecurityKeys();
|
||||||
}
|
}
|
||||||
|
|
|
@ -162,9 +162,8 @@ class CookieComponent extends Component {
|
||||||
*
|
*
|
||||||
* @param object $controller A reference to the instantiating controller object
|
* @param object $controller A reference to the instantiating controller object
|
||||||
*/
|
*/
|
||||||
public function initialize(&$controller, $settings) {
|
public function initialize(&$controller) {
|
||||||
$this->key = Configure::read('Security.salt');
|
$this->key = Configure::read('Security.salt');
|
||||||
$this->_set($settings);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -303,12 +303,11 @@ class EmailComponent extends Component {
|
||||||
*
|
*
|
||||||
* @param object $controller Instantiating controller
|
* @param object $controller Instantiating controller
|
||||||
*/
|
*/
|
||||||
public function initialize(&$controller, $settings = array()) {
|
public function initialize(&$controller) {
|
||||||
$this->Controller = $controller;
|
$this->Controller = $controller;
|
||||||
if (Configure::read('App.encoding') !== null) {
|
if (Configure::read('App.encoding') !== null) {
|
||||||
$this->charset = Configure::read('App.encoding');
|
$this->charset = Configure::read('App.encoding');
|
||||||
}
|
}
|
||||||
$this->_set($settings);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -173,8 +173,10 @@ class RequestHandlerComponent extends Component {
|
||||||
/**
|
/**
|
||||||
* Constructor. Parses the accepted content types accepted by the client using HTTP_ACCEPT
|
* Constructor. Parses the accepted content types accepted by the client using HTTP_ACCEPT
|
||||||
*
|
*
|
||||||
|
* @param ComponentCollection $collection ComponentCollection object.
|
||||||
|
* @param array $settings Array of settings.
|
||||||
*/
|
*/
|
||||||
function __construct() {
|
function __construct(ComponentCollection $collection, $settings = array()) {
|
||||||
$this->__acceptTypes = explode(',', env('HTTP_ACCEPT'));
|
$this->__acceptTypes = explode(',', env('HTTP_ACCEPT'));
|
||||||
|
|
||||||
foreach ($this->__acceptTypes as $i => $type) {
|
foreach ($this->__acceptTypes as $i => $type) {
|
||||||
|
@ -183,7 +185,7 @@ class RequestHandlerComponent extends Component {
|
||||||
$this->__acceptTypes[$i] = $type[0];
|
$this->__acceptTypes[$i] = $type[0];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
parent::__construct();
|
parent::__construct($collection, $settings);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -197,11 +199,10 @@ class RequestHandlerComponent extends Component {
|
||||||
* @return void
|
* @return void
|
||||||
* @see Router::parseExtensions()
|
* @see Router::parseExtensions()
|
||||||
*/
|
*/
|
||||||
public function initialize(&$controller, $settings = array()) {
|
public function initialize(&$controller) {
|
||||||
if (isset($controller->params['url']['ext'])) {
|
if (isset($controller->params['url']['ext'])) {
|
||||||
$this->ext = $controller->params['url']['ext'];
|
$this->ext = $controller->params['url']['ext'];
|
||||||
}
|
}
|
||||||
$this->_set($settings);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -169,17 +169,6 @@ class SecurityComponent extends Component {
|
||||||
*/
|
*/
|
||||||
protected $_action = null;
|
protected $_action = null;
|
||||||
|
|
||||||
/**
|
|
||||||
* Initialize the SecurityComponent
|
|
||||||
*
|
|
||||||
* @param object $controller Controller instance for the request
|
|
||||||
* @param array $settings Settings to set to the component
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
public function initialize(&$controller, $settings = array()) {
|
|
||||||
$this->_set($settings);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Component startup. All security checking happens here.
|
* Component startup. All security checking happens here.
|
||||||
*
|
*
|
||||||
|
|
|
@ -625,7 +625,7 @@ class Controller extends Object {
|
||||||
$response = $this->Components->trigger(
|
$response = $this->Components->trigger(
|
||||||
'beforeRedirect',
|
'beforeRedirect',
|
||||||
array(&$this, $url, $status, $exit),
|
array(&$this, $url, $status, $exit),
|
||||||
array('break' => true, 'breakOn' => false)
|
array('break' => true, 'breakOn' => false, 'collectReturn' => true)
|
||||||
);
|
);
|
||||||
|
|
||||||
if ($response === false) {
|
if ($response === false) {
|
||||||
|
|
Loading…
Reference in a new issue