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

Revision 13894, 3.2 KB checked in by flop25, 8 years ago (diff)

updated for 2.4 :
-deleted timthumb
-deleted config for auto-generation

features added :
-representative thumbs can be big : always, as the "Every x thumb" config or never

bug corrected :
-big thumbs didn't have rounded corners

Translations uk_UA needed for new keys

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  'load_parent_local_head' => true,
22);
23global $stripped;
24$stripped['themeStyle']='original';
25
26load_language('theme.lang', PHPWG_THEMES_PATH.'stripped_black_bloc/');
27
28// Need upgrade?
29
30include(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
42
43/************************************ thumbnails and category_thumbnails ************************************/
44add_event_handler('loc_end_index_category_thumbnails', 'stripped_black_bloc');
45add_event_handler('loc_end_index_thumbnails', 'stripped_black_bloc');
46function 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}
61add_event_handler('init', 'stripped_black_bloc_init');
62function stripped_black_bloc_init()
63{
64  remove_event_handler('loc_begin_index', 'modify_nb_thumbnail_page');
65}
66
67/************************************ index.tpl ************************************/
68add_event_handler('loc_end_index', 'stripped_black_bloc_index');
69function stripped_black_bloc_index()
70{
71    global $template;
72    $template->set_prefilter('index', 'stripped_black_bloc_prefilter_index');
73}
74function 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?>
Note: See TracBrowser for help on using the repository browser.