Changeset 3708267
- Timestamp:
- 09/22/2026 11:55:32 PM (5 weeks ago)
- Location:
- rentsyst/trunk
- Files:
-
- 7 added
- 11 edited
-
README.txt (modified) (2 diffs)
-
admin/Rentsyst_Admin.php (modified) (1 diff)
-
admin/components/Rentsyst_FormSearch_Widget.php (modified) (1 diff)
-
admin/components/Rentsyst_Widget.php (modified) (1 diff)
-
admin/js/block-booking.js (modified) (1 diff)
-
includes/Rentsyst.php (modified) (4 diffs)
-
includes/elementor (added)
-
includes/elementor/Rentsyst_Elementor.php (added)
-
includes/elementor/widgets (added)
-
includes/elementor/widgets/Rentsyst_Elementor_Booking.php (added)
-
includes/elementor/widgets/Rentsyst_Elementor_SearchForm.php (added)
-
includes/elementor/widgets/Rentsyst_Elementor_Vehicles.php (added)
-
includes/shortcodes/booking.php (modified) (2 diffs)
-
rentsyst.php (modified) (2 diffs)
-
site/Rentsyst_ResourceLoader.php (modified) (2 diffs)
-
site/js/rentsyst-elementor-preview.js (added)
-
site/partials/booking-v2.php (modified) (1 diff)
-
site/partials/booking.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
rentsyst/trunk/README.txt
r3685432 r3708267 4 4 Requires at least: 6.0 5 5 Tested up to: 7.0.0 6 Stable tag: 2.1. 36 Stable tag: 2.1.5 7 7 Requires PHP: 7.0 8 8 License: GPLv2 or later … … 126 126 127 127 == Changelog == 128 Version 2.1.4 – September 22, 2026 129 Fix: Design v2 bundles no longer override the global `_` (Underscore.js), which broke the Elementor editor and the WordPress media library in wp-admin. 130 Fix: The frontend assets are no longer loaded on wp-admin screens that only render post content, such as SEO analysers and page builders. 131 Fix: The booking and search form blocks show the widget again in the block editor instead of "Security error: invalid security token". 132 New: Native Elementor widgets — RentSyst Booking, RentSyst Search Form and RentSyst Vehicles — that render and update live inside the Elementor editor. 133 128 134 Version 2.0.123 – February 5, 2026 129 135 Security Fix: Fixed a Broken Access Control vulnerability in the REST API endpoint (rentsyst/v1/access-token). Added origin validation to restrict access to same-site requests only, preventing unauthorized external access to the API token. -
rentsyst/trunk/admin/Rentsyst_Admin.php
r3667904 r3708267 209 209 // Design v2 loads the Google Maps SDK itself with the key from the settings, or falls back to OpenStreetMap. 210 210 wp_enqueue_script( $this->plugin_name . '_bundle', dirname( plugin_dir_url( __FILE__ ) ) . '/resources-v2/static/js/bundle_admin_.js', [], $this->version, ['in_footer' => true] ); 211 Rentsyst_ResourceLoader::restoreUnderscore( $this->plugin_name . '_bundle' ); 211 212 } 212 213 } -
rentsyst/trunk/admin/components/Rentsyst_FormSearch_Widget.php
r2979561 r3708267 209 209 $marginTop = $attributes['marginTop'] ?? 0; 210 210 211 // The iframe lands on the admin screen that checks this nonce before rendering. 211 212 $params = http_build_query([ 212 'params' => $settingsDynamic 213 'params' => $settingsDynamic, 214 '_wpnonce' => wp_create_nonce( 'rentsyst_iframe_nonce' ), 213 215 ]); 214 216 -
rentsyst/trunk/admin/components/Rentsyst_Widget.php
r2979561 r3708267 233 233 $settingsDynamic = static::generateSetting($attributes); 234 234 235 // The iframe lands on the admin screen that checks this nonce before rendering. 235 236 $params = http_build_query([ 236 'params' => $settingsDynamic 237 'params' => $settingsDynamic, 238 '_wpnonce' => wp_create_nonce( 'rentsyst_iframe_nonce' ), 237 239 ]); 238 240 -
rentsyst/trunk/admin/js/block-booking.js
r2979561 r3708267 12 12 wp.element.createElement( 'path', 13 13 { 14 class : 'st0',14 className: 'st0', 15 15 d: "M17.9,1.7c0.2,0,0.4,0.2,0.4,0.4v4.1c-1.4,0.7-2.4,2.1-2.4,3.8c0,1.7,1,3.1,2.4,3.8V18c0,0.2-0.2,0.4-0.4,0.4\n" + 16 16 " H2.1c-0.2,0-0.4-0.2-0.4-0.4v-4c1.6-0.6,2.8-2.2,2.8-4c0-1.8-1.2-3.4-2.8-4V2.1c0-0.2,0.2-0.4,0.4-0.4H17.9 M17.9,0.1H2.1\n" + -
rentsyst/trunk/includes/Rentsyst.php
r3427502 r3708267 5 5 use rentsyst\admin\Rentsyst_Admin; 6 6 use rentsyst\includes\cli\Rentsyst_CLI_Command; 7 use rentsyst\includes\elementor\Rentsyst_Elementor; 7 8 use rentsyst\site\Rentsyst_Site; 8 9 use function add_action; … … 80 81 $this->define_admin_hooks(); 81 82 $this->load_site_components(); 83 $this->load_elementor_support(); 82 84 $this->includes(); 83 85 $this->register_cli_commands(); … … 148 150 'methods' => 'POST', 149 151 'callback' => [$plugin_admin, 'wp_rest_handler'], 152 // The route saves the plugin settings, and the nonce the handler checks is 153 // handed to every logged in user, so the capability has to be checked too. 154 'permission_callback' => function () { 155 return current_user_can( 'manage_options' ); 156 }, 150 157 ) ); 151 158 } ); … … 168 175 169 176 add_action('init', [$plugin_public, 'init']); 177 178 } 179 180 /** 181 * Native Elementor widgets and the editor glue around them. 182 * The hooks stay dormant until Elementor itself loads. 183 */ 184 private function load_elementor_support() { 185 186 Rentsyst_Elementor::init(); 170 187 171 188 } -
rentsyst/trunk/includes/shortcodes/booking.php
r3426844 r3708267 4 4 use rentsyst\includes\Rentsyst_PluginSettings; 5 5 use rentsyst\site\Rentsyst_BookingWidget; 6 use rentsyst\includes\elementor\Rentsyst_Elementor; 6 7 use rentsyst\site\Rentsyst_ResourceLoader; 7 8 … … 34 35 } 35 36 36 if ((!is_main_query() || !in_the_loop()) && !isset($params['force_output'])) { 37 // Elementor renders the page outside the main loop, both in the editor and when it 38 // re-renders a single widget over AJAX, so the widget itself has to stand in for the loop. 39 if ((!is_main_query() || !in_the_loop()) && !isset($params['force_output']) && !Rentsyst_Elementor::isRendering()) { 37 40 return 'Booking page'; 38 41 } 42 43 unset($params['force_output']); 39 44 40 45 $widgetOutput = Rentsyst_BookingWidget::widget($params); -
rentsyst/trunk/rentsyst.php
r3685432 r3708267 17 17 * Plugin URI: https://rentsyst.com/wp/ 18 18 * Description: Fleet management software for car rental business. 19 * Version: 2.1. 319 * Version: 2.1.5 20 20 * Author: Rentsyst 21 21 * Author URI: https://rentsyst.com/ … … 39 39 */ 40 40 41 define( 'RENTSYST_VERSION', '2.1. 3' );41 define( 'RENTSYST_VERSION', '2.1.5' ); 42 42 define( 'RENTSYST_PLUGIN_NAME', 'rentsyst' ); 43 43 define( 'RENTSYST_MOD', 'prod'); -
rentsyst/trunk/site/Rentsyst_ResourceLoader.php
r3667904 r3708267 26 26 public static function registerAll() 27 27 { 28 if(!self::isFrontendRequest()) { 29 return false; 30 } 28 31 if(Rentsyst_PaymentStatusWidget::$is_display) { 29 32 return false; … … 66 69 if($this->isV2()) { 67 70 wp_enqueue_script( self::PREFIX .'bundle_front', WP_RENTSYST_PLUGIN_URL . '/resources-v2/static/js/bundle_front.js', [], $this->version, true ); 71 self::restoreUnderscore( self::PREFIX . 'bundle_front' ); 68 72 } else { 69 73 wp_enqueue_script( self::PREFIX .'bundle_front', WP_RENTSYST_PLUGIN_URL . '/resources-v1/static/js/bundle_front.js', array( 'jquery' ), $this->version, true ); 70 74 } 75 } 76 77 /** 78 * The frontend set weighs about 2 MB and has nothing to do on a wp-admin screen. 79 * Third party plugins (SEO analysers, page builders) render post content in the admin, 80 * which used to drag the whole set into wp-admin and break the Elementor editor there. 81 * The own admin screens of the plugin render the booking widget on purpose, and so does 82 * every AJAX request that returns widget markup, so both keep the assets. 83 */ 84 private static function isFrontendRequest() 85 { 86 if ( ! is_admin() || wp_doing_ajax() ) { 87 return true; 88 } 89 90 if ( isset( $_GET['rentsyst-iframe'] ) || isset( $_GET['rentsyst-iframe-v2'] ) ) { 91 return true; 92 } 93 94 return isset( $_GET['page'] ) && strpos( sanitize_text_field( $_GET['page'] ), 'rentsyst' ) === 0; 95 } 96 97 /** 98 * Design v2 bundles embed lodash, whose UMD tail assigns window._ unconditionally 99 * (webpack exposes define.amd, so lodash takes the AMD branch). That replaces 100 * Underscore.js expected by WP core (wp-backbone, media-views) and Elementor. 101 * Put the previous _ back right after the bundle. Lodash stays in place when it 102 * took over nothing, so a page that has no Underscore keeps the global it had. 103 */ 104 public static function restoreUnderscore( $handle ) 105 { 106 $shim = 'if(window._&&typeof window._.noConflict==="function"&&typeof window._.pluck!=="function"){' 107 . 'var rsLodash=window._.noConflict();' 108 . 'if(!window._||typeof window._.pluck!=="function"){window._=rsLodash;}' 109 . '}'; 110 111 wp_add_inline_script( $handle, $shim, 'after' ); 71 112 } 72 113 -
rentsyst/trunk/site/partials/booking-v2.php
r2992156 r3708267 10 10 11 11 window.addEventListener( "load", ( function() { 12 RentSystFrame.init( { 13 container: document.getElementById("rentsyst_frame"), 12 var container = document.getElementById("rentsyst_frame"); 13 // The Elementor editor mounts the app itself as soon as it re-renders the 14 // widget, so skip a container that already carries the app. 15 if ( ! container || container.dataset.rentsystMounted ) { 16 return; 17 } 18 container.dataset.rentsystMounted = "1"; 19 RentSystFrame.init( { 20 container: container, 14 21 containerClassName: "wp-rentsyst-constructor" 15 22 } ) -
rentsyst/trunk/site/partials/booking.php
r2979561 r3708267 6 6 <?php 7 7 $script = <<<JS 8 window.rentsyst_settings = JSON.parse('$settings'); 9 (function () { 10 var container = document.getElementById("rentsyst_frame"); 11 // The Elementor editor mounts the app itself as soon as it re-renders the 12 // widget, so skip a container that already carries the app. 13 if ( ! container || container.dataset.rentsystMounted ) { 14 return; 15 } 16 container.dataset.rentsystMounted = "1"; 8 17 RentsystFrame.init({ 9 container: document.getElementById("rentsyst_frame"),10 settings: JSON.parse('$settings'),18 container: container, 19 settings: window.rentsyst_settings, 11 20 onResize: function (width, height) {}, 12 21 onAutoScroll: function (scrollVal) {} 13 22 }); 23 })(); 14 24 JS; 15 25
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)