PHP 클래스 Turba_Api, horde

This file defines Turba's external API interface. Other applications can interact with Turba through this API. Copyright 2009-2015 Horde LLC (http://www.horde.org/) See the enclosed file LICENSE for license information (ASL). If you did did not receive this file, see http://www.horde.org/licenses/apache.
저자: Michael Slusarz ([email protected])
상속: extends Horde_Registry_Api
파일 보기 프로젝트 열기: horde/horde

보호된 프로퍼티들

프로퍼티 타입 설명
$_links array Links.
$_noPerms array The listing of API calls that do not require permissions checking.

공개 메소드들

메소드 설명
addAddressbook ( string $name, array $params = [] ) : string Create a new addressbook
addClient ( array $attributes = [] ) : boolean Adds a client to the client source.
addField ( string | array $address = '', string $name = '', string $field = '', string $value = '', string $source = '' ) Sets the value of the specified attribute of a contact
addGroup ( string $name, array $members, array $opts = [] ) : array Adds a group (and its members) to the source provided.
browse ( string $path = '', array $properties = ['name', 'icon', 'browseable'] ) : array Browses through Turba's object tree.
clientFields ( ) : array Returns the available client fields.
commentCallback ( integer $id ) : mixed Callback for comment API.
delete ( string | array $uid, string | array $sources = null ) : boolean Deletes a contact identified by UID.
deleteAddressbook ( string $id ) Delete the specified addressbook.
deleteClient ( string $objectId = '' ) : boolean Deletes a client
deleteField ( string $address = '', string $field = '', array $sources = [] ) Deletes a field value.
export ( string $uid, mixed $contentType, string | array $sources = null, array $fields = null, array $options = [] ) : mixed Export a contact, identified by UID, in the requested contentType.
fields ( string $source = null ) : array Returns a list of fields avaiable in a source.
getActionTimestamp ( string $uid, string $action, string | array $sources = null, boolean $modSeq = false ) : integer Returns the timestamp of an operation for a given UID and action.
getAllAttributeValues ( string $field = '', array $sources = [] ) : array Retrieves a list of all possible values of a field in specified source(s).
getChanges ( integer $start, integer $end, boolean $isModSeq = false, string | array $sources = null ) : array Method for obtaining all server changes between two timestamps.
getChangesByModSeq ( integer $start, integer $end, string | array $sources = null ) : array Return all changes occuring between the specified modification sequences.
getClient ( string $objectId = '' ) : array Returns a contact from the client source.
getClientSource ( ) : string Returns the client source name.
getClients ( array $objectIds = [] ) : array Returns mulitple contacts from the client source.
getContact ( string $source = null, string $objectId = '' ) : array Retrieves a contact.
getContacts ( string $source = '', array $objectIds = [] ) : array Retrieves a set of contacts from a single source.
getDefaultShare ( ) : string Retrieve the UID for the current user's default Turba share.
getField ( string $address = '', string $field = '', array $sources = [], boolean $strict = false, boolean $multiple = false ) : array Returns a field value.
getGalUid ( ) : string | boolean Retrieve the UID for the Global Address List source.
getGroupMembers ( string $gid, boolean $subGroups = false ) : array Returns a list of all members belonging to a contact group.
getGroupMemberships ( string $user, boolean $parentGroups = false ) : array Returns all contact groups that the specified user is a member of.
getGroupObject ( string $gid ) : array Returns a contact group hash.
getGroupObjects ( ) : array Returns all contact groups.
getHighestModSeq ( string $id = null ) : integer Return the largest modification sequence from the history backend.
getOwnContactObject ( ) : array Helper function to return the user's own contact object
getSourcesConfig ( type $filter = [] ) : array Obtain an array of $cfgSource entries matching the filter criteria.
hasComments ( ) : boolean Does this API allow comments?
import ( string $content, string $contentType = 'array', string $source = null, array $options = [] ) : string Import a contact represented in the specified contentType.
listBy ( string $action, integer $timestamp, string | array $sources = null, integer $end = null, boolean $isModSeq = false ) : array Returns an array of UIDs for contacts that have had a given action since a certain time.
listShares ( integer $perms = Horde_Perms::READ ) : array Lists all shares the current user has access to.
listTagInfo ( array $tags = null, $user = null ) : array Retrieve the list of used tag_names, tag_ids and the total number of resources that are linked to that tag.
listTimeObjectCategories ( ) : array Retrieves a list of available time objects categories.
listTimeObjects ( array $time_categories, mixed $start, mixed $end ) : array Lists birthdays and/or anniversaries as time objects.
listUids ( string | array $sources = null ) : array Returns an array of UIDs for all contacts that the current user is authorized to see.
listUserGroupObjects ( ) : array GroupObject API - Lists all turba lists for the current user that can be treated as Horde_Group objects.
ownContact ( ) : array Export the user's own contact as a hash.
ownVCard ( ) : string Exports the user's own contact as a vCard string.
path_delete ( string $path ) : string Deletes a file from the Turba tree.
replace ( string $uid, mixed $content, string $contentType, string | array $sources = null ) : boolean Replaces the contact identified by UID with the content represented in the specified contentType.
search ( mixed $names = null, array $opts = [] ) : mixed Returns a contact search result.
searchClients ( array $names = [], array $fields = [], boolean $matchBegin = false ) : array Search for clients.
searchTags ( array $names, integer $max = 10, integer $from, string $resource_type = '', string $user = null, boolean $raw = false ) : array SearchTags API: Returns an application-agnostic array (useful for when doing a tag search across multiple applications)
sources ( boolean $writeable = false, boolean $sync_only = false ) : array Returns a list of available sources.
updateAddressbook ( string $id, array $info ) Update an existing addressbook's name or description.
updateClient ( string $objectId = '', array $attributes = [] ) : boolean Updates client data.

