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


PHP template::get_user_style方法代码示例

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


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

示例1: __construct

 /**
  * Constructor
  *
  * @param \phpbb\controller\helper	$helper		Controller helper object
  * @param \phpbb\template			$template	Template object
  */
 public function __construct(\phpbb\config\config $config, \phpbb\template\template $template, \phpbb\user $user, $root_path)
 {
     $template_path = $template->get_user_style();
     $template_path = $template_path[0];
     $this->size = (int) $config['default_gravatar_size'] ?: 80;
     $this->default_avatar = $root_path . 'styles/' . $template_path . '/theme/images/no_avatar.gif';
 }
开发者ID:cracknel,项目名称:ubuntudanmark.dk,代码行数:13,代码来源:main_listener.php

示例2: info

 public function info($user_id)
 {
     if (!$this->auth->acl_gets('u_viewprofile', 'a_user', 'a_useradd', 'a_userdel') || $user_id == ANONYMOUS) {
         trigger_error('NOT_AUTHORISED');
     }
     $sql_ary = array('SELECT' => 'u.username, u.user_colour, u.user_regdate, u.user_posts, u.user_lastvisit, u.user_rank, u.user_avatar, u.user_avatar_type, u.user_avatar_width, u.user_avatar_height', 'FROM' => array(USERS_TABLE => 'u'), 'WHERE' => 'user_id = ' . (int) $user_id);
     /**
      * Modify SQL query in tas2580 AJAX userinfo extension
      *
      * @event tas2580.userinfo_modify_sql
      * @var    string		sql_ary	The SQL query
      * @var    int		user_id	The ID of the user
      * @since 0.2.3
      */
     $vars = array('sql_ary', 'user_id');
     extract($this->phpbb_dispatcher->trigger_event('tas2580.userinfo_modify_sql', compact($vars)));
     $result = $this->db->sql_query_limit($this->db->sql_build_query('SELECT', $sql_ary), 1);
     $this->data = $this->db->sql_fetchrow($result);
     $this->db->sql_freeresult($result);
     include $this->phpbb_root_path . 'includes/functions_display.' . $this->php_ext;
     $user_rank_data = phpbb_get_user_rank($this->data, $this->data['user_posts']);
     $template = $this->template->get_user_style();
     // Get the avatar
     // Wen need to use the full URL here because we don't know the path where userinfo is called
     define('PHPBB_USE_BOARD_URL_PATH', true);
     $avatar = phpbb_get_user_avatar($this->data);
     $avatar = empty($avatar) ? '<img src="' . generate_board_url() . '/styles/' . $template[0] . '/theme/images/no_avatar.gif" width="100" height="100" alt="' . $this->user->lang('USER_AVATAR') . '">' : $avatar;
     $memberdays = max(1, round((time() - $this->data['user_regdate']) / 86400));
     $posts_per_day = $this->data['user_posts'] / $memberdays;
     $percentage = $this->config['num_posts'] ? min(100, $this->data['user_posts'] / $this->config['num_posts'] * 100) : 0;
     $result = array('username' => get_username_string('full', $user_id, $this->data['username'], $this->data['user_colour']), 'regdate' => $this->user->format_date($this->data['user_regdate']), 'posts' => $this->data['user_posts'], 'lastvisit' => $this->user->format_date($this->data['user_lastvisit']), 'avatar' => $avatar, 'rank' => empty($user_rank_data['title']) ? $this->user->lang('NA') : $user_rank_data['title'], 'postsperday' => $this->user->lang('POST_DAY', $posts_per_day), 'percentage' => $this->user->lang('POST_PCT', $percentage));
     /**
      * Modify return data in tas2580 AJAX userinfo extension
      *
      * @event tas2580.userinfo_modify_result
      * @var    array	result	The result array
      * @var    int	user_id	The ID of the user
      * @since 0.2.3
      */
     $vars = array('result', 'user_id');
     extract($this->phpbb_dispatcher->trigger_event('tas2580.userinfo_modify_result', compact($vars)));
     return new JsonResponse(array($result));
 }
开发者ID:phpbb-es,项目名称:userinfo,代码行数:43,代码来源:user.php


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