@@ -9,14 +9,14 @@ discard block |
||
9 | 9 | * @table_name - table name to impot data to |
10 | 10 | */ |
11 | 11 | public static function yikes_mailchimp_import_forms( $csv_file ) { |
12 | - if ( ! isset( $_REQUEST['action'] ) || $_REQUEST['action'] !== 'yikes-easy-mc-import-forms' ) { |
|
12 | + if ( ! isset( $_REQUEST[ 'action' ] ) || $_REQUEST[ 'action' ] !== 'yikes-easy-mc-import-forms' ) { |
|
13 | 13 | wp_die( __( 'There was an error during import. If you continue to run into issues, please reach out to the Yikes Inc. support team.', 'yikes-inc-easy-mailchimp-extender' ) ); |
14 | 14 | } |
15 | 15 | |
16 | - $name = $csv_file['csv']['name']; |
|
16 | + $name = $csv_file[ 'csv' ][ 'name' ]; |
|
17 | 17 | $ext_array = explode( '.', $name ); |
18 | 18 | $ext = end( $ext_array ); |
19 | - $tmp_name = $csv_file['csv']['tmp_name']; |
|
19 | + $tmp_name = $csv_file[ 'csv' ][ 'tmp_name' ]; |
|
20 | 20 | |
21 | 21 | // Ensure we have a valid file extension. |
22 | 22 | if ( 'csv' !== $ext ) { |
@@ -41,17 +41,17 @@ discard block |
||
41 | 41 | |
42 | 42 | // Check if this is a settings import by confirming the first option is 'yikes-mc-api-key' |
43 | 43 | // @todo: this should be a separate method. |
44 | - if( $line[0] == 'yikes-mc-api-key' ) { |
|
45 | - $options = fgetcsv($file, 10000, ','); |
|
44 | + if ( $line[ 0 ] == 'yikes-mc-api-key' ) { |
|
45 | + $options = fgetcsv( $file, 10000, ',' ); |
|
46 | 46 | $new_settings = array(); |
47 | 47 | $x = 0; |
48 | 48 | // build our new array $key => $value pair |
49 | - foreach( $line as $option_name ) { |
|
50 | - $new_settings[$option_name] = $options[$x]; |
|
49 | + foreach ( $line as $option_name ) { |
|
50 | + $new_settings[ $option_name ] = $options[ $x ]; |
|
51 | 51 | $x++; |
52 | 52 | } |
53 | 53 | // update the options in the databse |
54 | - foreach( $new_settings as $option_name => $option_value ) { |
|
54 | + foreach ( $new_settings as $option_name => $option_value ) { |
|
55 | 55 | update_option( $option_name, $option_value ); |
56 | 56 | } |
57 | 57 | } else { // if it's not, then it's an opt-in forms import |
@@ -80,7 +80,7 @@ discard block |
||
80 | 80 | $row++; |
81 | 81 | } |
82 | 82 | |
83 | - fclose($file); |
|
83 | + fclose( $file ); |
|
84 | 84 | } |
85 | 85 | |
86 | 86 | /* |
@@ -91,20 +91,20 @@ discard block |
||
91 | 91 | */ |
92 | 92 | public static function yikes_mailchimp_import_type( $csv_file ) { |
93 | 93 | // confirm |
94 | - if( isset( $_REQUEST['action'] ) && $_REQUEST['action'] == 'yikes-easy-mc-import-forms' ) { |
|
95 | - $name = $csv_file['csv']['name']; |
|
96 | - $ext_array = explode('.', $name); |
|
94 | + if ( isset( $_REQUEST[ 'action' ] ) && $_REQUEST[ 'action' ] == 'yikes-easy-mc-import-forms' ) { |
|
95 | + $name = $csv_file[ 'csv' ][ 'name' ]; |
|
96 | + $ext_array = explode( '.', $name ); |
|
97 | 97 | $ext = end( $ext_array ); |
98 | - $tmpName = $csv_file['csv']['tmp_name']; |
|
99 | - if($ext === 'csv') { |
|
100 | - if(($handle = fopen($tmpName, 'r')) !== FALSE) { |
|
101 | - $num = count($handle); |
|
102 | - $file = fopen( $tmpName, 'r'); |
|
98 | + $tmpName = $csv_file[ 'csv' ][ 'tmp_name' ]; |
|
99 | + if ( $ext === 'csv' ) { |
|
100 | + if ( ( $handle = fopen( $tmpName, 'r' ) ) !== FALSE ) { |
|
101 | + $num = count( $handle ); |
|
102 | + $file = fopen( $tmpName, 'r' ); |
|
103 | 103 | $row = 1; |
104 | - $first_line_data = fgetcsv($file, 10000, ','); |
|
105 | - if( count( $first_line_data ) > 1 ) { |
|
104 | + $first_line_data = fgetcsv( $file, 10000, ',' ); |
|
105 | + if ( count( $first_line_data ) > 1 ) { |
|
106 | 106 | // Check if this is a settings import by confirming the first option is 'yikes-mc-api-key' |
107 | - if( $first_line_data[0] == 'yikes-mc-api-key' ) { |
|
107 | + if ( $first_line_data[ 0 ] == 'yikes-mc-api-key' ) { |
|
108 | 108 | $import_type = 'import-settings'; |
109 | 109 | } else { |
110 | 110 | $import_type = 'import-forms'; |
@@ -54,7 +54,8 @@ |
||
54 | 54 | foreach( $new_settings as $option_name => $option_value ) { |
55 | 55 | update_option( $option_name, $option_value ); |
56 | 56 | } |
57 | - } else { // if it's not, then it's an opt-in forms import |
|
57 | + } else { |
|
58 | +// if it's not, then it's an opt-in forms import |
|
58 | 59 | // If this is the first row, then it should be title data. |
59 | 60 | if ( 1 === $row ) { |
60 | 61 | $titles = $line; |
@@ -1,6 +1,6 @@ |
||
1 | 1 | <?php |
2 | 2 | |
3 | -return array ( |
|
3 | +return array( |
|
4 | 4 | 'yikes_inc_easy_mailchimp_forms_admin' => 'admin/class-yikes-inc-easy-mailchimp-extender-admin.php', |
5 | 5 | 'yikes_inc_easy_mailchimp_process_ajax' => 'admin/partials/ajax/class.ajax.php', |
6 | 6 | 'yikes_inc_easy_mailchimp_dashboard_widgets' => 'admin/partials/dashboard-widgets/class.list-activity-widget.php', |
@@ -19,7 +19,7 @@ |
||
19 | 19 | * |
20 | 20 | * @param int $form_id The ID of the form to retrieve. |
21 | 21 | * |
22 | - * @return array The array of form data. |
|
22 | + * @return string The array of form data. |
|
23 | 23 | */ |
24 | 24 | public function get_form( $form_id ) { |
25 | 25 | $all_forms = $this->get_all_forms(); |
@@ -48,7 +48,7 @@ discard block |
||
48 | 48 | * @return bool Whether the form was successfully updated. |
49 | 49 | */ |
50 | 50 | public function update_form( $form_id, $data ) { |
51 | - $data['id'] = $form_id; |
|
51 | + $data[ 'id' ] = $form_id; |
|
52 | 52 | $all_forms = $this->get_all_forms(); |
53 | 53 | |
54 | 54 | if ( ! isset( $all_forms[ $form_id ] ) ) { |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | $all_ids = $this->get_form_ids(); |
80 | 80 | $last_id = end( $all_ids ); |
81 | 81 | $new_id = false === $last_id ? 1 : $last_id + 1; |
82 | - $form_data['id'] = $new_id; |
|
82 | + $form_data[ 'id' ] = $new_id; |
|
83 | 83 | |
84 | 84 | // Ensure our data is consistently sorted |
85 | 85 | ksort( $form_data ); |
@@ -80,7 +80,7 @@ discard block |
||
80 | 80 | $titles = array(); |
81 | 81 | $content = array(); |
82 | 82 | foreach ( $plugin_settings as $option_name => $option_value ) { |
83 | - $titles[] = $option_name; |
|
83 | + $titles[ ] = $option_name; |
|
84 | 84 | } |
85 | 85 | |
86 | 86 | // Generate the output file. |
@@ -103,7 +103,7 @@ discard block |
||
103 | 103 | fputcsv( $output_handle, $titles ); |
104 | 104 | $first = false; |
105 | 105 | } |
106 | - $content[] = $option_value; |
|
106 | + $content[ ] = $option_value; |
|
107 | 107 | |
108 | 108 | } |
109 | 109 | fputcsv( $output_handle, $content ); |
@@ -93,7 +93,7 @@ discard block |
||
93 | 93 | */ |
94 | 94 | public function update_form( $form_id, $data ) { |
95 | 95 | // Prepare the data for the database. |
96 | - $data['id'] = $form_id; |
|
96 | + $data[ 'id' ] = $form_id; |
|
97 | 97 | $save_data = $this->prepare_data_for_db( $data ); |
98 | 98 | $formats = $this->get_format_array( $save_data ); |
99 | 99 | |
@@ -122,7 +122,7 @@ discard block |
||
122 | 122 | $form_data = yikes_deep_parse_args( $form_data, $this->get_form_defaults() ); |
123 | 123 | |
124 | 124 | // If there is an ID set, remove it |
125 | - unset( $form_data['id'] ); |
|
125 | + unset( $form_data[ 'id' ] ); |
|
126 | 126 | |
127 | 127 | // Prepare the data for the database |
128 | 128 | $save_data = $this->prepare_data_for_db( $form_data ); |
@@ -302,11 +302,11 @@ discard block |
||
302 | 302 | case 'redirect_user_on_submit': |
303 | 303 | case 'redirect_page': |
304 | 304 | case 'id': |
305 | - $formats[] = '%d'; |
|
305 | + $formats[ ] = '%d'; |
|
306 | 306 | break; |
307 | 307 | |
308 | 308 | default: |
309 | - $formats[] = '%s'; |
|
309 | + $formats[ ] = '%s'; |
|
310 | 310 | } |
311 | 311 | } |
312 | 312 | |
@@ -346,7 +346,7 @@ discard block |
||
346 | 346 | continue; |
347 | 347 | } |
348 | 348 | |
349 | - $data['id'] = $id; |
|
349 | + $data[ 'id' ] = $id; |
|
350 | 350 | $_form_data = $this->prepare_data_for_db( $data ); |
351 | 351 | $formats = $this->get_format_array( $_form_data ); |
352 | 352 |
@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | // Widget name will appear in UI |
26 | 26 | __( 'Easy MailChimp Forms', 'yikes-inc-easy-mailchimp-extender' ), |
27 | 27 | // Widget description |
28 | - array( 'description' => __( 'MailChimp opt-in widget for your sidebar.', 'yikes-inc-easy-mailchimp-extender' ), ) |
|
28 | + array( 'description' => __( 'MailChimp opt-in widget for your sidebar.', 'yikes-inc-easy-mailchimp-extender' ),) |
|
29 | 29 | ); |
30 | 30 | } |
31 | 31 | |
@@ -39,10 +39,10 @@ discard block |
||
39 | 39 | // Get all form IDs so we can use the first one as a default. |
40 | 40 | $form_ids = $this->form_interface->get_form_ids(); |
41 | 41 | |
42 | - $title = isset( $instance['title'] ) ? apply_filters( 'widget_title', $instance['title'] ) : __( 'MailChimp Signup Form', 'yikes-inc-easy-mailchimp-extender' ); |
|
43 | - $form_id = isset( $instance['form_id'] ) ? $instance['form_id'] : $form_ids[0]; |
|
44 | - $form_description = isset( $instance['form_description'] ) ? $instance['form_description'] : ''; |
|
45 | - $submit_button_text = isset( $instance['submit_text'] ) ? $instance['submit_text'] : __( 'Submit', 'yikes-inc-easy-mailchimp-extender' ); |
|
42 | + $title = isset( $instance[ 'title' ] ) ? apply_filters( 'widget_title', $instance[ 'title' ] ) : __( 'MailChimp Signup Form', 'yikes-inc-easy-mailchimp-extender' ); |
|
43 | + $form_id = isset( $instance[ 'form_id' ] ) ? $instance[ 'form_id' ] : $form_ids[ 0 ]; |
|
44 | + $form_description = isset( $instance[ 'form_description' ] ) ? $instance[ 'form_description' ] : ''; |
|
45 | + $submit_button_text = isset( $instance[ 'submit_text' ] ) ? $instance[ 'submit_text' ] : __( 'Submit', 'yikes-inc-easy-mailchimp-extender' ); |
|
46 | 46 | |
47 | 47 | // Build our array based on settings chosen |
48 | 48 | $shortcode_attributes = array( |
@@ -52,10 +52,10 @@ discard block |
||
52 | 52 | ); |
53 | 53 | |
54 | 54 | // before and after widget arguments are defined by themes |
55 | - echo $args['before_widget']; |
|
55 | + echo $args[ 'before_widget' ]; |
|
56 | 56 | |
57 | 57 | if ( ! empty( $title ) ) { |
58 | - echo $args['before_title'] . $title . $args['after_title']; |
|
58 | + echo $args[ 'before_title' ] . $title . $args[ 'after_title' ]; |
|
59 | 59 | } |
60 | 60 | |
61 | 61 | // Custom action hooks to place content in the widget before the form |
@@ -71,7 +71,7 @@ discard block |
||
71 | 71 | do_action( 'yikes-mailchimp-after-form-' . $form_id ); |
72 | 72 | do_action( 'yikes-mailchimp-after-form' ); |
73 | 73 | |
74 | - echo $args['after_widget']; |
|
74 | + echo $args[ 'after_widget' ]; |
|
75 | 75 | } |
76 | 76 | |
77 | 77 | // Widget Backend |
@@ -81,7 +81,7 @@ discard block |
||
81 | 81 | if ( empty( $all_forms ) ) { |
82 | 82 | ?> |
83 | 83 | <section class="no-forms-widget"> |
84 | - <strong><span class="dashicons dashicons-no-alt no-forms-found-icon"></span><?php echo sprintf( __( 'No forms found. It looks like you need to <a href="%s" title="%s">%s</a>.', 'yikes-inc-easy-mailchimp-extender' ), esc_url_raw( admin_url( 'admin.php?page=yikes-inc-easy-mailchimp' ) ), __( 'Create a form' , 'yikes-inc-easy-mailchimp-extender' ), __( 'create a form' , 'yikes-inc-easy-mailchimp-extender' ) ); ?></strong> |
|
84 | + <strong><span class="dashicons dashicons-no-alt no-forms-found-icon"></span><?php echo sprintf( __( 'No forms found. It looks like you need to <a href="%s" title="%s">%s</a>.', 'yikes-inc-easy-mailchimp-extender' ), esc_url_raw( admin_url( 'admin.php?page=yikes-inc-easy-mailchimp' ) ), __( 'Create a form', 'yikes-inc-easy-mailchimp-extender' ), __( 'create a form', 'yikes-inc-easy-mailchimp-extender' ) ); ?></strong> |
|
85 | 85 | </section> |
86 | 86 | <?php |
87 | 87 | return; |
@@ -108,9 +108,9 @@ discard block |
||
108 | 108 | $submit_text = __( 'Submit', 'yikes-inc-easy-mailchimp-extender' ); |
109 | 109 | } |
110 | 110 | |
111 | - if( get_option( 'yikes-mc-api-validation' , 'invalid_api_key' ) == 'invalid_api_key' ) { |
|
111 | + if ( get_option( 'yikes-mc-api-validation', 'invalid_api_key' ) == 'invalid_api_key' ) { |
|
112 | 112 | ?> |
113 | - <p class="enter-valid-api-error-widget"><strong><?php _e( 'Please enter a valid MailChimp API key to connect your site to MailChimp.' , 'yikes-inc-easy-mailchimp-extender' ); ?></strong></p> |
|
113 | + <p class="enter-valid-api-error-widget"><strong><?php _e( 'Please enter a valid MailChimp API key to connect your site to MailChimp.', 'yikes-inc-easy-mailchimp-extender' ); ?></strong></p> |
|
114 | 114 | <?php |
115 | 115 | return; |
116 | 116 | } |
@@ -127,9 +127,9 @@ discard block |
||
127 | 127 | <select id="<?php echo $this->get_field_id( 'form_id' ); ?>" name="<?php echo $this->get_field_name( 'form_id' ); ?>" class="widefat"> |
128 | 128 | <?php |
129 | 129 | // build our array |
130 | - foreach( $all_forms as $id => $form ) { |
|
130 | + foreach ( $all_forms as $id => $form ) { |
|
131 | 131 | ?> |
132 | - <option <?php selected( $selected_form , $id ); ?> name="<?php echo $this->get_field_name( 'form_id' ); ?>" value="<?php echo $id; ?>"><?php echo stripslashes( $form['form_name'] ); ?></option> |
|
132 | + <option <?php selected( $selected_form, $id ); ?> name="<?php echo $this->get_field_name( 'form_id' ); ?>" value="<?php echo $id; ?>"><?php echo stripslashes( $form[ 'form_name' ] ); ?></option> |
|
133 | 133 | <?php |
134 | 134 | } |
135 | 135 | ?> |
@@ -138,7 +138,7 @@ discard block |
||
138 | 138 | |
139 | 139 | <p> |
140 | 140 | <label for="<?php echo $this->get_field_id( 'form_description' ); ?>"><?php _e( 'Display Form Description:' ); ?></label> |
141 | - <input class="widefat" id="<?php echo $this->get_field_id( 'form_description' ); ?>" name="<?php echo $this->get_field_name( 'form_description' ); ?>" type="checkbox" value="1" <?php if( isset( $instance['form_description'] ) ) { checked( $instance['form_description'] , 1 ); } ?> /> |
|
141 | + <input class="widefat" id="<?php echo $this->get_field_id( 'form_description' ); ?>" name="<?php echo $this->get_field_name( 'form_description' ); ?>" type="checkbox" value="1" <?php if ( isset( $instance[ 'form_description' ] ) ) { checked( $instance[ 'form_description' ], 1 ); } ?> /> |
|
142 | 142 | </p> |
143 | 143 | |
144 | 144 | <p> |
@@ -151,10 +151,10 @@ discard block |
||
151 | 151 | // Updating widget replacing old instances with new |
152 | 152 | public function update( $new_instance, $old_instance ) { |
153 | 153 | $instance = array(); |
154 | - $instance['title'] = ( ! empty( $new_instance['title'] ) ) ? strip_tags( $new_instance['title'] ) : ''; |
|
155 | - $instance['form_id'] = $new_instance['form_id']; |
|
156 | - $instance['form_description'] = isset( $new_instance['form_description'] ) ? '1' : ''; |
|
157 | - $instance['submit_text'] = ( ! empty( $new_instance['submit_text'] ) ) ? strip_tags( $new_instance['submit_text'] ) : 'Submit'; |
|
154 | + $instance[ 'title' ] = ( ! empty( $new_instance[ 'title' ] ) ) ? strip_tags( $new_instance[ 'title' ] ) : ''; |
|
155 | + $instance[ 'form_id' ] = $new_instance[ 'form_id' ]; |
|
156 | + $instance[ 'form_description' ] = isset( $new_instance[ 'form_description' ] ) ? '1' : ''; |
|
157 | + $instance[ 'submit_text' ] = ( ! empty( $new_instance[ 'submit_text' ] ) ) ? strip_tags( $new_instance[ 'submit_text' ] ) : 'Submit'; |
|
158 | 158 | return $instance; |
159 | 159 | } |
160 | 160 |
@@ -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 | } |
@@ -23,8 +23,8 @@ discard block |
||
23 | 23 | * @since 6.2.2 |
24 | 24 | * |
25 | 25 | */ |
26 | - if ( isset( $_REQUEST['section'] ) ) { |
|
27 | - $_REQUEST['section'] = preg_replace('/[^\w-]/', '', strip_tags ( $_REQUEST['section'] ) ); |
|
26 | + if ( isset( $_REQUEST[ 'section' ] ) ) { |
|
27 | + $_REQUEST[ 'section' ] = preg_replace( '/[^\w-]/', '', strip_tags( $_REQUEST[ 'section' ] ) ); |
|
28 | 28 | } |
29 | 29 | ?> |
30 | 30 | <!-- Actual Settings Form |
@@ -32,15 +32,15 @@ discard block |
||
32 | 32 | <div class="wrap"> |
33 | 33 | |
34 | 34 | <!-- Freddie Logo --> |
35 | - <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" /> |
|
35 | + <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" /> |
|
36 | 36 | |
37 | - <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> |
|
37 | + <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> |
|
38 | 38 | |
39 | 39 | <!-- Settings Page Description --> |
40 | - <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> |
|
40 | + <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> |
|
41 | 41 | <?php |
42 | 42 | /* Success Messages on Options Updated */ |
43 | - if( isset( $_REQUEST['settings-updated'] ) && $_REQUEST['settings-updated'] == 'true' ) { |
|
43 | + if ( isset( $_REQUEST[ 'settings-updated' ] ) && $_REQUEST[ 'settings-updated' ] == 'true' ) { |
|
44 | 44 | ?> |
45 | 45 | <div class="updated manage-form-admin-notice"> |
46 | 46 | <p><?php _e( 'Settings successfully updated.', 'yikes-inc-easy-mailchimp-extender' ); ?></p> |
@@ -48,7 +48,7 @@ discard block |
||
48 | 48 | <?php |
49 | 49 | } |
50 | 50 | /* MailChimp API Cleared Successfully message */ |
51 | - if( isset( $_REQUEST['transient-cleared'] ) && $_REQUEST['transient-cleared'] == 'true' ) { |
|
51 | + if ( isset( $_REQUEST[ 'transient-cleared' ] ) && $_REQUEST[ 'transient-cleared' ] == 'true' ) { |
|
52 | 52 | ?> |
53 | 53 | <div class="updated manage-form-admin-notice"> |
54 | 54 | <p><?php _e( 'MailChimp API Cache successfully cleared.', 'yikes-inc-easy-mailchimp-extender' ); ?></p> |
@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | } |
58 | 58 | /* Error Log Clear Messages */ |
59 | 59 | /* Success Messages on Options Updated */ |
60 | - if( isset( $_REQUEST['error-log-cleared'] ) && $_REQUEST['error-log-cleared'] == 'true' ) { |
|
60 | + if ( isset( $_REQUEST[ 'error-log-cleared' ] ) && $_REQUEST[ 'error-log-cleared' ] == 'true' ) { |
|
61 | 61 | ?> |
62 | 62 | <div class="updated manage-form-admin-notice"> |
63 | 63 | <p><?php _e( 'Error log successfully cleared.', 'yikes-inc-easy-mailchimp-extender' ); ?></p> |
@@ -65,7 +65,7 @@ discard block |
||
65 | 65 | <?php |
66 | 66 | } |
67 | 67 | /* MailChimp API Cleared Successfully message */ |
68 | - if( isset( $_REQUEST['error-log-cleared'] ) && $_REQUEST['error-log-cleared'] == 'false' ) { |
|
68 | + if ( isset( $_REQUEST[ 'error-log-cleared' ] ) && $_REQUEST[ 'error-log-cleared' ] == 'false' ) { |
|
69 | 69 | ?> |
70 | 70 | <div class="error manage-form-admin-notice"> |
71 | 71 | <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> |
@@ -74,28 +74,28 @@ discard block |
||
74 | 74 | } |
75 | 75 | |
76 | 76 | /* Display a success message if our error log was sucessfully created, or display an error if not */ |
77 | - if( isset( $_GET['error_log_created'] ) && $_GET['error_log_created'] == 'true' ) { |
|
77 | + if ( isset( $_GET[ 'error_log_created' ] ) && $_GET[ 'error_log_created' ] == 'true' ) { |
|
78 | 78 | ?> |
79 | 79 | <div class="updated"> |
80 | 80 | <p><?php _e( 'Error log successfully created. You may now start logging errors.', 'yikes-inc-easy-mailchimp-extender' ); ?></p> |
81 | 81 | </div> |
82 | 82 | <?php |
83 | - } else if( isset( $_GET['error_log_created'] ) && $_GET['error_log_created'] == 'false' ) { |
|
83 | + } else if ( isset( $_GET[ 'error_log_created' ] ) && $_GET[ 'error_log_created' ] == 'false' ) { |
|
84 | 84 | ?> |
85 | 85 | <div class="error"> |
86 | - <p><?php echo esc_attr( urldecode( $_GET['error_message'] ) , 'yikes-inc-easy-mailchimp-extender' ); ?></p> |
|
86 | + <p><?php echo esc_attr( urldecode( $_GET[ 'error_message' ] ), 'yikes-inc-easy-mailchimp-extender' ); ?></p> |
|
87 | 87 | </div> |
88 | 88 | <?php |
89 | 89 | } |
90 | 90 | |
91 | 91 | /* Display a success message if the user successfully imported some forms */ |
92 | - if( isset( $_GET['section'] ) && $_GET['section'] == 'import-export-forms' && isset( $_GET['import-forms'] ) && $_GET['import-forms'] == 'true' ) { |
|
92 | + if ( isset( $_GET[ 'section' ] ) && $_GET[ 'section' ] == 'import-export-forms' && isset( $_GET[ 'import-forms' ] ) && $_GET[ 'import-forms' ] == 'true' ) { |
|
93 | 93 | ?> |
94 | 94 | <div class="updated"> |
95 | 95 | <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> |
96 | 96 | </div> |
97 | 97 | <?php |
98 | - } elseif( isset( $_GET['section'] ) && $_GET['section'] == 'import-export-forms' && isset( $_GET['import-settings'] ) && $_GET['import-settings'] == 'true' ) { |
|
98 | + } elseif ( isset( $_GET[ 'section' ] ) && $_GET[ 'section' ] == 'import-export-forms' && isset( $_GET[ 'import-settings' ] ) && $_GET[ 'import-settings' ] == 'true' ) { |
|
99 | 99 | ?> |
100 | 100 | <div class="updated"> |
101 | 101 | <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> |
@@ -116,11 +116,11 @@ discard block |
||
116 | 116 | |
117 | 117 | <div class="postbox yikes-easy-mc-postbox"> |
118 | 118 | |
119 | - <?php if( !isset( $_REQUEST['section'] ) || $_REQUEST['section'] == '' ) { |
|
119 | + <?php if ( ! isset( $_REQUEST[ 'section' ] ) || $_REQUEST[ 'section' ] == '' ) { |
|
120 | 120 | include YIKES_MC_PATH . 'admin/partials/menu/options-sections/general-settings.php'; |
121 | 121 | } else { |
122 | - if( isset( $_REQUEST['addon'] ) && $_REQUEST['addon'] == 'true' ) { |
|
123 | - include apply_filters( 'yikes-mailchimp-'.$_REQUEST['section'].'-options-path' , '' ); |
|
122 | + if ( isset( $_REQUEST[ 'addon' ] ) && $_REQUEST[ 'addon' ] == 'true' ) { |
|
123 | + include apply_filters( 'yikes-mailchimp-' . $_REQUEST[ 'section' ] . '-options-path', '' ); |
|
124 | 124 | } else { |
125 | 125 | // White list a set of files that are allowed to be included here |
126 | 126 | $file_base = 'admin/partials/menu/options-sections/'; |
@@ -133,8 +133,8 @@ discard block |
||
133 | 133 | $file_base . 'recaptcha-settings.php', |
134 | 134 | ); |
135 | 135 | // Ensure the included file is allowed and whitelisted above, before including it |
136 | - if ( 0 === validate_file( 'admin/partials/menu/options-sections/' . $_REQUEST['section'] . '.php', $acceptable_files ) ) { |
|
137 | - include YIKES_MC_PATH . 'admin/partials/menu/options-sections/' . $_REQUEST['section'] . '.php'; |
|
136 | + if ( 0 === validate_file( 'admin/partials/menu/options-sections/' . $_REQUEST[ 'section' ] . '.php', $acceptable_files ) ) { |
|
137 | + include YIKES_MC_PATH . 'admin/partials/menu/options-sections/' . $_REQUEST[ 'section' ] . '.php'; |
|
138 | 138 | } else { |
139 | 139 | wp_die( esc_attr__( 'Invalid file. If this error persists, please contact support.', 'yikes-inc-easy-mailchimp' ) ); |
140 | 140 | } |
@@ -2,7 +2,10 @@ |
||
2 | 2 | /** |
3 | 3 | * Welcome Page - Knowledge Base Links |
4 | 4 | */ |
5 | -if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly |
|
5 | +if ( ! defined( 'ABSPATH' ) ) { |
|
6 | + exit; |
|
7 | +} |
|
8 | +// Exit if accessed directly |
|
6 | 9 | ?> |
7 | 10 | <div class="wrap about-wrap"> |
8 | 11 |
@@ -5,25 +5,25 @@ |
||
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 | - if ( is_string( $form_data['custom_fields'] ) ) { |
|
9 | - $field_data = json_decode( $form_data['custom_fields'] , true ); |
|
10 | - } elseif ( is_array( $form_data['custom_fields'] ) ) { |
|
11 | - $field_data = $form_data['custom_fields']; |
|
8 | + if ( is_string( $form_data[ 'custom_fields' ] ) ) { |
|
9 | + $field_data = json_decode( $form_data[ 'custom_fields' ], true ); |
|
10 | + } elseif ( is_array( $form_data[ 'custom_fields' ] ) ) { |
|
11 | + $field_data = $form_data[ 'custom_fields' ]; |
|
12 | 12 | } |
13 | 13 | ?> |
14 | 14 | <div class="custom-field-section"> |
15 | 15 | <!-- title --> |
16 | - <strong><?php echo $field['label']; ?></strong> |
|
16 | + <strong><?php echo $field[ 'label' ]; ?></strong> |
|
17 | 17 | |
18 | 18 | <!-- Dropdown --> |
19 | - <select class="custom-select-field" name="custom-field[<?php echo $field['id']; ?>]"> |
|
20 | - <?php foreach( $field['options'] as $value => $label ) { ?> |
|
21 | - <option value="<?php echo $value; ?>" <?php if( isset( $field_data[$field['id']] ) ) { selected( $field_data[$field['id']] , $value ); } ?>><?php echo $label; ?></option> |
|
19 | + <select class="custom-select-field" name="custom-field[<?php echo $field[ 'id' ]; ?>]"> |
|
20 | + <?php foreach ( $field[ 'options' ] as $value => $label ) { ?> |
|
21 | + <option value="<?php echo $value; ?>" <?php if ( isset( $field_data[ $field[ 'id' ] ] ) ) { selected( $field_data[ $field[ 'id' ] ], $value ); } ?>><?php echo $label; ?></option> |
|
22 | 22 | <?php } ?> |
23 | 23 | </select> |
24 | 24 | |
25 | 25 | <!-- description --> |
26 | - <?php if( isset( $field['description'] ) && $field['description'] != '' ) { ?> |
|
27 | - <p class="description"><?php echo $field['description']; ?></p> |
|
26 | + <?php if ( isset( $field[ 'description' ] ) && $field[ 'description' ] != '' ) { ?> |
|
27 | + <p class="description"><?php echo $field[ 'description' ]; ?></p> |
|
28 | 28 | <?php } ?> |
29 | 29 | </div> |
30 | 30 | \ No newline at end of file |