Klammer has asked for the wisdom of the Perl Monks concerning the following question:
After writing a blog post and publishing it, WordPress transforms the given title to a permalink.
Title: "Test title"
Permalink: http://blogname.com/YEAR/MONTH/DAY/test-title
I want to write a script that supports me in writing a blog post offline by generating some html code which I could paste easily in the online editor later.function sanitize_title($title, $fallback_title = '') { $title = strip_tags($title); $title = apply_filters('sanitize_title', $title); if ( '' === $title || false === $title ) $title = $fallback_title; return $title; }
The thing is, I need the "sanitized title" within some URLs within the generated html code. So Perl has to sanitize the given title in the same way as WordPress to generate valid urls.
I've searched google and Super Search but couldn't find anything useful. Has anybody already written a perl version of "sanitize_title" or a clue where WordPress does its magic to convert a user given title to its final form?
My goal would be a function which I can pass my title to and which returns the sanitized title.
Cheers Klammer
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: WordPress 'sanitize_title'
by moritz (Cardinal) on Sep 01, 2008 at 13:36 UTC | |
by Klammer (Acolyte) on Sep 01, 2008 at 14:04 UTC | |
by moritz (Cardinal) on Sep 01, 2008 at 15:59 UTC | |
by Klammer (Acolyte) on Sep 01, 2008 at 16:20 UTC | |
by moritz (Cardinal) on Sep 01, 2008 at 16:30 UTC | |
|
Re: WordPress 'sanitize_title'
by Anonymous Monk on Sep 01, 2008 at 14:53 UTC | |
by Klammer (Acolyte) on Sep 01, 2008 at 16:33 UTC | |
by Anonymous Monk on Sep 01, 2008 at 16:38 UTC | |
by Klammer (Acolyte) on Sep 01, 2008 at 17:13 UTC | |
|
Re: WordPress 'sanitize_title'
by Anonymous Monk on Sep 01, 2008 at 15:09 UTC | |
by Klammer (Acolyte) on Sep 01, 2008 at 16:44 UTC | |
by Anonymous Monk on Sep 01, 2008 at 16:45 UTC | |
by Klammer (Acolyte) on Sep 01, 2008 at 17:17 UTC |