Changeset 3430080
- Timestamp:
- 12/31/2025 11:16:40 AM (7 weeks ago)
- Location:
- az-video-and-audio-player-addon-for-elementor
- Files:
-
- 2 added
- 42 edited
- 1 copied
-
tags/3.0.5 (copied) (copied from az-video-and-audio-player-addon-for-elementor/trunk)
-
tags/3.0.5/assets/css/admin.css (modified) (1 diff)
-
tags/3.0.5/assets/css/main.css (modified) (3 diffs)
-
tags/3.0.5/assets/js/main.js (modified) (1 diff)
-
tags/3.0.5/includes/admin/class-menu.php (modified) (3 diffs)
-
tags/3.0.5/includes/class-assets-manager.php (modified) (3 diffs)
-
tags/3.0.5/includes/class-base.php (modified) (3 diffs)
-
tags/3.0.5/includes/class-custom-posts.php (modified) (1 diff)
-
tags/3.0.5/includes/class-player-preview.php (added)
-
tags/3.0.5/includes/elementor/class-integration.php (modified) (3 diffs)
-
tags/3.0.5/includes/elementor/widgets/audio-player.php (modified) (1 diff)
-
tags/3.0.5/includes/elementor/widgets/video-player.php (modified) (1 diff)
-
tags/3.0.5/includes/functions.php (modified) (1 diff)
-
tags/3.0.5/includes/libs/lex-settings-new/config/tabs/quick-start.php (modified) (1 diff)
-
tags/3.0.5/includes/libs/lex-settings-new/core/changeslog.txt (modified) (1 diff)
-
tags/3.0.5/includes/libs/lex-settings-new/core/includes/class-assets-manager.php (modified) (1 diff)
-
tags/3.0.5/includes/libs/lex-settings-new/core/partials/settings-page.php (modified) (1 diff)
-
tags/3.0.5/includes/libs/lex-settings-new/core/partials/upgrade-modal.php (modified) (1 diff)
-
tags/3.0.5/includes/shortcodes/class-audio-shortcode.php (modified) (1 diff)
-
tags/3.0.5/includes/shortcodes/class-player-shortcode.php (modified) (2 diffs)
-
tags/3.0.5/includes/shortcodes/class-video-shortcode.php (modified) (1 diff)
-
tags/3.0.5/plugin-main.php (modified) (2 diffs)
-
tags/3.0.5/readme.txt (modified) (4 diffs)
-
trunk/assets/css/admin.css (modified) (1 diff)
-
trunk/assets/css/main.css (modified) (3 diffs)
-
trunk/assets/js/main.js (modified) (1 diff)
-
trunk/includes/admin/class-menu.php (modified) (3 diffs)
-
trunk/includes/class-assets-manager.php (modified) (3 diffs)
-
trunk/includes/class-base.php (modified) (3 diffs)
-
trunk/includes/class-custom-posts.php (modified) (1 diff)
-
trunk/includes/class-player-preview.php (added)
-
trunk/includes/elementor/class-integration.php (modified) (3 diffs)
-
trunk/includes/elementor/widgets/audio-player.php (modified) (1 diff)
-
trunk/includes/elementor/widgets/video-player.php (modified) (1 diff)
-
trunk/includes/functions.php (modified) (1 diff)
-
trunk/includes/libs/lex-settings-new/config/tabs/quick-start.php (modified) (1 diff)
-
trunk/includes/libs/lex-settings-new/core/changeslog.txt (modified) (1 diff)
-
trunk/includes/libs/lex-settings-new/core/includes/class-assets-manager.php (modified) (1 diff)
-
trunk/includes/libs/lex-settings-new/core/partials/settings-page.php (modified) (1 diff)
-
trunk/includes/libs/lex-settings-new/core/partials/upgrade-modal.php (modified) (1 diff)
-
trunk/includes/shortcodes/class-audio-shortcode.php (modified) (1 diff)
-
trunk/includes/shortcodes/class-player-shortcode.php (modified) (2 diffs)
-
trunk/includes/shortcodes/class-video-shortcode.php (modified) (1 diff)
-
trunk/plugin-main.php (modified) (2 diffs)
-
trunk/readme.txt (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
az-video-and-audio-player-addon-for-elementor/tags/3.0.5/assets/css/admin.css
r3417290 r3430080 18 18 /* 1. General Layout & Structure 19 19 ================================================== */ 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 20 40 21 41 .lpl-hire-page{ -
az-video-and-audio-player-addon-for-elementor/tags/3.0.5/assets/css/main.css
r3417290 r3430080 2 2 box-shadow: none; 3 3 } 4 4 5 .plyr--audio .plyr__controls{ 5 6 background: transparent; … … 10 11 color: #fff; 11 12 padding: 15px 0; 13 display: -webkit-box; 14 display: -ms-flexbox; 12 15 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; 15 22 } 16 23 … … 26 33 box-shadow: none; 27 34 } 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 81 81 function isDebugModeEnabled(settings) { 82 82 var playerDebugMode = getBooleanSetting(settings, 'debug_mode', false); 83 var envDebugMode = (typeof l plData !== 'undefined' && lplData.debugMode) || false;83 var envDebugMode = (typeof leanpl_params !== 'undefined' && leanpl_params.debugMode) || false; 84 84 return playerDebugMode || envDebugMode; 85 85 } -
az-video-and-audio-player-addon-for-elementor/tags/3.0.5/includes/admin/class-menu.php
r3424247 r3430080 105 105 'defaults' => $default_settings, // Default settings array 106 106 'version' => LEANPL_VERSION, 107 'dropdown_label' => esc_html__(' LegacyShortcodes', 'vapfem'),107 'dropdown_label' => esc_html__('Shortcodes', 'vapfem'), 108 108 // Use callback instead of allowed_pages - leverages existing leanpl_is_our_admin_page() function 109 109 'page_check_callback' => 'leanpl_is_our_admin_page', … … 231 231 'lean_player-settings-tab', 232 232 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')) 233 242 ); 234 243 … … 327 336 // Update on hash change 328 337 $(window).on('hashchange', updateMenuHighlight); 338 339 // Target the specific upgrade 340 $('.wp-submenu a[href*=\"leanplugins.com\"]').attr('target', '_blank'); 329 341 }); 330 342 "); -
az-video-and-audio-player-addon-for-elementor/tags/3.0.5/includes/class-assets-manager.php
r3417290 r3430080 19 19 private $assets_loaded = false; 20 20 private $late_loading = false; 21 private $loaded = []; 21 22 22 23 /** … … 24 25 * All asset paths, handles, and dependencies defined here 25 26 */ 26 private $asset _definitions = [27 private $assets = [ 27 28 'scripts' => [ 28 29 'plyr' => [ 29 ' path' => '/assets/js/plyr.min.js',30 'file' => '/assets/js/plyr.min.js', 30 31 'deps' => ['jquery'], 31 'footer' => true, 32 'in_footer' => true, 33 'contexts' => ['frontend'], 32 34 ], 33 35 'plyr-polyfilled' => [ 34 ' path' => '/assets/js/plyr.polyfilled.min.js',36 'file' => '/assets/js/plyr.polyfilled.min.js', 35 37 'deps' => ['jquery'], 36 'footer' => true, 38 'in_footer' => true, 39 'contexts' => ['frontend'], 37 40 ], 38 41 'leanpl-main' => [ 39 ' path' => '/assets/js/main.js',42 'file' => '/assets/js/main.js', 40 43 'deps' => ['jquery', 'plyr'], 41 'footer' => true, 44 'in_footer' => true, 45 'contexts' => ['frontend'], 42 46 ], 43 47 'leanpl-admin' => [ 44 ' path' => '/assets/js/admin.js',48 'file' => '/assets/js/admin.js', 45 49 'deps' => ['jquery'], 46 'footer' => true, 50 'in_footer' => true, 51 'contexts' => ['admin'], 47 52 ], 48 53 ], 49 54 'styles' => [ 50 55 'plyr' => [ 51 ' path' => '/assets/css/plyr.css',56 'file' => '/assets/css/plyr.css', 52 57 'deps' => [], 58 'in_footer' => false, 59 'contexts' => ['frontend'], 53 60 ], 54 61 'leanpl-main' => [ 55 ' path' => '/assets/css/main.css',62 'file' => '/assets/css/main.css', 56 63 'deps' => ['plyr'], 64 'in_footer' => false, 65 'contexts' => ['frontend'], 57 66 ], 58 67 'leanpl-editor' => [ 59 ' path' => '/assets/css/editor.css',68 'file' => '/assets/css/editor.css', 60 69 'deps' => [], 70 'in_footer' => false, 71 'contexts' => ['elementor-editor'], 61 72 ], 62 73 'leanpl-admin' => [ 63 ' path' => '/assets/css/admin.css',74 'file' => '/assets/css/admin.css', 64 75 '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 ], 88 79 ], 89 80 ]; … … 101 92 102 93 /** 103 * Initialize - register ALL hooks in one place94 * Initialize the assets manager 104 95 */ 105 96 public function init() { 106 97 $this->version = leanpl_get_version(); 107 98 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 -- 121 104 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; 138 169 } 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; 150 179 } 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 166 182 wp_enqueue_script($handle); 167 183 } 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() { 184 193 if ($this->assets_loaded || is_admin()) { 185 194 return; 186 195 } 187 196 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 ) 194 204 ) { 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'); 371 218 } 372 219 } -
az-video-and-audio-player-addon-for-elementor/tags/3.0.5/includes/class-base.php
r3426299 r3430080 184 184 require_once LEANPL_DIR . '/includes/class-metaboxs-save.php'; 185 185 186 // Load preview class (needed for frontend preview functionality) 187 require_once LEANPL_DIR . '/includes/class-player-preview.php'; 188 186 189 // Load admin files 187 190 if (is_admin()) { … … 191 194 require_once LEANPL_DIR . '/includes/admin/class-player-table-columns.php'; 192 195 } 196 197 // Include Elementor integration 198 require_once LEANPL_DIR . '/includes/elementor/class-integration.php'; 193 199 } 194 200 … … 216 222 */ 217 223 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 } 221 233 } 222 234 -
az-video-and-audio-player-addon-for-elementor/tags/3.0.5/includes/class-custom-posts.php
r3417290 r3430080 56 56 'labels' => $labels, 57 57 'public' => false, // Not publicly accessible 58 'publicly_queryable' => false, // No single pages58 'publicly_queryable' => true, // No single pages (true for preview functionality) 59 59 'show_ui' => true, // Show in admin 60 60 '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 15 15 */ 16 16 class Integration { 17 18 const MINIMUM_ELEMENTOR_VERSION = '2.0.0';19 const MINIMUM_PHP_VERSION = '5.6';20 21 17 private static $instance = null; 22 18 … … 28 24 } 29 25 26 /** 27 * Loading sequence: plugins_loaded -> elementor/loaded -> register_hooks() 28 */ 30 29 private function __construct() { 31 // Check if Elementor is available32 if (!did_action('elementor/loaded')) {33 return;34 }35 36 // Run compatibility checks37 if (!$this->is_compatible()) {38 return;39 }40 41 30 // Register ONLY widget-related hooks 42 31 // Assets handled by Assets_Manager automatically 43 32 $this->register_hooks(); 44 }45 46 private function is_compatible() {47 // Check Elementor version48 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 version55 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;61 33 } 62 34 … … 75 47 $widgets_manager->register(new \LeanPL_Audio_Player()); 76 48 } 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_VERSION88 );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_VERSION103 );104 105 printf('<div class="notice notice-warning is-dismissible"><p>%1$s</p></div>', wp_kses_post($message));106 }107 49 } -
az-video-and-audio-player-addon-for-elementor/tags/3.0.5/includes/elementor/widgets/audio-player.php
r3417290 r3430080 19 19 public function get_categories() { 20 20 return array( 'general' ); 21 } 22 23 public function get_style_depends() { 24 return [ 25 'plyr', 26 'leanpl-main' 27 ]; 21 28 } 22 29 -
az-video-and-audio-player-addon-for-elementor/tags/3.0.5/includes/elementor/widgets/video-player.php
r3417290 r3430080 19 19 public function get_categories() { 20 20 return array( 'general' ); 21 } 22 23 public function get_style_depends() { 24 return [ 25 'plyr', 26 'leanpl-main' 27 ]; 21 28 } 22 29 -
az-video-and-audio-player-addon-for-elementor/tags/3.0.5/includes/functions.php
r3426299 r3430080 596 596 } 597 597 } 598 599 /** 600 * Get upgrade URL 601 * 602 * @return string Upgrade URL 603 */ 604 function 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 82 82 83 83 <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> 85 85 <p><strong><?php echo esc_html__('Good for:', 'vapfem'); ?></strong> <?php echo esc_html__('Quick embed or programmatic use', 'vapfem'); ?></p> 86 86 <ul> -
az-video-and-audio-player-addon-for-elementor/tags/3.0.5/includes/libs/lex-settings-new/core/changeslog.txt
r3426299 r3430080 1 31 Dec 2025 2 - Moved upgrade modal markup to assets manager 3 1 4 22 Dec 2025 2 5 - 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 50 50 */ 51 51 private function registerHooks() { 52 add_action('admin_footer', [$this, 'renderUpgradeModal']); 52 53 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 } 53 66 } 54 67 -
az-video-and-audio-player-addon-for-elementor/tags/3.0.5/includes/libs/lex-settings-new/core/partials/settings-page.php
r3417290 r3430080 145 145 </aside> 146 146 </div> 147 148 <?php149 // Include upgrade modal150 $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 87 87 88 88 <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"> 90 90 <?php echo esc_html__('View Pricing & Upgrade', 'lex-settings'); ?> 91 91 </a> -
az-video-and-audio-player-addon-for-elementor/tags/3.0.5/includes/shortcodes/class-audio-shortcode.php
r3426299 r3430080 99 99 } 100 100 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 } 103 105 104 106 // 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 66 66 */ 67 67 public function render_player_shortcode($atts, $content = null) { 68 global $wp_scripts; 69 68 70 if (is_admin() && !leanpl_is_elementor_editor()) { 69 71 // Don't render in admin area except in Elementor editor … … 71 73 } 72 74 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 } 75 79 76 80 // 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 111 111 } 112 112 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 } 115 117 116 118 // 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 4 4 Plugin URI: https://leanplugins.com/ 5 5 Description: Video & Audio player for Elementor, Gutenberg & Classic Editor 6 Version: 3.0. 46 Version: 3.0.5 7 7 Author: LeanPlugins 8 8 Author URI: https://leanplugins.com/ … … 19 19 // Both version may have this constant, so check first 20 20 if (!defined('LEANPL_VERSION')) { 21 define('LEANPL_VERSION', '3.0. 4');21 define('LEANPL_VERSION', '3.0.5'); 22 22 define('LEANPL_URI', plugins_url('', __FILE__)); 23 23 define('LEANPL_DIR', dirname(__FILE__)); -
az-video-and-audio-player-addon-for-elementor/tags/3.0.5/readme.txt
r3426299 r3430080 5 5 Tested up to: 6.9 6 6 Requires PHP: 7.4 7 Stable tag: 3.0. 47 Stable tag: 3.0.5 8 8 License: GPLv2 or later 9 9 License URI: http://www.gnu.org/licenses/gpl-2.0.html … … 26 26 * **Per-Player Configuration** - Override global settings for individual players 27 27 * **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 28 29 * **Simple Shortcode** - [lean_player id="123"] to embed anywhere 29 30 … … 98 99 99 100 == Changelog == 101 = Version: 3.0.5 = 102 Fixed: Widget does not load in the elementor planel 103 Improved: Assets management, Assets were loading on all pages 104 - Added: Preview Player feature - Preview players directly from the players list or edit page 105 100 106 = Version: 3.0.4 = 101 107 - Added: A new filter hook leanpl/metabox/field_config … … 230 236 231 237 You 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 241 You 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 246 The preview opens in a new tab, showing only the player without your site's header, footer, or sidebar for a clean preview experience. 232 247 233 248 = Does this plugin use any third-party services? = -
az-video-and-audio-player-addon-for-elementor/trunk/assets/css/admin.css
r3417290 r3430080 18 18 /* 1. General Layout & Structure 19 19 ================================================== */ 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 20 40 21 41 .lpl-hire-page{ -
az-video-and-audio-player-addon-for-elementor/trunk/assets/css/main.css
r3417290 r3430080 2 2 box-shadow: none; 3 3 } 4 4 5 .plyr--audio .plyr__controls{ 5 6 background: transparent; … … 10 11 color: #fff; 11 12 padding: 15px 0; 13 display: -webkit-box; 14 display: -ms-flexbox; 12 15 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; 15 22 } 16 23 … … 26 33 box-shadow: none; 27 34 } 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 81 81 function isDebugModeEnabled(settings) { 82 82 var playerDebugMode = getBooleanSetting(settings, 'debug_mode', false); 83 var envDebugMode = (typeof l plData !== 'undefined' && lplData.debugMode) || false;83 var envDebugMode = (typeof leanpl_params !== 'undefined' && leanpl_params.debugMode) || false; 84 84 return playerDebugMode || envDebugMode; 85 85 } -
az-video-and-audio-player-addon-for-elementor/trunk/includes/admin/class-menu.php
r3424247 r3430080 105 105 'defaults' => $default_settings, // Default settings array 106 106 'version' => LEANPL_VERSION, 107 'dropdown_label' => esc_html__(' LegacyShortcodes', 'vapfem'),107 'dropdown_label' => esc_html__('Shortcodes', 'vapfem'), 108 108 // Use callback instead of allowed_pages - leverages existing leanpl_is_our_admin_page() function 109 109 'page_check_callback' => 'leanpl_is_our_admin_page', … … 231 231 'lean_player-settings-tab', 232 232 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')) 233 242 ); 234 243 … … 327 336 // Update on hash change 328 337 $(window).on('hashchange', updateMenuHighlight); 338 339 // Target the specific upgrade 340 $('.wp-submenu a[href*=\"leanplugins.com\"]').attr('target', '_blank'); 329 341 }); 330 342 "); -
az-video-and-audio-player-addon-for-elementor/trunk/includes/class-assets-manager.php
r3417290 r3430080 19 19 private $assets_loaded = false; 20 20 private $late_loading = false; 21 private $loaded = []; 21 22 22 23 /** … … 24 25 * All asset paths, handles, and dependencies defined here 25 26 */ 26 private $asset _definitions = [27 private $assets = [ 27 28 'scripts' => [ 28 29 'plyr' => [ 29 ' path' => '/assets/js/plyr.min.js',30 'file' => '/assets/js/plyr.min.js', 30 31 'deps' => ['jquery'], 31 'footer' => true, 32 'in_footer' => true, 33 'contexts' => ['frontend'], 32 34 ], 33 35 'plyr-polyfilled' => [ 34 ' path' => '/assets/js/plyr.polyfilled.min.js',36 'file' => '/assets/js/plyr.polyfilled.min.js', 35 37 'deps' => ['jquery'], 36 'footer' => true, 38 'in_footer' => true, 39 'contexts' => ['frontend'], 37 40 ], 38 41 'leanpl-main' => [ 39 ' path' => '/assets/js/main.js',42 'file' => '/assets/js/main.js', 40 43 'deps' => ['jquery', 'plyr'], 41 'footer' => true, 44 'in_footer' => true, 45 'contexts' => ['frontend'], 42 46 ], 43 47 'leanpl-admin' => [ 44 ' path' => '/assets/js/admin.js',48 'file' => '/assets/js/admin.js', 45 49 'deps' => ['jquery'], 46 'footer' => true, 50 'in_footer' => true, 51 'contexts' => ['admin'], 47 52 ], 48 53 ], 49 54 'styles' => [ 50 55 'plyr' => [ 51 ' path' => '/assets/css/plyr.css',56 'file' => '/assets/css/plyr.css', 52 57 'deps' => [], 58 'in_footer' => false, 59 'contexts' => ['frontend'], 53 60 ], 54 61 'leanpl-main' => [ 55 ' path' => '/assets/css/main.css',62 'file' => '/assets/css/main.css', 56 63 'deps' => ['plyr'], 64 'in_footer' => false, 65 'contexts' => ['frontend'], 57 66 ], 58 67 'leanpl-editor' => [ 59 ' path' => '/assets/css/editor.css',68 'file' => '/assets/css/editor.css', 60 69 'deps' => [], 70 'in_footer' => false, 71 'contexts' => ['elementor-editor'], 61 72 ], 62 73 'leanpl-admin' => [ 63 ' path' => '/assets/css/admin.css',74 'file' => '/assets/css/admin.css', 64 75 '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 ], 88 79 ], 89 80 ]; … … 101 92 102 93 /** 103 * Initialize - register ALL hooks in one place94 * Initialize the assets manager 104 95 */ 105 96 public function init() { 106 97 $this->version = leanpl_get_version(); 107 98 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 -- 121 104 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; 138 169 } 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; 150 179 } 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 166 182 wp_enqueue_script($handle); 167 183 } 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() { 184 193 if ($this->assets_loaded || is_admin()) { 185 194 return; 186 195 } 187 196 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 ) 194 204 ) { 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'); 371 218 } 372 219 } -
az-video-and-audio-player-addon-for-elementor/trunk/includes/class-base.php
r3426299 r3430080 184 184 require_once LEANPL_DIR . '/includes/class-metaboxs-save.php'; 185 185 186 // Load preview class (needed for frontend preview functionality) 187 require_once LEANPL_DIR . '/includes/class-player-preview.php'; 188 186 189 // Load admin files 187 190 if (is_admin()) { … … 191 194 require_once LEANPL_DIR . '/includes/admin/class-player-table-columns.php'; 192 195 } 196 197 // Include Elementor integration 198 require_once LEANPL_DIR . '/includes/elementor/class-integration.php'; 193 199 } 194 200 … … 216 222 */ 217 223 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 } 221 233 } 222 234 -
az-video-and-audio-player-addon-for-elementor/trunk/includes/class-custom-posts.php
r3417290 r3430080 56 56 'labels' => $labels, 57 57 'public' => false, // Not publicly accessible 58 'publicly_queryable' => false, // No single pages58 'publicly_queryable' => true, // No single pages (true for preview functionality) 59 59 'show_ui' => true, // Show in admin 60 60 'show_in_menu' => false, // Show in admin menu -
az-video-and-audio-player-addon-for-elementor/trunk/includes/elementor/class-integration.php
r3417290 r3430080 15 15 */ 16 16 class Integration { 17 18 const MINIMUM_ELEMENTOR_VERSION = '2.0.0';19 const MINIMUM_PHP_VERSION = '5.6';20 21 17 private static $instance = null; 22 18 … … 28 24 } 29 25 26 /** 27 * Loading sequence: plugins_loaded -> elementor/loaded -> register_hooks() 28 */ 30 29 private function __construct() { 31 // Check if Elementor is available32 if (!did_action('elementor/loaded')) {33 return;34 }35 36 // Run compatibility checks37 if (!$this->is_compatible()) {38 return;39 }40 41 30 // Register ONLY widget-related hooks 42 31 // Assets handled by Assets_Manager automatically 43 32 $this->register_hooks(); 44 }45 46 private function is_compatible() {47 // Check Elementor version48 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 version55 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;61 33 } 62 34 … … 75 47 $widgets_manager->register(new \LeanPL_Audio_Player()); 76 48 } 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_VERSION88 );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_VERSION103 );104 105 printf('<div class="notice notice-warning is-dismissible"><p>%1$s</p></div>', wp_kses_post($message));106 }107 49 } -
az-video-and-audio-player-addon-for-elementor/trunk/includes/elementor/widgets/audio-player.php
r3417290 r3430080 19 19 public function get_categories() { 20 20 return array( 'general' ); 21 } 22 23 public function get_style_depends() { 24 return [ 25 'plyr', 26 'leanpl-main' 27 ]; 21 28 } 22 29 -
az-video-and-audio-player-addon-for-elementor/trunk/includes/elementor/widgets/video-player.php
r3417290 r3430080 19 19 public function get_categories() { 20 20 return array( 'general' ); 21 } 22 23 public function get_style_depends() { 24 return [ 25 'plyr', 26 'leanpl-main' 27 ]; 21 28 } 22 29 -
az-video-and-audio-player-addon-for-elementor/trunk/includes/functions.php
r3426299 r3430080 596 596 } 597 597 } 598 599 /** 600 * Get upgrade URL 601 * 602 * @return string Upgrade URL 603 */ 604 function 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 82 82 83 83 <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> 85 85 <p><strong><?php echo esc_html__('Good for:', 'vapfem'); ?></strong> <?php echo esc_html__('Quick embed or programmatic use', 'vapfem'); ?></p> 86 86 <ul> -
az-video-and-audio-player-addon-for-elementor/trunk/includes/libs/lex-settings-new/core/changeslog.txt
r3426299 r3430080 1 31 Dec 2025 2 - Moved upgrade modal markup to assets manager 3 1 4 22 Dec 2025 2 5 - 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 50 50 */ 51 51 private function registerHooks() { 52 add_action('admin_footer', [$this, 'renderUpgradeModal']); 52 53 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 } 53 66 } 54 67 -
az-video-and-audio-player-addon-for-elementor/trunk/includes/libs/lex-settings-new/core/partials/settings-page.php
r3417290 r3430080 145 145 </aside> 146 146 </div> 147 148 <?php149 // Include upgrade modal150 $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 87 87 88 88 <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"> 90 90 <?php echo esc_html__('View Pricing & Upgrade', 'lex-settings'); ?> 91 91 </a> -
az-video-and-audio-player-addon-for-elementor/trunk/includes/shortcodes/class-audio-shortcode.php
r3426299 r3430080 99 99 } 100 100 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 } 103 105 104 106 // 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 66 66 */ 67 67 public function render_player_shortcode($atts, $content = null) { 68 global $wp_scripts; 69 68 70 if (is_admin() && !leanpl_is_elementor_editor()) { 69 71 // Don't render in admin area except in Elementor editor … … 71 73 } 72 74 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 } 75 79 76 80 // Get post ID from attributes -
az-video-and-audio-player-addon-for-elementor/trunk/includes/shortcodes/class-video-shortcode.php
r3426299 r3430080 111 111 } 112 112 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 } 115 117 116 118 // 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 4 4 Plugin URI: https://leanplugins.com/ 5 5 Description: Video & Audio player for Elementor, Gutenberg & Classic Editor 6 Version: 3.0. 46 Version: 3.0.5 7 7 Author: LeanPlugins 8 8 Author URI: https://leanplugins.com/ … … 19 19 // Both version may have this constant, so check first 20 20 if (!defined('LEANPL_VERSION')) { 21 define('LEANPL_VERSION', '3.0. 4');21 define('LEANPL_VERSION', '3.0.5'); 22 22 define('LEANPL_URI', plugins_url('', __FILE__)); 23 23 define('LEANPL_DIR', dirname(__FILE__)); -
az-video-and-audio-player-addon-for-elementor/trunk/readme.txt
r3426299 r3430080 5 5 Tested up to: 6.9 6 6 Requires PHP: 7.4 7 Stable tag: 3.0. 47 Stable tag: 3.0.5 8 8 License: GPLv2 or later 9 9 License URI: http://www.gnu.org/licenses/gpl-2.0.html … … 26 26 * **Per-Player Configuration** - Override global settings for individual players 27 27 * **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 28 29 * **Simple Shortcode** - [lean_player id="123"] to embed anywhere 29 30 … … 98 99 99 100 == Changelog == 101 = Version: 3.0.5 = 102 Fixed: Widget does not load in the elementor planel 103 Improved: Assets management, Assets were loading on all pages 104 - Added: Preview Player feature - Preview players directly from the players list or edit page 105 100 106 = Version: 3.0.4 = 101 107 - Added: A new filter hook leanpl/metabox/field_config … … 230 236 231 237 You 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 241 You 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 246 The preview opens in a new tab, showing only the player without your site's header, footer, or sidebar for a clean preview experience. 232 247 233 248 = Does this plugin use any third-party services? =
Note: See TracChangeset
for help on using the changeset viewer.