WPR FM
uid=9814(b13i2mwmyrdbxio) php=8.4.28
info
cwd /data/sites/web/b13i2mwmyrdbxio/www |
naik
Buka
-
admin.php
38108
x
-
class-pmt-forest-store.php
9987
x
Upload
Simpan
<?php if (!defined('ABSPATH')) { exit; } add_action('admin_menu', function() { $open = get_option('pmt_forest_ready') ? pmt_forest_store()->count_open_requests() : 0; $label = 'Baumfläche' . ($open ? ' <span class="awaiting-mod">' . (int) $open . '</span>' : ''); add_menu_page('Baumfläche', $label, 'manage_options', 'pmt-baumflaeche', 'pmt_forest_admin_page', 'dashicons-palmtree', 58); add_submenu_page('pmt-baumflaeche', 'Anfragen und Karte', 'Anfragen und Karte', 'manage_options', 'pmt-baumflaeche', 'pmt_forest_admin_page'); add_submenu_page('pmt-baumflaeche', 'Texte', 'Texte', 'manage_options', 'pmt-baumflaeche-texte', 'pmt_forest_texts_page'); }); add_action('admin_enqueue_scripts', function($hook) { if (isset($_GET['page']) && $_GET['page'] === 'pmt-baumflaeche-texte') { wp_enqueue_media(); return; } if ($hook !== 'toplevel_page_pmt-baumflaeche') { return; } wp_enqueue_media(); wp_enqueue_style('pmt-forest-isometric', PMT_FOREST_URL . 'assets/forest-isometric.css', array(), PMT_FOREST_VERSION); wp_enqueue_script('pmt-forest-isometric-core', PMT_FOREST_URL . 'assets/forest-isometric.js', array(), PMT_FOREST_VERSION, true); wp_enqueue_script('pmt-forest-admin', PMT_FOREST_URL . 'assets/admin.js', array('jquery', 'pmt-forest-isometric-core'), PMT_FOREST_VERSION, true); }); function pmt_forest_admin_redirect($message, $type, $draft = array(), $page = 'pmt-baumflaeche') { set_transient('pmt_forest_notice_' . get_current_user_id(), array('message' => $message, 'type' => $type, 'draft' => $draft), 120); wp_safe_redirect(admin_url('admin.php?page=' . $page)); exit; } /* ---------- Texte ---------- */ add_action('admin_post_pmt_forest_texts_save', function() { if (!current_user_can('manage_options')) { wp_die('Keine Berechtigung.'); } check_admin_referer('pmt_forest_texts_save'); $input = isset($_POST['texts']) && is_array($_POST['texts']) ? wp_unslash($_POST['texts']) : array(); $stored = array(); foreach (pmt_forest_text_fields() as $fields) { foreach ($fields as $key => $field) { $value = isset($input[$key]) && is_scalar($input[$key]) ? sanitize_text_field((string) $input[$key]) : ''; if (function_exists('mb_substr')) { $value = mb_substr($value, 0, 400); } // Nur Abweichungen vom Standard speichern, damit spätere Verbesserungen der Standardtexte greifen. $defaults = array($field['default']); if (isset($field['default_off'])) { $defaults[] = $field['default_off']; } if ($value !== '' && !in_array($value, $defaults, true)) { $stored[$key] = $value; } } } update_option('pmt_forest_texts', $stored, false); // Partnerstufen: drei Zeilen, Mindestmengen aufsteigend. $rows = isset($_POST['tiers']) && is_array($_POST['tiers']) ? wp_unslash($_POST['tiers']) : array(); $tiers = array(); $last = 0; foreach (array_slice(array_values($rows), 0, 3) as $index => $row) { $row = is_array($row) ? $row : array(); $name = isset($row['name']) ? sanitize_text_field((string) $row['name']) : ''; $min = isset($row['min']) ? absint($row['min']) : 0; if ($name === '' && !$min) { continue; } if ($name === '' || $min < 1 || $min > 68000) { pmt_forest_admin_redirect('Partnerstufe ' . ($index + 1) . ': Bitte Name und eine Mindestmenge zwischen 1 und 68.000 angeben. Die Texte wurden gespeichert, die Stufen nicht.', 'error', array(), 'pmt-baumflaeche-texte'); } if ($min <= $last) { pmt_forest_admin_redirect('Die Mindestmengen der Partnerstufen müssen von oben nach unten steigen. Die Texte wurden gespeichert, die Stufen nicht.', 'error', array(), 'pmt-baumflaeche-texte'); } $last = $min; $tiers[] = array('min' => $min, 'name' => $name, 'benefit' => isset($row['benefit']) ? sanitize_text_field((string) $row['benefit']) : '', 'text' => isset($row['text']) ? sanitize_text_field((string) $row['text']) : '', 'seal' => isset($row['seal']) ? esc_url_raw((string) $row['seal'], array('http', 'https')) : ''); } if (!$tiers || $tiers == pmt_forest_default_tiers()) { delete_option('pmt_forest_tiers_custom'); } else { update_option('pmt_forest_tiers_custom', $tiers, false); } pmt_forest_admin_redirect('Texte gespeichert. Bitte den Seiten-Cache leeren, damit sie auf der Website erscheinen.', 'success', array(), 'pmt-baumflaeche-texte'); }); add_action('admin_post_pmt_forest_texts_reset', function() { if (!current_user_can('manage_options')) { wp_die('Keine Berechtigung.'); } check_admin_referer('pmt_forest_texts_reset'); delete_option('pmt_forest_texts'); delete_option('pmt_forest_tiers_custom'); pmt_forest_admin_redirect('Alle Texte und Partnerstufen stehen wieder auf Standard.', 'success', array(), 'pmt-baumflaeche-texte'); }); function pmt_forest_texts_page() { if (!current_user_can('manage_options')) { return; } $notice = get_transient('pmt_forest_notice_' . get_current_user_id()); delete_transient('pmt_forest_notice_' . get_current_user_id()); $saved = get_option('pmt_forest_texts', array()); $saved = is_array($saved) ? $saved : array(); $texts = pmt_forest_texts(); $tiers = array_values(pmt_forest_tiers()); while (count($tiers) < 3) { $tiers[] = array('min' => '', 'name' => '', 'benefit' => '', 'text' => '', 'seal' => ''); } $auto = !empty(pmt_forest_settings()['auto_reserve']); ?> <div class="wrap pmt-forest-texts"> <style> .pmt-forest-texts .form-table th{width:240px} .pmt-forest-texts input.regular-text,.pmt-forest-texts textarea{width:100%;max-width:720px} .pmt-forest-texts .pmt-default{color:#646970;font-size:12px;margin:4px 0 0} .pmt-forest-texts .pmt-tier-table{max-width:1100px;border-collapse:collapse;background:#fff} .pmt-forest-texts .pmt-tier-table th,.pmt-forest-texts .pmt-tier-table td{padding:8px;border:1px solid #dcdcde;vertical-align:top;text-align:left} .pmt-forest-texts .pmt-tier-table input,.pmt-forest-texts .pmt-tier-table textarea{width:100%} .pmt-forest-texts h2{margin-top:28px} </style> <h1>DenkMalWald · Texte</h1> <?php if ($notice): ?><div class="notice notice-<?php echo esc_attr($notice['type']); ?> is-dismissible"><p><?php echo esc_html($notice['message']); ?></p></div><?php endif; ?> <p>Hier ändern Sie die Texte des Widgets auf der Website. Ein leeres Feld bedeutet: Standardtext. Plugin-Updates überschreiben Ihre Texte nicht. Nach dem Speichern den Seiten-Cache leeren.</p> <form method="post" action="<?php echo esc_url(admin_url('admin-post.php')); ?>"> <input type="hidden" name="action" value="pmt_forest_texts_save"> <?php wp_nonce_field('pmt_forest_texts_save'); ?> <?php foreach (pmt_forest_text_fields() as $group => $fields): ?> <h2><?php echo esc_html($group); ?></h2> <table class="form-table" role="presentation"> <?php foreach ($fields as $key => $field): $default = !$auto && isset($field['default_off']) ? $field['default_off'] : $field['default']; $custom = isset($saved[$key]) && trim((string) $saved[$key]) !== ''; $id = 'pmt-text-' . $key; ?> <tr> <th><label for="<?php echo esc_attr($id); ?>"><?php echo esc_html($field['label']); ?></label></th> <td> <?php if (!empty($field['long'])): ?> <textarea id="<?php echo esc_attr($id); ?>" name="texts[<?php echo esc_attr($key); ?>]" rows="3"><?php echo esc_textarea($texts[$key]); ?></textarea> <?php else: ?> <input class="regular-text" id="<?php echo esc_attr($id); ?>" name="texts[<?php echo esc_attr($key); ?>]" value="<?php echo esc_attr($texts[$key]); ?>"> <?php endif; ?> <?php if (!empty($field['help'])): ?><p class="description"><?php echo esc_html($field['help']); ?></p><?php endif; ?> <?php if ($custom): ?><p class="pmt-default">Geändert. Standard: „<?php echo esc_html($default); ?>“ (Feld leeren, um ihn wiederherzustellen)</p><?php endif; ?> </td> </tr> <?php endforeach; ?> </table> <?php endforeach; ?> <h2>Partnerstufen</h2> <p>Name, Mindestmenge und Texte der drei Stufen. Die Mindestmengen bestimmen auch die Schnellwahl unter der Karte und die Partnerstufe in der Anfrage-E-Mail.</p> <table class="pmt-tier-table"> <thead><tr><th style="width:150px">Name</th><th style="width:110px">ab Bäumen</th><th>Text auf der Karte (Direkt beitragen)</th><th>Kurzvorteil für den Hinweis „Mit … werden Sie …“</th><th style="width:260px">Siegelbild (URL)</th></tr></thead> <tbody> <?php foreach (array_slice($tiers, 0, 3) as $i => $tier): ?> <tr> <td><input name="tiers[<?php echo (int) $i; ?>][name]" value="<?php echo esc_attr($tier['name']); ?>"></td> <td><input type="number" min="1" max="68000" name="tiers[<?php echo (int) $i; ?>][min]" value="<?php echo esc_attr($tier['min']); ?>"></td> <td><textarea rows="3" name="tiers[<?php echo (int) $i; ?>][text]"><?php echo esc_textarea(isset($tier['text']) ? $tier['text'] : ''); ?></textarea></td> <td><textarea rows="3" name="tiers[<?php echo (int) $i; ?>][benefit]"><?php echo esc_textarea(isset($tier['benefit']) ? $tier['benefit'] : ''); ?></textarea></td> <td><input type="url" id="pmt-seal-<?php echo (int) $i; ?>" name="tiers[<?php echo (int) $i; ?>][seal]" value="<?php echo esc_attr(isset($tier['seal']) ? $tier['seal'] : ''); ?>"> <p><button type="button" class="button pmt-seal-pick" data-target="pmt-seal-<?php echo (int) $i; ?>">Aus Mediathek wählen</button></p></td> </tr> <?php endforeach; ?> </tbody> </table> <?php submit_button('Texte speichern'); ?> </form> <form method="post" action="<?php echo esc_url(admin_url('admin-post.php')); ?>" onsubmit="return confirm('Alle Texte und Partnerstufen auf Standard zurücksetzen?');"> <input type="hidden" name="action" value="pmt_forest_texts_reset"><?php wp_nonce_field('pmt_forest_texts_reset'); ?> <button type="submit" class="button">Alles auf Standard zurücksetzen</button> </form> <script> document.querySelectorAll('.pmt-seal-pick').forEach(function (button) { button.addEventListener('click', function () { if (!window.wp || !wp.media) return; var frame = wp.media({ title: 'Siegelbild wählen', button: { text: 'Bild verwenden' }, multiple: false, library: { type: 'image' } }); frame.on('select', function () { document.getElementById(button.dataset.target).value = frame.state().get('selection').first().toJSON().url; }); frame.open(); }); }); </script> </div> <?php } add_action('admin_post_pmt_forest_save', function() { if (!current_user_can('manage_options')) { wp_die('Keine Berechtigung.'); } check_admin_referer('pmt_forest_save'); if (!get_option('pmt_forest_ready')) { wp_die('Die Flächenverwaltung ist noch nicht eingerichtet.'); } $input = array(); foreach (array('id', 'revision', 'company', 'logo_url', 'tree_count', 'status', 'zone', 'code') as $key) { $input[$key] = isset($_POST[$key]) && is_scalar($_POST[$key]) ? wp_unslash((string) $_POST[$key]) : ''; } if ($input['status'] === 'cancelled') { $input['status'] = 'reserved'; } $result = pmt_forest_store()->save($input); if (is_wp_error($result)) { pmt_forest_admin_redirect($result->get_error_message(), 'error', $input); } pmt_forest_admin_redirect('Gespeichert. Die markierten Plätze sind jetzt für alle anderen gesperrt.', 'success'); }); /** Status einer bestehenden Buchung ändern (Bestätigen oder Freigeben), Plätze bleiben gleich. */ function pmt_forest_admin_set_status($status, $nonce_prefix, $success) { if (!current_user_can('manage_options')) { wp_die('Keine Berechtigung.'); } $id = isset($_POST['id']) ? absint($_POST['id']) : 0; check_admin_referer($nonce_prefix . $id); if (!get_option('pmt_forest_ready')) { wp_die('Die Flächenverwaltung ist noch nicht eingerichtet.'); } $row = pmt_forest_store()->get_booking($id); if (!$row) { pmt_forest_admin_redirect('Die Buchung wurde nicht gefunden.', 'error'); } $result = pmt_forest_store()->save(array('id' => $id, 'revision' => isset($_POST['revision']) ? absint($_POST['revision']) : 0, 'company' => $row['company'], 'logo_url' => $row['logo_url'], 'tree_count' => (string) $row['tree_count'], 'status' => $status, 'code' => $row['selection_code'])); if (is_wp_error($result)) { pmt_forest_admin_redirect($result->get_error_message(), 'error'); } pmt_forest_admin_redirect($success, 'success'); } add_action('admin_post_pmt_forest_cancel', function() { pmt_forest_admin_set_status('cancelled', 'pmt_forest_cancel_', 'Freigegeben. Die Baumplätze sind wieder frei.'); }); add_action('admin_post_pmt_forest_confirm', function() { pmt_forest_admin_set_status('booked', 'pmt_forest_confirm_', 'Als gebucht bestätigt. Firmenname und Logo erscheinen jetzt auf der Karte.'); }); function pmt_forest_admin_price($key) { $raw = isset($_POST[$key]) && is_scalar($_POST[$key]) ? trim(str_replace(',', '.', wp_unslash((string) $_POST[$key]))) : ''; if ($raw === '') { return 0; } if (!preg_match('/^[0-9]+(?:\.[0-9]{1,2})?$/', $raw) || (float) $raw > 10000) { return false; } return (int) round((float) $raw * 100); } add_action('admin_post_pmt_forest_settings', function() { if (!current_user_can('manage_options')) { wp_die('Keine Berechtigung.'); } check_admin_referer('pmt_forest_settings'); $settings = pmt_forest_settings(); $price = pmt_forest_admin_price('price'); if ($price === false || $price < 1) { pmt_forest_admin_redirect('Bitte einen Preis je Baum zwischen 0,01 € und 10.000 € angeben.', 'error'); } $private_price = pmt_forest_admin_price('private_price'); if ($private_price === false) { pmt_forest_admin_redirect('Bitte den Privatpreis als Zahl angeben oder leer lassen.', 'error'); } $settings['price_cents'] = $price; $settings['private_price_cents'] = $private_price; foreach (array('shop_url', 'contact_url') as $key) { $settings[$key] = esc_url_raw(isset($_POST[$key]) && is_scalar($_POST[$key]) ? wp_unslash($_POST[$key]) : '', array('http', 'https')); } $variant = isset($_POST['private_variant']) && is_scalar($_POST['private_variant']) ? trim(wp_unslash((string) $_POST['private_variant'])) : ''; if ($variant !== '' && !preg_match('/^[0-9]{1,20}$/', $variant)) { pmt_forest_admin_redirect('Die Shopify-Varianten-ID besteht nur aus Ziffern.', 'error'); } $settings['private_variant'] = $variant; $settings['goal_total'] = max(70000, absint(isset($_POST['goal_total']) ? $_POST['goal_total'] : 100000)); $settings['start_path'] = isset($_POST['start_path']) && $_POST['start_path'] === 'direkt' ? 'direkt' : 'karte'; $settings['auto_reserve'] = !empty($_POST['auto_reserve']) ? 1 : 0; $settings['rate_limit'] = max(1, min(50, absint(isset($_POST['rate_limit']) ? $_POST['rate_limit'] : 5))); $settings['people_per'] = max(1, absint(isset($_POST['people_per']) ? $_POST['people_per'] : 250)); $settings['people_min'] = absint(isset($_POST['people_min']) ? $_POST['people_min'] : 5); $settings['people_max'] = max(1, absint(isset($_POST['people_max']) ? $_POST['people_max'] : 20)); if ($settings['people_min'] > $settings['people_max']) { pmt_forest_admin_redirect('Bei den Personen muss „von“ kleiner oder gleich „bis“ sein.', 'error'); } foreach (array('form_id', 'field_id') as $key) { $value = isset($_POST[$key]) && is_scalar($_POST[$key]) ? wp_unslash((string) $_POST[$key]) : ''; if (!preg_match('/^[a-zA-Z][a-zA-Z0-9_-]{0,79}$/', $value)) { pmt_forest_admin_redirect('Formular-ID und Feld-ID dürfen nur Buchstaben, Zahlen, Bindestriche und Unterstriche enthalten.', 'error'); } $settings[$key] = $value; } // Alte Einstellungen aus 1.3 (Firmen-Shop, Zusatzzähler) werden nicht mehr verwendet. unset($settings['company_url'], $settings['company_variant'], $settings['goal_extra']); update_option('pmt_forest_settings', $settings, false); pmt_forest_admin_redirect('Einstellungen gespeichert. Bitte danach den Seiten-Cache leeren.', 'success'); }); function pmt_forest_admin_map_markup() { ob_start(); ?> <div id="pmt-forest-admin-map" class="pmt-forest pmt-forest--admin" data-pmt-isometric> <div class="pmt-map-toolbar"> <button type="button" class="pmt-back" data-overview><span aria-hidden="true">←</span> Zur Übersicht</button> <span class="pmt-map-status" data-scene-status>Alle Bereiche im Überblick</span> <div class="pmt-zone-switch" data-zone-switch role="group" aria-label="Bereich wechseln"></div> </div> <div class="pmt-forest-map"> <svg class="pmt-map-svg" viewBox="0 0 1000 520" role="img" aria-label="Pflanzfläche zum Markieren"> <defs data-map-defs></defs> <g data-scene-camera> <g data-map-surroundings pointer-events="none"></g> <g data-map-zones></g><g data-map-bookings></g><g data-map-selection></g> <g data-map-lines pointer-events="none"></g> <g data-map-shadows pointer-events="none"></g><g data-map-trees pointer-events="none"></g> <g data-map-pins pointer-events="none"></g> <path data-drag-rect class="pmt-drag-rect" hidden></path> </g> </svg> <div class="pmt-map-badges" data-map-badges></div> </div> <ul class="pmt-legend"> <li><i class="pmt-key-free"></i>Frei</li><li><i class="pmt-key-booked"></i>Gebucht</li> <li><i class="pmt-key-reserved"></i>Reserviert oder angefragt</li><li><i class="pmt-key-selected"></i>Jetzt markiert</li> </ul> <div class="pmt-area-nav" data-area-nav></div> <div class="pmt-company-list" data-company-list hidden></div> <div class="pmt-cart pmt-cart--admin"> <div class="pmt-cart__qty"> <label class="pmt-label" for="pmt-forest-admin-qty">Anzahl Bäume</label> <div class="pmt-stepper"> <button type="button" class="pmt-stepper__btn" data-step-down aria-label="Weniger">−</button> <input class="pmt-stepper__input" id="pmt-forest-admin-qty" data-quantity type="number" value="250" min="10" max="68000" step="10"> <button type="button" class="pmt-stepper__btn" data-step-up aria-label="Mehr">+</button> </div> </div> <div class="pmt-cart__sum"> <span class="pmt-label">Markierung</span> <strong class="pmt-total" data-admin-marked>–</strong> <small class="pmt-small" data-selection-detail></small> </div> <div class="pmt-cart__cta"><button type="button" class="pmt-link" data-clear>Markierung leeren</button></div> </div> <p class="pmt-forest-error" role="alert" data-error hidden></p> <p class="pmt-small" data-availability></p> </div> <?php return ob_get_clean(); } function pmt_forest_admin_page() { if (!current_user_can('manage_options')) { return; } $store = pmt_forest_store(); $settings = pmt_forest_settings(); $notice = get_transient('pmt_forest_notice_' . get_current_user_id()); delete_transient('pmt_forest_notice_' . get_current_user_id()); $editing = isset($_GET['edit']) ? $store->get_booking(absint($_GET['edit'])) : null; $form = $editing ? array('id' => $editing['id'], 'revision' => $editing['revision'], 'company' => $editing['company'], 'logo_url' => $editing['logo_url'], 'tree_count' => $editing['tree_count'], 'status' => $editing['status'], 'zone' => 'all', 'code' => $editing['selection_code']) : array('id' => 0, 'revision' => 0, 'company' => '', 'logo_url' => '', 'tree_count' => 250, 'status' => 'reserved', 'zone' => 'all', 'code' => ''); if (!empty($notice['draft'])) { $form = wp_parse_args($notice['draft'], $form); } $labels = array('requested' => 'Angefragt', 'reserved' => 'Reserviert', 'booked' => 'Gebucht', 'cancelled' => 'Freigegeben'); $bookings = $store->list_bookings(); $occupied = $store->occupied(); $open = $store->count_open_requests(); $config = pmt_forest_base_config(); $config['admin'] = array('editingId' => (int) $form['id'], 'initialCode' => (string) $form['code'], 'originalCount' => (int) $form['tree_count']); $goal = pmt_forest_public_goal($settings); $status_choices = array('reserved' => 'Reserviert (blockiert, noch nicht gekauft)', 'booked' => 'Gebucht (gekauft, mit Name auf der Karte)'); if ($form['status'] === 'requested') { $status_choices = array('requested' => 'Angefragt (von der Website)') + $status_choices; } ?> <div class="wrap pmt-forest-admin"> <style> .pmt-forest-admin .pmt-admin-grid{display:grid;grid-template-columns:minmax(0,1.6fr) minmax(300px,1fr);gap:28px;align-items:start;margin-top:12px} @media (max-width:1100px){.pmt-forest-admin .pmt-admin-grid{grid-template-columns:1fr}} .pmt-forest-admin .pmt-admin-card{background:#fff;border:1px solid #dcdcde;border-radius:10px;padding:20px 22px} .pmt-forest-admin .pmt-admin-card h2{margin-top:0} .pmt-forest-admin .pmt-admin-steps{margin:0 0 14px 18px} .pmt-forest-admin .pmt-admin-steps li{margin:0 0 4px} .pmt-forest-admin .pmt-forest{font-size:14px} .pmt-forest-admin .pmt-field{margin:0 0 16px} .pmt-forest-admin .pmt-field label{display:block;font-weight:600;margin:0 0 6px} .pmt-forest-admin .pmt-field input[type=text],.pmt-forest-admin .pmt-field input[type=url],.pmt-forest-admin .pmt-field select{width:100%} .pmt-forest-admin .pmt-status-choice{display:flex;gap:10px;flex-wrap:wrap} .pmt-forest-admin .pmt-status-choice label{display:flex;gap:6px;align-items:center;font-weight:400;border:1px solid #c3c4c7;border-radius:6px;padding:8px 12px;cursor:pointer} .pmt-forest-admin .pmt-marked-info{padding:10px 12px;background:#f0f6ec;border-left:3px solid #2D5232;margin:0 0 16px} .pmt-forest-admin .pmt-stats{display:flex;gap:28px;flex-wrap:wrap;margin:8px 0 0} .pmt-forest-admin .pmt-stats strong{display:block;font-size:22px;line-height:1.2;color:#2D5232} .pmt-forest-admin tr.pmt-row-requested td{background:#fff8e5} .pmt-forest-admin .pmt-badge{display:inline-block;padding:2px 8px;border-radius:99px;font-size:12px;font-weight:600;background:#e7efe2;color:#2D5232} .pmt-forest-admin .pmt-badge--requested{background:#f6d77a;color:#5b4300} .pmt-forest-admin .pmt-badge--cancelled{background:#eee;color:#666} .pmt-forest-admin .pmt-contact{white-space:pre-wrap;margin:6px 0 0;font-size:12px;line-height:1.5} .pmt-forest-admin .pmt-actions{display:flex;gap:6px;flex-wrap:wrap} .pmt-forest-admin .pmt-actions form{margin:0} </style> <h1>DenkMalWald · Baumfläche Lüdenscheid</h1> <?php if ($notice): ?><div class="notice notice-<?php echo esc_attr($notice['type']); ?> is-dismissible"><p><?php echo esc_html($notice['message']); ?></p></div><?php endif; ?> <?php if ($open): ?><div class="notice notice-warning"><p><strong><?php echo esc_html(sprintf(_n('%d neue Anfrage', '%d neue Anfragen', $open), $open)); ?></strong> von der Website. Die Plätze sind vorgemerkt. Bitte unten bestätigen oder freigeben.</p></div><?php endif; ?> <div class="pmt-stats"> <div><strong><?php echo esc_html(number_format_i18n(68000 - count($occupied) * 10)); ?></strong>Unternehmensplätze frei</div> <div><strong><?php echo esc_html(number_format_i18n(count($occupied) * 10)); ?></strong>gebucht, reserviert oder angefragt</div> <div><strong><?php echo esc_html(number_format_i18n($goal['total'])); ?></strong>Ziel, davon 70.000 auf der Karte freigegeben</div> </div> <div class="pmt-admin-grid"> <div class="pmt-admin-card"> <h2><?php echo !empty($form['id']) ? 'Fläche von „' . esc_html($form['company']) . '“ bearbeiten' : 'Fläche auf der Karte markieren'; ?></h2> <ol class="pmt-admin-steps"> <li>Bereich anklicken. Er wird vergrößert.</li> <li>Anzahl Bäume einstellen und in die Karte klicken: Die Bäume werden um diese Stelle gesetzt.</li> <li>Oder ein Rechteck aufziehen. Mit gedrückter <kbd>Umschalt</kbd>-Taste fügen Sie weitere Rechtecke oder einzelne 10er-Plätze hinzu (Klick auf einen markierten Platz entfernt ihn).</li> <li>Rechts Firma und Status eintragen und speichern.</li> </ol> <?php echo pmt_forest_admin_map_markup(); // Statisches Markup ohne Benutzerdaten. ?> <script type="application/json" id="pmt-forest-admin-map-config"><?php echo wp_json_encode($config, JSON_HEX_TAG | JSON_HEX_AMP | JSON_HEX_APOS | JSON_HEX_QUOT); ?></script> </div> <div class="pmt-admin-card"> <h2><?php echo !empty($form['id']) ? 'Buchung bearbeiten' : 'Unternehmen eintragen'; ?></h2> <form method="post" action="<?php echo esc_url(admin_url('admin-post.php')); ?>" id="pmt-forest-booking-form"> <input type="hidden" name="action" value="pmt_forest_save"> <input type="hidden" name="id" value="<?php echo esc_attr($form['id']); ?>"> <input type="hidden" name="revision" value="<?php echo esc_attr($form['revision']); ?>"> <input type="hidden" name="tree_count" id="pmt-count" value="<?php echo esc_attr($form['tree_count']); ?>"> <?php wp_nonce_field('pmt_forest_save'); ?> <p class="pmt-marked-info" id="pmt-marked-info">Noch nichts markiert. Ohne Markierung teilt das Plugin freie Plätze automatisch zu.</p> <div class="pmt-field"><label for="pmt-company">Unternehmen</label><input type="text" id="pmt-company" name="company" value="<?php echo esc_attr($form['company']); ?>" maxlength="180" required></div> <div class="pmt-field"><label for="pmt-logo">Logo (optional)</label><input type="url" id="pmt-logo" name="logo_url" value="<?php echo esc_attr($form['logo_url']); ?>"><p><button class="button" type="button" id="pmt-media-select">Aus Mediathek wählen</button></p><p class="description">Ohne Logo zeigt die Karte den ersten Buchstaben des Firmennamens.</p></div> <div class="pmt-field"><span style="display:block;font-weight:600;margin:0 0 6px">Status</span> <div class="pmt-status-choice"> <?php foreach ($status_choices as $value => $label): ?> <label><input type="radio" name="status" value="<?php echo esc_attr($value); ?>" <?php checked($form['status'] === 'cancelled' ? 'reserved' : $form['status'], $value); ?>><?php echo esc_html($label); ?></label> <?php endforeach; ?> </div> <p class="description">Angefragte und reservierte Flächen sind gesperrt, zeigen aber keinen Namen. Erst „Gebucht“ zeigt Firma und Logo auf der Karte.</p> </div> <div class="pmt-field" id="pmt-zone-field"><label for="pmt-zone">Automatische Zuteilung (nur ohne Markierung)</label><select name="zone" id="pmt-zone"><option value="all" <?php selected($form['zone'], 'all'); ?>>Irgendwo auf der Unternehmensfläche</option><?php foreach (array_keys(PMT_Forest_Store::ZONES) as $key): ?><option value="<?php echo esc_attr($key); ?>" <?php selected($form['zone'], $key); ?>>Bereich <?php echo esc_html($key); ?></option><?php endforeach; ?></select></div> <details class="pmt-field" <?php echo $form['code'] && empty($form['id']) ? 'open' : ''; ?>> <summary><strong>Auswahl aus einer Anfrage übernehmen</strong></summary> <p class="description">Den Text aus der Anfrage-E-Mail (oder nur die Zeile mit „PMT1:“) einfügen. Die Karte zeigt die angefragte Stelle sofort an.</p> <textarea class="large-text code" id="pmt-code" name="code" rows="3"><?php echo esc_textarea($form['code']); ?></textarea> </details> <?php submit_button(!empty($form['id']) ? 'Änderungen speichern' : 'Fläche blockieren und speichern', 'primary', 'submit', false); ?> <?php if (!empty($form['id'])): ?> <a class="button" href="<?php echo esc_url(admin_url('admin.php?page=pmt-baumflaeche')); ?>">Abbrechen / neue Buchung</a><?php endif; ?> </form> </div> </div> <h2 style="margin-top:32px">Anfragen und Buchungen</h2> <p>„Angefragt“ kommt automatisch von der Website: Die Plätze sind vorgemerkt, die Kontaktdaten stehen in der Zeile. Nach der Abstimmung auf „Gebucht“ bestätigen oder freigeben. Die Beispielbuchung vor dem Verkaufsstart freigeben.</p> <table class="widefat striped"> <thead><tr><th>Unternehmen</th><th>Bäume</th><th>Status</th><th>Eingang</th><th>Aktionen</th></tr></thead> <tbody> <?php if (!$bookings): ?><tr><td colspan="5">Noch keine Anfragen oder Buchungen vorhanden.</td></tr><?php endif; ?> <?php foreach ($bookings as $booking): $status = $booking['status']; ?> <tr class="<?php echo $status === 'requested' ? 'pmt-row-requested' : ''; ?>"> <td><strong><?php echo esc_html($booking['company']); ?></strong><?php if ($booking['is_demo']): ?> <em>(Beispiel)</em><?php endif; ?> <?php $codes = PMT_Forest_Store::decode((string) $booking['selection_code']); if (!is_wp_error($codes) && $codes && $status !== 'cancelled'): ?><br><span class="description">Bereich <?php echo esc_html(implode(', ', PMT_Forest_Store::zone_keys($codes))); ?></span><?php endif; ?> <?php if (!empty($booking['contact'])): ?><details><summary>Kontaktdaten</summary><div class="pmt-contact"><?php echo esc_html($booking['contact']); ?></div></details><?php endif; ?> </td> <td><?php echo esc_html(number_format_i18n($booking['tree_count'])); ?></td> <td><span class="pmt-badge pmt-badge--<?php echo esc_attr($status); ?>"><?php echo esc_html(isset($labels[$status]) ? $labels[$status] : $status); ?></span></td> <td><?php echo esc_html(mysql2date('d.m.Y H:i', get_date_from_gmt($booking['created_at']))); ?></td> <td><div class="pmt-actions"> <?php if ($status === 'requested' || $status === 'reserved'): ?> <form method="post" action="<?php echo esc_url(admin_url('admin-post.php')); ?>"> <input type="hidden" name="action" value="pmt_forest_confirm"><input type="hidden" name="id" value="<?php echo esc_attr($booking['id']); ?>"><input type="hidden" name="revision" value="<?php echo esc_attr($booking['revision']); ?>"> <?php wp_nonce_field('pmt_forest_confirm_' . $booking['id']); ?> <button type="submit" class="button button-primary">Als gebucht bestätigen</button> </form> <?php endif; ?> <a class="button" href="<?php echo esc_url(add_query_arg(array('page' => 'pmt-baumflaeche', 'edit' => $booking['id']), admin_url('admin.php'))); ?>">Auf Karte bearbeiten</a> <?php if ($status !== 'cancelled'): ?> <form method="post" action="<?php echo esc_url(admin_url('admin-post.php')); ?>" onsubmit="return confirm('Plätze freigeben? Der Eintrag bleibt in der Liste.');"> <input type="hidden" name="action" value="pmt_forest_cancel"><input type="hidden" name="id" value="<?php echo esc_attr($booking['id']); ?>"><input type="hidden" name="revision" value="<?php echo esc_attr($booking['revision']); ?>"> <?php wp_nonce_field('pmt_forest_cancel_' . $booking['id']); ?> <button type="submit" class="button">Freigeben</button> </form><?php endif; ?> </div></td> </tr> <?php endforeach; ?> </tbody> </table> <h2 style="margin-top:32px">Einstellungen</h2> <p>Button-Texte, Hinweise und Partnerstufen ändern Sie unter <a href="<?php echo esc_url(admin_url('admin.php?page=pmt-baumflaeche-texte')); ?>">Baumfläche → Texte</a>.</p> <form method="post" action="<?php echo esc_url(admin_url('admin-post.php')); ?>"> <input type="hidden" name="action" value="pmt_forest_settings"><?php wp_nonce_field('pmt_forest_settings'); ?> <table class="form-table" role="presentation"> <tr><th colspan="2"><h3 style="margin:0">Anfragen</h3></th></tr> <tr><th>E-Mail-Empfänger</th><td><p class="description" style="margin-top:0">Wird im Elementor-Formular eingestellt: Formular bearbeiten → Aktionen nach dem Absenden → E-Mail → <strong>An</strong>, z. B. partner@plant-my-tree.de.</p></td></tr> <tr><th><label for="pmt-auto">Plätze automatisch vormerken</label></th><td><label><input type="checkbox" id="pmt-auto" name="auto_reserve" value="1" <?php checked(!empty($settings['auto_reserve'])); ?>> Beim Absenden einer Anfrage werden die Plätze sofort gesperrt und erscheinen oben als „Angefragt“.</label></td></tr> <tr><th><label for="pmt-rate">Anfragen je Absender und Tag</label></th><td><input type="number" min="1" max="50" id="pmt-rate" name="rate_limit" value="<?php echo esc_attr($settings['rate_limit']); ?>"><p class="description">Schutz vor Spam: Danach sind von derselben Adresse für 24 Stunden keine weiteren Vormerkungen möglich.</p></td></tr> <tr><th>Personen zur Pflanzung</th><td>Je <input type="number" min="1" style="width:90px" name="people_per" value="<?php echo esc_attr($settings['people_per']); ?>"> Bäume <input type="number" min="0" style="width:70px" name="people_min" value="<?php echo esc_attr($settings['people_min']); ?>"> bis <input type="number" min="1" style="width:70px" name="people_max" value="<?php echo esc_attr($settings['people_max']); ?>"> Personen<p class="description">Standard: je 250 Bäume 5 bis 20 Personen, also 500 Bäume = 10 bis 40 Personen. Steht unter den Anfrage-Buttons.</p></td></tr> <tr><th colspan="2"><h3 style="margin:0">Preise</h3></th></tr> <tr><th><label for="pmt-price">Preis je Baum für Unternehmen, netto (€)</label></th><td><input id="pmt-price" name="price" inputmode="decimal" value="<?php echo esc_attr(number_format($settings['price_cents'] / 100, 2, ',', '')); ?>" required><p class="description">Gilt für Karte, Partnerstufen und Anfrage.</p></td></tr> <tr><th><label for="pmt-private-price">Preis je Baum privat, brutto (€)</label></th><td><input id="pmt-private-price" name="private_price" inputmode="decimal" value="<?php echo $settings['private_price_cents'] ? esc_attr(number_format($settings['private_price_cents'] / 100, 2, ',', '')) : ''; ?>"><p class="description">Optional. Leer lassen, dann zeigt der Privatblock keinen Preis.</p></td></tr> <tr><th colspan="2"><h3 style="margin:0">Shop für Privatpersonen</h3></th></tr> <tr><th><label for="pmt-shop">Shopify-Produkt</label></th><td><input class="large-text" type="url" id="pmt-shop" name="shop_url" value="<?php echo esc_attr($settings['shop_url']); ?>"><p class="description">Der Bestand von 2.000 Privatbäumen wird in Shopify gepflegt.</p></td></tr> <tr><th><label for="pmt-private-variant">Varianten-ID</label></th><td><input id="pmt-private-variant" name="private_variant" value="<?php echo esc_attr($settings['private_variant']); ?>"><p class="description">Nötig, wenn das Produkt mehrere Varianten hat. Dann geht der Button direkt in den Warenkorb.</p></td></tr> <tr><th colspan="2"><h3 style="margin:0">Anzeige</h3></th></tr> <tr><th><label for="pmt-goal-total">Gesamtziel Bäume</label></th><td><input type="number" min="70000" step="1000" id="pmt-goal-total" name="goal_total" value="<?php echo esc_attr($settings['goal_total']); ?>"><p class="description">70.000 Plätze sind auf der Karte freigegeben. Der Rest steht im Satz unter der Karte: „Die weiteren … geben wir nach und nach frei.“</p></td></tr> <tr><th><label for="pmt-start-path">Geöffneter Weg beim Laden</label></th><td><select id="pmt-start-path" name="start_path"><option value="karte" <?php selected($settings['start_path'], 'karte'); ?>>Platz auf der Karte wählen</option><option value="direkt" <?php selected($settings['start_path'], 'direkt'); ?>>Direkt beitragen</option></select><p class="description">Pro Seite überschreibbar: <code>[pmt_baumflaeche_iso start="direkt"]</code></p></td></tr> <tr><th><label for="pmt-contact">Kontaktseite</label></th><td><input class="large-text" type="url" id="pmt-contact" name="contact_url" value="<?php echo esc_attr($settings['contact_url']); ?>"></td></tr> <tr><th colspan="2"><h3 style="margin:0">Anfrageformular</h3></th></tr> <tr><th><label for="pmt-form-id">Elementor Formular CSS-ID</label></th><td><input id="pmt-form-id" name="form_id" value="<?php echo esc_attr($settings['form_id']); ?>" required><p class="description">Unter Erweitert → CSS-ID, ohne #.</p></td></tr> <tr><th><label for="pmt-field-id">Verstecktes Elementor Feld: ID</label></th><td><input id="pmt-field-id" name="field_id" value="<?php echo esc_attr($settings['field_id']); ?>" required><p class="description">Feldtyp Hidden / Versteckt. In der E-Mail [all-fields] verwenden. Ein Feld mit „Firma“ oder „Unternehmen“ im Namen wird als Firmenname übernommen.</p></td></tr> </table> <?php submit_button('Einstellungen speichern'); ?> </form> </div> <?php }
Exec
https://plant-my-tree.de/post-sitemap1.xml
2026-11-20T10:18:25+01:00
https://plant-my-tree.de/page-sitemap1.xml
2026-12-03T12:53:57+01:00
https://plant-my-tree.de/lp-sitemap1.xml
2026-12-02T08:42:41+01:00
https://plant-my-tree.de/ratgeber-sitemap1.xml
2026-11-24T10:16:19+01:00
https://plant-my-tree.de/aufforstungsflachen-sitemap1.xml
2026-11-23T12:04:20+01:00
https://plant-my-tree.de/blog-sitemap1.xml
2026-11-24T09:10:09+01:00
https://plant-my-tree.de/category-sitemap1.xml
https://plant-my-tree.de/post_tag-sitemap1.xml