public function avatar($actor, $size = 'square', $linked = true, $attr = array())
    {
        if (is_numeric($size)) {
            $width = "width=\"$size\"";
            $size = 'square';
        } else {
            $width = '';
        }

        $defaultAvatar = $this->getService('com:base.template.asset')
                              ->getURL('lib_anahita/images/avatar/'.$size.'_default.gif');

        if (is_null($actor) || !isset($actor->id)) {
            return '<img '.$width.' src="'.$defaultAvatar.'" id="actor-avatar-'.$size.'" size="'.$size.'" class="actor-avatar '.$size.'" />';
        }

        if ($actor->hasPortrait()) {
            $src = $actor->getPortraitURL($size);

            $name = AnHelperString::ucwords($actor->name);
            $verified = ($actor->verified) ? 'verified' : '';
            $img = '<img '.$width.' alt="'.$name.'" actorid="'.$actor->id.'" src="'.$src.'" id="actor-avatar-'.$actor->id.'" size="'.$size.'" class="actor-avatar actor-avatar-'.$actor->id.' '.$size.' '.$verified.'" />';
        } else {
            $img = '<img '.$width.' src="'.$defaultAvatar.'" id="actor-avatar-'.$size.'-'.$actor->id.'" size="'.$size.'" class="actor-avatar '.$size.'" />';
        }

        if ($linked && $actor->authorize('access')) {
            $url = route($actor->getURL());
            $verified = ($actor->verified) ? 'verified' : '';
            $img = '<a class="actor-avatar-link '.$verified.'" '.$this->_buildAttribute($attr).' actorid="'.$actor->id.'" href="'.$url.'" >'.$img.'</a>';
        }

        return $img;
    }