function ws_images_addFlickr($photo, &$service)
{
    if (!is_admin()) {
        return new PwgError(403, 'Forbidden');
    }
    global $conf;
    if (empty($conf['flickr2piwigo']['api_key']) or empty($conf['flickr2piwigo']['secret_key'])) {
        return new PwgError(null, l10n('Please fill your API keys on the configuration tab'));
    }
    include_once PHPWG_ROOT_PATH . 'admin/include/functions.php';
    include_once PHPWG_ROOT_PATH . 'admin/include/functions_upload.inc.php';
    include_once FLICKR_PATH . 'include/functions.inc.php';
    if (test_remote_download() === false) {
        return new PwgError(null, l10n('No download method available'));
    }
    // init flickr API
    include_once FLICKR_PATH . 'include/phpFlickr/phpFlickr.php';
    $flickr = new phpFlickr($conf['flickr2piwigo']['api_key'], $conf['flickr2piwigo']['secret_key']);
    $flickr->enableCache('fs', FLICKR_FS_CACHE);
    // user
    $u = $flickr->test_login();
    if ($u === false or empty($_SESSION['phpFlickr_auth_token'])) {
        return new PwgError(403, l10n('API not authenticated'));
    }
    // photos infos
    $photo_f = $flickr->photos_getInfo($photo['id']);
    $photo = array_merge($photo, $photo_f['photo']);
    $photo['url'] = $flickr->get_biggest_size($photo['id'], 'original');
    $photo['path'] = FLICKR_FS_CACHE . 'flickr-' . $u['username'] . '-' . $photo['id'] . '.' . get_extension($photo['url']);
    // copy file
    if (download_remote_file($photo['url'], $photo['path']) == false) {
        return new PwgError(null, l10n('Can\'t download file'));
    }
    // category
    if (!preg_match('#^[0-9]+$#', $photo['category'])) {
        $categories_names = explode(',', $photo['category']);
        $photo['category'] = array();
        foreach ($categories_names as $category_name) {
            $query = '
SELECT id FROM ' . CATEGORIES_TABLE . '
  WHERE LOWER(name) = "' . strtolower($category_name) . '"
;';
            $result = pwg_query($query);
            if (pwg_db_num_rows($result)) {
                list($cat_id) = pwg_db_fetch_row($result);
                $photo['category'][] = $cat_id;
            } else {
                $cat = create_virtual_category($category_name);
                $photo['category'][] = $cat['id'];
            }
        }
    } else {
        $photo['category'] = array($photo['category']);
    }
    // add photo
    $photo['image_id'] = add_uploaded_file($photo['path'], basename($photo['path']), $photo['category']);
    // do some updates
    if (!empty($photo['fills'])) {
        $photo['fills'] = rtrim($photo['fills'], ',');
        $photo['fills'] = explode(',', $photo['fills']);
        $updates = array();
        if (in_array('fill_name', $photo['fills'])) {
            $updates['name'] = pwg_db_real_escape_string($photo['title']);
        }
        if (in_array('fill_posted', $photo['fills'])) {
            $updates['date_available'] = date('Y-m-d H:i:s', $photo['dates']['posted']);
        }
        if (in_array('fill_taken', $photo['fills'])) {
            $updates['date_creation'] = $photo['dates']['taken'];
        }
        if (in_array('fill_author', $photo['fills'])) {
            $updates['author'] = pwg_db_real_escape_string($photo['owner']['username']);
        }
        if (in_array('fill_description', $photo['fills'])) {
            $updates['comment'] = pwg_db_real_escape_string(@$photo['description']);
        }
        if (in_array('fill_geotag', $photo['fills']) and !empty($photo['location'])) {
            $updates['latitude'] = pwg_db_real_escape_string($photo['location']['latitude']);
            $updates['longitude'] = pwg_db_real_escape_string($photo['location']['longitude']);
        }
        if (in_array('level', $photo['fills']) && !$photo['visibility']['ispublic']) {
            $updates['level'] = 8;
            if ($photo['visibility']['isfamily']) {
                $updates['level'] = 4;
            }
            if ($photo['visibility']['isfriend']) {
                $updates['level'] = 2;
            }
        }
        if (count($updates)) {
            single_update(IMAGES_TABLE, $updates, array('id' => $photo['image_id']));
        }
        if (!empty($photo['tags']['tag']) and in_array('fill_tags', $photo['fills'])) {
            $raw_tags = array_map(create_function('$t', 'return $t["_content"];'), $photo['tags']['tag']);
            $raw_tags = implode(',', $raw_tags);
            set_tags(get_tag_ids($raw_tags), $photo['image_id']);
        }
    }
    return l10n('Photo "%s" imported', $photo['title']);
}
Example #2
0
function nextend_api_auth_flow()
{
    $api_key = NextendRequest::getVar('api_key');
    $api_secret = NextendRequest::getVar('api_secret');
    if (session_id() == "") {
        @session_start();
    }
    if (!$api_key || !$api_secret) {
        $api_key = isset($_SESSION['api_key']) ? $_SESSION['api_key'] : null;
        $api_secret = isset($_SESSION['api_secret']) ? $_SESSION['api_secret'] : null;
    } else {
        $_SESSION['api_key'] = $api_key;
        $_SESSION['api_secret'] = $api_secret;
    }
    if ($api_key && $api_secret) {
        require_once dirname(__FILE__) . "/api/phpFlickr.php";
        $f = new phpFlickr($api_key, $api_secret);
        if (empty($_GET['frob'])) {
            $f->auth('read', false);
        } else {
            $result = $f->auth_getToken($_GET['frob']);
            unset($_SESSION['api_key']);
            unset($_SESSION['api_secret']);
            unset($_SESSION['phpFlickr_auth_token']);
            echo '<script type="text/javascript">';
            echo 'window.opener.setToken("' . $result['token'] . '");';
            echo '</script>';
        }
    }
}
Example #3
0
 function getValidation($username, $apiKey, $secretKey)
 {
     $this->loadPhpFlickrClasses();
     $service = new phpFlickr($apiKey, $secretKey);
     $nsid = $service->people_findByUsername($username);
     return $nsid;
 }
Example #4
0
function searchFlickrPhotoDetail($id, $type)
{
    $retval = array();
    $data = array();
    $f = new phpFlickr('5bc169cff7b9121c0c93f9b8804b1116');
    $photo = $f->photos_getInfo($id);
    $tags = '';
    foreach ($photo['tags']['tag'] as $tag) {
        $tags .= $tag['raw'] . ',';
        //$tag['raw']
    }
    $notes = array();
    foreach ($photo['notes']['note'] as $note) {
        $notes[] = $note['_content'];
    }
    $urls = array();
    foreach ($photo['urls']['url'] as $url) {
        $urls = $url['_content'];
    }
    $data = array('title' => $photo['title'], 'description' => $photo['description'], 'image' => $f->buildPhotoURL($photo), 'date' => $photo['dates']['taken'], 'author' => $photo['owner']['username'], 'authorUrl' => 'http://flickr.com/photos/' . $photo['owner']['nsid'], 'tags' => $tags, 'note' => $notes, 'url' => $urls);
    $retval['status'] = 'OK';
    $retval['statusmsg'] = 'OK';
    $retval['data'] = $data;
    return $retval;
}
Example #5
0
 public function getFotos()
 {
     $f = new phpFlickr("f8dfa483443f9424a79d73c50344b90c");
     //Clase de Api, conseguir en: http://www.flickr.com/services/api/keys/
     $nsid = "139950084@N02";
     //NSID Usuario, conseguir en: http://idgettr.com/
     //Incluir tag, ordenamieno, privacidad, y numero de imagenes a mostrar
     $tagsList = $f->tags_getListUser($nsid);
     $j = 0;
     foreach ($tagsList as $tagl) {
         $photos = $f->photos_search(array("tags" => $tagl['_content'], "user_id" => $nsid, "sort" => "date-posted-desc", "privacy_filter" => "1"));
         //$photoList[$tagl['_content']] = $photos['photo'];
         $i = 0;
         $photoList[$j]['tag'] = $tagl['_content'];
         foreach ($photos['photo'] as $photo) {
             $photoList[$j]['photos'][$i]['id'] = $photo['id'];
             $photoList[$j]['photos'][$i]['url'] = $f->buildPhotoURL($photo, "Medium 640");
             $i++;
         }
         $j++;
         /*	if (is_array($photos['photo'])){
         				$i = 0;
         				foreach ($photos['photo'] as $photo){
         						$photoList[$tagl['_content']][$i] = $f->buildPhotoURL($photo, "Medium 640");
         				}
         			}*/
     }
     return $photoList;
 }
Example #6
0
 function onNextendFlickr(&$flickr)
 {
     $config = new NextendData();
     $config->loadJson(NextendSmartSliderStorage::get(self::$_group));
     require_once dirname(__FILE__) . "/api/phpFlickr.php";
     $flickr = new phpFlickr($config->get('apikey', ''), $config->get('apisecret', ''));
     $flickr->setToken($config->get('token', ''));
 }
