| @@ -25,12 +25,11 @@ | ||
| 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 | + * @since 4.12 | |
| 29 | 30 | * @param object $screen WP Screen object. |
| 30 | 31 | * |
| 31 | - * @since 4.12 | |
| 32 | - * | |
| 33 | 32 | * @return void |
| 34 | 33 | */ |
| 35 | 34 | public function start( $screen ) { |
| 36 | 35 | // phpcs:ignore WordPress.Security.NonceVerification.Recommended |
| @@ -74,18 +73,19 @@ | ||
| 74 | 73 | } |
| 75 | 74 | |
| 76 | 75 | $inject = (array) $this->get_plugin_data(); |
| 77 | 76 | $overrides = array( |
| 78 | - 'plugin-search' => true, // Helps to determine if that an injected card. | |
| 79 | - 'name' => sprintf( | |
| 77 | + // Helps to determine if that an injected card. | |
| 78 | + 'plugin-search' => true, | |
| 79 | + 'name' => sprintf( | |
| 80 | 80 | /* translators: Formidable addon name */ |
| 81 | 81 | esc_html_x( 'Formidable %s', 'Formidable Addon Name', 'formidable' ), |
| 82 | 82 | $addon_list[ $matching_addon ]['name'] |
| 83 | 83 | ), |
| 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'], | |
| 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'], | |
| 88 | 88 | ); |
| 89 | 89 | |
| 90 | 90 | if ( ! empty( $addon_list[ $matching_addon ]['external'] ) ) { |
| 91 | 91 | unset( $overrides['name'] ); |
| @@ -124,11 +124,11 @@ | ||
| 124 | 124 | } |
| 125 | 125 | |
| 126 | 126 | $addon_terms = $this->search_to_array( $addon_opts['search_terms'] . ' ' . $addon_opts['name'] ); |
| 127 | 127 | |
| 128 | - $matches = ! empty( array_intersect( $addon_terms, $normalized_term ) ); | |
| 128 | + $matched_terms = array_intersect( $addon_terms, $normalized_term ); | |
| 129 | 129 | |
| 130 | - if ( $matches ) { | |
| 130 | + if ( count( $matched_terms ) === count( $normalized_term ) ) { | |
| 131 | 131 | $matching_addon = $addon_id; |
| 132 | 132 | break; |
| 133 | 133 | } |
| 134 | 134 | } |
| @@ -181,12 +181,11 @@ | ||
| 181 | 181 | |
| 182 | 182 | /** |
| 183 | 183 | * Modify URL used to fetch to plugin information so it pulls Formidable plugin page. |
| 184 | 184 | * |
| 185 | + * @since 4.12 | |
| 185 | 186 | * @param string $url URL to load in dialog pulling the plugin page from wporg. |
| 186 | 187 | * |
| 187 | - * @since 4.12 | |
| 188 | - * | |
| 189 | 188 | * @return string The URL with 'formidable' instead of 'frm-plugin-search'. |
| 190 | 189 | */ |
| 191 | 190 | public function plugin_details( $url ) { |
| 192 | 191 | return false !== stripos( $url, 'tab=plugin-information&plugin=' . self::$slug ) |
| @@ -299,9 +298,9 @@ | ||
| 299 | 298 | |
| 300 | 299 | // By the time this filter is applied, self_admin_url was already applied and we don't need it anymore. |
| 301 | 300 | remove_filter( 'self_admin_url', array( $this, 'plugin_details' ) ); |
| 302 | 301 | |
| 303 | - $links = array(); | |
| 302 | + $links = array(); | |
| 304 | 303 | $is_installed = $this->is_installed( $plugin['plugin'] ); |
| 305 | 304 | $is_active = is_plugin_active( $plugin['plugin'] ); |
| 306 | 305 | |
| 307 | 306 | // Plugin installed, active, feature not enabled; prompt to enable. |
| @@ -306,11 +305,11 @@ | ||
| 306 | 305 | |
| 307 | 306 | // Plugin installed, active, feature not enabled; prompt to enable. |
| 308 | 307 | if ( ! $is_active && $is_installed ) { |
| 309 | 308 | if ( current_user_can( 'activate_plugins' ) ) { |
| 310 | - $activate_url = add_query_arg( | |
| 309 | + $activate_url = add_query_arg( | |
| 311 | 310 | array( |
| 312 | - 'action' => 'activate', | |
| 311 | + 'action' => 'activate', | |
| 313 | 312 | '_wpnonce' => wp_create_nonce( 'activate-plugin_' . $plugin['plugin'] ), |
| 314 | 313 | 'plugin' => $plugin['plugin'], |
| 315 | 314 | ), |
| 316 | 315 | admin_url( 'plugins.php' ) |
| @@ -331,9 +330,9 @@ | ||
| 331 | 330 | href="' . esc_url( FrmAppHelper::admin_upgrade_link( 'plugin-learn-more', $plugin['link'] ) ) . '" |
| 332 | 331 | target="_blank" |
| 333 | 332 | data-addon="' . esc_attr( $plugin['addon'] ) . '" |
| 334 | 333 | >' . esc_html__( 'Learn more', 'formidable' ) . '</a>'; |
| 335 | - } | |
| 334 | + }//end if | |
| 336 | 335 | |
| 337 | 336 | // Dismiss link. |
| 338 | 337 | $dismiss = add_query_arg( array( 'frm-dismiss' => $plugin['id'] ) ); |
| 339 | 338 | $links[] = '<a |