Ok finally got some more time to look at the code and have it working now:
Using ucwords now instead of my previous method. Let me know if you have any issues with it.
PHP Code:
if (is_subclass_of($this, 'vB_DataManager_ThreadPost') && is_array($this->validfields['title']))
{
global $exclude_words, $capital_words, $max_length ;
$exclude_words = array("the","a","of","is"); // Exclude analyzing these words
$capital_words = array("brb","lol"); // Capital exclusives (leave in lowercase in array)
$max_length = 5; // Maximum word length, anything over is case-lowered
$this->validfields['title'][VF_CODE] = '
global $exclude_words, $capital_words, $max_length ;
$retval = $dm->verify_title($data);
$words = explode(" ",$data);
foreach ($words as $word) {
if (!in_array(strtolower($word),$exclude_words))
{
if(in_array(preg_replace("/[^a-zA-Z]/","",strtolower($word)),$capital_words))
$newWord[] = strtoupper($word);
elseif(strlen($word) >=$max_length && !in_array(strtolower($word),$capital_words)) $newWord[] = ucwords(strtolower($word));
else $newWord[] = ucwords($word);
}
else $newWord[] = strtolower($word);
}
$data = implode(" ",$newWord);
return $retval;
';
}