You are here

function wysiwyg_tinymce_version in Wysiwyg 5

Same name and namespace in other branches
  1. 5.2 editors/tinymce.inc \wysiwyg_tinymce_version()
  2. 6.2 editors/tinymce.inc \wysiwyg_tinymce_version()
  3. 6 editors/tinymce.inc \wysiwyg_tinymce_version()
  4. 7.2 editors/tinymce.inc \wysiwyg_tinymce_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_tinymce_version'
wysiwyg_tinymce_editor in editors/tinymce.inc
Plugin implementation of hook_editor().

File

editors/tinymce.inc, line 78

Code

function wysiwyg_tinymce_version($editor) {
  $script = $editor['library path'] . '/tiny_mce.js';
  $script = fopen($script, 'r');

  // Version is contained in the first 80 chars.
  $line = fgets($script, 80);

  // 2.x: this.majorVersion="2";this.minorVersion="1.3"
  // 3.x: majorVersion:'3',minorVersion:'2.0.1'
  if (preg_match('@majorVersion[=:]["\'](\\d).+?minorVersion[=:]["\']([\\d\\.]+)@', $line, $version)) {
    fclose($script);
    return $version[1] . '.' . $version[2];
  }
}