TYPO3 CMS  TYPO3_6-2
Extension.php
Go to the documentation of this file.
1 <?php
3 
22 
27 
33  static protected $defaultCategories = array(
34  0 => 'be',
35  1 => 'module',
36  2 => 'fe',
37  3 => 'plugin',
38  4 => 'misc',
39  5 => 'services',
40  6 => 'templates',
41  8 => 'doc',
42  9 => 'example',
43  Extension::DISTRIBUTION_CATEGORY => 'distribution'
44  );
45 
51  static protected $defaultStates = array(
52  0 => 'alpha',
53  1 => 'beta',
54  2 => 'stable',
55  3 => 'experimental',
56  4 => 'test',
57  5 => 'obsolete',
58  6 => 'excludeFromUpdates',
59  999 => 'n/a'
60  );
61 
66  protected $objectManager;
67 
71  protected $extensionKey = '';
72 
76  protected $version = '';
77 
81  protected $integerVersion = 0;
82 
86  protected $title = '';
87 
91  protected $description = '';
92 
96  protected $state = 0;
97 
101  protected $category = 0;
102 
106  protected $lastUpdated;
107 
111  protected $updateComment = '';
112 
116  protected $authorName = '';
117 
121  protected $authorEmail = '';
122 
126  protected $currentVersion = FALSE;
127 
131  protected $md5hash = '';
132 
136  protected $reviewState;
137 
142 
146  protected $serializedDependencies = '';
147 
151  protected $dependencies = NULL;
152 
157  protected $position = 0;
158 
163  public function setAuthorEmail($authorEmail) {
164  $this->authorEmail = $authorEmail;
165  }
166 
170  public function getAuthorEmail() {
171  return $this->authorEmail;
172  }
173 
178  public function setAuthorName($authorName) {
179  $this->authorName = $authorName;
180  }
181 
185  public function getAuthorName() {
186  return $this->authorName;
187  }
188 
193  public function setCategory($category) {
194  $this->category = $category;
195  }
196 
200  public function getCategory() {
201  return $this->category;
202  }
203 
209  public function getCategoryString() {
210  $categoryString = '';
211  if (isset(self::$defaultCategories[$this->getCategory()])) {
212  $categoryString = self::$defaultCategories[$this->getCategory()];
213  }
214  return $categoryString;
215  }
216 
225  $categoryIndex = 4;
226  if (\TYPO3\CMS\Core\Utility\MathUtility::canBeInterpretedAsInteger($category)) {
227  $categoryIndex = (int)$category;
228  if ($categoryIndex < 0 || $categoryIndex > 10) {
229  $categoryIndex = 4;
230  }
231  } elseif (is_string($category)) {
232  $categoryIndex = array_search($category, self::$defaultCategories);
233  if ($categoryIndex === FALSE) {
234  $categoryIndex = 4;
235  }
236  }
237  return $categoryIndex;
238  }
239 
244  public function setDescription($description) {
245  $this->description = $description;
246  }
247 
251  public function getDescription() {
252  return $this->description;
253  }
254 
259  public function setExtensionKey($extensionKey) {
260  $this->extensionKey = $extensionKey;
261  }
262 
266  public function getExtensionKey() {
267  return $this->extensionKey;
268  }
269 
274  public function setLastUpdated(\DateTime $lastUpdated) {
275  $this->lastUpdated = $lastUpdated;
276  }
277 
281  public function getLastUpdated() {
282  return $this->lastUpdated;
283  }
284 
289  public function setState($state) {
290  $this->state = $state;
291  }
292 
296  public function getState() {
297  return $this->state;
298  }
299 
305  public function getStateString() {
306  $stateString = '';
307  if (isset(self::$defaultStates[$this->getState()])) {
308  $stateString = self::$defaultStates[$this->getState()];
309  }
310  return $stateString;
311  }
312 
320  public function getDefaultState($state = NULL) {
321  $defaultState = '';
322  if (is_null($state)) {
323  $defaultState = self::$defaultStates;
324  } else {
325  if (is_string($state)) {
326  $stateIndex = array_search(strtolower($state), self::$defaultStates);
327  if ($stateIndex === FALSE) {
328  // default state
329  $stateIndex = 999;
330  }
331  $defaultState = $stateIndex;
332  } else {
333  if (is_int($state) && $state >= 0) {
334  if (array_key_exists($state, self::$defaultStates)) {
335  $stateTitle = self::$defaultStates[$state];
336  } else {
337  // default state
338  $stateTitle = 'n/a';
339  }
340  $defaultState = $stateTitle;
341  }
342  }
343  }
344  return $defaultState;
345  }
346 
351  public function setTitle($title) {
352  $this->title = $title;
353  }
354 
358  public function getTitle() {
359  return $this->title;
360  }
361 
366  public function setUpdateComment($updateComment) {
367  $this->updateComment = $updateComment;
368  }
369 
373  public function getUpdateComment() {
374  return $this->updateComment;
375  }
376 
381  public function setVersion($version) {
382  $this->version = $version;
383  }
384 
388  public function getVersion() {
389  return $this->version;
390  }
391 
397  $this->currentVersion = $currentVersion;
398  }
399 
403  public function getCurrentVersion() {
404  return $this->currentVersion;
405  }
406 
411  public function setMd5hash($md5hash) {
412  $this->md5hash = $md5hash;
413  }
414 
418  public function getMd5hash() {
419  return $this->md5hash;
420  }
421 
428  static public function returnInstallPaths() {
429  $installPaths = array(
430  'System' => PATH_typo3 . 'sysext/',
431  'Global' => PATH_typo3 . 'ext/',
432  'Local' => PATH_typo3conf . 'ext/'
433  );
434  return $installPaths;
435  }
436 
443  static public function returnAllowedInstallPaths() {
444  $installPaths = self::returnInstallPaths();
445  if (empty($GLOBALS['TYPO3_CONF_VARS']['EXT']['allowSystemInstall'])) {
446  unset($installPaths['System']);
447  }
448  if (empty($GLOBALS['TYPO3_CONF_VARS']['EXT']['allowGlobalInstall'])) {
449  unset($installPaths['Global']);
450  }
451  if (empty($GLOBALS['TYPO3_CONF_VARS']['EXT']['allowLocalInstall'])) {
452  unset($installPaths['Local']);
453  }
454  return $installPaths;
455  }
456 
463  static public function returnAllowedInstallTypes() {
464  $installPaths = self::returnAllowedInstallPaths();
465  return array_keys($installPaths);
466  }
467 
473  $this->serializedDependencies = $dependencies;
474  }
475 
479  public function getSerializedDependencies() {
481  }
482 
487  public function setDependencies($dependencies) {
488  $this->dependencies = $dependencies;
489  }
490 
494  public function getDependencies() {
495  if (!is_object($this->dependencies)) {
497  $extensionModelUtility = $this->objectManager->get('TYPO3\\CMS\\Extensionmanager\\Utility\\ExtensionModelUtility');
498  $this->setDependencies($extensionModelUtility->convertDependenciesToObjects($this->getSerializedDependencies()));
499  }
500  return $this->dependencies;
501  }
502 
507  public function addDependency(\TYPO3\CMS\Extensionmanager\Domain\Model\Dependency $dependency) {
508  $this->dependencies->attach($dependency);
509  }
510 
516  $this->integerVersion = $integerVersion;
517  }
518 
522  public function getIntegerVersion() {
523  return $this->integerVersion;
524  }
525 
530  public function setReviewState($reviewState) {
531  $this->reviewState = $reviewState;
532  }
533 
537  public function getReviewState() {
538  return $this->reviewState;
539  }
540 
545  public function setPosition($position) {
546  $this->position = $position;
547  }
548 
552  public function getPosition() {
553  return $this->position;
554  }
555 
560  $this->alldownloadcounter = $alldownloadcounter;
561  }
562 
566  public function getAlldownloadcounter() {
568  }
569 
570 }
addDependency(\TYPO3\CMS\Extensionmanager\Domain\Model\Dependency $dependency)
Definition: Extension.php:507
if(!defined('TYPO3_MODE')) $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_userauth.php']['logoff_pre_processing'][]