@@ -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 | - $api_key = trim( get_option( 'yikes-mc-api-key' , '' ) ); |
|
6 | + $api_key = trim( get_option( 'yikes-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> |
@@ -17,7 +17,7 @@ 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'] ) ) { |
|
20 | + if( isset( $list_data['error'] ) ) { |
|
21 | 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(); |
@@ -80,9 +80,9 @@ discard block |
||
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 | 87 | <tr class="<?php if( $i % 2 == 0 ) { echo 'alternate'; } ?>"> |
88 | 88 | <td class="column-columnname"> |
@@ -3,24 +3,24 @@ 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 | } |
17 | 17 | |
18 | 18 | // run our API call, to get list data.. |
19 | - $api_key = trim( get_option( 'yikes-mc-api-key' , '' ) ); |
|
19 | + $api_key = trim( get_option( 'yikes-mc-api-key', '' ) ); |
|
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 | } |
382 | 382 | \ No newline at end of file |
@@ -36,7 +36,7 @@ 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'] ) ) { |
|
39 | + if( isset( $user_data['error'] ) ) { |
|
40 | 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(); |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | /* Build the array of mailing lists the user is subscribed to */ |
71 | 71 | if( isset( $other_lists ) && count( $other_lists ) >= 1 ) { |
72 | 72 | foreach( $other_lists as $list ) { |
73 | - if( $list['status'] == 'subscribed' ) { |
|
73 | + if( $list['status'] == 'subscribed' ) { |
|
74 | 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 | } |
@@ -85,7 +85,7 @@ discard block |
||
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'] ) ) { |
|
88 | + if( isset( $list_data['error'] ) ) { |
|
89 | 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(); |
@@ -113,7 +113,7 @@ 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'] ) ) { |
|
116 | + if( isset( $merge_variables['error'] ) ) { |
|
117 | 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(); |
@@ -123,7 +123,7 @@ discard block |
||
123 | 123 | // loop and display |
124 | 124 | if( $merge_variables ) { |
125 | 125 | foreach( $merge_variables['data'][0]['merge_vars'] as $merge_variable ) { |
126 | - if( $merge_variable['tag'] != 'EMAIL' ) { |
|
126 | + if( $merge_variable['tag'] != 'EMAIL' ) { |
|
127 | 127 | $merge_variable_fields[$merge_variable['name']] = ( isset( $merge_data_array[$merge_variable['tag']] ) ) ? $merge_data_array[$merge_variable['tag']] : ''; |
128 | 128 | } |
129 | 129 | } |
@@ -212,12 +212,12 @@ 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 | 222 | <?php foreach( $merge_variable_fields as $field_name => $value ) { ?> |
223 | 223 | <li> |
@@ -247,11 +247,11 @@ 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 | 256 | unset( $additional_lists[$list_id] ); |
257 | 257 | if( ! empty( $additional_lists ) ) { |
@@ -276,7 +276,7 @@ discard block |
||
276 | 276 | ?> |
277 | 277 | |
278 | 278 | <?php |
279 | - if( isset( $_GET['section'] ) && $_GET['section'] == 'delete-subscriber' ) { |
|
279 | + if( isset( $_GET['section'] ) && $_GET['section'] == 'delete-subscriber' ) { |
|
280 | 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; ?>"> |
@@ -7,13 +7,13 @@ discard block |
||
7 | 7 | class Yikes_Inc_Easy_Mailchimp_Extender_Helper { |
8 | 8 | |
9 | 9 | /** |
10 | - * Helper functions to help out with extensions (still fleshing out) |
|
11 | - * @since 6.0 |
|
12 | - * @ Parameters (array of data) |
|
13 | - * - Section ID - id of the section, should be a slug style text ie: 'custom-section' |
|
14 | - * - Link Text - Visible text for this link ie: 'Custom Section' |
|
15 | - * - Dashicon - class of the icon you would like to use for this link |
|
16 | - **/ |
|
10 | + * Helper functions to help out with extensions (still fleshing out) |
|
11 | + * @since 6.0 |
|
12 | + * @ Parameters (array of data) |
|
13 | + * - Section ID - id of the section, should be a slug style text ie: 'custom-section' |
|
14 | + * - Link Text - Visible text for this link ie: 'Custom Section' |
|
15 | + * - Dashicon - class of the icon you would like to use for this link |
|
16 | + **/ |
|
17 | 17 | public static function add_edit_form_section_link( $link_array=array() ) { |
18 | 18 | if( !empty( $link_array ) ) { |
19 | 19 | $link_data = wp_parse_args( array() , $link_array ); |
@@ -36,17 +36,17 @@ discard block |
||
36 | 36 | } |
37 | 37 | |
38 | 38 | /** |
39 | - * Helper functions to help out with extensions (still fleshing out) |
|
40 | - * @since 6.0 |
|
41 | - * @ Parameters: |
|
42 | - * - Section ID - id of the section, should be a slug style text ie: 'custom-section' |
|
43 | - * - Class - class file to call function from? |
|
44 | - * - Main Callback - call back for main section |
|
45 | - * - Main Section Title - main section title |
|
46 | - * - Sidebar Callback - callback for the sidebar section |
|
47 | - * - Sidebar Title - title of the sidebar section |
|
48 | - * - Class - class to reference funtions out of (optiona, if left blank functions should be defined in functions.php (or outside of a class)) |
|
49 | - **/ |
|
39 | + * Helper functions to help out with extensions (still fleshing out) |
|
40 | + * @since 6.0 |
|
41 | + * @ Parameters: |
|
42 | + * - Section ID - id of the section, should be a slug style text ie: 'custom-section' |
|
43 | + * - Class - class file to call function from? |
|
44 | + * - Main Callback - call back for main section |
|
45 | + * - Main Section Title - main section title |
|
46 | + * - Sidebar Callback - callback for the sidebar section |
|
47 | + * - Sidebar Title - title of the sidebar section |
|
48 | + * - Class - class to reference funtions out of (optiona, if left blank functions should be defined in functions.php (or outside of a class)) |
|
49 | + **/ |
|
50 | 50 | public static function add_edit_form_section( $section_array=array() ) { |
51 | 51 | if( !empty( $section_array ) ) { |
52 | 52 | $section_data = wp_parse_args( array() , $section_array ); |
@@ -59,11 +59,11 @@ discard block |
||
59 | 59 | } |
60 | 60 | |
61 | 61 | /** |
62 | - * Check if the custom section is single or two columns (with sidebar) |
|
63 | - * @since 6.0 |
|
64 | - * @Parameters: |
|
65 | - * - Section Data - the array of data associated with the custom field you've set up |
|
66 | - */ |
|
62 | + * Check if the custom section is single or two columns (with sidebar) |
|
63 | + * @since 6.0 |
|
64 | + * @Parameters: |
|
65 | + * - Section Data - the array of data associated with the custom field you've set up |
|
66 | + */ |
|
67 | 67 | public static function is_custom_section_two_column( $custom_section_data ) { |
68 | 68 | // print_r( $custom_section_data ); |
69 | 69 | $value = ( isset( $custom_section_data['sidebar_title'] ) && isset( $custom_section_data['sidebar_fields'] ) && !empty( $custom_section_data['sidebar_fields'] ) ) ? true : false; |
@@ -14,21 +14,21 @@ discard block |
||
14 | 14 | * - Link Text - Visible text for this link ie: 'Custom Section' |
15 | 15 | * - Dashicon - class of the icon you would like to use for this link |
16 | 16 | **/ |
17 | - public static function add_edit_form_section_link( $link_array=array() ) { |
|
18 | - if( !empty( $link_array ) ) { |
|
19 | - $link_data = wp_parse_args( array() , $link_array ); |
|
20 | - if( !empty( $link_data['text'] ) && !empty( $link_data['id'] ) ) { |
|
21 | - if( !empty( $link_data['icon'] ) ) { |
|
22 | - if( !isset( $link_data['icon_family'] ) || $link_data['icon_family'] == 'dashicons' || $link_data['icon_family'] == 'dashicon' ) { |
|
23 | - $icon = '<span class="dashicons dashicons-' . esc_attr__( $link_data['icon'] ) . ' yikes-easy-mailchimp-custom-content-icon"></span>'; |
|
17 | + public static function add_edit_form_section_link( $link_array = array() ) { |
|
18 | + if ( ! empty( $link_array ) ) { |
|
19 | + $link_data = wp_parse_args( array(), $link_array ); |
|
20 | + if ( ! empty( $link_data[ 'text' ] ) && ! empty( $link_data[ 'id' ] ) ) { |
|
21 | + if ( ! empty( $link_data[ 'icon' ] ) ) { |
|
22 | + if ( ! isset( $link_data[ 'icon_family' ] ) || $link_data[ 'icon_family' ] == 'dashicons' || $link_data[ 'icon_family' ] == 'dashicon' ) { |
|
23 | + $icon = '<span class="dashicons dashicons-' . esc_attr__( $link_data[ 'icon' ] ) . ' yikes-easy-mailchimp-custom-content-icon"></span>'; |
|
24 | 24 | } else { |
25 | - $icon = '<span class="' . esc_attr__( $link_data['icon'] ) . ' yikes-easy-mailchimp-custom-content-icon"></span>'; |
|
25 | + $icon = '<span class="' . esc_attr__( $link_data[ 'icon' ] ) . ' yikes-easy-mailchimp-custom-content-icon"></span>'; |
|
26 | 26 | } |
27 | 27 | } else { |
28 | 28 | $icon = ''; |
29 | 29 | } |
30 | 30 | $link = '<li class="hidden_setting_list">'; |
31 | - $link .= '<a class="hidden_setting ' . esc_attr__( $link_data['id'] ) . '" data-attr-container="' . esc_attr__( $link_data['id'] ) . '" onclick="return false;" title="' . esc_attr__( $link_data['text'] ) . '" href="#">' . $icon . esc_attr__( $link_data['text'] ) . '</a>'; |
|
31 | + $link .= '<a class="hidden_setting ' . esc_attr__( $link_data[ 'id' ] ) . '" data-attr-container="' . esc_attr__( $link_data[ 'id' ] ) . '" onclick="return false;" title="' . esc_attr__( $link_data[ 'text' ] ) . '" href="#">' . $icon . esc_attr__( $link_data[ 'text' ] ) . '</a>'; |
|
32 | 32 | $link .= '</li>'; |
33 | 33 | echo $link; |
34 | 34 | } |
@@ -47,9 +47,9 @@ discard block |
||
47 | 47 | * - Sidebar Title - title of the sidebar section |
48 | 48 | * - Class - class to reference funtions out of (optiona, if left blank functions should be defined in functions.php (or outside of a class)) |
49 | 49 | **/ |
50 | - public static function add_edit_form_section( $section_array=array() ) { |
|
51 | - if( !empty( $section_array ) ) { |
|
52 | - $section_data = wp_parse_args( array() , $section_array ); |
|
50 | + public static function add_edit_form_section( $section_array = array() ) { |
|
51 | + if ( ! empty( $section_array ) ) { |
|
52 | + $section_data = wp_parse_args( array(), $section_array ); |
|
53 | 53 | ob_start(); |
54 | 54 | include ( YIKES_MC_PATH . 'admin/partials/helpers/edit-form-hidden-section-template.php' ); |
55 | 55 | $section = ob_get_contents(); |
@@ -66,7 +66,7 @@ discard block |
||
66 | 66 | */ |
67 | 67 | public static function is_custom_section_two_column( $custom_section_data ) { |
68 | 68 | // print_r( $custom_section_data ); |
69 | - $value = ( isset( $custom_section_data['sidebar_title'] ) && isset( $custom_section_data['sidebar_fields'] ) && !empty( $custom_section_data['sidebar_fields'] ) ) ? true : false; |
|
69 | + $value = ( isset( $custom_section_data[ 'sidebar_title' ] ) && isset( $custom_section_data[ 'sidebar_fields' ] ) && ! empty( $custom_section_data[ 'sidebar_fields' ] ) ) ? true : false; |
|
70 | 70 | return $value; |
71 | 71 | } |
72 | 72 |
@@ -5,12 +5,12 @@ |
||
5 | 5 | * For help on using, see our documentation [https://yikesplugins.com/support/knowledge-base/product/easy-forms-for-mailchimp/] |
6 | 6 | * @since 6.0 |
7 | 7 | */ |
8 | - $field_data = json_decode( $form_data['custom_fields'] , true ); |
|
8 | + $field_data = json_decode( $form_data[ 'custom_fields' ], true ); |
|
9 | 9 | ?> |
10 | 10 | <label class="custom-field-section"> |
11 | - <strong><?php echo $field['label']; ?></strong> |
|
12 | - <input type="text" class="widefat" name="custom-field[<?php echo $field['id']; ?>]" id="custom-field" value="<?php echo isset( $field_data[$field['id']] ) ? $field_data[$field['id']] : ''; ?>" placeholder="<?php echo isset( $field['placeholder'] ) ? $field['placeholder'] : ''; ?>"> |
|
13 | - <?php if( isset( $field['description'] ) && $field['description'] != '' ) { ?> |
|
14 | - <p class="description"><?php echo $field['description']; ?></p> |
|
11 | + <strong><?php echo $field[ 'label' ]; ?></strong> |
|
12 | + <input type="text" class="widefat" name="custom-field[<?php echo $field[ 'id' ]; ?>]" id="custom-field" value="<?php echo isset( $field_data[ $field[ 'id' ] ] ) ? $field_data[ $field[ 'id' ] ] : ''; ?>" placeholder="<?php echo isset( $field[ 'placeholder' ] ) ? $field[ 'placeholder' ] : ''; ?>"> |
|
13 | + <?php if ( isset( $field[ 'description' ] ) && $field[ 'description' ] != '' ) { ?> |
|
14 | + <p class="description"><?php echo $field[ 'description' ]; ?></p> |
|
15 | 15 | <?php } ?> |
16 | 16 | </label> |
17 | 17 | \ No newline at end of file |
@@ -5,21 +5,21 @@ |
||
5 | 5 | * For help on using, see our documentation [https://yikesplugins.com/support/knowledge-base/product/easy-forms-for-mailchimp/] |
6 | 6 | * @since 6.0 |
7 | 7 | */ |
8 | - $field_data = json_decode( $form_data['custom_fields'] , true ); |
|
8 | + $field_data = json_decode( $form_data[ 'custom_fields' ], true ); |
|
9 | 9 | ?> |
10 | 10 | <div class="custom-field-section"> |
11 | 11 | <!-- title --> |
12 | - <strong><?php echo $field['label']; ?></strong> |
|
12 | + <strong><?php echo $field[ 'label' ]; ?></strong> |
|
13 | 13 | |
14 | 14 | <!-- Dropdown --> |
15 | - <select class="custom-select-field" name="custom-field[<?php echo $field['id']; ?>]"> |
|
16 | - <?php foreach( $field['options'] as $value => $label ) { ?> |
|
17 | - <option value="<?php echo $value; ?>" <?php if( isset( $field_data[$field['id']] ) ) { selected( $field_data[$field['id']] , $value ); } ?>><?php echo $label; ?></option> |
|
15 | + <select class="custom-select-field" name="custom-field[<?php echo $field[ 'id' ]; ?>]"> |
|
16 | + <?php foreach ( $field[ 'options' ] as $value => $label ) { ?> |
|
17 | + <option value="<?php echo $value; ?>" <?php if ( isset( $field_data[ $field[ 'id' ] ] ) ) { selected( $field_data[ $field[ 'id' ] ], $value ); } ?>><?php echo $label; ?></option> |
|
18 | 18 | <?php } ?> |
19 | 19 | </select> |
20 | 20 | |
21 | 21 | <!-- description --> |
22 | - <?php if( isset( $field['description'] ) && $field['description'] != '' ) { ?> |
|
23 | - <p class="description"><?php echo $field['description']; ?></p> |
|
22 | + <?php if ( isset( $field[ 'description' ] ) && $field[ 'description' ] != '' ) { ?> |
|
23 | + <p class="description"><?php echo $field[ 'description' ]; ?></p> |
|
24 | 24 | <?php } ?> |
25 | 25 | </div> |
26 | 26 | \ No newline at end of file |
@@ -6,13 +6,13 @@ |
||
6 | 6 | * For help on using, see our documentation [https://yikesplugins.com/support/knowledge-base/product/easy-forms-for-mailchimp/] |
7 | 7 | * @since 6.0 |
8 | 8 | */ |
9 | - $field_data = json_decode( $form_data['custom_fields'] , true ); |
|
10 | - $content = ( isset( $field_data[$field['id']] ) ) ? $field_data[$field['id']] : ( isset( $field['default'] ) ? $field['default'] : '' ); |
|
11 | - $wysiwyg_id = 'custom-field['.$field['id'].']'; |
|
9 | + $field_data = json_decode( $form_data[ 'custom_fields' ], true ); |
|
10 | + $content = ( isset( $field_data[ $field[ 'id' ] ] ) ) ? $field_data[ $field[ 'id' ] ] : ( isset( $field[ 'default' ] ) ? $field[ 'default' ] : '' ); |
|
11 | + $wysiwyg_id = 'custom-field[' . $field[ 'id' ] . ']'; |
|
12 | 12 | ?> |
13 | 13 | |
14 | 14 | <div class="yikes-mailchimp-wysiwyg-field"> |
15 | - <label for="image_url" class="widefat"><strong><?php echo $field['label']; ?></strong></label> |
|
16 | - <?php wp_editor( $content, $field['id'], array( 'textarea_name' => $wysiwyg_id ) ); ?> |
|
17 | - <p class="description"><?php echo $field['description']; ?></p> |
|
15 | + <label for="image_url" class="widefat"><strong><?php echo $field[ 'label' ]; ?></strong></label> |
|
16 | + <?php wp_editor( $content, $field[ 'id' ], array( 'textarea_name' => $wysiwyg_id ) ); ?> |
|
17 | + <p class="description"><?php echo $field[ 'description' ]; ?></p> |
|
18 | 18 | </div> |
@@ -5,22 +5,22 @@ |
||
5 | 5 | * For help on using, see our documentation [https://yikesplugins.com/support/knowledge-base/product/easy-forms-for-mailchimp/] |
6 | 6 | * @since 6.0 |
7 | 7 | */ |
8 | - $field_data = json_decode( $form_data['custom_fields'] , true ); |
|
8 | + $field_data = json_decode( $form_data[ 'custom_fields' ], true ); |
|
9 | 9 | ?> |
10 | 10 | <div class="custom-field-section"> |
11 | 11 | <!-- title --> |
12 | - <strong><?php echo $field['label']; ?></strong> |
|
12 | + <strong><?php echo $field[ 'label' ]; ?></strong> |
|
13 | 13 | <!-- radio buttons --> |
14 | 14 | <section class="custom-radio-holder"> |
15 | - <?php foreach( $field['options'] as $value => $label ) { ?> |
|
15 | + <?php foreach ( $field[ 'options' ] as $value => $label ) { ?> |
|
16 | 16 | <label class="custom-radio-label"> |
17 | - <input type="radio" name="custom-field[<?php echo $field['id']; ?>][]" id="custom-field" value="<?php echo $value; ?>" <?php if( isset( $field_data[$field['id']] ) ) { checked( $field_data[$field['id']] , $value ); } ?>> |
|
17 | + <input type="radio" name="custom-field[<?php echo $field[ 'id' ]; ?>][]" id="custom-field" value="<?php echo $value; ?>" <?php if ( isset( $field_data[ $field[ 'id' ] ] ) ) { checked( $field_data[ $field[ 'id' ] ], $value ); } ?>> |
|
18 | 18 | <?php echo $label; ?> |
19 | 19 | </label> |
20 | 20 | <?php } ?> |
21 | 21 | </section> |
22 | 22 | <!-- description --> |
23 | - <?php if( isset( $field['description'] ) && $field['description'] != '' ) { ?> |
|
24 | - <p class="description"><?php echo $field['description']; ?></p> |
|
23 | + <?php if ( isset( $field[ 'description' ] ) && $field[ 'description' ] != '' ) { ?> |
|
24 | + <p class="description"><?php echo $field[ 'description' ]; ?></p> |
|
25 | 25 | <?php } ?> |
26 | 26 | </div> |
27 | 27 | \ No newline at end of file |
@@ -5,12 +5,12 @@ |
||
5 | 5 | * For help on using, see our documentation [https://yikesplugins.com/support/knowledge-base/product/easy-forms-for-mailchimp/] |
6 | 6 | * @since 6.0 |
7 | 7 | */ |
8 | - $field_data = json_decode( $form_data['custom_fields'] , true ); |
|
8 | + $field_data = json_decode( $form_data[ 'custom_fields' ], true ); |
|
9 | 9 | ?> |
10 | 10 | <label class="custom-field-section"> |
11 | - <strong><?php echo $field['label']; ?></strong> |
|
12 | - <input type="checkbox" class="widefat" name="custom-field[<?php echo $field['id']; ?>]" id="custom-field" value="1" <?php checked( isset( $field_data[$field['id']] ) ? $field_data[$field['id']] : 0, 1, true ); ?>> |
|
13 | - <?php if( isset( $field['description'] ) && $field['description'] != '' ) { ?> |
|
14 | - <p class="description"><?php echo $field['description']; ?></p> |
|
11 | + <strong><?php echo $field[ 'label' ]; ?></strong> |
|
12 | + <input type="checkbox" class="widefat" name="custom-field[<?php echo $field[ 'id' ]; ?>]" id="custom-field" value="1" <?php checked( isset( $field_data[ $field[ 'id' ] ] ) ? $field_data[ $field[ 'id' ] ] : 0, 1, true ); ?>> |
|
13 | + <?php if ( isset( $field[ 'description' ] ) && $field[ 'description' ] != '' ) { ?> |
|
14 | + <p class="description"><?php echo $field[ 'description' ]; ?></p> |
|
15 | 15 | <?php } ?> |
16 | 16 | </label> |
17 | 17 | \ No newline at end of file |
@@ -5,33 +5,33 @@ |
||
5 | 5 | * For help on using, see our documentation [https://yikesplugins.com/support/knowledge-base/product/easy-forms-for-mailchimp/] |
6 | 6 | * @since 6.0 |
7 | 7 | */ |
8 | - $field_data = json_decode( $form_data['custom_fields'] , true ); |
|
8 | + $field_data = json_decode( $form_data[ 'custom_fields' ], true ); |
|
9 | 9 | // This will enqueue the Media Uploader script |
10 | 10 | wp_enqueue_media(); |
11 | 11 | // And let's not forget the script we wrote earlier |
12 | 12 | wp_enqueue_script( 'yikes-mailchimp-file-field-script', plugin_dir_url( __FILE__ ) . 'js/yikes-mc-file-upload.js', array( 'jquery' ), '1.0', false ); |
13 | 13 | // print_r( $field_data ); |
14 | - wp_localize_script( 'yikes-mailchimp-file-field-script' , 'additional_data' , array( |
|
14 | + wp_localize_script( 'yikes-mailchimp-file-field-script', 'additional_data', array( |
|
15 | 15 | 'wp_includes_image_url' => includes_url() . 'images/media/' |
16 | 16 | ) ); |
17 | 17 | $i = 1; |
18 | 18 | // create an single item array when nothing is stored yet, loop for one field |
19 | - $field_data['incentive-attachment'] = ( isset( $field_data['incentive-attachment'] ) && !empty( $field_data['incentive-attachment'] ) ) ? $field_data['incentive-attachment'] : array( '' ); |
|
19 | + $field_data[ 'incentive-attachment' ] = ( isset( $field_data[ 'incentive-attachment' ] ) && ! empty( $field_data[ 'incentive-attachment' ] ) ) ? $field_data[ 'incentive-attachment' ] : array( '' ); |
|
20 | 20 | ?> |
21 | 21 | |
22 | 22 | <div class="yikes-mailchimp-file-field"> |
23 | - <label for="image_url" class="widefat"><strong><?php echo $field['label']; ?></strong></label> |
|
24 | - <?php foreach( $field_data['incentive-attachment'] as $attachment ) { ?> |
|
25 | - <input type="text" name="custom-field[<?php echo $field['id']; ?>][<?php echo $i; ?>]" id="custom-field[<?php echo $field['id']; ?>][<?php echo $i; ?>]" class="file-attachment" value="<?php echo isset( $field_data[$field['id']][$i] ) ? $field_data[$field['id']][$i] : ''; ?>"> |
|
26 | - <input type="button" name="upload-btn" id="upload-btn" class="button-secondary" data-attr-position="<?php echo $i; ?>" value="<?php _e( 'Upload File' , 'yikes-inc-easy-mailchimp-extender' ); ?>"> |
|
23 | + <label for="image_url" class="widefat"><strong><?php echo $field[ 'label' ]; ?></strong></label> |
|
24 | + <?php foreach ( $field_data[ 'incentive-attachment' ] as $attachment ) { ?> |
|
25 | + <input type="text" name="custom-field[<?php echo $field[ 'id' ]; ?>][<?php echo $i; ?>]" id="custom-field[<?php echo $field[ 'id' ]; ?>][<?php echo $i; ?>]" class="file-attachment" value="<?php echo isset( $field_data[ $field[ 'id' ] ][ $i ] ) ? $field_data[ $field[ 'id' ] ][ $i ] : ''; ?>"> |
|
26 | + <input type="button" name="upload-btn" id="upload-btn" class="button-secondary" data-attr-position="<?php echo $i; ?>" value="<?php _e( 'Upload File', 'yikes-inc-easy-mailchimp-extender' ); ?>"> |
|
27 | 27 | <div class="file-container"> |
28 | 28 | <p class="file-remove-wrapper"> |
29 | - <a href="#" class="remove-file-button" data-attr-position="<?php echo $i; ?>"><?php _e( 'Remove File' , 'yikes-inc-easy-mailchimp-extender' ); ?></a> |
|
29 | + <a href="#" class="remove-file-button" data-attr-position="<?php echo $i; ?>"><?php _e( 'Remove File', 'yikes-inc-easy-mailchimp-extender' ); ?></a> |
|
30 | 30 | </p> |
31 | 31 | </div> |
32 | 32 | <?php $i++; } ?> |
33 | - <?php if( isset( $field['repeat'] ) ) { ?> |
|
33 | + <?php if ( isset( $field[ 'repeat' ] ) ) { ?> |
|
34 | 34 | <a href="#" class="button-secondary add-new-incentive-attachment" data-attr-position="<?php echo $i; ?>"><span class="dashicons dashicons-plus"></span></a> |
35 | 35 | <?php } ?> |
36 | - <p class="description"><?php echo $field['description']; ?></p> |
|
36 | + <p class="description"><?php echo $field[ 'description' ]; ?></p> |
|
37 | 37 | </div> |
38 | 38 | \ No newline at end of file |