Skip to:
Content
Pages
Categories
Search
Top
Bottom

Need explanation on these junks of codes

  • Hi,

    I would like to know the reason of filtering every ouput, even after being sanitized, with the following statement: return apply_filters(‘sanitized_string’, $string, $original_string, $context);

    I can’t understand the purpose of this (surplus?) filtration..

    And the “apply_filters” also have another sister function like “merge_filters” and “remove_filters”.

    I would be glad to know the purpose of these, thanks!


    Function details:

    1) found in file ./bb-includes/wp-functions.php as from line 579

    2) the function:

    function apply_filters($tag, $string) {

    global $wp_filter, $merged_filters;

    if ( !isset( $merged_filters[ $tag ] ) )

    merge_filters($tag);

    if ( !isset($wp_filter[$tag]) )

    return $string;

    reset( $wp_filter[ $tag ] );

    $args = func_get_args();

    do{

    foreach( (array) current($wp_filter[$tag]) as $the_ )

    if ( !is_null($the_) ){

    $args[1] = $string;

    $string = call_user_func_array($the_, array_slice($args, 1, (int) $the_));

    }

    } while ( next($wp_filter[$tag]) !== false );

    return $string;

    }

  • You must be logged in to reply to this topic.
Skip to toolbar