Newcastle United midfielder Joey Barton has been given a four-month suspended sentence after admitting attacking a former team-mate.