function ckeditor_plugins_path in CKEditor - WYSIWYG HTML editor 7
Same name and namespace in other branches
- 6 ckeditor.module \ckeditor_plugins_path()
Read the CKEditor plugins path from the Global profile.
Return value
Path to CKEditor plugins folder.
3 calls to ckeditor_plugins_path()
- ckeditor_admin_global_profile_form in includes/
ckeditor.admin.inc - Form builder for a global profile
- ckeditor_ckeditor_plugin in ./
ckeditor.ckeditor.inc - Implements hook_ckeditor_plugin().
- ckeditor_plugins_render in includes/
ckeditor.lib.inc - Render CKEditor plugins path
File
- ./
ckeditor.module, line 493 - CKEditor - The text editor for the Internet - http://ckeditor.com Copyright (c) 2003-2013, CKSource - Frederico Knabben. All rights reserved.
Code
function ckeditor_plugins_path($mode = 'relative', $refresh = FALSE) {
static $cke_static;
if (!isset($cke_static)) {
$cke_static = array();
}
if ($refresh || !isset($cke_static[$mode])) {
$global_profile = ckeditor_profile_load('CKEditor Global Profile', $refresh);
switch ($mode) {
default:
case 'relative':
if ($global_profile && isset($global_profile->settings['ckeditor_plugins_path'])) {
$cke_plugins_path = $global_profile->settings['ckeditor_plugins_path'];
$cke_plugins_path = strtr($cke_plugins_path, array(
"%b" => ckeditor_base_path('relative'),
"%m" => ckeditor_module_path('relative'),
"%l" => ckeditor_library_path('relative'),
));
$cke_plugins_path = str_replace('\\', '/', $cke_plugins_path);
$cke_plugins_path = str_replace('//', '/', $cke_plugins_path);
$cke_plugins_path = rtrim($cke_plugins_path, ' \\/');
return $cke_static[$mode] = $cke_plugins_path;
}
return $cke_static[$mode] = ckeditor_module_path('relative') . '/plugins';
case 'local':
if ($global_profile) {
if (!empty($global_profile->settings['ckeditor_plugins_local_path'])) {
return $cke_static[$mode] = $global_profile->settings['ckeditor_plugins_local_path'];
}
if (isset($global_profile->settings['ckeditor_plugins_path'])) {
$cke_plugins_local_path = $global_profile->settings['ckeditor_plugins_path'];
$cke_plugins_local_path = strtr($cke_plugins_local_path, array(
"%b" => ckeditor_base_path('local'),
"%m" => ckeditor_module_path('local'),
"%l" => ckeditor_library_path('local'),
));
return $cke_static[$mode] = $cke_plugins_local_path;
}
}
return $cke_static[$mode] = ckeditor_module_path('local') . '/plugins';
case 'url':
if ($global_profile && isset($global_profile->settings['ckeditor_plugins_path'])) {
$cke_plugins_path = $global_profile->settings['ckeditor_plugins_path'];
$cke_plugins_path = strtr($cke_plugins_path, array(
"%m" => ckeditor_module_path('url'),
"%l" => ckeditor_library_path('url'),
));
$cke_plugins_path = str_replace('\\', '/', $cke_plugins_path);
$cke_plugins_path = str_replace('//', '/', $cke_plugins_path);
$cke_plugins_path = rtrim($cke_plugins_path, ' \\/');
//In D7 base path in URL mode is not needed, so we need to remove it with trailing slash (if exists)
$cke_plugins_path = str_replace(array(
"%b/",
"%b",
), '', $cke_plugins_path);
return $cke_static[$mode] = $cke_plugins_path;
}
return $cke_static[$mode] = ckeditor_module_path('url') . '/plugins';
}
}
return $cke_static[$mode];
}