mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 03:18:26 +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()) {
|
||||
$this->_Collection = $collection;
|
||||
$this->settings = $settings;
|
||||
|
||||
$this->_set($settings);
|
||||
if (!empty($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.
|
||||
*/
|
||||
public function __construct() {
|
||||
public function __construct(ComponentCollection $collection, $settings = array()) {
|
||||
parent::__construct($collection, $settings);
|
||||
$name = Inflector::camelize(strtolower(Configure::read('Acl.classname')));
|
||||
if (!class_exists($name)) {
|
||||
if (App::import('Component', $name)) {
|
||||
|
@ -86,16 +87,6 @@ class AclComponent extends Component {
|
|||
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
|
||||
* 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
|
||||
* @return void
|
||||
*/
|
||||
public function initialize(&$controller, $settings = array()) {
|
||||
public function initialize(&$controller) {
|
||||
$this->params = $controller->params;
|
||||
$crud = array('create', 'read', 'update', 'delete');
|
||||
$this->actionMap = array_merge($this->actionMap, array_combine($crud, $crud));
|
||||
|
@ -290,8 +290,7 @@ class AuthComponent extends Component {
|
|||
));
|
||||
}
|
||||
}
|
||||
$this->_set($settings);
|
||||
if (Configure::read('debug') > 0) {
|
||||
if (Configure::read() > 0) {
|
||||
App::import('Debugger');
|
||||
Debugger::checkSecurityKeys();
|
||||
}
|
||||
|
|
|
@ -162,9 +162,8 @@ class CookieComponent extends Component {
|
|||
*
|
||||
* @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->_set($settings);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -303,12 +303,11 @@ class EmailComponent extends Component {
|
|||
*
|
||||
* @param object $controller Instantiating controller
|
||||
*/
|
||||
public function initialize(&$controller, $settings = array()) {
|
||||
public function initialize(&$controller) {
|
||||
$this->Controller = $controller;
|
||||
if (Configure::read('App.encoding') !== null) {
|
||||
$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
|
||||
*
|
||||
* @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'));
|
||||
|
||||
foreach ($this->__acceptTypes as $i => $type) {
|
||||
|
@ -183,7 +185,7 @@ class RequestHandlerComponent extends Component {
|
|||
$this->__acceptTypes[$i] = $type[0];
|
||||
}
|
||||
}
|
||||
parent::__construct();
|
||||
parent::__construct($collection, $settings);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -197,11 +199,10 @@ class RequestHandlerComponent extends Component {
|
|||
* @return void
|
||||
* @see Router::parseExtensions()
|
||||
*/
|
||||
public function initialize(&$controller, $settings = array()) {
|
||||
public function initialize(&$controller) {
|
||||
if (isset($controller->params['url']['ext'])) {
|
||||
$this->ext = $controller->params['url']['ext'];
|
||||
}
|
||||
$this->_set($settings);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -169,17 +169,6 @@ class SecurityComponent extends Component {
|
|||
*/
|
||||
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.
|
||||
*
|
||||
|
|
|
@ -625,7 +625,7 @@ class Controller extends Object {
|
|||
$response = $this->Components->trigger(
|
||||
'beforeRedirect',
|
||||
array(&$this, $url, $status, $exit),
|
||||
array('break' => true, 'breakOn' => false)
|
||||
array('break' => true, 'breakOn' => false, 'collectReturn' => true)
|
||||
);
|
||||
|
||||
if ($response === false) {
|
||||
|
|
Loading…
Reference in a new issue