You are here

function ckeditor_get_settings in CKEditor - WYSIWYG HTML editor 6

1 string reference to 'ckeditor_get_settings'
ckeditor_menu in ./ckeditor.module
Implementation of hook_menu().

File

./ckeditor.module, line 1455
CKEditor - The text editor for the Internet - http://ckeditor.com Copyright (c) 2003-2013, CKSource - Frederico Knabben. All rights reserved.

Code

function ckeditor_get_settings() {
  global $user;
  module_load_include('inc', 'ckeditor', 'includes/ckeditor.lib');
  if (empty($_POST['id']) || !isset($_POST['token']) || !drupal_valid_token($_POST['token'], 'ckeditorAjaxCall')) {
    echo json_encode(array());
    die;
  }
  unset($_SESSION['cke_get_settings']);
  $enabled = FALSE;
  $global_profile = ckeditor_profile_load('CKEditor Global Profile');
  if ($global_profile) {
    $global_conf = $global_profile->settings;
    if ($global_conf) {
      $enabled = ckeditor_is_enabled(empty($global_conf['excl_mode']) ? '0' : $global_conf['excl_mode'], empty($global_conf['excl_regex']) ? '' : $global_conf['excl_regex'], $_POST['id'], $_POST['url']);
    }
  }
  if ($enabled) {
    $profile = ckeditor_user_get_profile($user, $_POST['#id']);
    if ($profile) {
      $conf = array();
      $conf = $profile->settings;
      $enabled = ckeditor_is_enabled(empty($conf['excl_mode']) ? '0' : $conf['excl_mode'], empty($conf['excl_regex']) ? '' : $conf['excl_regex'], $_POST['id'], $_POST['url']);
    }
    else {
      $enabled = FALSE;
    }
  }
  if (!$enabled) {
    echo json_encode(array());
    die;
  }
  $element = ckeditor_process_textarea(array(
    '#id' => $_POST['id'],
  ));
  if (empty($_SESSION['cke_get_settings'][$_POST['id']])) {
    echo json_encode(array());
  }
  echo json_encode($_SESSION['cke_get_settings'][$_POST['id']]);
  die;
}