-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathconcat.c
More file actions
640 lines (530 loc) · 19 KB
/
concat.c
File metadata and controls
640 lines (530 loc) · 19 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
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
/*
+-------------------------------------------------------------------------+
| PHP Version 5 |
+-------------------------------------------------------------------------+
| Copyright (c) 1997-2011 The PHP Group |
+-------------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
| http://www.php.net/license/3_01.txt |
| If you did not receive a copy of the PHP license and are unable to |
| obtain it through the world-wide-web, please send a note to |
| license@php.net so we can mail you a copy immediately. |
+-------------------------------------------------------------------------+
| License: http://concat.concat.com.cn/LICENSE |
| Author: Yong.Teng <webmaster@concat.com> |
| Copyright @ 2013-2014 Concat.com Inc. |
+-------------------------------------------------------------------------+
*/
/* $Id: concat.c 310447 2011-06-18 00:04:23 Yong.Teng $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
/* include php file */
#include "Zend/zend.h"
#include "Zend/zend_API.h"
#include "Zend/zend_modules.h"
#include "Zend/zend_exceptions.h"
#include "main/php.h"
#include "main/php_main.h"
#include "main/SAPI.h"
#include "ext/standard/info.h"
#include "ext/standard/php_smart_str_public.h"
#include "ext/standard/php_smart_str.h"
#include "ext/spl/spl_exceptions.h"
/* include concat file */
#include "php_concat.h"
/* PHP versions lower than 5.3.0 are not compatible or are causing tests to FAIL */
#if ((PHP_MAJOR_VERSION < 5)||(PHP_MAJOR_VERSION == 5&&PHP_MINOR_VERSION < 3))
#error PHP 5.3.0 or newer is required. Please upgrade your php version.
#endif
ZEND_DECLARE_MODULE_GLOBALS(concat)
zend_class_entry *concat_ce;
/* {{{ arginfo */
ZEND_BEGIN_ARG_INFO_EX(concat_setEnable_arguments, FALSE, FALSE, 1)
ZEND_ARG_INFO(FALSE, enable)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(concat_setPrefix_arguments, FALSE, FALSE, 1)
ZEND_ARG_INFO(FALSE, prefix)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(concat_setDelimiter_arguments, FALSE, FALSE, 1)
ZEND_ARG_INFO(FALSE, delimiter)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(concat_setVersionPrefix_arguments, FALSE, FALSE, 1)
ZEND_ARG_INFO(FALSE, versionPrefix)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(concat_setVersion_arguments, FALSE, FALSE, 1)
ZEND_ARG_INFO(FALSE, version)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(concat_setMaxFiles_arguments, FALSE, FALSE, 1)
ZEND_ARG_INFO(FALSE, maxFiles)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(concat_css_arguments, FALSE, FALSE, 1)
ZEND_ARG_INFO(FALSE, baseUrl)
ZEND_ARG_INFO(FALSE, ...)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(concat_javascript_arguments, FALSE, FALSE, 1)
ZEND_ARG_INFO(FALSE, baseUrl)
ZEND_ARG_INFO(FALSE, ...)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(concat_js_arguments, FALSE, FALSE, 1)
ZEND_ARG_INFO(FALSE, baseUrl)
ZEND_ARG_INFO(FALSE, ...)
ZEND_END_ARG_INFO()
/* }}} */
CONCAT_API int concat_convert_object_to_string_ex(zend_class_entry *ce, zval *object, zend_bool show_error TSRMLS_DC){
#if PHP_VERSION_ID >= 50400
const zend_object_handlers *handlers = Z_OBJ_HT_P(object);
#else
zend_object_handlers *handlers = Z_OBJ_HT_P(object);
#endif
if(ce->__tostring&&handlers->cast_object){
zval dst;
if(handlers->cast_object(object, &dst, IS_STRING TSRMLS_CC) == FAILURE){
if(show_error == TRUE){
smart_str message = {0};
zval *exception = NULL;
smart_str_appendl(&message, "Object of class ", sizeof("Object of class ") - 1);
smart_str_appendl(&message, ce->name, ce->name_length);
smart_str_appendl(&message, " could not be converted to string.", sizeof(" could not be converted to string.") - 1);
smart_str_0(&message);
exception = zend_throw_error_exception(spl_ce_UnexpectedValueException, message.c, 0, E_CORE_WARNING TSRMLS_CC);
smart_str_free(&message);
concat_zval_ptr_dtor(exception);
}
}else{
zval_dtor(object);
Z_TYPE_P(object) = IS_STRING;
object->value = dst.value;
return SUCCESS;
}
}else{
if(handlers->get){
zval *newobject = handlers->get(object TSRMLS_CC);
if(Z_TYPE_P(newobject) != IS_OBJECT){
/* for safety - avoid loop */
zval_dtor(object);
*object = *newobject;
FREE_ZVAL(object);
convert_to_string(object);
return SUCCESS;
}
}
}
return FAILURE;
}
CONCAT_API char *concat_object_valueof(zval *data, size_t *result_length TSRMLS_DC){
switch(Z_TYPE_P(data)){
case IS_STRING:
*result_length = Z_STRLEN_P(data);
return estrndup(Z_STRVAL_P(data), Z_STRLEN_P(data));
break;
case IS_NULL:
*result_length = 4;
return estrndup("NULL", 4);
break;
case IS_BOOL:
if(Z_BVAL_P(data) == TRUE){
*result_length = 4;
return estrndup("true", 4);
}else{
*result_length = 5;
return estrndup("false", 5);
}
break;
case IS_OBJECT: {
zend_class_entry *ce = Z_OBJCE_P(data);
if(concat_convert_object_to_string_ex(ce, data, TRUE TSRMLS_CC) == SUCCESS){
if(Z_TYPE_P(data) == IS_STRING){
*result_length = Z_STRLEN_P(data);
return Z_STRVAL_P(data);
}
}
ce = zend_get_class_entry(data TSRMLS_CC);
*result_length = ce->name_length;
return estrndup(ce->name, ce->name_length);
}
break;
case IS_ARRAY: {
zval *exception = zend_throw_error_exception(spl_ce_UnexpectedValueException, "Array could not be converted to string", 0, E_CORE_WARNING TSRMLS_CC);
concat_zval_ptr_dtor(exception);
*result_length = 5;
return estrndup("Array", 5);
}
break;
default: {
zval str = *data;
zval_copy_ctor(&str);
convert_to_string(&str);
*result_length = Z_STRLEN(str);
return Z_STRVAL(str);
}
break;
}
*result_length = 0;
return estrndup("", 0);
}
CONCAT_API zend_bool concat_isBlank_ex(const char *str, uint str_length TSRMLS_DC){
if(str != NULL&&str_length != 0){
const char *p = str;
const char *end = str + str_length;
while(p < end){
if(memchr(" \t\r\n\013\014", *p++, sizeof(" \t\r\n\013\014") - 1) == NULL){
return FALSE;
}
}
}
return TRUE;
}
static ZEND_INI_MH(OnUpdatePrefix){
zval *exception = NULL;
if(new_value == NULL||new_value_length == 0){
exception = zend_throw_error_exception(spl_ce_RuntimeException, "concat.prefix could not be empty", 0, E_CORE_WARNING TSRMLS_CC);
goto failure;
}
if(concat_isBlank_ex(new_value, new_value_length TSRMLS_CC) == TRUE){
exception = zend_throw_error_exception(spl_ce_RuntimeException, "concat.prefix could not be blank", 0, E_CORE_WARNING TSRMLS_CC);
goto failure;
}
CONCAT_G(prefix_length) = new_value_length;
return OnUpdateStringUnempty(entry, new_value, new_value_length, mh_arg1, mh_arg2, mh_arg3, stage TSRMLS_CC);
failure:
concat_zval_ptr_dtor(exception);
return FAILURE;
}
static ZEND_INI_MH(OnUpdateDelimiter){
zval *exception = NULL;
if(new_value == NULL||new_value_length == 0){
exception = zend_throw_error_exception(spl_ce_RuntimeException, "concat.delimiter could not be empty", 0, E_CORE_WARNING TSRMLS_CC);
goto failure;
}
if(concat_isBlank_ex(new_value, new_value_length TSRMLS_CC) == TRUE){
exception = zend_throw_error_exception(spl_ce_RuntimeException, "concat.delimiter could not be blank", 0, E_CORE_WARNING TSRMLS_CC);
goto failure;
}
CONCAT_G(delimiter_length) = new_value_length;
return OnUpdateStringUnempty(entry, new_value, new_value_length, mh_arg1, mh_arg2, mh_arg3, stage TSRMLS_CC);
failure:
concat_zval_ptr_dtor(exception);
return FAILURE;
}
/* {{{ ZEND_INI */
ZEND_INI_BEGIN()
STD_ZEND_INI_BOOLEAN("concat.enable", "off", ZEND_INI_ALL, OnUpdateBool, enable, zend_concat_globals, concat_globals)
STD_ZEND_INI_ENTRY("concat.prefix", "??", ZEND_INI_ALL, OnUpdatePrefix, prefix, zend_concat_globals, concat_globals)
STD_ZEND_INI_ENTRY("concat.delimiter", ",", ZEND_INI_ALL, OnUpdateDelimiter, delimiter, zend_concat_globals, concat_globals)
STD_ZEND_INI_ENTRY("concat.max_files", "0", ZEND_INI_ALL, OnUpdateLong, max_files, zend_concat_globals, concat_globals)
ZEND_INI_END()
/* }}} */
/* {{{ private void Concat::__construct() */
static ZEND_METHOD(concat, __construct){
}
/* }}} */
/* {{{ public void Concat::setEnable(boolean $enable) */
static ZEND_METHOD(concat, setEnable){
CONCAT_SETBOOLEAN_METHOD(enable);
}
/* }}} */
/* {{{ public boolean Concat::getEnable() */
static ZEND_METHOD(concat, getEnable){
CONCAT_GETBOOLEAN_METHOD(enable);
}
/* }}} */
/* {{{ public void Concat::setPrefix(string $prefix) */
static ZEND_METHOD(concat, setPrefix){
CONCAT_SETSTRINGL_METHOD(prefix);
}
/* }}} */
/* {{{ public string Concat::getPrefix() */
static ZEND_METHOD(concat, getPrefix){
CONCAT_GETSTRINGL_METHOD(prefix);
}
/* }}} */
/* {{{ public void Concat::setDelimiter(string $delimiter) */
static ZEND_METHOD(concat, setDelimiter){
CONCAT_SETSTRINGL_METHOD(delimiter);
}
/* }}} */
/* {{{ public string Concat::getDelimiter() */
static ZEND_METHOD(concat, getDelimiter){
CONCAT_GETSTRINGL_METHOD(delimiter);
}
/* }}} */
/* {{{ public void Concat::setVersionPrefix(string $versionPrefix) */
static ZEND_METHOD(concat, setVersionPrefix){
char *versionPrefix;
uint versionPrefix_length;
if(zend_parse_parameters(1 TSRMLS_CC, "s", &versionPrefix, &versionPrefix_length) == SUCCESS){
CONCAT_CLEAN_STRING_G(version_prefix);
CONCAT_G(version_prefix) = estrndup(versionPrefix, versionPrefix_length);
CONCAT_G(version_prefix_length) = versionPrefix_length;
}
}
/* }}} */
/* {{{ public string Concat::getVersionPrefix() */
static ZEND_METHOD(concat, getVersionPrefix){
CONCAT_GETSTRINGL_METHOD(version_prefix);
}
/* }}} */
/* {{{ public void Concat::setVersion(string $version) */
static ZEND_METHOD(concat, setVersion){
char *version;
uint version_length;
if(zend_parse_parameters(1 TSRMLS_CC, "s", &version, &version_length) == SUCCESS){
CONCAT_CLEAN_STRING_G(version);
CONCAT_G(version) = estrndup(version, version_length);
CONCAT_G(version_length) = version_length;
}
}
/* }}} */
/* {{{ public string Concat::getVersion() */
static ZEND_METHOD(concat, getVersion){
CONCAT_GETSTRINGL_METHOD(version);
}
/* }}} */
/* {{{ public void Concat::setMaxFiles(integer $maxFiles) */
static ZEND_METHOD(concat, setMaxFiles){
CONCAT_SETLONG_METHOD(max_files);
}
/* }}} */
/* {{{ public integer Concat::getMaxFiles() */
static ZEND_METHOD(concat, getMaxFiles){
CONCAT_GETLONG_METHOD(max_files);
}
/* }}} */
/* {{{ public string Concat::css(string $baseUrl, mixed ...) */
static ZEND_METHOD(concat, css){
zval ***arguments = NULL;
uint arguments_count = 0;
if(zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "+", &arguments, &arguments_count) == SUCCESS){
uint i = 0;
int size = arguments_count - 1;
char *baseUrl;
size_t baseUrl_length;
uint end = CONCAT_G(enable) == FALSE||CONCAT_G(max_files) == 0 ? size : MIN(CONCAT_G(max_files), size);
zval ***args = arguments + 1;
smart_str str = {0};
baseUrl = concat_object_valueof(*(arguments[0]), &baseUrl_length TSRMLS_CC);
if(CONCAT_G(enable) == TRUE){
smart_str_appendl(&str, "<link href=\"", sizeof("<link href=\"") - 1);
if(baseUrl&&baseUrl_length > 0){
smart_str_appendl(&str, baseUrl, baseUrl_length);
}
if(CONCAT_G(prefix)&&CONCAT_G(prefix_length) > 0){
smart_str_appendl(&str, CONCAT_G(prefix), CONCAT_G(prefix_length));
}
CONCAT_FILES(end, args, &str);
smart_str_appendl(&str, "\" rel=\"stylesheet\" type=\"text/css\" />", sizeof("\" rel=\"stylesheet\" type=\"text/css\" />") - 1);
}else{
for(; i < end; i++){
char *filename = NULL;
size_t filename_length = 0;
smart_str_appendl(&str, "<link href=\"", sizeof("<link href=\"") - 1);
if(baseUrl&&baseUrl_length > 0){
smart_str_appendl(&str, baseUrl, baseUrl_length);
}
filename = concat_object_valueof(*(args[i]), &filename_length TSRMLS_CC);
if(filename&&filename_length > 0){
smart_str_appendl(&str, filename, filename_length);
}
CONCAT_APPEND_VERSION(&str);
smart_str_appendl(&str, "\" rel=\"stylesheet\" type=\"text/css\" />", sizeof("\" rel=\"stylesheet\" type=\"text/css\" />") - 1);
}
}
smart_str_0(&str);
concat_free(arguments);
RETURN_STRINGL(str.c, str.len, FALSE);
}
}
/* }}} */
/* {{{ public string Concat::javascript(string $baseUrl, mixed ...) */
static ZEND_METHOD(concat, javascript){
zval ***arguments = NULL;
uint arguments_count = 0;
if(zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "+", &arguments, &arguments_count) == SUCCESS){
uint i = 0;
int size = arguments_count - 1;
char *baseUrl;
size_t baseUrl_length;
uint end = CONCAT_G(enable) == FALSE||CONCAT_G(max_files) == 0 ? size : MIN(CONCAT_G(max_files), size);
zval ***args = arguments + 1;
smart_str str = {0};
baseUrl = concat_object_valueof(*(arguments[0]), &baseUrl_length TSRMLS_CC);
if(CONCAT_G(enable) == TRUE){
smart_str_appendl(&str, "<script src=\"", sizeof("<script src=\"") - 1);
if(baseUrl&&baseUrl_length > 0){
smart_str_appendl(&str, baseUrl, baseUrl_length);
}
if(CONCAT_G(prefix)&&CONCAT_G(prefix_length) > 0){
smart_str_appendl(&str, CONCAT_G(prefix), CONCAT_G(prefix_length));
}
CONCAT_FILES(end, args, &str);
smart_str_appendl(&str, "\" type=\"text/javascript\"></script>", sizeof("\" type=\"text/javascript\"></script>") - 1);
}else{
for(; i < end; i++){
char *filename = NULL;
size_t filename_length = 0;
smart_str_appendl(&str, "<script src=\"", sizeof("<script src=\"") - 1);
if(baseUrl&&baseUrl_length > 0){
smart_str_appendl(&str, baseUrl, baseUrl_length);
}
filename = concat_object_valueof(*(args[i]), &filename_length TSRMLS_CC);
if(filename&&filename_length > 0){
smart_str_appendl(&str, filename, filename_length);
}
CONCAT_APPEND_VERSION(&str);
smart_str_appendl(&str, "\" type=\"text/javascript\"></script>", sizeof("\" type=\"text/javascript\"></script>") - 1);
}
}
smart_str_0(&str);
concat_free(arguments);
RETURN_STRINGL(str.c, str.len, FALSE);
}
}
/* }}} */
/* {{{ private void Concat::__destruct() */
static ZEND_METHOD(concat, __destruct){
}
/* }}} */
static zend_function_entry concat_methods[] = {
CONCAT_ME(__construct, NULL, ZEND_ACC_PRIVATE|ZEND_ACC_CTOR)
CONCAT_STATIC_ME(setEnable, concat_setEnable_arguments)
CONCAT_STATIC_ME(getEnable, NULL)
CONCAT_STATIC_ME(setPrefix, concat_setPrefix_arguments)
CONCAT_STATIC_ME(getPrefix, NULL)
CONCAT_STATIC_ME(setDelimiter, concat_setDelimiter_arguments)
CONCAT_STATIC_ME(getDelimiter, NULL)
CONCAT_STATIC_ME(setVersionPrefix, concat_setVersionPrefix_arguments)
CONCAT_STATIC_ME(getVersionPrefix, NULL)
CONCAT_STATIC_ME(setVersion, concat_setVersion_arguments)
CONCAT_STATIC_ME(getVersion, NULL)
CONCAT_STATIC_ME(setMaxFiles, concat_setMaxFiles_arguments)
CONCAT_STATIC_ME(getMaxFiles, NULL)
CONCAT_STATIC_ME(css, concat_css_arguments)
CONCAT_STATIC_ME(javascript, concat_javascript_arguments)
CONCAT_STATIC_MALIAS(js, javascript, concat_js_arguments)
CONCAT_ME(__destruct, NULL, ZEND_ACC_PRIVATE|ZEND_ACC_DTOR)
ZEND_FE_END
};
/* {{{ concat_functions */
const zend_function_entry concat_functions[] = {
ZEND_FE_END
};
/* }}} */
/** {{{ ZEND_MINIT_FUNCTION */
ZEND_MINIT_FUNCTION(concat){
zend_class_entry ce;
INIT_CLASS_ENTRY(ce, "Concat", concat_methods);
concat_ce = zend_register_internal_class(&ce TSRMLS_CC);
concat_ce->ce_flags |= ZEND_ACC_FINAL_CLASS;
zend_declare_class_constant_stringl(concat_ce, "NAME", 4, ZEND_STRL(CONCAT) TSRMLS_CC);
zend_declare_class_constant_stringl(concat_ce, "VERSION", 7, ZEND_STRL(CONCAT_VERSION) TSRMLS_CC);
zend_declare_class_constant_long(concat_ce, "MAJOR_VERSION", 13, CONCAT_MAJOR_VERSION TSRMLS_CC);
zend_declare_class_constant_long(concat_ce, "MINOR_VERSION", 13, CONCAT_MINOR_VERSION TSRMLS_CC);
zend_declare_class_constant_long(concat_ce, "RELEASE_VERSION", 15, CONCAT_RELEASE_VERSION TSRMLS_CC);
zend_declare_class_constant_stringl(concat_ce, "EXTRA_VERSION", 13, ZEND_STRL(CONCAT_EXTRA_VERSION) TSRMLS_CC);
zend_declare_class_constant_stringl(concat_ce, "BUILD", 5, ZEND_STRL(CONCAT_BUILD) TSRMLS_CC);
zend_declare_class_constant_stringl(concat_ce, "API_VERSION", 11, ZEND_STRL(CONCAT_API_VERSION) TSRMLS_CC);
zend_declare_class_constant_stringl(concat_ce, "REVISION_ID", 11, ZEND_STRL(CONCAT_REVISION_ID) TSRMLS_CC);
ZEND_INIT_MODULE_GLOBALS(concat, ZEND_MODULE_GLOBALS_CTOR_N(concat), ZEND_MODULE_GLOBALS_DTOR_N(concat));
REGISTER_INI_ENTRIES();
return SUCCESS;
}
/* }}} */
/** {{{ ZEND_RINIT_FUNCTION */
ZEND_RINIT_FUNCTION(concat){
CONCAT_G(version_prefix) = NULL;
CONCAT_G(version_prefix_length) = 0;
CONCAT_G(version) = NULL;
CONCAT_G(version_length) = 0;
return SUCCESS;
}
/* }}} */
/** {{{ ZEND_RSHUTDOWN_FUNCTION */
ZEND_RSHUTDOWN_FUNCTION(concat){
CONCAT_CLEAN_STRING_G(version_prefix);
CONCAT_CLEAN_STRING_G(version);
return SUCCESS;
}
/* }}} */
/** {{{ ZEND_MSHUTDOWN_FUNCTION */
ZEND_MSHUTDOWN_FUNCTION(concat){
UNREGISTER_INI_ENTRIES();
#ifdef ZTS
ts_free_id(concat_globals_id);
#else
ZEND_MODULE_GLOBALS_DTOR_N(concat)(&concat_globals TSRMLS_CC);
#endif
return SUCCESS;
}
/* }}} */
/** {{{ ZEND_MINFO_FUNCTION */
ZEND_MINFO_FUNCTION(concat){
php_info_print_table_start();
php_info_print_table_header(2, "concat support", "enabled");
php_info_print_table_row(2, "Name", CONCAT);
php_info_print_table_row(2, "Version", CONCAT_VERSION" "CONCAT_EXTRA_VERSION);
if(CONCAT_BUILD[0] != '\0'){
php_info_print_table_row(2, "Build", CONCAT_BUILD);
}
php_info_print_table_row(2, "API Version", CONCAT_API_VERSION);
php_info_print_table_row(2, "Revision Id", CONCAT_REVISION_ID);
php_info_print_table_end();
DISPLAY_INI_ENTRIES();
}
/* }}} */
/** {{{ ZEND_GINIT_FUNCTION */
ZEND_GINIT_FUNCTION(concat){
concat_globals->enable = FALSE;
concat_globals->prefix = NULL;
concat_globals->prefix_length = 0;
concat_globals->delimiter = NULL;
concat_globals->delimiter_length = 0;
concat_globals->version_prefix = NULL;
concat_globals->version_prefix_length = 0;
concat_globals->version = NULL;
concat_globals->version_length = 0;
concat_globals->max_files = 0;
}
/* }}} */
/** {{{ ZEND_GSHUTDOWN_FUNCTION */
ZEND_GSHUTDOWN_FUNCTION(concat){
concat_free(concat_globals->version_prefix);
concat_globals->version_prefix_length = 0;
concat_free(concat_globals->version);
concat_globals->version_length = 0;
}
/* }}} */
/* {{{ module depends */
zend_module_dep concat_deps[] = {
{NULL, NULL, NULL}
};
/* }}} */
#ifdef COMPILE_DL_CONCAT
ZEND_GET_MODULE(concat)
#endif
/* {{{ concat_module_entry */
zend_module_entry concat_module_entry = {
STANDARD_MODULE_HEADER_EX,
NULL,
concat_deps,
CONCAT,
concat_functions,
ZEND_MODULE_STARTUP_N(concat),
ZEND_MODULE_SHUTDOWN_N(concat),
ZEND_MODULE_ACTIVATE_N(concat),
ZEND_MODULE_DEACTIVATE_N(concat),
ZEND_MINFO(concat),
CONCAT_VERSION,
STANDARD_MODULE_PROPERTIES
};
/* }}} */
/*
* Local variables:
* tab-width: 4
* c-basic-offset: 4
* End:
* vim600: noet sw=4 ts=4 fdm=marker
* vim<600: noet sw=4 ts=4
*/