@@ -115,7 +115,7 @@ |
||
| 115 | 115 | if ( ! empty( $all_forms ) ) {
|
| 116 | 116 | // build an array to pass to our javascript |
| 117 | 117 | foreach ( $all_forms as $id => $form ) {
|
| 118 | - $lists[ $form['form_name'] ] = $id; |
|
| 118 | + $lists[ $form[ 'form_name' ] ] = $id; |
|
| 119 | 119 | } |
| 120 | 120 | } else {
|
| 121 | 121 | $lists[ __( 'Please Import Some Mailchimp Lists', 'yikes-inc-easy-mailchimp-extender' ) ] = '-'; |
@@ -5,18 +5,18 @@ discard block |
||
| 5 | 5 | * @since 6.0.3 |
| 6 | 6 | */ |
| 7 | 7 | |
| 8 | -class YIKES_Mailchimp_Visual_Composer_Extension {
|
|
| 8 | +class YIKES_Mailchimp_Visual_Composer_Extension { |
|
| 9 | 9 | |
| 10 | 10 | /** |
| 11 | 11 | * Constructor |
| 12 | 12 | * |
| 13 | 13 | * @since 6.0.3 |
| 14 | 14 | */ |
| 15 | - function __construct() {
|
|
| 15 | + function __construct() { |
|
| 16 | 16 | |
| 17 | 17 | add_action( 'admin_init', array( $this, 'extend_visual_composer' ) ); |
| 18 | 18 | |
| 19 | - if ( function_exists( 'vc_add_shortcode_param' ) ) {
|
|
| 19 | + if ( function_exists( 'vc_add_shortcode_param' ) ) { |
|
| 20 | 20 | vc_add_shortcode_param( 'yikes_mailchimp_logo', array( $this, 'yikes_mailchimp_logo_vc_section' ) ); |
| 21 | 21 | } |
| 22 | 22 | } |
@@ -26,9 +26,9 @@ discard block |
||
| 26 | 26 | * |
| 27 | 27 | * @since 6.0.3 |
| 28 | 28 | */ |
| 29 | - public function extend_visual_composer() {
|
|
| 29 | + public function extend_visual_composer() { |
|
| 30 | 30 | |
| 31 | - if ( ! function_exists( 'vc_map' ) ) {
|
|
| 31 | + if ( ! function_exists( 'vc_map' ) ) { |
|
| 32 | 32 | return; |
| 33 | 33 | } |
| 34 | 34 | |
@@ -98,7 +98,7 @@ discard block |
||
| 98 | 98 | * |
| 99 | 99 | * @since 6.0.3 |
| 100 | 100 | */ |
| 101 | - public function yikes_mailchimp_logo_vc_section() {
|
|
| 101 | + public function yikes_mailchimp_logo_vc_section() { |
|
| 102 | 102 | return '<img style="width:250px;display:block;margin:0 auto;" src="' . YIKES_MC_URL . 'includes/images/Mailchimp_Assets/mailchimp-logo.png" title="' . __( 'Easy Forms for Mailchimp', 'yikes-inc-easy-mailchimp-extender' ) . '" />'; |
| 103 | 103 | } |
| 104 | 104 | |
@@ -107,17 +107,17 @@ discard block |
||
| 107 | 107 | * |
| 108 | 108 | * @since 6.0.3 |
| 109 | 109 | */ |
| 110 | - public function yikes_mailchimp_retreive_user_created_forms() {
|
|
| 110 | + public function yikes_mailchimp_retreive_user_created_forms() { |
|
| 111 | 111 | $interface = yikes_easy_mailchimp_extender_get_form_interface(); |
| 112 | 112 | $all_forms = $interface->get_all_forms(); |
| 113 | 113 | |
| 114 | 114 | $lists = array(); |
| 115 | - if ( ! empty( $all_forms ) ) {
|
|
| 115 | + if ( ! empty( $all_forms ) ) { |
|
| 116 | 116 | // build an array to pass to our javascript |
| 117 | - foreach ( $all_forms as $id => $form ) {
|
|
| 117 | + foreach ( $all_forms as $id => $form ) { |
|
| 118 | 118 | $lists[ $form['form_name'] ] = $id; |
| 119 | 119 | } |
| 120 | - } else {
|
|
| 120 | + } else { |
|
| 121 | 121 | $lists[ __( 'Please Import Some Mailchimp Lists', 'yikes-inc-easy-mailchimp-extender' ) ] = '-'; |
| 122 | 122 | } |
| 123 | 123 | |
@@ -103,7 +103,7 @@ discard block |
||
| 103 | 103 | * @return array|WP_Error |
| 104 | 104 | */ |
| 105 | 105 | public function patch( $path = '', $headers = array(), $params = array() ) { |
| 106 | - if ( ! isset( $params['body'] ) ) { |
|
| 106 | + if ( ! isset( $params[ 'body' ] ) ) { |
|
| 107 | 107 | return new WP_Error( |
| 108 | 108 | 'yikesinc_eme_missing_body', |
| 109 | 109 | sprintf( |
@@ -130,7 +130,7 @@ discard block |
||
| 130 | 130 | * @return array|WP_Error |
| 131 | 131 | */ |
| 132 | 132 | public function post( $path = '', $headers = array(), $params = array() ) { |
| 133 | - if ( ! isset( $params['body'] ) ) { |
|
| 133 | + if ( ! isset( $params[ 'body' ] ) ) { |
|
| 134 | 134 | return new WP_Error( |
| 135 | 135 | 'yikesinc_eme_missing_body', |
| 136 | 136 | sprintf( |
@@ -157,7 +157,7 @@ discard block |
||
| 157 | 157 | * @return array|WP_Error |
| 158 | 158 | */ |
| 159 | 159 | public function put( $path = '', $headers = array(), $params = array() ) { |
| 160 | - if ( ! isset( $params['body'] ) ) { |
|
| 160 | + if ( ! isset( $params[ 'body' ] ) ) { |
|
| 161 | 161 | return new WP_Error( |
| 162 | 162 | 'yikesinc_eme_missing_body', |
| 163 | 163 | sprintf( |
@@ -288,13 +288,13 @@ discard block |
||
| 288 | 288 | $authorized_args = $this->get_authorized_args(); |
| 289 | 289 | |
| 290 | 290 | // If we have body data, maybe convert it to JSON. |
| 291 | - if ( isset( $params['body'] ) && ( is_array( $params['body'] ) || is_object( $params['body'] ) ) ) { |
|
| 292 | - $params['body'] = json_encode( wp_parse_args( $authorized_args['body'], $params['body'] ) ); |
|
| 293 | - $headers['Content-Type'] = 'application/json'; |
|
| 291 | + if ( isset( $params[ 'body' ] ) && ( is_array( $params[ 'body' ] ) || is_object( $params[ 'body' ] ) ) ) { |
|
| 292 | + $params[ 'body' ] = json_encode( wp_parse_args( $authorized_args[ 'body' ], $params[ 'body' ] ) ); |
|
| 293 | + $headers[ 'Content-Type' ] = 'application/json'; |
|
| 294 | 294 | } |
| 295 | 295 | |
| 296 | 296 | // Combine the given headers and auth headers |
| 297 | - $headers = wp_parse_args( $authorized_args['headers'], $headers ); |
|
| 297 | + $headers = wp_parse_args( $authorized_args[ 'headers' ], $headers ); |
|
| 298 | 298 | /** |
| 299 | 299 | * Filter the headers used for a request to the Mailchimp API. |
| 300 | 300 | * |
@@ -358,12 +358,12 @@ discard block |
||
| 358 | 358 | |
| 359 | 359 | // Version 2.0 uses body authorization |
| 360 | 360 | if ( version_compare( '3.0', $this->api_version, '>' ) ) { |
| 361 | - $args['body'] = $this->get_auth_body(); |
|
| 361 | + $args[ 'body' ] = $this->get_auth_body(); |
|
| 362 | 362 | } |
| 363 | 363 | |
| 364 | 364 | // Version 3.0 uses authorization headers. |
| 365 | 365 | if ( version_compare( '3.0', $this->api_version, '<=' ) ) { |
| 366 | - $args['headers'] = $this->get_auth_headers(); |
|
| 366 | + $args[ 'headers' ] = $this->get_auth_headers(); |
|
| 367 | 367 | } |
| 368 | 368 | |
| 369 | 369 | return $args; |
@@ -3,18 +3,18 @@ |
||
| 3 | 3 | - Clear Mailchimp transient data such as forms, form fields, list data, subscribers etc. |
| 4 | 4 | * transient cache is stored for 60 minutes. |
| 5 | 5 | --> |
| 6 | -<h3><span><?php _e( 'API Cache Settings' , 'yikes-inc-easy-mailchimp-extender' ); ?></span></h3> |
|
| 6 | +<h3><span><?php _e( 'API Cache Settings', 'yikes-inc-easy-mailchimp-extender' ); ?></span></h3> |
|
| 7 | 7 | <div class="inside"> |
| 8 | 8 | |
| 9 | 9 | <!-- Settings Form --> |
| 10 | - <form action="<?php echo esc_url_raw( add_query_arg( array( 'action' => 'yikes-easy-mc-clear-transient-data' , 'nonce' => wp_create_nonce( 'clear-mc-transient-data' ) ) ) ); ?>" method="post"> |
|
| 10 | + <form action="<?php echo esc_url_raw( add_query_arg( array( 'action' => 'yikes-easy-mc-clear-transient-data', 'nonce' => wp_create_nonce( 'clear-mc-transient-data' ) ) ) ); ?>" method="post"> |
|
| 11 | 11 | |
| 12 | - <p><?php _e( "Delete all Mailchimp data stored in your sites cache. Most data is stored in the cache for 1 hour." , 'yikes-inc-easy-mailchimp-extender' ); ?></p> |
|
| 12 | + <p><?php _e( "Delete all Mailchimp data stored in your sites cache. Most data is stored in the cache for 1 hour.", 'yikes-inc-easy-mailchimp-extender' ); ?></p> |
|
| 13 | 13 | <!-- check if any of our transients contain data --> |
| 14 | 14 | <?php if ( false === get_transient( 'yikes-easy-mailchimp-list-data' ) && false === get_transient( 'yikes-easy-mailchimp-profile-data' ) && false === get_transient( 'yikes-easy-mailchimp-account-data' ) && false === get_transient( 'yikesinc_eme_list_ids' ) && false === get_transient( 'yikes_eme_lists' ) ) { ?> |
| 15 | - <p><a href="#" class="button-secondary" disabled="disabled" title="<?php _e( 'No Mailchimp data found in temporary cache storage.' , 'yikes-inc-easy-mailchimp-extender' ); ?>"><?php _e( 'Clear Mailchimp API Cache' , 'yikes-inc-easy-mailchimp-extender' ); ?></a></p> |
|
| 15 | + <p><a href="#" class="button-secondary" disabled="disabled" title="<?php _e( 'No Mailchimp data found in temporary cache storage.', 'yikes-inc-easy-mailchimp-extender' ); ?>"><?php _e( 'Clear Mailchimp API Cache', 'yikes-inc-easy-mailchimp-extender' ); ?></a></p> |
|
| 16 | 16 | <?php } else { ?> |
| 17 | - <p><input type="submit" class="button-primary" value="<?php _e( 'Clear Mailchimp API Cache' , 'yikes-inc-easy-mailchimp-extender' ); ?>" /></p> |
|
| 17 | + <p><input type="submit" class="button-primary" value="<?php _e( 'Clear Mailchimp API Cache', 'yikes-inc-easy-mailchimp-extender' ); ?>" /></p> |
|
| 18 | 18 | <?php } ?> |
| 19 | 19 | |
| 20 | 20 | </form> |
@@ -54,23 +54,23 @@ discard block |
||
| 54 | 54 | |
| 55 | 55 | // Easy Digital Downloads. |
| 56 | 56 | if ( class_exists( 'Easy_Digital_Downloads' ) ) {
|
| 57 | - $active_plugins['easy_digital_downloads_checkout_form'] = __( 'Easy Digital Downloads Checkout', 'yikes-inc-easy-mailchimp-extender' ); |
|
| 57 | + $active_plugins[ 'easy_digital_downloads_checkout_form' ] = __( 'Easy Digital Downloads Checkout', 'yikes-inc-easy-mailchimp-extender' ); |
|
| 58 | 58 | } |
| 59 | 59 | // WooCommerce. |
| 60 | 60 | if ( class_exists( 'WooCommerce' ) ) {
|
| 61 | - $active_plugins['woocommerce_checkout_form'] = __( 'WooCommerce Checkout', 'yikes-inc-easy-mailchimp-extender' ); |
|
| 61 | + $active_plugins[ 'woocommerce_checkout_form' ] = __( 'WooCommerce Checkout', 'yikes-inc-easy-mailchimp-extender' ); |
|
| 62 | 62 | } |
| 63 | 63 | // BuddyPress. |
| 64 | 64 | if ( class_exists( 'BuddyPress' ) ) {
|
| 65 | - $active_plugins['buddypress_form'] = __( 'BuddyPress Registration', 'yikes-inc-easy-mailchimp-extender' ); |
|
| 65 | + $active_plugins[ 'buddypress_form' ] = __( 'BuddyPress Registration', 'yikes-inc-easy-mailchimp-extender' ); |
|
| 66 | 66 | } |
| 67 | 67 | // bbPress. |
| 68 | 68 | if ( class_exists( 'bbPress' ) ) {
|
| 69 | - $active_plugins['bbpress_forms'] = __( 'bbPress', 'yikes-inc-easy-mailchimp-extender' ); |
|
| 69 | + $active_plugins[ 'bbpress_forms' ] = __( 'bbPress', 'yikes-inc-easy-mailchimp-extender' ); |
|
| 70 | 70 | } |
| 71 | 71 | // Contact Form 7. |
| 72 | 72 | if ( is_plugin_active( 'contact-form-7/wp-contact-form-7.php' ) ) {
|
| 73 | - $active_plugins['contact_form_7'] = __( 'Contact Form 7', 'yikes-inc-easy-mailchimp-extender' ); |
|
| 73 | + $active_plugins[ 'contact_form_7' ] = __( 'Contact Form 7', 'yikes-inc-easy-mailchimp-extender' ); |
|
| 74 | 74 | } |
| 75 | 75 | |
| 76 | 76 | // store our checkbox options. |
@@ -87,7 +87,7 @@ discard block |
||
| 87 | 87 | $error_logging = new Yikes_Inc_Easy_Mailchimp_Error_Logging(); |
| 88 | 88 | $error_logging->maybe_write_to_log( |
| 89 | 89 | $list_data->get_error_code(), |
| 90 | - __( "Get Account Lists" , 'yikes-inc-easy-mailchimp-extender' ), |
|
| 90 | + __( "Get Account Lists", 'yikes-inc-easy-mailchimp-extender' ), |
|
| 91 | 91 | "Integration Settings Page" |
| 92 | 92 | ); |
| 93 | 93 | } |
@@ -118,26 +118,26 @@ discard block |
||
| 118 | 118 | <?php |
| 119 | 119 | if ( ! empty( $active_plugins ) ) {
|
| 120 | 120 | |
| 121 | - foreach( $active_plugins as $class => $value ) {
|
|
| 121 | + foreach ( $active_plugins as $class => $value ) {
|
|
| 122 | 122 | |
| 123 | - $checked = isset( $options[$class]['value'] ) ? 'checked="checked"' : ''; |
|
| 124 | - $hidden = ! isset( $options[$class]['value'] ) ? 'yikes-easy-mc-hidden' : ''; |
|
| 125 | - $checkbox_label = isset( $options[$class]['label'] ) ? esc_attr( $options[$class]['label'] ) : ''; |
|
| 126 | - $precheck_checkbox = isset( $options[$class]['precheck'] ) ? $options[$class]['precheck'] : ''; |
|
| 127 | - $selected_list = isset( $options[$class]['associated-list'] ) ? $options[$class]['associated-list'] : '-'; |
|
| 128 | - $list_interest_groups = isset( $options[$class]['interest-groups'] ) ? $options[$class]['interest-groups'] : false; |
|
| 123 | + $checked = isset( $options[ $class ][ 'value' ] ) ? 'checked="checked"' : ''; |
|
| 124 | + $hidden = ! isset( $options[ $class ][ 'value' ] ) ? 'yikes-easy-mc-hidden' : ''; |
|
| 125 | + $checkbox_label = isset( $options[ $class ][ 'label' ] ) ? esc_attr( $options[ $class ][ 'label' ] ) : ''; |
|
| 126 | + $precheck_checkbox = isset( $options[ $class ][ 'precheck' ] ) ? $options[ $class ][ 'precheck' ] : ''; |
|
| 127 | + $selected_list = isset( $options[ $class ][ 'associated-list' ] ) ? $options[ $class ][ 'associated-list' ] : '-'; |
|
| 128 | + $list_interest_groups = isset( $options[ $class ][ 'interest-groups' ] ) ? $options[ $class ][ 'interest-groups' ] : false; |
|
| 129 | 129 | |
| 130 | 130 | // Force the selected list to be an array (@since 6.4). |
| 131 | 131 | $selected_list = is_array( $selected_list ) ? $selected_list : array( $selected_list ); |
| 132 | 132 | ?> |
| 133 | 133 | <li class="yikes-mailchimp-checkbox-integration-item"> |
| 134 | 134 | <label> |
| 135 | - <input type="checkbox" name="optin-checkbox-init[<?php echo $class; ?>][value]" value="on" <?php echo $checked; ?> onclick="jQuery(this).parents('li').next().stop().slideToggle();"><?php echo ucwords( $value ); ?><span class="dashicons dashicons-editor-help"></span><div class="tooltiptext qtip-bootstrap" style="display:none;"><?php echo $class_descriptions[$class]; ?></div>
|
|
| 135 | + <input type="checkbox" name="optin-checkbox-init[<?php echo $class; ?>][value]" value="on" <?php echo $checked; ?> onclick="jQuery(this).parents('li').next().stop().slideToggle();"><?php echo ucwords( $value ); ?><span class="dashicons dashicons-editor-help"></span><div class="tooltiptext qtip-bootstrap" style="display:none;"><?php echo $class_descriptions[ $class ]; ?></div>
|
|
| 136 | 136 | </label> |
| 137 | 137 | </li> |
| 138 | 138 | <!-- checkbox settings, text - associated list etc. --> |
| 139 | 139 | <li class="optin-checkbox-init[<?php echo $class; ?>]-settings <?php echo $hidden; ?>"> |
| 140 | - <?php if( $class == 'contact_form_7' ) { ?>
|
|
| 140 | + <?php if ( $class == 'contact_form_7' ) { ?>
|
|
| 141 | 141 | <p style="margin-top:0;"><small class="contact-form-7-notice"><?php printf( __( 'Use %s in Contact Form 7 to display the checkbox.', 'yikes-inc-easy-mailchimp-extender' ), '<code>[yikes_mailchimp_checkbox]</code>' ); ?></small></p> |
| 142 | 142 | <?php } ?> |
| 143 | 143 | <p style="margin-top:0;padding-top:0;margin-bottom:0;padding-bottom:0;"> |
@@ -147,24 +147,24 @@ discard block |
||
| 147 | 147 | <?php |
| 148 | 148 | if ( count( $list_data ) > 0 ) {
|
| 149 | 149 | ?> |
| 150 | - <?php foreach( $list_data as $list ) { ?>
|
|
| 150 | + <?php foreach ( $list_data as $list ) { ?>
|
|
| 151 | 151 | |
| 152 | 152 | <?php |
| 153 | - $list_interest_groups = isset( $list_interest_groups[ $list['id'] ] ) ? $list_interest_groups[ $list['id'] ] : $list_interest_groups; |
|
| 153 | + $list_interest_groups = isset( $list_interest_groups[ $list[ 'id' ] ] ) ? $list_interest_groups[ $list[ 'id' ] ] : $list_interest_groups; |
|
| 154 | 154 | ?> |
| 155 | 155 | |
| 156 | - <label class="yikes-mailchimp-checkbox-integration-list" for="list-<?php echo $class ?>-<?php echo $list['id']; ?>"> |
|
| 156 | + <label class="yikes-mailchimp-checkbox-integration-list" for="list-<?php echo $class ?>-<?php echo $list[ 'id' ]; ?>"> |
|
| 157 | 157 | <input type="checkbox" class="checkbox-settings-list-item" data-integration="<?php echo $class; ?>" |
| 158 | 158 | name="optin-checkbox-init[<?php echo $class; ?>][associated-list][]" |
| 159 | - value="<?php echo $list['id']; ?>" <?php echo in_array( $list['id'], $selected_list ) ? 'checked="checked"' : ''; ?> |
|
| 160 | - id="list-<?php echo $class ?>-<?php echo $list['id']; ?>"> |
|
| 161 | - <?php echo $list['name']; ?> |
|
| 159 | + value="<?php echo $list[ 'id' ]; ?>" <?php echo in_array( $list[ 'id' ], $selected_list ) ? 'checked="checked"' : ''; ?> |
|
| 160 | + id="list-<?php echo $class ?>-<?php echo $list[ 'id' ]; ?>"> |
|
| 161 | + <?php echo $list[ 'name' ]; ?> |
|
| 162 | 162 | </label> |
| 163 | 163 | |
| 164 | 164 | <!-- If interest groups have been selected already, load them here --> |
| 165 | 165 | <?php |
| 166 | - if ( in_array( $list['id'], $selected_list ) && $list_interest_groups ) {
|
|
| 167 | - YIKES_Inc_Easy_Mailchimp_Process_Ajax::check_list_for_interest_groups( $list['id'], $class, true ); |
|
| 166 | + if ( in_array( $list[ 'id' ], $selected_list ) && $list_interest_groups ) {
|
|
| 167 | + YIKES_Inc_Easy_Mailchimp_Process_Ajax::check_list_for_interest_groups( $list[ 'id' ], $class, true ); |
|
| 168 | 168 | } |
| 169 | 169 | ?> |
| 170 | 170 | |
@@ -185,8 +185,8 @@ discard block |
||
| 185 | 185 | <label class="optin-checkbox-label"> |
| 186 | 186 | <strong><?php _e( 'Precheck Checkbox?', 'yikes-inc-easy-mailchimp-extender' ); ?></strong> |
| 187 | 187 | <select id="optin-checkbox-init[<?php echo $class; ?>][precheck]" name="optin-checkbox-init[<?php echo $class; ?>][precheck]" class="optin-checkbox-init[<?php echo $class; ?>][precheck] checkbox-settings-list-dropdown"> |
| 188 | - <option value="true" <?php selected( $precheck_checkbox , 'true' ); ?>><?php _e( 'Yes', 'yikes-inc-easy-mailchimp-extender' ); ?></option> |
|
| 189 | - <option value="false" <?php selected( $precheck_checkbox , 'false' ); ?>><?php _e( 'No', 'yikes-inc-easy-mailchimp-extender' ); ?></option> |
|
| 188 | + <option value="true" <?php selected( $precheck_checkbox, 'true' ); ?>><?php _e( 'Yes', 'yikes-inc-easy-mailchimp-extender' ); ?></option> |
|
| 189 | + <option value="false" <?php selected( $precheck_checkbox, 'false' ); ?>><?php _e( 'No', 'yikes-inc-easy-mailchimp-extender' ); ?></option> |
|
| 190 | 190 | </select> |
| 191 | 191 | </label> |
| 192 | 192 | </p> |
@@ -53,23 +53,23 @@ discard block |
||
| 53 | 53 | ); |
| 54 | 54 | |
| 55 | 55 | // Easy Digital Downloads. |
| 56 | - if ( class_exists( 'Easy_Digital_Downloads' ) ) {
|
|
| 56 | + if ( class_exists( 'Easy_Digital_Downloads' ) ) { |
|
| 57 | 57 | $active_plugins['easy_digital_downloads_checkout_form'] = __( 'Easy Digital Downloads Checkout', 'yikes-inc-easy-mailchimp-extender' ); |
| 58 | 58 | } |
| 59 | 59 | // WooCommerce. |
| 60 | - if ( class_exists( 'WooCommerce' ) ) {
|
|
| 60 | + if ( class_exists( 'WooCommerce' ) ) { |
|
| 61 | 61 | $active_plugins['woocommerce_checkout_form'] = __( 'WooCommerce Checkout', 'yikes-inc-easy-mailchimp-extender' ); |
| 62 | 62 | } |
| 63 | 63 | // BuddyPress. |
| 64 | - if ( class_exists( 'BuddyPress' ) ) {
|
|
| 64 | + if ( class_exists( 'BuddyPress' ) ) { |
|
| 65 | 65 | $active_plugins['buddypress_form'] = __( 'BuddyPress Registration', 'yikes-inc-easy-mailchimp-extender' ); |
| 66 | 66 | } |
| 67 | 67 | // bbPress. |
| 68 | - if ( class_exists( 'bbPress' ) ) {
|
|
| 68 | + if ( class_exists( 'bbPress' ) ) { |
|
| 69 | 69 | $active_plugins['bbpress_forms'] = __( 'bbPress', 'yikes-inc-easy-mailchimp-extender' ); |
| 70 | 70 | } |
| 71 | 71 | // Contact Form 7. |
| 72 | - if ( is_plugin_active( 'contact-form-7/wp-contact-form-7.php' ) ) {
|
|
| 72 | + if ( is_plugin_active( 'contact-form-7/wp-contact-form-7.php' ) ) { |
|
| 73 | 73 | $active_plugins['contact_form_7'] = __( 'Contact Form 7', 'yikes-inc-easy-mailchimp-extender' ); |
| 74 | 74 | } |
| 75 | 75 | |
@@ -81,9 +81,9 @@ discard block |
||
| 81 | 81 | |
| 82 | 82 | <?php |
| 83 | 83 | // lets confirm the user has a valid API key stored. |
| 84 | - if ( $this->is_user_mc_api_valid_form( false ) == 'valid' ) {
|
|
| 84 | + if ( $this->is_user_mc_api_valid_form( false ) == 'valid' ) { |
|
| 85 | 85 | $list_data = yikes_get_mc_api_manager()->get_list_handler()->get_lists(); |
| 86 | - if ( is_wp_error( $list_data ) ) {
|
|
| 86 | + if ( is_wp_error( $list_data ) ) { |
|
| 87 | 87 | $error_logging = new Yikes_Inc_Easy_Mailchimp_Error_Logging(); |
| 88 | 88 | $error_logging->maybe_write_to_log( |
| 89 | 89 | $list_data->get_error_code(), |
@@ -91,7 +91,7 @@ discard block |
||
| 91 | 91 | "Integration Settings Page" |
| 92 | 92 | ); |
| 93 | 93 | } |
| 94 | - } else {
|
|
| 94 | + } else { |
|
| 95 | 95 | ?> |
| 96 | 96 | <div class="inside"> |
| 97 | 97 | <?php |
@@ -116,9 +116,9 @@ discard block |
||
| 116 | 116 | |
| 117 | 117 | <ul> |
| 118 | 118 | <?php |
| 119 | - if ( ! empty( $active_plugins ) ) {
|
|
| 119 | + if ( ! empty( $active_plugins ) ) { |
|
| 120 | 120 | |
| 121 | - foreach( $active_plugins as $class => $value ) {
|
|
| 121 | + foreach( $active_plugins as $class => $value ) { |
|
| 122 | 122 | |
| 123 | 123 | $checked = isset( $options[$class]['value'] ) ? 'checked="checked"' : ''; |
| 124 | 124 | $hidden = ! isset( $options[$class]['value'] ) ? 'yikes-easy-mc-hidden' : ''; |
@@ -145,7 +145,7 @@ discard block |
||
| 145 | 145 | <!-- Associated Lists --> |
| 146 | 146 | <div class="checkbox-lists"><strong><?php _e( 'Choose Lists: ', 'yikes-inc-easy-mailchimp-extender' ); ?></strong> |
| 147 | 147 | <?php |
| 148 | - if ( count( $list_data ) > 0 ) {
|
|
| 148 | + if ( count( $list_data ) > 0 ) { |
|
| 149 | 149 | ?> |
| 150 | 150 | <?php foreach( $list_data as $list ) { ?>
|
| 151 | 151 | |
@@ -163,14 +163,14 @@ discard block |
||
| 163 | 163 | |
| 164 | 164 | <!-- If interest groups have been selected already, load them here --> |
| 165 | 165 | <?php |
| 166 | - if ( in_array( $list['id'], $selected_list ) && $list_interest_groups ) {
|
|
| 166 | + if ( in_array( $list['id'], $selected_list ) && $list_interest_groups ) { |
|
| 167 | 167 | YIKES_Inc_Easy_Mailchimp_Process_Ajax::check_list_for_interest_groups( $list['id'], $class, true ); |
| 168 | 168 | } |
| 169 | 169 | ?> |
| 170 | 170 | |
| 171 | 171 | <?php } ?> |
| 172 | 172 | <?php |
| 173 | - } else {
|
|
| 173 | + } else { |
|
| 174 | 174 | echo '<p class="description no-lists-setup-notice"><strong>' . __( 'You have not setup any lists. Head over to Mailchimp and setup your first list.', 'yikes-inc-easy-mailchimp-extender' ) . '</strong></p>'; |
| 175 | 175 | } |
| 176 | 176 | ?> |
@@ -193,7 +193,7 @@ discard block |
||
| 193 | 193 | </li> |
| 194 | 194 | <?php |
| 195 | 195 | } |
| 196 | - } else {
|
|
| 196 | + } else { |
|
| 197 | 197 | ?> |
| 198 | 198 | <li> |
| 199 | 199 | <?php _e( 'Nothing is active.', 'yikes-inc-easy-mailchimp-extender' ); ?> |
@@ -72,8 +72,8 @@ discard block |
||
| 72 | 72 | |
| 73 | 73 | $this->api_key = $api_key; |
| 74 | 74 | $parts = $this->get_api_key_parts(); |
| 75 | - $this->key = $parts['key']; |
|
| 76 | - $this->dc = $parts['dc']; |
|
| 75 | + $this->key = $parts[ 'key' ]; |
|
| 76 | + $this->dc = $parts[ 'dc' ]; |
|
| 77 | 77 | } |
| 78 | 78 | |
| 79 | 79 | /** |
@@ -98,8 +98,8 @@ discard block |
||
| 98 | 98 | $parts = explode( '-', $this->api_key ); |
| 99 | 99 | |
| 100 | 100 | return array( |
| 101 | - 'key' => $parts[0], |
|
| 102 | - 'dc' => isset( $parts[1] ) ? $parts[1] : '', |
|
| 101 | + 'key' => $parts[ 0 ], |
|
| 102 | + 'dc' => isset( $parts[ 1 ] ) ? $parts[ 1 ] : '', |
|
| 103 | 103 | ); |
| 104 | 104 | } |
| 105 | 105 | |
@@ -143,7 +143,7 @@ discard block |
||
| 143 | 143 | * @return Yikes_Inc_Easy_Mailchimp_API |
| 144 | 144 | */ |
| 145 | 145 | public function get_api( $version = '' ) { |
| 146 | - $version = $version ?: $this->get_default_api_version(); |
|
| 146 | + $version = $version ? : $this->get_default_api_version(); |
|
| 147 | 147 | |
| 148 | 148 | if ( ! array_key_exists( $version, $this->api ) || null === $this->api[ $version ] ) { |
| 149 | 149 | $this->api[ $version ] = new Yikes_Inc_Easy_Mailchimp_API( $this->get_datacenter(), $this->get_api_key(), $version ); |
@@ -17,7 +17,7 @@ |
||
| 17 | 17 | // required..* |
| 18 | 18 | include_once( ABSPATH . 'wp-admin/includes/plugin.php' ); |
| 19 | 19 | /* Visual Composer */ |
| 20 | - if( is_plugin_active( 'js_composer/js_composer.php' ) ) { |
|
| 20 | + if ( is_plugin_active( 'js_composer/js_composer.php' ) ) { |
|
| 21 | 21 | new YIKES_Mailchimp_Visual_Composer_Extension(); |
| 22 | 22 | } |
| 23 | 23 | } |
@@ -11,16 +11,16 @@ discard block |
||
| 11 | 11 | */ |
| 12 | 12 | public function __construct() { |
| 13 | 13 | // ajax process form submission |
| 14 | - add_action( 'wp_ajax_nopriv_process_form_submission', array( $this , 'process_form_submission' ), 10 ); |
|
| 15 | - add_action( 'wp_ajax_process_form_submission', array( $this , 'process_form_submission' ), 10 ); |
|
| 14 | + add_action( 'wp_ajax_nopriv_process_form_submission', array( $this, 'process_form_submission' ), 10 ); |
|
| 15 | + add_action( 'wp_ajax_process_form_submission', array( $this, 'process_form_submission' ), 10 ); |
|
| 16 | 16 | |
| 17 | 17 | // ajax send update emails |
| 18 | - add_action( 'wp_ajax_nopriv_easy_forms_send_email', array( $this , 'sendUpdateProfileEmail' ), 10 ); |
|
| 19 | - add_action( 'wp_ajax_easy_forms_send_email', array( $this , 'sendUpdateProfileEmail' ), 10 ); |
|
| 18 | + add_action( 'wp_ajax_nopriv_easy_forms_send_email', array( $this, 'sendUpdateProfileEmail' ), 10 ); |
|
| 19 | + add_action( 'wp_ajax_easy_forms_send_email', array( $this, 'sendUpdateProfileEmail' ), 10 ); |
|
| 20 | 20 | |
| 21 | 21 | // increase submission count for a given form on successful submit |
| 22 | - add_action( 'wp_ajax_nopriv_increase_submission_count' , array( $this , 'increase_submission_count' ), 10 ); |
|
| 23 | - add_action( 'wp_ajax_increase_submission_count' , array( $this , 'increase_submission_count' ), 10 ); |
|
| 22 | + add_action( 'wp_ajax_nopriv_increase_submission_count', array( $this, 'increase_submission_count' ), 10 ); |
|
| 23 | + add_action( 'wp_ajax_increase_submission_count', array( $this, 'increase_submission_count' ), 10 ); |
|
| 24 | 24 | } |
| 25 | 25 | |
| 26 | 26 | /* |
@@ -37,7 +37,7 @@ discard block |
||
| 37 | 37 | * Increase the submission count for a given form. |
| 38 | 38 | */ |
| 39 | 39 | public function increase_submission_count() { |
| 40 | - $form_id = intval( $_POST['form_id'] ); |
|
| 40 | + $form_id = intval( $_POST[ 'form_id' ] ); |
|
| 41 | 41 | $interface = yikes_easy_mailchimp_extender_get_form_interface(); |
| 42 | 42 | $form = $interface->get_form( $form_id ); |
| 43 | 43 | |
@@ -47,7 +47,7 @@ discard block |
||
| 47 | 47 | } |
| 48 | 48 | |
| 49 | 49 | // Update the form. |
| 50 | - $submission_count = isset( $form['submissions'] ) ? $form['submissions'] + 1 : 1; |
|
| 50 | + $submission_count = isset( $form[ 'submissions' ] ) ? $form[ 'submissions' ] + 1 : 1; |
|
| 51 | 51 | $interface->update_form_field( $form_id, 'submissions', $submission_count ); |
| 52 | 52 | |
| 53 | 53 | exit(); |
@@ -58,11 +58,11 @@ discard block |
||
| 58 | 58 | @since v6.0.4.1 |
| 59 | 59 | */ |
| 60 | 60 | public function sendUpdateProfileEmail() { |
| 61 | - $user_email = filter_var( $_POST['user_email'], FILTER_SANITIZE_STRING ); |
|
| 61 | + $user_email = filter_var( $_POST[ 'user_email' ], FILTER_SANITIZE_STRING ); |
|
| 62 | 62 | $user_id = md5( $user_email ); |
| 63 | - $list_id = filter_var( $_POST['list_id'], FILTER_SANITIZE_STRING ); |
|
| 64 | - $form_id = filter_var( $_POST['form_id'], FILTER_SANITIZE_NUMBER_INT ); |
|
| 65 | - $page_id = filter_var( $_POST['page_id'], FILTER_SANITIZE_NUMBER_INT ); |
|
| 63 | + $list_id = filter_var( $_POST[ 'list_id' ], FILTER_SANITIZE_STRING ); |
|
| 64 | + $form_id = filter_var( $_POST[ 'form_id' ], FILTER_SANITIZE_NUMBER_INT ); |
|
| 65 | + $page_id = filter_var( $_POST[ 'page_id' ], FILTER_SANITIZE_NUMBER_INT ); |
|
| 66 | 66 | $full_site_url = get_bloginfo( 'url' ); |
| 67 | 67 | $manager = yikes_get_mc_api_manager(); |
| 68 | 68 | |
@@ -79,7 +79,7 @@ discard block |
||
| 79 | 79 | 'class.public_ajax.php' |
| 80 | 80 | ); |
| 81 | 81 | $is_error = true; |
| 82 | - $errors[] = $list_details->get_error_message(); |
|
| 82 | + $errors[ ] = $list_details->get_error_message(); |
|
| 83 | 83 | } |
| 84 | 84 | |
| 85 | 85 | // Subscriber details API call. |
@@ -88,7 +88,7 @@ discard block |
||
| 88 | 88 | $error_logging = new Yikes_Inc_Easy_Mailchimp_Error_Logging(); |
| 89 | 89 | $error_logging->maybe_write_to_log( $subscriber_account_details->get_error_code(), __( 'Send Update Profile Email - Get Member Info.', 'yikes-inc-easy-mailchimp-extender' ), 'class.public_ajax.php' ); |
| 90 | 90 | $is_error = true; |
| 91 | - $errors[] = $subscriber_account_details->get_error_message(); |
|
| 91 | + $errors[ ] = $subscriber_account_details->get_error_message(); |
|
| 92 | 92 | } |
| 93 | 93 | |
| 94 | 94 | // Form details API call. |
@@ -96,22 +96,22 @@ discard block |
||
| 96 | 96 | if ( ! empty( $interface ) && method_exists( $interface, 'get_form' ) && ! empty( $form_id ) ) { |
| 97 | 97 | $form_data = $interface->get_form( $form_id ); |
| 98 | 98 | if ( ! empty( $form_data ) ) { |
| 99 | - if ( isset( $form_data['error_messages'] ) ) { |
|
| 99 | + if ( isset( $form_data[ 'error_messages' ] ) ) { |
|
| 100 | 100 | |
| 101 | - if ( isset( $form_data['error_messages']['email-body'] ) && ! empty( $form_data['error_messages']['email-body'] ) ) { |
|
| 102 | - $email_body = apply_filters( 'the_content', $form_data['error_messages']['email-body'] ); |
|
| 101 | + if ( isset( $form_data[ 'error_messages' ][ 'email-body' ] ) && ! empty( $form_data[ 'error_messages' ][ 'email-body' ] ) ) { |
|
| 102 | + $email_body = apply_filters( 'the_content', $form_data[ 'error_messages' ][ 'email-body' ] ); |
|
| 103 | 103 | } |
| 104 | 104 | |
| 105 | - if ( isset( $form_data['error_messages']['email-subject'] ) && ! empty( $form_data['error_messages']['email-subject'] ) ) { |
|
| 106 | - $email_subject = $form_data['error_messages']['email-subject']; |
|
| 105 | + if ( isset( $form_data[ 'error_messages' ][ 'email-subject' ] ) && ! empty( $form_data[ 'error_messages' ][ 'email-subject' ] ) ) { |
|
| 106 | + $email_subject = $form_data[ 'error_messages' ][ 'email-subject' ]; |
|
| 107 | 107 | } |
| 108 | 108 | |
| 109 | - if ( isset( $form_data['error_messages']['update-email-success'] ) && ! empty( $form_data['error_messages']['update-email-success'] ) ) { |
|
| 110 | - $update_email_success_message = $form_data['error_messages']['update-email-success']; |
|
| 109 | + if ( isset( $form_data[ 'error_messages' ][ 'update-email-success' ] ) && ! empty( $form_data[ 'error_messages' ][ 'update-email-success' ] ) ) { |
|
| 110 | + $update_email_success_message = $form_data[ 'error_messages' ][ 'update-email-success' ]; |
|
| 111 | 111 | } |
| 112 | 112 | |
| 113 | - if ( isset( $form_data['error_messages']['update-email-failure'] ) && ! empty( $form_data['error_messages']['update-email-failure'] ) ) { |
|
| 114 | - $update_email_failed_message = $form_data['error_messages']['update-email-failure']; |
|
| 113 | + if ( isset( $form_data[ 'error_messages' ][ 'update-email-failure' ] ) && ! empty( $form_data[ 'error_messages' ][ 'update-email-failure' ] ) ) { |
|
| 114 | + $update_email_failed_message = $form_data[ 'error_messages' ][ 'update-email-failure' ]; |
|
| 115 | 115 | } |
| 116 | 116 | } |
| 117 | 117 | } |
@@ -132,11 +132,11 @@ discard block |
||
| 132 | 132 | } |
| 133 | 133 | |
| 134 | 134 | // Construct the headers & email message content. |
| 135 | - $subscriber_id = $subscriber_account_details['unique_email_id']; |
|
| 136 | - $update_link_href = str_replace( '/subscribe', '/profile', $list_details['subscribe_url_long'] ); |
|
| 135 | + $subscriber_id = $subscriber_account_details[ 'unique_email_id' ]; |
|
| 136 | + $update_link_href = str_replace( '/subscribe', '/profile', $list_details[ 'subscribe_url_long' ] ); |
|
| 137 | 137 | $update_link_href = add_query_arg( 'e', $subscriber_id, $update_link_href ); |
| 138 | 138 | $update_link_tag = '<a href="' . $update_link_href . '">'; |
| 139 | - $headers = 'From: ' . $list_details['campaign_defaults']['from_name'] . ' <' . $list_details['campaign_defaults']['from_email'] . '>' . "\r\n"; |
|
| 139 | + $headers = 'From: ' . $list_details[ 'campaign_defaults' ][ 'from_name' ] . ' <' . $list_details[ 'campaign_defaults' ][ 'from_email' ] . '>' . "\r\n"; |
|
| 140 | 140 | $headers .= 'Content-type: text/html'; |
| 141 | 141 | |
| 142 | 142 | if ( ! isset( $email_subject ) ) { |
@@ -178,26 +178,26 @@ discard block |
||
| 178 | 178 | $email_body = str_replace( array( '[subscriber_id]', '[SUBSCRIBER_ID]' ), $subscriber_id, $email_body ); |
| 179 | 179 | |
| 180 | 180 | // We let the user use [form_name] for the form's name so replace [form_name] with the form's name. |
| 181 | - $email_body = str_replace( array( '[form_name]', '[FORM_NAME]' ), $form_data['form_name'], $email_body ); |
|
| 181 | + $email_body = str_replace( array( '[form_name]', '[FORM_NAME]' ), $form_data[ 'form_name' ], $email_body ); |
|
| 182 | 182 | |
| 183 | 183 | // We let the user use [fname] and [lname] so replace those. |
| 184 | - $email_body = str_replace( array( '[fname]', '[FNAME]' ), isset( $subscriber_account_details['merge_fields']['FNAME'] ) ? $subscriber_account_details['merge_fields']['FNAME'] : '', $email_body ); |
|
| 185 | - $email_body = str_replace( array( '[lname]', '[LNAME]' ), isset( $subscriber_account_details['merge_fields']['LNAME'] ) ? $subscriber_account_details['merge_fields']['LNAME'] : '', $email_body ); |
|
| 184 | + $email_body = str_replace( array( '[fname]', '[FNAME]' ), isset( $subscriber_account_details[ 'merge_fields' ][ 'FNAME' ] ) ? $subscriber_account_details[ 'merge_fields' ][ 'FNAME' ] : '', $email_body ); |
|
| 185 | + $email_body = str_replace( array( '[lname]', '[LNAME]' ), isset( $subscriber_account_details[ 'merge_fields' ][ 'LNAME' ] ) ? $subscriber_account_details[ 'merge_fields' ][ 'LNAME' ] : '', $email_body ); |
|
| 186 | 186 | |
| 187 | 187 | /* Confirm that the email was sent */ |
| 188 | 188 | if ( wp_mail( $user_email, apply_filters( 'yikes-mailchimp-update-email-subject', $email_subject ), apply_filters( 'yikes-mailchimp-update-email-content', $email_body, $update_link_href ), $headers ) ) { |
| 189 | 189 | |
| 190 | 190 | $update_email_success_message = apply_filters( 'yikes-mailchimp-update-email-success-message', $update_email_success_message, $form_id, $user_email ); |
| 191 | - $submission_settings = isset( $form_data['submission_settings'] ) ? $form_data['submission_settings'] : null; |
|
| 191 | + $submission_settings = isset( $form_data[ 'submission_settings' ] ) ? $form_data[ 'submission_settings' ] : null; |
|
| 192 | 192 | $redirect_settings = Yikes_Inc_Easy_Mailchimp_Extender_Process_Submission_Handler::handle_submission_response_success_redirect( $form_id, $submission_settings, $page_id ); |
| 193 | 193 | |
| 194 | 194 | wp_send_json_success( |
| 195 | 195 | array( |
| 196 | 196 | 'response_text' => '<div class="yikes-easy-mc-success-message">' . $update_email_success_message . '</div>', |
| 197 | - 'redirection' => $redirect_settings['redirection'], |
|
| 198 | - 'redirect' => $redirect_settings['redirect'], |
|
| 199 | - 'redirect_timer' => $redirect_settings['redirect_timer'], |
|
| 200 | - 'new_window' => $redirect_settings['new_window'], |
|
| 197 | + 'redirection' => $redirect_settings[ 'redirection' ], |
|
| 198 | + 'redirect' => $redirect_settings[ 'redirect' ], |
|
| 199 | + 'redirect_timer' => $redirect_settings[ 'redirect_timer' ], |
|
| 200 | + 'new_window' => $redirect_settings[ 'new_window' ], |
|
| 201 | 201 | ) |
| 202 | 202 | ); |
| 203 | 203 | } else { |
@@ -75,14 +75,14 @@ |
||
| 75 | 75 | |
| 76 | 76 | // Create merge variables based on comment data. |
| 77 | 77 | $merge_vars = array( |
| 78 | - 'FNAME' => $comment_data['comment_author'], |
|
| 79 | - 'OPTIN_IP' => $comment_data['comment_author_IP'], |
|
| 78 | + 'FNAME' => $comment_data[ 'comment_author' ], |
|
| 79 | + 'OPTIN_IP' => $comment_data[ 'comment_author_IP' ], |
|
| 80 | 80 | ); |
| 81 | 81 | |
| 82 | 82 | $addl_vars = apply_filters( 'yikes_mailchimp_checkbox_integration_additional_vars', array( 'comment_data' => $comment_data ), $this->type ); |
| 83 | 83 | |
| 84 | 84 | // Subscribe the user. |
| 85 | - $this->subscribe_user_integration( $comment_data['comment_author_email'], $this->type, $merge_vars, $addl_vars ); |
|
| 85 | + $this->subscribe_user_integration( $comment_data[ 'comment_author_email' ], $this->type, $merge_vars, $addl_vars ); |
|
| 86 | 86 | } |
| 87 | 87 | } |
| 88 | 88 | $yikes_easy_mc_comment_checkbox_class = new Yikes_Easy_MC_Comment_Checkbox_Class(); |
@@ -80,11 +80,11 @@ |
||
| 80 | 80 | |
| 81 | 81 | $user_info = (array) edd_get_payment_meta_user_info( $payment_id ); |
| 82 | 82 | $merge_vars = array(); |
| 83 | - if ( isset( $user_info['first_name'] ) ) { |
|
| 84 | - $merge_vars['FNAME'] = $user_info['first_name']; |
|
| 83 | + if ( isset( $user_info[ 'first_name' ] ) ) { |
|
| 84 | + $merge_vars[ 'FNAME' ] = $user_info[ 'first_name' ]; |
|
| 85 | 85 | } |
| 86 | - if ( isset( $user_info['last_name'] ) ) { |
|
| 87 | - $merge_vars['LNAME'] = $user_info['last_name']; |
|
| 86 | + if ( isset( $user_info[ 'last_name' ] ) ) { |
|
| 87 | + $merge_vars[ 'LNAME' ] = $user_info[ 'last_name' ]; |
|
| 88 | 88 | } |
| 89 | 89 | |
| 90 | 90 | $addl_vars = apply_filters( 'yikes_mailchimp_checkbox_integration_additional_vars', array( 'user' => $user_info, 'payment_id' => $payment_id ), $this->type ); |