PHP Class Mnemo_Api, horde

This file defines Mnemo's external API interface. Other applications can interact with Mnemo through this API. Copyright 2001-2014 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.
Inheritance: extends Horde_Registry_Api
Datei anzeigen Open project: horde/horde

Protected Properties

Property Type Description
$_links array Links.

Public Methods

Method Description
addNotepad ( string $name, array $params = [] ) : string Create a new notepad.
browse ( string $path = '', array $properties = [] ) : array Browse through Mnemo's object tree.
delete ( string | array $uid ) Delete a memo identified by UID.
deleteNotepad ( string $id ) Delete notepad.
export ( string $uid, string $contentType, array $options = [] ) : mixed Export a memo, identified by UID, in the requested contentType.
getActionTimestamp ( string $uid, string $action, string $notepad = null, boolean $modSeq = false ) : integer Returns the timestamp of an operation for a given uid an action.
getChanges ( integer $start, integer $end, boolean $isModSeq = false, string $notepad = null ) : array Method for obtaining all server changes between two timestamps. Basically a wrapper around listBy(), but returns an array containing all adds, edits and deletions.
getChangesByModSeq ( integer $start, integer $end, string $notepad = null ) : array Return all changes occuring between the specified modification sequences.
getDefaultShare ( ) : string Retrieve the UID for the current user's default notepad.
getHighestModSeq ( string $id = null ) : integer Return the largest modification sequence from the history backend.
import ( string $content, string $contentType, string $notepad = null ) : string Import a memo represented in the specified contentType.
listBy ( string $action, integer $timestamp, string $notepad = null, integer $end = null, boolean $isModSeq = false ) : array Returns an array of UIDs for notes that have had $action happen since $timestamp.
listNotepads ( boolean $owneronly, integer $permission ) : array
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.
listUids ( array | string $notepads = null ) : array Returns an array of UIDs for all notes that the current user is authorized to see.
path_delete ( string $path ) : string Deletes a file from the Mnemo tree.
put ( string $path, string $content, string $content_type ) : array Saves a file into the Mnemo tree.
removeUserData ( string $user ) Removes user data.
replace ( string $uid, string $content, string $contentType ) Replace the memo identified by UID with the content represented in the specified contentType.
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.
updateNotepad ( string $id, array $info ) Update a notepad's title and/or description.

Protected Methods

Method Description
_modified ( array $memo ) : integer Returns the last modification timestamp of a note.

Method Details

_modified() protected method

Returns the last modification timestamp of a note.
protected _modified ( array $memo ) : integer
$memo array The note to look in.
return integer The timestamp for the last modification.

addNotepad() public method

Create a new notepad.
Since: 4.2.0
public addNotepad ( string $name, array $params = [] ) : string
$name string The notepad display name.
$params array Any additional parameters needed. - synchronize: (boolean) If true, add notepad to the list of notepads to syncronize. DEFAULT: false (do not add to the list). @since 4.2.1
return string The new notepad's id.

browse() public method

Browse through Mnemo's object tree.
public browse ( string $path = '', array $properties = [] ) : array
$path string The level of the tree to browse.
$properties array The item properties to return. Defaults to 'name', 'icon', and 'browseable'.
return array The contents of $path

delete() public method

Delete a memo identified by UID.
public delete ( string | array $uid )
$uid string | array

deleteNotepad() public method

Delete notepad.
Since: 4.2.0
public deleteNotepad ( string $id )
$id string The notepad id.

export() public method

Export a memo, identified by UID, in the requested contentType.
public export ( string $uid, string $contentType, array $options = [] ) : mixed
$uid string Identify the memo to export.
$contentType string What format should the data be in? A string with one of:
  'text/plain'
  'text/x-vnote'
  'activesync'
$options array Any additional options to be passed to the exporter.
return mixed The requested data

getActionTimestamp() public method

