Changeset 3506160
- Timestamp:
- 04/14/2026 02:58:08 PM (6 months ago)
- Location:
- gastro-site-table-reservation
- Files:
-
- 43 added
- 4 edited
-
tags/1.0.1 (added)
-
tags/1.0.1/admin (added)
-
tags/1.0.1/admin/assets (added)
-
tags/1.0.1/admin/assets/css (added)
-
tags/1.0.1/admin/assets/css/settings.css (added)
-
tags/1.0.1/admin/settings.php (added)
-
tags/1.0.1/gastro-site-table-reservation.php (added)
-
tags/1.0.1/includes (added)
-
tags/1.0.1/includes/frontend.php (added)
-
tags/1.0.1/languages (added)
-
tags/1.0.1/languages/gastro-site-table-reservation-cs_CZ.mo (added)
-
tags/1.0.1/languages/gastro-site-table-reservation-cs_CZ.po (added)
-
tags/1.0.1/languages/gastro-site-table-reservation-da_DK.mo (added)
-
tags/1.0.1/languages/gastro-site-table-reservation-da_DK.po (added)
-
tags/1.0.1/languages/gastro-site-table-reservation-de_DE.mo (added)
-
tags/1.0.1/languages/gastro-site-table-reservation-de_DE.po (added)
-
tags/1.0.1/languages/gastro-site-table-reservation-el_GR.mo (added)
-
tags/1.0.1/languages/gastro-site-table-reservation-el_GR.po (added)
-
tags/1.0.1/languages/gastro-site-table-reservation-es_ES.mo (added)
-
tags/1.0.1/languages/gastro-site-table-reservation-es_ES.po (added)
-
tags/1.0.1/languages/gastro-site-table-reservation-fi_FI.mo (added)
-
tags/1.0.1/languages/gastro-site-table-reservation-fi_FI.po (added)
-
tags/1.0.1/languages/gastro-site-table-reservation-fr_FR.mo (added)
-
tags/1.0.1/languages/gastro-site-table-reservation-fr_FR.po (added)
-
tags/1.0.1/languages/gastro-site-table-reservation-it_IT.mo (added)
-
tags/1.0.1/languages/gastro-site-table-reservation-it_IT.po (added)
-
tags/1.0.1/languages/gastro-site-table-reservation-nl_NL.mo (added)
-
tags/1.0.1/languages/gastro-site-table-reservation-nl_NL.po (added)
-
tags/1.0.1/languages/gastro-site-table-reservation-no_NO.mo (added)
-
tags/1.0.1/languages/gastro-site-table-reservation-no_NO.po (added)
-
tags/1.0.1/languages/gastro-site-table-reservation-pl_PL.mo (added)
-
tags/1.0.1/languages/gastro-site-table-reservation-pl_PL.po (added)
-
tags/1.0.1/languages/gastro-site-table-reservation-ro_RO.mo (added)
-
tags/1.0.1/languages/gastro-site-table-reservation-ro_RO.po (added)
-
tags/1.0.1/languages/gastro-site-table-reservation-sk_SK.mo (added)
-
tags/1.0.1/languages/gastro-site-table-reservation-sk_SK.po (added)
-
tags/1.0.1/languages/gastro-site-table-reservation-sv_SE.mo (added)
-
tags/1.0.1/languages/gastro-site-table-reservation-sv_SE.po (added)
-
tags/1.0.1/languages/gastro-site-table-reservation-tr_TR.mo (added)
-
tags/1.0.1/languages/gastro-site-table-reservation-tr_TR.po (added)
-
tags/1.0.1/languages/gastro-site-table-reservation.pot (added)
-
tags/1.0.1/readme.txt (added)
-
tags/1.0.1/uninstall.php (added)
-
trunk/admin/settings.php (modified) (4 diffs)
-
trunk/gastro-site-table-reservation.php (modified) (2 diffs)
-
trunk/includes/frontend.php (modified) (4 diffs)
-
trunk/readme.txt (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
gastro-site-table-reservation/trunk/admin/settings.php
r3267180 r3506160 1 1 <?php 2 2 if (!defined('ABSPATH')) exit; 3 4 function gastrosite_reservation_get_supported_languages() { 5 return [ 6 'ar' => 'العربية', 7 'bg' => 'Български', 8 'cs' => 'Čeština', 9 'da' => 'Dansk', 10 'de' => 'Deutsch', 11 'el' => 'Ελληνικά', 12 'en' => 'English', 13 'es' => 'Español', 14 'et' => 'Eesti', 15 'fi' => 'Suomi', 16 'fr' => 'Français', 17 'he' => 'עברית', 18 'hi' => 'हिन्दी', 19 'hr' => 'Hrvatski', 20 'hu' => 'Magyar', 21 'id' => 'Bahasa Indonesia', 22 'it' => 'Italiano', 23 'ja' => '日本語', 24 'ko' => '한국어', 25 'lt' => 'Lietuvių', 26 'lv' => 'Latviešu', 27 'ms' => 'Bahasa Melayu', 28 'nl' => 'Nederlands', 29 'no' => 'Norsk', 30 'pl' => 'Polski', 31 'pt' => 'Português', 32 'ro' => 'Română', 33 'ru' => 'Русский', 34 'sk' => 'Slovenčina', 35 'sl' => 'Slovenščina', 36 'sv' => 'Svenska', 37 'sw' => 'Kiswahili', 38 'th' => 'ไทย', 39 'tr' => 'Türkçe', 40 'vi' => 'Tiếng Việt', 41 'zh' => '中文', 42 ]; 43 } 44 45 function gastrosite_reservation_sanitize_language($value) { 46 $value = sanitize_text_field($value); 47 $languages = gastrosite_reservation_get_supported_languages(); 48 return array_key_exists($value, $languages) ? $value : ''; 49 } 50 51 function gastrosite_reservation_sanitize_button_size($value) { 52 $value = sanitize_text_field($value); 53 return in_array($value, ['sm', 'lg'], true) ? $value : ''; 54 } 55 56 function gastrosite_reservation_sanitize_button_color($value) { 57 $value = sanitize_text_field($value); 58 return in_array($value, ['white', 'gray', 'primary'], true) ? $value : ''; 59 } 60 61 function gastrosite_reservation_sanitize_button_position($value) { 62 $value = sanitize_text_field($value); 63 return in_array($value, ['left', 'right'], true) ? $value : ''; 64 } 3 65 4 66 function gastrosite_reservation_add_admin_menu() { … … 15 77 function gastrosite_reservation_register_settings() { 16 78 register_setting('gastrosite_reservation_settings_group', 'gastrosite_reservation_id', ['sanitize_callback' => 'sanitize_text_field']); 17 register_setting('gastrosite_reservation_settings_group', 'gastrosite_reservation_language', ['sanitize_callback' => ' sanitize_text_field']);79 register_setting('gastrosite_reservation_settings_group', 'gastrosite_reservation_language', ['sanitize_callback' => 'gastrosite_reservation_sanitize_language']); 18 80 register_setting('gastrosite_reservation_settings_group', 'gastrosite_reservation_show_header', ['sanitize_callback' => 'absint']); 19 81 register_setting('gastrosite_reservation_settings_group', 'gastrosite_reservation_color', ['sanitize_callback' => 'sanitize_hex_color']); 20 82 register_setting('gastrosite_reservation_settings_group', 'gastrosite_reservation_button_text', ['sanitize_callback' => 'sanitize_text_field']); 21 register_setting('gastrosite_reservation_settings_group', 'gastrosite_reservation_button_size', ['sanitize_callback' => ' sanitize_text_field']);22 register_setting('gastrosite_reservation_settings_group', 'gastrosite_reservation_button_color', ['sanitize_callback' => ' sanitize_text_field']);83 register_setting('gastrosite_reservation_settings_group', 'gastrosite_reservation_button_size', ['sanitize_callback' => 'gastrosite_reservation_sanitize_button_size']); 84 register_setting('gastrosite_reservation_settings_group', 'gastrosite_reservation_button_color', ['sanitize_callback' => 'gastrosite_reservation_sanitize_button_color']); 23 85 register_setting('gastrosite_reservation_settings_group', 'gastrosite_reservation_z_index', ['sanitize_callback' => 'absint']); 24 register_setting('gastrosite_reservation_settings_group', 'gastrosite_reservation_button_position', ['sanitize_callback' => ' sanitize_text_field']);86 register_setting('gastrosite_reservation_settings_group', 'gastrosite_reservation_button_position', ['sanitize_callback' => 'gastrosite_reservation_sanitize_button_position']); 25 87 } 26 88 add_action('admin_init', 'gastrosite_reservation_register_settings'); … … 65 127 <option value=""><?php esc_html_e('Use WordPress language', 'gastro-site-table-reservation'); ?></option> 66 128 <?php 67 $languages = [ 68 'cs' => 'Čeština', 69 'da' => 'Dansk', 70 'de' => 'Deutsch', 71 'el' => 'Ελληνικά', 72 'en' => 'English', 73 'es' => 'Español', 74 'fi' => 'Suomi', 75 'fr' => 'Français', 76 'it' => 'Italiano', 77 'nl' => 'Nederlands', 78 'no' => 'Norsk', 79 'pl' => 'Polski', 80 'ro' => 'Română', 81 'sk' => 'Slovenčina', 82 'sv' => 'Svenska', 83 'tr' => 'Türkçe', 84 ]; 129 $languages = gastrosite_reservation_get_supported_languages(); 85 130 86 131 $selected_lang = get_option('gastrosite_reservation_language', ''); … … 170 215 <p><?php esc_html_e('You can also embed the widget manually using the following shortcode:', 'gastro-site-table-reservation'); ?></p> 171 216 <code>[book_a_table]</code> 172 <p><?php esc_html_e('Optional attributes:', 'gastro-site-table-reservation'); ?> <code>lang</code>, <code>header</code>, <code>primary-color</code> </p>217 <p><?php esc_html_e('Optional attributes:', 'gastro-site-table-reservation'); ?> <code>lang</code>, <code>header</code>, <code>primary-color</code>, <code>render-method</code>, <code>button-label</code>, <code>button-size</code>, <code>button-color</code>, <code>button-position</code>, <code>z-index</code></p> 173 218 <p><em><?php esc_html_e('The ID is always taken from the plugin settings.', 'gastro-site-table-reservation'); ?></em></p> 174 219 <p><strong><?php esc_html_e('Example:', 'gastro-site-table-reservation'); ?></strong></p> 175 <code>[book_a_table lang="de" header="true" primary-color="#E74E60" ]</code>220 <code>[book_a_table lang="de" header="true" primary-color="#E74E60" render-method="button" button-label="Reserve table online" button-size="lg" button-color="primary" button-position="right" z-index="1000"]</code> 176 221 </div> 177 222 </div> -
gastro-site-table-reservation/trunk/gastro-site-table-reservation.php
r3267180 r3506160 3 3 * Plugin Name: Gastro.site Table Reservation 4 4 * Description: Integrate the Gastro.site Table Reservation Tool in your Website. 5 * Version: 1.0. 05 * Version: 1.0.1 6 6 * Author: Gastro.site 7 7 * Author URI: https://www.gastro.site … … 17 17 define('GASTROSITE_RESERVATION_PLUGIN_DIR', plugin_dir_path(__FILE__)); 18 18 define('GASTROSITE_RESERVATION_PLUGIN_URL', plugin_dir_url(__FILE__)); 19 define('GASTROSITE_RESERVATION_PLUGIN_VERSION', '1.0. 0');19 define('GASTROSITE_RESERVATION_PLUGIN_VERSION', '1.0.1'); 20 20 21 21 function gastrosite_reservation_plugin_action_links($links) { -
gastro-site-table-reservation/trunk/includes/frontend.php
r3267180 r3506160 3 3 4 4 $GLOBALS['gastrosite_reservation_shortcode_used'] = false; 5 6 function gastrosite_reservation_filter_attribute_value($value, $allowed_values) { 7 $value = sanitize_text_field((string) $value); 8 return in_array($value, $allowed_values, true) ? $value : null; 9 } 10 11 function gastrosite_reservation_normalize_header_attribute($value) { 12 if (is_bool($value)) { 13 return $value ? 'true' : null; 14 } 15 16 $value = strtolower(sanitize_text_field((string) $value)); 17 if (in_array($value, ['1', 'true', 'yes', 'on'], true)) { 18 return 'true'; 19 } 20 21 return null; 22 } 5 23 6 24 function gastrosite_reservation_enqueue_script() { … … 30 48 $primary_color = get_option('gastrosite_reservation_color'); 31 49 $button_label = get_option('gastrosite_reservation_button_text'); 32 $button_size = g et_option('gastrosite_reservation_button_size');33 $button_color = g et_option('gastrosite_reservation_button_color');50 $button_size = gastrosite_reservation_filter_attribute_value(get_option('gastrosite_reservation_button_size'), ['sm', 'lg']); 51 $button_color = gastrosite_reservation_filter_attribute_value(get_option('gastrosite_reservation_button_color'), ['white', 'gray', 'primary']); 34 52 $z_index = get_option('gastrosite_reservation_z_index'); 35 $button_position = g et_option('gastrosite_reservation_button_position');53 $button_position = gastrosite_reservation_filter_attribute_value(get_option('gastrosite_reservation_button_position'), ['left', 'right']); 36 54 37 55 $output = '<book-a-table id="BAT' . esc_attr($id) . '" render-method="button"'; … … 77 95 $settings_show_header = get_option('gastrosite_reservation_show_header') ? 'true' : null; 78 96 $settings_primary_color = get_option('gastrosite_reservation_color'); 97 $settings_button_label = get_option('gastrosite_reservation_button_text'); 98 $settings_button_size = gastrosite_reservation_filter_attribute_value(get_option('gastrosite_reservation_button_size'), ['sm', 'lg']); 99 $settings_button_color = gastrosite_reservation_filter_attribute_value(get_option('gastrosite_reservation_button_color'), ['white', 'gray', 'primary']); 100 $settings_z_index = get_option('gastrosite_reservation_z_index'); 101 $settings_button_position = gastrosite_reservation_filter_attribute_value(get_option('gastrosite_reservation_button_position'), ['left', 'right']); 79 102 80 103 if (empty($settings_lang)) { … … 87 110 'header' => $settings_show_header, 88 111 'primary-color' => $settings_primary_color, 112 'render-method' => 'inline', 113 'button-label' => $settings_button_label, 114 'button-size' => $settings_button_size, 115 'button-color' => $settings_button_color, 116 'button-position' => $settings_button_position, 117 'z-index' => $settings_z_index, 89 118 ], $atts, 'book_a_table'); 119 120 $allowed_atts['lang'] = sanitize_text_field((string) $allowed_atts['lang']); 121 $allowed_atts['header'] = gastrosite_reservation_normalize_header_attribute($allowed_atts['header']); 122 $allowed_atts['primary-color'] = sanitize_hex_color((string) $allowed_atts['primary-color']); 123 $allowed_atts['render-method'] = gastrosite_reservation_filter_attribute_value($allowed_atts['render-method'], ['inline', 'button']); 124 $allowed_atts['button-label'] = sanitize_text_field((string) $allowed_atts['button-label']); 125 $allowed_atts['button-size'] = gastrosite_reservation_filter_attribute_value($allowed_atts['button-size'], ['sm', 'lg']); 126 $allowed_atts['button-color'] = gastrosite_reservation_filter_attribute_value($allowed_atts['button-color'], ['white', 'gray', 'primary']); 127 $allowed_atts['button-position'] = gastrosite_reservation_filter_attribute_value($allowed_atts['button-position'], ['left', 'right']); 128 $allowed_atts['z-index'] = absint($allowed_atts['z-index']); 90 129 91 130 if (empty($settings_id)) { -
gastro-site-table-reservation/trunk/readme.txt
r3267180 r3506160 3 3 Tags: table booking, reservations, restaurant, tischreservierung, gastro.site 4 4 Requires at least: 5.5 5 Tested up to: 6. 75 Tested up to: 6.9 6 6 Requires PHP: 7.4 7 Stable tag: 1.0. 07 Stable tag: 1.0.1 8 8 License: GPLv2 or later 9 9 License URI: https://www.gnu.org/licenses/gpl-2.0.html … … 24 24 25 25 = Does this plugin work with all WordPress themes? = 26 Yes, as long as your theme supports the `wp_head` hook.26 Yes, as long as your theme supports either the `wp_body_open` or the `wp_footer` hook. 27 27 28 28 = How do I embed the booking widget manually? = … … 35 35 - `header`: Show header above the widget (`true` or `false`). Defaults to plugin setting. 36 36 - `primary-color`: Primary color for the widget in hex format (e.g. `#E74E60`). Defaults to plugin setting. 37 - `render-method`: Display mode (`inline` or `button`). Defaults to `inline`. 38 - `button-label`: Text shown on the booking button. 39 - `button-size`: Button size (`sm` or `lg`). 40 - `button-color`: Button color (`white`, `gray`, or `primary`). 41 - `button-position`: Button position (`left` or `right`). 42 - `z-index`: Numeric z-index value. 37 43 38 44 Example: 39 `[book_a_table lang="de" header="true" primary-color="#E74E60" ]`45 `[book_a_table lang="de" header="true" primary-color="#E74E60" render-method="button" button-label="Reserve table online" button-size="lg" button-color="primary" button-position="right" z-index="1000"]` 40 46 41 47 The ID is always taken from the plugin settings and cannot be set via the shortcode. 42 48 43 49 == Changelog == 50 = 1.0.1 = 51 * Compatibility update for WordPress 6.9 52 * Extended shortcode attributes for advanced widget configuration 53 * Improved settings validation for integration options 54 44 55 = 1.0.0 = 45 56 * Initial release
Note:
See TracChangeset
for help on using the changeset viewer.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)