示例#1
1
 function CreateEmail($mailto = '', $subject = '', $text = '')
 {
     $this->AddStrings($row);
     if ($mailto == 'use_client_selection' && $_SESSION['use_client_selection']) {
         $client_selection = join(' AND ', $_SESSION['use_client_selection']);
         $row['use_client_selection'] = '1';
         $emails = $this->GetValue("SELECT COUNT(*) FROM clients AS c WHERE subscribe=1 AND " . $client_selection);
         $row['mailto'] = sprintf($this->str('client_selection'), $emails);
         $row['mailto_readonly'] = 'READONLY';
     } else {
         $row['mailto'] = htmlspecialchars($mailto);
         $row['use_client_selection'] = '0';
         $row['client_selector']['value'] = ' ';
     }
     $row['subject'] = htmlspecialchars($subject);
     $managers = sql_getRows("SELECT id, CONCAT(fullname,' &lt;',email,'&gt;') FROM admins WHERE email<>'' " . (is_root() ? '' : "AND id IN (" . join(',', $this->user['subst']) . ") AND fullname!=''") . " ORDER BY fullname", true);
     $row['managers'] = $this->GetArrayOptions($managers, $this->user['id'], true);
     ###
     include "editor/fckeditor.php";
     $oFCKeditor = new FCKeditor();
     $oFCKeditor->ToolbarSet = 'Common';
     $oFCKeditor->Value = $text;
     $row['editor'] = $oFCKeditor->ReturnFCKeditor('editor[html]', '100%', '100%');
     ###
     return Parse($row, $this->name . '.tmpl');
 }
示例#2
0
 /**
  * @param $name 隐藏字段名
  * @param $value 隐藏字段值
  * @param $toolbar 工具栏样式,可选值 Basic Default
  * @param $skin 面板,可选值 default office2003 silver
  * @param $Lang 语言,可选值 zh-cn zh e
  *
  */
 public function htmlEdit($name, $value, $height = 420, $width = 720, $toolbar = 'Default', $skin = 'office2003', $Lang = 'en')
 {
     require_once __SITE_ROOT__ . DS . "www/js/FCKeditor/fckeditor.php";
     $sBasePath = "/js/FCKeditor/";
     $oFCKeditor = new FCKeditor($name);
     $oFCKeditor->BasePath = $sBasePath;
     if ($Lang) {
         $oFCKeditor->Config['AutoDetectLanguage'] = false;
     }
     if ($Lang) {
         $oFCKeditor->Config['DefaultLanguage'] = $Lang;
     }
     if ($skin) {
         $oFCKeditor->Config['SkinPath'] = $sBasePath . 'editor/skins/' . $skin . '/';
     }
     if ($toolbar) {
         $oFCKeditor->ToolbarSet = $toolbar;
     }
     if ($width) {
         $oFCKeditor->Width = $width;
     }
     if ($height) {
         $oFCKeditor->Height = $height;
     }
     $oFCKeditor->Value = $value;
     return $oFCKeditor->CreateHtml();
 }
示例#3
0
 function editor($fieldname, $content)
 {
     if (!is_file($this->coderoot . '/fckeditor/fckeditor.php')) {
         return '<textarea name="' . $fieldname . '">' . htmlspecialchars($content) . '</textarea>';
     }
     include_once $this->coderoot . '/fckeditor/fckeditor.php';
     if (!class_exists('FCKeditor')) {
         return 'Editor class not found';
     }
     $oFCKeditor = new FCKeditor($fieldname);
     $fckPath = getConfig("fckeditor_path");
     $oFCKeditor->BasePath = $fckPath;
     $oFCKeditor->ToolbarSet = 'Default';
     $oFCKeditor->Value = $content;
     $w = getConfig("fckeditor_width");
     $h = getConfig("fckeditor_height");
     if (isset($_SESSION["fckeditor_height"])) {
         $h = sprintf('%d', $_SESSION["fckeditor_height"]);
     }
     # for version 2.0
     if ($h < 400) {
         $h = 400;
     }
     $oFCKeditor->Height = $h;
     $oFCKeditor->Width = $w;
     return $oFCKeditor->CreateHtml();
 }
