示例#1
0
 /**
  * @param $item
  * @param bool $photo = true
  *
  * @return SocialNetworkUser
  */
 private static function _user($item, $photo = true)
 {
     $user = new SocialNetworkUser($item->id, $item->name);
     $user->PhotoFromLink($item->picture->data->url, $photo);
     $user->Gender($item->gender[0]);
     $user->Page($item->link);
     if (isset($item->email)) {
         $user->Email($item->email);
     }
     if (isset($item->birthday)) {
         $user->BirthdayByDate('m/d/Y', $item->birthday);
     }
     return $user;
 }
示例#2
0
 /**
  * @param $item
  * @param bool $photo = true
  *
  * @return SocialNetworkUser
  */
 private static function _user($item, $photo = true)
 {
     if (!$item) {
         return null;
     }
     $user = new SocialNetworkUser($item->uid, $item->first_name . ' ' . $item->last_name);
     $user->PhotoFromLink($item->photo_max_orig, $photo);
     $user->Gender(isset(self::$_gender[$item->sex]) ? self::$_gender[$item->sex] : SocialNetworkUser::GENDER_UNKNOWN);
     $user->Page('http://vk.com/id' . $item->uid);
     if (isset($item->email)) {
         $user->Email($item->email);
     }
     if (isset($item->bdate)) {
         $date = explode('.', $item->bdate);
         $out = array();
         foreach ($date as $component) {
             $out[] = (strlen($component == 1) ? '0' : '') . $component;
         }
         if (sizeof($out) == 2) {
             $out[] = QuarkDate::UNKNOWN_YEAR;
         }
         $user->BirthdayByDate('d.m.Y', implode('.', $out), 'd.m');
     }
     return $user;
 }