Greetings,
I've changed the code within the plugin in order to get it to work at our forums. This works with 3.6.8 and I've not tested it on any of the other versions. If anyone else wants to make the same modifications they are more than welcome to do so, but please be advised that it'll be at your own discretion and I will not provide support or be held liable if anything goes wrong.
*Props goes to mah man Nate(nathanledet) for bringing this plugin to our attention.*
Things the modification fixes:
1)It does not lower case the entire message
2)It tries to uppercase the first letter of a word at the beginning of a sentence. Say for example you want to replace the uppercase word WIDGET with widget. If someone begins the sentence with this word, then it'll look awkward and incorrect when it gets lowercased. The code then corrects this by uppercasing the "w" and giving us a correct much better looking "Widget."
Find and replace the <phpcode> opening and closing tags with the following.
PHP Code:
<![CDATA[$array1 = explode("|", $vbulletin->options['ah_word_replace_find']);
$array2 = explode("|", $vbulletin->options['ah_word_replace_replace']);
$ah_text = $this->post['message'];
$breadcrumb = array();
if(count($array1) > 0) {
for($j=0; $j<count($array1); $j++) {
$breadcrumb[] = '/'.$array1[$j].'/i';
}
$ah_text = preg_replace($breadcrumb, $array2, $ah_text);
$separators = array('. ', '? ', '! ');
for($i=0; $i<count($separators); $i++) {
$var = $separators[$i];
$sentences = explode($var, $ah_text);
$tmp_sentence = '';
$k = 0;
foreach($sentences as $single_sentence) {
$tmp_sentence .= ucfirst($single_sentence);
if ($k<count($sentences)-1) {
$tmp_sentence .= $var;
}
$k++;
}
$ah_text = $tmp_sentence;
}
}
$this->post['message'] = $ah_text;]]>