Development

#3388 ([PATCH] auto_link_text() should give option to truncate urls)

You must first sign up to be able to contribute.

Ticket #3388 (closed enhancement: fixed)

Opened 7 months ago

Last modified 5 months ago

[PATCH] auto_link_text() should give option to truncate urls

Reported by: Whosrodney Assigned to: Whosrodney
Priority: minor Milestone: 1.1.0
Component: helpers Version: 1.1.0 DEV
Keywords: Cc:
Qualification: Ready for core team

Description

It would be nice if auto_link_text() had an option to truncate the text portion of a url after a center number of characters (i.e. http://www.google.com/search?q=symfony+rocks&sourceid=navclient-ff&ie=UTF-8&rlz=1B3GGGL_enUS263US263 would become http://www.google.com/search...).

Attachments

auto_link_urls.patch (2.5 kB) - added by Whosrodney on 04/23/08 21:30:05.
TextHelperTest.patch (4.3 kB) - added by Whosrodney on 04/23/08 22:14:32.

Change History

04/23/08 04:14:23 changed by Carl.Vondrick

Will truncate_text() not do the trick?

04/23/08 08:48:04 changed by FabianLange

no it won't. Perhaps a simple shortening could go into the auto_link_text. But I wonder what functionality this helper should deliver. I have created a auto linker for my project and its now very heavy. about 500 lines.

it shortens links "sensible" (params first leave file but remove then subfolders) It can detect links to our own site and obtain a useful textual description. It removes the server part for urls to our own server, so that users using IP due to firewalling can click links others posted with full dns) It can automatically add partner programs to certain urls it can strip of known unnecessary informations (e.g. that sourceid in google urls)

and i am working on obtaining the page title from remote urls (e.g. when someone posts a youtube link)

Overall pretty heavy and I wonder how the defined scope of a "standard" helper should be.

PS: I can share most of the code if desired.

04/23/08 08:48:39 changed by FabianLange

  • version changed from 1.0.13 to 1.1.0 DEV.

as this is a new feature request i put it to 1.1

04/23/08 21:30:05 changed by Whosrodney

  • attachment auto_link_urls.patch added.

04/23/08 21:31:14 changed by Whosrodney

  • owner changed from fabien to Whosrodney.
  • status changed from new to assigned.
  • version changed from 1.1.0 DEV to 1.0.13.
  • summary changed from auto_link_text() should give option to truncate urls to [PATCH] auto_link_text() should give option to truncate urls.

The patch I'm attaching is against the 1.0.13 TextHelper?.php (I don't have 1.1 on my system yet). As this is my first time submitting a patch, I'm sure I did not do it properly. Please (kindly) inform me of what I need to do to submit this patch properly (I did take a look at the Bug Submission Guidelines page).

04/23/08 21:34:49 changed by Carl.Vondrick

  • version changed from 1.0.13 to 1.1.0 DEV.
  • qualification changed from Unreviewed to Ready for core team.

Patch itself looks pretty good. But, as this is a feature, it must go into 1.1.

04/23/08 22:14:17 changed by Whosrodney

Added patch for TextHelperTest? to test for truncation functionality. The patch also cleans up auto_linking() to auto_link_text().

04/23/08 22:14:32 changed by Whosrodney

  • attachment TextHelperTest.patch added.

06/23/08 03:29:25 changed by dwhittle

  • status changed from assigned to closed.
  • resolution set to fixed.

(In [9757]) 1.1: added truncate options to auto_link_text text helper (closes #3388)

06/23/08 08:48:37 changed by fabien

  • milestone set to 1.1.0 FINAL.

06/29/08 23:36:24 changed by FabianLange

  • milestone changed from 1.1.0 FINAL to 1.1.0.