Skip to content

Commit 3041fa7

Browse files
Declare compatibility with WordPress 5.4, update dependencies, add PHP 7.4 to Travis build (#16)
* Declare compatibility with WordPress 5.4, update dependencies, add PHP 7.4 to Travis build * Improve code style * Improve code style of JavaScript file
1 parent 5b3f546 commit 3041fa7

11 files changed

+124
-123
lines changed

.travis.yml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
language: php
22

33
php:
4-
- '5.6'
5-
- '7.1'
6-
- '7.2'
7-
- '7.3'
4+
- 5.6
5+
- 7.1
6+
- 7.2
7+
- 7.3
8+
- 7.4
89
- nightly
910

1011
matrix:

CHANGELOG.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,15 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
55
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
66

77

8-
## Version 1.1.2
8+
## Unreleased
99

1010
### Changed
11+
* Enhancement: Compliance with latest WP coding guidelines and other code style improvements
12+
1113

14+
## Version 1.1.2
15+
16+
### Changed
1217
* Enhancement: Compliance with latest WP coding guidelines
1318

1419

assets/functions.js

Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,32 @@
1-
function exportTableToCSV($table, filename) {
2-
var tmpColDelim = String.fromCharCode(11), tmpRowDelim = String.fromCharCode(0), // Temporary delimiters unlikely to be typed by keyboard to avoid accidentally splitting the actual contents
3-
colDelim = '","', rowDelim = '"\r\n"', // actual delimiters for CSV
4-
$rows = $table.find('tr'),
5-
csv = '"' + $rows.map(function(i, row) {
6-
var $row = jQuery(row), $cols = $row.find('td,th');
7-
return $cols.map(function(j, col) {
8-
var $col = jQuery(col), text = $col.text();
9-
return text.replace(/"/g, '""'); // escape double quotes
10-
}).get().join(tmpColDelim);
11-
}).get().join(tmpRowDelim).split(tmpRowDelim)
12-
.join(rowDelim).split(tmpColDelim)
13-
.join(colDelim) + '"',
14-
csvData = 'data:application/csv;charset=utf-8,' + encodeURIComponent(csv);
15-
jQuery(this).attr({
16-
'download' : filename,
17-
'href' : csvData
18-
});
1+
function posts_and_users_stats_export_table_to_csv(table, filename) {
2+
const tmpColDelim = String.fromCharCode(11), tmpRowDelim = String.fromCharCode(0), // Temporary delimiters unlikely to be typed by keyboard to avoid accidentally splitting the actual contents
3+
colDelim = '","', rowDelim = '"\r\n"', // actual delimiters for CSV
4+
rows = table.find('tr'),
5+
csv = '"' + rows.map(function (i, row) {
6+
const $row = jQuery(row), $cols = $row.find('td,th');
7+
return $cols.map(function (j, col) {
8+
const $col = jQuery(col), text = $col.text();
9+
return text.replace(/"/g, '""'); // escape double quotes
10+
}).get().join(tmpColDelim);
11+
}).get().join(tmpRowDelim).split(tmpRowDelim)
12+
.join(rowDelim).split(tmpColDelim)
13+
.join(colDelim) + '"',
14+
csvData = 'data:application/csv;charset=utf-8,' + encodeURIComponent(csv);
15+
jQuery(this).attr({
16+
'download': filename,
17+
'href': csvData
18+
});
1919
}
2020

2121
function posts_and_users_stats_bar_chart(div, xData, yData, xAxisTitle, yAxisTitle) {
22-
var data = {
22+
const data = {
2323
labels: xData,
24-
series: [
25-
yData
26-
]
27-
};
24+
series: [
25+
yData
26+
]
27+
};
2828

29-
var options = {
29+
const options = {
3030
seriesBarDistance: 20,
3131
chartPadding: {
3232
top: 20,
@@ -61,7 +61,7 @@ function posts_and_users_stats_bar_chart(div, xData, yData, xAxisTitle, yAxisTit
6161
]
6262
};
6363

64-
var responsiveOptions = [
64+
const responsiveOptions = [
6565
['screen and (max-width: 640px)', {
6666
seriesBarDistance: 5,
6767
axisX: {
@@ -76,7 +76,7 @@ function posts_and_users_stats_bar_chart(div, xData, yData, xAxisTitle, yAxisTit
7676
}
7777

7878
function posts_and_users_stats_time_line_chart(div, seriesData, dateFormat, xAxisTitle, yAxisTitle) {
79-
var data = {
79+
const data = {
8080
series: [
8181
{
8282
name: 'series-1',
@@ -85,7 +85,7 @@ function posts_and_users_stats_time_line_chart(div, seriesData, dateFormat, xAxi
8585
]
8686
};
8787

88-
var options = {
88+
const options = {
8989
chartPadding: {
9090
top: 20,
9191
right: 30,
@@ -95,7 +95,7 @@ function posts_and_users_stats_time_line_chart(div, seriesData, dateFormat, xAxi
9595
axisX: {
9696
type: Chartist.FixedScaleAxis,
9797
divisor: 5,
98-
labelInterpolationFnc: function(value) {
98+
labelInterpolationFnc: function (value) {
9999
return moment(value).format(dateFormat);
100100
}
101101
},

composer.json

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,16 +17,16 @@
1717
"require": {
1818
"php": ">=5.6",
1919
"npm-asset/chartist": "^0.11.4",
20-
"npm-asset/chartist-plugin-axistitle": "^0.0.6",
20+
"npm-asset/chartist-plugin-axistitle": "^0.0.7",
2121
"npm-asset/moment": "^2.24.0"
2222
},
2323
"require-dev": {
24-
"dealerdirect/phpcodesniffer-composer-installer": "^0.4",
25-
"matthiasmullie/minify": "^1.3",
26-
"phpcompatibility/php-compatibility": "^9.3",
27-
"slowprog/composer-copy-file": "^0.3",
28-
"squizlabs/php_codesniffer": "^3.5",
29-
"wp-coding-standards/wpcs": "^2.1"
24+
"dealerdirect/phpcodesniffer-composer-installer": "^0.6.2",
25+
"matthiasmullie/minify": "^1.3.63",
26+
"phpcompatibility/php-compatibility": "^9.3.5",
27+
"slowprog/composer-copy-file": "^0.3.1",
28+
"squizlabs/php_codesniffer": "^3.5.4",
29+
"wp-coding-standards/wpcs": "^2.2.1"
3030
},
3131
"repositories": [
3232
{

0 commit comments

Comments
 (0)