5
Maybe a better way is to have a /modules/oledrion/class/themeform.php
<?php
defined('XOOPS_ROOT_PATH') or die('Restricted access');
xoops_load('XoopsForm');
xoops_load('XoopsThemeForm');
class OledrionThemeForm extends XoopsThemeForm
{
function insertBreak($extra = '', $class = '')
{
$class = ($class != '') ? " class='" . preg_replace('/[^A-Za-z0-9ss_-]/i', '', $class) . "'" : '';
if ($extra) {
$extra = '' . $class . '' . $extra . '';
$this->addElement($extra);
} else {
$extra = '' . $class . '';
$this->addElement($extra);
}
}
function render()
{
$ele_name = $this->getName();
$ret = '<form name="' . $ele_name . '" id="' . $ele_name . '" action="' . $this->getAction() . '" method="' . $this->getMethod() . '" onsubmit="return xoopsFormValidate_' . $ele_name . '();"' . $this->getExtra() . '><div class="header-form">' . $this->getTitle() . '</div>';
$hidden = '';
$class = '';
foreach ($this->getElements() as $ele) {
if (!is_object($ele)) {
$ret .= $ele;
} else if (!$ele->isHidden()) {
if (!$ele->getNocolspan()) {
$ret .= '';
if (($caption = $ele->getCaption()) != '') {
$ret .= '';
$ret .= '' . $caption . '';
$ret .= '';
$ret .= '';
}
if (($desc = $ele->getDescription()) != '') {
$ret .= '' . $desc . '';
}
$ret .= '' . $ele->render() . '' . NWLINE;
} else {
$ret .= '';
if (($caption = $ele->getCaption()) != '') {
$ret .= '';
$ret .= '' . $caption . '';
$ret .= '';
$ret .= '';
}
$ret .= '' . $ele->render() . '';
}
} else {
$hidden .= $ele->render();
}
}
$ret .= '' . NWLINE . ' ' . $hidden . '</form>' . NWLINE;
$ret .= $this->renderValidationJS(true);
return $ret;
}
}
?>
(To you to test.)
In Oledrion, everywhere an XoopsThemeForm is used, it has to be renamed to OledrionThemeForm and the /modules/oledrion/class/themeform.php included.
eg in checkout.php
$sform = new XoopsThemeForm(_OLEDRION_PLEASE_ENTER, "informationfrm", OLEDRION_URL.'checkout.php', 'post');
=>
$sform = new OledrionThemeForm(_OLEDRION_PLEASE_ENTER, "informationfrm", OLEDRION_URL.'checkout.php', 'post');
Advantage are that
- the core stays unmodified.
- the differences are transparent and obvious.
- installing Oledrion in an other directory (cloning) doesn't need adaptation.
-