function wysiwyg_ckeditor_version in Wysiwyg 5.2
Same name and namespace in other branches
- 6.2 editors/ckeditor.inc \wysiwyg_ckeditor_version()
- 7.2 editors/ckeditor.inc \wysiwyg_ckeditor_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_ckeditor_version'
- wysiwyg_ckeditor_editor in editors/
ckeditor.inc - Plugin implementation of hook_editor().
File
- editors/
ckeditor.inc, line 68 - Editor integration functions for CKEditor.
Code
function wysiwyg_ckeditor_version($editor) {
$library = $editor['library path'] . '/ckeditor.js';
if (!file_exists($library)) {
return;
}
$library = fopen($library, 'r');
$max_lines = 8;
while ($max_lines && ($line = fgets($library, 500))) {
// version:'CKEditor 3.0 SVN',revision:'3665'
// version:'3.0 RC',revision:'3753'
// version:'3.0.1',revision:'4391'
if (preg_match('@version:\'(?:CKEditor )?([\\d\\.]+)(?:.+revision:\'([\\d]+))?@', $line, $version)) {
fclose($library);
// Version numbers need to have three parts since 3.0.1.
$version[1] = preg_replace('/^(\\d+)\\.(\\d+)$/', '${1}.${2}.0', $version[1]);
return $version[1] . '.' . $version[2];
}
$max_lines--;
}
fclose($library);
}