Code Duplication    Length = 15-17 lines in 5 locations

packages/mobile/src/class-mobile.php 5 locations

@@ 903-917 (lines=15) @@
900
	 * Detects if the current browser is a Windows Phone 7 device.
901
	 * ex: Mozilla/4.0 (compatible; MSIE 7.0; Windows Phone OS 7.0; Trident/3.1; IEMobile/7.0; LG; GW910)
902
	 */
903
	static function is_WindowsPhone7() {
904
		if ( empty( $_SERVER['HTTP_USER_AGENT'] ) ) {
905
			return false;
906
		}
907
908
		$ua = strtolower( $_SERVER['HTTP_USER_AGENT'] );
909
910
		if ( false === strpos( $ua, 'windows phone os 7' ) ) {
911
			return false;
912
		} else {
913
			if ( self::is_opera_mini() || self::is_opera_mobile() || self::is_firefox_mobile() ) {
914
				return false;
915
			} else {
916
				return true;
917
			}
918
		}
919
	}
920
@@ 946-960 (lines=15) @@
943
	 * 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
944
	 *
945
	 */
946
	static function is_PalmWebOS() {
947
		if ( empty( $_SERVER['HTTP_USER_AGENT'] ) ) {
948
			return false;
949
		}
950
951
		$ua = strtolower( $_SERVER['HTTP_USER_AGENT'] );
952
953
		if ( false === strpos( $ua, 'webos' ) ) {
954
			return false;
955
		} else {
956
			if ( self::is_opera_mini() || self::is_opera_mobile() || self::is_firefox_mobile() ) {
957
				return false;
958
			} else {
959
				return true;
960
			}
961
		}
962
	}
963
@@ 1134-1149 (lines=16) @@
1131
	/*
1132
	 * Detects if the current UA is a MeeGo device (Nokia Smartphone).
1133
	 */
1134
	static function is_MeeGo() {
1135
1136
		if ( empty( $_SERVER['HTTP_USER_AGENT'] ) ) {
1137
			return false;
1138
		}
1139
1140
		$ua = strtolower( $_SERVER['HTTP_USER_AGENT'] );
1141
1142
		if ( false === strpos( $ua, 'meego' ) ) {
1143
			return false;
1144
		} else {
1145
			if ( self::is_opera_mini() || self::is_opera_mobile() || self::is_firefox_mobile() ) {
1146
				return false;
1147
			} else {
1148
				return true;
1149
			}
1150
		}
1151
	}
1152
@@ 1179-1193 (lines=15) @@
1176
	 *
1177
	 * @return boolean true if the browser is Android otherwise false
1178
	 */
1179
	static function is_android() {
1180
		if ( empty( $_SERVER['HTTP_USER_AGENT'] ) ) {
1181
			return false;
1182
		}
1183
1184
		$agent       = strtolower( $_SERVER['HTTP_USER_AGENT'] );
1185
		$pos_android = strpos( $agent, 'android' );
1186
		if ( $pos_android !== false ) {
1187
			if ( self::is_opera_mini() || self::is_opera_mobile() || self::is_firefox_mobile() ) {
1188
				return false;
1189
			} else {
1190
				return true;
1191
			}
1192
		} else {
1193
			return false;
1194
		}
1195
	}
1196
@@ 1345-1361 (lines=17) @@
1342
	 is_blackbeberry() can be used to check the User Agent for a blackberry device
1343
	 Note that opera mini on BB matches this rule.
1344
	 */
1345
	static function is_blackbeberry() {
1346
1347
		if ( empty( $_SERVER['HTTP_USER_AGENT'] ) ) {
1348
			return false;
1349
		}
1350
1351
		$agent = strtolower( $_SERVER['HTTP_USER_AGENT'] );
1352
1353
		$pos_blackberry = strpos( $agent, 'blackberry' );
1354
		if ( $pos_blackberry !== false ) {
1355
			if ( self::is_opera_mini() || self::is_opera_mobile() || self::is_firefox_mobile() ) {
1356
				return false;
1357
			} else {
1358
				return true;
1359
			}
1360
		} else {
1361
			return false;
1362
		}
1363
	}
1364