Make WordPress Core

Changeset 11362


Ignore:
Timestamp:
05/16/2009 05:16:45 PM (16 years ago)
Author:
ryan
Message:

Trim long descriptions in plugin installer search results. Props DD32. fixes #9576

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/includes/plugin-install.php

    r11312 r11362  
    325325
    326326                $title = wp_kses($plugin['name'], $plugins_allowedtags);
    327                 $description = wp_kses($plugin['description'], $plugins_allowedtags);
     327                //Limit description to 400char, and remove any HTML.
     328                $description = strip_tags($plugin['description']);
     329                if ( strlen($description) > 400 )
     330                    $description = mb_substr($description, 0, 400) . '…';
     331                //remove any trailing entities
     332                $description = preg_replace('/&[^;\s]{0,6}$/', '', $description);
     333                //strip leading/trailing & multiple consecutive lines
     334                $description = trim($description);
     335                $description = preg_replace("|(\r?\n)+|", "\n", $description);
     336                //\n => <br>
     337                $description = nl2br($description);
    328338                $version = wp_kses($plugin['version'], $plugins_allowedtags);
    329339
Note: See TracChangeset for help on using the changeset viewer.