@@ -9,11 +9,11 @@ |
||
9 | 9 | </div> <!-- post-body-content --> |
10 | 10 | |
11 | 11 | <?php |
12 | - // let's loop through the columns |
|
13 | - for ($i = 1; $i <= $num_columns; $i++) { |
|
14 | - $metaref = ($i === 1) ? 'normal' : 'side'; |
|
15 | - $metaref = ($i > 2) ? 'column' . $i : $metaref; |
|
16 | - ?> |
|
12 | + // let's loop through the columns |
|
13 | + for ($i = 1; $i <= $num_columns; $i++) { |
|
14 | + $metaref = ($i === 1) ? 'normal' : 'side'; |
|
15 | + $metaref = ($i > 2) ? 'column' . $i : $metaref; |
|
16 | + ?> |
|
17 | 17 | |
18 | 18 | <div id='postbox-container-<?php echo $i; ?>' class='postbox-container'> |
19 | 19 | <?php do_meta_boxes($current_page, $metaref, null); ?> |
@@ -12,7 +12,7 @@ |
||
12 | 12 | // let's loop through the columns |
13 | 13 | for ($i = 1; $i <= $num_columns; $i++) { |
14 | 14 | $metaref = ($i === 1) ? 'normal' : 'side'; |
15 | - $metaref = ($i > 2) ? 'column' . $i : $metaref; |
|
15 | + $metaref = ($i > 2) ? 'column'.$i : $metaref; |
|
16 | 16 | ?> |
17 | 17 | |
18 | 18 | <div id='postbox-container-<?php echo $i; ?>' class='postbox-container'> |
@@ -3,11 +3,11 @@ |
||
3 | 3 | |
4 | 4 | <div class="ee-notices"><?php echo isset($ajax_notices) ? $ajax_notices : ''; ?></div> |
5 | 5 | <?php |
6 | - do_action('AHEE__admin_wrapper__template__before_admin_page_content'); |
|
7 | - echo $before_admin_page_content; |
|
8 | - echo $admin_page_content; |
|
9 | - echo $after_admin_page_content; |
|
10 | - do_action('AHEE__admin_wrapper__template__after_admin_page_content'); |
|
11 | - ?> |
|
6 | + do_action('AHEE__admin_wrapper__template__before_admin_page_content'); |
|
7 | + echo $before_admin_page_content; |
|
8 | + echo $admin_page_content; |
|
9 | + echo $after_admin_page_content; |
|
10 | + do_action('AHEE__admin_wrapper__template__after_admin_page_content'); |
|
11 | + ?> |
|
12 | 12 | </div> |
13 | 13 | <!-- espresso-admin --> |
14 | 14 | \ No newline at end of file |
@@ -7,7 +7,7 @@ |
||
7 | 7 | <div id="<?php echo $admin_page_wrapper_div_id; ?>"> |
8 | 8 | <div id="post-body" class="metabox-holder columns-1"> |
9 | 9 | |
10 | - <?php if (! empty($admin_page_header)) : ?> |
|
10 | + <?php if ( ! empty($admin_page_header)) : ?> |
|
11 | 11 | <div id="admin-page-header"> |
12 | 12 | <?php echo $admin_page_header; ?> |
13 | 13 | </div> |
@@ -99,7 +99,7 @@ discard block |
||
99 | 99 | { |
100 | 100 | $save_tracking = array('updated' => 0, 'notupdated' => 0, 'errors' => array()); |
101 | 101 | |
102 | - if (! $do_hooks_only) { |
|
102 | + if ( ! $do_hooks_only) { |
|
103 | 103 | $this->rewind(); |
104 | 104 | // exit early if there is nothing to save. |
105 | 105 | if ($this->count() < 1) { |
@@ -155,7 +155,7 @@ discard block |
||
155 | 155 | public function get_generation_data() |
156 | 156 | { |
157 | 157 | // first verify we're at a valid iterator point. |
158 | - if (! $this->valid()) { |
|
158 | + if ( ! $this->valid()) { |
|
159 | 159 | return array(); |
160 | 160 | } |
161 | 161 | $info = $this->getInfo(); |
@@ -170,7 +170,7 @@ discard block |
||
170 | 170 | */ |
171 | 171 | public function get_data_handler() |
172 | 172 | { |
173 | - if (! $this->valid()) { |
|
173 | + if ( ! $this->valid()) { |
|
174 | 174 | return ''; |
175 | 175 | } |
176 | 176 | $info = $this->getInfo(); |
@@ -185,7 +185,7 @@ discard block |
||
185 | 185 | */ |
186 | 186 | public function is_preview() |
187 | 187 | { |
188 | - if (! $this->valid()) { |
|
188 | + if ( ! $this->valid()) { |
|
189 | 189 | return false; |
190 | 190 | } |
191 | 191 | $info = $this->getInfo(); |
@@ -200,7 +200,7 @@ discard block |
||
200 | 200 | */ |
201 | 201 | public function is_test_send() |
202 | 202 | { |
203 | - if (! $this->valid()) { |
|
203 | + if ( ! $this->valid()) { |
|
204 | 204 | return false; |
205 | 205 | } |
206 | 206 | $info = $this->getInfo(); |
@@ -214,7 +214,7 @@ discard block |
||
214 | 214 | */ |
215 | 215 | protected function _maybe_persist_attached_data() |
216 | 216 | { |
217 | - if (! $this->valid()) { |
|
217 | + if ( ! $this->valid()) { |
|
218 | 218 | return; |
219 | 219 | } |
220 | 220 | |
@@ -237,7 +237,7 @@ discard block |
||
237 | 237 | */ |
238 | 238 | public function count_by_priority_and_status($priority, $status = array()) |
239 | 239 | { |
240 | - if (! empty($status)) { |
|
240 | + if ( ! empty($status)) { |
|
241 | 241 | $status = is_array($status) ? $status : array($status); |
242 | 242 | } |
243 | 243 |
@@ -12,257 +12,257 @@ |
||
12 | 12 | { |
13 | 13 | |
14 | 14 | |
15 | - /** |
|
16 | - * EE_Message_Repository constructor |
|
17 | - */ |
|
18 | - public function __construct() |
|
19 | - { |
|
20 | - $this->interface = 'EE_Message'; |
|
21 | - parent::__construct(); |
|
22 | - } |
|
15 | + /** |
|
16 | + * EE_Message_Repository constructor |
|
17 | + */ |
|
18 | + public function __construct() |
|
19 | + { |
|
20 | + $this->interface = 'EE_Message'; |
|
21 | + parent::__construct(); |
|
22 | + } |
|
23 | 23 | |
24 | 24 | |
25 | - /** |
|
26 | - * Add the EE_Message to the repository. |
|
27 | - * This also ensures that the MSG_token is saves as a part of the info for retrieval. |
|
28 | - * |
|
29 | - * @param EE_Message $message |
|
30 | - * @param mixed $info Any included data is saved in the attached object info array indexed by 'data' |
|
31 | - * @return bool |
|
32 | - */ |
|
33 | - public function add($message, $info = null) |
|
34 | - { |
|
35 | - $attached = parent::add($message); |
|
36 | - // ensure $info is an array if not already |
|
37 | - $info = $info === null ? $info = array() : (array) $info; |
|
38 | - $data = $this->_init_data($info, $attached, $message); |
|
39 | - if ($attached) { |
|
40 | - $this->set_info($message, $data); |
|
41 | - } |
|
42 | - return $attached; |
|
43 | - } |
|
25 | + /** |
|
26 | + * Add the EE_Message to the repository. |
|
27 | + * This also ensures that the MSG_token is saves as a part of the info for retrieval. |
|
28 | + * |
|
29 | + * @param EE_Message $message |
|
30 | + * @param mixed $info Any included data is saved in the attached object info array indexed by 'data' |
|
31 | + * @return bool |
|
32 | + */ |
|
33 | + public function add($message, $info = null) |
|
34 | + { |
|
35 | + $attached = parent::add($message); |
|
36 | + // ensure $info is an array if not already |
|
37 | + $info = $info === null ? $info = array() : (array) $info; |
|
38 | + $data = $this->_init_data($info, $attached, $message); |
|
39 | + if ($attached) { |
|
40 | + $this->set_info($message, $data); |
|
41 | + } |
|
42 | + return $attached; |
|
43 | + } |
|
44 | 44 | |
45 | 45 | |
46 | - /** |
|
47 | - * Initializes the data from the incoming info. |
|
48 | - * |
|
49 | - * @param array $info incoming data. |
|
50 | - * @param bool $attached Indicates whether the object was attached successfully. |
|
51 | - * @param EE_Message $message |
|
52 | - * @return array |
|
53 | - */ |
|
54 | - protected function _init_data($info, $attached, $message) |
|
55 | - { |
|
56 | - $data = array( |
|
57 | - 'test_send' => false, |
|
58 | - 'preview' => false, |
|
59 | - 'data_handler_class_name' => '', |
|
60 | - 'data' => array( |
|
61 | - 'MSG_generation_data' => array(), |
|
62 | - ), |
|
63 | - ); |
|
64 | - if (isset($info['preview'])) { |
|
65 | - $data['preview'] = $info['preview']; |
|
66 | - unset($info['preview']); |
|
67 | - } |
|
68 | - if (isset($info['test_send'])) { |
|
69 | - $data['test_send'] = $info['test_send']; |
|
70 | - unset($info['test_send']); |
|
71 | - } |
|
72 | - if (isset($info['data_handler_class_name'])) { |
|
73 | - $data['data_handler_class_name'] = $info['data_handler_class_name']; |
|
74 | - unset($info['data_handler_class_name']); |
|
75 | - } |
|
76 | - if ($attached && $message->STS_ID() === EEM_Message::status_incomplete) { |
|
77 | - $generation_data = isset($info['MSG_generation_data']) ? $info['MSG_generation_data'] : array(); |
|
78 | - // if data isn't in $info...let's see if its available via the message object |
|
79 | - $generation_data = ! $generation_data ? $message->get_generation_data() : $generation_data; |
|
80 | - // still empty then let's just use info |
|
81 | - $generation_data = ! $generation_data ? $info : $generation_data; |
|
82 | - $data['data']['MSG_generation_data'] = $generation_data; |
|
83 | - } |
|
84 | - return $data; |
|
85 | - } |
|
46 | + /** |
|
47 | + * Initializes the data from the incoming info. |
|
48 | + * |
|
49 | + * @param array $info incoming data. |
|
50 | + * @param bool $attached Indicates whether the object was attached successfully. |
|
51 | + * @param EE_Message $message |
|
52 | + * @return array |
|
53 | + */ |
|
54 | + protected function _init_data($info, $attached, $message) |
|
55 | + { |
|
56 | + $data = array( |
|
57 | + 'test_send' => false, |
|
58 | + 'preview' => false, |
|
59 | + 'data_handler_class_name' => '', |
|
60 | + 'data' => array( |
|
61 | + 'MSG_generation_data' => array(), |
|
62 | + ), |
|
63 | + ); |
|
64 | + if (isset($info['preview'])) { |
|
65 | + $data['preview'] = $info['preview']; |
|
66 | + unset($info['preview']); |
|
67 | + } |
|
68 | + if (isset($info['test_send'])) { |
|
69 | + $data['test_send'] = $info['test_send']; |
|
70 | + unset($info['test_send']); |
|
71 | + } |
|
72 | + if (isset($info['data_handler_class_name'])) { |
|
73 | + $data['data_handler_class_name'] = $info['data_handler_class_name']; |
|
74 | + unset($info['data_handler_class_name']); |
|
75 | + } |
|
76 | + if ($attached && $message->STS_ID() === EEM_Message::status_incomplete) { |
|
77 | + $generation_data = isset($info['MSG_generation_data']) ? $info['MSG_generation_data'] : array(); |
|
78 | + // if data isn't in $info...let's see if its available via the message object |
|
79 | + $generation_data = ! $generation_data ? $message->get_generation_data() : $generation_data; |
|
80 | + // still empty then let's just use info |
|
81 | + $generation_data = ! $generation_data ? $info : $generation_data; |
|
82 | + $data['data']['MSG_generation_data'] = $generation_data; |
|
83 | + } |
|
84 | + return $data; |
|
85 | + } |
|
86 | 86 | |
87 | 87 | |
88 | - /** |
|
89 | - * Save all EE_Message objects to the db. |
|
90 | - * |
|
91 | - * @param bool $do_hooks_only When true, only the hooks related to saving are fired. |
|
92 | - * @return array array( |
|
93 | - * 'updated' => 0, //count of how many messages updated |
|
94 | - * 'notupdated' => 0, //count of how many messages not updated. |
|
95 | - * 'errors' => array( $token ), //array of message object tokens that had errors in saving |
|
96 | - * ) |
|
97 | - */ |
|
98 | - public function saveAll($do_hooks_only = false) |
|
99 | - { |
|
100 | - $save_tracking = array('updated' => 0, 'notupdated' => 0, 'errors' => array()); |
|
88 | + /** |
|
89 | + * Save all EE_Message objects to the db. |
|
90 | + * |
|
91 | + * @param bool $do_hooks_only When true, only the hooks related to saving are fired. |
|
92 | + * @return array array( |
|
93 | + * 'updated' => 0, //count of how many messages updated |
|
94 | + * 'notupdated' => 0, //count of how many messages not updated. |
|
95 | + * 'errors' => array( $token ), //array of message object tokens that had errors in saving |
|
96 | + * ) |
|
97 | + */ |
|
98 | + public function saveAll($do_hooks_only = false) |
|
99 | + { |
|
100 | + $save_tracking = array('updated' => 0, 'notupdated' => 0, 'errors' => array()); |
|
101 | 101 | |
102 | - if (! $do_hooks_only) { |
|
103 | - $this->rewind(); |
|
104 | - // exit early if there is nothing to save. |
|
105 | - if ($this->count() < 1) { |
|
106 | - return $save_tracking; |
|
107 | - } |
|
102 | + if (! $do_hooks_only) { |
|
103 | + $this->rewind(); |
|
104 | + // exit early if there is nothing to save. |
|
105 | + if ($this->count() < 1) { |
|
106 | + return $save_tracking; |
|
107 | + } |
|
108 | 108 | |
109 | - while ($this->valid()) { |
|
110 | - $saved = $this->current()->save(); |
|
111 | - if ($saved === false) { |
|
112 | - $save_tracking['errors'][] = $this->current()->MSG_token(); |
|
113 | - } elseif ($saved) { |
|
114 | - $save_tracking['updated']++; |
|
115 | - } else { |
|
116 | - $save_tracking['notupdated']++; |
|
117 | - } |
|
118 | - // maybe persist generation data if this is an incomplete EE_Message. |
|
119 | - $this->_maybe_persist_attached_data(); |
|
109 | + while ($this->valid()) { |
|
110 | + $saved = $this->current()->save(); |
|
111 | + if ($saved === false) { |
|
112 | + $save_tracking['errors'][] = $this->current()->MSG_token(); |
|
113 | + } elseif ($saved) { |
|
114 | + $save_tracking['updated']++; |
|
115 | + } else { |
|
116 | + $save_tracking['notupdated']++; |
|
117 | + } |
|
118 | + // maybe persist generation data if this is an incomplete EE_Message. |
|
119 | + $this->_maybe_persist_attached_data(); |
|
120 | 120 | |
121 | - $this->next(); |
|
122 | - } |
|
123 | - } |
|
124 | - do_action('AHEE__EE_Message_Repository__saveAll__after', $save_tracking, $this, $do_hooks_only); |
|
125 | - return $save_tracking; |
|
126 | - } |
|
121 | + $this->next(); |
|
122 | + } |
|
123 | + } |
|
124 | + do_action('AHEE__EE_Message_Repository__saveAll__after', $save_tracking, $this, $do_hooks_only); |
|
125 | + return $save_tracking; |
|
126 | + } |
|
127 | 127 | |
128 | 128 | |
129 | - /** |
|
130 | - * Retrieves a EE_Message from the repository that matches the given token. |
|
131 | - * |
|
132 | - * @param string $token Token. |
|
133 | - * @return EE_Message | null |
|
134 | - */ |
|
135 | - public function getMessageByToken($token) |
|
136 | - { |
|
137 | - $this->rewind(); |
|
138 | - while ($this->valid()) { |
|
139 | - if ($this->current()->MSG_token() === $token) { |
|
140 | - $message = $this->current(); |
|
141 | - $this->rewind(); |
|
142 | - return $message; |
|
143 | - } |
|
144 | - $this->next(); |
|
145 | - } |
|
146 | - return null; |
|
147 | - } |
|
129 | + /** |
|
130 | + * Retrieves a EE_Message from the repository that matches the given token. |
|
131 | + * |
|
132 | + * @param string $token Token. |
|
133 | + * @return EE_Message | null |
|
134 | + */ |
|
135 | + public function getMessageByToken($token) |
|
136 | + { |
|
137 | + $this->rewind(); |
|
138 | + while ($this->valid()) { |
|
139 | + if ($this->current()->MSG_token() === $token) { |
|
140 | + $message = $this->current(); |
|
141 | + $this->rewind(); |
|
142 | + return $message; |
|
143 | + } |
|
144 | + $this->next(); |
|
145 | + } |
|
146 | + return null; |
|
147 | + } |
|
148 | 148 | |
149 | 149 | |
150 | - /** |
|
151 | - * This retrieves any data required for generation that may be saved with the current EE_Message in storage. |
|
152 | - * |
|
153 | - * @return array(); |
|
154 | - */ |
|
155 | - public function get_generation_data() |
|
156 | - { |
|
157 | - // first verify we're at a valid iterator point. |
|
158 | - if (! $this->valid()) { |
|
159 | - return array(); |
|
160 | - } |
|
161 | - $info = $this->getInfo(); |
|
162 | - return isset($info['data']) && isset($info['data']['MSG_generation_data']) ? $info['data']['MSG_generation_data'] : array(); |
|
163 | - } |
|
150 | + /** |
|
151 | + * This retrieves any data required for generation that may be saved with the current EE_Message in storage. |
|
152 | + * |
|
153 | + * @return array(); |
|
154 | + */ |
|
155 | + public function get_generation_data() |
|
156 | + { |
|
157 | + // first verify we're at a valid iterator point. |
|
158 | + if (! $this->valid()) { |
|
159 | + return array(); |
|
160 | + } |
|
161 | + $info = $this->getInfo(); |
|
162 | + return isset($info['data']) && isset($info['data']['MSG_generation_data']) ? $info['data']['MSG_generation_data'] : array(); |
|
163 | + } |
|
164 | 164 | |
165 | 165 | |
166 | - /** |
|
167 | - * Retrieves the data_handler_class_name or reference associated with the current EE_Message object in the iterator. |
|
168 | - * |
|
169 | - * @return string |
|
170 | - */ |
|
171 | - public function get_data_handler() |
|
172 | - { |
|
173 | - if (! $this->valid()) { |
|
174 | - return ''; |
|
175 | - } |
|
176 | - $info = $this->getInfo(); |
|
177 | - return isset($info['data_handler_class_name']) ? $info['data_handler_class_name'] : ''; |
|
178 | - } |
|
166 | + /** |
|
167 | + * Retrieves the data_handler_class_name or reference associated with the current EE_Message object in the iterator. |
|
168 | + * |
|
169 | + * @return string |
|
170 | + */ |
|
171 | + public function get_data_handler() |
|
172 | + { |
|
173 | + if (! $this->valid()) { |
|
174 | + return ''; |
|
175 | + } |
|
176 | + $info = $this->getInfo(); |
|
177 | + return isset($info['data_handler_class_name']) ? $info['data_handler_class_name'] : ''; |
|
178 | + } |
|
179 | 179 | |
180 | 180 | |
181 | - /** |
|
182 | - * Returns whether this EE_Message is for a preview or not. |
|
183 | - * |
|
184 | - * @return bool |
|
185 | - */ |
|
186 | - public function is_preview() |
|
187 | - { |
|
188 | - if (! $this->valid()) { |
|
189 | - return false; |
|
190 | - } |
|
191 | - $info = $this->getInfo(); |
|
192 | - return $info['preview']; |
|
193 | - } |
|
181 | + /** |
|
182 | + * Returns whether this EE_Message is for a preview or not. |
|
183 | + * |
|
184 | + * @return bool |
|
185 | + */ |
|
186 | + public function is_preview() |
|
187 | + { |
|
188 | + if (! $this->valid()) { |
|
189 | + return false; |
|
190 | + } |
|
191 | + $info = $this->getInfo(); |
|
192 | + return $info['preview']; |
|
193 | + } |
|
194 | 194 | |
195 | 195 | |
196 | - /** |
|
197 | - * Returns whether the current message pointed to is for a test send. |
|
198 | - * |
|
199 | - * @return bool |
|
200 | - */ |
|
201 | - public function is_test_send() |
|
202 | - { |
|
203 | - if (! $this->valid()) { |
|
204 | - return false; |
|
205 | - } |
|
206 | - $info = $this->getInfo(); |
|
207 | - return $info['test_send']; |
|
208 | - } |
|
196 | + /** |
|
197 | + * Returns whether the current message pointed to is for a test send. |
|
198 | + * |
|
199 | + * @return bool |
|
200 | + */ |
|
201 | + public function is_test_send() |
|
202 | + { |
|
203 | + if (! $this->valid()) { |
|
204 | + return false; |
|
205 | + } |
|
206 | + $info = $this->getInfo(); |
|
207 | + return $info['test_send']; |
|
208 | + } |
|
209 | 209 | |
210 | 210 | |
211 | - /** |
|
212 | - * This checks if the current EE_Message in the iterator is incomplete. If it is, then |
|
213 | - * data is attached for later retrieval (batch generation). |
|
214 | - */ |
|
215 | - protected function _maybe_persist_attached_data() |
|
216 | - { |
|
217 | - if (! $this->valid()) { |
|
218 | - return; |
|
219 | - } |
|
211 | + /** |
|
212 | + * This checks if the current EE_Message in the iterator is incomplete. If it is, then |
|
213 | + * data is attached for later retrieval (batch generation). |
|
214 | + */ |
|
215 | + protected function _maybe_persist_attached_data() |
|
216 | + { |
|
217 | + if (! $this->valid()) { |
|
218 | + return; |
|
219 | + } |
|
220 | 220 | |
221 | - $info = $this->getInfo(); |
|
222 | - $data_handler_class_name = isset($info['data_handler_class_name']) ? $info['data_handler_class_name'] : ''; |
|
223 | - $data = isset($info['data']) && isset($info['data']['MSG_generation_data']) ? $info['data']['MSG_generation_data'] : array(); |
|
224 | - if ($data && $this->current()->STS_ID() === EEM_Message::status_incomplete) { |
|
225 | - $this->current()->set_generation_data($data); |
|
226 | - $this->current()->set_field_or_extra_meta('data_handler_class_name', $data_handler_class_name); |
|
227 | - } |
|
228 | - } |
|
221 | + $info = $this->getInfo(); |
|
222 | + $data_handler_class_name = isset($info['data_handler_class_name']) ? $info['data_handler_class_name'] : ''; |
|
223 | + $data = isset($info['data']) && isset($info['data']['MSG_generation_data']) ? $info['data']['MSG_generation_data'] : array(); |
|
224 | + if ($data && $this->current()->STS_ID() === EEM_Message::status_incomplete) { |
|
225 | + $this->current()->set_generation_data($data); |
|
226 | + $this->current()->set_field_or_extra_meta('data_handler_class_name', $data_handler_class_name); |
|
227 | + } |
|
228 | + } |
|
229 | 229 | |
230 | 230 | |
231 | - /** |
|
232 | - * This method returns a count of messages in the repository that have a given priority. |
|
233 | - * |
|
234 | - * @param int $priority the priority that is being filtered for the count. |
|
235 | - * @param array $status the optional status(es) that will also be filtered by when priority matches. |
|
236 | - * @return int count of messages in the queue matching the conditions. |
|
237 | - */ |
|
238 | - public function count_by_priority_and_status($priority, $status = array()) |
|
239 | - { |
|
240 | - if (! empty($status)) { |
|
241 | - $status = is_array($status) ? $status : array($status); |
|
242 | - } |
|
231 | + /** |
|
232 | + * This method returns a count of messages in the repository that have a given priority. |
|
233 | + * |
|
234 | + * @param int $priority the priority that is being filtered for the count. |
|
235 | + * @param array $status the optional status(es) that will also be filtered by when priority matches. |
|
236 | + * @return int count of messages in the queue matching the conditions. |
|
237 | + */ |
|
238 | + public function count_by_priority_and_status($priority, $status = array()) |
|
239 | + { |
|
240 | + if (! empty($status)) { |
|
241 | + $status = is_array($status) ? $status : array($status); |
|
242 | + } |
|
243 | 243 | |
244 | - $count = 0; |
|
245 | - $this->rewind(); |
|
246 | - while ($this->valid()) { |
|
247 | - if ( |
|
248 | - $this->current()->priority() === $priority && (($status && in_array( |
|
249 | - $this->current()->STS_ID(), |
|
250 | - $status |
|
251 | - )) || ! $status) |
|
252 | - ) { |
|
253 | - $count++; |
|
254 | - } |
|
255 | - $this->next(); |
|
256 | - } |
|
257 | - return $count; |
|
258 | - } |
|
244 | + $count = 0; |
|
245 | + $this->rewind(); |
|
246 | + while ($this->valid()) { |
|
247 | + if ( |
|
248 | + $this->current()->priority() === $priority && (($status && in_array( |
|
249 | + $this->current()->STS_ID(), |
|
250 | + $status |
|
251 | + )) || ! $status) |
|
252 | + ) { |
|
253 | + $count++; |
|
254 | + } |
|
255 | + $this->next(); |
|
256 | + } |
|
257 | + return $count; |
|
258 | + } |
|
259 | 259 | |
260 | 260 | |
261 | - /** |
|
262 | - * @return EE_Message |
|
263 | - */ |
|
264 | - public function current() |
|
265 | - { |
|
266 | - return parent::current(); |
|
267 | - } |
|
261 | + /** |
|
262 | + * @return EE_Message |
|
263 | + */ |
|
264 | + public function current() |
|
265 | + { |
|
266 | + return parent::current(); |
|
267 | + } |
|
268 | 268 | } |
@@ -14,168 +14,168 @@ |
||
14 | 14 | class EE_Message_Type_Collection extends EE_Object_Collection |
15 | 15 | { |
16 | 16 | |
17 | - /** |
|
18 | - * EE_Message_Type_Collection constructor. |
|
19 | - */ |
|
20 | - public function __construct() |
|
21 | - { |
|
22 | - $this->interface = 'EE_message_type'; |
|
23 | - } |
|
24 | - |
|
25 | - |
|
26 | - |
|
27 | - /** |
|
28 | - * add |
|
29 | - * |
|
30 | - * attaches an object to the Collection |
|
31 | - * and sets any supplied data associated with the current iterator entry |
|
32 | - * by calling EE_Object_Collection::set_info() |
|
33 | - * |
|
34 | - * @access public |
|
35 | - * @param object $object |
|
36 | - * @param mixed $info |
|
37 | - * @return bool |
|
38 | - */ |
|
39 | - public function add($object, $info = null) |
|
40 | - { |
|
41 | - $info = empty($info) && $object instanceof $this->interface ? $object->name : $info; |
|
42 | - return parent::add($object, $info); |
|
43 | - } |
|
44 | - |
|
45 | - |
|
46 | - |
|
47 | - /** |
|
48 | - * set_info |
|
49 | - * |
|
50 | - * Sets the data associated with an object in the Collection |
|
51 | - * if no $info is supplied, then the spl_object_hash() is used |
|
52 | - * |
|
53 | - * @access public |
|
54 | - * @param object $object |
|
55 | - * @param mixed $info |
|
56 | - * @return bool |
|
57 | - */ |
|
58 | - public function set_info($object, $info = null) |
|
59 | - { |
|
60 | - $info = empty($info) && $object instanceof $this->interface ? $object->name : $info; |
|
61 | - return parent::set_info($object, $info); |
|
62 | - } |
|
63 | - |
|
64 | - |
|
65 | - |
|
66 | - /** |
|
67 | - * get_by_info |
|
68 | - * |
|
69 | - * finds and returns an object in the Collection based on the info that was set using addObject() |
|
70 | - * PLZ NOTE: the pointer is reset to the beginning of the collection before returning |
|
71 | - * |
|
72 | - * @access public |
|
73 | - * @param mixed |
|
74 | - * @return null | object |
|
75 | - */ |
|
76 | - public function get_by_info($info) |
|
77 | - { |
|
78 | - return parent::get_by_info(str_replace(' ', '_', strtolower($info))); |
|
79 | - } |
|
80 | - |
|
81 | - |
|
82 | - |
|
83 | - /** |
|
84 | - * has |
|
85 | - * |
|
86 | - * returns TRUE or FALSE depending on whether the supplied object is within the Collection |
|
87 | - * |
|
88 | - * @access public |
|
89 | - * @param object $object |
|
90 | - * @return bool |
|
91 | - */ |
|
92 | - public function has($object) |
|
93 | - { |
|
94 | - return parent::has($object); |
|
95 | - } |
|
96 | - |
|
97 | - |
|
98 | - |
|
99 | - /** |
|
100 | - * has_by_name |
|
101 | - * |
|
102 | - * returns TRUE or FALSE depending on whether the supplied message_type classname is within the Collection |
|
103 | - * |
|
104 | - * @access public |
|
105 | - * @param string $message_type_name |
|
106 | - * @return bool |
|
107 | - */ |
|
108 | - public function has_by_name($message_type_name) |
|
109 | - { |
|
110 | - return $this->get_by_info($message_type_name) instanceof $this->interface ? true : false; |
|
111 | - } |
|
112 | - |
|
113 | - |
|
114 | - |
|
115 | - /** |
|
116 | - * remove |
|
117 | - * |
|
118 | - * detaches an object from the Collection |
|
119 | - * |
|
120 | - * @access public |
|
121 | - * @param $object |
|
122 | - * @return bool |
|
123 | - */ |
|
124 | - public function remove($object) |
|
125 | - { |
|
126 | - return parent::remove($object); |
|
127 | - } |
|
128 | - |
|
129 | - |
|
130 | - |
|
131 | - /** |
|
132 | - * set_current |
|
133 | - * |
|
134 | - * advances pointer to the provided object |
|
135 | - * |
|
136 | - * @access public |
|
137 | - * @param $object |
|
138 | - * @return void |
|
139 | - */ |
|
140 | - public function set_current($object) |
|
141 | - { |
|
142 | - parent::set_current($object); |
|
143 | - } |
|
144 | - |
|
145 | - |
|
146 | - |
|
147 | - /** |
|
148 | - * set_current_by_info |
|
149 | - * |
|
150 | - * advances pointer to the object whose info matches that which was provided |
|
151 | - * |
|
152 | - * @access public |
|
153 | - * @param $info |
|
154 | - * @return void |
|
155 | - */ |
|
156 | - public function set_current_by_info($info) |
|
157 | - { |
|
158 | - parent::set_current_by_info($info); |
|
159 | - } |
|
160 | - |
|
161 | - |
|
162 | - |
|
163 | - /** |
|
164 | - * show_collection_classes |
|
165 | - * |
|
166 | - * displays list of collection classes if WP_DEBUG is on |
|
167 | - * |
|
168 | - * @access public |
|
169 | - * @return void |
|
170 | - */ |
|
171 | - public function show_collection_classes() |
|
172 | - { |
|
173 | - if (WP_DEBUG) { |
|
174 | - $this->rewind(); |
|
175 | - while ($this->valid()) { |
|
176 | - echo '<h5 style="color:#2EA2CC;">' . __CLASS__ . ' class : <span style="color:#E76700">' . $this->getInfo() . '</span></h5>'; |
|
177 | - $this->next(); |
|
178 | - } |
|
179 | - } |
|
180 | - } |
|
17 | + /** |
|
18 | + * EE_Message_Type_Collection constructor. |
|
19 | + */ |
|
20 | + public function __construct() |
|
21 | + { |
|
22 | + $this->interface = 'EE_message_type'; |
|
23 | + } |
|
24 | + |
|
25 | + |
|
26 | + |
|
27 | + /** |
|
28 | + * add |
|
29 | + * |
|
30 | + * attaches an object to the Collection |
|
31 | + * and sets any supplied data associated with the current iterator entry |
|
32 | + * by calling EE_Object_Collection::set_info() |
|
33 | + * |
|
34 | + * @access public |
|
35 | + * @param object $object |
|
36 | + * @param mixed $info |
|
37 | + * @return bool |
|
38 | + */ |
|
39 | + public function add($object, $info = null) |
|
40 | + { |
|
41 | + $info = empty($info) && $object instanceof $this->interface ? $object->name : $info; |
|
42 | + return parent::add($object, $info); |
|
43 | + } |
|
44 | + |
|
45 | + |
|
46 | + |
|
47 | + /** |
|
48 | + * set_info |
|
49 | + * |
|
50 | + * Sets the data associated with an object in the Collection |
|
51 | + * if no $info is supplied, then the spl_object_hash() is used |
|
52 | + * |
|
53 | + * @access public |
|
54 | + * @param object $object |
|
55 | + * @param mixed $info |
|
56 | + * @return bool |
|
57 | + */ |
|
58 | + public function set_info($object, $info = null) |
|
59 | + { |
|
60 | + $info = empty($info) && $object instanceof $this->interface ? $object->name : $info; |
|
61 | + return parent::set_info($object, $info); |
|
62 | + } |
|
63 | + |
|
64 | + |
|
65 | + |
|
66 | + /** |
|
67 | + * get_by_info |
|
68 | + * |
|
69 | + * finds and returns an object in the Collection based on the info that was set using addObject() |
|
70 | + * PLZ NOTE: the pointer is reset to the beginning of the collection before returning |
|
71 | + * |
|
72 | + * @access public |
|
73 | + * @param mixed |
|
74 | + * @return null | object |
|
75 | + */ |
|
76 | + public function get_by_info($info) |
|
77 | + { |
|
78 | + return parent::get_by_info(str_replace(' ', '_', strtolower($info))); |
|
79 | + } |
|
80 | + |
|
81 | + |
|
82 | + |
|
83 | + /** |
|
84 | + * has |
|
85 | + * |
|
86 | + * returns TRUE or FALSE depending on whether the supplied object is within the Collection |
|
87 | + * |
|
88 | + * @access public |
|
89 | + * @param object $object |
|
90 | + * @return bool |
|
91 | + */ |
|
92 | + public function has($object) |
|
93 | + { |
|
94 | + return parent::has($object); |
|
95 | + } |
|
96 | + |
|
97 | + |
|
98 | + |
|
99 | + /** |
|
100 | + * has_by_name |
|
101 | + * |
|
102 | + * returns TRUE or FALSE depending on whether the supplied message_type classname is within the Collection |
|
103 | + * |
|
104 | + * @access public |
|
105 | + * @param string $message_type_name |
|
106 | + * @return bool |
|
107 | + */ |
|
108 | + public function has_by_name($message_type_name) |
|
109 | + { |
|
110 | + return $this->get_by_info($message_type_name) instanceof $this->interface ? true : false; |
|
111 | + } |
|
112 | + |
|
113 | + |
|
114 | + |
|
115 | + /** |
|
116 | + * remove |
|
117 | + * |
|
118 | + * detaches an object from the Collection |
|
119 | + * |
|
120 | + * @access public |
|
121 | + * @param $object |
|
122 | + * @return bool |
|
123 | + */ |
|
124 | + public function remove($object) |
|
125 | + { |
|
126 | + return parent::remove($object); |
|
127 | + } |
|
128 | + |
|
129 | + |
|
130 | + |
|
131 | + /** |
|
132 | + * set_current |
|
133 | + * |
|
134 | + * advances pointer to the provided object |
|
135 | + * |
|
136 | + * @access public |
|
137 | + * @param $object |
|
138 | + * @return void |
|
139 | + */ |
|
140 | + public function set_current($object) |
|
141 | + { |
|
142 | + parent::set_current($object); |
|
143 | + } |
|
144 | + |
|
145 | + |
|
146 | + |
|
147 | + /** |
|
148 | + * set_current_by_info |
|
149 | + * |
|
150 | + * advances pointer to the object whose info matches that which was provided |
|
151 | + * |
|
152 | + * @access public |
|
153 | + * @param $info |
|
154 | + * @return void |
|
155 | + */ |
|
156 | + public function set_current_by_info($info) |
|
157 | + { |
|
158 | + parent::set_current_by_info($info); |
|
159 | + } |
|
160 | + |
|
161 | + |
|
162 | + |
|
163 | + /** |
|
164 | + * show_collection_classes |
|
165 | + * |
|
166 | + * displays list of collection classes if WP_DEBUG is on |
|
167 | + * |
|
168 | + * @access public |
|
169 | + * @return void |
|
170 | + */ |
|
171 | + public function show_collection_classes() |
|
172 | + { |
|
173 | + if (WP_DEBUG) { |
|
174 | + $this->rewind(); |
|
175 | + while ($this->valid()) { |
|
176 | + echo '<h5 style="color:#2EA2CC;">' . __CLASS__ . ' class : <span style="color:#E76700">' . $this->getInfo() . '</span></h5>'; |
|
177 | + $this->next(); |
|
178 | + } |
|
179 | + } |
|
180 | + } |
|
181 | 181 | } |
@@ -173,7 +173,7 @@ |
||
173 | 173 | if (WP_DEBUG) { |
174 | 174 | $this->rewind(); |
175 | 175 | while ($this->valid()) { |
176 | - echo '<h5 style="color:#2EA2CC;">' . __CLASS__ . ' class : <span style="color:#E76700">' . $this->getInfo() . '</span></h5>'; |
|
176 | + echo '<h5 style="color:#2EA2CC;">'.__CLASS__.' class : <span style="color:#E76700">'.$this->getInfo().'</span></h5>'; |
|
177 | 177 | $this->next(); |
178 | 178 | } |
179 | 179 | } |
@@ -22,13 +22,13 @@ discard block |
||
22 | 22 | <div class="ticket-time-and-place-details"> |
23 | 23 | <div class="ticket-time-details"> |
24 | 24 | <h4 class="sub-section-title no-bottom-margin"> |
25 | - <img class="icon" src="<?php echo EE_IMAGES_URL . 'clock-16x16.png'; ?>"><?php _e('Date/Time:', 'event_espresso'); ?> |
|
25 | + <img class="icon" src="<?php echo EE_IMAGES_URL.'clock-16x16.png'; ?>"><?php _e('Date/Time:', 'event_espresso'); ?> |
|
26 | 26 | </h4> |
27 | 27 | <ul class="event-dates">[DATETIME_LIST]</ul> |
28 | 28 | </div> |
29 | 29 | <div class="ticket-place-details"> |
30 | 30 | <h4 class="sub-section-title no-bottom-margin"> |
31 | - <img class="icon" src="<?php echo EE_IMAGES_URL . 'location-pin-16x16.png'; ?>"><?php _e('Venue', 'event_espresso'); ?> |
|
31 | + <img class="icon" src="<?php echo EE_IMAGES_URL.'location-pin-16x16.png'; ?>"><?php _e('Venue', 'event_espresso'); ?> |
|
32 | 32 | </h4> |
33 | 33 | <ul class="event-venues"> |
34 | 34 | <li>[VENUE_TITLE] |
@@ -39,7 +39,7 @@ discard block |
||
39 | 39 | </div> |
40 | 40 | <div class="ticket-registrations-area"> |
41 | 41 | <h4 class="sub-section-title"> |
42 | - <img class="icon" src="<?php echo EE_IMAGES_URL . 'users-16x16.png'; ?>"><?php _e("Registration Details", "event_espresso"); ?> |
|
42 | + <img class="icon" src="<?php echo EE_IMAGES_URL.'users-16x16.png'; ?>"><?php _e("Registration Details", "event_espresso"); ?> |
|
43 | 43 | <span class="small-text link">( <a class="print_button noPrint" href="[PRIMARY_REGISTRANT_FRONTEND_EDIT_REG_LINK]"><?php _e('edit', 'event_espresso'); ?></a> )</span> |
44 | 44 | </h4> |
45 | 45 | <ul class="ticket-registrations-list">[ATTENDEE_LIST]</ul> |
@@ -6,11 +6,11 @@ |
||
6 | 6 | <li class="ticket-registration"> |
7 | 7 | <table class="registration-details"> |
8 | 8 | <tr class="odd"> |
9 | - <th><?php _e('Attendee', 'event_espresso');?></th> |
|
9 | + <th><?php _e('Attendee', 'event_espresso'); ?></th> |
|
10 | 10 | <td>[FNAME] [LNAME] ([ATTENDEE_EMAIL])</td> |
11 | 11 | </tr> |
12 | 12 | <tr> |
13 | - <th><?php _e("Registration Code:", "event_espresso");?></th> |
|
13 | + <th><?php _e("Registration Code:", "event_espresso"); ?></th> |
|
14 | 14 | <td>[REGISTRATION_CODE] - <span class="[REGISTRATION_STATUS_ID]">[REGISTRATION_STATUS_LABEL]</span></td> |
15 | 15 | </tr> |
16 | 16 | </table> |
@@ -11,19 +11,19 @@ |
||
11 | 11 | { |
12 | 12 | |
13 | 13 | |
14 | - public function __construct() |
|
15 | - { |
|
16 | - $this->interface = 'EE_Messages_Template_Pack'; |
|
17 | - } |
|
14 | + public function __construct() |
|
15 | + { |
|
16 | + $this->interface = 'EE_Messages_Template_Pack'; |
|
17 | + } |
|
18 | 18 | |
19 | - public function get_by_name($template_pack_name) |
|
20 | - { |
|
21 | - $this->rewind(); |
|
22 | - while ($this->valid()) { |
|
23 | - if ($this->current()->dbref == $template_pack_name) { |
|
24 | - return $this->current(); |
|
25 | - } |
|
26 | - $this->next(); |
|
27 | - } |
|
28 | - } |
|
19 | + public function get_by_name($template_pack_name) |
|
20 | + { |
|
21 | + $this->rewind(); |
|
22 | + while ($this->valid()) { |
|
23 | + if ($this->current()->dbref == $template_pack_name) { |
|
24 | + return $this->current(); |
|
25 | + } |
|
26 | + $this->next(); |
|
27 | + } |
|
28 | + } |
|
29 | 29 | } |
@@ -15,175 +15,175 @@ |
||
15 | 15 | { |
16 | 16 | |
17 | 17 | |
18 | - /** |
|
19 | - * @type EE_Message_Factory $_instance |
|
20 | - */ |
|
21 | - protected static $_instance = null; |
|
22 | - |
|
23 | - |
|
24 | - /** |
|
25 | - * @type EE_Message_Resource_Manager $_message_resource_manager |
|
26 | - */ |
|
27 | - protected $_message_resource_manager; |
|
28 | - |
|
29 | - |
|
30 | - |
|
31 | - /** |
|
32 | - * EE_Message_Factory constructor. |
|
33 | - * |
|
34 | - * @access protected |
|
35 | - * @param \EE_Message_Resource_Manager $Message_Resource_Manager |
|
36 | - */ |
|
37 | - protected function __construct( |
|
38 | - EE_Message_Resource_Manager $Message_Resource_Manager |
|
39 | - ) { |
|
40 | - $this->_message_resource_manager = $Message_Resource_Manager; |
|
41 | - } |
|
42 | - |
|
43 | - |
|
44 | - |
|
45 | - /** |
|
46 | - * @singleton method used to instantiate class object |
|
47 | - * @access public |
|
48 | - * @param \EE_Message_Resource_Manager $Message_Resource_Manager |
|
49 | - * @return \EE_Message_Factory instance |
|
50 | - */ |
|
51 | - public static function instance(EE_Message_Resource_Manager $Message_Resource_Manager) |
|
52 | - { |
|
53 | - // check if class object is instantiated, and instantiated properly |
|
54 | - if (! self::$_instance instanceof EE_Message_Factory) { |
|
55 | - self::$_instance = new EE_Message_Factory($Message_Resource_Manager); |
|
56 | - } |
|
57 | - return self::$_instance; |
|
58 | - } |
|
59 | - |
|
60 | - |
|
61 | - |
|
62 | - /** |
|
63 | - * @access public |
|
64 | - * @param array $props_n_values |
|
65 | - * @return EE_Message |
|
66 | - */ |
|
67 | - public static function create($props_n_values = array()) |
|
68 | - { |
|
69 | - /** @type EE_Message_Factory $Message_Factory */ |
|
70 | - $Message_Factory = EE_Registry::instance()->load_lib('Message_Factory'); |
|
71 | - return $Message_Factory->_create($props_n_values); |
|
72 | - } |
|
73 | - |
|
74 | - |
|
75 | - |
|
76 | - /** |
|
77 | - * @access public |
|
78 | - * @param \EE_Message $message |
|
79 | - * @return \EE_Message |
|
80 | - * @throws \EE_Error |
|
81 | - */ |
|
82 | - public static function set_messenger_and_message_type(EE_Message $message) |
|
83 | - { |
|
84 | - /** @type EE_Message_Factory $Message_Factory */ |
|
85 | - $Message_Factory = EE_Registry::instance()->load_lib('Message_Factory'); |
|
86 | - return $Message_Factory->_set_messenger_and_message_type($message); |
|
87 | - } |
|
88 | - |
|
89 | - |
|
90 | - |
|
91 | - /** |
|
92 | - * @access public |
|
93 | - * @param \EE_Message $message |
|
94 | - * @return \EE_Message |
|
95 | - * @throws \EE_Error |
|
96 | - */ |
|
97 | - public static function set_messenger(EE_Message $message) |
|
98 | - { |
|
99 | - /** @type EE_Message_Factory $Message_Factory */ |
|
100 | - $Message_Factory = EE_Registry::instance()->load_lib('Message_Factory'); |
|
101 | - return $Message_Factory->_set_messenger($message); |
|
102 | - } |
|
103 | - |
|
104 | - |
|
105 | - |
|
106 | - /** |
|
107 | - * @access public |
|
108 | - * @param \EE_Message $message |
|
109 | - * @return \EE_Message |
|
110 | - * @throws \EE_Error |
|
111 | - */ |
|
112 | - public static function set_message_type(EE_Message $message) |
|
113 | - { |
|
114 | - /** @type EE_Message_Factory $Message_Factory */ |
|
115 | - $Message_Factory = EE_Registry::instance()->load_lib('Message_Factory'); |
|
116 | - return $Message_Factory->_set_message_type($message); |
|
117 | - } |
|
118 | - |
|
119 | - |
|
120 | - |
|
121 | - /** |
|
122 | - * @access protected |
|
123 | - * @param array $props_n_values |
|
124 | - * @return \EE_Message |
|
125 | - * @throws \EE_Error |
|
126 | - */ |
|
127 | - protected function _create($props_n_values = array()) |
|
128 | - { |
|
129 | - $new_instance = false; |
|
130 | - if (! empty($props_n_values['MSG_ID'])) { |
|
131 | - $message = EE_Message::new_instance_from_db($props_n_values); |
|
132 | - } else { |
|
133 | - $message = EE_Message::new_instance($props_n_values); |
|
134 | - $new_instance = true; |
|
135 | - } |
|
136 | - return $this->_set_messenger_and_message_type($message, $new_instance); |
|
137 | - } |
|
138 | - |
|
139 | - |
|
140 | - |
|
141 | - /** |
|
142 | - * @access public |
|
143 | - * @param \EE_Message $message |
|
144 | - * @param bool $new_instance Whether the message type was setup from the database (false) or not (true) |
|
145 | - * @return \EE_Message |
|
146 | - * @throws \EE_Error |
|
147 | - */ |
|
148 | - protected function _set_messenger_and_message_type(EE_Message $message, $new_instance = false) |
|
149 | - { |
|
150 | - $message = $this->_set_messenger($message); |
|
151 | - $message = $this->_set_message_type($message, $new_instance); |
|
152 | - return $message; |
|
153 | - } |
|
154 | - |
|
155 | - |
|
156 | - |
|
157 | - /** |
|
158 | - * @access protected |
|
159 | - * @param \EE_Message $message |
|
160 | - * @return \EE_Message |
|
161 | - * @throws \EE_Error |
|
162 | - */ |
|
163 | - protected function _set_messenger(EE_Message $message) |
|
164 | - { |
|
165 | - $messenger = $this->_message_resource_manager->get_messenger($message->messenger()); |
|
166 | - if ($messenger instanceof EE_messenger) { |
|
167 | - $message->set_messenger_object($messenger); |
|
168 | - } |
|
169 | - return $message; |
|
170 | - } |
|
171 | - |
|
172 | - |
|
173 | - |
|
174 | - /** |
|
175 | - * @access protected |
|
176 | - * @param \EE_Message $message |
|
177 | - * @param bool $new_instance Whether the message type was setup from the database (false) or not (true) |
|
178 | - * @return \EE_Message |
|
179 | - * @throws \EE_Error |
|
180 | - */ |
|
181 | - protected function _set_message_type(EE_Message $message, $new_instance = false) |
|
182 | - { |
|
183 | - $message_type = $this->_message_resource_manager->get_message_type($message->message_type()); |
|
184 | - if ($message_type instanceof EE_message_type) { |
|
185 | - $message->set_message_type_object($message_type, $new_instance); |
|
186 | - } |
|
187 | - return $message; |
|
188 | - } |
|
18 | + /** |
|
19 | + * @type EE_Message_Factory $_instance |
|
20 | + */ |
|
21 | + protected static $_instance = null; |
|
22 | + |
|
23 | + |
|
24 | + /** |
|
25 | + * @type EE_Message_Resource_Manager $_message_resource_manager |
|
26 | + */ |
|
27 | + protected $_message_resource_manager; |
|
28 | + |
|
29 | + |
|
30 | + |
|
31 | + /** |
|
32 | + * EE_Message_Factory constructor. |
|
33 | + * |
|
34 | + * @access protected |
|
35 | + * @param \EE_Message_Resource_Manager $Message_Resource_Manager |
|
36 | + */ |
|
37 | + protected function __construct( |
|
38 | + EE_Message_Resource_Manager $Message_Resource_Manager |
|
39 | + ) { |
|
40 | + $this->_message_resource_manager = $Message_Resource_Manager; |
|
41 | + } |
|
42 | + |
|
43 | + |
|
44 | + |
|
45 | + /** |
|
46 | + * @singleton method used to instantiate class object |
|
47 | + * @access public |
|
48 | + * @param \EE_Message_Resource_Manager $Message_Resource_Manager |
|
49 | + * @return \EE_Message_Factory instance |
|
50 | + */ |
|
51 | + public static function instance(EE_Message_Resource_Manager $Message_Resource_Manager) |
|
52 | + { |
|
53 | + // check if class object is instantiated, and instantiated properly |
|
54 | + if (! self::$_instance instanceof EE_Message_Factory) { |
|
55 | + self::$_instance = new EE_Message_Factory($Message_Resource_Manager); |
|
56 | + } |
|
57 | + return self::$_instance; |
|
58 | + } |
|
59 | + |
|
60 | + |
|
61 | + |
|
62 | + /** |
|
63 | + * @access public |
|
64 | + * @param array $props_n_values |
|
65 | + * @return EE_Message |
|
66 | + */ |
|
67 | + public static function create($props_n_values = array()) |
|
68 | + { |
|
69 | + /** @type EE_Message_Factory $Message_Factory */ |
|
70 | + $Message_Factory = EE_Registry::instance()->load_lib('Message_Factory'); |
|
71 | + return $Message_Factory->_create($props_n_values); |
|
72 | + } |
|
73 | + |
|
74 | + |
|
75 | + |
|
76 | + /** |
|
77 | + * @access public |
|
78 | + * @param \EE_Message $message |
|
79 | + * @return \EE_Message |
|
80 | + * @throws \EE_Error |
|
81 | + */ |
|
82 | + public static function set_messenger_and_message_type(EE_Message $message) |
|
83 | + { |
|
84 | + /** @type EE_Message_Factory $Message_Factory */ |
|
85 | + $Message_Factory = EE_Registry::instance()->load_lib('Message_Factory'); |
|
86 | + return $Message_Factory->_set_messenger_and_message_type($message); |
|
87 | + } |
|
88 | + |
|
89 | + |
|
90 | + |
|
91 | + /** |
|
92 | + * @access public |
|
93 | + * @param \EE_Message $message |
|
94 | + * @return \EE_Message |
|
95 | + * @throws \EE_Error |
|
96 | + */ |
|
97 | + public static function set_messenger(EE_Message $message) |
|
98 | + { |
|
99 | + /** @type EE_Message_Factory $Message_Factory */ |
|
100 | + $Message_Factory = EE_Registry::instance()->load_lib('Message_Factory'); |
|
101 | + return $Message_Factory->_set_messenger($message); |
|
102 | + } |
|
103 | + |
|
104 | + |
|
105 | + |
|
106 | + /** |
|
107 | + * @access public |
|
108 | + * @param \EE_Message $message |
|
109 | + * @return \EE_Message |
|
110 | + * @throws \EE_Error |
|
111 | + */ |
|
112 | + public static function set_message_type(EE_Message $message) |
|
113 | + { |
|
114 | + /** @type EE_Message_Factory $Message_Factory */ |
|
115 | + $Message_Factory = EE_Registry::instance()->load_lib('Message_Factory'); |
|
116 | + return $Message_Factory->_set_message_type($message); |
|
117 | + } |
|
118 | + |
|
119 | + |
|
120 | + |
|
121 | + /** |
|
122 | + * @access protected |
|
123 | + * @param array $props_n_values |
|
124 | + * @return \EE_Message |
|
125 | + * @throws \EE_Error |
|
126 | + */ |
|
127 | + protected function _create($props_n_values = array()) |
|
128 | + { |
|
129 | + $new_instance = false; |
|
130 | + if (! empty($props_n_values['MSG_ID'])) { |
|
131 | + $message = EE_Message::new_instance_from_db($props_n_values); |
|
132 | + } else { |
|
133 | + $message = EE_Message::new_instance($props_n_values); |
|
134 | + $new_instance = true; |
|
135 | + } |
|
136 | + return $this->_set_messenger_and_message_type($message, $new_instance); |
|
137 | + } |
|
138 | + |
|
139 | + |
|
140 | + |
|
141 | + /** |
|
142 | + * @access public |
|
143 | + * @param \EE_Message $message |
|
144 | + * @param bool $new_instance Whether the message type was setup from the database (false) or not (true) |
|
145 | + * @return \EE_Message |
|
146 | + * @throws \EE_Error |
|
147 | + */ |
|
148 | + protected function _set_messenger_and_message_type(EE_Message $message, $new_instance = false) |
|
149 | + { |
|
150 | + $message = $this->_set_messenger($message); |
|
151 | + $message = $this->_set_message_type($message, $new_instance); |
|
152 | + return $message; |
|
153 | + } |
|
154 | + |
|
155 | + |
|
156 | + |
|
157 | + /** |
|
158 | + * @access protected |
|
159 | + * @param \EE_Message $message |
|
160 | + * @return \EE_Message |
|
161 | + * @throws \EE_Error |
|
162 | + */ |
|
163 | + protected function _set_messenger(EE_Message $message) |
|
164 | + { |
|
165 | + $messenger = $this->_message_resource_manager->get_messenger($message->messenger()); |
|
166 | + if ($messenger instanceof EE_messenger) { |
|
167 | + $message->set_messenger_object($messenger); |
|
168 | + } |
|
169 | + return $message; |
|
170 | + } |
|
171 | + |
|
172 | + |
|
173 | + |
|
174 | + /** |
|
175 | + * @access protected |
|
176 | + * @param \EE_Message $message |
|
177 | + * @param bool $new_instance Whether the message type was setup from the database (false) or not (true) |
|
178 | + * @return \EE_Message |
|
179 | + * @throws \EE_Error |
|
180 | + */ |
|
181 | + protected function _set_message_type(EE_Message $message, $new_instance = false) |
|
182 | + { |
|
183 | + $message_type = $this->_message_resource_manager->get_message_type($message->message_type()); |
|
184 | + if ($message_type instanceof EE_message_type) { |
|
185 | + $message->set_message_type_object($message_type, $new_instance); |
|
186 | + } |
|
187 | + return $message; |
|
188 | + } |
|
189 | 189 | } |
@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | public static function instance(EE_Message_Resource_Manager $Message_Resource_Manager) |
52 | 52 | { |
53 | 53 | // check if class object is instantiated, and instantiated properly |
54 | - if (! self::$_instance instanceof EE_Message_Factory) { |
|
54 | + if ( ! self::$_instance instanceof EE_Message_Factory) { |
|
55 | 55 | self::$_instance = new EE_Message_Factory($Message_Resource_Manager); |
56 | 56 | } |
57 | 57 | return self::$_instance; |
@@ -127,7 +127,7 @@ discard block |
||
127 | 127 | protected function _create($props_n_values = array()) |
128 | 128 | { |
129 | 129 | $new_instance = false; |
130 | - if (! empty($props_n_values['MSG_ID'])) { |
|
130 | + if ( ! empty($props_n_values['MSG_ID'])) { |
|
131 | 131 | $message = EE_Message::new_instance_from_db($props_n_values); |
132 | 132 | } else { |
133 | 133 | $message = EE_Message::new_instance($props_n_values); |