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; } ?>
|
|---|
Passive voice - Lijdende vorm IntroductionThe passive voice is not a tense, but provides a different focus on a situation. A sentence in the passive voice always has an active counterpart. Look at the following examples:
In the first sentence, the subject is Alan, and the object is Hanna. This is an active sentence, because the person carrying out the activity described by the verb (Alan), is the subject. In the corresponding passive sentence, the subject is Hanna. In other words, the object in the active sentence is the subject in the corresponding passive sentence. The subject of the active sentence (Alan) is still present in the passive sentence and indicated by the preposition door. It is possible to omit the 'do-er' (or agent) of the action without making the sentence ungrammatical. Hanna wordt uitgenodigd. Hanna is invited. If we consider examples 1 and 2, it is obvious that both sentences refer to the same event in which an invitation is issued by Alan to Hanna. The difference lies in the way in which that event is described: in both types of sentence, it is the subject that plays the central role. In the active sentence, this is the agent (the do-er of the action), but in the passive sentence it is the person or thing undergoing the action that plays the central role. In other words: there is a different perspective. Note that the English passive is invited is translated into Dutch wordt uitgenodigd, and not is uitgenodigd. The passive auxiliary for the present tense in Dutch is worden. Is uitgenodigd is a perfect passive tense in Dutch, because zijn is the passive auxiliary for the perfect tense in Dutch. Top of page UseThe passive voice is widely used in Dutch. You'll come across it frequently in more formal text or written reports.
The subject of the active sentence is still present in the passive sentence and indicated by the preposition door (in the example below Zwarte Piet). However, it is also possible to omit the agent:
This is in fact a very significant characteristic of the passive voice, because it provides us with the opportunity to talk about actions where it is either (a) unnecessary to report who the agent is, or where it is (b) obvious, (c) unclear or (d) undesirable to know who the agent is:
In this example it is not necessary to spell out who the people are who light the fireworks: it is more important to describe the activity.
In this example it is not necessary to say who arrested the terrorist as this job is usually carried out by police officers.
Here, the speaker does not know who has stolen the bicycle, and is therefore not able to mention the agent. (d) Note that in all cases (a), (b), (c) and (d), the focus of the sentence is not on the people undertaking the action, but on the recipient of the action. It shows that the passive voice is indeed used when a different perspective is needed. Top of page Formation of the passive: present tenseThe present tense of the passive is formed by combining the past participle of a verb with a special auxiliary: the verb worden. As with the perfect tense, the past participle occurs in penultimate position (see sentence structure).
Have a look at the following active sentence. The subject is underlined, the finite verb is red, and the object is bold:
Top of page Formation of the passive: imperfect tense, future and conditionalJust as with active sentences, passive sentences can be used in a variety of different tenses. As with the present tense of the passive, in the passive voices of the imperfect tense and the future the appropriate tense of the verb worden is used with the past participle.
In other words, with these tenses, the tense of the active sentence is 'translated' into the tense of the auxiliary worden in the passive sentence. As with the present tense of the passive voice, make sure that the form of worden (or zullen in the case of the future passive) matches the subject of the passive sentence in number.
Top of page Formation of the passive: perfect tense and pluperfect tenseDutch uses a completely different verb to form the perfect tense of the passive: de verb zijn. To form the perfect tense of the passive voice, the present tense of the verb zijn is used with the past participle. To form the pluperfect tense of the passive voice, the imperfect tense of the verb zijn is used with the past participle.
Make sure that the form of zijn matches the subject of the passive sentence in number.
Note that the translation of the Dutch passive is gemaakt is has been made in English and not is made. The auxiliary zijn is used only in the perfect and pluperfect tenses of the Dutch passive. Worden is used for the present. So the verb worden does not figure at all in the perfect and pluperfect tenses of the passive voice in Dutch. Top of page Passive with an indefinite subjectTake a look at the following sentence:
In other words, when the subject of a passive sentence is indefinite, existential er is normally added. It will then take the position of the subject (see sentence structure) and the actual subject itself comes later in the sentence. Om twaalf uur wordt het vuurwerk afgestoken. Another example of this type of sentence (passive with indefinite subject) is:
Top of page Pseudo-passivesOne of the main characteristics of the passive voice is that the subject of a passive sentence is the same as the object in the corresponding active sentence. This means that an active sentence without an object (i.e. an active sentence containing an intransitive verb) cannot be made passive:
Nevertheless, a construction that looks very much like the passive can be used in combination with intransitive verbs: Er wordt in romantische films veel gehuild. There is a lot of crying in romantic films.The above sentence is a so-called pseudo-passive. Because the ‘corresponding' active sentence does not contain an object, pseudo-passives do not contain a subject. The agent (doer) is characteristically absent, although not necessarily:
Top of page |