@@ -5,14 +5,15 @@ | |||||
* | * | ||||
* @version 2019年6月5日 tianya $ | * @version 2019年6月5日 tianya $ | ||||
* @package DedeCMS.Command | * @package DedeCMS.Command | ||||
* @copyright Copyright (c) 2007 - 2020, DesDev, Inc. | |||||
* @copyright Copyright (c) 2020, DedeBIZ.COM | |||||
* @license https://www.dedebiz.com/license | |||||
* @link https://www.dedebiz.com | |||||
*/ | */ | ||||
// 切换工作目录到./src | // 切换工作目录到./src | ||||
$workDir = dirname(__FILE__)."/src"; | |||||
$workDir = dirname(__FILE__) . "/src"; | |||||
chdir($workDir); | chdir($workDir); | ||||
if (substr(php_sapi_name(), 0, 3) === 'cgi') | |||||
{ | |||||
if (substr(php_sapi_name(), 0, 3) === 'cgi') { | |||||
die("DedeCMS:needs php-cli to run\n\n"); | die("DedeCMS:needs php-cli to run\n\n"); | ||||
} | } | ||||
@@ -24,5 +25,5 @@ if (count($argv) > 1 && $argv[1] == "serv") { | |||||
} | } | ||||
echo "Start Dev Server For DedeCMS\n\r"; | echo "Start Dev Server For DedeCMS\n\r"; | ||||
echo "Open http://localhost:8088\n\r"; | echo "Open http://localhost:8088\n\r"; | ||||
passthru(PHP_BINARY . ' -S localhost:8088 -t'.escapeshellarg('./')); | |||||
} | |||||
passthru(PHP_BINARY . ' -S localhost:8088 -t' . escapeshellarg('./')); | |||||
} |
@@ -16,7 +16,7 @@ td { | |||||
left: 455px; | left: 455px; | ||||
top: 150px; | top: 150px; | ||||
width: 360px; | width: 360px; | ||||
height: 180px; | |||||
height: 200px; | |||||
z-index: 2; | z-index: 2; | ||||
background-color: #FFFFFF; | background-color: #FFFFFF; | ||||
border: 1px solid #889D8F; | border: 1px solid #889D8F; | ||||
@@ -56,7 +56,7 @@ | |||||
<body> | <body> | ||||
<div class="container-fluid"> | <div class="container-fluid"> | ||||
<div class="mt-3 mb-3"> | <div class="mt-3 mb-3"> | ||||
欢迎使用专业的PHP网站管理系统,轻松建站的首选利器 -- <?php echo $cfg_softname; ?> | |||||
欢迎使用国内流行的内容管理系统(CMS)多端全媒体解决方案 -- <?php echo $cfg_softname; ?> | |||||
</div> | </div> | ||||
<div class="row"> | <div class="row"> | ||||
<div id="__testEvn" class="col-md-12"></div> | <div id="__testEvn" class="col-md-12"></div> | ||||
@@ -1,4 +1,5 @@ | |||||
<?php | <?php | ||||
/** | /** | ||||
* @version $Id: common.inc.php 3 17:44 2010-11-23 tianya $ | * @version $Id: common.inc.php 3 17:44 2010-11-23 tianya $ | ||||
* @package DedeCMS.Libraries | * @package DedeCMS.Libraries | ||||
@@ -10,8 +11,7 @@ | |||||
// 生产环境使用production,如果采用dev模式,会有一些php的报错信息提示,便于开发调试 | // 生产环境使用production,如果采用dev模式,会有一些php的报错信息提示,便于开发调试 | ||||
define('DEDE_ENVIRONMENT', 'production'); | define('DEDE_ENVIRONMENT', 'production'); | ||||
if ( DEDE_ENVIRONMENT == 'production' ) | |||||
{ | |||||
if (DEDE_ENVIRONMENT == 'production') { | |||||
error_reporting(E_ALL || ~E_NOTICE); | error_reporting(E_ALL || ~E_NOTICE); | ||||
} else { | } else { | ||||
error_reporting(E_ALL); | error_reporting(E_ALL); | ||||
@@ -19,11 +19,11 @@ if ( DEDE_ENVIRONMENT == 'production' ) | |||||
define('DEBUG_LEVEL', FALSE); // 如果设置为TRUE则会打印执行SQL的时间和标签加载时间方便调试 | define('DEBUG_LEVEL', FALSE); // 如果设置为TRUE则会打印执行SQL的时间和标签加载时间方便调试 | ||||
define('DEDEINC', str_replace("\\", '/', dirname(__FILE__) ) ); | |||||
define('DEDEROOT', str_replace("\\", '/', substr(DEDEINC,0,-8) ) ); | |||||
define('DEDEDATA', DEDEROOT.'/data'); | |||||
define('DEDEMEMBER', DEDEROOT.'/member'); | |||||
define('DEDETEMPLATE', DEDEROOT.'/templets'); | |||||
define('DEDEINC', str_replace("\\", '/', dirname(__FILE__))); | |||||
define('DEDEROOT', str_replace("\\", '/', substr(DEDEINC, 0, -8))); | |||||
define('DEDEDATA', DEDEROOT . '/data'); | |||||
define('DEDEMEMBER', DEDEROOT . '/member'); | |||||
define('DEDETEMPLATE', DEDEROOT . '/templets'); | |||||
// ------------------------------------------------------------------------ | // ------------------------------------------------------------------------ | ||||
define('DEDEMODEL', './model'); | define('DEDEMODEL', './model'); | ||||
@@ -44,27 +44,25 @@ PwIDAQAB | |||||
-----END PUBLIC KEY-----'); // DedeBIZ系统公钥 | -----END PUBLIC KEY-----'); // DedeBIZ系统公钥 | ||||
define('DEDECDNURL', 'https://cdn.dedebiz.com'); // 默认静态资源地址 | define('DEDECDNURL', 'https://cdn.dedebiz.com'); // 默认静态资源地址 | ||||
if (version_compare(PHP_VERSION, '5.3.0', '<') && function_exists("get_magic_quotes_gpc")) | |||||
{ | |||||
if (version_compare(PHP_VERSION, '5.3.0', '<') && function_exists("get_magic_quotes_gpc")) { | |||||
set_magic_quotes_runtime(0); | set_magic_quotes_runtime(0); | ||||
} | } | ||||
if (version_compare(PHP_VERSION, '5.4.0', '>=')) | |||||
{ | |||||
if (!function_exists('session_register')) | |||||
{ | |||||
if (version_compare(PHP_VERSION, '5.4.0', '>=')) { | |||||
if (!function_exists('session_register')) { | |||||
function session_register() | function session_register() | ||||
{ | { | ||||
$args = func_get_args(); | $args = func_get_args(); | ||||
foreach ($args as $key){ | |||||
$_SESSION[$key]=$GLOBALS[$key]; | |||||
foreach ($args as $key) { | |||||
$_SESSION[$key] = $GLOBALS[$key]; | |||||
} | } | ||||
} | } | ||||
function session_is_registered($key) | function session_is_registered($key) | ||||
{ | { | ||||
return isset($_SESSION[$key]); | return isset($_SESSION[$key]); | ||||
} | } | ||||
function session_unregister($key){ | |||||
function session_unregister($key) | |||||
{ | |||||
unset($_SESSION[$key]); | unset($_SESSION[$key]); | ||||
} | } | ||||
} | } | ||||
@@ -72,22 +70,17 @@ if (version_compare(PHP_VERSION, '5.4.0', '>=')) | |||||
//是否启用mb_substr替换cn_substr来提高效率 | //是否启用mb_substr替换cn_substr来提高效率 | ||||
$cfg_is_mb = $cfg_is_iconv = FALSE; | $cfg_is_mb = $cfg_is_iconv = FALSE; | ||||
if(function_exists('mb_substr')) $cfg_is_mb = TRUE; | |||||
if(function_exists('iconv_substr')) $cfg_is_iconv = TRUE; | |||||
if (function_exists('mb_substr')) $cfg_is_mb = TRUE; | |||||
if (function_exists('iconv_substr')) $cfg_is_iconv = TRUE; | |||||
function _RunMagicQuotes(&$svar) | function _RunMagicQuotes(&$svar) | ||||
{ | { | ||||
if(function_exists("get_magic_quotes_gpc") && !@get_magic_quotes_gpc()) | |||||
{ | |||||
if( is_array($svar) ) | |||||
{ | |||||
foreach($svar as $_k => $_v) $svar[$_k] = _RunMagicQuotes($_v); | |||||
} | |||||
else | |||||
{ | |||||
if( strlen($svar)>0 && preg_match('#^(cfg_|GLOBALS|_GET|_POST|_COOKIE|_SESSION)#',$svar) ) | |||||
{ | |||||
exit('Request var not allow!'); | |||||
if (function_exists("get_magic_quotes_gpc") && !@get_magic_quotes_gpc()) { | |||||
if (is_array($svar)) { | |||||
foreach ($svar as $_k => $_v) $svar[$_k] = _RunMagicQuotes($_v); | |||||
} else { | |||||
if (strlen($svar) > 0 && preg_match('#^(cfg_|GLOBALS|_GET|_POST|_COOKIE|_SESSION)#', $svar)) { | |||||
exit('Request var not allow!'); | |||||
} | } | ||||
$svar = addslashes($svar); | $svar = addslashes($svar); | ||||
} | } | ||||
@@ -95,20 +88,18 @@ function _RunMagicQuotes(&$svar) | |||||
return $svar; | return $svar; | ||||
} | } | ||||
if (!defined('DEDEREQUEST')) | |||||
{ | |||||
if (!defined('DEDEREQUEST')) { | |||||
//检查和注册外部提交的变量 (2011.8.10 修改登录时相关过滤) | //检查和注册外部提交的变量 (2011.8.10 修改登录时相关过滤) | ||||
function CheckRequest(&$val) { | |||||
function CheckRequest(&$val) | |||||
{ | |||||
if (is_array($val)) { | if (is_array($val)) { | ||||
foreach ($val as $_k=>$_v) { | |||||
if($_k == 'nvarname') continue; | |||||
foreach ($val as $_k => $_v) { | |||||
if ($_k == 'nvarname') continue; | |||||
CheckRequest($_k); | CheckRequest($_k); | ||||
CheckRequest($val[$_k]); | CheckRequest($val[$_k]); | ||||
} | } | ||||
} else | |||||
{ | |||||
if( strlen($val)>0 && preg_match('#^(cfg_|GLOBALS|_GET|_POST|_COOKIE|_SESSION)#',$val) ) | |||||
{ | |||||
} else { | |||||
if (strlen($val) > 0 && preg_match('#^(cfg_|GLOBALS|_GET|_POST|_COOKIE|_SESSION)#', $val)) { | |||||
exit('Request var not allow!'); | exit('Request var not allow!'); | ||||
} | } | ||||
} | } | ||||
@@ -116,33 +107,29 @@ if (!defined('DEDEREQUEST')) | |||||
//var_dump($_REQUEST);exit; | //var_dump($_REQUEST);exit; | ||||
CheckRequest($_REQUEST); | CheckRequest($_REQUEST); | ||||
CheckRequest($_COOKIE); | |||||
CheckRequest($_COOKIE); | |||||
foreach(Array('_GET','_POST','_COOKIE') as $_request) | |||||
{ | |||||
foreach($$_request as $_k => $_v) | |||||
{ | |||||
if($_k == 'nvarname') ${$_k} = $_v; | |||||
else ${$_k} = _RunMagicQuotes($_v); | |||||
} | |||||
foreach (array('_GET', '_POST', '_COOKIE') as $_request) { | |||||
foreach ($$_request as $_k => $_v) { | |||||
if ($_k == 'nvarname') ${$_k} = $_v; | |||||
else ${$_k} = _RunMagicQuotes($_v); | |||||
} | |||||
} | } | ||||
} | } | ||||
//系统相关变量检测 | //系统相关变量检测 | ||||
if(!isset($needFilter)) | |||||
{ | |||||
if (!isset($needFilter)) { | |||||
$needFilter = false; | $needFilter = false; | ||||
} | } | ||||
$registerGlobals = @ini_get("register_globals"); | $registerGlobals = @ini_get("register_globals"); | ||||
$isUrlOpen = @ini_get("allow_url_fopen"); | $isUrlOpen = @ini_get("allow_url_fopen"); | ||||
$isSafeMode = @ini_get("safe_mode"); | $isSafeMode = @ini_get("safe_mode"); | ||||
if( preg_match('/windows/i', @getenv('OS')) ) | |||||
{ | |||||
if (preg_match('/windows/i', @getenv('OS'))) { | |||||
$isSafeMode = false; | $isSafeMode = false; | ||||
} | } | ||||
//系统配置参数 | //系统配置参数 | ||||
require_once(DEDEDATA."/config.cache.inc.php"); | |||||
require_once(DEDEDATA . "/config.cache.inc.php"); | |||||
//Session保存路径 | //Session保存路径 | ||||
$sessSaveHandler = @ini_get("session.save_handler"); | $sessSaveHandler = @ini_get("session.save_handler"); | ||||
@@ -150,112 +137,103 @@ if ($sessSaveHandler !== "files") { | |||||
@ini_set("session.save_handler", "files"); | @ini_set("session.save_handler", "files"); | ||||
} | } | ||||
$enkey = substr(md5(substr($cfg_cookie_encode,0,5)),0,10); | |||||
$sessSavePath = DEDEDATA."/sessions_{$enkey}"; | |||||
if ( !is_dir($sessSavePath) ) mkdir($sessSavePath); | |||||
$enkey = substr(md5(substr($cfg_cookie_encode, 0, 5)), 0, 10); | |||||
$sessSavePath = DEDEDATA . "/sessions_{$enkey}"; | |||||
if (!is_dir($sessSavePath)) mkdir($sessSavePath); | |||||
if(is_writeable($sessSavePath) && is_readable($sessSavePath)) | |||||
{ | |||||
if (is_writeable($sessSavePath) && is_readable($sessSavePath)) { | |||||
session_save_path($sessSavePath); | session_save_path($sessSavePath); | ||||
} | } | ||||
//转换上传的文件相关的变量及安全处理、并引用前台通用的上传函数 | //转换上传的文件相关的变量及安全处理、并引用前台通用的上传函数 | ||||
if($_FILES) | |||||
{ | |||||
require_once(DEDEINC.'/uploadsafe.inc.php'); | |||||
if ($_FILES) { | |||||
require_once(DEDEINC . '/uploadsafe.inc.php'); | |||||
} | } | ||||
//数据库配置文件 | //数据库配置文件 | ||||
require_once(DEDEDATA.'/common.inc.php'); | |||||
require_once(DEDEDATA . '/common.inc.php'); | |||||
if ( !isset($cfg_dbtype) ) | |||||
{ | |||||
if (!isset($cfg_dbtype)) { | |||||
$cfg_dbtype = 'mysql'; | $cfg_dbtype = 'mysql'; | ||||
} | } | ||||
//载入系统验证安全配置 | //载入系统验证安全配置 | ||||
if(file_exists(DEDEDATA.'/safe/inc_safe_config.php')) | |||||
{ | |||||
require_once(DEDEDATA.'/safe/inc_safe_config.php'); | |||||
if(!empty($safe_faqs)) $safefaqs = unserialize($safe_faqs); | |||||
if (file_exists(DEDEDATA . '/safe/inc_safe_config.php')) { | |||||
require_once(DEDEDATA . '/safe/inc_safe_config.php'); | |||||
if (!empty($safe_faqs)) $safefaqs = unserialize($safe_faqs); | |||||
} | } | ||||
//Session跨域设置 | //Session跨域设置 | ||||
if(!empty($cfg_domain_cookie)) | |||||
{ | |||||
@session_set_cookie_params(0,'/',$cfg_domain_cookie); | |||||
if (!empty($cfg_domain_cookie)) { | |||||
@session_set_cookie_params(0, '/', $cfg_domain_cookie); | |||||
} | } | ||||
//php5.1版本以上时区设置 | //php5.1版本以上时区设置 | ||||
//由于这个函数对于是php5.1以下版本并无意义,因此实际上的时间调用,应该用MyDate函数调用 | //由于这个函数对于是php5.1以下版本并无意义,因此实际上的时间调用,应该用MyDate函数调用 | ||||
if(PHP_VERSION > '5.1') | |||||
{ | |||||
if (PHP_VERSION > '5.1') { | |||||
$time51 = $cfg_cli_time * -1; | $time51 = $cfg_cli_time * -1; | ||||
@date_default_timezone_set('Etc/GMT'.$time51); | |||||
@date_default_timezone_set('Etc/GMT' . $time51); | |||||
} | } | ||||
$cfg_isUrlOpen = @ini_get("allow_url_fopen"); | $cfg_isUrlOpen = @ini_get("allow_url_fopen"); | ||||
//用户访问的网站host | //用户访问的网站host | ||||
$cfg_clihost = 'http://'.$_SERVER['HTTP_HOST']; | |||||
$cfg_clihost = 'http://' . $_SERVER['HTTP_HOST']; | |||||
//站点根目录 | //站点根目录 | ||||
$cfg_basedir = preg_replace('#'.$cfg_cmspath.'\/include$#i', '', DEDEINC); | |||||
if($cfg_multi_site == 'Y') | |||||
{ | |||||
$cfg_basedir = preg_replace('#' . $cfg_cmspath . '\/include$#i', '', DEDEINC); | |||||
if ($cfg_multi_site == 'Y') { | |||||
$cfg_mainsite = $cfg_basehost; | $cfg_mainsite = $cfg_basehost; | ||||
} | |||||
else | |||||
{ | |||||
} else { | |||||
$cfg_mainsite = ''; | $cfg_mainsite = ''; | ||||
} | } | ||||
//模板的存放目录 | //模板的存放目录 | ||||
$cfg_templets_dir = $cfg_cmspath.'/templets'; | |||||
$cfg_templeturl = $cfg_mainsite.$cfg_templets_dir; | |||||
$cfg_templets_skin = empty($cfg_df_style)? $cfg_mainsite.$cfg_templets_dir."/default" : $cfg_mainsite.$cfg_templets_dir."/$cfg_df_style"; | |||||
$cfg_templets_dir = $cfg_cmspath . '/templets'; | |||||
$cfg_templeturl = $cfg_mainsite . $cfg_templets_dir; | |||||
$cfg_templets_skin = empty($cfg_df_style) ? $cfg_mainsite . $cfg_templets_dir . "/default" : $cfg_mainsite . $cfg_templets_dir . "/$cfg_df_style"; | |||||
//cms安装目录的网址 | //cms安装目录的网址 | ||||
$cfg_cmsurl = $cfg_mainsite.$cfg_cmspath; | |||||
$cfg_cmsurl = $cfg_mainsite . $cfg_cmspath; | |||||
//插件目录,这个目录是用于存放计数器、投票、评论等程序的必要动态程序 | //插件目录,这个目录是用于存放计数器、投票、评论等程序的必要动态程序 | ||||
$cfg_plus_dir = $cfg_cmspath.'/plus'; | |||||
$cfg_phpurl = $cfg_mainsite.$cfg_plus_dir; | |||||
$cfg_plus_dir = $cfg_cmspath . '/plus'; | |||||
$cfg_phpurl = $cfg_mainsite . $cfg_plus_dir; | |||||
$cfg_static_dir = $cfg_cmspath.'/static'; | |||||
$cfg_staticurl = $cfg_mainsite.$cfg_static_dir; | |||||
$cfg_static_dir = $cfg_cmspath . '/static'; | |||||
$cfg_staticurl = $cfg_mainsite . $cfg_static_dir; | |||||
$cfg_mobile_dir = $cfg_cmspath.'/m'; | |||||
$cfg_mobileurl = $cfg_mainsite.$cfg_mobile_dir; | |||||
$cfg_mobile_dir = $cfg_cmspath . '/m'; | |||||
$cfg_mobileurl = $cfg_mainsite . $cfg_mobile_dir; | |||||
$cfg_data_dir = $cfg_cmspath.'/data'; | |||||
$cfg_dataurl = $cfg_mainsite.$cfg_data_dir; | |||||
$cfg_data_dir = $cfg_cmspath . '/data'; | |||||
$cfg_dataurl = $cfg_mainsite . $cfg_data_dir; | |||||
//会员目录 | //会员目录 | ||||
$cfg_member_dir = $cfg_cmspath.'/member'; | |||||
$cfg_memberurl = $cfg_mainsite.$cfg_member_dir; | |||||
$cfg_member_dir = $cfg_cmspath . '/member'; | |||||
$cfg_memberurl = $cfg_mainsite . $cfg_member_dir; | |||||
//专题列表的存放路径 | //专题列表的存放路径 | ||||
$cfg_special = $cfg_cmspath.'/special'; | |||||
$cfg_specialurl = $cfg_mainsite.$cfg_special; | |||||
$cfg_special = $cfg_cmspath . '/special'; | |||||
$cfg_specialurl = $cfg_mainsite . $cfg_special; | |||||
//附件目录 | //附件目录 | ||||
$cfg_medias_dir = $cfg_cmspath.$cfg_medias_dir; | |||||
$cfg_mediasurl = $cfg_mainsite.$cfg_medias_dir; | |||||
$cfg_medias_dir = $cfg_cmspath . $cfg_medias_dir; | |||||
$cfg_mediasurl = $cfg_mainsite . $cfg_medias_dir; | |||||
//上传的普通图片的路径,建议按默认 | //上传的普通图片的路径,建议按默认 | ||||
$cfg_image_dir = $cfg_medias_dir.'/allimg'; | |||||
$cfg_image_dir = $cfg_medias_dir . '/allimg'; | |||||
//上传的缩略图 | //上传的缩略图 | ||||
$ddcfg_image_dir = $cfg_medias_dir.'/litimg'; | |||||
$ddcfg_image_dir = $cfg_medias_dir . '/litimg'; | |||||
//用户投稿图片存放目录 | //用户投稿图片存放目录 | ||||
$cfg_user_dir = $cfg_medias_dir.'/userup'; | |||||
$cfg_user_dir = $cfg_medias_dir . '/userup'; | |||||
//上传的软件目录 | //上传的软件目录 | ||||
$cfg_soft_dir = $cfg_medias_dir.'/soft'; | |||||
$cfg_soft_dir = $cfg_medias_dir . '/soft'; | |||||
//上传的多媒体文件目录 | //上传的多媒体文件目录 | ||||
$cfg_other_medias = $cfg_medias_dir.'/media'; | |||||
$cfg_other_medias = $cfg_medias_dir . '/media'; | |||||
//软件摘要信息,****请不要删除本项**** 否则系统无法正确接收系统漏洞或升级信息 | //软件摘要信息,****请不要删除本项**** 否则系统无法正确接收系统漏洞或升级信息 | ||||
$cfg_version = 'V6_UTF8'; | $cfg_version = 'V6_UTF8'; | ||||
@@ -264,20 +242,17 @@ $cfg_soft_lang = 'utf-8'; | |||||
$cfg_soft_public = 'base'; | $cfg_soft_public = 'base'; | ||||
$cfg_softname = '织梦内容管理系统'; | $cfg_softname = '织梦内容管理系统'; | ||||
$cfg_soft_enname = 'DedeCMS'; | |||||
$cfg_soft_enname = 'DedeCMSV6'; | |||||
$cfg_soft_devteam = 'DedeBIZ'; | $cfg_soft_devteam = 'DedeBIZ'; | ||||
//文档的默认命名规则 | //文档的默认命名规则 | ||||
$art_shortname = $cfg_df_ext = '.html'; | $art_shortname = $cfg_df_ext = '.html'; | ||||
$cfg_df_namerule = '{typedir}/{Y}/{M}{D}/{aid}'.$cfg_df_ext; | |||||
$cfg_df_namerule = '{typedir}/{Y}/{M}{D}/{aid}' . $cfg_df_ext; | |||||
//新建目录的权限,如果你使用别的属性,本程不保证程序能顺利在Linux或Unix系统运行 | //新建目录的权限,如果你使用别的属性,本程不保证程序能顺利在Linux或Unix系统运行 | ||||
if(isset($cfg_ftp_mkdir) && $cfg_ftp_mkdir=='Y') | |||||
{ | |||||
if (isset($cfg_ftp_mkdir) && $cfg_ftp_mkdir == 'Y') { | |||||
$cfg_dir_purview = '0755'; | $cfg_dir_purview = '0755'; | ||||
} | |||||
else | |||||
{ | |||||
} else { | |||||
$cfg_dir_purview = 0755; | $cfg_dir_purview = 0755; | ||||
} | } | ||||
@@ -290,17 +265,15 @@ $_sys_globals['typeid'] = 0; | |||||
$_sys_globals['typename'] = ''; | $_sys_globals['typename'] = ''; | ||||
$_sys_globals['aid'] = 0; | $_sys_globals['aid'] = 0; | ||||
if(empty($cfg_addon_savetype)) | |||||
{ | |||||
if (empty($cfg_addon_savetype)) { | |||||
$cfg_addon_savetype = 'Ymd'; | $cfg_addon_savetype = 'Ymd'; | ||||
} | } | ||||
if($cfg_sendmail_bysmtp=='Y' && !empty($cfg_smtp_usermail)) | |||||
{ | |||||
if ($cfg_sendmail_bysmtp == 'Y' && !empty($cfg_smtp_usermail)) { | |||||
$cfg_adminemail = $cfg_smtp_usermail; | $cfg_adminemail = $cfg_smtp_usermail; | ||||
} | } | ||||
// DedeBIZ商业化组件 | // DedeBIZ商业化组件 | ||||
require_once(DEDEINC.'/dedebiz.class.php'); | |||||
require_once(DEDEINC . '/dedebiz.class.php'); | |||||
//对全局分页传递参数进行过滤 | //对全局分页传递参数进行过滤 | ||||
if (isset($GLOBALS['PageNo'])) { | if (isset($GLOBALS['PageNo'])) { | ||||
@@ -312,60 +285,56 @@ if (isset($GLOBALS['TotalResult'])) { | |||||
// ------------------------------------------------------------------------ | // ------------------------------------------------------------------------ | ||||
// 设定缓存配置信息 | // 设定缓存配置信息 | ||||
if ($cfg_memcache_enable == 'Y') | |||||
{ | |||||
if ($cfg_memcache_enable == 'Y') { | |||||
$cache_helper_config = array(); | $cache_helper_config = array(); | ||||
$cache_helper_config['memcache']['is_mc_enable'] = $GLOBALS["cfg_memcache_enable"]; | $cache_helper_config['memcache']['is_mc_enable'] = $GLOBALS["cfg_memcache_enable"]; | ||||
$cache_helper_config['memcache']['mc'] = array ( | |||||
$cache_helper_config['memcache']['mc'] = array( | |||||
'default' => $GLOBALS["cfg_memcache_mc_defa"], | 'default' => $GLOBALS["cfg_memcache_mc_defa"], | ||||
'other' => $GLOBALS["cfg_memcache_mc_oth"] | 'other' => $GLOBALS["cfg_memcache_mc_oth"] | ||||
); | ); | ||||
$cache_helper_config['memcache']['mc_cache_time'] = $GLOBALS["cfg_puccache_time"]; | $cache_helper_config['memcache']['mc_cache_time'] = $GLOBALS["cfg_puccache_time"]; | ||||
} | } | ||||
if(!isset($cfg_NotPrintHead)) { | |||||
if (!isset($cfg_NotPrintHead)) { | |||||
header("Content-Type: text/html; charset={$cfg_soft_lang}"); | header("Content-Type: text/html; charset={$cfg_soft_lang}"); | ||||
} | } | ||||
//自动加载类库处理 | //自动加载类库处理 | ||||
if (version_compare(PHP_VERSION, '7.2.0', '>=')) | |||||
{ | |||||
require_once(DEDEINC.'/autoload7.inc.php'); | |||||
if (version_compare(PHP_VERSION, '7.2.0', '>=')) { | |||||
require_once(DEDEINC . '/autoload7.inc.php'); | |||||
} else { | } else { | ||||
require_once(DEDEINC.'/autoload.inc.php'); | |||||
require_once(DEDEINC . '/autoload.inc.php'); | |||||
} | } | ||||
$cfg_biz_helpUrl = DEDEBIZURL."/help"; | |||||
$cfg_biz_gitUrl = DEDEBIZURL."/git"; | |||||
$cfg_biz_helpUrl = DEDEBIZURL . "/help"; | |||||
$cfg_biz_gitUrl = DEDEBIZURL . "/git"; | |||||
$cfg_biz_dedebizUrl = DEDEBIZURL; | $cfg_biz_dedebizUrl = DEDEBIZURL; | ||||
//引入数据库类 | //引入数据库类 | ||||
if ( $GLOBALS['cfg_dbtype'] =='mysql' || $GLOBALS['cfg_dbtype'] =='mysqli' ) | |||||
{ | |||||
require_once(DEDEINC.'/dedesqli.class.php'); | |||||
if ($GLOBALS['cfg_dbtype'] == 'mysql' || $GLOBALS['cfg_dbtype'] == 'mysqli') { | |||||
require_once(DEDEINC . '/dedesqli.class.php'); | |||||
} else { | } else { | ||||
require_once(DEDEINC.'/dedesqlite.class.php'); | |||||
require_once(DEDEINC . '/dedesqlite.class.php'); | |||||
} | } | ||||
//全局常用函数 | //全局常用函数 | ||||
require_once(DEDEINC.'/common.func.php'); | |||||
require_once(DEDEINC . '/common.func.php'); | |||||
//载入小助手配置,并对其进行默认初始化 | //载入小助手配置,并对其进行默认初始化 | ||||
$cfg_helper_autoload = array | |||||
( | |||||
'charset', /* 编码小助手 */ | |||||
'channelunit',/* 模型单元小助手 */ | |||||
'string', /* 字符串小助手 */ | |||||
'time', /* 日期小助手 */ | |||||
'file', /* 文件小助手 */ | |||||
'util', /* 单元小助手 */ | |||||
'validate', /* 数据验证小助手 */ | |||||
'filter', /* 过滤器小助手 */ | |||||
'cookie', /* cookies小助手 */ | |||||
'debug', /* 调试小助手 */ | |||||
'archive', /* 文档小助手 */ | |||||
'upload', /* 上传小助手 */ | |||||
'extend', /* 扩展小助手 */ | |||||
$cfg_helper_autoload = array( | |||||
'charset', /* 编码小助手 */ | |||||
'channelunit',/* 模型单元小助手 */ | |||||
'string', /* 字符串小助手 */ | |||||
'time', /* 日期小助手 */ | |||||
'file', /* 文件小助手 */ | |||||
'util', /* 单元小助手 */ | |||||
'validate', /* 数据验证小助手 */ | |||||
'filter', /* 过滤器小助手 */ | |||||
'cookie', /* cookies小助手 */ | |||||
'debug', /* 调试小助手 */ | |||||
'archive', /* 文档小助手 */ | |||||
'upload', /* 上传小助手 */ | |||||
'extend', /* 扩展小助手 */ | |||||
); | ); | ||||
// 初始化小助手 | // 初始化小助手 | ||||
helper($cfg_helper_autoload); | helper($cfg_helper_autoload); |
@@ -1,4 +1,4 @@ | |||||
<?php if(!defined('DEDEINC')) exit('dedecms'); | |||||
<?php if (!defined('DEDEINC')) exit('dedecms'); | |||||
/** | /** | ||||
* 管理员后台基本函数 | * 管理员后台基本函数 | ||||
* | * | ||||
@@ -18,10 +18,10 @@ | |||||
* @param int $isclose 解析后是否释放资源 | * @param int $isclose 解析后是否释放资源 | ||||
* @return string | * @return string | ||||
*/ | */ | ||||
function SpGetPinyin($str, $ishead=0, $isclose=1) | |||||
function SpGetPinyin($str, $ishead = 0, $isclose = 1) | |||||
{ | { | ||||
global $pinyins; | global $pinyins; | ||||
global $cfg_bizcore_appid,$cfg_bizcore_key,$cfg_bizcore_hostname,$cfg_bizcore_port; | |||||
global $cfg_bizcore_appid, $cfg_bizcore_key, $cfg_bizcore_hostname, $cfg_bizcore_port; | |||||
global $cfg_soft_lang; | global $cfg_soft_lang; | ||||
$restr = ''; | $restr = ''; | ||||
if (!empty($cfg_bizcore_appid) && !empty($cfg_bizcore_key)) { | if (!empty($cfg_bizcore_appid) && !empty($cfg_bizcore_key)) { | ||||
@@ -31,57 +31,43 @@ function SpGetPinyin($str, $ishead=0, $isclose=1) | |||||
$client = new DedeBizClient($cfg_bizcore_hostname, $cfg_bizcore_port); | $client = new DedeBizClient($cfg_bizcore_hostname, $cfg_bizcore_port); | ||||
$client->appid = $cfg_bizcore_appid; | $client->appid = $cfg_bizcore_appid; | ||||
$client->key = $cfg_bizcore_key; | $client->key = $cfg_bizcore_key; | ||||
$data = $client->Pinyin($str,""); | |||||
$data = $client->Pinyin($str, ""); | |||||
$restr = $data->data; | $restr = $data->data; | ||||
$client->Close(); | $client->Close(); | ||||
} else { | } else { | ||||
$str = trim($str); | $str = trim($str); | ||||
$slen = strlen($str); | $slen = strlen($str); | ||||
if($slen < 2) | |||||
{ | |||||
if ($slen < 2) { | |||||
return $str; | return $str; | ||||
} | } | ||||
if(@count($pinyins) == 0) | |||||
{ | |||||
$fp = fopen(DEDEINC.'/data/pinyin.dat', 'r'); | |||||
while(!feof($fp)) | |||||
{ | |||||
if (@count($pinyins) == 0) { | |||||
$fp = fopen(DEDEINC . '/data/pinyin.dat', 'r'); | |||||
while (!feof($fp)) { | |||||
$line = trim(fgets($fp)); | $line = trim(fgets($fp)); | ||||
$pinyins[$line[0].$line[1]] = substr($line, 3, strlen($line)-3); | |||||
$pinyins[$line[0] . $line[1]] = substr($line, 3, strlen($line) - 3); | |||||
} | } | ||||
fclose($fp); | fclose($fp); | ||||
} | } | ||||
for($i=0; $i<$slen; $i++) | |||||
{ | |||||
if(ord($str[$i])>0x80) | |||||
{ | |||||
$c = $str[$i].$str[$i+1]; | |||||
for ($i = 0; $i < $slen; $i++) { | |||||
if (ord($str[$i]) > 0x80) { | |||||
$c = $str[$i] . $str[$i + 1]; | |||||
$i++; | $i++; | ||||
if(isset($pinyins[$c])) | |||||
{ | |||||
if($ishead==0) | |||||
{ | |||||
if (isset($pinyins[$c])) { | |||||
if ($ishead == 0) { | |||||
$restr .= $pinyins[$c]; | $restr .= $pinyins[$c]; | ||||
} | |||||
else | |||||
{ | |||||
} else { | |||||
$restr .= $pinyins[$c][0]; | $restr .= $pinyins[$c][0]; | ||||
} | } | ||||
}else | |||||
{ | |||||
} else { | |||||
$restr .= "_"; | $restr .= "_"; | ||||
} | } | ||||
}else if( preg_match("/[a-z0-9]/i", $str[$i]) ) | |||||
{ | |||||
} else if (preg_match("/[a-z0-9]/i", $str[$i])) { | |||||
$restr .= $str[$i]; | $restr .= $str[$i]; | ||||
} | |||||
else | |||||
{ | |||||
} else { | |||||
$restr .= "_"; | $restr .= "_"; | ||||
} | } | ||||
} | } | ||||
if($isclose==0) | |||||
{ | |||||
if ($isclose == 0) { | |||||
unset($pinyins); | unset($pinyins); | ||||
} | } | ||||
} | } | ||||
@@ -99,37 +85,29 @@ function SpGetPinyin($str, $ishead=0, $isclose=1) | |||||
*/ | */ | ||||
function SpCreateDir($spath) | function SpCreateDir($spath) | ||||
{ | { | ||||
global $cfg_dir_purview,$cfg_basedir,$cfg_ftp_mkdir,$isSafeMode; | |||||
if($spath=='') | |||||
{ | |||||
global $cfg_dir_purview, $cfg_basedir, $cfg_ftp_mkdir, $isSafeMode; | |||||
if ($spath == '') { | |||||
return true; | return true; | ||||
} | } | ||||
$flink = false; | $flink = false; | ||||
$truepath = $cfg_basedir; | $truepath = $cfg_basedir; | ||||
$truepath = str_replace("\\","/",$truepath); | |||||
$spaths = explode("/",$spath); | |||||
$truepath = str_replace("\\", "/", $truepath); | |||||
$spaths = explode("/", $spath); | |||||
$spath = ""; | $spath = ""; | ||||
foreach($spaths as $spath) | |||||
{ | |||||
if($spath=="") | |||||
{ | |||||
foreach ($spaths as $spath) { | |||||
if ($spath == "") { | |||||
continue; | continue; | ||||
} | } | ||||
$spath = trim($spath); | $spath = trim($spath); | ||||
$truepath .= "/".$spath; | |||||
if(!is_dir($truepath) || !is_writeable($truepath)) | |||||
{ | |||||
if(!is_dir($truepath)) | |||||
{ | |||||
$isok = MkdirAll($truepath,$cfg_dir_purview); | |||||
} | |||||
else | |||||
{ | |||||
$isok = ChmodAll($truepath,$cfg_dir_purview); | |||||
$truepath .= "/" . $spath; | |||||
if (!is_dir($truepath) || !is_writeable($truepath)) { | |||||
if (!is_dir($truepath)) { | |||||
$isok = MkdirAll($truepath, $cfg_dir_purview); | |||||
} else { | |||||
$isok = ChmodAll($truepath, $cfg_dir_purview); | |||||
} | } | ||||
if(!$isok) | |||||
{ | |||||
echo "创建或修改目录:".$truepath." 失败!<br>"; | |||||
if (!$isok) { | |||||
echo "创建或修改目录:" . $truepath . " 失败!<br>"; | |||||
CloseFtp(); | CloseFtp(); | ||||
return false; | return false; | ||||
} | } | ||||
@@ -141,13 +119,13 @@ function SpCreateDir($spath) | |||||
function jsScript($js) | function jsScript($js) | ||||
{ | { | ||||
$out = "<script type=\"text/javascript\">"; | |||||
$out .= "//<![CDATA[\n"; | |||||
$out .= $js; | |||||
$out .= "\n//]]>"; | |||||
$out .= "</script>\n"; | |||||
$out = "<script type=\"text/javascript\">"; | |||||
$out .= "//<![CDATA[\n"; | |||||
$out .= $js; | |||||
$out .= "\n//]]>"; | |||||
$out .= "</script>\n"; | |||||
return $out; | |||||
return $out; | |||||
} | } | ||||
/** | /** | ||||
@@ -162,45 +140,37 @@ function jsScript($js) | |||||
* @param string $isfullpage 是否全屏 | * @param string $isfullpage 是否全屏 | ||||
* @return string | * @return string | ||||
*/ | */ | ||||
function SpGetEditor($fname,$fvalue,$nheight="350",$etype="Basic",$gtype="print",$isfullpage="false",$bbcode=false) | |||||
function SpGetEditor($fname, $fvalue, $nheight = "350", $etype = "Basic", $gtype = "print", $isfullpage = "false", $bbcode = false) | |||||
{ | { | ||||
global $cfg_ckeditor_initialized; | global $cfg_ckeditor_initialized; | ||||
if(!isset($GLOBALS['cfg_html_editor'])) | |||||
{ | |||||
$GLOBALS['cfg_html_editor']='fck'; | |||||
if (!isset($GLOBALS['cfg_html_editor'])) { | |||||
$GLOBALS['cfg_html_editor'] = 'fck'; | |||||
} | } | ||||
if($gtype=="") | |||||
{ | |||||
if ($gtype == "") { | |||||
$gtype = "print"; | $gtype = "print"; | ||||
} | } | ||||
if($GLOBALS['cfg_html_editor']=='fck') | |||||
{ | |||||
require_once(DEDEINC.'/FCKeditor/fckeditor.php'); | |||||
if ($GLOBALS['cfg_html_editor'] == 'fck') { | |||||
require_once(DEDEINC . '/FCKeditor/fckeditor.php'); | |||||
$fck = new FCKeditor($fname); | $fck = new FCKeditor($fname); | ||||
$fck->BasePath = $GLOBALS['cfg_cmspath'].'/include/FCKeditor/' ; | |||||
$fck->Width = '100%' ; | |||||
$fck->Height = $nheight ; | |||||
$fck->ToolbarSet = $etype ; | |||||
$fck->BasePath = $GLOBALS['cfg_cmspath'] . '/include/FCKeditor/'; | |||||
$fck->Width = '100%'; | |||||
$fck->Height = $nheight; | |||||
$fck->ToolbarSet = $etype; | |||||
$fck->Config['FullPage'] = $isfullpage; | $fck->Config['FullPage'] = $isfullpage; | ||||
if($GLOBALS['cfg_fck_xhtml']=='Y') | |||||
{ | |||||
if ($GLOBALS['cfg_fck_xhtml'] == 'Y') { | |||||
$fck->Config['EnableXHTML'] = 'true'; | $fck->Config['EnableXHTML'] = 'true'; | ||||
$fck->Config['EnableSourceXHTML'] = 'true'; | $fck->Config['EnableSourceXHTML'] = 'true'; | ||||
} | } | ||||
$fck->Value = $fvalue ; | |||||
if($gtype=="print") | |||||
{ | |||||
$fck->Value = $fvalue; | |||||
if ($gtype == "print") { | |||||
$fck->Create(); | $fck->Create(); | ||||
} | |||||
else | |||||
{ | |||||
} else { | |||||
return $fck->CreateHtml(); | return $fck->CreateHtml(); | ||||
} | } | ||||
} | |||||
else if($GLOBALS['cfg_html_editor']=='ckeditor') | |||||
{ | |||||
} else if ($GLOBALS['cfg_html_editor'] == 'ckeditor') { | |||||
$addConfig = ""; | $addConfig = ""; | ||||
if (defined("DEDEADMIN")) { | if (defined("DEDEADMIN")) { | ||||
// $addConfig = ",{filebrowserImageUploadUrl:'./dialog/select_images_post.php',filebrowserUploadUrl:'./dialog/select_media_post.php'}"; | |||||
$addConfig = ",{filebrowserImageUploadUrl:'./dialog/select_images_post.php'}"; | $addConfig = ",{filebrowserImageUploadUrl:'./dialog/select_images_post.php'}"; | ||||
} | } | ||||
$code = <<<EOT | $code = <<<EOT | ||||
@@ -210,15 +180,12 @@ function SpGetEditor($fname,$fvalue,$nheight="350",$etype="Basic",$gtype="print" | |||||
var editor = CKEDITOR.replace('{$fname}'{$addConfig}); | var editor = CKEDITOR.replace('{$fname}'{$addConfig}); | ||||
</script> | </script> | ||||
EOT; | EOT; | ||||
if($gtype=="print") | |||||
{ | |||||
if ($gtype == "print") { | |||||
echo $code; | echo $code; | ||||
} | |||||
else | |||||
{ | |||||
} else { | |||||
return $code; | return $code; | ||||
} | } | ||||
} else { | |||||
} else { | |||||
/* | /* | ||||
// ------------------------------------------------------------------------ | // ------------------------------------------------------------------------ | ||||
// 当前版本,暂时取消dedehtml编辑器的支持 | // 当前版本,暂时取消dedehtml编辑器的支持 | ||||
@@ -249,12 +216,11 @@ EOT; | |||||
*/ | */ | ||||
function SpGetNewInfo() | function SpGetNewInfo() | ||||
{ | { | ||||
global $cfg_version_detail,$dsql; | |||||
global $cfg_version_detail, $dsql; | |||||
$nurl = $_SERVER['HTTP_HOST']; | $nurl = $_SERVER['HTTP_HOST']; | ||||
if( preg_match("#[a-z\-]{1,}\.[a-z]{2,}#i",$nurl) ) { | |||||
if (preg_match("#[a-z\-]{1,}\.[a-z]{2,}#i", $nurl)) { | |||||
$nurl = urlencode($nurl); | $nurl = urlencode($nurl); | ||||
} | |||||
else { | |||||
} else { | |||||
$nurl = "test"; | $nurl = "test"; | ||||
} | } | ||||
$phpv = phpversion(); | $phpv = phpversion(); | ||||
@@ -263,13 +229,11 @@ function SpGetNewInfo() | |||||
$add_query = ''; | $add_query = ''; | ||||
$query = "SELECT COUNT(*) AS dd FROM `#@__member` "; | $query = "SELECT COUNT(*) AS dd FROM `#@__member` "; | ||||
$row1 = $dsql->GetOne($query); | $row1 = $dsql->GetOne($query); | ||||
if ( $row1 ) $add_query .= "&mcount={$row1['dd']}"; | |||||
if ($row1) $add_query .= "&mcount={$row1['dd']}"; | |||||
$query = "SELECT COUNT(*) AS dd FROM `#@__arctiny` "; | $query = "SELECT COUNT(*) AS dd FROM `#@__arctiny` "; | ||||
$row2 = $dsql->GetOne($query); | $row2 = $dsql->GetOne($query); | ||||
if ( $row2 ) $add_query .= "&acount={$row2['dd']}"; | |||||
$offUrl = DEDEBIZURL."/version?version={$cfg_version_detail}&formurl={$nurl}&phpver={$phpv}&os={$sp_os}&mysqlver={$mysql_ver}{$add_query}"; | |||||
if ($row2) $add_query .= "&acount={$row2['dd']}"; | |||||
$offUrl = DEDEBIZURL . "/version?version={$cfg_version_detail}&formurl={$nurl}&phpver={$phpv}&os={$sp_os}&mysqlver={$mysql_ver}{$add_query}"; | |||||
return $offUrl; | return $offUrl; | ||||
} | } | ||||
?> |
@@ -3,24 +3,24 @@ | |||||
* For licensing, see https://ckeditor.com/legal/ckeditor-oss-license | * For licensing, see https://ckeditor.com/legal/ckeditor-oss-license | ||||
*/ | */ | ||||
CKEDITOR.editorConfig = function( config ) { | |||||
CKEDITOR.editorConfig = function (config) { | |||||
config.toolbarGroups = [ | config.toolbarGroups = [ | ||||
{ name: 'document', groups: [ 'mode', 'document', 'doctools' ] }, | |||||
{ name: 'clipboard', groups: [ 'clipboard', 'undo' ] }, | |||||
{ name: 'editing', groups: [ 'find', 'selection', 'spellchecker', 'editing' ] }, | |||||
{ name: 'forms', groups: [ 'forms' ] }, | |||||
{ name: 'document', groups: ['mode', 'document', 'doctools'] }, | |||||
{ name: 'clipboard', groups: ['clipboard', 'undo'] }, | |||||
{ name: 'editing', groups: ['find', 'selection', 'spellchecker', 'editing'] }, | |||||
{ name: 'forms', groups: ['forms'] }, | |||||
'/', | '/', | ||||
{ name: 'basicstyles', groups: [ 'basicstyles', 'cleanup' ] }, | |||||
{ name: 'paragraph', groups: [ 'list', 'indent', 'blocks', 'align', 'bidi', 'paragraph' ] }, | |||||
{ name: 'links', groups: [ 'links' ] }, | |||||
{ name: 'insert', groups: [ 'insert' ] }, | |||||
{ name: 'basicstyles', groups: ['basicstyles', 'cleanup'] }, | |||||
{ name: 'paragraph', groups: ['list', 'indent', 'blocks', 'align', 'bidi', 'paragraph'] }, | |||||
{ name: 'links', groups: ['links'] }, | |||||
{ name: 'insert', groups: ['insert'] }, | |||||
'/', | '/', | ||||
{ name: 'styles', groups: [ 'styles' ] }, | |||||
{ name: 'colors', groups: [ 'colors' ] }, | |||||
{ name: 'tools', groups: [ 'tools' ] } | |||||
{ name: 'styles', groups: ['styles'] }, | |||||
{ name: 'colors', groups: ['colors'] }, | |||||
{ name: 'tools', groups: ['tools'] } | |||||
]; | ]; | ||||
config.extraPlugins = 'dedepagebreak'; | |||||
config.extraPlugins = 'html5video,dedepagebreak'; | |||||
config.removeButtons = 'About,ShowBlocks,Iframe,Flash,Form,Checkbox,Radio,TextField,Textarea,Select,Button,ImageButton,HiddenField'; | config.removeButtons = 'About,ShowBlocks,Iframe,Flash,Form,Checkbox,Radio,TextField,Textarea,Select,Button,ImageButton,HiddenField'; | ||||
@@ -0,0 +1,259 @@ | |||||
CKEDITOR.dialog.add( 'html5video', function( editor ) { | |||||
return { | |||||
title: editor.lang.html5video.title, | |||||
minWidth: 500, | |||||
minHeight: 100, | |||||
contents: [ { | |||||
id: 'info', | |||||
label: editor.lang.html5video.infoLabel, | |||||
elements: [ | |||||
{ | |||||
type: 'vbox', | |||||
padding: 0, | |||||
children: [ | |||||
{ | |||||
type: 'hbox', | |||||
widths: [ '365px', '110px' ], | |||||
align: 'right', | |||||
children: [ { | |||||
type: 'text', | |||||
id: 'url', | |||||
label: editor.lang.html5video.allowed, | |||||
required: true, | |||||
validate: CKEDITOR.dialog.validate.notEmpty( editor.lang.html5video.urlMissing ), | |||||
setup: function( widget ) { | |||||
this.setValue( widget.data.src ); | |||||
}, | |||||
commit: function( widget ) { | |||||
widget.setData( 'src', this.getValue() ); | |||||
} | |||||
}, | |||||
{ | |||||
type: 'button', | |||||
id: 'browse', | |||||
// v-align with the 'txtUrl' field. | |||||
// TODO: We need something better than a fixed size here. | |||||
style: 'display:inline-block;margin-top:14px;', | |||||
align: 'center', | |||||
label: editor.lang.common.browseServer, | |||||
hidden: true, | |||||
filebrowser: 'info:url' | |||||
} ] | |||||
} ] | |||||
}, | |||||
{ | |||||
type: 'checkbox', | |||||
id: 'responsive', | |||||
label: editor.lang.html5video.responsive, | |||||
setup: function( widget ) { | |||||
this.setValue( widget.data.responsive ); | |||||
}, | |||||
commit: function( widget ) { | |||||
widget.setData( 'responsive', this.getValue()?'true':'' ); | |||||
} | |||||
}, | |||||
{ | |||||
type: 'vbox', | |||||
padding: 0, | |||||
children: [{ | |||||
type: 'hbox', | |||||
widths: [ '365px', '110px' ], | |||||
align: 'right', | |||||
children: [ { | |||||
type: 'text', | |||||
id: 'poster', | |||||
label: editor.lang.html5video.poster, | |||||
setup: function( widget ) { | |||||
this.setValue( widget.data.poster ); | |||||
}, | |||||
commit: function( widget ) { | |||||
widget.setData( 'poster', this.getValue() ); | |||||
} | |||||
}, | |||||
{ | |||||
type: 'button', | |||||
id: 'browseposter', | |||||
// v-align with the 'txtUrl' field. | |||||
// TODO: We need something better than a fixed size here. | |||||
style: 'display:inline-block;margin-top:14px;', | |||||
align: 'center', | |||||
label: editor.lang.common.browseServer, | |||||
hidden: true, | |||||
filebrowser:{action:"Browse",target:"info:poster",url:editor.config.filebrowserImageBrowseUrl} | |||||
} ] | |||||
}] | |||||
}, | |||||
{ | |||||
type: 'checkbox', | |||||
id: 'controls', | |||||
label: editor.lang.html5video.controls, | |||||
setup: function (widget) { | |||||
this.setValue(widget.data.controls); | |||||
}, | |||||
commit: function (widget) { | |||||
widget.setData('controls', this.getValue() ? 'true' : ''); | |||||
} | |||||
}, | |||||
{ | |||||
type: 'hbox', | |||||
id: 'size', | |||||
children: [ { | |||||
type: 'text', | |||||
id: 'width', | |||||
label: editor.lang.common.width, | |||||
setup: function( widget ) { | |||||
if ( widget.data.width ) { | |||||
this.setValue( widget.data.width ); | |||||
} | |||||
}, | |||||
commit: function( widget ) { | |||||
widget.setData( 'width', this.getValue() ); | |||||
} | |||||
}, | |||||
{ | |||||
type: 'text', | |||||
id: 'height', | |||||
label: editor.lang.common.height, | |||||
setup: function( widget ) { | |||||
if ( widget.data.height ) { | |||||
this.setValue( widget.data.height ); | |||||
} | |||||
}, | |||||
commit: function( widget ) { | |||||
widget.setData( 'height', this.getValue() ); | |||||
} | |||||
}, | |||||
] | |||||
}, | |||||
{ | |||||
type: 'hbox', | |||||
id: 'alignment', | |||||
children: [ { | |||||
type: 'radio', | |||||
id: 'align', | |||||
label: editor.lang.common.align, | |||||
items: [ | |||||
[editor.lang.common.alignCenter, 'center'], | |||||
[editor.lang.common.alignLeft, 'left'], | |||||
[editor.lang.common.alignRight, 'right'], | |||||
[editor.lang.common.alignNone, 'none'] | |||||
], | |||||
'default': 'center', | |||||
setup: function( widget ) { | |||||
if ( widget.data.align ) { | |||||
this.setValue( widget.data.align ); | |||||
} | |||||
}, | |||||
commit: function( widget ) { | |||||
widget.setData( 'align', this.getValue() ); | |||||
} | |||||
} ] | |||||
} ] | |||||
}, | |||||
{ | |||||
id: 'Upload', | |||||
hidden: true, | |||||
filebrowser: 'uploadButton', | |||||
label: editor.lang.html5video.upload, | |||||
elements: [ { | |||||
type: 'file', | |||||
id: 'upload', | |||||
label: editor.lang.html5video.btnUpload, | |||||
style: 'height:40px', | |||||
size: 38 | |||||
}, | |||||
{ | |||||
type: 'fileButton', | |||||
id: 'uploadButton', | |||||
filebrowser: 'info:url', | |||||
label: editor.lang.html5video.btnUpload, | |||||
'for': [ 'Upload', 'upload' ] | |||||
} ] | |||||
}, | |||||
{ | |||||
id: 'advanced', | |||||
label: editor.lang.html5video.advanced, | |||||
elements: [ { | |||||
type: 'vbox', | |||||
padding: 10, | |||||
children: [ { | |||||
type: 'hbox', | |||||
widths: ["33%", "33%", "33%"], | |||||
children: [ { | |||||
type: 'radio', | |||||
id: 'autoplay', | |||||
label: editor.lang.html5video.autoplay, | |||||
items: [ | |||||
[editor.lang.html5video.yes, 'yes'], | |||||
[editor.lang.html5video.no, 'no'] | |||||
], | |||||
'default': 'no', | |||||
setup: function( widget ) { | |||||
if ( widget.data.autoplay ) { | |||||
this.setValue( widget.data.autoplay ); | |||||
} | |||||
}, | |||||
commit: function( widget ) { | |||||
widget.setData( 'autoplay', this.getValue() ); | |||||
} | |||||
}, | |||||
{ | |||||
type: 'radio', | |||||
id: 'loop', | |||||
label: editor.lang.html5video.loop, | |||||
items: [ | |||||
[editor.lang.html5video.yes, 'yes'], | |||||
[editor.lang.html5video.no, 'no'] | |||||
], | |||||
'default': 'no', | |||||
setup: function( widget ) { | |||||
if ( widget.data.loop ) { | |||||
this.setValue( widget.data.loop ); | |||||
} | |||||
}, | |||||
commit: function( widget ) { | |||||
widget.setData( 'loop', this.getValue() ); | |||||
} | |||||
}, | |||||
{ | |||||
type: 'radio', | |||||
id: 'allowdownload', | |||||
label: editor.lang.html5video.allowdownload, | |||||
items: [ | |||||
[editor.lang.html5video.yes, 'yes'], | |||||
[editor.lang.html5video.no, 'no'] | |||||
], | |||||
'default': 'no', | |||||
setup: function( widget ) { | |||||
if ( widget.data.allowdownload ) { | |||||
this.setValue(widget.data.allowdownload); | |||||
} | |||||
}, | |||||
commit: function( widget ) { | |||||
widget.setData( 'allowdownload', this.getValue() ); | |||||
} | |||||
} ] | |||||
}, | |||||
{ | |||||
type: 'hbox', | |||||
children: [ { | |||||
type: "text", | |||||
id: 'advisorytitle', | |||||
label: editor.lang.html5video.advisorytitle, | |||||
'default': '', | |||||
setup: function( widget ) { | |||||
if ( widget.data.advisorytitle ) { | |||||
this.setValue(widget.data.advisorytitle); | |||||
} | |||||
}, | |||||
commit: function( widget ) { | |||||
widget.setData( 'advisorytitle', this.getValue() ); | |||||
} | |||||
} ] | |||||
} ] | |||||
} ] | |||||
} ] | |||||
}; | |||||
} ); |
@@ -0,0 +1,20 @@ | |||||
CKEDITOR.plugins.setLang( 'html5video', 'bg', { | |||||
button: 'Вмъква HTML5 видео', | |||||
title: 'HTML5 видео', | |||||
infoLabel: 'Видео', | |||||
allowed: 'Допустими файлови разширения: MP4, WebM, Ogv', | |||||
urlMissing: 'URL адресът на източника на видео липсва.', | |||||
videoProperties: 'Свойства на видео', | |||||
upload: 'Качване', | |||||
btnUpload: 'Изпрати на сървъра', | |||||
advanced: 'Разширено', | |||||
autoplay: 'Автоматично изпълнение', | |||||
allowdownload: 'Позволено изтегляне?', | |||||
advisorytitle: 'Заглавие', | |||||
yes: 'Да', | |||||
no: 'Не', | |||||
loop: 'Циклично изпълнение', | |||||
responsive: 'Адаптивна ширина', | |||||
controls: 'Показване на контролите', | |||||
poster: 'URL миниатюра' | |||||
} ); |
@@ -0,0 +1,20 @@ | |||||
CKEDITOR.plugins.setLang( 'html5video', 'ca', { | |||||
button: "Insereix un vídeo HTML5", | |||||
title: "Vídeo HTML5", | |||||
infoLabel: "Informació del vídeo", | |||||
allowed: "Extensions d'arxius permeses: MP4, WebM, Ogv", | |||||
urlMissing: "Falta l'URL de la font de vídeo.", | |||||
videoProperties: "Propietats de vídeo", | |||||
upload: "Pujar", | |||||
btnUpload: "Envia-lo al servidor", | |||||
advanced: "Avançat", | |||||
autoplay: "Reproducció automàtica?", | |||||
allowdownload: 'Allow download?', | |||||
advisorytitle: 'Advisory title', | |||||
yes: "Sí", | |||||
no: "No", | |||||
loop: "Bucle?", | |||||
responsive: "Ample adaptatiu", | |||||
controls: "Mostra els controls", | |||||
poster: "Miniatura" | |||||
} ); |
@@ -0,0 +1,17 @@ | |||||
CKEDITOR.plugins.setLang( 'html5video', 'de', { | |||||
button: 'HTML5 Video einfügen', | |||||
title: 'HTML5 Video', | |||||
infoLabel: 'Video Infos', | |||||
allowed: 'Erlaubte Dateierweiterungen: MP4, WebM, Ogv', | |||||
urlMissing: 'Sie haben keine URL zur Video-Datei angegeben.', | |||||
videoProperties: 'Video-Einstellungen', | |||||
upload: 'Hochladen', | |||||
btnUpload: 'Zum Server senden', | |||||
advanced: 'Erweitert', | |||||
autoplay: 'Autoplay?', | |||||
allowdownload: 'Allow download?', | |||||
advisorytitle: 'Advisory title', | |||||
yes: 'Ja', | |||||
no: 'Nein', | |||||
controls: 'Steuerelemente anzeigen' | |||||
} ); |
@@ -0,0 +1,20 @@ | |||||
CKEDITOR.plugins.setLang( 'html5video', 'en', { | |||||
button: 'Insert HTML5 video', | |||||
title: 'HTML5 video', | |||||
infoLabel: 'Video info', | |||||
allowed: 'Allowed file extensions: MP4, WebM, Ogv', | |||||
urlMissing: 'Video source URL is missing.', | |||||
videoProperties: 'Video properties', | |||||
upload: 'Upload', | |||||
btnUpload: 'Send it to the server', | |||||
advanced: 'Advanced', | |||||
autoplay: 'Autoplay?', | |||||
allowdownload: 'Allow download?', | |||||
advisorytitle: 'Advisory title', | |||||
yes: 'Yes', | |||||
no: 'No', | |||||
loop: 'Loop?', | |||||
responsive: 'Responsive width', | |||||
controls: 'Show controls', | |||||
poster: 'Thumbnail' | |||||
} ); |
@@ -0,0 +1,18 @@ | |||||
CKEDITOR.plugins.setLang( 'html5video', 'es', { | |||||
button: 'Insertar video HTML5', | |||||
title: 'Video HTML5', | |||||
infoLabel: 'Información del video', | |||||
allowed: 'Extensiones de archivo permitidas: MP4, WebM, Ogv', | |||||
urlMissing: 'La URL del video no puede estar vacía.', | |||||
videoProperties: 'Propiedades del video', | |||||
upload: 'Cargar', | |||||
btnUpload: 'Enviar al servidor', | |||||
advanced: 'Avanzado', | |||||
autoplay: '¿Reproducir automáticamente?', | |||||
allowdownload: 'Allow download?', | |||||
advisorytitle: 'Advisory title', | |||||
yes: 'Sí', | |||||
no: 'No', | |||||
responsive: '¿Responsive?', | |||||
controls: 'Mostrar controles' | |||||
} ); |
@@ -0,0 +1,17 @@ | |||||
CKEDITOR.plugins.setLang( 'html5video', 'eu', { | |||||
button: 'Txertatu HTML5 bideoa', | |||||
title: 'HTML5 bideoa', | |||||
infoLabel: 'Bideoaren informazioa', | |||||
allowed: 'Baimendutako fitxategi luzapenak: MP4, WebM, Ogv', | |||||
urlMissing: 'Bideoaren URLak ezin du hutsik egon.', | |||||
videoProperties: 'Bideoaren propietateak', | |||||
upload: 'Kargatu', | |||||
btnUpload: 'Bidali zerbitzarira', | |||||
advanced: 'Aurreratua', | |||||
autoplay: 'Automatikoki erreproduzitu?', | |||||
allowdownload: 'Allow download?', | |||||
advisorytitle: 'Advisory title', | |||||
yes: 'Bai', | |||||
no: 'Ez', | |||||
controls: 'Erakutsi kontrolak?' | |||||
} ); |
@@ -0,0 +1,18 @@ | |||||
CKEDITOR.plugins.setLang( 'html5video', 'fa', { | |||||
button: 'وارد کردن ویدیوی HTML5', | |||||
title: 'ویدیوی HTML5', | |||||
infoLabel: 'اطلاعات ویدیو', | |||||
allowed: 'پسوندهای مجاز فایل: MP4, WebM, Ogv', | |||||
urlMissing: 'URL منبع ویدیو پیدا نشد.', | |||||
videoProperties: 'خواهص ویدیو', | |||||
upload: 'بارگذاری', | |||||
btnUpload: 'ارسال به سرور', | |||||
advanced: 'پیشرفته', | |||||
autoplay: 'پخش خودکار؟', | |||||
allowdownload: 'Allow download?', | |||||
advisorytitle: 'Advisory title', | |||||
yes: 'بله', | |||||
no: 'خیر', | |||||
responsive: 'عرض واکنشگرا', | |||||
controls: 'نمایش کنترل؟' | |||||
} ); |
@@ -0,0 +1,17 @@ | |||||
CKEDITOR.plugins.setLang( 'html5video', 'fr', { | |||||
button: 'Insérer un lecteur video HTML5', | |||||
title: 'HTML5 video', | |||||
infoLabel: 'Informations video', | |||||
allowed: 'Extensions de fichiers autorisées: MP4, WebM, Ogv', | |||||
urlMissing: 'URL de la source video manquante. Veuillez la renseigner.', | |||||
videoProperties: 'Propriétés Video', | |||||
upload: 'Télécharger', | |||||
btnUpload: 'Envoyer vers le serveur', | |||||
advanced: 'Avancé', | |||||
autoplay: 'Jouer automatiquement ?', | |||||
allowdownload: 'Allow download?', | |||||
advisorytitle: 'Advisory title', | |||||
yes: 'Oui', | |||||
no: 'Non', | |||||
controls: 'Afficher les contrôles ?' | |||||
} ); |
@@ -0,0 +1,18 @@ | |||||
CKEDITOR.plugins.setLang('html5video', 'he', { | |||||
button: 'הוסף וידאו HTML5', | |||||
title: 'וידאו HTML5', | |||||
infoLabel: 'מידע וידאו', | |||||
allowed: 'סוגי קבצים מורשים: MP4, WebM, Ogv', | |||||
urlMissing: 'כתובת הוידאו חסרה', | |||||
videoProperties: 'מאפייני וידאו', | |||||
upload: 'העלה', | |||||
btnUpload: 'שלח לשרת', | |||||
advanced: 'מתקדם', | |||||
autoplay: 'ניגון אוטומטי?', | |||||
allowdownload: 'Allow download?', | |||||
advisorytitle: 'Advisory title', | |||||
yes: 'כן', | |||||
no: 'לא', | |||||
responsive: 'רוחב רספונסיבי' | |||||
}); |
@@ -0,0 +1,20 @@ | |||||
CKEDITOR.plugins.setLang( 'html5video', 'ko', { | |||||
button: 'HTML5 비디오 추가하기', | |||||
title: 'HTML5 비디오', | |||||
infoLabel: '비디오 정보', | |||||
allowed: '허용된 파일 확장자들: MP4, WebM, Ogv', | |||||
urlMissing: '비디오 Url이 없습니다.', | |||||
videoProperties: '비디오 속성', | |||||
upload: '업로드', | |||||
btnUpload: '서버로 전송', | |||||
advanced: '고급', | |||||
autoplay: '자동재생?', | |||||
allowdownload: 'Allow download?', | |||||
advisorytitle: 'Advisory title', | |||||
yes: '네', | |||||
no: '아니오', | |||||
loop: '무한반복?', | |||||
responsive: '반응형 너비', | |||||
controls: '컨트롤 보여주기', | |||||
poster: '썸네일' | |||||
} ); |
@@ -0,0 +1,18 @@ | |||||
CKEDITOR.plugins.setLang( 'html5video', 'pl', { | |||||
button: 'Wstaw HTML5 video', | |||||
title: 'HTML5 video', | |||||
infoLabel: 'Informacje', | |||||
allowed: 'Dozwolone typy plików: MP4, WebM, Ogv', | |||||
urlMissing: 'Nie znaleziono URL do pliku video.', | |||||
videoProperties: 'Właściwości', | |||||
upload: 'Wrzuć plik', | |||||
btnUpload: 'Wyślij na serwer', | |||||
advanced: 'Zaawansowane', | |||||
autoplay: 'Autoodtwarzanie?', | |||||
allowdownload: 'Allow download?', | |||||
advisorytitle: 'Advisory title', | |||||
yes: 'Tak', | |||||
no: 'Nie', | |||||
responsive: 'Szerokość responsywna', | |||||
controls: 'Pokaż kontrolki' | |||||
} ); |
@@ -0,0 +1,18 @@ | |||||
CKEDITOR.plugins.setLang( 'html5video', 'pt-br', { | |||||
button: 'Inserir vídeo HTML5', | |||||
title: 'HTML5 video', | |||||
infoLabel: 'Informações do Vídeo', | |||||
allowed: 'Extensões permitidas: MP4, WebM, Ogv', | |||||
urlMissing: 'O URL do vídeo está faltando.', | |||||
videoProperties: 'Propriedades do vídeo', | |||||
upload: 'Upload', | |||||
btnUpload: 'Enviar para o servidor', | |||||
advanced: 'Avançado', | |||||
autoplay: 'Autoplay?', | |||||
allowdownload: 'Allow download?', | |||||
advisorytitle: 'Advisory title', | |||||
yes: 'Sim', | |||||
no: 'Não', | |||||
responsive: 'Largura responsiva', | |||||
controls: 'Exibir controles' | |||||
} ); |
@@ -0,0 +1,18 @@ | |||||
CKEDITOR.plugins.setLang( 'html5video', 'pt', { | |||||
button: 'Inserir vídeo HTML5', | |||||
title: 'HTML5 video', | |||||
infoLabel: 'Informações do Vídeo', | |||||
allowed: 'Extensões permitidas: MP4, WebM, Ogv', | |||||
urlMissing: 'O URL do vídeo está faltando.', | |||||
videoProperties: 'Propriedades do vídeo', | |||||
upload: 'Upload', | |||||
btnUpload: 'Enviar para o servidor', | |||||
advanced: 'Avançado', | |||||
autoplay: 'Autoplay?', | |||||
allowdownload: 'Allow download?', | |||||
advisorytitle: 'Advisory title', | |||||
yes: 'Sim', | |||||
no: 'Não', | |||||
responsive: 'Largura responsiva', | |||||
controls: 'Exibir controles' | |||||
} ); |
@@ -0,0 +1,21 @@ | |||||
CKEDITOR.plugins.setLang( 'html5video', 'ru', { | |||||
button: 'Вставить HTML5 видео', | |||||
title: 'HTML5 видео', | |||||
infoLabel: 'Видео', | |||||
allowed: 'Допустимые расширения файлов: MP4, WebM, Ogv', | |||||
urlMissing: 'Не выбран источник видео', | |||||
videoProperties: 'Свойства видео', | |||||
upload: 'Загрузить', | |||||
btnUpload: 'Загрузить на сервер', | |||||
advanced: 'Дополнительно', | |||||
autoplay: 'Автовоспроизведение', | |||||
allowdownload: 'Разрешить загрузку', | |||||
advisorytitle: 'Заголовок', | |||||
yes: 'Да', | |||||
no: 'Нет', | |||||
responsive: 'Адаптивная ширина', | |||||
controls: 'Показать элементы управления', | |||||
loop: 'Зациклить', | |||||
poster: 'Постер', | |||||
advisorytitle: 'Пояснительный текст' | |||||
} ); |
@@ -0,0 +1,17 @@ | |||||
CKEDITOR.plugins.setLang( 'html5video', 'uk', { | |||||
button: 'Вставити HTML5 відео', | |||||
title: 'HTML5 відео', | |||||
infoLabel: 'Інформація', | |||||
allowed: 'Допустимі розширення файлів: MP4, WebM, Ogv', | |||||
urlMissing: 'Не обрано джерела відео', | |||||
videoProperties: 'Властивості відео', | |||||
upload: 'Відвантажити', | |||||
btnUpload: 'Відвантажити на сервер', | |||||
advanced: 'Додатково', | |||||
autoplay: 'Автовідтворення?', | |||||
allowdownload: 'Allow download?', | |||||
advisorytitle: 'Advisory title', | |||||
yes: 'Так', | |||||
no: 'Ні', | |||||
controls: 'Показати елементи керування?' | |||||
} ); |
@@ -0,0 +1,17 @@ | |||||
CKEDITOR.plugins.setLang( 'html5video', 'uz', { | |||||
button: 'HTML5 video qo‘shing', | |||||
title: 'HTML5 video', | |||||
infoLabel: 'Video ma\'lumot', | |||||
allowed: 'Ruxsat etilgan kengaytmalar: MP4, WebM, Ogv', | |||||
urlMissing: 'Video\'ning URL manbasi topilmadi.', | |||||
videoProperties: 'Video xususiyatlari', | |||||
upload: 'Yuklash', | |||||
btnUpload: 'Serverga jo‘natish', | |||||
advanced: 'Kengaytrilgan', | |||||
autoplay: 'Avtoijro?', | |||||
allowdownload: 'Allow download?', | |||||
advisorytitle: 'Advisory title', | |||||
yes: 'Ha', | |||||
no: 'Yo‘q', | |||||
controls: 'Tekshiruvlarni ko‘rsatish' | |||||
} ); |
@@ -0,0 +1,18 @@ | |||||
CKEDITOR.plugins.setLang( 'html5video', 'zh-cn', { | |||||
button: '发布HTML5视频', | |||||
title: 'HTML5视频', | |||||
infoLabel: '视频信息', | |||||
allowed: '支持格式: MP4, WebM, Ogv', | |||||
urlMissing: '视频url', | |||||
videoProperties: '视频属性', | |||||
upload: '上传视频', | |||||
btnUpload: '上传', | |||||
advanced: '高级', | |||||
autoplay: '自动播放', | |||||
allowdownload: 'Allow download?', | |||||
advisorytitle: 'Advisory title', | |||||
yes: '是', | |||||
no: '否', | |||||
responsive: '自动宽度', | |||||
controls: '显示控件?' | |||||
} ); |
@@ -0,0 +1,196 @@ | |||||
CKEDITOR.plugins.add( 'html5video', { | |||||
requires: 'widget', | |||||
lang: 'bg,ca,de,en,eu,es,ru,uk,fr,ko,pt,pt-br,pl', | |||||
icons: 'html5video', | |||||
init: function( editor ) { | |||||
editor.widgets.add( 'html5video', { | |||||
button: editor.lang.html5video.button, | |||||
template: '<div class="ckeditor-html5-video"></div>', | |||||
/* | |||||
* Allowed content rules (http://docs.ckeditor.com/#!/guide/dev_allowed_content_rules): | |||||
* - div-s with text-align,float,margin-left,margin-right inline style rules and required ckeditor-html5-video class. | |||||
* - video tags with src, controls, width and height attributes. | |||||
*/ | |||||
allowedContent: 'div[data-responsive](!ckeditor-html5-video){text-align,float,margin-left,margin-right}; video[src,poster,controls,autoplay,width, height,loop]{max-width,height};', | |||||
requiredContent: 'div(ckeditor-html5-video); video[src];', | |||||
upcast: function( element ) { | |||||
return element.name === 'div' && element.hasClass( 'ckeditor-html5-video' ); | |||||
}, | |||||
dialog: 'html5video', | |||||
init: function() { | |||||
var src = ''; | |||||
var autoplay = ''; | |||||
var loop = ''; | |||||
var controls = ''; | |||||
var align = this.element.getStyle( 'text-align' ); | |||||
var width = ''; | |||||
var height = ''; | |||||
var poster = ''; | |||||
// If there's a child (the video element) | |||||
if ( this.element.getChild( 0 ) ) { | |||||
// get it's attributes. | |||||
src = this.element.getChild( 0 ).getAttribute( 'src' ); | |||||
width = this.element.getChild( 0 ).getAttribute( 'width' ); | |||||
height = this.element.getChild( 0 ).getAttribute( 'height' ); | |||||
autoplay = this.element.getChild(0).getAttribute('autoplay'); | |||||
allowdownload = !this.element.getChild( 0 ).getAttribute( 'controlslist' ); | |||||
loop = this.element.getChild( 0 ).getAttribute( 'loop' ); | |||||
advisorytitle = this.element.getChild( 0 ).getAttribute( 'title' ); | |||||
controls = this.element.getChild(0).getAttribute('controls'); | |||||
responsive = this.element.getAttribute( 'data-responsive' ); | |||||
poster = this.element.getChild( 0 ).getAttribute( 'poster' ); | |||||
} | |||||
if ( src ) { | |||||
this.setData( 'src', src ); | |||||
if ( align ) { | |||||
this.setData( 'align', align ); | |||||
} else { | |||||
this.setData( 'align', 'none' ); | |||||
} | |||||
if ( width ) { | |||||
this.setData( 'width', width ); | |||||
} | |||||
if ( height ) { | |||||
this.setData( 'height', height ); | |||||
} | |||||
if ( autoplay ) { | |||||
this.setData( 'autoplay', 'yes' ); | |||||
} | |||||
if ( allowdownload ) { | |||||
this.setData( 'allowdownload', 'yes' ); | |||||
} | |||||
if ( loop ) { | |||||
this.setData( 'loop', 'yes' ); | |||||
} | |||||
if ( advisorytitle ) { | |||||
this.setData( 'advisorytitle', advisorytitle ); | |||||
} | |||||
if ( responsive ) { | |||||
this.setData( 'responsive', responsive ); | |||||
} | |||||
if (controls) { | |||||
this.setData('controls', controls); | |||||
} | |||||
if ( poster ) { | |||||
this.setData('poster', poster); | |||||
} | |||||
} | |||||
}, | |||||
data: function() { | |||||
// If there is an video source | |||||
if ( this.data.src ) { | |||||
// and there isn't a child (the video element) | |||||
if ( !this.element.getChild( 0 ) ) { | |||||
// Create a new <video> element. | |||||
var videoElement = new CKEDITOR.dom.element( 'video' ); | |||||
// Set the controls attribute. | |||||
if (this.data.controls) { | |||||
videoElement.setAttribute('controls', 'controls'); | |||||
} | |||||
// Append it to the container of the plugin. | |||||
this.element.append( videoElement ); | |||||
} | |||||
this.element.getChild( 0 ).setAttribute( 'src', this.data.src ); | |||||
if (this.data.width) this.element.getChild( 0 ).setAttribute( 'width', this.data.width ); | |||||
if (this.data.height) this.element.getChild( 0 ).setAttribute( 'height', this.data.height ); | |||||
if ( this.data.responsive ) { | |||||
this.element.setAttribute("data-responsive", this.data.responsive); | |||||
this.element.getChild( 0 ).setStyle( 'max-width', '100%' ); | |||||
this.element.getChild( 0 ).setStyle( 'height', 'auto' ); | |||||
} else { | |||||
this.element.removeAttribute("data-responsive"); | |||||
this.element.getChild( 0 ).removeStyle( 'max-width' ); | |||||
this.element.getChild( 0 ).removeStyle( 'height' ); | |||||
} | |||||
if (this.data.poster) this.element.getChild( 0 ).setAttribute('poster', this.data.poster); | |||||
} | |||||
this.element.removeStyle( 'float' ); | |||||
this.element.removeStyle( 'margin-left' ); | |||||
this.element.removeStyle( 'margin-right' ); | |||||
if ( this.data.align === 'none' ) { | |||||
this.element.removeStyle( 'text-align' ); | |||||
} else { | |||||
this.element.setStyle( 'text-align', this.data.align ); | |||||
} | |||||
if ( this.data.align === 'left' ) { | |||||
this.element.setStyle( 'float', this.data.align ); | |||||
this.element.setStyle( 'margin-right', '10px' ); | |||||
} else if ( this.data.align === 'right' ) { | |||||
this.element.setStyle( 'float', this.data.align ); | |||||
this.element.setStyle( 'margin-left', '10px' ); | |||||
} | |||||
if ( this.element.getChild( 0 ) ) { | |||||
if ( this.data.autoplay === 'yes' ) { | |||||
this.element.getChild( 0 ).setAttribute( 'autoplay', 'autoplay' ); | |||||
} else { | |||||
this.element.getChild( 0 ).removeAttribute( 'autoplay' ); | |||||
} | |||||
if ( this.data.loop === 'yes' ) { | |||||
this.element.getChild( 0 ).setAttribute( 'loop', 'loop' ); | |||||
} else { | |||||
this.element.getChild( 0 ).removeAttribute( 'loop' ); | |||||
} | |||||
if ( this.data.allowdownload === 'yes' ) { | |||||
this.element.getChild( 0 ).removeAttribute( 'controlslist' ); | |||||
} else { | |||||
this.element.getChild( 0 ).setAttribute( 'controlslist', 'nodownload' ); | |||||
} | |||||
if ( this.data.advisorytitle ) { | |||||
this.element.getChild( 0 ).setAttribute( 'title', this.data.advisorytitle ); | |||||
} else { | |||||
this.element.getChild( 0 ).removeAttribute( 'title' ); | |||||
} | |||||
if (this.data.controls) { | |||||
this.element.getChild(0).setAttribute('controls', 'controls'); | |||||
} else { | |||||
this.element.getChild(0).removeAttribute('controls'); | |||||
} | |||||
} | |||||
} | |||||
} ); | |||||
if ( editor.contextMenu ) { | |||||
editor.addMenuGroup( 'html5videoGroup' ); | |||||
editor.addMenuItem( 'html5videoPropertiesItem', { | |||||
label: editor.lang.html5video.videoProperties, | |||||
icon: 'html5video', | |||||
command: 'html5video', | |||||
group: 'html5videoGroup' | |||||
}); | |||||
editor.contextMenu.addListener( function( element ) { | |||||
if ( element && | |||||
element.getChild( 0 ) && | |||||
element.getChild( 0 ).hasClass && | |||||
element.getChild( 0 ).hasClass( 'ckeditor-html5-video' ) ) { | |||||
return { html5videoPropertiesItem: CKEDITOR.TRISTATE_OFF }; | |||||
} | |||||
}); | |||||
} | |||||
CKEDITOR.dialog.add( 'html5video', this.path + 'dialogs/html5video.js' ); | |||||
} | |||||
} ); |