[30210] | 1 | <?php |
---|
| 2 | /* |
---|
| 3 | Theme Name: GreyDragon |
---|
| 4 | Version: 1.0.13 |
---|
| 5 | Description: Dark, slate, white background, grayscale. |
---|
| 6 | Theme URI: http://piwigo.org/ext/extension_view.php?eid=775 |
---|
| 7 | Author: Serge Dosyukov |
---|
| 8 | Author URI: http://blog.dragonsoft.us |
---|
| 9 | */ |
---|
| 10 | |
---|
| 11 | if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!'); |
---|
| 12 | |
---|
| 13 | define('GDTHEME_VERSION', '1.0.13'); |
---|
| 14 | |
---|
| 15 | require_once( PHPWG_THEMES_PATH . 'greydragon/include/greydragon.class.php'); |
---|
| 16 | require_once( PHPWG_THEMES_PATH . 'greydragon/admin/upgrade.inc.php'); |
---|
| 17 | |
---|
| 18 | $themeCore = greyDragonCore::Instance(GDTHEME_VERSION); |
---|
| 19 | |
---|
| 20 | $themeconf = array( |
---|
| 21 | 'name' => 'greydragon', |
---|
| 22 | 'parent' => 'default', |
---|
| 23 | 'colorscheme' => 'whitehawk' == $themeCore->getOption('p_colorpack') ? 'clear' : 'dark' |
---|
| 24 | ); |
---|
| 25 | |
---|
| 26 | add_event_handler('init', 'greydragon_init'); |
---|
| 27 | add_event_handler('loc_begin_page_header', 'greydragon_set_header', 55); |
---|
| 28 | |
---|
| 29 | pwg_set_session_var('show_metadata', 1); |
---|
| 30 | |
---|
| 31 | // Load Theme's Parameters |
---|
| 32 | function greydragon_init() { |
---|
| 33 | global $template; |
---|
| 34 | |
---|
| 35 | $themeCore = greyDragonCore::Instance(); |
---|
| 36 | if ($themeCore->hasOption("p_logo_path") || $themeCore->hasOption("p_header") || $themeCore->hasOption('page_banner', TRUE)): |
---|
| 37 | add_event_handler('render_page_banner', 'greydragon_render_header'); |
---|
| 38 | endif; |
---|
| 39 | if ($themeCore->getOption("p_nocounter") == "on"): |
---|
| 40 | add_event_handler('loc_end_index', 'no_breadcrumb_counter'); |
---|
| 41 | endif; |
---|
| 42 | |
---|
| 43 | $template->assign('greydragon', $themeCore->getConfig()); |
---|
| 44 | } |
---|
| 45 | |
---|
| 46 | // Render custom header content |
---|
| 47 | function greydragon_render_header() { |
---|
| 48 | |
---|
| 49 | return greyDragonCore::Instance()->getHeader(); |
---|
| 50 | } |
---|
| 51 | |
---|
| 52 | // Add custom favicon or custom meta if provided |
---|
| 53 | function greydragon_set_header() { |
---|
| 54 | global $template; |
---|
| 55 | |
---|
| 56 | $themeCore = greyDragonCore::Instance(); |
---|
| 57 | if (($themeCore->hasOption("p_favicon_path")) || ($themeCore->getOption("p_nogenerator"))): |
---|
| 58 | $template->set_prefilter('header', "greydragon_head"); |
---|
| 59 | endif; |
---|
| 60 | } |
---|
| 61 | |
---|
| 62 | // Render head content |
---|
| 63 | function greydragon_head($content, &$smarty) { |
---|
| 64 | return greyDragonCore::Instance()->getHead($content); |
---|
| 65 | } |
---|
| 66 | |
---|
| 67 | function no_breadcrumb_counter() { |
---|
| 68 | global $template; |
---|
| 69 | |
---|
| 70 | $titre = $template->get_template_vars('TITLE'); |
---|
| 71 | $pos = strrpos($titre,"["); |
---|
| 72 | if ($pos !== false): |
---|
| 73 | $template->assign('TITLE', substr($titre, 0, $pos)); |
---|
| 74 | endif; |
---|
| 75 | } |
---|
| 76 | |
---|
| 77 | ?> |
---|