You are here

function _ckeditor_requirements_isinstalled in CKEditor - WYSIWYG HTML editor 7

Same name and namespace in other branches
  1. 6 includes/ckeditor.lib.inc \_ckeditor_requirements_isinstalled()

Determines whether the CKEditor sources are present

It checks if ckeditor.js is present.

This function is used by ckeditor_requirements()

Return value

boolean True if CKEditor is installed

2 calls to _ckeditor_requirements_isinstalled()
ckeditor_admin_main in includes/ckeditor.admin.inc
Main administrative page
ckeditor_requirements in ./ckeditor.install
Implementation of hook_requirements().

File

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

Code

function _ckeditor_requirements_isinstalled() {
  $editor_path = ckeditor_path('local');
  if ($editor_path == '<URL>') {
    return TRUE;
  }
  $jspath = $editor_path . '/ckeditor.js';
  $jsp = file_exists($jspath);
  if (!$jsp && ($editor_path = _ckeditor_script_path())) {
    $result = db_select('ckeditor_settings', 's')
      ->fields('s')
      ->condition('name', 'CKEditor Global Profile')
      ->execute()
      ->fetchAssoc();
    if ($result) {
      $result['settings'] = unserialize($result['settings']);
      $result['settings']['ckeditor_path'] = $editor_path;
      $result['settings'] = serialize($result['settings']);
      db_update('ckeditor_settings')
        ->fields(array(
        "settings" => $result['settings'],
      ))
        ->condition('name', 'CKEditor Global Profile')
        ->execute();
      $jsp = TRUE;
      ckeditor_path('local', TRUE);
    }
  }
  return $jsp;
}