static function replaceVars($template, $er = array())
 {
     $r = rex_extension::registerPoint(new rex_extension_point('YFORM_EMAIL_BEFORE_REPLACEVARS', ['template' => $template, 'search_replace' => $er, 'status' => false]));
     $template = $r['template'];
     $er = $r['search_replace'];
     $status = $r['status'];
     if ($status) {
         return true;
     }
     $er['REX_SERVER'] = rex::getServer();
     $er['REX_ERROR_EMAIL'] = rex::getErrorEmail();
     $er['REX_SERVERNAME'] = rex::getServerName();
     $er['REX_NOTFOUND_ARTICLE_ID'] = rex_article::getNotfoundArticleId();
     $er['REX_ARTICLE_ID'] = rex_article::getCurrentId();
     $template['body'] = rex_var::parse($template['body'], '', 'yform_email_template', $er);
     $template['body_html'] = rex_var::parse($template['body_html'], '', 'yform_email_template', $er);
     // rex_vars bug: sonst wird der Zeilenumbruch entfernt - wenn DATA_VAR am Ende einer Zeile
     if (rex_string::versionCompare(rex::getVersion(), '5.0.1', '<')) {
         $template['body'] = str_replace("?>\r", "?>\r\n\r", $template['body']);
         $template['body'] = str_replace("?>\n", "?>\n\r\n", $template['body']);
         $template['body_html'] = str_replace("?>\r", "?>\r\n\r", $template['body_html']);
         $template['body_html'] = str_replace("?>\n", "?>\n\r\n", $template['body_html']);
     }
     $template['body'] = rex_file::getOutput(rex_stream::factory('yform/email/template/' . $template['name'] . '/body', $template['body']));
     $template['body_html'] = rex_file::getOutput(rex_stream::factory('yform/email/template/' . $template['name'] . '/body_html', $template['body_html']));
     return $template;
 }
Example #2
0
 protected function getParseOutput($content)
 {
     return rex_file::getOutput(rex_stream::factory('rex-var-test', rex_var::parse($content)));
 }
Example #3
0
 public function testGetOutput()
 {
     $file = $this->getPath('test.php');
     rex_file::put($file, 'a<?php echo "b";');
     $this->assertEquals('ab', rex_file::getOutput($file), 'getOutput() returns the executed content');
 }
Example #4
0
<?php

$content = rex_file::getOutput(rex_path::plugin('be_style', 'redaxo', 'assets/css/styles.css'));
preg_match_all('@\\.rex-icon-(\\w+):before@im', $content, $matches, PREG_SET_ORDER);
$icons_used = '';
if (count($matches) > 0) {
    $list = [];
    foreach ($matches as $match) {
        $list[$match[1]] = '<li><i class="rex-icon rex-icon-' . $match[1] . '"></i> rex-icon-' . $match[1] . '</li>';
    }
    ksort($list);
    $icons_used = '<ul class="rex-list-inline">' . implode('', $list) . '</ul>';
}
preg_match_all('@\\.fa-(\\w+):before@im', $content, $matches, PREG_SET_ORDER);
$icons_complete = '';
if (count($matches) > 0) {
    $list = [];
    foreach ($matches as $match) {
        $list[$match[1]] = '<li><i class="fa fa-' . $match[1] . '"></i> fa-' . $match[1] . '</li>';
    }
    ksort($list);
    $icons_complete = '<ul class="rex-list-inline">' . implode('', $list) . '</ul>';
}
$fragment = new rex_fragment();
$fragment->setVar('content', '<h3>REDAXO Icons</h3>' . $icons_used, false);
echo $fragment->parse('core/page/section.php');
$fragment = new rex_fragment();
$fragment->setVar('content', '<h3>Font-Awesome Icons</h3>' . $icons_complete, false);
echo $fragment->parse('core/page/section.php');