Disable shouting

Started by Rudolf, July 18, 2007, 10:57:32 AM

Previous topic - Next topic

Rudolf

Link to Mod

*****************************************************
Disable shouting - Modification for SMF
version 1.0
© 2007, Rudolf Martincsek
*****************************************************
This mod changes text written in upper case letters into lower case letters. Only in the topic disaply page!
You can enable/disable in Admin -> Posts and Topics -> "Disable shouting".
The feature is disabled by default
I will update all my mods in the next few weeks. Thanks for your patience.

SVG-Collapse (you need an SVG compliant browser)

shadow82x

Very Nice mod again Rudolf. :)
Colin B
Former Spammer, Customize, & Support Team Member

GC

If the text were to be like "Hello", would it display "hello"?

Also, on my board there's a game we discuss about called SOCOM, and yes it's spelt in caps. Would this mod change it to socom or Socom?

Is there a way to stop certain words from being uncapitalized?

Rudolf

#3
I will be adding that feature soon.

Don't worry because the mod doesn't changes the content. The content stored in the database is written by the poster.
You might see it now lowercase, but once the feature included it will turn back normal.
I will update all my mods in the next few weeks. Thanks for your patience.

SVG-Collapse (you need an SVG compliant browser)


sodmanccc

this type of mod is really needed at a forum like ours.

however when we install and enable it it does not seam to change it 100%, when posting a shouting or yelling TOPIC subject and message but only the message content is change. once i double click to change the title i add any letter or number and then allow it to change it does change it from yelling to not but then once you refresh its changed back for some reason.

Rudolf you made by far one of the best mods for SMF (the enhanced stats) so i know you are busy but i was hoping i could get a little help on this please pm me if you can assist me. thanks and great work.

Rudolf

Do you have any errors in the error log related to this?
If the install went fine I see no reason why it shouldn't work.
Can you give a link to your forum?
I will update all my mods in the next few weeks. Thanks for your patience.

SVG-Collapse (you need an SVG compliant browser)

sodmanccc

hello

yea it is working partly... only in the Message it self, but when looking at the forums main you still SEE CAPS

i am kind of thinking that it pretty much has to change the topic title from caps to not other wise there is still caps and shouting.


i am going to PM you the site URL thanks.

Rudolf

Removing shouting from any part of the forum is quite easy, but it requires small modifications in numerous files.
I will add this in other places in the next versions.
This was an "emergency" release to handle the topic display area.
I will update all my mods in the next few weeks. Thanks for your patience.

SVG-Collapse (you need an SVG compliant browser)

LeeOwen

Alright,

Blinding add on, anyway to make it so it alters the same for 'Recent Posts'

Cheers
Lee
MillwallOnline.co.uk

michaelnl

#10
Hi,

I think i've found a bug. With sticky topics I get this error:

Notice: Uninitialized string offset: -1 in /home/holland/public_html/smf/Sources/Subs.php on line 3611

Line 3611 is:

$pos--;


And that's part of:

//-Disable shouting MOD- START
function disableShouting($string, $echo = false)
{
global $func, $modSettings;

if (empty($modSettings['disableShouting']))
return $string;

preg_match_all('~[A-Z ]{5,}~',$string, $matches, PREG_OFFSET_CAPTURE);

foreach ($matches[0] as $match)
{
$search = $func['htmltrim']($match[0]);
$pos = $match[1];
do
{
[b]$pos--;[/b]
}while ($pos < 1 && $string[$pos] == ' ');

$replace = strtolower($search);
if ($pos <= 0 || in_array($string[$pos], array('.','!','?')))
$replace = ucfirst($replace);
$string = str_replace($search, $replace, $string);
}

if ($echo)
echo $string;
else
return $string;
}
//Disable shouting MOD- END

sodmanccc

oh ok, i would be willing to donate a little to help make sure it gets done ... soon..
haha

tsmalmbe

Only the message itself is unshoutified, the subject still is with CAPS.

