diff --git a/includes/common.inc b/includes/common.inc index 28377d71a34de8ee369511862730d31e1e638f62..62a5037f01a34a26cbb068cfd7037097fb3e2960 100644 --- a/includes/common.inc +++ b/includes/common.inc @@ -3543,7 +3543,7 @@ function drupal_load_stylesheet_content($contents, $optimize = FALSE) { // There are different conditions for removing leading and trailing // whitespace. // @see http://php.net/manual/en/regexp.reference.subpatterns.php - $contents = preg_replace_callback('< + $contents = preg_replace('< # Strip leading and trailing whitespace. \s*([@{};,])\s* # Strip only leading whitespace from: @@ -3554,7 +3554,10 @@ function drupal_load_stylesheet_content($contents, $optimize = FALSE) { # - Colon: Retain :pseudo-selectors. | ([\(:])\s+ >xS', - '_drupal_load_stylesheet_content', + // Only one of the three capturing groups will match, so its reference + // will contain the wanted value and the references for the + // two non-matching groups will be replaced with empty strings. + '$1$2$3', $contents ); // End the file with a new line. @@ -3568,16 +3571,6 @@ function drupal_load_stylesheet_content($contents, $optimize = FALSE) { return $contents; } -/** - * Helper for drupal_load_stylesheet_content(). - */ -function _drupal_load_stylesheet_content($matches) { - // Discard the full match. - unset($matches[0]); - // Use the non-empty match. - return current(array_filter($matches)); -} - /** * Loads stylesheets recursively and returns contents with corrected paths. *