@@ -1,48 +1,48 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | $api_key = yikes_get_mc_api_key(); |
3 | 3 | $dash_position = strpos( $api_key, '-' ); |
4 | - if( $dash_position !== false ) { |
|
4 | + if ( $dash_position !== false ) { |
|
5 | 5 | $api_endpoint = 'https://' . substr( $api_key, $dash_position + 1 ) . '.api.mailchimp.com/2.0/lists/interest-groupings.json'; |
6 | 6 | } |
7 | 7 | // get the interest group data |
8 | 8 | $interest_groupings = wp_remote_post( $api_endpoint, array( |
9 | 9 | 'body' => array( |
10 | 10 | 'apikey' => $api_key, |
11 | - 'id' => $form_data_array['list_id'] |
|
11 | + 'id' => $form_data_array[ 'list_id' ] |
|
12 | 12 | ), |
13 | 13 | 'timeout' => 10, |
14 | 14 | 'sslverify' => apply_filters( 'yikes-mailchimp-sslverify', true ) |
15 | 15 | ) ); |
16 | 16 | $interest_groupings_body = json_decode( wp_remote_retrieve_body( $interest_groupings ), true ); |
17 | - if( ! is_wp_error( $interest_groupings_body ) ) { |
|
18 | - if( isset( $interest_groupings_body['error'] ) ) { |
|
19 | - if( WP_DEBUG || get_option( 'yikes-mailchimp-debug-status' , '' ) == '1' ) { |
|
17 | + if ( ! is_wp_error( $interest_groupings_body ) ) { |
|
18 | + if ( isset( $interest_groupings_body[ 'error' ] ) ) { |
|
19 | + if ( WP_DEBUG || get_option( 'yikes-mailchimp-debug-status', '' ) == '1' ) { |
|
20 | 20 | require_once YIKES_MC_PATH . 'includes/error_log/class-yikes-inc-easy-mailchimp-error-logging.php'; |
21 | 21 | $error_logging = new Yikes_Inc_Easy_Mailchimp_Error_Logging(); |
22 | - $error_logging->yikes_easy_mailchimp_write_to_error_log( $interest_groupings_body['error'], __( "Get Interest Groups" , 'yikes-inc-easy-mailchimp-extender' ) , __( "Add Interest Group to Form" , 'yikes-inc-easy-mailchimp-extender' ) ); |
|
22 | + $error_logging->yikes_easy_mailchimp_write_to_error_log( $interest_groupings_body[ 'error' ], __( "Get Interest Groups", 'yikes-inc-easy-mailchimp-extender' ), __( "Add Interest Group to Form", 'yikes-inc-easy-mailchimp-extender' ) ); |
|
23 | 23 | } |
24 | 24 | ?> |
25 | 25 | <section class="draggable" id="error-container"> |
26 | - <p><span class="dashicons dashicons-no-alt"></span> <?php printf( __( 'Error: %s', 'yikes-inc-easy-mailchimp-extender' ), $interest_groupings_body['error'] ); ?></p> |
|
26 | + <p><span class="dashicons dashicons-no-alt"></span> <?php printf( __( 'Error: %s', 'yikes-inc-easy-mailchimp-extender' ), $interest_groupings_body[ 'error' ] ); ?></p> |
|
27 | 27 | </section> |
28 | 28 | <?php |
29 | 29 | return; |
30 | 30 | } |
31 | 31 | // find and return the location of this merge field in the array |
32 | - $index = $this->findMCListIndex( $form_data_array['group_id'], $interest_groupings_body, 'id' ); |
|
32 | + $index = $this->findMCListIndex( $form_data_array[ 'group_id' ], $interest_groupings_body, 'id' ); |
|
33 | 33 | // check for our index... |
34 | - if( isset( $index) ) { |
|
34 | + if ( isset( $index ) ) { |
|
35 | 35 | // store it and use it to pre-populate field data (only on initial add to form) |
36 | - $merge_field_data = $interest_groupings_body[$index]; |
|
36 | + $merge_field_data = $interest_groupings_body[ $index ]; |
|
37 | 37 | } |
38 | 38 | } |
39 | 39 | |
40 | 40 | ?> |
41 | -<section class="draggable" id="<?php echo $form_data_array['group_id']; ?>"> |
|
41 | +<section class="draggable" id="<?php echo $form_data_array[ 'group_id' ]; ?>"> |
|
42 | 42 | <!-- top --> |
43 | 43 | <a href="#" class="expansion-section-title settings-sidebar"> |
44 | - <span class="dashicons dashicons-plus" title="<?php _e( 'Expand Field' , 'yikes-inc-easy-mailchimp-extender' ); ?>"></span><?php echo stripslashes( $form_data_array['field_name'] ); ?> |
|
45 | - <span class="field-type-text"><small><?php echo __( 'type' , 'yikes-inc-easy-mailchimp-extender' ) . ' : ' . $form_data_array['field_type']; ?></small></span> |
|
44 | + <span class="dashicons dashicons-plus" title="<?php _e( 'Expand Field', 'yikes-inc-easy-mailchimp-extender' ); ?>"></span><?php echo stripslashes( $form_data_array[ 'field_name' ] ); ?> |
|
45 | + <span class="field-type-text"><small><?php echo __( 'type', 'yikes-inc-easy-mailchimp-extender' ) . ' : ' . $form_data_array[ 'field_type' ]; ?></small></span> |
|
46 | 46 | </a> |
47 | 47 | <!-- expansion section --> |
48 | 48 | <div class="yikes-mc-settings-expansion-section"> |
@@ -50,16 +50,16 @@ discard block |
||
50 | 50 | <!-- Single or Double Opt-in --> |
51 | 51 | <p class="type-container"><!-- necessary to prevent skipping on slideToggle(); --> |
52 | 52 | <!-- store the label --> |
53 | - <input type="hidden" name="field[<?php echo $form_data_array['group_id']; ?>][label]" value="<?php echo $form_data_array['field_name']; ?>" /> |
|
54 | - <input type="hidden" name="field[<?php echo $form_data_array['group_id']; ?>][type]" value="<?php echo $form_data_array['field_type']; ?>" /> |
|
55 | - <input type="hidden" name="field[<?php echo $form_data_array['group_id']; ?>][group_id]" value="<?php echo $form_data_array['group_id']; ?>" /> |
|
56 | - <input type="hidden" name="field[<?php echo $form_data_array['group_id']; ?>][groups]" value='<?php echo str_replace( '\'' , '~' , json_encode( $merge_field_data['groups'] ) ); ?>' /> |
|
53 | + <input type="hidden" name="field[<?php echo $form_data_array[ 'group_id' ]; ?>][label]" value="<?php echo $form_data_array[ 'field_name' ]; ?>" /> |
|
54 | + <input type="hidden" name="field[<?php echo $form_data_array[ 'group_id' ]; ?>][type]" value="<?php echo $form_data_array[ 'field_type' ]; ?>" /> |
|
55 | + <input type="hidden" name="field[<?php echo $form_data_array[ 'group_id' ]; ?>][group_id]" value="<?php echo $form_data_array[ 'group_id' ]; ?>" /> |
|
56 | + <input type="hidden" name="field[<?php echo $form_data_array[ 'group_id' ]; ?>][groups]" value='<?php echo str_replace( '\'', '~', json_encode( $merge_field_data[ 'groups' ] ) ); ?>' /> |
|
57 | 57 | |
58 | 58 | |
59 | 59 | <table class="form-table form-field-container"> |
60 | 60 | |
61 | 61 | <!-- Default Value --> |
62 | - <?php switch( $form_data_array['field_type'] ) { |
|
62 | + <?php switch ( $form_data_array[ 'field_type' ] ) { |
|
63 | 63 | |
64 | 64 | default: |
65 | 65 | case 'radio': |
@@ -67,19 +67,19 @@ discard block |
||
67 | 67 | <tr valign="top"> |
68 | 68 | <td scope="row"> |
69 | 69 | <label for="placeholder"> |
70 | - <?php _e( 'Default Selection' , 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
70 | + <?php _e( 'Default Selection', 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
71 | 71 | </label> |
72 | 72 | </td> |
73 | 73 | <td> |
74 | - <?php $i = 0; foreach( $merge_field_data['groups'] as $interest_group ) { |
|
75 | - $pre_selected = !empty( $merge_field_data['default_choice'] ) ? $merge_field_data['default_choice'] : '0'; |
|
74 | + <?php $i = 0; foreach ( $merge_field_data[ 'groups' ] as $interest_group ) { |
|
75 | + $pre_selected = ! empty( $merge_field_data[ 'default_choice' ] ) ? $merge_field_data[ 'default_choice' ] : '0'; |
|
76 | 76 | ?> |
77 | - <input type="radio" name="field[<?php echo $form_data_array['group_id']; ?>][default_choice][]" value="<?php echo $i; ?>" <?php checked( $pre_selected , $i ); ?>><?php echo stripslashes( $interest_group['name'] ); ?> |
|
77 | + <input type="radio" name="field[<?php echo $form_data_array[ 'group_id' ]; ?>][default_choice][]" value="<?php echo $i; ?>" <?php checked( $pre_selected, $i ); ?>><?php echo stripslashes( $interest_group[ 'name' ] ); ?> |
|
78 | 78 | <?php |
79 | 79 | $i++; |
80 | 80 | } |
81 | 81 | ?> |
82 | - <p class="description"><small><?php _e( "Select the option that should be selected by default.", 'yikes-inc-easy-mailchimp-extender' );?></small></p> |
|
82 | + <p class="description"><small><?php _e( "Select the option that should be selected by default.", 'yikes-inc-easy-mailchimp-extender' ); ?></small></p> |
|
83 | 83 | </td> |
84 | 84 | </tr> |
85 | 85 | |
@@ -91,19 +91,19 @@ discard block |
||
91 | 91 | <tr valign="top"> |
92 | 92 | <td scope="row"> |
93 | 93 | <label for="placeholder"> |
94 | - <?php _e( 'Default Selection' , 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
94 | + <?php _e( 'Default Selection', 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
95 | 95 | </label> |
96 | 96 | </td> |
97 | 97 | <td> |
98 | - <?php $i = 0; foreach( $merge_field_data['groups'] as $interest_group ) { |
|
99 | - $pre_selected = !empty( $merge_field_data['default_choice'] ) ? $merge_field_data['default_choice'] : '0'; |
|
98 | + <?php $i = 0; foreach ( $merge_field_data[ 'groups' ] as $interest_group ) { |
|
99 | + $pre_selected = ! empty( $merge_field_data[ 'default_choice' ] ) ? $merge_field_data[ 'default_choice' ] : '0'; |
|
100 | 100 | ?> |
101 | - <input type="checkbox" name="field[<?php echo $form_data_array['group_id']; ?>][default_choice][]" value="<?php echo $i; ?>" <?php checked( $pre_selected , $i ); ?>><?php echo stripslashes( $interest_group['name'] ); ?> |
|
101 | + <input type="checkbox" name="field[<?php echo $form_data_array[ 'group_id' ]; ?>][default_choice][]" value="<?php echo $i; ?>" <?php checked( $pre_selected, $i ); ?>><?php echo stripslashes( $interest_group[ 'name' ] ); ?> |
|
102 | 102 | <?php |
103 | 103 | $i++; |
104 | 104 | } |
105 | 105 | ?> |
106 | - <p class="description"><small><?php _e( "Select the option that should be selected by default.", 'yikes-inc-easy-mailchimp-extender' );?></small></p> |
|
106 | + <p class="description"><small><?php _e( "Select the option that should be selected by default.", 'yikes-inc-easy-mailchimp-extender' ); ?></small></p> |
|
107 | 107 | </td> |
108 | 108 | </tr> |
109 | 109 | |
@@ -115,18 +115,18 @@ discard block |
||
115 | 115 | <tr valign="top"> |
116 | 116 | <td scope="row"> |
117 | 117 | <label for="placeholder"> |
118 | - <?php _e( 'Default Selection' , 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
118 | + <?php _e( 'Default Selection', 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
119 | 119 | </label> |
120 | 120 | </td> |
121 | 121 | <td> |
122 | - <select type="default" name="field[<?php echo $form_data_array['group_id']; ?>][default_choice]"> |
|
123 | - <?php $i = 0; foreach( $merge_field_data['groups'] as $interest_group ) { |
|
124 | - $pre_selected = !empty( $merge_field_data['default_choice'] ) ? $merge_field_data['default_choice'] : '0'; |
|
122 | + <select type="default" name="field[<?php echo $form_data_array[ 'group_id' ]; ?>][default_choice]"> |
|
123 | + <?php $i = 0; foreach ( $merge_field_data[ 'groups' ] as $interest_group ) { |
|
124 | + $pre_selected = ! empty( $merge_field_data[ 'default_choice' ] ) ? $merge_field_data[ 'default_choice' ] : '0'; |
|
125 | 125 | ?> |
126 | - <option value="<?php echo $i; ?>" <?php selected( $pre_selected , $i ); ?>><?php echo $interest_group['name']; ?></option> |
|
126 | + <option value="<?php echo $i; ?>" <?php selected( $pre_selected, $i ); ?>><?php echo $interest_group[ 'name' ]; ?></option> |
|
127 | 127 | <?php $i++; } ?> |
128 | 128 | </select> |
129 | - <p class="description"><small><?php _e( "Which option should be selected by default?", 'yikes-inc-easy-mailchimp-extender' );?></small></p> |
|
129 | + <p class="description"><small><?php _e( "Which option should be selected by default?", 'yikes-inc-easy-mailchimp-extender' ); ?></small></p> |
|
130 | 130 | </td> |
131 | 131 | </tr> |
132 | 132 | |
@@ -140,12 +140,12 @@ discard block |
||
140 | 140 | <tr valign="top"> |
141 | 141 | <td scope="row"> |
142 | 142 | <label for="placeholder"> |
143 | - <?php _e( 'Description' , 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
143 | + <?php _e( 'Description', 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
144 | 144 | </label> |
145 | 145 | </td> |
146 | 146 | <td> |
147 | - <textarea class="widefat field-description-input" name="field[<?php echo $form_data_array['group_id']; ?>][description]"></textarea> |
|
148 | - <p class="description"><small><?php _e( "Enter the description for the form field. This will be displayed to the user and provide some direction on how the field should be filled out or selected.", 'yikes-inc-easy-mailchimp-extender' );?></small></p> |
|
147 | + <textarea class="widefat field-description-input" name="field[<?php echo $form_data_array[ 'group_id' ]; ?>][description]"></textarea> |
|
148 | + <p class="description"><small><?php _e( "Enter the description for the form field. This will be displayed to the user and provide some direction on how the field should be filled out or selected.", 'yikes-inc-easy-mailchimp-extender' ); ?></small></p> |
|
149 | 149 | </td> |
150 | 150 | </tr> |
151 | 151 | |
@@ -153,48 +153,48 @@ discard block |
||
153 | 153 | <tr valign="top"> |
154 | 154 | <td scope="row"> |
155 | 155 | <label for="placeholder"> |
156 | - <?php _e( 'Additional Classes' , 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
156 | + <?php _e( 'Additional Classes', 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
157 | 157 | </label> |
158 | 158 | </td> |
159 | 159 | <td> |
160 | - <input type="text" class="widefat" name="field[<?php echo $form_data_array['group_id']; ?>][additional-classes]" value="<?php echo isset( $form_data_array['classes'] ) ? stripslashes( wp_strip_all_tags( $form_data_array['classes'] ) ) : '' ; ?>" /> |
|
161 | - <p class="description"><small><?php printf( __( "Assign additional classes to this field. %s.", 'yikes-inc-easy-mailchimp-extender' ), '<a target="_blank" href="' . esc_url( 'https://yikesplugins.com/support/knowledge-base/bundled-css-classes/' ) . '">' . __( 'View bundled classes', 'yikes-inc-easy-mailchimp-extender' ) . '</a>' );?></small></p> |
|
160 | + <input type="text" class="widefat" name="field[<?php echo $form_data_array[ 'group_id' ]; ?>][additional-classes]" value="<?php echo isset( $form_data_array[ 'classes' ] ) ? stripslashes( wp_strip_all_tags( $form_data_array[ 'classes' ] ) ) : ''; ?>" /> |
|
161 | + <p class="description"><small><?php printf( __( "Assign additional classes to this field. %s.", 'yikes-inc-easy-mailchimp-extender' ), '<a target="_blank" href="' . esc_url( 'https://yikesplugins.com/support/knowledge-base/bundled-css-classes/' ) . '">' . __( 'View bundled classes', 'yikes-inc-easy-mailchimp-extender' ) . '</a>' ); ?></small></p> |
|
162 | 162 | </td> |
163 | 163 | </tr> |
164 | 164 | <!-- Required Toggle --> |
165 | 165 | <tr valign="top"> |
166 | 166 | <td scope="row"> |
167 | 167 | <label for="field-required"> |
168 | - <?php _e( 'Field Required?' , 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
168 | + <?php _e( 'Field Required?', 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
169 | 169 | </label> |
170 | 170 | </td> |
171 | 171 | <td> |
172 | - <input type="checkbox" class="widefat" value="1" name="field[<?php echo $form_data_array['group_id']; ?>][require]"> |
|
173 | - <p class="description"><small><?php _e( "Require this field to be filled in before the form can be submitted.", 'yikes-inc-easy-mailchimp-extender' );?></small></p> |
|
172 | + <input type="checkbox" class="widefat" value="1" name="field[<?php echo $form_data_array[ 'group_id' ]; ?>][require]"> |
|
173 | + <p class="description"><small><?php _e( "Require this field to be filled in before the form can be submitted.", 'yikes-inc-easy-mailchimp-extender' ); ?></small></p> |
|
174 | 174 | </td> |
175 | 175 | </tr> |
176 | 176 | <!-- Visible Toggle --> |
177 | 177 | <tr valign="top"> |
178 | 178 | <td scope="row"> |
179 | 179 | <label for="hide-field"> |
180 | - <?php _e( 'Hide Field' , 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
180 | + <?php _e( 'Hide Field', 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
181 | 181 | </label> |
182 | 182 | </td> |
183 | 183 | <td> |
184 | - <input type="checkbox" class="widefat" value="1" name="field[<?php echo $form_data_array['group_id']; ?>][hide]"> |
|
185 | - <p class="description"><small><?php _e( "Hide this field from being displayed on the front end.", 'yikes-inc-easy-mailchimp-extender' );?></small></p> |
|
184 | + <input type="checkbox" class="widefat" value="1" name="field[<?php echo $form_data_array[ 'group_id' ]; ?>][hide]"> |
|
185 | + <p class="description"><small><?php _e( "Hide this field from being displayed on the front end.", 'yikes-inc-easy-mailchimp-extender' ); ?></small></p> |
|
186 | 186 | </td> |
187 | 187 | </tr> |
188 | 188 | <!-- Toggle Field Label Visibility --> |
189 | 189 | <tr valign="top"> |
190 | 190 | <td scope="row"> |
191 | 191 | <label for="placeholder"> |
192 | - <?php _e( 'Hide Label' , 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
192 | + <?php _e( 'Hide Label', 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
193 | 193 | </label> |
194 | 194 | </td> |
195 | 195 | <td> |
196 | - <input type="checkbox" name="field[<?php echo $form_data_array['group_id']; ?>][hide-label]" value="1" /> |
|
197 | - <p class="description"><small><?php _e( "Toggle field label visibility.", 'yikes-inc-easy-mailchimp-extender' );?></small></p> |
|
196 | + <input type="checkbox" name="field[<?php echo $form_data_array[ 'group_id' ]; ?>][hide-label]" value="1" /> |
|
197 | + <p class="description"><small><?php _e( "Toggle field label visibility.", 'yikes-inc-easy-mailchimp-extender' ); ?></small></p> |
|
198 | 198 | </td> |
199 | 199 | </tr> |
200 | 200 | <!-- Toggle Buttons --> |
@@ -204,8 +204,8 @@ discard block |
||
204 | 204 | </td> |
205 | 205 | <td> |
206 | 206 | <span class="toggle-container"> |
207 | - <a href="#" class="hide-field"><?php _e( "Close" , 'yikes-inc-easy-mailchimp-extender' ); ?></a> | |
|
208 | - <a href="#" class="remove-field" alt="<?php echo $form_data_array['group_id']; ?>"><?php _e( "Remove Field" , 'yikes-inc-easy-mailchimp-extender' ); ?></a> |
|
207 | + <a href="#" class="hide-field"><?php _e( "Close", 'yikes-inc-easy-mailchimp-extender' ); ?></a> | |
|
208 | + <a href="#" class="remove-field" alt="<?php echo $form_data_array[ 'group_id' ]; ?>"><?php _e( "Remove Field", 'yikes-inc-easy-mailchimp-extender' ); ?></a> |
|
209 | 209 | </span> |
210 | 210 | </td> |
211 | 211 | </tr> |
@@ -1,12 +1,12 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | // lets confirm the user has a valid API key stored |
3 | - if( $this->is_user_mc_api_valid_form( false ) == 'valid' ) { |
|
3 | + if ( $this->is_user_mc_api_valid_form( false ) == 'valid' ) { |
|
4 | 4 | // store the API key |
5 | 5 | $api_key = yikes_get_mc_api_key(); |
6 | 6 | $dash_position = strpos( $api_key, '-' ); |
7 | 7 | /// Check for a transients, if not - set them up |
8 | 8 | if ( false === ( $profile_info = get_transient( 'yikes-easy-mailchimp-profile-data' ) ) ) { |
9 | - if( $dash_position !== false ) { |
|
9 | + if ( $dash_position !== false ) { |
|
10 | 10 | $api_endpoint = 'https://' . substr( $api_key, $dash_position + 1 ) . '.api.mailchimp.com/2.0/users/profile.json'; |
11 | 11 | } |
12 | 12 | $profile_info = wp_remote_post( $api_endpoint, array( |
@@ -17,11 +17,11 @@ discard block |
||
17 | 17 | 'sslverify' => apply_filters( 'yikes-mailchimp-sslverify', true ) |
18 | 18 | ) ); |
19 | 19 | $profile_info = json_decode( wp_remote_retrieve_body( $profile_info ), true ); |
20 | - if( isset( $profile_info['error'] ) ) { |
|
21 | - if( WP_DEBUG || get_option( 'yikes-mailchimp-debug-status' , '' ) == '1' ) { |
|
20 | + if ( isset( $profile_info[ 'error' ] ) ) { |
|
21 | + if ( WP_DEBUG || get_option( 'yikes-mailchimp-debug-status', '' ) == '1' ) { |
|
22 | 22 | require_once YIKES_MC_PATH . 'includes/error_log/class-yikes-inc-easy-mailchimp-error-logging.php'; |
23 | 23 | $error_logging = new Yikes_Inc_Easy_Mailchimp_Error_Logging(); |
24 | - $error_logging->yikes_easy_mailchimp_write_to_error_log( $profile_info['error'], __( "Get Profile Info." , 'yikes-inc-easy-mailchimp-extender' ), "Account Details Page" ); |
|
24 | + $error_logging->yikes_easy_mailchimp_write_to_error_log( $profile_info[ 'error' ], __( "Get Profile Info.", 'yikes-inc-easy-mailchimp-extender' ), "Account Details Page" ); |
|
25 | 25 | } |
26 | 26 | return; |
27 | 27 | } else { |
@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | } |
31 | 31 | } |
32 | 32 | if ( false === ( $account_details = get_transient( 'yikes-easy-mailchimp-account-data' ) ) ) { |
33 | - if( $dash_position !== false ) { |
|
33 | + if ( $dash_position !== false ) { |
|
34 | 34 | $api_endpoint = 'https://' . substr( $api_key, $dash_position + 1 ) . '.api.mailchimp.com/2.0/helper/account-details.json'; |
35 | 35 | } |
36 | 36 | $account_details = wp_remote_post( $api_endpoint, array( |
@@ -41,11 +41,11 @@ discard block |
||
41 | 41 | 'sslverify' => apply_filters( 'yikes-mailchimp-sslverify', true ) |
42 | 42 | ) ); |
43 | 43 | $account_details = json_decode( wp_remote_retrieve_body( $account_details ), true ); |
44 | - if( isset( $account_details['error'] ) ) { |
|
45 | - if( WP_DEBUG || get_option( 'yikes-mailchimp-debug-status' , '' ) == '1' ) { |
|
44 | + if ( isset( $account_details[ 'error' ] ) ) { |
|
45 | + if ( WP_DEBUG || get_option( 'yikes-mailchimp-debug-status', '' ) == '1' ) { |
|
46 | 46 | require_once YIKES_MC_PATH . 'includes/error_log/class-yikes-inc-easy-mailchimp-error-logging.php'; |
47 | 47 | $error_logging = new Yikes_Inc_Easy_Mailchimp_Error_Logging(); |
48 | - $error_logging->yikes_easy_mailchimp_write_to_error_log( $account_details['error'], __( "Get Account Details" , 'yikes-inc-easy-mailchimp-extender' ), "Account Details Page" ); |
|
48 | + $error_logging->yikes_easy_mailchimp_write_to_error_log( $account_details[ 'error' ], __( "Get Account Details", 'yikes-inc-easy-mailchimp-extender' ), "Account Details Page" ); |
|
49 | 49 | } |
50 | 50 | } else { |
51 | 51 | // set our transient for one hour |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | } |
55 | 55 | if ( false === ( $account_activity = get_transient( 'yikes-easy-mailchimp-account-activity' ) ) ) { |
56 | 56 | // retreive our list data |
57 | - if( $dash_position !== false ) { |
|
57 | + if ( $dash_position !== false ) { |
|
58 | 58 | $api_endpoint = 'https://' . substr( $api_key, $dash_position + 1 ) . '.api.mailchimp.com/2.0/helper/chimp-chatter.json'; |
59 | 59 | } |
60 | 60 | $account_activity = wp_remote_post( $api_endpoint, array( |
@@ -65,11 +65,11 @@ discard block |
||
65 | 65 | 'sslverify' => apply_filters( 'yikes-mailchimp-sslverify', true ) |
66 | 66 | ) ); |
67 | 67 | $account_activity = json_decode( wp_remote_retrieve_body( $account_activity ), true ); |
68 | - if( isset( $account_activity['error'] ) ) { |
|
69 | - if( WP_DEBUG || get_option( 'yikes-mailchimp-debug-status' , '' ) == '1' ) { |
|
68 | + if ( isset( $account_activity[ 'error' ] ) ) { |
|
69 | + if ( WP_DEBUG || get_option( 'yikes-mailchimp-debug-status', '' ) == '1' ) { |
|
70 | 70 | require_once YIKES_MC_PATH . 'includes/error_log/class-yikes-inc-easy-mailchimp-error-logging.php'; |
71 | 71 | $error_logging = new Yikes_Inc_Easy_Mailchimp_Error_Logging(); |
72 | - $error_logging->yikes_easy_mailchimp_write_to_error_log( $account_activity['error'], __( "Get Chimp Chatter" , 'yikes-inc-easy-mailchimp-extender' ), "Account Details Page" ); |
|
72 | + $error_logging->yikes_easy_mailchimp_write_to_error_log( $account_activity[ 'error' ], __( "Get Chimp Chatter", 'yikes-inc-easy-mailchimp-extender' ), "Account Details Page" ); |
|
73 | 73 | } |
74 | 74 | } else { |
75 | 75 | // set our transient for one hour |
@@ -77,16 +77,16 @@ discard block |
||
77 | 77 | } |
78 | 78 | } |
79 | 79 | } else { |
80 | - wp_die( __( 'It looks like you need to re-validate your MailChimp API key before you can continue.' , 'yikes-inc-easy-mailchimp-extender' ) , 500 ); |
|
80 | + wp_die( __( 'It looks like you need to re-validate your MailChimp API key before you can continue.', 'yikes-inc-easy-mailchimp-extender' ), 500 ); |
|
81 | 81 | } |
82 | 82 | ?> |
83 | 83 | <div class="wrap" id="account-details"> |
84 | 84 | <!-- Freddie Logo --> |
85 | - <img src="<?php echo YIKES_MC_URL . 'includes/images/MailChimp_Assets/Freddie_60px.png'; ?>" alt="<?php _e( 'Freddie - MailChimp Mascot' , 'yikes-inc-easy-mailchimp-extender' ); ?>" class="yikes-mc-freddie-logo" /> |
|
85 | + <img src="<?php echo YIKES_MC_URL . 'includes/images/MailChimp_Assets/Freddie_60px.png'; ?>" alt="<?php _e( 'Freddie - MailChimp Mascot', 'yikes-inc-easy-mailchimp-extender' ); ?>" class="yikes-mc-freddie-logo" /> |
|
86 | 86 | |
87 | - <h1><?php _e( 'Account Overview' , 'yikes-inc-easy-mailchimp-extender' ); echo ' | ' . $profile_info['username']; ?></h1> |
|
87 | + <h1><?php _e( 'Account Overview', 'yikes-inc-easy-mailchimp-extender' ); echo ' | ' . $profile_info[ 'username' ]; ?></h1> |
|
88 | 88 | <!-- Account Overview Page Description --> |
89 | - <p class="yikes-easy-mc-about-text about-text"><?php _e( "Below you'll find a brief overview of account activity as well as some account and profile info." , 'yikes-inc-easy-mailchimp-extender' ); ?></p> |
|
89 | + <p class="yikes-easy-mc-about-text about-text"><?php _e( "Below you'll find a brief overview of account activity as well as some account and profile info.", 'yikes-inc-easy-mailchimp-extender' ); ?></p> |
|
90 | 90 | |
91 | 91 | <div id="poststuff"> |
92 | 92 | <div id="post-body" class="metabox-holder columns-2"> |
@@ -96,16 +96,16 @@ discard block |
||
96 | 96 | <!-- <div class="postbox yikes-easy-mc-postbox" id="chimp-chatter"> |
97 | 97 | <div class="inside"> --> |
98 | 98 | |
99 | - <h1><?php _e( 'Chimp Chatter' , 'yikes-inc-easy-mailchimp-extender' ); ?></h1> |
|
99 | + <h1><?php _e( 'Chimp Chatter', 'yikes-inc-easy-mailchimp-extender' ); ?></h1> |
|
100 | 100 | |
101 | 101 | <?php |
102 | 102 | $date_format = get_option( 'date_format' ); |
103 | 103 | $time_format = get_option( 'time_format' ); |
104 | 104 | $x = 1; |
105 | 105 | $end = count( $account_activity ); |
106 | - foreach( $account_activity as $activity ) { |
|
107 | - $split_type = explode( ':',str_replace('-',' ',$activity['type'])); |
|
108 | - switch( $activity['type'] ) { |
|
106 | + foreach ( $account_activity as $activity ) { |
|
107 | + $split_type = explode( ':', str_replace( '-', ' ', $activity[ 'type' ] ) ); |
|
108 | + switch ( $activity[ 'type' ] ) { |
|
109 | 109 | case 'lists:new-subscriber': |
110 | 110 | case 'lists:profile-updates': |
111 | 111 | case 'campaigns:facebook-likes': |
@@ -123,60 +123,60 @@ discard block |
||
123 | 123 | $section_class = 'chimp-chatter-neutral'; |
124 | 124 | break; |
125 | 125 | } |
126 | - if( $x < 5 ) { |
|
126 | + if ( $x < 5 ) { |
|
127 | 127 | ?> |
128 | 128 | <!--- <section class="chimp-chatter-container <?php echo esc_attr( $section_class ); ?>"> |
129 | - <div class="chatter-type"><?php echo ucwords( $split_type[1] ); ?></div> |
|
129 | + <div class="chatter-type"><?php echo ucwords( $split_type[ 1 ] ); ?></div> |
|
130 | 130 | <p class="chatter-message description"> |
131 | - <?php echo $activity['message']; ?> |
|
131 | + <?php echo $activity[ 'message' ]; ?> |
|
132 | 132 | </p> |
133 | 133 | <p class="chatter-time"> |
134 | - <?php echo get_date_from_gmt( $activity['update_time'], 'F jS, Y h:i a' ); ?> |
|
134 | + <?php echo get_date_from_gmt( $activity[ 'update_time' ], 'F jS, Y h:i a' ); ?> |
|
135 | 135 | </p> |
136 | 136 | </section> --> |
137 | 137 | |
138 | - <section class="postbox yikes-easy-mc-postbox chimp-chatter-postbox <?php echo esc_attr( $section_class ); if( $x % 2 == 0 ) { echo ' even'; } ?>"> |
|
138 | + <section class="postbox yikes-easy-mc-postbox chimp-chatter-postbox <?php echo esc_attr( $section_class ); if ( $x % 2 == 0 ) { echo ' even'; } ?>"> |
|
139 | 139 | <div class="inside"> |
140 | - <div class="chatter-type"><?php echo ucwords( $split_type[1] ); ?></div> |
|
140 | + <div class="chatter-type"><?php echo ucwords( $split_type[ 1 ] ); ?></div> |
|
141 | 141 | <p class="chatter-message description"> |
142 | - <?php echo $activity['message']; ?> |
|
142 | + <?php echo $activity[ 'message' ]; ?> |
|
143 | 143 | </p> |
144 | 144 | <p class="chatter-time"> |
145 | - <?php echo get_date_from_gmt( $activity['update_time'], 'F jS, Y h:i a' ); ?> |
|
145 | + <?php echo get_date_from_gmt( $activity[ 'update_time' ], 'F jS, Y h:i a' ); ?> |
|
146 | 146 | </p> |
147 | 147 | </div> |
148 | 148 | </section> |
149 | 149 | <?php |
150 | 150 | } else { |
151 | - if( $x == 7 ) { |
|
151 | + if ( $x == 7 ) { |
|
152 | 152 | ?> |
153 | 153 | <div id="hidden-chatter" class="yikes-easy-mc-hidden"> |
154 | 154 | <?php |
155 | 155 | } |
156 | 156 | ?> |
157 | 157 | <!-- <section class="chimp-chatter-container <?php echo esc_attr( $section_class ); ?>"> |
158 | - <div class="chatter-type"><?php echo ucwords( $split_type[1] ); ?></div> |
|
158 | + <div class="chatter-type"><?php echo ucwords( $split_type[ 1 ] ); ?></div> |
|
159 | 159 | <p class="chatter-message description"> |
160 | - <?php echo $activity['message']; ?> |
|
160 | + <?php echo $activity[ 'message' ]; ?> |
|
161 | 161 | </p> |
162 | 162 | <p class="chatter-time"> |
163 | - <?php echo get_date_from_gmt( $activity['update_time'], 'F jS, Y h:i a' ); ?> |
|
163 | + <?php echo get_date_from_gmt( $activity[ 'update_time' ], 'F jS, Y h:i a' ); ?> |
|
164 | 164 | </p> |
165 | 165 | </section> --> |
166 | 166 | |
167 | - <section class="postbox yikes-easy-mc-postbox chimp-chatter-postbox <?php echo esc_attr( $section_class ); if( $x % 2 == 0 ) { echo ' even'; } ?>"> |
|
167 | + <section class="postbox yikes-easy-mc-postbox chimp-chatter-postbox <?php echo esc_attr( $section_class ); if ( $x % 2 == 0 ) { echo ' even'; } ?>"> |
|
168 | 168 | <div class="inside"> |
169 | - <div class="chatter-type"><?php echo ucwords( $split_type[1] ); ?></div> |
|
169 | + <div class="chatter-type"><?php echo ucwords( $split_type[ 1 ] ); ?></div> |
|
170 | 170 | <p class="chatter-message description"> |
171 | - <?php echo $activity['message']; ?> |
|
171 | + <?php echo $activity[ 'message' ]; ?> |
|
172 | 172 | </p> |
173 | 173 | <p class="chatter-time"> |
174 | - <?php echo get_date_from_gmt( $activity['update_time'], 'F jS, Y h:i a' ); ?> |
|
174 | + <?php echo get_date_from_gmt( $activity[ 'update_time' ], 'F jS, Y h:i a' ); ?> |
|
175 | 175 | </p> |
176 | 176 | </div> |
177 | 177 | </section> |
178 | 178 | <?php |
179 | - if( $x == $end ) { |
|
179 | + if ( $x == $end ) { |
|
180 | 180 | ?> |
181 | 181 | </div> |
182 | 182 | <?php |
@@ -187,7 +187,7 @@ discard block |
||
187 | 187 | ?> |
188 | 188 | |
189 | 189 | <div class="chimpchatter-button-container"> |
190 | - <a href="#" onclick="jQuery(this).parents().find('#hidden-chatter').slideToggle();jQuery(this).fadeOut();return false;" class="button-primary"><?php _e( 'View All Activity' , 'yikes-inc-easy-mailchimp-extender' ); ?></a> |
|
190 | + <a href="#" onclick="jQuery(this).parents().find('#hidden-chatter').slideToggle();jQuery(this).fadeOut();return false;" class="button-primary"><?php _e( 'View All Activity', 'yikes-inc-easy-mailchimp-extender' ); ?></a> |
|
191 | 191 | </div> |
192 | 192 | |
193 | 193 | <!-- </div> --> |
@@ -208,8 +208,8 @@ discard block |
||
208 | 208 | <div class="postbox yikes-easy-mc-postbox"> |
209 | 209 | <div class="inside"> |
210 | 210 | |
211 | - <a href="https://us3.admin.mailchimp.com/" title="<?php _e( 'MailChimp Site' , 'yikes-inc-easy-mailchimp-extender' ); ?>" target="_blank"> |
|
212 | - <img src="<?php echo YIKES_MC_URL . 'includes/images/Welcome_Page/mailchimp-logo.png'; ?>" title="<?php _e( 'MailChimp Site' , 'yikes-inc-easy-mailchimp-extender' ); ?>" class="chimp-chatter-mailchimp-logo"> |
|
211 | + <a href="https://us3.admin.mailchimp.com/" title="<?php _e( 'MailChimp Site', 'yikes-inc-easy-mailchimp-extender' ); ?>" target="_blank"> |
|
212 | + <img src="<?php echo YIKES_MC_URL . 'includes/images/Welcome_Page/mailchimp-logo.png'; ?>" title="<?php _e( 'MailChimp Site', 'yikes-inc-easy-mailchimp-extender' ); ?>" class="chimp-chatter-mailchimp-logo"> |
|
213 | 213 | </a> |
214 | 214 | |
215 | 215 | </div> |
@@ -219,60 +219,60 @@ discard block |
||
219 | 219 | <div class="postbox yikes-easy-mc-postbox chimp-chatter-sidebar"> |
220 | 220 | <div class="inside"> |
221 | 221 | |
222 | - <h2 class="account-status"><?php if( $account_details['has_activated'] == 1 ) { ?><div class="circle-account-active" title="<?php _e( "Account Active" , 'yikes-inc-easy-mailchimp-extender' ); ?>"></div><?php } else { ?><div class="circle-account-inactive" title="<?php _e( "Account Inactive" , 'yikes-inc-easy-mailchimp-extender' ); ?>"></div><?php } echo $profile_info['name']; ?> <small>(<?php echo $profile_info['role']; ?>)</small></h2> |
|
222 | + <h2 class="account-status"><?php if ( $account_details[ 'has_activated' ] == 1 ) { ?><div class="circle-account-active" title="<?php _e( "Account Active", 'yikes-inc-easy-mailchimp-extender' ); ?>"></div><?php } else { ?><div class="circle-account-inactive" title="<?php _e( "Account Inactive", 'yikes-inc-easy-mailchimp-extender' ); ?>"></div><?php } echo $profile_info[ 'name' ]; ?> <small>(<?php echo $profile_info[ 'role' ]; ?>)</small></h2> |
|
223 | 223 | |
224 | - <img class="mailchimp-avatar" src="<?php echo esc_url_raw( $profile_info['avatar'] ); ?>" title="<?php echo $profile_info['username'] . ' ' . __( "MailChimp avatar" , 'yikes-inc-easy-mailchimp-extender' ); ?>"> |
|
224 | + <img class="mailchimp-avatar" src="<?php echo esc_url_raw( $profile_info[ 'avatar' ] ); ?>" title="<?php echo $profile_info[ 'username' ] . ' ' . __( "MailChimp avatar", 'yikes-inc-easy-mailchimp-extender' ); ?>"> |
|
225 | 225 | |
226 | 226 | <table class="form-table" id="account-details-table"> |
227 | 227 | <tr valign="top"> |
228 | 228 | <td scope="row"> |
229 | 229 | <label for="tablecell"> |
230 | - <strong><?php _e( 'Company' , 'yikes-inc-easy-mailchimp-extender' ); ?></strong> |
|
230 | + <strong><?php _e( 'Company', 'yikes-inc-easy-mailchimp-extender' ); ?></strong> |
|
231 | 231 | </label> |
232 | 232 | </td> |
233 | - <td><?php echo $account_details['contact']['company']; ?><br /><?php echo $account_details['contact']['city'] . ', ' . $account_details['contact']['state']; ?></td> |
|
233 | + <td><?php echo $account_details[ 'contact' ][ 'company' ]; ?><br /><?php echo $account_details[ 'contact' ][ 'city' ] . ', ' . $account_details[ 'contact' ][ 'state' ]; ?></td> |
|
234 | 234 | </tr> |
235 | 235 | <tr valign="top"> |
236 | 236 | <td scope="row"> |
237 | 237 | <label for="tablecell"> |
238 | - <strong><?php _e( 'Industry' , 'yikes-inc-easy-mailchimp-extender' ); ?></strong> |
|
238 | + <strong><?php _e( 'Industry', 'yikes-inc-easy-mailchimp-extender' ); ?></strong> |
|
239 | 239 | </label> |
240 | 240 | </td> |
241 | - <td><?php echo $account_details['industry']; ?></td> |
|
241 | + <td><?php echo $account_details[ 'industry' ]; ?></td> |
|
242 | 242 | </tr> |
243 | 243 | <tr valign="top"> |
244 | 244 | <td scope="row"> |
245 | 245 | <label for="tablecell"> |
246 | - <strong><?php _e( 'Member Since' , 'yikes-inc-easy-mailchimp-extender' ); ?></strong> |
|
246 | + <strong><?php _e( 'Member Since', 'yikes-inc-easy-mailchimp-extender' ); ?></strong> |
|
247 | 247 | </label> |
248 | 248 | </td> |
249 | - <td><?php echo date( get_option('date_format') , strtotime( $account_details['member_since'] ) ); ?></td> |
|
249 | + <td><?php echo date( get_option( 'date_format' ), strtotime( $account_details[ 'member_since' ] ) ); ?></td> |
|
250 | 250 | </tr> |
251 | 251 | <tr valign="top"> |
252 | 252 | <td scope="row"> |
253 | 253 | <label for="tablecell"> |
254 | - <strong><?php _e( 'Plan Type' , 'yikes-inc-easy-mailchimp-extender' ); ?></strong> |
|
254 | + <strong><?php _e( 'Plan Type', 'yikes-inc-easy-mailchimp-extender' ); ?></strong> |
|
255 | 255 | </label> |
256 | 256 | </td> |
257 | - <td><?php echo ucwords( $account_details['plan_type'] ); ?></td> |
|
257 | + <td><?php echo ucwords( $account_details[ 'plan_type' ] ); ?></td> |
|
258 | 258 | </tr> |
259 | - <?php if( $account_details['plan_type'] == 'payasyougo' || $account_details['plan_type'] == 'free' ) { ?> |
|
259 | + <?php if ( $account_details[ 'plan_type' ] == 'payasyougo' || $account_details[ 'plan_type' ] == 'free' ) { ?> |
|
260 | 260 | <tr valign="top"> |
261 | 261 | <td scope="row"> |
262 | 262 | <label for="tablecell"> |
263 | - <strong><?php _e( 'Emails Left' , 'yikes-inc-easy-mailchimp-extender' ); ?></strong> |
|
263 | + <strong><?php _e( 'Emails Left', 'yikes-inc-easy-mailchimp-extender' ); ?></strong> |
|
264 | 264 | </label> |
265 | 265 | </td> |
266 | - <td><?php echo number_format( $account_details['emails_left'] ); ?></td> |
|
266 | + <td><?php echo number_format( $account_details[ 'emails_left' ] ); ?></td> |
|
267 | 267 | </tr> |
268 | 268 | <?php } ?> |
269 | 269 | <tr valign="top"> |
270 | 270 | <td scope="row"> |
271 | 271 | <label for="tablecell"> |
272 | - <strong><?php _e( 'Affiliate Link' , 'yikes-inc-easy-mailchimp-extender' ); ?></strong> |
|
272 | + <strong><?php _e( 'Affiliate Link', 'yikes-inc-easy-mailchimp-extender' ); ?></strong> |
|
273 | 273 | </label> |
274 | 274 | </td> |
275 | - <td><a href="#" onclick="jQuery(this).hide().next().fadeIn('fast');return false;" class="button-secondary"><?php _e( 'View Link', 'yikes-inc-easy-mailchimp-extender' ); ?></a><input type="text" class="widefat mailchimp-affiliate-link" readonly value="<?php echo esc_url_raw( $account_details['affiliate_link'] ); ?>" onclick="jQuery(this).select();return false;"></td> |
|
275 | + <td><a href="#" onclick="jQuery(this).hide().next().fadeIn('fast');return false;" class="button-secondary"><?php _e( 'View Link', 'yikes-inc-easy-mailchimp-extender' ); ?></a><input type="text" class="widefat mailchimp-affiliate-link" readonly value="<?php echo esc_url_raw( $account_details[ 'affiliate_link' ] ); ?>" onclick="jQuery(this).select();return false;"></td> |
|
276 | 276 | </tr> |
277 | 277 | </table> |
278 | 278 |
@@ -5,13 +5,13 @@ discard block |
||
5 | 5 | */ |
6 | 6 | |
7 | 7 | /* Get and Store Option Values */ |
8 | - if( get_option( 'yikes-mc-api-validation' , 'invalid_api_key' ) === 'valid_api_key' ) { |
|
9 | - $api_connection = '<span id="connection-container" class="api-connected" title="' . __( "Your site is currently connected to the MailChimp API" , "yikes-inc-easy-mailchimp-extender" ) . '"><span class="dashicons dashicons-yes yikes-mc-api-connected"></span> ' . __( "Connected" , 'yikes-inc-easy-mailchimp-extender' ) . '</span>'; |
|
8 | + if ( get_option( 'yikes-mc-api-validation', 'invalid_api_key' ) === 'valid_api_key' ) { |
|
9 | + $api_connection = '<span id="connection-container" class="api-connected" title="' . __( "Your site is currently connected to the MailChimp API", "yikes-inc-easy-mailchimp-extender" ) . '"><span class="dashicons dashicons-yes yikes-mc-api-connected"></span> ' . __( "Connected", 'yikes-inc-easy-mailchimp-extender' ) . '</span>'; |
|
10 | 10 | $api_error_response = ''; |
11 | 11 | } else { |
12 | - $api_connection = '<span id="connection-container" class="api-not-connected"><span class="dashicons dashicons-no-alt yikes-mc-api-not-connected"></span> ' . __( "Not Connected" , 'yikes-inc-easy-mailchimp-extender' ) . '</span>'; |
|
13 | - if( get_option( 'yikes-mc-api-invalid-key-response' , '' ) != '' ) { |
|
14 | - $api_error_response = '<p><small><i class="dashicons dashicons-no-alt"></i> ' . get_option( 'yikes-mc-api-invalid-key-response' , '' ) . '</small></p>'; |
|
12 | + $api_connection = '<span id="connection-container" class="api-not-connected"><span class="dashicons dashicons-no-alt yikes-mc-api-not-connected"></span> ' . __( "Not Connected", 'yikes-inc-easy-mailchimp-extender' ) . '</span>'; |
|
13 | + if ( get_option( 'yikes-mc-api-invalid-key-response', '' ) != '' ) { |
|
14 | + $api_error_response = '<p><small><i class="dashicons dashicons-no-alt"></i> ' . get_option( 'yikes-mc-api-invalid-key-response', '' ) . '</small></p>'; |
|
15 | 15 | } else { |
16 | 16 | $api_error_response = ''; |
17 | 17 | } |
@@ -25,15 +25,15 @@ discard block |
||
25 | 25 | <div class="wrap"> |
26 | 26 | |
27 | 27 | <!-- Freddie Logo --> |
28 | - <img src="<?php echo YIKES_MC_URL . 'includes/images/MailChimp_Assets/Freddie_60px.png'; ?>" alt="<?php _e( 'Freddie - MailChimp Mascot' , 'yikes-inc-easy-mailchimp-extender' ); ?>" class="yikes-mc-freddie-logo" /> |
|
28 | + <img src="<?php echo YIKES_MC_URL . 'includes/images/MailChimp_Assets/Freddie_60px.png'; ?>" alt="<?php _e( 'Freddie - MailChimp Mascot', 'yikes-inc-easy-mailchimp-extender' ); ?>" class="yikes-mc-freddie-logo" /> |
|
29 | 29 | |
30 | - <h1>YIKES Easy Forms for MailChimp | <?php if ( isset( $_REQUEST['section'] ) ) { echo ucwords( str_replace( '-', ' ', $_REQUEST['section'] ) ); } else { echo __( 'General Settings' , 'yikes-inc-easy-mailchimp-extender' ); } ?></h1> |
|
30 | + <h1>YIKES Easy Forms for MailChimp | <?php if ( isset( $_REQUEST[ 'section' ] ) ) { echo ucwords( str_replace( '-', ' ', $_REQUEST[ 'section' ] ) ); } else { echo __( 'General Settings', 'yikes-inc-easy-mailchimp-extender' ); } ?></h1> |
|
31 | 31 | |
32 | 32 | <!-- Settings Page Description --> |
33 | - <p class="yikes-easy-mc-about-text about-text"><?php _e( 'Easy Forms for MailChimp allows you to painlessly add MailChimp sign up forms to your WordPress site and track user activity with interactive reports.' , 'yikes-inc-easy-mailchimp-extender' ); ?></p> |
|
33 | + <p class="yikes-easy-mc-about-text about-text"><?php _e( 'Easy Forms for MailChimp allows you to painlessly add MailChimp sign up forms to your WordPress site and track user activity with interactive reports.', 'yikes-inc-easy-mailchimp-extender' ); ?></p> |
|
34 | 34 | <?php |
35 | 35 | /* Success Messages on Options Updated */ |
36 | - if( isset( $_REQUEST['settings-updated'] ) && $_REQUEST['settings-updated'] == 'true' ) { |
|
36 | + if ( isset( $_REQUEST[ 'settings-updated' ] ) && $_REQUEST[ 'settings-updated' ] == 'true' ) { |
|
37 | 37 | ?> |
38 | 38 | <div class="updated manage-form-admin-notice"> |
39 | 39 | <p><?php _e( 'Settings successfully updated.', 'yikes-inc-easy-mailchimp-extender' ); ?></p> |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | <?php |
42 | 42 | } |
43 | 43 | /* MailChimp API Cleared Successfully message */ |
44 | - if( isset( $_REQUEST['transient-cleared'] ) && $_REQUEST['transient-cleared'] == 'true' ) { |
|
44 | + if ( isset( $_REQUEST[ 'transient-cleared' ] ) && $_REQUEST[ 'transient-cleared' ] == 'true' ) { |
|
45 | 45 | ?> |
46 | 46 | <div class="updated manage-form-admin-notice"> |
47 | 47 | <p><?php _e( 'MailChimp API Cache successfully cleared.', 'yikes-inc-easy-mailchimp-extender' ); ?></p> |
@@ -50,7 +50,7 @@ discard block |
||
50 | 50 | } |
51 | 51 | /* Error Log Clear Messages */ |
52 | 52 | /* Success Messages on Options Updated */ |
53 | - if( isset( $_REQUEST['error-log-cleared'] ) && $_REQUEST['error-log-cleared'] == 'true' ) { |
|
53 | + if ( isset( $_REQUEST[ 'error-log-cleared' ] ) && $_REQUEST[ 'error-log-cleared' ] == 'true' ) { |
|
54 | 54 | ?> |
55 | 55 | <div class="updated manage-form-admin-notice"> |
56 | 56 | <p><?php _e( 'Error log successfully cleared.', 'yikes-inc-easy-mailchimp-extender' ); ?></p> |
@@ -58,7 +58,7 @@ discard block |
||
58 | 58 | <?php |
59 | 59 | } |
60 | 60 | /* MailChimp API Cleared Successfully message */ |
61 | - if( isset( $_REQUEST['error-log-cleared'] ) && $_REQUEST['error-log-cleared'] == 'false' ) { |
|
61 | + if ( isset( $_REQUEST[ 'error-log-cleared' ] ) && $_REQUEST[ 'error-log-cleared' ] == 'false' ) { |
|
62 | 62 | ?> |
63 | 63 | <div class="error manage-form-admin-notice"> |
64 | 64 | <p><?php _e( "Whoops! We've encountered an error while trying to clear the error log. Please refresh the page and try again. If the error persists please get in touch with the YIKES Inc. support team.", 'yikes-inc-easy-mailchimp-extender' ); ?></p> |
@@ -67,28 +67,28 @@ discard block |
||
67 | 67 | } |
68 | 68 | |
69 | 69 | /* Display a success message if our error log was sucessfully created, or display an error if not */ |
70 | - if( isset( $_GET['error_log_created'] ) && $_GET['error_log_created'] == 'true' ) { |
|
70 | + if ( isset( $_GET[ 'error_log_created' ] ) && $_GET[ 'error_log_created' ] == 'true' ) { |
|
71 | 71 | ?> |
72 | 72 | <div class="updated"> |
73 | 73 | <p><?php _e( 'Error log successfully created. You may now start logging errors.', 'yikes-inc-easy-mailchimp-extender' ); ?></p> |
74 | 74 | </div> |
75 | 75 | <?php |
76 | - } else if( isset( $_GET['error_log_created'] ) && $_GET['error_log_created'] == 'false' ) { |
|
76 | + } else if ( isset( $_GET[ 'error_log_created' ] ) && $_GET[ 'error_log_created' ] == 'false' ) { |
|
77 | 77 | ?> |
78 | 78 | <div class="error"> |
79 | - <p><?php _e( urldecode( $_GET['error_message'] ) , 'yikes-inc-easy-mailchimp-extender' ); ?></p> |
|
79 | + <p><?php _e( urldecode( $_GET[ 'error_message' ] ), 'yikes-inc-easy-mailchimp-extender' ); ?></p> |
|
80 | 80 | </div> |
81 | 81 | <?php |
82 | 82 | } |
83 | 83 | |
84 | 84 | /* Display a success message if the user successfully imported some forms */ |
85 | - if( isset( $_GET['section'] ) && $_GET['section'] == 'import-export-forms' && isset( $_GET['import-forms'] ) && $_GET['import-forms'] == 'true' ) { |
|
85 | + if ( isset( $_GET[ 'section' ] ) && $_GET[ 'section' ] == 'import-export-forms' && isset( $_GET[ 'import-forms' ] ) && $_GET[ 'import-forms' ] == 'true' ) { |
|
86 | 86 | ?> |
87 | 87 | <div class="updated"> |
88 | 88 | <p><?php printf( __( 'Opt-in forms successfully imported. <a href="%s" title="View Forms">View Forms</a>', 'yikes-inc-easy-mailchimp-extender' ), esc_url_raw( admin_url( 'admin.php?page=yikes-inc-easy-mailchimp' ) ) ); ?></p> |
89 | 89 | </div> |
90 | 90 | <?php |
91 | - } elseif( isset( $_GET['section'] ) && $_GET['section'] == 'import-export-forms' && isset( $_GET['import-settings'] ) && $_GET['import-settings'] == 'true' ) { |
|
91 | + } elseif ( isset( $_GET[ 'section' ] ) && $_GET[ 'section' ] == 'import-export-forms' && isset( $_GET[ 'import-settings' ] ) && $_GET[ 'import-settings' ] == 'true' ) { |
|
92 | 92 | ?> |
93 | 93 | <div class="updated"> |
94 | 94 | <p><?php printf( __( 'YIKES Easy Forms for MailChimp settings successfully imported.', 'yikes-inc-easy-mailchimp-extender' ), esc_url_raw( admin_url( 'admin.php?page=yikes-inc-easy-mailchimp' ) ) ); ?></p> |
@@ -109,11 +109,11 @@ discard block |
||
109 | 109 | |
110 | 110 | <div class="postbox yikes-easy-mc-postbox"> |
111 | 111 | |
112 | - <?php if( !isset( $_REQUEST['section'] ) || $_REQUEST['section'] == '' ) { |
|
112 | + <?php if ( ! isset( $_REQUEST[ 'section' ] ) || $_REQUEST[ 'section' ] == '' ) { |
|
113 | 113 | include YIKES_MC_PATH . 'admin/partials/menu/options-sections/general-settings.php'; |
114 | 114 | } else { |
115 | - if( isset( $_REQUEST['addon'] ) && $_REQUEST['addon'] == 'true' ) { |
|
116 | - include apply_filters( 'yikes-mailchimp-'.$_REQUEST['section'].'-options-path' , '' ); |
|
115 | + if ( isset( $_REQUEST[ 'addon' ] ) && $_REQUEST[ 'addon' ] == 'true' ) { |
|
116 | + include apply_filters( 'yikes-mailchimp-' . $_REQUEST[ 'section' ] . '-options-path', '' ); |
|
117 | 117 | } else { |
118 | 118 | // White list a set of files that are allowed to be included here |
119 | 119 | $file_base = 'admin/partials/menu/options-sections/'; |
@@ -126,8 +126,8 @@ discard block |
||
126 | 126 | $file_base . 'recaptcha-settings.php', |
127 | 127 | ); |
128 | 128 | // Ensure the included file is allowed and whitelisted above, before including it |
129 | - if ( 0 === validate_file( 'admin/partials/menu/options-sections/' . $_REQUEST['section'] . '.php', $acceptable_files ) ) { |
|
130 | - include YIKES_MC_PATH . 'admin/partials/menu/options-sections/' . $_REQUEST['section'] . '.php'; |
|
129 | + if ( 0 === validate_file( 'admin/partials/menu/options-sections/' . $_REQUEST[ 'section' ] . '.php', $acceptable_files ) ) { |
|
130 | + include YIKES_MC_PATH . 'admin/partials/menu/options-sections/' . $_REQUEST[ 'section' ] . '.php'; |
|
131 | 131 | } else { |
132 | 132 | wp_die( esc_attr__( 'Invalid file. If this error persists, please contact support.', 'yikes-inc-easy-mailchimp' ) ); |
133 | 133 | } |
@@ -1,11 +1,11 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | // lets confirm the user has a valid API key stored |
3 | - if( $this->is_user_mc_api_valid_form( false ) == 'valid' ) { |
|
3 | + if ( $this->is_user_mc_api_valid_form( false ) == 'valid' ) { |
|
4 | 4 | /// Check for a transient, if not - set one up for one hour |
5 | 5 | if ( false === ( $list_data = get_transient( 'yikes-easy-mailchimp-list-data' ) ) ) { |
6 | 6 | $api_key = yikes_get_mc_api_key(); |
7 | 7 | $dash_position = strpos( $api_key, '-' ); |
8 | - if( $dash_position !== false ) { |
|
8 | + if ( $dash_position !== false ) { |
|
9 | 9 | $api_endpoint = 'https://' . substr( $api_key, $dash_position + 1 ) . '.api.mailchimp.com/2.0/lists/list.json'; |
10 | 10 | } |
11 | 11 | $list_data = wp_remote_post( $api_endpoint, array( |
@@ -17,11 +17,11 @@ discard block |
||
17 | 17 | 'sslverify' => apply_filters( 'yikes-mailchimp-sslverify', true ) |
18 | 18 | ) ); |
19 | 19 | $list_data = json_decode( wp_remote_retrieve_body( $list_data ), true ); |
20 | - if( isset( $list_data['error'] ) ) { |
|
21 | - if( WP_DEBUG || get_option( 'yikes-mailchimp-debug-status' , '' ) == '1' ) { |
|
20 | + if ( isset( $list_data[ 'error' ] ) ) { |
|
21 | + if ( WP_DEBUG || get_option( 'yikes-mailchimp-debug-status', '' ) == '1' ) { |
|
22 | 22 | require_once YIKES_MC_PATH . 'includes/error_log/class-yikes-inc-easy-mailchimp-error-logging.php'; |
23 | 23 | $error_logging = new Yikes_Inc_Easy_Mailchimp_Error_Logging(); |
24 | - $error_logging->yikes_easy_mailchimp_write_to_error_log( $list_data['error'], __( "Get Account Lists" , 'yikes-inc-easy-mailchimp-extender' ), "Manage Lists Page" ); |
|
24 | + $error_logging->yikes_easy_mailchimp_write_to_error_log( $list_data[ 'error' ], __( "Get Account Lists", 'yikes-inc-easy-mailchimp-extender' ), "Manage Lists Page" ); |
|
25 | 25 | } |
26 | 26 | } else { |
27 | 27 | // set our transient |
@@ -32,17 +32,17 @@ discard block |
||
32 | 32 | ?> |
33 | 33 | <div class="wrap"> |
34 | 34 | <!-- Freddie Logo --> |
35 | - <img src="<?php echo YIKES_MC_URL . 'includes/images/MailChimp_Assets/Freddie_60px.png'; ?>" alt="<?php __( 'Freddie - MailChimp Mascot' , 'yikes-inc-easy-mailchimp-extender' ); ?>" class="yikes-mc-freddie-logo" /> |
|
35 | + <img src="<?php echo YIKES_MC_URL . 'includes/images/MailChimp_Assets/Freddie_60px.png'; ?>" alt="<?php __( 'Freddie - MailChimp Mascot', 'yikes-inc-easy-mailchimp-extender' ); ?>" class="yikes-mc-freddie-logo" /> |
|
36 | 36 | |
37 | - <h1>YIKES Easy Forms for MailChimp | <?php _e( 'Manage Mailing Lists' , 'yikes-inc-easy-mailchimp-extender' ); ?></h1> |
|
37 | + <h1>YIKES Easy Forms for MailChimp | <?php _e( 'Manage Mailing Lists', 'yikes-inc-easy-mailchimp-extender' ); ?></h1> |
|
38 | 38 | |
39 | 39 | <!-- Settings Page Description --> |
40 | - <p class="yikes-easy-mc-about-text about-text"><?php _e( 'Make edits to your MailChimp lists on the following page. Select a list to make edits to it.' , 'yikes-inc-easy-mailchimp-extender' ); ?></p> |
|
40 | + <p class="yikes-easy-mc-about-text about-text"><?php _e( 'Make edits to your MailChimp lists on the following page. Select a list to make edits to it.', 'yikes-inc-easy-mailchimp-extender' ); ?></p> |
|
41 | 41 | |
42 | 42 | <?php |
43 | 43 | /* If the user hasn't authenticated yet, lets kill off */ |
44 | - if( get_option( 'yikes-mc-api-validation' , 'invalid_api_key' ) != 'valid_api_key' ) { |
|
45 | - wp_die( '<div class="error"><p>' . sprintf( __( 'You need to connect to MailChimp before you can start creating forms. Head over to the <a href="%s" title="Settings Page">Settings Page</a> and enter your API key.', 'yikes-inc-easy-mailchimp-extender' ), esc_url_raw( admin_url( 'admin.php?page=yikes-inc-easy-mailchimp-settings' ) ) ) . '</p></div>' , 500 ); |
|
44 | + if ( get_option( 'yikes-mc-api-validation', 'invalid_api_key' ) != 'valid_api_key' ) { |
|
45 | + wp_die( '<div class="error"><p>' . sprintf( __( 'You need to connect to MailChimp before you can start creating forms. Head over to the <a href="%s" title="Settings Page">Settings Page</a> and enter your API key.', 'yikes-inc-easy-mailchimp-extender' ), esc_url_raw( admin_url( 'admin.php?page=yikes-inc-easy-mailchimp-settings' ) ) ) . '</p></div>', 500 ); |
|
46 | 46 | } |
47 | 47 | ?> |
48 | 48 | |
@@ -63,8 +63,8 @@ discard block |
||
63 | 63 | <!-- TABLE HEAD --> |
64 | 64 | <thead> |
65 | 65 | <tr> |
66 | - <th id="columnname" class="manage-column column-columnname" scope="col"><?php _e( 'List Name' , 'yikes-inc-easy-mailchimp-extender' ); ?></th> |
|
67 | - <th id="columnname" class="manage-column column-columnname num" scope="col"><?php _e( 'Subscriber Count' , 'yikes-inc-easy-mailchimp-extender' ); ?></th> |
|
66 | + <th id="columnname" class="manage-column column-columnname" scope="col"><?php _e( 'List Name', 'yikes-inc-easy-mailchimp-extender' ); ?></th> |
|
67 | + <th id="columnname" class="manage-column column-columnname num" scope="col"><?php _e( 'Subscriber Count', 'yikes-inc-easy-mailchimp-extender' ); ?></th> |
|
68 | 68 | </tr> |
69 | 69 | </thead> |
70 | 70 | <!-- end header --> |
@@ -72,25 +72,25 @@ discard block |
||
72 | 72 | <!-- FOOTER --> |
73 | 73 | <tfoot> |
74 | 74 | <tr> |
75 | - <th class="manage-column column-columnname" scope="col"><?php _e( 'List Name' , 'yikes-inc-easy-mailchimp-extender' ); ?></th> |
|
76 | - <th class="manage-column column-columnname num" scope="col"><?php _e( 'Subscriber Count' , 'yikes-inc-easy-mailchimp-extender' ); ?></th> |
|
75 | + <th class="manage-column column-columnname" scope="col"><?php _e( 'List Name', 'yikes-inc-easy-mailchimp-extender' ); ?></th> |
|
76 | + <th class="manage-column column-columnname num" scope="col"><?php _e( 'Subscriber Count', 'yikes-inc-easy-mailchimp-extender' ); ?></th> |
|
77 | 77 | </tr> |
78 | 78 | </tfoot> |
79 | 79 | <!-- end footer --> |
80 | 80 | |
81 | 81 | <!-- TABLE BODY --> |
82 | 82 | <tbody> |
83 | - <?php if( $list_data['total'] > 0 ) { |
|
83 | + <?php if ( $list_data[ 'total' ] > 0 ) { |
|
84 | 84 | $i = 1; |
85 | - foreach( $list_data['data'] as $list ) { |
|
85 | + foreach ( $list_data[ 'data' ] as $list ) { |
|
86 | 86 | ?> |
87 | - <tr class="<?php if( $i % 2 == 0 ) { echo 'alternate'; } ?>"> |
|
87 | + <tr class="<?php if ( $i % 2 == 0 ) { echo 'alternate'; } ?>"> |
|
88 | 88 | <td class="column-columnname"> |
89 | - <a href="<?php echo esc_url_raw( add_query_arg( array( 'list-id' => $list['id'] ) , admin_url( 'admin.php?page=yikes-mailchimp-view-list' ) ) ); ?>" class="row-title"> |
|
90 | - <?php echo stripslashes( $list['name'] ); ?> |
|
89 | + <a href="<?php echo esc_url_raw( add_query_arg( array( 'list-id' => $list[ 'id' ] ), admin_url( 'admin.php?page=yikes-mailchimp-view-list' ) ) ); ?>" class="row-title"> |
|
90 | + <?php echo stripslashes( $list[ 'name' ] ); ?> |
|
91 | 91 | </a> |
92 | 92 | <div class="row-actions"> |
93 | - <span><a href="<?php echo esc_url_raw( add_query_arg( array( 'list-id' => $list['id'] ) , admin_url( 'admin.php?page=yikes-mailchimp-view-list' ) ) ); ?>"><?php _e( "View" , 'yikes-inc-easy-mailchimp-extender' ); ?></a></span> |
|
93 | + <span><a href="<?php echo esc_url_raw( add_query_arg( array( 'list-id' => $list[ 'id' ] ), admin_url( 'admin.php?page=yikes-mailchimp-view-list' ) ) ); ?>"><?php _e( "View", 'yikes-inc-easy-mailchimp-extender' ); ?></a></span> |
|
94 | 94 | <?php |
95 | 95 | /* |
96 | 96 | * Custom action to allow users to add additional action links |
@@ -100,14 +100,14 @@ discard block |
||
100 | 100 | ?> |
101 | 101 | </div> |
102 | 102 | </td> |
103 | - <td class="column-columnname num"><?php echo $list['stats']['member_count']; ?></td> |
|
103 | + <td class="column-columnname num"><?php echo $list[ 'stats' ][ 'member_count' ]; ?></td> |
|
104 | 104 | </tr> |
105 | 105 | <?php |
106 | 106 | $i++; |
107 | 107 | } |
108 | 108 | } else { ?> |
109 | 109 | <tr class="no-items"> |
110 | - <td class="colspanchange no-mailchimp-lists-found" colspan="3"><em><?php printf( __( 'No MailChimp lists found. Head over to <a href="%s" title="MailChimp.com">MailChimp.com</a> to setup your first mailing list. Once thats done you can head back here to customize it!' , 'yikes-inc-easy-mailchimp-extender' ), esc_url( 'http://mailchimp.com/' ) ); ?></em></td> |
|
110 | + <td class="colspanchange no-mailchimp-lists-found" colspan="3"><em><?php printf( __( 'No MailChimp lists found. Head over to <a href="%s" title="MailChimp.com">MailChimp.com</a> to setup your first mailing list. Once thats done you can head back here to customize it!', 'yikes-inc-easy-mailchimp-extender' ), esc_url( 'http://mailchimp.com/' ) ); ?></em></td> |
|
111 | 111 | </tr> |
112 | 112 | <?php } ?> |
113 | 113 | </tbody> |
@@ -1,11 +1,11 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | // lets confirm the user has a valid API key stored |
3 | - if( $this->is_user_mc_api_valid_form( false ) == 'valid' ) { |
|
3 | + if ( $this->is_user_mc_api_valid_form( false ) == 'valid' ) { |
|
4 | 4 | /// Check for a transient, if not - set one up for one hour |
5 | 5 | if ( false === ( $list_data = get_transient( 'yikes-easy-mailchimp-list-data' ) ) ) { |
6 | 6 | $api_key = yikes_get_mc_api_key(); |
7 | 7 | $dash_position = strpos( $api_key, '-' ); |
8 | - if( $dash_position !== false ) { |
|
8 | + if ( $dash_position !== false ) { |
|
9 | 9 | $api_endpoint = 'https://' . substr( $api_key, $dash_position + 1 ) . '.api.mailchimp.com/2.0/lists/list.json'; |
10 | 10 | } |
11 | 11 | $list_data = wp_remote_post( $api_endpoint, array( |
@@ -17,11 +17,11 @@ discard block |
||
17 | 17 | 'sslverify' => apply_filters( 'yikes-mailchimp-sslverify', true ) |
18 | 18 | ) ); |
19 | 19 | $list_data = json_decode( wp_remote_retrieve_body( $list_data ), true ); |
20 | - if( isset( $list_data['error'] ) ) { |
|
21 | - if( WP_DEBUG || get_option( 'yikes-mailchimp-debug-status' , '' ) == '1' ) { |
|
20 | + if ( isset( $list_data[ 'error' ] ) ) { |
|
21 | + if ( WP_DEBUG || get_option( 'yikes-mailchimp-debug-status', '' ) == '1' ) { |
|
22 | 22 | require_once YIKES_MC_PATH . 'includes/error_log/class-yikes-inc-easy-mailchimp-error-logging.php'; |
23 | 23 | $error_logging = new Yikes_Inc_Easy_Mailchimp_Error_Logging(); |
24 | - $error_logging->yikes_easy_mailchimp_write_to_error_log( $list_data['error'], __( "Get Account Lists" , 'yikes-inc-easy-mailchimp-extender' ), "View Lists Page" ); |
|
24 | + $error_logging->yikes_easy_mailchimp_write_to_error_log( $list_data[ 'error' ], __( "Get Account Lists", 'yikes-inc-easy-mailchimp-extender' ), "View Lists Page" ); |
|
25 | 25 | } |
26 | 26 | } else { |
27 | 27 | // set our transient |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | } |
30 | 30 | } |
31 | 31 | } else { |
32 | - wp_die( __( 'It looks like you need to re-validate your MailChimp API key before you can continue.' , 'yikes-inc-easy-mailchimp-extender' ) , 500 ); |
|
32 | + wp_die( __( 'It looks like you need to re-validate your MailChimp API key before you can continue.', 'yikes-inc-easy-mailchimp-extender' ), 500 ); |
|
33 | 33 | } |
34 | 34 | |
35 | 35 | wp_register_script( 'yikes-easy-mc-manage-forms-script', YIKES_MC_URL . 'admin/js/yikes-inc-easy-mailchimp-manage-forms.js', array( 'jquery' ), $this->version, false ); |
@@ -43,12 +43,12 @@ discard block |
||
43 | 43 | ?> |
44 | 44 | <div class="wrap"> |
45 | 45 | <!-- Freddie Logo --> |
46 | - <img src="<?php echo YIKES_MC_URL . 'includes/images/MailChimp_Assets/Freddie_60px.png'; ?>" alt="<?php _e( 'Freddie - MailChimp Mascot' , 'yikes-inc-easy-mailchimp-extender' ); ?>" class="yikes-mc-freddie-logo" /> |
|
46 | + <img src="<?php echo YIKES_MC_URL . 'includes/images/MailChimp_Assets/Freddie_60px.png'; ?>" alt="<?php _e( 'Freddie - MailChimp Mascot', 'yikes-inc-easy-mailchimp-extender' ); ?>" class="yikes-mc-freddie-logo" /> |
|
47 | 47 | |
48 | - <h1>YIKES Easy Forms for MailChimp | <?php _e( 'Manage Lists' , 'yikes-inc-easy-mailchimp-extender' ) ?></h1> |
|
48 | + <h1>YIKES Easy Forms for MailChimp | <?php _e( 'Manage Lists', 'yikes-inc-easy-mailchimp-extender' ) ?></h1> |
|
49 | 49 | |
50 | 50 | <!-- Settings Page Description --> |
51 | - <p class="yikes-easy-mc-about-text about-text"><?php _e( 'Make edits to your MailChimp lists on the following page. Select a list to make edits to it.' , 'yikes-inc-easy-mailchimp-extender' ); ?></p> |
|
51 | + <p class="yikes-easy-mc-about-text about-text"><?php _e( 'Make edits to your MailChimp lists on the following page. Select a list to make edits to it.', 'yikes-inc-easy-mailchimp-extender' ); ?></p> |
|
52 | 52 | |
53 | 53 | <!-- entire body content --> |
54 | 54 | <div id="poststuff"> |
@@ -68,8 +68,8 @@ discard block |
||
68 | 68 | <thead> |
69 | 69 | <tr> |
70 | 70 | <th id="cb" class="manage-column column-cb check-column" scope="col"><input type="checkbox" /></th> |
71 | - <th id="columnname" class="manage-column column-columnname" scope="col"><?php _e( 'List Name' , 'yikes-inc-easy-mailchimp-extender' ); ?></th> |
|
72 | - <th id="columnname" class="manage-column column-columnname num" scope="col"><?php _e( 'Subscriber Count' , 'yikes-inc-easy-mailchimp-extender' ); ?></th> |
|
71 | + <th id="columnname" class="manage-column column-columnname" scope="col"><?php _e( 'List Name', 'yikes-inc-easy-mailchimp-extender' ); ?></th> |
|
72 | + <th id="columnname" class="manage-column column-columnname num" scope="col"><?php _e( 'Subscriber Count', 'yikes-inc-easy-mailchimp-extender' ); ?></th> |
|
73 | 73 | </tr> |
74 | 74 | </thead> |
75 | 75 | <!-- end header --> |
@@ -78,36 +78,36 @@ discard block |
||
78 | 78 | <tfoot> |
79 | 79 | <tr> |
80 | 80 | <th class="manage-column column-cb check-column" scope="col"><input type="checkbox" /></th> |
81 | - <th class="manage-column column-columnname" scope="col"><?php _e( 'Form Name' , 'yikes-inc-easy-mailchimp-extender' ); ?></th> |
|
82 | - <th class="manage-column column-columnname num" scope="col"><?php _e( 'Subscriber Count' , 'yikes-inc-easy-mailchimp-extender' ); ?></th> |
|
81 | + <th class="manage-column column-columnname" scope="col"><?php _e( 'Form Name', 'yikes-inc-easy-mailchimp-extender' ); ?></th> |
|
82 | + <th class="manage-column column-columnname num" scope="col"><?php _e( 'Subscriber Count', 'yikes-inc-easy-mailchimp-extender' ); ?></th> |
|
83 | 83 | </tr> |
84 | 84 | </tfoot> |
85 | 85 | <!-- end footer --> |
86 | 86 | |
87 | 87 | <!-- TABLE BODY --> |
88 | 88 | <tbody> |
89 | - <?php if( count( $list_data['total'] ) > 0 ) { |
|
89 | + <?php if ( count( $list_data[ 'total' ] ) > 0 ) { |
|
90 | 90 | $i = 1; |
91 | - foreach( $list_data['data'] as $list ) { |
|
91 | + foreach ( $list_data[ 'data' ] as $list ) { |
|
92 | 92 | ?> |
93 | - <tr class="<?php if( $i % 2 == 0 ) { echo 'alternate'; } ?>"> |
|
93 | + <tr class="<?php if ( $i % 2 == 0 ) { echo 'alternate'; } ?>"> |
|
94 | 94 | <th class="check-column" scope="row"><input type="checkbox" /></th> |
95 | - <td class="column-columnname"><?php echo stripslashes( $list['name'] ); ?> |
|
95 | + <td class="column-columnname"><?php echo stripslashes( $list[ 'name' ] ); ?> |
|
96 | 96 | <div class="row-actions"> |
97 | - <span><a href="<?php echo esc_url_raw( add_query_arg( array( 'list-id' => (int) $list['id'] ) , admin_url( 'admin.php?page=yikes-mailchimp-view-list' ) ) ); ?>"><?php _e( "View" , 'yikes-inc-easy-mailchimp-extender' ); ?></a> |</span> |
|
98 | - <span><a href="<?php echo esc_url_raw( add_query_arg( array( 'list-id' => (int) $list['id'] ) , admin_url( 'admin.php?page=yikes-mailchimp-edit-list' ) ) ); ?>"><?php _e( "Edit Fields" , 'yikes-inc-easy-mailchimp-extender' ); ?></a> |</span> |
|
99 | - <span><a href="<?php echo esc_url_raw( add_query_arg( array( 'action' => '', 'mailchimp-list' => (int) $list['id'] , 'nonce' => wp_create_nonce( 'duplicate-mailchimp-form-'.$list['id'] ) ) , admin_url( 'admin.php?page=yikes-inc-easy-mailchimp' ) ) ); ?>"><?php _e( "Delete" , 'yikes-inc-easy-mailchimp-extender' ); ?></a> |</span> |
|
100 | - <span><a href="#" class="view-yikes-mc-list-info"><?php _e( "List Info." , 'yikes-inc-easy-mailchimp-extender' ); ?></a></span> |
|
97 | + <span><a href="<?php echo esc_url_raw( add_query_arg( array( 'list-id' => (int) $list[ 'id' ] ), admin_url( 'admin.php?page=yikes-mailchimp-view-list' ) ) ); ?>"><?php _e( "View", 'yikes-inc-easy-mailchimp-extender' ); ?></a> |</span> |
|
98 | + <span><a href="<?php echo esc_url_raw( add_query_arg( array( 'list-id' => (int) $list[ 'id' ] ), admin_url( 'admin.php?page=yikes-mailchimp-edit-list' ) ) ); ?>"><?php _e( "Edit Fields", 'yikes-inc-easy-mailchimp-extender' ); ?></a> |</span> |
|
99 | + <span><a href="<?php echo esc_url_raw( add_query_arg( array( 'action' => '', 'mailchimp-list' => (int) $list[ 'id' ], 'nonce' => wp_create_nonce( 'duplicate-mailchimp-form-' . $list[ 'id' ] ) ), admin_url( 'admin.php?page=yikes-inc-easy-mailchimp' ) ) ); ?>"><?php _e( "Delete", 'yikes-inc-easy-mailchimp-extender' ); ?></a> |</span> |
|
100 | + <span><a href="#" class="view-yikes-mc-list-info"><?php _e( "List Info.", 'yikes-inc-easy-mailchimp-extender' ); ?></a></span> |
|
101 | 101 | </div> |
102 | 102 | </td> |
103 | - <td class="column-columnname num"><?php echo $list['stats']['member_count']; ?></td> |
|
103 | + <td class="column-columnname num"><?php echo $list[ 'stats' ][ 'member_count' ]; ?></td> |
|
104 | 104 | </tr> |
105 | 105 | <?php |
106 | 106 | $i++; |
107 | 107 | } |
108 | 108 | } else { ?> |
109 | 109 | <tr class="no-items"> |
110 | - <td class="colspanchange no-mailchimp-lists-found" colspan="3"><em><?php _e( 'No MailChimp lists found. Head over to' , 'yikes-inc-easy-mailchimp-extender' ); ?></em></td> |
|
110 | + <td class="colspanchange no-mailchimp-lists-found" colspan="3"><em><?php _e( 'No MailChimp lists found. Head over to', 'yikes-inc-easy-mailchimp-extender' ); ?></em></td> |
|
111 | 111 | </tr> |
112 | 112 | <?php } ?> |
113 | 113 | </tbody> |
@@ -8,7 +8,7 @@ discard block |
||
8 | 8 | $yikes_mc_api_constant = ( defined( 'YIKES_MC_API_KEY' ) ) ? true : false; |
9 | 9 | ?> |
10 | 10 | |
11 | -<h3><span><?php _e( 'General Settings' , 'yikes-inc-easy-mailchimp-extender' ); ?></span><?php echo $api_connection; ?></h3> |
|
11 | +<h3><span><?php _e( 'General Settings', 'yikes-inc-easy-mailchimp-extender' ); ?></span><?php echo $api_connection; ?></h3> |
|
12 | 12 | <div class="inside"> |
13 | 13 | |
14 | 14 | <!-- Settings Form --> |
@@ -21,11 +21,11 @@ discard block |
||
21 | 21 | <!-- MailChimp API Input Field --> |
22 | 22 | <label for="yks-mailchimp-api-key"> |
23 | 23 | |
24 | - <p><?php _e( 'Enter your API key in the field below to connect your site to your MailChimp account.' , 'yikes-inc-easy-mailchimp-extender' ); ?></p> |
|
24 | + <p><?php _e( 'Enter your API key in the field below to connect your site to your MailChimp account.', 'yikes-inc-easy-mailchimp-extender' ); ?></p> |
|
25 | 25 | |
26 | - <p><strong><?php _e( 'MailChimp API Key' , 'yikes-inc-easy-mailchimp-extender' ); ?></strong></p> |
|
26 | + <p><strong><?php _e( 'MailChimp API Key', 'yikes-inc-easy-mailchimp-extender' ); ?></strong></p> |
|
27 | 27 | |
28 | - <input autocomplete="off" <?php if ( $yikes_mc_api_constant ) { echo 'readonly="readonly"'; } if( strlen( yikes_get_mc_api_key() ) > 0 ) { ?> type="password" <?php } else { ?> type="text" <?php } ?> value="<?php echo yikes_get_mc_api_key(); ?>" placeholder="<?php _e( 'MailChimp API Key' , 'yikes-inc-easy-mailchimp-extender' ); ?>" name="yikes-mc-api-key" id="yikes-mc-api-key" class="settings-page-input" /> |
|
28 | + <input autocomplete="off" <?php if ( $yikes_mc_api_constant ) { echo 'readonly="readonly"'; } if ( strlen( yikes_get_mc_api_key() ) > 0 ) { ?> type="password" <?php } else { ?> type="text" <?php } ?> value="<?php echo yikes_get_mc_api_key(); ?>" placeholder="<?php _e( 'MailChimp API Key', 'yikes-inc-easy-mailchimp-extender' ); ?>" name="yikes-mc-api-key" id="yikes-mc-api-key" class="settings-page-input" /> |
|
29 | 29 | |
30 | 30 | <?php if ( $yikes_mc_api_constant ) { ?> |
31 | 31 | <p class="description"><?php printf( __( "Your MailChimp API key has been defined using the %s constant, in a PHP file.", "yikes-inc-easy-mailchimp-extender" ), '<code>YIKES_MC_API_KEY</code>' ); ?></p> |
@@ -34,7 +34,7 @@ discard block |
||
34 | 34 | <?php echo $api_error_response; ?> |
35 | 35 | |
36 | 36 | <?php if ( ! $yikes_mc_api_constant ) { ?> |
37 | - <p class="description"><small><a href="https://admin.mailchimp.com/account/api" target="_blank" title="<?php _e( 'Get your API key here' , 'yikes-inc-easy-mailchimp-extender' ); ?>"><?php _e( 'Get your API key here' , 'yikes-inc-easy-mailchimp-extender' ); ?></a></small></p> |
|
37 | + <p class="description"><small><a href="https://admin.mailchimp.com/account/api" target="_blank" title="<?php _e( 'Get your API key here', 'yikes-inc-easy-mailchimp-extender' ); ?>"><?php _e( 'Get your API key here', 'yikes-inc-easy-mailchimp-extender' ); ?></a></small></p> |
|
38 | 38 | <?php } ?> |
39 | 39 | </label> |
40 | 40 |
@@ -11,8 +11,8 @@ discard block |
||
11 | 11 | */ |
12 | 12 | |
13 | 13 | // enqueue jquery qtip for our tooltip |
14 | - wp_enqueue_script( 'jquery-qtip-tooltip', YIKES_MC_URL . 'admin/js/min/jquery.qtip.min.js' , array( 'jquery' ) ); |
|
15 | - wp_enqueue_style( 'jquery-qtip-style', YIKES_MC_URL . 'admin/css/jquery.qtip.min.css' ); |
|
14 | + wp_enqueue_script( 'jquery-qtip-tooltip', YIKES_MC_URL . 'admin/js/min/jquery.qtip.min.js', array( 'jquery' ) ); |
|
15 | + wp_enqueue_style( 'jquery-qtip-style', YIKES_MC_URL . 'admin/css/jquery.qtip.min.css' ); |
|
16 | 16 | |
17 | 17 | ?> |
18 | 18 | <script> |
@@ -43,50 +43,50 @@ discard block |
||
43 | 43 | ); |
44 | 44 | |
45 | 45 | $class_descriptions = array( |
46 | - 'comment_form' => '<img class="tooltip-integration-banner" src="' . YIKES_MC_URL . 'includes/images/Checkbox_Integration_Logos/wordpress-banner-logo.png" title="' . __( 'WordPress' , 'yikes-inc-easy-mailchimp-extender' ) . '">' . __( 'Enabling the WordPress core comment form opt-in checkbox will display a checkbox to your current users when leaving a comment (if they are not currently subscribed).' , 'yikes-inc-easy-mailchimp-extender' ), |
|
47 | - 'registration_form' => '<img class="tooltip-integration-banner" src="' . YIKES_MC_URL . 'includes/images/Checkbox_Integration_Logos/wordpress-banner-logo.png" title="' . __( 'WordPress' , 'yikes-inc-easy-mailchimp-extender' ) . '">' . __( 'Enabling the WordPress core registration form opt-in checkbox will display a checkbox to new users when registering for your site.' , 'yikes-inc-easy-mailchimp-extender' ), |
|
48 | - 'woocommerce_checkout_form' => '<img class="tooltip-integration-banner" src="' . YIKES_MC_URL . 'includes/images/Checkbox_Integration_Logos/woocommerce-banner.png" title="' . __( 'WooCommerce Store' , 'yikes-inc-easy-mailchimp-extender' ) . '">' . __( 'Enabling the WooCommerce checkout opt-in form allows you to capture email addresses from users who make purchases in your store. This option will add an opt-in checkbox to the checkout page.' , 'yikes-inc-easy-mailchimp-extender' ), |
|
49 | - 'easy_digital_downloads_checkout_form' => '<img class="tooltip-integration-banner" src="' . YIKES_MC_URL . 'includes/images/Checkbox_Integration_Logos/edd-banner.png" title="' . __( 'Easy Digital Downloads' , 'yikes-inc-easy-mailchimp-extender' ) . '">' . __( 'Enabling the Easy Digital Downloads checkout opt-in allows users who make a purchase to opt-in to your mailing list during checkout.' , 'yikes-inc-easy-mailchimp-extender' ), |
|
50 | - 'buddypress_form' => '<img class="tooltip-integration-banner" src="' . YIKES_MC_URL . 'includes/images/Checkbox_Integration_Logos/buddypress-banner.png" title="' . __( 'BuddyPress' , 'yikes-inc-easy-mailchimp-extender' ) . '">' . __( 'Enabling the BuddyPress opt-in allows users who register for your site to be automatically added to the mailing list of your choice.' , 'yikes-inc-easy-mailchimp-extender' ), |
|
51 | - 'bbpress_forms' => '<img class="tooltip-integration-banner" src="' . YIKES_MC_URL . 'includes/images/Checkbox_Integration_Logos/bbpress-banner.png" title="' . __( 'bbPress' , 'yikes-inc-easy-mailchimp-extender' ) . '">' . __( 'Enabling the bbPress opt-in enables users who register to use the forums on your site to be automatically added to the mailing list of your choice.' , 'yikes-inc-easy-mailchimp-extender' ), |
|
52 | - 'contact_form_7' => '<img class="tooltip-integration-banner" src="' . YIKES_MC_URL . 'includes/images/Checkbox_Integration_Logos/cf7-banner.png" title="' . __( 'Contact Form 7' , 'yikes-inc-easy-mailchimp-extender' ) . '">' . __( 'Once the Contact Form 7 integration is active you can use our custom shortcode [yikes_mailchimp_checkbox] in your contact forms to subscribe users to a pre-selected list.' , 'yikes-inc-easy-mailchimp-extender' ), |
|
46 | + 'comment_form' => '<img class="tooltip-integration-banner" src="' . YIKES_MC_URL . 'includes/images/Checkbox_Integration_Logos/wordpress-banner-logo.png" title="' . __( 'WordPress', 'yikes-inc-easy-mailchimp-extender' ) . '">' . __( 'Enabling the WordPress core comment form opt-in checkbox will display a checkbox to your current users when leaving a comment (if they are not currently subscribed).', 'yikes-inc-easy-mailchimp-extender' ), |
|
47 | + 'registration_form' => '<img class="tooltip-integration-banner" src="' . YIKES_MC_URL . 'includes/images/Checkbox_Integration_Logos/wordpress-banner-logo.png" title="' . __( 'WordPress', 'yikes-inc-easy-mailchimp-extender' ) . '">' . __( 'Enabling the WordPress core registration form opt-in checkbox will display a checkbox to new users when registering for your site.', 'yikes-inc-easy-mailchimp-extender' ), |
|
48 | + 'woocommerce_checkout_form' => '<img class="tooltip-integration-banner" src="' . YIKES_MC_URL . 'includes/images/Checkbox_Integration_Logos/woocommerce-banner.png" title="' . __( 'WooCommerce Store', 'yikes-inc-easy-mailchimp-extender' ) . '">' . __( 'Enabling the WooCommerce checkout opt-in form allows you to capture email addresses from users who make purchases in your store. This option will add an opt-in checkbox to the checkout page.', 'yikes-inc-easy-mailchimp-extender' ), |
|
49 | + 'easy_digital_downloads_checkout_form' => '<img class="tooltip-integration-banner" src="' . YIKES_MC_URL . 'includes/images/Checkbox_Integration_Logos/edd-banner.png" title="' . __( 'Easy Digital Downloads', 'yikes-inc-easy-mailchimp-extender' ) . '">' . __( 'Enabling the Easy Digital Downloads checkout opt-in allows users who make a purchase to opt-in to your mailing list during checkout.', 'yikes-inc-easy-mailchimp-extender' ), |
|
50 | + 'buddypress_form' => '<img class="tooltip-integration-banner" src="' . YIKES_MC_URL . 'includes/images/Checkbox_Integration_Logos/buddypress-banner.png" title="' . __( 'BuddyPress', 'yikes-inc-easy-mailchimp-extender' ) . '">' . __( 'Enabling the BuddyPress opt-in allows users who register for your site to be automatically added to the mailing list of your choice.', 'yikes-inc-easy-mailchimp-extender' ), |
|
51 | + 'bbpress_forms' => '<img class="tooltip-integration-banner" src="' . YIKES_MC_URL . 'includes/images/Checkbox_Integration_Logos/bbpress-banner.png" title="' . __( 'bbPress', 'yikes-inc-easy-mailchimp-extender' ) . '">' . __( 'Enabling the bbPress opt-in enables users who register to use the forums on your site to be automatically added to the mailing list of your choice.', 'yikes-inc-easy-mailchimp-extender' ), |
|
52 | + 'contact_form_7' => '<img class="tooltip-integration-banner" src="' . YIKES_MC_URL . 'includes/images/Checkbox_Integration_Logos/cf7-banner.png" title="' . __( 'Contact Form 7', 'yikes-inc-easy-mailchimp-extender' ) . '">' . __( 'Once the Contact Form 7 integration is active you can use our custom shortcode [yikes_mailchimp_checkbox] in your contact forms to subscribe users to a pre-selected list.', 'yikes-inc-easy-mailchimp-extender' ), |
|
53 | 53 | ); |
54 | 54 | |
55 | 55 | // Easy Digital Downloads |
56 | - if( class_exists( 'Easy_Digital_Downloads' ) ) { |
|
57 | - $active_plugins['easy_digital_downloads_checkout_form'] = __( 'Easy Digital Downloads Checkout', 'yikes-inc-easy-mailchimp-extender' ); |
|
56 | + if ( class_exists( 'Easy_Digital_Downloads' ) ) { |
|
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' ) ) { |
|
61 | - $active_plugins['woocommerce_checkout_form'] = __( 'WooCommerce Checkout', 'yikes-inc-easy-mailchimp-extender' ); |
|
60 | + if ( class_exists( 'WooCommerce' ) ) { |
|
61 | + $active_plugins[ 'woocommerce_checkout_form' ] = __( 'WooCommerce Checkout', 'yikes-inc-easy-mailchimp-extender' ); |
|
62 | 62 | } |
63 | 63 | // BuddyPress |
64 | - if( class_exists( 'BuddyPress' ) ) { |
|
65 | - $active_plugins['buddypress_form'] = __( 'BuddyPress Registration', 'yikes-inc-easy-mailchimp-extender' ); |
|
64 | + if ( class_exists( 'BuddyPress' ) ) { |
|
65 | + $active_plugins[ 'buddypress_form' ] = __( 'BuddyPress Registration', 'yikes-inc-easy-mailchimp-extender' ); |
|
66 | 66 | } |
67 | 67 | // bbPress |
68 | - if( class_exists( 'bbPress' ) ) { |
|
69 | - $active_plugins['bbpress_forms'] = __( 'bbPress', 'yikes-inc-easy-mailchimp-extender' ); |
|
68 | + if ( class_exists( 'bbPress' ) ) { |
|
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' ) ) { |
|
73 | - $active_plugins['contact_form_7'] = __( 'Contact Form 7', 'yikes-inc-easy-mailchimp-extender' ); |
|
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' ); |
|
74 | 74 | } |
75 | 75 | |
76 | 76 | // store our checkbox options |
77 | - $options = get_option( 'optin-checkbox-init' , '' ); |
|
77 | + $options = get_option( 'optin-checkbox-init', '' ); |
|
78 | 78 | ?> |
79 | -<h3><span><?php _e( 'Integration Settings' , 'yikes-inc-easy-mailchimp-extender' ); ?></span></h3> |
|
79 | +<h3><span><?php _e( 'Integration Settings', 'yikes-inc-easy-mailchimp-extender' ); ?></span></h3> |
|
80 | 80 | |
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 | /// Check for a transient, if not - set one up for one hour |
86 | 86 | if ( false === ( $list_data = get_transient( 'yikes-easy-mailchimp-list-data' ) ) ) { |
87 | 87 | $api_key = yikes_get_mc_api_key(); |
88 | 88 | $dash_position = strpos( $api_key, '-' ); |
89 | - if( $dash_position !== false ) { |
|
89 | + if ( $dash_position !== false ) { |
|
90 | 90 | $api_endpoint = 'https://' . substr( $api_key, $dash_position + 1 ) . '.api.mailchimp.com/2.0/lists/list.json'; |
91 | 91 | } |
92 | 92 | $list_data = wp_remote_post( $api_endpoint, array( |
@@ -98,11 +98,11 @@ discard block |
||
98 | 98 | 'sslverify' => apply_filters( 'yikes-mailchimp-sslverify', true ) |
99 | 99 | ) ); |
100 | 100 | $list_data = json_decode( wp_remote_retrieve_body( $list_data ), true ); |
101 | - if( isset( $list_data['error'] ) ) { |
|
102 | - if( WP_DEBUG || get_option( 'yikes-mailchimp-debug-status' , '' ) == '1' ) { |
|
101 | + if ( isset( $list_data[ 'error' ] ) ) { |
|
102 | + if ( WP_DEBUG || get_option( 'yikes-mailchimp-debug-status', '' ) == '1' ) { |
|
103 | 103 | require_once YIKES_MC_PATH . 'includes/error_log/class-yikes-inc-easy-mailchimp-error-logging.php'; |
104 | 104 | $error_logging = new Yikes_Inc_Easy_Mailchimp_Error_Logging(); |
105 | - $error_logging->yikes_easy_mailchimp_write_to_error_log( $list_data['error'], __( "Get Account Lists" , 'yikes-inc-easy-mailchimp-extender' ), "Integration Settings Page" ); |
|
105 | + $error_logging->yikes_easy_mailchimp_write_to_error_log( $list_data[ 'error' ], __( "Get Account Lists", 'yikes-inc-easy-mailchimp-extender' ), "Integration Settings Page" ); |
|
106 | 106 | } |
107 | 107 | } else { |
108 | 108 | // set our transient |
@@ -113,7 +113,7 @@ discard block |
||
113 | 113 | ?> |
114 | 114 | <div class="inside"> |
115 | 115 | <?php |
116 | - echo sprintf( __( 'Please %s to setup your integrations.', 'yikes-inc-easy-mailchimp-extender' ), '<a href="' . esc_url_raw( admin_url( 'admin.php?page=yikes-inc-easy-mailchimp-settings§ion=general-settings' ) ) . '" title="' . __( 'General Settings' , 'yikes-inc-easy-mailchimp-extender' ) . '">' . __( 'enter a valid MailChimp API key' , 'yikes-inc-easy-mailchimp-extender' ) . '</a>' ); |
|
116 | + echo sprintf( __( 'Please %s to setup your integrations.', 'yikes-inc-easy-mailchimp-extender' ), '<a href="' . esc_url_raw( admin_url( 'admin.php?page=yikes-inc-easy-mailchimp-settings§ion=general-settings' ) ) . '" title="' . __( 'General Settings', 'yikes-inc-easy-mailchimp-extender' ) . '">' . __( 'enter a valid MailChimp API key', 'yikes-inc-easy-mailchimp-extender' ) . '</a>' ); |
|
117 | 117 | ?> |
118 | 118 | </div> |
119 | 119 | <?php |
@@ -124,7 +124,7 @@ discard block |
||
124 | 124 | <div class="inside"> |
125 | 125 | |
126 | 126 | <p> |
127 | - <?php _e( 'Select which plugins or features Easy Forms for MailChimp by Yikes Inc. should integrate with. Depending on which plugins or features you choose to integrate with, an opt-in checkbox will be generated. For example, the comment form checkbox will generate a checkbox below the standard WordPress comment form to add any new commenters to a pre-determined MailChimp mailing list.' , 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
127 | + <?php _e( 'Select which plugins or features Easy Forms for MailChimp by Yikes Inc. should integrate with. Depending on which plugins or features you choose to integrate with, an opt-in checkbox will be generated. For example, the comment form checkbox will generate a checkbox below the standard WordPress comment form to add any new commenters to a pre-determined MailChimp mailing list.', 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
128 | 128 | </p> |
129 | 129 | |
130 | 130 | <!-- Settings Form --> |
@@ -134,54 +134,54 @@ discard block |
||
134 | 134 | |
135 | 135 | <ul> |
136 | 136 | <?php |
137 | - if( !empty( $active_plugins ) ) { |
|
137 | + if ( ! empty( $active_plugins ) ) { |
|
138 | 138 | |
139 | - foreach( $active_plugins as $class => $value ) { |
|
139 | + foreach ( $active_plugins as $class => $value ) { |
|
140 | 140 | // echo $class; |
141 | - $checked = isset( $options[$class]['value'] ) ? 'checked="checked"' : ''; |
|
142 | - $hidden = !isset( $options[$class]['value'] ) ? 'yikes-easy-mc-hidden' : ''; |
|
143 | - $checkbox_label = isset( $options[$class]['label'] ) ? esc_attr__( $options[$class]['label'] ) : ''; |
|
144 | - $precheck_checkbox = isset( $options[$class]['precheck'] ) ? $options[$class]['precheck'] : ''; |
|
145 | - $selected_list = isset( $options[$class]['associated-list'] ) ? $options[$class]['associated-list'] : '-'; |
|
146 | - $list_interest_groups = isset( $options[$class]['interest-groups'] ) ? $options[$class]['interest-groups'] : false; |
|
141 | + $checked = isset( $options[ $class ][ 'value' ] ) ? 'checked="checked"' : ''; |
|
142 | + $hidden = ! isset( $options[ $class ][ 'value' ] ) ? 'yikes-easy-mc-hidden' : ''; |
|
143 | + $checkbox_label = isset( $options[ $class ][ 'label' ] ) ? esc_attr__( $options[ $class ][ 'label' ] ) : ''; |
|
144 | + $precheck_checkbox = isset( $options[ $class ][ 'precheck' ] ) ? $options[ $class ][ 'precheck' ] : ''; |
|
145 | + $selected_list = isset( $options[ $class ][ 'associated-list' ] ) ? $options[ $class ][ 'associated-list' ] : '-'; |
|
146 | + $list_interest_groups = isset( $options[ $class ][ 'interest-groups' ] ) ? $options[ $class ][ 'interest-groups' ] : false; |
|
147 | 147 | ?> |
148 | 148 | <li> |
149 | 149 | <label> |
150 | - <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> |
|
150 | + <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> |
|
151 | 151 | </label> |
152 | 152 | </li> |
153 | 153 | <!-- checkbox settings, text - associated list etc. --> |
154 | 154 | <li class="optin-checkbox-init[<?php echo $class; ?>]-settings <?php echo $hidden; ?>"> |
155 | - <?php if( $class == 'contact_form_7' ) { ?> |
|
155 | + <?php if ( $class == 'contact_form_7' ) { ?> |
|
156 | 156 | <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> |
157 | 157 | <?php } ?> |
158 | 158 | <p style="margin-top:0;padding-top:0;margin-bottom:0;padding-bottom:0;"> |
159 | 159 | <!-- checkbox associated list --> |
160 | - <label><?php _e( 'Associated List' , 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
160 | + <label><?php _e( 'Associated List', 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
161 | 161 | <?php |
162 | - if( $list_data['total'] > 0 ) { |
|
162 | + if ( $list_data[ 'total' ] > 0 ) { |
|
163 | 163 | ?> |
164 | 164 | <select class="optin-checkbox-init[<?php echo $class; ?>][associated-list] checkbox-settings-list-dropdown" data-attr-integration="<?php echo $class; ?>" name="optin-checkbox-init[<?php echo $class; ?>][associated-list]" onchange="checkForInterestGroups( jQuery( this ), jQuery( this ).find( 'option:selected' ).val(), jQuery( this ).attr( 'data-attr-integration' ) );return false;"> |
165 | - <option value="-" <?php selected( $selected_list , '-' ); ?>><?php _e( 'Select a List' , 'yikes-inc-easy-mailchimp-extender' ); ?></option> |
|
166 | - <?php foreach( $list_data['data'] as $list ) { ?> |
|
167 | - <option value="<?php echo $list['id']; ?>" <?php selected( $selected_list , $list['id'] ); ?>><?php echo $list['name']; ?></option> |
|
165 | + <option value="-" <?php selected( $selected_list, '-' ); ?>><?php _e( 'Select a List', 'yikes-inc-easy-mailchimp-extender' ); ?></option> |
|
166 | + <?php foreach ( $list_data[ 'data' ] as $list ) { ?> |
|
167 | + <option value="<?php echo $list[ 'id' ]; ?>" <?php selected( $selected_list, $list[ 'id' ] ); ?>><?php echo $list[ 'name' ]; ?></option> |
|
168 | 168 | <?php } ?> |
169 | 169 | </select> |
170 | 170 | <?php |
171 | 171 | } else { |
172 | - echo '<p class="description no-lists-setup-notice"><strong>' . __( 'You have not setup any lists. You should head over to MailChimp and setup your first list.' , 'yikes-inc-easy-mailchimp-extender' ) . '</strong></p>'; |
|
172 | + echo '<p class="description no-lists-setup-notice"><strong>' . __( 'You have not setup any lists. You should head over to MailChimp and setup your first list.', 'yikes-inc-easy-mailchimp-extender' ) . '</strong></p>'; |
|
173 | 173 | } |
174 | 174 | ?> |
175 | 175 | </label> |
176 | 176 | <!-- checkbox text label --> |
177 | - <label><?php _e( 'Checkbox Label' , 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
177 | + <label><?php _e( 'Checkbox Label', 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
178 | 178 | <input type="text" class="optin-checkbox-init[<?php echo $class; ?>][label] optin-checkbox-label-input" name="optin-checkbox-init[<?php echo $class; ?>][label]" value="<?php echo $checkbox_label; ?>"> |
179 | 179 | </label> |
180 | 180 | <!-- prechecked? --> |
181 | - <label><?php _e( 'Precheck Checkbox' , 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
181 | + <label><?php _e( 'Precheck Checkbox', 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
182 | 182 | <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"> |
183 | - <option value="true" <?php selected( $precheck_checkbox , 'true' ); ?>><?php _e( 'Yes' , 'yikes-inc-easy-mailchimp-extender' ); ?></option> |
|
184 | - <option value="false" <?php selected( $precheck_checkbox , 'false' ); ?>><?php _e( 'No' , 'yikes-inc-easy-mailchimp-extender' ); ?></option> |
|
183 | + <option value="true" <?php selected( $precheck_checkbox, 'true' ); ?>><?php _e( 'Yes', 'yikes-inc-easy-mailchimp-extender' ); ?></option> |
|
184 | + <option value="false" <?php selected( $precheck_checkbox, 'false' ); ?>><?php _e( 'No', 'yikes-inc-easy-mailchimp-extender' ); ?></option> |
|
185 | 185 | </select> |
186 | 186 | </label> |
187 | 187 | |
@@ -192,8 +192,8 @@ discard block |
||
192 | 192 | $interest_groupings = get_transient( $selected_list . '_interest_group' ); |
193 | 193 | $integration_type = $class; |
194 | 194 | require( YIKES_MC_PATH . 'admin/partials/menu/options-sections/templates/integration-interest-groups.php' ); |
195 | - } else if( $selected_list != '-' && $list_interest_groups ) { |
|
196 | - $list_id = $options[$class]['associated-list']; |
|
195 | + } else if ( $selected_list != '-' && $list_interest_groups ) { |
|
196 | + $list_id = $options[ $class ][ 'associated-list' ]; |
|
197 | 197 | $integration_type = $class; |
198 | 198 | YIKES_Inc_Easy_MailChimp_Process_Ajax::check_list_for_interest_groups( $list_id, $integration_type, true ); |
199 | 199 | } |
@@ -208,7 +208,7 @@ discard block |
||
208 | 208 | } else { |
209 | 209 | ?> |
210 | 210 | <li> |
211 | - <?php _e( 'Nothing is active.' , 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
211 | + <?php _e( 'Nothing is active.', 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
212 | 212 | </li> |
213 | 213 | <?php |
214 | 214 | } |
@@ -10,12 +10,12 @@ discard block |
||
10 | 10 | $form_results = $wpdb->get_results( 'SELECT * FROM ' . $wpdb->prefix . 'yikes_easy_mc_forms', ARRAY_A ); |
11 | 11 | |
12 | 12 | /* Store Data if User is Authorized */ |
13 | - if( $this->is_user_mc_api_valid_form( false ) == 'valid' ) { |
|
13 | + if ( $this->is_user_mc_api_valid_form( false ) == 'valid' ) { |
|
14 | 14 | /// Check for a transient, if not - set one up for one hour |
15 | 15 | if ( false === ( $list_data = get_transient( 'yikes-easy-mailchimp-list-data' ) ) ) { |
16 | 16 | $api_key = yikes_get_mc_api_key(); |
17 | 17 | $dash_position = strpos( $api_key, '-' ); |
18 | - if( $dash_position !== false ) { |
|
18 | + if ( $dash_position !== false ) { |
|
19 | 19 | $api_endpoint = 'https://' . substr( $api_key, $dash_position + 1 ) . '.api.mailchimp.com/2.0/lists/list.json'; |
20 | 20 | } |
21 | 21 | $list_data = wp_remote_post( $api_endpoint, array( |
@@ -27,11 +27,11 @@ discard block |
||
27 | 27 | 'sslverify' => apply_filters( 'yikes-mailchimp-sslverify', true ) |
28 | 28 | ) ); |
29 | 29 | $list_data = json_decode( wp_remote_retrieve_body( $list_data ), true ); |
30 | - if( isset( $list_data['error'] ) ) { |
|
31 | - if( WP_DEBUG || get_option( 'yikes-mailchimp-debug-status' , '' ) == '1' ) { |
|
30 | + if ( isset( $list_data[ 'error' ] ) ) { |
|
31 | + if ( WP_DEBUG || get_option( 'yikes-mailchimp-debug-status', '' ) == '1' ) { |
|
32 | 32 | require_once YIKES_MC_PATH . 'includes/error_log/class-yikes-inc-easy-mailchimp-error-logging.php'; |
33 | 33 | $error_logging = new Yikes_Inc_Easy_Mailchimp_Error_Logging(); |
34 | - $error_logging->yikes_easy_mailchimp_write_to_error_log( $list_data['error'], __( "Get Account Lists" , 'yikes-inc-easy-mailchimp-extender' ), "Manage Forms Page" ); |
|
34 | + $error_logging->yikes_easy_mailchimp_write_to_error_log( $list_data[ 'error' ], __( "Get Account Lists", 'yikes-inc-easy-mailchimp-extender' ), "Manage Forms Page" ); |
|
35 | 35 | } |
36 | 36 | } else { |
37 | 37 | // set our transient |
@@ -44,28 +44,28 @@ discard block |
||
44 | 44 | ?> |
45 | 45 | <div class="wrap"> |
46 | 46 | <!-- Freddie Logo --> |
47 | - <img src="<?php echo YIKES_MC_URL . 'includes/images/MailChimp_Assets/Freddie_60px.png'; ?>" alt="<?php _e( 'Freddie - MailChimp Mascot' , 'yikes-inc-easy-mailchimp-extender' ); ?>" class="yikes-mc-freddie-logo" /> |
|
47 | + <img src="<?php echo YIKES_MC_URL . 'includes/images/MailChimp_Assets/Freddie_60px.png'; ?>" alt="<?php _e( 'Freddie - MailChimp Mascot', 'yikes-inc-easy-mailchimp-extender' ); ?>" class="yikes-mc-freddie-logo" /> |
|
48 | 48 | |
49 | - <h1>YIKES Easy Forms for MailChimp | <?php _e( 'Manage Forms' , 'yikes-inc-easy-mailchimp-extender' ) ?></h1> |
|
49 | + <h1>YIKES Easy Forms for MailChimp | <?php _e( 'Manage Forms', 'yikes-inc-easy-mailchimp-extender' ) ?></h1> |
|
50 | 50 | |
51 | 51 | <!-- Settings Page Description --> |
52 | - <p class="yikes-easy-mc-about-text about-text"><?php _e( 'Create and manage your MailChimp opt-in forms on the following page. Select a form to make edits to it.' , 'yikes-inc-easy-mailchimp-extender' ); ?></p> |
|
52 | + <p class="yikes-easy-mc-about-text about-text"><?php _e( 'Create and manage your MailChimp opt-in forms on the following page. Select a form to make edits to it.', 'yikes-inc-easy-mailchimp-extender' ); ?></p> |
|
53 | 53 | |
54 | 54 | <!-- Action Notices --> |
55 | 55 | <?php |
56 | 56 | // Confirm that the necessary forms table in the database exists |
57 | - if( $wpdb->get_var("show tables like '" . $wpdb->prefix . "yikes_easy_mc_forms'") != $wpdb->prefix . "yikes_easy_mc_forms" ) { |
|
58 | - wp_die( '<div class="error"><p>' . __( 'It looks like the forms table is missing. Please de-activate and re-activate the plugin to attempt to create the table. If the error persists, please get in touch with the YIKES Inc. support team.', 'yikes-inc-easy-mailchimp-extender' ) . '</p></div>' , 500 ); |
|
57 | + if ( $wpdb->get_var( "show tables like '" . $wpdb->prefix . "yikes_easy_mc_forms'" ) != $wpdb->prefix . "yikes_easy_mc_forms" ) { |
|
58 | + wp_die( '<div class="error"><p>' . __( 'It looks like the forms table is missing. Please de-activate and re-activate the plugin to attempt to create the table. If the error persists, please get in touch with the YIKES Inc. support team.', 'yikes-inc-easy-mailchimp-extender' ) . '</p></div>', 500 ); |
|
59 | 59 | } |
60 | 60 | |
61 | 61 | /* If the user hasn't authenticated yet, lets kill off */ |
62 | - if( get_option( 'yikes-mc-api-validation' , 'invalid_api_key' ) != 'valid_api_key' ) { |
|
63 | - wp_die( '<div class="error"><p>' . sprintf( __( 'You need to connect to MailChimp before you can start creating forms. Head over to the <a href="%s" title="Settings Page">Settings Page</a> and enter your API key.' , 'yikes-inc-easy-mailchimp-extender' ), esc_url_raw( admin_url( 'admin.php?page=yikes-inc-easy-mailchimp-settings' ) ) ) . '</p></div>' , 500 ); |
|
62 | + if ( get_option( 'yikes-mc-api-validation', 'invalid_api_key' ) != 'valid_api_key' ) { |
|
63 | + wp_die( '<div class="error"><p>' . sprintf( __( 'You need to connect to MailChimp before you can start creating forms. Head over to the <a href="%s" title="Settings Page">Settings Page</a> and enter your API key.', 'yikes-inc-easy-mailchimp-extender' ), esc_url_raw( admin_url( 'admin.php?page=yikes-inc-easy-mailchimp-settings' ) ) ) . '</p></div>', 500 ); |
|
64 | 64 | } |
65 | 65 | |
66 | 66 | /* Display our admin notices here */ |
67 | 67 | // delete form success |
68 | - if( isset( $_REQUEST['deleted-form'] ) && $_REQUEST['deleted-form'] == 'true' ) { |
|
68 | + if ( isset( $_REQUEST[ 'deleted-form' ] ) && $_REQUEST[ 'deleted-form' ] == 'true' ) { |
|
69 | 69 | ?> |
70 | 70 | <div class="updated manage-form-admin-notice"> |
71 | 71 | <p><?php _e( 'Opt-in form successfully deleted.', 'yikes-inc-easy-mailchimp-extender' ); ?></p> |
@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | <?php |
74 | 74 | } |
75 | 75 | // duplicate form success |
76 | - if( isset( $_REQUEST['duplicated-form'] ) && $_REQUEST['duplicated-form'] == 'true' ) { |
|
76 | + if ( isset( $_REQUEST[ 'duplicated-form' ] ) && $_REQUEST[ 'duplicated-form' ] == 'true' ) { |
|
77 | 77 | ?> |
78 | 78 | <div class="updated manage-form-admin-notice"> |
79 | 79 | <p><?php _e( 'MailChimp Form successfully cloned.', 'yikes-inc-easy-mailchimp-extender' ); ?></p> |
@@ -81,7 +81,7 @@ discard block |
||
81 | 81 | <?php |
82 | 82 | } |
83 | 83 | // duplicate form error |
84 | - if( isset( $_REQUEST['duplicated-form'] ) && $_REQUEST['duplicated-form'] == 'false' ) { |
|
84 | + if ( isset( $_REQUEST[ 'duplicated-form' ] ) && $_REQUEST[ 'duplicated-form' ] == 'false' ) { |
|
85 | 85 | ?> |
86 | 86 | <div class="error manage-form-admin-notice"> |
87 | 87 | <p><?php _e( 'There was an error trying to clone your form. Please try again. If this error persists, please contact the YIKES Inc. support team.', 'yikes-inc-easy-mailchimp-extender' ); ?></p> |
@@ -89,7 +89,7 @@ discard block |
||
89 | 89 | <?php |
90 | 90 | } |
91 | 91 | // reset form submission stats success |
92 | - if( isset( $_REQUEST['reset-stats'] ) && $_REQUEST['reset-stats'] == 'true' ) { |
|
92 | + if ( isset( $_REQUEST[ 'reset-stats' ] ) && $_REQUEST[ 'reset-stats' ] == 'true' ) { |
|
93 | 93 | ?> |
94 | 94 | <div class="updated manage-form-admin-notice"> |
95 | 95 | <p><?php _e( 'Form submission stats/rates successfully reset.', 'yikes-inc-easy-mailchimp-extender' ); ?></p> |
@@ -97,7 +97,7 @@ discard block |
||
97 | 97 | <?php |
98 | 98 | } |
99 | 99 | // reset form submission stats error |
100 | - if( isset( $_REQUEST['reset-stats'] ) && $_REQUEST['reset-stats'] == 'false' ) { |
|
100 | + if ( isset( $_REQUEST[ 'reset-stats' ] ) && $_REQUEST[ 'reset-stats' ] == 'false' ) { |
|
101 | 101 | ?> |
102 | 102 | <div class="error manage-form-admin-notice"> |
103 | 103 | <p><?php _e( 'There was an error trying to reset the form submission stats/rates. Please try again. If this error persists, please contact the YIKES Inc. support team.', 'yikes-inc-easy-mailchimp-extender' ); ?></p> |
@@ -124,13 +124,13 @@ discard block |
||
124 | 124 | <thead> |
125 | 125 | <tr> |
126 | 126 | <th id="cb" class="manage-column column-cb check-column num" scope="col"><input type="checkbox" /></th> |
127 | - <th id="columnname" class="manage-column column-columnname num yikes-form-id-number" scope="col"><?php _e( 'ID' , 'yikes-inc-easy-mailchimp-extender' ); ?></th> |
|
128 | - <th id="columnname" class="manage-column column-columnname" scope="col"><?php _e( 'Form Name' , 'yikes-inc-easy-mailchimp-extender' ); ?></th> |
|
129 | - <th id="columnname" class="manage-column column-columnname" scope="col"><?php _e( 'Form Description' , 'yikes-inc-easy-mailchimp-extender' ); ?></th> |
|
130 | - <th id="columnname" class="manage-column column-columnname" scope="col"><?php _e( 'List' , 'yikes-inc-easy-mailchimp-extender' ); ?></th> |
|
131 | - <th id="columnname" class="manage-column column-columnname num" scope="col"><?php _e( 'Impressions' , 'yikes-inc-easy-mailchimp-extender' ); ?></th> |
|
132 | - <th id="columnname" class="manage-column column-columnname num" scope="col" ><?php _e( 'Submissions' , 'yikes-inc-easy-mailchimp-extender' ); ?></th> |
|
133 | - <th id="columnname" class="manage-column column-columnname num" scope="col"><?php _e( 'Conversion Rate' , 'yikes-inc-easy-mailchimp-extender' ); ?></th> |
|
127 | + <th id="columnname" class="manage-column column-columnname num yikes-form-id-number" scope="col"><?php _e( 'ID', 'yikes-inc-easy-mailchimp-extender' ); ?></th> |
|
128 | + <th id="columnname" class="manage-column column-columnname" scope="col"><?php _e( 'Form Name', 'yikes-inc-easy-mailchimp-extender' ); ?></th> |
|
129 | + <th id="columnname" class="manage-column column-columnname" scope="col"><?php _e( 'Form Description', 'yikes-inc-easy-mailchimp-extender' ); ?></th> |
|
130 | + <th id="columnname" class="manage-column column-columnname" scope="col"><?php _e( 'List', 'yikes-inc-easy-mailchimp-extender' ); ?></th> |
|
131 | + <th id="columnname" class="manage-column column-columnname num" scope="col"><?php _e( 'Impressions', 'yikes-inc-easy-mailchimp-extender' ); ?></th> |
|
132 | + <th id="columnname" class="manage-column column-columnname num" scope="col" ><?php _e( 'Submissions', 'yikes-inc-easy-mailchimp-extender' ); ?></th> |
|
133 | + <th id="columnname" class="manage-column column-columnname num" scope="col"><?php _e( 'Conversion Rate', 'yikes-inc-easy-mailchimp-extender' ); ?></th> |
|
134 | 134 | </tr> |
135 | 135 | </thead> |
136 | 136 | <!-- end header --> |
@@ -139,72 +139,72 @@ discard block |
||
139 | 139 | <tfoot> |
140 | 140 | <tr> |
141 | 141 | <th class="manage-column column-cb check-column num" scope="col"><input type="checkbox" /></th> |
142 | - <th id="columnname" class="manage-column column-columnname num yikes-form-id-number" scope="col"><?php _e( 'ID' , 'yikes-inc-easy-mailchimp-extender' ); ?></th> |
|
143 | - <th id="columnname" class="manage-column column-columnname" scope="col"><?php _e( 'Form Name' , 'yikes-inc-easy-mailchimp-extender' ); ?></th> |
|
144 | - <th id="columnname" class="manage-column column-columnname" scope="col"><?php _e( 'Form Description' , 'yikes-inc-easy-mailchimp-extender' ); ?></th> |
|
145 | - <th class="manage-column column-columnname" scope="col"><?php _e( 'List' , 'yikes-inc-easy-mailchimp-extender' ); ?></th> |
|
146 | - <th id="columnname" class="manage-column column-columnname num" scope="col"><?php _e( 'Impressions' , 'yikes-inc-easy-mailchimp-extender' ); ?></th> |
|
147 | - <th id="columnname" class="manage-column column-columnname num" scope="col"><?php _e( 'Submissions' , 'yikes-inc-easy-mailchimp-extender' ); ?></th> |
|
148 | - <th id="columnname" class="manage-column column-columnname num" scope="col"><?php _e( 'Conversion Rate' , 'yikes-inc-easy-mailchimp-extender' ); ?></th> |
|
142 | + <th id="columnname" class="manage-column column-columnname num yikes-form-id-number" scope="col"><?php _e( 'ID', 'yikes-inc-easy-mailchimp-extender' ); ?></th> |
|
143 | + <th id="columnname" class="manage-column column-columnname" scope="col"><?php _e( 'Form Name', 'yikes-inc-easy-mailchimp-extender' ); ?></th> |
|
144 | + <th id="columnname" class="manage-column column-columnname" scope="col"><?php _e( 'Form Description', 'yikes-inc-easy-mailchimp-extender' ); ?></th> |
|
145 | + <th class="manage-column column-columnname" scope="col"><?php _e( 'List', 'yikes-inc-easy-mailchimp-extender' ); ?></th> |
|
146 | + <th id="columnname" class="manage-column column-columnname num" scope="col"><?php _e( 'Impressions', 'yikes-inc-easy-mailchimp-extender' ); ?></th> |
|
147 | + <th id="columnname" class="manage-column column-columnname num" scope="col"><?php _e( 'Submissions', 'yikes-inc-easy-mailchimp-extender' ); ?></th> |
|
148 | + <th id="columnname" class="manage-column column-columnname num" scope="col"><?php _e( 'Conversion Rate', 'yikes-inc-easy-mailchimp-extender' ); ?></th> |
|
149 | 149 | </tr> |
150 | 150 | </tfoot> |
151 | 151 | <!-- end footer --> |
152 | 152 | |
153 | 153 | <!-- TABLE BODY --> |
154 | 154 | <tbody> |
155 | - <?php if( count( $form_results ) > 0 ) { |
|
155 | + <?php if ( count( $form_results ) > 0 ) { |
|
156 | 156 | $i = 1; |
157 | - foreach( $form_results as $form ) { |
|
157 | + foreach ( $form_results as $form ) { |
|
158 | 158 | ?> |
159 | - <tr class="<?php if( $i % 2 == 0 ) { echo 'alternate'; } ?>"> |
|
159 | + <tr class="<?php if ( $i % 2 == 0 ) { echo 'alternate'; } ?>"> |
|
160 | 160 | <th class="check-column num" scope="row"><input type="checkbox" /></th> |
161 | - <td class="column-columnname num"><span class="form-id-container"><?php echo intval( $form['id'] ); ?></span></td> |
|
161 | + <td class="column-columnname num"><span class="form-id-container"><?php echo intval( $form[ 'id' ] ); ?></span></td> |
|
162 | 162 | <td class="column-columnname"> |
163 | 163 | <!-- row title/link --> |
164 | - <a href="<?php echo esc_url_raw( add_query_arg( array( 'id' => $form['id'] ) , admin_url( 'admin.php?page=yikes-mailchimp-edit-form' ) ) ); ?>" class="row-title"> |
|
165 | - <?php echo stripslashes( $form['form_name'] ); ?> |
|
164 | + <a href="<?php echo esc_url_raw( add_query_arg( array( 'id' => $form[ 'id' ] ), admin_url( 'admin.php?page=yikes-mailchimp-edit-form' ) ) ); ?>" class="row-title"> |
|
165 | + <?php echo stripslashes( $form[ 'form_name' ] ); ?> |
|
166 | 166 | </a> |
167 | 167 | <div class="row-actions"> |
168 | - <span><a href="<?php echo esc_url_raw( add_query_arg( array( 'id' => $form['id'] ) , admin_url( 'admin.php?page=yikes-mailchimp-edit-form' ) ) ); ?>"><?php _e( "Edit" , 'yikes-inc-easy-mailchimp-extender' ); ?></a> |</span> |
|
169 | - <span><a href="<?php echo esc_url_raw( add_query_arg( array( 'action' => 'yikes-easy-mc-duplicate-form', 'mailchimp-form' => $form['id'] , 'nonce' => wp_create_nonce( 'duplicate-mailchimp-form-'.$form['id'] ) ) , admin_url( 'admin.php?page=yikes-inc-easy-mailchimp' ) ) ); ?>"><?php _e( "Duplicate" , 'yikes-inc-easy-mailchimp-extender' ); ?></a> |</span> |
|
170 | - <span><a href="<?php echo esc_url_raw( add_query_arg( array( 'action' => 'yikes-easy-mc-reset-stats', 'mailchimp-form' => $form['id'] , 'nonce' => wp_create_nonce( 'reset-stats-mailchimp-form-'.$form['id'] ) ) , admin_url( 'admin.php?page=yikes-inc-easy-mailchimp' ) ) ); ?>"><?php _e( "Reset Stats" , 'yikes-inc-easy-mailchimp-extender' ); ?></a> |</span> |
|
171 | - <span><a href="#" class="view-yikes-mc-form-shortcode" data-alt-text="<?php _e( 'Stats' , 'yikes-inc-easy-mailchimp-extender' ); ?>"><?php _e( "Shortcode" , 'yikes-inc-easy-mailchimp-extender' ); ?></a> |</span> |
|
168 | + <span><a href="<?php echo esc_url_raw( add_query_arg( array( 'id' => $form[ 'id' ] ), admin_url( 'admin.php?page=yikes-mailchimp-edit-form' ) ) ); ?>"><?php _e( "Edit", 'yikes-inc-easy-mailchimp-extender' ); ?></a> |</span> |
|
169 | + <span><a href="<?php echo esc_url_raw( add_query_arg( array( 'action' => 'yikes-easy-mc-duplicate-form', 'mailchimp-form' => $form[ 'id' ], 'nonce' => wp_create_nonce( 'duplicate-mailchimp-form-' . $form[ 'id' ] ) ), admin_url( 'admin.php?page=yikes-inc-easy-mailchimp' ) ) ); ?>"><?php _e( "Duplicate", 'yikes-inc-easy-mailchimp-extender' ); ?></a> |</span> |
|
170 | + <span><a href="<?php echo esc_url_raw( add_query_arg( array( 'action' => 'yikes-easy-mc-reset-stats', 'mailchimp-form' => $form[ 'id' ], 'nonce' => wp_create_nonce( 'reset-stats-mailchimp-form-' . $form[ 'id' ] ) ), admin_url( 'admin.php?page=yikes-inc-easy-mailchimp' ) ) ); ?>"><?php _e( "Reset Stats", 'yikes-inc-easy-mailchimp-extender' ); ?></a> |</span> |
|
171 | + <span><a href="#" class="view-yikes-mc-form-shortcode" data-alt-text="<?php _e( 'Stats', 'yikes-inc-easy-mailchimp-extender' ); ?>"><?php _e( "Shortcode", 'yikes-inc-easy-mailchimp-extender' ); ?></a> |</span> |
|
172 | 172 | <?php |
173 | 173 | /* |
174 | 174 | * Custom action to allow users to add additional action links |
175 | 175 | * to each form. We use this in our add-ons. |
176 | 176 | * - Delete should remain last |
177 | 177 | */ |
178 | - do_action( 'yikes-mailchimp-custom-form-actions' , $form['id'] ); |
|
178 | + do_action( 'yikes-mailchimp-custom-form-actions', $form[ 'id' ] ); |
|
179 | 179 | ?> |
180 | - <span><a href="<?php echo esc_url_raw( add_query_arg( array( 'action' => 'yikes-easy-mc-delete-form', 'mailchimp-form' => $form['id'] , 'nonce' => wp_create_nonce( 'delete-mailchimp-form-'.$form['id'] ) ) , admin_url( 'admin.php?page=yikes-inc-easy-mailchimp' ) ) ); ?>" class="yikes-delete-mailchimp-form" onclick="return confirm('<?php printf( __( 'Are you sure you want to delete the %s form? This cannot be undone.' , 'yikes-inc-easy-mailchimp-extender' ), stripslashes( $form['form_name'] ) ); ?>');"><?php _e( "Delete" , 'yikes-inc-easy-mailchimp-extender' ); ?></a></span> |
|
180 | + <span><a href="<?php echo esc_url_raw( add_query_arg( array( 'action' => 'yikes-easy-mc-delete-form', 'mailchimp-form' => $form[ 'id' ], 'nonce' => wp_create_nonce( 'delete-mailchimp-form-' . $form[ 'id' ] ) ), admin_url( 'admin.php?page=yikes-inc-easy-mailchimp' ) ) ); ?>" class="yikes-delete-mailchimp-form" onclick="return confirm('<?php printf( __( 'Are you sure you want to delete the %s form? This cannot be undone.', 'yikes-inc-easy-mailchimp-extender' ), stripslashes( $form[ 'form_name' ] ) ); ?>');"><?php _e( "Delete", 'yikes-inc-easy-mailchimp-extender' ); ?></a></span> |
|
181 | 181 | </div> |
182 | 182 | </td> |
183 | 183 | |
184 | - <td class="column-columnname"><?php echo isset( $form['form_description'] ) ? str_replace( '[yikes-mailchimp-subscriber-count]', do_shortcode( '[yikes-mailchimp-subscriber-count form="' . $form['id'] . '"]' ), $form['form_description'] ) : ''; ?></td> |
|
185 | - <td class="column-columnname"><?php if( isset( $list_data ) && $list_data['total'] > 0 ) { $key = $this->findMCListID( $form['list_id'] , $list_data['data'] ); if( isset( $key ) ) { echo $list_data['data'][$key]['name']; } else { echo '<strong>' . __( 'List Not Found' , 'yikes-inc-easy-mailchimp-extender' ) . '</strong>'; } } ?></td> |
|
184 | + <td class="column-columnname"><?php echo isset( $form[ 'form_description' ] ) ? str_replace( '[yikes-mailchimp-subscriber-count]', do_shortcode( '[yikes-mailchimp-subscriber-count form="' . $form[ 'id' ] . '"]' ), $form[ 'form_description' ] ) : ''; ?></td> |
|
185 | + <td class="column-columnname"><?php if ( isset( $list_data ) && $list_data[ 'total' ] > 0 ) { $key = $this->findMCListID( $form[ 'list_id' ], $list_data[ 'data' ] ); if ( isset( $key ) ) { echo $list_data[ 'data' ][ $key ][ 'name' ]; } else { echo '<strong>' . __( 'List Not Found', 'yikes-inc-easy-mailchimp-extender' ) . '</strong>'; } } ?></td> |
|
186 | 186 | |
187 | 187 | <td class="column-columnname num stat-container"> |
188 | 188 | <?php |
189 | - $impressions = number_format( $form['impressions'] ); |
|
190 | - echo '<span title="' . __( 'Impressions' , 'yikes-inc-easy-mailchimp-extender' ) . '">' . $impressions . '</span>'; |
|
189 | + $impressions = number_format( $form[ 'impressions' ] ); |
|
190 | + echo '<span title="' . __( 'Impressions', 'yikes-inc-easy-mailchimp-extender' ) . '">' . $impressions . '</span>'; |
|
191 | 191 | ?> |
192 | 192 | </td> |
193 | 193 | <td class="column-columnname num stat-container"> |
194 | 194 | <?php |
195 | - $submissions = number_format( $form['submissions'] ); |
|
196 | - echo '<span title="' . __( 'Submissions' , 'yikes-inc-easy-mailchimp-extender' ) . '">' . $submissions . '</span>'; |
|
195 | + $submissions = number_format( $form[ 'submissions' ] ); |
|
196 | + echo '<span title="' . __( 'Submissions', 'yikes-inc-easy-mailchimp-extender' ) . '">' . $submissions . '</span>'; |
|
197 | 197 | ?> |
198 | 198 | </td> |
199 | 199 | <td class="column-columnname num stat-container"> |
200 | 200 | <?php |
201 | - if( $impressions != 0 ) { |
|
202 | - $conversion_rate = '%' . ( round( $form['submissions'] / $form['impressions'] , 2 ) * 100 ); |
|
203 | - if( $conversion_rate >= '%15' ) { |
|
201 | + if ( $impressions != 0 ) { |
|
202 | + $conversion_rate = '%' . ( round( $form[ 'submissions' ] / $form[ 'impressions' ], 2 ) * 100 ); |
|
203 | + if ( $conversion_rate >= '%15' ) { |
|
204 | 204 | $conversion_color = '#00cc00'; // green (unicorn!) |
205 | - } else if( $conversion_rate < '%15' && $conversion_rate >= '%10' ) { |
|
205 | + } else if ( $conversion_rate < '%15' && $conversion_rate >= '%10' ) { |
|
206 | 206 | $conversion_color = '#0080FF'; // light blue (good) |
207 | - } else if( $conversion_rate < '%10' && $conversion_rate >= '%5' ) { |
|
207 | + } else if ( $conversion_rate < '%10' && $conversion_rate >= '%5' ) { |
|
208 | 208 | $conversion_color = '#FFFF32'; // yellow (ok) |
209 | 209 | } else { |
210 | 210 | $conversion_color = '#FF0000'; // red (no bueno) |
@@ -213,12 +213,12 @@ discard block |
||
213 | 213 | $conversion_rate = '%0'; |
214 | 214 | $conversion_color = '#333333'; |
215 | 215 | } |
216 | - echo '<span style="color:' . esc_attr( $conversion_color ) . ';" title="' . esc_attr__( 'Conversion Rate' , 'yikes-inc-easy-mailchimp-extender' ) . '">' . $conversion_rate . '</span>'; |
|
216 | + echo '<span style="color:' . esc_attr( $conversion_color ) . ';" title="' . esc_attr__( 'Conversion Rate', 'yikes-inc-easy-mailchimp-extender' ) . '">' . $conversion_rate . '</span>'; |
|
217 | 217 | ?> |
218 | 218 | </td> |
219 | 219 | <!-- shortcode --> |
220 | 220 | <td class="column-columnname shortcode hidden-class" colspan="3"> |
221 | - <input type="text" class="yikes-mc-shortcode-input yikes-mc-shortcode-input-<?php echo $form['id']; ?>" onclick="this.setSelectionRange(0, this.value.length)" readonly value='[yikes-mailchimp form="<?php echo $form['id']; ?>"]' /> |
|
221 | + <input type="text" class="yikes-mc-shortcode-input yikes-mc-shortcode-input-<?php echo $form[ 'id' ]; ?>" onclick="this.setSelectionRange(0, this.value.length)" readonly value='[yikes-mailchimp form="<?php echo $form[ 'id' ]; ?>"]' /> |
|
222 | 222 | </td> |
223 | 223 | </tr> |
224 | 224 | <?php |
@@ -226,7 +226,7 @@ discard block |
||
226 | 226 | } |
227 | 227 | } else { ?> |
228 | 228 | <tr class="no-items"> |
229 | - <td class="colspanchange no-mailchimp-forms-found" colspan="8"><em><?php _e( 'No MailChimp forms found. Use the form to the right to create a new one.' , 'yikes-inc-easy-mailchimp-extender' ); ?></em></td> |
|
229 | + <td class="colspanchange no-mailchimp-forms-found" colspan="8"><em><?php _e( 'No MailChimp forms found. Use the form to the right to create a new one.', 'yikes-inc-easy-mailchimp-extender' ); ?></em></td> |
|
230 | 230 | </tr> |
231 | 231 | <?php } ?> |
232 | 232 | </tbody> |
@@ -247,7 +247,7 @@ discard block |
||
247 | 247 | <div class="postbox yikes-easy-mc-postbox"> |
248 | 248 | |
249 | 249 | <?php |
250 | - $this->generate_manage_forms_sidebar( $list_data['data'] ); |
|
250 | + $this->generate_manage_forms_sidebar( $list_data[ 'data' ] ); |
|
251 | 251 | ?> |
252 | 252 | |
253 | 253 | </div> <!-- .postbox --> |
@@ -3,14 +3,14 @@ discard block |
||
3 | 3 | * Get and store our variables |
4 | 4 | * @since 6.0 |
5 | 5 | */ |
6 | - $list_id = $_GET['mailchimp-list']; |
|
7 | - $email_id = (int) esc_attr( $_GET['email-id'] ); |
|
6 | + $list_id = $_GET[ 'mailchimp-list' ]; |
|
7 | + $email_id = (int) esc_attr( $_GET[ 'email-id' ] ); |
|
8 | 8 | |
9 | 9 | /* |
10 | 10 | * Confirm that our data is set |
11 | 11 | * or abort... |
12 | 12 | */ |
13 | - if( ! isset( $list_id ) || ! isset( $email_id ) ) { |
|
13 | + if ( ! isset( $list_id ) || ! isset( $email_id ) ) { |
|
14 | 14 | wp_die( "We've encountered an error. Please go back and try again", "yikes-inc-easy-mailchimp-extender" ); |
15 | 15 | exit; |
16 | 16 | } |
@@ -20,7 +20,7 @@ discard block |
||
20 | 20 | $dash_position = strpos( $api_key, '-' ); |
21 | 21 | |
22 | 22 | // get this lists data |
23 | - if( $dash_position !== false ) { |
|
23 | + if ( $dash_position !== false ) { |
|
24 | 24 | $api_endpoint = 'https://' . substr( $api_key, $dash_position + 1 ) . '.api.mailchimp.com/2.0/lists/member-info.json'; |
25 | 25 | } |
26 | 26 | $user_data = wp_remote_post( $api_endpoint, array( |
@@ -36,29 +36,29 @@ discard block |
||
36 | 36 | ) ); |
37 | 37 | $user_data = json_decode( wp_remote_retrieve_body( $user_data ), true ); |
38 | 38 | |
39 | - if( isset( $user_data['error'] ) ) { |
|
40 | - if( WP_DEBUG || get_option( 'yikes-mailchimp-debug-status' , '' ) == '1' ) { |
|
39 | + if ( isset( $user_data[ 'error' ] ) ) { |
|
40 | + if ( WP_DEBUG || get_option( 'yikes-mailchimp-debug-status', '' ) == '1' ) { |
|
41 | 41 | require_once YIKES_MC_PATH . 'includes/error_log/class-yikes-inc-easy-mailchimp-error-logging.php'; |
42 | 42 | $error_logging = new Yikes_Inc_Easy_Mailchimp_Error_Logging(); |
43 | - $error_logging->yikes_easy_mailchimp_write_to_error_log( $user_data['error'], __( "Get Member Info" , 'yikes-inc-easy-mailchimp-extender' ), "View User Page" ); |
|
43 | + $error_logging->yikes_easy_mailchimp_write_to_error_log( $user_data[ 'error' ], __( "Get Member Info", 'yikes-inc-easy-mailchimp-extender' ), "View User Page" ); |
|
44 | 44 | } |
45 | 45 | } |
46 | 46 | |
47 | 47 | /* |
48 | 48 | * Check for MailChimp returned errors |
49 | 49 | */ |
50 | - if( isset( $user_data['error'] ) ) { |
|
50 | + if ( isset( $user_data[ 'error' ] ) ) { |
|
51 | 51 | echo '<h4>Error</h4>'; |
52 | - echo $user_data['error'] . '.'; |
|
52 | + echo $user_data[ 'error' ] . '.'; |
|
53 | 53 | return; |
54 | 54 | } |
55 | 55 | |
56 | - if( isset( $user_data['data'][0] ) ) { |
|
56 | + if ( isset( $user_data[ 'data' ][ 0 ] ) ) { |
|
57 | 57 | // reset our data so we can easily use it |
58 | - $user_data = $user_data['data'][0]; |
|
58 | + $user_data = $user_data[ 'data' ][ 0 ]; |
|
59 | 59 | |
60 | - $other_lists = ( isset( $user_data['lists'] ) && ! empty( $user_data['lists'] ) ) ? $user_data['lists'] : array(); |
|
61 | - $merge_data_array = ( $user_data['merges'] && ! empty( $user_data['merges'] ) ) ? $user_data['merges'] : array(); |
|
60 | + $other_lists = ( isset( $user_data[ 'lists' ] ) && ! empty( $user_data[ 'lists' ] ) ) ? $user_data[ 'lists' ] : array(); |
|
61 | + $merge_data_array = ( $user_data[ 'merges' ] && ! empty( $user_data[ 'merges' ] ) ) ? $user_data[ 'merges' ] : array(); |
|
62 | 62 | |
63 | 63 | // print_r( $user_data ); |
64 | 64 | |
@@ -68,40 +68,40 @@ discard block |
||
68 | 68 | $merge_variable_fields = array(); |
69 | 69 | |
70 | 70 | /* Build the array of mailing lists the user is subscribed to */ |
71 | - if( isset( $other_lists ) && count( $other_lists ) >= 1 ) { |
|
72 | - foreach( $other_lists as $list ) { |
|
73 | - if( $list['status'] == 'subscribed' ) { |
|
74 | - if( $dash_position !== false ) { |
|
71 | + if ( isset( $other_lists ) && count( $other_lists ) >= 1 ) { |
|
72 | + foreach ( $other_lists as $list ) { |
|
73 | + if ( $list[ 'status' ] == 'subscribed' ) { |
|
74 | + if ( $dash_position !== false ) { |
|
75 | 75 | $api_endpoint = 'https://' . substr( $api_key, $dash_position + 1 ) . '.api.mailchimp.com/2.0/lists/list.json'; |
76 | 76 | } |
77 | 77 | $list_data = wp_remote_post( $api_endpoint, array( |
78 | 78 | 'body' => array( |
79 | 79 | 'apikey' => $api_key, |
80 | 80 | 'filters' => array( |
81 | - 'list_id' => $list['id'] |
|
81 | + 'list_id' => $list[ 'id' ] |
|
82 | 82 | ) |
83 | 83 | ), |
84 | 84 | 'timeout' => 10, |
85 | 85 | 'sslverify' => apply_filters( 'yikes-mailchimp-sslverify', true ) |
86 | 86 | ) ); |
87 | 87 | $list_data = json_decode( wp_remote_retrieve_body( $list_data ), true ); |
88 | - if( isset( $list_data['error'] ) ) { |
|
89 | - if( WP_DEBUG || get_option( 'yikes-mailchimp-debug-status' , '' ) == '1' ) { |
|
88 | + if ( isset( $list_data[ 'error' ] ) ) { |
|
89 | + if ( WP_DEBUG || get_option( 'yikes-mailchimp-debug-status', '' ) == '1' ) { |
|
90 | 90 | require_once YIKES_MC_PATH . 'includes/error_log/class-yikes-inc-easy-mailchimp-error-logging.php'; |
91 | 91 | $error_logging = new Yikes_Inc_Easy_Mailchimp_Error_Logging(); |
92 | - $error_logging->yikes_easy_mailchimp_write_to_error_log( $list_data['error'], __( "Get Account Lists" , 'yikes-inc-easy-mailchimp-extender' ), "View User Page" ); |
|
92 | + $error_logging->yikes_easy_mailchimp_write_to_error_log( $list_data[ 'error' ], __( "Get Account Lists", 'yikes-inc-easy-mailchimp-extender' ), "View User Page" ); |
|
93 | 93 | } |
94 | 94 | } |
95 | - if( $list_data && isset( $list_data['data'][0] ) ) { |
|
96 | - $additional_lists[$list_data['data'][0]['id']] = $list_data['data'][0]['name']; |
|
95 | + if ( $list_data && isset( $list_data[ 'data' ][ 0 ] ) ) { |
|
96 | + $additional_lists[ $list_data[ 'data' ][ 0 ][ 'id' ] ] = $list_data[ 'data' ][ 0 ][ 'name' ]; |
|
97 | 97 | } |
98 | 98 | } |
99 | 99 | } |
100 | 100 | } |
101 | 101 | |
102 | 102 | /* Build the array of merge variables => value */ |
103 | - if( isset( $merge_data_array ) && count( $merge_data_array ) >= 1 ) { |
|
104 | - if( $dash_position !== false ) { |
|
103 | + if ( isset( $merge_data_array ) && count( $merge_data_array ) >= 1 ) { |
|
104 | + if ( $dash_position !== false ) { |
|
105 | 105 | $api_endpoint = 'https://' . substr( $api_key, $dash_position + 1 ) . '.api.mailchimp.com/2.0/lists/merge-vars.json'; |
106 | 106 | } |
107 | 107 | $merge_variables = wp_remote_post( $api_endpoint, array( |
@@ -113,18 +113,18 @@ discard block |
||
113 | 113 | 'sslverify' => apply_filters( 'yikes-mailchimp-sslverify', true ) |
114 | 114 | ) ); |
115 | 115 | $merge_variables = json_decode( wp_remote_retrieve_body( $merge_variables ), true ); |
116 | - if( isset( $merge_variables['error'] ) ) { |
|
117 | - if( WP_DEBUG || get_option( 'yikes-mailchimp-debug-status' , '' ) == '1' ) { |
|
116 | + if ( isset( $merge_variables[ 'error' ] ) ) { |
|
117 | + if ( WP_DEBUG || get_option( 'yikes-mailchimp-debug-status', '' ) == '1' ) { |
|
118 | 118 | require_once YIKES_MC_PATH . 'includes/error_log/class-yikes-inc-easy-mailchimp-error-logging.php'; |
119 | 119 | $error_logging = new Yikes_Inc_Easy_Mailchimp_Error_Logging(); |
120 | - $error_logging->yikes_easy_mailchimp_write_to_error_log( $merge_variables['error'], __( "Get Merge Variables" , 'yikes-inc-easy-mailchimp-extender' ), "View User Page" ); |
|
120 | + $error_logging->yikes_easy_mailchimp_write_to_error_log( $merge_variables[ 'error' ], __( "Get Merge Variables", 'yikes-inc-easy-mailchimp-extender' ), "View User Page" ); |
|
121 | 121 | } |
122 | 122 | } |
123 | 123 | // loop and display |
124 | - if( $merge_variables ) { |
|
125 | - foreach( $merge_variables['data'][0]['merge_vars'] as $merge_variable ) { |
|
126 | - if( $merge_variable['tag'] != 'EMAIL' ) { |
|
127 | - $merge_variable_fields[$merge_variable['name']] = ( isset( $merge_data_array[$merge_variable['tag']] ) ) ? $merge_data_array[$merge_variable['tag']] : ''; |
|
124 | + if ( $merge_variables ) { |
|
125 | + foreach ( $merge_variables[ 'data' ][ 0 ][ 'merge_vars' ] as $merge_variable ) { |
|
126 | + if ( $merge_variable[ 'tag' ] != 'EMAIL' ) { |
|
127 | + $merge_variable_fields[ $merge_variable[ 'name' ] ] = ( isset( $merge_data_array[ $merge_variable[ 'tag' ] ] ) ) ? $merge_data_array[ $merge_variable[ 'tag' ] ] : ''; |
|
128 | 128 | } |
129 | 129 | } |
130 | 130 | } |
@@ -132,17 +132,17 @@ discard block |
||
132 | 132 | |
133 | 133 | |
134 | 134 | // store usable data |
135 | - $user_email = sanitize_email( $user_data['email'] ); |
|
135 | + $user_email = sanitize_email( $user_data[ 'email' ] ); |
|
136 | 136 | // prepend our email address to the beginning |
137 | 137 | $merge_variable_fields = array( 'Email Address' => $user_email ) + $merge_variable_fields; |
138 | 138 | $gravatar_image = get_avatar( $user_email, 120 ); |
139 | - $email_type = $user_data['email_type']; |
|
140 | - $member_rating = ( ! empty( $user_data['member_rating'] ) ) ? (int) $user_data['member_rating'] : 0; |
|
139 | + $email_type = $user_data[ 'email_type' ]; |
|
140 | + $member_rating = ( ! empty( $user_data[ 'member_rating' ] ) ) ? (int) $user_data[ 'member_rating' ] : 0; |
|
141 | 141 | $member_rating_stars = ''; |
142 | - if( $member_rating > 0 ) { |
|
142 | + if ( $member_rating > 0 ) { |
|
143 | 143 | $x = 1; |
144 | - while( $x <= 5 ) { |
|
145 | - if( $x <= $member_rating ) { |
|
144 | + while ( $x <= 5 ) { |
|
145 | + if ( $x <= $member_rating ) { |
|
146 | 146 | $member_rating_stars .= '<span class="yikes-mc-member-rating-star dashicons dashicons-star-filled"></span>'; |
147 | 147 | } else { |
148 | 148 | $member_rating_stars .= '<span class="yikes-mc-member-rating-star dashicons dashicons-star-empty"></span>'; |
@@ -151,25 +151,25 @@ discard block |
||
151 | 151 | } |
152 | 152 | } else { |
153 | 153 | $y = 1; |
154 | - while( $y <= 5 ) { |
|
154 | + while ( $y <= 5 ) { |
|
155 | 155 | $member_rating_stars .= '<span class="yikes-mc-member-rating-star dashicons dashicons-star-empty"></span>'; |
156 | 156 | $y++; |
157 | 157 | } |
158 | 158 | } |
159 | - $last_changed = strtotime( $user_data['info_changed'] ); |
|
160 | - $user_language = ( $user_data['language'] && $user_data['language'] != '' ) ? $user_data['language'] : ''; |
|
161 | - $list_name = $user_data['list_name']; |
|
159 | + $last_changed = strtotime( $user_data[ 'info_changed' ] ); |
|
160 | + $user_language = ( $user_data[ 'language' ] && $user_data[ 'language' ] != '' ) ? $user_data[ 'language' ] : ''; |
|
161 | + $list_name = $user_data[ 'list_name' ]; |
|
162 | 162 | |
163 | 163 | // Generate our display page |
164 | 164 | ?> |
165 | 165 | <div class="wrap view-user-data-wrap"> |
166 | 166 | <!-- Freddie Logo --> |
167 | - <img src="<?php echo YIKES_MC_URL . 'includes/images/MailChimp_Assets/Freddie_60px.png'; ?>" alt="<?php __( 'Freddie - MailChimp Mascot' , 'yikes-inc-easy-mailchimp-extender' ); ?>" class="yikes-mc-freddie-logo" /> |
|
167 | + <img src="<?php echo YIKES_MC_URL . 'includes/images/MailChimp_Assets/Freddie_60px.png'; ?>" alt="<?php __( 'Freddie - MailChimp Mascot', 'yikes-inc-easy-mailchimp-extender' ); ?>" class="yikes-mc-freddie-logo" /> |
|
168 | 168 | |
169 | - <h1>YIKES Easy Forms for MailChimp | <?php _e( 'Subscriber Details' , 'yikes-inc-easy-mailchimp-extender' ); ?></h1> |
|
169 | + <h1>YIKES Easy Forms for MailChimp | <?php _e( 'Subscriber Details', 'yikes-inc-easy-mailchimp-extender' ); ?></h1> |
|
170 | 170 | |
171 | 171 | <!-- Settings Page Description --> |
172 | - <p class="yikes-easy-mc-about-text about-text"><?php printf( __( 'View %s subscriber details below.' , 'yikes-inc-easy-mailchimp-extender' ), $user_email ); ?></p> |
|
172 | + <p class="yikes-easy-mc-about-text about-text"><?php printf( __( 'View %s subscriber details below.', 'yikes-inc-easy-mailchimp-extender' ), $user_email ); ?></p> |
|
173 | 173 | |
174 | 174 | <section class="yikes-mc-view-list-breadcrumbs"> |
175 | 175 | <a href="<?php echo esc_url( admin_url( 'admin.php?page=yikes-inc-easy-mailchimp-lists' ) ); ?>" title="<?php _e( 'View List', 'yikes-inc-easy-mailchimp-extender' ); ?>"> |
@@ -192,16 +192,16 @@ discard block |
||
192 | 192 | <h2><?php echo $user_email; ?></h2> |
193 | 193 | <?php echo '<span class="member-star-rating-container" title="' . sprintf( _n( 'Member Rating: %s star', 'Member Rating: %s stars', $member_rating, 'yikes-inc-easy-mailchimp-extender' ), $member_rating ) . '">' . $member_rating_stars . '</span>'; ?> |
194 | 194 | <span class="member-subscription-date"> |
195 | - <?php echo __( 'Subscribed:', 'yikes-inc-easy-mailchimp-extender' ) . ' ' . get_date_from_gmt( $user_data['info_changed'], 'F jS, Y h:i a' ); ?> |
|
195 | + <?php echo __( 'Subscribed:', 'yikes-inc-easy-mailchimp-extender' ) . ' ' . get_date_from_gmt( $user_data[ 'info_changed' ], 'F jS, Y h:i a' ); ?> |
|
196 | 196 | </span> |
197 | - <?php if( isset( $user_data['geo'] ) && ! empty( $user_data['geo'] ) ) { ?> |
|
198 | - <?php if( isset( $user_data['geo']['latitude'] ) && isset( $user_data['geo']['longitude'] ) ) { ?> |
|
197 | + <?php if ( isset( $user_data[ 'geo' ] ) && ! empty( $user_data[ 'geo' ] ) ) { ?> |
|
198 | + <?php if ( isset( $user_data[ 'geo' ][ 'latitude' ] ) && isset( $user_data[ 'geo' ][ 'longitude' ] ) ) { ?> |
|
199 | 199 | <span class="member-location-data"> |
200 | - <?php echo __( 'Location:', 'yikes-inc-easy-mailchimp-extender' ) . ' ' . yikes_mc_geocode_subscriber_data( $user_data['geo']['latitude'], $user_data['geo']['longitude'] ); ?> |
|
200 | + <?php echo __( 'Location:', 'yikes-inc-easy-mailchimp-extender' ) . ' ' . yikes_mc_geocode_subscriber_data( $user_data[ 'geo' ][ 'latitude' ], $user_data[ 'geo' ][ 'longitude' ] ); ?> |
|
201 | 201 | </span> |
202 | 202 | <?php } else { ?> |
203 | 203 | <span class="member-location-data"> |
204 | - <?php echo __( 'Location:', 'yikes-inc-easy-mailchimp-extender' ) . ' ' . $user_data['geo']['region'] . ', ' . $user_data['geo']['cc']; ?> |
|
204 | + <?php echo __( 'Location:', 'yikes-inc-easy-mailchimp-extender' ) . ' ' . $user_data[ 'geo' ][ 'region' ] . ', ' . $user_data[ 'geo' ][ 'cc' ]; ?> |
|
205 | 205 | </span> |
206 | 206 | <?php |
207 | 207 | } |
@@ -212,14 +212,14 @@ discard block |
||
212 | 212 | <hr class="yikes-mc-subscriber-hr" /> |
213 | 213 | |
214 | 214 | <?php |
215 | - if( ! isset( $_GET['section'] ) || ( isset( $_GET['section'] ) && $_GET['section'] == 'subscriber-data' ) ) { |
|
215 | + if ( ! isset( $_GET[ 'section' ] ) || ( isset( $_GET[ 'section' ] ) && $_GET[ 'section' ] == 'subscriber-data' ) ) { |
|
216 | 216 | ?> |
217 | 217 | <section class="yikes-mc-card-body merge-variable-section"> |
218 | 218 | <h3><?php _e( 'Fields:', 'yikes-inc-easy-mailchimp-extender' ); ?></h3> |
219 | 219 | <?php |
220 | - if( ! empty( $merge_variable_fields ) ) { |
|
220 | + if ( ! empty( $merge_variable_fields ) ) { |
|
221 | 221 | ?> |
222 | - <?php foreach( $merge_variable_fields as $field_name => $value ) { ?> |
|
222 | + <?php foreach ( $merge_variable_fields as $field_name => $value ) { ?> |
|
223 | 223 | <li> |
224 | 224 | <label> |
225 | 225 | <strong class="section-label"><?php echo $field_name; ?></strong> |
@@ -232,11 +232,11 @@ discard block |
||
232 | 232 | <strong><?php _e( 'No Subscriber Data Found', 'yikes-inc-easy-mailchimp-extender' ); ?></strong> |
233 | 233 | <?php |
234 | 234 | } |
235 | - if( isset( $user_data['ip_signup'] ) && $user_data['ip_signup'] != '' ) { |
|
235 | + if ( isset( $user_data[ 'ip_signup' ] ) && $user_data[ 'ip_signup' ] != '' ) { |
|
236 | 236 | ?> |
237 | 237 | <li> |
238 | 238 | <label> |
239 | - <strong class="section-label"><?php echo __( 'Signup IP', 'yikes-inc-easy-mailchimp-extender' ) . '</strong><p class="section-value"><em>' . $user_data['ip_signup']; ?></em></p> |
|
239 | + <strong class="section-label"><?php echo __( 'Signup IP', 'yikes-inc-easy-mailchimp-extender' ) . '</strong><p class="section-value"><em>' . $user_data[ 'ip_signup' ]; ?></em></p> |
|
240 | 240 | </label> |
241 | 241 | </li> |
242 | 242 | <?php |
@@ -247,17 +247,17 @@ discard block |
||
247 | 247 | <?php |
248 | 248 | |
249 | 249 | |
250 | - if( isset( $_GET['section'] ) && $_GET['section'] == 'additional-subscriptions' ) { |
|
250 | + if ( isset( $_GET[ 'section' ] ) && $_GET[ 'section' ] == 'additional-subscriptions' ) { |
|
251 | 251 | ?> |
252 | 252 | <section class="yikes-mc-card-body"> |
253 | 253 | <?php |
254 | - if( ! empty( $additional_lists ) ) { |
|
254 | + if ( ! empty( $additional_lists ) ) { |
|
255 | 255 | // remove this list from the additional lists list |
256 | - unset( $additional_lists[$list_id] ); |
|
257 | - if( ! empty( $additional_lists ) ) { |
|
256 | + unset( $additional_lists[ $list_id ] ); |
|
257 | + if ( ! empty( $additional_lists ) ) { |
|
258 | 258 | ?> |
259 | 259 | <h3><?php _e( 'Additional Subscriptions:', 'yikes-inc-easy-mailchimp-extender' ); ?></h3> |
260 | - <?php foreach( $additional_lists as $listid => $name ) { ?> |
|
260 | + <?php foreach ( $additional_lists as $listid => $name ) { ?> |
|
261 | 261 | <?php |
262 | 262 | $user_redirect_url = esc_url_raw( admin_url( 'admin.php?page=yikes-mailchimp-view-list&list-id=' . $listid ) ); |
263 | 263 | ?> |
@@ -276,8 +276,8 @@ discard block |
||
276 | 276 | ?> |
277 | 277 | |
278 | 278 | <?php |
279 | - if( isset( $_GET['section'] ) && $_GET['section'] == 'delete-subscriber' ) { |
|
280 | - $unsubscribe_subscriber_url = esc_url_raw( add_query_arg( array( 'action' => 'yikes-easy-mc-unsubscribe-user', 'mailchimp-list' => $list_id , 'nonce' => wp_create_nonce( 'unsubscribe-user-'.$email_id ), 'email_id' => $email_id ) ) ); |
|
279 | + if ( isset( $_GET[ 'section' ] ) && $_GET[ 'section' ] == 'delete-subscriber' ) { |
|
280 | + $unsubscribe_subscriber_url = esc_url_raw( add_query_arg( array( 'action' => 'yikes-easy-mc-unsubscribe-user', 'mailchimp-list' => $list_id, 'nonce' => wp_create_nonce( 'unsubscribe-user-' . $email_id ), 'email_id' => $email_id ) ) ); |
|
281 | 281 | ?> |
282 | 282 | <form id="delete_subscriber" method="POST" action="<?php echo $unsubscribe_subscriber_url; ?>"> |
283 | 283 | <p class="description"> |
@@ -326,33 +326,33 @@ discard block |
||
326 | 326 | <div id="customer-tab-wrapper"> |
327 | 327 | <ul id="customer-tab-wrapper-list"> |
328 | 328 | |
329 | - <?php if( isset( $_GET['section'] ) && $_GET['section'] != 'subscriber-data' ) { ?> |
|
329 | + <?php if ( isset( $_GET[ 'section' ] ) && $_GET[ 'section' ] != 'subscriber-data' ) { ?> |
|
330 | 330 | <a title="<?php _e( 'Subscriber Details', 'yikes-inc-easy-mailchimp-extender' ); ?>" aria-label="<?php _e( 'Subscriber Details', 'yikes-inc-easy-mailchimp-extender' ); ?>" href="<?php echo $subscriber_details; ?>"> |
331 | 331 | <?php } ?> |
332 | 332 | |
333 | - <li <?php if( ! isset( $_GET['section'] ) || ( isset( $_GET['section'] ) && $_GET['section'] == 'subscriber-data' ) ) { ?>class="active"<?php } else { ?>class="inactive"<?php } ?>><span class="dashicons dashicons-id"></span></li> |
|
333 | + <li <?php if ( ! isset( $_GET[ 'section' ] ) || ( isset( $_GET[ 'section' ] ) && $_GET[ 'section' ] == 'subscriber-data' ) ) { ?>class="active"<?php } else { ?>class="inactive"<?php } ?>><span class="dashicons dashicons-id"></span></li> |
|
334 | 334 | |
335 | - <?php if( isset( $_GET['section'] ) && $_GET['section'] != 'subscriber-data' ) { ?> |
|
335 | + <?php if ( isset( $_GET[ 'section' ] ) && $_GET[ 'section' ] != 'subscriber-data' ) { ?> |
|
336 | 336 | </a> |
337 | 337 | <?php } ?> |
338 | 338 | |
339 | - <?php if( ! isset( $_GET['section'] ) || ( isset( $_GET['section'] ) && $_GET['section'] != 'additional-subscriptions' ) ) { ?> |
|
339 | + <?php if ( ! isset( $_GET[ 'section' ] ) || ( isset( $_GET[ 'section' ] ) && $_GET[ 'section' ] != 'additional-subscriptions' ) ) { ?> |
|
340 | 340 | <a title="<?php _e( 'Additional Subscriptions', 'yikes-inc-easy-mailchimp-extender' ); ?>" aria-label="<?php _e( 'Additional Subscriptions', 'yikes-inc-easy-mailchimp-extender' ); ?>" href="<?php echo $additional_subscription_url; ?>"> |
341 | 341 | <?php } ?> |
342 | 342 | |
343 | - <li <?php if( isset( $_GET['section'] ) && $_GET['section'] == 'additional-subscriptions' ) { ?>class="active"<?php } else { ?>class="inactive"<?php } ?>><span class="dashicons dashicons-portfolio"></span></li> |
|
343 | + <li <?php if ( isset( $_GET[ 'section' ] ) && $_GET[ 'section' ] == 'additional-subscriptions' ) { ?>class="active"<?php } else { ?>class="inactive"<?php } ?>><span class="dashicons dashicons-portfolio"></span></li> |
|
344 | 344 | |
345 | - <?php if( ! isset( $_GET['section'] ) || ( isset( $_GET['section'] ) && $_GET['section'] == 'additional-subscriptions' ) ) { ?> |
|
345 | + <?php if ( ! isset( $_GET[ 'section' ] ) || ( isset( $_GET[ 'section' ] ) && $_GET[ 'section' ] == 'additional-subscriptions' ) ) { ?> |
|
346 | 346 | </a> |
347 | 347 | <?php } ?> |
348 | 348 | |
349 | - <?php if( ! isset( $_GET['section'] ) || isset( $_GET['section'] ) && $_GET['section'] != 'delete-subscriber' ) { ?> |
|
349 | + <?php if ( ! isset( $_GET[ 'section' ] ) || isset( $_GET[ 'section' ] ) && $_GET[ 'section' ] != 'delete-subscriber' ) { ?> |
|
350 | 350 | <a title="<?php _e( 'Delete Subscriber', 'yikes-inc-easy-mailchimp-extender' ); ?>" aria-label="<?php _e( 'Delete Subscriber', 'yikes-inc-easy-mailchimp-extender' ); ?>" href="<?php echo $delete_subscriber_url; ?>"> |
351 | 351 | <?php } ?> |
352 | 352 | |
353 | - <li <?php if( isset( $_GET['section'] ) && $_GET['section'] == 'delete-subscriber' ) { ?>class="active"<?php } else { ?>class="inactive"<?php } ?>><span class="dashicons dashicons-trash"></span></li> |
|
353 | + <li <?php if ( isset( $_GET[ 'section' ] ) && $_GET[ 'section' ] == 'delete-subscriber' ) { ?>class="active"<?php } else { ?>class="inactive"<?php } ?>><span class="dashicons dashicons-trash"></span></li> |
|
354 | 354 | |
355 | - <?php if( ! isset( $_GET['section'] ) || ( isset( $_GET['section'] ) && $_GET['section'] == 'delete-subscriber' ) ) { ?> |
|
355 | + <?php if ( ! isset( $_GET[ 'section' ] ) || ( isset( $_GET[ 'section' ] ) && $_GET[ 'section' ] == 'delete-subscriber' ) ) { ?> |
|
356 | 356 | </a> |
357 | 357 | <?php } ?> |
358 | 358 | |
@@ -367,15 +367,15 @@ discard block |
||
367 | 367 | function yikes_mc_geocode_subscriber_data( $latitude, $longitude ) { |
368 | 368 | $geocode_url = 'https://maps.googleapis.com/maps/api/geocode/json?latlng=' . $latitude . ',' . $longitude; |
369 | 369 | $geocode_response = wp_remote_get( $geocode_url ); |
370 | - if( is_wp_error( $geocode_response ) ) { |
|
370 | + if ( is_wp_error( $geocode_response ) ) { |
|
371 | 371 | return; |
372 | 372 | } |
373 | 373 | $geocode_response_body = json_decode( wp_remote_retrieve_body( $geocode_response ), true ); |
374 | - if( is_wp_error( $geocode_response_body ) ) { |
|
374 | + if ( is_wp_error( $geocode_response_body ) ) { |
|
375 | 375 | return; |
376 | 376 | } |
377 | - $city = $geocode_response_body['results'][0]['address_components'][2]['short_name']; |
|
378 | - $state = $geocode_response_body['results'][0]['address_components'][5]['short_name']; |
|
379 | - $country = $geocode_response_body['results'][0]['address_components'][6]['short_name']; |
|
377 | + $city = $geocode_response_body[ 'results' ][ 0 ][ 'address_components' ][ 2 ][ 'short_name' ]; |
|
378 | + $state = $geocode_response_body[ 'results' ][ 0 ][ 'address_components' ][ 5 ][ 'short_name' ]; |
|
379 | + $country = $geocode_response_body[ 'results' ][ 0 ][ 'address_components' ][ 6 ][ 'short_name' ]; |
|
380 | 380 | return $link = '<a href="http://maps.google.com/maps?q=' . $latitude . ',' . $longitude . '" target="_blank" title="' . __( 'View Google Map', 'yikes-inc-easy-mailchimp-extender' ) . '">' . $city . ', ' . $state . ', ' . $country . '</a> <span class="flag-icon flag-icon-' . strtolower( $country ) . '"></span>'; |
381 | 381 | } |