<?php
/*
* Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
* For licensing, see LICENSE.html or http://ckeditor.com/license
*/
/**
* \brief CKEditor class that can be used to create editor
* instances in PHP pages on server side.
* @see http://ckeditor.com
*
* Sample usage:
* @code
* $CKEditor = new CKEditor();
* $CKEditor->editor("editor1", "<p>Initial value.</p>");
* @endcode
*/
class CKEditor
{
/**
* The version of %CKEditor.
* \private
*/
var $version = '3.6.3';
/**
* A constant string unique for each release of %CKEditor.
* \private
*/
var $_timestamp = 'C3HA5RM';
/**
* URL to the %CKEditor installation directory (absolute or relative to document root).
* If not set, CKEditor will try to guess it's path.
*
* Example usage:
* @code
* $CKEditor->basePath = '/ckeditor/';
* @endcode
*/
var $basePath;
/**
* An array that holds the global %CKEditor configuration.
* For the list of available options, see http://docs.cksource.com/ckeditor_api/symbols/CKEDITOR.config.html
*
* Example usage:
* @code
* $CKEditor->config['height'] = 400;
* // Use @@ at the beggining of a string to ouput it without surrounding quotes.
* $CKEditor->config['width'] = '@@screen.width * 0.8';
* @endcode
*/
var $config = array();
/**
* A boolean variable indicating whether CKEditor has been initialized.
* Set it to true only if you have already included
* <script> tag loading ckeditor.js in your website.
*/
var $initialized = false;
/**
* Boolean variable indicating whether created code should be printed out or returned by a function.
*
* Example 1: get the code creating %CKEditor instance and print it on a page with the "echo" function.
* @code
* $CKEditor = new CKEditor();
* $CKEditor->returnOutput = true;
* $code = $CKEditor->editor("editor1", "<p>Initial value.</p>");
* echo "<p>Editor 1:</p>";
* echo $code;
* @endcode
*/
var $returnOutput = false;
/**
* An array with textarea attributes.
*
* When %CKEditor is created with the editor() method, a HTML <textarea> element is created,
* it will be displayed to anyone with JavaScript disabled or with incompatible browser.
*/
var $textareaAttributes = array( "rows" => 8, "cols" => 60 );
/**
* A string indicating the creation date of %CKEditor.
* Do not change it unless you want to force browsers to not use previously cached version of %CKEditor.
*/
var $timestamp = "C3HA5RM";
/**
* An array that holds event listeners.
* \private
*/
var $_events = array();
/**
* An array that holds global event listeners.
* \private
*/
var $_globalEvents = array();
/**
* Main Constructor.
*
* @param $basePath (string) URL to the %CKEditor installation directory (optional).
*/
function CKEditor($basePath = null) {
if (!empty($basePath)) {
$this->basePath = $basePath;
}
}
/**
* Creates a %CKEditor instance.
* In incompatible browsers %CKEditor will downgrade to plain HTML <textarea> element.
*
* @param $name (string) Name of the %CKEditor instance (this will be also the "name" attribute of textarea element).
* @param $value (string) Initial value (optional).
* @param $config (array) The specific configurations to apply to this editor instance (optional).
* @param $events (array) Event listeners for this editor instance (optional).
*
* Example usage:
* @code
* $CKEditor = new CKEditor();
* $CKEditor->editor("field1", "<p>Initial value.</p>");
* @endcode
*
* Advanced example:
* @code
* $CKEditor = new CKEditor();
* $config = array();
* $config['toolbar'] = array(
* array( 'Source', '-', 'Bold', 'Italic', 'Underline', 'Strike' ),
* array( 'Image', 'Link', 'Unlink', 'Anchor' )
* );
* $events['instanceReady'] = 'function (ev) {
* alert("Loaded: " + ev.editor.name);
* }';
* $CKEditor->editor("field1", "<p>Initial value.</p>", $config, $events);
* @endcode
*/
function editor($name, $value = "", $config = array(), $events = array())
{
$attr = "";
foreach ($this->textareaAttributes as $key => $val) {
$attr.= " " . $key . '="' . str_replace('"', '"', $val) . '"';
}
$out = "<textarea name=\"" . $name . "\"" . $attr . ">" . htmlspecialchars($value) . "</textarea>\n";
if (!$this->initialized) {
$out .= $this->init();
}
$_config = $this->configSettings($config, $events);
$js = $this->returnGlobalEvents();
if (!empty($_config))
$js .= "CKEDITOR.replace('".$name."', ".$this->jsEncode($_config).");";
else
$js .= "CKEDITOR.replace('".$name."');";
$out .= $this->script($js);
if (!$this->returnOutput) {
print $out;
$out = "";
}
return $out;
}
/**
* Replaces a <textarea> with a %CKEditor instance.
*
* @param $id (string) The id or name of textarea element.
* @param $config (array) The specific configurations to apply to this editor instance (optional).
* @param $events (array) Event listeners for this editor instance (optional).
*
* Example 1: adding %CKEditor to <textarea name="article"></textarea> element:
* @code
* $CKEditor = new CKEditor();
* $CKEditor->replace("article");
* @endcode
*/
function replace($id, $config = array(), $events = array())
{
$out = "";
if (!$this->initialized) {
$out .= $this->init();
}
$_config = $this->configSettings($config, $events);
$js = $this->returnGlobalEvents();
if (!empty($_config)) {
$js .= "CKEDITOR.replace('".$id."', ".$this->jsEncode($_config).");";
}
else {
$js .= "CKEDITOR.replace('".$id."');";
}
$out .= $this->script($js);
if (!$this->returnOutput) {
print $out;
$out = "";
}
return $out;
}
/**
* Replace all <textarea> elements available in the document with editor instances.
*
* @param $className (string) If set, replace all textareas with class className in the page.
*
* Example 1: replace all <textarea> elements in the page.
* @code
* $CKEditor = new CKEditor();
* $CKEditor->replaceAll();
* @endcode
*
* Example 2: replace all <textarea class="myClassName"> elements in the page.
* @code
* $CKEditor = new CKEditor();
* $CKEditor->replaceAll( 'myClassName' );
* @endcode
*/
function replaceAll($className = null)
{
$out = "";
if (!$this->initialized) {
$out .= $this->init();
}
$_config = $this->configSettings();
$js = $this->returnGlobalEvents();
if (empty($_config)) {
if (empty($className)) {
$js .= "CKEDITOR.replaceAll();";
}
else {
$js .= "CKEDITOR.replaceAll('".$className."');";
}
}
else {
$classDetection = "";
$js .= "CKEDITOR.replaceAll( function(textarea, config) {\n";
if (!empty($className)) {
$js .= " var classRegex = new RegExp('(?:^| )' + '". $className ."' + '(?:$| )');\n";
$js .= " if (!classRegex.test(textarea.className))\n";
$js .= " return false;\n";
}
$js .= " CKEDITOR.tools.extend(config, ". $this->jsEncode($_config) .", true);";
$js .= "} );";
}
$out .= $this->script($js);
if (!$this->returnOutput) {
print $out;
$out = "";
}
return $out;
}
/**
* Adds event listener.
* Events are fired by %CKEditor in various situations.
*
* @param $event (string) Event name.
* @param $javascriptCode (string) Javascript anonymous function or function name.
*
* Example usage:
* @code
* $CKEditor->addEventHandler('instanceReady', 'function (ev) {
* alert("Loaded: " + ev.editor.name);
* }');
* @endcode
*/
function addEventHandler($event, $javascriptCode)
{
if (!isset($this->_events[$event])) {
$this->_events[$event] = array();
}
// Avoid duplicates.
i
没有合适的资源?快使用搜索试试~ 我知道了~
asp源码-CuzCms成创企业网站内容管理系统 asp版 v2.1.zip
共1632个文件
js:675个
gif:340个
css:144个
1 下载量 16 浏览量
2024-02-12
10:50:34
上传
评论
收藏 7.13MB ZIP 举报
温馨提示
anaconda安装 asp源码—CuzCms成创企业网站内容管理系统 asp版 v2.1.zip asp源码—CuzCms成创企业网站内容管理系统 asp版 v2.1.zip asp源码—CuzCms成创企业网站内容管理系统 asp版 v2.1.zip asp源码—CuzCms成创企业网站内容管理系统 asp版 v2.1.zip asp源码—CuzCms成创企业网站内容管理系统 asp版 v2.1.zip asp源码—CuzCms成创企业网站内容管理系统 asp版 v2.1.zip asp源码—CuzCms成创企业网站内容管理系统 asp版 v2.1.zip
资源推荐
资源详情
资源评论
收起资源包目录
asp源码-CuzCms成创企业网站内容管理系统 asp版 v2.1.zip (1632个子文件)
ckeditor.asp 30KB
upload.asp 21KB
config.asp 20KB
Config.asp 18KB
Site.asp 16KB
DataM.asp 15KB
SearchShow.asp 12KB
List.asp 11KB
UpLoadClass.asp 11KB
Md5.asp 10KB
ProductList.asp 9KB
CaseList.asp 9KB
DownList.asp 9KB
NewsList.asp 9KB
browse.asp 8KB
Recycle.asp 8KB
Main.asp 8KB
left.asp 8KB
UserList.asp 8KB
Gbook.asp 8KB
UpSoftFile.asp 7KB
Admin_Left.asp 7KB
Function.asp 7KB
index.asp 7KB
Flink.asp 7KB
FJob.asp 7KB
Notice.asp 7KB
Job.asp 7KB
Flash.asp 7KB
About.asp 7KB
Ads.asp 6KB
fJob.asp 6KB
DownEdit.asp 6KB
GBook.asp 6KB
Member.asp 6KB
fso.asp 6KB
UserLog.asp 6KB
JobList.asp 6KB
Property.asp 6KB
OrderList.asp 6KB
MemberReg.asp 5KB
UserPro.asp 5KB
CaseList.asp 5KB
ProductEdit.asp 5KB
ProductList.asp 5KB
DownList.asp 5KB
Login.asp 5KB
DataSql.asp 5KB
NewsList.asp 5KB
CaseEdit.asp 5KB
Order.asp 5KB
MemberLost.asp 5KB
MemberOrder.asp 5KB
Upload.asp 5KB
MemberLogin.asp 5KB
NewsEdit.asp 5KB
Search.asp 4KB
Config.asp 4KB
events.asp 4KB
upfileclass.asp 4KB
MemberOrderView.asp 4KB
SortEdit.asp 4KB
Menu.asp 4KB
Conn.asp 4KB
UserEdit.asp 4KB
JobEdit.asp 4KB
UserConfig.asp 4KB
Sort.asp 4KB
Box.asp 3KB
OrderEdit.asp 3KB
advanced.asp 3KB
Product.asp 3KB
Search.asp 3KB
FlashEdit.asp 3KB
ConfigPro.asp 3KB
FlinkEdit.asp 3KB
Head.asp 3KB
Code.asp 3KB
AdsEdit.asp 3KB
Checklogin.asp 3KB
replaceall.asp 3KB
AboutEdit.asp 3KB
replace.asp 2KB
NoticeEdit.asp 2KB
fJobEdit.asp 2KB
standalone.asp 2KB
top.asp 2KB
clientapi.asp 2KB
UserShow.asp 2KB
dlg_upload.asp 2KB
GbookEdit.asp 2KB
Reg.asp 2KB
remote.asp 2KB
standard.asp 2KB
para_file.asp 2KB
News.asp 2KB
NoSql.asp 2KB
Config.asp 1KB
Job.asp 1KB
sample_posteddata.asp 1KB
共 1632 条
- 1
- 2
- 3
- 4
- 5
- 6
- 17
资源评论
快乐无限出发
- 粉丝: 1188
- 资源: 7365
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- 中国光伏电站安装时间的多边形地理空间数据集(2010-2022年)-最新出炉.zip
- 几种常见简单滤波器用于二维图像降噪,包括均值、中值、高斯、低通、双边滤波器,语言是python
- 二手车管理系统,pc端,小程序端,java后端
- 2011-2022年中国光伏电站遥感识别面矢量数据-最新出炉.zip
- 基于深度学习的边缘计算网络的卸载优化及资源优化python源码+文档说明(高分项目)
- 基于yolov5+超声图像的钢轨缺陷检测python源码+数据集(高分毕设)
- 基于大语言模型的智能审计问答系统python源码+文档说明(高分项目)
- C++程序设计编程题库
- javase停车场管理系统答辩PPT(高级版)
- javase的停车场管理系统(高级版)
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功