示例#4
0
function form_fckeditor($data = '', $value = '', $extra = '')
{
    $CI =& get_instance();
    $fckeditor_basepath = $CI->config->item('fckeditor_basepath');
    require_once $_SERVER["DOCUMENT_ROOT"] . '/' . $fckeditor_basepath . 'fckeditor.php';
    $instanceName = is_array($data) && isset($data['name']) ? $data['name'] : $data;
    $fckeditor = new FCKeditor($instanceName);
    if ($fckeditor->IsCompatible()) {
        $fckeditor->Value = html_entity_decode($value);
        $fckeditor->BasePath = $fckeditor_basepath;
        if ($fckeditor_toolbarset = $CI->config->item('fckeditor_toolbarset_default')) {
            $fckeditor->ToolbarSet = $fckeditor_toolbarset;
        }
        if (is_array($data)) {
            if (isset($data['value'])) {
                $fckeditor->Value = html_entity_decode($data['value']);
            }
            if (isset($data['basepath'])) {
                $fckeditor->BasePath = $data['basepath'];
            }
            if (isset($data['toolbarset'])) {
                $fckeditor->ToolbarSet = $data['toolbarset'];
            }
            if (isset($data['width'])) {
                $fckeditor->Width = $data['width'];
            }
            if (isset($data['height'])) {
                $fckeditor->Height = $data['height'];
            }
        }
        return $fckeditor->CreateHtml();
    } else {
        return form_textarea($data, $value, $extra);
    }
}
示例#5
0
function editor($input_name, $input_value, $height = "480", $upfile = true)
{
    $prefix = Swoole\Auth::$session_prefix;
    $editor = new FCKeditor($input_name);
    if (substr(WEBPATH, -1, 1) == '/') {
        $editor->BasePath = WEBROOT . "/swoole_plugin/fckeditor/";
        //指定编辑器路径
    } else {
        $editor->BasePath = WEBROOT . "swoole_plugin/fckeditor/";
        //指定编辑器路径
    }
    $editor->ToolbarSet = "Default";
    //编辑器工具栏有Basic(基本工具),Default(所有工具)选择
    $editor->Width = "100%";
    $editor->Height = $height;
    $editor->Value = $input_value;
    $editor->Config['AutoDetectLanguage'] = true;
    $editor->Config['DefaultLanguage'] = 'en';
    $FCKeditor = $editor->CreateHtml();
    $ext = <<<HTML
<script language="javascript">
function upfile_success(filepath)
{
\tvar fck = FCKeditorAPI.GetInstance("content");
\tfck.InsertHtml("<img src='"+ filepath +"' />");
}
</script>
<iframe src="{$editor->BasePath}plus/upload_image.php?prefix={$prefix}" height="40" width="100%" frameborder="0" scrolling="no"></iframe>
HTML;
    if ($upfile) {
        $FCKeditor .= $ext;
    }
    return $FCKeditor;
}
示例#6
0
 /**
  * Get the current user
  *
  * @return  NovemberUser
  */
 public function FCKEditor($name, $value = '', $basePath = '')
 {
     $oFCKeditor = new FCKeditor($name);
     $oFCKeditor->BasePath = $basePath . '/';
     $oFCKeditor->Value = $value;
     $oFCKeditor->Create();
 }
 public function cmsEditor($name, $value, $options = null, $width = '100%', $height = '350')
 {
     //1. Nhung tap tin fckeditor vao file chay
     require_once SCRIPTS_PATH . "/fckeditor/fckeditor_php5.php";
     //2. Khai bao duong dan URL den thu muc fckeditor
     $sBasePath = SRCIPTS_URL . '/fckeditor/';
     //3. Khoi tao doi tuong FCKeditor
     $oFCKeditor = new FCKeditor($name);
     //4. Thiet lap duong den cho thuong BasePath
     $oFCKeditor->BasePath = $sBasePath;
     //Dua gia tri vao Editor
     $oFCKeditor->Value = $value;
     //Thay doi kich thuoc cua Editor
     $oFCKeditor->Width = $width;
     $oFCKeditor->Height = $height;
     if (!isset($options['toolbar'])) {
         $oFCKeditor->ToolbarSet = 'Default';
     } else {
         $oFCKeditor->ToolbarSet = $options['toolbar'];
     }
     if (!isset($options['language'])) {
         $oFCKeditor->Config['AutoDetectLanguage'] = false;
         $oFCKeditor->Config['DefaultLanguage'] = 'en';
     } else {
         $oFCKeditor->Config['AutoDetectLanguage'] = false;
         $oFCKeditor->Config['DefaultLanguage'] = $options['language'];
     }
     //5. Tao FCKeditor
     return $oFCKeditor->Create();
 }
