| @@ -25,10 +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 | + * @param object $screen WP Screen object. | |
| 30 | + * | |
| 29 | 31 | * @since 4.12 |
| 30 | - * @param object $screen WP Screen object. | |
| 31 | 32 | * |
| 32 | 33 | * @return void |
| 33 | 34 | */ |
| 34 | 35 | public function start( $screen ) { |
| @@ -56,13 +57,8 @@ | ||
| 56 | 57 | if ( empty( $args->search ) ) { |
| 57 | 58 | return $result; |
| 58 | 59 | } |
| 59 | 60 | |
| 60 | - if ( is_wp_error( $result ) ) { | |
| 61 | - // This may happen if the request failed due to an internet connection issue. | |
| 62 | - return $result; | |
| 63 | - } | |
| 64 | - | |
| 65 | 61 | $addon_list = $this->get_addons(); |
| 66 | 62 | |
| 67 | 63 | // Lowercase, trim, remove punctuation/special chars, decode url, remove 'formidable'. |
| 68 | 64 | $normalized_term = $this->search_to_array( $args->search ); |
| @@ -80,17 +76,17 @@ | ||
| 80 | 76 | $inject = (array) $this->get_plugin_data(); |
| 81 | 77 | $overrides = array( |
| 82 | 78 | // Helps to determine if that an injected card. |
| 83 | 79 | 'plugin-search' => true, |
| 84 | - 'name' => sprintf( | |
| 80 | + 'name' => sprintf( | |
| 85 | 81 | /* translators: Formidable addon name */ |
| 86 | 82 | esc_html_x( 'Formidable %s', 'Formidable Addon Name', 'formidable' ), |
| 87 | 83 | $addon_list[ $matching_addon ]['name'] |
| 88 | 84 | ), |
| 89 | - 'addon' => $addon_list[ $matching_addon ]['slug'], | |
| 90 | - 'short_description' => $addon_list[ $matching_addon ]['excerpt'], | |
| 91 | - 'slug' => self::$slug, | |
| 92 | - 'version' => $addon_list[ $matching_addon ]['version'], | |
| 85 | + 'addon' => $addon_list[ $matching_addon ]['slug'], | |
| 86 | + 'short_description' => $addon_list[ $matching_addon ]['excerpt'], | |
| 87 | + 'slug' => self::$slug, | |
| 88 | + 'version' => $addon_list[ $matching_addon ]['version'], | |
| 93 | 89 | ); |
| 94 | 90 | |
| 95 | 91 | if ( ! empty( $addon_list[ $matching_addon ]['external'] ) ) { |
| 96 | 92 | unset( $overrides['name'] ); |
| @@ -186,10 +182,11 @@ | ||
| 186 | 182 | |
| 187 | 183 | /** |
| 188 | 184 | * Modify URL used to fetch to plugin information so it pulls Formidable plugin page. |
| 189 | 185 | * |
| 186 | + * @param string $url URL to load in dialog pulling the plugin page from wporg. | |
| 187 | + * | |
| 190 | 188 | * @since 4.12 |
| 191 | - * @param string $url URL to load in dialog pulling the plugin page from wporg. | |
| 192 | 189 | * |
| 193 | 190 | * @return string The URL with 'formidable' instead of 'frm-plugin-search'. |
| 194 | 191 | */ |
| 195 | 192 | public function plugin_details( $url ) { |
| @@ -303,9 +300,9 @@ | ||
| 303 | 300 | |
| 304 | 301 | // By the time this filter is applied, self_admin_url was already applied and we don't need it anymore. |
| 305 | 302 | remove_filter( 'self_admin_url', array( $this, 'plugin_details' ) ); |
| 306 | 303 | |
| 307 | - $links = array(); | |
| 304 | + $links = array(); | |
| 308 | 305 | $is_installed = $this->is_installed( $plugin['plugin'] ); |
| 309 | 306 | $is_active = is_plugin_active( $plugin['plugin'] ); |
| 310 | 307 | |
| 311 | 308 | // Plugin installed, active, feature not enabled; prompt to enable. |
| @@ -310,11 +307,11 @@ | ||
| 310 | 307 | |
| 311 | 308 | // Plugin installed, active, feature not enabled; prompt to enable. |
| 312 | 309 | if ( ! $is_active && $is_installed ) { |
| 313 | 310 | if ( current_user_can( 'activate_plugins' ) ) { |
| 314 | - $activate_url = add_query_arg( | |
| 311 | + $activate_url = add_query_arg( | |
| 315 | 312 | array( |
| 316 | - 'action' => 'activate', | |
| 313 | + 'action' => 'activate', | |
| 317 | 314 | '_wpnonce' => wp_create_nonce( 'activate-plugin_' . $plugin['plugin'] ), |
| 318 | 315 | 'plugin' => $plugin['plugin'], |
| 319 | 316 | ), |
| 320 | 317 | admin_url( 'plugins.php' ) |