Plugin Directory

Changeset 3708267


Ignore:
Timestamp:
09/22/2026 11:55:32 PM (5 weeks ago)
Author:
dimafreund
Message:

Release version 2.1.5

Location:
rentsyst/trunk
Files:
7 added
11 edited

Legend:

Unmodified
Added
Removed
  • rentsyst/trunk/README.txt

    r3685432 r3708267  
    44Requires at least: 6.0
    55Tested up to: 7.0.0
    6 Stable tag: 2.1.3
     6Stable tag: 2.1.5
    77Requires PHP: 7.0
    88License: GPLv2 or later
    … …  
    126126
    127127== Changelog ==
     128Version 2.1.4 – September 22, 2026
     129Fix: Design v2 bundles no longer override the global `_` (Underscore.js), which broke the Elementor editor and the WordPress media library in wp-admin.
     130Fix: The frontend assets are no longer loaded on wp-admin screens that only render post content, such as SEO analysers and page builders.
     131Fix: The booking and search form blocks show the widget again in the block editor instead of "Security error: invalid security token".
     132New: Native Elementor widgets — RentSyst Booking, RentSyst Search Form and RentSyst Vehicles — that render and update live inside the Elementor editor.
     133
    128134Version 2.0.123 – February 5, 2026
    129135Security 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  
    209209                        // Design v2 loads the Google Maps SDK itself with the key from the settings, or falls back to OpenStreetMap.
    210210                        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' );
    211212                }
    212213        }
  • rentsyst/trunk/admin/components/Rentsyst_FormSearch_Widget.php

    r2979561 r3708267  
    209209                $marginTop = $attributes['marginTop'] ?? 0;
    210210
     211                // The iframe lands on the admin screen that checks this nonce before rendering.
    211212                $params = http_build_query([
    212                         'params' => $settingsDynamic
     213                        'params'   => $settingsDynamic,
     214                        '_wpnonce' => wp_create_nonce( 'rentsyst_iframe_nonce' ),
    213215                ]);
    214216
  • rentsyst/trunk/admin/components/Rentsyst_Widget.php

    r2979561 r3708267  
    233233                $settingsDynamic = static::generateSetting($attributes);
    234234
     235                // The iframe lands on the admin screen that checks this nonce before rendering.
    235236                $params = http_build_query([
    236                         'params' => $settingsDynamic
     237                        'params'   => $settingsDynamic,
     238                        '_wpnonce' => wp_create_nonce( 'rentsyst_iframe_nonce' ),
    237239                ]);
    238240
  • rentsyst/trunk/admin/js/block-booking.js

    r2979561 r3708267  
    1212                wp.element.createElement( 'path',
    1313                        {
    14                                 class: 'st0',
     14                                className: 'st0',
    1515                                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" +
    1616                                        "                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  
    55use rentsyst\admin\Rentsyst_Admin;
    66use rentsyst\includes\cli\Rentsyst_CLI_Command;
     7use rentsyst\includes\elementor\Rentsyst_Elementor;
    78use rentsyst\site\Rentsyst_Site;
    89use function add_action;
    … …  
    8081                $this->define_admin_hooks();
    8182                $this->load_site_components();
     83                $this->load_elementor_support();
    8284                $this->includes();
    8385                $this->register_cli_commands();
    … …  
    148150                                'methods' => 'POST',
    149151                                '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                                },
    150157                        ) );
    151158                } );
    … …  
    168175
    169176                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();
    170187
    171188        }
  • rentsyst/trunk/includes/shortcodes/booking.php

    r3426844 r3708267  
    44use rentsyst\includes\Rentsyst_PluginSettings;
    55use rentsyst\site\Rentsyst_BookingWidget;
     6use rentsyst\includes\elementor\Rentsyst_Elementor;
    67use rentsyst\site\Rentsyst_ResourceLoader;
    78
    … …  
    3435        }
    3536
    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()) {
    3740                return 'Booking page';
    3841        }
     42
     43        unset($params['force_output']);
    3944
    4045        $widgetOutput = Rentsyst_BookingWidget::widget($params);
  • rentsyst/trunk/rentsyst.php

    r3685432 r3708267  
    1717 * Plugin URI:        https://rentsyst.com/wp/
    1818 * Description:       Fleet management software for car rental business.
    19  * Version:           2.1.3
     19 * Version:           2.1.5
    2020 * Author:            Rentsyst
    2121 * Author URI:        https://rentsyst.com/
    … …  
    3939 */
    4040
    41 define( 'RENTSYST_VERSION', '2.1.3' );
     41define( 'RENTSYST_VERSION', '2.1.5' );
    4242define( 'RENTSYST_PLUGIN_NAME', 'rentsyst' );
    4343define( 'RENTSYST_MOD', 'prod');
  • rentsyst/trunk/site/Rentsyst_ResourceLoader.php

    r3667904 r3708267  
    2626        public static function registerAll()
    2727        {
     28                if(!self::isFrontendRequest()) {
     29                        return false;
     30                }
    2831                if(Rentsyst_PaymentStatusWidget::$is_display) {
    2932                        return false;
    … …  
    6669                if($this->isV2()) {
    6770                        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' );
    6872                } else {
    6973                        wp_enqueue_script( self::PREFIX .'bundle_front', WP_RENTSYST_PLUGIN_URL . '/resources-v1/static/js/bundle_front.js', array( 'jquery' ), $this->version, true );
    7074                }
     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' );
    71112        }
    72113
  • rentsyst/trunk/site/partials/booking-v2.php

    r2992156 r3708267  
    1010
    1111        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,
    1421                containerClassName: "wp-rentsyst-constructor"
    1522                } )
  • rentsyst/trunk/site/partials/booking.php

    r2979561 r3708267  
    66<?php
    77$script = <<<JS
     8window.rentsyst_settings = JSON.parse('$settings');
     9(function () {
     10var 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.
     13if ( ! container || container.dataset.rentsystMounted ) {
     14        return;
     15}
     16container.dataset.rentsystMounted = "1";
    817RentsystFrame.init({
    9 container: document.getElementById("rentsyst_frame"),
    10 settings: JSON.parse('$settings'),
     18container: container,
     19settings: window.rentsyst_settings,
    1120onResize: function (width, height) {},
    1221onAutoScroll: function (scrollVal) {}
    1322});
     23})();
    1424JS;
    1525
Note: See TracChangeset for help on using the changeset viewer.