File:  [mozdev] / cdn / www / pxHlp_ext / themeSetup.html
Revision 1.14: download - view: text, annotated - select for diffs - revision graph
Mon Feb 17 08:21:52 2003 UTC (16 years, 9 months ago) by cdn
Branches: MAIN
CVS tags: HEAD
and initial .=

    1: <?php
    2: 
    3: // $Id: themeSetup.html,v 1.14 2003/02/17 08:21:52 cdn Exp $
    4: 
    5: $themeArray = array();
    6: 
    7: function getThemeCount($themeArray) {
    8:   return count($themeArray);
    9: }
   10: 
   11: function makeThemeGrid($themeArray) {
   12:   if (count($themeArray) == 0) {
   13:     echo('<p><b><i>A <a href="javascript:">JavaScript Error</a> has probably occurred</i></b></p>');
   14:   }
   15: 
   16:   for ($i = 0; $i < count($themeArray); ++$i) {
   17:     echo("\n" . '<div');
   18:     if (checkDateWindow($themeArray[$i]['updated'])) { 
   19:       echo(' class="updated"');
   20:     }
   21:     echo('><a href="#' . rawurlencode($themeArray[$i]['name']) . '">' . $themeArray[$i]['name']);
   22:     echo('<br /><img src="' . $themeArray[$i]['preview'] . '" alt="" title="Preview of ' . $themeArray[$i]['name'] . ' theme ');
   23:     if (checkDateWindow($themeArray[$i]['updated'])) { 
   24:       echo('(Theme recently updated!)');
   25:     }
   26:     echo('" /></a></div>');
   27:   }
   28: }
   29: 
   30: 
   31: function listThemes($themeArray) {
   32:   for ($i = 0; $i < count($themeArray); ++$i) { 
   33:     $ret .= '<a name="';
   34:     $ret .= $themeArray[$i]['name'];
   35:     $ret .= '"></a><div class="theme">' . "\n" . '<img src="';
   36:     $ret .= $themeArray[$i]['preview'];
   37:     $ret .= '" alt="" title="Screenshot of ';
   38:     $ret .= $themeArray[$i]['name'];
   39:     $ret .= ' theme" /><p class="info"><strong>' . $themeArray[$i]['name'] . '</strong> by ';
   40:     for ($j=0; $j < count($themeArray[$i]['author']); ++$j) {
   41:       if ($j > 0 && count($themeArray[$i]['author']) > 1 ) {
   42:         $ret .= ', ';
   43:       }
   44:       if ($themeArray[$i]['authorEmail'][$j] != '') {
   45:         $ret .= '<a href="mailto:';
   46:         $ret .= $themeArray[$i]['authorEmail'][$j];
   47:         $ret .= '">';
   48:       }
   49:       $ret .= $themeArray[$i]['author'][$j];
   50:       if ($themeArray[$i]['authorEmail'][$j] != '') {
   51:         $ret .= '</a>';
   52:       }
   53:     }
   54:     
   55:     $ret .= '<br />Version ' . $themeArray[$i]['version'] . ', ';
   56:     if (checkDateWindow($themeArray[$i]['updated'])) {
   57:     	$ret .= '<span class="updated">';
   58:     }
   59:     $ret .= 'Updated ' . $themeArray[$i]['updated'];
   60:     if (checkDateWindow($themeArray[$i]['updated'])) {
   61:     	$ret .= '</span>';
   62:     }
   63:     $ret .= '<br /><a href="';
   64:     $ret .= $themeArray[$i]['installFile'];
   65:     $ret .= '" onclick="installThemeNow(\'';
   66:     $ret .= $themeArray[$i]['installFile'];
   67:     $ret .= '\'); return false;">Install</a> or ';
   68:     $ret .= '<a href="' . $themeArray[$i]['installFile'] . '">Download</a> Theme (' . $themeArray[$i]['size'] . ' KB)<br />';
   69:     if ($themeArray[$i]['homepage'] != '') {
   70:       $ret .= '<a href="' . $themeArray[$i]['homepage'] . '">Visit Theme Homepage</a>';
   71:     }
   72:     else {
   73:       $ret .= 'Theme homepage not available.';
   74:     }
   75:     $ret .= '</p>';
   76:     
   77:     $ret .= '<p class="desc">' . $themeArray[$i]['description'] . '</p></div>';
   78:   }
   79:   
   80:   return $ret;
   81: }
   82: 
   83: function checkDateWindow($dateString) { // Input string of yyyy-mm-dd
   84:   $newDaysWindow = 7 * (60 * 60 * 24); // Only new for 7 days
   85:   $dateArray = explode('-', $dateString);
   86:   $newDate = mktime(0, 0, 0, $dateArray[1] - 1, $dateArray[2], $dateArray[0]) + $newDaysWindow;
   87:   return ( $newDate > time() );
   88: }
   89: 
   90: ?>

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>