function _process_comment

6.x common.inc _process_comment($matches)

Process comment blocks.

This is the callback function for the preg_replace_callback() used in drupal_load_stylesheet_content(). Support for comment hacks is implemented here.

File

drupal-6.x/includes/common.inc, line 2105
Common functions that many Drupal modules will need to reference.

Code

function _process_comment($matches) {
  static $keep_nextone = FALSE;

  // Quoted string, keep it.
  if ($matches[0][0] == "'" || $matches[0][0] == '"') {
    return $matches[0];
  }
  // End of IE-Mac hack, keep it.
  if ($keep_nextone) {
    $keep_nextone = FALSE;
    return $matches[0];
  }
  switch (strrpos($matches[0], '\\')) {
    case FALSE:
      // No backslash, strip it.
      return '';

    case drupal_strlen($matches[0]) -3:
      // Ends with \*/ so is a multi line IE-Mac hack, keep the next one also.
      $keep_nextone = TRUE;
      return '/*_\*/';

    default :
      // Single line IE-Mac hack.
      return '/*\_*/';
  }
}