보호된 메소드들

메소드 설명
_encodeContent ( $content )
_getContactImageUrl ( $obj )
_getGroupObject ( $source, $key )
_getSource ( $source )
_getSources ( $sources, $synchronize = false, $end = false )
_modified ( $uid, $sources )

메소드 상세

_encodeContent() 보호된 메소드

protected _encodeContent ( $content )

_getContactImageUrl() 보호된 메소드

protected _getContactImageUrl ( $obj )

_getGroupObject() 보호된 메소드

protected _getGroupObject ( $source, $key )

_getSource() 보호된 메소드

protected _getSource ( $source )

_getSources() 보호된 메소드

protected _getSources ( $sources, $synchronize = false, $end = false )

_modified() 보호된 메소드

protected _modified ( $uid, $sources )

addAddressbook() 공개 메소드

Create a new addressbook
부터: 4.2.0
public addAddressbook ( string $name, array $params = [] ) : string
$name string The display name for the addressbook.
$params array Any addtional parameters needed. - synchronize: (boolean) If true, add address book to the list of address books to syncronize. DEFAULT: false (do not add to the list). @since 4.2.1
리턴 string The new addressbook's id (share name).

addClient() 공개 메소드

Adds a client to the client source.
public addClient ( array $attributes = [] ) : boolean
$attributes array Array containing the client attributes.
리턴 boolean

addField() 공개 메소드

Sets the value of the specified attribute of a contact
public addField ( string | array $address = '', string $name = '', string $field = '', string $value = '', string $source = '' )
$address string | array Contact email address(es).
$name string Contact name.
$field string Field to update.
$value string Field value to set.
$source string Contact source.

addGroup() 공개 메소드

Adds a group (and its members) to the source provided.
public addGroup ( string $name, array $members, array $opts = [] ) : array
$name string Group name.
$members array An array of members to add to the group. Format is the same as the 'array' argument to the import() API function.
$opts array Additional options:
  - attr: (array) Additional attributes to add to group.
  - source: (string) Source to import contacts to.
리턴 array An array with the following keys:
  - added: (integer) The number of addresses added to the group.
  - uid: (string) The uid of the group object.

browse() 공개 메소드

Browses through Turba's object tree.
public browse ( string $path = '', array $properties = ['name', 'icon', 'browseable'] ) : array
$path string The path of the tree to browse.
$properties array The item properties to return. Defaults to 'name', 'icon', and 'browseable'.
리턴 array Content of the specified path.

clientFields() 공개 메소드

Returns the available client fields.
public clientFields ( ) : array
리턴 array An array describing the fields.

commentCallback() 공개 메소드

Callback for comment API.
public commentCallback ( integer $id ) : mixed
$id integer Internal data identifier.
리턴 mixed Name of object on success, false on failure.

delete() 공개 메소드

