function fckeditor_load_toolbar_options in FCKeditor - WYSIWYG HTML editor 6
Same name and namespace in other branches
- 5.2 fckeditor.module \fckeditor_load_toolbar_options()
- 6.2 fckeditor.lib.inc \fckeditor_load_toolbar_options()
2 calls to fckeditor_load_toolbar_options()
- fckeditor_profile_form_build in ./
fckeditor.module - Return an HTML form for profile configuration.
- fckeditor_user in ./
fckeditor.module - Implementation of hook_user().
File
- ./
fckeditor.module, line 1387 - FCKeditor - The text editor for Internet - http://www.fckeditor.net Copyright (C) 2003-2008 Frederico Caldeira Knabben
Code
function fckeditor_load_toolbar_options() {
$arr = array();
$module_drupal_path = drupal_get_path('module', 'fckeditor');
$fckconfig_js = $module_drupal_path . '/fckeditor/fckconfig.js';
$fckeditor_config_js = $module_drupal_path . '/fckeditor.config.js';
if (file_exists($fckconfig_js) && is_readable($fckconfig_js)) {
$fp = @fopen($fckconfig_js, "r");
if ($fp) {
while (!feof($fp)) {
$line = fgets($fp, 1024);
if (preg_match("/FCKConfig\\.ToolbarSets\\[(\"|')(.*?)\\1\\]/i", $line, $matches)) {
$arr[$matches[2]] = ucfirst($matches[2]);
}
}
fclose($fp);
}
}
if (file_exists($fckeditor_config_js) && is_readable($fckeditor_config_js)) {
$fp = @fopen($fckeditor_config_js, "r");
if ($fp) {
while (!feof($fp)) {
$line = fgets($fp, 1024);
if (preg_match("/FCKConfig\\.ToolbarSets\\[(\"|')(.*?)\\1\\]/i", $line, $matches)) {
$arr[$matches[2]] = ucfirst($matches[2]);
}
}
fclose($fp);
}
}
//oops, we have no information about toolbars, let's use hardcoded array
if (empty($arr)) {
$arr = array(
'Basic' => 'Basic',
'Default' => 'Default',
);
}
asort($arr);
return $arr;
}