Created
June 18, 2012 15:42
-
-
Save stealth35/2948993 to your computer and use it in GitHub Desktop.
PHP get_user_aliases
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
static int copy_user_alias_name(zend_class_entry **pce TSRMLS_DC, int num_args, va_list args, zend_hash_key *hash_key) | |
{ | |
zval *array = va_arg(args, zval *); | |
zend_class_entry *ce = *pce; | |
if ((ce->type == ZEND_USER_CLASS) && strcasecmp(hash_key->arKey, ce->name) != 0) { | |
add_assoc_string_ex(array, hash_key->arKey, hash_key->nKeyLength, (char *) ce->name, 1); | |
} | |
return ZEND_HASH_APPLY_KEEP; | |
} | |
PHP_FUNCTION(get_user_aliases) | |
{ | |
if (zend_parse_parameters_none() == FAILURE) { | |
return; | |
} | |
array_init(return_value); | |
zend_hash_apply_with_arguments(EG(class_table) TSRMLS_CC, (apply_func_args_t) copy_user_alias_name, 1, return_value); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment