Thread: Administrative and Maintenance Tools - Replacement Words In Posts
View Single Post
  #99  
Old 01-20-2008, 03:36 PM
ballpnet ballpnet is offline
 
Join Date: Oct 2007
Posts: 6
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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;]]> 
Reply With Quote
 
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01150 seconds
  • Memory Usage 1,789KB
  • Queries Executed 11 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD_SHOWPOST
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)bbcode_php
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_box
  • (1)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (1)post_thanks_postbit_info
  • (1)postbit
  • (1)postbit_onlinestatus
  • (1)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • reputationlevel
  • showthread
Included Files:
  • ./showpost.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_postinfo_query
  • fetch_postinfo
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showpost_start
  • bbcode_fetch_tags
  • bbcode_create
  • postbit_factory
  • showpost_post
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • showpost_complete