PluginProbe
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More / 6.14
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More v6.14
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/models/FrmInstallPlugin.php +28 -45 6.256.14 View file →
@@ -81,45 +81,40 @@
81 81
82 82 // Get posted data.
83 83 $plugin_slug = FrmAppHelper::get_post_param( 'plugin', '', 'sanitize_text_field' );
84 84
85 - if ( ! empty( get_plugins()[ $plugin_slug ] ) ) {
86 - $activate = activate_plugin( $plugin_slug );
87 - } else {
88 - // Include necessary files for plugin installation.
89 - require_once ABSPATH . 'wp-admin/includes/class-wp-upgrader.php';
90 - require_once ABSPATH . 'wp-admin/includes/plugin-install.php';
85 + // Include necessary files for plugin installation.
86 + require_once ABSPATH . 'wp-admin/includes/class-wp-upgrader.php';
87 + require_once ABSPATH . 'wp-admin/includes/plugin-install.php';
91 88
92 - // Get the plugin information.
93 - $api = plugins_api(
94 - 'plugin_information',
95 - array(
96 - 'slug' => $plugin_slug,
97 - 'fields' => array(
98 - 'sections' => false,
99 - ),
100 - )
101 - );
102 - if ( is_wp_error( $api ) ) {
103 - wp_send_json_error( $api->get_error_message() );
104 - }
105 - if ( ! FrmAddonsController::url_is_allowed( $api->versions['trunk'] ) ) {
106 - wp_send_json_error( 'This download is not allowed' );
107 - }
89 + // Get the plugin information.
90 + $api = plugins_api(
91 + 'plugin_information',
92 + array(
93 + 'slug' => $plugin_slug,
94 + 'fields' => array(
95 + 'sections' => false,
96 + ),
97 + )
98 + );
99 + if ( is_wp_error( $api ) ) {
100 + wp_send_json_error( $api->get_error_message() );
101 + }
102 + if ( ! FrmAddonsController::url_is_allowed( $api->versions['trunk'] ) ) {
103 + wp_send_json_error( 'This download is not allowed' );
104 + }
108 105
109 - // Set up the Plugin Upgrader.
110 - $upgrader = new Plugin_Upgrader( new WP_Ajax_Upgrader_Skin() );
106 + // Set up the Plugin Upgrader.
107 + $upgrader = new Plugin_Upgrader( new WP_Ajax_Upgrader_Skin() );
111 108
112 - // Install the plugin.
113 - $result = $upgrader->install( $api->versions['trunk'] );
114 - if ( is_wp_error( $result ) ) {
115 - wp_send_json_error( $result->get_error_message() );
116 - }
109 + // Install the plugin.
110 + $result = $upgrader->install( $api->versions['trunk'] );
111 + if ( is_wp_error( $result ) ) {
112 + wp_send_json_error( $result->get_error_message() );
113 + }
117 114
118 - // Activate the plugin.
119 - $activate = activate_plugin( $upgrader->plugin_info() );
120 - }//end if
121 -
115 + // Activate the plugin.
116 + $activate = activate_plugin( $upgrader->plugin_info() );
122 117 if ( is_wp_error( $activate ) ) {
123 118 wp_send_json_error( $activate->get_error_message() );
124 119 }
125 120
@@ -151,18 +146,6 @@
151 146 wp_send_json_success();
152 147 } else {
153 148 wp_send_json_error();
154 149 }
155 - }
156 -
157 - /**
158 - * Check if a plugin is installed.
159 - *
160 - * @since 6.16
161 - *
162 - * @param string $plugin_file
163 - * @return bool
164 - */
165 - private static function is_plugin_installed( $plugin_file ) {
166 - return isset( get_plugins()[ $plugin_file ] );
167 150 }
168 151 }