Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- class Badge
- {
- publi function addPoints ($name)
- {
- list ($base, $event) = explode('.', $name);
- include '/badges/' . $base . '.php'; // /badges/user.php
- $badge = new UserBadge();
- $points = $badge->trigger($event);
- if ($points)
- {
- // add points to user account
- }
- }
- }
- class BadgeSystem
- {
- public function trigger ($event)
- {
- return $this->$event();
- }
- }
- class UserBadges extends BadgeSystem
- {
- public function login ()
- {
- return 0;
- }
- }
- Badge::trackEvent('user.login');
Add Comment
Please, Sign In to add comment