source: extensions/floPure/Pure_default/themeconf.inc.php @ 30085

Last change on this file since 30085 was 30085, checked in by flop25, 10 years ago

2.7 compat: colorscheme and 2.7 only OS_default

File size: 7.3 KB
Line 
1<?php
2/*
3Theme Name: Pure_default
4Version: auto
5Description:
6Theme URI: http://piwigo.org/ext/extension_view.php?eid=384
7Author: flop25
8Author URI: http://www.planete-flop.fr
9*/
10$themeconf = array(
11  'name'         => 'Pure_default',
12  'parent'        => 'default',
13  'icon_dir'      => 'themes/Pure_default/icon',
14  'mime_icon_dir' => 'themes/Pure_default/icon/mimetypes/',
15  'local_head'    => 'local_head.tpl',
16  'activable' => false,
17  'colorscheme' => 'clear',
18);
19
20
21add_event_handler('loc_begin_page_header', 'pwg_v');
22function  pwg_v() {
23  global $template;
24  $pwgversion=str_replace('.','',PHPWG_VERSION);
25  $pwgversion_array=explode('.', PHPWG_VERSION);
26  $template->assign(
27  array(
28    'PHPWG_VERSION_01' => $pwgversion_array[0].$pwgversion_array[1],
29  ));
30}
31
32
33// function load_pattern
34// include the right ***.pattern.php
35// not compatible 2.2and<2.2
36
37function load_pattern()
38{
39  global $pattern;
40  $pwgversion=str_replace('.','',PHPWG_VERSION);
41  $pwgversion_array=explode('.', PHPWG_VERSION);
42  if (file_exists($pwgversion.'pattern.php'))
43  {
44    include($pwgversion.'.pattern.php');
45    return true;
46  }
47  elseif (file_exists(PHPWG_ROOT_PATH.'themes/Pure_default/'.$pwgversion_array[0].$pwgversion_array[1].'x.pattern.php'))
48  {
49    include(PHPWG_ROOT_PATH.'themes/Pure_default/'.$pwgversion_array[0].$pwgversion_array[1].'x.pattern.php');
50    return true;
51  }
52  else
53  {
54    $list_pattern_path=array();
55    $dir=PHPWG_ROOT_PATH.'themes/Pure_default';
56    $dh = opendir($dir);
57    while (($file = readdir ($dh)) !== false ) {
58      if ($file !== '.' && $file !== '..') {
59        $path =$dir.'/'.$file;
60        if (!is_dir ($path)) { 
61          if(strpos($file,'pattern.php')!==false) { //On ne prend que les .pattern.php
62            $list_pattern_path[]=$file;
63          }
64        }
65      }
66    }
67    closedir($dh);
68    $f=0;
69    for($i = 10; $i >=0; $i--)
70    {
71      if (in_array($pwgversion_array[0].$i.'.pattern.php',$list_pattern_path))
72      {
73        include($pwgversion_array[0].$i.'.pattern.php');
74        return true;
75        $f=1;
76        break;
77      }
78    }
79    if ($f=0)
80    {
81      return false;
82    }
83  }
84 
85}
86if(!load_pattern())
87{
88  global $page;
89  $page['errors'][]='Theme not compatible';
90}
91
92
93
94add_event_handler('loc_after_page_header', 'Pure_default_after_page_header');
95function Pure_default_after_page_header()
96{
97        global $template, $page;
98        if (isset($page['body_id']) and $page['body_id'] == 'theIdentificationPage')
99        {
100    $template->set_prefilter('identification', 'Pure_default_prefilter_identification');
101        }
102        if (isset($page['body_id']) and $page['body_id'] == 'theNBMPage')
103        {
104    $template->set_prefilter('nbm', 'Pure_default_prefilter_nbm');
105        }
106        if (isset($page['body_id']) and $page['body_id'] == 'theNotificationPage')
107        {
108                $template->set_prefilter('notification', 'Pure_default_prefilter_notification');
109        }
110        if (isset($page['body_id']) and $page['body_id'] == 'thePasswordPage')
111        {
112                $template->set_prefilter('password', 'Pure_default_prefilter_password');
113        }
114        if (isset($page['body_id']) and $page['body_id'] == 'theTagsPage')
115        {
116                $template->set_prefilter('tags', 'Pure_default_prefilter_tags');
117        }
118        if (isset($page['body_id']) and $page['body_id'] == 'theAboutPage')
119        {
120                $template->set_prefilter('about', 'Pure_default_prefilter_about');
121        }
122        if (isset($page['body_id']) and $page['body_id'] == 'thePopuphelpPage')
123        {
124                $template->set_prefilter('popuphelp', 'Pure_default_prefilter_popuphelp');
125        }
126}
127/************************************ index.tpl ************************************/
128add_event_handler('loc_end_index', 'Pure_default_index');
129function Pure_default_index()
130{
131  global $template;
132  $template->set_prefilter('index', 'Pure_default_prefilter_index');
133}
134function Pure_default_prefilter_index($content, &$smarty)
135{
136  global $pattern;
137  $r=$pattern['Pure_default_prefilter_index']['R'];
138  $ps=$pattern['Pure_default_prefilter_index']['S'];
139  foreach($r as $i => $pr)
140  {
141    $content = preg_replace($ps[$i], $pr, $content);
142  }
143  return $content;
144}
145
146/************************************ picture.tpl ************************************/
147add_event_handler('loc_begin_picture', 'Pure_default_picture');
148function Pure_default_picture()
149{
150  global $template;
151  $template->set_prefilter('picture', 'Pure_default_prefilter_picture');
152}
153function Pure_default_prefilter_picture($content, &$smarty)
154{
155  global $pattern;
156  $r=$pattern['Pure_default_prefilter_picture']['R'];
157  $ps=$pattern['Pure_default_prefilter_picture']['S'];
158  foreach($r as $i => $pr)
159  {
160    $content = preg_replace($ps[$i], $pr, $content);
161  }
162  return $content;
163}
164/**************************** identification.tpl *****************************************************************/
165function Pure_default_prefilter_identification($content, &$smarty)
166{
167  global $pattern;
168  $r=$pattern['Pure_default_prefilter_identification']['R'];
169  $ps=$pattern['Pure_default_prefilter_identification']['S'];
170  foreach($r as $i => $pr)
171  {
172    $content = preg_replace($ps[$i], $pr, $content);
173  }
174  return $content;
175}
176/**************************** nbm.tpl *****************************************************************/
177function Pure_default_prefilter_nbm($content, &$smarty)
178{
179  global $pattern;
180  $r=$pattern['Pure_default_prefilter_nbm']['R'];
181  $ps=$pattern['Pure_default_prefilter_nbm']['S'];
182  foreach($r as $i => $pr)
183  {
184    $content = preg_replace($ps[$i], $pr, $content);
185  }
186  return $content;
187}
188/**************************** notification.tpl *****************************************************************/
189function Pure_default_prefilter_notification($content, &$smarty)
190{
191  global $pattern;
192  $r=$pattern['Pure_default_prefilter_notification']['R'];
193  $ps=$pattern['Pure_default_prefilter_notification']['S'];
194  foreach($r as $i => $pr)
195  {
196    $content = preg_replace($ps[$i], $pr, $content);
197  }
198  return $content;
199}
200/**************************** password.tpl *****************************************************************/
201function Pure_default_prefilter_password($content, &$smarty)
202{
203  global $pattern;
204  $r=$pattern['Pure_default_prefilter_password']['R'];
205  $ps=$pattern['Pure_default_prefilter_password']['S'];
206  foreach($r as $i => $pr)
207  {
208    $content = preg_replace($ps[$i], $pr, $content);
209  }
210  return $content;
211}
212/**************************** tags.tpl *****************************************************************/
213function Pure_default_prefilter_tags($content, &$smarty)
214{
215  global $pattern;
216  $r=$pattern['Pure_default_prefilter_tags']['R'];
217  $ps=$pattern['Pure_default_prefilter_tags']['S'];
218  foreach($r as $i => $pr)
219  {
220    $content = preg_replace($ps[$i], $pr, $content);
221  }
222  return $content;
223}
224/**************************** about.tpl *****************************************************************/
225function Pure_default_prefilter_about($content, &$smarty)
226{
227  global $pattern;
228  $r=$pattern['Pure_default_prefilter_about']['R'];
229  $ps=$pattern['Pure_default_prefilter_about']['S'];
230  foreach($r as $i => $pr)
231  {
232    $content = preg_replace($ps[$i], $pr, $content);
233  }
234  return $content;
235}
236/**************************** popuphelp.tpl *****************************************************************/
237function Pure_default_prefilter_popuphelp($content, &$smarty)
238{
239  global $pattern;
240  $r=$pattern['Pure_default_prefilter_popuphelp']['R'];
241  $ps=$pattern['Pure_default_prefilter_popuphelp']['S'];
242  foreach($r as $i => $pr)
243  {
244    $content = preg_replace($ps[$i], $pr, $content);
245  }
246  return $content;
247}
248
249?>
Note: See TracBrowser for help on using the repository browser.