$thisformat = '^'.str_replace('*', '[^-]*', $format).'.*$';Located in blocks_name_allowed_in_format($name, $pageformat) (lib/blocklib.php near §177 - sorry guys, but have patched blocklib.php so line number may be wrong...) No in-code documentation here. What is the heuristics used here for format matching ?
My immediate need is to change control over applicable_formats in all course formats as a global but essential cleanup customization. I would suggest this format checking might have a local hook entry to allow customization to take over applicable formats whitout having to patch ALL blocks !! This is specially usefull when adding alternate customized page formats that will need a reconsideration of those settings.
Something as :
function blocks_name_allowed_in_format($name, $pageformat) {
global $CFG
$accept = NULL;
$depth = -1;
if (file_exists($CFG->dirroot.'/local/lib.php')){
require_once ($CFG->dirroot.'/local/lib.php');
if (function_exists('local_get_format_mapping')){
$formats = local_get_format_mapping($name);
}
}
if (!$formats){
$formats = block_method_result($name, 'applicable_formats');
}
if ($format){
foreach($formats as $format => $allowed) {
$thisformat = '^'.str_replace('*', '[^-]*', $format).'.*$';
if(ereg($thisformat, $pageformat)) {
if(($scount = substr_count($format, '-')) > $depth) {
$depth = $scount;
$accept = $allowed;
}
}
}
}
...
Cheers...