本文整理汇总了PHP中modX::getLoginUserName方法的典型用法代码示例。如果您正苦于以下问题:PHP modX::getLoginUserName方法的具体用法?PHP modX::getLoginUserName怎么用?PHP modX::getLoginUserName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类modX
的用法示例。
在下文中一共展示了modX::getLoginUserName方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setPlaceholders
/**
* Set a bunch of placeholders to be used within Smarty templates
*
* @return void
*/
public function setPlaceholders()
{
$username = '';
if ($this->modx->getOption('manager_use_fullname') == true) {
$userProfile = $this->modx->user->getOne('Profile');
$username = $userProfile->get('fullname');
}
if (empty($username)) {
$username = $this->modx->getLoginUserName();
}
$placeholders = array('username' => $username, 'userImage' => $this->getUserImage());
$this->controller->setPlaceholders($placeholders);
}
示例2: getUserImage
/**
* Retrieve/compute the user picture profile
*
* @return string The HTML output
*/
public function getUserImage()
{
/** @var modUserProfile $userProfile */
$userProfile = $this->modx->user->getOne('Profile');
// Default to FontAwesome
$userImage = '<i class="icon icon-user icon-large"></i> ';
if ($userProfile->photo) {
// First, handle user defined image
$src = $this->modx->getOption('connectors_url', MODX_CONNECTORS_URL) . 'system/phpthumb.php?zc=1&h=128&w=128&src=' . $userProfile->photo;
$userImage = '<img src="' . $src . '" />';
} elseif ($this->modx->getOption('enable_gravatar')) {
// Gravatar
$gravemail = md5(strtolower(trim($userProfile->email)));
$gravsrc = $this->modx->getOption('url_scheme', null, 'http://') . 'www.gravatar.com/avatar/' . $gravemail . '?s=128&d=mm';
$userImage = '<img src="' . $gravsrc . '" alt="' . $this->modx->getLoginUserName() . '" />';
}
return $userImage;
}
示例3: setPlaceholders
/**
* Set a bunch of placeholders to be used within Smarty templates
*
* @return void
*/
public function setPlaceholders()
{
$placeholders = array('username' => $this->modx->getLoginUserName(), 'userImage' => $this->getUserImage());
$this->controller->setPlaceholders($placeholders);
}