Upload folder via GUI - integrations

This commit is contained in:
Git Manager GUI
2026-04-13 18:52:48 +02:00
parent 09ac38e9fa
commit 9514db9454
19 changed files with 1042 additions and 0 deletions

View 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">&#10003; 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 &rarr;</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>';
}
}