PluginProbe
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More / 6.1
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More v6.1
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 +424 -586 6.256.1 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,66 +18,49 @@
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 - /**
131 - * @return void
132 - */
133 41 public static function list_addons() {
134 42 FrmAppHelper::include_svg();
43 + $installed_addons = apply_filters( 'frm_installed_addons', array() );
44 + $license_type = '';
135 45
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;
46 + $addons = self::get_api_addons();
47 + $errors = array();
142 48
143 49 if ( isset( $addons['error'] ) ) {
144 - $api = new FrmFormApi();
145 - $errors = $api->get_error_from_response( $addons );
146 - $license_type = $addons['error']['type'] ?? '';
50 + $api = new FrmFormApi();
51 + $errors = $api->get_error_from_response( $addons );
52 + $license_type = isset( $addons['error']['type'] ) ? $addons['error']['type'] : '';
147 53 unset( $addons['error'] );
148 54 }
149 55
150 - $pro = array(
56 + $pro = array(
151 57 '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.',
58 + 'title' => 'Formidable Forms Pro',
59 + 'slug' => 'formidable-pro',
60 + 'released' => '2011-02-05',
61 + 'docs' => 'knowledgebase/',
62 + 'excerpt' => 'Create calculators, surveys, smart forms, and data-driven applications. Build directories, real estate listings, job boards, and much more.',
158 63 ),
159 64 );
160 65 $addons = $pro + $addons;
161 66 self::prepare_addons( $addons );
@@ -161,105 +66,11 @@
161 66 self::prepare_addons( $addons );
162 67
163 68 $pricing = FrmAppHelper::admin_upgrade_link( 'addons' );
164 69
165 - self::organize_and_get_categories();
166 - $categories = self::$categories;
167 -
168 - include $view_path . 'index.php';
70 + include( FrmAppHelper::plugin_path() . '/classes/views/addons/list.php' );
169 71 }
170 72
171 - /**
172 - * Organize and set categories.
173 - *
174 - * @since 6.15
175 - *
176 - * @return void
177 - */
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 73 public static function license_settings() {
263 74 $plugins = apply_filters( 'frm_installed_addons', array() );
264 75 if ( empty( $plugins ) ) {
265 76 esc_html_e( 'There are no plugins on your site that require a license', 'formidable' );
@@ -268,14 +79,11 @@
268 79 }
269 80
270 81 ksort( $plugins );
271 82
272 - include FrmAppHelper::plugin_path() . '/classes/views/addons/settings.php';
83 + include( FrmAppHelper::plugin_path() . '/classes/views/addons/settings.php' );
273 84 }
274 85
275 - /**
276 - * @return array
277 - */
278 86 protected static function get_api_addons() {
279 87 $api = new FrmFormApi();
280 88 $addons = $api->get_api_info();
281 89
@@ -292,21 +100,8 @@
292 100 return $addons;
293 101 }
294 102
295 103 /**
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 104 * If the API is unable to connect, show something on the addons page
310 105 *
311 106 * @since 3.04.03
312 107 * @return array
@@ -414,9 +209,9 @@
414 209 $api = new FrmFormApi( $license );
415 210 $downloads = $api->get_api_info();
416 211 $pro = self::get_pro_from_addons( $downloads );
417 212
418 - return $pro['url'] ?? '';
213 + return isset( $pro['url'] ) ? $pro['url'] : '';
419 214 }
420 215
421 216 /**
422 217 * @since 4.08
@@ -447,14 +242,11 @@
447 242 }
448 243
449 244 /**
450 245 * @since 4.08
451 - *
452 - * @param array $addons
453 - * @return array
454 246 */
455 247 protected static function get_pro_from_addons( $addons ) {
456 - return $addons['93790'] ?? array();
248 + return isset( $addons['93790'] ) ? $addons['93790'] : array();
457 249 }
458 250
459 251 /**
460 252 * @since 4.06
@@ -468,10 +260,8 @@
468 260 }
469 261
470 262 /**
471 263 * @since 4.0.01
472 - *
473 - * @return bool
474 264 */
475 265 public static function is_license_expired() {
476 266 $version_info = self::get_primary_license_info();
477 267 if ( ! isset( $version_info['error'] ) ) {
@@ -477,29 +267,28 @@
477 267 if ( ! isset( $version_info['error'] ) ) {
478 268 return false;
479 269 }
480 270
481 - $expires = $version_info['error']['expires'] ?? 0;
482 - if ( empty( $expires ) || $expires > time() ) {
483 - return false;
484 - }
271 + return $version_info['error'];
272 + }
485 273
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;
274 + /**
275 + * @since 4.08
276 + *
277 + * @return boolean|int false or the number of days until expiration.
278 + */
279 + public static function is_license_expiring() {
280 + if ( is_callable( 'FrmProAddonsController::is_license_expiring' ) ) {
281 + return FrmProAddonsController::is_license_expiring();
490 282 }
491 283
492 - return $version_info['error'];
284 + return false;
493 285 }
494 286
495 287 /**
496 288 * @since 4.08
497 - * @since 6.7 This is public.
498 - *
499 - * @return array|false
500 289 */
501 - public static function get_primary_license_info() {
290 + protected static function get_primary_license_info() {
502 291 $installed_addons = apply_filters( 'frm_installed_addons', array() );
503 292 if ( empty( $installed_addons ) || ! isset( $installed_addons['formidable_pro'] ) ) {
504 293 return false;
505 294 }
@@ -531,9 +320,9 @@
531 320 $version_info = self::fill_update_addon_info( $installed_addons );
532 321 $transient->last_checked = time();
533 322 $wp_plugins = self::get_plugins();
534 323
535 - foreach ( $version_info as $plugin ) {
324 + foreach ( $version_info as $id => $plugin ) {
536 325 $plugin = (object) $plugin;
537 326
538 327 if ( ! isset( $plugin->new_version ) || ! isset( $plugin->package ) ) {
539 328 continue;
@@ -548,21 +337,20 @@
548 337 // don't show an update if the plugin isn't installed
549 338 continue;
550 339 }
551 340
552 - $wp_plugin = $wp_plugins[ $folder ] ?? array();
553 - $wp_version = $wp_plugin['Version'] ?? '1.0';
554 - $plugin->slug = explode( '/', $folder )[0];
341 + $wp_plugin = isset( $wp_plugins[ $folder ] ) ? $wp_plugins[ $folder ] : array();
342 + $wp_version = isset( $wp_plugin['Version'] ) ? $wp_plugin['Version'] : '1.0';
555 343
556 344 if ( version_compare( $wp_version, $plugin->new_version, '<' ) ) {
345 + $slug = explode( '/', $folder );
346 + $plugin->slug = $slug[0];
557 347 $transient->response[ $folder ] = $plugin;
558 - } else {
559 - $transient->no_update[ $folder ] = $plugin;
560 348 }
561 349
562 350 $transient->checked[ $folder ] = $wp_version;
563 351
564 - }//end foreach
352 + }
565 353
566 354 return $transient;
567 355 }
568 356
@@ -585,9 +373,9 @@
585 373 * Check if a plugin is installed before showing an update for it
586 374 *
587 375 * @since 3.05
588 376 *
589 - * @param string $plugin The folder/filename.php for a plugin.
377 + * @param string $plugin - the folder/filename.php for a plugin
590 378 *
591 379 * @return bool - True if installed
592 380 */
593 381 protected static function is_installed( $plugin ) {
@@ -629,9 +417,9 @@
629 417 if ( empty( $plugin ) ) {
630 418 continue;
631 419 }
632 420
633 - $download_id = $plugin['id'] ?? 0;
421 + $download_id = isset( $plugin['id'] ) ? $plugin['id'] : 0;
634 422 if ( ! empty( $download_id ) && ! isset( $version_info[ $download_id ]['package'] ) ) {
635 423 // if this addon is using its own license, get the update url
636 424 $addon_info = $api->get_api_info();
637 425
@@ -642,9 +430,9 @@
642 430 'code' => $addon_info['error']['code'],
643 431 );
644 432 }
645 433 }
646 - }//end foreach
434 + }
647 435
648 436 return $version_info;
649 437 }
650 438
@@ -651,9 +439,9 @@
651 439 /**
652 440 * Get the action link for an addon that isn't active.
653 441 *
654 442 * @since 3.06.03
655 - * @param string $plugin The plugin slug.
443 + * @param string $plugin The plugin slug
656 444 * @return array
657 445 */
658 446 public static function install_link( $plugin ) {
659 447 $link = array();
@@ -664,14 +452,14 @@
664 452 $link = array(
665 453 'url' => $addon['plugin'],
666 454 'class' => 'frm-activate-addon',
667 455 );
668 - } elseif ( ! empty( $addon['url'] ) ) {
456 + } elseif ( isset( $addon['url'] ) && ! empty( $addon['url'] ) ) {
669 457 $link = array(
670 458 'url' => $addon['url'],
671 459 'class' => 'frm-install-addon',
672 460 );
673 - } elseif ( ! empty( $addon['categories'] ) ) {
461 + } elseif ( isset( $addon['categories'] ) && ! empty( $addon['categories'] ) ) {
674 462 $link = array(
675 463 'categories' => $addon['categories'],
676 464 );
677 465 }
@@ -683,9 +471,9 @@
683 471 $link = array(
684 472 'url' => 'formidable-' . $plugin . '/formidable-' . $plugin . '.php',
685 473 'class' => 'frm-activate-addon',
686 474 );
687 - }//end if
475 + }
688 476
689 477 return $link;
690 478 }
691 479
@@ -690,12 +478,12 @@
690 478 }
691 479
692 480 /**
693 481 * @since 4.09
694 - * @param string $plugin The plugin slug.
482 + * @param string $plugin The plugin slug
695 483 * @return array|false
696 484 */
697 - public static function get_addon( $plugin ) {
485 + protected static function get_addon( $plugin ) {
698 486 $addons = self::get_api_addons();
699 487 self::prepare_addons( $addons );
700 488 foreach ( $addons as $addon ) {
701 489 $slug = explode( '/', $addon['plugin'] );
@@ -721,10 +509,10 @@
721 509
722 510 /**
723 511 * @since 3.04.03
724 512 *
725 - * @param array $addons
726 - * @param object $license The FrmAddon object.
513 + * @param array $addons
514 + * @param object $license The FrmAddon object
727 515 *
728 516 * @return array
729 517 */
730 518 public static function get_addon_for_license( $addons, $license ) {
@@ -731,9 +519,9 @@
731 519 $download_id = $license->download_id;
732 520 $plugin = array();
733 521 if ( empty( $download_id ) && ! empty( $addons ) ) {
734 522 foreach ( $addons as $addon ) {
735 - if ( strtolower( $license->plugin_name ) === strtolower( $addon['title'] ) ) {
523 + if ( strtolower( $license->plugin_name ) == strtolower( $addon['title'] ) ) {
736 524 return $addon;
737 525 }
738 526 }
739 527 } elseif ( isset( $addons[ $download_id ] ) ) {
@@ -742,11 +530,8 @@
742 530
743 531 return $plugin;
744 532 }
745 533
746 - /**
747 - * @return void
748 - */
749 534 protected static function prepare_addons( &$addons ) {
750 535 $activate_url = '';
751 536 if ( current_user_can( 'activate_plugins' ) ) {
752 537 $activate_url = add_query_arg( array( 'action' => 'activate' ), admin_url( 'plugins.php' ) );
@@ -797,20 +582,15 @@
797 582
798 583 if ( ! isset( $addon['link'] ) ) {
799 584 $addon['link'] = 'downloads/' . $slug . '/';
800 585 }
586 + self::prepare_addon_link( $addon['link'] );
801 587
802 - self::prepare_addon_link( $addon['link'] );
803 588 self::set_addon_status( $addon );
804 - self::set_categories( $addon );
805 -
806 589 $addons[ $id ] = $addon;
807 - }//end foreach
590 + }
808 591 }
809 592
810 - /**
811 - * @return bool
812 - */
813 593 private static function is_plugin_active( $file_name, $slug ) {
814 594 if ( 'formidable-views/formidable-views.php' === $file_name ) {
815 595 return self::get_active_views_version() === $slug;
816 596 }
@@ -817,9 +597,9 @@
817 597 return is_plugin_active( $file_name );
818 598 }
819 599
820 600 /**
821 - * @return false|string either 'visual-views' or 'views', false if one is not found.
601 + * @return string|false either 'visual-views' or 'views', false if one is not found.
822 602 */
823 603 private static function get_active_views_version() {
824 604 if ( ! is_callable( 'FrmViewsAppHelper::plugin_version' ) ) {
825 605 return false;
@@ -829,10 +609,8 @@
829 609 }
830 610
831 611 /**
832 612 * @since 3.04.02
833 - *
834 - * @return void
835 613 */
836 614 protected static function prepare_addon_link( &$link ) {
837 615 $site_url = 'https://formidableforms.com/';
838 616 if ( strpos( $link, 'http' ) !== 0 ) {
@@ -851,10 +629,8 @@
851 629 * Add the status to the addon array. Status options are:
852 630 * installed, active, not installed
853 631 *
854 632 * @since 3.04.02
855 - *
856 - * @return void
857 633 */
858 634 protected static function set_addon_status( &$addon ) {
859 635 if ( ! empty( $addon['activate_url'] ) ) {
860 636 $addon['status'] = array(
@@ -873,65 +649,259 @@
873 649 );
874 650 }
875 651 }
876 652
653 + public static function upgrade_to_pro() {
654 + FrmAppHelper::include_svg();
655 +
656 + $link_parts = array(
657 + 'medium' => 'upgrade',
658 + 'content' => 'button',
659 + );
660 +
661 + $features = array(
662 + 'Display Entries' => array(
663 + array(
664 + 'label' => 'Display form data with virtually limitless views',
665 + 'link' => array(
666 + 'content' => 'views',
667 + 'param' => 'views-display-form-data',
668 + ),
669 + 'lite' => false,
670 + ),
671 + array(
672 + 'label' => 'Generate graphs and stats based on your submitted data',
673 + 'link' => array(
674 + 'content' => 'graphs',
675 + 'param' => 'statistics-graphs-wordpress-forms',
676 + ),
677 + 'lite' => false,
678 + ),
679 + ),
680 + 'Entry Management' => array(
681 + array(
682 + 'label' => 'Import entries from a CSV',
683 + 'link' => array(
684 + 'content' => 'import-entries',
685 + 'param' => 'importing-exporting-wordpress-forms',
686 + ),
687 + 'lite' => false,
688 + ),
689 + array(
690 + 'label' => 'Logged-in users can save drafts and return later',
691 + 'link' => array(
692 + 'content' => 'save-drafts',
693 + 'param' => 'save-drafts-wordpress-form',
694 + ),
695 + 'lite' => false,
696 + ),
697 + array(
698 + 'label' => 'Flexibly and powerfully view, edit, and delete entries from anywhere on your site',
699 + 'link' => array(
700 + 'content' => 'front-edit',
701 + 'param' => 'wordpress-front-end-editing',
702 + ),
703 + 'lite' => false,
704 + ),
705 + array(
706 + 'label' => 'View form submissions from the back-end',
707 + 'lite' => true,
708 + ),
709 + array(
710 + 'label' => 'Export your entries to a CSV',
711 + 'lite' => true,
712 + ),
713 + ),
714 + 'Form Building' => array(
715 + array(
716 + 'label' => 'Save a calculated value into a field',
717 + 'link' => array(
718 + 'content' => 'calculations',
719 + 'param' => 'field-calculations-wordpress-form',
720 + ),
721 + 'lite' => false,
722 + ),
723 + array(
724 + 'label' => 'Allow multiple file uploads',
725 + 'link' => array(
726 + 'content' => 'file-uploads',
727 + 'param' => 'wordpress-multi-file-upload-fields',
728 + ),
729 + 'lite' => false,
730 + ),
731 + array(
732 + 'label' => 'Repeat sections of fields',
733 + 'link' => array(
734 + 'content' => 'repeaters',
735 + 'param' => 'repeatable-sections-forms',
736 + ),
737 + 'lite' => false,
738 + ),
739 + array(
740 + 'label' => 'Hide and show fields conditionally based on other fields or the user\'s role',
741 + 'link' => array(
742 + 'content' => 'conditional-logic',
743 + 'param' => 'conditional-logic-wordpress-forms',
744 + ),
745 + 'lite' => false,
746 + ),
747 + array(
748 + 'label' => 'Confirmation fields',
749 + 'link' => array(
750 + 'content' => 'confirmation-fields',
751 + 'param' => 'confirmation-fields-wordpress-forms',
752 + ),
753 + 'lite' => false,
754 + ),
755 + array(
756 + 'label' => 'Multi-paged forms',
757 + 'link' => array(
758 + 'content' => 'page-breaks',
759 + 'param' => 'wordpress-multi-page-forms',
760 + ),
761 + 'lite' => false,
762 + ),
763 + array(
764 + '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.',
765 + 'lite' => false,
766 + ),
767 + array(
768 + 'label' => 'Include text, email, url, paragraph text, radio, checkbox, dropdown fields, hidden fields, user ID fields, and HTML blocks in your form.',
769 + 'lite' => true,
770 + ),
771 + array(
772 + 'label' => 'Drag & Drop Form building',
773 + 'link' => array(
774 + 'content' => 'drag-drop',
775 + 'param' => 'drag-drop-forms',
776 + ),
777 + 'lite' => true,
778 + ),
779 + array(
780 + 'label' => 'Create forms from Templates',
781 + 'link' => array(
782 + 'content' => 'form-templates',
783 + 'param' => 'wordpress-form-templates',
784 + ),
785 + 'lite' => true,
786 + ),
787 + array(
788 + 'label' => 'Import and export forms with XML',
789 + 'link' => array(
790 + 'content' => 'import',
791 + 'param' => 'importing-exporting-wordpress-forms',
792 + ),
793 + 'lite' => true,
794 + ),
795 + array(
796 + 'label' => 'Use input placeholder text in your fields that clear when typing starts.',
797 + 'lite' => true,
798 + ),
799 + ),
800 + 'Form Actions' => array(
801 + array(
802 + 'label' => 'Conditionally send your email notifications based on values in your form',
803 + 'link' => array(
804 + 'content' => 'conditional-emails',
805 + ),
806 + 'lite' => false,
807 + ),
808 + array(
809 + 'label' => 'Create and edit WordPress posts or custom posts from the front-end',
810 + 'link' => array(
811 + 'content' => 'create-posts',
812 + 'param' => 'create-posts-pages-wordpress-forms',
813 + ),
814 + 'lite' => false,
815 + ),
816 + array(
817 + 'label' => 'Send multiple emails and autoresponders',
818 + 'link' => array(
819 + 'content' => 'multiple-emails',
820 + 'param' => 'virtually-unlimited-emails',
821 + ),
822 + 'lite' => true,
823 + ),
824 + ),
825 + 'Form Appearance' => array(
826 + array(
827 + 'label' => 'Create Multiple styles for different forms',
828 + 'link' => array(
829 + 'content' => 'multiple-styles',
830 + 'param' => 'wordpress-visual-form-styler',
831 + ),
832 + 'lite' => false,
833 + ),
834 + array(
835 + 'label' => 'Customizable layout with CSS classes',
836 + 'link' => array(
837 + 'content' => 'form-layout',
838 + 'param' => 'wordpress-mobile-friendly-forms',
839 + ),
840 + 'lite' => true,
841 + ),
842 + array(
843 + 'label' => 'Customize the HTML for your forms',
844 + 'link' => array(
845 + 'content' => 'custom-html',
846 + 'param' => 'customizable-html-wordpress-form',
847 + ),
848 + 'lite' => true,
849 + ),
850 + array(
851 + 'label' => 'Style your form with the Visual Form Styler',
852 + 'lite' => true,
853 + ),
854 + ),
855 + );
856 +
857 + include( FrmAppHelper::plugin_path() . '/classes/views/addons/upgrade_to_pro.php' );
858 + }
859 +
877 860 /**
878 - * @since 5.5.2
861 + * Install Pro after connection with Formidable.
879 862 *
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.
863 + * @since 4.02.05
885 864 */
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';
865 + public static function connect_pro() {
866 + FrmAppHelper::permission_check( 'install_plugins' );
867 + check_ajax_referer( 'frm_ajax', 'nonce' );
868 +
869 + $url = self::get_current_plugin();
870 + if ( FrmAppHelper::pro_is_installed() || empty( $url ) ) {
871 + wp_die();
889 872 }
890 - return activate_plugin( $plugin, $redirect, $network_wide, $silent );
891 - }
892 873
893 - /**
894 - * Deactivate a specified plugin.
895 - *
896 - * @since 6.8
897 - *
898 - * @param string $plugin
899 - * @param bool $silent
900 - * @return void
901 - */
902 - protected static function deactivate_plugin( $plugin, $silent = false ) {
903 - if ( ! function_exists( 'deactivate_plugins' ) ) {
904 - require_once ABSPATH . 'wp-admin/includes/plugin.php';
874 + $response = array();
875 +
876 + // It's already installed and active.
877 + $active = self::activate_plugin( 'formidable-pro/formidable-pro.php', false, false, true );
878 + if ( is_wp_error( $active ) ) {
879 + // The plugin was installed, but not active. Download it now.
880 + self::ajax_install_addon();
881 + } else {
882 + $response['active'] = true;
883 + $response['success'] = true;
905 884 }
906 - deactivate_plugins( $plugin, $silent );
885 +
886 + echo json_encode( $response );
887 + wp_die();
907 888 }
908 889
909 890 /**
910 - * Uninstall a specified plugin.
891 + * @since 5.5.2
911 892 *
912 - * @since 6.8
913 - *
914 893 * @param string $plugin
915 - * @return true|WP_Error True on success, WP_Error on invalid file.
894 + * @param string $redirect
895 + * @param bool $network_wide
896 + * @param bool $silent
897 + * @return null|WP_Error Null on success, WP_Error on invalid file.
916 898 */
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' ) ) {
899 + protected static function activate_plugin( $plugin, $redirect = '', $network_wide = false, $silent = false ) {
900 + if ( ! function_exists( 'activate_plugin' ) ) {
923 901 require_once ABSPATH . 'wp-admin/includes/plugin.php';
924 902 }
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;
903 + return activate_plugin( $plugin, $redirect, $network_wide, $silent );
934 904 }
935 905
936 906 /**
937 907 * @since 5.0.10
@@ -938,9 +908,9 @@
938 908 *
939 909 * @return string
940 910 */
941 911 protected static function get_current_plugin() {
942 - if ( empty( self::$plugin ) ) {
912 + if ( ! isset( self::$plugin ) ) {
943 913 self::$plugin = FrmAppHelper::get_param( 'plugin', '', 'post', 'esc_url_raw' );
944 914 }
945 915 return self::$plugin;
946 916 }
@@ -946,10 +916,8 @@
946 916 }
947 917
948 918 /**
949 919 * @since 4.08
950 - *
951 - * @return array|void
952 920 */
953 921 protected static function download_and_activate() {
954 922 if ( is_admin() ) {
955 923 FrmAppHelper::set_current_screen_and_hook_suffix();
@@ -960,22 +928,20 @@
960 928 $installed = self::install_addon();
961 929 if ( is_array( $installed ) && isset( $installed['message'] ) ) {
962 930 return $installed;
963 931 }
964 - self::handle_addon_action( $installed, 'activate' );
932 + self::maybe_activate_addon( $installed );
965 933 }
966 934
967 935 /**
968 936 * @since 3.04.02
969 - *
970 - * @return void
971 937 */
972 938 protected static function maybe_show_cred_form() {
973 939 if ( ! function_exists( 'request_filesystem_credentials' ) ) {
974 - include_once ABSPATH . 'wp-admin/includes/file.php';
940 + include_once( ABSPATH . 'wp-admin/includes/file.php' );
975 941 }
976 942
977 - // Start output buffering to catch the filesystem form if credentials are needed.
943 + // Start output bufferring to catch the filesystem form if credentials are needed.
978 944 ob_start();
979 945
980 946 $show_form = false;
981 947 $method = '';
@@ -1005,21 +971,8 @@
1005 971 ob_end_clean();
1006 972 }
1007 973
1008 974 /**
1009 - * Checks if an addon download url is allowed.
1010 - *
1011 - * @since 6.2
1012 - *
1013 - * @param string $download_url
1014 - *
1015 - * @return bool
1016 - */
1017 - 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 );
1019 - }
1020 -
1021 - /**
1022 975 * We do not need any extra credentials if we have gotten this far,
1023 976 * so let's install the plugin.
1024 977 *
1025 978 * @since 3.04.02
@@ -1028,9 +981,9 @@
1028 981 require_once ABSPATH . 'wp-admin/includes/class-wp-upgrader.php';
1029 982
1030 983 $download_url = self::get_current_plugin();
1031 984
1032 - if ( ! self::url_is_allowed( $download_url ) ) {
985 + if ( ! FrmAppHelper::validate_url_is_in_s3_bucket( $download_url, 'zip' ) ) {
1033 986 return array(
1034 987 'message' => 'Plugin URL is not valid',
1035 988 'success' => false,
1036 989 );
@@ -1053,139 +1006,31 @@
1053 1006 return $plugin;
1054 1007 }
1055 1008
1056 1009 /**
1057 - * Handle the AJAX request to activate an add-on.
1058 - *
1059 - * @since 6.8
1060 - *
1061 - * @return void
1010 + * @since 3.06.03
1062 1011 */
1063 1012 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 1013
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 - }
1014 + self::install_addon_permissions();
1080 1015
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 1016 FrmAppHelper::set_current_screen_and_hook_suffix();
1123 1017
1124 1018 $plugin = FrmAppHelper::get_param( 'plugin', '', 'post', 'sanitize_text_field' );
1125 - call_user_func( $action_callback, $plugin );
1019 + self::maybe_activate_addon( $plugin );
1126 1020
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();
1021 + echo json_encode( self::get_addon_activation_response() );
1022 + wp_die();
1133 1023 }
1134 1024
1135 1025 /**
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
1026 + * @return array|string
1143 1027 */
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 - * @return array
1180 - */
1181 1028 private static function get_addon_activation_response() {
1182 1029 $activating_page = self::get_activating_page();
1183 1030
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 1031 $response = array(
1187 - 'message' => $message,
1032 + 'message' => __( 'Your plugin has been activated. Would you like to save and reload the page now?', 'formidable' ),
1188 1033 'saveAndReload' => $activating_page,
1189 1034 );
1190 1035
1191 1036 return $response;
@@ -1210,13 +1055,36 @@
1210 1055 return '';
1211 1056 }
1212 1057
1213 1058 /**
1059 + * @since 3.04.02
1060 + * @param string $installed The plugin folder name with file name
1061 + */
1062 + protected static function maybe_activate_addon( $installed ) {
1063 + if ( ! $installed ) {
1064 + return;
1065 + }
1066 +
1067 + $activate = self::activate_plugin( $installed );
1068 + if ( is_wp_error( $activate ) ) {
1069 + // Ignore the invalid header message that shows with nested plugins.
1070 + if ( $activate->get_error_code() !== 'no_plugin_header' ) {
1071 + if ( wp_doing_ajax() ) {
1072 + echo json_encode( array( 'error' => $activate->get_error_message() ) );
1073 + wp_die();
1074 + }
1075 + return array(
1076 + 'message' => $activate->get_error_message(),
1077 + 'success' => false,
1078 + );
1079 + }
1080 + }
1081 + }
1082 +
1083 + /**
1214 1084 * Run security checks before installing
1215 1085 *
1216 1086 * @since 3.04.02
1217 - *
1218 - * @return void
1219 1087 */
1220 1088 protected static function install_addon_permissions() {
1221 1089 check_ajax_referer( 'frm_ajax', 'nonce' );
1222 1090
@@ -1227,25 +1095,20 @@
1227 1095 }
1228 1096
1229 1097 /**
1230 1098 * @since 4.08
1231 - *
1232 - * @return string
1233 1099 */
1234 1100 public static function connect_link() {
1235 1101 $auth = get_option( 'frm_connect_token' );
1236 1102 if ( empty( $auth ) ) {
1237 1103 $auth = hash( 'sha512', wp_rand() );
1238 - update_option( 'frm_connect_token', $auth, 'no' );
1104 + update_option( 'frm_connect_token', $auth );
1239 1105 }
1240 - $page = FrmAppHelper::simple_get( 'page', 'sanitize_title', 'formidable-settings' );
1241 - $link = 'https://formidableforms.com/api-connect/';
1106 + $link = FrmAppHelper::admin_upgrade_link( 'connect', 'api-connect' );
1242 1107 $args = array(
1243 1108 'v' => 2,
1244 1109 'siteurl' => FrmAppHelper::site_url(),
1245 1110 'url' => get_rest_url(),
1246 - 'inst' => (int) FrmAppHelper::pro_is_included(),
1247 - 'return' => $page,
1248 1111 'token' => $auth,
1249 1112 'l' => self::get_pro_license(),
1250 1113 );
1251 1114
@@ -1263,12 +1126,9 @@
1263 1126 // Verify params present (auth & download link).
1264 1127 $post_auth = FrmAppHelper::get_param( 'token', '', 'request', 'sanitize_text_field' );
1265 1128 $post_url = FrmAppHelper::get_param( 'file_url', '', 'request', 'sanitize_text_field' );
1266 1129
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 ) {
1130 + if ( empty( $post_auth ) || empty( $post_url ) ) {
1271 1131 return false;
1272 1132 }
1273 1133
1274 1134 // Verify auth.
@@ -1283,10 +1143,8 @@
1283 1143 /**
1284 1144 * Install and/or activate the add-on file.
1285 1145 *
1286 1146 * @since 4.08
1287 - *
1288 - * @return array
1289 1147 */
1290 1148 public static function install_addon_api() {
1291 1149 self::$plugin = FrmAppHelper::get_param( 'file_url', '', 'request', 'esc_url_raw' );
1292 1150
@@ -1297,11 +1155,11 @@
1297 1155
1298 1156 // It's already installed and active.
1299 1157 $active = self::activate_plugin( 'formidable-pro/formidable-pro.php', false, false, true );
1300 1158 if ( is_wp_error( $active ) ) {
1301 - $response = self::maybe_download_and_activate();
1302 - if ( is_array( $response ) ) {
1303 - // The download failed.
1159 + // Download plugin now.
1160 + $response = self::download_and_activate();
1161 + if ( is_array( $response ) && isset( $response['success'] ) ) {
1304 1162 return $response;
1305 1163 }
1306 1164 }
1307 1165
@@ -1328,58 +1186,22 @@
1328 1186 );
1329 1187 }
1330 1188
1331 1189 /**
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 1190 * Render a conditional action button for a specified plugin
1356 1191 *
1192 + * @param string $plugin
1193 + * @param array|string $upgrade_link_args
1357 1194 * @since 4.09
1358 - *
1359 - * @param string $plugin
1360 - * @param array|string $upgrade_link_args
1361 - * @return void
1362 1195 */
1363 1196 public static function conditional_action_button( $plugin, $upgrade_link_args ) {
1364 1197 if ( is_callable( 'FrmProAddonsController::conditional_action_button' ) ) {
1365 - FrmProAddonsController::conditional_action_button( $plugin, $upgrade_link_args );
1366 - return;
1198 + return FrmProAddonsController::conditional_action_button( $plugin, $upgrade_link_args );
1367 1199 }
1368 1200
1369 1201 $addon = self::get_addon( $plugin );
1370 1202 $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 );
1203 + self::addon_upgrade_link( $addon, $upgrade_link );
1382 1204 }
1383 1205
1384 1206 /**
1385 1207 * Render a conditional action button for an add on
@@ -1384,23 +1206,16 @@
1384 1206 /**
1385 1207 * Render a conditional action button for an add on
1386 1208 *
1387 1209 * @since 4.09.01
1388 - *
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
1210 + * @param array $addon
1211 + * @param string|false $license_type
1212 + * @param string $plan_required
1213 + * @param string $upgrade_link
1398 1214 */
1399 1215 public static function show_conditional_action_button( $atts ) {
1400 1216 if ( is_callable( 'FrmProAddonsController::show_conditional_action_button' ) ) {
1401 - FrmProAddonsController::show_conditional_action_button( $atts );
1402 - return;
1217 + return FrmProAddonsController::show_conditional_action_button( $atts );
1403 1218 }
1404 1219
1405 1220 self::addon_upgrade_link( $atts['addon'], $atts['upgrade_link'] );
1406 1221 }
@@ -1406,19 +1221,10 @@
1406 1221 }
1407 1222
1408 1223 /**
1409 1224 * @since 4.09.01
1410 - *
1411 - * @param array|false $addon
1412 - * @param array|string $upgrade_link
1413 - *
1414 - * @return void
1415 1225 */
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 -
1226 + protected static function addon_upgrade_link( $addon, $upgrade_link ) {
1421 1227 if ( $addon ) {
1422 1228 $upgrade_link .= '&utm_content=' . $addon['slug'];
1423 1229 }
1424 1230
@@ -1425,16 +1231,11 @@
1425 1231 if ( $addon && isset( $addon['categories'] ) && in_array( 'Solution', $addon['categories'], true ) ) {
1426 1232 // Solutions will go to a separate page.
1427 1233 $upgrade_link = FrmAppHelper::admin_upgrade_link( 'addons', $addon['link'] );
1428 1234 }
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 1235 ?>
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 ); ?>
1236 + <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' ); ?>">
1237 + <?php esc_html_e( 'Upgrade Now', 'formidable' ); ?>
1437 1238 </a>
1438 1239 <?php
1439 1240 }
1440 1241
@@ -1439,10 +1240,8 @@
1439 1240 }
1440 1241
1441 1242 /**
1442 1243 * @since 3.04.02
1443 - *
1444 - * @return void
1445 1244 */
1446 1245 public static function ajax_install_addon() {
1447 1246 self::install_addon_permissions();
1448 1247
@@ -1456,58 +1255,97 @@
1456 1255 wp_die();
1457 1256 }
1458 1257
1459 1258 /**
1460 - * Allowed URLs used for internal source of plugins installation.
1461 - *
1462 - * @since 6.3.1
1463 - *
1259 + * @since 4.06.02
1260 + * @deprecated 4.09.01
1261 + */
1262 + public static function ajax_multiple_addons() {
1263 + FrmDeprecated::ajax_multiple_addons();
1264 + }
1265 +
1266 + /**
1267 + * @since 3.04.03
1268 + * @deprecated 3.06
1269 + * @codeCoverageIgnore
1464 1270 * @return array
1465 1271 */
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 - );
1272 + public static function error_for_license( $license ) {
1273 + return FrmDeprecated::error_for_license( $license );
1274 + }
1472 1275
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 );
1276 + /**
1277 + * @since 3.04.03
1278 + * @deprecated 3.06
1279 + * @codeCoverageIgnore
1280 + */
1281 + public static function get_pro_updater() {
1282 + return FrmDeprecated::get_pro_updater();
1283 + }
1481 1284
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' );
1285 + /**
1286 + * @since 3.04.03
1287 + * @deprecated 3.06
1288 + * @codeCoverageIgnore
1289 + *
1290 + * @return array
1291 + */
1292 + public static function get_addon_info( $license = '' ) {
1293 + return FrmDeprecated::get_addon_info( $license );
1294 + }
1484 1295
1485 - return array();
1486 - }
1296 + /**
1297 + * @since 3.04.03
1298 + * @deprecated 3.06
1299 + * @codeCoverageIgnore
1300 + *
1301 + * @return string
1302 + */
1303 + public static function get_cache_key( $license ) {
1304 + return FrmDeprecated::get_cache_key( $license );
1305 + }
1487 1306
1488 - return $allowed_url_list;
1307 + /**
1308 + * @since 3.04.03
1309 + * @deprecated 3.06
1310 + * @codeCoverageIgnore
1311 + */
1312 + public static function reset_cached_addons( $license = '' ) {
1313 + FrmDeprecated::reset_cached_addons( $license );
1489 1314 }
1490 1315
1491 1316 /**
1492 - * Gets required plan for an addon.
1317 + * @since 2.03.08
1318 + * @deprecated 3.04.03
1319 + * @codeCoverageIgnore
1493 1320 *
1494 - * @since 6.4.2
1321 + * @param boolean $return
1322 + * @param string $package
1495 1323 *
1496 - * @return string Empty string if no plan is required for active license.
1324 + * @return boolean
1497 1325 */
1498 - public static function get_addon_required_plan( $addon_id ) {
1499 - $api = new FrmFormApi();
1500 - $addons = $api->get_api_info();
1326 + public static function add_shorten_edd_filename_filter( $return, $package ) {
1327 + return FrmDeprecated::add_shorten_edd_filename_filter( $return, $package );
1328 + }
1501 1329
1502 - if ( is_array( $addons ) && array_key_exists( $addon_id, $addons ) ) {
1503 - $dates = $addons[ $addon_id ];
1504 - $requires = FrmFormsHelper::get_plan_required( $dates );
1505 - }
1330 + /**
1331 + * @since 2.03.08
1332 + * @deprecated 3.04.03
1333 + * @codeCoverageIgnore
1334 + *
1335 + * @param string $filename
1336 + * @param string $ext
1337 + *
1338 + * @return string
1339 + */
1340 + public static function shorten_edd_filename( $filename, $ext ) {
1341 + return FrmDeprecated::shorten_edd_filename( $filename, $ext );
1342 + }
1506 1343
1507 - if ( ! isset( $requires ) || ! is_string( $requires ) ) {
1508 - $requires = '';
1509 - }
1510 -
1511 - return $requires;
1344 + /**
1345 + * @deprecated 3.04.03
1346 + * @codeCoverageIgnore
1347 + */
1348 + public static function get_licenses() {
1349 + FrmDeprecated::get_licenses();
1512 1350 }
1513 1351 }