Link Summarizer Patch
I use Link Summarizer plugin for WordPress, and it work great. Until I found there is no text limitation for displayed URL. So I decide write a small modification to limit the output of displayed URL. This patch will limit displayed URL to 70 characters long (sorry, the magic number is hardcoded :-(). For example:
Before:

After applying patch:

How to apply the patch
You can apply the patch manually or if you have shell access you can do it better (see below). To apply this patch manually, open link-summarizer.php file with your favourite editor. Modify the line 228 (est.) in function link_summary :
$matches[2][$i]
with following code:
lnsum_limit_link_output($matches[2][$i])
Then insert the following function in the bottom file just before ?> mark:
function lnsum_limit_link_output($input) { $link_url_junk = $input; $lnsum_url_limit = 70; $lnsum_url_range = $lnsum_url_limit / 2; if (strlen($link_url_junk) >= $lnsum_url_limit) { $link_url_junk = substr($link_url_junk,0,$lnsum_url_range) ."...". substr($link_url_junk,-$lnsum_url_range,$lnsum_url_range); } return $link_url_junk; }
If you have direct access to your hosting (shell access), you can do it better. After uploading the patch in your wordpress directory (eg. wp-content/plugins/link-summarizer/), just invoke the following command:
patch < limit_url_output.patch
The patch is here: limit_url_output.patch
Update: Link Summarizer 1.5.5 has limit text support
Random Posts:
← Iptables 1.3.5 string match support Installing Gutsy Gibbon on Thinkpad T21 →
on 6 January 2008 14:01:57 WIB
on 7 January 2008 08:01:52 WIB
on 3 October 2008 17:10:18 WIB







4 Comments