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 | 'img_dir' => 'themes/stripped_black_bloc/img', |
---|
19 | 'admin_icon_dir' => 'themes/default/icon/admin', |
---|
20 | 'mime_icon_dir' => 'themes/default/icon/mimetypes/', |
---|
21 | 'local_head' => 'local_head.tpl', |
---|
22 | 'load_parent_local_head' => true, |
---|
23 | ); |
---|
24 | global $stripped; |
---|
25 | $stripped['themeStyle']='original'; |
---|
26 | |
---|
27 | load_language('theme.lang', PHPWG_THEMES_PATH.'stripped_black_bloc/'); |
---|
28 | |
---|
29 | // Need upgrade? |
---|
30 | |
---|
31 | include(PHPWG_THEMES_PATH.'stripped_black_bloc/admin/upgrade.inc.php'); |
---|
32 | |
---|
33 | add_event_handler('loc_begin_page_header', 'set_config_values_stripped_black_bloc'); |
---|
34 | |
---|
35 | function set_config_values_stripped_black_bloc() |
---|
36 | { |
---|
37 | global $conf, $template; |
---|
38 | $config = unserialize( $conf['stripped_black_bloc'] ); |
---|
39 | $template->assign( 'stripped_black_bloc', $config ); |
---|
40 | } |
---|
41 | |
---|
42 | /// EVENT |
---|
43 | |
---|
44 | /************************************ thumbnails and category_thumbnails ************************************/ |
---|
45 | add_event_handler('loc_end_index_category_thumbnails', 'stripped_black_bloc'); |
---|
46 | add_event_handler('loc_end_index_thumbnails', 'stripped_black_bloc'); |
---|
47 | function stripped_black_bloc($tpl_thumbnails_var) |
---|
48 | { |
---|
49 | global $template, $conf; |
---|
50 | if (defined('RVTS_VERSION')) |
---|
51 | { |
---|
52 | $template->func_combine_script( array( |
---|
53 | 'id'=> 'sc_tscroller', |
---|
54 | 'load'=> 'async', |
---|
55 | 'path'=> PHPWG_THEMES_PATH.'stripped_black_bloc/js/tscroller.min.js', |
---|
56 | 'require' => 'jquery', |
---|
57 | ), $template->smarty); |
---|
58 | } |
---|
59 | |
---|
60 | $config = unserialize( $conf['stripped_black_bloc'] ); |
---|
61 | $template->assign( 'stripped_black_bloc', $config ); |
---|
62 | $new_tplvar=array(); |
---|
63 | $i=1; |
---|
64 | foreach ($tpl_thumbnails_var as $tplvar) |
---|
65 | { |
---|
66 | $tplvar['TN_CLASS']=($i==$config['starting_to']) ? "bloc_big" : "bloc"; |
---|
67 | $new_tplvar[]=$tplvar; |
---|
68 | $i= ($i==$config['every_x']) ? 1 : $i+1 ; |
---|
69 | } |
---|
70 | return $new_tplvar; |
---|
71 | } |
---|
72 | add_event_handler('init', 'stripped_black_bloc_init'); |
---|
73 | function stripped_black_bloc_init() |
---|
74 | { |
---|
75 | remove_event_handler('loc_begin_index', 'modify_nb_thumbnail_page'); |
---|
76 | } |
---|
77 | |
---|
78 | /************************************ index.tpl ************************************/ |
---|
79 | add_event_handler('loc_end_index', 'stripped_black_bloc_index'); |
---|
80 | function stripped_black_bloc_index() |
---|
81 | { |
---|
82 | global $template; |
---|
83 | $template->set_prefilter('index', 'stripped_black_bloc_prefilter_index'); |
---|
84 | } |
---|
85 | function stripped_black_bloc_prefilter_index($content, &$smarty) |
---|
86 | { |
---|
87 | $search = "#\{\'Menu\'\|@translate\}#"; |
---|
88 | $replacement = "{'Show/hide menu'|@translate}</span>"; |
---|
89 | $content = preg_replace($search, $replacement, $content); |
---|
90 | $search = '#<div id="subcontent">#'; |
---|
91 | $replacement = ""; |
---|
92 | $content = preg_replace($search, $replacement, $content); |
---|
93 | $search = '#\{if \!empty\(\$CONTENT_DESCRIPTION\) \}#'; |
---|
94 | $replacement = ' <div id="subcontent"> |
---|
95 | |
---|
96 | {if !empty($CONTENT_DESCRIPTION) }'; |
---|
97 | $content = preg_replace($search, $replacement, $content); |
---|
98 | $search = '#\{if \!empty\(\$navbar\) \}[\s]*\{include file=\'navigation_bar\.tpl\'\|@get_extent:\'navbar\'\}[\s]*\{/if\}#'; |
---|
99 | $replacement = ''; |
---|
100 | $content = preg_replace($search, $replacement, $content); |
---|
101 | |
---|
102 | $search = '#{\$PLUGIN_INDEX_CONTENT_AFTER}</div>{/if}.*</div>#s'; |
---|
103 | $replacement = '{$PLUGIN_INDEX_CONTENT_AFTER}</div>{/if} |
---|
104 | </div> |
---|
105 | {if !empty($navbar) } |
---|
106 | {include file=\'navigation_bar.tpl\'|@get_extent:\'navbar\'} |
---|
107 | {/if}'; |
---|
108 | return preg_replace($search, $replacement, $content); |
---|
109 | } |
---|
110 | |
---|
111 | ?> |
---|