Beispiel #1
0
 public function setUp()
 {
     // Create profile
     $this->profile = new Profile();
     // Create and add Habbo
     $habbo = new Habbo();
     $habbo->parse(self::$data['user']);
     $this->profile->setHabbo($habbo);
     // Create and add all Badge
     foreach (self::$data['badges'] as $badge_data) {
         $badge = new Badge();
         $badge->parse($badge_data);
         $this->profile->addBadge($badge);
     }
     // Create and add all Groups
     foreach (self::$data['groups'] as $group_data) {
         $group = new Group();
         $group->parse($group_data);
         $this->profile->addGroup($group);
     }
     // Create and add all Friends
     foreach (self::$data['friends'] as $friend_data) {
         $friend = new Habbo();
         $friend->parse($friend_data);
         $this->profile->addFriend($friend);
     }
     // Create and add all Rooms
     foreach (self::$data['rooms'] as $room_data) {
         $room = new Room();
         $room->parse($room_data);
         $this->profile->addRoom($room);
     }
 }
Beispiel #2
0
 /**
  * Parses the Habbo Profile endpoints
  *
  * Return an associative array including a Habbo entity and 4 arrays with Group, Friend, Room, Badge entities
  *
  * @param string $id
  * @return array
  */
 public function parseProfile($id)
 {
     // Collect JSON
     list($data) = $this->_callUrl($this->api_base . '/api/public/users/' . $id . '/profile', true);
     // Create Profile entity
     $profile = new Profile();
     // Habbo
     $habbo = new Habbo();
     $habbo->parse($data['user']);
     $profile->setHabbo($habbo);
     // Friends
     foreach ($data['friends'] as $friend) {
         $temp_friend = new Habbo();
         $temp_friend->parse($friend);
         $profile->addFriend($temp_friend);
     }
     // Groups
     foreach ($data['groups'] as $group) {
         $temp_group = new Group();
         $temp_group->parse($group);
         $profile->addGroup($temp_group);
     }
     // Rooms
     foreach ($data['rooms'] as $room) {
         $temp_room = new Room();
         $temp_room->parse($room);
         $profile->addRoom($temp_room);
     }
     // Badges
     foreach ($data['badges'] as $badge) {
         $temp_badge = new Badge();
         $temp_badge->parse($badge);
         $profile->addBadge($temp_badge);
     }
     // Return the Profile
     return $profile;
 }
Beispiel #3
0
        <p>Oops. Can not find this Habbo!</p>
        <p>Try to catch this exception gracefully in your application!</p>
        <p>[' . $e->getCode() . '] ' . $e->getMessage() . '</p>
        <hr>
        ' . $e->getTraceAsString() . '
    ';
    exit;
}
if ($myHabbo->hasProfile()) {
    // Collect all the profile info
    /** @var Profile $myProfile */
    $myProfile = $habboApi->getProfile($myHabbo->getId());
} else {
    // This Habbo has a closed home, only show their Habbo object
    $profile = new Profile();
    $myProfile = $profile->setHabbo($myHabbo);
}
$myPhotos = $habboApi->getPhotos($myHabbo->getId());
// Export as HTML
$html = ['habbo' => '', 'worn_badges' => '', 'friends' => '', 'groups' => '', 'rooms' => '', 'badges' => '', 'photos' => ''];
// Some markup for the Habbo part
/* @var Habbo $habbo */
$habbo = $myProfile->getHabbo();
$html['habbo'] .= '<img src="http://www.habbo.com/habbo-imaging/avatarimage?figure=' . $habbo->getFigureString() . '&size=l&gesture=sml&head_direction=3"
            alt="' . $habbo->getHabboName() . '" title="' . $habbo->getHabboName() . '" style="float: left; margin-right: 10px;" />';
$html['habbo'] .= '<h3>' . $habbo->getHabboName() . '</h3>';
$html['habbo'] .= '<p>' . $habbo->getMotto() . '<br><em>' . $habbo->getMemberSince()->toFormattedDateString() . '</em></p>';
if ($habbo->getProfileVisible()) {
    $html['habbo'] .= '<p><a href="https://www.habbo.com/profile/' . $habbo->getHabboName() . '">View home &raquo;</a></p>';
}
if ($badges = $habbo->getSelectedBadges()) {