Download & Extend

Request function to return full shortened URL

Project:Short URL
Version:6.x-1.x-dev
Component:Code
Category:feature request
Priority:normal
Assigned:Unassigned
Status:closed (fixed)

Issue Summary

In followup to #628086: Don't use url() to create 'shorturl' URLs, I request the inclusion for a function that returns a full URL, including http://HOSTNAME/ part.

(shorturl_shorturl($original_url), for instance)

You're going to need such a function anyway, when implementing things like #568190: Introduce Automated Mode for Node Types or #546378: New short URL with bookmarklet or http/REST request. I think it should be the business of shorturl.module to provice the complete URL -- because it is a self contained 'service' that other parts of the code can 'query' for a shortened URL. (Just like you query any other shortURL service and get the shortened URL back, not only the part behind the hostname.)

I gave my arguments about why I think you should not use the url() function for this, in http://drupal.org/node/628086#comment-2249864 . Among others: it is good to use the 'shorturl_domain' variable that is configured on the admin/settings/shorturl page, and that domain does not need to be configured in the rest of Drupal. (I am using it this way at the moment, with a different hostname.)

If you don't agree and still want to use url()... then I ask you, why does the 'shorturl_domain' variable exist? It is not used at the moment :-)

Comments

#1

I agree. ShortURL domain is definitely not necessarily the same as the main domain of a website. For instance, the main domain of a website can be: techcrunch.com, while they would want to shorten URLs with the domain: tcrn.ch.

thx

#2

Tracking, so I know when to switch to using the planned function in the Shorten URLs module.

#3

FYI: I plan to continue what I started, but don't have time yet. Will look through http://drupal.org/project/url_alter sometime, to see if that's got any usefulness (and 'nice path to D7'), and then report back. In 2 weeks maybe.

#4

Status:active» fixed

The function to use for Full URLs (dev release):

<?php
shorturl_shorten
($long_url, TRUE);
?>

#5

Nice. I'll update Shorten URLs when I get a chance.

#6

Status:fixed» closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

#7

Hi,
I use this function in a custom formatters way, but when I use this function:

shorturl_shorten($variables['#items'][0]['url'], TRUE);

1) I got a shorturl [mywebsite]/lql like on comment: http://drupal.org/node/628086
Every node I try the same lql shorturl

2) and url's with variables like /?=code12 are cut off before the variable.

Greetings, Martijn

nobody click here