source: extensions/floOS/OS_default/themeconf.inc.php

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

2.7 compat: colorscheme and 2.7 only OS_default

File size: 4.2 KB
Line 
1<?php
2/*
3Theme Name: OS_default
4Version: auto
5Description:
6Theme URI: http://piwigo.org/ext/extension_view.php?eid=497
7Author: flop25
8Author URI: http://www.planete-flop.fr
9*/
10$themeconf = array(
11  'name'         => 'OS_default',
12  'parent'        => 'default',
13  'icon_dir'      => 'themes/OS_default/icon',
14  'mime_icon_dir' => 'themes/OS_default/icon/mimetypes/',
15  'local_head'    => 'local_head.tpl',
16  'activable' => false,
17        'add_menu_on_public_pages'                      => true,        # activation
18        'Exclude'                       => array('theNBMPage','thePicturePage','thePopuphelpPage',),    # Excluded pages
19  'colorscheme' => 'clear',
20);
21
22/*********************************menu on every pages ************************************/
23// thx to Vdigital and his plugin spreadmenus
24if ( !function_exists( 'add_menu_on_public_pages' ) ) {
25        if ( defined('IN_ADMIN') and IN_ADMIN ) return false;
26        add_event_handler('loc_after_page_header', 'add_menu_on_public_pages', 20);
27
28        function  add_menu_on_public_pages() {
29          if ( function_exists( 'initialize_menu') ) return false; # The current page has already the menu
30          if ( !get_themeconf('add_menu_on_public_pages') ) return false; # The current page has already the menu
31          global $template, $page, $conf;
32          if ( isset($page['body_id']) and in_array($page['body_id'], get_themeconf('Exclude')) ) return false;
33
34          $template->set_filenames(array(
35                'add_menu_on_public_pages' => dirname(__FILE__) . '/template/add_menu_on_public_pages.tpl',
36          ));
37          include_once(PHPWG_ROOT_PATH.'include/menubar.inc.php');
38          $template->parse('add_menu_on_public_pages');
39         
40          if (is_admin())
41                {
42          $template->assign(
43        'U_ADMIN', get_root_url().'admin.php?page=picture_modify'
44      .'&amp;cat_id='.(isset($page['category']) ? $page['category']['id'] : '')
45      .( isset($page['image_id']) ? '&amp;image_id='.$page['image_id'] : '')
46      );
47                }
48         
49        }
50}
51
52
53// function load_pattern
54// include the right ***.pattern.php
55// not compatible 2.2and<2.2
56
57function load_pattern()
58{
59  global $pattern;
60  $pwgversion=str_replace('.','',PHPWG_VERSION);
61  $pwgversion_array=explode('.', PHPWG_VERSION);
62  if (file_exists($pwgversion.'pattern.php'))
63  {
64    include($pwgversion.'.pattern.php');
65    return true;
66  }
67  elseif (file_exists(PHPWG_ROOT_PATH.'themes/OS_default/'.$pwgversion_array[0].$pwgversion_array[1].'x.pattern.php'))
68  {
69    include(PHPWG_ROOT_PATH.'themes/OS_default/'.$pwgversion_array[0].$pwgversion_array[1].'x.pattern.php');
70    return true;
71  }
72  else
73  {
74    $list_pattern_path=array();
75    $dir=PHPWG_ROOT_PATH.'themes/OS_default';
76    $dh = opendir($dir);
77    while (($file = readdir ($dh)) !== false ) {
78      if ($file !== '.' && $file !== '..') {
79        $path =$dir.'/'.$file;
80        if (!is_dir ($path)) { 
81          if(strpos($file,'pattern.php')!==false) { //On ne prend que les .pattern.php
82            $list_pattern_path[]=$file;
83          }
84        }
85      }
86    }
87    closedir($dh);
88    $f=0;
89    for($i = 10; $i >=0; $i--)
90    {
91      if (in_array($pwgversion_array[0].$i.'.pattern.php',$list_pattern_path))
92      {
93        include($pwgversion_array[0].$i.'.pattern.php');
94        return true;
95        $f=1;
96        break;
97      }
98    }
99    if ($f=0)
100    {
101      return false;
102    }
103  }
104 
105}
106if(!load_pattern())
107{
108  global $page;
109  $page['errors'][]='Theme not compatible';
110}
111add_event_handler('loc_end_index', 'OS_default_index');
112function OS_default_index()
113{
114  global $template;
115  $template->set_prefilter('index', 'OS_default_prefilter_index');
116}
117function OS_default_prefilter_index($content, &$smarty)
118{
119  global $pattern;
120  $r=$pattern['OS_default_prefilter_index']['R'];
121  $ps=$pattern['OS_default_prefilter_index']['S'];
122  foreach($r as $i => $pr)
123  {
124    $content = str_replace($ps[$i], $pr, $content);
125  }
126  return $content;
127}
128
129add_event_handler('loc_begin_picture', 'OS_default_picture');
130function OS_default_picture()
131{
132  global $template;
133  $template->set_prefilter('picture', 'OS_default_prefilter_picture');
134}
135function OS_default_prefilter_picture($content, &$smarty)
136{
137  global $pattern;
138  $r=$pattern['OS_default_prefilter_picture']['R'];
139  $ps=$pattern['OS_default_prefilter_picture']['S'];
140  foreach($r as $i => $pr)
141  {
142    $content = preg_replace($ps[$i], $pr, $content);
143  }
144  return $content;
145}
146?>
Note: See TracBrowser for help on using the repository browser.