Commit 8749a43a authored by Dries's avatar Dries

- Patch #601548 by Damien Tournoud, moshe weitzman: loosen the dependency...

- Patch #601548 by Damien Tournoud, moshe weitzman: loosen the dependency between t() and the theming layer.
parent a71fd090
......@@ -2247,3 +2247,18 @@ function drupal_static_reset($name = NULL) {
function drupal_is_cli() {
return (!isset($_SERVER['SERVER_SOFTWARE']) && (php_sapi_name() == 'cli' || (is_numeric($_SERVER['argc']) && $_SERVER['argc'] > 0)));
}
/**
* Formats text for emphasized display in a placeholder inside a sentence.
* Used automatically by t().
*
* @param $variables
* An associative array containing:
* - text: The text to format (plain-text).
*
* @return
* The formatted text (html).
*/
function drupal_placeholder($variables) {
return '<em class="placeholder">' . check_plain($variables['text']) . '</em>';
}
......@@ -1546,7 +1546,7 @@ function t($string, array $args = array(), array $options = array()) {
case '%':
default:
// Escaped and placeholder.
$args[$key] = theme('placeholder', array('text' => $value));
$args[$key] = drupal_placeholder(array('text' => $value));
break;
case '!':
......
......@@ -1374,21 +1374,6 @@ function theme_disable($theme_list) {
* @see hook_theme()
*/
/**
* Formats text for emphasized display in a placeholder inside a sentence.
* Used automatically by t().
*
* @param $variables
* An associative array containing:
* - text: The text to format (plain-text).
*
* @return
* The formatted text (html).
*/
function theme_placeholder($variables) {
return '<em>' . check_plain($variables['text']) . '</em>';
}
/**
* Return a themed set of status and/or error messages. The messages are grouped
* by type.
......
......@@ -23,8 +23,8 @@ function filter_admin_overview($form) {
// to all roles and cannot be deleted via the admin interface.
$form['formats'][$id]['#is_fallback'] = ($id == $fallback_format);
if ($form['formats'][$id]['#is_fallback']) {
$form['formats'][$id]['name'] = array('#markup' => theme('placeholder', array('text' => $format->name)));
$roles_markup = theme('placeholder', array('text' => t('All roles may use this format')));
$form['formats'][$id]['name'] = array('#markup' => drupal_placeholder(array('text' => $format->name)));
$roles_markup = drupal_placeholder(array('text' => t('All roles may use this format')));
}
else {
$form['formats'][$id]['name'] = array('#markup' => check_plain($format->name));
......
......@@ -268,7 +268,7 @@ function filter_admin_format_title($format) {
function filter_permission() {
$perms['administer filters'] = array(
'title' => t('Administer and use any text formats and filters'),
'description' => theme('placeholder', array('text' => t('Warning: This permission may have security implications depending on how the text format is configured.'))),
'description' => drupal_placeholder(array('text' => t('Warning: This permission may have security implications depending on how the text format is configured.'))),
);
// Generate permissions for each text format. Warn the administrator that any
......@@ -278,10 +278,10 @@ function filter_permission() {
if (!empty($permission)) {
// Only link to the text format configuration page if the user who is
// viewing this will have access to that page.
$format_name_replacement = user_access('administer filters') ? l($format->name, 'admin/config/content/formats/' . $format->format) : theme('placeholder', array('text' => $format->name));
$format_name_replacement = user_access('administer filters') ? l($format->name, 'admin/config/content/formats/' . $format->format) : drupal_placeholder(array('text' => $format->name));
$perms[$permission] = array(
'title' => t("Use the !text_format text format", array('!text_format' => $format_name_replacement,)),
'description' => theme('placeholder', array('text' => t('Warning: This permission may have security implications depending on how the text format is configured.'))),
'description' => drupal_placeholder(array('text' => t('Warning: This permission may have security implications depending on how the text format is configured.'))),
);
}
}
......
......@@ -1423,7 +1423,7 @@ function node_permission() {
),
'administer nodes' => array(
'title' => t('Administer content'),
'description' => theme('placeholder', array('text' => t('Warning: Give to trusted roles only; this permission has security implications.'))),
'description' => drupal_placeholder(array('text' => t('Warning: Give to trusted roles only; this permission has security implications.'))),
),
'access content' => array(
'title' => t('View published content'),
......
......@@ -521,7 +521,7 @@ function node_revision_overview($node) {
$row[] = array('data' => t('!date by !username', array('!date' => l(format_date($revision->timestamp, 'short'), "node/$node->nid"), '!username' => theme('username', array('account' => $revision))))
. (($revision->log != '') ? '<p class="revision-log">' . filter_xss($revision->log) . '</p>' : ''),
'class' => array('revision-current'));
$operations[] = array('data' => theme('placeholder', array('text' => t('current revision'))), 'class' => array('revision-current'), 'colspan' => 2);
$operations[] = array('data' => drupal_placeholder(array('text' => t('current revision'))), 'class' => array('revision-current'), 'colspan' => 2);
}
else {
$row[] = t('!date by !username', array('!date' => l(format_date($revision->timestamp, 'short'), "node/$node->nid/revisions/$revision->vid/view"), '!username' => theme('username', array('account' => $revision))))
......
......@@ -31,7 +31,7 @@ function php_permission() {
return array(
'use PHP for settings' => array(
'title' => t('Use PHP for settings'),
'description' => theme('placeholder', array('text' => t('Warning: Give to trusted roles only; this permission has security implications.'))),
'description' => drupal_placeholder(array('text' => t('Warning: Give to trusted roles only; this permission has security implications.'))),
),
);
}
......
......@@ -77,7 +77,7 @@ function profile_browse() {
$output .= theme('pager', array('tags' => NULL));
if ($field->type == 'selection' || $field->type == 'list' || $field->type == 'textfield') {
$title = strtr(check_plain($field->page), array('%value' => theme('placeholder', array('text' => $value))));
$title = strtr(check_plain($field->page), array('%value' => drupal_placeholder(array('text' => $value))));
}
else {
$title = check_plain($field->page);
......
......@@ -68,7 +68,7 @@ function simpletest_permission() {
return array(
'administer unit tests' => array(
'title' => t('Administer tests'),
'description' => theme('placeholder', array('text' => t('Warning: Give to trusted roles only; this permission has security implications.'))),
'description' => drupal_placeholder(array('text' => t('Warning: Give to trusted roles only; this permission has security implications.'))),
),
);
}
......
......@@ -164,7 +164,7 @@ function theme_update_report($variables) {
foreach ($project['extra'] as $key => $value) {
$row .= '<div class="' . implode(' ', $value['class']) . '">';
$row .= check_plain($value['label']) . ': ';
$row .= theme('placeholder', array('text' => $value['data']));
$row .= drupal_placeholder(array('text' => $value['data']));
$row .= "</div>\n";
}
$row .= "</div>\n"; // extra div.
......@@ -199,7 +199,7 @@ function theme_update_report($variables) {
break;
default:
$base_themes[] = theme('placeholder', array('text' => $base_theme));
$base_themes[] = drupal_placeholder(array('text' => $base_theme));
}
}
$row .= t('Depends on: !basethemes', array('!basethemes' => implode(', ', $base_themes)));
......
......@@ -767,11 +767,11 @@ function user_permission() {
return array(
'administer permissions' => array(
'title' => t('Administer permissions'),
'description' => theme('placeholder', array('text' => t('Warning: Give to trusted roles only; this permission has security implications.'))),
'description' => drupal_placeholder(array('text' => t('Warning: Give to trusted roles only; this permission has security implications.'))),
),
'administer users' => array(
'title' => t('Administer users'),
'description' => theme('placeholder', array('text' => t('Warning: Give to trusted roles only; this permission has security implications.'))),
'description' => drupal_placeholder(array('text' => t('Warning: Give to trusted roles only; this permission has security implications.'))),
),
'access user profiles' => array(
'title' => t('View user profiles'),
......@@ -785,7 +785,7 @@ function user_permission() {
),
'select account cancellation method' => array(
'title' => t('Select method for cancelling own account'),
'description' => theme('placeholder', array('text' => t('Warning: Give to trusted roles only; this permission has security implications.'))),
'description' => drupal_placeholder(array('text' => t('Warning: Give to trusted roles only; this permission has security implications.'))),
),
);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment