Skip to content

Instantly share code, notes, and snippets.

@Elsensee
Last active August 29, 2015 14:01
Show Gist options
  • Save Elsensee/491b461cc7a2e20d93d5 to your computer and use it in GitHub Desktop.
Save Elsensee/491b461cc7a2e20d93d5 to your computer and use it in GitHub Desktop.
groupname class
<?php
/**
*
* @package phpBB3
* @copyright (c) 2014 phpBB Group
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
*
*/
namespace phpbb;
/**
* A class with various functions that are related to strings for groupnames
* @package phpBB3
*/
class groups
{
/**
* User object
* @var \phpbb\user
*/
protected $user;
/**
* Constructor
*
* @param \phpbb\user $user User object
*/
public function __construct(\phpbb\user $user)
{
$this->user = $user;
}
/**
* Get groupname or translated groupname if it exists
*
* @param string $groupname The stored groupname
*
* @return string Groupname or tranlsated groupname if it exists
*/
public function get_name($groupname)
{
return (isset($this->user->lang['G_' . $groupname]) ? $this->user->lang('G_' . $groupname) : $groupname);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment