@@ -5,16 +5,16 @@ |
||
| 5 | 5 | * For help on using, see our documentation [https://yikesplugins.com/support/knowledge-base/product/easy-forms-for-mailchimp/] |
| 6 | 6 | * @since 6.0 |
| 7 | 7 | */ |
| 8 | - if ( is_string( $form_data['custom_fields'] ) ) { |
|
| 9 | - $field_data = json_decode( $form_data['custom_fields'] , true ); |
|
| 10 | - } elseif ( is_array( $form_data['custom_fields'] ) ) { |
|
| 11 | - $field_data = $form_data['custom_fields']; |
|
| 8 | + if ( is_string( $form_data[ 'custom_fields' ] ) ) { |
|
| 9 | + $field_data = json_decode( $form_data[ 'custom_fields' ], true ); |
|
| 10 | + } elseif ( is_array( $form_data[ 'custom_fields' ] ) ) { |
|
| 11 | + $field_data = $form_data[ 'custom_fields' ]; |
|
| 12 | 12 | } |
| 13 | 13 | ?> |
| 14 | 14 | <label class="custom-field-section"> |
| 15 | - <strong><?php echo $field['label']; ?></strong> |
|
| 16 | - <input type="checkbox" class="widefat" name="custom-field[<?php echo $field['id']; ?>]" id="custom-field" value="1" <?php checked( isset( $field_data[$field['id']] ) ? $field_data[$field['id']] : 0, 1, true ); ?>> |
|
| 17 | - <?php if( isset( $field['description'] ) && $field['description'] != '' ) { ?> |
|
| 18 | - <p class="description"><?php echo $field['description']; ?></p> |
|
| 15 | + <strong><?php echo $field[ 'label' ]; ?></strong> |
|
| 16 | + <input type="checkbox" class="widefat" name="custom-field[<?php echo $field[ 'id' ]; ?>]" id="custom-field" value="1" <?php checked( isset( $field_data[ $field[ 'id' ] ] ) ? $field_data[ $field[ 'id' ] ] : 0, 1, true ); ?>> |
|
| 17 | + <?php if ( isset( $field[ 'description' ] ) && $field[ 'description' ] != '' ) { ?> |
|
| 18 | + <p class="description"><?php echo $field[ 'description' ]; ?></p> |
|
| 19 | 19 | <?php } ?> |
| 20 | 20 | </label> |
@@ -5,10 +5,10 @@ discard block |
||
| 5 | 5 | * For help on using, see our documentation [https://yikesplugins.com/support/knowledge-base/product/easy-forms-for-mailchimp/] |
| 6 | 6 | * @since 6.0 |
| 7 | 7 | */ |
| 8 | - if ( is_string( $form_data['custom_fields'] ) ) { |
|
| 9 | - $field_data = json_decode( $form_data['custom_fields'] , true ); |
|
| 10 | - } elseif ( is_array( $form_data['custom_fields'] ) ) { |
|
| 11 | - $field_data = $form_data['custom_fields']; |
|
| 8 | + if ( is_string( $form_data[ 'custom_fields' ] ) ) { |
|
| 9 | + $field_data = json_decode( $form_data[ 'custom_fields' ], true ); |
|
| 10 | + } elseif ( is_array( $form_data[ 'custom_fields' ] ) ) { |
|
| 11 | + $field_data = $form_data[ 'custom_fields' ]; |
|
| 12 | 12 | } |
| 13 | 13 | |
| 14 | 14 | // This will enqueue the Media Uploader script |
@@ -16,27 +16,27 @@ discard block |
||
| 16 | 16 | // And let's not forget the script we wrote earlier |
| 17 | 17 | wp_enqueue_script( 'yikes-mailchimp-file-field-script', plugin_dir_url( __FILE__ ) . 'js/yikes-mc-file-upload.js', array( 'jquery' ), '1.0', false ); |
| 18 | 18 | // print_r( $field_data ); |
| 19 | - wp_localize_script( 'yikes-mailchimp-file-field-script' , 'additional_data' , array( |
|
| 19 | + wp_localize_script( 'yikes-mailchimp-file-field-script', 'additional_data', array( |
|
| 20 | 20 | 'wp_includes_image_url' => includes_url() . 'images/media/' |
| 21 | 21 | ) ); |
| 22 | 22 | $i = 1; |
| 23 | 23 | // create an single item array when nothing is stored yet, loop for one field |
| 24 | - $field_data['incentive-attachment'] = ( isset( $field_data['incentive-attachment'] ) && !empty( $field_data['incentive-attachment'] ) ) ? $field_data['incentive-attachment'] : array( '' ); |
|
| 24 | + $field_data[ 'incentive-attachment' ] = ( isset( $field_data[ 'incentive-attachment' ] ) && ! empty( $field_data[ 'incentive-attachment' ] ) ) ? $field_data[ 'incentive-attachment' ] : array( '' ); |
|
| 25 | 25 | ?> |
| 26 | 26 | |
| 27 | 27 | <div class="yikes-mailchimp-file-field"> |
| 28 | - <label for="image_url" class="widefat"><strong><?php echo $field['label']; ?></strong></label> |
|
| 29 | - <?php foreach( $field_data['incentive-attachment'] as $attachment ) { ?> |
|
| 30 | - <input type="text" name="custom-field[<?php echo $field['id']; ?>][<?php echo $i; ?>]" id="custom-field[<?php echo $field['id']; ?>][<?php echo $i; ?>]" class="file-attachment" value="<?php echo isset( $field_data[$field['id']][$i] ) ? $field_data[$field['id']][$i] : ''; ?>"> |
|
| 31 | - <input type="button" name="upload-btn" id="upload-btn" class="button-secondary" data-attr-position="<?php echo $i; ?>" value="<?php _e( 'Upload File' , 'yikes-inc-easy-mailchimp-extender' ); ?>"> |
|
| 28 | + <label for="image_url" class="widefat"><strong><?php echo $field[ 'label' ]; ?></strong></label> |
|
| 29 | + <?php foreach ( $field_data[ 'incentive-attachment' ] as $attachment ) { ?> |
|
| 30 | + <input type="text" name="custom-field[<?php echo $field[ 'id' ]; ?>][<?php echo $i; ?>]" id="custom-field[<?php echo $field[ 'id' ]; ?>][<?php echo $i; ?>]" class="file-attachment" value="<?php echo isset( $field_data[ $field[ 'id' ] ][ $i ] ) ? $field_data[ $field[ 'id' ] ][ $i ] : ''; ?>"> |
|
| 31 | + <input type="button" name="upload-btn" id="upload-btn" class="button-secondary" data-attr-position="<?php echo $i; ?>" value="<?php _e( 'Upload File', 'yikes-inc-easy-mailchimp-extender' ); ?>"> |
|
| 32 | 32 | <div class="file-container"> |
| 33 | 33 | <p class="file-remove-wrapper"> |
| 34 | - <a href="#" class="remove-file-button" data-attr-position="<?php echo $i; ?>"><?php _e( 'Remove File' , 'yikes-inc-easy-mailchimp-extender' ); ?></a> |
|
| 34 | + <a href="#" class="remove-file-button" data-attr-position="<?php echo $i; ?>"><?php _e( 'Remove File', 'yikes-inc-easy-mailchimp-extender' ); ?></a> |
|
| 35 | 35 | </p> |
| 36 | 36 | </div> |
| 37 | 37 | <?php $i++; } ?> |
| 38 | - <?php if( isset( $field['repeat'] ) ) { ?> |
|
| 38 | + <?php if ( isset( $field[ 'repeat' ] ) ) { ?> |
|
| 39 | 39 | <a href="#" class="button-secondary add-new-incentive-attachment" data-attr-position="<?php echo $i; ?>"><span class="dashicons dashicons-plus"></span></a> |
| 40 | 40 | <?php } ?> |
| 41 | - <p class="description"><?php echo $field['description']; ?></p> |
|
| 41 | + <p class="description"><?php echo $field[ 'description' ]; ?></p> |
|
| 42 | 42 | </div> |
| 43 | 43 | \ No newline at end of file |
@@ -6,18 +6,18 @@ |
||
| 6 | 6 | * For help on using, see our documentation [https://yikesplugins.com/support/knowledge-base/product/easy-forms-for-mailchimp/] |
| 7 | 7 | * @since 6.0 |
| 8 | 8 | */ |
| 9 | - if ( is_string( $form_data['custom_fields'] ) ) { |
|
| 10 | - $field_data = json_decode( $form_data['custom_fields'] , true ); |
|
| 11 | - } elseif ( is_array( $form_data['custom_fields'] ) ) { |
|
| 12 | - $field_data = $form_data['custom_fields']; |
|
| 9 | + if ( is_string( $form_data[ 'custom_fields' ] ) ) { |
|
| 10 | + $field_data = json_decode( $form_data[ 'custom_fields' ], true ); |
|
| 11 | + } elseif ( is_array( $form_data[ 'custom_fields' ] ) ) { |
|
| 12 | + $field_data = $form_data[ 'custom_fields' ]; |
|
| 13 | 13 | } |
| 14 | 14 | |
| 15 | - $content = ( isset( $field_data[$field['id']] ) ) ? $field_data[$field['id']] : ( isset( $field['default'] ) ? $field['default'] : '' ); |
|
| 16 | - $wysiwyg_id = 'custom-field['.$field['id'].']'; |
|
| 15 | + $content = ( isset( $field_data[ $field[ 'id' ] ] ) ) ? $field_data[ $field[ 'id' ] ] : ( isset( $field[ 'default' ] ) ? $field[ 'default' ] : '' ); |
|
| 16 | + $wysiwyg_id = 'custom-field[' . $field[ 'id' ] . ']'; |
|
| 17 | 17 | ?> |
| 18 | 18 | |
| 19 | 19 | <div class="yikes-mailchimp-wysiwyg-field"> |
| 20 | - <label for="image_url" class="widefat"><strong><?php echo $field['label']; ?></strong></label> |
|
| 21 | - <?php wp_editor( $content, $field['id'], array( 'textarea_name' => $wysiwyg_id ) ); ?> |
|
| 22 | - <p class="description"><?php echo $field['description']; ?></p> |
|
| 20 | + <label for="image_url" class="widefat"><strong><?php echo $field[ 'label' ]; ?></strong></label> |
|
| 21 | + <?php wp_editor( $content, $field[ 'id' ], array( 'textarea_name' => $wysiwyg_id ) ); ?> |
|
| 22 | + <p class="description"><?php echo $field[ 'description' ]; ?></p> |
|
| 23 | 23 | </div> |
@@ -5,26 +5,26 @@ |
||
| 5 | 5 | * For help on using, see our documentation [https://yikesplugins.com/support/knowledge-base/product/easy-forms-for-mailchimp/] |
| 6 | 6 | * @since 6.0 |
| 7 | 7 | */ |
| 8 | - if ( is_string( $form_data['custom_fields'] ) ) { |
|
| 9 | - $field_data = json_decode( $form_data['custom_fields'] , true ); |
|
| 10 | - } elseif ( is_array( $form_data['custom_fields'] ) ) { |
|
| 11 | - $field_data = $form_data['custom_fields']; |
|
| 8 | + if ( is_string( $form_data[ 'custom_fields' ] ) ) { |
|
| 9 | + $field_data = json_decode( $form_data[ 'custom_fields' ], true ); |
|
| 10 | + } elseif ( is_array( $form_data[ 'custom_fields' ] ) ) { |
|
| 11 | + $field_data = $form_data[ 'custom_fields' ]; |
|
| 12 | 12 | } |
| 13 | 13 | ?> |
| 14 | 14 | <div class="custom-field-section"> |
| 15 | 15 | <!-- title --> |
| 16 | - <strong><?php echo $field['label']; ?></strong> |
|
| 16 | + <strong><?php echo $field[ 'label' ]; ?></strong> |
|
| 17 | 17 | <!-- radio buttons --> |
| 18 | 18 | <section class="custom-radio-holder"> |
| 19 | - <?php foreach( $field['options'] as $value => $label ) { ?> |
|
| 19 | + <?php foreach ( $field[ 'options' ] as $value => $label ) { ?> |
|
| 20 | 20 | <label class="custom-radio-label"> |
| 21 | - <input type="radio" name="custom-field[<?php echo $field['id']; ?>][]" id="custom-field" value="<?php echo $value; ?>" <?php if( isset( $field_data[$field['id']] ) ) { checked( $field_data[$field['id']] , $value ); } ?>> |
|
| 21 | + <input type="radio" name="custom-field[<?php echo $field[ 'id' ]; ?>][]" id="custom-field" value="<?php echo $value; ?>" <?php if ( isset( $field_data[ $field[ 'id' ] ] ) ) { checked( $field_data[ $field[ 'id' ] ], $value ); } ?>> |
|
| 22 | 22 | <?php echo $label; ?> |
| 23 | 23 | </label> |
| 24 | 24 | <?php } ?> |
| 25 | 25 | </section> |
| 26 | 26 | <!-- description --> |
| 27 | - <?php if( isset( $field['description'] ) && $field['description'] != '' ) { ?> |
|
| 28 | - <p class="description"><?php echo $field['description']; ?></p> |
|
| 27 | + <?php if ( isset( $field[ 'description' ] ) && $field[ 'description' ] != '' ) { ?> |
|
| 28 | + <p class="description"><?php echo $field[ 'description' ]; ?></p> |
|
| 29 | 29 | <?php } ?> |
| 30 | 30 | </div> |
| 31 | 31 | \ No newline at end of file |
@@ -96,8 +96,8 @@ discard block |
||
| 96 | 96 | |
| 97 | 97 | $this->api_key = $api_key; |
| 98 | 98 | $parts = $this->get_api_key_parts(); |
| 99 | - $this->key = $parts['key']; |
|
| 100 | - $this->dc = $parts['dc']; |
|
| 99 | + $this->key = $parts[ 'key' ]; |
|
| 100 | + $this->dc = $parts[ 'dc' ]; |
|
| 101 | 101 | } |
| 102 | 102 | |
| 103 | 103 | /** |
@@ -122,8 +122,8 @@ discard block |
||
| 122 | 122 | $parts = explode( '-', $this->api_key ); |
| 123 | 123 | |
| 124 | 124 | return array( |
| 125 | - 'key' => $parts[0], |
|
| 126 | - 'dc' => isset( $parts[1] ) ? $parts[1] : '', |
|
| 125 | + 'key' => $parts[ 0 ], |
|
| 126 | + 'dc' => isset( $parts[ 1 ] ) ? $parts[ 1 ] : '', |
|
| 127 | 127 | ); |
| 128 | 128 | } |
| 129 | 129 | |
@@ -167,7 +167,7 @@ discard block |
||
| 167 | 167 | * @return Yikes_Inc_Easy_MailChimp_API |
| 168 | 168 | */ |
| 169 | 169 | public function get_api( $version = '' ) { |
| 170 | - $version = $version ?: $this->get_default_api_version(); |
|
| 170 | + $version = $version ? : $this->get_default_api_version(); |
|
| 171 | 171 | |
| 172 | 172 | if ( ! array_key_exists( $version, $this->api ) || null === $this->api[ $version ] ) { |
| 173 | 173 | $this->api[ $version ] = new Yikes_Inc_Easy_MailChimp_API( $this->get_datacenter(), $this->get_api_key(), $version ); |
@@ -26,8 +26,8 @@ discard block |
||
| 26 | 26 | return ''; |
| 27 | 27 | } |
| 28 | 28 | |
| 29 | - $form = ( ! empty( $attributes['form'] ) ) ? str_replace( '"', '', $attributes['form'] ) : false; |
|
| 30 | - $list_id = ( ! empty( $attributes['list'] ) ) ? $attributes['list'] : false; |
|
| 29 | + $form = ( ! empty( $attributes[ 'form' ] ) ) ? str_replace( '"', '', $attributes[ 'form' ] ) : false; |
|
| 30 | + $list_id = ( ! empty( $attributes[ 'list' ] ) ) ? $attributes[ 'list' ] : false; |
|
| 31 | 31 | |
| 32 | 32 | /* If no list ID was passed into the shortcode - bail */ |
| 33 | 33 | if ( ! $list_id && ! $form ) { |
@@ -52,7 +52,7 @@ discard block |
||
| 52 | 52 | return ''; |
| 53 | 53 | } |
| 54 | 54 | |
| 55 | - $list_id = sanitize_key( $form_data['list_id'] ); // associated list id (users who fill out the form will be subscribed to this list) |
|
| 55 | + $list_id = sanitize_key( $form_data[ 'list_id' ] ); // associated list id (users who fill out the form will be subscribed to this list) |
|
| 56 | 56 | } |
| 57 | 57 | |
| 58 | 58 | // object buffer |
@@ -71,7 +71,7 @@ discard block |
||
| 71 | 71 | } |
| 72 | 72 | |
| 73 | 73 | /* type cast the returned value as an integer */ |
| 74 | - echo (int) apply_filters( 'yikes-mailchimp-subscriber-count-value', $list_data['stats']['member_count'] ); |
|
| 74 | + echo (int) apply_filters( 'yikes-mailchimp-subscriber-count-value', $list_data[ 'stats' ][ 'member_count' ] ); |
|
| 75 | 75 | |
| 76 | 76 | return ob_get_clean(); |
| 77 | 77 | |
@@ -34,7 +34,7 @@ discard block |
||
| 34 | 34 | if ( $network_wide ) {
|
| 35 | 35 | $old_blog = $wpdb->blogid; |
| 36 | 36 | // Get all blog ids |
| 37 | - $blogids = $wpdb->get_col("SELECT blog_id FROM $wpdb->blogs");
|
|
| 37 | + $blogids = $wpdb->get_col( "SELECT blog_id FROM $wpdb->blogs" ); |
|
| 38 | 38 | foreach ( $blogids as $blog_id ) {
|
| 39 | 39 | switch_to_blog( $blog_id ); |
| 40 | 40 | self::_activate_yikes_easy_mailchimp( $wpdb ); |
@@ -90,8 +90,8 @@ discard block |
||
| 90 | 90 | custom_fields TEXT NOT NULL, |
| 91 | 91 | UNIQUE KEY id (id) |
| 92 | 92 | ) $charset_collate;"; |
| 93 | - require_once(ABSPATH . 'wp-admin/includes/upgrade.php'); |
|
| 94 | - dbDelta($sql); |
|
| 93 | + require_once( ABSPATH . 'wp-admin/includes/upgrade.php' ); |
|
| 94 | + dbDelta( $sql ); |
|
| 95 | 95 | |
| 96 | 96 | // create an option for the date that the user initially activated the plugin |
| 97 | 97 | // used to display a two week notice, asking for a review or to upgrade |
@@ -86,7 +86,7 @@ discard block |
||
| 86 | 86 | * @return type The collection of actions and filters registered with WordPress. |
| 87 | 87 | */ |
| 88 | 88 | private function add( $hooks, $hook, $component, $callback, $priority, $accepted_args ) {
|
| 89 | - $hooks[] = array( |
|
| 89 | + $hooks[ ] = array( |
|
| 90 | 90 | 'hook' => $hook, |
| 91 | 91 | 'component' => $component, |
| 92 | 92 | 'callback' => $callback, |
@@ -102,10 +102,10 @@ discard block |
||
| 102 | 102 | */ |
| 103 | 103 | public function run() {
|
| 104 | 104 | foreach ( $this->filters as $hook ) {
|
| 105 | - add_filter( $hook['hook'], array( $hook['component'], $hook['callback'] ), $hook['priority'], $hook['accepted_args'] ); |
|
| 105 | + add_filter( $hook[ 'hook' ], array( $hook[ 'component' ], $hook[ 'callback' ] ), $hook[ 'priority' ], $hook[ 'accepted_args' ] ); |
|
| 106 | 106 | } |
| 107 | 107 | foreach ( $this->actions as $hook ) {
|
| 108 | - add_action( $hook['hook'], array( $hook['component'], $hook['callback'] ), $hook['priority'], $hook['accepted_args'] ); |
|
| 108 | + add_action( $hook[ 'hook' ], array( $hook[ 'component' ], $hook[ 'callback' ] ), $hook[ 'priority' ], $hook[ 'accepted_args' ] ); |
|
| 109 | 109 | } |
| 110 | 110 | } |
| 111 | 111 | } |
| 112 | 112 | \ No newline at end of file |
@@ -56,9 +56,9 @@ discard block |
||
| 56 | 56 | new YIKES_Inc_Easy_MailChimp_Public_Ajax(); |
| 57 | 57 | |
| 58 | 58 | // Include our error logging class |
| 59 | - add_action( 'init' , array( $this , 'load_error_logging_class' ) , 1 ); |
|
| 59 | + add_action( 'init', array( $this, 'load_error_logging_class' ), 1 ); |
|
| 60 | 60 | // load our checkbox classes |
| 61 | - add_action( 'init' , array( $this , 'load_checkbox_integration_classes' ) , 1 ); |
|
| 61 | + add_action( 'init', array( $this, 'load_checkbox_integration_classes' ), 1 ); |
|
| 62 | 62 | // custom front end filter |
| 63 | 63 | add_action( 'init', array( $this, 'yikes_custom_frontend_content_filter' ) ); |
| 64 | 64 | // Process non-ajax forms in the header |
@@ -93,15 +93,15 @@ discard block |
||
| 93 | 93 | **/ |
| 94 | 94 | public function load_checkbox_integration_classes() { |
| 95 | 95 | // store our options |
| 96 | - $integrations = get_option( 'optin-checkbox-init' , array() ); |
|
| 97 | - if( ! empty( $integrations ) && is_array( $integrations ) ) { |
|
| 96 | + $integrations = get_option( 'optin-checkbox-init', array() ); |
|
| 97 | + if ( ! empty( $integrations ) && is_array( $integrations ) ) { |
|
| 98 | 98 | // load our mail integrations class |
| 99 | 99 | require_once YIKES_MC_PATH . 'public/classes/checkbox-integrations.php'; |
| 100 | 100 | // loop over selected classes and load them up! |
| 101 | - foreach( $integrations as $integration => $value ) { |
|
| 102 | - if( isset( $value['value'] ) && $value['value'] == 'on' ) { |
|
| 101 | + foreach ( $integrations as $integration => $value ) { |
|
| 102 | + if ( isset( $value[ 'value' ] ) && $value[ 'value' ] == 'on' ) { |
|
| 103 | 103 | // load our class extensions |
| 104 | - require_once YIKES_MC_PATH . 'public/classes/checkbox-integrations/class.'.$integration.'-checkbox.php'; |
|
| 104 | + require_once YIKES_MC_PATH . 'public/classes/checkbox-integrations/class.' . $integration . '-checkbox.php'; |
|
| 105 | 105 | } |
| 106 | 106 | } |
| 107 | 107 | } |
@@ -115,7 +115,7 @@ discard block |
||
| 115 | 115 | * @since 6.0.0 |
| 116 | 116 | */ |
| 117 | 117 | public function load_error_logging_class() { |
| 118 | - if( get_option( 'yikes-mailchimp-debug-status' , '' ) == '1' ) { |
|
| 118 | + if ( get_option( 'yikes-mailchimp-debug-status', '' ) == '1' ) { |
|
| 119 | 119 | // if error logging is enabled we should include our error logging class |
| 120 | 120 | require_once YIKES_MC_PATH . 'includes/error_log/class-yikes-inc-easy-mailchimp-error-logging.php'; |
| 121 | 121 | $error_logging = new Yikes_Inc_Easy_Mailchimp_Error_Logging; |
@@ -128,19 +128,19 @@ discard block |
||
| 128 | 128 | * @since 6.0.3.4 |
| 129 | 129 | */ |
| 130 | 130 | public function yikes_process_non_ajax_forms( $form_submitted ) { |
| 131 | - global $wpdb,$post; |
|
| 132 | - $form_id = ( ! empty( $_POST['yikes-mailchimp-submitted-form'] ) ) ? (int) $_POST['yikes-mailchimp-submitted-form'] : false; // store form id |
|
| 133 | - if( $form_id ) { |
|
| 131 | + global $wpdb, $post; |
|
| 132 | + $form_id = ( ! empty( $_POST[ 'yikes-mailchimp-submitted-form' ] ) ) ? (int) $_POST[ 'yikes-mailchimp-submitted-form' ] : false; // store form id |
|
| 133 | + if ( $form_id ) { |
|
| 134 | 134 | $form_settings = self::yikes_retrieve_form_settings( $form_id ); |
| 135 | - if( isset( $_POST ) && !empty( $_POST ) && isset( $form_id ) && $form_settings['submission_settings']['ajax'] == 0 ) { |
|
| 136 | - if( $_POST['yikes-mailchimp-submitted-form'] == $form_id ) { // ensure we only process the form that was submitted |
|
| 135 | + if ( isset( $_POST ) && ! empty( $_POST ) && isset( $form_id ) && $form_settings[ 'submission_settings' ][ 'ajax' ] == 0 ) { |
|
| 136 | + if ( $_POST[ 'yikes-mailchimp-submitted-form' ] == $form_id ) { // ensure we only process the form that was submitted |
|
| 137 | 137 | |
| 138 | 138 | // Lets include our form processing file |
| 139 | 139 | include_once( YIKES_MC_PATH . 'public/partials/shortcodes/process/process_form_submission.php' ); |
| 140 | - if( $form_settings['submission_settings']['redirect_on_submission'] == '1' ) { |
|
| 141 | - if( $form_submitted == 1 ) { |
|
| 140 | + if ( $form_settings[ 'submission_settings' ][ 'redirect_on_submission' ] == '1' ) { |
|
| 141 | + if ( $form_submitted == 1 ) { |
|
| 142 | 142 | // decode our settings |
| 143 | - $redirect_page = ( 'custom_url' != $form_settings['submission_settings']['redirect_page'] ) ? get_permalink( (int) $form_settings['submission_settings']['redirect_page'] ) : $form_settings['submission_settings']['custom_redirect_url']; |
|
| 143 | + $redirect_page = ( 'custom_url' != $form_settings[ 'submission_settings' ][ 'redirect_page' ] ) ? get_permalink( (int) $form_settings[ 'submission_settings' ][ 'redirect_page' ] ) : $form_settings[ 'submission_settings' ][ 'custom_redirect_url' ]; |
|
| 144 | 144 | wp_redirect( apply_filters( 'yikes-mailchimp-redirect-url', esc_url( $redirect_page ), $form_id, $post ) ); |
| 145 | 145 | exit; |
| 146 | 146 | } |
@@ -168,7 +168,7 @@ discard block |
||
| 168 | 168 | */ |
| 169 | 169 | public static function yikes_retrieve_form_settings( $form_id ) { |
| 170 | 170 | // if no form id, abort |
| 171 | - if( ! $form_id ) { |
|
| 171 | + if ( ! $form_id ) { |
|
| 172 | 172 | return array(); |
| 173 | 173 | } |
| 174 | 174 | |
@@ -197,13 +197,13 @@ discard block |
||
| 197 | 197 | return; |
| 198 | 198 | } |
| 199 | 199 | // trim trailing period |
| 200 | - if ( isset( $form_settings['error_messages']['update-link'] ) && ! empty( $form_settings['error_messages']['update-link'] ) ) { |
|
| 201 | - $response_text = $form_settings['error_messages']['update-link']; |
|
| 200 | + if ( isset( $form_settings[ 'error_messages' ][ 'update-link' ] ) && ! empty( $form_settings[ 'error_messages' ][ 'update-link' ] ) ) { |
|
| 201 | + $response_text = $form_settings[ 'error_messages' ][ 'update-link' ]; |
|
| 202 | 202 | // extract the link text |
| 203 | 203 | preg_match( '/\[link].*?\[\/link\]/', $response_text, $link_text ); |
| 204 | 204 | if ( $link_text && ! empty( $link_text ) ) { |
| 205 | 205 | // Extract the custom link text ([link]*[/link]) |
| 206 | - $custom_link_text = str_replace( '[/link]', '', str_replace( '[link]', '', str_replace( 'click to send yourself an update link', $link_text[0], $link ) ) ); |
|
| 206 | + $custom_link_text = str_replace( '[/link]', '', str_replace( '[link]', '', str_replace( 'click to send yourself an update link', $link_text[ 0 ], $link ) ) ); |
|
| 207 | 207 | // Replace the link text, with our custom link text |
| 208 | 208 | $response_text = str_replace( $link_text, $custom_link_text, $response_text ); |
| 209 | 209 | } |
@@ -232,8 +232,8 @@ discard block |
||
| 232 | 232 | } |
| 233 | 233 | |
| 234 | 234 | // trim trailing period |
| 235 | - if ( isset( $form_settings['error_messages']['already-subscribed'] ) && ! empty( $form_settings['error_messages']['already-subscribed'] ) ) { |
|
| 236 | - $response_text = str_replace( '[email]', $email, $form_settings['error_messages']['already-subscribed'] ); |
|
| 235 | + if ( isset( $form_settings[ 'error_messages' ][ 'already-subscribed' ] ) && ! empty( $form_settings[ 'error_messages' ][ 'already-subscribed' ] ) ) { |
|
| 236 | + $response_text = str_replace( '[email]', $email, $form_settings[ 'error_messages' ][ 'already-subscribed' ] ); |
|
| 237 | 237 | } |
| 238 | 238 | // Return our new string |
| 239 | 239 | return $response_text; |