summaryrefslogtreecommitdiff
path: root/kolab.org/www/drupal-7.18/sites/all/modules/ckeditor/ckeditor.module
diff options
context:
space:
mode:
Diffstat (limited to 'kolab.org/www/drupal-7.18/sites/all/modules/ckeditor/ckeditor.module')
-rw-r--r--kolab.org/www/drupal-7.18/sites/all/modules/ckeditor/ckeditor.module47
1 files changed, 40 insertions, 7 deletions
diff --git a/kolab.org/www/drupal-7.18/sites/all/modules/ckeditor/ckeditor.module b/kolab.org/www/drupal-7.18/sites/all/modules/ckeditor/ckeditor.module
index ab868ee..809b201 100644
--- a/kolab.org/www/drupal-7.18/sites/all/modules/ckeditor/ckeditor.module
+++ b/kolab.org/www/drupal-7.18/sites/all/modules/ckeditor/ckeditor.module
@@ -2,7 +2,7 @@
/**
* CKEditor - The text editor for the Internet - http://ckeditor.com
- * Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
+ * Copyright (c) 2003-2013, CKSource - Frederico Knabben. All rights reserved.
*
* == BEGIN LICENSE ==
*
@@ -299,7 +299,7 @@ function ckeditor_pre_render_text_format($element) {
/**
* Load all profiles. Just load one profile if $name is passed in.
*/
-function ckeditor_profile_load($name = '', $clear = FALSE) {
+function ckeditor_profile_load($name = '', $clear = FALSE, $check_access = TRUE) {
static $profiles = array();
global $user;
@@ -311,7 +311,12 @@ function ckeditor_profile_load($name = '', $clear = FALSE) {
$profiles[$data->name] = $data;
}
- $input_formats = filter_formats($user);
+ if ($check_access === FALSE) {
+ // don't check if user has access to filter formats, needed for exporting as feature with drush
+ $input_formats = filter_formats();
+ } else {
+ $input_formats = filter_formats($user);
+ }
$result = db_select('ckeditor_input_format', 'f')->fields('f')->execute();
foreach ($result as $data) {
if (isset($input_formats[$data->format])) {
@@ -361,14 +366,22 @@ function ckeditor_module_path($mode = 'relative') {
* Path of library in the Drupal installation.
*/
function ckeditor_library_path($mode = 'relative') {
+ $lib_path = 'sites/all/libraries';
+
+ if (function_exists('libraries_get_path')) {
+ $path = libraries_get_path('ckeditor');
+ if ($path !== FALSE) {
+ $lib_path = drupal_substr($path, 0, strlen($path) - 9);
+ }
+ }
switch ($mode) {
default:
case 'relative':
- return ckeditor_base_path('relative') . '/sites/all/libraries';
+ return ckeditor_base_path('relative') . '/' . $lib_path;
case 'local':
- return ckeditor_base_path('local') . '/sites/all/libraries';
+ return ckeditor_base_path('local') . '/' . $lib_path;
case 'url':
- return 'sites/all/libraries';
+ return $lib_path;
}
}
@@ -545,6 +558,7 @@ function ckeditor_features_api() {
return array(
'ckeditor_profile' => array(
'name' => t('CKEditor profiles'),
+ 'feature_source' => TRUE,
'default_hook' => 'ckeditor_profile_defaults',
'default_file' => FEATURES_DEFAULTS_INCLUDED,
'file' => drupal_get_path('module', 'ckeditor') . '/includes/ckeditor.features.inc',
@@ -603,6 +617,10 @@ function ckeditor_file_download($uri) {
*/
function ckeditor_modules_enabled($modules) {
module_load_include('inc', 'ckeditor', 'includes/ckeditor.lib');
+ if (in_array('libraries', $modules)) {
+ // Check and update path to CKEditor in the global profile
+ _ckeditor_requirements_isinstalled();
+ }
$profiles_list = ckeditor_profile_input_formats();
$plugins_list = ckeditor_load_plugins();
foreach ($profiles_list AS $_profile => $_inputs) {
@@ -638,6 +656,7 @@ function ckeditor_modules_disabled($modules) {
foreach ($profiles_list AS $_profile => $_inputs) {
$changed = FALSE;
$profile = ckeditor_profile_load($_profile);
+ if (!isset($profile->settings['loadPlugins'])) continue;
foreach (array_keys((array) $profile->settings['loadPlugins']) as $plugin_name) {
if (!array_key_exists($plugin_name, $plugins_list)) {
$profile->settings['loadPlugins'][$plugin_name]['active'] = 0;
@@ -667,6 +686,7 @@ function ckeditor_modules_uninstalled($modules) {
foreach ($profiles_list AS $_profile => $_inputs) {
$changed = FALSE;
$profile = ckeditor_profile_load($_profile);
+ if (!isset($profile->settings['loadPlugins'])) continue;
foreach (array_keys((array) $profile->settings['loadPlugins']) as $plugin_name) {
if (!array_key_exists($plugin_name, $plugins_list)) {
unset($profile->settings['loadPlugins'][$plugin_name]);
@@ -682,4 +702,17 @@ function ckeditor_modules_uninstalled($modules) {
->execute();
}
}
-} \ No newline at end of file
+}
+
+
+/**
+ * Implements hook_field_extra_fields().
+ */
+function ckeditor_field_extra_fields() {
+ $fields['user']['user']['form']['ckeditor'] = array(
+ 'label' => t('Rich text editor settings'),
+ 'description' => t('Rich text editor settings'),
+ 'weight' => 10,
+ );
+ return $fields;
+}