示例#8
0
    /**
     * i know it is not well liked to output this here, but for integration purposes it makes sense
     */
    public function FckEditor($instance = 'content', $value = 'Enter text here', $height = 600, $width = 600, $fullToolbar = true)
    {
        $view = $this->view;
        include 'Digitalus/editor/fckeditor.php';
        ?>
        <script>
        function FCKeditor_OnComplete( editorInstance )
        {
        }
        </script>

        <?php 
        $sBasePath = '/scripts/fckeditor/';
        $oFCKeditor = new FCKeditor($instance);
        $oFCKeditor->BasePath = $sBasePath;
        $oFCKeditor->Config['SkinPath'] = $sBasePath . 'editor/skins/office2003/';
        $oFCKeditor->Width = $width;
        $oFCKeditor->Height = $height;
        if ($fullToolbar) {
            $oFCKeditor->ToolbarSet = 'Digitalus';
        } else {
            $oFCKeditor->ToolbarSet = 'Basic';
        }
        $oFCKeditor->Value = $value;
        $oFCKeditor->Create();
    }
示例#9
0
 function Send_Email($mailto = '', $subject = '', $text = '')
 {
     $this->AddStrings($row);
     // Берем из сессии
     $use_client_selection = get('use_client_selection', array(), 's');
     if ($mailto == 'use_client_selection' && $use_client_selection) {
         $client_selection = join(' AND ', $use_client_selection);
         $row['use_client_selection'] = '1';
         $emails = $this->GetValue("SELECT COUNT(*) FROM auth_users AS c WHERE subscribe=1 AND " . $client_selection);
         $row['mailto'] = sprintf($this->str('client_selection'), $emails);
         $row['mailto_readonly'] = 'READONLY';
     } else {
         $row['mailto'] = h($mailto);
         $row['use_client_selection'] = '0';
         $row['client_selector']['value'] = ' ';
     }
     $row['subject'] = h($subject);
     $managers = sql_getRows("SELECT id, CONCAT(fullname,' &lt;',email,'&gt;') FROM admins WHERE email<>'' " . " AND fullname!='' ORDER BY fullname", true);
     $row['managers'] = $this->GetArrayOptions($managers, $this->user['id'], true);
     ###
     include_fckeditor();
     $oFCKeditor = new FCKeditor();
     $oFCKeditor->ToolbarSet = 'Common';
     $oFCKeditor->Value = $text;
     $row['editor'] = $oFCKeditor->ReturnFCKeditor('editor[html]', '100%', '100%');
     ###
     return $this->Parse($row, $this->name . '.tmpl');
 }
function SpGetEditor($fname,$fvalue,$nheight="350",$etype="Basic",$gtype="print",$isfullpage="false")
{
	if(!isset($GLOBALS['cfg_html_editor'])) $GLOBALS['cfg_html_editor']='fck';
	if($gtype=="") $gtype = "print";
	if($GLOBALS['cfg_html_editor']=='fck'){
	  require_once(dirname(__FILE__)."/../FCKeditor/fckeditor.php");
	  $fck = new FCKeditor($fname);
	  $fck->BasePath		= $GLOBALS['cfg_cmspath'].'/include/FCKeditor/' ;
	  $fck->Width		= '100%' ;
	  $fck->Height		= $nheight ;
	  $fck->ToolbarSet	= $etype ;
	  $fck->Config['FullPage'] = $isfullpage;
	  if($GLOBALS['cfg_fck_xhtml']=='Y'){
	  	$fck->Config['EnableXHTML'] = 'true';
	    $fck->Config['EnableSourceXHTML'] = 'true';
	  }
	  $fck->Value = $fvalue ;
	  if($gtype=="print") $fck->Create();
	  else return $fck->CreateHtml();
  }else{
		require_once(dirname(__FILE__)."/../htmledit/dede_editor.php");
	  $ded = new DedeEditor($fname);
	  $ded->BasePath		= $GLOBALS['cfg_cmspath'].'/include/htmledit/' ;
	  $ded->Width		= '100%' ;
	  $ded->Height		= $nheight ;
	  $ded->ToolbarSet = strtolower($etype);
	  $ded->Value = $fvalue ;
	  if($gtype=="print") $ded->Create();
	  else return $ded->CreateHtml();
	}
}
示例#11
0
文件: email.php 项目: romlg/cms36
 function getContent()
 {
     $data = array();
     $func = get('func', '', 'pg');
     if (!empty($func)) {
         $func = get('func', '', 'pg');
         if (!empty($func)) {
             $data = $this->{$func}();
         }
     } else {
         global $user;
         $data['current_user'] = $user['id'];
         $data['managers'] = sql_getRows("SELECT id, CONCAT(login,' (',email,') ') as name FROM admins", true);
         $this->AddStrings($data);
         include_fckeditor();
         $oFCKeditor = new FCKeditor();
         $oFCKeditor->ToolbarSet = 'Common';
         $oFCKeditor->Value = '';
         $data['editor'] = $oFCKeditor->ReturnFCKeditor('fld[html]', '100%', '100%');
         $this->AddStrings($data);
     }
     $tpl = strtolower($this->dir . '/' . $this->name . (!empty($func) ? '.' . $func : '') . '.tmpl');
     if (is_file($tpl)) {
         return Parse($data, $tpl);
     } else {
         return $data;
     }
 }
