|
Replace threadpost characters
This modification is in the archives.
Recently I was in search of a way to replace or restrict the use of non-alpha characters used in thread titles. This is useful when adding your thread titles to a welcome header or other area where these characters would look out of place (i.e. '!' or '?' placed mid sentence).
The following is a manual addition of code which will replace specified characters with whatever you want. Start by finding /includes/class_dm_threadpost.php You may want to make a backup copy of this file in case you blow things up Open class_dm_threadpost.php in an editor and find the following code: Code:
// replace html-encoded spaces with actual spaces
$title = preg_replace('/&#(0*32|x0*20);/', ' ', $title);
Code:
$title = preg_replace('/[\?\!]/', ' ', $title);
Between the [brackets] only add the characters you wish to have replaced when a user types it into their thread title. Separate each character with a backslash. I personally didn't want to see anything except alpha-numeric titles so I included just about every character. The first part replaces the specified character with a space. The next part I added replaces each specific character with a corresponding word (i.e. '&' is replaced by the word 'and'). Below: Code:
// replace html-encoded spaces with actual spaces
$title = preg_replace('/&#(0*32|x0*20);/', ' ', $title);
Code:
// replace special characters with actual spaces
$title = preg_replace('/[\?\!\#\$\%\^\*\~\|\:\;\...]/', ' ', $title);
// replace special characters with...
$title = preg_replace('/[\@]/', ' at ', $title);
$title = preg_replace('/[\+]/', ' plus ', $title);
$title = preg_replace('/[\=]/', ' equals ', $title);
$title = preg_replace('/[\&]/', ' and ', $title);
Download No files for download. |
|||||||||
Similar Mods
| Add spanish characters/ or other language characters | vBulletin 2.x Beta Releases |