| @@ -1,12 +1,12 @@ | ||
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | 3 | * @package FirePlugins Framework |
| 4 | - * @version 1.0.0 | |
| 4 | + * @version 1.1.102 | |
| 5 | 5 | * |
| 6 | 6 | * @author FirePlugins <info@fireplugins.com> |
| 7 | 7 | * @link https://www.fireplugins.com |
| 8 | - * @copyright Copyright © 2021 FirePlugins All Rights Reserved | |
| 8 | + * @copyright Copyright © 2024 FirePlugins All Rights Reserved | |
| 9 | 9 | * @license GNU GPLv3 <http://www.gnu.org/licenses/gpl.html> or later |
| 10 | 10 | */ |
| 11 | 11 | |
| 12 | 12 | namespace FPFramework\Base; |
| @@ -26,8 +26,20 @@ | ||
| 26 | 26 | public function getSiteData() |
| 27 | 27 | { |
| 28 | 28 | return new Factory\SiteData(); |
| 29 | 29 | } |
| 30 | + | |
| 31 | + /** | |
| 32 | + * Returns the condition. | |
| 33 | + * | |
| 34 | + * @param string $name | |
| 35 | + * | |
| 36 | + * @return Object | |
| 37 | + */ | |
| 38 | + public static function getCondition($name) | |
| 39 | + { | |
| 40 | + return \FPFramework\Base\Conditions\ConditionsHelper::getInstance()->getCondition($name); | |
| 41 | + } | |
| 30 | 42 | |
| 31 | 43 | /** |
| 32 | 44 | * WordPress Database Object |
| 33 | 45 | * |
| @@ -45,9 +57,9 @@ | ||
| 45 | 57 | * @return array |
| 46 | 58 | */ |
| 47 | 59 | public function getQueryStrings() |
| 48 | 60 | { |
| 49 | - return isset($_GET) ? wp_unslash($_GET) : []; | |
| 61 | + return isset($_GET) ? wp_unslash($_GET) : []; //phpcs:ignore WordPress.Security.NonceVerification.Recommended | |
| 50 | 62 | } |
| 51 | 63 | |
| 52 | 64 | /** |
| 53 | 65 | * Retrieves the language code |
| @@ -80,9 +92,9 @@ | ||
| 80 | 92 | * @param object $tz |
| 81 | 93 | */ |
| 82 | 94 | public function getDate($date = 'now', $tz = null) |
| 83 | 95 | { |
| 84 | - return date_create($date, $tz); | |
| 96 | + return date_create($date ?? '', $tz); | |
| 85 | 97 | } |
| 86 | 98 | |
| 87 | 99 | /** |
| 88 | 100 | * Get the user by a given field |
| @@ -117,31 +129,8 @@ | ||
| 117 | 129 | return wp_get_referer(); |
| 118 | 130 | } |
| 119 | 131 | |
| 120 | 132 | /** |
| 121 | - * Get IP | |
| 122 | - * | |
| 123 | - * @return string | |
| 124 | - */ | |
| 125 | - public function getIP() | |
| 126 | - { | |
| 127 | - if (!empty($_SERVER['HTTP_CLIENT_IP'])) | |
| 128 | - { | |
| 129 | - $ip = $_SERVER['HTTP_CLIENT_IP']; | |
| 130 | - } | |
| 131 | - elseif (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) | |
| 132 | - { | |
| 133 | - $ip = $_SERVER['HTTP_X_FORWARDED_FOR']; | |
| 134 | - } | |
| 135 | - else | |
| 136 | - { | |
| 137 | - $ip = $_SERVER['REMOTE_ADDR']; | |
| 138 | - } | |
| 139 | - | |
| 140 | - return $ip; | |
| 141 | - } | |
| 142 | - | |
| 143 | - /** | |
| 144 | 133 | * Returns the current page url |
| 145 | 134 | * |
| 146 | 135 | * @return string |
| 147 | 136 | */ |
| @@ -220,9 +209,9 @@ | ||
| 220 | 209 | * @return array |
| 221 | 210 | */ |
| 222 | 211 | public function getCookie($cookie_name = null) |
| 223 | 212 | { |
| 224 | - return new Factory\Cookie($cookie_name); | |
| 213 | + return (new Factory\Cookie($cookie_name))->get(); | |
| 225 | 214 | } |
| 226 | 215 | |
| 227 | 216 | /** |
| 228 | 217 | * Get Visitor ID |