当前位置: 首页>>代码示例>>PHP>>正文


PHP AlphaUserPointsHelper::getAvatarPath方法代码示例

本文整理汇总了PHP中AlphaUserPointsHelper::getAvatarPath方法的典型用法代码示例。如果您正苦于以下问题:PHP AlphaUserPointsHelper::getAvatarPath方法的具体用法?PHP AlphaUserPointsHelper::getAvatarPath怎么用?PHP AlphaUserPointsHelper::getAvatarPath使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在AlphaUserPointsHelper的用法示例。


在下文中一共展示了AlphaUserPointsHelper::getAvatarPath方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: get_user_avatar_image


//.........这里部分代码省略.........
             break;
         case 'jomsocial':
             include_once JPATH_ROOT . DS . 'components' . DS . 'com_community' . DS . 'defines.community.php';
             require_once JPATH_ROOT . DS . 'components' . DS . 'com_community' . DS . 'libraries' . DS . 'core.php';
             require_once JPATH_ROOT . DS . 'components' . DS . 'com_community' . DS . 'helpers' . DS . 'string.php';
             $user = CFactory::getUser($userid);
             $avatar = $user->getThumbAvatar();
             if ($path_only == false) {
                 $attribs['height'] = $height . 'px';
                 $avatar = '<img src="' . $avatar . '" alt="' . $alt . '" ' . trim((is_array($attribs) ? JArrayHelper::toString($attribs) : $attribs) . ' /') . '>';
             }
             break;
         case 'cb':
             global $_CB_framework, $_CB_database, $ueConfig, $mainframe;
             $api = JPATH_ADMINISTRATOR . '/components/com_comprofiler/plugin.foundation.php';
             if (!is_file($api)) {
                 return;
             }
             require_once $api;
             cbimport('cb.database');
             cbimport('cb.tables');
             cbimport('cb.field');
             cbimport('language.front');
             outputCbTemplate($_CB_framework->getUi());
             //TODO: Here
             $img_attribs['height'] = $height . 'px';
             if ($userid > 0) {
                 $cbUser = CBuser::getInstance($userid);
                 if ($cbUser !== null) {
                     $avatar = $cbUser->getField('avatar', null, 'php', 'profile', 'list');
                     $name = $cbUser->getField('name');
                     $avatar = $avatar['avatar'];
                     if ($path_only == false) {
                         $avatar = '<img src="' . $avatar . '" alt="' . $alt . '" ' . trim((is_array($attribs) ? JArrayHelper::toString($attribs) : $attribs) . ' /') . '>';
                     }
                 }
             } else {
                 if ($height <= 90) {
                     $avatar = $path_only ? selectTemplate() . 'images/avatar/tnnophoto_n.png' : Jhtml::image(selectTemplate() . 'images/avatar/tnnophoto_n.png', '', $img_attribs);
                 } else {
                     $avatar = $path_only ? selectTemplate() . 'images/avatar/nophoto_n.png' : Jhtml::image(selectTemplate() . 'images/avatar/nophoto_n.png', '', $img_attribs);
                 }
             }
             break;
         case 'touch':
             $avatarLoc = JURI::base(true) . '/index2.php?option=com_community&amp;controller=profile&amp;task=avatar&amp;width=' . $height . '&amp;height=' . $height . '&amp;user_id=' . $userid . '&amp;no_ajax=1';
             $attribs[] = array('style' => 'height: ' . $height . 'px');
             $avatar = $path_only ? $avatarLoc : JHtml::image($avatarLoc, $alt, $attribs);
             break;
         case 'gravatar':
             if (null == $email && $userid > 0) {
                 $strSql = 'SELECT email FROM #__users WHERE id=' . $userid;
                 $db->setQuery($strSql);
                 $email = $db->loadResult();
             }
             $avatar = 'https://www.gravatar.com/avatar/' . md5(strtolower(trim($email))) . '?s=' . $height . '&d=mm&r=g';
             if ($path_only == false) {
                 $avatar = '<img src="' . $avatar . '" alt="' . $alt . '" ' . trim((is_array($attribs) ? JArrayHelper::toString($attribs) : $attribs) . ' /') . '>';
             }
             break;
         case 'kunena':
             if (CJFunctions::_initialize_kunena()) {
                 $class = 'avatar';
                 $user = KunenaFactory::getUser($userid);
                 $avatar = $user->getAvatarImage($class, $height, $height);
                 if ($path_only) {
                     preg_match_all('/<img .*src=["|\']([^"|\']+)/i', $avatar, $matches);
                     foreach ($matches[1] as $key => $value) {
                         $avatar = $value;
                         break;
                     }
                 }
             }
             break;
         case 'aup':
             $api_AUP = JPATH_SITE . DS . 'components' . DS . 'com_alphauserpoints' . DS . 'helper.php';
             if (file_exists($api_AUP)) {
                 require_once $api_AUP;
                 if ($path_only) {
                     $avatar = AlphaUserPointsHelper::getAvatarPath($userid);
                 } else {
                     $avatar = AlphaUserPointsHelper::getAupAvatar($userid, 0, $height, $height);
                 }
             }
             break;
         case 'easysocial':
             $api = JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_easysocial' . DS . 'includes' . DS . 'foundry.php';
             if (file_exists($api)) {
                 require_once $api;
                 $my = Foundry::user();
                 $avatar = $my->getAvatar($height < 64 ? SOCIAL_AVATAR_SMALL : ($height < 128 ? SOCIAL_AVATAR_MEDIUM : SOCIAL_AVATAR_LARGE));
                 $attribs[] = array('style' => 'height: ' . $height . 'px');
                 if ($path_only == false) {
                     $avatar = '<img src="' . $avatar . '" alt="' . $alt . '" ' . trim((is_array($attribs) ? JArrayHelper::toString($attribs) : $attribs) . ' /') . '>';
                 }
             }
             break;
     }
     return $avatar;
 }
