forked from BoldGrid/post-and-page-builder
-
Notifications
You must be signed in to change notification settings - Fork 0
/
post-and-page-builder.php
90 lines (72 loc) · 2.9 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
<?php
/**
* Plugin Name: Post and Page Builder
* Plugin URI: https://www.boldgrid.com/boldgrid-editor/
* 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.7.4
* Author: BoldGrid <[email protected]>
* Author URI: https://www.boldgrid.com/
* 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 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.' ) ) {
// Prevent invalid PHP version from loading.
require BOLDGRID_PPB_PATH . '/includes/version-check.php';
// 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' ) );
register_uninstall_hook( __FILE__, array( 'Boldgrid_Editor_Uninstall', 'on_delete' ) );
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();
}
function boldgrid_editor_deactivate() {
deactivate_plugins( array( 'boldgrid-editor/boldgrid-editor.php' ), true );
}
// 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' );
}
}