| 17 | | $function['sidebar:legacy:logpane'][] = $CFG->dirroot . 'mod/display/lib/function_log_on_pane.php'; |
|---|
| 18 | | $function['sidebar:legacy:stats'][] = $CFG->dirroot . 'mod/users/lib/function_number_of_users.php'; |
|---|
| 19 | | $function['sidebar:legacy:friends'][] = $CFG->dirroot . 'mod/friend/lib/profile_friends.php'; |
|---|
| 20 | | $function['sidebar:legacy:blog'][] = $CFG->dirroot . 'mod/blog/lib/weblogs_user_info_menu.php'; |
|---|
| 21 | | $function['sidebar:legacy:communities'][] = $CFG->dirroot . 'mod/community/lib/community_memberships.php'; |
|---|
| 22 | | $function['sidebar:legacy:mycommunities'][] = $CFG->dirroot . 'mod/community/lib/communities_owned.php'; |
|---|
| 23 | | $function['sidebar:legacy:files'][] = $CFG->dirroot . 'mod/file/lib/files_user_info_menu.php'; |
|---|
| | 15 | $PAGE->sidebar_legacy = array(); |
|---|
| | 16 | |
|---|
| | 17 | $PAGE->sidebar_legacy['sidebar-profile'] = 10; |
|---|
| | 18 | $function['sidebar-profile'][] = $CFG->dirroot . 'mod/display/lib/function_log_on_pane.php'; |
|---|
| | 19 | |
|---|
| | 20 | $PAGE->sidebar_legacy['sidebar-stats'] = 50; |
|---|
| | 21 | $function['sidebar-stats'][] = $CFG->dirroot . 'mod/users/lib/function_number_of_users.php'; |
|---|
| | 22 | |
|---|
| | 23 | $PAGE->sidebar_legacy['sidebar-blog'] = 30; |
|---|
| | 24 | $function['sidebar-blog'][] = $CFG->dirroot . 'mod/blog/lib/weblogs_user_info_menu.php'; |
|---|
| | 25 | |
|---|
| | 26 | $PAGE->sidebar_legacy['sidebar-friends'] = 40; |
|---|
| | 27 | $function['sidebar-friends'][] = $CFG->dirroot . 'mod/friend/lib/profile_friends.php'; |
|---|
| | 28 | |
|---|
| | 29 | $PAGE->sidebar_legacy['sidebar-communities'] = 50; |
|---|
| | 30 | $function['sidebar-communities'][] = $CFG->dirroot . 'mod/community/lib/community_memberships.php'; |
|---|
| | 31 | |
|---|
| | 32 | $PAGE->sidebar_legacy['sidebar-mycommunities'] = 60; |
|---|
| | 33 | $function['sidebar-mycommunities'][] = $CFG->dirroot . 'mod/community/lib/communities_owned.php'; |
|---|
| | 34 | |
|---|
| | 35 | $PAGE->sidebar_legacy['sidebar-files'] = 60; |
|---|
| | 36 | $function['sidebar-files'][] = $CFG->dirroot . 'mod/file/lib/files_user_info_menu.php'; |
|---|
| 40 | | sidebar_add(40, 'sidebar-profile', sidebar_legacy_wrap(run('sidebar:legacy:logpane'))); |
|---|
| 41 | | |
|---|
| 42 | | sidebar_add(50, 'sidebar-stats', sidebar_legacy_wrap(run('sidebar:legacy:stats'))); |
|---|
| 43 | | |
|---|
| 44 | | sidebar_add(20, 'sidebar-blog', sidebar_legacy_wrap(run('sidebar:legacy:blog'))); |
|---|
| 45 | | |
|---|
| 46 | | sidebar_add(40, 'sidebar-friends', sidebar_legacy_wrap(run('sidebar:legacy:friends'))); |
|---|
| 47 | | |
|---|
| 48 | | sidebar_add(50, 'sidebar-communities', sidebar_legacy_wrap(run('sidebar:legacy:communities'))); |
|---|
| 49 | | |
|---|
| 50 | | sidebar_add(60, 'sidebar-mycommunities', sidebar_legacy_wrap(run('sidebar:legacy:mycommunities'))); |
|---|
| 51 | | |
|---|
| 52 | | sidebar_add(30, 'sidebar-files', sidebar_legacy_wrap(run('sidebar:legacy:files'))); |
|---|
| 53 | | |
|---|
| 54 | | if (isset($function['sidebar:legacy:category'])) { |
|---|
| 55 | | sidebar_add(25, 'sidebar-blogcats', sidebar_legacy_wrap(run('sidebar:legacy:category'))); |
|---|
| | 57 | if (is_array($PAGE->sidebar_legacy)) { |
|---|
| | 58 | foreach ($PAGE->sidebar_legacy as $key => $weight) { |
|---|
| | 59 | sidebar_add($weight, $key, sidebar_legacy_wrap(run($key))); |
|---|
| | 60 | $runned[] = $function[$key]; |
|---|
| | 61 | //print_object($key); |
|---|
| | 62 | } |
|---|
| 58 | | if (isset($function['sidebar:legacy:vanilla'])) { |
|---|
| 59 | | sidebar_add(25, 'sidebar-vanilla', sidebar_legacy_wrap(run('sidebar:legacy:vanilla'))); |
|---|
| | 65 | // filter legacy sidebar code already included |
|---|
| | 66 | if (isset($function['display:sidebar'])) { |
|---|
| | 67 | foreach ($function['display:sidebar'] as $n => $script) { |
|---|
| | 68 | if (!in_arrayr($script, $runned)) { |
|---|
| | 69 | // temp function() |
|---|
| | 70 | $function["sidebar:$n"][] = $script; |
|---|
| | 71 | // include as generic block |
|---|
| | 72 | sidebar_add(99, "sidebar-$n", sidebar_legacy_wrap(run("sidebar:$n"))); |
|---|
| | 73 | // unset |
|---|
| | 74 | unset($function["sidebar:$n"]); |
|---|
| | 75 | } |
|---|
| | 76 | } |
|---|
| | 77 | //print_object($runned); |
|---|
| 158 | | return preg_replace("#^\s*(<li|<li\s+id=\"[a-zA-Z0-9-_]+\"\s*)>(.*)</li>\s*$#si", "\${2}", $body); |
|---|
| | 179 | return preg_replace("#^\s*(<li|<li\s+[\"\'\w-_\.\s\=]*\s*)>(.*)</li>\s*$#si", "\${2}", $body); |
|---|
| | 180 | } |
|---|
| | 181 | |
|---|
| | 182 | if (!function_exists('in_arrayr')) { |
|---|
| | 183 | function in_arrayr($needle, $haystack) { |
|---|
| | 184 | foreach ($haystack as $v) { |
|---|
| | 185 | if ($needle == $v) { |
|---|
| | 186 | return true; |
|---|
| | 187 | } elseif (is_array($v)) { |
|---|
| | 188 | if (in_arrayr($needle, $v) === true) { |
|---|
| | 189 | return true; |
|---|
| | 190 | } |
|---|
| | 191 | } |
|---|
| | 192 | } |
|---|
| | 193 | |
|---|
| | 194 | return false; |
|---|
| | 195 | } |
|---|