/**
  * Generate text html of a output for preview and sending email
  *
  * @see classes/cjwnewslettermail.php getAllOutputFormatTextByContentObjectVersion()
  * @see modules/newsletter/preview.php
  * @param unknown_type $editionContentObjectId
  * @param unknown_type $versionId
  * @param unknown_type $outputFormat
  * @param string $siteAccess
  * @param string $skinName
  * @param int $forceImageIncludeSettings -1 - use default settings
  *                                       1 - force do not render all img to file://settings from newsletterContentArray['html_mail_image_include'] will be used
  *                                       0 - force renders all img to file://
  * @return array
  */
 static function getOutput($editionContentObjectId, $versionId, $outputFormat, $siteAccess, $skinName = 'default', $forceSettingImageIncludeTo = -1)
 {
     if ($skinName == '') {
         $skinName = 'default';
     }
     $cjwNewsletterIni = eZINI::instance('cjw_newsletter.ini');
     $phpCli = $cjwNewsletterIni->variable('NewsletterSettings', 'PhpCli');
     $currentHostName = eZSys::hostname();
     $wwwDir = eZSys::wwwDir();
     //$wwwDir = 'tmp';
     $wwwDirString = '';
     if ($wwwDir != '') {
         $wwwDirString = "--www_dir={$wwwDir} ";
     }
     $cmd = "\"{$phpCli}\" extension/cjw_newsletter/bin/php/createoutput.php --object_id={$editionContentObjectId} --object_version={$versionId} --output_format_id={$outputFormat} {$wwwDirString}--current_hostname={$currentHostName} --skin_name={$skinName} -s {$siteAccess}";
     $fileSep = eZSys::fileSeparator();
     $cmd = str_replace('/', $fileSep, $cmd);
     eZDebug::writeDebug("shell_exec( {$cmd} )", 'newsletter/preview');
     // echo "<hr>$cmd<hr>";
     $returnValue = shell_exec(escapeshellcmd($cmd));
     $newsletterContentArray = unserialize(trim($returnValue));
     if (CjwNewsletterEdition::imageIncludeIsEnabled()) {
         $htmlMailImageInclude = 1;
     }
     // forpreview
     $imageInclude = false;
     // render file:// if we want to force it
     // or use setting from $newsletterContentArray['html_mail_image_include']
     if ($forceSettingImageIncludeTo === -1 && $newsletterContentArray['html_mail_image_include'] === 1) {
         $imageInclude = true;
     } elseif ($forceSettingImageIncludeTo === 1) {
         $imageInclude = true;
     } elseif ($forceSettingImageIncludeTo === 0) {
         // $imageInclude = false;
     }
     if ($imageInclude === true) {
         $newsletterContentArray = CjwNewsletterEdition::prepareImageInclude($newsletterContentArray);
     }
     return $newsletterContentArray;
 }
Esempio n. 2
0
     // html 0
 // html 0
 case CjwNewsletterSubscription::OUTPUT_FORMAT_HTML:
     // textpart
     $template = 'design:newsletter/skin/' . $skinName . '/outputformat/text.tpl';
     $content = $tpl->fetch($template);
     $content = generateAbsoluteLinks($content, $urlArray);
     $content = formatText($content);
     $newsletterEditionContent['text'] = $content;
     // htmlpart
     $template = 'design:newsletter/skin/' . $skinName . '/outputformat/html.tpl';
     $content = $tpl->fetch($template);
     $content = generateAbsoluteLinks($content, $urlArray);
     $newsletterEditionContent['html'] = $content;
     $contentType = 'multipart/alternative';
     if (CjwNewsletterEdition::imageIncludeIsEnabled()) {
         $htmlMailImageInclude = 1;
     }
     break;
     // text 1
 // text 1
 case CjwNewsletterSubscription::OUTPUT_FORMAT_TEXT:
     $template = 'design:newsletter/skin/' . $skinName . '/outputformat/text.tpl';
     $content = $tpl->fetch($template);
     // TODO text version erstellen
     $content = generateAbsoluteLinks($content, $urlArray);
     $content = formatText($content);
     $newsletterEditionContent['text'] = $content;
     $contentType = 'text/plain';
     break;
     // text - html