function simple_adsense_settings_validate in Simple AdSense 7
Form validate.
File
- ./
simple_adsense.admin.inc, line 92 - Configuration form.
Code
function simple_adsense_settings_validate($form, &$form_state) {
for ($i = 1; $i <= $form_state['num_slots']; $i++) {
$slot = $form_state['values']['slot'][$i];
if (!preg_match('/^\\d+$/', $slot)) {
form_set_error("slot][{$i}", t("AD Unit ID @i must be numbers", array(
'@i' => $i,
)));
}
}
$client = $form_state['values']['client'];
if (!preg_match('/^pub-\\d+$/', $client)) {
form_set_error("client", t('Publisher ID must be like this: pub-9513614146655499'));
}
}