修复文本框链接问题
This commit is contained in:
@@ -1,25 +1,24 @@
|
||||
(function () {
|
||||
/* eslint-disable */
|
||||
if (window.frameElement.id) {
|
||||
let parent = window.parent,
|
||||
var parent = window.parent;
|
||||
//dialog对象
|
||||
dialog = parent.$EDITORUI[window.frameElement.id.replace( /_iframe$/, '' )];
|
||||
//当前打开dialog的编辑器实例
|
||||
editor = dialog.editor;
|
||||
|
||||
dialog = parent.$EDITORUI[window.frameElement.id.replace(/_iframe$/, '')],
|
||||
UE = parent.UE;
|
||||
|
||||
editor = dialog.editor,
|
||||
domUtils = UE.dom.domUtils;
|
||||
|
||||
UE = parent.UE,
|
||||
utils = UE.utils;
|
||||
|
||||
domUtils = UE.dom.domUtils,
|
||||
browser = UE.browser;
|
||||
|
||||
utils = UE.utils,
|
||||
|
||||
browser = UE.browser,
|
||||
/* eslint-disable */
|
||||
ajax = UE.ajax,
|
||||
ajax = UE.ajax;
|
||||
|
||||
$G = function ( id ) {
|
||||
return document.getElementById( id )
|
||||
},
|
||||
};
|
||||
//focus元素
|
||||
$focus = function ( node ) {
|
||||
setTimeout( function () {
|
||||
if ( browser.ie ) {
|
||||
@@ -33,21 +32,22 @@
|
||||
};
|
||||
window.nowEditor = {editor: editor, dialog: dialog};
|
||||
utils.loadFile(document,{
|
||||
href: editor.options.themePath + editor.options.theme + '/dialogbase.css?cache=' + Math.random(),
|
||||
tag: 'link',
|
||||
type: 'text/css',
|
||||
rel: 'stylesheet'
|
||||
href:editor.options.themePath + editor.options.theme + "/dialogbase.css?cache="+Math.random(),
|
||||
tag:"link",
|
||||
type:"text/css",
|
||||
rel:"stylesheet"
|
||||
});
|
||||
var lang = editor.getLang(dialog.className.split('-')[2]);
|
||||
lang = editor.getLang(dialog.className.split( "-" )[2]);
|
||||
if(lang){
|
||||
domUtils.on(window,'load',function () {
|
||||
var langImgPath = editor.options.langPath + editor.options.lang + '/images/';
|
||||
|
||||
var langImgPath = editor.options.langPath + editor.options.lang + "/images/";
|
||||
//针对静态资源
|
||||
for (var i in lang['static']) {
|
||||
for ( var i in lang["static"] ) {
|
||||
var dom = $G( i );
|
||||
if(!dom) continue;
|
||||
let tagName = dom.tagName,
|
||||
content = lang['static'][i];
|
||||
var tagName = dom.tagName,
|
||||
content = lang["static"][i];
|
||||
if(content.src){
|
||||
//clone
|
||||
content = utils.extend({},content,false);
|
||||
@@ -55,19 +55,19 @@
|
||||
}
|
||||
if(content.style){
|
||||
content = utils.extend({},content,false);
|
||||
content.style = content.style.replace(/url\s*\(/g, 'url(' + langImgPath)
|
||||
content.style = content.style.replace(/url\s*\(/g,"url(" + langImgPath)
|
||||
}
|
||||
switch ( tagName.toLowerCase() ) {
|
||||
case 'var':
|
||||
case "var":
|
||||
dom.parentNode.replaceChild( document.createTextNode( content ), dom );
|
||||
break;
|
||||
case 'select':
|
||||
case "select":
|
||||
var ops = dom.options;
|
||||
for ( var j = 0, oj; oj = ops[j]; ) {
|
||||
oj.innerHTML = content.options[j++];
|
||||
}
|
||||
for ( var p in content ) {
|
||||
p != 'options' && dom.setAttribute(p, content[p]);
|
||||
p != "options" && dom.setAttribute( p, content[p] );
|
||||
}
|
||||
break;
|
||||
default :
|
||||
@@ -76,5 +76,7 @@
|
||||
}
|
||||
} );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
})();
|
||||
|
||||
|
||||
@@ -256,7 +256,7 @@ var scrawl = function (options) {
|
||||
|
||||
if (img) {
|
||||
if (!scaleCon) {
|
||||
picBoard.style.cssText = "position:relative;z-index:1;"+picBoard.style.cssText;
|
||||
picBoard.style.cssText = "position:relative;z-index:999;"+picBoard.style.cssText;
|
||||
img.style.cssText = "position: absolute;top:" + (canvas.height - img.height) / 2 + "px;left:" + (canvas.width - img.width) / 2 + "px;";
|
||||
var scale = new ScaleBoy();
|
||||
picBoard.appendChild(scale.init());
|
||||
@@ -268,7 +268,7 @@ var scrawl = function (options) {
|
||||
picBoard.style.zIndex = "";
|
||||
} else {
|
||||
scaleCon.style.visibility = "visible";
|
||||
picBoard.style.cssText += "position:relative;z-index:1";
|
||||
picBoard.style.cssText += "position:relative;z-index:999";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Binary file not shown.
Binary file not shown.
+202
-273
@@ -7,96 +7,25 @@
|
||||
*/
|
||||
UE.I18N['en'] = {
|
||||
'labelMap':{
|
||||
'anchor': 'Anchor',
|
||||
'undo': 'Undo',
|
||||
'redo': 'Redo',
|
||||
'bold': 'Bold',
|
||||
'indent': 'Indent',
|
||||
'snapscreen': 'SnapScreen',
|
||||
'italic': 'Italic',
|
||||
'underline': 'Underline',
|
||||
'strikethrough': 'Strikethrough',
|
||||
'subscript': 'SubScript',
|
||||
'fontborder': 'text border',
|
||||
'superscript': 'SuperScript',
|
||||
'formatmatch': 'Format Match',
|
||||
'source': 'Source',
|
||||
'blockquote': 'BlockQuote',
|
||||
'pasteplain': 'PastePlain',
|
||||
'selectall': 'SelectAll',
|
||||
'print': 'Print',
|
||||
'preview': 'Preview',
|
||||
'horizontal': 'Horizontal',
|
||||
'removeformat': 'RemoveFormat',
|
||||
'time': 'Time',
|
||||
'date': 'Date',
|
||||
'unlink': 'Unlink',
|
||||
'insertrow': 'InsertRow',
|
||||
'insertcol': 'InsertCol',
|
||||
'mergeright': 'MergeRight',
|
||||
'mergedown': 'MergeDown',
|
||||
'deleterow': 'DeleteRow',
|
||||
'deletecol': 'DeleteCol',
|
||||
'splittorows': 'SplitToRows',
|
||||
'insertcode': 'insert code',
|
||||
'splittocols': 'SplitToCols',
|
||||
'splittocells': 'SplitToCells',
|
||||
'deletecaption': 'DeleteCaption',
|
||||
'inserttitle': 'InsertTitle',
|
||||
'mergecells': 'MergeCells',
|
||||
'deletetable': 'DeleteTable',
|
||||
'cleardoc': 'Clear',
|
||||
'insertparagraphbeforetable': 'InsertParagraphBeforeTable',
|
||||
'fontfamily': 'FontFamily',
|
||||
'fontsize': 'FontSize',
|
||||
'paragraph': 'Paragraph',
|
||||
'simpleupload': 'Single Image',
|
||||
'insertimage': 'Multi Image',
|
||||
'edittable': 'Edit Table',
|
||||
'edittd': 'Edit Td',
|
||||
'link': 'Link',
|
||||
'emotion': 'Emotion',
|
||||
'spechars': 'Spechars',
|
||||
'searchreplace': 'SearchReplace',
|
||||
'map': 'BaiduMap',
|
||||
'gmap': 'GoogleMap',
|
||||
'insertvideo': 'Video',
|
||||
'help': 'Help',
|
||||
'justifyleft': 'JustifyLeft',
|
||||
'justifyright': 'JustifyRight',
|
||||
'justifycenter': 'JustifyCenter',
|
||||
'justifyjustify': 'Justify',
|
||||
'forecolor': 'FontColor',
|
||||
'backcolor': 'BackColor',
|
||||
'insertorderedlist': 'OL',
|
||||
'insertunorderedlist': 'UL',
|
||||
'fullscreen': 'FullScreen',
|
||||
'directionalityltr': 'EnterFromLeft',
|
||||
'directionalityrtl': 'EnterFromRight',
|
||||
'rowspacingtop': 'RowSpacingTop',
|
||||
'rowspacingbottom': 'RowSpacingBottom',
|
||||
'pagebreak': 'PageBreak',
|
||||
'insertframe': 'Iframe',
|
||||
'imagenone': 'Default',
|
||||
'imageleft': 'ImageLeft',
|
||||
'imageright': 'ImageRight',
|
||||
'attachment': 'Attachment',
|
||||
'imagecenter': 'ImageCenter',
|
||||
'wordimage': 'WordImage',
|
||||
'lineheight': 'LineHeight',
|
||||
'edittip': 'EditTip',
|
||||
'customstyle': 'CustomStyle',
|
||||
'scrawl': 'Scrawl',
|
||||
'autotypeset': 'AutoTypeset',
|
||||
'webapp': 'WebAPP',
|
||||
'touppercase': 'UpperCase',
|
||||
'tolowercase': 'LowerCase',
|
||||
'template': 'Template',
|
||||
'background': 'Background',
|
||||
'inserttable': 'InsertTable',
|
||||
'music': 'Music',
|
||||
'charts': 'charts',
|
||||
'drafts': 'Load from Drafts'
|
||||
'anchor':'Anchor', 'undo':'Undo', 'redo':'Redo', 'bold':'Bold', 'indent':'Indent', 'snapscreen':'SnapScreen',
|
||||
'italic':'Italic', 'underline':'Underline', 'strikethrough':'Strikethrough', 'subscript':'SubScript','fontborder':'text border',
|
||||
'superscript':'SuperScript', 'formatmatch':'Format Match', 'source':'Source', 'blockquote':'BlockQuote',
|
||||
'pasteplain':'PastePlain', 'selectall':'SelectAll', 'print':'Print', 'preview':'Preview',
|
||||
'horizontal':'Horizontal', 'removeformat':'RemoveFormat', 'time':'Time', 'date':'Date',
|
||||
'unlink':'Unlink', 'insertrow':'InsertRow', 'insertcol':'InsertCol', 'mergeright':'MergeRight', 'mergedown':'MergeDown',
|
||||
'deleterow':'DeleteRow', 'deletecol':'DeleteCol', 'splittorows':'SplitToRows','insertcode':'insert code',
|
||||
'splittocols':'SplitToCols', 'splittocells':'SplitToCells','deletecaption':'DeleteCaption','inserttitle':'InsertTitle',
|
||||
'mergecells':'MergeCells', 'deletetable':'DeleteTable', 'cleardoc':'Clear', 'insertparagraphbeforetable':"InsertParagraphBeforeTable",
|
||||
'fontfamily':'FontFamily', 'fontsize':'FontSize', 'paragraph':'Paragraph','simpleupload':'Single Image','insertimage':'Multi Image','edittable':'Edit Table', 'edittd':'Edit Td','link':'Link',
|
||||
'emotion':'Emotion', 'spechars':'Spechars', 'searchreplace':'SearchReplace', 'map':'BaiduMap', 'gmap':'GoogleMap',
|
||||
'insertvideo':'Video', 'help':'Help', 'justifyleft':'JustifyLeft', 'justifyright':'JustifyRight', 'justifycenter':'JustifyCenter',
|
||||
'justifyjustify':'Justify', 'forecolor':'FontColor', 'backcolor':'BackColor', 'insertorderedlist':'OL',
|
||||
'insertunorderedlist':'UL', 'fullscreen':'FullScreen', 'directionalityltr':'EnterFromLeft', 'directionalityrtl':'EnterFromRight',
|
||||
'rowspacingtop':'RowSpacingTop', 'rowspacingbottom':'RowSpacingBottom', 'pagebreak':'PageBreak', 'insertframe':'Iframe', 'imagenone':'Default',
|
||||
'imageleft':'ImageLeft', 'imageright':'ImageRight', 'attachment':'Attachment', 'imagecenter':'ImageCenter', 'wordimage':'WordImage',
|
||||
'lineheight':'LineHeight','edittip':'EditTip','customstyle':'CustomStyle', 'scrawl':'Scrawl', 'autotypeset':'AutoTypeset',
|
||||
'webapp':'WebAPP', 'touppercase':'UpperCase', 'tolowercase':'LowerCase','template':'Template','background':'Background','inserttable':'InsertTable',
|
||||
'music':'Music', 'charts': 'charts','drafts': 'Load from Drafts'
|
||||
},
|
||||
'insertorderedlist':{
|
||||
'num':'1,2,3...',
|
||||
@@ -142,34 +71,34 @@ UE.I18N['en'] = {
|
||||
'exceedSizeError': 'File Size Exceed',
|
||||
'exceedTypeError': 'File Type Not Allow',
|
||||
'jsonEncodeError': 'Server Return Format Error',
|
||||
'loading': 'loading...',
|
||||
'loadError': 'load error',
|
||||
'errorLoadConfig': 'Server config not loaded, upload can not work.'
|
||||
'loading':"loading...",
|
||||
'loadError':"load error",
|
||||
'errorLoadConfig': 'Server config not loaded, upload can not work.',
|
||||
},
|
||||
'simpleupload':{
|
||||
'exceedSizeError': 'File Size Exceed',
|
||||
'exceedTypeError': 'File Type Not Allow',
|
||||
'jsonEncodeError': 'Server Return Format Error',
|
||||
'loading': 'loading...',
|
||||
'loadError': 'load error',
|
||||
'errorLoadConfig': 'Server config not loaded, upload can not work.'
|
||||
'loading':"loading...",
|
||||
'loadError':"load error",
|
||||
'errorLoadConfig': 'Server config not loaded, upload can not work.',
|
||||
},
|
||||
'elementPathTip': 'Path',
|
||||
'wordCountTip': 'Word Count',
|
||||
'elementPathTip':"Path",
|
||||
'wordCountTip':"Word Count",
|
||||
'wordCountMsg':'{#count} characters entered,{#leave} left. ',
|
||||
'wordOverFlowMsg':'<span style="color:red;">The number of characters has exceeded allowable maximum values, the server may refuse to save!</span>',
|
||||
'ok': 'OK',
|
||||
'cancel': 'Cancel',
|
||||
'closeDialog': 'closeDialog',
|
||||
'tableDrag': 'You must import the file uiUtils.js before drag! ',
|
||||
'autofloatMsg': 'The plugin AutoFloat depends on EditorUI!',
|
||||
'ok':"OK",
|
||||
'cancel':"Cancel",
|
||||
'closeDialog':"closeDialog",
|
||||
'tableDrag':"You must import the file uiUtils.js before drag! ",
|
||||
'autofloatMsg':"The plugin AutoFloat depends on EditorUI!",
|
||||
'loadconfigError': 'Get server config error.',
|
||||
'loadconfigFormatError': 'Server config format error.',
|
||||
'loadconfigHttpError': 'Get server config http error.',
|
||||
'snapScreen_plugin':{
|
||||
'browserMsg': 'Only IE supported!',
|
||||
'callBackErrorMsg': 'The callback data is wrong,please check the config!',
|
||||
'uploadErrorMsg': 'Upload error,please check your server environment! '
|
||||
'browserMsg':"Only IE supported!",
|
||||
'callBackErrorMsg':"The callback data is wrong,please check the config!",
|
||||
'uploadErrorMsg':"Upload error,please check your server environment! "
|
||||
},
|
||||
'insertcode':{
|
||||
'as3':'ActionScript 3',
|
||||
@@ -197,31 +126,31 @@ UE.I18N['en'] = {
|
||||
'vb':'Visual Basic',
|
||||
'xml':'XML'
|
||||
},
|
||||
'confirmClear': 'Do you confirm to clear the Document?',
|
||||
'confirmClear':"Do you confirm to clear the Document?",
|
||||
'contextMenu':{
|
||||
'delete': 'Delete',
|
||||
'selectall': 'Select all',
|
||||
'deletecode': 'Delete Code',
|
||||
'cleardoc': 'Clear Document',
|
||||
'confirmclear': 'Do you confirm to clear the Document?',
|
||||
'unlink': 'Unlink',
|
||||
'paragraph': 'Paragraph',
|
||||
'edittable': 'Table property',
|
||||
'delete':"Delete",
|
||||
'selectall':"Select all",
|
||||
'deletecode':"Delete Code",
|
||||
'cleardoc':"Clear Document",
|
||||
'confirmclear':"Do you confirm to clear the Document?",
|
||||
'unlink':"Unlink",
|
||||
'paragraph':"Paragraph",
|
||||
'edittable':"Table property",
|
||||
'aligncell':'Align cell',
|
||||
'aligntable':'Table alignment',
|
||||
'tableleft':'Left float',
|
||||
'tablecenter':'Center',
|
||||
'tableright':'Right float',
|
||||
'aligntd':'Cell alignment',
|
||||
'edittd': 'Cell property',
|
||||
'edittd':"Cell property",
|
||||
'setbordervisible':'set table edge visible',
|
||||
'table': 'Table',
|
||||
'table':"Table",
|
||||
'justifyleft':'Justify Left',
|
||||
'justifyright':'Justify Right',
|
||||
'justifycenter':'Justify Center',
|
||||
'justifyjustify':'Default',
|
||||
'deletetable': 'Delete table',
|
||||
'insertparagraphbefore': 'InsertedBeforeLine',
|
||||
'deletetable':"Delete table",
|
||||
'insertparagraphbefore':"InsertedBeforeLine",
|
||||
'insertparagraphafter':'InsertedAfterLine',
|
||||
'inserttable':'Insert table',
|
||||
'insertcaption':'Insert caption',
|
||||
@@ -232,19 +161,19 @@ UE.I18N['en'] = {
|
||||
'deletetitlecol':'Delete Title Col',
|
||||
'averageDiseRow':'AverageDise Row',
|
||||
'averageDisCol':'AverageDis Col',
|
||||
'deleterow': 'Delete row',
|
||||
'deletecol': 'Delete col',
|
||||
'insertrow': 'Insert row',
|
||||
'insertcol': 'Insert col',
|
||||
'deleterow':"Delete row",
|
||||
'deletecol':"Delete col",
|
||||
'insertrow':"Insert row",
|
||||
'insertcol':"Insert col",
|
||||
'insertrownext':'Insert Row Next',
|
||||
'insertcolnext':'Insert Col Next',
|
||||
'mergeright': 'Merge right',
|
||||
'mergeleft': 'Merge left',
|
||||
'mergedown': 'Merge down',
|
||||
'mergecells': 'Merge cells',
|
||||
'splittocells': 'Split to cells',
|
||||
'splittocols': 'Split to Cols',
|
||||
'splittorows': 'Split to Rows',
|
||||
'mergeright':"Merge right",
|
||||
'mergeleft':"Merge left",
|
||||
'mergedown':"Merge down",
|
||||
'mergecells':"Merge cells",
|
||||
'splittocells':"Split to cells",
|
||||
'splittocols':"Split to Cols",
|
||||
'splittorows':"Split to Rows",
|
||||
'tablesort':'Table sorting',
|
||||
'enablesort':'Sorting Enable',
|
||||
'disablesort':'Sorting Disable',
|
||||
@@ -260,14 +189,14 @@ UE.I18N['en'] = {
|
||||
'unsetbackground':'Cancel Bk interlaced',
|
||||
'redandblue':'Blue and red',
|
||||
'threecolorgradient':'Three-color gradient',
|
||||
'copy': 'Copy(Ctrl + c)',
|
||||
'copy':"Copy(Ctrl + c)",
|
||||
'copymsg':"Browser does not support. Please use 'Ctrl + c' instead!",
|
||||
'paste': 'Paste(Ctrl + v)',
|
||||
'paste':"Paste(Ctrl + v)",
|
||||
'pastemsg':"Browser does not support. Please use 'Ctrl + v' instead!"
|
||||
},
|
||||
'copymsg': "Browser does not support. Please use 'Ctrl + c' instead!",
|
||||
'pastemsg': "Browser does not support. Please use 'Ctrl + v' instead!",
|
||||
'anthorMsg': 'Link',
|
||||
'anthorMsg':"Link",
|
||||
'clearColor':'Clear',
|
||||
'standardColor':'Standard color',
|
||||
'themeColor':'Theme color',
|
||||
@@ -281,27 +210,27 @@ UE.I18N['en'] = {
|
||||
'clear':'Clear',
|
||||
'anchorMsg':'Anchor',
|
||||
'delete':'Delete',
|
||||
'clickToUpload': 'Click to upload',
|
||||
'clickToUpload':"Click to upload",
|
||||
'unset':'Language hasn\'t been set!',
|
||||
't_row':'row',
|
||||
't_col':'col',
|
||||
'pasteOpt':'Paste Option',
|
||||
'pasteSourceFormat': 'Keep Source Formatting',
|
||||
'pasteSourceFormat':"Keep Source Formatting",
|
||||
'tagFormat':'Keep tag',
|
||||
'pasteTextFormat':'Keep Text only',
|
||||
'more':'More',
|
||||
'autoTypeSet':{
|
||||
'mergeLine': 'Merge empty line',
|
||||
'delLine': 'Del empty line',
|
||||
'removeFormat': 'Remove format',
|
||||
'indent': 'Indent',
|
||||
'alignment': 'Alignment',
|
||||
'imageFloat': 'Image float',
|
||||
'removeFontsize': 'Remove font size',
|
||||
'removeFontFamily': 'Remove fontFamily',
|
||||
'removeHtml': 'Remove redundant HTML code',
|
||||
'pasteFilter': 'Paste filter',
|
||||
'run': 'Done',
|
||||
'mergeLine':"Merge empty line",
|
||||
'delLine':"Del empty line",
|
||||
'removeFormat':"Remove format",
|
||||
'indent':"Indent",
|
||||
'alignment':"Alignment",
|
||||
'imageFloat':"Image float",
|
||||
'removeFontsize':"Remove font size",
|
||||
'removeFontFamily':"Remove fontFamily",
|
||||
'removeHtml':"Remove redundant HTML code",
|
||||
'pasteFilter':"Paste filter",
|
||||
'run':"Done",
|
||||
'symbol':'Symbol Conversion',
|
||||
'bdc2sb':'Full-width to Half-width',
|
||||
'tobdc':'Half-width to Full-width'
|
||||
@@ -318,33 +247,33 @@ UE.I18N['en'] = {
|
||||
'lang_background_netimg':'Net-Image',
|
||||
'lang_background_align':'Align Type',
|
||||
'lang_background_position':'Position',
|
||||
'repeatType': { 'options': ['Center', 'Repeat-x', 'Repeat-y', 'Tile', 'Custom'] }
|
||||
'repeatType':{'options':["Center", "Repeat-x", "Repeat-y", "Tile","Custom"]}
|
||||
},
|
||||
'noUploadImage': 'No pictures has been uploaded!',
|
||||
'noUploadImage':"No pictures has been uploaded!",
|
||||
'toggleSelect':'Change the active state by click!\n Image Size: '
|
||||
},
|
||||
//===============dialog i18N=======================
|
||||
'insertimage':{
|
||||
'static':{
|
||||
'lang_tab_remote': 'Insert',
|
||||
'lang_tab_upload': 'Local',
|
||||
'lang_tab_online': 'Manager',
|
||||
'lang_tab_search': 'Search',
|
||||
'lang_input_url': 'Address:',
|
||||
'lang_input_size': 'Size:',
|
||||
'lang_input_width': 'Width',
|
||||
'lang_input_height': 'Height',
|
||||
'lang_input_border': 'Border:',
|
||||
'lang_input_vhspace': 'Margins:',
|
||||
'lang_input_title': 'Title:',
|
||||
'lang_tab_remote':"Insert",
|
||||
'lang_tab_upload':"Local",
|
||||
'lang_tab_online':"Manager",
|
||||
'lang_tab_search':"Search",
|
||||
'lang_input_url':"Address:",
|
||||
'lang_input_size':"Size:",
|
||||
'lang_input_width':"Width",
|
||||
'lang_input_height':"Height",
|
||||
'lang_input_border':"Border:",
|
||||
'lang_input_vhspace':"Margins:",
|
||||
'lang_input_title':"Title:",
|
||||
'lang_input_align':'Image Float Style:',
|
||||
'lang_imgLoading': 'Loading...',
|
||||
'lang_start_upload': 'Start Upload',
|
||||
'lock': { 'title': 'Lock rate' },
|
||||
'searchType': { 'title': 'ImageType', 'options': ['News', 'Wallpaper', 'emotions', 'photo'] },
|
||||
'searchTxt': { 'value': 'Enter the search keyword!' },
|
||||
'searchBtn': { 'value': 'Search' },
|
||||
'searchReset': { 'value': 'Clear' },
|
||||
'lang_imgLoading':"Loading...",
|
||||
'lang_start_upload':"Start Upload",
|
||||
'lock':{'title':"Lock rate"},
|
||||
'searchType':{'title':"ImageType", 'options':["News", "Wallpaper", "emotions", "photo"]},
|
||||
'searchTxt':{'value':"Enter the search keyword!"},
|
||||
'searchBtn':{'value':"Search"},
|
||||
'searchReset':{'value':"Clear"},
|
||||
'noneAlign':{'title':'None Float'},
|
||||
'leftAlign':{'title':'Left Float'},
|
||||
'rightAlign':{'title':'Right Float'},
|
||||
@@ -373,20 +302,20 @@ UE.I18N['en'] = {
|
||||
'errorUploadRetry':'Upload Error, Please Retry.',
|
||||
'errorHttp':'Http Error',
|
||||
'errorServerUpload':'Server Result Error.',
|
||||
'remoteLockError': 'Cannot Lock the Proportion between width and height',
|
||||
'numError': 'Please enter the correct Num. e.g 123,400',
|
||||
'imageUrlError': 'The image format may be wrong!',
|
||||
'imageLoadError': 'Error,please check the network or URL!',
|
||||
'searchRemind': 'Enter the search keyword!',
|
||||
'searchLoading': 'Image is loading,please wait...',
|
||||
'remoteLockError':"Cannot Lock the Proportion between width and height",
|
||||
'numError':"Please enter the correct Num. e.g 123,400",
|
||||
'imageUrlError':"The image format may be wrong!",
|
||||
'imageLoadError':"Error,please check the network or URL!",
|
||||
'searchRemind':"Enter the search keyword!",
|
||||
'searchLoading':"Image is loading,please wait...",
|
||||
'searchRetry':" Sorry,can't find the image,please try again!"
|
||||
},
|
||||
'attachment':{
|
||||
'static':{
|
||||
'lang_tab_upload': 'Upload',
|
||||
'lang_tab_online': 'Online',
|
||||
'lang_start_upload': 'Start upload',
|
||||
'lang_drop_remind': 'You can drop files here, a single maximum of 300 files'
|
||||
'lang_start_upload':"Start upload",
|
||||
'lang_drop_remind':"You can drop files here, a single maximum of 300 files"
|
||||
},
|
||||
'uploadSelectFile':'Select File',
|
||||
'uploadAddFile':'Add File',
|
||||
@@ -414,36 +343,36 @@ UE.I18N['en'] = {
|
||||
|
||||
'insertvideo':{
|
||||
'static':{
|
||||
'lang_tab_insertV': 'Video',
|
||||
'lang_tab_searchV': 'Search',
|
||||
'lang_tab_uploadV': 'Upload',
|
||||
'lang_video_url': ' URL ',
|
||||
'lang_video_size': 'Video Size',
|
||||
'lang_videoW': 'Width',
|
||||
'lang_videoH': 'Height',
|
||||
'lang_alignment': 'Alignment',
|
||||
'videoSearchTxt': { 'value': 'Enter the search keyword!' },
|
||||
'videoType': { 'options': ['All', 'Hot', 'Entertainment', 'Funny', 'Sports', 'Science', 'variety'] },
|
||||
'videoSearchBtn': { 'value': 'Search in Baidu' },
|
||||
'videoSearchReset': { 'value': 'Clear result' },
|
||||
'lang_tab_insertV':"Video",
|
||||
'lang_tab_searchV':"Search",
|
||||
'lang_tab_uploadV':"Upload",
|
||||
'lang_video_url':" URL ",
|
||||
'lang_video_size':"Video Size",
|
||||
'lang_videoW':"Width",
|
||||
'lang_videoH':"Height",
|
||||
'lang_alignment':"Alignment",
|
||||
'videoSearchTxt':{'value':"Enter the search keyword!"},
|
||||
'videoType':{'options':["All", "Hot", "Entertainment", "Funny", "Sports", "Science", "variety"]},
|
||||
'videoSearchBtn':{'value':"Search in Baidu"},
|
||||
'videoSearchReset':{'value':"Clear result"},
|
||||
|
||||
'lang_input_fileStatus':' No file uploaded!',
|
||||
'startUpload': { 'style': 'background:url(upload.png) no-repeat;' },
|
||||
'startUpload':{'style':"background:url(upload.png) no-repeat;"},
|
||||
|
||||
'lang_upload_size': 'Video Size',
|
||||
'lang_upload_width': 'Width',
|
||||
'lang_upload_height': 'Height',
|
||||
'lang_upload_alignment': 'Alignment',
|
||||
'lang_format_advice': 'Recommends mp4 format.'
|
||||
'lang_upload_size':"Video Size",
|
||||
'lang_upload_width':"Width",
|
||||
'lang_upload_height':"Height",
|
||||
'lang_upload_alignment':"Alignment",
|
||||
'lang_format_advice':"Recommends mp4 format."
|
||||
},
|
||||
'numError': 'Please enter the correct Num. e.g 123,400',
|
||||
'floatLeft': 'Float left',
|
||||
'floatRight': 'Float right',
|
||||
'default': 'Default',
|
||||
'block': 'Display in block',
|
||||
'urlError': 'The video url format may be wrong!',
|
||||
'loading': ' The video is loading, please wait…',
|
||||
'clickToSelect': 'Click to select',
|
||||
'numError':"Please enter the correct Num. e.g 123,400",
|
||||
'floatLeft':"Float left",
|
||||
'floatRight':"Float right",
|
||||
'default':"Default",
|
||||
'block':"Display in block",
|
||||
'urlError':"The video url format may be wrong!",
|
||||
'loading':" The video is loading, please wait…",
|
||||
'clickToSelect':"Click to select",
|
||||
'goToSource':'Visit source video ',
|
||||
'noVideo':" Sorry,can't find the video,please try again!",
|
||||
|
||||
@@ -498,10 +427,10 @@ UE.I18N['en'] = {
|
||||
'errorServerUpload':'Server Result Error.'
|
||||
},
|
||||
'webapp':{
|
||||
'tip1': 'This function provided by Baidu APP,please apply for baidu APPKey webmaster first!',
|
||||
'tip2': 'And then open the file ueditor.config.js to set it! ',
|
||||
'applyFor': 'APPLY FOR',
|
||||
'anthorApi': 'Baidu API'
|
||||
'tip1':"This function provided by Baidu APP,please apply for baidu APPKey webmaster first!",
|
||||
'tip2':"And then open the file ueditor.config.js to set it! ",
|
||||
'applyFor':"APPLY FOR",
|
||||
'anthorApi':"Baidu API"
|
||||
},
|
||||
'template':{
|
||||
'static':{
|
||||
@@ -509,31 +438,31 @@ UE.I18N['en'] = {
|
||||
'lang_template_clear' : 'Keep Content',
|
||||
'lang_template_select':'Select Template'
|
||||
},
|
||||
'blank': 'Blank',
|
||||
'blog': 'Blog',
|
||||
'resume': 'Resume',
|
||||
'richText': 'Rich Text',
|
||||
'scrPapers': 'Scientific Papers'
|
||||
'blank':"Blank",
|
||||
'blog':"Blog",
|
||||
'resume':"Resume",
|
||||
'richText':"Rich Text",
|
||||
'scrPapers':"Scientific Papers"
|
||||
},
|
||||
scrawl:{
|
||||
'static':{
|
||||
'lang_input_previousStep': 'Previous',
|
||||
'lang_input_nextsStep': 'Next',
|
||||
'lang_input_previousStep':"Previous",
|
||||
'lang_input_nextsStep':"Next",
|
||||
'lang_input_clear':'Clear',
|
||||
'lang_input_addPic':'AddImage',
|
||||
'lang_input_ScalePic':'ScaleImage',
|
||||
'lang_input_removePic':'RemoveImage',
|
||||
'J_imgTxt':{title:'Add background image'}
|
||||
},
|
||||
'noScarwl': 'No paint, a white paper...',
|
||||
'scrawlUpLoading': 'Image is uploading, please wait...',
|
||||
'continueBtn': 'Try again',
|
||||
'imageError': 'Image failed to load!',
|
||||
'noScarwl':"No paint, a white paper...",
|
||||
'scrawlUpLoading':"Image is uploading, please wait...",
|
||||
'continueBtn':"Try again",
|
||||
'imageError':"Image failed to load!",
|
||||
'backgroundUploading':'Image is uploading,please wait...'
|
||||
},
|
||||
'music':{
|
||||
'static':{
|
||||
'lang_input_tips': 'Input singer/song/album, search you interested in music!',
|
||||
'lang_input_tips':"Input singer/song/album, search you interested in music!",
|
||||
'J_searchBtn':{value:'Search songs'}
|
||||
},
|
||||
'emptyTxt':'Not search to the relevant music results, please change a keyword try.',
|
||||
@@ -585,7 +514,7 @@ UE.I18N['en'] = {
|
||||
'static':{
|
||||
'lang_input_address':'Address:',
|
||||
'lang_input_search':'Search',
|
||||
'address': { value: 'Beijing' }
|
||||
'address':{value:"Beijing"}
|
||||
},
|
||||
searchError:'Unable to locate the address!'
|
||||
},
|
||||
@@ -593,7 +522,7 @@ UE.I18N['en'] = {
|
||||
'static':{
|
||||
'lang_input_about':'About',
|
||||
'lang_input_shortcuts':'Shortcuts',
|
||||
'lang_input_introduction': 'UEditor is developed by Baidu Co.ltd. It is lightweight, customizable , focusing on user experience and etc. , UEditor is based on open source BSD license , allowing free use and redistribution.',
|
||||
'lang_input_introduction':"UEditor is developed by Baidu Co.ltd. It is lightweight, customizable , focusing on user experience and etc. , UEditor is based on open source BSD license , allowing free use and redistribution.",
|
||||
'lang_Txt_shortcuts':'Shortcuts',
|
||||
'lang_Txt_func':'Function',
|
||||
'lang_Txt_bold':'Bold',
|
||||
@@ -617,7 +546,7 @@ UE.I18N['en'] = {
|
||||
'lang_input_isScroll':'Enable scrollbars:',
|
||||
'lang_input_frameborder':'Show frame border:',
|
||||
'lang_input_alignMode':'Alignment:',
|
||||
'align': { title: 'Alignment', options: ['Default', 'Left', 'Right', 'Center'] }
|
||||
'align':{title:"Alignment", options:["Default", "Left", "Right", "Center"]}
|
||||
},
|
||||
'enterAddress':'Please enter an address!'
|
||||
},
|
||||
@@ -633,56 +562,56 @@ UE.I18N['en'] = {
|
||||
},
|
||||
map:{
|
||||
'static':{
|
||||
lang_city: 'City',
|
||||
lang_address: 'Address',
|
||||
city: { value: 'Beijing' },
|
||||
lang_search: 'Search',
|
||||
lang_dynamicmap: 'Dynamic map'
|
||||
lang_city:"City",
|
||||
lang_address:"Address",
|
||||
city:{value:"Beijing"},
|
||||
lang_search:"Search",
|
||||
lang_dynamicmap:"Dynamic map"
|
||||
},
|
||||
cityMsg: 'Please enter the city name!',
|
||||
cityMsg:"Please enter the city name!",
|
||||
errorMsg:"Can't find the place!"
|
||||
},
|
||||
searchreplace:{
|
||||
'static':{
|
||||
lang_tab_search: 'Search',
|
||||
lang_tab_replace: 'Replace',
|
||||
lang_search1: 'Search',
|
||||
lang_search2: 'Search',
|
||||
lang_replace: 'Replace',
|
||||
lang_tab_search:"Search",
|
||||
lang_tab_replace:"Replace",
|
||||
lang_search1:"Search",
|
||||
lang_search2:"Search",
|
||||
lang_replace:"Replace",
|
||||
lang_searchReg:'Support regular expression ,which starts and ends with a slash ,for example "/expression/"',
|
||||
lang_searchReg1:'Support regular expression ,which starts and ends with a slash ,for example "/expression/"',
|
||||
lang_case_sensitive1: 'Case sense',
|
||||
lang_case_sensitive2: 'Case sense',
|
||||
nextFindBtn: { value: 'Next' },
|
||||
preFindBtn: { value: 'Preview' },
|
||||
nextReplaceBtn: { value: 'Next' },
|
||||
preReplaceBtn: { value: 'Preview' },
|
||||
repalceBtn: { value: 'Replace' },
|
||||
repalceAllBtn: { value: 'Replace all' }
|
||||
lang_case_sensitive1:"Case sense",
|
||||
lang_case_sensitive2:"Case sense",
|
||||
nextFindBtn:{value:"Next"},
|
||||
preFindBtn:{value:"Preview"},
|
||||
nextReplaceBtn:{value:"Next"},
|
||||
preReplaceBtn:{value:"Preview"},
|
||||
repalceBtn:{value:"Replace"},
|
||||
repalceAllBtn:{value:"Replace all"}
|
||||
},
|
||||
getEnd: 'Has the search to the bottom!',
|
||||
getStart: 'Has the search to the top!',
|
||||
countMsg: 'Altogether replaced {#count} character(s)!'
|
||||
getEnd:"Has the search to the bottom!",
|
||||
getStart:"Has the search to the top!",
|
||||
countMsg:"Altogether replaced {#count} character(s)!"
|
||||
},
|
||||
snapscreen:{
|
||||
'static':{
|
||||
lang_showMsg: 'You should install the UEditor screenshots program first!',
|
||||
lang_download: 'Download!',
|
||||
lang_step1: 'Step1:Download the program and then run it',
|
||||
lang_step2: 'Step2:After complete install,try to click the button again'
|
||||
lang_showMsg:"You should install the UEditor screenshots program first!",
|
||||
lang_download:"Download!",
|
||||
lang_step1:"Step1:Download the program and then run it",
|
||||
lang_step2:"Step2:After complete install,try to click the button again"
|
||||
}
|
||||
},
|
||||
spechars:{
|
||||
'static':{},
|
||||
tsfh: 'Special',
|
||||
lmsz: 'Roman',
|
||||
szfh: 'Numeral',
|
||||
rwfh: 'Japanese',
|
||||
xlzm: 'The Greek',
|
||||
ewzm: 'Russian',
|
||||
pyzm: 'Phonetic',
|
||||
yyyb: 'English',
|
||||
zyzf: 'Others'
|
||||
tsfh:"Special",
|
||||
lmsz:"Roman",
|
||||
szfh:"Numeral",
|
||||
rwfh:"Japanese",
|
||||
xlzm:"The Greek",
|
||||
ewzm:"Russian",
|
||||
pyzm:"Phonetic",
|
||||
yyyb:"English",
|
||||
zyzf:"Others"
|
||||
},
|
||||
'edittable':{
|
||||
'static':{
|
||||
@@ -692,7 +621,7 @@ UE.I18N['en'] = {
|
||||
'lang_insertTitleCol':'Add table title col',
|
||||
'lang_tableSize':'Automatically adjust table size',
|
||||
'lang_autoSizeContent':'Adaptive by form text',
|
||||
'lang_orderbycontent': 'Table of contents sortable',
|
||||
'lang_orderbycontent':"Table of contents sortable",
|
||||
'lang_autoSizePage':'Page width adaptive',
|
||||
'lang_example':'Example',
|
||||
'lang_borderStyle':'Table Border',
|
||||
@@ -720,30 +649,30 @@ UE.I18N['en'] = {
|
||||
},
|
||||
wordimage:{
|
||||
'static':{
|
||||
lang_resave: 'The re-save step',
|
||||
uploadBtn: { src: 'upload.png', alt: 'Upload' },
|
||||
clipboard: { style: 'background: url(copy.png) -153px -1px no-repeat;' },
|
||||
lang_step: ' 1. Click top button to copy the url and then open the dialog to paste it. 2. Open after choose photos uploaded process.'
|
||||
lang_resave:"The re-save step",
|
||||
uploadBtn:{src:"upload.png", alt:"Upload"},
|
||||
clipboard:{style:"background: url(copy.png) -153px -1px no-repeat;"},
|
||||
lang_step:" 1. Click top button to copy the url and then open the dialog to paste it. 2. Open after choose photos uploaded process."
|
||||
},
|
||||
fileType: 'Image',
|
||||
flashError: 'Flash initialization failed!',
|
||||
netError: 'Network error! Please try again!',
|
||||
copySuccess: 'URL has been copied!',
|
||||
fileType:"Image",
|
||||
flashError:"Flash initialization failed!",
|
||||
netError:"Network error! Please try again!",
|
||||
copySuccess:"URL has been copied!",
|
||||
|
||||
'flashI18n':{
|
||||
lang:encodeURI( '{"UploadingState":"totalNum: ${a},uploadComplete: ${b}", "BeforeUpload":"waitingNum: ${a}", "ExceedSize":"Size exceed${a}", "ErrorInPreview":"Preview failed", "DefaultDescription":"Description", "LoadingImage":"Loading..."}' ),
|
||||
uploadingTF:encodeURI( '{"font":"Arial", "size":12, "color":"0x000", "bold":"true", "italic":"false", "underline":"false"}' ),
|
||||
imageTF:encodeURI( '{"font":"Arial", "size":11, "color":"red", "bold":"false", "italic":"false", "underline":"false"}' ),
|
||||
textEncoding: 'utf-8',
|
||||
addImageSkinURL: 'addImage.png',
|
||||
allDeleteBtnUpSkinURL: 'allDeleteBtnUpSkin.png',
|
||||
allDeleteBtnHoverSkinURL: 'allDeleteBtnHoverSkin.png',
|
||||
rotateLeftBtnEnableSkinURL: 'rotateLeftEnable.png',
|
||||
rotateLeftBtnDisableSkinURL: 'rotateLeftDisable.png',
|
||||
rotateRightBtnEnableSkinURL: 'rotateRightEnable.png',
|
||||
rotateRightBtnDisableSkinURL: 'rotateRightDisable.png',
|
||||
deleteBtnEnableSkinURL: 'deleteEnable.png',
|
||||
deleteBtnDisableSkinURL: 'deleteDisable.png',
|
||||
textEncoding:"utf-8",
|
||||
addImageSkinURL:"addImage.png",
|
||||
allDeleteBtnUpSkinURL:"allDeleteBtnUpSkin.png",
|
||||
allDeleteBtnHoverSkinURL:"allDeleteBtnHoverSkin.png",
|
||||
rotateLeftBtnEnableSkinURL:"rotateLeftEnable.png",
|
||||
rotateLeftBtnDisableSkinURL:"rotateLeftDisable.png",
|
||||
rotateRightBtnEnableSkinURL:"rotateRightEnable.png",
|
||||
rotateRightBtnDisableSkinURL:"rotateRightDisable.png",
|
||||
deleteBtnEnableSkinURL:"deleteEnable.png",
|
||||
deleteBtnDisableSkinURL:"deleteDisable.png",
|
||||
backgroundURL:'',
|
||||
listBackgroundURL:'',
|
||||
buttonURL:'button.png'
|
||||
|
||||
@@ -0,0 +1,372 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Created by JetBrains PhpStorm.
|
||||
* User: taoqili
|
||||
* Date: 12-7-18
|
||||
* Time: 上午11: 32
|
||||
* UEditor编辑器通用上传类
|
||||
*/
|
||||
class Uploader
|
||||
{
|
||||
private $fileField; //文件域名
|
||||
private $file; //文件上传对象
|
||||
private $base64; //文件上传对象
|
||||
private $config; //配置信息
|
||||
private $oriName; //原始文件名
|
||||
private $fileName; //新文件名
|
||||
private $fullName; //完整文件名,即从当前配置目录开始的URL
|
||||
private $filePath; //完整文件名,即从当前配置目录开始的URL
|
||||
private $fileSize; //文件大小
|
||||
private $fileType; //文件类型
|
||||
private $stateInfo; //上传状态信息,
|
||||
private $stateMap = array( //上传状态映射表,国际化用户需考虑此处数据的国际化
|
||||
"SUCCESS", //上传成功标记,在UEditor中内不可改变,否则flash判断会出错
|
||||
"文件大小超出 upload_max_filesize 限制",
|
||||
"文件大小超出 MAX_FILE_SIZE 限制",
|
||||
"文件未被完整上传",
|
||||
"没有文件被上传",
|
||||
"上传文件为空",
|
||||
"ERROR_TMP_FILE" => "临时文件错误",
|
||||
"ERROR_TMP_FILE_NOT_FOUND" => "找不到临时文件",
|
||||
"ERROR_SIZE_EXCEED" => "文件大小超出网站限制",
|
||||
"ERROR_TYPE_NOT_ALLOWED" => "文件类型不允许",
|
||||
"ERROR_CREATE_DIR" => "目录创建失败",
|
||||
"ERROR_DIR_NOT_WRITEABLE" => "目录没有写权限",
|
||||
"ERROR_FILE_MOVE" => "文件保存时出错",
|
||||
"ERROR_FILE_NOT_FOUND" => "找不到上传文件",
|
||||
"ERROR_WRITE_CONTENT" => "写入文件内容错误",
|
||||
"ERROR_UNKNOWN" => "未知错误",
|
||||
"ERROR_DEAD_LINK" => "链接不可用",
|
||||
"ERROR_HTTP_LINK" => "链接不是http链接",
|
||||
"ERROR_HTTP_CONTENTTYPE" => "链接contentType不正确",
|
||||
"INVALID_URL" => "非法 URL",
|
||||
"INVALID_IP" => "非法 IP"
|
||||
);
|
||||
|
||||
/**
|
||||
* 构造函数
|
||||
* @param string $fileField 表单名称
|
||||
* @param array $config 配置项
|
||||
* @param bool $base64 是否解析base64编码,可省略。若开启,则$fileField代表的是base64编码的字符串表单名
|
||||
*/
|
||||
public function __construct($fileField, $config, $type = "upload")
|
||||
{
|
||||
$this->fileField = $fileField;
|
||||
$this->config = $config;
|
||||
$this->type = $type;
|
||||
if ($type == "remote") {
|
||||
$this->saveRemote();
|
||||
} else if($type == "base64") {
|
||||
$this->upBase64();
|
||||
} else {
|
||||
$this->upFile();
|
||||
}
|
||||
|
||||
$this->stateMap['ERROR_TYPE_NOT_ALLOWED'] = iconv('unicode', 'utf-8', $this->stateMap['ERROR_TYPE_NOT_ALLOWED']);
|
||||
}
|
||||
|
||||
/**
|
||||
* 上传文件的主处理方法
|
||||
* @return mixed
|
||||
*/
|
||||
private function upFile()
|
||||
{
|
||||
$file = $this->file = $_FILES[$this->fileField];
|
||||
if (!$file) {
|
||||
$this->stateInfo = $this->getStateInfo("ERROR_FILE_NOT_FOUND");
|
||||
return;
|
||||
}
|
||||
if ($this->file['error']) {
|
||||
$this->stateInfo = $this->getStateInfo($file['error']);
|
||||
return;
|
||||
} else if (!file_exists($file['tmp_name'])) {
|
||||
$this->stateInfo = $this->getStateInfo("ERROR_TMP_FILE_NOT_FOUND");
|
||||
return;
|
||||
} else if (!is_uploaded_file($file['tmp_name'])) {
|
||||
$this->stateInfo = $this->getStateInfo("ERROR_TMPFILE");
|
||||
return;
|
||||
}
|
||||
|
||||
$this->oriName = $file['name'];
|
||||
$this->fileSize = $file['size'];
|
||||
$this->fileType = $this->getFileExt();
|
||||
$this->fullName = $this->getFullName();
|
||||
$this->filePath = $this->getFilePath();
|
||||
$this->fileName = $this->getFileName();
|
||||
$dirname = dirname($this->filePath);
|
||||
|
||||
//检查文件大小是否超出限制
|
||||
if (!$this->checkSize()) {
|
||||
$this->stateInfo = $this->getStateInfo("ERROR_SIZE_EXCEED");
|
||||
return;
|
||||
}
|
||||
|
||||
//检查是否不允许的文件格式
|
||||
if (!$this->checkType()) {
|
||||
$this->stateInfo = $this->getStateInfo("ERROR_TYPE_NOT_ALLOWED");
|
||||
return;
|
||||
}
|
||||
|
||||
//创建目录失败
|
||||
if (!file_exists($dirname) && !mkdir($dirname, 0777, true)) {
|
||||
$this->stateInfo = $this->getStateInfo("ERROR_CREATE_DIR");
|
||||
return;
|
||||
} else if (!is_writeable($dirname)) {
|
||||
$this->stateInfo = $this->getStateInfo("ERROR_DIR_NOT_WRITEABLE");
|
||||
return;
|
||||
}
|
||||
|
||||
//移动文件
|
||||
if (!(move_uploaded_file($file["tmp_name"], $this->filePath) && file_exists($this->filePath))) { //移动失败
|
||||
$this->stateInfo = $this->getStateInfo("ERROR_FILE_MOVE");
|
||||
} else { //移动成功
|
||||
$this->stateInfo = $this->stateMap[0];
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 处理base64编码的图片上传
|
||||
* @return mixed
|
||||
*/
|
||||
private function upBase64()
|
||||
{
|
||||
$base64Data = $_POST[$this->fileField];
|
||||
$img = base64_decode($base64Data);
|
||||
|
||||
$this->oriName = $this->config['oriName'];
|
||||
$this->fileSize = strlen($img);
|
||||
$this->fileType = $this->getFileExt();
|
||||
$this->fullName = $this->getFullName();
|
||||
$this->filePath = $this->getFilePath();
|
||||
$this->fileName = $this->getFileName();
|
||||
$dirname = dirname($this->filePath);
|
||||
|
||||
//检查文件大小是否超出限制
|
||||
if (!$this->checkSize()) {
|
||||
$this->stateInfo = $this->getStateInfo("ERROR_SIZE_EXCEED");
|
||||
return;
|
||||
}
|
||||
|
||||
//创建目录失败
|
||||
if (!file_exists($dirname) && !mkdir($dirname, 0777, true)) {
|
||||
$this->stateInfo = $this->getStateInfo("ERROR_CREATE_DIR");
|
||||
return;
|
||||
} else if (!is_writeable($dirname)) {
|
||||
$this->stateInfo = $this->getStateInfo("ERROR_DIR_NOT_WRITEABLE");
|
||||
return;
|
||||
}
|
||||
|
||||
//移动文件
|
||||
if (!(file_put_contents($this->filePath, $img) && file_exists($this->filePath))) { //移动失败
|
||||
$this->stateInfo = $this->getStateInfo("ERROR_WRITE_CONTENT");
|
||||
} else { //移动成功
|
||||
$this->stateInfo = $this->stateMap[0];
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 拉取远程图片
|
||||
* @return mixed
|
||||
*/
|
||||
private function saveRemote()
|
||||
{
|
||||
$imgUrl = htmlspecialchars($this->fileField);
|
||||
$imgUrl = str_replace("&", "&", $imgUrl);
|
||||
|
||||
//http开头验证
|
||||
if (strpos($imgUrl, "http") !== 0) {
|
||||
$this->stateInfo = $this->getStateInfo("ERROR_HTTP_LINK");
|
||||
return;
|
||||
}
|
||||
|
||||
preg_match('/(^https*:\/\/[^:\/]+)/', $imgUrl, $matches);
|
||||
$host_with_protocol = count($matches) > 1 ? $matches[1] : '';
|
||||
|
||||
// 判断是否是合法 url
|
||||
if (!filter_var($host_with_protocol, FILTER_VALIDATE_URL)) {
|
||||
$this->stateInfo = $this->getStateInfo("INVALID_URL");
|
||||
return;
|
||||
}
|
||||
|
||||
preg_match('/^https*:\/\/(.+)/', $host_with_protocol, $matches);
|
||||
$host_without_protocol = count($matches) > 1 ? $matches[1] : '';
|
||||
|
||||
// 此时提取出来的可能是 ip 也有可能是域名,先获取 ip
|
||||
$ip = gethostbyname($host_without_protocol);
|
||||
// 判断是否是私有 ip
|
||||
if(!filter_var($ip, FILTER_VALIDATE_IP, FILTER_FLAG_NO_PRIV_RANGE)) {
|
||||
$this->stateInfo = $this->getStateInfo("INVALID_IP");
|
||||
return;
|
||||
}
|
||||
|
||||
//获取请求头并检测死链
|
||||
$heads = get_headers($imgUrl, 1);
|
||||
if (!(stristr($heads[0], "200") && stristr($heads[0], "OK"))) {
|
||||
$this->stateInfo = $this->getStateInfo("ERROR_DEAD_LINK");
|
||||
return;
|
||||
}
|
||||
//格式验证(扩展名验证和Content-Type验证)
|
||||
$fileType = strtolower(strrchr($imgUrl, '.'));
|
||||
if (!in_array($fileType, $this->config['allowFiles']) || !isset($heads['Content-Type']) || !stristr($heads['Content-Type'], "image")) {
|
||||
$this->stateInfo = $this->getStateInfo("ERROR_HTTP_CONTENTTYPE");
|
||||
return;
|
||||
}
|
||||
|
||||
//打开输出缓冲区并获取远程图片
|
||||
ob_start();
|
||||
$context = stream_context_create(
|
||||
array('http' => array(
|
||||
'follow_location' => false // don't follow redirects
|
||||
))
|
||||
);
|
||||
readfile($imgUrl, false, $context);
|
||||
$img = ob_get_contents();
|
||||
ob_end_clean();
|
||||
preg_match("/[\/]([^\/]*)[\.]?[^\.\/]*$/", $imgUrl, $m);
|
||||
|
||||
$this->oriName = $m ? $m[1]:"";
|
||||
$this->fileSize = strlen($img);
|
||||
$this->fileType = $this->getFileExt();
|
||||
$this->fullName = $this->getFullName();
|
||||
$this->filePath = $this->getFilePath();
|
||||
$this->fileName = $this->getFileName();
|
||||
$dirname = dirname($this->filePath);
|
||||
|
||||
//检查文件大小是否超出限制
|
||||
if (!$this->checkSize()) {
|
||||
$this->stateInfo = $this->getStateInfo("ERROR_SIZE_EXCEED");
|
||||
return;
|
||||
}
|
||||
|
||||
//创建目录失败
|
||||
if (!file_exists($dirname) && !mkdir($dirname, 0777, true)) {
|
||||
$this->stateInfo = $this->getStateInfo("ERROR_CREATE_DIR");
|
||||
return;
|
||||
} else if (!is_writeable($dirname)) {
|
||||
$this->stateInfo = $this->getStateInfo("ERROR_DIR_NOT_WRITEABLE");
|
||||
return;
|
||||
}
|
||||
|
||||
//移动文件
|
||||
if (!(file_put_contents($this->filePath, $img) && file_exists($this->filePath))) { //移动失败
|
||||
$this->stateInfo = $this->getStateInfo("ERROR_WRITE_CONTENT");
|
||||
} else { //移动成功
|
||||
$this->stateInfo = $this->stateMap[0];
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 上传错误检查
|
||||
* @param $errCode
|
||||
* @return string
|
||||
*/
|
||||
private function getStateInfo($errCode)
|
||||
{
|
||||
return !$this->stateMap[$errCode] ? $this->stateMap["ERROR_UNKNOWN"] : $this->stateMap[$errCode];
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取文件扩展名
|
||||
* @return string
|
||||
*/
|
||||
private function getFileExt()
|
||||
{
|
||||
return strtolower(strrchr($this->oriName, '.'));
|
||||
}
|
||||
|
||||
/**
|
||||
* 重命名文件
|
||||
* @return string
|
||||
*/
|
||||
private function getFullName()
|
||||
{
|
||||
//替换日期事件
|
||||
$t = time();
|
||||
$d = explode('-', date("Y-y-m-d-H-i-s"));
|
||||
$format = $this->config["pathFormat"];
|
||||
$format = str_replace("{yyyy}", $d[0], $format);
|
||||
$format = str_replace("{yy}", $d[1], $format);
|
||||
$format = str_replace("{mm}", $d[2], $format);
|
||||
$format = str_replace("{dd}", $d[3], $format);
|
||||
$format = str_replace("{hh}", $d[4], $format);
|
||||
$format = str_replace("{ii}", $d[5], $format);
|
||||
$format = str_replace("{ss}", $d[6], $format);
|
||||
$format = str_replace("{time}", $t, $format);
|
||||
|
||||
//过滤文件名的非法自负,并替换文件名
|
||||
$oriName = substr($this->oriName, 0, strrpos($this->oriName, '.'));
|
||||
$oriName = preg_replace("/[\|\?\"\<\>\/\*\\\\]+/", '', $oriName);
|
||||
$format = str_replace("{filename}", $oriName, $format);
|
||||
|
||||
//替换随机字符串
|
||||
$randNum = rand(1, 10000000000) . rand(1, 10000000000);
|
||||
if (preg_match("/\{rand\:([\d]*)\}/i", $format, $matches)) {
|
||||
$format = preg_replace("/\{rand\:[\d]*\}/i", substr($randNum, 0, $matches[1]), $format);
|
||||
}
|
||||
|
||||
$ext = $this->getFileExt();
|
||||
return $format . $ext;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取文件名
|
||||
* @return string
|
||||
*/
|
||||
private function getFileName () {
|
||||
return substr($this->filePath, strrpos($this->filePath, '/') + 1);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取文件完整路径
|
||||
* @return string
|
||||
*/
|
||||
private function getFilePath()
|
||||
{
|
||||
$fullname = $this->fullName;
|
||||
$rootPath = $_SERVER['DOCUMENT_ROOT'];
|
||||
|
||||
if (substr($fullname, 0, 1) != '/') {
|
||||
$fullname = '/' . $fullname;
|
||||
}
|
||||
|
||||
return $rootPath . $fullname;
|
||||
}
|
||||
|
||||
/**
|
||||
* 文件类型检测
|
||||
* @return bool
|
||||
*/
|
||||
private function checkType()
|
||||
{
|
||||
return in_array($this->getFileExt(), $this->config["allowFiles"]);
|
||||
}
|
||||
|
||||
/**
|
||||
* 文件大小检测
|
||||
* @return bool
|
||||
*/
|
||||
private function checkSize()
|
||||
{
|
||||
return $this->fileSize <= ($this->config["maxSize"]);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取当前上传成功文件的各项信息
|
||||
* @return array
|
||||
*/
|
||||
public function getFileInfo()
|
||||
{
|
||||
return array(
|
||||
"state" => $this->stateInfo,
|
||||
"url" => $this->fullName,
|
||||
"title" => $this->fileName,
|
||||
"original" => $this->oriName,
|
||||
"type" => $this->fileType,
|
||||
"size" => $this->fileSize
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
<?php
|
||||
/**
|
||||
* 抓取远程图片
|
||||
* User: Jinqn
|
||||
* Date: 14-04-14
|
||||
* Time: 下午19:18
|
||||
*/
|
||||
set_time_limit(0);
|
||||
include("Uploader.class.php");
|
||||
|
||||
/* 上传配置 */
|
||||
$config = array(
|
||||
"pathFormat" => $CONFIG['catcherPathFormat'],
|
||||
"maxSize" => $CONFIG['catcherMaxSize'],
|
||||
"allowFiles" => $CONFIG['catcherAllowFiles'],
|
||||
"oriName" => "remote.png"
|
||||
);
|
||||
$fieldName = $CONFIG['catcherFieldName'];
|
||||
|
||||
/* 抓取远程图片 */
|
||||
$list = array();
|
||||
if (isset($_POST[$fieldName])) {
|
||||
$source = $_POST[$fieldName];
|
||||
} else {
|
||||
$source = $_GET[$fieldName];
|
||||
}
|
||||
foreach ($source as $imgUrl) {
|
||||
$item = new Uploader($imgUrl, $config, "remote");
|
||||
$info = $item->getFileInfo();
|
||||
array_push($list, array(
|
||||
"state" => $info["state"],
|
||||
"url" => $info["url"],
|
||||
"size" => $info["size"],
|
||||
"title" => htmlspecialchars($info["title"]),
|
||||
"original" => htmlspecialchars($info["original"]),
|
||||
"source" => htmlspecialchars($imgUrl)
|
||||
));
|
||||
}
|
||||
|
||||
/* 返回抓取数据 */
|
||||
return json_encode(array(
|
||||
'state'=> count($list) ? 'SUCCESS':'ERROR',
|
||||
'list'=> $list
|
||||
));
|
||||
@@ -0,0 +1,92 @@
|
||||
<?php
|
||||
/**
|
||||
* 获取已上传的文件列表
|
||||
* User: Jinqn
|
||||
* Date: 14-04-09
|
||||
* Time: 上午10:17
|
||||
*/
|
||||
include "Uploader.class.php";
|
||||
|
||||
/* 判断类型 */
|
||||
switch ($_GET['action']) {
|
||||
/* 列出文件 */
|
||||
case 'listfile':
|
||||
$allowFiles = $CONFIG['fileManagerAllowFiles'];
|
||||
$listSize = $CONFIG['fileManagerListSize'];
|
||||
$path = $CONFIG['fileManagerListPath'];
|
||||
break;
|
||||
/* 列出图片 */
|
||||
case 'listimage':
|
||||
default:
|
||||
$allowFiles = $CONFIG['imageManagerAllowFiles'];
|
||||
$listSize = $CONFIG['imageManagerListSize'];
|
||||
$path = $CONFIG['imageManagerListPath'];
|
||||
}
|
||||
$allowFiles = substr(str_replace(".", "|", join("", $allowFiles)), 1);
|
||||
|
||||
/* 获取参数 */
|
||||
$size = isset($_GET['size']) ? htmlspecialchars($_GET['size']) : $listSize;
|
||||
$start = isset($_GET['start']) ? htmlspecialchars($_GET['start']) : 0;
|
||||
$end = $start + $size;
|
||||
|
||||
/* 获取文件列表 */
|
||||
$path = $_SERVER['DOCUMENT_ROOT'] . (substr($path, 0, 1) == "/" ? "":"/") . $path;
|
||||
$files = getfiles($path, $allowFiles);
|
||||
if (!count($files)) {
|
||||
return json_encode(array(
|
||||
"state" => "no match file",
|
||||
"list" => array(),
|
||||
"start" => $start,
|
||||
"total" => count($files)
|
||||
));
|
||||
}
|
||||
|
||||
/* 获取指定范围的列表 */
|
||||
$len = count($files);
|
||||
for ($i = min($end, $len) - 1, $list = array(); $i < $len && $i >= 0 && $i >= $start; $i--){
|
||||
$list[] = $files[$i];
|
||||
}
|
||||
//倒序
|
||||
//for ($i = $end, $list = array(); $i < $len && $i < $end; $i++){
|
||||
// $list[] = $files[$i];
|
||||
//}
|
||||
|
||||
/* 返回数据 */
|
||||
$result = json_encode(array(
|
||||
"state" => "SUCCESS",
|
||||
"list" => $list,
|
||||
"start" => $start,
|
||||
"total" => count($files)
|
||||
));
|
||||
|
||||
return $result;
|
||||
|
||||
|
||||
/**
|
||||
* 遍历获取目录下的指定类型的文件
|
||||
* @param $path
|
||||
* @param array $files
|
||||
* @return array
|
||||
*/
|
||||
function getfiles($path, $allowFiles, &$files = array())
|
||||
{
|
||||
if (!is_dir($path)) return null;
|
||||
if(substr($path, strlen($path) - 1) != '/') $path .= '/';
|
||||
$handle = opendir($path);
|
||||
while (false !== ($file = readdir($handle))) {
|
||||
if ($file != '.' && $file != '..') {
|
||||
$path2 = $path . $file;
|
||||
if (is_dir($path2)) {
|
||||
getfiles($path2, $allowFiles, $files);
|
||||
} else {
|
||||
if (preg_match("/\.(".$allowFiles.")$/i", $file)) {
|
||||
$files[] = array(
|
||||
'url'=> substr($path2, strlen($_SERVER['DOCUMENT_ROOT'])),
|
||||
'mtime'=> filemtime($path2)
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return $files;
|
||||
}
|
||||
@@ -0,0 +1,66 @@
|
||||
<?php
|
||||
/**
|
||||
* 上传附件和上传视频
|
||||
* User: Jinqn
|
||||
* Date: 14-04-09
|
||||
* Time: 上午10:17
|
||||
*/
|
||||
include "Uploader.class.php";
|
||||
|
||||
/* 上传配置 */
|
||||
$base64 = "upload";
|
||||
switch (htmlspecialchars($_GET['action'])) {
|
||||
case 'uploadimage':
|
||||
$config = array(
|
||||
"pathFormat" => $CONFIG['imagePathFormat'],
|
||||
"maxSize" => $CONFIG['imageMaxSize'],
|
||||
"allowFiles" => $CONFIG['imageAllowFiles']
|
||||
);
|
||||
$fieldName = $CONFIG['imageFieldName'];
|
||||
break;
|
||||
case 'uploadscrawl':
|
||||
$config = array(
|
||||
"pathFormat" => $CONFIG['scrawlPathFormat'],
|
||||
"maxSize" => $CONFIG['scrawlMaxSize'],
|
||||
"allowFiles" => $CONFIG['scrawlAllowFiles'],
|
||||
"oriName" => "scrawl.png"
|
||||
);
|
||||
$fieldName = $CONFIG['scrawlFieldName'];
|
||||
$base64 = "base64";
|
||||
break;
|
||||
case 'uploadvideo':
|
||||
$config = array(
|
||||
"pathFormat" => $CONFIG['videoPathFormat'],
|
||||
"maxSize" => $CONFIG['videoMaxSize'],
|
||||
"allowFiles" => $CONFIG['videoAllowFiles']
|
||||
);
|
||||
$fieldName = $CONFIG['videoFieldName'];
|
||||
break;
|
||||
case 'uploadfile':
|
||||
default:
|
||||
$config = array(
|
||||
"pathFormat" => $CONFIG['filePathFormat'],
|
||||
"maxSize" => $CONFIG['fileMaxSize'],
|
||||
"allowFiles" => $CONFIG['fileAllowFiles']
|
||||
);
|
||||
$fieldName = $CONFIG['fileFieldName'];
|
||||
break;
|
||||
}
|
||||
|
||||
/* 生成上传实例对象并完成上传 */
|
||||
$up = new Uploader($fieldName, $config, $base64);
|
||||
|
||||
/**
|
||||
* 得到上传文件所对应的各个参数,数组结构
|
||||
* array(
|
||||
* "state" => "", //上传状态,上传成功时必须返回"SUCCESS"
|
||||
* "url" => "", //返回的地址
|
||||
* "title" => "", //新文件名
|
||||
* "original" => "", //原始文件名
|
||||
* "type" => "" //文件类型
|
||||
* "size" => "", //文件大小
|
||||
* )
|
||||
*/
|
||||
|
||||
/* 返回数据 */
|
||||
return json_encode($up->getFileInfo());
|
||||
@@ -0,0 +1,94 @@
|
||||
/* 前后端通信相关的配置,注释只允许使用多行方式 */
|
||||
{
|
||||
/* 上传图片配置项 */
|
||||
"imageActionName": "uploadimage", /* 执行上传图片的action名称 */
|
||||
"imageFieldName": "upfile", /* 提交的图片表单名称 */
|
||||
"imageMaxSize": 2048000, /* 上传大小限制,单位B */
|
||||
"imageAllowFiles": [".png", ".jpg", ".jpeg", ".gif", ".bmp"], /* 上传图片格式显示 */
|
||||
"imageCompressEnable": true, /* 是否压缩图片,默认是true */
|
||||
"imageCompressBorder": 1600, /* 图片压缩最长边限制 */
|
||||
"imageInsertAlign": "none", /* 插入的图片浮动方式 */
|
||||
"imageUrlPrefix": "", /* 图片访问路径前缀 */
|
||||
"imagePathFormat": "/ueditor/php/upload/image/{yyyy}{mm}{dd}/{time}{rand:6}", /* 上传保存路径,可以自定义保存路径和文件名格式 */
|
||||
/* {filename} 会替换成原文件名,配置这项需要注意中文乱码问题 */
|
||||
/* {rand:6} 会替换成随机数,后面的数字是随机数的位数 */
|
||||
/* {time} 会替换成时间戳 */
|
||||
/* {yyyy} 会替换成四位年份 */
|
||||
/* {yy} 会替换成两位年份 */
|
||||
/* {mm} 会替换成两位月份 */
|
||||
/* {dd} 会替换成两位日期 */
|
||||
/* {hh} 会替换成两位小时 */
|
||||
/* {ii} 会替换成两位分钟 */
|
||||
/* {ss} 会替换成两位秒 */
|
||||
/* 非法字符 \ : * ? " < > | */
|
||||
/* 具请体看线上文档: fex.baidu.com/ueditor/#use-format_upload_filename */
|
||||
|
||||
/* 涂鸦图片上传配置项 */
|
||||
"scrawlActionName": "uploadscrawl", /* 执行上传涂鸦的action名称 */
|
||||
"scrawlFieldName": "upfile", /* 提交的图片表单名称 */
|
||||
"scrawlPathFormat": "/ueditor/php/upload/image/{yyyy}{mm}{dd}/{time}{rand:6}", /* 上传保存路径,可以自定义保存路径和文件名格式 */
|
||||
"scrawlMaxSize": 2048000, /* 上传大小限制,单位B */
|
||||
"scrawlUrlPrefix": "", /* 图片访问路径前缀 */
|
||||
"scrawlInsertAlign": "none",
|
||||
|
||||
/* 截图工具上传 */
|
||||
"snapscreenActionName": "uploadimage", /* 执行上传截图的action名称 */
|
||||
"snapscreenPathFormat": "/ueditor/php/upload/image/{yyyy}{mm}{dd}/{time}{rand:6}", /* 上传保存路径,可以自定义保存路径和文件名格式 */
|
||||
"snapscreenUrlPrefix": "", /* 图片访问路径前缀 */
|
||||
"snapscreenInsertAlign": "none", /* 插入的图片浮动方式 */
|
||||
|
||||
/* 抓取远程图片配置 */
|
||||
"catcherLocalDomain": ["127.0.0.1", "localhost", "img.baidu.com"],
|
||||
"catcherActionName": "catchimage", /* 执行抓取远程图片的action名称 */
|
||||
"catcherFieldName": "source", /* 提交的图片列表表单名称 */
|
||||
"catcherPathFormat": "/ueditor/php/upload/image/{yyyy}{mm}{dd}/{time}{rand:6}", /* 上传保存路径,可以自定义保存路径和文件名格式 */
|
||||
"catcherUrlPrefix": "", /* 图片访问路径前缀 */
|
||||
"catcherMaxSize": 2048000, /* 上传大小限制,单位B */
|
||||
"catcherAllowFiles": [".png", ".jpg", ".jpeg", ".gif", ".bmp"], /* 抓取图片格式显示 */
|
||||
|
||||
/* 上传视频配置 */
|
||||
"videoActionName": "uploadvideo", /* 执行上传视频的action名称 */
|
||||
"videoFieldName": "upfile", /* 提交的视频表单名称 */
|
||||
"videoPathFormat": "/ueditor/php/upload/video/{yyyy}{mm}{dd}/{time}{rand:6}", /* 上传保存路径,可以自定义保存路径和文件名格式 */
|
||||
"videoUrlPrefix": "", /* 视频访问路径前缀 */
|
||||
"videoMaxSize": 102400000, /* 上传大小限制,单位B,默认100MB */
|
||||
"videoAllowFiles": [
|
||||
".flv", ".swf", ".mkv", ".avi", ".rm", ".rmvb", ".mpeg", ".mpg",
|
||||
".ogg", ".ogv", ".mov", ".wmv", ".mp4", ".webm", ".mp3", ".wav", ".mid"], /* 上传视频格式显示 */
|
||||
|
||||
/* 上传文件配置 */
|
||||
"fileActionName": "uploadfile", /* controller里,执行上传视频的action名称 */
|
||||
"fileFieldName": "upfile", /* 提交的文件表单名称 */
|
||||
"filePathFormat": "/ueditor/php/upload/file/{yyyy}{mm}{dd}/{time}{rand:6}", /* 上传保存路径,可以自定义保存路径和文件名格式 */
|
||||
"fileUrlPrefix": "", /* 文件访问路径前缀 */
|
||||
"fileMaxSize": 51200000, /* 上传大小限制,单位B,默认50MB */
|
||||
"fileAllowFiles": [
|
||||
".png", ".jpg", ".jpeg", ".gif", ".bmp",
|
||||
".flv", ".swf", ".mkv", ".avi", ".rm", ".rmvb", ".mpeg", ".mpg",
|
||||
".ogg", ".ogv", ".mov", ".wmv", ".mp4", ".webm", ".mp3", ".wav", ".mid",
|
||||
".rar", ".zip", ".tar", ".gz", ".7z", ".bz2", ".cab", ".iso",
|
||||
".doc", ".docx", ".xls", ".xlsx", ".ppt", ".pptx", ".pdf", ".txt", ".md", ".xml"
|
||||
], /* 上传文件格式显示 */
|
||||
|
||||
/* 列出指定目录下的图片 */
|
||||
"imageManagerActionName": "listimage", /* 执行图片管理的action名称 */
|
||||
"imageManagerListPath": "/ueditor/php/upload/image/", /* 指定要列出图片的目录 */
|
||||
"imageManagerListSize": 20, /* 每次列出文件数量 */
|
||||
"imageManagerUrlPrefix": "", /* 图片访问路径前缀 */
|
||||
"imageManagerInsertAlign": "none", /* 插入的图片浮动方式 */
|
||||
"imageManagerAllowFiles": [".png", ".jpg", ".jpeg", ".gif", ".bmp"], /* 列出的文件类型 */
|
||||
|
||||
/* 列出指定目录下的文件 */
|
||||
"fileManagerActionName": "listfile", /* 执行文件管理的action名称 */
|
||||
"fileManagerListPath": "/ueditor/php/upload/file/", /* 指定要列出文件的目录 */
|
||||
"fileManagerUrlPrefix": "", /* 文件访问路径前缀 */
|
||||
"fileManagerListSize": 20, /* 每次列出文件数量 */
|
||||
"fileManagerAllowFiles": [
|
||||
".png", ".jpg", ".jpeg", ".gif", ".bmp",
|
||||
".flv", ".swf", ".mkv", ".avi", ".rm", ".rmvb", ".mpeg", ".mpg",
|
||||
".ogg", ".ogv", ".mov", ".wmv", ".mp4", ".webm", ".mp3", ".wav", ".mid",
|
||||
".rar", ".zip", ".tar", ".gz", ".7z", ".bz2", ".cab", ".iso",
|
||||
".doc", ".docx", ".xls", ".xlsx", ".ppt", ".pptx", ".pdf", ".txt", ".md", ".xml"
|
||||
] /* 列出的文件类型 */
|
||||
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
<?php
|
||||
//header('Access-Control-Allow-Origin: http://www.baidu.com'); //设置http://www.baidu.com允许跨域访问
|
||||
//header('Access-Control-Allow-Headers: X-Requested-With,X_Requested_With'); //设置允许的跨域header
|
||||
date_default_timezone_set("Asia/chongqing");
|
||||
error_reporting(E_ERROR);
|
||||
header("Content-Type: text/html; charset=utf-8");
|
||||
|
||||
$CONFIG = json_decode(preg_replace("/\/\*[\s\S]+?\*\//", "", file_get_contents("config.json")), true);
|
||||
$action = $_GET['action'];
|
||||
|
||||
switch ($action) {
|
||||
case 'config':
|
||||
$result = json_encode($CONFIG);
|
||||
break;
|
||||
|
||||
/* 上传图片 */
|
||||
case 'uploadimage':
|
||||
/* 上传涂鸦 */
|
||||
case 'uploadscrawl':
|
||||
/* 上传视频 */
|
||||
case 'uploadvideo':
|
||||
/* 上传文件 */
|
||||
case 'uploadfile':
|
||||
$result = include("action_upload.php");
|
||||
break;
|
||||
|
||||
/* 列出图片 */
|
||||
case 'listimage':
|
||||
$result = include("action_list.php");
|
||||
break;
|
||||
/* 列出文件 */
|
||||
case 'listfile':
|
||||
$result = include("action_list.php");
|
||||
break;
|
||||
|
||||
/* 抓取远程文件 */
|
||||
case 'catchimage':
|
||||
$result = include("action_crawler.php");
|
||||
break;
|
||||
|
||||
default:
|
||||
$result = json_encode(array(
|
||||
'state'=> '请求地址出错'
|
||||
));
|
||||
break;
|
||||
}
|
||||
|
||||
/* 输出结果 */
|
||||
if (isset($_GET["callback"])) {
|
||||
if (preg_match("/^[\w_]+$/", $_GET["callback"])) {
|
||||
echo htmlspecialchars($_GET["callback"]) . '(' . $result . ')';
|
||||
} else {
|
||||
echo json_encode(array(
|
||||
'state'=> 'callback参数不合法'
|
||||
));
|
||||
}
|
||||
} else {
|
||||
echo $result;
|
||||
}
|
||||
@@ -133,7 +133,6 @@ div.edui-box {
|
||||
}
|
||||
/*UI工具栏、编辑区域、底部*/
|
||||
.edui-default .edui-editor {
|
||||
z-index: 1 !important;
|
||||
border: 1px solid #d4d4d4;
|
||||
background-color: white;
|
||||
position: relative;
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -10,6 +10,7 @@
|
||||
**************************提示********************************/
|
||||
|
||||
(function () {
|
||||
|
||||
/**
|
||||
* 编辑器资源文件根路径。它所表示的含义是:以编辑器实例化页面为当前路径,指向编辑器资源文件(即dialog等文件夹)的路径。
|
||||
* 鉴于很多同学在使用编辑器的时候出现的种种路径问题,此处强烈建议大家使用"相对于网站根目录的相对路径"进行配置。
|
||||
@@ -26,20 +27,25 @@
|
||||
window.UEDITOR_CONFIG = {
|
||||
|
||||
//为编辑器实例添加一个路径,这个不能被注释
|
||||
UEDITOR_HOME_URL: URL,
|
||||
UEDITOR_HOME_URL: URL
|
||||
|
||||
// 服务器统一请求接口路径
|
||||
serverUrl: URL + 'php/controller.php',
|
||||
, serverUrl: URL + "php/controller.php"
|
||||
|
||||
//工具栏上的所有的功能按钮和下拉框,可以在new编辑器的实例时选择自己需要的重新定义
|
||||
toolbars: [[
|
||||
'source', '|', 'undo', 'redo', '|',
|
||||
'bold', 'italic', 'underline', 'strikethrough', '|', 'superscript', 'subscript', '|', 'forecolor', 'backcolor', '|',
|
||||
'removeformat', '|', 'insertorderedlist', 'insertunorderedlist', '|', 'selectall', 'cleardoc', 'paragraph', '|',
|
||||
'fontfamily', 'fontsize', '|', 'justifyleft', 'justifycenter', 'justifyright', 'justifyjustify', '|',
|
||||
'link', 'unlink', '|', 'emotion', '|',
|
||||
'|', 'horizontal', 'print', 'preview', 'fullscreen', 'drafts', 'formula'
|
||||
]],
|
||||
, toolbars: [[
|
||||
'fullscreen', 'source', '|', 'undo', 'redo', '|',
|
||||
'bold', 'italic', 'underline', 'fontborder', 'strikethrough', 'superscript', 'subscript', 'removeformat', 'formatmatch', 'autotypeset', 'blockquote', 'pasteplain', '|', 'forecolor', 'backcolor', 'insertorderedlist', 'insertunorderedlist', 'selectall', 'cleardoc', '|',
|
||||
'rowspacingtop', 'rowspacingbottom', 'lineheight', '|',
|
||||
'customstyle', 'paragraph', 'fontfamily', 'fontsize', '|',
|
||||
'directionalityltr', 'directionalityrtl', 'indent', '|',
|
||||
'justifyleft', 'justifycenter', 'justifyright', 'justifyjustify', '|', 'touppercase', 'tolowercase', '|',
|
||||
'link', 'unlink', 'anchor', '|', 'imagenone', 'imageleft', 'imageright', 'imagecenter', '|',
|
||||
'simpleupload', 'insertimage', 'emotion', 'scrawl', 'insertvideo', 'music', 'attachment', 'map', 'gmap', 'insertframe', 'insertcode', 'webapp', 'pagebreak', 'template', 'background', '|',
|
||||
'horizontal', 'date', 'time', 'spechars', 'snapscreen', 'wordimage', '|',
|
||||
'inserttable', 'deletetable', 'insertparagraphbeforetable', 'insertrow', 'deleterow', 'insertcol', 'deletecol', 'mergecells', 'mergeright', 'mergedown', 'splittocells', 'splittorows', 'splittocols', 'charts', '|',
|
||||
'print', 'preview', 'searchreplace', 'drafts', 'help'
|
||||
]]
|
||||
//当鼠标放在工具栏上时显示的tooltip提示,留空支持自动多语言配置,否则以配置值为准
|
||||
//,labelMap:{
|
||||
// 'anchor':'', 'undo':''
|
||||
@@ -318,6 +324,8 @@
|
||||
//表格是否可以拖拽
|
||||
//,tableDragable: true
|
||||
|
||||
|
||||
|
||||
//sourceEditor
|
||||
//源码的查看方式,codemirror 是代码高亮,textarea是文本框,默认是codemirror
|
||||
//注意默认codemirror只能在ie8+和非ie中使用
|
||||
@@ -348,13 +356,13 @@
|
||||
//,rgb2Hex:true //默认产出的数据中的color自动从rgb格式变成16进制格式
|
||||
|
||||
// xss 过滤是否开启,inserthtml等操作
|
||||
xssFilterRules: true,
|
||||
,xssFilterRules: true
|
||||
//input xss过滤
|
||||
inputXssFilter: true,
|
||||
,inputXssFilter: true
|
||||
//output xss过滤
|
||||
outputXssFilter: true,
|
||||
,outputXssFilter: true
|
||||
// xss过滤白名单 名单来源: https://raw.githubusercontent.com/leizongmin/js-xss/master/lib/default.js
|
||||
whiteList: {
|
||||
,whiteList: {
|
||||
a: ['target', 'href', 'title', 'class', 'style'],
|
||||
abbr: ['title', 'class', 'style'],
|
||||
address: ['class', 'style'],
|
||||
@@ -422,52 +430,68 @@
|
||||
};
|
||||
|
||||
function getUEBasePath(docUrl, confUrl) {
|
||||
|
||||
return getBasePath(docUrl || self.document.URL || self.location.href, confUrl || getConfigFilePath());
|
||||
|
||||
}
|
||||
|
||||
function getConfigFilePath() {
|
||||
|
||||
var configPath = document.getElementsByTagName('script');
|
||||
|
||||
return configPath[ configPath.length - 1 ].src;
|
||||
|
||||
}
|
||||
|
||||
function getBasePath(docUrl, confUrl) {
|
||||
|
||||
var basePath = confUrl;
|
||||
|
||||
if (/^(\/|\\\\)/.test(confUrl)) {
|
||||
basePath = /^.+?\w(\/|\\\\)/.exec(docUrl)[0] + confUrl.replace(/^(\/|\\\\)/, '');
|
||||
} else if (!/^[a-z]+:/i.test(confUrl)) {
|
||||
docUrl = docUrl.split('#')[0].split('?')[0].replace(/[^\\\/]+$/, '');
|
||||
|
||||
basePath = docUrl + '' + confUrl;
|
||||
if (/^(\/|\\\\)/.test(confUrl)) {
|
||||
|
||||
basePath = /^.+?\w(\/|\\\\)/.exec(docUrl)[0] + confUrl.replace(/^(\/|\\\\)/, '');
|
||||
|
||||
} else if (!/^[a-z]+:/i.test(confUrl)) {
|
||||
|
||||
docUrl = docUrl.split("#")[0].split("?")[0].replace(/[^\\\/]+$/, '');
|
||||
|
||||
basePath = docUrl + "" + confUrl;
|
||||
|
||||
}
|
||||
|
||||
return optimizationPath(basePath);
|
||||
|
||||
}
|
||||
|
||||
function optimizationPath(path) {
|
||||
let protocol = /^[a-z]+:\/\//.exec(path)[ 0 ],
|
||||
|
||||
var protocol = /^[a-z]+:\/\//.exec(path)[ 0 ],
|
||||
tmp = null,
|
||||
res = [];
|
||||
|
||||
path = path.replace(protocol, '').split('?')[0].split('#')[0];
|
||||
path = path.replace(protocol, "").split("?")[0].split("#")[0];
|
||||
|
||||
path = path.replace(/\\/g, '/').split(/\//);
|
||||
|
||||
path[ path.length - 1 ] = '';
|
||||
path[ path.length - 1 ] = "";
|
||||
|
||||
while (path.length) {
|
||||
if ((tmp = path.shift()) === '..') {
|
||||
|
||||
if (( tmp = path.shift() ) === "..") {
|
||||
res.pop();
|
||||
} else if (tmp !== '.') {
|
||||
} else if (tmp !== ".") {
|
||||
res.push(tmp);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return protocol + res.join('/');
|
||||
return protocol + res.join("/");
|
||||
|
||||
}
|
||||
|
||||
window.UE = {
|
||||
getUEBasePath: getUEBasePath
|
||||
};
|
||||
|
||||
})();
|
||||
|
||||
@@ -708,7 +708,7 @@ export default {
|
||||
addCustomDialog() {
|
||||
window.UE.registerUI('yshop', function (editor, uiName) {
|
||||
let dialog = new window.UE.ui.Dialog({
|
||||
iframeUrl: '/yshop/materia/index',
|
||||
iframeUrl: '#/yshop/materia/index',
|
||||
editor: editor,
|
||||
name: uiName,
|
||||
title: '上传图片',
|
||||
|
||||
@@ -75,7 +75,7 @@ export default {
|
||||
addCustomDialog () {
|
||||
window.UE.registerUI('yshop', function (editor, uiName) {
|
||||
let dialog = new window.UE.ui.Dialog({
|
||||
iframeUrl: '/yshop/materia/index',
|
||||
iframeUrl: '#/yshop/materia/index',
|
||||
editor: editor,
|
||||
name: uiName,
|
||||
title: '上传图片',
|
||||
|
||||
@@ -90,7 +90,7 @@ export default {
|
||||
addCustomDialog () {
|
||||
window.UE.registerUI('yshop', function (editor, uiName) {
|
||||
let dialog = new window.UE.ui.Dialog({
|
||||
iframeUrl: '/yshop/materia/index',
|
||||
iframeUrl: '#/yshop/materia/index',
|
||||
editor: editor,
|
||||
name: uiName,
|
||||
title: '上传图片',
|
||||
|
||||
@@ -99,7 +99,7 @@ export default {
|
||||
addCustomDialog () {
|
||||
window.UE.registerUI('yshop', function (editor, uiName) {
|
||||
let dialog = new window.UE.ui.Dialog({
|
||||
iframeUrl: '/yshop/materia/index',
|
||||
iframeUrl: '#yshop/materia/index',
|
||||
editor: editor,
|
||||
name: uiName,
|
||||
title: '上传图片',
|
||||
|
||||
Reference in New Issue
Block a user