Deletes a contact identified by UID.
public delete ( string | array $uid, string | array $sources = null ) : boolean
$uid string | array Identify the contact to delete, either a single UID or an array.
$sources string | array The source(s) from which the contact will be deleted.
리턴 boolean Success or failure.

deleteAddressbook() 공개 메소드

Delete the specified addressbook.
부터: 4.2.0
public deleteAddressbook ( string $id )
$id string The addressbook id.

deleteClient() 공개 메소드

Deletes a client
public deleteClient ( string $objectId = '' ) : boolean
$objectId string The unique id of the client
리턴 boolean

deleteField() 공개 메소드

Deletes a field value.
public deleteField ( string $address = '', string $field = '', array $sources = [] )
$address string Contact email address.
$field string Field to delete value for.
$sources array Sources to delete value from.

export() 공개 메소드

Export a contact, identified by UID, in the requested contentType.
public export ( string $uid, mixed $contentType, string | array $sources = null, array $fields = null, array $options = [] ) : mixed
$uid string Identify the contact to export.
$contentType mixed What format should the data be in? - text/directory: Returns RFC2426 vcard3.0 - text/vcard: Returns RFC2426 vcard3.0 - text/x-vcard: Returns imc.org vcard 2.1 format. - array: Returns a raw array - activesync: Returns a Horde_ActiveSync_Message_Contact:: object
$sources string | array The source(s) from which the contact will be exported.
$fields array Hash of field names and Horde_SyncMl_Property properties with the requested fields.
$options array Any additional options to be passed to the exporter. Currently supported: - skip_empty: (boolean) {text/vcard or text/x-vcard} Set to true to not output empty properties. DEFAULT: false. - protocolversion: (float) {activesync} The EAS version to support DEFAULT: 2.5 - bodyprefs: (array) {activesync} A BODYPREFERENCE array. DEFAULT: none (No body prefs enforced). - truncation: (integer) {activesync} Truncate event body to this length. DEFAULT: none (No truncation).
리턴 mixed The requested data.

fields() 공개 메소드

Returns a list of fields avaiable in a source.
public fields ( string $source = null ) : array
$source string The source name.
리턴 array An array describing the fields. Keys are the field name, values are arrays with these keys: - name: (string) Field name. - label: (string) Field label. - search: (boolean) Can this field be searched? - type: (string) See turba/config/attributes.php.

getActionTimestamp() 공개 메소드

Returns the timestamp of an operation for a given UID and action.
public getActionTimestamp ( string $uid, string $action, string | array $sources = null, boolean $modSeq = false ) : integer
$uid string The UID to look for.
$action string The action to check for - add, modify, or delete.
$sources string | array The source(s) for which to retrieve the history.
$modSeq boolean Request a modification sequence instead of timestamp. @since 4.1.1
리턴 integer The timestamp for this action.

getAllAttributeValues() 공개 메소드

Retrieves a list of all possible values of a field in specified source(s).
public getAllAttributeValues ( string $field = '', array $sources = [] ) : array
$field string Field name to check.
$sources array Array containing the sources to look in.
리턴 array An array of fields and possible values.

getChanges() 공개 메소드

Essentially a wrapper around listBy(), but returns an array containing all adds, edits, and deletions.
public getChanges ( integer $start, integer $end, boolean $isModSeq = false, string | array $sources = null ) : array
$start integer The starting timestamp
$end integer The ending timestamp.
$isModSeq boolean If true, $start and $end are modification sequences and not timestamps. @since 4.1.1
$sources string | array The sources to check. @since 4.2.0
리턴 array A hash with 'add', 'modify' and 'delete' arrays.

getChangesByModSeq() 공개 메소드

Return all changes occuring between the specified modification sequences.
부터: 4.1.1
public getChangesByModSeq ( integer $start, integer $end, string | array $sources = null ) : array
$start integer The starting modseq.
$end integer The ending modseq.
$sources string | array The sources to check. @since 4.2.0
리턴 array The changes @see getChanges()

getClient() 공개 메소드

Returns a contact from the client source.
public getClient ( string $objectId = '' ) : array
$objectId string Client unique ID.
리턴 array Array of client data.

getClientSource() 공개 메소드

Returns the client source name.
public getClientSource ( ) : string
리턴 string The name of the source to use with the clients api.

getClients() 공개 메소드

