vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 4.x Add-ons (https://vborg.vbsupport.ru/forumdisplay.php?f=245)
-   -   Miscellaneous Hacks - Shorten Bottom [Bit.ly] (https://vborg.vbsupport.ru/showthread.php?t=256493)

LOGECT 01-03-2011 10:00 PM

Shorten Bottom [Bit.ly]
 
1 Attachment(s)
Info :

A simple way to add a shorten bottom for your vBulletin ( bitly shorten url service )


Note:
Of course, you can use this code to any custom template or page ( like Blogs, Cms, Forums and etc )

Screenshots:

https://vborg.vbsupport.ru/attachmen...1&d=1294168217

https://vborg.vbsupport.ru/attachmen...1&d=1294168222

https://vborg.vbsupport.ru/attachmen...1&d=1294174499


Installation:

1- Go to : Admincp>Phrase Manager>Add New Phrase:

Product = vBulletin
Phrase Type = GLOBAL
Varname: vbshorten
Text: Shorten
Save.


2- In the SHOWTHREAD template, Find:
Code:

<h1>
And below that, add this code:

Code:

<a href="javascript:(function(){%20window.open('http://bit.ly/?url='+encodeURIComponent(location.href));%20})();" rel="nofollow"  class="pagetitleinfo textcontrol" >{vb:rawphrase vbshorten}</a>
This is just an example for threads.
and this code works with any version of vBulletin.


All the best.

Brandon Sheley 01-04-2011 06:35 PM

wouldn't you want to place this outside the header tags?
maybe after the </h1> tag
I wouldn't want a bit.ly link in all my h1 tags

nice idea

LOGECT 01-05-2011 09:13 AM

Quote:

Originally Posted by Brandon Sheley (Post 2144059)
wouldn't you want to place this outside the header tags?
maybe after the </h1> tag
I wouldn't want a bit.ly link in all my h1 tags

nice idea

Use this code for any place that you want, that was just an example for threads.

Dr.osamA 01-06-2011 12:21 AM

1 Attachment(s)
Excellent = 5 stars
installed

Note:
I think the reference to missing when adding a new phrase you should choose
Phrase Type = GLOBAL
Product = vBulletin

I chose to add the code to another place after you make changes to code
Become so as it is in the attached photo

my code is:

PHP Code:

<a href="javascript:(function(){%20window.open('http://bit.ly/?url='+encodeURIComponent(location.href));%20})();" rel="nofollow" class="newcontent_textcontrol">{vb:rawphrase vbshorten}</a

and i add it in SHOWTHREAD template .. if you need to do same
find
PHP Code:

    <div id="above_postlist" class="above_postlist">
        <
vb:if condition="$show['largereplybutton']">
            <
a href="newreply.php?{vb:raw session.sessionurl}p={vb:raw LASTPOSTID}&amp;noquote=1" 
class="newcontent_textcontrol" id="newreplylink_top"><vb:if condition="$show['closethread']"><span>+</span> {vb:rawphrase reply_to_thread}<vb:else />{vb:rawphrase closed_thread}</vb:if></a

then add code below that

LOGECT 01-06-2011 04:29 PM

Quote:

Originally Posted by Dr.osamA (Post 2144676)
Excellent = 5 stars
installed

Note:
I think the reference to missing when adding a new phrase you should choose
Phrase Type = GLOBAL
Product = vBulletin

Thanks Dr.osamA, first post updated.

Dr.osamA 01-07-2011 01:02 AM

you are welcome bro

thank you for update

Kingdombuilder 02-28-2011 06:27 AM

This is an awesome mod thank you for your contribution. I have my own url shortener and i would like to use it instead of bit.ly. The shortener is http://www.bfx.me

I tried substituting the URL of bit.ly with bfx.me - it comes up but the url does not automatically go into the field provided. Can anyone help me to get this to work?


Edit:

Well i got it to work a little bit. I found this on the http://bfx.me site:

Code:

Shortening a URL with the bfx.me API is very simple, all you need to do is send a get request to the API passing through the URL you wish to shorten.

To shorten http://www.neowin.net/news/windows-7-piracy-check-update-goes-live request:

http://bfx.me/api.php?u=http://www.neowin.net/news/windows-7-piracy-check-update-goes-live

The API will return the shortened URL http://bfx.me/jZ2qi


To retrieve the original URL from the API, all you need to do is send a get request to the API passing through the shortened URL (or the last 5 characters).

To expand http://bfx.me/jZ2qi request:

http://bfx.me/api.php?r=http://bfx.me/jZ2qi
or http://bfx.me/api.php?r=jZ2qi

The API will return the original URL http://www.neowin.net/news/windows-7-piracy-check-update-goes-live



So I use this:
Code:

http://bfx.me/api.php?u

Instead of this:
Code:

http://bit.ly/?url
It will return the shortened url but will not function the site properly. What I mean by that is if you go to the bfx.me and shorten a url it eill return the shortened url and a barcode as well and will also alow you to tweet the url. From what I did it just comes up as a white screen with the shortened url in the upper left corner. The shortened url is right but I would like it to return to the bfx.me page where it will display the bardcode and the tweet option.

Any help would be appreciated...

BlueCheri 02-28-2011 06:58 AM

This can be very useful, tagged.

indie2industry 02-25-2013 11:16 PM

Can this be used for o-url.com ?

datoneer 02-26-2013 01:35 AM

Thanks. Installed and it works fine

xbrian88 03-14-2013 01:40 AM

<a href="https://goo.gl/" target="_blank">http://goo.gl/</a> is possible use???

xbrian88 03-20-2013 04:48 PM

uppppppppppp

LOGECT 03-22-2013 11:54 AM

Quote:

Originally Posted by xbrian88 (Post 2409851)
http://goo.gl/ is possible use???

Try this:

Code:

<script type="text/javascript">
function makeShort()
{
  var longUrl=document.getElementById("longurl").value;
    var request = gapi.client.urlshortener.url.insert({
      'resource': {
      'longUrl': longUrl
    }
    });
    request.execute(function(response)
    {
 
        if(response.id != null)
        {
            str ="<b>Long URL:</b>"+longUrl+"<br>";
            str +="<b>Short URL:</b> <a href='"+response.id+"'>"+response.id+"</a><br>";
            document.getElementById("output").innerHTML = str;
        }
        else
        {
            alert("error: creating short url \n"+ response.error);
        }
 
    });
 }
 
function getShortInfo()
{
var shortUrl=document.getElementById("shorturl").value;
 
    var request = gapi.client.urlshortener.url.get({
      'shortUrl': shortUrl,
    'projection':'FULL'
    });
    request.execute(function(response)
    {
 
        if(response.longUrl!= null)
        {
            str ="<b>Long URL:</b>"+response.longUrl+"<br>";
            str +="<b>Create On:</b>"+response.created+"<br>";
            str +="<b>Short URL Clicks:</b>"+response.analytics.allTime.shortUrlClicks+"<br>";
            str +="<b>Long URL Clicks:</b>"+response.analytics.allTime.longUrlClicks+"<br>";
 
            document.getElementById("output").innerHTML = str;
        }
        else
        {
            alert("error: "+response.error);
        }
 
    });
 
}
function load()
{
    //Get your own Browser API Key from  https://code.google.com/apis/console/
    gapi.client.setApiKey('XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX');
    gapi.client.load('urlshortener', 'v1',function(){document.getElementById("output").innerHTML="";});
 
}
window.onload = load;
 
</script>
<script src="https://apis.google.com/js/client.js"></script>
 
 
URL: <input type="text" id="longurl" name="url" value="{vb:raw thread_url}" /> <br/>
<input type="button" value="{vb:rawphrase vbshorten}" onclick="makeShort();" />



All times are GMT. The time now is 06:53 PM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01123 seconds
  • Memory Usage 1,766KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (6)bbcode_code_printable
  • (2)bbcode_php_printable
  • (3)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (13)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete