diff --git a/blocks/comments/lib.php b/blocks/comments/lib.php index 4e2d828d39ad0..3f10939bb3dc8 100644 --- a/blocks/comments/lib.php +++ b/blocks/comments/lib.php @@ -37,7 +37,7 @@ * } * @return boolean */ -function comments_comment_validate($comment_param) { +function block_comments_comment_validate($comment_param) { if ($comment_param->commentarea != 'page_comments') { throw new comment_exception('invalidcommentarea'); } @@ -53,7 +53,7 @@ function comments_comment_validate($comment_param) { * @param stdClass $args * @return array */ -function comments_comment_permissions($args) { +function block_comments_comment_permissions($args) { return array('post'=>true, 'view'=>true); } @@ -64,7 +64,7 @@ function comments_comment_permissions($args) { * @param stdClass $args * @return boolean */ -function comments_comment_display($comments, $args) { +function block_comments_comment_display($comments, $args) { if ($args->commentarea != 'page_comments') { throw new comment_exception('invalidcommentarea'); } diff --git a/lib/moodlelib.php b/lib/moodlelib.php index e2cde0b755d4e..da0ce385b98f3 100644 --- a/lib/moodlelib.php +++ b/lib/moodlelib.php @@ -7552,12 +7552,20 @@ function get_list_of_plugins($directory='mod', $exclude='', $basedir='') { * @return mixed */ function plugin_callback($type, $name, $feature, $action, $options = null, $default=null) { + global $CFG; + $component = clean_param($type . '_' . $name, PARAM_COMPONENT); if (empty($component)) { throw coding_exception('Invalid component used in plugin_callback():' . $type . '_' . $name); } - $function = $name.'_'.$feature.'_'.$action; + list($type, $name) = normalize_component($component); + $component = $type . '_' . $name; + + $function = null; + + $function = $component.'_'.$feature.'_'.$action; + $oldfunction = $name.'_'.$feature.'_'.$action; $dir = get_component_directory($component); if (empty($dir)) { @@ -7569,6 +7577,13 @@ function plugin_callback($type, $name, $feature, $action, $options = null, $defa require_once($dir.'/lib.php'); } + if (!function_exists($function) and function_exists($oldfunction)) { + if ($type !== 'mod' and $type !== 'core') { + debugging("Please use new function name $function instead of legacy $oldfunction"); + } + $function = $oldfunction; + } + if (function_exists($function)) { // Function exists, so just return function result $ret = call_user_func_array($function, (array)$options);