get('action')) { case 'auth': if ($rpc->get_arg('api_key') == get_option('e2pdf_zapier_api_key')) { wp_send_json_success(); } else { wp_send_json_error(null, 401); } break; default: break; } } } // adobe rpc service public function adobe($rpc) { if (is_a($rpc, 'Model_E2pdf_Rpc')) { switch ($rpc->get('action')) { case 'auth': if ($rpc->get_arg('api_key') == get_option('e2pdf_adobe_api_key')) { if ($rpc->get_arg('code')) { $this->redirect( $this->helper->get_url( [ 'page' => 'e2pdf-integrations', 'action' => 'adobesign', 'code' => $rpc->get_arg('code'), '_wpnonce' => wp_create_nonce('e2pdf_adobe'), ] ) ); } } break; default: break; } } } // gdrive rpc service public function gdrive($rpc) { if (is_a($rpc, 'Model_E2pdf_Rpc')) { switch ($rpc->get('action')) { case 'auth': if ($rpc->get_arg('api_key') == get_option('e2pdf_gdrive_api_key')) { if ($rpc->get_arg('code') || $rpc->get_arg('error')) { if ($rpc->get_arg('code')) { (new Model_E2pdf_Gdrive())->get_token($rpc->get_arg('code')); } $this->redirect( $this->helper->get_url( [ 'page' => 'e2pdf-integrations', 'action' => 'gdrive', ] ) ); } } else { wp_send_json_error(null, 401); } break; default: break; } } } public function restore($rpc) { if (is_a($rpc, 'Model_E2pdf_Rpc')) { switch ($rpc->get('action')) { case 'request': if (get_transient('e2pdf_restore_key') && $rpc->get_arg('restore_key') === get_transient('e2pdf_restore_key')) { wp_send_json_success([ 'restore_key' => get_transient('e2pdf_restore_key') ]); } else { wp_send_json_error(null, 401); } break; default: break; } } } }