Jetpack_Protect_Module::configuration_load PHP Méthode

configuration_load() public méthode

Get or delete API key
public configuration_load ( )
    public function configuration_load()
    {
        if (isset($_POST['action']) && $_POST['action'] == 'jetpack_protect_save_whitelist' && wp_verify_nonce($_POST['_wpnonce'], 'jetpack-protect')) {
            $whitelist = str_replace(' ', '', $_POST['whitelist']);
            $whitelist = explode(PHP_EOL, $whitelist);
            $result = jetpack_protect_save_whitelist($whitelist);
            $this->whitelist_saved = !is_wp_error($result);
            $this->whitelist_error = is_wp_error($result);
        }
        if (isset($_POST['action']) && 'get_protect_key' == $_POST['action'] && wp_verify_nonce($_POST['_wpnonce'], 'jetpack-protect')) {
            $result = $this->get_protect_key();
            // Only redirect on success
            // If it fails we need access to $this->api_key_error
            if ($result) {
                wp_safe_redirect(Jetpack::module_configuration_url('protect'));
            }
        }
        $this->api_key = get_site_option('jetpack_protect_key', false);
        $this->user_ip = jetpack_protect_get_ip();
    }