@@ -1669,34 +1669,34 @@ |
||
| 1669 | 1669 | protected function checkPlatform() |
| 1670 | 1670 | { |
| 1671 | 1671 | $platformMaps = array( |
| 1672 | - 'windows' => self::PLATFORM_WINDOWS, |
|
| 1673 | - 'iPad' => self::PLATFORM_IPAD, |
|
| 1674 | - 'iPod' => self::PLATFORM_IPOD, |
|
| 1675 | - 'iPhone' => self::PLATFORM_IPHONE, |
|
| 1676 | - 'mac' => self::PLATFORM_APPLE, |
|
| 1677 | - 'android' => self::PLATFORM_ANDROID, |
|
| 1678 | - 'Silk' => self::PLATFORM_FIRE_OS, |
|
| 1679 | - 'linux_smarttv' => self::PLATFORM_LINUX .'/'.self::PLATFORM_SMART_TV, |
|
| 1680 | - 'linux' => self::PLATFORM_LINUX, |
|
| 1681 | - 'Nokia' => self::PLATFORM_NOKIA, |
|
| 1682 | - 'BlackBerry' => self::PLATFORM_BLACKBERRY, |
|
| 1683 | - 'FreeBSD' => self::PLATFORM_FREEBSD, |
|
| 1684 | - 'OpenBSD' => self::PLATFORM_OPENBSD, |
|
| 1685 | - 'NetBSD' => self::PLATFORM_NETBSD, |
|
| 1686 | - 'OpenSolaris' => self::PLATFORM_OPENSOLARIS, |
|
| 1687 | - 'SunOS' => self::PLATFORM_SUNOS, |
|
| 1688 | - 'OS\/2' => self::PLATFORM_OS2, |
|
| 1689 | - 'BeOS' => self::PLATFORM_BEOS, |
|
| 1690 | - 'win' => self::PLATFORM_WINDOWS, |
|
| 1691 | - 'Playstation' => self::PLATFORM_PLAYSTATION, |
|
| 1692 | - 'Roku' => self::PLATFORM_ROKU, |
|
| 1693 | - 'iOS' => self::PLATFORM_IPHONE . '/' . self::PLATFORM_IPAD, |
|
| 1694 | - 'tvOS' => self::PLATFORM_APPLE_TV, |
|
| 1695 | - 'curl' => self::PLATFORM_TERMINAL, |
|
| 1696 | - 'CrOS' => self::PLATFORM_CHROME_OS, |
|
| 1697 | - 'okhttp' => self::PLATFORM_JAVA_ANDROID, |
|
| 1698 | - 'PostmanRuntime' => self::PLATFORM_POSTMAN, |
|
| 1699 | - 'Iframely' => self::PLATFORM_I_FRAME |
|
| 1672 | + 'windows' => self::PLATFORM_WINDOWS, |
|
| 1673 | + 'iPad' => self::PLATFORM_IPAD, |
|
| 1674 | + 'iPod' => self::PLATFORM_IPOD, |
|
| 1675 | + 'iPhone' => self::PLATFORM_IPHONE, |
|
| 1676 | + 'mac' => self::PLATFORM_APPLE, |
|
| 1677 | + 'android' => self::PLATFORM_ANDROID, |
|
| 1678 | + 'Silk' => self::PLATFORM_FIRE_OS, |
|
| 1679 | + 'linux_smarttv' => self::PLATFORM_LINUX .'/'.self::PLATFORM_SMART_TV, |
|
| 1680 | + 'linux' => self::PLATFORM_LINUX, |
|
| 1681 | + 'Nokia' => self::PLATFORM_NOKIA, |
|
| 1682 | + 'BlackBerry' => self::PLATFORM_BLACKBERRY, |
|
| 1683 | + 'FreeBSD' => self::PLATFORM_FREEBSD, |
|
| 1684 | + 'OpenBSD' => self::PLATFORM_OPENBSD, |
|
| 1685 | + 'NetBSD' => self::PLATFORM_NETBSD, |
|
| 1686 | + 'OpenSolaris' => self::PLATFORM_OPENSOLARIS, |
|
| 1687 | + 'SunOS' => self::PLATFORM_SUNOS, |
|
| 1688 | + 'OS\/2' => self::PLATFORM_OS2, |
|
| 1689 | + 'BeOS' => self::PLATFORM_BEOS, |
|
| 1690 | + 'win' => self::PLATFORM_WINDOWS, |
|
| 1691 | + 'Playstation' => self::PLATFORM_PLAYSTATION, |
|
| 1692 | + 'Roku' => self::PLATFORM_ROKU, |
|
| 1693 | + 'iOS' => self::PLATFORM_IPHONE . '/' . self::PLATFORM_IPAD, |
|
| 1694 | + 'tvOS' => self::PLATFORM_APPLE_TV, |
|
| 1695 | + 'curl' => self::PLATFORM_TERMINAL, |
|
| 1696 | + 'CrOS' => self::PLATFORM_CHROME_OS, |
|
| 1697 | + 'okhttp' => self::PLATFORM_JAVA_ANDROID, |
|
| 1698 | + 'PostmanRuntime' => self::PLATFORM_POSTMAN, |
|
| 1699 | + 'Iframely' => self::PLATFORM_I_FRAME |
|
| 1700 | 1700 | ); |
| 1701 | 1701 | |
| 1702 | 1702 | foreach ($platformMaps as $name => $value) { |
@@ -916,27 +916,27 @@ discard block |
||
| 916 | 916 | if (isset($aresult[1])) { |
| 917 | 917 | $this->setBrowser(self::BROWSER_IE); |
| 918 | 918 | $this->setVersion(str_replace(array('(', ')', ';'), '', $aresult[1])); |
| 919 | - if(preg_match('#trident/([0-9\.]+);#i', $this->_agent, $aresult)){ |
|
| 920 | - if($aresult[1] == '3.1'){ |
|
| 919 | + if (preg_match('#trident/([0-9\.]+);#i', $this->_agent, $aresult)) { |
|
| 920 | + if ($aresult[1] == '3.1') { |
|
| 921 | 921 | $this->setVersion('7.0'); |
| 922 | 922 | } |
| 923 | - else if($aresult[1] == '4.0'){ |
|
| 923 | + else if ($aresult[1] == '4.0') { |
|
| 924 | 924 | $this->setVersion('8.0'); |
| 925 | 925 | } |
| 926 | - else if($aresult[1] == '5.0'){ |
|
| 926 | + else if ($aresult[1] == '5.0') { |
|
| 927 | 927 | $this->setVersion('9.0'); |
| 928 | 928 | } |
| 929 | - else if($aresult[1] == '6.0'){ |
|
| 929 | + else if ($aresult[1] == '6.0') { |
|
| 930 | 930 | $this->setVersion('10.0'); |
| 931 | 931 | } |
| 932 | - else if($aresult[1] == '7.0'){ |
|
| 932 | + else if ($aresult[1] == '7.0') { |
|
| 933 | 933 | $this->setVersion('11.0'); |
| 934 | 934 | } |
| 935 | - else if($aresult[1] == '8.0'){ |
|
| 935 | + else if ($aresult[1] == '8.0') { |
|
| 936 | 936 | $this->setVersion('11.0'); |
| 937 | 937 | } |
| 938 | 938 | } |
| 939 | - if(stripos($this->_agent, 'IEMobile') !== false) { |
|
| 939 | + if (stripos($this->_agent, 'IEMobile') !== false) { |
|
| 940 | 940 | $this->setBrowser(self::BROWSER_POCKET_IE); |
| 941 | 941 | $this->setMobile(true); |
| 942 | 942 | } |
@@ -1676,7 +1676,7 @@ discard block |
||
| 1676 | 1676 | 'mac' => self::PLATFORM_APPLE, |
| 1677 | 1677 | 'android' => self::PLATFORM_ANDROID, |
| 1678 | 1678 | 'Silk' => self::PLATFORM_FIRE_OS, |
| 1679 | - 'linux_smarttv' => self::PLATFORM_LINUX .'/'.self::PLATFORM_SMART_TV, |
|
| 1679 | + 'linux_smarttv' => self::PLATFORM_LINUX . '/' . self::PLATFORM_SMART_TV, |
|
| 1680 | 1680 | 'linux' => self::PLATFORM_LINUX, |
| 1681 | 1681 | 'Nokia' => self::PLATFORM_NOKIA, |
| 1682 | 1682 | 'BlackBerry' => self::PLATFORM_BLACKBERRY, |
@@ -1700,9 +1700,9 @@ discard block |
||
| 1700 | 1700 | ); |
| 1701 | 1701 | |
| 1702 | 1702 | foreach ($platformMaps as $name => $value) { |
| 1703 | - if($name == 'linux_smarttv' |
|
| 1703 | + if ($name == 'linux_smarttv' |
|
| 1704 | 1704 | && stripos($this->_agent, 'linux') !== false |
| 1705 | - && stripos($this->_agent, 'SMART-TV') !== false ){ |
|
| 1705 | + && stripos($this->_agent, 'SMART-TV') !== false) { |
|
| 1706 | 1706 | $this->_platform = $value; |
| 1707 | 1707 | break; |
| 1708 | 1708 | } elseif (stripos($this->_agent, $name) !== false) { |
@@ -1,71 +1,71 @@ |
||
| 1 | 1 | <?php |
| 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 GNU GPL License (GPL) |
|
| 9 | - * |
|
| 10 | - * Copyright (C) 2017 Tony NGUEREZA |
|
| 11 | - * |
|
| 12 | - * This program is free software; you can redistribute it and/or |
|
| 13 | - * modify it under the terms of the GNU General Public License |
|
| 14 | - * as published by the Free Software Foundation; either version 3 |
|
| 15 | - * of the License, or (at your option) any later version. |
|
| 16 | - * |
|
| 17 | - * This program is distributed in the hope that it will be useful, |
|
| 18 | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
| 19 | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
| 20 | - * GNU General Public License for more details. |
|
| 21 | - * |
|
| 22 | - * You should have received a copy of the GNU General Public License |
|
| 23 | - * along with this program; if not, write to the Free Software |
|
| 24 | - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
|
| 25 | - */ |
|
| 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 GNU GPL License (GPL) |
|
| 9 | + * |
|
| 10 | + * Copyright (C) 2017 Tony NGUEREZA |
|
| 11 | + * |
|
| 12 | + * This program is free software; you can redistribute it and/or |
|
| 13 | + * modify it under the terms of the GNU General Public License |
|
| 14 | + * as published by the Free Software Foundation; either version 3 |
|
| 15 | + * of the License, or (at your option) any later version. |
|
| 16 | + * |
|
| 17 | + * This program is distributed in the hope that it will be useful, |
|
| 18 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
| 19 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
| 20 | + * GNU General Public License for more details. |
|
| 21 | + * |
|
| 22 | + * You should have received a copy of the GNU General Public License |
|
| 23 | + * along with this program; if not, write to the Free Software |
|
| 24 | + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
|
| 25 | + */ |
|
| 26 | 26 | |
| 27 | - /** |
|
| 28 | - * @file function_string.php |
|
| 29 | - * |
|
| 30 | - * This file contains the definition of the functions relating to the processing of strings characters. |
|
| 31 | - * |
|
| 32 | - * @package core |
|
| 33 | - * @author Tony NGUEREZA |
|
| 34 | - * @copyright Copyright (c) 2017 |
|
| 35 | - * @license https://opensource.org/licenses/gpl-3.0.html GNU GPL License (GPL) |
|
| 36 | - * @link http://www.iacademy.cf |
|
| 37 | - * @version 1.0.0 |
|
| 38 | - * @since 1.0.0 |
|
| 39 | - * @filesource |
|
| 40 | - */ |
|
| 27 | + /** |
|
| 28 | + * @file function_string.php |
|
| 29 | + * |
|
| 30 | + * This file contains the definition of the functions relating to the processing of strings characters. |
|
| 31 | + * |
|
| 32 | + * @package core |
|
| 33 | + * @author Tony NGUEREZA |
|
| 34 | + * @copyright Copyright (c) 2017 |
|
| 35 | + * @license https://opensource.org/licenses/gpl-3.0.html GNU GPL License (GPL) |
|
| 36 | + * @link http://www.iacademy.cf |
|
| 37 | + * @version 1.0.0 |
|
| 38 | + * @since 1.0.0 |
|
| 39 | + * @filesource |
|
| 40 | + */ |
|
| 41 | 41 | |
| 42 | - if(! function_exists('get_random_string')){ |
|
| 43 | - /** |
|
| 44 | - * Generate a random string |
|
| 45 | - * @param string $type the type of generation. It can take the values: "alpha" for alphabetic characters, |
|
| 46 | - * "alnum" for alpha-numeric characters and "num" for numbers. |
|
| 47 | - * By default it is "alnum". |
|
| 48 | - * @param integer $length the length of the string to generate. By default it is 10. |
|
| 49 | - * @param boolean $lower if we return the generated string in lowercase (true). By default it's false. |
|
| 50 | - * @return string the generated string. |
|
| 51 | - */ |
|
| 52 | - function get_random_string($type = 'alnum', $length = 10, $lower = false){ |
|
| 53 | - $chars = array( |
|
| 54 | - 'alpha' => 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ', |
|
| 55 | - 'alnum' => 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890', |
|
| 56 | - 'num' => '1234567890' |
|
| 57 | - ); |
|
| 58 | - $str = null; |
|
| 59 | - if(isset($chars[$type])){ |
|
| 60 | - $str = $chars[$type]; |
|
| 61 | - } |
|
| 62 | - $random = null; |
|
| 63 | - for($i = 0; $i < $length; $i++){ |
|
| 64 | - $random .= $str[mt_rand() % strlen($str)]; |
|
| 65 | - } |
|
| 66 | - if($lower){ |
|
| 67 | - $random = strtolower($random); |
|
| 68 | - } |
|
| 69 | - return $random; |
|
| 70 | - } |
|
| 71 | - } |
|
| 42 | + if(! function_exists('get_random_string')){ |
|
| 43 | + /** |
|
| 44 | + * Generate a random string |
|
| 45 | + * @param string $type the type of generation. It can take the values: "alpha" for alphabetic characters, |
|
| 46 | + * "alnum" for alpha-numeric characters and "num" for numbers. |
|
| 47 | + * By default it is "alnum". |
|
| 48 | + * @param integer $length the length of the string to generate. By default it is 10. |
|
| 49 | + * @param boolean $lower if we return the generated string in lowercase (true). By default it's false. |
|
| 50 | + * @return string the generated string. |
|
| 51 | + */ |
|
| 52 | + function get_random_string($type = 'alnum', $length = 10, $lower = false){ |
|
| 53 | + $chars = array( |
|
| 54 | + 'alpha' => 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ', |
|
| 55 | + 'alnum' => 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890', |
|
| 56 | + 'num' => '1234567890' |
|
| 57 | + ); |
|
| 58 | + $str = null; |
|
| 59 | + if(isset($chars[$type])){ |
|
| 60 | + $str = $chars[$type]; |
|
| 61 | + } |
|
| 62 | + $random = null; |
|
| 63 | + for($i = 0; $i < $length; $i++){ |
|
| 64 | + $random .= $str[mt_rand() % strlen($str)]; |
|
| 65 | + } |
|
| 66 | + if($lower){ |
|
| 67 | + $random = strtolower($random); |
|
| 68 | + } |
|
| 69 | + return $random; |
|
| 70 | + } |
|
| 71 | + } |
|
@@ -39,7 +39,7 @@ discard block |
||
| 39 | 39 | * @filesource |
| 40 | 40 | */ |
| 41 | 41 | |
| 42 | - if(! function_exists('get_random_string')){ |
|
| 42 | + if (!function_exists('get_random_string')) { |
|
| 43 | 43 | /** |
| 44 | 44 | * Generate a random string |
| 45 | 45 | * @param string $type the type of generation. It can take the values: "alpha" for alphabetic characters, |
@@ -49,21 +49,21 @@ discard block |
||
| 49 | 49 | * @param boolean $lower if we return the generated string in lowercase (true). By default it's false. |
| 50 | 50 | * @return string the generated string. |
| 51 | 51 | */ |
| 52 | - function get_random_string($type = 'alnum', $length = 10, $lower = false){ |
|
| 52 | + function get_random_string($type = 'alnum', $length = 10, $lower = false) { |
|
| 53 | 53 | $chars = array( |
| 54 | 54 | 'alpha' => 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ', |
| 55 | 55 | 'alnum' => 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890', |
| 56 | 56 | 'num' => '1234567890' |
| 57 | 57 | ); |
| 58 | 58 | $str = null; |
| 59 | - if(isset($chars[$type])){ |
|
| 59 | + if (isset($chars[$type])) { |
|
| 60 | 60 | $str = $chars[$type]; |
| 61 | 61 | } |
| 62 | 62 | $random = null; |
| 63 | - for($i = 0; $i < $length; $i++){ |
|
| 63 | + for ($i = 0; $i < $length; $i++) { |
|
| 64 | 64 | $random .= $str[mt_rand() % strlen($str)]; |
| 65 | 65 | } |
| 66 | - if($lower){ |
|
| 66 | + if ($lower) { |
|
| 67 | 67 | $random = strtolower($random); |
| 68 | 68 | } |
| 69 | 69 | return $random; |