本文整理汇总了PHP中print_line函数的典型用法代码示例。如果您正苦于以下问题:PHP print_line函数的具体用法?PHP print_line怎么用?PHP print_line使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了print_line函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: message_show_all
function message_show_all($user_id, $msgbox)
{
assert(is_numeric($user_id));
assert(is_string($msgbox));
// Display all messages
$found_messages = 0;
$result = sql_query("SELECT * FROM m_messages WHERE deleted=0 AND type='" . $msgbox . "' AND user_id=" . $user_id . " ORDER BY DATETIME DESC");
while ($message = sql_fetchrow($result)) {
message_view($msgbox, $message);
$found_messages = 1;
}
// If there were no messages, display something else..
if ($found_messages == 0) {
print_line("<center>Your messagebox is empty...</center><br>");
}
}
示例2: dump
function dump($data, $depth = 0)
{
if (is_array($data)) {
print_line('[', $depth);
foreach ($data as $key => $value) {
if (!is_int($key)) {
print_line("{$key} =>", $depth + 1);
}
dump($value, $depth + 2);
}
print_line(']', $depth);
return;
}
if (is_object($data)) {
if (method_exists($data, '__toString')) {
$class = get_class($data);
print_line("[{$class}] {$data}", $depth);
return;
}
$class = get_class($data);
print_line("[{$class}] {", $depth);
if ($data instanceof \IteratorAggregate) {
$iterator = $data->getIterator();
} elseif ($data instanceof \Iterator) {
$iterator = $data;
} else {
$iterator = new \ArrayIterator((array) $data);
}
for ($iterator->rewind(); $iterator->valid(); $iterator->next()) {
if (!is_int($iterator->key())) {
dump($iterator->key(), $depth + 1);
}
dump($iterator->current(), $depth + 2);
}
print_line('}', $depth);
return;
}
if (is_string($data)) {
print_line('"' . $data . '"', $depth);
return;
}
print_line($data, $depth);
}
示例3: trade_show_routes
function trade_show_routes($user_id)
{
assert(is_numeric($user_id));
global $_GALAXY;
$firstrow = 1;
$result = sql_query("SELECT * FROM a_trades");
while ($traderoute = sql_fetchrow($result)) {
$src_planet = anomaly_get_anomaly($traderoute['src_planet_id']);
$dst_planet = anomaly_get_anomaly($traderoute['dst_planet_id']);
// We don't own the source or destination planet... skip it..
if ($src_planet['user_id'] != $user_id and $dst_planet['user_id'] != $user_id) {
continue;
}
$vessel = vessel_get_vessel($traderoute['vessel_id']);
$ore1 = "";
$ore2 = "";
if ($traderoute['src_ore'] == ORE_NONE) {
$ore1 = "None, ";
} elseif ($traderoute['src_ore'] == ORE_ALL) {
$ore1 = "All ores, ";
} else {
$ores = csl($traderoute['src_ore']);
foreach ($ores as $ore) {
$ore1 .= ore_get_ore_name($ore) . ", ";
}
}
// Chop off last comma
$ore1 = substr_replace($ore1, "", -2);
if ($traderoute['dst_ore'] == ORE_NONE) {
$ore2 = "None, ";
} elseif ($traderoute['dst_ore'] == ORE_ALL) {
$ore2 = "All ores, ";
} else {
$ores = csl($traderoute['dst_ore']);
foreach ($ores as $ore) {
$ore2 .= ore_get_ore_name($ore) . ", ";
}
}
// Chop off last comma
$ore2 = substr_replace($ore2, "", -2);
if ($firstrow == 1) {
$firstrow = 0;
print_remark("Vessel table");
echo "<table align=center width=80% border=0>\n";
echo " <tr class=wb>";
echo "<th>Vessel</th>";
echo "<th>Source</th>";
echo "<th>Ores</th>";
echo "<th>Destination</th>";
echo "<th>Ores</th>";
echo "</tr>\n";
}
echo " <tr class=bl>\n";
echo " <td> <img src=" . $_CONFIG['URL'] . $_GALAXY['image_dir'] . "/ships/trade.jpg> <a href=vessel.php?cmd=" . encrypt_get_vars("showvid") . "&vid=" . encrypt_get_vars($vessel['id']) . ">" . $vessel['name'] . "</a> </td>\n";
echo " <td> <a href=anomaly.php?cmd=" . encrypt_get_vars("show") . "&aid=" . encrypt_get_vars($src_planet['id']) . ">" . $src_planet['name'] . "</a> </td>\n";
echo " <td> " . $ore1 . " </td>\n";
echo " <td> <a href=anomaly.php?cmd=" . encrypt_get_vars("show") . "&aid=" . encrypt_get_vars($dst_planet['id']) . ">" . $dst_planet['name'] . "</a> </td>\n";
echo " <td> " . $ore2 . " </td>\n";
echo " </tr>\n";
}
if ($firstrow == 0) {
echo "</table>\n";
echo "<br><br>\n";
} else {
print_line("There are currently no traderoutes available.");
}
}
示例4: comm_send_to_server
$data['name'] = 0;
$data['uid'] = 0;
comm_send_to_server("PRESET", $data, $ok, $errors);
}
if ($cmd == "create") {
$distance = substr($ne_distance, 0, 5);
$angle = substr($ne_angle, 0, 6);
if (!preg_match("/^\\d+\$/", $distance)) {
print_line("<li><font color=red>You should enter a distance in the format ######.</font>\n");
} elseif (!preg_match("/^\\d{1,6}\$/", $angle)) {
print_line("<li><font color=red>You should enter an angle in the format ######.</font>\n");
} else {
if ($distance < $_GALAXY['galaxy_core']) {
print_line("<li><font color=red>You cannot fly that far into the galaxy core. Try a higher distance (minimum is " . $_GALAXY['galaxy_core'] . ").</font>\n");
} elseif ($distance > $_GALAXY['galaxy_size']) {
print_line("<li><font color=red>You cannot fly outside of the galaxy. Try a lower distance (maximum is " . $_GALAXY['galaxy_size'] . ").</font>\n");
} else {
$ok = "";
$errors['PARAMS'] = "Incorrect parameters specified..\n";
$errors['NAME'] = "The preset name you already used.\n";
$data['action'] = "create";
$data['distance'] = $distance;
$data['angle'] = $angle;
$data['name'] = $ne_name;
$data['uid'] = $uid;
$data['pid'] = 0;
comm_send_to_server("PRESET", $data, $ok, $errors);
}
}
}
// Show command, always executed.
示例5: dirname
* @author Gassan Idriss <gidriss@mivamerchant.com>
*/
require_once dirname(__FILE__) . '/functions.php';
if (!isset($argv[1]) || !isset($argv[2])) {
print_line(PHP_EOL . 'Usage:');
print_line("\t" . 'php ' . $_SERVER['SCRIPT_NAME'] . ' /path/to/fragment.xml ClassName [/out/dir]');
print_line("\t" . 'php ' . $_SERVER['SCRIPT_NAME'] . ' "<XML></XML>" ClassName [/out/dir]', true);
}
$sourceXml = $argv[1];
$targetClass = $argv[2];
$targetDir = isset($argv[3]) && is_dir($argv[3]) ? $argv[3] : dirname(__FILE__);
if (!is_dir($targetDir)) {
print_line(spritnf('Dir %s Not Found', $targetDir), true);
}
if (file_exists($sourceXml)) {
$xml = new \SimpleXMLElement(file_get_contents($sourceXml));
} else {
$xml = new \SimpleXMLElement($sourceXml);
}
$setters = '';
$assertions = '';
foreach ($xml->children() as $child) {
print_line($child->getName());
$name = $child->getName();
$camelName = $name;
$camelName[0] = strtolower($camelName[0]);
$setters .= generate_setter($name, $camelName);
$assertions .= generate_assertion($name, $camelName);
}
$template = replace_template(dirname(__FILE__) . '/generate_class_from_xml_fragment_class_template.php.template', array('{name}' => $targetClass, '{setters}' => $setters, '{assertions}' => $assertions, '{expected_xml}' => $xml->saveXML(), '{xml_assertions}' => null));
file_put_contents($targetDir . '/' . $targetClass . 'Test.php', $template);
示例6: array_push
if (!$chunk) {
continue;
}
$tree = $tree . '/' . $chunk;
array_push($paths, $tree);
}
$paths = array_reverse($paths);
foreach ($paths as $path) {
if (is_file($path . '/wp-config.php')) {
define('ABSPATH', $path . '/');
break;
}
}
}
if (!defined('ABSPATH')) {
print_line("Unable to determine wordpress path. Please set it using WORDPRESS_PATH.");
die;
}
$_SERVER = array("HTTP_HOST" => "disqus.com", "SCRIPT_NAME" => "", "PHP_SELF" => __FILE__, "SERVER_NAME" => "localhost", "REQUEST_URI" => "/", "REQUEST_METHOD" => "GET");
require_once ABSPATH . 'wp-config.php';
// swap out the object cache due to memory constraints
global $wp_object_cache;
class DummyWP_Object_Cache extends WP_Object_Cache
{
function set($id, $data, $group = 'default', $expire = '')
{
return;
}
function delete($id, $group = 'default', $force = false)
{
return;
示例7: print_item
function print_item($url, $short_name, $long_name, $logo, $level, $type)
{
$href_start = "";
$href_end = "";
$img = " ";
$skip_space = 3;
global $member, $contrib, $partner;
global $organization, $individual;
global $num_members, $num_contribs, $num_partners;
global $num_organizations, $num_individuals;
if (!empty($url)) {
$href_start = "<a href=\"{$url}\">";
$href_end = "</a>";
}
print "<tr>\n";
# Organization
$org = "{$href_start}{$short_name}{$href_end}";
if (!empty($long_name)) {
$org .= "<br>{$long_name}";
}
print "<td>{$org}</td>\n";
print "<td width={$skip_space}> </td>\n";
# Type
print "<td align=\"center\">";
if ($type == $organization) {
print "Organization";
++$num_organizations;
} else {
if ($type == $individual) {
print "Individual";
++$num_individuals;
}
}
print "</td>\n";
# Status
print "<td align=\"center\">";
if ($level == $member) {
print "Member";
++$num_members;
} else {
if ($level == $contrib) {
print "Contributor";
++$num_contribs;
} else {
if ($level == $partner) {
print "Partner";
++$num_partners;
}
}
}
print "</td>\n<td width={$skip_space}> </td>\n";
# Logo
if (!empty($logo)) {
$size = GetImageSize($logo);
print "<td align=center>{$href_start}<img src=\"{$logo}\" {$size['3']} border=\"0\">{$href_end}</td>\n";
} else {
print "<td> </td>\n";
}
print "</tr>\n\n";
print_line();
}
示例8: print_orders
function print_orders($sourceid)
{
/*
name:
print_orders($sourceid)
returns:
0 - no error
1 - no orders to be printed
2 - template parsing error
3 - error setting orders printed
other - mysql error number
*/
$sourceid = $_SESSION['sourceid'];
debug_msg(__FILE__, __LINE__, "BEGIN PRINTING");
$query = "SELECT * FROM `orders` WHERE `sourceid`='{$sourceid}' AND `printed` IS NULL AND `suspend`='0' ORDER BY dest_id ASC, priority ASC, associated_id ASC, id ASC";
$res = common_query($query, __FILE__, __LINE__);
if (!$res) {
return mysql_errno();
}
if (!mysql_num_rows($res)) {
return ERR_ORDER_NOT_FOUND;
}
$newassociated_id = "";
$tablenum = get_db_data(__FILE__, __LINE__, $_SESSION['common_db'], 'sources', "name", $sourceid);
$tpl_print = new template();
$output['orders'] = '';
$msg = "";
while ($arr = mysql_fetch_array($res)) {
$oldassociated_id = $newassociated_id;
$newassociated_id = $arr['associated_id'];
if (isset($priority)) {
$oldpriority = $priority;
} else {
$oldpriority = 0;
}
$priority = $arr['priority'];
if ($oldassociated_id != "") {
$olddestid = get_db_data(__FILE__, __LINE__, $_SESSION['common_db'], 'dishes', "destid", get_db_data(__FILE__, __LINE__, $_SESSION['common_db'], 'orders', 'dishid', $oldassociated_id));
$olddest = get_db_data(__FILE__, __LINE__, $_SESSION['common_db'], 'dests', "dest", $olddestid);
$olddestname = get_db_data(__FILE__, __LINE__, $_SESSION['common_db'], 'dests', "name", $olddestid);
} else {
$olddestid = 0;
}
$destid = get_db_data(__FILE__, __LINE__, $_SESSION['common_db'], 'dishes', "destid", get_db_data(__FILE__, __LINE__, $_SESSION['common_db'], 'orders', 'dishid', $newassociated_id));
$dest = get_db_data(__FILE__, __LINE__, $_SESSION['common_db'], 'dests', "dest", $destid);
$destname = get_db_data(__FILE__, __LINE__, $_SESSION['common_db'], 'dests', "name", $destid);
$dest_language = get_db_data(__FILE__, __LINE__, $_SESSION['common_db'], 'dests', "language", $destid);
if ($destid != $olddestid || $priority != $oldpriority) {
if ($destid != $olddestid && $olddestid != "") {
$tpl_print->assign("date", printer_print_date());
$tpl_print->assign("gonow", printer_print_gonow($oldpriority, $dest_language));
$tpl_print->assign("page_cut", printer_print_cut());
// strips the last newline that has been put
$output['orders'] = substr($output['orders'], 0, strlen($output['orders']) - 1);
if (table_is_takeaway($sourceid)) {
$print_tpl_file = 'ticket_takeaway';
} else {
$print_tpl_file = 'ticket';
}
if ($err = $tpl_print->set_print_template_file($olddestid, $print_tpl_file)) {
return $err;
}
if ($err = $tpl_print->parse()) {
$msg = "Error in " . __FUNCTION__ . " - ";
$msg .= 'error: ' . $err . "\n";
echo nl2br($msg) . "\n";
error_msg(__FILE__, __LINE__, $msg);
return ERR_PARSING_TEMPLATE;
}
$tpl_print->restore_curly();
$msg = $tpl_print->getOutput();
$tpl_print->reset_vars();
$output['orders'] = '';
$msg = str_replace("'", "", $msg);
if ($outerr = print_line($olddestid, $msg)) {
return $outerr;
}
} elseif ($priority != $oldpriority && $oldpriority != "") {
$tpl_print->assign("date", printer_print_date());
$tpl_print->assign("gonow", printer_print_gonow($oldpriority, $dest_language));
$tpl_print->assign("page_cut", printer_print_cut());
// strips the last newline that has been put
$output['orders'] = substr($output['orders'], 0, strlen($output['orders']) - 1);
if (table_is_takeaway($sourceid)) {
$print_tpl_file = 'ticket_takeaway';
} else {
$print_tpl_file = 'ticket';
}
if ($err = $tpl_print->set_print_template_file($destid, $print_tpl_file)) {
return $err;
}
if ($err = $tpl_print->parse()) {
$msg = "Error in " . __FUNCTION__ . " - ";
$msg .= 'error: ' . $err . "\n";
error_msg(__FILE__, __LINE__, $msg);
echo nl2br($msg) . "\n";
return ERR_PARSING_TEMPLATE;
}
$tpl_print->restore_curly();
$msg = $tpl_print->getOutput();
//.........这里部分代码省略.........
示例9: hash
/**
print out the key value pairs from the supplied has as HTML
@param hash $hash a hash (sic)
@return NULL
*/
function print_hash($hash)
{
foreach ($hash as $key => $value) {
echo $key . ": " . $value . '<br>';
}
}
/**
print out line of text with a label, to be used between PRE tags
@param string $label a descriptive label or title
@param string $line the text to display
@return NULL
*/
function print_line($label, $line)
{
echo $label . ": " . $line . "\n";
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>BaseElements Plug-In HTTP Test Helper</title>
</head>
<body>
<?php
示例10: session_identification
<?php
// Include Files
include "../includes.inc.php";
// Session Identification
session_identification("admin");
print_header();
print_title("Tick Scheme");
$ticks = calc_sector_ticks($_GALAXY['galaxy_size'], 0, $_GALAXY['galaxy_size'], 180, 99);
print_line("Crossing ticks at warp 9.9: {$ticks}");
$ticks = calc_sector_ticks($_GALAXY['galaxy_size'], 0, $_GALAXY['galaxy_size'], 180, 50);
print_line("Crossing ticks at warp 5.0: {$ticks}");
$ticks = calc_sector_ticks($_GALAXY['galaxy_size'], 0, $_GALAXY['galaxy_size'], 180, 10);
print_line("Crossing ticks at warp 1.0: {$ticks}");
warp_scheme(99);
warp_scheme(50);
warp_scheme(10);
print_footer();
exit;
function warp_scheme($warp)
{
$result = sql_query("SELECT COUNT(*) AS nr FROM s_sectors");
$tmp = sql_fetchrow($result);
$count = $tmp['nr'];
if ($count > 30) {
$count = 30;
echo "WARNING: Only the first 30 sectors are viewed now!!!<br>\n";
}
$result = sql_query("SELECT * FROM s_sectors");
print "<table align=center border=1>";
print " <tr><th colspan=" . ($count + 1) . ">Warp Factor " . $warp . "</th></tr>";
示例11: session_identification
<?php
// Include Files
include "includes.inc.php";
// Session Identification
session_identification();
print_header();
print_title("Vessel upgrade");
// can we build ships already?
$user = user_get_user($_USER['id']);
if ($user['impulse'] == 0) {
print_line("You cannot build ships yet");
print_footer();
exit;
}
// Get a ship if we didn't select one
if (!isset($_GET['vid'])) {
choose_vessel($_USER['id']);
print_footer();
exit;
}
$vid = decrypt_get_vars($_GET['vid']);
// Go to the first stage if no stage is selected
if (isset($_GET['stage'])) {
$stage = decrypt_get_vars($_GET['stage']);
} else {
$stage = 1;
}
// Do upgrade (depending on stage)
if ($stage == 1) {
upgrade_speed($_USER, $vid);
示例12: show_constructions
function show_constructions($anomaly_id)
{
assert(is_numeric($anomaly_id));
// Get global information stuff
$planet = anomaly_get_anomaly($anomaly_id);
$user = user_get_user($planet['user_id']);
// And get the ores from the planet
$result = sql_query("SELECT * FROM g_ores WHERE planet_id=" . $anomaly_id);
$ores = sql_fetchrow($result);
// Get all buildings that are currently build on the planet
$surface = planet_get_surface($anomaly_id);
$current_buildings = csl($surface['csl_building_id']);
// If we've got an headquarter and it's inactive, we cannot build anything.. :(
if (in_array(BUILDING_HEADQUARTER_INACTIVE, $current_buildings)) {
print_line("Your headquarter is currently inactive due to insufficent resources for its upkeep. You cannot build anything on this planet until you replenish your resources.");
$cannot_build = true;
return;
}
print_subtitle("Construction on planet " . $planet['name']);
// And get all buildings, compare wether or not we may build them...
$result = sql_query("SELECT * FROM s_buildings ORDER BY id");
while ($building = sql_fetchrow($result)) {
// Default, we can build this
$cannot_build = false;
// Stage -1: Check planet class when we want to build a headquarter
if ($building['id'] == BUILDING_HEADQUARTER) {
if (!planet_is_habitable($anomaly_id)) {
$cannot_build = true;
}
}
// Stage 0: Check building_level
if ($building['build_level'] > $user['building_level']) {
$cannot_build = true;
}
// Stage 1: Building Count Check
// Build counter check
if ($building['max'] > 0) {
$times_already_build = 0;
for ($i = 0; $i != count($current_buildings); $i++) {
if (building_active_or_inactive($current_buildings[$i]) == $building['id']) {
$times_already_build++;
}
}
// Cannot build cause we already have MAX buildings of this kind.. :(
// building['max'] = 0 means unlimited buildings...
if ($times_already_build == $building['max']) {
$cannot_build = true;
}
}
// Stage 2: Dependency Check
// Get all dependencies
$buildings_needed = csl($building['csl_depends']);
// Do we need them? If not, skip dependency-check.
if (!empty($building['csl_depends'])) {
$deps_found = count($buildings_needed);
// Count to zero...
while (list($key, $building_dep_id) = each($buildings_needed)) {
if ($building_dep_id == "") {
$deps_found--;
continue;
}
// Get all dependencies
if (in_array($building_dep_id, $current_buildings)) {
$deps_found--;
// Found in current_buildings?
// Decrease counter
}
}
} else {
// No need for deps
$deps_found = 0;
// Zero is good...
}
// Not all dependencies found, we cannot build it.. :(
if ($deps_found > 0) {
$cannot_build = true;
}
// Stage 3: Show building if we can build it..
if ($cannot_build == false) {
building_show_details($building['id'], $planet['id'], $user['user_id'], $ores['stock_ores']);
}
}
}
示例13: foreach
if (!file_exists($testsDir . DIRECTORY_SEPARATOR . $testFileName)) {
$missingTests[] = $testFileName;
}
}
foreach ($testsDirFiles as $testsDirFile) {
$filename = @end(explode('/', $testsDirFile));
$fragFileName = str_replace('Test.php', '.php', $filename);
if (!file_exists($srcDir . DIRECTORY_SEPARATOR . $fragFileName)) {
$testsWithoutFragments[] = $fragFileName;
}
}
array_walk($missingTests, function ($v, $k) {
global $createMissingTests, $deleteTestsWithoutFragments, $srcDir, $testsDir;
print_line('Missing Test: ' . $v);
if (true === $createMissingTests) {
print_line('Created Missing Test: ' . $v);
file_put_contents($testsDir . DIRECTORY_SEPARATOR . $v, '');
}
});
array_walk($testsWithoutFragments, function ($v, $k) {
global $createMissingTests, $deleteTestsWithoutFragments, $srcDir, $testsDir;
print_line('Test Missing Fragment: ' . $v);
if (true === $deleteTestsWithoutFragments) {
print_line('Removed Test Without Fragment: ' . $v);
@unlink($testsDir . DIRECTORY_SEPARATOR . $v);
}
});
/*
print_r($testsWithoutFragments);
print_r($missingTests);*/
示例14: passtrough
function passtrough($url)
{
assert(!empty($url));
print_header("<meta http-equiv=\"refresh\" CONTENT=\"1; URL={$url}\">");
print_subtitle("<b>Loading...</b>");
print_line("<a href=\"{$url}\">Click here if you are not being redirected...</a>");
print_footer();
}
示例15: Time
<table BORDER=0 BGCOLOR=white>
<font size=-1>
<tr bgcolor=black>
<th width=80><a class=tooltip href="#"><font color=white><center><b>Callsign</b></center></font><span><b>Callsign of the DD-mode user</b></span></a></th>
<th width=80><a class=tooltip href="#"><font color=white><center><b>IP Address</b></center></font><span><b>Dynamic IP address of the DD-Mode user</b></span></a></th>
<th width=130><a class=tooltip href="#"><font color=white><center><b>Start Time (UTC)</b></center></font><span><b>Start time of DHCP lease</b>(UTC)</span></a></th>
<th width=130><a class=tooltip href="#"><font color=white><center><b>End Time (UTC)</b></center></font><span><b>End time of DHCP Lease</b>Expire time of DHCP lease (UTC)</span></a></th>
<th width=130><a class=tooltip href="#"><font color=white><center><b>MAC</b></center></font><span><b>MAC address of device</b>vendor information</span></a></th>
<th width=80><a class=tooltip href="#"><font color=white><center><b>Lease State</b></center></font><span><b>State of DHCP Lease</b></span></a></th>
</tr>
<?php
$ci = 0;
for ($line = count($dhcptable) - 1; $line >= 0; $line--) {
$ci++;
if ($ci > 1) {
$ci = 0;
}
print "<tr bgcolor=\"{$col[$ci]}\">";
print_line($dhcptable[$line]);
print "</tr>";
}
fclose($open_file);
echo "</table>";
}
} else {
echo "<p class='error'>The DHCP leases file does not exist or does not have sufficient read privileges.</p>";
}
}
}
}