You are here

function fckeditor_is_compatible_client in FCKeditor - WYSIWYG HTML editor 5.2

Same name and namespace in other branches
  1. 5 fckeditor.module \fckeditor_is_compatible_client()
  2. 6.2 fckeditor.module \fckeditor_is_compatible_client()
  3. 6 fckeditor.module \fckeditor_is_compatible_client()

Test if client can render the FCKeditor Use built-in test method in fckeditor.php If fckeditor.php is not found, return false (probably in such case fckeditor is not installed correctly)

Return value

TRUE if the browser is reasonably capable

2 calls to fckeditor_is_compatible_client()
fckeditor_elements in ./fckeditor.module
Implementation of textarea Replace textarea with FCKeditor using callback function (fckeditor_process_textarea)
fckeditor_form_alter in ./fckeditor.module
Drupal 5 does not properly support #after_build in hook_elements().

File

./fckeditor.module, line 2164
FCKeditor - The text editor for Internet - http://www.fckeditor.net Copyright (C) 2003-2007 Frederico Caldeira Knabben

Code

function fckeditor_is_compatible_client() {
  $fckeditor_main_file = drupal_get_path('module', 'fckeditor') . '/fckeditor/fckeditor.php';
  if (!function_exists('version_compare') || version_compare(phpversion(), '5', '<')) {
    $fckeditor_target_file = drupal_get_path('module', 'fckeditor') . '/fckeditor/fckeditor_php4.php';
  }
  else {
    $fckeditor_target_file = drupal_get_path('module', 'fckeditor') . '/fckeditor/fckeditor_php5.php';
  }
  if (file_exists($fckeditor_target_file)) {
    include_once $fckeditor_target_file;

    //FCKeditor 2.6.1+
    if (function_exists('FCKeditor_IsCompatibleBrowser')) {
      return FCKeditor_IsCompatibleBrowser();
    }
    else {
      if (class_exists('FCKeditor')) {

        //FCKeditor 2.5.1 - 2.6 with definition of FCKeditor_IsCompatibleBrowser() in fckeditor.php
        if (filesize($fckeditor_main_file) > 1500) {
          include_once $fckeditor_main_file;
        }

        //FCKeditor 2.5 and earlier
        $fck = new FCKeditor('fake');
        return $fck
          ->IsCompatible();
      }
    }
  }
  return FALSE;
}