File:  [mozdev] / cdn / www / pxHlp_ext / extensionSetup.html
Revision 1.16: download - view: text, annotated - select for diffs - revision graph
Mon Feb 17 01:01:08 2003 UTC (16 years, 10 months ago) by cdn
Branches: MAIN
CVS tags: HEAD
yet another func

    1: <?php
    2: 
    3: // $Id: extensionSetup.html,v 1.16 2003/02/17 01:01:08 cdn Exp $
    4: 
    5: // Functions needed for an XPI install
    6: // Simplified version of Chris Cooks' install script
    7: 
    8: /*
    9: function doneFn(name,result) {}
   10: 
   11: function isValidUa() {
   12:   // Returns true if script is run in the Phoenix browser
   13:   
   14:   var ua=navigator.userAgent.toLowerCase();
   15:   if(ua.indexOf('gecko')!=-1 && ua.indexOf('phoenix')!=-1) {
   16:       return true;
   17:   }
   18:   return false;
   19: }
   20: 
   21: function doXPIInstall(file,name) {
   22:   if(!isValidUa()) {
   23:   	alert('This extension is not supported by your browser.');
   24:   	return false;
   25:   }
   26:   var xpi = new Object();
   27:   xpi[name] = file;
   28:   InstallTrigger.install(xpi,doneFn);
   29: }
   30: */
   31: 
   32: // here down js->php
   33: 
   34: /*
   35: function checkDateWindow(dateString) { // Input string of yyyy-mm-dd
   36:   var newDaysWindow = 7 * (1000 * 60 * 60 * 24); // Only new for 7 days
   37:   var dateArray = dateString.split('-');
   38:   var newDate = (new Date( dateArray[0], dateArray[1] - 1, dateArray[2])).valueOf() + newDaysWindow;
   39:   return ( newDate > (new Date()).valueOf() );
   40: }
   41: */
   42: 
   43: $extensionArray = array();
   44: 
   45: function makeExtensionGrid($extensionArray) {
   46:   if (count($extensionArray) == 0) {
   47:     echo('<p><b><i>A <a href="javascript:">JavaScript Error</a> has probably occurred</i></b></p>');
   48:   }
   49:   echo('<ul>');
   50:   for ($i = 0; $i < count($extensionArray); $i++) {
   51:     echo('<div>');
   52:     echo('<li><a href="#');
   53:     echo(rawurlencode($extensionArray[$i]['name']));
   54:     echo('">');
   55:     echo($extensionArray[$i]['name']);
   56:     echo('</a></li>');
   57:   }
   58:   echo('</ul>');
   59: }
   60: 
   61: function listExtensions($extensionArray)
   62: {
   63: 
   64:   $howMany = count($extensionArray);
   65: 
   66:   $ret = '<p>This list contains most known Phoenix Extensions. There are currently ' . $howMany . ' extensions available here.</p>';
   67:   
   68:   for ($i = 0; $i < $howMany; $i++)
   69:   {
   70:    
   71:     $ret .= '<a name="';
   72:     $ret .= $extensionArray[$i]['name'];
   73:     $ret .= '"></a>';
   74:     $ret .= '<table class="extensions"><thead><tr><td colspan="4">';
   75:     $ret .= $extensionArray[$i]['name'];
   76:     $ret .= '</td></tr></thead>';
   77:     $ret .= '<tbody><tr>';
   78:     $ret .= '<td class="label">Size:</td><td class="size">';
   79:     $ret .= $extensionArray[$i]['size'];
   80:     $ret .= ' KB</td>';
   81:     $ret .= '<td class="label">Author:</td><td>';
   82:     for ($j=0; $extensionArray[$i]['author'][$j] != ''; $j++) {
   83:       if ($j > 0 && count($extensionArray[$i]['author']) > 1 ) {
   84:         $ret .= ', ';
   85:       }
   86:       if ($extensionArray[$i]['authorEmail'][$j] != '') {
   87:         $ret .= '<a href="mailto:';
   88:         $ret .= $extensionArray[$i]['authorEmail'][$j];
   89:         $ret .= '">';
   90:       }
   91:       $ret .= $extensionArray[$i]['author'][$j];
   92:       if ($extensionArray[$i]['authorEmail'][$j] != '') {
   93:         $ret .= '</a>';
   94:       }
   95:     }
   96:     $ret .= '</td></tr><tr><td class="label">Install:</td><td><a href="';
   97:     $ret .= $extensionArray[$i]['installFile'];
   98:     $ret .= '">Click Here</a></td><td class="label">Homepage:</td><td>';
   99:     if ($extensionArray[$i].homepage != '') {
  100:       $ret .= '<a href="';
  101:       $ret .= $extensionArray[$i]['homepage'];
  102:       $ret .= '">';
  103:       $ret .= $extensionArray[$i]['homepage'];
  104:       $ret .= '</a>';
  105:     }
  106:     else {
  107:       $ret .= 'N/A';
  108:     }
  109:     $ret .= '</td></tr><tr><td colspan="4">';
  110:     $ret .= $extensionArray[$i]['description'];
  111:     $ret .= '</td></tr></tbody></table>';
  112:   
  113:   }
  114: 
  115:   return $ret;
  116: 
  117: }
  118: 
  119: ?>

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