TYPO3 CMS  TYPO3_7-6
EmailViewHelper.php
Go to the documentation of this file.
1 <?php
3 
4 /* *
5  * This script is part of the TYPO3 project - inspiring people to share! *
6  * *
7  * TYPO3 is free software; you can redistribute it and/or modify it under *
8  * the terms of the GNU General Public License version 2 as published by *
9  * the Free Software Foundation. *
10  * *
11  * This script is distributed in the hope that it will be useful, but *
12  * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHAN- *
13  * TABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General *
14  * Public License for more details. *
15  * */
38 {
42  protected $tagName = 'a';
43 
49  public function initializeArguments()
50  {
52  $this->registerTagAttribute('name', 'string', 'Specifies the name of an anchor');
53  $this->registerTagAttribute('rel', 'string', 'Specifies the relationship between the current document and the linked document');
54  $this->registerTagAttribute('rev', 'string', 'Specifies the relationship between the linked document and the current document');
55  $this->registerTagAttribute('target', 'string', 'Specifies where to open the linked document');
56  }
57 
62  public function render($email)
63  {
64  if ($this->isFrontendAvailable()) {
65  list($linkHref, $linkText) = $GLOBALS['TSFE']->cObj->getMailTo($email, '');
66  $escapeSpecialCharacters = !isset($GLOBALS['TSFE']->spamProtectEmailAddresses) || $GLOBALS['TSFE']->spamProtectEmailAddresses !== 'ascii';
67  } else {
68  $linkHref = 'mailto:' . $email;
69  $linkText = htmlspecialchars($email);
70  $escapeSpecialCharacters = true;
71  }
72  $tagContent = $this->renderChildren();
73  if ($tagContent !== null) {
74  $linkText = $tagContent;
75  }
76  $this->tag->setContent($linkText);
77  $this->tag->addAttribute('href', $linkHref, $escapeSpecialCharacters);
78  $this->tag->forceClosingTag(true);
79  return $this->tag->render();
80  }
81 
85  protected function isFrontendAvailable()
86  {
87  return TYPO3_MODE === 'FE';
88  }
89 }
registerTagAttribute($name, $type, $description, $required=false, $default=null)
if(TYPO3_MODE==='BE') $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_tsfebeuserauth.php']['frontendEditingController']['default']