本文整理汇总了PHP中StringUtil::formatNumeric方法的典型用法代码示例。如果您正苦于以下问题:PHP StringUtil::formatNumeric方法的具体用法?PHP StringUtil::formatNumeric怎么用?PHP StringUtil::formatNumeric使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类StringUtil
的用法示例。
在下文中一共展示了StringUtil::formatNumeric方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: assignVariables
/**
* @see Page::assignVariables()
*/
public function assignVariables()
{
parent::assignVariables();
// disk space in GB
$di = AdminTools::getDiskInfo();
if (is_array($di) && count($di)) {
$totalSpace = StringUtil::formatNumeric($di['TOTAL_SPACE']) . ' GB';
$freeSpace = StringUtil::formatNumeric($di['FREE_SPACE']) . ' GB (' . StringUtil::formatNumeric($di['FREE_QUOTA']) . '%)';
$usedSpace = StringUtil::formatNumeric($di['USED_SPACE']) . ' GB (' . StringUtil::formatNumeric($di['USED_QUOTA']) . '%)';
$this->diskInfo = WCF::getLanguage()->get('wcf.acp.adminTools.diskInfo', array('$totalSpace' => $totalSpace, '$freeSpace' => $freeSpace, '$usedSpace' => $usedSpace));
}
WCF::getTPL()->assign(array('wbbExists' => AdminTools::wbbExists(), 'atPHP' => AdminTools::parsePHPConfig(), 'diskInfo' => $this->diskInfo));
}
示例2: getRatingOutput
/**
* Gets the thread rating result for template output.
*
* @return string thread rating result for template output
*/
public function getRatingOutput()
{
$rating = $this->getRating();
if ($rating !== false) {
$roundedRating = round($rating, 0);
} else {
$roundedRating = 0;
}
$description = '';
if ($this->ratings > 0) {
$description = WCF::getLanguage()->get('wbb.board.vote.description', array('$votes' => StringUtil::formatNumeric($this->ratings), '$vote' => StringUtil::formatNumeric($rating)));
}
return '<img src="' . StyleManager::getStyle()->getIconPath('rating' . $roundedRating . '.png') . '" alt="" title="' . $description . '" />';
}
示例3: destroy
/**
* Destroys the espionage sondes if they get destroyed.
*/
protected function destroy()
{
$shipCount = 0;
Spec::storeData($this->getTargetPlanet(), false);
$specs = Spec::getBySpecType(3, false);
foreach ($specs as $specObj) {
$shipCount += $specObj->level;
}
$this->destroyChance = pow($this->getOfiara()->spy_tech / $this->getOwner()->spy_tech, 5) * $this->fleet[210] * pow($shipCount, 0.2) / 10;
$this->destroyChance = min($this->destroyChance, 100);
$rand = rand(0, 99);
if ($this->destroyChance > $rand) {
$this->fight = true;
$this->simulate();
$this->generateReport();
}
$this->ereport .= WCF::getLanguage()->get('wot.mission.mission6.impact.owner.defenseChance', array('$defenseChance' => StringUtil::formatNumeric(round($this->destroyChance))));
}
示例4: array
if (!$this->v['smileyCategory']->disabled) {
?>
smileyCategories.set(<?php
echo $this->v['smileyCategory']->smileyCategoryID;
?>
, '<?php
$this->tagStack[] = array('lang', array());
ob_start();
echo StringUtil::encodeHTML($this->v['smileyCategory']->title);
$_langa73fcf5d137c9c2edd3fb4dec8a7ce63e2c179c5 = ob_get_contents();
ob_end_clean();
echo WCF::getLanguage()->getDynamicVariable($_langa73fcf5d137c9c2edd3fb4dec8a7ce63e2c179c5, $this->tagStack[count($this->tagStack) - 1][1]);
array_pop($this->tagStack);
?>
(<?php
echo StringUtil::formatNumeric($this->v['smileyCategory']->smileys);
?>
)');<?php
}
?>
<?php
}
}
?>
// init smiley category switcher
var smileyCategorySwitcher = new SmileyCategorySwitcher(smileyCategories);
<?php
if ($this->v['activeTab'] == 'smilies' || $this->v['activeTab'] == '') {
?>
document.observe("dom:loaded", function() {
示例5: ob_end_clean
ob_end_clean();
echo WCF::getLanguage()->getDynamicVariable($_langfcd2a69e3aba94b61dd32ee2e5d49c5ae6e526fa, $this->tagStack[count($this->tagStack) - 1][1]);
array_pop($this->tagStack);
?>
</span></a> »</li>
</ul>
<div class="mainHeadline">
<img src="<?php
echo StyleManager::getStyle()->getIconPath('membersL.png');
?>
" alt="" />
<div class="headlineContainer">
<h2>Mitglieder</h2>
<p>Insgesamt <?php
echo StringUtil::formatNumeric($this->v['items']);
?>
Mitglied<?php
if ($this->v['items'] != 1) {
?>
er<?php
}
?>
</p>
</div>
</div>
<?php
if (isset($this->v['userMessages'])) {
echo $this->v['userMessages'];
}
示例6:
?>
hot<?php
}
?>
"><?php
echo StringUtil::formatNumeric($this->v['thread']->replies);
?>
</td>
<td class="columnViews<?php
if ($this->v['thread']->views > BOARD_THREADS_VIEWS_HOT) {
?>
hot<?php
}
?>
"><?php
echo StringUtil::formatNumeric($this->v['thread']->views);
?>
</td>
<td class="columnLastPost">
<?php
if ($this->v['thread']->replies != 0) {
?>
<div class="containerIconSmall">
<a href="index.php?page=Thread&threadID=<?php
echo $this->v['thread']->threadID;
?>
&action=lastPost<?php
echo SID_ARG_2ND;
?>
"><img src="<?php
echo StyleManager::getStyle()->getIconPath('goToLastPostS.png');
示例7: count
<?php
if (isset($this->v['additionalContent2'])) {
echo $this->v['additionalContent2'];
}
?>
<?php
if (count($this->v['friends']) > 0) {
?>
<div class="contentBox">
<h3 class="subHeadline"><a href="index.php?page=UserFriendList&userID=<?php
echo $this->v['userID'];
echo SID_ARG_2ND;
?>
">Friends</a> <span>(<?php
echo StringUtil::formatNumeric($this->v['user']->friends);
?>
)</span></h3>
<ul class="dataList thumbnailView floatContainer container-1">
<?php
$this->v['tpl']['foreach']['friends']['total'] = count($this->v['friends']);
$this->v['tpl']['foreach']['friends']['show'] = $this->v['tpl']['foreach']['friends']['total'] > 0 ? true : false;
$this->v['tpl']['foreach']['friends']['iteration'] = 0;
if (count($this->v['friends']) > 0) {
foreach ($this->v['friends'] as $this->v['friend']) {
$this->v['tpl']['foreach']['friends']['first'] = $this->v['tpl']['foreach']['friends']['iteration'] == 0 ? true : false;
$this->v['tpl']['foreach']['friends']['last'] = $this->v['tpl']['foreach']['friends']['iteration'] == $this->v['tpl']['foreach']['friends']['total'] - 1 ? true : false;
$this->v['tpl']['foreach']['friends']['iteration']++;
?>
<li class="floatedElement smallFont<?php
示例8: formatFilesizeBinary
/**
* formats a filesize (binary prefix)
*
* For more informations: <http://en.wikipedia.org/wiki/Binary_prefix>
*
* @param integer $byte
* @param integer $precision
* @return string filesize
*/
public static function formatFilesizeBinary($byte, $precision = 2)
{
$symbol = 'Byte';
if ($byte >= 1024) {
$byte /= 1024;
$symbol = 'KiB';
}
if ($byte >= 1024) {
$byte /= 1024;
$symbol = 'MiB';
}
if ($byte >= 1024) {
$byte /= 1024;
$symbol = 'GiB';
}
if ($byte >= 1024) {
$byte /= 1024;
$symbol = 'TiB';
}
return StringUtil::formatNumeric(round($byte, $precision)) . ' ' . $symbol;
}
示例9:
echo $this->pluginObjects['TemplatePluginFunctionCycle']->execute(array('name' => 'messageCycle'), $this);
?>
">
<div class="messageHeader">
<p class="messageCount">
<a href="index.php?page=Thread&postID=<?php
echo $this->v['post']->postID;
?>
#post<?php
echo $this->v['post']->postID;
?>
" title="Permalink to post #<?php
echo StringUtil::formatNumeric($this->v['startIndex']);
?>
" class="messageNumber"><?php
echo StringUtil::formatNumeric($this->v['startIndex']);
?>
</a>
<?php
if ($this->v['permissions']['canMarkPost']) {
?>
<span class="messageMarkCheckBox">
<input id="postMark<?php
echo $this->v['post']->postID;
?>
" type="checkbox" title="Mark post" />
</span>
<?php
}
?>
</p>
示例10:
<span class="digitCaption">Freunde der Freunde</span>
</div>
</div>
</li>
<?php
}
?>
<?php
if ($this->v['network']['friends3rdGrade']) {
?>
<li class="dynItem">
<div class="dynBox network3">
<div class="dynBoxInner">
<span class="digitDisplay light"><?php
echo StringUtil::formatNumeric($this->v['network']['friends3rdGrade']);
?>
</span>
<span class="digitCaption">Freunde dritten Grades</span>
</div>
</div>
</li>
<?php
}
?>
</ul>
</div>
<?php
} else {
?>
<div class="friendsNone">
示例11: readData
/**
* @see Page::readData()
*/
public function readData()
{
parent::readData();
// get profile options
require_once WCF_DIR . 'lib/data/user/option/UserOptions.class.php';
$userOptions = new UserOptions();
$this->categories = $userOptions->getOptionTree('profile', $this->frame->getUser());
// move contact information and about me
foreach ($this->categories as $category => $categoryData) {
if ($category == 'profile.contact' || $category == 'profile.messenger') {
foreach ($categoryData['options'] as $key => $option) {
if (isset($option['outputData'])) {
$this->contactInformation[] = $option['outputData'];
} else {
if (!empty($option['optionValue']) && (empty($option['outputClass']) || !$userOptions->getOutputObject($option['outputClass']) instanceof UserOptionOutputContactInformation)) {
$this->contactInformation[] = array('icon' => '', 'title' => WCF::getLanguage()->get('wcf.user.option.' . $option['optionName']), 'value' => $option['optionValue'], 'url' => '');
}
}
}
unset($this->categories[$category]);
}
}
// add vcard link
$this->contactInformation[] = array('icon' => StyleManager::getStyle()->getIconPath('vCardM.png'), 'title' => WCF::getLanguage()->get('wcf.user.profile.downloadVCard'), 'value' => StringUtil::encodeHTML($this->frame->getUser()->username), 'url' => 'index.php?page=VCard&userID=' . $this->frame->getUserID() . SID_ARG_2ND);
// add general informations
// registration date
$this->generalInformation[] = array('icon' => StyleManager::getStyle()->getIconPath('registerM.png'), 'title' => WCF::getLanguage()->get('wcf.user.registrationDate'), 'value' => DateUtil::formatTime(null, $this->frame->getUser()->registrationDate));
// languages
require_once WCF_DIR . 'lib/acp/form/UserOptionListForm.class.php';
$languages = array();
$availableLanguages = UserOptionListForm::getAvailableContentLanguages();
if (!$this->frame->getUser()->languageIDs) {
$this->languages = $availableLanguages;
} else {
$languageIDs = explode(',', $this->frame->getUser()->languageIDs);
foreach ($languageIDs as $languageID) {
if (isset($availableLanguages[$languageID])) {
$languages[$languageID] = $availableLanguages[$languageID];
}
}
// sort languages
StringUtil::sort($languages);
}
if (count($languages)) {
$this->generalInformation[] = array('icon' => StyleManager::getStyle()->getIconPath('languageM.png'), 'title' => WCF::getLanguage()->get('wcf.user.profile.languages'), 'value' => implode(', ', $languages));
}
// last activity
if (!$this->frame->getUser()->isOnline() && (!$this->frame->getUser()->invisible || WCF::getUser()->getPermission('admin.general.canViewInvisible')) && $this->frame->getUser()->lastActivityTime != 0) {
$this->generalInformation[] = array('icon' => StyleManager::getStyle()->getIconPath('offlineM.png'), 'title' => WCF::getLanguage()->get('wcf.user.lastActivity'), 'value' => DateUtil::formatTime(null, $this->frame->getUser()->lastActivityTime, true));
}
// profile visits
WCF::getTPL()->assign('user', $this->frame->getUser());
$this->generalInformation[] = array('icon' => StyleManager::getStyle()->getIconPath('visitsM.png'), 'title' => WCF::getLanguage()->get('wcf.user.profile.hits'), 'value' => StringUtil::formatNumeric($this->frame->getUser()->profileHits) . ($this->frame->getUser()->getProfileAge() > 1 ? ' ' . WCF::getLanguage()->getDynamicVariable('wcf.user.profile.hitsPerDay') : ''));
// get profile visitors
$sql = "SELECT\t\tavatar.*, user_table.*, visitor.*\n\t\t\tFROM\t\twcf" . WCF_N . "_user_profile_visitor visitor\n\t\t\tLEFT JOIN \twcf" . WCF_N . "_user user_table\n\t\t\tON \t\t(user_table.userID = visitor.userID)\n\t\t\tLEFT JOIN \twcf" . WCF_N . "_avatar avatar\n\t\t\tON \t\t(avatar.avatarID = user_table.avatarID)\n\t\t\tWHERE\t\townerID = " . $this->frame->getUserID() . "\n\t\t\t\t\tAND user_table.userID IS NOT NULL\n\t\t\tORDER BY\ttime DESC";
$result = WCF::getDB()->sendQuery($sql, 5);
while ($row = WCF::getDB()->fetchArray($result)) {
$this->profileVisitors[] = new UserProfile(null, $row);
}
// friends
if (MODULE_MEMBERS_LIST == 1 && $this->frame->getUser()->shareWhitelist) {
$sql = "SELECT\t\tavatar.*, user_table.*\n\t\t\t\tFROM\t\twcf" . WCF_N . "_user_whitelist friends\n\t\t\t\tLEFT JOIN \twcf" . WCF_N . "_user user_table\n\t\t\t\tON \t\t(user_table.userID = friends.whiteUserID)\n\t\t\t\tLEFT JOIN \twcf" . WCF_N . "_avatar avatar\n\t\t\t\tON \t\t(avatar.avatarID = user_table.avatarID)\n\t\t\t\tWHERE\t\tfriends.userID = " . $this->frame->getUserID() . "\n\t\t\t\t\t\tAND confirmed = 1\n\t\t\t\t\t\tAND user_table.userID IS NOT NULL\n\t\t\t\tORDER BY\tfriends.time DESC";
$result = WCF::getDB()->sendQuery($sql, 5);
while ($row = WCF::getDB()->fetchArray($result)) {
$this->friends[] = new UserProfile(null, $row);
}
}
}
示例12: function
}
// add button
document.observe('dom:loaded', function() {
$$('#uploadFields input[type=file]').invoke('observe', 'change', uploadFieldChanged);
$$('#uploadFields a[href*="#delete"]').invoke('observe', 'click', removeUploadField);
});
//]]>
</script>
<?php
}
?>
<input type="submit" name="upload" id="attachmentsInputSubmitButton" value="Hochladen" />
</div>
<p class="smallFont">Maximale Anzahl an Dateianhängen: <?php
echo StringUtil::formatNumeric($this->v['maxUploads']);
?>
<br />
Maximale Dateigröße: <?php
echo $this->pluginObjects['TemplatePluginModifierFilesize']->execute(array($this->v['maxFileSize']), $this);
?>
<br />
Erlaubte Dateiendungen: <?php
echo StringUtil::encodeHTML($this->v['allowedExtensions']);
?>
</p>
<?php
}
?>
</fieldset>
示例13: TemplatePluginFunctionCycle
if (!isset($this->pluginObjects['TemplatePluginFunctionCycle'])) {
require_once WCF_DIR . 'lib/system/template/plugin/TemplatePluginFunctionCycle.class.php';
$this->pluginObjects['TemplatePluginFunctionCycle'] = new TemplatePluginFunctionCycle();
}
if (!isset($this->pluginObjects['TemplatePluginModifierTime'])) {
require_once WCF_DIR . 'lib/system/template/plugin/TemplatePluginModifierTime.class.php';
$this->pluginObjects['TemplatePluginModifierTime'] = new TemplatePluginModifierTime();
}
?>
<div class="contentBox">
<h3 class="subHeadline"><a href="index.php?form=Search&types[]=post&userID=<?php
echo $this->v['user']->userID;
echo SID_ARG_2ND;
?>
">Posts</a> <span>(<?php
echo StringUtil::formatNumeric($this->v['user']->posts);
?>
)</span></h3>
<ul class="dataList">
<?php
if (count($this->v['posts']) > 0) {
foreach ($this->v['posts'] as $this->v['post']) {
?>
<li class="<?php
echo $this->pluginObjects['TemplatePluginFunctionCycle']->execute(array('values' => 'container-1,container-2'), $this);
?>
">
<div class="containerIcon">
<img src="<?php
echo StyleManager::getStyle()->getIconPath('postM.png');
示例14: count
if ($this->v['usersOnlineInvisible'] > 0) {
?>
(davon <?php
echo StringUtil::formatNumeric($this->v['usersOnlineInvisible']);
?>
unsichtbar)
<?php
}
if ($this->v['usersOnlineGuests'] > 0 && $this->v['usersOnlineMembers'] > 0) {
?>
und<?php
}
if ($this->v['usersOnlineGuests'] > 0) {
?>
<?php
echo StringUtil::formatNumeric($this->v['usersOnlineGuests']);
?>
Besucher
<?php
}
?>
</p>
<?php
if (count($this->v['usersOnline'])) {
?>
<p class="smallFont"><?php
$_length7296916c432afaf5c3ccb062e71f5fac51c04d93 = count($this->v['usersOnline']);
$_i7296916c432afaf5c3ccb062e71f5fac51c04d93 = 0;
foreach ($this->v['usersOnline'] as $this->v['userOnline']) {
?>
<a href="index.php?page=User&userID=<?php
示例15: foreach
?>
<?php
if (isset($this->v['activePollID']) && $this->v['activePollID'] == $this->v['pollID'] && $this->v['errorField'] == 'pollOptionID') {
?>
<p class="innerError smallFont">
<?php
if ($this->v['errorType'] == 'notValid') {
?>
You have not chosen a valid answer for this poll. Please choose at least one of the available answers!<?php
}
?>
<?php
if ($this->v['errorType'] == 'tooMuch') {
?>
You have chosen too many answers for this poll. The maximum allowed votes for this poll is <?php
echo StringUtil::formatNumeric($this->v['poll']->choiceCount);
?>
.<?php
}
?>
</p>
<?php
}
?>
</div>
</div>
<?php
if (count($this->v['poll']->getPollOptions()) > 0) {
foreach ($this->v['poll']->getPollOptions() as $this->v['pollOption']) {
?>