Skip to content

Commit

Permalink
Allow readFile() in CakeEmail to be accessed publicly
Browse files Browse the repository at this point in the history
I needed this method while building a Transport, and saw no reason why it needed to be protected.
  • Loading branch information
jmillerdesign committed May 16, 2013
1 parent de7535d commit f47609b
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lib/Cake/Network/Email/CakeEmail.php
Expand Up @@ -1359,7 +1359,7 @@ protected function _attachFiles($boundary = null) {
if (!empty($fileInfo['contentId'])) {
continue;
}
$data = $this->_readFile($fileInfo['file']);
$data = $this->readFile($fileInfo['file']);

$msg[] = '--' . $boundary;
$msg[] = 'Content-Type: ' . $fileInfo['mimetype'];
Expand All @@ -1383,7 +1383,7 @@ protected function _attachFiles($boundary = null) {
* @param string $file The file to read.
* @return string File contents in base64 encoding
*/
protected function _readFile($file) {
public function readFile($file) {
$handle = fopen($file, 'rb');
$data = fread($handle, filesize($file));
$data = chunk_split(base64_encode($data));
Expand All @@ -1407,7 +1407,7 @@ protected function _attachInlineFiles($boundary = null) {
if (empty($fileInfo['contentId'])) {
continue;
}
$data = $this->_readFile($fileInfo['file']);
$data = $this->readFile($fileInfo['file']);

$msg[] = '--' . $boundary;
$msg[] = 'Content-Type: ' . $fileInfo['mimetype'];
Expand Down

0 comments on commit f47609b

Please sign in to comment.