PluginProbe
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More / 6.2
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More v6.2
6.35 6.34 6.33.1 6.33 6.32.1 6.32 6.31 6.25 6.25.1 6.26 6.26.1 6.27 6.28 6.29 6.3 6.3.1 6.3.2 6.30 6.4 6.4.1 6.4.2 6.5 6.5.1 6.5.2 6.5.3 All 141 releases
← All changes | classes/controllers/FrmAddonsController.php +437 -528 6.256.2 View file →
@@ -5,93 +5,15 @@
5 5
6 6 class FrmAddonsController {
7 7
8 8 /**
9 - * @var string
9 + * @var string $plugin
10 10 */
11 - const SCRIPT_HANDLE = 'frm-addons-page';
12 -
13 - /**
14 - * @var array
15 - */
16 - private static $categories = array();
17 -
18 - /**
19 - * @var string
20 - */
21 - private static $request_addon_url;
22 -
23 - /**
24 - * @var string
25 - */
26 11 protected static $plugin;
27 12
28 13 /**
29 - * @since 6.15
30 - */
31 - public static function load_admin_hooks() {
32 - add_action( 'admin_menu', self::class . '::menu', 100 );
33 - add_filter( 'pre_set_site_transient_update_plugins', self::class . '::check_update' );
34 -
35 - if ( FrmAppHelper::is_admin_page( 'formidable-addons' ) ) {
36 - self::$request_addon_url = 'https://connect.formidableforms.com/add-on-request/';
37 -
38 - add_action( 'admin_enqueue_scripts', self::class . '::enqueue_assets', 15 );
39 - add_filter( 'frm_show_footer_links', '__return_false' );
40 - }
41 - }
42 -
43 - /**
44 - * Enqueues the Add-Ons page scripts and styles.
45 - *
46 - * @since 6.15
47 - *
48 14 * @return void
49 15 */
50 - public static function enqueue_assets() {
51 - $plugin_url = FrmAppHelper::plugin_url();
52 - $version = FrmAppHelper::plugin_version();
53 - $js_dependencies = array(
54 - 'wp-i18n',
55 - // This prevents a console error "wp.hooks is undefined" in WP versions older than 5.7.
56 - 'wp-hooks',
57 - 'formidable_dom',
58 - );
59 -
60 - // Enqueue styles that needed.
61 - wp_enqueue_style( 'formidable-admin' );
62 - wp_enqueue_style( 'formidable-grids' );
63 -
64 - // Register and enqueue Add-Ons page style.
65 - wp_register_style( self::SCRIPT_HANDLE, $plugin_url . '/css/admin/addons-page.css', array(), $version );
66 - wp_enqueue_style( self::SCRIPT_HANDLE );
67 -
68 - // Register and enqueue Add-Ons page script.
69 - wp_register_script( self::SCRIPT_HANDLE, $plugin_url . '/js/addons-page.js', $js_dependencies, $version, true );
70 - wp_localize_script( self::SCRIPT_HANDLE, 'frmAddonsVars', self::get_js_variables() );
71 - wp_enqueue_script( self::SCRIPT_HANDLE );
72 - wp_set_script_translations( self::SCRIPT_HANDLE, 'formidable' );
73 -
74 - FrmAppHelper::dequeue_extra_global_scripts();
75 - }
76 -
77 - /**
78 - * Get the Add-Ons page JS variables as an array.
79 - *
80 - * @since 6.15
81 - *
82 - * @return array
83 - */
84 - private static function get_js_variables() {
85 - return array(
86 - 'proIsIncluded' => FrmAppHelper::pro_is_included(),
87 - 'addonRequestURL' => self::$request_addon_url,
88 - );
89 - }
90 -
91 - /**
92 - * @return void
93 - */
94 16 public static function menu() {
95 17 if ( ! current_user_can( 'activate_plugins' ) ) {
96 18 return;
97 19 }
@@ -96,36 +18,25 @@
96 18 return;
97 19 }
98 20
99 21 $label = __( 'Add-Ons', 'formidable' );
100 - $label = '<span style="color:#3FCA89">' . esc_html( $label ) . '</span>';
22 + $label = '<span style="color:#fe5a1d">' . $label . '</span>';
101 23
102 24 add_submenu_page( 'formidable', 'Formidable | ' . __( 'Add-Ons', 'formidable' ), $label, 'frm_view_forms', 'formidable-addons', 'FrmAddonsController::list_addons' );
103 25
104 - // remove default created subpage, make the page with highest priority as default.
105 - remove_submenu_page( 'formidable', 'formidable' );
106 -
107 26 if ( ! FrmAppHelper::pro_is_installed() ) {
108 - $cta_text = FrmSalesApi::get_best_sale_value( 'menu_cta_text' );
109 - if ( ! $cta_text ) {
110 - $cta_text = __( 'Upgrade', 'formidable' );
111 - }
112 -
113 27 add_submenu_page(
114 28 'formidable',
115 29 'Formidable | ' . __( 'Upgrade', 'formidable' ),
116 - '<span class="frm-upgrade-submenu">' . esc_html( $cta_text ) . '</span>',
30 + '<span class="frm-upgrade-submenu">' . __( 'Upgrade', 'formidable' ) . '</span>',
117 31 'frm_view_forms',
118 32 'formidable-pro-upgrade',
119 - function () {
120 - // This function doesn't need to do anything.
121 - // The redirect is handled earlier to avoid issues with the headers being sent.
122 - }
33 + 'FrmAddonsController::upgrade_to_pro'
123 34 );
124 35 } elseif ( 'formidable-pro-upgrade' === FrmAppHelper::get_param( 'page' ) ) {
125 36 wp_safe_redirect( admin_url( 'admin.php?page=formidable' ) );
126 37 exit;
127 - }//end if
38 + }
128 39 }
129 40
130 41 /**
131 42 * @return void
@@ -131,31 +42,28 @@
131 42 * @return void
132 43 */
133 44 public static function list_addons() {
134 45 FrmAppHelper::include_svg();
46 + $installed_addons = apply_filters( 'frm_installed_addons', array() );
47 + $license_type = '';
135 48
136 - $view_path = FrmAppHelper::plugin_path() . '/classes/views/addons/';
137 - $installed_addons = apply_filters( 'frm_installed_addons', array() );
138 - $addons = self::get_api_addons();
139 - $errors = array();
140 - $license_type = '';
141 - $request_addon_url = self::$request_addon_url;
49 + $addons = self::get_api_addons();
50 + $errors = array();
142 51
143 52 if ( isset( $addons['error'] ) ) {
144 - $api = new FrmFormApi();
145 - $errors = $api->get_error_from_response( $addons );
146 - $license_type = $addons['error']['type'] ?? '';
53 + $api = new FrmFormApi();
54 + $errors = $api->get_error_from_response( $addons );
55 + $license_type = isset( $addons['error']['type'] ) ? $addons['error']['type'] : '';
147 56 unset( $addons['error'] );
148 57 }
149 58
150 - $pro = array(
59 + $pro = array(
151 60 'pro' => array(
152 - 'title' => 'Formidable Forms Pro',
153 - 'slug' => 'formidable-pro',
154 - 'released' => '2011-02-05',
155 - 'docs' => 'knowledgebase/',
156 - 'categories' => array( 'basic', 'plus', 'business', 'elite' ),
157 - 'excerpt' => 'Create calculators, surveys, smart forms, and data-driven applications. Build directories, real estate listings, job boards, and much more.',
61 + 'title' => 'Formidable Forms Pro',
62 + 'slug' => 'formidable-pro',
63 + 'released' => '2011-02-05',
64 + 'docs' => 'knowledgebase/',
65 + 'excerpt' => 'Create calculators, surveys, smart forms, and data-driven applications. Build directories, real estate listings, job boards, and much more.',
158 66 ),
159 67 );
160 68 $addons = $pro + $addons;
161 69 self::prepare_addons( $addons );
@@ -161,105 +69,14 @@
161 69 self::prepare_addons( $addons );
162 70
163 71 $pricing = FrmAppHelper::admin_upgrade_link( 'addons' );
164 72
165 - self::organize_and_get_categories();
166 - $categories = self::$categories;
167 -
168 - include $view_path . 'index.php';
73 + include( FrmAppHelper::plugin_path() . '/classes/views/addons/list.php' );
169 74 }
170 75
171 76 /**
172 - * Organize and set categories.
173 - *
174 - * @since 6.15
175 - *
176 77 * @return void
177 78 */
178 - protected static function organize_and_get_categories() {
179 - unset( self::$categories['strategy11'] );
180 - ksort( self::$categories );
181 -
182 - $bottom_categories = array();
183 - $plans = FrmFormsHelper::get_license_types(
184 - array(
185 - 'include_all' => false,
186 - 'case_lower' => true,
187 - )
188 - );
189 -
190 - // Extract the elements to move
191 - foreach ( $plans as $plan ) {
192 - if ( isset( self::$categories[ $plan ] ) ) {
193 - $bottom_categories[ $plan ] = self::$categories[ $plan ];
194 - unset( self::$categories[ $plan ] );
195 - }
196 - }
197 -
198 - $special_categories = array();
199 - if ( 'elite' !== self::license_type() ) {
200 - $special_categories['available-addons'] = array(
201 - 'name' => __( 'Available', 'formidable' ),
202 - // To be assigned via JavaScript.
203 - 'count' => 0,
204 - );
205 - }
206 -
207 - $special_categories['active-addons'] = array(
208 - 'name' => __( 'Active', 'formidable' ),
209 - // To be assigned via JavaScript.
210 - 'count' => 0,
211 - );
212 -
213 - $special_categories['all-items'] = array(
214 - 'name' => __( 'All Add-Ons', 'formidable' ),
215 - // To be assigned via JavaScript.
216 - 'count' => 0,
217 - );
218 -
219 - self::$categories = array_merge(
220 - $special_categories,
221 - self::$categories,
222 - $bottom_categories
223 - );
224 - }
225 -
226 - /**
227 - * Organize and set categories.
228 - *
229 - * @since 6.15
230 - *
231 - * @param array $addon The addon array that will be modified by reference.
232 - * @return void
233 - */
234 - protected static function set_categories( &$addon ) {
235 - if ( ! isset( $addon['categories'] ) ) {
236 - return;
237 - }
238 -
239 - $addon['category-slugs'] = array();
240 -
241 - foreach ( $addon['categories'] as $category ) {
242 - $category = FrmFormsHelper::convert_legacy_package_names( $category );
243 - $category_slug = sanitize_title( $category );
244 -
245 - // Add the slug to the new array.
246 - $addon['category-slugs'][] = $category_slug;
247 -
248 - if ( ! isset( self::$categories[ $category_slug ] ) ) {
249 - self::$categories[ $category_slug ] = array(
250 - 'name' => $category,
251 - 'count' => 0,
252 - );
253 - }
254 -
255 - ++self::$categories[ $category_slug ]['count'];
256 - }
257 - }
258 -
259 - /**
260 - * @return void
261 - */
262 79 public static function license_settings() {
263 80 $plugins = apply_filters( 'frm_installed_addons', array() );
264 81 if ( empty( $plugins ) ) {
265 82 esc_html_e( 'There are no plugins on your site that require a license', 'formidable' );
@@ -268,9 +85,9 @@
268 85 }
269 86
270 87 ksort( $plugins );
271 88
272 - include FrmAppHelper::plugin_path() . '/classes/views/addons/settings.php';
89 + include( FrmAppHelper::plugin_path() . '/classes/views/addons/settings.php' );
273 90 }
274 91
275 92 /**
276 93 * @return array
@@ -292,21 +109,8 @@
292 109 return $addons;
293 110 }
294 111
295 112 /**
296 - * Retrieves the count of available addons.
297 - *
298 - * @since 6.9
299 - *
300 - * @return int Count of addons.
301 - */
302 - public static function get_addons_count() {
303 - $addons = self::get_api_addons();
304 -
305 - return count( $addons );
306 - }
307 -
308 - /**
309 113 * If the API is unable to connect, show something on the addons page
310 114 *
311 115 * @since 3.04.03
312 116 * @return array
@@ -414,9 +218,9 @@
414 218 $api = new FrmFormApi( $license );
415 219 $downloads = $api->get_api_info();
416 220 $pro = self::get_pro_from_addons( $downloads );
417 221
418 - return $pro['url'] ?? '';
222 + return isset( $pro['url'] ) ? $pro['url'] : '';
419 223 }
420 224
421 225 /**
422 226 * @since 4.08
@@ -452,9 +256,9 @@
452 256 * @param array $addons
453 257 * @return array
454 258 */
455 259 protected static function get_pro_from_addons( $addons ) {
456 - return $addons['93790'] ?? array();
260 + return isset( $addons['93790'] ) ? $addons['93790'] : array();
457 261 }
458 262
459 263 /**
460 264 * @since 4.06
@@ -468,10 +272,8 @@
468 272 }
469 273
470 274 /**
471 275 * @since 4.0.01
472 - *
473 - * @return bool
474 276 */
475 277 public static function is_license_expired() {
476 278 $version_info = self::get_primary_license_info();
477 279 if ( ! isset( $version_info['error'] ) ) {
@@ -477,29 +279,30 @@
477 279 if ( ! isset( $version_info['error'] ) ) {
478 280 return false;
479 281 }
480 282
481 - $expires = $version_info['error']['expires'] ?? 0;
482 - if ( empty( $expires ) || $expires > time() ) {
483 - return false;
484 - }
283 + return $version_info['error'];
284 + }
485 285
486 - $rate_limited = ! empty( $version_info['response_code'] ) && 429 === (int) $version_info['response_code'];
487 - if ( $rate_limited ) {
488 - // Do not return false positives for rate limited responses.
489 - return false;
286 + /**
287 + * @since 4.08
288 + *
289 + * @return boolean|int false or the number of days until expiration.
290 + */
291 + public static function is_license_expiring() {
292 + if ( is_callable( 'FrmProAddonsController::is_license_expiring' ) ) {
293 + return FrmProAddonsController::is_license_expiring();
490 294 }
491 295
492 - return $version_info['error'];
296 + return false;
493 297 }
494 298
495 299 /**
496 300 * @since 4.08
497 - * @since 6.7 This is public.
498 301 *
499 302 * @return array|false
500 303 */
501 - public static function get_primary_license_info() {
304 + protected static function get_primary_license_info() {
502 305 $installed_addons = apply_filters( 'frm_installed_addons', array() );
503 306 if ( empty( $installed_addons ) || ! isset( $installed_addons['formidable_pro'] ) ) {
504 307 return false;
505 308 }
@@ -531,9 +334,9 @@
531 334 $version_info = self::fill_update_addon_info( $installed_addons );
532 335 $transient->last_checked = time();
533 336 $wp_plugins = self::get_plugins();
534 337
535 - foreach ( $version_info as $plugin ) {
338 + foreach ( $version_info as $id => $plugin ) {
536 339 $plugin = (object) $plugin;
537 340
538 341 if ( ! isset( $plugin->new_version ) || ! isset( $plugin->package ) ) {
539 342 continue;
@@ -548,21 +351,20 @@
548 351 // don't show an update if the plugin isn't installed
549 352 continue;
550 353 }
551 354
552 - $wp_plugin = $wp_plugins[ $folder ] ?? array();
553 - $wp_version = $wp_plugin['Version'] ?? '1.0';
554 - $plugin->slug = explode( '/', $folder )[0];
355 + $wp_plugin = isset( $wp_plugins[ $folder ] ) ? $wp_plugins[ $folder ] : array();
356 + $wp_version = isset( $wp_plugin['Version'] ) ? $wp_plugin['Version'] : '1.0';
555 357
556 358 if ( version_compare( $wp_version, $plugin->new_version, '<' ) ) {
359 + $slug = explode( '/', $folder );
360 + $plugin->slug = $slug[0];
557 361 $transient->response[ $folder ] = $plugin;
558 - } else {
559 - $transient->no_update[ $folder ] = $plugin;
560 362 }
561 363
562 364 $transient->checked[ $folder ] = $wp_version;
563 365
564 - }//end foreach
366 + }
565 367
566 368 return $transient;
567 369 }
568 370
@@ -585,9 +387,9 @@
585 387 * Check if a plugin is installed before showing an update for it
586 388 *
587 389 * @since 3.05
588 390 *
589 - * @param string $plugin The folder/filename.php for a plugin.
391 + * @param string $plugin - the folder/filename.php for a plugin
590 392 *
591 393 * @return bool - True if installed
592 394 */
593 395 protected static function is_installed( $plugin ) {
@@ -629,9 +431,9 @@
629 431 if ( empty( $plugin ) ) {
630 432 continue;
631 433 }
632 434
633 - $download_id = $plugin['id'] ?? 0;
435 + $download_id = isset( $plugin['id'] ) ? $plugin['id'] : 0;
634 436 if ( ! empty( $download_id ) && ! isset( $version_info[ $download_id ]['package'] ) ) {
635 437 // if this addon is using its own license, get the update url
636 438 $addon_info = $api->get_api_info();
637 439
@@ -642,9 +444,9 @@
642 444 'code' => $addon_info['error']['code'],
643 445 );
644 446 }
645 447 }
646 - }//end foreach
448 + }
647 449
648 450 return $version_info;
649 451 }
650 452
@@ -651,9 +453,9 @@
651 453 /**
652 454 * Get the action link for an addon that isn't active.
653 455 *
654 456 * @since 3.06.03
655 - * @param string $plugin The plugin slug.
457 + * @param string $plugin The plugin slug
656 458 * @return array
657 459 */
658 460 public static function install_link( $plugin ) {
659 461 $link = array();
@@ -664,14 +466,14 @@
664 466 $link = array(
665 467 'url' => $addon['plugin'],
666 468 'class' => 'frm-activate-addon',
667 469 );
668 - } elseif ( ! empty( $addon['url'] ) ) {
470 + } elseif ( isset( $addon['url'] ) && ! empty( $addon['url'] ) ) {
669 471 $link = array(
670 472 'url' => $addon['url'],
671 473 'class' => 'frm-install-addon',
672 474 );
673 - } elseif ( ! empty( $addon['categories'] ) ) {
475 + } elseif ( isset( $addon['categories'] ) && ! empty( $addon['categories'] ) ) {
674 476 $link = array(
675 477 'categories' => $addon['categories'],
676 478 );
677 479 }
@@ -683,9 +485,9 @@
683 485 $link = array(
684 486 'url' => 'formidable-' . $plugin . '/formidable-' . $plugin . '.php',
685 487 'class' => 'frm-activate-addon',
686 488 );
687 - }//end if
489 + }
688 490
689 491 return $link;
690 492 }
691 493
@@ -690,12 +492,12 @@
690 492 }
691 493
692 494 /**
693 495 * @since 4.09
694 - * @param string $plugin The plugin slug.
496 + * @param string $plugin The plugin slug
695 497 * @return array|false
696 498 */
697 - public static function get_addon( $plugin ) {
499 + protected static function get_addon( $plugin ) {
698 500 $addons = self::get_api_addons();
699 501 self::prepare_addons( $addons );
700 502 foreach ( $addons as $addon ) {
701 503 $slug = explode( '/', $addon['plugin'] );
@@ -721,10 +523,10 @@
721 523
722 524 /**
723 525 * @since 3.04.03
724 526 *
725 - * @param array $addons
726 - * @param object $license The FrmAddon object.
527 + * @param array $addons
528 + * @param object $license The FrmAddon object
727 529 *
728 530 * @return array
729 531 */
730 532 public static function get_addon_for_license( $addons, $license ) {
@@ -731,9 +533,9 @@
731 533 $download_id = $license->download_id;
732 534 $plugin = array();
733 535 if ( empty( $download_id ) && ! empty( $addons ) ) {
734 536 foreach ( $addons as $addon ) {
735 - if ( strtolower( $license->plugin_name ) === strtolower( $addon['title'] ) ) {
537 + if ( strtolower( $license->plugin_name ) == strtolower( $addon['title'] ) ) {
736 538 return $addon;
737 539 }
738 540 }
739 541 } elseif ( isset( $addons[ $download_id ] ) ) {
@@ -797,15 +599,13 @@
797 599
798 600 if ( ! isset( $addon['link'] ) ) {
799 601 $addon['link'] = 'downloads/' . $slug . '/';
800 602 }
603 + self::prepare_addon_link( $addon['link'] );
801 604
802 - self::prepare_addon_link( $addon['link'] );
803 605 self::set_addon_status( $addon );
804 - self::set_categories( $addon );
805 -
806 606 $addons[ $id ] = $addon;
807 - }//end foreach
607 + }
808 608 }
809 609
810 610 /**
811 611 * @return bool
@@ -817,9 +617,9 @@
817 617 return is_plugin_active( $file_name );
818 618 }
819 619
820 620 /**
821 - * @return false|string either 'visual-views' or 'views', false if one is not found.
621 + * @return string|false either 'visual-views' or 'views', false if one is not found.
822 622 */
823 623 private static function get_active_views_version() {
824 624 if ( ! is_callable( 'FrmViewsAppHelper::plugin_version' ) ) {
825 625 return false;
@@ -874,64 +674,263 @@
874 674 }
875 675 }
876 676
877 677 /**
878 - * @since 5.5.2
879 - *
880 - * @param string $plugin
881 - * @param string $redirect
882 - * @param bool $network_wide
883 - * @param bool $silent
884 - * @return WP_Error|null Null on success, WP_Error on invalid file.
678 + * @return void
885 679 */
886 - protected static function activate_plugin( $plugin, $redirect = '', $network_wide = false, $silent = false ) {
887 - if ( ! function_exists( 'activate_plugin' ) ) {
888 - require_once ABSPATH . 'wp-admin/includes/plugin.php';
889 - }
890 - return activate_plugin( $plugin, $redirect, $network_wide, $silent );
680 + public static function upgrade_to_pro() {
681 + FrmAppHelper::include_svg();
682 +
683 + $link_parts = array(
684 + 'medium' => 'upgrade',
685 + 'content' => 'button',
686 + );
687 +
688 + $features = array(
689 + 'Display Entries' => array(
690 + array(
691 + 'label' => 'Display form data with virtually limitless views',
692 + 'link' => array(
693 + 'content' => 'views',
694 + 'param' => 'views-display-form-data',
695 + ),
696 + 'lite' => false,
697 + ),
698 + array(
699 + 'label' => 'Generate graphs and stats based on your submitted data',
700 + 'link' => array(
701 + 'content' => 'graphs',
702 + 'param' => 'statistics-graphs-wordpress-forms',
703 + ),
704 + 'lite' => false,
705 + ),
706 + ),
707 + 'Entry Management' => array(
708 + array(
709 + 'label' => 'Import entries from a CSV',
710 + 'link' => array(
711 + 'content' => 'import-entries',
712 + 'param' => 'importing-exporting-wordpress-forms',
713 + ),
714 + 'lite' => false,
715 + ),
716 + array(
717 + 'label' => 'Logged-in users can save drafts and return later',
718 + 'link' => array(
719 + 'content' => 'save-drafts',
720 + 'param' => 'save-drafts-wordpress-form',
721 + ),
722 + 'lite' => false,
723 + ),
724 + array(
725 + 'label' => 'Flexibly and powerfully view, edit, and delete entries from anywhere on your site',
726 + 'link' => array(
727 + 'content' => 'front-edit',
728 + 'param' => 'wordpress-front-end-editing',
729 + ),
730 + 'lite' => false,
731 + ),
732 + array(
733 + 'label' => 'View form submissions from the back-end',
734 + 'lite' => true,
735 + ),
736 + array(
737 + 'label' => 'Export your entries to a CSV',
738 + 'lite' => true,
739 + ),
740 + ),
741 + 'Form Building' => array(
742 + array(
743 + 'label' => 'Save a calculated value into a field',
744 + 'link' => array(
745 + 'content' => 'calculations',
746 + 'param' => 'field-calculations-wordpress-form',
747 + ),
748 + 'lite' => false,
749 + ),
750 + array(
751 + 'label' => 'Allow multiple file uploads',
752 + 'link' => array(
753 + 'content' => 'file-uploads',
754 + 'param' => 'wordpress-multi-file-upload-fields',
755 + ),
756 + 'lite' => false,
757 + ),
758 + array(
759 + 'label' => 'Repeat sections of fields',
760 + 'link' => array(
761 + 'content' => 'repeaters',
762 + 'param' => 'repeatable-sections-forms',
763 + ),
764 + 'lite' => false,
765 + ),
766 + array(
767 + 'label' => 'Hide and show fields conditionally based on other fields or the user\'s role',
768 + 'link' => array(
769 + 'content' => 'conditional-logic',
770 + 'param' => 'conditional-logic-wordpress-forms',
771 + ),
772 + 'lite' => false,
773 + ),
774 + array(
775 + 'label' => 'Confirmation fields',
776 + 'link' => array(
777 + 'content' => 'confirmation-fields',
778 + 'param' => 'confirmation-fields-wordpress-forms',
779 + ),
780 + 'lite' => false,
781 + ),
782 + array(
783 + 'label' => 'Multi-paged forms',
784 + 'link' => array(
785 + 'content' => 'page-breaks',
786 + 'param' => 'wordpress-multi-page-forms',
787 + ),
788 + 'lite' => false,
789 + ),
790 + array(
791 + 'label' => 'Include section headings, page breaks, rich text, dates, times, scales, star ratings, sliders, toggles, dynamic fields populated from other forms, passwords, and tags in advanced forms.',
792 + 'lite' => false,
793 + ),
794 + array(
795 + 'label' => 'Include text, email, url, paragraph text, radio, checkbox, dropdown fields, hidden fields, user ID fields, and HTML blocks in your form.',
796 + 'lite' => true,
797 + ),
798 + array(
799 + 'label' => 'Drag & Drop Form building',
800 + 'link' => array(
801 + 'content' => 'drag-drop',
802 + 'param' => 'drag-drop-forms',
803 + ),
804 + 'lite' => true,
805 + ),
806 + array(
807 + 'label' => 'Create forms from Templates',
808 + 'link' => array(
809 + 'content' => 'form-templates',
810 + 'param' => 'wordpress-form-templates',
811 + ),
812 + 'lite' => true,
813 + ),
814 + array(
815 + 'label' => 'Import and export forms with XML',
816 + 'link' => array(
817 + 'content' => 'import',
818 + 'param' => 'importing-exporting-wordpress-forms',
819 + ),
820 + 'lite' => true,
821 + ),
822 + array(
823 + 'label' => 'Use input placeholder text in your fields that clear when typing starts.',
824 + 'lite' => true,
825 + ),
826 + ),
827 + 'Form Actions' => array(
828 + array(
829 + 'label' => 'Conditionally send your email notifications based on values in your form',
830 + 'link' => array(
831 + 'content' => 'conditional-emails',
832 + ),
833 + 'lite' => false,
834 + ),
835 + array(
836 + 'label' => 'Create and edit WordPress posts or custom posts from the front-end',
837 + 'link' => array(
838 + 'content' => 'create-posts',
839 + 'param' => 'create-posts-pages-wordpress-forms',
840 + ),
841 + 'lite' => false,
842 + ),
843 + array(
844 + 'label' => 'Send multiple emails and autoresponders',
845 + 'link' => array(
846 + 'content' => 'multiple-emails',
847 + 'param' => 'virtually-unlimited-emails',
848 + ),
849 + 'lite' => true,
850 + ),
851 + ),
852 + 'Form Appearance' => array(
853 + array(
854 + 'label' => 'Create Multiple styles for different forms',
855 + 'link' => array(
856 + 'content' => 'multiple-styles',
857 + 'param' => 'wordpress-visual-form-styler',
858 + ),
859 + 'lite' => false,
860 + ),
861 + array(
862 + 'label' => 'Customizable layout with CSS classes',
863 + 'link' => array(
864 + 'content' => 'form-layout',
865 + 'param' => 'wordpress-mobile-friendly-forms',
866 + ),
867 + 'lite' => true,
868 + ),
869 + array(
870 + 'label' => 'Customize the HTML for your forms',
871 + 'link' => array(
872 + 'content' => 'custom-html',
873 + 'param' => 'customizable-html-wordpress-form',
874 + ),
875 + 'lite' => true,
876 + ),
877 + array(
878 + 'label' => 'Style your form with the Visual Form Styler',
879 + 'lite' => true,
880 + ),
881 + ),
882 + );
883 +
884 + include( FrmAppHelper::plugin_path() . '/classes/views/addons/upgrade_to_pro.php' );
891 885 }
892 886
893 887 /**
894 - * Deactivate a specified plugin.
888 + * Install Pro after connection with Formidable.
895 889 *
896 - * @since 6.8
890 + * @since 4.02.05
897 891 *
898 - * @param string $plugin
899 - * @param bool $silent
900 892 * @return void
901 893 */
902 - protected static function deactivate_plugin( $plugin, $silent = false ) {
903 - if ( ! function_exists( 'deactivate_plugins' ) ) {
904 - require_once ABSPATH . 'wp-admin/includes/plugin.php';
894 + public static function connect_pro() {
895 + FrmAppHelper::permission_check( 'install_plugins' );
896 + check_ajax_referer( 'frm_ajax', 'nonce' );
897 +
898 + $url = self::get_current_plugin();
899 + if ( FrmAppHelper::pro_is_installed() || empty( $url ) ) {
900 + wp_die();
905 901 }
906 - deactivate_plugins( $plugin, $silent );
902 +
903 + $response = array();
904 +
905 + // It's already installed and active.
906 + $active = self::activate_plugin( 'formidable-pro/formidable-pro.php', false, false, true );
907 + if ( is_wp_error( $active ) ) {
908 + // The plugin was installed, but not active. Download it now.
909 + self::ajax_install_addon();
910 + } else {
911 + $response['active'] = true;
912 + $response['success'] = true;
913 + }
914 +
915 + echo json_encode( $response );
916 + wp_die();
907 917 }
908 918
909 919 /**
910 - * Uninstall a specified plugin.
920 + * @since 5.5.2
911 921 *
912 - * @since 6.8
913 - *
914 922 * @param string $plugin
915 - * @return true|WP_Error True on success, WP_Error on invalid file.
923 + * @param string $redirect
924 + * @param bool $network_wide
925 + * @param bool $silent
926 + * @return null|WP_Error Null on success, WP_Error on invalid file.
916 927 */
917 - protected static function uninstall_plugin( $plugin ) {
918 - if ( ! current_user_can( 'delete_plugins' ) ) {
919 - return new WP_Error( 'uninstall_failed', __( 'Current user cannot delete plugins.', 'formidable' ) );
920 - }
921 -
922 - if ( ! function_exists( 'delete_plugins' ) ) {
928 + protected static function activate_plugin( $plugin, $redirect = '', $network_wide = false, $silent = false ) {
929 + if ( ! function_exists( 'activate_plugin' ) ) {
923 930 require_once ABSPATH . 'wp-admin/includes/plugin.php';
924 931 }
925 -
926 - self::deactivate_plugin( $plugin, true );
927 - $result = delete_plugins( array( $plugin ) );
928 -
929 - if ( is_wp_error( $result ) ) {
930 - return $result;
931 - }
932 -
933 - return true;
932 + return activate_plugin( $plugin, $redirect, $network_wide, $silent );
934 933 }
935 934
936 935 /**
937 936 * @since 5.0.10
@@ -938,9 +937,9 @@
938 937 *
939 938 * @return string
940 939 */
941 940 protected static function get_current_plugin() {
942 - if ( empty( self::$plugin ) ) {
941 + if ( ! isset( self::$plugin ) ) {
943 942 self::$plugin = FrmAppHelper::get_param( 'plugin', '', 'post', 'esc_url_raw' );
944 943 }
945 944 return self::$plugin;
946 945 }
@@ -946,10 +945,8 @@
946 945 }
947 946
948 947 /**
949 948 * @since 4.08
950 - *
951 - * @return array|void
952 949 */
953 950 protected static function download_and_activate() {
954 951 if ( is_admin() ) {
955 952 FrmAppHelper::set_current_screen_and_hook_suffix();
@@ -960,9 +957,9 @@
960 957 $installed = self::install_addon();
961 958 if ( is_array( $installed ) && isset( $installed['message'] ) ) {
962 959 return $installed;
963 960 }
964 - self::handle_addon_action( $installed, 'activate' );
961 + self::maybe_activate_addon( $installed );
965 962 }
966 963
967 964 /**
968 965 * @since 3.04.02
@@ -970,12 +967,12 @@
970 967 * @return void
971 968 */
972 969 protected static function maybe_show_cred_form() {
973 970 if ( ! function_exists( 'request_filesystem_credentials' ) ) {
974 - include_once ABSPATH . 'wp-admin/includes/file.php';
971 + include_once( ABSPATH . 'wp-admin/includes/file.php' );
975 972 }
976 973
977 - // Start output buffering to catch the filesystem form if credentials are needed.
974 + // Start output bufferring to catch the filesystem form if credentials are needed.
978 975 ob_start();
979 976
980 977 $show_form = false;
981 978 $method = '';
@@ -1014,9 +1011,12 @@
1014 1011 *
1015 1012 * @return bool
1016 1013 */
1017 1014 public static function url_is_allowed( $download_url ) {
1018 - return FrmAppHelper::validate_url_is_in_s3_bucket( $download_url, 'zip' ) || in_array( $download_url, self::allowed_external_urls(), true );
1015 + return (
1016 + FrmAppHelper::validate_url_is_in_s3_bucket( $download_url, 'zip' ) ||
1017 + ( strpos( $download_url, 'https://downloads.wordpress.org/plugin' ) === 0 && substr_compare( $download_url, '.zip', -4 ) === 0 )
1018 + );
1019 1019 }
1020 1020
1021 1021 /**
1022 1022 * We do not need any extra credentials if we have gotten this far,
@@ -1053,139 +1053,33 @@
1053 1053 return $plugin;
1054 1054 }
1055 1055
1056 1056 /**
1057 - * Handle the AJAX request to activate an add-on.
1057 + * @since 3.06.03
1058 1058 *
1059 - * @since 6.8
1060 - *
1061 1059 * @return void
1062 1060 */
1063 1061 public static function ajax_activate_addon() {
1064 - self::process_addon_action(
1065 - function ( $plugin ) {
1066 - return self::handle_addon_action( $plugin, 'activate' );
1067 - },
1068 - array( 'FrmAddonsController', 'get_addon_activation_response' )
1069 - );
1070 - }
1071 1062
1072 - /**
1073 - * @since 3.04.02
1074 - *
1075 - * @param string $installed The plugin folder name with file name.
1076 - */
1077 - protected static function maybe_activate_addon( $installed ) {
1078 - self::ajax_activate_addon();
1079 - }
1063 + self::install_addon_permissions();
1080 1064
1081 - /**
1082 - * Handle the AJAX request to deactivate an add-on.
1083 - *
1084 - * @since 6.8
1085 - *
1086 - * @return void
1087 - */
1088 - public static function ajax_deactivate_addon() {
1089 - self::process_addon_action(
1090 - function ( $plugin ) {
1091 - return self::handle_addon_action( $plugin, 'deactivate' );
1092 - }
1093 - );
1094 - }
1095 -
1096 - /**
1097 - * Handle the AJAX request to uninstall an add-on.
1098 - *
1099 - * @since 6.8
1100 - *
1101 - * @return void
1102 - */
1103 - public static function ajax_uninstall_addon() {
1104 - self::process_addon_action(
1105 - function ( $plugin ) {
1106 - return self::handle_addon_action( $plugin, 'uninstall' );
1107 - }
1108 - );
1109 - }
1110 -
1111 - /**
1112 - * Process a specific action (activate, deactivate, uninstall) on an add-on.
1113 - *
1114 - * @since 6.8
1115 - *
1116 - * @param callable $action_callback The specific add-on action to be executed.
1117 - * @param callable|null $response_callback Optional. The response handling callback. Default null.
1118 - * @return void
1119 - */
1120 - private static function process_addon_action( $action_callback, $response_callback = null ) {
1121 - self::install_addon_permissions();
1122 1065 FrmAppHelper::set_current_screen_and_hook_suffix();
1123 1066
1124 1067 $plugin = FrmAppHelper::get_param( 'plugin', '', 'post', 'sanitize_text_field' );
1125 - call_user_func( $action_callback, $plugin );
1068 + self::maybe_activate_addon( $plugin );
1126 1069
1127 - if ( is_callable( $response_callback ) ) {
1128 - wp_send_json_success( call_user_func( $response_callback ) );
1129 - return;
1130 - }
1131 -
1132 - wp_send_json_success();
1070 + echo json_encode( self::get_addon_activation_response() );
1071 + wp_die();
1133 1072 }
1134 1073
1135 1074 /**
1136 - * Attempt to perform a specific action (activate, deactivate, uninstall) on an add-on.
1137 - *
1138 - * @since 6.8
1139 - *
1140 - * @param string $installed The plugin folder name with file name.
1141 - * @param string $action The action type ('activate', 'deactivate', 'uninstall').
1142 - * @return array|void
1143 - */
1144 - protected static function handle_addon_action( $installed, $action ) {
1145 - if ( ! $installed || ! $action ) {
1146 - return;
1147 - }
1148 -
1149 - $result = null;
1150 - switch ( $action ) {
1151 - case 'activate':
1152 - $result = self::activate_plugin( $installed );
1153 - break;
1154 - case 'deactivate':
1155 - self::deactivate_plugin( $installed );
1156 - break;
1157 - case 'uninstall':
1158 - $result = self::uninstall_plugin( $installed );
1159 - break;
1160 - }
1161 -
1162 - if ( is_wp_error( $result ) ) {
1163 - // Ignore the invalid header message that shows with nested plugins.
1164 - if ( $result->get_error_code() !== 'no_plugin_header' ) {
1165 - if ( wp_doing_ajax() ) {
1166 - wp_send_json_error( array( 'error' => $result->get_error_message() ) );
1167 - }
1168 - return array(
1169 - 'message' => $result->get_error_message(),
1170 - 'success' => false,
1171 - );
1172 - }
1173 - }
1174 -
1175 - return $result;
1176 - }
1177 -
1178 - /**
1179 1075 * @return array
1180 1076 */
1181 1077 private static function get_addon_activation_response() {
1182 1078 $activating_page = self::get_activating_page();
1183 1079
1184 - $message = $activating_page ? __( 'Your plugin has been activated. Would you like to save and reload the page now?', 'formidable' ) : __( 'Your plugin has been activated.', 'formidable' );
1185 -
1186 1080 $response = array(
1187 - 'message' => $message,
1081 + 'message' => __( 'Your plugin has been activated. Would you like to save and reload the page now?', 'formidable' ),
1188 1082 'saveAndReload' => $activating_page,
1189 1083 );
1190 1084
1191 1085 return $response;
@@ -1210,8 +1104,34 @@
1210 1104 return '';
1211 1105 }
1212 1106
1213 1107 /**
1108 + * @since 3.04.02
1109 + *
1110 + * @param string $installed The plugin folder name with file name
1111 + */
1112 + protected static function maybe_activate_addon( $installed ) {
1113 + if ( ! $installed ) {
1114 + return;
1115 + }
1116 +
1117 + $activate = self::activate_plugin( $installed );
1118 + if ( is_wp_error( $activate ) ) {
1119 + // Ignore the invalid header message that shows with nested plugins.
1120 + if ( $activate->get_error_code() !== 'no_plugin_header' ) {
1121 + if ( wp_doing_ajax() ) {
1122 + echo json_encode( array( 'error' => $activate->get_error_message() ) );
1123 + wp_die();
1124 + }
1125 + return array(
1126 + 'message' => $activate->get_error_message(),
1127 + 'success' => false,
1128 + );
1129 + }
1130 + }
1131 + }
1132 +
1133 + /**
1214 1134 * Run security checks before installing
1215 1135 *
1216 1136 * @since 3.04.02
1217 1137 *
@@ -1234,18 +1154,15 @@
1234 1154 public static function connect_link() {
1235 1155 $auth = get_option( 'frm_connect_token' );
1236 1156 if ( empty( $auth ) ) {
1237 1157 $auth = hash( 'sha512', wp_rand() );
1238 - update_option( 'frm_connect_token', $auth, 'no' );
1158 + update_option( 'frm_connect_token', $auth );
1239 1159 }
1240 - $page = FrmAppHelper::simple_get( 'page', 'sanitize_title', 'formidable-settings' );
1241 - $link = 'https://formidableforms.com/api-connect/';
1160 + $link = FrmAppHelper::admin_upgrade_link( 'connect', 'api-connect' );
1242 1161 $args = array(
1243 1162 'v' => 2,
1244 1163 'siteurl' => FrmAppHelper::site_url(),
1245 1164 'url' => get_rest_url(),
1246 - 'inst' => (int) FrmAppHelper::pro_is_included(),
1247 - 'return' => $page,
1248 1165 'token' => $auth,
1249 1166 'l' => self::get_pro_license(),
1250 1167 );
1251 1168
@@ -1263,12 +1180,9 @@
1263 1180 // Verify params present (auth & download link).
1264 1181 $post_auth = FrmAppHelper::get_param( 'token', '', 'request', 'sanitize_text_field' );
1265 1182 $post_url = FrmAppHelper::get_param( 'file_url', '', 'request', 'sanitize_text_field' );
1266 1183
1267 - // The download link is not required if already installed.
1268 - $is_installed = FrmAppHelper::pro_is_included();
1269 - $file_missing = ! $is_installed && empty( $post_url );
1270 - if ( ! $post_auth || $file_missing ) {
1184 + if ( empty( $post_auth ) || empty( $post_url ) ) {
1271 1185 return false;
1272 1186 }
1273 1187
1274 1188 // Verify auth.
@@ -1283,10 +1197,8 @@
1283 1197 /**
1284 1198 * Install and/or activate the add-on file.
1285 1199 *
1286 1200 * @since 4.08
1287 - *
1288 - * @return array
1289 1201 */
1290 1202 public static function install_addon_api() {
1291 1203 self::$plugin = FrmAppHelper::get_param( 'file_url', '', 'request', 'esc_url_raw' );
1292 1204
@@ -1297,11 +1209,11 @@
1297 1209
1298 1210 // It's already installed and active.
1299 1211 $active = self::activate_plugin( 'formidable-pro/formidable-pro.php', false, false, true );
1300 1212 if ( is_wp_error( $active ) ) {
1301 - $response = self::maybe_download_and_activate();
1302 - if ( is_array( $response ) ) {
1303 - // The download failed.
1213 + // Download plugin now.
1214 + $response = self::download_and_activate();
1215 + if ( is_array( $response ) && isset( $response['success'] ) ) {
1304 1216 return $response;
1305 1217 }
1306 1218 }
1307 1219
@@ -1328,58 +1240,22 @@
1328 1240 );
1329 1241 }
1330 1242
1331 1243 /**
1332 - * @since 6.8.3
1333 - *
1334 - * @return array|true
1335 - */
1336 - private static function maybe_download_and_activate() {
1337 - if ( ! self::$plugin ) {
1338 - return array(
1339 - 'success' => false,
1340 - 'message' => __( 'The plugin download was not found.', 'formidable' ),
1341 - );
1342 - }
1343 -
1344 - // Download plugin now.
1345 - $response = self::download_and_activate();
1346 - if ( is_array( $response ) && isset( $response['success'] ) ) {
1347 - // The download failed.
1348 - return $response;
1349 - }
1350 -
1351 - return true;
1352 - }
1353 -
1354 - /**
1355 1244 * Render a conditional action button for a specified plugin
1356 1245 *
1246 + * @param string $plugin
1247 + * @param array|string $upgrade_link_args
1357 1248 * @since 4.09
1358 - *
1359 - * @param string $plugin
1360 - * @param array|string $upgrade_link_args
1361 - * @return void
1362 1249 */
1363 1250 public static function conditional_action_button( $plugin, $upgrade_link_args ) {
1364 1251 if ( is_callable( 'FrmProAddonsController::conditional_action_button' ) ) {
1365 - FrmProAddonsController::conditional_action_button( $plugin, $upgrade_link_args );
1366 - return;
1252 + return FrmProAddonsController::conditional_action_button( $plugin, $upgrade_link_args );
1367 1253 }
1368 1254
1369 1255 $addon = self::get_addon( $plugin );
1370 1256 $upgrade_link = FrmAppHelper::admin_upgrade_link( $upgrade_link_args );
1371 -
1372 - if ( ! is_array( $upgrade_link_args ) ) {
1373 - // A string $upgrade_link_args is used for the utm-medium value when calling
1374 - // FrmAppHelper::admin_upgrade_link above.
1375 - // For self::addon_upgrade_link, we'll pass just an empty array with the link key (set below).
1376 - $upgrade_link_args = array();
1377 - }
1378 -
1379 - $upgrade_link_args['link'] = $upgrade_link;
1380 -
1381 - self::addon_upgrade_link( $addon, $upgrade_link_args );
1257 + self::addon_upgrade_link( $addon, $upgrade_link );
1382 1258 }
1383 1259
1384 1260 /**
1385 1261 * Render a conditional action button for an add on
@@ -1385,22 +1261,16 @@
1385 1261 * Render a conditional action button for an add on
1386 1262 *
1387 1263 * @since 4.09.01
1388 1264 *
1389 - * @param array $atts {
1390 - * Button attributes.
1391 - *
1392 - * @type array $addon
1393 - * @type false|string $license_type
1394 - * @type string $plan_required
1395 - * @type string $upgrade_link
1396 - * }
1397 - * @return void
1265 + * @param array $addon
1266 + * @param string|false $license_type
1267 + * @param string $plan_required
1268 + * @param string $upgrade_link
1398 1269 */
1399 1270 public static function show_conditional_action_button( $atts ) {
1400 1271 if ( is_callable( 'FrmProAddonsController::show_conditional_action_button' ) ) {
1401 - FrmProAddonsController::show_conditional_action_button( $atts );
1402 - return;
1272 + return FrmProAddonsController::show_conditional_action_button( $atts );
1403 1273 }
1404 1274
1405 1275 self::addon_upgrade_link( $atts['addon'], $atts['upgrade_link'] );
1406 1276 }
@@ -1407,18 +1277,13 @@
1407 1277
1408 1278 /**
1409 1279 * @since 4.09.01
1410 1280 *
1411 - * @param array|false $addon
1412 - * @param array|string $upgrade_link
1281 + * @param array|false $addon
1413 1282 *
1414 1283 * @return void
1415 1284 */
1416 - public static function addon_upgrade_link( $addon, $upgrade_link ) {
1417 - $atts = is_array( $upgrade_link ) ? $upgrade_link : array();
1418 - $upgrade_link = is_array( $upgrade_link ) ? $upgrade_link['link'] : $upgrade_link;
1419 - $text = ! empty( $atts['text'] ) ? $atts['text'] : __( 'Upgrade Now', 'formidable' );
1420 -
1285 + protected static function addon_upgrade_link( $addon, $upgrade_link ) {
1421 1286 if ( $addon ) {
1422 1287 $upgrade_link .= '&utm_content=' . $addon['slug'];
1423 1288 }
1424 1289
@@ -1425,16 +1290,11 @@
1425 1290 if ( $addon && isset( $addon['categories'] ) && in_array( 'Solution', $addon['categories'], true ) ) {
1426 1291 // Solutions will go to a separate page.
1427 1292 $upgrade_link = FrmAppHelper::admin_upgrade_link( 'addons', $addon['link'] );
1428 1293 }
1429 -
1430 - $class = ! empty( $atts['class'] ) ? $atts['class'] : '';
1431 - if ( strpos( $class, 'frm-button' ) === false ) {
1432 - $class .= ' frm-button-secondary frm-button-sm';
1433 - }
1434 1294 ?>
1435 - <a class="install-now button <?php echo esc_attr( $class ); ?>" href="<?php echo esc_url( $upgrade_link ); ?>" target="_blank" rel="noopener" aria-label="<?php esc_attr_e( 'Upgrade Now', 'formidable' ); ?>">
1436 - <?php echo esc_html( $text ); ?>
1295 + <a class="install-now button frm-button-secondary frm-button-sm" href="<?php echo esc_url( $upgrade_link ); ?>" target="_blank" rel="noopener" aria-label="<?php esc_attr_e( 'Upgrade Now', 'formidable' ); ?>">
1296 + <?php esc_html_e( 'Upgrade Now', 'formidable' ); ?>
1437 1297 </a>
1438 1298 <?php
1439 1299 }
1440 1300
@@ -1456,58 +1316,107 @@
1456 1316 wp_die();
1457 1317 }
1458 1318
1459 1319 /**
1460 - * Allowed URLs used for internal source of plugins installation.
1320 + * @since 4.06.02
1461 1321 *
1462 - * @since 6.3.1
1322 + * @deprecated 4.09.01
1463 1323 *
1324 + * @return void
1325 + */
1326 + public static function ajax_multiple_addons() {
1327 + FrmDeprecated::ajax_multiple_addons();
1328 + }
1329 +
1330 + /**
1331 + * @since 3.04.03
1332 + * @deprecated 3.06
1333 + * @codeCoverageIgnore
1464 1334 * @return array
1465 1335 */
1466 - private static function allowed_external_urls() {
1467 - $allowed_url_list = array(
1468 - 'https://downloads.wordpress.org/plugin/formidable-gravity-forms-importer.zip',
1469 - 'https://downloads.wordpress.org/plugin/formidable-import-pirate-forms.zip',
1470 - 'https://downloads.wordpress.org/plugin/wp-mail-smtp.zip',
1471 - );
1336 + public static function error_for_license( $license ) {
1337 + return FrmDeprecated::error_for_license( $license );
1338 + }
1472 1339
1473 - /**
1474 - * List of URLs used in plugin formidable internal installation.
1475 - *
1476 - * @since 6.3.1
1477 - *
1478 - * @param array $allowed_url_list List of URLs.
1479 - */
1480 - $allowed_url_list = apply_filters( 'frm_allowed_external_urls', $allowed_url_list );
1340 + /**
1341 + * @since 3.04.03
1342 + * @deprecated 3.06
1343 + * @codeCoverageIgnore
1344 + */
1345 + public static function get_pro_updater() {
1346 + return FrmDeprecated::get_pro_updater();
1347 + }
1481 1348
1482 - if ( ! is_array( $allowed_url_list ) ) {
1483 - _doing_it_wrong( __METHOD__, 'Only an array of URLs could be used within this filter.', '6.3.1' );
1349 + /**
1350 + * @since 3.04.03
1351 + * @deprecated 3.06
1352 + * @codeCoverageIgnore
1353 + *
1354 + * @return array
1355 + */
1356 + public static function get_addon_info( $license = '' ) {
1357 + return FrmDeprecated::get_addon_info( $license );
1358 + }
1484 1359
1485 - return array();
1486 - }
1360 + /**
1361 + * @since 3.04.03
1362 + * @deprecated 3.06
1363 + * @codeCoverageIgnore
1364 + *
1365 + * @return string
1366 + */
1367 + public static function get_cache_key( $license ) {
1368 + return FrmDeprecated::get_cache_key( $license );
1369 + }
1487 1370
1488 - return $allowed_url_list;
1371 + /**
1372 + * @since 3.04.03
1373 + *
1374 + * @deprecated 3.06
1375 + *
1376 + * @codeCoverageIgnore
1377 + *
1378 + * @return void
1379 + */
1380 + public static function reset_cached_addons( $license = '' ) {
1381 + FrmDeprecated::reset_cached_addons( $license );
1489 1382 }
1490 1383
1491 1384 /**
1492 - * Gets required plan for an addon.
1385 + * @since 2.03.08
1386 + * @deprecated 3.04.03
1387 + * @codeCoverageIgnore
1493 1388 *
1494 - * @since 6.4.2
1389 + * @param boolean $return
1390 + * @param string $package
1495 1391 *
1496 - * @return string Empty string if no plan is required for active license.
1392 + * @return boolean
1497 1393 */
1498 - public static function get_addon_required_plan( $addon_id ) {
1499 - $api = new FrmFormApi();
1500 - $addons = $api->get_api_info();
1394 + public static function add_shorten_edd_filename_filter( $return, $package ) {
1395 + return FrmDeprecated::add_shorten_edd_filename_filter( $return, $package );
1396 + }
1501 1397
1502 - if ( is_array( $addons ) && array_key_exists( $addon_id, $addons ) ) {
1503 - $dates = $addons[ $addon_id ];
1504 - $requires = FrmFormsHelper::get_plan_required( $dates );
1505 - }
1398 + /**
1399 + * @since 2.03.08
1400 + * @deprecated 3.04.03
1401 + * @codeCoverageIgnore
1402 + *
1403 + * @param string $filename
1404 + * @param string $ext
1405 + *
1406 + * @return string
1407 + */
1408 + public static function shorten_edd_filename( $filename, $ext ) {
1409 + return FrmDeprecated::shorten_edd_filename( $filename, $ext );
1410 + }
1506 1411
1507 - if ( ! isset( $requires ) || ! is_string( $requires ) ) {
1508 - $requires = '';
1509 - }
1510 -
1511 - return $requires;
1412 + /**
1413 + * @deprecated 3.04.03
1414 + *
1415 + * @codeCoverageIgnore
1416 + *
1417 + * @return void
1418 + */
1419 + public static function get_licenses() {
1420 + FrmDeprecated::get_licenses();
1512 1421 }
1513 1422 }