To simply check if all letters aren't caps, try:
if ($text != strtoupper($text)
{
// Valid
}
else
{
// Invalid because all letters are caps
}
To specify a certain maximum percentage of capital letters is a little trickier. Off the top of my head it would be something like:
$maxPercentageCaps = 0.80;
$length = strlen($text);
$countCaps = 0;
for ($i = 0; $i < $length; $i++)
{
// For each letter, check if it is capital and increment # of capital letters
// if it is.
if ($text[$i] == strtoupper($text[$i]) $countCaps++;
}
$capsPercentage = $countCaps / $length;
if ($capsPercentage <= $maxPercentageCaps)
{
// Valid entry
}
You could also add code to deal with numbers in the text, etc., but that should get you started.