Permalink
Browse files

multiple strpos to preg_match

  • Loading branch information...
1 parent 319658e commit 57bf15a415adc6d498bc0f9faac33b1ebf1a4672 @dereuromark dereuromark committed Aug 1, 2012
Showing with 1 addition and 8 deletions.
  1. +1 −8 lib/Cake/Routing/Router.php
View
9 lib/Cake/Routing/Router.php
@@ -829,14 +829,7 @@ public static function url($url = null, $full = false) {
$output = self::_handleNoRoute($url);
}
} else {
- if (
- (strpos($url, '://') !== false ||
- (strpos($url, 'javascript:') === 0) ||
- (strpos($url, 'mailto:') === 0) ||
- (strpos($url, 'tel:') === 0) ||
- (strpos($url, 'sms:') === 0)) ||
- (!strncmp($url, '#', 1))
- ) {
+ if (preg_match('/:\/\/|^(javascript|mailto|tel|sms):|\#/i', $url)) {
return $url;
}
if (substr($url, 0, 1) === '/') {

0 comments on commit 57bf15a

Please sign in to comment.