forked from humanmade/modular-page-builder
-
Notifications
You must be signed in to change notification settings - Fork 0
/
modular-page-builder.php
60 lines (50 loc) · 2.16 KB
/
modular-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
<?php
/**
* Plugin Name: Modular Page Builder
* Plugin URI: https://github.com/humanmade/modular-page-builder
* Description: Customisable and extensible modular page builder for WordPress with REST API support
* Version: 0.1
* Author: Human Made Limited
* Author URI: http://hmn.md
* License: GPL v2 or later
*
* Originally built for UsTwo.com.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*/
namespace ModularPageBuilder;
use WP_CLI;
define( __NAMESPACE__ . '\\PLUGIN_URL', plugins_url( null, __FILE__ ) );
define( __NAMESPACE__ . '\\PLUGIN_DIR', __DIR__ );
require __DIR__ . '/inc/class-plugin.php';
require __DIR__ . '/inc/class-builder.php';
require __DIR__ . '/inc/class-builder-post-meta.php';
require __DIR__ . '/inc/modules/class-module.php';
require __DIR__ . '/inc/modules/class-header.php';
require __DIR__ . '/inc/modules/class-text.php';
require __DIR__ . '/inc/modules/class-image.php';
require __DIR__ . '/inc/modules/class-blockquote.php';
add_action( 'init', function() {
$plugin = Plugin::get_instance();
$plugin->register_module( 'header', __NAMESPACE__ . '\Modules\Header' );
$plugin->register_module( 'text', __NAMESPACE__ . '\Modules\Text' );
$plugin->register_module( 'image', __NAMESPACE__ . '\Modules\Image' );
$plugin->register_module( 'blockquote', __NAMESPACE__ . '\Modules\Blockquote' );
$plugin->register_builder_post_meta( 'modular-page-builder', array(
'title' => __( 'Page Body Content' ),
'api_prop' => 'page_builder',
'allowed_modules' => array( 'header', 'text', 'image', 'video', 'blockquote', ),
) );
}, 100 );
if ( defined( 'WP_CLI' ) && WP_CLI ) {
require __DIR__ . '/inc/class-wp-cli.php';
WP_CLI::add_command( 'modular-page-builder', __NAMESPACE__ . '\\CLI' );
}