You are here

function wysiwyg_epiceditor_version in Wysiwyg 7.2

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_epiceditor_version'
wysiwyg_epiceditor_editor in editors/epiceditor.inc
Plugin implementation of hook_editor().

File

editors/epiceditor.inc, line 49
Editor integration functions for EpicEditor.

Code

function wysiwyg_epiceditor_version(&$editor) {
  $library = $editor['library path'] . '/js/epiceditor.js';
  if (!file_exists($library)) {
    $library = $editor['library path'] . '/epiceditor/js/epiceditor.js';
    if (!file_exists($library)) {
      return;
    }
    $editor['library path'] .= '/epiceditor';
    $editor['editor path'] .= '/epiceditor';
  }

  // @todo Do not load the entire file; use fgets() instead.
  $library = file_get_contents($library, 'r');
  preg_match('%EpicEditor\\.version = \'(.*)\'\\;%', $library, $matches);
  if (!isset($matches[1])) {
    return;
  }
  return $matches[1];
}