示例#12
0
 function render()
 {
     include_once JIEQI_ROOT_PATH . '/lib/html/form/fckeditor/fckeditor.php';
     $editor = new FCKeditor();
     $editor->Value = $this->getValue();
     return $editor->ReturnFCKeditor($this->getName(), $this->getWidth(), $this->getHeight());
 }
示例#13
0
/**
* ------------------------------------------------------------- 
* @param InstanceName Editor instance name (form field name)
* @param Width optional width (css units)
* @param Height optional height (css units)
* @param CheckBrowser optional check the browser compatibility when rendering the editor
* @param DisplayErrors optional show error messages on errors while rendering the editor
*
*/
function smarty_function_editor($params, &$smarty)
{
    global $ari;
    require_once $ari->filesdir . DIRECTORY_SEPARATOR . 'scripts' . DIRECTORY_SEPARATOR . 'editor' . DIRECTORY_SEPARATOR . 'fckeditor.php';
    if (!isset($params['InstanceName']) || empty($params['InstanceName'])) {
        $smarty->trigger_error('fckeditor: required parameter "InstanceName" missing');
    }
    $oFCKeditor = new FCKeditor($params['InstanceName']);
    if ($ari->mode == 'admin') {
        $oFCKeditor->BasePath = $ari->adminaddress . '/scripts/editor/';
    } else {
        $oFCKeditor->BasePath = $ari->webaddress . '/scripts/editor/';
    }
    if (isset($params['Value'])) {
        $oFCKeditor->Value = $params['Value'];
    }
    /*					if (isset ($params['Width']))
    			$oFCKeditor->Width = $params['Width'];
    			
    					if (isset ($params['Height']))
    			$oFCKeditor->Height = $params['Height']; */
    $oFCKeditor->Config['DefaultLanguage'] = substr($ari->agent->getSelectedLang(), 0, 2);
    $oFCKeditor->Config['CustomConfigurationsPath'] = $oFCKeditor->BasePath . 'config.js';
    if (isset($params['simple']) && $params['simple'] == true) {
        $oFCKeditor->ToolbarSet = 'Small';
    }
    //$oFCKeditor->Create() ;
    return $oFCKeditor->CreateHtml();
}
示例#14
0
 function EditForm()
 {
     $id = get('id');
     if ($id) {
         $row = $this->GetRow($id);
     } else {
         $row['visible'] = 1;
         $row['content_type'] = 'html';
         $row['text'] = '';
         $row['user_id'] = '';
     }
     $row['private_checked'] = $row['user_id'] ? 'checked' : '';
     $row['user_id'] = $GLOBALS['user']['id'];
     $row['options'] = $this->getSetOptions('content_type', $row['content_type']);
     $row['vis_etext'] = $row['content_type'] == 'text' ? 'show' : 'hide';
     $row['vis_ehtml'] = $row['content_type'] == 'html' ? 'show' : 'hide';
     ###
     include_fckeditor();
     $oFCKeditor = new FCKeditor();
     $oFCKeditor->ToolbarSet = 'Common';
     $oFCKeditor->Value = $row['text'];
     $row['editor'] = $oFCKeditor->ReturnFCKeditor('editor[html]', '100%', '100%');
     ###
     $this->AddStrings($row);
     return $this->Parse($row, $this->name . '.editform.tmpl');
 }
示例#15
0
 function get_edit_page()
 {
     $list = "";
     if ($this->session->justloggedin == 1) {
         $query = "select id, content from mdl_about where id=1";
         $result = $this->db->query($query);
         while ($row = $result->fetch(PDO::FETCH_ASSOC)) {
             $content = $row['content'];
         }
         $list = $list . "<table class='table table-hover' border='0'>";
         $list = $list . "<tr>";
         $oFCKeditor = new FCKeditor('editor');
         $oFCKeditor->BasePath = $this->editor_path;
         $oFCKeditor->Value = $content;
         $editor = $oFCKeditor->Create(false);
         $list = $list . "</td >&nbsp;&nbsp;{$editor}</td>";
         $list = $list . "</tr>";
         $list = $list . "<tr>";
         $list = $list . "<td align='left' style='padding-left:0px'><button type='button' id='save_about' class='btn btn-primary' style='spacing-left:0px;'>Save</button></td>";
         $list = $list . "</tr>";
         $list = $list . "</table>";
     } else {
         $list .= "<p>You are not authenticated. &nbsp; <a href='https://medical2.com/login'><button class='btn btn-primary' id='relogin'>Login</button></a></p>";
     }
     return $list;
 }
