Tribe__Image__Plus__PUE
Source
File: src/Tribe/PUE.php
class Tribe__Image__Plus__PUE {
/**
* @var string slug used for the plugin update engine
*/
private static $pue_slug = 'image-widget-plus';
/**
* @var string plugin update url
*/
private static $update_url = 'https://pue.tri.be/';
/**
* @var string plugin file name
*/
private static $plugin_file;
/**
* @var Tribe__PUE__Checker
*/
public $pue_instance;
/**
* Constructor function. a.k.a. Let's get this party started!
*
* @param string $plugin_file file path.
*/
public function __construct( $plugin_file ) {
self::$plugin_file = $plugin_file;
add_action( 'tribe_helper_activation_complete', array( $this, 'load_plugin_update_engine' ) );
register_activation_hook( self::$plugin_file, array( $this, 'register_uninstall_hook' ) );
}
/**
* Load the Plugin Update Engine
*/
public function load_plugin_update_engine() {
// if running an old version of TEC (pre embedded licensing), use the old update_url
if ( version_compare( Tribe__Main::VERSION, '4.5.1', '<' ) ) {
self::$update_url = 'https://theeventscalendar.com/';
}
if ( apply_filters( 'tribe_enable_pue', true, self::$pue_slug ) && class_exists( 'Tribe__PUE__Checker' ) ) {
$this->pue_instance = new Tribe__PUE__Checker( self::$update_url, self::$pue_slug, array(), plugin_basename( self::$plugin_file ) );
}
}
/**
* Register the uninstall hook on activation
*/
public function register_uninstall_hook() {
register_uninstall_hook( self::$plugin_file, array( get_class( $this ), 'uninstall' ) );
}
/**
* The uninstall hook for the pue option.
*/
public function uninstall() {
$slug = str_replace( '-', '_', self::$pue_slug );
delete_option( 'pue_install_key_' . $slug );
delete_option( 'pu_dismissed_upgrade_' . $slug );
}
}
Methods
- __construct — Constructor function. a.k.a. Let's get this party started!
- load_plugin_update_engine — Load the Plugin Update Engine
- register_uninstall_hook — Register the uninstall hook on activation
- uninstall — The uninstall hook for the pue option.