diff --git a/.phpcs b/.phpcs new file mode 100644 index 0000000..d715535 --- /dev/null +++ b/.phpcs @@ -0,0 +1,59 @@ +setRiskyAllowed(true) + ->setRules([ + '@Symfony' => true, + '@Symfony:risky' => true, + 'array_syntax' => ['syntax' => 'short'], + 'combine_consecutive_unsets' => true, + 'combine_consecutive_issets' => true, + 'general_phpdoc_annotation_remove' => ['expectedException', 'expectedExceptionMessage', 'expectedExceptionMessageRegExp'], + 'header_comment' => ['header' => $header], + 'heredoc_to_nowdoc' => true, + 'no_extra_consecutive_blank_lines' => ['break', 'continue', 'extra', 'return', 'throw', 'use', 'parenthesis_brace_block', 'square_brace_block', 'curly_brace_block'], + 'no_short_echo_tag' => true, + 'no_unreachable_default_argument_value' => true, + 'no_useless_else' => true, + 'no_useless_return' => true, + 'ordered_imports' => true, + 'php_unit_strict' => true, + 'phpdoc_add_missing_param_annotation' => true, + 'phpdoc_order' => true, + 'semicolon_after_instruction' => true, + 'strict_comparison' => true, + 'strict_param' => true, + 'binary_operator_spaces' => ['align_equals' => true, 'align_double_arrow' => true], + 'align_multiline_comment' => true, + 'yoda_style' => false, + 'compact_nullable_typehint' => true, + 'native_function_invocation' => false, + ]) + ->setFinder( + PhpCsFixer\Finder::create() + ->exclude('tests/Fixture') + ->exclude('moodle') + ->exclude('moodledata') + ->name('moodle-plugin-ci') + ->in(__DIR__) + ); diff --git a/classes/permissions/capability.class.php b/classes/permissions/capability.class.php index 648682b..beafa35 100644 --- a/classes/permissions/capability.class.php +++ b/classes/permissions/capability.class.php @@ -30,8 +30,7 @@ if (!defined('MOODLE_INTERNAL')) { die('Direct access to this script is forbidden.'); // It must be included from a Moodle page. } -class capability -{ +class capability { /** * ENABLE */ diff --git a/form/plagiarism_pchkorg_setup_form.php b/form/plagiarism_pchkorg_setup_form.php index 3510222..65035ae 100644 --- a/form/plagiarism_pchkorg_setup_form.php +++ b/form/plagiarism_pchkorg_setup_form.php @@ -23,12 +23,6 @@ defined('MOODLE_INTERNAL') || die(); - -//function pchkorg_check_pchkorg_min_percent($value) -//{ -// return 0 <= $value && $value < 100; -//} - /** * Class defined plugin settings form. */ @@ -55,6 +49,18 @@ class plagiarism_pchkorg_setup_form extends moodleform { if (!isset($mform->exportValues()['pchkorg_use']) || is_null($mform->exportValues()['pchkorg_use'])) { $mform->setDefault('pchkorg_use', false); } + if (!isset($mform->exportValues()['pchkorg_exclude_self_plagiarism']) + || is_null($mform->exportValues()['pchkorg_exclude_self_plagiarism'])) { + $mform->setDefault('pchkorg_exclude_self_plagiarism', 1); + } + if (!isset($mform->exportValues()['pchkorg_include_referenced']) + || is_null($mform->exportValues()['pchkorg_include_referenced'])) { + $mform->setDefault('pchkorg_include_referenced', 0); + } + if (!isset($mform->exportValues()['pchkorg_include_citation']) + || is_null($mform->exportValues()['pchkorg_include_citation'])) { + $mform->setDefault('pchkorg_include_citation', 0); + } $mform->addElement('password', 'pchkorg_token', get_string('pchkorg_token', 'plagiarism_pchkorg')); $mform->addHelpButton('pchkorg_token', 'pchkorg_token', 'plagiarism_pchkorg'); @@ -74,6 +80,26 @@ class plagiarism_pchkorg_setup_form extends moodleform { $mform->addRule('pchkorg_min_percent', get_string('pchkorg_min_percent_range', 'plagiarism_pchkorg'), 'check_pchkorg_min_percent'); $mform->setType('pchkorg_min_percent', PARAM_INT); + $mform->addElement( + 'select', + 'pchkorg_exclude_self_plagiarism', + get_string('pchkorg_exclude_self_plagiarism', 'plagiarism_pchkorg'), + array(get_string('no'), get_string('yes')) + ); + + $mform->addElement( + 'select', + 'pchkorg_include_referenced', + get_string('pchkorg_include_referenced', 'plagiarism_pchkorg'), + array(get_string('no'), get_string('yes')) + ); + + $mform->addElement( + 'select', + 'pchkorg_include_citation', + get_string('pchkorg_include_citation', 'plagiarism_pchkorg'), + array(get_string('no'), get_string('yes')) + ); $this->add_action_buttons(true); } diff --git a/lang/en/plagiarism_pchkorg.php b/lang/en/plagiarism_pchkorg.php index 02bb137..f09034d 100644 --- a/lang/en/plagiarism_pchkorg.php +++ b/lang/en/plagiarism_pchkorg.php @@ -39,6 +39,9 @@ $string['pchkorg_check_for_plagiarism'] = 'Check for plagiarism'; $string['pchkorg_min_percent'] = 'Exclude sources below X% similarity'; $string['pchkorg_min_percent_help'] = 'Exclude sources below X% similarity'; $string['pchkorg_min_percent_range'] = 'Must be between 0 and 99'; +$string['pchkorg_exclude_self_plagiarism'] = 'Exclude self-plagiarism'; +$string['pchkorg_include_referenced'] = 'Include References'; +$string['pchkorg_include_citation'] = 'Include Quotes'; $string['pchkorg_disclosure'] = 'Submission will be sent to PlagiarismCheck.org for check.
By submitting assignment I agree with Terms & Conditions