示例#16
0
 /**
  * Метод создания объекта FCKeditor
  *
  * @param string $val		значение поля ввода
  * @param int $height		высота поля ввода
  * @param string $name		наименование поля ввода
  * @param string $toolbar	панель управления
  * @return object			объект FCKeditor
  */
 function _newsletterFckObjectCreate($val, $height = 300, $name, $toolbar = 'Default')
 {
     $oFCKeditor = new FCKeditor($name);
     $oFCKeditor->Height = $height;
     $oFCKeditor->ToolbarSet = $toolbar;
     $oFCKeditor->Value = $val;
     $obj = $oFCKeditor->Create();
     return $obj;
 }
 function render_editor()
 {
     include_once FCKeditor_DIR . 'fckeditor.php';
     $editor = new FCKeditor($this->_process_name_attribute($this->get_attribute('name')));
     $editor->BasePath = FCKeditor_BasePath;
     $editor->Value = $this->get_value();
     $editor->Width = $this->get_attribute('width');
     $editor->Height = $this->get_attribute('height');
     $editor->Create();
 }
示例#18
0
function createEditer($inputName, $inputValue = '', $width = '550', $height = '400', $toolbarSet = 'Basic')
{
    $editor = new FCKeditor($inputName);
    $editor->BasePath = "../FCKeditor/";
    $editor->ToolbarSet = $toolbarSet;
    $editor->Width = $width;
    $editor->Height = $height;
    $editor->Value = $inputValue;
    $GLOBALS['smarty']->assign("editor", $editor->CreateHtml());
}
示例#19
0
function create_html_editor($input_name, $input_value = '')
{
    $editor = new FCKeditor($input_name);
    $editor->BasePath = '../includes/fckeditor/';
    $editor->ToolbarSet = 'Normal';
    $editor->Width = '100%';
    $editor->Height = '320';
    $editor->Value = $input_value;
    return $editor->CreateHtml();
}
示例#20
0
/**
 * 创建 FCKeditor 编辑器
 * @param $initInfo :初始化的值
 * @param $fckName :Fckeditor提交后的表单域名称
 * @param $width :Fckeditor编辑器的宽度
 * @param $height :Fckeditor编辑器的高度
 */
function getFckeditor($initInfo = '', $fckName = 'fckEditInfo', $width = '100%', $height = '600')
{
    include_once SITEWEB_PATH . "/fckeditor/fckeditor.php";
    $oFCKeditor = new FCKeditor($fckName);
    $oFCKeditor->BasePath = "fckeditor/";
    $oFCKeditor->Width = $width;
    $oFCKeditor->Height = $height;
    $oFCKeditor->Value = $initInfo;
    //默认的内容
    return $oFCKeditor->Create();
}
示例#21
0
function richField($name, $value)
{
    $oFCKeditor = new FCKeditor($name);
    $sBasePath = 'fckeditor/';
    $oFCKeditor->BasePath = $sBasePath;
    $oFCKeditor->ToolbarSet = 'Basic';
    $oFCKeditor->Height = '100';
    $oFCKeditor->Width = '367';
    $oFCKeditor->Value = $value;
    return $oFCKeditor->CreateHtml();
}
示例#22
0
 public function action_edit()
 {
     exit;
     include_once "ext/fckeditor/fckeditor.php";
     $oFCKeditor = new FCKeditor('FCKeditor2');
     $oFCKeditor->Height = 190;
     $oFCKeditor->BasePath = '/ext/fckeditor/';
     $oFCKeditor->Config['AutoDetectLanguage'] = false;
     $oFCKeditor->Config['DefaultLanguage'] = "ru";
     $oFCKeditor->Value = "";
     $oFCKeditor->Create();
 }
示例#23
0
 public function __toString()
 {
     $oFCKeditor = new FCKeditor($this->name);
     $oFCKeditor->BasePath = '/includes/libs/fckeditor/';
     if (_PATH_ != '/') {
         $oFCKeditor->BasePath = _PATH_ . '/includes/libs/fckeditor/';
     }
     $oFCKeditor->Value = $this->value;
     $oFCKeditor->ToolbarSet = $this->toolbar;
     $oFCKeditor->Width = $this->width;
     $oFCKeditor->Height = $this->height;
     return $oFCKeditor->CreateHtml();
 }
