<?php
/**
* Class file for generic NoteDriver
*
* PHP Version 4
*
* @author <hide@address.com>
* @copyright Copyright (c) 2006, Benedikt Hallinger
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the
* Free Software Foundation, 51 Franklin St, Fifth Floor,
* Boston, MA 02110-1301 USA
*/
/**
* This is a generic NoteDriver, that must be subclassed.
*
* It must be subclassed, so it gets the methods to store/retrieve the events data.
*
* This class provides some standardized method used by the core but you can
* and should use those methods too, especially the config methods.
*
* It is neccessary, that a custom driver is loaded, which extends this class so
* notesdata is really read and stored.
*
* To write your own driver, follow the instructions in the documentation,
* but you just need to subclass this class and make sure it is used
*/
class LCC_NoteDriver extends LCC_Driver
{
/**
* LCC_Core will store a reference of itself here on driver loading
*
* @var LCC_Core
*/
var $lcc_core = null;
/**
* Allowed note public fields
*
* @see LCC_Driver::_allowedFields
* @access private
* @var array
*/
var $_allowedFields = array(
'text' => array(
'regex' => '/^.*$/s',
'mandatory' => true,
'writable' => true,
'html' => false
),
);
/**
* Event fields managed by LCC (metadata)
*
* @see LCC_Driver::_allowedFields
* @access private
* @var array
*/
var $_metaFields = array('author', 'created', 'last_modified', 'last_modified_author', 'event_id');
/**
* Methods the class (and extends) HAS TO provide to be compatible with the core.
*
* @see LCC_Driver::_needed_methods.
* @access private
* @var array
*/
var $_needed_methods = array('getnotes', 'getdata', 'storedata', 'deletenote');
/**
* Postprocessor for reading data
*
* This postprocessor is called from the core after getting the secured
* data. It enables to perform some driver type unique actions.
* Here, we assign some metadata.
*
* @access private
* @param array $data Data as fetched by {@link LCC_Driver::getSecuredData()}
* @param mixed $id ID of the note in question
* @return array Processed data array
*/
function _getDataPostprocessor($data, $id)
{
$data['id'] = htmlentities($id, ENT_QUOTES); // HTML should never be allowed in IDs!
return $data;
}
}
?>