plugin_name = $plugin_name; $this->plugin_file = $plugin_file; // deactivate plugin straight away add_action( 'admin_init', array( $this, 'deactivate_self' ) ); } /** * @return bool */ public function deactivate_self() { if( ! current_user_can( 'activate_plugins' ) ) { return false; } // deactivate self deactivate_plugins( $this->plugin_file ); // get rid of "Plugin activated" notice if( isset( $_GET['activate'] ) ) { unset( $_GET['activate'] ); } // show notice to user add_action( 'admin_notices', array( $this, 'show_notice' ) ); return true; } /** * @return void */ public function show_notice() { ?>
%s did not activate because it requires PHP v5.3 or higher, while your server is running PHP v%s.', $this->plugin_name, PHP_VERSION ); ?>
Updating your PHP version makes your site faster, more secure and should be easy for your host.', 'http://www.wpupdatephp.com/update/#utm_source=wp-plugin&utm_medium=boxzillas&utm_campaign=activation-notice' ); ?>