You are here

function ckeditor_admin_main in CKEditor - WYSIWYG HTML editor 7

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

Main administrative page

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

File

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

Code

function ckeditor_admin_main() {
  global $base_url;
  module_load_include('inc', 'ckeditor', 'includes/ckeditor.lib');
  $editor_path = ckeditor_path('local');
  $ckconfig_file = $editor_path . '/config.js';

  //check if CKEditor plugin is installed
  if ($editor_path != '<URL>' && !_ckeditor_requirements_isinstalled()) {
    drupal_set_message(t('Checking for !filename or !file.', array(
      '!filename' => '<code>' . $ckconfig_file . '</code>',
      '!file' => '<code>sites/all/libraries/ckeditor/ckeditor.js</code>',
    )));
    drupal_set_message(t('The CKEditor component is not installed correctly. Please go to the !ckeditorlink in order to download the latest version. After that you must extract the files to the !ckeditorpath or !librarypath directory and make sure that the !ckeditorfile or !ckeditorlibrary file exists. Refer to the !readme file for more information.', array(
      '!ckeditorlink' => l(t('CKEditor homepage'), 'http://ckeditor.com/download'),
      '!readme' => l(t('README.txt'), $base_url . '/' . drupal_get_path('module', 'ckeditor') . '/README.txt', array(
        'absolute' => TRUE,
      )),
      '!ckeditorpath' => '<code>sites/all/modules/ckeditor/ckeditor</code>',
      '!ckeditorfile' => '<code>sites/all/modules/ckeditor/ckeditor/ckeditor.js</code>',
      '!ckeditorlibrary' => '<code>sites/all/libraries/ckeditor/ckeditor.js</code>',
      '!librarypath' => '<code>sites/all/libraries/ckeditor</code>',
    )), 'error');
    drupal_set_message(t('If you have CKEditor already installed, edit the <strong>!editg</strong> and update the CKEditor path.', array(
      '!editg' => l(t('CKEditor Global Profile'), 'admin/config/content/ckeditor/editg'),
    )), 'warning');
    return '';
  }
  if (module_exists('wysiwyg')) {
    drupal_set_message(t('The WYSIWYG module was detected. Using both modules at the same time may cause problems. It is recommended to turn the WYSIWYG module off (!wysiwygdisablelink).', array(
      '!wysiwygdisablelink' => l(t('click here to disable'), 'ckeditor/disable/wysiwyg/' . drupal_get_token('ckeditorDisableWysiwyg')),
    )), 'warning');
  }

  //find profile other than Global
  $result = db_select('ckeditor_settings', 's')
    ->fields('s', array(
    'name',
  ))
    ->condition('name', 'CKEditor Global Profile', '<>')
    ->range(0, 1)
    ->execute()
    ->fetchAssoc();
  if (!$result) {
    drupal_set_message(t('No CKEditor profiles found. Right now nobody is able to use CKEditor. Create a new profile below.'), 'error');
  }
  return ckeditor_profile_overview();
}