You are here

function _ckeditor_requirements_getinstalledversion in CKEditor - WYSIWYG HTML editor 6

Same name and namespace in other branches
  1. 7 ckeditor.install \_ckeditor_requirements_getinstalledversion()

Fetches the version of the installed CKEditor sources.

It tries to locate the version of the CKEditor sources in ckeditor.js.

Releases have a version number such as "3.0.1". SVN nightly releases have a minor version number with SVN appended: "3.0 SVN". SVN checkouts have the string "[Development]".

This function is used by ckeditor_requirements().

Return value

string Version number (eg. 3.0) of CKEditor. Null if not found in ckeditor_basic.js.

1 call to _ckeditor_requirements_getinstalledversion()
ckeditor_requirements in ./ckeditor.install
Implementation of hook_requirements().

File

./ckeditor.install, line 361

Code

function _ckeditor_requirements_getinstalledversion() {
  module_load_include('module', 'ckeditor');
  $editor_path = ckeditor_path(TRUE, TRUE);
  $jspath = $editor_path . '/ckeditor.js';
  $configcontents = @file_get_contents($jspath);
  if (!$configcontents) {
    return NULL;
  }
  $matches = array();
  if (preg_match('#,version:[\'\\"]{1}(.*?)[\'\\"]{1},#', $configcontents, $matches)) {
    return $matches[1];
  }
  return NULL;
}