baseUrl = $this->getAdminURL(); // hardcoded relative path to avoid domain security issues (IE6 'Access is denied' error) global $CONF; $this->baseUrl = str_replace ($CONF['AdminURL'],'',$this->getAdminURL()); } function getName() { return 'TinyMCE 2RC3'; } function getAuthor() { return 'karma | roel | eph'; } function getURL() { return 'http://demuynck.org/'; } function getVersion() { return '0.9c'; } function getMinNucleusVersion() { return 300; } function getDescription() { return 'WYSIWYG XHTML 1.0 editor. Mozilla, MSIE and FireFox (Safari experimental).'; } /** * Make sure plugin still works when a database table prefix is activated for * the Nucleus installation. (Nucleus refuses to install plugins which do not * support SqlTablePrefix when a database prefix is active) */ function supportsFeature($what) { switch($what) { case 'HelpPage': return 0; break; case 'SqlTablePrefix': return 1; break; default: return 0; } } function install() { // create plugin options (per-blog options) $this->createBlogOption('use_tinymce', 'Use TinyMCE editor', 'yesno', 'yes'); // create plugin options (admin) $this->createOption('use_tgzip', 'Use TinyMCE GZip compression (experimental)', 'yesno', 'no'); // disable the default javascript editbar that comes with nucleus mysql_query("UPDATE ".sql_table('config')." SET value='1' WHERE name='DisableJSTools'"); // disable auto-linebreak conversions $this->setLinebreakConversion(0); } function setLinebreakConversion($mode) { // modify auto-linebreak on the fly. Thx to alfmiti :) mysql_query("UPDATE ".sql_table('blog')." SET bconvertbreaks=".$mode); } function unInstall() { // restore to standard settings $this->setLinebreakConversion(1); mysql_query("UPDATE ".sql_table('config')." SET value='2' WHERE name='DisableJSTools'"); } /** * List of events we want to subscribe to */ function getEventList() { return array( 'AdminPrePageHead', // include javascript on admin add/edit pages 'BookmarkletExtraHead', // include javascript on bookmarklet pages 'PreSendContentType' // we need to force text/html instead of application/xhtml+xml ); } /** * Hook into the
section of bookmarkler area pages. * Insert extra script/css includes there. */ function event_BookmarkletExtraHead(&$data) { $this->_getExtraHead($data['extrahead']); } /** * Hook into the section of admin area pages. When the requested page is an "add item" or * "edit item" form, include the extra code. */ function event_AdminPrePageHead(&$data) { $action = $data['action']; if (($action != 'createitem') && ($action != 'itemedit')) return; $this->_getExtraHead($data['extrahead']); } /** * Returns the extra code that needs to be inserted in the ... section of pages that * use tinyMCE */ function _getExtraHead(&$extrahead) { global $CONF, $manager; // Found no function to detect blogid in this time -> do the long way if (is_array($manager->blogs)) { $tmp_keys = array_keys($manager->blogs); $blogid = $tmp_keys[0]; } // get the options for the current blog $bUseEditor = ($this->getBlogOption($blogid, 'use_tinymce') == 'yes'); // add code for html editor if ($bUseEditor) { // To avoid conflicts if a other user use only textmode we must set this on all calls $CONF['DisableJsTools'] = 1; // overrule simple global settings $this->setLinebreakConversion(0); // GZip compression? if ($this->getOption('use_tgzip') == 'yes') $editorCode = ''; else $editorCode = ''; if(_CHARSET == 'UTF-8'){ $lang_jp = 'ja_utf8'; }elseif(_CHARSET == 'EUC-JP'){ $lang_jp = 'ja_euc'; }else{ $lang_jp = 'en'; } $editorCode .= <<