/**
  * @return Tribe__PUE__Package_Handler
  */
 public static function instance()
 {
     if (empty(self::$instance)) {
         self::$instance = new self();
     }
     return self::$instance;
 }
Example #2
0
 /**
  * Install the hooks required to run periodic update checks and inject update info
  * into WP data structures.
  * Also other hooks related to the automatic updates (such as checking agains API and what not (@from Darren)
  */
 public function hooks()
 {
     // Override requests for plugin information
     add_filter('plugins_api', array($this, 'inject_info'), 10, 3);
     // Check for updates when the WP updates are checked and inject our update if needed.
     // Only add filter if the TRIBE_DISABLE_PUE constant is not set as true and where
     // the context is not 'service'
     if ((!defined('TRIBE_DISABLE_PUE') || TRIBE_DISABLE_PUE !== true) && 'service' !== $this->context) {
         add_filter('pre_set_site_transient_update_plugins', array($this, 'check_for_updates'));
     }
     add_filter('tribe_licensable_addons', array($this, 'build_addon_list'));
     add_action('tribe_license_fields', array($this, 'do_license_key_fields'));
     add_action('tribe_settings_after_content_tab_licenses', array($this, 'do_license_key_javascript'));
     add_action('tribe_settings_success_message', array($this, 'do_license_key_success_message'), 10, 2);
     add_action('load-plugins.php', array($this, 'remove_default_inline_update_msg'), 50);
     add_action('update_option_' . $this->pue_install_key, array($this, 'check_for_api_key_error'), 10, 2);
     add_action('update_site_option_' . $this->pue_install_key, array($this, 'check_for_api_key_error'), 10, 2);
     // Key validation
     add_action('wp_ajax_pue-validate-key_' . $this->get_slug(), array($this, 'ajax_validate_key'));
     add_filter('tribe-pue-install-keys', array($this, 'return_install_key'));
     add_action('admin_enqueue_scripts', array($this, 'maybe_display_json_error_on_plugins_page'), 1);
     add_action('admin_init', array($this, 'general_notifications'));
     // Package name
     add_filter('upgrader_pre_download', array(Tribe__PUE__Package_Handler::instance(), 'filter_upgrader_pre_download'), 5, 3);
 }