@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | 0 => array( |
34 | 34 | 'content_id' => 'attendee-column-tip', |
35 | 35 | 'target' => '.column-attendees .dashicons-groups', |
36 | - 'content' => sprintf( __('%s Registrations', 'event_espresso'), EEH_Template::pretty_status(EEM_Registration::status_id_approved, FALSE, 'sentence') ), |
|
36 | + 'content' => sprintf(__('%s Registrations', 'event_espresso'), EEH_Template::pretty_status(EEM_Registration::status_id_approved, FALSE, 'sentence')), |
|
37 | 37 | 'options' => array( |
38 | 38 | 'position' => array( |
39 | 39 | 'my' => 'bottom left', |
@@ -124,7 +124,7 @@ discard block |
||
124 | 124 | * @param EE_Datetime constant $status What status is set (by class) |
125 | 125 | * @return string The status legend with the related status highlighted |
126 | 126 | */ |
127 | - private function _event_status_legend( $status ) { |
|
127 | + private function _event_status_legend($status) { |
|
128 | 128 | |
129 | 129 | $status_array = array( |
130 | 130 | 'active_status' => EE_Datetime::active, |
@@ -136,7 +136,7 @@ discard block |
||
136 | 136 | 'inactive_status' => EE_Datetime::inactive |
137 | 137 | ); |
138 | 138 | |
139 | - return EEH_Template::status_legend( $status_array, $status ); |
|
139 | + return EEH_Template::status_legend($status_array, $status); |
|
140 | 140 | } |
141 | 141 | |
142 | 142 | } |
143 | 143 | \ No newline at end of file |
@@ -6,8 +6,9 @@ |
||
6 | 6 | * @package Event Espresso |
7 | 7 | * @subpackage messages |
8 | 8 | */ |
9 | -if (!defined('EVENT_ESPRESSO_VERSION') ) |
|
9 | +if (!defined('EVENT_ESPRESSO_VERSION') ) { |
|
10 | 10 | exit('NO direct script access allowed'); |
11 | +} |
|
11 | 12 | |
12 | 13 | /** |
13 | 14 | * |
@@ -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 | /** |
@@ -41,8 +41,8 @@ discard block |
||
41 | 41 | |
42 | 42 | |
43 | 43 | protected function _setup_data() { |
44 | - $this->_data = $this->get_admin_page()->get_message_templates( $this->_per_page, $this->_view, FALSE); |
|
45 | - $this->_all_data_count = $this->get_admin_page()->get_message_templates( $this->_per_page, $this->_view, TRUE, TRUE ); |
|
44 | + $this->_data = $this->get_admin_page()->get_message_templates($this->_per_page, $this->_view, FALSE); |
|
45 | + $this->_all_data_count = $this->get_admin_page()->get_message_templates($this->_per_page, $this->_view, TRUE, TRUE); |
|
46 | 46 | } |
47 | 47 | |
48 | 48 | |
@@ -51,21 +51,21 @@ discard block |
||
51 | 51 | |
52 | 52 | protected function _set_properties() { |
53 | 53 | $this->_wp_list_args = array( |
54 | - 'singular' => __('Message Template Group', 'event_espresso' ), |
|
55 | - 'plural' => __('Message Template', 'event_espresso' ), |
|
54 | + 'singular' => __('Message Template Group', 'event_espresso'), |
|
55 | + 'plural' => __('Message Template', 'event_espresso'), |
|
56 | 56 | 'ajax' => TRUE, //for now, |
57 | 57 | 'screen' => $this->get_admin_page()->get_current_screen()->id |
58 | 58 | ); |
59 | 59 | $this->_columns = array( |
60 | 60 | //'cb' => '<input type="checkbox" />', //no deleting default (global) templates! |
61 | 61 | 'message_type' => __('Message Type', 'event_espresso'), |
62 | - 'messenger' => __( 'Messenger', 'event_espresso'), |
|
63 | - 'description' => __( 'Description', 'event_espresso' ), |
|
62 | + 'messenger' => __('Messenger', 'event_espresso'), |
|
63 | + 'description' => __('Description', 'event_espresso'), |
|
64 | 64 | //'messages_sent' => __( 'Total Sent', 'event_espresso' ) //todo this will come later when we've got message tracking in place. |
65 | 65 | ); |
66 | 66 | |
67 | 67 | $this->_sortable_columns = array( |
68 | - 'messenger' => array( 'MTP_messenger' => TRUE ), |
|
68 | + 'messenger' => array('MTP_messenger' => TRUE), |
|
69 | 69 | //'message_type' => array( 'MTP_message_type' => FALSE ) |
70 | 70 | ); |
71 | 71 | |
@@ -84,16 +84,16 @@ discard block |
||
84 | 84 | * |
85 | 85 | * @return string |
86 | 86 | */ |
87 | - public function single_row( $item ) { |
|
87 | + public function single_row($item) { |
|
88 | 88 | $message_type = $item->message_type_obj(); |
89 | 89 | $messenger = $item->messenger_obj(); |
90 | 90 | |
91 | - if ( ! $message_type instanceof EE_message_type || ! $messenger instanceof EE_messenger ) { |
|
91 | + if ( ! $message_type instanceof EE_message_type || ! $messenger instanceof EE_messenger) { |
|
92 | 92 | echo ''; |
93 | 93 | return; |
94 | 94 | } |
95 | 95 | |
96 | - parent::single_row( $item ); |
|
96 | + parent::single_row($item); |
|
97 | 97 | } |
98 | 98 | |
99 | 99 | |
@@ -111,8 +111,8 @@ discard block |
||
111 | 111 | ); |
112 | 112 | |
113 | 113 | //set filters to select inputs if they aren't empty |
114 | - foreach ( $select_inputs as $select_input ) { |
|
115 | - if ( $select_input ) { |
|
114 | + foreach ($select_inputs as $select_input) { |
|
115 | + if ($select_input) { |
|
116 | 116 | $filters[] = $select_input; |
117 | 117 | } |
118 | 118 | } |
@@ -123,20 +123,20 @@ discard block |
||
123 | 123 | * we're just removing the search box for message templates, not needed. |
124 | 124 | * @return string (empty); |
125 | 125 | */ |
126 | - function search_box( $text, $input_id ) { |
|
126 | + function search_box($text, $input_id) { |
|
127 | 127 | return ''; |
128 | 128 | } |
129 | 129 | |
130 | 130 | |
131 | 131 | protected function _add_view_counts() { |
132 | - foreach ( $this->_views as $view => $args ) { |
|
133 | - $this->_views[$view]['count'] = $this->get_admin_page()->get_message_templates( $this->_per_page, $view, TRUE, TRUE ); |
|
132 | + foreach ($this->_views as $view => $args) { |
|
133 | + $this->_views[$view]['count'] = $this->get_admin_page()->get_message_templates($this->_per_page, $view, TRUE, TRUE); |
|
134 | 134 | } |
135 | 135 | } |
136 | 136 | |
137 | 137 | |
138 | 138 | |
139 | - public function column_cb( $item ) { |
|
139 | + public function column_cb($item) { |
|
140 | 140 | return ''; |
141 | 141 | } |
142 | 142 | |
@@ -144,8 +144,8 @@ discard block |
||
144 | 144 | |
145 | 145 | |
146 | 146 | |
147 | - function column_description( $item ) { |
|
148 | - return '<p>' . $item->message_type_obj()->description . '</p>'; |
|
147 | + function column_description($item) { |
|
148 | + return '<p>'.$item->message_type_obj()->description.'</p>'; |
|
149 | 149 | } |
150 | 150 | |
151 | 151 | |
@@ -160,27 +160,27 @@ discard block |
||
160 | 160 | $actions = array(); |
161 | 161 | |
162 | 162 | // edit link but only if item isn't trashed. |
163 | - if ( !$item->get('MTP_deleted') && EE_Registry::instance()->CAP->current_user_can( 'ee_edit_message', 'espresso_messages_edit_message_template', $item->ID() ) ) { |
|
164 | - $edit_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'edit_message_template', 'id'=>$item->GRP_ID() ), EE_MSG_ADMIN_URL ); |
|
165 | - $actions['edit'] = '<a href="'.$edit_lnk_url.'" title="' . esc_attr__( 'Edit Template Group', 'event_espresso' ) . '">' . __( 'Edit', 'event_espresso' ) . '</a>'; |
|
163 | + if ( ! $item->get('MTP_deleted') && EE_Registry::instance()->CAP->current_user_can('ee_edit_message', 'espresso_messages_edit_message_template', $item->ID())) { |
|
164 | + $edit_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'edit_message_template', 'id'=>$item->GRP_ID()), EE_MSG_ADMIN_URL); |
|
165 | + $actions['edit'] = '<a href="'.$edit_lnk_url.'" title="'.esc_attr__('Edit Template Group', 'event_espresso').'">'.__('Edit', 'event_espresso').'</a>'; |
|
166 | 166 | } |
167 | 167 | |
168 | - $name_link = ! $item->get('MTP_deleted') && EE_Registry::instance()->CAP->current_user_can( 'ee_edit_message', 'espresso_messages_edit_message_template', $item->ID() ) ? '<a href="'.$edit_lnk_url.'" title="' . esc_attr__( 'Edit Template Group', 'event_espresso' ) . '">' . ucwords( $item->messenger_obj()->label['singular'] ) . '</a>' : ucwords( $item->messenger_obj()->label['singular'] ); |
|
168 | + $name_link = ! $item->get('MTP_deleted') && EE_Registry::instance()->CAP->current_user_can('ee_edit_message', 'espresso_messages_edit_message_template', $item->ID()) ? '<a href="'.$edit_lnk_url.'" title="'.esc_attr__('Edit Template Group', 'event_espresso').'">'.ucwords($item->messenger_obj()->label['singular']).'</a>' : ucwords($item->messenger_obj()->label['singular']); |
|
169 | 169 | |
170 | 170 | //we want to display the contexts in here so we need to set them up |
171 | 171 | $c_label = $item->context_label(); |
172 | 172 | $c_configs = $item->contexts_config(); |
173 | 173 | $ctxt = array(); |
174 | 174 | $context_templates = $item->context_templates(); |
175 | - foreach ( $context_templates as $context => $template_fields ) { |
|
176 | - $mtp_to = !empty( $context_templates[$context]['to'] ) && $context_templates[$context]['to'] instanceof EE_Message_Template ? $context_templates[$context]['to']->get('MTP_content') : NULL; |
|
177 | - $inactive = empty( $mtp_to ) && !empty( $context_templates[$context]['to'] ) ? ' class="mtp-inactive"' : ''; |
|
175 | + foreach ($context_templates as $context => $template_fields) { |
|
176 | + $mtp_to = ! empty($context_templates[$context]['to']) && $context_templates[$context]['to'] instanceof EE_Message_Template ? $context_templates[$context]['to']->get('MTP_content') : NULL; |
|
177 | + $inactive = empty($mtp_to) && ! empty($context_templates[$context]['to']) ? ' class="mtp-inactive"' : ''; |
|
178 | 178 | $context_title = ucwords($c_configs[$context]['label']); |
179 | - $edit_link = EE_Admin_Page::add_query_args_and_nonce( array('action'=>'edit_message_template', 'id'=>$item->GRP_ID(), 'context' => $context), EE_MSG_ADMIN_URL ); |
|
180 | - $ctxt[] = EE_Registry::instance()->CAP->current_user_can( 'ee_edit_message', 'espresso_messages_edit_message_template', $item->ID() ) ? '<a' . $inactive . ' href="'. $edit_link . '" title="' . esc_attr__('Edit Context', 'event_espresso') . '">' . $context_title . '</a>' : $context_title; |
|
179 | + $edit_link = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'edit_message_template', 'id'=>$item->GRP_ID(), 'context' => $context), EE_MSG_ADMIN_URL); |
|
180 | + $ctxt[] = EE_Registry::instance()->CAP->current_user_can('ee_edit_message', 'espresso_messages_edit_message_template', $item->ID()) ? '<a'.$inactive.' href="'.$edit_link.'" title="'.esc_attr__('Edit Context', 'event_espresso').'">'.$context_title.'</a>' : $context_title; |
|
181 | 181 | } |
182 | 182 | |
183 | - $ctx_content = !$item->get('MTP_deleted') && EE_Registry::instance()->CAP->current_user_can( 'ee_edit_message', 'espresso_messages_edit_message_template', $item->ID() ) ? sprintf( __('<strong>%s:</strong> ', 'event_espresso'), ucwords($c_label['plural']) ) . implode(' | ', $ctxt) : ''; |
|
183 | + $ctx_content = ! $item->get('MTP_deleted') && EE_Registry::instance()->CAP->current_user_can('ee_edit_message', 'espresso_messages_edit_message_template', $item->ID()) ? sprintf(__('<strong>%s:</strong> ', 'event_espresso'), ucwords($c_label['plural'])).implode(' | ', $ctxt) : ''; |
|
184 | 184 | |
185 | 185 | |
186 | 186 | //Return the name contents |
@@ -188,7 +188,7 @@ discard block |
||
188 | 188 | /* $1%s */ $name_link, |
189 | 189 | /* $2%s */ $item->GRP_ID(), |
190 | 190 | /* %4$s */ $ctx_content, |
191 | - /* $3%s */ $this->row_actions( $actions ) |
|
191 | + /* $3%s */ $this->row_actions($actions) |
|
192 | 192 | ); |
193 | 193 | } |
194 | 194 | |
@@ -198,7 +198,7 @@ discard block |
||
198 | 198 | * @return string message_type name |
199 | 199 | */ |
200 | 200 | function column_message_type($item) { |
201 | - return ucwords($item->message_type_obj()->label['singular'] ); |
|
201 | + return ucwords($item->message_type_obj()->label['singular']); |
|
202 | 202 | } |
203 | 203 | |
204 | 204 | |
@@ -225,16 +225,16 @@ discard block |
||
225 | 225 | ) |
226 | 226 | ); |
227 | 227 | |
228 | - foreach ( $active_message_template_groups_grouped_by_messenger as $active_message_template_group ) { |
|
229 | - if ( $active_message_template_group instanceof EE_Message_Template_Group ) { |
|
228 | + foreach ($active_message_template_groups_grouped_by_messenger as $active_message_template_group) { |
|
229 | + if ($active_message_template_group instanceof EE_Message_Template_Group) { |
|
230 | 230 | $messenger = $active_message_template_group->messenger_obj(); |
231 | 231 | $messenger_label = $messenger instanceof EE_messenger |
232 | 232 | ? $messenger->label['singular'] |
233 | 233 | : $active_message_template_group->messenger(); |
234 | - $messenger_options[ $active_message_template_group->messenger() ] = ucwords( $messenger_label ); |
|
234 | + $messenger_options[$active_message_template_group->messenger()] = ucwords($messenger_label); |
|
235 | 235 | } |
236 | 236 | } |
237 | - return $this->get_admin_page()->get_messengers_select_input( $messenger_options ); |
|
237 | + return $this->get_admin_page()->get_messengers_select_input($messenger_options); |
|
238 | 238 | } |
239 | 239 | |
240 | 240 | |
@@ -254,16 +254,16 @@ discard block |
||
254 | 254 | ) |
255 | 255 | ); |
256 | 256 | |
257 | - foreach ( $active_message_template_groups_grouped_by_message_type as $active_message_template_group ) { |
|
258 | - if ( $active_message_template_group instanceof EE_Message_Template_Group ) { |
|
257 | + foreach ($active_message_template_groups_grouped_by_message_type as $active_message_template_group) { |
|
258 | + if ($active_message_template_group instanceof EE_Message_Template_Group) { |
|
259 | 259 | $message_type = $active_message_template_group->message_type_obj(); |
260 | 260 | $message_type_label = $message_type instanceof EE_message_type |
261 | 261 | ? $message_type->label['singular'] |
262 | 262 | : $active_message_template_group->message_type(); |
263 | - $message_type_options[ $active_message_template_group->message_type() ] = ucwords( $message_type_label ); |
|
263 | + $message_type_options[$active_message_template_group->message_type()] = ucwords($message_type_label); |
|
264 | 264 | } |
265 | 265 | } |
266 | - return $this->get_admin_page()->get_message_types_select_input( $message_type_options ); |
|
266 | + return $this->get_admin_page()->get_message_types_select_input($message_type_options); |
|
267 | 267 | } |
268 | 268 | |
269 | 269 | } |
@@ -92,7 +92,7 @@ discard block |
||
92 | 92 | |
93 | 93 | |
94 | 94 | private function _registration_trash_message() { |
95 | - return '<p>' . __('This lock-icon means that this registration cannot be trashed. Registrations that belong to a transaction that has payments cannot be trashed. If you wish to trash this registration then you must delete all payments attached to the related transaction first.', 'event_espresso') . '</p>'; |
|
95 | + return '<p>'.__('This lock-icon means that this registration cannot be trashed. Registrations that belong to a transaction that has payments cannot be trashed. If you wish to trash this registration then you must delete all payments attached to the related transaction first.', 'event_espresso').'</p>'; |
|
96 | 96 | } |
97 | 97 | |
98 | 98 | |
@@ -104,7 +104,7 @@ discard block |
||
104 | 104 | * @param EEM_Registration constant $status What status is set (by class) |
105 | 105 | * @return string The status legend with the related status highlighted |
106 | 106 | */ |
107 | - private function _registration_status_legend( $status ) { |
|
107 | + private function _registration_status_legend($status) { |
|
108 | 108 | |
109 | 109 | $status_array = array( |
110 | 110 | 'approved_status' => EEM_Registration::status_id_approved, |
@@ -114,6 +114,6 @@ discard block |
||
114 | 114 | 'cancelled_status' => EEM_Registration::status_id_cancelled |
115 | 115 | ); |
116 | 116 | |
117 | - return EEH_Template::status_legend( $status_array, $status ); |
|
117 | + return EEH_Template::status_legend($status_array, $status); |
|
118 | 118 | } |
119 | 119 | } |
120 | 120 | \ No newline at end of file |
@@ -83,7 +83,7 @@ discard block |
||
83 | 83 | * @param EEM_Transaction constant $status What status is set (by class) |
84 | 84 | * @return string The status legend with the related status highlighted |
85 | 85 | */ |
86 | - private function _transaction_status_legend( $status ) { |
|
86 | + private function _transaction_status_legend($status) { |
|
87 | 87 | |
88 | 88 | $status_array = array( |
89 | 89 | 'overpaid' => EEM_Transaction::overpaid_status_code, |
@@ -92,6 +92,6 @@ discard block |
||
92 | 92 | 'failed' => EEM_Transaction::failed_status_code, |
93 | 93 | ); |
94 | 94 | |
95 | - return EEH_Template::status_legend( $status_array, $status ); |
|
95 | + return EEH_Template::status_legend($status_array, $status); |
|
96 | 96 | } |
97 | 97 | } |
98 | 98 | \ No newline at end of file |
@@ -2,25 +2,25 @@ |
||
2 | 2 | //this displays any legends with an array of $items that are indexed by id for each item and each item itself is an array of 'icon' and 'desc'. |
3 | 3 | |
4 | 4 | //figure out the columns based on the count of items (we want a max of 6 items per column). |
5 | -$per_col = isset( $per_column ) ? $per_column : 5; |
|
5 | +$per_col = isset($per_column) ? $per_column : 5; |
|
6 | 6 | $count = 1; |
7 | 7 | ?> |
8 | 8 | <div class="ee-list-table-legend-container"> |
9 | 9 | <h4><?php _e('Legend', 'event_espresso'); ?></h4> |
10 | 10 | <dl class="alignleft ee-list-table-legend"> |
11 | - <?php foreach ( $items as $item => $details ) : ?> |
|
12 | - <?php if ( $per_col < $count ) : ?> |
|
11 | + <?php foreach ($items as $item => $details) : ?> |
|
12 | + <?php if ($per_col < $count) : ?> |
|
13 | 13 | </dl> |
14 | 14 | <dl class="alignleft ee-list-table-legend"> |
15 | 15 | <?php $count = 1; endif; ?> |
16 | 16 | <dt id="ee-legend-item-<?php echo $item; ?>"> |
17 | - <?php $class = ! empty( $details['class'] ) ? $details['class'] : 'ee-legend-img-container'; ?> |
|
18 | - <?php if ( strpos( $details[ 'class' ], '<span' ) !== false ) { |
|
17 | + <?php $class = ! empty($details['class']) ? $details['class'] : 'ee-legend-img-container'; ?> |
|
18 | + <?php if (strpos($details['class'], '<span') !== false) { |
|
19 | 19 | echo $class; |
20 | 20 | } else { ?> |
21 | 21 | <span class="<?php echo $class; ?>"> |
22 | - <?php if ( ! empty( $details[ 'icon' ] ) ) : ?> |
|
23 | - <img src="<?php echo $details[ 'icon' ]; ?>" class="ee-legend-icon" alt="<?php echo esc_attr( $details[ 'desc' ] ); ?>"/> |
|
22 | + <?php if ( ! empty($details['icon'])) : ?> |
|
23 | + <img src="<?php echo $details['icon']; ?>" class="ee-legend-icon" alt="<?php echo esc_attr($details['desc']); ?>"/> |
|
24 | 24 | <?php endif; ?> |
25 | 25 | </span> |
26 | 26 | <?php } ?> |
@@ -55,21 +55,21 @@ discard block |
||
55 | 55 | 'QSO_deleted'=>new EE_Trashed_Flag_Field('QSO_deleted', __('Flag indicating Option was trashed','event_espresso'), false, false) |
56 | 56 | ) |
57 | 57 | */ |
58 | -class EE_DMS_4_1_0_questions extends EE_Data_Migration_Script_Stage{ |
|
58 | +class EE_DMS_4_1_0_questions extends EE_Data_Migration_Script_Stage { |
|
59 | 59 | private $_old_table; |
60 | 60 | private $_new_table; |
61 | 61 | private $_option_table; |
62 | - function _migration_step($num_items=50){ |
|
62 | + function _migration_step($num_items = 50) { |
|
63 | 63 | global $wpdb; |
64 | 64 | $start_at_record = $this->count_records_migrated(); |
65 | - $rows = $wpdb->get_results($wpdb->prepare("SELECT * FROM $this->_old_table LIMIT %d,%d",$start_at_record,$num_items),ARRAY_A); |
|
65 | + $rows = $wpdb->get_results($wpdb->prepare("SELECT * FROM $this->_old_table LIMIT %d,%d", $start_at_record, $num_items), ARRAY_A); |
|
66 | 66 | $items_actually_migrated = 0; |
67 | - foreach($rows as $question_row){ |
|
67 | + foreach ($rows as $question_row) { |
|
68 | 68 | $new_id = $this->_insert_new_question($question_row); |
69 | 69 | $this->get_migration_script()->set_mapping($this->_old_table, $question_row['id'], $this->_new_table, $new_id); |
70 | 70 | $items_actually_migrated++; |
71 | 71 | } |
72 | - if($this->count_records_migrated() + $items_actually_migrated >= $this->count_records_to_migrate()){ |
|
72 | + if ($this->count_records_migrated() + $items_actually_migrated >= $this->count_records_to_migrate()) { |
|
73 | 73 | $this->set_completed(); |
74 | 74 | } |
75 | 75 | return $items_actually_migrated; |
@@ -87,14 +87,14 @@ discard block |
||
87 | 87 | $this->_option_table = $wpdb->prefix."esp_question_option"; |
88 | 88 | parent::__construct(); |
89 | 89 | } |
90 | - private function _insert_new_question($old_question){ |
|
90 | + private function _insert_new_question($old_question) { |
|
91 | 91 | global $wpdb; |
92 | 92 | //if this pretends to be a 'system' question, check if we already have a |
93 | 93 | //system question for that string. If so, pretend THAT new question |
94 | 94 | //is what we just isnerted |
95 | - if($old_question['system_name']){ |
|
96 | - $id_of_new_system_question = intval($wpdb->get_var($wpdb->prepare("SELECT QST_ID FROM {$this->_new_table} WHERE QST_system = %s",$old_question['system_name']))); |
|
97 | - if($id_of_new_system_question){ |
|
95 | + if ($old_question['system_name']) { |
|
96 | + $id_of_new_system_question = intval($wpdb->get_var($wpdb->prepare("SELECT QST_ID FROM {$this->_new_table} WHERE QST_system = %s", $old_question['system_name']))); |
|
97 | + if ($id_of_new_system_question) { |
|
98 | 98 | return $id_of_new_system_question; |
99 | 99 | } |
100 | 100 | //ok so this must be the first one. Carry on. |
@@ -113,27 +113,27 @@ discard block |
||
113 | 113 | 'QST_deleted'=>false |
114 | 114 | ); |
115 | 115 | $datatypes = array( |
116 | - '%s',//QST_display_text |
|
117 | - '%s',//QST-admin_label |
|
118 | - '%s',//QST_system |
|
119 | - '%s',//QST_type |
|
120 | - '%d',//QST_required |
|
121 | - '%s',//QST_required_text |
|
122 | - '%d',//QST_order |
|
123 | - '%d',//QST_admin_only |
|
124 | - '%d',//QST_wp_user |
|
125 | - '%d',//QST_deleted |
|
116 | + '%s', //QST_display_text |
|
117 | + '%s', //QST-admin_label |
|
118 | + '%s', //QST_system |
|
119 | + '%s', //QST_type |
|
120 | + '%d', //QST_required |
|
121 | + '%s', //QST_required_text |
|
122 | + '%d', //QST_order |
|
123 | + '%d', //QST_admin_only |
|
124 | + '%d', //QST_wp_user |
|
125 | + '%d', //QST_deleted |
|
126 | 126 | ); |
127 | - $success = $wpdb->insert($this->_new_table,$cols_n_values,$datatypes); |
|
128 | - if ( ! $success){ |
|
127 | + $success = $wpdb->insert($this->_new_table, $cols_n_values, $datatypes); |
|
128 | + if ( ! $success) { |
|
129 | 129 | $this->add_error($this->get_migration_script()->_create_error_message_for_db_insertion($this->_old_table, $old_question, $this->_new_table, $cols_n_values, $datatypes)); |
130 | 130 | return 0; |
131 | 131 | } |
132 | 132 | $new_id = $wpdb->insert_id; |
133 | 133 | //now take care of posisbly adding question options |
134 | - if(in_array($old_question['question_type'],array('DROPDOWN','SINGLE','MULTIPLE'))){ |
|
135 | - $options = explode(",",$old_question['response']); |
|
136 | - foreach($options as $option){ |
|
134 | + if (in_array($old_question['question_type'], array('DROPDOWN', 'SINGLE', 'MULTIPLE'))) { |
|
135 | + $options = explode(",", $old_question['response']); |
|
136 | + foreach ($options as $option) { |
|
137 | 137 | $this->_insert_question_option($option, $new_id); |
138 | 138 | } |
139 | 139 | } |
@@ -146,7 +146,7 @@ discard block |
||
146 | 146 | * @param int $question_id |
147 | 147 | * @return int |
148 | 148 | */ |
149 | - private function _insert_question_option($option,$question_id){ |
|
149 | + private function _insert_question_option($option, $question_id) { |
|
150 | 150 | $option = trim($option); |
151 | 151 | global $wpdb; |
152 | 152 | $cols_n_values = array( |
@@ -154,14 +154,14 @@ discard block |
||
154 | 154 | 'QSO_value'=>$option, |
155 | 155 | 'QSO_deleted'=>false |
156 | 156 | ); |
157 | - $datatypes= array( |
|
158 | - '%d',//QST_ID |
|
159 | - '%s',//QSO_value |
|
160 | - '%d',//QSO_deleted |
|
157 | + $datatypes = array( |
|
158 | + '%d', //QST_ID |
|
159 | + '%s', //QSO_value |
|
160 | + '%d', //QSO_deleted |
|
161 | 161 | ); |
162 | - $success = $wpdb->insert($this->_option_table,$cols_n_values,$datatypes); |
|
163 | - if ( ! $success ){ |
|
164 | - $this->add_error($this->get_migration_script()->_create_error_message_for_db_insertion($this->_old_table, array('option'=>$option,'new_question_id'=>$question_id), $this->_option_table, $cols_n_values, $datatypes)); |
|
162 | + $success = $wpdb->insert($this->_option_table, $cols_n_values, $datatypes); |
|
163 | + if ( ! $success) { |
|
164 | + $this->add_error($this->get_migration_script()->_create_error_message_for_db_insertion($this->_old_table, array('option'=>$option, 'new_question_id'=>$question_id), $this->_option_table, $cols_n_values, $datatypes)); |
|
165 | 165 | return 0; |
166 | 166 | } |
167 | 167 | return $wpdb->insert_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 | /** |
@@ -12,68 +12,68 @@ discard block |
||
12 | 12 | * @author Mike Nelson |
13 | 13 | * |
14 | 14 | */ |
15 | -class EE_DMS_4_8_0_event_subtotals extends EE_Data_Migration_Script_Stage_Table{ |
|
16 | - function __construct(){ |
|
15 | +class EE_DMS_4_8_0_event_subtotals extends EE_Data_Migration_Script_Stage_Table { |
|
16 | + function __construct() { |
|
17 | 17 | global $wpdb; |
18 | - $this->_old_table = $wpdb->prefix . 'esp_line_item'; |
|
18 | + $this->_old_table = $wpdb->prefix.'esp_line_item'; |
|
19 | 19 | $this->_extra_where_sql = ' WHERE LIN_type="sub-total" AND LIN_code="pre-tax-subtotal"'; |
20 | 20 | $this->_pretty_name = __('Event Sub-total line items', 'event_espresso'); |
21 | 21 | parent::__construct(); |
22 | 22 | } |
23 | - protected function _migrate_old_row( $line_item_row ) { |
|
23 | + protected function _migrate_old_row($line_item_row) { |
|
24 | 24 | global $wpdb; |
25 | 25 | //what event is this line item for? this can be found by looking at its transaction's registration's EVT_ID |
26 | - $event_id = $wpdb->get_var( $wpdb->prepare( 'SELECT EVT_ID FROM ' . $wpdb->prefix . 'esp_registration WHERE TXN_ID=%d LIMIT 1', $line_item_row[ 'TXN_ID' ] ) ); |
|
26 | + $event_id = $wpdb->get_var($wpdb->prepare('SELECT EVT_ID FROM '.$wpdb->prefix.'esp_registration WHERE TXN_ID=%d LIMIT 1', $line_item_row['TXN_ID'])); |
|
27 | 27 | $new_line_item_data = array( |
28 | - 'LIN_code' => 'event-' . $event_id, |
|
29 | - 'TXN_ID' => $line_item_row[ 'TXN_ID' ], |
|
30 | - 'LIN_name' => __( 'Event', 'event_espresso' ), |
|
31 | - 'LIN_desc' => $line_item_row[ 'LIN_desc' ], |
|
32 | - 'LIN_unit_price' => $line_item_row[ 'LIN_unit_price' ], |
|
33 | - 'LIN_percent' => $line_item_row[ 'LIN_percent' ], |
|
34 | - 'LIN_is_taxable' => $line_item_row[ 'LIN_is_taxable' ], |
|
35 | - 'LIN_order' => $line_item_row[ 'LIN_order' ], |
|
36 | - 'LIN_total' => $line_item_row[ 'LIN_total' ], |
|
37 | - 'LIN_quantity' => $line_item_row[ 'LIN_quantity' ], |
|
38 | - 'LIN_parent' => $line_item_row[ 'LIN_ID'], |
|
28 | + 'LIN_code' => 'event-'.$event_id, |
|
29 | + 'TXN_ID' => $line_item_row['TXN_ID'], |
|
30 | + 'LIN_name' => __('Event', 'event_espresso'), |
|
31 | + 'LIN_desc' => $line_item_row['LIN_desc'], |
|
32 | + 'LIN_unit_price' => $line_item_row['LIN_unit_price'], |
|
33 | + 'LIN_percent' => $line_item_row['LIN_percent'], |
|
34 | + 'LIN_is_taxable' => $line_item_row['LIN_is_taxable'], |
|
35 | + 'LIN_order' => $line_item_row['LIN_order'], |
|
36 | + 'LIN_total' => $line_item_row['LIN_total'], |
|
37 | + 'LIN_quantity' => $line_item_row['LIN_quantity'], |
|
38 | + 'LIN_parent' => $line_item_row['LIN_ID'], |
|
39 | 39 | 'LIN_type' => 'sub-total', |
40 | 40 | 'OBJ_type' => 'Event', |
41 | 41 | 'OBJ_ID' => $event_id, |
42 | 42 | ); |
43 | 43 | $new_line_item_datatypes = array( |
44 | - '%s',//LIN_code |
|
45 | - '%d',//TXN_ID |
|
46 | - '%s',//LIN_name |
|
47 | - '%s',//LIN_desc |
|
48 | - '%f',//LIN_unit_price |
|
49 | - '%f',//LIN_percent |
|
50 | - '%d',//LIN_is_taxable |
|
51 | - '%d',//LIN_order |
|
52 | - '%f',//LIN_total |
|
53 | - '%d',//LIN_quantity |
|
54 | - '%d',//LIN_parent |
|
55 | - '%s',//LIN_type |
|
56 | - '%s',//OBJ_type |
|
57 | - '%d',//OBJ_ID |
|
44 | + '%s', //LIN_code |
|
45 | + '%d', //TXN_ID |
|
46 | + '%s', //LIN_name |
|
47 | + '%s', //LIN_desc |
|
48 | + '%f', //LIN_unit_price |
|
49 | + '%f', //LIN_percent |
|
50 | + '%d', //LIN_is_taxable |
|
51 | + '%d', //LIN_order |
|
52 | + '%f', //LIN_total |
|
53 | + '%d', //LIN_quantity |
|
54 | + '%d', //LIN_parent |
|
55 | + '%s', //LIN_type |
|
56 | + '%s', //OBJ_type |
|
57 | + '%d', //OBJ_ID |
|
58 | 58 | ); |
59 | 59 | //insert the new event subtotal line item, pointing to this line item |
60 | - $success = $wpdb->insert( $this->_old_table, $new_line_item_data, $new_line_item_datatypes ); |
|
61 | - if( ! $success ) { |
|
62 | - $this->add_error( $this->_create_error_message_for_db_insertion( $this->_old_table, $line_item_row, $this->_old_table, $new_line_item_data, $new_line_item_datatypes ) ); |
|
60 | + $success = $wpdb->insert($this->_old_table, $new_line_item_data, $new_line_item_datatypes); |
|
61 | + if ( ! $success) { |
|
62 | + $this->add_error($this->_create_error_message_for_db_insertion($this->_old_table, $line_item_row, $this->_old_table, $new_line_item_data, $new_line_item_datatypes)); |
|
63 | 63 | } |
64 | 64 | $new_line_item_id = $wpdb->insert_id; |
65 | - $this->get_migration_script()->set_mapping($this->_old_table, $line_item_row[ 'LIN_ID' ], $this->_old_table, $new_line_item_id ); |
|
65 | + $this->get_migration_script()->set_mapping($this->_old_table, $line_item_row['LIN_ID'], $this->_old_table, $new_line_item_id); |
|
66 | 66 | $query = $wpdb->prepare( |
67 | 67 | "UPDATE {$this->_old_table} SET LIN_parent=%d WHERE LIN_parent = %d AND LIN_ID != %d LIMIT 100", |
68 | 68 | $new_line_item_id, |
69 | - $line_item_row[ 'LIN_ID' ], |
|
69 | + $line_item_row['LIN_ID'], |
|
70 | 70 | $new_line_item_id ); |
71 | - $success = $wpdb->query( $query ); |
|
72 | - if( $success === false ) { |
|
71 | + $success = $wpdb->query($query); |
|
72 | + if ($success === false) { |
|
73 | 73 | $this->add_error( |
74 | - sprintf( __( 'Error updating rows to new event subtotal %1$s from %2$s. Error was: %3$s, while using query %4$s which had a result of %5$s', 'event_espresso' ), |
|
74 | + sprintf(__('Error updating rows to new event subtotal %1$s from %2$s. Error was: %3$s, while using query %4$s which had a result of %5$s', 'event_espresso'), |
|
75 | 75 | $new_line_item_id, |
76 | - $line_item_row[ 'LIN_ID' ], |
|
76 | + $line_item_row['LIN_ID'], |
|
77 | 77 | $wpdb->last_error, |
78 | 78 | $query, |
79 | 79 | $success) ); |
@@ -1,5 +1,5 @@ discard block |
||
1 | -<?php if ( !defined( 'EVENT_ESPRESSO_VERSION' ) ) { |
|
2 | - exit( 'No direct script access allowed' ); |
|
1 | +<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
2 | + exit('No direct script access allowed'); |
|
3 | 3 | } |
4 | 4 | /** |
5 | 5 | * EE_WP_User class |
@@ -22,9 +22,9 @@ discard block |
||
22 | 22 | * @param array $props_n_values |
23 | 23 | * @return EE_WP_User|mixed |
24 | 24 | */ |
25 | - public static function new_instance( $props_n_values = array() ) { |
|
26 | - $has_object = parent::_check_for_object( $props_n_values, __CLASS__ ); |
|
27 | - return $has_object ? $has_object : new self( $props_n_values ); |
|
25 | + public static function new_instance($props_n_values = array()) { |
|
26 | + $has_object = parent::_check_for_object($props_n_values, __CLASS__); |
|
27 | + return $has_object ? $has_object : new self($props_n_values); |
|
28 | 28 | } |
29 | 29 | |
30 | 30 | |
@@ -33,8 +33,8 @@ discard block |
||
33 | 33 | * @param array $props_n_values |
34 | 34 | * @return EE_WP_User |
35 | 35 | */ |
36 | - public static function new_instance_from_db( $props_n_values = array() ) { |
|
37 | - return new self( $props_n_values, TRUE ); |
|
36 | + public static function new_instance_from_db($props_n_values = array()) { |
|
37 | + return new self($props_n_values, TRUE); |
|
38 | 38 | } |
39 | 39 | |
40 | 40 | /** |
@@ -42,8 +42,8 @@ discard block |
||
42 | 42 | * @return WP_User |
43 | 43 | */ |
44 | 44 | public function wp_user_obj() { |
45 | - if( ! $this->_wp_user_obj ) { |
|
46 | - $this->_wp_user_obj = get_user_by('ID', $this->ID() ); |
|
45 | + if ( ! $this->_wp_user_obj) { |
|
46 | + $this->_wp_user_obj = get_user_by('ID', $this->ID()); |
|
47 | 47 | } |
48 | 48 | return $this->_wp_user_obj; |
49 | 49 | } |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | $_SERVER['REQUEST_URI'] |
70 | 70 | ) |
71 | 71 | ), |
72 | - get_edit_user_link( $this->ID() ) |
|
72 | + get_edit_user_link($this->ID()) |
|
73 | 73 | ) |
74 | 74 | ); |
75 | 75 | } |
@@ -87,7 +87,7 @@ discard block |
||
87 | 87 | * @return string |
88 | 88 | */ |
89 | 89 | public function get_admin_overview_link() { |
90 | - return admin_url( 'users.php' ); |
|
90 | + return admin_url('users.php'); |
|
91 | 91 | } |
92 | 92 | |
93 | 93 |
@@ -1,4 +1,6 @@ |
||
1 | -<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed'); |
|
1 | +<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
2 | + exit('No direct script access allowed'); |
|
3 | +} |
|
2 | 4 | /** |
3 | 5 | * Event Espresso |
4 | 6 | * |
@@ -105,42 +105,42 @@ discard block |
||
105 | 105 | * |
106 | 106 | * @return EEM_Message |
107 | 107 | */ |
108 | - protected function __construct( $timezone = null ) { |
|
109 | - $this->singular_item = __('Message','event_espresso'); |
|
110 | - $this->plural_item = __('Messages','event_espresso'); |
|
108 | + protected function __construct($timezone = null) { |
|
109 | + $this->singular_item = __('Message', 'event_espresso'); |
|
110 | + $this->plural_item = __('Messages', 'event_espresso'); |
|
111 | 111 | |
112 | 112 | //used for token generator |
113 | - EE_Registry::instance()->load_helper( 'URL' ); |
|
113 | + EE_Registry::instance()->load_helper('URL'); |
|
114 | 114 | |
115 | 115 | $this->_tables = array( |
116 | - 'Message'=>new EE_Primary_Table('esp_message','MSG_ID') |
|
116 | + 'Message'=>new EE_Primary_Table('esp_message', 'MSG_ID') |
|
117 | 117 | ); |
118 | 118 | |
119 | 119 | $allowed_priority = array( |
120 | - self::priority_high => __( 'high', 'event_espresso' ), |
|
121 | - self::priority_medium => __( 'medium', 'event_espresso' ), |
|
122 | - self::priority_low => __( 'low', 'event_espresso' ) |
|
120 | + self::priority_high => __('high', 'event_espresso'), |
|
121 | + self::priority_medium => __('medium', 'event_espresso'), |
|
122 | + self::priority_low => __('low', 'event_espresso') |
|
123 | 123 | ); |
124 | 124 | |
125 | 125 | $this->_fields = array( |
126 | 126 | 'Message'=>array( |
127 | - 'MSG_ID'=>new EE_Primary_Key_Int_Field('MSG_ID', __('Message ID','event_espresso')), |
|
128 | - 'MSG_token' => new EE_Plain_Text_Field( 'MSG_token', __('Unique Token used to represent this row in publicly viewable contexts (eg. a url).', 'event_espresso' ), false, EEH_URL::generate_unique_token() ), |
|
129 | - 'GRP_ID'=>new EE_Foreign_Key_Int_Field( 'GRP_ID', __('Foreign key to the EEM_Message_Template_Group table.', 'event_espresso' ), true, 0, 'Message_Template_Group' ), |
|
130 | - 'TXN_ID' => new EE_Foreign_Key_Int_Field( 'TXN_ID', __( 'Foreign key to the related EE_Transaction. This is required to give context for regenerating the specific message', 'event_espresso' ), true, 0, 'Transaction' ), |
|
131 | - 'MSG_messenger' => new EE_Plain_Text_Field('MSG_messenger', __( 'Corresponds to the EE_messenger::name used to send this message. This will also be used to attempt any resending of the message.', 'event_espresso' ), false, 'email' ), |
|
132 | - 'MSG_message_type' => new EE_Plain_Text_Field( 'MSG_message_type', __( 'Corresponds to the EE_message_type::name used to generate this message.', 'event_espresso' ), false, 'receipt' ), |
|
133 | - 'MSG_context' => new EE_Plain_Text_Field( 'MSG_context', __( 'Context', 'event_espresso' ), false ), |
|
134 | - 'MSG_recipient_ID' => new EE_Foreign_Key_Int_Field( 'MSG_recipient_ID', __( 'Recipient ID', 'event_espresso' ), true, null, array( 'Registration', 'Attendee', 'WP_User' ) ), |
|
135 | - 'MSG_recipient_type' => new EE_Any_Foreign_Model_Name_Field( 'MSG_recipient_type', __( 'Recipient Type', 'event_espresso' ), true, null, array( 'Registration', 'Attendee', 'WP_User' ) ), |
|
136 | - 'MSG_content' => new EE_Maybe_Serialized_Text_Field( 'MSG_content', __( 'Content', 'event_espresso' ), true, '' ), |
|
137 | - 'MSG_to' => new EE_Maybe_Serialized_Text_Field( 'MSG_to', __( 'Address To', 'event_espresso' ), true ), |
|
138 | - 'MSG_from' => new EE_Maybe_Serialized_Text_Field( 'MSG_from', __( 'Address From', 'event_espresso' ), true ), |
|
139 | - 'MSG_subject' => new EE_Maybe_Serialized_Text_Field( 'MSG_subject', __( 'Subject', 'event_espresso' ), true, '' ), |
|
140 | - 'MSG_priority' => new EE_Enum_Integer_Field( 'MSG_priority', __( 'Priority', 'event_espresso' ), false, self::priority_low, $allowed_priority ), |
|
141 | - 'STS_ID' => new EE_Foreign_Key_String_Field( 'STS_ID', __( 'Status', 'event_espresso' ), false, self::status_incomplete, 'Status' ), |
|
142 | - 'MSG_created' => new EE_Datetime_Field( 'MSG_created', __( 'Created', 'event_espresso' ), false, EE_Datetime_Field::now ), |
|
143 | - 'MSG_modified' => new EE_Datetime_Field( 'MSG_modified', __( 'Modified', 'event_espresso' ), true, EE_Datetime_Field::now ) |
|
127 | + 'MSG_ID'=>new EE_Primary_Key_Int_Field('MSG_ID', __('Message ID', 'event_espresso')), |
|
128 | + 'MSG_token' => new EE_Plain_Text_Field('MSG_token', __('Unique Token used to represent this row in publicly viewable contexts (eg. a url).', 'event_espresso'), false, EEH_URL::generate_unique_token()), |
|
129 | + 'GRP_ID'=>new EE_Foreign_Key_Int_Field('GRP_ID', __('Foreign key to the EEM_Message_Template_Group table.', 'event_espresso'), true, 0, 'Message_Template_Group'), |
|
130 | + 'TXN_ID' => new EE_Foreign_Key_Int_Field('TXN_ID', __('Foreign key to the related EE_Transaction. This is required to give context for regenerating the specific message', 'event_espresso'), true, 0, 'Transaction'), |
|
131 | + 'MSG_messenger' => new EE_Plain_Text_Field('MSG_messenger', __('Corresponds to the EE_messenger::name used to send this message. This will also be used to attempt any resending of the message.', 'event_espresso'), false, 'email'), |
|
132 | + 'MSG_message_type' => new EE_Plain_Text_Field('MSG_message_type', __('Corresponds to the EE_message_type::name used to generate this message.', 'event_espresso'), false, 'receipt'), |
|
133 | + 'MSG_context' => new EE_Plain_Text_Field('MSG_context', __('Context', 'event_espresso'), false), |
|
134 | + 'MSG_recipient_ID' => new EE_Foreign_Key_Int_Field('MSG_recipient_ID', __('Recipient ID', 'event_espresso'), true, null, array('Registration', 'Attendee', 'WP_User')), |
|
135 | + 'MSG_recipient_type' => new EE_Any_Foreign_Model_Name_Field('MSG_recipient_type', __('Recipient Type', 'event_espresso'), true, null, array('Registration', 'Attendee', 'WP_User')), |
|
136 | + 'MSG_content' => new EE_Maybe_Serialized_Text_Field('MSG_content', __('Content', 'event_espresso'), true, ''), |
|
137 | + 'MSG_to' => new EE_Maybe_Serialized_Text_Field('MSG_to', __('Address To', 'event_espresso'), true), |
|
138 | + 'MSG_from' => new EE_Maybe_Serialized_Text_Field('MSG_from', __('Address From', 'event_espresso'), true), |
|
139 | + 'MSG_subject' => new EE_Maybe_Serialized_Text_Field('MSG_subject', __('Subject', 'event_espresso'), true, ''), |
|
140 | + 'MSG_priority' => new EE_Enum_Integer_Field('MSG_priority', __('Priority', 'event_espresso'), false, self::priority_low, $allowed_priority), |
|
141 | + 'STS_ID' => new EE_Foreign_Key_String_Field('STS_ID', __('Status', 'event_espresso'), false, self::status_incomplete, 'Status'), |
|
142 | + 'MSG_created' => new EE_Datetime_Field('MSG_created', __('Created', 'event_espresso'), false, EE_Datetime_Field::now), |
|
143 | + 'MSG_modified' => new EE_Datetime_Field('MSG_modified', __('Modified', 'event_espresso'), true, EE_Datetime_Field::now) |
|
144 | 144 | ) |
145 | 145 | ); |
146 | 146 | $this->_model_relations = array( |
@@ -150,7 +150,7 @@ discard block |
||
150 | 150 | 'Message_Template_Group' => new EE_Belongs_To_Relation(), |
151 | 151 | 'Transaction' => new EE_Belongs_To_Relation() |
152 | 152 | ); |
153 | - parent::__construct( $timezone ); |
|
153 | + parent::__construct($timezone); |
|
154 | 154 | } |
155 | 155 | |
156 | 156 | |
@@ -161,8 +161,8 @@ discard block |
||
161 | 161 | public function create_default_object() { |
162 | 162 | /** @type EE_Message $message */ |
163 | 163 | $message = parent::create_default_object(); |
164 | - if ( $message instanceof EE_Message ) { |
|
165 | - return EE_Message_Factory::set_messenger_and_message_type( $message ); |
|
164 | + if ($message instanceof EE_Message) { |
|
165 | + return EE_Message_Factory::set_messenger_and_message_type($message); |
|
166 | 166 | } |
167 | 167 | return null; |
168 | 168 | } |
@@ -173,11 +173,11 @@ discard block |
||
173 | 173 | * @param mixed $cols_n_values |
174 | 174 | * @return \EE_Message |
175 | 175 | */ |
176 | - public function instantiate_class_from_array_or_object( $cols_n_values ) { |
|
176 | + public function instantiate_class_from_array_or_object($cols_n_values) { |
|
177 | 177 | /** @type EE_Message $message */ |
178 | - $message = parent::instantiate_class_from_array_or_object( $cols_n_values ); |
|
179 | - if ( $message instanceof EE_Message ) { |
|
180 | - return EE_Message_Factory::set_messenger_and_message_type( $message ); |
|
178 | + $message = parent::instantiate_class_from_array_or_object($cols_n_values); |
|
179 | + if ($message instanceof EE_Message) { |
|
180 | + return EE_Message_Factory::set_messenger_and_message_type($message); |
|
181 | 181 | } |
182 | 182 | return null; |
183 | 183 | } |
@@ -190,13 +190,13 @@ discard block |
||
190 | 190 | * @param string $message_type the message type slug |
191 | 191 | * @return boolean |
192 | 192 | */ |
193 | - public function message_sent_for_attendee( $attendee, $message_type ) { |
|
194 | - $attendee_ID = EEM_Attendee::instance()->ensure_is_ID( $attendee ); |
|
195 | - return $this->exists( array( array( |
|
193 | + public function message_sent_for_attendee($attendee, $message_type) { |
|
194 | + $attendee_ID = EEM_Attendee::instance()->ensure_is_ID($attendee); |
|
195 | + return $this->exists(array(array( |
|
196 | 196 | 'Attendee.ATT_ID' => $attendee_ID, |
197 | 197 | 'MSG_message_type' => $message_type, |
198 | - 'STS_ID' => array( 'IN', $this->stati_indicating_sent() ) |
|
199 | - ) ) ); |
|
198 | + 'STS_ID' => array('IN', $this->stati_indicating_sent()) |
|
199 | + ))); |
|
200 | 200 | } |
201 | 201 | |
202 | 202 | |
@@ -208,13 +208,13 @@ discard block |
||
208 | 208 | * @param string $message_type the message type slug |
209 | 209 | * @return boolean |
210 | 210 | */ |
211 | - public function message_sent_for_registration( $registration, $message_type ) { |
|
212 | - $registrationID = EEM_Registration::instance()->ensure_is_ID( $registration ); |
|
213 | - return $this->exists( array( array( |
|
211 | + public function message_sent_for_registration($registration, $message_type) { |
|
212 | + $registrationID = EEM_Registration::instance()->ensure_is_ID($registration); |
|
213 | + return $this->exists(array(array( |
|
214 | 214 | 'Registration.REG_ID' => $registrationID, |
215 | 215 | 'MSG_message_type' => $message_type, |
216 | - 'STS_ID' => array( 'IN', $this->stati_indicating_sent() ) |
|
217 | - ) ) ); |
|
216 | + 'STS_ID' => array('IN', $this->stati_indicating_sent()) |
|
217 | + ))); |
|
218 | 218 | } |
219 | 219 | |
220 | 220 | |
@@ -225,10 +225,10 @@ discard block |
||
225 | 225 | * @param string $token |
226 | 226 | * @return EE_Message |
227 | 227 | */ |
228 | - public function get_one_by_token( $token ) { |
|
229 | - return $this->get_one( array( array( |
|
228 | + public function get_one_by_token($token) { |
|
229 | + return $this->get_one(array(array( |
|
230 | 230 | 'MSG_token' => $token |
231 | - ) ) ); |
|
231 | + ))); |
|
232 | 232 | } |
233 | 233 | |
234 | 234 | |
@@ -236,8 +236,8 @@ discard block |
||
236 | 236 | * Returns stati that indicate the message HAS been sent |
237 | 237 | * @return array of strings for possible stati |
238 | 238 | */ |
239 | - public function stati_indicating_sent(){ |
|
240 | - return apply_filters( 'FHEE__EEM_Message__stati_indicating_sent', array( self::status_sent ) ); |
|
239 | + public function stati_indicating_sent() { |
|
240 | + return apply_filters('FHEE__EEM_Message__stati_indicating_sent', array(self::status_sent)); |
|
241 | 241 | } |
242 | 242 | |
243 | 243 | |
@@ -248,7 +248,7 @@ discard block |
||
248 | 248 | * @return array of strings for possible stati. |
249 | 249 | */ |
250 | 250 | public function stati_indicating_to_send() { |
251 | - return apply_filters( 'FHEE__EEM_Message__stati_indicating_to_send', array( self::status_idle, self::status_resend ) ); |
|
251 | + return apply_filters('FHEE__EEM_Message__stati_indicating_to_send', array(self::status_idle, self::status_resend)); |
|
252 | 252 | } |
253 | 253 | |
254 | 254 | |
@@ -262,10 +262,10 @@ discard block |
||
262 | 262 | self::status_retry, |
263 | 263 | ); |
264 | 264 | //if WP_DEBUG is set, then let's include debug_only fails |
265 | - if ( WP_DEBUG ) { |
|
265 | + if (WP_DEBUG) { |
|
266 | 266 | $failed_stati[] = self::status_debug_only; |
267 | 267 | } |
268 | - return apply_filters( 'FHEE__EEM_Message__stati_indicating_failed_sending', $failed_stati ); |
|
268 | + return apply_filters('FHEE__EEM_Message__stati_indicating_failed_sending', $failed_stati); |
|
269 | 269 | } |
270 | 270 | |
271 | 271 | |
@@ -300,11 +300,11 @@ discard block |
||
300 | 300 | // the value, matches the corresponding EEM_Base child reference. |
301 | 301 | $expected_vars = $this->_expected_vars_for_query_inject(); |
302 | 302 | $query_params[0] = array(); |
303 | - foreach ( $expected_vars as $request_key => $model_name ) { |
|
304 | - $request_value = EE_Registry::instance()->REQ->get( $request_key ); |
|
305 | - if ( $request_value ) { |
|
303 | + foreach ($expected_vars as $request_key => $model_name) { |
|
304 | + $request_value = EE_Registry::instance()->REQ->get($request_key); |
|
305 | + if ($request_value) { |
|
306 | 306 | //special case |
307 | - switch ( $request_key ) { |
|
307 | + switch ($request_key) { |
|
308 | 308 | case '_REG_ID' : |
309 | 309 | $query_params[0]['AND**filter_by']['OR**filter_by_REG_ID'] = array( |
310 | 310 | 'Transaction.Registration.REG_ID' => $request_value, |
@@ -316,7 +316,7 @@ discard block |
||
316 | 316 | ); |
317 | 317 | break; |
318 | 318 | default : |
319 | - $query_params[0]['AND**filter_by'][ 'OR**filter_by_' . $request_key ][ $model_name . '.' . $request_key ] = $request_value; |
|
319 | + $query_params[0]['AND**filter_by']['OR**filter_by_'.$request_key][$model_name.'.'.$request_key] = $request_value; |
|
320 | 320 | break; |
321 | 321 | } |
322 | 322 | } |
@@ -333,53 +333,53 @@ discard block |
||
333 | 333 | $expected_vars = $this->_expected_vars_for_query_inject(); |
334 | 334 | $pretty_label = ''; |
335 | 335 | $label_parts = array(); |
336 | - foreach ( $expected_vars as $request_key => $model_name ) { |
|
337 | - $model = EE_Registry::instance()->load_model( $model_name ); |
|
338 | - if ( $model_field_value = EE_Registry::instance()->REQ->get( $request_key ) ) { |
|
339 | - switch ( $request_key ) { |
|
336 | + foreach ($expected_vars as $request_key => $model_name) { |
|
337 | + $model = EE_Registry::instance()->load_model($model_name); |
|
338 | + if ($model_field_value = EE_Registry::instance()->REQ->get($request_key)) { |
|
339 | + switch ($request_key) { |
|
340 | 340 | case '_REG_ID' : |
341 | 341 | $label_parts[] = sprintf( |
342 | - esc_html__( 'Registration with the ID: %s', 'event_espresso' ), |
|
342 | + esc_html__('Registration with the ID: %s', 'event_espresso'), |
|
343 | 343 | $model_field_value |
344 | 344 | ); |
345 | 345 | break; |
346 | 346 | case 'ATT_ID' : |
347 | 347 | /** @var EE_Attendee $attendee */ |
348 | - $attendee = $model->get_one_by_ID( $model_field_value ); |
|
348 | + $attendee = $model->get_one_by_ID($model_field_value); |
|
349 | 349 | $label_parts[] = $attendee instanceof EE_Attendee |
350 | - ? sprintf( esc_html__( 'Attendee %s', 'event_espresso' ), $attendee->full_name() ) |
|
351 | - : sprintf( esc_html__( 'Attendee ID: %s', 'event_espresso' ), $model_field_value ); |
|
350 | + ? sprintf(esc_html__('Attendee %s', 'event_espresso'), $attendee->full_name()) |
|
351 | + : sprintf(esc_html__('Attendee ID: %s', 'event_espresso'), $model_field_value); |
|
352 | 352 | break; |
353 | 353 | case 'ID' : |
354 | 354 | /** @var EE_WP_User $wpUser */ |
355 | - $wpUser = $model->get_one_by_ID( $model_field_value ); |
|
355 | + $wpUser = $model->get_one_by_ID($model_field_value); |
|
356 | 356 | $label_parts[] = $wpUser instanceof EE_WP_User |
357 | - ? sprintf( esc_html__( 'WP User: %s', 'event_espresso' ), $wpUser->name() ) |
|
358 | - : sprintf( esc_html__( 'WP User ID: %s', 'event_espresso' ), $model_field_value ); |
|
357 | + ? sprintf(esc_html__('WP User: %s', 'event_espresso'), $wpUser->name()) |
|
358 | + : sprintf(esc_html__('WP User ID: %s', 'event_espresso'), $model_field_value); |
|
359 | 359 | break; |
360 | 360 | case 'TXN_ID' : |
361 | 361 | $label_parts[] = sprintf( |
362 | - esc_html__( 'Transaction with the ID: %s', 'event_espresso' ), |
|
362 | + esc_html__('Transaction with the ID: %s', 'event_espresso'), |
|
363 | 363 | $model_field_value |
364 | 364 | ); |
365 | 365 | break; |
366 | 366 | case 'EVT_ID' : |
367 | 367 | /** @var EE_Event $Event */ |
368 | - $Event = $model->get_one_by_ID( $model_field_value ); |
|
368 | + $Event = $model->get_one_by_ID($model_field_value); |
|
369 | 369 | $label_parts[] = $Event instanceof EE_Event |
370 | - ? sprintf( esc_html__( 'for the Event: %s', 'event_espresso' ), $Event->name() ) |
|
371 | - : sprintf( esc_html__( 'for the Event with ID: %s', 'event_espresso' ), $model_field_value ); |
|
370 | + ? sprintf(esc_html__('for the Event: %s', 'event_espresso'), $Event->name()) |
|
371 | + : sprintf(esc_html__('for the Event with ID: %s', 'event_espresso'), $model_field_value); |
|
372 | 372 | break; |
373 | 373 | } |
374 | 374 | } |
375 | 375 | } |
376 | 376 | |
377 | - if ( $label_parts ) { |
|
377 | + if ($label_parts) { |
|
378 | 378 | |
379 | 379 | //prepend to the last element of $label_parts an "and". |
380 | - if ( count( $label_parts ) > 1 ) { |
|
381 | - $label_parts_index_to_prepend = count( $label_parts ) - 1; |
|
382 | - $label_parts[ $label_parts_index_to_prepend ] = 'and' . $label_parts[ $label_parts_index_to_prepend ]; |
|
380 | + if (count($label_parts) > 1) { |
|
381 | + $label_parts_index_to_prepend = count($label_parts) - 1; |
|
382 | + $label_parts[$label_parts_index_to_prepend] = 'and'.$label_parts[$label_parts_index_to_prepend]; |
|
383 | 383 | } |
384 | 384 | |
385 | 385 | $pretty_label .= sprintf( |
@@ -388,7 +388,7 @@ discard block |
||
388 | 388 | 'A label for the messages returned in a query that are filtered by items in the query. This could be Transaction, Event, Attendee, Registration, or WP_User.', |
389 | 389 | 'event_espresso' |
390 | 390 | ), |
391 | - implode( ', ', $label_parts ) |
|
391 | + implode(', ', $label_parts) |
|
392 | 392 | ); |
393 | 393 | } |
394 | 394 | return $pretty_label; |
@@ -438,20 +438,20 @@ discard block |
||
438 | 438 | * |
439 | 439 | * @return bool true means Messages is in debug mode. false means messages system is not in debug mode. |
440 | 440 | */ |
441 | - public static function debug( $set_debug = null ) { |
|
441 | + public static function debug($set_debug = null) { |
|
442 | 442 | static $is_debugging = null; |
443 | 443 | |
444 | 444 | //initialize (use constant if set). |
445 | - if ( is_null( $set_debug ) && is_null( $is_debugging ) ) { |
|
446 | - $is_debugging = defined( 'EE_DEBUG_MESSAGES' ) && EE_DEBUG_MESSAGES; |
|
445 | + if (is_null($set_debug) && is_null($is_debugging)) { |
|
446 | + $is_debugging = defined('EE_DEBUG_MESSAGES') && EE_DEBUG_MESSAGES; |
|
447 | 447 | } |
448 | 448 | |
449 | - if ( ! is_null( $set_debug ) ) { |
|
450 | - $is_debugging = filter_var( $set_debug, FILTER_VALIDATE_BOOLEAN ); |
|
449 | + if ( ! is_null($set_debug)) { |
|
450 | + $is_debugging = filter_var($set_debug, FILTER_VALIDATE_BOOLEAN); |
|
451 | 451 | } |
452 | 452 | |
453 | 453 | //return filtered value |
454 | - return apply_filters( 'FHEE__EEM_Message__debug', $is_debugging ); |
|
454 | + return apply_filters('FHEE__EEM_Message__debug', $is_debugging); |
|
455 | 455 | } |
456 | 456 | |
457 | 457 |