summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBharat Mediratta <bharat@menalto.com>2013-02-02 23:39:16 -0500
committerBharat Mediratta <bharat@menalto.com>2013-02-02 23:39:16 -0500
commitdece6dc5a5880c6267431ba3299c5758b38662ee (patch)
tree25692478d340f9b457194c397191ee2f19c83f17
parent314e2e67b1d52b7d01a715d7a6680862bf83b987 (diff)
Create gallery::allow_css_and_js_combining() which lets you disable combining CSS/JS
by touching var/DONT_COMBINE. Fixes #1989.
-rw-r--r--modules/gallery/helpers/gallery.php8
-rw-r--r--modules/gallery/libraries/Gallery_View.php6
2 files changed, 12 insertions, 2 deletions
diff --git a/modules/gallery/helpers/gallery.php b/modules/gallery/helpers/gallery.php
index 725a710d..f1f7190c 100644
--- a/modules/gallery/helpers/gallery.php
+++ b/modules/gallery/helpers/gallery.php
@@ -222,4 +222,12 @@ class gallery_Core {
static function show_profiler() {
return file_exists(VARPATH . "PROFILE");
}
+
+ /**
+ * Return true if we should allow Javascript and CSS combining for performance reasons.
+ * Typically we want this, but it's convenient for developers to be able to disable it.
+ */
+ static function allow_css_and_js_combining() {
+ return !file_exists(VARPATH . "DONT_COMBINE");
+ }
} \ No newline at end of file
diff --git a/modules/gallery/libraries/Gallery_View.php b/modules/gallery/libraries/Gallery_View.php
index 64fea0ad..8f02b53c 100644
--- a/modules/gallery/libraries/Gallery_View.php
+++ b/modules/gallery/libraries/Gallery_View.php
@@ -82,8 +82,10 @@ class Gallery_View_Core extends View {
* @param $types a comma separated list of types to combine, eg "script,css"
*/
public function start_combining($types) {
- foreach (explode(",", $types) as $type) {
- $this->combine_queue[$type] = array();
+ if (gallery::allow_css_and_js_combining()) {
+ foreach (explode(",", $types) as $type) {
+ $this->combine_queue[$type] = array();
+ }
}
}