diff --git a/modules/block/block.module b/modules/block/block.module
index f56e428dc94..9c482e1de10 100644
--- a/modules/block/block.module
+++ b/modules/block/block.module
@@ -213,7 +213,7 @@ function block_block($op = 'list', $delta = 0, $edit = array()) {
case 'view':
$block = db_fetch_object(db_query('SELECT body, format FROM {boxes} WHERE bid = %d', $delta));
- $data['content'] = check_markup($block->body, $block->format, FALSE);
+ $data['content'] = check_markup($block->body, $block->format, '', FALSE);
return $data;
}
}
diff --git a/modules/comment/comment.module b/modules/comment/comment.module
index 7644e0f9eef..d1797fef8a5 100644
--- a/modules/comment/comment.module
+++ b/modules/comment/comment.module
@@ -604,7 +604,7 @@ function comment_nodeapi_update_index(&$node, $arg = 0) {
$text = '';
$comments = db_query('SELECT subject, comment, format FROM {comments} WHERE nid = %d AND status = %d', $node->nid, COMMENT_PUBLISHED);
while ($comment = db_fetch_object($comments)) {
- $text .= '
' . check_plain($comment->subject) . '
' . check_markup($comment->comment, $comment->format, FALSE);
+ $text .= '' . check_plain($comment->subject) . '
' . check_markup($comment->comment, $comment->format, '', FALSE);
}
return $text;
}
@@ -1597,7 +1597,7 @@ function theme_comment_view($comment, $node, $links = array(), $visible = TRUE)
// Switch to folded/unfolded view of the comment.
if ($visible) {
- $comment->comment = check_markup($comment->comment, $comment->format, FALSE);
+ $comment->comment = check_markup($comment->comment, $comment->format, '', FALSE);
// Comment API hook.
comment_invoke_comment($comment, 'view');
$output .= theme('comment', $comment, $node, $links);
diff --git a/modules/filter/filter.module b/modules/filter/filter.module
index 8366216b4cc..7e21d5facb2 100644
--- a/modules/filter/filter.module
+++ b/modules/filter/filter.module
@@ -409,6 +409,10 @@ function filter_list_format($format) {
* @param $format
* The format of the text to be filtered. Specify FILTER_FORMAT_DEFAULT for
* the default format.
+ * @param $langcode
+ * Optional: the language code of the text to be filtered, e.g. 'en' for
+ * English. This allows filters to be language aware so language specific
+ * text replacement can be implemented.
* @param $check
* Whether to check the $format with filter_access() first. Defaults to TRUE.
* Note that this will check the permissions of the current user, so you
@@ -416,13 +420,13 @@ function filter_list_format($format) {
* showing content that is not (yet) stored in the database (eg. upon preview),
* set to TRUE so the user's permissions are checked.
*/
-function check_markup($text, $format = FILTER_FORMAT_DEFAULT, $check = TRUE) {
+function check_markup($text, $format = FILTER_FORMAT_DEFAULT, $langcode = '', $check = TRUE) {
// When $check = TRUE, do an access check on $format.
if (isset($text) && (!$check || filter_access($format))) {
$format = filter_resolve_format($format);
// Check for a cached version of this piece of text.
- $cache_id = $format . ':' . md5($text);
+ $cache_id = $format . ':' . $langcode . ':' . md5($text);
if ($cached = cache_get($cache_id, 'cache_filter')) {
return $cached->data;
}
@@ -439,12 +443,12 @@ function check_markup($text, $format = FILTER_FORMAT_DEFAULT, $check = TRUE) {
// Give filters the chance to escape HTML-like data such as code or formulas.
foreach ($filters as $filter) {
- $text = module_invoke($filter->module, 'filter', 'prepare', $filter->delta, $format, $text, $cache_id);
+ $text = module_invoke($filter->module, 'filter', 'prepare', $filter->delta, $format, $text, $langcode, $cache_id);
}
// Perform filtering.
foreach ($filters as $filter) {
- $text = module_invoke($filter->module, 'filter', 'process', $filter->delta, $format, $text, $cache_id);
+ $text = module_invoke($filter->module, 'filter', 'process', $filter->delta, $format, $text, $langcode, $cache_id);
}
// Store in cache with a minimum expiration time of 1 day.
diff --git a/modules/node/node.module b/modules/node/node.module
index eed4cf34aad..7c8763cd3d8 100644
--- a/modules/node/node.module
+++ b/modules/node/node.module
@@ -1088,10 +1088,10 @@ function node_prepare($node, $teaser = FALSE) {
$node->readmore = (strlen($node->teaser) < strlen($node->body));
if ($teaser == FALSE) {
- $node->body = check_markup($node->body, $node->format, FALSE);
+ $node->body = check_markup($node->body, $node->format, $node->language, FALSE);
}
else {
- $node->teaser = check_markup($node->teaser, $node->format, FALSE);
+ $node->teaser = check_markup($node->teaser, $node->format, $node->language, FALSE);
}
$node->content['body'] = array(