ConvertHeadersStylesPlugin   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 0
Metric Value
dl 0
loc 27
rs 10
c 0
b 0
f 0
wmc 5
lcom 0
cbo 1

2 Methods

Rating   Name   Duplication   Size   Complexity  
A Init() 0 4 1
A FilterResultMessage() 0 16 4
1
<?php
2
3
class ConvertHeadersStylesPlugin extends \RainLoop\Plugins\AbstractPlugin
4
{
5
	public function Init()
6
	{
7
		$this->addHook('filter.result-message', 'FilterResultMessage');
8
	}
9
10
	/**
11
	 * @param \MailSo\Mail\Message &$oMessage
12
	 */
13
	public function FilterResultMessage(&$oMessage)
14
	{
15
		if ($oMessage)
16
		{
17
			$sHtml = $oMessage->Html();
18
			if ($sHtml && 0 < strlen($sHtml))
19
			{
20
				include_once __DIR__.'/CssToInlineStyles.php';
21
				
22
				$oCSSToInlineStyles = new \TijsVerkoyen\CssToInlineStyles\CssToInlineStyles($sHtml);
23
				$oCSSToInlineStyles->setEncoding('utf-8');
24
				$oCSSToInlineStyles->setUseInlineStylesBlock(true);
25
				$oMessage->SetHtml($oCSSToInlineStyles->convert().'<!-- convert-headers-styles-plugin -->');
26
			}
27
		}
28
	}
29
}
30