public function makeMapSheetAction() { // Set up config options $sourceSize = 16; $destinationSize = 32; $images = array(); $dir = $_SERVER['DOCUMENT_ROOT'] . '/modules/wes/img/sprites/maps/jidoor-tiles'; $writeDir = $_SERVER['DOCUMENT_ROOT'] . '/modules/wes/img/sprites/maps'; if ($handle = opendir($dir)) { while (false !== ($file = readdir($handle))) { if ($file != "." && $file != "..") { $images[] = $dir . '/' . $file; } } closedir($handle); } $numTiles = count($images); $tileSheet = imagecreatetruecolor($numTiles * $destinationSize, $destinationSize); for ($i = 0; $i < $numTiles; $i++) { $tile = imagecreatefrompng($images[$i]); $x = $i * $destinationSize; $y = 0; imagecopyresized($tileSheet, $tile, $x, $y, 0, 0, $destinationSize, $destinationSize, $sourceSize, $sourceSize); imagedestroy($tile); } imagepng($tileSheet, $writeDir . '/sheet.png'); imagedestroy($tileSheet); show_array($images); die(); }
function html_show_array($array) { $output = ''; $output .= '<table cellspacing="0" border="2">'; $output .= show_array($array, 1, 0); $output .= '</table>'; return $output; }
function show_array($array) { foreach ($array as $value) { if (is_array($value)) { show_array($value); } else { // note that htmlentities has been added here so that items in angle brackets will be shown on the webpage echo htmlentities($value) . "<br><br>"; } } }
function show_array($array) { $output = ""; for (reset($array); $key = key($array), $pos = pos($array); next($array)) { if (is_array($pos)) { $output .= "{$key} : <ul>"; $output .= show_array($pos); $output .= "</ul>"; } else { $output .= "{$key} = {$pos} <br/>"; } } return $output; }
function show_array_array($array) { echo "<BR><table>"; for ($j = 0; $j < count($array); $j++) { $row = each($array); print "<tr><td>" . $row["key"] . "</td><td>" . show_array($row["value"]) . "</td></tr>"; } echo "</table>"; }
function html_show_array($array) { $echo = "<table class='beatmapListing'>\n"; $echo .= show_array($array, 1, 0); $echo .= "</table>\n"; return $echo; }
function show_array($list) { foreach ($list as $ID => $value) { echo " <tr>\n"; echo " <td>" . $ID . "</td>\n"; if (is_array($value)) { echo " <td> array:</td>"; echo " </tr>\n"; echo " <tr><td></td><td><table>\n"; show_array($value); echo " </table></td></tr>\n"; } else { echo " <td>" . $value . "</td>"; echo " </tr>\n"; } } }
function html_show_array($array) { echo "<table cellspacing=\"0\" border=\"2\">\n"; show_array($array, 1, 0); echo "</table>\n"; }
function show_array($list) { foreach ($list as $ID => $value) { echo " <tr>\n"; echo " <td>" . $ID . "</td>\n"; if (is_array($value)) { echo " <td> array:</td>"; echo " </tr>\n"; echo " <tr><td></td><td><table>\n"; show_array($value); echo " </table></td></tr>\n"; } else { if ($ID == "DBADMIN" || $ID == "DBEDITOR" || $ID == "DBREADER") { $value = "*"; } echo " <td>" . $value . "</td>"; echo " </tr>\n"; } } }
</head> <body> <center> <br/> <h1>42 Ifield Road: Room Auction</h1> <br/> <?php include "show_array.php"; include "validate_bid.php"; include "process_bid.php"; $filename = "bids.txt"; $bids = unserialize(file_get_contents($filename)); show_array($bids); echo "<br/>"; echo "<br/>"; $errors = array(); if (!empty($_POST['Submit'])) { $errors = validate_bid($_POST['name'], $_POST['room'], $_POST['bid']); if (count($errors) == 0) { process_bid($_POST['name'], $_POST['room'], $_POST['bid']); #Confirmation page } else { $error_str = "<p>Please check the following and try again:</p>"; } echo $error_str; } ?>
function show_array($array) { foreach ($array as $value) { if (is_array($value)) { show_array($value); } else { echo $value . "<br>"; } } }
function show_array($a, $indent = '') { $out = 'array( ' . PHP_EOL; $end_char = strlen($indent) == 0 ? ';' : ','; foreach ($a as $k => $v) { $out .= $indent; if (is_string($k)) { $out .= '"' . $k . '"'; } else { $out .= $k; } $out .= ' => '; if (is_string($v)) { $out .= '"' . $v . '"'; } else { if (is_array($v)) { $out .= show_array($a, $indent . ' '); } } $out .= ',' . PHP_EOL; } $out .= $indent . ')' . $end_char . PHP_EOL; return $out; }
function show_array($array, $level, $sub) { if (is_array($array) == 1) { // check if input is an array foreach ($array as $key_val => $value) { $offset = ""; if (is_array($value) == 1) { // array is multidimensional echo "<tr>"; $offset = do_offset($level); echo $offset . "<td>" . $key_val . "</td>"; show_array($value, $level + 1, 1); } else { // (sub)array is not multidim if ($sub != 1) { // first entry for subarray echo "<tr nosub>"; $offset = do_offset($level); } $sub = 0; echo $offset . "<td main " . $sub . " width=\"120\">" . $key_val . "</td><td width=\"120\">" . pairToString($value, "", "%8.7f") . "</td>"; echo "</tr>\n"; } } //foreach $array } else { // argument $array is not an array return; } }