You are here

function fckeditor_is_compatible_client in FCKeditor - WYSIWYG HTML editor 6

Same name and namespace in other branches
  1. 5.2 fckeditor.module \fckeditor_is_compatible_client()
  2. 5 fckeditor.module \fckeditor_is_compatible_client()
  3. 6.2 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

1 call to fckeditor_is_compatible_client()
fckeditor_elements in ./fckeditor.module
Implementation of textarea Replace textarea with FCKeditor using callback function (fckeditor_process_textarea)

File

./fckeditor.module, line 2242
FCKeditor - The text editor for Internet - http://www.fckeditor.net Copyright (C) 2003-2008 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();
    }
    elseif (class_exists('FCKeditor')) {

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

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