PluginProbe
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More / 6.2
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More v6.2
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/helpers/FrmFormMigratorsHelper.php +22 -28 6.276.2 View file →
@@ -5,11 +5,8 @@
5 5
6 6 class FrmFormMigratorsHelper {
7 7
8 8 /**
9 - * @param array $form
10 - * @param array|null $dismissed
11 - *
12 9 * @return bool
13 10 */
14 11 private static function is_dismissed( $form, $dismissed = null ) {
15 12 if ( $dismissed === null ) {
@@ -14,10 +11,14 @@
14 11 private static function is_dismissed( $form, $dismissed = null ) {
15 12 if ( $dismissed === null ) {
16 13 $dismissed = get_option( 'frm_dismissed' );
17 14 }
18 - // phpcs:ignore WordPress.PHP.StrictInArray.MissingTrueStrict
19 - return ! empty( $dismissed ) && in_array( $form['class'], $dismissed );
15 +
16 + if ( ! empty( $dismissed ) && in_array( $form['class'], $dismissed ) ) {
17 + return true;
18 + }
19 +
20 + return false;
20 21 }
21 22
22 23 /**
23 24 * @return void
@@ -23,9 +24,8 @@
23 24 * @return void
24 25 */
25 26 public static function maybe_show_download_link() {
26 27 $forms = self::import_links();
27 -
28 28 foreach ( $forms as $form ) {
29 29 if ( ! self::is_dismissed( $form ) ) {
30 30 self::install_banner( $form );
31 31 } else {
@@ -41,16 +41,11 @@
41 41 *
42 42 * @return void
43 43 */
44 44 public static function maybe_add_to_inbox() {
45 + $inbox = new FrmInbox();
45 46 $forms = self::import_links();
46 47
47 - if ( ! $forms ) {
48 - return;
49 - }
50 -
51 - $inbox = new FrmInbox();
52 -
53 48 foreach ( $forms as $form ) {
54 49 $inbox->add_message(
55 50 array(
56 51 'key' => $form['class'],
@@ -55,9 +50,9 @@
55 50 array(
56 51 'key' => $form['class'],
57 52 'subject' => 'You have new importable forms',
58 53 'message' => 'Did you know you can import your forms created in ' . esc_html( $form['name'] ) . '?',
59 - 'cta' => '<a href="' . esc_url( admin_url( 'admin.php?page=formidable-import' ) ) . '" class="button-primary frm-button-primary">' . esc_html__( 'Learn More', 'formidable' ) . '</a>', // phpcs:ignore SlevomatCodingStandard.Files.LineLength.LineTooLong
54 + 'cta' => '<a href="' . esc_url( admin_url( 'admin.php?page=formidable-import' ) ) . '" class="button-primary frm-button-primary">' . esc_html__( 'Learn More', 'formidable' ) . '</a>',
60 55 'icon' => 'frm_cloud_upload_solid_icon',
61 56 'type' => 'news',
62 57 )
63 58 );
@@ -72,9 +67,8 @@
72 67 return array();
73 68 }
74 69
75 70 $forms = array();
76 -
77 71 foreach ( self::importable_forms() as $form ) {
78 72 if ( class_exists( $form['class'] ) || ! is_plugin_active( $form['plugin'] ) ) {
79 73 // Either the importer is installed or the source plugin isn't.
80 74 continue;
@@ -79,15 +73,14 @@
79 73 // Either the importer is installed or the source plugin isn't.
80 74 continue;
81 75 }
82 76
83 - $installer = new FrmInstallPlugin( array( 'plugin_file' => $form['importer'] ) );
77 + $installer = new FrmInstallPlugin( array( 'plugin_file' => $form['importer'] ) );
84 78 $form['installed'] = $installer->is_installed();
85 79 $form['link'] = $installer->get_activate_link();
86 80
87 81 $forms[] = $form;
88 82 }
89 -
90 83 return $forms;
91 84 }
92 85
93 86 /**
@@ -111,13 +104,8 @@
111 104 ),
112 105 );
113 106 }
114 107
115 - /**
116 - * @param array $install
117 - *
118 - * @return string|null
119 - */
120 108 private static function install_banner( $install ) {
121 109 if ( empty( $install['link'] ) ) {
122 110 return '';
123 111 }
@@ -133,9 +121,8 @@
133 121 <p>Did you know you can import your forms created in <?php echo esc_html( $install['name'] ); ?>?</p>
134 122 <?php self::install_button( $install ); ?>
135 123 </div>
136 124 <?php
137 - return null;
138 125 }
139 126
140 127 /**
141 128 * @param array $install
@@ -145,9 +132,9 @@
145 132 */
146 133 private static function install_button( $install, $label = '' ) {
147 134 $primary = 'button-secondary frm-button-secondary ';
148 135
149 - if ( ! $label ) {
136 + if ( empty( $label ) ) {
150 137 $label = __( 'Get Started', 'formidable' );
151 138 $primary = 'button-primary frm-button-primary ';
152 139 }
153 140
@@ -152,9 +139,9 @@
152 139 }
153 140
154 141 if ( $install['installed'] ) {
155 142 ?>
156 - <a rel="<?php echo esc_attr( $install['importer'] ); ?>" class="button frm-activate-addon <?php echo esc_attr( $primary . ( empty( $install['link'] ) ? 'frm_hidden' : '' ) ); ?>"><?php // phpcs:ignore SlevomatCodingStandard.Files.LineLength.LineTooLong ?>
143 + <a rel="<?php echo esc_attr( $install['importer'] ); ?>" class="button frm-activate-addon <?php echo esc_attr( $primary . ( empty( $install['link'] ) ? 'frm_hidden' : '' ) ); ?>">
157 144 <?php
158 145 if ( $label === 'auto' ) {
159 146 /* translators: %s: Name of the plugin */
160 147 $label = sprintf( __( 'Activate %s', 'formidable' ), $install['name'] );
@@ -160,9 +147,9 @@
160 147 $label = sprintf( __( 'Activate %s', 'formidable' ), $install['name'] );
161 148 }
162 149 } else {
163 150 ?>
164 - <a rel="<?php echo esc_attr( $install['package'] ); ?>" class="frm-install-addon button <?php echo esc_attr( $primary ); ?>" aria-label="<?php esc_attr_e( 'Install', 'formidable' ); ?>"><?php // phpcs:ignore SlevomatCodingStandard.Files.LineLength.LineTooLong ?>
151 + <a rel="<?php echo esc_attr( $install['package'] ); ?>" class="frm-install-addon button <?php echo esc_attr( $primary ); ?>" aria-label="<?php esc_attr_e( 'Install', 'formidable' ); ?>">
165 152 <?php
166 153 if ( $label === 'auto' ) {
167 154 /* translators: %s: Name of the plugin */
168 155 $label = sprintf( __( 'Install %s Importer', 'formidable' ), $install['name'] );
@@ -179,14 +166,21 @@
179 166 */
180 167 public static function dismiss_migrator() {
181 168 check_ajax_referer( 'frm_ajax', 'nonce' );
182 169 $dismissed = get_option( 'frm_dismissed' );
183 -
184 - if ( ! $dismissed ) {
170 + if ( empty( $dismissed ) ) {
185 171 $dismissed = array();
186 172 }
187 -
188 173 $dismissed[] = FrmAppHelper::get_param( 'plugin', '', 'post', 'sanitize_text_field' );
189 174 update_option( 'frm_dismissed', array_filter( $dismissed ), 'no' );
190 175 wp_die();
176 + }
177 +
178 + /**
179 + * @deprecated 4.05
180 + *
181 + * @return void
182 + */
183 + public static function notification_count() {
184 + _deprecated_function( __METHOD__, '4.05' );
191 185 }
192 186 }