Skip to content
Permalink
Browse files

Removed mb_* function checks

  • Loading branch information...
jrbasso committed Sep 14, 2012
1 parent 32a066c commit e7af1be61371ee419977b5e2959cd2b0b87515f4
@@ -1203,18 +1203,13 @@ public function reset() {
* @return string Encoded string
*/
protected function _encode($text) {
$internalEncoding = function_exists('mb_internal_encoding');
if ($internalEncoding) {
$restore = mb_internal_encoding();
mb_internal_encoding($this->_appCharset);
}
$restore = mb_internal_encoding();
mb_internal_encoding($this->_appCharset);
if (empty($this->headerCharset)) {
$this->headerCharset = $this->charset;
}
$return = mb_encode_mimeheader($text, $this->headerCharset, 'B');
if ($internalEncoding) {
mb_internal_encoding($restore);
}
mb_internal_encoding($restore);
return $return;
}
@@ -1227,7 +1222,7 @@ protected function _encode($text) {
* @return string
*/
protected function _encodeString($text, $charset) {
if ($this->_appCharset === $charset || !function_exists('mb_convert_encoding')) {
if ($this->_appCharset === $charset) {
return $text;
}
return mb_convert_encoding($text, $charset, $this->_appCharset);
@@ -477,7 +477,7 @@ protected function _setContentLength() {
}
if ($shouldSetLength && !$this->outputCompressed()) {
$offset = ob_get_level() ? ob_get_length() : 0;
if (ini_get('mbstring.func_overload') & 2 && function_exists('mb_strlen')) {
if (ini_get('mbstring.func_overload') & 2) {
$this->length($offset + mb_strlen($this->_body, '8bit'));
} else {
$this->length($this->_headers['Content-Length'] = $offset + strlen($this->_body));
@@ -302,8 +302,6 @@ public function testFormatAddress() {
* @return void
*/
public function testFormatAddressJapanese() {
$this->skipIf(!function_exists('mb_convert_encoding'));
$this->CakeEmail->headerCharset = 'ISO-2022-JP';
$result = $this->CakeEmail->formatAddress(array('cake@cakephp.org' => '日本語Test'));
$expected = array('=?ISO-2022-JP?B?GyRCRnxLXDhsGyhCVGVzdA==?= <cake@cakephp.org>');
@@ -445,7 +443,6 @@ public function testSubject() {
* @return void
*/
public function testSubjectJapanese() {
$this->skipIf(!function_exists('mb_convert_encoding'));
mb_internal_encoding('UTF-8');
$this->CakeEmail->headerCharset = 'ISO-2022-JP';
@@ -1048,8 +1045,6 @@ public function testSendRender() {
* @return void
*/
public function testSendRenderJapanese() {
$this->skipIf(!function_exists('mb_convert_encoding'));
$this->CakeEmail->reset();
$this->CakeEmail->transport('debug');
@@ -1115,7 +1110,6 @@ public function testSendRenderWithVars() {
* @return void
*/
public function testSendRenderWithVarsJapanese() {
$this->skipIf(!function_exists('mb_convert_encoding'));
$this->CakeEmail->reset();
$this->CakeEmail->transport('debug');
@@ -1601,7 +1595,6 @@ public function testConfigCharset() {
* @return void
*/
public function testHeaderEncoding() {
$this->skipIf(!function_exists('mb_convert_encoding'));
$email = new Email(array('headerCharset' => 'iso-2022-jp-ms', 'transport' => 'Debug'));
$email->subject('あれ?もしかしての前と');
$headers = $email->getHeaders(array('subject'));
@@ -1619,7 +1612,6 @@ public function testHeaderEncoding() {
* @return void
*/
public function testBodyEncoding() {
$this->skipIf(!function_exists('mb_convert_encoding'));
$email = new Email(array(
'charset' => 'iso-2022-jp',
'headerCharset' => 'iso-2022-jp-ms',
@@ -1642,7 +1634,6 @@ public function testBodyEncoding() {
* @return void
*/
public function testBodyEncodingIso2022Jp() {
$this->skipIf(!function_exists('mb_convert_encoding'));
$email = new Email(array(
'charset' => 'iso-2022-jp',
'headerCharset' => 'iso-2022-jp',
@@ -1666,7 +1657,6 @@ public function testBodyEncodingIso2022Jp() {
* @return void
*/
public function testBodyEncodingIso2022JpMs() {
$this->skipIf(!function_exists('mb_convert_encoding'));
$email = new Email(array(
'charset' => 'iso-2022-jp-ms',
'headerCharset' => 'iso-2022-jp-ms',
@@ -1717,8 +1707,6 @@ protected function _checkContentTransferEncoding($message, $charset) {
* @return void
*/
public function testEncode() {
$this->skipIf(!function_exists('mb_convert_encoding'));
$this->CakeEmail->headerCharset = 'ISO-2022-JP';
$result = $this->CakeEmail->encode('日本語');
$expected = '=?ISO-2022-JP?B?GyRCRnxLXDhsGyhC?=';
@@ -1770,8 +1758,6 @@ public function testHeaderCharset() {
* headerCharset property and headerCharset() method.
*/
public function testCharsetsCompatible() {
$this->skipIf(!function_exists('mb_convert_encoding'));
$checkHeaders = array(
'from' => true,
'to' => true,

0 comments on commit e7af1be

Please sign in to comment.
You can’t perform that action at this time.