vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   Modification Requests/Questions (Unpaid) (https://vborg.vbsupport.ru/forumdisplay.php?f=112)
-   -   Case-Insensitive Smilies. (https://vborg.vbsupport.ru/showthread.php?t=81450)

Dilmah 05-13-2005 11:52 PM

Case-Insensitive Smilies.
 
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:
Code:

$bbcode = preg_replace('#(?<!&amp|&quot|&lt|&gt|&copy)' . preg_quote($smiliefind, '#') . '#s', $smilie_replace["$smiliekey"], $bbcode);
Replace with:
Code:

$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:

Code:

                        $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:

Code:

                        $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):
PHP Code:

$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:
PHP Code:

$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):
PHP Code:

$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:
PHP Code:

$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):
PHP Code:

$find htmlspecialchars_uni(trim($smilie['smilietext'])); 

Replace with:
PHP Code:

$find strtolower(htmlspecialchars_uni(trim($smilie['smilietext']))); 



Find (2 instances):
PHP Code:

$find trim($smilie['smilietext']); 

Replace with:
PHP Code:

$find strtolower(trim($smilie['smilietext'])); 



Find:
PHP Code:

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

Add this above that:
PHP Code:

$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

Quote:

Originally Posted by IrPr (Post 1374924)
Ok, this works for me

[...]

Works like a charm. Thanks a bunch!


All times are GMT. The time now is 05:50 PM.

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.01176 seconds
  • Memory Usage 1,768KB
  • 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
  • (4)bbcode_code_printable
  • (10)bbcode_php_printable
  • (1)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (18)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