Example #7
0
function flickrUser($userName)
{
    global $site;
    $f = new phpFlickr($site["flickr"]["key"]);
    $f->enableCache("fs", $site["path"] . $site["folder"] . $site["flickr"]["cache"], $site["flickr"]["cacheduration"]);
    $user = $f->people_findByUsername($userName);
    return $user;
}
Example #8
0
function flickr_show_set($set_id, $size = 's', $start = 0, $limit = 0, $bigsize = '')
{
    global $FLICKR_API_KEY;
    $f = new phpFlickr($FLICKR_API_KEY);
    $set = $f->photosets_getPhotos($set_id);
    $start = $start;
    $limit = $limit > 0 ? $limit : count($set['photo']);
    flickr_output_from_set($set, $size, $start, $limit, $bigsize);
}
function uploadPhoto($path, $title)
{
    $apiKey = "3b7d4ab3e54988c4e6fd59d9e40ca28c";
    $apiSecret = "84d2e480c8e3c926";
    $permissions = "write";
    $token = "72157626228984291-4635fa88a6fed8f5";
    $f = new phpFlickr($apiKey, $apiSecret, true);
    $f->setToken($token);
    return $f->async_upload($path, $title);
}
function upload_photo($path, $title)
{
    $apiKey = "your-flickr-key";
    $apiSecret = "your-flickr-secret";
    $token = "flickr-token";
    $permissions = "write";
    $f = new phpFlickr($apiKey, $apiSecret, true);
    $f->setToken($token);
    $f->async_upload($path, $title);
    @unlink("temp.jpg");
}
function total_photo($tags)
{
    $o = new phpFlickr('6791ccf468e1c2276c1ba1e0c41683a4');
    $d = $o->photos_search(array('tags' => $tags, 'content_type' => 1, 'sort' => 'date-posted-asc', 'extras' => 'url_o,url_l', 'page' => 1, 'per_page' => 500));
    print_r("total page :" . $d['pages']);
    $total_page = $d['pages'];
    print_r("total photo :" . $d['total']);
    $total_photo = $d['total'];
    $dir = str_replace(" ", "_", $tags);
    system(" mkdir {$dir}");
    photo_list($tags, 1, 500);
}
 /**
  * get images from flickr
  * @author - Henry Addo
  * @access - public 
  * @return - Array of images
  */
 public function get_images()
 {
     $username = "";
     $photo_urls = "http://www.flickr.com/photos/eyedol/";
     $tags = "tedglobal2007";
     // create instance of phpFlickr class
     $flickr = new phpFlickr('');
     //enable caching
     $flickr->enableCache("");
     //authenticate
     //$flickr->auth();
     //get token
     //$token = $token['user']['nsid'];
     // get NSID of the username
     $nsid = $token['user']['nsid'];
     $user = $flickr->people_findByUsername($username);
     //get the friendly URL of the the users' photos
     $photos_url = $flickr->urls_getUserPhotos($username);
     // get 20 images of public images of the user
     //$photos = $flickr->photos_search( array( 'tags'=>$tags,
     //'per_page'=> 200 ) );
     $photos = $flickr->people_getPublicPhotos($username, NULL, 36);
     // loop through the photos
     foreach ((array) $photos['photo'] as $photo) {
         $this->images[] = "<li><a href=\"#\">\n        <img  alt='{$photo['title']}' title='{$photo['title']}'\n        src=\"" . $flickr->buildPhotoURL($photo, 'Square') . "\" \n        onclick=\"get_image_id('" . $flickr->buildPhotoURL($photo) . "','{$photo['title']}')\"/></a></li>";
         $owner = $flickr->people_getInfo($photo[owner]);
         $this->owner = $owner['username'];
     }
     return $this->images;
 }
Example #13
0
function uploadPhoto($path, $title)
{
    $apiKey = "e0fb27a9db978169247afe3169afba43";
    $apiSecret = "d9a3f7d933ae7ccf";
    $permissions = "write";
    $token = "72157662014557483-df831fa3afbc5468";
    $f = new phpFlickr($apiKey, $apiSecret, true);
    $f->setToken($token);
    $result = $f->sync_upload($path, $title);
    $photo = $f->photos_getInfo($result);
    print_r($photo);
    $src = 'http://farm' . $photo['photo']['farm'] . '.staticflickr.com/' . $photo['photo']['server'] . '/' . $photo['photo']['id'] . '_' . $photo['photo']['secret'] . '.' . $photo['photo']['originalformat'];
    $src = 'https://c1.staticflickr.com/' . $photo['photo']['farm'] . '/' . $photo['photo']['server'] . '/' . $photo['photo']['id'] . '_' . $photo['photo']['secret'] . '_n.jpg';
    echo '<br><img src="' . $src . '">';
}
Example #14
0
function jeg_get_flickr_photo($flickrapi, $flickrid, $totalimage)
{
    require_once JEG_PLUGIN_DIR . "util/phpFlickr/phpFlickr.php";
    $f = new phpFlickr($flickrapi);
    $result = $f->people_getPublicPhotos($flickrid, null, null, $totalimage, null);
    $photos = array();
    if (empty($result)) {
        echo $f->getErrorMsg();
    } else {
        $photosUrl = $f->urls_getUserPhotos($flickrid);
        foreach ($result['photos']['photo'] as $photo) {
            $photos[] = array('s' => $f->buildPhotoURL($photo, 'square'), 'url' => $photosUrl . $photo['id'], 'title' => $photo['title']);
        }
    }
    return $photos;
}
Example #15
0
 function display()
 {
     $flickr = new phpFlickr(ModUtil::getVar('Content', 'flickrApiKey'));
     $flickr->enableCache("fs", System::getVar('temp'));
     // Find the NSID of the username
     $person = $flickr->people_findByUsername($this->userName);
     // Get the photos
     //$photos = $flickr->people_getPublicPhotos($person['id'], NULL, $this->photoCount);
     $photos = $flickr->photos_search(array('user_id' => $person['id'], 'tags' => $this->tags, 'per_page' => $this->photoCount));
     $photoData = array();
     foreach ((array) $photos['photo'] as $photo) {
         $photoData[] = array('title' => DataUtil::formatForDisplayHTML($this->decode($photo['title'])), 'src' => $flickr->buildPhotoURL($photo, "Square"), 'url' => "http://www.flickr.com/photos/{$photo['owner']}/{$photo['id']}");
     }
     $this->view->assign('photos', $photoData);
     return $this->view->fetch($this->getTemplate());
 }
