|
1
|
|
|
<?php |
|
2
|
|
|
/** |
|
3
|
|
|
* Plugin Name: Stencil: Smarty 3.x Implementation |
|
4
|
|
|
* Plugin URI: https://github.com/moorscode/stencil/ |
|
5
|
|
|
* Description: Smarty 3 Stencil Implementation. This plugin enables the use of Smarty 3 in your theme. This implementation requires the plugin "Stencil" to be installed and active. |
|
6
|
|
|
* Version: 1.0.1 |
|
7
|
|
|
* Author: Jip Moors (moorscode) |
|
8
|
|
|
* Author URI: http://www.jipmoors.nl |
|
9
|
|
|
* Text Domain: stencil |
|
10
|
|
|
* License: GPL2 |
|
11
|
|
|
* |
|
12
|
|
|
* Stencil - Smarty 3.x addon is free software: you can redistribute it |
|
13
|
|
|
* and/or modify it under the terms of the GNU General Public License |
|
14
|
|
|
* as published by the Free Software Foundation, either version 2 of the |
|
15
|
|
|
* License, or any later version. |
|
16
|
|
|
* |
|
17
|
|
|
* Stencil - Smarty 3.x addon is distributed in the hope that it will |
|
18
|
|
|
* be useful, but WITHOUT ANY WARRANTY; without even the implied warranty |
|
19
|
|
|
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
20
|
|
|
* General Public License for more details. |
|
21
|
|
|
* |
|
22
|
|
|
* You should have received a copy of the GNU General Public License |
|
23
|
|
|
* along with Stencil - Smarty 3.x addon. |
|
24
|
|
|
* If not, see http://www.gnu.org/licenses/gpl-2.0.html. |
|
25
|
|
|
* |
|
26
|
|
|
* @package Stencil |
|
27
|
|
|
* @subpackage Smarty3 |
|
28
|
|
|
*/ |
|
29
|
|
|
|
|
30
|
|
|
if ( ! function_exists( 'add_filter' ) ) { |
|
31
|
|
|
header( 'Status: 403 Forbidden' ); |
|
32
|
|
|
header( 'HTTP/1.1 403 Forbidden' ); |
|
33
|
|
|
exit(); |
|
34
|
|
|
} |
|
35
|
|
|
|
|
36
|
|
|
if ( ! function_exists( '__stencil_smarty3_register' ) ): |
|
37
|
|
|
|
|
38
|
|
|
include( 'stencil-dependency.php' ); |
|
39
|
|
|
|
|
40
|
|
|
add_filter( 'stencil:register-engine', '__stencil_smarty3_register' ); |
|
41
|
|
|
|
|
42
|
|
|
/** |
|
43
|
|
|
* Register this implementation to Stencil |
|
44
|
|
|
* |
|
45
|
|
|
* @param array $engines Currently registered engines. |
|
46
|
|
|
* |
|
47
|
|
|
* @return array |
|
48
|
|
|
*/ |
|
49
|
|
|
function __stencil_smarty3_register( $engines ) { |
|
50
|
|
|
$engine = 'Smarty 3.x'; |
|
51
|
|
|
$engines[] = $engine; |
|
52
|
|
|
|
|
53
|
|
|
add_action( 'stencil.activate-' . $engine, '__stencil_smarty3_activate' ); |
|
54
|
|
|
|
|
55
|
|
|
return $engines; |
|
56
|
|
|
} |
|
57
|
|
|
|
|
58
|
|
|
/** |
|
59
|
|
|
* On activation, include engine file. |
|
60
|
|
|
*/ |
|
61
|
|
|
function __stencil_smarty3_activate() { |
|
62
|
|
|
include_once( 'stencil-engine.php' ); |
|
63
|
|
|
} |
|
64
|
|
|
|
|
65
|
|
|
/** |
|
66
|
|
|
* Load plugin textdomain |
|
67
|
|
|
*/ |
|
68
|
|
|
add_action( |
|
69
|
|
|
'plugins_loaded', |
|
70
|
|
|
create_function( |
|
|
|
|
|
|
71
|
|
|
'', |
|
72
|
|
|
"load_plugin_textdomain( 'stencil', false, dirname( plugin_basename( __FILE__ ) ) . '/languages' );" |
|
73
|
|
|
) |
|
74
|
|
|
); |
|
75
|
|
|
|
|
76
|
|
|
endif; |
create_functioncan pose a great security vulnerability as it is similar toeval, and could be used for arbitrary code execution. We highly recommend to use a closure instead.