示例#24
0
 public function TextBox($name, $value = "")
 {
     $sBasePath = join_path(Registry::get('base_dir'), 'system/editor/fckeditor/');
     $oFCKeditor = new \FCKeditor($name);
     $oFCKeditor->BasePath = $sBasePath;
     $oFCKeditor->Value = $value;
     $oFCKeditor->Width = 800;
     $oFCKeditor->Height = 700;
     ob_start();
     $oFCKeditor->Create();
     unset($oFCKeditor);
     return ob_get_clean();
 }
示例#25
0
function fck_editor($editor_name, $type, $value = '')
{
    global $config;
    load("fckeditor.php", "", "fckeditor", 0);
    $editor = new FCKeditor($editor_name);
    $editor->BasePath = $config["base_url"] . 'fckeditor/';
    $editor->ToolbarSet = $type;
    $editor->Width = '100%';
    $editor->Height = '320';
    $editor->Value = $value;
    $FCKeditor = $editor->CreateHtml();
    return $FCKeditor;
}
示例#26
0
 /**
  * creates an fckeditor textarea
  * 
  * @param array $namepair - used to build textarea name for views, array('Model', 'fieldname')
  * @param stirng $basepath - base path of project/system
  * @param string $content
  */
 public function fckeditor($namepair = array(), $basepath = '', $content = '', $width = '100%', $height = '200')
 {
     $editor_name = 'data';
     foreach ($namepair as $name) {
         $editor_name .= "[" . $name . "]";
     }
     $oFCKeditor = new FCKeditor($editor_name);
     $oFCKeditor->BasePath = $basepath . '/js/fckeditor/';
     $oFCKeditor->Value = $content;
     ///code by praveen
     $oFCKeditor->Height = $height;
     $oFCKeditor->Width = $width;
     $oFCKeditor->Create();
 }
 public function process($pParams)
 {
     static $_init = false;
     static $htmlPath = '';
     extract($pParams);
     //check the initialisation
     if (!$_init) {
         $path = CopixModule::getPath('htmleditor') . COPIX_CLASSES_DIR;
         $htmlPath = CopixUrl::get() . 'js/FCKeditor/';
         require_once $path . 'fckeditor.php';
         $_init = true;
     }
     if (empty($content)) {
         $content = '&nbsp;';
     }
     //name of the textarea.
     if (empty($name)) {
         throw new CopixTemplateTagException('htmleditor: missing name parameter');
     } else {
         if (!isset($width)) {
             $width = CopixConfig::get('htmleditor|width');
             //$width = '100%';
         }
         if (!isset($height)) {
             $height = CopixConfig::get('htmleditor|height');
             //$height = '450px';
         }
         /*
          * ATTENTION les éléments de config viewPhototèque etc font doublon avec la sélection de la toolbarset, mais sont nécessaire à Copix
          * Par contre si on ne les load pas, on a une erreur de FCKeditor, il faut donc supprimer ce gestionnaire d'erreur sinon on se prend un alert javascript
          * le gestionnaire en question se trouve dans "FCKToolbarItems.GetItem" (chercher cette chaîne pour le trouver) et désactiver "alert( FCKLang.UnknownToolbarItem.replace( /%1/g, itemName ) ) ;
          */
         $oFCKeditor = new FCKeditor($name);
         $oFCKeditor->BasePath = $htmlPath;
         $oFCKeditor->Value = $content;
         $oFCKeditor->ToolbarSet = 'Copix';
         $oFCKeditor->Width = $width;
         $oFCKeditor->Height = $height;
         $oFCKeditor->Config['viewPhototheque'] = CopixModule::isEnabled('pictures') ? 'true' : 'false';
         $oFCKeditor->Config['viewCmsLink'] = CopixModule::isEnabled('cms') ? 'true' : 'false';
         $oFCKeditor->Config['viewLinkPopup'] = CopixModule::isEnabled('cms') ? 'true' : 'false';
         $oFCKeditor->Config['viewDocument'] = CopixModule::isEnabled('document') ? 'true' : 'false';
         $oFCKeditor->Config['viewMailto'] = 'true';
         // Configuration de la feuille de style à utiliser.
         //$oFCKeditor->Config['EditorAreaCSS'] = CopixUrl::get ().'styles/themes/hivers/hivers.css';
         $out = $oFCKeditor->CreateHtml();
     }
     return $out;
 }
