-
Notifications
You must be signed in to change notification settings - Fork 9
/
easy-code-manager.php
74 lines (59 loc) · 1.99 KB
/
easy-code-manager.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
<?php
/**
* Plugin Name: Fluent Snippets
* Plugin URI: https://fluentsnippets.com
* Description: Super Fast File Based Native Code Snippets (header / footer codes) Manager for WordPress
* Author: Fluent Snippets
* Author URI: https://fluentsnippets.com
* License: GPL-2.0-or-later
* License URI: https://www.gnu.org/licenses/gpl-2.0.html
* Text Domain: easy-code-manager
* Version: 10.34
* Requires PHP: 7.3
* Requires at least: 6.0
* Domain Path: /language
*/
// Exit if accessed directly.
if (!defined('ABSPATH')) {
return;
}
if (defined('FLUENT_SNIPPETS_PLUGIN_PATH')) {
return;
}
define('FLUENT_SNIPPETS_PLUGIN_PATH', plugin_dir_path(__FILE__));
define('FLUENT_SNIPPETS_PLUGIN_URL', plugin_dir_url(__FILE__));
define('FLUENT_SNIPPETS_PLUGIN_VERSION', '10.34');
class FluentCodeSnippetsBoot
{
public function boot()
{
$this->autoLoad();
add_action('init', function () {
load_plugin_textdomain('easy-code-manager', false, 'fluent-snippets/language');
});
}
private function autoLoad()
{
spl_autoload_register(function ($class) {
$match = 'FluentSnippets';
if (!preg_match("/\b{$match}\b/", $class)) {
return;
}
$path = plugin_dir_path(__FILE__);
$file = str_replace(
['FluentSnippets', '\\', '/App/'],
['', DIRECTORY_SEPARATOR, 'app/'],
$class
);
require(trailingslashit($path) . trim($file, '/') . '.php');
});
add_action('plugins_loaded', function () {
add_action('rest_api_init', function () {
require_once FLUENT_SNIPPETS_PLUGIN_PATH . 'app/Http/routes.php';
});
});
require_once FLUENT_SNIPPETS_PLUGIN_PATH . 'app/Hooks/hooks.php';
register_deactivation_hook(__FILE__, [\FluentSnippets\App\Helpers\Helper::class, 'handleDeactivate']);
}
}
(new FluentCodeSnippetsBoot())->boot();