Ejemplo n.º 1
0
/**
 *  Fetch data feed from flickr 
 */
function get_flickrs($query)
{
    $flickr_get_favorite_photos = 0;
    $regex = '/\\d+\\@[^\\@]+/';
    $searchById = 0;
    $fetchUrl = 'http://api.flickr.com/services/feeds/photos_public.gne?format=php_serial';
    if (preg_match($regex, $query)) {
        $searchById = 1;
        $fetchUrl .= '&id=' . $query;
    } else {
        $fetchUrl .= '&tags=' . $query;
    }
    $content = dw_file_get_content($fetchUrl);
    $data = unserialize($content);
    $numResult = 0;
    //$aResult = array();
    $items = array();
    if (isset($data['items']) && is_array($data['items']) && count($data['items'])) {
        $items = $data['items'];
    }
    //Favorite Photos
    if ($searchById && $flickr_get_favorite_photos) {
        $fetchUrl2 = 'http://api.flickr.com/services/feeds/photos_faves.gne?format=php_serial&id=' . $query;
        $content2 = dw_file_get_content($fetchUrl2);
        $data2 = unserialize($content2);
        if (isset($data2['items']) && is_array($data2['items']) && count($data2['items'])) {
            foreach ($data2['items'] as $dt) {
                $items[] = $dt;
            }
        }
    }
    if (count($items)) {
        return $items;
    }
    return false;
}
Ejemplo n.º 2
0
 function dw_get_pinterest_count($url)
 {
     $pincount = json_decode(dw_file_get_content('http://api.pinterest.com/v1/urls/count.json?callback=receiveCount&url=' . $url));
     return $pincount->count;
 }
Ejemplo n.º 3
0
    function dw_ajax_facebook_setup()
    {
        global $social_wall_settings;
        if (!isset($_GET['page_id'])) {
            exit(0);
        }
        $social_wall_settings = get_post_meta($_REQUEST['page_id'], 'dw-social-wall-settings', true);
        $social_wall_settings = wp_parse_args($social_wall_settings, array('heading-1' => '', 'heading-2' => '', 'short-intro' => '', 'welcome-box-bg-color' => '#fc615d', 'welcome-box-text-color' => '#fff', 'facebook-name' => '', 'twitter-query' => '', 'twitter-consumer-key' => '', 'twitter-consumer-secret' => '', 'google-plus-name' => '', 'google-plus-url' => '', 'flickr-id' => '', 'instagram-search' => ''));
        if (!$social_wall_settings['facebook-name']) {
            exit(0);
        }
        $facebook = $social_wall_settings['facebook-name'];
        if ($facebook) {
            $result = json_decode(dw_file_get_content('http://graph.facebook.com/' . $facebook));
            $link = isset($result->link) ? $result->link : 'http://facebook.com/' . $result->id;
            $avatar = json_decode(dw_file_get_content('http://graph.facebook.com/' . $facebook . '?fields=picture'));
            $avatar = $avatar->picture->data->url;
            ?>
             <a class="fb-profile-picture" href="<?php 
            echo $link;
            ?>
"><img src="<?php 
            echo $avatar;
            ?>
" alt /></a>
            <p><?php 
            echo $result->name;
            ?>
 on <a href="<?php 
            echo $link;
            ?>
"><span>Facebook</span></a></p>
            <iframe src="//www.facebook.com/plugins/like.php?href=<?php 
            echo urlencode($link);
            ?>
&amp;send=false&amp;layout=button_count&amp;show_faces=true&amp;font&amp;colorscheme=light&amp;action=like" scrolling="no" frameborder="0" style="border:none; overflow:hidden; height: 20px; width: 77px;" allowTransparency="true"></iframe>
        <?php 
        }
        exit(0);
    }
Ejemplo n.º 4
0
 function dw_content_get_vimeo($vimeo_id)
 {
     $vimeo = dw_file_get_content('http://vimeo.com/api/v2/video/' . $vimeo_id . '.json');
     return $vimeo[0]->thumbnail_large;
 }