You are here

function _media_flickr_error_check in Media: Flickr 7.2

Same name and namespace in other branches
  1. 7 includes/media_flickr.utilities.inc \_media_flickr_error_check()

This will log an error if we don't have a key yet. In addition, if the user is an admin, we'll display an error.

1 call to _media_flickr_error_check()
_media_flickr_sets_request in includes/media_flickr.utilities.inc
This is a wrapper for emfield_request_xml that includes flickr's api key.

File

includes/media_flickr.utilities.inc, line 109
Utility functions for Media: Flickr.

Code

function _media_flickr_error_check() {
  static $checked;
  if (is_null($checked)) {
    if (variable_get('media_flickr_api_key', '') == '') {
      $error = 'You do not yet have a Flickr API key set. You will need to !apply and enter your key at the !settings before Flickr images may be displayed.';
      $arguments = array(
        '!apply' => l(t('apply for a Flickr API key'), MEDIA_FLICKR_API_APPLICATION_URL),
        '!settings' => l(t('Flickr administration page'), 'admin/config/media/media-flickr'),
      );
      if (user_access('administer site configuration')) {
        drupal_set_message(t($error, $arguments), 'error');
      }
      watchdog('media_flickr', $error, $arguments);
      $checked = FALSE;
    }
    else {
      $checked = TRUE;
    }
  }
  return $checked;
}