Changeset 1553833
- Timestamp:
- 12/13/2016 05:09:23 PM (9 years ago)
- Location:
- simple-flickr-display/trunk
- Files:
-
- 3 edited
-
README.txt (modified) (3 diffs)
-
css/simple-flickr-display.css (modified) (1 diff)
-
simple-flickr-display.php (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
simple-flickr-display/trunk/README.txt
r1222947 r1553833 4 4 Tags: flickr, images 5 5 Requires at least: 3.1 6 Tested up to: 4. 37 Stable tag: 1. 16 Tested up to: 4.7 7 Stable tag: 1.2 8 8 License: GPLv2 or later 9 9 License URI: http://www.gnu.org/licenses/gpl.html … … 13 13 == Description == 14 14 15 This slideruses the Flickr API to pull the most recent images that a user has uploaded. Simply type the Flickr username and number of photos that you would like to display and the plugin does the rest!15 This widget uses the Flickr API to pull the most recent images that a user has uploaded. Simply type the Flickr username and number of photos that you would like to display and the plugin does the rest! 16 16 17 17 = Options that can be set: = 18 18 * Widget Title 19 19 * Flickr User 20 * Number of Photos 20 * Number of Photos to display 21 21 22 22 == Installation == … … 36 36 == Changelog == 37 37 38 = 1.2 = 39 * Display formatting with flexbox 40 * Fixed PHP error thrown for incorrect username 41 * Title attribute added to images 42 38 43 = 1.1 = 39 44 * Clarification on public user profiles -
simple-flickr-display/trunk/css/simple-flickr-display.css
r716877 r1553833 1 1 /* Flickr widget */ 2 .flickr-photos { 3 overflow: hidden; 4 margin: 0; 5 padding: 0; 6 display: -webkit-box; 7 display: -moz-box; 8 display: -ms-flexbox; 9 display: -webkit-flex; 10 display: flex; 11 -webkit-flex-direction: row; 12 flex-direction: row; 13 flex-wrap: wrap; 14 -webkit-justify-content: space-around; 15 justify-content: space-between; 16 } 2 17 3 18 .flickr-photo { 4 19 list-style: none; 5 float: left; 6 padding: 2px; 7 border: 1px solid #D7D7D7; 8 margin: 0 10px 10px 0; 9 background: #FFF; 20 padding: 2px; 21 border: 1px solid #D7D7D7; 22 margin-bottom: 10px; 23 background: #FFFFFF; 10 24 transition: all 0.3s ease-in-out; 11 25 } -
simple-flickr-display/trunk/simple-flickr-display.php
r1222947 r1553833 4 4 Plugin URI: http://davidlaietta.com/plugins/ 5 5 Description: Installs a widget that you can place onto any sidebar and allows you to pull recent photos from Flickr. Light on settings/options, you can enter your username and the number of photos that you would like displayed. 6 Version: 1. 06 Version: 1.2 7 7 Author: David Laietta 8 8 Author URI: http://davidlaietta.com/ … … 11 11 License: GPL 12 12 License URI: http://www.gnu.org/licenses/gpl.html 13 14 Copyright 2013 (plugins@davidlaietta.com)15 13 16 14 This program is free software; you can redistribute it and/or modify … … 74 72 extract( $args, EXTR_SKIP ); 75 73 76 $title = apply_filters( 'widget_title', $instance['title']);74 $title = apply_filters( 'widget_title', $instance['title'] ); 77 75 $screen_name = $instance['screen_name']; 78 76 $number = $instance['number']; … … 84 82 wp_enqueue_style( 'simple-flickr-display-widget-styles' ); 85 83 86 if( $title) {87 echo $before_title .$title.$after_title;84 if( $title ) { 85 echo $before_title . $title . $after_title; 88 86 } 89 87 90 if( $screen_name && $number) {88 if( $screen_name && $number ) { 91 89 // Plugin Developer API Key 92 90 $api_key = '692b5728131fcd77dfdec0b6f6bc0cad'; 93 91 94 92 // Retrieve User 95 $person = wp_remote_get( 'https://api.flickr.com/services/rest/?method=flickr.people.findByUsername&api_key='.$api_key.'&username='.$screen_name.'&format=json');96 $person = trim( $person['body'], 'jsonFlickrApi()');97 $person = json_decode( $person);93 $person = wp_remote_get( 'https://api.flickr.com/services/rest/?method=flickr.people.findByUsername&api_key='.$api_key.'&username='.$screen_name.'&format=json' ); 94 $person = trim( $person['body'], 'jsonFlickrApi()' ); 95 $person = json_decode( $person ); 98 96 99 100 if($person->user->id) { 97 if( $person->stat != 'fail' && $person->user->id ) { 101 98 // Retrieve Photo URL 102 $photos_url = wp_remote_get('https://api.flickr.com/services/rest/?method=flickr.urls.getUserPhotos&api_key='.$api_key.'&user_id='.$person->user->id.'&format=json'); 103 $photos_url = trim($photos_url['body'], 'jsonFlickrApi()'); 104 $photos_url = json_decode($photos_url); 105 106 // var_dump($photos_url); 99 $photos_url = wp_remote_get( 'https://api.flickr.com/services/rest/?method=flickr.urls.getUserPhotos&api_key='.$api_key.'&user_id='.$person->user->id.'&format=json' ); 100 $photos_url = trim( $photos_url['body'], 'jsonFlickrApi()' ); 101 $photos_url = json_decode( $photos_url ); 107 102 108 103 // Retrieve Photos 109 $photos = wp_remote_get( 'https://api.flickr.com/services/rest/?method=flickr.people.getPublicPhotos&api_key='.$api_key.'&user_id='.$person->user->id.'&per_page='.$number.'&format=json');110 $photos = trim( $photos['body'], 'jsonFlickrApi()');111 $photos = json_decode( $photos);104 $photos = wp_remote_get( 'https://api.flickr.com/services/rest/?method=flickr.people.getPublicPhotos&api_key='.$api_key.'&user_id='.$person->user->id.'&per_page='.$number.'&format=json' ); 105 $photos = trim( $photos['body'], 'jsonFlickrApi()' ); 106 $photos = json_decode( $photos ); 112 107 113 108 // Create unordered list of selected photos 114 109 echo '<ul class="flickr-photos">'; 115 foreach( $photos->photos->photo as $photo): $photo = (array) $photo;110 foreach( $photos->photos->photo as $photo ): $photo = (array) $photo; 116 111 $url = "https://farm" . $photo['farm'] . ".static.flickr.com/" . $photo['server'] . "/" . $photo['id'] . "_" . $photo['secret'] . '_s' . ".jpg"; 117 112 echo '<li class="flickr-photo">'; 118 113 echo '<a href="' . $photos_url->user->url . $photo['id'] . '" target="_blank">'; 119 echo '<img src="' . $url . '" alt="' . $photo['title'] . '" />';114 echo '<img src="' . $url . '" alt="' . $photo['title'] . '" title="' . $photo['title'] . '" />'; 120 115 echo '</a>'; 121 116 echo '</li>'; … … 162 157 'number' => 6 163 158 ); 164 $instance = wp_parse_args( (array) $instance, $defaults);159 $instance = wp_parse_args( (array) $instance, $defaults ); 165 160 166 161 // Display the admin form
Note: See TracChangeset
for help on using the changeset viewer.