A unified proof of conjectures on cycle lengths in graphs