public
Last active

CodeIgniter Demo

  • Download Gist
test.php
PHP
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79
/**
Distributed under the MIT License :
 
Copyright (c) 2009 <http://blankdots.com>
 
Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
files (the "Software"), to deal in the Software without
restriction, including without limitation the rights to use,
copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following
conditions:
 
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
 
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.
 
**/
 
<?php
 
class Test extends Controller {
 
function test()
{
parent::Controller();
}
function index()
{
/*load libraries*/
$this->load->library('flickr');
$this->load->library('twitter');
$this->load->library('vimeo');
$tags = $this->input->post('tags'); /*get tags to display*/
$message = $this->input->post('message'); /*get status for twitter*/
/*configure flickr access and options like image size tags*/
$config = array(
'type' => 'user',
'user' => 'your_user_id',
'num_items' => 10,
'rss_cache_path' => APPPATH.'cache/flickr-rss-cache',
'cache_time' => 3600,
'img_cache_path' => APPPATH.'cache/flickr-image-cache',
'img_cache_url' => $this->config->item('base_url').'application/cache/flickr-image-cache',
'use_cache' => false,
'image_size' => 'thumbnail',
'tags' => $tags
);
$this->flickr->init($config);
/*get photos*/
$data['photos'] = $this->flickr->get_photos();
/*get user videos from vimeo*/
$data['clips'] = $response = $this->vimeo->call('user', array('method' => 'all_clips', 'id' =>'your_user_id'));
/*update twitter status*/
if ($this->twitter->auth('your_username', 'your_password')) {
$this->twitter->update($message);
}
/*the view*/
$this->load->view('index_view', $data);
}
}

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.