Pwirth has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/332226 )

Change subject: BSEmoticons: Fixed replacing in tags and their attributes
......................................................................

BSEmoticons: Fixed replacing in tags and their attributes

Change-Id: I8628d16c273206dc74e11cf9d6ea9d12bdfb6093
---
M Emoticons/Emoticons.class.php
1 file changed, 14 insertions(+), 1 deletion(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/BlueSpiceExtensions 
refs/changes/26/332226/1

diff --git a/Emoticons/Emoticons.class.php b/Emoticons/Emoticons.class.php
index f254d06..3308ed0 100644
--- a/Emoticons/Emoticons.class.php
+++ b/Emoticons/Emoticons.class.php
@@ -129,7 +129,20 @@
                        BsCacheHelper::set( $sKey, $aMapping );
                }
 
-               $sText = str_replace( $aMapping['emoticons'], 
$aMapping['replacements'], $sText );
+               $fCallable = function( $aMatches ) use( $aMapping ) {
+                       return empty( $aMatches[0] ) ? '' : str_replace(
+                               $aMapping['emoticons'],
+                               $aMapping['replacements'],
+                               $aMatches[0]
+                       );
+               };
+               //only replace in actual text and not in html tags or their 
attributes!
+               $sText = preg_replace_callback(
+                       "/(?<=>)[^><]+?(?=<)/",
+                       $fCallable,
+                       $sText
+               );
+
                wfProfileOut( 'BS::'.__METHOD__ );
                return true;
        }

-- 
To view, visit https://gerrit.wikimedia.org/r/332226
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I8628d16c273206dc74e11cf9d6ea9d12bdfb6093
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/BlueSpiceExtensions
Gerrit-Branch: master
Gerrit-Owner: Pwirth <wi...@hallowelt.biz>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to