4 ) && ( substr( $o, 0, 4 ) == 'a:2:' ) ) { $o = @unserialize( $o ); if ( is_array( $o ) && isset( $o['GoogleID'] ) && isset( $o['HideForAdmins'] ) ) { # apparently, we've got something here $options = array( 'GoogleID' => $o['GoogleID'], 'HideInAdmin' => $o['HideForAdmins'], 'HideForLogged' => '0', 'IntoFooter' => '0', ); Config::save_options( $options ); } } # now it is safe to remove all old options, if existed self::remove_old_options(); } /** * This method must be static, because of WordPress requirements. * At this time, there is nothing we can do here. * @return void */ public static function deactivation() { } /** * This method must be static, because of WordPress requirements. * Use this method to remove current options * @return void */ public static function uninstall() { delete_option( Config::OPTION_NAME ); } /** * This method will remove all previous options (0.1-0.5), * notice that current options will be safe * @return bool Always returns true */ public static function remove_old_options() { # version 0.1/0.2 delete_option('wordpress_ln_gah_ad'); delete_option('wordpress_ln_gah_id'); # version 0.3 delete_option('wordpress_ln_p_ah_ga_id'); delete_option('wordpress_ln_p_ah_add_for_admins'); # version 0.4.1 delete_option('wordpress_ln_p_ah'); # version 0.5 delete_option('wordpress_lnpo_ah'); return true; } } register_activation_hook( PLUGIN_FILE, array( 'Phylax\Plugin\Installer', 'activation' ) ); register_deactivation_hook( PLUGIN_FILE, array( 'Phylax\Plugin\Installer', 'deactivation' ) ); register_uninstall_hook( PLUGIN_FILE, array( 'Phylax\Plugin\Installer', 'uninstall' ) ); # EOF