https://bugzilla.wikimedia.org/show_bug.cgi?id=50928
Web browser: ---
Bug ID: 50928
Summary: TinyMCE_MW Extension don't handle headings with php
5.5, if the headings dont stand alone
Product: MediaWiki extensions
Version: REL1_20 branch
Hardware: All
OS: All
Status: UNCONFIRMED
Severity: normal
Priority: Unprioritized
Component: General/Unknown
Assignee: [email protected]
Reporter: [email protected]
Classification: Unclassified
Mobile Platform: ---
I installed in my Wiki the TinyMCE extension. The webhoster bplaced.net
switched from the php Version 5.4 to 5.5. After that change the TinyMCE
extension can't handle the headings from the Wikilanguage anymore, if there is
some other stuff in the same line. The following code shall handle it (for
example):
TinyMCE_MW.php:
#====level 3====
while (preg_match("|====.*?====|is", $tinymcetext, $a))
{
$value = implode(",", $a);
$value = str_replace("====", "", $value);
$r = preg_replace("|====.*?====|is", "<h4>".$value."</h4>", $a[0]);
$tinymcetext = str_replace($a[0], html_entity_decode($r), $tinymcetext);
}
The attributs are valide, but the "====" isn't change to a <h4>-HTML-Tag, if
the "===="-tag don't stand alone in a line. For example:
<p>====HEADING====</p>
This example isn't parse from the normal TinyMCE_MW extension. If the heading
stands alone in a line for example
....some stuff....
====HEADING====
....some other stuff....
it works fine.
A member of my Wikiadministrator stuff developed a workaround for this problem.
You must comment the code form TinyMCE_MW.php and add some code in the
parser.php:
/**
* Parse headers and return html
* @private
* @param $text string
* @return string
*/
function doHeadings( $text ) {
wfProfileIn( __METHOD__ );
######################################################
# Workaround by Kitty
# - Just go down to 2: h1 grabs a lot
for ( $i = 6; $i >= 2; --$i ) {
$h = str_repeat( '=', $i );
# Pattern can be found everywhere. Removed ^ and $, added non greedy
$text = preg_replace( "/$h(.+?)$h/m", "<h$i>\\1</h$i>", $text );
# Resolve text
$text = htmlspecialchars_decode($text);
}
wfProfileOut( __METHOD__ );
return $text;
}
This function is parsing the heading in the html-Tag. Maybe there is an other
option for fix the problem.
--
You are receiving this mail because:
You are the assignee for the bug.
You are on the CC list for the bug.
_______________________________________________
Wikibugs-l mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/wikibugs-l