-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathnotifier-to-slack.php
171 lines (155 loc) · 4.42 KB
/
notifier-to-slack.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
<?php
/**
* Plugin Name: Notifier To Slack
*
* @author wpxpertise, devsabbirahmed
* @copyright 2023- wpxpertise
* @license GPL-2.0-or-later
* @package WP-Notifier-To-Slack
*
* @wordpress-plugin
* Plugin Name: Notifier To Slack
* Plugin URI: https://github.com/wpxpertise/
* Description: Notifier To Slack allows users to receive instant notifications of their plugin activity, review and support requests directly in their Slack workspace.
* Version: 1.9.0
* Requires at least: 5.9
* Requires PHP: 5.6
* Author: WPXpertise
* Author URI: https://github.com/wpxpertise/
* Text Domain: wpnts
* Domain Path: /languages/
* License: GPL-2.0+
* License URI: http://www.gnu.org/licenses/gpl-2.0.txt
*/
// If direct access than exit the file.
defined('ABSPATH') || die('Hey, what are you doing here? You silly human!');
define( 'WP_NOTIFIER_TO_SLACK_VERSION', '1.9.0' );
define( 'WP_NOTIFIER_TO_SLACK__FILE__', __FILE__ );
define( 'WP_NOTIFIER_TO_SLACK_DIR', __DIR__ );
define( 'WP_NOTIFIER_TO_SLACK_DIR_PATH', plugin_dir_path( WP_NOTIFIER_TO_SLACK__FILE__ ) );
define( 'WP_NOTIFIER_TO_SLACK_URL', plugins_url( '', __FILE__ ) );
define( 'WP_NOTIFIER_TO_SLACK_DIR_URL', plugin_dir_url( __FILE__ ) ); // Directory URL.
define( 'WP_NOTIFIER_TO_SLACK_NAME', plugin_dir_url( __FILE__ ) );
if ( file_exists(dirname(__FILE__) . '/vendor/autoload.php') ) {
require_once dirname(__FILE__) . '/vendor/autoload.php';
}
/**
* All Namespace.
*/
use WPNTS\Inc\Ajax\Ajax;
use WPNTS\Inc\Route;
use WPNTS\Inc\Notify;
use WPNTS\Inc\Enqueue;
use WPNTS\Inc\WPUpdate;
use WPNTS\Inc\Activate;
use WPNTS\Inc\Security;
use WPNTS\Inc\DbTables;
use WPNTS\Inc\Deactivate;
use WPNTS\Inc\Database\DB;
use WPNTS\Inc\WooCommerce;
use WPNTS\Inc\PluginUpdate;
use WPNTS\Inc\AdminDashboard;
use WPNTS\Inc\BaseController;
use WPNTS\Inc\NotifierReview;
use WPNTS\Inc\NotifierSupport;
use WPNTS\Inc\SlackAttachment;
if ( ! class_exists('Notifier') ) {
/**
* Main plugin class.
*
* @since 1.0.0
*/
class Notifier {
/**
* Holds the plugin base file
*
* @since 1.0.0
* @var WPNTS
*/
public $WP_NOTIFIER_TO_SLACK;
/**
* Constructor of the plugin.
*
* @since 1.0.0
* @var WPNTS
*/
public function __construct() {
$this->includes();
$this->WP_NOTIFIER_TO_SLACK = plugin_basename(__FILE__);
}
/**
* Register
*/
public function register() {
add_action('plugins_loaded', [ $this, 'wpnts_load' ]);
add_action('activated_plugin', [ $this, 'wpnts_plugin_activation' ]);
}
/**
* Main Plugin Textdomain.
*/
public static function wpnts_load() {
load_plugin_textdomain('wpnts', false,dirname(__FILE__) . 'languages');
}
/**
* Classes instantiating here.
*/
public function includes() {
new AdminDashboard();
$enqueue = new Enqueue();
$enqueue->register();
new BaseController();
new DbTables();
new Route();
//Calling Ajax.
new Ajax();
// Active and Deactivation notification.
$active = new Notify();
// All plugin update notification.
$update = new PluginUpdate();
$update->wpnts_plugin_update_notification();
// WordPress Core version update notification.
$wpupdate = new WPUpdate();
$wpupdate->wpnts_wordpress_core_update();
// Plugin ORG support case notification.
$load_support = new NotifierSupport();
$load_support->wpnts_support_tickets();
// Plugin review notification.
$load_review = new NotifierReview();
$load_review->wpnts_review_tickets();
$woocoomerce_product = new WooCommerce();
$security_acess = new Security();
$slackattachment = new SlackAttachment();
}
/**
* While active the plugin redirect.
*
* @param string $plugin redirect to the dashboard.
* @since 1.0.0
*/
public function wpnts_plugin_activation( $plugin ) {
if ( plugin_basename(__FILE__) == $plugin ) {
wp_redirect(admin_url('admin.php?page=wpnts_notifier'));
die();
}
}
/**
* Activation Hook
*/
public function wpnts_activate() {
Activate::wpnts_activate();
}
/**
* Deactivation Hook
*/
public function wpnts_deactivate() {
Deactivate::wpnts_deactivate();
}
}
/**
* Instantiate an Object Class
*/
$wpnts = new Notifier();
$wpnts->register();
register_activation_hook (WP_NOTIFIER_TO_SLACK__FILE__, [ $wpnts, 'wpnts_activate' ] );
register_deactivation_hook (WP_NOTIFIER_TO_SLACK__FILE__, [ $wpnts, 'wpnts_deactivate' ] );
}