@@ -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 --> |
@@ -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 | ?> |
@@ -24,8 +24,8 @@ discard block |
||
| 24 | 24 | } |
| 25 | 25 | |
| 26 | 26 | /** |
| 27 | - * Outputs a checkbox |
|
| 28 | - */ |
|
| 27 | + * Outputs a checkbox |
|
| 28 | + */ |
|
| 29 | 29 | public function output_checkbox() { |
| 30 | 30 | echo $this->yikes_get_checkbox(); |
| 31 | 31 | } |
@@ -36,7 +36,7 @@ discard block |
||
| 36 | 36 | * @param int $user_id |
| 37 | 37 | * |
| 38 | 38 | * @return bool|string |
| 39 | - */ |
|
| 39 | + */ |
|
| 40 | 40 | public function subscribe_from_registration( $user_id ) { |
| 41 | 41 | // was sign-up checkbox checked? |
| 42 | 42 | if ( $this->was_checkbox_checked( $this->type ) === false ) { |
@@ -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_Registration_Checkbox_Class extends Yikes_Easy_MC_Checkbox_Integration_Class { |
| 14 | 14 | |
@@ -20,7 +20,7 @@ discard block |
||
| 20 | 20 | add_action( 'register_form', array( $this, 'output_checkbox' ), 20 ); |
| 21 | 21 | add_action( 'user_register', array( $this, 'subscribe_from_registration' ), 90, 1 ); |
| 22 | 22 | // alter the error message, if there was an error with the users email address |
| 23 | - add_filter( 'wp_login_errors', array( $this , 'yikes_reg_complete_msg' ), 10, 2 ); |
|
| 23 | + add_filter( 'wp_login_errors', array( $this, 'yikes_reg_complete_msg' ), 10, 2 ); |
|
| 24 | 24 | } |
| 25 | 25 | |
| 26 | 26 | /** |
@@ -52,11 +52,11 @@ discard block |
||
| 52 | 52 | $merge_variables = $this->user_merge_vars( $user ); |
| 53 | 53 | // only subscribe the user if they aren't already on the list |
| 54 | 54 | if ( $this->is_user_already_subscribed( 'registration_form', $user->user_email ) === false ) { |
| 55 | - $this->subscribe_user_integration( sanitize_email( $user->user_email ) , $this->type , $merge_variables ); |
|
| 55 | + $this->subscribe_user_integration( sanitize_email( $user->user_email ), $this->type, $merge_variables ); |
|
| 56 | 56 | } else { |
| 57 | 57 | // add a temporary option to pass our email address and let the user know they are already subscribed |
| 58 | - $user_already_subscribed_message = sprintf( __( "You have not been subscribed to our mailing list. %s is already subscribed to this list.", "yikes-inc-easy-mailchimp-extender" ), $user->user_email ); |
|
| 59 | - add_option( 'yikes_register_subscription_error' , $user_already_subscribed_message ); |
|
| 58 | + $user_already_subscribed_message = sprintf( __( "You have not been subscribed to our mailing list. %s is already subscribed to this list.", "yikes-inc-easy-mailchimp-extender" ), $user->user_email ); |
|
| 59 | + add_option( 'yikes_register_subscription_error', $user_already_subscribed_message ); |
|
| 60 | 60 | } |
| 61 | 61 | } |
| 62 | 62 | |
@@ -11,7 +11,7 @@ discard block |
||
| 11 | 11 | * |
| 12 | 12 | * @since 6.0.0 |
| 13 | 13 | */ |
| 14 | -function yksemeProcessSnippet( $list=false, $submit_text ) { |
|
| 14 | +function yksemeProcessSnippet( $list = false, $submit_text ) { |
|
| 15 | 15 | $submit_text = ( isset( $submit_text ) ) ? 'submit="' . $submit_text . '"' : ''; |
| 16 | 16 | return do_shortcode( '[yikes-mailchimp form="' . $list . '" ' . $submit_text . ']' ); |
| 17 | 17 | } |
@@ -21,7 +21,7 @@ discard block |
||
| 21 | 21 | * @since 6.0.3.4 |
| 22 | 22 | */ |
| 23 | 23 | function yikes_get_form_data( $form_id ) { |
| 24 | - if( ! $form_id ) { |
|
| 24 | + if ( ! $form_id ) { |
|
| 25 | 25 | return __( 'Whoops, you forgot to specify a form ID.', 'yikes-inc-easy-mailchimp-extender' ); |
| 26 | 26 | } |
| 27 | 27 | return Yikes_Inc_Easy_Mailchimp_Extender_Public::yikes_retrieve_form_settings( $form_id ); |
@@ -32,7 +32,7 @@ |
||
| 32 | 32 | |
| 33 | 33 | <div class="addon-footer-wrap give-clearfix"> |
| 34 | 34 | <a href="<?php echo esc_attr( $permalink ); ?>" title="<?php echo esc_attr( $add_on_title ); ?>" class="button-secondary" target="_blank"> |
| 35 | - <?php esc_attr_e( 'View Add-on' , 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
| 35 | + <?php esc_attr_e( 'View Add-on', 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
| 36 | 36 | <span class="dashicons dashicons-external"></span></a> |
| 37 | 37 | </div> |
| 38 | 38 | |
@@ -3,15 +3,15 @@ discard block |
||
| 3 | 3 | $form_interface = yikes_easy_mailchimp_extender_get_form_interface(); |
| 4 | 4 | $all_forms = $form_interface->get_all_forms(); |
| 5 | 5 | ?> |
| 6 | -<h3><span><?php _e( 'Import/Export Forms & Settings' , 'yikes-inc-easy-mailchimp-extender' ); ?></span></h3> |
|
| 6 | +<h3><span><?php _e( 'Import/Export Forms & Settings', 'yikes-inc-easy-mailchimp-extender' ); ?></span></h3> |
|
| 7 | 7 | |
| 8 | 8 | <div class="inside"> |
| 9 | 9 | |
| 10 | 10 | <!-- Export Form --> |
| 11 | - <form action="<?php echo esc_url_raw( add_query_arg( array( 'action' => 'yikes-easy-mc-export-forms' , 'nonce' => wp_create_nonce( 'export-forms' ) ) ) ); ?>" method="post"> |
|
| 12 | - <p><strong><?php _e( "Export Forms" , 'yikes-inc-easy-mailchimp-extender' ); ?></strong></p> |
|
| 11 | + <form action="<?php echo esc_url_raw( add_query_arg( array( 'action' => 'yikes-easy-mc-export-forms', 'nonce' => wp_create_nonce( 'export-forms' ) ) ) ); ?>" method="post"> |
|
| 12 | + <p><strong><?php _e( "Export Forms", 'yikes-inc-easy-mailchimp-extender' ); ?></strong></p> |
|
| 13 | 13 | <p class="description"> |
| 14 | - <?php _e( "Select the forms you would like to export. When you click the download button below, Easy Forms for MailChimp will create a CSV file for you to save to your computer. Once you've saved the download file, you can use the Import tool to import the forms to this or any other site." , "yikes-inc-easy-mailchimp-extender" ); ?> |
|
| 14 | + <?php _e( "Select the forms you would like to export. When you click the download button below, Easy Forms for MailChimp will create a CSV file for you to save to your computer. Once you've saved the download file, you can use the Import tool to import the forms to this or any other site.", "yikes-inc-easy-mailchimp-extender" ); ?> |
|
| 15 | 15 | </p> |
| 16 | 16 | |
| 17 | 17 | <?php if ( empty( $all_forms ) ) { ?> |
@@ -20,44 +20,44 @@ discard block |
||
| 20 | 20 | </p> |
| 21 | 21 | <?php } else { ?> |
| 22 | 22 | <!-- custom list so users can export specific forms --> |
| 23 | - <a class="toggle-custom-lists button-secondary" onclick="jQuery(this).next().slideToggle();return false;"><?php _e( 'Select Forms' , 'yikes-inc-easy-mailchimp-extender' ); ?></a> |
|
| 23 | + <a class="toggle-custom-lists button-secondary" onclick="jQuery(this).next().slideToggle();return false;"><?php _e( 'Select Forms', 'yikes-inc-easy-mailchimp-extender' ); ?></a> |
|
| 24 | 24 | <ul class="export-custom-forms-list"> |
| 25 | - <p class="description"><?php _e( 'Select which forms to export. Leave all checkboxes unchecked to export all of your forms.' , 'yikes-inc-easy-mailchimp-extender' ); ?></p> |
|
| 26 | - <?php foreach( $all_forms as $id => $form ) { ?> |
|
| 27 | - <li><label><input type="checkbox" name="export_forms[]" value="<?php echo (int) $id; ?>"><?php echo esc_html( $form['form_name'] ); ?></label></li> |
|
| 25 | + <p class="description"><?php _e( 'Select which forms to export. Leave all checkboxes unchecked to export all of your forms.', 'yikes-inc-easy-mailchimp-extender' ); ?></p> |
|
| 26 | + <?php foreach ( $all_forms as $id => $form ) { ?> |
|
| 27 | + <li><label><input type="checkbox" name="export_forms[]" value="<?php echo (int) $id; ?>"><?php echo esc_html( $form[ 'form_name' ] ); ?></label></li> |
|
| 28 | 28 | <?php } ?> |
| 29 | 29 | </ul> |
| 30 | 30 | <?php } ?> |
| 31 | 31 | <!-- check if any of our transients contain data --> |
| 32 | - <p><input type="submit" class="button-primary" value="<?php _e( 'Export Opt-in Forms' , 'yikes-inc-easy-mailchimp-extender' ); ?>" /></p> |
|
| 32 | + <p><input type="submit" class="button-primary" value="<?php _e( 'Export Opt-in Forms', 'yikes-inc-easy-mailchimp-extender' ); ?>" /></p> |
|
| 33 | 33 | </form> |
| 34 | 34 | |
| 35 | 35 | <hr /> |
| 36 | 36 | |
| 37 | 37 | <!-- Export Form --> |
| 38 | - <form action="<?php echo esc_url_raw( add_query_arg( array( 'action' => 'yikes-easy-mc-export-settings' , 'nonce' => wp_create_nonce( 'export-settings' ) ) ) ); ?>" method="post"> |
|
| 39 | - <p><strong><?php _e( "Export Settings" , 'yikes-inc-easy-mailchimp-extender' ); ?></strong></p> |
|
| 38 | + <form action="<?php echo esc_url_raw( add_query_arg( array( 'action' => 'yikes-easy-mc-export-settings', 'nonce' => wp_create_nonce( 'export-settings' ) ) ) ); ?>" method="post"> |
|
| 39 | + <p><strong><?php _e( "Export Settings", 'yikes-inc-easy-mailchimp-extender' ); ?></strong></p> |
|
| 40 | 40 | <p class="description"> |
| 41 | - <?php _e( "Export YIKES Easy Forms for MailChimp plugin settings." , 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
| 41 | + <?php _e( "Export YIKES Easy Forms for MailChimp plugin settings.", 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
| 42 | 42 | </p> |
| 43 | 43 | |
| 44 | 44 | <!-- check if any of our transients contain data --> |
| 45 | - <p><input type="submit" class="button-primary" value="<?php _e( 'Export Plugin Settings' , 'yikes-inc-easy-mailchimp-extender' ); ?>" /></p> |
|
| 45 | + <p><input type="submit" class="button-primary" value="<?php _e( 'Export Plugin Settings', 'yikes-inc-easy-mailchimp-extender' ); ?>" /></p> |
|
| 46 | 46 | </form> |
| 47 | 47 | |
| 48 | 48 | <hr /> |
| 49 | 49 | |
| 50 | 50 | <!-- Import Form --> |
| 51 | - <form action="<?php echo esc_url_raw( add_query_arg( array( 'action' => 'yikes-easy-mc-import-forms' , 'nonce' => wp_create_nonce( 'import-forms' ) ) ) ); ?>" method="post" enctype="multipart/form-data"> |
|
| 52 | - <p><strong><?php _e( "Import" , 'yikes-inc-easy-mailchimp-extender' ); ?></strong></p> |
|
| 51 | + <form action="<?php echo esc_url_raw( add_query_arg( array( 'action' => 'yikes-easy-mc-import-forms', 'nonce' => wp_create_nonce( 'import-forms' ) ) ) ); ?>" method="post" enctype="multipart/form-data"> |
|
| 52 | + <p><strong><?php _e( "Import", 'yikes-inc-easy-mailchimp-extender' ); ?></strong></p> |
|
| 53 | 53 | <p class="description"> |
| 54 | - <?php _e( "Select the Easy Forms for MailChimp export file you would like to import. You can use this field to import your opt-in forms or settings. " , 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
| 54 | + <?php _e( "Select the Easy Forms for MailChimp export file you would like to import. You can use this field to import your opt-in forms or settings. ", 'yikes-inc-easy-mailchimp-extender' ); ?> |
|
| 55 | 55 | </p> |
| 56 | 56 | <label> |
| 57 | 57 | <input type="file" name="csv" id="forms_to_import"> |
| 58 | 58 | </label> |
| 59 | 59 | <!-- check if any of our transients contain data --> |
| 60 | - <p><input type="submit" class="button-primary" value="<?php _e( 'Import' , 'yikes-inc-easy-mailchimp-extender' ); ?>" /></p> |
|
| 60 | + <p><input type="submit" class="button-primary" value="<?php _e( 'Import', 'yikes-inc-easy-mailchimp-extender' ); ?>" /></p> |
|
| 61 | 61 | </form> |
| 62 | 62 | |
| 63 | 63 | </div> <!-- .inside --> |
@@ -9,14 +9,14 @@ discard block |
||
| 9 | 9 | * @table_name - table name to impot data to |
| 10 | 10 | */ |
| 11 | 11 | public static function yikes_mailchimp_import_forms( $csv_file ) { |
| 12 | - if ( ! isset( $_REQUEST['action'] ) || $_REQUEST['action'] !== 'yikes-easy-mc-import-forms' ) { |
|
| 12 | + if ( ! isset( $_REQUEST[ 'action' ] ) || $_REQUEST[ 'action' ] !== 'yikes-easy-mc-import-forms' ) { |
|
| 13 | 13 | wp_die( __( 'There was an error during import. If you continue to run into issues, please reach out to the Yikes Inc. support team.', 'yikes-inc-easy-mailchimp-extender' ) ); |
| 14 | 14 | } |
| 15 | 15 | |
| 16 | - $name = $csv_file['csv']['name']; |
|
| 16 | + $name = $csv_file[ 'csv' ][ 'name' ]; |
|
| 17 | 17 | $ext_array = explode( '.', $name ); |
| 18 | 18 | $ext = end( $ext_array ); |
| 19 | - $tmp_name = $csv_file['csv']['tmp_name']; |
|
| 19 | + $tmp_name = $csv_file[ 'csv' ][ 'tmp_name' ]; |
|
| 20 | 20 | |
| 21 | 21 | // Ensure we have a valid file extension. |
| 22 | 22 | if ( 'csv' !== $ext ) { |
@@ -41,17 +41,17 @@ discard block |
||
| 41 | 41 | |
| 42 | 42 | // Check if this is a settings import by confirming the first option is 'yikes-mc-api-key' |
| 43 | 43 | // @todo: this should be a separate method. |
| 44 | - if( $line[0] == 'yikes-mc-api-key' ) { |
|
| 45 | - $options = fgetcsv($file, 10000, ','); |
|
| 44 | + if ( $line[ 0 ] == 'yikes-mc-api-key' ) { |
|
| 45 | + $options = fgetcsv( $file, 10000, ',' ); |
|
| 46 | 46 | $new_settings = array(); |
| 47 | 47 | $x = 0; |
| 48 | 48 | // build our new array $key => $value pair |
| 49 | - foreach( $line as $option_name ) { |
|
| 50 | - $new_settings[$option_name] = $options[$x]; |
|
| 49 | + foreach ( $line as $option_name ) { |
|
| 50 | + $new_settings[ $option_name ] = $options[ $x ]; |
|
| 51 | 51 | $x++; |
| 52 | 52 | } |
| 53 | 53 | // update the options in the databse |
| 54 | - foreach( $new_settings as $option_name => $option_value ) { |
|
| 54 | + foreach ( $new_settings as $option_name => $option_value ) { |
|
| 55 | 55 | update_option( $option_name, $option_value ); |
| 56 | 56 | } |
| 57 | 57 | } else { // if it's not, then it's an opt-in forms import |
@@ -80,7 +80,7 @@ discard block |
||
| 80 | 80 | $row++; |
| 81 | 81 | } |
| 82 | 82 | |
| 83 | - fclose($file); |
|
| 83 | + fclose( $file ); |
|
| 84 | 84 | } |
| 85 | 85 | |
| 86 | 86 | /* |
@@ -91,20 +91,20 @@ discard block |
||
| 91 | 91 | */ |
| 92 | 92 | public static function yikes_mailchimp_import_type( $csv_file ) { |
| 93 | 93 | // confirm |
| 94 | - if( isset( $_REQUEST['action'] ) && $_REQUEST['action'] == 'yikes-easy-mc-import-forms' ) { |
|
| 95 | - $name = $csv_file['csv']['name']; |
|
| 96 | - $ext_array = explode('.', $name); |
|
| 94 | + if ( isset( $_REQUEST[ 'action' ] ) && $_REQUEST[ 'action' ] == 'yikes-easy-mc-import-forms' ) { |
|
| 95 | + $name = $csv_file[ 'csv' ][ 'name' ]; |
|
| 96 | + $ext_array = explode( '.', $name ); |
|
| 97 | 97 | $ext = end( $ext_array ); |
| 98 | - $tmpName = $csv_file['csv']['tmp_name']; |
|
| 99 | - if($ext === 'csv') { |
|
| 100 | - if(($handle = fopen($tmpName, 'r')) !== FALSE) { |
|
| 101 | - $num = count($handle); |
|
| 102 | - $file = fopen( $tmpName, 'r'); |
|
| 98 | + $tmpName = $csv_file[ 'csv' ][ 'tmp_name' ]; |
|
| 99 | + if ( $ext === 'csv' ) { |
|
| 100 | + if ( ( $handle = fopen( $tmpName, 'r' ) ) !== FALSE ) { |
|
| 101 | + $num = count( $handle ); |
|
| 102 | + $file = fopen( $tmpName, 'r' ); |
|
| 103 | 103 | $row = 1; |
| 104 | - $first_line_data = fgetcsv($file, 10000, ','); |
|
| 105 | - if( count( $first_line_data ) > 1 ) { |
|
| 104 | + $first_line_data = fgetcsv( $file, 10000, ',' ); |
|
| 105 | + if ( count( $first_line_data ) > 1 ) { |
|
| 106 | 106 | // Check if this is a settings import by confirming the first option is 'yikes-mc-api-key' |
| 107 | - if( $first_line_data[0] == 'yikes-mc-api-key' ) { |
|
| 107 | + if ( $first_line_data[ 0 ] == 'yikes-mc-api-key' ) { |
|
| 108 | 108 | $import_type = 'import-settings'; |
| 109 | 109 | } else { |
| 110 | 110 | $import_type = 'import-forms'; |
@@ -1,6 +1,6 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -return array ( |
|
| 3 | +return array( |
|
| 4 | 4 | 'yikes_inc_easy_mailchimp_forms_admin' => 'admin/class-yikes-inc-easy-mailchimp-extender-admin.php', |
| 5 | 5 | 'yikes_inc_easy_mailchimp_process_ajax' => 'admin/partials/ajax/class.ajax.php', |
| 6 | 6 | 'yikes_inc_easy_mailchimp_dashboard_widgets' => 'admin/partials/dashboard-widgets/class.list-activity-widget.php', |