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

Last change on this file since 10451 was 10450, checked in by flop25, 13 years ago

prefilter for index.tpl

File size: 3.3 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);
20/*********************************menu on every pages ************************************/
21// thx to Vdigital and his plugin spreadmenus
22if ( !function_exists( 'add_menu_on_public_pages' ) ) {
23        if ( defined('IN_ADMIN') and IN_ADMIN ) return false;
24        add_event_handler('loc_after_page_header', 'add_menu_on_public_pages', 20);
25
26        function  add_menu_on_public_pages() {
27          if ( function_exists( 'initialize_menu') ) return false; # The current page has already the menu
28          if ( !get_themeconf('add_menu_on_public_pages') ) return false; # The current page has already the menu
29          global $template, $page, $conf;
30          if ( isset($page['body_id']) and in_array($page['body_id'], get_themeconf('Exclude')) ) return false;
31
32          $template->set_filenames(array(
33                'add_menu_on_public_pages' => dirname(__FILE__) . '/template/add_menu_on_public_pages.tpl',
34          ));
35          include_once(PHPWG_ROOT_PATH.'include/menubar.inc.php');
36          $template->parse('add_menu_on_public_pages');
37         
38          if (is_admin())
39                {
40          $template->assign(
41        'U_ADMIN', get_root_url().'admin.php?page=picture_modify'
42      .'&amp;cat_id='.(isset($page['category']) ? $page['category']['id'] : '')
43      .( isset($page['image_id']) ? '&amp;image_id='.$page['image_id'] : '')
44      );
45                }
46         
47        }
48}
49/************************************ index.tpl ************************************/
50add_event_handler('loc_end_index', 'OS_default_index');
51function OS_default_index()
52{
53    global $template;
54    $template->set_prefilter('index', 'OS_default_prefilter_index');
55}
56function OS_default_prefilter_index($content, &$smarty)
57{
58  $search = '#<div id="content" class="content">#'; 
59  $replacement = '<div id="content" class="content">
60  <table id="table_content" border="0" cellspacing="0" cellpadding="0">
61    <tr>
62      <td id="section_up_left">&nbsp;</td>
63      <td id="section_up">
64';
65  $content = preg_replace($search, $replacement, $content);
66
67  $search = '#</div>\{\* <\!-- titrePage --> \*\}#'; 
68  $replacement = '';
69  $content = preg_replace($search, $replacement, $content);
70       
71  $search = '#<h2>\{\$TITLE\}</h2>#'; 
72  $replacement = '<h2>{$TITLE}</h2>
73        </div>{* <!-- titrePage --> *} 
74          </td>
75      <td id="section_up_right">&nbsp;</td>
76    </tr>
77    <tr>
78      <td id="section_left">&nbsp;</td>
79      <td id="section_in">';
80  $content = preg_replace($search, $replacement, $content);
81       
82  $search = '#\{if \!empty\(\$PLUGIN_INDEX_CONTENT_END\)\}\{\$PLUGIN_INDEX_CONTENT_END\}\{/if\}#'; 
83  $replacement = '{if !empty($PLUGIN_INDEX_CONTENT_END)}{$PLUGIN_INDEX_CONTENT_END}{/if}
84      </td>
85          <td id="section_right">&nbsp;</td>
86    </tr>
87    <tr>
88      <td id="section_bottom_left">&nbsp;</td>
89      <td id="section_bottom" >&nbsp;</td>
90      <td id="section_bottom_right" >&nbsp;</td>
91    </tr>
92  </table>
93';
94  return preg_replace($search, $replacement, $content);
95}
96?>
Note: See TracBrowser for help on using the repository browser.