Returns mulitple contacts from the client source.
public getClients ( array $objectIds = [] ) : array
$objectIds array client unique ids.
리턴 array An array of clients data.

getContact() 공개 메소드

Retrieves a contact.
public getContact ( string $source = null, string $objectId = '' ) : array
$source string The source name where the contact is stored
$objectId string The unique id of the contact to retrieve
리턴 array The retrieved contact.

getContacts() 공개 메소드

Retrieves a set of contacts from a single source.
public getContacts ( string $source = '', array $objectIds = [] ) : array
$source string The source name where the contact is stored
$objectIds array The unique ids of the contact to retrieve.
리턴 array The retrieved contact.

getDefaultShare() 공개 메소드

Retrieve the UID for the current user's default Turba share.
public getDefaultShare ( ) : string
리턴 string UID.

getField() 공개 메소드

Returns a field value.
public getField ( string $address = '', string $field = '', array $sources = [], boolean $strict = false, boolean $multiple = false ) : array
$address string Contact email address.
$field string Field to get.
$sources array Sources to check.
$strict boolean Match the email address strictly.
$multiple boolean Return more than one entry if found and true, return an error if this is false.
리턴 array An array of field value(s).

getGalUid() 공개 메소드

Retrieve the UID for the Global Address List source.
public getGalUid ( ) : string | boolean
리턴 string | boolean The UID or false if none configured.

getGroupMembers() 공개 메소드

Returns a list of all members belonging to a contact group.
public getGroupMembers ( string $gid, boolean $subGroups = false ) : array
$gid string The group identifier
$subGroups boolean Also include members of any subgroups?
리턴 array An array of group members (identified by email address).

getGroupMemberships() 공개 메소드

Returns all contact groups that the specified user is a member of.
public getGroupMemberships ( string $user, boolean $parentGroups = false ) : array
$user string The user.
$parentGroups boolean Include user as a member of the any parent group as well.
리턴 array An array of group identifiers that the specified user is a member of.

getGroupObject() 공개 메소드

Returns a contact group hash.
public getGroupObject ( string $gid ) : array
$gid string The group identifier.
리턴 array A hash defining the group.

getGroupObjects() 공개 메소드

Returns all contact groups.
public getGroupObjects ( ) : array
리턴 array A list of group hashes.

getHighestModSeq() 공개 메소드

Return the largest modification sequence from the history backend.
부터: 4.1.1
public getHighestModSeq ( string $id = null ) : integer
$id string Addressbook id to return highest MODSEQ for. If null, the highest MODSEQ across all addressbooks is returned. @since 4.2.0
리턴 integer The modseq.

getOwnContactObject() 공개 메소드

Helper function to return the user's own contact object
public getOwnContactObject ( ) : array
리턴 array An array containing the following keys: - contact: (Turba_Object) Object representing the user's own contact. - source: (string) The source of the user's own contact.

getSourcesConfig() 공개 메소드

Obtain an array of $cfgSource entries matching the filter criteria.
public getSourcesConfig ( type $filter = [] ) : array
$filter type A single key -> value hash to filter the sources.
리턴 array

hasComments() 공개 메소드

Does this API allow comments?
public hasComments ( ) : boolean
리턴 boolean True if API allows comments.

import() 공개 메소드

Import a contact represented in the specified contentType.
public import ( string $content, string $contentType = 'array', string $source = null, array $options = [] ) : string
$content string The content of the contact.
$contentType string What format is the data in? Currently supports array, text/directory, text/vcard, text/x-vcard, and activesync.
$source string The source into which the contact will be imported.
$options array Additional options: - match_on_email: (boolean) If true, will detect entry as duplicate if ANY email field matches. Useful for automatically adding contacts from an email application, such as IMP. @since 4.2.9
리턴 string The new UID.

listBy() 공개 메소드

Returns an array of UIDs for contacts that have had a given action since a certain time.
public listBy ( string $action, integer $timestamp, string | array $sources = null, integer $end = null, boolean $isModSeq = false ) : array
$action string The action to check for - add, modify, or delete.
$timestamp integer The time to start the search.
$sources string | array The source(s) for which to retrieve the history.
$end integer The optional ending timestamp.
$isModSeq boolean If true, $timestamp and $end are modification sequences and not timestamps. @since 4.1.1
리턴 array An array of UIDs matching the action and time criteria.

listShares() 공개 메소드

