-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathhelppress.php
160 lines (139 loc) · 4.12 KB
/
helppress.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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
<?php
/**
* Plugin Name: HelpPress
* Description: A powerful and easy-to-use knowledge base plugin for WordPress, compatible with 99% of themes.
* Version: 3.1.3
* Author: Galen Gidman
* Author URI: https://galengidman.com/
* License: GPL2+
* Text Domain: helppress
*/
if (! defined('ABSPATH')) {
exit;
}
/**
* Add item to the container.
*
* @since 3.1.0
* @param string $key Key to access item.
* @param mixed $value Value to add to the container.
*/
function helppress_set($key, $value) {
$GLOBALS['helppress'][$key] = $value;
}
/**
* Get item from the container.
*
* @since 3.1.0
*
* @param string $key Key to access item.
* @return mixed Item from container.
*/
function helppress_get($key) {
return $GLOBALS['helppress'][$key];
}
if (! class_exists('HelpPress_Plugin')) :
/**
* Plugin class
*
* @since 2.0.0
*/
final class HelpPress_Plugin {
/**
* Constructor.
*
* @access public
* @since 2.0.0
*/
public function __construct() {
$this->constants();
if (version_compare(PHP_VERSION, HELPPRESS_MIN_PHP, '<')) {
add_action('admin_notices', [$this, 'fail_php_version']);
} elseif (version_compare(get_bloginfo('version'), HELPPRESS_MIN_WP, '<')) {
add_action('admin_notices', [$this, 'fail_wp_version']);
} else {
$this->includes();
add_action('plugins_loaded', [$this, 'load_textdomain']);
}
}
/**
* Define constants.
*
* @access protected
* @since 3.0.0
*/
protected function constants() {
define('HELPPRESS_VERSION', '3.1.3');
define('HELPPRESS_FILE', __FILE__);
define('HELPPRESS_PATH', plugin_dir_path(HELPPRESS_FILE));
define('HELPPRESS_URL', plugin_dir_url(HELPPRESS_FILE));
define('HELPPRESS_BASENAME', plugin_basename(HELPPRESS_FILE));
define('HELPPRESS_MIN_PHP', '5.4');
define('HELPPRESS_MIN_WP', '4.5');
}
/**
* Define constants.
*
* @access protected
* @since 3.0.0
*/
protected function includes() {
require_once HELPPRESS_PATH . 'includes/vendor/cmb2/cmb2/init.php';
require_once HELPPRESS_PATH . 'includes/vendor/gamajo/template-loader/class-gamajo-template-loader.php';
require_once HELPPRESS_PATH . 'includes/vendor/yahnis-elsts/admin-notices/AdminNotice.php';
require_once HELPPRESS_PATH . 'includes/class-helppress-breadcrumb.php';
require_once HELPPRESS_PATH . 'includes/class-helppress-demo-content.php';
require_once HELPPRESS_PATH . 'includes/class-helppress-menu-archive-link.php';
require_once HELPPRESS_PATH . 'includes/class-helppress-search.php';
require_once HELPPRESS_PATH . 'includes/class-helppress-settings.php';
require_once HELPPRESS_PATH . 'includes/class-helppress-template-loader.php';
require_once HELPPRESS_PATH . 'includes/class-helppress-theme-compat.php';
require_once HELPPRESS_PATH . 'includes/assets.php';
require_once HELPPRESS_PATH . 'includes/deprecated-functions.php';
require_once HELPPRESS_PATH . 'includes/options-functions.php';
require_once HELPPRESS_PATH . 'includes/post-types.php';
require_once HELPPRESS_PATH . 'includes/install.php';
require_once HELPPRESS_PATH . 'includes/sanitization-functions.php';
require_once HELPPRESS_PATH . 'includes/template-functions.php';
require_once HELPPRESS_PATH . 'includes/upgrade.php';
}
/**
* Load textdomain.
*
* @access public
* @since 3.0.0
*/
public function load_textdomain() {
load_plugin_textdomain('helppress');
}
/**
* Check for compatible PHP version.
*
* @access public
* @since 3.0.0
*/
public function fail_php_version() {
$message = sprintf(
esc_html__('HelpPress requires PHP version %s+, plugin is currently NOT ACTIVE.', 'helppress'),
HELPPRESS_MIN_PHP
);
$message = sprintf('<div class="error">%s</div>', wpautop($message));
echo wp_kses_post($message);
}
/**
* Check for compatible WordPress version.
*
* @access public
* @since 3.0.0
*/
public function fail_wp_version() {
$message = sprintf(
esc_html__('HelpPress requires WordPress version %s+, plugin is currently NOT ACTIVE.', 'helppress'),
HELPPRESS_MIN_WP
);
$message = sprintf('<div class="error">%s</div>', wpautop($message));
echo wp_kses_post($message);
}
}
endif;
helppress_set('plugin', new HelpPress_Plugin());