Plugin Directory

Changeset 3198078


Ignore:
Timestamp:
11/27/2024 11:05:18 AM (16 months ago)
Author:
videlin
Message:

Uploading 1.0.6

Location:
showcase-creator
Files:
89 added
4 edited

Legend:

Unmodified
Added
Removed
  • showcase-creator/trunk/readme.txt

    r3198055 r3198078  
    55Requires at least: 6.1
    66Tested up to: 6.7
    7 Stable tag: 1.0.5
     7Stable tag: 1.0.6
    88Requires PHP: 7.0
    99License: GPLv2 or later
     
    128128== Changelog ==
    129129
     130= 1.0.6 =
     131* Bug fixed: The Featured Image layout element does not work with a DIV tag.
     132* Bug fixed: Lightbox does not load with post types other than posts.
     133* Bug fixed: Query galleries not working with some themes.
     134
    130135= 1.0.5 =
    131136* Bug fixed: Galleries are not working properly.
  • showcase-creator/trunk/showcase-creator.php

    r3198055 r3198078  
    44 * Plugin URI:      https://videlinify.com/showcase-creator/
    55 * Description:     Provides tools to display a showcase of posts (or custom post types) using a custom layout, advanced filtering and customized post order.
    6  * Version:         1.0.5
     6 * Version:         1.0.6
    77 * Requires PHP:    7.0
    88 * Author:          Videlin Djedjev
  • showcase-creator/trunk/src/class.php

    r3198055 r3198078  
    1818     * @var string $version x.x.x format
    1919     */
    20     public static string $version = '1.0.5';
     20    public static string $version = '1.0.6';
    2121   
    2222    /**
     
    279279        add_action( 'wp_enqueue_scripts', function() {
    280280            self::register_asset( '-vid-modules', '/src/modules/vid-modules' );
    281             self::register_asset( '-lightbox', '/src/modules/lightbox' );
     281            self::register_asset( '-lightbox', '/src/modules/lightbox', [], true );
    282282            self::register_asset( '-slider', '/src/modules/slider.js' );
    283283            // Detects if any layout uses lightbox and enqueues the script if so.
     
    332332     *
    333333     * @since 1.0.0
     334     * @since 1.0.6 Added new parameter: $args
    334335     *
    335336     * @param string        $name   String name. Start it with '-' to use the plugin prefix.
    336337     * @param string        $rel    Path relative to plugin directory.
    337338     * @param string[]      $deps   Script dependanices.
    338      */
    339     private static function register_asset( string $name, string $rel, $deps = [] ) {
     339     * @param array|bool    $args   Array of loading strategies or bool for setting in_footer. Default: false
     340     */
     341    private static function register_asset( string $name, string $rel, $deps = [], $args = false ) {
    340342        $deps = array_map(
    341343            function( $e ) {
     
    351353                SHOWCASE_CREATOR_URL . $rel . ( $js_only ? '' : '.js' ),
    352354                $deps,
    353                 self::$version
     355                self::$version,
     356                $args
    354357            );
    355358        }
     
    436439                add_action( 'wp_enqueue_scripts', $func, 20 );
    437440            }
    438            
    439             /**
    440              * Hooks into lightbox enqueue
    441              */
    442             do_action( 'showcase_creator_enqueue_lightbox' );
    443            
    444             /*add_action( 'wp_print_footer_scripts', function() {
    445                 $galleries = [];
    446                 foreach ( $this->galleries as $name=>$gallery ) {
    447                     if ( ! isset( $this->localized_galleries[ $name ] ) ) {
    448                         $galleries[ $name ] = $gallery;
    449                     }
    450                 }
    451                 if ( $galleries ) {
    452                     printf(
    453                         '<script type="text/javascript">( () => { window.showcaseCreator.gallery = {
    454                             ...window.showcaseCreator.gallery,
    455                             ...%s
    456                         } } )();</script>',
    457                         wp_json_encode( $galleries )
    458                     );
    459                 }
    460             } );*/
    461441        }
    462442    }
     
    473453        if ( ! isset( $this->galleries[ $name ] ) ) {
    474454            $this->galleries[ $name ] = $gallery;
     455            wp_add_inline_script(
     456                self::$prefix . '-lightbox',
     457                "( () => {
     458                    window.showcaseCreator = window.showcaseCreator || {};
     459                    window.showcaseCreator.gallery = window.showcaseCreator.gallery || {};
     460                    window.showcaseCreator.gallery['$name'] = " .
     461                    wp_json_encode( $gallery ) . ";
     462                } )();"
     463            );
    475464        }
    476465    }
  • showcase-creator/trunk/src/modules/lightbox.js

    r3198050 r3198078  
    329329        }
    330330
    331         static async gallery( name, args = {} ) {
     331        static gallery( name, current ) {
    332332            let imgs;
    333333            const gallery = (
     
    341341                return;
    342342            }
    343             const lightbox = new this( args, imgs );
     343            const lightbox = new this( { current: current }, imgs );
    344344            lightbox.open();
    345345        }
Note: See TracChangeset for help on using the changeset viewer.