本文整理汇总了PHP中TYPO3\CMS\Core\Utility\MailUtility::breakLinesForEmail方法的典型用法代码示例。如果您正苦于以下问题:PHP MailUtility::breakLinesForEmail方法的具体用法?PHP MailUtility::breakLinesForEmail怎么用?PHP MailUtility::breakLinesForEmail使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TYPO3\CMS\Core\Utility\MailUtility
的用法示例。
在下文中一共展示了MailUtility::breakLinesForEmail方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: renderInternal
/**
* Render the given element
*
* @return array
*/
public function renderInternal()
{
$headerWrap = MailUtility::breakLinesForEmail(trim($this->contentObject->data['header']), LF, Configuration::getPlainTextWith());
$subHeaderWrap = MailUtility::breakLinesForEmail(trim($this->contentObject->data['subheader']), LF, Configuration::getPlainTextWith());
// align
$header = array_merge(GeneralUtility::trimExplode(LF, $headerWrap, TRUE), GeneralUtility::trimExplode(LF, $subHeaderWrap, TRUE));
if ($this->contentObject->data['header_position'] == 'right') {
foreach ($header as $key => $l) {
$l = trim($l);
$header[$key] = str_pad(' ', Configuration::getPlainTextWith() - strlen($l), ' ', STR_PAD_LEFT) . $l;
}
} elseif ($this->contentObject->data['header_position'] == 'center') {
foreach ($header as $key => $l) {
$l = trim($l);
$header[$key] = str_pad(' ', floor((Configuration::getPlainTextWith() - strlen($l)) / 2), ' ', STR_PAD_LEFT) . $l;
}
}
$header = implode(LF, $header);
$lines[] = $header;
return $lines;
}
示例2: breakLines
/**
* Breaking lines into fixed length lines, using GeneralUtility::breakLinesForEmail()
*
* @param string $content The string to break
* @param array $conf Configuration options: linebreak, charWidth; stdWrap enabled
*
* @return string Processed string
* @see GeneralUtility::breakLinesForEmail()
*/
public function breakLines($content, array $conf)
{
$linebreak = $GLOBALS['TSFE']->cObj->stdWrap($conf['linebreak'] ? $conf['linebreak'] : chr(32) . LF, $conf['linebreak.']);
$charWidth = $GLOBALS['TSFE']->cObj->stdWrap($conf['charWidth'] ? intval($conf['charWidth']) : 76, $conf['charWidth.']);
return MailUtility::breakLinesForEmail($content, $linebreak, $charWidth);
}
示例3: breakLinesForEmailBreaksTextIfLineIsLongerThanTheLineWidth
/**
* @test
*/
public function breakLinesForEmailBreaksTextIfLineIsLongerThanTheLineWidth()
{
$str = 'Mein Link auf eine News (Link: http://zzzzzzzzzzzzz.xxxxxxxxx.de/index.php?id=10&tx_ttnews%5Btt_news%5D=1&cHash=66f5af320da29b7ae1cda49047ca7358)';
$returnString = \TYPO3\CMS\Core\Utility\MailUtility::breakLinesForEmail($str);
$this->assertEquals($returnString, 'Mein Link auf eine News (Link:' . LF . 'http://zzzzzzzzzzzzz.xxxxxxxxx.de/index.php?id=10&tx_ttnews%5Btt_news%5D=1&cHash=66f5af320da29b7ae1cda49047ca7358)');
}
示例4: breakLines
/**
* Breaking lines into fixed length lines, using GeneralUtility::breakLinesForEmail()
*
* @param string $str : The string to break
* @param string $implChar : Line break character
* @param integer $charWidth : Length of lines, default is $this->charWidth
*
* @return string Processed string
*/
function breakLines($str, $implChar = LF, $charWidth = FALSE)
{
$charWidth = $charWidth === FALSE ? Configuration::getPlainTextWith() : (int) $charWidth;
return MailUtility::breakLinesForEmail($str, $implChar, $charWidth);
}
示例5: breakLinesForEmailBreaksTextWithNoSpaceFoundBeforeLimit
/**
* @test
*/
public function breakLinesForEmailBreaksTextWithNoSpaceFoundBeforeLimit()
{
$newlineChar = LF;
$lineWidth = 10;
// first space after 20 chars (more than $lineWidth)
$str = 'abcdefghijklmnopqrst uvwxyz 123456';
$returnString = \TYPO3\CMS\Core\Utility\MailUtility::breakLinesForEmail($str, $newlineChar, $lineWidth);
$this->assertEquals($returnString, 'abcdefghijklmnopqrst' . LF . 'uvwxyz' . LF . '123456');
}
示例6: breakLines
/**
* Breaking lines into fixed length lines, using MailUtility::breakLinesForEmail()
*
* @param string $str: The string to break
* @param string $implChar: Line break character
* @param integer $charWidth: Length of lines, default is $this->charWidth
* @return string Processed string
* @see MailUtility::breakLinesForEmail()
*/
function breakLines($str, $implChar, $charWidth = 0)
{
$cW = $charWidth ? $charWidth : $this->charWidth;
$linebreak = $implChar ? $implChar : $this->linebreak;
return MailUtility::breakLinesForEmail($str, $linebreak, $cW);
}