Ignore:
Timestamp:
Mar 11, 2009, 6:25:26 PM (15 years ago)
Author:
patdenice
Message:

Move get_icon function.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/functions_html.inc.php

    r3185 r3188  
    2222// +-----------------------------------------------------------------------+
    2323
    24 function get_icon($date, $is_child_date = false)
    25 {
    26   global $cache, $user;
    27 
    28   if (empty($date))
    29   {
    30     return '';
    31   }
    32 
    33   if (isset($cache['get_icon'][$date]))
    34   {
    35     if (! $cache['get_icon'][$date] )
    36       return '';
    37     return $cache['get_icon']['_icons_'][$is_child_date];
    38   }
    39 
    40   if (!isset($cache['get_icon']['sql_recent_date']))
    41   {
    42     // Use MySql date in order to standardize all recent "actions/queries"
    43     list($cache['get_icon']['sql_recent_date']) =
    44       mysql_fetch_array(pwg_query('select SUBDATE(
    45       CURRENT_DATE,INTERVAL '.$user['recent_period'].' DAY)'));
    46   }
    47 
    48   $cache['get_icon'][$date] = false;
    49   if ( $date > $cache['get_icon']['sql_recent_date'] )
    50   {
    51     if ( !isset($cache['get_icon']['_icons_'] ) )
    52     {
    53       $icons = array(false => 'recent', true => 'recent_by_child' );
    54       $title = sprintf(
    55         l10n('elements posted during the last %d days'),
    56         $user['recent_period']
    57         );
    58       foreach ($icons as $key => $icon)
    59       {
    60         $icon_url = get_themeconf('icon_dir').'/'.$icon.'.png';
    61         $size = getimagesize( PHPWG_ROOT_PATH.$icon_url );
    62         $icon_url = get_root_url().$icon_url;
    63         $output = '<img title="'.$title.'" src="'.$icon_url.'" class="icon" style="border:0;';
    64         $output.= 'height:'.$size[1].'px;width:'.$size[0].'px" alt="(!)">';
    65         $cache['get_icon']['_icons_'][$key] = $output;
    66       }
    67     }
    68     $cache['get_icon'][$date] = true;
    69   }
    70 
    71   if (! $cache['get_icon'][$date] )
    72     return '';
    73   return $cache['get_icon']['_icons_'][$is_child_date];
    74 }
    75 
    7624/**
    7725 * returns the list of categories as a HTML string
Note: See TracChangeset for help on using the changeset viewer.