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:
parent
cb58bf22be
commit
dcdfeb9956
2 changed files with 3 additions and 13 deletions
|
@ -286,18 +286,8 @@ class customcert_element_base {
|
||||||
return true;
|
return true;
|
||||||
} else if (in_array(strtolower($colour), $colournames)) {
|
} else if (in_array(strtolower($colour), $colournames)) {
|
||||||
return true;
|
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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -48,7 +48,7 @@ $string['height'] = 'Height';
|
||||||
$string['heightnotvalid'] = 'The height has to be a valid number.';
|
$string['heightnotvalid'] = 'The height has to be a valid number.';
|
||||||
$string['height_help'] = 'This is the height of the certificate PDF in mm. For reference an A4 piece of paper is 297mm high and a letter is 279mm high.';
|
$string['height_help'] = 'This is the height of the certificate PDF in mm. For reference an A4 piece of paper is 297mm high and a letter is 279mm high.';
|
||||||
$string['intro'] = 'Introduction';
|
$string['intro'] = 'Introduction';
|
||||||
$string['invalidcolour'] = 'Invalid colour chosen.';
|
$string['invalidcolour'] = 'Invalid colour chosen, please enter a valid HTML colour name, or a six-digit, or three-digit hexadecimal colour.';
|
||||||
$string['invalidposition'] = 'Please select a positive number for position {$a}.';
|
$string['invalidposition'] = 'Please select a positive number for position {$a}.';
|
||||||
$string['issued'] = 'Issued';
|
$string['issued'] = 'Issued';
|
||||||
$string['landscape'] = 'Landscape';
|
$string['landscape'] = 'Landscape';
|
||||||
|
|
Loading…
Reference in a new issue