Plugin Directory

Changeset 1325810


Ignore:
Timestamp:
01/11/2016 01:26:11 PM (10 years ago)
Author:
phuisman
Message:

Updated constants so you can use Flickr api, secret

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

Legend:

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

    r1306209 r1325810  
    115115            <td class="label">
    116116                <label><?php _e('Flickr API Key','acf-flickr'); ?><span class="required">*</span></label>
    117                 <p class="description"><?php _e('Find or register your API key at <a href="http://www.flickr.com/services/apps/" target="_blank">http://www.flickr.com/services/apps</a>', 'acf-flickr');?></p>
     117                <p class="description"><?php _e('Find or register your API key at <a href="http://www.flickr.com/services/apps/" target="_blank">http://www.flickr.com/services/apps</a>', 'acf-flickr');?>.  Alternatively, you can set the constant <strong>FLICKR_FIELD_API_KEY</strong>.</p>
    118118            </td>
    119119            <td>
     
    151151            <td class="label">
    152152                <label><?php _e('Flickr Secret Key','acf-flickr'); ?><span class="required">*</span></label>
    153                 <p class="description"><?php _e('Find or register your secret key at <a href="http://www.flickr.com/services/apps/" target="_blank">http://www.flickr.com/services/apps</a>', 'acf-flickr');?></p>
     153                <p class="description"><?php _e('Find or register your secret key at <a href="http://www.flickr.com/services/apps/" target="_blank">http://www.flickr.com/services/apps</a>', 'acf-flickr');?>.  Alternatively, you can set the constant <strong>FLICKR_FIELD_SECRET</strong>.</p>
    154154            </td>
    155155            <td>
     
    369369        $field['optgroup'] = isset($field['optgroup']) ? $field['optgroup'] : false;
    370370
     371        // Check constants
     372        if(defined('FLICKR_FIELD_API_KEY')) {
     373            $field['flickr_api_key'] = FLICKR_FIELD_API_KEY;
     374        }
     375        if(defined('FLICKR_FIELD_SECRET')) {
     376            $field['flickr_secret_key'] = FLICKR_FIELD_SECRET;
     377        }
     378        if(defined('FLICKR_FIELD_API_TOKEN')) {
     379            $field['flickr_private_token'] = FLICKR_FIELD_API_TOKEN;
     380        }
     381
    371382        // Get all Flickr sets by the given user ID and api key (both required)
    372383        require_once(dirname(__FILE__) . '/phpflickr/phpFlickr.php');
     
    421432                    <tbody>
    422433                        <?php
    423                         if (is_array($flickr_data) && !empty($flickr_data)) {
     434                        if (is_array($flickr_data) && (!empty($flickr_data['photoset']) || !empty($flickr_data['galleries']['gallery']))) {
    424435                            if ($field['flickr_content_type'] == 'sets') {
    425436                                $data = $flickr_data['photoset'];
     
    458469                        else {
    459470                            ?><tr class="field_label">
    460                                 <td colspan="2"><?php _e('There are no Flickr sets available for user ID'); ?> <?php echo $field['flickr_user_id']; ?> <?php _e('or there is a problem with API KEY'); ?> <?php echo $field['api_key']; ?></td>
     471                                <td colspan="2"><?php _e('There is no Flickr data available for user ID'); ?> <em><?php echo $field['flickr_user_id']; ?></em> <?php _e('or there is a problem with api key'); ?> <em><?php echo $field['flickr_api_key']; ?></em></td>
    461472                            </tr><?php
    462473                        }
     
    503514                    </ul>
    504515                <?php else: ?>
    505                     <p><?php _e('There are no Flickr sets available for user ID'); ?> <?php echo $field['flickr_user_id']; ?> <?php _e('or there is a problem with API KEY'); ?> <?php echo $field['api_key']; ?></p>
     516                    <p><?php _e('There is no Flickr data available for user ID'); ?> <?php echo $field['flickr_user_id']; ?> <?php _e('or there is a problem with api key'); ?> <?php echo $field['api_key']; ?></p>
    506517                <?php
    507518                endif;
     
    696707            require_once(dirname(__FILE__) . '/phpflickr/phpFlickr.php');
    697708
     709            // Check constants
     710            if(defined('FLICKR_FIELD_API_KEY')) {
     711                $value['api_key'] = FLICKR_FIELD_API_KEY;
     712            }
     713            if(defined('FLICKR_FIELD_SECRET')) {
     714                $value['secret_key'] = FLICKR_FIELD_SECRET;
     715            }
     716            if(defined('FLICKR_FIELD_API_TOKEN')) {
     717                $value['private_token'] = FLICKR_FIELD_API_TOKEN;
     718            }
     719
    698720            if($value['private_mode']) {
    699721                // Private Mode
  • flickr-field-for-advanced-custom-fields/trunk/acf-flickr-v5.php

    r1306209 r1325810  
    9292            'required'  => true,
    9393            'label'         => __('Flickr API Key','acf-flickr'),
    94             'instructions'  => __('Find or register your API key at','acf-flickr') . ' <a href="http://www.flickr.com/services/apps/" target="_blank">http://www.flickr.com/services/apps</a>',
     94            'instructions'  => __('Find or register your API key at','acf-flickr') . ' <a href="http://www.flickr.com/services/apps/" target="_blank">http://www.flickr.com/services/apps</a>. Alternatively, you can set the constant <strong>FLICKR_FIELD_API_KEY</strong>.',
    9595            'type'          => 'text',
    9696            'name'          => 'flickr_api_key',
     
    112112        acf_render_field_setting( $field, array(
    113113            'label'        => __('Flickr Secret Key','acf-flickr'),
    114             'instructions' => __('Find or register your Secret key at','acf-flickr') . ' <a href="http://www.flickr.com/services/apps/" target="_blank">http://www.flickr.com/services/apps</a>',
     114            'instructions' => __('Find or register your Secret key at','acf-flickr') . ' <a href="http://www.flickr.com/services/apps/" target="_blank">http://www.flickr.com/services/apps</a>. Alternatively, you can set the constant <strong>FLICKR_FIELD_SECRET</strong>.',
    115115            'type'         => 'text',
    116116            'name'         => 'flickr_secret_key',
     
    254254        // Get all Flickr sets by the given user ID and api key (both required)
    255255        require_once(dirname(__FILE__) . '/phpflickr/phpFlickr.php');
     256
     257        // Check constants
     258        if(defined('FLICKR_FIELD_API_KEY')) {
     259            $field['flickr_api_key'] = FLICKR_FIELD_API_KEY;
     260        }
     261        if(defined('FLICKR_FIELD_SECRET')) {
     262            $field['flickr_secret_key'] = FLICKR_FIELD_SECRET;
     263        }
     264        if(defined('FLICKR_FIELD_API_TOKEN')) {
     265            $field['flickr_private_token'] = FLICKR_FIELD_API_TOKEN;
     266        }
    256267
    257268        if(isset($field['flickr_private_mode']) && $field['flickr_private_mode'] == true) {
     
    341352                        else {
    342353                            ?><tr class="field_label">
    343                                 <td colspan="2"><?php _e('There are no Flickr sets available for user ID'); ?> <?php echo $field['flickr_user_id']; ?> <?php _e('or there is a problem with API KEY'); ?> <?php echo $field['api_key']; ?></td>
     354                                <td colspan="2"><?php _e('There is no Flickr data available for user ID'); ?> <em><?php echo $field['flickr_user_id']; ?></em> <?php _e('or there is a problem with api key'); ?> <em><?php echo $field['flickr_api_key']; ?></em></td>
    344355                            </tr><?php
    345356                        }
     
    383394                    </ul>
    384395                <?php else: ?>
    385                     <p><?php _e('There are no Flickr sets available for user ID'); ?> <?php echo $field['flickr_user_id']; ?> <?php _e('or there is a problem with API KEY'); ?> <?php echo $field['api_key']; ?></p>
     396                    <p><?php _e('There is no Flickr data available for user ID'); ?> <?php echo $field['flickr_user_id']; ?> <?php _e('or there is a problem with api key'); ?> <?php echo $field['flickr_api_key']; ?></p>
    386397                <?php
    387398                endif;
     
    664675            require_once(dirname(__FILE__) . '/phpflickr/phpFlickr.php');
    665676
     677            // Check constants
     678            if(defined('FLICKR_FIELD_API_KEY')) {
     679                $value['api_key'] = FLICKR_FIELD_API_KEY;
     680            }
     681            if(defined('FLICKR_FIELD_SECRET')) {
     682                $value['secret_key'] = FLICKR_FIELD_SECRET;
     683            }
     684            if(defined('FLICKR_FIELD_API_TOKEN')) {
     685                $value['private_token'] = FLICKR_FIELD_API_TOKEN;
     686            }
     687
    666688            if($value['private_mode']) {
    667689                // Private Mode
Note: See TracChangeset for help on using the changeset viewer.