PluginProbe
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More / trunk
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More vtrunk
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/FrmFormTemplatesController.php +13 -11 6.28 → trunk View file →
@@ -351,9 +351,9 @@
351 351 }
352 352 }
353 353
354 354 // Update the favorite templates option.
355 - update_option( self::FAVORITE_TEMPLATES_OPTION, self::$favorite_templates );
355 + update_option( self::FAVORITE_TEMPLATES_OPTION, self::$favorite_templates, false );
356 356
357 357 // Return the updated list of favorite templates.
358 358 wp_send_json_success( self::$favorite_templates );
359 359 }
@@ -376,14 +376,9 @@
376 376 // Get posted data.
377 377 $form_id = FrmAppHelper::get_param( 'xml', '', 'post', 'absint' );
378 378 $new_form_id = FrmForm::duplicate( $form_id, 1, true );
379 379
380 - if ( ! $new_form_id ) {
381 - // Send an error response if form duplication fails.
382 - $response = array(
383 - 'message' => __( 'There was an error creating a template.', 'formidable' ),
384 - );
385 - } else {
380 + if ( $new_form_id ) {
386 381 FrmForm::update( $new_form_id, FrmFormsController::get_modal_values() );
387 382
388 383 // Send a success response with redirect URL.
389 384 $response = array(
@@ -388,8 +383,13 @@
388 383 // Send a success response with redirect URL.
389 384 $response = array(
390 385 'redirect' => admin_url( 'admin.php?page=formidable&frm_action=duplicate&id=' . $new_form_id ) . '&_wpnonce=' . wp_create_nonce(),
391 386 );
387 + } else {
388 + // Send an error response if form duplication fails.
389 + $response = array(
390 + 'message' => __( 'There was an error creating a template.', 'formidable' ),
391 + );
392 392 }
393 393
394 394 // Send response.
395 395 echo wp_json_encode( $response );
@@ -591,12 +591,14 @@
591 591 * @return void
592 592 */
593 593 private static function assign_featured_templates() {
594 594 foreach ( self::FEATURED_TEMPLATES_IDS as $key ) {
595 - if ( isset( self::$templates[ $key ] ) ) {
596 - self::$templates[ $key ]['is_featured'] = true;
597 - self::$featured_templates[] = self::$templates[ $key ];
595 + if ( ! isset( self::$templates[ $key ] ) ) {
596 + continue;
598 597 }
598 +
599 + self::$templates[ $key ]['is_featured'] = true;
600 + self::$featured_templates[] = self::$templates[ $key ];
599 601 }
600 602 }
601 603
602 604 /**
@@ -779,9 +781,9 @@
779 781 *
780 782 * @return int
781 783 */
782 784 public static function get_template_count() {
783 - if ( empty( self::$templates ) ) {
785 + if ( ! self::$templates ) {
784 786 self::$form_template_api = new FrmFormTemplateApi();
785 787 self::retrieve_and_set_templates();
786 788 }
787 789 return count( self::$templates );