vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 3.0 Full Releases (https://vborg.vbsupport.ru/forumdisplay.php?f=33)
-   -   Stop SHOUTING and Posts With Annoying UPdown Text Like This (https://vborg.vbsupport.ru/showthread.php?t=91206)

Reynaldovb 06-26-2005 10:00 PM

Stop SHOUTING and Posts With Annoying UPdown Text Like This
 
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:

Quote:

"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 "?????".

Reynaldovb 06-27-2005 09:20 PM

- Place holder -

Marco van Herwaarden 06-27-2005 09:26 PM

Thansk for sharing, could you please also upload as a (zipped) textfile.

Jenta 06-27-2005 10:27 PM

hehe, i hate people that type like that myself

sv1cec 06-30-2005 07:45 PM

I installed that, and it works OK for all upper-case messages, but not with the Jumpy text. Any ideas of what I did wrong (although I am sure I didn't do anything wrong!) LoL.

Gutspiller 08-19-2005 09:25 PM

Confirmed, fixing jumpy text doesn't work, but all caps does. (v3.0.7)

redspider 09-16-2005 03:47 AM

any way to fix edit.php so that way anything new they enter dont come out as shouting if they try to go around this hack?

dknelson 11-18-2005 04:24 AM

Does anybody know if this works for 3.51? I know that prevent shouting is built in but does this prevent shouting even if "quote" is used in reply? Does it prevent shouting if not the works are caps?


All times are GMT. The time now is 03:11 AM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01067 seconds
  • Memory Usage 1,770KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (6)bbcode_php_printable
  • (1)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (8)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.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/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete