@@ -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 |
@@ -41,8 +41,8 @@ discard block |
||
41 | 41 | * Loop over all of our queries set above |
42 | 42 | * @sicne 6.0.3.8 |
43 | 43 | */ |
44 | - foreach( $kb_queries as $article_title => $rss_feed_url ) { |
|
45 | - $page = ( isset( $_GET['page'] ) ) ? $_GET['page'] : 'yikes-inc-easy-mailchimp-support'; |
|
44 | + foreach ( $kb_queries as $article_title => $rss_feed_url ) { |
|
45 | + $page = ( isset( $_GET[ 'page' ] ) ) ? $_GET[ 'page' ] : 'yikes-inc-easy-mailchimp-support'; |
|
46 | 46 | /* Create the SimplePie object */ |
47 | 47 | $article_feed = new SimplePie(); |
48 | 48 | $article_feed->enable_cache( true ); // temporary |
@@ -64,11 +64,11 @@ discard block |
||
64 | 64 | return $article_feed = new WP_Error( 'simplepie-error', $article_feed->error() ); |
65 | 65 | } |
66 | 66 | // loop over latest items |
67 | - if( $article_feed->get_items() ) { |
|
67 | + if ( $article_feed->get_items() ) { |
|
68 | 68 | ?><ul class="knowledge-base-listing"> |
69 | 69 | <li class="list-title"><?php echo $article_title; ?></li> |
70 | 70 | <?php |
71 | - foreach( $article_feed->get_items( 0, 5 ) as $kb_article ) { |
|
71 | + foreach ( $article_feed->get_items( 0, 5 ) as $kb_article ) { |
|
72 | 72 | // store the description |
73 | 73 | $description_pre_split = $kb_article->get_description(); |
74 | 74 | $kb_article_permalink = esc_url_raw( $kb_article->get_permalink() ); |
@@ -8,28 +8,28 @@ discard block |
||
8 | 8 | // grab our global form_data; |
9 | 9 | global $form_data; |
10 | 10 | ?> |
11 | - <label class="hidden-setting-label yikes-easy-mc-hidden" for="form" id=<?php esc_attr_e( $section_data['id'] ); ?>> |
|
11 | + <label class="hidden-setting-label yikes-easy-mc-hidden" for="form" id=<?php esc_attr_e( $section_data[ 'id' ] ); ?>> |
|
12 | 12 | <div id="poststuff"> |
13 | - <div id="post-body" class="metabox-holder <?php if( self::is_custom_section_two_column( $section_data ) ) { ?> columns-2 <?php } else { ?> columns-1 <?php } ?>"> |
|
13 | + <div id="post-body" class="metabox-holder <?php if ( self::is_custom_section_two_column( $section_data ) ) { ?> columns-2 <?php } else { ?> columns-1 <?php } ?>"> |
|
14 | 14 | <div id="post-body-content"> |
15 | 15 | <div class="meta-box-sortables ui-sortable"> |
16 | 16 | <div class="postbox yikes-easy-mc-postbox"> |
17 | - <h3 class="edit-form-title"><span><?php echo $section_data['main_title']; ?></span></h3> |
|
18 | - <div class="inside <?php esc_attr_e( $section_data['id'] ); ?>-container"> |
|
17 | + <h3 class="edit-form-title"><span><?php echo $section_data[ 'main_title' ]; ?></span></h3> |
|
18 | + <div class="inside <?php esc_attr_e( $section_data[ 'id' ] ); ?>-container"> |
|
19 | 19 | <?php |
20 | - if( isset( $section_data['main_description'] ) && $section_data['main_description'] != '' ) { |
|
20 | + if ( isset( $section_data[ 'main_description' ] ) && $section_data[ 'main_description' ] != '' ) { |
|
21 | 21 | ?> |
22 | - <p><?php echo $section_data['main_description']; ?></p> |
|
22 | + <p><?php echo $section_data[ 'main_description' ]; ?></p> |
|
23 | 23 | <?php |
24 | 24 | } |
25 | - $main_field_data = $section_data['main_fields']; |
|
26 | - foreach( $main_field_data as $field ) { |
|
27 | - if( $field['type'] == 'custom' ) { |
|
25 | + $main_field_data = $section_data[ 'main_fields' ]; |
|
26 | + foreach ( $main_field_data as $field ) { |
|
27 | + if ( $field[ 'type' ] == 'custom' ) { |
|
28 | 28 | // execute the custom callback |
29 | - $field['callback'](); |
|
29 | + $field[ 'callback' ](); |
|
30 | 30 | } else { |
31 | 31 | // include our field files |
32 | - include( YIKES_MC_PATH . 'admin/partials/helpers/fields/yikes-mailchimp-' . $field['type'] . '-field.php' ); |
|
32 | + include( YIKES_MC_PATH . 'admin/partials/helpers/fields/yikes-mailchimp-' . $field[ 'type' ] . '-field.php' ); |
|
33 | 33 | } |
34 | 34 | } |
35 | 35 | ?> |
@@ -39,27 +39,27 @@ discard block |
||
39 | 39 | </div> |
40 | 40 | |
41 | 41 | <!-- check for single/double box --> |
42 | - <?php if( self::is_custom_section_two_column( $section_data ) ) { ?> |
|
42 | + <?php if ( self::is_custom_section_two_column( $section_data ) ) { ?> |
|
43 | 43 | <!-- begin sidebar --> |
44 | 44 | <div id="postbox-container-1" class="postbox-container"> |
45 | 45 | <div class="meta-box-sortables"> |
46 | 46 | <div class="postbox yikes-easy-mc-postbox"> |
47 | - <h3 class="edit-form-title"><span><?php echo $section_data['sidebar_title']; ?></span></h3> |
|
48 | - <div class="inside <?php esc_attr_e( $section_data['id'] ); ?>-sidebar-container"> |
|
47 | + <h3 class="edit-form-title"><span><?php echo $section_data[ 'sidebar_title' ]; ?></span></h3> |
|
48 | + <div class="inside <?php esc_attr_e( $section_data[ 'id' ] ); ?>-sidebar-container"> |
|
49 | 49 | <?php |
50 | - if( isset( $section_data['sidebar_description'] ) && $section_data['sidebar_description'] != '' ) { |
|
50 | + if ( isset( $section_data[ 'sidebar_description' ] ) && $section_data[ 'sidebar_description' ] != '' ) { |
|
51 | 51 | ?> |
52 | - <p><?php echo $section_data['sidebar_description']; ?></p> |
|
52 | + <p><?php echo $section_data[ 'sidebar_description' ]; ?></p> |
|
53 | 53 | <?php |
54 | 54 | } |
55 | - $sidebar_field_data = $section_data['sidebar_fields']; |
|
56 | - foreach( $sidebar_field_data as $field ) { |
|
57 | - if( $field['type'] == 'custom' ) { |
|
55 | + $sidebar_field_data = $section_data[ 'sidebar_fields' ]; |
|
56 | + foreach ( $sidebar_field_data as $field ) { |
|
57 | + if ( $field[ 'type' ] == 'custom' ) { |
|
58 | 58 | // execute the custom callback |
59 | - $field['callback'](); |
|
59 | + $field[ 'callback' ](); |
|
60 | 60 | } else { |
61 | 61 | // include our field files |
62 | - include( YIKES_MC_PATH . 'admin/partials/helpers/fields/yikes-mailchimp-' . $field['type'] . '-field.php' ); |
|
62 | + include( YIKES_MC_PATH . 'admin/partials/helpers/fields/yikes-mailchimp-' . $field[ 'type' ] . '-field.php' ); |
|
63 | 63 | } |
64 | 64 | } |
65 | 65 | ?> |
@@ -14,7 +14,7 @@ discard block |
||
14 | 14 | // Widget name will appear in UI |
15 | 15 | __( 'Easy MailChimp Forms', 'yikes-inc-easy-mailchimp-extender' ), |
16 | 16 | // Widget description |
17 | - array( 'description' => __( 'MailChimp opt-in widget for your sidebar.', 'yikes-inc-easy-mailchimp-extender' ), ) |
|
17 | + array( 'description' => __( 'MailChimp opt-in widget for your sidebar.', 'yikes-inc-easy-mailchimp-extender' ),) |
|
18 | 18 | ); |
19 | 19 | |
20 | 20 | } |
@@ -27,41 +27,41 @@ discard block |
||
27 | 27 | global $wpdb; |
28 | 28 | $form_results = $wpdb->get_results( 'SELECT * FROM ' . $wpdb->prefix . 'yikes_easy_mc_forms LIMIT 1', ARRAY_A ); |
29 | 29 | |
30 | - $title = isset( $instance['title'] ) ? apply_filters( 'widget_title', $instance['title'] ) : __( 'MailChimp Signup Form', 'yikes-inc-easy-mailchimp-extender' ); |
|
31 | - $form_id = isset( $instance['form_id'] ) ? $instance['form_id'] : $form_results[0]['id']; |
|
32 | - $form_description = isset( $instance['form_description'] ) ? $instance['form_description'] : ''; |
|
33 | - $submit_button_text = isset( $instance['submit_text'] ) ? $instance['submit_text'] : __( 'Submit' , 'yikes-inc-easy-mailchimp-extender' ); |
|
30 | + $title = isset( $instance[ 'title' ] ) ? apply_filters( 'widget_title', $instance[ 'title' ] ) : __( 'MailChimp Signup Form', 'yikes-inc-easy-mailchimp-extender' ); |
|
31 | + $form_id = isset( $instance[ 'form_id' ] ) ? $instance[ 'form_id' ] : $form_results[ 0 ][ 'id' ]; |
|
32 | + $form_description = isset( $instance[ 'form_description' ] ) ? $instance[ 'form_description' ] : ''; |
|
33 | + $submit_button_text = isset( $instance[ 'submit_text' ] ) ? $instance[ 'submit_text' ] : __( 'Submit', 'yikes-inc-easy-mailchimp-extender' ); |
|
34 | 34 | |
35 | 35 | $shortcode_attributes = array(); |
36 | 36 | // Build our array based on settings chosen |
37 | - $sortcode_attributes[] = 'form="' . $form_id .'"'; |
|
37 | + $sortcode_attributes[ ] = 'form="' . $form_id . '"'; |
|
38 | 38 | // form description |
39 | - if( !empty( $form_description ) ) { |
|
40 | - $sortcode_attributes[] = 'description="1"'; |
|
39 | + if ( ! empty( $form_description ) ) { |
|
40 | + $sortcode_attributes[ ] = 'description="1"'; |
|
41 | 41 | } |
42 | 42 | // submit button text |
43 | - $sortcode_attributes[] = 'submit="' . $submit_button_text .'"'; |
|
43 | + $sortcode_attributes[ ] = 'submit="' . $submit_button_text . '"'; |
|
44 | 44 | |
45 | 45 | // before and after widget arguments are defined by themes |
46 | - echo $args['before_widget']; |
|
46 | + echo $args[ 'before_widget' ]; |
|
47 | 47 | |
48 | 48 | if ( ! empty( $title ) ) |
49 | - echo $args['before_title'] . $title . $args['after_title']; |
|
49 | + echo $args[ 'before_title' ] . $title . $args[ 'after_title' ]; |
|
50 | 50 | |
51 | 51 | // Custom action hooks to place content in the widget before the form |
52 | 52 | // See FAQ for examples on usage |
53 | - do_action( 'yikes-mailchimp-before-form-'.$form_id ); |
|
53 | + do_action( 'yikes-mailchimp-before-form-' . $form_id ); |
|
54 | 54 | do_action( 'yikes-mailchimp-before-form' ); |
55 | 55 | |
56 | 56 | // This is where you run the code and display the output |
57 | - echo do_shortcode( '[yikes-mailchimp ' . implode( ' ' , $sortcode_attributes ) . ']' ); |
|
57 | + echo do_shortcode( '[yikes-mailchimp ' . implode( ' ', $sortcode_attributes ) . ']' ); |
|
58 | 58 | |
59 | 59 | // Custom action hooks to place content in the widget after the form |
60 | 60 | // See FAQ for examples on usage |
61 | - do_action( 'yikes-mailchimp-after-form-'.$form_id ); |
|
61 | + do_action( 'yikes-mailchimp-after-form-' . $form_id ); |
|
62 | 62 | do_action( 'yikes-mailchimp-after-form' ); |
63 | 63 | |
64 | - echo $args['after_widget']; |
|
64 | + echo $args[ 'after_widget' ]; |
|
65 | 65 | |
66 | 66 | } |
67 | 67 | |
@@ -72,10 +72,10 @@ discard block |
||
72 | 72 | global $wpdb; |
73 | 73 | $form_results = $wpdb->get_results( 'SELECT * FROM ' . $wpdb->prefix . 'yikes_easy_mc_forms', ARRAY_A ); |
74 | 74 | |
75 | - if( empty( $form_results ) ) { |
|
75 | + if ( empty( $form_results ) ) { |
|
76 | 76 | ?> |
77 | 77 | <section class="no-forms-widget"> |
78 | - <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> |
|
78 | + <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> |
|
79 | 79 | </section> |
80 | 80 | <?php |
81 | 81 | return; |
@@ -102,9 +102,9 @@ discard block |
||
102 | 102 | $submit_text = __( 'Submit', 'yikes-inc-easy-mailchimp-extender' ); |
103 | 103 | } |
104 | 104 | |
105 | - if( get_option( 'yikes-mc-api-validation' , 'invalid_api_key' ) == 'invalid_api_key' ) { |
|
105 | + if ( get_option( 'yikes-mc-api-validation', 'invalid_api_key' ) == 'invalid_api_key' ) { |
|
106 | 106 | ?> |
107 | - <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> |
|
107 | + <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> |
|
108 | 108 | <?php |
109 | 109 | return; |
110 | 110 | } |
@@ -121,9 +121,9 @@ discard block |
||
121 | 121 | <select id="<?php echo $this->get_field_id( 'form_id' ); ?>" name="<?php echo $this->get_field_name( 'form_id' ); ?>" class="widefat"> |
122 | 122 | <?php |
123 | 123 | // build our array |
124 | - foreach( $form_results as $form ) { |
|
124 | + foreach ( $form_results as $form ) { |
|
125 | 125 | ?> |
126 | - <option <?php selected( $selected_form , $form['id'] ); ?> name="<?php echo $this->get_field_name( 'form_id' ); ?>" value="<?php echo $form['id']; ?>"><?php echo stripslashes( $form['form_name'] ); ?></option> |
|
126 | + <option <?php selected( $selected_form, $form[ 'id' ] ); ?> name="<?php echo $this->get_field_name( 'form_id' ); ?>" value="<?php echo $form[ 'id' ]; ?>"><?php echo stripslashes( $form[ 'form_name' ] ); ?></option> |
|
127 | 127 | <?php |
128 | 128 | } |
129 | 129 | ?> |
@@ -132,7 +132,7 @@ discard block |
||
132 | 132 | |
133 | 133 | <p> |
134 | 134 | <label for="<?php echo $this->get_field_id( 'form_description' ); ?>"><?php _e( 'Display Form Description:' ); ?></label> |
135 | - <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 ); } ?> /> |
|
135 | + <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 ); } ?> /> |
|
136 | 136 | </p> |
137 | 137 | |
138 | 138 | <p> |
@@ -145,10 +145,10 @@ discard block |
||
145 | 145 | // Updating widget replacing old instances with new |
146 | 146 | public function update( $new_instance, $old_instance ) { |
147 | 147 | $instance = array(); |
148 | - $instance['title'] = ( ! empty( $new_instance['title'] ) ) ? strip_tags( $new_instance['title'] ) : ''; |
|
149 | - $instance['form_id'] = $new_instance['form_id']; |
|
150 | - $instance['form_description'] = isset( $new_instance['form_description'] ) ? '1' : ''; |
|
151 | - $instance['submit_text'] = ( ! empty( $new_instance['submit_text'] ) ) ? strip_tags( $new_instance['submit_text'] ) : 'Submit'; |
|
148 | + $instance[ 'title' ] = ( ! empty( $new_instance[ 'title' ] ) ) ? strip_tags( $new_instance[ 'title' ] ) : ''; |
|
149 | + $instance[ 'form_id' ] = $new_instance[ 'form_id' ]; |
|
150 | + $instance[ 'form_description' ] = isset( $new_instance[ 'form_description' ] ) ? '1' : ''; |
|
151 | + $instance[ 'submit_text' ] = ( ! empty( $new_instance[ 'submit_text' ] ) ) ? strip_tags( $new_instance[ 'submit_text' ] ) : 'Submit'; |
|
152 | 152 | return $instance; |
153 | 153 | } |
154 | 154 |