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

Last change on this file since 21326 was 21210, checked in by flop25, 12 years ago

compatibility 2.5: navigation bar

File size: 4.4 KB
RevLine 
[10851]1<?php
2/*
[11679]3Theme Name: Stripped & Columns
[11680]4Version: auto
[10851]5Description: stripped_black_bloc
[11680]6Theme URI: http://piwigo.org/ext/extension_view.php?eid=568
7Author: flop25
8Author URI: http://www.planete-flop.fr
[10851]9*/
10
11
[12048]12 
[10851]13$themeconf = array(
14  'parent' => 'stripped',
15  'name' => 'stripped_black_bloc',
16  'theme_dir' => 'stripped_black_bloc',
17  'icon_dir' => 'themes/stripped/icon',
[13920]18  'img_dir' => 'themes/stripped_black_bloc/img',
[10851]19  'admin_icon_dir' => 'themes/default/icon/admin',
20  'mime_icon_dir' => 'themes/default/icon/mimetypes/',
21  'local_head' => 'local_head.tpl',
[12408]22  'load_parent_local_head' => true,
[10851]23);
[12408]24global $stripped;
25$stripped['themeStyle']='original';
[11696]26
27load_language('theme.lang', PHPWG_THEMES_PATH.'stripped_black_bloc/');
28
[11699]29// Need upgrade?
[11696]30
[11823]31include(PHPWG_THEMES_PATH.'stripped_black_bloc/admin/upgrade.inc.php');
[11699]32
[18691]33add_event_handler('init', 'set_config_values_stripped_black_bloc');
[11699]34
35function set_config_values_stripped_black_bloc()
36{
[12048]37  global $conf, $template;
38  $config = unserialize( $conf['stripped_black_bloc'] );
39  $template->assign( 'stripped_black_bloc', $config );
[11699]40}
41
42/// EVENT
[12048]43
44/************************************ thumbnails and category_thumbnails ************************************/
45add_event_handler('loc_end_index_category_thumbnails', 'stripped_black_bloc');
46add_event_handler('loc_end_index_thumbnails', 'stripped_black_bloc');
47function stripped_black_bloc($tpl_thumbnails_var)
[10851]48{
[12048]49  global $template, $conf;
[16787]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 
[12048]60  $config = unserialize( $conf['stripped_black_bloc'] );
[13894]61  $template->assign( 'stripped_black_bloc', $config );
[12048]62  $new_tplvar=array();
63  $i=1;
64  foreach ($tpl_thumbnails_var as $tplvar)
65  {
[17843]66    $tplvar['TN_CLASS']=($i==$config['starting_to']) ? "twocol" : "onecol";
[13894]67    $new_tplvar[]=$tplvar;
68    $i= ($i==$config['every_x']) ? 1 : $i+1 ;
[12048]69  }
70  return $new_tplvar;
[10851]71}
[12048]72add_event_handler('init', 'stripped_black_bloc_init');
73function stripped_black_bloc_init()
[11498]74{
[12048]75  remove_event_handler('loc_begin_index', 'modify_nb_thumbnail_page');
[11498]76}
[11696]77
78/************************************ index.tpl ************************************/
79add_event_handler('loc_end_index', 'stripped_black_bloc_index');
80function stripped_black_bloc_index()
81{
82    global $template;
83    $template->set_prefilter('index', 'stripped_black_bloc_prefilter_index');
84}
85function stripped_black_bloc_prefilter_index($content, &$smarty)
86{
[16790]87  global $page;
[13015]88  $search = "#\{\'Menu\'\|@translate\}#"; 
[11823]89  $replacement = "{'Show/hide menu'|@translate}</span>";
90  $content = preg_replace($search, $replacement, $content);
[11843]91  $search = '#<div id="subcontent">#'; 
[11842]92  $replacement = "";
93  $content = preg_replace($search, $replacement, $content);
[11843]94  $search = '#\{if \!empty\(\$CONTENT_DESCRIPTION\) \}#'; 
[12048]95  $replacement = ' <div id="subcontent">
[11843]96
[12048]97  {if !empty($CONTENT_DESCRIPTION) }';
[11843]98  $content = preg_replace($search, $replacement, $content);
[21210]99  $search = '#\{if \!empty\(\$thumb_navbar\) \}[\s]*\{include file=\'navigation_bar\.tpl\'\|@get_extent:\'navbar\' navbar=\$thumb_navbar\}[\s]*\{/if\}#'; 
[11696]100  $replacement = '';
101  $content = preg_replace($search, $replacement, $content);
102
[16790]103  $search = '#\{\$PLUGIN_INDEX_CONTENT_AFTER\}</div>\{/if\}.*</div>#s'; 
[21207]104
[12406]105  $replacement = '{$PLUGIN_INDEX_CONTENT_AFTER}</div>{/if}
[21207]106    </div>
107  {if !empty($thumb_navbar) }
108  {include file=\'navigation_bar.tpl\'|@get_extent:\'navbar\' navbar=$thumb_navbar}
[16790]109  {/if}';
[21207]110
[16790]111  $content = preg_replace($search, $replacement, $content);
112  if ( isset($page['chronology_view']))
113  {
114    $search = '#\{if isset\(\$chronology\.TITLE\)#s';
115    $replacement = '<div class="bloc_stuff">
116{if isset($chronology.TITLE)';
117    $content = preg_replace($search, $replacement, $content);
118    $search = '#\{if \!empty\(\$PLUGIN_INDEX_CONTENT_BEGIN\)\}#s';
119    $replacement = '</div>
120{if !empty($PLUGIN_INDEX_CONTENT_BEGIN)}';
121    $content = preg_replace($search, $replacement, $content);
122    $search = '#calendar_block"#s';
123    if ($page['chronology_view']=='calendar')
124    {
125     $replacement = 'calendar_block" class="bloc_stuff" style="width:100%;padding:5px"';
126    }
127    else {
128     $replacement = 'calendar_block" class="bloc_stuff" style="padding:5px 0"';
129    }
130    $content = preg_replace($search, $replacement, $content);
131  }
132
133  return $content;
[11696]134}
135
[10851]136?>
Note: See TracBrowser for help on using the repository browser.