diff options
Diffstat (limited to 'modules')
-rw-r--r-- | modules/g2_import/controllers/admin_g2_import.php | 4 | ||||
-rw-r--r-- | modules/g2_import/helpers/g2_import.php | 4 | ||||
-rw-r--r-- | modules/gallery/controllers/albums.php | 2 | ||||
-rw-r--r-- | modules/gallery/helpers/gallery_installer.php | 21 | ||||
-rw-r--r-- | modules/gallery/helpers/theme.php | 29 | ||||
-rw-r--r-- | modules/gallery/libraries/Theme_View.php | 2 | ||||
-rw-r--r-- | modules/gallery/module.info | 2 | ||||
-rw-r--r-- | modules/search/controllers/search.php | 2 | ||||
-rw-r--r-- | modules/tag/controllers/tags.php | 2 |
9 files changed, 54 insertions, 14 deletions
diff --git a/modules/g2_import/controllers/admin_g2_import.php b/modules/g2_import/controllers/admin_g2_import.php index 1c65f482..6ed92c37 100644 --- a/modules/g2_import/controllers/admin_g2_import.php +++ b/modules/g2_import/controllers/admin_g2_import.php @@ -35,8 +35,8 @@ class Admin_g2_import_Controller extends Admin_Controller { if (g2_import::is_initialized()) { $view->content->g2_stats = $g2_stats; $view->content->g2_sizes = $g2_sizes; - $view->content->thumb_size = module::get_var("gallery", "thumb_size"); - $view->content->resize_size = module::get_var("gallery", "resize_size"); + $view->content->thumb_size = theme::get_var("thumb_size"); + $view->content->resize_size = theme::get_var("resize_size"); } print $view; } diff --git a/modules/g2_import/helpers/g2_import.php b/modules/g2_import/helpers/g2_import.php index 202a0e92..61a7ef85 100644 --- a/modules/g2_import/helpers/g2_import.php +++ b/modules/g2_import/helpers/g2_import.php @@ -671,8 +671,8 @@ class g2_import_Core { $g2_item_id = self::$current_g2_item->getId(); $derivatives = g2(GalleryCoreApi::fetchDerivativesByItemIds(array($g2_item_id))); - $target_thumb_size = module::get_var("gallery", "thumb_size"); - $target_resize_size = module::get_var("gallery", "resize_size"); + $target_thumb_size = theme::get_var("thumb_size"); + $target_resize_size = theme::get_var("resize_size"); if (!empty($derivatives[$g2_item_id])) { foreach ($derivatives[$g2_item_id] as $derivative) { if ($derivative->getPostFilterOperations()) { diff --git a/modules/gallery/controllers/albums.php b/modules/gallery/controllers/albums.php index e67df6f6..749fb520 100644 --- a/modules/gallery/controllers/albums.php +++ b/modules/gallery/controllers/albums.php @@ -23,7 +23,7 @@ class Albums_Controller extends Items_Controller { * @see REST_Controller::_show($resource) */ public function _show($album) { - $page_size = module::get_var("gallery", "page_size", 9); + $page_size = theme::get_var("page_size", 9); if (!access::can("view", $album)) { if ($album->id == 1) { $view = new Theme_View("page.html", "other", "login"); diff --git a/modules/gallery/helpers/gallery_installer.php b/modules/gallery/helpers/gallery_installer.php index 57a5ee9f..4051c6e9 100644 --- a/modules/gallery/helpers/gallery_installer.php +++ b/modules/gallery/helpers/gallery_installer.php @@ -226,9 +226,9 @@ class gallery_installer { module::set_var("gallery", "active_site_theme", "wind"); module::set_var("gallery", "active_admin_theme", "admin_wind"); - module::set_var("gallery", "page_size", 9); - module::set_var("gallery", "thumb_size", 200); - module::set_var("gallery", "resize_size", 640); + module::set_var("wind", "page_size", 9); + module::set_var("wind", "thumb_size", 200); + module::set_var("wind", "resize_size", 640); module::set_var("gallery", "default_locale", "en_US"); module::set_var("gallery", "image_quality", 75); module::set_var("gallery", "image_sharpen", 15); @@ -265,10 +265,10 @@ class gallery_installer { module::set_var("gallery", "date_format", "Y-M-d"); module::set_var("gallery", "date_time_format", "Y-M-d H:i:s"); module::set_var("gallery", "time_format", "H:i:s"); - module::set_var("gallery", "show_credits", 1); + module::set_var("wind", "show_credits", 1); // @todo this string needs to be picked up by l10n_scanner module::set_var("gallery", "credits", "Powered by <a href=\"%url\">Gallery %version</a>"); - module::set_version("gallery", 19); + module::set_version("gallery", 20); } static function upgrade($version) { @@ -432,6 +432,17 @@ class gallery_installer { module::clear_var("gallery", "blocks_site.sidebar"); module::set_version("gallery", $version = 19); } + + // Move the theme related variables into the current theme + if ($version == 19) { + foreach (array("page_size", "thumb_size", "resize_size", "header_text", + "footer_text", "show_credits") as $var) { + $value = module::get_var("gallery", $var); + theme::set_var($var, $value); + module::clear_var("gallery", $var); + } + module::set_version("gallery", $version = 20); + } } static function uninstall() { diff --git a/modules/gallery/helpers/theme.php b/modules/gallery/helpers/theme.php index 6e8943b3..c7b773d1 100644 --- a/modules/gallery/helpers/theme.php +++ b/modules/gallery/helpers/theme.php @@ -57,4 +57,33 @@ class theme_Core { return $theme_info; } + + /** + * Get a variable from the active theme + * @param string $name + * @param string $default_value + * @return the value + */ + static function get_var($name, $default_value=null) { + return module::get_var(self::$site, $name, $default_value); + } + + /** + * Store a variable for active theme + * @param string $module_name + * @param string $name + * @param string $value + */ + static function set_var($name, $value) { + module::set_var(self::$site, $name, $value); + } + + /** + * Remove a variable for this module. + * @param string $module_name + * @param string $name + */ + static function clear_var($name) { + module::clear_var(self::$site, $name); + } } diff --git a/modules/gallery/libraries/Theme_View.php b/modules/gallery/libraries/Theme_View.php index b1167d0e..87d8de56 100644 --- a/modules/gallery/libraries/Theme_View.php +++ b/modules/gallery/libraries/Theme_View.php @@ -65,7 +65,7 @@ class Theme_View_Core extends Gallery_View { public function thumb_proportion() { // @TODO change the 200 to a theme supplied value when and if we come up with an // API to allow the theme to set defaults. - return module::get_var("gallery", "thumb_size", 200) / 200; + return theme::get_var("thumb_size", 200) / 200; } public function item() { diff --git a/modules/gallery/module.info b/modules/gallery/module.info index 2dc62ecd..ecce9118 100644 --- a/modules/gallery/module.info +++ b/modules/gallery/module.info @@ -1,3 +1,3 @@ name = "Gallery 3" description = "Gallery core application" -version = 19 +version = 20 diff --git a/modules/search/controllers/search.php b/modules/search/controllers/search.php index 539e063f..fcee5233 100644 --- a/modules/search/controllers/search.php +++ b/modules/search/controllers/search.php @@ -19,7 +19,7 @@ */ class Search_Controller extends Controller { public function index() { - $page_size = module::get_var("gallery", "page_size", 9); + $page_size = theme::get_var("page_size", 9); $q = $this->input->get("q"); $page = $this->input->get("page", 1); $offset = ($page - 1) * $page_size; diff --git a/modules/tag/controllers/tags.php b/modules/tag/controllers/tags.php index 52001719..6dc77d56 100644 --- a/modules/tag/controllers/tags.php +++ b/modules/tag/controllers/tags.php @@ -21,7 +21,7 @@ class Tags_Controller extends REST_Controller { protected $resource_type = "tag"; public function _show($tag) { - $page_size = module::get_var("gallery", "page_size", 9); + $page_size = theme::get_var("page_size", 9); $page = (int) $this->input->get("page", "1"); $children_count = $tag->items_count(); $offset = ($page-1) * $page_size; |