Repository navigation
Expand file tree
/
Copy pathphp_mustache.cpp
More file actions
117 lines (99 loc) · 3.58 KB
/
Copy pathphp_mustache.cpp
File metadata and controls
117 lines (99 loc) · 3.58 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
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
113
114
115
116
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <string>
#include <php.h>
#include <php_ini.h>
#include <ext/standard/info.h>
#include "php_mustache.h"
#include "mustache_ast.hpp"
#include "mustache_exceptions.hpp"
#include "mustache_mustache.hpp"
#include "mustache_data.hpp"
#include "mustache_template.hpp"
#include "mustache_lambda_helper.hpp"
/* {{{ prototypes */
ZEND_DECLARE_MODULE_GLOBALS(mustache)
/* }}} */
/* {{{ php.ini directive registration */
PHP_INI_BEGIN()
STD_PHP_INI_BOOLEAN((char *) "mustache.default_escape", (char *) "1", PHP_INI_ALL, OnUpdateBool, default_escape_by_default, zend_mustache_globals, mustache_globals)
STD_PHP_INI_ENTRY((char *) "mustache.default_start", (char *) "{{", PHP_INI_ALL, OnUpdateString, default_start_sequence, zend_mustache_globals, mustache_globals)
STD_PHP_INI_ENTRY((char *) "mustache.default_stop", (char *) "}}", PHP_INI_ALL, OnUpdateString, default_stop_sequence, zend_mustache_globals, mustache_globals)
PHP_INI_END()
/* }}} */
/* {{{ PHP_MINIT_FUNCTION */
static PHP_MINIT_FUNCTION(mustache)
{
REGISTER_INI_ENTRIES();
PHP_MINIT(mustache_ast)(INIT_FUNC_ARGS_PASSTHRU);
PHP_MINIT(mustache_mustache)(INIT_FUNC_ARGS_PASSTHRU);
PHP_MINIT(mustache_data)(INIT_FUNC_ARGS_PASSTHRU);
PHP_MINIT(mustache_template)(INIT_FUNC_ARGS_PASSTHRU);
PHP_MINIT(mustache_exceptions)(INIT_FUNC_ARGS_PASSTHRU);
PHP_MINIT(mustache_lambda_helper)(INIT_FUNC_ARGS_PASSTHRU);
return SUCCESS;
}
/* }}} */
/* {{{ PHP_MSHUTDOWN_FUNCTION */
static PHP_MSHUTDOWN_FUNCTION(mustache)
{
UNREGISTER_INI_ENTRIES();
return SUCCESS;
}
/* }}} */
/* {{{ PHP_MINFO_FUNCTION */
const char *PHP_MUSTACHE_MOTD =
"Think not that I am come to send peace on earth: I came not to send peace, but a sword. Matthew 10:34";
static PHP_MINFO_FUNCTION(mustache)
{
php_info_print_table_start();
php_info_print_table_row(2, "Version", PHP_MUSTACHE_VERSION);
php_info_print_table_row(2, "Released", PHP_MUSTACHE_RELEASE);
php_info_print_table_row(2, "Revision", PHP_MUSTACHE_BUILD);
php_info_print_table_row(2, "Authors", PHP_MUSTACHE_AUTHORS);
php_info_print_table_row(2, "Spec Version", PHP_MUSTACHE_SPEC);
php_info_print_table_row(2, "Libmustache Version", mustache_version());
#if MUSTACHE_HAVE_CXX11
php_info_print_table_row(2, "c++11 unordered map support", "enabled");
#else
php_info_print_table_row(2, "c++11 unordered map support", "disabled");
#endif
php_info_print_table_end();
DISPLAY_INI_ENTRIES();
php_info_print_box_start(0);
PUTS(PHP_MUSTACHE_MOTD);
php_info_print_box_end();
}
/* }}} */
/* {{{ PHP_GINIT_FUNCTION */
static PHP_GINIT_FUNCTION(mustache)
{
mustache_globals->default_escape_by_default = 1;
mustache_globals->default_start_sequence = (char *) "{{";
mustache_globals->default_stop_sequence = (char *) "}}";
}
/* }}} */
/* {{{ mustache_module_entry */
zend_module_entry mustache_module_entry = {
STANDARD_MODULE_HEADER,
(char *) PHP_MUSTACHE_NAME, /* Name */
NULL, /* Functions */
PHP_MINIT(mustache), /* MINIT */
PHP_MSHUTDOWN(mustache), /* MSHUTDOWN */
NULL, /* RINIT */
NULL, /* RSHUTDOWN */
PHP_MINFO(mustache), /* MINFO */
(char *) PHP_MUSTACHE_VERSION, /* Version */
PHP_MODULE_GLOBALS(mustache), /* Globals */
PHP_GINIT(mustache), /* GINIT */
NULL,
NULL,
0, 0, NULL, 0, (char *) ZEND_MODULE_BUILD_ID /* STANDARD_MODULE_PROPERTIES_EX */
};
/* }}} */
#ifdef COMPILE_DL_MUSTACHE
extern "C" {
ZEND_GET_MODULE(mustache) // Common for all PHP extensions which are build as shared modules
}
#endif