Plugin Directory

Changeset 3134296


Ignore:
Timestamp:
08/12/2024 02:33:43 PM (18 months ago)
Author:
crazypsycho
Message:

fix loops

Location:
dynamicconditions
Files:
65 added
4 edited

Legend:

Unmodified
Added
Removed
  • dynamicconditions/trunk/Lib/Date.php

    r3098518 r3134296  
    9797     */
    9898    public static function unTranslateDate( $needle = '', $setLocale = null ) {
     99        if (empty($needle)) {
     100            return $needle;
     101        }
    99102        // get in translated lang
    100103        $translatedMonths = self::getMonthsTranslated();
  • dynamicconditions/trunk/Public/DynamicConditionsPublic.php

    r3134117 r3134296  
    4444
    4545    /**
    46      * Cache to store a widget's dynamic condition properties.
    47      * Provides compatibility with php 8.2+ after deprecation of dynamic properties.
    48      *
    4946     * @access   private
    50      * @var      array $widgetCache For storing dynamic condition data by widget.
    51      */
    52     private array $widgetCache = [];
     47     * @var      array $isSectionHidden For storing hidden-status
     48     */
     49    private array $isSectionHidden = [];
    5350
    5451    private Date $dateInstance;
     
    7370     */
    7471    private function getElementSettings( $element ): array {
    75         $id = $element->get_id();
     72        $id =  get_the_id(). '-'. $element->get_id();
     73
     74        if ( !empty( $this->elementSettings[$id] ) ) {
     75            return $this->elementSettings[$id];
     76        }
    7677        $clonedElement = clone $element;
    7778
     
    300301        }
    301302
     303        $id = get_the_id() .'-'. $section->get_id();
     304        $this->isSectionHidden[$id] = true;
    302305
    303306        //prevent shortcodes from execution
    304         $this->shortcodeTags = $GLOBALS['shortcode_tags'];
     307        $this->shortcodeTags += $GLOBALS['shortcode_tags'];
    305308        $GLOBALS['shortcode_tags'] = [];
    306309
    307310        ob_start();
    308         $this->widgetCache[$section->get_id()] = [
    309             'isHidden' => true,
    310             'settings' => $settings,
    311             #'ob_level' => ob_get_level(),
    312         ];
    313311    }
    314312
     
    319317     */
    320318    public function filterSectionContentAfter( $section ): void {
     319        $id = get_the_id() .'-'. $section->get_id();
    321320        // reset shortcode tags
    322321        $GLOBALS['shortcode_tags'] += $this->shortcodeTags;
    323         if ( empty( $section ) || empty( $this->widgetCache[$section->get_id()]['isHidden'] ) ) {
     322        if ( empty( $section ) ||
     323            empty( $this->isSectionHidden[$id] )
     324        ) {
    324325            return;
    325326        }
     
    333334        $matchesStyleTags = [];
    334335
    335 
    336336        $type = $section->get_type();
    337         $settings = $this->widgetCache[$section->get_id()]['settings'];
     337        $settings = $this->elementSettings[$id];
    338338
    339339        if ( empty( $settings['dynamicconditions_removeStyles'] ) ) {
     
    360360        }
    361361
    362 
    363         echo "<!-- hidden $type {$section->get_id()} -->";
     362        echo "<!-- hidden $type $id -->";
    364363    }
    365364
     
    375374            return false;
    376375        }
    377         if (filter_input(INPUT_SERVER, 'REQUEST_METHOD') === 'POST') {
     376        /*if ( filter_input( INPUT_SERVER, 'REQUEST_METHOD' ) === 'POST' ) {
    378377            return false;
    379         }
     378        }*/
    380379
    381380        // loop values
  • dynamicconditions/trunk/README.txt

    r3134117 r3134296  
    66Requires PHP: 7.4
    77Tested up to: 6.6
    8 Stable tag: 1.7.3
     8Stable tag: 1.7.4
    99License: GPLv2 or later
    1010License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    6666
    6767== Changelog ==
     68= 1.7.4 =
     69* Fix big issue with loops destroying everything
     70
    6871= 1.7.3 =
    6972* Fix issue with date-conditions
  • dynamicconditions/trunk/dynamic-conditions.php

    r3134117 r3134296  
    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.3
     25 * Version:           1.7.4
    2626 * Author:            RTO GmbH
    2727 * Author URI:        https://www.rto.de
     
    3737}
    3838
    39 define( 'DynamicConditions_VERSION', '1.7.3' );
     39define( 'DynamicConditions_VERSION', '1.7.4' );
    4040
    4141define( 'DynamicConditions_DIR', str_replace( '\\', '/', __DIR__ ) );
Note: See TracChangeset for help on using the changeset viewer.