Plugin Directory

Changeset 1327415


Ignore:
Timestamp:
01/13/2016 11:14:56 AM (10 years ago)
Author:
phuisman
Message:

Added version 1.1.2: seperate caching for admin / front-end

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

Legend:

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

    r1325810 r1327415  
    2525        $this->defaults = array(
    2626            // add defaults here to merge into your field.
    27             'flickr_api_key'        => '',
    28             'flickr_user_id'        => '',
    29             'flickr_content_type'   => 'sets',
    30         'flickr_private_mode'   => 0,
    31       'flickr_secret_key'     => '',
    32       'flickr_private_token'  => '',
    33             'flickr_sets_amount'    => '9999',
    34             'flickr_max_selected'   => '0',
    35             'flickr_thumb_size'     => 'square',
    36             'flickr_large_size'     => 'large_1024',
    37             'flickr_show_limit'     => '500',
    38             'flickr_cache_enabled'  => '1',
    39             'flickr_cache_duration' => '168',
     27            'flickr_api_key'              => '',
     28            'flickr_user_id'              => '',
     29            'flickr_content_type'         => 'sets',
     30            'flickr_private_mode'         => 0,
     31            'flickr_secret_key'           => '',
     32            'flickr_private_token'        => '',
     33            'flickr_sets_amount'          => '9999',
     34            'flickr_max_selected'         => '0',
     35            'flickr_thumb_size'           => 'square',
     36            'flickr_large_size'           => 'large_1024',
     37            'flickr_show_limit'           => '500',
     38            'flickr_cache_enabled'        => '1',
     39            'flickr_admin_cache_duration' => '30',
     40            'flickr_cache_duration'       => '168',
    4041        );
    4142
     
    273274        <tr class="field_option field_option_<?php echo $this->name; ?>" data-name="flickr_cache_duration">
    274275            <td class="label">
    275                 <label><?php _e('Cache duration','acf-flickr'); ?></label>
    276                 <p class="description"><?php _e('The time your cache may last in minutes.', 'acf-flickr');?></p>
     276                <label><?php _e('Front-end cache duration','acf-flickr'); ?></label>
     277                <p class="description"><?php _e('The time your front-end cache may last in minutes (how visitors view the photos).', 'acf-flickr');?></p>
    277278            </td>
    278279            <td>
     
    282283                    'name'      =>  'fields['.$key.'][flickr_cache_duration]',
    283284                    'value'     =>  $field['flickr_cache_duration'],
     285                ));
     286                ?>
     287            </td>
     288        </tr>
     289        <tr class="field_option field_option_<?php echo $this->name; ?>" data-name="flickr_cache_duration">
     290            <td class="label">
     291                <label><?php _e('Admin cache duration','acf-flickr'); ?></label>
     292                <p class="description"><?php _e('The time your admin cache may last in minutes. This is usually lower than the front-end cache duration.', 'acf-flickr');?></p>
     293            </td>
     294            <td>
     295                <?php
     296                do_action('acf/create_field', array(
     297                    'type'      =>  'text',
     298                    'name'      =>  'fields['.$key.'][flickr_admin_cache_duration]',
     299                    'value'     =>  $field['flickr_admin_cache_duration'],
    284300                ));
    285301                ?>
     
    399415        }
    400416        if (is_writeable($cache_dir) && $field['flickr_cache_enabled'] == 1) {
    401             $duration = $field['flickr_cache_duration'] * 60 * 60;
     417            $admin_cache = isset($field['flickr_admin_cache_duration']) ? $field['flickr_admin_cache_duration'] : $field['flickr_cache_duration'];
     418            $duration = $admin_cache * 60 * 60;
    402419            $f->enableCache('fs', $cache_dir, $duration);
    403420        }
  • flickr-field-for-advanced-custom-fields/trunk/acf-flickr-v5.php

    r1327340 r1327415  
    4444
    4545        $this->defaults = array(
    46             'flickr_api_key'        => '',
    47             'flickr_user_id'        => '',
    48             'flickr_private_mode'   => 0,
    49             'flickr_secret_key'     => '',
    50             'flickr_private_token'  => '',
    51             'flickr_content_type'   => 'sets',
    52             'flickr_sets_amount'    => '9999',
    53             'flickr_max_selected'   => '0',
    54             'flickr_show_limit'     => '500',
    55             'flickr_thumb_size'     => 'square',
    56             'flickr_large_size'     => 'large_1024',
    57             'flickr_cache_enabled'  => '1',
    58             'flickr_cache_duration' => '168',
     46            'flickr_api_key'              => '',
     47            'flickr_user_id'              => '',
     48            'flickr_private_mode'         => 0,
     49            'flickr_secret_key'           => '',
     50            'flickr_private_token'        => '',
     51            'flickr_content_type'         => 'sets',
     52            'flickr_sets_amount'          => '9999',
     53            'flickr_max_selected'         => '0',
     54            'flickr_show_limit'           => '500',
     55            'flickr_thumb_size'           => 'square',
     56            'flickr_large_size'           => 'large_1024',
     57            'flickr_cache_enabled'        => '1',
     58            'flickr_admin_cache_duration' => '30',
     59            'flickr_cache_duration'       => '168',
    5960        );
    6061
     
    186187
    187188        acf_render_field_setting( $field, array(
    188             'label'        => __('Cache duration','acf-flickr'),
    189             'instructions' => __('The time your cache may last in minutes.','acf-flickr'),
     189            'label'        => __('Front-end cache duration','acf-flickr'),
     190            'instructions' => __('The time your front-end cache may last in minutes (how visitors view the photos).','acf-flickr'),
    190191            'type'         => 'text',
    191192            'name'         => 'flickr_cache_duration',
    192193            'class'        => 'flickr_cache_duration',
     194            'append'       => 'minutes',
     195        ));
     196
     197        acf_render_field_setting( $field, array(
     198            'label'        => __('Admin cache duration','acf-flickr'),
     199            'instructions' => __('The time your admin cache may last in minutes. This is usually lower than the front-end cache duration.','acf-flickr'),
     200            'type'         => 'text',
     201            'name'         => 'flickr_admin_cache_duration',
     202            'class'        => 'flickr_admin_cache_duration',
    193203            'append'       => 'minutes',
    194204        ));
     
    282292        }
    283293        if (is_writeable($cache_dir) && $field['flickr_cache_enabled'] == 1) {
    284             $duration = $field['flickr_cache_duration'] * 60 * 60;
     294            $admin_cache = isset($field['flickr_admin_cache_duration']) ? $field['flickr_admin_cache_duration'] : $field['flickr_cache_duration'];
     295            $duration = $admin_cache * 60 * 60;
    285296            $f->enableCache('fs', $cache_dir, $duration);
    286297        }
  • flickr-field-for-advanced-custom-fields/trunk/acf-flickr.php

    r1325811 r1327415  
    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.1
     6Version: 1.1.2
    77Author: Paul Huisman
    88Author URI: www.paulhuisman.com
  • flickr-field-for-advanced-custom-fields/trunk/css/options.css

    r1306180 r1327415  
    88  display: none;
    99}
     10[data-name="flickr_admin_cache_duration"] {
     11  display: none;
     12}
    1013.acf-field .description a {
    1114  text-decoration: underline;
  • flickr-field-for-advanced-custom-fields/trunk/js/options.js

    r1306180 r1327415  
    1515      if ($(this).is(':checked') && $(this).val() == '1') {
    1616        $wrap.parent().parent().parent().find('[data-name="flickr_cache_duration"]').css('display', 'table-row');
     17        $wrap.parent().parent().parent().find('[data-name="flickr_admin_cache_duration"]').css('display', 'table-row');
    1718      }
    1819    });
     
    2829    // Toggle hidden cache field(s)
    2930    $(this).parent().parent().parent().find('[data-name="flickr_cache_duration"]').toggle();
     31    $(this).parent().parent().parent().find('[data-name="flickr_admin_cache_duration"]').toggle();
    3032  });
    3133
  • flickr-field-for-advanced-custom-fields/trunk/readme.txt

    r1325811 r1327415  
    44Requires at least: 3.0.1
    55Tested up to: 4.4.1
    6 Stable tag: 1.1.1
     6Stable tag: 1.1.2
    77License: GPLv2 or later
    88License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    5858== Changelog ==
    5959
     60= 1.1.2 =
     61* Added seperate caching for the admin loading of flickr data. You now have a setting for front-end caching and admin (back-end) caching.
     62
    6063= 1.1.1 =
    6164* You can now (optionally) use constants for flickr api key, secret and api token (for private mode). This could be useful in a multisite environment.
Note: See TracChangeset for help on using the changeset viewer.