diff --git a/.php-cs-fixer.php b/.php-cs-fixer.php
new file mode 100644
index 00000000..5fd203df
--- /dev/null
+++ b/.php-cs-fixer.php
@@ -0,0 +1,20 @@
+in(__DIR__)
+ ->name('*.php');
+
+$config = new Config();
+
+$rules = [
+ '@PER-CS2.0' => true,
+ 'trailing_comma_in_multiline' => ['elements' => ['arguments', 'array_destructuring', 'arrays']], // For PHP 7.4 compatibility
+];
+
+return $config
+ ->setRules($rules)
+ ->setFinder($finder)
+ ->setUsingCache(false);
diff --git a/ajax/common.tabs.php b/ajax/common.tabs.php
index 73d1f30d..4483523e 100644
--- a/ajax/common.tabs.php
+++ b/ajax/common.tabs.php
@@ -28,8 +28,8 @@
* -------------------------------------------------------------------------
*/
-include("../../../inc/includes.php");
-header("Content-Type: text/html; charset=UTF-8");
+include('../../../inc/includes.php');
+header('Content-Type: text/html; charset=UTF-8');
Html::header_nocache();
Session::checkLoginUser();
diff --git a/ajax/dashboard.php b/ajax/dashboard.php
index 1cd12e33..ad2d2085 100644
--- a/ajax/dashboard.php
+++ b/ajax/dashboard.php
@@ -49,14 +49,14 @@
case 'centralDashboard':
Html::includeHeader();
- echo "
";
+ echo '';
$dashboard = new PluginMreportingDashboard();
$dashboard->showDashboard(false);
- //load protovis lib for dashboard render
+ //load protovis lib for dashboard render
$version = Plugin::getInfo('mreporting', 'version');
$php_dir = Plugin::getPhpDir('mreporting', false);
- echo Html::script($php_dir . "/lib/protovis/protovis.js", ['version' => $version]);
+ echo Html::script($php_dir . '/lib/protovis/protovis.js', ['version' => $version]);
Html::popFooter();
break;
diff --git a/ajax/dropdownExport.php b/ajax/dropdownExport.php
index e14f4f8a..9dbc2fdf 100644
--- a/ajax/dropdownExport.php
+++ b/ajax/dropdownExport.php
@@ -28,8 +28,8 @@
* -------------------------------------------------------------------------
*/
-include("../../../inc/includes.php");
-header("Content-Type: text/html; charset=UTF-8");
+include('../../../inc/includes.php');
+header('Content-Type: text/html; charset=UTF-8');
Html::header_nocache();
Session::checkLoginUser();
@@ -38,16 +38,16 @@
isset($_POST['ext'])
&& !empty($_POST['ext'])
) {
- if ($_POST['ext'] == "odt") {
- echo " ";
- $option = [];
- $option[1] = __("With data", 'mreporting');
- $option[0] = __("Without data", 'mreporting');
- Dropdown::showFromArray("withdata", $option, []);
+ if ($_POST['ext'] == 'odt') {
+ echo ' ';
+ $option = [];
+ $option[1] = __('With data', 'mreporting');
+ $option[0] = __('Without data', 'mreporting');
+ Dropdown::showFromArray('withdata', $option, []);
}
- if ($_POST['ext'] == "svg") {
- //close previous form
+ if ($_POST['ext'] == 'svg') {
+ //close previous form
Html::Closeform();
$randname = $_POST['randname'];
diff --git a/ajax/dropdownGraphs.php b/ajax/dropdownGraphs.php
index b07be6b9..aee6349f 100644
--- a/ajax/dropdownGraphs.php
+++ b/ajax/dropdownGraphs.php
@@ -28,21 +28,21 @@
* -------------------------------------------------------------------------
*/
-if (strpos($_SERVER['PHP_SELF'], "dropdownGraphs.php")) {
- include("../../../inc/includes.php");
- header("Content-Type: text/html; charset=UTF-8");
+if (strpos($_SERVER['PHP_SELF'], 'dropdownGraphs.php')) {
+ include('../../../inc/includes.php');
+ header('Content-Type: text/html; charset=UTF-8');
Html::header_nocache();
}
Session::checkLoginUser();
if ($_POST['graphname'] != -1) {
- $test = explode(";", $_POST['graphname']);
+ $test = explode(';', $_POST['graphname']);
if (isset($test[0])) {
- $_POST['classname'] = $test[0];
- $_POST['name'] = $test[1];
+ $_POST['classname'] = $test[0];
+ $_POST['name'] = $test[1];
$config = new PluginMreportingConfig();
- echo "