-
Notifications
You must be signed in to change notification settings - Fork 3
/
webman-amplifier.php
172 lines (111 loc) · 4.24 KB
/
webman-amplifier.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
161
162
163
164
165
166
167
168
169
170
171
172
<?php
/**
* Plugin Name: WebMan Amplifier
* Plugin URI: https://github.com/webmandesign/webman-amplifier/
* Description: Pack of additional WordPress features. Contains additional custom post types, shortcodes, page builder integration, meta box generator and icon font management.
* Version: 1.5.11
* Author: WebMan Design, Oliver Juhas
* Author URI: https://www.webmandesign.eu/
* License: GPL-3.0-or-later
* License URI: http://www.gnu.org/licenses/gpl-3.0.txt
* Text Domain: webman-amplifier
* Domain Path: /languages
*
* Requires PHP: 7.0
* Requires at least: 6.0
*
* @copyright WebMan Design, Oliver Juhas
* @license GPL-3.0, https://www.gnu.org/licenses/gpl-3.0.html
*
* @link https://www.webmandesign.eu
*
* @package WebMan Amplifier
*/
// Exit if accessed directly
if ( ! defined( 'ABSPATH' ) ) exit;
/**
* Constants
*/
// Define global constants
// Plugin version
if ( ! defined( 'WMAMP_VERSION' ) ) define( 'WMAMP_VERSION', '1.5.10' );
// Paths
if ( ! defined( 'WMAMP_PLUGIN_FILE' ) ) define( 'WMAMP_PLUGIN_FILE', __FILE__ );
if ( ! defined( 'WMAMP_PLUGIN_DIR' ) ) define( 'WMAMP_PLUGIN_DIR', plugin_dir_path( __FILE__ ) );
if ( ! defined( 'WMAMP_PLUGIN_URL' ) ) define( 'WMAMP_PLUGIN_URL', plugin_dir_url( __FILE__ ) );
if ( ! defined( 'WMAMP_INCLUDES_DIR' ) ) define( 'WMAMP_INCLUDES_DIR', trailingslashit( WMAMP_PLUGIN_DIR ) . 'includes/' );
if ( ! defined( 'WMAMP_INCLUDES_URL' ) ) define( 'WMAMP_INCLUDES_URL', trailingslashit( WMAMP_PLUGIN_URL ) . 'includes/' );
if ( ! defined( 'WMAMP_ASSETS_DIR' ) ) define( 'WMAMP_ASSETS_DIR', trailingslashit( WMAMP_PLUGIN_DIR ) . 'assets/' );
if ( ! defined( 'WMAMP_ASSETS_URL' ) ) define( 'WMAMP_ASSETS_URL', trailingslashit( WMAMP_PLUGIN_URL ) . 'assets/' );
// Variables
if ( ! defined( 'WMAMP_COLOR_BRIGHTNESS_TRESHOLD' ) ) define( 'WMAMP_COLOR_BRIGHTNESS_TRESHOLD', 127 );
// Define Metabox class constants
if ( ! defined( 'WM_METABOX_FIELD_PREFIX' ) ) define( 'WM_METABOX_FIELD_PREFIX', 'wm-' );
if ( ! defined( 'WM_METABOX_SERIALIZED_NAME' ) ) define( 'WM_METABOX_SERIALIZED_NAME', '_' . WM_METABOX_FIELD_PREFIX . 'meta' );
if ( ! defined( 'WM_METABOX_LABEL_HTML' ) ) define( 'WM_METABOX_LABEL_HTML', '<a><br><code><em><img><small><strong>' );
/**
* Required files
*/
// Load the main plugin class
require_once WMAMP_PLUGIN_DIR . 'class-wm-amplifier.php';
// Load helper functions
require_once WMAMP_INCLUDES_DIR . 'functions.php';
// Load 3rd party plugins compatibility
require_once WMAMP_INCLUDES_DIR . 'compatibility/compatibility.php';
/**
* Functions
*/
/**
* The main function responsible for returning the plugin instance
* to functions everywhere.
*
* Use this function like you would a global variable, except without
* needing to declare the global.
*
* Example: <?php $wmamp = wm_amplifier(); ?>
*
* @since 1.0
* @version 1.2.2
*
* @return WebMan Amplifier instance
*/
function wma_amplifier() {
// Output
return WM_Amplifier::instance();
} // /wma_amplifier
/**
* Plugin activation
*
* @since 1.0
* @version 1.2.2
*/
function wma_amplifier_activate() {
// Processing
do_action( 'wmhook_wmamp_' . 'plugin_activation' );
} // /wma_amplifier_activate
register_activation_hook( WMAMP_PLUGIN_FILE, 'wma_amplifier_activate' );
/**
* Plugin deactivation
*
* @since 1.0.5
* @version 1.2.2
*/
function wma_amplifier_deactivate() {
// Processing
do_action( 'wmhook_wmamp_' . 'plugin_deactivation' );
} // /wma_amplifier_deactivate
register_deactivation_hook( WMAMP_PLUGIN_FILE, 'wma_amplifier_deactivate' );
/**
* Hook WebMan Amplifier early onto the 'plugins_loaded' action.
*
* This gives all other plugins the chance to load before WebMan Amplifier, to get
* their actions, filters, and overrides setup without WebMan Amplifier being in the way.
*
* @since 1.0
* @version 1.2.2
*/
if ( defined( 'WMAMP_LATE_LOAD' ) ) {
add_action( 'plugins_loaded', 'wma_amplifier', (int) WMAMP_LATE_LOAD );
} else {
wma_amplifier();
}