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


PHP SSViewer::exists方法代码示例

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


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

示例1: parseVariables

 /**
  * Load all the template variables into the internal variables, including
  * the template into body.	Called before send() or debugSend()
  * $isPlain=true will cause the template to be ignored, otherwise the GenericEmail template will be used
  * and it won't be plain email :)
  *
  * This function is updated to rewrite urls in a safely manner and inline css.
  * It will also changed the requirements backend to avoid requiring stuff in the html.
  */
 protected function parseVariables($isPlain = false)
 {
     $origState = Config::inst()->get('SSViewer', 'source_file_comments');
     Config::inst()->update('SSViewer', 'source_file_comments', false);
     // Workaround to avoid clutter in our rendered html
     $backend = Requirements::backend();
     Requirements::set_backend(new MandrillRequirementsBackend());
     if (!$this->parseVariables_done) {
         $this->parseVariables_done = true;
         if (!$this->original_body) {
             $this->original_body = $this->body;
         }
         // Parse $ variables in the base parameters
         $data = $this->templateData();
         // Process a .SS template file
         $fullBody = $this->original_body;
         if ($this->parse_body) {
             try {
                 $viewer = new SSViewer_FromString($fullBody);
                 $fullBody = $viewer->process($data);
             } catch (Exception $ex) {
                 SS_Log::log($ex->getMessage(), SS_Log::DEBUG);
             }
             // Also parse the email title
             try {
                 $viewer = new SSViewer_FromString($this->subject);
                 $this->subject = $viewer->process($data);
             } catch (Exception $ex) {
                 SS_Log::log($ex->getMessage(), SS_Log::DEBUG);
             }
             if ($this->callout) {
                 try {
                     $viewer = new SSViewer_FromString($this->callout);
                     $this->callout = $viewer->process($data);
                 } catch (Exception $ex) {
                     SS_Log::log($ex->getMessage(), SS_Log::DEBUG);
                 }
             }
             if ($this->sidebar) {
                 try {
                     $viewer = new SSViewer_FromString($this->sidebar);
                     $this->sidebar = $viewer->process($data);
                 } catch (Exception $ex) {
                     SS_Log::log($ex->getMessage(), SS_Log::DEBUG);
                 }
             }
         }
         if ($this->ss_template && !$isPlain) {
             // Requery data so that updated versions of To, From, Subject, etc are included
             $data = $this->templateData();
             $template = new SSViewer($this->ss_template);
             if ($template->exists()) {
                 // Make sure we included the parsed body into layout
                 $data->setField('Body', $fullBody);
                 try {
                     $fullBody = $template->process($data);
                 } catch (Exception $ex) {
                     SS_Log::log($ex->getMessage(), SS_Log::DEBUG);
                 }
             }
         }
         // Rewrite relative URLs
         $this->body = self::rewriteURLs($fullBody);
     }
     Config::inst()->update('SSViewer', 'source_file_comments', $origState);
     Requirements::set_backend($backend);
     return $this;
 }
开发者ID:Olliepop,项目名称:silverstripe-mandrill,代码行数:77,代码来源:MandrillEmail.php

示例2: parseVariables

 /**
  * Load all the template variables into the internal variables, including
  * the template into body.	Called before send() or debugSend()
  * $isPlain=true will cause the template to be ignored, otherwise the GenericEmail template will be used
  * and it won't be plain email :)
  */
 protected function parseVariables($isPlain = false)
 {
     $origState = Config::inst()->get('SSViewer', 'source_file_comments');
     Config::inst()->update('SSViewer', 'source_file_comments', false);
     if (!$this->parseVariables_done) {
         $this->parseVariables_done = true;
         // Parse $ variables in the base parameters
         $data = $this->templateData();
         // Process a .SS template file
         $fullBody = $this->body;
         if ($this->ss_template && !$isPlain) {
             // Requery data so that updated versions of To, From, Subject, etc are included
             $data = $this->templateData();
             $template = new SSViewer($this->ss_template);
             if ($template->exists()) {
                 $fullBody = $template->process($data);
             }
         }
         // Rewrite relative URLs
         $this->body = HTTP::absoluteURLs($fullBody);
     }
     Config::inst()->update('SSViewer', 'source_file_comments', $origState);
     return $this;
 }
开发者ID:congaaids,项目名称:silverstripe-framework,代码行数:30,代码来源:Email.php

示例3: parseVariables

	/**
	 * Load all the template variables into the internal variables, including
	 * the template into body.  Called before send() or debugSend()
	 * $isPlain=true will cause the template to be ignored, otherwise the GenericEmail template will be used
	 * and it won't be plain email :) 
	 */
	protected function parseVariables($isPlain = false) {
		if(!$this->parseVariables_done) {
			$this->parseVariables_done = true;

			// Parse $ variables in the base parameters
			$data = $this->templateData();
			
			foreach(array('from','to','subject','body', 'plaintext_body', 'cc', 'bcc') as $param) {
				$template = SSViewer::fromString($this->$param);
				$this->$param = $template->process($data);
			}
			
			// Process a .SS template file
			$fullBody = $this->body;
			if($this->ss_template && !$isPlain) {
				// Requery data so that updated versions of To, From, Subject, etc are included
				$data = $this->templateData();
				
				$template = new SSViewer($this->ss_template);
				
				if($template->exists()) {
					$fullBody = $template->process($data);
				}
			}
			
			// Rewrite relative URLs
			$this->body = HTTP::absoluteURLs($fullBody);
		}
	}
开发者ID:neopba,项目名称:silverstripe-book,代码行数:35,代码来源:Email.php


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