You are here

function wysiwyg_yui_version in Wysiwyg 6.2

Same name and namespace in other branches
  1. 5.2 editors/yui.inc \wysiwyg_yui_version()
  2. 5 editors/yui.inc \wysiwyg_yui_version()
  3. 6 editors/yui.inc \wysiwyg_yui_version()
  4. 7.2 editors/yui.inc \wysiwyg_yui_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_yui_version'
wysiwyg_yui_editor in editors/yui.inc
Plugin implementation of hook_editor().

File

editors/yui.inc, line 87
Editor integration functions for YUI editor.

Code

function wysiwyg_yui_version($editor) {
  $library = $editor['library path'] . '/editor/editor.js';
  if (!file_exists($library)) {
    return;
  }
  $library = fopen($library, 'r');
  $max_lines = 10;
  while ($max_lines && ($line = fgets($library, 60))) {
    if (preg_match('@version:\\s([0-9\\.]+)@', $line, $version)) {
      fclose($library);
      return $version[1];
    }
    $max_lines--;
  }
  fclose($library);
}