-
Notifications
You must be signed in to change notification settings - Fork 0
/
cbxchangelog.php
128 lines (103 loc) · 3.82 KB
/
cbxchangelog.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
<?php
/**
* The plugin bootstrap file
*
* This file is read by WordPress to generate the plugin information in the plugin
* admin area. This file also includes all of the dependencies used by the plugin,
* registers the activation and deactivation functions, and defines a function
* that starts the plugin.
*
* @link http://codeboxr.com
* @since 1.0.0
* @package Cbxchangelog
*
* @wordpress-plugin
* Plugin Name: CBX Changelog
* Plugin URI: http://codeboxr.com/product/cbx-changelog-for-wordpress/
* Description: Easy change log manager for WordPress, use for any product post type or releases notes
* Version: 1.1.6
* Author: Codeboxr
* Author URI: http://codeboxr.com
* License: GPL-2.0+
* License URI: http://www.gnu.org/licenses/gpl-2.0.txt
* Text Domain: cbxchangelog
* Domain Path: /languages
*/
// If this file is called directly, abort.
if ( ! defined( 'WPINC' ) ) {
die;
}
defined( 'CBXCHANGELOG_PLUGIN_NAME' ) or define( 'CBXCHANGELOG_PLUGIN_NAME', 'cbxchangelog' );
defined( 'CBXCHANGELOG_PLUGIN_VERSION' ) or define( 'CBXCHANGELOG_PLUGIN_VERSION', '1.1.6' );
defined( 'CBXCHANGELOG_ROOT_PATH' ) or define( 'CBXCHANGELOG_ROOT_PATH', plugin_dir_path( __FILE__ ) );
defined( 'CBXCHANGELOG_ROOT_URL' ) or define( 'CBXCHANGELOG_ROOT_URL', plugin_dir_url( __FILE__ ) );
defined( 'CBXCHANGELOG_BASE_NAME' ) or define( 'CBXCHANGELOG_BASE_NAME', plugin_basename( __FILE__ ) );
/**
* Checking wp version
*
* @return bool
*/
function cbxchangelog_compatible_wp_version() {
if ( version_compare( $GLOBALS['wp_version'], '5.3', '<' ) ) {
return false;
}
// Add sanity checks for other version requirements here
return true;
}//end method cbxchangelog_compatible_wp_version
/**
* Checking php version
*
* @return bool
*/
function cbxchangelog_compatible_php_version() {
if ( version_compare( PHP_VERSION, '7.4', '<=' ) ) {
return false;
}
return true;
}//end method cbxchangelog_compatible_php_version
/**
* The code that runs during plugin activation.
* This action is documented in includes/class-cbxchangelog-activator.php
*/
function activate_cbxchangelog() {
if ( ! cbxchangelog_compatible_wp_version() ) {
deactivate_plugins( plugin_basename( __FILE__ ) );
wp_die( esc_html__( 'CBX Changelog plugin requires WordPress 3.5 or higher!', 'cbxchangelog' ) );
}
if ( ! cbxchangelog_compatible_php_version() ) {
deactivate_plugins( plugin_basename( __FILE__ ) );
wp_die( esc_html__( 'CBX Changelog plugin requires PHP 7.4 or higher!', 'cbxchangelog' ) );
}
//register_uninstall_hook( __FILE__, 'uninstall_cbxchangelog' );
//now it's safe to move forward
require_once plugin_dir_path( __FILE__ ) . 'includes/CBXChangelogActivator.php';
CBXChangelogActivator::activate();
}//end method activate_cbxchangelog
/**
* The code that runs during plugin deactivation.
* This action is documented in includes/class-cbxchangelog-deactivator.php
*/
function deactivate_cbxchangelog() {
require_once plugin_dir_path( __FILE__ ) . 'includes/CBXChangelogDeactivator.php';
CBXChangelogDeactivator::deactivate();
}//end method deactivate_cbxchangelog
register_activation_hook( __FILE__, 'activate_cbxchangelog' );
register_deactivation_hook( __FILE__, 'deactivate_cbxchangelog' );
/**
* The core plugin class that is used to define internationalization,
* admin-specific hooks, and public-facing site hooks.
*/
require plugin_dir_path( __FILE__ ) . 'includes/CBXChangelog.php';
/**
* Begins execution of the plugin.
*
* Since everything within the plugin is registered via hooks,
* then kicking off the plugin from this point in the file does
* not affect the page life cycle.
*
* @since 1.0.0
*/
function run_cbxchangelog() {
return Cbxchangelog::instance();
}
$GLOBALS['cbxchangelog_core'] = run_cbxchangelog();