PluginProbe
Kit (formerly ConvertKit) – Email Newsletter, Email Marketing, Membership, Subscribers and Landing Pages / 3.4.3
Kit (formerly ConvertKit) – Email Newsletter, Email Marketing, Membership, Subscribers and Landing Pages v3.4.3
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 2.3.1 All 196 releases
← All changes | includes/plugin-sidebars/class-convertkit-plugin-sidebar-post-settings.php +87 -15 3.3.33.4.3 View file →
@@ -118,31 +118,49 @@
118 118 $convertkit_landing_pages = new ConvertKit_Resource_Landing_Pages( 'post_settings' );
119 119 $convertkit_tags = new ConvertKit_Resource_Tags( 'post_settings' );
120 120 $convertkit_products = new ConvertKit_Resource_Products( 'post_settings' );
121 121
122 - // Get Forms.
123 - $forms = array(
122 + // Get Forms. Non-legacy forms populate the dropdown; legacy forms are
123 + // exposed separately as a fallback so a previously-saved legacy form
124 + // remains visible as the current selection without offering other
125 + // legacy forms as new choices.
126 + $forms = array(
124 127 '-1' => esc_html__( 'Default', 'convertkit' ),
125 128 '0' => esc_html__( 'None', 'convertkit' ),
126 129 );
130 + $legacy_forms = array();
127 131 if ( $convertkit_forms->exist() ) {
128 132 foreach ( $convertkit_forms->get() as $form ) {
129 - // Legacy forms don't include a `format` key, so define them as inline.
130 - $forms[ absint( $form['id'] ) ] = sprintf(
133 + $label = sprintf(
131 134 '%s [%s]',
132 135 sanitize_text_field( $form['name'] ),
136 + // Legacy forms don't include a `format` key, so define them as inline.
133 137 ( ! empty( $form['format'] ) ? sanitize_text_field( $form['format'] ) : 'inline' )
134 138 );
139 +
140 + if ( ! empty( $form['format'] ) ) {
141 + $forms[ absint( $form['id'] ) ] = $label;
142 + } else {
143 + $legacy_forms[ absint( $form['id'] ) ] = $label;
144 + }
135 145 }
136 146 }
137 147
138 - // Get Landing Pages.
139 - $landing_pages = array(
148 + // Get Landing Pages. Non-legacy pages populate the dropdown; legacy
149 + // pages are exposed separately as a fallback so a previously-saved
150 + // legacy landing page remains visible as the current selection
151 + // without offering other legacy pages as new choices.
152 + $landing_pages = array(
140 153 '0' => esc_html__( 'None', 'convertkit' ),
141 154 );
155 + $legacy_landing_pages = array();
142 156 if ( $convertkit_landing_pages->exist() ) {
143 157 foreach ( $convertkit_landing_pages->get() as $landing_page ) {
144 - $landing_pages[ absint( $landing_page['id'] ) ] = sanitize_text_field( $landing_page['name'] );
158 + if ( isset( $landing_page['url'] ) ) {
159 + $legacy_landing_pages[ absint( $landing_page['id'] ) ] = sanitize_text_field( $landing_page['name'] );
160 + } else {
161 + $landing_pages[ absint( $landing_page['id'] ) ] = sanitize_text_field( $landing_page['name'] );
162 + }
145 163 }
146 164 }
147 165
148 166 // Get Tags.
@@ -155,11 +173,12 @@
155 173 }
156 174 }
157 175
158 176 // Get Products.
159 - $restrict_content = array(
177 + $restrict_content = array(
160 178 '0' => esc_html__( 'Do not restrict content to member-only', 'convertkit' ),
161 179 );
180 + $restrict_content_legacy_forms = array();
162 181 if ( $convertkit_forms->exist() ) {
163 182 $restrict_content['forms'] = array(
164 183 'label' => esc_html__( 'Forms', 'convertkit' ),
165 184 'values' => array(),
@@ -164,14 +183,21 @@
164 183 'label' => esc_html__( 'Forms', 'convertkit' ),
165 184 'values' => array(),
166 185 );
167 186 foreach ( $convertkit_forms->get() as $form ) {
168 - // Legacy forms don't include a `format` key, so define them as inline.
169 - $restrict_content['forms']['values'][ 'form_' . absint( $form['id'] ) ] = sprintf(
187 + $key = 'form_' . absint( $form['id'] );
188 + $label = sprintf(
170 189 '%s [%s]',
171 190 sanitize_text_field( $form['name'] ),
191 + // Legacy forms don't include a `format` key, so define them as inline.
172 192 ( ! empty( $form['format'] ) ? sanitize_text_field( $form['format'] ) : 'inline' )
173 193 );
194 +
195 + if ( ! empty( $form['format'] ) ) {
196 + $restrict_content['forms']['values'][ $key ] = $label;
197 + } else {
198 + $restrict_content_legacy_forms[ $key ] = $label;
199 + }
174 200 }
175 201 }
176 202 if ( $convertkit_tags->exist() ) {
177 203 $restrict_content['tags'] = array(
@@ -196,20 +222,45 @@
196 222 'form' => array(
197 223 'label' => __( 'Form', 'convertkit' ),
198 224 'type' => 'select',
199 225 'description' => array(
200 - __( 'Default', 'convertkit' ) . ': ' . __( 'Uses the form specified on the settings page.', 'convertkit' ),
201 - __( 'None', 'convertkit' ) . ': ' . __( 'do not display a form.', 'convertkit' ),
226 + sprintf(
227 + '<code>%s</code>: %s <a href="%s" target="_blank">%s</a>',
228 + esc_html__( 'Default', 'convertkit' ),
229 + esc_html__( 'Uses the form specified on the', 'convertkit' ),
230 + esc_url( convertkit_get_settings_link() ),
231 + esc_html__( 'settings page', 'convertkit' )
232 + ),
233 + sprintf(
234 + '<code>%s</code>: %s',
235 + esc_html__( 'None', 'convertkit' ),
236 + esc_html__( 'do not display a form.', 'convertkit' )
237 + ),
202 238 __( 'Any other option will display that form after the main content.', 'convertkit' ),
239 + sprintf(
240 + '%s <a href="%s" target="_blank">%s</a>',
241 + esc_html__( 'To make changes to your forms,', 'convertkit' ),
242 + esc_url( convertkit_get_sign_in_url() ),
243 + esc_html__( 'sign in to Kit', 'convertkit' )
244 + ),
203 245 ),
204 246 'values' => $forms,
247 + 'legacy_values' => $legacy_forms,
205 248 'resource_type' => 'forms',
206 249 ),
207 250 'landing_page' => array(
208 251 'label' => __( 'Landing Page', 'convertkit' ),
209 252 'type' => 'select',
210 - 'description' => __( 'Select a landing page to make it appear in place of this page.', 'convertkit' ),
253 + 'description' => array(
254 + esc_html__( 'Select a landing page to make it appear in place of this page.', 'convertkit' ),
255 + sprintf(
256 + /* translators: Link to sign in to ConvertKit */
257 + esc_html__( 'To make changes to your landing pages, %s', 'convertkit' ),
258 + '<a href="' . esc_url( convertkit_get_sign_in_url() ) . '" target="_blank">' . esc_html__( 'sign in to Kit', 'convertkit' ) . '</a>'
259 + ),
260 + ),
211 261 'values' => $landing_pages,
262 + 'legacy_values' => $legacy_landing_pages,
212 263 'post_type' => 'page',
213 264 'resource_type' => 'landing_pages',
214 265 ),
215 266 'tag' => array(
@@ -214,9 +265,12 @@
214 265 ),
215 266 'tag' => array(
216 267 'label' => __( 'Tag', 'convertkit' ),
217 268 'type' => 'select',
218 - 'description' => __( 'Select a tag to apply to visitors of this page who are subscribed. A visitor is deemed to be subscribed if they have clicked a link in an email to this site which includes their subscriber ID, or have entered their email address in a Kit Form on this site.', 'convertkit' ),
269 + 'description' => array(
270 + esc_html__( 'Select a tag to apply to visitors of this page who are subscribed.', 'convertkit' ),
271 + esc_html__( 'A visitor is deemed to be subscribed if they have clicked a link in an email to this site which includes their subscriber ID, or have entered their email address in a Kit Form on this site.', 'convertkit' ),
272 + ),
219 273 'values' => $tags,
220 274 'resource_type' => 'tags',
221 275 ),
222 276 'restrict_content' => array(
@@ -221,10 +275,28 @@
221 275 ),
222 276 'restrict_content' => array(
223 277 'label' => __( 'Restrict Content', 'convertkit' ),
224 278 'type' => 'select',
225 - 'description' => __( 'Select the Kit form, tag or product that the visitor must be subscribed to, permitting them access to view this member-only content.', 'convertkit' ),
279 + 'description' => array(
280 + esc_html__( 'Select the Kit form, tag or product that the visitor must be subscribed to, permitting them access to view this member-only content.', 'convertkit' ),
281 + sprintf(
282 + '<code>%s</code>: %s',
283 + esc_html__( 'Form', 'convertkit' ),
284 + esc_html__( 'Displays the Kit form. On submission, the email address will be subscribed to the selected form, granting access to the member-only content. Useful to gate free content in return for an email address.', 'convertkit' )
285 + ),
286 + sprintf(
287 + '<code>%s</code>: %s',
288 + esc_html__( 'Tag', 'convertkit' ),
289 + esc_html__( 'Displays a WordPress styled subscription form. On submission, the email address will be subscribed to the selected tag, granting access to the member-only content. Useful to gate free content in return for an email address.', 'convertkit' )
290 + ),
291 + sprintf(
292 + '<code>%s</code>: %s',
293 + esc_html__( 'Product', 'convertkit' ),
294 + esc_html__( 'Displays a link to the Kit product, and a login form. Useful to gate content that can only be accessed by purchasing the Kit product.', 'convertkit' )
295 + ),
296 + ),
226 297 'values' => $restrict_content,
298 + 'legacy_values' => $restrict_content_legacy_forms,
227 299 'resource_type' => 'restrict_content',
228 300 ),
229 301 );
230 302