On second thought, moving the cache retrieval out of the loop should eliminate

up to ten or so function calls per page view. I don't know how expensive they
are, but let's take what we can.
This commit is contained in:
defacer
2005-04-30 03:18:02 +00:00
parent 9b68732055
commit ff6191b742
+6 -3
View File
@@ -279,15 +279,18 @@ function blocks_preferred_width(&$instances) {
if(empty($instances) || !is_array($instances)) {
return 0;
}
$blocks = blocks_get_record();
foreach($instances as $instance) {
if(!$instance->visible) {
continue;
}
$block = blocks_get_record($instance->blockid);
if(!$block->visible) {
if(!$blocks[$instance->blockid]->visible) {
continue;
}
$pref = block_method_result($block->name, 'preferred_width');
$pref = block_method_result($blocks[$instance->blockid]->name, 'preferred_width');
if($pref === NULL) {
continue;
}