From 75bc58b05cf16a0f8c5e7ed1545033a5d8b8feba Mon Sep 17 00:00:00 2001 From: David Behler Date: Sun, 21 Aug 2011 15:03:47 +0200 Subject: Fixed problem with needless seperator at begin/end of string --- system/helpers/url_helper.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) mode change 100644 => 100755 system/helpers/url_helper.php (limited to 'system/helpers/url_helper.php') diff --git a/system/helpers/url_helper.php b/system/helpers/url_helper.php old mode 100644 new mode 100755 index d0516cee6..0431e0b4b --- a/system/helpers/url_helper.php +++ b/system/helpers/url_helper.php @@ -509,7 +509,7 @@ if ( ! function_exists('url_title')) $str = strtolower($str); } - return trim(stripslashes($str)); + return trim(trim(stripslashes($str)), $replace); } } -- cgit v1.2.3-24-g4f1b From f31895096e821c694670b62180b7a5c309b62a9b Mon Sep 17 00:00:00 2001 From: Eric Barnes Date: Tue, 23 Aug 2011 21:40:59 -0400 Subject: Changed doc block options. Fixes #100 --- system/helpers/url_helper.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'system/helpers/url_helper.php') diff --git a/system/helpers/url_helper.php b/system/helpers/url_helper.php index 9f4b85248..09d975621 100644 --- a/system/helpers/url_helper.php +++ b/system/helpers/url_helper.php @@ -527,7 +527,7 @@ if ( ! function_exists('url_title')) * * @access public * @param string the URL - * @param string the method: location or redirect + * @param string the method: location or refresh * @return string */ if ( ! function_exists('redirect')) -- cgit v1.2.3-24-g4f1b From f4a4bd8fac188ebc9cda822ffc811c218fd92b45 Mon Sep 17 00:00:00 2001 From: Derek Jones Date: Thu, 20 Oct 2011 12:18:42 -0500 Subject: adding new license file (OSL 3.0) and updating readme to ReST added notice of license to all source files. OSL to all except the few files we ship inside of the application folder, those are AFL. Updated license in user guide. incrementing next dev version to 3.0 due to licensing change --- system/helpers/url_helper.php | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) (limited to 'system/helpers/url_helper.php') diff --git a/system/helpers/url_helper.php b/system/helpers/url_helper.php index c524dddd1..bfed96c6e 100755 --- a/system/helpers/url_helper.php +++ b/system/helpers/url_helper.php @@ -4,10 +4,22 @@ * * An open source application development framework for PHP 5.1.6 or newer * + * NOTICE OF LICENSE + * + * Licensed under the Open Software License version 3.0 + * + * This source file is subject to the Open Software License (OSL 3.0) that is + * bundled with this package in the files license.txt / license.rst. It is + * also available through the world wide web at this URL: + * http://opensource.org/licenses/OSL-3.0 + * If you did not receive a copy of the license and are unable to obtain it + * through the world wide web, please send an email to + * licensing@ellislab.com so we can send you a copy immediately. + * * @package CodeIgniter - * @author ExpressionEngine Dev Team - * @copyright Copyright (c) 2008 - 2011, EllisLab, Inc. - * @license http://codeigniter.com/user_guide/license.html + * @author EllisLab Dev Team + * @copyright Copyright (c) 2008 - 2011, EllisLab, Inc. (http://ellislab.com/) + * @license http://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) * @link http://codeigniter.com * @since Version 1.0 * @filesource @@ -21,7 +33,7 @@ * @package CodeIgniter * @subpackage Helpers * @category Helpers - * @author ExpressionEngine Dev Team + * @author EllisLab Dev Team * @link http://codeigniter.com/user_guide/helpers/url_helper.html */ -- cgit v1.2.3-24-g4f1b From 50e5dbb6079380d2e79e2fbbb39adfeaa40a33ea Mon Sep 17 00:00:00 2001 From: Brandon Jones Date: Mon, 7 Nov 2011 15:51:05 -0500 Subject: Adding auto-detection of best redirect method in url_helper. --- system/helpers/url_helper.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'system/helpers/url_helper.php') diff --git a/system/helpers/url_helper.php b/system/helpers/url_helper.php index bfed96c6e..5d907d00e 100755 --- a/system/helpers/url_helper.php +++ b/system/helpers/url_helper.php @@ -544,13 +544,19 @@ if ( ! function_exists('url_title')) */ if ( ! function_exists('redirect')) { - function redirect($uri = '', $method = 'location', $http_response_code = 302) + function redirect($uri = '', $method = 'auto', $http_response_code = 302) { if ( ! preg_match('#^https?://#i', $uri)) { $uri = site_url($uri); } + // IIS environment likely? Use 'refresh' for better compatibility + if (DIRECTORY_SEPARATOR != '/' && $method == 'auto') + { + $method = 'refresh'; + } + switch($method) { case 'refresh' : header("Refresh:0;url=".$uri); -- cgit v1.2.3-24-g4f1b From 793cc2b3cfedcf067df8a8c88f516c68f30d72a2 Mon Sep 17 00:00:00 2001 From: has2k1 Date: Thu, 17 Nov 2011 11:04:27 -0700 Subject: auto_link() learned to recognize more URLs Problem: auto_link() only works on URLs that are preceded by a new line, space, or open parentheses. As a result the URL in the string below would be missed. 'Google
http://www.google.com/' Solution: Add a word boundary to the list of features that can precede a URL. Credit to: @scaryuncledevin, issue #419 --- system/helpers/url_helper.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'system/helpers/url_helper.php') diff --git a/system/helpers/url_helper.php b/system/helpers/url_helper.php index 5d907d00e..5d9afe457 100755 --- a/system/helpers/url_helper.php +++ b/system/helpers/url_helper.php @@ -393,7 +393,7 @@ if ( ! function_exists('auto_link')) { 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\" " : ""; -- cgit v1.2.3-24-g4f1b From 0defe5d33ee2633f377a109519ca818becc60f64 Mon Sep 17 00:00:00 2001 From: Greg Aker Date: Sun, 1 Jan 2012 18:46:41 -0600 Subject: Updating copyright date to 2012 --- system/helpers/url_helper.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'system/helpers/url_helper.php') diff --git a/system/helpers/url_helper.php b/system/helpers/url_helper.php index 5d9afe457..c630ebea8 100755 --- a/system/helpers/url_helper.php +++ b/system/helpers/url_helper.php @@ -18,7 +18,7 @@ * * @package CodeIgniter * @author EllisLab Dev Team - * @copyright Copyright (c) 2008 - 2011, EllisLab, Inc. (http://ellislab.com/) + * @copyright Copyright (c) 2008 - 2012, EllisLab, Inc. (http://ellislab.com/) * @license http://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) * @link http://codeigniter.com * @since Version 1.0 -- cgit v1.2.3-24-g4f1b From debcc3676083eca34f89d00e6197e9892f77c0e2 Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Sat, 7 Jan 2012 02:05:29 +0200 Subject: Improve typography, url & xml helpers --- system/helpers/url_helper.php | 130 ++++++++++++++++++++---------------------- 1 file changed, 61 insertions(+), 69 deletions(-) mode change 100755 => 100644 system/helpers/url_helper.php (limited to 'system/helpers/url_helper.php') diff --git a/system/helpers/url_helper.php b/system/helpers/url_helper.php old mode 100755 new mode 100644 index c630ebea8..2cbcd9dbf --- a/system/helpers/url_helper.php +++ b/system/helpers/url_helper.php @@ -1,13 +1,13 @@ -'.$title.''; + return ''.$title.''; } } @@ -278,19 +275,16 @@ if ( ! function_exists('safe_mailto')) { $title = (string) $title; - if ($title == "") + if ($title == '') { $title = $email; } - for ($i = 0; $i < 16; $i++) - { - $x[] = substr(' $val) { $x[] = ' '.$key.'="'; - for ($i = 0; $i < strlen($val); $i++) + for ($i = 0, $l = strlen($val); $i < $l; $i++) { - $x[] = "|".ord(substr($val, $i, 1)); + $x[] = '|'.ord($val[$i]); } $x[] = '"'; } } else { - for ($i = 0; $i < strlen($attributes); $i++) + for ($i = 0, $l = strlen($attributes); $i < $l; $i++) { - $x[] = substr($attributes, $i, 1); + $x[] = $attributes[$i]; } } } @@ -321,26 +315,28 @@ if ( ! function_exists('safe_mailto')) $x[] = '>'; $temp = array(); - for ($i = 0; $i < strlen($title); $i++) + for ($i = 0, $l = strlen($title); $i < $l; $i++) { $ordinal = ord($title[$i]); if ($ordinal < 128) { - $x[] = "|".$ordinal; + $x[] = '|'.$ordinal; } else { - if (count($temp) == 0) + if (count($temp) === 0) { $count = ($ordinal < 224) ? 2 : 3; } $temp[] = $ordinal; - if (count($temp) == $count) + if (count($temp) === $count) { - $number = ($count == 3) ? (($temp['0'] % 16) * 4096) + (($temp['1'] % 64) * 64) + ($temp['2'] % 64) : (($temp['0'] % 32) * 64) + ($temp['1'] % 64); - $x[] = "|".$number; + $number = ($count === 3) + ? (($temp[0] % 16) * 4096) + (($temp[1] % 64) * 64) + ($temp[2] % 64) + : (($temp[0] % 32) * 64) + ($temp[1] % 64); + $x[] = '|'.$number; $count = 1; $temp = array(); } @@ -356,8 +352,7 @@ if ( ! function_exists('safe_mailto')) //l[]=''; + for ($i = 0, $c = count($x); $i < $c; $i++) { ?>l[]=''; for (var i = l.length-1; i >= 0; i=i-1){ if (l[i].substring(0, 1) == '|') document.write("&#"+unescape(l[i].substring(1))+";"); @@ -391,49 +386,46 @@ if ( ! function_exists('auto_link')) { function auto_link($str, $type = 'both', $popup = FALSE) { - if ($type != 'email') + if ($type !== 'email' && preg_match_all('#(^|\s|\(|\b)((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\" " : ""; + $pop = ($popup) ? ' target="_blank" ' : ''; - for ($i = 0; $i < count($matches['0']); $i++) + for ($i = 0, $c = count($matches[0]); $i < $c; $i++) + { + if (preg_match('|\.$|', $matches[6][$i])) + { + $period = '.'; + $matches[6][$i] = substr($matches[6][$i], 0, -1); + } + else { $period = ''; - if (preg_match("|\.$|", $matches['6'][$i])) - { - $period = '.'; - $matches['6'][$i] = substr($matches['6'][$i], 0, -1); - } - - $str = str_replace($matches['0'][$i], - $matches['1'][$i].'http'. - $matches['4'][$i].'://'. - $matches['5'][$i]. - $matches['6'][$i].''. - $period, $str); } + + $str = str_replace($matches[0][$i], + $matches[1][$i].'http' + .$matches[4][$i].'://'.$matches[5][$i] + .$matches[6][$i].''.$period, + $str); } } - if ($type != 'url') + if ($type !== 'url' && preg_match_all('/([a-zA-Z0-9_\.\-\+]+)@([a-zA-Z0-9\-]+)\.([a-zA-Z0-9\-\.]*)/i', $str, $matches)) { - if (preg_match_all("/([a-zA-Z0-9_\.\-\+]+)@([a-zA-Z0-9\-]+)\.([a-zA-Z0-9\-\.]*)/i", $str, $matches)) + for ($i = 0, $c = count($matches); $i < $c; $i++) { - for ($i = 0; $i < count($matches['0']); $i++) + if (preg_match('|\.$|', $matches[3][$i])) + { + $period = '.'; + $matches[3][$i] = substr($matches[3][$i], 0, -1); + } + else { $period = ''; - if (preg_match("|\.$|", $matches['3'][$i])) - { - $period = '.'; - $matches['3'][$i] = substr($matches['3'][$i], 0, -1); - } - - $str = str_replace($matches['0'][$i], safe_mailto($matches['1'][$i].'@'.$matches['2'][$i].'.'.$matches['3'][$i]).$period, $str); } + + $str = str_replace($matches[0][$i], safe_mailto($matches[1][$i].'@'.$matches[2][$i].'.'.$matches[3][$i]).$period, $str); } } @@ -456,7 +448,7 @@ if ( ! function_exists('prep_url')) { function prep_url($str = '') { - if ($str == 'http://' OR $str == '') + if ($str === 'http://' OR $str == '') { return ''; } @@ -465,7 +457,7 @@ if ( ! function_exists('prep_url')) if ( ! $url OR ! isset($url['scheme'])) { - $str = 'http://'.$str; + return 'http://'.$str; } return $str; @@ -490,7 +482,7 @@ if ( ! function_exists('url_title')) { function url_title($str, $separator = 'dash', $lowercase = FALSE) { - if ($separator == 'dash') + if ($separator === 'dash') { $search = '_'; $replace = '-'; @@ -513,10 +505,9 @@ if ( ! function_exists('url_title')) ); $str = strip_tags($str); - foreach ($trans as $key => $val) { - $str = preg_replace("#".$key."#i", $val, $str); + $str = preg_replace('#'.$key.'#i', $val, $str); } if ($lowercase === TRUE) @@ -552,16 +543,18 @@ if ( ! function_exists('redirect')) } // IIS environment likely? Use 'refresh' for better compatibility - if (DIRECTORY_SEPARATOR != '/' && $method == 'auto') + if (DIRECTORY_SEPARATOR !== '/' && $method === 'auto') { $method = 'refresh'; } switch($method) { - case 'refresh' : header("Refresh:0;url=".$uri); + case 'refresh': + header('Refresh:0;url='.$uri); break; - default : header("Location: ".$uri, TRUE, $http_response_code); + default: + header('Location: '.$uri, TRUE, $http_response_code); break; } exit; @@ -604,13 +597,12 @@ if ( ! function_exists('_parse_attributes')) if ($javascript == TRUE AND $att != '') { - $att = substr($att, 0, -1); + return substr($att, 0, -1); } return $att; } } - /* End of file url_helper.php */ -/* Location: ./system/helpers/url_helper.php */ \ No newline at end of file +/* Location: ./system/helpers/url_helper.php */ -- cgit v1.2.3-24-g4f1b From 07c1ac830b4e98aa40f48baef3dd05fb68c0a836 Mon Sep 17 00:00:00 2001 From: Phil Sturgeon Date: Fri, 9 Mar 2012 17:03:37 +0000 Subject: Bumped CodeIgniter's PHP requirement to 5.2.4. Yes I know PHP 5.4 just came out, and yes I know PHP 5.3 has lovely features, but there are plenty of corporate systems running on CodeIgniter and PHP 5.3 still is not widely supported enough. CodeIgniter is great for distributed applications, and this is the highest we can reasonably go without breaking support. PHP 5.3 will most likely happen in another year or so. Fingers crossed on that one anyway... --- system/helpers/url_helper.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'system/helpers/url_helper.php') diff --git a/system/helpers/url_helper.php b/system/helpers/url_helper.php index 3f0fef58e..2ae1fd37b 100644 --- a/system/helpers/url_helper.php +++ b/system/helpers/url_helper.php @@ -2,7 +2,7 @@ /** * CodeIgniter * - * An open source application development framework for PHP 5.1.6 or newer + * An open source application development framework for PHP 5.2.4 or newer * * NOTICE OF LICENSE * -- cgit v1.2.3-24-g4f1b From 1222087be893a38927c0a61566231abf093fbf2f Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Mon, 26 Mar 2012 21:38:56 +0300 Subject: Remove access description lines and cleanup the url helper --- system/helpers/url_helper.php | 59 ++++++++++++++++--------------------------- 1 file changed, 22 insertions(+), 37 deletions(-) (limited to 'system/helpers/url_helper.php') diff --git a/system/helpers/url_helper.php b/system/helpers/url_helper.php index 2ae1fd37b..5576c2748 100644 --- a/system/helpers/url_helper.php +++ b/system/helpers/url_helper.php @@ -25,8 +25,6 @@ * @filesource */ -// ------------------------------------------------------------------------ - /** * CodeIgniter URL Helpers * @@ -45,7 +43,6 @@ * Create a local URL based on your basepath. Segments can be passed via the * first parameter either as a string or an array. * - * @access public * @param string * @return string */ @@ -67,8 +64,7 @@ if ( ! function_exists('site_url')) * Segments can be passed in as a string or an array, same as site_url * or a URL to a file can be passed in, e.g. to an image file. * - * @access public - * @param string + * @param string * @return string */ if ( ! function_exists('base_url')) @@ -88,7 +84,6 @@ if ( ! function_exists('base_url')) * Returns the full URL (including segments) of the page where this * function is placed * - * @access public * @return string */ if ( ! function_exists('current_url')) @@ -106,7 +101,6 @@ if ( ! function_exists('current_url')) * * Returns the URI segments. * - * @access public * @return string */ if ( ! function_exists('uri_string')) @@ -125,7 +119,6 @@ if ( ! function_exists('uri_string')) * * Returns the "index_page" from your config file * - * @access public * @return string */ if ( ! function_exists('index_page')) @@ -144,7 +137,6 @@ if ( ! function_exists('index_page')) * * Creates an anchor based on the local URL. * - * @access public * @param string the URL * @param string the link title * @param mixed any attributes @@ -158,7 +150,7 @@ if ( ! function_exists('anchor')) if ( ! is_array($uri)) { - $site_url = ( ! preg_match('!^\w+://! i', $uri)) ? site_url($uri) : $uri; + $site_url = preg_match('!^\w+://! i', $uri) ? $uri : site_url($uri); } else { @@ -187,7 +179,6 @@ if ( ! function_exists('anchor')) * Creates an anchor based on the local URL. The link * opens a new window based on the attributes specified. * - * @access public * @param string the URL * @param string the link title * @param mixed any attributes @@ -198,7 +189,7 @@ if ( ! function_exists('anchor_popup')) function anchor_popup($uri = '', $title = '', $attributes = FALSE) { $title = (string) $title; - $site_url = ( ! preg_match('!^\w+://! i', $uri)) ? site_url($uri) : $uri; + $site_url = preg_match('!^\w+://! i', $uri) ? $uri : site_url($uri); if ($title == '') { @@ -207,7 +198,7 @@ if ( ! function_exists('anchor_popup')) if ($attributes === FALSE) { - return "".$title.""; + return "".$title.''; } if ( ! is_array($attributes)) @@ -217,7 +208,7 @@ if ( ! function_exists('anchor_popup')) foreach (array('width' => '800', 'height' => '600', 'scrollbars' => 'yes', 'status' => 'yes', 'resizable' => 'yes', 'screenx' => '0', 'screeny' => '0', ) as $key => $val) { - $atts[$key] = ( ! isset($attributes[$key])) ? $val : $attributes[$key]; + $atts[$key] = isset($attributes[$key]) ? $attributes[$key] : $val; unset($attributes[$key]); } @@ -226,7 +217,7 @@ if ( ! function_exists('anchor_popup')) $attributes = _parse_attributes($attributes); } - return "".$title.""; + return "'.$title.''; } } @@ -235,7 +226,6 @@ if ( ! function_exists('anchor_popup')) /** * Mailto Link * - * @access public * @param string the email address * @param string the link title * @param mixed any attributes @@ -263,7 +253,6 @@ if ( ! function_exists('mailto')) * * Create a spam-protected mailto link written in Javascript * - * @access public * @param string the email address * @param string the link title * @param mixed any attributes @@ -373,10 +362,9 @@ if ( ! function_exists('safe_mailto')) * * Automatically links URL and Email addresses. * Note: There's a bit of extra code here to deal with - * URLs or emails that end in a period. We'll strip these + * URLs or emails that end in a period. We'll strip these * off and add them after the link. * - * @access public * @param string the string * @param string the type: email, url, or both * @param bool whether to create pop-up links @@ -440,7 +428,6 @@ if ( ! function_exists('auto_link')) * * Simply adds the http:// part if no scheme is included * - * @access public * @param string the URL * @return string */ @@ -470,12 +457,12 @@ if ( ! function_exists('prep_url')) * Create URL Title * * Takes a "title" string as input and creates a - * human-friendly URL string with a "separator" string + * human-friendly URL string with a "separator" string * as the word separator. * - * @access public * @param string the string * @param string the separator + * @param bool * @return string */ if ( ! function_exists('url_title')) @@ -484,21 +471,21 @@ if ( ! function_exists('url_title')) { if ($separator === 'dash') { - $separator = '-'; + $separator = '-'; } - else if ($separator == 'underscore') + elseif ($separator === 'underscore') { - $separator = '_'; + $separator = '_'; } - + $q_separator = preg_quote($separator); $trans = array( - '&.+?;' => '', - '[^a-z0-9 _-]' => '', - '\s+' => $separator, - '('.$q_separator.')+' => $separator - ); + '&.+?;' => '', + '[^a-z0-9 _-]' => '', + '\s+' => $separator, + '('.$q_separator.')+' => $separator + ); $str = strip_tags($str); foreach ($trans as $key => $val) @@ -524,7 +511,6 @@ if ( ! function_exists('url_title')) * For very fine grained control over headers, you could use the Output * Library's set_header() function. * - * @access public * @param string the URL * @param string the method: location or refresh * @return string @@ -564,7 +550,6 @@ if ( ! function_exists('redirect')) * * Some of the functions use this * - * @access private * @param array * @param bool * @return string @@ -583,15 +568,15 @@ if ( ! function_exists('_parse_attributes')) { if ($javascript == TRUE) { - $att .= $key . '=' . $val . ','; + $att .= $key.'='.$val.','; } else { - $att .= ' ' . $key . '="' . $val . '"'; + $att .= ' '.$key.'="'.$val.'"'; } } - if ($javascript == TRUE AND $att != '') + if ($javascript == TRUE && $att != '') { return substr($att, 0, -1); } @@ -601,4 +586,4 @@ if ( ! function_exists('_parse_attributes')) } /* End of file url_helper.php */ -/* Location: ./system/helpers/url_helper.php */ +/* Location: ./system/helpers/url_helper.php */ \ No newline at end of file -- cgit v1.2.3-24-g4f1b From b75faa1a03a32330e412f0bd0332fb9fa389e914 Mon Sep 17 00:00:00 2001 From: Timothy Warren Date: Fri, 27 Apr 2012 12:03:32 -0400 Subject: Fix rest of the helpers --- system/helpers/url_helper.php | 268 +++++++++++++++++++++--------------------- 1 file changed, 135 insertions(+), 133 deletions(-) (limited to 'system/helpers/url_helper.php') diff --git a/system/helpers/url_helper.php b/system/helpers/url_helper.php index 5576c2748..fa685645a 100644 --- a/system/helpers/url_helper.php +++ b/system/helpers/url_helper.php @@ -37,17 +37,17 @@ // ------------------------------------------------------------------------ -/** - * Site URL - * - * Create a local URL based on your basepath. Segments can be passed via the - * first parameter either as a string or an array. - * - * @param string - * @return string - */ if ( ! function_exists('site_url')) { + /** + * Site URL + * + * Create a local URL based on your basepath. Segments can be passed via the + * first parameter either as a string or an array. + * + * @param string + * @return string + */ function site_url($uri = '') { $CI =& get_instance(); @@ -57,18 +57,18 @@ if ( ! function_exists('site_url')) // ------------------------------------------------------------------------ -/** - * Base URL - * - * Create a local URL based on your basepath. - * Segments can be passed in as a string or an array, same as site_url - * or a URL to a file can be passed in, e.g. to an image file. - * - * @param string - * @return string - */ if ( ! function_exists('base_url')) { + /** + * Base URL + * + * Create a local URL based on your basepath. + * Segments can be passed in as a string or an array, same as site_url + * or a URL to a file can be passed in, e.g. to an image file. + * + * @param string + * @return string + */ function base_url($uri = '') { $CI =& get_instance(); @@ -78,16 +78,16 @@ if ( ! function_exists('base_url')) // ------------------------------------------------------------------------ -/** - * Current URL - * - * Returns the full URL (including segments) of the page where this - * function is placed - * - * @return string - */ if ( ! function_exists('current_url')) { + /** + * Current URL + * + * Returns the full URL (including segments) of the page where this + * function is placed + * + * @return string + */ function current_url() { $CI =& get_instance(); @@ -96,15 +96,16 @@ if ( ! function_exists('current_url')) } // ------------------------------------------------------------------------ -/** - * URL String - * - * Returns the URI segments. - * - * @return string - */ + if ( ! function_exists('uri_string')) { + /** + * URL String + * + * Returns the URI segments. + * + * @return string + */ function uri_string() { $CI =& get_instance(); @@ -114,15 +115,15 @@ if ( ! function_exists('uri_string')) // ------------------------------------------------------------------------ -/** - * Index page - * - * Returns the "index_page" from your config file - * - * @return string - */ if ( ! function_exists('index_page')) { + /** + * Index page + * + * Returns the "index_page" from your config file + * + * @return string + */ function index_page() { $CI =& get_instance(); @@ -132,18 +133,18 @@ if ( ! function_exists('index_page')) // ------------------------------------------------------------------------ -/** - * Anchor Link - * - * Creates an anchor based on the local URL. - * - * @param string the URL - * @param string the link title - * @param mixed any attributes - * @return string - */ if ( ! function_exists('anchor')) { + /** + * Anchor Link + * + * Creates an anchor based on the local URL. + * + * @param string the URL + * @param string the link title + * @param mixed any attributes + * @return string + */ function anchor($uri = '', $title = '', $attributes = '') { $title = (string) $title; @@ -173,19 +174,19 @@ if ( ! function_exists('anchor')) // ------------------------------------------------------------------------ -/** - * Anchor Link - Pop-up version - * - * Creates an anchor based on the local URL. The link - * opens a new window based on the attributes specified. - * - * @param string the URL - * @param string the link title - * @param mixed any attributes - * @return string - */ if ( ! function_exists('anchor_popup')) { + /** + * Anchor Link - Pop-up version + * + * Creates an anchor based on the local URL. The link + * opens a new window based on the attributes specified. + * + * @param string the URL + * @param string the link title + * @param mixed any attributes + * @return string + */ function anchor_popup($uri = '', $title = '', $attributes = FALSE) { $title = (string) $title; @@ -223,16 +224,16 @@ if ( ! function_exists('anchor_popup')) // ------------------------------------------------------------------------ -/** - * Mailto Link - * - * @param string the email address - * @param string the link title - * @param mixed any attributes - * @return string - */ if ( ! function_exists('mailto')) { + /** + * Mailto Link + * + * @param string the email address + * @param string the link title + * @param mixed any attributes + * @return string + */ function mailto($email, $title = '', $attributes = '') { $title = (string) $title; @@ -248,18 +249,18 @@ if ( ! function_exists('mailto')) // ------------------------------------------------------------------------ -/** - * Encoded Mailto Link - * - * Create a spam-protected mailto link written in Javascript - * - * @param string the email address - * @param string the link title - * @param mixed any attributes - * @return string - */ if ( ! function_exists('safe_mailto')) { + /** + * Encoded Mailto Link + * + * Create a spam-protected mailto link written in Javascript + * + * @param string the email address + * @param string the link title + * @param mixed any attributes + * @return string + */ function safe_mailto($email, $title = '', $attributes = '') { $title = (string) $title; @@ -357,21 +358,21 @@ if ( ! function_exists('safe_mailto')) // ------------------------------------------------------------------------ -/** - * Auto-linker - * - * Automatically links URL and Email addresses. - * Note: There's a bit of extra code here to deal with - * URLs or emails that end in a period. We'll strip these - * off and add them after the link. - * - * @param string the string - * @param string the type: email, url, or both - * @param bool whether to create pop-up links - * @return string - */ if ( ! function_exists('auto_link')) { + /** + * Auto-linker + * + * Automatically links URL and Email addresses. + * Note: There's a bit of extra code here to deal with + * URLs or emails that end in a period. We'll strip these + * off and add them after the link. + * + * @param string the string + * @param string the type: email, url, or both + * @param bool whether to create pop-up links + * @return string + */ function auto_link($str, $type = 'both', $popup = FALSE) { if ($type !== 'email' && preg_match_all('#(^|\s|\(|\b)((http(s?)://)|(www\.))(\w+[^\s\)\<]+)#i', $str, $matches)) @@ -423,16 +424,16 @@ if ( ! function_exists('auto_link')) // ------------------------------------------------------------------------ -/** - * Prep URL - * - * Simply adds the http:// part if no scheme is included - * - * @param string the URL - * @return string - */ if ( ! function_exists('prep_url')) { + /** + * Prep URL + * + * Simply adds the http:// part if no scheme is included + * + * @param string the URL + * @return string + */ function prep_url($str = '') { if ($str === 'http://' OR $str == '') @@ -453,20 +454,20 @@ if ( ! function_exists('prep_url')) // ------------------------------------------------------------------------ -/** - * Create URL Title - * - * Takes a "title" string as input and creates a - * human-friendly URL string with a "separator" string - * as the word separator. - * - * @param string the string - * @param string the separator - * @param bool - * @return string - */ if ( ! function_exists('url_title')) { + /** + * Create URL Title + * + * Takes a "title" string as input and creates a + * human-friendly URL string with a "separator" string + * as the word separator. + * + * @param string the string + * @param string the separator + * @param bool + * @return string + */ function url_title($str, $separator = '-', $lowercase = FALSE) { if ($separator === 'dash') @@ -504,19 +505,20 @@ if ( ! function_exists('url_title')) // ------------------------------------------------------------------------ -/** - * Header Redirect - * - * Header redirect in two flavors - * For very fine grained control over headers, you could use the Output - * Library's set_header() function. - * - * @param string the URL - * @param string the method: location or refresh - * @return string - */ if ( ! function_exists('redirect')) { + /** + * Header Redirect + * + * Header redirect in two flavors + * For very fine grained control over headers, you could use the Output + * Library's set_header() function. + * + * @param string the URL + * @param string the method: location or refresh + * @param int + * @return string + */ function redirect($uri = '', $method = 'auto', $http_response_code = 302) { if ( ! preg_match('#^https?://#i', $uri)) @@ -545,17 +547,17 @@ if ( ! function_exists('redirect')) // ------------------------------------------------------------------------ -/** - * Parse out the attributes - * - * Some of the functions use this - * - * @param array - * @param bool - * @return string - */ if ( ! function_exists('_parse_attributes')) { + /** + * Parse out the attributes + * + * Some of the functions use this + * + * @param array + * @param bool + * @return string + */ function _parse_attributes($attributes, $javascript = FALSE) { if (is_string($attributes)) -- cgit v1.2.3-24-g4f1b From ae31eb5e75d914fc3ab622a7ac5c23eb1e6d9f9a Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Thu, 17 May 2012 14:54:15 +0300 Subject: Clean up the helpers --- system/helpers/url_helper.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'system/helpers/url_helper.php') diff --git a/system/helpers/url_helper.php b/system/helpers/url_helper.php index 5576c2748..cf6df4ef5 100644 --- a/system/helpers/url_helper.php +++ b/system/helpers/url_helper.php @@ -198,7 +198,7 @@ if ( ! function_exists('anchor_popup')) if ($attributes === FALSE) { - return "".$title.''; + return '".$title.''; } if ( ! is_array($attributes)) @@ -217,7 +217,7 @@ if ( ! function_exists('anchor_popup')) $attributes = _parse_attributes($attributes); } - return "'.$title.''; + return ''.$title.''; } } -- cgit v1.2.3-24-g4f1b From 773ccc318f2769c9b7579630569b5d8ba47b114b Mon Sep 17 00:00:00 2001 From: Alex Bilbie Date: Sat, 2 Jun 2012 11:11:08 +0100 Subject: Replaced `==` with `===` and `!=` with `!==` in /system/helpers --- system/helpers/url_helper.php | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) (limited to 'system/helpers/url_helper.php') diff --git a/system/helpers/url_helper.php b/system/helpers/url_helper.php index 0e933c18e..2bd41b04d 100644 --- a/system/helpers/url_helper.php +++ b/system/helpers/url_helper.php @@ -158,12 +158,12 @@ if ( ! function_exists('anchor')) $site_url = site_url($uri); } - if ($title == '') + if ($title === '') { $title = $site_url; } - if ($attributes != '') + if ($attributes !== '') { $attributes = _parse_attributes($attributes); } @@ -192,7 +192,7 @@ if ( ! function_exists('anchor_popup')) $title = (string) $title; $site_url = preg_match('!^\w+://! i', $uri) ? $uri : site_url($uri); - if ($title == '') + if ($title === '') { $title = $site_url; } @@ -213,7 +213,7 @@ if ( ! function_exists('anchor_popup')) unset($attributes[$key]); } - if ($attributes != '') + if ($attributes !== '') { $attributes = _parse_attributes($attributes); } @@ -238,7 +238,7 @@ if ( ! function_exists('mailto')) { $title = (string) $title; - if ($title == '') + if ($title === '') { $title = $email; } @@ -265,7 +265,7 @@ if ( ! function_exists('safe_mailto')) { $title = (string) $title; - if ($title == '') + if ($title === '') { $title = $email; } @@ -279,7 +279,7 @@ if ( ! function_exists('safe_mailto')) $x[] = '"'; - if ($attributes != '') + if ($attributes !== '') { if (is_array($attributes)) { @@ -345,7 +345,7 @@ if ( ! function_exists('safe_mailto')) for ($i = 0, $c = count($x); $i < $c; $i++) { ?>l[]=''; for (var i = l.length-1; i >= 0; i=i-1){ - if (l[i].substring(0, 1) == '|') document.write("&#"+unescape(l[i].substring(1))+";"); + if (l[i].substring(0, 1) === '|') document.write("&#"+unescape(l[i].substring(1))+";"); else document.write(unescape(l[i]));} //]]> $val) { - if ($javascript == TRUE) + if ($javascript === TRUE) { $att .= $key.'='.$val.','; } @@ -578,7 +578,7 @@ if ( ! function_exists('_parse_attributes')) } } - if ($javascript == TRUE && $att != '') + if ($javascript === TRUE && $att !== '') { return substr($att, 0, -1); } -- cgit v1.2.3-24-g4f1b From f0a8410a5cbe080b377ec352320872d27ce7d91f Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Sat, 16 Jun 2012 20:52:20 +0300 Subject: Fix two anchor_popup() issues --- system/helpers/url_helper.php | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) (limited to 'system/helpers/url_helper.php') diff --git a/system/helpers/url_helper.php b/system/helpers/url_helper.php index 2bd41b04d..58bde17b4 100644 --- a/system/helpers/url_helper.php +++ b/system/helpers/url_helper.php @@ -204,7 +204,7 @@ if ( ! function_exists('anchor_popup')) if ( ! is_array($attributes)) { - $attributes = array(); + $attributes = array($attributes); } foreach (array('width' => '800', 'height' => '600', 'scrollbars' => 'yes', 'status' => 'yes', 'resizable' => 'yes', 'screenx' => '0', 'screeny' => '0', ) as $key => $val) @@ -213,10 +213,7 @@ if ( ! function_exists('anchor_popup')) unset($attributes[$key]); } - if ($attributes !== '') - { - $attributes = _parse_attributes($attributes); - } + $attributes = empty($attributes) ? '' : _parse_attributes($attributes); return ''.$title.''; } -- cgit v1.2.3-24-g4f1b From 81c3208b79cca353b27ecd4bdf00d4b6e7c91b2c Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Sat, 16 Jun 2012 21:21:46 +0300 Subject: anchor_popup() improvements --- system/helpers/url_helper.php | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) (limited to 'system/helpers/url_helper.php') diff --git a/system/helpers/url_helper.php b/system/helpers/url_helper.php index 58bde17b4..40ce807df 100644 --- a/system/helpers/url_helper.php +++ b/system/helpers/url_helper.php @@ -199,15 +199,23 @@ if ( ! function_exists('anchor_popup')) if ($attributes === FALSE) { - return '".$title.''; + return '".$title.''; } if ( ! is_array($attributes)) { $attributes = array($attributes); + + // Ref: http://www.w3schools.com/jsref/met_win_open.asp + $window_name = '_blank'; + } + elseif ( ! empty($attributes['window_name'])) + { + $window_name = $attributes['window_name']; + unset($attributes['window_name']); } - foreach (array('width' => '800', 'height' => '600', 'scrollbars' => 'yes', 'status' => 'yes', 'resizable' => 'yes', 'screenx' => '0', 'screeny' => '0', ) as $key => $val) + foreach (array('width' => '800', 'height' => '600', 'scrollbars' => 'yes', 'status' => 'yes', 'resizable' => 'yes', 'screenx' => '0', 'screeny' => '0') as $key => $val) { $atts[$key] = isset($attributes[$key]) ? $attributes[$key] : $val; unset($attributes[$key]); @@ -215,7 +223,9 @@ if ( ! function_exists('anchor_popup')) $attributes = empty($attributes) ? '' : _parse_attributes($attributes); - return ''.$title.''; + return ''.$title.''; } } -- cgit v1.2.3-24-g4f1b From 2fce2a95e99c91c57f7d15b5e441b2cf89193da3 Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Wed, 27 Jun 2012 01:07:56 +0300 Subject: URL Helper redirect() to utilize HTTP/1.1 response code 303 See Other --- system/helpers/url_helper.php | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'system/helpers/url_helper.php') diff --git a/system/helpers/url_helper.php b/system/helpers/url_helper.php index 40ce807df..39e6343a6 100644 --- a/system/helpers/url_helper.php +++ b/system/helpers/url_helper.php @@ -526,7 +526,7 @@ if ( ! function_exists('redirect')) * @param int * @return string */ - function redirect($uri = '', $method = 'auto', $http_response_code = 302) + function redirect($uri = '', $method = 'auto', $code = NULL) { if ( ! preg_match('#^https?://#i', $uri)) { @@ -538,14 +538,22 @@ if ( ! function_exists('redirect')) { $method = 'refresh'; } + elseif ($method !== 'refresh' && (empty($code) OR ! is_numeric($code))) + { + // Reference: http://en.wikipedia.org/wiki/Post/Redirect/Get + $code = (isset($_SERVER['REQUEST_METHOD'], $_SERVER['SERVER_PROTOCOL']) + && $_SERVER['REQUEST_METHOD'] === 'POST' + && $_SERVER['SERVER_PROTOCOL'] === 'HTTP/1.1') + ? 303 : 302; + } - switch($method) + switch ($method) { case 'refresh': header('Refresh:0;url='.$uri); break; default: - header('Location: '.$uri, TRUE, $http_response_code); + header('Location: '.$uri, TRUE, $code); break; } exit; -- cgit v1.2.3-24-g4f1b From acedd2b1a37b22cb04b01038f21876ddfe38b83a Mon Sep 17 00:00:00 2001 From: Eric Barnes Date: Sun, 29 Jul 2012 00:15:40 -0400 Subject: Adding a common stringify_attributes function for dealing with attributes through out various helpers. Signed-off-by: Eric Barnes --- system/helpers/url_helper.php | 50 ++++--------------------------------------- 1 file changed, 4 insertions(+), 46 deletions(-) (limited to 'system/helpers/url_helper.php') diff --git a/system/helpers/url_helper.php b/system/helpers/url_helper.php index 39e6343a6..57208c948 100644 --- a/system/helpers/url_helper.php +++ b/system/helpers/url_helper.php @@ -165,7 +165,7 @@ if ( ! function_exists('anchor')) if ($attributes !== '') { - $attributes = _parse_attributes($attributes); + $attributes = _stringify_attributes($attributes); } return ''.$title.''; @@ -221,10 +221,10 @@ if ( ! function_exists('anchor_popup')) unset($attributes[$key]); } - $attributes = empty($attributes) ? '' : _parse_attributes($attributes); + $attributes = _stringify_attributes($attributes); return ''.$title.''; } } @@ -250,7 +250,7 @@ if ( ! function_exists('mailto')) $title = $email; } - return ''.$title.''; + return ''.$title.''; } } @@ -560,47 +560,5 @@ if ( ! function_exists('redirect')) } } -// ------------------------------------------------------------------------ - -if ( ! function_exists('_parse_attributes')) -{ - /** - * Parse out the attributes - * - * Some of the functions use this - * - * @param array - * @param bool - * @return string - */ - function _parse_attributes($attributes, $javascript = FALSE) - { - if (is_string($attributes)) - { - return ($attributes !== '') ? ' '.$attributes : ''; - } - - $att = ''; - foreach ($attributes as $key => $val) - { - if ($javascript === TRUE) - { - $att .= $key.'='.$val.','; - } - else - { - $att .= ' '.$key.'="'.$val.'"'; - } - } - - if ($javascript === TRUE && $att !== '') - { - return substr($att, 0, -1); - } - - return $att; - } -} - /* End of file url_helper.php */ /* Location: ./system/helpers/url_helper.php */ \ No newline at end of file -- cgit v1.2.3-24-g4f1b From aab26a12a98ca99d956ef24e36c2262938631d73 Mon Sep 17 00:00:00 2001 From: vlakoff Date: Tue, 11 Sep 2012 13:10:21 +0200 Subject: Better server test in redirect() of URL helper "Location" header bugs are specific to IIS; previous test was matching all HTTP servers under Windows. This test isn't perfect yet ($_SERVER['SERVER_SOFTWARE'], which corresponds to the "Server" header of HTTP response, might be missing), but there is no perfect test. "Refresh" method makes the window blank for quite a noticeable time, so let's not affect other servers because of IIS. --- system/helpers/url_helper.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'system/helpers/url_helper.php') diff --git a/system/helpers/url_helper.php b/system/helpers/url_helper.php index 57208c948..b1f5eccf1 100644 --- a/system/helpers/url_helper.php +++ b/system/helpers/url_helper.php @@ -534,7 +534,7 @@ if ( ! function_exists('redirect')) } // IIS environment likely? Use 'refresh' for better compatibility - if (DIRECTORY_SEPARATOR !== '/' && $method === 'auto') + if ($method === 'auto' && isset($_SERVER['SERVER_SOFTWARE']) && strpos($_SERVER['SERVER_SOFTWARE'], 'Microsoft-IIS') !== FALSE) { $method = 'refresh'; } -- cgit v1.2.3-24-g4f1b From 929e1241879c94bff85203d2e00623284d72dc87 Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Fri, 19 Oct 2012 10:09:28 +0300 Subject: Manually apply an improved version of PR #1797 (auto_link() URL helper) --- system/helpers/url_helper.php | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) (limited to 'system/helpers/url_helper.php') diff --git a/system/helpers/url_helper.php b/system/helpers/url_helper.php index b1f5eccf1..de5bdec31 100644 --- a/system/helpers/url_helper.php +++ b/system/helpers/url_helper.php @@ -388,40 +388,43 @@ if ( ! function_exists('auto_link')) for ($i = 0, $c = count($matches[0]); $i < $c; $i++) { - if (preg_match('|\.$|', $matches[6][$i])) + if (preg_match('/(\.|\,)$/i', $matches[6][$i], $m)) { - $period = '.'; + $punct = $m[1]; $matches[6][$i] = substr($matches[6][$i], 0, -1); } else { - $period = ''; + $punct = ''; } $str = str_replace($matches[0][$i], $matches[1][$i].'http' .$matches[4][$i].'://'.$matches[5][$i] - .$matches[6][$i].''.$period, + .$matches[6][$i].''.$punct, $str); } } - if ($type !== 'url' && preg_match_all('/([a-zA-Z0-9_\.\-\+]+)@([a-zA-Z0-9\-]+)\.([a-zA-Z0-9\-\.]*)/i', $str, $matches)) + if ($type !== 'url' && preg_match_all('/([a-zA-Z0-9_\.\-\+]+)@([a-zA-Z0-9\-]+)\.([a-zA-Z0-9\-\.]+)/i', $str, $matches)) { for ($i = 0, $c = count($matches); $i < $c; $i++) { - if (preg_match('|\.$|', $matches[3][$i])) + if (preg_match('/(\.|\,)$/i', $matches[3][$i], $m)) { - $period = '.'; + $punct = $m[1]; $matches[3][$i] = substr($matches[3][$i], 0, -1); } else { - $period = ''; + $punct = ''; } - $str = str_replace($matches[0][$i], safe_mailto($matches[1][$i].'@'.$matches[2][$i].'.'.$matches[3][$i]).$period, $str); + if (filter_var(($m = $matches[1][$i].'@'.$matches[2][$i].'.'.$matches[3][$i]), FILTER_VALIDATE_EMAIL) !== FALSE) + { + $str = str_replace($matches[0][$i], safe_mailto($m).$punct, $str); + } } } -- cgit v1.2.3-24-g4f1b From e47425844e84d54c659280c04f450a3526b4e09d Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Thu, 25 Oct 2012 13:25:13 +0300 Subject: Add missing delimiter in preg_quote() occurences (fix #1929) --- system/helpers/url_helper.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'system/helpers/url_helper.php') diff --git a/system/helpers/url_helper.php b/system/helpers/url_helper.php index de5bdec31..dc77246dc 100644 --- a/system/helpers/url_helper.php +++ b/system/helpers/url_helper.php @@ -489,7 +489,7 @@ if ( ! function_exists('url_title')) $separator = '_'; } - $q_separator = preg_quote($separator); + $q_separator = preg_quote($separator, '#'); $trans = array( '&.+?;' => '', -- cgit v1.2.3-24-g4f1b From c5536aac5752054f7f76e448d58b86407d8f574e Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Thu, 1 Nov 2012 17:33:58 +0200 Subject: Manually apply PR #1594 (fixing phpdoc page-level generation/warnings) Also partially fixes issue #1295, fixes inconsistencies in some page-level docblocks and adds include checks in language files. --- system/helpers/url_helper.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'system/helpers/url_helper.php') diff --git a/system/helpers/url_helper.php b/system/helpers/url_helper.php index dc77246dc..8e9cb7b03 100644 --- a/system/helpers/url_helper.php +++ b/system/helpers/url_helper.php @@ -1,4 +1,4 @@ - Date: Fri, 9 Nov 2012 10:27:43 +0200 Subject: Polish docs for URL and XML helpers and deprecate obsolete options for String helper random_string() and URL helper url_title() --- system/helpers/url_helper.php | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) (limited to 'system/helpers/url_helper.php') diff --git a/system/helpers/url_helper.php b/system/helpers/url_helper.php index 8e9cb7b03..0aa358a0b 100644 --- a/system/helpers/url_helper.php +++ b/system/helpers/url_helper.php @@ -474,9 +474,11 @@ if ( ! function_exists('url_title')) * human-friendly URL string with a "separator" string * as the word separator. * - * @param string the string - * @param string the separator - * @param bool + * @todo Remove old 'dash' and 'underscore' usage in 3.1+. + * @param string $str Input string + * @param string $separator Word separator + * (usually '-' or '_') + * @param bool $lowercase Wether to transform the output string to lowercase * @return string */ function url_title($str, $separator = '-', $lowercase = FALSE) @@ -525,10 +527,11 @@ if ( ! function_exists('redirect')) * For very fine grained control over headers, you could use the Output * Library's set_header() function. * - * @param string the URL - * @param string the method: location or refresh - * @param int - * @return string + * @param string $uri URL + * @param string $method Redirect method + * 'auto', 'location' or 'refresh' + * @param int $code HTTP Response status code + * @return void */ function redirect($uri = '', $method = 'auto', $code = NULL) { -- cgit v1.2.3-24-g4f1b From 838a9d69a9139b6bcd6f8765fdd2d58b929e70ad Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Mon, 3 Dec 2012 14:37:47 +0200 Subject: [ci skip] Cleaned some spaces --- system/helpers/url_helper.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'system/helpers/url_helper.php') diff --git a/system/helpers/url_helper.php b/system/helpers/url_helper.php index 0aa358a0b..14c216afe 100644 --- a/system/helpers/url_helper.php +++ b/system/helpers/url_helper.php @@ -293,7 +293,7 @@ if ( ! function_exists('safe_mailto')) { foreach ($attributes as $key => $val) { - $x[] = ' '.$key.'="'; + $x[] = ' '.$key.'="'; for ($i = 0, $l = strlen($val); $i < $l; $i++) { $x[] = '|'.ord($val[$i]); -- cgit v1.2.3-24-g4f1b From 16800e4e356fa1aa3d92d368e6e495b97b64ad83 Mon Sep 17 00:00:00 2001 From: Aaron Adams Date: Fri, 7 Dec 2012 22:39:23 -0500 Subject: While most of CodeIgniter supports protocol-relative URLs, a few URL helpers do not. Most notably, redirect('//www.facebook.com/aaronadams') led my browser to https://aaronadams.ca/index.php/www.facebook.com/aaronadams. In this commit, I have fixed the header() helper, along with the anchor() and anchor_popup() helpers, to be compatible with protocol-relative URLs. Signed-off-by: Aaron Adams --- system/helpers/url_helper.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'system/helpers/url_helper.php') diff --git a/system/helpers/url_helper.php b/system/helpers/url_helper.php index 14c216afe..36ff0ff2c 100644 --- a/system/helpers/url_helper.php +++ b/system/helpers/url_helper.php @@ -152,7 +152,7 @@ if ( ! function_exists('anchor')) if ( ! is_array($uri)) { - $site_url = preg_match('!^\w+://! i', $uri) ? $uri : site_url($uri); + $site_url = preg_match('#^(\w+:)?//#i', $uri) ? $uri : site_url($uri); } else { @@ -191,7 +191,7 @@ if ( ! function_exists('anchor_popup')) function anchor_popup($uri = '', $title = '', $attributes = FALSE) { $title = (string) $title; - $site_url = preg_match('!^\w+://! i', $uri) ? $uri : site_url($uri); + $site_url = preg_match('#^(\w+:)?//#i', $uri) ? $uri : site_url($uri); if ($title === '') { @@ -535,7 +535,7 @@ if ( ! function_exists('redirect')) */ function redirect($uri = '', $method = 'auto', $code = NULL) { - if ( ! preg_match('#^https?://#i', $uri)) + if ( ! preg_match('#^(\w+:)?//#i', $uri)) { $uri = site_url($uri); } -- cgit v1.2.3-24-g4f1b From 80500afbd188600212ca913a7bac073009feac73 Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Tue, 1 Jan 2013 08:16:53 +0200 Subject: [ci skip] Happy new year --- system/helpers/url_helper.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'system/helpers/url_helper.php') diff --git a/system/helpers/url_helper.php b/system/helpers/url_helper.php index 36ff0ff2c..0c0edf54e 100644 --- a/system/helpers/url_helper.php +++ b/system/helpers/url_helper.php @@ -18,7 +18,7 @@ * * @package CodeIgniter * @author EllisLab Dev Team - * @copyright Copyright (c) 2008 - 2012, EllisLab, Inc. (http://ellislab.com/) + * @copyright Copyright (c) 2008 - 2013, EllisLab, Inc. (http://ellislab.com/) * @license http://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) * @link http://codeigniter.com * @since Version 1.0 -- cgit v1.2.3-24-g4f1b From e9eb64f863ffeacd2986eb75e0aaaeb95d12a122 Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Thu, 17 Jan 2013 15:21:02 +0200 Subject: Fix issues #2160, #2161 --- system/helpers/url_helper.php | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) (limited to 'system/helpers/url_helper.php') diff --git a/system/helpers/url_helper.php b/system/helpers/url_helper.php index 0c0edf54e..130f6f962 100644 --- a/system/helpers/url_helper.php +++ b/system/helpers/url_helper.php @@ -408,23 +408,18 @@ if ( ! function_exists('auto_link')) } } - if ($type !== 'url' && preg_match_all('/([a-zA-Z0-9_\.\-\+]+)@([a-zA-Z0-9\-]+)\.([a-zA-Z0-9\-\.]+)/i', $str, $matches)) + if ($type !== 'url' && preg_match_all('/([a-zA-Z0-9_\.\-\+]+)@([a-zA-Z0-9\-]+)\.([a-zA-Z0-9\-\.]+)/i', $str, $matches, PREG_OFFSET_CAPTURE)) { - for ($i = 0, $c = count($matches); $i < $c; $i++) + for ($i = count($matches[0]) - 1; $i > -1; $i--) { - if (preg_match('/(\.|\,)$/i', $matches[3][$i], $m)) + if (preg_match('/(\.|\,)$/i', $matches[3][$i][0], $m)) { - $punct = $m[1]; - $matches[3][$i] = substr($matches[3][$i], 0, -1); - } - else - { - $punct = ''; + $matches[3][$i][0] = substr($matches[3][$i][0], 0, -1); } - if (filter_var(($m = $matches[1][$i].'@'.$matches[2][$i].'.'.$matches[3][$i]), FILTER_VALIDATE_EMAIL) !== FALSE) + if (filter_var(($m = $matches[1][$i][0].'@'.$matches[2][$i][0].'.'.$matches[3][$i][0]), FILTER_VALIDATE_EMAIL) !== FALSE) { - $str = str_replace($matches[0][$i], safe_mailto($m).$punct, $str); + $str = substr_replace($str, safe_mailto($m), $matches[0][$i][1], strlen($m)); } } } -- cgit v1.2.3-24-g4f1b From 8093bd7a1ae63cacb87c16aad9910c053349739f Mon Sep 17 00:00:00 2001 From: Eric Roberts Date: Thu, 17 Jan 2013 18:12:47 -0600 Subject: Fix and optimize auto_link() URL helper function. Signed-off-by: Eric Roberts --- system/helpers/url_helper.php | 53 ++++++++++++++++++------------------------- 1 file changed, 22 insertions(+), 31 deletions(-) (limited to 'system/helpers/url_helper.php') diff --git a/system/helpers/url_helper.php b/system/helpers/url_helper.php index 130f6f962..8be327276 100644 --- a/system/helpers/url_helper.php +++ b/system/helpers/url_helper.php @@ -383,47 +383,38 @@ if ( ! function_exists('auto_link')) */ function auto_link($str, $type = 'both', $popup = FALSE) { - if ($type !== 'email' && preg_match_all('#(^|\s|\(|\b)((http(s?)://)|(www\.))(\w+[^\s\)\<]+)#i', $str, $matches)) + // Find and replace any URLs. + if ($type !== 'email' && preg_match_all('#\b(([\w-]+://?|www[.])[^\s()<>]+(?:\([\w\d]+\)|([^[:punct:]\s]|/)))#', $str, $matches, PREG_OFFSET_CAPTURE)) { - $pop = ($popup) ? ' target="_blank" ' : ''; - - for ($i = 0, $c = count($matches[0]); $i < $c; $i++) + // Set our target HTML if using popup links. + $target = ($popup) ? 'target="_blank"' : ''; + + // We process the links in reverse order (last -> first) so that + // the returned string offsets from preg_match_all() are not + // moved as we add more HTML. + foreach (array_reverse($matches[0]) as $match) { - if (preg_match('/(\.|\,)$/i', $matches[6][$i], $m)) - { - $punct = $m[1]; - $matches[6][$i] = substr($matches[6][$i], 0, -1); - } - else - { - $punct = ''; - } - - $str = str_replace($matches[0][$i], - $matches[1][$i].'http' - .$matches[4][$i].'://'.$matches[5][$i] - .$matches[6][$i].''.$punct, - $str); + // $match is an array generated by the PREG_OFFSET_CAPTURE flag. + // $match[0] is the matched string, $match[1] is the string offset. + + $anchor = anchor($match[0], '', $target); + + $str = substr_replace($str, $anchor, $match[1], strlen($match[0])); } } - - if ($type !== 'url' && preg_match_all('/([a-zA-Z0-9_\.\-\+]+)@([a-zA-Z0-9\-]+)\.([a-zA-Z0-9\-\.]+)/i', $str, $matches, PREG_OFFSET_CAPTURE)) + + // Find and replace any emails. + if ($type !== 'url' && preg_match_all('#([\w\.\-\+]+@[a-z0-9\-]+\.[a-z0-9\-\.]+[^[:punct:]\s])#i', $str, $matches, PREG_OFFSET_CAPTURE)) { - for ($i = count($matches[0]) - 1; $i > -1; $i--) + foreach (array_reverse($matches[0]) as $match) { - if (preg_match('/(\.|\,)$/i', $matches[3][$i][0], $m)) + if (filter_var($match[0], FILTER_VALIDATE_EMAIL) !== FALSE) { - $matches[3][$i][0] = substr($matches[3][$i][0], 0, -1); - } - - if (filter_var(($m = $matches[1][$i][0].'@'.$matches[2][$i][0].'.'.$matches[3][$i][0]), FILTER_VALIDATE_EMAIL) !== FALSE) - { - $str = substr_replace($str, safe_mailto($m), $matches[0][$i][1], strlen($m)); + $str = substr_replace($str, safe_mailto($match[0]), $match[1], strlen($match[0])); } } } - + return $str; } } -- cgit v1.2.3-24-g4f1b From 32a28f59a08c9fd24f0d884ecfa71bf8df4bbe97 Mon Sep 17 00:00:00 2001 From: Eric Roberts Date: Sat, 19 Jan 2013 02:59:14 -0600 Subject: Remove whitespace from empty lines. Signed-off-by: Eric Roberts --- system/helpers/url_helper.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'system/helpers/url_helper.php') diff --git a/system/helpers/url_helper.php b/system/helpers/url_helper.php index 8be327276..e54969b22 100644 --- a/system/helpers/url_helper.php +++ b/system/helpers/url_helper.php @@ -388,7 +388,7 @@ if ( ! function_exists('auto_link')) { // Set our target HTML if using popup links. $target = ($popup) ? 'target="_blank"' : ''; - + // We process the links in reverse order (last -> first) so that // the returned string offsets from preg_match_all() are not // moved as we add more HTML. @@ -396,13 +396,13 @@ if ( ! function_exists('auto_link')) { // $match is an array generated by the PREG_OFFSET_CAPTURE flag. // $match[0] is the matched string, $match[1] is the string offset. - + $anchor = anchor($match[0], '', $target); - + $str = substr_replace($str, $anchor, $match[1], strlen($match[0])); } } - + // Find and replace any emails. if ($type !== 'url' && preg_match_all('#([\w\.\-\+]+@[a-z0-9\-]+\.[a-z0-9\-\.]+[^[:punct:]\s])#i', $str, $matches, PREG_OFFSET_CAPTURE)) { @@ -414,7 +414,7 @@ if ( ! function_exists('auto_link')) } } } - + return $str; } } -- cgit v1.2.3-24-g4f1b From 4de1198ccf88d4a448ff752f35630228b60c53a8 Mon Sep 17 00:00:00 2001 From: Eric Roberts Date: Mon, 21 Jan 2013 16:47:22 -0600 Subject: Adjust regex. --- system/helpers/url_helper.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'system/helpers/url_helper.php') diff --git a/system/helpers/url_helper.php b/system/helpers/url_helper.php index e54969b22..a6536cf81 100644 --- a/system/helpers/url_helper.php +++ b/system/helpers/url_helper.php @@ -384,7 +384,7 @@ if ( ! function_exists('auto_link')) function auto_link($str, $type = 'both', $popup = FALSE) { // Find and replace any URLs. - if ($type !== 'email' && preg_match_all('#\b(([\w-]+://?|www[.])[^\s()<>]+(?:\([\w\d]+\)|([^[:punct:]\s]|/)))#', $str, $matches, PREG_OFFSET_CAPTURE)) + if ($type !== 'email' && preg_match_all('#\b(([\w-]+://?|www\.)[^\s()<>]+(?:\([\w\d]+\)|([^[:punct:]\s]|/)))#', $str, $matches, PREG_OFFSET_CAPTURE)) { // Set our target HTML if using popup links. $target = ($popup) ? 'target="_blank"' : ''; -- cgit v1.2.3-24-g4f1b From 606fee0e2e0aa6a906db82e77090e91f133d7378 Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Mon, 28 Jan 2013 12:57:13 +0200 Subject: Fix auto_link() for the Nth time - anchor() is for local links and breaks ones that don't have a protocol prefix - Allow :// links (no actual protocol specified) - Further simplified the URL regular expression --- system/helpers/url_helper.php | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) (limited to 'system/helpers/url_helper.php') diff --git a/system/helpers/url_helper.php b/system/helpers/url_helper.php index a6536cf81..d0fab3fe0 100644 --- a/system/helpers/url_helper.php +++ b/system/helpers/url_helper.php @@ -384,22 +384,23 @@ if ( ! function_exists('auto_link')) function auto_link($str, $type = 'both', $popup = FALSE) { // Find and replace any URLs. - if ($type !== 'email' && preg_match_all('#\b(([\w-]+://?|www\.)[^\s()<>]+(?:\([\w\d]+\)|([^[:punct:]\s]|/)))#', $str, $matches, PREG_OFFSET_CAPTURE)) + if ($type !== 'email' && preg_match_all('#(\w*://|www\.)[^\s()<>;]+\w#i', $str, $matches, PREG_OFFSET_CAPTURE | PREG_SET_ORDER)) { // Set our target HTML if using popup links. - $target = ($popup) ? 'target="_blank"' : ''; + $target = ($popup) ? ' target="_blank"' : ''; // We process the links in reverse order (last -> first) so that // the returned string offsets from preg_match_all() are not // moved as we add more HTML. - foreach (array_reverse($matches[0]) as $match) + foreach (array_reverse($matches) as $match) { - // $match is an array generated by the PREG_OFFSET_CAPTURE flag. - // $match[0] is the matched string, $match[1] is the string offset. - - $anchor = anchor($match[0], '', $target); - - $str = substr_replace($str, $anchor, $match[1], strlen($match[0])); + // $match[0] is the matched string/link + // $match[1] is either a protocol prefix or 'www.' + // + // With PREG_OFFSET_CAPTURE, both of the above is an array, + // where the actual value is held in [0] and its offset at the [1] index. + $a = ''.$match[0][0].''; + $str = substr_replace($str, $a, $match[0][1], strlen($match[0][0])); } } -- cgit v1.2.3-24-g4f1b From 2023c3d05b042cf1322286d69557c2b8bf3bd8d5 Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Thu, 18 Jul 2013 03:19:59 +0300 Subject: Add an optional parameter to URL helpers base_url() and site_url() (supersedes #2535) --- system/helpers/url_helper.php | 28 +++++++++++++++++++++------- 1 file changed, 21 insertions(+), 7 deletions(-) (limited to 'system/helpers/url_helper.php') diff --git a/system/helpers/url_helper.php b/system/helpers/url_helper.php index d0fab3fe0..36219630d 100644 --- a/system/helpers/url_helper.php +++ b/system/helpers/url_helper.php @@ -46,13 +46,20 @@ if ( ! function_exists('site_url')) * Create a local URL based on your basepath. Segments can be passed via the * first parameter either as a string or an array. * - * @param string + * @param string $uri + * @param string $protocol * @return string */ function site_url($uri = '') { - $CI =& get_instance(); - return $CI->config->site_url($uri); + $site_url = get_instance()->config->site_url($uri); + + if (isset($protocol)) + { + $site_url = $protocol.substr($site_url, strpos($site_url, '://')); + } + + return $site_url; } } @@ -67,13 +74,20 @@ if ( ! function_exists('base_url')) * Segments can be passed in as a string or an array, same as site_url * or a URL to a file can be passed in, e.g. to an image file. * - * @param string + * @param string $uri + * @param string $protocol * @return string */ - function base_url($uri = '') + function base_url($uri = '', $protocol = NULL) { - $CI =& get_instance(); - return $CI->config->base_url($uri); + $base_url = get_instance()->config->base_url($uri); + + if (isset($protocol)) + { + $base_url = $protocol.substr($base_url, strpos($base_url, '://')); + } + + return $base_url; } } -- cgit v1.2.3-24-g4f1b From 56c8ca6e3d292030283ee23745d495a146c168f5 Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Thu, 18 Jul 2013 03:21:16 +0300 Subject: Add that parameter for real :) --- system/helpers/url_helper.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'system/helpers/url_helper.php') diff --git a/system/helpers/url_helper.php b/system/helpers/url_helper.php index 36219630d..e82a51dcc 100644 --- a/system/helpers/url_helper.php +++ b/system/helpers/url_helper.php @@ -50,7 +50,7 @@ if ( ! function_exists('site_url')) * @param string $protocol * @return string */ - function site_url($uri = '') + function site_url($uri = '', $protocol = NULL) { $site_url = get_instance()->config->site_url($uri); -- cgit v1.2.3-24-g4f1b From 1f061c24ef6788ccfea4182e43f9d3076714940d Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Thu, 18 Jul 2013 14:15:57 +0300 Subject: Micro-optimization on base_url() & site_url() --- system/helpers/url_helper.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'system/helpers/url_helper.php') diff --git a/system/helpers/url_helper.php b/system/helpers/url_helper.php index e82a51dcc..fbb4a1b24 100644 --- a/system/helpers/url_helper.php +++ b/system/helpers/url_helper.php @@ -52,14 +52,14 @@ if ( ! function_exists('site_url')) */ function site_url($uri = '', $protocol = NULL) { - $site_url = get_instance()->config->site_url($uri); + $uri = get_instance()->config->site_url($uri); if (isset($protocol)) { - $site_url = $protocol.substr($site_url, strpos($site_url, '://')); + return $protocol.substr($uri, strpos($uri, '://')); } - return $site_url; + return $uri; } } @@ -80,14 +80,14 @@ if ( ! function_exists('base_url')) */ function base_url($uri = '', $protocol = NULL) { - $base_url = get_instance()->config->base_url($uri); + $uri = get_instance()->config->base_url($uri); if (isset($protocol)) { - $base_url = $protocol.substr($base_url, strpos($base_url, '://')); + return $protocol.substr($uri, strpos($uri, '://')); } - return $base_url; + return $uri; } } -- cgit v1.2.3-24-g4f1b From 4c07fce7191ed5d9c393479406cce454a9c4a7cc Mon Sep 17 00:00:00 2001 From: vlakoff Date: Fri, 25 Oct 2013 01:20:32 +0200 Subject: Implement $protocol parameter in Config base_url() and site_url() methods Let's keep the implementation logic in one place. Improves 2023c3d05b042cf1322286d69557c2b8bf3bd8d5. --- system/helpers/url_helper.php | 18 ++---------------- 1 file changed, 2 insertions(+), 16 deletions(-) (limited to 'system/helpers/url_helper.php') diff --git a/system/helpers/url_helper.php b/system/helpers/url_helper.php index fbb4a1b24..b0f436840 100644 --- a/system/helpers/url_helper.php +++ b/system/helpers/url_helper.php @@ -52,14 +52,7 @@ if ( ! function_exists('site_url')) */ function site_url($uri = '', $protocol = NULL) { - $uri = get_instance()->config->site_url($uri); - - if (isset($protocol)) - { - return $protocol.substr($uri, strpos($uri, '://')); - } - - return $uri; + return get_instance()->config->site_url($uri, $protocol); } } @@ -80,14 +73,7 @@ if ( ! function_exists('base_url')) */ function base_url($uri = '', $protocol = NULL) { - $uri = get_instance()->config->base_url($uri); - - if (isset($protocol)) - { - return $protocol.substr($uri, strpos($uri, '://')); - } - - return $uri; + return get_instance()->config->base_url($uri, $protocol); } } -- cgit v1.2.3-24-g4f1b From 119d8a7547e155edaaa53682b9247cd7e80d8c9d Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Wed, 8 Jan 2014 15:27:53 +0200 Subject: Optimize get_instance() calls/assignments --- system/helpers/url_helper.php | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) (limited to 'system/helpers/url_helper.php') diff --git a/system/helpers/url_helper.php b/system/helpers/url_helper.php index b0f436840..2d9289791 100644 --- a/system/helpers/url_helper.php +++ b/system/helpers/url_helper.php @@ -91,8 +91,7 @@ if ( ! function_exists('current_url')) */ function current_url() { - $CI =& get_instance(); - return $CI->config->site_url($CI->uri->uri_string()); + return get_instance()->config->site_url($CI->uri->uri_string()); } } @@ -109,8 +108,7 @@ if ( ! function_exists('uri_string')) */ function uri_string() { - $CI =& get_instance(); - return $CI->uri->uri_string(); + return get_instance()->uri->uri_string(); } } @@ -127,8 +125,7 @@ if ( ! function_exists('index_page')) */ function index_page() { - $CI =& get_instance(); - return $CI->config->item('index_page'); + return get_instance()->config->item('index_page'); } } -- cgit v1.2.3-24-g4f1b From 4ea76cc2216b19bfae38dbbfe7104c21ee278d81 Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Wed, 8 Jan 2014 21:49:23 +0200 Subject: Fix 2 errors caused by recent commits --- system/helpers/url_helper.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'system/helpers/url_helper.php') diff --git a/system/helpers/url_helper.php b/system/helpers/url_helper.php index 2d9289791..f819b96e9 100644 --- a/system/helpers/url_helper.php +++ b/system/helpers/url_helper.php @@ -91,7 +91,8 @@ if ( ! function_exists('current_url')) */ function current_url() { - return get_instance()->config->site_url($CI->uri->uri_string()); + $CI =& get_instance(); + return $CI->config->site_url($CI->uri->uri_string()); } } -- cgit v1.2.3-24-g4f1b From a0a73c977ce25911f56948d89de817b3ca83adcb Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Thu, 9 Jan 2014 19:21:26 +0200 Subject: Add HTTP response code 307 support in URL helper redirect() --- system/helpers/url_helper.php | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) (limited to 'system/helpers/url_helper.php') diff --git a/system/helpers/url_helper.php b/system/helpers/url_helper.php index f819b96e9..f9650cd04 100644 --- a/system/helpers/url_helper.php +++ b/system/helpers/url_helper.php @@ -532,11 +532,16 @@ if ( ! function_exists('redirect')) } elseif ($method !== 'refresh' && (empty($code) OR ! is_numeric($code))) { - // Reference: http://en.wikipedia.org/wiki/Post/Redirect/Get - $code = (isset($_SERVER['REQUEST_METHOD'], $_SERVER['SERVER_PROTOCOL']) - && $_SERVER['REQUEST_METHOD'] === 'POST' - && $_SERVER['SERVER_PROTOCOL'] === 'HTTP/1.1') - ? 303 : 302; + if (isset($_SERVER['SERVER_PROTOCOL'], $_SERVER['REQUEST_METHOD']) && $_SERVER['SERVER_PROTOCOL'] === 'HTTP/1.1') + { + $code = ($_SERVER['REQUEST_METHOD'] !== 'GET') + ? 303 // reference: http://en.wikipedia.org/wiki/Post/Redirect/Get + : 307; + } + else + { + $code = 302; + } } switch ($method) -- cgit v1.2.3-24-g4f1b From 871754af60251993d640981e107d2def5f2db396 Mon Sep 17 00:00:00 2001 From: darwinel Date: Tue, 11 Feb 2014 17:34:57 +0100 Subject: 2013 > 2014 Update copyright notices from 2013 to 2014. And update one calendar example in user_guide from year 2013/2014 to 2014/2015. --- system/helpers/url_helper.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'system/helpers/url_helper.php') diff --git a/system/helpers/url_helper.php b/system/helpers/url_helper.php index f9650cd04..a9790e5c4 100644 --- a/system/helpers/url_helper.php +++ b/system/helpers/url_helper.php @@ -18,7 +18,7 @@ * * @package CodeIgniter * @author EllisLab Dev Team - * @copyright Copyright (c) 2008 - 2013, EllisLab, Inc. (http://ellislab.com/) + * @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (http://ellislab.com/) * @license http://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) * @link http://codeigniter.com * @since Version 1.0 -- cgit v1.2.3-24-g4f1b From cfaf8c4ef695f78fffef9b60a05bb89e2270b78b Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Sat, 15 Feb 2014 21:58:45 +0200 Subject: [ci skip] Don't use output buffering in URL helper safe_mailto() --- system/helpers/url_helper.php | 35 ++++++++++++++++++----------------- 1 file changed, 18 insertions(+), 17 deletions(-) (limited to 'system/helpers/url_helper.php') diff --git a/system/helpers/url_helper.php b/system/helpers/url_helper.php index a9790e5c4..5f11a42ca 100644 --- a/system/helpers/url_helper.php +++ b/system/helpers/url_helper.php @@ -342,23 +342,24 @@ if ( ! function_exists('safe_mailto')) $x[] = '<'; $x[] = '/'; $x[] = 'a'; $x[] = '>'; $x = array_reverse($x); - ob_start(); - - ?>\n" + ."\t//= 0; i=i-1) {\n" + ."\t\tif (l[i].substring(0, 1) === '|') document.write(\"&#\"+unescape(l[i].substring(1))+\";\");\n" + ."\t\telse document.write(unescape(l[i]));\n" + ."\t}\n" + ."\t//]]>\n" + .''; + + return $output; } } -- cgit v1.2.3-24-g4f1b From ea41c8aa1951216b6a9ccc99832d69d2b41c5ead Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Wed, 26 Feb 2014 18:31:02 +0200 Subject: Don't use error suppression on realpath() + style adjustments --- system/helpers/url_helper.php | 21 ++++++++------------- 1 file changed, 8 insertions(+), 13 deletions(-) (limited to 'system/helpers/url_helper.php') diff --git a/system/helpers/url_helper.php b/system/helpers/url_helper.php index 5f11a42ca..dff1a86d2 100644 --- a/system/helpers/url_helper.php +++ b/system/helpers/url_helper.php @@ -148,14 +148,9 @@ if ( ! function_exists('anchor')) { $title = (string) $title; - if ( ! is_array($uri)) - { - $site_url = preg_match('#^(\w+:)?//#i', $uri) ? $uri : site_url($uri); - } - else - { - $site_url = site_url($uri); - } + $site_url = is_array($uri) + ? site_url($uri) + : preg_match('#^(\w+:)?//#i', $uri) ? $uri : site_url($uri); if ($title === '') { @@ -481,11 +476,11 @@ if ( ! function_exists('url_title')) $q_separator = preg_quote($separator, '#'); $trans = array( - '&.+?;' => '', - '[^a-z0-9 _-]' => '', - '\s+' => $separator, - '('.$q_separator.')+' => $separator - ); + '&.+?;' => '', + '[^a-z0-9 _-]' => '', + '\s+' => $separator, + '('.$q_separator.')+' => $separator + ); $str = strip_tags($str); foreach ($trans as $key => $val) -- cgit v1.2.3-24-g4f1b From 5286ef0f3ec6d298fa53bfbf8ecde474e5710f81 Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Sun, 6 Jul 2014 19:57:59 +0300 Subject: Fix #3131 --- system/helpers/url_helper.php | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'system/helpers/url_helper.php') diff --git a/system/helpers/url_helper.php b/system/helpers/url_helper.php index dff1a86d2..4493d5b97 100644 --- a/system/helpers/url_helper.php +++ b/system/helpers/url_helper.php @@ -208,6 +208,10 @@ if ( ! function_exists('anchor_popup')) $window_name = $attributes['window_name']; unset($attributes['window_name']); } + else + { + $window_name = '_blank'; + } foreach (array('width' => '800', 'height' => '600', 'scrollbars' => 'yes', 'status' => 'yes', 'resizable' => 'yes', 'screenx' => '0', 'screeny' => '0') as $key => $val) { -- cgit v1.2.3-24-g4f1b From a3f13b74fe88a899c476efd0d275cabaaac24ff2 Mon Sep 17 00:00:00 2001 From: Mian Saleem Date: Thu, 31 Jul 2014 18:16:20 +0800 Subject: anchor popup attribute missing Please add the menubar attribute to anchor popup --- system/helpers/url_helper.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'system/helpers/url_helper.php') diff --git a/system/helpers/url_helper.php b/system/helpers/url_helper.php index 4493d5b97..f5a880c9b 100644 --- a/system/helpers/url_helper.php +++ b/system/helpers/url_helper.php @@ -213,7 +213,7 @@ if ( ! function_exists('anchor_popup')) $window_name = '_blank'; } - foreach (array('width' => '800', 'height' => '600', 'scrollbars' => 'yes', 'status' => 'yes', 'resizable' => 'yes', 'screenx' => '0', 'screeny' => '0') as $key => $val) + foreach (array('width' => '800', 'height' => '600', 'scrollbars' => 'yes', 'menubar' => 'yes', 'status' => 'yes', 'resizable' => 'yes', 'screenx' => '0', 'screeny' => '0') as $key => $val) { $atts[$key] = isset($attributes[$key]) ? $attributes[$key] : $val; unset($attributes[$key]); @@ -558,4 +558,4 @@ if ( ! function_exists('redirect')) } /* End of file url_helper.php */ -/* Location: ./system/helpers/url_helper.php */ \ No newline at end of file +/* Location: ./system/helpers/url_helper.php */ -- cgit v1.2.3-24-g4f1b From fc88a5f319d4c32f3ce9429293549e6c90a68440 Mon Sep 17 00:00:00 2001 From: Mian Saleem Date: Thu, 31 Jul 2014 22:08:07 +0800 Subject: Update url_helper.php --- system/helpers/url_helper.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'system/helpers/url_helper.php') diff --git a/system/helpers/url_helper.php b/system/helpers/url_helper.php index f5a880c9b..04aacede5 100644 --- a/system/helpers/url_helper.php +++ b/system/helpers/url_helper.php @@ -213,7 +213,7 @@ if ( ! function_exists('anchor_popup')) $window_name = '_blank'; } - foreach (array('width' => '800', 'height' => '600', 'scrollbars' => 'yes', 'menubar' => 'yes', 'status' => 'yes', 'resizable' => 'yes', 'screenx' => '0', 'screeny' => '0') as $key => $val) + foreach (array('width' => '800', 'height' => '600', 'scrollbars' => 'yes', 'menubar' => 'no', 'status' => 'yes', 'resizable' => 'yes', 'screenx' => '0', 'screeny' => '0') as $key => $val) { $atts[$key] = isset($attributes[$key]) ? $attributes[$key] : $val; unset($attributes[$key]); -- cgit v1.2.3-24-g4f1b From dc5fe5a179e41792a7fd4f2019e38bb13cddc675 Mon Sep 17 00:00:00 2001 From: Mian Saleem Date: Thu, 31 Jul 2014 23:30:24 +0800 Subject: Last empty line remove --- system/helpers/url_helper.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'system/helpers/url_helper.php') diff --git a/system/helpers/url_helper.php b/system/helpers/url_helper.php index 04aacede5..0846472e7 100644 --- a/system/helpers/url_helper.php +++ b/system/helpers/url_helper.php @@ -558,4 +558,4 @@ if ( ! function_exists('redirect')) } /* End of file url_helper.php */ -/* Location: ./system/helpers/url_helper.php */ +/* Location: ./system/helpers/url_helper.php */ \ No newline at end of file -- cgit v1.2.3-24-g4f1b From bdb96ca1b1dbfc1791172fd169d7751cbc4d7d55 Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Tue, 28 Oct 2014 00:13:31 +0200 Subject: [ci skip] Switch to MIT license; close #3293 --- system/helpers/url_helper.php | 39 +++++++++++++++++++++++++-------------- 1 file changed, 25 insertions(+), 14 deletions(-) (limited to 'system/helpers/url_helper.php') diff --git a/system/helpers/url_helper.php b/system/helpers/url_helper.php index 0846472e7..6b84c9cc6 100644 --- a/system/helpers/url_helper.php +++ b/system/helpers/url_helper.php @@ -4,24 +4,35 @@ * * An open source application development framework for PHP 5.2.4 or newer * - * NOTICE OF LICENSE + * This content is released under the MIT License (MIT) * - * Licensed under the Open Software License version 3.0 + * Copyright (c) 2014, British Columbia Institute of Technology * - * This source file is subject to the Open Software License (OSL 3.0) that is - * bundled with this package in the files license.txt / license.rst. It is - * also available through the world wide web at this URL: - * http://opensource.org/licenses/OSL-3.0 - * If you did not receive a copy of the license and are unable to obtain it - * through the world wide web, please send an email to - * licensing@ellislab.com so we can send you a copy immediately. + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: * - * @package CodeIgniter - * @author EllisLab Dev Team + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + * + * @package CodeIgniter + * @author EllisLab Dev Team * @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (http://ellislab.com/) - * @license http://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) - * @link http://codeigniter.com - * @since Version 1.0 + * @copyright Copyright (c) 2014, British Columbia Institute of Technology (http://bcit.ca/) + * @license http://opensource.org/licenses/MIT MIT License + * @link http://codeigniter.com + * @since Version 1.0.0 * @filesource */ defined('BASEPATH') OR exit('No direct script access allowed'); -- cgit v1.2.3-24-g4f1b From fe9309d22c1b088f5363954d6dac013c8c955894 Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Fri, 9 Jan 2015 17:48:58 +0200 Subject: Bulk (mostly documentation) update - Remove PHP version from license notices - Bump year number in copyright notices - Recommend PHP 5.4 or newer to be used - Tell Travis-CI to test on PHP 5.3.0 instead of the latest 5.3 version Related: #3450 --- system/helpers/url_helper.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'system/helpers/url_helper.php') diff --git a/system/helpers/url_helper.php b/system/helpers/url_helper.php index 6b84c9cc6..afec35aea 100644 --- a/system/helpers/url_helper.php +++ b/system/helpers/url_helper.php @@ -2,11 +2,11 @@ /** * CodeIgniter * - * An open source application development framework for PHP 5.2.4 or newer + * An open source application development framework for PHP * * This content is released under the MIT License (MIT) * - * Copyright (c) 2014, British Columbia Institute of Technology + * Copyright (c) 2014 - 2015, British Columbia Institute of Technology * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -29,7 +29,7 @@ * @package CodeIgniter * @author EllisLab Dev Team * @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (http://ellislab.com/) - * @copyright Copyright (c) 2014, British Columbia Institute of Technology (http://bcit.ca/) + * @copyright Copyright (c) 2014 - 2015, British Columbia Institute of Technology (http://bcit.ca/) * @license http://opensource.org/licenses/MIT MIT License * @link http://codeigniter.com * @since Version 1.0.0 -- cgit v1.2.3-24-g4f1b From 4cbe463b4c442e0e2dae2f43565e77f7ac5ecb86 Mon Sep 17 00:00:00 2001 From: vlakoff Date: Wed, 21 Jan 2015 22:56:22 +0100 Subject: Remove closing blocks at end of PHP files --- system/helpers/url_helper.php | 3 --- 1 file changed, 3 deletions(-) (limited to 'system/helpers/url_helper.php') diff --git a/system/helpers/url_helper.php b/system/helpers/url_helper.php index afec35aea..bf623b000 100644 --- a/system/helpers/url_helper.php +++ b/system/helpers/url_helper.php @@ -567,6 +567,3 @@ if ( ! function_exists('redirect')) exit; } } - -/* End of file url_helper.php */ -/* Location: ./system/helpers/url_helper.php */ \ No newline at end of file -- cgit v1.2.3-24-g4f1b From c14aa9bcca4b5876f2bf46bbe9eb4c7d3e0e013a Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Sun, 12 Apr 2015 14:23:47 +0300 Subject: Close #3761 --- system/helpers/url_helper.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'system/helpers/url_helper.php') diff --git a/system/helpers/url_helper.php b/system/helpers/url_helper.php index bf623b000..5f8c6ce67 100644 --- a/system/helpers/url_helper.php +++ b/system/helpers/url_helper.php @@ -161,7 +161,7 @@ if ( ! function_exists('anchor')) $site_url = is_array($uri) ? site_url($uri) - : preg_match('#^(\w+:)?//#i', $uri) ? $uri : site_url($uri); + : (preg_match('#^(\w+:)?//#i', $uri) ? $uri : site_url($uri)); if ($title === '') { -- cgit v1.2.3-24-g4f1b From 9409a2a02c1097d14ce30b3587011a7cd00d046c Mon Sep 17 00:00:00 2001 From: Michael Foss Date: Fri, 12 Jun 2015 20:22:39 -0400 Subject: Fix typo in url_title function description. --- system/helpers/url_helper.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'system/helpers/url_helper.php') diff --git a/system/helpers/url_helper.php b/system/helpers/url_helper.php index 5f8c6ce67..6a033d6ba 100644 --- a/system/helpers/url_helper.php +++ b/system/helpers/url_helper.php @@ -474,7 +474,7 @@ if ( ! function_exists('url_title')) * @param string $str Input string * @param string $separator Word separator * (usually '-' or '_') - * @param bool $lowercase Wether to transform the output string to lowercase + * @param bool $lowercase Whether to transform the output string to lowercase * @return string */ function url_title($str, $separator = '-', $lowercase = FALSE) -- cgit v1.2.3-24-g4f1b From 32bdf1c1e3c8ec6c0ccf38a947ff01c06eb9152f Mon Sep 17 00:00:00 2001 From: dimonneon Date: Fri, 10 Jul 2015 21:47:04 +0300 Subject: Add unicode support in url_title function --- system/helpers/url_helper.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'system/helpers/url_helper.php') diff --git a/system/helpers/url_helper.php b/system/helpers/url_helper.php index 6a033d6ba..41ded94ee 100644 --- a/system/helpers/url_helper.php +++ b/system/helpers/url_helper.php @@ -492,7 +492,7 @@ if ( ! function_exists('url_title')) $trans = array( '&.+?;' => '', - '[^a-z0-9 _-]' => '', + '[^\w\d _-]' => '', '\s+' => $separator, '('.$q_separator.')+' => $separator ); @@ -500,7 +500,7 @@ if ( ! function_exists('url_title')) $str = strip_tags($str); foreach ($trans as $key => $val) { - $str = preg_replace('#'.$key.'#i', $val, $str); + $str = preg_replace('#'.$key.'#ui', $val, $str); } if ($lowercase === TRUE) -- cgit v1.2.3-24-g4f1b From 28c830507780c65c9b79f55e63d1071327c41205 Mon Sep 17 00:00:00 2001 From: dimonneon Date: Mon, 13 Jul 2015 11:54:05 +0300 Subject: Add check for PCRE UTF-8 support --- system/helpers/url_helper.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'system/helpers/url_helper.php') diff --git a/system/helpers/url_helper.php b/system/helpers/url_helper.php index 41ded94ee..d65f92f1b 100644 --- a/system/helpers/url_helper.php +++ b/system/helpers/url_helper.php @@ -500,7 +500,7 @@ if ( ! function_exists('url_title')) $str = strip_tags($str); foreach ($trans as $key => $val) { - $str = preg_replace('#'.$key.'#ui', $val, $str); + $str = preg_replace('#'.$key.'#i'.(UTF8_ENABLED ? 'u' : ''), $val, $str); } if ($lowercase === TRUE) -- cgit v1.2.3-24-g4f1b From 125ef4751080a2118cb203357d77687699e3eb25 Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Mon, 11 Jan 2016 12:33:00 +0200 Subject: [ci skip] Bump year to 2016 --- system/helpers/url_helper.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'system/helpers/url_helper.php') diff --git a/system/helpers/url_helper.php b/system/helpers/url_helper.php index d65f92f1b..6c96482d2 100644 --- a/system/helpers/url_helper.php +++ b/system/helpers/url_helper.php @@ -6,7 +6,7 @@ * * This content is released under the MIT License (MIT) * - * Copyright (c) 2014 - 2015, British Columbia Institute of Technology + * Copyright (c) 2014 - 2016, British Columbia Institute of Technology * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -29,7 +29,7 @@ * @package CodeIgniter * @author EllisLab Dev Team * @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (http://ellislab.com/) - * @copyright Copyright (c) 2014 - 2015, British Columbia Institute of Technology (http://bcit.ca/) + * @copyright Copyright (c) 2014 - 2016, British Columbia Institute of Technology (http://bcit.ca/) * @license http://opensource.org/licenses/MIT MIT License * @link http://codeigniter.com * @since Version 1.0.0 -- cgit v1.2.3-24-g4f1b From bd202c91b0e9cf0a8c93bcaa71df9574f5909346 Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Mon, 11 Jan 2016 12:50:18 +0200 Subject: [ci skip] Update codeigniter.com links to https --- system/helpers/url_helper.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'system/helpers/url_helper.php') diff --git a/system/helpers/url_helper.php b/system/helpers/url_helper.php index 6c96482d2..2c6672922 100644 --- a/system/helpers/url_helper.php +++ b/system/helpers/url_helper.php @@ -31,7 +31,7 @@ * @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (http://ellislab.com/) * @copyright Copyright (c) 2014 - 2016, British Columbia Institute of Technology (http://bcit.ca/) * @license http://opensource.org/licenses/MIT MIT License - * @link http://codeigniter.com + * @link https://codeigniter.com * @since Version 1.0.0 * @filesource */ @@ -44,7 +44,7 @@ defined('BASEPATH') OR exit('No direct script access allowed'); * @subpackage Helpers * @category Helpers * @author EllisLab Dev Team - * @link http://codeigniter.com/user_guide/helpers/url_helper.html + * @link https://codeigniter.com/user_guide/helpers/url_helper.html */ // ------------------------------------------------------------------------ -- cgit v1.2.3-24-g4f1b From 1924e879b165fb119847a49a7a5eab2f28295fa2 Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Mon, 11 Jan 2016 12:55:34 +0200 Subject: [ci skip] Update ellislab.com links to https too --- system/helpers/url_helper.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'system/helpers/url_helper.php') diff --git a/system/helpers/url_helper.php b/system/helpers/url_helper.php index 2c6672922..fd7b5e116 100644 --- a/system/helpers/url_helper.php +++ b/system/helpers/url_helper.php @@ -28,7 +28,7 @@ * * @package CodeIgniter * @author EllisLab Dev Team - * @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (http://ellislab.com/) + * @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (https://ellislab.com/) * @copyright Copyright (c) 2014 - 2016, British Columbia Institute of Technology (http://bcit.ca/) * @license http://opensource.org/licenses/MIT MIT License * @link https://codeigniter.com -- cgit v1.2.3-24-g4f1b From da60e9bc66ec90970fbd2dfd08b0a6e66b9f5f5f Mon Sep 17 00:00:00 2001 From: Master Yoda Date: Sat, 31 Dec 2016 08:46:18 -0800 Subject: Update copyright data to 2017 --- system/helpers/url_helper.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'system/helpers/url_helper.php') diff --git a/system/helpers/url_helper.php b/system/helpers/url_helper.php index fd7b5e116..84023affd 100644 --- a/system/helpers/url_helper.php +++ b/system/helpers/url_helper.php @@ -6,7 +6,7 @@ * * This content is released under the MIT License (MIT) * - * Copyright (c) 2014 - 2016, British Columbia Institute of Technology + * Copyright (c) 2014 - 2017, British Columbia Institute of Technology * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -29,7 +29,7 @@ * @package CodeIgniter * @author EllisLab Dev Team * @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (https://ellislab.com/) - * @copyright Copyright (c) 2014 - 2016, British Columbia Institute of Technology (http://bcit.ca/) + * @copyright Copyright (c) 2014 - 2017, British Columbia Institute of Technology (http://bcit.ca/) * @license http://opensource.org/licenses/MIT MIT License * @link https://codeigniter.com * @since Version 1.0.0 -- cgit v1.2.3-24-g4f1b