本文整理汇总了PHP中Zend_Mime::encodeQuotedPrintable方法的典型用法代码示例。如果您正苦于以下问题:PHP Zend_Mime::encodeQuotedPrintable方法的具体用法?PHP Zend_Mime::encodeQuotedPrintable怎么用?PHP Zend_Mime::encodeQuotedPrintable使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Zend_Mime
的用法示例。
在下文中一共展示了Zend_Mime::encodeQuotedPrintable方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _encodeHeader
/**
* Encode header fields
*
* Encodes header content according to RFC1522 if it contains non-printable
* characters.
*
* @param string $value
* @return string
*/
protected function _encodeHeader($value)
{
if (Zend_Mime::isPrintable($value)) {
return $value;
} else {
$quotedValue = Zend_Mime::encodeQuotedPrintable($value, 400);
$quotedValue = str_replace(array('?', ' ', '_'), array('=3F', '=20', '=5F'), $quotedValue);
return '=?' . $this->_charset . '?Q?' . $quotedValue . '?=';
}
}
示例2: testQP
public function testQP()
{
$text = "This is a cool Test Text with special chars: дцья\n"
. "and with multiple linesдцья some of the Lines are long, long"
. ", long, long, long, long, long, long, long, long, long, long"
. ", long, long, long, long, long, long, long, long, long, long"
. ", long, long, long, long, long, long, long, long, long, long"
. ", long, long, long, long and with дцья";
$qp = Zend_Mime::encodeQuotedPrintable($text);
$this->assertEquals(quoted_printable_decode($qp), $text);
}
示例3: _encodeHeader
protected function _encodeHeader($value)
{
if (Zend_Mime::isPrintable($value)) {
return $value;
} else {
$quotedValue = Zend_Mime::encodeQuotedPrintable($value);
$quotedValue = str_replace(array('?', ' '), array('=3F', '=20'), $quotedValue);
$quotedValue = rawurlencode($quotedValue);
$quotedValue = str_replace('%3D%0A', '', $quotedValue);
$quotedValue = rawurldecode($quotedValue);
$quotedValue = '=?' . $this->_charset . '?Q?' . $quotedValue . '?=';
}
return $quotedValue;
}
示例4: encodeXdfnVariable
/**
* @param mixed $variableName
* @param mixed $variableValue
* @return string
*/
protected function encodeXdfnVariable($variableName, $variableValue)
{
if ($this->isReservedVariable($variableName)) {
$variableName = '*' . $variableName;
//reserved variables are prefixed
}
if ($variableName == '*parts') {
$encoded = sprintf('%s=%s', $variableName, $variableValue);
} else {
$variableValue = addslashes($variableValue);
$variableValue = Zend_Mime::encodeQuotedPrintable($variableValue, 4096);
$variableValue = str_replace("\r", "", $variableValue);
$variableValue = str_replace("\n", " ", $variableValue);
$encoded = sprintf('%s="%s"', $variableName, $variableValue);
}
return $encoded;
}
示例5: _encodeHeader
/**
* Encode header fields
*
* Encodes header content according to RFC1522 if it contains non-printable
* characters.
*
* @param string $value
* @return string
*/
protected function _encodeHeader($value)
{
if (Zend_Mime::isPrintable($value)) {
return $value;
} elseif ($this->_encodingOfHeaders === Zend_Mime::ENCODING_QUOTEDPRINTABLE) {
$quotedValue = Zend_Mime::encodeQuotedPrintable($value);
$quotedValue = str_replace(array('?', ' ', '_'), array('=3F', '=20', '=5F'), $quotedValue);
return '=?' . $this->_charset . '?Q?' . $quotedValue . '?=';
} elseif ($this->_encodingOfHeaders === Zend_Mime::ENCODING_BASE64) {
return '=?' . $this->_charset . '?B?' . Zend_Mime::encodeBase64($value) . '?=';
} else {
/**
* @todo 7Bit and 8Bit is currently handled the same way.
*/
return $value;
}
}
示例6: Zend_Http_Client
$client = new Zend_Http_Client("http://de.wikipedia.org/w/index.php?title=PHP&printable=yes");
$string = $client->request()->getBody();
echo "===================================================================\n";
echo "RUNNING BENCHMARK\n";
echo "===================================================================\n";
echo "Starting encoding with imap_8bit() (" . LOOPS . " times)\n";
$startTime = microtime(true);
for ($i = 0; $i < LOOPS; $i++) {
imap_8bit($string);
}
$durationImap_8bit = microtime(true) - $startTime;
echo "Duration: " . round($durationImap_8bit, 4) . " seconds\n\n";
echo "Starting encoding with Zend_Mime::encodeQuotedPrintable() (" . LOOPS . " times)\n";
$startTime = microtime(true);
for ($i = 0; $i < LOOPS; $i++) {
Zend_Mime::encodeQuotedPrintable($string, Zend_Mime::LINELENGTH, Zend_Mime::LINEEND);
}
$durationZendMime = microtime(true) - $startTime;
echo "Duration: " . round($durationZendMime, 4) . " seconds\n\n";
echo "Starting encoding with quoted_printable_encode() (" . LOOPS . " times)\n";
$startTime = microtime(true);
for ($i = 0; $i < LOOPS; $i++) {
quoted_printable_encode($string);
}
$durationQPE = microtime(true) - $startTime;
echo "Duration: " . round($durationQPE, 4) . " seconds\n\n";
echo "===================================================================\n";
echo "SUMMARY\n";
echo "===================================================================\n";
echo "imap_8bit() is " . round($durationZendMime - $durationImap_8bit, 4) . " seconds faster than Zend_Mime!\n";
echo "It is " . round($durationZendMime / $durationImap_8bit, 2) . " times faster\n\n";