-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patheledocs.php
82 lines (70 loc) · 1.77 KB
/
eledocs.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
<?php
/*
Plugin Name: EleDocs
Plugin URI: https://w4dev.com/
Description: Use Elementor Pro to modify WeDocs frontend.
Version: 1.0.0
Author: Shazzad Hossain Khan
Author URI: https://shazzad.me/
License: GPL2
Text Domain: eledocs
Domain Path: /languages
*/
// Don't call the file directly.
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
// Defined this file as plugin base file.
if ( ! defined( 'ELEDOCS_PLUGIN_FILE' ) ) {
define( 'ELEDOCS_PLUGIN_FILE', __FILE__ );
}
// Load dependencies.
require_once __DIR__ . '/vendor/autoload.php';
/**
* Get Plugin Instance.
*
* @return \EleDocs
*/
function eledocs() {
return \EleDocs\Plugin::init();
}
/**
* Show in WP Dashboard notice about wedocs requirement.
*
* @return void
*/
function eledocs_notice_missing_wedocs() {
if ( ! current_user_can( 'install_plugins' ) ) {
return;
}
echo '<div class="error"><p>' . __( 'EleDocs is not working because you need to activate the WeDocs plugin.', 'eledocs' ) . '</p></div>';
}
/**
* Show in WP Dashboard notice about elementor pro requirement.
*
* @return void
*/
function eledocs_notice_missing_elementor_pro() {
if ( ! current_user_can( 'install_plugins' ) ) {
return;
}
echo '<div class="error"><p>' . __( 'EleDocs is not working because you need to activate the Elementor Pro plugin.', 'eledocs' ) . '</p></div>';
}
/**
* Kickoff the plugin or display admin notice if dependencies unavailable.
*
* @return void
*/
function eledocs_load_plugin() {
if ( ! defined( 'WEDOCS_VERSION' ) ) {
add_action( 'admin_notices', 'eledocs_notice_missing_wedocs' );
return;
}
if ( ! defined( 'ELEMENTOR_PRO_VERSION' ) ) {
add_action( 'admin_notices', 'eledocs_notice_missing_elementor_pro' );
return;
}
// Kick.
eledocs();
}
add_action( 'plugins_loaded', 'eledocs_load_plugin' );