PDA

View Full Version : Case-Insensitive Smilies.


Dilmah
05-13-2005, 11:52 PM
I imagine this is a fairly easy modification to write, i'm guessing perhaps adding a strtoupper or lower or something somewhere.

What I want to do is make a "catch-all" for my smilies, whereby typing the smilie code in any case will make it work. At the moment only lower case works. I don't want to have to create duplicates of each of my smilies just to get upper case to work as well. Is this possible? I'm using vb 3.0.7.

Zero Tolerance
05-14-2005, 12:00 AM
Well this is a minor edit, shouldn't cause any problems from what i can see, open includes/functions_bbcodeparse.php
Find:
$bbcode = preg_replace('#(?<!&amp|&quot|&lt|&gt|&copy)' . preg_quote($smiliefind, '#') . '#s', $smilie_replace["$smiliekey"], $bbcode);
Replace with:
$bbcode = preg_replace('#(?<!&amp|&quot|&lt|&gt|&copy)' . preg_quote($smiliefind, '#') . '#is', $smilie_replace["$smiliekey"], $bbcode);

Should work just fine then - but i havn't tested it.

- Zero Tolerance

Dilmah
05-15-2005, 12:13 PM
Works perfectly.

Cheers.

Electronic Punk
08-31-2005, 09:27 PM
is there a similar change that can be made for 3.5?

Jayphen
08-15-2006, 05:00 AM
Bump.

Anyone know how to do this in 3.6?

Freesteyelz
08-16-2006, 03:28 AM
I wonder...

At least for 3.6.0 in /includes/class_bbcode.php find:


$text = preg_replace('/(?<!&amp|&quot|&lt|&gt|&copy|&#[0-9]{1}|&#[0-9]{2}|&#[0-9]{3}|&#[0-9]{4}|&#[0-9]{5})' . preg_quote($find, '/') . '/s', $replace, $text);


And replace it with:


$text = preg_replace('/(?<!&amp|&quot|&lt|&gt|&copy|&#[0-9]{1}|&#[0-9]{2}|&#[0-9]{3}|&#[0-9]{4}|&#[0-9]{5})' . preg_quote($find, '/') . '/is', $replace, $text);


I haven't tested it.

Jayphen
08-17-2006, 02:28 AM
That works buddy :) Thanks alot.

Freesteyelz
08-17-2006, 02:34 AM
Cool. :)

Jon
08-23-2007, 10:27 AM
This no longer seems to work (in 3.6.8 at least). Anyone?

Jon
09-18-2007, 07:31 PM
*bump*

Dismounted
09-19-2007, 06:04 AM
In /includes/class_bbcode.php, find (2 instances):
$text = preg_replace_callback('/(?<!&amp|&quot|&lt|&gt|&copy|&#[0-9]{1}|&#[0-9]{2}|&#[0-9]{3}|&#[0-9]{4}|&#[0-9]{5})(' . implode('|', $quoted) . ')/s', array(&$this, 'replace_smilies'), $text);
Replace With:
$text = preg_replace_callback('/(?<!&amp|&quot|&lt|&gt|&copy|&#[0-9]{1}|&#[0-9]{2}|&#[0-9]{3}|&#[0-9]{4}|&#[0-9]{5})(' . implode('|', $quoted) . ')/is', array(&$this, 'replace_smilies'), $text);

Jon
09-19-2007, 09:13 AM
Thanks, but that doesn't work. When I post the (Y)-smilie now it returns nothing.

Jon
09-29-2007, 06:34 AM
*another bump*

IrPr
11-03-2007, 03:13 PM
me 2
bump

BrandiDup
11-03-2007, 03:24 PM
Oh, I've been wondering the same exact thing. Is anyone aware of a solution that works for 3.6.8? This would be great b/c my fat fingers sometimes hold the shift key a little too long and I end up leaving the first letter as a cap, so the smilie doesn't show.

IrPr
11-03-2007, 04:47 PM
Ok, this works for me

Find (2 instances):
$text = preg_replace_callback('/(?<!&amp|&quot|&lt|&gt|&copy|&#[0-9]{1}|&#[0-9]{2}|&#[0-9]{3}|&#[0-9]{4}|&#[0-9]{5})(' . implode('|', $quoted) . ')/s', array(&$this, 'replace_smilies'), $text);
Replace with:
$text = preg_replace_callback('/(?<!&amp|&quot|&lt|&gt|&copy|&#[0-9]{1}|&#[0-9]{2}|&#[0-9]{3}|&#[0-9]{4}|&#[0-9]{5})(' . implode('|', $quoted) . ')/is', array(&$this, 'replace_smilies'), $text);



Find (2 instances):
$find = htmlspecialchars_uni(trim($smilie['smilietext']));
Replace with:
$find = strtolower(htmlspecialchars_uni(trim($smilie['smilietext'])));



Find (2 instances):
$find = trim($smilie['smilietext']);
Replace with:
$find = strtolower(trim($smilie['smilietext']));



Find:
return $this->local_smilies["$matches[0]"];

Add this above that:
$matches[0] = strtolower($matches[0]);

Analogpoint
11-03-2007, 07:46 PM
If anyone's interested in having vB support case-insensitive smilies out of the box, you might consider chiming in on this poll.

http://www.vbulletin.com/forum/showthread.php?t=247519

Jon
11-05-2007, 06:26 AM
Ok, this works for me

[...]


Works like a charm. Thanks a bunch!