-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathpost-and-page-builder.php
127 lines (102 loc) · 3.94 KB
/
post-and-page-builder.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
<?php
/**
* Plugin Name: Post and Page Builder
* Plugin URI: https://www.boldgrid.com/boldgrid-editor/?utm_source=ppb-wp-repo&utm_medium=plugin-uri&utm_campaign=ppb
* Description: Customized drag and drop editing for posts and pages. The Post and Page Builder adds functionality to the existing TinyMCE Editor to give you easier control over your content.
* Version: 1.27.7
* Author: BoldGrid <[email protected]>
* Author URI: https://www.boldgrid.com/?utm_source=ppb-wp-repo&utm_medium=author-uri&utm_campaign=ppb
* Text Domain: boldgrid-editor
* Domain Path: /languages
* License: GPLv2 or later
*/
// Prevent direct calls.
if ( ! defined( 'WPINC' ) ) {
die();
}
// Define Editor version.
if ( ! defined( 'BOLDGRID_EDITOR_VERSION' ) ) {
define( 'BOLDGRID_EDITOR_VERSION', implode( get_file_data( __FILE__, array( 'Version' ), 'plugin' ) ) );
}
// Define boldgrid-backup key.
if ( ! defined( 'BOLDGRID_EDITOR_KEY' ) ) {
define( 'BOLDGRID_EDITOR_KEY', 'bgppb' );
}
// Define Editor path.
if ( ! defined( 'BOLDGRID_EDITOR_PATH' ) ) {
define( 'BOLDGRID_EDITOR_PATH', dirname( __FILE__ ) );
}
// Define temporary path for migration.
if ( ! defined( 'BOLDGRID_PPB_PATH' ) ) {
define( 'BOLDGRID_PPB_PATH', dirname( __FILE__ ) );
}
// Define Editor entry.
if ( ! defined( 'BOLDGRID_EDITOR_ENTRY' ) ) {
define( 'BOLDGRID_EDITOR_ENTRY', __FILE__ );
}
// Define Editor configuration directory.
if ( ! defined( 'BOLDGRID_EDITOR_CONFIGDIR' ) ) {
define( 'BOLDGRID_EDITOR_CONFIGDIR', BOLDGRID_EDITOR_PATH . '/includes/config' );
}
/**
* Initialize the editor plugin for Editors and Administrators in the admin section.
*/
if ( ! function_exists( 'boldgrid_editor_setup' ) && false === strpos( BOLDGRID_EDITOR_VERSION, '1.6.0.' ) ) {
// BEFORE LOADING CHECK - WP & PHP Versions.
require_once BOLDGRID_EDITOR_PATH . '/includes/class-boldgrid-editor-compatibility.php';
$compatibility = new Boldgrid_Editor_Compatibility( array(
'wp' => '4.7',
'php' => '5.4',
) );
if ( ! $compatibility->checkVersions() ) {
return;
}
// BEFORE LOADING CHECK - Build Files exist.
require_once BOLDGRID_EDITOR_PATH . '/includes/class-boldgrid-editor-development.php';
$development = new Boldgrid_Editor_Development();
if ( ! $development->checkValidBuild() ) {
return;
}
// Load the editor class.
require_once BOLDGRID_EDITOR_PATH . '/includes/class-boldgrid-editor.php';
register_activation_hook( __FILE__, array( 'Boldgrid_Editor_Activate', 'on_activate' ) );
register_activation_hook( __FILE__, 'boldgrid_editor_deactivate' );
register_deactivation_hook( __FILE__, array( 'Boldgrid_Editor_Activate', 'on_deactivate' ) );
add_action( 'activate_boldgrid-editor/boldgrid-editor.php',
array( 'Boldgrid_Editor_Activate', 'block_activate' ) );
function boldgrid_editor_setup () {
Boldgrid_Editor_Service::register(
'main',
new Boldgrid_Editor()
);
Boldgrid_Editor_Service::get( 'main' )->run();
}
$autoload = require plugin_dir_path( __FILE__ ) . 'vendor/autoload.php';
// Load Library.
new \Boldgrid\Library\Util\Load(
array(
'type' => 'plugin',
'file' => plugin_basename( __FILE__ ),
'loader' => $autoload,
'keyValidate' => true,
'licenseActivate' => false,
)
);
function boldgrid_editor_deactivate() {
deactivate_plugins( array( 'boldgrid-editor/boldgrid-editor.php' ), true );
}
if ( ! class_exists( 'Boldgrid_Editor_Upgrade' ) ) {
require_once BOLDGRID_PPB_PATH . '/includes/class-boldgrid-editor-upgrade.php';
}
// Plugin update checks.
$upgrade = new Boldgrid_Editor_Upgrade();
add_action( 'upgrader_process_complete', array( $upgrade, 'plugin_update_check' ), 10, 2 );
$theme = new Boldgrid_Editor_Theme();
add_filter( 'boldgrid_theme_framework_config', array( $theme, 'BGTFW_config_filters' ) );
// Load on an early hook so we can tie into framework configs.
if ( is_admin() ) {
add_action( 'init', 'boldgrid_editor_setup' );
} else {
add_action( 'setup_theme', 'boldgrid_editor_setup' );
}
}