mirror of
https://github.com/claudehohl/Stikked.git
synced 2025-04-25 20:41:20 -05:00
gw.gd URL shortener
This commit is contained in:
parent
ebae3ba4fa
commit
77dca63840
@ -28,16 +28,6 @@ $config['db_password'] = 'stikked';
|
||||
*/
|
||||
$config['combine_assets'] = false;
|
||||
|
||||
/**
|
||||
* Bit.ly config
|
||||
*
|
||||
* The username & API-Key for bit.ly
|
||||
* (get one at: http://bitly.com/a/your_api_key)
|
||||
*
|
||||
**/
|
||||
$config['bitly_username'] = '';
|
||||
$config['bitly_apikey'] = '';
|
||||
|
||||
/**
|
||||
* Key for Cron
|
||||
*
|
||||
@ -47,6 +37,15 @@ $config['bitly_apikey'] = '';
|
||||
**/
|
||||
$config['cron_key'] = '';
|
||||
|
||||
/**
|
||||
* gw.gd config
|
||||
*
|
||||
* Your own instance of the gw.gd URL-shortener (Download: https://github.com/neofutur/gwgd)
|
||||
* Default: http://gw.gd/
|
||||
*
|
||||
**/
|
||||
$config['gwgd_url'] = '';
|
||||
|
||||
/**
|
||||
* Credentials for the backup URL
|
||||
*
|
||||
|
@ -135,16 +135,15 @@ class Pastes extends CI_Model
|
||||
{
|
||||
$url = site_url('view/' . $data['pid']);
|
||||
$url = urlencode($url);
|
||||
$bitly_username = $this->config->item('bitly_username');
|
||||
$bitly_apikey = $this->config->item('bitly_apikey');
|
||||
$target = 'http://api.bitly.com/v3/shorten?login=' . $bitly_username . '&apiKey=' . $bitly_apikey . '&longUrl=' . $url;
|
||||
$config_gwgd_url = $this->config->item('gwgd_url');
|
||||
$gwgd_url = ($config_gwgd_url ? $config_gwgd_url : 'http://gw.gd/');
|
||||
$target = $gwgd_url . 'api.php?long=' . $url;
|
||||
$ch = curl_init();
|
||||
curl_setopt($ch, CURLOPT_URL, $target);
|
||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
||||
$resp = curl_exec($ch);
|
||||
curl_close($ch);
|
||||
$resp = json_decode($resp);
|
||||
$data['snipurl'] = $resp->data->url;
|
||||
$data['snipurl'] = $resp;
|
||||
|
||||
if (empty($data['snipurl']))
|
||||
{
|
||||
|
@ -53,7 +53,7 @@
|
||||
|
||||
<div class="item_group">
|
||||
<div class="item">
|
||||
<label for="snipurl">Create a bit.ly url
|
||||
<label for="snipurl">Create Shorturl
|
||||
<span class="instruction">Create a shorter url that redirects to your paste?</span>
|
||||
</label>
|
||||
<div class="text_beside">
|
||||
|
Loading…
x
Reference in New Issue
Block a user