PluginProbe
AcyMailing – An Ultimate Newsletter Plugin and Marketing Automation Solution for WordPress / 10.0.1
AcyMailing – An Ultimate Newsletter Plugin and Marketing Automation Solution for WordPress v10.0.1
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 / vendor / javanile / php-imap2 / src / Errors.php

Errors.php in AcyMailing – An Ultimate Newsletter Plugin and Marketing Automation Solution for WordPress 10.0.1, at vendor/javanile/php-imap2/src/Errors.php

110 lines 2.7 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3
4 namespace Javanile\Imap2;
5
6 class Errors
7 {
8 protected static $alerts = [];
9
10 protected static $errors = [];
11
12 protected static $lastError;
13
14 public static function appendAlert($alert)
15 {
16 self::$alerts[] = $alert;
17 }
18
19 public static function appendError($error)
20 {
21 self::$lastError = $error;
22
23 self::$errors[] = $error;
24 }
25
26 public static function alerts()
27 {
28 if (empty(self::$alerts)) {
29 return false;
30 }
31
32 $return = self::$alerts;
33
34 self::$alerts = [];
35
36 return $return;
37 }
38
39 public static function errors()
40 {
41 if (empty(self::$errors)) {
42 return false;
43 }
44
45 $return = self::$errors;
46
47 self::$errors = [];
48
49 return $return;
50 }
51
52 public static function lastError()
53 {
54 if (empty(self::$lastError)) {
55 return false;
56 }
57
58 return self::$lastError;
59 }
60
61 public static function raiseWarning($warning, $backtrace, $depth)
62 {
63 $message = $warning . ' in '.$backtrace[$depth]['file']. ' on line '.$backtrace[$depth]['line'];
64
65 trigger_error($message, E_USER_WARNING);
66 }
67
68 public static function invalidImapConnection($backtrace, $depth, $return)
69 {
70 $warning = 'Invalid IMAP connection parameter for '.$backtrace[$depth]['function'].'() '
71 . 'at '.$backtrace[$depth]['file']. ' on line '.$backtrace[$depth]['line'].'. Source code';
72
73 trigger_error($warning, E_USER_WARNING);
74
75 return $return;
76 }
77
78 public static function couldNotOpenStream($mailbox, $backtrace, $depth)
79 {
80 if (isset($backtrace[$depth + 1]['function']) && $backtrace[$depth + 1]['function'] == 'imap_open') {
81 $depth++;
82 }
83
84 return $backtrace[$depth]['function'].'(): Couldn\'t open stream '.$mailbox
85 . ' in '.$backtrace[$depth]['file']. ' on line '.$backtrace[$depth]['line'].'. Source code';
86 }
87
88 public static function badMessageNumber($backtrace, $depth)
89 {
90 if (Functions::isBackportCall($backtrace, $depth)) {
91 $depth++;
92 }
93
94 return $backtrace[$depth]['function'].'(): Bad message number in '
95 . $backtrace[$depth]['file']. ' on line '.$backtrace[$depth]['line'].'. Source code';
96 }
97
98 public static function appendErrorCanNotOpen($mailbox, $error)
99 {
100 if ($mailbox[0] == '{') {
101 $error = preg_replace("/^AUTHENTICATE [A-Z]+\d*:\s/i", '', $error);
102 $error = 'Can not authenticate to IMAP server: '.$error;
103 } else {
104 $error = "Can't open mailbox {$mailbox}: no such mailbox";
105 }
106
107 self::appendError($error);
108 }
109 }
110