PluginProbe
Kit (formerly ConvertKit) – Email Newsletter, Email Marketing, Membership, Subscribers and Landing Pages / 3.4.4
Kit (formerly ConvertKit) – Email Newsletter, Email Marketing, Membership, Subscribers and Landing Pages v3.4.4
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 2.2.9 2.3.0 All 197 releases
← All changes | includes/block-formatters/class-convertkit-block-formatter-form-link.php +16 -11 2.2.7 → 3.4.4 View file →
@@ -73,9 +73,9 @@
73 73 */
74 74 public function get_overview() {
75 75
76 76 return array(
77 - 'title' => __( 'ConvertKit Form Trigger', 'convertkit' ),
77 + 'title' => __( 'Kit Form Trigger', 'convertkit' ),
78 78 'description' => __( 'Displays a modal, sticky bar or slide in form to display when the link is pressed.', 'convertkit' ),
79 79 'icon' => 'resources/backend/images/block-icon-formtrigger.svg',
80 80
81 81 // Gutenberg: Block Icon in Editor.
@@ -122,9 +122,14 @@
122 122 $forms_data = array();
123 123 if ( $this->forms->exist() ) {
124 124 foreach ( $this->forms->get_non_inline() as $form ) {
125 125 // Add this form's necessary to the attribute arrays.
126 - $forms[ absint( $form['id'] ) ] = sanitize_text_field( $form['name'] );
126 + // Legacy forms don't include a `format` key, so define them as inline.
127 + $forms[ absint( $form['id'] ) ] = sprintf(
128 + '%s [%s]',
129 + sanitize_text_field( $form['name'] ),
130 + ( ! empty( $form['format'] ) ? sanitize_text_field( $form['format'] ) : 'inline' )
131 + );
127 132 $forms_data[ absint( $form['id'] ) ] = array(
128 133 'data-id' => sanitize_text_field( $form['id'] ),
129 134 'data-formkit-toggle' => sanitize_text_field( $form['uid'] ),
130 135 'href' => $form['embed_url'],
@@ -190,34 +195,34 @@
190 195 * Callback function to enqueue a script to a matching link.
191 196 *
192 197 * @since 2.2.0
193 198 *
194 - * @param array $match preg_replace_callback() match.
195 - * @return string Link with script appended
199 + * @param array $preg_match preg_replace_callback() match.
200 + * @return string Link with script appended
196 201 */
197 - public function enqueue_scripts( $match ) {
202 + public function enqueue_scripts( $preg_match ) {
198 203
199 204 // Get Form by its ID.
200 - $form = $this->forms->get_by_id( absint( $match[1] ) );
205 + $form = $this->forms->get_by_id( absint( $preg_match[1] ) );
201 206
202 207 // Just return the original element, unedited, if the Form could not be found.
203 208 if ( ! $form ) {
204 - return $match[0];
209 + return $preg_match[0];
205 210 }
206 211
207 212 // Return the original link, unedited, if the Form doesn't have a UID or JS embed.
208 213 // This prevents issues with legacy modal forms.
209 214 if ( ! array_key_exists( 'uid', $form ) ) {
210 - return $match[0];
215 + return $preg_match[0];
211 216 }
212 217 if ( ! array_key_exists( 'embed_js', $form ) ) {
213 - return $match[0];
218 + return $preg_match[0];
214 219 }
215 220
216 221 // Register the script, so it's only loaded once for this non-inline form across the entire page.
217 222 add_filter(
218 223 'convertkit_output_scripts_footer',
219 - function( $scripts ) use ( $form ) {
224 + function ( $scripts ) use ( $form ) {
220 225
221 226 $scripts[] = array(
222 227 'async' => true,
223 228 'data-uid' => $form['uid'],
@@ -229,9 +234,9 @@
229 234 }
230 235 );
231 236
232 237 // Return original link.
233 - return $match[0];
238 + return $preg_match[0];
234 239
235 240 }
236 241
237 242 }