3
* $RCSfile: module.inc,v $
5
* Gallery - a web based photo album viewer and editor
6
* Copyright (C) 2000-2006 Bharat Mediratta
8
* This program is free software; you can redistribute it and/or modify
9
* it under the terms of the GNU General Public License as published by
10
* the Free Software Foundation; either version 2 of the License, or (at
11
* your option) any later version.
13
* This program is distributed in the hope that it will be useful, but
14
* WITHOUT ANY WARRANTY; without even the implied warranty of
15
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16
* General Public License for more details.
18
* You should have received a copy of the GNU General Public License
19
* along with this program; if not, write to the Free Software
20
* Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
23
* @version $Revision: 1.4 $ $Date: 2006/03/22 03:52:31 $
25
* @author Don Willingham <donwillingham@users.sf.net>
29
* getID3() ID3 metadata Module
31
* This module provides the getID3 metadata toolkit for Gallery
35
class Getid3Module extends GalleryModule {
37
function Getid3Module() {
40
$this->setId('getid3');
41
$this->setName($gallery->i18n('Getid3'));
42
$this->setDescription($gallery->i18n('A toolkit for getting id3 tag information'));
43
$this->setVersion('1.0.0'); /* Update upgrade() function below too */
44
$this->setGroup('data', $gallery->i18n('Extra Data'));
45
$this->setCallbacks('getSiteAdminViews');
46
$this->setRequiredCoreApi(array(7, 1));
47
$this->setRequiredModuleApi(array(3, 0));
51
* @see GalleryModule::upgrade()
53
function upgrade($currentVersion) {
56
if (!isset($currentVersion)) {
58
GalleryCoreApi::requireOnce('modules/getid3/classes/Getid3Helper.class');
59
$ret = Getid3Helper::setDefaultProperties(GETID3_SUMMARY);
61
return $ret->wrap(__FILE__, __LINE__);
64
$ret = Getid3Helper::setDefaultProperties(GETID3_DETAILED);
66
return $ret->wrap(__FILE__, __LINE__);
69
switch ($currentVersion) {
74
case 'end of upgrade path':
78
return GalleryCoreApi::error(ERROR_BAD_PLUGIN, __FILE__, __LINE__,
79
sprintf('Unknown module version %s', $currentVersion));
87
* @see GalleryModule::performFactoryRegistrations()
89
function performFactoryRegistrations() {
90
/* Register our graphics class with the factory */
91
$ret = GalleryCoreApi::registerFactoryImplementation(
92
'Getid3Interface_1_0', 'Getid3Extractor', 'Getid3',
93
'modules/getid3/classes/Getid3Extractor.class', 'getid3', null);
95
return $ret->wrap(__FILE__, __LINE__);
98
$ret = GalleryCoreApi::registerFactoryImplementation(
99
'GalleryToolkit', 'Getid3Toolkit', 'Getid3',
100
'modules/getid3/classes/Getid3Toolkit.class', 'getid3', null);
102
return $ret->wrap(__FILE__, __LINE__);
105
$ret = GalleryCoreApi::registerFactoryImplementation('ItemAddOption',
106
'Getid3DescriptionOption', 'Getid3DescriptionOption',
107
'modules/getid3/Getid3DescriptionOption.inc', 'getid3', null);
109
return $ret->wrap(__FILE__, __LINE__);
117
* @see GalleryModule::activate
119
function activate($postActivationEvent=true) {
121
$ret = GalleryCoreApi::registerToolkitProperty(
123
array('video/x-msvideo'),
124
'originationTimestamp',
126
$gallery->i18n('Get the origination timestamp'));
128
return array($ret->wrap(__FILE__, __LINE__), null);
132
* Stopgap for now, don't allow installation on Windows until
133
* we resolve the fact that the helperapps dir is missing from
134
* the getid3 lib and the lib won't work properly if there are
135
* spaces in the path.
137
$platform =& $gallery->getPlatform();
138
if (GalleryUtilities::isA($platform, 'WinNtPlatform')) {
140
array('view' => 'core.SiteAdmin',
141
'subView' => 'getid3.CantActivate'));
144
list ($ret, $redirect) = parent::activate($postActivationEvent);
146
return array($ret->wrap(__FILE__, __LINE__), null);
149
return array(null, $redirect);
153
* @see GalleryModule::deactivate()
155
function deactivate() {
156
list ($ret, $redirect) = parent::deactivate();
158
return array($ret->wrap(__FILE__, __LINE__), null);
161
/* Unregister all of our properties and operations */
162
$ret = GalleryCoreApi::unregisterToolkit('Getid3');
164
return array($ret->wrap(__FILE__, __LINE__), null);
167
return array(null, $redirect);
171
* @see GalleryModule::getSiteAdminViews()
173
function getSiteAdminViews() {
174
return array(null, array(array('name' => $this->translate('Getid3'),
175
'view' => 'getid3:AdminGetid3')));
179
* @see GalleryModule::getConfigurationView()
181
function getConfigurationView() {
182
return 'getid3.CantActivate';