-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpattern-wrangler.php
112 lines (96 loc) · 2.27 KB
/
pattern-wrangler.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
<?php
/**
* Plugin Name: Pattern Wrangler
* Plugin URI: https://dlxplugins.com/plugins/pattern-wrangler/
* Description: Manage your block patterns.
* Version: 1.2.0
* Requires at least: 6.5
* Requires PHP: 7.2
* Author: DLX Plugins
* Author URI: https://dlxplugins.com
* License: GPL v2 or later
* License URI: https://www.gnu.org/licenses/gpl-2.0.html
* Text Domain: pattern-wrangler
* Domain Path: /languages
*
* @package PatternWrangler
*/
namespace DLXPlugins\PatternWrangler;
define( 'DLXPW_PATTERN_WRANGLER_VERSION', '1.2.0' );
define( 'DLXPW_PATTERN_WRANGLER_FILE', __FILE__ );
// Support for site-level autoloading.
if ( file_exists( __DIR__ . '/lib/autoload.php' ) ) {
require_once __DIR__ . '/lib/autoload.php';
}
/**
* PatternWrangler class.
*/
class PatternWrangler {
/**
* Holds the class instance.
*
* @var PatternWrangler $instance
*/
private static $instance = null;
/**
* Return an instance of the class
*
* Return an instance of the ReflectorDLX Class.
*
* @since 1.0.0
*
* @return PatternWrangler class instance.
*/
public static function get_instance() {
if ( null === self::$instance ) {
self::$instance = new self();
}
return self::$instance;
}
/**
* Class initializer.
*/
public function plugins_loaded() {
load_plugin_textdomain(
'pattern-wrangler',
false,
basename( __DIR__ ) . '/languages'
);
$admin = new Admin();
$admin->run();
$patterns = new Patterns();
$patterns->run();
$drafts = new Drafts();
$drafts->run();
$preview = new Preview();
$preview->run();
// Determine if blocks can run or not.
$options = Options::get_options();
$can_disable_blocks = (bool) $options['disablePatternImporterBlock'];
if ( ! $can_disable_blocks ) {
$blocks = new Blocks();
$blocks->run();
}
/**
* When PatternWrangler can be extended.
*
* Filter when PatternWrangler can be extended.
*
* @since 1.0.0
*/
do_action( 'dlxplugins_pw_loaded' );
}
/**
* Init all the things.
*/
public function init() {
// Nothing here yet.
}
}
add_action(
'plugins_loaded',
function () {
$pattern_wrangler = PatternWrangler::get_instance();
$pattern_wrangler->plugins_loaded();
}
);