@@ -4,7 +4,7 @@ discard block |
||
4 | 4 | - php version, wp version, plugin version and debug log |
5 | 5 | --> |
6 | 6 | |
7 | -<h3><span><?php _e( 'Debug Settings' , 'yikes-inc-easy-mailchimp-extender' ); ?></span></h3> |
|
7 | +<h3><span><?php _e( 'Debug Settings', 'yikes-inc-easy-mailchimp-extender' ); ?></span></h3> |
|
8 | 8 | |
9 | 9 | <div class="inside"> |
10 | 10 | |
@@ -13,10 +13,10 @@ discard block |
||
13 | 13 | |
14 | 14 | <?php settings_fields( 'yikes_inc_easy_mc_debug_settings_page' ); ?> |
15 | 15 | |
16 | - <label for="yikes-mailchimp-debug-status"><strong><?php _e( 'Enable Debugging' , 'yikes-inc-easy-mailchimp-extender' ); ?></strong> |
|
17 | - <input type="checkbox" name="yikes-mailchimp-debug-status" id="yikes-mailchimp-debug-status" value="1" <?php checked( get_option( 'yikes-mailchimp-debug-status' , '' ) , '1' ); ?>> |
|
16 | + <label for="yikes-mailchimp-debug-status"><strong><?php _e( 'Enable Debugging', 'yikes-inc-easy-mailchimp-extender' ); ?></strong> |
|
17 | + <input type="checkbox" name="yikes-mailchimp-debug-status" id="yikes-mailchimp-debug-status" value="1" <?php checked( get_option( 'yikes-mailchimp-debug-status', '' ), '1' ); ?>> |
|
18 | 18 | </label> |
19 | - <p class="description"><?php _e( "If you encounter an issue with Easy Forms for MailChimp you can toggle on debugging to display advanced error messages and start logging errors." , 'yikes-inc-easy-mailchimp-extender' ); ?></p> |
|
19 | + <p class="description"><?php _e( "If you encounter an issue with Easy Forms for MailChimp you can toggle on debugging to display advanced error messages and start logging errors.", 'yikes-inc-easy-mailchimp-extender' ); ?></p> |
|
20 | 20 | |
21 | 21 | <?php submit_button(); ?> |
22 | 22 | |
@@ -35,7 +35,7 @@ discard block |
||
35 | 35 | ) |
36 | 36 | ); |
37 | 37 | ?> |
38 | - <h2><?php _e( "Debug Log" , 'yikes-inc-easy-mailchimp-extender' ); ?> <a href="<?php echo $url; ?>" class="button-secondary"><?php _e( 'Clear Log', 'yikes-inc-easy-mailchimp-extender' ); ?></a></h2> |
|
38 | + <h2><?php _e( "Debug Log", 'yikes-inc-easy-mailchimp-extender' ); ?> <a href="<?php echo $url; ?>" class="button-secondary"><?php _e( 'Clear Log', 'yikes-inc-easy-mailchimp-extender' ); ?></a></h2> |
|
39 | 39 | |
40 | 40 | <table class="widefat" id="yikes-mailchimp-error-log"> |
41 | 41 | <!-- table header --> |
@@ -12,16 +12,16 @@ discard block |
||
12 | 12 | |
13 | 13 | ?> |
14 | 14 | |
15 | -<h3><span><?php _e( 'reCAPTCHA Settings' , 'yikes-inc-easy-mailchimp-extender' ); ?></span></h3> |
|
15 | +<h3><span><?php _e( 'reCAPTCHA Settings', 'yikes-inc-easy-mailchimp-extender' ); ?></span></h3> |
|
16 | 16 | |
17 | 17 | <div class="inside"> |
18 | 18 | |
19 | 19 | <p> |
20 | - <?php _e( 'reCAPTCHA is a free CAPTCHA service, from Google, that helps protect your site against spam, malicious registrations and other forms of attacks where computers try to disguise themselves as a human. reCAPTCHA will help prevent spammers and bots from submitting data through your MailChimp forms.' , 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
20 | + <?php _e( 'reCAPTCHA is a free CAPTCHA service, from Google, that helps protect your site against spam, malicious registrations and other forms of attacks where computers try to disguise themselves as a human. reCAPTCHA will help prevent spammers and bots from submitting data through your MailChimp forms.', 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
21 | 21 | </p> |
22 | 22 | |
23 | 23 | <p> |
24 | - <?php echo '<a href="https://www.google.com/recaptcha/admin" target="_blank" title="' . __( 'Get your reCAPTCHA API Key' , 'yikes-inc-easy-mailchimp-extender' ) . '">' . __( 'Get Your reCAPTCHA API Key' , 'yikes-inc-easy-mailchimp-extender' ) . '</a>'; ?> |
|
24 | + <?php echo '<a href="https://www.google.com/recaptcha/admin" target="_blank" title="' . __( 'Get your reCAPTCHA API Key', 'yikes-inc-easy-mailchimp-extender' ) . '">' . __( 'Get Your reCAPTCHA API Key', 'yikes-inc-easy-mailchimp-extender' ) . '</a>'; ?> |
|
25 | 25 | </p> |
26 | 26 | |
27 | 27 | <!-- Settings Form --> |
@@ -29,21 +29,21 @@ discard block |
||
29 | 29 | |
30 | 30 | <?php settings_fields( 'yikes_inc_easy_mc_recaptcha_settings_page' ); ?> |
31 | 31 | |
32 | - <label for="yikes-mc-recaptcha-setting"><strong><?php _e( 'Enable reCAPTCHA Protection' , 'yikes-inc-easy-mailchimp-extender' ); ?></strong> |
|
33 | - <input type="checkbox" name="yikes-mc-recaptcha-status" class="recaptcha-setting-checkbox" value="1" <?php checked( get_option( 'yikes-mc-recaptcha-status' , '' ) , '1' ); ?>> |
|
32 | + <label for="yikes-mc-recaptcha-setting"><strong><?php _e( 'Enable reCAPTCHA Protection', 'yikes-inc-easy-mailchimp-extender' ); ?></strong> |
|
33 | + <input type="checkbox" name="yikes-mc-recaptcha-status" class="recaptcha-setting-checkbox" value="1" <?php checked( get_option( 'yikes-mc-recaptcha-status', '' ), '1' ); ?>> |
|
34 | 34 | </label> |
35 | 35 | |
36 | - <label for="yikes-mc-recaptcha-api-key"><strong><?php _e( 'reCAPTCHA Site Key' , 'yikes-inc-easy-mailchimp-extender' ); ?></strong> |
|
37 | - <input type="text" class="widefat recaptcha-setting-checkbox" name="yikes-mc-recaptcha-site-key" value="<?php echo esc_attr( get_option( 'yikes-mc-recaptcha-site-key' , '' ) ); ?>"> |
|
36 | + <label for="yikes-mc-recaptcha-api-key"><strong><?php _e( 'reCAPTCHA Site Key', 'yikes-inc-easy-mailchimp-extender' ); ?></strong> |
|
37 | + <input type="text" class="widefat recaptcha-setting-checkbox" name="yikes-mc-recaptcha-site-key" value="<?php echo esc_attr( get_option( 'yikes-mc-recaptcha-site-key', '' ) ); ?>"> |
|
38 | 38 | </label> |
39 | 39 | |
40 | - <label for="yikes-mc-recaptcha-private-api-key"><strong><?php _e( 'reCAPTCHA Secret Key' , 'yikes-inc-easy-mailchimp-extender' ); ?></strong> |
|
41 | - <input type="text" class="widefat recaptcha-setting-checkbox" name="yikes-mc-recaptcha-secret-key" id="" value="<?php echo esc_attr( get_option( 'yikes-mc-recaptcha-secret-key' , '' ) ); ?>"> |
|
40 | + <label for="yikes-mc-recaptcha-private-api-key"><strong><?php _e( 'reCAPTCHA Secret Key', 'yikes-inc-easy-mailchimp-extender' ); ?></strong> |
|
41 | + <input type="text" class="widefat recaptcha-setting-checkbox" name="yikes-mc-recaptcha-secret-key" id="" value="<?php echo esc_attr( get_option( 'yikes-mc-recaptcha-secret-key', '' ) ); ?>"> |
|
42 | 42 | </label> |
43 | 43 | |
44 | - <a href="#" onclick="jQuery(this).next().slideToggle();return false;" class="recaptcha-preview-link"><?php _e( 'View reCAPTCHA Preview' , 'yikes-inc-easy-mailchimp-extender' ); ?></a> |
|
44 | + <a href="#" onclick="jQuery(this).next().slideToggle();return false;" class="recaptcha-preview-link"><?php _e( 'View reCAPTCHA Preview', 'yikes-inc-easy-mailchimp-extender' ); ?></a> |
|
45 | 45 | <span class="recaptcha-preview-container"> |
46 | - <img src="<?php echo YIKES_MC_URL . 'includes/images/recaptcha/recaptcha-demo.gif'; ?>" alt="<?php _e( 'reCAPTCHA Preview' , 'yikes-inc-easy-mailchimp-extender' ); ?>" class="recaptcha-demo-gif"> |
|
46 | + <img src="<?php echo YIKES_MC_URL . 'includes/images/recaptcha/recaptcha-demo.gif'; ?>" alt="<?php _e( 'reCAPTCHA Preview', 'yikes-inc-easy-mailchimp-extender' ); ?>" class="recaptcha-demo-gif"> |
|
47 | 47 | </span> |
48 | 48 | |
49 | 49 |
@@ -10,17 +10,17 @@ discard block |
||
10 | 10 | |
11 | 11 | <div id="yikes-mailchimp-logo" class="support-page"></div> |
12 | 12 | |
13 | - <h1><?php _e( 'Support' , 'yikes-inc-easy-mailchimp-extender' ); ?></h1> |
|
14 | - <strong><?php _e( "You've got questions? We have answers!" , 'yikes-inc-easy-mailchimp-extender' ); ?></strong> |
|
15 | - <?php if( get_option( 'yikes-easy-mc-active-addons' , array() ) == array() ) { ?> |
|
16 | - <p><?php _e( 'Users of the free version of YIKES Inc. Easy Forms for MailChimp are limited to two methods of support. We respond to support requests for the free version of the plugin once a week.' , 'yikes-inc-easy-mailchimp-extender' ); ?></p> |
|
17 | - <p><?php printf( __( 'Purchasers of our paid add-ons qualify for premium support, <a href="%s" target="_blank" title="' . __( 'check them out', 'yikes-inc-easy-mailchimp-extender' ) . '">' . __( 'check them out', 'yikes-inc-easy-mailchimp-extender' ) . '</a>!' , 'yikes-inc-easy-mailchimp-extender' ), esc_url( 'https://yikesplugins.com/' ) ); ?></p> |
|
13 | + <h1><?php _e( 'Support', 'yikes-inc-easy-mailchimp-extender' ); ?></h1> |
|
14 | + <strong><?php _e( "You've got questions? We have answers!", 'yikes-inc-easy-mailchimp-extender' ); ?></strong> |
|
15 | + <?php if ( get_option( 'yikes-easy-mc-active-addons', array() ) == array() ) { ?> |
|
16 | + <p><?php _e( 'Users of the free version of YIKES Inc. Easy Forms for MailChimp are limited to two methods of support. We respond to support requests for the free version of the plugin once a week.', 'yikes-inc-easy-mailchimp-extender' ); ?></p> |
|
17 | + <p><?php printf( __( 'Purchasers of our paid add-ons qualify for premium support, <a href="%s" target="_blank" title="' . __( 'check them out', 'yikes-inc-easy-mailchimp-extender' ) . '">' . __( 'check them out', 'yikes-inc-easy-mailchimp-extender' ) . '</a>!', 'yikes-inc-easy-mailchimp-extender' ), esc_url( 'https://yikesplugins.com/' ) ); ?></p> |
|
18 | 18 | <?php } else { ?> |
19 | - <p><?php _e( "It looks like you are one of our premium users! Fill out the form below to submit a priority support request." , 'yikes-inc-easy-mailchimp-extender' ); ?></p> |
|
20 | - <p><?php _e( "If you have any problems with the form, send an email to <a href='mailto:[email protected]'>[email protected]</a> and a ticket will be created." , 'yikes-inc-easy-mailchimp-extender' ); ?></p> |
|
19 | + <p><?php _e( "It looks like you are one of our premium users! Fill out the form below to submit a priority support request.", 'yikes-inc-easy-mailchimp-extender' ); ?></p> |
|
20 | + <p><?php _e( "If you have any problems with the form, send an email to <a href='mailto:[email protected]'>[email protected]</a> and a ticket will be created.", 'yikes-inc-easy-mailchimp-extender' ); ?></p> |
|
21 | 21 | <?php } ?> |
22 | 22 | |
23 | - <p><?php printf( __( 'Before submitting a support request, visit our %s.' , 'yikes-inc-easy-mailchimp-extender' ), '<a target="_blank" href="' . esc_url( 'https://yikesplugins.com/support/knowledge-base/product/easy-forms-for-mailchimp/' ) . '" title="' . __( 'Knowledge Base', 'yikes-inc-easy-mailchimp-extender' ) . '">' . __( 'knowledge base', 'yikes-inc-easy-mailchimp-extender' ) . '</a> where we have step-by-step guides and troubleshooting help.' ); ?></p> |
|
23 | + <p><?php printf( __( 'Before submitting a support request, visit our %s.', 'yikes-inc-easy-mailchimp-extender' ), '<a target="_blank" href="' . esc_url( 'https://yikesplugins.com/support/knowledge-base/product/easy-forms-for-mailchimp/' ) . '" title="' . __( 'Knowledge Base', 'yikes-inc-easy-mailchimp-extender' ) . '">' . __( 'knowledge base', 'yikes-inc-easy-mailchimp-extender' ) . '</a> where we have step-by-step guides and troubleshooting help.' ); ?></p> |
|
24 | 24 | |
25 | 25 | <hr /> |
26 | 26 | |
@@ -29,10 +29,10 @@ discard block |
||
29 | 29 | <div id="col-right"> |
30 | 30 | |
31 | 31 | <div class="col-wrap"> |
32 | - <h1><span class="github-octocat"></span><?php _e( 'Github Issue Tracker' , 'yikes-inc-easy-mailchimp-extender' ); ?></h1> |
|
32 | + <h1><span class="github-octocat"></span><?php _e( 'Github Issue Tracker', 'yikes-inc-easy-mailchimp-extender' ); ?></h1> |
|
33 | 33 | <div class="inside"> |
34 | 34 | <p><?php _e( 'The fastest way to receive free support is to submit a new issue to our GitHub issue tracker. ', 'yikes-inc-easy-mailchimp-extender' ); ?></p> |
35 | - <img class="support-page-logo" src="<?php echo YIKES_MC_URL; ?>includes/images/Support_Page/github-issue-screenshot.png" title="<?php esc_attr_e( 'Github Issue Tracker Screenshot' , 'yikes-inc-easy-mailchimp-extender' ); ?>" > |
|
35 | + <img class="support-page-logo" src="<?php echo YIKES_MC_URL; ?>includes/images/Support_Page/github-issue-screenshot.png" title="<?php esc_attr_e( 'Github Issue Tracker Screenshot', 'yikes-inc-easy-mailchimp-extender' ); ?>" > |
|
36 | 36 | <a href="https://github.com/yikesinc/yikes-inc-easy-mailchimp-extender/issues" target="_blank" class="button-secondary support-page-button"><?php _e( 'Submit New github.org Issue', 'yikes-inc-easy-mailchimp-extender' ); ?></a> |
37 | 37 | </div> |
38 | 38 | </div> |
@@ -44,10 +44,10 @@ discard block |
||
44 | 44 | <div id="col-left"> |
45 | 45 | |
46 | 46 | <div class="col-wrap"> |
47 | - <h1><span class="dashicons dashicons-wordpress-alt support-page-wordpress-font"></span> <?php _e( 'WordPress.org Plugin Directory' , 'yikes-inc-easy-mailchimp-extender' ); ?></h1> |
|
47 | + <h1><span class="dashicons dashicons-wordpress-alt support-page-wordpress-font"></span> <?php _e( 'WordPress.org Plugin Directory', 'yikes-inc-easy-mailchimp-extender' ); ?></h1> |
|
48 | 48 | <div class="inside"> |
49 | 49 | <p><?php _e( 'Use your WordPress.org username to submit support requests on the WordPress Directory support forum.', 'yikes-inc-easy-mailchimp-extender' ); ?></p> |
50 | - <img class="support-page-logo" src="<?php echo YIKES_MC_URL; ?>includes/images/Support_Page/wordpress-issue-screenshot.png" title="<?php esc_attr_e( 'WordPress.org Issue Tracker Screenshot' , 'yikes-inc-easy-mailchimp-extender' ); ?>" > |
|
50 | + <img class="support-page-logo" src="<?php echo YIKES_MC_URL; ?>includes/images/Support_Page/wordpress-issue-screenshot.png" title="<?php esc_attr_e( 'WordPress.org Issue Tracker Screenshot', 'yikes-inc-easy-mailchimp-extender' ); ?>" > |
|
51 | 51 | <a href="https://wordpress.org/support/plugin/yikes-inc-easy-mailchimp-extender" target="_blank" class="button-secondary support-page-button"><?php _e( 'Submit New WordPress.org Support Request', 'yikes-inc-easy-mailchimp-extender' ); ?></a> |
52 | 52 | </div> |
53 | 53 | </div> |
@@ -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 |
@@ -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 | ?> |
@@ -23,7 +23,7 @@ discard block |
||
23 | 23 | <?php |
24 | 24 | } |
25 | 25 | $main_field_data = $section_data['main_fields']; |
26 | - foreach( $main_field_data as $field ) { |
|
26 | + foreach( $main_field_data as $field ) { |
|
27 | 27 | if( $field['type'] == 'custom' ) { |
28 | 28 | // execute the custom callback |
29 | 29 | $field['callback'](); |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | <?php |
54 | 54 | } |
55 | 55 | $sidebar_field_data = $section_data['sidebar_fields']; |
56 | - foreach( $sidebar_field_data as $field ) { |
|
56 | + foreach( $sidebar_field_data as $field ) { |
|
57 | 57 | if( $field['type'] == 'custom' ) { |
58 | 58 | // execute the custom callback |
59 | 59 | $field['callback'](); |
@@ -9,30 +9,30 @@ discard block |
||
9 | 9 | */ |
10 | 10 | |
11 | 11 | // enqueue the styles for our migration page.. |
12 | - wp_enqueue_style( 'yikes_mc_migrate_option_styles' , YIKES_MC_URL . 'admin/css/yikes-inc-easy-mailchimp-migrate-option-styles.css' ); |
|
13 | - wp_enqueue_style( 'animate-css' , YIKES_MC_URL . 'admin/css/animate.min.css' ); |
|
12 | + wp_enqueue_style( 'yikes_mc_migrate_option_styles', YIKES_MC_URL . 'admin/css/yikes-inc-easy-mailchimp-migrate-option-styles.css' ); |
|
13 | + wp_enqueue_style( 'animate-css', YIKES_MC_URL . 'admin/css/animate.min.css' ); |
|
14 | 14 | |
15 | 15 | // store our old options |
16 | 16 | $old_plugin_options = get_option( 'ykseme_storage' ); |
17 | 17 | |
18 | 18 | $global_error_messages = array( |
19 | - 'success' => __( $old_plugin_options['single-optin-message'] , 'yikes-inc-easy-mailchimp-extender' ), |
|
20 | - 'general-error' => __( "Whoops! It looks like something went wrong. Please try again." , 'yikes-inc-easy-mailchimp-extender' ), |
|
21 | - 'invalid-email' => __( "Please provide a valid email address." , 'yikes-inc-easy-mailchimp-extender' ), |
|
22 | - 'email-exists-error' => __( "The provided email is already subscribed to this list." , 'yikes-inc-easy-mailchimp-extender' ) |
|
19 | + 'success' => __( $old_plugin_options[ 'single-optin-message' ], 'yikes-inc-easy-mailchimp-extender' ), |
|
20 | + 'general-error' => __( "Whoops! It looks like something went wrong. Please try again.", 'yikes-inc-easy-mailchimp-extender' ), |
|
21 | + 'invalid-email' => __( "Please provide a valid email address.", 'yikes-inc-easy-mailchimp-extender' ), |
|
22 | + 'email-exists-error' => __( "The provided email is already subscribed to this list.", 'yikes-inc-easy-mailchimp-extender' ) |
|
23 | 23 | ); |
24 | 24 | |
25 | 25 | // if old options are defined... |
26 | - if( $old_plugin_options ) { |
|
26 | + if ( $old_plugin_options ) { |
|
27 | 27 | |
28 | 28 | // Verify the NONCE is valid |
29 | - check_admin_referer( 'yikes-mc-migrate-options' , 'migrate_options_nonce' ); |
|
29 | + check_admin_referer( 'yikes-mc-migrate-options', 'migrate_options_nonce' ); |
|
30 | 30 | |
31 | 31 | ?> |
32 | 32 | |
33 | 33 | <div class="wrap" style="text-align:center;"> |
34 | - <h3><?php _e( 'Migrating old plugin options' , 'yikes-inc-easy-mailchimp-extender' ); ?><span class="upgrading-ellipse-one">.</span><span class="upgrading-ellipse-two">.</span><span class="upgrading-ellipse-three">.</h3> |
|
35 | - <p><?php _e( 'please be patient while your options are updated and the process has completed' , 'yikes-inc-easy-mailchimp-extender' ); ?></p> |
|
34 | + <h3><?php _e( 'Migrating old plugin options', 'yikes-inc-easy-mailchimp-extender' ); ?><span class="upgrading-ellipse-one">.</span><span class="upgrading-ellipse-two">.</span><span class="upgrading-ellipse-three">.</h3> |
|
35 | + <p><?php _e( 'please be patient while your options are updated and the process has completed', 'yikes-inc-easy-mailchimp-extender' ); ?></p> |
|
36 | 36 | <!-- empty list, populate when options get updated --> |
37 | 37 | <ul id="options-updated" class="yikes-easy-mc-hidden"> |
38 | 38 | <hr /> |
@@ -46,82 +46,82 @@ discard block |
||
46 | 46 | |
47 | 47 | // loop over our old options, and store them in a new option value |
48 | 48 | $do_not_migrate_options = array( |
49 | - 'ssl_verify_peer', 'api_validation' , 'widget_yikes_mc_widget' , 'flavor' , 'single-optin-message' , 'double-optin-message' , |
|
50 | - 'mailchimp-optIn-default-list' , 'version' , 'yks-mailchimp-jquery-datepicker' , 'ssl_verify_peer' , 'optIn-checkbox' , 'yks-mailchimp-optin-checkbox-text', |
|
51 | - 'yks-mailchimp-required-text' , 'optin' |
|
49 | + 'ssl_verify_peer', 'api_validation', 'widget_yikes_mc_widget', 'flavor', 'single-optin-message', 'double-optin-message', |
|
50 | + 'mailchimp-optIn-default-list', 'version', 'yks-mailchimp-jquery-datepicker', 'ssl_verify_peer', 'optIn-checkbox', 'yks-mailchimp-optin-checkbox-text', |
|
51 | + 'yks-mailchimp-required-text', 'optin' |
|
52 | 52 | ); |
53 | 53 | |
54 | - foreach( $old_plugin_options as $option_name => $option_value ) { |
|
54 | + foreach ( $old_plugin_options as $option_name => $option_value ) { |
|
55 | 55 | |
56 | - if( ! in_array( $option_name , $do_not_migrate_options ) ) { |
|
56 | + if ( ! in_array( $option_name, $do_not_migrate_options ) ) { |
|
57 | 57 | // ajax request to update our options one by one.. |
58 | 58 | // if its an array, we need to json encode it |
59 | - if( is_array( $option_value ) ) { |
|
59 | + if ( is_array( $option_value ) ) { |
|
60 | 60 | |
61 | - if( $option_name == 'lists' ) { |
|
61 | + if ( $option_name == 'lists' ) { |
|
62 | 62 | |
63 | - if( ! empty( $option_value ) ) { |
|
63 | + if ( ! empty( $option_value ) ) { |
|
64 | 64 | $settings = 1; |
65 | 65 | $form_length = count( $option_value ); |
66 | - foreach( $option_value as $mailchimp_form ) { |
|
66 | + foreach ( $option_value as $mailchimp_form ) { |
|
67 | 67 | // update and pass our placeholder value |
68 | 68 | reset( $mailchimp_form ); |
69 | - $form_id = $mailchimp_form['id']; |
|
69 | + $form_id = $mailchimp_form[ 'id' ]; |
|
70 | 70 | |
71 | - $fields = $mailchimp_form['fields']; |
|
71 | + $fields = $mailchimp_form[ 'fields' ]; |
|
72 | 72 | reset( $fields ); |
73 | 73 | $first_field_key = key( $fields ); |
74 | 74 | $array_keys = array_keys( $fields ); |
75 | 75 | |
76 | 76 | $x = 1; |
77 | 77 | |
78 | - foreach( $array_keys as $parent_key ) { |
|
78 | + foreach ( $array_keys as $parent_key ) { |
|
79 | 79 | |
80 | 80 | // alter the field keys so they show up after an import |
81 | 81 | $split_parent_key = explode( '-', $parent_key ); |
82 | 82 | |
83 | - $new_parent_key = ( isset( $split_parent_key[1] ) ) ? strtoupper( $split_parent_key[1] ) : $parent_key; |
|
83 | + $new_parent_key = ( isset( $split_parent_key[ 1 ] ) ) ? strtoupper( $split_parent_key[ 1 ] ) : $parent_key; |
|
84 | 84 | |
85 | - $mailchimp_form['fields'][$new_parent_key] = $mailchimp_form['fields'][$parent_key]; |
|
85 | + $mailchimp_form[ 'fields' ][ $new_parent_key ] = $mailchimp_form[ 'fields' ][ $parent_key ]; |
|
86 | 86 | |
87 | - unset( $mailchimp_form['fields'][$parent_key] ); |
|
87 | + unset( $mailchimp_form[ 'fields' ][ $parent_key ] ); |
|
88 | 88 | |
89 | 89 | // update our placeholder key to be 'placeholder' |
90 | - $mailchimp_form['fields'][$new_parent_key]['placeholder'] = isset( $mailchimp_form['fields'][$new_parent_key]['placeholder-'.$form_id.'-'.$x] ) ? $mailchimp_form['fields'][$new_parent_key]['placeholder-'.$form_id.'-'.$x] : ''; |
|
90 | + $mailchimp_form[ 'fields' ][ $new_parent_key ][ 'placeholder' ] = isset( $mailchimp_form[ 'fields' ][ $new_parent_key ][ 'placeholder-' . $form_id . '-' . $x ] ) ? $mailchimp_form[ 'fields' ][ $new_parent_key ][ 'placeholder-' . $form_id . '-' . $x ] : ''; |
|
91 | 91 | // update field classes |
92 | - $mailchimp_form['fields'][$new_parent_key]['additional-classes'] = isset( $mailchimp_form['fields'][$new_parent_key]['custom-field-class-'.$form_id.'-'.$x] ) ? $mailchimp_form['fields'][$new_parent_key]['custom-field-class-'.$form_id.'-'.$x] : ''; |
|
92 | + $mailchimp_form[ 'fields' ][ $new_parent_key ][ 'additional-classes' ] = isset( $mailchimp_form[ 'fields' ][ $new_parent_key ][ 'custom-field-class-' . $form_id . '-' . $x ] ) ? $mailchimp_form[ 'fields' ][ $new_parent_key ][ 'custom-field-class-' . $form_id . '-' . $x ] : ''; |
|
93 | 93 | // update help field - populate description |
94 | - $mailchimp_form['fields'][$new_parent_key]['description'] = isset( $mailchimp_form['fields'][$new_parent_key]['help'] ) ? $mailchimp_form['fields'][$new_parent_key]['help'] : ''; |
|
94 | + $mailchimp_form[ 'fields' ][ $new_parent_key ][ 'description' ] = isset( $mailchimp_form[ 'fields' ][ $new_parent_key ][ 'help' ] ) ? $mailchimp_form[ 'fields' ][ $new_parent_key ][ 'help' ] : ''; |
|
95 | 95 | // remove the old placeholder structure |
96 | - unset( $mailchimp_form['fields'][$new_parent_key]['placeholder-'.$form_id.'-'.$x] ); |
|
96 | + unset( $mailchimp_form[ 'fields' ][ $new_parent_key ][ 'placeholder-' . $form_id . '-' . $x ] ); |
|
97 | 97 | // remove old custom class structure |
98 | - unset( $mailchimp_form['fields'][$new_parent_key]['custom-field-class-'.$form_id.'-'.$x] ); |
|
98 | + unset( $mailchimp_form[ 'fields' ][ $new_parent_key ][ 'custom-field-class-' . $form_id . '-' . $x ] ); |
|
99 | 99 | // remove old help/description |
100 | - unset( $mailchimp_form['fields'][$new_parent_key]['help'] ); |
|
100 | + unset( $mailchimp_form[ 'fields' ][ $new_parent_key ][ 'help' ] ); |
|
101 | 101 | |
102 | 102 | // check if choices is set, and encode them |
103 | - if( isset( $mailchimp_form['fields'][$new_parent_key]['choices'] ) && ! empty( $mailchimp_form['fields'][$new_parent_key]['choices'] ) ) { |
|
104 | - $mailchimp_form['fields'][$new_parent_key]['choices'] = addslashes( addslashes( json_encode( $mailchimp_form['fields'][$new_parent_key]['choices'] ) ) ); |
|
103 | + if ( isset( $mailchimp_form[ 'fields' ][ $new_parent_key ][ 'choices' ] ) && ! empty( $mailchimp_form[ 'fields' ][ $new_parent_key ][ 'choices' ] ) ) { |
|
104 | + $mailchimp_form[ 'fields' ][ $new_parent_key ][ 'choices' ] = addslashes( addslashes( json_encode( $mailchimp_form[ 'fields' ][ $new_parent_key ][ 'choices' ] ) ) ); |
|
105 | 105 | } |
106 | 106 | |
107 | 107 | // update 'default' to 'default-choice' for radio/dropdown |
108 | - if( isset( $mailchimp_form['fields'][$new_parent_key]['type'] ) && in_array( $mailchimp_form['fields'][$new_parent_key]['type'], array( 'radio', 'dropdown' ) ) ) { |
|
109 | - $mailchimp_form['fields'][$new_parent_key]['default_choice'] = $mailchimp_form['fields'][$new_parent_key]['default']; |
|
110 | - unset( $mailchimp_form['fields'][$new_parent_key]['default'] ); |
|
108 | + if ( isset( $mailchimp_form[ 'fields' ][ $new_parent_key ][ 'type' ] ) && in_array( $mailchimp_form[ 'fields' ][ $new_parent_key ][ 'type' ], array( 'radio', 'dropdown' ) ) ) { |
|
109 | + $mailchimp_form[ 'fields' ][ $new_parent_key ][ 'default_choice' ] = $mailchimp_form[ 'fields' ][ $new_parent_key ][ 'default' ]; |
|
110 | + unset( $mailchimp_form[ 'fields' ][ $new_parent_key ][ 'default' ] ); |
|
111 | 111 | } |
112 | 112 | |
113 | 113 | // update 'date_format' on 'birthday' and 'date' fields |
114 | - if( isset( $mailchimp_form['fields'][$new_parent_key]['type'] ) && in_array( $mailchimp_form['fields'][$new_parent_key]['type'], array( 'date', 'birthday' ) ) ) { |
|
115 | - if( $mailchimp_form['fields'][$new_parent_key]['type'] == 'date' ) { // date |
|
116 | - $mailchimp_form['fields'][$new_parent_key]['date_format'] = 'MM/DD'; // mailchimp default (can be altered) |
|
114 | + if ( isset( $mailchimp_form[ 'fields' ][ $new_parent_key ][ 'type' ] ) && in_array( $mailchimp_form[ 'fields' ][ $new_parent_key ][ 'type' ], array( 'date', 'birthday' ) ) ) { |
|
115 | + if ( $mailchimp_form[ 'fields' ][ $new_parent_key ][ 'type' ] == 'date' ) { // date |
|
116 | + $mailchimp_form[ 'fields' ][ $new_parent_key ][ 'date_format' ] = 'MM/DD'; // mailchimp default (can be altered) |
|
117 | 117 | } else { // birthday |
118 | - $mailchimp_form['fields'][$new_parent_key]['date_format'] = 'MM/DD/YYYY'; // mailchimp default (can be altered) |
|
118 | + $mailchimp_form[ 'fields' ][ $new_parent_key ][ 'date_format' ] = 'MM/DD/YYYY'; // mailchimp default (can be altered) |
|
119 | 119 | } |
120 | 120 | } |
121 | 121 | |
122 | 122 | // update 'phone_format' on 'phone' |
123 | - if( isset( $mailchimp_form['fields'][$new_parent_key]['type'] ) && in_array( $mailchimp_form['fields'][$new_parent_key]['type'], array( 'phone' ) ) ) { |
|
124 | - $mailchimp_form['fields'][$new_parent_key]['phone_format'] = 'phone_format '; // phone format |
|
123 | + if ( isset( $mailchimp_form[ 'fields' ][ $new_parent_key ][ 'type' ] ) && in_array( $mailchimp_form[ 'fields' ][ $new_parent_key ][ 'type' ], array( 'phone' ) ) ) { |
|
124 | + $mailchimp_form[ 'fields' ][ $new_parent_key ][ 'phone_format' ] = 'phone_format '; // phone format |
|
125 | 125 | } |
126 | 126 | |
127 | 127 | $x++; |
@@ -138,7 +138,7 @@ discard block |
||
138 | 138 | |
139 | 139 | $.post( ajaxurl, mc_data, function(response) { |
140 | 140 | jQuery( '#options-updated' ).show(); |
141 | - jQuery( '#options-updated' ).append( '<li class="animated fadeInDown"><?php echo '<strong>'; ?>' + response.form_name + '<?php echo '</strong> ' . __( "successfully imported." , 'yikes-inc-easy-mailchimp-extender' ); ?></li>' ); |
|
141 | + jQuery( '#options-updated' ).append( '<li class="animated fadeInDown"><?php echo '<strong>'; ?>' + response.form_name + '<?php echo '</strong> ' . __( "successfully imported.", 'yikes-inc-easy-mailchimp-extender' ); ?></li>' ); |
|
142 | 142 | if( response.completed_import ) { |
143 | 143 | setTimeout( function() { |
144 | 144 | // finished with the loop...lets let the user know....and then redirect them.... |
@@ -147,13 +147,13 @@ discard block |
||
147 | 147 | jQuery( '.upgrading-ellipse-two' ).remove(); |
148 | 148 | jQuery( '.upgrading-ellipse-three' ).remove(); |
149 | 149 | jQuery( '.wrap' ).find( 'h3' ).next().fadeOut(); |
150 | - jQuery( '#options-updated' ).append( '<li class="animated fadeInDown migration-complete-notification"><em><?php _e( "Migration Complete. Please wait..." , 'yikes-inc-easy-mailchimp-extender' ); ?> </em> <img src="<?php echo esc_url_raw( admin_url( "images/wpspin_light.gif" ) ); ?>" /></li>' ); |
|
150 | + jQuery( '#options-updated' ).append( '<li class="animated fadeInDown migration-complete-notification"><em><?php _e( "Migration Complete. Please wait...", 'yikes-inc-easy-mailchimp-extender' ); ?> </em> <img src="<?php echo esc_url_raw( admin_url( "images/wpspin_light.gif" ) ); ?>" /></li>' ); |
|
151 | 151 | // redirect our user to the main plugin page... |
152 | 152 | setTimeout( function() { |
153 | 153 | <?php |
154 | 154 | // migrate options that didnt make it (they were never stored in the 'ykseme_storage' options array) |
155 | - add_option( 'yikes-mc-api-validation' , get_option( 'api_validation' , 'invalid_api_key' ) ); |
|
156 | - add_option( 'yikes-mc-error-messages' , $global_error_messages ); |
|
155 | + add_option( 'yikes-mc-api-validation', get_option( 'api_validation', 'invalid_api_key' ) ); |
|
156 | + add_option( 'yikes-mc-error-messages', $global_error_messages ); |
|
157 | 157 | // delete our old options after a successful migration (and some new ones that are no longer needed) |
158 | 158 | delete_option( 'widget_yikes_mc_widget' ); |
159 | 159 | delete_option( 'api_validation' ); |
@@ -174,26 +174,26 @@ discard block |
||
174 | 174 | } |
175 | 175 | /* Rename our ReCaptcha Options */ |
176 | 176 | /* Public Site Key */ |
177 | - if( $option_name == 'recaptcha-api-key' ) { |
|
177 | + if ( $option_name == 'recaptcha-api-key' ) { |
|
178 | 178 | $option_name = 'recaptcha-site-key'; |
179 | 179 | } |
180 | 180 | /* Private Key */ |
181 | - if( $option_name == 'recaptcha-private-api-key' ) { |
|
181 | + if ( $option_name == 'recaptcha-private-api-key' ) { |
|
182 | 182 | $option_name = 'recaptcha-secret-key'; |
183 | 183 | } |
184 | 184 | /* Change 'recaptcha-setting' to 'recaptcha-status' */ |
185 | 185 | /* Status */ |
186 | - if( $option_name == 'recaptcha-setting' ) { |
|
186 | + if ( $option_name == 'recaptcha-setting' ) { |
|
187 | 187 | $option_name = 'recaptcha-status'; |
188 | 188 | } |
189 | 189 | /* End re-name ReCaptcha options */ |
190 | 190 | |
191 | 191 | |
192 | - if( is_array( $option_value ) ) { |
|
192 | + if ( is_array( $option_value ) ) { |
|
193 | 193 | $option_value = json_encode( $option_value ); |
194 | 194 | } |
195 | 195 | // do noit migrate the lists option, it's not useful to us |
196 | - if( $option_name != 'lists' ) { |
|
196 | + if ( $option_name != 'lists' ) { |
|
197 | 197 | ?> |
198 | 198 | var data = { |
199 | 199 | 'action': 'migrate_old_plugin_settings', |
@@ -203,7 +203,7 @@ discard block |
||
203 | 203 | |
204 | 204 | $.post( ajaxurl, data, function(response) { |
205 | 205 | jQuery( '#options-updated' ).show(); |
206 | - jQuery( '#options-updated' ).append( '<li class="animated fadeInDown"><?php echo '<strong>' . ucwords( str_replace( '_' , ' ' , str_replace( '-' , ' ' , $option_name ) ) ) . '</strong> ' . __( "successfully imported." , 'yikes-inc-easy-mailchimp-extender' ); ?></li>' ); |
|
206 | + jQuery( '#options-updated' ).append( '<li class="animated fadeInDown"><?php echo '<strong>' . ucwords( str_replace( '_', ' ', str_replace( '-', ' ', $option_name ) ) ) . '</strong> ' . __( "successfully imported.", 'yikes-inc-easy-mailchimp-extender' ); ?></li>' ); |
|
207 | 207 | }); |
208 | 208 | <?php |
209 | 209 | |
@@ -227,7 +227,7 @@ discard block |
||
227 | 227 | }, 2000 ); |
228 | 228 | </script> |
229 | 229 | <?php |
230 | - wp_die( '<strong>' . __( 'Old plugin options do not exist. Redirecting you...' , 'yikes-inc-easy-mailchimp-extender' ) . '</strong>' , 500 ); |
|
230 | + wp_die( '<strong>' . __( 'Old plugin options do not exist. Redirecting you...', 'yikes-inc-easy-mailchimp-extender' ) . '</strong>', 500 ); |
|
231 | 231 | ?> |
232 | 232 | </div> |
233 | 233 | <?php |
@@ -112,9 +112,11 @@ |
||
112 | 112 | |
113 | 113 | // update 'date_format' on 'birthday' and 'date' fields |
114 | 114 | if( isset( $mailchimp_form['fields'][$new_parent_key]['type'] ) && in_array( $mailchimp_form['fields'][$new_parent_key]['type'], array( 'date', 'birthday' ) ) ) { |
115 | - if( $mailchimp_form['fields'][$new_parent_key]['type'] == 'date' ) { // date |
|
115 | + if( $mailchimp_form['fields'][$new_parent_key]['type'] == 'date' ) { |
|
116 | +// date |
|
116 | 117 | $mailchimp_form['fields'][$new_parent_key]['date_format'] = 'MM/DD'; // mailchimp default (can be altered) |
117 | - } else { // birthday |
|
118 | + } else { |
|
119 | +// birthday |
|
118 | 120 | $mailchimp_form['fields'][$new_parent_key]['date_format'] = 'MM/DD/YYYY'; // mailchimp default (can be altered) |
119 | 121 | } |
120 | 122 | } |
@@ -162,9 +162,9 @@ discard block |
||
162 | 162 | } |
163 | 163 | |
164 | 164 | /** |
165 | - * If login is required, abort |
|
166 | - * @since 6.0.3.8 |
|
167 | - */ |
|
165 | + * If login is required, abort |
|
166 | + * @since 6.0.3.8 |
|
167 | + */ |
|
168 | 168 | if( $form_login_required ) { |
169 | 169 | if( apply_filters( 'yikes-mailchimp-required-login-requirement', ! is_user_logged_in() ) ) { |
170 | 170 | ob_start(); |
@@ -179,9 +179,9 @@ discard block |
||
179 | 179 | } |
180 | 180 | |
181 | 181 | /** |
182 | - * Check if schedule is set for this form |
|
183 | - * @since 6.0.3.8 |
|
184 | - */ |
|
182 | + * Check if schedule is set for this form |
|
183 | + * @since 6.0.3.8 |
|
184 | + */ |
|
185 | 185 | if( $form_schedule_state ) { |
186 | 186 | // store current date |
187 | 187 | $current_date = strtotime( current_time( 'm/d/Y g:iA' ) ); |
@@ -234,8 +234,8 @@ discard block |
||
234 | 234 | } |
235 | 235 | |
236 | 236 | /** |
237 | - * Check for form inline parameter |
|
238 | - */ |
|
237 | + * Check for form inline parameter |
|
238 | + */ |
|
239 | 239 | $form_inline = ( isset( $atts['inline'] ) && ( $atts['inline'] == 1 || $atts['inline'] == 'true' ) ) ? true : false; |
240 | 240 | // recheck from our form options |
241 | 241 | if( ! $form_inline ) { |
@@ -720,7 +720,7 @@ discard block |
||
720 | 720 | } else { |
721 | 721 | $zip_value_to_echo = $_POST[$field['merge']]; |
722 | 722 | } |
723 | - } else { |
|
723 | + } else { |
|
724 | 724 | $zip_value_to_echo = esc_attr( $default_value ); |
725 | 725 | } |
726 | 726 | ?> |
@@ -994,7 +994,8 @@ discard block |
||
994 | 994 | |
995 | 995 | } |
996 | 996 | |
997 | - } else { // loop over interest groups |
|
997 | + } else { |
|
998 | +// loop over interest groups |
|
998 | 999 | |
999 | 1000 | |
1000 | 1001 | // store default choice |
@@ -30,54 +30,54 @@ discard block |
||
30 | 30 | $form_submitted = isset( $form_submitted ) ? $form_submitted : 0; |
31 | 31 | |
32 | 32 | /* If the user hasn't authenticated yet, lets kill off */ |
33 | - if( get_option( 'yikes-mc-api-validation' , 'invalid_api_key' ) != 'valid_api_key' ) { |
|
34 | - return '<div class="invalid-api-key-error"><p>' . __( "Whoops, you're not connected to MailChimp. You need to enter a valid MailChimp API key." , 'yikes-inc-easy-mailchimp-extender' ) . '</p></div>'; |
|
33 | + if ( get_option( 'yikes-mc-api-validation', 'invalid_api_key' ) != 'valid_api_key' ) { |
|
34 | + return '<div class="invalid-api-key-error"><p>' . __( "Whoops, you're not connected to MailChimp. You need to enter a valid MailChimp API key.", 'yikes-inc-easy-mailchimp-extender' ) . '</p></div>'; |
|
35 | 35 | } |
36 | 36 | |
37 | 37 | // if the user forgot to specify a form ID, lets kill of and warn them. |
38 | - if( ! $atts['form'] ) { |
|
38 | + if ( ! $atts[ 'form' ] ) { |
|
39 | 39 | return __( 'Whoops, it looks like you forgot to specify a form to display.', 'yikes-inc-easy-mailchimp-extender' ); |
40 | 40 | } |
41 | 41 | |
42 | 42 | // store our variables |
43 | - $form_id = (int) $atts['form']; // form id (the id of the form in the database) |
|
43 | + $form_id = (int) $atts[ 'form' ]; // form id (the id of the form in the database) |
|
44 | 44 | $interface = yikes_easy_mailchimp_extender_get_form_interface(); |
45 | 45 | $form_data = $interface->get_form( $form_id ); |
46 | 46 | |
47 | 47 | // confirm we have some results, or return an error |
48 | 48 | if ( empty( $form_data ) ) { |
49 | - return __( "Oh no...This form doesn't exist. Head back to the manage forms page and select a different form." , 'yikes-inc-easy-mailchimp-extender' ); |
|
49 | + return __( "Oh no...This form doesn't exist. Head back to the manage forms page and select a different form.", 'yikes-inc-easy-mailchimp-extender' ); |
|
50 | 50 | } |
51 | 51 | |
52 | 52 | /* |
53 | 53 | * Check if the user wants to use reCAPTCHA Spam Prevention |
54 | 54 | */ |
55 | - if ( get_option( 'yikes-mc-recaptcha-status' , '' ) == '1' ) { |
|
55 | + if ( get_option( 'yikes-mc-recaptcha-status', '' ) == '1' ) { |
|
56 | 56 | // allow users to manually set recaptcha (instead of globally - recaptcha="1"/recaptcha="0" - but still needs to be globally enabled on the settings page) |
57 | - if ( $atts['recaptcha'] != '0' ) { |
|
57 | + if ( $atts[ 'recaptcha' ] != '0' ) { |
|
58 | 58 | // if either of the Private the Secret key is left blank, we should display an error back to the user |
59 | - if( get_option( 'yikes-mc-recaptcha-site-key' , '' ) == '' ) { |
|
60 | - return __( "Whoops! It looks like you enabled reCAPTCHA but forgot to enter the reCAPTCHA site key!" , 'yikes-inc-easy-mailchimp-extender' ) . '<span class="edit-link yikes-easy-mc-edit-link"><a class="post-edit-link" href="' . esc_url( admin_url( 'admin.php?page=yikes-inc-easy-mailchimp-settings§ion=recaptcha-settings' ) ) . '" title="' . __( 'ReCaptcha Settings' , 'yikes-inc-easy-mailchimp-extender' ) . '">' . __( 'Edit ReCaptcha Settings' , 'yikes-inc-easy-mailchimp-extender' ) . '</a></span>'; |
|
59 | + if ( get_option( 'yikes-mc-recaptcha-site-key', '' ) == '' ) { |
|
60 | + return __( "Whoops! It looks like you enabled reCAPTCHA but forgot to enter the reCAPTCHA site key!", 'yikes-inc-easy-mailchimp-extender' ) . '<span class="edit-link yikes-easy-mc-edit-link"><a class="post-edit-link" href="' . esc_url( admin_url( 'admin.php?page=yikes-inc-easy-mailchimp-settings§ion=recaptcha-settings' ) ) . '" title="' . __( 'ReCaptcha Settings', 'yikes-inc-easy-mailchimp-extender' ) . '">' . __( 'Edit ReCaptcha Settings', 'yikes-inc-easy-mailchimp-extender' ) . '</a></span>'; |
|
61 | 61 | } |
62 | - if( get_option( 'yikes-mc-recaptcha-secret-key' , '' ) == '' ) { |
|
63 | - return __( "Whoops! It looks like you enabled reCAPTCHA but forgot to enter the reCAPTCHA secret key!" , 'yikes-inc-easy-mailchimp-extender' ) . '<span class="edit-link yikes-easy-mc-edit-link"><a class="post-edit-link" href="' . esc_url( admin_url( 'admin.php?page=yikes-inc-easy-mailchimp-settings§ion=recaptcha-settings' ) ) . '" title="' . __( 'ReCaptcha Settings' , 'yikes-inc-easy-mailchimp-extender' ) . '">' . __( 'Edit ReCaptcha Settings' , 'yikes-inc-easy-mailchimp-extender' ) . '</a></span>'; |
|
62 | + if ( get_option( 'yikes-mc-recaptcha-secret-key', '' ) == '' ) { |
|
63 | + return __( "Whoops! It looks like you enabled reCAPTCHA but forgot to enter the reCAPTCHA secret key!", 'yikes-inc-easy-mailchimp-extender' ) . '<span class="edit-link yikes-easy-mc-edit-link"><a class="post-edit-link" href="' . esc_url( admin_url( 'admin.php?page=yikes-inc-easy-mailchimp-settings§ion=recaptcha-settings' ) ) . '" title="' . __( 'ReCaptcha Settings', 'yikes-inc-easy-mailchimp-extender' ) . '">' . __( 'Edit ReCaptcha Settings', 'yikes-inc-easy-mailchimp-extender' ) . '</a></span>'; |
|
64 | 64 | } |
65 | 65 | |
66 | - if( ! empty( $atts['recaptcha_type'] ) ) { |
|
67 | - echo $atts['recaptcha_type']; |
|
66 | + if ( ! empty( $atts[ 'recaptcha_type' ] ) ) { |
|
67 | + echo $atts[ 'recaptcha_type' ]; |
|
68 | 68 | } |
69 | 69 | |
70 | 70 | // Store the site language (to load recaptcha in a specific language) |
71 | 71 | $locale = get_locale(); |
72 | 72 | $locale_split = explode( '_', $locale ); |
73 | 73 | // Setup reCAPTCHA parameters |
74 | - $lang = ( ! empty( $locale_split ) ? $locale_split[0] : $locale ); |
|
75 | - $lang = ( ! empty( $atts['recaptcha_lang'] ) ) ? $atts['recaptcha_lang'] : $lang; |
|
76 | - $type = ( ! empty( $atts['recaptcha_type'] ) ) ? strtolower( $atts['recaptcha_type'] ) : 'image'; // setup recaptcha type |
|
77 | - $theme= ( ! empty( $atts['recaptcha_theme'] ) ) ? strtolower( $atts['recaptcha_theme'] ) : 'light'; // setup recaptcha theme |
|
78 | - $size = ( ! empty( $atts['recaptcha_size'] ) ) ? strtolower( $atts['recaptcha_size'] ) : 'normal'; // setup recaptcha size |
|
79 | - $data_callback = ( ! empty( $atts['recaptcha_data_callback'] ) ) ? $atts['recaptcha_data_callback'] : false; // setup recaptcha size |
|
80 | - $expired_callback = ( ! empty( $atts['recaptcha_expired_callback'] ) ) ? $atts['recaptcha_expired_callback'] : false; // setup recaptcha size |
|
74 | + $lang = ( ! empty( $locale_split ) ? $locale_split[ 0 ] : $locale ); |
|
75 | + $lang = ( ! empty( $atts[ 'recaptcha_lang' ] ) ) ? $atts[ 'recaptcha_lang' ] : $lang; |
|
76 | + $type = ( ! empty( $atts[ 'recaptcha_type' ] ) ) ? strtolower( $atts[ 'recaptcha_type' ] ) : 'image'; // setup recaptcha type |
|
77 | + $theme = ( ! empty( $atts[ 'recaptcha_theme' ] ) ) ? strtolower( $atts[ 'recaptcha_theme' ] ) : 'light'; // setup recaptcha theme |
|
78 | + $size = ( ! empty( $atts[ 'recaptcha_size' ] ) ) ? strtolower( $atts[ 'recaptcha_size' ] ) : 'normal'; // setup recaptcha size |
|
79 | + $data_callback = ( ! empty( $atts[ 'recaptcha_data_callback' ] ) ) ? $atts[ 'recaptcha_data_callback' ] : false; // setup recaptcha size |
|
80 | + $expired_callback = ( ! empty( $atts[ 'recaptcha_expired_callback' ] ) ) ? $atts[ 'recaptcha_expired_callback' ] : false; // setup recaptcha size |
|
81 | 81 | // Pass the shortcode parameters through a filter |
82 | 82 | $recaptcha_shortcode_params = apply_filters( 'yikes-mailchimp-recaptcha-parameters', array( |
83 | 83 | 'language' => $lang, |
@@ -86,12 +86,12 @@ discard block |
||
86 | 86 | 'size' => $size, |
87 | 87 | 'success_callback' => $data_callback, |
88 | 88 | 'expired_callback' => $expired_callback, |
89 | - ), $atts['form'] ); |
|
89 | + ), $atts[ 'form' ] ); |
|
90 | 90 | // enqueue Google recaptcha JS |
91 | - wp_register_script( 'google-recaptcha-js' , 'https://www.google.com/recaptcha/api.js?hl=' . $recaptcha_shortcode_params['language'] . '&onload=renderReCaptchaCallback&render=explicit', array( 'jquery' ) , 'all' ); |
|
91 | + wp_register_script( 'google-recaptcha-js', 'https://www.google.com/recaptcha/api.js?hl=' . $recaptcha_shortcode_params[ 'language' ] . '&onload=renderReCaptchaCallback&render=explicit', array( 'jquery' ), 'all' ); |
|
92 | 92 | wp_enqueue_script( 'google-recaptcha-js' ); |
93 | - $recaptcha_site_key = get_option( 'yikes-mc-recaptcha-site-key' , '' ); |
|
94 | - $recaptcha_box = '<div name="g-recaptcha" class="g-recaptcha" data-sitekey="' . $recaptcha_site_key . '" data-theme="' . $recaptcha_shortcode_params['theme'] . '" data-type="' . $recaptcha_shortcode_params['type'] . '" data-size="' . $recaptcha_shortcode_params['size'] . '" data-callback="' . $recaptcha_shortcode_params['success_callback'] . '" data-expired-callback="' . $recaptcha_shortcode_params['expired_callback'] . '"></div>'; |
|
93 | + $recaptcha_site_key = get_option( 'yikes-mc-recaptcha-site-key', '' ); |
|
94 | + $recaptcha_box = '<div name="g-recaptcha" class="g-recaptcha" data-sitekey="' . $recaptcha_site_key . '" data-theme="' . $recaptcha_shortcode_params[ 'theme' ] . '" data-type="' . $recaptcha_shortcode_params[ 'type' ] . '" data-size="' . $recaptcha_shortcode_params[ 'size' ] . '" data-callback="' . $recaptcha_shortcode_params[ 'success_callback' ] . '" data-expired-callback="' . $recaptcha_shortcode_params[ 'expired_callback' ] . '"></div>'; |
|
95 | 95 | ?> |
96 | 96 | <script type="text/javascript"> |
97 | 97 | /* Script Callback to init. multiple recaptchas on a single page */ |
@@ -118,36 +118,36 @@ discard block |
||
118 | 118 | } |
119 | 119 | |
120 | 120 | // place our results into a seperate variable for easy looping |
121 | - $additional_form_settings = ( isset( $form_data['form_settings'] ) ) ? $form_data['form_settings'] : false; |
|
121 | + $additional_form_settings = ( isset( $form_data[ 'form_settings' ] ) ) ? $form_data[ 'form_settings' ] : false; |
|
122 | 122 | // store our options from the additional form settings array |
123 | - $form_classes = ( $additional_form_settings ) ? $additional_form_settings['yikes-easy-mc-form-class-names'] : ''; |
|
124 | - $inline_form = ( $additional_form_settings ) ? $additional_form_settings['yikes-easy-mc-inline-form'] : ''; |
|
125 | - $submit_button_type = ( $additional_form_settings ) ? $additional_form_settings['yikes-easy-mc-submit-button-type'] : 'text'; |
|
126 | - $submit_button_text = ( $additional_form_settings && $additional_form_settings['yikes-easy-mc-submit-button-text'] != '' ) ? esc_attr( $additional_form_settings['yikes-easy-mc-submit-button-text'] ) : __( 'Submit', 'yikes-inc-easy-mailchimp-extender' ); |
|
127 | - $submit_button_image = ( $additional_form_settings ) ? esc_url( $additional_form_settings['yikes-easy-mc-submit-button-image'] ) : ''; |
|
128 | - $submit_button_classes = ( $additional_form_settings ) ? ' ' . esc_attr( $additional_form_settings['yikes-easy-mc-submit-button-classes'] ) : ''; |
|
123 | + $form_classes = ( $additional_form_settings ) ? $additional_form_settings[ 'yikes-easy-mc-form-class-names' ] : ''; |
|
124 | + $inline_form = ( $additional_form_settings ) ? $additional_form_settings[ 'yikes-easy-mc-inline-form' ] : ''; |
|
125 | + $submit_button_type = ( $additional_form_settings ) ? $additional_form_settings[ 'yikes-easy-mc-submit-button-type' ] : 'text'; |
|
126 | + $submit_button_text = ( $additional_form_settings && $additional_form_settings[ 'yikes-easy-mc-submit-button-text' ] != '' ) ? esc_attr( $additional_form_settings[ 'yikes-easy-mc-submit-button-text' ] ) : __( 'Submit', 'yikes-inc-easy-mailchimp-extender' ); |
|
127 | + $submit_button_image = ( $additional_form_settings ) ? esc_url( $additional_form_settings[ 'yikes-easy-mc-submit-button-image' ] ) : ''; |
|
128 | + $submit_button_classes = ( $additional_form_settings ) ? ' ' . esc_attr( $additional_form_settings[ 'yikes-easy-mc-submit-button-classes' ] ) : ''; |
|
129 | 129 | |
130 | 130 | // scheuldes |
131 | - $form_schedule_state = ( $additional_form_settings ) ? $additional_form_settings['yikes-easy-mc-form-schedule'] : false; |
|
132 | - $form_schedule_start = ( $additional_form_settings ) ? $additional_form_settings['yikes-easy-mc-form-restriction-start'] : '';; |
|
133 | - $form_schedule_end = ( $additional_form_settings ) ? $additional_form_settings['yikes-easy-mc-form-restriction-end'] : ''; |
|
134 | - $form_pending_message = ( $additional_form_settings ) ? $additional_form_settings['yikes-easy-mc-form-restriction-pending-message'] : ''; |
|
135 | - $form_expired_message = ( $additional_form_settings ) ? $additional_form_settings['yikes-easy-mc-form-restriction-expired-message'] : ''; |
|
131 | + $form_schedule_state = ( $additional_form_settings ) ? $additional_form_settings[ 'yikes-easy-mc-form-schedule' ] : false; |
|
132 | + $form_schedule_start = ( $additional_form_settings ) ? $additional_form_settings[ 'yikes-easy-mc-form-restriction-start' ] : ''; ; |
|
133 | + $form_schedule_end = ( $additional_form_settings ) ? $additional_form_settings[ 'yikes-easy-mc-form-restriction-end' ] : ''; |
|
134 | + $form_pending_message = ( $additional_form_settings ) ? $additional_form_settings[ 'yikes-easy-mc-form-restriction-pending-message' ] : ''; |
|
135 | + $form_expired_message = ( $additional_form_settings ) ? $additional_form_settings[ 'yikes-easy-mc-form-restriction-expired-message' ] : ''; |
|
136 | 136 | |
137 | 137 | // register required |
138 | - $form_login_required = ( $additional_form_settings ) ? $additional_form_settings['yikes-easy-mc-form-login-required'] : false; |
|
139 | - $form_login_message = ( $additional_form_settings ) ? $additional_form_settings['yikes-easy-mc-form-restriction-login-message'] : ''; |
|
138 | + $form_login_required = ( $additional_form_settings ) ? $additional_form_settings[ 'yikes-easy-mc-form-login-required' ] : false; |
|
139 | + $form_login_message = ( $additional_form_settings ) ? $additional_form_settings[ 'yikes-easy-mc-form-restriction-login-message' ] : ''; |
|
140 | 140 | |
141 | 141 | // store number of fields |
142 | - $field_count = (int) count( $form_data['fields'] ); |
|
142 | + $field_count = (int) count( $form_data[ 'fields' ] ); |
|
143 | 143 | |
144 | 144 | // confirm we actually have fields, before looping |
145 | - if ( isset( $form_data['fields'] ) && ! empty( $form_data['fields'] ) ) { |
|
145 | + if ( isset( $form_data[ 'fields' ] ) && ! empty( $form_data[ 'fields' ] ) ) { |
|
146 | 146 | // loop over each field, if it's set to hidden -- subtract it from the field count |
147 | 147 | // this throws off the layout for inline forms setup below |
148 | - foreach ( $form_data['fields'] as $form_field ) { |
|
148 | + foreach ( $form_data[ 'fields' ] as $form_field ) { |
|
149 | 149 | if ( isset( $form_field->hide ) && $form_field->hide == 1 ) { |
150 | - $field_count --; |
|
150 | + $field_count--; |
|
151 | 151 | } |
152 | 152 | } |
153 | 153 | } |
@@ -156,8 +156,8 @@ discard block |
||
156 | 156 | * If login is required, abort |
157 | 157 | * @since 6.0.3.8 |
158 | 158 | */ |
159 | - if( $form_login_required ) { |
|
160 | - if( apply_filters( 'yikes-mailchimp-required-login-requirement', ! is_user_logged_in() ) ) { |
|
159 | + if ( $form_login_required ) { |
|
160 | + if ( apply_filters( 'yikes-mailchimp-required-login-requirement', ! is_user_logged_in() ) ) { |
|
161 | 161 | ob_start(); |
162 | 162 | ?> |
163 | 163 | <div class="yikes-mailchimp-login-required yikes-mailchimp-form-<?php echo $form_id; ?>-login-required"> |
@@ -173,19 +173,19 @@ discard block |
||
173 | 173 | * Check if schedule is set for this form |
174 | 174 | * @since 6.0.3.8 |
175 | 175 | */ |
176 | - if( $form_schedule_state ) { |
|
176 | + if ( $form_schedule_state ) { |
|
177 | 177 | // store current date |
178 | 178 | $current_date = strtotime( current_time( 'm/d/Y g:iA' ) ); |
179 | 179 | |
180 | 180 | // the the current date is less than the form scheduled start date |
181 | - if( $current_date < $form_schedule_start ) { |
|
181 | + if ( $current_date < $form_schedule_start ) { |
|
182 | 182 | echo apply_filters( 'yikes-mailchimp-frontend-content', $form_pending_message ); |
183 | 183 | return; |
184 | 184 | // abort |
185 | 185 | } |
186 | 186 | |
187 | 187 | // The current date is past or equal to the end date, aka form has now expired |
188 | - if( $current_date >= $form_schedule_end ) { |
|
188 | + if ( $current_date >= $form_schedule_end ) { |
|
189 | 189 | echo apply_filters( 'yikes-mailchimp-frontend-content', $form_expired_message ); |
190 | 190 | return; |
191 | 191 | // abort |
@@ -194,14 +194,14 @@ discard block |
||
194 | 194 | |
195 | 195 | // setup the submit button text |
196 | 196 | // shortcode parameter takes precedence over option |
197 | - $submit = ( ! empty( $atts['submit'] ) ) ? $atts['submit'] : $submit_button_text; |
|
197 | + $submit = ( ! empty( $atts[ 'submit' ] ) ) ? $atts[ 'submit' ] : $submit_button_text; |
|
198 | 198 | |
199 | 199 | // used in yikes-mailchimp-redirect-url filter |
200 | 200 | global $post; |
201 | 201 | $page_data = $post; |
202 | 202 | |
203 | 203 | // Remove the post_password from this for security |
204 | - if( isset( $page_data->post_password ) ) { |
|
204 | + if ( isset( $page_data->post_password ) ) { |
|
205 | 205 | unset( $page_data->post_password ); |
206 | 206 | } |
207 | 207 | |
@@ -219,7 +219,7 @@ discard block |
||
219 | 219 | * to exclude styles from loading, add `define( 'YIKES_MAILCHIMP_EXCLUDE_STYLES', true );` to functions.php |
220 | 220 | * @since 6.0.3.8 |
221 | 221 | */ |
222 | - if( ! defined( 'YIKES_MAILCHIMP_EXCLUDE_STYLES' ) ) { |
|
222 | + if ( ! defined( 'YIKES_MAILCHIMP_EXCLUDE_STYLES' ) ) { |
|
223 | 223 | // enqueue the form styles |
224 | 224 | wp_enqueue_style( 'yikes-inc-easy-mailchimp-public-styles', YIKES_MC_URL . 'public/css/yikes-inc-easy-mailchimp-extender-public.min.css', array( $last_key ) ); |
225 | 225 | } |
@@ -227,19 +227,19 @@ discard block |
||
227 | 227 | /** |
228 | 228 | * Check for form inline parameter |
229 | 229 | */ |
230 | - $form_inline = ( $atts['inline'] == 1 || $atts['inline'] == 'true' ); |
|
230 | + $form_inline = ( $atts[ 'inline' ] == 1 || $atts[ 'inline' ] == 'true' ); |
|
231 | 231 | // recheck from our form options |
232 | 232 | if ( ! $form_inline ) { |
233 | - $form_inline = (bool) $additional_form_settings['yikes-easy-mc-inline-form']; |
|
233 | + $form_inline = (bool) $additional_form_settings[ 'yikes-easy-mc-inline-form' ]; |
|
234 | 234 | } |
235 | 235 | |
236 | 236 | /* If the current user is logged in, and an admin...lets display our 'Edit Form' link */ |
237 | - if( is_user_logged_in() ) { |
|
238 | - if( current_user_can( apply_filters( 'yikes-mailchimp-user-role-access' , 'manage_options' ) ) ) { |
|
237 | + if ( is_user_logged_in() ) { |
|
238 | + if ( current_user_can( apply_filters( 'yikes-mailchimp-user-role-access', 'manage_options' ) ) ) { |
|
239 | 239 | $edit_form_link = '<span class="edit-link">'; |
240 | - $edit_form_link .= '<a class="post-edit-link" href="' . esc_url( admin_url( 'admin.php?page=yikes-mailchimp-edit-form&id=' . $atts['form'] ) ) . '" title="' . __( 'Edit' , 'yikes-inc-easy-mailchimp-extender' ) . ' ' . ucwords( $form_data['form_name'] ) . '">' . __( 'Edit Form' , 'yikes-inc-easy-mailchimp-extender' ) . '</a>'; |
|
240 | + $edit_form_link .= '<a class="post-edit-link" href="' . esc_url( admin_url( 'admin.php?page=yikes-mailchimp-edit-form&id=' . $atts[ 'form' ] ) ) . '" title="' . __( 'Edit', 'yikes-inc-easy-mailchimp-extender' ) . ' ' . ucwords( $form_data[ 'form_name' ] ) . '">' . __( 'Edit Form', 'yikes-inc-easy-mailchimp-extender' ) . '</a>'; |
|
241 | 241 | $edit_form_link .= '</span>'; |
242 | - $edit_form_link = apply_filters( 'yikes-mailchimp-front-end-form-action-links', $edit_form_link, $atts['form'], ucwords( $form_data['form_name'] ) ); |
|
242 | + $edit_form_link = apply_filters( 'yikes-mailchimp-front-end-form-action-links', $edit_form_link, $atts[ 'form' ], ucwords( $form_data[ 'form_name' ] ) ); |
|
243 | 243 | } else { |
244 | 244 | $edit_form_link = ''; |
245 | 245 | } |
@@ -249,16 +249,16 @@ discard block |
||
249 | 249 | // or else MailChimp throws errors at you |
250 | 250 | // extract our array keys |
251 | 251 | // @todo Remove array_keys() and in_array() usage here. |
252 | - if( isset( $form_data['fields'] ) && ! empty( $form_data['fields'] ) ) { |
|
253 | - $array_keys = array_keys( $form_data['fields'] ); |
|
252 | + if ( isset( $form_data[ 'fields' ] ) && ! empty( $form_data[ 'fields' ] ) ) { |
|
253 | + $array_keys = array_keys( $form_data[ 'fields' ] ); |
|
254 | 254 | // check for EMAIL in that array |
255 | - if( !in_array( 'EMAIL', $array_keys ) && !in_array( 'email', $array_keys ) ) { |
|
256 | - return '<p>' . __( "An email field is required for all MailChimp forms. Please add an email field to this form." , 'yikes-inc-easy-mailchimp-extender' ) . '</p><p>' . $edit_form_link . '</p>'; |
|
255 | + if ( ! in_array( 'EMAIL', $array_keys ) && ! in_array( 'email', $array_keys ) ) { |
|
256 | + return '<p>' . __( "An email field is required for all MailChimp forms. Please add an email field to this form.", 'yikes-inc-easy-mailchimp-extender' ) . '</p><p>' . $edit_form_link . '</p>'; |
|
257 | 257 | } |
258 | 258 | } else { |
259 | - $error = '<p>' . __( "Whoops, it looks like you forgot to assign fields to this form." , 'yikes-inc-easy-mailchimp-extender' ) . '</p>'; |
|
260 | - if( is_user_logged_in() ) { |
|
261 | - if( current_user_can( apply_filters( 'yikes-mailchimp-user-role-access' , 'manage_options' ) ) ) { |
|
259 | + $error = '<p>' . __( "Whoops, it looks like you forgot to assign fields to this form.", 'yikes-inc-easy-mailchimp-extender' ) . '</p>'; |
|
260 | + if ( is_user_logged_in() ) { |
|
261 | + if ( current_user_can( apply_filters( 'yikes-mailchimp-user-role-access', 'manage_options' ) ) ) { |
|
262 | 262 | return $error . $edit_form_link; |
263 | 263 | } |
264 | 264 | } else { |
@@ -266,7 +266,7 @@ discard block |
||
266 | 266 | } |
267 | 267 | } |
268 | 268 | |
269 | - if( $form_inline ) { |
|
269 | + if ( $form_inline ) { |
|
270 | 270 | $field_width = (float) ( 100 / $field_count ); |
271 | 271 | $submit_button_width = (float) ( 20 / $field_count ); |
272 | 272 | /* |
@@ -303,17 +303,17 @@ discard block |
||
303 | 303 | * Set a custom title using custom_title="lorem ipsum" parameter in the shortcode |
304 | 304 | * - This takes precedence over the title set |
305 | 305 | */ |
306 | - if ( $atts['title'] ) { |
|
307 | - if ( ! empty( $atts['custom_title'] ) ) { |
|
306 | + if ( $atts[ 'title' ] ) { |
|
307 | + if ( ! empty( $atts[ 'custom_title' ] ) ) { |
|
308 | 308 | /** |
309 | 309 | * Filter the title that is displayed through the shortcode. |
310 | 310 | * |
311 | 311 | * @param string $title The title to display. |
312 | 312 | * @param int $form_id The form ID. |
313 | 313 | */ |
314 | - $title = apply_filters( 'yikes-mailchimp-form-title', apply_filters( 'the_title', $atts['custom_title'] ), $form_id ); |
|
314 | + $title = apply_filters( 'yikes-mailchimp-form-title', apply_filters( 'the_title', $atts[ 'custom_title' ] ), $form_id ); |
|
315 | 315 | } else { |
316 | - $title = apply_filters( 'yikes-mailchimp-form-title', apply_filters( 'the_title', $form_data['form_name'] ), $form_id ); |
|
316 | + $title = apply_filters( 'yikes-mailchimp-form-title', apply_filters( 'the_title', $form_data[ 'form_name' ] ), $form_id ); |
|
317 | 317 | } |
318 | 318 | |
319 | 319 | echo sprintf( '<h3 class="yikes-mailchimp-form-title yikes-mailchimp-form-title-%1$s">%2$s</h3>', $form_id, $title ); |
@@ -323,26 +323,26 @@ discard block |
||
323 | 323 | * Allow users to specify a custom description for this form, no html support |
324 | 324 | * @since 6.0.3.8 |
325 | 325 | */ |
326 | - if ( $atts['description'] ) { |
|
327 | - if ( ! empty( $atts['custom_description'] ) ) { |
|
326 | + if ( $atts[ 'description' ] ) { |
|
327 | + if ( ! empty( $atts[ 'custom_description' ] ) ) { |
|
328 | 328 | /** |
329 | 329 | * Filter the description that is displayed through the shortcode. |
330 | 330 | * |
331 | 331 | * @param string $title The title to display. |
332 | 332 | * @param int $form_id The form ID. |
333 | 333 | */ |
334 | - $description = apply_filters( 'yikes-mailchimp-form-description', $atts['custom_description'], $form_id ); |
|
334 | + $description = apply_filters( 'yikes-mailchimp-form-description', $atts[ 'custom_description' ], $form_id ); |
|
335 | 335 | } else { |
336 | - $description = apply_filters( 'yikes-mailchimp-form-description', $form_data['form_description'], $form_id ); |
|
336 | + $description = apply_filters( 'yikes-mailchimp-form-description', $form_data[ 'form_description' ], $form_id ); |
|
337 | 337 | } |
338 | 338 | |
339 | 339 | echo sprintf( '<section class="yikes-mailchimp-form-description yikes-mailchimp-form-description-%1$s">%2$s</section>', $form_id, $description ); |
340 | 340 | } |
341 | 341 | |
342 | 342 | // Check for AJAX |
343 | - if( ( ! empty( $atts['ajax'] ) && $atts['ajax'] == 1 ) || $form_data['submission_settings']['ajax'] == 1 ) { |
|
343 | + if ( ( ! empty( $atts[ 'ajax' ] ) && $atts[ 'ajax' ] == 1 ) || $form_data[ 'submission_settings' ][ 'ajax' ] == 1 ) { |
|
344 | 344 | // enqueue our ajax script |
345 | - wp_enqueue_script( 'yikes-easy-mc-ajax' , YIKES_MC_URL . 'public/js/yikes-mc-ajax-forms.min.js' , array( 'jquery' ) , YIKES_MC_VERSION, false ); |
|
345 | + wp_enqueue_script( 'yikes-easy-mc-ajax', YIKES_MC_URL . 'public/js/yikes-mc-ajax-forms.min.js', array( 'jquery' ), YIKES_MC_VERSION, false ); |
|
346 | 346 | wp_localize_script( 'yikes-easy-mc-ajax', 'yikes_mailchimp_ajax', array( |
347 | 347 | 'ajax_url' => esc_url( admin_url( 'admin-ajax.php' ) ), |
348 | 348 | 'page_data' => $page_data, |
@@ -361,67 +361,67 @@ discard block |
||
361 | 361 | |
362 | 362 | // render the form! |
363 | 363 | ?> |
364 | - <form id="<?php echo sanitize_title( $form_data['form_name'] ); ?>-<?php echo $form_id; ?>" class="yikes-easy-mc-form yikes-easy-mc-form-<?php echo $form_id . ' '; if ( $form_inline ) { echo 'yikes-mailchimp-form-inline '; } echo ' ' . apply_filters( 'yikes-mailchimp-form-class', $form_classes, $form_id ); if( !empty( $_POST ) && $form_submitted == 1 && $form_data['submission_settings']['hide_form_post_signup'] == 1 ) { echo ' yikes-easy-mc-display-none'; } ?>" action="" method="POST" data-attr-form-id="<?php echo $form_id; ?>"> |
|
364 | + <form id="<?php echo sanitize_title( $form_data[ 'form_name' ] ); ?>-<?php echo $form_id; ?>" class="yikes-easy-mc-form yikes-easy-mc-form-<?php echo $form_id . ' '; if ( $form_inline ) { echo 'yikes-mailchimp-form-inline '; } echo ' ' . apply_filters( 'yikes-mailchimp-form-class', $form_classes, $form_id ); if ( ! empty( $_POST ) && $form_submitted == 1 && $form_data[ 'submission_settings' ][ 'hide_form_post_signup' ] == 1 ) { echo ' yikes-easy-mc-display-none'; } ?>" action="" method="POST" data-attr-form-id="<?php echo $form_id; ?>"> |
|
365 | 365 | |
366 | 366 | <?php |
367 | 367 | // Set a default constant for hidden fields |
368 | 368 | $hidden_label_count = 0; |
369 | 369 | |
370 | 370 | // Loop over our form fields |
371 | - foreach( $form_data['fields'] as $field ) { |
|
371 | + foreach ( $form_data[ 'fields' ] as $field ) { |
|
372 | 372 | // input array |
373 | 373 | $field_array = array(); |
374 | 374 | // label array |
375 | 375 | $label_array = array(); |
376 | 376 | // label classes array |
377 | 377 | $label_class_array = array(); |
378 | - if( $field['additional-classes'] != '' ) { |
|
378 | + if ( $field[ 'additional-classes' ] != '' ) { |
|
379 | 379 | // split custom classes at spaces |
380 | - $custom_classes = explode( ' ' , $field['additional-classes'] ); |
|
380 | + $custom_classes = explode( ' ', $field[ 'additional-classes' ] ); |
|
381 | 381 | // check our custom class array for field-left/field-right |
382 | 382 | // if it's set we need to assign it to our label and remove it from the field classes |
383 | 383 | // input half left |
384 | - if( in_array( 'field-left-half' , $custom_classes ) ) { |
|
384 | + if ( in_array( 'field-left-half', $custom_classes ) ) { |
|
385 | 385 | // $label_array['class'] = 'class="field-left-half"'; |
386 | - $label_class_array[] = 'field-left-half'; |
|
387 | - $key = array_search( 'field-left-half' , $custom_classes ); |
|
388 | - unset( $custom_classes[$key] ); |
|
386 | + $label_class_array[ ] = 'field-left-half'; |
|
387 | + $key = array_search( 'field-left-half', $custom_classes ); |
|
388 | + unset( $custom_classes[ $key ] ); |
|
389 | 389 | } // input half right |
390 | - if( in_array( 'field-right-half' , $custom_classes ) ) { |
|
390 | + if ( in_array( 'field-right-half', $custom_classes ) ) { |
|
391 | 391 | // $label_array['class'] = 'class="field-right-half"'; |
392 | - $label_class_array[] = 'field-right-half'; |
|
393 | - $key = array_search( 'field-right-half' , $custom_classes ); |
|
394 | - unset( $custom_classes[$key] ); |
|
392 | + $label_class_array[ ] = 'field-right-half'; |
|
393 | + $key = array_search( 'field-right-half', $custom_classes ); |
|
394 | + unset( $custom_classes[ $key ] ); |
|
395 | 395 | } // input thirds (1/3 width, floated left) |
396 | - if( in_array( 'field-third' , $custom_classes ) ) { |
|
396 | + if ( in_array( 'field-third', $custom_classes ) ) { |
|
397 | 397 | // $label_array['class'] = 'class="field-third"'; |
398 | - $label_class_array[] = 'field-third'; |
|
399 | - $key = array_search( 'field-third' , $custom_classes ); |
|
400 | - unset( $custom_classes[$key] ); |
|
398 | + $label_class_array[ ] = 'field-third'; |
|
399 | + $key = array_search( 'field-third', $custom_classes ); |
|
400 | + unset( $custom_classes[ $key ] ); |
|
401 | 401 | } // 2 column radio |
402 | - if( in_array( 'option-2-col' , $custom_classes ) ) { |
|
402 | + if ( in_array( 'option-2-col', $custom_classes ) ) { |
|
403 | 403 | // $label_array['class'] = 'class="option-2-col"'; |
404 | - $label_class_array[] = 'option-2-col'; |
|
405 | - $key = array_search( 'option-2-col' , $custom_classes ); |
|
406 | - unset( $custom_classes[$key] ); |
|
404 | + $label_class_array[ ] = 'option-2-col'; |
|
405 | + $key = array_search( 'option-2-col', $custom_classes ); |
|
406 | + unset( $custom_classes[ $key ] ); |
|
407 | 407 | } // 3 column radio |
408 | - if( in_array( 'option-3-col' , $custom_classes ) ) { |
|
408 | + if ( in_array( 'option-3-col', $custom_classes ) ) { |
|
409 | 409 | // $label_array['class'] = 'class="option-3-col"'; |
410 | - $label_class_array[] = 'option-3-col'; |
|
411 | - $key = array_search( 'option-3-col' , $custom_classes ); |
|
412 | - unset( $custom_classes[$key] ); |
|
410 | + $label_class_array[ ] = 'option-3-col'; |
|
411 | + $key = array_search( 'option-3-col', $custom_classes ); |
|
412 | + unset( $custom_classes[ $key ] ); |
|
413 | 413 | } // 4 column radio |
414 | - if( in_array( 'option-4-col' , $custom_classes ) ) { |
|
414 | + if ( in_array( 'option-4-col', $custom_classes ) ) { |
|
415 | 415 | // $label_array['class'] = 'class="option-4-col"'; |
416 | - $label_class_array[] = 'option-4-col'; |
|
417 | - $key = array_search( 'option-4-col' , $custom_classes ); |
|
418 | - unset( $custom_classes[$key] ); |
|
416 | + $label_class_array[ ] = 'option-4-col'; |
|
417 | + $key = array_search( 'option-4-col', $custom_classes ); |
|
418 | + unset( $custom_classes[ $key ] ); |
|
419 | 419 | } // inline radio & checkboxes etc |
420 | - if( in_array( 'option-inline' , $custom_classes ) ) { |
|
420 | + if ( in_array( 'option-inline', $custom_classes ) ) { |
|
421 | 421 | // $label_array['class'] = 'class="option-inline"'; |
422 | - $label_class_array[] = 'option-inline'; |
|
423 | - $key = array_search( 'option-inline' , $custom_classes ); |
|
424 | - unset( $custom_classes[$key] ); |
|
422 | + $label_class_array[ ] = 'option-inline'; |
|
423 | + $key = array_search( 'option-inline', $custom_classes ); |
|
424 | + unset( $custom_classes[ $key ] ); |
|
425 | 425 | } |
426 | 426 | } else { |
427 | 427 | $custom_classes = array(); |
@@ -429,19 +429,19 @@ discard block |
||
429 | 429 | |
430 | 430 | // if the form is set to inline, add the inline class to our labels |
431 | 431 | // since @6.0.3.8 |
432 | - if( $form_inline ) { |
|
433 | - $label_class_array[] = 'label-inline'; |
|
432 | + if ( $form_inline ) { |
|
433 | + $label_class_array[ ] = 'label-inline'; |
|
434 | 434 | } |
435 | 435 | |
436 | - if( isset( $field['hide-label'] ) ) { |
|
437 | - if( absint( $field['hide-label'] ) === 1 ) { |
|
436 | + if ( isset( $field[ 'hide-label' ] ) ) { |
|
437 | + if ( absint( $field[ 'hide-label' ] ) === 1 ) { |
|
438 | 438 | $hidden_label_count++; |
439 | - $custom_classes[] = 'field-no-label'; |
|
439 | + $custom_classes[ ] = 'field-no-label'; |
|
440 | 440 | } |
441 | 441 | } |
442 | 442 | |
443 | 443 | /* Store tag variable based on field type */ |
444 | - if( isset( $field['merge'] ) ) { |
|
444 | + if ( isset( $field[ 'merge' ] ) ) { |
|
445 | 445 | $group = ''; |
446 | 446 | $tag = 'merge'; |
447 | 447 | } else { |
@@ -450,49 +450,49 @@ discard block |
||
450 | 450 | } |
451 | 451 | |
452 | 452 | // build up our array |
453 | - $field_array['id'] = 'id="yikes-easy-mc-form-' . $form_id . '-' . esc_attr( $field[$tag] ) . '" '; |
|
454 | - $field_array['name'] = 'name="' . $group . esc_attr( $field[ $tag ] ) . '" '; |
|
455 | - $field_array['placeholder'] = isset( $field['placeholder'] ) ? 'placeholder="' . esc_attr( stripslashes( $field['placeholder'] ) ) . '" ' : ''; |
|
456 | - $field_array['classes'] = 'class="yikes-easy-mc-'.$field['type'] . ' ' . esc_attr( trim( implode( ' ' , $custom_classes ) ) ) . '" '; |
|
453 | + $field_array[ 'id' ] = 'id="yikes-easy-mc-form-' . $form_id . '-' . esc_attr( $field[ $tag ] ) . '" '; |
|
454 | + $field_array[ 'name' ] = 'name="' . $group . esc_attr( $field[ $tag ] ) . '" '; |
|
455 | + $field_array[ 'placeholder' ] = isset( $field[ 'placeholder' ] ) ? 'placeholder="' . esc_attr( stripslashes( $field[ 'placeholder' ] ) ) . '" ' : ''; |
|
456 | + $field_array[ 'classes' ] = 'class="yikes-easy-mc-' . $field[ 'type' ] . ' ' . esc_attr( trim( implode( ' ', $custom_classes ) ) ) . '" '; |
|
457 | 457 | |
458 | 458 | // email must always be required and visible |
459 | - if( $field['type'] == 'email' ) { |
|
460 | - $field_array['required'] = 'required="required"'; |
|
461 | - $label_array['visible'] = ''; |
|
459 | + if ( $field[ 'type' ] == 'email' ) { |
|
460 | + $field_array[ 'required' ] = 'required="required"'; |
|
461 | + $label_array[ 'visible' ] = ''; |
|
462 | 462 | // $label_array['required'] = 'class="' . $field['merge'] . '-label yikes-mailchimp-field-required"'; |
463 | - $label_class_array[] = $field['merge'] . '-label'; |
|
464 | - $label_class_array[] = 'yikes-mailchimp-field-required'; |
|
463 | + $label_class_array[ ] = $field[ 'merge' ] . '-label'; |
|
464 | + $label_class_array[ ] = 'yikes-mailchimp-field-required'; |
|
465 | 465 | } else { |
466 | - if( $tag == 'merge' ) { |
|
467 | - $field_array['required'] = isset( $field['require'] ) ? 'required="required"' : ''; |
|
468 | - $label_array['visible'] = isset( $field['hide'] ) ? 'style="display:none;"' : ''; |
|
466 | + if ( $tag == 'merge' ) { |
|
467 | + $field_array[ 'required' ] = isset( $field[ 'require' ] ) ? 'required="required"' : ''; |
|
468 | + $label_array[ 'visible' ] = isset( $field[ 'hide' ] ) ? 'style="display:none;"' : ''; |
|
469 | 469 | // $label_array['required'] = isset( $field['require'] ) ? 'class="' . $field['merge'] . '-label yikes-mailchimp-field-required"' : 'class="' . $field['merge'] . '-label"'; |
470 | - $label_class_array[] = isset( $field['require'] ) ? $field['merge'] . '-label yikes-mailchimp-field-required' : $field['merge'] . '-label'; |
|
470 | + $label_class_array[ ] = isset( $field[ 'require' ] ) ? $field[ 'merge' ] . '-label yikes-mailchimp-field-required' : $field[ 'merge' ] . '-label'; |
|
471 | 471 | } else { |
472 | - $field_array['required'] = isset( $field['require'] ) ? 'required="required"' : ''; |
|
473 | - $label_array['visible'] = isset( $field['hide'] ) ? 'style="display:none;"' : ''; |
|
472 | + $field_array[ 'required' ] = isset( $field[ 'require' ] ) ? 'required="required"' : ''; |
|
473 | + $label_array[ 'visible' ] = isset( $field[ 'hide' ] ) ? 'style="display:none;"' : ''; |
|
474 | 474 | // $label_array['required'] = isset( $field['require'] ) ? 'class="' . $field['group_id'] . '-label yikes-mailchimp-field-required"' : 'class="' . $field['group_id'] . '-label"'; |
475 | - $label_class_array[] = isset( $field['require'] ) ? $field['group_id'] . '-label yikes-mailchimp-field-required' : $field['group_id'] . '-label'; |
|
475 | + $label_class_array[ ] = isset( $field[ 'require' ] ) ? $field[ 'group_id' ] . '-label yikes-mailchimp-field-required' : $field[ 'group_id' ] . '-label'; |
|
476 | 476 | } |
477 | 477 | } |
478 | 478 | |
479 | 479 | // if both hide label and hide field are checked, we gotta hide the field! |
480 | - if( isset( $field['hide' ] ) && $field['hide'] == 1 ) { |
|
481 | - if( isset( $field['hide-label' ] ) && $field['hide-label'] == 1 ) { |
|
482 | - $field_array['visible'] = 'style="display:none;"'; |
|
480 | + if ( isset( $field[ 'hide' ] ) && $field[ 'hide' ] == 1 ) { |
|
481 | + if ( isset( $field[ 'hide-label' ] ) && $field[ 'hide-label' ] == 1 ) { |
|
482 | + $field_array[ 'visible' ] = 'style="display:none;"'; |
|
483 | 483 | } |
484 | 484 | } |
485 | 485 | |
486 | - $label_array['classes'] = 'class="' . implode( ' ', $label_class_array ) . '"'; |
|
486 | + $label_array[ 'classes' ] = 'class="' . implode( ' ', $label_class_array ) . '"'; |
|
487 | 487 | |
488 | 488 | // filter the field array data |
489 | 489 | $field_array = apply_filters( 'yikes-mailchimp-field-data', $field_array, $field, $form_id ); |
490 | 490 | |
491 | 491 | /* Loop Over Standard Fields (aka merge variables) */ |
492 | - if( isset( $field['merge'] ) ) { |
|
492 | + if ( isset( $field[ 'merge' ] ) ) { |
|
493 | 493 | |
494 | 494 | // loop over our fields by Type |
495 | - switch ( $field['type'] ) { |
|
495 | + switch ( $field[ 'type' ] ) { |
|
496 | 496 | |
497 | 497 | default: |
498 | 498 | case 'email': |
@@ -500,25 +500,25 @@ discard block |
||
500 | 500 | case 'number': |
501 | 501 | |
502 | 502 | // pass our default value through our filter to parse dynamic data by tag (used solely for 'text' type) |
503 | - $default_value = ( isset( $field['default'] ) ? esc_attr( $field['default'] ) : '' ); |
|
503 | + $default_value = ( isset( $field[ 'default' ] ) ? esc_attr( $field[ 'default' ] ) : '' ); |
|
504 | 504 | $default_value = apply_filters( 'yikes-mailchimp-process-default-tag', $default_value ); |
505 | 505 | ?> |
506 | - <label for="<?php echo $field['merge']; ?>" <?php echo implode( ' ' , $label_array ); ?>> |
|
506 | + <label for="<?php echo $field[ 'merge' ]; ?>" <?php echo implode( ' ', $label_array ); ?>> |
|
507 | 507 | |
508 | 508 | <!-- dictate label visibility --> |
509 | - <?php if( !isset( $field['hide-label'] ) ) { ?> |
|
510 | - <span class="<?php echo esc_attr( $field['merge'] ) . '-label'; ?>"> |
|
511 | - <?php if( ! isset( $field['hide-label'] ) ) { echo apply_filters( 'yikes-mailchimp-'.$field['merge'].'-label' , esc_attr( stripslashes( $field['label'] ) ), $form_id ); } ?> |
|
509 | + <?php if ( ! isset( $field[ 'hide-label' ] ) ) { ?> |
|
510 | + <span class="<?php echo esc_attr( $field[ 'merge' ] ) . '-label'; ?>"> |
|
511 | + <?php if ( ! isset( $field[ 'hide-label' ] ) ) { echo apply_filters( 'yikes-mailchimp-' . $field[ 'merge' ] . '-label', esc_attr( stripslashes( $field[ 'label' ] ) ), $form_id ); } ?> |
|
512 | 512 | </span> |
513 | 513 | <?php } ?> |
514 | 514 | |
515 | - <input <?php echo implode( ' ' , $field_array ); if( $field['type'] != 'email' && $field['type'] != 'number' ) { ?> type="text" <?php } else if( $field['type'] == 'email' ) { ?> type="email" <?php } else { ?> type="number" <?php } ?> value="<?php if( isset( $_POST[$field['merge']] ) && $form_submitted != 1 ) { echo $_POST[$field['merge']]; } else { echo esc_attr( $default_value ); } ?>"> |
|
515 | + <input <?php echo implode( ' ', $field_array ); if ( $field[ 'type' ] != 'email' && $field[ 'type' ] != 'number' ) { ?> type="text" <?php } else if ( $field[ 'type' ] == 'email' ) { ?> type="email" <?php } else { ?> type="number" <?php } ?> value="<?php if ( isset( $_POST[ $field[ 'merge' ] ] ) && $form_submitted != 1 ) { echo $_POST[ $field[ 'merge' ] ]; } else { echo esc_attr( $default_value ); } ?>"> |
|
516 | 516 | |
517 | 517 | <!-- description --> |
518 | - <?php if( isset( $field['description'] ) && trim( $field['description'] ) != '' ) { ?> |
|
518 | + <?php if ( isset( $field[ 'description' ] ) && trim( $field[ 'description' ] ) != '' ) { ?> |
|
519 | 519 | <p class="form-field-description"> |
520 | 520 | <small> |
521 | - <?php echo apply_filters( 'yikes-mailchimp-' . $field['merge'] . '-description', esc_attr( stripslashes( $field['description'] ) ), $form_id ); ?> |
|
521 | + <?php echo apply_filters( 'yikes-mailchimp-' . $field[ 'merge' ] . '-description', esc_attr( stripslashes( $field[ 'description' ] ) ), $form_id ); ?> |
|
522 | 522 | </small> |
523 | 523 | </p> |
524 | 524 | <?php } ?> |
@@ -530,7 +530,7 @@ discard block |
||
530 | 530 | |
531 | 531 | case 'url': |
532 | 532 | case 'imageurl': |
533 | - $default_value = ( isset( $field['default'] ) ) ? $field['default'] : ''; |
|
533 | + $default_value = ( isset( $field[ 'default' ] ) ) ? $field[ 'default' ] : ''; |
|
534 | 534 | ?> |
535 | 535 | |
536 | 536 | <script type="text/javascript"> |
@@ -545,22 +545,22 @@ discard block |
||
545 | 545 | } |
546 | 546 | </script> |
547 | 547 | |
548 | - <label for="<?php echo $field['merge']; ?>" <?php echo implode( ' ' , $label_array ); ?>> |
|
548 | + <label for="<?php echo $field[ 'merge' ]; ?>" <?php echo implode( ' ', $label_array ); ?>> |
|
549 | 549 | |
550 | 550 | <!-- dictate label visibility --> |
551 | - <?php if( !isset( $field['hide-label'] ) ) { ?> |
|
552 | - <span class="<?php echo esc_attr( $field['merge'] ) . '-label'; ?>"> |
|
553 | - <?php echo apply_filters( 'yikes-mailchimp-'.$field['merge'].'-label' , esc_attr( stripslashes( $field['label'] ) ) ); ?> |
|
551 | + <?php if ( ! isset( $field[ 'hide-label' ] ) ) { ?> |
|
552 | + <span class="<?php echo esc_attr( $field[ 'merge' ] ) . '-label'; ?>"> |
|
553 | + <?php echo apply_filters( 'yikes-mailchimp-' . $field[ 'merge' ] . '-label', esc_attr( stripslashes( $field[ 'label' ] ) ) ); ?> |
|
554 | 554 | </span> |
555 | 555 | <?php } ?> |
556 | 556 | |
557 | - <input <?php echo implode( ' ' , $field_array ); ?> type="url" <?php if( $field['type'] == 'url' ) { ?> title="<?php _e( 'Please enter a valid URL to the website.' , 'yikes-inc-easy-mailchimp-extender' ); ?>" <?php } else { ?> title="<?php _e( 'Please enter a valid URL to the image.' , 'yikes-inc-easy-mailchimp-extender' ); ?>" <?php } ?> value="<?php if( isset( $_POST[$field['merge']] ) && $form_submitted != 1 ) { echo $_POST[$field['merge']]; } else { echo esc_attr( $default_value ); } ?>" onblur="properlyFormatURLField(this);return false;"> |
|
557 | + <input <?php echo implode( ' ', $field_array ); ?> type="url" <?php if ( $field[ 'type' ] == 'url' ) { ?> title="<?php _e( 'Please enter a valid URL to the website.', 'yikes-inc-easy-mailchimp-extender' ); ?>" <?php } else { ?> title="<?php _e( 'Please enter a valid URL to the image.', 'yikes-inc-easy-mailchimp-extender' ); ?>" <?php } ?> value="<?php if ( isset( $_POST[ $field[ 'merge' ] ] ) && $form_submitted != 1 ) { echo $_POST[ $field[ 'merge' ] ]; } else { echo esc_attr( $default_value ); } ?>" onblur="properlyFormatURLField(this);return false;"> |
|
558 | 558 | |
559 | 559 | <!-- description --> |
560 | - <?php if( isset( $field['description'] ) && trim( $field['description'] ) != '' ) { ?> |
|
560 | + <?php if ( isset( $field[ 'description' ] ) && trim( $field[ 'description' ] ) != '' ) { ?> |
|
561 | 561 | <p class="form-field-description"> |
562 | 562 | <small> |
563 | - <?php echo apply_filters( 'yikes-mailchimp-' . $field['merge'] . '-description', esc_attr( stripslashes( $field['description'] ) ), $form_id ); ?> |
|
563 | + <?php echo apply_filters( 'yikes-mailchimp-' . $field[ 'merge' ] . '-description', esc_attr( stripslashes( $field[ 'description' ] ) ), $form_id ); ?> |
|
564 | 564 | </small> |
565 | 565 | </p> |
566 | 566 | <?php } ?> |
@@ -571,8 +571,8 @@ discard block |
||
571 | 571 | break; |
572 | 572 | |
573 | 573 | case 'phone': |
574 | - $default_value = ( isset( $field['default'] ) ? esc_attr( $field['default'] ) : '' ); |
|
575 | - $phone_format = $field['phone_format']; |
|
574 | + $default_value = ( isset( $field[ 'default' ] ) ? esc_attr( $field[ 'default' ] ) : '' ); |
|
575 | + $phone_format = $field[ 'phone_format' ]; |
|
576 | 576 | ?> |
577 | 577 | <script type="text/javascript"> |
578 | 578 | /* Replace incorrect values and format it correctly for MailChimp API */ |
@@ -585,22 +585,22 @@ discard block |
||
585 | 585 | } |
586 | 586 | </script> |
587 | 587 | |
588 | - <label for="<?php echo $field['merge']; ?>" <?php echo implode( ' ' , $label_array ); ?>> |
|
588 | + <label for="<?php echo $field[ 'merge' ]; ?>" <?php echo implode( ' ', $label_array ); ?>> |
|
589 | 589 | |
590 | 590 | <!-- dictate label visibility --> |
591 | - <?php if( !isset( $field['hide-label'] ) ) { ?> |
|
592 | - <span class="<?php echo esc_attr( $field['merge'] ) . '-label'; ?>"> |
|
593 | - <?php echo apply_filters( 'yikes-mailchimp-'.$field['merge'].'-label' , esc_attr( stripslashes( $field['label'] ) ) ); ?> |
|
591 | + <?php if ( ! isset( $field[ 'hide-label' ] ) ) { ?> |
|
592 | + <span class="<?php echo esc_attr( $field[ 'merge' ] ) . '-label'; ?>"> |
|
593 | + <?php echo apply_filters( 'yikes-mailchimp-' . $field[ 'merge' ] . '-label', esc_attr( stripslashes( $field[ 'label' ] ) ) ); ?> |
|
594 | 594 | </span> |
595 | 595 | <?php } ?> |
596 | 596 | |
597 | - <input <?php echo implode( ' ' , $field_array ); ?> type="text" <?php if( $phone_format != 'US' ) { ?> title="<?php _e( 'International Phone Number' , 'yikes-inc-easy-mailchimp-extender' ); ?>" pattern="<?php echo apply_filters( 'yikes-mailchimp-international-phone-pattern' , '[0-9,-]{1,}' ); ?>" <?php } else { ?> title="<?php _e( 'US Phone Number (###) ### - ####' , 'yikes-inc-easy-mailchimp-extender' ); ?>" pattern="<?php echo apply_filters( 'yikes-mailchimp-us-phone-pattern' , '^(\([0-9]{3}\)|[0-9]{3}-)[0-9]{3}-[0-9]{4}$' ); ?>" onblur="formatUSPhoneNumber(this);"<?php } ?> value="<?php if( isset( $_POST[$field['merge']] ) && $form_submitted != 1 ) { echo $_POST[$field['merge']]; } else { echo esc_attr( $default_value ); } ?>"> |
|
597 | + <input <?php echo implode( ' ', $field_array ); ?> type="text" <?php if ( $phone_format != 'US' ) { ?> title="<?php _e( 'International Phone Number', 'yikes-inc-easy-mailchimp-extender' ); ?>" pattern="<?php echo apply_filters( 'yikes-mailchimp-international-phone-pattern', '[0-9,-]{1,}' ); ?>" <?php } else { ?> title="<?php _e( 'US Phone Number (###) ### - ####', 'yikes-inc-easy-mailchimp-extender' ); ?>" pattern="<?php echo apply_filters( 'yikes-mailchimp-us-phone-pattern', '^(\([0-9]{3}\)|[0-9]{3}-)[0-9]{3}-[0-9]{4}$' ); ?>" onblur="formatUSPhoneNumber(this);"<?php } ?> value="<?php if ( isset( $_POST[ $field[ 'merge' ] ] ) && $form_submitted != 1 ) { echo $_POST[ $field[ 'merge' ] ]; } else { echo esc_attr( $default_value ); } ?>"> |
|
598 | 598 | |
599 | 599 | <!-- description --> |
600 | - <?php if( isset( $field['description'] ) && trim( $field['description'] ) != '' ) { ?> |
|
600 | + <?php if ( isset( $field[ 'description' ] ) && trim( $field[ 'description' ] ) != '' ) { ?> |
|
601 | 601 | <p class="form-field-description"> |
602 | 602 | <small> |
603 | - <?php echo apply_filters( 'yikes-mailchimp-' . esc_attr( $field['merge'] ) . '-description', stripslashes( $field['description'] ), $form_id ); ?> |
|
603 | + <?php echo apply_filters( 'yikes-mailchimp-' . esc_attr( $field[ 'merge' ] ) . '-description', stripslashes( $field[ 'description' ] ), $form_id ); ?> |
|
604 | 604 | </small> |
605 | 605 | </p> |
606 | 606 | <?php } ?> |
@@ -610,25 +610,25 @@ discard block |
||
610 | 610 | break; |
611 | 611 | |
612 | 612 | case 'zip': |
613 | - $default_value = ( isset( $field['default'] ) ? esc_attr( $field['default'] ) : '' ); |
|
613 | + $default_value = ( isset( $field[ 'default' ] ) ? esc_attr( $field[ 'default' ] ) : '' ); |
|
614 | 614 | |
615 | 615 | ?> |
616 | - <label for="<?php echo $field['merge']; ?>" <?php echo implode( ' ' , $label_array ); ?>> |
|
616 | + <label for="<?php echo $field[ 'merge' ]; ?>" <?php echo implode( ' ', $label_array ); ?>> |
|
617 | 617 | |
618 | 618 | <!-- dictate label visibility --> |
619 | - <?php if( ! isset( $field['hide-label'] ) ) { ?> |
|
620 | - <span class="<?php echo esc_attr( $field['merge'] ) . '-label'; ?>"> |
|
621 | - <?php echo apply_filters( 'yikes-mailchimp-'.$field['merge'].'-label' , esc_attr( stripslashes( $field['label'] ) ) ); ?> |
|
619 | + <?php if ( ! isset( $field[ 'hide-label' ] ) ) { ?> |
|
620 | + <span class="<?php echo esc_attr( $field[ 'merge' ] ) . '-label'; ?>"> |
|
621 | + <?php echo apply_filters( 'yikes-mailchimp-' . $field[ 'merge' ] . '-label', esc_attr( stripslashes( $field[ 'label' ] ) ) ); ?> |
|
622 | 622 | </span> |
623 | 623 | <?php } ?> |
624 | 624 | |
625 | - <input <?php echo implode( ' ' , $field_array ); ?> type="text" pattern="\d{5,5}(-\d{4,4})?" title="<?php _e( '5 digit zip code, numbers only' , 'yikes-inc-easy-mailchimp-extender' ); ?>" value="<?php if( isset( $_POST[$field['merge']] ) && $form_submitted != 1 ) { echo $_POST[$field['merge']]; } else { echo esc_attr( $default_value ); } ?>"> |
|
625 | + <input <?php echo implode( ' ', $field_array ); ?> type="text" pattern="\d{5,5}(-\d{4,4})?" title="<?php _e( '5 digit zip code, numbers only', 'yikes-inc-easy-mailchimp-extender' ); ?>" value="<?php if ( isset( $_POST[ $field[ 'merge' ] ] ) && $form_submitted != 1 ) { echo $_POST[ $field[ 'merge' ] ]; } else { echo esc_attr( $default_value ); } ?>"> |
|
626 | 626 | |
627 | 627 | <!-- description --> |
628 | - <?php if( isset( $field['description'] ) ) { ?> |
|
628 | + <?php if ( isset( $field[ 'description' ] ) ) { ?> |
|
629 | 629 | <p class="form-field-description"> |
630 | 630 | <small> |
631 | - <?php echo apply_filters( 'yikes-mailchimp-' . $field['merge'] . '-description', esc_attr( stripslashes( $field['description'] ) ), $form_id ); ?> |
|
631 | + <?php echo apply_filters( 'yikes-mailchimp-' . $field[ 'merge' ] . '-description', esc_attr( stripslashes( $field[ 'description' ] ) ), $form_id ); ?> |
|
632 | 632 | </small> |
633 | 633 | </p> |
634 | 634 | <?php } ?> |
@@ -640,28 +640,28 @@ discard block |
||
640 | 640 | |
641 | 641 | case 'address': |
642 | 642 | // required fields |
643 | - $required_fields = array( 'addr1' => 'address' , 'addr2' => 'address 2', 'city' => 'city', 'state' =>'state', 'zip' =>'zip' , 'country' => 'country' ); |
|
643 | + $required_fields = array( 'addr1' => 'address', 'addr2' => 'address 2', 'city' => 'city', 'state' =>'state', 'zip' =>'zip', 'country' => 'country' ); |
|
644 | 644 | |
645 | 645 | // setup the default country value |
646 | 646 | $default_country = apply_filters( 'yikes-mailchimp-default-country-value', 'US' ); |
647 | 647 | |
648 | 648 | // store number for looping |
649 | 649 | $x = 1; |
650 | - foreach( $required_fields as $type => $label ) { |
|
650 | + foreach ( $required_fields as $type => $label ) { |
|
651 | 651 | |
652 | 652 | // set the field names for the addrress fields |
653 | - $field_array['name'] = 'name="'.$field[$tag].'['.$type.']'.'"'; |
|
653 | + $field_array[ 'name' ] = 'name="' . $field[ $tag ] . '[' . $type . ']' . '"'; |
|
654 | 654 | |
655 | 655 | // reset the label classes for left-half/right-half for addresses |
656 | - if( isset( $label_array['class'] ) ) { |
|
656 | + if ( isset( $label_array[ 'class' ] ) ) { |
|
657 | 657 | if ( $x % 2 == 0 ) { |
658 | - $label_array['class'] = str_replace( 'field-left-half', 'field-right-half', $label_array['class'] ); |
|
658 | + $label_array[ 'class' ] = str_replace( 'field-left-half', 'field-right-half', $label_array[ 'class' ] ); |
|
659 | 659 | } else { |
660 | - $label_array['class'] = str_replace( 'field-right-half', 'field-left-half', $label_array['class'] ); |
|
660 | + $label_array[ 'class' ] = str_replace( 'field-right-half', 'field-left-half', $label_array[ 'class' ] ); |
|
661 | 661 | } |
662 | 662 | } |
663 | 663 | |
664 | - switch( $type ) { |
|
664 | + switch ( $type ) { |
|
665 | 665 | |
666 | 666 | default: |
667 | 667 | case 'addr1': |
@@ -670,17 +670,17 @@ discard block |
||
670 | 670 | |
671 | 671 | |
672 | 672 | ?> |
673 | - <label for="<?php echo $field['merge']; ?>" data-attr-name="<?php echo esc_attr( $type ); ?>-field" <?php echo implode( ' ' , $label_array ); ?>> |
|
673 | + <label for="<?php echo $field[ 'merge' ]; ?>" data-attr-name="<?php echo esc_attr( $type ); ?>-field" <?php echo implode( ' ', $label_array ); ?>> |
|
674 | 674 | |
675 | 675 | <!-- dictate label visibility --> |
676 | - <?php if( ! isset( $field['hide-label'] ) ) { ?> |
|
677 | - <span class="<?php echo esc_attr( $field['merge'] ) . '-label'; ?>"> |
|
678 | - <?php echo ucwords( apply_filters( 'yikes-mailchimp-address-'.$type.'-label' , esc_attr( $label ) ) ); ?> |
|
676 | + <?php if ( ! isset( $field[ 'hide-label' ] ) ) { ?> |
|
677 | + <span class="<?php echo esc_attr( $field[ 'merge' ] ) . '-label'; ?>"> |
|
678 | + <?php echo ucwords( apply_filters( 'yikes-mailchimp-address-' . $type . '-label', esc_attr( $label ) ) ); ?> |
|
679 | 679 | </span> |
680 | 680 | <?php } ?> |
681 | 681 | |
682 | 682 | |
683 | - <input <?php echo implode( ' ' , $field_array ); ?> type="text" value="<?php if( isset( $_POST[$field['merge']] ) && $form_submitted != 1 ) { echo $_POST[$field['merge']]; } ?>"> |
|
683 | + <input <?php echo implode( ' ', $field_array ); ?> type="text" value="<?php if ( isset( $_POST[ $field[ 'merge' ] ] ) && $form_submitted != 1 ) { echo $_POST[ $field[ 'merge' ] ]; } ?>"> |
|
684 | 684 | |
685 | 685 | </label> |
686 | 686 | <?php |
@@ -690,16 +690,16 @@ discard block |
||
690 | 690 | case 'state': |
691 | 691 | |
692 | 692 | ?> |
693 | - <label for="<?php echo $field['merge']; ?>" <?php echo implode( ' ' , $label_array ); ?> data-attr-name="state-dropdown"<?php if( ! in_array( $default_country, array( 'US' ) ) ) { ?> style="display: none;"<?php } ?>> |
|
693 | + <label for="<?php echo $field[ 'merge' ]; ?>" <?php echo implode( ' ', $label_array ); ?> data-attr-name="state-dropdown"<?php if ( ! in_array( $default_country, array( 'US' ) ) ) { ?> style="display: none;"<?php } ?>> |
|
694 | 694 | |
695 | 695 | <!-- dictate label visibility --> |
696 | - <?php if( ! isset( $field['hide-label'] ) ) { ?> |
|
697 | - <span class="<?php echo esc_attr( $field['merge'] ) . '-label'; ?>"> |
|
698 | - <?php echo ucwords( apply_filters( 'yikes-mailchimp-address-'.$type.'-label' , esc_attr( $label ) ) ); ?> |
|
696 | + <?php if ( ! isset( $field[ 'hide-label' ] ) ) { ?> |
|
697 | + <span class="<?php echo esc_attr( $field[ 'merge' ] ) . '-label'; ?>"> |
|
698 | + <?php echo ucwords( apply_filters( 'yikes-mailchimp-address-' . $type . '-label', esc_attr( $label ) ) ); ?> |
|
699 | 699 | </span> |
700 | 700 | <?php } ?> |
701 | 701 | |
702 | - <select <?php echo implode( ' ' , $field_array ); ?>> |
|
702 | + <select <?php echo implode( ' ', $field_array ); ?>> |
|
703 | 703 | <?php include( YIKES_MC_PATH . 'public/partials/shortcodes/templates/state-dropdown.php' ); ?> |
704 | 704 | </select> |
705 | 705 | |
@@ -712,29 +712,29 @@ discard block |
||
712 | 712 | case 'zip': |
713 | 713 | |
714 | 714 | ?> |
715 | - <label for="<?php echo $field['merge']; ?>" <?php echo implode( ' ' , $label_array ); ?> data-attr-name="zip-input"<?php if( ! in_array( $default_country, array( 'US', 'GB' ) ) ) { ?> style="display: none;"<?php } ?>> |
|
715 | + <label for="<?php echo $field[ 'merge' ]; ?>" <?php echo implode( ' ', $label_array ); ?> data-attr-name="zip-input"<?php if ( ! in_array( $default_country, array( 'US', 'GB' ) ) ) { ?> style="display: none;"<?php } ?>> |
|
716 | 716 | |
717 | - <?php if( ! isset( $field['hide-label'] ) ) { ?> |
|
718 | - <span class="<?php echo esc_attr( $field['merge'] ) . '-label'; ?>"> |
|
719 | - <?php echo ucwords( apply_filters( 'yikes-mailchimp-address-'.$type.'-label' , esc_attr( $label ) ) ); ?> |
|
717 | + <?php if ( ! isset( $field[ 'hide-label' ] ) ) { ?> |
|
718 | + <span class="<?php echo esc_attr( $field[ 'merge' ] ) . '-label'; ?>"> |
|
719 | + <?php echo ucwords( apply_filters( 'yikes-mailchimp-address-' . $type . '-label', esc_attr( $label ) ) ); ?> |
|
720 | 720 | </span> |
721 | 721 | <?php } ?> |
722 | 722 | |
723 | 723 | <?php |
724 | 724 | // If zip lookup plugin is installed, the ZIP field comes back as an array and we need to handle it differently... |
725 | 725 | $zip_value_to_echo = ''; |
726 | - if( isset( $_POST[$field['merge']] ) && $form_submitted != 1 ) { |
|
727 | - if ( is_array( $_POST[$field['merge']] ) && isset( $_POST[$field['merge']]['zip'] ) ) { |
|
728 | - $zip_value_to_echo = $_POST[$field['merge']]['zip']; |
|
726 | + if ( isset( $_POST[ $field[ 'merge' ] ] ) && $form_submitted != 1 ) { |
|
727 | + if ( is_array( $_POST[ $field[ 'merge' ] ] ) && isset( $_POST[ $field[ 'merge' ] ][ 'zip' ] ) ) { |
|
728 | + $zip_value_to_echo = $_POST[ $field[ 'merge' ] ][ 'zip' ]; |
|
729 | 729 | } else { |
730 | - $zip_value_to_echo = $_POST[$field['merge']]; |
|
730 | + $zip_value_to_echo = $_POST[ $field[ 'merge' ] ]; |
|
731 | 731 | } |
732 | 732 | } else { |
733 | 733 | $zip_value_to_echo = esc_attr( $default_value ); |
734 | 734 | } |
735 | 735 | ?> |
736 | 736 | |
737 | - <input <?php echo implode( ' ' , $field_array ); ?> type="text" pattern="<?php echo apply_filters( 'yikes-mailchimp-zip-pattern', '\d{5,5}(-\d{4,4})?' ); ?>" title="<?php _e( '5 digit zip code, numbers only' , 'yikes-inc-easy-mailchimp-extender' ); ?>" value="<?php echo $zip_value_to_echo ?>"> |
|
737 | + <input <?php echo implode( ' ', $field_array ); ?> type="text" pattern="<?php echo apply_filters( 'yikes-mailchimp-zip-pattern', '\d{5,5}(-\d{4,4})?' ); ?>" title="<?php _e( '5 digit zip code, numbers only', 'yikes-inc-easy-mailchimp-extender' ); ?>" value="<?php echo $zip_value_to_echo ?>"> |
|
738 | 738 | |
739 | 739 | </label> |
740 | 740 | <?php |
@@ -772,16 +772,16 @@ discard block |
||
772 | 772 | $default_country = apply_filters( 'yikes-mailchimp-default-country-value', 'US' ); |
773 | 773 | ?> |
774 | 774 | |
775 | - <label for="<?php echo $field['merge']; ?>" data-attr-name="<?php echo esc_attr( $type ); ?>-field" <?php echo implode( ' ' , $label_array ); ?>> |
|
775 | + <label for="<?php echo $field[ 'merge' ]; ?>" data-attr-name="<?php echo esc_attr( $type ); ?>-field" <?php echo implode( ' ', $label_array ); ?>> |
|
776 | 776 | |
777 | 777 | <!-- dictate label visibility --> |
778 | - <?php if( !isset( $field['hide-label'] ) ) { ?> |
|
779 | - <span class="<?php echo esc_attr( $field['merge'] ) . '-label'; ?>"> |
|
780 | - <?php echo ucwords( apply_filters( 'yikes-mailchimp-address-'.$type.'-label' , esc_attr( $label ) ) ); ?> |
|
778 | + <?php if ( ! isset( $field[ 'hide-label' ] ) ) { ?> |
|
779 | + <span class="<?php echo esc_attr( $field[ 'merge' ] ) . '-label'; ?>"> |
|
780 | + <?php echo ucwords( apply_filters( 'yikes-mailchimp-address-' . $type . '-label', esc_attr( $label ) ) ); ?> |
|
781 | 781 | </span> |
782 | 782 | <?php } ?> |
783 | 783 | |
784 | - <select <?php echo implode( ' ' , $field_array ); ?> onchange="checkCountry(this);return false;"> |
|
784 | + <select <?php echo implode( ' ', $field_array ); ?> onchange="checkCountry(this);return false;"> |
|
785 | 785 | <?php include( YIKES_MC_PATH . 'public/partials/shortcodes/templates/country-dropdown.php' ); ?> |
786 | 786 | </select> |
787 | 787 | </label> |
@@ -792,10 +792,10 @@ discard block |
||
792 | 792 | } |
793 | 793 | |
794 | 794 | // description |
795 | - if( isset( $field['description'] ) && trim( $field['description'] ) != '' ) { ?> |
|
795 | + if ( isset( $field[ 'description' ] ) && trim( $field[ 'description' ] ) != '' ) { ?> |
|
796 | 796 | <p class="form-field-description"> |
797 | 797 | <small> |
798 | - <?php echo apply_filters( 'yikes-mailchimp-' . $field['merge'] . '-description', esc_attr( trim( stripslashes( $field['description'] ) ) ), $form_id ); ?> |
|
798 | + <?php echo apply_filters( 'yikes-mailchimp-' . $field[ 'merge' ] . '-description', esc_attr( trim( stripslashes( $field[ 'description' ] ) ) ), $form_id ); ?> |
|
799 | 799 | </small> |
800 | 800 | </p> |
801 | 801 | <?php } |
@@ -805,19 +805,19 @@ discard block |
||
805 | 805 | case 'birthday': |
806 | 806 | |
807 | 807 | // bootstrap datepicker requirements |
808 | - wp_enqueue_script( 'bootstrap-hover-dropdown' , YIKES_MC_URL . 'public/js/bootstrap-hover-dropdown.min.js' , array( 'jquery' ) ); |
|
809 | - wp_enqueue_script( 'bootstrap-datepicker-script' , YIKES_MC_URL . 'public/js/bootstrap-datepicker.min.js' , array( 'jquery' , 'bootstrap-hover-dropdown' ) ); |
|
810 | - wp_enqueue_style( 'bootstrap-datepicker-styles' , YIKES_MC_URL . 'public/css/bootstrap-datepicker3.standalone.min.css' ); |
|
811 | - wp_enqueue_style( 'override-datepicker-styles' , YIKES_MC_URL . 'public/css/yikes-inc-easy-mailchimp-datepicker-styles.css' , array( 'bootstrap-datepicker-styles' ) ); |
|
808 | + wp_enqueue_script( 'bootstrap-hover-dropdown', YIKES_MC_URL . 'public/js/bootstrap-hover-dropdown.min.js', array( 'jquery' ) ); |
|
809 | + wp_enqueue_script( 'bootstrap-datepicker-script', YIKES_MC_URL . 'public/js/bootstrap-datepicker.min.js', array( 'jquery', 'bootstrap-hover-dropdown' ) ); |
|
810 | + wp_enqueue_style( 'bootstrap-datepicker-styles', YIKES_MC_URL . 'public/css/bootstrap-datepicker3.standalone.min.css' ); |
|
811 | + wp_enqueue_style( 'override-datepicker-styles', YIKES_MC_URL . 'public/css/yikes-inc-easy-mailchimp-datepicker-styles.css', array( 'bootstrap-datepicker-styles' ) ); |
|
812 | 812 | |
813 | - switch ( $field['type'] ) { |
|
813 | + switch ( $field[ 'type' ] ) { |
|
814 | 814 | default: |
815 | 815 | case 'date': |
816 | - $date_format = ( isset( $field['date_format'] ) ) ? $field['date_format'] : 'mm/dd'; |
|
816 | + $date_format = ( isset( $field[ 'date_format' ] ) ) ? $field[ 'date_format' ] : 'mm/dd'; |
|
817 | 817 | break; |
818 | 818 | |
819 | 819 | case 'birthday': |
820 | - $date_format = ( isset( $field['date_format'] ) ) ? strtolower( $field['date_format'] ) : 'mm/dd'; |
|
820 | + $date_format = ( isset( $field[ 'date_format' ] ) ) ? strtolower( $field[ 'date_format' ] ) : 'mm/dd'; |
|
821 | 821 | break; |
822 | 822 | } |
823 | 823 | // initialize the datepicker |
@@ -828,7 +828,7 @@ discard block |
||
828 | 828 | padding: .85em .5em !important; |
829 | 829 | } |
830 | 830 | <?php |
831 | - if( wp_is_mobile() ) { |
|
831 | + if ( wp_is_mobile() ) { |
|
832 | 832 | ?> |
833 | 833 | .datepicker-dropdown { |
834 | 834 | margin-top: 0px; |
@@ -844,7 +844,7 @@ discard block |
||
844 | 844 | $day_names = array_values( $wp_locale->weekday ); |
845 | 845 | $day_names_short = array_values( $wp_locale->weekday_abbrev ); |
846 | 846 | $day_names_min = array_values( $wp_locale->weekday_initial ); |
847 | - $date_format = $admin_class->yikes_jQuery_datepicker_date_format_php_to_js( $date_format, $field['type'] ); |
|
847 | + $date_format = $admin_class->yikes_jQuery_datepicker_date_format_php_to_js( $date_format, $field[ 'type' ] ); |
|
848 | 848 | $first_day = get_option( 'start_of_week' ); |
849 | 849 | $isRTL = $wp_locale->is_rtl(); |
850 | 850 | ?> |
@@ -865,10 +865,10 @@ discard block |
||
865 | 865 | numberOfMonths: 1, |
866 | 866 | today: '<?php _e( 'Today', 'yikes-inc-easy-mailchimp-extender' ); ?>' |
867 | 867 | }; |
868 | - jQuery('input[data-attr-type="<?php echo $field['type']; ?>"]').datepicker().on( 'show', function( e ) { |
|
869 | - var date_picker_height = jQuery('input[data-attr-type="<?php echo $field['type']; ?>"]').css( 'height' ); |
|
868 | + jQuery('input[data-attr-type="<?php echo $field[ 'type' ]; ?>"]').datepicker().on( 'show', function( e ) { |
|
869 | + var date_picker_height = jQuery('input[data-attr-type="<?php echo $field[ 'type' ]; ?>"]').css( 'height' ); |
|
870 | 870 | date_picker_height = parseInt( date_picker_height.replace( 'px', '' ) ) + parseInt( 15 ) + 'px'; |
871 | - var date_picker_width = jQuery('input[data-attr-type="<?php echo $field['type']; ?>"]').css( 'width' ).replace( 'px', '' ); |
|
871 | + var date_picker_width = jQuery('input[data-attr-type="<?php echo $field[ 'type' ]; ?>"]').css( 'width' ).replace( 'px', '' ); |
|
872 | 872 | if( date_picker_width > 500 ) { |
873 | 873 | date_picker_width = 500; |
874 | 874 | } |
@@ -878,27 +878,27 @@ discard block |
||
878 | 878 | </script> |
879 | 879 | <?php |
880 | 880 | |
881 | - $default_value = ( isset( $field['default'] ) ? esc_attr( $field['default'] ) : '' ); |
|
881 | + $default_value = ( isset( $field[ 'default' ] ) ? esc_attr( $field[ 'default' ] ) : '' ); |
|
882 | 882 | // store empty number for looping |
883 | 883 | $x = 0; |
884 | 884 | |
885 | 885 | ?> |
886 | - <label for="<?php echo esc_attr( $field['merge'] ); ?>" <?php echo implode( ' ' , $label_array ); ?>> |
|
886 | + <label for="<?php echo esc_attr( $field[ 'merge' ] ); ?>" <?php echo implode( ' ', $label_array ); ?>> |
|
887 | 887 | |
888 | 888 | <!-- dictate label visibility --> |
889 | - <?php if( !isset( $field['hide-label'] ) ) { ?> |
|
890 | - <span class="<?php echo esc_attr( $field['merge'] ) . '-label'; ?>"> |
|
891 | - <?php echo apply_filters( 'yikes-mailchimp-'.$field['merge'].'-label' , esc_attr( stripslashes( $field['label'] ) ) ); ?> |
|
889 | + <?php if ( ! isset( $field[ 'hide-label' ] ) ) { ?> |
|
890 | + <span class="<?php echo esc_attr( $field[ 'merge' ] ) . '-label'; ?>"> |
|
891 | + <?php echo apply_filters( 'yikes-mailchimp-' . $field[ 'merge' ] . '-label', esc_attr( stripslashes( $field[ 'label' ] ) ) ); ?> |
|
892 | 892 | </span> |
893 | 893 | <?php } ?> |
894 | 894 | |
895 | - <input <?php echo implode( ' ' , $field_array ); ?> type="text" <?php if( $field['type'] == 'date' ) { ?> data-attr-type="date" <?php } else { ?> data-attr-type="birthday" <?php } ?> value="<?php if( isset( $_POST[$field['merge']] ) && $form_submitted != 1 ) { echo $_POST[$field['merge']]; } else { echo esc_attr( $default_value ); } ?>"> |
|
895 | + <input <?php echo implode( ' ', $field_array ); ?> type="text" <?php if ( $field[ 'type' ] == 'date' ) { ?> data-attr-type="date" <?php } else { ?> data-attr-type="birthday" <?php } ?> value="<?php if ( isset( $_POST[ $field[ 'merge' ] ] ) && $form_submitted != 1 ) { echo $_POST[ $field[ 'merge' ] ]; } else { echo esc_attr( $default_value ); } ?>"> |
|
896 | 896 | |
897 | 897 | <!-- description --> |
898 | - <?php if( isset( $field['description'] ) && trim( $field['description'] ) != '' ) { ?> |
|
898 | + <?php if ( isset( $field[ 'description' ] ) && trim( $field[ 'description' ] ) != '' ) { ?> |
|
899 | 899 | <p class="form-field-description"> |
900 | 900 | <small> |
901 | - <?php echo apply_filters( 'yikes-mailchimp-' . $field['merge'] . '-description', esc_attr( trim( stripslashes( $field['description'] ) ) ), $form_id ); ?> |
|
901 | + <?php echo apply_filters( 'yikes-mailchimp-' . $field[ 'merge' ] . '-description', esc_attr( trim( stripslashes( $field[ 'description' ] ) ) ), $form_id ); ?> |
|
902 | 902 | </small> |
903 | 903 | </p> |
904 | 904 | <?php } ?> |
@@ -909,36 +909,36 @@ discard block |
||
909 | 909 | break; |
910 | 910 | |
911 | 911 | case 'dropdown': |
912 | - $default_value = $field['default_choice']; |
|
912 | + $default_value = $field[ 'default_choice' ]; |
|
913 | 913 | // store empty number for looping |
914 | 914 | $x = 0; |
915 | 915 | // hidden labels |
916 | 916 | |
917 | 917 | ?> |
918 | - <label for="<?php echo esc_attr( $field['merge'] ); ?>" <?php echo implode( ' ' , $label_array ); ?>> |
|
918 | + <label for="<?php echo esc_attr( $field[ 'merge' ] ); ?>" <?php echo implode( ' ', $label_array ); ?>> |
|
919 | 919 | <!-- dictate label visibility --> |
920 | - <?php if( ! isset( $field['hide-label'] ) ) { ?> |
|
921 | - <span class="<?php echo esc_attr( $field['merge'] ) . '-label'; ?>"> |
|
922 | - <?php echo apply_filters( 'yikes-mailchimp-'.$field['merge'].'-label' , esc_attr( stripslashes( $field['label'] ) ) ); ?> |
|
920 | + <?php if ( ! isset( $field[ 'hide-label' ] ) ) { ?> |
|
921 | + <span class="<?php echo esc_attr( $field[ 'merge' ] ) . '-label'; ?>"> |
|
922 | + <?php echo apply_filters( 'yikes-mailchimp-' . $field[ 'merge' ] . '-label', esc_attr( stripslashes( $field[ 'label' ] ) ) ); ?> |
|
923 | 923 | </span> |
924 | 924 | <?php } ?> |
925 | 925 | |
926 | - <select <?php echo implode( ' ' , $field_array ); ?>> |
|
926 | + <select <?php echo implode( ' ', $field_array ); ?>> |
|
927 | 927 | <?php |
928 | 928 | // decode for looping |
929 | - $choices = json_decode( $field['choices'], true ); |
|
930 | - foreach( $choices as $choice ) { |
|
931 | - ?><option value="<?php echo $choice; ?>" <?php selected( $default_value , $x ); ?>><?php echo esc_attr( stripslashes( $choice ) ); ?></option><?php |
|
929 | + $choices = json_decode( $field[ 'choices' ], true ); |
|
930 | + foreach ( $choices as $choice ) { |
|
931 | + ?><option value="<?php echo $choice; ?>" <?php selected( $default_value, $x ); ?>><?php echo esc_attr( stripslashes( $choice ) ); ?></option><?php |
|
932 | 932 | $x++; |
933 | 933 | } |
934 | 934 | ?> |
935 | 935 | </select> |
936 | 936 | |
937 | 937 | <!-- description --> |
938 | - <?php if( isset( $field['description'] ) && trim( $field['description'] ) != '' ) { ?> |
|
938 | + <?php if ( isset( $field[ 'description' ] ) && trim( $field[ 'description' ] ) != '' ) { ?> |
|
939 | 939 | <p class="form-field-description"> |
940 | 940 | <small> |
941 | - <?php echo apply_filters( 'yikes-mailchimp-' . $field['merge'] . '-description', esc_attr( trim( stripslashes( $field['description'] ) ) ), $form_id ); ?> |
|
941 | + <?php echo apply_filters( 'yikes-mailchimp-' . $field[ 'merge' ] . '-description', esc_attr( trim( stripslashes( $field[ 'description' ] ) ) ), $form_id ); ?> |
|
942 | 942 | </small> |
943 | 943 | </p> |
944 | 944 | <?php } ?> |
@@ -952,13 +952,13 @@ discard block |
||
952 | 952 | case 'radio': |
953 | 953 | case 'checkbox': |
954 | 954 | // remove the ID (as to not assign the same ID to every radio button) |
955 | - unset( $field_array['id'] ); |
|
956 | - $choices = json_decode( $field['choices'], true ); |
|
955 | + unset( $field_array[ 'id' ] ); |
|
956 | + $choices = json_decode( $field[ 'choices' ], true ); |
|
957 | 957 | // assign a default choice |
958 | - $default_value = ( isset( $field['default_choice'] ) && $field['default_choice'] != '' ) ? $field['default_choice'] : $choices[0]; |
|
958 | + $default_value = ( isset( $field[ 'default_choice' ] ) && $field[ 'default_choice' ] != '' ) ? $field[ 'default_choice' ] : $choices[ 0 ]; |
|
959 | 959 | // if the form was submit, but failed, let's reset the post data |
960 | - if( isset( $_POST[$field['merge']] ) && $form_submitted != 1 ) { |
|
961 | - $default_value = $_POST[$field['merge']]; |
|
960 | + if ( isset( $_POST[ $field[ 'merge' ] ] ) && $form_submitted != 1 ) { |
|
961 | + $default_value = $_POST[ $field[ 'merge' ] ]; |
|
962 | 962 | } |
963 | 963 | $count = count( $choices ); |
964 | 964 | $i = 1; |
@@ -967,20 +967,20 @@ discard block |
||
967 | 967 | // hidden labels |
968 | 968 | |
969 | 969 | ?> |
970 | - <label for="<?php echo esc_attr( $field['merge'] ); ?>" <?php echo implode( ' ' , $label_array ); ?>> |
|
970 | + <label for="<?php echo esc_attr( $field[ 'merge' ] ); ?>" <?php echo implode( ' ', $label_array ); ?>> |
|
971 | 971 | |
972 | 972 | <!-- dictate label visibility --> |
973 | - <?php if( ! isset( $field['hide-label'] ) ) { ?> |
|
974 | - <span class="<?php echo esc_attr( $field['merge'] ). '-label'; ?> checkbox-parent-label"> |
|
975 | - <?php echo apply_filters( 'yikes-mailchimp-'.$field['merge'].'-label' , esc_attr( stripslashes( $field['label'] ) ) ); ?> |
|
973 | + <?php if ( ! isset( $field[ 'hide-label' ] ) ) { ?> |
|
974 | + <span class="<?php echo esc_attr( $field[ 'merge' ] ) . '-label'; ?> checkbox-parent-label"> |
|
975 | + <?php echo apply_filters( 'yikes-mailchimp-' . $field[ 'merge' ] . '-label', esc_attr( stripslashes( $field[ 'label' ] ) ) ); ?> |
|
976 | 976 | </span> |
977 | 977 | <?php } |
978 | 978 | |
979 | - foreach( $choices as $choice ) { |
|
979 | + foreach ( $choices as $choice ) { |
|
980 | 980 | ?> |
981 | - <label for="<?php echo esc_attr( $field['merge'] ) . '-' . $i; ?>" class="yikes-easy-mc-checkbox-label <?php echo implode( ' ' , $custom_classes ); if( $i === $count ) { ?> last-selection<?php } ?>" <?php if( $i == 1 ) { echo $field_array['required']; } ?>> |
|
982 | - <input type="<?php echo esc_attr( $field['type'] ); ?>" name="<?php echo $field['merge']; ?>" id="<?php echo $field['merge'] . '-' . $i; ?>" <?php checked( $default_value , $x ); ?> value="<?php echo esc_attr( $choice ); ?>"> |
|
983 | - <span class="<?php echo esc_attr( $field['merge'] ). '-label'; ?>"><?php echo stripslashes( $choice ); ?></span> |
|
981 | + <label for="<?php echo esc_attr( $field[ 'merge' ] ) . '-' . $i; ?>" class="yikes-easy-mc-checkbox-label <?php echo implode( ' ', $custom_classes ); if ( $i === $count ) { ?> last-selection<?php } ?>" <?php if ( $i == 1 ) { echo $field_array[ 'required' ]; } ?>> |
|
982 | + <input type="<?php echo esc_attr( $field[ 'type' ] ); ?>" name="<?php echo $field[ 'merge' ]; ?>" id="<?php echo $field[ 'merge' ] . '-' . $i; ?>" <?php checked( $default_value, $x ); ?> value="<?php echo esc_attr( $choice ); ?>"> |
|
983 | + <span class="<?php echo esc_attr( $field[ 'merge' ] ) . '-label'; ?>"><?php echo stripslashes( $choice ); ?></span> |
|
984 | 984 | </label> |
985 | 985 | <?php |
986 | 986 | $i++; |
@@ -988,10 +988,10 @@ discard block |
||
988 | 988 | } |
989 | 989 | |
990 | 990 | // description |
991 | - if( isset( $field['description'] ) && trim( $field['description'] ) != '' ) { ?> |
|
991 | + if ( isset( $field[ 'description' ] ) && trim( $field[ 'description' ] ) != '' ) { ?> |
|
992 | 992 | <p class="form-field-description"> |
993 | 993 | <small> |
994 | - <?php echo apply_filters( 'yikes-mailchimp-' . $field['merge'] . '-description', esc_attr( trim( stripslashes( $field['description'] ) ) ), $form_id ); ?> |
|
994 | + <?php echo apply_filters( 'yikes-mailchimp-' . $field[ 'merge' ] . '-description', esc_attr( trim( stripslashes( $field[ 'description' ] ) ) ), $form_id ); ?> |
|
995 | 995 | </small> |
996 | 996 | </p> |
997 | 997 | <?php } ?> |
@@ -1007,26 +1007,26 @@ discard block |
||
1007 | 1007 | |
1008 | 1008 | |
1009 | 1009 | // store default choice |
1010 | - $default_choice = ( isset( $field['default_choice'] ) && ! empty( $field['default_choice'] ) ) ? ( is_array( $field['default_choice'] ) ? $field['default_choice'] : $field['default_choice'] ) : ( isset( $field['default_choice'] ) ? $field['default_choice'] : '' ); |
|
1010 | + $default_choice = ( isset( $field[ 'default_choice' ] ) && ! empty( $field[ 'default_choice' ] ) ) ? ( is_array( $field[ 'default_choice' ] ) ? $field[ 'default_choice' ] : $field[ 'default_choice' ] ) : ( isset( $field[ 'default_choice' ] ) ? $field[ 'default_choice' ] : '' ); |
|
1011 | 1011 | |
1012 | 1012 | // if the form was submit, but failed, let's reset the post data |
1013 | - if( isset( $_POST[$field['group_id']] ) && $form_submitted != 1 ) { |
|
1014 | - $default_choice = $_POST[$field['group_id']]; |
|
1013 | + if ( isset( $_POST[ $field[ 'group_id' ] ] ) && $form_submitted != 1 ) { |
|
1014 | + $default_choice = $_POST[ $field[ 'group_id' ] ]; |
|
1015 | 1015 | } |
1016 | 1016 | |
1017 | 1017 | // get our groups |
1018 | - $groups = ( isset( $field['groups'] ) && ! empty( $field['groups'] ) ) ? json_decode( $field['groups'], true ) : array(); |
|
1018 | + $groups = ( isset( $field[ 'groups' ] ) && ! empty( $field[ 'groups' ] ) ) ? json_decode( $field[ 'groups' ], true ) : array(); |
|
1019 | 1019 | |
1020 | 1020 | $count = count( $groups ); |
1021 | 1021 | |
1022 | - if( $field['type'] == 'checkboxes' ) { |
|
1022 | + if ( $field[ 'type' ] == 'checkboxes' ) { |
|
1023 | 1023 | $type = 'checkbox'; |
1024 | - } else if( $field['type'] == 'radio' ) { |
|
1024 | + } else if ( $field[ 'type' ] == 'radio' ) { |
|
1025 | 1025 | $type = 'radio'; |
1026 | 1026 | } |
1027 | 1027 | |
1028 | 1028 | // loop over the interest group field types |
1029 | - switch ( $field['type'] ) { |
|
1029 | + switch ( $field[ 'type' ] ) { |
|
1030 | 1030 | |
1031 | 1031 | case 'checkboxes': |
1032 | 1032 | case 'radio': |
@@ -1034,18 +1034,18 @@ discard block |
||
1034 | 1034 | $x = 1; // used to find the last item of our array |
1035 | 1035 | |
1036 | 1036 | ?> |
1037 | - <label for="<?php echo esc_attr( $field['group_id'] ); ?>" <?php echo implode( ' ' , $label_array ); ?>> |
|
1038 | - <?php if( ! isset( $field['hide-label'] ) ) { ?> |
|
1037 | + <label for="<?php echo esc_attr( $field[ 'group_id' ] ); ?>" <?php echo implode( ' ', $label_array ); ?>> |
|
1038 | + <?php if ( ! isset( $field[ 'hide-label' ] ) ) { ?> |
|
1039 | 1039 | <!-- dictate label visibility --> |
1040 | - <span class="<?php echo esc_attr( $field['group_id'] ) . '-label'; ?> checkbox-parent-label"> |
|
1041 | - <?php echo apply_filters( 'yikes-mailchimp-'.$field['group_id'].'-label' , esc_attr( $field['label'] ) ); ?> |
|
1040 | + <span class="<?php echo esc_attr( $field[ 'group_id' ] ) . '-label'; ?> checkbox-parent-label"> |
|
1041 | + <?php echo apply_filters( 'yikes-mailchimp-' . $field[ 'group_id' ] . '-label', esc_attr( $field[ 'label' ] ) ); ?> |
|
1042 | 1042 | </span> |
1043 | 1043 | <?php |
1044 | 1044 | } |
1045 | 1045 | |
1046 | 1046 | // Display Submission Errors |
1047 | - if( ! empty( $missing_required_checkbox_interest_groups ) ) { |
|
1048 | - if( in_array( $field['group_id'], $missing_required_checkbox_interest_groups ) ) { |
|
1047 | + if ( ! empty( $missing_required_checkbox_interest_groups ) ) { |
|
1048 | + if ( in_array( $field[ 'group_id' ], $missing_required_checkbox_interest_groups ) ) { |
|
1049 | 1049 | ?> |
1050 | 1050 | <p class="yikes-mailchimp-required-interest-group-error"> |
1051 | 1051 | <?php echo apply_filters( 'yikes-mailchimp-interest-group-checkbox-error', __( 'This field is required.', 'yikes-inc-easy-mailchimp-extender' ), $form_id ); ?> |
@@ -1056,24 +1056,24 @@ discard block |
||
1056 | 1056 | |
1057 | 1057 | foreach ( $groups as $group_id => $name ) { |
1058 | 1058 | |
1059 | - if( $field['type'] == 'checkboxes' ) { |
|
1059 | + if ( $field[ 'type' ] == 'checkboxes' ) { |
|
1060 | 1060 | |
1061 | 1061 | /* Setup the defaults for this field - varies if the field was previously submitted */ |
1062 | - if( isset( $_POST[$field['group_id']] ) && $form_submitted != 1 ) { |
|
1062 | + if ( isset( $_POST[ $field[ 'group_id' ] ] ) && $form_submitted != 1 ) { |
|
1063 | 1063 | |
1064 | - $default_choice = $_POST[$field['group_id']]; |
|
1064 | + $default_choice = $_POST[ $field[ 'group_id' ] ]; |
|
1065 | 1065 | |
1066 | - } elseif( ( ! isset( $_POST['yikes-mailchimp-honeypot'] ) && $form_submitted != 1 ) || ( isset( $_POST['yikes-mailchimp-honeypot'] ) && $form_submitted == 1 ) ) { |
|
1066 | + } elseif ( ( ! isset( $_POST[ 'yikes-mailchimp-honeypot' ] ) && $form_submitted != 1 ) || ( isset( $_POST[ 'yikes-mailchimp-honeypot' ] ) && $form_submitted == 1 ) ) { |
|
1067 | 1067 | |
1068 | - $default_choice = ( isset( $field['default_choice'] ) && ! empty( $field['default_choice'] ) ) ? ( is_array( $field['default_choice'] ) ? $field['default_choice'] : $field['default_choice'] ) : array(); |
|
1068 | + $default_choice = ( isset( $field[ 'default_choice' ] ) && ! empty( $field[ 'default_choice' ] ) ) ? ( is_array( $field[ 'default_choice' ] ) ? $field[ 'default_choice' ] : $field[ 'default_choice' ] ) : array(); |
|
1069 | 1069 | |
1070 | 1070 | } |
1071 | 1071 | |
1072 | 1072 | } |
1073 | 1073 | |
1074 | 1074 | ?> |
1075 | - <label for="<?php echo $field['group_id'] . '-' . $i; ?>" class="yikes-easy-mc-checkbox-label <?php echo implode( ' ' , $custom_classes ); if( $x === $count ) { ?> last-selection<?php } ?>"> |
|
1076 | - <input <?php if( isset( $field['require'] ) && $field['require'] == 1 ) { ?> class="yikes-interest-group-required" <?php } ?> type="<?php echo $type; ?>" name="group-<?php echo $field['group_id']; ?>[]" id="<?php echo $field['group_id'] . '-' . $i; ?>" <?php if( $field['type'] == 'checkboxes' ) { if( ( ( isset( $_POST['yikes-mailchimp-honeypot' ] ) && $form_submitted == 1 && in_array( $i , $default_choice )) || ! isset( $_POST['yikes-mailchimp-honeypot' ] ) && $form_submitted != 1 && in_array( $i , $default_choice ) ) || ( ( $form_submitted != 1 && isset( $_POST[$field['group_id']] ) ) && in_array( esc_attr( $group['name'] ), $default_choice ) ) ) { echo 'checked="checked"'; } } else { checked( ( isset( $default_choice ) && is_array( $default_choice ) ) ? $default_choice[0] : $default_choice , $i ); } ?> value="<?php echo $group_id; ?>"> |
|
1075 | + <label for="<?php echo $field[ 'group_id' ] . '-' . $i; ?>" class="yikes-easy-mc-checkbox-label <?php echo implode( ' ', $custom_classes ); if ( $x === $count ) { ?> last-selection<?php } ?>"> |
|
1076 | + <input <?php if ( isset( $field[ 'require' ] ) && $field[ 'require' ] == 1 ) { ?> class="yikes-interest-group-required" <?php } ?> type="<?php echo $type; ?>" name="group-<?php echo $field[ 'group_id' ]; ?>[]" id="<?php echo $field[ 'group_id' ] . '-' . $i; ?>" <?php if ( $field[ 'type' ] == 'checkboxes' ) { if ( ( ( isset( $_POST[ 'yikes-mailchimp-honeypot' ] ) && $form_submitted == 1 && in_array( $i, $default_choice ) ) || ! isset( $_POST[ 'yikes-mailchimp-honeypot' ] ) && $form_submitted != 1 && in_array( $i, $default_choice ) ) || ( ( $form_submitted != 1 && isset( $_POST[ $field[ 'group_id' ] ] ) ) && in_array( esc_attr( $group[ 'name' ] ), $default_choice ) ) ) { echo 'checked="checked"'; } } else { checked( ( isset( $default_choice ) && is_array( $default_choice ) ) ? $default_choice[ 0 ] : $default_choice, $i ); } ?> value="<?php echo $group_id; ?>"> |
|
1077 | 1077 | <?php echo $name; ?> |
1078 | 1078 | </label> |
1079 | 1079 | <?php |
@@ -1082,10 +1082,10 @@ discard block |
||
1082 | 1082 | } |
1083 | 1083 | |
1084 | 1084 | // description |
1085 | - if( isset( $field['description'] ) && trim( $field['description'] ) != '' ) { ?> |
|
1085 | + if ( isset( $field[ 'description' ] ) && trim( $field[ 'description' ] ) != '' ) { ?> |
|
1086 | 1086 | <p class="form-field-description"> |
1087 | 1087 | <small> |
1088 | - <?php echo apply_filters( 'yikes-mailchimp-' . $field['group_id'] . '-description', esc_attr( trim( $field['description'] ) ), $form_id ); ?> |
|
1088 | + <?php echo apply_filters( 'yikes-mailchimp-' . $field[ 'group_id' ] . '-description', esc_attr( trim( $field[ 'description' ] ) ), $form_id ); ?> |
|
1089 | 1089 | </small> |
1090 | 1090 | </p> |
1091 | 1091 | <?php } ?> |
@@ -1099,28 +1099,28 @@ discard block |
||
1099 | 1099 | |
1100 | 1100 | ?> |
1101 | 1101 | |
1102 | - <label for="<?php echo esc_attr( $field['group_id'] ); ?>" <?php echo implode( ' ' , $label_array ); ?>> |
|
1102 | + <label for="<?php echo esc_attr( $field[ 'group_id' ] ); ?>" <?php echo implode( ' ', $label_array ); ?>> |
|
1103 | 1103 | <!-- dictate label visibility --> |
1104 | - <?php if( ! isset( $field['hide-label'] ) ) { ?> |
|
1105 | - <span class="<?php echo esc_attr( $field['group_id'] ) . '-label'; ?>"> |
|
1106 | - <?php echo apply_filters( 'yikes-mailchimp-'.$field['group_id'].'-label' , esc_attr( $field['label'] ) ); ?> |
|
1104 | + <?php if ( ! isset( $field[ 'hide-label' ] ) ) { ?> |
|
1105 | + <span class="<?php echo esc_attr( $field[ 'group_id' ] ) . '-label'; ?>"> |
|
1106 | + <?php echo apply_filters( 'yikes-mailchimp-' . $field[ 'group_id' ] . '-label', esc_attr( $field[ 'label' ] ) ); ?> |
|
1107 | 1107 | </span> |
1108 | 1108 | <?php } ?> |
1109 | 1109 | |
1110 | - <select <?php echo implode( ' ' , $field_array ); ?>> |
|
1110 | + <select <?php echo implode( ' ', $field_array ); ?>> |
|
1111 | 1111 | <?php |
1112 | 1112 | $i = 0; |
1113 | - foreach( $groups as $group_id => $name ) { |
|
1114 | - ?><option <?php selected( $i , $default_choice ); ?> value="<?php echo $group_id; ?>"><?php echo esc_attr( $name ); ?></option><?php |
|
1113 | + foreach ( $groups as $group_id => $name ) { |
|
1114 | + ?><option <?php selected( $i, $default_choice ); ?> value="<?php echo $group_id; ?>"><?php echo esc_attr( $name ); ?></option><?php |
|
1115 | 1115 | $i++; |
1116 | 1116 | } |
1117 | 1117 | ?> |
1118 | 1118 | </select> |
1119 | 1119 | |
1120 | - <?php if( isset( $field['description'] ) && trim( $field['description'] ) != '' ) { ?> |
|
1120 | + <?php if ( isset( $field[ 'description' ] ) && trim( $field[ 'description' ] ) != '' ) { ?> |
|
1121 | 1121 | <p class="form-field-description"> |
1122 | 1122 | <small> |
1123 | - <?php echo apply_filters( 'yikes-mailchimp-' . $field['group_id'] . '-description', esc_attr( trim( $field['description'] ) ), $form_id ); ?> |
|
1123 | + <?php echo apply_filters( 'yikes-mailchimp-' . $field[ 'group_id' ] . '-description', esc_attr( trim( $field[ 'description' ] ) ), $form_id ); ?> |
|
1124 | 1124 | </small> |
1125 | 1125 | </p> |
1126 | 1126 | <?php } ?> |
@@ -1137,21 +1137,21 @@ discard block |
||
1137 | 1137 | |
1138 | 1138 | ?> |
1139 | 1139 | |
1140 | - <label for="<?php echo esc_attr( $field['group_id'] ); ?>" <?php echo implode( ' ' , $label_array ); ?>> |
|
1140 | + <label for="<?php echo esc_attr( $field[ 'group_id' ] ); ?>" <?php echo implode( ' ', $label_array ); ?>> |
|
1141 | 1141 | |
1142 | 1142 | <!-- dictate label visibility --> |
1143 | - <?php if( ! isset( $field['hide-label'] ) ) { ?> |
|
1144 | - <span class="<?php echo esc_attr( $field['group_id'] ) . '-label'; ?> checkbox-parent-label" style="display:none;"> |
|
1145 | - <?php echo apply_filters( 'yikes-mailchimp-'.$field['group_id'].'-label' , esc_attr( stripslashes( $field['label'] ) ) ); ?> |
|
1143 | + <?php if ( ! isset( $field[ 'hide-label' ] ) ) { ?> |
|
1144 | + <span class="<?php echo esc_attr( $field[ 'group_id' ] ) . '-label'; ?> checkbox-parent-label" style="display:none;"> |
|
1145 | + <?php echo apply_filters( 'yikes-mailchimp-' . $field[ 'group_id' ] . '-label', esc_attr( stripslashes( $field[ 'label' ] ) ) ); ?> |
|
1146 | 1146 | </span> |
1147 | 1147 | <?php } |
1148 | 1148 | |
1149 | 1149 | |
1150 | - foreach( $groups as $group ) { |
|
1150 | + foreach ( $groups as $group ) { |
|
1151 | 1151 | ?> |
1152 | - <label for="<?php echo $field['group_id'] . '-' . $i; ?>" class="yikes-easy-mc-checkbox-label <?php echo implode( ' ' , $custom_classes ); if( $x === $count ) { ?> last-selection<?php } ?>" style="display:none;"> |
|
1153 | - <input type="radio" name="<?php echo $field['group_id']; ?>[]" id="<?php echo $field['group_id'] . '-' . $i; ?>" <?php if( $field['type'] == 'checkboxes' ) { if( in_array( $i , $default_choice ) ) { echo 'checked="checked"'; } } else { checked( ( isset( $default_choice ) && is_array( $default_choice ) ) ? $default_choice[0] : $default_choice , $i ); } ?> value="<?php echo esc_attr( $group['name'] ); ?>"> |
|
1154 | - <?php echo esc_attr( stripslashes( str_replace( '' , '\'', $group['name'] ) ) ); ?> |
|
1152 | + <label for="<?php echo $field[ 'group_id' ] . '-' . $i; ?>" class="yikes-easy-mc-checkbox-label <?php echo implode( ' ', $custom_classes ); if ( $x === $count ) { ?> last-selection<?php } ?>" style="display:none;"> |
|
1153 | + <input type="radio" name="<?php echo $field[ 'group_id' ]; ?>[]" id="<?php echo $field[ 'group_id' ] . '-' . $i; ?>" <?php if ( $field[ 'type' ] == 'checkboxes' ) { if ( in_array( $i, $default_choice ) ) { echo 'checked="checked"'; } } else { checked( ( isset( $default_choice ) && is_array( $default_choice ) ) ? $default_choice[ 0 ] : $default_choice, $i ); } ?> value="<?php echo esc_attr( $group[ 'name' ] ); ?>"> |
|
1154 | + <?php echo esc_attr( stripslashes( str_replace( '', '\'', $group[ 'name' ] ) ) ); ?> |
|
1155 | 1155 | </label> |
1156 | 1156 | <?php |
1157 | 1157 | $i++; |
@@ -1159,10 +1159,10 @@ discard block |
||
1159 | 1159 | } |
1160 | 1160 | |
1161 | 1161 | // description |
1162 | - if( isset( $field['description'] ) && trim( $field['description'] ) != '' ) { ?> |
|
1162 | + if ( isset( $field[ 'description' ] ) && trim( $field[ 'description' ] ) != '' ) { ?> |
|
1163 | 1163 | <p class="form-field-description"> |
1164 | 1164 | <small> |
1165 | - <?php echo apply_filters( 'yikes-mailchimp-' . $field['group_id'] . '-description', esc_attr( trim( stripslashes( $field['description'] ) ) ), $form_id ); ?> |
|
1165 | + <?php echo apply_filters( 'yikes-mailchimp-' . $field[ 'group_id' ] . '-description', esc_attr( trim( stripslashes( $field[ 'description' ] ) ) ), $form_id ); ?> |
|
1166 | 1166 | </small> |
1167 | 1167 | </p> |
1168 | 1168 | <?php } |
@@ -1179,11 +1179,11 @@ discard block |
||
1179 | 1179 | do_action( 'yikes-mailchimp-additional-form-fields', $form_data ); |
1180 | 1180 | |
1181 | 1181 | /* if we've enabled reCAPTCHA protection */ |
1182 | - if( isset( $recaptcha_box ) ) { |
|
1182 | + if ( isset( $recaptcha_box ) ) { |
|
1183 | 1183 | echo $recaptcha_box; |
1184 | 1184 | } |
1185 | - if( is_user_logged_in() ) { |
|
1186 | - $admin_class = ( current_user_can( apply_filters( 'yikes-mailchimp-user-role-access' , 'manage_options' ) ) ) ? ' admin-logged-in' : ''; |
|
1185 | + if ( is_user_logged_in() ) { |
|
1186 | + $admin_class = ( current_user_can( apply_filters( 'yikes-mailchimp-user-role-access', 'manage_options' ) ) ) ? ' admin-logged-in' : ''; |
|
1187 | 1187 | } else { |
1188 | 1188 | $admin_class = ''; |
1189 | 1189 | } |
@@ -1193,29 +1193,29 @@ discard block |
||
1193 | 1193 | <input type="hidden" name="yikes-mailchimp-honeypot" id="yikes-mailchimp-honeypot" value=""> |
1194 | 1194 | |
1195 | 1195 | <!-- List ID --> |
1196 | - <input type="hidden" name="yikes-mailchimp-associated-list-id" id="yikes-mailchimp-associated-list-id" value="<?php echo $form_data['list_id']; ?>"> |
|
1196 | + <input type="hidden" name="yikes-mailchimp-associated-list-id" id="yikes-mailchimp-associated-list-id" value="<?php echo $form_data[ 'list_id' ]; ?>"> |
|
1197 | 1197 | |
1198 | 1198 | <!-- Form that is being submitted! Used to display error/success messages above the correct form --> |
1199 | 1199 | <input type="hidden" name="yikes-mailchimp-submitted-form" id="yikes-mailchimp-submitted-form" value="<?php echo $form_id; ?>"> |
1200 | 1200 | |
1201 | 1201 | <!-- Submit Button --> |
1202 | 1202 | <?php |
1203 | - if( $form_inline ) { |
|
1203 | + if ( $form_inline ) { |
|
1204 | 1204 | $submit_button_label_classes = array( 'empty-label' ); |
1205 | 1205 | // If the number of fields, is equal to the hidden label count, add our class |
1206 | 1206 | // eg: All field labels are set to hidden. |
1207 | 1207 | if ( absint( $field_count ) === absint( $hidden_label_count ) ) { |
1208 | - $submit_button_label_classes[] = 'labels-hidden'; |
|
1208 | + $submit_button_label_classes[ ] = 'labels-hidden'; |
|
1209 | 1209 | } |
1210 | 1210 | echo '<label class="empty-form-inline-label submit-button-inline-label"><span class="' . implode( ' ', $submit_button_label_classes ) . '"> </span>'; |
1211 | 1211 | } |
1212 | 1212 | // display the image or text based button |
1213 | - if( $submit_button_type == 'text' ) { |
|
1214 | - echo apply_filters( 'yikes-mailchimp-form-submit-button', '<button type="submit" class="' . apply_filters( 'yikes-mailchimp-form-submit-button-classes', 'yikes-easy-mc-submit-button yikes-easy-mc-submit-button-' . esc_attr( $form_data['id'] ) . ' btn btn-primary' . $submit_button_classes . $admin_class, $form_data['id'] ) . '">' . apply_filters( 'yikes-mailchimp-form-submit-button-text', esc_attr( stripslashes( $submit ) ), $form_data['id'] ) . '</button>', $form_data['id'] ); |
|
1213 | + if ( $submit_button_type == 'text' ) { |
|
1214 | + echo apply_filters( 'yikes-mailchimp-form-submit-button', '<button type="submit" class="' . apply_filters( 'yikes-mailchimp-form-submit-button-classes', 'yikes-easy-mc-submit-button yikes-easy-mc-submit-button-' . esc_attr( $form_data[ 'id' ] ) . ' btn btn-primary' . $submit_button_classes . $admin_class, $form_data[ 'id' ] ) . '">' . apply_filters( 'yikes-mailchimp-form-submit-button-text', esc_attr( stripslashes( $submit ) ), $form_data[ 'id' ] ) . '</button>', $form_data[ 'id' ] ); |
|
1215 | 1215 | } else { |
1216 | - echo apply_filters( 'yikes-mailchimp-form-submit-button', '<input type="image" alt="' . apply_filters( 'yikes-mailchimp-form-submit-button-text', esc_attr( stripslashes( $submit ) ), $form_data['id'] ) . '" src="' . $submit_button_image . '" class="' . apply_filters( 'yikes-mailchimp-form-submit-button-classes', 'yikes-easy-mc-submit-button yikes-easy-mc-submit-button-image yikes-easy-mc-submit-button-' . esc_attr( $form_data['id'] ) . ' btn btn-primary' . $submit_button_classes . $admin_class, $form_data['id'] ) . '">', $form_data['id'] ); |
|
1216 | + echo apply_filters( 'yikes-mailchimp-form-submit-button', '<input type="image" alt="' . apply_filters( 'yikes-mailchimp-form-submit-button-text', esc_attr( stripslashes( $submit ) ), $form_data[ 'id' ] ) . '" src="' . $submit_button_image . '" class="' . apply_filters( 'yikes-mailchimp-form-submit-button-classes', 'yikes-easy-mc-submit-button yikes-easy-mc-submit-button-image yikes-easy-mc-submit-button-' . esc_attr( $form_data[ 'id' ] ) . ' btn btn-primary' . $submit_button_classes . $admin_class, $form_data[ 'id' ] ) . '">', $form_data[ 'id' ] ); |
|
1217 | 1217 | } |
1218 | - if( $form_inline ) { |
|
1218 | + if ( $form_inline ) { |
|
1219 | 1219 | echo '</label>'; |
1220 | 1220 | } |
1221 | 1221 | ?> |
@@ -1227,8 +1227,8 @@ discard block |
||
1227 | 1227 | |
1228 | 1228 | <?php |
1229 | 1229 | /* If the current user is logged in, and an admin...lets display our 'Edit Form' link */ |
1230 | - if( is_user_logged_in() ) { |
|
1231 | - if( current_user_can( apply_filters( 'yikes-mailchimp-user-role-access' , 'manage_options' ) ) ) { |
|
1230 | + if ( is_user_logged_in() ) { |
|
1231 | + if ( current_user_can( apply_filters( 'yikes-mailchimp-user-role-access', 'manage_options' ) ) ) { |
|
1232 | 1232 | echo $edit_form_link; |
1233 | 1233 | } |
1234 | 1234 | } |
@@ -1244,7 +1244,7 @@ discard block |
||
1244 | 1244 | * for non-admins |
1245 | 1245 | */ |
1246 | 1246 | if ( ! current_user_can( 'manage_options' ) ) { |
1247 | - $impressions = $form_data['impressions'] + 1; |
|
1247 | + $impressions = $form_data[ 'impressions' ] + 1; |
|
1248 | 1248 | $interface->update_form_field( $form_id, 'impressions', $impressions ); |
1249 | 1249 | } |
1250 | 1250 |
@@ -24,8 +24,8 @@ discard block |
||
24 | 24 | |
25 | 25 | |
26 | 26 | /** |
27 | - * Outputs a checkbox, if user is not already subscribed |
|
28 | - */ |
|
27 | + * Outputs a checkbox, if user is not already subscribed |
|
28 | + */ |
|
29 | 29 | public function output_checkbox( $comment_field ) { |
30 | 30 | if( $this->is_user_already_subscribed( $this->type ) == '1' ) { |
31 | 31 | return $comment_field; |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | * a new comment is submitted |
41 | 41 | * |
42 | 42 | * @since 6.0.0 |
43 | - **/ |
|
43 | + **/ |
|
44 | 44 | public function subscribe_from_comment( $comment_id , $comment_approved ) { |
45 | 45 | // was sign-up checkbox checked? |
46 | 46 | if ( $this->was_checkbox_checked( $this->type ) === false ) { |
@@ -13,7 +13,7 @@ discard block |
||
13 | 13 | // declare our integration type |
14 | 14 | protected $type = 'comment_form'; |
15 | 15 | |
16 | - public function __construct() { |
|
16 | + public function __construct() { |
|
17 | 17 | // hooks for outputting the checkbox |
18 | 18 | add_action( 'thesis_hook_after_comment_box', array( $this, 'output_checkbox' ), 10 ); |
19 | 19 | add_action( 'comment_form_field_comment', array( $this, 'output_checkbox' ), 10 ); |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | * |
42 | 42 | * @since 6.0.0 |
43 | 43 | **/ |
44 | - public function subscribe_from_comment( $comment_id , $comment_approved ) { |
|
44 | + public function subscribe_from_comment( $comment_id , $comment_approved ) { |
|
45 | 45 | // was sign-up checkbox checked? |
46 | 46 | if ( $this->was_checkbox_checked( $this->type ) === false ) { |
47 | 47 | return false; |
@@ -6,7 +6,7 @@ discard block |
||
6 | 6 | */ |
7 | 7 | |
8 | 8 | // Prevent direct access to the file |
9 | - defined('ABSPATH') or die( __( "Whoops, you shouldn't be accessing this file directly. Abort!" , 'yikes-inc-easy-mailchimp-extender' ) ); |
|
9 | + defined( 'ABSPATH' ) or die( __( "Whoops, you shouldn't be accessing this file directly. Abort!", 'yikes-inc-easy-mailchimp-extender' ) ); |
|
10 | 10 | |
11 | 11 | class Yikes_Easy_MC_Comment_Checkbox_Class extends Yikes_Easy_MC_Checkbox_Integration_Class { |
12 | 12 | |
@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | * |
43 | 43 | * @since 6.0.0 |
44 | 44 | **/ |
45 | - public function subscribe_from_comment( $comment_id , $comment_approved ) { |
|
45 | + public function subscribe_from_comment( $comment_id, $comment_approved ) { |
|
46 | 46 | // was sign-up checkbox checked? |
47 | 47 | if ( $this->was_checkbox_checked( $this->type ) === false ) { |
48 | 48 | return false; |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | 'OPTIN_IP' => $comment_data->comment_author_IP, |
60 | 60 | ); |
61 | 61 | // subscribe the user |
62 | - $this->subscribe_user_integration( sanitize_email( $comment_data->comment_author_email ) , $this->type , $merge_vars ); |
|
62 | + $this->subscribe_user_integration( sanitize_email( $comment_data->comment_author_email ), $this->type, $merge_vars ); |
|
63 | 63 | } |
64 | 64 | |
65 | 65 | } |
@@ -65,17 +65,17 @@ |
||
65 | 65 | } |
66 | 66 | |
67 | 67 | /** |
68 | - * @param int $order_id |
|
69 | - */ |
|
68 | + * @param int $order_id |
|
69 | + */ |
|
70 | 70 | public function save_woocommerce_checkout_checkbox_value( $order_id ) { |
71 | 71 | // update the order post meta |
72 | 72 | update_post_meta( $order_id, 'yikes_easy_mailchimp_optin', $this->was_checkbox_checked( $this->type ) ); |
73 | 73 | } |
74 | 74 | |
75 | 75 | /** |
76 | - * @param int $order_id |
|
77 | - * @return boolean |
|
78 | - */ |
|
76 | + * @param int $order_id |
|
77 | + * @return boolean |
|
78 | + */ |
|
79 | 79 | public function subscribe_from_woocommerce_checkout( $order_id ) { |
80 | 80 | $do_optin = get_post_meta( $order_id, 'yikes_easy_mailchimp_optin', true ); |
81 | 81 | if( $do_optin == '1' ) { |
@@ -8,7 +8,7 @@ discard block |
||
8 | 8 | */ |
9 | 9 | |
10 | 10 | // Prevent direct access to the file |
11 | -defined('ABSPATH') or die( __( "Whoops, you shouldn't be accessing this file directly. Abort!" , 'yikes-inc-easy-mailchimp-extender' ) ); |
|
11 | +defined( 'ABSPATH' ) or die( __( "Whoops, you shouldn't be accessing this file directly. Abort!", 'yikes-inc-easy-mailchimp-extender' ) ); |
|
12 | 12 | |
13 | 13 | class Yikes_Easy_MC_WooCommerce_Checkbox_Class extends Yikes_Easy_MC_Checkbox_Integration_Class { |
14 | 14 | |
@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | */ |
33 | 33 | public function get_position() { |
34 | 34 | $opts = $this->get_options(); |
35 | - return $opts['woocommerce_position']; |
|
35 | + return $opts[ 'woocommerce_position' ]; |
|
36 | 36 | } |
37 | 37 | |
38 | 38 | /** |
@@ -42,22 +42,22 @@ discard block |
||
42 | 42 | */ |
43 | 43 | public function add_checkout_field( $fields ) { |
44 | 44 | // get checkbox data |
45 | - $checkbox_options = get_option( 'optin-checkbox-init' , '' ); |
|
45 | + $checkbox_options = get_option( 'optin-checkbox-init', '' ); |
|
46 | 46 | // only display the field if a list is set |
47 | - if( isset( $checkbox_options ) && $checkbox_options[$this->type]['associated-list'] != '-' ) { |
|
48 | - if( $this->is_user_already_subscribed( $this->type ) ) { |
|
47 | + if ( isset( $checkbox_options ) && $checkbox_options[ $this->type ][ 'associated-list' ] != '-' ) { |
|
48 | + if ( $this->is_user_already_subscribed( $this->type ) ) { |
|
49 | 49 | return $fields; |
50 | 50 | } |
51 | - if( isset( $checkbox_options[$this->type]['precheck'] ) && $checkbox_options[$this->type]['precheck'] == 'true' ) { |
|
51 | + if ( isset( $checkbox_options[ $this->type ][ 'precheck' ] ) && $checkbox_options[ $this->type ][ 'precheck' ] == 'true' ) { |
|
52 | 52 | $precheck = '1'; |
53 | 53 | } else { |
54 | 54 | $precheck = '0'; |
55 | 55 | } |
56 | - $fields[ 'billing' ]['yikes_mailchimp_checkbox_'.$this->type] = array( |
|
57 | - 'id' => 'yikes_mailchimp_checkbox_'.$this->type, |
|
56 | + $fields[ 'billing' ][ 'yikes_mailchimp_checkbox_' . $this->type ] = array( |
|
57 | + 'id' => 'yikes_mailchimp_checkbox_' . $this->type, |
|
58 | 58 | 'type' => 'checkbox', |
59 | 59 | 'class' => array(), |
60 | - 'label' => $checkbox_options[$this->type]['label'], |
|
60 | + 'label' => $checkbox_options[ $this->type ][ 'label' ], |
|
61 | 61 | 'default' => $precheck, |
62 | 62 | ); |
63 | 63 | } |
@@ -78,7 +78,7 @@ discard block |
||
78 | 78 | */ |
79 | 79 | public function subscribe_from_woocommerce_checkout( $order_id ) { |
80 | 80 | $do_optin = get_post_meta( $order_id, 'yikes_easy_mailchimp_optin', true ); |
81 | - if( $do_optin == '1' ) { |
|
81 | + if ( $do_optin == '1' ) { |
|
82 | 82 | $order = new WC_Order( $order_id ); |
83 | 83 | $email = $order->billing_email; |
84 | 84 | $merge_vars = array( |
@@ -87,7 +87,7 @@ discard block |
||
87 | 87 | 'LNAME' => $order->billing_last_name, |
88 | 88 | ); |
89 | 89 | // subscribe the user |
90 | - $this->subscribe_user_integration( sanitize_email( $email ) , $this->type , $merge_vars ); |
|
90 | + $this->subscribe_user_integration( sanitize_email( $email ), $this->type, $merge_vars ); |
|
91 | 91 | } |
92 | 92 | return false; |
93 | 93 | } |