/usr/share/php/Horde/Editor/Ckeditor.php is in php-horde-editor 2.0.4+debian0-3build1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 | <?php
/**
* Copyright 2009-2014 Horde LLC (http://www.horde.org/)
*
* See the enclosed file COPYING for license information (LGPL). If you
* did not receive this file, see http://www.horde.org/licenses/lgpl21.
*
* @category Horde
* @copyright 2009-2014 Horde LLC
* @license http://www.horde.org/licenses/lgpl21 LGPL-2.1
* @package Editor
*/
/**
* This driver provides the code needed to initialize the CKeditor javascript
* WYSIWYG editor.
*
* @author Michael Slusarz <slusarz@horde.org>
* @category Horde
* @copyright 2009-2014 Horde LLC
* @license http://www.horde.org/licenses/lgpl21 LGPL-2.1
* @package Editor
*/
class Horde_Editor_Ckeditor extends Horde_Editor
{
/**
* @param array $params The following configuration parameters:
* - basic: (boolean) Load "basic" editor (a small javascript stub that
* will download the full code on demand)?
* - config: (mixed) If an array, the javascript config hash used to
* indiciate the config for this editor instance. If a string,
* will be used directly as the javascript config name to use
* when loading (must exist elsewhere in page).
* - id: (string) The ID of the text area to turn into an editor. If
* empty, won't automatically load the editor.
*/
public function initialize(array $params = array())
{
if (!$this->supportedByBrowser()) {
return;
}
$ck_file = empty($params['basic'])
? 'ckeditor/ckeditor.js'
: 'ckeditor/ckeditor_basic.js';
if (isset($params['config'])) {
if (is_array($params['config'])) {
/* Globally disable spell check as you type. */
$params['config']['scayt_autoStartup'] = false;
$params['config'] = Horde_Serialize::serialize($params['config'], Horde_Serialize::JSON);
}
} else {
$params['config'] = array();
}
$this->_js = array(
'files' => array(
$ck_file
),
'script' => array()
);
if (isset($params['id'])) {
$this->_js['script'] = array(
'CKEDITOR.replace("' . $params['id'] . '",' . $params['config'] . ')'
);
}
}
/**
* Does the current browser support this driver.
*
* @return boolean True if the browser supports the editor.
*/
public function supportedByBrowser()
{
if (!$this->_browser) {
return true;
}
switch ($this->_browser->getBrowser()) {
case 'webkit':
case 'msie':
case 'mozilla':
case 'opera':
// MSIE: 5.5+
// Firefox: 1.5+
// Opera: 9.5+
// Safari: 3.0+
return $this->_browser->hasFeature('rte');
default:
return false;
}
}
}
|