summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--system/libraries/Email.php24
-rw-r--r--system/libraries/Form_validation.php12
-rw-r--r--user_guide/changelog.html2
3 files changed, 35 insertions, 3 deletions
diff --git a/system/libraries/Email.php b/system/libraries/Email.php
index a09ca5882..0a0d6c287 100644
--- a/system/libraries/Email.php
+++ b/system/libraries/Email.php
@@ -160,6 +160,8 @@ class CI_Email {
$this->_attach_type = array();
$this->_attach_disp = array();
}
+
+ return $this;
}
// --------------------------------------------------------------------
@@ -201,6 +203,8 @@ class CI_Email {
$this->_set_header('From', $name.' <'.$from.'>');
$this->_set_header('Return-Path', '<'.$from.'>');
+
+ return $this;
}
// --------------------------------------------------------------------
@@ -237,6 +241,8 @@ class CI_Email {
$this->_set_header('Reply-To', $name.' <'.$replyto.'>');
$this->_replyto_flag = TRUE;
+
+ return $this;
}
// --------------------------------------------------------------------
@@ -272,6 +278,8 @@ class CI_Email {
case 'mail' : $this->_recipients = implode(", ", $to);
break;
}
+
+ return $this;
}
// --------------------------------------------------------------------
@@ -299,6 +307,8 @@ class CI_Email {
{
$this->_cc_array = $cc;
}
+
+ return $this;
}
// --------------------------------------------------------------------
@@ -335,6 +345,8 @@ class CI_Email {
{
$this->_set_header('Bcc', implode(", ", $bcc));
}
+
+ return $this;
}
// --------------------------------------------------------------------
@@ -350,6 +362,7 @@ class CI_Email {
{
$subject = $this->_prep_q_encoding($subject);
$this->_set_header('Subject', $subject);
+ return $this;
}
// --------------------------------------------------------------------
@@ -364,6 +377,7 @@ class CI_Email {
function message($body)
{
$this->_body = stripslashes(rtrim(str_replace("\r", "", $body)));
+ return $this;
}
// --------------------------------------------------------------------
@@ -380,6 +394,7 @@ class CI_Email {
$this->_attach_name[] = $filename;
$this->_attach_type[] = $this->_mime_types(next(explode('.', basename($filename))));
$this->_attach_disp[] = $disposition; // Can also be 'inline' Not sure if it matters
+ return $this;
}
// --------------------------------------------------------------------
@@ -435,6 +450,7 @@ class CI_Email {
function set_alt_message($str = '')
{
$this->alt_message = ($str == '') ? '' : $str;
+ return $this;
}
// --------------------------------------------------------------------
@@ -449,6 +465,7 @@ class CI_Email {
function set_mailtype($type = 'text')
{
$this->mailtype = ($type == 'html') ? 'html' : 'text';
+ return $this;
}
// --------------------------------------------------------------------
@@ -463,6 +480,7 @@ class CI_Email {
function set_wordwrap($wordwrap = TRUE)
{
$this->wordwrap = ($wordwrap === FALSE) ? FALSE : TRUE;
+ return $this;
}
// --------------------------------------------------------------------
@@ -477,6 +495,7 @@ class CI_Email {
function set_protocol($protocol = 'mail')
{
$this->protocol = ( ! in_array($protocol, $this->_protocols, TRUE)) ? 'mail' : strtolower($protocol);
+ return $this;
}
// --------------------------------------------------------------------
@@ -503,6 +522,7 @@ class CI_Email {
}
$this->priority = $n;
+ return $this;
}
// --------------------------------------------------------------------
@@ -523,6 +543,8 @@ class CI_Email {
}
$this->newline = $newline;
+
+ return $this;
}
// --------------------------------------------------------------------
@@ -543,6 +565,8 @@ class CI_Email {
}
$this->crlf = $crlf;
+
+ return $this;
}
// --------------------------------------------------------------------
diff --git a/system/libraries/Form_validation.php b/system/libraries/Form_validation.php
index d62071b79..bf3689058 100644
--- a/system/libraries/Form_validation.php
+++ b/system/libraries/Form_validation.php
@@ -77,7 +77,7 @@ class CI_Form_validation {
// No reason to set rules if we have no POST data
if (count($_POST) == 0)
{
- return;
+ return $this;
}
// If an array was passed via the first parameter instead of indidual string
@@ -98,13 +98,13 @@ class CI_Form_validation {
// Here we go!
$this->set_rules($row['field'], $label, $row['rules']);
}
- return;
+ return $this;
}
// No fields? Nothing to do...
if ( ! is_string($field) OR ! is_string($rules) OR $field == '')
{
- return;
+ return $this;
}
// If the field label wasn't passed we use the field name
@@ -146,6 +146,8 @@ class CI_Form_validation {
'postdata' => NULL,
'error' => ''
);
+
+ return $this;
}
// --------------------------------------------------------------------
@@ -169,6 +171,8 @@ class CI_Form_validation {
}
$this->_error_messages = array_merge($this->_error_messages, $lang);
+
+ return $this;
}
// --------------------------------------------------------------------
@@ -187,6 +191,8 @@ class CI_Form_validation {
{
$this->_error_prefix = $prefix;
$this->_error_suffix = $suffix;
+
+ return $this;
}
// --------------------------------------------------------------------
diff --git a/user_guide/changelog.html b/user_guide/changelog.html
index 181fbe4db..56f750be8 100644
--- a/user_guide/changelog.html
+++ b/user_guide/changelog.html
@@ -106,6 +106,8 @@ Hg Tag: </p>
<li>Changed the default encryption mode in the Encryption library to CBC.</li>
<li>Added an <kbd>encode_from_legacy()</kbd> method to provide a way to transition encrypted data from CodeIgniter 1.x to CodeIgniter 2.x.
Please see the <a href="./installation/upgrade_200.html">upgrade instructions</a> for details.</li>
+ <li>Altered Form_Validation library to allow for method chaining on <kbd>set_rules()</kbd>, <kbd>set_message()</kbd> and <kbd>set_error_delimiters()</kbd> functions.</li>
+ <li>Altered Email Library to allow for method chaining.</li>
</ul>
</li>
<li>Database