This mod also modifies Post.php, and adds the disableShouting()-method there. If this only affects viewing, why are you modifying stuff in Post.php?

Nice mod, requires a few fixes still :).
..:: http://www.kontrollrummet.com - Studio och musik ::.. RSS?

tsmalmbe

Did some mods to support finnish and swedisch characters. This does not yet cover german umlauts and french wierdnesses (just to mention a few shortcomings). I assume we are using UTF-8 as the forum locale, didnä't know how to pull that  dynamically from the forum.


//-Disable shouting MOD- START
function disableShouting($string, $echo = false)
{
global $func, $modSettings;

if (empty($modSettings['disableShouting']))
return $string;

preg_match_all('~[A-Ö ]{5,}~',$string, $matches, PREG_OFFSET_CAPTURE);

foreach ($matches[0] as $match)
{
$search = $func['htmltrim']($match[0]);
$pos = $match[1];
do
{
$pos--;
}while ($pos < 1 && $string[$pos] == ' ');

$replace = mb_strtolower($search, "UTF-8");
if ($pos <= 0 || in_array($string[$pos], array('.','!','?')))
$replace = ucfirst($replace);
$string = str_replace($search, $replace, $string);
}

if ($echo)
echo $string;
else
return $string;
}
//Disable shouting MOD- END
..:: http://www.kontrollrummet.com - Studio och musik ::.. RSS?

kamili34

Thanks for another good mod.

tsmalmbe

Another big or should I say BIG issue is that it breaks links. I have not verfiied yet that it breaks internal, although that too was reported.

but: http://www.foobar.com/the_EBCDIC_keyboard_layout.pdf cannot be linked to, because this mod modifies the link.
..:: http://www.kontrollrummet.com - Studio och musik ::.. RSS?

Gideon

Great mod, thanks...one problem I found is that if anyone links a photo in an [img] tag which is in caps it changes it, and the photo is not visible...

Miyagi

Quote from: michaelnl on August 12, 2007, 02:57:30 PM
Hi,

I think i've found a bug. With sticky topics I get this error:

Notice: Uninitialized string offset: -1 in /home/holland/public_html/smf/Sources/Subs.php on line 3611

Line 3611 is:

$pos--;


And that's part of:

//-Disable shouting MOD- START
function disableShouting($string, $echo = false)
{
global $func, $modSettings;

if (empty($modSettings['disableShouting']))
return $string;

preg_match_all('~[A-Z ]{5,}~',$string, $matches, PREG_OFFSET_CAPTURE);

foreach ($matches[0] as $match)
{
$search = $func['htmltrim']($match[0]);
$pos = $match[1];
do
{
[b]$pos--;[/b]
}while ($pos < 1 && $string[$pos] == ' ');

$replace = strtolower($search);
if ($pos <= 0 || in_array($string[$pos], array('.','!','?')))
$replace = ucfirst($replace);
$string = str_replace($search, $replace, $string);
}

if ($echo)
echo $string;
else
return $string;
}
//Disable shouting MOD- END


I am having this error also!

Rudolf... please help! :)

Thx,
Miyagi
FordXR5Turbo.com - Dedicated to the Ford Focus & Mondeo XR5 Turbo in Australia
FordXR4.com - Dedicated to the Ford Fiesta XR4 in Australia

pinoypetfinder

i need help on installing this theme on my custom made template..
i need to manually install the script on

Admin.template.php  and languages/Admin.english.php .. but what script and where should i place that?

