'wordpress-plugin', 'utm_medium' => 'plugin', 'utm_campaign' => YOPINGME_VERSION, ), YOPINGME_APP_URL . ltrim( $path, '/' ) ); } register_activation_hook( __FILE__, array( 'Yopingme_Heartbeat', 'activate' ) ); register_deactivation_hook( __FILE__, 'yopingme_deactivate' ); function yopingme_deactivate() { delete_transient( 'yopingme_cache_fresh' ); delete_transient( 'yopingme_status_fresh' ); delete_transient( 'yopingme_status_pages' ); Yopingme_Heartbeat::deactivate(); } /** * Forget cached server state after an update. * * Transients survive a plugin upgrade, so a site that cached "this YoPingMe * cannot add monitors" would keep saying so after both sides had been * updated. Upgrading is a deliberate act; re-ask. */ function yopingme_maybe_upgrade() { if ( get_option( 'yopingme_installed_version' ) === YOPINGME_VERSION ) { return; } Yopingme_Cache::flush(); // 1.2.0 retired the terms checkbox (wordpress.org Guideline 7 exempts a // service you configure yourself, and the readme carries the disclosure) // and the activation notice that asked about the badge, which is now a // labelled step of the setup wizard. delete_option( 'yopingme_terms_accepted' ); delete_option( 'yopingme_activation_notice' ); delete_option( 'yopingme_notice_done' ); // A site that already has a key was set up under an earlier version; // walking it back through the wizard would be nonsense. if ( '' !== (string) get_option( 'yopingme_api_key', '' ) ) { update_option( 'yopingme_setup_done', '1', false ); } update_option( 'yopingme_installed_version', YOPINGME_VERSION, false ); } add_action( 'admin_init', 'yopingme_maybe_upgrade' ); Yopingme_Badge::init(); Yopingme_Status::init(); Yopingme_Heartbeat::init(); if ( is_admin() ) { Yopingme_Settings::init(); Yopingme_Widget::init(); Yopingme_Notice::init(); }