| @@ -1,15 +1,21 @@ | ||
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | 3 | * @package FirePlugins Framework |
| 4 | - * @version 1.0.27 | |
| 4 | + * @version 1.1.132 | |
| 5 | 5 | * |
| 6 | 6 | * @author FirePlugins <info@fireplugins.com> |
| 7 | 7 | * @link https://www.fireplugins.com |
| 8 | - * @copyright Copyright © 2022 FirePlugins All Rights Reserved | |
| 8 | + * @copyright Copyright © 2025 FirePlugins All Rights Reserved | |
| 9 | 9 | * @license GNU GPLv3 <http://www.gnu.org/licenses/gpl.html> or later |
| 10 | 10 | */ |
| 11 | 11 | |
| 12 | +if (!function_exists('add_action')) | |
| 13 | +{ | |
| 14 | + // We are running outside of the context of WordPress. | |
| 15 | + return; | |
| 16 | +} | |
| 17 | + | |
| 12 | 18 | if (!function_exists('firepluginsframework_getFrameworkVersion')) |
| 13 | 19 | { |
| 14 | 20 | /** |
| 15 | 21 | * Return the framework version |
| @@ -54,14 +60,30 @@ | ||
| 54 | 60 | * @return void |
| 55 | 61 | */ |
| 56 | 62 | function firepluginsframework_getFrameworkPriority($dir) |
| 57 | 63 | { |
| 58 | - $max_int_size = PHP_INT_MAX; | |
| 64 | + $id = PHP_INT_MAX; | |
| 59 | 65 | |
| 60 | 66 | $version = firepluginsframework_getFrameworkVersion($dir); |
| 61 | - $version = str_replace('.', '', $version); | |
| 67 | + $version = array_map('intval', explode('.', $version)); | |
| 62 | 68 | |
| 63 | - return $max_int_size - (int) $version; | |
| 69 | + for ($i = 0; $i < count($version); $i++) | |
| 70 | + { | |
| 71 | + if ($i == 0) | |
| 72 | + { | |
| 73 | + $id -= $version[$i] * 105; | |
| 74 | + } | |
| 75 | + else if ($i == 1) | |
| 76 | + { | |
| 77 | + $id -= $version[$i] * 55; | |
| 78 | + } | |
| 79 | + else | |
| 80 | + { | |
| 81 | + $id -= $version[$i]; | |
| 82 | + } | |
| 83 | + } | |
| 84 | + | |
| 85 | + return $id; | |
| 64 | 86 | } |
| 65 | 87 | } |
| 66 | 88 | |
| 67 | 89 | /** |
| @@ -75,14 +97,8 @@ | ||
| 75 | 97 | { |
| 76 | 98 | return; |
| 77 | 99 | } |
| 78 | 100 | |
| 79 | - if (!function_exists('add_action')) | |
| 80 | - { | |
| 81 | - // We are running outside of the context of WordPress. | |
| 82 | - return; | |
| 83 | - } | |
| 84 | - | |
| 85 | 101 | $version = firepluginsframework_getFrameworkVersion(dirname(__DIR__)); |
| 86 | 102 | $priority = firepluginsframework_getFrameworkPriority(dirname(__DIR__)); |
| 87 | 103 | |
| 88 | 104 | // Framework priority |
| @@ -123,9 +139,9 @@ | ||
| 123 | 139 | |
| 124 | 140 | // Support URL |
| 125 | 141 | if (!defined('FPF_SUPPORT_URL')) |
| 126 | 142 | { |
| 127 | - define('FPF_SUPPORT_URL', FPF_SITE_URL . 'contact'); | |
| 143 | + define('FPF_SUPPORT_URL', FPF_SITE_URL . 'contact/'); | |
| 128 | 144 | } |
| 129 | 145 | |
| 130 | 146 | // Site Tower Endpoint |
| 131 | 147 | if (!defined('FPF_TOWER_ENDPOINT')) |
| @@ -132,14 +148,32 @@ | ||
| 132 | 148 | { |
| 133 | 149 | define('FPF_TOWER_ENDPOINT', FPF_SITE_URL . 'wp-json/tower/v1/'); |
| 134 | 150 | } |
| 135 | 151 | |
| 152 | + // The templates.fireplugins.com Site URL | |
| 153 | + if (!defined('FPF_TEMPLATES_SITE_URL')) | |
| 154 | + { | |
| 155 | + define('FPF_TEMPLATES_SITE_URL', 'https://templates.fireplugins.com/'); | |
| 156 | + } | |
| 157 | + | |
| 158 | + // Site Tower Endpoint | |
| 159 | + if (!defined('FPF_TEMPLATES_TOWER_ENDPOINT')) | |
| 160 | + { | |
| 161 | + define('FPF_TEMPLATES_TOWER_ENDPOINT', FPF_TEMPLATES_SITE_URL . 'wp-json/tower/v1/'); | |
| 162 | + } | |
| 163 | + | |
| 136 | 164 | // URL to retrieve templates |
| 137 | 165 | if (!defined('FPF_TEMPLATES_GET_URL')) |
| 138 | 166 | { |
| 139 | - define('FPF_TEMPLATES_GET_URL', FPF_TOWER_ENDPOINT . 'templates/{{PLUGIN}}/{{LICENSE_KEY}}/{{SITE_URL}}/get'); | |
| 167 | + define('FPF_TEMPLATES_GET_URL', FPF_TEMPLATES_TOWER_ENDPOINT . 'templates/{{PLUGIN}}/{{LICENSE_KEY}}/{{PLUGIN_VERSION}}/{{SITE_URL}}/get'); | |
| 140 | 168 | } |
| 141 | 169 | |
| 170 | + // URL to retrieve a template | |
| 171 | + if (!defined('FPF_TEMPLATE_GET_URL')) | |
| 172 | + { | |
| 173 | + define('FPF_TEMPLATE_GET_URL', FPF_TEMPLATES_TOWER_ENDPOINT . 'template/{{PLUGIN}}/{{TEMPLATE}}/{{LICENSE_KEY}}/{{SITE_URL}}/get'); | |
| 174 | + } | |
| 175 | + | |
| 142 | 176 | /** |
| 143 | 177 | * Get License Version URL |
| 144 | 178 | */ |
| 145 | 179 | if (!defined('FPF_GET_LICENSE_VERSION_URL')) |
| @@ -154,10 +188,8 @@ | ||
| 154 | 188 | { |
| 155 | 189 | define('FPF_PLUGIN_CHANGELOG_URL', FPF_SITE_URL . '%s/changelog/'); |
| 156 | 190 | } |
| 157 | 191 | |
| 158 | - firepluginsframework_load_textdomain(dirname(__DIR__)); | |
| 159 | - | |
| 160 | 192 | // Now kick off the class autoloader. |
| 161 | 193 | spl_autoload_register( |
| 162 | 194 | /** |
| 163 | 195 | * Autoload classes |
| @@ -170,10 +202,10 @@ | ||
| 170 | 202 | { |
| 171 | 203 | $base = dirname(__FILE__) . '/Inc/'; |
| 172 | 204 | |
| 173 | 205 | $namespaces = [ |
| 206 | + 'FPFramework\\GeoIp2\\' => [ $base . 'Libs/Vendors/geoip2/geoip2/src/' ], | |
| 174 | 207 | 'FPFramework\\' => [ $base ], |
| 175 | - 'GeoIp2\\' => [ $base . 'Libs/Vendors/geoip2/geoip2/src/' ], | |
| 176 | 208 | 'MaxMind\\Db\\' => [ $base . 'Libs/Vendors/maxmind-db/reader/src/MaxMind/Db/' ], |
| 177 | 209 | 'MaxMind\\' => [ $base . 'Libs/Vendors/maxmind/web-service-common/src/' ], |
| 178 | 210 | 'splitbrain\\PHPArchive\\' => [$base . 'Libs/Vendors/splitbrain/php-archive/src/' ], |
| 179 | 211 | ]; |
| @@ -202,8 +234,10 @@ | ||
| 202 | 234 | require_once $file; |
| 203 | 235 | } |
| 204 | 236 | } |
| 205 | 237 | ); |
| 238 | + | |
| 239 | + \FPFramework\Base\Session::getInstance()->init(); | |
| 206 | 240 | |
| 207 | 241 | // load once |
| 208 | 242 | if (FPF_LOADED == $priority) |
| 209 | 243 | { |
| @@ -220,21 +254,8 @@ | ||
| 220 | 254 | do_action('fpf_admin_init'); |
| 221 | 255 | } |
| 222 | 256 | } |
| 223 | 257 | }, firepluginsframework_getFrameworkPriority(dirname(__DIR__))); |
| 224 | - | |
| 225 | -if (!function_exists('firepluginsframework_load_textdomain')) | |
| 226 | -{ | |
| 227 | - /** | |
| 228 | - * Load textdomain of plugin | |
| 229 | - * | |
| 230 | - * @return void | |
| 231 | - */ | |
| 232 | - function firepluginsframework_load_textdomain($dir) | |
| 233 | - { | |
| 234 | - load_plugin_textdomain('fpf-framework', false, $dir . '/Framework/languages/'); | |
| 235 | - } | |
| 236 | -} | |
| 237 | 258 | |
| 238 | 259 | if (!function_exists('firepluginsframework_fixClassBasedOnNamespace')) |
| 239 | 260 | { |
| 240 | 261 | /** |