MOODLE2: Adapting code to php 5.3.3