diff --git a/integrations/assets/css/admin.css b/integrations/assets/css/admin.css
new file mode 100644
index 0000000..73fbaa8
--- /dev/null
+++ b/integrations/assets/css/admin.css
@@ -0,0 +1,36 @@
+.wmf-integrations-widget .mode-group{margin:0 0 1em;}
+.wmf-buttongroup{display:flex;flex-wrap:wrap;gap:4px;margin-top:4px;}
+.wmf-buttongroup input[type=radio]{position:absolute;opacity:0;width:0;height:0;}
+.wmf-buttongroup label span{display:inline-block;padding:4px 12px;border:1px solid #8c8f94;border-radius:3px;cursor:pointer;background:#f6f7f7;font-size:13px;line-height:2;}
+.wmf-buttongroup input[type=radio]:checked+span{background:#2271b1;border-color:#2271b1;color:#fff;}
+.wmf-service-integration{display:none;}
+.wmf-stripe-block,.wmf-paypal-block{display:none;}
+#wmf-service-stripe[data-active-mode=live] .wmf-stripe-block-live,
+#wmf-service-stripe[data-active-mode=test] .wmf-stripe-block-test,
+#wmf-service-paypal[data-active-mode=live] .wmf-paypal-block-live,
+#wmf-service-paypal[data-active-mode=sandbox] .wmf-paypal-block-sandbox{display:block;}
+#wmf-int-widget-recaptcha .has-service-selection[data-active-service=recaptcha] #wmf-service-recaptcha,
+#wmf-int-widget-recaptcha .has-service-selection[data-active-service=recaptchav3] #wmf-service-recaptchav3{display:block;}
+#wmf-integration-toolbar{margin-bottom:15px;}
+#wmf-integration-toolbar .media-toolbar-secondary{float:left;margin-top:11px;}
+#wmf-no-integrations-found{color:#646970;font-size:16px;text-align:center;padding:60px 0;display:none;}
+#wmf-integrations-results-wrap.no-results #wmf-no-integrations-found{display:block;}
+#wmf-integrations-results{display:none;}
+#wmf-integrations-results .postbox-container{width:25%;padding:0 8px;box-sizing:border-box;float:left;}
+.wmf-integrations-widget{box-sizing:border-box;}
+.wmf-integrations-widget .handle-actions{display:none;}
+.wmf-integrations-widget.closed .inside{display:block;}
+@media(max-width:799px){#wmf-integrations-results .postbox-container{width:100%;}}
+
+/* Widget-Inhalte */
+.wmf-widget-body{padding:4px 0 0;}
+.wmf-widget-body p{margin-bottom:12px;}
+.wmf-widget-body label{display:block;font-weight:600;font-size:12px;margin-bottom:4px;color:#1d2327;}
+.wmf-widget-body .widefat{width:100%;box-sizing:border-box;}
+.wmf-widget-body .description{font-size:12px;color:#646970;margin-top:3px;display:block;}
+.wmf-widget-body a{color:#2271b1;}
+.wmf-connected-badge{display:inline-flex;align-items:center;gap:5px;background:#f0fdf4;border:1px solid #46b450;color:#166534;padding:4px 10px;border-radius:12px;font-size:12px;font-weight:600;margin-bottom:12px;}
+.wmf-mode-switch{display:flex;gap:4px;margin-bottom:14px;}
+.wmf-mode-btn{padding:5px 14px;border:1px solid #8c8f94;border-radius:3px;cursor:pointer;font-size:13px;background:#f6f7f7;line-height:1.8;}
+.wmf-mode-btn input[type=radio]{display:none;}
+.wmf-mode-btn.active{background:#2271b1;border-color:#2271b1;color:#fff;}
diff --git a/integrations/assets/js/dashboard.js b/integrations/assets/js/dashboard.js
new file mode 100644
index 0000000..1b9c30c
--- /dev/null
+++ b/integrations/assets/js/dashboard.js
@@ -0,0 +1,63 @@
+(function($){
+$(document).on('change','input[name*=services]',function(e){
+ var $i=$(e.target),v=$i.val(),$w=$i.parents('.inside');
+ if(v){var $s=$('#wmf-service-'+v,$w);if($s.length){$('.wmf-service-integration',$w).hide();$i.parents('[data-active-service]').attr('data-active-service',v);$s.show();}}
+ else{$('.wmf-service-integration',$w).hide();}
+ $i.parents('form').trigger('wmf.enable');
+});
+$(document).on('change','input[name*="[mode]"]',function(e){ $(e.target).parents('[data-active-mode]').attr('data-active-mode',$(e.target).val()); });
+$(document).on('submit','#wmf-integrations-screen form.hf-ajax-submit',function(e){
+ e.preventDefault();
+ var $f=$(e.target),$w=$f.parent(),$sp=$('.spinner',$w),$sb=$('input[type=submit]',$w);
+ $sb.prop('disabled',true);$sp.css('visibility','visible');
+ $.post(ajaxurl,$f.serialize(),function(r){$sb.prop('disabled',false);$sp.css('visibility','hidden');$f.replaceWith(r);});
+});
+function refresh(){
+ var sg=$('#wmf-integration-filters').val(),st=$('#wmf-search-input').val().trim();
+ var $rw=$('#wmf-integrations-results-wrap'),$rc=$('#wmf-integrations-results'),$dw=$('#dashboard-widgets');
+ $('.wmf-integrations-widget',$rc).each(function(){$('.notice',$(this)).remove();$('#'+$(this).attr('id'),$dw).replaceWith($(this));});
+ $('.wmf-integrations-widget',$rc).remove();$rc.hide();$rw.removeClass('no-results');
+ if(!sg&&!st){$dw.show();return;}
+ $dw.hide();
+ var $r=$('.wmf-integrations-widget',$dw);
+ if(sg)$r=$r.filter(function(){return $(this).hasClass('wmf-integrations-widget-group-'+sg);});
+ if(st)$r=$r.filter(function(){return $('h2',$(this)).text().toLowerCase().indexOf(st.toLowerCase())>=0;});
+ $r=$r.filter(function(){return'none'!==$(this).css('display');});
+ $r=$r.clone(true,true).get();
+ if(!$r.length)$rw.addClass('no-results');
+ $rc.show();
+ var $cols=$('.postbox-container:visible',$rc);
+ while($r.length>0){$cols.each(function(){if($r.length>0)$(this).append($r.pop());});}
+}
+$(document).on('input','#wmf-integration-toolbar',refresh);
+$(window).on('resize',refresh);
+})(jQuery);
+
+/* Widget-Formulare AJAX speichern */
+(function($){
+$(document).on('submit', '.wmf-int-form', function(e){
+ e.preventDefault();
+ var $form = $(this);
+ var $btn = $form.find('button[type=submit]');
+ var $wrap = $form.closest('.wmf-widget-body');
+ $btn.prop('disabled', true).text('Speichere...');
+ $.post(ajaxurl, $form.serialize(), function(response){
+ $btn.prop('disabled', false).text('Speichern');
+ var $notice = $('
').text('Gespeichert!').css({
+ background:'#f0fdf4',border:'1px solid #46b450',color:'#166534',
+ padding:'6px 10px',borderRadius:'3px',marginBottom:'8px',fontSize:'13px'
+ });
+ $wrap.prepend($notice);
+ setTimeout(function(){ $notice.fadeOut(300, function(){ $(this).remove(); }); }, 2500);
+ // Badge aktualisieren
+ if(response && response.indexOf('Verbunden') !== -1) {
+ if(!$wrap.find('.wmf-connected-badge').length) {
+ $wrap.prepend('
✓ Verbunden
');
+ }
+ }
+ }).fail(function(){
+ $btn.prop('disabled', false).text('Speichern');
+ alert('Fehler beim Speichern. Bitte Seite neu laden.');
+ });
+});
+})(jQuery);
diff --git a/integrations/classes/class-api-request.php b/integrations/classes/class-api-request.php
new file mode 100644
index 0000000..39deaa3
--- /dev/null
+++ b/integrations/classes/class-api-request.php
@@ -0,0 +1,6 @@
+url=$url;$this->arguments=$arguments;}
+}
diff --git a/integrations/classes/class-integrations-page-controller.php b/integrations/classes/class-integrations-page-controller.php
new file mode 100644
index 0000000..7a00375
--- /dev/null
+++ b/integrations/classes/class-integrations-page-controller.php
@@ -0,0 +1,299 @@
+hook();
+ return self::$instance;
+ }
+
+ public function hook() {
+ add_action('admin_menu', array($this, 'register_menu'));
+ add_action('admin_post_wmf_save_global_settings', array($this, 'save_global_settings'));
+ }
+
+ public function register_menu() {
+ $hook = add_submenu_page(
+ 'wp-multi-formular',
+ 'Integrationen',
+ 'Integrationen',
+ 'manage_options',
+ 'wmf-integrations',
+ array($this, 'page')
+ );
+ if($hook) {
+ add_action('load-' . $hook, array($this, 'on_load'));
+ }
+ }
+
+ public function on_load() {
+ // Metaboxen direkt hier registrieren (nicht ueber add_meta_boxes Hook)
+ $this->register_metaboxes();
+ wp_enqueue_script('postbox');
+ wp_enqueue_style('wmf-int', WMF_URL . 'integrations/assets/css/admin.css', array(), WMF_VERSION);
+ wp_enqueue_script('wmf-int', WMF_URL . 'integrations/assets/js/dashboard.js', array('jquery'), WMF_VERSION, true);
+ wp_enqueue_style('wmf-admin', WMF_URL . 'assets/css/admin.css', array(), WMF_VERSION);
+ }
+
+ private function register_metaboxes() {
+ $screen = get_current_screen();
+ if(!$screen) return;
+ $sid = $screen->id;
+ $int = wmf_get_integrations();
+
+ // Dienste nach Gruppe
+ $groups = array(
+ 'email' => 'normal',
+ 'antispam' => 'side',
+ 'address' => 'side',
+ 'payments' => 'side',
+ 'automation' => 'column3',
+ 'analytics' => 'column4',
+ );
+
+ foreach($groups as $group => $context) {
+ $services = $int->get_service_group($group);
+ foreach($services as $svc) {
+ $id = 'wmf-int-widget-' . $svc->id;
+ add_meta_box(
+ $id,
+ esc_html($svc->label),
+ array($this, 'metabox_callback'),
+ $sid,
+ $context,
+ 'default',
+ array('service' => $svc)
+ );
+ add_filter("postbox_classes_{$sid}_{$id}", function($classes) use($svc) {
+ $classes[] = 'wmf-integrations-widget';
+ $classes[] = 'wmf-integrations-widget-group-' . $svc->group;
+ return $classes;
+ });
+ }
+ }
+ }
+
+ public function metabox_callback($post, $metabox) {
+ $metabox['args']['service']->admin_widget();
+ }
+
+ /* ------------------------------------------------------------------
+ SEITEN-AUSGABE
+ ------------------------------------------------------------------ */
+ public function page() {
+ // Test-Mail
+ if(!empty($_GET['wmf_test_mail']) && wp_verify_nonce($_GET['_wpnonce'] ?? '', 'wmf_test_mail')) {
+ $this->handle_test_mail();
+ }
+ $screen = get_current_screen();
+ $sid = $screen ? $screen->id : '';
+ require WMF_INT_DIR . 'templates/admin-integrations.php';
+ }
+
+ /* ------------------------------------------------------------------
+ GLOBALE E-MAIL-EINSTELLUNGEN (als eigener Abschnitt, nicht als Meta-Box)
+ ------------------------------------------------------------------ */
+ public function render_global_email_settings() {
+ $opts = get_option('wmf_global_settings', array());
+ $from_name = $opts['from_name'] ?? get_bloginfo('name');
+ $from_email = $opts['from_email'] ?? get_option('admin_email');
+ $smtp_on = $opts['smtp_enabled'] ?? '0';
+ $smtp_host = $opts['smtp_host'] ?? '';
+ $smtp_port = $opts['smtp_port'] ?? '587';
+ $smtp_enc = $opts['smtp_enc'] ?? 'tls';
+ $smtp_user = $opts['smtp_user'] ?? '';
+ $smtp_pass = $opts['smtp_pass'] ?? '';
+ ?>
+
+
+
+ Globale E-Mail-Einstellungen
+
+
+
+
+
+
+
+
+ sanitize_text_field($_POST['wmf_from_name'] ?? ''),
+ 'from_email' => sanitize_email( $_POST['wmf_from_email'] ?? ''),
+ 'smtp_enabled' => !empty($_POST['wmf_smtp_enabled']) ? '1' : '0',
+ 'smtp_host' => sanitize_text_field($_POST['wmf_smtp_host'] ?? ''),
+ 'smtp_port' => intval( $_POST['wmf_smtp_port'] ?? 587),
+ 'smtp_enc' => sanitize_text_field($_POST['wmf_smtp_enc'] ?? 'tls'),
+ 'smtp_user' => sanitize_text_field($_POST['wmf_smtp_user'] ?? ''),
+ 'smtp_pass' => $_POST['wmf_smtp_pass'] ?? '',
+ ));
+ wmf_safe_redirect(add_query_arg(array('page'=>'wmf-integrations','wmf_notice'=>'global_saved'), admin_url('admin.php')));
+ }
+
+ /* ------------------------------------------------------------------
+ TEST-MAIL
+ ------------------------------------------------------------------ */
+ private function handle_test_mail() {
+ $opts = get_option('wmf_global_settings', array());
+ $from_name = $opts['from_name'] ?? get_bloginfo('name');
+ $from_mail = $opts['from_email'] ?? get_option('admin_email');
+ $to = get_option('admin_email');
+ $headers = array('Content-Type: text/html; charset=UTF-8', 'From: '.$from_name.' <'.$from_mail.'>');
+ $body = '
+
WP Multi Formular – Test-E-Mail
+
Diese Test-E-Mail wurde erfolgreich gesendet.
+
+ | Von: | ' . esc_html($from_name) . ' <' . esc_html($from_mail) . '> |
+ | An: | ' . esc_html($to) . ' |
+ | Datum: | ' . current_time('d.m.Y H:i') . ' |
+
+ ';
+ $sent = wp_mail($to, 'Test-E-Mail – WP Multi Formular', $body, $headers);
+ $msg = $sent
+ ? '
✓ Test-E-Mail gesendet an ' . esc_html($to) . '.
'
+ : '
✗ Fehler beim Senden. Bitte SMTP-Einstellungen pruefen.
';
+ add_action('admin_notices', function() use($msg){ echo $msg; });
+ }
+}
+
+function wmf_get_integrations_page_controller() {
+ return WMF_Integrations_Page_Controller::instance();
+}
diff --git a/integrations/classes/class-integrations.php b/integrations/classes/class-integrations.php
new file mode 100644
index 0000000..38747da
--- /dev/null
+++ b/integrations/classes/class-integrations.php
@@ -0,0 +1,113 @@
+'WMF_Service_Recaptcha',
+ 'recaptchav3/class-service-recaptchav3.php' =>'WMF_Service_RecaptchaV3',
+ 'mailchimp/class-service-mailchimp.php' =>'WMF_Service_Mailchimp',
+ 'mailerlite/class-service-mailerlite.php' =>'WMF_Service_MailerLite',
+ 'active-campaign/class-service-active-campaign.php'=>'WMF_Service_ActiveCampaign',
+ 'convertkit/class-service-convertkit.php' =>'WMF_Service_ConvertKit',
+ 'stripe/class-service-stripe.php' =>'WMF_Service_Stripe',
+ 'paypal/class-service-paypal.php' =>'WMF_Service_PayPal',
+ 'zapier/class-service-zapier.php' =>'WMF_Service_Zapier',
+ 'google-analytics/class-service-google-analytics.php'=>'WMF_Service_Google_Analytics',
+ 'google-places/class-service-google-places.php' =>'WMF_Service_Google_Places',
+ );
+ foreach($services as $file=>$cls) {
+ require_once $b.'services/'.$file;
+ $this->register_service($cls);
+ }
+ }
+ public function hook() {
+ if(self::$hooked) return; self::$hooked=true;
+ add_action('wp_ajax_'.$this->action_update, array($this,'ajax_service_update'));
+ add_action('wp_ajax_'.$this->integrations_action,array($this,'ajax_integrations_update'));
+ add_action('wmf_integrations_print_notices', array($this,'print_notices'));
+ $this->read_credentials();
+ $this->configure_services();
+ }
+ public function register_service($cls) {
+ $s=$cls instanceof WMF_Service?$cls:new $cls();
+ $this->services[$s->id]=$s;
+ }
+ public function configure_services() {
+ foreach($this->services as $s) {
+ $s->set_credentials($this->credentials[$s->id]??array());
+ $s->configure(); $s->load();
+ }
+ }
+ public function read_credentials(){$this->credentials=get_option($this->option_name,array());}
+ public function write_credentials(){
+ $this->credentials=array_map(fn($s)=>$s->get_credentials(),$this->services);
+ update_option($this->option_name,$this->credentials);
+ }
+ public function get_services(){return $this->services;}
+ public function get_service($id){return $this->services[$id]??false;}
+ public function get_service_group($group){
+ // Neu aufbauen falls noch nicht geschehen oder leer
+ if(empty($this->grouped_services)) {
+ $this->grouped_services = array();
+ foreach($this->services as $s) {
+ $this->grouped_services[$s->group][] = $s;
+ }
+ }
+ return $this->grouped_services[$group] ?? array();
+ }
+
+ public function reset_grouped_cache() {
+ $this->grouped_services = array();
+ }
+ public function ajax_service_update() {
+ if(!check_ajax_referer($this->action_update)||!current_user_can('manage_options')) wp_die();
+ $services=(array)($_REQUEST['services']??array());
+ $group=sanitize_text_field($_REQUEST['group']??'');
+ ob_start();
+ foreach($services as $sid) {
+ if(!isset($this->services[$sid])) continue;
+ $svc=$this->services[$sid];
+ $def=$svc->get_credentials();
+ $raw=$_REQUEST['credentials'][$sid]??array();
+ $creds=array_map('sanitize_text_field',array_intersect_key(wp_parse_args($raw,$def),$def));
+ $svc->set_credentials($creds,$raw);
+ $this->write_credentials();
+ }
+ $this->notice=array('status'=>'success','message'=>'Änderungen gespeichert.');
+ if($group==='antispam') require WMF_INT_DIR.'templates/admin-antispam-integrations.php';
+ echo ob_get_clean(); die();
+ }
+ public function ajax_integrations_update() {
+ if(!check_ajax_referer($this->integrations_action)||!current_user_can('manage_options')) wp_die();
+ if(!isset($_REQUEST['service'],$_REQUEST['credentials'])) wp_die();
+ $sid=sanitize_text_field($_REQUEST['service']);
+ if(!isset($this->services[$sid])) wp_send_json_error();
+ $svc=$this->services[$sid]; $def=$svc->get_credentials();
+ $raw=$_REQUEST['credentials'][$sid]??array();
+ $creds=array_map('sanitize_text_field',array_intersect_key(wp_parse_args($raw,$def),$def));
+ $prev=$svc->get_credentials(); $svc->set_credentials($creds,$raw); $this->write_credentials();
+ $this->notice=array('status'=>'success','message'=>'Änderungen gespeichert.');
+ ob_start(); $svc->admin_widget($prev); echo ob_get_clean(); die();
+ }
+ public function print_notices() {
+ if(empty($this->notice)) return;
+ printf('
',esc_attr($this->notice['status']),esc_html($this->notice['message']));
+ }
+}
+function wmf_get_integrations(){return WMF_Integrations::instance();}
diff --git a/integrations/classes/class-service.php b/integrations/classes/class-service.php
new file mode 100644
index 0000000..c9846c1
--- /dev/null
+++ b/integrations/classes/class-service.php
@@ -0,0 +1,17 @@
+credentials=$creds;}
+ public function get_credentials(){return $this->credentials;}
+ public function is_connected(){return false;}
+ public function admin_widget($prev=array()){}
+ public function configure(){}
+ public function load(){}
+ public function make_api_request($url,$args){
+ $req=new WMF_API_Request($url,$args);
+ $req=apply_filters('wmf_api_request',$req,$this);
+ return wp_remote_request($req->url,$req->arguments);
+ }
+}
diff --git a/integrations/services/active-campaign/class-service-active-campaign.php b/integrations/services/active-campaign/class-service-active-campaign.php
new file mode 100644
index 0000000..928daa4
--- /dev/null
+++ b/integrations/services/active-campaign/class-service-active-campaign.php
@@ -0,0 +1,46 @@
+'','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 '
';
+ if($conn) echo '
✓ Verbunden
';
+ echo '
';
+
+ echo '
';
+ }
+ 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));
+ }
+ }
+}
\ No newline at end of file
diff --git a/integrations/services/convertkit/class-service-convertkit.php b/integrations/services/convertkit/class-service-convertkit.php
new file mode 100644
index 0000000..ba4db2e
--- /dev/null
+++ b/integrations/services/convertkit/class-service-convertkit.php
@@ -0,0 +1,42 @@
+'','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 '
';
+ if($conn) echo '
✓ Verbunden
';
+ echo '
';
+
+ echo '
';
+ }
+ 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));
+ }
+}
\ No newline at end of file
diff --git a/integrations/services/google-analytics/class-service-google-analytics.php b/integrations/services/google-analytics/class-service-google-analytics.php
new file mode 100644
index 0000000..50b8b96
--- /dev/null
+++ b/integrations/services/google-analytics/class-service-google-analytics.php
@@ -0,0 +1,35 @@
+'');
+ 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 '
';
+ if($conn) echo '
✓ Verbunden
';
+ echo '
';
+
+ echo '
';
+ }
+ 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 '';
+ echo '';
+ }
+}
\ No newline at end of file
diff --git a/integrations/services/google-places/class-service-google-places.php b/integrations/services/google-places/class-service-google-places.php
new file mode 100644
index 0000000..81c5d09
--- /dev/null
+++ b/integrations/services/google-places/class-service-google-places.php
@@ -0,0 +1,29 @@
+'');
+ 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 '
';
+ if($conn) echo '
✓ Verbunden
';
+ echo '
';
+
+ echo '
';
+ }
+}
\ No newline at end of file
diff --git a/integrations/services/mailchimp/class-service-mailchimp.php b/integrations/services/mailchimp/class-service-mailchimp.php
new file mode 100644
index 0000000..da194bd
--- /dev/null
+++ b/integrations/services/mailchimp/class-service-mailchimp.php
@@ -0,0 +1,46 @@
+'','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 '
';
+ if($conn) echo '
✓ Verbunden
';
+ echo '
';
+
+ echo '
';
+ }
+ 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,
+ ));
+ }
+}
\ No newline at end of file
diff --git a/integrations/services/mailerlite/class-service-mailerlite.php b/integrations/services/mailerlite/class-service-mailerlite.php
new file mode 100644
index 0000000..7d67b40
--- /dev/null
+++ b/integrations/services/mailerlite/class-service-mailerlite.php
@@ -0,0 +1,43 @@
+'','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 '
';
+ if($conn) echo '
✓ Verbunden
';
+ echo '
';
+
+ echo '
';
+ }
+ 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));
+ }
+}
\ No newline at end of file
diff --git a/integrations/services/paypal/class-service-paypal.php b/integrations/services/paypal/class-service-paypal.php
new file mode 100644
index 0000000..00a25c9
--- /dev/null
+++ b/integrations/services/paypal/class-service-paypal.php
@@ -0,0 +1,38 @@
+'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 '
';
+ if($conn) echo '
✓ Verbunden ('.($m==='live'?'Live':'Sandbox').')
';
+ echo '
';
+ echo '';
+ echo '
';
+ }
+}
\ No newline at end of file
diff --git a/integrations/services/recaptcha/class-service-recaptcha.php b/integrations/services/recaptcha/class-service-recaptcha.php
new file mode 100644
index 0000000..eb16b59
--- /dev/null
+++ b/integrations/services/recaptcha/class-service-recaptcha.php
@@ -0,0 +1,31 @@
+'','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 '
';
+ if($conn) echo '
✓ Verbunden
';
+ echo '
';
+
+ echo '
';
+ }
+}
\ No newline at end of file
diff --git a/integrations/services/recaptchav3/class-service-recaptchav3.php b/integrations/services/recaptchav3/class-service-recaptchav3.php
new file mode 100644
index 0000000..e5da5e5
--- /dev/null
+++ b/integrations/services/recaptchav3/class-service-recaptchav3.php
@@ -0,0 +1,33 @@
+'','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 '
';
+ if($conn) echo '
✓ Verbunden
';
+ echo '
';
+
+ echo '
';
+ }
+}
\ No newline at end of file
diff --git a/integrations/services/stripe/class-service-stripe.php b/integrations/services/stripe/class-service-stripe.php
new file mode 100644
index 0000000..c5a31ee
--- /dev/null
+++ b/integrations/services/stripe/class-service-stripe.php
@@ -0,0 +1,38 @@
+'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 '
';
+ if($conn) echo '
✓ Verbunden ('.($m==='live'?'Live':'Test').')
';
+ echo '
';
+ echo '';
+ echo '
';
+ }
+}
\ No newline at end of file
diff --git a/integrations/services/zapier/class-service-zapier.php b/integrations/services/zapier/class-service-zapier.php
new file mode 100644
index 0000000..8750abf
--- /dev/null
+++ b/integrations/services/zapier/class-service-zapier.php
@@ -0,0 +1,37 @@
+'');
+ 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 '
';
+ if($conn) echo '
✓ Verbunden
';
+ echo '
';
+
+ echo '
';
+ }
+ 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,
+ ));
+ }
+}
\ No newline at end of file
diff --git a/integrations/templates/admin-antispam-integrations.php b/integrations/templates/admin-antispam-integrations.php
new file mode 100644
index 0000000..084bbcf
--- /dev/null
+++ b/integrations/templates/admin-antispam-integrations.php
@@ -0,0 +1,20 @@
+action_update;
+$grp=$int->get_service_group('antispam');
+$active=''; foreach($grp as $s){ if($s->is_connected()){$active=$s->id;break;} }
+?>
+
diff --git a/integrations/templates/admin-integrations.php b/integrations/templates/admin-integrations.php
new file mode 100644
index 0000000..92bf53a
--- /dev/null
+++ b/integrations/templates/admin-integrations.php
@@ -0,0 +1,70 @@
+id : '';
+$ctrl = wmf_get_integrations_page_controller();
+?>
+
+
Integrationen
+
+ render_global_email_settings(); ?>
+
+
+
+
+
+
+