diff options
author | Tim Almdal <tnalmdal@shaw.ca> | 2008-11-23 16:51:06 +0000 |
---|---|---|
committer | Tim Almdal <tnalmdal@shaw.ca> | 2008-11-23 16:51:06 +0000 |
commit | 7491e3c44affb89fe28030f8759283bc1b4aa291 (patch) | |
tree | 077c14bcee9f68e80e07c8165dbf11ec41107e43 /core | |
parent | 7485740d9741021b2016df80b225ae4d82b892d0 (diff) |
Add a site-config parameter to the config.php file. Created a core_block:head method to insert the title into the head section. If the config value is false, the default Browse Photos::$item->title is used. A string value with a trailing '-' will append the config value to $item-title. Otherwise, the page title is set with the supplied value.
Diffstat (limited to 'core')
-rw-r--r-- | core/config/config.php | 9 | ||||
-rw-r--r-- | core/helpers/core_block.php | 35 | ||||
-rw-r--r-- | core/libraries/Theme.php | 6 |
3 files changed, 49 insertions, 1 deletions
diff --git a/core/config/config.php b/core/config/config.php index 9fe668b8..745fd76b 100644 --- a/core/config/config.php +++ b/core/config/config.php @@ -135,3 +135,12 @@ $config['modules'] = array MODPATH . 'atom', MODPATH . 'search' ); + +/** + * Set the global site title. + * Valid values are: + * FALSE: Use the default, which is the album or image title + * A string value that ends with '-' will append the string befor the default value + * A string value without a trailing '-' will replace the default value. + */ +$config['site_title'] = "Gallery3 Rocks"; diff --git a/core/helpers/core_block.php b/core/helpers/core_block.php new file mode 100644 index 00000000..aecbde47 --- /dev/null +++ b/core/helpers/core_block.php @@ -0,0 +1,35 @@ +<?php defined("SYSPATH") or die("No direct script access."); +/** + * Gallery - a web based photo album viewer and editor + * Copyright (C) 2000-2008 Bharat Mediratta + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or (at + * your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. + */ +class core_block_Core { + public static function head($theme) { + $site_title = Kohana::config("core.site_title"); + $title = $theme->item()->title; + if (!empty($site_title)) { + if (substr($site_title, -1) == "-") { + $title = "$site_title $title"; + } else { + $title = $site_title; + } + } else { + $title = _("Browse Photos") . "::$title"; + } + return "<title>$title</title>"; + } +} diff --git a/core/libraries/Theme.php b/core/libraries/Theme.php index 19c2dd57..d5af41b4 100644 --- a/core/libraries/Theme.php +++ b/core/libraries/Theme.php @@ -82,7 +82,11 @@ class Theme_Core { case "photo_bottom": if (empty($this->block_helpers[$function])) { foreach (module::get_list() as $module) { - $helper_path = MODPATH . "$module->name/helpers/{$module->name}_block.php"; + if ($module->name == "core") { + $helper_path = APPPATH . "helpers/{$module->name}_block.php"; + } else { + $helper_path = MODPATH . "$module->name/helpers/{$module->name}_block.php"; + } $helper_class = "{$module->name}_block"; if (file_exists($helper_path) && method_exists($helper_class, $function)) { $this->block_helpers[$function][] = $helper_class; |