You are here

function wysiwyg_whizzywig_version in Wysiwyg 7.2

Same name and namespace in other branches
  1. 5.2 editors/whizzywig.inc \wysiwyg_whizzywig_version()
  2. 5 editors/whizzywig.inc \wysiwyg_whizzywig_version()
  3. 6.2 editors/whizzywig.inc \wysiwyg_whizzywig_version()
  4. 6 editors/whizzywig.inc \wysiwyg_whizzywig_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_whizzywig_version'
wysiwyg_whizzywig_editor in editors/whizzywig.inc
Plugin implementation of hook_editor().

File

editors/whizzywig.inc, line 57
Editor integration functions for Whizzywig.

Code

function wysiwyg_whizzywig_version($editor) {
  $script = $editor['library path'] . '/whizzywig.js';
  if (!file_exists($script)) {
    return;
  }
  $script = fopen($script, 'r');
  $line = fgets($script, 43);

  // 55: Whizzywig v55i
  // 60: Whizzywig 60
  if (preg_match('@Whizzywig v?([0-9]+)@', $line, $version)) {
    fclose($script);
    return $version[1];
  }
  fclose($script);
}