diff options
author | Andreas Fischer <bantu@phpbb.com> | 2010-08-22 21:50:17 +0200 |
---|---|---|
committer | Andreas Fischer <bantu@phpbb.com> | 2010-08-22 21:50:17 +0200 |
commit | cd46b399678db9f7a10f6395b2920135800c41fd (patch) | |
tree | c764ae7ff6626787d1137b1acf774872839b89b9 | |
parent | e4a1f08364c29693680c01f14cbd46e5d48ee972 (diff) | |
parent | c3a5fd30eea8b5426adfc9318d6e6b89616bc071 (diff) | |
download | forums-cd46b399678db9f7a10f6395b2920135800c41fd.tar forums-cd46b399678db9f7a10f6395b2920135800c41fd.tar.gz forums-cd46b399678db9f7a10f6395b2920135800c41fd.tar.bz2 forums-cd46b399678db9f7a10f6395b2920135800c41fd.tar.xz forums-cd46b399678db9f7a10f6395b2920135800c41fd.zip |
Merge branch 'ticket/jellydoughnut/9646' into develop-olympus
* ticket/jellydoughnut/9646:
[ticket/9646] Honor CSS comments in @import statements
-rw-r--r-- | phpBB/includes/acp/acp_styles.php | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/phpBB/includes/acp/acp_styles.php b/phpBB/includes/acp/acp_styles.php index 3310560c73..95b700c876 100644 --- a/phpBB/includes/acp/acp_styles.php +++ b/phpBB/includes/acp/acp_styles.php @@ -2531,13 +2531,21 @@ parse_css_file = {PARSE_CSS_FILE} // Match CSS imports $matches = array(); - preg_match_all('/@import url\(["\'](.*)["\']\);/i', $stylesheet, $matches); + preg_match_all('/@import url\((["\'])(.*)\1\);/i', $stylesheet, $matches); + + // remove commented stylesheets (very simple parser, allows only whitespace + // around an @import statement) + preg_match_all('#/\*\s*@import url\((["\'])(.*)\1\);\s\*/#i', $stylesheet, $commented); + $matches[2] = array_diff($matches[2], $commented[2]); if (sizeof($matches)) { foreach ($matches[0] as $idx => $match) { - $stylesheet = str_replace($match, acp_styles::load_css_file($theme_row['theme_path'], $matches[1][$idx]), $stylesheet); + if (isset($matches[2][$idx])) + { + $stylesheet = str_replace($match, acp_styles::load_css_file($theme_row['theme_path'], $matches[2][$idx]), $stylesheet); + } } } |