Plugin Directory

Changeset 3318124


Ignore:
Timestamp:
06/26/2025 09:41:57 AM (9 months ago)
Author:
dmimag
Message:

Fixed a bug related to wp_add_inline_script

Location:
dmimag-liveblog
Files:
28 added
4 edited

Legend:

Unmodified
Added
Removed
  • dmimag-liveblog/trunk/dmimag-liveblog.php

    r3317020 r3318124  
    1717 * Plugin URI:        https://dmimag.site
    1818 * Description:       Create an unlimited of Live broadcast that easily fit into your website design.
    19  * Version:           1.2.3
     19 * Version:           1.2.4
    2020 * Author:            dmimag
    2121 * Author URI:        https://dmimag.site/
     
    3535 * Rename this for your plugin and update it as you release new versions.
    3636 */
    37 define( 'DMIMAG_LIVEBLOG_VERSION', '1.2.3' );
     37define( 'DMIMAG_LIVEBLOG_VERSION', '1.2.4' );
    3838
    3939/**
  • dmimag-liveblog/trunk/includes/class-dmimag-liveblog.php

    r3317020 r3318124  
    7272            $this->version = DMIMAG_LIVEBLOG_VERSION;
    7373        } else {
    74             $this->version = '1.2.3';
     74            $this->version = '1.2.4';
    7575        }
    7676
  • dmimag-liveblog/trunk/public/class-dmimag-liveblog-public.php

    r3317020 r3318124  
    239239        if ( isset( $atts['id'] ) && is_numeric( $atts['id'] ) ) {
    240240
    241             $livebroadcast_completed = get_post_meta( $atts['id'], '_dlb_livebroadcast_completed', true );
    242 
    243             if ( ! isset( $livebroadcast_completed ) or $livebroadcast_completed != 'on' ) {
    244 
    245                 $livebroadcast_interval = get_post_meta( $atts['id'], '_dlb_livebroadcast_interval', true );
    246 
    247                 if ( isset( $livebroadcast_interval ) && is_numeric( $livebroadcast_interval ) ) {
    248                     $livebroadcast_interval = 1000 * 60 * intval( $livebroadcast_interval );
    249                 } else {
    250                     $livebroadcast_interval = 1000 * 60 * 5;
    251                 }
    252 
    253                 add_action( 'wp_enqueue_scripts', function() use ( $livebroadcast_interval ) {
    254                     wp_add_inline_script( $this->plugin_name, 'var dmimag_livebroadcast_interval = ' . esc_js( $livebroadcast_interval ), 'before' );
    255                 });
    256 
    257             }
    258 
    259241            /**
    260242             * Including JS and CSS only when loading shortcode
     
    265247           
    266248            ob_start();
     249
     250            $livebroadcast_completed = get_post_meta( $atts['id'], '_dlb_livebroadcast_completed', true );
     251
     252            if ( ! isset( $livebroadcast_completed ) or $livebroadcast_completed != 'on' ) {
     253
     254                $livebroadcast_interval = get_post_meta( $atts['id'], '_dlb_livebroadcast_interval', true );
     255
     256                if ( isset( $livebroadcast_interval ) && is_numeric( $livebroadcast_interval ) ) {
     257                    $livebroadcast_interval = 1000 * 60 * intval( $livebroadcast_interval );
     258                } else {
     259                    $livebroadcast_interval = 1000 * 60 * 5;
     260                }
     261
     262                /**
     263                 * https://core.trac.wordpress.org/ticket/54958
     264                 */
     265                /*
     266                add_action( 'wp_enqueue_scripts', function() use ( $livebroadcast_interval ) {
     267                    wp_add_inline_script( $this->plugin_name, 'var dmimag_livebroadcast_interval = ' . esc_js( $livebroadcast_interval ), 'before' );
     268                });
     269                */               
     270?>
     271                <script>var dmimag_livebroadcast_interval = <?php echo esc_js( $livebroadcast_interval ); ?>;</script>
     272<?php
     273            }
    267274?>
    268275            <div id="dmilb" class="dmilb liveblog live-broadcast live-broadcast-<?php echo esc_attr( $atts['id'] ); ?>" data-dmilb="<?php echo esc_attr( $atts['id'] ); ?>">
  • dmimag-liveblog/trunk/readme.txt

    r3317020 r3318124  
    66Tested up to: 6.8
    77Requires PHP: 7.4
    8 Stable tag: 1.2.3
     8Stable tag: 1.2.4
    99License: GPLv2 or later
    1010License URI: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
     
    4444== Changelog ==
    4545
     46= 1.2.4 =
     47- Fixed a bug related to wp_add_inline_script
     48
    4649= 1.2.3 =
    4750- Including JS and CSS only when loading plugin shortcode
Note: See TracChangeset for help on using the changeset viewer.