version 1.1, 2012/02/21 23:48:02
|
version 1.1.1.3, 2013/07/22 01:32:04
|
Line 2
|
Line 2
|
+----------------------------------------------------------------------+ |
+----------------------------------------------------------------------+ |
| PHP Version 5 | |
| PHP Version 5 | |
+----------------------------------------------------------------------+ |
+----------------------------------------------------------------------+ |
| Copyright (c) 1997-2012 The PHP Group | | | Copyright (c) 1997-2013 The PHP Group | |
+----------------------------------------------------------------------+ |
+----------------------------------------------------------------------+ |
| This source file is subject to version 3.01 of the PHP license, | |
| 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 | |
| that is bundled with this package in the file LICENSE, and is | |
Line 43 ZEND_BEGIN_MODULE_GLOBALS(browscap)
|
Line 43 ZEND_BEGIN_MODULE_GLOBALS(browscap)
|
browser_data activation_bdata; |
browser_data activation_bdata; |
ZEND_END_MODULE_GLOBALS(browscap) |
ZEND_END_MODULE_GLOBALS(browscap) |
|
|
ZEND_DECLARE_MODULE_GLOBALS(browscap); | ZEND_DECLARE_MODULE_GLOBALS(browscap) |
|
|
#ifdef ZTS |
#ifdef ZTS |
#define BROWSCAP_G(v) TSRMG(browscap_globals_id, zend_browscap_globals *, v) |
#define BROWSCAP_G(v) TSRMG(browscap_globals_id, zend_browscap_globals *, v) |
Line 333 PHP_INI_MH(OnChangeBrowscap)
|
Line 333 PHP_INI_MH(OnChangeBrowscap)
|
PHP_MINIT_FUNCTION(browscap) /* {{{ */ |
PHP_MINIT_FUNCTION(browscap) /* {{{ */ |
{ |
{ |
char *browscap = INI_STR("browscap"); |
char *browscap = INI_STR("browscap"); |
| |
#ifdef ZTS |
#ifdef ZTS |
ts_allocate_id(&browscap_globals_id, sizeof(browser_data), |
ts_allocate_id(&browscap_globals_id, sizeof(browser_data), |
(ts_allocate_ctor)browscap_globals_ctor, NULL); | browscap_globals_ctor, NULL); |
#endif |
#endif |
/* ctor call not really needed for non-ZTS */ |
/* ctor call not really needed for non-ZTS */ |
|
|
Line 451 static int browser_reg_compare(zval **browser TSRMLS_D
|
Line 451 static int browser_reg_compare(zval **browser TSRMLS_D
|
} |
} |
/* }}} */ |
/* }}} */ |
|
|
|
static void browscap_zval_copy_ctor(zval **p) /* {{{ */ |
|
{ |
|
zval *new; |
|
|
|
ALLOC_ZVAL(new); |
|
*new = **p; |
|
|
|
zval_copy_ctor(new); |
|
|
|
INIT_PZVAL(new); |
|
*p = new; |
|
} /* }}} */ |
|
|
/* {{{ proto mixed get_browser([string browser_name [, bool return_array]]) |
/* {{{ proto mixed get_browser([string browser_name [, bool return_array]]) |
Get information about the capabilities of a browser. If browser_name is omitted or null, HTTP_USER_AGENT is used. Returns an object by default; if return_array is true, returns an array. */ |
Get information about the capabilities of a browser. If browser_name is omitted or null, HTTP_USER_AGENT is used. Returns an object by default; if return_array is true, returns an array. */ |
PHP_FUNCTION(get_browser) |
PHP_FUNCTION(get_browser) |
Line 511 PHP_FUNCTION(get_browser)
|
Line 524 PHP_FUNCTION(get_browser)
|
|
|
if (return_array) { |
if (return_array) { |
array_init(return_value); |
array_init(return_value); |
zend_hash_copy(Z_ARRVAL_P(return_value), Z_ARRVAL_PP(agent), (copy_ctor_func_t) zval_add_ref, (void *) &tmp_copy, sizeof(zval *)); | zend_hash_copy(Z_ARRVAL_P(return_value), Z_ARRVAL_PP(agent), (copy_ctor_func_t) browscap_zval_copy_ctor, (void *) &tmp_copy, sizeof(zval *)); |
} |
} |
else { |
else { |
object_init(return_value); |
object_init(return_value); |
zend_hash_copy(Z_OBJPROP_P(return_value), Z_ARRVAL_PP(agent), (copy_ctor_func_t) zval_add_ref, (void *) &tmp_copy, sizeof(zval *)); | zend_hash_copy(Z_OBJPROP_P(return_value), Z_ARRVAL_PP(agent), (copy_ctor_func_t) browscap_zval_copy_ctor, (void *) &tmp_copy, sizeof(zval *)); |
} |
} |
|
|
while (zend_hash_find(Z_ARRVAL_PP(agent), "parent", sizeof("parent"), (void **) &z_agent_name) == SUCCESS) { |
while (zend_hash_find(Z_ARRVAL_PP(agent), "parent", sizeof("parent"), (void **) &z_agent_name) == SUCCESS) { |
Line 524 PHP_FUNCTION(get_browser)
|
Line 537 PHP_FUNCTION(get_browser)
|
} |
} |
|
|
if (return_array) { |
if (return_array) { |
zend_hash_merge(Z_ARRVAL_P(return_value), Z_ARRVAL_PP(agent), (copy_ctor_func_t) zval_add_ref, (void *) &tmp_copy, sizeof(zval *), 0); | zend_hash_merge(Z_ARRVAL_P(return_value), Z_ARRVAL_PP(agent), (copy_ctor_func_t) browscap_zval_copy_ctor, (void *) &tmp_copy, sizeof(zval *), 0); |
} |
} |
else { |
else { |
zend_hash_merge(Z_OBJPROP_P(return_value), Z_ARRVAL_PP(agent), (copy_ctor_func_t) zval_add_ref, (void *) &tmp_copy, sizeof(zval *), 0); | zend_hash_merge(Z_OBJPROP_P(return_value), Z_ARRVAL_PP(agent), (copy_ctor_func_t) browscap_zval_copy_ctor, (void *) &tmp_copy, sizeof(zval *), 0); |
} |
} |
} |
} |
|
|