PluginProbe
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More / 6.7
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More v6.7
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 +30 -15 6.56.7 View file →
@@ -297,12 +297,13 @@
297 297 }
298 298
299 299 /**
300 300 * @since 4.08
301 + * @since 6.7 This is public.
301 302 *
302 303 * @return array|false
303 304 */
304 - protected static function get_primary_license_info() {
305 + public static function get_primary_license_info() {
305 306 $installed_addons = apply_filters( 'frm_installed_addons', array() );
306 307 if ( empty( $installed_addons ) || ! isset( $installed_addons['formidable_pro'] ) ) {
307 308 return false;
308 309 }
@@ -351,15 +352,16 @@
351 352 // don't show an update if the plugin isn't installed
352 353 continue;
353 354 }
354 355
355 - $wp_plugin = isset( $wp_plugins[ $folder ] ) ? $wp_plugins[ $folder ] : array();
356 - $wp_version = isset( $wp_plugin['Version'] ) ? $wp_plugin['Version'] : '1.0';
356 + $wp_plugin = isset( $wp_plugins[ $folder ] ) ? $wp_plugins[ $folder ] : array();
357 + $wp_version = isset( $wp_plugin['Version'] ) ? $wp_plugin['Version'] : '1.0';
358 + $plugin->slug = explode( '/', $folder )[0];
357 359
358 360 if ( version_compare( $wp_version, $plugin->new_version, '<' ) ) {
359 - $slug = explode( '/', $folder );
360 - $plugin->slug = $slug[0];
361 361 $transient->response[ $folder ] = $plugin;
362 + } else {
363 + $transient->no_update[ $folder ] = $plugin;
362 364 }
363 365
364 366 $transient->checked[ $folder ] = $wp_version;
365 367
@@ -1023,10 +1025,8 @@
1023 1025 *
1024 1026 * @since 3.04.02
1025 1027 */
1026 1028 protected static function install_addon() {
1027 - FrmAppHelper::permission_check( 'install_plugins' );
1028 -
1029 1029 require_once ABSPATH . 'wp-admin/includes/class-wp-upgrader.php';
1030 1030
1031 1031 $download_url = self::get_current_plugin();
1032 1032
@@ -1179,17 +1179,13 @@
1179 1179 *
1180 1180 * @return bool
1181 1181 */
1182 1182 public static function can_install_addon_api() {
1183 - if ( ! current_user_can( 'activate_plugins' ) ) {
1184 - return false;
1185 - }
1186 -
1187 1183 // Verify params present (auth & download link).
1188 1184 $post_auth = FrmAppHelper::get_param( 'token', '', 'request', 'sanitize_text_field' );
1189 1185 $post_url = FrmAppHelper::get_param( 'file_url', '', 'request', 'sanitize_text_field' );
1190 1186
1191 - if ( empty( $post_auth ) || empty( $post_url ) ) {
1187 + if ( ! $post_auth || ! $post_url ) {
1192 1188 return false;
1193 1189 }
1194 1190
1195 1191 // Verify auth.
@@ -1260,9 +1256,19 @@
1260 1256 }
1261 1257
1262 1258 $addon = self::get_addon( $plugin );
1263 1259 $upgrade_link = FrmAppHelper::admin_upgrade_link( $upgrade_link_args );
1264 - self::addon_upgrade_link( $addon, $upgrade_link );
1260 +
1261 + if ( ! is_array( $upgrade_link_args ) ) {
1262 + // A string $upgrade_link_args is used for the utm-medium value when calling
1263 + // FrmAppHelper::admin_upgrade_link above.
1264 + // For self::addon_upgrade_link, we'll pass just an empty array with the link key (set below).
1265 + $upgrade_link_args = array();
1266 + }
1267 +
1268 + $upgrade_link_args['link'] = $upgrade_link;
1269 +
1270 + self::addon_upgrade_link( $addon, $upgrade_link_args );
1265 1271 }
1266 1272
1267 1273 /**
1268 1274 * Render a conditional action button for an add on
@@ -1284,13 +1290,17 @@
1284 1290
1285 1291 /**
1286 1292 * @since 4.09.01
1287 1293 *
1288 - * @param array|false $addon
1294 + * @param array|false $addon
1295 + * @param string|array $upgrade_link
1289 1296 *
1290 1297 * @return void
1291 1298 */
1292 1299 protected static function addon_upgrade_link( $addon, $upgrade_link ) {
1300 + $atts = is_array( $upgrade_link ) ? $upgrade_link : array();
1301 + $upgrade_link = is_array( $upgrade_link ) ? $upgrade_link['link'] : $upgrade_link;
1302 +
1293 1303 if ( $addon ) {
1294 1304 $upgrade_link .= '&utm_content=' . $addon['slug'];
1295 1305 }
1296 1306
@@ -1297,10 +1307,15 @@
1297 1307 if ( $addon && isset( $addon['categories'] ) && in_array( 'Solution', $addon['categories'], true ) ) {
1298 1308 // Solutions will go to a separate page.
1299 1309 $upgrade_link = FrmAppHelper::admin_upgrade_link( 'addons', $addon['link'] );
1300 1310 }
1311 +
1312 + $class = ! empty( $atts['class'] ) ? $atts['class'] : '';
1313 + if ( strpos( $class, 'frm-button' ) === false ) {
1314 + $class .= ' frm-button-secondary frm-button-sm';
1315 + }
1301 1316 ?>
1302 - <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' ); ?>">
1317 + <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' ); ?>">
1303 1318 <?php esc_html_e( 'Upgrade Now', 'formidable' ); ?>
1304 1319 </a>
1305 1320 <?php
1306 1321 }