Pakistan's former Prime Minister Imran Khan has been wounded in the foot after a gunman opened fired on a truck he was travelling in.