Пример #1
0
        //trigger any uninstall hook that is registered by any extension
        do_action('aam-uninstall-action');
        //remove aam directory if exists
        $dirname = WP_CONTENT_DIR . '/aam';
        if (file_exists($dirname)) {
            AAM_Core_API::removeDirectory($dirname);
        }
        //clear schedules
        wp_clear_scheduled_hook('aam-cron');
    }
}
if (defined('ABSPATH')) {
    //define few common constants
    define('AAM_MEDIA', plugins_url('/media', __FILE__));
    define('AAM_KEY', 'advanced-access-manager');
    define('AAM_BASE', dirname(__FILE__));
    //register autoloader
    require dirname(__FILE__) . '/autoloader.php';
    AAM_Autoloader::register();
    //the highest priority (higher the core)
    //this is important to have to catch events like register core post types
    add_action('init', 'AAM::getInstance', -1);
    //schedule cron
    if (!wp_next_scheduled('aam-cron')) {
        wp_schedule_event(time(), 'daily', 'aam-cron');
    }
    add_action('aam-cron', 'AAM::cron');
    //activation & deactivation hooks
    register_activation_hook(__FILE__, array('AAM', 'activate'));
    register_uninstall_hook(__FILE__, array('AAM', 'uninstall'));
}