'wfcm',
'title' => self::get_plugin_name(),
'image_filename' => 'wfcm.png',
'plugin_slug' => self::get_plugin_filename(),
'plugin_basename' => 'website-file-changes-monitor.php',
'plugin_url' => 'https://downloads.wordpress.org/plugin/website-file-changes-monitor.latest-stable.zip',
'event_tab_id' => '#cat-wfcm',
'plugin_description' => 'To keep a log of file changes please install Website File Changes Monitor, a plugin which is also developed by us.',
),
);
// combine the two arrays.
return $new_plugin;
}
/**
* Retrieves a plugin name.
*
* @return string Plugin name.
*
* @since 5.1.0
*/
public static function get_plugin_name(): string {
return 'Website File Changes Monitor';
}
/**
* Gets a plugin icon URL.
*
* @return string Plugin icon URL.
*
* @since 5.1.0
*/
public static function get_plugin_icon_url(): string {
return 'https://ps.w.org/website-file-changes-monitor/assets/icon-128x128.png?rev=2393849';
}
/**
* Retrieves the color to use when showing some info about the extension.
*
* @return string HEX color.
*
* @since 4.5.0
*/
public static function get_color(): string {
return '#a4286a';
}
/**
* Gets the filename of the plugin this extension is targeting.
*
* @return string Filename.
*
* @since 4.5.0
*/
public static function get_plugin_filename(): string {
return 'website-file-changes-monitor/website-file-changes-monitor.php';
}
/**
* Appends content to the daily notification email content.
*
* @param string $body Email body (text).
* @param array $events Events.
*
* @return string
*
* @since 5.1.0
*/
public static function append_dailynotification_email_content( $body, $events ): string {
if ( ! empty( $events ) ) {
foreach ( $events as $event ) {
if ( 6028 === (int) $event['alert_id'] ) {
$files_modified[] = $event;
} elseif ( 6029 === (int) $event['alert_id'] ) {
$files_added[] = $event;
} elseif ( 6030 === (int) $event['alert_id'] ) {
$files_deleted[] = $event;
}
}
}
$media_check = trailingslashit( WSAL_BASE_URL ) . 'img/mails/daily-notification/alert-icon.png';
if ( class_exists( 'Website_File_Changes_Monitor' ) ) {
// File changes.
if ( ! empty( $files_added ) || ! empty( $files_modified ) || ! empty( $files_deleted ) ) {
$body .= '
| Website File Changes | ';
$body .= '| During the last file integrity scan on ' . date('d/m/Y', get_option('wfcm_last-scan-timestamp')) . ' at ' . date('H:i:s', get_option('wfcm_last-scan-timestamp')) . ' we detected the following file changes: | '; // phpcs:disable
if (! empty($files_added)) {
$body .= ' New files identified | ';
}
if (! empty($files_modified)) {
$body .= ' Some files were changed | ';
}
if (! empty($files_deleted)) {
$body .= ' Some files were deleted | ';
}
$body .= '| Click here to see the file changes. | ';
$body .= ' |
|
';
}
// No changes to report.
if (empty($files_added) && empty($files_modified) && empty($files_deleted) && class_exists('Website_File_Changes_Monitor')) {
$body .= '| Website File Changes | ';
$body .= '| Everything is looking good. No file changes detected during the last scan that ran on ' . date('d/m/Y', get_option('wfcm_last-scan-timestamp')) . ' at ' . date('H:i:s', get_option('wfcm_last-scan-timestamp')) . '. | ';
$body .= ' |
|
';
}
}
// No WFCM plugin found.
if (! class_exists('Website_File_Changes_Monitor')) {
$body .= '| Website File Changes | ';
$body .= ' To be alerted of file changes install the Website File Changes Monitor, a plugin we developed to detect file changes. Once installed, the plugin fully integrates with WP Activity Log. | ';
$body .= ' |
|
';
}
return $body;
}
}
}