PluginProbe
Download Manager Addons for Elementor / trunk
Download Manager Addons for Elementor vtrunk
trunk 1.0.5 1.2.3 1.2.5 1.3.0
wpdm-elementor / wpdm-elementor.php

wpdm-elementor.php in Download Manager Addons for Elementor trunk, at wpdm-elementor.php

73 lines 1.7 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Plugin Name: WPDM - Elementor
4 * Plugin URI: https://www.wpdownloadmanager.com/download/wpdm-elementor/
5 * Description: Download Manger modules for Elementor
6 * Version: 2.0.2
7 * Author: WordPress Download Manager
8 * Text Domain: wpdm-elementor
9 * Author URI: https://www.wpdownloadmanager.com/
10 * Elementor tested up to: 4.2
11 * Elementor Pro tested up to: 4.2
12 */
13
14 if (!defined('ABSPATH')) {
15 exit;
16 }
17
18 /**
19 * Check for required dependencies
20 */
21 function wpdm_elementor_check_dependencies() {
22 $missing = [];
23
24 if (!did_action('elementor/loaded')) {
25 $missing[] = 'Elementor';
26 }
27
28 if (!function_exists('WPDM')) {
29 $missing[] = 'WordPress Download Manager';
30 }
31
32 return $missing;
33 }
34
35 /**
36 * Display admin notice for missing dependencies
37 */
38 function wpdm_elementor_missing_dependencies_notice() {
39 $missing = wpdm_elementor_check_dependencies();
40 if (empty($missing)) {
41 return;
42 }
43
44 $message = sprintf(
45 '<strong>WPDM - Elementor</strong> requires %s to be installed and activated.',
46 implode(' and ', $missing)
47 );
48
49 printf('<div class="notice notice-error"><p>%s</p></div>', $message);
50 }
51 add_action('admin_notices', 'wpdm_elementor_missing_dependencies_notice');
52
53 /**
54 * Initialize plugin only if dependencies are met
55 */
56 function wpdm_elementor_init() {
57 $missing = wpdm_elementor_check_dependencies();
58 if (!empty($missing)) {
59 return;
60 }
61
62 define("__WPDM_ELEMENTOR__", true);
63
64 // Load constants first
65 require_once __DIR__.'/src/constants.php';
66
67 require_once __DIR__.'/src/api/API.php';
68 require_once __DIR__.'/src/Main.php';
69
70 \WPDM\Elementor\Main::getInstance();
71 }
72 add_action('plugins_loaded', 'wpdm_elementor_init');
73