/**
  * Constructor for Licence Validator in each plugin
  *
  * @param string $file - full server path to the main plugin file
  * @param string $identifier - selling Shop Product ID
  * @param string $home_shop_url - selling Shop URL of this plugin (product)
  */
 public function __construct($file, $identifier, $home_shop_url)
 {
     $info = get_file_data($file, array('Title' => 'Plugin Name', 'Version' => 'Version', 'Url' => 'Plugin URI'), 'plugin');
     $this->identifier = $identifier;
     $this->file = $file;
     $this->path = plugin_dir_path($this->file);
     $this->plugin_slug = plugin_basename($this->file);
     list($a, $b) = explode('/', $this->plugin_slug);
     $this->file_slug = str_replace('.php', '', $b);
     $this->title = $info['Title'];
     $this->version = $info['Version'];
     $this->plugin_url = $info['Url'];
     $this->home_shop_url = $home_shop_url;
     $this->override_validation_url = get_option('jigoshop_license_override_validation_url', false);
     $this->custom_validation_url = get_option('jigoshop_license_custom_validation_url', '');
     if ($this->override_validation_url) {
         $this->home_shop_url = $this->custom_validation_url;
     }
     self::$plugins[$this->identifier] = array('version' => $this->version, 'plugin_slug' => $this->plugin_slug, 'file_slug' => $this->file_slug, 'path' => $this->path, 'title' => $this->title);
     if (!self::$instance) {
         self::$instance = true;
         add_action('admin_menu', array($this, 'register_nav_menu_link'));
         // Define the alternative response for information checking
         add_filter('plugins_api', array($this, 'get_update_info'), 20, 3);
     }
     // define the alternative API for updating checking
     add_filter('pre_set_site_transient_update_plugins', array($this, 'check_for_update'));
     add_action('in_plugin_update_message-' . $this->plugin_slug, array($this, 'in_plugin_update_message'), 10, 2);
 }
Example #2
0
     // Define plugin URL for assets
     define('JIGOSHOP_PLUGIN_NAME_URL', plugins_url('', __FILE__));
     //Init components.
     require_once JIGOSHOP_PLUGIN_NAME_DIR . '/src/Jigoshop/Extension/PluginName/Common.php';
     if (is_admin()) {
         require_once JIGOSHOP_PLUGIN_NAME_DIR . '/src/Jigoshop/Extension/PluginName/Admin.php';
     } else {
         require_once JIGOSHOP_PLUGIN_NAME_DIR . '/src/Jigoshop/Extension/PluginName/Shop.php';
     }
 } elseif (class_exists('jigoshop')) {
     //Check version.
     if (jigoshop_add_required_version_notice(JIGOSHOP_PLUGIN_NAME_NAME, '1.17')) {
         return;
     }
     //Check license.
     $licence = new jigoshop_licence_validator(__FILE__, '111111', 'http://www.jigoshop.com');
     if (!$licence->is_licence_active()) {
         return;
     }
     // Define plugin directory for inclusions
     define('JIGOSHOP_PLUGIN_NAME_DIR', dirname(__FILE__) . '/Jigoshop1x');
     // Define plugin URL for assets
     define('JIGOSHOP_PLUGIN_NAME_URL', plugins_url('', __FILE__) . '/Jigoshop1x');
     //Init components.
     require_once JIGOSHOP_PLUGIN_NAME_DIR . '/src/to/old/plugin/start/file.php';
 } else {
     add_action('admin_notices', function () {
         echo '<div class="error"><p>';
         printf(__('%s requires Jigoshop plugin to be active. Code for plugin %s was not loaded.', 'plugin_textdomain'), JIGOSHOP_PLUGIN_NAME_NAME, JIGOSHOP_PLUGIN_NAME_NAME);
         echo '</p></div>';
     });