Permalink
Browse files

Made the lib fully compatible with GetSparks.org by providing an auto…

…load.php and the cURL library can now be installed as a Spark or in the normal way. Updated formatting docs too.
  • Loading branch information...
1 parent df80cab commit 3e9b4dd513452b5cfb07ca594daa12f0f1b51f2b @joelcox joelcox committed Mar 4, 2011
Showing with 44 additions and 42 deletions.
  1. +1 −29 .gitignore
  2. +22 −9 README.md
  3. +1 −1 config/amazon_ses.php
  4. +10 −0 config/autoload.php
  5. +10 −3 libraries/Amazon_ses.php
View
@@ -1,29 +1 @@
-.htaccess
-config/doctypes.php
-config/profiler.php
-config/autoload.php
-config/foreign_chars.php
-config/routes.php
-config/config.php
-config/hooks.php
-config/smileys.php
-config/constants.php
-config/index.html
-config/user_agents.php
-config/database.php
-config/mimes.php
-config/amazon_ses_real.php
-controllers/welcome.php
-controllers/index.html
-core/
-errors/
-helpers/
-hooks/
-index.html
-language/
-libraries/index.html
-models/
-third_party/
-views/
-logs/
-libraries/Curl.php
+config/amazon_ses_real.php
View
@@ -12,6 +12,10 @@ Requirements
4. Phil Sturgeon's CodeIgniter cURL library (http://github.com/philsturgeon/codeigniter-curl)
5. Amazon Web Services account (http://aws.amazon.com)
+Spark
+-------------
+This library is also released as a Spark (GetSparks.org). If you use this library in any other way, **don't copy the autoload.php to your config directory**.
+
Documentation
-------------
@@ -20,38 +24,47 @@ This library expects a configuration file to function correctly. A template for
### Recipients
-####$this->amazon_ses->to()
Set the "To" address(es) for a message.
-####$this->amazon_ses->cc()
+ $this->amazon_ses->to('to1@example.com');
+
Set the "CC" address(es) (carbon copy) for a message.
-####$this->amazon_ses->bcc()
+ $this->amazon_ses->cc('cc1@example.com, cc2@example.com');
+
Set the "BCC" address(es) (blind carbon copy) for a message.
+ $this->amazon_ses->bcc(array('bcc1@example.com', 'bcc2@example.com', 'bcc3@example.com'));
+
These three methods expect valid e-mail addresses as a string, array or comma separated list.
###Message
-####$this->amazon_ses->subject()
Set the subject for a message.
-####$this->amazon_ses->message()
+ $this->amazon_ses->subject('Open me!');
+
Set the message to be sent.
-####$this->amazon_ses->message_alt()
+ $this->amazon_ses->message('<strong>Use HTML</strong>');
+
Set the alternative message (plain-text) to be sent. When not specified, an alternative message is generated by using PHP's strip_tags() function.
-####$this->amazon_ses->send()
+ $this->amazon_ses->message_alt('No HTML?!');
+
Sends the message. Returns true on success.
+ $this->amazon_ses->send();
+
###Misc
-####$this->amazon_ses->debug()
Sends the message in debug mode. In debug mode, the send() methods returns the actual API response instead of a boolean. Call this method before calling the send method.
+
+ $this->amazon_ses->debug();
-####$this->amazon_ses->destroy()
Preserves recipient after the message has been successfully send. When you call this method, all recipients will be preserved during the objects life. This makes it possible to sent an additional message without re-specifying the recipients.
+
+ $this->amazon_ses->destroy();
Contributing
------------
View
@@ -3,7 +3,7 @@
/**
* Config for the Amazon Simple Email Service library
*
- * @see /application/libraries/Amazon_ses.php
+ * @see ../libraries/Amazon_ses.php
*/
// Amazon credentials
View
@@ -0,0 +1,10 @@
+<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
+
+/**
+ * Autoload for the Amazon Simple Email Service library. Only need when installing through GetSparks.org.
+ *
+ * @see ../libraries/Amazon_ses.php
+ */
+
+// Add autoload for Sparks
+$autoload['libraries'] = array('amazon_ses');
View
@@ -173,7 +173,15 @@ public function message_alt($message_alt)
*/
public function send($destroy = TRUE)
{
- $this->_ci->load->library('curl');
+ // First try to load the cURL library through Sparks and fall back on the default loader
+ if (method_exists($this->_ci->load, 'spark'))
+ {
+ $this->_ci->load->spark('curl/1.0');
+ }
+ else
+ {
+ $this->_ci->load->library('curl');
+ }
// Set the endpoint
$this->_ci->curl->create($this->_endpoint());
@@ -376,6 +384,5 @@ private function _endpoint()
{
return 'https://email.' . $this->region . '.amazonaws.com';
}
-
-
+
}

0 comments on commit 3e9b4dd

Please sign in to comment.