After searching the forum and not finding any mod to stop users from SHOUTING and from Using "Jumpy" Text, i decided to give it a try and I came up with this modification. I'm not an expert coder, so if you find a better way to do it, please feel free to suggest it.
VB3 already has an option to stop shouting but it only works if ALL the text is in caps and even a little formatting can shut off the option.
What this mod does is:
1) Switch SHOUTING from the body text and from title into "normal" text.
2) Switch "Jumpy" text from both the body and title into a more readable form. Example of "Jumpy" text is the following sentence:
"This Sentence Is A Example Of 'Jumping' Text. The Reason Why Some Users Like To Write Sentences In This Way Eludes Me. I Just Know That After A Few Lines, It Becomes Difficult To Read"
Other rules can be easily added, if a few people find this mod interesting and ask for it, I may add a few more rules later (for example to convert text LiKe ThIs InTo SoMeThInG NoRmAl).
STEP 1
open file includes/functions_newpost.php
SEARCH FOR: (end of file)
PHP Code:
|| ####################################################################
\*======================================================================*/
?>
REPLACE WITH:
PHP Code:
####################################################################
\*======================================================================*/
//=======================================
function myRemoveShouting($string)
{
//$string = strtolower($string);
$string = html_entity_decode(strtolower(htmlentities($string)));
$string = preg_replace("/\s\s+/", " ", $string);
$string = preg_replace("/\.\s([a-z]{1})/e", "'. ' . strtoupper('\\1')", $string);
$string = ucfirst($string);
return($string);
}
//=======================================
?>
STEP 2:
Open file: newreply.php
SEARCH FOR:
PHP Code:
build_new_post('reply', $foruminfo, $threadinfo, $_POST['postid'], $newpost, $errors);
if (sizeof($errors) > 0)
{
// ### POST HAS ERRORS ###
$postpreview = construct_errors($errors); // this will take the preview's place
ABOVE THAT ADD:
PHP Code:
//==================================
if ($newpost['message'] == strtoupper($newpost['message']))
{
$newpost['message'] = myRemoveShouting($newpost['message']);
}
elseif (preg_match("/([a-z]+\s)([A-Z]+)([a-z]+\s)([A-Z]+)([a-z]+\s)([A-Z]+)([a-z]+\s)([A-Z]+)([a-z]+)/", $newpost['message']))
{
$newpost['message'] = myRemoveShouting($newpost['message']);
}
if ($newpost['title'] == strtoupper($newpost['title']))
{
$newpost['title'] = myRemoveShouting($newpost['title']);
}
elseif (preg_match("/([a-z]+\s)([A-Z]+)([a-z]+\s)([A-Z]+)([a-z]+\s)([A-Z]+)([a-z]+\s)([A-Z]+)([a-z]+)/", $newpost['message']))
{
$newpost['title'] = myRemoveShouting($newpost['title']);
}
//==================================
STEP 3:
Open file: newthread.php
SEARCH FOR:
PHP Code:
build_new_post('thread', $foruminfo, array(), 0, $newpost, $errors);
if (sizeof($errors) > 0)
{
// ### POST HAS ERRORS ###
$postpreview = construct_errors($errors); // this will take the preview's place
construct_checkboxes($newpost);
$_REQUEST['do'] = 'newthread';
ABOVE THAT ADD:
PHP Code:
//==================================
if ($newpost['message'] == strtoupper($newpost['message']))
{
$newpost['message'] = myRemoveShouting($newpost['message']);
}
elseif (preg_match("/([a-z]+\s)([A-Z]+)([a-z]+\s)([A-Z]+)([a-z]+\s)([A-Z]+)([a-z]+\s)([A-Z]+)([a-z]+)/", $newpost['message']))
{
$newpost['message'] = myRemoveShouting($newpost['message']);
}
if ($newpost['title'] == strtoupper($newpost['title']))
{
$newpost['title'] = myRemoveShouting($newpost['title']);
}
elseif (preg_match("/([a-z]+\s)([A-Z]+)([a-z]+\s)([A-Z]+)([a-z]+\s)([A-Z]+)([a-z]+\s)([A-Z]+)([a-z]+)/", $newpost['message']))
{
$newpost['title'] = myRemoveShouting($newpost['title']);
}
//==================================
Save the files or upload them and test if everything is working right. Go to one of you test forums and make a few threads and posts using SHOUTING text and "Jumpy" text.
This mod has been working nicely on my site for about a week.
The second line of function myRemoveShouting() is slower than the (commented) first one, but it makes the function compatible with forums with international characters like "áéíóú".