Guest User

Untitled

a guest
Aug 16th, 2018
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.58 KB | None | 0 0
  1. <?php
  2.  
  3.  
  4. class Badge
  5. {
  6.    
  7.     publi function addPoints ($name)
  8.     {
  9.        
  10.         list ($base, $event) = explode('.', $name);
  11.        
  12.         include '/badges/' . $base . '.php'; // /badges/user.php
  13.        
  14.         $badge = new UserBadge();
  15.         $points = $badge->trigger($event);
  16.         if ($points)
  17.         {
  18.             // add points to user account
  19.         }
  20.        
  21.     }
  22.    
  23.    
  24.    
  25.    
  26. }
  27.  
  28. class BadgeSystem
  29. {
  30.    
  31.     public function trigger ($event)
  32.     {
  33.        
  34.         return $this->$event();
  35.        
  36.     }
  37.    
  38. }
  39.  
  40. class UserBadges extends BadgeSystem
  41. {
  42.    
  43.     public function login ()
  44.     {
  45.        
  46.         return 0;
  47.        
  48.     }
  49.    
  50. }
  51.  
  52.  
  53. Badge::trackEvent('user.login');
Add Comment
Please, Sign In to add comment