Changed the validation of the colour picker to only allow HTML colours or hexadecimal values

The reason for this is because the call to TCPDF_COLORS::convertHTMLColorToDec only allows these values.
This commit is contained in:
Mark Nelson 2013-04-11 19:25:55 +08:00
parent cb58bf22be
commit dcdfeb9956
2 changed files with 3 additions and 13 deletions

View file

@ -286,18 +286,8 @@ class customcert_element_base {
return true;
} else if (in_array(strtolower($colour), $colournames)) {
return true;
} else if (preg_match('/rgb\(\d{0,3}%?\, ?\d{0,3}%?, ?\d{0,3}%?\)/i', $colour)) {
return true;
} else if (preg_match('/rgba\(\d{0,3}%?\, ?\d{0,3}%?, ?\d{0,3}%?\, ?\d(\.\d)?\)/i', $colour)) {
return true;
} else if (preg_match('/hsl\(\d{0,3}\, ?\d{0,3}%, ?\d{0,3}%\)/i', $colour)) {
return true;
} else if (preg_match('/hsla\(\d{0,3}\, ?\d{0,3}%,\d{0,3}%\, ?\d(\.\d)?\)/i', $colour)) {
return true;
} else if (($colour == 'transparent') || ($colour == 'currentColor') || ($colour == 'inherit')) {
return true;
} else {
return false;
}
return false;
}
}