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

Fix linter issues. Prepare version 1.19

This commit is contained in:
Jane Adelmann 2018-11-01 18:50:10 +02:00
parent 64b3c4e64e
commit 325aa87fa8
No known key found for this signature in database
GPG Key ID: 4CCF39DF30B8AF72
21 changed files with 109 additions and 35 deletions

2
.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
.idea

50
.travis.yml Normal file
View File

@ -0,0 +1,50 @@
language: php
sudo: true
addons:
firefox: "47.0.1"
postgresql: "9.4"
apt:
packages:
- oracle-java8-installer
- oracle-java8-set-default
cache:
directories:
- $HOME/.composer/cache
- $HOME/.npm
php:
- 7.0
- 7.1
env:
global:
- MOODLE_BRANCH=MOODLE_35_STABLE
matrix:
- DB=pgsql
- DB=mysqli
before_install:
- phpenv config-rm xdebug.ini
- nvm install 8.9
- nvm use 8.9
- cd ../..
- composer create-project -n --no-dev --prefer-dist blackboard-open-source/moodle-plugin-ci ci ^2
- export PATH="$(cd ci/bin; pwd):$(cd ci/vendor/bin; pwd):$PATH"
install:
- moodle-plugin-ci install
script:
- moodle-plugin-ci phplint
- moodle-plugin-ci phpcpd
- moodle-plugin-ci phpmd
#- moodle-plugin-ci codechecker
- moodle-plugin-ci validate
- moodle-plugin-ci savepoints
- moodle-plugin-ci mustache
#- moodle-plugin-ci grunt
- moodle-plugin-ci phpunit
- moodle-plugin-ci behat

View File

@ -1 +0,0 @@
define(["jquery"],function(a){return{checkReport:function(){window.console.log("loaded",a)}}});

View File

