@@ -32,8 +32,8 @@ |
||
| 32 | 32 | <p>Required PHP version : <b>PHP >= <?php echo TNH_MIN_PHP_VERSION; ?>, PHP < <?php echo TNH_MAX_PHP_VERSION; ?></b></p> |
| 33 | 33 | <p>Release date : <b><?php echo TNH_RELEASE_DATE; ?></b></p> |
| 34 | 34 | <hr /> |
| 35 | - <p>Current controller: <b class = "text-muted label-danger"><?php echo APPS_CONTROLLER_PATH . 'Home.php';?></b> |
|
| 36 | - <p>Current view: <b class = "text-muted label-danger"><?php echo APPS_VIEWS_PATH . 'home.php';?></b> |
|
| 35 | + <p>Current controller: <b class = "text-muted label-danger"><?php echo APPS_CONTROLLER_PATH . 'Home.php'; ?></b> |
|
| 36 | + <p>Current view: <b class = "text-muted label-danger"><?php echo APPS_VIEWS_PATH . 'home.php'; ?></b> |
|
| 37 | 37 | </div> |
| 38 | 38 | </div> |
| 39 | 39 | </div> |
@@ -144,7 +144,7 @@ discard block |
||
| 144 | 144 | * Reset all properties |
| 145 | 145 | */ |
| 146 | 146 | public function reset() { |
| 147 | - $this->_agent = get_instance()->globalvar->server('HTTP_USER_AGENT'); |
|
| 147 | + $this->_agent = get_instance()->globalvar->server('HTTP_USER_AGENT'); |
|
| 148 | 148 | $this->_browser_name = 'unknown'; |
| 149 | 149 | $this->_version = 'unknown'; |
| 150 | 150 | $this->_platform = 'unknown'; |
@@ -306,7 +306,7 @@ discard block |
||
| 306 | 306 | */ |
| 307 | 307 | protected function checkPlatform() { |
| 308 | 308 | foreach ($this->_platforms as $regex => $value) { |
| 309 | - if (preg_match($regex, $this->_agent) ) { |
|
| 309 | + if (preg_match($regex, $this->_agent)) { |
|
| 310 | 310 | $this->setPlatform($value); |
| 311 | 311 | break; |
| 312 | 312 | } |
@@ -318,7 +318,7 @@ discard block |
||
| 318 | 318 | */ |
| 319 | 319 | protected function checkBrowser() { |
| 320 | 320 | foreach ($this->_browsers as $regex => $value) { |
| 321 | - if (preg_match($regex, $this->_agent ) ) { |
|
| 321 | + if (preg_match($regex, $this->_agent)) { |
|
| 322 | 322 | $this->setBrowser($value); |
| 323 | 323 | break; |
| 324 | 324 | } |
@@ -328,10 +328,10 @@ discard block |
||
| 328 | 328 | /** |
| 329 | 329 | * Routine to determine the browser version |
| 330 | 330 | */ |
| 331 | - protected function checkBrowserVersion(){ |
|
| 331 | + protected function checkBrowserVersion() { |
|
| 332 | 332 | $detected = $this->getBrowser(); |
| 333 | 333 | $d = array_search($detected, $this->_browsers); |
| 334 | - $browser = str_replace(array("/i","/"), "", $d); |
|
| 334 | + $browser = str_replace(array("/i", "/"), "", $d); |
|
| 335 | 335 | $regex = "/(?<browser>version|{$browser})[\/]+(?<version>[0-9.|a-zA-Z.]*)/i"; |
| 336 | 336 | if (preg_match_all($regex, $this->_agent, $matches)) { |
| 337 | 337 | $found = array_search($browser, $matches["browser"]); |
@@ -343,7 +343,7 @@ discard block |
||
| 343 | 343 | * Determine if the browser is Mobile or not |
| 344 | 344 | */ |
| 345 | 345 | protected function checkMobile() { |
| 346 | - if (preg_match('/(android|avantgo|blackberry|bolt|boost|cricket|docomo|fone|hiptop|mini|mobi|palm|phone|pie|tablet|up\.browser|up\.link|webos|wos)/i', $this->_agent) ) { |
|
| 346 | + if (preg_match('/(android|avantgo|blackberry|bolt|boost|cricket|docomo|fone|hiptop|mini|mobi|palm|phone|pie|tablet|up\.browser|up\.link|webos|wos)/i', $this->_agent)) { |
|
| 347 | 347 | $this->setMobile(true); |
| 348 | 348 | } |
| 349 | 349 | } |
@@ -352,7 +352,7 @@ discard block |
||
| 352 | 352 | * Determine if the browser is Tablet or not |
| 353 | 353 | */ |
| 354 | 354 | protected function checkTablet() { |
| 355 | - if (preg_match('/tablet|ipad/i', $this->_agent) ) { |
|
| 355 | + if (preg_match('/tablet|ipad/i', $this->_agent)) { |
|
| 356 | 356 | $this->setTablet(true); |
| 357 | 357 | } |
| 358 | 358 | } |
@@ -361,7 +361,7 @@ discard block |
||
| 361 | 361 | * Determine if the browser is Robot or not |
| 362 | 362 | */ |
| 363 | 363 | protected function checkBot() { |
| 364 | - if (preg_match('/bot/i', $this->_agent) ) { |
|
| 364 | + if (preg_match('/bot/i', $this->_agent)) { |
|
| 365 | 365 | $this->setRobot(true); |
| 366 | 366 | } |
| 367 | 367 | } |
@@ -373,7 +373,7 @@ discard block |
||
| 373 | 373 | if (stristr($this->_agent, 'FacebookExternalHit')) { |
| 374 | 374 | $this->setRobot(true); |
| 375 | 375 | $this->setFacebook(true); |
| 376 | - } else if (stristr($this->_agent, 'FBIOS')) { |
|
| 376 | + } else if (stristr($this->_agent, 'FBIOS')) { |
|
| 377 | 377 | $this->setFacebook(true); |
| 378 | 378 | } |
| 379 | 379 | } |
@@ -158,7 +158,7 @@ discard block |
||
| 158 | 158 | public function getCacheContent() { |
| 159 | 159 | //set some attributes values |
| 160 | 160 | $this->setPropertiesValues(); |
| 161 | - if(! $this->isSelectQuery || ! $this->dbCacheStatus){ |
|
| 161 | + if (!$this->isSelectQuery || !$this->dbCacheStatus) { |
|
| 162 | 162 | $this->logger->info('The cache is not enabled for this query or is not a SELECT query'); |
| 163 | 163 | return null; |
| 164 | 164 | } |
@@ -179,7 +179,7 @@ discard block |
||
| 179 | 179 | public function saveCacheContent($result) { |
| 180 | 180 | //set some attributes values |
| 181 | 181 | $this->setPropertiesValues(); |
| 182 | - if(! $this->isSelectQuery || ! $this->dbCacheStatus){ |
|
| 182 | + if (!$this->isSelectQuery || !$this->dbCacheStatus) { |
|
| 183 | 183 | return null; |
| 184 | 184 | } |
| 185 | 185 | $this->setCacheInstanceFromSuperInstanceIfNull(); |
@@ -308,7 +308,7 @@ discard block |
||
| 308 | 308 | * @param string $appLang the application language, only if type = "language" |
| 309 | 309 | * @return string|null the full file path |
| 310 | 310 | */ |
| 311 | - protected function getDefaultFilePathForFunctionLanguage($file, $type, $appLang = null){ |
|
| 311 | + protected function getDefaultFilePathForFunctionLanguage($file, $type, $appLang = null) { |
|
| 312 | 312 | $searchDir = null; |
| 313 | 313 | if ($type == 'function') { |
| 314 | 314 | $searchDir = array(FUNCTIONS_PATH, CORE_FUNCTIONS_PATH); |
@@ -334,7 +334,7 @@ discard block |
||
| 334 | 334 | * @param string|null $module the module if is not null will return it |
| 335 | 335 | * @return string|null |
| 336 | 336 | */ |
| 337 | - protected function getModuleFromSuperController($module){ |
|
| 337 | + protected function getModuleFromSuperController($module) { |
|
| 338 | 338 | $obj = & get_instance(); |
| 339 | 339 | if (!$module && !empty($obj->moduleName)) { |
| 340 | 340 | $module = $obj->moduleName; |
@@ -61,7 +61,7 @@ |
||
| 61 | 61 | */ |
| 62 | 62 | public function add($name) { |
| 63 | 63 | if (in_array($name, $this->list)) { |
| 64 | - $this->logger->info('The module [' .$name. '] already added skipping.'); |
|
| 64 | + $this->logger->info('The module [' . $name . '] already added skipping.'); |
|
| 65 | 65 | return $this; |
| 66 | 66 | } |
| 67 | 67 | $this->list[] = $name; |
@@ -143,7 +143,7 @@ discard block |
||
| 143 | 143 | $instance = $db; |
| 144 | 144 | } else { |
| 145 | 145 | $obj = & get_instance(); |
| 146 | - if (isset($obj->database)){ |
|
| 146 | + if (isset($obj->database)) { |
|
| 147 | 147 | /** |
| 148 | 148 | * NOTE: Need use "clone" because some Model need have the personal instance of the database library |
| 149 | 149 | * to prevent duplication |
@@ -684,7 +684,7 @@ discard block |
||
| 684 | 684 | * Get the return type array or object |
| 685 | 685 | * @return string|boolean |
| 686 | 686 | */ |
| 687 | - protected function getReturnType(){ |
|
| 687 | + protected function getReturnType() { |
|
| 688 | 688 | $type = false; |
| 689 | 689 | if ($this->_temporary_return_type == 'array') { |
| 690 | 690 | $type = 'array'; |
@@ -696,7 +696,7 @@ discard block |
||
| 696 | 696 | * Check if soft delete is enable setting the condition |
| 697 | 697 | * @return object the current instance |
| 698 | 698 | */ |
| 699 | - protected function checkForSoftDelete(){ |
|
| 699 | + protected function checkForSoftDelete() { |
|
| 700 | 700 | if ($this->soft_delete && $this->_temporary_with_deleted !== true) { |
| 701 | 701 | $this->getQueryBuilder()->where($this->soft_delete_key, (bool) $this->_temporary_only_deleted); |
| 702 | 702 | } |
@@ -711,11 +711,11 @@ discard block |
||
| 711 | 711 | * @param string $type the type can be "belongs_to", "has_many" |
| 712 | 712 | * @return mixed the final row values |
| 713 | 713 | */ |
| 714 | - protected function relateBelongsToAndHasMany($relationship, $options, $row, $type){ |
|
| 714 | + protected function relateBelongsToAndHasMany($relationship, $options, $row, $type) { |
|
| 715 | 715 | if (in_array($relationship, $this->_with)) { |
| 716 | 716 | get_instance()->loader->model($options['model'], $relationship . '_model'); |
| 717 | 717 | |
| 718 | - if($type == 'belongs_to'){ |
|
| 718 | + if ($type == 'belongs_to') { |
|
| 719 | 719 | if (is_object($row)) { |
| 720 | 720 | $row->{$relationship} = $this->{$relationship . '_model'}->get($row->{$options['primary_key']}); |
| 721 | 721 | } else { |
@@ -443,7 +443,7 @@ discard block |
||
| 443 | 443 | * Remove the DOCUMENT_ROOT and front controller from segments if exists |
| 444 | 444 | * @return void |
| 445 | 445 | */ |
| 446 | - protected function removeDocumentRootFrontControllerFromSegments(){ |
|
| 446 | + protected function removeDocumentRootFrontControllerFromSegments() { |
|
| 447 | 447 | $segment = $this->segments; |
| 448 | 448 | $baseUrl = get_config('base_url'); |
| 449 | 449 | //check if the app is not in DOCUMENT_ROOT |
@@ -561,7 +561,7 @@ discard block |
||
| 561 | 561 | break; |
| 562 | 562 | } |
| 563 | 563 | } |
| 564 | - if($findIndex !== -1){ |
|
| 564 | + if ($findIndex !== -1) { |
|
| 565 | 565 | //$args[0] => full string captured by preg_match |
| 566 | 566 | //$args[1], $args[2], $args[n] => contains the value of |
| 567 | 567 | //(:num), (:alpha), (:alnum), (:any) |
@@ -586,7 +586,7 @@ discard block |
||
| 586 | 586 | * Find file path of the current controller using the current module |
| 587 | 587 | * @return boolean true if the file path is found otherwise false. |
| 588 | 588 | */ |
| 589 | - protected function findControllerFullPathUsingCurrentModule(){ |
|
| 589 | + protected function findControllerFullPathUsingCurrentModule() { |
|
| 590 | 590 | $path = $this->moduleInstance->findControllerFullPath(ucfirst($this->controller), $this->module); |
| 591 | 591 | if (!$path) { |
| 592 | 592 | $this->logger->info('The controller [' . $this->controller . '] not found in the module, may be will use the module [' . $this->module . '] as controller'); |
@@ -602,7 +602,7 @@ discard block |
||
| 602 | 602 | * or the current request does not use module |
| 603 | 603 | * @return void |
| 604 | 604 | */ |
| 605 | - protected function setRouteParamsIfNoModuleOrNotFound(){ |
|
| 605 | + protected function setRouteParamsIfNoModuleOrNotFound() { |
|
| 606 | 606 | $segment = $this->segments; |
| 607 | 607 | //controller |
| 608 | 608 | if (isset($segment[0])) { |
@@ -623,7 +623,7 @@ discard block |
||
| 623 | 623 | * or the current request use module |
| 624 | 624 | * @return void |
| 625 | 625 | */ |
| 626 | - protected function setRouteParamsIfAppHasModuleOrFound(){ |
|
| 626 | + protected function setRouteParamsIfAppHasModuleOrFound() { |
|
| 627 | 627 | //get the module list |
| 628 | 628 | $modules = $this->moduleInstance->getModuleList(); |
| 629 | 629 | $segment = $this->segments; |
@@ -636,7 +636,7 @@ discard block |
||
| 636 | 636 | $this->controller = $segment[0]; |
| 637 | 637 | |
| 638 | 638 | //check if the request use the same module name and controller |
| 639 | - if($this->findControllerFullPathUsingCurrentModule()){ |
|
| 639 | + if ($this->findControllerFullPathUsingCurrentModule()) { |
|
| 640 | 640 | array_shift($segment); |
| 641 | 641 | } |
| 642 | 642 | } |