开发者ID:pguilford,项目名称:vcomcc,代码行数:101,代码来源:functions.php

示例2: getUserAvatarImage


//.........这里部分代码省略.........
             }
             break;
         case 'jomsocial':
             require_once JPATH_ROOT . '/components/com_community/defines.community.php';
             require_once JPATH_ROOT . '/components/com_community/libraries/core.php';
             require_once JPATH_ROOT . '/components/com_community/helpers/string.php';
             $user = CFactory::getUser($userId);
             $avatar = $user->getThumbAvatar();
             if ($urlOnly == false) {
                 $imgAttribs['height'] = $height . 'px';
                 $avatar = '<img src="' . $avatar . '" alt="' . $alt . '" ' . trim((is_array($imgAttribs) ? JArrayHelper::toString($imgAttribs) : $imgAttribs) . ' /') . '>';
             }
             break;
         case 'cb':
             global $_CB_framework, $_CB_database, $ueConfig, $mainframe;
             $api = JPATH_ADMINISTRATOR . '/components/com_comprofiler/plugin.foundation.php';
             if (!is_file($api)) {
                 return;
             }
             require_once $api;
             cbimport('cb.database');
             cbimport('cb.tables');
             cbimport('cb.field');
             cbimport('language.front');
             outputCbTemplate($_CB_framework->getUi());
             //TODO: Here
             $imgAttribs['height'] = $height . 'px';
             if ($userId > 0) {
                 $cbUser = CBuser::getInstance($userId);
                 if ($cbUser !== null) {
                     $avatar = $cbUser->getField('avatar', null, 'php', 'profile', 'list');
                     $alt = $cbUser->getField('name');
                     $avatar = $avatar['avatar'];
                 }
             } else {
                 if ($height <= 90) {
                     $avatar = selectTemplate() . 'images/avatar/tnnophoto_n.png';
                 } else {
                     $avatar = selectTemplate() . 'images/avatar/nophoto_n.png';
                 }
             }
             if ($urlOnly == false) {
                 $avatar = '<img src="' . $avatar . '" alt="' . $alt . '" ' . trim((is_array($imgAttribs) ? JArrayHelper::toString($imgAttribs) : $imgAttribs) . ' /') . '>';
             }
             break;
         case 'gravatar':
             if (null == $email && $userId > 0) {
                 try {
                     $db = JFactory::getDbo();
                     $query = $db->getQuery(true)->select('email')->from('#__users')->where('id = ' . $userId);
                     $db->setQuery($query);
                     $email = $db->loadResult();
                 } catch (Exception $e) {
                 }
             }
             $avatar = 'https://www.gravatar.com/avatar/' . md5(strtolower(trim($email))) . '?s=' . $height . '&d=mm&r=g';
             if ($urlOnly == false) {
                 $avatar = JHtml::image($avatar, $alt, $imgAttribs);
             }
             break;
         case 'kunena':
             if ($this->_initialize_kunena()) {
                 $class = 'avatar';
                 $user = KunenaFactory::getUser($userId);
                 $avatar = $user->getAvatarImage($class, $height, $height);
                 if ($urlOnly) {
                     preg_match_all('/<img .*src=["|\']([^"|\']+)/i', $avatar, $matches);
                     foreach ($matches[1] as $key => $value) {
                         $avatar = $value;
                         break;
                     }
                 }
             }
             break;
         case 'aup':
             $api_AUP = JPATH_SITE . '/components/com_alphauserpoints/helper.php';
             if (file_exists($api_AUP)) {
                 require_once $api_AUP;
                 if ($urlOnly) {
                     $avatar = AlphaUserPointsHelper::getAvatarPath($userId);
                 } else {
                     $avatar = AlphaUserPointsHelper::getAupAvatar($userId, 0, $height, $height);
                 }
             }
             break;
         case 'easysocial':
             $api = JPATH_ADMINISTRATOR . '/components/com_easysocial/includes/foundry.php';
             if (file_exists($api)) {
                 require_once $api;
                 $my = Foundry::user($userId);
                 $avatar = $my->getAvatar($height < 64 ? SOCIAL_AVATAR_SMALL : ($height < 128 ? SOCIAL_AVATAR_MEDIUM : SOCIAL_AVATAR_LARGE));
                 $imgAttribs[] = array('style' => 'height: ' . $height . 'px');
                 if ($urlOnly == false) {
                     $avatar = '<img src="' . $avatar . '" alt="' . $alt . '" ' . trim((is_array($imgAttribs) ? JArrayHelper::toString($imgAttribs) : $imgAttribs) . ' /') . '>';
                 }
             }
             break;
     }
     return $avatar;
 }
开发者ID:pguilford,项目名称:vcomcc,代码行数:101,代码来源:api.php


注:本文中的AlphaUserPointsHelper::getAvatarPath方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。