'; $cnt=0; foreach (glob("*_lighthouses.php") as $filename) { if (strpos(($filename . "*"), (str_replace(" ", "_", strtolower($def)) . '_lighthouses.php*')) === false) { $cnt++; $newidea=str_replace("_", " ", str_replace("_lighthouses.php", "", strtolower($filename))); $newideas=explode(" ", $newidea); $ideas=strtoupper(substr($newideas[0],0,1)) . strtolower(substr($newideas[0],1)); for ($ii=1; $ii' . $ideas . ''; } } if ($cnt > 0) return $selstr . ""; return $ret; } $lhcont=str_replace("", "\n"; $ourscript="<" . "script type='text/javascript'>\nfunction populate() { document.getElementById('title').value=decodeURIComponent('" . $ourtitle . "'); document.getElementById('label').value=decodeURIComponent('" . $ourlabel . "'); document.getElementById('value').value=decodeURIComponent('" . $ourvalue . "'); document.getElementById('data').value=''; \n"; // Write out start of HTML ready for the one table row that will be created ... echo 'Ireland Lighthouses - RJM Programming - July, 2015<' . 'script type="text/javascript"> function after() { document.getElementById("submit").click(); document.getElementById("' .$iname . '").style.display="inline"; }

' . selcreate('Ireland') . ' Lighthouses ... Thanks to Wikipedia

' . "\n"; $bextras = ""; $docb=false; try { $doc = new DOMDocument(); $doc->preserveWhiteSpace = FALSE; $before = libxml_use_internal_errors(true); $doc->loadHTML(file_get_contents(dirname(__FILE__) . "/ireland_lighthouses.txt")); libxml_use_internal_errors($before); $docb = true; } catch (Exception $e) { throw new Exception( 'Something really wrong', 0, $e); } if ($docb && 1 == 1) { foreach ($doc->getElementsByTagName("li") as $link) { $linkc14n=$link->C14N(); $hrefs=explode("href=", $linkc14n); $posthrefs=explode(" ", $hrefs[sizeof($hrefs) - 1]); $ihs=explode("", $linkc14n); $ih=explode(">", $ihs[0]); $bits=explode(" - ", $linkc14n); $altis=$ih[sizeof($ih) - 1]; $titleis=$ih[sizeof($ih) - 1]; $altis=str_replace("'", "`", $altis); $titleis=str_replace("'", "`", $titleis); $xpostabits=explode("°", $linkc14n); $dpostabits=explode(".", $linkc14n); $latsofar="0"; $longsofar="0"; $sl=""; if (sizeof($dpostabits) >= 2) { if (strpos($dpostabits[sizeof($dpostabits) - 2], "S") !== false) { $bs=explode("S", $dpostabits[sizeof($dpostabits) - 2]); //$longsofar=trim($bs[sizeof($bs) - 1]); $longsofar=""; $ip=(strlen($dpostabits[sizeof($dpostabits) - 2]) - 1); while ($ip >= 0 && (substr($dpostabits[sizeof($dpostabits) - 2], $ip, 1) < '0' || substr($dpostabits[sizeof($dpostabits) - 2], $ip, 1) > '9')) { $ip--; } while ($ip >= 0 && substr($dpostabits[sizeof($dpostabits) - 2], $ip, 1) >= '0' && substr($dpostabits[sizeof($dpostabits) - 2], $ip, 1) <= '9') { $longsofar=substr($dpostabits[sizeof($dpostabits) - 2], $ip, 1) . $longsofar; $ip--; } $latsofar="-"; $ip=(strlen($dpostabits[sizeof($dpostabits) - 3]) - 1); while ($ip >= 0 && (substr($dpostabits[sizeof($dpostabits) - 3], $ip, 1) < '0' || substr($dpostabits[sizeof($dpostabits) - 3], $ip, 1) > '9')) { $ip--; } while ($ip >= 0 && substr($dpostabits[sizeof($dpostabits) - 3], $ip, 1) >= '0' && substr($dpostabits[sizeof($dpostabits) - 3], $ip, 1) <= '9') { $latsofar=str_replace("-", "-" . substr($dpostabits[sizeof($dpostabits) - 3], $ip, 1), $latsofar); $ip--; } $latsofar.="."; $ip=0; while (substr($dpostabits[sizeof($dpostabits) - 2], $ip, 1) >= '0' && substr($dpostabits[sizeof($dpostabits) - 2], $ip, 1) <= '9') { $latsofar.=substr($dpostabits[sizeof($dpostabits) - 2], $ip, 1); $ip++; } } else { $bs=explode("N", $dpostabits[sizeof($dpostabits) - 2]); //$longsofar=trim($bs[sizeof($bs) - 1]); $longsofar=""; $ip=(strlen($dpostabits[sizeof($dpostabits) - 2]) - 1); while ($ip >= 0 && (substr($dpostabits[sizeof($dpostabits) - 2], $ip, 1) < '0' || substr($dpostabits[sizeof($dpostabits) - 2], $ip, 1) > '9')) { $ip--; } while ($ip >= 0 && substr($dpostabits[sizeof($dpostabits) - 2], $ip, 1) >= '0' && substr($dpostabits[sizeof($dpostabits) - 2], $ip, 1) <= '9') { $longsofar=substr($dpostabits[sizeof($dpostabits) - 2], $ip, 1) . $longsofar; $ip--; } $latsofar="+"; $ip=(strlen($dpostabits[sizeof($dpostabits) - 3]) - 1); while ($ip >= 0 && (substr($dpostabits[sizeof($dpostabits) - 3], $ip, 1) < '0' || substr($dpostabits[sizeof($dpostabits) - 3], $ip, 1) > '9')) { $ip--; } while ($ip >= 0 && substr($dpostabits[sizeof($dpostabits) - 3], $ip, 1) >= '0' && substr($dpostabits[sizeof($dpostabits) - 3], $ip, 1) <= '9') { $latsofar=str_replace("+", "+" . substr($dpostabits[sizeof($dpostabits) - 3], $ip, 1), $latsofar); $ip--; } if (1 == 4) $latsofar=str_replace("+", "", $latsofar); $latsofar.="."; $ip=0; while (substr($dpostabits[sizeof($dpostabits) - 2], $ip, 1) >= '0' && substr($dpostabits[sizeof($dpostabits) - 2], $ip, 1) <= '9') { $latsofar.=substr($dpostabits[sizeof($dpostabits) - 2], $ip, 1); $ip++; } } } if (strpos($xpostabits[sizeof($xpostabits) - 1], "W") !== false) { $longsofar="-" . $longsofar . "."; if ($sl == "") $sl=$longsofar; $ip=0; while (substr($dpostabits[sizeof($dpostabits) - 1], $ip, 1) >= '0' && substr($dpostabits[sizeof($dpostabits) - 1], $ip, 1) <= '9') { $longsofar.=substr($dpostabits[sizeof($dpostabits) - 1], $ip, 1); $ip++; } } else { $longsofar="+" . $longsofar . "."; if ($sl == "") $sl=$longsofar; $ip=0; while (substr($dpostabits[sizeof($dpostabits) - 1], $ip, 1) >= '0' && substr($dpostabits[sizeof($dpostabits) - 1], $ip, 1) <= '9') { $longsofar.=substr($dpostabits[sizeof($dpostabits) - 1], $ip, 1); $ip++; } } $latis=$latsofar; $longis=$longsofar; if (sizeof($xpostabits) > 1) { $bextras = str_replace("", "", $bextras); $seimgbit=urlencode(">" . str_replace((", " . $altis), "", ($altis . ", " . $titleis)) ) . "%3C/a%3E"; $thisdata = ",[" . str_replace("+","",$latis) . "," . str_replace("+","",$longis) . "," . "%22A%20Wikipedia%20clicking%20link%20for%20Google%20Map%20based%20on%20latitude%20and%20longitude%20of%20%3Ca%20target=_blank%20href=\\\\\"https://maps.google.com.au/maps?" . urlencode("z=15&t=m&q=loc:") . urlencode(str_replace("+","",$latis) . "+" . $longis) . "\\\\\"" . $seimgbit . "%22,~" . urlencode(str_replace((", " . $altis), "", ($altis . ", " . $titleis)) ) . "~]"; // Write out Javascript to populate textarea and rest of form data that will be posted to iframe ... $ourscript .= "\n document.getElementById('data').value+=decodeURIComponent('" . $thisdata . "'); "; $ourscript .= "\n document.getElementById('data').innerHTML+=decodeURIComponent('" . $thisdata . "'); "; $ourdata .= $thisdata; } } echo $bextras; } // Write out end of HTML including end of row and end of table and form (method=POST with a submit button programmatically clicked via setInterval() at body onload event) and Javascript code and Google Chart Map Chart map.php iframe. echo "\n
" . $posthrefs[0] . "" . str_replace((", " . $altis), "", ($altis . ", " . $titleis)) . $imgbit . "
" . $ourform . $ourscript . "\n if (1 == 1) { setTimeout(after, 2000); } \n } \n
"; ?>