Exemplo n.º 1
0
 /**
  * Replace EXT, EXTCONF ...
  * 
  * @param string $string the raw string
  * @return string eval string
  */
 public function smart($string)
 {
     // if is callable function
     if (is_callable($string)) {
         $string = call_user_func($string);
     }
     // return locallang value
     if (substr($string, 0, 4) === 'LLL:') {
         $string = str_replace('LLL:', '', $string);
         $string = LocalizationUtility::translate($string, $this->form->getExtensionName());
     }
     // Search in typoscript configuration
     if (substr($string, 0, 3) === 'TS:') {
         $path = str_replace('TS:', '', $string);
         $parts = GeneralUtility::trimExplode('.', $path);
         $string = $GLOBALS['TSFE']->tmpl->setup;
         $lastPart = array_pop($parts);
         foreach ($parts as $part) {
             if (!isset($string[$part . '.'])) {
                 $string = '';
                 break;
             }
             $string = $string[$part . '.'];
         }
         $string = isset($string[$lastPart]) ? $string[$lastPart] : '';
     }
     // search in $GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf']
     if (substr($string, 0, 8) === 'EXTCONF:') {
         $path = str_replace('EXTCONF:', '', $string);
         $parts = GeneralUtility::trimExplode('/', $path);
         $string = $GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf'];
         foreach ($parts as $part) {
             if (!isset($string[$part])) {
                 $string = '';
                 break;
             }
             $string = $string[$part];
         }
     }
     // replace EXT:my_ext by ext path
     if (substr($string, 0, 4) === 'EXT:') {
         $string = str_replace('EXT:', '', $string);
         list($ext, $file) = explode('/', $string, 2);
         $string = ExtensionManagementUtility::siteRelPath($ext) . $file;
     }
     return $string;
 }
Exemplo n.º 2
0
 /**
  * return true if must check constraints
  * @return bool
  */
 protected function checkConstraints()
 {
     if ($this->checkConstraints === null) {
         $submitter = $this->form->getSubmitter();
         if (is_object($submitter)) {
             $this->checkConstraints = $submitter->checkConstraints();
         } else {
             $this->checkConstraints = true;
         }
     }
     return $this->checkConstraints;
 }
Exemplo n.º 3
0
 /**
  * Renders form
  *
  * @param \Ameos\AmeosForm\Form $form the form
  * @return string html
  */
 public function render($form)
 {
     return $form->toHtml();
 }
Exemplo n.º 4
0
 /**
  * return errors
  *
  * @return	array errors
  */
 public function getErrors()
 {
     return $this->form->getErrorManager()->getErrors($this);
 }