Upload folder via GUI - integrations
This commit is contained in:
@@ -0,0 +1,46 @@
|
||||
<?php
|
||||
if(!defined('ABSPATH')) exit;
|
||||
class WMF_Service_ActiveCampaign extends WMF_Service {
|
||||
public $id='active-campaign'; public $label='ActiveCampaign'; public $group='email';
|
||||
protected $credentials=array('api_url'=>'','api_key'=>'','list_id'=>'');
|
||||
public function is_connected(){return!empty($this->credentials['api_url'])&&!empty($this->credentials['api_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="active-campaign">';
|
||||
|
||||
echo '<p><label>Konto-URL</label>';
|
||||
echo '<input type="url" name="credentials[active-campaign][api_url]" value="'.esc_attr($c['api_url']??'').'" class="widefat" placeholder="https://KONTO.api-us1.com">';
|
||||
echo '<span class="description">Einstellungen → Entwickler → API-Zugang</span></p>';
|
||||
echo '<p><label>API-Schluessel</label>';
|
||||
echo '<input type="text" name="credentials[active-campaign][api_key]" value="'.esc_attr($c['api_key']??'').'" class="widefat" autocomplete="off"></p>';
|
||||
echo '<p><label>Listen-ID (optional)</label>';
|
||||
echo '<input type="text" name="credentials[active-campaign][list_id]" value="'.esc_attr($c['list_id']??'').'" class="widefat"></p>';
|
||||
|
||||
echo '<p><button type="submit" class="button button-primary">Speichern</button></p>';
|
||||
echo '</form>';
|
||||
|
||||
echo '</div>';
|
||||
}
|
||||
public function load(){add_action('wmf_form_submitted',array($this,'subscribe'),10,5);}
|
||||
public function subscribe($form_id,$meta,$fields,$values,$sub_id){
|
||||
if(!$this->is_connected()) return;
|
||||
$email=''; foreach($fields as $f){if(($f['type']??'')==='email'&&!empty($values[$f['id']])){$email=$values[$f['id']];break;}}
|
||||
if(!is_email($email)) return;
|
||||
$api=rtrim($this->credentials['api_url'],'/'); $key=$this->credentials['api_key'];
|
||||
$res=wp_remote_post($api.'/api/3/contacts',array('headers'=>array('Api-Token'=>$key,'Content-Type'=>'application/json'),'body'=>wp_json_encode(array('contact'=>array('email'=>$email))),'timeout'=>10));
|
||||
if(!is_wp_error($res)&&!empty($this->credentials['list_id'])){
|
||||
$body=json_decode(wp_remote_retrieve_body($res),true);
|
||||
$cid=$body['contact']['id']??0;
|
||||
if($cid) wp_remote_post($api.'/api/3/contactLists',array('headers'=>array('Api-Token'=>$key,'Content-Type'=>'application/json'),'body'=>wp_json_encode(array('contactList'=>array('list'=>intval($this->credentials['list_id']),'contact'=>$cid,'status'=>1))),'timeout'=>10));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
if(!defined('ABSPATH')) exit;
|
||||
class WMF_Service_ConvertKit extends WMF_Service {
|
||||
public $id='convertkit'; public $label='ConvertKit / Kit'; public $group='email';
|
||||
protected $credentials=array('api_key'=>'','api_secret'=>'','form_id'=>'');
|
||||
public function is_connected(){return!empty($this->credentials['api_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="convertkit">';
|
||||
|
||||
echo '<p><label>API-Schluessel</label>';
|
||||
echo '<input type="text" name="credentials[convertkit][api_key]" value="'.esc_attr($c['api_key']??'').'" class="widefat" autocomplete="off">';
|
||||
echo '<span class="description"><a href="https://app.kit.com/account_settings/developer_settings" target="_blank">API-Schluessel in Kit/ConvertKit →</a></span></p>';
|
||||
echo '<p><label>API-Secret</label>';
|
||||
echo '<input type="text" name="credentials[convertkit][api_secret]" value="'.esc_attr($c['api_secret']??'').'" class="widefat" autocomplete="off"></p>';
|
||||
echo '<p><label>Formular-ID (optional)</label>';
|
||||
echo '<input type="text" name="credentials[convertkit][form_id]" value="'.esc_attr($c['form_id']??'').'" class="widefat"></p>';
|
||||
|
||||
echo '<p><button type="submit" class="button button-primary">Speichern</button></p>';
|
||||
echo '</form>';
|
||||
|
||||
echo '</div>';
|
||||
}
|
||||
public function load(){add_action('wmf_form_submitted',array($this,'subscribe'),10,5);}
|
||||
public function subscribe($form_id,$meta,$fields,$values,$sub_id){
|
||||
if(!$this->is_connected()) return;
|
||||
$email=''; foreach($fields as $f){if(($f['type']??'')==='email'&&!empty($values[$f['id']])){$email=$values[$f['id']];break;}}
|
||||
if(!is_email($email)) return;
|
||||
$fid=$this->credentials['form_id']??'';
|
||||
if($fid) wp_remote_post("https://api.convertkit.com/v3/forms/{$fid}/subscribe",array('body'=>array('api_key'=>$this->credentials['api_key'],'email'=>$email),'timeout'=>10));
|
||||
else wp_remote_post('https://api.convertkit.com/v3/subscribers',array('body'=>array('api_secret'=>$this->credentials['api_secret']??'','email_address'=>$email),'timeout'=>10));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
if(!defined('ABSPATH')) exit;
|
||||
class WMF_Service_Google_Analytics extends WMF_Service {
|
||||
public $id='google-analytics'; public $label='Google Analytics (GA4)'; public $group='analytics';
|
||||
protected $credentials=array('measurement_id'=>'');
|
||||
public function is_connected(){return!empty($this->credentials['measurement_id']);}
|
||||
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="google-analytics">';
|
||||
|
||||
echo '<p><label>Mess-ID (GA4)</label>';
|
||||
echo '<input type="text" name="credentials[google-analytics][measurement_id]" value="'.esc_attr($c['measurement_id']??'').'" class="widefat" placeholder="G-XXXXXXXXXX">';
|
||||
echo '<span class="description">Google Analytics → Verwaltung → Datenstroeme → Mess-ID. Das gtag.js-Skript wird automatisch eingebunden.</span></p>';
|
||||
|
||||
echo '<p><button type="submit" class="button button-primary">Speichern</button></p>';
|
||||
echo '</form>';
|
||||
|
||||
echo '</div>';
|
||||
}
|
||||
public function load(){if($this->is_connected()) add_action('wp_footer',array($this,'inject_gtag'));}
|
||||
public function inject_gtag(){
|
||||
$id=esc_js($this->credentials['measurement_id']);
|
||||
echo '<script async src="https://www.googletagmanager.com/gtag/js?id='.$id.'"></script>';
|
||||
echo '<script>window.dataLayer=window.dataLayer||[];function gtag(){dataLayer.push(arguments);}gtag("js",new Date());gtag("config","'.$id.'");</script>';
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
if(!defined('ABSPATH')) exit;
|
||||
class WMF_Service_Google_Places extends WMF_Service {
|
||||
public $id='google-places'; public $label='Google Places (Autocomplete)'; public $group='address';
|
||||
protected $credentials=array('api_key'=>'');
|
||||
public function is_connected(){return!empty($this->credentials['api_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="google-places">';
|
||||
|
||||
echo '<p><label>API-Schluessel</label>';
|
||||
echo '<input type="text" name="credentials[google-places][api_key]" value="'.esc_attr($c['api_key']??'').'" class="widefat" autocomplete="off">';
|
||||
echo '<span class="description"><a href="https://console.cloud.google.com/apis/credentials" target="_blank">Google Cloud Console →</a> Places API aktivieren.</span></p>';
|
||||
|
||||
echo '<p><button type="submit" class="button button-primary">Speichern</button></p>';
|
||||
echo '</form>';
|
||||
|
||||
echo '</div>';
|
||||
}
|
||||
}
|
||||
46
integrations/services/mailchimp/class-service-mailchimp.php
Normal file
46
integrations/services/mailchimp/class-service-mailchimp.php
Normal file
@@ -0,0 +1,46 @@
|
||||
<?php
|
||||
if(!defined('ABSPATH')) exit;
|
||||
class WMF_Service_Mailchimp extends WMF_Service {
|
||||
public $id='mailchimp'; public $label='Mailchimp'; public $group='email';
|
||||
protected $credentials=array('api_key'=>'','list_id'=>'');
|
||||
public function is_connected(){return!empty($this->credentials['api_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="mailchimp">';
|
||||
|
||||
echo '<p><label>API-Schluessel</label>';
|
||||
echo '<input type="text" name="credentials[mailchimp][api_key]" value="'.esc_attr($c['api_key']??'').'" class="widefat" autocomplete="off">';
|
||||
echo '<span class="description"><a href="https://mailchimp.com/help/about-api-keys/" target="_blank">API-Schluessel erstellen →</a></span></p>';
|
||||
echo '<p><label>Audience-ID (Listen-ID)</label>';
|
||||
echo '<input type="text" name="credentials[mailchimp][list_id]" value="'.esc_attr($c['list_id']??'').'" class="widefat">';
|
||||
echo '<span class="description">Einstellungen → Audience → Audience ID</span></p>';
|
||||
|
||||
echo '<p><button type="submit" class="button button-primary">Speichern</button></p>';
|
||||
echo '</form>';
|
||||
|
||||
echo '</div>';
|
||||
}
|
||||
public function load(){add_action('wmf_form_submitted',array($this,'subscribe'),10,5);}
|
||||
public function subscribe($form_id,$meta,$fields,$values,$sub_id){
|
||||
if(!$this->is_connected()) return;
|
||||
$email='';
|
||||
foreach($fields as $f){if(($f['type']??'')==='email'&&!empty($values[$f['id']])&&is_email($values[$f['id']])){$email=$values[$f['id']];break;}}
|
||||
if(!is_email($email)||empty($this->credentials['list_id'])) return;
|
||||
$key=$this->credentials['api_key'];
|
||||
$dash=strrpos($key,'-'); if($dash===false) return;
|
||||
$dc=substr($key,$dash+1);
|
||||
wp_remote_post("https://{$dc}.api.mailchimp.com/3.0/lists/{$this->credentials['list_id']}/members",array(
|
||||
'headers'=>array('Authorization'=>'Basic '.base64_encode('key:'.$key),'Content-Type'=>'application/json'),
|
||||
'body'=>wp_json_encode(array('email_address'=>$email,'status'=>'subscribed')),'timeout'=>10,
|
||||
));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
<?php
|
||||
if(!defined('ABSPATH')) exit;
|
||||
class WMF_Service_MailerLite extends WMF_Service {
|
||||
public $id='mailerlite'; public $label='MailerLite'; public $group='email';
|
||||
protected $credentials=array('api_key'=>'','group_id'=>'');
|
||||
public function is_connected(){return!empty($this->credentials['api_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="mailerlite">';
|
||||
|
||||
echo '<p><label>API-Schluessel</label>';
|
||||
echo '<input type="text" name="credentials[mailerlite][api_key]" value="'.esc_attr($c['api_key']??'').'" class="widefat" autocomplete="off">';
|
||||
echo '<span class="description"><a href="https://app.mailerlite.com/integrations/api/" target="_blank">API-Schluessel in MailerLite →</a></span></p>';
|
||||
echo '<p><label>Gruppen-ID (optional)</label>';
|
||||
echo '<input type="text" name="credentials[mailerlite][group_id]" value="'.esc_attr($c['group_id']??'').'" class="widefat">';
|
||||
echo '<span class="description">Leer lassen fuer Standard-Liste</span></p>';
|
||||
|
||||
echo '<p><button type="submit" class="button button-primary">Speichern</button></p>';
|
||||
echo '</form>';
|
||||
|
||||
echo '</div>';
|
||||
}
|
||||
public function load(){add_action('wmf_form_submitted',array($this,'subscribe'),10,5);}
|
||||
public function subscribe($form_id,$meta,$fields,$values,$sub_id){
|
||||
if(!$this->is_connected()) return;
|
||||
$email=''; foreach($fields as $f){if(($f['type']??'')==='email'&&!empty($values[$f['id']])){$email=$values[$f['id']];break;}}
|
||||
if(!is_email($email)) return;
|
||||
$name=''; foreach($fields as $f){if(($f['type']??'')==='text'&&!empty($values[$f['id']])){$name=$values[$f['id']];break;}}
|
||||
$body=array('email'=>$email); if($name) $body['name']=$name;
|
||||
$gid=$this->credentials['group_id']??'';
|
||||
$url=$gid?"https://api.mailerlite.com/api/v2/groups/{$gid}/subscribers":'https://api.mailerlite.com/api/v2/subscribers';
|
||||
wp_remote_post($url,array('headers'=>array('X-MailerLite-ApiKey'=>$this->credentials['api_key'],'Content-Type'=>'application/json'),'body'=>wp_json_encode($body),'timeout'=>10));
|
||||
}
|
||||
}
|
||||
38
integrations/services/paypal/class-service-paypal.php
Normal file
38
integrations/services/paypal/class-service-paypal.php
Normal file
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
if(!defined('ABSPATH')) exit;
|
||||
class WMF_Service_PayPal extends WMF_Service {
|
||||
public $id='paypal'; public $label='PayPal'; public $group='payments';
|
||||
protected $credentials=array('mode'=>'sandbox','live_client'=>'','live_secret'=>'','sandbox_client'=>'','sandbox_secret'=>'');
|
||||
public function is_connected(){$m=$this->credentials['mode']??'sandbox';return($m==='live')?!empty($this->credentials['live_secret']):!empty($this->credentials['sandbox_secret']);}
|
||||
public function admin_widget($prev=array()){
|
||||
$c=$this->get_credentials();
|
||||
$int=wmf_get_integrations();
|
||||
$act=$int->action_update;
|
||||
$nonce=wp_create_nonce($act);
|
||||
$m=$c['mode']??'sandbox';
|
||||
$conn=$this->is_connected();
|
||||
echo '<div class="wmf-widget-body">';
|
||||
if($conn) echo '<div class="wmf-connected-badge">✓ Verbunden ('.($m==='live'?'Live':'Sandbox').')</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="paypal">';
|
||||
echo '<div class="wmf-mode-switch">';
|
||||
echo '<label class="wmf-mode-btn '.($m==='sandbox'?'active':'').'"><input type="radio" name="credentials[paypal][mode]" value="sandbox" '.checked($m,'sandbox',false).' onchange="wmfPaypalMode(this)"> Sandbox</label>';
|
||||
echo '<label class="wmf-mode-btn '.($m==='live'?'active':'').'"><input type="radio" name="credentials[paypal][mode]" value="live" '.checked($m,'live',false).' onchange="wmfPaypalMode(this)"> Live</label>';
|
||||
echo '</div>';
|
||||
echo '<div id="wmf-paypal-sandbox" '.($m==='live'?'style="display:none"':'').'>';
|
||||
echo '<p><label>Sandbox Client-ID</label><input type="text" name="credentials[paypal][sandbox_client]" value="'.esc_attr($c['sandbox_client']??'').'" class="widefat"></p>';
|
||||
echo '<p><label>Sandbox Secret</label><input type="password" name="credentials[paypal][sandbox_secret]" value="'.esc_attr($c['sandbox_secret']??'').'" class="widefat"></p>';
|
||||
echo '</div>';
|
||||
echo '<div id="wmf-paypal-live" '.($m==='sandbox'?'style="display:none"':'').'>';
|
||||
echo '<p><label>Live Client-ID</label><input type="text" name="credentials[paypal][live_client]" value="'.esc_attr($c['live_client']??'').'" class="widefat"></p>';
|
||||
echo '<p><label>Live Secret</label><input type="password" name="credentials[paypal][live_secret]" value="'.esc_attr($c['live_secret']??'').'" class="widefat"></p>';
|
||||
echo '</div>';
|
||||
echo '<p class="description"><a href="https://developer.paypal.com/dashboard/applications" target="_blank">PayPal Developer Dashboard →</a></p>';
|
||||
echo '<p><button type="submit" class="button button-primary">Speichern</button></p>';
|
||||
echo '</form>';
|
||||
echo '<script>function wmfPaypalMode(el){document.getElementById("wmf-paypal-sandbox").style.display=el.value==="sandbox"?"":"none";document.getElementById("wmf-paypal-live").style.display=el.value==="live"?"":"none";}</script>';
|
||||
echo '</div>';
|
||||
}
|
||||
}
|
||||
31
integrations/services/recaptcha/class-service-recaptcha.php
Normal file
31
integrations/services/recaptcha/class-service-recaptcha.php
Normal file
@@ -0,0 +1,31 @@
|
||||
<?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>';
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
if(!defined('ABSPATH')) exit;
|
||||
class WMF_Service_RecaptchaV3 extends WMF_Service {
|
||||
public $id='recaptchav3'; public $label='reCAPTCHA v3'; public $group='antispam';
|
||||
protected $credentials=array('site_key'=>'','secret_key'=>'','score'=>'0.5');
|
||||
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="recaptchav3">';
|
||||
|
||||
echo '<p><label>Website-Schluessel (Site Key)</label>';
|
||||
echo '<input type="text" name="credentials[recaptchav3][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[recaptchav3][secret_key]" value="'.esc_attr($c['secret_key']??'').'" class="widefat"></p>';
|
||||
echo '<p><label>Mindest-Score (0.0-1.0, empfohlen: 0.5)</label>';
|
||||
echo '<input type="number" min="0" max="1" step="0.1" name="credentials[recaptchav3][score]" value="'.esc_attr($c['score']??'0.5').'" class="small-text"></p>';
|
||||
echo '<p class="description"><a href="https://www.google.com/recaptcha/admin/create" target="_blank">Schluessel bei Google erstellen →</a> (Typ: v3)</p>';
|
||||
|
||||
echo '<p><button type="submit" class="button button-primary">Speichern</button></p>';
|
||||
echo '</form>';
|
||||
|
||||
echo '</div>';
|
||||
}
|
||||
}
|
||||
38
integrations/services/stripe/class-service-stripe.php
Normal file
38
integrations/services/stripe/class-service-stripe.php
Normal file
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
if(!defined('ABSPATH')) exit;
|
||||
class WMF_Service_Stripe extends WMF_Service {
|
||||
public $id='stripe'; public $label='Stripe'; public $group='payments';
|
||||
protected $credentials=array('mode'=>'test','live_public'=>'','live_secret'=>'','test_public'=>'','test_secret'=>'');
|
||||
public function is_connected(){$m=$this->credentials['mode']??'test';return($m==='live')?!empty($this->credentials['live_secret']):!empty($this->credentials['test_secret']);}
|
||||
public function admin_widget($prev=array()){
|
||||
$c=$this->get_credentials();
|
||||
$int=wmf_get_integrations();
|
||||
$act=$int->action_update;
|
||||
$nonce=wp_create_nonce($act);
|
||||
$m=$c['mode']??'test';
|
||||
$conn=$this->is_connected();
|
||||
echo '<div class="wmf-widget-body">';
|
||||
if($conn) echo '<div class="wmf-connected-badge">✓ Verbunden ('.($m==='live'?'Live':'Test').')</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="stripe">';
|
||||
echo '<div class="wmf-mode-switch">';
|
||||
echo '<label class="wmf-mode-btn '.($m==='test'?'active':'').'"><input type="radio" name="credentials[stripe][mode]" value="test" '.checked($m,'test',false).' onchange="wmfStripeMode(this)"> Test</label>';
|
||||
echo '<label class="wmf-mode-btn '.($m==='live'?'active':'').'"><input type="radio" name="credentials[stripe][mode]" value="live" '.checked($m,'live',false).' onchange="wmfStripeMode(this)"> Live</label>';
|
||||
echo '</div>';
|
||||
echo '<div id="wmf-stripe-test" '.($m==='live'?'style="display:none"':'').'>';
|
||||
echo '<p><label>Test Publishable Key</label><input type="text" name="credentials[stripe][test_public]" value="'.esc_attr($c['test_public']??'').'" class="widefat" placeholder="pk_test_..."></p>';
|
||||
echo '<p><label>Test Secret Key</label><input type="password" name="credentials[stripe][test_secret]" value="'.esc_attr($c['test_secret']??'').'" class="widefat" placeholder="sk_test_..."></p>';
|
||||
echo '</div>';
|
||||
echo '<div id="wmf-stripe-live" '.($m==='test'?'style="display:none"':'').'>';
|
||||
echo '<p><label>Live Publishable Key</label><input type="text" name="credentials[stripe][live_public]" value="'.esc_attr($c['live_public']??'').'" class="widefat" placeholder="pk_live_..."></p>';
|
||||
echo '<p><label>Live Secret Key</label><input type="password" name="credentials[stripe][live_secret]" value="'.esc_attr($c['live_secret']??'').'" class="widefat" placeholder="sk_live_..."></p>';
|
||||
echo '</div>';
|
||||
echo '<p class="description"><a href="https://dashboard.stripe.com/apikeys" target="_blank">Stripe Dashboard → API-Schluessel</a></p>';
|
||||
echo '<p><button type="submit" class="button button-primary">Speichern</button></p>';
|
||||
echo '</form>';
|
||||
echo '<script>function wmfStripeMode(el){document.getElementById("wmf-stripe-test").style.display=el.value==="test"?"":"none";document.getElementById("wmf-stripe-live").style.display=el.value==="live"?"":"none";}</script>';
|
||||
echo '</div>';
|
||||
}
|
||||
}
|
||||
37
integrations/services/zapier/class-service-zapier.php
Normal file
37
integrations/services/zapier/class-service-zapier.php
Normal file
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
if(!defined('ABSPATH')) exit;
|
||||
class WMF_Service_Zapier extends WMF_Service {
|
||||
public $id='zapier'; public $label='Zapier'; public $group='automation';
|
||||
protected $credentials=array('webhook_url'=>'');
|
||||
public function is_connected(){return!empty($this->credentials['webhook_url']);}
|
||||
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="zapier">';
|
||||
|
||||
echo '<p><label>Webhook-URL</label>';
|
||||
echo '<input type="url" name="credentials[zapier][webhook_url]" value="'.esc_attr($c['webhook_url']??'').'" class="widefat" placeholder="https://hooks.zapier.com/hooks/catch/...">';
|
||||
echo '<span class="description">In Zapier: Neuer Zap → Trigger "Webhooks by Zapier" → "Catch Hook" → URL kopieren.</span></p>';
|
||||
|
||||
echo '<p><button type="submit" class="button button-primary">Speichern</button></p>';
|
||||
echo '</form>';
|
||||
|
||||
echo '</div>';
|
||||
}
|
||||
public function load(){add_action('wmf_form_submitted',array($this,'send'),10,5);}
|
||||
public function send($form_id,$meta,$fields,$values,$sub_id){
|
||||
if(!$this->is_connected()) return;
|
||||
wp_remote_post($this->credentials['webhook_url'],array(
|
||||
'body'=>wp_json_encode(array('form_id'=>$form_id,'submission_id'=>$sub_id,'data'=>$values,'site'=>get_site_url(),'date'=>current_time('c'))),
|
||||
'headers'=>array('Content-Type'=>'application/json'),'timeout'=>5,'blocking'=>false,
|
||||
));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user