PluginProbe
Kit (formerly ConvertKit) – Email Newsletter, Email Marketing, Membership, Subscribers and Landing Pages / 2.4.0
Kit (formerly ConvertKit) – Email Newsletter, Email Marketing, Membership, Subscribers and Landing Pages v2.4.0
3.4.6 3.4.5 3.4.4 3.4.3 3.4.2 3.4.1 3.4.0 3.3.9 3.3.8 3.3.7 3.3.6 3.3.5 3.3.4 3.3.3 3.3.2 3.3.1 2.2.0 2.2.1 2.2.2 2.2.3 2.2.4 2.2.5 2.2.6 2.2.7 2.2.8 All 199 releases
← All changes | includes/class-convertkit-preview-output.php +25 -32 3.3.9 → 2.4.0 View file →
@@ -63,9 +63,9 @@
63 63 return $form_id;
64 64 }
65 65
66 66 // Determine the form to preview.
67 - $preview_form_id = ( isset( $_REQUEST['convertkit_form_id'] ) ? absint( wp_unslash( $_REQUEST['convertkit_form_id'] ) ) : 0 );
67 + $preview_form_id = (int) ( isset( $_REQUEST['convertkit_form_id'] ) ? sanitize_text_field( $_REQUEST['convertkit_form_id'] ) : 0 );
68 68
69 69 // Return.
70 70 return $preview_form_id;
71 71
@@ -71,9 +71,9 @@
71 71
72 72 }
73 73
74 74 /**
75 - * Adds non-inline form(s) for display if the request is from a logged in user who has clicked a preview link
75 + * Adds a non-inline form for display if the request is from a logged in user who has clicked a preview link
76 76 * and is viewing the home page.
77 77 *
78 78 * @since 2.3.3
79 79 */
@@ -98,43 +98,36 @@
98 98 if ( ! wp_verify_nonce( sanitize_key( wp_unslash( $_REQUEST['convertkit-preview-form-nonce'] ) ), 'convertkit-preview-form' ) ) {
99 99 return;
100 100 }
101 101
102 - // Bail if no form(s) to preview.
103 - if ( ! isset( $_REQUEST['convertkit_form_id'] ) ) {
104 - return;
105 - }
102 + // Determine the form to preview.
103 + $preview_form_id = (int) ( isset( $_REQUEST['convertkit_form_id'] ) ? sanitize_text_field( $_REQUEST['convertkit_form_id'] ) : 0 );
106 104
107 - // Determine form ID(s) to preview.
105 + // Get form.
108 106 $convertkit_forms = new ConvertKit_Resource_Forms();
109 - $preview_form_ids = explode( ',', sanitize_text_field( wp_unslash( $_REQUEST['convertkit_form_id'] ) ) );
107 + $form = $convertkit_forms->get_by_id( $preview_form_id );
110 108
111 - foreach ( $preview_form_ids as $preview_form_id ) {
112 - // Get form.
113 - $form = $convertkit_forms->get_by_id( (int) $preview_form_id );
109 + // Bail if the Form doesn't exist (this shouldn't happen, but you never know).
110 + if ( ! $form ) {
111 + return;
112 + }
114 113
115 - // Bail if the Form doesn't exist (this shouldn't happen, but you never know).
116 - if ( ! $form ) {
117 - continue;
118 - }
114 + // Add the form to the scripts array so it is included in the preview.
115 + add_filter(
116 + 'convertkit_output_scripts_footer',
117 + function ( $scripts ) use ( $form ) {
119 118
120 - // Add the form to the scripts array so it is included in the preview.
121 - add_filter(
122 - 'convertkit_output_scripts_footer',
123 - function ( $scripts ) use ( $form ) {
119 + $scripts[] = array(
120 + 'async' => true,
121 + 'data-uid' => $form['uid'],
122 + 'src' => $form['embed_js'],
123 + );
124 124
125 - $scripts[] = array(
126 - 'async' => true,
127 - 'data-uid' => $form['uid'],
128 - 'src' => $form['embed_js'],
129 - );
125 + return $scripts;
130 126
131 - return $scripts;
127 + }
128 + );
132 129
133 - }
134 - );
135 - }
136 -
137 130 }
138 131
139 132 /**
140 133 * Returns the URL for the most recent published Post based on the supplied Post Type,
@@ -273,9 +266,9 @@
273 266 'utm_term' => get_locale(),
274 267 'utm_content' => 'convertkit',
275 268 ),
276 269 sprintf(
277 - 'https://app.kit.com/landing_pages/%s/edit/',
270 + 'https://app.convertkit.com/landing_pages/%s/edit/',
278 271 esc_attr( (string) $form_id )
279 272 )
280 273 );
281 274 } else {
@@ -285,9 +278,9 @@
285 278 'utm_term' => get_locale(),
286 279 'utm_content' => 'convertkit',
287 280 ),
288 281 sprintf(
289 - 'https://app.kit.com/forms/designers/%s/edit/',
282 + 'https://app.convertkit.com/forms/designers/%s/edit/',
290 283 esc_attr( (string) $form_id )
291 284 )
292 285 );
293 286 }
@@ -295,9 +288,9 @@
295 288 // Append a link to edit the Form on ConvertKit.
296 289 $form_html .= sprintf(
297 290 '<div style="margin:0;padding:5px;text-align:right;font-size:13px;"><a href="%s" target="_blank">%s</a></div>',
298 291 esc_url( $link ),
299 - esc_html__( 'Edit form in Kit', 'convertkit' )
292 + esc_html__( 'Edit form in ConvertKit', 'convertkit' )
300 293 );
301 294
302 295 return $form_html;
303 296