@@ -1,6 +1,7 @@ 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 | 6 | /** |
6 | 7 | * Event Espresso |
@@ -144,17 +145,19 @@ discard block |
||
144 | 145 | $msgr_filters = !empty($m_values) ? array_merge( $msgr_default, $m_values ) : array(); |
145 | 146 | $mt_filters = !empty($mt_values) ? array_merge( $mt_default, $mt_values ) : array(); |
146 | 147 | |
147 | - if ( empty( $m_values ) ) |
|
148 | - $msgr_filters[0] = array( |
|
148 | + if ( empty( $m_values ) ) { |
|
149 | + $msgr_filters[0] = array( |
|
149 | 150 | 'id' => 'no_messenger_options', |
150 | 151 | 'text' => __('No Messengers active', 'event_espresso') |
151 | 152 | ); |
153 | + } |
|
152 | 154 | |
153 | - if ( empty($mt_values) ) |
|
154 | - $mt_filters[0] = array( |
|
155 | + if ( empty($mt_values) ) { |
|
156 | + $mt_filters[0] = array( |
|
155 | 157 | 'id' => 'no_message_type_options', |
156 | 158 | 'text' => __('No Message Types active', 'event_espresso') |
157 | 159 | ); |
160 | + } |
|
158 | 161 | |
159 | 162 | if ( count( $messengers ) >= 1 && !empty( $m_values ) ) { |
160 | 163 | unset( $msgr_filters[0] ); |
@@ -191,10 +194,11 @@ discard block |
||
191 | 194 | * @return string |
192 | 195 | */ |
193 | 196 | public function no_items() { |
194 | - if ( $this->_view !== 'trashed' ) |
|
195 | - printf( __('%sNo Custom Templates found.%s To create your first custom message template, go to the "Default Message Templates" tab and click the "Create Custom" button next to the template you want to use as a base for the new one.', 'event_espresso'), '<strong>', '</strong>' ); |
|
196 | - else |
|
197 | - parent::no_items(); |
|
197 | + if ( $this->_view !== 'trashed' ) { |
|
198 | + printf( __('%sNo Custom Templates found.%s To create your first custom message template, go to the "Default Message Templates" tab and click the "Create Custom" button next to the template you want to use as a base for the new one.', 'event_espresso'), '<strong>', '</strong>' ); |
|
199 | + } else { |
|
200 | + parent::no_items(); |
|
201 | + } |
|
198 | 202 | } |
199 | 203 | |
200 | 204 |
@@ -93,7 +93,7 @@ |
||
93 | 93 | * |
94 | 94 | * @abstract |
95 | 95 | * @access protected |
96 | - * @return array |
|
96 | + * @return string[] |
|
97 | 97 | */ |
98 | 98 | protected function _get_table_filters() { |
99 | 99 | $filters = array(); |
@@ -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 | /** |
@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | class Custom_Messages_Template_List_Table extends EE_Admin_List_Table { |
31 | 31 | |
32 | 32 | |
33 | - public function __construct( $admin_page ) { |
|
33 | + public function __construct($admin_page) { |
|
34 | 34 | //Set parent defaults |
35 | 35 | parent::__construct($admin_page); |
36 | 36 | } |
@@ -49,8 +49,8 @@ discard block |
||
49 | 49 | |
50 | 50 | |
51 | 51 | protected function _setup_data() { |
52 | - $this->_data = $this->get_admin_page()->get_message_templates( $this->_per_page, $this->_view, FALSE, FALSE, FALSE ); |
|
53 | - $this->_all_data_count = $this->get_admin_page()->get_message_templates( $this->_per_page, $this->_view, TRUE, TRUE, FALSE ); |
|
52 | + $this->_data = $this->get_admin_page()->get_message_templates($this->_per_page, $this->_view, FALSE, FALSE, FALSE); |
|
53 | + $this->_all_data_count = $this->get_admin_page()->get_message_templates($this->_per_page, $this->_view, TRUE, TRUE, FALSE); |
|
54 | 54 | } |
55 | 55 | |
56 | 56 | |
@@ -59,8 +59,8 @@ discard block |
||
59 | 59 | |
60 | 60 | protected function _set_properties() { |
61 | 61 | $this->_wp_list_args = array( |
62 | - 'singular' => __('Message Template Group', 'event_espresso' ), |
|
63 | - 'plural' => __('Message Template', 'event_espresso' ), |
|
62 | + 'singular' => __('Message Template Group', 'event_espresso'), |
|
63 | + 'plural' => __('Message Template', 'event_espresso'), |
|
64 | 64 | 'ajax' => TRUE, //for now, |
65 | 65 | 'screen' => $this->get_admin_page()->get_current_screen()->id |
66 | 66 | ); |
@@ -69,15 +69,15 @@ discard block |
||
69 | 69 | 'cb' => '<input type="checkbox" />', |
70 | 70 | 'name' => __('Template Name', 'event_espresso'), |
71 | 71 | 'message_type' => __('Message Type', 'event_espresso'), |
72 | - 'messenger' => __( 'Messenger', 'event_espresso'), |
|
73 | - 'description' => __( 'Description', 'event_espresso' ), |
|
74 | - 'events' => __( 'Events', 'event_espresso'), //count of events using this template. |
|
72 | + 'messenger' => __('Messenger', 'event_espresso'), |
|
73 | + 'description' => __('Description', 'event_espresso'), |
|
74 | + 'events' => __('Events', 'event_espresso'), //count of events using this template. |
|
75 | 75 | 'actions' => '' |
76 | 76 | //'messages_sent' => __( 'Total Sent', 'event_espresso' ) //todo this will come later when we've got message tracking in place. |
77 | 77 | ); |
78 | 78 | |
79 | 79 | $this->_sortable_columns = array( |
80 | - 'messenger' => array( 'MTP_messenger' => TRUE ), |
|
80 | + 'messenger' => array('MTP_messenger' => TRUE), |
|
81 | 81 | //'message_type' => array( 'MTP_message_type' => FALSE ) |
82 | 82 | ); |
83 | 83 | |
@@ -96,16 +96,16 @@ discard block |
||
96 | 96 | * |
97 | 97 | * @return string |
98 | 98 | */ |
99 | - public function single_row( $item ) { |
|
99 | + public function single_row($item) { |
|
100 | 100 | $message_type = $item->message_type_obj(); |
101 | 101 | $messenger = $item->messenger_obj(); |
102 | 102 | |
103 | - if ( ! $message_type instanceof EE_message_type || ! $messenger instanceof EE_messenger ) { |
|
103 | + if ( ! $message_type instanceof EE_message_type || ! $messenger instanceof EE_messenger) { |
|
104 | 104 | echo ''; |
105 | 105 | return; |
106 | 106 | } |
107 | 107 | |
108 | - parent::single_row( $item ); |
|
108 | + parent::single_row($item); |
|
109 | 109 | } |
110 | 110 | |
111 | 111 | |
@@ -121,7 +121,7 @@ discard block |
||
121 | 121 | $mt_values = $this->get_admin_page()->get_message_types_for_list_table(); |
122 | 122 | //setup messengers for selects |
123 | 123 | $m_values[0]['id'] = 'all'; |
124 | - $m_values[0]['text'] = __('All Messengers', 'event_espresso' ); |
|
124 | + $m_values[0]['text'] = __('All Messengers', 'event_espresso'); |
|
125 | 125 | |
126 | 126 | $msgr_default[0] = array( |
127 | 127 | 'id' => 'none_selected', |
@@ -133,28 +133,28 @@ discard block |
||
133 | 133 | 'text' => __('Show All', 'event_espresso') |
134 | 134 | ); |
135 | 135 | |
136 | - $msgr_filters = !empty($m_values) ? array_merge( $msgr_default, $m_values ) : array(); |
|
137 | - $mt_filters = !empty($mt_values) ? array_merge( $mt_default, $mt_values ) : array(); |
|
136 | + $msgr_filters = ! empty($m_values) ? array_merge($msgr_default, $m_values) : array(); |
|
137 | + $mt_filters = ! empty($mt_values) ? array_merge($mt_default, $mt_values) : array(); |
|
138 | 138 | |
139 | - if ( empty( $m_values ) ) |
|
139 | + if (empty($m_values)) |
|
140 | 140 | $msgr_filters[0] = array( |
141 | 141 | 'id' => 'no_messenger_options', |
142 | 142 | 'text' => __('No Messengers active', 'event_espresso') |
143 | 143 | ); |
144 | 144 | |
145 | - if ( empty($mt_values) ) |
|
145 | + if (empty($mt_values)) |
|
146 | 146 | $mt_filters[0] = array( |
147 | 147 | 'id' => 'no_message_type_options', |
148 | 148 | 'text' => __('No Message Types active', 'event_espresso') |
149 | 149 | ); |
150 | 150 | |
151 | - if ( count( $m_values ) >= 1 && !empty( $m_values ) ) { |
|
152 | - unset( $msgr_filters[0] ); |
|
153 | - $msgr_filters = array_values( $msgr_filters ); //reindex keys |
|
151 | + if (count($m_values) >= 1 && ! empty($m_values)) { |
|
152 | + unset($msgr_filters[0]); |
|
153 | + $msgr_filters = array_values($msgr_filters); //reindex keys |
|
154 | 154 | } |
155 | 155 | |
156 | - $filters[] = EEH_Form_Fields::select_input('ee_messenger_filter_by', $msgr_filters, isset($this->_req_data['ee_messenger_filter_by']) ? sanitize_key( $this->_req_data['ee_messenger_filter_by']) : '' ); |
|
157 | - $filters[] = EEH_Form_Fields::select_input('ee_message_type_filter_by', $mt_filters, isset($this->_req_data['ee_message_type_filter_by']) ? sanitize_key( $this->_req_data['ee_message_type_filter_by']) : ''); |
|
156 | + $filters[] = EEH_Form_Fields::select_input('ee_messenger_filter_by', $msgr_filters, isset($this->_req_data['ee_messenger_filter_by']) ? sanitize_key($this->_req_data['ee_messenger_filter_by']) : ''); |
|
157 | + $filters[] = EEH_Form_Fields::select_input('ee_message_type_filter_by', $mt_filters, isset($this->_req_data['ee_message_type_filter_by']) ? sanitize_key($this->_req_data['ee_message_type_filter_by']) : ''); |
|
158 | 158 | return $filters; |
159 | 159 | } |
160 | 160 | |
@@ -162,14 +162,14 @@ discard block |
||
162 | 162 | * we're just removing the search box for message templates, not needed. |
163 | 163 | * @return string (empty); |
164 | 164 | */ |
165 | - function search_box( $text, $input_id ) { |
|
165 | + function search_box($text, $input_id) { |
|
166 | 166 | return ''; |
167 | 167 | } |
168 | 168 | |
169 | 169 | |
170 | 170 | protected function _add_view_counts() { |
171 | - foreach ( $this->_views as $view => $args ) { |
|
172 | - $this->_views[$view]['count'] = $this->get_admin_page()->get_message_templates( $this->_per_page, $view, TRUE, TRUE, FALSE ); |
|
171 | + foreach ($this->_views as $view => $args) { |
|
172 | + $this->_views[$view]['count'] = $this->get_admin_page()->get_message_templates($this->_per_page, $view, TRUE, TRUE, FALSE); |
|
173 | 173 | } |
174 | 174 | } |
175 | 175 | |
@@ -183,16 +183,16 @@ discard block |
||
183 | 183 | * @return string |
184 | 184 | */ |
185 | 185 | public function no_items() { |
186 | - if ( $this->_view !== 'trashed' ) |
|
187 | - printf( __('%sNo Custom Templates found.%s To create your first custom message template, go to the "Default Message Templates" tab and click the "Create Custom" button next to the template you want to use as a base for the new one.', 'event_espresso'), '<strong>', '</strong>' ); |
|
186 | + if ($this->_view !== 'trashed') |
|
187 | + printf(__('%sNo Custom Templates found.%s To create your first custom message template, go to the "Default Message Templates" tab and click the "Create Custom" button next to the template you want to use as a base for the new one.', 'event_espresso'), '<strong>', '</strong>'); |
|
188 | 188 | else |
189 | 189 | parent::no_items(); |
190 | 190 | } |
191 | 191 | |
192 | 192 | |
193 | 193 | |
194 | - public function column_cb( $item ) { |
|
195 | - return sprintf( '<input type="checkbox" name="checkbox[%s] value="1" />', $item->GRP_ID() ); |
|
194 | + public function column_cb($item) { |
|
195 | + return sprintf('<input type="checkbox" name="checkbox[%s] value="1" />', $item->GRP_ID()); |
|
196 | 196 | } |
197 | 197 | |
198 | 198 | |
@@ -200,29 +200,29 @@ discard block |
||
200 | 200 | |
201 | 201 | |
202 | 202 | |
203 | - function column_name( $item ) { |
|
204 | - return '<p>' . $item->name() . '</p>'; |
|
203 | + function column_name($item) { |
|
204 | + return '<p>'.$item->name().'</p>'; |
|
205 | 205 | } |
206 | 206 | |
207 | 207 | |
208 | 208 | |
209 | 209 | |
210 | - function column_description( $item ) { |
|
211 | - return '<p>' . $item->description() . '</p>'; |
|
210 | + function column_description($item) { |
|
211 | + return '<p>'.$item->description().'</p>'; |
|
212 | 212 | } |
213 | 213 | |
214 | 214 | |
215 | 215 | |
216 | - function column_actions( $item ) { |
|
217 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_edit_messages', 'espresso_messages_add_new_message_template' ) ) { |
|
216 | + function column_actions($item) { |
|
217 | + if (EE_Registry::instance()->CAP->current_user_can('ee_edit_messages', 'espresso_messages_add_new_message_template')) { |
|
218 | 218 | $create_args = array( |
219 | 219 | 'GRP_ID' => $item->ID(), |
220 | 220 | 'messenger' => $item->messenger(), |
221 | 221 | 'message_type' => $item->message_type(), |
222 | 222 | 'action' => 'add_new_message_template' |
223 | 223 | ); |
224 | - $create_link = EE_Admin_Page::add_query_args_and_nonce( $create_args, EE_MSG_ADMIN_URL ); |
|
225 | - return sprintf( '<p><a href="%s" class="button button-small">%s</a></p>', $create_link, __('Create Custom', 'event_espresso') ); |
|
224 | + $create_link = EE_Admin_Page::add_query_args_and_nonce($create_args, EE_MSG_ADMIN_URL); |
|
225 | + return sprintf('<p><a href="%s" class="button button-small">%s</a></p>', $create_link, __('Create Custom', 'event_espresso')); |
|
226 | 226 | } |
227 | 227 | return ''; |
228 | 228 | } |
@@ -239,27 +239,27 @@ discard block |
||
239 | 239 | $actions = array(); |
240 | 240 | |
241 | 241 | // edit link but only if item isn't trashed. |
242 | - if ( !$item->get('MTP_deleted') && EE_Registry::instance()->CAP->current_user_can( 'ee_edit_message', 'espresso_messages_edit_message_template', $item->ID() ) ) { |
|
243 | - $edit_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'edit_message_template', 'id'=>$item->GRP_ID() ), EE_MSG_ADMIN_URL ); |
|
244 | - $actions['edit'] = '<a href="'.$edit_lnk_url.'" title="' . esc_attr__( 'Edit Template', 'event_espresso' ) . '">' . __( 'Edit', 'event_espresso' ) . '</a>'; |
|
242 | + if ( ! $item->get('MTP_deleted') && EE_Registry::instance()->CAP->current_user_can('ee_edit_message', 'espresso_messages_edit_message_template', $item->ID())) { |
|
243 | + $edit_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'edit_message_template', 'id'=>$item->GRP_ID()), EE_MSG_ADMIN_URL); |
|
244 | + $actions['edit'] = '<a href="'.$edit_lnk_url.'" title="'.esc_attr__('Edit Template', 'event_espresso').'">'.__('Edit', 'event_espresso').'</a>'; |
|
245 | 245 | } |
246 | 246 | |
247 | - $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', 'event_espresso' ) . '">' . ucwords( $item->messenger_obj()->label['singular'] ) . '</a>' : ucwords( $item->messenger_obj()->label['singular'] ); |
|
248 | - $trash_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'trash_message_template', 'id'=>$item->GRP_ID(), 'noheader' => TRUE ), EE_MSG_ADMIN_URL ); |
|
247 | + $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', 'event_espresso').'">'.ucwords($item->messenger_obj()->label['singular']).'</a>' : ucwords($item->messenger_obj()->label['singular']); |
|
248 | + $trash_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'trash_message_template', 'id'=>$item->GRP_ID(), 'noheader' => TRUE), EE_MSG_ADMIN_URL); |
|
249 | 249 | // restore link |
250 | - $restore_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'restore_message_template', 'id'=>$item->GRP_ID(), 'noheader' => TRUE ), EE_MSG_ADMIN_URL ); |
|
250 | + $restore_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'restore_message_template', 'id'=>$item->GRP_ID(), 'noheader' => TRUE), EE_MSG_ADMIN_URL); |
|
251 | 251 | // delete price link |
252 | - $delete_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'delete_message_template', 'id'=>$item->GRP_ID(), 'noheader' => TRUE ), EE_MSG_ADMIN_URL ); |
|
252 | + $delete_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'delete_message_template', 'id'=>$item->GRP_ID(), 'noheader' => TRUE), EE_MSG_ADMIN_URL); |
|
253 | 253 | |
254 | - if ( !$item->get('MTP_deleted') && EE_Registry::instance()->CAP->current_user_can( 'ee_delete_message', 'espresso_messages_trash_message_template', $item->ID() ) ) { |
|
255 | - $actions['trash'] = '<a href="'.$trash_lnk_url.'" title="' . esc_attr__( 'Move Template Group to Trash', 'event_espresso' ) . '">' . __( 'Move to Trash', 'event_espresso' ) . '</a>'; |
|
254 | + if ( ! $item->get('MTP_deleted') && EE_Registry::instance()->CAP->current_user_can('ee_delete_message', 'espresso_messages_trash_message_template', $item->ID())) { |
|
255 | + $actions['trash'] = '<a href="'.$trash_lnk_url.'" title="'.esc_attr__('Move Template Group to Trash', 'event_espresso').'">'.__('Move to Trash', 'event_espresso').'</a>'; |
|
256 | 256 | } else { |
257 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_delete_message', 'espresso_messages_restore_message_template', $item->ID() ) ) { |
|
258 | - $actions['restore'] = '<a href="'.$restore_lnk_url.'" title="' . esc_attr__( 'Restore Message Template', 'event_espresso' ) . '">' . __( 'Restore', 'event_espresso' ) . '</a>'; |
|
257 | + if (EE_Registry::instance()->CAP->current_user_can('ee_delete_message', 'espresso_messages_restore_message_template', $item->ID())) { |
|
258 | + $actions['restore'] = '<a href="'.$restore_lnk_url.'" title="'.esc_attr__('Restore Message Template', 'event_espresso').'">'.__('Restore', 'event_espresso').'</a>'; |
|
259 | 259 | } |
260 | 260 | |
261 | - if ( $this->_view == 'trashed' && EE_Registry::instance()->CAP->current_user_can( 'ee_delete_message', 'espresso_messages_delete_message_template', $item->ID() ) ) { |
|
262 | - $actions['delete'] = '<a href="'.$delete_lnk_url.'" title="' . esc_attr__( 'Delete Template Group Permanently', 'event_espresso' ) . '">' . __( 'Delete Permanently', 'event_espresso' ) . '</a>'; |
|
261 | + if ($this->_view == 'trashed' && EE_Registry::instance()->CAP->current_user_can('ee_delete_message', 'espresso_messages_delete_message_template', $item->ID())) { |
|
262 | + $actions['delete'] = '<a href="'.$delete_lnk_url.'" title="'.esc_attr__('Delete Template Group Permanently', 'event_espresso').'">'.__('Delete Permanently', 'event_espresso').'</a>'; |
|
263 | 263 | } |
264 | 264 | } |
265 | 265 | |
@@ -268,15 +268,15 @@ discard block |
||
268 | 268 | $c_configs = $item->contexts_config(); |
269 | 269 | $ctxt = array(); |
270 | 270 | $context_templates = $item->context_templates(); |
271 | - foreach ( $context_templates as $context => $template_fields ) { |
|
272 | - $mtp_to = !empty( $context_templates[$context]['to'] ) && $context_templates[$context]['to'] instanceof EE_Message_Template ? $context_templates[$context]['to']->get('MTP_content') : NULL; |
|
273 | - $inactive = empty( $mtp_to ) && !empty( $context_templates[$context]['to'] ) ? ' class="mtp-inactive"' : ''; |
|
271 | + foreach ($context_templates as $context => $template_fields) { |
|
272 | + $mtp_to = ! empty($context_templates[$context]['to']) && $context_templates[$context]['to'] instanceof EE_Message_Template ? $context_templates[$context]['to']->get('MTP_content') : NULL; |
|
273 | + $inactive = empty($mtp_to) && ! empty($context_templates[$context]['to']) ? ' class="mtp-inactive"' : ''; |
|
274 | 274 | $context_title = ucwords($c_configs[$context]['label']); |
275 | - $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 ); |
|
276 | - $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; |
|
275 | + $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); |
|
276 | + $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; |
|
277 | 277 | } |
278 | 278 | |
279 | - $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) : ''; |
|
279 | + $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) : ''; |
|
280 | 280 | |
281 | 281 | |
282 | 282 | //Return the name contents |
@@ -284,7 +284,7 @@ discard block |
||
284 | 284 | /* $1%s */ $name_link, |
285 | 285 | /* $2%s */ $item->GRP_ID(), |
286 | 286 | /* %4$s */ $ctx_content, |
287 | - /* $3%s */ $this->row_actions( $actions ) |
|
287 | + /* $3%s */ $this->row_actions($actions) |
|
288 | 288 | ); |
289 | 289 | } |
290 | 290 | |
@@ -305,7 +305,7 @@ discard block |
||
305 | 305 | * @return string message_type name |
306 | 306 | */ |
307 | 307 | function column_message_type($item) { |
308 | - return ucwords($item->message_type_obj()->label['singular'] ); |
|
308 | + return ucwords($item->message_type_obj()->label['singular']); |
|
309 | 309 | } |
310 | 310 | |
311 | 311 |
@@ -1,6 +1,7 @@ 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 | 6 | /** |
6 | 7 | * Event Espresso |
@@ -134,8 +135,9 @@ discard block |
||
134 | 135 | } |
135 | 136 | |
136 | 137 | //first we consider whether this template has override set. If it does then that means no custom templates can be created from this template as a base. So let's just skip the button creation. |
137 | - if ( $item->get('MTP_is_override' ) ) |
|
138 | - return ''; |
|
138 | + if ( $item->get('MTP_is_override' ) ) { |
|
139 | + return ''; |
|
140 | + } |
|
139 | 141 | |
140 | 142 | |
141 | 143 | $create_args = array( |
@@ -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 | /** |
@@ -31,18 +31,18 @@ discard block |
||
31 | 31 | |
32 | 32 | |
33 | 33 | |
34 | - public function __construct( $routing = TRUE ) { |
|
35 | - parent::__construct( $routing ); |
|
36 | - if ( !defined( 'EE_MSG_CAF_ASSETS_PATH' ) ) { |
|
37 | - define( 'EE_MSG_CAF_ASSETS_PATH', EE_CORE_CAF_ADMIN_EXTEND . 'messages/assets/' ); |
|
38 | - define( 'EE_MSG_CAF_ASSETS_URL', EE_CORE_CAF_ADMIN_EXTEND_URL . 'messages/assets/' ); |
|
39 | - define( 'EE_MSG_CAF_TEMPLATE_PATH', EE_CORE_CAF_ADMIN_EXTEND . 'messages/templates/' ); |
|
40 | - define( 'EE_MSG_CAF_TEMPLATE_URL', EE_CORE_CAF_ADMIN_EXTEND_URL . 'messages/templates/' ); |
|
34 | + public function __construct($routing = TRUE) { |
|
35 | + parent::__construct($routing); |
|
36 | + if ( ! defined('EE_MSG_CAF_ASSETS_PATH')) { |
|
37 | + define('EE_MSG_CAF_ASSETS_PATH', EE_CORE_CAF_ADMIN_EXTEND.'messages/assets/'); |
|
38 | + define('EE_MSG_CAF_ASSETS_URL', EE_CORE_CAF_ADMIN_EXTEND_URL.'messages/assets/'); |
|
39 | + define('EE_MSG_CAF_TEMPLATE_PATH', EE_CORE_CAF_ADMIN_EXTEND.'messages/templates/'); |
|
40 | + define('EE_MSG_CAF_TEMPLATE_URL', EE_CORE_CAF_ADMIN_EXTEND_URL.'messages/templates/'); |
|
41 | 41 | } |
42 | 42 | } |
43 | 43 | |
44 | 44 | protected function _extend_page_config() { |
45 | - $this->_admin_base_path = EE_CORE_CAF_ADMIN_EXTEND . 'messages'; |
|
45 | + $this->_admin_base_path = EE_CORE_CAF_ADMIN_EXTEND.'messages'; |
|
46 | 46 | $this->_page_routes['custom_mtps'] = array( |
47 | 47 | 'func' => '_ee_custom_messages_overview_list_table', |
48 | 48 | 'capability' => 'ee_read_messages' ); |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | 'require_nonce' => FALSE |
71 | 71 | ); |
72 | 72 | |
73 | - add_action( 'current_screen', array( $this, 'dynamic_screen_hooks' ), 10 ); |
|
73 | + add_action('current_screen', array($this, 'dynamic_screen_hooks'), 10); |
|
74 | 74 | } |
75 | 75 | |
76 | 76 | |
@@ -87,12 +87,12 @@ discard block |
||
87 | 87 | public function dynamic_screen_hooks() { |
88 | 88 | global $admin_page_hooks; |
89 | 89 | |
90 | - if ( !empty( $admin_page_hooks['espresso_events'] ) ) { |
|
90 | + if ( ! empty($admin_page_hooks['espresso_events'])) { |
|
91 | 91 | //we're on a EE specific page... good stuff! |
92 | 92 | $hook_prefix = $admin_page_hooks['espresso_events']; |
93 | - $filter_ref = $hook_prefix . '_page_' . $this->page_slug; |
|
94 | - add_filter( 'FHEE_manage_' . $filter_ref . '_columns', array( $this, 'add_custom_mtps_columns' ), 10, 2 ); |
|
95 | - add_action( 'AHEE__EE_Admin_List_Table__column_actions__' . $filter_ref, array( $this, 'custom_mtp_create_button_column'), 10, 2 ); |
|
93 | + $filter_ref = $hook_prefix.'_page_'.$this->page_slug; |
|
94 | + add_filter('FHEE_manage_'.$filter_ref.'_columns', array($this, 'add_custom_mtps_columns'), 10, 2); |
|
95 | + add_action('AHEE__EE_Admin_List_Table__column_actions__'.$filter_ref, array($this, 'custom_mtp_create_button_column'), 10, 2); |
|
96 | 96 | } |
97 | 97 | } |
98 | 98 | |
@@ -106,8 +106,8 @@ discard block |
||
106 | 106 | * @param array $columns Original defined list of columns |
107 | 107 | * @param string $screen_id The unique screen id for the page. |
108 | 108 | */ |
109 | - public function add_custom_mtps_columns( $columns, $screen_id ) { |
|
110 | - if ( $screen_id !== 'espresso_messages_global_mtps' ) { |
|
109 | + public function add_custom_mtps_columns($columns, $screen_id) { |
|
110 | + if ($screen_id !== 'espresso_messages_global_mtps') { |
|
111 | 111 | return $columns; |
112 | 112 | } |
113 | 113 | |
@@ -128,13 +128,13 @@ discard block |
||
128 | 128 | * |
129 | 129 | * @return string html content for the page. |
130 | 130 | */ |
131 | - public function custom_mtp_create_button_column( $item, $screen_id ) { |
|
132 | - if ( $screen_id !== 'espresso_messages_global_mtps' || ! EE_Registry::instance()->CAP->current_user_can( 'ee_edit_messages', 'espresso_messages_add_new_message_template' ) ) { |
|
131 | + public function custom_mtp_create_button_column($item, $screen_id) { |
|
132 | + if ($screen_id !== 'espresso_messages_global_mtps' || ! EE_Registry::instance()->CAP->current_user_can('ee_edit_messages', 'espresso_messages_add_new_message_template')) { |
|
133 | 133 | return ''; |
134 | 134 | } |
135 | 135 | |
136 | 136 | //first we consider whether this template has override set. If it does then that means no custom templates can be created from this template as a base. So let's just skip the button creation. |
137 | - if ( $item->get('MTP_is_override' ) ) |
|
137 | + if ($item->get('MTP_is_override')) |
|
138 | 138 | return ''; |
139 | 139 | |
140 | 140 | |
@@ -144,8 +144,8 @@ discard block |
||
144 | 144 | 'message_type' => $item->message_type(), |
145 | 145 | 'action' => 'add_new_message_template' |
146 | 146 | ); |
147 | - $create_link = EE_Admin_Page::add_query_args_and_nonce( $create_args, EE_MSG_ADMIN_URL ); |
|
148 | - echo sprintf( '<a href="%s" class="button button-small">%s</a>', $create_link, __('Create Custom', 'event_espresso') ); |
|
147 | + $create_link = EE_Admin_Page::add_query_args_and_nonce($create_args, EE_MSG_ADMIN_URL); |
|
148 | + echo sprintf('<a href="%s" class="button button-small">%s</a>', $create_link, __('Create Custom', 'event_espresso')); |
|
149 | 149 | } |
150 | 150 | |
151 | 151 | |
@@ -178,7 +178,7 @@ discard block |
||
178 | 178 | ) |
179 | 179 | ) |
180 | 180 | ); |
181 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_delete_messages', 'espresso_messages_trash_message_template' ) ) { |
|
181 | + if (EE_Registry::instance()->CAP->current_user_can('ee_delete_messages', 'espresso_messages_trash_message_template')) { |
|
182 | 182 | $this->_views['trashed'] = array( |
183 | 183 | 'slug' => 'trashed', |
184 | 184 | 'label' => __('Trash', 'event_espresso'), |
@@ -1,6 +1,7 @@ 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 | 6 | /** |
6 | 7 | * Event Espresso |
@@ -125,8 +126,9 @@ discard block |
||
125 | 126 | $actions = array(); |
126 | 127 | |
127 | 128 | //return $item->name(); |
128 | - if ( !defined('REG_ADMIN_URL') ) |
|
129 | - define('REG_ADMIN_URL', EVENTS_ADMIN_URL); |
|
129 | + if ( !defined('REG_ADMIN_URL') ) { |
|
130 | + define('REG_ADMIN_URL', EVENTS_ADMIN_URL); |
|
131 | + } |
|
130 | 132 | |
131 | 133 | $edit_query_args = array( |
132 | 134 | 'action' => 'edit_question_group', |
@@ -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 | /** |
@@ -31,7 +31,7 @@ discard block |
||
31 | 31 | class Registration_Form_Question_Groups_Admin_List_Table extends EE_Admin_List_Table { |
32 | 32 | |
33 | 33 | |
34 | - public function __construct( $admin_page ) { |
|
34 | + public function __construct($admin_page) { |
|
35 | 35 | parent::__construct($admin_page); |
36 | 36 | } |
37 | 37 | |
@@ -39,8 +39,8 @@ discard block |
||
39 | 39 | |
40 | 40 | |
41 | 41 | protected function _setup_data() { |
42 | - $this->_data = $this->_view != 'trash' ? $this->_admin_page->get_question_groups( $this->_per_page,$this->_current_page, FALSE ) : $this->_admin_page->get_trashed_question_groups( $this->_per_page,$this->_current_page, FALSE ); |
|
43 | - $this->_all_data_count = $this->_view != 'trash' ? $this->_admin_page->get_question_groups( $this->_per_page,$this->_current_page, TRUE ) : $this->_admin_page->get_trashed_question_groups( $this->_per_page,$this->_current_page, TRUE ); |
|
42 | + $this->_data = $this->_view != 'trash' ? $this->_admin_page->get_question_groups($this->_per_page, $this->_current_page, FALSE) : $this->_admin_page->get_trashed_question_groups($this->_per_page, $this->_current_page, FALSE); |
|
43 | + $this->_all_data_count = $this->_view != 'trash' ? $this->_admin_page->get_question_groups($this->_per_page, $this->_current_page, TRUE) : $this->_admin_page->get_trashed_question_groups($this->_per_page, $this->_current_page, TRUE); |
|
44 | 44 | } |
45 | 45 | |
46 | 46 | |
@@ -49,8 +49,8 @@ discard block |
||
49 | 49 | |
50 | 50 | protected function _set_properties() { |
51 | 51 | $this->_wp_list_args = array( |
52 | - 'singular' => __('question group', 'event_espresso' ), |
|
53 | - 'plural' => __('question groups', 'event_espresso' ), |
|
52 | + 'singular' => __('question group', 'event_espresso'), |
|
53 | + 'plural' => __('question groups', 'event_espresso'), |
|
54 | 54 | 'ajax' => TRUE, //for now, |
55 | 55 | 'screen' => $this->_admin_page->get_current_screen()->id |
56 | 56 | ); |
@@ -65,8 +65,8 @@ discard block |
||
65 | 65 | ); |
66 | 66 | |
67 | 67 | $this->_sortable_columns = array( |
68 | - 'id' => array( 'QSG_ID' => FALSE ), |
|
69 | - 'name' => array( 'QSG_name' => FALSE ) |
|
68 | + 'id' => array('QSG_ID' => FALSE), |
|
69 | + 'name' => array('QSG_name' => FALSE) |
|
70 | 70 | ); |
71 | 71 | |
72 | 72 | $this->_hidden_columns = array( |
@@ -92,9 +92,9 @@ discard block |
||
92 | 92 | |
93 | 93 | |
94 | 94 | protected function _add_view_counts() { |
95 | - $this->_views['all']['count'] = $this->_admin_page->get_question_groups( $this->_per_page,$this->_current_page, TRUE ); |
|
96 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_delete_question_groups', 'espresso_registration_form_trash_question_group' ) ) { |
|
97 | - $this->_views['trash']['count'] = $this->_admin_page->get_trashed_question_groups( $this->_per_page,$this->_current_page, TRUE ); |
|
95 | + $this->_views['all']['count'] = $this->_admin_page->get_question_groups($this->_per_page, $this->_current_page, TRUE); |
|
96 | + if (EE_Registry::instance()->CAP->current_user_can('ee_delete_question_groups', 'espresso_registration_form_trash_question_group')) { |
|
97 | + $this->_views['trash']['count'] = $this->_admin_page->get_trashed_question_groups($this->_per_page, $this->_current_page, TRUE); |
|
98 | 98 | } |
99 | 99 | } |
100 | 100 | |
@@ -107,7 +107,7 @@ discard block |
||
107 | 107 | $system_group = $item->get('QSG_system'); |
108 | 108 | $has_questions_with_answers = $item->has_questions_with_answers(); |
109 | 109 | $lock_icon = $system_group === 0 && $this->_view == 'trash' && $has_questions_with_answers ? 'ee-lock-icon ee-alternate-color' : 'ee-lock-icon ee-system-lock'; |
110 | - return $system_group > 0 || ( $system_group === 0 && $this->_view == 'trash' && $has_questions_with_answers ) || ! EE_Registry::instance()->CAP->current_user_can( 'ee_delete_question_groups', 'espresso_registration_form_trash_question_groups', $item->ID() ) ? '<span class="' . $lock_icon . '"></span>' . sprintf( '<input type="hidden" name="hdnchk[%1$d]" value="%1$d" />', $item->ID() ) : sprintf( '<input type="checkbox" id="QSG_ID[%1$d]" name="checkbox[%1$d]" value="%1$d" />', $item->ID() ); |
|
110 | + return $system_group > 0 || ($system_group === 0 && $this->_view == 'trash' && $has_questions_with_answers) || ! EE_Registry::instance()->CAP->current_user_can('ee_delete_question_groups', 'espresso_registration_form_trash_question_groups', $item->ID()) ? '<span class="'.$lock_icon.'"></span>'.sprintf('<input type="hidden" name="hdnchk[%1$d]" value="%1$d" />', $item->ID()) : sprintf('<input type="checkbox" id="QSG_ID[%1$d]" name="checkbox[%1$d]" value="%1$d" />', $item->ID()); |
|
111 | 111 | } |
112 | 112 | |
113 | 113 | |
@@ -117,7 +117,7 @@ discard block |
||
117 | 117 | |
118 | 118 | public function column_id(EE_Question_Group $item) { |
119 | 119 | $content = $item->ID(); |
120 | - $content .= ' <span class="show-on-mobile-view-only">' .$item->name() . '</span>'; |
|
120 | + $content .= ' <span class="show-on-mobile-view-only">'.$item->name().'</span>'; |
|
121 | 121 | return $content; |
122 | 122 | } |
123 | 123 | |
@@ -127,7 +127,7 @@ discard block |
||
127 | 127 | $actions = array(); |
128 | 128 | |
129 | 129 | //return $item->name(); |
130 | - if ( !defined('REG_ADMIN_URL') ) |
|
130 | + if ( ! defined('REG_ADMIN_URL')) |
|
131 | 131 | define('REG_ADMIN_URL', EVENTS_ADMIN_URL); |
132 | 132 | |
133 | 133 | $edit_query_args = array( |
@@ -152,32 +152,32 @@ discard block |
||
152 | 152 | |
153 | 153 | |
154 | 154 | |
155 | - $edit_link = EE_Admin_Page::add_query_args_and_nonce( $edit_query_args, EE_FORMS_ADMIN_URL ); |
|
156 | - $trash_link = EE_Admin_Page::add_query_args_and_nonce( $trash_query_args, EE_FORMS_ADMIN_URL ); |
|
157 | - $restore_link = EE_Admin_Page::add_query_args_and_nonce( $restore_query_args, EE_FORMS_ADMIN_URL ); |
|
158 | - $delete_link = EE_Admin_Page::add_query_args_and_nonce( $delete_query_args, EE_FORMS_ADMIN_URL ); |
|
155 | + $edit_link = EE_Admin_Page::add_query_args_and_nonce($edit_query_args, EE_FORMS_ADMIN_URL); |
|
156 | + $trash_link = EE_Admin_Page::add_query_args_and_nonce($trash_query_args, EE_FORMS_ADMIN_URL); |
|
157 | + $restore_link = EE_Admin_Page::add_query_args_and_nonce($restore_query_args, EE_FORMS_ADMIN_URL); |
|
158 | + $delete_link = EE_Admin_Page::add_query_args_and_nonce($delete_query_args, EE_FORMS_ADMIN_URL); |
|
159 | 159 | |
160 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_edit_question_group', 'espresso_registration_form_edit_question_group', $item->ID() ) ) { |
|
160 | + if (EE_Registry::instance()->CAP->current_user_can('ee_edit_question_group', 'espresso_registration_form_edit_question_group', $item->ID())) { |
|
161 | 161 | $actions = array( |
162 | - 'edit' => '<a href="' . $edit_link . '" title="' . esc_attr__('Edit Question Group', 'event_espresso') . '">' . __('Edit', 'event_espresso') . '</a>' |
|
162 | + 'edit' => '<a href="'.$edit_link.'" title="'.esc_attr__('Edit Question Group', 'event_espresso').'">'.__('Edit', 'event_espresso').'</a>' |
|
163 | 163 | ); |
164 | 164 | } |
165 | - if ( $item->get('QSG_system') < 1 && $this->_view != 'trash' && EE_Registry::instance()->CAP->current_user_can( 'ee_delete_question_group', 'espresso_registration_form_trash_question_group', $item->ID() ) ) { |
|
166 | - $actions['delete'] = '<a href="' . $trash_link . '" title="' . esc_attr__('Delete Question Group', 'event_espresso') . '">' . __('Trash', 'event_espresso') . '</a>'; |
|
165 | + if ($item->get('QSG_system') < 1 && $this->_view != 'trash' && EE_Registry::instance()->CAP->current_user_can('ee_delete_question_group', 'espresso_registration_form_trash_question_group', $item->ID())) { |
|
166 | + $actions['delete'] = '<a href="'.$trash_link.'" title="'.esc_attr__('Delete Question Group', 'event_espresso').'">'.__('Trash', 'event_espresso').'</a>'; |
|
167 | 167 | } |
168 | 168 | |
169 | - if ( $this->_view == 'trash' ) { |
|
169 | + if ($this->_view == 'trash') { |
|
170 | 170 | |
171 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_delete_question_group', 'espresso_registration_form_restore_question_group', $item->ID() ) ) { |
|
172 | - $actions['restore'] = '<a href="' . $restore_link . '" title="' . esc_attr__('Restore Question Group', 'event_espresso') . '">' . __('Restore', 'event_espresso') . '</a>'; |
|
171 | + if (EE_Registry::instance()->CAP->current_user_can('ee_delete_question_group', 'espresso_registration_form_restore_question_group', $item->ID())) { |
|
172 | + $actions['restore'] = '<a href="'.$restore_link.'" title="'.esc_attr__('Restore Question Group', 'event_espresso').'">'.__('Restore', 'event_espresso').'</a>'; |
|
173 | 173 | } |
174 | 174 | |
175 | - if ( !$item->has_questions_with_answers() && EE_Registry::instance()->CAP->current_user_can( 'ee_delete_question_group', 'espresso_registration_form_delete_question_group', $item->ID() ) ) { |
|
176 | - $actions['delete'] = '<a href="' . $delete_link . '" title="' . esc_attr__('Delete Question Group Permanently', 'event_espresso') . '">' . __('Delete Permanently', 'event_espresso') . '</a>'; |
|
175 | + if ( ! $item->has_questions_with_answers() && EE_Registry::instance()->CAP->current_user_can('ee_delete_question_group', 'espresso_registration_form_delete_question_group', $item->ID())) { |
|
176 | + $actions['delete'] = '<a href="'.$delete_link.'" title="'.esc_attr__('Delete Question Group Permanently', 'event_espresso').'">'.__('Delete Permanently', 'event_espresso').'</a>'; |
|
177 | 177 | } |
178 | 178 | } |
179 | 179 | |
180 | - $content = EE_Registry::instance()->CAP->current_user_can( 'ee_edit_question_group', 'espresso_registration_form_edit_question_group', $item->ID() ) ? '<strong><a class="row-title" href="' . $edit_link . '">' . $item->name() . '</a></strong>' : $item->name(); |
|
180 | + $content = EE_Registry::instance()->CAP->current_user_can('ee_edit_question_group', 'espresso_registration_form_edit_question_group', $item->ID()) ? '<strong><a class="row-title" href="'.$edit_link.'">'.$item->name().'</a></strong>' : $item->name(); |
|
181 | 181 | $content .= $this->row_actions($actions); |
182 | 182 | return $content; |
183 | 183 | } |
@@ -198,13 +198,13 @@ discard block |
||
198 | 198 | |
199 | 199 | |
200 | 200 | public function column_show_group_name(EE_Question_Group $item) { |
201 | - return $this->_yes_no[ $item->show_group_name() ]; |
|
201 | + return $this->_yes_no[$item->show_group_name()]; |
|
202 | 202 | } |
203 | 203 | |
204 | 204 | |
205 | 205 | |
206 | 206 | public function column_show_group_desc(EE_Question_Group $item) { |
207 | - return $this->_yes_no[ $item->show_group_desc() ]; |
|
207 | + return $this->_yes_no[$item->show_group_desc()]; |
|
208 | 208 | } |
209 | 209 | |
210 | 210 |
@@ -1,6 +1,7 @@ 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 | 6 | /** |
6 | 7 | * Event Espresso |
@@ -142,8 +143,9 @@ discard block |
||
142 | 143 | if ( !empty( $question_groups ) ) { |
143 | 144 | foreach ( $question_groups as $id => $val ) { |
144 | 145 | //add to event |
145 | - if ( $val ) |
|
146 | - $qg = $evtobj->_add_relation_to( $id, 'Question_Group', array('EQG_primary' => 0) ); |
|
146 | + if ( $val ) { |
|
147 | + $qg = $evtobj->_add_relation_to( $id, 'Question_Group', array('EQG_primary' => 0) ); |
|
148 | + } |
|
147 | 149 | $success[] = !empty($qg) ? 1 : 0; |
148 | 150 | } |
149 | 151 | } |
@@ -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 | /** |
@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | class espresso_events_Registration_Form_Hooks_Extend extends espresso_events_Registration_Form_Hooks { |
31 | 31 | |
32 | 32 | |
33 | - public function __construct( EE_Admin_Page $admin_page ) { |
|
33 | + public function __construct(EE_Admin_Page $admin_page) { |
|
34 | 34 | parent::__construct($admin_page); |
35 | 35 | } |
36 | 36 | |
@@ -54,31 +54,31 @@ discard block |
||
54 | 54 | ) |
55 | 55 | ); |
56 | 56 | |
57 | - $this->_metaboxes = array_merge( $this->_metaboxes, $new_metaboxes); |
|
57 | + $this->_metaboxes = array_merge($this->_metaboxes, $new_metaboxes); |
|
58 | 58 | } |
59 | 59 | |
60 | 60 | |
61 | 61 | |
62 | 62 | |
63 | - public function modify_callbacks( $callbacks ) { |
|
64 | - $callbacks = parent::modify_callbacks( $callbacks ); |
|
65 | - $callbacks[] = array( $this, 'additional_question_group_update' ); |
|
63 | + public function modify_callbacks($callbacks) { |
|
64 | + $callbacks = parent::modify_callbacks($callbacks); |
|
65 | + $callbacks[] = array($this, 'additional_question_group_update'); |
|
66 | 66 | return $callbacks; |
67 | 67 | } |
68 | 68 | |
69 | 69 | |
70 | 70 | |
71 | - public function restore_revision( $post_id, $revision_id ) { |
|
72 | - $post_evt = parent::restore_revision( $post_id, $revision_id ); |
|
71 | + public function restore_revision($post_id, $revision_id) { |
|
72 | + $post_evt = parent::restore_revision($post_id, $revision_id); |
|
73 | 73 | |
74 | 74 | //restore revision for additional questions |
75 | - $post_evt->restore_revision( $revision_id, array('Question_Group'), array('Question_Group' => array('Event_Question_Group.EQG_primary' => 0 ) ) ); |
|
75 | + $post_evt->restore_revision($revision_id, array('Question_Group'), array('Question_Group' => array('Event_Question_Group.EQG_primary' => 0))); |
|
76 | 76 | } |
77 | 77 | |
78 | 78 | |
79 | 79 | |
80 | 80 | |
81 | - public function additional_questions( $post_id, $post ) { |
|
81 | + public function additional_questions($post_id, $post) { |
|
82 | 82 | $this->_event = $this->_adminpage_obj->get_event_object(); |
83 | 83 | $event_id = $this->_event->ID(); |
84 | 84 | ?> |
@@ -95,32 +95,32 @@ discard block |
||
95 | 95 | <?php |
96 | 96 | |
97 | 97 | $qsg_where['QSG_deleted'] = FALSE; |
98 | - $query_params = array( $qsg_where, 'order_by' => array( 'QSG_order' => 'ASC' ) ); |
|
99 | - $QSGs = EEM_Question_Group::instance()->get_all( $query_params ); |
|
100 | - $EQGs = !empty( $event_id ) ? $this->_event->get_many_related('Question_Group', array(array('Event_Question_Group.EQG_primary' => 0 )) ) : array(); |
|
98 | + $query_params = array($qsg_where, 'order_by' => array('QSG_order' => 'ASC')); |
|
99 | + $QSGs = EEM_Question_Group::instance()->get_all($query_params); |
|
100 | + $EQGs = ! empty($event_id) ? $this->_event->get_many_related('Question_Group', array(array('Event_Question_Group.EQG_primary' => 0))) : array(); |
|
101 | 101 | $EQGids = array_keys($EQGs); |
102 | 102 | |
103 | - if ( ! empty( $QSGs )) { |
|
104 | - $html = count( $QSGs ) > 10 ? '<div style="height:250px;overflow:auto;">' : ''; |
|
105 | - foreach ( $QSGs as $QSG ) { |
|
103 | + if ( ! empty($QSGs)) { |
|
104 | + $html = count($QSGs) > 10 ? '<div style="height:250px;overflow:auto;">' : ''; |
|
105 | + foreach ($QSGs as $QSG) { |
|
106 | 106 | |
107 | - $checked = in_array( $QSG->ID(), $EQGids ) ? ' checked="checked" ' : ''; |
|
108 | - $edit_link = $this->_adminpage_obj->add_query_args_and_nonce( array( 'action' => 'edit_question_group', 'QSG_ID' => $QSG->ID() ), EE_FORMS_ADMIN_URL ); |
|
107 | + $checked = in_array($QSG->ID(), $EQGids) ? ' checked="checked" ' : ''; |
|
108 | + $edit_link = $this->_adminpage_obj->add_query_args_and_nonce(array('action' => 'edit_question_group', 'QSG_ID' => $QSG->ID()), EE_FORMS_ADMIN_URL); |
|
109 | 109 | |
110 | 110 | $html .= ' |
111 | - <p id="event-question-group-' . $QSG->ID() . '"> |
|
112 | - <input value="' . $QSG->ID() . '" type="checkbox" name="add_attendee_question_groups[' . $QSG->ID() . ']"' . $checked . ' /> |
|
113 | - <a href="' . $edit_link . '" title="' . sprintf( esc_attr__( 'Edit %s Group', 'event_espresso' ), $QSG->get('QSG_name') ) . '" target="_blank">' . $QSG->get('QSG_name') . '</a> |
|
111 | + <p id="event-question-group-' . $QSG->ID().'"> |
|
112 | + <input value="' . $QSG->ID().'" type="checkbox" name="add_attendee_question_groups['.$QSG->ID().']"'.$checked.' /> |
|
113 | + <a href="' . $edit_link.'" title="'.sprintf(esc_attr__('Edit %s Group', 'event_espresso'), $QSG->get('QSG_name')).'" target="_blank">'.$QSG->get('QSG_name').'</a> |
|
114 | 114 | </p>'; |
115 | 115 | } |
116 | - $html .= count( $QSGs ) > 10 ? '</div>' : ''; |
|
116 | + $html .= count($QSGs) > 10 ? '</div>' : ''; |
|
117 | 117 | |
118 | 118 | echo $html; |
119 | 119 | |
120 | 120 | } else { |
121 | 121 | echo __('There seems to be a problem with your questions. Please contact [email protected]', 'event_espresso'); |
122 | 122 | } |
123 | - do_action( 'AHEE__espresso_events_Registration_Form_Hooks__additional_questions__after_content' ); |
|
123 | + do_action('AHEE__espresso_events_Registration_Form_Hooks__additional_questions__after_content'); |
|
124 | 124 | ?> |
125 | 125 | </div> |
126 | 126 | <?php |
@@ -130,31 +130,31 @@ discard block |
||
130 | 130 | |
131 | 131 | |
132 | 132 | |
133 | - public function additional_question_group_update( $evtobj, $data ) { |
|
134 | - $question_groups = !empty( $data['add_attendee_question_groups'] ) ? (array) $data['add_attendee_question_groups'] : array(); |
|
133 | + public function additional_question_group_update($evtobj, $data) { |
|
134 | + $question_groups = ! empty($data['add_attendee_question_groups']) ? (array) $data['add_attendee_question_groups'] : array(); |
|
135 | 135 | $added_qgs = array_keys($question_groups); |
136 | 136 | $success = array(); |
137 | 137 | |
138 | 138 | //let's get all current question groups associated with this event. |
139 | - $current_qgs = $evtobj->get_many_related('Question_Group', array(array('Event_Question_Group.EQG_primary' => 0) ) ); |
|
139 | + $current_qgs = $evtobj->get_many_related('Question_Group', array(array('Event_Question_Group.EQG_primary' => 0))); |
|
140 | 140 | $current_qgs = array_keys($current_qgs); //we just want the ids |
141 | 141 | |
142 | 142 | //now let's get the groups selected in the editor and update (IF we have data) |
143 | - if ( !empty( $question_groups ) ) { |
|
144 | - foreach ( $question_groups as $id => $val ) { |
|
143 | + if ( ! empty($question_groups)) { |
|
144 | + foreach ($question_groups as $id => $val) { |
|
145 | 145 | //add to event |
146 | - if ( $val ) |
|
147 | - $qg = $evtobj->_add_relation_to( $id, 'Question_Group', array('EQG_primary' => 0) ); |
|
148 | - $success[] = !empty($qg) ? 1 : 0; |
|
146 | + if ($val) |
|
147 | + $qg = $evtobj->_add_relation_to($id, 'Question_Group', array('EQG_primary' => 0)); |
|
148 | + $success[] = ! empty($qg) ? 1 : 0; |
|
149 | 149 | } |
150 | 150 | } |
151 | 151 | |
152 | 152 | //wait a minute... are there question groups missing in the saved groups that ARE with the current event? |
153 | - $removed_qgs = array_diff( $current_qgs, $added_qgs ); |
|
153 | + $removed_qgs = array_diff($current_qgs, $added_qgs); |
|
154 | 154 | |
155 | - foreach ( $removed_qgs as $qgid ) { |
|
156 | - $qg = $evtobj->_remove_relation_to( $qgid, 'Question_Group', array('EQG_primary' => 0 ) ); |
|
157 | - $success[] = !empty($qg) ? 1 : 0; |
|
155 | + foreach ($removed_qgs as $qgid) { |
|
156 | + $qg = $evtobj->_remove_relation_to($qgid, 'Question_Group', array('EQG_primary' => 0)); |
|
157 | + $success[] = ! empty($qg) ? 1 : 0; |
|
158 | 158 | } |
159 | 159 | |
160 | 160 |
@@ -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 | /** |
@@ -116,42 +116,42 @@ discard block |
||
116 | 116 | |
117 | 117 | |
118 | 118 | protected function _start() { |
119 | - $content = '<h3>' . __('Questions Overview', 'event_espresso') . '</h3>'; |
|
120 | - $content .= '<p>' . __('This tour of the Questions Overview page will go over different areas of the screen to help you understand what they are used for.', 'event_espresso') . '</p>'; |
|
119 | + $content = '<h3>'.__('Questions Overview', 'event_espresso').'</h3>'; |
|
120 | + $content .= '<p>'.__('This tour of the Questions Overview page will go over different areas of the screen to help you understand what they are used for.', 'event_espresso').'</p>'; |
|
121 | 121 | |
122 | 122 | return $content; |
123 | 123 | } |
124 | 124 | |
125 | 125 | protected function _display_text_stop() { |
126 | - return '<p>' . __('View available questions. You can reorder your questions by dragging and dropping them.', 'event_espresso') . '</p>'; |
|
126 | + return '<p>'.__('View available questions. You can reorder your questions by dragging and dropping them.', 'event_espresso').'</p>'; |
|
127 | 127 | } |
128 | 128 | |
129 | 129 | protected function _admin_label_stop() { |
130 | - return '<p>' . __('View the admin label for your questions.', 'event_espresso') . '</p>'; |
|
130 | + return '<p>'.__('View the admin label for your questions.', 'event_espresso').'</p>'; |
|
131 | 131 | } |
132 | 132 | |
133 | 133 | protected function _type_stop() { |
134 | - return '<p>' . __('View the type of question. Available options are Text, Textarea, Checkboxes, Radio Buttons, Dropdown, State/Province Dropdown, Country Dropdown, and Date Picker.', 'event_espresso') . '</p>'; |
|
134 | + return '<p>'.__('View the type of question. Available options are Text, Textarea, Checkboxes, Radio Buttons, Dropdown, State/Province Dropdown, Country Dropdown, and Date Picker.', 'event_espresso').'</p>'; |
|
135 | 135 | } |
136 | 136 | |
137 | 137 | protected function _values_stop() { |
138 | - return '<p>' . __('View stored values for checkboxes, radio buttons, and select boxes.', 'event_espresso') . '</p>'; |
|
138 | + return '<p>'.__('View stored values for checkboxes, radio buttons, and select boxes.', 'event_espresso').'</p>'; |
|
139 | 139 | } |
140 | 140 | |
141 | 141 | protected function _required_stop() { |
142 | - return '<p>' . __('View if a question is required.', 'event_espresso') . '</p>'; |
|
142 | + return '<p>'.__('View if a question is required.', 'event_espresso').'</p>'; |
|
143 | 143 | } |
144 | 144 | |
145 | 145 | protected function _bulk_actions_stop() { |
146 | - return '<p>' . __('Perform bulk actions to multiple questions.', 'event_espresso') . '</p>'; |
|
146 | + return '<p>'.__('Perform bulk actions to multiple questions.', 'event_espresso').'</p>'; |
|
147 | 147 | } |
148 | 148 | |
149 | 149 | protected function _search_stop() { |
150 | - return '<p>' . __('Search through questions. The following sources will be searched: Name of Question (display text).', 'event_espresso') . '</p>'; |
|
150 | + return '<p>'.__('Search through questions. The following sources will be searched: Name of Question (display text).', 'event_espresso').'</p>'; |
|
151 | 151 | } |
152 | 152 | |
153 | 153 | protected function _add_new_question_stop() { |
154 | - return '<p>' . __('Click here to add a new question.', 'event_espresso') . '</p>'; |
|
154 | + return '<p>'.__('Click here to add a new question.', 'event_espresso').'</p>'; |
|
155 | 155 | } |
156 | 156 | |
157 | 157 | } |
158 | 158 | \ 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 | * |
@@ -121,7 +121,7 @@ |
||
121 | 121 | <?php |
122 | 122 | $question_order = 0; |
123 | 123 | $question_group_questions = $question_group->questions(); |
124 | - foreach( $all_questions as $question_ID => $question ){ |
|
124 | + foreach( $all_questions as $question_ID => $question ){ |
|
125 | 125 | if ( $question instanceof EE_Question ) { |
126 | 126 | /*@var $question EE_Question*/ |
127 | 127 | $checked = isset( $question_group_questions[ $question_ID ] ) ? ' checked="checked"' : ''; |
@@ -9,8 +9,8 @@ discard block |
||
9 | 9 | assert($question_group); |
10 | 10 | assert($question_group instanceof EE_Question_Group); |
11 | 11 | /* @var EE_Question[] $all_questions */ |
12 | -assert(isset($all_questions) && (empty($all_questions) || is_array($all_questions)));//list of unused questions |
|
13 | -foreach($all_questions as $unused_question){ |
|
12 | +assert(isset($all_questions) && (empty($all_questions) || is_array($all_questions))); //list of unused questions |
|
13 | +foreach ($all_questions as $unused_question) { |
|
14 | 14 | assert($unused_question); |
15 | 15 | assert($unused_question instanceof EE_Question); |
16 | 16 | } |
@@ -19,8 +19,8 @@ discard block |
||
19 | 19 | |
20 | 20 | $QSG_system = $question_group->system_group(); |
21 | 21 | |
22 | -$disabled = ! empty( $QSG_system ) ? ' disabled="disabled"' : ''; |
|
23 | -$id = ! empty( $QST_system ) ? '_disabled' : ''; |
|
22 | +$disabled = ! empty($QSG_system) ? ' disabled="disabled"' : ''; |
|
23 | +$id = ! empty($QST_system) ? '_disabled' : ''; |
|
24 | 24 | ?> |
25 | 25 | |
26 | 26 | <div id="group-details" class="edit-group padding"> |
@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | <tr> |
31 | 31 | <th> |
32 | 32 | <label for="QSG_name"> |
33 | - <?php _e('Group Name','event_espresso');?> <?php echo EEH_Template::get_help_tab_link('group_name_info');?> |
|
33 | + <?php _e('Group Name', 'event_espresso'); ?> <?php echo EEH_Template::get_help_tab_link('group_name_info'); ?> |
|
34 | 34 | </label> |
35 | 35 | </th> |
36 | 36 | <td> |
@@ -42,14 +42,14 @@ discard block |
||
42 | 42 | <tr> |
43 | 43 | <th> |
44 | 44 | <label for="QSG_identifier"> |
45 | - <?php _e('Group Identifier','event_espresso');?> <?php echo EEH_Template::get_help_tab_link('group_identifier_info');?> |
|
45 | + <?php _e('Group Identifier', 'event_espresso'); ?> <?php echo EEH_Template::get_help_tab_link('group_identifier_info'); ?> |
|
46 | 46 | </label> |
47 | 47 | </th> |
48 | 48 | <td> |
49 | 49 | <input id="QSG_identifier" name="QSG_identifier<?php echo $id; ?>" value="<?php echo $question_group->identifier()?>" type="text" class="regular-text"<?php echo $disabled; ?>> |
50 | - <?php if ( ! empty( $QSG_system )) { ?> |
|
50 | + <?php if ( ! empty($QSG_system)) { ?> |
|
51 | 51 | <p><span class="description" style="color:#D54E21;"> |
52 | - <?php _e('System question group! This field cannot be changed.','event_espresso')?> |
|
52 | + <?php _e('System question group! This field cannot be changed.', 'event_espresso')?> |
|
53 | 53 | </span><br/></p> |
54 | 54 | <?php } ?> |
55 | 55 | |
@@ -58,7 +58,7 @@ discard block |
||
58 | 58 | <tr> |
59 | 59 | <th> |
60 | 60 | <label for="QSG_desc"> |
61 | - <?php _e('Description','event_espresso');?> <?php echo EEH_Template::get_help_tab_link('group_description_info');?> |
|
61 | + <?php _e('Description', 'event_espresso'); ?> <?php echo EEH_Template::get_help_tab_link('group_description_info'); ?> |
|
62 | 62 | </label> |
63 | 63 | </th> |
64 | 64 | <td> |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | <tr> |
70 | 70 | <th> |
71 | 71 | <label for="QSG_order"> |
72 | - <?php _e('Question Group Order','event_espresso');?> <?php echo EEH_Template::get_help_tab_link('group_order_info');?> |
|
72 | + <?php _e('Question Group Order', 'event_espresso'); ?> <?php echo EEH_Template::get_help_tab_link('group_order_info'); ?> |
|
73 | 73 | </label> |
74 | 74 | </th> |
75 | 75 | <td> |
@@ -80,13 +80,13 @@ discard block |
||
80 | 80 | <tr> |
81 | 81 | <th> |
82 | 82 | <label> |
83 | - <?php _e('Show Name','event_espresso');?> <?php echo EEH_Template::get_help_tab_link('show_group_name_info');?> |
|
83 | + <?php _e('Show Name', 'event_espresso'); ?> <?php echo EEH_Template::get_help_tab_link('show_group_name_info'); ?> |
|
84 | 84 | </label> |
85 | 85 | </th> |
86 | 86 | <td> |
87 | 87 | <label for="QSG_show_group_name"> |
88 | - <?php echo EEH_Form_Fields::select_input( 'QSG_show_group_name', $values, $question_group->show_group_name() ); ?> |
|
89 | - <p class="description"><?php _e('Show Group Name on Registration Page?','event_espresso');?></p> |
|
88 | + <?php echo EEH_Form_Fields::select_input('QSG_show_group_name', $values, $question_group->show_group_name()); ?> |
|
89 | + <p class="description"><?php _e('Show Group Name on Registration Page?', 'event_espresso'); ?></p> |
|
90 | 90 | </label> |
91 | 91 | </td> |
92 | 92 | </tr> |
@@ -94,13 +94,13 @@ discard block |
||
94 | 94 | <tr> |
95 | 95 | <th> |
96 | 96 | <label> |
97 | - <?php _e(' Show Description','event_espresso');?> <?php echo EEH_Template::get_help_tab_link('show_group_description_info');?> |
|
97 | + <?php _e(' Show Description', 'event_espresso'); ?> <?php echo EEH_Template::get_help_tab_link('show_group_description_info'); ?> |
|
98 | 98 | </label> |
99 | 99 | </th> |
100 | 100 | <td> |
101 | 101 | <label for="QSG_show_group_order"> |
102 | - <?php echo EEH_Form_Fields::select_input( 'QSG_show_group_desc', $values, $question_group->show_group_desc() ); ?> |
|
103 | - <p class="description"><?php _e(' Show Group Description on Registration Page?','event_espresso');?></p> |
|
102 | + <?php echo EEH_Form_Fields::select_input('QSG_show_group_desc', $values, $question_group->show_group_desc()); ?> |
|
103 | + <p class="description"><?php _e(' Show Group Description on Registration Page?', 'event_espresso'); ?></p> |
|
104 | 104 | </label> |
105 | 105 | <input type="hidden" name="QSG_system" value="<?php echo $question_group->system_group(); ?>"> |
106 | 106 | </td> |
@@ -111,8 +111,8 @@ discard block |
||
111 | 111 | </div> |
112 | 112 | |
113 | 113 | <div id="group-questions" class="edit-group padding question-group-questions-container postbox"> |
114 | - <div class="handlediv" title="<?php esc_attr_e( 'Click to toggle', 'event_espresso' ); ?>"><br></div> |
|
115 | - <h2 class="handle"><?php _e('Questions','event_espresso');?></h2> |
|
114 | + <div class="handlediv" title="<?php esc_attr_e('Click to toggle', 'event_espresso'); ?>"><br></div> |
|
115 | + <h2 class="handle"><?php _e('Questions', 'event_espresso'); ?></h2> |
|
116 | 116 | <div class="form-table question-group-questions inside"> |
117 | 117 | <div class="padding"> |
118 | 118 | <p><span class="description"><?php _e('Select which questions should be shown in this group by checking or unchecking boxes. You can drag and drop questions to reorder them. Your changes will be updated when you save.', 'event_espresso'); ?></span></p> |
@@ -121,26 +121,26 @@ discard block |
||
121 | 121 | <?php |
122 | 122 | $question_order = 0; |
123 | 123 | $question_group_questions = $question_group->questions(); |
124 | - foreach( $all_questions as $question_ID => $question ){ |
|
125 | - if ( $question instanceof EE_Question ) { |
|
124 | + foreach ($all_questions as $question_ID => $question) { |
|
125 | + if ($question instanceof EE_Question) { |
|
126 | 126 | /*@var $question EE_Question*/ |
127 | - $checked = isset( $question_group_questions[ $question_ID ] ) ? ' checked="checked"' : ''; |
|
127 | + $checked = isset($question_group_questions[$question_ID]) ? ' checked="checked"' : ''; |
|
128 | 128 | // disable questions from the personal information question group |
129 | 129 | // is it required in the current question group? if so don't allow admins to remove it |
130 | - $disabled = in_array( $question->system_ID(), EEM_Question::instance()->required_system_questions_in_system_question_group( $QSG_system ) ) ? 'disabled="disabled"' : ''; |
|
130 | + $disabled = in_array($question->system_ID(), EEM_Question::instance()->required_system_questions_in_system_question_group($QSG_system)) ? 'disabled="disabled"' : ''; |
|
131 | 131 | //limit where system questions can appear |
132 | 132 | if ( |
133 | 133 | $question->system_ID() && |
134 | - ! in_array( $question->system_ID(), EEM_Question::instance()->allowed_system_questions_in_system_question_group( $QSG_system ) ) |
|
134 | + ! in_array($question->system_ID(), EEM_Question::instance()->allowed_system_questions_in_system_question_group($QSG_system)) |
|
135 | 135 | ) { |
136 | 136 | continue; //skip over system question not assigned to this group except for the address system group cause we want the address questions to display even if they aren't selected (but still not show the personal system questions). The third condition checks if we're displaying a non system question group and the question is a system question, then we skip because for non-system question groups we only want to show non-system questions. |
137 | 137 | } |
138 | 138 | ?> |
139 | 139 | <li class="ee-question-sortable"> |
140 | 140 | <label for="question-<?php echo $question_ID?>"> |
141 | - <input type="checkbox" name="questions[<?php echo $question_ID;?>]" id="question-<?php echo $question_ID; ?>" value="<?php echo $question_ID;?>"<?php echo $disabled; ?><?php echo $checked; ?>/> |
|
141 | + <input type="checkbox" name="questions[<?php echo $question_ID; ?>]" id="question-<?php echo $question_ID; ?>" value="<?php echo $question_ID; ?>"<?php echo $disabled; ?><?php echo $checked; ?>/> |
|
142 | 142 | <span class="question-text"> |
143 | - <?php echo trim( $question->display_text() ) . ( 95 <= strlen( trim( $question->display_text() ) ) ? "…" : '' ); ?> |
|
143 | + <?php echo trim($question->display_text()).(95 <= strlen(trim($question->display_text())) ? "…" : ''); ?> |
|
144 | 144 | </span> |
145 | 145 | <input class="question-group-QGQ_order" type="hidden" name="question_orders[<?php echo $question_ID; ?>]" value="<?php echo $question_order; ?>"> |
146 | 146 | </label> |
@@ -1,22 +1,22 @@ |
||
1 | 1 | <?php |
2 | 2 | //required variables for template: |
3 | 3 | assert($question_group instanceof EE_Question_Group); |
4 | -assert(isset($all_questions) && (empty($all_questions) || is_array($all_questions)));//list of unused questions |
|
5 | -foreach($all_questions as $question_option){ |
|
4 | +assert(isset($all_questions) && (empty($all_questions) || is_array($all_questions))); //list of unused questions |
|
5 | +foreach ($all_questions as $question_option) { |
|
6 | 6 | assert($question_option); |
7 | 7 | assert($question_option instanceof EE_Question); |
8 | 8 | } |
9 | 9 | ?> |
10 | -<h4><?php _e('Check off all questions that you wish to appear in this group.','event_espresso');?></h4> |
|
10 | +<h4><?php _e('Check off all questions that you wish to appear in this group.', 'event_espresso'); ?></h4> |
|
11 | 11 | <ul> |
12 | 12 | <?php |
13 | - foreach( $all_questions as $question_ID=>$question ){ |
|
13 | + foreach ($all_questions as $question_ID=>$question) { |
|
14 | 14 | /*@var $question EE_Question*/ |
15 | - $checked = array_key_exists( $question_ID, $question_group->questions() ) ? ' checked="checked"' : ''; |
|
15 | + $checked = array_key_exists($question_ID, $question_group->questions()) ? ' checked="checked"' : ''; |
|
16 | 16 | ?> |
17 | 17 | <li> |
18 | 18 | <label for="question-<?php echo $question_ID?>"> |
19 | - <input type="checkbox" name="questions[<?php echo $question_ID;?>]" id="question-<?php echo $question_ID;?>" value="<?php echo $question_ID;?>"<?php echo $checked;?>/> |
|
19 | + <input type="checkbox" name="questions[<?php echo $question_ID; ?>]" id="question-<?php echo $question_ID; ?>" value="<?php echo $question_ID; ?>"<?php echo $checked; ?>/> |
|
20 | 20 | <?php echo $question->display_text()?> |
21 | 21 | </label> |
22 | 22 | </li> |
@@ -1,3 +1,3 @@ |
||
1 | 1 | <div class="padding"> |
2 | - <?php do_action( 'AHEE__Extend_Registration_Form_Admin_Page___reg_form_settings_template' ); ?> |
|
2 | + <?php do_action('AHEE__Extend_Registration_Form_Admin_Page___reg_form_settings_template'); ?> |
|
3 | 3 | </div> |
@@ -1,4 +1,6 @@ discard block |
||
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 | * |
@@ -123,8 +125,9 @@ discard block |
||
123 | 125 | } |
124 | 126 | |
125 | 127 | //if no reg id then get out cause need a reg id |
126 | - if ( empty( $REG_ID ) || empty( $DTT_ID ) ) |
|
127 | - throw new EE_Error(__('This route cannot be viewed unless registration and datetime IDs are included in the request (via REG_ID and DTT_ID parameters)', 'event_espresso') ); |
|
128 | + if ( empty( $REG_ID ) || empty( $DTT_ID ) ) { |
|
129 | + throw new EE_Error(__('This route cannot be viewed unless registration and datetime IDs are included in the request (via REG_ID and DTT_ID parameters)', 'event_espresso') ); |
|
130 | + } |
|
128 | 131 | |
129 | 132 | //set orderby |
130 | 133 | $orderby = 'CHK_timestamp'; //note that with this table we're only providing the option to orderby the timestamp value. |
@@ -147,8 +150,9 @@ discard block |
||
147 | 150 | $query_params = array( $_where, 'order_by' => array( $orderby => $order ), 'limit' => $limit ); |
148 | 151 | |
149 | 152 | //if no per_page value then we just want to return a count of all Check-ins |
150 | - if ( $count ) |
|
151 | - return EEM_Checkin::instance()->count( array( $_where ) ); |
|
153 | + if ( $count ) { |
|
154 | + return EEM_Checkin::instance()->count( array( $_where ) ); |
|
155 | + } |
|
152 | 156 | |
153 | 157 | return $count ? EEM_Checkin::instance()->count( array( $_where ) ) : EEM_Checkin::instance()->get_all($query_params); |
154 | 158 | } |
@@ -28,7 +28,7 @@ discard block |
||
28 | 28 | |
29 | 29 | |
30 | 30 | |
31 | - public function __construct( $admin_page ) { |
|
31 | + public function __construct($admin_page) { |
|
32 | 32 | parent::__construct($admin_page); |
33 | 33 | } |
34 | 34 | |
@@ -36,8 +36,8 @@ discard block |
||
36 | 36 | |
37 | 37 | |
38 | 38 | protected function _setup_data() { |
39 | - $this->_data = $this->_get_checkins( $this->_per_page ); |
|
40 | - $this->_all_data_count = $this->_get_checkins( $this->_per_page, TRUE ); |
|
39 | + $this->_data = $this->_get_checkins($this->_per_page); |
|
40 | + $this->_all_data_count = $this->_get_checkins($this->_per_page, TRUE); |
|
41 | 41 | } |
42 | 42 | |
43 | 43 | |
@@ -58,7 +58,7 @@ discard block |
||
58 | 58 | ); |
59 | 59 | |
60 | 60 | $this->_sortable_columns = array( |
61 | - 'CHK_timestamp' => array( 'CHK_timestamp' => TRUE ) |
|
61 | + 'CHK_timestamp' => array('CHK_timestamp' => TRUE) |
|
62 | 62 | ); |
63 | 63 | |
64 | 64 | $this->_primary_column = 'CHK_in'; |
@@ -82,25 +82,25 @@ discard block |
||
82 | 82 | } |
83 | 83 | |
84 | 84 | |
85 | - function column_cb($item ) { |
|
86 | - return sprintf( '<input type="checkbox" name="checkbox[%1$s]" />', $item->ID() ); |
|
85 | + function column_cb($item) { |
|
86 | + return sprintf('<input type="checkbox" name="checkbox[%1$s]" />', $item->ID()); |
|
87 | 87 | } |
88 | 88 | |
89 | 89 | |
90 | - function column_CHK_in( EE_Checkin $item ) { |
|
90 | + function column_CHK_in(EE_Checkin $item) { |
|
91 | 91 | $checkinstatus = $item->get('CHK_in'); |
92 | 92 | $checkinstatus = $checkinstatus ? EE_Registration::checkin_status_in : EE_Registration::checkin_status_out; |
93 | - return '<span class="checkin-icons checkedin-status-' . $checkinstatus . '"></span><span class="show-on-mobile-view-only">' . $item->get_datetime('CHK_timestamp') . '</span>'; |
|
93 | + return '<span class="checkin-icons checkedin-status-'.$checkinstatus.'"></span><span class="show-on-mobile-view-only">'.$item->get_datetime('CHK_timestamp').'</span>'; |
|
94 | 94 | } |
95 | 95 | |
96 | 96 | |
97 | 97 | |
98 | - function column_CHK_timestamp( EE_Checkin $item ) { |
|
98 | + function column_CHK_timestamp(EE_Checkin $item) { |
|
99 | 99 | $actions = array(); |
100 | - $delete_url = EE_Admin_Page::add_query_args_and_nonce( array('action' => 'delete_checkin_row', 'DTT_ID' => $this->_req_data['DTT_ID'], '_REGID' => $this->_req_data['_REGID'], 'CHK_ID' => $item->ID() ) ); |
|
101 | - $actions['delete_checkin'] = EE_Registry::instance()->CAP->current_user_can( 'ee_delete_checkins', 'espresso_registrations_delete_checkin_row' ) ? '<a href="' . $delete_url . '" title="' . esc_attr__('Click here to delete this check-in record', 'event_espresso') . '">' . __('Delete', 'event_espresso') . '</a>' : ''; |
|
100 | + $delete_url = EE_Admin_Page::add_query_args_and_nonce(array('action' => 'delete_checkin_row', 'DTT_ID' => $this->_req_data['DTT_ID'], '_REGID' => $this->_req_data['_REGID'], 'CHK_ID' => $item->ID())); |
|
101 | + $actions['delete_checkin'] = EE_Registry::instance()->CAP->current_user_can('ee_delete_checkins', 'espresso_registrations_delete_checkin_row') ? '<a href="'.$delete_url.'" title="'.esc_attr__('Click here to delete this check-in record', 'event_espresso').'">'.__('Delete', 'event_espresso').'</a>' : ''; |
|
102 | 102 | |
103 | - return sprintf( '%1$s %2$s', $item->get_datetime('CHK_timestamp'), $this->row_actions($actions) ); |
|
103 | + return sprintf('%1$s %2$s', $item->get_datetime('CHK_timestamp'), $this->row_actions($actions)); |
|
104 | 104 | } |
105 | 105 | |
106 | 106 | |
@@ -115,30 +115,30 @@ discard block |
||
115 | 115 | * @param bool $count Whether to return a count or not |
116 | 116 | * @return EE_Checkin[]|int |
117 | 117 | */ |
118 | - protected function _get_checkins( $per_page = 10, $count = FALSE ) { |
|
119 | - $REG_ID = isset( $this->_req_data['_REGID'] ) ? $this->_req_data['_REGID'] : FALSE; |
|
120 | - $DTT_ID = isset( $this->_req_data['DTT_ID'] ) ? $this->_req_data['DTT_ID'] : FALSE; |
|
118 | + protected function _get_checkins($per_page = 10, $count = FALSE) { |
|
119 | + $REG_ID = isset($this->_req_data['_REGID']) ? $this->_req_data['_REGID'] : FALSE; |
|
120 | + $DTT_ID = isset($this->_req_data['DTT_ID']) ? $this->_req_data['DTT_ID'] : FALSE; |
|
121 | 121 | |
122 | 122 | //if user does not have the capability for the checkins for this registration then get out! |
123 | - if ( ! EE_Registry::instance()->CAP->current_user_can( 'ee_read_checkin', 'espresso_registrations_registration_checkins', $REG_ID ) ) { |
|
123 | + if ( ! EE_Registry::instance()->CAP->current_user_can('ee_read_checkin', 'espresso_registrations_registration_checkins', $REG_ID)) { |
|
124 | 124 | return $count ? 0 : array(); |
125 | 125 | } |
126 | 126 | |
127 | 127 | //if no reg id then get out cause need a reg id |
128 | - if ( empty( $REG_ID ) || empty( $DTT_ID ) ) |
|
129 | - throw new EE_Error(__('This route cannot be viewed unless registration and datetime IDs are included in the request (via REG_ID and DTT_ID parameters)', 'event_espresso') ); |
|
128 | + if (empty($REG_ID) || empty($DTT_ID)) |
|
129 | + throw new EE_Error(__('This route cannot be viewed unless registration and datetime IDs are included in the request (via REG_ID and DTT_ID parameters)', 'event_espresso')); |
|
130 | 130 | |
131 | 131 | //set orderby |
132 | 132 | $orderby = 'CHK_timestamp'; //note that with this table we're only providing the option to orderby the timestamp value. |
133 | 133 | |
134 | - $order = !empty( $this->_req_data['order'] ) ? $this->_req_data['order'] : 'ASC'; |
|
134 | + $order = ! empty($this->_req_data['order']) ? $this->_req_data['order'] : 'ASC'; |
|
135 | 135 | |
136 | - $current_page = isset( $this->_req_data['paged'] ) && !empty( $this->_req_data['paged'] ) ? $this->_req_data['paged'] : 1; |
|
137 | - $per_page = isset( $this->_req_data['perpage'] ) && !empty( $this->_req_data['perpage'] ) ? $this->_req_data['perpage'] : $per_page; |
|
136 | + $current_page = isset($this->_req_data['paged']) && ! empty($this->_req_data['paged']) ? $this->_req_data['paged'] : 1; |
|
137 | + $per_page = isset($this->_req_data['perpage']) && ! empty($this->_req_data['perpage']) ? $this->_req_data['perpage'] : $per_page; |
|
138 | 138 | $limit = NULL; |
139 | - if ( !$count ) { |
|
140 | - $offset = ($current_page-1)*$per_page; |
|
141 | - $limit = array( $offset, $per_page ); |
|
139 | + if ( ! $count) { |
|
140 | + $offset = ($current_page - 1) * $per_page; |
|
141 | + $limit = array($offset, $per_page); |
|
142 | 142 | } |
143 | 143 | |
144 | 144 | $_where = array( |
@@ -146,13 +146,13 @@ discard block |
||
146 | 146 | 'DTT_ID' => $DTT_ID |
147 | 147 | ); |
148 | 148 | |
149 | - $query_params = array( $_where, 'order_by' => array( $orderby => $order ), 'limit' => $limit ); |
|
149 | + $query_params = array($_where, 'order_by' => array($orderby => $order), 'limit' => $limit); |
|
150 | 150 | |
151 | 151 | //if no per_page value then we just want to return a count of all Check-ins |
152 | - if ( $count ) |
|
153 | - return EEM_Checkin::instance()->count( array( $_where ) ); |
|
152 | + if ($count) |
|
153 | + return EEM_Checkin::instance()->count(array($_where)); |
|
154 | 154 | |
155 | - return $count ? EEM_Checkin::instance()->count( array( $_where ) ) : EEM_Checkin::instance()->get_all($query_params); |
|
155 | + return $count ? EEM_Checkin::instance()->count(array($_where)) : EEM_Checkin::instance()->get_all($query_params); |
|
156 | 156 | } |
157 | 157 | |
158 | 158 | } //end class EE_Registration_CheckIn_List_Table |