Changeset 12048 for extensions/stripped_black_bloc/themeconf.inc.php
- Timestamp:
- Sep 4, 2011, 6:08:09 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/stripped_black_bloc/themeconf.inc.php
r11843 r12048 10 10 11 11 12 12 13 13 $themeconf = array( 14 14 'parent' => 'stripped', … … 31 31 function set_config_values_stripped_black_bloc() 32 32 { 33 34 35 33 global $conf, $template; 34 $config = unserialize( $conf['stripped_black_bloc'] ); 35 $template->assign( 'stripped_black_bloc', $config ); 36 36 } 37 37 38 38 /// EVENT 39 add_event_handler('loc_end_index_category_thumbnails', 'MY'); 40 add_event_handler('loc_end_index_thumbnails', 'MY'); 41 function MY($tpl_thumbnails_var) 39 40 /************************************ thumbnails and category_thumbnails ************************************/ 41 add_event_handler('loc_end_index_category_thumbnails', 'stripped_black_bloc'); 42 add_event_handler('loc_end_index_thumbnails', 'stripped_black_bloc'); 43 function stripped_black_bloc($tpl_thumbnails_var) 42 44 { 43 global $template, $conf; 44 $config = unserialize( $conf['stripped_black_bloc'] ); 45 $new_tplvar=array(); 46 foreach ($tpl_thumbnails_var as $tplvar) 47 { 48 list($width, $height, $type, $attr) = getimagesize( $tplvar['TN_SRC'] ); 49 $tplvar['TN_WIDTH']=$width; 50 $tplvar['TN_HEIGHT']=$height; 51 if (isset($config['thumbnail'])) 52 { 53 switch ($config['thumbnail']) 54 { 55 case 'generated': 56 if (isset($tplvar['FILE_WIDTH'])) 57 { 58 $tplvar['TN_SRC']=PHPWG_THEMES_PATH."stripped_black_bloc/library/timthumb.php?src=".$tplvar['FILE_PATH']."&w=".$config['thumbnail_width']; 59 } 60 else 61 { 62 $tplvar['TN_SRC']=PHPWG_THEMES_PATH."stripped_black_bloc/library/timthumb.php?src=".$tplvar['TN_SRC']."&w=".$config['thumbnail_width']; 63 } 64 $tplvar['TN_HEIGHT']=floor($tplvar['TN_HEIGHT']*($config['thumbnail_width']/$tplvar['TN_WIDTH'])); 65 $tplvar['TN_WIDTH']=$config['thumbnail_width']; 66 break; 67 case 'auto': 68 if($tplvar['TN_WIDTH']<=$config['thumbnail_width']) 69 { 70 if (isset($tplvar['FILE_WIDTH'])) 71 { 72 $tplvar['TN_SRC']=PHPWG_THEMES_PATH."stripped_black_bloc/library/timthumb.php?src=".$tplvar['FILE_PATH']."&w=".$config['thumbnail_width']; 73 } 74 else 75 { 76 $tplvar['TN_SRC']=PHPWG_THEMES_PATH."stripped_black_bloc/library/timthumb.php?src=".$tplvar['TN_SRC']."&w=".$config['thumbnail_width']; 77 } 78 $tplvar['TN_HEIGHT']=floor($tplvar['TN_HEIGHT']*($config['thumbnail_width']/$tplvar['TN_WIDTH'])); 79 $tplvar['TN_WIDTH']=$config['thumbnail_width']; 80 } 81 break; 82 case 'piwigo':break; 83 } 84 } 85 $new_tplvar[]=$tplvar; 86 } 87 return $new_tplvar; 45 global $template, $conf; 46 $config = unserialize( $conf['stripped_black_bloc'] ); 47 $new_tplvar=array(); 48 $i=1; 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; 54 if (!isset($tplvar['CAPTION_NB_IMAGES'])) 55 { 56 $conf_thumbnail_width=($i==$config['starting_to']) ? $config['column_width']+$config['thumbnail_width'] : $config['thumbnail_width']; 57 $tplvar['TN_CLASS']=($i==$config['starting_to']) ? "bloc_big" : "bloc"; 58 } 59 else 60 { 61 $conf_thumbnail_width=$config['thumbnail_width']; 62 } 63 if (isset($config['thumbnail'])) 64 { 65 switch ($config['thumbnail']) 66 { 67 case 'generated': 68 if (isset($tplvar['FILE_WIDTH'])) 69 { 70 $tplvar['TN_SRC']=PHPWG_THEMES_PATH."stripped_black_bloc/library/phpthumb/phpThumb.php?src=../../../../".$tplvar['FILE_PATH']."&w=".$conf_thumbnail_width; 71 } 72 else 73 { 74 $tplvar['TN_SRC']=PHPWG_THEMES_PATH."stripped_black_bloc/library/phpthumb/phpThumb.php?src=../../../../".$tplvar['TN_SRC']."&w=".$conf_thumbnail_width; 75 } 76 $tplvar['TN_HEIGHT']=floor($tplvar['TN_HEIGHT']*($conf_thumbnail_width/$tplvar['TN_WIDTH'])); 77 $tplvar['TN_WIDTH']=$conf_thumbnail_width; 78 break; 79 case 'auto': 80 if($tplvar['TN_WIDTH']<=$conf_thumbnail_width) 81 { 82 if (isset($tplvar['FILE_WIDTH'])) 83 { 84 $tplvar['TN_SRC']=PHPWG_THEMES_PATH."stripped_black_bloc/library/phpthumb/phpThumb.php?src=../../../../".$tplvar['FILE_PATH']."&w=".$conf_thumbnail_width; 85 } 86 else 87 { 88 $tplvar['TN_SRC']=PHPWG_THEMES_PATH."stripped_black_bloc/library/phpthumb/phpThumb.php?src=../../../../".$tplvar['TN_SRC']."&w=".$conf_thumbnail_width; 89 } 90 $tplvar['TN_HEIGHT']=floor($tplvar['TN_HEIGHT']*($conf_thumbnail_width/$tplvar['TN_WIDTH'])); 91 $tplvar['TN_WIDTH']=$conf_thumbnail_width; 92 } 93 break; 94 case 'piwigo':break; 95 } 96 } 97 $new_tplvar[]=$tplvar; 98 if ($i==$config['every_x']) 99 { 100 $i=1; 101 } 102 else { 103 $i++; 104 } 105 } 106 return $new_tplvar; 88 107 } 89 add_event_handler('init', ' MY_init');90 function MY_init()108 add_event_handler('init', 'stripped_black_bloc_init'); 109 function stripped_black_bloc_init() 91 110 { 92 111 remove_event_handler('loc_begin_index', 'modify_nb_thumbnail_page'); 93 112 } 94 113 … … 109 128 $content = preg_replace($search, $replacement, $content); 110 129 $search = '#\{if \!empty\(\$CONTENT_DESCRIPTION\) \}#'; 111 $replacement = ' 130 $replacement = ' <div id="subcontent"> 112 131 113 132 {if !empty($CONTENT_DESCRIPTION) }'; 114 133 $content = preg_replace($search, $replacement, $content); 115 134 $search = '#\{if \!empty\(\$navbar\) \}[\s]*\{include file=\'navigation_bar\.tpl\'\|@get_extent:\'navbar\'\}[\s]*\{/if\}#'; … … 119 138 $search = '#<\!-- subContent -->#'; 120 139 $replacement = '<!-- subContent --> 121 122 123 140 {if !empty($navbar) } 141 {include file=\'navigation_bar.tpl\'|@get_extent:\'navbar\'} 142 {/if}'; 124 143 return preg_replace($search, $replacement, $content); 125 144 }
Note: See TracChangeset
for help on using the changeset viewer.