Subs.php Case Insensitive

Started by Servious, July 09, 2009, 04:33:44 PM

Previous topic - Next topic

Servious

I was looking at an old MOD to make smileys case insensitive. so  :smile: and SmIlE would be the same thing.

It said it worked with 2.0 beta 3    but it will not work with RC1 and the maker has since left the community.

It does not work with RC1 because the line it is suppose to change is formatted differently now unless i'm looking at the wrong line.

It appears as though it wants to edit this from the RC1 subs.php
$smileyPregSearch = '~(?<=[>:\?\.\s' . $non_breaking_space . '[\]()*\\\;]|^)(' . implode('|', $searchParts) . ')(?=[^[:alpha:]0-9]|$)~e' . ($context['utf8'] ? 'u' : '');


The old line in previous versions read as:
$smileyfromcache[] = '/(?<=[>:\?\.\s' . $non_breaking_space . '[\]()*\\\;]|^)(' . preg_quote($smileysfrom[$i], '/') . '|' . preg_quote(htmlspecialchars($smileysfrom[$i], ENT_QUOTES), '/') . ')(?=[^[:alpha:]0-9]|$)/' . ($context['utf8'] ? 'u' : '');

Now in the old version all you have to do to make it case insensitive is add an   i   after   ?=[^[:alpha:]0-9]|$)/ and it would be all fine and dandy.

In the new code there is an ~e  and any modification to that seems to cause major problems weather a php error, all posts disappearing or just when it's suppose to be case insensitive it just deletes the word.

Any help on this issue would be greatly appreciated.

Servious

Bump,

Really no one? Is it an impossible request?

[SiNaN]

See if this works:

Code (Find) Select
$smileyPregReplacements[$smileysfrom[$i]]

Code (Replace) Select
$smileyPregReplacements[strtolower($smileysfrom[$i])]

Code (Find) Select
$smileyPregReplacements[htmlspecialchars($smileysfrom[$i], ENT_QUOTES)]

Code (Replace) Select
$smileyPregReplacements[strtolower(htmlspecialchars($smileysfrom[$i], ENT_QUOTES))]

Code (Find) Select
(?=[^[:alpha:]0-9]|$)~e

Code (Replace) Select
(?=[^[:alpha:]0-9]|$)~ei

Code (Find) Select
isset($smileyPregReplacements[\'$1\']) ? $smileyPregReplacements[\'$1\']

Code (Replace) Select
isset($smileyPregReplacements[strtolower(\'$1\')]) ? $smileyPregReplacements[strtolower(\'$1\')]
Former SMF Core Developer | My Mods | SimplePortal

Servious

It works great  i can put any combination of caps and lowercase with my custom smilies and they work. Thank you very much.

I'd suggest making this a mod for RC-1 :D

[SiNaN]

My pleasure. Marked as solved. ;)
Former SMF Core Developer | My Mods | SimplePortal

Advertisement: