diff --git a/.github/workflows/php-coding-standards.yml b/.github/workflows/php-coding-standards.yml
index 8617dab..b7a50c9 100644
--- a/.github/workflows/php-coding-standards.yml
+++ b/.github/workflows/php-coding-standards.yml
@@ -48,5 +48,5 @@ jobs:
run: |
export PATH=$HOME/.composer/vendor/bin:$PATH
composer run lint -- --report=checkstyle
- # Also show warnings as PR annotations (non-blocking)
+ # Errors (including EscapeOutput) fail the job; remaining Security sniffs stay warnings
vendor/bin/phpcs --standard=./ruleset.xml --extensions=php --error-severity=0 . --report=checkstyle || true
diff --git a/.github/workflows/phpunit.yml b/.github/workflows/phpunit.yml
index cf8cbc8..9b5f40f 100644
--- a/.github/workflows/phpunit.yml
+++ b/.github/workflows/phpunit.yml
@@ -68,10 +68,15 @@ jobs:
cp -r /tmp/wordpress-develop/tests/phpunit/* /tmp/wordpress-tests-lib/
if [ "${{ matrix.wp-version }}" = "latest" ]; then
- wget -O /tmp/wordpress.tar.gz https://wordpress.org/latest.tar.gz
+ WP_URL="https://wordpress.org/latest.tar.gz"
else
- wget -O /tmp/wordpress.tar.gz https://wordpress.org/wordpress-${{ matrix.wp-version }}.tar.gz
+ WP_URL="https://wordpress.org/wordpress-${{ matrix.wp-version }}.tar.gz"
fi
+ for i in 1 2 3 4 5; do
+ wget -nv -O /tmp/wordpress.tar.gz "$WP_URL" && break
+ echo "Download attempt $i failed, retrying in $((i * 15))s..."
+ sleep $((i * 15))
+ done
tar -xzf /tmp/wordpress.tar.gz -C /tmp/
}
diff --git a/aryo-activity-log.php b/aryo-activity-log.php
index 6391310..6dab52a 100644
--- a/aryo-activity-log.php
+++ b/aryo-activity-log.php
@@ -35,7 +35,6 @@
include( 'classes/class-aal-settings.php' );
include( 'classes/class-aal-api.php' );
include( 'classes/class-aal-hooks.php' );
-include( 'classes/class-aal-notifications.php' );
include( 'classes/class-aal-export.php' );
include( 'classes/class-aal-privacy.php' );
include( 'classes/abstract-class-aal-exporter.php' );
@@ -76,11 +75,6 @@ final class AAL_Main {
*/
public $api;
- /**
- * @var \AAL_Notifications
- */
- public $notifications;
-
/**
* Construct
*/
@@ -91,7 +85,6 @@ protected function __construct() {
$this->hooks = new AAL_Hooks();
$this->settings = new AAL_Settings();
$this->api = new AAL_API();
- $this->notifications = new AAL_Notifications();
new AAL_Export();
new AAL_Privacy();
@@ -112,10 +105,12 @@ protected function __construct() {
public function __clone() {
_doing_it_wrong(
__FUNCTION__,
- sprintf(
- /* translators: %s: Class name. */
- __( 'Cloning instances of the singleton "%s" class is forbidden.', 'aryo-activity-log' ),
- get_class( $this )
+ esc_html(
+ sprintf(
+ /* translators: %s: Class name. */
+ __( 'Cloning instances of the singleton "%s" class is forbidden.', 'aryo-activity-log' ),
+ get_class( $this )
+ )
),
'2.0.7'
);
@@ -130,10 +125,12 @@ public function __clone() {
public function __wakeup() {
_doing_it_wrong(
__FUNCTION__,
- sprintf(
- /* translators: %s: Class name. */
- __( 'Unserializing instances of the singleton "%s" class is forbidden.', 'aryo-activity-log' ),
- get_class( $this )
+ esc_html(
+ sprintf(
+ /* translators: %s: Class name. */
+ __( 'Unserializing instances of the singleton "%s" class is forbidden.', 'aryo-activity-log' ),
+ get_class( $this )
+ )
),
'2.0.7'
);
diff --git a/assets/js/settings.js b/assets/js/settings.js
deleted file mode 100644
index 21d797f..0000000
--- a/assets/js/settings.js
+++ /dev/null
@@ -1,123 +0,0 @@
-'use strict';
-
-jQuery( function( $ ) {
- var AAL = {
- $wrapper: {},
- $container: {},
- conter: 0,
-
- init: function () {
- var _this = this;
-
- AAL.$wrapper = $( ".aal-notifier-settings" );
- AAL.$container = $( "ul", AAL.$wrapper );
-
- AAL.counter = AAL.$container.children().length;
-
- // check if there's only one option
- if ( 1 === AAL.counter ) {
- var $temp_el = AAL.$container.children().first();
- // check if the "value" select box has no options
- if ( 0 === $temp_el.find( ".aal-value option" ).length ) {
- // click the button with a timeout. Note that this is a hack that will need
- // to be solved server-side
- setTimeout( function () {
- $temp_el.find( ".aal-category" ).change();
- }, 300 );
- }
- }
-
- // when the "add" button is clicked
- AAL.$container.on( 'click', '.aal-new-rule', function ( e ) {
- e.preventDefault();
- _this.addRule( $( this ).closest( 'li' ) );
- });
-
- AAL.$container.on( 'click', '.aal-delete-rule', function ( e ) {
- e.preventDefault();
-
- // do not delete item if it's the only one left in the list
- if ( 1 === AAL.$container.children().length ) {
- return;
- }
-
- _this.deleteRule( $( this ).closest( 'li' ) );
- });
-
- // handle change on action category selectbox
- AAL.$container.on( 'change', '.aal-category', function ( e ) {
- e.preventDefault();
-
- var $select = $( this ),
- $siblings = $select.siblings( "select" );
-
- // disable all selectboxes to prevent multiple calls
- $siblings.filter( "select" ).prop( 'disabled', true );
-
- // grab live data via AJAX
- var data = _this.getData( $select.val(), function ( d ) {
- var $target = $siblings.filter( '.aal-value' );
- $target.empty(); // clear so we can insert fresh data
-
- $.each( d.data, function ( k, v ) {
- $target.append( $( "", {
- text: v,
- value: k
- } ) );
- });
-
- // restore disabled selectboxes
- $siblings.filter( "select" ).prop( 'disabled', false );
- });
- });
-
- },
- addRule: function ( $el ) {
- this.counter++;
- var $copy = $el.clone(),
- curID = parseInt( $el.data( 'id' ), null ),
- newID = this.counter;
-
- $copy.find( '[name]' ).each( function() {
- $( this ).attr( 'name', $( this ).attr( 'name' ).replace( curID, newID ) );
- // $( this ).attr( 'id', $( this ).attr( 'id' ).replace( curID, newID ) );
- });
-
- $copy.attr( 'data-id', newID );
- $el.after( $copy );
- },
- deleteRule: function ( $el ) {
- $el.remove();
- },
- getData: function ( type, cb ) {
- var payload = {
- action: 'aal_get_properties',
- action_category: type
- };
- $.getJSON( window.ajaxurl, payload, cb );
- }
- };
-
- AAL.init();
-
- window.AAL = AAL;
-
- /**
- * Form serialization helper
- */
- $.fn.AALSerializeObject = function() {
- var o = {};
- var a = this.serializeArray();
- $.each( a, function() {
- if ( o[this.name] !== undefined ) {
- if ( !o[this.name].push ) {
- o[this.name] = [o[this.name]];
- }
- o[this.name].push( this.value || '' );
- } else {
- o[this.name] = this.value || '';
- }
- } );
- return o;
- };
-});
diff --git a/bin/install-wp-tests.sh b/bin/install-wp-tests.sh
index 8a7192d..24f42f1 100644
--- a/bin/install-wp-tests.sh
+++ b/bin/install-wp-tests.sh
@@ -18,11 +18,18 @@ WP_TESTS_DIR=${WP_TESTS_DIR-$TMPDIR/wordpress-tests-lib}
WP_CORE_DIR=${WP_CORE_DIR-$TMPDIR/wordpress}
download() {
- if [ `which curl` ]; then
- curl -s "$1" > "$2";
- elif [ `which wget` ]; then
- wget -nv -O "$2" "$1"
- fi
+ local max_retries=5
+ for i in $(seq 1 $max_retries); do
+ if [ `which curl` ]; then
+ curl -sSf --retry 3 --retry-delay 10 "$1" > "$2" && return 0
+ elif [ `which wget` ]; then
+ wget -nv --tries=3 --waitretry=10 -O "$2" "$1" && return 0
+ fi
+ echo "Download attempt $i/$max_retries failed for $1, retrying in $((i * 15))s..."
+ sleep $((i * 15))
+ done
+ echo "All download attempts failed for $1"
+ return 1
}
if [[ $WP_VERSION =~ ^[0-9]+\.[0-9]+\-(beta|RC)[0-9]+$ ]]; then
diff --git a/classes/class-aal-activity-log-list-table.php b/classes/class-aal-activity-log-list-table.php
index 86d94c8..b42a524 100644
--- a/classes/class-aal-activity-log-list-table.php
+++ b/classes/class-aal-activity-log-list-table.php
@@ -222,9 +222,9 @@ private function maybe_promotion_row( $object_type ) {
printf(
'
%s%s |
',
esc_attr( $object_type ),
- wp_create_nonce( 'aal_promotion' ),
- $promotion_html,
- $dismiss_button
+ esc_attr( wp_create_nonce( 'aal_promotion' ) ),
+ $promotion_html, // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- escaped in get_promotion_html_by_object_type().
+ $dismiss_button // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- label escaped with esc_html__().
);
}
@@ -558,9 +558,21 @@ public function extra_tablenav_footer() {
@@ -614,7 +626,7 @@ public function extra_tablenav( $which ) {
);
echo '';
submit_button( __( 'Filter', 'aryo-activity-log' ), 'button', 'aal-filter', false, array( 'id' => 'activity-query-submit' ) );
@@ -631,9 +643,9 @@ public function extra_tablenav( $which ) {
if ( ! empty( $output ) ) {
echo '';
}
@@ -655,9 +667,9 @@ public function extra_tablenav( $which ) {
if ( ! empty( $output ) ) {
echo '';
}
@@ -668,19 +680,16 @@ public function extra_tablenav( $which ) {
$_REQUEST['typeshow'] = '';
}
- $output = array();
+ echo '