| 1 | <?php |
|---|
| 2 | /* |
|---|
| 3 | Theme Name: OS_default |
|---|
| 4 | Version: auto |
|---|
| 5 | Description: |
|---|
| 6 | Theme URI: http://piwigo.org/ext/extension_view.php?eid=497 |
|---|
| 7 | Author: flop25 |
|---|
| 8 | Author 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 |
|---|
| 22 | if ( !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 | .'&cat_id='.(isset($page['category']) ? $page['category']['id'] : '') |
|---|
| 43 | .( isset($page['image_id']) ? '&image_id='.$page['image_id'] : '') |
|---|
| 44 | ); |
|---|
| 45 | } |
|---|
| 46 | |
|---|
| 47 | } |
|---|
| 48 | } |
|---|
| 49 | /************************************ index.tpl ************************************/ |
|---|
| 50 | add_event_handler('loc_end_index', 'OS_default_index'); |
|---|
| 51 | function OS_default_index() |
|---|
| 52 | { |
|---|
| 53 | global $template; |
|---|
| 54 | $template->set_prefilter('index', 'OS_default_prefilter_index'); |
|---|
| 55 | } |
|---|
| 56 | function 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"> </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"> </td> |
|---|
| 76 | </tr> |
|---|
| 77 | <tr> |
|---|
| 78 | <td id="section_left"> </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"> </td> |
|---|
| 86 | </tr> |
|---|
| 87 | <tr> |
|---|
| 88 | <td id="section_bottom_left"> </td> |
|---|
| 89 | <td id="section_bottom" > </td> |
|---|
| 90 | <td id="section_bottom_right" > </td> |
|---|
| 91 | </tr> |
|---|
| 92 | </table> |
|---|
| 93 | '; |
|---|
| 94 | return preg_replace($search, $replacement, $content); |
|---|
| 95 | } |
|---|
| 96 | |
|---|
| 97 | /************************************ picture.tpl ************************************/ |
|---|
| 98 | add_event_handler('loc_begin_picture', 'OS_default_picture'); |
|---|
| 99 | function OS_default_picture() |
|---|
| 100 | { |
|---|
| 101 | global $template; |
|---|
| 102 | $template->set_prefilter('picture', 'OS_default_prefilter_picture'); |
|---|
| 103 | } |
|---|
| 104 | function OS_default_prefilter_picture($content, &$smarty) |
|---|
| 105 | { |
|---|
| 106 | $search = '#<div id="imageInfos">.*<table id="standard" class="infoTable">#s'; |
|---|
| 107 | $replacement = '<table id="standard" class="infoTable">'; |
|---|
| 108 | return preg_replace($search, $replacement, $content); |
|---|
| 109 | } |
|---|
| 110 | |
|---|
| 111 | |
|---|
| 112 | |
|---|
| 113 | ?> |
|---|