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; } ?>
|
|---|
Constituents - ZinsdelenObject - VoorwerpThere are three types of object: direct object, indirect object and prepositional object.
Direct object - lijdend voorwerp Every declarative and interrogative clause contains a >subject and a >predicate. The subject fulfils the role of the main actor in a clause. Often, but not necessarily, a sentence also contains a direct object. The direct object is a second 'player' or ‘actor' and is the person or thing undergoing the action. Look at the examples below:
In the first sentence we have Jeltje as subject and studeert as predicate. There is no (direct) object in this sentence. In the second sentenceJeltje is still the subject, and studeert is still the predicate. But in this second sentence we are also told what Jeltje is studying: Nederlands. Nederlands is the direct object. The direct object is affected by the action of the verb. You can find the direct object by asking the question: 'What does [subject] [verb]?' In the case of the example, you can ask the question ‘What does Jeltje study?'. The answer is ‘Dutch'. In the example above the direct object is a >>noun. A direct object can also be a noun group rather than a single noun:
In the example above you can ask: 'What is the school going to put on the board?'. The answer, 'the names of bullies', is the direct object. De namen van pesters is a noun group. >>Personal pronouns also have direct object forms, for example haar in the sentence below:
Direct object pronouns are:
Indirect object - meewerkend voorwerp A clause normally contains a >subject and a >predicate, and often also a direct object. The subject fulfils the role of the main actor in a clause. The direct object is a second ‘player' or ‘actor' and is the person or thing undergoing the action. In some sentences you might find a a third 'actor'. Look at the examples below:
In the first sentence we have Sara as subject, geeft as the predicate, and een boek as the direct object. In the second sentence the recipient of the action has appeared:Kamil. This recipient is referred to as the indirect object. You can find the indirect object by asking the question: ‘To whom……?' In the case of the example you can ask the question: ‘To whom does Sara give the book?'. The answer is ‘Kamil'. In the example above the indirect object is a >>noun. An indirect object can also be a noun group rather than a single noun:
>>Personal pronouns also have indirect object forms, for example hem in the sentence below:
Indirect object pronouns are the same as direct object pronouns, except in the 3rd person plural where the stressed form is hun. Click >here if you want to know more about the order of direct object and indirect object. Prepositional object - voorzetselvoorwerp Whenever a direct or indirect object is accompanied by a >>preposition, it is called a prepositional object. This is the case when the main verb and the preposition form a fixed phrase such as kijken naar, meebrengen voor, houden van, praten met. Such verbs are called >>phrasal verbs. Semantically, a prepositional object can be interpreted as either a direct object or an indirect object. Look at the following sentences:
In the first example the prepositional object is naar het nieuws (preposition naar) and the prepositional object can be considered a direct object: ' What do we watch at 8 o'clock?' In the second example voor je is the prepositional object. It can be seen as an indirect object: 'For whom did I bring the wine?' Note, however, that the phrase om acht uur is not a prepositional object but an adjunct of time. There is a test for this: if a phrase with a preposition can be left out without making the sentence ungrammatical, it is an adverbial adjunct. If it cannot be left out, it is a prepositional object:
The first sentence is grammatical; the second sentence is not: it needs a prepositional object. The prepositional object may be a >>pronominal adverb, which is an >>adverb of place with the function of a >>pronoun. This can be illustrated by means of two verbs with the same meaning, one of which a >>transitive verb, the other a phrasal verb, e.g. bespreken ('discuss') and praten over ('talk about', i.e. 'discuss'). Consider the following comment that could be made in a popular radio phone-in programme:
The first example contains the verb bespreken and the demonstrative pronoun dat to refer back to het probleem van de werkloosheid. The second example contains the phrasal ver praten over and the demonstrative pronominal adverb daarover to refer back to het probleem van de werkloosheid. Click >here if you want to know more about a special prepositional object in passive sentences. Back to home.
|