[10851] | 1 | <?php |
---|
| 2 | /* |
---|
[11679] | 3 | Theme Name: Stripped & Columns |
---|
[11680] | 4 | Version: auto |
---|
[10851] | 5 | Description: stripped_black_bloc |
---|
[11680] | 6 | Theme URI: http://piwigo.org/ext/extension_view.php?eid=568 |
---|
| 7 | Author: flop25 |
---|
| 8 | Author URI: http://www.planete-flop.fr |
---|
[10851] | 9 | */ |
---|
| 10 | |
---|
| 11 | |
---|
| 12 | |
---|
| 13 | $themeconf = array( |
---|
| 14 | 'parent' => 'stripped', |
---|
| 15 | 'name' => 'stripped_black_bloc', |
---|
| 16 | 'theme_dir' => 'stripped_black_bloc', |
---|
| 17 | 'icon_dir' => 'themes/stripped/icon', |
---|
| 18 | 'admin_icon_dir' => 'themes/default/icon/admin', |
---|
| 19 | 'mime_icon_dir' => 'themes/default/icon/mimetypes/', |
---|
| 20 | 'local_head' => 'local_head.tpl', |
---|
| 21 | ); |
---|
[11696] | 22 | |
---|
| 23 | load_language('theme.lang', PHPWG_THEMES_PATH.'stripped_black_bloc/'); |
---|
| 24 | |
---|
[11699] | 25 | // Need upgrade? |
---|
[11696] | 26 | |
---|
[11699] | 27 | global $conf; |
---|
| 28 | |
---|
| 29 | if (!isset($conf['stripped_black_bloc'])) |
---|
| 30 | include(PHPWG_THEMES_PATH.'stripped_black_bloc/admin/upgrade.inc.php'); |
---|
| 31 | |
---|
| 32 | add_event_handler('loc_begin_page_header', 'set_config_values_stripped_black_bloc'); |
---|
| 33 | |
---|
| 34 | function set_config_values_stripped_black_bloc() |
---|
| 35 | { |
---|
| 36 | global $conf, $template; |
---|
| 37 | $config = unserialize( $conf['stripped_black_bloc'] ); |
---|
| 38 | $template->assign( 'stripped_black_bloc', $config ); |
---|
| 39 | } |
---|
| 40 | |
---|
| 41 | /// EVENT |
---|
[11677] | 42 | add_event_handler('loc_end_index_category_thumbnails', 'MY'); |
---|
[10851] | 43 | add_event_handler('loc_end_index_thumbnails', 'MY'); |
---|
| 44 | function MY($tpl_thumbnails_var) |
---|
| 45 | { |
---|
[11699] | 46 | global $template, $conf; |
---|
| 47 | $config = unserialize( $conf['stripped_black_bloc'] ); |
---|
[10851] | 48 | $new_tplvar=array(); |
---|
| 49 | foreach ($tpl_thumbnails_var as $tplvar) |
---|
| 50 | { |
---|
| 51 | list($width, $height, $type, $attr) = getimagesize( $tplvar['TN_SRC'] ); |
---|
| 52 | $tplvar['TN_WIDTH']=$width; |
---|
| 53 | $tplvar['TN_HEIGHT']=$height; |
---|
[11699] | 54 | if (isset($config['thumbnail'])) |
---|
| 55 | { |
---|
| 56 | switch ($config['thumbnail']) |
---|
| 57 | { |
---|
| 58 | case 'generated': |
---|
| 59 | $tplvar['TN_SRC']=PHPWG_THEMES_PATH."stripped_black_bloc/library/timthumb.php?src=".$tplvar['TN_SRC']."&w=".$config['thumbnail_width']; |
---|
| 60 | $tplvar['TN_HEIGHT']=floor($tplvar['TN_HEIGHT']*($config['thumbnail_width']/$tplvar['TN_WIDTH'])); |
---|
| 61 | $tplvar['TN_WIDTH']=$config['thumbnail_width']; |
---|
| 62 | break; |
---|
| 63 | case 'auto': |
---|
| 64 | if($tplvar['TN_WIDTH']<=$config['thumbnail_width']) |
---|
| 65 | { |
---|
| 66 | $tplvar['TN_SRC']=PHPWG_THEMES_PATH."stripped_black_bloc/library/timthumb.php?src=".$tplvar['TN_SRC']."&w=".$config['thumbnail_width']; |
---|
| 67 | $tplvar['TN_HEIGHT']=floor($tplvar['TN_HEIGHT']*($config['thumbnail_width']/$tplvar['TN_WIDTH'])); |
---|
| 68 | $tplvar['TN_WIDTH']=$config['thumbnail_width']; |
---|
| 69 | } |
---|
| 70 | break; |
---|
| 71 | case 'piwigo':break; |
---|
| 72 | } |
---|
| 73 | } |
---|
[10851] | 74 | $new_tplvar[]=$tplvar; |
---|
| 75 | } |
---|
| 76 | return $new_tplvar; |
---|
| 77 | } |
---|
[11498] | 78 | add_event_handler('init', 'MY_init'); |
---|
| 79 | function MY_init() |
---|
| 80 | { |
---|
| 81 | remove_event_handler('loc_begin_index', 'modify_nb_thumbnail_page'); |
---|
| 82 | } |
---|
[11696] | 83 | |
---|
| 84 | /************************************ index.tpl ************************************/ |
---|
| 85 | add_event_handler('loc_end_index', 'stripped_black_bloc_index'); |
---|
| 86 | function stripped_black_bloc_index() |
---|
| 87 | { |
---|
| 88 | global $template; |
---|
| 89 | $template->set_prefilter('index', 'stripped_black_bloc_prefilter_index'); |
---|
| 90 | } |
---|
| 91 | function stripped_black_bloc_prefilter_index($content, &$smarty) |
---|
| 92 | { |
---|
| 93 | $search = '#\{if \!empty\(\$navbar\) \}[\s]*\{include file=\'navigation_bar\.tpl\'\|@get_extent:\'navbar\'\}[\s]*\{/if\}#'; |
---|
| 94 | $replacement = ''; |
---|
| 95 | $content = preg_replace($search, $replacement, $content); |
---|
| 96 | |
---|
| 97 | $search = '#<\!-- subContent -->#'; |
---|
[11697] | 98 | $replacement = '<!-- subContent --> |
---|
[11696] | 99 | {if !empty($navbar) } |
---|
| 100 | {include file=\'navigation_bar.tpl\'|@get_extent:\'navbar\'} |
---|
| 101 | {/if}'; |
---|
| 102 | return preg_replace($search, $replacement, $content); |
---|
| 103 | } |
---|
| 104 | |
---|
[10851] | 105 | ?> |
---|