Merge branch 'w38_MDL-29504_m22_plugincallback' of git://github.com/skodak/moodle
This commit is contained in:
@@ -37,7 +37,7 @@ defined('MOODLE_INTERNAL') || die();
|
||||
* }
|
||||
* @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');
|
||||
}
|
||||
|
||||
+16
-1
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user