You are here

function ckfinder_path in CKEditor - WYSIWYG HTML editor 6

Same name and namespace in other branches
  1. 7 ckeditor.module \ckfinder_path()

Read the CKFinder path from the Global profile.

Return value

Path to CKFinder folder.

4 calls to ckfinder_path()
ckeditor_admin_global_profile_form in includes/ckeditor.admin.inc
ckeditor_perm in ./ckeditor.module
Implementation of hook_perm(). Administer -> User management -> Permissions
ckeditor_process_textarea in ./ckeditor.module
This function creates the HTML objects required for CKEditor.
_ckeditor_requirements_ckfinder_config_check in ./ckeditor.install
Executed when the built-in file browser is enabled. Returns FALSE if no errors are found in the config.php file, otherwise it returns an error message.

File

./ckeditor.module, line 1351
CKEditor - The text editor for the Internet - http://ckeditor.com Copyright (c) 2003-2013, CKSource - Frederico Knabben. All rights reserved.

Code

function ckfinder_path($refresh = FALSE) {
  static $ckf_path;
  if ($refresh || !$ckf_path) {
    $mod_path = drupal_get_path('module', 'ckeditor');
    $lib_path = 'sites/all/libraries';
    $global_profile = ckeditor_profile_load('CKEditor Global Profile', $refresh);

    //default: path to ckeditor subdirectory in the ckeditor module directory (starting from the document root)

    //e.g. for http://example.com/drupal it will be /drupal/sites/all/modules/ckeditor/ckeditor
    $ckf_path = $mod_path . '/ckfinder';
    if ($global_profile) {
      $gs = $global_profile->settings;
      if (isset($gs['ckfinder_path'])) {
        $tmp_path = $gs['ckfinder_path'];
        $tmp_path = strtr($tmp_path, array(
          "%b" => base_path(),
          "%m" => $mod_path,
          "%l" => $lib_path,
        ));
        $tmp_path = str_replace('\\', '/', $tmp_path);
        $tmp_path = str_replace('//', '/', $tmp_path);
        $ckf_path = $tmp_path;
      }
    }
  }
  return $ckf_path;
}