Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Added very basic HTML tag stripping support for plain_message();

  • Loading branch information...
commit 62eeaf37fa9718fec9644b900c9c4fe8b84e275c 1 parent 0245adf
@zackkitzmiller authored
View
18 system/application/config/postmark.php
@@ -22,7 +22,7 @@
|
| If you're going to be using the same Sender Signature for all emails, it
| might be easier to assign it here, than doing so with each individual
-| email.
+| email. If you are not using this setting, comment it out.
|
| Configure your Sender Signatures at http://postmarkapp.com/signatures
*/
@@ -41,4 +41,18 @@
| This is reccomended on high traffic servers
|
*/
-$config['validation'] = TRUE;
+$config['validation'] = TRUE;
+
+/*
+|--------------------------------------------------------------------------
+| STRIP_HTML
+|--------------------------------------------------------------------------
+|
+| Setting strip_tags to TRUE will strip all HTML tags from _plain_message
+| using PHP's strip_tags() function. It should be noted that the output
+| will probably be far from what you would expect.
+|
+| Experimental Feature
+|
+*/
+$config['strip_html'] = FALSE;
View
26 system/application/libraries/Postmark.php
@@ -17,6 +17,7 @@ class Postmark {
var $CI;
var $api_key = '';
var $validation = FALSE;
+ var $strip_html = FALSE;
var $from_name;
var $from_address;
@@ -180,8 +181,15 @@ function subject($subject)
*/
function message_plain($message)
{
- $this->_message_plain = $message;
- }
+ if ( ! $this->strip_html )
+ {
+ $this->_message_plain = $message;
+ }
+ else
+ {
+ $this->_message_plain = $this->_strip_html($message);
+ }
+ }
// --------------------------------------------------------------------
@@ -290,5 +298,19 @@ function send($from_address = null, $from_name = null, $to_address = null, $to_n
function _validate_email($address)
{
return ( ! preg_match("/^([a-z0-9\+_\-]+)(\.[a-z0-9\+_\-]+)*@([a-z0-9\-]+\.)+[a-z]{2,6}$/ix", $address)) ? FALSE : TRUE;
+ }
+
+ // --------------------------------------------------------------------
+
+ /**
+ * Strip Html
+ *
+ * @access public
+ * @param string
+ * @return string
+ */
+ function _strip_html($message)
+ {
+ return strip_tags($message);
}
}
Please sign in to comment.
Something went wrong with that request. Please try again.