当前位置: 首页>>代码示例>>PHP>>正文


PHP HTML_Template_Flexy::resolvePath方法代码示例

本文整理汇总了PHP中HTML_Template_Flexy::resolvePath方法的典型用法代码示例。如果您正苦于以下问题:PHP HTML_Template_Flexy::resolvePath方法的具体用法?PHP HTML_Template_Flexy::resolvePath怎么用?PHP HTML_Template_Flexy::resolvePath使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在HTML_Template_Flexy的用法示例。


在下文中一共展示了HTML_Template_Flexy::resolvePath方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: toData

 /**
  * ---------------- Global Tools ---------------   
  */
 function toData()
 {
     $templateFile = $this->template;
     $args = (array) $this->contents;
     $content = clone $this->page;
     foreach ($args as $k => $v) {
         $content->{$k} = $v;
     }
     $content->msgid = empty($content->msgid) ? md5(time() . rand()) : $content->msgid;
     $ff = HTML_FlexyFramework::get();
     $http_host = isset($_SERVER["HTTP_HOST"]) ? $_SERVER["HTTP_HOST"] : 'pman.HTTP_HOST.not.set';
     if (isset($ff->Pman['HTTP_HOST'])) {
         $http_host = $ff->Pman['HTTP_HOST'];
     }
     $content->HTTP_HOST = $http_host;
     // this should be done by having multiple template sources...!!!
     require_once 'HTML/Template/Flexy.php';
     $tmp_opts = array('site_prefix' => false);
     if (!empty($this->templateDir)) {
         $tmp_opts['templateDir'] = $this->templateDir;
     }
     $fopts = HTML_FlexyFramework::get()->HTML_Template_Flexy;
     if (!empty($fopts['DB_DataObject_translator'])) {
         $tmp_opts['DB_DataObject_translator'] = $fopts['DB_DataObject_translator'];
     }
     if (!empty($fopts['locale'])) {
         $tmp_opts['locale'] = $fopts['locale'];
     }
     // local opt's overwrite
     if (!empty($this->locale)) {
         $tmp_opts['locale'] = $this->locale;
     }
     $htmlbody = false;
     $html_tmp_opts = $tmp_opts;
     $htmltemplate = new HTML_Template_Flexy($html_tmp_opts);
     if (is_string($htmltemplate->resolvePath('mail/' . $templateFile . '.body.html'))) {
         // then we have a multi-part email...
         if (!empty($this->html_locale)) {
             $html_tmp_opts['locale'] = $this->html_locale;
         }
         $htmltemplate = new HTML_Template_Flexy($html_tmp_opts);
         $htmltemplate->compile('mail/' . $templateFile . '.body.html');
         $htmlbody = $htmltemplate->bufferedOutputObject($content);
         $this->htmlbody = $htmlbody;
         // for the html body, we may want to convert the attachments to images.
         //            var_dump($htmlbody);exit;
         if ($this->replaceImages) {
             $htmlbody = $this->htmlbodytoCID($htmlbody);
         }
         if ($this->css_embed) {
             $htmlbody = $this->htmlbodyCssEmbed($htmlbody);
         }
     }
     $tmp_opts['nonHTML'] = true;
     //print_R($tmp_opts);
     // $tmp_opts['force'] = true;
     $template = new HTML_Template_Flexy($tmp_opts);
     $template->compile('mail/' . $templateFile . '.txt');
     /* use variables from this object to ouput data. */
     $mailtext = $template->bufferedOutputObject($content);
     //print_r($mailtext);exit;
     //echo "<PRE>";print_R($mailtext);
     /* With the output try and send an email, using a few tricks in Mail_MimeDecode. */
     require_once 'Mail/mimeDecode.php';
     require_once 'Mail.php';
     $decoder = new Mail_mimeDecode($mailtext);
     $parts = $decoder->getSendArray();
     if (PEAR::isError($parts)) {
         return $parts;
         //echo "PROBLEM: {$parts->message}";
         //exit;
     }
     $isMime = false;
     require_once 'Mail/mime.php';
     $mime = new Mail_mime(array('eol' => "\n", 'html_charset' => 'utf-8', 'text_charset' => 'utf-8', 'head_charset' => 'utf-8'));
     // clean up the headers...
     $parts[1]['Message-Id'] = '<' . $content->msgid . '@' . $content->HTTP_HOST . '>';
     if ($htmlbody !== false) {
         // got a html headers...
         if (isset($parts[1]['Content-Type'])) {
             unset($parts[1]['Content-Type']);
         }
         $mime->setTXTBody($parts[2]);
         $mime->setHTMLBody($htmlbody);
         //            var_dump($mime);exit;
         foreach ($this->images as $cid => $cdata) {
             $mime->addHTMLImage($cdata['file'], $cdata['mimetype'], $cid . '.' . $cdata['ext'], true, $cdata['contentid']);
         }
         $isMime = true;
     }
     if (!empty($this->attachments)) {
         //if got a attachments
         $header = $mime->headers($parts[1]);
         if (isset($parts[1]['Content-Type'])) {
             unset($parts[1]['Content-Type']);
         }
         if (!$isMime) {
//.........这里部分代码省略.........
开发者ID:roojs,项目名称:Pman.Core,代码行数:101,代码来源:Mailer.php

示例2: buildMail

 /**
  *
  *
  *
  *
  *  FIXME !!!! -- USE Pman_Core_Mailer !!!!!
  *
  *
  *
  *  
  */
 function buildMail($templateFile, $args)
 {
     $args = (array) $args;
     $content = clone $this;
     foreach ((array) $args as $k => $v) {
         $content->{$k} = $v;
     }
     $ff = HTML_FlexyFramework::get();
     //?? is this really the place for this???
     if (!$ff->cli && empty($args['no_auth']) && !in_array($templateFile, array('password_reset', 'password_welcome'))) {
         $content->authUser = $this->getAuthUser();
         if (!$content->authUser) {
             return PEAR::raiseError("Not authenticated");
         }
     }
     // should handle x-forwarded...
     $content->HTTP_HOST = isset($_SERVER["HTTP_HOST"]) ? $_SERVER["HTTP_HOST"] : (isset($ff->HTTP_HOST) ? $ff->HTTP_HOST : 'localhost');
     /* use the regex compiler, as it doesnt parse <tags */
     $tops = array('compiler' => 'Flexy', 'nonHTML' => true, 'filters' => array('SimpleTags', 'Mail'));
     if (!empty($args['templateDir'])) {
         $tops['templateDir'] = $args['templateDir'];
     }
     require_once 'HTML/Template/Flexy.php';
     $template = new HTML_Template_Flexy($tops);
     $template->compile("mail/{$templateFile}.txt");
     /* use variables from this object to ouput data. */
     $mailtext = $template->bufferedOutputObject($content);
     $htmlbody = false;
     // if a html file with the same name exists, use that as the body
     // I've no idea where this code went, it was here before..
     if (false !== $template->resolvePath("mail/{$templateFile}.html")) {
         $tops['nonHTML'] = false;
         $template = new HTML_Template_Flexy($tops);
         $template->compile("mail/{$templateFile}.html");
         $htmlbody = $template->bufferedOutputObject($content);
     }
     //echo "<PRE>";print_R($mailtext);
     //print_R($mailtext);exit;
     /* With the output try and send an email, using a few tricks in Mail_MimeDecode. */
     require_once 'Mail/mimeDecode.php';
     require_once 'Mail.php';
     $decoder = new Mail_mimeDecode($mailtext);
     $parts = $decoder->getSendArray();
     if (PEAR::isError($parts)) {
         return $parts;
         //echo "PROBLEM: {$parts->message}";
         //exit;
     }
     list($recipents, $headers, $body) = $parts;
     $recipents = array($this->email);
     if (!empty($content->bcc) && is_array($content->bcc)) {
         $recipents = array_merge($recipents, $content->bcc);
     }
     $headers['Date'] = date('r');
     if ($htmlbody !== false) {
         require_once 'Mail/mime.php';
         $mime = new Mail_mime(array('eol' => "\n"));
         $mime->setTXTBody($body);
         $mime->setHTMLBody($htmlbody);
         // I think there might be code in mediaoutreach toEmail somewhere
         // h embeds images here..
         $body = $mime->get();
         $headers = $mime->headers($headers);
     }
     return array('recipients' => $recipents, 'headers' => $headers, 'body' => $body);
 }
开发者ID:roojs,项目名称:Pman.Core,代码行数:77,代码来源:Core_person.php


注:本文中的HTML_Template_Flexy::resolvePath方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。