| @@ 239-266 (lines=28) @@ | ||
| 236 | * @return string |
|
| 237 | * @throws EE_Error |
|
| 238 | */ |
|
| 239 | public function get_messengers_select_input($messenger_options) |
|
| 240 | { |
|
| 241 | // if empty or just one value then just return an empty string |
|
| 242 | if (empty($messenger_options) |
|
| 243 | || ! is_array($messenger_options) |
|
| 244 | || count($messenger_options) === 1 |
|
| 245 | ) { |
|
| 246 | return ''; |
|
| 247 | } |
|
| 248 | // merge in default |
|
| 249 | $messenger_options = array_merge( |
|
| 250 | array('none_selected' => esc_html__('Show All Messengers', 'event_espresso')), |
|
| 251 | $messenger_options |
|
| 252 | ); |
|
| 253 | $input = new EE_Select_Input( |
|
| 254 | $messenger_options, |
|
| 255 | array( |
|
| 256 | 'html_name' => 'ee_messenger_filter_by', |
|
| 257 | 'html_id' => 'ee_messenger_filter_by', |
|
| 258 | 'html_class' => 'wide', |
|
| 259 | 'default' => isset($this->_req_data['ee_messenger_filter_by']) |
|
| 260 | ? sanitize_title($this->_req_data['ee_messenger_filter_by']) |
|
| 261 | : 'none_selected', |
|
| 262 | ) |
|
| 263 | ); |
|
| 264 | ||
| 265 | return $input->get_html_for_input(); |
|
| 266 | } |
|
| 267 | ||
| 268 | ||
| 269 | /** |
|
| @@ 277-304 (lines=28) @@ | ||
| 274 | * @return string |
|
| 275 | * @throws EE_Error |
|
| 276 | */ |
|
| 277 | public function get_message_types_select_input($message_type_options) |
|
| 278 | { |
|
| 279 | // if empty or count of options is 1 then just return an empty string |
|
| 280 | if (empty($message_type_options) |
|
| 281 | || ! is_array($message_type_options) |
|
| 282 | || count($message_type_options) === 1 |
|
| 283 | ) { |
|
| 284 | return ''; |
|
| 285 | } |
|
| 286 | // merge in default |
|
| 287 | $message_type_options = array_merge( |
|
| 288 | array('none_selected' => esc_html__('Show All Message Types', 'event_espresso')), |
|
| 289 | $message_type_options |
|
| 290 | ); |
|
| 291 | $input = new EE_Select_Input( |
|
| 292 | $message_type_options, |
|
| 293 | array( |
|
| 294 | 'html_name' => 'ee_message_type_filter_by', |
|
| 295 | 'html_id' => 'ee_message_type_filter_by', |
|
| 296 | 'html_class' => 'wide', |
|
| 297 | 'default' => isset($this->_req_data['ee_message_type_filter_by']) |
|
| 298 | ? sanitize_title($this->_req_data['ee_message_type_filter_by']) |
|
| 299 | : 'none_selected', |
|
| 300 | ) |
|
| 301 | ); |
|
| 302 | ||
| 303 | return $input->get_html_for_input(); |
|
| 304 | } |
|
| 305 | ||
| 306 | ||
| 307 | /** |
|
| @@ 315-342 (lines=28) @@ | ||
| 312 | * @return string |
|
| 313 | * @throws EE_Error |
|
| 314 | */ |
|
| 315 | public function get_contexts_for_message_types_select_input($context_options) |
|
| 316 | { |
|
| 317 | // if empty or count of options is one then just return empty string |
|
| 318 | if (empty($context_options) |
|
| 319 | || ! is_array($context_options) |
|
| 320 | || count($context_options) === 1 |
|
| 321 | ) { |
|
| 322 | return ''; |
|
| 323 | } |
|
| 324 | // merge in default |
|
| 325 | $context_options = array_merge( |
|
| 326 | array('none_selected' => esc_html__('Show all Contexts', 'event_espresso')), |
|
| 327 | $context_options |
|
| 328 | ); |
|
| 329 | $input = new EE_Select_Input( |
|
| 330 | $context_options, |
|
| 331 | array( |
|
| 332 | 'html_name' => 'ee_context_filter_by', |
|
| 333 | 'html_id' => 'ee_context_filter_by', |
|
| 334 | 'html_class' => 'wide', |
|
| 335 | 'default' => isset($this->_req_data['ee_context_filter_by']) |
|
| 336 | ? sanitize_title($this->_req_data['ee_context_filter_by']) |
|
| 337 | : 'none_selected', |
|
| 338 | ) |
|
| 339 | ); |
|
| 340 | ||
| 341 | return $input->get_html_for_input(); |
|
| 342 | } |
|
| 343 | ||
| 344 | ||
| 345 | protected function _ajax_hooks() |
|