You are here

function fckeditor_is_compatible_client in FCKeditor - WYSIWYG HTML editor 5

Same name and namespace in other branches
  1. 5.2 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

Check the user agent for a matching browser, using HTTP_USER_AGENT because the browsers that are known to support FCKeditor are limited

Opera and Safari are disabled because FCKeditor does not work reliably on those browsers yet

Return value

TRUE if the browser is reasonably capable

1 call to fckeditor_is_compatible_client()
fckeditor_elements in ./fckeditor.module
Implementation of textarea

File

./fckeditor.module, line 487
FCKeditor Module for Drupal 5.x

Code

function fckeditor_is_compatible_client() {
  $useragent = $_SERVER['HTTP_USER_AGENT'];
  if (strpos($useragent, 'MSIE') !== false && strpos($useragent, 'mac') === false && strpos($useragent, 'Opera') === false) {
    $browserversion = (double) substr($useragent, strpos($useragent, 'MSIE') + 5, 3);
    return $browserversion >= 5.5;
  }
  elseif (strpos($useragent, 'Gecko') !== false) {
    $browserversion = (int) substr($useragent, strpos($useragent, 'Gecko/') + 6, 8);
    return $browserversion >= 20030210;
  }
  else {
    return false;
  }
}