diff --git a/README.md b/README.md
index ade31fd..0b5c530 100644
--- a/README.md
+++ b/README.md
@@ -3,9 +3,9 @@
**Contributors:** lightningspirit\
**Tags:** email, logging\
**Requires at least:** 4.5\
-**Tested up to:** 6.4\
+**Tested up to:** 6.4.3\
**Requires PHP:** 7.4\
-**Stable tag:** 0.3.1\
+**Stable tag:** 0.3.7\
**License:** GPLv2 or later\
**License URI:** https://www.gnu.org/licenses/gpl-2.0.html
diff --git a/assets/banner-1544x500.jpg b/assets/banner-1544x500.jpg
new file mode 100644
index 0000000..3badb80
Binary files /dev/null and b/assets/banner-1544x500.jpg differ
diff --git a/assets/banner-772x250.jpg b/assets/banner-772x250.jpg
new file mode 100644
index 0000000..56628d5
Binary files /dev/null and b/assets/banner-772x250.jpg differ
diff --git a/email-logs.php b/email-logs.php
index c48ae42..dce6c34 100644
--- a/email-logs.php
+++ b/email-logs.php
@@ -3,7 +3,7 @@
* Plugin Name: Email Logs
* Plugin URI: https://github.com/moveyourdigital/wp-email-logs
* Description: Log all emails sent from WordPress
- * Version: 0.3.1
+ * Version: 0.3.7
* Requires: PHP: 7.4
* Author: Move Your Digital, Inc.
* Author URI: https://moveyourdigital.com
diff --git a/readme.txt b/readme.txt
index e367c31..6c873cb 100644
--- a/readme.txt
+++ b/readme.txt
@@ -2,9 +2,9 @@
Contributors: lightningspirit
Tags: email, logging
Requires at least: 4.5
-Tested up to: 6.4
+Tested up to: 6.4.3
Requires PHP: 7.4
-Stable tag: 0.3.1
+Stable tag: 0.3.7
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
diff --git a/updater.php b/updater.php
index 2930c3e..45e3b86 100644
--- a/updater.php
+++ b/updater.php
@@ -9,6 +9,37 @@
exit;
}
+/**
+ * Gets and updates plugin Update URI
+ *
+ * @since 0.3.5
+ */
+add_filter(
+ 'plugin_update_uri_' . plugin_basename( __DIR__ ),
+ function ( $delete = false ) {
+ if ( true === $delete ) {
+ delete_option( 'plugin_update_uri_' . plugin_basename( __DIR__ ) );
+ }
+
+ $update_uri = get_option( 'plugin_update_uri_' . plugin_basename( __DIR__ ) );
+
+ if ( ! $update_uri ) {
+ if ( ! function_exists( 'get_plugin_data' ) ) {
+ require_once ABSPATH . 'wp-admin/includes/plugin.php';
+ }
+
+ $basename_file = apply_filters( 'plugin_basename_file_' . plugin_basename( __DIR__ ), '' );
+
+ $plugin_data = get_plugin_data( trailingslashit( WP_PLUGIN_DIR ) . $basename_file );
+ $update_uri = $plugin_data['UpdateURI'];
+
+ update_option( 'plugin_update_uri_' . plugin_basename( __DIR__ ), $update_uri );
+ }
+
+ return $update_uri;
+ }
+);
+
/**
* Fetch and return plugin data from declared remote
*
@@ -20,7 +51,7 @@
'plugin_update_remote_data_' . plugin_basename( __DIR__ ),
function ( $default_result = '' ) {
$remote_data = wp_remote_get(
- get_option( 'plugin_update_uri_' . plugin_basename( __DIR__ ) ),
+ apply_filters( 'plugin_update_uri_' . plugin_basename( __DIR__ ), null ),
array(
'timeout' => 10,
'headers' => array(
@@ -64,9 +95,17 @@ function ( $result, $action, $args ) {
return $result;
}
- $result = apply_filters( 'plugin_update_remote_data_' . plugin_basename( __DIR__ ), $result );
- $result->slug = plugin_basename( __DIR__ );
- $result->trunk = $remote->download_url;
+ $result = apply_filters( 'plugin_update_remote_data_' . plugin_basename( __DIR__ ), $result );
+ $result->slug = plugin_basename( __DIR__ );
+ $result->trunk = $result->download_url;
+ $result->sections = array(
+ 'description' => $result->sections->description,
+ 'installation' => $result->sections->installation,
+ );
+ $result->banners = array(
+ 'low' => $result->banners->low,
+ 'high' => $result->banners->high,
+ );
return $result;
},
@@ -84,25 +123,14 @@ function ( $result, $action, $args ) {
add_action(
'init',
function () {
- $basename_file = apply_filters( 'plugin_basename_file_' . plugin_basename( __DIR__ ), '' );
- $update_uri = get_option( 'plugin_update_uri_' . plugin_basename( __DIR__ ) );
-
- if ( ! $update_uri ) {
- if ( ! function_exists( 'get_plugin_data' ) ) {
- require_once ABSPATH . 'wp-admin/includes/plugin.php';
- }
-
- $plugin_data = get_plugin_data( WP_PLUGIN_DIR . $basename_file );
- $update_uri = $plugin_data['UpdateURI'];
-
- add_option( 'plugin_update_uri_' . plugin_basename( __DIR__ ), $update_uri );
- }
-
- $hostname = wp_parse_url( sanitize_url( $update_uri ), PHP_URL_HOST );
+ $update_uri = apply_filters( 'plugin_update_uri_' . plugin_basename( __DIR__ ), null );
+ $hostname = wp_parse_url( sanitize_url( $update_uri ), PHP_URL_HOST );
add_filter(
'update_plugins_' . $hostname,
function ( $update, $plugin_data, $plugin_file ) {
+ $basename_file = apply_filters( 'plugin_basename_file_' . plugin_basename( __DIR__ ), '' );
+
if ( $plugin_file !== $basename_file ) {
return $update;
}
@@ -111,9 +139,21 @@ function ( $update, $plugin_data, $plugin_file ) {
return $update;
}
- $remote_data = apply_filter( 'plugin_update_remote_data_' . plugin_basename( __DIR__ ), $result );
+ $remote_data = apply_filters( 'plugin_update_remote_data_' . plugin_basename( __DIR__ ), $update );
+
+ if ( ! $remote_data ) {
+ return $update;
+ }
+
+ if ( version_compare( $remote_data->version, $plugin_data['Version'], '<=' ) ) {
+ return $update;
+ }
+
+ if ( version_compare( get_bloginfo( 'version' ), $remote_data->requires, '<' ) ) {
+ return $update;
+ }
- if ( ! version_compare( $plugin_data['Version'], $remote_data->version, '<' ) ) {
+ if ( version_compare( PHP_VERSION, $remote_data->requires_php, '<' ) ) {
return $update;
}
@@ -168,7 +208,7 @@ function ( $upgrader_object, $options ) {
if ( 'update' === $options['action'] && 'plugin' === $options['type'] ) {
foreach ( $options['plugins'] as $each_plugin ) {
if ( $each_plugin === $basename_file ) {
- delete_option( 'plugin_update_uri_' . plugin_basename( __DIR__ ) );
+ apply_filters( 'plugin_update_uri_' . plugin_basename( __DIR__ ), true );
}
}
}
diff --git a/wp-info.json b/wp-info.json
index 3a230f3..55754f5 100644
--- a/wp-info.json
+++ b/wp-info.json
@@ -3,14 +3,18 @@
"slug": "wp-email-logs",
"author": "Move Your Digital",
"author_profile": "https://github.com/moveyourdigital",
- "version": "0.3.1",
+ "version": "0.3.7",
"download_url": "https://github.com/moveyourdigital/wp-email-logs/archive/refs/heads/main.zip",
"requires": "5.8",
- "tested": "6.4",
+ "tested": "6.4.3",
"requires_php": "7.4",
- "last_updated": "2024-03-27 18:35:00",
+ "last_updated": "2024-03-27 22:45:00",
"sections": {
- "description": "This simple plugin does nothing, only gets updates from a custom server",
- "installation": "Click the activate button and that's it."
+ "description": "Log all emails sent from WordPress.",
+ "installation": "Click the activate button. No further configuration."
+ },
+ "banners": {
+ "low": "https://github.com/moveyourdigital/wp-email-logs/raw/main/assets/banner-772x250.jpg",
+ "high": "https://github.com/moveyourdigital/wp-email-logs/raw/main/assets/banner-1544x500.jpg"
}
}