define('PREG_FIND_RECURSIVE', 1); define('PREG_FIND_DIRMATCH', 2); define('PREG_FIND_FULLPATH', 4); define('PREG_FIND_NEGATE', 8); define('PREG_FIND_DIRONLY', 16); define('PREG_FIND_RETURNASSOC', 32); define('PREG_FIND_SORTDESC', 64); define('PREG_FIND_SORTKEYS', 128); define('PREG_FIND_SORTBASENAME', 256); # requires PREG_FIND_RETURNASSOC define('PREG_FIND_SORTMODIFIED', 512); # requires PREG_FIND_RETURNASSOC define('PREG_FIND_SORTFILESIZE', 1024); # requires PREG_FIND_RETURNASSOC define('PREG_FIND_SORTDISKUSAGE', 2048); # requires PREG_FIND_RETURNASSOC // PREG_FIND_RECURSIVE - go into subdirectorys looking for more files // PREG_FIND_DIRMATCH - return directorys that match the pattern also // PREG_FIND_DIRONLY - return only directorys that match the pattern (no files) // PREG_FIND_FULLPATH - search for the pattern in the full path (dir+file) // PREG_FIND_NEGATE - return files that don't match the pattern // PREG_FIND_RETURNASSOC - Instead of just returning a plain array of matches, // return an associative array with file stats // // You can also request to have the results sorted based on various criteria // By default if any sorting is done, it will be sorted in ascending order. // You can reverse this via use of: // PREG_FIND_SORTDESC - Reverse order of sort // PREG_FILE_SORTKEYS - Sort on the keyvalues or non-assoc array results // The following sorts *require* PREG_FIND_RETURNASSOC to be used as they are // sorting on values stored in the constructed associative array // PREG_FIND_SORTBASENAME - Sort the results in alphabetical order on filename // PREG_FIND_SORTMODIFIED - Sort the results in last modified timestamp order // PREG_FIND_SORTFILESIZE - Sort the results based on filesize // PREG_FILE_SORTDISKUSAGE - Sort based on the amount of disk space taken // to use more than one simply seperate them with a | character // Search for files matching $pattern in $start_dir. // if args contains PREG_FIND_RECURSIVE then do a recursive search // return value is an associative array, the key of which is the path/file // and the value is the stat of the file. Function preg_find($pattern, $start_dir='.', $args=NULL) { static $depth = -1; ++$depth; $files_matched = array(); $fh = opendir($start_dir); while (($file = readdir($fh)) !== false) { if (strcmp($file, '.')==0 || strcmp($file, '..')==0) continue; $filepath = $start_dir . '/' . $file; if (preg_match($pattern, ($args & PREG_FIND_FULLPATH) ? $filepath : $file)) { $doadd = is_file($filepath) || (is_dir($filepath) && ($args & PREG_FIND_DIRMATCH)) || (is_dir($filepath) && ($args & PREG_FIND_DIRONLY)); if ($args & PREG_FIND_DIRONLY && $doadd && !is_dir($filepath)) $doadd = false; if ($args & PREG_FIND_NEGATE) $doadd = !$doadd; if ($doadd) { if ($args & PREG_FIND_RETURNASSOC) { // return more than just the filenames $fileres = array(); if (function_exists('stat')) { $fileres['stat'] = stat($filepath); $fileres['du'] = $fileres['stat']['blocks'] * 512; } if (function_exists('fileowner')) $fileres['uid'] = fileowner($filepath); if (function_exists('filegroup')) $fileres['gid'] = filegroup($filepath); if (function_exists('filetype')) $fileres['filetype'] = filetype($filepath); if (function_exists('mime_content_type')) $fileres['mimetype'] = mime_content_type($filepath); if (function_exists('dirname')) $fileres['dirname'] = dirname($filepath); if (function_exists('basename')) $fileres['basename'] = basename($filepath); if (isset($fileres['uid']) && function_exists('posix_getpwuid')) $fileres['owner'] = posix_getpwuid ($fileres['uid']); $files_matched[$filepath] = $fileres; } else array_push($files_matched, $filepath); } } if ( is_dir($filepath) && ($args & PREG_FIND_RECURSIVE) ) { $files_matched = array_merge($files_matched, preg_find($pattern, $filepath, $args)); } } closedir($fh); // Before returning check if we need to sort the results. if (($depth==0) && ($args & (PREG_FIND_SORTKEYS|PREG_FIND_SORTBASENAME|PREG_FIND_SORTMODIFIED|PREG_FIND_SORTFILESIZE|PREG_FIND_SORTDISKUSAGE)) ) { $order = ($args & PREG_FIND_SORTDESC) ? 1 : -1; $sortby = ''; if ($args & PREG_FIND_RETURNASSOC) { if ($args & PREG_FIND_SORTMODIFIED) $sortby = "['stat']['mtime']"; if ($args & PREG_FIND_SORTBASENAME) $sortby = "['basename']"; if ($args & PREG_FIND_SORTFILESIZE) $sortby = "['stat']['size']"; if ($args & PREG_FIND_SORTDISKUSAGE) $sortby = "['du']"; } $filesort = create_function('$a,$b', "\$a1=\$a$sortby;\$b1=\$b$sortby; if (\$a1==\$b1) return 0; else return (\$a1<\$b1) ? $order : 0- $order;"); uasort($files_matched, $filesort); } --$depth; return $files_matched; } ?>
|
|---|
Sentence types - ZinstypenA text with passive sentencesHere is a text containing a few passive sentences. The text is about interactief voorlezen (reading aloud interactively), a new method for improving childrens' literacy that has been tested out in a nursery school in Rotterdam.
This example is in the present tense, because the passive auxiliary is wordt. The >>subject is het boek, so it's in the third person singular. There is no >agent. Voorlezen is an activity normally carried out by an adult for a younger audience, so we can deduce from the text that the reader will be a teacher. The most important information is the way the book is being read: op een samenvattende manier. Because it is so important, this >>adverbial adjunt of manner occurs towards the end of the sentence. [back] The two examples in this paragraph are very similar. They are both in the present tense, with the plural >>subject kinderen. The first example is a subordinate introduced by the >>subordinating conjunction dat. There is no >agent, but the paragraph begins with: De kern van de methode is dat ... From this it is clear that it is the reading method that does the promting and stimulating. In both examples the final constituent of the clause is the most informative one. In the first example it is thinking that children are prompted to do. In the second example the last constituent it is linking the story to their own experiences that the children are stimulated into doing. The whole (elliptical) clause om het verhaal te koppelen aan hun eigen ervaringen also occurs at the end of the clause because it is such a long constituent. [back] This example is in the perfect tense, because the auxiliary is is (the third person singular form of zijn). The >>subject is de methode. There is no >agent and it is not clear from the context (or indeed the entire text) who has been the developer of the method. But that is not the important point of this sentence. What is important here is the developer's customer: the minister of education. That is why the prepositional phrase in opdracht van de minister van onderwijs occurs in the final position of the clause. [back] In this example a subordinate clause (dat veel peuterscholen de methode zullen omarmen) which is the >>subject of the passive construction verwacht wordt. This sentence is quite typical of a rather formal, almost bureaucratic style. The sentence is in the present tense because the passive auxiliary is wordt. Note that the past participle takes up the first position in the clause. That is normally quite strange, but not for this particular style. In a more relaxed style you would expect a different formulation: Er wordt verwacht dat ... In English both formulations translate in the same way: It is expected that ... You will find the more formal formulation (starting with the past participle) in texts such as policy documents, official reports or academic papers. The example contains no agent, but the conjunctional adverb daarom indicates that we can conclude 'that many nursery schools will embrace the method' from the preceding sentence. So it looks as though the expectation is Leny Zweerink's, that Leny Zweerink is the agent. [back] This example is a >>relative clause. The example is in the present tense with the >>relative pronoun die as the >>subject. As the >>antecedent of die is de onderwerpen, the example is in the plural. There is no >agent, but as it is normally a teacher who deals with topics in a class, the implied agent is peuterleidsters. [back] Back to home.
|