source: extensions/floPure/Pure_autumn/themeconf.inc.php @ 19923

Last change on this file since 19923 was 17145, checked in by flop25, 12 years ago

fix for 2.4.2 : the regex was corrected

File size: 2.4 KB
Line 
1<?php
2/*
3Theme Name: Pure_autumn
4Version: auto
5Description: Colors of autumn, random sort of colors for thumbnails, "S" blocks... a must have !
6Theme URI: http://fr.piwigo.org/ext/extension_view.php?eid=443
7Author: flop25
8Author URI: http://www.planete-flop.fr
9*/
10
11$themeconf = array(
12  'name'         => 'Pure_autumn',
13  'parent'        => 'Pure_default',
14  'icon_dir'      => 'themes/Pure_default/icon',
15  'mime_icon_dir' => 'themes/Pure_default/icon/mimetypes/',
16  'local_head' => 'local_head.tpl',
17);
18/** mainpage_categories.tpl **/
19add_event_handler('loc_end_index_category_thumbnails', 'Pure_autumn_cat');
20function Pure_autumn_cat($tpl_thumbnails_var)
21{
22    global $template;
23    $template->set_prefilter('index_category_thumbnails', 'Pure_autumn_prefilter_cat');
24                return $tpl_thumbnails_var;
25}
26function Pure_autumn_prefilter_cat($content, &$smarty)
27{
28  $pwgversion=str_replace('.','',PHPWG_VERSION);
29  $pwgversion_array=explode('.', PHPWG_VERSION);
30  if ($pwgversion_array[0].$pwgversion_array[1]=="23")
31  {
32    $search = '#<li>[\s]*<div class="thumbnailCategory">#';
33    $replacement = '<li class="{cycle values="cat_1,cat_2,cat_3,cat_4"}" >
34        <div class="thumbnailCategory">';
35  }
36  elseif ($pwgversion_array[0].$pwgversion_array[1]=="24" or $pwgversion_array[0].$pwgversion_array[1]=="25" )
37  {
38    $search = '#<li class="\{if \$smarty\.foreach.*odd\{else\}even\{/if\}">#s';
39    $replacement = '<li class="{cycle values="cat_1,cat_2,cat_3,cat_4"}" >';
40  }
41  return preg_replace($search, $replacement, $content);
42}
43
44/** thumbnails.tpl **/
45add_event_handler('loc_end_index_thumbnails', 'Pure_autumn_thumbnails');
46function Pure_autumn_thumbnails($tpl_thumbnails_var)
47{
48    global $template;
49    $template->set_prefilter('index_thumbnails', 'Pure_autumn_prefilter_thumbnails');
50    $template->set_prefilter('stuffs', 'Pure_autumn_prefilter_thumbnails');
51                return $tpl_thumbnails_var;
52}
53
54function Pure_autumn_prefilter_thumbnails($content, &$smarty)
55{
56  $pwgversion=str_replace('.','',PHPWG_VERSION);
57  $pwgversion_array=explode('.', PHPWG_VERSION);
58  if ($pwgversion_array[0].$pwgversion_array[1]=="23")
59  {
60  $search = '#<li>[\s]*<span class="wrap1">#';
61 
62  $replacement = '<li class="thumb_{"1"|mt_rand:5}"  >
63        <span class="wrap1">';
64  }
65  elseif ($pwgversion_array[0].$pwgversion_array[1]=="24")
66  {
67  $search = '#<li>[\s]*<span class="wrap1">#';
68 
69  $replacement = '<li class="thumb_{"1"|mt_rand:5}"  >
70        <span class="wrap1">';
71  }
72
73  return preg_replace($search, $replacement, $content);
74}
75?>
Note: See TracBrowser for help on using the repository browser.