function draw_server($name, $stats, $dumb = false) { $name = preprocess($name); $tag = ""; $text = ""; if ($stats === null) { if ($dumb) { $tag = "class=\"box borderedtinybox\""; } else { $tag = "class=\"box borderedbox\""; } } else { if (!$dumb) { $tag = "class=\"box smallbox\" "; $sent = intval($stats['tx']); $received = intval($stats['rx']); $loss = 100 - $received * 100.0 / $sent; $min = $stats['min']; $avg = $stats['avg']; $max = $stats['max']; $text = "<br />{$loss}%/{$min}/{$avg}/{$max}"; } else { $tag = "class=\"box tinybox\" "; } $tag .= ' style="background-color: ' . gradient(intval($stats['loss'])) . '"'; } echo "\t<div {$tag}>{$name}{$text}</div>\n"; }
//////////////////////////////////////////////////// // // The Magic Includes which make everything happen! // //////////////////////////////////////////////////// include 'includes/includes.php'; // Read in the tag from any POST data avaliable if (!isset($_GET['tag'])) { $tag = ""; } else { $tag = $_GET['tag']; } $result = cachedSQL("SELECT * FROM `" . $unitname . "` WHERE tag LIKE \"" . $tag . "\" order BY time ASC"); // Get the total number of points - used for gradient plotting $num_rows = mysql_num_rows($result); $gradient = gradient($gradstart, $gradend, $num_rows); $count = 0; ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xmlns:v="urn:schemas-microsoft-com:vml" style="height:100%"> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8"/> <link href='style/admin.css' rel='stylesheet' type='text/css'> <title>Live Map || Admin</title> <script src="http://maps.google.com/maps?file=api&v=2&key=ABQIAAAAKgG0R3M9OxpxGiBKm4inbhTJR35ebiLeByqbVSzBszWxVTR5ZxR93MDkF8UAWN222OFV6DTaoe3zHw" type="text/javascript"></script> <script src="javascript/mapiconmaker.js" type="text/javascript"></script> <script type="text/javascript"> //<![CDATA[
<?php $options = get_option('simple_wp'); $rgb_code = get_rgb($options['highlight_color']); $rgb = $rgb_code[0] . ',' . $rgb_code[1] . ',' . $rgb_code[2]; $menu_main = str_replace("#", "", $options['highlight_color']); $grad = gradient($menu_main, 'FFFFFF', 30); ?> <style> ::-moz-selection{ background: <?php echo $options['highlight_color']; ?> !important; color: #fff; text-shadow: none; } ::selection { background: <?php echo $options['highlight_color']; ?> !important; color: #fff; text-shadow: none; } #mast-nav > li > a.active { border-bottom: solid 4px <?php echo $options['highlight_color']; ?>
function create_image($user) { global $quality; global $allsizearray; $files = ""; $iteration = 0; foreach ($allsizearray as $banner => $size) { if ($iteration != 0) { $files .= "##"; } $size = split('x', $size); $iwidth = $size[0]; $iheight = $size[1]; $bannersize = split('x', $banner); $files .= "covers/cpn_" . $bannersize[0] . "x" . $bannersize[1] . "_1&" . md5($user['standardwording'] . $iteration) . ".jpg"; $file = "covers/cpn_" . $bannersize[0] . "x" . $bannersize[1] . "_1&" . md5($user['standardwording'] . $iteration) . ".jpg"; // define the base image that we lay our text on if ($user['bgcolor2'] != "") { error_log("gradient creation"); if ($user['angle'] == "horizontal") { $im = gradient($iwidth, $iheight, array($user['bgcolor'], $user['bgcolor2'], $user['bgcolor'], $user['bgcolor2'])); } else { $im = gradient($iwidth, $iheight, array($user['bgcolor'], $user['bgcolor'], $user['bgcolor2'], $user['bgcolor2'])); } } else { $im = imagecreate($iwidth, $iheight); $rgbbgcolor = hex2rgb($user['bgcolor']); $color['bgcolor'] = imagecolorallocate($im, $rgbbgcolor[0], $rgbbgcolor[1], $rgbbgcolor[2]); } // setup the text colours $rgbcolor = hex2rgb($user['color']); $color['color'] = imagecolorallocate($im, $rgbcolor[0], $rgbcolor[1], $rgbcolor[2]); // this defines the starting height for the text block $y = imagesy($im) - $iheight / 2 + 6; $wordingtext = ""; $wordingtextvertical = ""; if ($user['uppercase'] == true) { $wordingtext = strtoupper($user['standardwording']); $wordingtextvertical = strtoupper($user['verticalwording']); } elseif ($user['lowercase'] == true) { $wordingtext = strtolower($user['standardwording']); $wordingtextvertical = strtolower($user['verticalwording']); } else { $wordingtext = $user['standardwording']; $wordingtextvertical = $user['verticalwording']; } if ($iwidth / 3 > $iheight) { $words = explode(" ", $wordingtext); } else { if ($user['verticalwording'] != "") { $words = explode(" ", $wordingtextvertical); } else { $words = explode(" ", $wordingtext); } } if ($iwidth <= 200 && $iheight <= 200) { $fontsize = $user['font-size-small']; $lineheight = $user['line-height-small']; } elseif ($iwidth > 360 || $iheight >= 200) { $fontsize = $user['font-size-big']; $lineheight = $user['line-height-big']; } else { $fontsize = $user['font-size']; $lineheight = $user['line-height']; } $fontRegular = str_replace("-Bold", "-Regular", $user['font']); $fontRegular = str_replace("-CondBold", "-CondLight", $fontRegular); $fontRegular = str_replace("-Black", "-Regular", $fontRegular); $fontName = str_replace("-Regular", "", $fontRegular); $fontBold = str_replace("-Regular", "-Bold", $fontRegular); $fontItalic = str_replace("-Regular", "-Italic", $fontRegular); $fontBoldItalic = str_replace("-Regular", "-BoldItalic", $fontRegular); $wnum = count($words); $line = ''; $text = ''; $boldActive = false; $italicActive = false; $boldItalicActive = false; $dimensions = 0; for ($i = 0; $i < $wnum; $i++) { if ($words[$i] == "<br>" || $words[$i] == "<BR>") { $text .= $text != '' ? '##' . $words[$i] . ' ' : $words[$i] . ' '; $line = $words[$i] . ' '; continue; } $line .= $words[$i]; if ($words[$i] == "**") { if ($boldActive != true) { $boldActive = true; } else { $boldActive = false; $text .= $text != '' ? '** ##' . ' ' : ' '; $line = ''; continue; } } elseif ($boldActive == true) { if (isset($fontstyleArray[$fontName])) { $styles = explode(", ", $fontstyleArray[$fontName]); foreach ($styles as $style) { if ($style == "Bold") { $dimensions = imagettfbbox($fontsize, 0, $fontBold, $line); } } } } else { $dimensions = imagettfbbox($fontsize, 0, $fontRegular, $line); } if ($words[$i] == "__") { if ($italicActive != true) { $italicActive = true; } else { $italicActive = false; $text .= $text != '' ? '__ ##' . ' ' : ' '; $line = ''; continue; } } elseif ($italicActive == true) { if (isset($fontstyleArray[$fontName])) { $styles = explode(", ", $fontstyleArray[$fontName]); foreach ($styles as $style) { if ($style == "Italic") { $dimensions = imagettfbbox($fontsize, 0, $fontItalic, $line); } } } } else { $dimensions = imagettfbbox($fontsize, 0, $fontRegular, $line); } if ($words[$i] == "//") { if ($boldItalicActive != true) { $boldItalicActive = true; } else { $boldItalicActive = false; $text .= $text != '' ? '// ##' . ' ' : ' '; $line = ''; continue; } } elseif ($boldItalicActive == true) { if (isset($fontstyleArray[$fontName])) { $styles = explode(", ", $fontstyleArray[$fontName]); foreach ($styles as $style) { if ($style == "BoldItalic") { $dimensions = imagettfbbox($fontsize, 0, $boldItalicActive, $line); } } } } else { $dimensions = imagettfbbox($fontsize, 0, $fontRegular, $line); } $lineWidth = $dimensions[2] - $dimensions[0]; if ($lineWidth > $iwidth) { if ($boldActive == true) { $text .= $text != '' ? '** ##' . $words[$i] . ' ' : $words[$i] . ' '; $line = $words[$i] . ' '; } elseif ($italicActive == true) { $text .= $text != '' ? '__ ##' . $words[$i] . ' ' : $words[$i] . ' '; $line = $words[$i] . ' '; } elseif ($boldItalicActive == true) { $text .= $text != '' ? '// ##' . $words[$i] . ' ' : $words[$i] . ' '; $line = $words[$i] . ' '; } else { $text .= $text != '' ? '##' . $words[$i] . ' ' : $words[$i] . ' '; $line = $words[$i] . ' '; } } else { $text .= $words[$i] . ' '; $line .= ' '; } } $text = preg_replace("/(<br> *##)|(<br>##)|(## *<br>)|(##<br>)|(<BR> *##)|(<BR>##)|(## *<BR>)|(##<BR>)/", "##", $text); $pattern = "/(##)|(<\\s*br\\s*\\/?>)/"; $wordings = preg_split($pattern, $text); $wordingIndex = 0; foreach ($wordings as $wording) { $wording = trim($wording); if (preg_match("/[a-zA-Z]/i", $wording)) { $wordingIndex++; } else { break; } } unset($wordings[$wordingIndex]); if (count($wordings) > 1) { $space = -(count($wordings) * $lineheight / 2) + $lineheight / 2; } else { $space = 0; } foreach ($wordings as $wording) { if (strpos($wording, '**') !== false) { $wording = str_replace("** ", "", $wording); $wording = str_replace(" ** ", "", $wording); $wording = str_replace(" **", "", $wording); $wording = str_replace("**", "", $wording); $wording = trim($wording); $x = center_text($wording, $fontsize, $iwidth, $fontBold); imagettftext($im, $fontsize, 0, $x, $y + $space, $color['color'], $fontBold, $wording); } elseif (strpos($wording, '__') !== false) { $wording = str_replace("__ ", "", $wording); $wording = str_replace(" __ ", "", $wording); $wording = str_replace(" __", "", $wording); $wording = str_replace("__", "", $wording); $wording = trim($wording); $x = center_text($wording, $fontsize, $iwidth, $fontItalic); imagettftext($im, $fontsize, 0, $x, $y + $space, $color['color'], $fontItalic, $wording); } elseif (strpos($wording, '//') !== false) { $wording = str_replace("// ", "", $wording); $wording = str_replace(" // ", "", $wording); $wording = str_replace(" //", "", $wording); $wording = str_replace("//", "", $wording); $wording = trim($wording); $x = center_text($wording, $fontsize, $iwidth, $fontBoldItalic); imagettftext($im, $fontsize, 0, $x, $y + $space, $color['color'], $fontBoldItalic, $wording); } else { $wording = trim($wording); $x = center_text($wording, $fontsize, $iwidth, $fontRegular); imagettftext($im, $fontsize, 0, $x, $y + $space, $color['color'], $fontRegular, $wording); } $space = $space + $lineheight; } // create the image imagejpeg($im, $file, $quality); $iteration++; } return $files; }
$theTDARTag = sprintf("<td bgcolor='#%06X' align='right'>", $theVal); $temp = dechex($theVal); while (strlen($temp) < 6) { $temp = '0' . $temp; } $colorindex[$i + $pos] = $temp; $theFC0Tag = "<font color='#000000'>"; $theFC1Tag = "<font color='#ffffff'>"; //printf("<tr>$theTDTag$theFC0Tag%d</font></td>$theTDTag$theFC0Tag%d%%</font></td>$theTDARTag$theFC0Tag%d</font></td>$theTDARTag$theFC0Tag%06X</font></td>", $i, ($i/$theNumSteps) * 100, $theVal, $theVal); //printf("$theTDTag$theFC1Tag%06X</font></td>$theTDTag$theFC1Tag%d</font></td>$theTDARTag$theFC1Tag%d%%</font></td>$theTDARTag$theFC1Tag%d</font></td></tr>\n", $theVal, $theVal, ($i/$theNumSteps) * 100, $i); } //echo "</table>\n"; } $colorindex = array(); gradient($colorindex, 0, 0xffffff, 0xff, 200); gradient($colorindex, 128, 0xffc5c5, 0xff0000, 128); $azimuth1 = array(); //first $energy1 = array(); $wwr1 = array(); //second $ratio1 = array(); //third $shgc1 = array(); //fifth $depth1 = array(); //fourth $u_factor1 = array(); $vlt1 = array(); $count = 0; $file = fopen("../working_directory/parametric/" . $unique_counter . "/finalvalues.txt", "r");
function rgbGradient($low, $high, $totalsteps) { $r1 = $low >> 16; $g1 = ($low & 0xff00) >> 8; $b1 = $low & 0xff; $r2 = $high >> 16; $g2 = ($high & 0xff00) >> 8; $b2 = $high & 0xff; $r = gradient($r1, $r2, $totalsteps); $g = gradient($g1, $g2, $totalsteps); $b = gradient($b1, $b2, $totalsteps); $ary = array(); for ($i = 0; $i < count($r); $i++) { $ary[] = $r[$i] << 16 | $g[$i] << 8 | $b[$i]; } return $ary; }
return array($out_i, $out_g); } function gradient($data, $parameters) { $learn_rate = 0.01; $hypothesis = hypothesis($parameters[0], $parameters[1]); $deriv = deriv($data, $hypothesis); $score = score($data, $hypothesis); $parameters[0] = $parameters[0] - $learn_rate * $deriv[0]; $parameters[1] = $parameters[1] - $learn_rate * $deriv[1]; // Create a new hypothesis to test our score $hypothesis = hypothesis($parameters[0], $parameters[1]); if ($score < score($data, $hypothesis)) { return false; } return $parameters; } $parameters = array(0, 0); $min = null; do { list($minParams, $min) = step($data, $parameters, $min); } while ($minParams != null && ($parameters = $minParams)); var_dump($parameters); echo "====================\n"; $parameters = array(1, 3); $last_parameters = false; do { $last_parameters = $parameters; $parameters = gradient($data, $parameters); } while ($parameters != false); var_dump($last_parameters);
} footer#page-footer a:hover { color: <?php echo $footer_link_hover_color; ?> ; } footer#page-footer a:visited { color: <?php echo $footer_link_visited_color; ?> ; } .footer-color { <?php gradient($footer_top_color, $footer_bottom_color); ?> ; } footer#page-footer h3 { color: <?php echo $footer_header_color; ?> ; font-size: 1.3em; text-shadow: 0 -1px <?php echo $footer_header_shadow; ?> ; margin-top: <?php echo $default_margin;