Example #16
0
function getFlickrConnection()
{
    if (FLICKR_KEY) {
        $flickr = new phpFlickr(FLICKR_KEY);
        if (false !== $flickr->test_echo()) {
            $cache = dirname(__FILE__) . '/cache';
            if (file_exists($cache)) {
                $flickr->enableCache("fs", $cache);
            }
            return $flickr;
        } else {
            throw new \RuntimeException('Flickr API Key has been defined but is invalid.');
        }
    } else {
        throw new \RuntimeException('Flickr API Key has not been defined.');
    }
}
function total_photo($tags, $camera)
{
    $o = new phpFlickr('6791ccf468e1c2276c1ba1e0c41683a4');
    $d = $o->photos_search(array('tags' => $tags, 'content_type' => 1, 'sort' => 'date-posted-asc', 'camera' => $camera, 'extras' => 'url_o,url_l', 'page' => 1, 'per_page' => 500));
    print_r("total page :" . $d['pages']);
    $total_page = $d['pages'];
    print_r("total photo :" . $d['total']);
    $total_photo = $d['total'];
    for ($page = 1; $total_page >= $page; $page++) {
        print "page {$page} \n";
        if ($total_photo >= 500) {
            $total_photo -= 500;
            photo_list($tags, $camera, $page, 500);
        } else {
            photo_list($tags, $camera, $page, $total_photo);
        }
    }
}
function total_photo($tags)
{
    $o = new phpFlickr('6791ccf468e1c2276c1ba1e0c41683a4');
    $tags = trim(preg_replace('/\\s\\s+/', ' ', $tags));
    $d = $o->photos_search(array('user_id' => $tags, 'content_type' => 1, 'sort' => 'date-posted-asc', 'extras' => 'url_m,url_z', 'page' => 1, 'per_page' => 500));
    print_r("total page :" . $d['pages']);
    $total_page = $d['pages'];
    print_r("total photo :" . $d['total']);
    $total_photo = $d['total'];
    for ($page = 1; $total_page >= $page; $page++) {
        print "page {$page} \n";
        if ($total_photo >= 500) {
            $total_photo -= 500;
            photo_list($tags, $page, 500);
        } else {
            photo_list($tags, $page, $total_photo);
        }
    }
}
Example #19
0
function listafotosflickr()
{
    global $ret, $cp, $key, $texto, $ai, $af, $page;
    $ret = explode(" ", $ret);
    $ret = implode(",", $ret);
    $resultado = "";
    if ($ai != "") {
        $ai = strtotime("1 Jan " . $ai);
    }
    // echo strtotime("10 September 2000")
    if ($af != "") {
        $af = strtotime("31 Dec " . $af);
    }
    $f = new phpFlickr($key);
    $recent = @$f->photos_search(array("page" => $page, "extras" => "geo", "accuracy" => "11", "min_upload_date" => $ai, "max_upload_date" => $af, "text" => $texto, "bbox" => $ret, "privacy_filter" => "1"));
    if (!$recent) {
        $recent = "";
    }
    $cp->set_data($recent);
}
function displayFlickrPhotos()
{
    if (isset($_GET['q']) && isset($_GET['maxResults'])) {
        $flickrKey = 'b1a69066d658530df604321f514b72d0';
        $flickrSecret = '9e0e977d109675fa';
        require_once 'phpFlickr.php';
        $f = new phpFlickr($flickrKey);
        $recent = $f->photos_search(array("tags" => $_GET['q'], "tag_mode" => "any", "per_page" => $_GET['maxResults'], "extras" => "url_sq"));
        $url = array();
        $urls = array();
        if (count($recent['photo']) < 1) {
            echo '<h5>There are no Results Found</h5>';
        } else {
            foreach ($recent['photo'] as $photo) {
                $urls[] = $f->buildPhotoURL($photo, "Medium");
            }
            foreach ($urls as $url) {
                echo '<img src="' . $url . '">';
            }
        }
    }
}
Example #21
0
 public function index()
 {
     $this->template->content = new View('flickrwijit_front');
     //fetch flickrwijit settings from db
     $flickrwijit_settings = ORM::factory('flickrwijit', 1);
     // include phpflickr library
     include Kohana::find_file('libraries/phpflickr', 'phpFlickr');
     $f = new phpFlickr(Kohana::config('flickrwijit.flick_api_key'));
     //enable caching
     if ($flickrwijit_settings->enable_cache == 1) {
         $f->enableCache("fs", "application/cache");
     }
     $pagination = new Pagination(array('query_string' => 'page', 'items_per_page' => (int) Kohana::config('settings.items_per_page'), 'total_items' => $flickrwijit_settings->num_of_photos));
     //print_r($pagination);
     $photos = $f->photos_search(array('page' => $pagination->current_page, 'tags' => $flickrwijit_settings->flickr_tag, 'per_page' => (int) Kohana::config('settings.items_per_page'), 'user_id' => $flickrwijit_settings->flickr_id));
     $this->template->content->image_width = $flickrwijit_settings->image_width;
     $this->template->content->image_height = $flickrwijit_settings->image_height;
     $this->template->content->num_of_photos = $flickrwijit_settings->num_of_photos;
     $this->template->content->f = $f;
     $this->template->content->photos = $photos;
     $this->template->content->pagination = $pagination;
 }
 public function displayFlickr($FlickrKey, $FlickrWhat, $FlickrWhere, $DisplayCount, $RandomCount, $width)
 {
     $f = new phpFlickr($FlickrKey);
     $returnurl = '';
     $trycount = 1;
     $FlickrSearch = $FlickrWhat . ", " . $FlickrWhere;
     $photocount = $DisplayCount;
     //echo "Search - " . $FlickrSearch . "<br />";
     //echo "Count - " . $RandomCount . "<br />";
     $search = $f->photos_search(array("text" => $FlickrSearch, "tag_mode" => "any", "per_page" => $RandomCount, "license" => "Attribution Creative Commons"));
     //var_dump($search);
     $TotalCount = $search['total'];
     //echo "Count - " . $TotalCount . "<br />";
     if ($TotalCount < $RandomCount) {
         $RandomCount = $TotalCount;
     }
     // Create the illusion of random photo
     $RandomPhoto = rand(1, $RandomCount);
     foreach ($search['photo'] as $photo) {
         //echo $photocount . ' == ' . $RandomPhoto . '<br />';
         if ($photocount == $RandomPhoto) {
             $photo_id = $photo['id'];
             $photo_owner = $photo['owner'];
             $photo_title = $photo['title'];
             $photo_farm = $photo['farm'];
             $photo_server = $photo['server'];
             $photo_secret = $photo['secret'];
             $url = "http://www.flickr.com/photos/" . $photo_owner . "/" . $photo_id . "/";
             // Build the HTML for an image to return
             $returnurl = '<center><a href="' . $url . '" class="img">';
             $returnurl .= '<img src="http://farm' . $photo_farm . '.staticflickr.com/' . $photo_server . '/' . $photo_id . '_' . $photo_secret . '.jpg" width="' . $width . '" />';
             $returnurl .= '<div>' . $FlickrWhere . '</div>';
             $returnurl .= '</a></center>';
         }
         $photocount++;
     }
     return $returnurl;
 }
Example #23
0
function flickr_stream($username, $api_key)
{
    require_once "phpflickr/phpFlickr.php";
    $phpFlickrObj = new phpFlickr($api_key);
    $phpFlickrObj->enableCache("fs", TEMPLATEPATH . "/cache");
    $user = $phpFlickrObj->people_findByUsername($username);
    $user_url = $phpFlickrObj->urls_getUserPhotos($user['id']);
    $photos = $phpFlickrObj->people_getPublicPhotos($user['id'], NULL, NULL, 9);
    foreach ($photos['photos']['photo'] as $photo) {
        echo '<a href="' . $user_url . $photo['id'] . '" title="' . $photo['title'] . ' (on Flickr)" target="_blank">';
        echo '<img style="width: 64px; height: 64px; margin: 1px; padding: 2px; border: 3px solid #ddd; background: #fff;" class="wp-image" alt="' . $photo['title'] . '" src="' . $phpFlickrObj->buildPhotoURL($photo, "square") . '" />';
        echo '</a>';
    }
}
Example #24
0
<?php

if (!isset($_GET['id'])) {
    header('Location:index.php');
}
require_once "phpFlickr/phpFlickr.php";
$f = new phpFlickr("44449d9d74ed80abe095ab2a6f137dbe", "abde3a1309b8d8e1");
$photos = $f->photosets_getPhotos($_GET['id']);
if (sizeof($photos['photoset']['photo']) <= 0) {
    header('Location:index.php');
}
$p = $f->photosets_getInfo($photos['photoset']['id']);
$set_title = $p['title'];
include "header.php";
//include "sidebar.php";
?>
<div id="main_left">
	<img src="<?php 
echo $f->buildPhotoURL($photos['photoset']['photo'][0], 'medium');
?>
" />
</div>
<div id="main_right">
	<ul id="gallery" class="gallery">
