function __construct($filename) { $this->dom = new DOMDocument(); $this->dom->load(mapPath($filename)); $this->filename = basename($filename); $xmlbase = $this->getXmlBase(); if (!$xmlbase) { $xmlbase = 'http://novascotia.ca' . dirname(dirname($_SERVER['SCRIPT_NAME'])) . '/'; $this->dom->documentElement->setAttribute('xml:base', $xmlbase); } #echo "Loaded feed:\n" . $this->toString() . "\n"; }
// plot starting point if (count($starts) == 1 && count($ends) == 1) { if ($debug) { echo "//start location:\n//"; $start_location->printInfo(); echo "\n//end location:\n//"; $end_location->printInfo(); echo "\n"; } markLocation($start_location, $start_marker_img, "start"); if (is_array($cpath) && !is_null($path)) { //plot ending point markLocation($end_location, $end_marker_img, "end"); mapStations($start_stations, "start"); mapStations($end_stations, "end"); mapPath($path->path, $cpath); } else { if (is_string($cpath) && $cpath == "walk") { //plot ending point markLocation($end_location, $end_marker_img, "end"); } } } else { for ($i = 0; $i < count($starts); $i++) { markLocation($starts[$i], $start_marker_img, "start" . $i); } for ($i = 0; $i < count($ends); $i++) { markLocation($ends[$i], $end_marker_img, "end" . $i); } } }
/** * Performs a search for given pattern in files in supplied sub-folder/file * * @param array $args $args[0] contains path to sub-folder/file, * $args[1] contains the regex searching for * @return bool $no_instructions false if should output code_tool.php * instructions */ function search($args) { $no_instructions = false; if (isset($args[0]) && isset($args[1])) { $path = realpath($args[0]); $no_instructions = true; $pattern = $args[1]; $len = strlen($pattern); if ($len >= 2) { $pattern = preg_quote($pattern, "@"); $pattern = "@{$pattern}@"; searchFile("", $pattern); // initialize callback mapPath($path, "searchFile"); } } return $no_instructions; }