function __get($key) { if (empty($this->{$key})) { switch ($key) { case 'email': $this->{$key} = LP_Email::instance(); break; case 'checkout': $this->{$key} = LP_Checkout::instance(); break; case 'course': if (is_course()) { $this->{$key} = LP_Course::get_course(get_the_ID()); } break; case 'quiz': if (is_quiz()) { $this->{$key} = LP_Quiz::get_quiz(get_the_ID()); } break; } } return !empty($this->{$key}) ? $this->{$key} : false; }