You are here

function ueditor_version in UEditor - 百度编辑器 7

Same name and namespace in other branches
  1. 7.3 editors/ueditor.inc \ueditor_version()
  2. 7.2 editors/ueditor.inc \ueditor_version()

Detect editor version.

Parameters

array $editor: An array containing editor properties as returned from hook_editor().

Return value

int The installed editor version.

1 string reference to 'ueditor_version'
ueditor_ueditor_editor in editors/ueditor.inc
Plugin implementation of hook_editor().

File

editors/ueditor.inc, line 43
Editor integration functions for ueditor.

Code

function ueditor_version($editor) {
  $script = $editor['library path'] . '/ueditor.all.js';
  if (!file_exists($script)) {
    return;
  }
  $script = fopen($script, 'r');
  $max_lines = 50;
  while ($max_lines && ($line = fgets($script, 500))) {
    if (preg_match('/^UE.*?"([\\d\\.]+)"/', $line, $version)) {
      fclose($script);
      return $version[1];
    }
    $max_lines--;
  }
  fclose($script);
}