summaryrefslogtreecommitdiffstats
path: root/system/helpers/url_helper.php
diff options
context:
space:
mode:
authorFlorian Pritz <bluewind@server-speed.net>2011-01-28 22:51:06 +0100
committerFlorian Pritz <bluewind@server-speed.net>2011-01-28 22:58:52 +0100
commitce2b69675075444c9e40b72bcdd42ab7edbbe633 (patch)
tree2932f13b0db14fe53dc0622d888318db638a017f /system/helpers/url_helper.php
parentb6b8a6587c399bfd89e13e92ce04ee8486688e6e (diff)
update to CI 2.0
Signed-off-by: Florian Pritz <bluewind@server-speed.net>
Diffstat (limited to 'system/helpers/url_helper.php')
-rwxr-xr-x[-rw-r--r--]system/helpers/url_helper.php32
1 files changed, 17 insertions, 15 deletions
diff --git a/system/helpers/url_helper.php b/system/helpers/url_helper.php
index 90ea9207e..d0516cee6 100644..100755
--- 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 4.3.2 or newer
+ * An open source application development framework for PHP 5.1.6 or newer
*
* @package CodeIgniter
* @author ExpressionEngine Dev Team
- * @copyright Copyright (c) 2008 - 2010, EllisLab, Inc.
+ * @copyright Copyright (c) 2008 - 2011, EllisLab, Inc.
* @license http://codeigniter.com/user_guide/license.html
* @link http://codeigniter.com
* @since Version 1.0
@@ -70,7 +70,7 @@ if ( ! function_exists('base_url'))
/**
* Current URL
*
- * Returns the full URL (including segments) of the page where this
+ * Returns the full URL (including segments) of the page where this
* function is placed
*
* @access public
@@ -224,7 +224,7 @@ if ( ! function_exists('anchor_popup'))
* @access public
* @param string the email address
* @param string the link title
- * @param mixed any attributes
+ * @param mixed any attributes
* @return string
*/
if ( ! function_exists('mailto'))
@@ -254,7 +254,7 @@ if ( ! function_exists('mailto'))
* @access public
* @param string the email address
* @param string the link title
- * @param mixed any attributes
+ * @param mixed any attributes
* @return string
*/
if ( ! function_exists('safe_mailto'))
@@ -320,7 +320,7 @@ if ( ! function_exists('safe_mailto'))
{
$count = ($ordinal < 224) ? 2 : 3;
}
-
+
$temp[] = $ordinal;
if (count($temp) == $count)
{
@@ -369,7 +369,7 @@ if ( ! function_exists('safe_mailto'))
* @access public
* @param string the string
* @param string the type: email, url, or both
- * @param bool whether to create pop-up links
+ * @param bool whether to create pop-up links
* @return string
*/
if ( ! function_exists('auto_link'))
@@ -381,7 +381,7 @@ if ( ! function_exists('auto_link'))
if (preg_match_all("#(^|\s|\()((http(s?)://)|(www\.))(\w+[^\s\)\<]+)#i", $str, $matches))
{
$pop = ($popup == TRUE) ? " target=\"_blank\" " : "";
-
+
for ($i = 0; $i < count($matches['0']); $i++)
{
$period = '';
@@ -390,7 +390,7 @@ if ( ! function_exists('auto_link'))
$period = '.';
$matches['6'][$i] = substr($matches['6'][$i], 0, -1);
}
-
+
$str = str_replace($matches['0'][$i],
$matches['1'][$i].'<a href="http'.
$matches['4'][$i].'://'.
@@ -416,7 +416,7 @@ if ( ! function_exists('auto_link'))
$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);
}
}
@@ -431,7 +431,7 @@ if ( ! function_exists('auto_link'))
/**
* Prep URL
*
- * Simply adds the http:// part if missing
+ * Simply adds the http:// part if no scheme is included
*
* @access public
* @param string the URL
@@ -446,7 +446,9 @@ if ( ! function_exists('prep_url'))
return '';
}
- if (substr($str, 0, 7) != 'http://' && substr($str, 0, 8) != 'https://')
+ $url = parse_url($str);
+
+ if ( ! $url OR ! isset($url['scheme']))
{
$str = 'http://'.$str;
}
@@ -493,7 +495,7 @@ if ( ! function_exists('url_title'))
$replace.'$' => $replace,
'^'.$replace => $replace,
'\.+$' => ''
- );
+ );
$str = strip_tags($str);
@@ -506,7 +508,7 @@ if ( ! function_exists('url_title'))
{
$str = strtolower($str);
}
-
+
return trim(stripslashes($str));
}
}
@@ -533,7 +535,7 @@ if ( ! function_exists('redirect'))
{
$uri = site_url($uri);
}
-
+
switch($method)
{
case 'refresh' : header("Refresh:0;url=".$uri);