PluginProbe
Texty – SMS Notification for WordPress, WooCommerce, Dokan and more / 1.1.4
Texty – SMS Notification for WordPress, WooCommerce, Dokan and more v1.1.4
2.0.2 trunk 0.2 1.0 1.1 1.1.1 1.1.2 1.1.3 1.1.4 1.1.5 2.0.0 2.0.1
texty / texty.php

texty.php in Texty – SMS Notification for WordPress, WooCommerce, Dokan and more 1.1.4, at texty.php

165 lines 3.3 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Plugin Name: Texty
4 * Description: SMS Notification for WordPress
5 * Plugin URI: https://wordpress.org/plugins/texty/
6 * Author: weDevs
7 * Author URI: https://wptexty.com/
8 * Version: 1.1.4
9 * License: GPL2 or later
10 * License URI: https://www.gnu.org/licenses/gpl-2.0.html
11 * Text Domain: texty
12 */
13 defined( 'ABSPATH' ) || exit;
14
15 require __DIR__ . '/vendor/autoload.php';
16
17 /**
18 * Texty Class
19 */
20 final class Texty {
21
22 /**
23 * Plugin version
24 *
25 * @var string
26 */
27 private $version = '1.1.4';
28
29 /**
30 * Instances array
31 *
32 * @var array
33 */
34 private $instances = [];
35
36 /**
37 * Initialize
38 */
39 public function __construct() {
40 $this->define_constants();
41 $this->appsero_init();
42
43 // run the installer
44 register_activation_hook( __FILE__, [ $this, 'activate' ] );
45
46 // load the plugin
47 add_action( 'plugins_loaded', [ $this, 'init_plugin' ] );
48 }
49
50 /**
51 * Initializes the Texty class
52 *
53 * Checks for an existing Texty instance
54 * and if it doesn't find one, creates it.
55 */
56 public static function instance() {
57 static $instance = false;
58
59 if ( ! $instance ) {
60 $instance = new self();
61 }
62
63 return $instance;
64 }
65
66 /**
67 * Initialize the plugin
68 *
69 * @return void
70 */
71 public function init_plugin() {
72 if ( is_admin() ) {
73 new Texty\Admin();
74 }
75
76 new Texty\Api();
77 new Texty\Dispatcher();
78 }
79
80 /**
81 * Define constants
82 *
83 * @return void
84 */
85 private function define_constants() {
86 define( 'TEXTY_VERSION', $this->version );
87 define( 'TEXTY_DIR', __DIR__ );
88 define( 'TEXTY_FILE', __FILE__ );
89 define( 'TEXTY_URL', plugins_url( '', __FILE__ ) );
90 }
91
92 /**
93 * Run the installer
94 *
95 * @return void
96 */
97 public function activate() {
98 $installer = new Texty\Install();
99 $installer->run();
100 }
101
102 /**
103 * Access to gateway manager
104 *
105 * @return Texty\Gateways
106 */
107 public function gateways() {
108 if ( ! isset( $this->instances['gateway'] ) ) {
109 $this->instances['gateway'] = new \Texty\Gateways();
110 }
111
112 return $this->instances['gateway'];
113 }
114
115 /**
116 * Access to gateway manager
117 *
118 * @return Texty\Settings
119 */
120 public function settings() {
121 if ( ! isset( $this->instances['settings'] ) ) {
122 $this->instances['settings'] = new \Texty\Settings();
123 }
124
125 return $this->instances['settings'];
126 }
127
128 /**
129 * Access to gateway manager
130 *
131 * @return Texty\Notifications
132 */
133 public function notifications() {
134 if ( ! isset( $this->instances['notification'] ) ) {
135 $this->instances['notification'] = new \Texty\Notifications();
136 }
137
138 return $this->instances['notification'];
139 }
140
141 /**
142 * Initialize the plugin tracker
143 *
144 * @return void
145 */
146 public function appsero_init() {
147 $client = new Appsero\Client( 'd4c17b0f-8f01-4b95-a8de-42b0641eec9a', 'Texty', __FILE__ );
148
149 // Active insights
150 $client->insights()->init();
151 }
152 }
153
154 /**
155 * Return the instance
156 *
157 * @return \Texty
158 */
159 function texty() {
160 return Texty::instance();
161 }
162
163 // take off
164 texty();
165