summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--modules/block/block.module2
-rw-r--r--modules/comment/comment.module4
-rw-r--r--modules/comment/comment.tokens.inc2
-rw-r--r--modules/field/field.api.php8
-rw-r--r--modules/field/modules/text/text.module8
-rw-r--r--modules/filter/filter.module14
-rw-r--r--modules/node/node.api.php2
-rw-r--r--modules/profile/profile.module2
-rw-r--r--modules/user/user.module2
9 files changed, 24 insertions, 20 deletions
diff --git a/modules/block/block.module b/modules/block/block.module
index 06aa77178..b534113ad 100644
--- a/modules/block/block.module
+++ b/modules/block/block.module
@@ -195,7 +195,7 @@ function block_block_save($delta = 0, $edit = array()) {
*/
function block_block_view($delta = 0, $edit = array()) {
$block = db_query('SELECT body, format FROM {block_custom} WHERE bid = :bid', array(':bid' => $delta))->fetchObject();
- $data['content'] = check_markup($block->body, $block->format);
+ $data['content'] = check_markup($block->body, $block->format, '', TRUE);
return $data;
}
diff --git a/modules/comment/comment.module b/modules/comment/comment.module
index 93958f37a..04e8fe200 100644
--- a/modules/comment/comment.module
+++ b/modules/comment/comment.module
@@ -841,7 +841,7 @@ function comment_build_content($comment, $node, $build_mode = 'full') {
// Build comment body.
$comment->content['comment_body'] = array(
- '#markup' => check_markup($comment->comment, $comment->format),
+ '#markup' => check_markup($comment->comment, $comment->format, '', TRUE),
);
$comment->content += field_attach_view('comment', $comment, $build_mode);
@@ -1158,7 +1158,7 @@ function comment_node_update_index($node) {
':status' => COMMENT_PUBLISHED
));
foreach ($comments as $comment) {
- $text .= '<h2>' . check_plain($comment->subject) . '</h2>' . check_markup($comment->comment, $comment->format);
+ $text .= '<h2>' . check_plain($comment->subject) . '</h2>' . check_markup($comment->comment, $comment->format, '', TRUE);
}
}
return $text;
diff --git a/modules/comment/comment.tokens.inc b/modules/comment/comment.tokens.inc
index 3f5590ee6..8ca74fa70 100644
--- a/modules/comment/comment.tokens.inc
+++ b/modules/comment/comment.tokens.inc
@@ -175,7 +175,7 @@ function comment_tokens($type, $tokens, array $data = array(), array $options =
break;
case 'body':
- $replacements[$original] = $sanitize ? check_markup($comment->comment, $comment->format) : $replacements[$original] = $comment->comment;
+ $replacements[$original] = $sanitize ? check_markup($comment->comment, $comment->format, '', TRUE) : $comment->comment;
break;
// Comment related URLs.
diff --git a/modules/field/field.api.php b/modules/field/field.api.php
index 9e9924f9b..52673a39c 100644
--- a/modules/field/field.api.php
+++ b/modules/field/field.api.php
@@ -278,9 +278,9 @@ function hook_field_load($obj_type, $objects, $field, $instances, $langcode, &$i
// handled by hook_field_sanitize().
$format = $item['format'];
if (filter_format_allowcache($format)) {
- $items[$id][$delta]['safe'] = isset($item['value']) ? check_markup($item['value'], $format, $langcode, FALSE) : '';
+ $items[$id][$delta]['safe'] = isset($item['value']) ? check_markup($item['value'], $format, $langcode) : '';
if ($field['type'] == 'text_with_summary') {
- $items[$id][$delta]['safe_summary'] = isset($item['summary']) ? check_markup($item['summary'], $format, $langcode, FALSE) : '';
+ $items[$id][$delta]['safe_summary'] = isset($item['summary']) ? check_markup($item['summary'], $format, $langcode) : '';
}
}
}
@@ -322,9 +322,9 @@ function hook_field_sanitize($obj_type, $object, $field, $instance, $langcode, &
if (!isset($items[$delta]['safe'])) {
if (!empty($instance['settings']['text_processing'])) {
$format = $item['format'];
- $items[$delta]['safe'] = isset($item['value']) ? check_markup($item['value'], $format, $langcode) : '';
+ $items[$delta]['safe'] = isset($item['value']) ? check_markup($item['value'], $format, $langcode, TRUE) : '';
if ($field['type'] == 'text_with_summary') {
- $items[$delta]['safe_summary'] = isset($item['summary']) ? check_markup($item['summary'], $format, $langcode) : '';
+ $items[$delta]['safe_summary'] = isset($item['summary']) ? check_markup($item['summary'], $format, $langcode, TRUE) : '';
}
}
else {
diff --git a/modules/field/modules/text/text.module b/modules/field/modules/text/text.module
index 4a88b1e3a..0579a8bcf 100644
--- a/modules/field/modules/text/text.module
+++ b/modules/field/modules/text/text.module
@@ -207,9 +207,9 @@ function text_field_load($obj_type, $objects, $field, $instances, $langcode, &$i
// handled by text_field_sanitize().
$format = $item['format'];
if (filter_format_allowcache($format)) {
- $items[$id][$delta]['safe'] = isset($item['value']) ? check_markup($item['value'], $format, $langcode, FALSE) : '';
+ $items[$id][$delta]['safe'] = isset($item['value']) ? check_markup($item['value'], $format, $langcode) : '';
if ($field['type'] == 'text_with_summary') {
- $items[$id][$delta]['safe_summary'] = isset($item['summary']) ? check_markup($item['summary'], $format, $langcode, FALSE) : '';
+ $items[$id][$delta]['safe_summary'] = isset($item['summary']) ? check_markup($item['summary'], $format, $langcode) : '';
}
}
}
@@ -236,9 +236,9 @@ function text_field_sanitize($obj_type, $object, $field, $instance, $langcode, &
if (!isset($items[$delta]['safe'])) {
if (!empty($instance['settings']['text_processing'])) {
$format = $item['format'];
- $items[$delta]['safe'] = isset($item['value']) ? check_markup($item['value'], $format, $langcode) : '';
+ $items[$delta]['safe'] = isset($item['value']) ? check_markup($item['value'], $format, $langcode, TRUE) : '';
if ($field['type'] == 'text_with_summary') {
- $items[$delta]['safe_summary'] = isset($item['summary']) ? check_markup($item['summary'], $format, $langcode) : '';
+ $items[$delta]['safe_summary'] = isset($item['summary']) ? check_markup($item['summary'], $format, $langcode, TRUE) : '';
}
}
else {
diff --git a/modules/filter/filter.module b/modules/filter/filter.module
index c274b88b2..040d6a60f 100644
--- a/modules/filter/filter.module
+++ b/modules/filter/filter.module
@@ -692,15 +692,19 @@ function filter_list_format($format, $include_disabled = FALSE) {
* The caller may set this to FALSE when the output is already cached
* elsewhere to avoid duplicate cache lookups and storage.
*/
-function check_markup($text, $format = NULL, $langcode = '', $cache = TRUE) {
+function check_markup($text, $format = NULL, $langcode = '', $cache = FALSE) {
if (empty($format)) {
$format = filter_fallback_format();
}
+ $cache = $cache && filter_format_allowcache($format);
+ $cache_id = '';
// Check for a cached version of this piece of text.
- $cache_id = $format . ':' . $langcode . ':' . md5($text);
- if ($cache && $cached = cache_get($cache_id, 'cache_filter')) {
- return $cached->data;
+ if ($cache) {
+ $cache_id = $format . ':' . $langcode . ':' . md5($text);
+ if ($cached = cache_get($cache_id, 'cache_filter')) {
+ return $cached->data;
+ }
}
// Convert all Windows and Mac newlines to a single newline, so filters only
@@ -726,7 +730,7 @@ function check_markup($text, $format = NULL, $langcode = '', $cache = TRUE) {
}
// Store in cache with a minimum expiration time of 1 day.
- if ($cache && filter_format_allowcache($format)) {
+ if ($cache) {
cache_set($cache_id, $text, 'cache_filter', REQUEST_TIME + (60 * 60 * 24));
}
diff --git a/modules/node/node.api.php b/modules/node/node.api.php
index 1ed19a6aa..7e1491b53 100644
--- a/modules/node/node.api.php
+++ b/modules/node/node.api.php
@@ -486,7 +486,7 @@ function hook_node_update_index($node) {
$text = '';
$comments = db_query('SELECT subject, comment, format FROM {comment} WHERE nid = :nid AND status = :status', array(':nid' => $node->nid, ':status' => COMMENT_PUBLISHED));
foreach ($comments as $comment) {
- $text .= '<h2>' . check_plain($comment->subject) . '</h2>' . check_markup($comment->comment, $comment->format);
+ $text .= '<h2>' . check_plain($comment->subject) . '</h2>' . check_markup($comment->comment, $comment->format, '', TRUE);
}
return $text;
}
diff --git a/modules/profile/profile.module b/modules/profile/profile.module
index aac2c8105..6bef40933 100644
--- a/modules/profile/profile.module
+++ b/modules/profile/profile.module
@@ -280,7 +280,7 @@ function profile_view_field($account, $field) {
if (isset($account->{$field->name}) && $value = $account->{$field->name}) {
switch ($field->type) {
case 'textarea':
- return check_markup($value, filter_default_format($account));
+ return check_markup($value, filter_default_format($account), '', TRUE);
case 'textfield':
case 'selection':
return $browse ? l($value, 'profile/' . $field->name . '/' . $value) : check_plain($value);
diff --git a/modules/user/user.module b/modules/user/user.module
index 26064f886..1cf567bb1 100644
--- a/modules/user/user.module
+++ b/modules/user/user.module
@@ -2852,7 +2852,7 @@ function user_forms() {
*/
function user_comment_view($comment) {
if (variable_get('user_signatures', 0) && !empty($comment->signature)) {
- $comment->signature = check_markup($comment->signature, $comment->format);
+ $comment->signature = check_markup($comment->signature, $comment->format, '', TRUE);
}
else {
$comment->signature = '';