function widget($args, $instance)
 {
     extract($args, EXTR_SKIP);
     echo $before_widget;
     $flickr_id = empty($instance['flickr_id']) ? ' ' : apply_filters('widget_title', $instance['flickr_id']);
     $title = $instance['title'];
     $items = $instance['items'];
     if (!is_numeric($items)) {
         $items = 9;
     }
     if (empty($title)) {
         $title = 'Photostream';
     }
     if (!empty($items) && !empty($flickr_id)) {
         $photos_arr = get_flickr(array('type' => 'user', 'id' => $flickr_id, 'items' => $items));
         if (!empty($photos_arr)) {
             echo '<h2 class="widgettitle">' . $title . '</h2>';
             echo '<ul class="flickr">';
             foreach ($photos_arr as $photo) {
                 echo '<li>';
                 echo '<a href="' . $photo['url'] . '" title="' . $photo['title'] . '"><img src="' . $photo['thumb_url'] . '" alt="" class="img_nofade" /></a>';
                 echo '</li>';
             }
             echo '</ul><br class="clear"/>';
         }
     }
     echo $after_widget;
 }
function flickr_func($atts, $content)
{
    //extract short code attr
    extract(shortcode_atts(array('items' => 9, 'flickr_id' => ''), $atts));
    $return_html = '';
    if (!empty($flickr_id)) {
        $photos_arr = get_flickr(array('type' => 'user', 'id' => $flickr_id, 'items' => $items));
        $return_html = '<ul class="flickr">';
        foreach ($photos_arr as $photo) {
            $return_html = '<li>';
            $return_html = '<a href="' . $photo['url'] . '" title="' . $photo['title'] . '"><img src="' . $photo['thumb_url'] . '" alt="" class="frame img_nofade" /></a>';
            $return_html = '</li>';
        }
        $return_html = '</ul><br class="clear"/>';
    }
    return $return_html;
}
Exemple #3
0
        $o[$x]['id'] = $i->id;
        $o[$x]['title'] = $i->title;
        $o[$x]['description'] = $i->description;
        $x++;
    }
    return $o;
}
function get_flickr()
{
    $jsonurl = 'http://api.flickr.com/services/rest/?method=flickr.photosets.getList&api_key=636a6afb01db7089334b86e4fb2a5e8d&user_id=38705147%40N00&format=json&nojsoncallback=1&auth_token=72157631215064726-e17fcdb0b95d0bdb&api_sig=4f3477b3c46523370a53792ca924f7d1';
    $json = file_get_contents($jsonurl, 0, null, null);
    $v = json_decode($json);
    $x = 0;
    foreach ($v->photosets->photoset as $i) {
        $o[$x]['id'] = $i->id;
        $o[$x]['title'] = $i->title->_content;
        $o[$x]['description'] = $i->description->_content;
        $x++;
    }
    return $o;
}
$yt = get_youtube(5);
$flickr = get_flickr();
?>
<pre>
<?php 
print_r($yt);
print_r($flickr);
?>
</pre>
 function widget($args, $instance)
 {
     extract($args, EXTR_SKIP);
     echo $before_widget;
     $flickr_id = empty($instance['flickr_id']) ? ' ' : apply_filters('widget_title', $instance['flickr_id']);
     $title = $instance['title'];
     $items = $instance['items'];
     $items = absint($items);
     if (!is_numeric($items)) {
         $items = 9;
     }
     if (empty($title)) {
         $title = 'Flickr Widget';
     }
     if (!empty($items) && !empty($flickr_id)) {
         $photos_arr = get_flickr(array('type' => 'user', 'id' => $flickr_id, 'items' => $items));
         if (!empty($photos_arr)) {
             echo '<h2 class="widgettitle"><span>' . $title . '</span></h2>';
             echo '<ul class="flickr">';
             foreach ($photos_arr as $photo) {
                 echo '<li>';
                 echo '<a target="_blank" href="' . esc_url($photo['link']) . '"><img src="' . esc_url($photo['thumb_url']) . '" alt="' . esc_attr($photo['title']) . '" width="75" height="75" /></a>';
                 echo '</li>';
             }
             echo '</ul><br class="clear"/>';
         }
     }
     echo $after_widget;
 }
Exemple #5
0
function extract_items($site, $content)
{
    switch ($site) {
        case 'flickr':
            //ok
            $items = get_flickr($content);
            break;
        case 'ffffound':
            //ok
            $items = get_ffffound($content);
            break;
        case 'dribbble':
            //ok
            $items = get_dribbble($content);
            break;
        case 'imgur':
            //ok
            $items = get_imgur($content);
            break;
        case 'picplz':
            //ok
            $items = get_picplz($content);
            break;
        case 'instagram':
            //ok
            $items = get_instagram($content);
            break;
        case 'delicious':
            //ok
            $items = get_delicious($content);
            break;
        case 'hn':
            //ok
            $items = get_delicious($content);
            break;
        case 'reddit':
            //ok
            $items = get_delicious($content);
            break;
        case 'pinboard':
            //ok
            $items = get_pinboard($content);
            break;
        case 'digg':
            //ok
            $items = get_digg($content);
            break;
        case 'youtube':
            //ok
            $items = get_youtube($content);
            break;
        case 'hulu':
            //ok
            $items = get_hulu($content);
            break;
        case 'yahoovideos':
            //ok
            $items = get_yahoovideos($content);
            break;
        case 'yahoobuzz':
            //ok
            $items = get_yahoobuzz($content);
            break;
        case 'googletrends':
            //ok
            $items = get_googletrends($content);
            break;
        case 'amazon':
            //ok
            $items = get_amazon($content);
            break;
        case 'itunes':
            //ok
            $items = get_itunes($content);
            break;
        case 'wearehunted':
            //ok
            $items = get_wearehunted($content);
            break;
        case 'twitter':
            //ok
            $items = get_twitter($content);
            break;
        case 'wordpress':
            //ok
            $items = get_delicious($content);
            break;
    }
    return $items;
}
    global $pp_homepage_style;
    ?>
	<?php 
    if (!is_product()) {
        ?>
	<?php 
        //If display photostream
        $pp_photostream = get_option('pp_photostream');
        if (THEMEDEMO && isset($_GET['footer']) && !empty($_GET['footer'])) {
            $pp_photostream = 0;
        }
        if (!empty($pp_photostream)) {
            $photos_arr = array();
            if ($pp_photostream == 'flickr') {
                $pp_flickr_id = get_option('pp_flickr_id');
                $photos_arr = get_flickr(array('type' => 'user', 'id' => $pp_flickr_id, 'items' => 8));
            } else {
                $pp_instagram_username = get_option('pp_instagram_username');
                $pp_instagram_access_token = get_option('pp_instagram_access_token');
                $photos_arr = tg_get_instagram($pp_instagram_username, $pp_instagram_access_token, 8);
            }
            if (!empty($photos_arr) && $screen_class != 'split' && $pp_homepage_style != 'fullscreen' && $pp_homepage_style != 'flow') {
                ?>
<br class="clear"/>
<div class="footer_photostream_wrapper">
	<h2 class="widgettitle"><span>@<?php 
                echo ucfirst($pp_photostream);
                ?>
</span></h2>
	<ul class="footer_photostream">
		<?php