Added unofficial backwards compatibility with FCKeditor 2.5.1-2.6
authorWiktor Walc
Wed, 17 Dec 2008 09:35:31 +0000 (09:35 +0000)
committerWiktor Walc
Wed, 17 Dec 2008 09:35:31 +0000 (09:35 +0000)
fckeditor.module

index ee3d792..b8b695d 100644 (file)
@@ -2109,18 +2109,26 @@ function fckeditor_idsearch($search, $array) {
  *   TRUE if the browser is reasonably capable
  */
 function fckeditor_is_compatible_client() {
-
-  if (!function_exists('version_compare') || version_compare(phpversion(), '5', '<'))
-    $fckeditor_main_file  = drupal_get_path('module', 'fckeditor') .'/fckeditor/fckeditor_php4.php';
-  else
-    $fckeditor_main_file  = drupal_get_path('module', 'fckeditor') .'/fckeditor/fckeditor_php5.php';
-
-  if (file_exists($fckeditor_main_file)) {
-    include_once $fckeditor_main_file;
+  $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();
     }