From 4e93521f61cc4741ce87208615839bfa83dec9b0 Mon Sep 17 00:00:00 2001 From: Robert Sesek Date: Fri, 18 Aug 2006 00:19:47 +0000 Subject: [PATCH] r1050: Adding a language API --- includes/api_language.php | 120 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 120 insertions(+) create mode 100644 includes/api_language.php diff --git a/includes/api_language.php b/includes/api_language.php new file mode 100644 index 0000000..61612ca --- /dev/null +++ b/includes/api_language.php @@ -0,0 +1,120 @@ +load('api', null); + +require_once('./includes/functions_datastore.php'); + +/** +* API: Language +* +* @author Blue Static +* @copyright Copyright ©2002 - [#]year[#], Blue Static +* @version $Revision$ +* @package Bugdar +* +*/ +class LanguageAPI extends API +{ + /** + * Fields + * @var array + * @access private + */ + var $fields = array( + 'languageid' => array(TYPE_UINT, REQ_AUTO, 'verify_nozero'), + 'title' => array(TYPE_STR, REQ_YES, 'verify_noempty'), + 'direction' => array(TYPE_STR, REQ_NO, ':self'), + 'userselect' => array(TYPE_BOOL, REQ_NO), + 'filename' => array(TYPE_STR, REQ_YES) + ); + + /** + * Table + * @var string + * @access private + */ + var $table = 'language'; + + /** + * Table prefix + * @var string + * @access private + */ + var $prefix = TABLE_PREFIX; + + // ################################################################### + /** + * Post-insert + * + * @access private + */ + function post_insert() + { + build_languages(); + build_language_cache($this->insertid); + } + + // ################################################################### + /** + * Post-update + * + * @access private + */ + function post_update() + { + build_languages(); + } + + // ################################################################### + /** + * Post-delete + * + * @access private + */ + function post_delete() + { + build_languages(); + } + + // ################################################################### + /** + * Verify: direction + * + * @access private + */ + function verify_direction() + { + if (!in_array(array('ltr', 'rtl'), $this->values['direction'])) + { + return _('The direction must be ltr (left-to-right) or rtl (right-to-left)'); + } + return true; + } +} + +/*=====================================================================*\ +|| ################################################################### +|| # $HeadURL$ +|| # $Id$ +|| ################################################################### +\*=====================================================================*/ +?> \ No newline at end of file -- 2.43.5