You are here

function ckeditor_profile_load in CKEditor - WYSIWYG HTML editor 7

Same name and namespace in other branches
  1. 6 ckeditor.module \ckeditor_profile_load()

Load all profiles. Just load one profile if $name is passed in.

17 calls to ckeditor_profile_load()
ckeditor_admin_global_profile_form in includes/ckeditor.admin.inc
Form builder for a global profile
ckeditor_admin_profile_form in includes/ckeditor.admin.inc
Form builder for a profile
ckeditor_admin_profile_form_validate in includes/ckeditor.admin.inc
Form validation for a profile.
ckeditor_file_download in ./ckeditor.module
Implementation of hook_file_download(). Support for private downloads. CKEditor does not implement any kind of potection on private files.
ckeditor_get_profile in includes/ckeditor.lib.inc
Return CKEditor profile by input format

... See full list

File

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

Code

function ckeditor_profile_load($name = '', $clear = FALSE, $check_access = TRUE) {
  static $profiles = array();
  global $user;
  if (empty($profiles) || $clear === TRUE) {
    $result = db_select('ckeditor_settings', 's')
      ->fields('s')
      ->execute();
    foreach ($result as $data) {
      $data->settings = unserialize($data->settings);
      $data->input_formats = array();
      $profiles[$data->name] = $data;
    }
    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])) {
        $profiles[$data->name]->input_formats[$data->format] = $input_formats[$data->format]->name;
      }
    }
  }
  return $name ? isset($profiles[urldecode($name)]) ? $profiles[urldecode($name)] : FALSE : $profiles;
}