Skip to content

Commit e76800f

Browse files
committed
Fetch attributes set to null
1 parent 96eb056 commit e76800f

File tree

3 files changed

+6
-29
lines changed

3 files changed

+6
-29
lines changed

src/IMAP/Client.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -470,7 +470,7 @@ public function deleteFolder($name, $expunge = true) {
470470
* @deprecated 1.0.5.2:2.0.0 No longer needed. Use Folder::getMessages() instead
471471
* @see Folder::getMessages()
472472
*/
473-
public function getMessages(Folder $folder, $criteria = 'ALL', $fetch_options = null, $fetch_body = true, $fetch_attachment = true, $fetch_flags = false) {
473+
public function getMessages(Folder $folder, $criteria = 'ALL', $fetch_options = null, $fetch_body = null, $fetch_attachment = null, $fetch_flags = null) {
474474
return $folder->getMessages($criteria, $fetch_options, $fetch_body, $fetch_attachment, $fetch_flags);
475475
}
476476

src/IMAP/Folder.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@ public function setChildren($children = []) {
191191
* @throws Exceptions\ConnectionFailedException
192192
* @throws Exceptions\InvalidMessageDateException
193193
*/
194-
public function getMessage($uid, $msglist = null, $fetch_options = null, $fetch_body = false, $fetch_attachment = false, $fetch_flags = true) {
194+
public function getMessage($uid, $msglist = null, $fetch_options = null, $fetch_body = null, $fetch_attachment = null, $fetch_flags = null) {
195195
$this->client->openFolder($this->path);
196196
if (\imap_msgno($this->getClient()->getConnection(), $uid) > 0) {
197197
return new Message($uid, $msglist, $this->getClient(), $fetch_options, $fetch_body, $fetch_attachment, $fetch_flags);
@@ -217,7 +217,7 @@ public function getMessage($uid, $msglist = null, $fetch_options = null, $fetch_
217217
* @throws Exceptions\InvalidWhereQueryCriteriaException
218218
* @throws GetMessagesFailedException
219219
*/
220-
public function getMessages($criteria = 'ALL', $fetch_options = null, $fetch_body = true, $fetch_attachment = true, $fetch_flags = true, $limit = null, $page = 1, $charset = "UTF-8") {
220+
public function getMessages($criteria = 'ALL', $fetch_options = null, $fetch_body = null, $fetch_attachment = null, $fetch_flags = null, $limit = null, $page = 1, $charset = "UTF-8") {
221221

222222
return $this->query($charset)->where($criteria)->setFetchOptions($fetch_options)->setFetchBody($fetch_body)
223223
->setFetchAttachment($fetch_attachment)->setFetchFlags($fetch_flags)

src/IMAP/Message.php

Lines changed: 3 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@ class Message {
197197
* @throws Exceptions\ConnectionFailedException
198198
* @throws InvalidMessageDateException
199199
*/
200-
public function __construct($uid, $msglist, Client $client, $fetch_options = null, $fetch_body = false, $fetch_attachment = false, $fetch_flags = false) {
200+
public function __construct($uid, $msglist, Client $client, $fetch_options = null, $fetch_body = null, $fetch_attachment = null, $fetch_flags = null) {
201201

202202
$default_mask = $client->getDefaultMessageMask();
203203
if($default_mask != null) {
@@ -349,37 +349,14 @@ public function hasHTMLBody() {
349349

350350
/**
351351
* Get the Message html body
352-
* If $replaceImages is callable it should expect string $body as first parameter, $oAttachment as second and return
353-
* the resulting $body.
354-
*
355-
* @var bool|callable $replaceImages
356352
*
357353
* @return string|null
358-
*
359-
* @deprecated 1.4.0:2.0.0 No longer needed. Use AttachmentMask::getImageSrc() instead
360354
*/
361-
public function getHTMLBody($replaceImages = false) {
355+
public function getHTMLBody() {
362356
if (!isset($this->bodies['html'])) {
363357
return null;
364358
}
365-
366-
$body = $this->bodies['html']->content;
367-
if ($replaceImages !== false) {
368-
$this->attachments->each(function($oAttachment) use(&$body, $replaceImages) {
369-
/** @var Attachment $oAttachment */
370-
if(is_callable($replaceImages)) {
371-
$body = $replaceImages($body, $oAttachment);
372-
}elseif(is_string($replaceImages)) {
373-
call_user_func($replaceImages, [$body, $oAttachment]);
374-
}else{
375-
if ($oAttachment->id && $oAttachment->getImgSrc() != null) {
376-
$body = str_replace('cid:'.$oAttachment->id, $oAttachment->getImgSrc(), $body);
377-
}
378-
}
379-
});
380-
}
381-
382-
return $body;
359+
return $this->bodies['html']->content;
383360
}
384361

385362
/**

0 commit comments

Comments
 (0)