You are here

function wysiwyg_jwysiwyg_version in Wysiwyg 7.2

Same name and namespace in other branches
  1. 5.2 editors/jwysiwyg.inc \wysiwyg_jwysiwyg_version()
  2. 5 editors/jwysiwyg.inc \wysiwyg_jwysiwyg_version()
  3. 6.2 editors/jwysiwyg.inc \wysiwyg_jwysiwyg_version()
  4. 6 editors/jwysiwyg.inc \wysiwyg_jwysiwyg_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_jwysiwyg_version'
wysiwyg_jwysiwyg_editor in editors/jwysiwyg.inc
Plugin implementation of hook_editor().

File

editors/jwysiwyg.inc, line 77
Editor integration functions for jWYSIWYG.

Code

function wysiwyg_jwysiwyg_version(&$editor) {
  $script = $editor['library path'] . '/jquery.wysiwyg.js';
  if (!file_exists($script)) {
    $script = $editor['library path'] . '/jwysiwyg/jquery.wysiwyg.js';
    if (!file_exists($script)) {
      return;
    }
    $editor['library path'] .= '/jwysiwyg';
    $editor['editor path'] .= '/jwysiwyg';
  }
  $script = fopen($script, 'r');
  fgets($script);
  $line = fgets($script);
  if (preg_match('@([0-9\\.]+)\\D*$@', $line, $version)) {
    fclose($script);
    return $version[1];
  }
  fclose($script);
}