/**
  * Read JavaScript file(s) set in TypoScript. If set add to header data
  *
  * @return void
  * @author	Reinhard Führicht <*****@*****.**>
  */
 protected function addJS()
 {
     $jsFile = $this->settings['jsFile'];
     $jsFiles = array();
     if ($this->settings['jsFile.']) {
         foreach ($this->settings['jsFile.'] as $idx => $file) {
             if (strpos($idx, '.') === FALSE) {
                 $file = Tx_Formhandler_StaticFuncs::getSingle($this->settings['jsFile.'], $idx);
                 $jsFiles[] = $file;
             }
         }
     } elseif (strlen($jsFile) > 0) {
         $jsFiles[] = Tx_Formhandler_StaticFuncs::getSingle($this->settings, 'jsFile');
     }
     foreach ($jsFiles as $idx => $file) {
         // set stylesheet
         $GLOBALS['TSFE']->additionalHeaderData[$this->configuration->getPackageKeyLowercase()] .= '<script type="text/javascript" src="' . Tx_Formhandler_StaticFuncs::resolveRelPathFromSiteRoot($file) . '"></script>' . "\n";
     }
 }
 /**
  * Reads the translation file entered in TS setup.
  *
  * @return void
  */
 protected function readMasterTemplates()
 {
     $this->masterTemplates = array();
     if (isset($this->settings['masterTemplateFile']) && !isset($this->settings['masterTemplateFile.'])) {
         array_push($this->masterTemplates, Tx_Formhandler_StaticFuncs::resolveRelPathFromSiteRoot($this->settings['masterTemplateFile']));
     } elseif (isset($this->settings['masterTemplateFile']) && isset($this->settings['masterTemplateFile.'])) {
         array_push($this->masterTemplates, Tx_Formhandler_StaticFuncs::getSingle($this->settings, 'masterTemplateFile'));
     } elseif (isset($this->settings['masterTemplateFile.']) && is_array($this->settings['masterTemplateFile.'])) {
         foreach ($this->settings['masterTemplateFile.'] as $key => $masterTemplate) {
             if (FALSE === strpos($key, '.')) {
                 if (is_array($this->settings['masterTemplateFile.'][$key . '.'])) {
                     array_push($this->masterTemplates, Tx_Formhandler_StaticFuncs::getSingle($this->settings['masterTemplateFile.'], $key));
                 } else {
                     array_push($this->masterTemplates, Tx_Formhandler_StaticFuncs::resolveRelPathFromSiteRoot($masterTemplate));
                 }
             }
         }
     }
 }
 /**
  * Read language file set in flexform or TypoScript, read the file's path to $this->langFile
  *
  * @param $settings The formhandler settings
  * @return void
  * @author	Reinhard Führicht <*****@*****.**>
  */
 public static function readLanguageFiles($langFiles, &$settings)
 {
     //language file was not set in flexform, search TypoScript for setting
     if (!$langFiles) {
         $langFiles = array();
         if (isset($settings['langFile']) && !isset($settings['langFile.'])) {
             array_push($langFiles, Tx_Formhandler_StaticFuncs::resolveRelPathFromSiteRoot($settings['langFile']));
         } elseif (isset($settings['langFile']) && isset($settings['langFile.'])) {
             array_push($langFiles, Tx_Formhandler_Globals::getSingle($settings, 'langFile'));
         } elseif (isset($settings['langFile.']) && is_array($settings['langFile.'])) {
             foreach ($settings['langFile.'] as $key => $langFile) {
                 if (FALSE === strpos($key, '.')) {
                     if (is_array($settings['langFile.'][$key . '.'])) {
                         array_push($langFiles, Tx_Formhandler_StaticFuncs::getSingle($settings['langFile.'], $key));
                     } else {
                         array_push($langFiles, Tx_Formhandler_StaticFuncs::resolveRelPathFromSiteRoot($langFile));
                     }
                 }
             }
         }
     }
     foreach ($langFiles as $idx => &$langFile) {
         $langFile = Tx_Formhandler_StaticFuncs::convertToRelativePath($langFile);
     }
     return $langFiles;
 }