Index: modules/block/block.module =================================================================== RCS file: /cvs/drupal/drupal/modules/block/block.module,v retrieving revision 1.300 diff -u -p -r1.300 block.module --- modules/block/block.module 20 Feb 2008 13:46:38 -0000 1.300 +++ modules/block/block.module 26 Feb 2008 13:48:54 -0000 @@ -215,7 +215,7 @@ function block_block($op = 'list', $delt 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'] = apply_filters($block->body, array('block' => $block), $block->format, FALSE); return $data; } } Index: modules/comment/comment.module =================================================================== RCS file: /cvs/drupal/drupal/modules/comment/comment.module,v retrieving revision 1.621 diff -u -p -r1.621 comment.module --- modules/comment/comment.module 23 Feb 2008 08:02:48 -0000 1.621 +++ modules/comment/comment.module 26 Feb 2008 13:48:54 -0000 @@ -638,7 +638,7 @@ function comment_nodeapi(&$node, $op, $a $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) .'

'. apply_filters($comment->comment, array('comment' => $comment), $comment->format, FALSE); } return $text; @@ -1542,8 +1542,8 @@ function _comment_form_submit(&$comment_ // 1) Filter it into HTML // 2) Strip out all HTML tags // 3) Convert entities back to plain-text. - // Note: format is checked by check_markup(). - $comment_values['subject'] = trim(truncate_utf8(decode_entities(strip_tags(check_markup($comment_values['comment'], $comment_values['format']))), 29, TRUE)); + // Note: format is checked by apply_filters(). + $comment_values['subject'] = trim(truncate_utf8(decode_entities(strip_tags(apply_filters($comment_values['comment'], NULL, $comment_values['format']))), 29, TRUE)); // Edge cases where the comment body is populated only by HTML tags will // require a default subject. if ($comment_values['subject'] == '') { @@ -1594,7 +1594,7 @@ function theme_comment_view($comment, $n // Switch to folded/unfolded view of the comment if ($visible) { - $comment->comment = check_markup($comment->comment, $comment->format, FALSE); + $comment->comment = apply_filters($comment->comment, array('comment' => $comment), $comment->format, FALSE); // Comment API hook comment_invoke_comment($comment, 'view'); Index: modules/filter/filter.module =================================================================== RCS file: /cvs/drupal/drupal/modules/filter/filter.module,v retrieving revision 1.206 diff -u -p -r1.206 filter.module --- modules/filter/filter.module 20 Feb 2008 13:46:39 -0000 1.206 +++ modules/filter/filter.module 26 Feb 2008 13:48:54 -0000 @@ -407,6 +407,10 @@ function filter_list_format($format) { * * @param $text * The text to be filtered. + * @param $context + * The context in which the text is filtered. This is an array which has either + * 'node' set to a node object, 'comment' set to a comment object or 'block' + * set to the block in which the text occurs. * @param $format * The format of the text to be filtered. Specify FILTER_FORMAT_DEFAULT for * the default format. @@ -417,7 +421,7 @@ 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 apply_filters($text, $context = NULL, $format = FILTER_FORMAT_DEFAULT, $check = TRUE) { // When $check = TRUE, do an access check on $format. if (isset($text) && (!$check || filter_access($format))) { $format = filter_resolve_format($format); @@ -440,12 +444,12 @@ function check_markup($text, $format = F // 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, $context, $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, $context, $cache_id); } // Store in cache with a minimum expiration time of 1 day. @@ -600,7 +604,7 @@ function theme_filter_tips_more_info() { * - URL and e-mail address filter: * Converts newlines into paragraph and break tags. */ -function filter_filter($op, $delta = 0, $format = -1, $text = '') { +function filter_filter($op, $delta = 0, $format = -1, $text = '', $context = NULL) { switch ($op) { case 'list': return array(0 => t('HTML filter'), 1 => t('Line break converter'), 2 => t('URL filter'), 3 => t('HTML corrector')); Index: modules/node/node.module =================================================================== RCS file: /cvs/drupal/drupal/modules/node/node.module,v retrieving revision 1.950 diff -u -p -r1.950 node.module --- modules/node/node.module 20 Feb 2008 13:46:40 -0000 1.950 +++ modules/node/node.module 26 Feb 2008 13:48:55 -0000 @@ -1035,10 +1035,10 @@ function node_prepare($node, $teaser = F $node->readmore = (strlen($node->teaser) < strlen($node->body)); if ($teaser == FALSE) { - $node->body = check_markup($node->body, $node->format, FALSE); + $node->body = apply_filters($node->body, array('node' => $node), $node->format, FALSE); } else { - $node->teaser = check_markup($node->teaser, $node->format, FALSE); + $node->teaser = apply_filters($node->teaser, array('node' => $node), $node->format, FALSE); } $node->content['body'] = array( Index: modules/php/php.module =================================================================== RCS file: /cvs/drupal/drupal/modules/php/php.module,v retrieving revision 1.9 diff -u -p -r1.9 php.module --- modules/php/php.module 10 Feb 2008 19:57:20 -0000 1.9 +++ modules/php/php.module 26 Feb 2008 13:48:55 -0000 @@ -69,7 +69,7 @@ else { * * Executes PHP code. Use with care. */ -function php_filter($op, $delta = 0, $format = -1, $text = '') { +function php_filter($op, $delta = 0, $format = -1, $text = '', $context = NULL) { switch ($op) { case 'list': return array(0 => t('PHP evaluator')); Index: modules/profile/profile.module =================================================================== RCS file: /cvs/drupal/drupal/modules/profile/profile.module,v retrieving revision 1.236 diff -u -p -r1.236 profile.module --- modules/profile/profile.module 3 Feb 2008 19:36:46 -0000 1.236 +++ modules/profile/profile.module 26 Feb 2008 13:48:55 -0000 @@ -254,7 +254,7 @@ function profile_view_field($user, $fiel if (isset($user->{$field->name}) && $value = $user->{$field->name}) { switch ($field->type) { case 'textarea': - return check_markup($value); + return apply_filters($value); case 'textfield': case 'selection': return $browse ? l($value, 'profile/'. $field->name .'/'. $value) : check_plain($value); Index: modules/user/user.module =================================================================== RCS file: /cvs/drupal/drupal/modules/user/user.module,v retrieving revision 1.896 diff -u -p -r1.896 user.module --- modules/user/user.module 20 Feb 2008 13:46:43 -0000 1.896 +++ modules/user/user.module 26 Feb 2008 13:48:55 -0000 @@ -1965,7 +1965,7 @@ function user_comment(&$comment, $op) { // Validate signature. if ($op == 'view') { if (variable_get('user_signatures', 0) && !empty($comment->signature)) { - $comment->signature = check_markup($comment->signature, $comment->format); + $comment->signature = apply_filters($comment->signature, array('comment' => $comment), $comment->format); } else { $comment->signature = '';