forked from dievardump/wp-bladeone-plugin
-
Notifications
You must be signed in to change notification settings - Fork 0
/
wp-bladeone.php
75 lines (63 loc) · 1.62 KB
/
wp-bladeone.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
<?php
/**
* WP Blade(One)
*
* @package WP_Blade(One)
* @copyright Copyright(c) 2020, dievardump
* @license http://opensource.org/licenses/GPL-2.0 GNU General Public License, version 2 (GPL-2.0)
*
* Plugin Name: WP Blade(One)
* Plugin URI: https://github.com/dievardump/wp-bladeone-plugin
* Description: Blade(One) syntaxing in wordpress themes
* Version: 0.0.1
* Author: dievardump
* Author URI: https://github.com/dievardump
* License: GPL2
* License URI: http://www.gnu.org/licenses/gpl-2.0.html
* Text Domain: wp-bladeone-plugin
* Domain Path: languages
*/
// Exit if accessed directly.
if (! defined('ABSPATH')) {
exit;
}
// composer deps
if (is_readable(__DIR__ . '/vendor/autoload.php')) {
require __DIR__ . '/vendor/autoload.php';
}
/**
* Get the plugin object.
*
* @return \WP_BladeOne\Plugin
*/
function wp_bladeone()
{
static $instance;
if (null === $instance) {
$instance = new \WP_BladeOne\Plugin();
}
return $instance;
}
/**
* Alias to wp_bladeone
*/
function wp_blade()
{
return wp_bladeone();
}
if (!defined('WP_BLADEONE_VIEWS')) {
define('WP_BLADEONE_VIEWS', get_stylesheet_directory());
}
if (!defined('WP_BLADEONE_CACHE')) {
define('WP_BLADEONE_CACHE', WP_CONTENT_DIR . '/cache/.wp-bladeone-cache');
}
if (!file_exists(WP_BLADEONE_CACHE)) {
wp_mkdir_p(WP_BLADEONE_CACHE);
}
if (!defined('WP_BLADEONE_MODE')) {
define('WP_BLADEONE_MODE', \eftec\bladeone\BladeOne::MODE_AUTO);
}
$blade = new \eftec\bladeone\BladeOne(WP_BLADEONE_VIEWS, WP_BLADEONE_CACHE, WP_BLADEONE_MODE);
wp_bladeone()
->setCompiler($blade);
require __DIR__ . '/php/hooks.php';