cke plugin 2.3.0 upgrade (CKEDITOR 4.2.3)
This commit is contained in:
parent
69fcbffc73
commit
620ddf978a
|
@ -1,3 +1,18 @@
|
|||
2.3.0:
|
||||
-----
|
||||
* Check if zip extension loaded
|
||||
* Removed most of the inline code into 2 new files, which are:
|
||||
cke_config.js - the custom config.js file, which now substitutes every config option to CKE
|
||||
cke_plugin.js - the render and add button/plugin file, which loads the custom config file and now renders all backend textareas.
|
||||
* To take care about placed javascript, smarty tags and other protected source tags (like mediainsert by imageselectorplus galleries),
|
||||
the new 'procurator' CKEDITOR Plugin (s9y-specific) was added, which acts like a hidden event plugin and takes care for the placeholder wysiwyg-mode replacements.
|
||||
* In order to be able to place prettified code snippets into entries, the
|
||||
'pbckcode' CKEDITOR Plugin was added (v 1.1.0, https://github.com/prbaron/PBCKCode).
|
||||
* Updated 'mediaembed' CKEDITOR Plugin, which removed a useless loop, issue #6
|
||||
* Fixed 'backend_plugins_update' update hook to config fallback
|
||||
* Updated CKEDITOR Library to version 4.2.3
|
||||
* Changed en/de lang notes to state the current changes
|
||||
|
||||
1.3.2:
|
||||
-----
|
||||
* Better workflow between nuggets and entry textareas
|
||||
|
@ -29,4 +44,4 @@
|
|||
1.2.0:
|
||||
-----
|
||||
* Update to CKEDITOR 4.1.2, 2013, June 10
|
||||
* Added Plugin option to set ACF off (default false)
|
||||
* Added Plugin option to set ACF off (default false)
|
|
@ -1,10 +1,10 @@
|
|||
<?php #
|
||||
|
||||
/**
|
||||
* @file UTF-8/lang_de.inc.php 1.4 2013-08-02 12:24:20 Ian
|
||||
* @version 1.4
|
||||
* @file UTF-8/lang_de.inc.php 1.4.2 2013-10-24 Ian
|
||||
* @version 1.4.2
|
||||
* @author Translator Name <yourmail@example.com>
|
||||
* DE-Revision: Revision of lang_de.inc.php
|
||||
* DE-Revision: Revision of UTF-8/lang_de.inc.php
|
||||
*/
|
||||
|
||||
@define('PLUGIN_EVENT_CKEDITOR_NAME', 'CKEditor');
|
||||
|
@ -12,47 +12,30 @@
|
|||
@define('PLUGIN_EVENT_CKEDITOR_REVISION_TITLE', '<h3>Das Plugin enthält:</h3>');
|
||||
@define('PLUGIN_EVENT_CKEDITOR_INSTALL', '<h2>Installation</h2>
|
||||
<ol style="line-height: 1.6">
|
||||
<li>Gebe den relativen HTTP Pfad des <em>"ckeditor"</em> Verzeichnisses in die Plugin Konfiguration ein.
|
||||
<div><strong>Note:</strong> bei den allermeisten Installationen, ist dieser Pfad <em>"plugins/serendipity_event_ckeditor/ckeditor/"</em></div>
|
||||
</li>
|
||||
<li>Gebe den vollen HTTP Pfad des S9y <em>"plugins"</em> Verzeichnisses (mit endendem "/" slash) in die Plugin Konfiguration ein.
|
||||
<div><strong>Note:</strong> bei den allermeisten Installationen, ist dieser Pfad <em>"' . $serendipity['serendipityHTTPPath'] . 'plugins/"</em></div>
|
||||
</li>
|
||||
<li>Um anderen Plugins Zugriff auf das Plugin oder dessen Hook zu gewähren, plaziere das (CKEditor) Plugin nahe dem Ende deiner Pluginliste.</li>
|
||||
<li>Versichere dich, dass der WYSIWYG Modus in den "Persönlichen Einstellungen" eingeschaltet ist.</li>
|
||||
</ol>
|
||||
|
||||
<h3>Manuelle Erweiterungen mit CKEDITOR Plugins</h3>
|
||||
<h3>Manuelle Erweiterungen mit anderen CKEDITOR Plugins</h3>
|
||||
<ol style="line-height: 1.6">
|
||||
<li>Definiere manuell hinzugefügte Plugins (analog zu { name: \'mediaembed\' },) in ckeditor/config.js, in die <em>CKEDITOR.config.toolbarGroups = [...]</em> Definition in der serendipity_event_ckeditor.php Datei.</li>
|
||||
<li>Außerdem füge den neuen Pluginnamen (analog zu mediaembed) zu beiden Vorkommen der <em>CKEDITOR.config.extraPlugins = \'...,...\'</em> Definitionen in der serendipity_event_ckeditor.php Datei hinzu.</li>
|
||||
<li>Definiere manuell hinzugefügte Plugins (analog zu <em>{ name: \'mediaembed\' },</em>) in der custom cke_config.js, in der <em>CKEDITOR.config.toolbarGroups = [...]</em> Definition.</li>
|
||||
<li>Außerdem füge den neuen Pluginnamen (analog zu mediaembed) der <em>var extraPluginList = \'...\'</em> Definition in der cke_plugin.js Datei hinzu.</li>
|
||||
</ol>
|
||||
|
||||
<h3>Upgrading</h3>
|
||||
<p>Dieses Plugin wird von Zeit zu Zeit selber Updates via Spartacus bereitstellen.<hr>
|
||||
Wenn jemals ein manuelles oder persönliches Update des mitgelieferten CKEditor Paketes benötigt wird (*), bitte:
|
||||
Wenn jemals ein manuelles oder persönliches Update des mitgelieferten CKEditor Paketes benötigt wird:
|
||||
<ol style="line-height: 1.6">
|
||||
<li><a href="http://ckeditor.com/download" target="_blank">Download CKEditor</a></li>
|
||||
<li>Extrahiere in: <em>' . realpath(dirname(__FILE__) . '/..') . '</em> (dies sollte das <em>"ckeditor"</em> Sub-Verzeichnis automatisch erstellen)</li>
|
||||
<li>Extrahiere nach: <em>' . realpath(dirname(__FILE__) . '/..') . '</em> (dies sollte das <em>"ckeditor"</em> Sub-Verzeichnis automatisch erstellen)</li>
|
||||
</ol>
|
||||
(*) <em><strong>Note:</strong> Dies wird die KCFinder\'s Integration überschreiben, die am unteren Ende der ckeditor/config.js Datei zu finden ist: <a style="border:0; text-decoration: none;" href="#" onClick="showConfig(\'el1\'); return false" title="auf-/einklappen"><img src="'.serendipity_getTemplateFile('img/plus.png').'" id="optionel1" alt="+/-" border="0"> auf-/einklappen</a></em>
|
||||
<div id="el1" style="margin-top: 0.5em; border: 1px solid #BBB;background-color: #EEE; padding: 0.5em">
|
||||
<pre>
|
||||
/* KCFinder integration - 2013-05-04 */
|
||||
CKEDITOR.editorConfig = function(config) {
|
||||
config.filebrowserBrowseUrl = CKEDITOR_BASEPATH + \'../kcfinder/browse.php?type=files\';
|
||||
config.filebrowserImageBrowseUrl = CKEDITOR_BASEPATH + \'../kcfinder/browse.php?type=images\';
|
||||
config.filebrowserFlashBrowseUrl = CKEDITOR_BASEPATH + \'../kcfinder/browse.php?type=flash\';
|
||||
config.filebrowserUploadUrl = CKEDITOR_BASEPATH + \'../kcfinder/upload.php?type=files\';
|
||||
config.filebrowserImageUploadUrl = CKEDITOR_BASEPATH + \'../kcfinder/upload.php?type=images\';
|
||||
config.filebrowserFlashUploadUrl = CKEDITOR_BASEPATH + \'../kcfinder/upload.php?type=flash\';
|
||||
};
|
||||
</pre>
|
||||
</div><script type="text/javascript" language="JavaScript">document.getElementById("el1").style.display = "none";</script>
|
||||
</p>');
|
||||
@define('PLUGIN_EVENT_CKEDITOR_CONFIG', '');
|
||||
@define('PLUGIN_EVENT_CKEDITOR_INSTALL_PLUGPATH', 'HTTP Pfad des S9y Plugins Verzeichnisses');
|
||||
@define('PLUGIN_EVENT_CKEDITOR_CKEACF_OPTION', 'Stelle Advanced-Content-Filter (ACF) ab');
|
||||
@define('PLUGIN_EVENT_CKEDITOR_TBLB_OPTION', 'Nutze den (default) 2-Zeiler toolbar-group Umbruch');
|
||||
@define('PLUGIN_EVENT_CKEDITOR_CKEACF_OPTION', 'Stelle Advanced-Content-Filter (ACF) ab?');
|
||||
@define('PLUGIN_EVENT_CKEDITOR_TBLB_OPTION', 'Nutze den (default) 2-Zeiler toolbar-group Umbruch?');
|
||||
|
||||
?>
|
||||
@define('PLUGIN_EVENT_CKEDITOR_CODEBUTTON_OPTION', 'Nutze "code toolbar button"?');
|
||||
@define('PLUGIN_EVENT_CKEDITOR_PRETTIFY_OPTION', 'Nutze "prettify code" im Frontend?');
|
||||
@define('PLUGIN_EVENT_CKEDITOR_PRETTIFY_OPTION_BLAHBLAH', 'Erweitert "code toolbar button" Option, um lokal geladene prettify.js und prettify.ccs Dateien (code by Google) im Frontend.');
|
||||
@define('PLUGIN_EVENT_CKEDITOR_OPTION_BLAHBLAH', 'Normalerweise: ');
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
<?php #
|
||||
|
||||
/**
|
||||
* @file UTF-8/lang_en.inc.php 1.4 2013-08-02 12:25:09 Ian
|
||||
* @version 1.4
|
||||
* @file UTF-8/lang_en.inc.php 1.4.2 2013-10-24 Ian
|
||||
* @version 1.4.2
|
||||
* @author Translator Name <yourmail@example.com>
|
||||
* EN-Revision: Revision of lang_en.inc.php
|
||||
* EN-Revision: Revision of UTF-8/lang_en.inc.php
|
||||
*/
|
||||
|
||||
@define('PLUGIN_EVENT_CKEDITOR_NAME', 'CKEditor');
|
||||
|
@ -12,20 +12,14 @@
|
|||
@define('PLUGIN_EVENT_CKEDITOR_REVISION_TITLE', '<h3>This Plugin includes:</h3>');
|
||||
@define('PLUGIN_EVENT_CKEDITOR_INSTALL', '<h2>Installation</h2>
|
||||
<ol style="line-height: 1.6">
|
||||
<li>Enter the relative HTTP path to the <em>"ckeditor"</em> directory in plugin configuration.
|
||||
<div><strong>Note:</strong> in most installations, this path is <em>"plugins/serendipity_event_ckeditor/ckeditor/"</em></div>
|
||||
</li>
|
||||
<li>Enter the full HTTP path to s9y <em>"plugins"</em> directory (with trailing slash) in plugin configuration.
|
||||
<div><strong>Note:</strong> in most installations, this path is <em>"' . $serendipity['serendipityHTTPPath'] . 'plugins/"</em></div>
|
||||
</li>
|
||||
<li>To allow other plugins to use or hook into the editor, place this (CKEditor) plugin near the end of your plugin list.</li>
|
||||
<li>Make sure to enable WYSIWYG mode in your personal preferences.</li>
|
||||
</ol>
|
||||
|
||||
<h3>Manually extending with CKEDITOR Plugins</h3>
|
||||
<ol style="line-height: 1.6">
|
||||
<li>Define manually added Plugins (analog to { name: \'mediaembed\' },) in ckeditor/config.js, to the <em>CKEDITOR.config.toolbarGroups = [...]</em> in the serendipity_event_ckeditor.php file.</li>
|
||||
<li>Add (append) the plugin name (analog to mediaembed) to both <em>CKEDITOR.config.extraPlugins = \'...,...\'</em> rules of the serendipity_event_ckeditor.php file.</li>
|
||||
<li>Define manually added Plugins (analog to <em>{ name: \'mediaembed\' },</em>) to the <em>CKEDITOR.config.toolbarGroups = [...]</em> definition, in the cke_config.js.</li>
|
||||
<li>Add (append) the plugin name (analog to mediaembed) to <em>var extraPluginList = \'...\'</em> definition, in the cke_plugin.js.</li>
|
||||
</ol>
|
||||
|
||||
<h3>Upgrading</h3>
|
||||
|
@ -35,24 +29,13 @@ If you - in follow - ever need to manually upgrade the delivered CKEditor packag
|
|||
<li><a href="http://ckeditor.com/download" target="_blank">Download CKEditor</a></li>
|
||||
<li>Extract to: <em>' . realpath(dirname(__FILE__) . '/..') . '</em> (should create <em>"ckeditor"</em> subdirectory)</li>
|
||||
</ol>
|
||||
(*) <em><strong>Note:</strong> This will disable (overwrite) the KCFinder\'s integration added to the end of ckeditor/config.js file: <a style="border:0; text-decoration: none;" href="#" onClick="showConfig(\'el1\'); return false" title="TOGGLE_OPTION"><img src="'.serendipity_getTemplateFile('img/plus.png').'" id="optionel1" alt="+/-" border="0"> TOGGLE_OPTION</a></em>
|
||||
<div id="el1" style="margin-top: 0.5em; border: 1px solid #BBB;background-color: #EEE; padding: 0.5em">
|
||||
<pre>
|
||||
/* KCFinder integration - 2013-05-04 */
|
||||
CKEDITOR.editorConfig = function(config) {
|
||||
config.filebrowserBrowseUrl = CKEDITOR_BASEPATH + \'../kcfinder/browse.php?type=files\';
|
||||
config.filebrowserImageBrowseUrl = CKEDITOR_BASEPATH + \'../kcfinder/browse.php?type=images\';
|
||||
config.filebrowserFlashBrowseUrl = CKEDITOR_BASEPATH + \'../kcfinder/browse.php?type=flash\';
|
||||
config.filebrowserUploadUrl = CKEDITOR_BASEPATH + \'../kcfinder/upload.php?type=files\';
|
||||
config.filebrowserImageUploadUrl = CKEDITOR_BASEPATH + \'../kcfinder/upload.php?type=images\';
|
||||
config.filebrowserFlashUploadUrl = CKEDITOR_BASEPATH + \'../kcfinder/upload.php?type=flash\';
|
||||
};
|
||||
</pre>
|
||||
</div><script type="text/javascript" language="JavaScript">document.getElementById("el1").style.display = "none";</script>
|
||||
</p>');
|
||||
@define('PLUGIN_EVENT_CKEDITOR_CONFIG', '');
|
||||
@define('PLUGIN_EVENT_CKEDITOR_INSTALL_PLUGPATH', 'HTTP path to s9y plugins directory');
|
||||
@define('PLUGIN_EVENT_CKEDITOR_CKEACF_OPTION', 'Disable Advanced-Content-Filter (ACF)');
|
||||
@define('PLUGIN_EVENT_CKEDITOR_TBLB_OPTION', 'Use default 2-liner toolbar-group linebreak');
|
||||
@define('PLUGIN_EVENT_CKEDITOR_CKEACF_OPTION', 'Disable Advanced-Content-Filter (ACF)?');
|
||||
@define('PLUGIN_EVENT_CKEDITOR_TBLB_OPTION', 'Use default 2-liner toolbar-group linebreak?');
|
||||
|
||||
?>
|
||||
@define('PLUGIN_EVENT_CKEDITOR_CODEBUTTON_OPTION', 'Allow code toolbar button?');
|
||||
@define('PLUGIN_EVENT_CKEDITOR_PRETTIFY_OPTION', 'Allow prettify code in frontend?');
|
||||
@define('PLUGIN_EVENT_CKEDITOR_PRETTIFY_OPTION_BLAHBLAH', 'Extends to "allowed code button" option. Adds locally loaded prettify.js and prettify.ccs (code by Google) to frontend.');
|
||||
@define('PLUGIN_EVENT_CKEDITOR_OPTION_BLAHBLAH', 'Usually: ');
|
||||
|
|
107
serendipity_event_ckeditor/cke_config.js
Normal file
107
serendipity_event_ckeditor/cke_config.js
Normal file
|
@ -0,0 +1,107 @@
|
|||
/**
|
||||
* This is the serendipity_event_ckeditor plugins CKEDITOR custom config.js file
|
||||
* Substitute every config option to CKE in here
|
||||
*/
|
||||
CKEDITOR.editorConfig = function( config ) {
|
||||
|
||||
// KCFinder integration - 2013-05-04
|
||||
config.filebrowserBrowseUrl = CKEDITOR_BASEPATH +'../kcfinder/browse.php?type=files';
|
||||
config.filebrowserImageBrowseUrl = CKEDITOR_BASEPATH +'../kcfinder/browse.php?type=images';
|
||||
config.filebrowserFlashBrowseUrl = CKEDITOR_BASEPATH +'../kcfinder/browse.php?type=flash';
|
||||
config.filebrowserUploadUrl = CKEDITOR_BASEPATH +'../kcfinder/upload.php?type=files';
|
||||
config.filebrowserImageUploadUrl = CKEDITOR_BASEPATH +'../kcfinder/upload.php?type=images';
|
||||
config.filebrowserFlashUploadUrl = CKEDITOR_BASEPATH +'../kcfinder/upload.php?type=flash';
|
||||
|
||||
// Set ACF by serendipity_event_ckeditor plugin option - default (false)
|
||||
// The automatic mode is on (false) when the CKEDITOR.config.allowedContent option is not set in your editor configuration.
|
||||
// This is the default setting which means that from now on by default all CKEditor contents will be filtered.
|
||||
// Advanced Content Filter works in two modes:
|
||||
// automatic – the filter is configured by editor features (like plugins, buttons, and commands) that are enabled with configuration options
|
||||
// such as CKEDITOR.config.plugins, CKEDITOR.config.extraPlugins, and CKEDITOR.config.toolbar,
|
||||
// custom – the filter is configured by the CKEDITOR.config.allowedContent option and only features that match this setting are activated.
|
||||
// In both modes it is possible to extend the filter configuration by using the CKEDITOR.config.extraAllowedContent setting.
|
||||
// If you want to disable Advanced Content Filter, set CKEDITOR.config.allowedContent to true. All available editor features will be activated and input data will not be filtered.
|
||||
// Allowed content rules. This setting is used when instantiating CKEDITOR.editor.filter.
|
||||
// The following values are accepted:
|
||||
// CKEDITOR.filter.allowedContentRules – defined rules will be added to the CKEDITOR.editor.filter.
|
||||
// true – will disable the filter (data will not be filtered, all features will be activated).
|
||||
// default – the filter will be configured by loaded features (toolbar items, commands, etc.).
|
||||
// In all cases filter configuration may be extended by extraAllowedContent. This option may be especially useful when you want to use the default allowedContent value along with some additional rules.
|
||||
// console.log('Double check - ACF is boolean: '+CONFIG_ACF_OFF);
|
||||
if (CONFIG_ACF_OFF === true) {
|
||||
config.allowedContent = CONFIG_ACF_OFF;
|
||||
} else { // this is ACF default
|
||||
|
||||
// List of regular expressions to be executed on ***input HTML***, indicating HTML source code that, when matched, must not be available in the WYSIWYG mode for editing.
|
||||
|
||||
// allow <script> tags
|
||||
config.protectedSource.push( /<(script)[^>]*>.*<\/script>/ig ); // set default in ckeditor.js [/<script[\s\S]*?<\/script>/gi,/<noscript[\s\S]*?<\/noscript>/gi]
|
||||
// allow imageselectorplus mediainsert tag code
|
||||
config.protectedSource.push( /<(mediainsert)[^>]*>[\s\S]*?<\/mediainsert>/img );
|
||||
// allow a Smarty like {} tag syntax.
|
||||
config.protectedSource.push( /\{.*?\}/gi ); // or as config.protectedSource = [/\{.*?\}/gi]; // { } tags.
|
||||
|
||||
// set placeholder tag cases - elements [attributes]{styles}(classes)
|
||||
config.extraAllowedContent = 'mediainsert[*]{*}(*);script[*]{*}(*);php'; // changed to ACF right order: attr style class
|
||||
|
||||
// CKEDITOR.protectedSource patterns used regex Escape sequences
|
||||
// \s any whitespace character;
|
||||
// \S any character that is not a whitespace character
|
||||
// \t tab (hex 09);
|
||||
// \r carriage return (hex 0D);
|
||||
// \n newline (hex 0A);
|
||||
// Pattern Modifiers
|
||||
// /i caseless, match both upper and lower case letters
|
||||
// /m treat as multiline
|
||||
// /g be greedy
|
||||
|
||||
} // do we need to put config.autoParagraph in here too?
|
||||
|
||||
// Prevent filler nodes in all empty blocks. - case switching source and wysiwyg mode multiple times
|
||||
//config.fillEmptyBlocks = false; // default (true) - switches <p> </p> to <p></p>
|
||||
//config.ignoreEmptyParagraph = false; // default(true) - Whether the editor must output an empty value ('') if it's contents is made by an empty paragraph only. (extends to config.fillEmptyBlocks)
|
||||
// It will still generate an empty <p></p> though.
|
||||
config.autoParagraph = false; // but this one definitely prevents adding multiple empty paragraphs when switching source mode!!!
|
||||
|
||||
//config.entities = false;
|
||||
//config.htmlEncodeOutput = false;
|
||||
|
||||
// ui configurations - just some examples
|
||||
//config.uiColor = 'transparent'; // standard, but better disable config.uiColor all
|
||||
//config.uiColor = '#CFD1CF'; // standard grey
|
||||
//config.uiColor = '#f5f5f5'; // standard light grey
|
||||
//config.uiColor = '#E6EDF3'; // extreme light blue
|
||||
//config.uiColor = '#DFE8F6'; // very light blue
|
||||
//config.uiColor = '#9AB8F3'; // light blue/violet
|
||||
//config.uiColor = '#AADC6E'; // light green
|
||||
//config.uiColor = '#FFDC6E'; // light gold
|
||||
//config.uiColor = '#FF8040'; // mango
|
||||
//config.uiColor = '#FF2400'; // scarlet red
|
||||
//config.uiColor = '#14B8C4'; // light turquoise
|
||||
config['skin'] = 'moono';
|
||||
config['height'] = 400;
|
||||
|
||||
// remove custom toolbar buttons and plugins
|
||||
//config.removePlugins = 'flash,iframe';
|
||||
config.removeButtons = 'Styles';
|
||||
|
||||
// set the serendipity_event_ckeditor custom toolbar group
|
||||
// Note: indent is disabled, mediaembed and pbckcode plugins are set here, and procurator placeholders for "protected Source" is buttonless
|
||||
config.toolbarGroups = [
|
||||
{ name: 'styles' },
|
||||
{ name: 'basicstyles', groups: [ 'basicstyles', 'cleanup' ] },
|
||||
{ name: 'paragraph', groups: [ 'list', /*'indent', */'blocks', 'align', 'bidi' ] },
|
||||
{ name: 'links' },
|
||||
{ name: 'insert' },
|
||||
CONFIG_TOOLBAR_BREAK,
|
||||
{ name: 'clipboard', groups: [ 'clipboard', 'undo' ] },
|
||||
{ name: 'document', groups: [ 'mode', 'document', 'doctools' ] },
|
||||
{ name: 'pbckcode' },
|
||||
{ name: 'editing', groups: [ 'find', 'selection', 'spellchecker' ] },
|
||||
{ name: 'others' },
|
||||
{ name: 'mediaembed' },
|
||||
{ name: 'tools' },
|
||||
{ name: 'about' }
|
||||
];
|
||||
|
||||
};
|
161
serendipity_event_ckeditor/cke_plugin.js
Normal file
161
serendipity_event_ckeditor/cke_plugin.js
Normal file
|
@ -0,0 +1,161 @@
|
|||
/*
|
||||
* Get the instance ready event and set global instance var
|
||||
* This is read by serendipity_editor.js and in case of serendipity_html_nugget_plugin by below serendipity_imageSelector_addToBody()
|
||||
*/
|
||||
CKEDITOR.on( 'instanceReady', function( event ) {
|
||||
event.editor.on( 'focus', function() {
|
||||
isinstance = this;
|
||||
});
|
||||
});
|
||||
|
||||
/*
|
||||
* Create a prototyp foreach array function
|
||||
* This is faster than using ckeditor.js internal forEach() implementation or even using plain for()
|
||||
**/
|
||||
if (!Array.prototype.forEach) {
|
||||
Array.prototype.forEach = function (fn, scope) {
|
||||
'use strict';
|
||||
var i, len;
|
||||
for (i = 0, len = this.length; i < len; ++i) {
|
||||
if (i in this) {
|
||||
fn.call(scope, this[i], i, this);
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
/*
|
||||
* ExecutionCommand string replacement function
|
||||
* Used in CKEDITOR.plugins.add(), to get ready to execute (eval) the button command passed by Serendipity plugins
|
||||
* @param string string
|
||||
* @return string string
|
||||
**/
|
||||
function ecfit(str) {
|
||||
str = str.replace('function() { ', '');
|
||||
str = str.replace(' }', '');
|
||||
str = str.replace(S9Y_BASEURL, '');
|
||||
return str;
|
||||
}
|
||||
|
||||
/*
|
||||
* This was previously a nugget only area, spawned by head! (textareas of staticpage nuggets, html nugget plugins, etc.)
|
||||
* called via Spawnnugget(), set by real plugins like staticpages and cores functions_plugins_admin.inc in case of $ev['skip_nuggets'] === false
|
||||
*
|
||||
* NOW it is used by all textareas!
|
||||
*
|
||||
* @param string $eventData['item']
|
||||
* @param string $eventData['jsname']
|
||||
* @param array/object jsEventData/json_encode($eventData['buttons'])
|
||||
**/
|
||||
function Spawnnuggets(item = null, addEP = null, jsED = null) {
|
||||
|
||||
var textarea_instance = !isNaN(item) ? 'nuggets' + item : item;
|
||||
var name_extraPlugins = (addEP !== null) ? addEP : textarea_instance;
|
||||
var jsEventData = (jsED !== null) ? jsED : window.jsEventData; // global set by 'backend_wysiwyg_finish' hook
|
||||
var extraPluginList = (CONFIG_ACF_OFF === true) ? name_extraPlugins+',mediaembed,pbckcode' : name_extraPlugins+',mediaembed,pbckcode,procurator'; // no spaces allowed!
|
||||
|
||||
if (document.getElementById(textarea_instance)) {
|
||||
CKEDITOR.replace(textarea_instance, {
|
||||
// Load our specific configuration file.
|
||||
customConfig : CKEDITOR_PLUGPATH+'serendipity_event_ckeditor/cke_config.js',
|
||||
|
||||
// or do and set
|
||||
// Reset toolbar Groups settings
|
||||
// toolbarGroups: null
|
||||
// or any other configuration option here
|
||||
// uiColor : '#AADC6E', // light green example
|
||||
// language: 'fr', // lang set example
|
||||
|
||||
// set all plugins at once - no spaces allowed!
|
||||
extraPlugins: extraPluginList,
|
||||
|
||||
// Set the startup mode view [OK]
|
||||
// startupMode: 'source',
|
||||
|
||||
// listen on load - do I need this still?
|
||||
on: {
|
||||
loaded: function( evt ) {
|
||||
var editor = evt.editor,
|
||||
rules = {
|
||||
elements: {
|
||||
mediainsert: function( element ) {
|
||||
if (CONFIG_ACF_OFF !== true) {
|
||||
// XHTML output instead of HTML - but this does not react on trailing slash eg <media "blah" />
|
||||
// editor.dataProcessor.writer.selfClosingEnd = ' />';
|
||||
|
||||
//avoid line breaks with special block elements
|
||||
var tags = ['mediainsert', 'gallery', 'media'];
|
||||
|
||||
for (var key in tags) {
|
||||
editor.dataProcessor.writer.setRules(tags[key],
|
||||
{
|
||||
// Indicates that this tag causes indentation on line breaks inside of it.
|
||||
indent : true,
|
||||
// Inserts a line break before the element opening tag.
|
||||
breakBeforeOpen : true,
|
||||
// Inserts a line break after the element opening tag.
|
||||
breakAfterOpen : false,
|
||||
// Inserts a line break before the element closing tag.
|
||||
breakBeforeClose : true,
|
||||
// Inserts a line break after the element closing tag.
|
||||
breakAfterClose : false
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
// It's good to set both filters - dataFilter is used when loading data and htmlFilter when retrieving.
|
||||
editor.dataProcessor.htmlFilter.addRules( rules );
|
||||
editor.dataProcessor.dataFilter.addRules( rules );
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
CKEDITOR.plugins.add(name_extraPlugins, {
|
||||
init: function(editor) {
|
||||
if(typeof jsEventData !== 'undefined') {
|
||||
jsEventData.forEach( function(k, i) {
|
||||
var execcom = ecfit(jsEventData[i].javascript);
|
||||
editor.addCommand( jsEventData[i].id, {
|
||||
exec: function( editor ) {
|
||||
eval(execcom); // [OK] only way this code is executable
|
||||
}
|
||||
});
|
||||
editor.ui.addButton(jsEventData[i].id, {
|
||||
label: jsEventData[i].name,
|
||||
title: jsEventData[i].name+' Plugin',
|
||||
icon: CKEDITOR_PLUGPATH+jsEventData[i].img_path,
|
||||
iconName: jsEventData[i].id+'_icon',
|
||||
command: jsEventData[i].id
|
||||
});
|
||||
});
|
||||
}
|
||||
editor.addCommand( 'openML', {
|
||||
exec : function( editor ) {
|
||||
window.open('serendipity_admin_image_selector.php', 'ImageSel', 'width=800,height=600,toolbar=no,scrollbars=1,scrollbars,resize=1,resizable=1');
|
||||
}
|
||||
});
|
||||
editor.ui.addButton('openML', {
|
||||
label: 'S9yMedia',
|
||||
title: 'Serendipity Media Library',
|
||||
icon: CKEDITOR_MLIMGPATH,
|
||||
iconName: 'openML_icon',
|
||||
command: 'openML'
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Clone a serendipity_editor.js function, to avoid a
|
||||
* TypeError: parent.self.opener.serendipity_imageSelector_addToBody is not a function
|
||||
* in case of serendipity_html_nugget_plugin textarea (nuggets3) usage in S9y 1.7 Series
|
||||
*/
|
||||
function serendipity_imageSelector_addToBody (str, textarea) {
|
||||
var oEditor = isinstance;
|
||||
if (oEditor.mode == "wysiwyg") {
|
||||
oEditor.insertHtml(str);
|
||||
}
|
||||
}
|
Binary file not shown.
BIN
serendipity_event_ckeditor/ckeditor_4.2.3_standard-plus.zip
Normal file
BIN
serendipity_event_ckeditor/ckeditor_4.2.3_standard-plus.zip
Normal file
Binary file not shown.
|
@ -1,8 +1,8 @@
|
|||
<?php #
|
||||
|
||||
/**
|
||||
* @file lang_de.inc.php 1.4 2013-08-02 12:23:59 Ian
|
||||
* @version 1.4
|
||||
* @file UTF-8/lang_de.inc.php 1.4.2 2013-10-24 Ian
|
||||
* @version 1.4.2
|
||||
* @author Translator Name <yourmail@example.com>
|
||||
* DE-Revision: Revision of lang_de.inc.php
|
||||
*/
|
||||
|
@ -12,47 +12,30 @@
|
|||
@define('PLUGIN_EVENT_CKEDITOR_REVISION_TITLE', '<h3>Das Plugin enthält:</h3>');
|
||||
@define('PLUGIN_EVENT_CKEDITOR_INSTALL', '<h2>Installation</h2>
|
||||
<ol style="line-height: 1.6">
|
||||
<li>Gebe den relativen HTTP Pfad des <em>"ckeditor"</em> Verzeichnisses in die Plugin Konfiguration ein.
|
||||
<div><strong>Note:</strong> bei den allermeisten Installationen, ist dieser Pfad <em>"plugins/serendipity_event_ckeditor/ckeditor/"</em></div>
|
||||
</li>
|
||||
<li>Gebe den vollen HTTP Pfad des S9y <em>"plugins"</em> Verzeichnisses (mit endendem "/" slash) in die Plugin Konfiguration ein.
|
||||
<div><strong>Note:</strong> bei den allermeisten Installationen, ist dieser Pfad <em>"' . $serendipity['serendipityHTTPPath'] . 'plugins/"</em></div>
|
||||
</li>
|
||||
<li>Um anderen Plugins Zugriff auf das Plugin oder dessen Hook zu gewähren, plaziere das (CKEditor) Plugin nahe dem Ende deiner Pluginliste.</li>
|
||||
<li>Versichere dich, dass der WYSIWYG Modus in den "Persönlichen Einstellungen" eingeschaltet ist.</li>
|
||||
</ol>
|
||||
|
||||
<h3>Manuelle Erweiterungen mit CKEDITOR Plugins</h3>
|
||||
<h3>Manuelle Erweiterungen mit anderen CKEDITOR Plugins</h3>
|
||||
<ol style="line-height: 1.6">
|
||||
<li>Definiere manuell hinzugefügte Plugins (analog zu { name: \'mediaembed\' },) in ckeditor/config.js, in die <em>CKEDITOR.config.toolbarGroups = [...]</em> Definition in der serendipity_event_ckeditor.php Datei.</li>
|
||||
<li>Außerdem füge den neuen Pluginnamen (analog zu mediaembed) zu beiden Vorkommen der <em>CKEDITOR.config.extraPlugins = \'...,...\'</em> Definitionen in der serendipity_event_ckeditor.php Datei hinzu.</li>
|
||||
<li>Definiere manuell hinzugefügte Plugins (analog zu <em>{ name: \'mediaembed\' },</em>) in der custom cke_config.js, in der <em>CKEDITOR.config.toolbarGroups = [...]</em> Definition.</li>
|
||||
<li>Außerdem füge den neuen Pluginnamen (analog zu mediaembed) der <em>var extraPluginList = \'...\'</em> Definition in der cke_plugin.js Datei hinzu.</li>
|
||||
</ol>
|
||||
|
||||
<h3>Upgrading</h3>
|
||||
<p>Dieses Plugin wird von Zeit zu Zeit selber Updates via Spartacus bereitstellen.<hr>
|
||||
Wenn jemals ein manuelles oder persönliches Update des mitgelieferten CKEditor Paketes benötigt wird (*), bitte:
|
||||
Wenn jemals ein manuelles oder persönliches Update des mitgelieferten CKEditor Paketes benötigt wird:
|
||||
<ol style="line-height: 1.6">
|
||||
<li><a href="http://ckeditor.com/download" target="_blank">Download CKEditor</a></li>
|
||||
<li>Extrahiere in: <em>' . dirname(__FILE__) . '</em> (dies sollte das <em>"ckeditor"</em> Sub-Verzeichnis automatisch erstellen)</li>
|
||||
<li>Extrahiere nach: <em>' . realpath(dirname(__FILE__) . '/..') . '</em> (dies sollte das <em>"ckeditor"</em> Sub-Verzeichnis automatisch erstellen)</li>
|
||||
</ol>
|
||||
(*) <em><strong>Note:</strong> Dies wird die KCFinder\'s Integration überschreiben, die am unteren Ende der ckeditor/config.js Datei zu finden ist: <a style="border:0; text-decoration: none;" href="#" onClick="showConfig(\'el1\'); return false" title="auf-/einklappen"><img src="'.serendipity_getTemplateFile('img/plus.png').'" id="optionel1" alt="+/-" border="0"> auf-/einklappen</a></em>
|
||||
<div id="el1" style="margin-top: 0.5em; border: 1px solid #BBB;background-color: #EEE; padding: 0.5em">
|
||||
<pre>
|
||||
/* KCFinder integration - 2013-05-04 */
|
||||
CKEDITOR.editorConfig = function(config) {
|
||||
config.filebrowserBrowseUrl = CKEDITOR_BASEPATH + \'../kcfinder/browse.php?type=files\';
|
||||
config.filebrowserImageBrowseUrl = CKEDITOR_BASEPATH + \'../kcfinder/browse.php?type=images\';
|
||||
config.filebrowserFlashBrowseUrl = CKEDITOR_BASEPATH + \'../kcfinder/browse.php?type=flash\';
|
||||
config.filebrowserUploadUrl = CKEDITOR_BASEPATH + \'../kcfinder/upload.php?type=files\';
|
||||
config.filebrowserImageUploadUrl = CKEDITOR_BASEPATH + \'../kcfinder/upload.php?type=images\';
|
||||
config.filebrowserFlashUploadUrl = CKEDITOR_BASEPATH + \'../kcfinder/upload.php?type=flash\';
|
||||
};
|
||||
</pre>
|
||||
</div><script type="text/javascript" language="JavaScript">document.getElementById("el1").style.display = "none";</script>
|
||||
</p>');
|
||||
@define('PLUGIN_EVENT_CKEDITOR_CONFIG', '');
|
||||
@define('PLUGIN_EVENT_CKEDITOR_INSTALL_PLUGPATH', 'HTTP Pfad des S9y Plugins Verzeichnisses');
|
||||
@define('PLUGIN_EVENT_CKEDITOR_CKEACF_OPTION', 'Stelle Advanced-Content-Filter (ACF) ab');
|
||||
@define('PLUGIN_EVENT_CKEDITOR_TBLB_OPTION', 'Nutze den (default) 2-Zeiler toolbar-group Umbruch');
|
||||
@define('PLUGIN_EVENT_CKEDITOR_CKEACF_OPTION', 'Stelle Advanced-Content-Filter (ACF) ab?');
|
||||
@define('PLUGIN_EVENT_CKEDITOR_TBLB_OPTION', 'Nutze den (default) 2-Zeiler toolbar-group Umbruch?');
|
||||
|
||||
?>
|
||||
@define('PLUGIN_EVENT_CKEDITOR_CODEBUTTON_OPTION', 'Nutze "code toolbar button"?');
|
||||
@define('PLUGIN_EVENT_CKEDITOR_PRETTIFY_OPTION', 'Nutze "prettify code" im Frontend?');
|
||||
@define('PLUGIN_EVENT_CKEDITOR_PRETTIFY_OPTION_BLAHBLAH', 'Erweitert "code toolbar button" Option, um lokal geladene prettify.js und prettify.ccs Dateien (code by Google) im Frontend.');
|
||||
@define('PLUGIN_EVENT_CKEDITOR_OPTION_BLAHBLAH', 'Normalerweise: ');
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
<?php #
|
||||
|
||||
/**
|
||||
* @file lang_en.inc.php 1.4 2013-08-02 12:25:28 Ian
|
||||
* @version 1.4
|
||||
* @file lang_en.inc.php 1.4.2 2013-10-24 Ian
|
||||
* @version 1.4.2
|
||||
* @author Translator Name <yourmail@example.com>
|
||||
* EN-Revision: Revision of lang_en.inc.php
|
||||
*/
|
||||
|
@ -12,20 +12,14 @@
|
|||
@define('PLUGIN_EVENT_CKEDITOR_REVISION_TITLE', '<h3>This Plugin includes:</h3>');
|
||||
@define('PLUGIN_EVENT_CKEDITOR_INSTALL', '<h2>Installation</h2>
|
||||
<ol style="line-height: 1.6">
|
||||
<li>Enter the relative HTTP path to the <em>"ckeditor"</em> directory in plugin configuration.
|
||||
<div><strong>Note:</strong> in most installations, this path is <em>"plugins/serendipity_event_ckeditor/ckeditor/"</em></div>
|
||||
</li>
|
||||
<li>Enter the full HTTP path to s9y <em>"plugins"</em> directory (with trailing slash) in plugin configuration.
|
||||
<div><strong>Note:</strong> in most installations, this path is <em>"' . $serendipity['serendipityHTTPPath'] . 'plugins/"</em></div>
|
||||
</li>
|
||||
<li>To allow other plugins to use or hook into the editor, place this (CKEditor) plugin near the end of your plugin list.</li>
|
||||
<li>Make sure to enable WYSIWYG mode in your personal preferences.</li>
|
||||
</ol>
|
||||
|
||||
<h3>Manually extending with CKEDITOR Plugins</h3>
|
||||
<ol style="line-height: 1.6">
|
||||
<li>Define manually added Plugins (analog to { name: \'mediaembed\' },) in ckeditor/config.js, to the <em>CKEDITOR.config.toolbarGroups = [...]</em> in the serendipity_event_ckeditor.php file.</li>
|
||||
<li>Add (append) the plugin name (analog to mediaembed) to both <em>CKEDITOR.config.extraPlugins = \'...,...\'</em> rules of the serendipity_event_ckeditor.php file.</li>
|
||||
<li>Define manually added Plugins (analog to <em>{ name: \'mediaembed\' },</em>) to the <em>CKEDITOR.config.toolbarGroups = [...]</em> definition, in the cke_config.js.</li>
|
||||
<li>Add (append) the plugin name (analog to mediaembed) to <em>var extraPluginList = \'...\'</em> definition, in the cke_plugin.js.</li>
|
||||
</ol>
|
||||
|
||||
<h3>Upgrading</h3>
|
||||
|
@ -33,26 +27,15 @@
|
|||
If you - in follow - ever need to manually upgrade the delivered CKEditor package to a personal package (*), please:
|
||||
<ol style="line-height: 1.6">
|
||||
<li><a href="http://ckeditor.com/download" target="_blank">Download CKEditor</a></li>
|
||||
<li>Extract to: <em>' . dirname(__FILE__) . '</em> (should create <em>"ckeditor"</em> subdirectory)</li>
|
||||
<li>Extract to: <em>' . realpath(dirname(__FILE__) . '/..') . '</em> (should create <em>"ckeditor"</em> subdirectory)</li>
|
||||
</ol>
|
||||
(*) <em><strong>Note:</strong> This will disable (overwrite) the KCFinder\'s integration added to the end of ckeditor/config.js file: <a style="border:0; text-decoration: none;" href="#" onClick="showConfig(\'el1\'); return false" title="TOGGLE_OPTION"><img src="'.serendipity_getTemplateFile('img/plus.png').'" id="optionel1" alt="+/-" border="0"> TOGGLE_OPTION</a></em>
|
||||
<div id="el1" style="margin-top: 0.5em; border: 1px solid #BBB;background-color: #EEE; padding: 0.5em">
|
||||
<pre>
|
||||
/* KCFinder integration - 2013-05-04 */
|
||||
CKEDITOR.editorConfig = function(config) {
|
||||
config.filebrowserBrowseUrl = CKEDITOR_BASEPATH + \'../kcfinder/browse.php?type=files\';
|
||||
config.filebrowserImageBrowseUrl = CKEDITOR_BASEPATH + \'../kcfinder/browse.php?type=images\';
|
||||
config.filebrowserFlashBrowseUrl = CKEDITOR_BASEPATH + \'../kcfinder/browse.php?type=flash\';
|
||||
config.filebrowserUploadUrl = CKEDITOR_BASEPATH + \'../kcfinder/upload.php?type=files\';
|
||||
config.filebrowserImageUploadUrl = CKEDITOR_BASEPATH + \'../kcfinder/upload.php?type=images\';
|
||||
config.filebrowserFlashUploadUrl = CKEDITOR_BASEPATH + \'../kcfinder/upload.php?type=flash\';
|
||||
};
|
||||
</pre>
|
||||
</div><script type="text/javascript" language="JavaScript">document.getElementById("el1").style.display = "none";</script>
|
||||
</p>');
|
||||
@define('PLUGIN_EVENT_CKEDITOR_CONFIG', '');
|
||||
@define('PLUGIN_EVENT_CKEDITOR_INSTALL_PLUGPATH', 'HTTP path to s9y plugins directory');
|
||||
@define('PLUGIN_EVENT_CKEDITOR_CKEACF_OPTION', 'Disable Advanced-Content-Filter (ACF)');
|
||||
@define('PLUGIN_EVENT_CKEDITOR_TBLB_OPTION', 'Use default 2-liner toolbar-group linebreak');
|
||||
@define('PLUGIN_EVENT_CKEDITOR_CKEACF_OPTION', 'Disable Advanced-Content-Filter (ACF)?');
|
||||
@define('PLUGIN_EVENT_CKEDITOR_TBLB_OPTION', 'Use default 2-liner toolbar-group linebreak?');
|
||||
|
||||
?>
|
||||
@define('PLUGIN_EVENT_CKEDITOR_CODEBUTTON_OPTION', 'Allow code toolbar button?');
|
||||
@define('PLUGIN_EVENT_CKEDITOR_PRETTIFY_OPTION', 'Allow prettify code in frontend?');
|
||||
@define('PLUGIN_EVENT_CKEDITOR_PRETTIFY_OPTION_BLAHBLAH', 'Extends to "allowed code button" option. Adds locally loaded prettify.js and prettify.ccs (code by Google) to frontend.');
|
||||
@define('PLUGIN_EVENT_CKEDITOR_OPTION_BLAHBLAH', 'Usually: ');
|
||||
|
|
1
serendipity_event_ckeditor/prettify.css
Normal file
1
serendipity_event_ckeditor/prettify.css
Normal file
|
@ -0,0 +1 @@
|
|||
.pln{color:#000}@media screen{.str{color:#080}.kwd{color:#008}.com{color:#800}.typ{color:#606}.lit{color:#066}.pun,.opn,.clo{color:#660}.tag{color:#008}.atn{color:#606}.atv{color:#080}.dec,.var{color:#606}.fun{color:red}}@media print,projection{.str{color:#060}.kwd{color:#006;font-weight:bold}.com{color:#600;font-style:italic}.typ{color:#404;font-weight:bold}.lit{color:#044}.pun,.opn,.clo{color:#440}.tag{color:#006;font-weight:bold}.atn{color:#404}.atv{color:#060}}pre.prettyprint{padding:2px;border:1px solid #888}ol.linenums{margin-top:0;margin-bottom:0}li.L0,li.L1,li.L2,li.L3,li.L5,li.L6,li.L7,li.L8{list-style-type:none}li.L1,li.L3,li.L5,li.L7,li.L9{background:#eee}
|
30
serendipity_event_ckeditor/prettify.js
Normal file
30
serendipity_event_ckeditor/prettify.js
Normal file
|
@ -0,0 +1,30 @@
|
|||
!function(){var q=null;window.PR_SHOULD_USE_CONTINUATION=!0;
|
||||
(function(){function S(a){function d(e){var b=e.charCodeAt(0);if(b!==92)return b;var a=e.charAt(1);return(b=r[a])?b:"0"<=a&&a<="7"?parseInt(e.substring(1),8):a==="u"||a==="x"?parseInt(e.substring(2),16):e.charCodeAt(1)}function g(e){if(e<32)return(e<16?"\\x0":"\\x")+e.toString(16);e=String.fromCharCode(e);return e==="\\"||e==="-"||e==="]"||e==="^"?"\\"+e:e}function b(e){var b=e.substring(1,e.length-1).match(/\\u[\dA-Fa-f]{4}|\\x[\dA-Fa-f]{2}|\\[0-3][0-7]{0,2}|\\[0-7]{1,2}|\\[\S\s]|[^\\]/g),e=[],a=
|
||||
b[0]==="^",c=["["];a&&c.push("^");for(var a=a?1:0,f=b.length;a<f;++a){var h=b[a];if(/\\[bdsw]/i.test(h))c.push(h);else{var h=d(h),l;a+2<f&&"-"===b[a+1]?(l=d(b[a+2]),a+=2):l=h;e.push([h,l]);l<65||h>122||(l<65||h>90||e.push([Math.max(65,h)|32,Math.min(l,90)|32]),l<97||h>122||e.push([Math.max(97,h)&-33,Math.min(l,122)&-33]))}}e.sort(function(e,a){return e[0]-a[0]||a[1]-e[1]});b=[];f=[];for(a=0;a<e.length;++a)h=e[a],h[0]<=f[1]+1?f[1]=Math.max(f[1],h[1]):b.push(f=h);for(a=0;a<b.length;++a)h=b[a],c.push(g(h[0])),
|
||||
h[1]>h[0]&&(h[1]+1>h[0]&&c.push("-"),c.push(g(h[1])));c.push("]");return c.join("")}function s(e){for(var a=e.source.match(/\[(?:[^\\\]]|\\[\S\s])*]|\\u[\dA-Fa-f]{4}|\\x[\dA-Fa-f]{2}|\\\d+|\\[^\dux]|\(\?[!:=]|[()^]|[^()[\\^]+/g),c=a.length,d=[],f=0,h=0;f<c;++f){var l=a[f];l==="("?++h:"\\"===l.charAt(0)&&(l=+l.substring(1))&&(l<=h?d[l]=-1:a[f]=g(l))}for(f=1;f<d.length;++f)-1===d[f]&&(d[f]=++x);for(h=f=0;f<c;++f)l=a[f],l==="("?(++h,d[h]||(a[f]="(?:")):"\\"===l.charAt(0)&&(l=+l.substring(1))&&l<=h&&
|
||||
(a[f]="\\"+d[l]);for(f=0;f<c;++f)"^"===a[f]&&"^"!==a[f+1]&&(a[f]="");if(e.ignoreCase&&m)for(f=0;f<c;++f)l=a[f],e=l.charAt(0),l.length>=2&&e==="["?a[f]=b(l):e!=="\\"&&(a[f]=l.replace(/[A-Za-z]/g,function(a){a=a.charCodeAt(0);return"["+String.fromCharCode(a&-33,a|32)+"]"}));return a.join("")}for(var x=0,m=!1,j=!1,k=0,c=a.length;k<c;++k){var i=a[k];if(i.ignoreCase)j=!0;else if(/[a-z]/i.test(i.source.replace(/\\u[\da-f]{4}|\\x[\da-f]{2}|\\[^UXux]/gi,""))){m=!0;j=!1;break}}for(var r={b:8,t:9,n:10,v:11,
|
||||
f:12,r:13},n=[],k=0,c=a.length;k<c;++k){i=a[k];if(i.global||i.multiline)throw Error(""+i);n.push("(?:"+s(i)+")")}return RegExp(n.join("|"),j?"gi":"g")}function T(a,d){function g(a){var c=a.nodeType;if(c==1){if(!b.test(a.className)){for(c=a.firstChild;c;c=c.nextSibling)g(c);c=a.nodeName.toLowerCase();if("br"===c||"li"===c)s[j]="\n",m[j<<1]=x++,m[j++<<1|1]=a}}else if(c==3||c==4)c=a.nodeValue,c.length&&(c=d?c.replace(/\r\n?/g,"\n"):c.replace(/[\t\n\r ]+/g," "),s[j]=c,m[j<<1]=x,x+=c.length,m[j++<<1|1]=
|
||||
a)}var b=/(?:^|\s)nocode(?:\s|$)/,s=[],x=0,m=[],j=0;g(a);return{a:s.join("").replace(/\n$/,""),d:m}}function H(a,d,g,b){d&&(a={a:d,e:a},g(a),b.push.apply(b,a.g))}function U(a){for(var d=void 0,g=a.firstChild;g;g=g.nextSibling)var b=g.nodeType,d=b===1?d?a:g:b===3?V.test(g.nodeValue)?a:d:d;return d===a?void 0:d}function C(a,d){function g(a){for(var j=a.e,k=[j,"pln"],c=0,i=a.a.match(s)||[],r={},n=0,e=i.length;n<e;++n){var z=i[n],w=r[z],t=void 0,f;if(typeof w==="string")f=!1;else{var h=b[z.charAt(0)];
|
||||
if(h)t=z.match(h[1]),w=h[0];else{for(f=0;f<x;++f)if(h=d[f],t=z.match(h[1])){w=h[0];break}t||(w="pln")}if((f=w.length>=5&&"lang-"===w.substring(0,5))&&!(t&&typeof t[1]==="string"))f=!1,w="src";f||(r[z]=w)}h=c;c+=z.length;if(f){f=t[1];var l=z.indexOf(f),B=l+f.length;t[2]&&(B=z.length-t[2].length,l=B-f.length);w=w.substring(5);H(j+h,z.substring(0,l),g,k);H(j+h+l,f,I(w,f),k);H(j+h+B,z.substring(B),g,k)}else k.push(j+h,w)}a.g=k}var b={},s;(function(){for(var g=a.concat(d),j=[],k={},c=0,i=g.length;c<i;++c){var r=
|
||||
g[c],n=r[3];if(n)for(var e=n.length;--e>=0;)b[n.charAt(e)]=r;r=r[1];n=""+r;k.hasOwnProperty(n)||(j.push(r),k[n]=q)}j.push(/[\S\s]/);s=S(j)})();var x=d.length;return g}function v(a){var d=[],g=[];a.tripleQuotedStrings?d.push(["str",/^(?:'''(?:[^'\\]|\\[\S\s]|''?(?=[^']))*(?:'''|$)|"""(?:[^"\\]|\\[\S\s]|""?(?=[^"]))*(?:"""|$)|'(?:[^'\\]|\\[\S\s])*(?:'|$)|"(?:[^"\\]|\\[\S\s])*(?:"|$))/,q,"'\""]):a.multiLineStrings?d.push(["str",/^(?:'(?:[^'\\]|\\[\S\s])*(?:'|$)|"(?:[^"\\]|\\[\S\s])*(?:"|$)|`(?:[^\\`]|\\[\S\s])*(?:`|$))/,
|
||||
q,"'\"`"]):d.push(["str",/^(?:'(?:[^\n\r'\\]|\\.)*(?:'|$)|"(?:[^\n\r"\\]|\\.)*(?:"|$))/,q,"\"'"]);a.verbatimStrings&&g.push(["str",/^@"(?:[^"]|"")*(?:"|$)/,q]);var b=a.hashComments;b&&(a.cStyleComments?(b>1?d.push(["com",/^#(?:##(?:[^#]|#(?!##))*(?:###|$)|.*)/,q,"#"]):d.push(["com",/^#(?:(?:define|e(?:l|nd)if|else|error|ifn?def|include|line|pragma|undef|warning)\b|[^\n\r]*)/,q,"#"]),g.push(["str",/^<(?:(?:(?:\.\.\/)*|\/?)(?:[\w-]+(?:\/[\w-]+)+)?[\w-]+\.h(?:h|pp|\+\+)?|[a-z]\w*)>/,q])):d.push(["com",
|
||||
/^#[^\n\r]*/,q,"#"]));a.cStyleComments&&(g.push(["com",/^\/\/[^\n\r]*/,q]),g.push(["com",/^\/\*[\S\s]*?(?:\*\/|$)/,q]));if(b=a.regexLiterals){var s=(b=b>1?"":"\n\r")?".":"[\\S\\s]";g.push(["lang-regex",RegExp("^(?:^^\\.?|[+-]|[!=]=?=?|\\#|%=?|&&?=?|\\(|\\*=?|[+\\-]=|->|\\/=?|::?|<<?=?|>>?>?=?|,|;|\\?|@|\\[|~|{|\\^\\^?=?|\\|\\|?=?|break|case|continue|delete|do|else|finally|instanceof|return|throw|try|typeof)\\s*("+("/(?=[^/*"+b+"])(?:[^/\\x5B\\x5C"+b+"]|\\x5C"+s+"|\\x5B(?:[^\\x5C\\x5D"+b+"]|\\x5C"+
|
||||
s+")*(?:\\x5D|$))+/")+")")])}(b=a.types)&&g.push(["typ",b]);b=(""+a.keywords).replace(/^ | $/g,"");b.length&&g.push(["kwd",RegExp("^(?:"+b.replace(/[\s,]+/g,"|")+")\\b"),q]);d.push(["pln",/^\s+/,q," \r\n\t\u00a0"]);b="^.[^\\s\\w.$@'\"`/\\\\]*";a.regexLiterals&&(b+="(?!s*/)");g.push(["lit",/^@[$_a-z][\w$@]*/i,q],["typ",/^(?:[@_]?[A-Z]+[a-z][\w$@]*|\w+_t\b)/,q],["pln",/^[$_a-z][\w$@]*/i,q],["lit",/^(?:0x[\da-f]+|(?:\d(?:_\d+)*\d*(?:\.\d*)?|\.\d\+)(?:e[+-]?\d+)?)[a-z]*/i,q,"0123456789"],["pln",/^\\[\S\s]?/,
|
||||
q],["pun",RegExp(b),q]);return C(d,g)}function J(a,d,g){function b(a){var c=a.nodeType;if(c==1&&!x.test(a.className))if("br"===a.nodeName)s(a),a.parentNode&&a.parentNode.removeChild(a);else for(a=a.firstChild;a;a=a.nextSibling)b(a);else if((c==3||c==4)&&g){var d=a.nodeValue,i=d.match(m);if(i)c=d.substring(0,i.index),a.nodeValue=c,(d=d.substring(i.index+i[0].length))&&a.parentNode.insertBefore(j.createTextNode(d),a.nextSibling),s(a),c||a.parentNode.removeChild(a)}}function s(a){function b(a,c){var d=
|
||||
c?a.cloneNode(!1):a,e=a.parentNode;if(e){var e=b(e,1),g=a.nextSibling;e.appendChild(d);for(var i=g;i;i=g)g=i.nextSibling,e.appendChild(i)}return d}for(;!a.nextSibling;)if(a=a.parentNode,!a)return;for(var a=b(a.nextSibling,0),d;(d=a.parentNode)&&d.nodeType===1;)a=d;c.push(a)}for(var x=/(?:^|\s)nocode(?:\s|$)/,m=/\r\n?|\n/,j=a.ownerDocument,k=j.createElement("li");a.firstChild;)k.appendChild(a.firstChild);for(var c=[k],i=0;i<c.length;++i)b(c[i]);d===(d|0)&&c[0].setAttribute("value",d);var r=j.createElement("ol");
|
||||
r.className="linenums";for(var d=Math.max(0,d-1|0)||0,i=0,n=c.length;i<n;++i)k=c[i],k.className="L"+(i+d)%10,k.firstChild||k.appendChild(j.createTextNode("\u00a0")),r.appendChild(k);a.appendChild(r)}function p(a,d){for(var g=d.length;--g>=0;){var b=d[g];F.hasOwnProperty(b)?D.console&&console.warn("cannot override language handler %s",b):F[b]=a}}function I(a,d){if(!a||!F.hasOwnProperty(a))a=/^\s*</.test(d)?"default-markup":"default-code";return F[a]}function K(a){var d=a.h;try{var g=T(a.c,a.i),b=g.a;
|
||||
a.a=b;a.d=g.d;a.e=0;I(d,b)(a);var s=/\bMSIE\s(\d+)/.exec(navigator.userAgent),s=s&&+s[1]<=8,d=/\n/g,x=a.a,m=x.length,g=0,j=a.d,k=j.length,b=0,c=a.g,i=c.length,r=0;c[i]=m;var n,e;for(e=n=0;e<i;)c[e]!==c[e+2]?(c[n++]=c[e++],c[n++]=c[e++]):e+=2;i=n;for(e=n=0;e<i;){for(var p=c[e],w=c[e+1],t=e+2;t+2<=i&&c[t+1]===w;)t+=2;c[n++]=p;c[n++]=w;e=t}c.length=n;var f=a.c,h;if(f)h=f.style.display,f.style.display="none";try{for(;b<k;){var l=j[b+2]||m,B=c[r+2]||m,t=Math.min(l,B),A=j[b+1],G;if(A.nodeType!==1&&(G=x.substring(g,
|
||||
t))){s&&(G=G.replace(d,"\r"));A.nodeValue=G;var L=A.ownerDocument,o=L.createElement("span");o.className=c[r+1];var v=A.parentNode;v.replaceChild(o,A);o.appendChild(A);g<l&&(j[b+1]=A=L.createTextNode(x.substring(t,l)),v.insertBefore(A,o.nextSibling))}g=t;g>=l&&(b+=2);g>=B&&(r+=2)}}finally{if(f)f.style.display=h}}catch(u){D.console&&console.log(u&&u.stack||u)}}var D=window,y=["break,continue,do,else,for,if,return,while"],E=[[y,"auto,case,char,const,default,double,enum,extern,float,goto,inline,int,long,register,short,signed,sizeof,static,struct,switch,typedef,union,unsigned,void,volatile"],
|
||||
"catch,class,delete,false,import,new,operator,private,protected,public,this,throw,true,try,typeof"],M=[E,"alignof,align_union,asm,axiom,bool,concept,concept_map,const_cast,constexpr,decltype,delegate,dynamic_cast,explicit,export,friend,generic,late_check,mutable,namespace,nullptr,property,reinterpret_cast,static_assert,static_cast,template,typeid,typename,using,virtual,where"],N=[E,"abstract,assert,boolean,byte,extends,final,finally,implements,import,instanceof,interface,null,native,package,strictfp,super,synchronized,throws,transient"],
|
||||
O=[N,"as,base,by,checked,decimal,delegate,descending,dynamic,event,fixed,foreach,from,group,implicit,in,internal,into,is,let,lock,object,out,override,orderby,params,partial,readonly,ref,sbyte,sealed,stackalloc,string,select,uint,ulong,unchecked,unsafe,ushort,var,virtual,where"],E=[E,"debugger,eval,export,function,get,null,set,undefined,var,with,Infinity,NaN"],P=[y,"and,as,assert,class,def,del,elif,except,exec,finally,from,global,import,in,is,lambda,nonlocal,not,or,pass,print,raise,try,with,yield,False,True,None"],
|
||||
Q=[y,"alias,and,begin,case,class,def,defined,elsif,end,ensure,false,in,module,next,nil,not,or,redo,rescue,retry,self,super,then,true,undef,unless,until,when,yield,BEGIN,END"],W=[y,"as,assert,const,copy,drop,enum,extern,fail,false,fn,impl,let,log,loop,match,mod,move,mut,priv,pub,pure,ref,self,static,struct,true,trait,type,unsafe,use"],y=[y,"case,done,elif,esac,eval,fi,function,in,local,set,then,until"],R=/^(DIR|FILE|vector|(de|priority_)?queue|list|stack|(const_)?iterator|(multi)?(set|map)|bitset|u?(int|float)\d*)\b/,
|
||||
V=/\S/,X=v({keywords:[M,O,E,"caller,delete,die,do,dump,elsif,eval,exit,foreach,for,goto,if,import,last,local,my,next,no,our,print,package,redo,require,sub,undef,unless,until,use,wantarray,while,BEGIN,END",P,Q,y],hashComments:!0,cStyleComments:!0,multiLineStrings:!0,regexLiterals:!0}),F={};p(X,["default-code"]);p(C([],[["pln",/^[^<?]+/],["dec",/^<!\w[^>]*(?:>|$)/],["com",/^<\!--[\S\s]*?(?:--\>|$)/],["lang-",/^<\?([\S\s]+?)(?:\?>|$)/],["lang-",/^<%([\S\s]+?)(?:%>|$)/],["pun",/^(?:<[%?]|[%?]>)/],["lang-",
|
||||
/^<xmp\b[^>]*>([\S\s]+?)<\/xmp\b[^>]*>/i],["lang-js",/^<script\b[^>]*>([\S\s]*?)(<\/script\b[^>]*>)/i],["lang-css",/^<style\b[^>]*>([\S\s]*?)(<\/style\b[^>]*>)/i],["lang-in.tag",/^(<\/?[a-z][^<>]*>)/i]]),["default-markup","htm","html","mxml","xhtml","xml","xsl"]);p(C([["pln",/^\s+/,q," \t\r\n"],["atv",/^(?:"[^"]*"?|'[^']*'?)/,q,"\"'"]],[["tag",/^^<\/?[a-z](?:[\w-.:]*\w)?|\/?>$/i],["atn",/^(?!style[\s=]|on)[a-z](?:[\w:-]*\w)?/i],["lang-uq.val",/^=\s*([^\s"'>]*(?:[^\s"'/>]|\/(?=\s)))/],["pun",/^[/<->]+/],
|
||||
["lang-js",/^on\w+\s*=\s*"([^"]+)"/i],["lang-js",/^on\w+\s*=\s*'([^']+)'/i],["lang-js",/^on\w+\s*=\s*([^\s"'>]+)/i],["lang-css",/^style\s*=\s*"([^"]+)"/i],["lang-css",/^style\s*=\s*'([^']+)'/i],["lang-css",/^style\s*=\s*([^\s"'>]+)/i]]),["in.tag"]);p(C([],[["atv",/^[\S\s]+/]]),["uq.val"]);p(v({keywords:M,hashComments:!0,cStyleComments:!0,types:R}),["c","cc","cpp","cxx","cyc","m"]);p(v({keywords:"null,true,false"}),["json"]);p(v({keywords:O,hashComments:!0,cStyleComments:!0,verbatimStrings:!0,types:R}),
|
||||
["cs"]);p(v({keywords:N,cStyleComments:!0}),["java"]);p(v({keywords:y,hashComments:!0,multiLineStrings:!0}),["bash","bsh","csh","sh"]);p(v({keywords:P,hashComments:!0,multiLineStrings:!0,tripleQuotedStrings:!0}),["cv","py","python"]);p(v({keywords:"caller,delete,die,do,dump,elsif,eval,exit,foreach,for,goto,if,import,last,local,my,next,no,our,print,package,redo,require,sub,undef,unless,until,use,wantarray,while,BEGIN,END",hashComments:!0,multiLineStrings:!0,regexLiterals:2}),["perl","pl","pm"]);p(v({keywords:Q,
|
||||
hashComments:!0,multiLineStrings:!0,regexLiterals:!0}),["rb","ruby"]);p(v({keywords:E,cStyleComments:!0,regexLiterals:!0}),["javascript","js"]);p(v({keywords:"all,and,by,catch,class,else,extends,false,finally,for,if,in,is,isnt,loop,new,no,not,null,of,off,on,or,return,super,then,throw,true,try,unless,until,when,while,yes",hashComments:3,cStyleComments:!0,multilineStrings:!0,tripleQuotedStrings:!0,regexLiterals:!0}),["coffee"]);p(v({keywords:W,cStyleComments:!0,multilineStrings:!0}),["rc","rs","rust"]);
|
||||
p(C([],[["str",/^[\S\s]+/]]),["regex"]);var Y=D.PR={createSimpleLexer:C,registerLangHandler:p,sourceDecorator:v,PR_ATTRIB_NAME:"atn",PR_ATTRIB_VALUE:"atv",PR_COMMENT:"com",PR_DECLARATION:"dec",PR_KEYWORD:"kwd",PR_LITERAL:"lit",PR_NOCODE:"nocode",PR_PLAIN:"pln",PR_PUNCTUATION:"pun",PR_SOURCE:"src",PR_STRING:"str",PR_TAG:"tag",PR_TYPE:"typ",prettyPrintOne:D.prettyPrintOne=function(a,d,g){var b=document.createElement("div");b.innerHTML="<pre>"+a+"</pre>";b=b.firstChild;g&&J(b,g,!0);K({h:d,j:g,c:b,i:1});
|
||||
return b.innerHTML},prettyPrint:D.prettyPrint=function(a,d){function g(){for(var b=D.PR_SHOULD_USE_CONTINUATION?c.now()+250:Infinity;i<p.length&&c.now()<b;i++){for(var d=p[i],j=h,k=d;k=k.previousSibling;){var m=k.nodeType,o=(m===7||m===8)&&k.nodeValue;if(o?!/^\??prettify\b/.test(o):m!==3||/\S/.test(k.nodeValue))break;if(o){j={};o.replace(/\b(\w+)=([\w%+\-.:]+)/g,function(a,b,c){j[b]=c});break}}k=d.className;if((j!==h||e.test(k))&&!v.test(k)){m=!1;for(o=d.parentNode;o;o=o.parentNode)if(f.test(o.tagName)&&
|
||||
o.className&&e.test(o.className)){m=!0;break}if(!m){d.className+=" prettyprinted";m=j.lang;if(!m){var m=k.match(n),y;if(!m&&(y=U(d))&&t.test(y.tagName))m=y.className.match(n);m&&(m=m[1])}if(w.test(d.tagName))o=1;else var o=d.currentStyle,u=s.defaultView,o=(o=o?o.whiteSpace:u&&u.getComputedStyle?u.getComputedStyle(d,q).getPropertyValue("white-space"):0)&&"pre"===o.substring(0,3);u=j.linenums;if(!(u=u==="true"||+u))u=(u=k.match(/\blinenums\b(?::(\d+))?/))?u[1]&&u[1].length?+u[1]:!0:!1;u&&J(d,u,o);r=
|
||||
{h:m,c:d,j:u,i:o};K(r)}}}i<p.length?setTimeout(g,250):"function"===typeof a&&a()}for(var b=d||document.body,s=b.ownerDocument||document,b=[b.getElementsByTagName("pre"),b.getElementsByTagName("code"),b.getElementsByTagName("xmp")],p=[],m=0;m<b.length;++m)for(var j=0,k=b[m].length;j<k;++j)p.push(b[m][j]);var b=q,c=Date;c.now||(c={now:function(){return+new Date}});var i=0,r,n=/\blang(?:uage)?-([\w.]+)(?!\S)/,e=/\bprettyprint\b/,v=/\bprettyprinted\b/,w=/pre|xmp/i,t=/^code$/i,f=/^(?:pre|code|xmp)$/i,
|
||||
h={};g()}};typeof define==="function"&&define.amd&&define("google-code-prettify",[],function(){return Y})})();}()
|
|
@ -48,23 +48,25 @@ class serendipity_event_ckeditor extends serendipity_event
|
|||
* @access protected
|
||||
* @var string
|
||||
*/
|
||||
protected $cke_zipfile = 'ckeditor_4.1.3_standard-plus.zip';
|
||||
protected $cke_zipfile = 'ckeditor_4.2.3_standard-plus.zip';
|
||||
|
||||
/**
|
||||
* Access property checkUpdateVersion
|
||||
* Verify release package versions - do update on upgrades!
|
||||
* @var array
|
||||
*/
|
||||
protected $checkUpdateVersion = array('ckeditor:4.1.3', 'kcfinder:2.52-2');
|
||||
protected $checkUpdateVersion = array('ckeditor:4.2.3', 'kcfinder:2.52-2');
|
||||
|
||||
/**
|
||||
* Access property revisionPackage
|
||||
* Note revisions of ckeditor, kcfinder and plugin additions to lang files
|
||||
* @var array
|
||||
*/
|
||||
protected $revisionPackage = array('CKEditor 4.1.3 (revision 1baa4c5, standard package, 2013-07-18)',
|
||||
protected $revisionPackage = array('CKEditor 4.2.3 (revision a8bf556, standard package, 2013-11-14)',
|
||||
'KCFinder 2.52-dev (http://kcfinder.sunhater.com/ git package, 2013-05-04)',
|
||||
'CKEditor-Plugin: mediaembed 0.5+ (https://github.com/frozeman/MediaEmbed, 2013-07-25)');
|
||||
'CKEditor-Plugin: mediaembed, v. 0.5+ (https://github.com/frozeman/MediaEmbed, 2013-09-12)',
|
||||
'CKEditor-Plugin: pbckcode, v. 1.1.0 (https://github.com/prbaron/PBCKCode, 2013-09-06)',
|
||||
'CKEditor-Plugin: procurator, v. 1.0 (Serendipity placeholder Plugin, 2013-09-26)');
|
||||
|
||||
|
||||
function install() {
|
||||
|
@ -84,6 +86,11 @@ class serendipity_event_ckeditor extends serendipity_event
|
|||
}
|
||||
}
|
||||
|
||||
if (!extension_loaded('zip')) {
|
||||
trigger_error(' ZIP extension has not been compiled or loaded in php.', E_USER_WARNING);
|
||||
return;
|
||||
}
|
||||
|
||||
if (is_writable($this->cke_path)) {
|
||||
$zip = new ZipArchive;
|
||||
if ($zip->open($this->cke_path . '/' . $this->cke_zipfile) === true) {
|
||||
|
@ -94,8 +101,14 @@ class serendipity_event_ckeditor extends serendipity_event
|
|||
foreach (glob($this->cke_path . '/*.zip') as $filename) {
|
||||
if($this->cke_path . '/' . $this->cke_zipfile != $filename) {
|
||||
@unlink($filename);
|
||||
$is_update = true;
|
||||
}
|
||||
}
|
||||
if ($is_update) {
|
||||
// purge removed files for upgraders to ckeditor v. 4.2 only
|
||||
@unlink($this->cke_path . '/ckeditor/build_config.js');
|
||||
@unlink($this->cke_path . '/ckeditor/skins/moono/images/mini.png');
|
||||
}
|
||||
} else {
|
||||
$this->set_config('installer', '1-'.date('Ymd-H:i:s'));
|
||||
return false;
|
||||
|
@ -115,7 +128,7 @@ class serendipity_event_ckeditor extends serendipity_event
|
|||
$propbag->add('description', PLUGIN_EVENT_CKEDITOR_DESC);
|
||||
$propbag->add('stackable', false);
|
||||
$propbag->add('author', 'Rustam Abdullaev, Ian');
|
||||
$propbag->add('version', '1.3.2');
|
||||
$propbag->add('version', '2.3.0'); // is CKEDITOR Series 4 (hidden) - revision .2.3 - and appended serendipity_event_ckeditor revision .0
|
||||
$propbag->add('copyright', 'GPL or LGPL License');
|
||||
$propbag->add('requirements', array(
|
||||
'serendipity' => '1.7',
|
||||
|
@ -124,6 +137,7 @@ class serendipity_event_ckeditor extends serendipity_event
|
|||
));
|
||||
|
||||
$propbag->add('event_hooks', array(
|
||||
'frontend_footer' => true,
|
||||
'backend_header' => true,
|
||||
'css_backend' => true,
|
||||
'backend_plugins_update' => true,
|
||||
|
@ -131,7 +145,7 @@ class serendipity_event_ckeditor extends serendipity_event
|
|||
'backend_wysiwyg' => true,
|
||||
'backend_wysiwyg_finish' => true
|
||||
));
|
||||
$propbag->add('configuration', array('path', 'plugpath', 'acf_off', 'toolbar_break'));
|
||||
$propbag->add('configuration', array('path', 'plugpath', 'codebutton', 'prettify', 'acf_off', 'toolbar_break'));
|
||||
$propbag->add('groups', array('BACKEND_EDITOR'));
|
||||
}
|
||||
|
||||
|
@ -143,17 +157,31 @@ class serendipity_event_ckeditor extends serendipity_event
|
|||
case 'path':
|
||||
$propbag->add('type', 'string');
|
||||
$propbag->add('name', INSTALL_RELPATH);
|
||||
$propbag->add('description', '');
|
||||
$propbag->add('description', PLUGIN_EVENT_CKEDITOR_OPTION_BLAHBLAH . '"plugins/serendipity_event_ckeditor/ckeditor/"');
|
||||
$propbag->add('default', 'plugins/serendipity_event_ckeditor/ckeditor/');
|
||||
break;
|
||||
|
||||
case 'plugpath':
|
||||
$propbag->add('type', 'string');
|
||||
$propbag->add('name', PLUGIN_EVENT_CKEDITOR_INSTALL_PLUGPATH);
|
||||
$propbag->add('description', '');
|
||||
$propbag->add('description', PLUGIN_EVENT_CKEDITOR_OPTION_BLAHBLAH . '"' . $serendipity['serendipityHTTPPath'] . 'plugins/"');
|
||||
$propbag->add('default', $serendipity['serendipityHTTPPath'] . 'plugins/');
|
||||
break;
|
||||
|
||||
case 'codebutton':
|
||||
$propbag->add('type', 'boolean');
|
||||
$propbag->add('name', PLUGIN_EVENT_CKEDITOR_CODEBUTTON_OPTION);
|
||||
$propbag->add('description', '');
|
||||
$propbag->add('default', 'false');
|
||||
break;
|
||||
|
||||
case 'prettify':
|
||||
$propbag->add('type', 'boolean');
|
||||
$propbag->add('name', PLUGIN_EVENT_CKEDITOR_PRETTIFY_OPTION);
|
||||
$propbag->add('description', PLUGIN_EVENT_CKEDITOR_PRETTIFY_OPTION_BLAHBLAH);
|
||||
$propbag->add('default', 'false');
|
||||
break;
|
||||
|
||||
case 'acf_off':
|
||||
$propbag->add('type', 'boolean');
|
||||
$propbag->add('name', PLUGIN_EVENT_CKEDITOR_CKEACF_OPTION);
|
||||
|
@ -255,6 +283,20 @@ class serendipity_event_ckeditor extends serendipity_event
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Check and purge KCFinder Error fallback files to avoid errors
|
||||
* @access private
|
||||
*/
|
||||
private function checkFallback() {
|
||||
// kcfinder has a fallback media library mode if not properly loaded, or an other error occurs - get rid of it by default, since it stops image browser executing!
|
||||
// this is only executed once for the finish hook with entryforms - but sadly twice for staticpages forms
|
||||
if( is_file(dirname(__FILE__) . '/kcfinder/.htaccess') ) {
|
||||
@unlink(dirname(__FILE__) . '/kcfinder/.htaccess');
|
||||
$this->empty_dir(dirname(__FILE__) . '/kcfinder/.thumbs');
|
||||
if (!is_dir(dirname(__FILE__) . '/kcfinder/.thumbs')) @rmdir(dirname(__FILE__) . '/kcfinder/.thumbs');
|
||||
}
|
||||
}
|
||||
|
||||
function event_hook($event, &$bag, &$eventData, $addData = null) {
|
||||
global $serendipity;
|
||||
|
||||
|
@ -262,126 +304,58 @@ class serendipity_event_ckeditor extends serendipity_event
|
|||
|
||||
if (isset($hooks[$event])) {
|
||||
switch($event) {
|
||||
case 'frontend_footer':
|
||||
// set prettify.css and prettify.js in frontend by plugin option
|
||||
if ($this->get_config('prettify')) {
|
||||
?>
|
||||
<link rel="stylesheet" type="text/css" href="<?php echo $serendipity['serendipityHTTPPath'] . 'plugins/serendipity_event_ckeditor/prettify.css'; ?>" />
|
||||
<?php
|
||||
}
|
||||
if ($this->get_config('codebutton')) {
|
||||
?>
|
||||
<script language="javascript" type="text/javascript" src="<?php echo $serendipity['serendipityHTTPPath'] . 'plugins/serendipity_event_ckeditor/prettify.js'; ?>"></script>
|
||||
<script>
|
||||
jQuery(function($){
|
||||
// relaunch the prettify code
|
||||
prettyPrint();
|
||||
});
|
||||
</script>
|
||||
<?php
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case 'backend_header':
|
||||
if (isset($serendipity['wysiwyg']) && $serendipity['wysiwyg'] && isset($eventData)) {
|
||||
$relpath = htmlspecialchars($this->get_config('path'));
|
||||
$plgpath = htmlspecialchars($this->get_config('plugpath'));
|
||||
$acfoff = serendipity_db_bool($this->get_config('acf_off')) ? 'true' : 'false';
|
||||
$acfoff = serendipity_db_bool($this->get_config('acf_off')) ? 'true' : 'false'; // need this, to be passed correctly as boolean true/false to custom config.js
|
||||
if(!isset($_COOKIE['KCFINDER_uploadurl']) || empty($_COOKIE['KCFINDER_uploadurl'])) {
|
||||
setcookie('KCFINDER_uploadurl', serialize($serendipity['serendipityHTTPPath'] . $serendipity['uploadHTTPPath']), time()+60*60*24*30, $serendipity['serendipityHTTPPath'], $_SERVER['HTTP_HOST'], false);
|
||||
}
|
||||
/* set some global vars */
|
||||
/* bind ckeditor */
|
||||
/* build specific dynamic plugins and set custom config (cke_config.js) */
|
||||
?>
|
||||
|
||||
<script type="text/javascript">
|
||||
CKEDITOR_BASEPATH = '<?php echo $relpath; ?>';
|
||||
CKEDITOR_PLUGPATH = '<?php echo $plgpath; ?>';
|
||||
KCFINDER_UPLOADPATH = '<?php echo $serendipity['serendipityHTTPPath'] . $serendipity['uploadPath'] ?>';
|
||||
CKEDITOR_BASEPATH = '<?php echo $relpath; ?>';
|
||||
CKEDITOR_PLUGPATH = '<?php echo $plgpath; ?>';
|
||||
CKEDITOR_MLIMGPATH = '<?php echo $serendipity['serendipityHTTPPath'] . 'plugins/serendipity_event_ckeditor/img/mls9y.png'; ?>';
|
||||
KCFINDER_UPLOADPATH = '<?php echo $serendipity['serendipityHTTPPath'] . $serendipity['uploadPath'] ?>';
|
||||
S9Y_BASEURL = '<?php echo $serendipity['defaultBaseURL']; ?>';
|
||||
CONFIG_ACF_OFF = <?php echo $acfoff; ?>;
|
||||
CONFIG_TOOLBAR_BREAK = <?php echo (serendipity_db_bool($this->get_config('toolbar_break'))) ? "'/'" : "''"; ?>;
|
||||
</script>
|
||||
<script language="javascript" type="text/javascript" src="<?php echo $relpath; ?>ckeditor.js"></script>
|
||||
<script type="text/javascript">
|
||||
CKEDITOR.config['skin'] = 'moono';
|
||||
CKEDITOR.config['height'] = 400;
|
||||
//CKEDITOR.config.removePlugins = 'flash,iframe';
|
||||
CKEDITOR.config.allowedContent = <?php echo $acfoff; ?>;
|
||||
CKEDITOR.config.protectedSource.push(/<mediainsert>.*<\/mediainsert>/ig); // protect imageselectorplus galleries [OK] - still very sensitive!
|
||||
CKEDITOR.config.removeButtons = 'Styles';
|
||||
CKEDITOR.config.toolbarGroups = [
|
||||
{ name: 'styles' },
|
||||
{ name: 'basicstyles', groups: [ 'basicstyles', 'cleanup' ] },
|
||||
{ name: 'paragraph', groups: [ 'list', /*'indent', */'blocks', 'align', 'bidi' ] },
|
||||
{ name: 'links' },
|
||||
{ name: 'insert' },
|
||||
<?php if(serendipity_db_bool($this->get_config('toolbar_break'))) echo " '/',\n"; ?>
|
||||
{ name: 'clipboard', groups: [ 'clipboard', 'undo' ] },
|
||||
{ name: 'document', groups: [ 'mode', 'document', 'doctools' ] },
|
||||
{ name: 'editing', groups: [ 'find', 'selection', 'spellchecker' ] },
|
||||
{ name: 'others' },
|
||||
{ name: 'mediaembed' },
|
||||
{ name: 'tools' },
|
||||
{ name: 'about' }
|
||||
];
|
||||
|
||||
CKEDITOR.on( 'instanceReady', function( event ) {
|
||||
event.editor.on( 'focus', function() {
|
||||
// console.log( 'focused', this );
|
||||
isinstance = this;
|
||||
});
|
||||
});
|
||||
|
||||
if (!Array.prototype.forEach) {
|
||||
Array.prototype.forEach = function (fn, scope) {
|
||||
'use strict';
|
||||
var i, len;
|
||||
for (i = 0, len = this.length; i < len; ++i) {
|
||||
if (i in this) {
|
||||
fn.call(scope, this[i], i, this);
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
function exefit(execcom) {
|
||||
execcom = execcom.replace('function() { ', '');
|
||||
execcom = execcom.replace(' }', '');
|
||||
execcom = execcom.replace('<?php echo $serendipity['defaultBaseURL']; ?>', '');
|
||||
return execcom;
|
||||
}
|
||||
|
||||
// this is nugget only area, spawned by head! (textareas of staticpage nuggets, html nugget plugins, etc.)
|
||||
// called via Spawnnugget(), set by real plugins like staticpages and cores functions_plugins_admin.inc in case of $ev['skip_nuggets'] === false
|
||||
function Spawnnuggets(item) {
|
||||
// console.log(item);
|
||||
if (document.getElementById('nuggets' + item)) {
|
||||
CKEDITOR.replace('nuggets' + item, {
|
||||
// Reset toolbar Groups settings
|
||||
// toolbarGroups: null
|
||||
});
|
||||
|
||||
CKEDITOR.config.extraPlugins = 'nuggets'+item +',mediaembed'; // no spaces allowed!
|
||||
CKEDITOR.plugins.add('nuggets' + item, {
|
||||
init: function(editor) {
|
||||
if(typeof jsEventData !== 'undefined') {
|
||||
jsEventData.forEach( function(k, i) {
|
||||
var execcom = jsEventData[i].javascript;
|
||||
execcom = exefit(execcom);
|
||||
editor.addCommand( jsEventData[i].id, {
|
||||
exec: function( editor ) {
|
||||
eval(execcom);
|
||||
}
|
||||
});
|
||||
editor.ui.addButton(jsEventData[i].id, {
|
||||
label: jsEventData[i].name,
|
||||
title: jsEventData[i].name+' Plugin',
|
||||
icon: '<?php echo $serendipity['serendipityHTTPPath'] . 'plugins/'; ?>'+jsEventData[i].img_path,
|
||||
iconName: jsEventData[i].id+'_icon',
|
||||
command: jsEventData[i].id
|
||||
});
|
||||
});
|
||||
}
|
||||
editor.addCommand( 'openML', {
|
||||
exec : function( editor ) {
|
||||
window.open('serendipity_admin_image_selector.php', 'ImageSel', 'width=800,height=600,toolbar=no,scrollbars=1,scrollbars,resize=1,resizable=1');
|
||||
}
|
||||
});
|
||||
editor.ui.addButton('openML', {
|
||||
label: 'S9yMedia',
|
||||
title: 'Serendipity Media Library',
|
||||
icon: '<?php echo $serendipity['serendipityHTTPPath'] . 'plugins/serendipity_event_ckeditor/img/mls9y.png'; ?>',
|
||||
iconName: 'openML_icon',
|
||||
command: 'openML'
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<script language="javascript" type="text/javascript" src="<?php echo $serendipity['serendipityHTTPPath'] . $relpath; ?>ckeditor.js"></script>
|
||||
<script language="javascript" type="text/javascript" src="<?php echo $plgpath . 'serendipity_event_ckeditor/'; ?>cke_plugin.js"></script>
|
||||
<?php
|
||||
} // add to backend header end
|
||||
break;
|
||||
|
||||
|
||||
case 'css_backend': // do not use in 2.0 versions
|
||||
if( $serendipity['version'][0] == '1' ) {
|
||||
if ($serendipity['version'][0] == '1') {
|
||||
?>
|
||||
/* BACKEND MESSAGES
|
||||
----------------------------------------------------------------- */
|
||||
|
@ -421,19 +395,22 @@ class serendipity_event_ckeditor extends serendipity_event
|
|||
}
|
||||
break;
|
||||
|
||||
|
||||
case 'backend_plugins_update':
|
||||
if ($this->install() === true) {
|
||||
// make sure it really falls down to plugins config
|
||||
// make sure a spartacus update really falls down to plugins config, when an update deflating zip has returned true
|
||||
echo '<script type="text/javascript">location.href = \'' . $serendipity['baseURL'] . 'serendipity_admin.php?serendipity[adminModule]=plugins&serendipity[plugin_to_conf]=serendipity_event_ckeditor\';</script>';
|
||||
die();
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case 'backend_media_path_exclude_directories':
|
||||
$eventData[".thumbs"] = true;
|
||||
return true;
|
||||
break;
|
||||
|
||||
|
||||
case 'backend_wysiwyg':
|
||||
$eventData['skip'] = true; // this skips htmlarea drop-in
|
||||
|
||||
|
@ -442,56 +419,33 @@ class serendipity_event_ckeditor extends serendipity_event
|
|||
$this->event_hook('backend_wysiwyg_finish', $bag, $eventData);
|
||||
} else {
|
||||
// this builds both textareas of entry forms only
|
||||
if (isset($eventData['item']) && !empty($eventData['item'])) {
|
||||
?>
|
||||
|
||||
<script type="text/javascript">
|
||||
CKEDITOR.replace('<?php echo $eventData['item']; ?>', {});
|
||||
CKEDITOR.config.extraPlugins = 'entryforms<?php echo $eventData['jsname']; ?>,mediaembed'; // no spaces allowed!
|
||||
CKEDITOR.plugins.add('entryforms<?php echo $eventData['jsname']; ?>', {
|
||||
init: function(editor) {
|
||||
<?php
|
||||
if (isset($eventData) && (is_array($eventData['buttons']) && !empty($eventData['buttons']))) {
|
||||
foreach ($eventData['buttons'] as $button) {
|
||||
<script type="text/javascript">
|
||||
<?php
|
||||
if (isset($eventData['buttons']) && (is_array($eventData['buttons']) && !empty($eventData['buttons']))) {
|
||||
?>
|
||||
editor.addCommand( '<?php echo $button['id']; ?>', {
|
||||
exec: function( editor ) {
|
||||
<?php echo str_replace(array('function() { ',' }'), '', $button['javascript']); ?>;
|
||||
}
|
||||
});
|
||||
editor.ui.addButton('<?php echo $button['id']; ?>', {
|
||||
label: '<?php echo $button['name']; ?>',
|
||||
title: '<?php echo $button['name']; ?> Plugin',
|
||||
icon: '<?php echo $serendipity['serendipityHTTPPath'] . 'plugins/' . $button['img_path']; ?>',
|
||||
iconName: '<?php echo $button['id']; ?>_icon',
|
||||
command: '<?php echo $button['id']; ?>'
|
||||
});
|
||||
<?php
|
||||
} // close foreach - follow up ML button into 'other' toolbar needs no textarea GET name, since the right instance dropping is done by this plugin
|
||||
} // close isset $eventData
|
||||
if (window.Spawnnuggets) Spawnnuggets('<?php echo $eventData['item']; ?>', 'entryforms<?php echo $eventData['jsname']; ?>', <?php echo json_encode($eventData['buttons']); ?>);
|
||||
<?php
|
||||
} else {
|
||||
?>
|
||||
editor.addCommand( 'openML', {
|
||||
exec : function( editor ) {
|
||||
window.open('serendipity_admin_image_selector.php', 'ImageSel', 'width=800,height=600,toolbar=no,scrollbars=1,scrollbars,resize=1,resizable=1');
|
||||
}
|
||||
});
|
||||
editor.ui.addButton('openML', {
|
||||
label: 'S9yMedia',
|
||||
title: 'Serendipity Media Library',
|
||||
icon: '<?php echo $serendipity['serendipityHTTPPath'] . 'plugins/serendipity_event_ckeditor/img/mls9y.png'; ?>',
|
||||
iconName: 'openML_icon',
|
||||
command: 'openML'
|
||||
});
|
||||
}
|
||||
});
|
||||
</script>
|
||||
if (window.Spawnnuggets) Spawnnuggets('<?php echo $eventData['item']; ?>', 'entryforms<?php echo $eventData['jsname']; ?>', null);
|
||||
<?php
|
||||
}
|
||||
}
|
||||
?>
|
||||
</script>
|
||||
<?php
|
||||
}
|
||||
return true;
|
||||
break;
|
||||
|
||||
|
||||
case 'backend_wysiwyg_finish':
|
||||
// Run once only, save ressources
|
||||
// This should better move into a future 'backend_footer' hook, to not happen twice on multiple textareas, or has to get rewritten in serendipity_html_nugget_plugin textarea, since only needed there!
|
||||
// This should better move into a future(!) 'backend_footer' hook, to not happen for every of any multiple textareas!
|
||||
// but there $eventData['item'] isn't availabale yet...
|
||||
if (isset($eventData['item']) && !empty($eventData['item'])) {
|
||||
?>
|
||||
<script type="text/javascript">
|
||||
|
@ -503,29 +457,16 @@ class serendipity_event_ckeditor extends serendipity_event
|
|||
<?php
|
||||
}
|
||||
?>
|
||||
|
||||
// Avoid TypeError: parent.self.opener.serendipity_imageSelector_addToBody is not a function in serendipity_html_nugget_plugin textarea (nuggets3) in S9y 1.7 Series
|
||||
function serendipity_imageSelector_addToBody (str, textarea) {
|
||||
var oEditor = isinstance; // WHOW this was easy...!!!!
|
||||
//console.log(oEditor);
|
||||
if (oEditor.mode == "wysiwyg") {
|
||||
oEditor.insertHtml(str);
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<?php
|
||||
} // end isset $eventData['item']
|
||||
|
||||
// kcfinder has a fallback media library mode if not properly loaded, or an other error occurs - get rid of it by default, since it stops image browser executing!
|
||||
if( is_file(dirname(__FILE__) . '/kcfinder/.htaccess') ) {
|
||||
@unlink(dirname(__FILE__) . '/kcfinder/.htaccess');
|
||||
$this->empty_dir(dirname(__FILE__) . '/kcfinder/.thumbs');
|
||||
if (!is_dir(dirname(__FILE__) . '/kcfinder/.thumbs')) @rmdir(dirname(__FILE__) . '/kcfinder/.thumbs');
|
||||
}
|
||||
$this->checkFallback();
|
||||
|
||||
return true;
|
||||
break;
|
||||
|
||||
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue