summaryrefslogtreecommitdiff
path: root/Postman/notifications
diff options
context:
space:
mode:
authoryehudah <yehudah@b8457f37-d9ea-0310-8a92-e5e31aec5664>2019-11-25 07:50:30 +0000
committeryehudah <yehudah@b8457f37-d9ea-0310-8a92-e5e31aec5664>2019-11-25 07:50:30 +0000
commit907ce8c044159ca8da6ccce3ec5362ac61e7c142 (patch)
tree4e4b83a3aa041a1826e4ac876b001195fce3f7c2 /Postman/notifications
parenta41b9219a66f4018dc581f561fbe3fedd24e73f2 (diff)
downloadPost-SMTP-907ce8c044159ca8da6ccce3ec5362ac61e7c142.zip
deleted by mistake
Diffstat (limited to 'Postman/notifications')
-rw-r--r--Postman/notifications/INotify.php7
-rw-r--r--Postman/notifications/PostmanMailNotify.php14
-rw-r--r--Postman/notifications/PostmanNotify.php42
-rw-r--r--Postman/notifications/PostmanPushoverNotify.php34
-rw-r--r--Postman/notifications/PostmanSlackNotify.php39
5 files changed, 0 insertions, 136 deletions
diff --git a/Postman/notifications/INotify.php b/Postman/notifications/INotify.php
deleted file mode 100644
index f40548d..0000000
--- a/Postman/notifications/INotify.php
+++ /dev/null
@@ -1,7 +0,0 @@
-<?php
-if ( ! defined( 'ABSPATH' ) ) {
- exit; // Exit if accessed directly
-}
-interface Postman_Notify {
- public function send_message( $message );
-} \ No newline at end of file
diff --git a/Postman/notifications/PostmanMailNotify.php b/Postman/notifications/PostmanMailNotify.php
deleted file mode 100644
index 922c304..0000000
--- a/Postman/notifications/PostmanMailNotify.php
+++ /dev/null
@@ -1,14 +0,0 @@
-<?php
-if ( ! defined( 'ABSPATH' ) ) {
- exit; // Exit if accessed directly
-}
-class PostmanMailNotify implements Postman_Notify {
-
- public function send_message($message)
- {
- $to_email = apply_filters( 'post_smtp_notify_email',get_bloginfo( 'admin_email' ) );
- $domain = get_bloginfo( 'url' );
-
- mail( $to_email, "{$domain}: " . __( 'Post SMTP email error', 'post-smtp' ), $message , '', "-f{$to_email}" );
- }
-} \ No newline at end of file
diff --git a/Postman/notifications/PostmanNotify.php b/Postman/notifications/PostmanNotify.php
deleted file mode 100644
index 7654ecb..0000000
--- a/Postman/notifications/PostmanNotify.php
+++ /dev/null
@@ -1,42 +0,0 @@
-<?php
-if ( ! defined( 'ABSPATH' ) ) {
- exit; // Exit if accessed directly
-}
-require_once 'INotify.php';
-require_once 'PostmanMailNotify.php';
-require_once 'PostmanPushoverNotify.php';
-require_once 'PostmanSlackNotify.php';
-
-class PostmanNotify {
- private $notify;
-
- public function __construct( Postman_Notify $notify ) {
- $this->notify = $notify;
- }
-
- public function send( $message, $log ) {
- $this->notify->send_message( $message );
- }
-
- public function push_to_chrome($message) {
- $push_chrome = PostmanOptions::getInstance()->useChromeExtension();
-
- if ( $push_chrome ) {
- $uid = PostmanOptions::getInstance()->getNotificationChromeUid();
-
- if ( empty( $uid ) ) {
- return;
- }
-
- $url = 'https://postmansmtp.com/chrome/' . $uid;
-
- $args = array(
- 'body' => array(
- 'message' => $message
- )
- );
-
- $response = wp_remote_post( $url , $args );
- }
- }
-} \ No newline at end of file
diff --git a/Postman/notifications/PostmanPushoverNotify.php b/Postman/notifications/PostmanPushoverNotify.php
deleted file mode 100644
index 14ef7d2..0000000
--- a/Postman/notifications/PostmanPushoverNotify.php
+++ /dev/null
@@ -1,34 +0,0 @@
-<?php
-if ( ! defined( 'ABSPATH' ) ) {
- exit; // Exit if accessed directly
-}
-class PostmanPushoverNotify implements Postman_Notify {
-
- public function send_message($message)
- {
- $options = PostmanOptions::getInstance();
-
- $api_url = "https://api.pushover.net/1/messages.json";
- $app_token = $options->getPushoverToken();
- $user_key = $options->getPushoverUser();
-
- $args = array(
- 'body' => array(
- "token" => $app_token,
- "user" => $user_key,
- "message" => $message,
- )
- );
-
- $result = wp_remote_post( $api_url, $args );
-
- if ( is_wp_error($result) ) {
- error_log( __CLASS__ . ': ' . $result->get_error_message() );
- }
-
- $body = json_decode( wp_remote_retrieve_body( $result ), true );
- if ( $body['status'] == 0 ) {
- error_log( __CLASS__ . ': ' . print_r( $body, true ) );
- }
- }
-} \ No newline at end of file
diff --git a/Postman/notifications/PostmanSlackNotify.php b/Postman/notifications/PostmanSlackNotify.php
deleted file mode 100644
index 5b6fae3..0000000
--- a/Postman/notifications/PostmanSlackNotify.php
+++ /dev/null
@@ -1,39 +0,0 @@
-<?php
-if ( ! defined( 'ABSPATH' ) ) {
- exit; // Exit if accessed directly
-}
-class PostmanSlackNotify implements Postman_Notify {
-
- public function send_message($message)
- {
- $options = PostmanOptions::getInstance();
-
- $api_url = $options->getSlackToken();
-
- $headers = array(
- 'content-type' => 'application/json'
- );
-
- $body = array(
- 'text' => $message
- );
-
- $args = array(
- 'headers' => $headers,
- 'body' => json_encode($body)
- );
-
- $result = wp_remote_post( $api_url, $args );
-
- if ( is_wp_error($result) ) {
- error_log( __CLASS__ . ': ' . $result->get_error_message() );
- }
-
- $code = wp_remote_retrieve_response_code( $result );
- $message = wp_remote_retrieve_response_message( $result );
-
- if ( $code != 200 && $message !== 'OK' ) {
- error_log( __CLASS__ . ': ' . $message );
- }
- }
-} \ No newline at end of file