source: extensions/stripped_black_bloc/themeconf.inc.php @ 11709

Last change on this file since 11709 was 11709, checked in by flop25, 13 years ago

adding a round border
changed the way to recognize album : clear border
thumbnails caption = false compatible
bar removed
pwg stuff witdh restricted to 2width except for stuff_thumbnail
thumbnails generation based on file first

File size: 3.7 KB
Line 
1<?php
2/*
3Theme Name: Stripped & Columns
4Version: auto
5Description: stripped_black_bloc
6Theme URI: http://piwigo.org/ext/extension_view.php?eid=568
7Author: flop25
8Author URI: http://www.planete-flop.fr
9*/
10
11
12       
13$themeconf = array(
14  'parent' => 'stripped',
15  'name' => 'stripped_black_bloc',
16  'theme_dir' => 'stripped_black_bloc',
17  'icon_dir' => 'themes/stripped/icon',
18  'admin_icon_dir' => 'themes/default/icon/admin',
19  'mime_icon_dir' => 'themes/default/icon/mimetypes/',
20  'local_head' => 'local_head.tpl',
21);
22
23load_language('theme.lang', PHPWG_THEMES_PATH.'stripped_black_bloc/');
24
25// Need upgrade?
26
27global $conf;
28
29if (!isset($conf['stripped_black_bloc']))
30  include(PHPWG_THEMES_PATH.'stripped_black_bloc/admin/upgrade.inc.php');
31
32add_event_handler('loc_begin_page_header', 'set_config_values_stripped_black_bloc');
33
34function set_config_values_stripped_black_bloc()
35{
36        global $conf, $template;
37        $config = unserialize( $conf['stripped_black_bloc'] );
38        $template->assign( 'stripped_black_bloc', $config );
39}
40
41/// EVENT
42add_event_handler('loc_end_index_category_thumbnails', 'MY');
43add_event_handler('loc_end_index_thumbnails', 'MY');
44function MY($tpl_thumbnails_var)
45{
46    global $template, $conf;
47                $config = unserialize( $conf['stripped_black_bloc'] );
48                $new_tplvar=array();
49                foreach ($tpl_thumbnails_var as $tplvar)
50                {
51                        list($width, $height, $type, $attr) = getimagesize(     $tplvar['TN_SRC'] );
52                        $tplvar['TN_WIDTH']=$width;
53                        $tplvar['TN_HEIGHT']=$height;
54                        if (isset($config['thumbnail']))
55                        {
56                                switch ($config['thumbnail'])
57                                {
58                                        case 'generated':
59                                                if (isset($tplvar['FILE_WIDTH']))
60                                                {
61                                                        $tplvar['TN_SRC']=PHPWG_THEMES_PATH."stripped_black_bloc/library/timthumb.php?src=".$tplvar['FILE_PATH']."&w=".$config['thumbnail_width'];
62                                                }
63                                                else
64                                                {
65                                                        $tplvar['TN_SRC']=PHPWG_THEMES_PATH."stripped_black_bloc/library/timthumb.php?src=".$tplvar['TN_SRC']."&w=".$config['thumbnail_width'];
66                                                }
67                                                $tplvar['TN_HEIGHT']=floor($tplvar['TN_HEIGHT']*($config['thumbnail_width']/$tplvar['TN_WIDTH']));
68                                                $tplvar['TN_WIDTH']=$config['thumbnail_width'];
69                                        break;
70                                        case 'auto':
71                                                if($tplvar['TN_WIDTH']<=$config['thumbnail_width'])
72                                                {
73                                                        if (isset($tplvar['FILE_WIDTH']))
74                                                        {
75                                                                $tplvar['TN_SRC']=PHPWG_THEMES_PATH."stripped_black_bloc/library/timthumb.php?src=".$tplvar['FILE_PATH']."&w=".$config['thumbnail_width'];
76                                                        }
77                                                        else
78                                                        {
79                                                                $tplvar['TN_SRC']=PHPWG_THEMES_PATH."stripped_black_bloc/library/timthumb.php?src=".$tplvar['TN_SRC']."&w=".$config['thumbnail_width'];
80                                                        }
81                                                        $tplvar['TN_HEIGHT']=floor($tplvar['TN_HEIGHT']*($config['thumbnail_width']/$tplvar['TN_WIDTH']));
82                                                        $tplvar['TN_WIDTH']=$config['thumbnail_width'];
83                                                }
84                                        break;
85                                        case 'piwigo':break;
86                                }
87                        }
88                        $new_tplvar[]=$tplvar;
89                }
90                return $new_tplvar;
91}
92add_event_handler('init', 'MY_init');
93function MY_init()
94{
95        remove_event_handler('loc_begin_index', 'modify_nb_thumbnail_page');
96}
97
98/************************************ index.tpl ************************************/
99add_event_handler('loc_end_index', 'stripped_black_bloc_index');
100function stripped_black_bloc_index()
101{
102    global $template;
103    $template->set_prefilter('index', 'stripped_black_bloc_prefilter_index');
104}
105function stripped_black_bloc_prefilter_index($content, &$smarty)
106{
107  $search = '#\{if \!empty\(\$navbar\) \}[\s]*\{include file=\'navigation_bar\.tpl\'\|@get_extent:\'navbar\'\}[\s]*\{/if\}#'; 
108  $replacement = '';
109  $content = preg_replace($search, $replacement, $content);
110
111  $search = '#<\!-- subContent -->#'; 
112  $replacement = '<!-- subContent -->
113        {if !empty($navbar) }
114                {include file=\'navigation_bar.tpl\'|@get_extent:\'navbar\'}
115        {/if}';
116  return preg_replace($search, $replacement, $content);
117}
118
119?>
Note: See TracBrowser for help on using the repository browser.