Changeset 1915438
- Timestamp:
- 07/26/2018 02:51:10 PM (8 years ago)
- Location:
- flickr-field-for-advanced-custom-fields/trunk
- Files:
-
- 4 edited
-
acf-flickr-v4.php (modified) (4 diffs)
-
acf-flickr-v5.php (modified) (4 diffs)
-
acf-flickr.php (modified) (1 diff)
-
readme.txt (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
flickr-field-for-advanced-custom-fields/trunk/acf-flickr-v4.php
r1327415 r1915438 184 184 <td class="label"> 185 185 <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 /galleriesthat 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> 187 187 </td> 188 188 <td> … … 194 194 'choices' => array( 195 195 'sets' => 'Sets', 196 'galleries' => 'Galleries',196 //'galleries' => 'Galleries', 197 197 'photostream' => 'Photostream', 198 198 ), … … 438 438 // Check for three types of Flickr content; Sets, Galleries and Photostream 439 439 if ($field['flickr_content_type'] == 'sets' || $field['flickr_content_type'] == 'galleries') { 440 440 441 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 )); 445 445 } 446 446 ?> … … 449 449 <tbody> 450 450 <?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) { 459 453 ?> 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; ?>"> 461 455 <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" /> 467 457 </td> 468 458 <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> 471 461 <p class="meta_data"> 472 <?php _e('Added on'); ?> <?php echo date_i18n(get_option('date_format') ,$flickr['date_create']); echo ' | ';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 ' | '; 463 echo $flickr->count_views; ?> <?php _e('views on Flickr'); 474 464 echo ' | '; 475 echo $flickr ['photos'];?> <?php _e('Photos');476 if ($flickr ['videos']!= 0) {477 echo ' | '. $flickr ['videos'].' ';465 echo $flickr->photos; ?> <?php _e('Photos'); 466 if ($flickr->videos != 0) { 467 echo ' | '. $flickr->videos .' '; 478 468 _e('Videos'); 479 469 } ?> -
flickr-field-for-advanced-custom-fields/trunk/acf-flickr-v5.php
r1869935 r1915438 131 131 acf_render_field_setting( $field, array( 132 132 'label' => __('Type of content','acf-flickr'), 133 'instructions' => __('Do you want to be able to select photos from the photostream or use sets /galleriesthat 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'), 134 134 'type' => 'select', 135 135 'name' => 'flickr_content_type', 136 136 'choices' => array( 137 //'sets' => 'Sets',137 'sets' => 'Sets', 138 138 //'galleries' => 'Galleries', 139 139 'photostream' => 'Photostream', … … 316 316 if ($field['flickr_content_type'] == 'sets' || $field['flickr_content_type'] == 'galleries') { 317 317 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 )); 322 321 } 323 322 ?> … … 326 325 <tbody> 327 326 <?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) { 336 329 ?> 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; ?>"> 338 331 <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" /> 344 333 </td> 345 334 <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> 348 337 <p class="meta_data"> 349 <?php _e('Added on'); ?> <?php echo date_i18n(get_option('date_format') ,$flickr['date_create']); echo ' | ';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 ' | '; 339 echo $flickr->count_views; ?> <?php _e('views on Flickr'); 351 340 echo ' | '; 352 echo $flickr ['photos'];?> <?php _e('Photos');353 if ($flickr ['videos']!= 0) {354 echo ' | '. $flickr ['videos'].' ';341 echo $flickr->photos; ?> <?php _e('Photos'); 342 if ($flickr->videos != 0) { 343 echo ' | '. $flickr->videos .' '; 355 344 _e('Videos'); 356 345 } ?> … … 400 389 data-flickr-original-url="<?php echo $photo['url_o']; ?>" 401 390 > 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'); ?>"> 403 392 </li> 404 393 <?php endforeach; ?> -
flickr-field-for-advanced-custom-fields/trunk/acf-flickr.php
r1869935 r1915438 4 4 Plugin URI: https://github.com/phuisman88/flickrfield 5 5 Description: Flickr field for Advanced Custom Fields. Display items from your photostream or entire sets/galleries along with your WordPress content. 6 Version: 1.1. 36 Version: 1.1.4 7 7 Author: Paul Huisman 8 8 Author URI: www.paulhuisman.com -
flickr-field-for-advanced-custom-fields/trunk/readme.txt
r1869935 r1915438 4 4 Requires at least: 3.0.1 5 5 Tested up to: 4.9.5 6 Stable tag: 1.1. 36 Stable tag: 1.1.4 7 7 License: GPLv2 or later 8 8 License URI: http://www.gnu.org/licenses/gpl-2.0.html … … 58 58 == Changelog == 59 59 60 = 1.1.4 = 61 * Fixed plugin so that sets work yet again. 62 60 63 = 1.1.3 = 61 64 * 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.