mirror of
https://github.com/claudehohl/Stikked.git
synced 2025-04-26 04:51:08 -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;
|
$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
|
* Key for Cron
|
||||||
*
|
*
|
||||||
@ -47,6 +37,15 @@ $config['bitly_apikey'] = '';
|
|||||||
**/
|
**/
|
||||||
$config['cron_key'] = '';
|
$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
|
* Credentials for the backup URL
|
||||||
*
|
*
|
||||||
|
@ -135,16 +135,15 @@ class Pastes extends CI_Model
|
|||||||
{
|
{
|
||||||
$url = site_url('view/' . $data['pid']);
|
$url = site_url('view/' . $data['pid']);
|
||||||
$url = urlencode($url);
|
$url = urlencode($url);
|
||||||
$bitly_username = $this->config->item('bitly_username');
|
$config_gwgd_url = $this->config->item('gwgd_url');
|
||||||
$bitly_apikey = $this->config->item('bitly_apikey');
|
$gwgd_url = ($config_gwgd_url ? $config_gwgd_url : 'http://gw.gd/');
|
||||||
$target = 'http://api.bitly.com/v3/shorten?login=' . $bitly_username . '&apiKey=' . $bitly_apikey . '&longUrl=' . $url;
|
$target = $gwgd_url . 'api.php?long=' . $url;
|
||||||
$ch = curl_init();
|
$ch = curl_init();
|
||||||
curl_setopt($ch, CURLOPT_URL, $target);
|
curl_setopt($ch, CURLOPT_URL, $target);
|
||||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
||||||
$resp = curl_exec($ch);
|
$resp = curl_exec($ch);
|
||||||
curl_close($ch);
|
curl_close($ch);
|
||||||
$resp = json_decode($resp);
|
$data['snipurl'] = $resp;
|
||||||
$data['snipurl'] = $resp->data->url;
|
|
||||||
|
|
||||||
if (empty($data['snipurl']))
|
if (empty($data['snipurl']))
|
||||||
{
|
{
|
||||||
|
@ -53,7 +53,7 @@
|
|||||||
|
|
||||||
<div class="item_group">
|
<div class="item_group">
|
||||||
<div class="item">
|
<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>
|
<span class="instruction">Create a shorter url that redirects to your paste?</span>
|
||||||
</label>
|
</label>
|
||||||
<div class="text_beside">
|
<div class="text_beside">
|
||||||
|
Loading…
x
Reference in New Issue
Block a user