Replace self::func() with <helper_name>::func() for all public APIs

and constants to make overloading easier.  Fixes #1510.
This commit is contained in:
Bharat Mediratta
2010-11-28 11:27:25 -08:00
parent 76b6daefaa
commit eb010554ff
15 changed files with 92 additions and 92 deletions
+10 -10
View File
@@ -27,10 +27,10 @@ class block_manager_Core {
}
static function add($location, $module_name, $block_id) {
$blocks = self::get_active($location);
$blocks = block_manager::get_active($location);
$blocks[rand()] = array($module_name, $block_id);
self::set_active($location, $blocks);
block_manager::set_active($location, $blocks);
}
static function activate_blocks($module_name) {
@@ -38,25 +38,25 @@ class block_manager_Core {
if (method_exists($block_class, "get_site_list")) {
$blocks = call_user_func(array($block_class, "get_site_list"));
foreach (array_keys($blocks) as $block_id) {
self::add("site_sidebar", $module_name, $block_id);
block_manager::add("site_sidebar", $module_name, $block_id);
}
}
}
static function remove($location, $block_id) {
$blocks = self::get_active($location);
$blocks = block_manager::get_active($location);
unset($blocks[$block_id]);
self::set_active($location, $blocks);
block_manager::set_active($location, $blocks);
}
static function remove_blocks_for_module($location, $module_name) {
$blocks = self::get_active($location);
$blocks = block_manager::get_active($location);
foreach ($blocks as $key => $block) {
if ($block[0] == $module_name) {
unset($blocks[$key]);
}
}
self::set_active($location, $blocks);
block_manager::set_active($location, $blocks);
}
static function deactivate_blocks($module_name) {
@@ -64,14 +64,14 @@ class block_manager_Core {
if (method_exists($block_class, "get_site_list")) {
$blocks = call_user_func(array($block_class, "get_site_list"));
foreach (array_keys($blocks) as $block_id) {
self::remove_blocks_for_module("site_sidebar", $module_name);
block_manager::remove_blocks_for_module("site_sidebar", $module_name);
}
}
if (method_exists($block_class, "get_admin_list")) {
$blocks = call_user_func(array($block_class, "get_admin_list"));
foreach (array("dashboard_sidebar", "dashboard_center") as $location) {
self::remove_blocks_for_module($location, $module_name);
block_manager::remove_blocks_for_module($location, $module_name);
}
}
}
@@ -99,7 +99,7 @@ class block_manager_Core {
}
static function get_html($location, $theme=null) {
$active = self::get_active($location);
$active = block_manager::get_active($location);
$result = "";
foreach ($active as $id => $desc) {
if (method_exists("$desc[0]_block", "get")) {