Rewrite pieces like (an example from flickr.module):

  $location = !empty($country) ? ' ' . t('at') . ' ' . l($loc, 'https://www.flickr.com/photos/' . $info['owner']['nsid'] . '/map?&location=' . $neighbourhood . $locality . $region . $country, array(
    'attributes' => array(
      'title' => t('View photo on Flickr map.'),
      'target' => '_blank',
      'class' => array('flickr-location'),
    ),
  )) : '';
  // Compose extra Flickr info as HTML to render.
  $metadata = $taken . $location . ' ' . t('by') . ' ' . $username . '.';

to be:

  $loclink = l($loc, 'https://www.flickr.com/photos/' . $info['owner']['nsid'] . '/map?&location=' . $neighbourhood . $locality . $region . $country, array(
    'attributes' => array(
      'title' => t('View photo on Flickr map.'),
      'target' => '_blank',
      'class' => array('flickr-location'),
    ),
  ));
  $location = !empty($country) ? ' ' . t('at !loclink', array('!loclink' => $loclink)) . ' ' .  : '';
  // Compose extra Flickr info as HTML to render.
  $metadata = t('!taken !location by !username.', array('!taken' => $taken, '!location' => $location, '!username' => $username));