public function __construct($key = null, $secret_key = null, $account_id = null, $assoc_id = null)
{
// Instantiate the utilities class.
$this->util = new $this->utilities_class();
// Determine the current service.
$this->service = get_class($this);
// If both a key and secret key are passed in, use those.
if ($key && $secret_key)
{
$this->key = $key;
$this->secret_key = $secret_key;
}
// If neither are passed in, look for the constants instead.
else if (defined('AWS_KEY') && defined('AWS_SECRET_KEY'))
{
$this->key = AWS_KEY;
$this->secret_key = AWS_SECRET_KEY;
}
// Otherwise set the values to blank and return false.
else
{
throw new TarzanCore_Exception('No valid credentials were used to authenticate with AWS.');
}
// If account_id is passed in, use it.
if ($account_id)
{
$this->account_id = $account_id;
}
// If not passed in, look for the constant instead
else if (defined('AWS_ACCOUNT_ID'))
{
$this->account_id = AWS_ACCOUNT_ID;
}
// If assoc_id is passed in, use it.
if ($assoc_id)
{
$this->assoc_id = $assoc_id;
}
// If not passed in, look for the constant instead
else if (defined('AWS_ACCOUNT_ID'))
{
$this->assoc_id = AWS_ASSOC_ID;
}
return true;
}