Lists all shares the current user has access to.
public listShares ( integer $perms = Horde_Perms::READ ) : array
$perms integer
리턴 array of Turba_Share objects.

listTagInfo() 공개 메소드

Retrieve the list of used tag_names, tag_ids and the total number of resources that are linked to that tag.
public listTagInfo ( array $tags = null, $user = null ) : array
$tags array An optional array of tag_ids. If omitted, all tags will be included.
리턴 array An array containing tag_name, and total

listTimeObjectCategories() 공개 메소드

Retrieves a list of available time objects categories.
public listTimeObjectCategories ( ) : array
리턴 array An array of all configured time object categories.

listTimeObjects() 공개 메소드

Lists birthdays and/or anniversaries as time objects.
public listTimeObjects ( array $time_categories, mixed $start, mixed $end ) : array
$time_categories array The time categories (from listTimeObjectCategories) to list.
$start mixed The start date of the period.
$end mixed The end date of the period.
리턴 array An array of timeObject results.

listUids() 공개 메소드

Returns an array of UIDs for all contacts that the current user is authorized to see.
public listUids ( string | array $sources = null ) : array
$sources string | array The name(s) of the source(s) to return contacts of. If empty, the current user's sync sources or default source are used.
리턴 array An array of UIDs for all contacts the user can access.

listUserGroupObjects() 공개 메소드

GroupObject API - Lists all turba lists for the current user that can be treated as Horde_Group objects.
public listUserGroupObjects ( ) : array
리턴 array A hash of all visible groups in the form of group_id => group_name

ownContact() 공개 메소드

Export the user's own contact as a hash.
public ownContact ( ) : array
리턴 array The contact hash.

ownVCard() 공개 메소드

Exports the user's own contact as a vCard string.
public ownVCard ( ) : string
리턴 string The requested vCard data.

path_delete() 공개 메소드

Deletes a file from the Turba tree.
public path_delete ( string $path ) : string
$path string The path to the file.
리턴 string The event's UID.

replace() 공개 메소드

Replaces the contact identified by UID with the content represented in the specified contentType.
public replace ( string $uid, mixed $content, string $contentType, string | array $sources = null ) : boolean
$uid string Idenfity the contact to replace.
$content mixed The content of the contact.
$contentType string What format is the data in? Currently supports array, text/directory, text/vcard, text/x-vcard and activesync.
$sources string | array The source(s) where the contact will be replaced.
리턴 boolean Success or failure.

searchClients() 공개 메소드

Search for clients.
public searchClients ( array $names = [], array $fields = [], boolean $matchBegin = false ) : array
$names array The search filter values.
$fields array The fields to search in.
$matchBegin boolean Match word boundaries only.
리턴 array A hash containing the search results.

searchTags() 공개 메소드

The 'raw' results array can be returned instead by setting $raw = true.
public searchTags ( array $names, integer $max = 10, integer $from, string $resource_type = '', string $user = null, boolean $raw = false ) : array
$names array An array of tag_names to search for.
$max integer The maximum number of resources to return.
$from integer The number of the resource to start with.
$resource_type string The resource type [bookmark, '']
$user string Restrict results to resources owned by $user.
$raw boolean Return the raw data?
리턴 array An array of results:
 'title'    - The title for this resource.
 'desc'     - A terse description of this resource.
 'view_url' - The URL to view this resource.
 'app'      - The Horde application this resource belongs to.
 'icon'     - URL to an image.

sources() 공개 메소드

Returns a list of available sources.
public sources ( boolean $writeable = false, boolean $sync_only = false ) : array
$writeable boolean If true, limits to writeable sources.
$sync_only boolean Only include synchable address books.
리턴 array An array of the available sources. Keys are source IDs, values are source titles.

updateAddressbook() 공개 메소드

Update an existing addressbook's name or description.
부터: 4.2.0
public updateAddressbook ( string $id, array $info )
$id string The addressbook id.
$info array The info to change: - name: The addressbook's display name. - desc: The addressbook's description.

updateClient() 공개 메소드

Updates client data.
public updateClient ( string $objectId = '', array $attributes = [] ) : boolean
$objectId string The unique id of the client.
$attributes array An array of client attributes.
리턴 boolean

프로퍼티 상세

$_noPerms 보호되어 있는 프로퍼티

The listing of API calls that do not require permissions checking.
protected array $_noPerms
리턴 array