Merge pull request #690 from Repox/develop
Proposal for an updated mod_rewrite suggestion.
The existing mod_rewrite example in the documentation led to confusion with new users about how to include CSS, JS and image files.
diff --git a/application/config/config.php b/application/config/config.php
index 808cc33..063c3d5 100644
--- a/application/config/config.php
+++ b/application/config/config.php
@@ -253,6 +253,9 @@
|
| If you use the Encryption class or the Session class you
| MUST set an encryption key. See the user guide for info.
+|
+| http://codeigniter.com/user_guide/libraries/encryption.html
+| http://codeigniter.com/user_guide/libraries/sessions.html
|
*/
$config['encryption_key'] = '';
diff --git a/system/helpers/url_helper.php b/system/helpers/url_helper.php
index 5d907d0..5d9afe4 100755
--- a/system/helpers/url_helper.php
+++ b/system/helpers/url_helper.php
@@ -393,7 +393,7 @@
{
if ($type != 'email')
{
- if (preg_match_all("#(^|\s|\()((http(s?)://)|(www\.))(\w+[^\s\)\<]+)#i", $str, $matches))
+ if (preg_match_all("#(^|\s|\(|\b)((http(s?)://)|(www\.))(\w+[^\s\)\<]+)#i", $str, $matches))
{
$pop = ($popup == TRUE) ? " target=\"_blank\" " : "";
diff --git a/system/libraries/Email.php b/system/libraries/Email.php
index 7bde4c4..631b62e 100644
--- a/system/libraries/Email.php
+++ b/system/libraries/Email.php
@@ -418,11 +418,11 @@
* @param string
* @return void
*/
- public function attach($filename, $disposition = 'attachment')
+ public function attach($filename, $disposition = '', $newname = NULL)
{
- $this->_attach_name[] = $filename;
+ $this->_attach_name[] = array($filename, $newname);
$this->_attach_type[] = $this->_mime_types(pathinfo($filename, PATHINFO_EXTENSION));
- $this->_attach_disp[] = $disposition; // Can also be 'inline' Not sure if it matters
+ $this->_attach_disp[] = empty($disposition) ? 'attachment' : $disposition; // Can also be 'inline' Not sure if it matters
return $this;
}
@@ -1151,8 +1151,9 @@
for ($i=0; $i < count($this->_attach_name); $i++)
{
- $filename = $this->_attach_name[$i];
- $basename = basename($filename);
+ $filename = $this->_attach_name[$i][0];
+ $basename = ( is_null($this->_attach_name[$i][1]) ? basename($filename) : $this->_attach_name[$i][1] );
+
$ctype = $this->_attach_type[$i];
if ( ! file_exists($filename))
diff --git a/user_guide_src/source/changelog.rst b/user_guide_src/source/changelog.rst
index b9ca39c..979755c 100644
--- a/user_guide_src/source/changelog.rst
+++ b/user_guide_src/source/changelog.rst
@@ -35,8 +35,8 @@
- Database
- - Added new :doc:`Active Record <database/active_record>` methods that return
- the SQL string of queries without executing them: get_compiled_select(),
+ - Added new :doc:`Active Record <database/active_record>` methods that return
+ the SQL string of queries without executing them: get_compiled_select(),
get_compiled_insert(), get_compiled_update(), get_compiled_delete().
- Libraries
@@ -44,6 +44,7 @@
- Added max_filename_increment config setting for Upload library.
- CI_Loader::_ci_autoloader() is now a protected method.
- Modified valid_ip() to use PHP's filter_var() when possible (>= PHP 5.2) in the :doc:`Form Validation library <libraries/form_validation>`.
+ - Added custom filename to Email::attach() as $this->email->attach($filename, $disposition, $newname)
- Core
@@ -58,7 +59,7 @@
- Fixed a bug (#181) where a mis-spelling was in the form validation
language file.
- Fixed a bug (#159, #163) that mishandled Active Record nested transactions because _trans_depth was not getting incremented.
-
+- Bug #419 - auto_link() now recognizes URLs that come after a word boundary.
Version 2.1.0
=============
diff --git a/user_guide_src/source/helpers/string_helper.rst b/user_guide_src/source/helpers/string_helper.rst
index b8a69e0..dc70e46 100644
--- a/user_guide_src/source/helpers/string_helper.rst
+++ b/user_guide_src/source/helpers/string_helper.rst
@@ -58,7 +58,7 @@
echo increment_string('file', '_'); // "file_1"
echo increment_string('file', '-', 2); // "file-2"
- echo increment_string('file-4'); // "file-5"
+ echo increment_string('file_4'); // "file_5"
alternator()
============
diff --git a/user_guide_src/source/libraries/email.rst b/user_guide_src/source/libraries/email.rst
index 7598992..27b704d 100644
--- a/user_guide_src/source/libraries/email.rst
+++ b/user_guide_src/source/libraries/email.rst
@@ -228,7 +228,11 @@
$this->email->attach('/path/to/photo2.jpg');
$this->email->attach('/path/to/photo3.jpg');
- $this->email->send();
+If you'd like to change the disposition or add a custom file name, you can use the second and third paramaters. To use the default disposition (attachment), leave the second parameter blank. Here's an example::
+
+ $this->email->attach('/path/to/photo1.jpg', 'inline');
+ $this->email->attach('/path/to/photo1.jpg', '', 'birthday.jpg');
+
$this->email->print_debugger()
-------------------------------