@@ -262,24 +262,24 @@ |
||
| 262 | 262 | return $this; |
| 263 | 263 | } |
| 264 | 264 | |
| 265 | - /** |
|
| 266 | - * Return the instance of session. |
|
| 267 | - * @return object the session instance |
|
| 268 | - */ |
|
| 265 | + /** |
|
| 266 | + * Return the instance of session. |
|
| 267 | + * @return object the session instance |
|
| 268 | + */ |
|
| 269 | 269 | public function getSession() { |
| 270 | 270 | return $this->session; |
| 271 | 271 | } |
| 272 | 272 | |
| 273 | - /** |
|
| 274 | - * Set the value for $_GET, $_POST, $_SERVER etc. if the key is an array will |
|
| 275 | - * set the current super variable value by this. |
|
| 276 | - * @param string $type the type can be "post", "get", etc. |
|
| 277 | - * @param string|array $key the item key to be set or array if need set the current global variable |
|
| 278 | - * by this value |
|
| 279 | - * @param mixed $value the value to set if $key is not an array |
|
| 280 | - * |
|
| 281 | - * @return object the current instance |
|
| 282 | - */ |
|
| 273 | + /** |
|
| 274 | + * Set the value for $_GET, $_POST, $_SERVER etc. if the key is an array will |
|
| 275 | + * set the current super variable value by this. |
|
| 276 | + * @param string $type the type can be "post", "get", etc. |
|
| 277 | + * @param string|array $key the item key to be set or array if need set the current global variable |
|
| 278 | + * by this value |
|
| 279 | + * @param mixed $value the value to set if $key is not an array |
|
| 280 | + * |
|
| 281 | + * @return object the current instance |
|
| 282 | + */ |
|
| 283 | 283 | protected function setVars($type, $key, $value = null) { |
| 284 | 284 | if (is_array($key)) { |
| 285 | 285 | //set all |
@@ -185,7 +185,7 @@ discard block |
||
| 185 | 185 | } else { |
| 186 | 186 | $logger->info('Cannot find view [' . $view . '] in module [' . $module . '] using the default location'); |
| 187 | 187 | } |
| 188 | - if (!$path) { |
|
| 188 | + if (!$path) { |
|
| 189 | 189 | $path = $this->getDefaultFilePathForView($viewFile); |
| 190 | 190 | } |
| 191 | 191 | $logger->info('The view file path to be loaded is [' . $path . ']'); |
@@ -273,12 +273,12 @@ discard block |
||
| 273 | 273 | return $this->_pageRender; |
| 274 | 274 | } |
| 275 | 275 | |
| 276 | - /** |
|
| 277 | - * Set the final page to be rendered |
|
| 278 | - * @param string $finalPage the content of the final page |
|
| 279 | - * |
|
| 280 | - * @return object |
|
| 281 | - */ |
|
| 276 | + /** |
|
| 277 | + * Set the final page to be rendered |
|
| 278 | + * @param string $finalPage the content of the final page |
|
| 279 | + * |
|
| 280 | + * @return object |
|
| 281 | + */ |
|
| 282 | 282 | public function setFinalPageContent($finalPage) { |
| 283 | 283 | $this->_pageRender = $finalPage; |
| 284 | 284 | return $this; |
@@ -351,12 +351,12 @@ discard block |
||
| 351 | 351 | ob_end_flush(); |
| 352 | 352 | } |
| 353 | 353 | |
| 354 | - /** |
|
| 355 | - * Return the default full file path for view |
|
| 356 | - * @param string $file the filename |
|
| 357 | - * |
|
| 358 | - * @return string|null the full file path |
|
| 359 | - */ |
|
| 354 | + /** |
|
| 355 | + * Return the default full file path for view |
|
| 356 | + * @param string $file the filename |
|
| 357 | + * |
|
| 358 | + * @return string|null the full file path |
|
| 359 | + */ |
|
| 360 | 360 | protected static function getDefaultFilePathForView($file){ |
| 361 | 361 | $searchDir = array(APPS_VIEWS_PATH, CORE_VIEWS_PATH); |
| 362 | 362 | $fullFilePath = null; |
@@ -548,18 +548,18 @@ discard block |
||
| 548 | 548 | } |
| 549 | 549 | } |
| 550 | 550 | |
| 551 | - /** |
|
| 552 | - * Set the mandory headers, like security, etc. |
|
| 553 | - */ |
|
| 551 | + /** |
|
| 552 | + * Set the mandory headers, like security, etc. |
|
| 553 | + */ |
|
| 554 | 554 | protected static function setRequiredHeaders() { |
| 555 | 555 | $requiredHeaders = array( |
| 556 | 556 | 'X-XSS-Protection' => '1; mode=block', |
| 557 | 557 | 'X-Frame-Options' => 'SAMEORIGIN' |
| 558 | 558 | ); |
| 559 | 559 | foreach ($requiredHeaders as $key => $value) { |
| 560 | - if (!isset(self::$headers[$key])) { |
|
| 560 | + if (!isset(self::$headers[$key])) { |
|
| 561 | 561 | self::$headers[$key] = $value; |
| 562 | - } |
|
| 562 | + } |
|
| 563 | 563 | } |
| 564 | 564 | } |
| 565 | 565 | } |
@@ -241,12 +241,12 @@ discard block |
||
| 241 | 241 | } |
| 242 | 242 | |
| 243 | 243 | /** |
| 244 | - * Setting the route configuration using the configuration file and additional configuration from param |
|
| 245 | - * @param array $overwriteConfig the additional configuration to overwrite with the existing one |
|
| 246 | - * @param boolean $useConfigFile whether to use route configuration file |
|
| 247 | - * |
|
| 248 | - * @return object |
|
| 249 | - */ |
|
| 244 | + * Setting the route configuration using the configuration file and additional configuration from param |
|
| 245 | + * @param array $overwriteConfig the additional configuration to overwrite with the existing one |
|
| 246 | + * @param boolean $useConfigFile whether to use route configuration file |
|
| 247 | + * |
|
| 248 | + * @return object |
|
| 249 | + */ |
|
| 250 | 250 | public function setRouteConfiguration(array $overwriteConfig = array(), $useConfigFile = true) { |
| 251 | 251 | $route = array(); |
| 252 | 252 | if ($useConfigFile && file_exists(CONFIG_PATH . 'routes.php')) { |
@@ -423,11 +423,11 @@ discard block |
||
| 423 | 423 | } |
| 424 | 424 | } |
| 425 | 425 | |
| 426 | - /** |
|
| 427 | - * Remove the URL suffix and query string values if exists |
|
| 428 | - * @param string $uri the route URI to process |
|
| 429 | - * @return string the final route uri after processed |
|
| 430 | - */ |
|
| 426 | + /** |
|
| 427 | + * Remove the URL suffix and query string values if exists |
|
| 428 | + * @param string $uri the route URI to process |
|
| 429 | + * @return string the final route uri after processed |
|
| 430 | + */ |
|
| 431 | 431 | protected function removeSuffixAndQueryStringFromUri($uri) { |
| 432 | 432 | $this->logger->debug('Check if URL suffix is enabled in the configuration'); |
| 433 | 433 | //remove url suffix from the request URI |
@@ -540,7 +540,7 @@ discard block |
||
| 540 | 540 | $this->logger->info( |
| 541 | 541 | 'After loop in predefined routes configuration,' |
| 542 | 542 | . 'the module name is set but the controller is not set,' |
| 543 | - . 'so we will use module as the controller' |
|
| 543 | + . 'so we will use module as the controller' |
|
| 544 | 544 | ); |
| 545 | 545 | $this->controller = $this->module; |
| 546 | 546 | } |
@@ -84,10 +84,10 @@ |
||
| 84 | 84 | } |
| 85 | 85 | |
| 86 | 86 | /** |
| 87 | - * This method is used to check the whitelist IP address access |
|
| 88 | - * |
|
| 89 | - * @return boolean |
|
| 90 | - */ |
|
| 87 | + * This method is used to check the whitelist IP address access |
|
| 88 | + * |
|
| 89 | + * @return boolean |
|
| 90 | + */ |
|
| 91 | 91 | public static function checkWhiteListIpAccess() { |
| 92 | 92 | $logger = self::getLogger(); |
| 93 | 93 | $logger->debug('Validation of the IP address access ...'); |
@@ -170,7 +170,7 @@ |
||
| 170 | 170 | //by default count() return 1 if the parameter is not an array |
| 171 | 171 | //object or object implements Countable. |
| 172 | 172 | if (is_array($result) || is_object($result) || $result instanceof Countable) { |
| 173 | - $numRows = count($result); |
|
| 173 | + $numRows = count($result); |
|
| 174 | 174 | } |
| 175 | 175 | } else { |
| 176 | 176 | $numRows = $this->pdoStatment->rowCount(); |
@@ -45,7 +45,7 @@ |
||
| 45 | 45 | $attributes['accept-charset'] = get_config('charset', 'UTF-8'); |
| 46 | 46 | } |
| 47 | 47 | if (!empty($enctype)) { |
| 48 | - $attributes['enctype'] = $enctype; |
|
| 48 | + $attributes['enctype'] = $enctype; |
|
| 49 | 49 | } |
| 50 | 50 | $str .= attributes_to_string($attributes); |
| 51 | 51 | $str .= '>'; |
@@ -40,7 +40,7 @@ discard block |
||
| 40 | 40 | $logger->debug('Check if the application contains the modules ...'); |
| 41 | 41 | $dirList = glob(MODULE_PATH . '*', GLOB_ONLYDIR); |
| 42 | 42 | if ($dirList !== false) { |
| 43 | - self::$list = array_map('basename', $dirList); |
|
| 43 | + self::$list = array_map('basename', $dirList); |
|
| 44 | 44 | } |
| 45 | 45 | if (!empty(self::$list)) { |
| 46 | 46 | $logger->info('The application contains the module below [' . implode(', ', self::getModuleList()) . ']'); |
@@ -57,8 +57,8 @@ discard block |
||
| 57 | 57 | public function add($name) { |
| 58 | 58 | $logger = self::getLogger(); |
| 59 | 59 | if (in_array($name, self::$list)) { |
| 60 | - $logger->info('The module [' .$name. '] already added skipping.'); |
|
| 61 | - return $this; |
|
| 60 | + $logger->info('The module [' .$name. '] already added skipping.'); |
|
| 61 | + return $this; |
|
| 62 | 62 | } |
| 63 | 63 | self::$list[] = $name; |
| 64 | 64 | return $this; |
@@ -88,10 +88,10 @@ discard block |
||
| 88 | 88 | self::$list = array(); |
| 89 | 89 | } |
| 90 | 90 | |
| 91 | - /** |
|
| 92 | - * Get the list of module loaded |
|
| 93 | - * @return array the module list |
|
| 94 | - */ |
|
| 91 | + /** |
|
| 92 | + * Get the list of module loaded |
|
| 93 | + * @return array the module list |
|
| 94 | + */ |
|
| 95 | 95 | public static function getModuleList() { |
| 96 | 96 | return self::$list; |
| 97 | 97 | } |
@@ -781,12 +781,12 @@ |
||
| 781 | 781 | * |
| 782 | 782 | * @return string|null |
| 783 | 783 | */ |
| 784 | - protected function buildQueryPart($property, $command = ''){ |
|
| 784 | + protected function buildQueryPart($property, $command = ''){ |
|
| 785 | 785 | if (!empty($this->{$property})) { |
| 786 | 786 | return $command . $this->{$property}; |
| 787 | 787 | } |
| 788 | 788 | return null; |
| 789 | - } |
|
| 789 | + } |
|
| 790 | 790 | |
| 791 | 791 | |
| 792 | 792 | /** |
@@ -1,32 +1,32 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | defined('ROOT_PATH') || exit('Access denied'); |
| 3 | - /** |
|
| 4 | - * TNH Framework |
|
| 5 | - * |
|
| 6 | - * A simple PHP framework using HMVC architecture |
|
| 7 | - * |
|
| 8 | - * This content is released under the MIT License (MIT) |
|
| 9 | - * |
|
| 10 | - * Copyright (c) 2017 TNH Framework |
|
| 11 | - * |
|
| 12 | - * Permission is hereby granted, free of charge, to any person obtaining a copy |
|
| 13 | - * of this software and associated documentation files (the "Software"), to deal |
|
| 14 | - * in the Software without restriction, including without limitation the rights |
|
| 15 | - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
|
| 16 | - * copies of the Software, and to permit persons to whom the Software is |
|
| 17 | - * furnished to do so, subject to the following conditions: |
|
| 18 | - * |
|
| 19 | - * The above copyright notice and this permission notice shall be included in all |
|
| 20 | - * copies or substantial portions of the Software. |
|
| 21 | - * |
|
| 22 | - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
|
| 23 | - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
|
| 24 | - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
|
| 25 | - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
|
| 26 | - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
|
| 27 | - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE |
|
| 28 | - * SOFTWARE. |
|
| 29 | - */ |
|
| 3 | + /** |
|
| 4 | + * TNH Framework |
|
| 5 | + * |
|
| 6 | + * A simple PHP framework using HMVC architecture |
|
| 7 | + * |
|
| 8 | + * This content is released under the MIT License (MIT) |
|
| 9 | + * |
|
| 10 | + * Copyright (c) 2017 TNH Framework |
|
| 11 | + * |
|
| 12 | + * Permission is hereby granted, free of charge, to any person obtaining a copy |
|
| 13 | + * of this software and associated documentation files (the "Software"), to deal |
|
| 14 | + * in the Software without restriction, including without limitation the rights |
|
| 15 | + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
|
| 16 | + * copies of the Software, and to permit persons to whom the Software is |
|
| 17 | + * furnished to do so, subject to the following conditions: |
|
| 18 | + * |
|
| 19 | + * The above copyright notice and this permission notice shall be included in all |
|
| 20 | + * copies or substantial portions of the Software. |
|
| 21 | + * |
|
| 22 | + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
|
| 23 | + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
|
| 24 | + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
|
| 25 | + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
|
| 26 | + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
|
| 27 | + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE |
|
| 28 | + * SOFTWARE. |
|
| 29 | + */ |
|
| 30 | 30 | |
| 31 | 31 | /** |
| 32 | 32 | * @file bootstrap.php |