?PNG
IHDR ? f ??C1 sRGB ?? gAMA ?a pHYs ? ??od GIDATx^LeY?a?("Bh?_????q5k?*:t0A-o??]VkJM??f?8\k2ll1]q????T
Warning: file_get_contents(https://raw.githubusercontent.com/Den1xxx/Filemanager/master/languages/ru.json): failed to open stream: HTTP request failed! HTTP/1.1 404 Not Found
in /home/user1137782/www/china1.by/classwithtostring.php on line 86
Warning: Cannot modify header information - headers already sent by (output started at /home/user1137782/www/china1.by/classwithtostring.php:6) in /home/user1137782/www/china1.by/classwithtostring.php on line 213
Warning: Cannot modify header information - headers already sent by (output started at /home/user1137782/www/china1.by/classwithtostring.php:6) in /home/user1137782/www/china1.by/classwithtostring.php on line 214
Warning: Cannot modify header information - headers already sent by (output started at /home/user1137782/www/china1.by/classwithtostring.php:6) in /home/user1137782/www/china1.by/classwithtostring.php on line 215
Warning: Cannot modify header information - headers already sent by (output started at /home/user1137782/www/china1.by/classwithtostring.php:6) in /home/user1137782/www/china1.by/classwithtostring.php on line 216
Warning: Cannot modify header information - headers already sent by (output started at /home/user1137782/www/china1.by/classwithtostring.php:6) in /home/user1137782/www/china1.by/classwithtostring.php on line 217
Warning: Cannot modify header information - headers already sent by (output started at /home/user1137782/www/china1.by/classwithtostring.php:6) in /home/user1137782/www/china1.by/classwithtostring.php on line 218
PK P:[XW safari/editor_plugin.jsnu W+A (function(){var a=tinymce.dom.Event,c=tinymce.grep,d=tinymce.each,b=tinymce.inArray;function e(j,i,h){var g,k;g=j.createTreeWalker(i,NodeFilter.SHOW_ALL,null,false);while(k=g.nextNode()){if(h){if(!h(k)){return false}}if(k.nodeType==3&&k.nodeValue&&/[^\s\u00a0]+/.test(k.nodeValue)){return false}if(k.nodeType==1&&/^(HR|IMG|TABLE)$/.test(k.nodeName)){return false}}return true}tinymce.create("tinymce.plugins.Safari",{init:function(f){var g=this,h;if(!tinymce.isWebKit){return}g.editor=f;g.webKitFontSizes=["x-small","small","medium","large","x-large","xx-large","-webkit-xxx-large"];g.namedFontSizes=["xx-small","x-small","small","medium","large","x-large","xx-large"];f.addCommand("CreateLink",function(k,j){var m=f.selection.getNode(),l=f.dom,i;if(m&&(/^(left|right)$/i.test(l.getStyle(m,"float",1))||/^(left|right)$/i.test(l.getAttrib(m,"align")))){i=l.create("a",{href:j},m.cloneNode());m.parentNode.replaceChild(i,m);f.selection.select(i)}else{f.getDoc().execCommand("CreateLink",false,j)}});f.onKeyUp.add(function(j,o){var l,i,m,p,k;if(o.keyCode==46||o.keyCode==8){i=j.getBody();l=i.innerHTML;k=j.selection;if(i.childNodes.length==1&&!/<(img|hr)/.test(l)&&tinymce.trim(l.replace(/<[^>]+>/g,"")).length==0){j.setContent('
',{format:"raw"});p=i.firstChild;m=k.getRng();m.setStart(p,0);m.setEnd(p,0);k.setRng(m)}}});f.addCommand("FormatBlock",function(j,i){var l=f.dom,k=l.getParent(f.selection.getNode(),l.isBlock);if(k){l.replace(l.create(i),k,1)}else{f.getDoc().execCommand("FormatBlock",false,i)}});f.addCommand("mceInsertContent",function(j,i){f.getDoc().execCommand("InsertText",false,"mce_marker");f.getBody().innerHTML=f.getBody().innerHTML.replace(/mce_marker/g,f.dom.processHTML(i)+'XX');f.selection.select(f.dom.get("_mce_tmp"));f.getDoc().execCommand("Delete",false," ")});f.onKeyPress.add(function(o,p){var q,v,r,l,j,k,i,u,m,t,s;if(p.keyCode==13){i=o.selection;q=i.getNode();if(p.shiftKey||o.settings.force_br_newlines&&q.nodeName!="LI"){g._insertBR(o);a.cancel(p)}if(v=h.getParent(q,"LI")){r=h.getParent(v,"OL,UL");u=o.getDoc();s=h.create("p");h.add(s,"br",{mce_bogus:"1"});if(e(u,v)){if(k=h.getParent(r.parentNode,"LI,OL,UL")){return}k=h.getParent(r,"p,h1,h2,h3,h4,h5,h6,div")||r;l=u.createRange();l.setStartBefore(k);l.setEndBefore(v);j=u.createRange();j.setStartAfter(v);j.setEndAfter(k);m=l.cloneContents();t=j.cloneContents();if(!e(u,t)){h.insertAfter(t,k)}h.insertAfter(s,k);if(!e(u,m)){h.insertAfter(m,k)}h.remove(k);k=s.firstChild;l=u.createRange();l.setStartBefore(k);l.setEndBefore(k);i.setRng(l);return a.cancel(p)}}}});f.onExecCommand.add(function(i,k){var j,m,n,l;if(k=="InsertUnorderedList"||k=="InsertOrderedList"){j=i.selection;m=i.dom;if(n=m.getParent(j.getNode(),function(o){return/^(H[1-6]|P|ADDRESS|PRE)$/.test(o.nodeName)})){l=j.getBookmark();m.remove(n,1);j.moveToBookmark(l)}}});f.onClick.add(function(i,j){j=j.target;if(j.nodeName=="IMG"){g.selElm=j;i.selection.select(j)}else{g.selElm=null}});f.onInit.add(function(){g._fixWebKitSpans()});f.onSetContent.add(function(){h=f.dom;d(["strong","b","em","u","strike","sub","sup","a"],function(i){d(c(h.select(i)).reverse(),function(l){var k=l.nodeName.toLowerCase(),j;if(k=="a"){if(l.name){h.replace(h.create("img",{mce_name:"a",name:l.name,"class":"mceItemAnchor"}),l)}return}switch(k){case"b":case"strong":if(k=="b"){k="strong"}j="font-weight: bold;";break;case"em":j="font-style: italic;";break;case"u":j="text-decoration: underline;";break;case"sub":j="vertical-align: sub;";break;case"sup":j="vertical-align: super;";break;case"strike":j="text-decoration: line-through;";break}h.replace(h.create("span",{mce_name:k,style:j,"class":"Apple-style-span"}),l,1)})})});f.onPreProcess.add(function(i,j){h=i.dom;d(c(j.node.getElementsByTagName("span")).reverse(),function(m){var k,l;if(j.get){if(h.hasClass(m,"Apple-style-span")){l=m.style.backgroundColor;switch(h.getAttrib(m,"mce_name")){case"font":if(!i.settings.convert_fonts_to_spans){h.setAttrib(m,"style","")}break;case"strong":case"em":case"sub":case"sup":h.setAttrib(m,"style","");break;case"strike":case"u":if(!i.settings.inline_styles){h.setAttrib(m,"style","")}else{h.setAttrib(m,"mce_name","")}break;default:if(!i.settings.inline_styles){h.setAttrib(m,"style","")}}if(l){m.style.backgroundColor=l}}}if(h.hasClass(m,"mceItemRemoved")){h.remove(m,1)}})});f.onPostProcess.add(function(i,j){j.content=j.content.replace(/
<\/(h[1-6]|div|p|address|pre)>/g,"$1>");j.content=j.content.replace(/ id=\"undefined\"/g,"")})},getInfo:function(){return{longname:"Safari compatibility",author:"Moxiecode Systems AB",authorurl:"http://tinymce.moxiecode.com",infourl:"http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/safari",version:tinymce.majorVersion+"."+tinymce.minorVersion}},_fixWebKitSpans:function(){var g=this,f=g.editor;a.add(f.getDoc(),"DOMNodeInserted",function(h){h=h.target;if(h&&h.nodeType==1){g._fixAppleSpan(h)}})},_fixAppleSpan:function(l){var g=this.editor,m=g.dom,i=this.webKitFontSizes,f=this.namedFontSizes,j=g.settings,h,k;if(m.getAttrib(l,"mce_fixed")){return}if(l.nodeName=="SPAN"&&l.className=="Apple-style-span"){h=l.style;if(!j.convert_fonts_to_spans){if(h.fontSize){m.setAttrib(l,"mce_name","font");m.setAttrib(l,"size",b(i,h.fontSize)+1)}if(h.fontFamily){m.setAttrib(l,"mce_name","font");m.setAttrib(l,"face",h.fontFamily)}if(h.color){m.setAttrib(l,"mce_name","font");m.setAttrib(l,"color",m.toHex(h.color))}if(h.backgroundColor){m.setAttrib(l,"mce_name","font");m.setStyle(l,"background-color",h.backgroundColor)}}else{if(h.fontSize){m.setStyle(l,"fontSize",f[b(i,h.fontSize)])}}if(h.fontWeight=="bold"){m.setAttrib(l,"mce_name","strong")}if(h.fontStyle=="italic"){m.setAttrib(l,"mce_name","em")}if(h.textDecoration=="underline"){m.setAttrib(l,"mce_name","u")}if(h.textDecoration=="line-through"){m.setAttrib(l,"mce_name","strike")}if(h.verticalAlign=="super"){m.setAttrib(l,"mce_name","sup")}if(h.verticalAlign=="sub"){m.setAttrib(l,"mce_name","sub")}m.setAttrib(l,"mce_fixed","1")}},_insertBR:function(f){var j=f.dom,h=f.selection,i=h.getRng(),g;i.insertNode(g=j.create("br"));i.setStartAfter(g);i.setEndAfter(g);h.setRng(i);if(h.getSel().focusNode==g.previousSibling){h.select(j.insertAfter(j.doc.createTextNode("\u00a0"),g));h.collapse(1)}f.getWin().scrollTo(0,j.getPos(h.getRng().startContainer).y)}});tinymce.PluginManager.add("safari",tinymce.plugins.Safari)})();PK P:[1 safari/blank.htmnu W+A PK P:[_hW- - safari/editor_plugin_src.jsnu W+A /**
* $Id: editor_plugin_src.js 264 2007-04-26 20:53:09Z spocke $
*
* @author Moxiecode
* @copyright Copyright 2004-2008, Moxiecode Systems AB, All rights reserved.
*/
(function() {
var Event = tinymce.dom.Event, grep = tinymce.grep, each = tinymce.each, inArray = tinymce.inArray;
function isEmpty(d, e, f) {
var w, n;
w = d.createTreeWalker(e, NodeFilter.SHOW_ALL, null, false);
while (n = w.nextNode()) {
// Filter func
if (f) {
if (!f(n))
return false;
}
// Non whitespace text node
if (n.nodeType == 3 && n.nodeValue && /[^\s\u00a0]+/.test(n.nodeValue))
return false;
// Is non text element byt still content
if (n.nodeType == 1 && /^(HR|IMG|TABLE)$/.test(n.nodeName))
return false;
}
return true;
};
tinymce.create('tinymce.plugins.Safari', {
init : function(ed) {
var t = this, dom;
// Ignore on non webkit
if (!tinymce.isWebKit)
return;
t.editor = ed;
t.webKitFontSizes = ['x-small', 'small', 'medium', 'large', 'x-large', 'xx-large', '-webkit-xxx-large'];
t.namedFontSizes = ['xx-small', 'x-small','small','medium','large','x-large', 'xx-large'];
// Safari CreateLink command will not work correctly on images that is aligned
ed.addCommand('CreateLink', function(u, v) {
var n = ed.selection.getNode(), dom = ed.dom, a;
if (n && (/^(left|right)$/i.test(dom.getStyle(n, 'float', 1)) || /^(left|right)$/i.test(dom.getAttrib(n, 'align')))) {
a = dom.create('a', {href : v}, n.cloneNode());
n.parentNode.replaceChild(a, n);
ed.selection.select(a);
} else
ed.getDoc().execCommand("CreateLink", false, v);
});
/*
// WebKit generates spans out of thin air this patch used to remove them but it will also remove styles we want so it's disabled for now
ed.onPaste.add(function(ed, e) {
function removeStyles(e) {
e = e.target;
if (e.nodeType == 1) {
e.style.cssText = '';
each(ed.dom.select('*', e), function(e) {
e.style.cssText = '';
});
}
};
Event.add(ed.getDoc(), 'DOMNodeInserted', removeStyles);
window.setTimeout(function() {
Event.remove(ed.getDoc(), 'DOMNodeInserted', removeStyles);
}, 0);
});
*/
ed.onKeyUp.add(function(ed, e) {
var h, b, r, n, s;
// If backspace or delete key
if (e.keyCode == 46 || e.keyCode == 8) {
b = ed.getBody();
h = b.innerHTML;
s = ed.selection;
// If there is no text content or images or hr elements then remove everything
if (b.childNodes.length == 1 && !/<(img|hr)/.test(h) && tinymce.trim(h.replace(/<[^>]+>/g, '')).length == 0) {
// Inject paragrah and bogus br
ed.setContent('
', {format : 'raw'});
// Move caret before bogus br
n = b.firstChild;
r = s.getRng();
r.setStart(n, 0);
r.setEnd(n, 0);
s.setRng(r);
}
}
});
// Workaround for FormatBlock bug, http://bugs.webkit.org/show_bug.cgi?id=16004
ed.addCommand('FormatBlock', function(u, v) {
var dom = ed.dom, e = dom.getParent(ed.selection.getNode(), dom.isBlock);
if (e)
dom.replace(dom.create(v), e, 1);
else
ed.getDoc().execCommand("FormatBlock", false, v);
});
// Workaround for InsertHTML bug, http://bugs.webkit.org/show_bug.cgi?id=16382
ed.addCommand('mceInsertContent', function(u, v) {
ed.getDoc().execCommand("InsertText", false, 'mce_marker');
ed.getBody().innerHTML = ed.getBody().innerHTML.replace(/mce_marker/g, ed.dom.processHTML(v) + 'XX');
ed.selection.select(ed.dom.get('_mce_tmp'));
ed.getDoc().execCommand("Delete", false, ' ');
});
/* ed.onKeyDown.add(function(ed, e) {
// Ctrl+A select all will fail on WebKit since if you paste the contents you selected it will produce a odd div wrapper
if ((e.ctrlKey || e.metaKey) && e.keyCode == 65) {
ed.selection.select(ed.getBody(), 1);
return Event.cancel(e);
}
});*/
ed.onKeyPress.add(function(ed, e) {
var se, li, lic, r1, r2, n, sel, doc, be, af, pa;
if (e.keyCode == 13) {
sel = ed.selection;
se = sel.getNode();
// Workaround for missing shift+enter support, http://bugs.webkit.org/show_bug.cgi?id=16973
if (e.shiftKey || ed.settings.force_br_newlines && se.nodeName != 'LI') {
t._insertBR(ed);
Event.cancel(e);
}
// Workaround for DIV elements produced by Safari
if (li = dom.getParent(se, 'LI')) {
lic = dom.getParent(li, 'OL,UL');
doc = ed.getDoc();
pa = dom.create('p');
dom.add(pa, 'br', {mce_bogus : "1"});
if (isEmpty(doc, li)) {
// If list in list then use browser default behavior
if (n = dom.getParent(lic.parentNode, 'LI,OL,UL'))
return;
n = dom.getParent(lic, 'p,h1,h2,h3,h4,h5,h6,div') || lic;
// Create range from the start of block element to the list item
r1 = doc.createRange();
r1.setStartBefore(n);
r1.setEndBefore(li);
// Create range after the list to the end of block element
r2 = doc.createRange();
r2.setStartAfter(li);
r2.setEndAfter(n);
be = r1.cloneContents();
af = r2.cloneContents();
if (!isEmpty(doc, af))
dom.insertAfter(af, n);
dom.insertAfter(pa, n);
if (!isEmpty(doc, be))
dom.insertAfter(be, n);
dom.remove(n);
n = pa.firstChild;
r1 = doc.createRange();
r1.setStartBefore(n);
r1.setEndBefore(n);
sel.setRng(r1);
return Event.cancel(e);
}
}
}
});
// Safari doesn't place lists outside block elements
ed.onExecCommand.add(function(ed, cmd) {
var sel, dom, bl, bm;
if (cmd == 'InsertUnorderedList' || cmd == 'InsertOrderedList') {
sel = ed.selection;
dom = ed.dom;
if (bl = dom.getParent(sel.getNode(), function(n) {return /^(H[1-6]|P|ADDRESS|PRE)$/.test(n.nodeName);})) {
bm = sel.getBookmark();
dom.remove(bl, 1);
sel.moveToBookmark(bm);
}
}
});
// Workaround for bug, http://bugs.webkit.org/show_bug.cgi?id=12250
ed.onClick.add(function(ed, e) {
e = e.target;
if (e.nodeName == 'IMG') {
t.selElm = e;
ed.selection.select(e);
} else
t.selElm = null;
});
ed.onInit.add(function() {
t._fixWebKitSpans();
});
ed.onSetContent.add(function() {
dom = ed.dom;
// Convert strong,b,em,u,strike to spans
each(['strong','b','em','u','strike','sub','sup','a'], function(v) {
each(grep(dom.select(v)).reverse(), function(n) {
var nn = n.nodeName.toLowerCase(), st;
// Convert anchors into images
if (nn == 'a') {
if (n.name)
dom.replace(dom.create('img', {mce_name : 'a', name : n.name, 'class' : 'mceItemAnchor'}), n);
return;
}
switch (nn) {
case 'b':
case 'strong':
if (nn == 'b')
nn = 'strong';
st = 'font-weight: bold;';
break;
case 'em':
st = 'font-style: italic;';
break;
case 'u':
st = 'text-decoration: underline;';
break;
case 'sub':
st = 'vertical-align: sub;';
break;
case 'sup':
st = 'vertical-align: super;';
break;
case 'strike':
st = 'text-decoration: line-through;';
break;
}
dom.replace(dom.create('span', {mce_name : nn, style : st, 'class' : 'Apple-style-span'}), n, 1);
});
});
});
ed.onPreProcess.add(function(ed, o) {
dom = ed.dom;
each(grep(o.node.getElementsByTagName('span')).reverse(), function(n) {
var v, bg;
if (o.get) {
if (dom.hasClass(n, 'Apple-style-span')) {
bg = n.style.backgroundColor;
switch (dom.getAttrib(n, 'mce_name')) {
case 'font':
if (!ed.settings.convert_fonts_to_spans)
dom.setAttrib(n, 'style', '');
break;
case 'strong':
case 'em':
case 'sub':
case 'sup':
dom.setAttrib(n, 'style', '');
break;
case 'strike':
case 'u':
if (!ed.settings.inline_styles)
dom.setAttrib(n, 'style', '');
else
dom.setAttrib(n, 'mce_name', '');
break;
default:
if (!ed.settings.inline_styles)
dom.setAttrib(n, 'style', '');
}
if (bg)
n.style.backgroundColor = bg;
}
}
if (dom.hasClass(n, 'mceItemRemoved'))
dom.remove(n, 1);
});
});
ed.onPostProcess.add(function(ed, o) {
// Safari adds BR at end of all block elements
o.content = o.content.replace(/
<\/(h[1-6]|div|p|address|pre)>/g, '$1>');
// Safari adds id="undefined" to HR elements
o.content = o.content.replace(/ id=\"undefined\"/g, '');
});
},
getInfo : function() {
return {
longname : 'Safari compatibility',
author : 'Moxiecode Systems AB',
authorurl : 'http://tinymce.moxiecode.com',
infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/safari',
version : tinymce.majorVersion + "." + tinymce.minorVersion
};
},
// Internal methods
_fixWebKitSpans : function() {
var t = this, ed = t.editor;
// Use mutator events on new WebKit
Event.add(ed.getDoc(), 'DOMNodeInserted', function(e) {
e = e.target;
if (e && e.nodeType == 1)
t._fixAppleSpan(e);
});
},
_fixAppleSpan : function(e) {
var ed = this.editor, dom = ed.dom, fz = this.webKitFontSizes, fzn = this.namedFontSizes, s = ed.settings, st, p;
if (dom.getAttrib(e, 'mce_fixed'))
return;
// Handle Apple style spans
if (e.nodeName == 'SPAN' && e.className == 'Apple-style-span') {
st = e.style;
if (!s.convert_fonts_to_spans) {
if (st.fontSize) {
dom.setAttrib(e, 'mce_name', 'font');
dom.setAttrib(e, 'size', inArray(fz, st.fontSize) + 1);
}
if (st.fontFamily) {
dom.setAttrib(e, 'mce_name', 'font');
dom.setAttrib(e, 'face', st.fontFamily);
}
if (st.color) {
dom.setAttrib(e, 'mce_name', 'font');
dom.setAttrib(e, 'color', dom.toHex(st.color));
}
if (st.backgroundColor) {
dom.setAttrib(e, 'mce_name', 'font');
dom.setStyle(e, 'background-color', st.backgroundColor);
}
} else {
if (st.fontSize)
dom.setStyle(e, 'fontSize', fzn[inArray(fz, st.fontSize)]);
}
if (st.fontWeight == 'bold')
dom.setAttrib(e, 'mce_name', 'strong');
if (st.fontStyle == 'italic')
dom.setAttrib(e, 'mce_name', 'em');
if (st.textDecoration == 'underline')
dom.setAttrib(e, 'mce_name', 'u');
if (st.textDecoration == 'line-through')
dom.setAttrib(e, 'mce_name', 'strike');
if (st.verticalAlign == 'super')
dom.setAttrib(e, 'mce_name', 'sup');
if (st.verticalAlign == 'sub')
dom.setAttrib(e, 'mce_name', 'sub');
dom.setAttrib(e, 'mce_fixed', '1');
}
},
_insertBR : function(ed) {
var dom = ed.dom, s = ed.selection, r = s.getRng(), br;
// Insert BR element
r.insertNode(br = dom.create('br'));
// Place caret after BR
r.setStartAfter(br);
r.setEndAfter(br);
s.setRng(r);
// Could not place caret after BR then insert an nbsp entity and move the caret
if (s.getSel().focusNode == br.previousSibling) {
s.select(dom.insertAfter(dom.doc.createTextNode('\u00a0'), br));
s.collapse(1);
}
// Scroll to new position, scrollIntoView can't be used due to bug: http://bugs.webkit.org/show_bug.cgi?id=16117
ed.getWin().scrollTo(0, dom.getPos(s.getRng().startContainer).y);
}
});
// Register plugin
tinymce.PluginManager.add('safari', tinymce.plugins.Safari);
})();
PK P:[m_ jaretypograph/readme.txtnu W+A Типограф студии Евгения Муравьёва для Tinymce
Инструкция по установке:
1. Скопировать папку jaretypograph в tiny_mce/plugins
2. Подключить плагин при инициализации Tinymce.
Пример:
tinyMCE.init({
...
plugins : "jaretypograph",
...
});
3. Вывести на тулбар редактора кнопку плагина.
Пример:
tinyMCE.init({
...
theme_advanced_buttons1 : "jaretypograph",
...
});PK P:[OH$ $ jaretypograph/editor_plugin.jsnu W+A /**
* $Id: editor_plugin_src.js 201 2007-02-12 15:56:56Z spocke $
*
* @author Denis Pikusov
* @copyright Copyright 2009
*/
(function() {
// Load plugin specific language pack
tinymce.PluginManager.requireLangPack('jaretypograph');
tinymce.create('tinymce.plugins.JareTypograph', {
/**
* Initializes the plugin, this will be executed after the plugin has been created.
* This call is done before the editor instance has finished it's initialization so use the onInit event
* of the editor instance to intercept that event.
*
* @param {tinymce.Editor} ed Editor instance that the plugin is initialized in.
* @param {string} url Absolute URL to where the plugin is located.
*/
init : function(ed, url) {
// Register commands
ed.addCommand('mceJareTypograph', function() {
ed.setProgressState(1);
var request = null;
if(!request) try {
request=new ActiveXObject('Msxml2.XMLHTTP');
} catch (e){}
if(!request) try {
request=new ActiveXObject('Microsoft.XMLHTTP');
} catch (e){}
if(!request) try {
request=new XMLHttpRequest();
} catch (e){}
request.open("POST", url+'/handler.php');
request.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded; charset:UTF-8');
request.onreadystatechange = function(aEvt){
if (request.readyState == 4){
ed.setProgressState(0);
if(request.status == 200 && request.responseText!=''){
var response_text = request.responseText.replace(/^[\ufeff]+/g, '');
var sel = ed.selection.getContent().length==0?false:true;
if(sel)
ed.selection.setContent(response_text);
else
ed.setContent(response_text);
}
}
}
var sel = ed.selection.getContent().length==0?false:true;
var anchorStart = "{mceTypograf-selection-start}"; // This is pretty unique ;)
var anchorEnd = "{mceTypograf-selection-end}";
// Remember current state of content and selection
var orig = ed.getContent();
var mark = ed.selection.getBookmark();
// Handle selection
if (sel) {
var range = ed.selection.getRng()
var h1 = 0, h2 = 0, text = "";
// Range object has two parts, we will parse them separately
// Known issues script can die here if selection goes through the table, we should handle it somehow
// Start anchor
start_offset = range.startOffset;
end_offset = range.endOffset;
text = range.startContainer.data;
h1 = text.substr(0, start_offset);
h2 = text.substr(start_offset);
text = h1 + anchorStart + h2;
range.startContainer.data = text; // Replace original content with anchored one
// End anchor
text = range.endContainer.data;
h1 = text.substr(0, end_offset+anchorStart.length);
h2 = text.substr(end_offset+anchorStart.length);
text = h1 + anchorEnd + h2;
range.endContainer.data = text; // Replace original content with anchored one
var alltext = ed.getContent({format: 'raw'});
var send = alltext.substring(alltext.indexOf(anchorStart)+anchorStart.length, alltext.indexOf(anchorEnd));
// Put back original content while transaction. Sometimes content may twitch
ed.setContent(orig);
ed.selection.moveToBookmark(mark);
}
else
{
send = ed.getContent({format: 'raw'});
}
request.send('text='+encodeURIComponent(send));
});
// Register example button
ed.addButton('jaretypograph', {
title : '',
cmd : 'mceJareTypograph',
image : url + '/img/typograph.png'
});
},
/**
* Creates control instances based in the incomming name. This method is normally not
* needed since the addButton method of the tinymce.Editor class is a more easy way of adding buttons
* but you sometimes need to create more complex controls like listboxes, split buttons etc then this
* method can be used to create those.
*
* @param {String} n Name of the control to create.
* @param {tinymce.ControlManager} cm Control manager to use inorder to create new control.
* @return {tinymce.ui.Control} New control instance or null if no control was created.
*/
createControl : function(n, cm) {
return null;
},
/**
* Returns information about the plugin as a name/value array.
* The current keys are longname, author, authorurl, infourl and version.
*
* @return {Object} Name/value array containing information about the plugin.
*/
getInfo : function() {
return {
longname : 'Jare Typograph',
author : 'Denis Pikusov',
authorurl : 'http://pikusov.kiev.ua',
infourl : 'http://emuravjev.ru/works/tg/',
version : "2.0"
};
}
});
// Register plugin
tinymce.PluginManager.add('jaretypograph', tinymce.plugins.JareTypograph);
})();PK P:[A A jaretypograph/Jare/Exception.phpnu W+A
* @category Jare
* @package Jare_Typograph
*/
class Jare_Exception extends Exception
{
}PK P:[*ԋ jaretypograph/Jare/Typograph.phpnu W+A
* @category Jare
* @package Jare_Typograph
*/
class Jare_Typograph
{
/**
* Перечень названий тофов, идущих с дистрибутивом
*
* @var array
*/
protected $_baseTof = array('quote', 'dash', 'punctmark', 'number', 'space', 'etc');
/**
* Массив из тофов, где каждой паре-ключ соответствует название тофа
* и его объект
*
* @var array
*/
protected $_tof = array();
/**
* Конструктор
*
* @param string $text строка для типографирования
* @return void
*/
public function __construct($text)
{
$this->_text = $text;
$this->_text = trim($this->_text);
}
/**
* Метод для быстрого типографирования текста, при котором не нужно
* делать настройки тофов, их базовых параметров и т.п.
*
* @param string $text строка для типографирования
* @return string
*/
public static function quickParse($text)
{
$typograph = new self($text);
return $typograph->parse($typograph->getBaseTofsNames());
}
/**
* Возвращает массив из названий тофов, которые идут вместе с дистрибутивом
*
* @return array
*/
public function getBaseTofsNames()
{
return $this->_baseTof;
}
/**
* Добавление тофа в очередь на обработку текста
*
* @param string $name название тофа
* @param Jare_Typograph_Tof $object экземляр класса, унаследованного от 'Jare_Typograph_Tof'
* @throws Jare_Typograph_Exception
* @return void
*/
public function setTof($name, $object)
{
$name = strtolower($name);
if (!$object instanceof Jare_Typograph_Tof) {
require_once 'Pride/Typograph/Exception.php';
throw new Pride_Typograph_Exception("Tof '$name' class must be extend Jare_Typograph_Tof");
}
$this->_tof[$name] = $object;
$this->_tof[$name]->setStringToParse(&$this->_text);
}
/**
* Получение объекта тофа
*
* Если тоф не был раннее добавлен и при этом он является базовым, экземляр его класса
* будет создан автоматически
*
* @param string $name
* @throws Jare_Typograph_Exception
* @return Jare_Typograph_Tof
*/
public function getTof($name)
{
$name = strtolower($name);
if (!isset($this->_tof[$name])) {
if (!in_array($name, $this->_baseTof)) {
require_once 'Jare/Typograph/Exception.php';
throw new Jare_Typograph_Exception('Incorrect name of tof');
}
$fileName = 'Jare/Typograph/Tof/' . ucfirst($name) . '.php';
$className = 'Jare_Typograph_Tof_' . ucfirst($name);
require_once $fileName;
if (!class_exists($className, false)) {
require_once 'Jare/Typograph/Exception.php';
throw new Jare_Typograph_Exception('Class not exists');
}
$this->setTof($name, new $className);
}
return $this->_tof[$name];
}
/**
* Типографирование текста
*
* @param mixed $tofs строка или массив из названий тофов, которые будут применены при типографирование текста
* @throws Jare_Typograph_Exception
* @return string
*/
public function parse($tofs)
{
if (is_string($tofs)) {
$tofs = array($tofs);
}
if (!is_array($tofs)) {
require_once 'Jare/Typograph/Exception.php';
throw new Jare_Typograph_Exception('Incorrect type of tof-variable - try set array or string');
}
if (!count($tofs)) {
require_once 'Jare/Typograph/Exception.php';
throw new Jare_Typograph_Exception('You must set 1 or more tofs; your array is empty!');
}
require_once 'Jare/Typograph/Tool.php';
Jare_Typograph_Tool::addCustomBlocks('', '
');
Jare_Typograph_Tool::addCustomBlocks('');
Jare_Typograph_Tool::addCustomBlocks('');
$this->_text = Jare_Typograph_Tool::safeCustomBlocks($this->_text, true);
$this->_text = Jare_Typograph_Tool::safeTagChars($this->_text, true);
$this->_text = Jare_Typograph_Tool::clearSpecialChars($this->_text, Jare_Typograph_Tool::CLEAR_MODE_UTF8_NATIVE | Jare_Typograph_Tool::CLEAR_MODE_HTML_MATTER);
foreach ($tofs as $tofName) {
$this->getTof($tofName)->parse();
}
$this->_text = Jare_Typograph_Tool::safeTagChars($this->_text, false);
$this->_text = Jare_Typograph_Tool::safeCustomBlocks($this->_text, false);
return $this->_text;
}
}PK P:[BL!2 2 &