PluginProbe
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More / 5.4
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More v5.4
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/FrmFormAction.php +12 -68 6.35.4 View file →
@@ -49,11 +49,8 @@
49 49 public function get_defaults() {
50 50 return array();
51 51 }
52 52
53 - /**
54 - * @return array
55 - */
56 53 public function get_switch_fields() {
57 54 return array();
58 55 }
59 56
@@ -96,9 +93,8 @@
96 93 'plugin' => $this->id_base,
97 94 'tooltip' => $name,
98 95 'group' => $id_base,
99 96 'color' => '',
100 - 'keywords' => '',
101 97 );
102 98
103 99 $action_options = apply_filters( 'frm_' . $id_base . '_action_options', $action_options );
104 100 $group = $this->get_group( $action_options );
@@ -109,9 +105,9 @@
109 105 shuffle( $colors );
110 106 $action_options['color'] = 'var(--' . reset( $colors ) . ')';
111 107 }
112 108
113 - $upgrade_class = isset( $action_options['classes'] ) && $action_options['classes'] === 'frm_show_upgrade';
109 + $upgrade_class = $action_options['classes'] === 'frm_show_upgrade';
114 110 if ( $action_options['group'] === $id_base ) {
115 111 $upgrade_class = strpos( $action_options['classes'], 'frm_show_upgrade' ) !== false;
116 112 $action_options['classes'] = $group['icon'];
117 113 } elseif ( ! isset( $action_options['classes'] ) || empty( $action_options['classes'] ) || $upgrade_class ) {
@@ -201,20 +197,15 @@
201 197 public function get_field_id( $field_name ) {
202 198 return $field_name . '_' . $this->number;
203 199 }
204 200
205 - /**
206 - * @param int|string $number
207 - * @return void
208 - */
201 + // Private Function. Don't worry about this.
202 +
209 203 public function _set( $number ) {
210 204 $this->number = $number;
211 205 $this->id = $this->id_base . '-' . $number;
212 206 }
213 207
214 - /**
215 - * @return object
216 - */
217 208 public function prepare_new( $form_id = false ) {
218 209 if ( $form_id ) {
219 210 $this->form_id = $form_id;
220 211 }
@@ -251,11 +242,8 @@
251 242
252 243 return $this->save_settings( $action );
253 244 }
254 245
255 - /**
256 - * @return void
257 - */
258 246 public function duplicate_form_actions( $form_id, $old_id ) {
259 247 if ( $form_id == $old_id ) {
260 248 // don't duplicate the actions if this is a template getting updated
261 249 return;
@@ -291,11 +279,8 @@
291 279
292 280 return $post_id;
293 281 }
294 282
295 - /**
296 - * @param object $action
297 - */
298 283 public function duplicate_one( $action, $form_id ) {
299 284 global $frm_duplicate_ids;
300 285
301 286 $action->menu_order = $form_id;
@@ -398,8 +383,9 @@
398 383 $new_instance['post_type'] = FrmFormActionsController::$action_post_type;
399 384 $new_instance['post_name'] = $this->form_id . '_' . $this->id_base . '_' . $this->number;
400 385 $new_instance['menu_order'] = $this->form_id;
401 386 $new_instance['post_date'] = isset( $old_instance->post_date ) ? $old_instance->post_date : '';
387 +
402 388 $instance = $this->update( $new_instance, $old_instance );
403 389
404 390 /**
405 391 * Filter an action's settings before saving.
@@ -434,25 +420,19 @@
434 420 /**
435 421 * If the status of the action has changed, update it
436 422 *
437 423 * @since 3.04
438 - *
439 - * @param array $new_instance
440 - * @param stdClass|array $old_instance
441 - * @return void
442 424 */
443 425 protected function maybe_update_status( $new_instance, $old_instance ) {
444 - if ( ! is_object( $old_instance ) || $new_instance['post_status'] === $old_instance->post_status ) {
445 - return;
426 + if ( $new_instance['post_status'] !== $old_instance->post_status ) {
427 + self::clear_cache();
428 + wp_update_post(
429 + array(
430 + 'ID' => $new_instance['ID'],
431 + 'post_status' => $new_instance['post_status'],
432 + )
433 + );
446 434 }
447 -
448 - self::clear_cache();
449 - wp_update_post(
450 - array(
451 - 'ID' => $new_instance['ID'],
452 - 'post_status' => $new_instance['post_status'],
453 - )
454 - );
455 435 }
456 436
457 437 public function save_settings( $settings ) {
458 438 self::clear_cache();
@@ -522,13 +502,10 @@
522 502 }
523 503
524 504 /**
525 505 * @since 3.04
526 - *
527 506 * @param array $args
528 507 * @param string $default_status
529 - *
530 - * @return void
531 508 */
532 509 protected static function prepare_get_action( &$args, $default_status = 'publish' ) {
533 510 if ( is_numeric( $args ) ) {
534 511 // for reverse compatibility. $limit was changed to $args
@@ -566,14 +543,9 @@
566 543 return ! empty( $payment_actions );
567 544 }
568 545
569 546 public function get_all( $form_id = false, $atts = array() ) {
570 - if ( is_array( $atts ) && ! isset( $atts['limit'] ) && $this->action_options['limit'] > 99 ) {
571 - $atts['limit'] = $this->action_options['limit'];
572 - }
573 -
574 547 self::prepare_get_action( $atts, 'any' );
575 -
576 548 $limit = $atts['limit'];
577 549
578 550 if ( $form_id ) {
579 551 $this->form_id = $form_id;
@@ -615,11 +587,8 @@
615 587
616 588 return $settings;
617 589 }
618 590
619 - /**
620 - * @return array
621 - */
622 591 public static function action_args( $form_id = 0, $limit = 99 ) {
623 592 $args = array(
624 593 'post_type' => FrmFormActionsController::$action_post_type,
625 594 'post_status' => 'publish',
@@ -634,11 +603,8 @@
634 603
635 604 return $args;
636 605 }
637 606
638 - /**
639 - * @param WP_Post|array $action
640 - */
641 607 public function prepare_action( $action ) {
642 608 $action->post_content = (array) FrmAppHelper::maybe_json_decode( $action->post_content );
643 609 $action->post_excerpt = sanitize_title( $action->post_excerpt );
644 610
@@ -662,11 +628,8 @@
662 628
663 629 return $action;
664 630 }
665 631
666 - /**
667 - * @return void
668 - */
669 632 public function destroy( $form_id = false, $type = 'default' ) {
670 633 global $wpdb;
671 634
672 635 $this->form_id = $form_id;
@@ -690,10 +653,8 @@
690 653 /**
691 654 * Delete the action cache when a form action is created, deleted, or updated
692 655 *
693 656 * @since 2.0.5
694 - *
695 - * @return void
696 657 */
697 658 public static function clear_cache() {
698 659 FrmDb::cache_delete_group( 'frm_actions' );
699 660 }
@@ -701,11 +662,8 @@
701 662 public function get_settings() {
702 663 return self::get_action_for_form( $this->form_id, $this->id_base );
703 664 }
704 665
705 - /**
706 - * @return array
707 - */
708 666 public function get_global_defaults() {
709 667 $defaults = $this->get_defaults();
710 668
711 669 if ( ! isset( $defaults['event'] ) ) {
@@ -823,14 +781,11 @@
823 781 /**
824 782 * Prepare the logic value for comparison against the entered value
825 783 *
826 784 * @since 2.01.02
827 - *
828 785 * @deprecated 4.06.02
829 786 *
830 787 * @param array|string $logic_value
831 - *
832 - * @return void
833 788 */
834 789 private static function prepare_logic_value( &$logic_value, $action, $entry ) {
835 790 if ( is_array( $logic_value ) ) {
836 791 $logic_value = reset( $logic_value );
@@ -878,13 +833,8 @@
878 833
879 834 return $observed_value;
880 835 }
881 836
882 - /**
883 - * @param string $class
884 - *
885 - * @return array
886 - */
887 837 public static function default_action_opts( $class = '' ) {
888 838 return array(
889 839 'classes' => 'frm_icon_font ' . $class,
890 840 'active' => false,
@@ -903,11 +853,8 @@
903 853
904 854 return apply_filters( 'frm_action_triggers', $triggers );
905 855 }
906 856
907 - /**
908 - * @return void
909 - */
910 857 public function render_conditional_logic_call_to_action() {
911 858 ?>
912 859 <h3>
913 860 <a href="javascript:void(0)" class="frm_show_upgrade frm_noallow" data-upgrade="<?php echo esc_attr( $this->get_upgrade_text() ); ?>" data-medium="conditional-<?php echo esc_attr( $this->id_base ); ?>">
@@ -916,11 +863,8 @@
916 863 </h3>
917 864 <?php
918 865 }
919 866
920 - /**
921 - * @return string
922 - */
923 867 protected function get_upgrade_text() {
924 868 return __( 'Conditional form actions', 'formidable' );
925 869 }
926 870 }