diff options
-rw-r--r-- | modules/gallery/controllers/albums.php | 17 | ||||
-rw-r--r-- | modules/gallery/controllers/movies.php | 17 | ||||
-rw-r--r-- | modules/gallery/controllers/photos.php | 17 | ||||
-rw-r--r-- | modules/gallery/libraries/Admin_View.php | 10 | ||||
-rw-r--r-- | modules/gallery/libraries/MY_View.php | 10 | ||||
-rw-r--r-- | modules/gallery/libraries/Theme_View.php | 10 | ||||
-rw-r--r-- | modules/search/controllers/search.php | 8 | ||||
-rw-r--r-- | modules/tag/controllers/tag.php | 12 |
8 files changed, 55 insertions, 46 deletions
diff --git a/modules/gallery/controllers/albums.php b/modules/gallery/controllers/albums.php index c0368488..25df0da7 100644 --- a/modules/gallery/controllers/albums.php +++ b/modules/gallery/controllers/albums.php @@ -61,14 +61,15 @@ class Albums_Controller extends Items_Controller { } $template = new Theme_View("page.html", "collection", "album"); - $template->set_global("page", $page); - $template->set_global("page_title", null); - $template->set_global("max_pages", $max_pages); - $template->set_global("page_size", $page_size); - $template->set_global("item", $album); - $template->set_global("children", $album->viewable()->children($page_size, $offset)); - $template->set_global("children_count", $children_count); - $template->set_global("parents", $album->parents()->as_array()); // view calls empty() on this + $template->set_global( + array("page" => $page, + "page_title" => null, + "max_pages" => $max_pages, + "page_size" => $page_size, + "item" => $album, + "children" => $album->viewable()->children($page_size, $offset), + "parents" => $album->parents()->as_array(), // view calls empty() on this + "children_count" => $children_count)); $template->content = new View("album.html"); $album->increment_view_count(); diff --git a/modules/gallery/controllers/movies.php b/modules/gallery/controllers/movies.php index 15d4f950..bf50abd5 100644 --- a/modules/gallery/controllers/movies.php +++ b/modules/gallery/controllers/movies.php @@ -38,14 +38,15 @@ class Movies_Controller extends Items_Controller { } $template = new Theme_View("page.html", "item", "movie"); - $template->set_global("item", $movie); - $template->set_global("children", array()); - $template->set_global("children_count", 0); - $template->set_global("parents", $movie->parents()->as_array()); - $template->set_global("next_item", $next_item); - $template->set_global("previous_item", $previous_item); - $template->set_global("sibling_count", $movie->parent()->viewable()->children_count($where)); - $template->set_global("position", $position); + $template->set_global( + array("item" => $movie, + "children" => array(), + "children_count" => 0, + "parents" => $movie->parents()->as_array(), + "next_item" => $next_item, + "previous_item" => $previous_item, + "sibling_count" => $movie->parent()->viewable()->children_count($where), + "position" => $position)); $template->content = new View("movie.html"); diff --git a/modules/gallery/controllers/photos.php b/modules/gallery/controllers/photos.php index 2dc22ca4..d500a92e 100644 --- a/modules/gallery/controllers/photos.php +++ b/modules/gallery/controllers/photos.php @@ -38,14 +38,15 @@ class Photos_Controller extends Items_Controller { } $template = new Theme_View("page.html", "item", "photo"); - $template->set_global("item", $photo); - $template->set_global("children", array()); - $template->set_global("children_count", 0); - $template->set_global("parents", $photo->parents()->as_array()); - $template->set_global("next_item", $next_item); - $template->set_global("previous_item", $previous_item); - $template->set_global("sibling_count", $photo->parent()->viewable()->children_count($where)); - $template->set_global("position", $position); + $template->set_global( + array("item" => $photo, + "children" => array(), + "children_count" => 0, + "parents" => $photo->parents()->as_array(), + "next_item" => $next_item, + "previous_item" => $previous_item, + "sibling_count" => $photo->parent()->viewable()->children_count($where), + "position" => $position)); $template->content = new View("photo.html"); diff --git a/modules/gallery/libraries/Admin_View.php b/modules/gallery/libraries/Admin_View.php index bff13ace..28a003cc 100644 --- a/modules/gallery/libraries/Admin_View.php +++ b/modules/gallery/libraries/Admin_View.php @@ -34,11 +34,11 @@ class Admin_View_Core extends Gallery_View { $this->theme_name = Input::instance()->get("theme", $this->theme_name); } $this->sidebar = ""; - $this->set_global("theme", $this); - $this->set_global("user", identity::active_user()); - $this->set_global("page_type", "admin"); - $this->set_global("page_subtype", $name); - $this->set_global("page_title", null); + $this->set_global(array("theme" => $this, + "user" => identity::active_user(), + "page_type" => "admin", + "page_subtype" => $name, + "page_title" => null)); } public function admin_menu() { diff --git a/modules/gallery/libraries/MY_View.php b/modules/gallery/libraries/MY_View.php index ded77792..2230203a 100644 --- a/modules/gallery/libraries/MY_View.php +++ b/modules/gallery/libraries/MY_View.php @@ -23,8 +23,14 @@ class View extends View_Core { /** * Reimplement Kohana 2.3's View::set_global() functionality. */ - public function set_global($key, $value) { - View::$global_data[$key] = $value; + public function set_global($key, $value = NULL) { + if (is_array($key)) { + foreach ($key as $key2 => $value) { + View::$global_data[$key2] = $value; + } + } else { + View::$global_data[$key] = $value; + } } public function is_set($key=null) { diff --git a/modules/gallery/libraries/Theme_View.php b/modules/gallery/libraries/Theme_View.php index d22bb03a..ba1862c0 100644 --- a/modules/gallery/libraries/Theme_View.php +++ b/modules/gallery/libraries/Theme_View.php @@ -37,11 +37,11 @@ class Theme_View_Core extends Gallery_View { } $this->item = null; $this->tag = null; - $this->set_global("theme", $this); - $this->set_global("user", identity::active_user()); - $this->set_global("page_type", $page_type); - $this->set_global("page_subtype", $page_subtype); - $this->set_global("page_title", null); + $this->set_global(array("theme" => $this, + "user" => identity::active_user(), + "page_type" => $page_type, + "page_subtype" => $page_subtype, + "page_title" => null)); if ($page_type == "collection") { $this->set_global("thumb_proportion", $this->thumb_proportion()); } diff --git a/modules/search/controllers/search.php b/modules/search/controllers/search.php index e5894f30..733bc9f7 100644 --- a/modules/search/controllers/search.php +++ b/modules/search/controllers/search.php @@ -34,10 +34,10 @@ class Search_Controller extends Controller { $max_pages = max(ceil($count / $page_size), 1); $template = new Theme_View("page.html", "collection", "search"); - $template->set_global("page", $page); - $template->set_global("max_pages", $max_pages); - $template->set_global("page_size", $page_size); - $template->set_global("children_count", $count); + $template->set_global(array("page" => $page, + "max_pages" => $max_pages, + "page_size" => $page_size, + "children_count" => $count)); $template->content = new View("search.html"); $template->content->items = $result; diff --git a/modules/tag/controllers/tag.php b/modules/tag/controllers/tag.php index 0e924f3d..7bfa7d58 100644 --- a/modules/tag/controllers/tag.php +++ b/modules/tag/controllers/tag.php @@ -35,12 +35,12 @@ class Tag_Controller extends Controller { } $template = new Theme_View("page.html", "collection", "tag"); - $template->set_global("page", $page); - $template->set_global("max_pages", $max_pages); - $template->set_global("page_size", $page_size); - $template->set_global("tag", $tag); - $template->set_global("children", $tag->items($page_size, $offset)); - $template->set_global("children_count", $children_count); + $template->set_global(array("page" => $page, + "max_pages" => $max_pages, + "page_size" => $page_size, + "tag" => $tag, + "children" => $tag->items($page_size, $offset), + "children_count" => $children_count)); $template->content = new View("dynamic.html"); $template->content->title = t("Tag: %tag_name", array("tag_name" => $tag->name)); |