Returns the timestamp of an operation for a given uid an action.
public getActionTimestamp ( string $uid, string $action, string $notepad = null, boolean $modSeq = false ) : integer
$uid string The uid to look for.
$action string The action to check for - add, modify, or delete.
$notepad string The notepad to search in.
$modSeq boolean Request a modification sequence instead of a timestamp. @since 4.1.1
return integer The timestamp or modseq for this action.

getChanges() public method

Method for obtaining all server changes between two timestamps. Basically a wrapper around listBy(), but returns an array containing all adds, edits and deletions.
public getChanges ( integer $start, integer $end, boolean $isModSeq = false, string $notepad = null ) : array
$start integer The starting timestamp
$end integer The ending timestamp.
$isModSeq boolean If true, $timestamp and $end are modification sequences and not timestamps. @since 4.1.1
$notepad string The source to check. @since 4.2.0
return array An hash with 'add', 'modify' and 'delete' arrays.

getChangesByModSeq() public method

Return all changes occuring between the specified modification sequences.
Since: 4.1.1
public getChangesByModSeq ( integer $start, integer $end, string $notepad = null ) : array
$start integer The starting modseq.
$end integer The ending modseq.
$notepad string The source to check. @since 4.2.0
return array The changes @see getChanges()

getDefaultShare() public method

Retrieve the UID for the current user's default notepad.
Since: 4.2.0
public getDefaultShare ( ) : string
return string UID.

getHighestModSeq() public method

Return the largest modification sequence from the history backend.
Since: 4.1.1
public getHighestModSeq ( string $id = null ) : integer
$id string The notepad id to get the MODSEQ for. If null, the highest MODSEQ across all notepads is returned. @since 4.2.0
return integer The modseq.

import() public method

Import a memo represented in the specified contentType.
public import ( string $content, string $contentType, string $notepad = null ) : string
$content string The content of the memo.
$contentType string What format is the data in? Currently supports: text/plain text/x-vnote activesync
$notepad string (optional) The notepad to save the memo on.
return string The new UID, or false on failure.

listBy() public method

Returns an array of UIDs for notes that have had $action happen since $timestamp.
public listBy ( string $action, integer $timestamp, string $notepad = 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.
$notepad string The notepad to search in.
$end integer The optional ending timestamp.
$isModSeq boolean If true, $timestamp and $end are modification sequences and not timestamps. @since 4.1.1
return array An array of UIDs matching the action and time criteria.

listNotepads() public method

public listNotepads ( boolean $owneronly, integer $permission ) : array
$owneronly boolean Only return notepads that this user owns? Defaults to false.
$permission integer The permission to filter notepads by.
return array The notepads.

listTagInfo() public method

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.
return array An array containing tag_name, and total

listUids() public method

Returns an array of UIDs for all notes that the current user is authorized to see.
public listUids ( array | string $notepads = null ) : array
$notepads array | string The notepad(s) to list notes from.
return array An array of UIDs for all notes the user can access.

path_delete() public method

Deletes a file from the Mnemo tree.
public path_delete ( string $path ) : string
$path string The path to the file.
return string The note's UID

put() public method

Saves a file into the Mnemo tree.
public put ( string $path, string $content, string $content_type ) : array
$path string The path where to PUT the file.
$content string The file content.
$content_type string The file's content type.
return array The note UIDs

removeUserData() public method

Removes user data.
Deprecation: Use Horde's removeUserData API call instead.
public removeUserData ( string $user )
$user string Name of user to remove data for.

replace() public method

Replace the memo identified by UID with the content represented in the specified contentType.
public replace ( string $uid, string $content, string $contentType )
$uid string Idenfity the memo to replace.
$content string The content of the memo.
$contentType string What format is the data in? Currently supports: text/plain text/x-vnote activesync

searchTags() public method

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?
return 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() public method

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

updateNotepad() public method

Update a notepad's title and/or description.
Since: 4.2.0
public updateNotepad ( string $id, array $info )
$id string The notepad id
$info array The data to change: - name: The display name. - desc: The description.

Property Details