Plugin Directory

Changeset 3430080


Ignore:
Timestamp:
12/31/2025 11:16:40 AM (7 weeks ago)
Author:
azplugins
Message:

Update to version 3.0.5 from GitHub

Location:
az-video-and-audio-player-addon-for-elementor
Files:
2 added
42 edited
1 copied

Legend:

Unmodified
Added
Removed
  • az-video-and-audio-player-addon-for-elementor/tags/3.0.5/assets/css/admin.css

    r3417290 r3430080  
    1818/* 1. General Layout & Structure
    1919================================================== */
     20/* Override core */
     21.post-type-lean_player #preview-action,
     22.post-type-lean_player #visibility{
     23    display: none;
     24}
     25
     26.post-type-lean_player .lpl-preview-metabox{
     27    display:flex;
     28    align-items: flex-start;
     29    justify-content: start;
     30    margin-bottom: 5px;
     31    flex-direction: column;
     32}
     33
     34.post-type-lean_player a.preview.button{
     35    display: inline-flex;
     36    align-items: center;
     37    gap: 5px;
     38}
     39
    2040
    2141.lpl-hire-page{
  • az-video-and-audio-player-addon-for-elementor/tags/3.0.5/assets/css/main.css

    r3417290 r3430080  
    22    box-shadow: none;
    33}
     4
    45.plyr--audio .plyr__controls{
    56    background: transparent;
     
    1011    color: #fff;
    1112    padding: 15px 0;
     13    display: -webkit-box;
     14    display: -ms-flexbox;
    1215    display: flex;
    13     align-items: center;
    14     justify-content: center;
     16    -webkit-box-align: center;
     17        -ms-flex-align: center;
     18            align-items: center;
     19    -webkit-box-pack: center;
     20        -ms-flex-pack: center;
     21            justify-content: center;
    1522}
    1623
     
    2633    box-shadow: none;
    2734}
    28 
    29 /*BeTheme support*/
    30 .plyr button{
    31     margin-bottom: 0;
    32 }
  • az-video-and-audio-player-addon-for-elementor/tags/3.0.5/assets/js/main.js

    r3426299 r3430080  
    8181    function isDebugModeEnabled(settings) {
    8282        var playerDebugMode = getBooleanSetting(settings, 'debug_mode', false);
    83         var envDebugMode = (typeof lplData !== 'undefined' && lplData.debugMode) || false;
     83        var envDebugMode = (typeof leanpl_params !== 'undefined' && leanpl_params.debugMode) || false;
    8484        return playerDebugMode || envDebugMode;
    8585    }
  • az-video-and-audio-player-addon-for-elementor/tags/3.0.5/includes/admin/class-menu.php

    r3424247 r3430080  
    105105            'defaults' => $default_settings,       // Default settings array
    106106            'version' => LEANPL_VERSION,
    107             'dropdown_label' => esc_html__('Legacy Shortcodes', 'vapfem'),
     107            'dropdown_label' => esc_html__('Shortcodes', 'vapfem'),
    108108            // Use callback instead of allowed_pages - leverages existing leanpl_is_our_admin_page() function
    109109            'page_check_callback' => 'leanpl_is_our_admin_page',
     
    231231            'lean_player-settings-tab',
    232232            array($this, 'lean_player_settings_page')
     233        );
     234
     235        // Submenu - Upgrade Now
     236        add_submenu_page(
     237            'lean_player-settings',
     238            esc_html__('Upgrade to Premium', 'vapfem'),
     239            esc_html__('Upgrade to Premium', 'vapfem'),
     240            'manage_options',
     241            leanpl_get_upgrade_url(array('utm_medium' => 'menu'))
    233242        );
    234243       
     
    327336                // Update on hash change
    328337                $(window).on('hashchange', updateMenuHighlight);
     338
     339                // Target the specific upgrade
     340                $('.wp-submenu a[href*=\"leanplugins.com\"]').attr('target', '_blank');
    329341            });
    330342        ");
  • az-video-and-audio-player-addon-for-elementor/tags/3.0.5/includes/class-assets-manager.php

    r3417290 r3430080  
    1919    private $assets_loaded = false;
    2020    private $late_loading = false;
     21    private $loaded = [];
    2122
    2223    /**
     
    2425     * All asset paths, handles, and dependencies defined here
    2526     */
    26     private $asset_definitions = [
     27    private $assets = [
    2728        'scripts' => [
    2829            'plyr' => [
    29                 'path' => '/assets/js/plyr.min.js',
     30                'file' => '/assets/js/plyr.min.js',
    3031                'deps' => ['jquery'],
    31                 'footer' => true,
     32                'in_footer' => true,
     33                'contexts' => ['frontend'],
    3234            ],
    3335            'plyr-polyfilled' => [
    34                 'path' => '/assets/js/plyr.polyfilled.min.js',
     36                'file' => '/assets/js/plyr.polyfilled.min.js',
    3537                'deps' => ['jquery'],
    36                 'footer' => true,
     38                'in_footer' => true,
     39                'contexts' => ['frontend'],
    3740            ],
    3841            'leanpl-main' => [
    39                 'path' => '/assets/js/main.js',
     42                'file' => '/assets/js/main.js',
    4043                'deps' => ['jquery', 'plyr'],
    41                 'footer' => true,
     44                'in_footer' => true,
     45                'contexts' => ['frontend'],
    4246            ],
    4347            'leanpl-admin' => [
    44                 'path' => '/assets/js/admin.js',
     48                'file' => '/assets/js/admin.js',
    4549                'deps' => ['jquery'],
    46                 'footer' => true,
     50                'in_footer' => true,
     51                'contexts' => ['admin'],
    4752            ],
    4853        ],
    4954        'styles' => [
    5055            'plyr' => [
    51                 'path' => '/assets/css/plyr.css',
     56                'file' => '/assets/css/plyr.css',
    5257                'deps' => [],
     58                'in_footer' => false,
     59                'contexts' => ['frontend'],
    5360            ],
    5461            'leanpl-main' => [
    55                 'path' => '/assets/css/main.css',
     62                'file' => '/assets/css/main.css',
    5663                'deps' => ['plyr'],
     64                'in_footer' => false,
     65                'contexts' => ['frontend'],
    5766            ],
    5867            'leanpl-editor' => [
    59                 'path' => '/assets/css/editor.css',
     68                'file' => '/assets/css/editor.css',
    6069                'deps' => [],
     70                'in_footer' => false,
     71                'contexts' => ['elementor-editor'],
    6172            ],
    6273            'leanpl-admin' => [
    63                 'path' => '/assets/css/admin.css',
     74                'file' => '/assets/css/admin.css',
    6475                'deps' => [],
    65             ],
    66         ],
    67     ];
    68 
    69     /**
    70      * Context definitions - what assets to load where
    71      */
    72     private $context_assets = [
    73         'frontend' => [
    74             'scripts' => ['plyr', 'leanpl-main'],
    75             'styles' => ['plyr', 'leanpl-main'],
    76         ],
    77         'elementor-editor' => [
    78             'scripts' => [],
    79             'styles' => ['leanpl-editor'],
    80         ],
    81         'elementor-preview' => [
    82             'scripts' => ['plyr', 'leanpl-main'],
    83             'styles' => ['plyr', 'leanpl-main'],
    84         ],
    85         'admin' => [
    86             'scripts' => ['leanpl-admin'],
    87             'styles' => ['leanpl-admin'],
     76                'in_footer' => false,
     77                'contexts' => ['admin'],
     78            ],
    8879        ],
    8980    ];
     
    10192
    10293    /**
    103      * Initialize - register ALL hooks in one place
     94     * Initialize the assets manager
    10495     */
    10596    public function init() {
    10697        $this->version = leanpl_get_version();
    10798
    108         // Frontend hooks
    109         add_action('wp_enqueue_scripts', [$this, 'register_assets'], 10);
    110         add_action('wp_enqueue_scripts', [$this, 'conditional_enqueue'], 20);
    111 
    112         // Elementor hooks (if Elementor is active)
    113         if (did_action('elementor/loaded')) {
    114             add_action('elementor/frontend/after_register_scripts', [$this, 'register_assets']);
    115             add_action('elementor/frontend/after_enqueue_styles', [$this, 'enqueue_elementor_preview_assets']);
    116             add_action('elementor/editor/after_enqueue_styles', [$this, 'enqueue_elementor_editor_assets']);
    117         }
    118 
    119         // Admin hooks - Register assets first, then enqueue
    120         add_action('admin_enqueue_scripts', [$this, 'register_assets'] );
     99        // -- Register all assets --
     100        add_action('admin_enqueue_scripts', [$this, 'register_all']);
     101        add_action('wp_enqueue_scripts', [$this, 'register_all']);
     102
     103        // -- Load admin assets --
    121104        add_action('admin_enqueue_scripts', [$this, 'enqueue_admin_assets']);
    122     }
    123 
    124     /**
    125      * Register ALL assets - DRY method using definitions array
    126      */
    127     public function register_assets() {
    128         // Register scripts
    129         foreach ($this->asset_definitions['scripts'] as $handle => $config) {
    130             if (!wp_script_is($handle, 'registered')) {
    131                 wp_register_script(
    132                     $handle,
    133                     LEANPL_URI . $config['path'],
    134                     $config['deps'],
    135                     $this->version,
    136                     $config['footer']
    137                 );
     105       
     106        // -- Load frontend assets --
     107        add_action('wp_enqueue_scripts', [$this, 'common_frontend_enqueue']);
     108        add_action('wp_enqueue_scripts', [$this, 'enqueue_if_shortcode'], 20);
     109
     110        // -- Load Elementor assets --
     111        // Note: Widget frontend assets are loaded via widget registration, so we don't need to load them here.
     112        //       But we need to register the assets for the editor.
     113        add_action('elementor/editor/after_enqueue_scripts', [$this, 'register_n_enqueue_elementor_editor_assets']);
     114    }
     115
     116    /**
     117     * Register all assets
     118     */
     119    public function register_all() {
     120        foreach ($this->assets['styles'] as $handle => $config) {
     121            $url = LEANPL_URI . $config['file'];
     122            $deps = $config['deps'];
     123            $in_footer = $config['in_footer'];
     124
     125            wp_register_style($handle, $url, $deps, $this->version, $in_footer);
     126        }
     127
     128        foreach ($this->assets['scripts'] as $handle => $config) {
     129            $url = LEANPL_URI . $config['file'];
     130            $deps = $config['deps'];
     131            $in_footer = $config['in_footer'];
     132
     133            wp_register_script($handle, $url, $deps, $this->version, $in_footer);
     134        }
     135    }
     136
     137    public function enqueue_admin_assets($hook) {
     138        if (!leanpl_is_our_admin_page()) {
     139            return;
     140        }
     141       
     142        $this->load_assets_by_context('admin');
     143    }
     144
     145    public function common_frontend_enqueue() {
     146        // Enqueue jQuery first, other plugins may remove it from the queue
     147        wp_enqueue_script('jquery');
     148
     149        // Localization
     150        wp_localize_script('jquery', 'leanpl_params', [
     151            'version' => $this->version,
     152            'debugMode' => leanpl_is_debug_mode(),
     153            'ajaxUrl' => admin_url('admin-ajax.php'),
     154        ]);
     155    }
     156
     157    /**
     158     * Load by context
     159     *
     160     * @param string $context The context to load the assets for
     161     * @return void
     162     */
     163
     164    public function load_assets_by_context($context) {
     165        foreach ($this->assets['styles'] as $handle => $config) {
     166            // Skip if not for this context
     167            if (!in_array($context, $config['contexts'])) {
     168                continue;
    138169            }
    139         }
    140 
    141         // Register styles
    142         foreach ($this->asset_definitions['styles'] as $handle => $config) {
    143             if (!wp_style_is($handle, 'registered')) {
    144                 wp_register_style(
    145                     $handle,
    146                     LEANPL_URI . $config['path'],
    147                     $config['deps'],
    148                     $this->version
    149                 );
     170
     171            // Enqueue it
     172            wp_enqueue_style($handle);
     173        }
     174
     175        foreach ($this->assets['scripts'] as $handle => $config) {
     176            // Skip if not for this context
     177            if (!in_array($context, $config['contexts'])) {
     178                continue;
    150179            }
    151         }
    152     }
    153 
    154     /**
    155      * Enqueue assets by context - DRY method
    156      */
    157     private function enqueue_by_context($context) {
    158         if (!isset($this->context_assets[$context])) {
    159             return;
    160         }
    161 
    162         $assets = $this->context_assets[$context];
    163 
    164         // Enqueue scripts
    165         foreach ($assets['scripts'] as $handle) {
     180
     181            // Enqueue it
    166182            wp_enqueue_script($handle);
    167183        }
    168 
    169         // Enqueue styles
    170         foreach ($assets['styles'] as $handle) {
    171             wp_enqueue_style($handle);
    172         }
    173 
    174         // Localize main script if it's being loaded
    175         if (in_array('leanpl-main', $assets['scripts'])) {
    176             $this->localize_main_script();
    177         }
    178     }
    179 
    180     /**
    181      * Early detection for shortcodes in post content
    182      */
    183     public function conditional_enqueue() {
     184    }
     185
     186    /**
     187     * Load if shortcode is found in the post content
     188     *
     189     * Note: this will not support do_shortcode() usage
     190     * @return void
     191     */
     192    public function enqueue_if_shortcode() {
    184193        if ($this->assets_loaded || is_admin()) {
    185194            return;
    186195        }
    187196
    188         global $post;
    189 
    190         if ($post &&
    191             has_shortcode( $post->post_content, 'lean_video' ) ||
    192             has_shortcode( $post->post_content, 'lean_audio' ) ||
    193             has_shortcode( $post->post_content, 'lean_player' )
     197        global $post; // might be null for 404 pages
     198
     199        if ($post && (
     200                has_shortcode( $post->post_content, 'lean_video' ) ||
     201                has_shortcode( $post->post_content, 'lean_audio' ) ||
     202                has_shortcode( $post->post_content, 'lean_player' )
     203            )
    194204        ) {
    195             $this->enqueue_frontend_assets();
    196         }
    197     }
    198 
    199     /**
    200      * Enqueue frontend assets (shortcodes, widgets)
    201      */
    202     public function enqueue_frontend_assets() {
    203         if ($this->assets_loaded) {
    204             return;
    205         }
    206 
    207         $this->enqueue_by_context('frontend');
    208         $this->assets_loaded = true;
    209     }
    210 
    211     /**
    212      * Enqueue Elementor preview assets (iframe)
    213      */
    214     public function enqueue_elementor_preview_assets() {
    215         // Always load in Elementor preview - no conditional needed
    216         $this->enqueue_by_context('elementor-preview');
    217     }
    218 
    219     /**
    220      * Enqueue Elementor editor assets (editor UI)
    221      */
    222     public function enqueue_elementor_editor_assets() {
    223         // Always load in Elementor editor - no conditional needed
    224         $this->enqueue_by_context('elementor-editor');
    225     }
    226 
    227     /**
    228      * Enqueue admin assets
    229      */
    230     public function enqueue_admin_assets($hook) {
    231         // Only on plugin's own admin pages
    232         if (!leanpl_is_our_admin_page()) {
    233             return;
    234         }
    235 
    236         $this->enqueue_by_context('admin');
    237     }
    238 
    239     /**
    240      * Localize main script - DRY method
    241      */
    242     private function localize_main_script() {
    243         static $localized = false;
    244 
    245         if ($localized) {
    246             return; // Only localize once
    247         }
    248 
    249         wp_localize_script('leanpl-main', 'lplData', [
    250             'version' => leanpl_get_version(),
    251             'debugMode' => leanpl_is_debug_mode() || leanpl_is_test_mode(),
    252             'baseVersion' => LEANPL_VERSION,
    253             'ajaxUrl' => admin_url('admin-ajax.php'),
    254         ]);
    255 
    256         $localized = true;
    257     }
    258 
    259     /**
    260      * Runtime safety net for late shortcode execution
    261      * Called from shortcode handler
    262      */
    263     public function ensure_assets_loaded() {
    264         if ($this->assets_loaded) {
    265             return;
    266         }
    267 
    268         // Check if we're in Elementor editor/preview
    269         if ($this->is_elementor_context()) {
    270             // Elementor handles asset loading via its own hooks
    271             return;
    272         }
    273 
    274         // Check timing
    275         if (did_action('wp_enqueue_scripts')) {
    276             // Too late - use fallback
    277             $this->late_loading = true;
    278             $this->inline_critical_assets();
    279         } else {
    280             // Still in time
    281             $this->enqueue_frontend_assets();
    282         }
    283     }
    284 
    285     /**
    286      * Detect if we're in Elementor context
    287      */
    288     private function is_elementor_context() {
    289         if (!did_action('elementor/loaded')) {
    290             return false;
    291         }
    292 
    293         // Check if in editor or preview mode
    294         if (\Elementor\Plugin::$instance->editor->is_edit_mode()) {
    295             return true;
    296         }
    297 
    298         if (\Elementor\Plugin::$instance->preview->is_preview_mode()) {
    299             return true;
    300         }
    301 
    302         return false;
    303     }
    304 
    305     /**
    306      * Fallback for late loading
    307      */
    308     private function inline_critical_assets() {
    309         if ($this->assets_loaded) {
    310             return;
    311         }
    312 
    313         add_action('wp_footer', [$this, 'output_critical_css'], 1);
    314 
    315         // Scripts can still be enqueued in footer
    316         foreach ($this->context_assets['frontend']['scripts'] as $handle) {
    317             wp_enqueue_script($handle);
    318         }
    319 
    320         $this->localize_main_script();
    321         $this->assets_loaded = true;
    322     }
    323 
    324     /**
    325      * Output critical CSS for late loading
    326      */
    327     public function output_critical_css() {
    328         if (!$this->late_loading) {
    329             return;
    330         }
    331 
    332         // Critical CSS inline
    333         echo '<style id="leanpl-critical-css">
    334             .lpl-player { opacity: 0; transition: opacity 0.3s ease; }
    335             .plyr.plyr--ready .lpl-player,
    336             .plyr--video .lpl-player,
    337             .plyr--audio .lpl-player { opacity: 1; }
    338             .lpl-player video, .lpl-player iframe { width: 100%; height: auto; }
    339         </style>';
    340 
    341         // Full CSS via link tags
    342         foreach ($this->context_assets['frontend']['styles'] as $handle) {
    343             $config = $this->asset_definitions['styles'][$handle];
    344             echo sprintf(
    345                 '<link rel="stylesheet" id="%s-css" href="%s?ver=%s" type="text/css" media="all" />',
    346                 esc_attr($handle),
    347                 esc_url(LEANPL_URI . $config['path']),
    348                 esc_attr($this->version)
    349             );
    350         }
    351     }
    352 
    353     /**
    354      * Public API: Check if specific asset is loaded
    355      */
    356     public function is_asset_loaded($handle) {
    357         return wp_script_is($handle, 'enqueued') || wp_style_is($handle, 'enqueued');
    358     }
    359 
    360     /**
    361      * Public API: Get asset URL
    362      */
    363     public function get_asset_url($handle, $type = 'script') {
    364         $key = ($type === 'script') ? 'scripts' : 'styles';
    365        
    366         if (!isset($this->asset_definitions[$key][$handle])) {
    367             return '';
    368         }
    369 
    370         return LEANPL_URI . $this->asset_definitions[$key][$handle]['path'];
     205            $this->load_assets_by_context('frontend');
     206        }
     207    }
     208
     209    /**
     210     * Load Elementor editor assets
     211     */
     212    public function register_n_enqueue_elementor_editor_assets() {
     213        // Register all assets again because in the current hooks the assets are not registered via wp_enqueue_scripts
     214        $this->register_all();
     215
     216        // Load assets for Elementor editor
     217        $this->load_assets_by_context('elementor-editor');
    371218    }
    372219}
  • az-video-and-audio-player-addon-for-elementor/tags/3.0.5/includes/class-base.php

    r3426299 r3430080  
    184184        require_once LEANPL_DIR . '/includes/class-metaboxs-save.php';
    185185
     186        // Load preview class (needed for frontend preview functionality)
     187        require_once LEANPL_DIR . '/includes/class-player-preview.php';
     188
    186189        // Load admin files
    187190        if (is_admin()) {
     
    191194            require_once LEANPL_DIR . '/includes/admin/class-player-table-columns.php';
    192195        }
     196
     197        // Include Elementor integration
     198        require_once LEANPL_DIR . '/includes/elementor/class-integration.php';
    193199    }
    194200
     
    216222     */
    217223    private function init_integrations() {
    218         // Load and initialize Elementor integration
    219         require_once LEANPL_DIR . '/includes/elementor/class-integration.php';
    220         \LeanPL\Elementor\Integration::get_instance();
     224        if (did_action('elementor/loaded')) {
     225            \LeanPL\Elementor\Integration::get_instance();
     226
     227        // On few elementor versions, the elementor/loaded action hook is not fired, so we need to wait for it.
     228        } else {
     229            add_action('elementor/loaded', function() {
     230                \LeanPL\Elementor\Integration::get_instance();
     231            }, 20);
     232        }
    221233    }
    222234
  • az-video-and-audio-player-addon-for-elementor/tags/3.0.5/includes/class-custom-posts.php

    r3417290 r3430080  
    5656            'labels'             => $labels,
    5757            'public'             => false, // Not publicly accessible
    58             'publicly_queryable' => false, // No single pages
     58            'publicly_queryable' => true, // No single pages (true for preview functionality)
    5959            'show_ui'            => true, // Show in admin
    6060            'show_in_menu'       => false, // Show in admin menu
  • az-video-and-audio-player-addon-for-elementor/tags/3.0.5/includes/elementor/class-integration.php

    r3417290 r3430080  
    1515 */
    1616class Integration {
    17    
    18     const MINIMUM_ELEMENTOR_VERSION = '2.0.0';
    19     const MINIMUM_PHP_VERSION = '5.6';
    20 
    2117    private static $instance = null;
    2218
     
    2824    }
    2925
     26    /**
     27     * Loading sequence: plugins_loaded -> elementor/loaded -> register_hooks()
     28     */
    3029    private function __construct() {
    31         // Check if Elementor is available
    32         if (!did_action('elementor/loaded')) {
    33             return;
    34         }
    35 
    36         // Run compatibility checks
    37         if (!$this->is_compatible()) {
    38             return;
    39         }
    40 
    4130        // Register ONLY widget-related hooks
    4231        // Assets handled by Assets_Manager automatically
    4332        $this->register_hooks();
    44     }
    45 
    46     private function is_compatible() {
    47         // Check Elementor version
    48         if (!defined('ELEMENTOR_VERSION') ||
    49             !version_compare(ELEMENTOR_VERSION, self::MINIMUM_ELEMENTOR_VERSION, '>=')) {
    50             add_action('admin_notices', [$this, 'admin_notice_minimum_elementor_version']);
    51             return false;
    52         }
    53 
    54         // Check PHP version
    55         if (version_compare(PHP_VERSION, self::MINIMUM_PHP_VERSION, '<')) {
    56             add_action('admin_notices', [$this, 'admin_notice_minimum_php_version']);
    57             return false;
    58         }
    59 
    60         return true;
    6133    }
    6234
     
    7547        $widgets_manager->register(new \LeanPL_Audio_Player());
    7648    }
    77 
    78     public function admin_notice_minimum_php_version() {
    79         if (isset($_GET['activate'])) {
    80             unset($_GET['activate']);
    81         }
    82 
    83         $message = sprintf(
    84             esc_html__('"%1$s" requires "%2$s" version %3$s or greater.', 'leanpl'),
    85             '<strong>' . esc_html__('Lean Player', 'leanpl') . '</strong>',
    86             '<strong>' . esc_html__('PHP', 'leanpl') . '</strong>',
    87             self::MINIMUM_PHP_VERSION
    88         );
    89 
    90         printf('<div class="notice notice-warning is-dismissible"><p>%1$s</p></div>', wp_kses_post($message));
    91     }
    92 
    93     public function admin_notice_minimum_elementor_version() {
    94         if (isset($_GET['activate'])) {
    95             unset($_GET['activate']);
    96         }
    97 
    98         $message = sprintf(
    99             esc_html__('"%1$s" requires "%2$s" version %3$s or greater.', 'leanpl'),
    100             '<strong>' . esc_html__('Lean Player', 'leanpl') . '</strong>',
    101             '<strong>' . esc_html__('Elementor', 'leanpl') . '</strong>',
    102             self::MINIMUM_ELEMENTOR_VERSION
    103         );
    104 
    105         printf('<div class="notice notice-warning is-dismissible"><p>%1$s</p></div>', wp_kses_post($message));
    106     }
    10749}
  • az-video-and-audio-player-addon-for-elementor/tags/3.0.5/includes/elementor/widgets/audio-player.php

    r3417290 r3430080  
    1919    public function get_categories() {
    2020        return array( 'general' );
     21    }
     22   
     23    public function get_style_depends() {
     24        return [
     25            'plyr',
     26            'leanpl-main'
     27        ];
    2128    }
    2229   
  • az-video-and-audio-player-addon-for-elementor/tags/3.0.5/includes/elementor/widgets/video-player.php

    r3417290 r3430080  
    1919    public function get_categories() {
    2020        return array( 'general' );
     21    }
     22
     23    public function get_style_depends() {
     24        return [
     25            'plyr',
     26            'leanpl-main'
     27        ];
    2128    }
    2229   
  • az-video-and-audio-player-addon-for-elementor/tags/3.0.5/includes/functions.php

    r3426299 r3430080  
    596596    }
    597597}
     598
     599/**
     600 * Get upgrade URL
     601 *
     602 * @return string Upgrade URL
     603 */
     604function leanpl_get_upgrade_url($args = []) {
     605    $defaults = [
     606        'utm_source' => 'plugin-free',
     607        'utm_medium' => 'modal',
     608        'utm_campaign' => 'upgrade',
     609        'scroll_to' => '#pricing'
     610    ];
     611
     612    $args = wp_parse_args($args, $defaults);
     613
     614    $base_url = 'https://leanplugins.com/wordpress-plugins/video-and-audio-player/';
     615
     616    $url = $base_url . '?utm_source=' . esc_attr($args['utm_source']) . '&utm_medium=' . esc_attr($args['utm_medium']) . '&utm_campaign=' . esc_attr($args['utm_campaign']);
     617
     618    if(!empty($args['scroll_to'])){
     619        $url .= $args['scroll_to'];
     620    }
     621
     622    return $url;
     623}
  • az-video-and-audio-player-addon-for-elementor/tags/3.0.5/includes/libs/lex-settings-new/config/tabs/quick-start.php

    r3424247 r3430080  
    8282
    8383        <div class="lpl-info-block lpl-info-block--outline lex-mt-0">
    84             <div class="lpl-heading-3 lex-mb-3"><?php echo esc_html__('Advanced: Direct Shortcodes (Legacy Method)', 'vapfem'); ?></div>
     84            <div class="lpl-heading-3 lex-mb-3"><?php echo esc_html__('Direct Shortcodes', 'vapfem'); ?></div>
    8585            <p><strong><?php echo esc_html__('Good for:', 'vapfem'); ?></strong> <?php echo esc_html__('Quick embed or programmatic use', 'vapfem'); ?></p>
    8686            <ul>
  • az-video-and-audio-player-addon-for-elementor/tags/3.0.5/includes/libs/lex-settings-new/core/changeslog.txt

    r3426299 r3430080  
     131 Dec 2025
     2- Moved upgrade modal markup to assets manager
     3
    1422 Dec 2025
    25- Multiple checkbox field sorting support added for metabox as well
  • az-video-and-audio-player-addon-for-elementor/tags/3.0.5/includes/libs/lex-settings-new/core/includes/class-assets-manager.php

    r3417290 r3430080  
    5050     */
    5151    private function registerHooks() {
     52        add_action('admin_footer', [$this, 'renderUpgradeModal']);
    5253        add_action('admin_enqueue_scripts', [$this, 'enqueueAssets']);
     54    }
     55
     56    public function renderUpgradeModal() {
     57        $page_check_callback = $this->settings->getConfig('page_check_callback');
     58
     59
     60        if(is_callable($page_check_callback) && call_user_func($page_check_callback)){
     61            $upgrade_modal_path = $this->settings->getConfig('framework_path') . '/partials/upgrade-modal.php';
     62            if (file_exists($upgrade_modal_path)) {
     63                include $upgrade_modal_path;
     64            }
     65        }
    5366    }
    5467   
  • az-video-and-audio-player-addon-for-elementor/tags/3.0.5/includes/libs/lex-settings-new/core/partials/settings-page.php

    r3417290 r3430080  
    145145    </aside>
    146146</div>
    147 
    148 <?php
    149 // Include upgrade modal
    150 $upgrade_modal_path = $settings->getConfig('framework_path') . '/partials/upgrade-modal.php';
    151 if (file_exists($upgrade_modal_path)) {
    152     include $upgrade_modal_path;
    153 }
    154 ?>
    155 
  • az-video-and-audio-player-addon-for-elementor/tags/3.0.5/includes/libs/lex-settings-new/core/partials/upgrade-modal.php

    r3424247 r3430080  
    8787
    8888            <div class="lex-upgrade-cta-container">
    89                 <a href="https://leanplugins.com/wordpress-plugins/video-and-audio-player/?utm_source=plugin-free&utm_medium=modal&utm_campaign=upgrade#pricing" target="_blank" class="lex-upgrade-cta-btn">
     89                <a href="<?php echo leanpl_get_upgrade_url(array('utm_medium' => 'modal')); ?>" target="_blank" class="lex-upgrade-cta-btn">
    9090                    <?php echo esc_html__('View Pricing & Upgrade', 'lex-settings'); ?>
    9191                </a>
  • az-video-and-audio-player-addon-for-elementor/tags/3.0.5/includes/shortcodes/class-audio-shortcode.php

    r3426299 r3430080  
    9999        }
    100100
    101         // Ensure assets are loaded (handles all edge cases)
    102         Assets_Manager::get_instance()->ensure_assets_loaded();
     101        // Ensure assets are loaded even used with do_shortcode()
     102        if( !wp_script_is('leanpl-main', 'enqueued') ){
     103            Assets_Manager::get_instance()->load_assets_by_context('frontend');
     104        }
    103105
    104106        // Get all supported attribute keys from attribute_map (for filtering & documentation)
  • az-video-and-audio-player-addon-for-elementor/tags/3.0.5/includes/shortcodes/class-player-shortcode.php

    r3426299 r3430080  
    6666     */
    6767    public function render_player_shortcode($atts, $content = null) {
     68        global $wp_scripts;
     69       
    6870        if (is_admin() && !leanpl_is_elementor_editor()) {
    6971            // Don't render in admin area except in Elementor editor
     
    7173        }
    7274
    73         // Ensure assets are loaded (handles all edge cases)
    74         Assets_Manager::get_instance()->ensure_assets_loaded();
     75        // Ensure assets are loaded even used with do_shortcode()
     76        if( !wp_script_is('leanpl-main', 'enqueued') ){
     77            Assets_Manager::get_instance()->load_assets_by_context('frontend');
     78        }
    7579
    7680        // Get post ID from attributes
  • az-video-and-audio-player-addon-for-elementor/tags/3.0.5/includes/shortcodes/class-video-shortcode.php

    r3426299 r3430080  
    111111        }
    112112
    113         // Ensure assets are loaded (handles all edge cases)
    114         Assets_Manager::get_instance()->ensure_assets_loaded();
     113        // Ensure assets are loaded even used with do_shortcode()
     114        if( !wp_script_is('leanpl-main', 'enqueued') ){
     115            Assets_Manager::get_instance()->load_assets_by_context('frontend');
     116        }
    115117
    116118        // Get all supported attribute keys from attribute_map (for filtering & documentation)
  • az-video-and-audio-player-addon-for-elementor/tags/3.0.5/plugin-main.php

    r3426299 r3430080  
    44Plugin URI: https://leanplugins.com/
    55Description: Video & Audio player for Elementor, Gutenberg & Classic Editor
    6 Version: 3.0.4
     6Version: 3.0.5
    77Author: LeanPlugins
    88Author URI: https://leanplugins.com/
     
    1919// Both version may have this constant, so check first
    2020if (!defined('LEANPL_VERSION')) {
    21     define('LEANPL_VERSION', '3.0.4');
     21    define('LEANPL_VERSION', '3.0.5');
    2222    define('LEANPL_URI', plugins_url('', __FILE__));
    2323    define('LEANPL_DIR', dirname(__FILE__));
  • az-video-and-audio-player-addon-for-elementor/tags/3.0.5/readme.txt

    r3426299 r3430080  
    55Tested up to: 6.9
    66Requires PHP: 7.4
    7 Stable tag: 3.0.4
     7Stable tag: 3.0.5
    88License: GPLv2 or later
    99License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    2626* **Per-Player Configuration** - Override global settings for individual players
    2727* **Admin Columns** - View all players at a glance with Player Type, Source Type, Source, Autoplay status, and copy-ready Shortcode
     28* **Preview Player** - Preview your player before publishing directly from the players list or from the player edit page
    2829* **Simple Shortcode** - [lean_player id="123"] to embed anywhere
    2930
     
    9899
    99100== Changelog ==
     101= Version: 3.0.5 =
     102Fixed: Widget does not load in the elementor planel
     103Improved: Assets management, Assets were loading on all pages
     104- Added: Preview Player feature - Preview players directly from the players list or edit page
     105
    100106= Version: 3.0.4 =
    101107- Added: A new filter hook leanpl/metabox/field_config
     
    230236
    231237You can also set Global Player Settings to define default behavior for all players, then override those defaults for individual players as needed.
     238
     239= How do I preview a player before publishing? =
     240
     241You can preview your player in two ways:
     242
     243* **From the Players List**: Click "Preview Player" in the row actions next to any player in the All Players list
     244* **From the Edit Screen**: Use the "Preview Player" button in the publish box when editing a player
     245
     246The preview opens in a new tab, showing only the player without your site's header, footer, or sidebar for a clean preview experience.
    232247
    233248= Does this plugin use any third-party services? =
  • az-video-and-audio-player-addon-for-elementor/trunk/assets/css/admin.css

    r3417290 r3430080  
    1818/* 1. General Layout & Structure
    1919================================================== */
     20/* Override core */
     21.post-type-lean_player #preview-action,
     22.post-type-lean_player #visibility{
     23    display: none;
     24}
     25
     26.post-type-lean_player .lpl-preview-metabox{
     27    display:flex;
     28    align-items: flex-start;
     29    justify-content: start;
     30    margin-bottom: 5px;
     31    flex-direction: column;
     32}
     33
     34.post-type-lean_player a.preview.button{
     35    display: inline-flex;
     36    align-items: center;
     37    gap: 5px;
     38}
     39
    2040
    2141.lpl-hire-page{
  • az-video-and-audio-player-addon-for-elementor/trunk/assets/css/main.css

    r3417290 r3430080  
    22    box-shadow: none;
    33}
     4
    45.plyr--audio .plyr__controls{
    56    background: transparent;
     
    1011    color: #fff;
    1112    padding: 15px 0;
     13    display: -webkit-box;
     14    display: -ms-flexbox;
    1215    display: flex;
    13     align-items: center;
    14     justify-content: center;
     16    -webkit-box-align: center;
     17        -ms-flex-align: center;
     18            align-items: center;
     19    -webkit-box-pack: center;
     20        -ms-flex-pack: center;
     21            justify-content: center;
    1522}
    1623
     
    2633    box-shadow: none;
    2734}
    28 
    29 /*BeTheme support*/
    30 .plyr button{
    31     margin-bottom: 0;
    32 }
  • az-video-and-audio-player-addon-for-elementor/trunk/assets/js/main.js

    r3426299 r3430080  
    8181    function isDebugModeEnabled(settings) {
    8282        var playerDebugMode = getBooleanSetting(settings, 'debug_mode', false);
    83         var envDebugMode = (typeof lplData !== 'undefined' && lplData.debugMode) || false;
     83        var envDebugMode = (typeof leanpl_params !== 'undefined' && leanpl_params.debugMode) || false;
    8484        return playerDebugMode || envDebugMode;
    8585    }
  • az-video-and-audio-player-addon-for-elementor/trunk/includes/admin/class-menu.php

    r3424247 r3430080  
    105105            'defaults' => $default_settings,       // Default settings array
    106106            'version' => LEANPL_VERSION,
    107             'dropdown_label' => esc_html__('Legacy Shortcodes', 'vapfem'),
     107            'dropdown_label' => esc_html__('Shortcodes', 'vapfem'),
    108108            // Use callback instead of allowed_pages - leverages existing leanpl_is_our_admin_page() function
    109109            'page_check_callback' => 'leanpl_is_our_admin_page',
     
    231231            'lean_player-settings-tab',
    232232            array($this, 'lean_player_settings_page')
     233        );
     234
     235        // Submenu - Upgrade Now
     236        add_submenu_page(
     237            'lean_player-settings',
     238            esc_html__('Upgrade to Premium', 'vapfem'),
     239            esc_html__('Upgrade to Premium', 'vapfem'),
     240            'manage_options',
     241            leanpl_get_upgrade_url(array('utm_medium' => 'menu'))
    233242        );
    234243       
     
    327336                // Update on hash change
    328337                $(window).on('hashchange', updateMenuHighlight);
     338
     339                // Target the specific upgrade
     340                $('.wp-submenu a[href*=\"leanplugins.com\"]').attr('target', '_blank');
    329341            });
    330342        ");
  • az-video-and-audio-player-addon-for-elementor/trunk/includes/class-assets-manager.php

    r3417290 r3430080  
    1919    private $assets_loaded = false;
    2020    private $late_loading = false;
     21    private $loaded = [];
    2122
    2223    /**
     
    2425     * All asset paths, handles, and dependencies defined here
    2526     */
    26     private $asset_definitions = [
     27    private $assets = [
    2728        'scripts' => [
    2829            'plyr' => [
    29                 'path' => '/assets/js/plyr.min.js',
     30                'file' => '/assets/js/plyr.min.js',
    3031                'deps' => ['jquery'],
    31                 'footer' => true,
     32                'in_footer' => true,
     33                'contexts' => ['frontend'],
    3234            ],
    3335            'plyr-polyfilled' => [
    34                 'path' => '/assets/js/plyr.polyfilled.min.js',
     36                'file' => '/assets/js/plyr.polyfilled.min.js',
    3537                'deps' => ['jquery'],
    36                 'footer' => true,
     38                'in_footer' => true,
     39                'contexts' => ['frontend'],
    3740            ],
    3841            'leanpl-main' => [
    39                 'path' => '/assets/js/main.js',
     42                'file' => '/assets/js/main.js',
    4043                'deps' => ['jquery', 'plyr'],
    41                 'footer' => true,
     44                'in_footer' => true,
     45                'contexts' => ['frontend'],
    4246            ],
    4347            'leanpl-admin' => [
    44                 'path' => '/assets/js/admin.js',
     48                'file' => '/assets/js/admin.js',
    4549                'deps' => ['jquery'],
    46                 'footer' => true,
     50                'in_footer' => true,
     51                'contexts' => ['admin'],
    4752            ],
    4853        ],
    4954        'styles' => [
    5055            'plyr' => [
    51                 'path' => '/assets/css/plyr.css',
     56                'file' => '/assets/css/plyr.css',
    5257                'deps' => [],
     58                'in_footer' => false,
     59                'contexts' => ['frontend'],
    5360            ],
    5461            'leanpl-main' => [
    55                 'path' => '/assets/css/main.css',
     62                'file' => '/assets/css/main.css',
    5663                'deps' => ['plyr'],
     64                'in_footer' => false,
     65                'contexts' => ['frontend'],
    5766            ],
    5867            'leanpl-editor' => [
    59                 'path' => '/assets/css/editor.css',
     68                'file' => '/assets/css/editor.css',
    6069                'deps' => [],
     70                'in_footer' => false,
     71                'contexts' => ['elementor-editor'],
    6172            ],
    6273            'leanpl-admin' => [
    63                 'path' => '/assets/css/admin.css',
     74                'file' => '/assets/css/admin.css',
    6475                'deps' => [],
    65             ],
    66         ],
    67     ];
    68 
    69     /**
    70      * Context definitions - what assets to load where
    71      */
    72     private $context_assets = [
    73         'frontend' => [
    74             'scripts' => ['plyr', 'leanpl-main'],
    75             'styles' => ['plyr', 'leanpl-main'],
    76         ],
    77         'elementor-editor' => [
    78             'scripts' => [],
    79             'styles' => ['leanpl-editor'],
    80         ],
    81         'elementor-preview' => [
    82             'scripts' => ['plyr', 'leanpl-main'],
    83             'styles' => ['plyr', 'leanpl-main'],
    84         ],
    85         'admin' => [
    86             'scripts' => ['leanpl-admin'],
    87             'styles' => ['leanpl-admin'],
     76                'in_footer' => false,
     77                'contexts' => ['admin'],
     78            ],
    8879        ],
    8980    ];
     
    10192
    10293    /**
    103      * Initialize - register ALL hooks in one place
     94     * Initialize the assets manager
    10495     */
    10596    public function init() {
    10697        $this->version = leanpl_get_version();
    10798
    108         // Frontend hooks
    109         add_action('wp_enqueue_scripts', [$this, 'register_assets'], 10);
    110         add_action('wp_enqueue_scripts', [$this, 'conditional_enqueue'], 20);
    111 
    112         // Elementor hooks (if Elementor is active)
    113         if (did_action('elementor/loaded')) {
    114             add_action('elementor/frontend/after_register_scripts', [$this, 'register_assets']);
    115             add_action('elementor/frontend/after_enqueue_styles', [$this, 'enqueue_elementor_preview_assets']);
    116             add_action('elementor/editor/after_enqueue_styles', [$this, 'enqueue_elementor_editor_assets']);
    117         }
    118 
    119         // Admin hooks - Register assets first, then enqueue
    120         add_action('admin_enqueue_scripts', [$this, 'register_assets'] );
     99        // -- Register all assets --
     100        add_action('admin_enqueue_scripts', [$this, 'register_all']);
     101        add_action('wp_enqueue_scripts', [$this, 'register_all']);
     102
     103        // -- Load admin assets --
    121104        add_action('admin_enqueue_scripts', [$this, 'enqueue_admin_assets']);
    122     }
    123 
    124     /**
    125      * Register ALL assets - DRY method using definitions array
    126      */
    127     public function register_assets() {
    128         // Register scripts
    129         foreach ($this->asset_definitions['scripts'] as $handle => $config) {
    130             if (!wp_script_is($handle, 'registered')) {
    131                 wp_register_script(
    132                     $handle,
    133                     LEANPL_URI . $config['path'],
    134                     $config['deps'],
    135                     $this->version,
    136                     $config['footer']
    137                 );
     105       
     106        // -- Load frontend assets --
     107        add_action('wp_enqueue_scripts', [$this, 'common_frontend_enqueue']);
     108        add_action('wp_enqueue_scripts', [$this, 'enqueue_if_shortcode'], 20);
     109
     110        // -- Load Elementor assets --
     111        // Note: Widget frontend assets are loaded via widget registration, so we don't need to load them here.
     112        //       But we need to register the assets for the editor.
     113        add_action('elementor/editor/after_enqueue_scripts', [$this, 'register_n_enqueue_elementor_editor_assets']);
     114    }
     115
     116    /**
     117     * Register all assets
     118     */
     119    public function register_all() {
     120        foreach ($this->assets['styles'] as $handle => $config) {
     121            $url = LEANPL_URI . $config['file'];
     122            $deps = $config['deps'];
     123            $in_footer = $config['in_footer'];
     124
     125            wp_register_style($handle, $url, $deps, $this->version, $in_footer);
     126        }
     127
     128        foreach ($this->assets['scripts'] as $handle => $config) {
     129            $url = LEANPL_URI . $config['file'];
     130            $deps = $config['deps'];
     131            $in_footer = $config['in_footer'];
     132
     133            wp_register_script($handle, $url, $deps, $this->version, $in_footer);
     134        }
     135    }
     136
     137    public function enqueue_admin_assets($hook) {
     138        if (!leanpl_is_our_admin_page()) {
     139            return;
     140        }
     141       
     142        $this->load_assets_by_context('admin');
     143    }
     144
     145    public function common_frontend_enqueue() {
     146        // Enqueue jQuery first, other plugins may remove it from the queue
     147        wp_enqueue_script('jquery');
     148
     149        // Localization
     150        wp_localize_script('jquery', 'leanpl_params', [
     151            'version' => $this->version,
     152            'debugMode' => leanpl_is_debug_mode(),
     153            'ajaxUrl' => admin_url('admin-ajax.php'),
     154        ]);
     155    }
     156
     157    /**
     158     * Load by context
     159     *
     160     * @param string $context The context to load the assets for
     161     * @return void
     162     */
     163
     164    public function load_assets_by_context($context) {
     165        foreach ($this->assets['styles'] as $handle => $config) {
     166            // Skip if not for this context
     167            if (!in_array($context, $config['contexts'])) {
     168                continue;
    138169            }
    139         }
    140 
    141         // Register styles
    142         foreach ($this->asset_definitions['styles'] as $handle => $config) {
    143             if (!wp_style_is($handle, 'registered')) {
    144                 wp_register_style(
    145                     $handle,
    146                     LEANPL_URI . $config['path'],
    147                     $config['deps'],
    148                     $this->version
    149                 );
     170
     171            // Enqueue it
     172            wp_enqueue_style($handle);
     173        }
     174
     175        foreach ($this->assets['scripts'] as $handle => $config) {
     176            // Skip if not for this context
     177            if (!in_array($context, $config['contexts'])) {
     178                continue;
    150179            }
    151         }
    152     }
    153 
    154     /**
    155      * Enqueue assets by context - DRY method
    156      */
    157     private function enqueue_by_context($context) {
    158         if (!isset($this->context_assets[$context])) {
    159             return;
    160         }
    161 
    162         $assets = $this->context_assets[$context];
    163 
    164         // Enqueue scripts
    165         foreach ($assets['scripts'] as $handle) {
     180
     181            // Enqueue it
    166182            wp_enqueue_script($handle);
    167183        }
    168 
    169         // Enqueue styles
    170         foreach ($assets['styles'] as $handle) {
    171             wp_enqueue_style($handle);
    172         }
    173 
    174         // Localize main script if it's being loaded
    175         if (in_array('leanpl-main', $assets['scripts'])) {
    176             $this->localize_main_script();
    177         }
    178     }
    179 
    180     /**
    181      * Early detection for shortcodes in post content
    182      */
    183     public function conditional_enqueue() {
     184    }
     185
     186    /**
     187     * Load if shortcode is found in the post content
     188     *
     189     * Note: this will not support do_shortcode() usage
     190     * @return void
     191     */
     192    public function enqueue_if_shortcode() {
    184193        if ($this->assets_loaded || is_admin()) {
    185194            return;
    186195        }
    187196
    188         global $post;
    189 
    190         if ($post &&
    191             has_shortcode( $post->post_content, 'lean_video' ) ||
    192             has_shortcode( $post->post_content, 'lean_audio' ) ||
    193             has_shortcode( $post->post_content, 'lean_player' )
     197        global $post; // might be null for 404 pages
     198
     199        if ($post && (
     200                has_shortcode( $post->post_content, 'lean_video' ) ||
     201                has_shortcode( $post->post_content, 'lean_audio' ) ||
     202                has_shortcode( $post->post_content, 'lean_player' )
     203            )
    194204        ) {
    195             $this->enqueue_frontend_assets();
    196         }
    197     }
    198 
    199     /**
    200      * Enqueue frontend assets (shortcodes, widgets)
    201      */
    202     public function enqueue_frontend_assets() {
    203         if ($this->assets_loaded) {
    204             return;
    205         }
    206 
    207         $this->enqueue_by_context('frontend');
    208         $this->assets_loaded = true;
    209     }
    210 
    211     /**
    212      * Enqueue Elementor preview assets (iframe)
    213      */
    214     public function enqueue_elementor_preview_assets() {
    215         // Always load in Elementor preview - no conditional needed
    216         $this->enqueue_by_context('elementor-preview');
    217     }
    218 
    219     /**
    220      * Enqueue Elementor editor assets (editor UI)
    221      */
    222     public function enqueue_elementor_editor_assets() {
    223         // Always load in Elementor editor - no conditional needed
    224         $this->enqueue_by_context('elementor-editor');
    225     }
    226 
    227     /**
    228      * Enqueue admin assets
    229      */
    230     public function enqueue_admin_assets($hook) {
    231         // Only on plugin's own admin pages
    232         if (!leanpl_is_our_admin_page()) {
    233             return;
    234         }
    235 
    236         $this->enqueue_by_context('admin');
    237     }
    238 
    239     /**
    240      * Localize main script - DRY method
    241      */
    242     private function localize_main_script() {
    243         static $localized = false;
    244 
    245         if ($localized) {
    246             return; // Only localize once
    247         }
    248 
    249         wp_localize_script('leanpl-main', 'lplData', [
    250             'version' => leanpl_get_version(),
    251             'debugMode' => leanpl_is_debug_mode() || leanpl_is_test_mode(),
    252             'baseVersion' => LEANPL_VERSION,
    253             'ajaxUrl' => admin_url('admin-ajax.php'),
    254         ]);
    255 
    256         $localized = true;
    257     }
    258 
    259     /**
    260      * Runtime safety net for late shortcode execution
    261      * Called from shortcode handler
    262      */
    263     public function ensure_assets_loaded() {
    264         if ($this->assets_loaded) {
    265             return;
    266         }
    267 
    268         // Check if we're in Elementor editor/preview
    269         if ($this->is_elementor_context()) {
    270             // Elementor handles asset loading via its own hooks
    271             return;
    272         }
    273 
    274         // Check timing
    275         if (did_action('wp_enqueue_scripts')) {
    276             // Too late - use fallback
    277             $this->late_loading = true;
    278             $this->inline_critical_assets();
    279         } else {
    280             // Still in time
    281             $this->enqueue_frontend_assets();
    282         }
    283     }
    284 
    285     /**
    286      * Detect if we're in Elementor context
    287      */
    288     private function is_elementor_context() {
    289         if (!did_action('elementor/loaded')) {
    290             return false;
    291         }
    292 
    293         // Check if in editor or preview mode
    294         if (\Elementor\Plugin::$instance->editor->is_edit_mode()) {
    295             return true;
    296         }
    297 
    298         if (\Elementor\Plugin::$instance->preview->is_preview_mode()) {
    299             return true;
    300         }
    301 
    302         return false;
    303     }
    304 
    305     /**
    306      * Fallback for late loading
    307      */
    308     private function inline_critical_assets() {
    309         if ($this->assets_loaded) {
    310             return;
    311         }
    312 
    313         add_action('wp_footer', [$this, 'output_critical_css'], 1);
    314 
    315         // Scripts can still be enqueued in footer
    316         foreach ($this->context_assets['frontend']['scripts'] as $handle) {
    317             wp_enqueue_script($handle);
    318         }
    319 
    320         $this->localize_main_script();
    321         $this->assets_loaded = true;
    322     }
    323 
    324     /**
    325      * Output critical CSS for late loading
    326      */
    327     public function output_critical_css() {
    328         if (!$this->late_loading) {
    329             return;
    330         }
    331 
    332         // Critical CSS inline
    333         echo '<style id="leanpl-critical-css">
    334             .lpl-player { opacity: 0; transition: opacity 0.3s ease; }
    335             .plyr.plyr--ready .lpl-player,
    336             .plyr--video .lpl-player,
    337             .plyr--audio .lpl-player { opacity: 1; }
    338             .lpl-player video, .lpl-player iframe { width: 100%; height: auto; }
    339         </style>';
    340 
    341         // Full CSS via link tags
    342         foreach ($this->context_assets['frontend']['styles'] as $handle) {
    343             $config = $this->asset_definitions['styles'][$handle];
    344             echo sprintf(
    345                 '<link rel="stylesheet" id="%s-css" href="%s?ver=%s" type="text/css" media="all" />',
    346                 esc_attr($handle),
    347                 esc_url(LEANPL_URI . $config['path']),
    348                 esc_attr($this->version)
    349             );
    350         }
    351     }
    352 
    353     /**
    354      * Public API: Check if specific asset is loaded
    355      */
    356     public function is_asset_loaded($handle) {
    357         return wp_script_is($handle, 'enqueued') || wp_style_is($handle, 'enqueued');
    358     }
    359 
    360     /**
    361      * Public API: Get asset URL
    362      */
    363     public function get_asset_url($handle, $type = 'script') {
    364         $key = ($type === 'script') ? 'scripts' : 'styles';
    365        
    366         if (!isset($this->asset_definitions[$key][$handle])) {
    367             return '';
    368         }
    369 
    370         return LEANPL_URI . $this->asset_definitions[$key][$handle]['path'];
     205            $this->load_assets_by_context('frontend');
     206        }
     207    }
     208
     209    /**
     210     * Load Elementor editor assets
     211     */
     212    public function register_n_enqueue_elementor_editor_assets() {
     213        // Register all assets again because in the current hooks the assets are not registered via wp_enqueue_scripts
     214        $this->register_all();
     215
     216        // Load assets for Elementor editor
     217        $this->load_assets_by_context('elementor-editor');
    371218    }
    372219}
  • az-video-and-audio-player-addon-for-elementor/trunk/includes/class-base.php

    r3426299 r3430080  
    184184        require_once LEANPL_DIR . '/includes/class-metaboxs-save.php';
    185185
     186        // Load preview class (needed for frontend preview functionality)
     187        require_once LEANPL_DIR . '/includes/class-player-preview.php';
     188
    186189        // Load admin files
    187190        if (is_admin()) {
     
    191194            require_once LEANPL_DIR . '/includes/admin/class-player-table-columns.php';
    192195        }
     196
     197        // Include Elementor integration
     198        require_once LEANPL_DIR . '/includes/elementor/class-integration.php';
    193199    }
    194200
     
    216222     */
    217223    private function init_integrations() {
    218         // Load and initialize Elementor integration
    219         require_once LEANPL_DIR . '/includes/elementor/class-integration.php';
    220         \LeanPL\Elementor\Integration::get_instance();
     224        if (did_action('elementor/loaded')) {
     225            \LeanPL\Elementor\Integration::get_instance();
     226
     227        // On few elementor versions, the elementor/loaded action hook is not fired, so we need to wait for it.
     228        } else {
     229            add_action('elementor/loaded', function() {
     230                \LeanPL\Elementor\Integration::get_instance();
     231            }, 20);
     232        }
    221233    }
    222234
  • az-video-and-audio-player-addon-for-elementor/trunk/includes/class-custom-posts.php

    r3417290 r3430080  
    5656            'labels'             => $labels,
    5757            'public'             => false, // Not publicly accessible
    58             'publicly_queryable' => false, // No single pages
     58            'publicly_queryable' => true, // No single pages (true for preview functionality)
    5959            'show_ui'            => true, // Show in admin
    6060            'show_in_menu'       => false, // Show in admin menu
  • az-video-and-audio-player-addon-for-elementor/trunk/includes/elementor/class-integration.php

    r3417290 r3430080  
    1515 */
    1616class Integration {
    17    
    18     const MINIMUM_ELEMENTOR_VERSION = '2.0.0';
    19     const MINIMUM_PHP_VERSION = '5.6';
    20 
    2117    private static $instance = null;
    2218
     
    2824    }
    2925
     26    /**
     27     * Loading sequence: plugins_loaded -> elementor/loaded -> register_hooks()
     28     */
    3029    private function __construct() {
    31         // Check if Elementor is available
    32         if (!did_action('elementor/loaded')) {
    33             return;
    34         }
    35 
    36         // Run compatibility checks
    37         if (!$this->is_compatible()) {
    38             return;
    39         }
    40 
    4130        // Register ONLY widget-related hooks
    4231        // Assets handled by Assets_Manager automatically
    4332        $this->register_hooks();
    44     }
    45 
    46     private function is_compatible() {
    47         // Check Elementor version
    48         if (!defined('ELEMENTOR_VERSION') ||
    49             !version_compare(ELEMENTOR_VERSION, self::MINIMUM_ELEMENTOR_VERSION, '>=')) {
    50             add_action('admin_notices', [$this, 'admin_notice_minimum_elementor_version']);
    51             return false;
    52         }
    53 
    54         // Check PHP version
    55         if (version_compare(PHP_VERSION, self::MINIMUM_PHP_VERSION, '<')) {
    56             add_action('admin_notices', [$this, 'admin_notice_minimum_php_version']);
    57             return false;
    58         }
    59 
    60         return true;
    6133    }
    6234
     
    7547        $widgets_manager->register(new \LeanPL_Audio_Player());
    7648    }
    77 
    78     public function admin_notice_minimum_php_version() {
    79         if (isset($_GET['activate'])) {
    80             unset($_GET['activate']);
    81         }
    82 
    83         $message = sprintf(
    84             esc_html__('"%1$s" requires "%2$s" version %3$s or greater.', 'leanpl'),
    85             '<strong>' . esc_html__('Lean Player', 'leanpl') . '</strong>',
    86             '<strong>' . esc_html__('PHP', 'leanpl') . '</strong>',
    87             self::MINIMUM_PHP_VERSION
    88         );
    89 
    90         printf('<div class="notice notice-warning is-dismissible"><p>%1$s</p></div>', wp_kses_post($message));
    91     }
    92 
    93     public function admin_notice_minimum_elementor_version() {
    94         if (isset($_GET['activate'])) {
    95             unset($_GET['activate']);
    96         }
    97 
    98         $message = sprintf(
    99             esc_html__('"%1$s" requires "%2$s" version %3$s or greater.', 'leanpl'),
    100             '<strong>' . esc_html__('Lean Player', 'leanpl') . '</strong>',
    101             '<strong>' . esc_html__('Elementor', 'leanpl') . '</strong>',
    102             self::MINIMUM_ELEMENTOR_VERSION
    103         );
    104 
    105         printf('<div class="notice notice-warning is-dismissible"><p>%1$s</p></div>', wp_kses_post($message));
    106     }
    10749}
  • az-video-and-audio-player-addon-for-elementor/trunk/includes/elementor/widgets/audio-player.php

    r3417290 r3430080  
    1919    public function get_categories() {
    2020        return array( 'general' );
     21    }
     22   
     23    public function get_style_depends() {
     24        return [
     25            'plyr',
     26            'leanpl-main'
     27        ];
    2128    }
    2229   
  • az-video-and-audio-player-addon-for-elementor/trunk/includes/elementor/widgets/video-player.php

    r3417290 r3430080  
    1919    public function get_categories() {
    2020        return array( 'general' );
     21    }
     22
     23    public function get_style_depends() {
     24        return [
     25            'plyr',
     26            'leanpl-main'
     27        ];
    2128    }
    2229   
  • az-video-and-audio-player-addon-for-elementor/trunk/includes/functions.php

    r3426299 r3430080  
    596596    }
    597597}
     598
     599/**
     600 * Get upgrade URL
     601 *
     602 * @return string Upgrade URL
     603 */
     604function leanpl_get_upgrade_url($args = []) {
     605    $defaults = [
     606        'utm_source' => 'plugin-free',
     607        'utm_medium' => 'modal',
     608        'utm_campaign' => 'upgrade',
     609        'scroll_to' => '#pricing'
     610    ];
     611
     612    $args = wp_parse_args($args, $defaults);
     613
     614    $base_url = 'https://leanplugins.com/wordpress-plugins/video-and-audio-player/';
     615
     616    $url = $base_url . '?utm_source=' . esc_attr($args['utm_source']) . '&utm_medium=' . esc_attr($args['utm_medium']) . '&utm_campaign=' . esc_attr($args['utm_campaign']);
     617
     618    if(!empty($args['scroll_to'])){
     619        $url .= $args['scroll_to'];
     620    }
     621
     622    return $url;
     623}
  • az-video-and-audio-player-addon-for-elementor/trunk/includes/libs/lex-settings-new/config/tabs/quick-start.php

    r3424247 r3430080  
    8282
    8383        <div class="lpl-info-block lpl-info-block--outline lex-mt-0">
    84             <div class="lpl-heading-3 lex-mb-3"><?php echo esc_html__('Advanced: Direct Shortcodes (Legacy Method)', 'vapfem'); ?></div>
     84            <div class="lpl-heading-3 lex-mb-3"><?php echo esc_html__('Direct Shortcodes', 'vapfem'); ?></div>
    8585            <p><strong><?php echo esc_html__('Good for:', 'vapfem'); ?></strong> <?php echo esc_html__('Quick embed or programmatic use', 'vapfem'); ?></p>
    8686            <ul>
  • az-video-and-audio-player-addon-for-elementor/trunk/includes/libs/lex-settings-new/core/changeslog.txt

    r3426299 r3430080  
     131 Dec 2025
     2- Moved upgrade modal markup to assets manager
     3
    1422 Dec 2025
    25- Multiple checkbox field sorting support added for metabox as well
  • az-video-and-audio-player-addon-for-elementor/trunk/includes/libs/lex-settings-new/core/includes/class-assets-manager.php

    r3417290 r3430080  
    5050     */
    5151    private function registerHooks() {
     52        add_action('admin_footer', [$this, 'renderUpgradeModal']);
    5253        add_action('admin_enqueue_scripts', [$this, 'enqueueAssets']);
     54    }
     55
     56    public function renderUpgradeModal() {
     57        $page_check_callback = $this->settings->getConfig('page_check_callback');
     58
     59
     60        if(is_callable($page_check_callback) && call_user_func($page_check_callback)){
     61            $upgrade_modal_path = $this->settings->getConfig('framework_path') . '/partials/upgrade-modal.php';
     62            if (file_exists($upgrade_modal_path)) {
     63                include $upgrade_modal_path;
     64            }
     65        }
    5366    }
    5467   
  • az-video-and-audio-player-addon-for-elementor/trunk/includes/libs/lex-settings-new/core/partials/settings-page.php

    r3417290 r3430080  
    145145    </aside>
    146146</div>
    147 
    148 <?php
    149 // Include upgrade modal
    150 $upgrade_modal_path = $settings->getConfig('framework_path') . '/partials/upgrade-modal.php';
    151 if (file_exists($upgrade_modal_path)) {
    152     include $upgrade_modal_path;
    153 }
    154 ?>
    155 
  • az-video-and-audio-player-addon-for-elementor/trunk/includes/libs/lex-settings-new/core/partials/upgrade-modal.php

    r3424247 r3430080  
    8787
    8888            <div class="lex-upgrade-cta-container">
    89                 <a href="https://leanplugins.com/wordpress-plugins/video-and-audio-player/?utm_source=plugin-free&utm_medium=modal&utm_campaign=upgrade#pricing" target="_blank" class="lex-upgrade-cta-btn">
     89                <a href="<?php echo leanpl_get_upgrade_url(array('utm_medium' => 'modal')); ?>" target="_blank" class="lex-upgrade-cta-btn">
    9090                    <?php echo esc_html__('View Pricing & Upgrade', 'lex-settings'); ?>
    9191                </a>
  • az-video-and-audio-player-addon-for-elementor/trunk/includes/shortcodes/class-audio-shortcode.php

    r3426299 r3430080  
    9999        }
    100100
    101         // Ensure assets are loaded (handles all edge cases)
    102         Assets_Manager::get_instance()->ensure_assets_loaded();
     101        // Ensure assets are loaded even used with do_shortcode()
     102        if( !wp_script_is('leanpl-main', 'enqueued') ){
     103            Assets_Manager::get_instance()->load_assets_by_context('frontend');
     104        }
    103105
    104106        // Get all supported attribute keys from attribute_map (for filtering & documentation)
  • az-video-and-audio-player-addon-for-elementor/trunk/includes/shortcodes/class-player-shortcode.php

    r3426299 r3430080  
    6666     */
    6767    public function render_player_shortcode($atts, $content = null) {
     68        global $wp_scripts;
     69       
    6870        if (is_admin() && !leanpl_is_elementor_editor()) {
    6971            // Don't render in admin area except in Elementor editor
     
    7173        }
    7274
    73         // Ensure assets are loaded (handles all edge cases)
    74         Assets_Manager::get_instance()->ensure_assets_loaded();
     75        // Ensure assets are loaded even used with do_shortcode()
     76        if( !wp_script_is('leanpl-main', 'enqueued') ){
     77            Assets_Manager::get_instance()->load_assets_by_context('frontend');
     78        }
    7579
    7680        // Get post ID from attributes
  • az-video-and-audio-player-addon-for-elementor/trunk/includes/shortcodes/class-video-shortcode.php

    r3426299 r3430080  
    111111        }
    112112
    113         // Ensure assets are loaded (handles all edge cases)
    114         Assets_Manager::get_instance()->ensure_assets_loaded();
     113        // Ensure assets are loaded even used with do_shortcode()
     114        if( !wp_script_is('leanpl-main', 'enqueued') ){
     115            Assets_Manager::get_instance()->load_assets_by_context('frontend');
     116        }
    115117
    116118        // Get all supported attribute keys from attribute_map (for filtering & documentation)
  • az-video-and-audio-player-addon-for-elementor/trunk/plugin-main.php

    r3426299 r3430080  
    44Plugin URI: https://leanplugins.com/
    55Description: Video & Audio player for Elementor, Gutenberg & Classic Editor
    6 Version: 3.0.4
     6Version: 3.0.5
    77Author: LeanPlugins
    88Author URI: https://leanplugins.com/
     
    1919// Both version may have this constant, so check first
    2020if (!defined('LEANPL_VERSION')) {
    21     define('LEANPL_VERSION', '3.0.4');
     21    define('LEANPL_VERSION', '3.0.5');
    2222    define('LEANPL_URI', plugins_url('', __FILE__));
    2323    define('LEANPL_DIR', dirname(__FILE__));
  • az-video-and-audio-player-addon-for-elementor/trunk/readme.txt

    r3426299 r3430080  
    55Tested up to: 6.9
    66Requires PHP: 7.4
    7 Stable tag: 3.0.4
     7Stable tag: 3.0.5
    88License: GPLv2 or later
    99License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    2626* **Per-Player Configuration** - Override global settings for individual players
    2727* **Admin Columns** - View all players at a glance with Player Type, Source Type, Source, Autoplay status, and copy-ready Shortcode
     28* **Preview Player** - Preview your player before publishing directly from the players list or from the player edit page
    2829* **Simple Shortcode** - [lean_player id="123"] to embed anywhere
    2930
     
    9899
    99100== Changelog ==
     101= Version: 3.0.5 =
     102Fixed: Widget does not load in the elementor planel
     103Improved: Assets management, Assets were loading on all pages
     104- Added: Preview Player feature - Preview players directly from the players list or edit page
     105
    100106= Version: 3.0.4 =
    101107- Added: A new filter hook leanpl/metabox/field_config
     
    230236
    231237You can also set Global Player Settings to define default behavior for all players, then override those defaults for individual players as needed.
     238
     239= How do I preview a player before publishing? =
     240
     241You can preview your player in two ways:
     242
     243* **From the Players List**: Click "Preview Player" in the row actions next to any player in the All Players list
     244* **From the Edit Screen**: Use the "Preview Player" button in the publish box when editing a player
     245
     246The preview opens in a new tab, showing only the player without your site's header, footer, or sidebar for a clean preview experience.
    232247
    233248= Does this plugin use any third-party services? =
Note: See TracChangeset for help on using the changeset viewer.