Changeset 1641 for trunk/include/functions_html.inc.php
- Timestamp:
- Dec 8, 2006, 12:21:54 AM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/functions_html.inc.php
r1624 r1641 27 27 function get_icon($date, $is_child_date = false) 28 28 { 29 global $page, $user, $ conf, $lang;29 global $page, $user, $lang; 30 30 31 31 if (empty($date)) 32 32 { 33 $date = 'NULL'; 34 } 35 36 if (isset($page['get_icon_cache'][$is_child_date][$date])) 37 { 38 return $page['get_icon_cache'][$is_child_date][$date]; 33 return ''; 34 } 35 36 if (isset($page['get_icon_cache'][$date])) 37 { 38 if (! $page['get_icon_cache'][$date] ) 39 return ''; 40 return $page['get_icon_cache']['_icons_'][$is_child_date]; 39 41 } 40 42 41 43 if (!preg_match('/^(\d{4})-(\d{2})-(\d{2})/', $date, $matches)) 42 { 43 // date can be empty, no icon to display 44 $page['get_icon_cache'][$is_child_date][$date] = ''; 45 return $page['get_icon_cache'][$is_child_date][$date]; 44 {// date can be empty, no icon to display 45 $page['get_icon_cache'][$date] = false; 46 return ''; 46 47 } 47 48 48 49 list($devnull, $year, $month, $day) = $matches; 49 50 $unixtime = mktime( 0, 0, 0, $month, $day, $year ); 50 51 51 if ($unixtime === false // PHP 5.1.0 and above 52 52 or $unixtime === -1) // PHP prior to 5.1.0 53 53 { 54 $page['get_icon_cache'][$ is_child_date][$date] = '';55 return $page['get_icon_cache'][$is_child_date][$date];54 $page['get_icon_cache'][$date] = false; 55 return ''; 56 56 } 57 57 58 58 $diff = time() - $unixtime; 59 59 $day_in_seconds = 24*60*60; 60 $output = ''; 61 $title = $lang['recent_image'].' '; 60 $page['get_icon_cache'][$date] = false; 62 61 if ( $diff < $user['recent_period'] * $day_in_seconds ) 63 62 { 64 $icon_url = get_themeconf('icon_dir').'/'.($is_child_date ? 'recent_by_child.png' : 'recent.png'); 65 $title .= $user['recent_period']; 66 $title .= ' '.$lang['days']; 67 $size = getimagesize( PHPWG_ROOT_PATH.$icon_url ); 68 $icon_url = get_root_url().$icon_url; 69 $output = '<img title="'.$title.'" src="'.$icon_url.'" class="icon" style="border:0;'; 70 $output.= 'height:'.$size[1].'px;width:'.$size[0].'px" alt="(!)" />'; 71 } 72 73 $page['get_icon_cache'][$is_child_date][$date] = $output; 74 75 return $page['get_icon_cache'][$is_child_date][$date]; 76 } 63 if ( !isset($page['get_icon_cache']['_icons_'] ) ) 64 { 65 $icons = array(false => 'recent', true => 'recent_by_child' ); 66 $title = $lang['recent_image'].' '.$user['recent_period'] 67 .' '.$lang['days']; 68 foreach ($icons as $key => $icon) 69 { 70 $icon_url = get_themeconf('icon_dir').'/'.$icon.'.png'; 71 $size = getimagesize( PHPWG_ROOT_PATH.$icon_url ); 72 $icon_url = get_root_url().$icon_url; 73 $output = '<img title="'.$title.'" src="'.$icon_url.'" class="icon" style="border:0;'; 74 $output.= 'height:'.$size[1].'px;width:'.$size[0].'px" alt="(!)" />'; 75 $page['get_icon_cache']['_icons_'][$key] = $output; 76 } 77 } 78 $page['get_icon_cache'][$date] = true; 79 } 80 if (! $page['get_icon_cache'][$date] ) 81 return ''; 82 return $page['get_icon_cache']['_icons_'][$is_child_date]; 83 } 84 77 85 78 86 function create_navigation_bar( … … 393 401 * HTML code generated uses logical list tags ul and each category is an 394 402 * item li. The paramter given is the category informations as an array, 395 * used keys are : id, name, nb_images, max_date_last, is_child_date_last,403 * used keys are : id, name, nb_images, max_date_last, date_last 396 404 * count_images, count_categories 397 405 * … … 474 482 $menu.= '</span>'; 475 483 } 476 477 $menu.= get_icon($category['max_date_last'], $category['is_child_date_last']); 484 $child_date_last = isset($category['date_last']) 485 and $category['max_date_last']>$category['date_last'] ; 486 $menu.= get_icon($category['max_date_last'], $child_date_last); 478 487 } 479 488
Note: See TracChangeset
for help on using the changeset viewer.