31 lines
1.7 KiB
PHP
31 lines
1.7 KiB
PHP
<?php
|
|
if(!defined('ABSPATH')) exit;
|
|
class WMF_Service_Recaptcha extends WMF_Service {
|
|
public $id='recaptcha'; public $label='reCAPTCHA v2'; public $group='antispam';
|
|
protected $credentials=array('site_key'=>'','secret_key'=>'');
|
|
public function is_connected(){return!empty($this->credentials['site_key'])&&!empty($this->credentials['secret_key']);}
|
|
public function admin_widget($prev=array()){
|
|
$c = $this->get_credentials();
|
|
$int = wmf_get_integrations();
|
|
$act = $int->action_update;
|
|
$nonce= wp_create_nonce($act);
|
|
$conn = $this->is_connected();
|
|
echo '<div class="wmf-widget-body">';
|
|
if($conn) echo '<div class="wmf-connected-badge">✓ Verbunden</div>';
|
|
echo '<form class="wmf-int-form">';
|
|
echo '<input type="hidden" name="_wpnonce" value="'.esc_attr($nonce).'">';
|
|
echo '<input type="hidden" name="action" value="'.esc_attr($act).'">';
|
|
echo '<input type="hidden" name="services[]" value="recaptcha">';
|
|
|
|
echo '<p><label>Website-Schluessel (Site Key)</label>';
|
|
echo '<input type="text" name="credentials[recaptcha][site_key]" value="'.esc_attr($c['site_key']??'').'" class="widefat"></p>';
|
|
echo '<p><label>Geheimer Schluessel (Secret Key)</label>';
|
|
echo '<input type="text" name="credentials[recaptcha][secret_key]" value="'.esc_attr($c['secret_key']??'').'" class="widefat"></p>';
|
|
echo '<p class="description"><a href="https://www.google.com/recaptcha/admin/create" target="_blank">Schluessel bei Google erstellen →</a> (Typ: v2 Kontrollkaestchen)</p>';
|
|
|
|
echo '<p><button type="submit" class="button button-primary">Speichern</button></p>';
|
|
echo '</form>';
|
|
|
|
echo '</div>';
|
|
}
|
|
} |