summaryrefslogtreecommitdiff
path: root/Postman/Postman.php
diff options
context:
space:
mode:
authoryehudah <yehudah@b8457f37-d9ea-0310-8a92-e5e31aec5664>2017-12-23 23:23:04 +0000
committeryehudah <yehudah@b8457f37-d9ea-0310-8a92-e5e31aec5664>2017-12-23 23:23:04 +0000
commit707146a8ea285d5f51e112dabad57785b38f3b3a (patch)
tree1ce0952fd8a89cdc8308f32d09763169cb017dc4 /Postman/Postman.php
parent6eabf1113cb0837b3ee83c058d9d68fca72e1b71 (diff)
downloadPost-SMTP-707146a8ea285d5f51e112dabad57785b38f3b3a.zip
= 1.8 - 2017-12-24
* New: Mailgun API integration * New: New filter controls * New: WPML conflict fix * Fix: Minor old bugs
Diffstat (limited to 'Postman/Postman.php')
-rw-r--r--Postman/Postman.php33
1 files changed, 33 insertions, 0 deletions
diff --git a/Postman/Postman.php b/Postman/Postman.php
index 7eb512a..153257b 100644
--- a/Postman/Postman.php
+++ b/Postman/Postman.php
@@ -117,6 +117,14 @@ class Postman {
'on_plugins_loaded',
) );
+ $active_plugins = (array) get_option( 'active_plugins', array() );
+ if ( in_array( 'sitepress-multilingual-cms/sitepress.php', $active_plugins ) && !get_option( 'postman_wpml_fixed' ) ) {
+ add_action( 'admin_notices', array( $this, 'post_smtp_wpml_admin_notice' ) );
+
+ // Temp: Just a quick solution, need to find a better option.
+ add_action( 'admin_init', array( $this, 'postman_fix_wpml' ) );
+ }
+
// hook on the wp_loaded event
add_action( 'wp_loaded', array(
$this,
@@ -136,6 +144,31 @@ class Postman {
) );
}
+ public function post_smtp_wpml_admin_notice() {
+ $class = 'notice notice-error';
+ $title = __( 'Post SMTP notice!', Postman::TEXT_DOMAIN );
+ $intro = __( 'WPML is installed and has a known bug with Post SMTP and few other plugins.', Postman::TEXT_DOMAIN );
+ $text = __( 'Click here to fix', Postman::TEXT_DOMAIN );
+ $message = '<br><a href="' . esc_url( add_query_arg( 'action', 'postman_fix_wpml', get_permalink() ) ) . '">' . $text . '</a>';
+
+ printf( '<div class="%1$s"><h2>%2$s</h2><p>%3$s</p><p>%4$s</p></div>', esc_attr( $class ), $title, $intro, $message );
+ }
+
+ public function postman_fix_wpml() {
+ if ( isset( $_GET['action'] ) && $_GET['action'] == 'postman_fix_wpml' ) {
+ $wpml_file_path = WP_PLUGIN_DIR . '/sitepress-multilingual-cms/inc/utilities/wpml-data-encryptor.class.php';
+
+ if ( file_exists( $wpml_file_path ) ) {
+ $content = file_get_contents( $wpml_file_path );
+ $content = str_replace( "require_once ABSPATH . '/wp-includes/pluggable.php';", "//require_once ABSPATH . '/wp-includes/pluggable.php';", $content );
+ file_put_contents( $wpml_file_path, $content );
+ }
+
+ update_option( 'postman_wpml_fixed', true );
+ wp_redirect( esc_url( remove_query_arg( 'action' ) ) );
+ }
+ }
+
/**
* Functions to execute on the plugins_loaded event
*