function settings_menu_html()
 {
     // Return HTML code for AWS S3 related settings.
     // -- The Assurer, 2010-12-09.
     // Fetch current settings...
     if (!eStore_as3tp::as3key_fetch($eStore_as3tp_aws_acckey, $eStore_as3tp_aws_seckey, $eStore_as3tp_expiry)) {
         return 'An error occurred while retrieving the current settings from the WordPress database!<br /><br />';
     }
     // Generate HTML menu code...
     $html_code = 'To utilize this feature, you need to first <a href="http://aws.amazon.com/s3" target="_blank">setup an Amazon Web Services (AWS), Simple Storage Service (S3) account</a>.<br />After you have setup your S3 account, you will need to <a href="http://s3.amazonaws.com/mturk/tools/pages/aws-access-identifiers/aws-identifier.html" target="_blank">know what your AWS Access Identifiers are</a>.<br /><br />' . '<table width="100%" border="0" cellspacing="0" cellpadding="6">';
     // AWS Access Key ID...
     $html_code .= '<tr valign="top">' . '<td width="25%" align="left">AWS Access Key ID</td>' . '<td align="left">' . '<input type="text" name="eStore_as3tp_aws_acckey" value="' . $eStore_as3tp_aws_acckey . '" size="50" /><i>    Your 20 character AWS Acceess Key ID.</i><br /><br /></td></tr>';
     // AWS Secret Access Key...
     $html_code .= '<tr valign="top">' . '<td width="25%" align="left">AWS Secret Access Key</td>' . '<td align="left">' . '<input type="text" name="eStore_as3tp_aws_seckey" value="' . $eStore_as3tp_aws_seckey . '" size="50" /><i>    Your 40 character AWS Secret Acceess Key.</i><br /><br /></td></tr>';
     // AWS S3 presigned URL expiry...
     $html_code .= '<tr valign="top">' . '<td width="25%" align="left">AWS S3 Presigned URL Expiry</td>' . '<td align="left">' . '<input type="text" name="eStore_as3tp_expiry" value="' . $eStore_as3tp_expiry . '" size="5" /><i>    Number of seconds before a presigned URL expires.<br />Time is measured from the moment an encrypted link is used, until the user\'s browser is transferred to the AWS server.  May need adjustment if the system clock on your server is not in sync with the AWS server.</i><br /><br /></td></tr></table>';
     return $html_code;
 }
 function uri_authority(&$aws_acckey, &$aws_seckey, &$expiry)
 {
     // Performs URI authority syntax error checking and, as necessary, fills in the following variables:
     // $aws_acckey = 20 character AWS access key ID.
     // $aws_seckey = 40 character AWS secret access key.
     // $Expiry = Number of seconds before AWS S3 resource access expires.
     // Returns 1 if the URI authority is "public," or -1 if the URI authority is "private."
     // Returns FALSE if any AWSAccessKeyId:AWSSecretKey:Expiry syntax errors occur.
     // Permitted calling values for AWSAccessKeyId:AWSSecretKey:Expiry are:
     //	AWSAccessKeyId		AWSSecretKey		Expiry		Resulting Return Value(s)
     //	---------------		---------------		----------	------------------------------------------------
     //	"public"		Null			Null		Returns 1.
     //	Null			Null			Null		Returns -1.  Fills in access key, secret key and
     //									expiry values from the WordPress options.
     // All other calling values for AWSAccessKeyId:AWSSecretKey:Expiry will cause a FALSE to be returned.
     // -- The Assurer, 2010-11-27.
     if ($aws_seckey != '' || $expiry != '') {
         return FALSE;
     }
     // $aws_seckey & $expiry must be null.
     if (strtolower($aws_acckey) == 'public') {
         // Access is public...
         $aws_acckey = 'public';
         // Normalize $aws_acckey.
         return 1;
     }
     // Access is private...
     if ($aws_acckey != '') {
         return FALSE;
     }
     // No other authorities are supported.
     // Get preconfigured AWS Access Key ID, Secret Key and expiry...
     if (!eStore_as3tp::as3key_fetch($aws_acckey, $aws_seckey, $expiry)) {
         return FALSE;
     }
     // Perform error checking...
     if (strlen($aws_acckey) != 20) {
         return FALSE;
     }
     // Access Key ID must be 20 chars.
     if (strlen($aws_seckey) != 40) {
         return FALSE;
     }
     // Secret Key must be 40 chars.
     if (preg_match('/^[0-9]+$/', $expiry) != 1) {
         return FALSE;
     }
     // Expiry must be a decimal integer.
     return -1;
 }