Last modified: 2013-07-10 13:11:08 UTC
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.
Created attachment 12813 [details] malfunction in the ParserAfterTidy Hook The member, who developed the workaround has debugged the problem deep in the MediaWiki code. She said the following things: 1.) The malfunction is appeared at the ParserAfterTidy hook from the MediaWiki code. 2.) The hook calls two things. One of this things is the TinyMCE. 3.) After the call from TinyMCE the MediaWiki heading tags are switched in the HTML-Tags. 4.) After the call of the ParserAfterTidy hook the text has no changes. In her opinion the out-parameter doesn't work correctly. In the attachment is an logfile names Fehlverhalten-im-Hook.txt, where an example is debugged for the malfunction without the workaround. We hope, that u can fix the problem.