[ticket/11494] Use functions instead of repeating

PHPBB3-11494