]> granicus.if.org Git - php/commitdiff
Added stream_get_filters(); to list registered filters
authorSara Golemon <pollita@php.net>
Sun, 5 Jan 2003 03:24:38 +0000 (03:24 +0000)
committerSara Golemon <pollita@php.net>
Sun, 5 Jan 2003 03:24:38 +0000 (03:24 +0000)
ext/standard/basic_functions.c
ext/standard/basic_functions.h
ext/standard/user_filters.c

index 2344eb77340ccc1db3f2cff9dadd6a4254cac740..93649e2590d17ac57f6aebfee7475a4160634afb 100644 (file)
@@ -863,6 +863,7 @@ function_entry basic_functions[] = {
 #endif
 
        PHP_FE(str_rot13, NULL)
+       PHP_FE(stream_get_filters, NULL)
        PHP_FE(stream_register_filter, NULL)
 
        /* functions from aggregate.c */
index f1b9f4b4fc2b134adf5b948cb9cfd4fe44c1b3fa..a1d86ce2fd60ff4dfaee72aa4b873dc88783a2ce 100644 (file)
@@ -105,6 +105,7 @@ PHP_FUNCTION(move_uploaded_file);
 PHP_FUNCTION(parse_ini_file);
 
 PHP_FUNCTION(str_rot13);
+PHP_FUNCTION(stream_get_filters);
 PHP_FUNCTION(stream_register_filter);
 PHP_MINIT_FUNCTION(user_filters);
 
index 90ab01a672c65569e3e9a9aabe9238fb16d56af1..97b743899a2877e7b044ebc0f5fa4390e6fad2cd 100644 (file)
@@ -411,6 +411,24 @@ static void filter_item_dtor(struct php_user_filter_data *fdat)
 {
 }
 
+/* {{{ proto array stream_get_filters()
+   Returns a list of registered filters */
+PHP_FUNCTION(stream_get_filters)
+{
+       char *filter_name;
+       int filter_name_len = 0;
+
+       array_init(return_value);
+
+       if (BG(user_filter_map)) {
+               for(zend_hash_internal_pointer_reset(BG(user_filter_map));
+                       zend_hash_get_current_key_ex(BG(user_filter_map), &filter_name, &filter_name_len, NULL, 0, NULL) == HASH_KEY_IS_STRING;
+                       zend_hash_move_forward(BG(user_filter_map)))
+                               add_next_index_string(return_value, filter_name, 1);
+       }
+}
+/* }}} */      
+
 /* {{{ proto bool stream_register_filter(string filtername, string classname)
    Registers a custom filter handler class */
 PHP_FUNCTION(stream_register_filter)