MOON
Server: Apache
System: Linux server30c.hostingraja.org 3.10.0-962.3.2.lve1.5.63.el7.x86_64 #1 SMP Fri Oct 8 12:03:35 UTC 2021 x86_64
User: jibhires (1887)
PHP: 8.1.30
Disabled: show_source, system, shell_exec, passthru, exec, popen, proc_open, allow_url_fopen, symlink, escapeshellcmd, pcntl_exec
Upload Files
File: //proc/self/root/usr/local/sitepad/editor/site-data/plugins/gosmtp-pro/main/notifications/slack.php
<?php

namespace GOSMTP\Notifications;

use GOSMTP\Notifications\Manager;

class Slack extends Manager{

	var $title = 'Slack';
	var $service = 'slack';

	public function send($message){

		$webhook_url = $this->get_option('webhook_url', $this->service);

		if(empty($webhook_url)) return false;

		$headers = [
			'content-type' => 'application/json'
		];

		$message = html_entity_decode($message, ENT_QUOTES, 'UTF-8');

		$body = [
			'text' => $message
		];

		$args = [
			'headers' =>  $headers,
			'body' => json_encode($body)
		];

		return wp_remote_post($webhook_url, $args);
	}
	
	public function load_services_field(){

		$fields = [
			'webhook_url' => [
				'title' => __('Slack Webhook URL', 'gosmtp-pro'),
				'type' => 'password',
				'desc' => sprintf(__('Enter your Slack Webhook URL. %1$s%2$sFollow this link for guide.%3$s', 'gosmtp-pro'),
				'<br>', '<a href="https://gosmtp.net/docs/notifications/slack" target="_blank">', '</a>')
			]
		];

		return $fields;
	}
}