1
0
mirror of https://github.com/PlagiarismCheck/moodle-plagiarism_pchkorg.git synced 2024-12-22 04:10:07 +00:00

Use long syntax for arrays, remove comma in last argument

This commit is contained in:
Jane Adelmann 2022-11-16 16:31:42 +02:00
parent 987a4b8674
commit 99b58f8e27
No known key found for this signature in database
GPG Key ID: 4CCF39DF30B8AF72
5 changed files with 22 additions and 22 deletions

View File

@ -34,19 +34,19 @@ class backup_plagiarism_pchkorg_plugin extends backup_plagiarism_plugin {
$plugin->add_child($pluginwrapper); $plugin->add_child($pluginwrapper);
$configs = new backup_nested_element('pchkorg_activities_configs'); $configs = new backup_nested_element('pchkorg_activities_configs');
$config = new backup_nested_element('pchkorg_activities_config', ['id'], ['name', 'value']); $config = new backup_nested_element('pchkorg_activities_config', array('id'), array('name', 'value'));
$pluginwrapper->add_child($configs); $pluginwrapper->add_child($configs);
$configs->add_child($config); $configs->add_child($config);
$config->set_source_table('plagiarism_pchkorg_config', ['cm' => backup::VAR_PARENTID]); $config->set_source_table('plagiarism_pchkorg_config', array('cm' => backup::VAR_PARENTID));
// Now information about files to module. // Now information about files to module.
$files = new backup_nested_element('pchkorg_files'); $files = new backup_nested_element('pchkorg_files');
$file = new backup_nested_element('pchkorg_file', ['id'], [ $file = new backup_nested_element('pchkorg_file', array('id'), array(
'cm', 'fileid', 'userid', 'cm', 'fileid', 'userid',
'state', 'score', 'created_at', 'state', 'score', 'created_at',
'textid', 'reportid', 'signature', 'textid', 'reportid', 'signature',
'attempt', 'itemid' 'attempt', 'itemid'
]); ));
$pluginwrapper->add_child($files); $pluginwrapper->add_child($files);
$files->add_child($file); $files->add_child($file);
@ -54,7 +54,7 @@ class backup_plagiarism_pchkorg_plugin extends backup_plagiarism_plugin {
// To know if we are including userinfo. // To know if we are including userinfo.
$userinfo = $this->get_setting_value('userinfo'); $userinfo = $this->get_setting_value('userinfo');
if ($userinfo) { if ($userinfo) {
$file->set_source_table('plagiarism_pchkorg_files', ['cm' => backup::VAR_PARENTID]); $file->set_source_table('plagiarism_pchkorg_files', array('cm' => backup::VAR_PARENTID));
} }
return $plugin; return $plugin;
@ -71,12 +71,12 @@ class backup_plagiarism_pchkorg_plugin extends backup_plagiarism_plugin {
$plugin->add_child($pluginwrapper); $plugin->add_child($pluginwrapper);
$configs = new backup_nested_element('pchkorg_configs'); $configs = new backup_nested_element('pchkorg_configs');
$config = new backup_nested_element('pchkorg_config', ['id'], ['plugin', 'name', 'value']); $config = new backup_nested_element('pchkorg_config', array('id'), array('plugin', 'name', 'value'));
$pluginwrapper->add_child($configs); $pluginwrapper->add_child($configs);
$configs->add_child($config); $configs->add_child($config);
$config->set_source_table('config_plugins', [ $config->set_source_table('config_plugins', array(
'name' => backup::VAR_PARENTID, 'plugin' => backup_helper::is_sqlparam('plagiarism'), 'name' => backup::VAR_PARENTID, 'plugin' => backup_helper::is_sqlparam('plagiarism'),
]); ));
return $plugin; return $plugin;
} }

View File

@ -47,7 +47,7 @@ class restore_plagiarism_pchkorg_plugin extends restore_plagiarism_plugin {
protected function define_course_plugin_structure() { protected function define_course_plugin_structure() {
$paths = []; $paths = array();
$elename = 'pchkorg_config'; $elename = 'pchkorg_config';
$elepath = $this->get_pathfor('/pchkorg_configs/pchkorg_config'); $elepath = $this->get_pathfor('/pchkorg_configs/pchkorg_config');
@ -59,7 +59,7 @@ class restore_plagiarism_pchkorg_plugin extends restore_plagiarism_plugin {
protected function define_module_plugin_structure() { protected function define_module_plugin_structure() {
$paths = []; $paths = array();
$elename = 'pchkorgconfigmod'; $elename = 'pchkorgconfigmod';
$elepath = $this->get_pathfor('/pchkorg_activities_configs/pchkorg_activities_config'); $elepath = $this->get_pathfor('/pchkorg_activities_configs/pchkorg_activities_config');

View File

@ -177,7 +177,7 @@ class plagiarism_pchkorg_api_provider {
$content, $content,
$mime, $mime,
$filename, $filename,
$filters, $filters
), ),
array( array(
'CURLOPT_RETURNTRANSFER' => true, 'CURLOPT_RETURNTRANSFER' => true,
@ -299,7 +299,7 @@ class plagiarism_pchkorg_api_provider {
$content, $content,
$mime, $mime,
$filename, $filename,
$filters, $filters
), ),
array( array(
'CURLOPT_RETURNTRANSFER' => true, 'CURLOPT_RETURNTRANSFER' => true,

16
lib.php
View File

@ -66,7 +66,7 @@ function plagiarism_pchkorg_coursemodule_standard_elements($formwrapper, $mform)
$defaultcmid = null; $defaultcmid = null;
$cm = optional_param('update', $defaultcmid, PARAM_INT); $cm = optional_param('update', $defaultcmid, PARAM_INT);
$minpercent = $pchkorgconfigmodel->get_system_config('pchkorg_min_percent'); $minpercent = $pchkorgconfigmodel->get_system_config('pchkorg_min_percent');
$exportedvalues = $mform->exportValues([]); $exportedvalues = $mform->exportValues(array());
if (!is_array($exportedvalues)) { if (!is_array($exportedvalues)) {
$exportedvalues = array(); $exportedvalues = array();
} }
@ -324,7 +324,7 @@ class plagiarism_plugin_pchkorg extends plagiarism_plugin {
); );
} }
$roleDatas = get_user_roles($context, $USER->id, true); $roleDatas = get_user_roles($context, $USER->id, true);
$roles = []; $roles = array();
foreach ($roleDatas as $rolesData) { foreach ($roleDatas as $rolesData) {
$roles[] = strtolower($rolesData->shortname); $roles[] = strtolower($rolesData->shortname);
} }
@ -738,7 +738,7 @@ display: inline-block;"
if ($ismemberresponse->is_auto_registration_enabled) { if ($ismemberresponse->is_auto_registration_enabled) {
$name = $USER->firstname . ' ' . $USER->lastname; $name = $USER->firstname . ' ' . $USER->lastname;
$roleDatas = get_user_roles($context, $USER->id, true); $roleDatas = get_user_roles($context, $USER->id, true);
$roles = []; $roles = array();
foreach ($roleDatas as $rolesData) { foreach ($roleDatas as $rolesData) {
$roles[] = strtolower($rolesData->shortname); $roles[] = strtolower($rolesData->shortname);
} }
@ -1099,7 +1099,7 @@ display: inline-block;"
} else { } else {
$minpercent = $systemminpercent; $minpercent = $systemminpercent;
} }
$filters = [ $filters = array(
'include_references' => $pchkorgconfigmodel->get_filter_for_module( 'include_references' => $pchkorgconfigmodel->get_filter_for_module(
$cm->id, $cm->id,
'pchkorg_include_referenced' 'pchkorg_include_referenced'
@ -1112,7 +1112,7 @@ display: inline-block;"
$cm->id, $cm->id,
'pchkorg_exclude_self_plagiarism' 'pchkorg_exclude_self_plagiarism'
), ),
]; );
if ($minpercent) { if ($minpercent) {
$filters['source_min_percent'] = $minpercent; $filters['source_min_percent'] = $minpercent;
} }
@ -1153,7 +1153,7 @@ display: inline-block;"
html_to_text($content, 75, false), html_to_text($content, 75, false),
'plain/text', 'plain/text',
sprintf('%s-quiz.txt', $filedb->itemid), sprintf('%s-quiz.txt', $filedb->itemid),
$filters, $filters
); );
break; break;
} }
@ -1222,7 +1222,7 @@ display: inline-block;"
html_to_text($content, 75, false), html_to_text($content, 75, false),
'plain/text', 'plain/text',
sprintf('%s-quiz.txt', $filedb->itemid), sprintf('%s-quiz.txt', $filedb->itemid),
$filters, $filters
); );
} }
} }
@ -1280,7 +1280,7 @@ display: inline-block;"
html_to_text($content, 75, false), html_to_text($content, 75, false),
'plain/text', 'plain/text',
sprintf('%s-submussion.txt', $moodletextsubmission->id), sprintf('%s-submussion.txt', $moodletextsubmission->id),
$filters, $filters
); );
} }
} else { } else {

View File

@ -26,9 +26,9 @@ defined('MOODLE_INTERNAL') || die();
if (!isset($plugin)) { if (!isset($plugin)) {
$plugin = new stdClass(); $plugin = new stdClass();
} }
$plugin->version = 2022110716; $plugin->version = 2022111616;
$plugin->requires = 2020061501; // Requires Moodle 3.9 . $plugin->requires = 2020061501; // Requires Moodle 3.9 .
$plugin->release = 'v3.13.2'; $plugin->release = 'v3.13.3';
$plugin->component = 'plagiarism_pchkorg'; $plugin->component = 'plagiarism_pchkorg';
$plugin->maturity = MATURITY_STABLE; $plugin->maturity = MATURITY_STABLE;
$plugin->dependencies = array( $plugin->dependencies = array(