我应该如何使用filter_xss?尽管我';我正在使用它,编码器给了我一个问题


How am I supposed to be using filter_xss? Even though I'm using it, coder gives me an issue

+269:[严重]潜在问题:drupal_set_messagehttp://api.drupal.org/api/function/drupal_set_message/((只接受过滤后的文本,请确保全部!t中$variables的占位符http://api.drupal.org/api/function/t/((使用检查_搁置http://api.drupal.org/api/function/check_plain/((,过滤器xsshttp://api.drupal.org/api/function/filter_xss/((或相像的

与此代码相关的:

      drupal_set_message(t('Batch complete!  View/Download !results', array(
        '!results' => filter_xss(l(t('simple results'), file_create_url($filename))),
      )), 'info');

怎么了?

您使用的方法位于可翻译字符串中动态或静态链接的"不要做这些事情"部分下。您需要将其更改为已批准的方法之一。供参考:

<?php
  // DO NOT DO THESE THINGS
  $BAD_EXTERNAL_LINK = t('Look at Drupal documentation at !handbook.', array('!handbook' => '<a href="http://drupal.org/handbooks">'. t('the Drupal Handbooks') .'</a>'));
  $ANOTHER_BAD_EXTERNAL_LINK = t('Look at Drupal documentation at <a href="http://drupal.org/handbooks">the Drupal Handbooks</a>.');
  $BAD_INTERNAL_LINK = t('To get an overview of your administration options, go to !administer in the main menu.', array('!administer' => l(t('the Administer screen'), 'admin'));
  // Do this instead.
  $external_link = t('Look at Drupal documentation at <a href="@drupal-handbook">the Drupal Handbooks</a>.', array('@drupal-handbook' => 'http://drupal.org/handbooks'));
  $internal_link = t('To get an overview of your administration options, go to <a href="@administer-page">the Administer screen</a> in the main menu.', array('@administer-page' => url('admin')));
?>