Changeset 682334
- Timestamp:
- 03/15/2013 01:02:47 PM (13 years ago)
- Location:
- bitly-shortlinks-multisite/trunk
- Files:
-
- 2 edited
-
bitly-shortlinks-multisite.php (modified) (2 diffs)
-
readme.txt (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
bitly-shortlinks-multisite/trunk/bitly-shortlinks-multisite.php
r682278 r682334 2 2 /* 3 3 Plugin 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. 4 Version: 1.1 5 Plugin URI: http://wordpress.org/extend/plugins/bitly-shortlinks-multisite/ 6 Description: This plugin replaces the default WordPress shortlinks with Bit.ly shortlinks for your single site or multisite WordPress network. 7 Author: Denis Lam 8 License: GPL v3 7 9 8 Author: Denis Lam 9 Author URI: http://denislam.com/ 10 Bit.ly Shortlinks Multisite Plugin 11 Copyright (C) 2013, Denis Lam - d@denislam.com 12 13 This program is free software: you can redistribute it and/or modify 14 it under the terms of the GNU General Public License as published by 15 the Free Software Foundation, either version 3 of the License, or 16 (at your option) any later version. 17 18 This program is distributed in the hope that it will be useful, 19 but WITHOUT ANY WARRANTY; without even the implied warranty of 20 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 21 GNU General Public License for more details. 22 23 You should have received a copy of the GNU General Public License 24 along with this program. If not, see <http://www.gnu.org/licenses/>. 10 25 */ 11 26 … … 39 54 } 40 55 add_filter( 'pre_get_shortlink', 'denis_bitly_shortlink', 99, 4 ); 56 57 // Create the get_bitly global function for developers 58 function 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 } 41 67 42 68 /** -
bitly-shortlinks-multisite/trunk/readme.txt
r682302 r682334 5 5 Requires at least: 3.0 6 6 Tested up to: 3.5.1 7 Stable tag: 1.0 7 Stable tag: 1.1 8 License: GPLv3 or later 9 License URI: http://www.gnu.org/licenses/gpl.html 8 10 9 11 This plugin replaces the default WordPress shortlinks with Bit.ly shortlinks for your single site or multisite WordPress network. … … 25 27 You can get your generic access token here: [https://bitly.com/a/oauth_apps](https://bitly.com/a/oauth_apps) 26 28 27 ** Multisite Installation ** 29 = Multisite Installation = 28 30 Install 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 = 33 I'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 ?>` 29 41 30 42 == Changelog == 31 43 32 **1.0 (3/3/2013)** 44 = 1.1 = 45 * Added `get_bitly()` function. 33 46 47 = 1.0 = 34 48 * Initial release. 35 49
Note: See TracChangeset
for help on using the changeset viewer.