예제 #1
0
 public static function activate()
 {
     global $pp_db_setup_done;
     // set_current_user may have triggered DB setup already
     if (empty($pp_db_setup_done)) {
         $ver = (array) get_option('pp_c_version');
         $db_ver = isset($ver['db_version']) ? $ver['db_version'] : '';
         require_once dirname(__FILE__) . '/db-setup_pp.php';
         PP_DB_Setup::db_setup($db_ver);
     }
     require_once dirname(__FILE__) . '/admin/update_pp.php';
     PP_Updated::sync_wproles();
     update_option('pp_activation', true);
     do_action('pp_activate');
 }
예제 #2
0
 function act_sync_wproles($user_ids = '', $role_name = '', $blog_id_arg = '')
 {
     require_once dirname(__FILE__) . '/update_pp.php';
     PP_Updated::sync_wproles($user_ids, $role_name, $blog_id_arg);
 }
예제 #3
0
function _pp_act_on_init()
{
    if (defined('INIT_ACTION_DONE_PP') || ppc_interrupt_init()) {
        return;
    }
    define('INIT_ACTION_DONE_PP', true);
    // --- version check ---
    $ver = get_option('pp_c_version');
    if (!$ver || empty($ver['db_version']) || version_compare(PPC_DB_VERSION, $ver['db_version'], '!=')) {
        require_once dirname(__FILE__) . '/db-setup_pp.php';
        PP_DB_Setup::db_setup($ver['db_version']);
        if (!$ver) {
            require_once dirname(__FILE__) . '/admin/update_pp.php';
            PP_Updated::version_updated('');
        }
        update_option('pp_c_version', array('version' => PPC_VERSION, 'db_version' => PPC_DB_VERSION));
    }
    if ($ver && !empty($ver['version'])) {
        // These maintenance operations only apply when a previous version of PP was installed
        if (version_compare(PPC_VERSION, $ver['version'], '!=')) {
            require_once dirname(__FILE__) . '/admin/update_pp.php';
            PP_Updated::version_updated($ver['version']);
            update_option('pp_c_version', array('version' => PPC_VERSION, 'db_version' => PPC_DB_VERSION));
        }
        if (PP_MULTISITE && !pp_get_option('wp_role_sync')) {
            require_once dirname(__FILE__) . '/admin/update_pp.php';
            PP_Updated::sync_wproles();
        }
    } else {
        // first execution after install
        if (!get_option('ppperm_added_role_caps_21beta')) {
            pp_populate_roles();
        }
    }
    // --- end version check ---
    global $pp_default_options, $pp_site_options, $pp_cap_helper;
    $pp_default_options = apply_filters('pp_default_options', $pp_default_options);
    // already loaded these early, so apply filter again for extensions
    $pp_site_options = apply_filters('pp_options', $pp_site_options);
    if (PP_MULTISITE) {
        global $pp_netwide_options;
        $pp_netwide_options = apply_filters('pp_netwide_options', array('support_key', 'beta_updates'));
    }
    // PP_Cap_Helper() instantiation forces type-specific cap names for enabled post types and taxonomies
    require_once dirname(__FILE__) . '/cap-helper_pp.php';
    $pp_cap_helper = new PP_Cap_Helper();
    do_action('pp_pre_init');
    if (is_admin()) {
        load_plugin_textdomain('pp', false, PPC_FOLDER . '/languages');
        pp_admin_init();
    }
}