|
TYPO3 API
SVNRelease
|
00001 <?php 00002 /*************************************************************** 00003 * Copyright notice 00004 * 00005 * (c) 2010 Marcus Krause <marcus#exp2010@t3sec.info> 00006 * Steffen Kamper <info@sk-typo3.de> 00007 * All rights reserved 00008 * 00009 * This script is part of the TYPO3 project. The TYPO3 project is 00010 * free software; you can redistribute it and/or modify 00011 * it under the terms of the GNU General Public License as published by 00012 * the Free Software Foundation; either version 2 of the License, or 00013 * (at your option) any later version. 00014 * 00015 * The GNU General Public License can be found at 00016 * http://www.gnu.org/copyleft/gpl.html. 00017 * 00018 * This script is distributed in the hope that it will be useful, 00019 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00020 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00021 * GNU General Public License for more details. 00022 * 00023 * This copyright notice MUST APPEAR in all copies of the script! 00024 ***************************************************************/ 00025 /** 00026 * class.tx_em_parser_extensionxmlabstractparser.php 00027 * 00028 * Module: Extension manager - Extension.xml abstract parser 00029 * 00030 * $Id: class.tx_em_parser_extensionxmlabstractparser.php 1913 2010-02-21 15:47:37Z mkrause $ 00031 * 00032 * @author Marcus Krause <marcus#exp2010@t3sec.info> 00033 * @author Steffen Kamper <info@sk-typo3.de> 00034 */ 00035 00036 /** 00037 * Abstract parser for TYPO3's extension.xml file. 00038 * 00039 * @author Marcus Krause <marcus#exp2010@t3sec.info> 00040 * @author Steffen Kamper <info@sk-typo3.de> 00041 * 00042 * @since 2010-02-09 00043 * @package TYPO3 00044 * @subpackage EM 00045 */ 00046 abstract class tx_em_Parser_ExtensionXmlAbstractParser extends tx_em_Parser_XmlAbstractParser { 00047 00048 00049 /** 00050 * Keeps current author company of an extension's version. 00051 * 00052 * @var string 00053 */ 00054 protected $authorcompany = NULL; 00055 00056 /** 00057 * Keeps current author mail address of an extension's version. 00058 * 00059 * @var string 00060 */ 00061 protected $authoremail = NULL; 00062 00063 /** 00064 * Keeps current author name of an extension's version. 00065 * 00066 * @var string 00067 */ 00068 protected $authorname = NULL; 00069 00070 /** 00071 * Keeps current category of an extension's version. 00072 * 00073 * @var string 00074 */ 00075 protected $category = NULL; 00076 00077 /** 00078 * Keeps current dependencies of an extension's version. 00079 * 00080 * @var string 00081 */ 00082 protected $dependencies = NULL; 00083 00084 /** 00085 * Keeps current description of an extension's version. 00086 * 00087 * @var string 00088 */ 00089 protected $description = NULL; 00090 00091 /** 00092 * Keeps current download number sum of all extension's versions. 00093 * 00094 * @var string 00095 */ 00096 protected $extensionDLCounter = NULL; 00097 00098 /** 00099 * Keeps current key of an extension. 00100 * 00101 * @var string 00102 */ 00103 protected $extensionKey = NULL; 00104 00105 /** 00106 * Keeps current upload date of an extension's version. 00107 * 00108 * @var string 00109 */ 00110 protected $lastuploaddate = NULL; 00111 00112 /** 00113 * Keeps current owner username of an extension's version. 00114 * 00115 * @var string 00116 */ 00117 protected $ownerusername = NULL; 00118 00119 /** 00120 * Keeps current reviewstate of an extension's version. 00121 * 00122 * @var string 00123 */ 00124 protected $reviewstate = NULL; 00125 00126 /** 00127 * Keeps current state of an extension's version. 00128 * 00129 * @var string 00130 */ 00131 protected $state = NULL; 00132 00133 /** 00134 * Keeps current t3x file hash of an extension's version. 00135 * 00136 * @var string 00137 */ 00138 protected $t3xfilemd5 = NULL; 00139 00140 /** 00141 * Keeps current title of an extension's version. 00142 * 00143 * @var string 00144 */ 00145 protected $title = NULL; 00146 00147 /** 00148 * Keeps current upload comment of an extension's version. 00149 * 00150 * @var string 00151 */ 00152 protected $uploadcomment = NULL; 00153 00154 /** 00155 * Keeps current version number. 00156 * 00157 * @var string 00158 */ 00159 protected $version = NULL; 00160 00161 /** 00162 * Keeps current download number of an extension's version. 00163 * 00164 * @var string 00165 */ 00166 protected $versionDLCounter = NULL; 00167 00168 00169 /** 00170 * Returns an assoziative array of all extension version properties. 00171 * 00172 * Valid array keys of returned array are: 00173 * extkey, version, alldownloadcounter, downloadcounter, title, description, 00174 * state, reviewstate, category, lastuploaddate, uploadcomment, dependencies, 00175 * authorname, authoremail, authorcompany, ownerusername, t3xfilemd5 00176 * 00177 * @access public 00178 * @see $extensionKey, $version, $extensionDLCounter, $versionDLCounter, 00179 * $title, $description, $state, $reviewstate, $category, 00180 * $lastuploaddate, $uploadcomment, $dependencies, $authorname, 00181 * $authoremail, $authorcompany, $ownerusername, $t3xfilemd5 00182 * @return array assoziative array of an extension version's properties 00183 */ 00184 public function getAll() { 00185 $versionProperties = array(); 00186 $versionProperties['extkey'] = $this->extensionKey; 00187 $versionProperties['version'] = $this->version; 00188 $versionProperties['alldownloadcounter'] = $this->extensionDLCounter; 00189 $versionProperties['downloadcounter'] = $this->versionDLCounter; 00190 $versionProperties['title'] = $this->title; 00191 $versionProperties['description'] = $this->description; 00192 $versionProperties['state'] = $this->state; 00193 $versionProperties['reviewstate'] = $this->reviewstate; 00194 $versionProperties['category'] = $this->category; 00195 $versionProperties['lastuploaddate'] = $this->lastuploaddate; 00196 $versionProperties['uploadcomment'] = $this->uploadcomment; 00197 $versionProperties['dependencies'] = $this->dependencies; 00198 $versionProperties['authorname'] = $this->authorname; 00199 $versionProperties['authoremail'] = $this->authoremail; 00200 $versionProperties['authorcompany'] = $this->authorcompany; 00201 $versionProperties['ownerusername'] = $this->ownerusername; 00202 $versionProperties['t3xfilemd5'] = $this->t3xfilemd5; 00203 return $versionProperties; 00204 } 00205 00206 /** 00207 * Returns download number sum of all extension's versions. 00208 * 00209 * @access public 00210 * @return string download number sum 00211 * @see $extensionDLCounter, getAll() 00212 */ 00213 public function getAlldownloadcounter() { 00214 return $this->extensionDLCounter; 00215 } 00216 00217 /** 00218 * Returns company name of extension author. 00219 * 00220 * @access public 00221 * @return string company name of extension author 00222 * @see $authorcompany, getAll() 00223 */ 00224 public function getAuthorcompany() { 00225 return $this->authorcompany; 00226 } 00227 00228 /** 00229 * Returns e-mail address of extension author. 00230 * 00231 * @access public 00232 * @return string e-mail address of extension author 00233 * @see $authoremail, getAll() 00234 */ 00235 public function getAuthoremail() { 00236 return $this->authoremail; 00237 } 00238 00239 /** 00240 * Returns name of extension author. 00241 * 00242 * @access public 00243 * @return string name of extension author 00244 * @see $authorname, getAll() 00245 */ 00246 public function getAuthorname() { 00247 return $this->authorname; 00248 } 00249 00250 /** 00251 * Returns category of an extension. 00252 * 00253 * @access public 00254 * @return string extension category 00255 * @see $category, getAll() 00256 */ 00257 public function getCategory() { 00258 return $this->category; 00259 } 00260 00261 /** 00262 * Returns dependencies of an extension's version. 00263 * 00264 * @access public 00265 * @return string extension dependencies 00266 * @see $dependencies, getAll() 00267 */ 00268 public function getDependencies() { 00269 return $this->dependencies; 00270 } 00271 00272 /** 00273 * Returns description of an extension's version. 00274 * 00275 * @access public 00276 * @return string extension description 00277 * @see $description, getAll() 00278 */ 00279 public function getDescription() { 00280 return $this->description; 00281 } 00282 00283 /** 00284 * Returns download number of an extension's version. 00285 * 00286 * @access public 00287 * @return string download number 00288 * @see $versionDLCounter, getAll() 00289 */ 00290 public function getDownloadcounter() { 00291 return $this->versionDLCounter; 00292 } 00293 00294 /** 00295 * Returns key of an extension. 00296 * 00297 * @access public 00298 * @return string extension key 00299 * @see $extensionKey, getAll() 00300 */ 00301 public function getExtkey() { 00302 return $this->extensionKey; 00303 } 00304 00305 /** 00306 * Returns last uploaddate of an extension's version. 00307 * 00308 * @access public 00309 * @return string last upload date of an extension's version 00310 * @see $lastuploaddate, getAll() 00311 */ 00312 public function getLastuploaddate() { 00313 return $this->lastuploaddate; 00314 } 00315 00316 /** 00317 * Returns username of extension owner. 00318 * 00319 * @access public 00320 * @return string extension owner's username 00321 * @see $ownerusername, getAll() 00322 */ 00323 public function getOwnerusername() { 00324 return $this->ownerusername; 00325 } 00326 00327 /** 00328 * Returns review state of an extension's version. 00329 * 00330 * @access public 00331 * @return string extension review state 00332 * @see $reviewstate, getAll() 00333 */ 00334 public function getReviewstate() { 00335 return $this->reviewstate; 00336 } 00337 00338 /** 00339 * Returns state of an extension's version. 00340 * 00341 * @access public 00342 * @return string extension state 00343 * @see $state, getAll() 00344 */ 00345 public function getState() { 00346 return $this->state; 00347 } 00348 00349 /** 00350 * Returns t3x file hash of an extension's version. 00351 * 00352 * @access public 00353 * @return string t3x file hash * 00354 * @see $t3xfilemd5, getAll() 00355 */ 00356 public function getT3xfilemd5() { 00357 return $this->t3xfilemd5; 00358 } 00359 00360 /** 00361 * Returns title of an extension's version. 00362 * 00363 * @access public 00364 * @return string extension title 00365 * @see $title, getAll() 00366 */ 00367 public function getTitle() { 00368 return $this->title; 00369 } 00370 00371 /** 00372 * Returns extension upload comment. 00373 * 00374 * @access public 00375 * @return string extension upload comment 00376 * @see $uploadcomment, getAll() 00377 */ 00378 public function getUploadcomment() { 00379 return $this->uploadcomment; 00380 } 00381 00382 /** 00383 * Returns version number. 00384 * 00385 * @access public 00386 * @return string version number 00387 * @see $version, getAll() 00388 */ 00389 public function getVersion() { 00390 return $this->version; 00391 } 00392 00393 /** 00394 * Method resets version class properties. 00395 * 00396 * @access protected 00397 * @param boolean $all if true, additionally extension properties are reset 00398 * @return void 00399 * @see $extensionKey, $version, $extensionDLCounter, $versionDLCounter, 00400 * $title, $description, $state, $reviewstate, $category, 00401 * $lastuploaddate, $uploadcomment, $dependencies, $authorname, 00402 * $authoremail, $authorcompany, $ownerusername, $t3xfilemd5 00403 */ 00404 protected function resetProperties($resetAll = FALSE) { 00405 // resetting at least class property "version" is mandatory 00406 // as we need to do some magic in regards to 00407 // an extension's and version's child node "downloadcounter" 00408 $this->version = $this->title = $this->versionDLCounter = 00409 $this->description = $this->state = $this->reviewstate = 00410 $this->category = $this->lastuploaddate = $this->uploadcomment = 00411 $this->dependencies = $this->authorname = $this->authoremail = 00412 $this->authorcompany = $this->ownerusername = $this->t3xfilemd5 = NULL; 00413 if ($resetAll) { 00414 $this->extensionKey = $this->extensionDLCounter = NULL; 00415 } 00416 } 00417 00418 /** 00419 * Method provides a wrapper for an exception call 00420 * 00421 * @access protected 00422 * @param string $message the exception message to throw. 00423 * @param integer $code the exception code 00424 * @return void 00425 */ 00426 protected function throwException($message = "", $code = 0) { 00427 throw new tx_em_ExtensionXmlException(get_class($this) . ': ' . $message, $code); 00428 } 00429 00430 /** 00431 * Convert dependencies from TER format to EM_CONF format 00432 * 00433 * @param string $dependencies serialized dependency array 00434 * @return void 00435 */ 00436 protected function convertDependencies($dependencies) { 00437 $newDependencies = array(); 00438 $dependenciesArray = unserialize($dependencies); 00439 if (is_array($dependenciesArray)) { 00440 foreach ($dependenciesArray as $version) { 00441 $newDependencies[$version['kind']][$version['extensionKey']] = $version['versionRange']; 00442 } 00443 } 00444 return serialize($newDependencies); 00445 } 00446 } 00447 00448 if (defined('TYPO3_MODE') && isset($GLOBALS['TYPO3_CONF_VARS'][TYPO3_MODE]['XCLASS']['typo3/sysext/em/classes/parser/class.tx_em_parser_extensionxmlabstractparser.php'])) { 00449 include_once($GLOBALS['TYPO3_CONF_VARS'][TYPO3_MODE]['XCLASS']['typo3/sysext/em/classes/parser/class.tx_em_parser_extensionxmlabstractparser.php']); 00450 } 00451 00452 ?>
1.8.0