package parser not working :(

H3 Skillz

Could someone tell me how to edit the instalation files (or just the post.php document itself) to allow this just in topic titles?  I really love this mod but I don't like the fact that it does it in the actual post as well as the topic title.  I'm sure this is pretty simple to do but I'm just missing something, could someone help me out with this?

Rudolf

In Display.php
Code (Find and delete) Select
$message['subject'] = disableShouting($message['subject']); //-Disable shouting MOD-

In Post.php
Code (Find and delete) Select
$context['message']['body'] = disableShouting($context['message']['body']);
I will update all my mods in the next few weeks. Thanks for your patience.

SVG-Collapse (you need an SVG compliant browser)

H3 Skillz

#21
Thank you!

Edit: Wait are you sure?  The first one you told me to delete was the subject part, if I wanted to disable shouting in the subject but not the body, wouldn't you delete the body part instead?  I'm not that good at HTML or PHP or anything but I'm pretty sure you have to delete the body part.  Anyway, even when I tried it your way it still didn't seem to work and when I try it my way, it works inside the message (when you view the message) but not when you are viewing it in the forum (like when you see the subjects of all the posted threads in that forum).

Rudolf

yes, it was supposed to be the body part. I copied the wrong line.
I don't understand the problem on the forum index.
I will update all my mods in the next few weeks. Thanks for your patience.

SVG-Collapse (you need an SVG compliant browser)

H3 Skillz

What is the file that displays the forum index?  Maybe I could just figure it out by searching that file for disableshouting and deleting that line of code.

Rudolf

I will update all my mods in the next few weeks. Thanks for your patience.

SVG-Collapse (you need an SVG compliant browser)

H3 Skillz

Hum, that's wierd cuz that page doesn't even have anything about the disable shouting.  When you instal the mod, it doesn't even do anything to that page.  You know, I'm using 1.1.4 and this mod is made for 1.1.3 and it works perfectly when I don't try to modify it so maybe my SMF version has something to do with it.

Goad

bump to see this continue to be developed....i really need this mod but i'd rather live without for broken links (img or url)

m1ss1nnocent

Another bump for continued Dev on this mod.

Is there any way to configure it so that it only un-capitalises when more than say 4 or 5 letters are capital? At present it allows things like MK1 (where only 2 letters are capitals) but as soon as you do 3 or more capitals (FORD for example) it sends it to lower case. Anyone know where the code is to change it from the trigger being 3 letters or more to start converting?

Rudolf

Quote from: m1ss1nnocent on August 18, 2008, 05:43:16 PM
Another bump for continued Dev on this mod.

Is there any way to configure it so that it only un-capitalises when more than say 4 or 5 letters are capital? At present it allows things like MK1 (where only 2 letters are capitals) but as soon as you do 3 or more capitals (FORD for example) it sends it to lower case. Anyone know where the code is to change it from the trigger being 3 letters or more to start converting?

The minimum length of a word lowercased is 5 letters. It shouldn't lowercase FORD.

to change the length find in Subs.php
preg_match_all('~[A-Z ]{5,}~',$string, $matches, PREG_OFFSET_CAPTURE);
and replace the number 5, with the minimum length you want.
I will update all my mods in the next few weeks. Thanks for your patience.

SVG-Collapse (you need an SVG compliant browser)

DarkflameQ

A shame this hasn't been updated to v2.0 RC3

cyberdyne

I have this installed with a custom theme on v.1.1.13. I had to install it manually as the auto install didn't work.
The function works, but I get 2 small errors in the forum logs:

QuoteApply Filter: Only show the errors with the same message
8: Undefined variable: context
File: /home/server/public_html/forum/Sources/Post.php
Line: 2396
Refers to line:
$context['message']['subject'] = disableShouting($context['message']['subject']);



Quote8: Uninitialized string offset: -1
File: /home/server/public_html/forum/Sources/Subs.php
Line: 3692
Refers to line:
}while ($pos < 1 && $string[$pos] == ' ');

Would appreciate any help.
Many thanks
Using:
v.1.1.16
Custom theme (modified SMF Default Theme - Core)
AND
v.2.0.1
Custom theme (modified Bright Forest)

cyberdyne

Rudolf, any ideas please? These errors are filling up my logs! :)
Thanks
Using:
v.1.1.16
Custom theme (modified SMF Default Theme - Core)
AND
v.2.0.1
Custom theme (modified Bright Forest)

kyjeeper

Any shot at this being updated for 2.0.2? I had and loved this mod through 1.1.16, but recently upgraded the forum to 2.0.2 and it is not available.

Thanks!

Advertisement: