@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | -if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) { |
|
3 | - exit( 'No direct script access allowed' ); |
|
2 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
3 | + exit('No direct script access allowed'); |
|
4 | 4 | } |
5 | 5 | |
6 | 6 | |
@@ -28,14 +28,14 @@ discard block |
||
28 | 28 | * indexing the template by key. |
29 | 29 | * @return bool |
30 | 30 | */ |
31 | - public function add( $message_template_group, $EVT_ID = null ) { |
|
32 | - if ( $message_template_group instanceof $this->interface ) { |
|
33 | - $data[ 'key' ] = $this->get_key( |
|
31 | + public function add($message_template_group, $EVT_ID = null) { |
|
32 | + if ($message_template_group instanceof $this->interface) { |
|
33 | + $data['key'] = $this->get_key( |
|
34 | 34 | $message_template_group->messenger(), |
35 | 35 | $message_template_group->message_type(), |
36 | 36 | $EVT_ID |
37 | 37 | ); |
38 | - return parent::add( $message_template_group, $data ); |
|
38 | + return parent::add($message_template_group, $data); |
|
39 | 39 | } |
40 | 40 | return false; |
41 | 41 | } |
@@ -48,10 +48,10 @@ discard block |
||
48 | 48 | * @param $GRP_ID |
49 | 49 | * @return EE_Message_Template_Group | null |
50 | 50 | */ |
51 | - public function get_by_ID( $GRP_ID ) { |
|
51 | + public function get_by_ID($GRP_ID) { |
|
52 | 52 | $this->rewind(); |
53 | - while ( $this->valid() ) { |
|
54 | - if ( $this->current()->ID() === $GRP_ID ) { |
|
53 | + while ($this->valid()) { |
|
54 | + if ($this->current()->ID() === $GRP_ID) { |
|
55 | 55 | $grp = $this->current(); |
56 | 56 | $this->rewind(); |
57 | 57 | return $grp; |
@@ -73,8 +73,8 @@ discard block |
||
73 | 73 | * |
74 | 74 | * @return string |
75 | 75 | */ |
76 | - public function get_key( $messenger, $message_type, $EVT_ID = 0 ) { |
|
77 | - return md5( $messenger.$message_type.$EVT_ID ); |
|
76 | + public function get_key($messenger, $message_type, $EVT_ID = 0) { |
|
77 | + return md5($messenger.$message_type.$EVT_ID); |
|
78 | 78 | } |
79 | 79 | |
80 | 80 | |
@@ -86,11 +86,11 @@ discard block |
||
86 | 86 | * |
87 | 87 | * @return null|EE_Message_Template_Group |
88 | 88 | */ |
89 | - public function get_by_key( $key ) { |
|
89 | + public function get_by_key($key) { |
|
90 | 90 | $this->rewind(); |
91 | - while ( $this->valid() ) { |
|
91 | + while ($this->valid()) { |
|
92 | 92 | $data = $this->getInfo(); |
93 | - if ( isset( $data['key'] ) && $data['key'] === $key ) { |
|
93 | + if (isset($data['key']) && $data['key'] === $key) { |
|
94 | 94 | $handler = $this->current(); |
95 | 95 | $this->rewind(); |
96 | 96 | return $handler; |
@@ -45,7 +45,7 @@ |
||
45 | 45 | |
46 | 46 | /** |
47 | 47 | * This retrieves any EE_Message_Template_Group in the repo by its ID. |
48 | - * @param $GRP_ID |
|
48 | + * @param integer $GRP_ID |
|
49 | 49 | * @return EE_Message_Template_Group | null |
50 | 50 | */ |
51 | 51 | public function get_by_ID( $GRP_ID ) { |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | -if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) { |
|
3 | - exit( 'No direct script access allowed' ); |
|
2 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
3 | + exit('No direct script access allowed'); |
|
4 | 4 | } |
5 | 5 | |
6 | 6 | |
@@ -31,8 +31,8 @@ discard block |
||
31 | 31 | * |
32 | 32 | * @param EE_Message_Type_Collection $message_types |
33 | 33 | */ |
34 | - public function __construct( EE_Message_Type_Collection $message_types ) { |
|
35 | - $this->set_message_type_collection( $message_types ); |
|
34 | + public function __construct(EE_Message_Type_Collection $message_types) { |
|
35 | + $this->set_message_type_collection($message_types); |
|
36 | 36 | } |
37 | 37 | |
38 | 38 | |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | /** |
50 | 50 | * @param mixed $message_types |
51 | 51 | */ |
52 | - public function set_message_type_collection( EE_Message_Type_Collection $message_types ) { |
|
52 | + public function set_message_type_collection(EE_Message_Type_Collection $message_types) { |
|
53 | 53 | $this->_message_type_collection = $message_types; |
54 | 54 | } |
55 | 55 | |
@@ -62,41 +62,41 @@ discard block |
||
62 | 62 | * @param string $folder |
63 | 63 | * @throws \EE_Error |
64 | 64 | */ |
65 | - public function load_message_types_from_folder( $folder = '' ) { |
|
65 | + public function load_message_types_from_folder($folder = '') { |
|
66 | 66 | //make sure autoloaders are set (fail-safe) |
67 | 67 | EED_Messages::set_autoloaders(); |
68 | - $folder = ! empty( $folder ) ? $folder : EE_LIBRARIES . 'messages' . DS . 'message_type'; |
|
69 | - $folder .= $folder[ strlen( $folder ) - 1 ] != DS ? DS : ''; |
|
68 | + $folder = ! empty($folder) ? $folder : EE_LIBRARIES.'messages'.DS.'message_type'; |
|
69 | + $folder .= $folder[strlen($folder) - 1] != DS ? DS : ''; |
|
70 | 70 | // get all the files in that folder that end in ".class.php |
71 | 71 | $filepaths = apply_filters( |
72 | 72 | 'FHEE__EE_messages__get_installed__messagetype_files', |
73 | - glob( $folder . '*.class.php' ) |
|
73 | + glob($folder.'*.class.php') |
|
74 | 74 | ); |
75 | - if ( empty( $filepaths ) ) { |
|
75 | + if (empty($filepaths)) { |
|
76 | 76 | return; |
77 | 77 | } |
78 | - foreach ( (array) $filepaths as $file_path ) { |
|
78 | + foreach ((array) $filepaths as $file_path) { |
|
79 | 79 | // extract filename from path |
80 | - $file_path = basename( $file_path ); |
|
80 | + $file_path = basename($file_path); |
|
81 | 81 | // now remove any file extensions |
82 | - $message_type_class_name = substr( $file_path, 0, strpos( $file_path, '.' ) ); |
|
82 | + $message_type_class_name = substr($file_path, 0, strpos($file_path, '.')); |
|
83 | 83 | |
84 | 84 | //if this class name doesn't represent a message type class, then we just skip. |
85 | - if ( strpos( strtolower( $message_type_class_name ), 'message_type' ) === false ) { |
|
85 | + if (strpos(strtolower($message_type_class_name), 'message_type') === false) { |
|
86 | 86 | continue; |
87 | 87 | } |
88 | 88 | |
89 | - if ( ! class_exists( $message_type_class_name ) ) { |
|
89 | + if ( ! class_exists($message_type_class_name)) { |
|
90 | 90 | throw new EE_Error( |
91 | 91 | sprintf( |
92 | - __( 'The "%1$s" message type class can\'t be loaded from %2$s. Likely there is a typo in the class name or the file name.', 'event_espresso' ), |
|
92 | + __('The "%1$s" message type class can\'t be loaded from %2$s. Likely there is a typo in the class name or the file name.', 'event_espresso'), |
|
93 | 93 | $message_type_class_name, |
94 | 94 | $file_path |
95 | 95 | ) |
96 | 96 | ); |
97 | 97 | } |
98 | 98 | |
99 | - $this->_load_message_type( new $message_type_class_name ); |
|
99 | + $this->_load_message_type(new $message_type_class_name); |
|
100 | 100 | } |
101 | 101 | } |
102 | 102 | |
@@ -106,8 +106,8 @@ discard block |
||
106 | 106 | * @param EE_message_type $message_type |
107 | 107 | * @return bool |
108 | 108 | */ |
109 | - protected function _load_message_type( EE_message_type $message_type ) { |
|
110 | - if ( $this->message_type_collection()->has_by_name( $message_type->name ) ) { |
|
109 | + protected function _load_message_type(EE_message_type $message_type) { |
|
110 | + if ($this->message_type_collection()->has_by_name($message_type->name)) { |
|
111 | 111 | return true; |
112 | 112 | } |
113 | 113 | return $this->message_type_collection()->add( |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | -if (!defined('EVENT_ESPRESSO_VERSION') ) |
|
2 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) |
|
3 | 3 | exit('NO direct script access allowed'); |
4 | 4 | |
5 | 5 | /** |
@@ -184,9 +184,9 @@ discard block |
||
184 | 184 | * @access protected |
185 | 185 | * @param string $messenger |
186 | 186 | */ |
187 | - protected function _set_existing_admin_settings( $messenger = '' ) { |
|
187 | + protected function _set_existing_admin_settings($messenger = '') { |
|
188 | 188 | /** @var EE_Message_Resource_Manager $Message_Resource_Manager */ |
189 | - $Message_Resource_Manager = EE_Registry::instance()->load_lib( 'Message_Resource_Manager' ); |
|
189 | + $Message_Resource_Manager = EE_Registry::instance()->load_lib('Message_Resource_Manager'); |
|
190 | 190 | $active_messengers = $Message_Resource_Manager->get_active_messengers_option(); |
191 | 191 | $settings_to_use = $active_messengers; |
192 | 192 | |
@@ -194,14 +194,14 @@ discard block |
||
194 | 194 | * This determines what will be used for the getting the settings. |
195 | 195 | */ |
196 | 196 | if ( |
197 | - ! empty( $messenger ) |
|
198 | - && $Message_Resource_Manager->is_message_type_active_for_messenger( $messenger, $this->name ) |
|
197 | + ! empty($messenger) |
|
198 | + && $Message_Resource_Manager->is_message_type_active_for_messenger($messenger, $this->name) |
|
199 | 199 | ) { |
200 | - $settings_to_use = $active_messengers[ $messenger ]['settings'][ $messenger . '-message_types' ]; |
|
200 | + $settings_to_use = $active_messengers[$messenger]['settings'][$messenger.'-message_types']; |
|
201 | 201 | } |
202 | 202 | |
203 | - $this->_existing_admin_settings = isset( $settings_to_use[ $this->name ]['settings'] ) |
|
204 | - ? $settings_to_use[ $this->name ]['settings'] |
|
203 | + $this->_existing_admin_settings = isset($settings_to_use[$this->name]['settings']) |
|
204 | + ? $settings_to_use[$this->name]['settings'] |
|
205 | 205 | : null; |
206 | 206 | } |
207 | 207 | |
@@ -218,12 +218,12 @@ discard block |
||
218 | 218 | * @param string $messenger |
219 | 219 | * @return array settings |
220 | 220 | */ |
221 | - public function get_existing_admin_settings( $messenger = '' ) { |
|
221 | + public function get_existing_admin_settings($messenger = '') { |
|
222 | 222 | // if admin_settings property empty lets try setting it. |
223 | - if ( method_exists($this, '_set_existing_admin_settings') && empty( $this->_existing_admin_settings ) ) { |
|
224 | - $this->_set_existing_admin_settings( $messenger ); |
|
223 | + if (method_exists($this, '_set_existing_admin_settings') && empty($this->_existing_admin_settings)) { |
|
224 | + $this->_set_existing_admin_settings($messenger); |
|
225 | 225 | } |
226 | - return property_exists( $this, '_existing_admin_settings' ) |
|
226 | + return property_exists($this, '_existing_admin_settings') |
|
227 | 227 | ? $this->_existing_admin_settings |
228 | 228 | : null; |
229 | 229 | } |
@@ -239,12 +239,12 @@ discard block |
||
239 | 239 | */ |
240 | 240 | public function get_valid_shortcodes() { |
241 | 241 | $valid_shortcodes = apply_filters( |
242 | - 'FHEE__' . get_class( $this ) . '__get_valid_shortcodes', |
|
242 | + 'FHEE__'.get_class($this).'__get_valid_shortcodes', |
|
243 | 243 | $this->_valid_shortcodes, |
244 | 244 | $this |
245 | 245 | ); |
246 | 246 | //The below filter applies to ALL messengers and message types so use with care! |
247 | - $valid_shortcodes = apply_filters( 'FHEE__EE_Messages_Base__get_valid_shortcodes', $valid_shortcodes, $this ); |
|
247 | + $valid_shortcodes = apply_filters('FHEE__EE_Messages_Base__get_valid_shortcodes', $valid_shortcodes, $this); |
|
248 | 248 | return $valid_shortcodes; |
249 | 249 | } |
250 | 250 | |
@@ -278,23 +278,23 @@ discard block |
||
278 | 278 | * @access protected |
279 | 279 | * @return string $content for page. |
280 | 280 | */ |
281 | - protected function _get_admin_page_content( $page, $action, $extra, $actives ) { |
|
281 | + protected function _get_admin_page_content($page, $action, $extra, $actives) { |
|
282 | 282 | //we can also further refine the context by action (if present). |
283 | - if ( !empty($action) ) { |
|
284 | - $page = $page . '_' . $action; |
|
283 | + if ( ! empty($action)) { |
|
284 | + $page = $page.'_'.$action; |
|
285 | 285 | } |
286 | 286 | |
287 | - if ( !isset( $this->admin_registered_pages[$page]) ){ |
|
287 | + if ( ! isset($this->admin_registered_pages[$page])) { |
|
288 | 288 | // todo: a place to throw an exception? |
289 | 289 | // We need to indicate there is no registered page so this function is not being called correctly. |
290 | 290 | return false; |
291 | 291 | } |
292 | 292 | //k made it here so let's call the method |
293 | 293 | $content = call_user_func_array( |
294 | - array( $this, '_get_admin_content_' . $page ), |
|
295 | - array( $actives, $extra ) |
|
294 | + array($this, '_get_admin_content_'.$page), |
|
295 | + array($actives, $extra) |
|
296 | 296 | ); |
297 | - if ( $content === false ) { |
|
297 | + if ($content === false) { |
|
298 | 298 | // todo this needs to be an exception once we've got exceptions in place. |
299 | 299 | return false; |
300 | 300 | } |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | -if (!defined('EVENT_ESPRESSO_VERSION')) |
|
2 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) |
|
3 | 3 | exit('No direct script access allowed'); |
4 | 4 | |
5 | 5 | |
@@ -26,10 +26,10 @@ discard block |
||
26 | 26 | * classname to create an alternative index for retrieving data_handlers. |
27 | 27 | * @return bool |
28 | 28 | */ |
29 | - public function add( $data_handler, $data = null) { |
|
29 | + public function add($data_handler, $data = null) { |
|
30 | 30 | $data = $data === null ? array() : (array) $data; |
31 | - $info['key'] = $this->get_key( get_class( $data_handler ), $data ); |
|
32 | - return parent::add( $data_handler, $info ); |
|
31 | + $info['key'] = $this->get_key(get_class($data_handler), $data); |
|
32 | + return parent::add($data_handler, $info); |
|
33 | 33 | } |
34 | 34 | |
35 | 35 | |
@@ -44,8 +44,8 @@ discard block |
||
44 | 44 | * |
45 | 45 | * @return string md5 hash using provided info. |
46 | 46 | */ |
47 | - public function get_key( $classname, $data ) { |
|
48 | - return md5( $classname . print_r( $data, true ) ); |
|
47 | + public function get_key($classname, $data) { |
|
48 | + return md5($classname.print_r($data, true)); |
|
49 | 49 | } |
50 | 50 | |
51 | 51 | |
@@ -61,11 +61,11 @@ discard block |
||
61 | 61 | * |
62 | 62 | * @return null|EE_Messages_incoming_data |
63 | 63 | */ |
64 | - public function get_by_key( $key ) { |
|
64 | + public function get_by_key($key) { |
|
65 | 65 | $this->rewind(); |
66 | - while( $this->valid() ) { |
|
66 | + while ($this->valid()) { |
|
67 | 67 | $data = $this->getInfo(); |
68 | - if ( isset( $data['key'] ) && $data['key'] === $key ) { |
|
68 | + if (isset($data['key']) && $data['key'] === $key) { |
|
69 | 69 | $handler = $this->current(); |
70 | 70 | $this->rewind(); |
71 | 71 | return $handler; |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | -if (!defined('EVENT_ESPRESSO_VERSION')) |
|
2 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) |
|
3 | 3 | exit('No direct script access allowed'); |
4 | 4 | |
5 | 5 | |
@@ -17,10 +17,10 @@ discard block |
||
17 | 17 | $this->interface = 'EE_Messages_Template_Pack'; |
18 | 18 | } |
19 | 19 | |
20 | - public function get_by_name( $template_pack_name ) { |
|
20 | + public function get_by_name($template_pack_name) { |
|
21 | 21 | $this->rewind(); |
22 | - while ( $this->valid() ) { |
|
23 | - if ( $this->current()->dbref == $template_pack_name ) { |
|
22 | + while ($this->valid()) { |
|
23 | + if ($this->current()->dbref == $template_pack_name) { |
|
24 | 24 | return $this->current(); |
25 | 25 | } |
26 | 26 | $this->next(); |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | -if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) { |
|
3 | - exit( 'No direct script access allowed' ); |
|
2 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
3 | + exit('No direct script access allowed'); |
|
4 | 4 | } |
5 | 5 | |
6 | 6 | |
@@ -32,8 +32,8 @@ discard block |
||
32 | 32 | * |
33 | 33 | * @param EE_Messenger_Collection $messengers |
34 | 34 | */ |
35 | - public function __construct( EE_Messenger_Collection $messengers ) { |
|
36 | - $this->set_messenger_collection( $messengers ); |
|
35 | + public function __construct(EE_Messenger_Collection $messengers) { |
|
36 | + $this->set_messenger_collection($messengers); |
|
37 | 37 | } |
38 | 38 | |
39 | 39 | |
@@ -50,7 +50,7 @@ discard block |
||
50 | 50 | /** |
51 | 51 | * @param mixed $messengers |
52 | 52 | */ |
53 | - public function set_messenger_collection( EE_Messenger_Collection $messengers ) { |
|
53 | + public function set_messenger_collection(EE_Messenger_Collection $messengers) { |
|
54 | 54 | $this->_messenger_collection = $messengers; |
55 | 55 | } |
56 | 56 | |
@@ -63,41 +63,41 @@ discard block |
||
63 | 63 | * @param string $folder |
64 | 64 | * @throws \EE_Error |
65 | 65 | */ |
66 | - public function load_messengers_from_folder( $folder = '' ) { |
|
66 | + public function load_messengers_from_folder($folder = '') { |
|
67 | 67 | //make sure autoloaders are set (fail-safe) |
68 | 68 | EED_Messages::set_autoloaders(); |
69 | - $folder = ! empty( $folder ) ? $folder : EE_LIBRARIES . 'messages' . DS . 'messenger'; |
|
70 | - $folder .= $folder[ strlen( $folder ) - 1 ] != DS ? DS : ''; |
|
69 | + $folder = ! empty($folder) ? $folder : EE_LIBRARIES.'messages'.DS.'messenger'; |
|
70 | + $folder .= $folder[strlen($folder) - 1] != DS ? DS : ''; |
|
71 | 71 | // get all the files in that folder that end in ".class.php |
72 | 72 | $filepaths = apply_filters( |
73 | 73 | 'FHEE__EE_messages__get_installed__messenger_files', |
74 | - glob( $folder . '*.class.php' ) |
|
74 | + glob($folder.'*.class.php') |
|
75 | 75 | ); |
76 | - if ( empty( $filepaths ) ) { |
|
76 | + if (empty($filepaths)) { |
|
77 | 77 | return; |
78 | 78 | } |
79 | - foreach ( (array) $filepaths as $file_path ) { |
|
79 | + foreach ((array) $filepaths as $file_path) { |
|
80 | 80 | // extract filename from path |
81 | - $file_path = basename( $file_path ); |
|
81 | + $file_path = basename($file_path); |
|
82 | 82 | // now remove any file extensions |
83 | - $messenger_class_name = substr( $file_path, 0, strpos( $file_path, '.' ) ); |
|
83 | + $messenger_class_name = substr($file_path, 0, strpos($file_path, '.')); |
|
84 | 84 | |
85 | 85 | //first check to see if the class name represents an actual messenger class. |
86 | - if ( strpos( strtolower( $messenger_class_name ), 'messenger' ) === false ) { |
|
86 | + if (strpos(strtolower($messenger_class_name), 'messenger') === false) { |
|
87 | 87 | continue; |
88 | 88 | } |
89 | 89 | |
90 | - if ( ! class_exists( $messenger_class_name ) ) { |
|
90 | + if ( ! class_exists($messenger_class_name)) { |
|
91 | 91 | throw new EE_Error( |
92 | 92 | sprintf( |
93 | - __( 'The "%1$s" messenger class can\'t be loaded from %2$s. Likely there is a typo in the class name or the file name.', 'event_espresso' ), |
|
93 | + __('The "%1$s" messenger class can\'t be loaded from %2$s. Likely there is a typo in the class name or the file name.', 'event_espresso'), |
|
94 | 94 | $messenger_class_name, |
95 | 95 | $file_path |
96 | 96 | ) |
97 | 97 | ); |
98 | 98 | } |
99 | 99 | |
100 | - $this->_load_messenger( new $messenger_class_name() ); |
|
100 | + $this->_load_messenger(new $messenger_class_name()); |
|
101 | 101 | } |
102 | 102 | } |
103 | 103 | |
@@ -113,10 +113,10 @@ discard block |
||
113 | 113 | EED_Messages::set_autoloaders(); |
114 | 114 | $active_messengers = apply_filters( |
115 | 115 | 'FHEE__EEH_MSG_Template__get_active_messengers_in_db', |
116 | - get_option( 'ee_active_messengers', array() ) |
|
116 | + get_option('ee_active_messengers', array()) |
|
117 | 117 | ); |
118 | - foreach ( (array) $active_messengers as $active_messenger_classname => $active_messenger ) { |
|
119 | - $this->_load_messenger( $active_messenger ); |
|
118 | + foreach ((array) $active_messengers as $active_messenger_classname => $active_messenger) { |
|
119 | + $this->_load_messenger($active_messenger); |
|
120 | 120 | } |
121 | 121 | } |
122 | 122 | |
@@ -128,8 +128,8 @@ discard block |
||
128 | 128 | * @param \EE_messenger $messenger |
129 | 129 | * @return bool |
130 | 130 | */ |
131 | - protected function _load_messenger( EE_messenger $messenger ) { |
|
132 | - if ( $this->messenger_collection()->has_by_name( $messenger->name ) ) { |
|
131 | + protected function _load_messenger(EE_messenger $messenger) { |
|
132 | + if ($this->messenger_collection()->has_by_name($messenger->name)) { |
|
133 | 133 | return true; |
134 | 134 | } |
135 | 135 | return $this->messenger_collection()->add( |
@@ -51,26 +51,26 @@ |
||
51 | 51 | |
52 | 52 | |
53 | 53 | |
54 | - protected function _get_data_for_context( $context, EE_Registration $registration, $id ) { |
|
54 | + protected function _get_data_for_context($context, EE_Registration $registration, $id) { |
|
55 | 55 | |
56 | 56 | //use the registration to get the transaction. |
57 | 57 | $transaction = $registration->transaction(); |
58 | 58 | |
59 | 59 | //bail early if no transaction |
60 | - if ( ! $transaction instanceof EE_Transaction ) { |
|
61 | - throw new EE_Error( __('The given registration does not have an associated transaction. Something is wrong.', 'event_espresso' ) ); |
|
60 | + if ( ! $transaction instanceof EE_Transaction) { |
|
61 | + throw new EE_Error(__('The given registration does not have an associated transaction. Something is wrong.', 'event_espresso')); |
|
62 | 62 | } |
63 | 63 | |
64 | - $payment = ! empty( $id ) ? EEM_Payment::instance()->get_one( array( array( 'PAY_ID' => $id, 'TXN_ID' => $transaction->ID() ) ) ) : 0; |
|
64 | + $payment = ! empty($id) ? EEM_Payment::instance()->get_one(array(array('PAY_ID' => $id, 'TXN_ID' => $transaction->ID()))) : 0; |
|
65 | 65 | |
66 | - return array( $transaction, $payment ); |
|
66 | + return array($transaction, $payment); |
|
67 | 67 | } |
68 | 68 | |
69 | 69 | |
70 | 70 | |
71 | - protected function _get_admin_content_events_edit_for_messenger( EE_messenger $messenger ) { |
|
71 | + protected function _get_admin_content_events_edit_for_messenger(EE_messenger $messenger) { |
|
72 | 72 | //this is just a test |
73 | - return $this->name . ' Message Type for ' . $messenger->name . ' Messenger '; |
|
73 | + return $this->name.' Message Type for '.$messenger->name.' Messenger '; |
|
74 | 74 | } |
75 | 75 | |
76 | 76 | /** |
@@ -38,35 +38,35 @@ discard block |
||
38 | 38 | } |
39 | 39 | |
40 | 40 | |
41 | - protected function _get_admin_content_events_edit_for_messenger( EE_messenger $messenger ) { |
|
41 | + protected function _get_admin_content_events_edit_for_messenger(EE_messenger $messenger) { |
|
42 | 42 | //this is just a test |
43 | - return $this->name . ' Message Type for ' . $messenger->name . ' Messenger '; |
|
43 | + return $this->name.' Message Type for '.$messenger->name.' Messenger '; |
|
44 | 44 | } |
45 | 45 | |
46 | 46 | |
47 | 47 | |
48 | 48 | |
49 | 49 | protected function _set_data_handler() { |
50 | - if ( is_array( $this->_data ) ) { |
|
51 | - $data_type = reset( $this->_data ); |
|
50 | + if (is_array($this->_data)) { |
|
51 | + $data_type = reset($this->_data); |
|
52 | 52 | |
53 | - if ( is_array( $data_type ) ) { |
|
53 | + if (is_array($data_type)) { |
|
54 | 54 | //grab the first item and see if its a registration. |
55 | - $maybe_reg = isset( $data_type[0] ) && is_array( $data_type[0] ) ? reset( $data_type[0] ) : reset( $data_type ); |
|
56 | - if ( $maybe_reg instanceof EE_Registration ) { |
|
55 | + $maybe_reg = isset($data_type[0]) && is_array($data_type[0]) ? reset($data_type[0]) : reset($data_type); |
|
56 | + if ($maybe_reg instanceof EE_Registration) { |
|
57 | 57 | //is $data_type itself just an array of registrations? |
58 | - if ( isset( $data_type[1] ) && $data_type[1] instanceof EE_Registration ) { |
|
58 | + if (isset($data_type[1]) && $data_type[1] instanceof EE_Registration) { |
|
59 | 59 | $regs = $data_type; |
60 | 60 | } else { |
61 | - $regs = is_array( $data_type[0] ) ? $data_type[0] : array( $maybe_reg ); |
|
61 | + $regs = is_array($data_type[0]) ? $data_type[0] : array($maybe_reg); |
|
62 | 62 | } |
63 | 63 | |
64 | - foreach ( $regs as $reg ) { |
|
65 | - if ( $reg instanceof EE_Registration ) { |
|
64 | + foreach ($regs as $reg) { |
|
65 | + if ($reg instanceof EE_Registration) { |
|
66 | 66 | $this->_regs_for_sending[] = $reg->ID(); |
67 | 67 | } |
68 | 68 | } |
69 | - $this->_data = isset( $this->_data[1] ) ? array( $maybe_reg->transaction(), null, $this->_data[1] ) : array( $maybe_reg->transaction() ); |
|
69 | + $this->_data = isset($this->_data[1]) ? array($maybe_reg->transaction(), null, $this->_data[1]) : array($maybe_reg->transaction()); |
|
70 | 70 | $this->_data_handler = 'Gateways'; |
71 | 71 | } else { |
72 | 72 | $this->_data_handler = 'Gateways'; |
@@ -83,18 +83,18 @@ discard block |
||
83 | 83 | |
84 | 84 | |
85 | 85 | |
86 | - protected function _get_data_for_context( $context, EE_Registration $registration, $id ) { |
|
87 | - if ( $context == 'admin' ) { |
|
86 | + protected function _get_data_for_context($context, EE_Registration $registration, $id) { |
|
87 | + if ($context == 'admin') { |
|
88 | 88 | //use the registration to get the transaction. |
89 | 89 | $transaction = $registration->transaction(); |
90 | 90 | |
91 | 91 | //bail early if no transaction |
92 | - if ( ! $transaction instanceof EE_Transaction ) { |
|
93 | - throw new EE_Error( __('The given registration does not have an associated transaction. Something is wrong.', 'event_espresso' ) ); |
|
92 | + if ( ! $transaction instanceof EE_Transaction) { |
|
93 | + throw new EE_Error(__('The given registration does not have an associated transaction. Something is wrong.', 'event_espresso')); |
|
94 | 94 | } |
95 | 95 | |
96 | - $payment = !empty( $id ) ? EEM_Payment::instance()->get_one( array( array( 'PAY_ID' => $id, 'TXN_ID' => $transaction->ID() ) ) ) : 0; |
|
97 | - return array( $transaction, $payment ); |
|
96 | + $payment = ! empty($id) ? EEM_Payment::instance()->get_one(array(array('PAY_ID' => $id, 'TXN_ID' => $transaction->ID()))) : 0; |
|
97 | + return array($transaction, $payment); |
|
98 | 98 | } else { |
99 | 99 | return $registration; |
100 | 100 | } |
@@ -120,7 +120,7 @@ discard block |
||
120 | 120 | * @return array array of EE_Messages_Addressee objects |
121 | 121 | */ |
122 | 122 | protected function _admin_addressees() { |
123 | - if ( $this->_single_message ) |
|
123 | + if ($this->_single_message) |
|
124 | 124 | return array(); |
125 | 125 | return parent::_admin_addressees(); |
126 | 126 | } |
@@ -128,7 +128,7 @@ discard block |
||
128 | 128 | |
129 | 129 | |
130 | 130 | protected function _primary_attendee_addressees() { |
131 | - if ( $this->_single_message ) |
|
131 | + if ($this->_single_message) |
|
132 | 132 | return array(); |
133 | 133 | |
134 | 134 | return parent::_primary_attendee_addressees(); |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -if (!defined('EVENT_ESPRESSO_VERSION') ) |
|
3 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) |
|
4 | 4 | exit('NO direct script access allowed'); |
5 | 5 | |
6 | 6 | /** |
@@ -29,8 +29,8 @@ discard block |
||
29 | 29 | * For the constructor of this special preview class. We're either looking for an event id or empty data. If we have an event id (or ids) then we'll use that as the source for the "dummy" data. If the data is empty then we'll get the first three published events from the users database and use that as a source. |
30 | 30 | * @param array $data |
31 | 31 | */ |
32 | - public function __construct( $data = array() ) { |
|
33 | - $this->_data = isset( $data['event_ids'] ) ? $data['event_ids'] : array(); |
|
32 | + public function __construct($data = array()) { |
|
33 | + $this->_data = isset($data['event_ids']) ? $data['event_ids'] : array(); |
|
34 | 34 | $this->_setup_attendees_events(); |
35 | 35 | parent::__construct($data); |
36 | 36 | } |
@@ -46,7 +46,7 @@ discard block |
||
46 | 46 | * |
47 | 47 | * @return array The prepped data for db |
48 | 48 | */ |
49 | - static public function convert_data_for_persistent_storage( $data ) { |
|
49 | + static public function convert_data_for_persistent_storage($data) { |
|
50 | 50 | return $data; |
51 | 51 | } |
52 | 52 | |
@@ -61,7 +61,7 @@ discard block |
||
61 | 61 | * |
62 | 62 | * @return array |
63 | 63 | */ |
64 | - static public function convert_data_from_persistent_storage( $data ) { |
|
64 | + static public function convert_data_from_persistent_storage($data) { |
|
65 | 65 | return $data; |
66 | 66 | } |
67 | 67 | |
@@ -78,12 +78,12 @@ discard block |
||
78 | 78 | $attendees = $this->_get_some_attendees(); |
79 | 79 | |
80 | 80 | //if empty $data we'll do a query to get some events from the server. otherwise we'll retrieve the event data for the given ids. |
81 | - $events = $this->_get_some_events( $this->_data ); |
|
81 | + $events = $this->_get_some_events($this->_data); |
|
82 | 82 | |
83 | 83 | $answers_n_questions = $this->_get_some_q_and_as(); |
84 | 84 | |
85 | - if ( count( $events ) < 1 ) { |
|
86 | - throw new EE_Error( __('We can\'t generate a preview for you because there are no active events in your database', 'event_espresso' ) ); |
|
85 | + if (count($events) < 1) { |
|
86 | + throw new EE_Error(__('We can\'t generate a preview for you because there are no active events in your database', 'event_espresso')); |
|
87 | 87 | } |
88 | 88 | |
89 | 89 | |
@@ -93,14 +93,14 @@ discard block |
||
93 | 93 | |
94 | 94 | //we'll actually use the generated line_item identifiers for our loop |
95 | 95 | $dtts = $tkts = array(); |
96 | - foreach( $events as $id => $event ) { |
|
97 | - if ( ! $event instanceof EE_Event ) { |
|
96 | + foreach ($events as $id => $event) { |
|
97 | + if ( ! $event instanceof EE_Event) { |
|
98 | 98 | continue; |
99 | 99 | } |
100 | 100 | $this->_events[$id]['ID'] = $id; |
101 | 101 | $this->_events[$id]['name'] = $event->get('EVT_name'); |
102 | 102 | $datetime = $event->get_first_related('Datetime'); |
103 | - $tickets = $datetime instanceof EE_Datetime ? $datetime->get_many_related('Ticket', array('default_where_conditions' => 'none') ) : array(); |
|
103 | + $tickets = $datetime instanceof EE_Datetime ? $datetime->get_many_related('Ticket', array('default_where_conditions' => 'none')) : array(); |
|
104 | 104 | $this->_events[$id]['event'] = $event; |
105 | 105 | $this->_events[$id]['reg_objs'] = array(); |
106 | 106 | $this->_events[$id]['tkt_objs'] = $tickets; |
@@ -108,51 +108,51 @@ discard block |
||
108 | 108 | |
109 | 109 | $dttcache = array(); |
110 | 110 | $tkts = array(); |
111 | - foreach ( $tickets as $ticket ) { |
|
112 | - if ( ! $ticket instanceof EE_Ticket ) { |
|
111 | + foreach ($tickets as $ticket) { |
|
112 | + if ( ! $ticket instanceof EE_Ticket) { |
|
113 | 113 | continue; |
114 | 114 | } |
115 | 115 | $reldatetime = $ticket->datetimes(); |
116 | - $tkts[ $ticket->ID() ] = array(); |
|
117 | - $tkts[ $ticket->ID() ][ 'ticket' ] = $ticket; |
|
118 | - $tkts[ $ticket->ID() ][ 'dtt_objs' ] = $reldatetime; |
|
119 | - $tkts[ $ticket->ID() ][ 'att_objs' ] = $attendees; |
|
120 | - $tkts[ $ticket->ID() ][ 'count' ] = count( $attendees ); |
|
121 | - $tkts[ $ticket->ID() ][ 'EE_Event' ] = $event; |
|
122 | - foreach ( $reldatetime as $datetime ) { |
|
123 | - if ( $datetime instanceof EE_Datetime && ! isset( $dtts[ $datetime->ID() ] ) ) { |
|
124 | - $this->_events[ $id ][ 'dtt_objs' ][ $datetime->ID() ] = $datetime; |
|
125 | - $dtts[ $datetime->ID() ][ 'datetime' ] = $datetime; |
|
126 | - $dtts[ $datetime->ID() ][ 'tkt_objs' ][] = $ticket; |
|
127 | - $dtts[ $datetime->ID() ][ 'evt_objs' ][] = $event; |
|
128 | - $dttcache[ $datetime->ID() ] = $datetime; |
|
116 | + $tkts[$ticket->ID()] = array(); |
|
117 | + $tkts[$ticket->ID()]['ticket'] = $ticket; |
|
118 | + $tkts[$ticket->ID()]['dtt_objs'] = $reldatetime; |
|
119 | + $tkts[$ticket->ID()]['att_objs'] = $attendees; |
|
120 | + $tkts[$ticket->ID()]['count'] = count($attendees); |
|
121 | + $tkts[$ticket->ID()]['EE_Event'] = $event; |
|
122 | + foreach ($reldatetime as $datetime) { |
|
123 | + if ($datetime instanceof EE_Datetime && ! isset($dtts[$datetime->ID()])) { |
|
124 | + $this->_events[$id]['dtt_objs'][$datetime->ID()] = $datetime; |
|
125 | + $dtts[$datetime->ID()]['datetime'] = $datetime; |
|
126 | + $dtts[$datetime->ID()]['tkt_objs'][] = $ticket; |
|
127 | + $dtts[$datetime->ID()]['evt_objs'][] = $event; |
|
128 | + $dttcache[$datetime->ID()] = $datetime; |
|
129 | 129 | } |
130 | 130 | } |
131 | 131 | } |
132 | 132 | |
133 | - $this->_events[$id]['total_attendees'] = count( $attendees ); |
|
133 | + $this->_events[$id]['total_attendees'] = count($attendees); |
|
134 | 134 | $this->_events[$id]['att_objs'] = $attendees; |
135 | 135 | |
136 | 136 | //let's also setup the dummy attendees property! |
137 | - foreach ( $attendees as $att_key => $attendee ) { |
|
138 | - if ( ! $attendee instanceof EE_Attendee ) { |
|
137 | + foreach ($attendees as $att_key => $attendee) { |
|
138 | + if ( ! $attendee instanceof EE_Attendee) { |
|
139 | 139 | continue; |
140 | 140 | } |
141 | - $this->_attendees[$att_key]['line_ref'][] = $id; //so later it can be determined what events this attendee registered for! |
|
141 | + $this->_attendees[$att_key]['line_ref'][] = $id; //so later it can be determined what events this attendee registered for! |
|
142 | 142 | $this->_attendees[$att_key]['evt_objs'][] = $event; |
143 | 143 | $this->_attendees[$att_key]['att_obj'] = $attendee; |
144 | 144 | //$this->_attendees[$att_key]['registration_id'] = 0; |
145 | 145 | $this->_attendees[$att_key]['attendee_email'] = $attendee->email(); |
146 | 146 | $this->_attendees[$att_key]['tkt_objs'] = $tickets; |
147 | - if ( $att_key == 999999991 ) { |
|
147 | + if ($att_key == 999999991) { |
|
148 | 148 | $this->_attendees[$att_key]['ans_objs'][999] = $answers_n_questions['answers'][999]; |
149 | 149 | $this->_attendees[$att_key]['ans_objs'][1002] = $answers_n_questions['answers'][1002]; |
150 | 150 | $this->_attendees[$att_key]['ans_objs'][1005] = $answers_n_questions['answers'][1005]; |
151 | - } elseif ( $att_key == 999999992 ) { |
|
151 | + } elseif ($att_key == 999999992) { |
|
152 | 152 | $this->_attendees[$att_key]['ans_objs'][1000] = $answers_n_questions['answers'][1000]; |
153 | 153 | $this->_attendees[$att_key]['ans_objs'][1003] = $answers_n_questions['answers'][1003]; |
154 | 154 | $this->_attendees[$att_key]['ans_objs'][1006] = $answers_n_questions['answers'][1006]; |
155 | - } elseif ( $att_key == 999999993 ) { |
|
155 | + } elseif ($att_key == 999999993) { |
|
156 | 156 | $this->_attendees[$att_key]['ans_objs'][1001] = $answers_n_questions['answers'][1001]; |
157 | 157 | $this->_attendees[$att_key]['ans_objs'][1004] = $answers_n_questions['answers'][1004]; |
158 | 158 | $this->_attendees[$att_key]['ans_objs'][1007] = $answers_n_questions['answers'][1007]; |
@@ -225,11 +225,11 @@ discard block |
||
225 | 225 | |
226 | 226 | //let's generate the attendee objects |
227 | 227 | $attendees = array(); |
228 | - $var_array = array('fname','lname','email','address','address2','city','staid','cntry','zip','phone','deleted','attid'); |
|
228 | + $var_array = array('fname', 'lname', 'email', 'address', 'address2', 'city', 'staid', 'cntry', 'zip', 'phone', 'deleted', 'attid'); |
|
229 | 229 | |
230 | 230 | //EE_Registry::instance()->load_class( 'Attendee', array(), FALSE, false, TRUE ); |
231 | - foreach ( $dummy_attendees as $dummy ) { |
|
232 | - $att = array_combine( $var_array, $dummy ); |
|
231 | + foreach ($dummy_attendees as $dummy) { |
|
232 | + $att = array_combine($var_array, $dummy); |
|
233 | 233 | extract($att); |
234 | 234 | /** @var $fname string */ |
235 | 235 | /** @var $lname string */ |
@@ -346,15 +346,15 @@ discard block |
||
346 | 346 | |
347 | 347 | $qsts = array(); |
348 | 348 | //first the questions |
349 | - foreach ( $quests_array as $qst ) { |
|
350 | - $qstobj = array_combine( $qst_columns, $qst ); |
|
349 | + foreach ($quests_array as $qst) { |
|
350 | + $qstobj = array_combine($qst_columns, $qst); |
|
351 | 351 | $qsts[$qstobj['QST_ID']] = EE_Question::new_instance($qstobj); |
352 | 352 | } |
353 | 353 | |
354 | 354 | //now the answers (and we'll setup our arrays) |
355 | 355 | $q_n_as = array(); |
356 | - foreach ( $ans_array as $ans ) { |
|
357 | - $ansobj = array_combine( $ans_columns, $ans ); |
|
356 | + foreach ($ans_array as $ans) { |
|
357 | + $ansobj = array_combine($ans_columns, $ans); |
|
358 | 358 | $ansobj = EE_Answer::new_instance($ansobj); |
359 | 359 | $q_n_as['answers'][$ansobj->ID()] = $ansobj; |
360 | 360 | $q_n_as['questions'][$ansobj->ID()] = $qsts[$ansobj->get('QST_ID')]; |
@@ -376,25 +376,25 @@ discard block |
||
376 | 376 | * @param array $event_ids if set, this will be an array of event ids to obtain events for. |
377 | 377 | * @return array An array of event objects from the db. |
378 | 378 | */ |
379 | - private function _get_some_events( $event_ids = array() ) { |
|
379 | + private function _get_some_events($event_ids = array()) { |
|
380 | 380 | |
381 | 381 | //HEY, if we have an evt_id then we want to make sure we use that for the preview (because a specific event template is being viewed); |
382 | - $event_ids = isset( $_REQUEST['evt_id'] ) && !empty( $_REQUEST['evt_id'] ) |
|
383 | - ? array( $_REQUEST['evt_id'] ) |
|
382 | + $event_ids = isset($_REQUEST['evt_id']) && ! empty($_REQUEST['evt_id']) |
|
383 | + ? array($_REQUEST['evt_id']) |
|
384 | 384 | : $event_ids; |
385 | 385 | |
386 | - $limit = !empty( $event_ids ) |
|
386 | + $limit = ! empty($event_ids) |
|
387 | 387 | ? NULL |
388 | - : apply_filters( 'FHEE__EE_Messages_Preview_incoming_data___get_some_events__limit', '0,1' ); |
|
388 | + : apply_filters('FHEE__EE_Messages_Preview_incoming_data___get_some_events__limit', '0,1'); |
|
389 | 389 | |
390 | - $where = ! empty( $event_ids ) |
|
390 | + $where = ! empty($event_ids) |
|
391 | 391 | ? array( |
392 | - 'EVT_ID' => array( 'IN', $event_ids ), |
|
393 | - 'Datetime.Ticket.TKT_ID' => array( '>', 1 ) |
|
392 | + 'EVT_ID' => array('IN', $event_ids), |
|
393 | + 'Datetime.Ticket.TKT_ID' => array('>', 1) |
|
394 | 394 | ) |
395 | - : array( 'Datetime.Ticket.TKT_ID' => array( '>', 1 ) ); |
|
395 | + : array('Datetime.Ticket.TKT_ID' => array('>', 1)); |
|
396 | 396 | |
397 | - $events = EE_Registry::instance()->load_model('Event')->get_all(array($where, 'limit' => $limit ) ); |
|
397 | + $events = EE_Registry::instance()->load_model('Event')->get_all(array($where, 'limit' => $limit)); |
|
398 | 398 | |
399 | 399 | return $events; |
400 | 400 | } |
@@ -407,17 +407,17 @@ discard block |
||
407 | 407 | protected function _setup_data() { |
408 | 408 | |
409 | 409 | //need to figure out the running total for test purposes so... we're going to create a temp cart and add the tickets to it! |
410 | - if ( EE_Registry::instance()->SSN instanceof EE_Session ) { |
|
411 | - EE_Registry::instance()->SSN->clear_session( __CLASS__, __FUNCTION__ ); |
|
410 | + if (EE_Registry::instance()->SSN instanceof EE_Session) { |
|
411 | + EE_Registry::instance()->SSN->clear_session(__CLASS__, __FUNCTION__); |
|
412 | 412 | $session = EE_Registry::instance()->SSN; |
413 | 413 | } else { |
414 | - $session = EE_Registry::instance()->load_core( 'Session' ); |
|
414 | + $session = EE_Registry::instance()->load_core('Session'); |
|
415 | 415 | } |
416 | - $cart = EE_Cart::instance( null, $session ); |
|
416 | + $cart = EE_Cart::instance(null, $session); |
|
417 | 417 | |
418 | 418 | |
419 | 419 | //add tickets to cart |
420 | - foreach ( $this->tickets as $ticket ) { |
|
420 | + foreach ($this->tickets as $ticket) { |
|
421 | 421 | $cart->add_ticket_to_cart($ticket['ticket']); |
422 | 422 | } |
423 | 423 | |
@@ -441,14 +441,14 @@ discard block |
||
441 | 441 | //note we're setting up a reg object for each attendee in each event but ALSO adding to the reg_object array. |
442 | 442 | $this->reg_objs = array(); |
443 | 443 | $regid = 9999990; |
444 | - foreach ( $this->_attendees as $key => $attendee ) { |
|
444 | + foreach ($this->_attendees as $key => $attendee) { |
|
445 | 445 | //note we need to setup reg_objects for each event this attendee belongs to |
446 | 446 | $regatt = $attendee['att_obj'] instanceof EE_Attendee ? $attendee['att_obj']->ID() : null; |
447 | 447 | $regtxn = $this->txn->ID(); |
448 | 448 | $regcnt = 1; |
449 | - foreach ( $attendee['line_ref'] as $evtid ) { |
|
450 | - foreach ( $this->_events[$evtid]['tkt_objs'] as $ticket ) { |
|
451 | - if ( ! $ticket instanceof EE_Ticket ) { |
|
449 | + foreach ($attendee['line_ref'] as $evtid) { |
|
450 | + foreach ($this->_events[$evtid]['tkt_objs'] as $ticket) { |
|
451 | + if ( ! $ticket instanceof EE_Ticket) { |
|
452 | 452 | continue; |
453 | 453 | } |
454 | 454 | $reg_array = array( |
@@ -460,14 +460,14 @@ discard block |
||
460 | 460 | 'REG_date' => time(), |
461 | 461 | 'REG_final_price' => $ticket->get('TKT_price'), |
462 | 462 | 'REG_session' => 'dummy_session_id', |
463 | - 'REG_code' => $regid . '-dummy-generated-code', |
|
464 | - 'REG_url_link' => $regcnt . '-daafpapasdlfakasdfpqasdfasdf', |
|
463 | + 'REG_code' => $regid.'-dummy-generated-code', |
|
464 | + 'REG_url_link' => $regcnt.'-daafpapasdlfakasdfpqasdfasdf', |
|
465 | 465 | 'REG_count' => $regcnt, |
466 | 466 | 'REG_group_size' => $this->_events[$evtid]['total_attendees'], |
467 | 467 | 'REG_att_is_going' => TRUE, |
468 | 468 | 'REG_ID' => $regid |
469 | 469 | ); |
470 | - $REG_OBJ = EE_Registration::new_instance( $reg_array ); |
|
470 | + $REG_OBJ = EE_Registration::new_instance($reg_array); |
|
471 | 471 | $this->_attendees[$key]['reg_objs'][$regid] = $REG_OBJ; |
472 | 472 | $this->_events[$evtid]['reg_objs'][] = $REG_OBJ; |
473 | 473 | $this->reg_objs[] = $REG_OBJ; |
@@ -483,40 +483,40 @@ discard block |
||
483 | 483 | |
484 | 484 | //setup line items! |
485 | 485 | EE_Registry::instance()->load_helper('Line_Item'); |
486 | - $line_item_total = EEH_Line_Item::create_total_line_item( $this->txn ); |
|
486 | + $line_item_total = EEH_Line_Item::create_total_line_item($this->txn); |
|
487 | 487 | |
488 | 488 | //add tickets |
489 | - foreach ( $this->tickets as $tktid => $item ) { |
|
489 | + foreach ($this->tickets as $tktid => $item) { |
|
490 | 490 | $qty = $item['count']; |
491 | 491 | $ticket = $item['ticket']; |
492 | - EEH_Line_Item::add_ticket_purchase( $line_item_total, $ticket, $qty ); |
|
492 | + EEH_Line_Item::add_ticket_purchase($line_item_total, $ticket, $qty); |
|
493 | 493 | } |
494 | 494 | |
495 | - $shipping_line_item = EE_Line_Item::new_instance( array( |
|
496 | - 'LIN_name' => __( 'Shipping Surcharge', 'event_espresso' ), |
|
497 | - 'LIN_desc' => __( 'Sent via Millenium Falcon', 'event_espresso' ), |
|
495 | + $shipping_line_item = EE_Line_Item::new_instance(array( |
|
496 | + 'LIN_name' => __('Shipping Surcharge', 'event_espresso'), |
|
497 | + 'LIN_desc' => __('Sent via Millenium Falcon', 'event_espresso'), |
|
498 | 498 | 'LIN_unit_price' => 20, |
499 | 499 | 'LIN_quantity' => 1, |
500 | 500 | 'LIN_is_taxable' => TRUE, |
501 | 501 | 'LIN_total' => 20, |
502 | 502 | 'LIN_type' => EEM_Line_Item::type_line_item |
503 | 503 | )); |
504 | - EEH_Line_Item::add_item($line_item_total, $shipping_line_item ); |
|
505 | - $this->additional_line_items = array( $shipping_line_item ); |
|
504 | + EEH_Line_Item::add_item($line_item_total, $shipping_line_item); |
|
505 | + $this->additional_line_items = array($shipping_line_item); |
|
506 | 506 | |
507 | 507 | //now let's add taxes |
508 | - EEH_Line_Item::apply_taxes( $line_item_total ); |
|
508 | + EEH_Line_Item::apply_taxes($line_item_total); |
|
509 | 509 | |
510 | 510 | //now we should be able to get the items we need from this object |
511 | - $event_line_items = EEH_Line_Item::get_pre_tax_subtotal( $line_item_total )->children(); |
|
511 | + $event_line_items = EEH_Line_Item::get_pre_tax_subtotal($line_item_total)->children(); |
|
512 | 512 | $line_items = array(); |
513 | - foreach ( $event_line_items as $line_id => $line_item ) { |
|
514 | - if ( ! $line_item instanceof EE_Line_Item || $line_item->OBJ_type() !== 'Event' ) { |
|
513 | + foreach ($event_line_items as $line_id => $line_item) { |
|
514 | + if ( ! $line_item instanceof EE_Line_Item || $line_item->OBJ_type() !== 'Event') { |
|
515 | 515 | continue; |
516 | 516 | } |
517 | - $ticket_line_items = EEH_Line_Item::get_ticket_line_items( $line_item ); |
|
518 | - foreach ( $ticket_line_items as $ticket_line_id => $ticket_line_item ) { |
|
519 | - if ( ! $ticket_line_item instanceof EE_Line_Item ) { |
|
517 | + $ticket_line_items = EEH_Line_Item::get_ticket_line_items($line_item); |
|
518 | + foreach ($ticket_line_items as $ticket_line_id => $ticket_line_item) { |
|
519 | + if ( ! $ticket_line_item instanceof EE_Line_Item) { |
|
520 | 520 | continue; |
521 | 521 | } |
522 | 522 | $this->tickets[$ticket_line_item->OBJ_ID()]['line_item'] = $ticket_line_item; |
@@ -532,12 +532,12 @@ discard block |
||
532 | 532 | //add proper total to transaction object. |
533 | 533 | $grand_total = $line_item_total->recalculate_total_including_taxes(); |
534 | 534 | $this->grand_total_line_item = $line_item_total; |
535 | - $this->txn->set_total( $grand_total ); |
|
535 | + $this->txn->set_total($grand_total); |
|
536 | 536 | |
537 | 537 | |
538 | 538 | //add additional details for each registration |
539 | - foreach ( $this->reg_objs as $reg ) { |
|
540 | - if ( ! $reg instanceof EE_Registration ) { |
|
539 | + foreach ($this->reg_objs as $reg) { |
|
540 | + if ( ! $reg instanceof EE_Registration) { |
|
541 | 541 | continue; |
542 | 542 | } |
543 | 543 | $this->_registrations[$reg->ID()]['tkt_obj'] = $this->tickets[$reg->get('TKT_ID')]['ticket']; |
@@ -562,17 +562,17 @@ discard block |
||
562 | 562 | ? $this->_attendees[999999991]['att_obj']->fname() |
563 | 563 | : '', |
564 | 564 | |
565 | - 'lname' => $this->_attendees[ 999999991 ][ 'att_obj' ] instanceof EE_Attendee |
|
565 | + 'lname' => $this->_attendees[999999991]['att_obj'] instanceof EE_Attendee |
|
566 | 566 | ? $this->_attendees[999999991]['att_obj']->lname() |
567 | 567 | : '', |
568 | 568 | |
569 | - 'email' => $this->_attendees[ 999999991 ][ 'att_obj' ] instanceof EE_Attendee |
|
569 | + 'email' => $this->_attendees[999999991]['att_obj'] instanceof EE_Attendee |
|
570 | 570 | ? $this->_attendees[999999991]['att_obj']->email() |
571 | 571 | : '', |
572 | 572 | |
573 | 573 | 'att_obj' => $this->_attendees[999999991]['att_obj'], |
574 | 574 | |
575 | - 'reg_obj' => array_shift( $attendees_to_shift[999999991]['reg_objs'] ) |
|
575 | + 'reg_obj' => array_shift($attendees_to_shift[999999991]['reg_objs']) |
|
576 | 576 | ); |
577 | 577 | |
578 | 578 | //reg_info property |
@@ -580,7 +580,7 @@ discard block |
||
580 | 580 | $this->reg_info = array(); |
581 | 581 | |
582 | 582 | //let's set a reg_obj for messengers expecting one. |
583 | - $this->reg_obj = array_pop( $this->_attendees[999999991]['reg_objs'] ); |
|
583 | + $this->reg_obj = array_pop($this->_attendees[999999991]['reg_objs']); |
|
584 | 584 | |
585 | 585 | |
586 | 586 | //the below are just dummy items. |