Subversion-Projekte lars-tiefland.php_share

Revision

Details | Letzte Änderung | Log anzeigen | RSS feed

Revision Autor Zeilennr. Zeile
1 lars 1
<?php
2
/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
3
 
4
/**
5
 * Contains the Translation2_Admin_Decorator class
6
 *
7
 * PHP versions 4 and 5
8
 *
9
 * LICENSE: Redistribution and use in source and binary forms, with or without
10
 * modification, are permitted provided that the following conditions are met:
11
 * 1. Redistributions of source code must retain the above copyright
12
 *    notice, this list of conditions and the following disclaimer.
13
 * 2. Redistributions in binary form must reproduce the above copyright
14
 *    notice, this list of conditions and the following disclaimer in the
15
 *    documentation and/or other materials provided with the distribution.
16
 * 3. The name of the author may not be used to endorse or promote products
17
 *    derived from this software without specific prior written permission.
18
 *
19
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR IMPLIED
20
 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
21
 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
22
 * IN NO EVENT SHALL THE FREEBSD PROJECT OR CONTRIBUTORS BE LIABLE FOR ANY
23
 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
24
 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
25
 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
26
 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
28
 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29
 *
30
 * @category  Internationalization
31
 * @package   Translation2
32
 * @author    Lorenzo Alberton <l.alberton@quipo.it>
33
 * @copyright 2004-2007 Lorenzo Alberton
34
 * @license   http://www.debian.org/misc/bsd.license  BSD License (3 Clause)
35
 * @version   CVS: $Id: Decorator.php 305985 2010-12-05 22:55:33Z clockwerx $
36
 * @link      http://pear.php.net/package/Translation2
37
 */
38
 
39
/**
40
 * Load Translation2_Decorator class
41
 */
42
require_once 'Translation2/Decorator.php';
43
 
44
/**
45
 * Decorates a Translation2_Admin class.
46
 *
47
 * Create a subclass of this class for your own "decoration".
48
 *
49
 * @category  Internationalization
50
 * @package   Translation2
51
 * @author    Lorenzo Alberton <l.alberton@quipo.it>
52
 * @copyright 2004-2007 Lorenzo Alberton
53
 * @license   http://www.debian.org/misc/bsd.license  BSD License (3 Clause)
54
 * @link      http://pear.php.net/package/Translation2
55
 * @abstract
56
 * @todo      Don't allow stacking on top of regular Decorators,
57
 *            since that will break things.
58
 */
59
class Translation2_Admin_Decorator extends Translation2_Decorator
60
{
61
    // {{{ addLang()
62
 
63
    /**
64
     * Prepare the storage container for a new lang.
65
     * If the langsAvail table doesn't exist yet, it is created.
66
     *
67
     * @param array $langData array('lang_id'    => 'en',
68
     *                              'table_name' => 'i18n',
69
     *                              'name'       => 'english',
70
     *                              'meta'       => 'some meta info',
71
     *                              'error_text' => 'not available');
72
     * @param array $options  array('charset'   => 'utf8',
73
     *                              'collation' => 'utf8_general_ci');
74
     *
75
     * @return mixed true on success, PEAR_Error on failure
76
     * @see Translation2_Admin::addLang()
77
     */
78
    function addLang($langData, $options = array())
79
    {
80
        return $this->translation2->addLang($langData, $options);
81
    }
82
 
83
    // }}}
84
    // {{{ removeLang()
85
 
86
    /**
87
     * Remove the lang from the langsAvail table and drop the strings table.
88
     * If the strings table holds other langs and $force==false, then
89
     * only the lang column is dropped. If $force==true the whole
90
     * table is dropped without any check
91
     *
92
     * @param string  $langID language ID
93
     * @param boolean $force  remove the language info without further checks
94
     *
95
     * @return mixed true on success, PEAR_Error on failure
96
     * @see Translation2_Admin::removeLang()
97
     */
98
    function removeLang($langID = null, $force = false)
99
    {
100
        return $this->translation2->removeLang($langID, $force);
101
    }
102
 
103
    // }}}
104
    // {{{ updateLang()
105
 
106
    /**
107
     * Update the lang info in the langsAvail table
108
     *
109
     * @param array $langData array containing language info
110
     *
111
     * @return mixed true on success, PEAR_Error on failure
112
     * @see Translation2_Admin::updateLang()
113
     */
114
    function updateLang($langData)
115
    {
116
        return $this->translation2->updateLang($langData);
117
    }
118
 
119
    // }}}
120
    // {{{ add()
121
 
122
    /**
123
     * Add a new translation
124
     *
125
     * @param string $stringID    string ID
126
     * @param string $pageID      page/group ID
127
     * @param array  $stringArray Associative array with string translations.
128
     *               Sample format:  array('en' => 'sample', 'it' => 'esempio')
129
     *
130
     * @return mixed true on success, PEAR_Error on failure
131
     * @see Translation2_Admin::add()
132
     */
133
    function add($stringID, $pageID, $stringArray)
134
    {
135
        return $this->translation2->add($stringID, $pageID, $stringArray);
136
    }
137
 
138
    // }}}
139
    // {{{ update()
140
 
141
    /**
142
     * Update an existing translation
143
     *
144
     * @param string $stringID    string ID
145
     * @param string $pageID      page/group ID
146
     * @param array  $stringArray Associative array with string translations.
147
     *               Sample format:  array('en' => 'sample', 'it' => 'esempio')
148
     *
149
     * @return mixed true on success, PEAR_Error on failure
150
     * @see Translation2_Admin::update()
151
     */
152
    function update($stringID, $pageID, $stringArray)
153
    {
154
        return $this->translation2->update($stringID, $pageID, $stringArray);
155
    }
156
 
157
    // }}}
158
    // {{{ remove()
159
 
160
    /**
161
     * Remove a translated string
162
     *
163
     * @param string $stringID string ID
164
     * @param string $pageID   page/group ID
165
     *
166
     * @return mixed true on success, PEAR_Error on failure
167
     * @see Translation2_Admin::remove()
168
     */
169
    function remove($stringID, $pageID = null)
170
    {
171
        return $this->translation2->remove($stringID, $pageID);
172
    }
173
 
174
    // }}}
175
    // {{{ removePage
176
 
177
    /**
178
     * Remove all the strings in the given page/group
179
     *
180
     * @param string $pageID page/group ID
181
     *
182
     * @return mixed true on success, PEAR_Error on failure
183
     * @see Translation2_Admin::removePage()
184
     */
185
    function removePage($pageID = null)
186
    {
187
        return $this->translation2->removePager($pageID);
188
    }
189
 
190
    // }}}
191
    // {{{ getPageNames()
192
 
193
    /**
194
     * Get a list of all the pageIDs in any table.
195
     *
196
     * @return array
197
     * @see Translation2_Admin::getPageNames()
198
     */
199
    function getPageNames()
200
    {
201
        return $this->translation2->getPageNames();
202
    }
203
 
204
    // }}}
205
    // {{{ cleanCache()
206
 
207
    /**
208
     * If you use the CacheLiteFunction decorator, you may want to invalidate
209
     * the cache after a change in the data base.
210
     *
211
     * @return void
212
     * @see Translation2_Admin::cleanCache()
213
     */
214
    function cleanCache()
215
    {
216
        return $this->translation2->cleanCache();
217
    }
218
 
219
    // }}}
220
}
221
?>