-
Notifications
You must be signed in to change notification settings - Fork 16
/
uninstall.php
34 lines (29 loc) · 1.23 KB
/
uninstall.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
<?php
/*------------------------------------------------------------------------------
This is run only when this plugin is uninstalled. All cleanup code goes here.
WARNING: uninstalling a plugin fails when developing locally via MAMP et al.
Perhaps related to how WP attempts (and fails) to connect to the local site.
------------------------------------------------------------------------------*/
if ( defined('WP_UNINSTALL_PLUGIN'))
{
require_once('includes/constants.php');
require_once('includes/CCTM.php');
require_once('includes/CCTM_FormElement.php');
// If the custom fields modified anything, we need to give them this
// opportunity to clean it up.
$available_custom_field_files = CCTM::get_available_helper_classes('fields');
foreach ( $available_custom_field_files as $shortname => $file ) {
include_once($file);
if (class_exists(CCTM::filter_prefix.$shortname)){
$field_type_name = CCTM::filter_prefix.$shortname;
$FieldObj = new $field_type_name();
$FieldObj->uninstall();
}
}
delete_option( CCTM::db_key );
delete_option('custom_content_types_mgr_data'); // legacy pre 0.9.4
delete_option('custom_content_types_mgr_settings'); // legacy pre 0.9.4
global $wp_rewrite;
$wp_rewrite->flush_rules();
}
/*EOF*/