in reply to Re: WordPress 'sanitize_title'
in thread WordPress 'sanitize_title'
> So you found sanitize_title (you're good enough at PHP)
Well, I didn't find it by checking the source but during a google research. Someone pointed to the sanitize_title function when it comes to permalink creation.
So I downloaded the WordPress source code and found it in formatting.php.
To be honest I also found the apply_filters function in wp-includes/plugin.php when trying to understand what "sanitize_title" does.
But apply_filters as well as sanitize_title gives me no clue what WordPress does to convert the title. I expected to find some php string manipulation but apply_filters is all greek to me.
function apply_filters($tag, $value) { global $wp_filter, $merged_filters, $wp_current_filter; $args = array(); $wp_current_filter[] = $tag; // Do 'all' actions first if ( isset($wp_filter['all']) ) { $args = func_get_args(); _wp_call_all_hook($args); } if ( !isset($wp_filter[$tag]) ) { array_pop($wp_current_filter); return $value; } // Sort if ( !isset( $merged_filters[ $tag ] ) ) { ksort($wp_filter[$tag]); $merged_filters[ $tag ] = true; } reset( $wp_filter[ $tag ] ); if ( empty($args) ) $args = func_get_args(); do { foreach( (array) current($wp_filter[$tag]) as $the_ ) if ( !is_null($the_['function']) ){ $args[1] = $value; $value = call_user_func_array($the_['function'], array +_slice($args, 1, (int) $the_['accepted_args'])); } } while ( next($wp_filter[$tag]) !== false ); array_pop( $wp_current_filter ); return $value; }
My hope and the reason for my posting was, that someone already has written a module/function/... in Perl that accomplished this. It seems this is not the case.
Cheers Klammer
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: WordPress 'sanitize_title'
by Anonymous Monk on Sep 01, 2008 at 16:38 UTC | |
by Klammer (Acolyte) on Sep 01, 2008 at 17:13 UTC |