Plugin Directory

Changeset 682334


Ignore:
Timestamp:
03/15/2013 01:02:47 PM (13 years ago)
Author:
spiffyd
Message:

Commit of Bitly Shortlinks Multisite v1.1

Location:
bitly-shortlinks-multisite/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • bitly-shortlinks-multisite/trunk/bitly-shortlinks-multisite.php

    r682278 r682334  
    22/*
    33Plugin Name: Bit.ly Shortlinks Multisite (OAuth 2 Compatible)
    4 Version: 1.0
    5 Plugin URI:
    6 Description: This plugin replaces the default WordPress shortlinks with Bit.ly shortlinks for your single site or multisite WordPress network. The plugin uses Bit.ly's latest OAuth 2 API for authentication so you must have a generic access token in order for it to work.
     4Version: 1.1
     5Plugin URI: http://wordpress.org/extend/plugins/bitly-shortlinks-multisite/
     6Description: This plugin replaces the default WordPress shortlinks with Bit.ly shortlinks for your single site or multisite WordPress network.
     7Author: Denis Lam
     8License: GPL v3
    79
    8 Author: Denis Lam
    9 Author URI: http://denislam.com/
     10Bit.ly Shortlinks Multisite Plugin
     11Copyright (C) 2013, Denis Lam - d@denislam.com
     12
     13This program is free software: you can redistribute it and/or modify
     14it under the terms of the GNU General Public License as published by
     15the Free Software Foundation, either version 3 of the License, or
     16(at your option) any later version.
     17
     18This program is distributed in the hope that it will be useful,
     19but WITHOUT ANY WARRANTY; without even the implied warranty of
     20MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     21GNU General Public License for more details.
     22
     23You should have received a copy of the GNU General Public License
     24along with this program.  If not, see <http://www.gnu.org/licenses/>.
    1025*/
    1126
     
    3954}
    4055add_filter( 'pre_get_shortlink', 'denis_bitly_shortlink', 99, 4 );
     56
     57// Create the get_bitly global function for developers
     58function get_bitly($url) {
     59        $req = 'https://api-ssl.bitly.com/v3/shorten?access_token='.BITLY_ACCESS_TOKEN.'&longUrl='.$url;
     60        $resp = wpbitly_curl( $req );
     61               
     62        if ( !is_wp_error( $resp ) && is_array( $resp ) && 200 == $resp['status_code'] ) {             
     63            $short = $resp['data']['url'];
     64        }
     65        return $short;
     66}
    4167
    4268/**
  • bitly-shortlinks-multisite/trunk/readme.txt

    r682302 r682334  
    55Requires at least: 3.0
    66Tested up to: 3.5.1
    7 Stable tag: 1.0
     7Stable tag: 1.1
     8License: GPLv3 or later
     9License URI: http://www.gnu.org/licenses/gpl.html
    810
    911This plugin replaces the default WordPress shortlinks with Bit.ly shortlinks for your single site or multisite WordPress network.
     
    2527You can get your generic access token here: [https://bitly.com/a/oauth_apps](https://bitly.com/a/oauth_apps)
    2628
    27 ** Multisite Installation **
     29= Multisite Installation =
    2830Install and set up your access token the same way as a single site installation but make sure you Network Activate the plugin.
     31
     32= How To Call Bitly Shortlinks In Your Templates =
     33I've included the function `get_bitly($url)` to help developers easily shorten URLs in their templates.
     34
     35*Example Usage:*
     36
     37`<?php
     38    $url = 'http://YourLongURL.com';
     39    echo get_bitly($url); // display your shortened URL
     40?>`
    2941
    3042== Changelog ==
    3143
    32 **1.0 (3/3/2013)**
     44= 1.1 =
     45* Added `get_bitly()` function.
    3346
     47= 1.0 =
    3448* Initial release.
    3549
Note: See TracChangeset for help on using the changeset viewer.