Plugin Directory

Changeset 1553833


Ignore:
Timestamp:
12/13/2016 05:09:23 PM (9 years ago)
Author:
davidjlaietta
Message:

updates to v1.2 with title attr, flexbox, PHP error fix, WPv4.7 compat

Location:
simple-flickr-display/trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • simple-flickr-display/trunk/README.txt

    r1222947 r1553833  
    44Tags: flickr, images
    55Requires at least: 3.1
    6 Tested up to: 4.3
    7 Stable tag: 1.1
     6Tested up to: 4.7
     7Stable tag: 1.2
    88License: GPLv2 or later
    99License URI: http://www.gnu.org/licenses/gpl.html
     
    1313== Description ==
    1414
    15 This slider 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!
     15This 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!
    1616
    1717= Options that can be set: =
    1818* Widget Title
    1919* Flickr User
    20 * Number of Photos
     20* Number of Photos to display
    2121
    2222== Installation ==
     
    3636== Changelog ==
    3737
     38= 1.2 =
     39* Display formatting with flexbox
     40* Fixed PHP error thrown for incorrect username
     41* Title attribute added to images
     42
    3843= 1.1 =
    3944* Clarification on public user profiles
  • simple-flickr-display/trunk/css/simple-flickr-display.css

    r716877 r1553833  
    11/* 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}
    217
    318.flickr-photo {
    419    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;
    1024    transition: all 0.3s ease-in-out;
    1125}
  • simple-flickr-display/trunk/simple-flickr-display.php

    r1222947 r1553833  
    44Plugin URI: http://davidlaietta.com/plugins/
    55Description: 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.0
     6Version: 1.2
    77Author: David Laietta
    88Author URI: http://davidlaietta.com/
     
    1111License: GPL
    1212License URI: http://www.gnu.org/licenses/gpl.html
    13 
    14 Copyright 2013 (plugins@davidlaietta.com)
    1513
    1614This program is free software; you can redistribute it and/or modify
     
    7472        extract( $args, EXTR_SKIP );
    7573
    76         $title = apply_filters('widget_title', $instance['title']);
     74        $title = apply_filters( 'widget_title', $instance['title'] );
    7775        $screen_name = $instance['screen_name'];
    7876        $number = $instance['number'];
     
    8482        wp_enqueue_style( 'simple-flickr-display-widget-styles' );
    8583
    86         if($title) {
    87             echo $before_title.$title.$after_title;
     84        if( $title ) {
     85            echo $before_title . $title . $after_title;
    8886        }
    8987
    90         if($screen_name && $number) {
     88        if( $screen_name && $number ) {
    9189            // Plugin Developer API Key
    9290            $api_key = '692b5728131fcd77dfdec0b6f6bc0cad';
    9391
    9492            // 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 );
    9896
    99 
    100             if($person->user->id) {
     97            if( $person->stat != 'fail' && $person->user->id ) {
    10198                // 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 );
    107102
    108103                // 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 );
    112107
    113108                // Create unordered list of selected photos
    114109                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;
    116111                        $url = "https://farm" . $photo['farm'] . ".static.flickr.com/" . $photo['server'] . "/" . $photo['id'] . "_" . $photo['secret'] . '_s' . ".jpg";
    117112                        echo '<li class="flickr-photo">';
    118113                            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'] . '" />';
    120115                            echo '</a>';
    121116                        echo '</li>';
     
    162157            'number' => 6
    163158        );
    164         $instance = wp_parse_args((array) $instance, $defaults);
     159        $instance = wp_parse_args( (array) $instance, $defaults );
    165160
    166161        // Display the admin form
Note: See TracChangeset for help on using the changeset viewer.