Index: trunk/extensions/MeanEditor/MeanEditorEditPage.body.php |
— | — | @@ -293,7 +293,7 @@ |
294 | 294 | return $buttons; |
295 | 295 | } |
296 | 296 | |
297 | | - function substitute_hashed_img_urls($text) { |
| 297 | + static function substitute_hashed_img_urls($text) { |
298 | 298 | while (preg_match('/\[\[Image:(.*?)\]\]/', $text, $matches)) { |
299 | 299 | $img = $matches[1]; |
300 | 300 | $hash = md5($img); |
— | — | @@ -306,7 +306,7 @@ |
307 | 307 | return $text; |
308 | 308 | } |
309 | 309 | |
310 | | - function deny_visual_because_of($reason, &$edit_context) { |
| 310 | + static function deny_visual_because_of($reason, &$edit_context) { |
311 | 311 | global $wgOut; |
312 | 312 | $wgOut->addHTML('<p class="visual_editing_denied errorbox">' . wfMsg('no_visual') . '<em class="visual_editing_denied_reason">'.$reason.'</em></p>'); |
313 | 313 | # FIXME: Doesn't work. Why? |
— | — | @@ -316,13 +316,13 @@ |
317 | 317 | } |
318 | 318 | |
319 | 319 | # Return true to force traditional editing |
320 | | - function wiki2html($article, $user, &$edit_context, &$wiki_text) { |
| 320 | + static function wiki2html($article, $user, &$edit_context, &$wiki_text) { |
321 | 321 | global $wgUploadPath, $wgArticlePath; |
322 | 322 | $meaneditor_page_src = str_replace('$1', '', $wgArticlePath); |
323 | 323 | |
324 | 324 | # Detect code sections (lines beginning with whitespace) |
325 | 325 | if (preg_match('/^[ \t]/m',$wiki_text)) |
326 | | - return deny_visual_because_of(wfMsg('reason_whitespace'), $edit_context); |
| 326 | + return self::deny_visual_because_of(wfMsg('reason_whitespace'), $edit_context); |
327 | 327 | |
328 | 328 | # Detect custom tags: only <br />, super/sub-scripts and references are supported at the moment |
329 | 329 | # TODO: expand the safe list |
— | — | @@ -341,7 +341,7 @@ |
342 | 342 | $wiki_text=str_replace('<sub>','__TEMP__TEMP__sub',$wiki_text); |
343 | 343 | $wiki_text=str_replace('</sub>','__TEMP__TEMP__csub',$wiki_text); |
344 | 344 | if (!((strpos($wiki_text, '<')===FALSE) && (strpos($wiki_text, '>')===FALSE))) |
345 | | - return deny_visual_because_of(wfMsg('reason_tag'), $edit_context); |
| 345 | + return self::deny_visual_because_of(wfMsg('reason_tag'), $edit_context); |
346 | 346 | $wiki_text=str_replace('__TEMP__TEMP__br','<br />', $wiki_text); |
347 | 347 | $wiki_text=str_replace('__TEMP__TEMP__allreferences','references_here',$wiki_text); |
348 | 348 | $wiki_text=str_replace('__TEMP__TEMP__sup','<sup>',$wiki_text); |
— | — | @@ -355,7 +355,7 @@ |
356 | 356 | $unwanted_chars_at_beginning = array(':', ';'); |
357 | 357 | foreach ($unwanted_chars_at_beginning as $uc) |
358 | 358 | if (preg_match('/^'.$uc.'/m',$wiki_text)) |
359 | | - return deny_visual_because_of(wfMsg('reason_indent', $uc), $edit_context); |
| 359 | + return self::deny_visual_because_of(wfMsg('reason_indent', $uc), $edit_context); |
360 | 360 | |
361 | 361 | # <hr>, from Parser.php... TODO: other regexps can be directly stolen from there |
362 | 362 | $wiki_text=preg_replace('/(^|\n)-----*/', '\\1<hr />', $wiki_text); |
— | — | @@ -384,7 +384,7 @@ |
385 | 385 | if (!$wgHashedUploadDirectory) { |
386 | 386 | $wiki_text=preg_replace('/\[\[Image:(.*?)\]\]/','<img alt="\1" src="' . $wgUploadPath . '/\1" />',$wiki_text); |
387 | 387 | } else { |
388 | | - $wiki_text = substitute_hashed_img_urls($wiki_text); |
| 388 | + $wiki_text = self::substitute_hashed_img_urls($wiki_text); |
389 | 389 | } |
390 | 390 | |
391 | 391 | $wiki_text=preg_replace('/\[\[Image:(.*?)\]\]/','<img alt="\1" src="' . $wgUploadPath . '/\1" />',$wiki_text); |
— | — | @@ -395,7 +395,7 @@ |
396 | 396 | |
397 | 397 | #Substitute [[ syntax (internal links) |
398 | 398 | if (preg_match('/\[\[([^|\]]*?):(.*?)\|(.*?)\]\]/',$wiki_text,$unwanted_matches)) |
399 | | - return deny_visual_because_of(wfMsg('reason_special_link', $unwanted_matches[0]), $edit_context); |
| 399 | + return self::deny_visual_because_of(wfMsg('reason_special_link', $unwanted_matches[0]), $edit_context); |
400 | 400 | #Preserve #section links from the draconic feature detection |
401 | 401 | $wiki_text=preg_replace_callback('/\[\[(.*?)\|(.*?)\]\]/', |
402 | 402 | create_function('$matches', 'return "[[".str_replace("#","__TEMP_MEAN_hash",$matches[1])."|".str_replace("#","__TEMP_MEAN_hash",$matches[2])."]]";'), |
— | — | @@ -428,7 +428,7 @@ |
429 | 429 | $unwanted_chars = array('[', ']', '|', '{', '}', '#', '*'); |
430 | 430 | foreach ($unwanted_chars as $uc) |
431 | 431 | if (!($unwanted_match = strpos($wiki_text, $uc) === FALSE)) |
432 | | - return deny_visual_because_of(wfMsg('reason_forbidden_char', $uc), $edit_context); |
| 432 | + return self::deny_visual_because_of(wfMsg('reason_forbidden_char', $uc), $edit_context); |
433 | 433 | |
434 | 434 | # Restore numbered entities |
435 | 435 | $wiki_text=str_replace('__TEMP__MEAN__nument','&#',$wiki_text); |
— | — | @@ -453,7 +453,7 @@ |
454 | 454 | return false; |
455 | 455 | } |
456 | 456 | |
457 | | - function html2wiki($article, $user, &$edit_context, &$html_text) { |
| 457 | + static function html2wiki($article, $user, &$edit_context, &$html_text) { |
458 | 458 | global $wgArticlePath; |
459 | 459 | $meaneditor_page_src = str_replace('$1', '', $wgArticlePath); |
460 | 460 | $meaneditor_page_src_escaped = addcslashes($meaneditor_page_src, '/.'); |
— | — | @@ -518,7 +518,7 @@ |
519 | 519 | return false; |
520 | 520 | } |
521 | 521 | |
522 | | - function showBox(&$edit_context, $html_text, $rows, $cols, $ew) { |
| 522 | + static function showBox(&$edit_context, $html_text, $rows, $cols, $ew) { |
523 | 523 | global $wgOut, $wgArticlePath, $wgStylePath, $wgUploadPath, $wgLang; |
524 | 524 | $wiki_path = str_replace('$1', '', $wgArticlePath); |
525 | 525 | $wgOut->addScriptFile('../../extensions/MeanEditor/wymeditor/jquery/jquery.js'); |