| 29 |
} |
} |
| 30 |
|
|
| 31 |
// get all blocks assigned to the region thats assigned to this blockbar |
// get all blocks assigned to the region thats assigned to this blockbar |
| 32 |
$blocks = block_list(variable_get('blockbar_region' . $block_num, NULL)); |
$blocks = blockbar_block_list(variable_get('blockbar_region' . $block_num, NULL)); |
| 33 |
|
|
| 34 |
//the following <span> tag is needed to control javascript behavior |
//the following <span> tag is needed to control javascript behavior |
| 35 |
$content = '<span id="block_bar_num" class="' . variable_get('blockbar_number_of_blocks', 0) . '">'; |
$content = '<span id="block_bar_num" class="' . variable_get('blockbar_number_of_blocks', 0) . '">'; |
| 165 |
return system_region_list($theme_key); |
return system_region_list($theme_key); |
| 166 |
|
|
| 167 |
} |
} |
| 168 |
|
|
| 169 |
|
function blockbar_block_list($region){ |
| 170 |
|
// copy of block_list function in block.module with minor changes |
| 171 |
|
global $user, $theme_key; |
| 172 |
|
$blocks = array(); |
| 173 |
|
|
| 174 |
|
if (!count($blocks)) { |
| 175 |
|
$result = db_query("SELECT * FROM {blocks} WHERE theme = '%s' AND status = 1 AND region = '%s' ORDER BY region, weight, module", $theme_key, $region); |
| 176 |
|
while ($block = db_fetch_object($result)) { |
| 177 |
|
if (!isset($blocks[$block->region])) { |
| 178 |
|
$blocks[$block->region] = array(); |
| 179 |
|
} |
| 180 |
|
// Use the user's block visibility setting, if necessary |
| 181 |
|
if ($block->custom != 0) { |
| 182 |
|
if ($user->uid && isset($user->block[$block->module][$block->delta])) { |
| 183 |
|
$enabled = $user->block[$block->module][$block->delta]; |
| 184 |
|
} |
| 185 |
|
else { |
| 186 |
|
$enabled = ($block->custom == 1); |
| 187 |
|
} |
| 188 |
|
} |
| 189 |
|
else { |
| 190 |
|
$enabled = TRUE; |
| 191 |
|
} |
| 192 |
|
|
| 193 |
|
// Match path if necessary |
| 194 |
|
if ($block->pages) { |
| 195 |
|
if ($block->visibility < 2) { |
| 196 |
|
$path = drupal_get_path_alias($_GET['q']); |
| 197 |
|
$regexp = '/^('. preg_replace(array('/(\r\n?|\n)/', '/\\\\\*/', '/(^|\|)\\\\<front\\\\>($|\|)/'), array('|', '.*', '\1'. preg_quote(variable_get('site_frontpage', 'node'), '/') .'\2'), preg_quote($block->pages, '/')) .')$/'; |
| 198 |
|
$page_match = !($block->visibility xor preg_match($regexp, $path)); |
| 199 |
|
} |
| 200 |
|
else { |
| 201 |
|
$page_match = drupal_eval($block->pages); |
| 202 |
|
} |
| 203 |
|
} |
| 204 |
|
else { |
| 205 |
|
$page_match = TRUE; |
| 206 |
|
} |
| 207 |
|
|
| 208 |
|
if ($enabled && $page_match) { |
| 209 |
|
// Check the current throttle status and see if block should be displayed |
| 210 |
|
// based on server load. |
| 211 |
|
if (!($block->throttle && (module_invoke('throttle', 'status') > 0))) { |
| 212 |
|
$array = module_invoke($block->module, 'block', 'view', $block->delta); |
| 213 |
|
if (isset($array) && is_array($array)) { |
| 214 |
|
foreach ($array as $k => $v) { |
| 215 |
|
$block->$k = $v; |
| 216 |
|
} |
| 217 |
|
} |
| 218 |
|
} |
| 219 |
|
if (isset($block->content) && $block->content) { |
| 220 |
|
$blocks[$block->region]["{$block->module}_{$block->delta}"] = $block; |
| 221 |
|
} |
| 222 |
|
} |
| 223 |
|
} |
| 224 |
|
} |
| 225 |
|
// Create an empty array if there were no entries |
| 226 |
|
if (!isset($blocks[$region])) { |
| 227 |
|
$blocks[$region] = array(); |
| 228 |
|
} |
| 229 |
|
return $blocks[$region]; |
| 230 |
|
} |
| 231 |
?> |
?> |