本文整理汇总了PHP中Format::get_ratio_html方法的典型用法代码示例。如果您正苦于以下问题:PHP Format::get_ratio_html方法的具体用法?PHP Format::get_ratio_html怎么用?PHP Format::get_ratio_html使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Format
的用法示例。
在下文中一共展示了Format::get_ratio_html方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: IF
if (!$PeerStatsLocked) {
$Cache->cache_value('stats_peers_lock', 1, 30);
$DB->query("\n\t\t\tSELECT IF(remaining=0,'Seeding','Leeching') AS Type, COUNT(uid)\n\t\t\tFROM xbt_files_users\n\t\t\tWHERE active = 1\n\t\t\tGROUP BY Type");
$PeerCount = $DB->to_array(0, MYSQLI_NUM, false);
$SeederCount = $PeerCount['Seeding'][1] ?: 0;
$LeecherCount = $PeerCount['Leeching'][1] ?: 0;
$Cache->cache_value('stats_peers', array($LeecherCount, $SeederCount), 1209600);
// 2 week cache
$Cache->delete_value('stats_peers_lock');
}
} else {
$PeerStatsLocked = false;
list($LeecherCount, $SeederCount) = $PeerStats;
}
if (!$PeerStatsLocked) {
$Ratio = Format::get_ratio_html($SeederCount, $LeecherCount);
$PeerCount = number_format($SeederCount + $LeecherCount);
$SeederCount = number_format($SeederCount);
$LeecherCount = number_format($LeecherCount);
} else {
$PeerCount = $SeederCount = $LeecherCount = $Ratio = 'Server busy';
}
?>
<li>Peers: <?php
echo $PeerCount;
?>
</li>
<li>Seeders: <?php
echo $SeederCount;
?>
</li>
示例2:
" title="<?php
echo Format::get_size($Downloaded, 5);
?>
">Downloaded: <?php
echo Format::get_size($Downloaded);
?>
</li>
<?php
}
if ($Override = check_paranoia_here('ratio')) {
?>
<li<?php
echo $Override === 2 ? ' class="paranoia_override"' : '';
?>
>Ratio: <?php
echo Format::get_ratio_html($Uploaded, $Downloaded);
?>
</li>
<?php
}
if (($Override = check_paranoia_here('requiredratio')) && isset($RequiredRatio)) {
?>
<li<?php
echo $Override === 2 ? ' class="paranoia_override"' : '';
?>
>Required Ratio: <span class="tooltip" title="<?php
echo number_format((double) $RequiredRatio, 5);
?>
"><?php
echo number_format((double) $RequiredRatio, 2);
?>
示例3: translateUserStatus
if ($EnableUser != $Cur['Enabled'] && check_perms('users_disable_users')) {
$EnableStr = 'account ' . translateUserStatus($Cur['Enabled']) . '->' . translateUserStatus($EnableUser);
if ($EnableUser == '2') {
Tools::disable_users($UserID, '', 1);
$TrackerUserUpdates = array();
} elseif ($EnableUser == '1') {
$Cache->increment('stats_user_count');
$VisibleTrIP = $Visible && $Cur['IP'] != '127.0.0.1' ? '1' : '0';
Tracker::update_tracker('add_user', array('id' => $UserID, 'passkey' => $Cur['torrent_pass'], 'visible' => $VisibleTrIP));
if ($Cur['Downloaded'] == 0 || $Cur['Uploaded'] / $Cur['Downloaded'] >= $Cur['RequiredRatio']) {
$UpdateSet[] = "i.RatioWatchEnds = '0000-00-00 00:00:00'";
$CanLeech = 1;
$UpdateSet[] = "m.can_leech = '1'";
$UpdateSet[] = "i.RatioWatchDownload = '0'";
} else {
$EnableStr .= ' (Ratio: ' . Format::get_ratio_html($Cur['Uploaded'], $Cur['Downloaded'], false) . ', RR: ' . number_format($Cur['RequiredRatio'], 2) . ')';
if ($Cur['RatioWatchEnds'] != '0000-00-00 00:00:00') {
$UpdateSet[] = "i.RatioWatchEnds = NOW()";
$UpdateSet[] = "i.RatioWatchDownload = m.Downloaded";
$CanLeech = 0;
}
$TrackerUserUpdates['can_leech'] = 0;
}
$UpdateSet[] = "Enabled = '1'";
$LightUpdates['Enabled'] = 1;
}
$EditSummary[] = $EnableStr;
$Cache->replace_value("enabled_{$UserID}", $EnableUser, 0);
}
if ($ResetPasskey == 1 && check_perms('users_edit_reset_keys')) {
$Passkey = db_string(Users::make_secret());
示例4: echo
<input type="hidden" id="current_rr" value="<?php
echo (double) $LoggedUser['RequiredRatio'];
?>
" />
<input id="total_bounty" type="hidden" value="<?php
echo $RequestVotes['TotalBounty'];
?>
" />
Bounty after tax: <strong><span id="bounty_after_tax">0.00 MB</span></strong><br />
If you add the entered <strong><span id="new_bounty">0.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>
<input type="button" id="button" value="Vote!" disabled="disabled" onclick="Vote();" />
</form>
</td>
</tr>
<?php
}
?>
<tr id="bounty">
<td class="label">Bounty</td>
<td id="formatted_bounty"><?php
echo Format::get_size($RequestVotes['TotalBounty']);
?>
</td>
示例5: 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++;
//.........这里部分代码省略.........
示例6: generate_user_table
//.........这里部分代码省略.........
" 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']);
?>
/s</td>
<td class="number_column"><?php
echo Format::get_size($Detail['Downloaded']);
?>
</td>
<td class="number_column tooltip" title="Download speed is reported in base 2 in bytes per second, not bits per second."><?php
echo Format::get_size($Detail['DownSpeed']);
?>
/s</td>
<td class="number_column"><?php
echo number_format($Detail['NumUploads']);
?>
</td>
<td class="number_column"><?php
echo Format::get_ratio_html($Detail['Uploaded'], $Detail['Downloaded']);
?>
</td>
<td class="number_column"><?php
echo time_diff($Detail['JoinDate']);
?>
</td>
</tr>
<?php
}
?>
</table><br />
<?php
}
示例7: number_format
?>
</li>
<li><strong>Total peers: </strong><?php
echo number_format($TotalSeeders + $TotalLeechers);
?>
</li>
<li><strong>Total snatches: </strong><?php
echo number_format($TotalOverallSnatches);
?>
</li>
<li><strong>Seeder/leecher ratio: </strong><?php
echo Format::get_ratio_html($TotalSeeders, $TotalLeechers);
?>
</li>
<li><strong>Seeder/snatch ratio: </strong><?php
echo Format::get_ratio_html($TotalSeeders, $TotalOverallSnatches);
?>
</li>
<br />
<li><strong>Mean seeders per torrent: </strong><?php
echo number_format($TotalSeeders / $TotalTorrents, 2);
?>
</li>
<li><strong>Mean leechers per torrent: </strong><?php
echo number_format($TotalLeechers / $TotalTorrents, 2);
?>
</li>
<li><strong>Mean snatches per torrent: </strong><?php
echo number_format($TotalSnatches / $TotalTorrents, 2);
?>
</li>
示例8:
<tr class="row<?php
echo $Row;
?>
">
<td><?php
echo Users::format_username($UserID, true, true, true, true);
?>
<br /><?php
echo Users::format_username($InviterID, true, true, true, true);
?>
</td>
<td><?php
echo Format::get_ratio_html($Uploaded, $Downloaded);
?>
<br /><?php
echo Format::get_ratio_html($InviterUploaded, $InviterDownloaded);
?>
</td>
<td>
<span style="float: left;"><?php
echo display_str($Email);
?>
</span>
<span style="float: right;"><a href="userhistory.php?action=email&userid=<?php
echo $UserID;
?>
" title="History" class="brackets tooltip">H</a> <a href="/user.php?action=search&email_history=on&email=<?php
echo display_str($Email);
?>
" title="Search" class="brackets tooltip">S</a></span><br />
<span style="float: left;"><?php