Net_LDAP2 |
[ class tree: Net_LDAP2 ] [ index: Net_LDAP2 ] [ all elements ] |
Packages: Net_LDAP2 Classes:
Net_LDAP2
Files:Net_LDAP2_Entry Net_LDAP2_Error Net_LDAP2_Filter Net_LDAP2_LDIF Net_LDAP2_RootDSE Net_LDAP2_Schema Net_LDAP2_Search Net_LDAP2_Util
add_entry.php
connecting.php Entry.php fetch_entry.php Filter.php LDAP2.php LDIF.php modify_entry.php modify_entry2.php RootDSE.php Schema.php SchemaCache.interface.php schema_cache.php Search.php search_entries.php SimpleFileSchemaCache.php Util.php |
[ Top ] $_FH = null[line 100] Filehandle for read/write
[ Top ] $_FH_opened = false[line 108] Says, if we opened the filehandle ourselves
[ Top ] $_input_line = 0[line 116] Linecounter for input file handle
[ Top ] $_lines_cur = array()[line 150] Cache for lines that have build the current entry
[ Top ] $_lines_next = array()[line 158] Cache for lines that will build the next entry
[ Top ] $_mode = false[line 134] Mode we are working inEither 'r', 'a' or 'w'
[ Top ] $_options = array('encode' => 'base64',
|
Type: | array |
[line 142]
Tells, if the LDIF version string was already writtenType: | boolean |
|
new (FILE): Open the file read-only. FILE may be the name of a file or an already open filehandle. If the file doesn't exist, it will be created if in write mode.
new (FILE, MODE, OPTIONS): Open the file with the given MODE (see PHPs fopen()), eg "w" or "a". FILE may be the name of a file or an already open filehandle. PERLs Net_LDAP2 "FILE|" mode does not work curently.
OPTIONS is an associative array and may contain: encode => 'none' | 'canonical' | 'base64' Some DN values in LDIF cannot be written verbatim and have to be encoded in some way: 'none' No encoding. 'canonical' See "canonical_dn()" in Net::LDAP::Util. 'base64' Use base64. (default, this differs from the Perl interface. The perl default is "none"!)
onerror => 'die' | 'warn' | NULL Specify what happens when an error is detected. 'die' Net_LDAP2_LDIF will croak with an appropriate message. 'warn' Net_LDAP2_LDIF will warn (echo) with an appropriate message. NULL Net_LDAP2_LDIF will not warn (default), use error().
change => 1 Write entry changes to the LDIF file instead of the entries itself. I.e. write LDAP operations acting on the entries to the file instead of the entries contents. This writes the changes usually carried out by an update() to the LDIF file.
lowercase => 1 Convert attribute names to lowercase when writing.
sort => 1 Sort attribute names when writing entries according to the rule: objectclass first then all other attributes alphabetically sorted by attribute name
version => '1' Set the LDIF version to write to the resulting LDIF file. According to RFC 2849 currently the only legal value for this option is 1. When this option is set Net_LDAP2_LDIF tries to adhere more strictly to the LDIF specification in RFC2489 in a few places. The default is NULL meaning no version information is written to the LDIF file.
wrap => 78 Number of columns where output line wrapping shall occur. Default is 78. Setting it to 40 or lower inhibits wrapping.
raw => REGEX Use REGEX to denote the names of attributes that are to be considered binary in search results if writing entries. Example: raw => "/(?i:^jpegPhoto|;binary)/i"
string|ressource | $file | — | Filename or filehandle |
string | $mode | — | Mode to open filename |
array | $options | — | Options like described above |
|
It honors correct encoding of values according to RFC 2849. Line wrapping will occur at the configured maximum but only if the value is greater than 40 chars.
string | $attr_name | — | Name of the attribute |
string | $attr_value | — | Value of the attribute |
|
It honors correct encoding of values according to RFC 2849.
string | $dn | — | UTF8-Encoded DN |
|
|
Note that this returns an empty array if no lines have been read so far.
|
This method signals that the LDIF object is no longer needed. You can use this to free up some memory and close the file handle. The file handle is only closed, if it was opened from Net_LDAP2_LDIF.
|
string | $msg | — | Errortext |
int | $line | — | Line in the LDIF that caused the error |
|
Example:
boolean | $as_string | — | If set to true, only the message is returned |
|
Perl returns an array of faulty lines in list context, but we always just return an int because of PHPs language.
|
You can, for example, use this to fetch the content of the LDIF file yourself
|
If you set $force to TRUE then you can iterate over the lines that build up entries manually. Otherwise, iterating is done using read_entry(). Force will move the file pointer forward, thus returning the next entries lines.
Wrapped lines will be unwrapped. Comments are stripped.
boolean | $force | — | Set this to true if you want to iterate over the lines manually |
|
array | $lines | — | LDIF lines for one entry |
|
|
If called without arguments it returns the version of the LDIF file or NULL if no version has been set. If called with an argument it sets the LDIF version to VERSION. According to RFC 2849 currently the only legal value for VERSION is 1.
int | $version | — | (optional) LDIF version to set |
|
string | $attr_name | — | Name of the attribute |
string|array | $attr_values | — | Single attribute value or array with attribute values |
|
string | $dn | — | DN to write |
|
string | $line | — | Content to write |
string | $error | — | If error occurs, drop this message |
|
If you want to build an LDIF file containing several entries AND you want to call write_entry() several times, you must open the filehandle in append mode ("a"), otherwise you will always get the last entry only.
Net_LDAP2_Entry|array | $entries | — | Entry or array of entries |
|
If the object's version is defined, this method allows to explicitely write the version before an entry is written. If not called explicitely, it gets called automatically when writing the first entry.