summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
Diffstat (limited to 'modules')
-rw-r--r--modules/comment/helpers/comment_theme.php2
-rw-r--r--modules/digibug/helpers/digibug_theme.php2
-rw-r--r--modules/gallery/helpers/gallery.php2
-rw-r--r--modules/gallery/helpers/gallery_theme.php20
-rw-r--r--modules/gallery/libraries/Gallery_View.php66
-rw-r--r--modules/organize/helpers/organize_theme.php6
-rw-r--r--modules/server_add/helpers/server_add_theme.php8
-rw-r--r--modules/tag/helpers/tag_theme.php4
-rw-r--r--modules/user/helpers/user_theme.php2
9 files changed, 50 insertions, 62 deletions
diff --git a/modules/comment/helpers/comment_theme.php b/modules/comment/helpers/comment_theme.php
index 89b2f57c..b807e2cf 100644
--- a/modules/comment/helpers/comment_theme.php
+++ b/modules/comment/helpers/comment_theme.php
@@ -19,7 +19,7 @@
*/
class comment_theme_Core {
static function head($theme) {
- $theme->script("modules/comment/js/comment.js");
+ $theme->script("comment.js");
return "";
}
diff --git a/modules/digibug/helpers/digibug_theme.php b/modules/digibug/helpers/digibug_theme.php
index f94d07c6..ceda55b5 100644
--- a/modules/digibug/helpers/digibug_theme.php
+++ b/modules/digibug/helpers/digibug_theme.php
@@ -19,6 +19,6 @@
*/
class digibug_theme_Core {
static function head($theme) {
- $theme->script("modules/digibug/js/digibug.js");
+ $theme->script("digibug.js");
}
}
diff --git a/modules/gallery/helpers/gallery.php b/modules/gallery/helpers/gallery.php
index a32ac484..2fa7ad1c 100644
--- a/modules/gallery/helpers/gallery.php
+++ b/modules/gallery/helpers/gallery.php
@@ -18,7 +18,7 @@
* Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
*/
class gallery_Core {
- const VERSION = "3.0 beta 2";
+ const VERSION = "3.0 git (pre-beta3)";
/**
* If Gallery is in maintenance mode, then force all non-admins to get routed to a "This site is
diff --git a/modules/gallery/helpers/gallery_theme.php b/modules/gallery/helpers/gallery_theme.php
index f245ea31..998eb289 100644
--- a/modules/gallery/helpers/gallery_theme.php
+++ b/modules/gallery/helpers/gallery_theme.php
@@ -22,12 +22,12 @@ class gallery_theme_Core {
$session = Session::instance();
$buf = "";
if ($session->get("debug")) {
- $theme->css("modules/gallery/css/debug.css");
+ $theme->css("debug.css");
}
if (($theme->page_type == "album" || $theme->page_type == "photo")
&& access::can("edit", $theme->item())) {
- $theme->css("modules/gallery/css/quick.css");
- $theme->script("modules/gallery/js/quick.js");
+ $theme->css("quick.css");
+ $theme->script("quick.js");
}
if (module::is_active("rss")) {
@@ -43,9 +43,9 @@ class gallery_theme_Core {
}
if ($session->get("l10n_mode", false)) {
- $theme->css("modules/gallery/css/l10n_client.css");
- $theme->script("lib/jquery.cookie.js");
- $theme->script("modules/gallery/js/l10n_client.js");
+ $theme->css("l10n_client.css");
+ $theme->script("jquery.cookie.js");
+ $theme->script("l10n_client.js");
}
return $buf;
@@ -80,13 +80,13 @@ class gallery_theme_Core {
static function admin_head($theme) {
$session = Session::instance();
if ($session->get("debug")) {
- $theme->css("modules/gallery/css/debug.css");
+ $theme->css("debug.css");
}
if ($session->get("l10n_mode", false)) {
- $theme->css("modules/gallery/css/l10n_client.css");
- $theme->script("lib/jquery.cookie.js");
- $theme->script("modules/gallery/js/l10n_client.js");
+ $theme->css("l10n_client.css");
+ $theme->script("jquery.cookie.js");
+ $theme->script("l10n_client.js");
}
}
diff --git a/modules/gallery/libraries/Gallery_View.php b/modules/gallery/libraries/Gallery_View.php
index 31231ca6..219cc883 100644
--- a/modules/gallery/libraries/Gallery_View.php
+++ b/modules/gallery/libraries/Gallery_View.php
@@ -27,24 +27,20 @@ class Gallery_View_Core extends View {
* @param $file the relative path to a script from the gallery3 directory
*/
public function script($file) {
- $this->scripts[$file] = 1;
- }
-
- /**
- * Add a script to the combined scripts list.
- * @param $file the relative path to a script from the base of the active theme
- * @param
- */
- public function theme_script($file) {
- $file = "themes/{$this->theme_name}/$file";
- $this->scripts[$file] = 1;
+ $base_file = str_replace(".js", "", $file);
+ if (($path = Kohana::find_file("js", $base_file, false, "js")) ||
+ file_exists($path = DOCROOT . "lib/$file")) {
+ $this->scripts[$path] = 1;
+ } else {
+ Kohana::log("error", "Can't find script file: $file");
+ }
}
/**
* Provide a url to a resource within the current theme. This allows us to refer to theme
* resources without naming the theme itself which makes themes easier to copy.
*/
- public function theme_url($path, $absolute_url=false) {
+ public function url($path, $absolute_url=false) {
$arg = "themes/{$this->theme_name}/$path";
return $absolute_url ? url::abs_file($arg) : url::file($arg);
}
@@ -53,27 +49,23 @@ class Gallery_View_Core extends View {
* 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;
+ public function css($file) {
+ $base_file = str_replace(".css", "", $file);
+ if (($path = Kohana::find_file("css", $base_file, false, "css")) ||
+ file_exists($path = DOCROOT . "lib/$file")) {
+ $this->css[$path] = 1;
+ } else {
+ Kohana::log("error", "Can't find css file: $file");
+ }
}
/**
* Combine a series of files into a single one and cache it in the database.
*/
- protected function combine_files($files, $type) {
+ protected function combine_files($paths, $type) {
$links = array();
- if (empty($files)) {
+ if (empty($paths)) {
return;
}
@@ -81,16 +73,10 @@ class Gallery_View_Core extends View {
// entries.
$key = array(url::abs_file(""));
- foreach (array_keys($files) as $file) {
- $path = DOCROOT . $file;
- if (file_exists($path)) {
- $stats = stat($path);
- $links[$file] = $path;
- // 7 == size, 9 == mtime, see http://php.net/stat
- $key[] = "$file $stats[7] $stats[9]";
- } else {
- Kohana::log("error", "missing file ($type): $file");
- }
+ foreach (array_keys($paths) as $path) {
+ $stats = stat($path);
+ // 7 == size, 9 == mtime, see http://php.net/stat
+ $key[] = "$path $stats[7] $stats[9]";
}
$key = md5(join(" ", $key));
@@ -99,11 +85,13 @@ class Gallery_View_Core extends View {
if (empty($contents)) {
$contents = "";
- foreach ($links as $file => $link) {
+ $docroot_len = strlen(DOCROOT);
+ foreach (array_keys($paths) as $path) {
+ $relative = substr($path, $docroot_len);
if ($type == "css") {
- $contents .= "/* $file */\n" . $this->process_css($link) . "\n";
+ $contents .= "/* $relative */\n" . $this->process_css($path) . "\n";
} else {
- $contents .= "/* $file */\n" . file_get_contents($link) . "\n";
+ $contents .= "/* $relative */\n" . file_get_contents($path) . "\n";
}
}
diff --git a/modules/organize/helpers/organize_theme.php b/modules/organize/helpers/organize_theme.php
index 02f1f589..e4feba2b 100644
--- a/modules/organize/helpers/organize_theme.php
+++ b/modules/organize/helpers/organize_theme.php
@@ -20,8 +20,8 @@
class organize_theme {
static function head($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");
- $theme->css("modules/organize/css/organize.css");
+ $theme->script("organize_init.js");
+ $theme->script("organize.js");
+ $theme->css("organize.css");
}
}
diff --git a/modules/server_add/helpers/server_add_theme.php b/modules/server_add/helpers/server_add_theme.php
index 02f99690..2ba2e167 100644
--- a/modules/server_add/helpers/server_add_theme.php
+++ b/modules/server_add/helpers/server_add_theme.php
@@ -20,20 +20,20 @@
class server_add_theme_Core {
static function head($theme) {
if (user::active()->admin) {
- $theme->script("modules/server_add/js/server_add.js");
+ $theme->script("server_add.js");
}
}
static function admin_head($theme) {
$head = array();
if (strpos(Router::$current_uri, "admin/server_add") !== false) {
- $theme->css("lib/jquery.autocomplete.css");
+ $theme->css("jquery.autocomplete.css");
$base = url::site("__ARGS__");
$csrf = access::csrf_token();
$head[] = "<script> var base_url = \"$base\"; var csrf = \"$csrf\";</script>";
- $theme->script("lib/jquery.autocomplete.js");
- $theme->script("modules/server_add/js/admin.js");
+ $theme->script("jquery.autocomplete.js");
+ $theme->script("admin.js");
}
return implode("\n", $head);
diff --git a/modules/tag/helpers/tag_theme.php b/modules/tag/helpers/tag_theme.php
index fe30354f..d46a91e9 100644
--- a/modules/tag/helpers/tag_theme.php
+++ b/modules/tag/helpers/tag_theme.php
@@ -19,11 +19,11 @@
*/
class tag_theme_Core {
static function head($theme) {
- $theme->script("modules/tag/js/tag.js");
+ $theme->script("tag.js");
}
static function admin_head($theme) {
- $theme->script("modules/tag/js/tag.js");
+ $theme->script("tag.js");
}
static function sidebar_blocks($theme) {
diff --git a/modules/user/helpers/user_theme.php b/modules/user/helpers/user_theme.php
index ad9d4c63..c5351f8e 100644
--- a/modules/user/helpers/user_theme.php
+++ b/modules/user/helpers/user_theme.php
@@ -26,7 +26,7 @@ class user_theme_Core {
static function admin_head($theme) {
if (strpos(Router::$current_uri, "admin/users") !== false) {
- $theme->script("lib/gallery.panel.js");
+ $theme->script("gallery.panel.js");
}
}
}