本文整理汇总了PHP中PHPRtfLite::quoteRtfCode方法的典型用法代码示例。如果您正苦于以下问题:PHP PHPRtfLite::quoteRtfCode方法的具体用法?PHP PHPRtfLite::quoteRtfCode怎么用?PHP PHPRtfLite::quoteRtfCode使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PHPRtfLite
的用法示例。
在下文中一共展示了PHPRtfLite::quoteRtfCode方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getContent
/**
* renders footnote/endnote
*
* @return string
*/
public function getContent()
{
$content = '\\chftn ' . '{\\footnote' . ($this->isFootnote() ? '' : '\\ftnalt') . '\\pard\\plain \\lin283\\fi-283 ';
if ($this->_parFormat) {
$content .= $this->_parFormat->getContent($this->_rtf);
}
$content .= $this->_font->getContent($this->_rtf);
$content .= '{\\up6\\chftn}' . "\r\n" . PHPRtfLite::quoteRtfCode($this->_text) . '} ';
return $content;
}
示例2: getOpeningToken
/**
* gets opening token
*
* @return string
*/
protected function getOpeningToken()
{
$hyperlink = PHPRtfLite::quoteRtfCode($this->_hyperlink);
return '{\\field {\\*\\fldinst {HYPERLINK "' . $hyperlink . '"}}{\\fldrslt {';
}
示例3: render
/**
* renders footnote/endnote
*/
public function render()
{
$stream = $this->_rtf->getWriter();
$typeSetting = $this->_typeSettingType != self::TYPE_NORMAL ? '\\' . $this->_typeSettingType : '';
$stream->write('{' . $typeSetting . '\\chftn}' . '{' . $this->getTypeAsRtfCode() . '\\pard\\plain\\lin283\\fi-283 ');
if ($this->_parFormat) {
$stream->write($this->_parFormat->getContent());
}
if ($this->_font) {
$stream->write($this->_font->getContent());
}
$stream->write('{\\up6\\chftn}' . "\r\n" . PHPRtfLite::quoteRtfCode($this->_text) . '} ');
}
示例4: render
/**
* renders the element
*/
public function render()
{
$stream = $this->_rtf->getWriter();
$text = $this->_text;
if (!$this->_isRtfCode) {
$charset = $this->_rtf->getCharset();
$text = PHPRtfLite::quoteRtfCode($text);
if ($this->_convertTagsToRtf) {
$text = self::convertTagsToRtf($text, $charset);
}
$text = PHPRtfLite_Utf8::getUnicodeEntities($text, $charset);
}
$stream->write($this->getOpeningToken());
if ($this->_font) {
$stream->write($this->_font->getContent());
}
if ($this->isEmptyParagraph() && !$this->_isRtfCode) {
$stream->write('\\par');
} else {
$stream->write($text);
}
$stream->write($this->getClosingToken() . "\r\n");
}
示例5: writeText
/**
* Writes text to container.
*
* @param string $text Text. Also you can use html style tags. Possible tags:<br>
* strong, b- bold; <br>
* em - ; <br>
* i - italic; <br>
* u - underline; <br>
* br - line break; <br>
* chdate - current date; <br>
* chdpl - current date in long format; <br>
* chdpa - current date in abbreviated format; <br>
* chtime - current time; <br>
* chpgn, pagenum - page number ; <br>
* tab - tab
* sectnum - section number; <br>
* line - line break; <br>
* page - page break; <br>
* sect - section break; <br>
* @param PHPRtfLite_Font $font font of text
* @param PHPRtfLite_ParFormat $parFormat paragraph format, if null, text is written in the same paragraph.
* @param boolean $replaceTags if false, then html style tags are not replaced with rtf code
* @todo Documentation
*/
public function writeText($text, PHPRtfLite_Font $font = null, PHPRtfLite_ParFormat $parFormat = null, $replaceTags = true)
{
$text = PHPRtfLite::quoteRtfCode($text);
if ($replaceTags) {
//bold
$text = preg_replace('/<STRONG[ ]*>(.*?)<\\/STRONG[ ]*>/smi', '\\b \\1\\b0 ', $text);
$text = preg_replace('/<B[ ]*>(.*?)<\\/B[ ]*>/smi', '\\b \\1\\b0 ', $text);
//italic
$text = preg_replace('/<EM[ ]*>(.*?)<\\/EM[ ]*>/smi', '\\i \\1\\i0 ', $text);
$text = preg_replace('/<I[ ]*>(.*?)<\\/I[ ]*>/smi', '\\i \\1\\i0 ', $text);
//underline
$text = preg_replace('/<U[ ]*>(.*?)<\\/U[ ]*>/smi', '\\ul \\1\\ul0 ', $text);
//break
$text = preg_replace('/<BR[ ]*(\\/)?[ ]*>/smi', '\\line ', $text);
//horizontal rule
$text = preg_replace('/<HR[ ]*(\\/)?[ ]*>/smi', '{\\pard \\brdrb \\brdrs \\brdrw10 \\brsp20 \\par}', $text);
$text = preg_replace('/<CHDATE[ ]*(\\/)?[ ]*>/smi', '\\chdate ', $text);
$text = preg_replace('/<CHDPL[ ]*(\\/)?[ ]*>/smi', '\\\\chdpl ', $text);
$text = preg_replace('/<CHDPA[ ]*(\\/)?[ ]*>/smi', '\\chdpa ', $text);
$text = preg_replace('/<CHTIME[ ]*(\\/)?[ ]*>/smi', '\\chtime ', $text);
$text = preg_replace('/<CHPGN[ ]*(\\/)?[ ]*>/smi', '\\chpgn ', $text);
$text = preg_replace('/<TAB[ ]*(\\/)?[ ]*>/smi', '\\tab ', $text);
$text = preg_replace('/<BULLET[ ]*(\\/)?[ ]*>/smi', '\\bullet ', $text);
$text = preg_replace('/<PAGENUM[ ]*(\\/)?[ ]*>/smi', '\\chpgn ', $text);
$text = preg_replace('/<SECTNUM[ ]*(\\/)?[ ]*>/smi', '\\sectnum ', $text);
$text = preg_replace('/<LINE[ ]*(\\/)?[ ]*>/smi', '\\line ', $text);
//$text = preg_replace('/<PAGE[ ]*(\/)?[ ]*>/smi', '\\page ', $text);
//$text = preg_replace('/<SECT[ ]*(\/)?[ ]*>/smi', '\\sect', $text);
}
$text = PHPRtfLite_Utf8::getUnicodeEntities($text);
//content formating
$content = $parFormat && count($this->_elements) != 0 && !$this->_emptyPar ? '\\par ' : '';
$this->_emptyPar = false;
$content .= $parFormat ? $this->_pard . $parFormat->getContent($this->_rtf) : '';
$content .= '{';
if ($font) {
$content .= $font->getContent($this->_rtf);
}
$content .= $text . '}' . "\r\n";
$this->_elements[] = $content;
}
示例6: getListCharacter
/**
* gets list character
*
* @param integer $number
* @return string
*/
protected function getListCharacter($number)
{
$listCharacter = $this->_prefix . $this->getNumber($number) . $this->_suffix;
return PHPRtfLite::quoteRtfCode($listCharacter);
}
示例7: testQuoteRtfCode
/**
* @dataProvider provideQuoteRtfCode()
*/
public function testQuoteRtfCode($testString, $resultString)
{
$this->assertEquals($resultString, PHPRtfLite::quoteRtfCode($testString));
}