PluginProbe
Mailchimp List Subscribe Form / trunk
Mailchimp List Subscribe Form vtrunk
1.2.4 1.2.5 1.2.6 1.2.7 1.2.8 1.2.9 1.3 1.4 1.4.1 1.4.2 1.4.3 1.4.4 1.4.5 1.5 1.5.1 1.5.2 1.5.3 1.5.4 1.5.5 1.5.6 1.5.7 1.5.8 1.5.9 1.6.0 1.6.1 All 55 releases
mailchimp / includes / mailchimp-deprecated-functions.php

mailchimp-deprecated-functions.php in Mailchimp List Subscribe Form trunk, at includes/mailchimp-deprecated-functions.php

152 lines 4.1 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Deprecated functions.
4 *
5 * Where functions come to die.
6 *
7 * @package Mailchimp
8 */
9
10 // Exit if accessed directly.
11 if ( ! defined( 'ABSPATH' ) ) {
12 exit;
13 }
14
15 // Include the needed class incase if it is not already included.
16 require_once MCSF_DIR . 'includes/class-mailchimp-form-submission.php';
17
18 /**
19 * Prepare the merge fields body for the API request.
20 *
21 * @deprecated 1.8.0
22 * @param array $merge_fields Merge fields.
23 * @return stdClass|WP_Error
24 */
25 function mailchimp_sf_merge_submit( $merge_fields ) {
26 _deprecated_function( __FUNCTION__, '1.8.0', 'Mailchimp_Form_Submission::prepare_merge_fields_body()' );
27
28 $form_submission = new Mailchimp_Form_Submission();
29 return $form_submission->prepare_merge_fields_body( $merge_fields );
30 }
31
32 /**
33 * Prepare the interest groups body for the API request.
34 *
35 * @deprecated 1.8.0
36 * @param array $interest_groups Interest groups.
37 * @return stdClass
38 */
39 function mailchimp_sf_groups_submit( $interest_groups ) {
40 _deprecated_function( __FUNCTION__, '1.8.0', 'Mailchimp_Form_Submission::prepare_groups_body()' );
41
42 $form_submission = new Mailchimp_Form_Submission();
43 return $form_submission->prepare_groups_body( $interest_groups );
44 }
45
46 /**
47 * Set all groups to false
48 *
49 * @deprecated 1.8.0
50 * @return StdClass
51 */
52 function mailchimp_sf_set_all_groups_to_false() {
53 _deprecated_function( __FUNCTION__, '1.8.0', 'Mailchimp_Form_Submission::set_all_groups_to_false()' );
54
55 $interest_groups = get_option( 'mc_interest_groups' );
56 $form_submission = new Mailchimp_Form_Submission();
57 return $form_submission->set_all_groups_to_false( $interest_groups );
58 }
59
60 /**
61 * Get signup form URL.
62 *
63 * @deprecated 1.8.0
64 * @return string
65 */
66 function mailchimp_sf_signup_form_url() {
67 _deprecated_function( __FUNCTION__, '1.8.0', 'Mailchimp_Form_Submission::get_signup_form_url()' );
68
69 $list_id = get_option( 'mc_list_id' );
70 $form_submission = new Mailchimp_Form_Submission();
71 return $form_submission->get_signup_form_url( $list_id );
72 }
73
74
75 /**
76 * Attempts to signup a user, per the $_POST args.
77 *
78 * This sets a global message, that is then used in the widget
79 * output to retrieve and display that message.
80 *
81 * @deprecated 1.8.0
82 *
83 * @return bool
84 */
85 function mailchimp_sf_signup_submit() {
86 _deprecated_function( __FUNCTION__, '1.8.0', 'Mailchimp_Form_Submission::handle_form_submission()' );
87
88 $form_submission = new Mailchimp_Form_Submission();
89 $response = $form_submission->handle_form_submission();
90
91 // If we have an error, then show it.
92 if ( is_wp_error( $response ) ) {
93 $error = $response->get_error_message();
94 mailchimp_sf_global_msg( '<strong class="mc_error_msg">' . $error . '</strong>' );
95 return false;
96 }
97
98 mailchimp_sf_global_msg( '<strong class="mc_success_msg">' . esc_html( $response ) . '</strong>' );
99 return true;
100 }
101
102 /**
103 * Remove empty merge fields from the request body.
104 *
105 * @deprecated 1.8.0
106 *
107 * @param object $merge Merge fields request body.
108 * @return object The modified merge fields request body.
109 */
110 function mailchimp_sf_merge_remove_empty( $merge ) {
111 _deprecated_function( __FUNCTION__, '1.8.0', 'Mailchimp_Form_Submission::remove_empty_merge_fields()' );
112
113 $form_submission = new Mailchimp_Form_Submission();
114 return $form_submission->remove_empty_merge_fields( $merge );
115 }
116
117
118 /**
119 * Validate phone
120 *
121 * @deprecated 2.0.0
122 *
123 * @param array $opt_val Option value.
124 * @param array $data Data.
125 * @return string|WP_Error Option value or error.
126 */
127 function mailchimp_sf_merge_validate_phone( $opt_val, $data ) {
128 _deprecated_function( __FUNCTION__, '2.0.0', 'Mailchimp_Form_Submission::validate_phone()' );
129
130 if ( is_array( $opt_val ) ) {
131 $opt_val = implode( '-', $opt_val );
132 }
133 $form_submission = new Mailchimp_Form_Submission();
134 return $form_submission->validate_phone( $opt_val, $data );
135 }
136
137 /**
138 * Validate address
139 *
140 * @deprecated 2.0.0
141 *
142 * @param array $opt_val Option value.
143 * @param array $data Data.
144 * @return mixed
145 */
146 function mailchimp_sf_merge_validate_address( $opt_val, $data ) {
147 _deprecated_function( __FUNCTION__, '2.0.0', 'Mailchimp_Form_Submission::validate_address()' );
148
149 $form_submission = new Mailchimp_Form_Submission();
150 return $form_submission->validate_address( $opt_val, $data );
151 }
152