Jump to content

Stop Shouting In Topic Titles.


EricGagne

Recommended Posts

When this feature is enabled the topic titles are changed automatically regardless of whether they are actually all uppercase or not. I searched the tracker for this, it was reported as a bug back in January 2009 and the answer given was that it's working as intended. If that is so then I humbly suggest that the intent was wrong and that it should be changed. My board is in French and in our language we don't capitalize every word, the behavior of this feature forces me to choose between letting my members shout in titles or have every topic title in my forum spelled wrong.

I'm not asking that the system becomes language aware and changes topic titles to be spelled properly based on the forum/member language. I just wish that this feature would only change the when they're are actually all capitalized.

I think it's acceptable that "CECI EST MON SUJET" becomes "Ceci Est Mon Sujet" although it's still not correct in french. I do however think that if someone writes "Ceci est mon sujet", which is the correct spelling, it shoulnd't be turned into "Ceci Est Mon Sujet".

Eric

Link to comment
Share on other sites

  • 1 year later...

While this post is rather old I have just run across this problem with brand name spelling, which must be exact.

I decided to post the fix here for anyone who may need it. Note that I am running on version 3.4.4 so if you already have 3.4.5 the line numbers may be off a bit.

Insert a new global function 'IPSText::isShouting' to '/admin/sources/base/core.php' at line 4325:

/*
 * Add shout checking
 */
static public function isShouting($str)
{
    preg_match_all('/[a-z]/', $str, $matches);
    $ltot = count($matches[0]);
    preg_match_all('/[A-Z]/', $str, $matches);
    $utot = count($matches[0]);

    if ($utot > $ltot && (($ltot / $utot) <= 0.25))
        return(true);
    return(false);
}

change line 4326 in 'admin/applications/forums/modules_public/ajax/topics.php':

from:
    if ($this->settings['etfilter_shout'])

to:
    if ($this->settings['etfilter_shout'] && IPSText::isShouting($title))

change line 1361 in 'admin/applications/forums/modules_public/moderate/moderate.php':

from:
    if ($this->settings['etfilter_shout'])

to:
    if ($this->settings['etfilter_shout'] && IPSText::isShouting($title))

change line 469 in 'admin/applications/forums/sources/classes/post/classPost.php':

from:
    if ($this->settings['etfilter_shout'])

to:
    if ($this->settings['etfilter_shout'] && IPSText::isShouting($title))

change line 1143 in 'admin/applications_addon/ips/blog/sources/classes/post/blogPost.php':

from:
    if ($this->settings['etfilter_shout'])

to:
    if ($this->settings['etfilter_shout'] && IPSText::isShouting($title))

The 'IPSText::isShouting' function will identify the text as shouting if 75% or more of the characters are uppercase. You can tweak this and it probably should be added as a system setting for easy modification. I presented this as a core change in the hope that it would be added into the base code.

I hope someone finds this useful...

Jim

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...