Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
D
drupal
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Custom Issue Tracker
Custom Issue Tracker
Labels
Merge Requests
220
Merge Requests
220
Requirements
Requirements
List
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Analytics
Analytics
Code Review
Insights
Issue
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
project
drupal
Commits
0290031d
Commit
0290031d
authored
Nov 08, 2008
by
Dries
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
- Patch
#319788
by stella, nedjo et al: pass language code to filters when available.
parent
b3b68b8b
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
13 additions
and
9 deletions
+13
-9
modules/block/block.module
modules/block/block.module
+1
-1
modules/comment/comment.module
modules/comment/comment.module
+2
-2
modules/filter/filter.module
modules/filter/filter.module
+8
-4
modules/node/node.module
modules/node/node.module
+2
-2
No files found.
modules/block/block.module
View file @
0290031d
...
...
@@ -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
;
}
}
...
...
modules/comment/comment.module
View file @
0290031d
...
...
@@ -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
.
=
'<h2>'
.
check_plain
(
$comment
->
subject
)
.
'</h2>'
.
check_markup
(
$comment
->
comment
,
$comment
->
format
,
FALSE
);
$text
.
=
'<h2>'
.
check_plain
(
$comment
->
subject
)
.
'</h2>'
.
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
);
...
...
modules/filter/filter.module
View file @
0290031d
...
...
@@ -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.
...
...
modules/node/node.module
View file @
0290031d
...
...
@@ -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
(
...
...
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