@@ -44,7 +44,7 @@ |
||
| 44 | 44 | self::$logger = $logger[0]; |
| 45 | 45 | } |
| 46 | 46 | if ($setLoggerName) { |
| 47 | - self::$logger->setLogger('Class::' . get_called_class()); |
|
| 47 | + self::$logger->setLogger('Class::' . get_called_class()); |
|
| 48 | 48 | } |
| 49 | 49 | return self::$logger; |
| 50 | 50 | } |
@@ -189,11 +189,11 @@ |
||
| 189 | 189 | */ |
| 190 | 190 | define('VAR_PATH', ROOT_PATH . 'var' . DS); |
| 191 | 191 | |
| 192 | - /** |
|
| 193 | - * The path to the directory of your cache files. |
|
| 194 | - * |
|
| 195 | - * This feature is available currently for database and views. |
|
| 196 | - */ |
|
| 192 | + /** |
|
| 193 | + * The path to the directory of your cache files. |
|
| 194 | + * |
|
| 195 | + * This feature is available currently for database and views. |
|
| 196 | + */ |
|
| 197 | 197 | define('CACHE_PATH', VAR_PATH . 'cache' . DS); |
| 198 | 198 | |
| 199 | 199 | /** |
@@ -282,7 +282,7 @@ discard block |
||
| 282 | 282 | } |
| 283 | 283 | $filename = $this->encodeUtf8($this->filterOther((string) $filename)); |
| 284 | 284 | if (empty($data)) { |
| 285 | - $data = $this->getAttachmentData($path); |
|
| 285 | + $data = $this->getAttachmentData($path); |
|
| 286 | 286 | } |
| 287 | 287 | $this->_attachments[] = array( |
| 288 | 288 | 'path' => $path, |
@@ -346,7 +346,7 @@ discard block |
||
| 346 | 346 | $addresses = array(); |
| 347 | 347 | foreach ($pairs as $name => $email) { |
| 348 | 348 | if (is_numeric($name)) { |
| 349 | - $name = null; |
|
| 349 | + $name = null; |
|
| 350 | 350 | } |
| 351 | 351 | $addresses[] = $this->formatHeader($email, $name); |
| 352 | 352 | } |
@@ -25,103 +25,103 @@ |
||
| 25 | 25 | */ |
| 26 | 26 | |
| 27 | 27 | /** |
| 28 | - * This file contains the configuration of resources that you want to load automatically: |
|
| 29 | - * personals or systems libraries, configuration files, models, languages |
|
| 30 | - * personals functions or systems that are used often in your application |
|
| 31 | - * instead of loading them every time you want to use it. |
|
| 32 | - * Note: loading a lot of resources can decrease the performance of your application. |
|
| 33 | - */ |
|
| 28 | + * This file contains the configuration of resources that you want to load automatically: |
|
| 29 | + * personals or systems libraries, configuration files, models, languages |
|
| 30 | + * personals functions or systems that are used often in your application |
|
| 31 | + * instead of loading them every time you want to use it. |
|
| 32 | + * Note: loading a lot of resources can decrease the performance of your application. |
|
| 33 | + */ |
|
| 34 | 34 | |
| 35 | 35 | |
| 36 | - /** |
|
| 37 | - * If you have personals libraries or systems to load automatically, then list them in the following array. |
|
| 38 | - * For example : |
|
| 39 | - * |
|
| 40 | - * $autoload['libraries'] = array('library1', 'library2'); |
|
| 41 | - * |
|
| 42 | - * Using module: |
|
| 43 | - * |
|
| 44 | - * $autoload['libraries'] = array('module1/library1', 'module2/library1'); |
|
| 45 | - * |
|
| 46 | - * Note: Systems libraries have priority over personals libraries, |
|
| 47 | - * ie the loading order is as follows: it looks in the folder of the systems libraries, |
|
| 48 | - * if it is found, it is loaded, if not, it search in the module directories, if it is found, |
|
| 49 | - * it is loaded, if not will search in personals libraries folder, |
|
| 50 | - * before returning an error in case it does not find it. |
|
| 51 | - */ |
|
| 36 | + /** |
|
| 37 | + * If you have personals libraries or systems to load automatically, then list them in the following array. |
|
| 38 | + * For example : |
|
| 39 | + * |
|
| 40 | + * $autoload['libraries'] = array('library1', 'library2'); |
|
| 41 | + * |
|
| 42 | + * Using module: |
|
| 43 | + * |
|
| 44 | + * $autoload['libraries'] = array('module1/library1', 'module2/library1'); |
|
| 45 | + * |
|
| 46 | + * Note: Systems libraries have priority over personals libraries, |
|
| 47 | + * ie the loading order is as follows: it looks in the folder of the systems libraries, |
|
| 48 | + * if it is found, it is loaded, if not, it search in the module directories, if it is found, |
|
| 49 | + * it is loaded, if not will search in personals libraries folder, |
|
| 50 | + * before returning an error in case it does not find it. |
|
| 51 | + */ |
|
| 52 | 52 | $autoload['libraries'] = array(); |
| 53 | 53 | |
| 54 | 54 | /** |
| 55 | - * If you have configuration files to load automatically, then list them in the following array. |
|
| 56 | - * For example : |
|
| 57 | - * |
|
| 58 | - * $autoload['config'] = array('config1', 'config2'); |
|
| 59 | - * |
|
| 60 | - * Using module: |
|
| 61 | - * |
|
| 62 | - * $autoload['config'] = array('module1/config1', 'module2/config2'); |
|
| 63 | - * |
|
| 64 | - * Note 1: the file name must have as prefix "config_" for config file inside CONFIG_PATH folder |
|
| 65 | - * for example "config_name_of_the_file_config.php" and contains as configuration variable the array $config, |
|
| 66 | - * otherwise the system can not find this configuration file. |
|
| 67 | - * For example : |
|
| 68 | - * |
|
| 69 | - * $config['key1'] = value1; |
|
| 70 | - * $config['key2'] = value2; |
|
| 71 | - * |
|
| 72 | - * Note 2: the files to be loaded must be in the folder defined by the constant "CONFIG_PATH" in "index.php". |
|
| 73 | - * or inside the "config" of your application modules |
|
| 74 | - */ |
|
| 55 | + * If you have configuration files to load automatically, then list them in the following array. |
|
| 56 | + * For example : |
|
| 57 | + * |
|
| 58 | + * $autoload['config'] = array('config1', 'config2'); |
|
| 59 | + * |
|
| 60 | + * Using module: |
|
| 61 | + * |
|
| 62 | + * $autoload['config'] = array('module1/config1', 'module2/config2'); |
|
| 63 | + * |
|
| 64 | + * Note 1: the file name must have as prefix "config_" for config file inside CONFIG_PATH folder |
|
| 65 | + * for example "config_name_of_the_file_config.php" and contains as configuration variable the array $config, |
|
| 66 | + * otherwise the system can not find this configuration file. |
|
| 67 | + * For example : |
|
| 68 | + * |
|
| 69 | + * $config['key1'] = value1; |
|
| 70 | + * $config['key2'] = value2; |
|
| 71 | + * |
|
| 72 | + * Note 2: the files to be loaded must be in the folder defined by the constant "CONFIG_PATH" in "index.php". |
|
| 73 | + * or inside the "config" of your application modules |
|
| 74 | + */ |
|
| 75 | 75 | $autoload['config'] = array(); |
| 76 | 76 | |
| 77 | 77 | /** |
| 78 | - * If you have models to load automatically, then list them in the following array. |
|
| 79 | - * For example : |
|
| 80 | - * |
|
| 81 | - * $autoload['models'] = array('model1', 'model2'); |
|
| 82 | - * |
|
| 83 | - * Using module: |
|
| 84 | - * |
|
| 85 | - * $autoload['models'] = array('module1/model1', 'module2/model2'); |
|
| 86 | - */ |
|
| 78 | + * If you have models to load automatically, then list them in the following array. |
|
| 79 | + * For example : |
|
| 80 | + * |
|
| 81 | + * $autoload['models'] = array('model1', 'model2'); |
|
| 82 | + * |
|
| 83 | + * Using module: |
|
| 84 | + * |
|
| 85 | + * $autoload['models'] = array('module1/model1', 'module2/model2'); |
|
| 86 | + */ |
|
| 87 | 87 | $autoload['models'] = array(); |
| 88 | 88 | |
| 89 | 89 | /** |
| 90 | - * If you have systems or personals functions to load automatically, specify them in the following array. |
|
| 91 | - * For example : |
|
| 92 | - * |
|
| 93 | - * $autoload['functions'] = array('function1', 'function2'); |
|
| 94 | - * |
|
| 95 | - * Using module: |
|
| 96 | - * |
|
| 97 | - * $autoload['functions'] = array('module1/function1', 'module2/function2'); |
|
| 98 | - * |
|
| 99 | - * Note 1: Personal functions have priority over system functions, |
|
| 100 | - * that is to say that the order of loading is the following : it looks in the directory of the modules functions, |
|
| 101 | - * if it is found, it is loaded, otherwise, it looks in the directory of the personal functions, |
|
| 102 | - * if it is found, it is loaded, otherwise, it looks in the directory of the system functions, |
|
| 103 | - * before returning an error in case he does not find it. |
|
| 104 | - * |
|
| 105 | - * Note 2: the file name must have as prefix "function_" for example "function_foo.php" then |
|
| 106 | - * will use: |
|
| 107 | - * |
|
| 108 | - * $autoload['functions'] = array('foo'); |
|
| 109 | - */ |
|
| 90 | + * If you have systems or personals functions to load automatically, specify them in the following array. |
|
| 91 | + * For example : |
|
| 92 | + * |
|
| 93 | + * $autoload['functions'] = array('function1', 'function2'); |
|
| 94 | + * |
|
| 95 | + * Using module: |
|
| 96 | + * |
|
| 97 | + * $autoload['functions'] = array('module1/function1', 'module2/function2'); |
|
| 98 | + * |
|
| 99 | + * Note 1: Personal functions have priority over system functions, |
|
| 100 | + * that is to say that the order of loading is the following : it looks in the directory of the modules functions, |
|
| 101 | + * if it is found, it is loaded, otherwise, it looks in the directory of the personal functions, |
|
| 102 | + * if it is found, it is loaded, otherwise, it looks in the directory of the system functions, |
|
| 103 | + * before returning an error in case he does not find it. |
|
| 104 | + * |
|
| 105 | + * Note 2: the file name must have as prefix "function_" for example "function_foo.php" then |
|
| 106 | + * will use: |
|
| 107 | + * |
|
| 108 | + * $autoload['functions'] = array('foo'); |
|
| 109 | + */ |
|
| 110 | 110 | $autoload['functions'] = array(); |
| 111 | 111 | |
| 112 | 112 | /** |
| 113 | - * If you have systems or personals languages to load automatically, specify them in the following array. |
|
| 114 | - * For example : |
|
| 115 | - * |
|
| 116 | - * $autoload['languages'] = array('lang1', 'lang2'); |
|
| 117 | - * |
|
| 118 | - * Using module: |
|
| 119 | - * |
|
| 120 | - * $autoload['languages'] = array('module1/lang1', 'module2/lang2'); |
|
| 121 | - * |
|
| 122 | - * Note: the file name must have as prefix "lang_" for example "lang_foo.php" then |
|
| 123 | - * will use: |
|
| 124 | - * |
|
| 125 | - * $autoload['languages'] = array('foo'); |
|
| 126 | - */ |
|
| 113 | + * If you have systems or personals languages to load automatically, specify them in the following array. |
|
| 114 | + * For example : |
|
| 115 | + * |
|
| 116 | + * $autoload['languages'] = array('lang1', 'lang2'); |
|
| 117 | + * |
|
| 118 | + * Using module: |
|
| 119 | + * |
|
| 120 | + * $autoload['languages'] = array('module1/lang1', 'module2/lang2'); |
|
| 121 | + * |
|
| 122 | + * Note: the file name must have as prefix "lang_" for example "lang_foo.php" then |
|
| 123 | + * will use: |
|
| 124 | + * |
|
| 125 | + * $autoload['languages'] = array('foo'); |
|
| 126 | + */ |
|
| 127 | 127 | $autoload['languages'] = array(); |
@@ -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 | } |
@@ -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 .= '>'; |
@@ -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 |
@@ -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 | * |
@@ -28,68 +28,68 @@ discard block |
||
| 28 | 28 | * SOFTWARE. |
| 29 | 29 | */ |
| 30 | 30 | |
| 31 | - class Browser { |
|
| 32 | - |
|
| 33 | - /** |
|
| 34 | - * List of know platforms |
|
| 35 | - * @var array |
|
| 36 | - */ |
|
| 37 | - private $_platforms = array( |
|
| 38 | - '/windows nt 10/i' => 'Windows 10', |
|
| 39 | - '/windows phone 10/i' => 'Windows Phone 10', |
|
| 40 | - '/windows phone 8.1/i' => 'Windows Phone 8.1', |
|
| 41 | - '/windows phone 8/i' => 'Windows Phone 8', |
|
| 42 | - '/windows nt 6.3/i' => 'Windows 8.1', |
|
| 43 | - '/windows nt 6.2/i' => 'Windows 8', |
|
| 44 | - '/windows nt 6.1/i' => 'Windows 7', |
|
| 45 | - '/windows nt 6.0/i' => 'Windows Vista', |
|
| 46 | - '/windows nt 5.2/i' => 'Windows Server 2003/XP x64', |
|
| 47 | - '/windows nt 5.1/i' => 'Windows XP', |
|
| 48 | - '/windows xp/i' => 'Windows XP', |
|
| 49 | - '/windows nt 5.0/i' => 'Windows 2000', |
|
| 50 | - '/windows me/i' => 'Windows ME', |
|
| 51 | - '/win98/i' => 'Windows 98', |
|
| 52 | - '/win95/i' => 'Windows 95', |
|
| 53 | - '/win16/i' => 'Windows 3.11', |
|
| 54 | - '/ipad/i' => 'iPad', |
|
| 31 | + class Browser { |
|
| 32 | + |
|
| 33 | + /** |
|
| 34 | + * List of know platforms |
|
| 35 | + * @var array |
|
| 36 | + */ |
|
| 37 | + private $_platforms = array( |
|
| 38 | + '/windows nt 10/i' => 'Windows 10', |
|
| 39 | + '/windows phone 10/i' => 'Windows Phone 10', |
|
| 40 | + '/windows phone 8.1/i' => 'Windows Phone 8.1', |
|
| 41 | + '/windows phone 8/i' => 'Windows Phone 8', |
|
| 42 | + '/windows nt 6.3/i' => 'Windows 8.1', |
|
| 43 | + '/windows nt 6.2/i' => 'Windows 8', |
|
| 44 | + '/windows nt 6.1/i' => 'Windows 7', |
|
| 45 | + '/windows nt 6.0/i' => 'Windows Vista', |
|
| 46 | + '/windows nt 5.2/i' => 'Windows Server 2003/XP x64', |
|
| 47 | + '/windows nt 5.1/i' => 'Windows XP', |
|
| 48 | + '/windows xp/i' => 'Windows XP', |
|
| 49 | + '/windows nt 5.0/i' => 'Windows 2000', |
|
| 50 | + '/windows me/i' => 'Windows ME', |
|
| 51 | + '/win98/i' => 'Windows 98', |
|
| 52 | + '/win95/i' => 'Windows 95', |
|
| 53 | + '/win16/i' => 'Windows 3.11', |
|
| 54 | + '/ipad/i' => 'iPad', |
|
| 55 | 55 | '/ipod/i' => 'iPod', |
| 56 | 56 | '/iphone/i' => 'iPhone', |
| 57 | 57 | '/macintosh|mac os x/i' => 'Mac OS X', |
| 58 | - '/mac_powerpc/i' => 'Mac OS 9', |
|
| 59 | - '/android/i' => 'Android', |
|
| 60 | - '/ubuntu/i' => 'Ubuntu', |
|
| 61 | - '/linux/i' => 'Linux', |
|
| 62 | - '/blackberry/i' => 'BlackBerry', |
|
| 63 | - '/webos/i' => 'Mobile' |
|
| 64 | - ); |
|
| 65 | - |
|
| 66 | - /** |
|
| 67 | - * List of know browsers |
|
| 68 | - * @var array |
|
| 69 | - */ |
|
| 70 | - private $_browsers = array( |
|
| 71 | - '/mobile/i' => 'Handheld Browser', |
|
| 72 | - '/msie/i' => 'Internet Explorer', |
|
| 73 | - '/firefox/i' => 'Firefox', |
|
| 74 | - '/chrome/i' => 'Chrome', |
|
| 75 | - '/safari/i' => 'Safari', |
|
| 76 | - '/edge/i' => 'Edge', |
|
| 77 | - '/opera/i' => 'Opera', |
|
| 78 | - '/netscape/i' => 'Netscape', |
|
| 79 | - '/maxthon/i' => 'Maxthon', |
|
| 80 | - '/konqueror/i' => 'Konqueror' |
|
| 81 | - ); |
|
| 82 | - |
|
| 83 | - /** |
|
| 84 | - * Agent string |
|
| 85 | - * @var string |
|
| 86 | - */ |
|
| 87 | - private $_agent = ''; |
|
| 88 | - |
|
| 89 | - /** |
|
| 90 | - * Browser name |
|
| 91 | - * @var string |
|
| 92 | - */ |
|
| 58 | + '/mac_powerpc/i' => 'Mac OS 9', |
|
| 59 | + '/android/i' => 'Android', |
|
| 60 | + '/ubuntu/i' => 'Ubuntu', |
|
| 61 | + '/linux/i' => 'Linux', |
|
| 62 | + '/blackberry/i' => 'BlackBerry', |
|
| 63 | + '/webos/i' => 'Mobile' |
|
| 64 | + ); |
|
| 65 | + |
|
| 66 | + /** |
|
| 67 | + * List of know browsers |
|
| 68 | + * @var array |
|
| 69 | + */ |
|
| 70 | + private $_browsers = array( |
|
| 71 | + '/mobile/i' => 'Handheld Browser', |
|
| 72 | + '/msie/i' => 'Internet Explorer', |
|
| 73 | + '/firefox/i' => 'Firefox', |
|
| 74 | + '/chrome/i' => 'Chrome', |
|
| 75 | + '/safari/i' => 'Safari', |
|
| 76 | + '/edge/i' => 'Edge', |
|
| 77 | + '/opera/i' => 'Opera', |
|
| 78 | + '/netscape/i' => 'Netscape', |
|
| 79 | + '/maxthon/i' => 'Maxthon', |
|
| 80 | + '/konqueror/i' => 'Konqueror' |
|
| 81 | + ); |
|
| 82 | + |
|
| 83 | + /** |
|
| 84 | + * Agent string |
|
| 85 | + * @var string |
|
| 86 | + */ |
|
| 87 | + private $_agent = ''; |
|
| 88 | + |
|
| 89 | + /** |
|
| 90 | + * Browser name |
|
| 91 | + * @var string |
|
| 92 | + */ |
|
| 93 | 93 | private $_browser_name = ''; |
| 94 | 94 | |
| 95 | 95 | /** |
@@ -128,7 +128,7 @@ discard block |
||
| 128 | 128 | */ |
| 129 | 129 | private $_is_facebook = false; |
| 130 | 130 | |
| 131 | - /** |
|
| 131 | + /** |
|
| 132 | 132 | * Class constructor |
| 133 | 133 | */ |
| 134 | 134 | public function __construct($userAgent = '') { |
@@ -255,12 +255,12 @@ discard block |
||
| 255 | 255 | return $this->_is_facebook; |
| 256 | 256 | } |
| 257 | 257 | |
| 258 | - /** |
|
| 259 | - * Returns a formatted string with a summary of the details of the browser. |
|
| 260 | - * @codeCoverageIgnore |
|
| 261 | - * |
|
| 262 | - * @return string formatted string with a summary of the browser |
|
| 263 | - */ |
|
| 258 | + /** |
|
| 259 | + * Returns a formatted string with a summary of the details of the browser. |
|
| 260 | + * @codeCoverageIgnore |
|
| 261 | + * |
|
| 262 | + * @return string formatted string with a summary of the browser |
|
| 263 | + */ |
|
| 264 | 264 | public function __toString() { |
| 265 | 265 | return "<strong>Browser Name:</strong> {$this->getBrowser()}<br/>\n" . |
| 266 | 266 | "<strong>Browser Version:</strong> {$this->getVersion()}<br/>\n" . |
@@ -304,69 +304,69 @@ discard block |
||
| 304 | 304 | /** |
| 305 | 305 | * Determine the user's platform |
| 306 | 306 | */ |
| 307 | - protected function checkPlatform() { |
|
| 308 | - foreach ($this->_platforms as $regex => $value) { |
|
| 309 | - if (preg_match($regex, $this->_agent) ) { |
|
| 310 | - $this->setPlatform($value); |
|
| 311 | - break; |
|
| 312 | - } |
|
| 313 | - } |
|
| 314 | - } |
|
| 307 | + protected function checkPlatform() { |
|
| 308 | + foreach ($this->_platforms as $regex => $value) { |
|
| 309 | + if (preg_match($regex, $this->_agent) ) { |
|
| 310 | + $this->setPlatform($value); |
|
| 311 | + break; |
|
| 312 | + } |
|
| 313 | + } |
|
| 314 | + } |
|
| 315 | 315 | |
| 316 | - /** |
|
| 316 | + /** |
|
| 317 | 317 | * Routine to determine the browser type |
| 318 | 318 | */ |
| 319 | - protected function checkBrowser() { |
|
| 320 | - foreach ($this->_browsers as $regex => $value) { |
|
| 321 | - if (preg_match($regex, $this->_agent ) ) { |
|
| 322 | - $this->setBrowser($value); |
|
| 323 | - break; |
|
| 324 | - } |
|
| 325 | - } |
|
| 326 | - } |
|
| 319 | + protected function checkBrowser() { |
|
| 320 | + foreach ($this->_browsers as $regex => $value) { |
|
| 321 | + if (preg_match($regex, $this->_agent ) ) { |
|
| 322 | + $this->setBrowser($value); |
|
| 323 | + break; |
|
| 324 | + } |
|
| 325 | + } |
|
| 326 | + } |
|
| 327 | 327 | |
| 328 | - /** |
|
| 328 | + /** |
|
| 329 | 329 | * Routine to determine the browser version |
| 330 | 330 | */ |
| 331 | - protected function checkBrowserVersion(){ |
|
| 332 | - $detected = $this->getBrowser(); |
|
| 333 | - $d = array_search($detected, $this->_browsers); |
|
| 334 | - $browser = str_replace(array("/i","/"), "", $d); |
|
| 335 | - $regex = "/(?<browser>version|{$browser})[\/]+(?<version>[0-9.|a-zA-Z.]*)/i"; |
|
| 336 | - if (preg_match_all($regex, $this->_agent, $matches)) { |
|
| 337 | - $found = array_search($browser, $matches["browser"]); |
|
| 338 | - $this->setVersion($matches["version"][$found]); |
|
| 339 | - } |
|
| 340 | - } |
|
| 341 | - |
|
| 342 | - /** |
|
| 331 | + protected function checkBrowserVersion(){ |
|
| 332 | + $detected = $this->getBrowser(); |
|
| 333 | + $d = array_search($detected, $this->_browsers); |
|
| 334 | + $browser = str_replace(array("/i","/"), "", $d); |
|
| 335 | + $regex = "/(?<browser>version|{$browser})[\/]+(?<version>[0-9.|a-zA-Z.]*)/i"; |
|
| 336 | + if (preg_match_all($regex, $this->_agent, $matches)) { |
|
| 337 | + $found = array_search($browser, $matches["browser"]); |
|
| 338 | + $this->setVersion($matches["version"][$found]); |
|
| 339 | + } |
|
| 340 | + } |
|
| 341 | + |
|
| 342 | + /** |
|
| 343 | 343 | * Determine if the browser is Mobile or not |
| 344 | 344 | */ |
| 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) ) { |
|
| 347 | - $this->setMobile(true); |
|
| 348 | - } |
|
| 349 | - } |
|
| 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) ) { |
|
| 347 | + $this->setMobile(true); |
|
| 348 | + } |
|
| 349 | + } |
|
| 350 | 350 | |
| 351 | - /** |
|
| 351 | + /** |
|
| 352 | 352 | * Determine if the browser is Tablet or not |
| 353 | 353 | */ |
| 354 | - protected function checkTablet() { |
|
| 355 | - if (preg_match('/tablet|ipad/i', $this->_agent) ) { |
|
| 356 | - $this->setTablet(true); |
|
| 357 | - } |
|
| 358 | - } |
|
| 354 | + protected function checkTablet() { |
|
| 355 | + if (preg_match('/tablet|ipad/i', $this->_agent) ) { |
|
| 356 | + $this->setTablet(true); |
|
| 357 | + } |
|
| 358 | + } |
|
| 359 | 359 | |
| 360 | - /** |
|
| 360 | + /** |
|
| 361 | 361 | * Determine if the browser is Robot or not |
| 362 | 362 | */ |
| 363 | - protected function checkBot() { |
|
| 364 | - if (preg_match('/bot/i', $this->_agent) ) { |
|
| 365 | - $this->setRobot(true); |
|
| 366 | - } |
|
| 367 | - } |
|
| 363 | + protected function checkBot() { |
|
| 364 | + if (preg_match('/bot/i', $this->_agent) ) { |
|
| 365 | + $this->setRobot(true); |
|
| 366 | + } |
|
| 367 | + } |
|
| 368 | 368 | |
| 369 | - /** |
|
| 369 | + /** |
|
| 370 | 370 | * Detect if URL is loaded from FacebookExternalHit |
| 371 | 371 | */ |
| 372 | 372 | protected function checkFacebook() { |
@@ -379,10 +379,10 @@ discard block |
||
| 379 | 379 | } |
| 380 | 380 | |
| 381 | 381 | |
| 382 | - /** |
|
| 383 | - * Protected routine to calculate and determine what |
|
| 384 | - * the browser is in use (including platform) |
|
| 385 | - */ |
|
| 382 | + /** |
|
| 383 | + * Protected routine to calculate and determine what |
|
| 384 | + * the browser is in use (including platform) |
|
| 385 | + */ |
|
| 386 | 386 | protected function determine() { |
| 387 | 387 | $this->checkPlatform(); |
| 388 | 388 | $this->checkBrowser(); |
@@ -393,4 +393,4 @@ discard block |
||
| 393 | 393 | $this->checkFacebook(); |
| 394 | 394 | } |
| 395 | 395 | |
| 396 | - } |
|
| 396 | + } |
|
@@ -29,8 +29,8 @@ |
||
| 29 | 29 | */ |
| 30 | 30 | |
| 31 | 31 | /** |
| 32 | - * DB session handler model class |
|
| 33 | - */ |
|
| 32 | + * DB session handler model class |
|
| 33 | + */ |
|
| 34 | 34 | abstract class DBSessionHandlerModel extends Model { |
| 35 | 35 | |
| 36 | 36 | /** |