summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--modules/gallery/helpers/gallery_theme.php18
-rw-r--r--modules/gallery/libraries/Gallery_View.php35
-rw-r--r--modules/gallery/libraries/Theme_View.php3
-rw-r--r--modules/organize/helpers/organize_theme.php3
-rw-r--r--modules/server_add/helpers/server_add_theme.php3
-rw-r--r--themes/admin_default/views/admin.html.php19
-rw-r--r--themes/default/views/page.html.php15
7 files changed, 56 insertions, 40 deletions
diff --git a/modules/gallery/helpers/gallery_theme.php b/modules/gallery/helpers/gallery_theme.php
index cffecb12..0e3150bc 100644
--- a/modules/gallery/helpers/gallery_theme.php
+++ b/modules/gallery/helpers/gallery_theme.php
@@ -22,13 +22,11 @@ class gallery_theme_Core {
$session = Session::instance();
$buf = "";
if ($session->get("debug")) {
- $buf .= "<link rel=\"stylesheet\" type=\"text/css\" href=\"" .
- url::file("modules/gallery/css/debug.css") . "\" />";
+ $theme->css("modules/gallery/css/debug.css");
}
if (($theme->page_type == "album" || $theme->page_type == "photo")
&& access::can("edit", $theme->item())) {
- $buf .= "<link rel=\"stylesheet\" type=\"text/css\" href=\"" .
- url::file("modules/gallery/css/quick.css") . "\" />";
+ $theme->css("modules/gallery/css/quick.css");
$theme->script("modules/gallery/js/quick.js");
}
@@ -41,8 +39,7 @@ class gallery_theme_Core {
}
if ($session->get("l10n_mode", false)) {
- $buf .= "<link rel=\"stylesheet\" type=\"text/css\" href=\"" .
- url::file("modules/gallery/css/l10n_client.css") . "\" />";
+ $theme->css("modules/gallery/css/l10n_client.css");
$theme->script("lib/jquery.cookie.js");
$theme->script("modules/gallery/js/l10n_client.js");
}
@@ -78,20 +75,15 @@ class gallery_theme_Core {
static function admin_head($theme) {
$session = Session::instance();
- $buf = "";
if ($session->get("debug")) {
- $buf .= "<link rel=\"stylesheet\" type=\"text/css\" href=\"" .
- url::file("modules/gallery/css/debug.css") . "\" />";
+ $theme->css("modules/gallery/css/debug.css");
}
if ($session->get("l10n_mode", false)) {
- $buf .= "<link rel=\"stylesheet\" type=\"text/css\" href=\"" .
- url::file("modules/gallery/css/l10n_client.css") . "\" />";
+ $theme->css("modules/gallery/css/l10n_client.css");
$theme->script("lib/jquery.cookie.js");
$theme->script("modules/gallery/js/l10n_client.js");
}
-
- return $buf;
}
static function page_bottom($theme) {
diff --git a/modules/gallery/libraries/Gallery_View.php b/modules/gallery/libraries/Gallery_View.php
index e21e83d8..7000d3de 100644
--- a/modules/gallery/libraries/Gallery_View.php
+++ b/modules/gallery/libraries/Gallery_View.php
@@ -20,6 +20,7 @@
class Gallery_View_Core extends View {
protected $theme_name = null;
protected $scripts = array();
+ protected $css = array();
/**
* Add a script to the combined scripts list.
@@ -86,4 +87,38 @@ class Gallery_View_Core extends View {
return "<script type=\"text/javascript\" src=\"" . url::site("combined/javascript/$key") .
"\"></script>";
}
+
+ /**
+ * Add a css file to the combined css list.
+ * @param $file the relative path to a script from the gallery3 directory
+ */
+ public function css($file, $theme_relative=false) {
+ $this->css[$file] = 1;
+ }
+
+ /**
+ * Add a css file to the combined css list.
+ * @param $file the relative path to a script from the base of the active theme
+ * @param
+ */
+ public function theme_css($file) {
+ $file = "themes/{$this->theme_name}/$file";
+ $this->css[$file] = 1;
+ }
+
+ /**
+ * Combine a series of Javascript files into a single one and cache it in the database, then
+ * return a single <script> element to refer to it.
+ */
+ protected function combine_css() {
+ $links = array();
+ $key = "";
+ foreach (array_keys($this->css) as $file) {
+ $links[] = "<link media=\"screen, projection\" rel=\"stylesheet\" type=\"text/css\" href=\"" .
+ url::file($file) . "\" />";
+
+ }
+ return implode("\n", $links);
+ }
+
} \ No newline at end of file
diff --git a/modules/gallery/libraries/Theme_View.php b/modules/gallery/libraries/Theme_View.php
index 8e320f44..bc8e540a 100644
--- a/modules/gallery/libraries/Theme_View.php
+++ b/modules/gallery/libraries/Theme_View.php
@@ -201,8 +201,8 @@ class Theme_View_Core extends Gallery_View {
array("gallery_theme", $function),
array_merge(array($this), $args));
}
-
}
+
foreach (module::active() as $module) {
if ($module->name == "gallery") {
continue;
@@ -216,6 +216,7 @@ class Theme_View_Core extends Gallery_View {
}
if ($function == "head") {
+ array_unshift($blocks, $this->combine_css());
array_unshift($blocks, $this->combine_script());
}
diff --git a/modules/organize/helpers/organize_theme.php b/modules/organize/helpers/organize_theme.php
index cddc48b6..02f1f589 100644
--- a/modules/organize/helpers/organize_theme.php
+++ b/modules/organize/helpers/organize_theme.php
@@ -22,7 +22,6 @@ class organize_theme {
// @tdo remove the addition css and organize.js (just here to test)
$theme->script("modules/organize/js/organize_init.js");
$theme->script("modules/organize/js/organize.js");
- return "<link rel=\"stylesheet\" type=\"text/css\" href=\"" .
- url::file("modules/organize/css/organize.css") . "\" />";
+ $theme->css("modules/organize/css/organize.css");
}
}
diff --git a/modules/server_add/helpers/server_add_theme.php b/modules/server_add/helpers/server_add_theme.php
index 3df57ee4..02f99690 100644
--- a/modules/server_add/helpers/server_add_theme.php
+++ b/modules/server_add/helpers/server_add_theme.php
@@ -27,8 +27,7 @@ class server_add_theme_Core {
static function admin_head($theme) {
$head = array();
if (strpos(Router::$current_uri, "admin/server_add") !== false) {
- $head[] = "<link media=\"screen, projection\" rel=\"stylesheet\" type=\"text/css\" href=\"" .
- url::file("lib/jquery.autocomplete.css") . "\" />";
+ $theme->css("lib/jquery.autocomplete.css");
$base = url::site("__ARGS__");
$csrf = access::csrf_token();
$head[] = "<script> var base_url = \"$base\"; var csrf = \"$csrf\";</script>";
diff --git a/themes/admin_default/views/admin.html.php b/themes/admin_default/views/admin.html.php
index 62f9761f..2a231057 100644
--- a/themes/admin_default/views/admin.html.php
+++ b/themes/admin_default/views/admin.html.php
@@ -6,19 +6,14 @@
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
<title><?= t("Admin Dashboard") ?></title>
<link rel="shortcut icon" href="<?= url::file("themes/default/images/favicon.ico") ?>" type="image/x-icon" />
- <link rel="stylesheet" type="text/css" href="<?= url::file("lib/yui/reset-fonts-grids.css") ?>"
- media="screen,projection" />
- <link rel="stylesheet" type="text/css" type="text/css" href="<?= url::file("lib/themeroller/ui.base.css") ?>"
- media="screen,projection" />
- <link rel="stylesheet" type="text/css" href="<?= url::file("lib/superfish/css/superfish.css") ?>"
- media="screen,projection" />
- <link rel="stylesheet" type="text/css" href="<?= url::file("themes/default/css/screen.css") ?>"
- media="screen,projection" />
- <link rel="stylesheet" type="text/css" href="<?= $theme->theme_url("css/screen.css") ?>"
- media="screen,projection" />
+
+ <?= $theme->css("lib/yui/reset-fonts-grids.css") ?>
+ <?= $theme->css("lib/themeroller/ui.base.css") ?>
+ <?= $theme->css("lib/superfish/css/superfish.css") ?>
+ <?= $theme->css("themes/default/css/screen.css") ?>
+ <?= $theme->theme_css("css/screen.css") ?>
<!--[if IE]>
- <link rel="stylesheet" type="text/css" href="<?= $theme->theme_url("css/fix-ie.css") ?>"
- media="screen,print,projection" />
+ <?= $theme->theme_css("css/fix-ie.css") ?>
<![endif]-->
<?= $theme->script("lib/jquery.js") ?>
diff --git a/themes/default/views/page.html.php b/themes/default/views/page.html.php
index 3ae3e155..f6984958 100644
--- a/themes/default/views/page.html.php
+++ b/themes/default/views/page.html.php
@@ -24,17 +24,12 @@
<? endif ?>
</title>
<link rel="shortcut icon" href="<?= $theme->theme_url("images/favicon.ico") ?>" type="image/x-icon" />
- <link rel="stylesheet" type="text/css" href="<?= url::file("lib/yui/reset-fonts-grids.css") ?>"
- media="screen,print,projection" />
- <link rel="stylesheet" type="text/css" href="<?= url::file("lib/superfish/css/superfish.css") ?>"
- media="screen" />
- <link rel="stylesheet" type="text/css" href="<?= url::file("lib/themeroller/ui.base.css") ?>"
- media="screen,print,projection" />
- <link rel="stylesheet" type="text/css" href="<?= $theme->theme_url("css/screen.css") ?>"
- media="screen,print,projection" />
+ <?= $theme->css("lib/yui/reset-fonts-grids.css") ?>
+ <?= $theme->css("lib/themeroller/ui.base.css") ?>
+ <?= $theme->css("lib/superfish/css/superfish.css") ?>
+ <?= $theme->theme_css("css/screen.css") ?>
<!--[if lt IE 8]>
- <link rel="stylesheet" type="text/css" href="<?= $theme->theme_url("css/fix-ie.css") ?>"
- media="screen,print,projection" />
+ <?= $theme->theme_css("css/fix-ie.css") ?>
<![endif]-->
<? if ($theme->page_type == 'album'): ?>
<? if ($thumb_proportion != 1): ?>