<?php 
$i = 0;
foreach ((array) $photos['photoset']['photo'] as $photo) {
    //echo 'photo:'.$photo.'<hr />';
    echo "<li><a href='" . $f->buildPhotoURL($photo, "medium") . "' title='" . $photo['title'] . "'>";
    echo "<img alt='" . $photo['title'] . "' " . "src='" . $f->buildPhotoURL($photo, "square") . "' /></a></li>";
    $i++;
Example #25
0
/* Last updated with phpFlickr 2.3.2
 *
 * Edit these variables to reflect the values you need. $default_redirect 
 * and $permissions are only important if you are linking here instead of
 * using phpFlickr::auth() from another page or if you set the remember_uri
 * argument to false.
 */
$api_key = "[your api key]";
$api_secret = "[your api secret]";
$default_redirect = "/";
$permissions = "read";
$path_to_phpFlickr_class = "./";
ob_start();
require_once $path_to_phpFlickr_class . "phpFlickr.php";
unset($_SESSION['phpFlickr_auth_token']);
if (isset($_SESSION['phpFlickr_auth_redirect']) && !empty($_SESSION['phpFlickr_auth_redirect'])) {
    $redirect = $_SESSION['phpFlickr_auth_redirect'];
    unset($_SESSION['phpFlickr_auth_redirect']);
}
$f = new phpFlickr($api_key, $api_secret);
if (empty($_GET['frob'])) {
    $f->auth($permissions, false);
} else {
    $f->auth_getToken($_GET['frob']);
}
if (empty($redirect)) {
    header("Location: " . $default_redirect);
} else {
    header("Location: " . $redirect);
}
Example #26
0
function get_data_source($data_type, $type = '')
{
    $arr = array();
    if ($data_type == 'data-2') {
        $arr = get_categories();
    } elseif ($data_type == 'data-2-formats') {
        $post_formats = get_theme_support('post-formats');
        $arr = $post_formats[0];
        array_unshift($arr, "Select Filter");
    } elseif ($data_type == 'data-3') {
        if (is_admin()) {
            global $ph_sets;
            if (!empty($ph_sets)) {
                $arr = $ph_sets['photoset'];
            } else {
                if (of_get_option('flickr_userid') != '') {
                    require_once NV_FILES . "/adm/inc/phpFlickr/phpFlickr.php";
                    $f = new phpFlickr('7caca0370ede756c26832c28b266ead5');
                    $user = of_get_option('flickr_userid');
                    $ph_sets = $f->photosets_getList($user);
                    $arr = $ph_sets['photoset'];
                }
            }
            if ($arr != '' && $type == 'shortcode') {
                array_unshift($arr, "Select Flickr Set");
            }
        }
    } elseif ($data_type == 'data-4') {
        $args = array('numberposts' => -1, 'post_type' => 'slide-sets', 'post_status' => 'publish');
        $arr = get_posts($args);
    } elseif ($data_type == 'data-5') {
        if (class_exists('Woocommerce')) {
            $arr = get_terms('product_cat', 'orderby=name&hide_empty=0');
        } else {
            $arr = get_terms('wpsc_product_category', 'orderby=name&hide_empty=0');
        }
    } elseif ($data_type == 'data-5-tags') {
        $arr = get_terms('product_tag', 'orderby=name&hide_empty=1');
    } elseif ($data_type == 'data-6') {
        $arr = get_terms('portfolio-category', 'orderby=name&hide_empty=0');
    }
    // Set the options array
    if (is_array($arr)) {
        foreach ($arr as $val) {
            if ($data_type == 'data-2') {
                if ($type == 'shortcode') {
                    $options_array[htmlspecialchars($val->cat_name)] = $val->cat_name;
                } else {
                    $options_array[htmlspecialchars($val->term_id)] = $val->cat_name;
                }
            } elseif ($data_type == 'data-3') {
                if ($type == 'shortcode') {
                    if ($val == 'Select Flickr Set') {
                        $options_array[htmlspecialchars($val)] = '';
                    } else {
                        $options_array[$val['title']['_content']] = $val['id'];
                    }
                } else {
                    $options_array[$val['id']] = $val['title']['_content'];
                }
            } elseif ($data_type == 'data-4') {
                if ($type == 'shortcode') {
                    $options_array[htmlspecialchars($val->post_title)] = $val->post_title;
                } else {
                    $options_array[htmlspecialchars($val->ID)] = $val->post_title;
                }
            } elseif ($data_type == 'data-2-formats') {
                if ($type == 'shortcode') {
                    if ($val == 'Select Filter') {
                        $options_array[htmlspecialchars($val)] = '';
                    } else {
                        $options_array[htmlspecialchars($val)] = $val;
                    }
                } elseif ($type == 'blog') {
                    if ($val != 'Select Filter') {
                        $options_array[htmlspecialchars($val)] = $val;
                    }
                } else {
                    if ($val == 'Select Filter') {
                        $options_array[] = array('name' => $val, 'value' => '');
                    } else {
                        $options_array[] = array('name' => $val, 'value' => $val);
                    }
                }
            } else {
                $options_array[htmlspecialchars($val->name)] = $val->name;
            }
        }
    }
    if (empty($options_array)) {
        $options_array[''] = 'No Data Found';
    }
    return $options_array;
}
function UserSets_Get_Photos($photosets_id, $path)
{
    $o = new phpFlickr('6791ccf468e1c2276c1ba1e0c41683a4');
    $extras = 'url_o,url_l';
    $d = $o->photosets_getPhotos($photosets_id, $extras);
    $total_pages = $d['photoset']['pages'];
    $total_photos = $d['photoset']['total'];
    print "total photos : {$total_photos} \ntotal_pages : {$total_pages} \n";
    #print_r($d);
    for ($index_page = 1; $index_page <= $total_pages; $index_page++) {
        print "page : {$index_page} \n";
        $key = new phpFlickr('6791ccf468e1c2276c1ba1e0c41683a4');
        $extras = 'url_o,url_l';
        $set_data = $key->photosets_getPhotos($photosets_id, $extras, NULL, NULL, $index_page);
        for ($index = 0; $index <= 500; $index++) {
            if (!empty($set_data['photoset']['photo'][$index]['url_m'])) {
                #print_r( "photo $index : ". $set_data['photoset']['photo'][$index]['url_o'] ."\n");
                $downfile = $set_data['photoset']['photo'][$index]['url_m'];
                system("wget -nc {$downfile} -P {$path}");
            } elseif (!empty($set_data['photoset']['photo'][$index]['url_z'])) {
                #print_r( "photo $index : ".$set_data['photoset']['photo'][$index]['url_l'] ."\n");
                $downfile = $set_data['photoset']['photo'][$index]['url_z'];
                system("wget -nc {$downfile} -P {$path}");
            }
            # else{
            #     print ("orignal and large size is not available \n");
            # }
        }
    }
}
function fjgwpp_settings()
{
    global $fjgwpp_imagesHeight_default;
    global $fjgwpp_maxPhotosPP_default;
    global $fjgwpp_lastRow_default;
    global $fjgwpp_fixedHeight_default;
    global $fjgwpp_pagination_default;
    global $fjgwpp_lightbox_default;
    global $fjgwpp_provideColorbox_default;
    global $fjgwpp_provideSwipebox_default;
    global $fjgwpp_captions_default;
    global $fjgwpp_showDescriptions_default;
    global $fjgwpp_randomize_default;
    global $fjgwpp_margins_default;
    global $fjgwpp_openOriginals_default;
    global $fjgwpp_bcontextmenu_default;
    global $fjgwpp_flickrAPIWrapperVersion_default;
    //Get Values
    $fjgwpp_userID_saved = fjgwpp_getOption('userID', '');
    $fjgwpp_APIKey_saved = fjgwpp_getOption('APIKey', '');
    $fjgwpp_imagesHeight_saved = (int) fjgwpp_getOption('imagesHeight', $fjgwpp_imagesHeight_default);
    $fjgwpp_maxPhotosPP_saved = (int) fjgwpp_getOption('maxPhotosPP', $fjgwpp_maxPhotosPP_default);
    $fjgwpp_lastRow_saved = (int) fjgwpp_getOption('lastRow', $fjgwpp_lastRow_default);
    $fjgwpp_fixedHeight_saved = (int) fjgwpp_getOption('fixedHeight', $fjgwpp_fixedHeight_default);
    $fjgwpp_pagination_saved = fjgwpp_getOption('pagination', $fjgwpp_pagination_default);
    $fjgwpp_lightbox_saved = fjgwpp_getOption('lightbox', $fjgwpp_lightbox_default);
    $fjgwpp_provideColorbox_saved = (int) fjgwpp_getOption('provideColorbox', $fjgwpp_provideColorbox_default);
    $fjgwpp_provideSwipebox_saved = (int) fjgwpp_getOption('provideSwipebox', $fjgwpp_provideSwipebox_default);
    $fjgwpp_captions_saved = (int) fjgwpp_getOption('captions', $fjgwpp_captions_default);
    $fjgwpp_showDescriptions_saved = (int) fjgwpp_getOption('showDescriptions', $fjgwpp_showDescriptions_default);
    $fjgwpp_randomize_saved = (int) fjgwpp_getOption('randomize', $fjgwpp_randomize_default);
    $fjgwpp_margins_saved = (int) fjgwpp_getOption('margins', $fjgwpp_margins_default);
    $fjgwpp_openOriginals_saved = (int) fjgwpp_getOption('openOriginals', $fjgwpp_openOriginals_default);
    $fjgwpp_bcontextmenu_saved = (int) fjgwpp_getOption('bcontextmenu', $fjgwpp_bcontextmenu_default);
    $fjgwpp_flickrAPIWrapperVersion_saved = (int) fjgwpp_getOption('flickrAPIWrapperVersion', $fjgwpp_flickrAPIWrapperVersion_default);
    //Save Values
    if (isset($_POST['Submit'])) {
        $error = false;
        $error_msg = "";
        $fjgwpp_flickrAPIWrapperVersion_saved = (int) $_POST["fjgwpp_flickrAPIWrapperVersion"];
        if ($fjgwpp_flickrAPIWrapperVersion_saved == 0) {
            require_once "phpFlickr/phpFlickr.php";
        } else {
            require_once "phpFlickr_a" . $fjgwpp_flickrAPIWrapperVersion_saved . "/phpFlickr.php";
        }
        //Check the API Key
        $fjgwpp_APIKey_saved = trim($_POST["fjgwpp_APIKey"]);
        $f = new phpFlickr($fjgwpp_APIKey_saved);
        if ($f->test_echo() == false) {
            $error = true;
            $error_msg .= '<li>' . __('API Key is not valid', 'fjgwpp') . '</li>';
        }
        $fjgwpp_userID_saved = trim($_POST["fjgwpp_userID"]);
        if (!$error) {
            if ($f->urls_getUserProfile($fjgwpp_userID_saved) == false) {
                $error = true;
                $error_msg .= '<li>' . __('Invalid UserID', 'fjgwpp') . '</li>';
            }
        }
        $fjgwpp_imagesHeight_saved = (int) $_POST["fjgwpp_imagesHeight"];
        if ($fjgwpp_imagesHeight_saved < 30) {
            $error = true;
            $error_msg .= '<li>' . __('The \'Images Height\' field must have a value greater than or equal to 30', 'fjgwpp') . '</li>';
        }
        $fjgwpp_maxPhotosPP_saved = (int) $_POST["fjgwpp_maxPhotosPP"];
        if ($fjgwpp_maxPhotosPP_saved <= 0) {
            $error = true;
            $error_msg .= '<li>' . __('The \'Photos per page\' field must have a value greater than 0', 'fjgwpp') . '</li>';
        }
        $fjgwpp_lastRow_saved = $_POST["fjgwpp_lastRow"];
        if (isset($_POST["fjgwpp_fixedHeight"])) {
            $fjgwpp_fixedHeight_saved = (int) $_POST["fjgwpp_fixedHeight"] != 0 ? 1 : 0;
        } else {
            $fjgwpp_fixedHeight_saved = 0;
        }
        $fjgwpp_pagination_saved = $_POST["fjgwpp_pagination"];
        $fjgwpp_lightbox_saved = $_POST["fjgwpp_lightbox"];
        if (isset($_POST["fjgwpp_provideColorbox"])) {
            $fjgwpp_provideColorbox_saved = (int) $_POST["fjgwpp_provideColorbox"] != 0 ? 1 : 0;
        } else {
            $fjgwpp_provideColorbox_saved = 0;
        }
        if (isset($_POST["fjgwpp_provideSwipebox"])) {
            $fjgwpp_provideSwipebox_saved = (int) $_POST["fjgwpp_provideSwipebox"] != 0 ? 1 : 0;
        } else {
            $fjgwpp_provideSwipebox_saved = 0;
        }
        if (isset($_POST["fjgwpp_captions"])) {
            $fjgwpp_captions_saved = (int) $_POST["fjgwpp_captions"] != 0 ? 1 : 0;
        } else {
            $fjgwpp_captions_saved = 0;
        }
        if (isset($_POST["fjgwpp_showDescriptions"])) {
            $fjgwpp_showDescriptions_saved = (int) $_POST["fjgwpp_showDescriptions"] != 0 ? 1 : 0;
        } else {
            $fjgwpp_showDescriptions_saved = 0;
        }
        if (isset($_POST["fjgwpp_randomize"])) {
            $fjgwpp_randomize_saved = (int) $_POST["fjgwpp_randomize"] != 0 ? 1 : 0;
        } else {
            $fjgwpp_randomize_saved = 0;
        }
        if (isset($_POST["fjgwpp_openOriginals"])) {
            $fjgwpp_openOriginals_saved = (int) $_POST["fjgwpp_openOriginals"] != 0 ? 1 : 0;
        } else {
            $fjgwpp_openOriginals_saved = 0;
        }
        if (isset($_POST["fjgwpp_bcontextmenu"])) {
            $fjgwpp_bcontextmenu_saved = (int) $_POST["fjgwpp_bcontextmenu"] != 0 ? 1 : 0;
        } else {
            $fjgwpp_bcontextmenu_saved = 0;
        }
        $fjgwpp_margins_saved = (int) $_POST["fjgwpp_margins"];
        if ($fjgwpp_margins_saved < 0 || $fjgwpp_margins_saved > 30) {
            $error = true;
            $error_msg .= '<li>' . __('The \'Margins\' field must have a value greater or equal than 0, and not greater than 30', 'fjgwpp') . '</li>';
        }
        if ($error == false) {
            update_option('$fjgwpp_APIKey', $fjgwpp_APIKey_saved);
            update_option('$fjgwpp_userID', $fjgwpp_userID_saved);
            update_option('$fjgwpp_imagesHeight', $fjgwpp_imagesHeight_saved);
            update_option('$fjgwpp_maxPhotosPP', $fjgwpp_maxPhotosPP_saved);
            update_option('$fjgwpp_lastRow', $fjgwpp_lastRow_saved);
            update_option('$fjgwpp_fixedHeight', $fjgwpp_fixedHeight_saved);
            update_option('$fjgwpp_pagination', $fjgwpp_pagination_saved);
            update_option('$fjgwpp_lightbox', $fjgwpp_lightbox_saved);
            update_option('$fjgwpp_provideColorbox', $fjgwpp_provideColorbox_saved);
            update_option('$fjgwpp_provideSwipebox', $fjgwpp_provideSwipebox_saved);
            update_option('$fjgwpp_captions', $fjgwpp_captions_saved);
            update_option('$fjgwpp_showDescriptions', $fjgwpp_showDescriptions_saved);
            update_option('$fjgwpp_randomize', $fjgwpp_randomize_saved);
            update_option('$fjgwpp_margins', $fjgwpp_margins_saved);
            update_option('$fjgwpp_openOriginals', $fjgwpp_openOriginals_saved);
            update_option('$fjgwpp_bcontextmenu', $fjgwpp_bcontextmenu_saved);
            update_option('$fjgwpp_flickrAPIWrapperVersion', $fjgwpp_flickrAPIWrapperVersion_saved);
            ?>
		<div class="updated">
			<p><strong><?php 
            _e('Settings updated.', 'fjgwpp');
            ?>
</strong></p>
		</div>
<?php 
        } else {
            ?>
		<div class="updated">
			<p><strong><?php 
            _e('Invalid values, the settings have not been updated', 'fjgwpp');
            ?>
</strong></p>
			<ul style="color:red"><?php 
            echo $error_msg;
            ?>
</ul>
		</div>
<?php 
        }
    }
    ?>

	<style type="text/css">
		#poststuff h3 { cursor: auto; }
	</style>

			 
	<div class="wrap">
		<h2>Flickr Justified Gallery</h2>

		<div id="poststuff">

			<div class="postbox">

				<h3><?php 
    _e('Help', 'fjgwpp');
    ?>
</h3>
				<div class="inside">
					<p>
						<?php 
    _e('To display the default user\'s photostream, create a page and simply write the following shortcode where you want to display the gallery.', 'fjgwpp');
    ?>
						<div style="margin-left: 30px">
							<pre>[flickr_photostream]</pre>
						</div>
					</p>
					<p>
						<?php 
    _e('However, you can also use the attributes to have settings that are different than the defaults. For example:', 'fjgwpp');
    ?>
						<div style="margin-left: 30px">
							<pre>[flickr_photostream max_num_photos="50" no_pages="true"]</pre>
							<?php 
    _e('displays the latest 50 photos of the default user photostream, without any page navigation. (the other settings are the defaults)', 'fjgwpp');
    ?>
						</div>
					</p>
					<p>
						<?php 
    _e('You can also configure it to show other photostreams. For example:', 'fjgwpp');
    ?>
						<div style="margin-left: 30px">
							<pre>[flickr_photostream user_id="67681714@N03"]</pre>
							<?php 
    _e('displays the photostream of the specified user, no matter what is the default user ID in the settings. Remember that you can use <a href="http://idgettr.com/" target="_blank">idgettr</a> to retrieve the <code>user_id</code>.', 'fjgwpp');
    ?>
						</div>
					</p>

		
					<h4><?php 
    _e('Sets', 'fjgwpp');
    ?>
</h4>
					<p>
						<?php 
    _e('To show the photos of a particular photo set, you need to know its <code>photoset_id</code>.', 'fjgwpp');
    ?>
						<?php 
    _e('For example, the <code>photoset_id</code> of the photo set located in the URL:', 'fjgwpp');
    ?>
						<code>http://www.flickr.com/photos/miro-mannino/sets/72157629228993613/</code>
						<?php 
    _e('is: ', 'fjgwpp');
    ?>
						<code>72157629228993613</code>.
						<?php 
    _e('You can see that it is always the number after the word \'/sets/\'.', 'fjgwpp');
    ?>
						<div>
							<?php 
    _e('To show a particular photoset, you need to use the <code>flickr_set</code> shortcode, and specify the <code>photoset_id</code> with the attribute <code>id</code>. For example:', 'fjgwpp');
    ?>
							<div style="margin-left: 30px">
								<pre>[flickr_set id="72157629228993613"]</pre>
							</div>
						</div>
					</p>

					<h4><?php 
    _e('Galleries', 'fjgwpp');
    ?>
</h4>
					<p>
						<?php 
    _e('To show the photos of a particular gallery, you need to know the <code>user_id</code> of the user that owns it, and its <code>id</code>.', 'fjgwpp');
    ?>
						<?php 
    _e('For example, the <code>id</code> of the gallery located in the URL:', 'fjgwpp');
    ?>
						<code>http://www.flickr.com/photos/miro-mannino/galleries/72157636382842016/</code>
						<?php 
    _e('is: ', 'fjgwpp');
    ?>
						<code>72157636382842016</code>.
						<?php 
    _e('You can see that it is always the number after the word \'/galleries/\'.', 'fjgwpp');
    ?>
						<div>
							<?php 
    _e('To show a particular gallery, you need to use the <code>flickr_gallery</code> shortcode, and specify the <code>user_id</code> with the attribute <code>user_id</code>, and the <code>gallery_id</code> with the attribute <code>id</code>. For example:', 'fjgwpp');
    ?>
							<div style="margin-left: 30px">
								<pre>[flickr_gallery user_id="67681714@N03" id="72157636382842016"]</pre>
							</div>
						</div>
						<?php 
    _e('Remember that, if the gallery is owned by the default user (specified in the settings), you don\'t need the <code>user_id</code> attribute in the shortcode.', 'fjgwpp');
    ?>
					</p>

					<h4><?php 
    _e('Group pools', 'fjgwpp');
    ?>
</h4>
					<p>
						<?php 
    _e('To show the photos of a particular group pool, you need to know the group id, that you can retrieve using <a href="http://idgettr.com/" target="_blank">idgettr</a>.', 'fjgwpp');
    ?>
						<div>
							<?php 
    _e('To show a particular group pool, you need to use the <code>flickr_group</code> shortcode, and specify the group id with the attribute <code>id</code>. For example:', 'fjgwpp');
    ?>
							<div style="margin-left: 30px">
								<pre>[flickr_group id="1563131@N22"]</pre>
							</div>
						</div>
					</p>

					<h4><?php 
    _e('Tags', 'fjgwpp');
    ?>
</h4>
					<p>
						<?php 
    _e('To show the photos that have some particular tags, you need to use the <code>flickr_tags</code> shortcode, and specify the <code>user_id</code> and the tags with the attribute <code>tags</code>, as a comma-delimited list of words. For example:', 'fjgwpp');
    ?>
						<div style="margin-left: 30px">
							<pre>[flickr_tags user_id="67681714@N03" tags="cat, square, nikon"]</pre>
							<?php 
    _e('Displays photos with one or more of the tags listed (the list is viewed as an OR combination, that is the default behavior).', 'fjgwpp');
    ?>
						</div>
						<p>
							<?php 
    _e('You can also exclude results that match a term by prepending it with a <code>-</code> character.', 'fjgwpp');
    ?>
							<?php 
    _e('Then, you can choose to use the list as a OR combination of tags (to return photos that have <b>any</b> tag), or an AND combination (to return photos that have <b>all</b> the tags).', 'fjgwpp');
    ?>
							<?php 
    _e('To do this, you need to use the <code>tags_mode</code>, specifying "any" or "all". For example:', 'fjgwpp');
    ?>
						
							<div style="margin-left: 30px">
								<pre>[flickr_tags user_id="67681714@N03" tags="cat, square, nikon" tags_mode="all"]</pre>
								<?php 
    _e('Displays photos with all the tags listed (the list is viewed as an AND combination).', 'fjgwpp');
    ?>
							</div>
						</p>
						<?php 
    _e('Remember that, if the photo that you want to display is owned by the default user (specified in the settings), you don\'t need the <code>user_id</code> attribute in the shortcode.', 'fjgwpp');
    ?>
					</p>

				</div>
			</div>

			<div class="postbox">

				<h3><?php 
    _e('Settings', 'fjgwpp');
    ?>
</h3>
				<div class="inside">

					<form method="post" name="options" target="_self">
						<h4><?php 
    _e('Global Settings', 'fjgwpp');
    ?>
</h4>

						<table class="form-table">
							<tr>
								<th scope="row">
									<label><?php 
    _e('Flickr API Key', 'fjgwpp');
    ?>
</label>
								</th>
								<td>
									<label for="fjgwpp_APIKey">
									<input type="text" name="fjgwpp_APIKey" 
										value="<?php 
    echo $fjgwpp_APIKey_saved;
    ?>
"
										style="margin-right:10px"
									/> 	
									<?php 
    _e('Get your Flickr API Key from ', 'fjgwpp');
    ?>
<a href="http://www.flickr.com/services/api/keys/" target="_blank">Flickr API</a>
									<div><?php 
    _e('You can\'t use an attribute to change this setting', 'fjgwpp');
    ?>
</div>
									</label>
								</td>
							</tr>
						</table>

						<h4><?php 
    _e('Default Settings', 'fjgwpp');
    ?>
</h4>

						<table class="form-table">
							<tr>
								<th scope="row"><?php 
    _e('User ID', 'fjgwpp');
    ?>
</th>
								<td>
									<label for="fjgwpp_userID">
										<input type="text" name="fjgwpp_userID"
											value="<?php 
    echo $fjgwpp_userID_saved;
    ?>
"
											style="margin-right:10px"
										/>
										<?php 
    _e('Get the User ID from ', 'fjgwpp');
    ?>
<a href="http://idgettr.com/" target="_blank">idgettr</a>
										<div><?php 
    echo __('You can use the <code>', 'fjgwpp') . 'user_id' . __('</code> attribute to change this default value', 'fjgwpp');
    ?>
</div>
									</label>
								</td>
							</tr>
							<tr>
								<th scope="row"><?php 
    _e('Images Height (in px)', 'fjgwpp');
    ?>
</th>
								<td>
									<label for="fjgwpp_imagesHeight">
										<input type="text" name="fjgwpp_imagesHeight" 
											value="<?php 
    echo $fjgwpp_imagesHeight_saved;
    ?>
"
										/>
										<div><?php 
    echo __('You can use the <code>', 'fjgwpp') . 'images_height' . __('</code> attribute to change this default value', 'fjgwpp');
    ?>
</div>
									</label>
								</td>
							</tr>
							<tr>
								<th scope="row"><?php 
    _e('Maximum number of photos per page', 'fjgwpp');
    ?>
</th>
								<td>
									<label for="fjgwpp_maxPhotosPP">
										<input type="text" name="fjgwpp_maxPhotosPP" 
											value="<?php 
    echo $fjgwpp_maxPhotosPP_saved;
    ?>
"
										/>
										<div><?php 
    echo __('You can use the <code>', 'fjgwpp') . 'max_num_photos' . __('</code> attribute to change this default value', 'fjgwpp');
    ?>
</div>
									</label> 	
								</td>
							</tr>
							<tr>
								<th scope="row"><?php 
    _e('Last Row', 'fjgwpp');
    ?>
</th>
								<td>
									<label for="">
										<select name="fjgwpp_lastRow" style="margin-right:5px">
											<option value="justify" <?php 
    if ($fjgwpp_lastRow_saved === 'justify') {
        echo 'selected="selected"';
    }
    ?>
 ><?php 
    _e('Justify', 'fjgwpp');
    ?>
</option>
											<option value="nojustify" <?php 
    if ($fjgwpp_lastRow_saved === 'nojustify') {
        echo 'selected="selected"';
    }
    ?>
 ><?php 
    _e('No justify', 'fjgwpp');
    ?>
</option>
											<option value="hide" <?php 
    if ($fjgwpp_lastRow_saved === 'hide') {
        echo 'selected="selected"';
    }
    ?>
 ><?php 
    _e('Hide if it cannot be justified', 'fjgwpp');
    ?>
</option>
										</select>
										<div><?php 
    echo __('You can use the <code>', 'fjgwpp') . 'last_row' . __('</code> attribute to change this default value (with the value <code>justify</code>, <code>nojustify</code> or <code>hide</code>)', 'fjgwpp');
    ?>
</div>
									</label>
								</td>
							</tr>
							<tr>
								<th scope="row"><?php 
    _e('Fixed Height', 'fjgwpp');
    ?>
</th>
								<td>
									<label for="fjgwpp_fixedHeight">
										<input type="checkbox" name="fjgwpp_fixedHeight" 
											<?php 
    if ($fjgwpp_fixedHeight_saved == 1) {
        echo 'checked="checked"';
    }
    ?>
 
											value="1"
											style="margin-right:5px"
										/>
										<?php 
    _e('If enabled, each row has the same height, but the images will be cut more.', 'fjgwpp');
    ?>
</li>
										<div><?php 
    echo __('You can use the <code>', 'fjgwpp') . 'fixed_height' . __('</code> attribute to change this default value (with the value <code>true</code> or <code>false</code>)', 'fjgwpp');
    ?>
</div>
									</label>
								</td>
							</tr>
							<tr>
								<th scope="row"><?php 
    _e('Pagination', 'fjgwpp');
    ?>
</th>
								<td>
									<label for="fjgwpp_pagination">
										<select name="fjgwpp_pagination" style="margin-right:5px">
											<option value="none" <?php 
    if ($fjgwpp_pagination_saved === 'none') {
        echo 'selected="selected"';
    }
    ?>
 ><?php 
    _e('None', 'fjgwpp');
    ?>
</option>
											<option value="prevnext" <?php 
    if ($fjgwpp_pagination_saved === 'prevnext') {
        echo 'selected="selected"';
    }
    ?>
 ><?php 
    _e('Previous and Next', 'fjgwpp');
    ?>
</option>
											<option value="numbers" <?php 
    if ($fjgwpp_pagination_saved === 'numbers') {
        echo 'selected="selected"';
    }
    ?>
 ><?php 
    _e('Page Numbers', 'fjgwpp');
    ?>
</option>
										</select>
										<?php 
    _e('If enabled, navigation buttons will be shown, and you can see the older photos.<br/><i>Use only one instance per page with this settings enabled!</i>', 'fjgwpp');
    ?>
</li>
										<div><?php 
    echo __('You can use the <code>', 'fjgwpp') . 'pagination' . __('</code> attribute to change this default value (with the value <code>none</code>, <code>prevnext</code> or <code>numbers</code>)', 'fjgwpp');
    ?>
</div>
									</label>
								</td>
							</tr>
							<tr>
								<th scope="row"><?php 
    _e('Lightbox', 'fjgwpp');
    ?>
</th>
								<td>
									<label for="fjgwpp_lightbox">
									<select name="fjgwpp_lightbox" style="margin-right:5px">
										<option value="none" <?php 
    if ($fjgwpp_lightbox_saved === 'none') {
        echo 'selected="selected"';
    }
    ?>
 ><?php 
    _e('None', 'fjgwpp');
    ?>
</option>
										<option value="colorbox" <?php 
    if ($fjgwpp_lightbox_saved === 'colorbox') {
        echo 'selected="selected"';
    }
    ?>
 >Colorbox</option>
										<option value="swipebox" <?php 
    if ($fjgwpp_lightbox_saved === 'swipebox') {
        echo 'selected="selected"';
    }
    ?>
 >Swipebox</option>
									</select>
									<div><?php 
    echo __('You can use the <code>', 'fjgwpp') . 'lightbox' . __('</code> attribute to change this default value (with the value <code>none</code>, <code>colorbox</code> or <code>swipebox</code>).', 'fjgwpp');
    ?>
</div>
									</label>
									<br/>
									<label for="fjgwpp_provideColorbox">
										<input type="checkbox" name="fjgwpp_provideColorbox" 
											<?php 
    if ($fjgwpp_provideColorbox_saved == 1) {
        echo 'checked="checked"';
    }
    ?>
 
											value="1"
											style="margin-right:5px"
										/>
										<?php 
    _e('Provide Colorbox', 'fjgwpp');
    ?>
									</label>
									<span>&nbsp;</span>
									<label for="fjgwpp_provideSwipebox">
										<input type="checkbox" name="fjgwpp_provideSwipebox" 
											<?php 
    if ($fjgwpp_provideSwipebox_saved == 1) {
        echo 'checked="checked"';
    }
    ?>
 
											value="1"
											style="margin-right:5px"
										/>
										<?php 
    _e('Provide Swipebox', 'fjgwpp');
    ?>
									</label>
									<div>
										<?php 
    echo __('Decide to include the lightbox libraries. Without them checked, make sure that you have installed the chosen lightboxes with a plugin (e.g. ', 'fjgwpp') . '<a href="https://wordpress.org/plugins/responsive-lightbox/">Responsive Lightbox</a>, ' . '<a href="http://wordpress.org/extend/plugins/jquery-colorbox/">jQuery Colorbox</a>, ' . '<a href="http://wordpress.org/extend/plugins/lightbox-plus/">Lightbox Plus Colorbox</a>).';
    ?>
									</div>
								</td>
							</tr>
							<tr>
								<th scope="row"><?php 
    _e('Captions', 'fjgwpp');
    ?>
</th>
								<td>
									<label for="fjgwpp_captions">
									<input type="checkbox" name="fjgwpp_captions" 
										<?php 
    if ($fjgwpp_captions_saved == 1) {
        echo 'checked="checked"';
    }
    ?>
 
										value="1" 
										style="margin-right:5px"
									/>
									<?php 
    _e('If enabled, the title of the photo will be shown over the image when the mouse is over. Note: <i>captions, with small images, become aesthetically unpleasing</i>.', 'fjgwpp');
    ?>
</li>
										<div><?php 
    echo __('You can use the <code>', 'fjgwpp') . 'captions' . __('</code> attribute to change this default value (with the value <code>true</code> or <code>false</code>)', 'fjgwpp');
    ?>
</div>
									</label>
								</td>
							</tr>
							<tr>
								<th scope="row"><?php 
    _e('Show descriptions', 'fjgwpp');
    ?>
</th>
								<td>
									<label for="fjgwpp_showDescriptions">
									<input type="checkbox" name="fjgwpp_showDescriptions" 
										<?php 
    if ($fjgwpp_showDescriptions_saved == 1) {
        echo 'checked="checked"';
    }
    ?>
 
										value="1" 
										style="margin-right:5px"
									/>
									<?php 
    _e('If the captions are enabled, the descriptions of the photos will be shown. Note: <i>descriptions, with small images, become aesthetically unpleasing</i>.', 'fjgwpp');
    ?>
</li>
										<div><?php 
    echo __('You can use the <code>', 'fjgwpp') . 'show_descriptions' . __('</code> attribute to change this default value (with the value <code>true</code> or <code>false</code>)', 'fjgwpp');
    ?>
</div>
									</label>
								</td>
							</tr>
							<tr>
								<th scope="row"><?php 
    _e('Randomize order', 'fjgwpp');
    ?>
</th>
								<td>
									<label for="fjgwpp_randomize">
										<input type="checkbox" name="fjgwpp_randomize" 
											<?php 
    if ($fjgwpp_randomize_saved == 1) {
        echo 'checked="checked"';
    }
    ?>
 
											value="1"
											style="margin-right:5px"
										/>
										<?php 
    _e('If enabled, the photos of the same page are randomized.', 'fjgwpp');
    ?>
</li>
										<div><?php 
    echo __('You can use the <code>', 'fjgwpp') . 'randomize' . __('</code> attribute to change this default value (with the value <code>true</code> or <code>false</code>)', 'fjgwpp');
    ?>
</div>
									</label>
								</td>
							</tr>
							<tr>
								<th scope="row"><?php 
    _e('Margin between the images', 'fjgwpp');
    ?>
</th>
								<td>
									<label for="fjgwpp_margins">
										<input type="text" name="fjgwpp_margins" 
											value="<?php 
    echo $fjgwpp_margins_saved;
    ?>
"
											style="margin-right:10px"
										/>
										<div><?php 
    echo __('You can use the <code>', 'fjgwpp') . 'margins' . __('</code> attribute to change this default value', 'fjgwpp');
    ?>
</div>
									</label> 	
								</td>
							</tr>
							<tr>
								<th scope="row"><?php 
    _e('Open original images', 'fjgwpp');
    ?>
</th>
								<td>
									<label for="fjgwpp_openOriginals">
										<input type="checkbox" name="fjgwpp_openOriginals" 
											<?php 
    if ($fjgwpp_openOriginals_saved == 1) {
        echo 'checked="checked"';
    }
    ?>
 
											value="1"
											style="margin-right:5px"
										/>
										<?php 
    _e('If enabled, the lightbox will show the original images if they are available. Consider to leave this option off if your original images are very large.', 'fjgwpp');
    ?>
</li>
										<div><?php 
    echo __('You can use the <code>', 'fjgwpp') . 'open_originals' . __('</code> attribute to change this default value (with the value <code>true</code> or <code>false</code>)', 'fjgwpp');
    ?>
</div>
									</label>
								</td>
							</tr>
							<tr>
								<th scope="row"><?php 
    _e('Block right click', 'fjgwpp');
    ?>
</th>
								<td>
									<label for="fjgwpp_bcontextmenu">
										<input type="checkbox" name="fjgwpp_bcontextmenu" 
											<?php 
    if ($fjgwpp_bcontextmenu_saved == 1) {
        echo 'checked="checked"';
    }
    ?>
 
											value="1"
											style="margin-right:5px"
										/>
										<?php 
    _e('If enabled, the context menu will be blocked, so for the user is more difficult to save the images', 'fjgwpp');
    ?>
</li>
										<div><?php 
    echo __('You can use the <code>', 'fjgwpp') . 'block_contextmenu' . __('</code> attribute to change this default value (with the value <code>true</code> or <code>false</code>)', 'fjgwpp');
    ?>
</div>
									</label>
								</td>
							</tr>
							<tr>
								<th scope="row"><?php 
    _e('Flickr API Wrapper Version', 'fjgwpp');
    ?>
</th>
								<td>
									<label for="fjgwpp_flickrAPIWrapperVersion">
										<select name="fjgwpp_flickrAPIWrapperVersion" style="margin-right:5px">
											<option value="0" <?php 
    if ($fjgwpp_flickrAPIWrapperVersion_saved === 0) {
        echo 'selected="selected"';
    }
    ?>
 >phpFlickr</option>
											<option value="1" <?php 
    if ($fjgwpp_flickrAPIWrapperVersion_saved === 1) {
        echo 'selected="selected"';
    }
    ?>
 >phpFlickr (alternative version)</option>
										</select>
										<div><?php 
    echo __('If you have some problems to communicate with the Flickr\'s API could be useful to change the current version of phpFlickr', 'fjgwpp');
    ?>
</div>
									</label> 	
								</td>
							</tr>
						</table>

						<p>
							<input type="submit" class="button-primary" name="Submit" value="<?php 
    _e('Save Changes', 'fjgwpp');
    ?>
" />
						</p>
					</form>
				</div>
			</div>

			<div class="postbox">
				<h3><?php 
    _e('Help the project', 'fjgwpp');
    ?>
</h3>
				<div class="inside">
					<p>
						<?php 
    _e('Help the project to grow. Donate something, or simply <a href="http://wordpress.org/plugins/flickr-justified-gallery" target="_blank">rate the plugin on Wordpress</a>.', 'fjgwpp');
    ?>
						<form action="https://www.paypal.com/<cgi-bin/webscr" method="post" target="_top">
							<input type="hidden" name="cmd" value="_s-xclick">
							<input type="hidden" name="encrypted" value="-----BEGIN PKCS7-----MIIHLwYJKoZIhvcNAQcEoIIHIDCCBxwCAQExggEwMIIBLAIBADCBlDCBjjELMAkGA1UEBhMCVVMxCzAJBgNVBAgTAkNBMRYwFAYDVQQHEw1Nb3VudGFpbiBWaWV3MRQwEgYDVQQKEwtQYXlQYWwgSW5jLjETMBEGA1UECxQKbGl2ZV9jZXJ0czERMA8GA1UEAxQIbGl2ZV9hcGkxHDAaBgkqhkiG9w0BCQEWDXJlQHBheXBhbC5jb20CAQAwDQYJKoZIhvcNAQEBBQAEgYBaCyf+oIknmFhsXzg6/NMzIQqul6xv29/NoxNeLY9qTQx7cWHk58Zr8VoWG1ukzEr6kPHash3WD0EeMFtjnNaYXi9aYkvhwF6eSBYXwQYuQLNqKs4bN7QIoa5FLy6SZ0zWwPmgv/0U7338IJVIGsXftvFNQyb5S8MjHO6avNgmHDELMAkGBSsOAwIaBQAwgawGCSqGSIb3DQEHATAUBggqhkiG9w0DBwQIvVcVYkSJki+AgYjC6BBHnJH4/eA8hmo8xUB5j3TRadrqtaz/7o4OMu0lHsFilPob3qDJfZN7IQlL/PwJ0lN5x1Ruc2PyxTnDcc7eo/ho0N8wXTROArUcKpct4Tw7h/sFe4NW25B6lG+hx9fK/57569WwyRPK5psQumX4XQ+QIF/s6wYq84ufhbYVmY3oISDrzfGroIIDhzCCA4MwggLsoAMCAQICAQAwDQYJKoZIhvcNAQEFBQAwgY4xCzAJBgNVBAYTAlVTMQswCQYDVQQIEwJDQTEWMBQGA1UEBxMNTW91bnRhaW4gVmlldzEUMBIGA1UEChMLUGF5UGFsIEluYy4xEzARBgNVBAsUCmxpdmVfY2VydHMxETAPBgNVBAMUCGxpdmVfYXBpMRwwGgYJKoZIhvcNAQkBFg1yZUBwYXlwYWwuY29tMB4XDTA0MDIxMzEwMTMxNVoXDTM1MDIxMzEwMTMxNVowgY4xCzAJBgNVBAYTAlVTMQswCQYDVQQIEwJDQTEWMBQGA1UEBxMNTW91bnRhaW4gVmlldzEUMBIGA1UEChMLUGF5UGFsIEluYy4xEzARBgNVBAsUCmxpdmVfY2VydHMxETAPBgNVBAMUCGxpdmVfYXBpMRwwGgYJKoZIhvcNAQkBFg1yZUBwYXlwYWwuY29tMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDBR07d/ETMS1ycjtkpkvjXZe9k+6CieLuLsPumsJ7QC1odNz3sJiCbs2wC0nLE0uLGaEtXynIgRqIddYCHx88pb5HTXv4SZeuv0Rqq4+axW9PLAAATU8w04qqjaSXgbGLP3NmohqM6bV9kZZwZLR/klDaQGo1u9uDb9lr4Yn+rBQIDAQABo4HuMIHrMB0GA1UdDgQWBBSWn3y7xm8XvVk/UtcKG+wQ1mSUazCBuwYDVR0jBIGzMIGwgBSWn3y7xm8XvVk/UtcKG+wQ1mSUa6GBlKSBkTCBjjELMAkGA1UEBhMCVVMxCzAJBgNVBAgTAkNBMRYwFAYDVQQHEw1Nb3VudGFpbiBWaWV3MRQwEgYDVQQKEwtQYXlQYWwgSW5jLjETMBEGA1UECxQKbGl2ZV9jZXJ0czERMA8GA1UEAxQIbGl2ZV9hcGkxHDAaBgkqhkiG9w0BCQEWDXJlQHBheXBhbC5jb22CAQAwDAYDVR0TBAUwAwEB/zANBgkqhkiG9w0BAQUFAAOBgQCBXzpWmoBa5e9fo6ujionW1hUhPkOBakTr3YCDjbYfvJEiv/2P+IobhOGJr85+XHhN0v4gUkEDI8r2/rNk1m0GA8HKddvTjyGw/XqXa+LSTlDYkqI8OwR8GEYj4efEtcRpRYBxV8KxAW93YDWzFGvruKnnLbDAF6VR5w/cCMn5hzGCAZowggGWAgEBMIGUMIGOMQswCQYDVQQGEwJVUzELMAkGA1UECBMCQ0ExFjAUBgNVBAcTDU1vdW50YWluIFZpZXcxFDASBgNVBAoTC1BheVBhbCBJbmMuMRMwEQYDVQQLFApsaXZlX2NlcnRzMREwDwYDVQQDFAhsaXZlX2FwaTEcMBoGCSqGSIb3DQEJARYNcmVAcGF5cGFsLmNvbQIBADAJBgUrDgMCGgUAoF0wGAYJKoZIhvcNAQkDMQsGCSqGSIb3DQEHATAcBgkqhkiG9w0BCQUxDxcNMTMxMDA4MTUwOTE1WjAjBgkqhkiG9w0BCQQxFgQUiz62NrfLtqFKo3ajhtRp1q7EJzkwDQYJKoZIhvcNAQEBBQAEgYBPmyE8cQbzBqmOu2G4U7UguyWIoWopnGd/4TSzOpekRgUGO1AuRSECyUOirZozJDRqxnSBkuh6LKU9BuSQKErrLYaWWY0eIsyr7g1tD6v0ZllRFdAAWznJnqsw5pligM0YItaZ7ARTbk1IQP4fKm3I0rRMirxNQE4k1/8BPIMzTA==-----END PKCS7-----
							">
							<input type="image" src="https://www.paypalobjects.com/en_US/i/btn/btn_donateCC_LG.gif" border="0" name="submit" alt="PayPal - The safer, easier way to pay online!">
							<img alt="" border="0" src="https://www.paypalobjects.com/it_IT/i/scr/pixel.gif" width="1" height="1">
						</form>
					</p>
				</div>
			</div>

		</div>
	</div>

<?php 
}
Example #29
0
<?php

/* Last updated with phpFlickr 1.3.2
 *
 * This example file shows you how to call the 100 most recent public
 * photos.  It parses through them and prints out a link to each of them
 * along with the owner's name.
 *
 * Most of the processing time in this file comes from the 100 calls to
 * flickr.people.getInfo.  Enabling caching will help a whole lot with
 * this as there are many people who post multiple photos at once.
 *
 */
require_once "phpFlickr.php";
$f = new phpFlickr("bb204b11214e836e196f0481fa7f90b4");
$recent = $f->photos_getRecent(NULL, 1, 1);
foreach ($recent['photo'] as $photo) {
    $owner = $f->people_getInfo($photo['owner']);
    echo "<a href='http://www.flickr.com/photos/" . $photo['owner'] . "/" . $photo['id'] . "/'>";
    echo $photo['title'];
    echo "</a> Owner: ";
    echo "<a href='http://www.flickr.com/people/" . $photo['owner'] . "/'>";
    echo $owner['username'];
    echo "</a><br>";
}
Example #30
0
<?php

require_once "lib/phpFlickr/phpFlickr.php";
$f = new phpFlickr("", NULL, false);
if ($this->attributes['details']['show'] == "automatic") {
    if (empty($this->attributes['details']['query']) && empty($this->attributes['details']['text'])) {
        print "No search terms were entered.";
    } else {
        if ($this->attributes['details']['searchtype'] == 'tags') {
            $photos = $f->photos_search(array("tags" => $this->attributes['details']['query'], "tag_mode" => $this->attributes['details']['boolean'], "extras" => "owner_name", "per_page" => $this->attributes['details']['max_photos']));
        } else {
            if ($this->attributes['details']['searchtype'] == 'text') {
                $tags = trim($this->attributes['details']['tags']);
                $photos = $f->photos_search(array("text" => $tags, "extras" => "owner_name", "per_page" => $this->attributes['details']['max_photos']));
            }
        }
        $isError = $f->getErrorMsg();
        if (!$isError && isset($photos['photo']) && count($photos['photo']) > 0) {
            echo "<table cellpadding='3' style='border: none; width: 100%'>\n<tr>";
            foreach ($photos['photo'] as $key => $photo) {
                ?>
            <td style="vertical-align: top; text-align: center; width: 33%">
				<a href="http://www.flickr.com/photos/<?php 
                echo $photo['owner'];
                ?>
/<?php 
                echo $photo['id'];
                ?>
">
                    <img style="padding: 1px; border: 1px solid black;" alt="<?php 
                echo $photo['title'] . " by " . $photo['ownername'];