return $text;
}
-/**
- * @todo document
- */
-function wfQuotedPrintable( $string, $charset = '' ) {
- # Probably incomplete; see RFC 2045
- if( empty( $charset ) ) {
- global $wgInputEncoding;
- $charset = $wgInputEncoding;
- }
- $charset = strtoupper( $charset );
- $charset = str_replace( 'ISO-8859', 'ISO8859', $charset ); // ?
-
- $illegal = '\x00-\x08\x0b\x0c\x0e-\x1f\x7f-\xff=';
- $replace = $illegal . '\t ?_';
- if( !preg_match( "/[$illegal]/", $string ) ) {
- return $string;
- }
- $out = "=?$charset?Q?";
- $out .= preg_replace( "/([$replace])/e", 'sprintf("=%02X",ord("$1"))', $string );
- $out .= '?=';
- return $out;
-}
-
-
/**
* @todo document
* @return float
if ( $this->name != '' && !wfIsWindows() ) {
global $wgEnotifUseRealName;
$name = ( $wgEnotifUseRealName && $this->realName ) ? $this->realName : $this->name;
- $quoted = wfQuotedPrintable( $name );
+ $quoted = UserMailer::quotedPrintable( $name );
if ( strpos( $quoted, '.' ) !== false || strpos( $quoted, ',' ) !== false ) {
$quoted = '"' . $quoted . '"';
}
if ( $replyto ) {
$headers['Reply-To'] = $replyto->toString();
}
- $headers['Subject'] = wfQuotedPrintable( $subject );
+ $headers['Subject'] = self::quotedPrintable( $subject );
$headers['Date'] = date( 'r' );
$headers['MIME-Version'] = '1.0';
$headers['Content-type'] = ( is_null( $contentType ) ?
if ( is_array( $to ) ) {
foreach ( $to as $recip ) {
- $sent = mail( $recip->toString(), wfQuotedPrintable( $subject ), $body, $headers, $wgAdditionalMailParams );
+ $sent = mail( $recip->toString(), self::quotedPrintable( $subject ), $body, $headers, $wgAdditionalMailParams );
}
} else {
- $sent = mail( $to->toString(), wfQuotedPrintable( $subject ), $body, $headers, $wgAdditionalMailParams );
+ $sent = mail( $to->toString(), self::quotedPrintable( $subject ), $body, $headers, $wgAdditionalMailParams );
}
restore_error_handler();
$phrase = strtr( $phrase, array( "\r" => '', "\n" => '', '"' => '' ) );
return '"' . $phrase . '"';
}
+
+ /**
+ * Converts a string into quoted-printable format
+ */
+ public static function quotedPrintable( $string, $charset = '' ) {
+ # Probably incomplete; see RFC 2045
+ if( empty( $charset ) ) {
+ global $wgInputEncoding;
+ $charset = $wgInputEncoding;
+ }
+ $charset = strtoupper( $charset );
+ $charset = str_replace( 'ISO-8859', 'ISO8859', $charset ); // ?
+
+ $illegal = '\x00-\x08\x0b\x0c\x0e-\x1f\x7f-\xff=';
+ $replace = $illegal . '\t ?_';
+ if( !preg_match( "/[$illegal]/", $string ) ) {
+ return $string;
+ }
+ $out = "=?$charset?Q?";
+ $out .= preg_replace( "/([$replace])/e", 'sprintf("=%02X",ord("$1"))', $string );
+ $out .= '?=';
+ return $out;
+ }
}
/**
wfDeprecated( __FUNCTION__ );
return UserMailer::send( $to, $from, $subject, $body, $replyto );
}
-/**@}*/
\ No newline at end of file
+
+function wfQuotedPrintable( $string, $charset = '' ) {
+ wfDeprecated( __FUNCTION__ );
+ return UserMailer::quotedPrintable( $string, $charset );
+}
+/**@}*/