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/helpers/FrmFormMigratorsHelper.php +20 -16 6.26 → trunk View file →
@@ -14,14 +14,10 @@
14 14 private static function is_dismissed( $form, $dismissed = null ) {
15 15 if ( $dismissed === null ) {
16 16 $dismissed = get_option( 'frm_dismissed' );
17 17 }
18 -
19 - if ( ! empty( $dismissed ) && in_array( $form['class'], $dismissed ) ) {
20 - return true;
21 - }
22 -
23 - return false;
18 + // phpcs:ignore WordPress.PHP.StrictInArray.MissingTrueStrict
19 + return $dismissed && in_array( $form['class'], $dismissed );
24 20 }
25 21
26 22 /**
27 23 * @return void
@@ -31,13 +27,14 @@
31 27
32 28 foreach ( $forms as $form ) {
33 29 if ( ! self::is_dismissed( $form ) ) {
34 30 self::install_banner( $form );
35 - } else {
36 - echo '<span>';
37 - self::install_button( $form, 'auto' );
38 - echo '</span>';
31 + continue;
39 32 }
33 +
34 + echo '<span>';
35 + self::install_button( $form, 'auto' );
36 + echo '</span>';
40 37 }
41 38 }
42 39
43 40 /**
@@ -59,9 +56,9 @@
59 56 array(
60 57 'key' => $form['class'],
61 58 'subject' => 'You have new importable forms',
62 59 'message' => 'Did you know you can import your forms created in ' . esc_html( $form['name'] ) . '?',
63 - '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 + '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
64 61 'icon' => 'frm_cloud_upload_solid_icon',
65 62 'type' => 'news',
66 63 )
67 64 );
@@ -89,8 +86,9 @@
89 86 $form['link'] = $installer->get_activate_link();
90 87
91 88 $forms[] = $form;
92 89 }
90 +
93 91 return $forms;
94 92 }
95 93
96 94 /**
@@ -124,8 +122,9 @@
124 122 if ( empty( $install['link'] ) ) {
125 123 return '';
126 124 }
127 125
126 + // phpcs:disable Generic.WhiteSpace.ScopeIndent
128 127 ?>
129 128 <div class="frm-feature-banner">
130 129 <a href="#" class="dismiss alignright" id="<?php echo esc_attr( $install['class'] ); ?>" title="<?php esc_attr_e( 'Dismiss this message', 'formidable' ); ?>">
131 130 <?php FrmAppHelper::icon_by_class( 'frmfont frm_close_icon', array( 'aria-label' => 'Dismiss' ) ); ?>
@@ -136,8 +135,10 @@
136 135 <p>Did you know you can import your forms created in <?php echo esc_html( $install['name'] ); ?>?</p>
137 136 <?php self::install_button( $install ); ?>
138 137 </div>
139 138 <?php
139 + // phpcs:enable Generic.WhiteSpace.ScopeIndent
140 + return null;
140 141 }
141 142
142 143 /**
143 144 * @param array $install
@@ -147,16 +148,17 @@
147 148 */
148 149 private static function install_button( $install, $label = '' ) {
149 150 $primary = 'button-secondary frm-button-secondary ';
150 151
151 - if ( empty( $label ) ) {
152 + if ( ! $label ) {
152 153 $label = __( 'Get Started', 'formidable' );
153 154 $primary = 'button-primary frm-button-primary ';
154 155 }
155 156
157 + // phpcs:disable Generic.WhiteSpace.ScopeIndent
156 158 if ( $install['installed'] ) {
157 159 ?>
158 - <a rel="<?php echo esc_attr( $install['importer'] ); ?>" class="button frm-activate-addon <?php echo esc_attr( $primary . ( empty( $install['link'] ) ? 'frm_hidden' : '' ) ); ?>">
160 + <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 ?>
159 161 <?php
160 162 if ( $label === 'auto' ) {
161 163 /* translators: %s: Name of the plugin */
162 164 $label = sprintf( __( 'Activate %s', 'formidable' ), $install['name'] );
@@ -162,9 +164,9 @@
162 164 $label = sprintf( __( 'Activate %s', 'formidable' ), $install['name'] );
163 165 }
164 166 } else {
165 167 ?>
166 - <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' ); ?>">
168 + <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 ?>
167 169 <?php
168 170 if ( $label === 'auto' ) {
169 171 /* translators: %s: Name of the plugin */
170 172 $label = sprintf( __( 'Install %s Importer', 'formidable' ), $install['name'] );
@@ -173,8 +175,9 @@
173 175 ?>
174 176 <?php echo esc_html( $label ); ?>
175 177 </a>
176 178 <?php
179 + // phpcs:enable Generic.WhiteSpace.ScopeIndent
177 180 }
178 181
179 182 /**
180 183 * @return void
@@ -182,12 +185,13 @@
182 185 public static function dismiss_migrator() {
183 186 check_ajax_referer( 'frm_ajax', 'nonce' );
184 187 $dismissed = get_option( 'frm_dismissed' );
185 188
186 - if ( empty( $dismissed ) ) {
189 + if ( ! $dismissed ) {
187 190 $dismissed = array();
188 191 }
192 +
189 193 $dismissed[] = FrmAppHelper::get_param( 'plugin', '', 'post', 'sanitize_text_field' );
190 - update_option( 'frm_dismissed', array_filter( $dismissed ), 'no' );
194 + update_option( 'frm_dismissed', array_filter( $dismissed ), false );
191 195 wp_die();
192 196 }
193 197 }