_email = $email; $this->_properties['hash'] = md5(strtolower(trim($email))); $this->_properties['imageset'] = $d; $this->_properties['size'] = $s; $this->_properties['rating'] = $r; } function get_url() { $url = self::URL.'/avatar/'.$this->_properties['hash']; $url .= '?s='.$this->_properties['size'].'&d='.$this->_properties['imageset'].'&r='.$this->_properties['rating']; return $url; } function get_profile() { $str = @file_get_contents(self::URL.'/'.$this->_properties['hash'].'.php'); $profile = unserialize($str); return $profile ? $profile['entry'][0] : false; } function get_img($attrs = array()) { $url = $this->get_url(); $arr_attrs = array(); foreach ($attrs as $key => $value) { $arr_attrs[] = $key.'="'.$value.'"'; } $result = ''; return $result; } function __call($name, $args) { $call = explode('_', $name); if ($call) { $method = $call[0]; $property = $call[1]; switch ($method) { case 'get': if (isset($this->_properties[$property])) { return $this->_properties[$property]; } else if ($property == 'img') { $size = $call[2]; $this->_properties['size'] = (int)$size; return $this->get_img(($args[0]) ? $args[0] : array()); } break; case 'set': if (isset($this->_properties[$property]) && $args) { $this->_properties[$property] = $args[0]; return true; } else return false; break; default: return null; break; } } else return null; } } ?>