PluginProbe
AcyMailing – An Ultimate Newsletter Plugin and Marketing Automation Solution for WordPress / 11.0.3
AcyMailing – An Ultimate Newsletter Plugin and Marketing Automation Solution for WordPress v11.0.3
11.1.1 11.1.0 11.0.5 11.0.4 11.0.3 11.0.2 11.0.1 11.0.0 10.11.1 10.11.0 10.10.2 10.10.1 10.10.0 10.9.1 trunk 10.0.0 10.0.1 10.1.0 10.1.1 10.1.2 10.1.3 10.1.4 10.2.0 10.2.1 10.2.2 All 62 releases
acymailing / back / Libraries / Imap2 / ImapHelpers.php

ImapHelpers.php in AcyMailing – An Ultimate Newsletter Plugin and Marketing Automation Solution for WordPress 11.0.3, at back/Libraries/Imap2/ImapHelpers.php

55 lines 1.3 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 /*
4 * This file is part of the PHP IMAP2 package.
5 *
6 * (c) Francesco Bianco <[email protected]>
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11
12 namespace AcyMailing\Libraries\Imap2;
13
14 class ImapHelpers
15 {
16 /**
17 * Convert a string contain a sequence of message id to and equivalent with uid.
18 *
19 * @param $imap
20 * @param $messageNums
21 *
22 * @return string
23 */
24 public static function idToUid($imap, $messageNums)
25 {
26 $client = $imap->getClient();
27 $messages = $client->fetch($imap->getMailboxName(), $messageNums, false, ['UID']);
28 $uid = array_column($messages, 'uid');
29
30 return implode(',', $uid);
31 }
32
33 /**
34 * Convert a string contain a sequence of uid(s) to an equivalent with id(s).
35 *
36 * @param $imap
37 * @param $messageUid
38 *
39 * @return string
40 */
41 public static function uidToId($imap, $messageUid)
42 {
43 $client = $imap->getClient();
44
45 $messages = $client->fetch($imap->getMailboxName(), $messageUid, true, ['UID']);
46
47 $id = [];
48 foreach ($messages as $message) {
49 $id[] = $message->id;
50 }
51
52 return implode(',', $id);
53 }
54 }
55