[9237] | 1 | <?php |
---|
| 2 | /* |
---|
| 3 | Theme Name: OS_default |
---|
[10053] | 4 | Version: auto |
---|
[9237] | 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 |
---|
[30085] | 19 | 'colorscheme' => 'clear', |
---|
[9237] | 20 | ); |
---|
[14974] | 21 | |
---|
[10450] | 22 | /*********************************menu on every pages ************************************/ |
---|
[9237] | 23 | // thx to Vdigital and his plugin spreadmenus |
---|
| 24 | if ( !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 | .'&cat_id='.(isset($page['category']) ? $page['category']['id'] : '') |
---|
| 45 | .( isset($page['image_id']) ? '&image_id='.$page['image_id'] : '') |
---|
| 46 | ); |
---|
| 47 | } |
---|
| 48 | |
---|
| 49 | } |
---|
| 50 | } |
---|
[14390] | 51 | |
---|
| 52 | |
---|
| 53 | // function load_pattern |
---|
| 54 | // include the right ***.pattern.php |
---|
| 55 | // not compatible 2.2and<2.2 |
---|
| 56 | |
---|
| 57 | function 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 | } |
---|
[21027] | 67 | elseif (file_exists(PHPWG_ROOT_PATH.'themes/OS_default/'.$pwgversion_array[0].$pwgversion_array[1].'x.pattern.php')) |
---|
[14390] | 68 | { |
---|
[21027] | 69 | include(PHPWG_ROOT_PATH.'themes/OS_default/'.$pwgversion_array[0].$pwgversion_array[1].'x.pattern.php'); |
---|
[14390] | 70 | return true; |
---|
| 71 | } |
---|
| 72 | else |
---|
| 73 | { |
---|
| 74 | $list_pattern_path=array(); |
---|
[21027] | 75 | $dir=PHPWG_ROOT_PATH.'themes/OS_default'; |
---|
[14390] | 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 | } |
---|
| 106 | if(!load_pattern()) |
---|
| 107 | { |
---|
| 108 | global $page; |
---|
| 109 | $page['errors'][]='Theme not compatible'; |
---|
| 110 | } |
---|
[10450] | 111 | add_event_handler('loc_end_index', 'OS_default_index'); |
---|
| 112 | function OS_default_index() |
---|
| 113 | { |
---|
[14652] | 114 | global $template; |
---|
| 115 | $template->set_prefilter('index', 'OS_default_prefilter_index'); |
---|
[10450] | 116 | } |
---|
| 117 | function OS_default_prefilter_index($content, &$smarty) |
---|
| 118 | { |
---|
[14390] | 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; |
---|
[10450] | 127 | } |
---|
[11929] | 128 | |
---|
| 129 | add_event_handler('loc_begin_picture', 'OS_default_picture'); |
---|
| 130 | function OS_default_picture() |
---|
| 131 | { |
---|
[14652] | 132 | global $template; |
---|
| 133 | $template->set_prefilter('picture', 'OS_default_prefilter_picture'); |
---|
[11929] | 134 | } |
---|
| 135 | function OS_default_prefilter_picture($content, &$smarty) |
---|
| 136 | { |
---|
[14390] | 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; |
---|
[11929] | 145 | } |
---|
[21027] | 146 | ?> |
---|