@ -1,5 +1,6 @@
<?php <?php
class ApiProvider class ApiProvider
{ {

View File

@ -1,5 +1,6 @@
<?php <?php
class UrlGenerator class UrlGenerator
{ {
public function getCheckUrl($cmid, $fileid) public function getCheckUrl($cmid, $fileid)

View File

@ -1,4 +1,5 @@
<?php <?php
// This file is part of Moodle - http://moodle.org/ // This file is part of Moodle - http://moodle.org/
// //
// Moodle is free software: you can redistribute it and/or modify // Moodle is free software: you can redistribute it and/or modify

View File

@ -1,3 +1,4 @@
<?php <?php
$observers = array(); $observers = array();

View File

@ -1,4 +1,5 @@
<?php <?php
// This file is part of Moodle - http://moodle.org/ // This file is part of Moodle - http://moodle.org/
// //
// Moodle is free software: you can redistribute it and/or modify // Moodle is free software: you can redistribute it and/or modify

View File

@ -1,8 +1,9 @@
<?php <?php
class plagiarism_setup_form extends moodleform { class plagiarism_setup_form extends moodleform {
/// Define the form // Define the form
function definition () { function definition () {
global $CFG; global $CFG;

View File

@ -1,11 +1,11 @@
<?php <?php
//moodleform is defined in formslib.php // moodleform is defined in formslib.php
require_once("$CFG->libdir/formslib.php"); require_once("$CFG->libdir/formslib.php");
class send_text_form extends moodleform class send_text_form extends moodleform
{ {
//Add elements to form // Add elements to form
public function definition() public function definition()
{ {
global $CFG; global $CFG;
@ -21,9 +21,9 @@ class send_text_form extends moodleform
} }
//Custom validation should be added here // Custom validation should be added here
function validation($data, $files) function validation($data, $files)
{ {
return array(); return array();
} }
} }

View File

@ -1,4 +1,5 @@
<?php <?php
// This file is part of Moodle - http://moodle.org/ // This file is part of Moodle - http://moodle.org/
// //
// Moodle is free software: you can redistribute it and/or modify // Moodle is free software: you can redistribute it and/or modify

View File

@ -1,4 +1,5 @@
<?php <?php
// This file is part of Moodle - http://moodle.org/ // This file is part of Moodle - http://moodle.org/
// //
// Moodle is free software: you can redistribute it and/or modify // Moodle is free software: you can redistribute it and/or modify

View File

@ -1,5 +1,6 @@
<?php <?php
class ConfigModel class ConfigModel
{ {
private $db; private $db;

View File

@ -1,5 +1,6 @@
<?php <?php
class FileModel class FileModel
{ {
private $db; private $db;

View File

@ -1,4 +1,5 @@
<?php <?php
require_once(__DIR__ . '/../../../config.php'); require_once(__DIR__ . '/../../../config.php');
require_once(__DIR__ . '/../lib.php'); require_once(__DIR__ . '/../lib.php');
require_once(__DIR__ . '/../form/send_text_form.php'); require_once(__DIR__ . '/../form/send_text_form.php');

View File

@ -1,5 +1,6 @@
<?php <?php
require_once(__DIR__ . '/../../../config.php'); require_once(__DIR__ . '/../../../config.php');
require_once(__DIR__ . '/../lib.php'); require_once(__DIR__ . '/../lib.php');
require_once(__DIR__ . '/../form/send_text_form.php'); require_once(__DIR__ . '/../form/send_text_form.php');
@ -39,7 +40,7 @@ if ('POST' === $_SERVER['REQUEST_METHOD']) {// form submission
$file = $fs->get_file_by_id($fileid); $file = $fs->get_file_by_id($fileid);
if (!$file) { if (!$file) {
//file not found // file not found
die('404 not exists'); die('404 not exists');
} }
@ -74,7 +75,7 @@ if ('POST' === $_SERVER['REQUEST_METHOD']) {// form submission
$file = $fs->get_file_by_id($fileid); $file = $fs->get_file_by_id($fileid);
if (!$file) { if (!$file) {
//file not found // file not found
die('404 not exists'); die('404 not exists');
} }

View File

@ -1,4 +1,5 @@
<?php <?php
// This file is part of Moodle - http://moodle.org/ // This file is part of Moodle - http://moodle.org/
// //
// Moodle is free software: you can redistribute it and/or modify // Moodle is free software: you can redistribute it and/or modify

View File

@ -1,4 +1,5 @@
<?php <?php
// This file is part of Moodle - http://moodle.org/ // This file is part of Moodle - http://moodle.org/
// //
// Moodle is free software: you can redistribute it and/or modify // Moodle is free software: you can redistribute it and/or modify
@ -26,9 +27,9 @@ defined('MOODLE_INTERNAL') || die();
if (!isset($plugin)) { if (!isset($plugin)) {
$plugin = new stdClass(); $plugin = new stdClass();
} }
$plugin->version = 2018103102; $plugin->version = 2018110101;
$plugin->requires = 2017051501; // Requires Moodle 3.3 . $plugin->requires = 2017051501; // Requires Moodle 3.3 .
$plugin->release = 'v1.18'; $plugin->release = 'v1.19';
$plugin->maturity = MATURITY_STABLE; $plugin->maturity = MATURITY_STABLE;
$plugin->component = 'plagiarism_pchkorg'; $plugin->component = 'plagiarism_pchkorg';

View File

@ -1,5 +1,6 @@
<?php <?php
echo $OUTPUT->header(); echo $OUTPUT->header();
?> ?>
<style> <style>
@ -19,7 +20,10 @@ echo $OUTPUT->header();
</style> </style>
<div> <div>
<div id="plagcheck-loader" data-cmid="<?php echo intval($cmid)?>" data-file="<?php echo intval($fileid)?>" class="loader"></div> <div id="plagcheck-loader" data-cmid="<?php
echo intval($cmid)?>" data-file="<?php
echo intval($fileid)?>" class="loader"></div>
</div> </div>
<?php <?php
echo $OUTPUT->footer(); echo $OUTPUT->footer();

View File

@ -1,4 +1,5 @@
<?php <?php
$PAGE->requires->css('/plagiarism/pchkorg/assets/viewer/report-viewer.min.css'); $PAGE->requires->css('/plagiarism/pchkorg/assets/viewer/report-viewer.min.css');
echo $OUTPUT->header(); echo $OUTPUT->header();
@ -6,32 +7,32 @@ echo $OUTPUT->header();
?> ?>
<div class="pCheck-container"></div> <div class="pCheck-container"></div>
<div id="report-root"></div> <div id="report-root"></div>
<?php <?php
if (empty($error)) {
?>
<script src="/plagiarism/pchkorg/assets/viewer/report-viewer.min.js"></script>
<script>
(function(window, document, ReportViewer, localData) {
var element = document.getElementById('report-root');
var widget = ReportViewer.create();
widget.init({ if (empty($error)) {
element: element, ?>
localData: localData <script src="/plagiarism/pchkorg/assets/viewer/report-viewer.min.js"></script>
}); <script>
})(window, window.document, window.ReportViewer, <?php echo empty($data) ? '{}': $data ?>); (function (window, document, ReportViewer, localData) {
</script> var element = document.getElementById('report-root');
<? var widget = ReportViewer.create();
} elseif (isset($error)) {
?>
<h2>Error: <?php echo $error ?></h2>
<? widget.init({
} element: element,
?> localData: localData
});
})(window, window.document, window.ReportViewer, <?php
echo empty($data) ? '{}' : $data ?>);
</script>
<?php
<?php } elseif (isset($error)) {
?>
<h2>Error: <?php
echo $error ?></h2>
<?php
echo $OUTPUT->footer(); }
echo $OUTPUT->footer();

View File

@ -1,5 +1,6 @@
<?php <?php
echo $OUTPUT->header(); echo $OUTPUT->header();
?> ?>
@ -17,13 +18,15 @@ echo $OUTPUT->header();
<br/> <br/>
<div class="plagiarism-preview-content"> <div class="plagiarism-preview-content">
<div class="plagiarism-preview-content-inner"> <div class="plagiarism-preview-content-inner">
<?php echo nl2br(htmlspecialchars($content, ENT_COMPAT | ENT_HTML401, $encoding = 'UTF-8')) ?> <?php
echo nl2br(htmlspecialchars($content, ENT_COMPAT | ENT_HTML401, $encoding = 'UTF-8')) ?>
</div> </div>
</div> </div>
<br/> <br/>
<div> <div>
<?php <?php
if ($isSupported) { if ($isSupported) {
echo $form->display(); echo $form->display();
} else { } else {
@ -32,4 +35,5 @@ echo $OUTPUT->header();
?> ?>
</div> </div>
<?php <?php
echo $OUTPUT->footer(); echo $OUTPUT->footer();