1 | <?php |
---|
2 | /* |
---|
3 | Theme Name: Stripped & Columns |
---|
4 | Version: auto |
---|
5 | Description: stripped_black_bloc |
---|
6 | Theme URI: http://piwigo.org/ext/extension_view.php?eid=568 |
---|
7 | Author: flop25 |
---|
8 | Author 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 | 'load_parent_local_head' => true, |
---|
22 | ); |
---|
23 | global $stripped; |
---|
24 | $stripped['themeStyle']='original'; |
---|
25 | |
---|
26 | load_language('theme.lang', PHPWG_THEMES_PATH.'stripped_black_bloc/'); |
---|
27 | |
---|
28 | // Need upgrade? |
---|
29 | |
---|
30 | include(PHPWG_THEMES_PATH.'stripped_black_bloc/admin/upgrade.inc.php'); |
---|
31 | |
---|
32 | add_event_handler('loc_begin_page_header', 'set_config_values_stripped_black_bloc'); |
---|
33 | |
---|
34 | function 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 |
---|
42 | |
---|
43 | /************************************ thumbnails and category_thumbnails ************************************/ |
---|
44 | add_event_handler('loc_end_index_category_thumbnails', 'stripped_black_bloc'); |
---|
45 | add_event_handler('loc_end_index_thumbnails', 'stripped_black_bloc'); |
---|
46 | function stripped_black_bloc($tpl_thumbnails_var) |
---|
47 | { |
---|
48 | global $template, $conf; |
---|
49 | $config = unserialize( $conf['stripped_black_bloc'] ); |
---|
50 | $template->assign( 'stripped_black_bloc', $config ); |
---|
51 | $new_tplvar=array(); |
---|
52 | $i=1; |
---|
53 | foreach ($tpl_thumbnails_var as $tplvar) |
---|
54 | { |
---|
55 | $tplvar['TN_CLASS']=($i==$config['starting_to']) ? "bloc_big" : "bloc"; |
---|
56 | $new_tplvar[]=$tplvar; |
---|
57 | $i= ($i==$config['every_x']) ? 1 : $i+1 ; |
---|
58 | } |
---|
59 | return $new_tplvar; |
---|
60 | } |
---|
61 | add_event_handler('init', 'stripped_black_bloc_init'); |
---|
62 | function stripped_black_bloc_init() |
---|
63 | { |
---|
64 | remove_event_handler('loc_begin_index', 'modify_nb_thumbnail_page'); |
---|
65 | } |
---|
66 | |
---|
67 | /************************************ index.tpl ************************************/ |
---|
68 | add_event_handler('loc_end_index', 'stripped_black_bloc_index'); |
---|
69 | function stripped_black_bloc_index() |
---|
70 | { |
---|
71 | global $template; |
---|
72 | $template->set_prefilter('index', 'stripped_black_bloc_prefilter_index'); |
---|
73 | } |
---|
74 | function stripped_black_bloc_prefilter_index($content, &$smarty) |
---|
75 | { |
---|
76 | $search = "#\{\'Menu\'\|@translate\}#"; |
---|
77 | $replacement = "{'Show/hide menu'|@translate}</span>"; |
---|
78 | $content = preg_replace($search, $replacement, $content); |
---|
79 | $search = '#<div id="subcontent">#'; |
---|
80 | $replacement = ""; |
---|
81 | $content = preg_replace($search, $replacement, $content); |
---|
82 | $search = '#\{if \!empty\(\$CONTENT_DESCRIPTION\) \}#'; |
---|
83 | $replacement = ' <div id="subcontent"> |
---|
84 | |
---|
85 | {if !empty($CONTENT_DESCRIPTION) }'; |
---|
86 | $content = preg_replace($search, $replacement, $content); |
---|
87 | $search = '#\{if \!empty\(\$navbar\) \}[\s]*\{include file=\'navigation_bar\.tpl\'\|@get_extent:\'navbar\'\}[\s]*\{/if\}#'; |
---|
88 | $replacement = ''; |
---|
89 | $content = preg_replace($search, $replacement, $content); |
---|
90 | |
---|
91 | $search = '#{\$PLUGIN_INDEX_CONTENT_AFTER}</div>{/if}.*</div>#s'; |
---|
92 | $replacement = '{$PLUGIN_INDEX_CONTENT_AFTER}</div>{/if} |
---|
93 | </div> |
---|
94 | {if !empty($navbar) } |
---|
95 | {include file=\'navigation_bar.tpl\'|@get_extent:\'navbar\'} |
---|
96 | {/if}'; |
---|
97 | return preg_replace($search, $replacement, $content); |
---|
98 | } |
---|
99 | |
---|
100 | ?> |
---|