function fckeditor_path in FCKeditor - WYSIWYG HTML editor 6.2
Read FCKeditor path from Global profile
Return value
path to FCKeditor folder
12 calls to fckeditor_path()
- fckeditor_admin_global_profile_form in ./
fckeditor.admin.inc - fckeditor_admin_main in ./
fckeditor.admin.inc - Main administrative page
- fckeditor_admin_profile_form in ./
fckeditor.admin.inc - Form builder for a normal profile
- fckeditor_is_compatible_client in ./
fckeditor.module - Test if client can render the FCKeditor Use built-in test method in fckeditor.php If fckeditor.php is not found, return false (probably in such case fckeditor is not installed correctly)
- fckeditor_load_lang_options in ./
fckeditor.lib.inc
File
- ./
fckeditor.module, line 1049 - FCKeditor - The text editor for Internet - http://www.fckeditor.net Copyright (C) 2003-2008 Frederico Caldeira Knabben
Code
function fckeditor_path($local = FALSE) {
static $fck_path;
static $fck_local_path;
if (!$fck_path) {
$mod_path = drupal_get_path('module', 'fckeditor');
$global_profile = fckeditor_profile_load('FCKeditor Global Profile');
//default: path to fckeditor subdirectory in the fckeditor module directory (starting from the document root)
//e.g. for http://example.com/drupal it will be /drupal/sites/all/modules/fckeditor/fckeditor
$fck_path = base_path() . $mod_path . '/fckeditor';
//default: path to fckeditor subdirectory in the fckeditor module directory (relative to index.php)
//e.g.: sites/all/modules/fckeditor/fckeditor
$fck_local_path = $mod_path . '/fckeditor';
if ($global_profile) {
$gs = $global_profile->settings;
if (isset($gs['fckeditor_path'])) {
$tmp_path = $gs['fckeditor_path'];
$tmp_path = strtr($tmp_path, array(
"%b" => base_path(),
"%m" => base_path() . $mod_path,
));
$tmp_path = str_replace('\\', '/', $tmp_path);
$tmp_path = str_replace('//', '/', $tmp_path);
$tmp_path = rtrim($tmp_path, ' \\/');
if (substr($tmp_path, 0, 1) != '/') {
$tmp_path = '/' . $tmp_path;
//starts with '/'
}
$fck_path = $tmp_path;
if (empty($gs['fckeditor_local_path'])) {
//fortunately wildcards are used, we can easily get the right server path
if (false !== strpos($gs['fckeditor_path'], "%m")) {
$gs['fckeditor_local_path'] = strtr($gs['fckeditor_path'], array(
"%m" => $mod_path,
));
}
if (false !== strpos($gs['fckeditor_path'], "%b")) {
$gs['fckeditor_local_path'] = strtr($gs['fckeditor_path'], array(
"%b" => ".",
));
}
}
}
//fckeditor_path is defined, but wildcards are not used, we need to try to find out where is
//the document root located and append fckeditor_path to it.
if (!empty($gs['fckeditor_local_path'])) {
$fck_local_path = $gs['fckeditor_local_path'];
}
elseif (!empty($gs['fckeditor_path'])) {
module_load_include('lib.inc', 'fckeditor');
$local_path = fckeditor_resolve_url($gs['fckeditor_path'] . "/");
if (FALSE !== $local_path) {
$fck_local_path = $local_path;
}
}
}
}
if ($local) {
return $fck_local_path;
}
else {
return $fck_path;
}
}