Plugin Directory

Changeset 3398654


Ignore:
Timestamp:
11/19/2025 08:43:02 AM (5 months ago)
Author:
wpchill
Message:

Update to version 2.13.2 from GitHub

Location:
modula-best-grid-gallery
Files:
10 edited
1 copied

Legend:

Unmodified
Added
Removed
  • modula-best-grid-gallery/tags/2.13.2/Modula.php

    r3395701 r3398654  
    55* Description:              Modula is the most powerful, user-friendly WordPress gallery plugin. Add galleries, masonry grids and more in a few clicks.
    66* Author:                   WPChill
    7 * Version:                  2.13.1
     7* Version:                  2.13.2
    88* Author URI:               https://www.wpchill.com/
    99* License:                  GPLv3 or later
  • modula-best-grid-gallery/tags/2.13.2/changelog.txt

    r3395701 r3398654  
     1= 2.13.2 - 19.11.2025 =
     2Updated: Performance improvements.
     3
    14= 2.13.1 - 14.11.2025 =
    25Added: Enhancements for zip import.
  • modula-best-grid-gallery/tags/2.13.2/includes/ai/class-image-descriptor.php

    r3248316 r3398654  
    2121    }
    2222
     23    /**
     24     * Registers gallery actions only for galleries with scheduled Action Scheduler actions.
     25     */
    2326    private function _register_gallery_actions() {
    24         $posts = get_posts(
    25             array(
    26                 'post_type'      => 'modula-gallery',
    27                 'posts_per_page' => -1,
    28             )
     27        $post_ids = $this->_get_galleries_with_scheduled_actions();
     28
     29        foreach ( $post_ids as $post_id ) {
     30            Optimizer::get_instance( (string) $post_id );
     31        }
     32
     33        add_action( 'action_scheduler_before_execute', array( $this, '_lazy_register_optimizer_hooks' ), 10, 1 );
     34    }
     35
     36    /**
     37     * Lazy-loads Optimizer hooks when an action is about to execute.
     38     *
     39     * @param int $action_id The action ID that's about to execute.
     40     */
     41    public function _lazy_register_optimizer_hooks( $action_id ) {
     42        if ( ! class_exists( 'ActionScheduler' ) || ! \ActionScheduler::is_initialized() ) {
     43            return;
     44        }
     45
     46        try {
     47            $store  = \ActionScheduler::store();
     48            $action = $store->fetch_action( $action_id );
     49            $hook   = $action->get_hook();
     50
     51            $hook_patterns = array(
     52                'mai_process_image_batch_',
     53                'mai_check_image_batch_',
     54                'mai_check_optimizer_finished_',
     55            );
     56
     57            foreach ( $hook_patterns as $pattern ) {
     58                if ( strpos( $hook, $pattern ) === 0 ) {
     59                    $post_id = str_replace( $pattern, '', $hook );
     60                    if ( is_numeric( $post_id ) && $post_id > 0 ) {
     61                        Optimizer::get_instance( (string) $post_id );
     62                    }
     63                    break;
     64                }
     65            }
     66        } catch ( \Exception $e ) {
     67            return;
     68        }
     69    }
     70
     71    /**
     72     * Gets gallery post IDs that have scheduled Action Scheduler actions.
     73     * Queries for all actions (not just pending/running) to catch all possible hooks.
     74     *
     75     * @return array Array of unique post IDs
     76     */
     77    private function _get_galleries_with_scheduled_actions() {
     78        if ( ! function_exists( 'as_get_scheduled_actions' ) ) {
     79            return array();
     80        }
     81
     82        $post_ids = array();
     83
     84        if ( ! class_exists( 'ActionScheduler' ) || ! \ActionScheduler::is_initialized() ) {
     85            return array();
     86        }
     87
     88        $store = \ActionScheduler::store();
     89
     90        $hook_patterns = array(
     91            'mai_process_image_batch_',
     92            'mai_check_image_batch_',
     93            'mai_check_optimizer_finished_',
    2994        );
    3095
    31         foreach ( $posts as $post ) {
    32             Optimizer::get_instance( (string) $post->ID );
     96        $actions = as_get_scheduled_actions(
     97            array(
     98                'status'   => array(
     99                    \ActionScheduler_Store::STATUS_PENDING,
     100                    \ActionScheduler_Store::STATUS_RUNNING,
     101                    \ActionScheduler_Store::STATUS_FAILED,
     102                ),
     103                'per_page' => 1000,
     104            ),
     105            'ids'
     106        );
     107
     108        if ( empty( $actions ) ) {
     109            return array();
    33110        }
     111
     112        foreach ( $actions as $action_id ) {
     113            try {
     114                $action = $store->fetch_action( $action_id );
     115                $hook   = $action->get_hook();
     116
     117                foreach ( $hook_patterns as $pattern ) {
     118                    if ( strpos( $hook, $pattern ) === 0 ) {
     119                        $post_id = str_replace( $pattern, '', $hook );
     120                        if ( is_numeric( $post_id ) && $post_id > 0 ) {
     121                            $post_ids[] = (int) $post_id;
     122                        }
     123                        break;
     124                    }
     125                }
     126            } catch ( \Exception $e ) {
     127                continue;
     128            }
     129        }
     130
     131        return array_unique( $post_ids );
    34132    }
    35133}
  • modula-best-grid-gallery/tags/2.13.2/includes/ai/optimizer/class-optimizer.php

    r3248316 r3398654  
    7474        $this->gallery_helper = Gallery_Helper::get_instance();
    7575
    76         add_action( 'init', array( $this, 'add_process_hooks' ) );
     76
     77        $this->add_process_hooks();
     78        if ( ! did_action( 'init' ) ) {
     79            add_action( 'init', array( $this, 'add_process_hooks' ) );
     80        }
    7781    }
    7882
  • modula-best-grid-gallery/tags/2.13.2/readme.txt

    r3395701 r3398654  
    55Tested up to: 6.8
    66Requires PHP: 5.6 
    7 Stable tag: 2.13.1
     7Stable tag: 2.13.2
    88
    99License: GNU General Public License v3.0 or later 
     
    323323
    324324== Changelog ==
     325= 2.13.2 - 19.11.2025 =
     326Updated: Performance improvements.
     327
    325328= 2.13.1 - 14.11.2025 =
    326329Added: Enhancements for zip import.
  • modula-best-grid-gallery/trunk/Modula.php

    r3395701 r3398654  
    55* Description:              Modula is the most powerful, user-friendly WordPress gallery plugin. Add galleries, masonry grids and more in a few clicks.
    66* Author:                   WPChill
    7 * Version:                  2.13.1
     7* Version:                  2.13.2
    88* Author URI:               https://www.wpchill.com/
    99* License:                  GPLv3 or later
  • modula-best-grid-gallery/trunk/changelog.txt

    r3395701 r3398654  
     1= 2.13.2 - 19.11.2025 =
     2Updated: Performance improvements.
     3
    14= 2.13.1 - 14.11.2025 =
    25Added: Enhancements for zip import.
  • modula-best-grid-gallery/trunk/includes/ai/class-image-descriptor.php

    r3248316 r3398654  
    2121    }
    2222
     23    /**
     24     * Registers gallery actions only for galleries with scheduled Action Scheduler actions.
     25     */
    2326    private function _register_gallery_actions() {
    24         $posts = get_posts(
    25             array(
    26                 'post_type'      => 'modula-gallery',
    27                 'posts_per_page' => -1,
    28             )
     27        $post_ids = $this->_get_galleries_with_scheduled_actions();
     28
     29        foreach ( $post_ids as $post_id ) {
     30            Optimizer::get_instance( (string) $post_id );
     31        }
     32
     33        add_action( 'action_scheduler_before_execute', array( $this, '_lazy_register_optimizer_hooks' ), 10, 1 );
     34    }
     35
     36    /**
     37     * Lazy-loads Optimizer hooks when an action is about to execute.
     38     *
     39     * @param int $action_id The action ID that's about to execute.
     40     */
     41    public function _lazy_register_optimizer_hooks( $action_id ) {
     42        if ( ! class_exists( 'ActionScheduler' ) || ! \ActionScheduler::is_initialized() ) {
     43            return;
     44        }
     45
     46        try {
     47            $store  = \ActionScheduler::store();
     48            $action = $store->fetch_action( $action_id );
     49            $hook   = $action->get_hook();
     50
     51            $hook_patterns = array(
     52                'mai_process_image_batch_',
     53                'mai_check_image_batch_',
     54                'mai_check_optimizer_finished_',
     55            );
     56
     57            foreach ( $hook_patterns as $pattern ) {
     58                if ( strpos( $hook, $pattern ) === 0 ) {
     59                    $post_id = str_replace( $pattern, '', $hook );
     60                    if ( is_numeric( $post_id ) && $post_id > 0 ) {
     61                        Optimizer::get_instance( (string) $post_id );
     62                    }
     63                    break;
     64                }
     65            }
     66        } catch ( \Exception $e ) {
     67            return;
     68        }
     69    }
     70
     71    /**
     72     * Gets gallery post IDs that have scheduled Action Scheduler actions.
     73     * Queries for all actions (not just pending/running) to catch all possible hooks.
     74     *
     75     * @return array Array of unique post IDs
     76     */
     77    private function _get_galleries_with_scheduled_actions() {
     78        if ( ! function_exists( 'as_get_scheduled_actions' ) ) {
     79            return array();
     80        }
     81
     82        $post_ids = array();
     83
     84        if ( ! class_exists( 'ActionScheduler' ) || ! \ActionScheduler::is_initialized() ) {
     85            return array();
     86        }
     87
     88        $store = \ActionScheduler::store();
     89
     90        $hook_patterns = array(
     91            'mai_process_image_batch_',
     92            'mai_check_image_batch_',
     93            'mai_check_optimizer_finished_',
    2994        );
    3095
    31         foreach ( $posts as $post ) {
    32             Optimizer::get_instance( (string) $post->ID );
     96        $actions = as_get_scheduled_actions(
     97            array(
     98                'status'   => array(
     99                    \ActionScheduler_Store::STATUS_PENDING,
     100                    \ActionScheduler_Store::STATUS_RUNNING,
     101                    \ActionScheduler_Store::STATUS_FAILED,
     102                ),
     103                'per_page' => 1000,
     104            ),
     105            'ids'
     106        );
     107
     108        if ( empty( $actions ) ) {
     109            return array();
    33110        }
     111
     112        foreach ( $actions as $action_id ) {
     113            try {
     114                $action = $store->fetch_action( $action_id );
     115                $hook   = $action->get_hook();
     116
     117                foreach ( $hook_patterns as $pattern ) {
     118                    if ( strpos( $hook, $pattern ) === 0 ) {
     119                        $post_id = str_replace( $pattern, '', $hook );
     120                        if ( is_numeric( $post_id ) && $post_id > 0 ) {
     121                            $post_ids[] = (int) $post_id;
     122                        }
     123                        break;
     124                    }
     125                }
     126            } catch ( \Exception $e ) {
     127                continue;
     128            }
     129        }
     130
     131        return array_unique( $post_ids );
    34132    }
    35133}
  • modula-best-grid-gallery/trunk/includes/ai/optimizer/class-optimizer.php

    r3248316 r3398654  
    7474        $this->gallery_helper = Gallery_Helper::get_instance();
    7575
    76         add_action( 'init', array( $this, 'add_process_hooks' ) );
     76
     77        $this->add_process_hooks();
     78        if ( ! did_action( 'init' ) ) {
     79            add_action( 'init', array( $this, 'add_process_hooks' ) );
     80        }
    7781    }
    7882
  • modula-best-grid-gallery/trunk/readme.txt

    r3395701 r3398654  
    55Tested up to: 6.8
    66Requires PHP: 5.6 
    7 Stable tag: 2.13.1
     7Stable tag: 2.13.2
    88
    99License: GNU General Public License v3.0 or later 
     
    323323
    324324== Changelog ==
     325= 2.13.2 - 19.11.2025 =
     326Updated: Performance improvements.
     327
    325328= 2.13.1 - 14.11.2025 =
    326329Added: Enhancements for zip import.
Note: See TracChangeset for help on using the changeset viewer.