本文整理汇总了PHP中app\Permission::labelInitials方法的典型用法代码示例。如果您正苦于以下问题:PHP Permission::labelInitials方法的具体用法?PHP Permission::labelInitials怎么用?PHP Permission::labelInitials使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类app\Permission
的用法示例。
在下文中一共展示了Permission::labelInitials方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: Input
}
if ($targetUser->id === $currentUser->id) {
Response::fail("You cannot {$action} yourself");
}
if (Permission::sufficient('staff', $targetUser->role)) {
Response::fail("You cannot {$action} people within the assistant or any higher group");
}
if ($action == 'banish' && $targetUser->role === 'ban' || $action == 'un-banish' && $targetUser->role !== 'ban') {
Response::fail("This user has already been {$action}ed");
}
$reason = (new Input('reason', 'string', array(Input::IN_RANGE => [5, 255], Input::CUSTOM_ERROR_MESSAGES => array(Input::ERROR_MISSING => 'Please specify a reason', Input::ERROR_RANGE => 'Reason length must be between @min and @max characters'))))->out();
$changes = array('role' => $action == 'banish' ? 'ban' : 'user');
$Database->where('id', $targetUser->id)->update('users', $changes);
Logs::action($action, array('target' => $targetUser->id, 'reason' => $reason));
$changes['role'] = Permission::ROLES_ASSOC[$changes['role']];
$changes['badge'] = Permission::labelInitials($changes['role']);
if ($action == 'banish') {
Response::done($changes);
}
Response::success("We welcome {$targetUser->name} back with open hooves!", $changes);
} else {
CoreUtils::notFound();
}
}
}
if (strtolower($data) === 'immortalsexgod') {
$data = 'DJDavid98';
}
if (empty($data)) {
if ($signedIn) {
$un = $currentUser->name;
示例2:
use App\Time;
use App\UserPrefs;
use App\Users;
/** @var $User User */
if (isset($MSG)){
echo "<h1>$MSG</h1>";
if (isset($SubMSG)) echo "<p>$SubMSG</p>";
}
else {
$vectorapp = UserPrefs::get('p_vectorapp', $User->id); ?>
<div class="briefing">
<?=$User->getAvatarWrap()?>
<div class="title">
<h1><span class="role-badge"><?=Permission::labelInitials($User->role)?></span><span class="username"><?=$User->name?></span><a class="da" title="Visit DeviantArt profile" href="<?=$User->getDALink(User::LINKFORMAT_URL)?>"><?=str_replace(' fill="#FFF"','',file_get_contents(APPATH.'img/da-logo.svg'))?></a><?=!empty($vectorapp)?"<img class='vectorapp-logo' src='/img/vapps/$vectorapp.svg' alt='$vectorapp logo' title='".CoreUtils::$VECTOR_APPS[$vectorapp]." user'>":''?></h1>
<p><?php
echo "<span class='rolelabel'>{$User->rolelabel}</span>";
if ($canEdit){
echo ' <button id="change-role" class="blue typcn typcn-spanner'.($User->role==='ban'?' hidden':'').'" title="Change '.CoreUtils::posess($User->name).' group"></button>';
$BanLabel = ($User->role==='ban'?'Un-ban':'Ban').'ish';
$Icon = $User->role==='ban'?'world':'weather-night';
if (Permission::sufficient('staff', $User->role))
$Icon .= ' hidden';
echo ' <button id="ban-toggle" class="darkblue typcn typcn-'.$Icon.' '.strtolower($BanLabel).'" title="'."$BanLabel user".'"></button>';
}
if (Permission::sufficient('developer'))
echo " • <span class='userid'>{$User->id}</span>";
?></p>
</div>
</div>
示例3: array
if (!empty($Users)) {
$Arranged = array();
foreach ($Users as $u) {
if (!isset($Arranged[$u->role])) {
$Arranged[$u->role] = array();
}
$Arranged[$u->role][] = $u;
}
foreach (array_reverse(Permission::ROLES) as $r => $v) {
if (empty($Arranged[$r])) {
continue;
}
/** @var $users \App\Models\User[] */
$users = $Arranged[$r];
$group = CoreUtils::makePlural(Permission::ROLES_ASSOC[$r], count($users), true);
$groupInitials = '[' . Permission::labelInitials($r) . ']';
$usersStr = array();
foreach ($users as $u) {
$usersStr[] = $u->getProfileLink();
}
$usersStr = implode(', ', $usersStr);
echo <<<HTML
<section>
\t<h2>{$group} {$groupInitials}</h2>
\t{$usersStr}
</section>
HTML;
}
}
?>
</div>