-
Notifications
You must be signed in to change notification settings - Fork 16
Expand file tree
/
Copy pathGutesObjectPlugin.php
More file actions
executable file
·60 lines (45 loc) · 1.35 KB
/
GutesObjectPlugin.php
File metadata and controls
executable file
·60 lines (45 loc) · 1.35 KB
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
/*
* @wordpress-plugin
* Plugin Name: Gutenberg Object Plugin
* Description: Saves Gutenberg data as array into DB & adds API to access it
* Version: 2.0.2
* Author: Roy Sivan
* Author URI: https://roysivan.com
* License: GPL-3.0+
* License URI: http://www.gnu.org/licenses/gpl-3.0.txt
* Textdomain: gutes-array
*/
namespace GutesObjectPlugin;
if ( file_exists( __DIR__ . '/vendor/autoload.php' ) ) {
require_once 'vendor/autoload.php';
}
require_once 'src/Helpers.php';
use GutesObjectPlugin\Scripts;
use GutesObjectPlugin\Database;
use GutesObjectPlugin\API;
use GutesObjectPlugin\Hooks;
class GutesObjectPlugin {
public static $GutesObjectPluginUrl;
public static $GutesObjectPluginFile;
private $database;
private $api;
private $hooks;
public function __construct( Database $database, API $api, Hooks $hooks ) {
$this->database = $database;
$this->api = $api;
$this->hooks = $hooks;
}
public function run() {
self::$GutesObjectPluginFile = __FILE__;
self::$GutesObjectPluginUrl = plugin_dir_url( __FILE__ );
}
}
// construction of plugin
$scripts = new Scripts();
$api = new API();
$hooks = new Hooks( $api );
$database = new Database();
$gutenbergObjectPlugin = new GutesObjectPlugin( $database, $api, $hooks );
$gutenbergObjectPlugin->run();
$database->create();