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/models/FrmPluginSearch.php +16 -27 6.266.2 View file →
@@ -25,12 +25,12 @@
25 25
26 26 /**
27 27 * Add actions and filters only if this is the plugin installation screen and it's the first page.
28 28 *
29 + * @param object $screen WP Screen object.
30 + *
29 31 * @since 4.12
30 32 *
31 - * @param object $screen WP Screen object.
32 - *
33 33 * @return void
34 34 */
35 35 public function start( $screen ) {
36 36 // phpcs:ignore WordPress.Security.NonceVerification.Recommended
@@ -57,18 +57,12 @@
57 57 if ( empty( $args->search ) ) {
58 58 return $result;
59 59 }
60 60
61 - if ( is_wp_error( $result ) ) {
62 - // This may happen if the request failed due to an internet connection issue.
63 - return $result;
64 - }
65 -
66 61 $addon_list = $this->get_addons();
67 62
68 63 // Lowercase, trim, remove punctuation/special chars, decode url, remove 'formidable'.
69 64 $normalized_term = $this->search_to_array( $args->search );
70 -
71 65 if ( empty( $normalized_term ) ) {
72 66 // Don't add anything extra.
73 67 return $result;
74 68 }
@@ -80,19 +74,18 @@
80 74 }
81 75
82 76 $inject = (array) $this->get_plugin_data();
83 77 $overrides = array(
84 - // Helps to determine if that an injected card.
85 - 'plugin-search' => true,
86 - 'name' => sprintf(
78 + 'plugin-search' => true, // Helps to determine if that an injected card.
79 + 'name' => sprintf(
87 80 /* translators: Formidable addon name */
88 81 esc_html_x( 'Formidable %s', 'Formidable Addon Name', 'formidable' ),
89 82 $addon_list[ $matching_addon ]['name']
90 83 ),
91 - 'addon' => $addon_list[ $matching_addon ]['slug'],
92 - 'short_description' => $addon_list[ $matching_addon ]['excerpt'],
93 - 'slug' => self::$slug,
94 - 'version' => $addon_list[ $matching_addon ]['version'],
84 + 'addon' => $addon_list[ $matching_addon ]['slug'],
85 + 'short_description' => $addon_list[ $matching_addon ]['excerpt'],
86 + 'slug' => self::$slug,
87 + 'version' => $addon_list[ $matching_addon ]['version'],
95 88 );
96 89
97 90 if ( ! empty( $addon_list[ $matching_addon ]['external'] ) ) {
98 91 unset( $overrides['name'] );
@@ -131,11 +124,11 @@
131 124 }
132 125
133 126 $addon_terms = $this->search_to_array( $addon_opts['search_terms'] . ' ' . $addon_opts['name'] );
134 127
135 - $matched_terms = array_intersect( $addon_terms, $normalized_term );
128 + $matches = ! empty( array_intersect( $addon_terms, $normalized_term ) );
136 129
137 - if ( count( $matched_terms ) === count( $normalized_term ) ) {
130 + if ( $matches ) {
138 131 $matching_addon = $addon_id;
139 132 break;
140 133 }
141 134 }
@@ -188,12 +181,12 @@
188 181
189 182 /**
190 183 * Modify URL used to fetch to plugin information so it pulls Formidable plugin page.
191 184 *
185 + * @param string $url URL to load in dialog pulling the plugin page from wporg.
186 + *
192 187 * @since 4.12
193 188 *
194 - * @param string $url URL to load in dialog pulling the plugin page from wporg.
195 - *
196 189 * @return string The URL with 'formidable' instead of 'frm-plugin-search'.
197 190 */
198 191 public function plugin_details( $url ) {
199 192 return false !== stripos( $url, 'tab=plugin-information&plugin=' . self::$slug )
@@ -207,9 +200,8 @@
207 200 * @return void
208 201 */
209 202 private function maybe_dismiss() {
210 203 $addon = FrmAppHelper::get_param( 'frm-dismiss', '', 'get', 'absint' );
211 -
212 204 if ( ! empty( $addon ) ) {
213 205 $this->add_to_dismissed_hints( $addon );
214 206 }
215 207 }
@@ -266,9 +258,8 @@
266 258 * Take a raw search query and return something a bit more standardized and
267 259 * easy to work with.
268 260 *
269 261 * @param string $term The raw search term.
270 - *
271 262 * @return string A simplified/sanitized version.
272 263 */
273 264 private function sanitize_search_term( $term ) {
274 265 $term = strtolower( urldecode( $term ) );
@@ -285,9 +276,8 @@
285 276 /**
286 277 * @since 4.12
287 278 *
288 279 * @param string $terms
289 - *
290 280 * @return array
291 281 */
292 282 private function search_to_array( $terms ) {
293 283 $terms = $this->sanitize_search_term( $terms );
@@ -309,9 +299,9 @@
309 299
310 300 // By the time this filter is applied, self_admin_url was already applied and we don't need it anymore.
311 301 remove_filter( 'self_admin_url', array( $this, 'plugin_details' ) );
312 302
313 - $links = array();
303 + $links = array();
314 304 $is_installed = $this->is_installed( $plugin['plugin'] );
315 305 $is_active = is_plugin_active( $plugin['plugin'] );
316 306
317 307 // Plugin installed, active, feature not enabled; prompt to enable.
@@ -316,11 +306,11 @@
316 306
317 307 // Plugin installed, active, feature not enabled; prompt to enable.
318 308 if ( ! $is_active && $is_installed ) {
319 309 if ( current_user_can( 'activate_plugins' ) ) {
320 - $activate_url = add_query_arg(
310 + $activate_url = add_query_arg(
321 311 array(
322 - 'action' => 'activate',
312 + 'action' => 'activate',
323 313 '_wpnonce' => wp_create_nonce( 'activate-plugin_' . $plugin['plugin'] ),
324 314 'plugin' => $plugin['plugin'],
325 315 ),
326 316 admin_url( 'plugins.php' )
@@ -341,9 +331,9 @@
341 331 href="' . esc_url( FrmAppHelper::admin_upgrade_link( 'plugin-learn-more', $plugin['link'] ) ) . '"
342 332 target="_blank"
343 333 data-addon="' . esc_attr( $plugin['addon'] ) . '"
344 334 >' . esc_html__( 'Learn more', 'formidable' ) . '</a>';
345 - }//end if
335 + }
346 336
347 337 // Dismiss link.
348 338 $dismiss = add_query_arg( array( 'frm-dismiss' => $plugin['id'] ) );
349 339 $links[] = '<a
@@ -356,9 +346,8 @@
356 346 }
357 347
358 348 /**
359 349 * @param string $plugin
360 - *
361 350 * @return bool
362 351 */
363 352 protected function is_installed( $plugin ) {
364 353 $all_plugins = FrmAppHelper::get_plugins();