replace depracated functions for Moodle 2.6