public function render() { $connect_nonce = wp_create_nonce(self::CONNECT_CLEF_OAUTH_ACTION); $redirect_url = add_query_arg(array('_wpnonce' => $connect_nonce, 'connect' => true), admin_url("/admin.php?page=" . $this->settings->settings_path)); echo ClefUtils::render_template('user_settings.tpl', array("options" => array("connected" => ClefUtils::user_has_clef(), "appID" => $this->settings->get('clef_settings_app_id'), "redirectURL" => $redirect_url, "clefJSURL" => CLEF_JS_URL, "state" => ClefUtils::get_state(), "nonces" => array("connectClef" => $connect_nonce, "disconnectClef" => wp_create_nonce(self::DISCONNECT_CLEF_ACTION))))); $this->rendered = true; }
public static function verify_state() { $request_state = ClefUtils::isset_GET('state') ? ClefUtils::isset_GET('state') : ClefUtils::isset_POST('state'); $correct_state = ClefUtils::get_state(); if ($request_state && $correct_state && $correct_state == $request_state) { ClefUtils::initialize_state(true); return true; } else { throw new ClefStateException('The state parameter is not verified. This may be due to this page being cached by another WordPress plugin. Please refresh your page and try again'); } }
public function render() { echo ClefUtils::render_template('user_settings.tpl', array("connect_error" => $this->connect_error, "options" => array("connected" => ClefUtils::user_has_clef(), "appID" => $this->settings->get('clef_settings_app_id'), "clefJSURL" => CLEF_JS_URL, "state" => ClefUtils::get_state(), "nonces" => array("disconnectClef" => wp_create_nonce(self::DISCONNECT_CLEF_ACTION))))); $this->rendered = true; }
<div class="clef-button-to-render" data-app-id='<?php echo $app_id; ?> ' data-type="<?php echo $type; ?> " <?php if ($embed) { ?> data-embed="true" <?php } ?> data-state="<?php echo ClefUtils::get_state(); ?> " data-redirect-url='<?php echo $redirect_url; ?> ' <?php if (isset($custom['logo'])) { ?> data-custom-logo="<?php echo $custom['logo']; ?> "<?php } ?>
public static function verify_state() { $request_state = ClefUtils::isset_GET('state') ? ClefUtils::isset_GET('state') : ClefUtils::isset_POST('state'); $correct_state = ClefUtils::get_state(); if ($request_state && $correct_state && $correct_state == $request_state) { ClefUtils::initialize_state(true); return true; } else { throw new ClefStateException('The state parameter is not verified. This may be due to this page being cached by another WordPress plugin. Please refresh your page and try again. If the issue persists, please follow <a href="http://support.getclef.com/article/95-the-state-parameter-is-not-verified-error#caching" target="_blank">this guide</a> to debug the issue.'); } }