Copyright 2008, Red Hat, Inc., All rights reserved. Rewritten from Joseph Socoloski's original tinymce extension; moves logic to the tinymce plugin framework This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ if( !defined( 'MEDIAWIKI' ) ) { die(); } $wgExtensionCredits['other'][] = array( "name" => "Next-gen TinyMCE MediaWiki extension", "author" => "Bret McMillan ", "version" => "0.1", "url" => "http://www.redhat.com/", "description" => "Easily implement Moxiecode's TinyMCE into MediaWiki using the plugin framework (rework of Joseph Socoloski's original work)" ); # REGISTER HOOKS $wgHooks['ArticleAfterFetchContent'][] = 'wfCheckBeforeEdit'; $wgHooks['EditPage::showEditForm:initial'][] = 'wfTinymceAddScript'; function wfTinymceAddScript($q) { global $wgOut, $wgScriptPath; # use the more modern example straight from moxiecode $wgOut->addScript(""); $wgOut->addScript( "" ); # Since editing add the button $wgOut->addHTML("

Toggle Visual Editor

"); return true; } # Check existing article for any tags we don't want TinyMCE parsing... function wfCheckBeforeEdit ($q, $text) { global $wgUseTinymce; if (preg_match("|<(data.*?)>(.*?)</data>|is", $text, $a)) { $wgUseTinymce = false; } elseif(preg_match("|<(data.*?)>(.*?)|is", $text, $a)) { $wgUseTinymce = false;} else{$wgUseTinymce = true;} return true; } ?>