$action, 'object_type' => 'Plugin', 'object_id' => 0, 'object_name' => $plugin_name, ) ); } public function hooks_deactivated_plugin( $plugin_name ) { $this->_add_log_plugin( 'deactivated', $plugin_name ); } public function hooks_activated_plugin( $plugin_name ) { $this->_add_log_plugin( 'activated', $plugin_name ); } public function hooks_plugin_modify( $location, $status ) { if ( false !== strpos( $location, 'plugin-editor.php' ) ) { if ( ( ! empty( $_POST ) && 'update' === $_REQUEST['action'] ) ) { $aal_args = array( 'action' => 'file_updated', 'object_type' => 'Plugin', 'object_subtype' => 'plugin_unknown', 'object_id' => 0, 'object_name' => 'file_unknown', ); if ( ! empty( $_REQUEST['file'] ) ) { $aal_args['object_name'] = $_REQUEST['file']; // Get plugin name $plugin_dir = explode( '/', $_REQUEST['file'] ); $plugin_data = array_shift( array_values( get_plugins( '/' . $plugin_dir[0] ) ) ); $aal_args['object_subtype'] = $plugin_data['Name']; } aal_insert_log( $aal_args ); } } // We are need return the instance, for complete the filter. return $location; } public function __construct() { add_action( 'activated_plugin', array( &$this, 'hooks_activated_plugin' ) ); add_action( 'deactivated_plugin', array( &$this, 'hooks_deactivated_plugin' ) ); add_filter( 'wp_redirect', array( &$this, 'hooks_plugin_modify' ), 10, 2 ); parent::__construct(); } }