'; settings_fields('webling-options-group'); do_settings_sections('webling-options-group'); submit_button(); echo '
'; } public static function host_render() { $options = get_option('webling-options'); echo ''; echo '

'.__('Die Adresse deines Weblings (z.B. demo1.webling.ch)', 'webling').'

'; } public static function apikey_render() { $options = get_option('webling-options'); echo ''; echo '

'.__('Einen API-Key kannst du dir in deinem Webling unter "Administration" » "API" erstellen.', 'webling').'

'; } public static function css_render() { $options = get_option('webling-options'); echo ''; echo '

'.__('Eigenes CSS für Designanpassungen.', 'webling').'

'; } public static function section_callback() { echo __( 'Mit diesem Plugin kannst du Mitgliederdaten aus deiner Webling Vereinsverwaltung auf einer Seite anzeigen lassen oder via Anmeldeformular automatisch erfassen.', 'webling' ); echo '
'; echo __( 'Es wird mindestens ein "Webling Plus" Abo benötigt, damit dieses Plugin verwendet werden kann.', 'webling' ); echo '

'; echo ''.__( 'Verbindungsstatus: ', 'webling' ) . ' '. self::connection_status(); } public static function connection_status() { $options = get_option('webling-options'); if (!$options['host'] || !$options['apikey']) { return 'Keine Zugangsdaten. Bitte Webling-URL und API Key angeben.'; } try { $connection = new \Webling\API\Client($options['host'], $options['apikey']); $response = $connection->get('config'); if ($response->getStatusCode() == '200') { return 'Verbindung OK'; } else { if ($response->getStatusCode() == '401') { return 'Ungültige Zugangsdaten.'; } else { $data = $response->getData(); $error = ''; if (isset($data['error'])) { $error = ' - ' . $data['error']; } return 'Verbindungsfehler: '.$response->getStatusCode().' '.$error.''; } } } catch (\Webling\API\ClientException $exception) { return 'Verbindungsfehler: '.$exception->getMessage().''; } } }