@@ -30,25 +30,26 @@ class Mailjet {
3030 *
3131 * @since 5.0.0
3232 * @access protected
33- * @var Mailjet_Loader $loader Maintains and registers all hooks for the plugin.
33+ * @var Mailjet_Loader $loader Maintains and registers all hooks for the plugin.
3434 */
3535 protected $ loader ;
3636 /**
3737 * The unique identifier of this plugin.
3838 *
3939 * @since 5.0.0
4040 * @access protected
41- * @var string $plugin_name The string used to uniquely identify this plugin.
41+ * @var string $plugin_name The string used to uniquely identify this plugin.
4242 */
4343 protected $ plugin_name ;
4444 /**
4545 * The current version of the plugin.
4646 *
4747 * @since 1.0.0
4848 * @access protected
49- * @var string $version The current version of the plugin.
49+ * @var string $version The current version of the plugin.
5050 */
5151 protected $ version ;
52+
5253 /**
5354 * Define the core functionality of the plugin.
5455 *
@@ -58,7 +59,8 @@ class Mailjet {
5859 *
5960 * @since 5.0.0
6061 */
61- public function __construct () {
62+ public function __construct ()
63+ {
6264 if (\defined ('MAILJET_VERSION ' )) {
6365 $ this ->version = MAILJET_VERSION ;
6466 } else {
@@ -74,16 +76,17 @@ public function __construct() {
7476 $ this ->addMailjetPHPMailer ();
7577 $ this ->registerMailjetWidget ();
7678
77- add_shortcode ('mailjet_form_builder ' , array ( $ this , 'display_mailjet_form_builder_widget ' ));
79+ add_shortcode ('mailjet_form_builder ' , array ($ this , 'display_mailjet_form_builder_widget ' ));
7880 }
7981
8082 /**
81- * @param array $attr
83+ * @param array $attr
8284 * @param string $tag
8385 * @return false|string
8486 */
85- public static function display_mailjet_form_builder_widget ( array $ attr = array (), string $ tag = '' ) {
86- \extract (shortcode_atts (array ( 'widget_id ' => null ), $ attr , $ tag ));
87+ public static function display_mailjet_form_builder_widget (array $ attr = array (), string $ tag = '' )
88+ {
89+ \extract (shortcode_atts (array ('widget_id ' => null ), $ attr , $ tag ));
8790 // GET All Mailjet widgets - to find the one that user actually configured with the shortcode
8891 $ instance = self ::getOption ('mailjet_form_builder_widget_options ' );
8992
@@ -97,9 +100,9 @@ public static function display_mailjet_form_builder_widget( array $attr = array(
97100 }
98101 $ widget_id = min ($ widgetIds );
99102 }
100- if (isset ($ instance [ (int ) $ widget_id ])) {
103+ if (isset ($ instance [(int )$ widget_id ])) {
101104 ob_start ();
102- the_widget ('MailjetWp \\MailjetPlugin \\WidgetFormBuilder \\WP_Mailjet_FormBuilder_Widget ' , $ instance [ (int ) $ widget_id ]);
105+ the_widget ('MailjetWp \\MailjetPlugin \\WidgetFormBuilder \\WP_Mailjet_FormBuilder_Widget ' , $ instance [(int )$ widget_id ]);
103106 return ob_get_clean ();
104107 }
105108
@@ -122,9 +125,11 @@ public static function display_mailjet_form_builder_widget( array $attr = array(
122125 * @since 5.0.0
123126 * @access private
124127 */
125- private function load_dependencies () {
128+ private function load_dependencies ()
129+ {
126130 $ this ->loader = new MailjetLoader ();
127131 }
132+
128133 /**
129134 * Define the locale for this plugin for internationalization.
130135 *
@@ -134,18 +139,21 @@ private function load_dependencies() {
134139 * @since 5.0.0
135140 * @access private
136141 */
137- private function set_locale () {
142+ private function set_locale ()
143+ {
138144 $ plugin_i18n = new Mailjeti18n ();
139145 $ this ->loader ->add_action ('plugins_loaded ' , $ plugin_i18n , 'load_plugin_textdomain ' );
140146 }
147+
141148 /**
142149 * Register all of the hooks related to the admin area functionality
143150 * of the plugin.
144151 *
145152 * @since 1.0.0
146153 * @access private
147154 */
148- private function define_admin_hooks () {
155+ private function define_admin_hooks ()
156+ {
149157 $ plugin_admin = new MailjetAdmin ($ this ->get_plugin_name (), $ this ->get_version ());
150158 $ this ->loader ->add_action ('admin_enqueue_scripts ' , $ plugin_admin , 'enqueue_styles ' );
151159 $ this ->loader ->add_action ('admin_enqueue_scripts ' , $ plugin_admin , 'enqueue_scripts ' );
@@ -163,7 +171,8 @@ private function define_admin_hooks() {
163171 * @since 5.0.0
164172 * @access private
165173 */
166- private function define_public_hooks () {
174+ private function define_public_hooks ()
175+ {
167176 $ plugin_public = new MailjetPublic ($ this ->get_plugin_name (), $ this ->get_version ());
168177 $ this ->loader ->add_action ('wp_enqueue_scripts ' , $ plugin_public , 'enqueue_styles ' );
169178 $ this ->loader ->add_action ('wp_enqueue_scripts ' , $ plugin_public , 'enqueue_scripts ' );
@@ -172,15 +181,17 @@ private function define_public_hooks() {
172181 /**
173182 * @return void
174183 */
175- private function addMailjetMenu (): void {
184+ private function addMailjetMenu (): void
185+ {
176186 $ plugin_menu = new MailjetMenu ();
177187 $ this ->loader ->add_action ('admin_menu ' , $ plugin_menu , 'display_menu ' );
178188 }
179189
180190 /**
181191 * @return void
182192 */
183- private function addMailjetSettings (): void {
193+ private function addMailjetSettings (): void
194+ {
184195 $ plugin_settings = new MailjetSettings ();
185196 $ this ->loader ->add_action ('admin_init ' , $ plugin_settings , 'mailjet_settings_admin_init ' );
186197 $ this ->loader ->add_action ('init ' , $ plugin_settings , 'mailjet_settings_init ' );
@@ -189,7 +200,8 @@ private function addMailjetSettings(): void {
189200 /**
190201 * @return void
191202 */
192- private function addMailjetPHPMailer (): void {
203+ private function addMailjetPHPMailer (): void
204+ {
193205 $ plugin_mails = new MailjetMail ();
194206 $ this ->loader ->add_action ('phpmailer_init ' , $ plugin_mails , 'phpmailer_init_smtp ' );
195207 $ this ->loader ->add_action ('wp_mail_failed ' , $ plugin_mails , 'wp_mail_failed_cb ' );
@@ -198,58 +210,69 @@ private function addMailjetPHPMailer(): void {
198210 /**
199211 * @return void
200212 */
201- private function registerMailjetWidget (): void {
213+ private function registerMailjetWidget (): void
214+ {
202215 $ this ->loader ->add_action ('widgets_init ' , $ this , 'wp_mailjet_register_widgets ' );
203216 }
204217
205218 /**
206219 * @return void
207220 */
208- public function wp_mailjet_register_widgets () {
221+ public function wp_mailjet_register_widgets ()
222+ {
209223 $ widgetFormBuilder = 'MailjetWp \\MailjetPlugin \\WidgetFormBuilder \\WP_Mailjet_FormBuilder_Widget ' ;
210224 register_widget ($ widgetFormBuilder );
211225 }
226+
212227 /**
213228 * Run the loader to execute all of the hooks with WordPress.
214229 *
215230 * @since 5.0.0
216231 */
217- public function run (): void {
232+ public function run (): void
233+ {
218234 $ this ->loader ->run ();
219235 }
236+
220237 /**
221238 * The name of the plugin used to uniquely identify it within the context of
222239 * WordPress and to define internationalization functionality.
223240 *
224- * @since 1.0.0
225241 * @return string The name of the plugin.
242+ * @since 1.0.0
226243 */
227- public function get_plugin_name (): string {
244+ public function get_plugin_name (): string
245+ {
228246 return $ this ->plugin_name ;
229247 }
248+
230249 /**
231250 * The reference to the class that orchestrates the hooks with the plugin.
232251 *
233- * @since 5.0.0
234252 * @return Mailjet_Loader Orchestrates the hooks of the plugin.
253+ * @since 5.0.0
235254 */
236- public function get_loader () {
255+ public function get_loader ()
256+ {
237257 return $ this ->loader ;
238258 }
259+
239260 /**
240261 * Retrieve the version number of the plugin.
241262 *
242- * @since 5.0.0
243263 * @return string The version number of the plugin.
264+ * @since 5.0.0
244265 */
245- public function get_version (): string {
266+ public function get_version (): string
267+ {
246268 return $ this ->version ;
247269 }
248270
249271 /**
250272 * @return void
251273 */
252- private function addWoocommerceActions (): void {
274+ private function addWoocommerceActions (): void
275+ {
253276 $ wooCommerceSettings = WooCommerceSettings::getInstance ();
254277 if (isset ($ _POST ['action ' ]) && $ _POST ['action ' ] === 'order_notification_settings_custom_hook ' ) {
255278 $ wooCommerceSettings ->orders_automation_settings_post ();
@@ -259,14 +282,14 @@ private function addWoocommerceActions(): void {
259282 $ this ->loader ->add_action ('woocommerce_order_status_changed ' , $ wooCommerceSettings , 'order_edata_sync ' , 10 , 1 );
260283 $ this ->loader ->add_action ('woocommerce_cheque_process_payment_order_status ' , $ wooCommerceSettings , 'paid_by_cheque_order_edata_sync ' , 10 , 2 );
261284 }
262- $ activeActions = self ::getOption ('mailjet_wc_active_hooks ' );
285+ $ activeActions = self ::getOption ('mailjet_wc_active_hooks ' );
263286 $ abandonedCartActiveActions = self ::getOption ('mailjet_wc_abandoned_cart_active_hooks ' );
264- if ($ activeActions && ! empty ($ activeActions )) {
287+ if ($ activeActions && !empty ($ activeActions )) {
265288 foreach ($ activeActions as $ action ) {
266289 $ this ->loader ->add_action ($ action ['hook ' ], $ wooCommerceSettings , $ action ['callable ' ], 10 , 2 );
267290 }
268291 }
269- if ($ abandonedCartActiveActions && ! empty ($ abandonedCartActiveActions )) {
292+ if ($ abandonedCartActiveActions && !empty ($ abandonedCartActiveActions )) {
270293 foreach ($ abandonedCartActiveActions as $ action ) {
271294 $ this ->loader ->add_action ($ action ['hook ' ], $ wooCommerceSettings , $ action ['callable ' ], 10 , 2 );
272295 }
@@ -277,8 +300,9 @@ private function addWoocommerceActions(): void {
277300 * @param string $key
278301 * @return mixed
279302 */
280- public static function getOption ( string $ key ) {
281- if ( ! is_multisite ()) {
303+ public static function getOption (string $ key )
304+ {
305+ if (!is_multisite ()) {
282306 return get_option ($ key );
283307 }
284308
0 commit comments