本文整理汇总了PHP中Format::get_size方法的典型用法代码示例。如果您正苦于以下问题:PHP Format::get_size方法的具体用法?PHP Format::get_size怎么用?PHP Format::get_size使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Format
的用法示例。
在下文中一共展示了Format::get_size方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1:
<input type="hidden" id="amount" name="amount" value="<?php
echo !empty($Bounty) ? $Bounty : '100';
?>
" />
<input type="hidden" id="current_uploaded" value="<?php
echo $LoggedUser['BytesUploaded'];
?>
" />
<input type="hidden" id="current_downloaded" value="<?php
echo $LoggedUser['BytesDownloaded'];
?>
" />
Bounty after tax: <strong><span id="bounty_after_tax">90.00 MB</span></strong><br />
If you add the entered <strong><span id="new_bounty">100.00 MB</span></strong> of bounty, your new stats will be: <br />
Uploaded: <span id="new_uploaded"><?php
echo Format::get_size($LoggedUser['BytesUploaded']);
?>
</span><br />
Ratio: <span id="new_ratio"><?php
echo Format::get_ratio_html($LoggedUser['BytesUploaded'], $LoggedUser['BytesDownloaded']);
?>
</span>
</td>
</tr>
<tr>
<td colspan="2" class="center">
<input type="submit" id="button" value="Create request" disabled="disabled" />
</td>
</tr>
<?php
} else {
示例2: NOW
if ($LoggedUser['BytesUploaded'] >= $Amount && $Filled === '0') {
// Create vote!
$DB->query("\n\t\tINSERT IGNORE INTO requests_votes\n\t\t\t(RequestID, UserID, Bounty)\n\t\tVALUES\n\t\t\t({$RequestID}, " . $LoggedUser['ID'] . ", {$Bounty})");
if ($DB->affected_rows() < 1) {
//Insert failed, probably a dupe vote, just increase their bounty.
$DB->query("\n\t\t\t\tUPDATE requests_votes\n\t\t\t\tSET Bounty = (Bounty + {$Bounty})\n\t\t\t\tWHERE UserID = " . $LoggedUser['ID'] . "\n\t\t\t\t\tAND RequestID = {$RequestID}");
echo 'dupe';
}
$DB->query("\n\t\tUPDATE requests\n\t\tSET LastVote = NOW()\n\t\tWHERE ID = {$RequestID}");
$Cache->delete_value("request_{$RequestID}");
$Cache->delete_value("request_votes_{$RequestID}");
$ArtistForm = Requests::get_artists($RequestID);
foreach ($ArtistForm as $Importance) {
foreach ($Importance as $Artist) {
$Cache->delete_value('artists_requests_' . $Artist['id']);
}
}
// Subtract amount from user
$DB->query("\n\t\tUPDATE users_main\n\t\tSET Uploaded = (Uploaded - {$Amount})\n\t\tWHERE ID = " . $LoggedUser['ID']);
$Cache->delete_value('user_stats_' . $LoggedUser['ID']);
Requests::update_sphinx_requests($RequestID);
echo 'success';
$DB->query("\n\t\tSELECT UserID\n\t\tFROM requests_votes\n\t\tWHERE RequestID = '{$RequestID}'\n\t\t\tAND UserID != '{$LoggedUser['ID']}'");
$UserIDs = array();
while (list($UserID) = $DB->next_record()) {
$UserIDs[] = $UserID;
}
NotificationsManager::notify_users($UserIDs, NotificationsManager::REQUESTALERTS, Format::get_size($Amount) . " of bounty has been added to a request you've voted on!", "requests.php?action=view&id=" . $RequestID);
} elseif ($LoggedUser['BytesUploaded'] < $Amount) {
echo 'bankrupt';
}
示例3: summary
/**
* Produce a summary text over the collector results
*
* @param bool $FilterStats whether to include filter stats in the report
* @return summary text
*/
public function summary($FilterStats)
{
global $ScriptStartTime;
$Time = number_format(1000 * (microtime(true) - $ScriptStartTime), 2) . " ms";
$Used = Format::get_size(memory_get_usage(true));
$Date = date("M d Y, H:i");
$NumSkipped = count($this->SkippedFiles);
return "Collector Download Summary for {$this->Title} - " . SITE_NAME . "\r\n" . "\r\n" . "User:\t\t{$this->User[Username]}\r\n" . "Passkey:\t{$this->User[torrent_pass]}\r\n" . "\r\n" . "Time:\t\t{$Time}\r\n" . "Used:\t\t{$Used}\r\n" . "Date:\t\t{$Date}\r\n" . "\r\n" . ($FilterStats !== false ? "Torrent groups analyzed:\t{$this->NumFound}\r\n" . "Torrent groups filtered:\t{$NumSkipped}\r\n" : "") . "Torrents downloaded:\t\t{$this->NumAdded}\r\n" . "\r\n" . "Total size of torrents (ratio hit): " . Format::get_size($this->Size) . "\r\n" . ($NumSkipped ? "\r\n" . "Albums unavailable within your criteria (consider making a request for your desired format):\r\n" . implode("\r\n", $this->SkippedFiles) . "\r\n" : "");
}
示例4:
" class="tooltip" title="Report">RP</a>
</span>
<strong><?php
echo $DisplayName;
?>
</strong>
<?php
Votes::vote_link($GroupID, $UserVote);
?>
<div class="tags"><?php
echo $TorrentTags->format();
?>
</div>
</td>
<td class="number_column nobr"><?php
echo Format::get_size($Torrent['Size']);
?>
</td>
<td class="number_column"><?php
echo number_format($Torrent['Snatched']);
?>
</td>
<td class="number_column<?php
echo $Torrent['Seeders'] == 0 ? ' r00' : '';
?>
"><?php
echo number_format($Torrent['Seeders']);
?>
</td>
<td class="number_column"><?php
echo number_format($Torrent['Leechers']);
示例5: filelist
function filelist($Str)
{
return "</td>\n<td>" . Format::get_size($Str[1]) . "</td>\n</tr>";
}
示例6: make_tree
function make_tree()
{
$QueryID = G::$DB->get_query_id();
$UserID = $this->UserID;
?>
<div class="invitetree pad">
<?php
G::$DB->query("\n\t\t\tSELECT TreePosition, TreeID, TreeLevel\n\t\t\tFROM invite_tree\n\t\t\tWHERE UserID = {$UserID}");
list($TreePosition, $TreeID, $TreeLevel) = G::$DB->next_record(MYSQLI_NUM, false);
if (!$TreeID) {
return;
}
G::$DB->query("\n\t\t\tSELECT TreePosition\n\t\t\tFROM invite_tree\n\t\t\tWHERE TreeID = {$TreeID}\n\t\t\t\tAND TreeLevel = {$TreeLevel}\n\t\t\t\tAND TreePosition > {$TreePosition}\n\t\t\tORDER BY TreePosition ASC\n\t\t\tLIMIT 1");
if (G::$DB->has_results()) {
list($MaxPosition) = G::$DB->next_record(MYSQLI_NUM, false);
} else {
$MaxPosition = false;
}
$TreeQuery = G::$DB->query("\n\t\t\tSELECT\n\t\t\t\tit.UserID,\n\t\t\t\tEnabled,\n\t\t\t\tPermissionID,\n\t\t\t\tDonor,\n\t\t\t\tUploaded,\n\t\t\t\tDownloaded,\n\t\t\t\tParanoia,\n\t\t\t\tTreePosition,\n\t\t\t\tTreeLevel\n\t\t\tFROM invite_tree AS it\n\t\t\t\tJOIN users_main AS um ON um.ID = it.UserID\n\t\t\t\tJOIN users_info AS ui ON ui.UserID = it.UserID\n\t\t\tWHERE TreeID = {$TreeID}\n\t\t\t\tAND TreePosition > {$TreePosition}" . ($MaxPosition ? " AND TreePosition < {$MaxPosition}" : '') . "\n\t\t\t\tAND TreeLevel > {$TreeLevel}\n\t\t\tORDER BY TreePosition");
$PreviousTreeLevel = $TreeLevel;
// Stats for the summary
$MaxTreeLevel = $TreeLevel;
// The deepest level (this changes)
$OriginalTreeLevel = $TreeLevel;
// The level of the user we're viewing
$BaseTreeLevel = $TreeLevel + 1;
// The level of users invited by our user
$Count = 0;
$Branches = 0;
$DisabledCount = 0;
$DonorCount = 0;
$ParanoidCount = 0;
$TotalUpload = 0;
$TotalDownload = 0;
$TopLevelUpload = 0;
$TopLevelDownload = 0;
$ClassSummary = array();
global $Classes;
foreach ($Classes as $ClassID => $Val) {
$ClassSummary[$ClassID] = 0;
}
// We store this in an output buffer, so we can show the summary at the top without having to loop through twice
ob_start();
while (list($ID, $Enabled, $Class, $Donor, $Uploaded, $Downloaded, $Paranoia, $TreePosition, $TreeLevel) = G::$DB->next_record(MYSQLI_NUM, false)) {
// Do stats
$Count++;
if ($TreeLevel > $MaxTreeLevel) {
$MaxTreeLevel = $TreeLevel;
}
if ($TreeLevel == $BaseTreeLevel) {
$Branches++;
$TopLevelUpload += $Uploaded;
$TopLevelDownload += $Downloaded;
}
$ClassSummary[$Class]++;
if ($Enabled == 2) {
$DisabledCount++;
}
if ($Donor) {
$DonorCount++;
}
// Manage tree depth
if ($TreeLevel > $PreviousTreeLevel) {
for ($i = 0; $i < $TreeLevel - $PreviousTreeLevel; $i++) {
echo "\n\n<ul class=\"invitetree\">\n\t<li>\n";
}
} elseif ($TreeLevel < $PreviousTreeLevel) {
for ($i = 0; $i < $PreviousTreeLevel - $TreeLevel; $i++) {
echo "\t</li>\n</ul>\n";
}
echo "\t</li>\n\t<li>\n";
} else {
echo "\t</li>\n\t<li>\n";
}
$UserClass = $Classes[$Class]['Level'];
?>
<strong><?php
echo Users::format_username($ID, true, true, $Enabled != 2 ? false : true, true);
?>
</strong>
<?php
if (check_paranoia(array('uploaded', 'downloaded'), $Paranoia, $UserClass)) {
$TotalUpload += $Uploaded;
$TotalDownload += $Downloaded;
?>
Uploaded: <strong><?php
echo Format::get_size($Uploaded);
?>
</strong>
Downloaded: <strong><?php
echo Format::get_size($Downloaded);
?>
</strong>
Ratio: <strong><?php
echo Format::get_ratio_html($Uploaded, $Downloaded);
?>
</strong>
<?php
} else {
$ParanoidCount++;
//.........这里部分代码省略.........
示例7:
?>
</strong>
<?php
}
if (check_paranoia('uploaded', $Paranoia, $Class, $FriendID)) {
?>
Up: <strong><?php
echo Format::get_size($Uploaded);
?>
</strong>
<?php
}
if (check_paranoia('downloaded', $Paranoia, $Class, $FriendID)) {
?>
Down: <strong><?php
echo Format::get_size($Downloaded);
?>
</strong>
<?php
}
?>
</span>
<?php
if (check_paranoia('lastseen', $Paranoia, $Class, $FriendID)) {
?>
<span style="float: right;"><?php
echo time_diff($LastAccess);
?>
</span>
<?php
}
示例8: flag_table
public function flag_table($Flags = false)
{
if (!is_array($Flags)) {
$Flags = $this->get_flags();
}
if (empty($Flags)) {
return;
}
?>
<table class="layout" width="100%">
<tr>
<td align="left"><strong><a href="#" onclick="$(this).parents('.layout').next('#debug_flags').gtoggle(); return false;" class="brackets">View</a> Flags:</strong></td>
</tr>
</table>
<table id="debug_flags" class="debug_table hidden" width="100%">
<tr valign="top">
<td align="left" class="debug_flags_event"><strong>Event</strong></td>
<td align="left" class="debug_flags_time"><strong>Page time</strong></td>
<?php
if ($Flags[0][3] !== false) {
?>
<td align="left" class="debug_flags_time"><strong>CPU time</strong></td>
<?php
}
?>
<td align="left" class="debug_flags_memory"><strong>Memory</strong></td>
</tr>
<?php
foreach ($Flags as $Flag) {
list($Event, $MicroTime, $Memory, $CPUTime) = $Flag;
?>
<tr valign="top">
<td align="left"><?php
echo $Event;
?>
</td>
<td align="left"><?php
echo number_format($MicroTime, 3);
?>
ms</td>
<?php
if ($CPUTime !== false) {
?>
<td align="left"><?php
echo number_format($CPUTime / 1000, 3);
?>
ms</td>
<?php
}
?>
<td align="left"><?php
echo Format::get_size($Memory);
?>
</td>
</tr>
<?php
}
?>
</table>
<?php
}
示例9: number_format
</li>
<li><strong>Mean download: </strong><?php
echo Format::get_size($TotalDownload / $NumUsers);
?>
</li>
<li><strong>Mean buffer: </strong><?php
echo Format::get_size(($TotalUpload - $TotalDownload) / $NumUsers);
?>
</li>
<br />
<li><strong>Total request bounty: </strong><?php
echo Format::get_size($TotalBounty);
?>
</li>
<li><strong>Available request bounty: </strong><?php
echo Format::get_size($AvailableBounty);
?>
</li>
</ul>
</div>
</div>
<br />
<div class="box">
<div class="head">Swarms and snatches</div>
<div class="pad">
<ul class="stats nobullet">
<li><strong>Total seeders: </strong><?php
echo number_format($TotalSeeders);
?>
</li>
<li><strong>Total leechers: </strong><?php
示例10: generate_torrent_table
//.........这里部分代码省略.........
<div class="group_image float_left clear">
<?php
ImageTools::cover_thumb($WikiImage, $GroupCategoryID);
?>
</div>
<?php
}
?>
<div class="group_info clear">
<span><a href="torrents.php?action=download&id=<?php
echo $TorrentID;
?>
&authkey=<?php
echo $LoggedUser['AuthKey'];
?>
&torrent_pass=<?php
echo $LoggedUser['torrent_pass'];
?>
" title="Download" class="brackets tooltip">DL</a></span>
<strong><?php
echo $DisplayName;
?>
</strong> <?php
echo $ExtraInfo;
if ($Reported) {
?>
- <strong class="torrent_label tl_reported">Reported</strong><?php
}
if ($IsBookmarked) {
?>
<span class="remove_bookmark float_right">
<a href="#" id="bookmarklink_torrent_<?php
echo $GroupID;
?>
" class="bookmarklink_torrent_<?php
echo $GroupID;
?>
brackets" onclick="Unbookmark('torrent', <?php
echo $GroupID;
?>
, 'Bookmark'); return false;">Remove bookmark</a>
</span>
<?php
} else {
?>
<span class="add_bookmark float_right">
<a href="#" id="bookmarklink_torrent_<?php
echo $GroupID;
?>
" class="bookmarklink_torrent_<?php
echo $GroupID;
?>
brackets" onclick="Bookmark('torrent', <?php
echo $GroupID;
?>
, 'Remove bookmark'); return false;">Bookmark</a>
</span>
<?php
}
?>
<div class="tags"><?php
echo $TorrentTags->format();
?>
</div>
</div>
</td>
<td class="number_column nobr"><?php
echo Format::get_size($Size);
?>
</td>
<td class="number_column nobr"><?php
echo Format::get_size($Data);
?>
</td>
<td class="number_column"><?php
echo number_format((double) $Snatched);
?>
</td>
<td class="number_column"><?php
echo number_format((double) $Seeders);
?>
</td>
<td class="number_column"><?php
echo number_format((double) $Leechers);
?>
</td>
<td class="number_column"><?php
echo number_format($Seeders + $Leechers);
?>
</td>
</tr>
<?php
}
//foreach ($Details as $Detail)
?>
</table><br />
<?php
}
示例11: number_format
?>
" class="brackets">Schema</a></td>
</tr>
<?php
}
?>
<tr>
<td></td>
<td></td>
<td><?php
echo number_format($TotalRows);
?>
</td>
<td></td>
<td><?php
echo Format::get_size($TotalDataSize);
?>
</td>
<td><?php
echo Format::get_size($TotalIndexSize);
?>
</td>
<td><?php
echo Format::get_size($TotalDataSize + $TotalIndexSize);
?>
</td>
<td></td>
</tr>
</table>
<?php
View::show_footer();
示例12: get_perf
public function get_perf()
{
$PageTime = microtime(true) - $this->timestart;
$CPUTime = self::get_cpu_time();
$Perf = array('RameUsage' => Format::get_size(memory_get_usage(true)), 'TimePage' => number_format($PageTime, 3) . ' s');
if ($CPUTime) {
$Perf['TimeCPU'] = number_format($CPUTime / 1000000, 3) . ' s';
}
return $Perf;
}
示例13:
?>
" />
<a href="javascript:Vote(0, <?php
echo $RequestID;
?>
)" class="brackets"><strong>+</strong></a>
<?php
}
?>
</td>
<td class="nobr">
<span id="bounty_<?php
echo $RequestID;
?>
"><?php
echo Format::get_size($Request['Bounty']);
?>
</span>
</td>
<td>
<?php
echo time_diff($Request['TimeAdded']);
?>
</td>
</tr>
<?php
}
?>
</table>
<?php
}
示例14: site_url
// If we can't take it all out of upload, zero that out and add whatever is left as download.
$DB->query("\n\t\tUPDATE users_main\n\t\tSET Uploaded = 0\n\t\tWHERE ID = {$FillerID}");
$DB->query('
UPDATE users_main
SET Downloaded = Downloaded + ' . ($RequestVotes['TotalBounty'] - $Uploaded) . "\n\t\tWHERE ID = {$FillerID}");
} else {
$DB->query('
UPDATE users_main
SET Uploaded = Uploaded - ' . $RequestVotes['TotalBounty'] . "\n\t\tWHERE ID = {$FillerID}");
}
Misc::send_pm($FillerID, 0, 'A request you filled has been unfilled', "The request \"[url=" . site_url() . "requests.php?action=view&id={$RequestID}]{$FullName}" . "[/url]\" was unfilled by [url=" . site_url() . 'user.php?id=' . $LoggedUser['ID'] . ']' . $LoggedUser['Username'] . '[/url] for the reason: [quote]' . $_POST['reason'] . "[/quote]\nIf you feel like this request was unjustly unfilled, please [url=" . site_url() . "reports.php?action=report&type=request&id={$RequestID}]report the request[/url] and explain why this request should not have been unfilled.");
$Cache->delete_value("user_stats_{$FillerID}");
if ($UserID !== $LoggedUser['ID']) {
Misc::send_pm($UserID, 0, 'A request you created has been unfilled', "The request \"[url=" . site_url() . "requests.php?action=view&id={$RequestID}]{$FullName}" . "[/url]\" was unfilled by [url=" . site_url() . 'user.php?id=' . $LoggedUser['ID'] . ']' . $LoggedUser['Username'] . "[/url] for the reason: [quote]" . $_POST['reason'] . '[/quote]');
}
Misc::write_log("Request {$RequestID} ({$FullName}), with a " . Format::get_size($RequestVotes['TotalBounty']) . ' bounty, was unfilled by user ' . $LoggedUser['ID'] . ' (' . $LoggedUser['Username'] . ') for the reason: ' . $_POST['reason']);
$Cache->delete_value("request_{$RequestID}");
$Cache->delete_value("request_artists_{$RequestID}");
if ($GroupID) {
$Cache->delete_value("requests_group_{$GroupID}");
}
Requests::update_sphinx_requests($RequestID);
if (!empty($ArtistForm)) {
foreach ($ArtistForm as $ArtistType) {
foreach ($ArtistType as $Artist) {
$Cache->delete_value('artists_requests_' . $Artist['id']);
}
}
}
$SphQL = new SphinxqlQuery();
$SphQL->raw_query("\n\t\tUPDATE requests, requests_delta\n\t\tSET torrentid = 0, fillerid = 0\n\t\tWHERE id = {$RequestID}", false);
示例15: generate_user_table
function generate_user_table($Caption, $Tag, $Details, $Limit)
{
global $Time;
?>
<h3>Top <?php
echo $Limit . ' ' . $Caption;
?>
<small class="top10_quantity_links">
<?php
switch ($Limit) {
case 100:
?>
- <a href="top10.php?type=users&details=<?php
echo $Tag;
?>
" class="brackets">Top 10</a>
- <span class="brackets">Top 100</span>
- <a href="top10.php?type=users&limit=250&details=<?php
echo $Tag;
?>
" class="brackets">Top 250</a>
<?php
break;
case 250:
?>
- <a href="top10.php?type=users&details=<?php
echo $Tag;
?>
" class="brackets">Top 10</a>
- <a href="top10.php?type=users&limit=100&details=<?php
echo $Tag;
?>
" class="brackets">Top 100</a>
- <span class="brackets">Top 250</span>
<?php
break;
default:
?>
- <span class="brackets">Top 10</span>
- <a href="top10.php?type=users&limit=100&details=<?php
echo $Tag;
?>
" class="brackets">Top 100</a>
- <a href="top10.php?type=users&limit=250&details=<?php
echo $Tag;
?>
" class="brackets">Top 250</a>
<?php
}
?>
</small>
</h3>
<table class="border">
<tr class="colhead">
<td class="center">Rank</td>
<td>User</td>
<td style="text-align: right;">Uploaded</td>
<td style="text-align: right;">UL speed</td>
<td style="text-align: right;">Downloaded</td>
<td style="text-align: right;">DL speed</td>
<td style="text-align: right;">Uploads</td>
<td style="text-align: right;">Ratio</td>
<td style="text-align: right;">Joined</td>
</tr>
<?php
// in the unlikely event that query finds 0 rows...
if (empty($Details)) {
echo '
<tr class="rowb">
<td colspan="9" class="center">
Found no users matching the criteria
</td>
</tr>
</table><br />';
return;
}
$Rank = 0;
foreach ($Details as $Detail) {
$Rank++;
$Highlight = $Rank % 2 ? 'a' : 'b';
?>
<tr class="row<?php
echo $Highlight;
?>
">
<td class="center"><?php
echo $Rank;
?>
</td>
<td><?php
echo Users::format_username($Detail['ID'], false, false, false);
?>
</td>
<td class="number_column"><?php
echo Format::get_size($Detail['Uploaded']);
?>
</td>
<td class="number_column tooltip" title="Upload speed is reported in base 2 in bytes per second, not bits per second."><?php
echo Format::get_size($Detail['UpSpeed']);
?>
//.........这里部分代码省略.........