Code Duplication    Length = 15-15 lines in 3 locations

projects/plugins/vaultpress/class.vaultpress-hotfixes.php 3 locations

@@ 1016-1030 (lines=15) @@
1013
1014
				case 2 : # attribute value, a URL after href= for instance
1015
1016
					if (preg_match('%^"([^"]*)"(\s+|/?$)%', $attr, $match))
1017
						# "value"
1018
						{
1019
						$thisval = $match[1];
1020
						if ( in_array(strtolower($attrname), $uris) )
1021
							$thisval = VaultPress_kses::wp_kses_bad_protocol($thisval, $allowed_protocols);
1022
1023
						if(false === array_key_exists($attrname, $attrarr)) {
1024
							$attrarr[$attrname] = array ('name' => $attrname, 'value' => $thisval, 'whole' => "$attrname=\"$thisval\"", 'vless' => 'n');
1025
						}
1026
						$working = 1;
1027
						$mode = 0;
1028
						$attr = preg_replace('/^"[^"]*"(\s+|$)/', '', $attr);
1029
						break;
1030
					}
1031
1032
					if (preg_match("%^'([^']*)'(\s+|/?$)%", $attr, $match))
1033
						# 'value'
@@ 1032-1046 (lines=15) @@
1029
						break;
1030
					}
1031
1032
					if (preg_match("%^'([^']*)'(\s+|/?$)%", $attr, $match))
1033
						# 'value'
1034
						{
1035
						$thisval = $match[1];
1036
						if ( in_array(strtolower($attrname), $uris) )
1037
							$thisval = VaultPress_kses::wp_kses_bad_protocol($thisval, $allowed_protocols);
1038
1039
						if(false === array_key_exists($attrname, $attrarr)) {
1040
							$attrarr[$attrname] = array ('name' => $attrname, 'value' => $thisval, 'whole' => "$attrname='$thisval'", 'vless' => 'n');
1041
						}
1042
						$working = 1;
1043
						$mode = 0;
1044
						$attr = preg_replace("/^'[^']*'(\s+|$)/", '', $attr);
1045
						break;
1046
					}
1047
1048
					if (preg_match("%^([^\s\"']+)(\s+|/?$)%", $attr, $match))
1049
						# value
@@ 1048-1062 (lines=15) @@
1045
						break;
1046
					}
1047
1048
					if (preg_match("%^([^\s\"']+)(\s+|/?$)%", $attr, $match))
1049
						# value
1050
						{
1051
						$thisval = $match[1];
1052
						if ( in_array(strtolower($attrname), $uris) )
1053
							$thisval = VaultPress_kses::wp_kses_bad_protocol($thisval, $allowed_protocols);
1054
1055
						if(false === array_key_exists($attrname, $attrarr)) {
1056
							$attrarr[$attrname] = array ('name' => $attrname, 'value' => $thisval, 'whole' => "$attrname=\"$thisval\"", 'vless' => 'n');
1057
						}
1058
						# We add quotes to conform to W3C's HTML spec.
1059
						$working = 1;
1060
						$mode = 0;
1061
						$attr = preg_replace("%^[^\s\"']+(\s+|$)%", '', $attr);
1062
					}
1063
1064
					break;
1065
			} # switch