diff --git a/composer.json b/composer.json
index 139f1ce..1e529f5 100644
--- a/composer.json
+++ b/composer.json
@@ -21,5 +21,10 @@
"composer sqllint"
],
"fix": "phpcbf"
+ },
+ "config": {
+ "allow-plugins": {
+ "dealerdirect/phpcodesniffer-composer-installer": true
+ }
}
}
diff --git a/src/Helper.php b/src/Helper.php
new file mode 100644
index 0000000..e2e48fc
--- /dev/null
+++ b/src/Helper.php
@@ -0,0 +1,15 @@
+' ),
+ -strlen( '' )
+ );
+ }
+
+}
diff --git a/src/Hooks/MainHookHandler.php b/src/Hooks/MainHookHandler.php
index 1619919..1cf9478 100644
--- a/src/Hooks/MainHookHandler.php
+++ b/src/Hooks/MainHookHandler.php
@@ -3,6 +3,7 @@
namespace Liquipedia\Extension\TournamentsMenu\Hooks;
use Liquipedia\Extension\TournamentsMenu\Data;
+use Liquipedia\Extension\TournamentsMenu\Helper;
use MediaWiki\Hook\ParserFirstCallInitHook;
use MediaWiki\Hook\SkinBuildSidebarHook;
use Title;
@@ -70,11 +71,7 @@ public function onSkinBuildSidebar( $skin, &$bar ) {
false
);
if ( strpos( $iconHTML, 'mw-parser-output' ) !== false ) {
- $iconHTML = substr(
- $iconHTML,
- strlen( '
' ),
- -strlen( '
' )
- );
+ $iconHTML = Helper::unwrapHtml( $iconHTML );
}
$text = $iconHTML . ' ' . $text;
}
@@ -95,11 +92,7 @@ public function onSkinBuildSidebar( $skin, &$bar ) {
false
);
if ( strpos( $iconHTML, 'mw-parser-output' ) !== false ) {
- $iconHTML = substr(
- $iconHTML,
- strlen( '' ),
- -strlen( '
' )
- );
+ $iconHTML = Helper::unwrapHtml( $iconHTML );
}
$text = $iconHTML . ' ' . $text;
}
diff --git a/src/ParserFunction.php b/src/ParserFunction.php
index cb9db52..a690274 100644
--- a/src/ParserFunction.php
+++ b/src/ParserFunction.php
@@ -86,11 +86,7 @@ public static function getTournamentsList( $content, $attributes, $parser, $fram
)->getText();
$parserOptions->setOption( 'enableLimitReport', $wasParserReportEnabled );
if ( strpos( $iconHTML, 'mw-parser-output' ) !== false ) {
- $iconHTML = substr(
- $iconHTML,
- strlen( '' ),
- -strlen( '
' )
- );
+ $iconHTML = Helper::unwrapHtml( $iconHTML );
}
$return .= Parser::stripOuterParagraph( $iconHTML );
}
@@ -121,11 +117,7 @@ public static function getTournamentsList( $content, $attributes, $parser, $fram
)->getText();
$parserOptions->setOption( 'enableLimitReport', $wasParserReportEnabled );
if ( strpos( $iconHTML, 'mw-parser-output' ) !== false ) {
- $iconHTML = substr(
- $iconHTML,
- strlen( '' ),
- -strlen( '
' )
- );
+ $iconHTML = Helper::unwrapHtml( $iconHTML );
}
$return .= Parser::stripOuterParagraph( $iconHTML );
}