Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Open sidebar
project
drupal
Commits
7ed3cf3b
Commit
7ed3cf3b
authored
Oct 10, 2009
by
webchick
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
#569238
by sun, swentel, catch: Changed Make check_markup() not cache by default.
parent
7bcd22f1
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
24 additions
and
20 deletions
+24
-20
modules/block/block.module
modules/block/block.module
+1
-1
modules/comment/comment.module
modules/comment/comment.module
+2
-2
modules/comment/comment.tokens.inc
modules/comment/comment.tokens.inc
+1
-1
modules/field/field.api.php
modules/field/field.api.php
+4
-4
modules/field/modules/text/text.module
modules/field/modules/text/text.module
+4
-4
modules/filter/filter.module
modules/filter/filter.module
+9
-5
modules/node/node.api.php
modules/node/node.api.php
+1
-1
modules/profile/profile.module
modules/profile/profile.module
+1
-1
modules/user/user.module
modules/user/user.module
+1
-1
No files found.
modules/block/block.module
View file @
7ed3cf3b
...
...
@@ -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
;
}
...
...
modules/comment/comment.module
View file @
7ed3cf3b
...
...
@@ -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
;
...
...
modules/comment/comment.tokens.inc
View file @
7ed3cf3b
...
...
@@ -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.
...
...
modules/field/field.api.php
View file @
7ed3cf3b
...
...
@@ -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
{
...
...
modules/field/modules/text/text.module
View file @
7ed3cf3b
...
...
@@ -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
{
...
...
modules/filter/filter.module
View file @
7ed3cf3b
...
...
@@ -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
=
TRU
E
)
{
function
check_markup
(
$text
,
$format
=
NULL
,
$langcode
=
''
,
$cache
=
FALS
E
)
{
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
));
}
...
...
modules/node/node.api.php
View file @
7ed3cf3b
...
...
@@ -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
;
}
...
...
modules/profile/profile.module
View file @
7ed3cf3b
...
...
@@ -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
);
...
...
modules/user/user.module
View file @
7ed3cf3b
...
...
@@ -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
=
''
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment