mirror of
https://github.com/moodle/moodle.git
synced 2025-04-21 00:12:56 +02:00
MDL-62233 portfolio: check caller parent class
This commit is contained in:
parent
ce3f804683
commit
2d83a76ed7
@ -117,9 +117,9 @@ class portfolio_exporter {
|
||||
* @param portfolio_caller_base $caller portfolio caller (passed by reference)
|
||||
* @param string $callercomponent the name of the callercomponent
|
||||
*/
|
||||
public function __construct(&$instance, &$caller, $callercomponent) {
|
||||
$this->instance =& $instance;
|
||||
$this->caller =& $caller;
|
||||
public function __construct($instance, portfolio_caller_base $caller, $callercomponent) {
|
||||
$this->instance = $instance;
|
||||
$this->caller = $caller;
|
||||
if ($instance) {
|
||||
$this->instancefile = 'portfolio/' . $instance->get('plugin') . '/lib.php';
|
||||
$this->instance->set('exporter', $this);
|
||||
|
@ -1358,8 +1358,11 @@ function portfolio_include_callback_file($component, $class = null) {
|
||||
throw new portfolio_button_exception('nocallbackfile', 'portfolio', '', $component);
|
||||
}
|
||||
|
||||
if (!is_null($class) && !class_exists($class)) {
|
||||
throw new portfolio_button_exception('nocallbackclass', 'portfolio', '', $class);
|
||||
if (!is_null($class)) {
|
||||
// If class is specified, check it exists and extends portfolio_caller_base.
|
||||
if (!class_exists($class) || !is_subclass_of($class, 'portfolio_caller_base')) {
|
||||
throw new portfolio_button_exception('nocallbackclass', 'portfolio', '', $class);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user