public function prepareParams() { $this->_params['socialForum']['avatar_height'] = $this->_params['socialForum']['logo_height']; $this->_params['socialForum']['avatar_width'] = $this->_params['socialForum']['logo_width']; $this->_params['socialForum']['avatar_crop_x'] = $this->_params['socialForum']['logo_crop_x']; $this->_params['socialForum']['avatar_crop_y'] = $this->_params['socialForum']['logo_crop_y']; $this->_params['cropCss'] = XenForo_ViewPublic_Helper_User::getAvatarCropCss($this->_params['socialForum']); }
public function renderHtml() { $bbCodeParser = XenForo_BbCode_Parser::create(XenForo_BbCode_Formatter_Base::create('Base', array('view' => $this))); $this->_params['user']['aboutHtml'] = new XenForo_BbCode_TextWrapper($this->_params['user']['about'], $bbCodeParser); $this->_params['user']['signatureHtml'] = new XenForo_BbCode_TextWrapper($this->_params['user']['signature'], $bbCodeParser, array('lightBox' => false)); foreach ($this->_params['customFieldsGrouped'] as &$fields) { $fields = XenForo_ViewPublic_Helper_User::addUserFieldsValueHtml($this, $fields); } }
public function prepareParams() { $this->_params['cropCss'] = XenForo_ViewPublic_Helper_User::getAvatarCropCss($this->_params['user']); }
/** * Helper to fetch the CSS rules to crop a user's avatar to their chosen square aspect * * @param array $user * @param boolean $center */ public static function helperAvatarCropCss($user, $center = false) { if (!is_array($user) || empty($user['avatar_date']) || !array_key_exists('avatar_crop_x', $user) || !array_key_exists('avatar_crop_y', $user) || !empty($user['gravatar'])) { return ''; } $css = ''; foreach (XenForo_ViewPublic_Helper_User::getAvatarCropCss($user, $center) as $property => $value) { $css .= "{$property}: {$value}; "; } return $css; }
/** * Helper to fetch the HTML value of a custom user field * * @param array|string $field Either the field info array for a field, or just its field_id * @param array $user User to whom the field belongs * @param mixed $fieldValue Value of the field for $user * * @return string|boolean */ public static function helperUserFieldValue($field, array $user = array(), $fieldValue = null) { if (empty($user['user_id'])) { return false; } if (!is_array($field)) { if (empty(self::$_userFieldsInfo)) { self::$_userFieldsInfo = XenForo_Application::get('userFieldsInfo'); } if (!isset(self::$_userFieldsInfo[$field])) { return false; } $field = self::$_userFieldsInfo[$field]; } $fieldId = $field['field_id']; if (isset(self::$_userFieldsValues[$user['user_id']][$fieldId])) { return self::$_userFieldsValues[$user['user_id']][$fieldId]; } if (is_null($fieldValue)) { $fieldValue = $field['field_value']; } $value = XenForo_ViewPublic_Helper_User::getUserFieldValueHtml($field, $fieldValue); if (is_array($value)) { $value = implode(', ', $value); } self::$_userFieldsValues[$user['user_id']][$fieldId] = $value; return $value; }