You are here

function wysiwyg_markitup_version in Wysiwyg 7.2

Same name and namespace in other branches
  1. 5.2 editors/markitup.inc \wysiwyg_markitup_version()
  2. 5 editors/markitup.inc \wysiwyg_markitup_version()
  3. 6.2 editors/markitup.inc \wysiwyg_markitup_version()
  4. 6 editors/markitup.inc \wysiwyg_markitup_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_markitup_version'
wysiwyg_markitup_editor in editors/markitup.inc
Plugin implementation of hook_editor().

File

editors/markitup.inc, line 59
Editor integration functions for markItUp.

Code

function wysiwyg_markitup_version($editor) {

  // Changelog was in markitup/markitup/readme.txt <= 1.1.5.
  $changelog = $editor['library path'] . '/markitup/readme.txt';
  if (!file_exists($changelog)) {

    // Changelog was moved up to markitup/CHANGELOG.md after 1.1.5.
    $changelog = $editor['library path'] . '/CHANGELOG.md';
    if (!file_exists($changelog)) {
      return;
    }
  }
  $changelog = fopen($changelog, 'r');
  $line = fgets($changelog);
  if (preg_match('@([0-9\\.]+)@', $line, $version)) {
    fclose($changelog);
    return $version[1];
  }
  fclose($changelog);
}