So you’re the one who uses a non-SVG-enabled browser. You’re holding back the whole internet, you know that? The tag is only needed for visitors of your site who use the Adobe SVG Viewer. It is not required for standard conformance. */ error_reporting(E_ERROR|E_WARNING|E_PARSE|E_USER_ERROR|E_DEPRECATED); define('yes', TRUE); define('no' , FALSE); ################################## ##-- Customization settings --## ##- External PHP file with customization settings -## # Remove that line to use only the settings defined below $settings = 'settings.php'; ##- Title -## $title = 'Just Thinking...'; ##- Link to homepage -## $home = 'index.php'; # URL $thome = "‘$title’ home page"; # title ##- Titles to be used for navigation links -## # Most browsers show them as tooltips on mouseover $next = 'Next'; $previous = 'Previous'; $first = 'First'; $current = 'Current'; ##- Background Colors -## # May be omitted $backgroundColor = '#000000'; $backgroundGradientTo = '#cccccc'; ##- takes effect on the positioning of the navigation links -## # must be 'ltr' or 'rtl' $dir = 'ltr'; ##- Parts of image/text filenames before and after the numbers -## # The suffix '.jpg', '.jpeg', or '.png' for images isn't part of $ipost, # because they are added automatically. $ipre = 'thinking'; # first part of image names $ipost = ''; # third part of image names (second part is the number) $ipath = substr($_SERVER['SCRIPT_NAME'], 0, strrpos($_SERVER['SCRIPT_NAME'], '/')+1); # is prepended before the image filename in the image element's xlink:href attribute. set to empty string to use relative paths. $tpre = $ipre; # first part of text file names $tpost = '.txt'; # third part of text file names (second part is the number) ##- Index number of first image/text file -## # Typically 1, or 0 if you prefer, but may be any number $start = 1; ##- Default text file, image, or text -## # Will be shown if no image or text file with the requested number exists $tdefault = $tpre . 'error' . $tpost; $idefault = $ipre . 'error' . $ipost . '.png'; $tdefaultText = 'ERROR: This strip does not exist.'; ##- Whether to add a link to this source code -## # You don't have to $source = yes; $sourcet = 'view source code'; # link title $nsource = 'showsource'; # name of query variable for viewing the source code $ndownload = 'download'; # name of query variable for downloading the source code ##- Variable name for index number to be used in query strings -## # This is part of the URLs used to link to a specific strip $nvar = 'number'; ##- Link to this page -## # Can be customized to point to a PURL with partial redirect $here = yes; $herepre = "${_SERVER['SCRIPT_NAME']}?$nvar="; # part before the number $herepost = ''; # part after the number $heretitle = 'Permalink'; # title ##- Font size and line spacing in user coordinates -## # Only the ratio $tspace/$fsize has a visual effect. # Everything is scaled relative to the text, so the # only way to change the visible font size is by # adjusting the line breaks in your texts. $fsize = 30; $tspace = $fsize; ##- Whether to deliver the SVG inline in XHTML or as standalone SVG $inline = no; ##-- End of customization settings --## ######################################### ##-- Actual source code --## ##- Include external customization file -## if($settings && file_exists($settings)) { include $settings; } ##- Output own source code, if requested -## if($source && (isset($_GET[$nsource])||isset($_GET[$ndownload]))) { if(isset($_GET[$ndownload])) { header('Content-Type: application/x-php'); header('Content-Disposition: attachment'); } else { header('Content-Type: text/plain; charset=UTF-8'); } @readfile(__FILE__); exit(); } ##- Function to test for existence of a strip -## function exists($number) { global $ipre, $tpre, $ipost, $tpost; return (file_exists($tpre . $number . $tpost) || file_exists($ipre . $number . $ipost . '.jpg') || file_exists($ipre . $number . $ipost . '.jpeg') || file_exists($ipre . $number . $ipost . '.png')); } ##- Read strip number from query string -## if(isset($_GET[$nvar])) { $number = (int) $_GET[$nvar]; } else { ##- If no strip number given then find the latest strip -## $i = 1; while(exists($start + $i - 1)) { $i <<= 1; } $x = $i; $i >>= 1; $j = $i >> 1; while($j > 0) { if(exists($start + ($i | $j) - 1)) { $i |= $j; } $j >>= 1; } $number = $start + $i - 1; } ##- Put together image filename -## # Firstly with '.jpg' extension. $ifile = $ipre . $number . $ipost . '.jpg'; # If no such file exists then try '.jpeg' and then '.png' extensions. if(! file_exists($ifile)) { $ifile = $ipre . $number . $ipost . '.jpeg'; if(! file_exists($ifile)) { $ifile = $ipre . $number . $ipost . '.png'; # If no PNG exists either then set to empty string. # This is our way to remember that we don't have an image file if(! file_exists($ifile)) { $ifile = ''; } } } ##- Put together text filename -## $tfile = $tpre . $number . $tpost; # and read the text into an array if(file_exists($tfile)) { $text = file($tfile, FILE_IGNORE_NEW_LINES | FILE_TEXT); } ##- If neither image nor text were found then try default (error) values -## if(!($text || $ifile)) { if($tdefault && file_exists($tdefault)) { $text = file($tdefault, FILE_IGNORE_NEW_LINES | FILE_TEXT); } else if($tdefaultText) { $text = preg_split('/\n/', $tdefaultText); } if($idefault && file_exists($idefault)) { $ifile = $idefault; } } ##- function to produce XML safe attribute values -## function attribute_escape($string) { return str_replace(array('&', '"', '\''), array('&', '"', '''), $string); } ##- Put together links -## $self = $_SERVER['SCRIPT_NAME']; # keep all unknown parameters # maybe they are interpreted in the customization part $otherparameters = ''; foreach($_GET as $key => $value) { if($key!=$nvar) { $otherparameters .= '&'.rawurlencode($key).'='.rawurlencode($value); } } # create backward and forward links if(exists($number-1)) { $frstlink = $self.'?'.$nvar.'='.$start.$otherparameters; $prevlink = $self.'?'.$nvar.'='.($number-1).$otherparameters; $frstlinkxml = attribute_escape($frstlink); $prevlinkxml = attribute_escape($prevlink); } if(exists($number+1)) { $nextlink = $self.'?'.$nvar.'='.($number+1).$otherparameters; $lastlink = $self; if($otherparameters) { $lastlink .= '?'.substr($otherparameters, 1); } $nextlinkxml = attribute_escape($nextlink); $lastlinkxml = attribute_escape($lastlink); } # create link to this strip $herelink = "$herepre$number$herepost"; $herelinkxml = attribute_escape($herelink); # if an invalid number was given, set the link to the current strip # otherwise there would be no link at all in that case if(!exists($number)) { $lastlink = $self; $lastlinkxml = attribute_escape($lastlink); $here = no; } # link to source code, if desired if($source) { $sourcelink = $self.'?'.$nsource; } ##- Assign links to their positions -## # depending on the direction if ($dir=='ltr') { $rtdn = $lastlinkxml; $rtdnt = $current; $rght = $nextlinkxml; $rghtt = $next; $left = $prevlinkxml; $leftt = $previous; $ltup = $frstlinkxml; $ltupt = $first; $homepos = 0; # possible values are 0 to 3 for the four edges $sourcepos = 1; # possible values are 0 to 3 for the four edges $permalinkpos = 3; # possible values are 0 to 3 for the four edges } elseif ($dir=='rtl') { $ltdn = $lastlinkxml; $ltdnt = $current; $left = $nextlinkxml; $leftt = $next; $rght = $prevlinkxml; $rghtt = $previous; $rtup = $frstlinkxml; $rtupt = $first; $homepos = 1; # possible values are 0 to 3 for the four edges $sourcepos = 0; # possible values are 0 to 3 for the four edges $permalinkpos = 2; # possible values are 0 to 3 for the four edges } ##- Layout -## $margin = 3; # A margin # horizontal and vertical semi-major axes of the text box' rounded edges $hr = $fsize*1.4; $vr = $fsize; # horizontal and vertical offset of the ellipses from the text box edges $ehsp = 2*$fsize; $evsp = 0; # horizontal and vertical semi-major axes of the ellipses $ehr = $hr; $evr = $vr; # vertical distance between centers of top and bottom trail ellipses $bdist = $evr*7; $N = 3; # number of trail ellipses minus one # Function used for positioning and scaling of trail ellipses function brad($s) { return pow($s, 1.4); } # Get size of image, if present if ($ifile) { $isize = getimagesize($ifile); } # Determin size and position of text box, if text exists if ($text) { # Text width is roughly estimated based on the maximum # line length by characters $twidth = 0; foreach($text as $line) { $twidth = max($twidth, strlen(preg_replace('/\&(\#x?[0-9a-fA-F]+|amp)\;/', '#', $line))*$fsize*0.6); } $theight = $fsize + (count($text)-1)*$tspace; # Determin rectangle position (except for left offset) $rtop = $evsp + $evr + $margin; $rwidth = $twidth + 2*$hr; $rheight = $theight + 2*$vr; $texty = $rtop + $vr; # vertical position for first line of text } # Determin size and position of image, if present if($ifile) { if ($text) { # Align image verticalle at the center of the lowest but one trail ellipse. $itop = $rtop + $rheight + $evsp + $bdist*(1-brad(1/$N)); # Image width equal to text box size and preserve aspect ratio. $iwidth = $rwidth; $iheight = $iwidth*$isize[1]/$isize[0]; } else { # If no text is given then use pixel size of the image # one unit equals one image pixel. $itop = $margin; $iwidth = $isize[0]; $iheight = $isize[1]; } # Width and height of the whole content # i.e. without the navigation links at the left and right $cheight = $itop + $iheight + $margin; $cwidth = $iwidth; } else { $cheight = $rtop + $rheight + $evsp + $evr + $margin; $cwidth = $rwidth; } $bwidth = $cheight/10; # width of navigation bars $brad1 = $bwidth*0.4; # radius of large navigation links $brad2 = $brad1*0.9; # radius of smaller navigation links # Make room for the left navigation bar if($text) { $rleft = $margin + $bwidth; # left edge position of text box $textx = $rleft + 0.5*$rwidth; # horizontal coordinate for text } if($ifile) { $ileft = $margin + $bwidth; # left edge of image } # Overall dimensions of content and navigation links $width = $cwidth + 2*($bwidth + $margin); $height = $cheight; ##- End of layout -## ##- Output -## if($inline) { header('Content-Type: application/xhtml+xml'); } else { header('Content-Type: image/svg+xml'); } echo "\n"; if($inline) { echo '' . "\n"; echo ""; echo ""; echo "$title"; if($prevlink) { echo ""; } if($nextlink) { echo ""; } if($frstlink) { echo ""; } if($lastlink) { echo ""; } if($home) { echo ""; } echo ""; echo ""; echo "
"; } else { echo '' . "\n"; } echo ""; echo "$title\n"; ?> '; echo ""; echo ""; if($backgroundColor) { echo ""; } else { echo ""; } echo ""; } ?> "; } echo ""; $relw = 0.5; $posx = $bwidth*(1-$relw)/2.5; $posy = $bwidth*(1-$relw)/2.5; $wd = $bwidth*$relw; $ht = $height - 2*$posy; $rd = $wd/2; echo ""; $posx = $width - $posx - $wd; echo ""; $posx = $bwidth/2; $posy = $height/2; if($left) { echo ""; } echo ""; echo ""; if($left) { echo ""; } $posx = $bwidth/2; $posy = $height/2 - 2*$brad1; if($ltup) { echo ""; } echo ""; if($ltup) { echo ""; echo ""; } $posx = $bwidth/2; $posy = $height/2 + 2*$brad1; if($ltdn) { echo ""; } echo ""; if($ltdn) { echo ""; echo ""; } $posx = $width - $bwidth/2; $posy = $height/2; if($rght) { echo ""; } echo ""; echo ""; if($rght) { echo ""; } $posx = $width - $bwidth/2; $posy = $height/2 - 2*$brad1; if($rtup) { echo ""; } echo ""; if($rtup) { echo ""; echo ""; } $posx = $width - $bwidth/2; $posy = $height/2 + 2*$brad1; if($rtdn) { echo ""; } echo ""; if($rtdn) { echo ""; echo ""; } if($home) { $posx = ($homepos & 1)*($width-$bwidth) + $bwidth/2; $posy = ($homepos & 2)*($height-2*$bwidth)/2 + $bwidth; echo ""; echo ""; echo ""; echo ""; } if($here) { $posx = ($permalinkpos & 1)*($width-$bwidth) + $bwidth/2; $posy = ($permalinkpos & 2)*($height-2*$bwidth)/2 + $bwidth; echo ""; echo ""; echo ""; echo ""; } if($source) { $posx = ($sourcepos & 1)*($width-$bwidth) + $bwidth/2; $posy = ($sourcepos & 2)*($height-2*$bwidth)/2 + $bwidth; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; } echo ""; if($ifile) { echo ""; } if ($text) { echo ""; if ($ifile) { for($k = 0; $k < $N; $k++) { $s = brad($k/$N); $dx = 30*(-($N-$k)/$N + 0.5)*($N-$k)/$N; $dy = 1-$s; echo ""; } } echo ""; echo ""; echo ""; echo ""; $texty += $fsize; echo ""; foreach ($text as $line) { if($line) { $line = str_replace('<', '<', preg_replace('/\&(?!\#x?[0-9a-fA-F]+\;|amp\;)/', '&', $line)); echo " $line "; } $texty += $tspace; } echo ""; } echo ""; if($inline) { echo "
"; } ?>