Хочешь помочь с переводом? Это очень просто и быстро. Лишь зарегистрируйся, и можешь тут же начать переводить.
includes/common.inc, строка 1377
- 5
url($path = NULL, $query = NULL, $fragment = NULL, $absolute = FALSE)
- 6
url($path = NULL, $options = array())
Генерирует URL из указанного пути меню. Также поддерживает уже существующие URL.
Для создания ссылок в модулях лучше вместо url() использовать функцию l().
Параметры
$path
Путь меню, на который будет указывать URL, например 'admin/content/node', или уже существующий URL, например 'http://drupal.org/'. Специальный путь '<front>' может быть использован для получения адреса на заглавную страницу сайта.
$options
Ассоциативный массив дополнительных параметров со следующими ключами:
'query'
Строка запроса, присоединяемая к адресу или ассоциативный массив вида 'имя_параметра' => 'значение'.
'fragment'
Идентификатор фрагмента (или именованный якорь), присоединяемый к адресу. Не добавляйте символ '#'.
'absolute' (по умолчанию FALSE)
Определяет, будет ли полученый URL абсолютным (т.е. начанаться с 'http:'). Это полезно для ссылок, которые будут показываться в материалах вне сайта, например, при генерации ленты RSS.
'alias' (по умолчанию FALSE)
Определяет, является ли уже указанный путь псевдонимом или нет.
'external'
Определяет, является ли указанный путь внешним.
'language'
Языковой объект, определяющий к какой языковой версии документа требуется сформировать URL.
'base_url'
Только для внутренних адресов: задает базовый URL, если этого требуют языковые настройки сайта.
'prefix'
Только для внутренних адресов: задает префикс пути, если этого требуют языковые настройки сайта.
Возвращаемое значение
Строка, содержащая URL для заданного пути.
Generate a URL from a Drupal menu path. Will also pass-through existing URLs.
When creating links in modules, consider whether l() could be a better
alternative than url().
Parameters
$path
The Drupal path being linked to, such as "admin/content/node", or an
existing URL like "http://drupal.org/". The special path
'<front>' may also be given and will generate the site's base URL.
$options
An associative array of additional options, with the following keys:
- 'query'
A query string to append to the link, or an array of query key/value
properties.
- 'fragment'
A fragment identifier (or named anchor) to append to the link.
Do not include the '#' character.
- 'absolute' (default FALSE)
Whether to force the output to be an absolute link (beginning with
http:). Useful for links that will be displayed outside the site, such
as in an RSS feed.
- 'alias' (default FALSE)
Whether the given path is an alias already.
- 'external'
Whether the given path is an external URL.
- 'language'
An optional language object. Used to build the URL to link to and
look up the proper alias for the link.
- 'base_url'
Only used internally, to modify the base URL when a language dependent
URL requires so.
- 'prefix'
Only used internally, to modify the path when a language dependent URL
requires so.
Return value
A string containing a URL to the given path.
▸ 138 функции вызывают url()
▾ 138 функции вызывают url()
- aggregator_admin_settings in modules/aggregator/aggregator.admin.inc
- Конструктор формы; настройка агрегатора.
- aggregator_block in modules/aggregator/aggregator.module
- Реализация hook_block().
- aggregator_form_feed in modules/aggregator/aggregator.admin.inc
- Конструктор формы; генерирует форму добавления/редактирования источников фида.
- aggregator_help in modules/aggregator/aggregator.module
- Реализация hook_help().
- aggregator_page_categories in modules/aggregator/aggregator.pages.inc
- Коллбэк меню; показывает все категории, используемые аггрегатором.
- aggregator_page_category in modules/aggregator/aggregator.pages.inc
- Menu callback; displays all the items aggregated in a particular category.
- aggregator_page_last in modules/aggregator/aggregator.pages.inc
- Menu callback; displays the most recent items gathered from any feed.
- aggregator_page_sources in modules/aggregator/aggregator.pages.inc
- Коллбэк меню; показывает все фиды, используемые аггрегатором.
- batch_process in includes/form.inc
- Process the batch.
- block_admin_display_form in modules/block/block.admin.inc
- Generate main blocks administration form.
- block_box_form in modules/block/block.module
- Определяет пользовательскую блоковую форму.
- block_help in modules/block/block.module
- Реализация hook_help().
- blogapi_blogger_get_users_blogs in modules/blogapi/blogapi.module
- blogapi_blogger_get_user_info in modules/blogapi/blogapi.module
- Коллбэк Blogging API. Возвращает информацию о профиле пользователя.
- blogapi_help in modules/blogapi/blogapi.module
- Реализация hook_help().
- blogapi_init in modules/blogapi/blogapi.module
- blogapi_rsd in modules/blogapi/blogapi.module
- blogapi_update_6000 in modules/blogapi/blogapi.install
- Inform users about the new permission.
- blog_block in modules/blog/blog.module
- Реализация hook_block().
- blog_feed_last in modules/blog/blog.pages.inc
- Menu callback; displays an RSS feed containing recent blog entries of all users.
- blog_feed_user in modules/blog/blog.pages.inc
- Menu callback; displays an RSS feed containing recent blog entries of a given user.
- blog_help in modules/blog/blog.module
- Реализация hook_help().
- blog_page_last in modules/blog/blog.pages.inc
- Коллбэк меню. Показывает страницу Друпал с последними записями в блогах пользователей.
- blog_page_user in modules/blog/blog.pages.inc
- Коллбэк меню. Показывает страницу Друпал с последними записями в блоге данного пользователя.
- book_help in modules/book/book.module
- Реализация hook_help().
- chameleon_page in themes/chameleon/chameleon.theme
- color_form_alter in modules/color/color.module
- Реализация hook_form_alter().
- color_help in modules/color/color.module
- Реализация hook_help().
- comment_form in modules/comment/comment.module
- Создаёт базовую форму для комментирования, которая будет добавлена к странице с нодой или отображена на отдельной странице.
- comment_form_alter in modules/comment/comment.module
- Реализация hook_form_alter().
- comment_help in modules/comment/comment.module
- Реализация hook_help().
- comment_nodeapi in modules/comment/comment.module
- Реализация hook_nodeapi().
- contact_admin_settings in modules/contact/contact.admin.inc
- contact_help in modules/contact/contact.module
- Реализация hook_help().
- contact_mail in modules/contact/contact.module
- Реализация hook_mail().
- contact_mail_page in modules/contact/contact.pages.inc
- contact_user in modules/contact/contact.module
- Реализация hook_user().
- contact_user_page in modules/contact/contact.pages.inc
- Страница персональных контактов.
- dblog_admin_settings in modules/dblog/dblog.admin.inc
- Форма настроек модуля dblog.
Смотрите также system_settings_form()
- drupal_goto in includes/common.inc
- Перенаправляет пользователя на другую страницу сайта на Друпале.
- file_create_url in includes/file.inc
- Формирует путь для скачивания файла.
- filter_help in modules/filter/filter.module
- Реализация hook_help().
- form_expand_ahah in includes/form.inc
- Add AHAH information about a form element to the page to communicate with
javascript. If #ahah[path] is set on an element, this additional javascript is
added to the page header to attach the AHAH behaviors. See ahah.js for more
information.
- forum_block in modules/forum/forum.module
- Реализация hook_block().
- forum_confirm_delete in modules/forum/forum.admin.inc
- Returns a confirmation page for deleting a forum taxonomy term.
- forum_help in modules/forum/forum.module
- Реализация hook_help().
- forum_overview in modules/forum/forum.admin.inc
- Returns an overview list of existing forums and containers
- hook_help in developer/hooks/core.php
- Предоставляет контекстную справку для пользователей.
- hook_mail in developer/hooks/core.php
- Подготавливает письмо, основанное на параметрах. Для подробностей см. также drupal_mail().
- hook_ping in developer/hooks/core.php
- Отправляет ping-запрос на другой сервер.
- hook_requirements in developer/hooks/install.php
- Проверяет требования для установки и выдает сообщение о статусе.
- hook_search in developer/hooks/core.php
- Определяет пользовательскую функцию поиска.
- l in includes/common.inc
- Оформляет ссылки.
- locale_form_alter in modules/locale/locale.module
- Implementation of hook_form_alter(). Adds language fields to forms.
- locale_help in modules/locale/locale.module
- Реализация hook_help().
- locale_languages_predefined_form_submit in includes/locale.inc
- Process the language addition form submission.
- menu_get_active_help in includes/menu.inc
- Возвращает справку связанную с активизированным пунктом меню.
- menu_help in modules/menu/menu.module
- Реализация hook_help().
- node_block in modules/node/node.module
- Реализация hook_block().
- node_feed in modules/node/node.module
- A generic function for generating RSS feeds from a set of nodes.
- node_help in modules/node/node.module
- Реализация hook_help().
- node_page_default in modules/node/node.module
- Menu callback; Generate a listing of promoted nodes.
- node_search in modules/node/node.module
- Реализация hook_search().
- openid_authentication in modules/openid/openid.module
- Authenticate a user or attempt registration.
- openid_authentication_request in modules/openid/openid.module
- openid_form_alter in modules/openid/openid.module
- Implementation of hook_form_alter : adds OpenID login to the login forms.
- openid_help in modules/openid/openid.module
- Реализация hook_help().
- openid_login_validate in modules/openid/openid.module
- Login form _validate hook
- openid_user_add_validate in modules/openid/openid.pages.inc
- path_admin_form in modules/path/path.admin.inc
- Return a form for editing or creating an individual URL alias.
See alsopath_admin_form_validate()
- php_filter_tips in modules/php/php.module
- Реализация hook_filter_tips().
- php_help in modules/php/php.module
- Реализация hook_help().
- ping_help in modules/ping/ping.module
- Реализация hook_help().
- poll_help in modules/poll/poll.module
- Реализация hook_help().
- profile_block in modules/profile/profile.module
- Реализация hook_block().
- profile_field_delete in modules/profile/profile.admin.inc
- Menu callback; deletes a field from all user profiles.
- search_admin_settings in modules/search/search.admin.inc
- Menu callback; displays the search module settings page.
See alsosystem_settings_form()
- search_form in modules/search/search.module
- Выводит форму поиска.
- search_help in modules/search/search.module
- Реализация hook_help().
- statistics_access_log in modules/statistics/statistics.admin.inc
- Menu callback; Displays recent page accesses.
- statistics_access_logging_settings in modules/statistics/statistics.admin.inc
- Form builder; Configure access logging.
See alsosystem_settings_form()
- statistics_help in modules/statistics/statistics.module
- Реализация hook_help().
- syslog_admin_settings in modules/syslog/syslog.module
- syslog_help in modules/syslog/syslog.module
- Реализация hook_help().
- system_check_http_request in modules/system/system.module
- Checks whether the server is capable of issuing HTTP requests.
- system_date_time_settings in modules/system/system.admin.inc
- Form builder; Configure the site date and time settings.
See alsosystem_settings_form()
- system_error_reporting_settings in modules/system/system.admin.inc
- Form builder; Configure error reporting settings.
See alsosystem_settings_form()
- system_help in modules/system/system.module
- Реализация hook_help().
- system_mail in modules/system/system.module
- Implementation of hook_mail().
- system_main_admin_page in modules/system/system.admin.inc
- Menu callback; Provide the administration overview page.
- system_message_action in modules/system/system.module
- A configurable Drupal action. Sends a message to the current user's screen.
- system_modules in modules/system/system.admin.inc
- Menu callback; provides module enable/disable interface.
- system_modules_uninstall in modules/system/system.admin.inc
- Builds a form of currently disabled modules.
See alsosystem_modules_uninstall_validate()
- system_requirements in modules/system/system.install
- Test and report Drupal installation requirements.
- system_site_information_settings in modules/system/system.admin.inc
- Form builder; The general site information form.
See alsosystem_settings_form()
- system_site_maintenance_settings in modules/system/system.admin.inc
- Form builder; Configure the site's maintenance status.
See alsosystem_settings_form()
- system_themes_form_submit in modules/system/system.admin.inc
- Process system_themes_form form submissions.
- system_update_6017 in modules/system/system.install
- Rename settings related to user.module email notifications.
- system_update_6026 in modules/system/system.install
- Display warning about new Update status module.
- system_update_6045 in modules/system/system.install
- Update blog, book and locale module permissions.
- taxonomy_rss_item in modules/taxonomy/taxonomy.module
- Provides category information for RSS feeds.
- taxonomy_term_page in modules/taxonomy/taxonomy.pages.inc
- Коллбэк меню; отображает все ноды, связанные с термином таксономии.
- template_preprocess_aggregator_feed_source in modules/aggregator/aggregator.pages.inc
- Process variables for aggregator-feed-source.tpl.php.
See alsoaggregator-feed-source.tpl.php
- template_preprocess_aggregator_item in modules/aggregator/aggregator.pages.inc
- Process variables for aggregator-item.tpl.php.
See alsoaggregator-item.tpl.php
- template_preprocess_book_navigation in modules/book/book.module
- Process variables for book-navigation.tpl.php.
- template_preprocess_forums in modules/forum/forum.module
- Process variables for forums.tpl.php
- template_preprocess_forum_list in modules/forum/forum.module
- Process variables to format a forum listing.
- template_preprocess_forum_topic_list in modules/forum/forum.module
- Preprocess variables to format the topic listing.
- template_preprocess_forum_topic_navigation in modules/forum/forum.module
- Preprocess variables to format the next/previous forum topic navigation links.
- template_preprocess_node in includes/theme.inc
- Обрабатывает переменные для node.tpl.php
- template_preprocess_page in includes/theme.inc
- Обрабатывает переменные для page.tpl.php
- theme_aggregator_page_rss in modules/aggregator/aggregator.pages.inc
- Темизирует вывод RSS.
- theme_comment_post_forbidden in modules/comment/comment.module
- Темизирует уведомление "вы не можете оставить комментарий".
- theme_image in includes/theme.inc
- Возвращает темизированную картинку.
- theme_textfield in includes/form.inc
- Форматирует однострочное текстовое поле ввода.
- translation_form_alter in modules/translation/translation.module
- Implementation of hook_form_alter().
- translation_help in modules/translation/translation.module
- Реализация hook_help().
- trigger_help in modules/trigger/trigger.module
- Реализация hook_help().
- update_help in modules/update/update.module
- Реализация hook_help().
- update_mail in modules/update/update.module
- Implementation of hook_mail().
- update_settings in modules/update/update.settings.inc
- Form builder for the update settings tab.
- upload_admin_settings in modules/upload/upload.admin.inc
- Menu callback for the upload settings form.
- upload_form_alter in modules/upload/upload.module
- upload_help in modules/upload/upload.module
- Реализация hook_help().
- user_help in modules/user/user.module
- Реализация hook_help().
- user_login_block in modules/user/user.module
- user_login_final_validate in modules/user/user.module
- A validate handler on the login form. Should be the last validator. Sets an
error if user has not been authenticated yet.
- user_mail_tokens in modules/user/user.module
- Return an array of token to value mappings for user e-mail messages.
- user_pass_reset in modules/user/user.pages.inc
- Menu callback; process one time login link and redirects to the user page on success.
- user_pass_reset_url in modules/user/user.module
- user_register_submit in modules/user/user.module
- Обработчик формы регистрации пользователя.
- user_search in modules/user/user.module
- Реализация hook_search().
- _batch_progress_page_js in includes/batch.inc
- Batch processing page with JavaScript support.
- _batch_progress_page_nojs in includes/batch.inc
- Batch processing page without JavaScript support.
- _blogapi_get_post in modules/blogapi/blogapi.module
- _update_message_text in modules/update/update.module
- Helper function to return the appropriate message text when the site is out
of date or missing a security update.
- _update_no_data in modules/update/update.module
- Prints a warning message when there is no data about available updates.
- _user_edit_validate in modules/user/user.module
Код
<?php
function url($path = NULL, $options = array()) {
$options += array(
'fragment' => '',
'query' => '',
'absolute' => FALSE,
'alias' => FALSE,
'prefix' => ''
);
if (!isset($options['external'])) {
$colonpos = strpos($path, ':');
$options['external'] = ($colonpos !== FALSE && !preg_match('![/?#]!', substr($path, 0, $colonpos)) && filter_xss_bad_protocol($path, FALSE) == check_plain($path));
}
if (function_exists('language_url_rewrite')) {
language_url_rewrite($path, $options);
}
if ($options['fragment']) {
$options['fragment'] = '#'. $options['fragment'];
}
if (is_array($options['query'])) {
$options['query'] = drupal_query_string_encode($options['query']);
}
if ($options['external']) {
if (strpos($path, '#') !== FALSE) {
list($path, $old_fragment) = explode('#', $path, 2);
if (isset($old_fragment) && !$options['fragment']) {
$options['fragment'] = '#'. $old_fragment;
}
}
if ($options['query']) {
$path .= (strpos($path, '?') !== FALSE ? '&' : '?') . $options['query'];
}
return $path . $options['fragment'];
}
global $base_url;
static $script;
if (!isset($script)) {
$script = (strpos($_SERVER['SERVER_SOFTWARE'], 'Apache') === FALSE) ? 'index.php' : '';
}
if (!isset($options['base_url'])) {
$options['base_url'] = $base_url;
}
$original_path = $path;
if ($path == '<front>') {
$path = '';
}
elseif (!empty($path) && !$options['alias']) {
$path = drupal_get_path_alias($path, isset($options['language']) ? $options['language']->language : '');
}
if (function_exists('custom_url_rewrite_outbound')) {
custom_url_rewrite_outbound($path, $options, $original_path);
}
$base = $options['absolute'] ? $options['base_url'] .'/' : base_path();
$prefix = empty($path) ? rtrim($options['prefix'], '/') : $options['prefix'];
$path = drupal_urlencode($prefix . $path);
if (variable_get('clean_url', '0')) {
if ($options['query']) {
return $base . $path .'?'. $options['query'] . $options['fragment'];
}
else {
return $base . $path . $options['fragment'];
}
}
else {
$variables = array();
if (!empty($path)) {
$variables[] = 'q='. $path;
}
if (!empty($options['query'])) {
$variables[] = $options['query'];
}
if ($query = join('&', $variables)) {
return $base . $script .'?'. $query . $options['fragment'];
}
else {
return $base . $options['fragment'];
}
}
}
?>
Пользовательские комментарии
Войдите или зарегистрируйтесь, чтобы получить возможность отправлять комментарии
Функция возвращает URL с языковым префиксом (если он используется).
Это делает вызов:
language_url_rewrite($path, $options);