Skip to content
This repository
Browse code

multiple strpos to preg_match

  • Loading branch information...
commit 57bf15a415adc6d498bc0f9faac33b1ebf1a4672 1 parent 319658e
Mark authored

Showing 1 changed file with 1 addition and 8 deletions. Show diff stats Hide diff stats

  1. 9  lib/Cake/Routing/Router.php
9  lib/Cake/Routing/Router.php
@@ -829,14 +829,7 @@ public static function url($url = null, $full = false) {
829 829
 				$output = self::_handleNoRoute($url);
830 830
 			}
831 831
 		} else {
832  
-			if (
833  
-				(strpos($url, '://') !== false ||
834  
-				(strpos($url, 'javascript:') === 0) ||
835  
-				(strpos($url, 'mailto:') === 0) ||
836  
-				(strpos($url, 'tel:') === 0) ||
837  
-				(strpos($url, 'sms:') === 0)) ||
838  
-				(!strncmp($url, '#', 1))
839  
-			) {
  832
+			if (preg_match('/:\/\/|^(javascript|mailto|tel|sms):|\#/i', $url)) {
840 833
 				return $url;
841 834
 			}
842 835
 			if (substr($url, 0, 1) === '/') {

0 notes on commit 57bf15a

Please sign in to comment.
Something went wrong with that request. Please try again.