示例#28
0
function create_html_editor($input_name, $input_value = '', $is_ret = false, $width = "500", $height = '300')
{
    global $smarty;
    $editor = new FCKeditor($input_name);
    $editor->BasePath = '../fckeditor/';
    $editor->ToolbarSet = 'Default';
    $editor->Width = $width;
    $editor->Height = $height;
    $editor->Value = $input_value;
    $FCKeditor = $editor->CreateHtml();
    if ($is_ret) {
        return $FCKeditor;
    }
    $smarty->assign('FCKeditor', $FCKeditor);
}
function smarty_insert_editor($params, &$smarty)
{
    // Automatically calculates the editor base path based on the _samples directory.
    // This is usefull only for these samples. A real application should use something like this:
    // $oFCKeditor->BasePath = '/fckeditor/' ;	// '/fckeditor/' is the default value.
    if (!isset($params['InstanceName']) || empty($params['InstanceName'])) {
        $smarty->trigger_error('fckeditor: required parameter "InstanceName" missing');
    }
    $base_arguments = array('Width' => '100%', 'Height' => '380', 'ToolbarSet' => 'BasicNoticias');
    $config_arguments = array('DocType' => '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">', 'AutoDetectLanguage' => false, 'DefaultLanguage' => $_SESSION['language'], 'CustomConfigurationsPath' => "atrconfig.js", 'LinkDlgHideTarget' => true, 'DisableObjectResizing' => true, 'DisableFFTableHandles' => true, 'LinkDlgHideTarget' => true, 'LinkDlgHideAdvanced' => true, 'ImageDlgHideLink' => true, 'ImageDlgHideAdvanced' => true, 'FlashDlgHideAdvanced' => true, 'FormatOutput' => true, 'FormatSource' => true);
    $sBasePath = $_SERVER['PHP_SELF'];
    $sBasePath = '' . $smarty->get_config_vars('modulo_dir') . 'FCKeditor/';
    if ($smarty->FCKCFG['ID_SITE']) {
        $sBaseSrc = $smarty->get_config_vars('patchsite') . 'sites/' . $smarty->FCKCFG['ID_SITE'] . '/';
    } else {
        $sBaseSrc = $smarty->get_config_vars('patchsite') . '/';
    }
    // Use all other parameters for the config array (replace if needed)
    $other_arguments = array_diff_assoc($params, $base_arguments);
    $config_arguments = array_merge($config_arguments, $other_arguments);
    $oFCKeditor->Config = $config_arguments;
    // parametro Value
    $oFCKeditor = new FCKeditor($params['InstanceName']);
    $oFCKeditor->BasePath = $sBasePath;
    $oFCKeditor->Value = isset($params['Value']) ? $params['Value'] : $smarty->FCKCFG['Value'];
    /*$smarty->register_outputfilter("pre_editor");
    $oFCKeditor->Value = $smarty->fetch(realpath($oFCKeditor->Value));*/
    if (@is_file($oFCKeditor->Value)) {
        $file = new Arquivo($oFCKeditor->Value);
        $pfile = file_get_contents($file->origem);
        $searcharray = array("/(\\<head)(.*)?(\\>)(.*)(\\<\\/head\\>)/siU", "/(src=\")(.*)(\")/siU", "/(\\{([^#|^\$](.*)))(\\s)(.*)?(\\})/siU");
        //"/(\<)(head)(\>)(.*)(\<\/)(head)(\>)/siU";
        $replacearray = array("", "\\1{$sBaseSrc}\\2\\3", '<div modulo="\\2" class="FCK__Inserts" \\5></div>');
        $oFCKeditor->Value = preg_replace($searcharray, $replacearray, $pfile);
    }
    $oFCKeditor->Config['ImageBrowserURL'] = $smarty->get_config_vars('http') . $smarty->get_config_vars('modulo_dir') . 'FCKeditor/editorftp/browser.html?ServerPath=' . $smarty->get_config_vars('patchsite') . 'sites/' . $smarty->FCKCFG['ID_SITE'] . '/templates/&Type=Image&Connector=connectors/connector.php';
    $oFCKeditor->Config['LinkBrowserURL'] = $smarty->get_config_vars('http') . $smarty->get_config_vars('modulo_dir') . 'FCKeditor/editorftp/browser.html?ServerPath=' . $smarty->get_config_vars('patchsite') . 'sites/' . $smarty->FCKCFG['ID_SITE'] . '/templates/&Connector=connectors/connector.php';
    $oFCKeditor->Config['FlashBrowserURL'] = $smarty->get_config_vars('http') . $smarty->get_config_vars('modulo_dir') . 'FCKeditor/editorftp/browser.html?ServerPath=' . $smarty->get_config_vars('patchsite') . 'sites/' . $smarty->FCKCFG['ID_SITE'] . '/templates/&Type=Flash&Connector=connectors/connector.php';
    $oFCKeditor->Width = isset($params['Width']) ? $params['Width'] : $base_arguments['Width'];
    $oFCKeditor->Height = isset($params['Height']) ? $params['Height'] : $base_arguments['Height'];
    $oFCKeditor->ToolbarSet = isset($params['ToolbarSet']) ? $params['ToolbarSet'] : $base_arguments['ToolbarSet'];
    $oFCKeditor->Config['AutoDetectLanguage'] = isset($params['AutoDetectLanguage']) ? $params['AutoDetectLanguage'] : $config_arguments['AutoDetectLanguage'];
    $oFCKeditor->Config['DefaultLanguage'] = isset($params['DefaultLanguage']) ? $params['DefaultLanguage'] : $config_arguments['DefaultLanguage'];
    $oFCKeditor->Config['CustomConfigurationsPath'] = isset($smarty->cfg['CustomConfigurationsPath']) ? $smarty->cfg['CustomConfigurationsPath'] : $config_arguments['CustomConfigurationsPath'];
    $oFCKeditor->Config['EditorAreaCSS'] = isset($params['EditorAreaCSS']) ? $params['EditorAreaCSS'] : $smarty->FCKCFG['EditorAreaCSS'];
    $oFCKeditor->Config['BaseHref'] = $smarty->get_config_vars('http') . 'sites/' . $smarty->FCKCFG['ID_SITE'] . '/';
    return $oFCKeditor->CreateHtml();
}
示例#30
0
/**
* Smarty function plugin
* Requires PHP >= 4.3.0
* -------------------------------------------------------------
* Type:     function
* Name:     fckeditor
* Version:  1.1
* Author:   gazoot (gazoot care of gmail dot com)
* Purpose:  Creates a FCKeditor, a very powerful textarea replacement.
* -------------------------------------------------------------
* @param InstanceName Editor instance name (form field name)
* @param BasePath optional Path to the FCKeditor directory. Need only be set once on page. Default: /js/fckeditor/
* @param Value optional data that control will start with, default is taken from the javascript file
* @param Width optional width (css units)
* @param Height optional height (css units)
* @param ToolbarSet optional what toolbar to use from configuration
* @param CheckBrowser optional check the browser compatibility when rendering the editor
* @param DisplayErrors optional show error messages on errors while rendering the editor
*
* Default values for optional parameters (except BasePath) are taken from fckeditor.js.
*
* All other parameters used in the function will be put into the configuration section,
* CustomConfigurationsPath is useful for example.
* See http://docs.fckeditor.net/FCKeditor_2.x/Developers_Guide/Configuration/Configuration_Options for more configuration info.
*/
function smarty_function_editor($params, &$smarty)
{
    $params["BasePath"] = script_path . "/fckeditor";
    if (!isset($params['InstanceName']) || empty($params['InstanceName'])) {
        $smarty->trigger_error('fckeditor: required parameter "InstanceName" missing');
    }
    static $base_arguments = array();
    static $config_arguments = array();
    // Test if editor has been loaded before
    $init = count($base_arguments) == 0;
    // BasePath must be specified once.
    if (isset($params['BasePath'])) {
        $base_arguments['BasePath'] = $params['BasePath'];
    } else {
        if (empty($base_arguments['BasePath'])) {
            $base_arguments['BasePath'] = '/js/fckeditor/';
        }
    }
    $base_arguments['InstanceName'] = $params['InstanceName'];
    if (isset($params['Value'])) {
        $base_arguments['Value'] = $params['Value'];
    } else {
        $base_arguments['Value'] = '';
    }
    if (isset($params['Width'])) {
        $base_arguments['Width'] = $params['Width'];
    }
    if (isset($params['Height'])) {
        $base_arguments['Height'] = $params['Height'];
    }
    if (isset($params['ToolbarSet'])) {
        $base_arguments['ToolbarSet'] = $params['ToolbarSet'];
    }
    if (isset($params['CheckBrowser'])) {
        $base_arguments['CheckBrowser'] = $params['CheckBrowser'];
    }
    if (isset($params['DisplayErrors'])) {
        $base_arguments['DisplayErrors'] = $params['DisplayErrors'];
    }
    // Use all other parameters for the config array (replace if needed)
    $other_arguments = array_diff_assoc($params, $base_arguments);
    $config_arguments = array_merge($config_arguments, $other_arguments);
    require_once $base_arguments["BasePath"] . "/fckeditor.php";
    $oFCKeditor = new FCKeditor($base_arguments["InstanceName"]);
    $oFCKeditor->BasePath = script_url . "/fckeditor/";
    $oFCKeditor->ToolbarSet = "Basic";
    return $oFCKeditor->Create();
}