Ejemplo n.º 1
0
 public function badge()
 {
     $view = $this->getView();
     $request = $this->getRequest();
     $uid = $request->getParameter('user');
     if ($uid instanceof UserModel) {
         $user = $uid;
         $uid = $user->get('id');
     } else {
         $user = UserModel::Construct($uid);
     }
     $direction = $request->getParameter('direction') ? $request->getParameter('direction') : 'horizontal';
     $orientation = $request->getParameter('orientation') ? $request->getParameter('orientation') : 'left';
     $view->assign('enableavatar', \ConfigHandler::Get('/user/enableavatar'));
     $view->assign('link', UserSocialHelper::ResolveProfileLink($user));
     $view->assign('user', $user);
     $view->assign('profiles', $user->get('external_profiles'));
     $view->assign('direction', $direction);
     $view->assign('orientation', $orientation);
     $view->assign('title', $request->getParameter('title'));
 }
Ejemplo n.º 2
0
	public function fetch(){

		if($this->contentkey){
			// Authorid is the meta tag used as of 2.4.1 from the builtin author autocomplete.
			$authorid = $this->contentkey;
		}
		else{
			$authorid = null;
		}

		if(!$this->content) return '';

		$data = array();

		// It's probably a User object!
		if(is_subclass_of($this->content, 'User')){
			// All profiles get at least the meta tag.
			$data['author'] = '<meta property="author" content="' . str_replace('"', '&quot;', $this->content->getDisplayName()) . '"/>';
			// "Socially enabled" sites also get the link attribute!
			if(Core::IsComponentAvailable('user-social')){
				$data['link-author'] = '<link rel="author" href="' . UserSocialHelper::ResolveProfileLink($this->content) . '"/>';
			}
		}
		// Otherwise, if the authorid is set, use that to look up the user.
		elseif($authorid){
			$user = UserModel::Construct($authorid);
			// All profiles get at least the meta tag.
			$data['author'] = '<meta property="author" content="' . str_replace('"', '&quot;', $user->getDisplayName()) . '"/>';
			// "Socially enabled" sites also get the link attribute!
			if(Core::IsComponentAvailable('user-social')){
				$data['link-author'] = '<link rel="author" href="' . UserSocialHelper::ResolveProfileLink($user) . '"/>';
			}
		}
		else{
			$data['author'] = '<meta property="author" content="' . str_replace('"', '&quot;', $this->content) . '"/>';
		}

		return $data;
	}