本文整理汇总了PHP中trunc函数的典型用法代码示例。如果您正苦于以下问题:PHP trunc函数的具体用法?PHP trunc怎么用?PHP trunc使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了trunc函数的19个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: BlockPlayer
function BlockPlayer($check, $sid, $num, $type, $length)
{
$objResponse = new xajaxResponse();
global $userbank, $username;
$sid = (int) $sid;
$length = (int) $length;
if (!$userbank->HasAccess(ADMIN_OWNER | ADMIN_ADD_BAN)) {
$objResponse->redirect("index.php?p=login&m=no_access", 0);
$log = new CSystemLog("w", "Hacking Attempt", $username . " tried to process a playerblock, but doesnt have access.");
return $objResponse;
}
//get the server data
$sdata = $GLOBALS['db']->GetRow("SELECT ip, port, rcon FROM " . DB_PREFIX . "_servers WHERE sid = '" . $sid . "';");
//test if server is online
if ($test = @fsockopen($sdata['ip'], $sdata['port'], $errno, $errstr, 2)) {
@fclose($test);
require_once INCLUDES_PATH . "/CServerRcon.php";
$r = new CServerRcon($sdata['ip'], $sdata['port'], $sdata['rcon']);
if (!$r->Auth()) {
$GLOBALS['db']->Execute("UPDATE " . DB_PREFIX . "_servers SET rcon = '' WHERE sid = '" . $sid . "' LIMIT 1;");
$objResponse->addAssign("srv_{$num}", "innerHTML", "<font color='red' size='1'>Wrong RCON Password, please change!</font>");
$objResponse->addScript('set_counter(1);');
return $objResponse;
}
$ret = $r->rconCommand("status");
// show hostname instead of the ip, but leave the ip in the title
require_once "../includes/system-functions.php";
$hostsearch = preg_match_all('/hostname:[ ]*(.+)/', $ret, $hostname, PREG_PATTERN_ORDER);
$hostname = trunc(htmlspecialchars($hostname[1][0]), 25, false);
if (!empty($hostname)) {
$objResponse->addAssign("srvip_{$num}", "innerHTML", "<font size='1'><span title='" . $sdata['ip'] . ":" . $sdata['port'] . "'>" . $hostname . "</span></font>");
}
$gothim = false;
$search = preg_match_all(STATUS_PARSE, $ret, $matches, PREG_PATTERN_ORDER);
//search for the steamid on the server
foreach ($matches[3] as $match) {
if (substr($match, 8) == substr($check, 8)) {
// gotcha!!! kick him!
$gothim = true;
$GLOBALS['db']->Execute("UPDATE `" . DB_PREFIX . "_comms` SET sid = '" . $sid . "' WHERE authid = '" . $check . "' AND RemovedBy IS NULL;");
$requri = substr($_SERVER['REQUEST_URI'], 0, strrpos($_SERVER['REQUEST_URI'], "pages/admin.blockit.php"));
$kick = $r->sendCommand("sc_fw_block " . $type . " " . $length . " " . $match);
$objResponse->addAssign("srv_{$num}", "innerHTML", "<font color='green' size='1'><b><u>Player Found & blocked!!!</u></b></font>");
$objResponse->addScript("set_counter('-1');");
return $objResponse;
}
}
if (!$gothim) {
$objResponse->addAssign("srv_{$num}", "innerHTML", "<font size='1'>Player not found.</font>");
$objResponse->addScript('set_counter(1);');
return $objResponse;
}
} else {
$objResponse->addAssign("srv_{$num}", "innerHTML", "<font color='red' size='1'><i>Can't connect to server.</i></font>");
$objResponse->addScript('set_counter(1);');
return $objResponse;
}
}
开发者ID:CodingDK,项目名称:SourceBans-Fork,代码行数:58,代码来源:admin.blockit.php
示例2: getName
/**
* Get the name to display in the top right of the navigation bar
*
* @param number $maxLength
* @return string
*/
function getName($maxLength = 15)
{
global $userProfile;
$displayName = "";
if ($userProfile) {
$displayName = $userProfile->email;
}
$displayName = trunc($displayName, $maxLength);
return $displayName;
}
开发者ID:TroogS,项目名称:eap,代码行数:16,代码来源:navigation.php
示例3: _get_description
function _get_description($id, $post_type)
{
if (get_field('meta_description') != '') {
$descr = get_field('meta_description');
} else {
if ($post_type == 'post') {
$descr = trunc(strip_tags(get_field('person_bio')), 30);
} else {
$descr = get_field('meta_description', $GLOBALS['HOME_ID']);
}
}
return $descr;
}
开发者ID:vinoddope,项目名称:neilcarpenter.com-V2,代码行数:13,代码来源:misc.php
示例4: trunc
?>
<h1 class="navbar-displayname">
<div class="visible-inline-xs"><?php
echo trunc($communityName, 20);
?>
</div>
<div class="visible-inline-sm"><?php
echo trunc($communityName, 40);
?>
</div>
<div class="visible-inline-md"><?php
echo trunc($communityName, 45);
?>
</div>
<div class="visible-inline-lg"><?php
echo trunc($communityName, 50);
?>
</div>
</h1>
<?php
}
?>
</span>
</div>
<!-- Collect the nav links, forms, and other content for toggling -->
<div
class="collapse navbar-collapse navbar-right navbar-main-collapse">
<?php
echo $nav->build();
?>
开发者ID:TroogS,项目名称:eap,代码行数:31,代码来源:navigation.php
示例5: sortOutValues
public function sortOutValues($data)
{
//net value is unit-price * quantity
$this->net_value = round(bcmul($this->sales_qty, $this->sales_price, 4), 2);
//tax (in the UK at least) is dependent on the tax_rate of the item, and the tax status of the customer.
//this function is a wrapper to a call to a config-dependent method
$tax_percentage = calc_tax_percentage($data['tax_rate_id'], $data['tax_status_id'], $this->net_value);
$this->tax_percentage = $tax_percentage;
//tax_value is the tax percentage of the net value
$this->tax_value = trunc(bcmul($this->net_value, $tax_percentage), 2);
}
开发者ID:uzerpllp,项目名称:uzerp,代码行数:11,代码来源:SInvoiceLine.php
示例6: array
require_once "cnf.php";
if (isset($_GET['load_more'])) {
$l_id = $_GET['l_id'];
$data = array();
$q = mysql_query("select *, s.id as sid from shule as s join pic as p join user as u on s.author=u.id and s.cover=p.id where s.id<{$l_id} order by s.id desc limit 6");
$qt = mysql_query("select id from shule");
$tot_r = mysql_num_rows($qt);
while ($r = mysql_fetch_assoc($q)) {
$id = $r['sid'];
$title = $r['title'];
$cover = $r['src'];
$intro = $r['body'];
$published = $r['created'];
$category = $r['category'];
$intro = trunc($intro, 25, $id);
switch ($category) {
case 1:
$category = "Apps";
break;
case 2:
$category = "Gadgets";
break;
case 3:
$category = "Startups";
break;
case 4:
$category = "Social";
break;
case 5:
$category = "Multimedia";
开发者ID:Plus256,项目名称:TendoVillage,代码行数:30,代码来源:ld_mo.php
示例7: displayInbox
function displayInbox()
{
global $db, $form, $user;
echo '
<div class="green_contentbox">
<div class="green_content_top">
<h3 class="content_box_header">Personal Messaging System - Inbox</h3>
</div>
<div class="green_content">
<form action="process.php" method="post">
<input type="hidden" name="cmd" value="delete_message" />
<table class="general_info" width="95%" cellpadding="0" cellspacing="0">
<tr>
<td width="5%">
</td>
<td class="minor_header" width="25%">
<h4 class="content_box_minor_header">
Title
</h4>
</td>
<td class="minor_header" width="25%">
<h4 class="content_box_minor_header">
Preview
</h4>
</td>
<td class="minor_header" width="25%">
<h4 class="content_box_minor_header">
From
</h4>
</td>
<td class="minor_header" width="10%">
<h4 class="content_box_minor_header">
Date
</h4>
</td>
<td class="minor_header" width="10%" >
<h4 class="content_box_minor_header">
Read?
</h4>
</td>
</tr>
';
$sql = 'select id
from messages
where messages.to = "' . $user->username . '"
order by date desc
;';
$result = mysql_query($sql);
while ($row = mysql_fetch_array($result)) {
$message = new Message();
$message->getInfo($user->username, $row['id']);
if ($db->messages($user->username) == 0) {
echo 'You do not have any messages.';
} else {
echo '
<tr>
<td>
<input type="checkbox" name="delete[]" value="' . $message->id . '" />
</td>
<td>
<a class="' . $message->class . '" href="index.php?view=user_personal&cmd=displayInbox&mid=' . $message->id . '">' . $message->title . '</font>
</td>
<td>
' . trunc($message->text, 5) . '
</td>
<td>
' . $db->titleFromUsername($message->from) . '
</td>
<td>
' . dateFromTimestamp($message->date) . '
</td>
<td>
';
if ($message->read == 1) {
echo 'Yes';
}
if ($message->read == 0) {
echo 'No';
}
echo '
</td>
</tr>
';
}
}
echo '
</table>
<br />
<hr class="cb" />
<input type="submit" value="Delete Selected" />
<div>' . $form->error("security") . '</div>
<div>' . $_SESSION['event'] . '</div>
</form>
<hr class="cb" />
<a class="return" href="index.php?view=console">Click Here to return to your Console</a>
</div>
<div class="green_content_bottom">
</div>
</div>
//.........这里部分代码省略.........
开发者ID:sovcn,项目名称:Sovereign-Clan-Manager,代码行数:101,代码来源:message.php
示例8: display
function display($select)
{
global $db;
switch ($select) {
case 1:
echo '
<div class="news_header_left">
<div class="news_header_title_4" style="background: url(templates/orange_rush/images/java/java_03.jpg); height: 25px;">
<a href="index.php?newsid=4">' . $this->news_list[4]->title . '</a>
</div>
<div class="news_header_title_3" style="background: url(templates/orange_rush/images/java/java_03.jpg); height: 25px;">
<a href="index.php?newsid=3">' . $this->news_list[3]->title . '</a>
</div>
<div class="news_header_title_2" style="background: url(templates/orange_rush/images/java/java_03.jpg); height: 25px;">
<a href="index.php?newsid=2">' . $this->news_list[2]->title . '</a>
</div>
<div class="news_header_text_1" style="background: url(templates/orange_rush/images/java/java_07.jpg); height: 118px;">
<h3>' . $this->news_list[1]->title . ' - <a style="font-size: 10px;" href="index.php?view=news">[ View More ]</a></h3>
<p class="newstext">' . trunc(strip_tags($this->news_list[1]->news), 25) . '</p>
<h5>Posted by <strong>' . $db->titleFromUsername($this->news_list[1]->poster) . '</strong> at
<strong>' . dateFromTimestamp_Long($this->news_list[1]->date) . '</strong></h5>
</div>
</div>
';
break;
case 2:
echo '
<div class="news_header_left">
<div class="news_header_title_4" style="background: url(templates/orange_rush/images/java/java_03.jpg); height: 25px;">
<a href="index.php?newsid=4">' . $this->news_list[4]->title . '</a></div>
<div class="news_header_title_3" style="background: url(templates/orange_rush/images/java/java_03.jpg); height: 25px;">
<a href="index.php?newsid=3">' . $this->news_list[3]->title . '</a></div>
<div class="news_header_text_2" style="background: url(templates/orange_rush/images/java/java_07.jpg); height: 118px;">
<h3>' . $this->news_list[2]->title . ' - <a style="font-size: 10px;" href="index.php?view=news">[ View More ]</a></h3>
<p class="newstext">' . trunc(strip_tags($this->news_list[2]->news), 25) . '</p>
<h5>Posted by <strong>' . $db->titleFromUsername($this->news_list[2]->poster) . '</strong> at
<strong>' . dateFromTimestamp_Long($this->news_list[2]->date) . '</strong></h5>
</div>
<div class="news_header_title_1" style="background: url(templates/orange_rush/images/java/java_03.jpg); height: 25px;">
<a href="index.php?newsid=1">' . $this->news_list[1]->title . '</a></div>
</div>
';
break;
case 3:
echo '
<div class="news_header_left">
<div class="news_header_title_4" style="background: url(templates/orange_rush/images/java/java_03.jpg); height: 25px;">
<a href="index.php?newsid=4">' . $this->news_list[4]->title . '</a></div>
<div class="news_header_text_3" style="background: url(templates/orange_rush/images/java/java_07.jpg); height: 118px;">
<h3>' . $this->news_list[3]->title . ' - <a style="font-size: 10px;" href="index.php?view=news">[ View More ]</a></h3>
<p class="newstext">' . trunc(strip_tags($this->news_list[3]->news), 25) . '</p>
<h5>Posted by <strong>' . $db->titleFromUsername($this->news_list[3]->poster) . '</strong> at
<strong>' . dateFromTimestamp_Long($this->news_list[3]->date) . '</strong></h5>
</div>
<div class="news_header_title_2" style="background: url(templates/orange_rush/images/java/java_03.jpg); height: 25px;">
<a href="index.php?newsid=2">' . $this->news_list[2]->title . '</a></div>
<div class="news_header_title_1" style="background: url(templates/orange_rush/images/java/java_03.jpg); height: 25px;">
<a href="index.php?newsid=1">' . $this->news_list[1]->title . '</a></div>
</div>
';
break;
case 4:
echo '
<div class="news_header_left">
<div class="news_header_text_4" style="background: url(templates/orange_rush/images/java/java_07.jpg); height: 118px;">
<h3>' . $this->news_list[4]->title . ' - <a style="font-size: 10px;" href="index.php?view=news">[ View More ]</a></h3>
<p class="newstext">' . trunc(strip_tags($this->news_list[4]->news), 25) . '</p>
<h5>Posted by <strong>' . $db->titleFromUsername($this->news_list[4]->poster) . '</strong> at
<strong>' . dateFromTimestamp_Long($this->news_list[4]->date) . '</strong></h5>
</div>
<div class="news_header_title_3" style="background: url(templates/orange_rush/images/java/java_03.jpg); height: 25px;">
<a href="index.php?newsid=3">' . $this->news_list[3]->title . '</a></div>
<div class="news_header_title_2" style="background: url(templates/orange_rush/images/java/java_03.jpg); height: 25px;">
<a href="index.php?newsid=2">' . $this->news_list[2]->title . '</a></div>
<div class="news_header_title_1" style="background: url(templates/orange_rush/images/java/java_03.jpg); height: 25px;">
<a href="index.php?newsid=1">' . $this->news_list[1]->title . '</a></div>
</div>
';
break;
default:
echo '
<div class="news_header_left">
<div class="news_header_title_4" style="background: url(templates/orange_rush/images/java/java_03.jpg); height: 25px;">
<a href="index.php?newsid=4">' . $this->news_list[4]->title . '</a>
</div>
<div class="news_header_title_3" style="background: url(templates/orange_rush/images/java/java_03.jpg); height: 25px;">
<a href="index.php?newsid=3">' . $this->news_list[3]->title . '</a>
</div>
<div class="news_header_title_2" style="background: url(templates/orange_rush/images/java/java_03.jpg); height: 25px;">
<a href="index.php?newsid=2">' . $this->news_list[2]->title . '</a>
</div>
<div class="news_header_text_1" style="background: url(templates/orange_rush/images/java/java_07.jpg); height: 118px;">
<h3>' . $this->news_list[1]->title . ' - <a style="font-size: 10px;" href="index.php?view=news">[ View More ]</a></h3>
<p class="newstext">' . trunc(strip_tags($this->news_list[1]->news), 25) . '</p>
<h5>Posted by <strong>' . $db->titleFromUsername($this->news_list[1]->poster) . '</strong> at
<strong>' . dateFromTimestamp_Long($this->news_list[1]->date) . '</strong></h5>
</div>
</div>
';
break;
//.........这里部分代码省略.........
开发者ID:sovcn,项目名称:Sovereign-Clan-Manager,代码行数:101,代码来源:news.php
示例9: KickPlayer
function KickPlayer($check, $sid, $num, $type)
{
$objResponse = new xajaxResponse();
global $userbank, $username;
$sid = (int) $sid;
if (!$userbank->HasAccess(ADMIN_OWNER | ADMIN_ADD_BAN)) {
$objResponse->redirect("index.php?p=login&m=no_access", 0);
$log = new CSystemLog("w", "Ошибка доступа", $username . " пытался кого-то кикнуть, не имея на это прав.");
return $objResponse;
}
//get the server data
$sdata = $GLOBALS['db']->GetRow("SELECT ip, port, rcon FROM " . DB_PREFIX . "_servers WHERE sid = '" . $sid . "';");
//test if server is online
if ($test = @fsockopen($sdata['ip'], $sdata['port'], $errno, $errstr, 2)) {
@fclose($test);
require_once INCLUDES_PATH . "/CServerRcon.php";
$r = new CServerRcon($sdata['ip'], $sdata['port'], $sdata['rcon']);
if (!$r->Auth()) {
$GLOBALS['db']->Execute("UPDATE " . DB_PREFIX . "_servers SET rcon = '' WHERE sid = '" . $sid . "' LIMIT 1;");
$objResponse->addAssign("srv_{$num}", "innerHTML", "<font color='red' size='1'>Неверный РКОН!</font>");
$objResponse->addScript('set_counter(1);');
return $objResponse;
}
$ret = $r->rconCommand("status");
// show hostname instead of the ip, but leave the ip in the title
require_once "../includes/system-functions.php";
$hostsearch = preg_match_all('/hostname:[ ]*(.+)/', $ret, $hostname, PREG_PATTERN_ORDER);
$hostname = trunc(htmlspecialchars($hostname[1][0]), 25, false);
if (!empty($hostname)) {
$objResponse->addAssign("srvip_{$num}", "innerHTML", "<font size='1'><span title='" . $sdata['ip'] . ":" . $sdata['port'] . "'>" . $hostname . "</span></font>");
}
$gothim = false;
$search = preg_match_all(STATUS_PARSE, $ret, $matches, PREG_PATTERN_ORDER);
//search for the steamid on the server
if ((int) $type == 0) {
foreach ($matches[3] as $match) {
if (substr($match, 8) == substr($check, 8)) {
// gotcha!!! kick him!
$gothim = true;
$GLOBALS['db']->Execute("UPDATE `" . DB_PREFIX . "_bans` SET sid = '" . $sid . "' WHERE authid = '" . $check . "' AND RemovedBy IS NULL;");
$requri = substr($_SERVER['REQUEST_URI'], 0, strrpos($_SERVER['REQUEST_URI'], "pages/admin.kickit.php"));
$kick = $r->sendCommand("kickid " . $match . " \"Вы были забанены, посетите http://" . $_SERVER['HTTP_HOST'] . $requri . " для большей информации.\"");
$objResponse->addAssign("srv_{$num}", "innerHTML", "<font color='green' size='1'><b><u>Игрок найден и кикнут!!!</u></b></font>");
$objResponse->addScript("set_counter('-1');");
return $objResponse;
}
}
} else {
if ((int) $type == 1) {
// search for the ip on the server
$id = 0;
foreach ($matches[8] as $match) {
$ip = explode(":", $match);
$ip = $ip[0];
if ($ip == $check) {
$userid = $matches[1][$id];
// gotcha!!! kick him!
$gothim = true;
$GLOBALS['db']->Execute("UPDATE `" . DB_PREFIX . "_bans` SET sid = '" . $sid . "' WHERE ip = '" . $check . "' AND RemovedBy IS NULL;");
$requri = substr($_SERVER['REQUEST_URI'], 0, strrpos($_SERVER['REQUEST_URI'], "pages/admin.kickit.php"));
$kick = $r->sendCommand("kickid " . $userid . " \"Вы были забанены, посетите http://" . $_SERVER['HTTP_HOST'] . $requri . " для большей информации.\"");
$objResponse->addAssign("srv_{$num}", "innerHTML", "<font color='green' size='1'><b><u>Игрок найден и кикнут!!!</u></b></font>");
$objResponse->addScript("set_counter('-1');");
return $objResponse;
}
$id++;
}
}
}
if (!$gothim) {
$objResponse->addAssign("srv_{$num}", "innerHTML", "<font size='1'>Игрок не найден.</font>");
$objResponse->addScript('set_counter(1);');
return $objResponse;
}
} else {
$objResponse->addAssign("srv_{$num}", "innerHTML", "<font color='red' size='1'><i>Нет соединения с сервером.</i></font>");
$objResponse->addScript('set_counter(1);');
return $objResponse;
}
}
开发者ID:BGCX261,项目名称:zion-downloads-css-svn-to-git,代码行数:80,代码来源:admin.kickit.php
示例10: Float2BinaryDecimal
function Float2BinaryDecimal($floatvalue)
{
// http://www.scri.fsu.edu/~jac/MAD3401/Backgrnd/binary.html
$maxbits = 128;
// to how many bits of precision should the calculations be taken?
$intpart = trunc($floatvalue);
$floatpart = abs($floatvalue - $intpart);
$pointbitstring = '';
while ($floatpart != 0 && strlen($pointbitstring) < $maxbits) {
$floatpart *= 2;
$pointbitstring .= (string) trunc($floatpart);
$floatpart -= trunc($floatpart);
}
$binarypointnumber = decbin($intpart) . '.' . $pointbitstring;
return $binarypointnumber;
}
开发者ID:katbailey,项目名称:katbaileynet,代码行数:16,代码来源:demo.mp3header.php
示例11: getVOCheaderFilepointer
function getVOCheaderFilepointer(&$fd, &$ThisFileInfo)
{
$OriginalAVdataOffset = $ThisFileInfo['avdataoffset'];
fseek($fd, $ThisFileInfo['avdataoffset'], SEEK_SET);
$VOCheader = fread($fd, 26);
if (substr($VOCheader, 0, 19) != 'Creative Voice File') {
$ThisFileInfo['error'] .= "\n" . 'Expecting "Creative Voice File" at offset ' . $ThisFileInfo['avdataoffset'] . ', found "' . substr($VOCheader, 0, 19) . '"';
return false;
}
$ThisFileInfo['fileformat'] = 'voc';
$ThisFileInfo['audio']['dataformat'] = 'voc';
$ThisFileInfo['audio']['bitrate_mode'] = 'cbr';
$ThisFileInfo['audio']['channels'] = 1;
// might be overriden below
$ThisFileInfo['audio']['bits_per_sample'] = 8;
// might be overriden below
// byte # Description
// ------ ------------------------------------------
// 00-12 'Creative Voice File'
// 13 1A (eof to abort printing of file)
// 14-15 Offset of first datablock in .voc file (std 1A 00 in Intel Notation)
// 16-17 Version number (minor,major) (VOC-HDR puts 0A 01)
// 18-19 2's Comp of Ver. # + 1234h (VOC-HDR puts 29 11)
$ThisFileInfo['voc']['header']['datablock_offset'] = LittleEndian2Int(substr($VOCheader, 20, 2));
$ThisFileInfo['voc']['header']['minor_version'] = LittleEndian2Int(substr($VOCheader, 22, 1));
$ThisFileInfo['voc']['header']['major_version'] = LittleEndian2Int(substr($VOCheader, 23, 1));
do {
$BlockOffset = ftell($fd);
$BlockData = fread($fd, 4);
$BlockType = LittleEndian2Int(substr($BlockData, 0, 1));
$BlockSize = LittleEndian2Int(substr($BlockData, 1, 3));
$ThisBlock = array();
switch ($BlockType) {
case 0:
// Terminator
// do nothing, we'll break out of the loop down below
break;
case 1:
// Sound data
$BlockData .= fread($fd, 2);
if ($ThisFileInfo['avdataoffset'] <= $OriginalAVdataOffset) {
$ThisFileInfo['avdataoffset'] = ftell($fd);
}
fseek($fd, $BlockSize - 2, SEEK_CUR);
$ThisBlock['sample_rate_id'] = LittleEndian2Int(substr($BlockData, 4, 1));
$ThisBlock['compression_type'] = LittleEndian2Int(substr($BlockData, 5, 1));
$ThisBlock['compression_name'] = VOCcompressionTypeLookup($ThisBlock['compression_type']);
if ($ThisBlock['compression_type'] <= 3) {
$ThisFileInfo['voc']['compressed_bits_per_sample'] = CastAsInt(str_replace('-bit', '', $ThisBlock['compression_name']));
}
if (empty($ThisFileInfo['audio']['sample_rate'])) {
// Less accurate than the Extended block (#8) data
// SR byte = 256-(1000000/sample_rate)
$ThisFileInfo['audio']['sample_rate'] = trunc(1000000 / (256 - $ThisBlock['sample_rate_id']) / $ThisFileInfo['audio']['channels']);
}
break;
case 2:
// Sound continue
// Sound continue
case 3:
// Silence
// Silence
case 4:
// Marker
// Marker
case 6:
// Repeat
// Repeat
case 7:
// End repeat
// nothing useful, just skip
fseek($fd, $BlockSize, SEEK_CUR);
break;
case 8:
// Extended
$BlockData .= fread($fd, 4);
//00-01 Time Constant:
// Mono: 65536 - (256000000 / sample_rate)
// Stereo: 65536 - (256000000 / (sample_rate * 2))
$ThisBlock['time_constant'] = LittleEndian2Int(substr($BlockData, 4, 2));
$ThisBlock['pack_method'] = LittleEndian2Int(substr($BlockData, 6, 1));
$ThisBlock['stereo'] = (bool) LittleEndian2Int(substr($BlockData, 7, 1));
$ThisFileInfo['audio']['channels'] = $ThisBlock['stereo'] ? 2 : 1;
$ThisFileInfo['audio']['sample_rate'] = trunc(256000000 / (65536 - $ThisBlock['time_constant']) / $ThisFileInfo['audio']['channels']);
break;
case 9:
// data block that supersedes blocks 1 and 8. Used for stereo, 16 bit
$BlockData .= fread($fd, 12);
if ($ThisFileInfo['avdataoffset'] <= $OriginalAVdataOffset) {
$ThisFileInfo['avdataoffset'] = ftell($fd);
}
fseek($fd, $BlockSize - 12, SEEK_CUR);
$ThisBlock['sample_rate'] = LittleEndian2Int(substr($BlockData, 4, 4));
$ThisBlock['bits_per_sample'] = LittleEndian2Int(substr($BlockData, 8, 1));
$ThisBlock['channels'] = LittleEndian2Int(substr($BlockData, 9, 1));
$ThisBlock['wFormat'] = LittleEndian2Int(substr($BlockData, 10, 2));
$ThisBlock['compression_name'] = VOCwFormatLookup($ThisBlock['wFormat']);
if (VOCwFormatActualBitsPerSampleLookup($ThisBlock['wFormat'])) {
$ThisFileInfo['voc']['compressed_bits_per_sample'] = VOCwFormatActualBitsPerSampleLookup($ThisBlock['wFormat']);
}
//.........这里部分代码省略.........
开发者ID:BackupTheBerlios,项目名称:sotf,代码行数:101,代码来源:getid3.voc.php
示例12: while
while (!$res->EOF) {
$info = array();
$info['name'] = stripslashes($res->fields[3]);
$info['created'] = SBDate($dateformat, $res->fields['created']);
$ltemp = explode(",", $res->fields[6] == 0 ? 'Навсегда' : SecondsToString(intval($res->fields[6])));
$info['length'] = $ltemp[0];
$info['icon'] = empty($res->fields[13]) ? 'web.png' : $res->fields[13];
$info['authid'] = $res->fields[2];
$info['ip'] = $res->fields[1];
if ($res->fields[15] == 1) {
$info['search_link'] = "index.php?p=banlist&advSearch=" . $info['ip'] . "&advType=ip&Submit";
} else {
$info['search_link'] = "index.php?p=banlist&advSearch=" . $info['authid'] . "&advType=steamid&Submit";
}
$info['link_url'] = "window.location = '" . $info['search_link'] . "';";
$info['short_name'] = trunc($info['name'], 25, false);
if ($res->fields[14] == 'D' || $res->fields[14] == 'U' || $res->fields[14] == 'E' || $res->fields[6] && $res->fields[5] < time()) {
$info['unbanned'] = true;
if ($res->fields[14] == 'D') {
$info['ub_reason'] = 'У';
} elseif ($res->fields[14] == 'U') {
$info['ub_reason'] = 'Р';
} else {
$info['ub_reason'] = 'И';
}
} else {
$info['unbanned'] = false;
}
array_push($bans, $info);
$res->MoveNext();
}
开发者ID:BGCX261,项目名称:zion-downloads-css-svn-to-git,代码行数:31,代码来源:page.home.php
示例13: get_outcome
/** public function get_outcome
* Returns the current outcome of the previous move
*
* @param void
* @return bool game winner
*/
public function get_outcome()
{
call(__METHOD__);
call($this->get_board_ascii());
$return = array();
// search the board for matching attributes
// search vertical
for ($x = 0; $x < 4; ++$x) {
for ($y = 0; $y < 4; ++$y) {
$index = $x + $y * 4;
$piece = $this->board[$index];
if ('.' == $piece) {
$and = $not = false;
break;
}
if (0 == $y) {
$and = hexdec($piece);
$not = trunc(~hexdec($piece), 4);
} else {
$and = $and & hexdec($piece);
$not = trunc($not & ~hexdec($piece), 4);
}
// no need to keep searching if the ones we have don't match
if (!$and && !$not) {
break;
}
}
if ($and || $not) {
$cols = array('A', 'B', 'C', 'D');
$return[$cols[$x]] = $and | $not;
}
}
// search horizontal
for ($y = 0; $y < 4; ++$y) {
for ($x = 0; $x < 4; ++$x) {
$index = $x + $y * 4;
$piece = $this->board[$index];
if ('.' == $piece) {
$and = $not = false;
break;
}
if (0 == $x) {
$and = hexdec($piece);
$not = trunc(~hexdec($piece), 4);
} else {
$and = $and & hexdec($piece);
$not = trunc($not & ~hexdec($piece), 4);
}
// no need to keep searching if the ones we have don't match
if (!$and && !$not) {
break;
}
}
if ($and || $not) {
$return[$y + 1] = $and | $not;
}
}
// search diagonal
for ($i = 0; $i < 2; ++$i) {
for ($j = 0; $j < 4; ++$j) {
for ($k = 0; $k < 4; ++$k) {
if (!$this->diagonal_torus && 0 < $j) {
$and = $not = false;
continue;
}
$x = $k + $j;
$y = $k;
while (4 <= $x) {
$x -= 4;
}
if ($i) {
$x = 3 - $x;
}
$index = $x + $y * 4;
$piece = $this->board[$index];
if ('.' == $piece) {
$and = $not = false;
break;
}
if (0 == $k) {
$and = hexdec($piece);
$not = trunc(~hexdec($piece), 4);
} else {
$and = $and & hexdec($piece);
$not = trunc($not & ~hexdec($piece), 4);
}
// no need to keep searching if the ones we have don't match
if (!$and && !$not) {
break;
}
}
if ($and || $not) {
$diags = array('\\', '/');
$l = $j;
//.........这里部分代码省略.........
开发者ID:benjamw,项目名称:quarto,代码行数:101,代码来源:quarto.class.php
示例14: widget
function widget($args, $instance)
{
$cache = wp_cache_get('etheme_widget_recent_entries', 'widget');
if (!is_array($cache)) {
$cache = array();
}
if (isset($cache[$args['widget_id']])) {
echo $cache[$args['widget_id']];
return;
}
ob_start();
extract($args);
$title = apply_filters('widget_title', empty($instance['title']) ? false : $instance['title']);
if (!($number = (int) $instance['number'])) {
$number = 10;
} else {
if ($number < 1) {
$number = 1;
} else {
if ($number > 15) {
$number = 15;
}
}
}
$r = new WP_Query(array('showposts' => $number, 'nopaging' => 0, 'post_status' => 'publish', 'ignore_sticky_posts' => 1));
if ($r->have_posts()) {
?>
<?php
echo $before_widget;
?>
<?php
if ($title) {
echo $before_title . $title . $after_title;
}
?>
<div>
<?php
while ($r->have_posts()) {
$r->the_post();
?>
<div class="recent-post-mini">
<?php
$thumb = wp_get_attachment_image_src(get_post_thumbnail_id(), array(130, 130));
$url = $thumb[0];
if ($url && $url != '') {
?>
<a class="postimg" href="<?php
the_permalink();
?>
" title="<?php
echo esc_attr(get_the_title() ? get_the_title() : get_the_ID());
?>
"><img src="<?php
echo etheme_get_image(false, 70, 70);
?>
" /></a>
<?php
}
?>
<?php
if (get_the_title()) {
$title = get_the_title();
} else {
$title = get_the_ID();
}
$title = trunc($title, 10);
?>
<a href="<?php
the_permalink();
?>
" <?php
if (!$url || $url == '') {
echo 'style="width:100%;"';
}
?>
title="<?php
echo esc_attr(get_the_title() ? get_the_title() : get_the_ID());
?>
">
<?php
echo $title;
?>
</a><br />
<?php
_e('by', ETHEME_DOMAIN);
?>
<strong><?php
the_author();
?>
</strong><br>
<?php
the_time(get_option('date_format'));
?>
<div class="clear"></div>
</div>
<?php
}
?>
//.........这里部分代码省略.........
开发者ID:MrMuzik,项目名称:ar4tupgrade,代码行数:101,代码来源:widgets.php
示例15: while
<table cellpadding="0" cellspacing="0" class="db-table">
<tr>
<th>Source URL</th>
<th>Magnet URL</th>
<th>Description</th>
<th>More Info</th>
</tr>
<?php
while ($row = mysql_fetch_array($result)) {
echo "</td><td>";
echo '<a href="' . $row['url'] . '">Source</a>';
echo "</td><td>";
echo '<a href="' . $row['magnet'] . '">Download</a>';
echo "</td><td>";
if ($trunc == TRUE) {
echo trunc($row['description'], 15);
} else {
echo nl2br($row['description']);
}
echo "</td><td>";
echo '<a href="index.php?id=' . $row['id'] . '">Info</a>';
echo "</td></tr>";
}
echo "</table>";
if (!($id || $search)) {
?>
You are at page: <?php
echo $page;
?>
of <?php
echo $totpages;
开发者ID:henrytrager,项目名称:TPCrawler,代码行数:31,代码来源:index.php
示例16: widget
function widget($args, $instance)
{
$cache = wp_cache_get('etheme_widget_recent_entries', 'widget');
if (!is_array($cache)) {
$cache = array();
}
if (isset($args['widget_id']) && isset($cache[$args['widget_id']])) {
echo $cache[$args['widget_id']];
return;
}
ob_start();
extract($args);
$box_id = rand(1000, 10000);
$title = apply_filters('widget_title', empty($instance['title']) ? false : $instance['title']);
if (!($number = (int) $instance['number'])) {
$number = 10;
} else {
if ($number < 1) {
$number = 1;
} else {
if ($number > 15) {
$number = 15;
}
}
}
$slider = !empty($instance['slider']) ? (int) $instance['slider'] : false;
$r = new WP_Query(array('posts_per_page' => $number, 'post_type' => 'post', 'post_status' => 'publish', 'ignore_sticky_posts' => 1));
if ($r->have_posts()) {
?>
<?php
echo $before_widget;
?>
<?php
if ($title) {
echo $before_title . $title . $after_title;
}
?>
<?php
if ($slider) {
?>
<div class="owl-carousel blogCarousel slider-<?php
echo $box_id;
?>
">
<?php
}
?>
<ul class="blog-post-list slide-item">
<?php
$i = 0;
while ($r->have_posts()) {
|
请发表评论