| @@ -71,14 +71,8 @@ | ||
| 71 | 71 | } |
| 72 | 72 | |
| 73 | 73 | WebTotemOption::multisiteCheck(); |
| 74 | 74 | |
| 75 | - $version = WebTotemOption::getOption('plugin_version'); | |
| 76 | - if (WebTotemOption::isActivated() and !empty($version) and version_compare($version, '3.0.0', '<')) { | |
| 77 | - WebTotemDB::clearSettings(); | |
| 78 | - WebTotemOption::setOptions(['plugin_version' => WEBTOTEM_VERSION]); | |
| 79 | - } | |
| 80 | - | |
| 81 | 75 | if(!WebTotemOption::isActivated() and $_page !== 'wtotem_activation') { |
| 82 | 76 | // If the plugin is not activated by the API key, then redirect to the activation page. |
| 83 | 77 | wp_safe_redirect( WebTotem::adminURL('admin.php?page=wtotem_activation') ); |
| 84 | 78 | exit; |
| @@ -96,21 +90,24 @@ | ||
| 96 | 90 | } |
| 97 | 91 | elseif(WebTotemOption::isActivated()) { |
| 98 | 92 | // Checking whether agents are installed, if they are not installed, then install. |
| 99 | 93 | self::checkAgents(); |
| 100 | -// self::checkSiteAddedDate(); | |
| 101 | - | |
| 102 | - // Check if the plugin version has changed. | |
| 103 | - WebTotemAgentManager::checkVersion(); | |
| 104 | - | |
| 105 | 94 | } |
| 106 | 95 | } |
| 107 | 96 | |
| 97 | + // Check if the plugin version has changed. | |
| 98 | + WebTotemAgentManager::checkVersion(); | |
| 108 | 99 | |
| 109 | - if (!WebTotemOption::isActivated() and version_compare(WEBTOTEM_VERSION, '3.0.3', '<=')) { | |
| 110 | - WebTotemOption::setNotification('warning', __('We’ve made significant changes to the backend of our platform.. To continue using the plugin, please re-authorize your account in the dashboard and generate a new API key here: <a target="_blank" href="https://app.wtotem.com"> cabinet </a>.', 'wtotem')); | |
| 111 | - } | |
| 100 | + $sapi = @php_sapi_name(); | |
| 101 | + if( $sapi != "cli" ) { | |
| 102 | + if ($waf = WebTotemOption::getOption("waf_file")) { | |
| 103 | + $include_waf_file = ABSPATH . '_include_' . $waf; | |
| 112 | 104 | |
| 105 | + if (is_file($include_waf_file) && is_readable($include_waf_file)) { | |
| 106 | + include_once $include_waf_file; | |
| 107 | + } | |
| 108 | + } | |
| 109 | + } | |
| 113 | 110 | } |
| 114 | 111 | |
| 115 | 112 | /** |
| 116 | 113 | * Checking whether agents are installed, if they are not installed, then install. |
| @@ -120,9 +117,9 @@ | ||
| 120 | 117 | $api_key = WebTotemOption::getOption('api_key'); |
| 121 | 118 | |
| 122 | 119 | $host = WebTotemAPI::siteInfo(); |
| 123 | 120 | |
| 124 | - if ($api_key && array_key_exists('id', $host) && $host['id']) { | |
| 121 | + if ($api_key && array_key_exists('id', $host)) { | |
| 125 | 122 | |
| 126 | 123 | // Install Agent Manager if it was not previously installed. |
| 127 | 124 | $am_installed = WebTotemAgentManager::checkInstalledService('am'); |
| 128 | 125 | if (!$am_installed['file_status']) { |
| @@ -136,30 +133,8 @@ | ||
| 136 | 133 | |
| 137 | 134 | } |
| 138 | 135 | } |
| 139 | 136 | |
| 140 | - /** | |
| 141 | - * Checking whether the site added date has been saved, if not, then requests the data and saves. | |
| 142 | - */ | |
| 143 | - private static function checkSiteAddedDate(){ | |
| 144 | - if (WebTotemRequest::get('hid')) { | |
| 145 | - $host = WebTotemOption::getHost(WebTotemRequest::get('hid')); | |
| 146 | - } else { | |
| 147 | - $host = WebTotemAPI::siteInfo(); | |
| 148 | - } | |
| 149 | - | |
| 150 | - $site_created_at = WebTotemOption::getOption('site_created_at'); | |
| 151 | - | |
| 152 | - $site_created_at = $site_created_at ? json_decode($site_created_at, true) : []; | |
| 153 | - | |
| 154 | - if(!array_key_exists($host['name'], $site_created_at)){ | |
| 155 | - $createdAt = WebTotemAPI::getGetSiteAddedDate($host['name']); | |
| 156 | - if($createdAt){ | |
| 157 | - WebTotemOption::setOptions(['site_created_at' => [ $host['name'] => $createdAt] ]); | |
| 158 | - } | |
| 159 | - } | |
| 160 | - } | |
| 161 | - | |
| 162 | 137 | /** |
| 163 | 138 | * When adding a new site, add it to the WebTotem platform. |
| 164 | 139 | */ |
| 165 | 140 | public static function addNewSite($new_site){ |
| @@ -464,17 +439,17 @@ | ||
| 464 | 439 | wp_enqueue_script('wtotem_toastr'); |
| 465 | 440 | |
| 466 | 441 | $_page = WebTotemRequest::get('page'); |
| 467 | 442 | if($_page === 'wtotem_settings'){ |
| 468 | -// wp_register_script( | |
| 469 | -// 'wtotem_country_blocking', | |
| 470 | -// WEBTOTEM_URL . '/includes/js/country-blocking.js', | |
| 471 | -// ['wp-i18n'], | |
| 472 | -// WebTotem::fileVersion('includes/js/country-blocking.js'), | |
| 473 | -// true | |
| 474 | -// ); | |
| 475 | -// wp_set_script_translations( 'wtotem_country_blocking', 'wtotem' , WEBTOTEM_PLUGIN_PATH . '/lang/'); | |
| 476 | -// wp_enqueue_script('wtotem_country_blocking'); | |
| 443 | + wp_register_script( | |
| 444 | + 'wtotem_country_blocking', | |
| 445 | + WEBTOTEM_URL . '/includes/js/country-blocking.js', | |
| 446 | + ['wp-i18n'], | |
| 447 | + WebTotem::fileVersion('includes/js/country-blocking.js'), | |
| 448 | + true | |
| 449 | + ); | |
| 450 | + wp_set_script_translations( 'wtotem_country_blocking', 'wtotem' , WEBTOTEM_PLUGIN_PATH . '/lang/'); | |
| 451 | + wp_enqueue_script('wtotem_country_blocking'); | |
| 477 | 452 | } |
| 478 | 453 | |
| 479 | 454 | wp_register_script( |
| 480 | 455 | 'wtotem_main', |