@@ -7,7 +7,7 @@ discard block |
||
7 | 7 | */ |
8 | 8 | |
9 | 9 | // Prevent direct access to the file |
10 | - defined('ABSPATH') or die( __( "Whoops, you shouldn't be accessing this file directly. Abort!" , 'yikes-inc-easy-mailchimp-extender' ) ); |
|
10 | + defined( 'ABSPATH' ) or die( __( "Whoops, you shouldn't be accessing this file directly. Abort!", 'yikes-inc-easy-mailchimp-extender' ) ); |
|
11 | 11 | |
12 | 12 | class Yikes_Easy_MC_EDD_Checkbox_Class extends Yikes_Easy_MC_Checkbox_Integration_Class { |
13 | 13 | |
@@ -21,8 +21,8 @@ discard block |
||
21 | 21 | */ |
22 | 22 | public function __construct() { |
23 | 23 | add_action( 'edd_purchase_form_user_info_fields', array( $this, 'output_checkbox' ) ); |
24 | - add_action( 'edd_insert_payment', array( $this, 'update_payment_post_meta' ) , 99999 ); |
|
25 | - add_action( 'edd_complete_purchase', array( $this, 'subscribe_from_edd_purchase'), 50 ); |
|
24 | + add_action( 'edd_insert_payment', array( $this, 'update_payment_post_meta' ), 99999 ); |
|
25 | + add_action( 'edd_complete_purchase', array( $this, 'subscribe_from_edd_purchase' ), 50 ); |
|
26 | 26 | } |
27 | 27 | |
28 | 28 | |
@@ -30,13 +30,13 @@ discard block |
||
30 | 30 | * Outputs a checkbox |
31 | 31 | */ |
32 | 32 | public function output_checkbox() { |
33 | - if( $this->is_user_already_subscribed( $this->type ) == '1' ) { |
|
33 | + if ( $this->is_user_already_subscribed( $this->type ) == '1' ) { |
|
34 | 34 | return; |
35 | 35 | } |
36 | 36 | // render our field if the user isn't current subscribed |
37 | - echo do_action( 'yikes-mailchimp-before-checkbox' , $this->type ); |
|
37 | + echo do_action( 'yikes-mailchimp-before-checkbox', $this->type ); |
|
38 | 38 | echo $this->yikes_get_checkbox(); |
39 | - echo do_action( 'yikes-mailchimp-after-checkbox' , $this->type ); |
|
39 | + echo do_action( 'yikes-mailchimp-after-checkbox', $this->type ); |
|
40 | 40 | } |
41 | 41 | |
42 | 42 | |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | */ |
48 | 48 | public function update_payment_post_meta( $payment_id = 0, $payment_data = array() ) { |
49 | 49 | // don't save anything if the checkbox was not checked |
50 | - if( ! $this->was_checkbox_checked( $this->type ) ) { |
|
50 | + if ( ! $this->was_checkbox_checked( $this->type ) ) { |
|
51 | 51 | update_post_meta( $payment_id, '_yikes_easy_mc_optin', '0' ); |
52 | 52 | return; |
53 | 53 | } |
@@ -60,25 +60,25 @@ discard block |
||
60 | 60 | * @return bool|string |
61 | 61 | */ |
62 | 62 | public function subscribe_from_edd_purchase( $payment_id ) { |
63 | - $meta = get_post_meta( $payment_id , '_yikes_easy_mc_optin' , true ); |
|
64 | - if( $meta == '0' ) { |
|
63 | + $meta = get_post_meta( $payment_id, '_yikes_easy_mc_optin', true ); |
|
64 | + if ( $meta == '0' ) { |
|
65 | 65 | return false; |
66 | 66 | } |
67 | 67 | $email = (string) edd_get_payment_user_email( $payment_id ); |
68 | 68 | $merge_vars = array(); |
69 | 69 | // add first and last name to merge vars, if given |
70 | 70 | $user_info = (array) edd_get_payment_meta_user_info( $payment_id ); |
71 | - if( isset( $user_info['first_name'] ) && isset( $user_info['last_name'] ) ) { |
|
72 | - $merge_vars['NAME'] = $user_info['first_name'] . ' ' . $user_info['last_name']; |
|
71 | + if ( isset( $user_info[ 'first_name' ] ) && isset( $user_info[ 'last_name' ] ) ) { |
|
72 | + $merge_vars[ 'NAME' ] = $user_info[ 'first_name' ] . ' ' . $user_info[ 'last_name' ]; |
|
73 | 73 | } |
74 | - if( isset( $user_info['first_name'] ) ) { |
|
75 | - $merge_vars['FNAME'] = $user_info['first_name']; |
|
74 | + if ( isset( $user_info[ 'first_name' ] ) ) { |
|
75 | + $merge_vars[ 'FNAME' ] = $user_info[ 'first_name' ]; |
|
76 | 76 | } |
77 | - if( isset( $user_info['last_name'] ) ) { |
|
78 | - $merge_vars['LNAME'] = $user_info['last_name']; |
|
77 | + if ( isset( $user_info[ 'last_name' ] ) ) { |
|
78 | + $merge_vars[ 'LNAME' ] = $user_info[ 'last_name' ]; |
|
79 | 79 | } |
80 | 80 | // subscribe the user |
81 | - $this->subscribe_user_integration( sanitize_email( $email ) , $this->type , $merge_vars ); |
|
81 | + $this->subscribe_user_integration( sanitize_email( $email ), $this->type, $merge_vars ); |
|
82 | 82 | } |
83 | 83 | |
84 | 84 | } |
@@ -6,7 +6,7 @@ discard block |
||
6 | 6 | */ |
7 | 7 | |
8 | 8 | // Prevent direct access to the file |
9 | - defined('ABSPATH') or die( __( "Whoops, you shouldn't be accessing this file directly. Abort!" , 'yikes-inc-easy-mailchimp-extender' ) ); |
|
9 | + defined( 'ABSPATH' ) or die( __( "Whoops, you shouldn't be accessing this file directly. Abort!", 'yikes-inc-easy-mailchimp-extender' ) ); |
|
10 | 10 | |
11 | 11 | class Yikes_Easy_MC_Comment_Checkbox_Class extends Yikes_Easy_MC_Checkbox_Integration_Class { |
12 | 12 | |
@@ -27,12 +27,12 @@ discard block |
||
27 | 27 | * Outputs a checkbox, if user is not already subscribed |
28 | 28 | */ |
29 | 29 | public function output_checkbox( $comment_field ) { |
30 | - if( $this->is_user_already_subscribed( $this->type ) == '1' ) { |
|
30 | + if ( $this->is_user_already_subscribed( $this->type ) == '1' ) { |
|
31 | 31 | return $comment_field; |
32 | 32 | } |
33 | - echo do_action( 'yikes-mailchimp-before-checkbox' , $this->type ); |
|
33 | + echo do_action( 'yikes-mailchimp-before-checkbox', $this->type ); |
|
34 | 34 | echo $comment_field . $this->yikes_get_checkbox(); |
35 | - echo do_action( 'yikes-mailchimp-after-checkbox' , $this->type ); |
|
35 | + echo do_action( 'yikes-mailchimp-after-checkbox', $this->type ); |
|
36 | 36 | } |
37 | 37 | |
38 | 38 | /** |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | * |
42 | 42 | * @since 6.0.0 |
43 | 43 | **/ |
44 | - public function subscribe_from_comment( $comment_id , $comment_approved ) { |
|
44 | + public function subscribe_from_comment( $comment_id, $comment_approved ) { |
|
45 | 45 | // was sign-up checkbox checked? |
46 | 46 | if ( $this->was_checkbox_checked( $this->type ) === false ) { |
47 | 47 | return false; |
@@ -58,7 +58,7 @@ discard block |
||
58 | 58 | 'OPTIN_IP' => $comment_data->comment_author_IP, |
59 | 59 | ); |
60 | 60 | // subscribe the user |
61 | - $this->subscribe_user_integration( sanitize_email( $comment_data->comment_author_email ) , $this->type , $merge_vars ); |
|
61 | + $this->subscribe_user_integration( sanitize_email( $comment_data->comment_author_email ), $this->type, $merge_vars ); |
|
62 | 62 | } |
63 | 63 | |
64 | 64 | } |
@@ -6,7 +6,7 @@ discard block |
||
6 | 6 | */ |
7 | 7 | |
8 | 8 | // Prevent direct access to the file |
9 | - defined('ABSPATH') or die( __( "Whoops, you shouldn't be accessing this file directly. Abort!" , 'yikes-inc-easy-mailchimp-extender' ) ); |
|
9 | + defined( 'ABSPATH' ) or die( __( "Whoops, you shouldn't be accessing this file directly. Abort!", 'yikes-inc-easy-mailchimp-extender' ) ); |
|
10 | 10 | |
11 | 11 | class Yikes_Easy_MC_BuddyPress_Checkbox_Class extends Yikes_Easy_MC_Checkbox_Integration_Class { |
12 | 12 | |
@@ -21,7 +21,7 @@ discard block |
||
21 | 21 | * Outputs a checkbox, if user is not already subscribed |
22 | 22 | */ |
23 | 23 | public function output_checkbox() { |
24 | - if( $this->is_user_already_subscribed( $this->type ) == '1' ) { |
|
24 | + if ( $this->is_user_already_subscribed( $this->type ) == '1' ) { |
|
25 | 25 | return; |
26 | 26 | } |
27 | 27 | ?> |
@@ -8,7 +8,7 @@ discard block |
||
8 | 8 | */ |
9 | 9 | |
10 | 10 | // Prevent direct access to the file |
11 | -defined('ABSPATH') or die( __( "Whoops, you shouldn't be accessing this file directly. Abort!" , 'yikes-inc-easy-mailchimp-extender' ) ); |
|
11 | +defined( 'ABSPATH' ) or die( __( "Whoops, you shouldn't be accessing this file directly. Abort!", 'yikes-inc-easy-mailchimp-extender' ) ); |
|
12 | 12 | |
13 | 13 | class Yikes_Easy_MC_WooCommerce_Checkbox_Class extends Yikes_Easy_MC_Checkbox_Integration_Class { |
14 | 14 | |
@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | */ |
33 | 33 | public function get_position() { |
34 | 34 | $opts = $this->get_options(); |
35 | - return $opts['woocommerce_position']; |
|
35 | + return $opts[ 'woocommerce_position' ]; |
|
36 | 36 | } |
37 | 37 | |
38 | 38 | /** |
@@ -42,22 +42,22 @@ discard block |
||
42 | 42 | */ |
43 | 43 | public function add_checkout_field( $fields ) { |
44 | 44 | // get checkbox data |
45 | - $checkbox_options = get_option( 'optin-checkbox-init' , '' ); |
|
45 | + $checkbox_options = get_option( 'optin-checkbox-init', '' ); |
|
46 | 46 | // only display the field if a list is set |
47 | - if( isset( $checkbox_options ) && $checkbox_options[$this->type]['associated-list'] != '-' ) { |
|
48 | - if( $this->is_user_already_subscribed( $this->type ) == '1' ) { |
|
47 | + if ( isset( $checkbox_options ) && $checkbox_options[ $this->type ][ 'associated-list' ] != '-' ) { |
|
48 | + if ( $this->is_user_already_subscribed( $this->type ) == '1' ) { |
|
49 | 49 | return $fields; |
50 | 50 | } |
51 | - if( isset( $checkbox_options[$this->type]['precheck'] ) && $checkbox_options[$this->type]['precheck'] == 'true' ) { |
|
51 | + if ( isset( $checkbox_options[ $this->type ][ 'precheck' ] ) && $checkbox_options[ $this->type ][ 'precheck' ] == 'true' ) { |
|
52 | 52 | $precheck = '1'; |
53 | 53 | } else { |
54 | 54 | $precheck = '0'; |
55 | 55 | } |
56 | - $fields[ 'billing' ]['yikes_mailchimp_checkbox_'.$this->type] = array( |
|
57 | - 'id' => 'yikes_mailchimp_checkbox_'.$this->type, |
|
56 | + $fields[ 'billing' ][ 'yikes_mailchimp_checkbox_' . $this->type ] = array( |
|
57 | + 'id' => 'yikes_mailchimp_checkbox_' . $this->type, |
|
58 | 58 | 'type' => 'checkbox', |
59 | 59 | 'class' => array(), |
60 | - 'label' => $checkbox_options[$this->type]['label'], |
|
60 | + 'label' => $checkbox_options[ $this->type ][ 'label' ], |
|
61 | 61 | 'default' => $precheck, |
62 | 62 | ); |
63 | 63 | } |
@@ -78,7 +78,7 @@ discard block |
||
78 | 78 | */ |
79 | 79 | public function subscribe_from_woocommerce_checkout( $order_id ) { |
80 | 80 | $do_optin = get_post_meta( $order_id, 'yikes_easy_mailchimp_optin', true ); |
81 | - if( $do_optin == '1' ) { |
|
81 | + if ( $do_optin == '1' ) { |
|
82 | 82 | $order = new WC_Order( $order_id ); |
83 | 83 | $email = $order->billing_email; |
84 | 84 | $merge_vars = array( |
@@ -87,7 +87,7 @@ discard block |
||
87 | 87 | 'LNAME' => $order->billing_last_name, |
88 | 88 | ); |
89 | 89 | // subscribe the user |
90 | - $this->subscribe_user_integration( sanitize_email( $email ) , $this->type , $merge_vars ); |
|
90 | + $this->subscribe_user_integration( sanitize_email( $email ), $this->type, $merge_vars ); |
|
91 | 91 | } |
92 | 92 | return false; |
93 | 93 | } |
@@ -8,7 +8,7 @@ discard block |
||
8 | 8 | */ |
9 | 9 | |
10 | 10 | // Prevent direct access to the file |
11 | -defined('ABSPATH') or die( __( "Whoops, you shouldn't be accessing this file directly. Abort!" , 'yikes-inc-easy-mailchimp-extender' ) ); |
|
11 | +defined( 'ABSPATH' ) or die( __( "Whoops, you shouldn't be accessing this file directly. Abort!", 'yikes-inc-easy-mailchimp-extender' ) ); |
|
12 | 12 | |
13 | 13 | class Yikes_Easy_MC_Registration_Checkbox_Class extends Yikes_Easy_MC_Checkbox_Integration_Class { |
14 | 14 | |
@@ -20,7 +20,7 @@ discard block |
||
20 | 20 | add_action( 'register_form', array( $this, 'output_checkbox' ), 20 ); |
21 | 21 | add_action( 'user_register', array( $this, 'subscribe_from_registration' ), 90, 1 ); |
22 | 22 | // alter the error message, if there was an error with the users email address |
23 | - add_filter( 'wp_login_errors', array( $this , 'yikes_reg_complete_msg' ), 10, 2 ); |
|
23 | + add_filter( 'wp_login_errors', array( $this, 'yikes_reg_complete_msg' ), 10, 2 ); |
|
24 | 24 | } |
25 | 25 | |
26 | 26 | /** |
@@ -51,12 +51,12 @@ discard block |
||
51 | 51 | // build our merge vars |
52 | 52 | $merge_variables = $this->user_merge_vars( $user ); |
53 | 53 | // only subscribe the user if they aren't already on the list |
54 | - if( $this->is_new_registration_already_subscribed( $user->user_email , 'registration_form' ) != '1' ) { |
|
55 | - $this->subscribe_user_integration( sanitize_email( $user->user_email ) , $this->type , $merge_variables ); |
|
54 | + if ( $this->is_new_registration_already_subscribed( $user->user_email, 'registration_form' ) != '1' ) { |
|
55 | + $this->subscribe_user_integration( sanitize_email( $user->user_email ), $this->type, $merge_variables ); |
|
56 | 56 | } else { |
57 | 57 | // add a temporary option to pass our email address and let the user know they are already subscribed |
58 | - $user_already_subscirbed_message = sprintf( __( "You have not been subscribed to our mailing list. %s is already subscribed to this list.", "yikes-inc-easy-mailchimp-extender" ), $user->user_email ); |
|
59 | - add_option( 'yikes_register_subscription_error' , $user_already_subscirbed_message ); |
|
58 | + $user_already_subscirbed_message = sprintf( __( "You have not been subscribed to our mailing list. %s is already subscribed to this list.", "yikes-inc-easy-mailchimp-extender" ), $user->user_email ); |
|
59 | + add_option( 'yikes_register_subscription_error', $user_already_subscirbed_message ); |
|
60 | 60 | } |
61 | 61 | } |
62 | 62 |
@@ -11,7 +11,7 @@ discard block |
||
11 | 11 | */ |
12 | 12 | |
13 | 13 | // Prevent direct access to the file |
14 | -defined('ABSPATH') or die( __( "Whoops, you shouldn't be accessing this file directly. Abort!" , 'yikes-inc-easy-mailchimp-extender' ) ); |
|
14 | +defined( 'ABSPATH' ) or die( __( "Whoops, you shouldn't be accessing this file directly. Abort!", 'yikes-inc-easy-mailchimp-extender' ) ); |
|
15 | 15 | |
16 | 16 | class Yikes_Easy_MC_CF7_Checkbox_Class extends Yikes_Easy_MC_Checkbox_Integration_Class { |
17 | 17 | /** |
@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | // initialize |
27 | 27 | $this->init(); |
28 | 28 | add_action( 'wpcf7_mail_sent', array( $this, 'new_cf7_subscription' ) ); |
29 | - add_action( 'wpcf7_posted_data', array( $this, 'alter_cf7_data') ); |
|
29 | + add_action( 'wpcf7_posted_data', array( $this, 'alter_cf7_data' ) ); |
|
30 | 30 | } |
31 | 31 | |
32 | 32 | /** |
@@ -35,7 +35,7 @@ discard block |
||
35 | 35 | * @return boolean |
36 | 36 | */ |
37 | 37 | public function init() { |
38 | - if( ! function_exists( 'wpcf7_add_shortcode' ) ) { |
|
38 | + if ( ! function_exists( 'wpcf7_add_shortcode' ) ) { |
|
39 | 39 | return false; |
40 | 40 | } |
41 | 41 | wpcf7_add_shortcode( 'yikes_mailchimp_checkbox', array( $this, 'yikes_get_checkbox' ) ); |
@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | * @return array |
52 | 52 | */ |
53 | 53 | public function alter_cf7_data( $data = array() ) { |
54 | - $data['yikes_mailchimp_checkbox'] = $this->was_checkbox_checked( $this->type ) ? __( 'Yes', 'yikes-inc-easy-mailchimp-extender' ) : __( 'No', 'yikes-inc-easy-mailchimp-extender' ); |
|
54 | + $data[ 'yikes_mailchimp_checkbox' ] = $this->was_checkbox_checked( $this->type ) ? __( 'Yes', 'yikes-inc-easy-mailchimp-extender' ) : __( 'No', 'yikes-inc-easy-mailchimp-extender' ); |
|
55 | 55 | return $data; |
56 | 56 | } |
57 | 57 | |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | return false; |
65 | 65 | } |
66 | 66 | // get the integration options |
67 | - $integration_options = get_option( 'optin-checkbox-init' , '' ); |
|
67 | + $integration_options = get_option( 'optin-checkbox-init', '' ); |
|
68 | 68 | // get the contact form 7 submission instance |
69 | 69 | $submission = WPCF7_Submission::get_instance(); |
70 | 70 | // confirm the submission was received |
@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | // get the submission data |
73 | 73 | $posted_data = $submission->get_posted_data(); |
74 | 74 | // store the email -- this needs to be more dynamic (find string with containing string email?) |
75 | - $email = ( isset( $posted_data['your-email'] ) ) ? $posted_data['your-email'] : ''; |
|
75 | + $email = ( isset( $posted_data[ 'your-email' ] ) ) ? $posted_data[ 'your-email' ] : ''; |
|
76 | 76 | // submit this subscriber |
77 | 77 | return $this->subscribe_user_integration( $email, $this->type, apply_filters( 'yikes-mailchimp-contact-form-7', array(), $posted_data ) ); |
78 | 78 | } |
@@ -11,7 +11,7 @@ discard block |
||
11 | 11 | * |
12 | 12 | * @since 6.0.0 |
13 | 13 | */ |
14 | -function yksemeProcessSnippet( $list=false, $submit_text ) { |
|
14 | +function yksemeProcessSnippet( $list = false, $submit_text ) { |
|
15 | 15 | $submit_text = ( isset( $submit_text ) ) ? 'submit="' . $submit_text . '"' : ''; |
16 | 16 | return do_shortcode( '[yikes-mailchimp form="' . $list . '" ' . $submit_text . ']' ); |
17 | 17 | } |
@@ -21,7 +21,7 @@ discard block |
||
21 | 21 | * @since 6.0.3.4 |
22 | 22 | */ |
23 | 23 | function yikes_get_form_data( $form_id ) { |
24 | - if( ! $form_id ) { |
|
24 | + if ( ! $form_id ) { |
|
25 | 25 | return __( 'Whoops, you forgot to specify a form ID.', 'yikes-inc-easy-mailchimp-extender' ); |
26 | 26 | } |
27 | 27 | return Yikes_Inc_Easy_Mailchimp_Extender_Public::yikes_retrieve_form_settings( $form_id ); |
@@ -8,7 +8,7 @@ discard block |
||
8 | 8 | if ( function_exists( 'is_multisite' ) && is_multisite() ) { |
9 | 9 | // users can only unisntall a plugin from the network dashboard page |
10 | 10 | // Get all blog ids |
11 | - $blogids = $wpdb->get_col("SELECT blog_id FROM $wpdb->blogs"); |
|
11 | + $blogids = $wpdb->get_col( "SELECT blog_id FROM $wpdb->blogs" ); |
|
12 | 12 | foreach ( $blogids as $blog_id ) { |
13 | 13 | switch_to_blog( $blog_id ); |
14 | 14 | self::_uninstall_yikes_easy_mailchimp( $wpdb ); |
@@ -28,13 +28,13 @@ discard block |
||
28 | 28 | * @since 6.0.0 |
29 | 29 | */ |
30 | 30 | static function _uninstall_yikes_easy_mailchimp( $wpdb ) { |
31 | - require_once(ABSPATH . 'wp-admin/includes/upgrade.php'); |
|
31 | + require_once( ABSPATH . 'wp-admin/includes/upgrade.php' ); |
|
32 | 32 | /* Clean up and delete our custom table from the databse */ |
33 | - $table = $wpdb->prefix."yikes_easy_mc_forms"; |
|
33 | + $table = $wpdb->prefix . "yikes_easy_mc_forms"; |
|
34 | 34 | $sql = 'DROP TABLE IF EXISTS ' . $table; |
35 | 35 | //Delete any options thats stored also? |
36 | 36 | $wpdb->query( $sql ); |
37 | - dbDelta($sql); |
|
37 | + dbDelta( $sql ); |
|
38 | 38 | /* Clear All Transient Data */ |
39 | 39 | // Delete list data transient data |
40 | 40 | delete_transient( 'yikes-easy-mailchimp-list-data' ); |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | * @return type The collection of actions and filters registered with WordPress. |
87 | 87 | */ |
88 | 88 | private function add( $hooks, $hook, $component, $callback, $priority, $accepted_args ) { |
89 | - $hooks[] = array( |
|
89 | + $hooks[ ] = array( |
|
90 | 90 | 'hook' => $hook, |
91 | 91 | 'component' => $component, |
92 | 92 | 'callback' => $callback, |
@@ -102,10 +102,10 @@ discard block |
||
102 | 102 | */ |
103 | 103 | public function run() { |
104 | 104 | foreach ( $this->filters as $hook ) { |
105 | - add_filter( $hook['hook'], array( $hook['component'], $hook['callback'] ), $hook['priority'], $hook['accepted_args'] ); |
|
105 | + add_filter( $hook[ 'hook' ], array( $hook[ 'component' ], $hook[ 'callback' ] ), $hook[ 'priority' ], $hook[ 'accepted_args' ] ); |
|
106 | 106 | } |
107 | 107 | foreach ( $this->actions as $hook ) { |
108 | - add_action( $hook['hook'], array( $hook['component'], $hook['callback'] ), $hook['priority'], $hook['accepted_args'] ); |
|
108 | + add_action( $hook[ 'hook' ], array( $hook[ 'component' ], $hook[ 'callback' ] ), $hook[ 'priority' ], $hook[ 'accepted_args' ] ); |
|
109 | 109 | } |
110 | 110 | } |
111 | 111 | } |
112 | 112 | \ No newline at end of file |