| @@ -9,11 +9,8 @@ | ||
| 9 | 9 | * @var string $plugin |
| 10 | 10 | */ |
| 11 | 11 | protected static $plugin; |
| 12 | 12 | |
| 13 | - /** | |
| 14 | - * @return void | |
| 15 | - */ | |
| 16 | 13 | public static function menu() { |
| 17 | 14 | if ( ! current_user_can( 'activate_plugins' ) ) { |
| 18 | 15 | return; |
| 19 | 16 | } |
| @@ -18,9 +15,9 @@ | ||
| 18 | 15 | return; |
| 19 | 16 | } |
| 20 | 17 | |
| 21 | 18 | $label = __( 'Add-Ons', 'formidable' ); |
| 22 | - $label = '<span style="color:#1da867">' . $label . '</span>'; | |
| 19 | + $label = '<span style="color:#fe5a1d">' . $label . '</span>'; | |
| 23 | 20 | |
| 24 | 21 | add_submenu_page( 'formidable', 'Formidable | ' . __( 'Add-Ons', 'formidable' ), $label, 'frm_view_forms', 'formidable-addons', 'FrmAddonsController::list_addons' ); |
| 25 | 22 | |
| 26 | 23 | if ( ! FrmAppHelper::pro_is_installed() ) { |
| @@ -37,11 +34,8 @@ | ||
| 37 | 34 | exit; |
| 38 | 35 | } |
| 39 | 36 | } |
| 40 | 37 | |
| 41 | - /** | |
| 42 | - * @return void | |
| 43 | - */ | |
| 44 | 38 | public static function list_addons() { |
| 45 | 39 | FrmAppHelper::include_svg(); |
| 46 | 40 | $installed_addons = apply_filters( 'frm_installed_addons', array() ); |
| 47 | 41 | $license_type = ''; |
| @@ -72,11 +66,8 @@ | ||
| 72 | 66 | |
| 73 | 67 | include( FrmAppHelper::plugin_path() . '/classes/views/addons/list.php' ); |
| 74 | 68 | } |
| 75 | 69 | |
| 76 | - /** | |
| 77 | - * @return void | |
| 78 | - */ | |
| 79 | 70 | public static function license_settings() { |
| 80 | 71 | $plugins = apply_filters( 'frm_installed_addons', array() ); |
| 81 | 72 | if ( empty( $plugins ) ) { |
| 82 | 73 | esc_html_e( 'There are no plugins on your site that require a license', 'formidable' ); |
| @@ -88,11 +79,8 @@ | ||
| 88 | 79 | |
| 89 | 80 | include( FrmAppHelper::plugin_path() . '/classes/views/addons/settings.php' ); |
| 90 | 81 | } |
| 91 | 82 | |
| 92 | - /** | |
| 93 | - * @return array | |
| 94 | - */ | |
| 95 | 83 | protected static function get_api_addons() { |
| 96 | 84 | $api = new FrmFormApi(); |
| 97 | 85 | $addons = $api->get_api_info(); |
| 98 | 86 | |
| @@ -123,10 +111,10 @@ | ||
| 123 | 111 | 'docs' => '', |
| 124 | 112 | 'excerpt' => 'Enhance your basic Formidable forms with a plethora of Pro field types and features. Create advanced forms and data-driven applications in minutes.', |
| 125 | 113 | ), |
| 126 | 114 | 'mailchimp' => array( |
| 127 | - 'title' => 'Mailchimp Forms', | |
| 128 | - 'excerpt' => 'Get on the path to more sales and leads in a matter of minutes. Add leads to a Mailchimp mailing list when they submit forms and update their information along with the entry.', | |
| 115 | + 'title' => 'MailChimp Forms', | |
| 116 | + 'excerpt' => 'Get on the path to more sales and leads in a matter of minutes. Add leads to a MailChimp mailing list when they submit forms and update their information along with the entry.', | |
| 129 | 117 | ), |
| 130 | 118 | 'registration' => array( |
| 131 | 119 | 'title' => 'User Registration Forms', |
| 132 | 120 | 'link' => 'downloads/user-registration/', |
| @@ -251,11 +239,8 @@ | ||
| 251 | 239 | } |
| 252 | 240 | |
| 253 | 241 | /** |
| 254 | 242 | * @since 4.08 |
| 255 | - * | |
| 256 | - * @param array $addons | |
| 257 | - * @return array | |
| 258 | 243 | */ |
| 259 | 244 | protected static function get_pro_from_addons( $addons ) { |
| 260 | 245 | return isset( $addons['93790'] ) ? $addons['93790'] : array(); |
| 261 | 246 | } |
| @@ -297,10 +282,8 @@ | ||
| 297 | 282 | } |
| 298 | 283 | |
| 299 | 284 | /** |
| 300 | 285 | * @since 4.08 |
| 301 | - * | |
| 302 | - * @return array|false | |
| 303 | 286 | */ |
| 304 | 287 | protected static function get_primary_license_info() { |
| 305 | 288 | $installed_addons = apply_filters( 'frm_installed_addons', array() ); |
| 306 | 289 | if ( empty( $installed_addons ) || ! isset( $installed_addons['formidable_pro'] ) ) { |
| @@ -330,12 +313,17 @@ | ||
| 330 | 313 | if ( empty( $installed_addons ) ) { |
| 331 | 314 | return $transient; |
| 332 | 315 | } |
| 333 | 316 | |
| 334 | - $version_info = self::fill_update_addon_info( $installed_addons ); | |
| 317 | + $version_info = self::fill_update_addon_info( $installed_addons ); | |
| 318 | + | |
| 335 | 319 | $transient->last_checked = time(); |
| 336 | - $wp_plugins = self::get_plugins(); | |
| 337 | 320 | |
| 321 | + if ( ! function_exists( 'get_plugins' ) ) { | |
| 322 | + require_once ABSPATH . 'wp-admin/includes/plugin.php'; | |
| 323 | + } | |
| 324 | + $wp_plugins = get_plugins(); | |
| 325 | + | |
| 338 | 326 | foreach ( $version_info as $id => $plugin ) { |
| 339 | 327 | $plugin = (object) $plugin; |
| 340 | 328 | |
| 341 | 329 | if ( ! isset( $plugin->new_version ) || ! isset( $plugin->package ) ) { |
| @@ -368,23 +356,8 @@ | ||
| 368 | 356 | return $transient; |
| 369 | 357 | } |
| 370 | 358 | |
| 371 | 359 | /** |
| 372 | - * Copy of FrmAppHelper::get_plugins. | |
| 373 | - * Because this gets called on "pre_set_site_transient_update_plugins" an old version of FrmAppHelper may be loaded on plugin update. | |
| 374 | - * This means that trying to access FrmAppHelper::get_plugins when upgrading from a Lite version before v5.5 results in a one-off error. | |
| 375 | - * | |
| 376 | - * @since 5.5.2 | |
| 377 | - * @return array | |
| 378 | - */ | |
| 379 | - protected static function get_plugins() { | |
| 380 | - if ( ! function_exists( 'get_plugins' ) ) { | |
| 381 | - require_once ABSPATH . 'wp-admin/includes/plugin.php'; | |
| 382 | - } | |
| 383 | - return get_plugins(); | |
| 384 | - } | |
| 385 | - | |
| 386 | - /** | |
| 387 | 360 | * Check if a plugin is installed before showing an update for it |
| 388 | 361 | * |
| 389 | 362 | * @since 3.05 |
| 390 | 363 | * |
| @@ -392,9 +365,14 @@ | ||
| 392 | 365 | * |
| 393 | 366 | * @return bool - True if installed |
| 394 | 367 | */ |
| 395 | 368 | protected static function is_installed( $plugin ) { |
| 396 | - $all_plugins = self::get_plugins(); | |
| 369 | + if ( ! function_exists( 'get_plugins' ) ) { | |
| 370 | + require_once ABSPATH . 'wp-admin/includes/plugin.php'; | |
| 371 | + } | |
| 372 | + | |
| 373 | + $all_plugins = get_plugins(); | |
| 374 | + | |
| 397 | 375 | return isset( $all_plugins[ $plugin ] ); |
| 398 | 376 | } |
| 399 | 377 | |
| 400 | 378 | /** |
| @@ -544,11 +522,8 @@ | ||
| 544 | 522 | |
| 545 | 523 | return $plugin; |
| 546 | 524 | } |
| 547 | 525 | |
| 548 | - /** | |
| 549 | - * @return void | |
| 550 | - */ | |
| 551 | 526 | protected static function prepare_addons( &$addons ) { |
| 552 | 527 | $activate_url = ''; |
| 553 | 528 | if ( current_user_can( 'activate_plugins' ) ) { |
| 554 | 529 | $activate_url = add_query_arg( array( 'action' => 'activate' ), admin_url( 'plugins.php' ) ); |
| @@ -606,11 +581,8 @@ | ||
| 606 | 581 | $addons[ $id ] = $addon; |
| 607 | 582 | } |
| 608 | 583 | } |
| 609 | 584 | |
| 610 | - /** | |
| 611 | - * @return bool | |
| 612 | - */ | |
| 613 | 585 | private static function is_plugin_active( $file_name, $slug ) { |
| 614 | 586 | if ( 'formidable-views/formidable-views.php' === $file_name ) { |
| 615 | 587 | return self::get_active_views_version() === $slug; |
| 616 | 588 | } |
| @@ -629,10 +601,8 @@ | ||
| 629 | 601 | } |
| 630 | 602 | |
| 631 | 603 | /** |
| 632 | 604 | * @since 3.04.02 |
| 633 | - * | |
| 634 | - * @return void | |
| 635 | 605 | */ |
| 636 | 606 | protected static function prepare_addon_link( &$link ) { |
| 637 | 607 | $site_url = 'https://formidableforms.com/'; |
| 638 | 608 | if ( strpos( $link, 'http' ) !== 0 ) { |
| @@ -651,10 +621,8 @@ | ||
| 651 | 621 | * Add the status to the addon array. Status options are: |
| 652 | 622 | * installed, active, not installed |
| 653 | 623 | * |
| 654 | 624 | * @since 3.04.02 |
| 655 | - * | |
| 656 | - * @return void | |
| 657 | 625 | */ |
| 658 | 626 | protected static function set_addon_status( &$addon ) { |
| 659 | 627 | if ( ! empty( $addon['activate_url'] ) ) { |
| 660 | 628 | $addon['status'] = array( |
| @@ -673,11 +641,8 @@ | ||
| 673 | 641 | ); |
| 674 | 642 | } |
| 675 | 643 | } |
| 676 | 644 | |
| 677 | - /** | |
| 678 | - * @return void | |
| 679 | - */ | |
| 680 | 645 | public static function upgrade_to_pro() { |
| 681 | 646 | FrmAppHelper::include_svg(); |
| 682 | 647 | |
| 683 | 648 | $link_parts = array( |
| @@ -887,10 +852,8 @@ | ||
| 887 | 852 | /** |
| 888 | 853 | * Install Pro after connection with Formidable. |
| 889 | 854 | * |
| 890 | 855 | * @since 4.02.05 |
| 891 | - * | |
| 892 | - * @return void | |
| 893 | 856 | */ |
| 894 | 857 | public static function connect_pro() { |
| 895 | 858 | FrmAppHelper::permission_check( 'install_plugins' ); |
| 896 | 859 | check_ajax_referer( 'frm_ajax', 'nonce' ); |
| @@ -902,9 +865,9 @@ | ||
| 902 | 865 | |
| 903 | 866 | $response = array(); |
| 904 | 867 | |
| 905 | 868 | // It's already installed and active. |
| 906 | - $active = self::activate_plugin( 'formidable-pro/formidable-pro.php', false, false, true ); | |
| 869 | + $active = activate_plugin( 'formidable-pro/formidable-pro.php', false, false, true ); | |
| 907 | 870 | if ( is_wp_error( $active ) ) { |
| 908 | 871 | // The plugin was installed, but not active. Download it now. |
| 909 | 872 | self::ajax_install_addon(); |
| 910 | 873 | } else { |
| @@ -916,24 +879,8 @@ | ||
| 916 | 879 | wp_die(); |
| 917 | 880 | } |
| 918 | 881 | |
| 919 | 882 | /** |
| 920 | - * @since 5.5.2 | |
| 921 | - * | |
| 922 | - * @param string $plugin | |
| 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. | |
| 927 | - */ | |
| 928 | - protected static function activate_plugin( $plugin, $redirect = '', $network_wide = false, $silent = false ) { | |
| 929 | - if ( ! function_exists( 'activate_plugin' ) ) { | |
| 930 | - require_once ABSPATH . 'wp-admin/includes/plugin.php'; | |
| 931 | - } | |
| 932 | - return activate_plugin( $plugin, $redirect, $network_wide, $silent ); | |
| 933 | - } | |
| 934 | - | |
| 935 | - /** | |
| 936 | 883 | * @since 5.0.10 |
| 937 | 884 | * |
| 938 | 885 | * @return string |
| 939 | 886 | */ |
| @@ -962,10 +909,8 @@ | ||
| 962 | 909 | } |
| 963 | 910 | |
| 964 | 911 | /** |
| 965 | 912 | * @since 3.04.02 |
| 966 | - * | |
| 967 | - * @return void | |
| 968 | 913 | */ |
| 969 | 914 | protected static function maybe_show_cred_form() { |
| 970 | 915 | if ( ! function_exists( 'request_filesystem_credentials' ) ) { |
| 971 | 916 | include_once( ABSPATH . 'wp-admin/includes/file.php' ); |
| @@ -1002,23 +947,8 @@ | ||
| 1002 | 947 | ob_end_clean(); |
| 1003 | 948 | } |
| 1004 | 949 | |
| 1005 | 950 | /** |
| 1006 | - * Checks if an addon download url is allowed. | |
| 1007 | - * | |
| 1008 | - * @since 6.2 | |
| 1009 | - * | |
| 1010 | - * @param string $download_url | |
| 1011 | - * | |
| 1012 | - * @return bool | |
| 1013 | - */ | |
| 1014 | - public static function url_is_allowed( $download_url ) { | |
| 1015 | - return ( | |
| 1016 | - FrmAppHelper::validate_url_is_in_s3_bucket( $download_url, 'zip' ) || in_array( $download_url, self::allowed_external_urls(), true ) | |
| 1017 | - ); | |
| 1018 | - } | |
| 1019 | - | |
| 1020 | - /** | |
| 1021 | 951 | * We do not need any extra credentials if we have gotten this far, |
| 1022 | 952 | * so let's install the plugin. |
| 1023 | 953 | * |
| 1024 | 954 | * @since 3.04.02 |
| @@ -1027,15 +957,8 @@ | ||
| 1027 | 957 | require_once ABSPATH . 'wp-admin/includes/class-wp-upgrader.php'; |
| 1028 | 958 | |
| 1029 | 959 | $download_url = self::get_current_plugin(); |
| 1030 | 960 | |
| 1031 | - if ( ! self::url_is_allowed( $download_url ) ) { | |
| 1032 | - return array( | |
| 1033 | - 'message' => 'Plugin URL is not valid', | |
| 1034 | - 'success' => false, | |
| 1035 | - ); | |
| 1036 | - } | |
| 1037 | - | |
| 1038 | 961 | // Create the plugin upgrader with our custom skin. |
| 1039 | 962 | $installer = new Plugin_Upgrader( new FrmInstallerSkin() ); |
| 1040 | 963 | $installer->install( $download_url ); |
| 1041 | 964 | |
| @@ -1053,10 +976,8 @@ | ||
| 1053 | 976 | } |
| 1054 | 977 | |
| 1055 | 978 | /** |
| 1056 | 979 | * @since 3.06.03 |
| 1057 | - * | |
| 1058 | - * @return void | |
| 1059 | 980 | */ |
| 1060 | 981 | public static function ajax_activate_addon() { |
| 1061 | 982 | |
| 1062 | 983 | self::install_addon_permissions(); |
| @@ -1070,45 +991,31 @@ | ||
| 1070 | 991 | wp_die(); |
| 1071 | 992 | } |
| 1072 | 993 | |
| 1073 | 994 | /** |
| 1074 | - * @return array | |
| 995 | + * @return array|string | |
| 1075 | 996 | */ |
| 1076 | 997 | private static function get_addon_activation_response() { |
| 1077 | - $activating_page = self::get_activating_page(); | |
| 1078 | - | |
| 1079 | - $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' ); | |
| 1080 | - | |
| 1081 | - $response = array( | |
| 1082 | - 'message' => $message, | |
| 1083 | - 'saveAndReload' => $activating_page, | |
| 1084 | - ); | |
| 1085 | - | |
| 998 | + if ( self::activating_from_settings_page() ) { | |
| 999 | + $response = array( | |
| 1000 | + 'message' => __( 'Your plugin has been activated. Would you like to save and reload the page now?', 'formidable' ), | |
| 1001 | + 'saveAndReload' => 'settings', | |
| 1002 | + ); | |
| 1003 | + } else { | |
| 1004 | + $response = __( 'Your plugin has been activated. Please reload the page to see more options.', 'formidable' ); | |
| 1005 | + } | |
| 1086 | 1006 | return $response; |
| 1087 | 1007 | } |
| 1088 | 1008 | |
| 1089 | 1009 | /** |
| 1090 | - * Return a string that reflects the page from which the addon is being activated on, | |
| 1091 | - * if it is from settings or form builder, otherwise return empty string. | |
| 1092 | - * | |
| 1093 | - * @return string | |
| 1010 | + * @return bool | |
| 1094 | 1011 | */ |
| 1095 | - private static function get_activating_page() { | |
| 1096 | - $referer = FrmAppHelper::get_server_value( 'HTTP_REFERER' ); | |
| 1097 | - if ( false !== strpos( $referer, 'frm_action=settings' ) ) { | |
| 1098 | - return 'settings'; | |
| 1099 | - } | |
| 1100 | - | |
| 1101 | - if ( false !== strpos( $referer, 'frm_action=edit' ) ) { | |
| 1102 | - return 'form_builder'; | |
| 1103 | - } | |
| 1104 | - | |
| 1105 | - return ''; | |
| 1012 | + private static function activating_from_settings_page() { | |
| 1013 | + return false !== strpos( FrmAppHelper::get_server_value( 'HTTP_REFERER' ), 'frm_action=settings' ); | |
| 1106 | 1014 | } |
| 1107 | 1015 | |
| 1108 | 1016 | /** |
| 1109 | 1017 | * @since 3.04.02 |
| 1110 | - * | |
| 1111 | 1018 | * @param string $installed The plugin folder name with file name |
| 1112 | 1019 | */ |
| 1113 | 1020 | protected static function maybe_activate_addon( $installed ) { |
| 1114 | 1021 | if ( ! $installed ) { |
| @@ -1114,9 +1021,9 @@ | ||
| 1114 | 1021 | if ( ! $installed ) { |
| 1115 | 1022 | return; |
| 1116 | 1023 | } |
| 1117 | 1024 | |
| 1118 | - $activate = self::activate_plugin( $installed ); | |
| 1025 | + $activate = activate_plugin( $installed ); | |
| 1119 | 1026 | if ( is_wp_error( $activate ) ) { |
| 1120 | 1027 | // Ignore the invalid header message that shows with nested plugins. |
| 1121 | 1028 | if ( $activate->get_error_code() !== 'no_plugin_header' ) { |
| 1122 | 1029 | if ( wp_doing_ajax() ) { |
| @@ -1134,10 +1041,8 @@ | ||
| 1134 | 1041 | /** |
| 1135 | 1042 | * Run security checks before installing |
| 1136 | 1043 | * |
| 1137 | 1044 | * @since 3.04.02 |
| 1138 | - * | |
| 1139 | - * @return void | |
| 1140 | 1045 | */ |
| 1141 | 1046 | protected static function install_addon_permissions() { |
| 1142 | 1047 | check_ajax_referer( 'frm_ajax', 'nonce' ); |
| 1143 | 1048 | |
| @@ -1148,10 +1053,8 @@ | ||
| 1148 | 1053 | } |
| 1149 | 1054 | |
| 1150 | 1055 | /** |
| 1151 | 1056 | * @since 4.08 |
| 1152 | - * | |
| 1153 | - * @return string | |
| 1154 | 1057 | */ |
| 1155 | 1058 | public static function connect_link() { |
| 1156 | 1059 | $auth = get_option( 'frm_connect_token' ); |
| 1157 | 1060 | if ( empty( $auth ) ) { |
| @@ -1181,9 +1084,9 @@ | ||
| 1181 | 1084 | // Verify params present (auth & download link). |
| 1182 | 1085 | $post_auth = FrmAppHelper::get_param( 'token', '', 'request', 'sanitize_text_field' ); |
| 1183 | 1086 | $post_url = FrmAppHelper::get_param( 'file_url', '', 'request', 'sanitize_text_field' ); |
| 1184 | 1087 | |
| 1185 | - if ( ! $post_auth || ! $post_url ) { | |
| 1088 | + if ( empty( $post_auth ) || empty( $post_url ) ) { | |
| 1186 | 1089 | return false; |
| 1187 | 1090 | } |
| 1188 | 1091 | |
| 1189 | 1092 | // Verify auth. |
| @@ -1208,9 +1111,9 @@ | ||
| 1208 | 1111 | // Delete so cannot replay. |
| 1209 | 1112 | delete_option( 'frm_connect_token' ); |
| 1210 | 1113 | |
| 1211 | 1114 | // It's already installed and active. |
| 1212 | - $active = self::activate_plugin( 'formidable-pro/formidable-pro.php', false, false, true ); | |
| 1115 | + $active = activate_plugin( 'formidable-pro/formidable-pro.php', false, false, true ); | |
| 1213 | 1116 | if ( is_wp_error( $active ) ) { |
| 1214 | 1117 | // Download plugin now. |
| 1215 | 1118 | $response = self::download_and_activate(); |
| 1216 | 1119 | if ( is_array( $response ) && isset( $response['success'] ) ) { |
| @@ -1254,11 +1157,9 @@ | ||
| 1254 | 1157 | } |
| 1255 | 1158 | |
| 1256 | 1159 | $addon = self::get_addon( $plugin ); |
| 1257 | 1160 | $upgrade_link = FrmAppHelper::admin_upgrade_link( $upgrade_link_args ); |
| 1258 | - | |
| 1259 | - $upgrade_link_args['link'] = $upgrade_link; | |
| 1260 | - self::addon_upgrade_link( $addon, $upgrade_link_args ); | |
| 1161 | + self::addon_upgrade_link( $addon, $upgrade_link ); | |
| 1261 | 1162 | } |
| 1262 | 1163 | |
| 1263 | 1164 | /** |
| 1264 | 1165 | * Render a conditional action button for an add on |
| @@ -1263,9 +1164,8 @@ | ||
| 1263 | 1164 | /** |
| 1264 | 1165 | * Render a conditional action button for an add on |
| 1265 | 1166 | * |
| 1266 | 1167 | * @since 4.09.01 |
| 1267 | - * | |
| 1268 | 1168 | * @param array $addon |
| 1269 | 1169 | * @param string|false $license_type |
| 1270 | 1170 | * @param string $plan_required |
| 1271 | 1171 | * @param string $upgrade_link |
| @@ -1279,18 +1179,10 @@ | ||
| 1279 | 1179 | } |
| 1280 | 1180 | |
| 1281 | 1181 | /** |
| 1282 | 1182 | * @since 4.09.01 |
| 1283 | - * | |
| 1284 | - * @param array|false $addon | |
| 1285 | - * @param string|array $upgrade_link | |
| 1286 | - * | |
| 1287 | - * @return void | |
| 1288 | 1183 | */ |
| 1289 | 1184 | protected static function addon_upgrade_link( $addon, $upgrade_link ) { |
| 1290 | - $atts = is_array( $upgrade_link ) ? $upgrade_link : array(); | |
| 1291 | - $upgrade_link = is_array( $upgrade_link ) ? $upgrade_link['link'] : $upgrade_link; | |
| 1292 | - | |
| 1293 | 1185 | if ( $addon ) { |
| 1294 | 1186 | $upgrade_link .= '&utm_content=' . $addon['slug']; |
| 1295 | 1187 | } |
| 1296 | 1188 | |
| @@ -1297,15 +1189,10 @@ | ||
| 1297 | 1189 | if ( $addon && isset( $addon['categories'] ) && in_array( 'Solution', $addon['categories'], true ) ) { |
| 1298 | 1190 | // Solutions will go to a separate page. |
| 1299 | 1191 | $upgrade_link = FrmAppHelper::admin_upgrade_link( 'addons', $addon['link'] ); |
| 1300 | 1192 | } |
| 1301 | - | |
| 1302 | - $class = ! empty( $atts['class'] ) ? $atts['class'] : ''; | |
| 1303 | - if ( strpos( $class, 'frm-button' ) === false ) { | |
| 1304 | - $class .= ' frm-button-secondary frm-button-sm'; | |
| 1305 | - } | |
| 1306 | 1193 | ?> |
| 1307 | - <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' ); ?>"> | |
| 1194 | + <a class="install-now button button-secondary frm-button-secondary" href="<?php echo esc_url( $upgrade_link ); ?>" target="_blank" rel="noopener" aria-label="<?php esc_attr_e( 'Upgrade Now', 'formidable' ); ?>"> | |
| 1308 | 1195 | <?php esc_html_e( 'Upgrade Now', 'formidable' ); ?> |
| 1309 | 1196 | </a> |
| 1310 | 1197 | <?php |
| 1311 | 1198 | } |
| @@ -1311,19 +1198,13 @@ | ||
| 1311 | 1198 | } |
| 1312 | 1199 | |
| 1313 | 1200 | /** |
| 1314 | 1201 | * @since 3.04.02 |
| 1315 | - * | |
| 1316 | - * @return void | |
| 1317 | 1202 | */ |
| 1318 | 1203 | public static function ajax_install_addon() { |
| 1319 | 1204 | self::install_addon_permissions(); |
| 1320 | 1205 | |
| 1321 | - $result = self::download_and_activate(); | |
| 1322 | - if ( isset( $result['success'] ) && ! $result['success'] ) { | |
| 1323 | - echo json_encode( $result ); | |
| 1324 | - wp_die(); | |
| 1325 | - } | |
| 1206 | + self::download_and_activate(); | |
| 1326 | 1207 | |
| 1327 | 1208 | echo json_encode( self::get_addon_activation_response() ); |
| 1328 | 1209 | wp_die(); |
| 1329 | 1210 | } |
| @@ -1328,68 +1209,10 @@ | ||
| 1328 | 1209 | wp_die(); |
| 1329 | 1210 | } |
| 1330 | 1211 | |
| 1331 | 1212 | /** |
| 1332 | - * Allowed URLs used for internal source of plugins installation. | |
| 1333 | - * | |
| 1334 | - * @since 6.3.1 | |
| 1335 | - * | |
| 1336 | - * @return array | |
| 1337 | - */ | |
| 1338 | - private static function allowed_external_urls() { | |
| 1339 | - $allowed_url_list = array( | |
| 1340 | - 'https://downloads.wordpress.org/plugin/formidable-gravity-forms-importer.zip', | |
| 1341 | - 'https://downloads.wordpress.org/plugin/formidable-import-pirate-forms.zip', | |
| 1342 | - 'https://downloads.wordpress.org/plugin/wp-mail-smtp.zip', | |
| 1343 | - ); | |
| 1344 | - | |
| 1345 | - /** | |
| 1346 | - * List of URLs used in plugin formidable internal installation. | |
| 1347 | - * | |
| 1348 | - * @since 6.3.1 | |
| 1349 | - * | |
| 1350 | - * @param array $allowed_url_list List of URLs. | |
| 1351 | - */ | |
| 1352 | - $allowed_url_list = apply_filters( 'frm_allowed_external_urls', $allowed_url_list ); | |
| 1353 | - | |
| 1354 | - if ( ! is_array( $allowed_url_list ) ) { | |
| 1355 | - _doing_it_wrong( __METHOD__, 'Only an array of URLs could be used within this filter.', '6.3.1' ); | |
| 1356 | - | |
| 1357 | - return array(); | |
| 1358 | - } | |
| 1359 | - | |
| 1360 | - return $allowed_url_list; | |
| 1361 | - } | |
| 1362 | - | |
| 1363 | - /** | |
| 1364 | - * Gets required plan for an addon. | |
| 1365 | - * | |
| 1366 | - * @since 6.4.2 | |
| 1367 | - * | |
| 1368 | - * @return string Empty string if no plan is required for active license. | |
| 1369 | - */ | |
| 1370 | - public static function get_addon_required_plan( $addon_id ) { | |
| 1371 | - $api = new FrmFormApi(); | |
| 1372 | - $addons = $api->get_api_info(); | |
| 1373 | - | |
| 1374 | - if ( is_array( $addons ) && array_key_exists( $addon_id, $addons ) ) { | |
| 1375 | - $dates = $addons[ $addon_id ]; | |
| 1376 | - $requires = FrmFormsHelper::get_plan_required( $dates ); | |
| 1377 | - } | |
| 1378 | - | |
| 1379 | - if ( ! isset( $requires ) || ! is_string( $requires ) ) { | |
| 1380 | - $requires = ''; | |
| 1381 | - } | |
| 1382 | - | |
| 1383 | - return $requires; | |
| 1384 | - } | |
| 1385 | - | |
| 1386 | - /** | |
| 1387 | 1213 | * @since 4.06.02 |
| 1388 | - * | |
| 1389 | 1214 | * @deprecated 4.09.01 |
| 1390 | - * | |
| 1391 | - * @return void | |
| 1392 | 1215 | */ |
| 1393 | 1216 | public static function ajax_multiple_addons() { |
| 1394 | 1217 | FrmDeprecated::ajax_multiple_addons(); |
| 1395 | 1218 | } |
| @@ -1436,14 +1259,10 @@ | ||
| 1436 | 1259 | } |
| 1437 | 1260 | |
| 1438 | 1261 | /** |
| 1439 | 1262 | * @since 3.04.03 |
| 1440 | - * | |
| 1441 | 1263 | * @deprecated 3.06 |
| 1442 | - * | |
| 1443 | 1264 | * @codeCoverageIgnore |
| 1444 | - * | |
| 1445 | - * @return void | |
| 1446 | 1265 | */ |
| 1447 | 1266 | public static function reset_cached_addons( $license = '' ) { |
| 1448 | 1267 | FrmDeprecated::reset_cached_addons( $license ); |
| 1449 | 1268 | } |
| @@ -1477,12 +1296,9 @@ | ||
| 1477 | 1296 | } |
| 1478 | 1297 | |
| 1479 | 1298 | /** |
| 1480 | 1299 | * @deprecated 3.04.03 |
| 1481 | - * | |
| 1482 | 1300 | * @codeCoverageIgnore |
| 1483 | - * | |
| 1484 | - * @return void | |
| 1485 | 1301 | */ |
| 1486 | 1302 | public static function get_licenses() { |
| 1487 | 1303 | FrmDeprecated::get_licenses(); |
| 1488 | 1304 | } |