Code Duplication    Length = 15-17 lines in 5 locations

class.jetpack-user-agent.php 5 locations

@@ 844-858 (lines=15) @@
841
	 * Detects if the current browser is a Windows Phone 7 device.
842
	 * ex: Mozilla/4.0 (compatible; MSIE 7.0; Windows Phone OS 7.0; Trident/3.1; IEMobile/7.0; LG; GW910)
843
	 */
844
	static function is_WindowsPhone7() {
845
		if ( empty( $_SERVER['HTTP_USER_AGENT'] ) )
846
			return false;
847
848
		$ua = strtolower( $_SERVER['HTTP_USER_AGENT'] );
849
850
		if ( false === strpos( $ua, 'windows phone os 7' ) ) {
851
			return false;
852
		} else {
853
			if ( self::is_opera_mini() || self::is_opera_mobile() || self::is_firefox_mobile() )
854
	   			return false;
855
	   		else
856
	   			return true;
857
		}
858
	}
859
860
	/*
861
	 * Detects if the current browser is a Windows Phone 8 device.
@@ 884-898 (lines=15) @@
881
	 * ex2: Mozilla/5.0 (webOS/1.4.0; U; en-US) AppleWebKit/532.2 (KHTML, like Gecko) Version/1.0 Safari/532.2 Pixi/1.1
882
	 *
883
	 */
884
	static function is_PalmWebOS() {
885
		if ( empty( $_SERVER['HTTP_USER_AGENT'] ) )
886
			return false;
887
888
		$ua = strtolower( $_SERVER['HTTP_USER_AGENT'] );
889
890
		if ( false === strpos( $ua, 'webos' ) ) {
891
	   		return false;
892
		} else {
893
			if ( self::is_opera_mini() || self::is_opera_mobile() || self::is_firefox_mobile() )
894
	   			return false;
895
	   		else
896
	   			return true;
897
		}
898
	}
899
900
	/*
901
	 * Detects if the current browser is the HP TouchPad default browser. This excludes phones wt WebOS.
@@ 1054-1069 (lines=16) @@
1051
	/*
1052
	 * Detects if the current UA is a MeeGo device (Nokia Smartphone).
1053
	 */
1054
	static function is_MeeGo() {
1055
1056
		if ( empty( $_SERVER['HTTP_USER_AGENT'] ) )
1057
			return false;
1058
1059
		$ua = strtolower( $_SERVER['HTTP_USER_AGENT'] );
1060
1061
		if ( false === strpos( $ua, 'meego' ) ) {
1062
	   		return false;
1063
		} else {
1064
			if ( self::is_opera_mini() || self::is_opera_mobile() || self::is_firefox_mobile() )
1065
	   			return false;
1066
	   		else
1067
	   			return true;
1068
		}
1069
	}
1070
1071
1072
	/*
@@ 1094-1108 (lines=15) @@
1091
     * Detects if the current browser is the Native Android browser.
1092
     * @return boolean true if the browser is Android otherwise false
1093
     */
1094
	static function is_android() {
1095
		if ( empty( $_SERVER['HTTP_USER_AGENT'] ) )
1096
			return false;
1097
1098
		$agent = strtolower( $_SERVER['HTTP_USER_AGENT'] );
1099
		$pos_android = strpos( $agent, 'android' );
1100
		if ( $pos_android !== false ) {
1101
			if ( self::is_opera_mini() || self::is_opera_mobile() || self::is_firefox_mobile() )
1102
	   			return false;
1103
	   		else
1104
	   			return true;
1105
		}
1106
		else
1107
			return false;
1108
	}
1109
1110
1111
	/**
@@ 1245-1261 (lines=17) @@
1242
	 is_blackbeberry() can be used to check the User Agent for a blackberry device
1243
	 Note that opera mini on BB matches this rule.
1244
	 */
1245
	static function is_blackbeberry() {
1246
1247
		if ( empty( $_SERVER['HTTP_USER_AGENT'] ) )
1248
			return false;
1249
1250
		$agent = strtolower( $_SERVER['HTTP_USER_AGENT'] );
1251
1252
		$pos_blackberry = strpos( $agent, 'blackberry' );
1253
		if ( $pos_blackberry !== false ) {
1254
			if ( self::is_opera_mini() || self::is_opera_mobile() || self::is_firefox_mobile() )
1255
				return false;
1256
			else
1257
				return true;
1258
		} else {
1259
			return false;
1260
		}
1261
	}
1262
1263
	/*
1264
	 is_blackberry_10() can be used to check the User Agent for a BlackBerry 10 device.