@@ -79,8 +79,8 @@ discard block |
||
| 79 | 79 | } |
| 80 | 80 | |
| 81 | 81 | // If the API gave an error or there are no more lists, break. |
| 82 | - if ( isset( $response['error'] ) ) { |
|
| 83 | - return new WP_Error( $response['title'], $response['detail'] ); |
|
| 82 | + if ( isset( $response[ 'error' ] ) ) { |
|
| 83 | + return new WP_Error( $response[ 'title' ], $response[ 'detail' ] ); |
|
| 84 | 84 | } |
| 85 | 85 | |
| 86 | 86 | if ( empty( $response[ $item_key ] ) ) { |
@@ -89,7 +89,7 @@ discard block |
||
| 89 | 89 | |
| 90 | 90 | // Update the total number of items if it's still zero. |
| 91 | 91 | if ( 0 === $total ) { |
| 92 | - $total = intval( $response['total_items'] ); |
|
| 92 | + $total = intval( $response[ 'total_items' ] ); |
|
| 93 | 93 | } |
| 94 | 94 | |
| 95 | 95 | // Store each new list. |
@@ -196,28 +196,28 @@ discard block |
||
| 196 | 196 | return $response; |
| 197 | 197 | } |
| 198 | 198 | |
| 199 | - if ( isset( $response['error'] ) ) { |
|
| 200 | - $title = isset( $response['title'] ) ? $response['title'] : $response['name']; |
|
| 201 | - $detail = isset( $response['detail'] ) ? $response['detail'] : $response['error']; |
|
| 202 | - $data = isset( $response['errors'] ) ? $response['errors'] : array(); |
|
| 199 | + if ( isset( $response[ 'error' ] ) ) { |
|
| 200 | + $title = isset( $response[ 'title' ] ) ? $response[ 'title' ] : $response[ 'name' ]; |
|
| 201 | + $detail = isset( $response[ 'detail' ] ) ? $response[ 'detail' ] : $response[ 'error' ]; |
|
| 202 | + $data = isset( $response[ 'errors' ] ) ? $response[ 'errors' ] : array(); |
|
| 203 | 203 | |
| 204 | 204 | return new WP_Error( |
| 205 | 205 | $title, |
| 206 | 206 | $detail, |
| 207 | 207 | array( |
| 208 | - 'status' => (int) $response['status'], |
|
| 208 | + 'status' => (int) $response[ 'status' ], |
|
| 209 | 209 | 'data' => $data, |
| 210 | 210 | ) |
| 211 | 211 | ); |
| 212 | 212 | } |
| 213 | 213 | |
| 214 | - if ( isset( $response['status'] ) && 503 === (int) $response['status'] ) { |
|
| 214 | + if ( isset( $response[ 'status' ] ) && 503 === (int) $response[ 'status' ] ) { |
|
| 215 | 215 | return new WP_Error( |
| 216 | - $response['status'], |
|
| 217 | - ( isset( $response['ref_no'] ) ? $response['ref_no'] . '. ' : '' ) . ( isset( $response['title'] ) ? '(' . $response['title'] . ')' : '(akamai_503)' ), |
|
| 216 | + $response[ 'status' ], |
|
| 217 | + ( isset( $response[ 'ref_no' ] ) ? $response[ 'ref_no' ] . '. ' : '' ) . ( isset( $response[ 'title' ] ) ? '(' . $response[ 'title' ] . ')' : '(akamai_503)' ), |
|
| 218 | 218 | array( |
| 219 | - 'status' => (int) $response['status'], |
|
| 220 | - 'data' => isset( $response['ref_no'] ) ? $response['ref_no'] : '', |
|
| 219 | + 'status' => (int) $response[ 'status' ], |
|
| 220 | + 'data' => isset( $response[ 'ref_no' ] ) ? $response[ 'ref_no' ] : '', |
|
| 221 | 221 | ) |
| 222 | 222 | ); |
| 223 | 223 | } |
@@ -246,9 +246,9 @@ discard block |
||
| 246 | 246 | // Mailchimp uses the application/problem+json type for errors. |
| 247 | 247 | $headers = wp_remote_retrieve_headers( $response ); |
| 248 | 248 | |
| 249 | - if ( isset( $headers['content-type'] ) ) { |
|
| 250 | - if ( false !== strpos( $headers['content-type'], 'application/problem+json' ) ) { |
|
| 251 | - $body['error'] = true; |
|
| 249 | + if ( isset( $headers[ 'content-type' ] ) ) { |
|
| 250 | + if ( false !== strpos( $headers[ 'content-type' ], 'application/problem+json' ) ) { |
|
| 251 | + $body[ 'error' ] = true; |
|
| 252 | 252 | } |
| 253 | 253 | } |
| 254 | 254 | |
@@ -23,7 +23,7 @@ discard block |
||
| 23 | 23 | </span> |
| 24 | 24 | </h3> |
| 25 | 25 | <?php else : ?> |
| 26 | - <h3><span><?php _e( 'General Settings' , 'yikes-inc-easy-mailchimp-extender' ); ?></span><?php echo $api_connection; ?></h3> |
|
| 26 | + <h3><span><?php _e( 'General Settings', 'yikes-inc-easy-mailchimp-extender' ); ?></span><?php echo $api_connection; ?></h3> |
|
| 27 | 27 | <?php endif; ?> |
| 28 | 28 | |
| 29 | 29 | <div class="inside"> |
@@ -38,11 +38,11 @@ discard block |
||
| 38 | 38 | <!-- Mailchimp API Input Field --> |
| 39 | 39 | <label for="yks-mailchimp-api-key"> |
| 40 | 40 | |
| 41 | - <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> |
|
| 41 | + <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> |
|
| 42 | 42 | |
| 43 | - <p><strong><?php _e( 'Mailchimp API Key' , 'yikes-inc-easy-mailchimp-extender' ); ?></strong></p> |
|
| 43 | + <p><strong><?php _e( 'Mailchimp API Key', 'yikes-inc-easy-mailchimp-extender' ); ?></strong></p> |
|
| 44 | 44 | |
| 45 | - <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 esc_attr( 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" /> |
|
| 45 | + <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 esc_attr( 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" /> |
|
| 46 | 46 | |
| 47 | 47 | <?php if ( $yikes_mc_api_constant ) { ?> |
| 48 | 48 | <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> |
@@ -51,21 +51,21 @@ discard block |
||
| 51 | 51 | <?php echo $api_error_response; ?> |
| 52 | 52 | |
| 53 | 53 | <?php if ( ! $yikes_mc_api_constant ) { ?> |
| 54 | - <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> |
|
| 54 | + <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> |
|
| 55 | 55 | <?php } ?> |
| 56 | 56 | |
| 57 | 57 | <p class="description"><?php esc_html_e( 'Warning: changing your API key may break your current forms.', 'yikes-inc-easy-mailchimp-extender' ); ?></p> |
| 58 | 58 | </label> |
| 59 | 59 | |
| 60 | 60 | <!-- Use Nonce Validation Field --> |
| 61 | - <p><strong><?php _e( 'Enable nonce validation on this site?' , 'yikes-inc-easy-mailchimp-extender' ); ?></strong></p> |
|
| 61 | + <p><strong><?php _e( 'Enable nonce validation on this site?', 'yikes-inc-easy-mailchimp-extender' ); ?></strong></p> |
|
| 62 | 62 | <label for="yikes-mailchimp-use-nonce-yes"> |
| 63 | 63 | Yes |
| 64 | - <input type="radio" name="yikes-mailchimp-use-nonce" id="yikes-mailchimp-use-nonce-yes" class="settings-page-input" value="1" <?php checked( get_option( 'yikes-mailchimp-use-nonce', '1' ) , '1' ); ?> /> |
|
| 64 | + <input type="radio" name="yikes-mailchimp-use-nonce" id="yikes-mailchimp-use-nonce-yes" class="settings-page-input" value="1" <?php checked( get_option( 'yikes-mailchimp-use-nonce', '1' ), '1' ); ?> /> |
|
| 65 | 65 | </label> |
| 66 | 66 | <label for="yikes-mailchimp-use-nonce-no"> |
| 67 | 67 | No |
| 68 | - <input type="radio" name="yikes-mailchimp-use-nonce" id="yikes-mailchimp-use-nonce-no" class="settings-page-input" value="0" <?php checked( get_option( 'yikes-mailchimp-use-nonce', '1' ) , '0' ); ?> /> |
|
| 68 | + <input type="radio" name="yikes-mailchimp-use-nonce" id="yikes-mailchimp-use-nonce-no" class="settings-page-input" value="0" <?php checked( get_option( 'yikes-mailchimp-use-nonce', '1' ), '0' ); ?> /> |
|
| 69 | 69 | </label> |
| 70 | 70 | |
| 71 | 71 | <?php submit_button(); ?> |
@@ -22,8 +22,11 @@ |
||
| 22 | 22 | ?> |
| 23 | 23 | </span> |
| 24 | 24 | </h3> |
| 25 | -<?php else : ?> |
|
| 26 | - <h3><span><?php _e( 'General Settings' , 'yikes-inc-easy-mailchimp-extender' ); ?></span><?php echo $api_connection; ?></h3> |
|
| 25 | +<?php else { |
|
| 26 | + : ?> |
|
| 27 | + <h3><span><?php _e( 'General Settings' , 'yikes-inc-easy-mailchimp-extender' ); |
|
| 28 | +} |
|
| 29 | +?></span><?php echo $api_connection; ?></h3> |
|
| 27 | 30 | <?php endif; ?> |
| 28 | 31 | |
| 29 | 32 | <div class="inside"> |