Plugin Directory

Changeset 3133362


Ignore:
Timestamp:
08/10/2024 12:50:55 AM (18 months ago)
Author:
crazypsycho
Message:

possibly fix issue with broken layouts

Location:
dynamicconditions
Files:
65 added
4 edited

Legend:

Unmodified
Added
Removed
  • dynamicconditions/trunk/Legacy/WeakMap_Fallback.php

    r3132763 r3133362  
    99        }
    1010
    11         public function offsetGet($offset) {
     11        /**
     12         * @param mixed $offset
     13         * @return mixed|null
     14         */
     15        public function offsetGet( $offset) {
    1216            return $this->storage[spl_object_id($offset)] ?? null;
    1317        }
  • dynamicconditions/trunk/Public/DynamicConditionsPublic.php

    r3132825 r3133362  
    2323if ( !defined( 'ABSPATH' ) ) {
    2424    die;
    25 }
    26 
    27 if ( !class_exists( 'WeakMap' ) ) {
    28     include_once DynamicConditions_DIR . '/Legacy/WeakMap_Fallback.php';
    2925}
    3026
     
    5248     *
    5349     * @access   private
    54      * @var      \WeakMap $widgetCache For storing dynamic condition data by widget.
    55      */
    56     private \WeakMap $widgetCache;
     50     * @var      array $widgetCache For storing dynamic condition data by widget.
     51     */
     52    private array $widgetCache = [];
    5753
    5854    private Date $dateInstance;
     
    7066        $this->version = $version;
    7167        $this->dateInstance = new Date();
    72 
    73         $this->widgetCache = new \WeakMap();
    7468    }
    7569
     
    306300        }
    307301
    308         $this->widgetCache[$section] = [
    309             'isHidden' => true,
    310             'settings' => $settings,
    311         ];
    312302
    313303        //prevent shortcodes from execution
     
    316306
    317307        ob_start();
     308        $this->widgetCache[$section->get_id()] = [
     309            'isHidden' => true,
     310            'settings' => $settings,
     311            'ob_level' =>  ob_get_level(),
     312        ];
    318313    }
    319314
     
    326321        // reset shortcode tags
    327322        $GLOBALS['shortcode_tags'] += $this->shortcodeTags;
    328         if ( empty( $section ) || empty( $this->widgetCache[$section]['isHidden'] ) ) {
    329             return;
     323        if ( empty( $section ) || empty( $this->widgetCache[$section->get_id()]['isHidden'] ) ) {
     324            return;
     325        }
     326
     327        while (ob_get_level() > $this->widgetCache[$section->get_id()]['ob_level']) {
     328            ob_end_flush();
    330329        }
    331330
     
    336335
    337336        $type = $section->get_type();
    338         $settings = $this->widgetCache[$section]['settings'];
     337        $settings = $this->widgetCache[$section->get_id()]['settings'];
    339338
    340339        if ( empty( $settings['dynamicconditions_removeStyles'] ) ) {
     
    362361
    363362
    364         echo "<!-- hidden $type -->";
     363        echo "<!-- hidden $type {$section->get_id()} -->";
    365364    }
    366365
  • dynamicconditions/trunk/README.txt

    r3132825 r3133362  
    6666
    6767== Changelog ==
     68= 1.7.2 =
     69* Fix issue with broken layout caused by weakmap and ob_cache
     70
    6871= 1.7.1 =
    6972* Hotfix issue when element is no Base_Element
  • dynamicconditions/trunk/dynamic-conditions.php

    r3132825 r3133362  
    2323 * Plugin URI:        https://github.com/RTO-Websites/dynamic-conditions
    2424 * Description:       Activates conditions for dynamic tags to show/hides a widget.
    25  * Version:           1.7.1
     25 * Version:           1.7.2
    2626 * Author:            RTO GmbH
    2727 * Author URI:        https://www.rto.de
     
    3737}
    3838
    39 define( 'DynamicConditions_VERSION', '1.7.1' );
     39define( 'DynamicConditions_VERSION', '1.7.2' );
    4040
    4141define( 'DynamicConditions_DIR', str_replace( '\\', '/', __DIR__ ) );
Note: See TracChangeset for help on using the changeset viewer.