$formats = block_method_result($name, 'applicable_formats');
$accept = NULL;
$depth = -1;
- foreach($formats as $format => $allowed) {
- $thisformat = '^'.str_replace('*', '[^-]*', $format).'.*$';
- if(ereg($thisformat, $pageformat)) {
- if(($scount = substr_count($format, '-')) > $depth) {
- $depth = $scount;
- $accept = $allowed;
- }
+ if (isset($formats)) {
+ foreach($formats as $format => $allowed) {
+ $thisformat = '^'.str_replace('*', '[^-]*', $format).'.*$';
+ if(ereg($thisformat, $pageformat)) {
+ if(($scount = substr_count($format, '-')) > $depth) {
+ $depth = $scount;
+ $accept = $allowed;
+ }
+ }
}
}
if($accept === NULL) {