-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathsmart-docs.php
More file actions
100 lines (91 loc) · 2.73 KB
/
smart-docs.php
File metadata and controls
100 lines (91 loc) · 2.73 KB
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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
<?php
/**
* Plugin Name: Smart Docs
* Plugin URI: https://wpsmartdocs.com/
* Description: Knowledge Base and Documentation plugin for WordPress.
* Author: IdeaBox Creations
* Author URI: https://ideabox.io/
* Version: 1.1.0
* License: GNU General Public License v3.0
* License URI: http://www.gnu.org/licenses/gpl-3.0.html
* Text Domain: smart-docs
*
* @package SmartDocs
*/
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly.
}
define( 'SMART_DOCS_VERSION', '1.1.0' );
define( 'SMART_DOCS_PATH', plugin_dir_path( __FILE__ ) );
define( 'SMART_DOCS_URL', plugin_dir_url( __FILE__ ) );
define( 'SMART_DOCS_FILE', __FILE__ );
add_action( 'plugins_loaded', 'smartdocs_load_plugin_textdomain' );
/**
* Check for the Compatibility.
*/
if ( ! version_compare( PHP_VERSION, '7.3', '>=' ) ) {
/**
* Display admin notice for PHP version less than 7.3.
*
* @since 1.0.0
*/
add_action( 'admin_notices', 'smartdocs_notice_php_version' );
} elseif ( ! version_compare( get_bloginfo( 'version' ), '5.0', '>=' ) ) {
/**
* Display admin notice for WordPress version less than 5.0
*
* @since 1.0.0
*/
add_action( 'admin_notices', 'smartdocs_notice_wp_version' );
} else {
/**
* Load the plugin.php file to run the plugin.
*
* @since 1.0.0
*/
require SMART_DOCS_PATH . 'classes/plugin.php';
}
/**
* Load SmartDocs textdomain.
*
* Load gettext translate for SmartDocs text domain.
*
* @since 1.0.0
*
* @return void
*/
function smartdocs_load_plugin_textdomain() {
load_plugin_textdomain( 'smart-docs', false, basename( dirname( __FILE__ ) ) . '/languages/' );
}
/**
* Shows Admin Notice for PHP compatibility.
*
* Function is used when the installed PHP is incompatible with the plugin to
* show an Admin Notice informing the user that the PHP version is incompatible
* with the plugin.
*
* @since 1.0.0
*
* @return void
*/
function smartdocs_notice_php_version() {
/* translators: %s: PHP version */
$message = sprintf( esc_html__( 'SmartDocs requires PHP version %s+, plugin is currently NOT RUNNING.', 'smart-docs' ), '7.3' );
$html_message = sprintf( '<div class="error">%s</div>', wpautop( $message ) );
echo wp_kses_post( $html_message );
}
/**
* Shows admin notice for minimum WordPress version.
*
* Warning when the site doesn't have the minimum required WordPress version.
*
* @since 1.0.0
*
* @return void
*/
function smartdocs_notice_wp_version() {
/* translators: %s: WordPress version */
$message = sprintf( esc_html__( 'SmartDocs requires WordPress version %s+. Because you are using an earlier version, the plugin is currently NOT RUNNING.', 'smart-docs' ), '5.0' );
$html_message = sprintf( '<div class="error">%s</div>', wpautop( $message ) );
echo wp_kses_post( $html_message );
}