-
Notifications
You must be signed in to change notification settings - Fork 1
/
vip-workflow.php
85 lines (73 loc) · 3.16 KB
/
vip-workflow.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
<?php
/**
* Plugin Name: WordPress VIP Workflow
* Plugin URI: https://github.com/Automattic/vip-workflow-plugin
* Description: Adding additional editorial workflow capabilities to WordPress.
* Author: WordPress VIP
* Text Domain: vip-workflow
* Version: 0.4.0
* Requires at least: 6.4
* Requires PHP: 8.1
* License: GPL-3
* License URI: https://www.gnu.org/licenses/gpl-3.0.html
*
* @package vip-workflow
*/
namespace VIPWorkflow;
if ( defined( 'VIP_WORKFLOW_LOADED' ) ) {
return;
}
define( 'VIP_WORKFLOW_LOADED', true );
global $wp_version;
if ( version_compare( phpversion(), '8.1', '<' ) || version_compare( $wp_version, '6.4', '<' ) ) {
wp_admin_notice( esc_html( 'VIP Workflow requires PHP 8.1+ and WordPress 6.4+.', 'vip-workflow' ), [
'type' => 'error',
'dismissible' => true,
] );
return;
}
// Define contants
define( 'VIP_WORKFLOW_VERSION', '0.4.0' );
define( 'VIP_WORKFLOW_ROOT', __DIR__ );
define( 'VIP_WORKFLOW_URL', plugins_url( '/', __FILE__ ) );
define( 'VIP_WORKFLOW_SETTINGS_PAGE', add_query_arg( 'page', 'vw-settings', get_admin_url( null, 'admin.php' ) ) );
define( 'VIP_WORKFLOW_REST_NAMESPACE', 'vip-workflow/v1' );
// Set the version for the plugin.
// It's not used for anything, which is why it's here.
// This should not rely on any other code in the plugin.
add_action( 'admin_init', function () {
$previous_version = get_option( 'vip_workflow_version' );
if ( $previous_version && version_compare( $previous_version, VIP_WORKFLOW_VERSION, '<' ) ) {
/**
* Fires when the plugin is upgraded
*
* @param string $previous_version The previous version of the plugin
* @param string $new_version The new version of the plugin
*/
do_action( 'vw_upgrade_version', $previous_version, VIP_WORKFLOW_VERSION );
update_option( 'vip_workflow_version', VIP_WORKFLOW_VERSION );
} elseif ( ! $previous_version ) {
update_option( 'vip_workflow_version', VIP_WORKFLOW_VERSION );
}
} );
// Utility classes
require_once VIP_WORKFLOW_ROOT . '/modules/shared/php/helper-utilities.php';
require_once VIP_WORKFLOW_ROOT . '/modules/shared/php/install-utilities.php';
require_once VIP_WORKFLOW_ROOT . '/modules/shared/php/options-utilities.php';
require_once VIP_WORKFLOW_ROOT . '/modules/shared/php/meta-cleanup-utilities.php';
require_once VIP_WORKFLOW_ROOT . '/modules/shared/php/util.php';
require_once VIP_WORKFLOW_ROOT . '/modules/shared/php/core-hacks.php';
require_once VIP_WORKFLOW_ROOT . '/modules/shared/php/log-level-enum.php';
require_once VIP_WORKFLOW_ROOT . '/modules/shared/php/logging-utility.php';
// Modules - Telemetry
if ( class_exists( '\Automattic\VIP\Telemetry\Tracks' ) ) {
// Telemetry is only initialized if the Telemetry library is available on VIP's platform
require_once VIP_WORKFLOW_ROOT . '/modules/telemetry/telemetry.php';
}
// Modules - Settings
require_once VIP_WORKFLOW_ROOT . '/modules/settings/settings.php';
// Other modules
require_once VIP_WORKFLOW_ROOT . '/modules/custom-status/custom-status.php';
require_once VIP_WORKFLOW_ROOT . '/modules/editorial-metadata/editorial-metadata.php';
require_once VIP_WORKFLOW_ROOT . '/modules/notifications/notifications.php';
require_once VIP_WORKFLOW_ROOT . '/modules/preview/preview.php';