Commit 9af572c7 authored by haystack's avatar haystack

audit and update plugin activation, deactivation and deletion

parent fe42665c
......@@ -198,9 +198,6 @@ class CiviCRM_For_WordPress {
*/
public function activation() {
//update_option( 'civicrm_activation_in_progress', 'true' );
//return;
// if activating...
if ( is_admin() && get_option( 'civicrm_activation_in_progress' ) == 'true' ) {
......@@ -218,6 +215,21 @@ class CiviCRM_For_WordPress {
}
/**
* Method that is called only when CiviCRM plugin is deactivated
* In order for other plugins to be able to interact with Civi's activation,
* we need to remove the option that is set in activate() above
*
* @return void
*/
public function deactivate() {
// delete option
delete_option( 'civicrm_activation_in_progress' );
}
/**
* Set up the CiviCRM plugin instance
*
......@@ -1204,7 +1216,8 @@ class CiviCRM_For_WordPress {
/**
* Callback from 'edit_post_link' hook to remove edit link in set_post_blank()
* Remove edit link from page content
* Callback from 'edit_post_link' hook
*
* @return string Always empty
*/
......@@ -1295,6 +1308,7 @@ function civi_wp() {
return CiviCRM_For_WordPress::singleton();
}
/**
* Hook CiviCRM_For_WordPress early onto the 'plugins_loaded' action.
*
......@@ -1310,11 +1324,23 @@ if ( defined( 'CIVICRM_LATE_LOAD' ) ) {
}
// tell WordPress to call plugin activation method, although it's still directed
// at the legacy callback, in case there are situations where the function is
// called from elsewhere. Should perhaps be:
// register_activation_hook( 'CiviCRM_For_WordPress, 'civicrm_activate' );
register_activation_hook( __FILE__, 'civicrm_activate' );
/**
* Tell WordPress to call plugin activation method - no longer calls legacy
* global scope function
*/
register_activation_hook( CIVICRM_PLUGIN_FILE, array( civi_wp(), 'activate' ) );
/**
* Tell WordPress to call plugin deactivation method - needed in order to reset
* the option that is set on activation.
*/
register_deactivation_hook( CIVICRM_PLUGIN_FILE, array( civi_wp(), 'deactivate' ) );
// uninstall uses the 'uninstall.php' method
// see: http://codex.wordpress.org/Function_Reference/register_uninstall_hook
/*
......
<?php
/*
+--------------------------------------------------------------------+
| CiviCRM version 4.5 |
+--------------------------------------------------------------------+
| Copyright CiviCRM LLC (c) 2004-2013 |
+--------------------------------------------------------------------+
| This file is a part of CiviCRM. |
| |
| CiviCRM is free software; you can copy, modify, and distribute it |
| under the terms of the GNU Affero General Public License |
| Version 3, 19 November 2007 and the CiviCRM Licensing Exception. |
| |
| CiviCRM is distributed in the hope that it will be useful, but |
| WITHOUT ANY WARRANTY; without even the implied warranty of |
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
| See the GNU Affero General Public License for more details. |
| |
| You should have received a copy of the GNU Affero General Public |
| License and the CiviCRM Licensing Exception along |
| with this program; if not, contact CiviCRM LLC |
| at info[AT]civicrm[DOT]org. If you have questions about the |
| GNU Affero General Public License or the licensing of CiviCRM, |
| see the CiviCRM license FAQ at http://civicrm.org/licensing |
+--------------------------------------------------------------------+
*/
/**
*
* @package CRM
* @copyright CiviCRM LLC (c) 2004-2013
*
*/
// kick out if uninstall not called from WordPress
if ( !defined( 'WP_UNINSTALL_PLUGIN' ) ) { exit(); }
// delete options that this plugin has set
delete_option( 'civicrm_activation_in_progress' );
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment