You are here

function wysiwyg_fckeditor_version in Wysiwyg 6.2

Same name and namespace in other branches
  1. 5.2 editors/fckeditor.inc \wysiwyg_fckeditor_version()
  2. 5 editors/fckeditor.inc \wysiwyg_fckeditor_version()
  3. 6 editors/fckeditor.inc \wysiwyg_fckeditor_version()
  4. 7.2 editors/fckeditor.inc \wysiwyg_fckeditor_version()

Detect editor version.

Parameters

$editor: An array containing editor properties as returned from hook_editor().

Return value

The installed editor version.

1 string reference to 'wysiwyg_fckeditor_version'
wysiwyg_fckeditor_editor in editors/fckeditor.inc
Plugin implementation of hook_editor().

File

editors/fckeditor.inc, line 55
Editor integration functions for FCKeditor.

Code

function wysiwyg_fckeditor_version($editor) {
  $library = $editor['library path'] . '/fckeditor.js';
  if (!file_exists($library)) {
    return;
  }
  $library = fopen($library, 'r');
  $max_lines = 100;
  while ($max_lines && ($line = fgets($library, 60))) {
    if (preg_match('@^FCKeditor.prototype.Version\\s*= \'([\\d\\.]+)@', $line, $version)) {
      fclose($library);
      return $version[1];
    }
    $max_lines--;
  }
  fclose($library);
}