@@ -43,13 +43,13 @@ discard block |
||
| 43 | 43 | abstract class Controller extends Mother |
| 44 | 44 | { |
| 45 | 45 | |
| 46 | - /** |
|
| 47 | - * Cache to know if a model was initialize or not because we must initialize it just one time by script |
|
| 48 | - * |
|
| 49 | - * @access private |
|
| 50 | - * @var array |
|
| 51 | - */ |
|
| 52 | - private static $_aInitialize = array(); |
|
| 46 | + /** |
|
| 47 | + * Cache to know if a model was initialize or not because we must initialize it just one time by script |
|
| 48 | + * |
|
| 49 | + * @access private |
|
| 50 | + * @var array |
|
| 51 | + */ |
|
| 52 | + private static $_aInitialize = array(); |
|
| 53 | 53 | |
| 54 | 54 | /** |
| 55 | 55 | * Constructor |
@@ -95,11 +95,11 @@ discard block |
||
| 95 | 95 | */ |
| 96 | 96 | if (method_exists(get_called_class(), 'initialize')) { |
| 97 | 97 | |
| 98 | - if (!isset(self::$_aInitialize[get_called_class()])) { |
|
| 98 | + if (!isset(self::$_aInitialize[get_called_class()])) { |
|
| 99 | 99 | |
| 100 | - static::initialize(); |
|
| 101 | - self::$_aInitialize[get_called_class()] = true; |
|
| 102 | - } |
|
| 100 | + static::initialize(); |
|
| 101 | + self::$_aInitialize[get_called_class()] = true; |
|
| 102 | + } |
|
| 103 | 103 | } |
| 104 | 104 | |
| 105 | 105 | /** |
@@ -169,12 +169,12 @@ discard block |
||
| 169 | 169 | */ |
| 170 | 170 | public function __get($mKey) |
| 171 | 171 | { |
| 172 | - if (isset($this->di) && property_exists($this, 'di')) { |
|
| 172 | + if (isset($this->di) && property_exists($this, 'di')) { |
|
| 173 | 173 | |
| 174 | - $mDi = $this->di->get($mKey); |
|
| 174 | + $mDi = $this->di->get($mKey); |
|
| 175 | 175 | |
| 176 | - if (isset($mDi) && $mDi !== false) { return $mDi; } |
|
| 177 | - } |
|
| 176 | + if (isset($mDi) && $mDi !== false) { return $mDi; } |
|
| 177 | + } |
|
| 178 | 178 | |
| 179 | 179 | return parent::__get($mKey); |
| 180 | 180 | } |
@@ -50,17 +50,17 @@ discard block |
||
| 50 | 50 | */ |
| 51 | 51 | public static function get(string $sName, string $sPortal = null, bool $bNoDoRedirect = false) |
| 52 | 52 | { |
| 53 | - if ($bNoDoRedirect === true) { $sNameCache = $sName.'_true'; } |
|
| 54 | - else { $sNameCache = $sName; } |
|
| 53 | + if ($bNoDoRedirect === true) { $sNameCache = $sName.'_true'; } |
|
| 54 | + else { $sNameCache = $sName; } |
|
| 55 | 55 | |
| 56 | 56 | if ($sPortal === null || !is_string($sPortal)) { |
| 57 | 57 | |
| 58 | - if (defined('PORTAL')) { |
|
| 58 | + if (defined('PORTAL')) { |
|
| 59 | 59 | |
| 60 | 60 | $sPortal = PORTAL; |
| 61 | 61 | $aDirectories = array($sPortal); |
| 62 | 62 | } |
| 63 | - else { |
|
| 63 | + else { |
|
| 64 | 64 | |
| 65 | 65 | $sPortal = ''; |
| 66 | 66 | $aDirectories = scandir(str_replace('core', 'src', __DIR__)); |
@@ -73,84 +73,84 @@ discard block |
||
| 73 | 73 | |
| 74 | 74 | foreach ($aDirectories as $sPortal) { |
| 75 | 75 | |
| 76 | - if ($sPortal != '..' && $sPortal != '.') { |
|
| 76 | + if ($sPortal != '..' && $sPortal != '.') { |
|
| 77 | 77 | |
| 78 | - if (file_exists(str_replace('core', 'conf', __DIR__).DIRECTORY_SEPARATOR.$sName.'.conf-local')) { |
|
| 78 | + if (file_exists(str_replace('core', 'conf', __DIR__).DIRECTORY_SEPARATOR.$sName.'.conf-local')) { |
|
| 79 | 79 | |
| 80 | - $sJsonFile = str_replace('core', 'conf', __DIR__).DIRECTORY_SEPARATOR.$sName.'.conf-local'; |
|
| 81 | - $base = self::_mergeAndGetConf($sJsonFile, $base); |
|
| 82 | - } |
|
| 80 | + $sJsonFile = str_replace('core', 'conf', __DIR__).DIRECTORY_SEPARATOR.$sName.'.conf-local'; |
|
| 81 | + $base = self::_mergeAndGetConf($sJsonFile, $base); |
|
| 82 | + } |
|
| 83 | 83 | |
| 84 | - if (file_exists(str_replace('core', 'src'.DIRECTORY_SEPARATOR.$sPortal.DIRECTORY_SEPARATOR.'app'.DIRECTORY_SEPARATOR.'conf', __DIR__).DIRECTORY_SEPARATOR.$sName.'.conf-local')) { |
|
| 84 | + if (file_exists(str_replace('core', 'src'.DIRECTORY_SEPARATOR.$sPortal.DIRECTORY_SEPARATOR.'app'.DIRECTORY_SEPARATOR.'conf', __DIR__).DIRECTORY_SEPARATOR.$sName.'.conf-local')) { |
|
| 85 | 85 | |
| 86 | - $sJsonFile = str_replace('core', 'src'.DIRECTORY_SEPARATOR.$sPortal.DIRECTORY_SEPARATOR.'app'.DIRECTORY_SEPARATOR.'conf', __DIR__).DIRECTORY_SEPARATOR.$sName.'.conf-local'; |
|
| 87 | - $base = self::_mergeAndGetConf($sJsonFile, $base); |
|
| 88 | - } |
|
| 86 | + $sJsonFile = str_replace('core', 'src'.DIRECTORY_SEPARATOR.$sPortal.DIRECTORY_SEPARATOR.'app'.DIRECTORY_SEPARATOR.'conf', __DIR__).DIRECTORY_SEPARATOR.$sName.'.conf-local'; |
|
| 87 | + $base = self::_mergeAndGetConf($sJsonFile, $base); |
|
| 88 | + } |
|
| 89 | 89 | |
| 90 | - if (file_exists(str_replace('core', 'src'.DIRECTORY_SEPARATOR.$sPortal.DIRECTORY_SEPARATOR.'app'.DIRECTORY_SEPARATOR.'conf', __DIR__).DIRECTORY_SEPARATOR.$sName.'.conf-dev') && getenv('DEV') == 1) { |
|
| 90 | + if (file_exists(str_replace('core', 'src'.DIRECTORY_SEPARATOR.$sPortal.DIRECTORY_SEPARATOR.'app'.DIRECTORY_SEPARATOR.'conf', __DIR__).DIRECTORY_SEPARATOR.$sName.'.conf-dev') && getenv('DEV') == 1) { |
|
| 91 | 91 | |
| 92 | - $sJsonFile = str_replace('core', 'src'.DIRECTORY_SEPARATOR.$sPortal.DIRECTORY_SEPARATOR.'app'.DIRECTORY_SEPARATOR.'conf', __DIR__).DIRECTORY_SEPARATOR.$sName.'.conf-dev'; |
|
| 93 | - $base = self::_mergeAndGetConf($sJsonFile, $base); |
|
| 94 | - } |
|
| 92 | + $sJsonFile = str_replace('core', 'src'.DIRECTORY_SEPARATOR.$sPortal.DIRECTORY_SEPARATOR.'app'.DIRECTORY_SEPARATOR.'conf', __DIR__).DIRECTORY_SEPARATOR.$sName.'.conf-dev'; |
|
| 93 | + $base = self::_mergeAndGetConf($sJsonFile, $base); |
|
| 94 | + } |
|
| 95 | 95 | |
| 96 | - if (file_exists(str_replace('core', 'conf', __DIR__).DIRECTORY_SEPARATOR.$sName.'.conf-dev') && getenv('DEV') == 1) { |
|
| 96 | + if (file_exists(str_replace('core', 'conf', __DIR__).DIRECTORY_SEPARATOR.$sName.'.conf-dev') && getenv('DEV') == 1) { |
|
| 97 | 97 | |
| 98 | - $sJsonFile = str_replace('core', 'conf', __DIR__).DIRECTORY_SEPARATOR.$sName.'.conf-dev'; |
|
| 99 | - $base = self::_mergeAndGetConf($sJsonFile, $base); |
|
| 100 | - } |
|
| 98 | + $sJsonFile = str_replace('core', 'conf', __DIR__).DIRECTORY_SEPARATOR.$sName.'.conf-dev'; |
|
| 99 | + $base = self::_mergeAndGetConf($sJsonFile, $base); |
|
| 100 | + } |
|
| 101 | 101 | |
| 102 | - if (file_exists(str_replace('core', 'src'.DIRECTORY_SEPARATOR.$sPortal.DIRECTORY_SEPARATOR.'app'.DIRECTORY_SEPARATOR.'conf', __DIR__).DIRECTORY_SEPARATOR.$sName.'.conf-dev') && getenv('PROD') == 1) { |
|
| 102 | + if (file_exists(str_replace('core', 'src'.DIRECTORY_SEPARATOR.$sPortal.DIRECTORY_SEPARATOR.'app'.DIRECTORY_SEPARATOR.'conf', __DIR__).DIRECTORY_SEPARATOR.$sName.'.conf-dev') && getenv('PROD') == 1) { |
|
| 103 | 103 | |
| 104 | - $sJsonFile = str_replace('core', 'src'.DIRECTORY_SEPARATOR.$sPortal.DIRECTORY_SEPARATOR.'app'.DIRECTORY_SEPARATOR.'conf', __DIR__).DIRECTORY_SEPARATOR.$sName.'.conf-prod'; |
|
| 105 | - $base = self::_mergeAndGetConf($sJsonFile, $base); |
|
| 106 | - } |
|
| 104 | + $sJsonFile = str_replace('core', 'src'.DIRECTORY_SEPARATOR.$sPortal.DIRECTORY_SEPARATOR.'app'.DIRECTORY_SEPARATOR.'conf', __DIR__).DIRECTORY_SEPARATOR.$sName.'.conf-prod'; |
|
| 105 | + $base = self::_mergeAndGetConf($sJsonFile, $base); |
|
| 106 | + } |
|
| 107 | 107 | |
| 108 | - if (file_exists(str_replace('core', 'conf', __DIR__).DIRECTORY_SEPARATOR.$sName.'.conf-dev') && getenv('PROD') == 1) { |
|
| 108 | + if (file_exists(str_replace('core', 'conf', __DIR__).DIRECTORY_SEPARATOR.$sName.'.conf-dev') && getenv('PROD') == 1) { |
|
| 109 | 109 | |
| 110 | - $sJsonFile = str_replace('core', 'conf', __DIR__).DIRECTORY_SEPARATOR.$sName.'.conf-prod'; |
|
| 111 | - $base = self::_mergeAndGetConf($sJsonFile, $base); |
|
| 112 | - } |
|
| 110 | + $sJsonFile = str_replace('core', 'conf', __DIR__).DIRECTORY_SEPARATOR.$sName.'.conf-prod'; |
|
| 111 | + $base = self::_mergeAndGetConf($sJsonFile, $base); |
|
| 112 | + } |
|
| 113 | 113 | |
| 114 | - if (file_exists(str_replace('core', 'src'.DIRECTORY_SEPARATOR.$sPortal.DIRECTORY_SEPARATOR.'app'.DIRECTORY_SEPARATOR.'conf', __DIR__).DIRECTORY_SEPARATOR.$sName.'.conf-dev') && getenv('PREPROD') == 1) { |
|
| 114 | + if (file_exists(str_replace('core', 'src'.DIRECTORY_SEPARATOR.$sPortal.DIRECTORY_SEPARATOR.'app'.DIRECTORY_SEPARATOR.'conf', __DIR__).DIRECTORY_SEPARATOR.$sName.'.conf-dev') && getenv('PREPROD') == 1) { |
|
| 115 | 115 | |
| 116 | - $sJsonFile = str_replace('core', 'src'.DIRECTORY_SEPARATOR.$sPortal.DIRECTORY_SEPARATOR.'app'.DIRECTORY_SEPARATOR.'conf', __DIR__).DIRECTORY_SEPARATOR.$sName.'.conf-pprod'; |
|
| 117 | - $base = self::_mergeAndGetConf($sJsonFile, $base); |
|
| 118 | - } |
|
| 116 | + $sJsonFile = str_replace('core', 'src'.DIRECTORY_SEPARATOR.$sPortal.DIRECTORY_SEPARATOR.'app'.DIRECTORY_SEPARATOR.'conf', __DIR__).DIRECTORY_SEPARATOR.$sName.'.conf-pprod'; |
|
| 117 | + $base = self::_mergeAndGetConf($sJsonFile, $base); |
|
| 118 | + } |
|
| 119 | 119 | |
| 120 | - if (file_exists(str_replace('core', 'conf', __DIR__).DIRECTORY_SEPARATOR.$sName.'.conf-dev') && getenv('PREPROD') == 1) { |
|
| 120 | + if (file_exists(str_replace('core', 'conf', __DIR__).DIRECTORY_SEPARATOR.$sName.'.conf-dev') && getenv('PREPROD') == 1) { |
|
| 121 | 121 | |
| 122 | - $sJsonFile = str_replace('core', 'conf', __DIR__).DIRECTORY_SEPARATOR.$sName.'.conf-pprod'; |
|
| 123 | - $base = self::_mergeAndGetConf($sJsonFile, $base); |
|
| 124 | - } |
|
| 122 | + $sJsonFile = str_replace('core', 'conf', __DIR__).DIRECTORY_SEPARATOR.$sName.'.conf-pprod'; |
|
| 123 | + $base = self::_mergeAndGetConf($sJsonFile, $base); |
|
| 124 | + } |
|
| 125 | 125 | |
| 126 | - if (file_exists(str_replace('core', 'src'.DIRECTORY_SEPARATOR.$sPortal.DIRECTORY_SEPARATOR.'app'.DIRECTORY_SEPARATOR.'conf', __DIR__).DIRECTORY_SEPARATOR.$sName.'.conf-dev') && getenv('RECETTE') == 1) { |
|
| 126 | + if (file_exists(str_replace('core', 'src'.DIRECTORY_SEPARATOR.$sPortal.DIRECTORY_SEPARATOR.'app'.DIRECTORY_SEPARATOR.'conf', __DIR__).DIRECTORY_SEPARATOR.$sName.'.conf-dev') && getenv('RECETTE') == 1) { |
|
| 127 | 127 | |
| 128 | - $sJsonFile = str_replace('core', 'src'.DIRECTORY_SEPARATOR.$sPortal.DIRECTORY_SEPARATOR.'app'.DIRECTORY_SEPARATOR.'conf', __DIR__).DIRECTORY_SEPARATOR.$sName.'.conf-rec'; |
|
| 129 | - $base = self::_mergeAndGetConf($sJsonFile, $base); |
|
| 130 | - } |
|
| 128 | + $sJsonFile = str_replace('core', 'src'.DIRECTORY_SEPARATOR.$sPortal.DIRECTORY_SEPARATOR.'app'.DIRECTORY_SEPARATOR.'conf', __DIR__).DIRECTORY_SEPARATOR.$sName.'.conf-rec'; |
|
| 129 | + $base = self::_mergeAndGetConf($sJsonFile, $base); |
|
| 130 | + } |
|
| 131 | 131 | |
| 132 | - if (file_exists(str_replace('core', 'conf', __DIR__).DIRECTORY_SEPARATOR.$sName.'.conf-dev') && getenv('RECETTE') == 1) { |
|
| 132 | + if (file_exists(str_replace('core', 'conf', __DIR__).DIRECTORY_SEPARATOR.$sName.'.conf-dev') && getenv('RECETTE') == 1) { |
|
| 133 | 133 | |
| 134 | - $sJsonFile = str_replace('core', 'conf', __DIR__).DIRECTORY_SEPARATOR.$sName.'.conf-rec'; |
|
| 135 | - $base = self::_mergeAndGetConf($sJsonFile, $base); |
|
| 136 | - } |
|
| 134 | + $sJsonFile = str_replace('core', 'conf', __DIR__).DIRECTORY_SEPARATOR.$sName.'.conf-rec'; |
|
| 135 | + $base = self::_mergeAndGetConf($sJsonFile, $base); |
|
| 136 | + } |
|
| 137 | 137 | |
| 138 | - if (file_exists(str_replace('core', 'src'.DIRECTORY_SEPARATOR.$sPortal.DIRECTORY_SEPARATOR.'app'.DIRECTORY_SEPARATOR.'conf', __DIR__).DIRECTORY_SEPARATOR.$sName.'.conf-local')) { |
|
| 138 | + if (file_exists(str_replace('core', 'src'.DIRECTORY_SEPARATOR.$sPortal.DIRECTORY_SEPARATOR.'app'.DIRECTORY_SEPARATOR.'conf', __DIR__).DIRECTORY_SEPARATOR.$sName.'.conf-local')) { |
|
| 139 | 139 | |
| 140 | - $sJsonFile = str_replace('core', 'src'.DIRECTORY_SEPARATOR.$sPortal.DIRECTORY_SEPARATOR.'app'.DIRECTORY_SEPARATOR.'conf', __DIR__).DIRECTORY_SEPARATOR.$sName.'.conf-local'; |
|
| 141 | - $base = self::_mergeAndGetConf($sJsonFile, $base); |
|
| 142 | - } |
|
| 140 | + $sJsonFile = str_replace('core', 'src'.DIRECTORY_SEPARATOR.$sPortal.DIRECTORY_SEPARATOR.'app'.DIRECTORY_SEPARATOR.'conf', __DIR__).DIRECTORY_SEPARATOR.$sName.'.conf-local'; |
|
| 141 | + $base = self::_mergeAndGetConf($sJsonFile, $base); |
|
| 142 | + } |
|
| 143 | 143 | |
| 144 | - if (file_exists(str_replace('core', 'src'.DIRECTORY_SEPARATOR.$sPortal.DIRECTORY_SEPARATOR.'app'.DIRECTORY_SEPARATOR.'conf', __DIR__).DIRECTORY_SEPARATOR.$sName.'.conf')) { |
|
| 144 | + if (file_exists(str_replace('core', 'src'.DIRECTORY_SEPARATOR.$sPortal.DIRECTORY_SEPARATOR.'app'.DIRECTORY_SEPARATOR.'conf', __DIR__).DIRECTORY_SEPARATOR.$sName.'.conf')) { |
|
| 145 | 145 | |
| 146 | - $sJsonFile = str_replace('core', 'src'.DIRECTORY_SEPARATOR.$sPortal.DIRECTORY_SEPARATOR.'app'.DIRECTORY_SEPARATOR.'conf', __DIR__).DIRECTORY_SEPARATOR.$sName.'.conf'; |
|
| 147 | - $base = self::_mergeAndGetConf($sJsonFile, $base); |
|
| 148 | - } |
|
| 146 | + $sJsonFile = str_replace('core', 'src'.DIRECTORY_SEPARATOR.$sPortal.DIRECTORY_SEPARATOR.'app'.DIRECTORY_SEPARATOR.'conf', __DIR__).DIRECTORY_SEPARATOR.$sName.'.conf'; |
|
| 147 | + $base = self::_mergeAndGetConf($sJsonFile, $base); |
|
| 148 | + } |
|
| 149 | 149 | |
| 150 | - $sJsonFile = str_replace('core', 'conf', __DIR__).DIRECTORY_SEPARATOR.$sName.'.conf'; |
|
| 151 | - $base = self::_mergeAndGetConf($sJsonFile, $base); |
|
| 152 | - } |
|
| 153 | - } |
|
| 150 | + $sJsonFile = str_replace('core', 'conf', __DIR__).DIRECTORY_SEPARATOR.$sName.'.conf'; |
|
| 151 | + $base = self::_mergeAndGetConf($sJsonFile, $base); |
|
| 152 | + } |
|
| 153 | + } |
|
| 154 | 154 | |
| 155 | 155 | if ($base === '') { |
| 156 | 156 | |
@@ -183,10 +183,10 @@ discard block |
||
| 183 | 183 | */ |
| 184 | 184 | public static function getBundleLocationName(string $sName): string |
| 185 | 185 | { |
| 186 | - $oConfig = self::get($sName, null, true); |
|
| 186 | + $oConfig = self::get($sName, null, true); |
|
| 187 | 187 | |
| 188 | - if (isset($oConfig->redirect)) { return $oConfig->redirect; } |
|
| 189 | - else { return PORTAL; } |
|
| 188 | + if (isset($oConfig->redirect)) { return $oConfig->redirect; } |
|
| 189 | + else { return PORTAL; } |
|
| 190 | 190 | } |
| 191 | 191 | |
| 192 | 192 | /** |
@@ -211,7 +211,7 @@ discard block |
||
| 211 | 211 | echo "The Json ".$sFileToMerge." has an error! Please verify!\n"; |
| 212 | 212 | $oDebug = Debug::getInstance(); |
| 213 | 213 | $oDebug->error("The Json ".$sFileToMerge." has an error! Please verify!\n"); |
| 214 | - new \Exception("The Json ".$sFileToMerge." has an error! Please verify!\n"); |
|
| 214 | + new \Exception("The Json ".$sFileToMerge." has an error! Please verify!\n"); |
|
| 215 | 215 | } |
| 216 | 216 | } |
| 217 | 217 | |
@@ -82,8 +82,8 @@ discard block |
||
| 82 | 82 | */ |
| 83 | 83 | public function __construct() |
| 84 | 84 | { |
| 85 | - $oLogger = Debug::getInstance(); |
|
| 86 | - $this->setLogger($oLogger); |
|
| 85 | + $oLogger = Debug::getInstance(); |
|
| 86 | + $this->setLogger($oLogger); |
|
| 87 | 87 | } |
| 88 | 88 | |
| 89 | 89 | /** |
@@ -100,123 +100,123 @@ discard block |
||
| 100 | 100 | |
| 101 | 101 | if (Request::isHttpRequest()) { |
| 102 | 102 | |
| 103 | - // Search if a Less file exists |
|
| 104 | - if (defined('LESS_ACTIVE') && LESS_ACTIVE === true) { |
|
| 103 | + // Search if a Less file exists |
|
| 104 | + if (defined('LESS_ACTIVE') && LESS_ACTIVE === true) { |
|
| 105 | 105 | |
| 106 | - if (strstr($_SERVER['REQUEST_URI'], '.css') |
|
| 107 | - && file_exists(preg_replace('/\.css/', '.less', $_SERVER['REQUEST_URI']))) { |
|
| 106 | + if (strstr($_SERVER['REQUEST_URI'], '.css') |
|
| 107 | + && file_exists(preg_replace('/\.css/', '.less', $_SERVER['REQUEST_URI']))) { |
|
| 108 | 108 | |
| 109 | - Less::toCss($_SERVER['REQUEST_URI']); |
|
| 110 | - exit; |
|
| 111 | - } |
|
| 112 | - } |
|
| 109 | + Less::toCss($_SERVER['REQUEST_URI']); |
|
| 110 | + exit; |
|
| 111 | + } |
|
| 112 | + } |
|
| 113 | 113 | |
| 114 | - // Search if a typescript file exists |
|
| 115 | - if (defined('TYPESCRIPT_ACTIVE') && TYPESCRIPT_ACTIVE === true) { |
|
| 114 | + // Search if a typescript file exists |
|
| 115 | + if (defined('TYPESCRIPT_ACTIVE') && TYPESCRIPT_ACTIVE === true) { |
|
| 116 | 116 | |
| 117 | - if (strstr($_SERVER['REQUEST_URI'], '.js') |
|
| 118 | - && file_exists(preg_replace('/\.js/', '.ts', $_SERVER['REQUEST_URI']))) { |
|
| 117 | + if (strstr($_SERVER['REQUEST_URI'], '.js') |
|
| 118 | + && file_exists(preg_replace('/\.js/', '.ts', $_SERVER['REQUEST_URI']))) { |
|
| 119 | 119 | |
| 120 | - Typescript::toJs($_SERVER['REQUEST_URI']); |
|
| 121 | - exit; |
|
| 122 | - } |
|
| 123 | - } |
|
| 120 | + Typescript::toJs($_SERVER['REQUEST_URI']); |
|
| 121 | + exit; |
|
| 122 | + } |
|
| 123 | + } |
|
| 124 | 124 | |
| 125 | - // Search public files in all plugins |
|
| 126 | - if ($_SERVER['REQUEST_URI'] !== '/') { |
|
| 125 | + // Search public files in all plugins |
|
| 126 | + if ($_SERVER['REQUEST_URI'] !== '/') { |
|
| 127 | 127 | |
| 128 | - foreach (Config::get('Plugins')->list as $iKey => $sPlugin) { |
|
| 128 | + foreach (Config::get('Plugins')->list as $iKey => $sPlugin) { |
|
| 129 | 129 | |
| 130 | - if (file_exists(__DIR__.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'src'.DIRECTORY_SEPARATOR.'plugins'.DIRECTORY_SEPARATOR.$sPlugin.DIRECTORY_SEPARATOR.'public'.$_SERVER['REQUEST_URI'])) { |
|
| 130 | + if (file_exists(__DIR__.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'src'.DIRECTORY_SEPARATOR.'plugins'.DIRECTORY_SEPARATOR.$sPlugin.DIRECTORY_SEPARATOR.'public'.$_SERVER['REQUEST_URI'])) { |
|
| 131 | 131 | |
| 132 | - echo file_get_contents(__DIR__.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'src'.DIRECTORY_SEPARATOR.'plugins'.DIRECTORY_SEPARATOR.$sPlugin.DIRECTORY_SEPARATOR.'public'.$_SERVER['REQUEST_URI']); |
|
| 133 | - exit; |
|
| 134 | - } |
|
| 135 | - else if (strstr($_SERVER['REQUEST_URI'], '.css') |
|
| 136 | - && file_exists(__DIR__.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'src'.DIRECTORY_SEPARATOR.'plugins'.DIRECTORY_SEPARATOR.$sPlugin.DIRECTORY_SEPARATOR.'public'.preg_replace('/\.css/', '.less', $_SERVER['REQUEST_URI']))) { |
|
| 137 | - |
|
| 138 | - Less::toCss(__DIR__.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'src'.DIRECTORY_SEPARATOR.'plugins'.DIRECTORY_SEPARATOR.$sPlugin.DIRECTORY_SEPARATOR.'public'.preg_replace('/\.css/', '.less', $_SERVER['REQUEST_URI'])); |
|
| 139 | - exit; |
|
| 140 | - } |
|
| 141 | - else if (strstr($_SERVER['REQUEST_URI'], '.js') |
|
| 142 | - && file_exists(__DIR__.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'src'.DIRECTORY_SEPARATOR.'plugins'.DIRECTORY_SEPARATOR.$sPlugin.DIRECTORY_SEPARATOR.'public'.preg_replace('/\.js/', '.ts', $_SERVER['REQUEST_URI']))) { |
|
| 143 | - |
|
| 144 | - Typescript::toJs(__DIR__.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'src'.DIRECTORY_SEPARATOR.'plugins'.DIRECTORY_SEPARATOR.$sPlugin.DIRECTORY_SEPARATOR.'public'.preg_replace('/\.js/', '.ts', $_SERVER['REQUEST_URI'])); |
|
| 145 | - exit; |
|
| 146 | - } |
|
| 147 | - } |
|
| 148 | - } |
|
| 132 | + echo file_get_contents(__DIR__.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'src'.DIRECTORY_SEPARATOR.'plugins'.DIRECTORY_SEPARATOR.$sPlugin.DIRECTORY_SEPARATOR.'public'.$_SERVER['REQUEST_URI']); |
|
| 133 | + exit; |
|
| 134 | + } |
|
| 135 | + else if (strstr($_SERVER['REQUEST_URI'], '.css') |
|
| 136 | + && file_exists(__DIR__.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'src'.DIRECTORY_SEPARATOR.'plugins'.DIRECTORY_SEPARATOR.$sPlugin.DIRECTORY_SEPARATOR.'public'.preg_replace('/\.css/', '.less', $_SERVER['REQUEST_URI']))) { |
|
| 137 | + |
|
| 138 | + Less::toCss(__DIR__.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'src'.DIRECTORY_SEPARATOR.'plugins'.DIRECTORY_SEPARATOR.$sPlugin.DIRECTORY_SEPARATOR.'public'.preg_replace('/\.css/', '.less', $_SERVER['REQUEST_URI'])); |
|
| 139 | + exit; |
|
| 140 | + } |
|
| 141 | + else if (strstr($_SERVER['REQUEST_URI'], '.js') |
|
| 142 | + && file_exists(__DIR__.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'src'.DIRECTORY_SEPARATOR.'plugins'.DIRECTORY_SEPARATOR.$sPlugin.DIRECTORY_SEPARATOR.'public'.preg_replace('/\.js/', '.ts', $_SERVER['REQUEST_URI']))) { |
|
| 143 | + |
|
| 144 | + Typescript::toJs(__DIR__.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'src'.DIRECTORY_SEPARATOR.'plugins'.DIRECTORY_SEPARATOR.$sPlugin.DIRECTORY_SEPARATOR.'public'.preg_replace('/\.js/', '.ts', $_SERVER['REQUEST_URI'])); |
|
| 145 | + exit; |
|
| 146 | + } |
|
| 147 | + } |
|
| 148 | + } |
|
| 149 | 149 | |
| 150 | 150 | foreach (Config::get('Route') as $sMultiHost => $oHost) { |
| 151 | 151 | |
| 152 | - foreach (explode(',', $sMultiHost) as $sHost) { |
|
| 152 | + foreach (explode(',', $sMultiHost) as $sHost) { |
|
| 153 | 153 | |
| 154 | - if ((!strstr($sHost, '/') && $sHost == $_SERVER['HTTP_HOST']) || (strstr($sHost, '/') |
|
| 155 | - && strstr($_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'], $sHost))) { |
|
| 154 | + if ((!strstr($sHost, '/') && $sHost == $_SERVER['HTTP_HOST']) || (strstr($sHost, '/') |
|
| 155 | + && strstr($_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'], $sHost))) { |
|
| 156 | 156 | |
| 157 | - $this->_oRoutes = $oHost; |
|
| 157 | + $this->_oRoutes = $oHost; |
|
| 158 | 158 | |
| 159 | - if (strstr($sHost, '/') |
|
| 160 | - && strstr($_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'], $sHost)) { |
|
| 159 | + if (strstr($sHost, '/') |
|
| 160 | + && strstr($_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'], $sHost)) { |
|
| 161 | 161 | |
| 162 | - $this->_sBaseUri = preg_replace('#^[^/]+#', '', $sHost); |
|
| 163 | - } |
|
| 162 | + $this->_sBaseUri = preg_replace('#^[^/]+#', '', $sHost); |
|
| 163 | + } |
|
| 164 | 164 | |
| 165 | - if (isset($oHost->location)) { |
|
| 165 | + if (isset($oHost->location)) { |
|
| 166 | 166 | |
| 167 | - header('Status: 301 Moved Permanently', false, 301); |
|
| 168 | - header('Location: '.$oHost->location); |
|
| 169 | - exit; |
|
| 170 | - } |
|
| 171 | - else if (preg_match('#getCss\?#', $_SERVER['REQUEST_URI'])) { |
|
| 167 | + header('Status: 301 Moved Permanently', false, 301); |
|
| 168 | + header('Location: '.$oHost->location); |
|
| 169 | + exit; |
|
| 170 | + } |
|
| 171 | + else if (preg_match('#getCss\?#', $_SERVER['REQUEST_URI'])) { |
|
| 172 | 172 | |
| 173 | - foreach ($_GET as $sKey => $sValue) { |
|
| 173 | + foreach ($_GET as $sKey => $sValue) { |
|
| 174 | 174 | |
| 175 | - if (file_exists(str_replace(DIRECTORY_SEPARATOR.'core', DIRECTORY_SEPARATOR.'src'.DIRECTORY_SEPARATOR, __DIR__).$sKey.'.css')) { |
|
| 175 | + if (file_exists(str_replace(DIRECTORY_SEPARATOR.'core', DIRECTORY_SEPARATOR.'src'.DIRECTORY_SEPARATOR, __DIR__).$sKey.'.css')) { |
|
| 176 | 176 | |
| 177 | - echo file_get_contents(str_replace(DIRECTORY_SEPARATOR.'core', DIRECTORY_SEPARATOR.'src'.DIRECTORY_SEPARATOR, __DIR__).$sKey.'.css')."\n"; |
|
| 178 | - } |
|
| 179 | - } |
|
| 177 | + echo file_get_contents(str_replace(DIRECTORY_SEPARATOR.'core', DIRECTORY_SEPARATOR.'src'.DIRECTORY_SEPARATOR, __DIR__).$sKey.'.css')."\n"; |
|
| 178 | + } |
|
| 179 | + } |
|
| 180 | 180 | |
| 181 | - exit; |
|
| 182 | - } |
|
| 183 | - else if (preg_match('#getJs\?#', $_SERVER['REQUEST_URI'])) { |
|
| 181 | + exit; |
|
| 182 | + } |
|
| 183 | + else if (preg_match('#getJs\?#', $_SERVER['REQUEST_URI'])) { |
|
| 184 | 184 | |
| 185 | - foreach ($_GET as $sKey => $sValue) { |
|
| 185 | + foreach ($_GET as $sKey => $sValue) { |
|
| 186 | 186 | |
| 187 | - if (file_exists(str_replace(DIRECTORY_SEPARATOR.'core', DIRECTORY_SEPARATOR.'src'.DIRECTORY_SEPARATOR, __DIR__).$sKey.'.js')) { |
|
| 187 | + if (file_exists(str_replace(DIRECTORY_SEPARATOR.'core', DIRECTORY_SEPARATOR.'src'.DIRECTORY_SEPARATOR, __DIR__).$sKey.'.js')) { |
|
| 188 | 188 | |
| 189 | - echo file_get_contents(str_replace(DIRECTORY_SEPARATOR.'core', DIRECTORY_SEPARATOR.'src'.DIRECTORY_SEPARATOR, __DIR__).$sKey.'.js')."\n"; |
|
| 190 | - } |
|
| 191 | - } |
|
| 189 | + echo file_get_contents(str_replace(DIRECTORY_SEPARATOR.'core', DIRECTORY_SEPARATOR.'src'.DIRECTORY_SEPARATOR, __DIR__).$sKey.'.js')."\n"; |
|
| 190 | + } |
|
| 191 | + } |
|
| 192 | 192 | |
| 193 | - exit; |
|
| 194 | - } |
|
| 195 | - else if (isset($oHost->routes)) { |
|
| 193 | + exit; |
|
| 194 | + } |
|
| 195 | + else if (isset($oHost->routes)) { |
|
| 196 | 196 | |
| 197 | - foreach($oHost->routes as $sKey => $oRoute) { |
|
| 197 | + foreach($oHost->routes as $sKey => $oRoute) { |
|
| 198 | 198 | |
| 199 | - $mReturn = $this->_route($oRoute, $_SERVER['REQUEST_URI']); |
|
| 199 | + $mReturn = $this->_route($oRoute, $_SERVER['REQUEST_URI']); |
|
| 200 | 200 | |
| 201 | - if ($mReturn === 403) { |
|
| 201 | + if ($mReturn === 403) { |
|
| 202 | 202 | |
| 203 | - $this->_getPage403(); |
|
| 204 | - } |
|
| 205 | - else if ($mReturn === true) { |
|
| 203 | + $this->_getPage403(); |
|
| 204 | + } |
|
| 205 | + else if ($mReturn === true) { |
|
| 206 | 206 | |
| 207 | - if (isset($oRoute->cache)) { $this->_checkCache($oRoute->cache); } |
|
| 207 | + if (isset($oRoute->cache)) { $this->_checkCache($oRoute->cache); } |
|
| 208 | 208 | |
| 209 | - return true; |
|
| 210 | - } |
|
| 211 | - } |
|
| 209 | + return true; |
|
| 210 | + } |
|
| 211 | + } |
|
| 212 | 212 | |
| 213 | - $this->_getPage404(); |
|
| 214 | - } |
|
| 215 | - } |
|
| 216 | - } |
|
| 213 | + $this->_getPage404(); |
|
| 214 | + } |
|
| 215 | + } |
|
| 216 | + } |
|
| 217 | 217 | } |
| 218 | 218 | } |
| 219 | - else if (Request::isCliRequest()) { |
|
| 219 | + else if (Request::isCliRequest()) { |
|
| 220 | 220 | |
| 221 | 221 | if (isset($_SERVER['argv'])) { $aArguments = $_SERVER['argv']; } |
| 222 | 222 | else { $aArguments = $argv; } |
@@ -224,15 +224,15 @@ discard block |
||
| 224 | 224 | define('PORTAL', 'Batch'); |
| 225 | 225 | set_include_path(get_include_path().PATH_SEPARATOR.'src'.PATH_SEPARATOR.PORTAL.PATH_SEPARATOR.'public'); |
| 226 | 226 | |
| 227 | - if (!isset($aArguments[1]) && strstr($aArguments[0], '/phpunit')) { |
|
| 227 | + if (!isset($aArguments[1]) && strstr($aArguments[0], '/phpunit')) { |
|
| 228 | 228 | |
| 229 | - $sBatchName = "phpunit"; |
|
| 230 | - $aArguments[0] = "bin/console"; |
|
| 231 | - $aArguments[1] = "phpunit"; |
|
| 232 | - } |
|
| 233 | - else { |
|
| 234 | - $sBatchName = $aArguments[1]; |
|
| 235 | - } |
|
| 229 | + $sBatchName = "phpunit"; |
|
| 230 | + $aArguments[0] = "bin/console"; |
|
| 231 | + $aArguments[1] = "phpunit"; |
|
| 232 | + } |
|
| 233 | + else { |
|
| 234 | + $sBatchName = $aArguments[1]; |
|
| 235 | + } |
|
| 236 | 236 | |
| 237 | 237 | if (isset(Config::get('Route')->batch->script->{$sBatchName})) { |
| 238 | 238 | |
@@ -274,7 +274,7 @@ discard block |
||
| 274 | 274 | array_shift($aArguments); |
| 275 | 275 | } |
| 276 | 276 | } |
| 277 | - } |
|
| 277 | + } |
|
| 278 | 278 | |
| 279 | 279 | if (isset($oBatch->controller) && isset($oBatch->action)) { |
| 280 | 280 | |
@@ -347,7 +347,7 @@ discard block |
||
| 347 | 347 | foreach (Config::get('Route') as $sHost => $oHost) { |
| 348 | 348 | |
| 349 | 349 | if ((!strstr($sHost, '/') && $sHost == $_SERVER['HTTP_HOST']) |
| 350 | - || (strstr($sHost, '/') && strstr($_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'], $sHost))) { |
|
| 350 | + || (strstr($sHost, '/') && strstr($_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'], $sHost))) { |
|
| 351 | 351 | |
| 352 | 352 | $this->_oRoutes = $oHost->routes; |
| 353 | 353 | |
@@ -377,7 +377,7 @@ discard block |
||
| 377 | 377 | |
| 378 | 378 | if (isset($oRoute->route)) { |
| 379 | 379 | |
| 380 | - $sRoute = str_replace("*", ".*", $oRoute->route); |
|
| 380 | + $sRoute = str_replace("*", ".*", $oRoute->route); |
|
| 381 | 381 | |
| 382 | 382 | $sFinalRoute = preg_replace_callback( |
| 383 | 383 | '|\[/{0,1}:([a-zA-Z_]+)\]|', |
@@ -453,8 +453,8 @@ discard block |
||
| 453 | 453 | |
| 454 | 454 | if (isset($oRoute->controller)) { |
| 455 | 455 | |
| 456 | - define('PORTAL', preg_replace('/^\\\\Venus\\\\src\\\\([a-zA-Z0-9_]+)\\\\.+$/', '$1', $oRoute->controller)); |
|
| 457 | - set_include_path(get_include_path().PATH_SEPARATOR.'src'.PATH_SEPARATOR.PORTAL.PATH_SEPARATOR.'public'); |
|
| 456 | + define('PORTAL', preg_replace('/^\\\\Venus\\\\src\\\\([a-zA-Z0-9_]+)\\\\.+$/', '$1', $oRoute->controller)); |
|
| 457 | + set_include_path(get_include_path().PATH_SEPARATOR.'src'.PATH_SEPARATOR.PORTAL.PATH_SEPARATOR.'public'); |
|
| 458 | 458 | |
| 459 | 459 | if (isset($oRoute->content_type)) { |
| 460 | 460 | |
@@ -508,7 +508,7 @@ discard block |
||
| 508 | 508 | } |
| 509 | 509 | else { |
| 510 | 510 | |
| 511 | - $this->_oLogger->warning('Error: Parameter '.$sName.' not exists!'); |
|
| 511 | + $this->_oLogger->warning('Error: Parameter '.$sName.' not exists!'); |
|
| 512 | 512 | break; |
| 513 | 513 | } |
| 514 | 514 | } |
@@ -534,10 +534,10 @@ discard block |
||
| 534 | 534 | } |
| 535 | 535 | else if (isset($oRoute->template) && isset($oRoute->layout) && $oRoute->layout === true) { |
| 536 | 536 | |
| 537 | - define('PORTAL', preg_replace('/^\\\\Venus\\\\src\\\\([a-zA-Z0-9_]+)\\\\.+$/', '$1', $oRoute->template)); |
|
| 538 | - set_include_path(get_include_path().PATH_SEPARATOR.'src'.PATH_SEPARATOR.PORTAL.PATH_SEPARATOR.'public'); |
|
| 537 | + define('PORTAL', preg_replace('/^\\\\Venus\\\\src\\\\([a-zA-Z0-9_]+)\\\\.+$/', '$1', $oRoute->template)); |
|
| 538 | + set_include_path(get_include_path().PATH_SEPARATOR.'src'.PATH_SEPARATOR.PORTAL.PATH_SEPARATOR.'public'); |
|
| 539 | 539 | |
| 540 | - $oLayout = Vendor::getVendor('Apollina\Template', DIRECTORY_SEPARATOR.'src'.DIRECTORY_SEPARATOR.PORTAL.DIRECTORY_SEPARATOR.'View'.DIRECTORY_SEPARATOR.'Layout.tpl'); |
|
| 540 | + $oLayout = Vendor::getVendor('Apollina\Template', DIRECTORY_SEPARATOR.'src'.DIRECTORY_SEPARATOR.PORTAL.DIRECTORY_SEPARATOR.'View'.DIRECTORY_SEPARATOR.'Layout.tpl'); |
|
| 541 | 541 | |
| 542 | 542 | if (isset($oRoute->vars)) { |
| 543 | 543 | |
@@ -552,8 +552,8 @@ discard block |
||
| 552 | 552 | } |
| 553 | 553 | else if (isset($oRoute->template)) { |
| 554 | 554 | |
| 555 | - define('PORTAL', preg_replace('/^\\\\Venus\\\\src\\\\([a-zA-Z0-9_]+)\\\\.+$/', '$1', $oRoute->template)); |
|
| 556 | - set_include_path(get_include_path().PATH_SEPARATOR.'src'.PATH_SEPARATOR.PORTAL.PATH_SEPARATOR.'public'); |
|
| 555 | + define('PORTAL', preg_replace('/^\\\\Venus\\\\src\\\\([a-zA-Z0-9_]+)\\\\.+$/', '$1', $oRoute->template)); |
|
| 556 | + set_include_path(get_include_path().PATH_SEPARATOR.'src'.PATH_SEPARATOR.PORTAL.PATH_SEPARATOR.'public'); |
|
| 557 | 557 | |
| 558 | 558 | $oTemplate = Vendor::getVendor('Apollina\Template', DIRECTORY_SEPARATOR.'src'.DIRECTORY_SEPARATOR.PORTAL.DIRECTORY_SEPARATOR.'View'.DIRECTORY_SEPARATOR.$oRoute->template.'.tpl'); |
| 559 | 559 | |
@@ -653,14 +653,14 @@ discard block |
||
| 653 | 653 | |
| 654 | 654 | if (method_exists($oController, 'beforeExecuteRoute')) { |
| 655 | 655 | |
| 656 | - call_user_func_array(array($oController, 'beforeExecuteRoute'), array()); |
|
| 656 | + call_user_func_array(array($oController, 'beforeExecuteRoute'), array()); |
|
| 657 | 657 | } |
| 658 | 658 | |
| 659 | 659 | $mReturnController = call_user_func_array(array($oController, $sActionName), $aParams); |
| 660 | 660 | |
| 661 | 661 | if (method_exists($oController, 'afterExecuteRoute')) { |
| 662 | 662 | |
| 663 | - call_user_func_array(array($oController, 'afterExecuteRoute'), array()); |
|
| 663 | + call_user_func_array(array($oController, 'afterExecuteRoute'), array()); |
|
| 664 | 664 | } |
| 665 | 665 | |
| 666 | 666 | $mReturn = ob_get_clean(); |
@@ -800,6 +800,6 @@ discard block |
||
| 800 | 800 | */ |
| 801 | 801 | public function setLogger(LoggerInterface $logger) { |
| 802 | 802 | |
| 803 | - $this->_oLogger = $logger; |
|
| 803 | + $this->_oLogger = $logger; |
|
| 804 | 804 | } |
| 805 | 805 | } |
@@ -131,14 +131,12 @@ discard block |
||
| 131 | 131 | |
| 132 | 132 | echo file_get_contents(__DIR__.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'src'.DIRECTORY_SEPARATOR.'plugins'.DIRECTORY_SEPARATOR.$sPlugin.DIRECTORY_SEPARATOR.'public'.$_SERVER['REQUEST_URI']); |
| 133 | 133 | exit; |
| 134 | - } |
|
| 135 | - else if (strstr($_SERVER['REQUEST_URI'], '.css') |
|
| 134 | + } else if (strstr($_SERVER['REQUEST_URI'], '.css') |
|
| 136 | 135 | && file_exists(__DIR__.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'src'.DIRECTORY_SEPARATOR.'plugins'.DIRECTORY_SEPARATOR.$sPlugin.DIRECTORY_SEPARATOR.'public'.preg_replace('/\.css/', '.less', $_SERVER['REQUEST_URI']))) { |
| 137 | 136 | |
| 138 | 137 | Less::toCss(__DIR__.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'src'.DIRECTORY_SEPARATOR.'plugins'.DIRECTORY_SEPARATOR.$sPlugin.DIRECTORY_SEPARATOR.'public'.preg_replace('/\.css/', '.less', $_SERVER['REQUEST_URI'])); |
| 139 | 138 | exit; |
| 140 | - } |
|
| 141 | - else if (strstr($_SERVER['REQUEST_URI'], '.js') |
|
| 139 | + } else if (strstr($_SERVER['REQUEST_URI'], '.js') |
|
| 142 | 140 | && file_exists(__DIR__.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'src'.DIRECTORY_SEPARATOR.'plugins'.DIRECTORY_SEPARATOR.$sPlugin.DIRECTORY_SEPARATOR.'public'.preg_replace('/\.js/', '.ts', $_SERVER['REQUEST_URI']))) { |
| 143 | 141 | |
| 144 | 142 | Typescript::toJs(__DIR__.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'src'.DIRECTORY_SEPARATOR.'plugins'.DIRECTORY_SEPARATOR.$sPlugin.DIRECTORY_SEPARATOR.'public'.preg_replace('/\.js/', '.ts', $_SERVER['REQUEST_URI'])); |
@@ -167,8 +165,7 @@ discard block |
||
| 167 | 165 | header('Status: 301 Moved Permanently', false, 301); |
| 168 | 166 | header('Location: '.$oHost->location); |
| 169 | 167 | exit; |
| 170 | - } |
|
| 171 | - else if (preg_match('#getCss\?#', $_SERVER['REQUEST_URI'])) { |
|
| 168 | + } else if (preg_match('#getCss\?#', $_SERVER['REQUEST_URI'])) { |
|
| 172 | 169 | |
| 173 | 170 | foreach ($_GET as $sKey => $sValue) { |
| 174 | 171 | |
@@ -179,8 +176,7 @@ discard block |
||
| 179 | 176 | } |
| 180 | 177 | |
| 181 | 178 | exit; |
| 182 | - } |
|
| 183 | - else if (preg_match('#getJs\?#', $_SERVER['REQUEST_URI'])) { |
|
| 179 | + } else if (preg_match('#getJs\?#', $_SERVER['REQUEST_URI'])) { |
|
| 184 | 180 | |
| 185 | 181 | foreach ($_GET as $sKey => $sValue) { |
| 186 | 182 | |
@@ -191,8 +187,7 @@ discard block |
||
| 191 | 187 | } |
| 192 | 188 | |
| 193 | 189 | exit; |
| 194 | - } |
|
| 195 | - else if (isset($oHost->routes)) { |
|
| 190 | + } else if (isset($oHost->routes)) { |
|
| 196 | 191 | |
| 197 | 192 | foreach($oHost->routes as $sKey => $oRoute) { |
| 198 | 193 | |
@@ -201,8 +196,7 @@ discard block |
||
| 201 | 196 | if ($mReturn === 403) { |
| 202 | 197 | |
| 203 | 198 | $this->_getPage403(); |
| 204 | - } |
|
| 205 | - else if ($mReturn === true) { |
|
| 199 | + } else if ($mReturn === true) { |
|
| 206 | 200 | |
| 207 | 201 | if (isset($oRoute->cache)) { $this->_checkCache($oRoute->cache); } |
| 208 | 202 | |
@@ -215,11 +209,9 @@ discard block |
||
| 215 | 209 | } |
| 216 | 210 | } |
| 217 | 211 | } |
| 218 | - } |
|
| 219 | - else if (Request::isCliRequest()) { |
|
| 212 | + } else if (Request::isCliRequest()) { |
|
| 220 | 213 | |
| 221 | - if (isset($_SERVER['argv'])) { $aArguments = $_SERVER['argv']; } |
|
| 222 | - else { $aArguments = $argv; } |
|
| 214 | + if (isset($_SERVER['argv'])) { $aArguments = $_SERVER['argv']; } else { $aArguments = $argv; } |
|
| 223 | 215 | |
| 224 | 216 | define('PORTAL', 'Batch'); |
| 225 | 217 | set_include_path(get_include_path().PATH_SEPARATOR.'src'.PATH_SEPARATOR.PORTAL.PATH_SEPARATOR.'public'); |
@@ -229,8 +221,7 @@ discard block |
||
| 229 | 221 | $sBatchName = "phpunit"; |
| 230 | 222 | $aArguments[0] = "bin/console"; |
| 231 | 223 | $aArguments[1] = "phpunit"; |
| 232 | - } |
|
| 233 | - else { |
|
| 224 | + } else { |
|
| 234 | 225 | $sBatchName = $aArguments[1]; |
| 235 | 226 | } |
| 236 | 227 | |
@@ -279,8 +270,7 @@ discard block |
||
| 279 | 270 | if (isset($oBatch->controller) && isset($oBatch->action)) { |
| 280 | 271 | |
| 281 | 272 | echo $this->_loadController($oBatch->controller, $oBatch->action, array($aOptions)); |
| 282 | - } |
|
| 283 | - else { |
|
| 273 | + } else { |
|
| 284 | 274 | |
| 285 | 275 | if (Request::isCliRequest()) { |
| 286 | 276 | |
@@ -323,8 +313,7 @@ discard block |
||
| 323 | 313 | } |
| 324 | 314 | } |
| 325 | 315 | } |
| 326 | - } |
|
| 327 | - else if (defined('STDIN')) { |
|
| 316 | + } else if (defined('STDIN')) { |
|
| 328 | 317 | |
| 329 | 318 | $oBatch = Config::get('Route')->batch->script->{$sRoute}; |
| 330 | 319 | echo $this->_loadController($oBatch->controller, $oBatch->action, $aParams); |
@@ -386,8 +375,7 @@ discard block |
||
| 386 | 375 | }, |
| 387 | 376 | $sRoute |
| 388 | 377 | ); |
| 389 | - } |
|
| 390 | - else { |
|
| 378 | + } else { |
|
| 391 | 379 | |
| 392 | 380 | $sFinalRoute = '.*'; |
| 393 | 381 | } |
@@ -437,8 +425,7 @@ discard block |
||
| 437 | 425 | |
| 438 | 426 | $oMobileDetect = new \Mobile_Detect; |
| 439 | 427 | |
| 440 | - if ($oMobileDetect->isMobile()) { $sCacheExt = '.mobi'; } |
|
| 441 | - else { $sCacheExt = ''; } |
|
| 428 | + if ($oMobileDetect->isMobile()) { $sCacheExt = '.mobi'; } else { $sCacheExt = ''; } |
|
| 442 | 429 | |
| 443 | 430 | $mCacheReturn = Cache::get($RequestUri.$sCacheExt, $oRoute->cache->max_age); |
| 444 | 431 | |
@@ -461,17 +448,14 @@ discard block |
||
| 461 | 448 | if ($oRoute->content_type == 'json') { |
| 462 | 449 | |
| 463 | 450 | header('Content-type: application/json; charset='.$sCharset.''); |
| 464 | - } |
|
| 465 | - else if ($oRoute->content_type == 'html') { |
|
| 451 | + } else if ($oRoute->content_type == 'html') { |
|
| 466 | 452 | |
| 467 | 453 | header('Content-type: text/html; charset='.$sCharset.''); |
| 468 | - } |
|
| 469 | - else if ($oRoute->content_type == 'jpeg') { |
|
| 454 | + } else if ($oRoute->content_type == 'jpeg') { |
|
| 470 | 455 | |
| 471 | 456 | header('Content-type: image/jpeg'); |
| 472 | 457 | } |
| 473 | - } |
|
| 474 | - else { |
|
| 458 | + } else { |
|
| 475 | 459 | |
| 476 | 460 | header('Content-type: text/html; charset='.$sCharset.''); |
| 477 | 461 | } |
@@ -492,21 +476,17 @@ discard block |
||
| 492 | 476 | if (isset($_GET[$sName]) && $_GET[$sName] != '') { |
| 493 | 477 | |
| 494 | 478 | $aEntries[] = $_GET[$sName]; |
| 495 | - } |
|
| 496 | - else if (isset($oRoute->defaults_constraints) && is_object($oRoute->defaults_constraints) |
|
| 479 | + } else if (isset($oRoute->defaults_constraints) && is_object($oRoute->defaults_constraints) |
|
| 497 | 480 | && isset($oRoute->defaults_constraints->{$sName})) { |
| 498 | 481 | |
| 499 | 482 | $aEntries[] = $oRoute->defaults_constraints->{$sName}; |
| 500 | - } |
|
| 501 | - else if (isset($_GET[$sName])) { |
|
| 483 | + } else if (isset($_GET[$sName])) { |
|
| 502 | 484 | |
| 503 | 485 | $aEntries[] = $_GET[$sName]; |
| 504 | - } |
|
| 505 | - else if (preg_match('/'.$sType.'/', '')) { |
|
| 486 | + } else if (preg_match('/'.$sType.'/', '')) { |
|
| 506 | 487 | |
| 507 | 488 | $aEntries[] = ''; |
| 508 | - } |
|
| 509 | - else { |
|
| 489 | + } else { |
|
| 510 | 490 | |
| 511 | 491 | $this->_oLogger->warning('Error: Parameter '.$sName.' not exists!'); |
| 512 | 492 | break; |
@@ -518,8 +498,7 @@ discard block |
||
| 518 | 498 | $mReturn = $this->_loadController($oController, $sActionName, $aEntries); |
| 519 | 499 | |
| 520 | 500 | } |
| 521 | - } |
|
| 522 | - else { |
|
| 501 | + } else { |
|
| 523 | 502 | |
| 524 | 503 | $mReturn = $this->_loadController($oController, $sActionName, $aEntries); |
| 525 | 504 | } |
@@ -531,8 +510,7 @@ discard block |
||
| 531 | 510 | $mReturn = json_encode($mReturn, JSON_PRETTY_PRINT); |
| 532 | 511 | } |
| 533 | 512 | } |
| 534 | - } |
|
| 535 | - else if (isset($oRoute->template) && isset($oRoute->layout) && $oRoute->layout === true) { |
|
| 513 | + } else if (isset($oRoute->template) && isset($oRoute->layout) && $oRoute->layout === true) { |
|
| 536 | 514 | |
| 537 | 515 | define('PORTAL', preg_replace('/^\\\\Venus\\\\src\\\\([a-zA-Z0-9_]+)\\\\.+$/', '$1', $oRoute->template)); |
| 538 | 516 | set_include_path(get_include_path().PATH_SEPARATOR.'src'.PATH_SEPARATOR.PORTAL.PATH_SEPARATOR.'public'); |
@@ -549,8 +527,7 @@ discard block |
||
| 549 | 527 | |
| 550 | 528 | $mReturn = $oLayout->assign('model', DIRECTORY_SEPARATOR.'src'.DIRECTORY_SEPARATOR.PORTAL.DIRECTORY_SEPARATOR.'View'.DIRECTORY_SEPARATOR.$oRoute->template.'.tpl') |
| 551 | 529 | ->fetch(); |
| 552 | - } |
|
| 553 | - else if (isset($oRoute->template)) { |
|
| 530 | + } else if (isset($oRoute->template)) { |
|
| 554 | 531 | |
| 555 | 532 | define('PORTAL', preg_replace('/^\\\\Venus\\\\src\\\\([a-zA-Z0-9_]+)\\\\.+$/', '$1', $oRoute->template)); |
| 556 | 533 | set_include_path(get_include_path().PATH_SEPARATOR.'src'.PATH_SEPARATOR.PORTAL.PATH_SEPARATOR.'public'); |
@@ -574,8 +551,7 @@ discard block |
||
| 574 | 551 | |
| 575 | 552 | $oMobileDetect = new \Mobile_Detect; |
| 576 | 553 | |
| 577 | - if ($oMobileDetect->isMobile()) { $sCacheExt = '.mobi'; } |
|
| 578 | - else { $sCacheExt = ''; } |
|
| 554 | + if ($oMobileDetect->isMobile()) { $sCacheExt = '.mobi'; } else { $sCacheExt = ''; } |
|
| 579 | 555 | |
| 580 | 556 | if (defined('COMPRESS_HTML') && COMPRESS_HTML) { |
| 581 | 557 | |
@@ -629,8 +605,7 @@ discard block |
||
| 629 | 605 | |
| 630 | 606 | $oMobileDetect = new \Mobile_Detect; |
| 631 | 607 | |
| 632 | - if ($oMobileDetect->isMobile()) { $sCacheExt = '.mobi'; } |
|
| 633 | - else { $sCacheExt = ''; } |
|
| 608 | + if ($oMobileDetect->isMobile()) { $sCacheExt = '.mobi'; } else { $sCacheExt = ''; } |
|
| 634 | 609 | |
| 635 | 610 | $mCacheReturn = Cache::get($sActionName.$sCacheExt, $aPhpDoc['Cache']['maxage']); |
| 636 | 611 | |
@@ -671,8 +646,7 @@ discard block |
||
| 671 | 646 | |
| 672 | 647 | $oMobileDetect = new \Mobile_Detect; |
| 673 | 648 | |
| 674 | - if ($oMobileDetect->isMobile()) { $sCacheExt = '.mobi'; } |
|
| 675 | - else { $sCacheExt = ''; } |
|
| 649 | + if ($oMobileDetect->isMobile()) { $sCacheExt = '.mobi'; } else { $sCacheExt = ''; } |
|
| 676 | 650 | |
| 677 | 651 | if (defined('COMPRESS_HTML') && COMPRESS_HTML) { |
| 678 | 652 | |
@@ -34,15 +34,15 @@ |
||
| 34 | 34 | { |
| 35 | 35 | /** |
| 36 | 36 | * translate the content |
| 37 | - * @see \Venus\lib\Response\ResponseInterface::translate() |
|
| 37 | + * @see \Venus\lib\Response\ResponseInterface::translate() |
|
| 38 | 38 | * |
| 39 | 39 | * @access public |
| 40 | 40 | * @param mixed $mContent content to translate |
| 41 | 41 | * @return mixed |
| 42 | 42 | */ |
| 43 | - public static function translate($mContent) |
|
| 44 | - { |
|
| 45 | - return yaml_emit($mContent); |
|
| 46 | - } |
|
| 43 | + public static function translate($mContent) |
|
| 44 | + { |
|
| 45 | + return yaml_emit($mContent); |
|
| 46 | + } |
|
| 47 | 47 | |
| 48 | 48 | } |
@@ -40,9 +40,9 @@ |
||
| 40 | 40 | * @param mixed $mContent content to translate |
| 41 | 41 | * @return mixed |
| 42 | 42 | */ |
| 43 | - public static function translate($mContent) |
|
| 44 | - { |
|
| 45 | - return $mContent; |
|
| 46 | - } |
|
| 43 | + public static function translate($mContent) |
|
| 44 | + { |
|
| 45 | + return $mContent; |
|
| 46 | + } |
|
| 47 | 47 | |
| 48 | 48 | } |
@@ -41,9 +41,9 @@ |
||
| 41 | 41 | * @param mixed $mContent content to translate |
| 42 | 42 | * @return mixed |
| 43 | 43 | */ |
| 44 | - public static function translate($mContent) |
|
| 45 | - { |
|
| 46 | - return json_encode(ObjectOperation::objectToArray($mContent)); |
|
| 47 | - } |
|
| 44 | + public static function translate($mContent) |
|
| 45 | + { |
|
| 46 | + return json_encode(ObjectOperation::objectToArray($mContent)); |
|
| 47 | + } |
|
| 48 | 48 | |
| 49 | 49 | } |
@@ -32,26 +32,26 @@ discard block |
||
| 32 | 32 | */ |
| 33 | 33 | class Redis extends RealRedis implements CacheInterface |
| 34 | 34 | { |
| 35 | - /** |
|
| 36 | - * constructor with the connection to Redis |
|
| 37 | - * |
|
| 38 | - * @access public |
|
| 39 | - * @param string $sName name of the session |
|
| 40 | - * @param int $iFlags flags |
|
| 41 | - * @param int $iTimeout expiration of cache |
|
| 42 | - * @return mixed |
|
| 43 | - * @throws \Exception |
|
| 44 | - */ |
|
| 45 | - public function __construct($oConf) |
|
| 46 | - { |
|
| 47 | - if (!$this->connect($oConf->host, $oConf->port)) { |
|
| 35 | + /** |
|
| 36 | + * constructor with the connection to Redis |
|
| 37 | + * |
|
| 38 | + * @access public |
|
| 39 | + * @param string $sName name of the session |
|
| 40 | + * @param int $iFlags flags |
|
| 41 | + * @param int $iTimeout expiration of cache |
|
| 42 | + * @return mixed |
|
| 43 | + * @throws \Exception |
|
| 44 | + */ |
|
| 45 | + public function __construct($oConf) |
|
| 46 | + { |
|
| 47 | + if (!$this->connect($oConf->host, $oConf->port)) { |
|
| 48 | 48 | |
| 49 | - throw new \Exception('Redis server unavailable'); |
|
| 50 | - } |
|
| 49 | + throw new \Exception('Redis server unavailable'); |
|
| 50 | + } |
|
| 51 | 51 | |
| 52 | - // Select the REDIS db index |
|
| 53 | - $this->select($oConf->index); |
|
| 54 | - } |
|
| 52 | + // Select the REDIS db index |
|
| 53 | + $this->select($oConf->index); |
|
| 54 | + } |
|
| 55 | 55 | |
| 56 | 56 | /** |
| 57 | 57 | * get a value |
@@ -64,7 +64,7 @@ discard block |
||
| 64 | 64 | */ |
| 65 | 65 | public function get(string $sName, int &$iFlags = null, int $iTimeout = 0) |
| 66 | 66 | { |
| 67 | - return parent::get($sName); |
|
| 67 | + return parent::get($sName); |
|
| 68 | 68 | } |
| 69 | 69 | |
| 70 | 70 | /** |
@@ -85,8 +85,7 @@ discard block |
||
| 85 | 85 | if (file_exists($this->_sFolder.$this->_getSubDirectory($sName).md5($sName).'.fil.cac')) { |
| 86 | 86 | |
| 87 | 87 | return unserialize(file_get_contents($this->_sFolder.$this->_getSubDirectory($sName).md5($sName).'.fil.cac')); |
| 88 | - } |
|
| 89 | - else { |
|
| 88 | + } else { |
|
| 90 | 89 | |
| 91 | 90 | return false; |
| 92 | 91 | } |
@@ -146,8 +145,7 @@ discard block |
||
| 146 | 145 | |
| 147 | 146 | while (($sFile = readdir($rDirectory)) !== false) { |
| 148 | 147 | |
| 149 | - if ($sFile > '0' && filetype($sName.$sFile) == "file") { unlink($sName.$sFile); } |
|
| 150 | - elseif ($sFile > '0' && filetype($sName.$sFile) == "dir") { remove_dir($sName.$sFile."\\"); } |
|
| 148 | + if ($sFile > '0' && filetype($sName.$sFile) == "file") { unlink($sName.$sFile); } elseif ($sFile > '0' && filetype($sName.$sFile) == "dir") { remove_dir($sName.$sFile."\\"); } |
|
| 151 | 149 | } |
| 152 | 150 | |
| 153 | 151 | closedir($rDirectory); |
@@ -9,11 +9,11 @@ |
||
| 9 | 9 | |
| 10 | 10 | interface RequestInterface |
| 11 | 11 | { |
| 12 | - /** |
|
| 13 | - * get parameter |
|
| 14 | - * @param string $name |
|
| 15 | - * @param string $default |
|
| 16 | - * @return string |
|
| 17 | - */ |
|
| 18 | - public function get(string $name, string $default = null) : string; |
|
| 12 | + /** |
|
| 13 | + * get parameter |
|
| 14 | + * @param string $name |
|
| 15 | + * @param string $default |
|
| 16 | + * @return string |
|
| 17 | + */ |
|
| 18 | + public function get(string $name, string $default = null) : string; |
|
| 19 | 19 | } |