OK, I added one preload point in formdhtmltextarea.php
old code
function codeIcon()
{
$textarea_id = $this->getName();
$code = "<a name='moresmiley'></a>" . "<img src='" . XOOPS_URL . "/images/url.gif' alt='" . _XOOPS_FORM_ALT_URL . "' title='" . _XOOPS_FORM_ALT_URL . "' onclick='xoopsCodeUrl("{$textarea_id}", "" . htmlspecialchars(_ENTERURL, ENT_QUOTES) . "", "" . htmlspecialchars(_ENTERWEBTITLE, ENT_QUOTES) . "");' onmouseover='style.cursor="hand"'/> " . "<img src='" . XOOPS_URL . "/images/email.gif' alt='" . _XOOPS_FORM_ALT_EMAIL . "' title='" . _XOOPS_FORM_ALT_EMAIL . "' onclick='xoopsCodeEmail("{$textarea_id}", "" . htmlspecialchars(_ENTEREMAIL, ENT_QUOTES) . "");' onmouseover='style.cursor="hand"'/> " . "<img src='" . XOOPS_URL . "/images/imgsrc.gif' alt='" . _XOOPS_FORM_ALT_IMG . "' title='" . _XOOPS_FORM_ALT_IMG . "' onclick='xoopsCodeImg("{$textarea_id}", "" . htmlspecialchars(_ENTERIMGURL, ENT_QUOTES) . "", "" . htmlspecialchars(_ENTERIMGPOS, ENT_QUOTES) . "", "" . htmlspecialchars(_IMGPOSRORL, ENT_QUOTES) . "", "" . htmlspecialchars(_ERRORIMGPOS, ENT_QUOTES) . "", "" . htmlspecialchars(_XOOPS_FORM_ALT_ENTERWIDTH, ENT_QUOTES) . "");' onmouseover='style.cursor="hand"'/> " . "<img src='" . XOOPS_URL . "/images/image.gif' alt='" . _XOOPS_FORM_ALT_IMAGE . "' title='" . _XOOPS_FORM_ALT_IMAGE . "' onclick='openWithSelfMain("" . XOOPS_URL . "/imagemanager.php?target={$textarea_id}","imgmanager",400,430);' onmouseover='style.cursor="hand"'/> " . "<img src='" . XOOPS_URL . "/images/smiley.gif' alt='" . _XOOPS_FORM_ALT_SMILEY . "' title='" . _XOOPS_FORM_ALT_SMILEY . "' onclick='openWithSelfMain("" . XOOPS_URL . "/misc.php?action=showpopups&type=smilies&target={$textarea_id}","smilies",300,475);' onmouseover='style.cursor="hand"'/> ";
$myts = &MyTextSanitizer::getInstance();
$extensions = array_filter($myts->config['extensions']);
foreach(array_keys($extensions) as $key) {
$extension = $myts->loadExtension($key);
@list ($encode, $js) = $extension->encode($textarea_id);
if (empty($encode))
continue;
$code .= $encode;
if (! empty($js)) {
$this->js .= $js;
}
}
$code .= "<img src='" . XOOPS_URL . "/images/code.gif' alt='" . _XOOPS_FORM_ALT_CODE . "' title='" . _XOOPS_FORM_ALT_CODE . "' onclick='xoopsCodeCode("{$textarea_id}", "" . htmlspecialchars(_ENTERCODE, ENT_QUOTES) . "");' onmouseover='style.cursor="hand"'/> " . "<img src='" . XOOPS_URL . "/images/quote.gif' alt='" . _XOOPS_FORM_ALT_QUOTE . "' title='" . _XOOPS_FORM_ALT_QUOTE . "' onclick='xoopsCodeQuote("{$textarea_id}", "" . htmlspecialchars(_ENTERQUOTE, ENT_QUOTES) . "");' onmouseover='style.cursor="hand"'/>";
return $code;
}
new code
function codeIcon()
{
$textarea_id = $this->getName();
$code = "<a name='moresmiley'></a>" . "<img src='" . XOOPS_URL . "/images/url.gif' alt='" . _XOOPS_FORM_ALT_URL . "' title='" . _XOOPS_FORM_ALT_URL . "' onclick='xoopsCodeUrl("{$textarea_id}", "" . htmlspecialchars(_ENTERURL, ENT_QUOTES) . "", "" . htmlspecialchars(_ENTERWEBTITLE, ENT_QUOTES) . "");' onmouseover='style.cursor="hand"'/> " . "<img src='" . XOOPS_URL . "/images/email.gif' alt='" . _XOOPS_FORM_ALT_EMAIL . "' title='" . _XOOPS_FORM_ALT_EMAIL . "' onclick='xoopsCodeEmail("{$textarea_id}", "" . htmlspecialchars(_ENTEREMAIL, ENT_QUOTES) . "");' onmouseover='style.cursor="hand"'/> " . "<img src='" . XOOPS_URL . "/images/imgsrc.gif' alt='" . _XOOPS_FORM_ALT_IMG . "' title='" . _XOOPS_FORM_ALT_IMG . "' onclick='xoopsCodeImg("{$textarea_id}", "" . htmlspecialchars(_ENTERIMGURL, ENT_QUOTES) . "", "" . htmlspecialchars(_ENTERIMGPOS, ENT_QUOTES) . "", "" . htmlspecialchars(_IMGPOSRORL, ENT_QUOTES) . "", "" . htmlspecialchars(_ERRORIMGPOS, ENT_QUOTES) . "", "" . htmlspecialchars(_XOOPS_FORM_ALT_ENTERWIDTH, ENT_QUOTES) . "");' onmouseover='style.cursor="hand"'/> " . "<img src='" . XOOPS_URL . "/images/image.gif' alt='" . _XOOPS_FORM_ALT_IMAGE . "' title='" . _XOOPS_FORM_ALT_IMAGE . "' onclick='openWithSelfMain("" . XOOPS_URL . "/imagemanager.php?target={$textarea_id}","imgmanager",400,430);' onmouseover='style.cursor="hand"'/> " . "<img src='" . XOOPS_URL . "/images/smiley.gif' alt='" . _XOOPS_FORM_ALT_SMILEY . "' title='" . _XOOPS_FORM_ALT_SMILEY . "' onclick='openWithSelfMain("" . XOOPS_URL . "/misc.php?action=showpopups&type=smilies&target={$textarea_id}","smilies",300,475);' onmouseover='style.cursor="hand"'/> ";
$myts = &MyTextSanitizer::getInstance();
$extensions = array_filter($myts->config['extensions']);
foreach(array_keys($extensions) as $key) {
$extension = $myts->loadExtension($key);
@list ($encode, $js) = $extension->encode($textarea_id);
if (empty($encode))
continue;
$code .= $encode;
if (! empty($js)) {
$this->js .= $js;
}
}
$code .= "<img src='" . XOOPS_URL . "/images/code.gif' alt='" . _XOOPS_FORM_ALT_CODE . "' title='" . _XOOPS_FORM_ALT_CODE . "' onclick='xoopsCodeCode("{$textarea_id}", "" . htmlspecialchars(_ENTERCODE, ENT_QUOTES) . "");' onmouseover='style.cursor="hand"'/> " . "<img src='" . XOOPS_URL . "/images/quote.gif' alt='" . _XOOPS_FORM_ALT_QUOTE . "' title='" . _XOOPS_FORM_ALT_QUOTE . "' onclick='xoopsCodeQuote("{$textarea_id}", "" . htmlspecialchars(_ENTERQUOTE, ENT_QUOTES) . "");' onmouseover='style.cursor="hand"'/>";
//this is only what was added
$xoopsPreload =& XoopsPreload::getInstance();
$xoopsPreload->triggerEvent('core.class.xoopsform.formdhtmltextarea.codeicon', array(&$code));
return $code;
}
Now you need to create a folder named preloads and a file inside named core.php
Then you add this inside:
<?php
/**
* Image Manager
*
* You may not change or alter any portion of this comment or credits
* of supporting developers from this source code or any supporting source code
* which is considered copyrighted (c) material of the original comment or credit authors.
* This program 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.
*
* @copyright The XOOPS Project http://sourceforge.net/projects/xoops/
* @license http://www.fsf.org/copyleft/gpl.html GNU public license
* @package imagemanager
* @since 2.4.0
* @author trabis <lusopoemas@gmail.com>
* @version $Id: core.php 3333 2009-08-27 10:46:15Z trabis $
*/
defined('XOOPS_ROOT_PATH') or die('Restricted access');
/**
* Image Manager core preloads
*
* @copyright The XOOPS Project http://sourceforge.net/projects/xoops/
* @license http://www.fsf.org/copyleft/gpl.html GNU public license
* @author trabis <lusopoemas@gmail.com>
*/
class ImagemanagerCorePreload extends XoopsPreloadItem
{
function eventCoreClassXoopsformFormdhtmltextareaCodeicon($args)
{
if (ImagemanagerCorePreload::isActive()) {
$args[0] = str_replace('imagemanager.php', 'modules/imagemanager/imagemanager.php', $args[0]);
}
}
function isActive()
{
$module_handler =& xoops_getHandler('module');
$module = $module_handler->getByDirname('imagemanager');
return ($module && $module->getVar('isactive')) ? true : false;
}
}
?>
Working with XOOPS 2.4.0 from trunk.