Files
zurawik.pl/core/plugins/Smarty/function.insertFckEditor.php
2026-05-15 18:33:51 +02:00

71 lines
2.0 KiB
PHP

<?php
/**
* @author krku
*/
include_once(dirname(__FILE__) . '/function.formField.php');
//Via PHP
function smarty_function_insertFckEditor($params, &$smarty) {
include_once("plugins/fckeditor/fckeditor_php5.php");
$oFCKeditor = new FCKeditor($params['name']);
$oFCKeditor->BasePath = URL_MAIN.'/plugins/fckeditor/';
$oFCKeditor->ToolbarSet = (isset($params['toolbar']) ? $params['toolbar'] : 'Basic');
$oFCKeditor->InstanceName = $params['name'];
if (isset($params['width'])) {
$oFCKeditor->Width = $params['width'];
}
if (isset($params['height'])) {
$oFCKeditor->Height = $params['height'];
}
if (isset($params['value']) && is_string($params['value'])) {
$oFCKeditor->Value = $params['value'];
}
else if (Request::Check($params['name'])) {
$oFCKeditor->Value = Request::Get($params['name']);
}
$smarty->assign('fck' . ucfirst($params['name']), $oFCKeditor);
$ffParams = array('type' => 'hidden', 'name' => $params['name'] . 'FromFCK', 'id' => $params['name'] . 'FromFCK', 'style' => 'display: none;');
return $oFCKeditor->Create() . "\n" . smarty_function_formField($ffParams, $smarty);
}
////Via Javascript
//function smarty_function_insertFckEditor($params, &$smarty) {
// $name = 'oFCKeditor' . ucfirst($params['name']);
//
// $ret = '<script language="javascript" type="text/javascript">' .
// "var $name = new FCKeditor('$params[name]') ;
//
// $name.Config['ToolbarStartExpanded'] = false ;
// $name.BasePath = 'plugins/fckeditor/';
// $name.ToolbarSet = '$params[toolbar]' ;";
// if (isset($params['width'])) {
// $ret .= "$name.Width = $params[width];";
// }
//
// if (isset($params['height'])) {
// $ret .= "$name.Height = $params[height];";
// }
//
// if (isset($params['value']) && is_string($params['value'])) {
// $ret .= "$name.Value = $params[value];";
// }
// else if (Request::Check($params['name'])) {
// $ret .= "$name.Value = $params[value];";
// }
//
// $ret .= "$name.Create() ;";
//
// $ret .= "</script>";
// return $ret;
//}
?>