function smarty_function_ck4dhtmltarea($params, &$smarty) { if (isset($params['name'])) { $js = Ckeditor4_Utils::getJS($params); if ($js) { if (version_compare(LEGACY_BASE_VERSION, '2.2', '>=')) { // Add script into HEAD $root =& XCube_Root::getSingleton(); $jQuery = $root->mContext->getAttribute('headerScript'); $jQuery->addScript($js); $jQuery->addLibrary('/modules/ckeditor4/ckeditor/ckeditor.js'); $addScript = ''; } else { $xoopsURL = XOOPS_URL; $addScript = <<<EOD <script type="text/javascript"> if (typeof jQuery != 'undefined') { \tjQuery(function(\$){ \t\t{$js} \t}); } </script> <script type="text/javascript" src="{$xoopsURL}/modules/ckeditor4/ckeditor/ckeditor.js"></script> EOD; //$smarty->assign( 'xoops_module_header', $smarty->get_template_vars( 'xoops_module_header' ) . $addScript ); } } // // Build the object for output. // print '<textarea name="' . $params['name'] . '" class="' . $params['class'] . '" style="' . $params['style'] . '" cols="' . $params['cols'] . '" rows="' . $params['rows'] . '" id="' . $params['id'] . '">' . $params['value'] . '</textarea>' . $addScript; } }
/** * @public */ public function render(&$html, $params) { $js = Ckeditor4_Utils::getJS($params); $root =& XCube_Root::getSingleton(); $renderSystem =& $root->getRenderSystem(XOOPSFORM_DEPENDENCE_RENDER_SYSTEM); $renderTarget =& $renderSystem->createRenderTarget('main'); $renderTarget->setAttribute('legacy_module', 'ckeditor4'); $renderTarget->setTemplateName("ckeditor4_textarea.html"); $renderTarget->setAttribute("ckeditor4_params", $params); $renderSystem->render($renderTarget); $html = $renderTarget->getResult(); if (strpos($params['value'], '<!--norich-->') === false) { // Add script into HEAD $jQuery = $root->mContext->getAttribute('headerScript'); $jQuery->addScript($js); $jQuery->addLibrary('/modules/ckeditor4/ckeditor/ckeditor.js'); } }
<?php require_once '../../../mainfile.php'; require_once XOOPS_ROOT_PATH . '/header.php'; require_once XOOPS_ROOT_PATH . '/modules/ckeditor4/class/Ckeditor4Utiles.class.php'; $mid = Ckeditor4_Utils::getMid(); if (defined('LEGACY_BASE_VERSION')) { $pref = XOOPS_MODULE_URL . '/legacy/admin/index.php?action=PreferenceEdit&confmod_id='; $help = '<li><a href="' . XOOPS_MODULE_URL . '/legacy/admin/index.php?action=Help&dirname=ckeditor4">' . _HELP . '</a></li>'; } else { $pref = XOOPS_URL . '/modules/system/admin.php?fct=preferences&op=showmod&mod='; $help = ''; } ?> <h3>CKEditor 4 for XOOPS Cube Legacy</h3> <hr /> <ul> <li><a href="<?php echo $pref . $mid; ?> "><?php echo _PREFERENCES; ?> </a></li> <?php echo $help; ?> </ul>