public function main()
 {
     $out = '';
     $conf = $this->getModule()->getConfigurations();
     $file = tx_rnbase_util_Files::getFileAbsFileName($conf->get($this->getConfId() . 'template'));
     $templateCode = tx_rnbase_util_Network::getURL($file);
     if (!$templateCode) {
         return $conf->getLL('msg_template_not_found') . '<br />File: \'' . $file . '\'<br />ConfId: \'' . $this->getConfId() . 'template\'';
     }
     $subpart = '###' . strtoupper($this->getFuncId()) . '###';
     $template = tx_rnbase_util_Templates::getSubpart($templateCode, $subpart);
     if (!$template) {
         return $conf->getLL('msg_subpart_not_found') . ': ' . $subpart;
     }
     $start = microtime(TRUE);
     $memStart = memory_get_usage();
     $out .= $this->getContent($template, $conf, $conf->getFormatter(), $this->getModule()->getFormTool());
     if (tx_rnbase_util_BaseMarker::containsMarker($out, 'MOD_')) {
         $markerArr = array();
         $memEnd = memory_get_usage();
         $markerArr['###MOD_PARSETIME###'] = microtime(TRUE) - $start;
         $markerArr['###MOD_MEMUSED###'] = $memEnd - $memStart;
         $markerArr['###MOD_MEMSTART###'] = $memStart;
         $markerArr['###MOD_MEMEND###'] = $memEnd;
         $out = tx_rnbase_util_Templates::substituteMarkerArrayCached($out, $markerArr);
     }
     return $out;
 }
 /**
  * Returns a subpart from file
  * @param string $fileName filepath or url
  * @param string $subpart
  * @return string
  * @throws Exception if file or subpart not found
  */
 public static function getSubpartFromFile($fileName, $subpart)
 {
     $file = self::getTSTemplate()->getFileName($fileName);
     if (TYPO3_MODE == 'BE' && strpos($file, PATH_site) === FALSE) {
         $file = PATH_site . $file;
     }
     // Im BE auf absoluten Pfad setzen
     $templateCode = tx_rnbase_util_Network::getURL($file);
     if (!$templateCode) {
         throw new Exception('File not found: ' . htmlspecialchars($fileName));
     }
     $template = self::getSubpart($templateCode, $subpart);
     if (!$template) {
         throw new Exception('Subpart not found! File: ' . htmlspecialchars($file) . ' Subpart: ' . htmlspecialchars($subpart));
     }
     return $template;
 }
 /**
  * Returns the flexform data of this plugin as array
  *
  * @return array by reference
  */
 function &getFlexFormArray()
 {
     static $flex;
     if (!is_array($flex)) {
         $flex = tx_rnbase_util_Network::getURL(tx_rnbase_util_Extensions::extPath($this->getExtensionKey()) . $this->get('flexform'));
         $flex = tx_rnbase_util_Arrays::xml2array($flex);
     }
     return $flex;
 }
 public function test_includeSubTemplates()
 {
     $fixture = tx_rnbase_util_Network::getURL(tx_rnbase_util_Extensions::extPath('rn_base', 'tests/fixtures/html/includeSubTemplates.html'));
     $raw = tx_rnbase_util_Templates::getSubpart($fixture, '###TEMPLATE###');
     $expected = tx_rnbase_util_Templates::getSubpart($fixture, '###EXPECTED###');
     $included = tx_rnbase_util_Templates::includeSubTemplates($raw);
     // remove empty lines
     $included = preg_replace("/(^[\r\n]*|[\r\n]+)[\\s\t]*[\r\n]+/", "\n", $included);
     $expected = preg_replace("/(^[\r\n]*|[\r\n]+)[\\s\t]*[\r\n]+/", "\n", $expected);
     $this->assertEquals($expected, $included);
 }