mirror of
https://github.com/claudehohl/Stikked.git
synced 2025-04-26 04:51:08 -05:00
creation of bit.ly urls
This commit is contained in:
parent
736f039423
commit
969bd165ee
@ -6,7 +6,7 @@
|
|||||||
* The name of your site
|
* The name of your site
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
$config['site_name'] = "Stikked";
|
$config['site_name'] = 'Stikked';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Combine JS & CSS files
|
* Combine JS & CSS files
|
||||||
@ -16,13 +16,23 @@ $config['site_name'] = "Stikked";
|
|||||||
*/
|
*/
|
||||||
$config['combine_assets'] = false;
|
$config['combine_assets'] = false;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Bit.ly config
|
||||||
|
*
|
||||||
|
* The username & API-Key for bit.ly
|
||||||
|
* (go to: http://bitly.com/a/your_api_key)
|
||||||
|
*
|
||||||
|
**/
|
||||||
|
$config['bitly_username'] = '';
|
||||||
|
$config['bitly_apikey'] = '';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Key for Cron
|
* Key for Cron
|
||||||
*
|
*
|
||||||
* The password required to run the cron job
|
* The password required to run the cron job
|
||||||
*
|
*
|
||||||
**/
|
**/
|
||||||
$config['cron_key'] = "";
|
$config['cron_key'] = '';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Pastes Per Page
|
* Pastes Per Page
|
||||||
@ -41,7 +51,7 @@ $config['per_page'] = 10;
|
|||||||
* NOTE: if changed only pastes from then on will be updated.
|
* NOTE: if changed only pastes from then on will be updated.
|
||||||
*
|
*
|
||||||
**/
|
**/
|
||||||
$config['unknown_poster'] = "random";
|
$config['unknown_poster'] = 'random';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Name for untitled pastes
|
* Name for untitled pastes
|
||||||
@ -50,7 +60,7 @@ $config['unknown_poster'] = "random";
|
|||||||
* DO NOT SET BLANK
|
* DO NOT SET BLANK
|
||||||
* NOTE: if changed only pastes from then on will be updated.
|
* NOTE: if changed only pastes from then on will be updated.
|
||||||
**/
|
**/
|
||||||
$config['unknown_title'] = "Untitled";
|
$config['unknown_title'] = 'Untitled';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
@ -9,7 +9,6 @@
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#TODO
|
|
||||||
include_once('geshi/geshi.php');
|
include_once('geshi/geshi.php');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -39,7 +38,7 @@ Class Process {
|
|||||||
$source = $source;
|
$source = $source;
|
||||||
$language = $lang;
|
$language = $lang;
|
||||||
|
|
||||||
$geshi =& new Geshi($source, $lang);
|
$geshi = new Geshi($source, $lang);
|
||||||
$geshi->enable_line_numbers(GESHI_NORMAL_LINE_NUMBERS);
|
$geshi->enable_line_numbers(GESHI_NORMAL_LINE_NUMBERS);
|
||||||
$geshi->set_header_type(GESHI_HEADER_DIV);
|
$geshi->set_header_type(GESHI_HEADER_DIV);
|
||||||
|
|
||||||
|
@ -130,12 +130,18 @@ class Pastes extends CI_Model
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$target = 'http://snipr.com/site/snip?r=simple&link=' . site_url('view/' . $data['pid']);
|
$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;
|
||||||
$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);
|
||||||
$data['snipurl'] = curl_exec($ch);
|
$resp = curl_exec($ch);
|
||||||
curl_close($ch);
|
curl_close($ch);
|
||||||
|
$resp = json_decode($resp);
|
||||||
|
$data['snipurl'] = $resp->data->url;
|
||||||
|
|
||||||
if (empty($data['snipurl']))
|
if (empty($data['snipurl']))
|
||||||
{
|
{
|
||||||
|
@ -52,14 +52,14 @@
|
|||||||
|
|
||||||
<div class="item_group">
|
<div class="item_group">
|
||||||
<div class="item">
|
<div class="item">
|
||||||
<label for="snipurl">Create a snipurl
|
<label for="snipurl">Create a bit.ly url
|
||||||
<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">
|
||||||
<?php
|
<?php
|
||||||
$set = array('name' => 'snipurl', 'id' => 'snipurl', 'value' => '1', 'tabindex' => '5', 'checked' => $snipurl_set);
|
$set = array('name' => 'snipurl', 'id' => 'snipurl', 'value' => '1', 'tabindex' => '5', 'checked' => $snipurl_set);
|
||||||
echo form_checkbox($set);
|
echo form_checkbox($set);
|
||||||
?><p>Create a snipurl</p>
|
?><p>Create a bit.ly url</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user