Skip to content

Commit 6d1a193

Browse files
authored
Merge pull request #43 from BeAPI/add/popupmaker-default
add default-popup-maker mu-plugin
2 parents b773412 + 0dd5e34 commit 6d1a193

1 file changed

Lines changed: 37 additions & 0 deletions

File tree

default-popup-maker.php

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
<?php
2+
/**
3+
* Plugin Name: Be API - Default Popup Maker
4+
* Description: Hide Popup Maker filesystem cache alert
5+
* Version: 1.0
6+
* Author: BE API Technical team
7+
* Author URI: https://www.beapi.fr
8+
*/
9+
10+
namespace BEAPI\Plugin_Defaults\Popup_Maker;
11+
12+
if ( ! defined( 'ABSPATH' ) ) {
13+
die( 'Cannot access pages directly.' );
14+
}
15+
16+
add_filter( 'pum_alert_list', __NAMESPACE__ . '\\strip_filesystem_cache_alert', 999 );
17+
18+
/**
19+
* Hide Popup Maker filesystem cache alert
20+
*
21+
* @param array $alerts Popup Maker alerts returned by apply_filters( 'pum_alert_list', [] ).
22+
* @return array
23+
*/
24+
function strip_filesystem_cache_alert( $alerts ) {
25+
if ( empty( $alerts ) || ! is_array( $alerts ) ) {
26+
return $alerts;
27+
}
28+
29+
return array_values(
30+
array_filter(
31+
$alerts,
32+
static function ( $alert ) {
33+
return ! isset( $alert['code'] ) || 'pum_writeable_notice' !== $alert['code'];
34+
}
35+
)
36+
);
37+
}

0 commit comments

Comments
 (0)