电脑安全

您当前的位置:主页 > 电脑安全 >

新浪编辑器的调用-网络编程

来源:[db:来源]标题:   编辑器    编辑:电脑技术全能网 时间:2019-09-23 12:33

原标题:新浪编辑器的调用-网络编程
   require_once('cls.small_editor.php');$obj = new SmallEditor();$obj -> setEditor($e_form_name,$e_form_value,$width,$height);<?php /*=========================================================== = 版权协定: = GPL (The GNU GENERAL PUBLIC LICENSE Version 2, June 1991) =------------------------------------------------------------ = 文件称号:cls.small_editor.php = 摘 要:轻量级HTML编纂器 for PHP5 = 版 本:1.0 =------------------------------------------------------------ = Script Written By phpwms名目组 = 最初更新:xinge = 最初日期:2008-07-24 ============================================================*/ !defined('IN_SYS') and die('Hacking attempt'); class SmallEditor { public $editor_dir = 'editor/SMALLeditor/'; public function__construct() { global $root_dir; $this -> editor_dir = $root_dir.$this -> editor_dir; ob_start(array($this,'callBack')); } // 初始化 private function editorInit() { $str= '<link rel="stylesheet" type="text/css" href="'.$this -> editor_dir.'comm.css" />'."/n"; $str .= '<script type="text/javascript" language="JavaScript" src="'.$this -> editor_dir.'all.js"></script>'."/n"; $str .= '<script type="text/javascript" language="JavaScript" src="'.$this -> editor_dir.'editor.js"></script>'."/n"; $str .= '<script type="text/javascript" language="JavaScript" src="'.$this -> editor_dir.'editor_toolbar.js"></script>'."/n"; return $str; } // 回调调换 public function callBack($buffer) { return (str_replace(array('</HEAD>','</Head>','</head>'),$this -> editorInit().'</HEAD>', $buffer)); } public function setEditor($e_form_name = 'my_text_area',$e_form_value = '',$e_toolbar = 'AdminMode',$height='',$width = '100%') { !$height and $height = 230; !strstr($height,'%') and $height = $height.'px'; !strstr($width,'%')and $width= $width.'px'; return <<<EOF <textarea id="{$e_form_name}" name="{$e_form_name}" style="display:none;">{$e_form_value}</textarea> <script language="javascript"> gContentId = "{$e_form_name}"; OutputEditorLoading(); </script> <iframe id="HtmlEditor" class="editor_frame" frameborder="0" marginheight="0" marginwidth="0" style="width:{$width};height:{$height};overflow:visible;" hideFocus></iframe>EOF; } }?>新浪编纂器的挪用