diff options
author | Angie Byron <webchick@24967.no-reply.drupal.org> | 2011-01-14 08:37:20 +0000 |
---|---|---|
committer | Angie Byron <webchick@24967.no-reply.drupal.org> | 2011-01-14 08:37:20 +0000 |
commit | 5791f3724b0a395bc21f03b2cdf860fbc2b41a79 (patch) | |
tree | 56527246772de7a2f11a1dace0f02cf0e1629485 /includes | |
parent | da1a859349170aa42494e8588c37570e644f9c6d (diff) | |
download | brdo-5791f3724b0a395bc21f03b2cdf860fbc2b41a79.tar.gz brdo-5791f3724b0a395bc21f03b2cdf860fbc2b41a79.tar.bz2 |
#460448 follow-up by ridgerunner: Further optimize CSS aggregation regex.
Diffstat (limited to 'includes')
-rw-r--r-- | includes/common.inc | 17 |
1 files changed, 5 insertions, 12 deletions
diff --git a/includes/common.inc b/includes/common.inc index 28377d71a..62a5037f0 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. @@ -3569,16 +3572,6 @@ function drupal_load_stylesheet_content($contents, $optimize = FALSE) { } /** - * 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. * * This function is used for recursive loading of stylesheets and |