Пример #1
0
 /**
  * @author Vova Feldman (@svovaf)
  * @since  1.1.6
  */
 private function remove_sdk_reference()
 {
     global $fs_active_plugins;
     foreach ($fs_active_plugins->plugins as $sdk_path => &$data) {
         if ($this->_plugin_basename == $data->plugin_path) {
             unset($fs_active_plugins->plugins[$sdk_path]);
             break;
         }
     }
     fs_fallback_to_newest_active_sdk();
 }
Пример #2
0
     update_option('fs_active_plugins', $fs_active_plugins);
 }
 $is_newest_sdk_path_valid = ($is_newest_sdk_plugin_activate || $fs_active_plugins->newest->in_activation) && file_exists(fs_normalize_path(WP_PLUGIN_DIR . '/' . $this_sdk_relative_path . '/start.php'));
 if (!$is_newest_sdk_path_valid && !$is_current_sdk_newest) {
     // Plugin with newest SDK is no longer active, or SDK was moved to a different location.
     unset($fs_active_plugins->plugins[$fs_active_plugins->newest->sdk_path]);
 }
 if (!($is_newest_sdk_plugin_activate || $fs_active_plugins->newest->in_activation) || !$is_newest_sdk_path_valid || $this_sdk_relative_path == $fs_active_plugins->newest->sdk_path && version_compare($fs_active_plugins->newest->version, $this_sdk_version, '>')) {
     /**
      * Plugin with newest SDK is no longer active.
      *    OR
      * The newest SDK was in the current plugin. BUT, seems like the version of
      * the SDK was downgraded to a lower SDK.
      */
     // Find the active plugin with the newest SDK version and update the newest reference.
     fs_fallback_to_newest_active_sdk();
 } else {
     if ($is_newest_sdk_plugin_activate && $this_sdk_relative_path == $fs_active_plugins->newest->sdk_path && ($fs_active_plugins->newest->in_activation || class_exists('Freemius') && (!defined('WP_FS__SDK_VERSION') || version_compare(WP_FS__SDK_VERSION, $this_sdk_version, '<')))) {
         if ($fs_active_plugins->newest->in_activation) {
             // Plugin no more in activation.
             $fs_active_plugins->newest->in_activation = false;
             update_option('fs_active_plugins', $fs_active_plugins);
         }
         // Reorder plugins to load plugin with newest SDK first.
         if (fs_newest_sdk_plugin_first()) {
             // Refresh page after re-order to make sure activated plugin loads newest SDK.
             if (class_exists('Freemius')) {
                 if (fs_redirect($_SERVER['REQUEST_URI'])) {
                     exit;
                 }
             }