Example #1
0
 /**
  * Check compatibility of Addons vs Core
  *
  * @global type $Ig_Sc_Providers
  */
 public static function compatibility_check()
 {
     global $Ig_Sc_Providers;
     $providers = $Ig_Sc_Providers;
     // get current version of core
     $core_version = IG_Pb_Helper_Functions::get_plugin_info(IG_PB_FILE, 'Version');
     foreach ($providers as $dir => $provider) {
         if (!empty($provider['file']) && !empty($provider['path'])) {
             $addon_file = $provider['file'];
             // get value of core version required
             $core_required = IG_Pb_Addon::core_version_requied_value($provider, $addon_file);
             if ($core_required) {
                 // addon plugin name
                 $addon_name = IG_Pb_Helper_Functions::get_plugin_info($provider['file_path'], 'Name');
                 $compatibility = IG_Pb_Addon::compatibility_handle($core_required, $core_version, $addon_file);
                 if (!$compatibility) {
                     // remove provider from list
                     unset($Ig_Sc_Providers[$dir]);
                     // show notice
                     self::$notice[] = IG_Pb_Addon::show_notice(array('addon_name' => $addon_name, 'core_required' => $core_required), 'core_required');
                 }
             }
         }
     }
 }
Example #2
0
 /**
  * Activate handle
  */
 function do_activate()
 {
     // get current version of plugin
     $latest_version = IG_Pb_Helper_Functions::get_plugin_info(IG_PB_FILE, 'Version');
     // get previous version of plugin
     $old_version = get_transient('ig_pb_version');
     // compare version
     if (!$old_version || version_compare($old_version, $latest_version, '<')) {
         // update plugin version
         set_transient('ig_pb_version', $latest_version);
         // remove cache folder if plugin is installed before
         if ($old_version) {
             IG_Pb_Utils_Common::remove_cache_folder();
         }
     }
     // remove free shortcode directory
     if (is_dir(WP_PLUGIN_DIR . '/ig-shortcodes-free')) {
         delete_plugins(array('ig-shortcodes-free/main.php'));
     }
 }