@@ -204,7 +204,7 @@ |
||
| 204 | 204 | //If is the SELECT query |
| 205 | 205 | $this->isSqlSELECTQuery = stristr($this->query, 'SELECT') !== false; |
| 206 | 206 | |
| 207 | - //if can use cache feature for this query |
|
| 207 | + //if can use cache feature for this query |
|
| 208 | 208 | $this->dbCacheStatus = get_config('cache_enable', false) && $this->cacheTtl > 0; |
| 209 | 209 | } |
| 210 | 210 | |
@@ -154,7 +154,7 @@ discard block |
||
| 154 | 154 | public function getCacheContent() { |
| 155 | 155 | //set some attributes values |
| 156 | 156 | $this->setPropertiesValues(); |
| 157 | - if(! $this->isSqlSELECTQuery || ! $this->dbCacheStatus){ |
|
| 157 | + if (!$this->isSqlSELECTQuery || !$this->dbCacheStatus) { |
|
| 158 | 158 | $this->logger->info('The cache is not enabled for this query or is not a SELECT query'); |
| 159 | 159 | return null; |
| 160 | 160 | } |
@@ -181,7 +181,7 @@ discard block |
||
| 181 | 181 | public function saveCacheContent($result) { |
| 182 | 182 | //set some attributes values |
| 183 | 183 | $this->setPropertiesValues(); |
| 184 | - if(! $this->isSqlSELECTQuery || ! $this->dbCacheStatus){ |
|
| 184 | + if (!$this->isSqlSELECTQuery || !$this->dbCacheStatus) { |
|
| 185 | 185 | //just return true |
| 186 | 186 | return true; |
| 187 | 187 | } |
@@ -724,12 +724,12 @@ |
||
| 724 | 724 | * |
| 725 | 725 | * @return string|null |
| 726 | 726 | */ |
| 727 | - protected function buildQueryPart($property, $command = ''){ |
|
| 727 | + protected function buildQueryPart($property, $command = ''){ |
|
| 728 | 728 | if (!empty($this->{$property})) { |
| 729 | 729 | return $command . ' ' . $this->{$property}; |
| 730 | 730 | } |
| 731 | 731 | return null; |
| 732 | - } |
|
| 732 | + } |
|
| 733 | 733 | |
| 734 | 734 | |
| 735 | 735 | /** |
@@ -420,7 +420,7 @@ discard block |
||
| 420 | 420 | $_keys = array(); |
| 421 | 421 | foreach ($keys as $k => $v) { |
| 422 | 422 | $v = $this->checkForNullValue($v); |
| 423 | - if (! is_numeric($v)) { |
|
| 423 | + if (!is_numeric($v)) { |
|
| 424 | 424 | $v = $this->escape($v, $escape); |
| 425 | 425 | } |
| 426 | 426 | $_keys[] = $v; |
@@ -710,7 +710,7 @@ discard block |
||
| 710 | 710 | * |
| 711 | 711 | * @return string|null |
| 712 | 712 | */ |
| 713 | - protected function buildQueryPart($property, $command = ''){ |
|
| 713 | + protected function buildQueryPart($property, $command = '') { |
|
| 714 | 714 | if (!empty($this->{$property})) { |
| 715 | 715 | return $command . ' ' . $this->{$property}; |
| 716 | 716 | } |
@@ -796,7 +796,7 @@ discard block |
||
| 796 | 796 | * @param string $clause the clause type "IS NULL", "IS NOT NULLs" |
| 797 | 797 | * @return object the current DatabaseQueryBuilder instance |
| 798 | 798 | */ |
| 799 | - protected function whereIsNullAndNotNull($field, $andOr = 'AND', $clause = 'IS NULL'){ |
|
| 799 | + protected function whereIsNullAndNotNull($field, $andOr = 'AND', $clause = 'IS NULL') { |
|
| 800 | 800 | if (is_array($field)) { |
| 801 | 801 | foreach ($field as $f) { |
| 802 | 802 | $this->whereIsNullAndNotNull($f, $andOr, $clause); |
@@ -814,7 +814,7 @@ discard block |
||
| 814 | 814 | * |
| 815 | 815 | * @return object the current instance |
| 816 | 816 | */ |
| 817 | - protected function setSelectStr($newSelect){ |
|
| 817 | + protected function setSelectStr($newSelect) { |
|
| 818 | 818 | $this->select = (($this->select == '*' || empty($this->select)) |
| 819 | 819 | ? $newSelect |
| 820 | 820 | : $this->select . ', ' . $newSelect); |
@@ -828,8 +828,8 @@ discard block |
||
| 828 | 828 | * @return string the empty string if the value is null |
| 829 | 829 | * otherwise the same value will be returned |
| 830 | 830 | */ |
| 831 | - protected function checkForNullValue($value){ |
|
| 832 | - if(is_null($value)){ |
|
| 831 | + protected function checkForNullValue($value) { |
|
| 832 | + if (is_null($value)) { |
|
| 833 | 833 | return ''; |
| 834 | 834 | } |
| 835 | 835 | return $value; |
@@ -148,7 +148,7 @@ |
||
| 148 | 148 | static $cfg; |
| 149 | 149 | if (empty($cfg)) { |
| 150 | 150 | $cfg[0] = & load_configurations(); |
| 151 | - if(! is_array($cfg[0])){ |
|
| 151 | + if (!is_array($cfg[0])) { |
|
| 152 | 152 | $cfg[0] = array(); |
| 153 | 153 | } |
| 154 | 154 | } |
@@ -343,7 +343,7 @@ |
||
| 343 | 343 | * Get some parameters data need like ip address, hostname, browser info, etc. |
| 344 | 344 | * @return array |
| 345 | 345 | */ |
| 346 | - protected function getSessionDataParams(){ |
|
| 346 | + protected function getSessionDataParams() { |
|
| 347 | 347 | $this->getLoader()->functions('user_agent'); |
| 348 | 348 | $this->getLoader()->library('Browser'); |
| 349 | 349 | |
@@ -364,7 +364,7 @@ |
||
| 364 | 364 | if (stristr($this->_agent, 'FacebookExternalHit')) { |
| 365 | 365 | $this->setRobot(true); |
| 366 | 366 | $this->setFacebook(true); |
| 367 | - } else if (stristr($this->_agent, 'FBIOS')) { |
|
| 367 | + } else if (stristr($this->_agent, 'FBIOS')) { |
|
| 368 | 368 | $this->setFacebook(true); |
| 369 | 369 | } |
| 370 | 370 | } |
@@ -1,5 +1,5 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | - defined('ROOT_PATH') || exit('Access denied'); |
|
| 2 | + defined('ROOT_PATH') || exit('Access denied'); |
|
| 3 | 3 | /** |
| 4 | 4 | * TNH Framework |
| 5 | 5 | * |
@@ -24,68 +24,68 @@ discard block |
||
| 24 | 24 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
| 25 | 25 | */ |
| 26 | 26 | |
| 27 | - class Browser { |
|
| 28 | - |
|
| 29 | - /** |
|
| 30 | - * List of know platforms |
|
| 31 | - * @var array |
|
| 32 | - */ |
|
| 33 | - private $_platforms = array( |
|
| 34 | - '/windows nt 10/i' => 'Windows 10', |
|
| 35 | - '/windows phone 10/i' => 'Windows Phone 10', |
|
| 36 | - '/windows phone 8.1/i' => 'Windows Phone 8.1', |
|
| 37 | - '/windows phone 8/i' => 'Windows Phone 8', |
|
| 38 | - '/windows nt 6.3/i' => 'Windows 8.1', |
|
| 39 | - '/windows nt 6.2/i' => 'Windows 8', |
|
| 40 | - '/windows nt 6.1/i' => 'Windows 7', |
|
| 41 | - '/windows nt 6.0/i' => 'Windows Vista', |
|
| 42 | - '/windows nt 5.2/i' => 'Windows Server 2003/XP x64', |
|
| 43 | - '/windows nt 5.1/i' => 'Windows XP', |
|
| 44 | - '/windows xp/i' => 'Windows XP', |
|
| 45 | - '/windows nt 5.0/i' => 'Windows 2000', |
|
| 46 | - '/windows me/i' => 'Windows ME', |
|
| 47 | - '/win98/i' => 'Windows 98', |
|
| 48 | - '/win95/i' => 'Windows 95', |
|
| 49 | - '/win16/i' => 'Windows 3.11', |
|
| 50 | - '/ipad/i' => 'iPad', |
|
| 27 | + class Browser { |
|
| 28 | + |
|
| 29 | + /** |
|
| 30 | + * List of know platforms |
|
| 31 | + * @var array |
|
| 32 | + */ |
|
| 33 | + private $_platforms = array( |
|
| 34 | + '/windows nt 10/i' => 'Windows 10', |
|
| 35 | + '/windows phone 10/i' => 'Windows Phone 10', |
|
| 36 | + '/windows phone 8.1/i' => 'Windows Phone 8.1', |
|
| 37 | + '/windows phone 8/i' => 'Windows Phone 8', |
|
| 38 | + '/windows nt 6.3/i' => 'Windows 8.1', |
|
| 39 | + '/windows nt 6.2/i' => 'Windows 8', |
|
| 40 | + '/windows nt 6.1/i' => 'Windows 7', |
|
| 41 | + '/windows nt 6.0/i' => 'Windows Vista', |
|
| 42 | + '/windows nt 5.2/i' => 'Windows Server 2003/XP x64', |
|
| 43 | + '/windows nt 5.1/i' => 'Windows XP', |
|
| 44 | + '/windows xp/i' => 'Windows XP', |
|
| 45 | + '/windows nt 5.0/i' => 'Windows 2000', |
|
| 46 | + '/windows me/i' => 'Windows ME', |
|
| 47 | + '/win98/i' => 'Windows 98', |
|
| 48 | + '/win95/i' => 'Windows 95', |
|
| 49 | + '/win16/i' => 'Windows 3.11', |
|
| 50 | + '/ipad/i' => 'iPad', |
|
| 51 | 51 | '/ipod/i' => 'iPod', |
| 52 | 52 | '/iphone/i' => 'iPhone', |
| 53 | 53 | '/macintosh|mac os x/i' => 'Mac OS X', |
| 54 | - '/mac_powerpc/i' => 'Mac OS 9', |
|
| 55 | - '/android/i' => 'Android', |
|
| 56 | - '/ubuntu/i' => 'Ubuntu', |
|
| 57 | - '/linux/i' => 'Linux', |
|
| 58 | - '/blackberry/i' => 'BlackBerry', |
|
| 59 | - '/webos/i' => 'Mobile' |
|
| 60 | - ); |
|
| 61 | - |
|
| 62 | - /** |
|
| 63 | - * List of know browsers |
|
| 64 | - * @var array |
|
| 65 | - */ |
|
| 66 | - private $_browsers = array( |
|
| 67 | - '/mobile/i' => 'Handheld Browser', |
|
| 68 | - '/msie/i' => 'Internet Explorer', |
|
| 69 | - '/firefox/i' => 'Firefox', |
|
| 70 | - '/chrome/i' => 'Chrome', |
|
| 71 | - '/safari/i' => 'Safari', |
|
| 72 | - '/edge/i' => 'Edge', |
|
| 73 | - '/opera/i' => 'Opera', |
|
| 74 | - '/netscape/i' => 'Netscape', |
|
| 75 | - '/maxthon/i' => 'Maxthon', |
|
| 76 | - '/konqueror/i' => 'Konqueror' |
|
| 77 | - ); |
|
| 78 | - |
|
| 79 | - /** |
|
| 80 | - * Agent string |
|
| 81 | - * @var string |
|
| 82 | - */ |
|
| 83 | - private $_agent = ''; |
|
| 84 | - |
|
| 85 | - /** |
|
| 86 | - * Browser name |
|
| 87 | - * @var string |
|
| 88 | - */ |
|
| 54 | + '/mac_powerpc/i' => 'Mac OS 9', |
|
| 55 | + '/android/i' => 'Android', |
|
| 56 | + '/ubuntu/i' => 'Ubuntu', |
|
| 57 | + '/linux/i' => 'Linux', |
|
| 58 | + '/blackberry/i' => 'BlackBerry', |
|
| 59 | + '/webos/i' => 'Mobile' |
|
| 60 | + ); |
|
| 61 | + |
|
| 62 | + /** |
|
| 63 | + * List of know browsers |
|
| 64 | + * @var array |
|
| 65 | + */ |
|
| 66 | + private $_browsers = array( |
|
| 67 | + '/mobile/i' => 'Handheld Browser', |
|
| 68 | + '/msie/i' => 'Internet Explorer', |
|
| 69 | + '/firefox/i' => 'Firefox', |
|
| 70 | + '/chrome/i' => 'Chrome', |
|
| 71 | + '/safari/i' => 'Safari', |
|
| 72 | + '/edge/i' => 'Edge', |
|
| 73 | + '/opera/i' => 'Opera', |
|
| 74 | + '/netscape/i' => 'Netscape', |
|
| 75 | + '/maxthon/i' => 'Maxthon', |
|
| 76 | + '/konqueror/i' => 'Konqueror' |
|
| 77 | + ); |
|
| 78 | + |
|
| 79 | + /** |
|
| 80 | + * Agent string |
|
| 81 | + * @var string |
|
| 82 | + */ |
|
| 83 | + private $_agent = ''; |
|
| 84 | + |
|
| 85 | + /** |
|
| 86 | + * Browser name |
|
| 87 | + * @var string |
|
| 88 | + */ |
|
| 89 | 89 | private $_browser_name = ''; |
| 90 | 90 | |
| 91 | 91 | /** |
@@ -124,7 +124,7 @@ discard block |
||
| 124 | 124 | */ |
| 125 | 125 | private $_is_facebook = false; |
| 126 | 126 | |
| 127 | - /** |
|
| 127 | + /** |
|
| 128 | 128 | * Class constructor |
| 129 | 129 | */ |
| 130 | 130 | public function __construct($userAgent = '') { |
@@ -251,12 +251,12 @@ discard block |
||
| 251 | 251 | return $this->_is_facebook; |
| 252 | 252 | } |
| 253 | 253 | |
| 254 | - /** |
|
| 255 | - * Returns a formatted string with a summary of the details of the browser. |
|
| 256 | - * @codeCoverageIgnore |
|
| 257 | - * |
|
| 258 | - * @return string formatted string with a summary of the browser |
|
| 259 | - */ |
|
| 254 | + /** |
|
| 255 | + * Returns a formatted string with a summary of the details of the browser. |
|
| 256 | + * @codeCoverageIgnore |
|
| 257 | + * |
|
| 258 | + * @return string formatted string with a summary of the browser |
|
| 259 | + */ |
|
| 260 | 260 | public function __toString() { |
| 261 | 261 | return "<strong>Browser Name:</strong> {$this->getBrowser()}<br/>\n" . |
| 262 | 262 | "<strong>Browser Version:</strong> {$this->getVersion()}<br/>\n" . |
@@ -300,69 +300,69 @@ discard block |
||
| 300 | 300 | /** |
| 301 | 301 | * Determine the user's platform |
| 302 | 302 | */ |
| 303 | - protected function checkPlatform() { |
|
| 304 | - foreach ($this->_platforms as $regex => $value) { |
|
| 305 | - if (preg_match($regex, $this->_agent) ) { |
|
| 306 | - $this->setPlatform($value); |
|
| 307 | - break; |
|
| 308 | - } |
|
| 309 | - } |
|
| 310 | - } |
|
| 303 | + protected function checkPlatform() { |
|
| 304 | + foreach ($this->_platforms as $regex => $value) { |
|
| 305 | + if (preg_match($regex, $this->_agent) ) { |
|
| 306 | + $this->setPlatform($value); |
|
| 307 | + break; |
|
| 308 | + } |
|
| 309 | + } |
|
| 310 | + } |
|
| 311 | 311 | |
| 312 | - /** |
|
| 312 | + /** |
|
| 313 | 313 | * Routine to determine the browser type |
| 314 | 314 | */ |
| 315 | - protected function checkBrowser() { |
|
| 316 | - foreach ($this->_browsers as $regex => $value) { |
|
| 317 | - if (preg_match($regex, $this->_agent ) ) { |
|
| 318 | - $this->setBrowser($value); |
|
| 319 | - break; |
|
| 320 | - } |
|
| 321 | - } |
|
| 322 | - } |
|
| 315 | + protected function checkBrowser() { |
|
| 316 | + foreach ($this->_browsers as $regex => $value) { |
|
| 317 | + if (preg_match($regex, $this->_agent ) ) { |
|
| 318 | + $this->setBrowser($value); |
|
| 319 | + break; |
|
| 320 | + } |
|
| 321 | + } |
|
| 322 | + } |
|
| 323 | 323 | |
| 324 | - /** |
|
| 324 | + /** |
|
| 325 | 325 | * Routine to determine the browser version |
| 326 | 326 | */ |
| 327 | - protected function checkBrowserVersion(){ |
|
| 328 | - $detected = $this->getBrowser(); |
|
| 329 | - $d = array_search($detected, $this->_browsers); |
|
| 330 | - $browser = str_replace(array("/i","/"), "", $d); |
|
| 331 | - $regex = "/(?<browser>version|{$browser})[\/]+(?<version>[0-9.|a-zA-Z.]*)/i"; |
|
| 332 | - if (preg_match_all($regex, $this->_agent, $matches)) { |
|
| 333 | - $found = array_search($browser, $matches["browser"]); |
|
| 334 | - $this->setVersion($matches["version"][$found]); |
|
| 335 | - } |
|
| 336 | - } |
|
| 337 | - |
|
| 338 | - /** |
|
| 327 | + protected function checkBrowserVersion(){ |
|
| 328 | + $detected = $this->getBrowser(); |
|
| 329 | + $d = array_search($detected, $this->_browsers); |
|
| 330 | + $browser = str_replace(array("/i","/"), "", $d); |
|
| 331 | + $regex = "/(?<browser>version|{$browser})[\/]+(?<version>[0-9.|a-zA-Z.]*)/i"; |
|
| 332 | + if (preg_match_all($regex, $this->_agent, $matches)) { |
|
| 333 | + $found = array_search($browser, $matches["browser"]); |
|
| 334 | + $this->setVersion($matches["version"][$found]); |
|
| 335 | + } |
|
| 336 | + } |
|
| 337 | + |
|
| 338 | + /** |
|
| 339 | 339 | * Determine if the browser is Mobile or not |
| 340 | 340 | */ |
| 341 | - protected function checkMobile() { |
|
| 342 | - 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) ) { |
|
| 343 | - $this->setMobile(true); |
|
| 344 | - } |
|
| 345 | - } |
|
| 341 | + protected function checkMobile() { |
|
| 342 | + 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) ) { |
|
| 343 | + $this->setMobile(true); |
|
| 344 | + } |
|
| 345 | + } |
|
| 346 | 346 | |
| 347 | - /** |
|
| 347 | + /** |
|
| 348 | 348 | * Determine if the browser is Tablet or not |
| 349 | 349 | */ |
| 350 | - protected function checkTablet() { |
|
| 351 | - if (preg_match('/tablet|ipad/i', $this->_agent) ) { |
|
| 352 | - $this->setTablet(true); |
|
| 353 | - } |
|
| 354 | - } |
|
| 350 | + protected function checkTablet() { |
|
| 351 | + if (preg_match('/tablet|ipad/i', $this->_agent) ) { |
|
| 352 | + $this->setTablet(true); |
|
| 353 | + } |
|
| 354 | + } |
|
| 355 | 355 | |
| 356 | - /** |
|
| 356 | + /** |
|
| 357 | 357 | * Determine if the browser is Robot or not |
| 358 | 358 | */ |
| 359 | - protected function checkBot() { |
|
| 360 | - if (preg_match('/bot/i', $this->_agent) ) { |
|
| 361 | - $this->setRobot(true); |
|
| 362 | - } |
|
| 363 | - } |
|
| 359 | + protected function checkBot() { |
|
| 360 | + if (preg_match('/bot/i', $this->_agent) ) { |
|
| 361 | + $this->setRobot(true); |
|
| 362 | + } |
|
| 363 | + } |
|
| 364 | 364 | |
| 365 | - /** |
|
| 365 | + /** |
|
| 366 | 366 | * Detect if URL is loaded from FacebookExternalHit |
| 367 | 367 | */ |
| 368 | 368 | protected function checkFacebook() { |
@@ -375,10 +375,10 @@ discard block |
||
| 375 | 375 | } |
| 376 | 376 | |
| 377 | 377 | |
| 378 | - /** |
|
| 379 | - * Protected routine to calculate and determine what |
|
| 380 | - * the browser is in use (including platform) |
|
| 381 | - */ |
|
| 378 | + /** |
|
| 379 | + * Protected routine to calculate and determine what |
|
| 380 | + * the browser is in use (including platform) |
|
| 381 | + */ |
|
| 382 | 382 | protected function determine() { |
| 383 | 383 | $this->checkPlatform(); |
| 384 | 384 | $this->checkBrowser(); |
@@ -389,4 +389,4 @@ discard block |
||
| 389 | 389 | $this->checkFacebook(); |
| 390 | 390 | } |
| 391 | 391 | |
| 392 | - } |
|
| 392 | + } |
|
@@ -302,7 +302,7 @@ discard block |
||
| 302 | 302 | */ |
| 303 | 303 | protected function checkPlatform() { |
| 304 | 304 | foreach ($this->_platforms as $regex => $value) { |
| 305 | - if (preg_match($regex, $this->_agent) ) { |
|
| 305 | + if (preg_match($regex, $this->_agent)) { |
|
| 306 | 306 | $this->setPlatform($value); |
| 307 | 307 | break; |
| 308 | 308 | } |
@@ -314,7 +314,7 @@ discard block |
||
| 314 | 314 | */ |
| 315 | 315 | protected function checkBrowser() { |
| 316 | 316 | foreach ($this->_browsers as $regex => $value) { |
| 317 | - if (preg_match($regex, $this->_agent ) ) { |
|
| 317 | + if (preg_match($regex, $this->_agent)) { |
|
| 318 | 318 | $this->setBrowser($value); |
| 319 | 319 | break; |
| 320 | 320 | } |
@@ -324,10 +324,10 @@ discard block |
||
| 324 | 324 | /** |
| 325 | 325 | * Routine to determine the browser version |
| 326 | 326 | */ |
| 327 | - protected function checkBrowserVersion(){ |
|
| 327 | + protected function checkBrowserVersion() { |
|
| 328 | 328 | $detected = $this->getBrowser(); |
| 329 | 329 | $d = array_search($detected, $this->_browsers); |
| 330 | - $browser = str_replace(array("/i","/"), "", $d); |
|
| 330 | + $browser = str_replace(array("/i", "/"), "", $d); |
|
| 331 | 331 | $regex = "/(?<browser>version|{$browser})[\/]+(?<version>[0-9.|a-zA-Z.]*)/i"; |
| 332 | 332 | if (preg_match_all($regex, $this->_agent, $matches)) { |
| 333 | 333 | $found = array_search($browser, $matches["browser"]); |
@@ -339,7 +339,7 @@ discard block |
||
| 339 | 339 | * Determine if the browser is Mobile or not |
| 340 | 340 | */ |
| 341 | 341 | protected function checkMobile() { |
| 342 | - 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) ) { |
|
| 342 | + 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)) { |
|
| 343 | 343 | $this->setMobile(true); |
| 344 | 344 | } |
| 345 | 345 | } |
@@ -348,7 +348,7 @@ discard block |
||
| 348 | 348 | * Determine if the browser is Tablet or not |
| 349 | 349 | */ |
| 350 | 350 | protected function checkTablet() { |
| 351 | - if (preg_match('/tablet|ipad/i', $this->_agent) ) { |
|
| 351 | + if (preg_match('/tablet|ipad/i', $this->_agent)) { |
|
| 352 | 352 | $this->setTablet(true); |
| 353 | 353 | } |
| 354 | 354 | } |
@@ -357,7 +357,7 @@ discard block |
||
| 357 | 357 | * Determine if the browser is Robot or not |
| 358 | 358 | */ |
| 359 | 359 | protected function checkBot() { |
| 360 | - if (preg_match('/bot/i', $this->_agent) ) { |
|
| 360 | + if (preg_match('/bot/i', $this->_agent)) { |
|
| 361 | 361 | $this->setRobot(true); |
| 362 | 362 | } |
| 363 | 363 | } |
@@ -369,7 +369,7 @@ discard block |
||
| 369 | 369 | if (stristr($this->_agent, 'FacebookExternalHit')) { |
| 370 | 370 | $this->setRobot(true); |
| 371 | 371 | $this->setFacebook(true); |
| 372 | - } else if (stristr($this->_agent, 'FBIOS')) { |
|
| 372 | + } else if (stristr($this->_agent, 'FBIOS')) { |
|
| 373 | 373 | $this->setFacebook(true); |
| 374 | 374 | } |
| 375 | 375 | } |
@@ -222,7 +222,7 @@ discard block |
||
| 222 | 222 | if ($result) { |
| 223 | 223 | $this->insertId = $this->pdo->lastInsertId(); |
| 224 | 224 | //if the table doesn't have the auto increment field or sequence, the value of 0 will be returned |
| 225 | - $id = $this->insertId; |
|
| 225 | + $id = $this->insertId; |
|
| 226 | 226 | if (!$id) { |
| 227 | 227 | $id = true; |
| 228 | 228 | } |
@@ -440,9 +440,9 @@ discard block |
||
| 440 | 440 | $this->queryCount++; |
| 441 | 441 | |
| 442 | 442 | $queryResult = $this->queryRunner->setQuery($query) |
| 443 | - ->setReturnType($returnAsList) |
|
| 444 | - ->setReturnAsArray($returnAsArray) |
|
| 445 | - ->execute(); |
|
| 443 | + ->setReturnType($returnAsList) |
|
| 444 | + ->setReturnAsArray($returnAsArray) |
|
| 445 | + ->execute(); |
|
| 446 | 446 | |
| 447 | 447 | if (is_object($queryResult)) { |
| 448 | 448 | $this->result = $queryResult->getResult(); |
@@ -746,22 +746,22 @@ discard block |
||
| 746 | 746 | return $this->loaderInstance; |
| 747 | 747 | } |
| 748 | 748 | |
| 749 | - /** |
|
| 750 | - * Get the return type array or object |
|
| 751 | - * @return string|boolean |
|
| 752 | - */ |
|
| 749 | + /** |
|
| 750 | + * Get the return type array or object |
|
| 751 | + * @return string|boolean |
|
| 752 | + */ |
|
| 753 | 753 | protected function getReturnType(){ |
| 754 | 754 | $type = false; |
| 755 | 755 | if ($this->_temporary_return_type == 'array') { |
| 756 | - $type = 'array'; |
|
| 756 | + $type = 'array'; |
|
| 757 | 757 | } |
| 758 | 758 | return $type; |
| 759 | 759 | } |
| 760 | 760 | |
| 761 | - /** |
|
| 762 | - * Check if soft delete is enable setting the condition |
|
| 763 | - * @return object the current instance |
|
| 764 | - */ |
|
| 761 | + /** |
|
| 762 | + * Check if soft delete is enable setting the condition |
|
| 763 | + * @return object the current instance |
|
| 764 | + */ |
|
| 765 | 765 | protected function checkForSoftDelete(){ |
| 766 | 766 | if ($this->soft_delete && $this->_temporary_with_deleted !== true) { |
| 767 | 767 | $this->getQueryBuilder()->where($this->soft_delete_key, (bool) $this->_temporary_only_deleted); |
@@ -769,14 +769,14 @@ discard block |
||
| 769 | 769 | return $this; |
| 770 | 770 | } |
| 771 | 771 | |
| 772 | - /** |
|
| 773 | - * Relate for "belongs_to" and "has_many" |
|
| 774 | - * @param string $relationship the name of relation |
|
| 775 | - * @param string|array $options the model and primary key values |
|
| 776 | - * @param object|array $row the row to update |
|
| 777 | - * @param string $type the type can be "belongs_to", "has_many" |
|
| 778 | - * @return mixed the final row values |
|
| 779 | - */ |
|
| 772 | + /** |
|
| 773 | + * Relate for "belongs_to" and "has_many" |
|
| 774 | + * @param string $relationship the name of relation |
|
| 775 | + * @param string|array $options the model and primary key values |
|
| 776 | + * @param object|array $row the row to update |
|
| 777 | + * @param string $type the type can be "belongs_to", "has_many" |
|
| 778 | + * @return mixed the final row values |
|
| 779 | + */ |
|
| 780 | 780 | protected function relateBelongsToAndHasMany($relationship, $options, $row, $type){ |
| 781 | 781 | if (in_array($relationship, $this->_with)) { |
| 782 | 782 | $loaderInstance = $this->getLoaderInstanceOrCreate(); |
@@ -151,7 +151,7 @@ discard block |
||
| 151 | 151 | $instance = $db; |
| 152 | 152 | } else { |
| 153 | 153 | $obj = & get_instance(); |
| 154 | - if (isset($obj->database)){ |
|
| 154 | + if (isset($obj->database)) { |
|
| 155 | 155 | /** |
| 156 | 156 | * NOTE: Need use "clone" because some Model need have the personal instance of the database library |
| 157 | 157 | * to prevent duplication |
@@ -730,7 +730,7 @@ discard block |
||
| 730 | 730 | * @return object |
| 731 | 731 | */ |
| 732 | 732 | protected function getLoaderInstanceOrCreate() { |
| 733 | - if (! is_object($this->loaderInstance)) { |
|
| 733 | + if (!is_object($this->loaderInstance)) { |
|
| 734 | 734 | $this->loaderInstance = & get_instance()->loader; |
| 735 | 735 | } |
| 736 | 736 | return $this->loaderInstance; |
@@ -740,7 +740,7 @@ discard block |
||
| 740 | 740 | * Get the return type array or object |
| 741 | 741 | * @return string|boolean |
| 742 | 742 | */ |
| 743 | - protected function getReturnType(){ |
|
| 743 | + protected function getReturnType() { |
|
| 744 | 744 | $type = false; |
| 745 | 745 | if ($this->_temporary_return_type == 'array') { |
| 746 | 746 | $type = 'array'; |
@@ -752,7 +752,7 @@ discard block |
||
| 752 | 752 | * Check if soft delete is enable setting the condition |
| 753 | 753 | * @return object the current instance |
| 754 | 754 | */ |
| 755 | - protected function checkForSoftDelete(){ |
|
| 755 | + protected function checkForSoftDelete() { |
|
| 756 | 756 | if ($this->soft_delete && $this->_temporary_with_deleted !== true) { |
| 757 | 757 | $this->getQueryBuilder()->where($this->soft_delete_key, (bool) $this->_temporary_only_deleted); |
| 758 | 758 | } |
@@ -767,12 +767,12 @@ discard block |
||
| 767 | 767 | * @param string $type the type can be "belongs_to", "has_many" |
| 768 | 768 | * @return mixed the final row values |
| 769 | 769 | */ |
| 770 | - protected function relateBelongsToAndHasMany($relationship, $options, $row, $type){ |
|
| 770 | + protected function relateBelongsToAndHasMany($relationship, $options, $row, $type) { |
|
| 771 | 771 | if (in_array($relationship, $this->_with)) { |
| 772 | 772 | $loaderInstance = $this->getLoaderInstanceOrCreate(); |
| 773 | 773 | $loaderInstance->model($options['model'], $relationship . '_model'); |
| 774 | 774 | |
| 775 | - if($type == 'belongs_to'){ |
|
| 775 | + if ($type == 'belongs_to') { |
|
| 776 | 776 | if (is_object($row)) { |
| 777 | 777 | $row->{$relationship} = $this->{$relationship . '_model'}->get($row->{$options['primary_key']}); |
| 778 | 778 | } else { |
@@ -312,7 +312,7 @@ discard block |
||
| 312 | 312 | * @param string $appLang the application language, only if type = "language" |
| 313 | 313 | * @return string|null the full file path |
| 314 | 314 | */ |
| 315 | - protected static function getDefaultFilePathForFunctionLanguage($file, $type, $appLang = null){ |
|
| 315 | + protected static function getDefaultFilePathForFunctionLanguage($file, $type, $appLang = null) { |
|
| 316 | 316 | $searchDir = null; |
| 317 | 317 | if ($type == 'function') { |
| 318 | 318 | $searchDir = array(FUNCTIONS_PATH, CORE_FUNCTIONS_PATH); |
@@ -338,7 +338,7 @@ discard block |
||
| 338 | 338 | * @param string|null $module the module if is not null will return it |
| 339 | 339 | * @return string|null |
| 340 | 340 | */ |
| 341 | - protected static function getModuleFromSuperController($module){ |
|
| 341 | + protected static function getModuleFromSuperController($module) { |
|
| 342 | 342 | $obj = & get_instance(); |
| 343 | 343 | if (!$module && !empty($obj->moduleName)) { |
| 344 | 344 | $module = $obj->moduleName; |
@@ -315,7 +315,7 @@ |
||
| 315 | 315 | protected static function getDefaultFilePathForFunctionLanguage($file, $type, $appLang = null){ |
| 316 | 316 | $searchDir = null; |
| 317 | 317 | if ($type == 'function') { |
| 318 | - $searchDir = array(FUNCTIONS_PATH, CORE_FUNCTIONS_PATH); |
|
| 318 | + $searchDir = array(FUNCTIONS_PATH, CORE_FUNCTIONS_PATH); |
|
| 319 | 319 | } |
| 320 | 320 | else if ($type == 'language') { |
| 321 | 321 | $searchDir = array(APP_LANG_PATH, CORE_LANG_PATH); |
@@ -316,8 +316,7 @@ |
||
| 316 | 316 | $searchDir = null; |
| 317 | 317 | if ($type == 'function') { |
| 318 | 318 | $searchDir = array(FUNCTIONS_PATH, CORE_FUNCTIONS_PATH); |
| 319 | - } |
|
| 320 | - else if ($type == 'language') { |
|
| 319 | + } else if ($type == 'language') { |
|
| 321 | 320 | $searchDir = array(APP_LANG_PATH, CORE_LANG_PATH); |
| 322 | 321 | $file = $appLang . DS . $file; |
| 323 | 322 | } |
@@ -277,7 +277,7 @@ |
||
| 277 | 277 | * Set the file array data generally in constructor this is already set using $_FILES |
| 278 | 278 | * @param array $fileArray the new value |
| 279 | 279 | */ |
| 280 | - public function setFileArray($fileArray){ |
|
| 280 | + public function setFileArray($fileArray) { |
|
| 281 | 281 | $this->file_array = $fileArray; |
| 282 | 282 | } |
| 283 | 283 | |