Skip to content

Commit

Permalink
add notification if ninja firewall plugin is detected + fix regressio…
Browse files Browse the repository at this point in the history
…n in incompatible plugin detection
  • Loading branch information
diosmosis committed Sep 21, 2023
1 parent 0412ee9 commit a4e8e33
Showing 1 changed file with 20 additions and 4 deletions.
24 changes: 20 additions & 4 deletions classes/WpMatomo/Admin/SystemReport.php
Original file line number Diff line number Diff line change
Expand Up @@ -1689,15 +1689,20 @@ private function get_plugins_info() {
];
}

$active_plugins = $this->get_actives_plugins();
$active_plugins_with_version = $this->get_actives_plugins();

if ( ! empty( $active_plugins ) && is_array( $active_plugins ) ) {
if ( ! empty( $active_plugins_with_version ) && is_array( $active_plugins_with_version ) ) {
$rows[] = [
'name' => 'Active Plugins',
'value' => count( $active_plugins ),
'comment' => implode( ' ', $active_plugins ),
'value' => count( $active_plugins_with_version ),
'comment' => implode( ' ', $active_plugins_with_version ),
];

$active_plugins = array_map(function ( $plugin_with_version ) {
$parts = explode( ':', $plugin_with_version );
return $parts[0];
}, $active_plugins_with_version);

$used_not_compatible = array_intersect( $active_plugins, $this->not_compatible_plugins );
if ( in_array( 'wp-rocket', $used_not_compatible, true ) ) {
if ( defined( 'WP_ROCKET_VERSION' ) && ( version_compare( WP_ROCKET_VERSION, '3.11.5' ) <= 0 ) ) {
Expand Down Expand Up @@ -1735,6 +1740,17 @@ private function get_plugins_info() {
];
}
}

if ( in_array( 'ninjafirewall', $active_plugins, true ) ) {
$warning = <<<EOF
<div class="notice notice-warning">
<p><strong>We noticed you are using Matomo with Ninja Firewall.</strong> This can result in Matomo cache file changes showing up in Ninja Firewall which likely undesired.
<a href="https://matomo.org/faq/wordpress/how-do-i-prevent-matomo-cache-file-changes-to-show-up-in-ninja-firewall/" rel="noreferrer noopener" target="_blank">Read our FAQ to learn how to prevent these entries.</a>
</p>
</div>
EOF;
echo $warning;
}
}

$rows[] = [
Expand Down

0 comments on commit a4e8e33

Please sign in to comment.