Skip to content
This repository was archived by the owner on Jan 10, 2023. It is now read-only.

Commit af33257

Browse files
author
Guillermo Cespedes
committed
methods and properties defined as static cause problems when working with the controller and add-ons views at the same time.
1 parent 3866cdf commit af33257

File tree

4 files changed

+182
-152
lines changed

4 files changed

+182
-152
lines changed

Particle/Core/AssetConfig.php

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,13 @@ public static function getInstance()
1616
return self::$instance;
1717
}
1818

19-
final private function add($sAssetName, $aCssFileLayout, $aJsFileHeadLayout, $aJsFileFooterLayout)
19+
final private function add($sAssetName, $aCssFileLayout, $aJsFileHeadLayout, $aJsFileFooterLayout, $aPHPFileLayout)
2020
{
2121
$this->AssetConfig[$sAssetName] = array(
2222
'aCssFileLayout' => $aCssFileLayout,
2323
'aJsFileHeadLayout' => $aJsFileHeadLayout,
2424
'aJsFileFooterLayout' => $aJsFileFooterLayout,
25+
'aPHPFileLayout' => $aPHPFileLayout
2526
);
2627
}
2728

@@ -48,12 +49,16 @@ final public function init()
4849
if (!isset($itemAsset['aJsFileFooterLayout']) || empty($itemAsset['aJsFileFooterLayout'])) {
4950
$itemAsset['aJsFileFooterLayout'] = array();
5051
}
52+
if (!isset($itemAsset['aPHPFileLayout']) || empty($itemAsset['aPHPFileLayout'])) {
53+
$itemAsset['aPHPFileLayout'] = array();
54+
}
5155

5256
$aCssFileLayout = $itemAsset['aCssFileLayout'];
5357
$aJsFileHeadLayout = $itemAsset['aJsFileHeadLayout'];
5458
$aJsFileFooterLayout = $itemAsset['aJsFileFooterLayout'];
59+
$aPHPFileLayout = $itemAsset['aPHPFileLayout'];
5560

56-
$this->add($sAssetName, $aCssFileLayout, $aJsFileHeadLayout, $aJsFileFooterLayout);
61+
$this->add($sAssetName, $aCssFileLayout, $aJsFileHeadLayout, $aJsFileFooterLayout, $aPHPFileLayout);
5762
}
5863

5964
return true;

Particle/Core/Controller.php

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -19,34 +19,34 @@ abstract class Controller extends Core\SpotLoad
1919
protected $args = null;
2020
protected $spot = null;
2121

22-
private static $currentAddons;
23-
private static $controller;
24-
private static $method;
22+
private $currentAddons;
23+
private $controller;
24+
private $method;
2525

2626
public function __construct($noLoadView = false)
2727
{
2828
parent::__construct(); // init $spotInstance
2929
//$this->spot = parent::$spotInstance;
3030

31-
self::$controller = Core\App::getInstance()->getAppController();
32-
self::$method = Core\App::getInstance()->getAppMethod();
31+
$this->controller = Core\App::getInstance()->getAppController();
32+
$this->method = Core\App::getInstance()->getAppMethod();
3333

3434
$this->args = Core\App::getInstance()->getAppArgs();
3535

3636
$cacheKey = Core\App::getInstance()->getAppRequest(); // $cacheKey
3737

3838
if (!$noLoadView) {
39-
$this->view = new \Particle\Core\View(self::$controller, self::$method, $cacheKey, false);
39+
$this->view = new \Particle\Core\View($this->controller, $this->method, $cacheKey, false);
4040
}
4141
}
4242

43-
final protected static function loadViewAddons()
43+
final protected function loadViewAddons()
4444
{
45-
self::$currentAddons = Core\App::getInstance()->getAppCurrentAddons();
46-
return new \Particle\Core\View(self::$currentAddons, 'index', false, true);
45+
$this->currentAddons = Core\App::getInstance()->getAppCurrentAddons();
46+
return new \Particle\Core\View($this->currentAddons, 'index', false, true);
4747
}
4848

49-
final protected static function loadAddons($addons_name = false, $noException = false)
49+
final protected function loadAddons($addons_name = false, $noException = false)
5050
{
5151
$classPlugin = $addons_name.'Addons';
5252

Particle/Core/Cookies.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ public static function read($name)
3636
* @param string $value Value of the cookie. Destroy the cookie if omitted or null
3737
* @param int $duration Life time of the cookie. Uses default value if omitted or null
3838
*/
39-
public static function write($name, $value = null, $duration = 0)
39+
public static function write($name, $value = null, $duration = 0, $httponly = true)
4040
{
4141
if (!isset($value)) {
4242
return self::delete($name);
@@ -45,7 +45,6 @@ public static function write($name, $value = null, $duration = 0)
4545
$domain=ini_get('session.cookie_domain');
4646
$path=ini_get('session.cookie_path');
4747
$secure=isset($_SERVER['HTTPS']);
48-
$httponly=true;
4948

5049
// Expiration date from the life time in seconds
5150
if ($duration==0) {

0 commit comments

Comments
 (0)