@@ -57,7 +57,7 @@ |
||
| 57 | 57 | public function getCapCheck() |
| 58 | 58 | { |
| 59 | 59 | // need cap for non-AJAX admin requests |
| 60 | - if (! (defined('DOING_AJAX') && DOING_AJAX) && is_admin()) { |
|
| 60 | + if ( ! (defined('DOING_AJAX') && DOING_AJAX) && is_admin()) { |
|
| 61 | 61 | // there's no specific caps for editing/creating transactions, |
| 62 | 62 | // so that's why we are using ee_edit_registrations |
| 63 | 63 | return new CapCheck('ee_edit_registrations', 'create_new_transaction'); |
@@ -20,60 +20,60 @@ |
||
| 20 | 20 | class CreateTransactionCommand extends Command implements CommandRequiresCapCheckInterface |
| 21 | 21 | { |
| 22 | 22 | |
| 23 | - /** |
|
| 24 | - * @var EE_Checkout $checkout |
|
| 25 | - */ |
|
| 26 | - protected $checkout; |
|
| 23 | + /** |
|
| 24 | + * @var EE_Checkout $checkout |
|
| 25 | + */ |
|
| 26 | + protected $checkout; |
|
| 27 | 27 | |
| 28 | - /** |
|
| 29 | - * @var array $transaction_details |
|
| 30 | - */ |
|
| 31 | - protected $transaction_details; |
|
| 28 | + /** |
|
| 29 | + * @var array $transaction_details |
|
| 30 | + */ |
|
| 31 | + protected $transaction_details; |
|
| 32 | 32 | |
| 33 | 33 | |
| 34 | - /** |
|
| 35 | - * CreateTransactionCommand constructor. |
|
| 36 | - * |
|
| 37 | - * @param EE_Checkout $checkout |
|
| 38 | - * @param array $transaction_details |
|
| 39 | - */ |
|
| 40 | - public function __construct(EE_Checkout $checkout = null, array $transaction_details = array()) |
|
| 41 | - { |
|
| 42 | - $this->checkout = $checkout; |
|
| 43 | - $this->transaction_details = $transaction_details; |
|
| 44 | - } |
|
| 34 | + /** |
|
| 35 | + * CreateTransactionCommand constructor. |
|
| 36 | + * |
|
| 37 | + * @param EE_Checkout $checkout |
|
| 38 | + * @param array $transaction_details |
|
| 39 | + */ |
|
| 40 | + public function __construct(EE_Checkout $checkout = null, array $transaction_details = array()) |
|
| 41 | + { |
|
| 42 | + $this->checkout = $checkout; |
|
| 43 | + $this->transaction_details = $transaction_details; |
|
| 44 | + } |
|
| 45 | 45 | |
| 46 | 46 | |
| 47 | - /** |
|
| 48 | - * @return CapCheckInterface |
|
| 49 | - * @throws InvalidDataTypeException |
|
| 50 | - */ |
|
| 51 | - public function getCapCheck() |
|
| 52 | - { |
|
| 53 | - // need cap for non-AJAX admin requests |
|
| 54 | - if (! (defined('DOING_AJAX') && DOING_AJAX) && is_admin()) { |
|
| 55 | - // there's no specific caps for editing/creating transactions, |
|
| 56 | - // so that's why we are using ee_edit_registrations |
|
| 57 | - return new CapCheck('ee_edit_registrations', 'create_new_transaction'); |
|
| 58 | - } |
|
| 59 | - return new PublicCapabilities('', 'create_new_transaction'); |
|
| 60 | - } |
|
| 47 | + /** |
|
| 48 | + * @return CapCheckInterface |
|
| 49 | + * @throws InvalidDataTypeException |
|
| 50 | + */ |
|
| 51 | + public function getCapCheck() |
|
| 52 | + { |
|
| 53 | + // need cap for non-AJAX admin requests |
|
| 54 | + if (! (defined('DOING_AJAX') && DOING_AJAX) && is_admin()) { |
|
| 55 | + // there's no specific caps for editing/creating transactions, |
|
| 56 | + // so that's why we are using ee_edit_registrations |
|
| 57 | + return new CapCheck('ee_edit_registrations', 'create_new_transaction'); |
|
| 58 | + } |
|
| 59 | + return new PublicCapabilities('', 'create_new_transaction'); |
|
| 60 | + } |
|
| 61 | 61 | |
| 62 | 62 | |
| 63 | - /** |
|
| 64 | - * @return EE_Checkout |
|
| 65 | - */ |
|
| 66 | - public function checkout() |
|
| 67 | - { |
|
| 68 | - return $this->checkout; |
|
| 69 | - } |
|
| 63 | + /** |
|
| 64 | + * @return EE_Checkout |
|
| 65 | + */ |
|
| 66 | + public function checkout() |
|
| 67 | + { |
|
| 68 | + return $this->checkout; |
|
| 69 | + } |
|
| 70 | 70 | |
| 71 | 71 | |
| 72 | - /** |
|
| 73 | - * @return array |
|
| 74 | - */ |
|
| 75 | - public function transactionDetails() |
|
| 76 | - { |
|
| 77 | - return $this->transaction_details; |
|
| 78 | - } |
|
| 72 | + /** |
|
| 73 | + * @return array |
|
| 74 | + */ |
|
| 75 | + public function transactionDetails() |
|
| 76 | + { |
|
| 77 | + return $this->transaction_details; |
|
| 78 | + } |
|
| 79 | 79 | } |
@@ -81,7 +81,7 @@ |
||
| 81 | 81 | public function getCapCheck() |
| 82 | 82 | { |
| 83 | 83 | // need cap for non-AJAX admin requests |
| 84 | - if (! (defined('DOING_AJAX') && DOING_AJAX) && is_admin()) { |
|
| 84 | + if ( ! (defined('DOING_AJAX') && DOING_AJAX) && is_admin()) { |
|
| 85 | 85 | return new CapCheck('ee_edit_contacts', 'create_new_contact'); |
| 86 | 86 | } |
| 87 | 87 | return new PublicCapabilities('', 'create_new_contact'); |
@@ -20,62 +20,62 @@ |
||
| 20 | 20 | class CreateAttendeeCommand extends Command implements CommandRequiresCapCheckInterface |
| 21 | 21 | { |
| 22 | 22 | |
| 23 | - /** |
|
| 24 | - * array of details where keys are names of EEM_Attendee model fields |
|
| 25 | - * |
|
| 26 | - * @var array $attendee_details |
|
| 27 | - */ |
|
| 28 | - protected $attendee_details; |
|
| 23 | + /** |
|
| 24 | + * array of details where keys are names of EEM_Attendee model fields |
|
| 25 | + * |
|
| 26 | + * @var array $attendee_details |
|
| 27 | + */ |
|
| 28 | + protected $attendee_details; |
|
| 29 | 29 | |
| 30 | - /** |
|
| 31 | - * an existing registration to associate this attendee with |
|
| 32 | - * |
|
| 33 | - * @var EE_Registration $registration |
|
| 34 | - */ |
|
| 35 | - protected $registration; |
|
| 30 | + /** |
|
| 31 | + * an existing registration to associate this attendee with |
|
| 32 | + * |
|
| 33 | + * @var EE_Registration $registration |
|
| 34 | + */ |
|
| 35 | + protected $registration; |
|
| 36 | 36 | |
| 37 | 37 | |
| 38 | - /** |
|
| 39 | - * CreateAttendeeCommand constructor. |
|
| 40 | - * |
|
| 41 | - * @param array $attendee_details |
|
| 42 | - * @param EE_Registration $registration |
|
| 43 | - */ |
|
| 44 | - public function __construct(array $attendee_details, EE_Registration $registration) |
|
| 45 | - { |
|
| 46 | - $this->attendee_details = $attendee_details; |
|
| 47 | - $this->registration = $registration; |
|
| 48 | - } |
|
| 38 | + /** |
|
| 39 | + * CreateAttendeeCommand constructor. |
|
| 40 | + * |
|
| 41 | + * @param array $attendee_details |
|
| 42 | + * @param EE_Registration $registration |
|
| 43 | + */ |
|
| 44 | + public function __construct(array $attendee_details, EE_Registration $registration) |
|
| 45 | + { |
|
| 46 | + $this->attendee_details = $attendee_details; |
|
| 47 | + $this->registration = $registration; |
|
| 48 | + } |
|
| 49 | 49 | |
| 50 | 50 | |
| 51 | - /** |
|
| 52 | - * @return array |
|
| 53 | - */ |
|
| 54 | - public function attendeeDetails() |
|
| 55 | - { |
|
| 56 | - return $this->attendee_details; |
|
| 57 | - } |
|
| 51 | + /** |
|
| 52 | + * @return array |
|
| 53 | + */ |
|
| 54 | + public function attendeeDetails() |
|
| 55 | + { |
|
| 56 | + return $this->attendee_details; |
|
| 57 | + } |
|
| 58 | 58 | |
| 59 | 59 | |
| 60 | - /** |
|
| 61 | - * @return EE_Registration |
|
| 62 | - */ |
|
| 63 | - public function registration() |
|
| 64 | - { |
|
| 65 | - return $this->registration; |
|
| 66 | - } |
|
| 60 | + /** |
|
| 61 | + * @return EE_Registration |
|
| 62 | + */ |
|
| 63 | + public function registration() |
|
| 64 | + { |
|
| 65 | + return $this->registration; |
|
| 66 | + } |
|
| 67 | 67 | |
| 68 | 68 | |
| 69 | - /** |
|
| 70 | - * @return CapCheckInterface |
|
| 71 | - * @throws InvalidDataTypeException |
|
| 72 | - */ |
|
| 73 | - public function getCapCheck() |
|
| 74 | - { |
|
| 75 | - // need cap for non-AJAX admin requests |
|
| 76 | - if (! (defined('DOING_AJAX') && DOING_AJAX) && is_admin()) { |
|
| 77 | - return new CapCheck('ee_edit_contacts', 'create_new_contact'); |
|
| 78 | - } |
|
| 79 | - return new PublicCapabilities('', 'create_new_contact'); |
|
| 80 | - } |
|
| 69 | + /** |
|
| 70 | + * @return CapCheckInterface |
|
| 71 | + * @throws InvalidDataTypeException |
|
| 72 | + */ |
|
| 73 | + public function getCapCheck() |
|
| 74 | + { |
|
| 75 | + // need cap for non-AJAX admin requests |
|
| 76 | + if (! (defined('DOING_AJAX') && DOING_AJAX) && is_admin()) { |
|
| 77 | + return new CapCheck('ee_edit_contacts', 'create_new_contact'); |
|
| 78 | + } |
|
| 79 | + return new PublicCapabilities('', 'create_new_contact'); |
|
| 80 | + } |
|
| 81 | 81 | } |
@@ -9,12 +9,12 @@ |
||
| 9 | 9 | interface EEI_Line_Item_Display |
| 10 | 10 | { |
| 11 | 11 | |
| 12 | - /** |
|
| 13 | - * @param EE_Line_Item $line_item |
|
| 14 | - * @param array $options |
|
| 15 | - * @return mixed |
|
| 16 | - */ |
|
| 17 | - public function display_line_item(EE_Line_Item $line_item, $options = array()); |
|
| 12 | + /** |
|
| 13 | + * @param EE_Line_Item $line_item |
|
| 14 | + * @param array $options |
|
| 15 | + * @return mixed |
|
| 16 | + */ |
|
| 17 | + public function display_line_item(EE_Line_Item $line_item, $options = array()); |
|
| 18 | 18 | |
| 19 | 19 | } |
| 20 | 20 | |
@@ -1,6 +1,6 @@ |
||
| 1 | 1 | <p> |
| 2 | 2 | <?php esc_html_e( |
| 3 | - 'Use this to control what the default will be for maximum tickets on an order when creating a new event.', |
|
| 4 | - 'event_espresso' |
|
| 5 | - ); ?> |
|
| 3 | + 'Use this to control what the default will be for maximum tickets on an order when creating a new event.', |
|
| 4 | + 'event_espresso' |
|
| 5 | + ); ?> |
|
| 6 | 6 | </p> |
| 7 | 7 | \ No newline at end of file |
@@ -43,7 +43,7 @@ |
||
| 43 | 43 | $error_string = esc_html__('The following errors occurred:', 'event_espresso'); |
| 44 | 44 | foreach ($notices->getError() as $notice) { |
| 45 | 45 | if ($this->getThrowExceptions()) { |
| 46 | - $error_string .= '<br />' . $notice->message(); |
|
| 46 | + $error_string .= '<br />'.$notice->message(); |
|
| 47 | 47 | } else { |
| 48 | 48 | EE_Error::add_error( |
| 49 | 49 | $notice->message(), |
@@ -19,56 +19,56 @@ |
||
| 19 | 19 | class ConvertNoticesToEeErrors extends NoticeConverter |
| 20 | 20 | { |
| 21 | 21 | |
| 22 | - /** |
|
| 23 | - * Converts Notice objects into EE_Error notifications |
|
| 24 | - * |
|
| 25 | - * @param NoticesContainerInterface $notices |
|
| 26 | - * @throws EE_Error |
|
| 27 | - */ |
|
| 28 | - public function process(NoticesContainerInterface $notices) |
|
| 29 | - { |
|
| 30 | - $this->setNotices($notices); |
|
| 31 | - $notices = $this->getNotices(); |
|
| 32 | - if ($notices->hasAttention()) { |
|
| 33 | - foreach ($notices->getAttention() as $notice) { |
|
| 34 | - EE_Error::add_attention( |
|
| 35 | - $notice->message(), |
|
| 36 | - $notice->file(), |
|
| 37 | - $notice->func(), |
|
| 38 | - $notice->line() |
|
| 39 | - ); |
|
| 40 | - } |
|
| 41 | - } |
|
| 42 | - if ($notices->hasError()) { |
|
| 43 | - $error_string = esc_html__('The following errors occurred:', 'event_espresso'); |
|
| 44 | - foreach ($notices->getError() as $notice) { |
|
| 45 | - if ($this->getThrowExceptions()) { |
|
| 46 | - $error_string .= '<br />' . $notice->message(); |
|
| 47 | - } else { |
|
| 48 | - EE_Error::add_error( |
|
| 49 | - $notice->message(), |
|
| 50 | - $notice->file(), |
|
| 51 | - $notice->func(), |
|
| 52 | - $notice->line() |
|
| 53 | - ); |
|
| 54 | - } |
|
| 55 | - } |
|
| 56 | - if ($this->getThrowExceptions()) { |
|
| 57 | - throw new EE_Error($error_string); |
|
| 58 | - } |
|
| 59 | - } |
|
| 60 | - if ($notices->hasSuccess()) { |
|
| 61 | - foreach ($notices->getSuccess() as $notice) { |
|
| 62 | - EE_Error::add_success( |
|
| 63 | - $notice->message(), |
|
| 64 | - $notice->file(), |
|
| 65 | - $notice->func(), |
|
| 66 | - $notice->line() |
|
| 67 | - ); |
|
| 68 | - } |
|
| 69 | - } |
|
| 70 | - $this->clearNotices(); |
|
| 71 | - } |
|
| 22 | + /** |
|
| 23 | + * Converts Notice objects into EE_Error notifications |
|
| 24 | + * |
|
| 25 | + * @param NoticesContainerInterface $notices |
|
| 26 | + * @throws EE_Error |
|
| 27 | + */ |
|
| 28 | + public function process(NoticesContainerInterface $notices) |
|
| 29 | + { |
|
| 30 | + $this->setNotices($notices); |
|
| 31 | + $notices = $this->getNotices(); |
|
| 32 | + if ($notices->hasAttention()) { |
|
| 33 | + foreach ($notices->getAttention() as $notice) { |
|
| 34 | + EE_Error::add_attention( |
|
| 35 | + $notice->message(), |
|
| 36 | + $notice->file(), |
|
| 37 | + $notice->func(), |
|
| 38 | + $notice->line() |
|
| 39 | + ); |
|
| 40 | + } |
|
| 41 | + } |
|
| 42 | + if ($notices->hasError()) { |
|
| 43 | + $error_string = esc_html__('The following errors occurred:', 'event_espresso'); |
|
| 44 | + foreach ($notices->getError() as $notice) { |
|
| 45 | + if ($this->getThrowExceptions()) { |
|
| 46 | + $error_string .= '<br />' . $notice->message(); |
|
| 47 | + } else { |
|
| 48 | + EE_Error::add_error( |
|
| 49 | + $notice->message(), |
|
| 50 | + $notice->file(), |
|
| 51 | + $notice->func(), |
|
| 52 | + $notice->line() |
|
| 53 | + ); |
|
| 54 | + } |
|
| 55 | + } |
|
| 56 | + if ($this->getThrowExceptions()) { |
|
| 57 | + throw new EE_Error($error_string); |
|
| 58 | + } |
|
| 59 | + } |
|
| 60 | + if ($notices->hasSuccess()) { |
|
| 61 | + foreach ($notices->getSuccess() as $notice) { |
|
| 62 | + EE_Error::add_success( |
|
| 63 | + $notice->message(), |
|
| 64 | + $notice->file(), |
|
| 65 | + $notice->func(), |
|
| 66 | + $notice->line() |
|
| 67 | + ); |
|
| 68 | + } |
|
| 69 | + } |
|
| 70 | + $this->clearNotices(); |
|
| 71 | + } |
|
| 72 | 72 | |
| 73 | 73 | |
| 74 | 74 | } |
@@ -11,48 +11,48 @@ |
||
| 11 | 11 | * @version 4+ |
| 12 | 12 | */ |
| 13 | 13 | if (have_posts()) : |
| 14 | - if (apply_filters('FHEE__archive_espresso_events_template__show_header', true)) : ?> |
|
| 14 | + if (apply_filters('FHEE__archive_espresso_events_template__show_header', true)) : ?> |
|
| 15 | 15 | <header class="page-header"> |
| 16 | 16 | <h1 class="page-title"> |
| 17 | 17 | <?php |
| 18 | - if (is_day()) : |
|
| 19 | - printf(__('Today\'s Events: %s', 'event_espresso'), get_the_date()); |
|
| 20 | - elseif (is_month()) : |
|
| 21 | - printf( |
|
| 22 | - __('Events This Month: %s', 'event_espresso'), |
|
| 23 | - get_the_date(_x('F Y', 'monthly archives date format', 'event_espresso')) |
|
| 24 | - ); |
|
| 25 | - elseif (is_year()) : |
|
| 26 | - printf( |
|
| 27 | - __('Events This Year: %s', 'event_espresso'), |
|
| 28 | - get_the_date(_x('Y', 'yearly archives date format', 'event_espresso')) |
|
| 29 | - ); |
|
| 30 | - else : |
|
| 31 | - echo apply_filters( |
|
| 32 | - 'FHEE__archive_espresso_events_template__upcoming_events_h1', |
|
| 33 | - __('Upcoming Events', 'event_espresso') |
|
| 34 | - ); |
|
| 35 | - endif; |
|
| 36 | - ?> |
|
| 18 | + if (is_day()) : |
|
| 19 | + printf(__('Today\'s Events: %s', 'event_espresso'), get_the_date()); |
|
| 20 | + elseif (is_month()) : |
|
| 21 | + printf( |
|
| 22 | + __('Events This Month: %s', 'event_espresso'), |
|
| 23 | + get_the_date(_x('F Y', 'monthly archives date format', 'event_espresso')) |
|
| 24 | + ); |
|
| 25 | + elseif (is_year()) : |
|
| 26 | + printf( |
|
| 27 | + __('Events This Year: %s', 'event_espresso'), |
|
| 28 | + get_the_date(_x('Y', 'yearly archives date format', 'event_espresso')) |
|
| 29 | + ); |
|
| 30 | + else : |
|
| 31 | + echo apply_filters( |
|
| 32 | + 'FHEE__archive_espresso_events_template__upcoming_events_h1', |
|
| 33 | + __('Upcoming Events', 'event_espresso') |
|
| 34 | + ); |
|
| 35 | + endif; |
|
| 36 | + ?> |
|
| 37 | 37 | </h1> |
| 38 | 38 | |
| 39 | 39 | </header><!-- .page-header --> |
| 40 | 40 | |
| 41 | 41 | <?php |
| 42 | - endif; |
|
| 43 | - // allow other stuff |
|
| 44 | - do_action('AHEE__archive_espresso_events_template__before_loop'); |
|
| 45 | - // Start the Loop. |
|
| 46 | - while (have_posts()) : the_post(); |
|
| 47 | - // Include the post TYPE-specific template for the content. |
|
| 48 | - espresso_get_template_part('content', 'espresso_events-shortcode'); |
|
| 49 | - endwhile; |
|
| 50 | - // Previous/next page navigation. |
|
| 51 | - espresso_pagination(); |
|
| 52 | - // allow moar other stuff |
|
| 53 | - do_action('AHEE__archive_espresso_events_template__after_loop'); |
|
| 42 | + endif; |
|
| 43 | + // allow other stuff |
|
| 44 | + do_action('AHEE__archive_espresso_events_template__before_loop'); |
|
| 45 | + // Start the Loop. |
|
| 46 | + while (have_posts()) : the_post(); |
|
| 47 | + // Include the post TYPE-specific template for the content. |
|
| 48 | + espresso_get_template_part('content', 'espresso_events-shortcode'); |
|
| 49 | + endwhile; |
|
| 50 | + // Previous/next page navigation. |
|
| 51 | + espresso_pagination(); |
|
| 52 | + // allow moar other stuff |
|
| 53 | + do_action('AHEE__archive_espresso_events_template__after_loop'); |
|
| 54 | 54 | else : |
| 55 | - // If no content, include the "No posts found" template. |
|
| 56 | - espresso_get_template_part('content', 'none'); |
|
| 55 | + // If no content, include the "No posts found" template. |
|
| 56 | + espresso_get_template_part('content', 'none'); |
|
| 57 | 57 | endif; |
| 58 | 58 | |
@@ -27,11 +27,13 @@ discard block |
||
| 27 | 27 | __('Events This Year: %s', 'event_espresso'), |
| 28 | 28 | get_the_date(_x('Y', 'yearly archives date format', 'event_espresso')) |
| 29 | 29 | ); |
| 30 | - else : |
|
| 30 | + else { |
|
| 31 | + : |
|
| 31 | 32 | echo apply_filters( |
| 32 | 33 | 'FHEE__archive_espresso_events_template__upcoming_events_h1', |
| 33 | 34 | __('Upcoming Events', 'event_espresso') |
| 34 | 35 | ); |
| 36 | + } |
|
| 35 | 37 | endif; |
| 36 | 38 | ?> |
| 37 | 39 | </h1> |
@@ -51,8 +53,10 @@ discard block |
||
| 51 | 53 | espresso_pagination(); |
| 52 | 54 | // allow moar other stuff |
| 53 | 55 | do_action('AHEE__archive_espresso_events_template__after_loop'); |
| 54 | -else : |
|
| 56 | +else { |
|
| 57 | + : |
|
| 55 | 58 | // If no content, include the "No posts found" template. |
| 56 | 59 | espresso_get_template_part('content', 'none'); |
| 60 | +} |
|
| 57 | 61 | endif; |
| 58 | 62 | |
@@ -12,23 +12,23 @@ |
||
| 12 | 12 | trait TicketSelector |
| 13 | 13 | { |
| 14 | 14 | |
| 15 | - /** |
|
| 16 | - * Use to select a quantity from the first ticket for the given event (so this can be used on a event archive page). |
|
| 17 | - * @param int|string $event_id |
|
| 18 | - * @param int|string $quantity |
|
| 19 | - */ |
|
| 20 | - public function selectQuantityOfFirstTicketForEventId($event_id, $quantity = 1) |
|
| 21 | - { |
|
| 22 | - $this->actor()->selectOption(TicketSelectorElements::ticketOptionByEventIdSelector($event_id), $quantity); |
|
| 23 | - } |
|
| 15 | + /** |
|
| 16 | + * Use to select a quantity from the first ticket for the given event (so this can be used on a event archive page). |
|
| 17 | + * @param int|string $event_id |
|
| 18 | + * @param int|string $quantity |
|
| 19 | + */ |
|
| 20 | + public function selectQuantityOfFirstTicketForEventId($event_id, $quantity = 1) |
|
| 21 | + { |
|
| 22 | + $this->actor()->selectOption(TicketSelectorElements::ticketOptionByEventIdSelector($event_id), $quantity); |
|
| 23 | + } |
|
| 24 | 24 | |
| 25 | 25 | |
| 26 | - /** |
|
| 27 | - * Used to submit the ticket selection for the given event id (so this can be used on an event archive page). |
|
| 28 | - * @param int|string $event_id |
|
| 29 | - */ |
|
| 30 | - public function submitTicketSelectionsForEventId($event_id) |
|
| 31 | - { |
|
| 32 | - $this->actor()->click(TicketSelectorElements::ticketSelectionSubmitSelectorByEventId($event_id)); |
|
| 33 | - } |
|
| 26 | + /** |
|
| 27 | + * Used to submit the ticket selection for the given event id (so this can be used on an event archive page). |
|
| 28 | + * @param int|string $event_id |
|
| 29 | + */ |
|
| 30 | + public function submitTicketSelectionsForEventId($event_id) |
|
| 31 | + { |
|
| 32 | + $this->actor()->click(TicketSelectorElements::ticketSelectionSubmitSelectorByEventId($event_id)); |
|
| 33 | + } |
|
| 34 | 34 | } |
| 35 | 35 | \ No newline at end of file |
@@ -103,8 +103,8 @@ |
||
| 103 | 103 | public static function editMessageTemplateClassByMessageType($message_type_slug, $context = '') |
| 104 | 104 | { |
| 105 | 105 | return $context |
| 106 | - ? '.' . $message_type_slug . '-' . $context . '-edit-link' |
|
| 107 | - : '.' . $message_type_slug . '-edit-link'; |
|
| 106 | + ? '.'.$message_type_slug.'-'.$context.'-edit-link' |
|
| 107 | + : '.'.$message_type_slug.'-edit-link'; |
|
| 108 | 108 | } |
| 109 | 109 | |
| 110 | 110 | |
@@ -14,292 +14,292 @@ |
||
| 14 | 14 | class MessagesAdmin extends CoreAdmin |
| 15 | 15 | { |
| 16 | 16 | |
| 17 | - /** |
|
| 18 | - * Context slug for the admin messages context. |
|
| 19 | - */ |
|
| 20 | - const ADMIN_CONTEXT_SLUG = 'admin'; |
|
| 17 | + /** |
|
| 18 | + * Context slug for the admin messages context. |
|
| 19 | + */ |
|
| 20 | + const ADMIN_CONTEXT_SLUG = 'admin'; |
|
| 21 | 21 | |
| 22 | - /** |
|
| 23 | - * Context slug for the primary attendee messages context |
|
| 24 | - */ |
|
| 25 | - const PRIMARY_ATTENDEE_CONTEXT_SLUG = 'primary_attendee'; |
|
| 22 | + /** |
|
| 23 | + * Context slug for the primary attendee messages context |
|
| 24 | + */ |
|
| 25 | + const PRIMARY_ATTENDEE_CONTEXT_SLUG = 'primary_attendee'; |
|
| 26 | 26 | |
| 27 | 27 | |
| 28 | - /** |
|
| 29 | - * Context slug for the attendee messages context |
|
| 30 | - */ |
|
| 31 | - const ATTENDEE_CONTEXT_SLUG = 'attendee'; |
|
| 28 | + /** |
|
| 29 | + * Context slug for the attendee messages context |
|
| 30 | + */ |
|
| 31 | + const ATTENDEE_CONTEXT_SLUG = 'attendee'; |
|
| 32 | 32 | |
| 33 | 33 | |
| 34 | - /** |
|
| 35 | - * Status reference for the EEM_Message::status_sent status. |
|
| 36 | - */ |
|
| 37 | - const MESSAGE_STATUS_SENT = 'MSN'; |
|
| 34 | + /** |
|
| 35 | + * Status reference for the EEM_Message::status_sent status. |
|
| 36 | + */ |
|
| 37 | + const MESSAGE_STATUS_SENT = 'MSN'; |
|
| 38 | 38 | |
| 39 | 39 | |
| 40 | - /** |
|
| 41 | - * Message type slug for the Payment Failed message type |
|
| 42 | - */ |
|
| 43 | - const PAYMENT_FAILED_MESSAGE_TYPE_SLUG = 'payment_failed'; |
|
| 40 | + /** |
|
| 41 | + * Message type slug for the Payment Failed message type |
|
| 42 | + */ |
|
| 43 | + const PAYMENT_FAILED_MESSAGE_TYPE_SLUG = 'payment_failed'; |
|
| 44 | 44 | |
| 45 | 45 | |
| 46 | - /** |
|
| 47 | - * Message type slug for the Registration Pending Payment message type |
|
| 48 | - */ |
|
| 49 | - const MESSAGE_TYPE_PENDING_PAYMENT = 'pending_approval'; |
|
| 46 | + /** |
|
| 47 | + * Message type slug for the Registration Pending Payment message type |
|
| 48 | + */ |
|
| 49 | + const MESSAGE_TYPE_PENDING_PAYMENT = 'pending_approval'; |
|
| 50 | 50 | |
| 51 | 51 | |
| 52 | - /** |
|
| 53 | - * Selector for the Global Messages "Send on same request" field in the Messages Settings tab. |
|
| 54 | - */ |
|
| 55 | - const GLOBAL_MESSAGES_SETTINGS_ON_REQUEST_SELECTION_SELECTOR = |
|
| 56 | - '#global_messages_settings-do-messages-on-same-request'; |
|
| 52 | + /** |
|
| 53 | + * Selector for the Global Messages "Send on same request" field in the Messages Settings tab. |
|
| 54 | + */ |
|
| 55 | + const GLOBAL_MESSAGES_SETTINGS_ON_REQUEST_SELECTION_SELECTOR = |
|
| 56 | + '#global_messages_settings-do-messages-on-same-request'; |
|
| 57 | 57 | |
| 58 | 58 | |
| 59 | - /** |
|
| 60 | - * Selector for the Global Messages Settings submit button in the Messages Settings tab. |
|
| 61 | - */ |
|
| 62 | - const GLOBAL_MESSAGES_SETTINGS_SUBMIT_SELECTOR = '#global_messages_settings-update-settings-submit'; |
|
| 59 | + /** |
|
| 60 | + * Selector for the Global Messages Settings submit button in the Messages Settings tab. |
|
| 61 | + */ |
|
| 62 | + const GLOBAL_MESSAGES_SETTINGS_SUBMIT_SELECTOR = '#global_messages_settings-update-settings-submit'; |
|
| 63 | 63 | |
| 64 | 64 | |
| 65 | - /** |
|
| 66 | - * This is the container where active message types for a messenger are found/dragged to. |
|
| 67 | - */ |
|
| 68 | - const MESSAGES_SETTINGS_ACTIVE_MESSAGE_TYPES_CONTAINER_SELECTOR = '#active-message-types'; |
|
| 65 | + /** |
|
| 66 | + * This is the container where active message types for a messenger are found/dragged to. |
|
| 67 | + */ |
|
| 68 | + const MESSAGES_SETTINGS_ACTIVE_MESSAGE_TYPES_CONTAINER_SELECTOR = '#active-message-types'; |
|
| 69 | 69 | |
| 70 | 70 | |
| 71 | - /** |
|
| 72 | - * Locator for the context switcher selector on the Message Template Editor page. |
|
| 73 | - */ |
|
| 74 | - const MESSAGES_CONTEXT_SWITCHER_SELECTOR = "//form[@id='ee-msg-context-switcher-frm']/select"; |
|
| 71 | + /** |
|
| 72 | + * Locator for the context switcher selector on the Message Template Editor page. |
|
| 73 | + */ |
|
| 74 | + const MESSAGES_CONTEXT_SWITCHER_SELECTOR = "//form[@id='ee-msg-context-switcher-frm']/select"; |
|
| 75 | 75 | |
| 76 | 76 | |
| 77 | - /** |
|
| 78 | - * Locator for the context switcher submit button in the Message Template Editor page. |
|
| 79 | - */ |
|
| 80 | - const MESSAGES_CONTEXT_SWITCHER_BUTTON_SELECTOR = "#submit-msg-context-switcher-sbmt"; |
|
| 77 | + /** |
|
| 78 | + * Locator for the context switcher submit button in the Message Template Editor page. |
|
| 79 | + */ |
|
| 80 | + const MESSAGES_CONTEXT_SWITCHER_BUTTON_SELECTOR = "#submit-msg-context-switcher-sbmt"; |
|
| 81 | 81 | |
| 82 | 82 | |
| 83 | - /** |
|
| 84 | - * Locator for the dialog container used for housing viewed messages in the message activity list table. |
|
| 85 | - */ |
|
| 86 | - const MESSAGES_LIST_TABLE_VIEW_MESSAGE_DIALOG_CONTAINER_SELECTOR = '.ee-admin-dialog-container-inner-content'; |
|
| 87 | - |
|
| 88 | - |
|
| 89 | - /** |
|
| 90 | - * Returns the selector for the on/off toggle for context on the message template editor. |
|
| 91 | - */ |
|
| 92 | - const MESSAGES_CONTEXT_ACTIVE_STATE_TOGGLE = |
|
| 93 | - "//div[@class='activate_context_on_off_toggle_container']/div[@class='switch']/label"; |
|
| 94 | - |
|
| 95 | - |
|
| 96 | - const SELECTOR_LINK_FINALIZE_PAYMENT_PENDING_PAYMENT_MESSAGE = "//td/p[@class='callout']/a"; |
|
| 97 | - |
|
| 98 | - |
|
| 99 | - |
|
| 100 | - /** |
|
| 101 | - * @param string $additional_params Any additional request parameters for the generated url should be included as |
|
| 102 | - * a string. |
|
| 103 | - * @return string |
|
| 104 | - */ |
|
| 105 | - public static function messageActivityListTableUrl($additional_params = '') |
|
| 106 | - { |
|
| 107 | - return self::adminUrl('espresso_messages', 'default', $additional_params); |
|
| 108 | - } |
|
| 109 | - |
|
| 110 | - |
|
| 111 | - /** |
|
| 112 | - * @param string $additional_params Any additional request parameters for the generated url should be included as |
|
| 113 | - * a string. |
|
| 114 | - * @return string |
|
| 115 | - */ |
|
| 116 | - public static function defaultMessageTemplateListTableUrl($additional_params = '') |
|
| 117 | - { |
|
| 118 | - return self::adminUrl('espresso_messages', 'global_mtps', $additional_params); |
|
| 119 | - } |
|
| 120 | - |
|
| 121 | - |
|
| 122 | - /** |
|
| 123 | - * @param string $additional_params Any additional request parameters for the generated url should be included as |
|
| 124 | - * a string. |
|
| 125 | - * @return string |
|
| 126 | - */ |
|
| 127 | - public static function customMessageTemplateListTableUrl($additional_params = '') |
|
| 128 | - { |
|
| 129 | - return self::adminUrl('espresso_messages', 'custom_mtps', $additional_params); |
|
| 130 | - } |
|
| 131 | - |
|
| 132 | - |
|
| 133 | - /** |
|
| 134 | - * @return string |
|
| 135 | - */ |
|
| 136 | - public static function messageSettingsUrl() |
|
| 137 | - { |
|
| 138 | - return self::adminUrl('espresso_messages', 'settings'); |
|
| 139 | - } |
|
| 140 | - |
|
| 141 | - |
|
| 142 | - |
|
| 143 | - public static function draggableSettingsBoxSelectorForMessageTypeAndMessenger( |
|
| 144 | - $message_type_slug, |
|
| 145 | - $messenger_slug = 'email' |
|
| 146 | - ) { |
|
| 147 | - return "#$message_type_slug-messagetype-$messenger_slug"; |
|
| 148 | - } |
|
| 149 | - |
|
| 150 | - |
|
| 151 | - /** |
|
| 152 | - * @param string $message_type_slug |
|
| 153 | - * @param string $context |
|
| 154 | - * @return string |
|
| 155 | - */ |
|
| 156 | - public static function editMessageTemplateClassByMessageType($message_type_slug, $context = '') |
|
| 157 | - { |
|
| 158 | - return $context |
|
| 159 | - ? '.' . $message_type_slug . '-' . $context . '-edit-link' |
|
| 160 | - : '.' . $message_type_slug . '-edit-link'; |
|
| 161 | - } |
|
| 162 | - |
|
| 163 | - |
|
| 164 | - /** |
|
| 165 | - * Selector for (a) specific table cell(s) in the Messages Activity list table for the given parameters. |
|
| 166 | - * |
|
| 167 | - * @param $field |
|
| 168 | - * @param $message_type_label |
|
| 169 | - * @param string $message_status |
|
| 170 | - * @param string $messenger |
|
| 171 | - * @param string $context |
|
| 172 | - * @param string $table_cell_content_for_field |
|
| 173 | - * @param int $number_in_set It's possible that the given parameters could match multiple items in the view. |
|
| 174 | - * This allows you to indicate which item from the set to match. If this is set to 0 |
|
| 175 | - * then all matches for the locator will be returned. |
|
| 176 | - * @return string |
|
| 177 | - * @throws \InvalidArgumentException |
|
| 178 | - */ |
|
| 179 | - public static function messagesActivityListTableCellSelectorFor( |
|
| 180 | - $field, |
|
| 181 | - $message_type_label, |
|
| 182 | - $message_status = self::MESSAGE_STATUS_SENT, |
|
| 183 | - $messenger = 'Email', |
|
| 184 | - $context = 'Event Admin', |
|
| 185 | - $table_cell_content_for_field = '', |
|
| 186 | - $number_in_set = 1 |
|
| 187 | - ) { |
|
| 188 | - $selector = "//tbody[@id='the-list']"; |
|
| 189 | - $selector .= "//tr[contains(@class, 'msg-status-$message_status')]" |
|
| 190 | - . "//td[contains(@class, 'message_type') and text()='$message_type_label']"; |
|
| 191 | - if ($messenger) { |
|
| 192 | - $selector .= "/ancestor::tr/td[contains(@class, 'messenger') and text()='$messenger']"; |
|
| 193 | - } |
|
| 194 | - $selector .= "/ancestor::tr/td[contains(@class, 'column-context') and text()='$context']"; |
|
| 195 | - $selector .= $table_cell_content_for_field |
|
| 196 | - ? "/ancestor::tr/td[contains(@class, 'column-$field') and text()='$table_cell_content_for_field']" |
|
| 197 | - : "/ancestor::tr/td[contains(@class, 'column-$field')]"; |
|
| 198 | - return $number_in_set > 0 ? Locator::elementAt($selector, $number_in_set) : $selector; |
|
| 199 | - } |
|
| 200 | - |
|
| 201 | - |
|
| 202 | - /** |
|
| 203 | - * Selector for the Create Custom button found in the message template list table. |
|
| 204 | - * @param string $message_type_label |
|
| 205 | - * @param string $messenger_label |
|
| 206 | - * @return string |
|
| 207 | - */ |
|
| 208 | - public static function createCustomButtonForMessageTypeAndMessenger($message_type_label, $messenger_label) |
|
| 209 | - { |
|
| 210 | - $selector = "//tr/td[contains(@class, 'message_type') and text()='$message_type_label']" |
|
| 211 | - . "//ancestor::tr/td[contains(@class, 'messenger') and contains(., '$messenger_label')]" |
|
| 212 | - . "//ancestor::tr/td/a[@class='button button-small']"; |
|
| 213 | - return $selector; |
|
| 214 | - } |
|
| 215 | - |
|
| 216 | - |
|
| 217 | - /** |
|
| 218 | - * Note, this could potentially match multiple buttons in the view so the selector is intentionally restricted to |
|
| 219 | - * the FIRST match (which will be the latest message sent if the table is default sorted). |
|
| 220 | - * |
|
| 221 | - * @param string $message_type_label The visible message type label for the row you want to match |
|
| 222 | - * @param string $message_status The status of the message for the row you want to match. |
|
| 223 | - * @param string $messenger The visible messenger label for the row you want to match. |
|
| 224 | - * @param string $context The visible context label for the row you want to match. |
|
| 225 | - * @param int $number_in_set It's possible that the given parameters could match multiple items in the |
|
| 226 | - * view. This allows you to indicate which item from the set to match. |
|
| 227 | - * @return string |
|
| 228 | - * @throws \InvalidArgumentException |
|
| 229 | - */ |
|
| 230 | - public static function messagesActivityListTableViewButtonSelectorFor( |
|
| 231 | - $message_type_label, |
|
| 232 | - $message_status = self::MESSAGE_STATUS_SENT, |
|
| 233 | - $messenger = 'Email', |
|
| 234 | - $context = 'Event Admin', |
|
| 235 | - $number_in_set = 1 |
|
| 236 | - ) { |
|
| 237 | - $selector = self::messagesActivityListTableCellSelectorFor( |
|
| 238 | - 'action', |
|
| 239 | - $message_type_label, |
|
| 240 | - $message_status, |
|
| 241 | - $messenger, |
|
| 242 | - $context, |
|
| 243 | - '', |
|
| 244 | - $number_in_set |
|
| 245 | - ); |
|
| 246 | - $selector .= "/a/span[contains(@class, 'ee-message-action-link-view')" |
|
| 247 | - . " and not(contains(@class, 'ee-message-action-link-view_transaction'))]"; |
|
| 248 | - return $selector; |
|
| 249 | - } |
|
| 250 | - |
|
| 251 | - |
|
| 252 | - /** |
|
| 253 | - * Locator for the delete action link for a message item in the message activity list table. |
|
| 254 | - * Note: The link is not visible by default, so the column would need hovered over for the link to appear. |
|
| 255 | - * |
|
| 256 | - * @param $message_type_label |
|
| 257 | - * @param string $message_status |
|
| 258 | - * @param string $messenger |
|
| 259 | - * @param string $context |
|
| 260 | - * @param int $number_in_set |
|
| 261 | - * @return string |
|
| 262 | - * @throws \InvalidArgumentException |
|
| 263 | - */ |
|
| 264 | - public static function messagesActivityListTableDeleteActionSelectorFor( |
|
| 265 | - $message_type_label, |
|
| 266 | - $message_status = self::MESSAGE_STATUS_SENT, |
|
| 267 | - $messenger = 'Email', |
|
| 268 | - $context = 'Event Admin', |
|
| 269 | - $number_in_set = 1 |
|
| 270 | - ) { |
|
| 271 | - $selector = self::messagesActivityListTableCellSelectorFor( |
|
| 272 | - 'to', |
|
| 273 | - $message_type_label, |
|
| 274 | - $message_status, |
|
| 275 | - $messenger, |
|
| 276 | - $context, |
|
| 277 | - '', |
|
| 278 | - $number_in_set |
|
| 279 | - ); |
|
| 280 | - $selector .= "/div/span[@class='delete']/a"; |
|
| 281 | - return $selector; |
|
| 282 | - } |
|
| 283 | - |
|
| 284 | - |
|
| 285 | - |
|
| 286 | - /** |
|
| 287 | - * Returns the input selector for a given field in the message template editor. |
|
| 288 | - * Assumes one is already viewing the Message Template Editor. |
|
| 289 | - * @param string $field |
|
| 290 | - * @return string |
|
| 291 | - */ |
|
| 292 | - public static function messageInputFieldSelectorFor($field) |
|
| 293 | - { |
|
| 294 | - return "//div[@id='post-body']//input[@id='$field-content']"; |
|
| 295 | - } |
|
| 296 | - |
|
| 297 | - |
|
| 298 | - /** |
|
| 299 | - * Wrapper for self::messageInputFieldSelectorFor('to') that takes care of getting the input for the To field. |
|
| 300 | - */ |
|
| 301 | - public static function messageTemplateToFieldSelector() |
|
| 302 | - { |
|
| 303 | - return self::messageInputFieldSelectorFor('to'); |
|
| 304 | - } |
|
| 83 | + /** |
|
| 84 | + * Locator for the dialog container used for housing viewed messages in the message activity list table. |
|
| 85 | + */ |
|
| 86 | + const MESSAGES_LIST_TABLE_VIEW_MESSAGE_DIALOG_CONTAINER_SELECTOR = '.ee-admin-dialog-container-inner-content'; |
|
| 87 | + |
|
| 88 | + |
|
| 89 | + /** |
|
| 90 | + * Returns the selector for the on/off toggle for context on the message template editor. |
|
| 91 | + */ |
|
| 92 | + const MESSAGES_CONTEXT_ACTIVE_STATE_TOGGLE = |
|
| 93 | + "//div[@class='activate_context_on_off_toggle_container']/div[@class='switch']/label"; |
|
| 94 | + |
|
| 95 | + |
|
| 96 | + const SELECTOR_LINK_FINALIZE_PAYMENT_PENDING_PAYMENT_MESSAGE = "//td/p[@class='callout']/a"; |
|
| 97 | + |
|
| 98 | + |
|
| 99 | + |
|
| 100 | + /** |
|
| 101 | + * @param string $additional_params Any additional request parameters for the generated url should be included as |
|
| 102 | + * a string. |
|
| 103 | + * @return string |
|
| 104 | + */ |
|
| 105 | + public static function messageActivityListTableUrl($additional_params = '') |
|
| 106 | + { |
|
| 107 | + return self::adminUrl('espresso_messages', 'default', $additional_params); |
|
| 108 | + } |
|
| 109 | + |
|
| 110 | + |
|
| 111 | + /** |
|
| 112 | + * @param string $additional_params Any additional request parameters for the generated url should be included as |
|
| 113 | + * a string. |
|
| 114 | + * @return string |
|
| 115 | + */ |
|
| 116 | + public static function defaultMessageTemplateListTableUrl($additional_params = '') |
|
| 117 | + { |
|
| 118 | + return self::adminUrl('espresso_messages', 'global_mtps', $additional_params); |
|
| 119 | + } |
|
| 120 | + |
|
| 121 | + |
|
| 122 | + /** |
|
| 123 | + * @param string $additional_params Any additional request parameters for the generated url should be included as |
|
| 124 | + * a string. |
|
| 125 | + * @return string |
|
| 126 | + */ |
|
| 127 | + public static function customMessageTemplateListTableUrl($additional_params = '') |
|
| 128 | + { |
|
| 129 | + return self::adminUrl('espresso_messages', 'custom_mtps', $additional_params); |
|
| 130 | + } |
|
| 131 | + |
|
| 132 | + |
|
| 133 | + /** |
|
| 134 | + * @return string |
|
| 135 | + */ |
|
| 136 | + public static function messageSettingsUrl() |
|
| 137 | + { |
|
| 138 | + return self::adminUrl('espresso_messages', 'settings'); |
|
| 139 | + } |
|
| 140 | + |
|
| 141 | + |
|
| 142 | + |
|
| 143 | + public static function draggableSettingsBoxSelectorForMessageTypeAndMessenger( |
|
| 144 | + $message_type_slug, |
|
| 145 | + $messenger_slug = 'email' |
|
| 146 | + ) { |
|
| 147 | + return "#$message_type_slug-messagetype-$messenger_slug"; |
|
| 148 | + } |
|
| 149 | + |
|
| 150 | + |
|
| 151 | + /** |
|
| 152 | + * @param string $message_type_slug |
|
| 153 | + * @param string $context |
|
| 154 | + * @return string |
|
| 155 | + */ |
|
| 156 | + public static function editMessageTemplateClassByMessageType($message_type_slug, $context = '') |
|
| 157 | + { |
|
| 158 | + return $context |
|
| 159 | + ? '.' . $message_type_slug . '-' . $context . '-edit-link' |
|
| 160 | + : '.' . $message_type_slug . '-edit-link'; |
|
| 161 | + } |
|
| 162 | + |
|
| 163 | + |
|
| 164 | + /** |
|
| 165 | + * Selector for (a) specific table cell(s) in the Messages Activity list table for the given parameters. |
|
| 166 | + * |
|
| 167 | + * @param $field |
|
| 168 | + * @param $message_type_label |
|
| 169 | + * @param string $message_status |
|
| 170 | + * @param string $messenger |
|
| 171 | + * @param string $context |
|
| 172 | + * @param string $table_cell_content_for_field |
|
| 173 | + * @param int $number_in_set It's possible that the given parameters could match multiple items in the view. |
|
| 174 | + * This allows you to indicate which item from the set to match. If this is set to 0 |
|
| 175 | + * then all matches for the locator will be returned. |
|
| 176 | + * @return string |
|
| 177 | + * @throws \InvalidArgumentException |
|
| 178 | + */ |
|
| 179 | + public static function messagesActivityListTableCellSelectorFor( |
|
| 180 | + $field, |
|
| 181 | + $message_type_label, |
|
| 182 | + $message_status = self::MESSAGE_STATUS_SENT, |
|
| 183 | + $messenger = 'Email', |
|
| 184 | + $context = 'Event Admin', |
|
| 185 | + $table_cell_content_for_field = '', |
|
| 186 | + $number_in_set = 1 |
|
| 187 | + ) { |
|
| 188 | + $selector = "//tbody[@id='the-list']"; |
|
| 189 | + $selector .= "//tr[contains(@class, 'msg-status-$message_status')]" |
|
| 190 | + . "//td[contains(@class, 'message_type') and text()='$message_type_label']"; |
|
| 191 | + if ($messenger) { |
|
| 192 | + $selector .= "/ancestor::tr/td[contains(@class, 'messenger') and text()='$messenger']"; |
|
| 193 | + } |
|
| 194 | + $selector .= "/ancestor::tr/td[contains(@class, 'column-context') and text()='$context']"; |
|
| 195 | + $selector .= $table_cell_content_for_field |
|
| 196 | + ? "/ancestor::tr/td[contains(@class, 'column-$field') and text()='$table_cell_content_for_field']" |
|
| 197 | + : "/ancestor::tr/td[contains(@class, 'column-$field')]"; |
|
| 198 | + return $number_in_set > 0 ? Locator::elementAt($selector, $number_in_set) : $selector; |
|
| 199 | + } |
|
| 200 | + |
|
| 201 | + |
|
| 202 | + /** |
|
| 203 | + * Selector for the Create Custom button found in the message template list table. |
|
| 204 | + * @param string $message_type_label |
|
| 205 | + * @param string $messenger_label |
|
| 206 | + * @return string |
|
| 207 | + */ |
|
| 208 | + public static function createCustomButtonForMessageTypeAndMessenger($message_type_label, $messenger_label) |
|
| 209 | + { |
|
| 210 | + $selector = "//tr/td[contains(@class, 'message_type') and text()='$message_type_label']" |
|
| 211 | + . "//ancestor::tr/td[contains(@class, 'messenger') and contains(., '$messenger_label')]" |
|
| 212 | + . "//ancestor::tr/td/a[@class='button button-small']"; |
|
| 213 | + return $selector; |
|
| 214 | + } |
|
| 215 | + |
|
| 216 | + |
|
| 217 | + /** |
|
| 218 | + * Note, this could potentially match multiple buttons in the view so the selector is intentionally restricted to |
|
| 219 | + * the FIRST match (which will be the latest message sent if the table is default sorted). |
|
| 220 | + * |
|
| 221 | + * @param string $message_type_label The visible message type label for the row you want to match |
|
| 222 | + * @param string $message_status The status of the message for the row you want to match. |
|
| 223 | + * @param string $messenger The visible messenger label for the row you want to match. |
|
| 224 | + * @param string $context The visible context label for the row you want to match. |
|
| 225 | + * @param int $number_in_set It's possible that the given parameters could match multiple items in the |
|
| 226 | + * view. This allows you to indicate which item from the set to match. |
|
| 227 | + * @return string |
|
| 228 | + * @throws \InvalidArgumentException |
|
| 229 | + */ |
|
| 230 | + public static function messagesActivityListTableViewButtonSelectorFor( |
|
| 231 | + $message_type_label, |
|
| 232 | + $message_status = self::MESSAGE_STATUS_SENT, |
|
| 233 | + $messenger = 'Email', |
|
| 234 | + $context = 'Event Admin', |
|
| 235 | + $number_in_set = 1 |
|
| 236 | + ) { |
|
| 237 | + $selector = self::messagesActivityListTableCellSelectorFor( |
|
| 238 | + 'action', |
|
| 239 | + $message_type_label, |
|
| 240 | + $message_status, |
|
| 241 | + $messenger, |
|
| 242 | + $context, |
|
| 243 | + '', |
|
| 244 | + $number_in_set |
|
| 245 | + ); |
|
| 246 | + $selector .= "/a/span[contains(@class, 'ee-message-action-link-view')" |
|
| 247 | + . " and not(contains(@class, 'ee-message-action-link-view_transaction'))]"; |
|
| 248 | + return $selector; |
|
| 249 | + } |
|
| 250 | + |
|
| 251 | + |
|
| 252 | + /** |
|
| 253 | + * Locator for the delete action link for a message item in the message activity list table. |
|
| 254 | + * Note: The link is not visible by default, so the column would need hovered over for the link to appear. |
|
| 255 | + * |
|
| 256 | + * @param $message_type_label |
|
| 257 | + * @param string $message_status |
|
| 258 | + * @param string $messenger |
|
| 259 | + * @param string $context |
|
| 260 | + * @param int $number_in_set |
|
| 261 | + * @return string |
|
| 262 | + * @throws \InvalidArgumentException |
|
| 263 | + */ |
|
| 264 | + public static function messagesActivityListTableDeleteActionSelectorFor( |
|
| 265 | + $message_type_label, |
|
| 266 | + $message_status = self::MESSAGE_STATUS_SENT, |
|
| 267 | + $messenger = 'Email', |
|
| 268 | + $context = 'Event Admin', |
|
| 269 | + $number_in_set = 1 |
|
| 270 | + ) { |
|
| 271 | + $selector = self::messagesActivityListTableCellSelectorFor( |
|
| 272 | + 'to', |
|
| 273 | + $message_type_label, |
|
| 274 | + $message_status, |
|
| 275 | + $messenger, |
|
| 276 | + $context, |
|
| 277 | + '', |
|
| 278 | + $number_in_set |
|
| 279 | + ); |
|
| 280 | + $selector .= "/div/span[@class='delete']/a"; |
|
| 281 | + return $selector; |
|
| 282 | + } |
|
| 283 | + |
|
| 284 | + |
|
| 285 | + |
|
| 286 | + /** |
|
| 287 | + * Returns the input selector for a given field in the message template editor. |
|
| 288 | + * Assumes one is already viewing the Message Template Editor. |
|
| 289 | + * @param string $field |
|
| 290 | + * @return string |
|
| 291 | + */ |
|
| 292 | + public static function messageInputFieldSelectorFor($field) |
|
| 293 | + { |
|
| 294 | + return "//div[@id='post-body']//input[@id='$field-content']"; |
|
| 295 | + } |
|
| 296 | + |
|
| 297 | + |
|
| 298 | + /** |
|
| 299 | + * Wrapper for self::messageInputFieldSelectorFor('to') that takes care of getting the input for the To field. |
|
| 300 | + */ |
|
| 301 | + public static function messageTemplateToFieldSelector() |
|
| 302 | + { |
|
| 303 | + return self::messageInputFieldSelectorFor('to'); |
|
| 304 | + } |
|
| 305 | 305 | } |
| 306 | 306 | \ No newline at end of file |
@@ -8,26 +8,26 @@ |
||
| 8 | 8 | |
| 9 | 9 | class InvalidStatusException extends InvalidArgumentException |
| 10 | 10 | { |
| 11 | - /** |
|
| 12 | - * InvalidStatusException constructor. |
|
| 13 | - * @param string $status the invalid status id that was supplied |
|
| 14 | - * @param string $domain the name of the domain, model, or class that the status belongs to |
|
| 15 | - * @param string $message custom message |
|
| 16 | - * @param int $code |
|
| 17 | - * @param Exception|null $previous |
|
| 18 | - */ |
|
| 19 | - public function __construct($status, $domain, $message = '', $code = 0, Exception $previous = null) |
|
| 20 | - { |
|
| 21 | - if (empty($message)) { |
|
| 22 | - $message = sprintf( |
|
| 23 | - __( |
|
| 24 | - '"%1$s" is not a valid %2$s status', |
|
| 25 | - 'event_espresso' |
|
| 26 | - ), |
|
| 27 | - $status, |
|
| 28 | - $domain |
|
| 29 | - ); |
|
| 30 | - } |
|
| 31 | - parent::__construct($message, $code, $previous); |
|
| 32 | - } |
|
| 11 | + /** |
|
| 12 | + * InvalidStatusException constructor. |
|
| 13 | + * @param string $status the invalid status id that was supplied |
|
| 14 | + * @param string $domain the name of the domain, model, or class that the status belongs to |
|
| 15 | + * @param string $message custom message |
|
| 16 | + * @param int $code |
|
| 17 | + * @param Exception|null $previous |
|
| 18 | + */ |
|
| 19 | + public function __construct($status, $domain, $message = '', $code = 0, Exception $previous = null) |
|
| 20 | + { |
|
| 21 | + if (empty($message)) { |
|
| 22 | + $message = sprintf( |
|
| 23 | + __( |
|
| 24 | + '"%1$s" is not a valid %2$s status', |
|
| 25 | + 'event_espresso' |
|
| 26 | + ), |
|
| 27 | + $status, |
|
| 28 | + $domain |
|
| 29 | + ); |
|
| 30 | + } |
|
| 31 | + parent::__construct($message, $code, $previous); |
|
| 32 | + } |
|
| 33 | 33 | } |