PluginProbe
Kit (formerly ConvertKit) – Email Newsletter, Email Marketing, Membership, Subscribers and Landing Pages / 3.1.9
Kit (formerly ConvertKit) – Email Newsletter, Email Marketing, Membership, Subscribers and Landing Pages v3.1.9
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/class-convertkit-resource-forms.php +3 -70 3.3.83.1.9 View file →
@@ -70,9 +70,9 @@
70 70
71 71 // Call parent refresh method.
72 72 $result = parent::refresh();
73 73
74 - // If an error occurred, maybe delete credentials from the Plugin's settings
74 + // If an error occured, maybe delete credentials from the Plugin's settings
75 75 // if the error is a 401 unauthorized.
76 76 if ( is_wp_error( $result ) ) {
77 77 convertkit_maybe_delete_credentials( $result, CONVERTKIT_OAUTH_CLIENT_ID );
78 78 }
@@ -153,44 +153,8 @@
153 153
154 154 }
155 155
156 156 /**
157 - * Returns all non-legacy forms (any v4 format: inline, modal, slide in
158 - * or sticky bar) based on the sort order. Legacy forms lack a `format`
159 - * key and are therefore excluded.
160 - *
161 - * @since 3.3.7
162 - *
163 - * @return bool|array
164 - */
165 - public function get_non_legacy() {
166 -
167 - // If the ConvertKit WordPress Libraries are < 1.3.6 (e.g. loaded by an outdated
168 - // addon), or a WordPress site updates this Plugin before other ConvertKit Plugins,
169 - // get_by() won't be available and will cause an E_ERROR, crashing the site.
170 - // @see https://wordpress.org/support/topic/error-1795/.
171 - if ( ! method_exists( $this, 'get_by' ) ) { // @phpstan-ignore-line Older WordPress Libraries won't have this function.
172 - return false;
173 - }
174 -
175 - return $this->get_by( 'format', array( 'inline', 'modal', 'slide in', 'sticky bar' ) );
176 -
177 - }
178 -
179 - /**
180 - * Returns whether any non-legacy forms exist in the options table.
181 - *
182 - * @since 3.3.7
183 - *
184 - * @return bool
185 - */
186 - public function non_legacy_exist() {
187 -
188 - return (bool) $this->get_non_legacy();
189 -
190 - }
191 -
192 - /**
193 157 * Determines if the given Form ID is a legacy Form or Landing Page.
194 158 *
195 159 * @since 2.5.0
196 160 *
@@ -231,9 +195,9 @@
231 195 */
232 196 public function get_select_field_all( $name, $id, $css_classes, $selected_option, $prepend_options = false, $attributes = false, $description = false ) {
233 197
234 198 return $this->get_select_field(
235 - $this->get_forms_for_select_field( $selected_option ),
199 + $this->get(),
236 200 $name,
237 201 $id,
238 202 $css_classes,
239 203 $selected_option,
@@ -259,9 +223,9 @@
259 223 */
260 224 public function output_select_field_all( $name, $id, $css_classes, $selected_option, $prepend_options = false, $attributes = false, $description = false ) {
261 225
262 226 $this->output_select_field(
263 - $this->get_forms_for_select_field( $selected_option ),
227 + $this->get(),
264 228 $name,
265 229 $id,
266 230 $css_classes,
267 231 $selected_option,
@@ -268,39 +232,8 @@
268 232 $prepend_options,
269 233 $attributes,
270 234 $description
271 235 );
272 -
273 - }
274 -
275 - /**
276 - * Returns the array of forms to display in an "all forms" dropdown: every
277 - * non-legacy form, plus the currently-selected legacy form (if any) so
278 - * existing saved legacy assignments continue to render as selected in the
279 - * UI without exposing other legacy forms as new selection options.
280 - *
281 - * @since 3.3.7
282 - *
283 - * @param string|int $selected_option Currently-selected form ID.
284 - * @return array
285 - */
286 - private function get_forms_for_select_field( $selected_option ) {
287 -
288 - $forms = $this->get_non_legacy();
289 - if ( ! is_array( $forms ) ) {
290 - $forms = array();
291 - }
292 -
293 - // If the currently-selected form is a legacy form, append it so the
294 - // dropdown shows the saved value as selected.
295 - if ( $selected_option && $this->is_legacy( $selected_option ) ) {
296 - $legacy_form = $this->get_by_id( (int) $selected_option );
297 - if ( $legacy_form ) {
298 - $forms[] = $legacy_form;
299 - }
300 - }
301 -
302 - return $forms;
303 236
304 237 }
305 238
306 239 /**