file_create_path

Хочешь помочь с переводом? Это очень просто и быстро. Лишь зарегистрируйся, и можешь тут же начать переводить.

includes/file.inc, строка 63

Версии
5 – 6
file_create_path($dest = 0)

Make sure the destination is a complete path and resides in the file system directory, if it is not prepend the file system directory.

Параметры

$dest Строка, содержащая путь для проверки. Если это значение опущено, то путь к папке 'files' Друпал будет использован.

Возвращаемое значение

Строка, содержащая путь к файлу, с добавлением системной папки для файлов, если нужно. FALSE - если путь не верный (то есть находится вне настроенных папок 'files' или temp).

Связанные темы

▾ 15 функции вызывают file_create_path()

drupal_build_css_cache in includes/common.inc
Объединяет и оптимизирует файлы CSS, размещая конечный файл в файловой директории.
drupal_build_js_cache in includes/common.inc
Объединяет JS файлы, размещая конечный файл в файловой директории.
drupal_clear_css_cache in includes/common.inc
Удаляет все файлы кэша CSS.
drupal_clear_js_cache in includes/common.inc
Удаляет все файлы кэша JS.
file_copy in includes/file.inc
Копирует файл из одного места в другое. Эта мощная функция работает как расширенная версия функции copy(). Непосредственно перед копированием проверяет правильность $source и $dest и возможность чтения/записи. Копирование файла происходить только если $source и $dest не равны.
file_download in includes/file.inc
Call modules that implement hook_file_download() to find out if a file is accessible and what headers it should be transferred with. If a module returns -1 drupal_access_denied() will be returned. If one or more modules returned headers the download...
file_save_upload in includes/file.inc
Сохраняет загруженный файл в новое место. Исходный файл должен быть загружен и обработан.
file_transfer in includes/file.inc
Transfer file using http to client. Pipes a file through Drupal to the client.
hook_file_download in developer/hooks/core.php
Контролирует доступ к файлам при приватном способе загрузки. Кроме того, позволяет указывать HTTP заголовки для файлов.
locale_uninstall in modules/locale/locale.install
Реализация hook_uninstall().
locale_update_js_files in modules/locale/locale.module
Update JavaScript translation file, if required, and add it to the page.
upload_file_download in modules/upload/upload.module
Implementation of hook_file_download().
user_admin_settings in modules/user/user.admin.inc
Form builder; Configure user settings for this site. See alsosystem_settings_form()
user_file_download in modules/user/user.module
Implementation of hook_file_download().
_locale_rebuild_js in includes/locale.inc
Создает(заменяет) JavaScript-файл перевода для указанного языка.

Код

<?php
function file_create_path($dest = 0) {
  $file_path = file_directory_path();
  if (!$dest) {
    return $file_path;
  }
  // file_check_location() checks whether the destination is inside the Drupal files directory.
  if (file_check_location($dest, $file_path)) {
    return $dest;
  }
  // check if the destination is instead inside the Drupal temporary files directory.
  else if (file_check_location($dest, file_directory_temp())) {
    return $dest;
  }
  // Not found, try again with prefixed directory path.
  else if (file_check_location($file_path .'/'. $dest, $file_path)) {
    return $file_path .'/'. $dest;
  }
  // File not found.
  return FALSE;
}
?>
Войдите или зарегистрируйтесь, чтобы получить возможность отправлять комментарии

Вход в систему