:String - Directory to be listed. :Int - Level of subdirectories to be listed. Default = 0 (no subdirectories) :String - Sort data on: 'name'(default), 'size', 'date' of 'type'. :Boolean - Reverse data (true or false(default)) $ld = new ListDir(, , ); $ld->getList(, ); $ld->displayXml(, ); getList:Array - Returns multidimensional array. array (0 => array ( 'name' => 'img', 'type' => 'dir', 'date' => 1234214523, 'list' => array ( 0 => array ( 'name' => 'image.jpg', 'type' => 'file', 'date' => 1233524541, 'size' => 12485 ))), 1 => array ( 'name' => 'index.html', 'type' => 'file', 'date' => 1234214523, 'size' => 245 )); etc... displayXml:Xml - returns xml headers and data. image.jpg index.html */ class ListDir { var $dir; var $level; var $sort_on = 'name'; var $reversed = false; var $list = array(); var $knowntypes = array("css", "doc", "exe", "flv", "gif", "html", "jpg", "mp3", "pdf", "php", "png", "ppt", "psd", "swf", "txt", "xls", "zip"); var $allowedtypes = array(); // -------------------------------- // CONSTRUCTOR // -------------------------------- function ListDir($dir, $level = 0, $types = array()) { $this->dir = $dir; $this->level = $level; $this->allowedtypes = $types; $this->list = $this->_list($dir, 0); } // -------------------------------- // LIST A DIREACTORY // -------------------------------- function _list($dir, $dlevel) { if(substr($dir, -1) != '/') $dir .= '/'; if(!is_dir($dir)) return "$dir is not a directory"; $dlevel++; if($this->level < $dlevel - 1) return array(); $list = array(); if ($dh = opendir($dir)) { while (($file = readdir($dh)) !== false) { if($file == '.' || $file == '..') continue; $bestand = array(); $bestand['name'] = $file; $bestand['type'] = filetype($dir . $file); $bestand['date'] = filemtime($dir . $file); $bestand['path'] = $dir; if($bestand['type'] == 'file') { $bestand['size'] = filesize($dir . $file); $ext = pathinfo($file, PATHINFO_EXTENSION); $ext = strtolower($ext); if(in_array($ext, $this->knowntypes)) $bestand['type'] = $ext; if($ext == 'jpeg') $bestand['type'] = 'jpg'; if($bestand['type'] == 'jpg' || $bestand['type'] == 'gif' || $bestand['type'] == 'png'){ list($width, $height, $type, $attr) = getimagesize($dir . $file); $bestand['width'] = $width; $bestand['height'] = $height; } if($bestand['type'] == 'php' || $bestand['type'] == 'inc' || $bestand['type'] == 'mdu') continue; } if(!in_array($bestand['type'], $this->allowedtypes) && !empty($this->allowedtypes)) continue; if($bestand['type'] == 'dir') $bestand['list'] = $this->_list($dir . $file . '/', $dlevel); $list[] = $bestand; } closedir($dh); } return $list; } // -------------------------------- // GET DIRECTORY LIST // -------------------------------- function getList($sort_on = 'name', $reversed = false) { $this->sort_on = $sort_on; $this->reversed = $reversed; $this->_sortList($this->list); return $this->list; } // -------------------------------- // DISPLAY DIRECTORY LIST IN XML // -------------------------------- function displayXML($sort_on = 'name', $reversed = false) { $this->sort_on = $sort_on; $this->reversed = $reversed; $this->_sortList($this->list); header("Content-type: text/xml"); echo($this->_getXML()); exit(); } // -------------------------------- // CREATE XML STING // -------------------------------- function _getXML() { $dir_name = realpath($this->dir); $dir_name = substr( $dir_name, strlen($_SERVER['DOCUMENT_ROOT']) ); $xml = ""; $xml .= ''; $xml .= $this->_xmlDir($this->list); $xml .= ""; return $xml; } // -------------------------------- // XML DIRECTORY // -------------------------------- function _xmlDir(&$list) { $xml = ""; foreach($list as $nr => $file) { if($file['type'] == 'dir'){ $xml .= ""; $xml .= $this->_xmlDir($file['list']); $xml .= "\n"; }else{ $xml .= "\n"; } } return $xml; } // -------------------------------- // SORT DA LIST // -------------------------------- function _sortList(&$list) { usort($list, array('ListDir', 'compare')); // sort sub directories foreach($list as $nr => $file){ if($file['type'] == 'dir'){ $this->_sortList($list[$nr]['list']); } } } function compare($x, $y) { // altijd directories eerst, dan sorteren op $this->sort_on if ( $x['type'] == 'dir' && $y['type'] != 'dir'){ return -1; } elseif( $x['type'] != 'dir' && $y['type'] == 'dir'){ return 1; } else { if ( $x['name'] == $y['name'] ) return 0; return (strtolower($x['name']) < strtolower($y['name'])) ? -1 : 1; /* // $this bestaat niet??? if ( $x[$this->sort_on] == $y[$this->sort_on] ) return 0; elseif ( $x[$this->sort_on] < $y[$this->sort_on] ) return ($this->reversed)? 1:-1; else return ($this->reversed)? -1:1; */ } } } ?> ReservationsIl Senso - Italiaans Restaurant in Den Haag

Reservations

Book your table here!

Please complete the form below to book a table; your reservation will be confirme by email or telephone! Reservations for groups larger than 12 persons please indicate the number of guests in the field 'comments' or contact il Senso by phone.

For reservations on the same day, please contact il Senso by phone to ensure yourself of a table.

il Senso is closed on Monday May 5!