Changeset 1210231
- Timestamp:
- 07/31/2015 09:20:08 AM (11 years ago)
- Location:
- flickr-field-for-advanced-custom-fields/trunk
- Files:
-
- 2 edited
-
acf-flickr-v4.php (modified) (7 diffs)
-
acf-flickr-v5.php (modified) (8 diffs)
Legend:
- Unmodified
- Added
- Removed
-
flickr-field-for-advanced-custom-fields/trunk/acf-flickr-v4.php
r1208950 r1210231 24 24 $this->category = __("Content", 'acf'); // Basic, Content, Choice, etc 25 25 $this->defaults = array( 26 // add default here to merge into your field.26 // add defaults here to merge into your field. 27 27 'flickr_api_key' => '', 28 28 'flickr_user_id' => '', … … 32 32 'flickr_thumb_size' => 'square', 33 33 'flickr_large_size' => 'large_1024', 34 'flickr_show_limit' => '500', 34 35 'flickr_cache_enabled' => '1', 35 36 'flickr_cache_duration' => '168', … … 128 129 <td class="label"> 129 130 <label><?php _e( 'Display amount', 'acf-flickr' );?></label> 130 <p class="description"><?php _e('How many sets/photos do you want t o select from? The most recent items will be shown first.', 'acf-flickr');?></p>131 <p class="description"><?php _e('How many sets/photos do you want the admin to select from? The most recent items will be shown first.', 'acf-flickr');?></p> 131 132 </td> 132 133 <td> … … 152 153 <td class="label"> 153 154 <label><?php _e( 'Max selectable amount', 'acf-flickr' );?></label> 154 <p class="description"><?php _e('What\'s the maximum amount to be attached to a post ? Using 0 is default (and unlimited).', 'acf-flickr');?></p>155 <p class="description"><?php _e('What\'s the maximum amount to be attached to a post by the user? Using 0 is default (and unlimited).', 'acf-flickr');?></p> 155 156 </td> 156 157 <td> … … 250 251 'original' => 'Original', 251 252 ) 253 )); 254 ?> 255 </td> 256 </tr> 257 <tr class="field_option field_option_<?php echo $this->name; ?>"> 258 <td class="label"> 259 <label><?php _e( 'Maximum amount of photos in the set to load', 'acf-flickr' );?></label> 260 <p class="description"><?php _e('For sets only: How many photos should be loaded when viewing the set? Flickr allows a maximum of 500.', 'acf-flickr');?></p> 261 </td> 262 <td> 263 <?php 264 do_action('acf/create_field', array( 265 'type' => 'text', 266 'name' => 'fields['.$key.'][flickr_show_limit]', 267 'value' => $field['flickr_show_limit'], 252 268 )); 253 269 ?> … … 541 557 $data = array(); 542 558 543 $data['items'] = $value; 544 $data['type'] = $field['flickr_content_type']; 545 $data['thumb_size'] = $field['flickr_thumb_size']; 546 $data['large_size'] = $field['flickr_large_size']; 547 $data['user_id'] = $field['flickr_user_id']; 548 $data['api_key'] = $field['flickr_api_key']; 559 $data['items'] = $value; 560 $data['type'] = $field['flickr_content_type']; 561 $data['flickr_show_limit'] = $field['flickr_show_limit']; 562 $data['thumb_size'] = $field['flickr_thumb_size']; 563 $data['large_size'] = $field['flickr_large_size']; 564 $data['user_id'] = $field['flickr_user_id']; 565 $data['api_key'] = $field['flickr_api_key']; 549 566 550 567 return $data; … … 585 602 586 603 if ($value['type'] == 'sets' || $value['type'] == 'galleries') { 604 // Set default to get if flickr_show_limit does not exist 605 if(!isset($value['flickr_show_limit'])) { 606 $value['flickr_show_limit'] = '500'; 607 } 608 587 609 // Get photos from Flickr based on set/gallery id 588 610 $sets = array(); 589 611 foreach($value['items'] as $id) { 590 612 if ($value['type'] == 'sets') { 591 $photos = $f->photosets_getPhotos($id, 'url_o' );613 $photos = $f->photosets_getPhotos($id, 'url_o', null, $value['flickr_show_limit']); 592 614 $name = 'photoset'; 593 615 } 594 616 elseif ($value['type'] == 'galleries') { 595 $photos = $f->galleries_getPhotos($id, 'url_o' );617 $photos = $f->galleries_getPhotos($id, 'url_o', $value['flickr_show_limit']); 596 618 $name = 'photos'; 597 619 } -
flickr-field-for-advanced-custom-fields/trunk/acf-flickr-v5.php
r1208950 r1210231 49 49 'flickr_sets_amount' => '9999', 50 50 'flickr_max_selected' => '0', 51 'flickr_show_limit' => '500', 51 52 'flickr_thumb_size' => 'square', 52 53 'flickr_large_size' => 'large_1024', … … 107 108 acf_render_field_setting( $field, array( 108 109 'label' => __('Display amount','acf-flickr'), 109 'instructions' => __('How many sets/photos do you want t o select from? The most recent items will be shown first.','acf-flickr'),110 'instructions' => __('How many sets/photos do you want the admin to select from? The most recent items will be shown first.','acf-flickr'), 110 111 'type' => 'select', 111 112 'name' => 'flickr_sets_amount', … … 123 124 acf_render_field_setting( $field, array( 124 125 'label' => __('Max selectable amount','acf-flickr'), 125 'instructions' => __('What\'s the maximum amount to be attached to a post ? Using 0 is default (and unlimited).','acf-flickr'),126 'instructions' => __('What\'s the maximum amount to be attached to a post by the user? Using 0 is default (and unlimited).','acf-flickr'), 126 127 'type' => 'text', 127 128 'name' => 'flickr_max_selected', … … 153 154 'name' => 'flickr_cache_duration', 154 155 'append' => 'minutes', 156 )); 157 158 acf_render_field_setting( $field, array( 159 'label' => __('Maximum amount of photos in the set to load', 'acf-flickr'), 160 'instructions' => __('For sets only: How many photos should be loaded when viewing the set? Flickr allows a maximum of 500.', 'acf-flickr'), 161 'type' => 'text', 162 'name' => 'flickr_show_limit', 155 163 )); 156 164 … … 183 191 )); 184 192 185 186 187 } 188 193 } 189 194 190 195 … … 526 531 $data = array(); 527 532 528 $data['items'] = $value; 529 $data['type'] = $field['flickr_content_type']; 530 $data['thumb_size'] = $field['flickr_thumb_size']; 531 $data['large_size'] = $field['flickr_large_size']; 532 $data['user_id'] = $field['flickr_user_id']; 533 $data['api_key'] = $field['flickr_api_key']; 533 $data['items'] = $value; 534 $data['type'] = $field['flickr_content_type']; 535 $data['flickr_show_limit'] = $field['flickr_show_limit']; 536 $data['thumb_size'] = $field['flickr_thumb_size']; 537 $data['large_size'] = $field['flickr_large_size']; 538 $data['user_id'] = $field['flickr_user_id']; 539 $data['api_key'] = $field['flickr_api_key']; 534 540 535 541 return $data; … … 584 590 function format_value( $value, $post_id, $field ) { 585 591 // bail early if no value 586 if( empty($value)) {592 if(empty($value)) { 587 593 return $value; 588 594 } … … 603 609 604 610 if ($value['type'] == 'sets' || $value['type'] == 'galleries') { 611 // Set default to get if flickr_show_limit does not exist 612 if(!isset($value['flickr_show_limit'])) { 613 $value['flickr_show_limit'] = '500'; 614 } 615 605 616 // Get photos from Flickr based on set/gallery id 606 617 $sets = array(); 607 618 foreach($value['items'] as $id) { 608 619 if ($value['type'] == 'sets') { 609 $photos = $f->photosets_getPhotos($id, 'url_o' );620 $photos = $f->photosets_getPhotos($id, 'url_o', null, $value['flickr_show_limit']); 610 621 $name = 'photoset'; 611 622 } 612 623 elseif ($value['type'] == 'galleries') { 613 $photos = $f->galleries_getPhotos($id, 'url_o' );624 $photos = $f->galleries_getPhotos($id, 'url_o', $value['flickr_show_limit']); 614 625 $name = 'photos'; 615 626 }
Note: See TracChangeset
for help on using the changeset viewer.