Plugin Directory

Changeset 1915438


Ignore:
Timestamp:
07/26/2018 02:51:10 PM (8 years ago)
Author:
phuisman
Message:

Fixed sets

Location:
flickr-field-for-advanced-custom-fields/trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • flickr-field-for-advanced-custom-fields/trunk/acf-flickr-v4.php

    r1327415 r1915438  
    184184            <td class="label">
    185185                <label><?php _e( 'Type of content', 'acf-flickr' );?></label>
    186                 <p class="description"><?php _e('Do you want to be able to select photos from the photostream or use sets/galleries that have already been created on Flickr?', 'acf-flickr');?></p>
     186                <p class="description"><?php _e('Do you want to be able to select photos from the photostream or use sets that have already been created on Flickr?', 'acf-flickr');?></p>
    187187            </td>
    188188            <td>
     
    194194                    'choices' => array(
    195195                        'sets'        => 'Sets',
    196                         'galleries'   => 'Galleries',
     196                        //'galleries'   => 'Galleries',
    197197                        'photostream' => 'Photostream',
    198198                    ),
     
    438438            // Check for three types of Flickr content; Sets, Galleries and Photostream
    439439            if ($field['flickr_content_type'] == 'sets' || $field['flickr_content_type'] == 'galleries') {
     440               
    440441                if ($field['flickr_content_type'] == 'sets') {
    441                     $flickr_data = $f->photosets_getList($field['flickr_user_id'], $field['flickr_sets_amount'], 1);
    442                 }
    443                 elseif ($field['flickr_content_type'] == 'galleries') {
    444                     $flickr_data = $f->galleries_getList($field['flickr_user_id'], $field['flickr_sets_amount'], 1);
     442                    $flickr_api_request  = 'https://api.flickr.com/services/rest/?method=flickr.photosets.getList&api_key=' . $field['flickr_api_key'] . '&user_id=' . $field['flickr_user_id'] . '&format=json&nojsoncallback=1';
     443                    $flickr_api_response = wp_remote_get( $flickr_api_request );
     444                    $flickr_data = json_decode(wp_remote_retrieve_body( $flickr_api_response ));
    445445                }
    446446                ?>
     
    449449                    <tbody>
    450450                        <?php
    451                         if (is_array($flickr_data) && (!empty($flickr_data['photoset']) || !empty($flickr_data['galleries']['gallery']))) {
    452                             if ($field['flickr_content_type'] == 'sets') {
    453                                 $data = $flickr_data['photoset'];
    454                             }
    455                             elseif ($field['flickr_content_type'] == 'galleries') {
    456                                 $data = $flickr_data['galleries']['gallery'];
    457                             }
    458                             foreach($data as $key => $flickr) {
     451                        if (!empty($flickr_data)) {
     452                            foreach($flickr_data->photosets->photoset as $key => $flickr) {
    459453                                ?>
    460                                 <tr class="field_label flickr_row <?php if (isset($flickr['id']) && in_array($flickr['id'], $items)) echo 'active-row'; ?>" data-flickr-id="<?php echo $flickr['id']; ?>">
     454                                <tr class="field_label flickr_row <?php echo (isset($flickr->id) && in_array($flickr->id, $items)) ? 'active-row' : ''; ?>" data-flickr-id="<?php echo $flickr->id; ?>">
    461455                                    <td class="label set_image">
    462                                         <?php if ($field['flickr_content_type'] == 'sets'): ?>
    463                                             <img title="<?php echo $flickr['title'];?>" src="http://farm<?php echo $flickr['farm'];?>.static.flickr.com/<?php echo $flickr['server'];?>/<?php echo $flickr['primary'];?>_<?php echo $flickr['secret'];?>_s.jpg">
    464                                         <?php else: ?>
    465                                             <img title="<?php echo $flickr['title'];?>" src="http://farm<?php echo $flickr['primary_photo_farm'];?>.static.flickr.com/<?php echo $flickr['primary_photo_server'];?>/<?php echo $flickr['primary_photo_id'];?>_<?php echo $flickr['primary_photo_secret'];?>_s.jpg">
    466                                         <?php endif; ?>
     456                                        <img title="<?php echo $flickr->title_content; ?>" src="http://farm<?php echo $flickr->farm; ?>.static.flickr.com/<?php echo $flickr->server; ?>/<?php echo $flickr->primary; ?>_<?php echo $flickr->secret; ?>_s.jpg" />
    467457                                    </td>
    468458                                    <td class="set_info">
    469                                         <p class="set_title"><?php echo $flickr['title'];?></p>
    470                                         <p class="description"><?php echo $flickr['description'];?></p>
     459                                        <p class="set_title"><?php echo $flickr->title->_content; ?></p>
     460                                        <p class="description"><?php echo $flickr->description->_content; ?></p>
    471461                                        <p class="meta_data">
    472                                             <?php _e('Added on');?> <?php echo date_i18n(get_option('date_format') ,$flickr['date_create']); echo ' &nbsp;|&nbsp; ';
    473                                             echo $flickr['count_views'];?> <?php _e('views on Flickr');
     462                                            <?php _e('Added on'); ?> <?php echo date_i18n(get_option('date_format'), $flickr->date_create); echo ' &nbsp;|&nbsp; ';
     463                                            echo $flickr->count_views; ?> <?php _e('views on Flickr');
    474464                                            echo ' &nbsp;|&nbsp; ';
    475                                             echo $flickr['photos'];?> <?php _e('Photos');
    476                                             if ($flickr['videos'] != 0) {
    477                                                 echo ' &nbsp;|&nbsp; '. $flickr['videos'] .' ';
     465                                            echo $flickr->photos; ?> <?php _e('Photos');
     466                                            if ($flickr->videos != 0) {
     467                                                echo ' &nbsp;|&nbsp; '. $flickr->videos .' ';
    478468                                                _e('Videos');
    479469                                            } ?>
  • flickr-field-for-advanced-custom-fields/trunk/acf-flickr-v5.php

    r1869935 r1915438  
    131131        acf_render_field_setting( $field, array(
    132132            'label'         => __('Type of content','acf-flickr'),
    133             'instructions'  => __('Do you want to be able to select photos from the photostream or use sets/galleries that have already been created on Flickr?','acf-flickr'),
     133            'instructions'  => __('Do you want to be able to select photos from the photostream or use sets that have already been created on Flickr?','acf-flickr'),
    134134            'type'          => 'select',
    135135            'name'          => 'flickr_content_type',
    136136            'choices'   => array(
    137                 //'sets'        => 'Sets',
     137                'sets'        => 'Sets',
    138138                //'galleries'   => 'Galleries',
    139139                'photostream' => 'Photostream',
     
    316316            if ($field['flickr_content_type'] == 'sets' || $field['flickr_content_type'] == 'galleries') {
    317317                if ($field['flickr_content_type'] == 'sets') {
    318                     $flickr_data = $f->photosets_getList($field['flickr_user_id'], $field['flickr_sets_amount'], 1);
    319                 }
    320                 elseif ($field['flickr_content_type'] == 'galleries') {
    321                     $flickr_data = $f->galleries_getList($field['flickr_user_id'], $field['flickr_sets_amount'], 1);
     318                    $flickr_api_request  = 'https://api.flickr.com/services/rest/?method=flickr.photosets.getList&api_key=' . $field['flickr_api_key'] . '&user_id=' . $field['flickr_user_id'] . '&format=json&nojsoncallback=1';
     319                    $flickr_api_response = wp_remote_get( $flickr_api_request );
     320                    $flickr_data = json_decode(wp_remote_retrieve_body( $flickr_api_response ));
    322321                }
    323322                ?>
     
    326325                    <tbody>
    327326                        <?php
    328                         if (is_array($flickr_data) && (!empty($flickr_data['photoset']) || !empty($flickr_data['galleries']['gallery']))) {
    329                             if ($field['flickr_content_type'] == 'sets') {
    330                                 $data = $flickr_data['photoset'];
    331                             }
    332                             elseif ($field['flickr_content_type'] == 'galleries') {
    333                                 $data = $flickr_data['galleries']['gallery'];
    334                             }
    335                             foreach($data as $key => $flickr) {
     327                        if (!empty($flickr_data)) {
     328                            foreach($flickr_data->photosets->photoset as $key => $flickr) {
    336329                                ?>
    337                                 <tr class="field_label flickr_row <?php if (isset($flickr['id']) && in_array($flickr['id'], $items)) echo 'active-row'; ?>" data-flickr-id="<?php echo $flickr['id']; ?>">
     330                                <tr class="field_label flickr_row <?php echo (isset($flickr->id) && in_array($flickr->id, $items)) ? 'active-row' : ''; ?>" data-flickr-id="<?php echo $flickr->id; ?>">
    338331                                    <td class="label set_image">
    339                                         <?php if ($field['flickr_content_type'] == 'sets'): ?>
    340                                             <img title="<?php echo $flickr['title'];?>" src="http://farm<?php echo $flickr['farm'];?>.static.flickr.com/<?php echo $flickr['server'];?>/<?php echo $flickr['primary'];?>_<?php echo $flickr['secret'];?>_s.jpg">
    341                                         <?php else: ?>
    342                                             <img title="<?php echo $flickr['title'];?>" src="http://farm<?php echo $flickr['primary_photo_farm'];?>.static.flickr.com/<?php echo $flickr['primary_photo_server'];?>/<?php echo $flickr['primary_photo_id'];?>_<?php echo $flickr['primary_photo_secret'];?>_s.jpg">
    343                                         <?php endif; ?>
     332                                        <img title="<?php echo $flickr->title_content; ?>" src="http://farm<?php echo $flickr->farm; ?>.static.flickr.com/<?php echo $flickr->server; ?>/<?php echo $flickr->primary; ?>_<?php echo $flickr->secret; ?>_s.jpg" />
    344333                                    </td>
    345334                                    <td class="set_info">
    346                                         <p class="set_title"><?php echo $flickr['title'];?></p>
    347                                         <p class="description"><?php echo $flickr['description'];?></p>
     335                                        <p class="set_title"><?php echo $flickr->title->_content; ?></p>
     336                                        <p class="description"><?php echo $flickr->description->_content; ?></p>
    348337                                        <p class="meta_data">
    349                                             <?php _e('Added on');?> <?php echo date_i18n(get_option('date_format') ,$flickr['date_create']); echo ' &nbsp;|&nbsp; ';
    350                                             echo $flickr['count_views'];?> <?php _e('views on Flickr');
     338                                            <?php _e('Added on'); ?> <?php echo date_i18n(get_option('date_format'), $flickr->date_create); echo ' &nbsp;|&nbsp; ';
     339                                            echo $flickr->count_views; ?> <?php _e('views on Flickr');
    351340                                            echo ' &nbsp;|&nbsp; ';
    352                                             echo $flickr['photos'];?> <?php _e('Photos');
    353                                             if ($flickr['videos'] != 0) {
    354                                                 echo ' &nbsp;|&nbsp; '. $flickr['videos'] .' ';
     341                                            echo $flickr->photos; ?> <?php _e('Photos');
     342                                            if ($flickr->videos != 0) {
     343                                                echo ' &nbsp;|&nbsp; '. $flickr->videos .' ';
    355344                                                _e('Videos');
    356345                                            } ?>
     
    400389                                data-flickr-original-url="<?php echo $photo['url_o']; ?>"
    401390                                >
    402                                 <img title="<?php echo $photo['title'];?>" src="<?php echo $f->buildPhotoURL($photo, 'square'); ?>">
     391                                <img title="<?php echo $photo['title']; ?>" src="<?php echo $f->buildPhotoURL($photo, 'square'); ?>">
    403392                            </li>
    404393                        <?php endforeach; ?>
  • flickr-field-for-advanced-custom-fields/trunk/acf-flickr.php

    r1869935 r1915438  
    44Plugin URI: https://github.com/phuisman88/flickrfield
    55Description: Flickr field for Advanced Custom Fields. Display items from your photostream or entire sets/galleries along with your WordPress content.
    6 Version: 1.1.3
     6Version: 1.1.4
    77Author: Paul Huisman
    88Author URI: www.paulhuisman.com
  • flickr-field-for-advanced-custom-fields/trunk/readme.txt

    r1869935 r1915438  
    44Requires at least: 3.0.1
    55Tested up to: 4.9.5
    6 Stable tag: 1.1.3
     6Stable tag: 1.1.4
    77License: GPLv2 or later
    88License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    5858== Changelog ==
    5959
     60= 1.1.4 =
     61* Fixed plugin so that sets work yet again.
     62
    6063= 1.1.3 =
    6164* Updated phpFlickr class and disabled sets/galleries temporarily because they fail to work with Flickr api changes
Note: See TracChangeset for help on using the changeset viewer.