configure(array('instanceUrl' => $this->instanceUrl, 'siteKey' => $this->siteKey, 'secretKey' => $this->secretKey)); $this->setValidation($validator); } public function render() { wp_enqueue_script( 'accua-forms-cap', ACCUA_FORMS_DIR_URL . 'assets/js/frontend/cap.js', array('jquery'), ACCUA_FORMS_JS_VERSION, true ); $instance_url = trailingslashit($this->instanceUrl); /** * Filter the URL the Cap widget script is loaded from. * * Defaults to the assets server of the configured Cap Standalone instance * (requires ENABLE_ASSETS_SERVER=true on the instance). * * @param string $widget_url URL of the cap-widget script. * @param string $instance_url The configured Cap instance URL. */ $widget_url = apply_filters('accua_forms_cap_widget_url', $instance_url . 'assets/widget.js', $this->instanceUrl); /** * Filter the URL of the WASM solver loaded by the Cap widget. * * @param string $wasm_url URL of the Cap WASM binary. * @param string $instance_url The configured Cap instance URL. */ $wasm_url = apply_filters('accua_forms_cap_wasm_url', $instance_url . 'assets/cap_wasm_bg.wasm', $this->instanceUrl); $js_registration = _accua_forms_json_encode(array( $this->attributes["id"], array( 'endpoint' => $instance_url . rawurlencode($this->siteKey) . '/', 'widgetUrl' => $widget_url, 'wasmUrl' => $wasm_url, 'i18n' => array( /* translators: Label shown on the Cap captcha widget before verification */ 'initial-state' => __("I'm a human", 'contact-forms'), /* translators: Label shown on the Cap captcha widget while verifying */ 'verifying-label' => __('Verifying…', 'contact-forms'), /* translators: Label shown on the Cap captcha widget after verification */ 'solved-label' => __('Verified', 'contact-forms'), /* translators: Label shown on the Cap captcha widget on error */ 'error-label' => __('Verification failed. Try again.', 'contact-forms'), ), ), $this->form ? $this->form->getLanguage() : '', )); $field_id = htmlspecialchars($this->attributes["id"], ENT_QUOTES); echo <<
EOT; } }