Documentation

Turba_Data_Ldif extends Horde_Data_Base
in package

Horde_Data implementation for LDAP Data Interchange Format (LDIF).

Copyright 2007-2017 Horde LLC (http://www.horde.org/)

See the enclosed file LICENSE for license information (ASL). If you did not receive this file, see http://www.horde.org/licenses/apache.

Tags
author

Rita Selsky ritaselsky@gmail.com

Table of Contents

$_contentType  : mixed
$_extension  : mixed
$_mozillaAttr  : array<string|int, mixed>
Useful Mozilla address book attribute names.
$_turbaAttr  : array<string|int, mixed>
Useful Turba address book attribute names.
$_turbaMozillaMap  : array<string|int, mixed>
Turba address book attribute names and the corresponding Mozilla name.
exportData()  : string
Builds a LDIF file from a given data structure and returns it as a string.
exportFile()  : mixed
Builds a LDIF file from a given data structure and triggers its download.
importData()  : mixed
nextStep()  : mixed
Takes all necessary actions for the given import step, parameters and form values and returns the next necessary step.
_is_safe_string()  : bool
Checks if a string is safe according to RFC 2849, or if it needs to be base64 encoded.

Properties

$_contentType

protected mixed $_contentType = 'text/ldif'

$_extension

protected mixed $_extension = 'ldif'

$_mozillaAttr

Useful Mozilla address book attribute names.

protected array<string|int, mixed> $_mozillaAttr = array('cn', 'givenName', 'sn', 'mail', 'mozillaSecondEmail', 'mozillaNickname', 'homeStreet', 'mozillaHomeStreet2', 'mozillaHomeLocalityName', 'mozillaHomeState', 'mozillaHomePostalCode', 'mozillaHomeCountryName', 'street', 'mozillaWorkStreet2', 'l', 'st', 'postalCode', 'c', 'homePhone', 'telephoneNumber', 'mobile', 'fax', 'title', 'company', 'description', 'mozillaWorkUrl', 'department', 'mozillaNickname')

$_turbaAttr

Useful Turba address book attribute names.

protected array<string|int, mixed> $_turbaAttr = array('name', 'firstname', 'lastname', 'email', 'emails', 'alias', 'homeAddress', 'homeStreet', 'homeCity', 'homeProvince', 'homePostalCode', 'homeCountry', 'workAddress', 'workStreet', 'workCity', 'workProvince', 'workPostalCode', 'workCountry', 'homePhone', 'workPhone', 'cellPhone', 'fax', 'title', 'company', 'notes', 'website', 'department', 'nickname')

$_turbaMozillaMap

Turba address book attribute names and the corresponding Mozilla name.

protected array<string|int, mixed> $_turbaMozillaMap = array('name' => 'cn', 'firstname' => 'givenName', 'lastname' => 'sn', 'emails' => 'mail', 'email' => 'mail', 'workEmail' => 'mozillaSecondEmail', 'alias' => 'mozillaNickname', 'homePhone' => 'homePhone', 'workPhone' => 'telephoneNumber', 'cellPhone' => 'mobile', 'fax' => 'fax', 'title' => 'title', 'company' => 'company', 'notes' => 'description', 'homeAddress' => 'homeStreet', 'homeStreet' => 'mozillaHomeStreet2', 'homeCity' => 'mozillaHomeLocalityName', 'homeProvince' => 'mozillaHomeState', 'homePostalCode' => 'mozillaHomePostalCode', 'homeCountry' => 'mozillaHomeCountryName', 'workAddress' => 'street', 'workStreet' => 'mozillaWorkStreet2', 'workCity' => 'l', 'workProvince' => 'st', 'workPostalCode' => 'postalCode', 'workCountry' => 'c', 'website' => 'mozillaWorkUrl', 'department' => 'department', 'nickname' => 'mozillaNickname')

Methods

exportData()

Builds a LDIF file from a given data structure and returns it as a string.

public exportData(array<string|int, mixed> $data[, bool $header = false ]) : string
Parameters
$data : array<string|int, mixed>

A two-dimensional array containing the data set.

$header : bool = false

If true, the rows of $data are associative arrays with field names as their keys.

Return values
string

The LDIF data.

exportFile()

Builds a LDIF file from a given data structure and triggers its download.

public exportFile(string $filename, array<string|int, mixed> $data[, bool $header = false ]) : mixed

It DOES NOT exit the current script but only outputs the correct headers and data.

Parameters
$filename : string

The name of the file to be downloaded.

$data : array<string|int, mixed>

A two-dimensional array containing the data set.

$header : bool = false

If true, the rows of $data are associative arrays with field names as their keys.

Return values
mixed

importData()

public importData(mixed $contents[, mixed $header = false ]) : mixed
Parameters
$contents : mixed
$header : mixed = false
Return values
mixed

nextStep()

Takes all necessary actions for the given import step, parameters and form values and returns the next necessary step.

public nextStep(int $action[, array<string|int, mixed> $param = array() ]) : mixed
Parameters
$action : int

The current step. One of the IMPORT_* constants.

$param : array<string|int, mixed> = array()

An associative array containing needed parameters for the current step.

Tags
throws
Horde_Data_Exception
Return values
mixed

Either the next step as an integer constant or imported data set after the final step.

_is_safe_string()

Checks if a string is safe according to RFC 2849, or if it needs to be base64 encoded.

protected _is_safe_string(string $str) : bool
Parameters
$str : string

The string to check.

Return values
bool

True if the string is safe.

Search results