@@ -18,7 +18,7 @@ discard block |
||
18 | 18 | $this->_form_section->html_id(), |
19 | 19 | $this->_form_section->html_class(), |
20 | 20 | $this->_form_section->html_style() |
21 | - ) . EEH_HTML::tbody(); |
|
21 | + ).EEH_HTML::tbody(); |
|
22 | 22 | } |
23 | 23 | |
24 | 24 | |
@@ -31,7 +31,7 @@ discard block |
||
31 | 31 | */ |
32 | 32 | public function layout_form_end($additional_args = array()) |
33 | 33 | { |
34 | - return EEH_HTML::tbodyx() . EEH_HTML::tablex($this->_form_section->html_id()); |
|
34 | + return EEH_HTML::tbodyx().EEH_HTML::tablex($this->_form_section->html_id()); |
|
35 | 35 | } |
36 | 36 | |
37 | 37 | |
@@ -50,11 +50,11 @@ discard block |
||
50 | 50 | } else { |
51 | 51 | $html_for_input = $input->get_html_for_input(); |
52 | 52 | $html_for_input .= $input->get_html_for_errors() != '' |
53 | - ? EEH_HTML::nl() . $input->get_html_for_errors() |
|
53 | + ? EEH_HTML::nl().$input->get_html_for_errors() |
|
54 | 54 | : ''; |
55 | - $html_for_input .= $input->get_html_for_help() != '' ? EEH_HTML::nl() . $input->get_html_for_help() : ''; |
|
55 | + $html_for_input .= $input->get_html_for_help() != '' ? EEH_HTML::nl().$input->get_html_for_help() : ''; |
|
56 | 56 | $html .= EEH_HTML::tr( |
57 | - EEH_HTML::th($input->get_html_for_label()) . |
|
57 | + EEH_HTML::th($input->get_html_for_label()). |
|
58 | 58 | EEH_HTML::td($html_for_input) |
59 | 59 | ); |
60 | 60 | } |
@@ -2,93 +2,93 @@ |
||
2 | 2 | |
3 | 3 | class EE_Two_Column_Layout extends EE_Form_Section_Layout_Base |
4 | 4 | { |
5 | - /** |
|
6 | - * @param EE_Form_Section_Proper $form |
|
7 | - */ |
|
8 | - public function _construct_finalize(EE_Form_Section_Proper $form) |
|
9 | - { |
|
10 | - parent::_construct_finalize($form); |
|
11 | - $this->_form_section->set_html_class('ee-two-column-layout'); |
|
12 | - } |
|
5 | + /** |
|
6 | + * @param EE_Form_Section_Proper $form |
|
7 | + */ |
|
8 | + public function _construct_finalize(EE_Form_Section_Proper $form) |
|
9 | + { |
|
10 | + parent::_construct_finalize($form); |
|
11 | + $this->_form_section->set_html_class('ee-two-column-layout'); |
|
12 | + } |
|
13 | 13 | |
14 | 14 | |
15 | - /** |
|
16 | - * Should be used to start teh form section (Eg a table tag, or a div tag, etc.) |
|
17 | - * |
|
18 | - * @param array $additional_args |
|
19 | - * @return string |
|
20 | - * @throws EE_Error |
|
21 | - */ |
|
22 | - public function layout_form_begin($additional_args = array()) |
|
23 | - { |
|
24 | - return $this->display_form_wide_errors() |
|
25 | - . EEH_HTML::table( |
|
26 | - '', |
|
27 | - $this->_form_section->html_id(), |
|
28 | - $this->_form_section->html_class(), |
|
29 | - $this->_form_section->html_style() |
|
30 | - ) . EEH_HTML::tbody(); |
|
31 | - } |
|
15 | + /** |
|
16 | + * Should be used to start teh form section (Eg a table tag, or a div tag, etc.) |
|
17 | + * |
|
18 | + * @param array $additional_args |
|
19 | + * @return string |
|
20 | + * @throws EE_Error |
|
21 | + */ |
|
22 | + public function layout_form_begin($additional_args = array()) |
|
23 | + { |
|
24 | + return $this->display_form_wide_errors() |
|
25 | + . EEH_HTML::table( |
|
26 | + '', |
|
27 | + $this->_form_section->html_id(), |
|
28 | + $this->_form_section->html_class(), |
|
29 | + $this->_form_section->html_style() |
|
30 | + ) . EEH_HTML::tbody(); |
|
31 | + } |
|
32 | 32 | |
33 | 33 | |
34 | 34 | |
35 | - /** |
|
36 | - * Should be used to end the form section (eg a /table tag, or a /div tag, etc) |
|
37 | - * |
|
38 | - * @param array $additional_args |
|
39 | - * @return string |
|
40 | - */ |
|
41 | - public function layout_form_end($additional_args = array()) |
|
42 | - { |
|
43 | - return EEH_HTML::tbodyx() . EEH_HTML::tablex($this->_form_section->html_id()); |
|
44 | - } |
|
35 | + /** |
|
36 | + * Should be used to end the form section (eg a /table tag, or a /div tag, etc) |
|
37 | + * |
|
38 | + * @param array $additional_args |
|
39 | + * @return string |
|
40 | + */ |
|
41 | + public function layout_form_end($additional_args = array()) |
|
42 | + { |
|
43 | + return EEH_HTML::tbodyx() . EEH_HTML::tablex($this->_form_section->html_id()); |
|
44 | + } |
|
45 | 45 | |
46 | 46 | |
47 | 47 | |
48 | - /** |
|
49 | - * Lays out the row for the input, including label and errors |
|
50 | - * |
|
51 | - * @param EE_Form_Input_Base $input |
|
52 | - * @return string |
|
53 | - */ |
|
54 | - public function layout_input($input) |
|
55 | - { |
|
56 | - $html = ''; |
|
57 | - if ($input instanceof EE_Hidden_Input) { |
|
58 | - $html .= $input->get_html_for_input(); |
|
59 | - } else { |
|
60 | - $html_for_input = $input->get_html_for_input(); |
|
61 | - $html_for_input .= $input->get_html_for_errors() != '' |
|
62 | - ? EEH_HTML::nl() . $input->get_html_for_errors() |
|
63 | - : ''; |
|
64 | - $html_for_input .= $input->get_html_for_help() != '' ? EEH_HTML::nl() . $input->get_html_for_help() : ''; |
|
65 | - $html .= EEH_HTML::tr( |
|
66 | - EEH_HTML::th($input->get_html_for_label()) . |
|
67 | - EEH_HTML::td($html_for_input) |
|
68 | - ); |
|
69 | - } |
|
70 | - return $html; |
|
71 | - } |
|
48 | + /** |
|
49 | + * Lays out the row for the input, including label and errors |
|
50 | + * |
|
51 | + * @param EE_Form_Input_Base $input |
|
52 | + * @return string |
|
53 | + */ |
|
54 | + public function layout_input($input) |
|
55 | + { |
|
56 | + $html = ''; |
|
57 | + if ($input instanceof EE_Hidden_Input) { |
|
58 | + $html .= $input->get_html_for_input(); |
|
59 | + } else { |
|
60 | + $html_for_input = $input->get_html_for_input(); |
|
61 | + $html_for_input .= $input->get_html_for_errors() != '' |
|
62 | + ? EEH_HTML::nl() . $input->get_html_for_errors() |
|
63 | + : ''; |
|
64 | + $html_for_input .= $input->get_html_for_help() != '' ? EEH_HTML::nl() . $input->get_html_for_help() : ''; |
|
65 | + $html .= EEH_HTML::tr( |
|
66 | + EEH_HTML::th($input->get_html_for_label()) . |
|
67 | + EEH_HTML::td($html_for_input) |
|
68 | + ); |
|
69 | + } |
|
70 | + return $html; |
|
71 | + } |
|
72 | 72 | |
73 | 73 | |
74 | 74 | |
75 | - /** |
|
76 | - * Lays out a row for the subsection. Please note that if you have a subsection which you don't want wrapped in |
|
77 | - * a tr and td with a colspan=2, you should use a different layout strategy, like EE_No_Layout, EE_Template_Layout, |
|
78 | - * or EE_Div_Per_Section_Layout, and create subsections using EE_Two_Column_Layout for everywhere you want the |
|
79 | - * two-column layout, and then other sub-sections can be outside the EE_Two_Column_Layout table. |
|
80 | - * |
|
81 | - * @param EE_Form_Section_Proper $form_section |
|
82 | - * @return string |
|
83 | - */ |
|
84 | - public function layout_subsection($form_section) |
|
85 | - { |
|
86 | - if ( |
|
87 | - $form_section instanceof EE_Form_Section_Proper |
|
88 | - || $form_section instanceof EE_Form_Section_HTML |
|
89 | - ) { |
|
90 | - return EEH_HTML::no_row($form_section->get_html()); |
|
91 | - } |
|
92 | - return ''; |
|
93 | - } |
|
75 | + /** |
|
76 | + * Lays out a row for the subsection. Please note that if you have a subsection which you don't want wrapped in |
|
77 | + * a tr and td with a colspan=2, you should use a different layout strategy, like EE_No_Layout, EE_Template_Layout, |
|
78 | + * or EE_Div_Per_Section_Layout, and create subsections using EE_Two_Column_Layout for everywhere you want the |
|
79 | + * two-column layout, and then other sub-sections can be outside the EE_Two_Column_Layout table. |
|
80 | + * |
|
81 | + * @param EE_Form_Section_Proper $form_section |
|
82 | + * @return string |
|
83 | + */ |
|
84 | + public function layout_subsection($form_section) |
|
85 | + { |
|
86 | + if ( |
|
87 | + $form_section instanceof EE_Form_Section_Proper |
|
88 | + || $form_section instanceof EE_Form_Section_HTML |
|
89 | + ) { |
|
90 | + return EEH_HTML::no_row($form_section->get_html()); |
|
91 | + } |
|
92 | + return ''; |
|
93 | + } |
|
94 | 94 | } |
@@ -23,7 +23,7 @@ |
||
23 | 23 | */ |
24 | 24 | public function __construct($validation_error_message = '') |
25 | 25 | { |
26 | - if (! $validation_error_message) { |
|
26 | + if ( ! $validation_error_message) { |
|
27 | 27 | $validation_error_message = esc_html__('Please enter a valid email address.', 'event_espresso'); |
28 | 28 | } |
29 | 29 | parent::__construct($validation_error_message); |
@@ -15,72 +15,72 @@ |
||
15 | 15 | */ |
16 | 16 | class EE_Email_Validation_Strategy extends EE_Text_Validation_Strategy |
17 | 17 | { |
18 | - /** |
|
19 | - * @param string $validation_error_message |
|
20 | - */ |
|
21 | - public function __construct($validation_error_message = '') |
|
22 | - { |
|
23 | - if (! $validation_error_message) { |
|
24 | - $validation_error_message = esc_html__('Please enter a valid email address.', 'event_espresso'); |
|
25 | - } |
|
26 | - parent::__construct($validation_error_message); |
|
27 | - } |
|
18 | + /** |
|
19 | + * @param string $validation_error_message |
|
20 | + */ |
|
21 | + public function __construct($validation_error_message = '') |
|
22 | + { |
|
23 | + if (! $validation_error_message) { |
|
24 | + $validation_error_message = esc_html__('Please enter a valid email address.', 'event_espresso'); |
|
25 | + } |
|
26 | + parent::__construct($validation_error_message); |
|
27 | + } |
|
28 | 28 | |
29 | 29 | |
30 | 30 | |
31 | - /** |
|
32 | - * just checks the field isn't blank |
|
33 | - * |
|
34 | - * @param $normalized_value |
|
35 | - * @return bool |
|
36 | - * @throws InvalidArgumentException |
|
37 | - * @throws InvalidInterfaceException |
|
38 | - * @throws InvalidDataTypeException |
|
39 | - * @throws EE_Validation_Error |
|
40 | - */ |
|
41 | - public function validate($normalized_value) |
|
42 | - { |
|
43 | - if ($normalized_value && ! $this->_validate_email($normalized_value)) { |
|
44 | - throw new EE_Validation_Error($this->get_validation_error_message(), 'required'); |
|
45 | - } |
|
46 | - return true; |
|
47 | - } |
|
31 | + /** |
|
32 | + * just checks the field isn't blank |
|
33 | + * |
|
34 | + * @param $normalized_value |
|
35 | + * @return bool |
|
36 | + * @throws InvalidArgumentException |
|
37 | + * @throws InvalidInterfaceException |
|
38 | + * @throws InvalidDataTypeException |
|
39 | + * @throws EE_Validation_Error |
|
40 | + */ |
|
41 | + public function validate($normalized_value) |
|
42 | + { |
|
43 | + if ($normalized_value && ! $this->_validate_email($normalized_value)) { |
|
44 | + throw new EE_Validation_Error($this->get_validation_error_message(), 'required'); |
|
45 | + } |
|
46 | + return true; |
|
47 | + } |
|
48 | 48 | |
49 | 49 | |
50 | 50 | |
51 | - /** |
|
52 | - * @return array |
|
53 | - */ |
|
54 | - public function get_jquery_validation_rule_array() |
|
55 | - { |
|
56 | - return array('email' => true, 'messages' => array('email' => $this->get_validation_error_message())); |
|
57 | - } |
|
51 | + /** |
|
52 | + * @return array |
|
53 | + */ |
|
54 | + public function get_jquery_validation_rule_array() |
|
55 | + { |
|
56 | + return array('email' => true, 'messages' => array('email' => $this->get_validation_error_message())); |
|
57 | + } |
|
58 | 58 | |
59 | 59 | |
60 | 60 | |
61 | - /** |
|
62 | - * Validate an email address. |
|
63 | - * Provide email address (raw input) |
|
64 | - * |
|
65 | - * @param $email |
|
66 | - * @return bool of whether the email is valid or not |
|
67 | - * @throws InvalidArgumentException |
|
68 | - * @throws InvalidInterfaceException |
|
69 | - * @throws InvalidDataTypeException |
|
70 | - * @throws EE_Validation_Error |
|
71 | - */ |
|
72 | - private function _validate_email($email) |
|
73 | - { |
|
74 | - try { |
|
75 | - EmailAddressFactory::create($email); |
|
76 | - } catch (EmailValidationException $e) { |
|
77 | - throw new EE_Validation_Error( |
|
78 | - $e->getMessage(), |
|
79 | - 'invalid_email', |
|
80 | - $this->_input, |
|
81 | - $e |
|
82 | - ); |
|
83 | - } |
|
84 | - return true; |
|
85 | - } |
|
61 | + /** |
|
62 | + * Validate an email address. |
|
63 | + * Provide email address (raw input) |
|
64 | + * |
|
65 | + * @param $email |
|
66 | + * @return bool of whether the email is valid or not |
|
67 | + * @throws InvalidArgumentException |
|
68 | + * @throws InvalidInterfaceException |
|
69 | + * @throws InvalidDataTypeException |
|
70 | + * @throws EE_Validation_Error |
|
71 | + */ |
|
72 | + private function _validate_email($email) |
|
73 | + { |
|
74 | + try { |
|
75 | + EmailAddressFactory::create($email); |
|
76 | + } catch (EmailValidationException $e) { |
|
77 | + throw new EE_Validation_Error( |
|
78 | + $e->getMessage(), |
|
79 | + 'invalid_email', |
|
80 | + $this->_input, |
|
81 | + $e |
|
82 | + ); |
|
83 | + } |
|
84 | + return true; |
|
85 | + } |
|
86 | 86 | } |
@@ -19,16 +19,16 @@ |
||
19 | 19 | 'The green colored gear %s indicates that this messenger is currently active.', |
20 | 20 | 'event_espresso' |
21 | 21 | ), |
22 | - '<img class="inline-text" src="' . EE_MSG_ASSETS_URL . 'images/email-tab-active.png' . '"' |
|
23 | - . ' alt="' . esc_attr__('Active Email Tab', 'event_espresso') . '" />' |
|
22 | + '<img class="inline-text" src="'.EE_MSG_ASSETS_URL.'images/email-tab-active.png'.'"' |
|
23 | + . ' alt="'.esc_attr__('Active Email Tab', 'event_espresso').'" />' |
|
24 | 24 | ); |
25 | 25 | printf( |
26 | 26 | esc_html__( |
27 | 27 | ' The white colored gear %s indicates the messenger is inactive. This is very helpful for seeing at a glance all the messengers that are active when you first view the page.', |
28 | 28 | 'event_espresso' |
29 | 29 | ), |
30 | - '<img class="inline-text" src="' . EE_MSG_ASSETS_URL . 'images/email-tab-inactive.png' |
|
31 | - . '" alt="' . esc_attr__('Inactive Email Tab', 'event_espresso') . '" />' |
|
30 | + '<img class="inline-text" src="'.EE_MSG_ASSETS_URL.'images/email-tab-inactive.png' |
|
31 | + . '" alt="'.esc_attr__('Inactive Email Tab', 'event_espresso').'" />' |
|
32 | 32 | ); ?> |
33 | 33 | </p> |
34 | 34 | <p> |
@@ -3,79 +3,79 @@ |
||
3 | 3 | </p> |
4 | 4 | <p> |
5 | 5 | <?php esc_html_e( |
6 | - 'You can select Messengers via the tabs across the top of the settings page. The available messengers you see depends on what version of Event Espresso you have and what addons are installed. Every install include an "Email" messenger tab. When you click one of those tabs it will display that messenger.', |
|
7 | - 'event_espresso' |
|
8 | - ); ?> |
|
6 | + 'You can select Messengers via the tabs across the top of the settings page. The available messengers you see depends on what version of Event Espresso you have and what addons are installed. Every install include an "Email" messenger tab. When you click one of those tabs it will display that messenger.', |
|
7 | + 'event_espresso' |
|
8 | + ); ?> |
|
9 | 9 | </p> |
10 | 10 | <p> |
11 | 11 | <?php esc_html_e( |
12 | - 'There are two ways to determine whether a messenger is active or not. The first way is via the messenger tab itself.', |
|
13 | - 'event_espresso' |
|
14 | - ); ?> |
|
12 | + 'There are two ways to determine whether a messenger is active or not. The first way is via the messenger tab itself.', |
|
13 | + 'event_espresso' |
|
14 | + ); ?> |
|
15 | 15 | </p> |
16 | 16 | <p> |
17 | 17 | <?php printf( |
18 | - esc_html__( |
|
19 | - 'The green colored gear %s indicates that this messenger is currently active.', |
|
20 | - 'event_espresso' |
|
21 | - ), |
|
22 | - '<img class="inline-text" src="' . EE_MSG_ASSETS_URL . 'images/email-tab-active.png' . '"' |
|
23 | - . ' alt="' . esc_attr__('Active Email Tab', 'event_espresso') . '" />' |
|
24 | - ); |
|
25 | - printf( |
|
26 | - esc_html__( |
|
27 | - ' The white colored gear %s indicates the messenger is inactive. This is very helpful for seeing at a glance all the messengers that are active when you first view the page.', |
|
28 | - 'event_espresso' |
|
29 | - ), |
|
30 | - '<img class="inline-text" src="' . EE_MSG_ASSETS_URL . 'images/email-tab-inactive.png' |
|
31 | - . '" alt="' . esc_attr__('Inactive Email Tab', 'event_espresso') . '" />' |
|
32 | - ); ?> |
|
18 | + esc_html__( |
|
19 | + 'The green colored gear %s indicates that this messenger is currently active.', |
|
20 | + 'event_espresso' |
|
21 | + ), |
|
22 | + '<img class="inline-text" src="' . EE_MSG_ASSETS_URL . 'images/email-tab-active.png' . '"' |
|
23 | + . ' alt="' . esc_attr__('Active Email Tab', 'event_espresso') . '" />' |
|
24 | + ); |
|
25 | + printf( |
|
26 | + esc_html__( |
|
27 | + ' The white colored gear %s indicates the messenger is inactive. This is very helpful for seeing at a glance all the messengers that are active when you first view the page.', |
|
28 | + 'event_espresso' |
|
29 | + ), |
|
30 | + '<img class="inline-text" src="' . EE_MSG_ASSETS_URL . 'images/email-tab-inactive.png' |
|
31 | + . '" alt="' . esc_attr__('Inactive Email Tab', 'event_espresso') . '" />' |
|
32 | + ); ?> |
|
33 | 33 | </p> |
34 | 34 | <p> |
35 | 35 | <?php esc_html_e( |
36 | - 'The second way to determine whether a messenger is active or not is via the "on/off" button in the top right corner of the active messenger displayed content:', |
|
37 | - 'event_espresso' |
|
38 | - ); ?> |
|
36 | + 'The second way to determine whether a messenger is active or not is via the "on/off" button in the top right corner of the active messenger displayed content:', |
|
37 | + 'event_espresso' |
|
38 | + ); ?> |
|
39 | 39 | </p> |
40 | 40 | <p> |
41 | 41 | <?php printf( |
42 | - esc_html__( |
|
43 | - '%1$s means of course that the messenger is active and %2$s means the messenger is inactive.', |
|
44 | - 'event_espresso' |
|
45 | - ), |
|
46 | - '<div class="ee-switch">' |
|
47 | - . '<input class="ee-switch__input" type="checkbox" checked disabled>' |
|
48 | - . '<label class="ee-switch__toggle" for="ee-on-off-toggle-on"></label>' |
|
49 | - . '</div>', |
|
50 | - '<div class="ee-switch">' |
|
51 | - . '<input class="ee-switch__input" type="checkbox" disabled>' |
|
52 | - . '<label class="ee-switch__toggle" for="ee-on-off-toggle-off"></label>' |
|
53 | - . '</div>' |
|
54 | - ); ?> |
|
42 | + esc_html__( |
|
43 | + '%1$s means of course that the messenger is active and %2$s means the messenger is inactive.', |
|
44 | + 'event_espresso' |
|
45 | + ), |
|
46 | + '<div class="ee-switch">' |
|
47 | + . '<input class="ee-switch__input" type="checkbox" checked disabled>' |
|
48 | + . '<label class="ee-switch__toggle" for="ee-on-off-toggle-on"></label>' |
|
49 | + . '</div>', |
|
50 | + '<div class="ee-switch">' |
|
51 | + . '<input class="ee-switch__input" type="checkbox" disabled>' |
|
52 | + . '<label class="ee-switch__toggle" for="ee-on-off-toggle-off"></label>' |
|
53 | + . '</div>' |
|
54 | + ); ?> |
|
55 | 55 | </p> |
56 | 56 | <p> |
57 | 57 | <?php |
58 | - esc_html_e( |
|
59 | - 'The on/off toggle is also what you use to activate or deactivate a messenger.', |
|
60 | - 'event_espresso' |
|
61 | - ); ?> |
|
58 | + esc_html_e( |
|
59 | + 'The on/off toggle is also what you use to activate or deactivate a messenger.', |
|
60 | + 'event_espresso' |
|
61 | + ); ?> |
|
62 | 62 | </p> |
63 | 63 | <p> |
64 | 64 | <?php esc_html_e( |
65 | - 'What happens when you click the toggle to activate is the messenger is activated and the system determines what default message types are activated with the messenger. Then, if there are any default settings for either the messenger or message types those settings are saved. Next, the system will generate any default templates (if none have been generated before, if there are previously generated templates then they are reactivated). Finally, you will see the display change to reflect that the messenger is active. If the messenger has settings you can modify them then. Any message types that have settings will also automatically expand so you can see the default settings and make any changes as necessary to fit your needs. Usually the defaults are sufficient however.', |
|
66 | - 'event_espresso' |
|
67 | - ); ?> |
|
65 | + 'What happens when you click the toggle to activate is the messenger is activated and the system determines what default message types are activated with the messenger. Then, if there are any default settings for either the messenger or message types those settings are saved. Next, the system will generate any default templates (if none have been generated before, if there are previously generated templates then they are reactivated). Finally, you will see the display change to reflect that the messenger is active. If the messenger has settings you can modify them then. Any message types that have settings will also automatically expand so you can see the default settings and make any changes as necessary to fit your needs. Usually the defaults are sufficient however.', |
|
66 | + 'event_espresso' |
|
67 | + ); ?> |
|
68 | 68 | </p> |
69 | 69 | <p> |
70 | 70 | <?php esc_html_e( |
71 | - 'When you deactivate a messenger, the system will first check if there are any custom event templates for that messenger. If there are you will be unable to deactivate the messenger. This is a fail safe to make sure you know that no messages will go out for those specific events so you don\'t accidentally deactivate. If this check passes, then the system will deactivate any global templates for that messenger (note the templates are not erased, they just become inactive, so if you decide to reactivate the messenger later all your customizations are preserved). Then the display will change to reflect the deactivation.', |
|
72 | - 'event_espresso' |
|
73 | - ); ?> |
|
71 | + 'When you deactivate a messenger, the system will first check if there are any custom event templates for that messenger. If there are you will be unable to deactivate the messenger. This is a fail safe to make sure you know that no messages will go out for those specific events so you don\'t accidentally deactivate. If this check passes, then the system will deactivate any global templates for that messenger (note the templates are not erased, they just become inactive, so if you decide to reactivate the messenger later all your customizations are preserved). Then the display will change to reflect the deactivation.', |
|
72 | + 'event_espresso' |
|
73 | + ); ?> |
|
74 | 74 | </p> |
75 | 75 | <p> |
76 | 76 | <strong><?php esc_html_e('Important', 'event_espresso'); ?></strong><br /> |
77 | 77 | <?php esc_html_e( |
78 | - 'Although customizations made to global templates are preserved when a messenger is deactivated, any settings for that messenger (or the message types that were attached to it) are lost on deactivation. Also, once you deactivate a messenger, no more messages will be delivered using that messenger for any of your events.', |
|
79 | - 'event_espresso' |
|
80 | - ); ?> |
|
78 | + 'Although customizations made to global templates are preserved when a messenger is deactivated, any settings for that messenger (or the message types that were attached to it) are lost on deactivation. Also, once you deactivate a messenger, no more messages will be delivered using that messenger for any of your events.', |
|
79 | + 'event_espresso' |
|
80 | + ); ?> |
|
81 | 81 | </p> |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | ) |
30 | 30 | ); |
31 | 31 | parent::__construct($input_settings); |
32 | - $this->set_html_class($this->html_class() . ' datepicker'); |
|
32 | + $this->set_html_class($this->html_class().' datepicker'); |
|
33 | 33 | // add some style and make it dance |
34 | 34 | add_action('wp_enqueue_scripts', array('EE_Datepicker_Input', 'enqueue_styles_and_scripts')); |
35 | 35 | add_action('admin_enqueue_scripts', array('EE_Datepicker_Input', 'enqueue_styles_and_scripts')); |
@@ -48,7 +48,7 @@ discard block |
||
48 | 48 | // load css |
49 | 49 | wp_register_style( |
50 | 50 | 'espresso-ui-theme', |
51 | - EE_GLOBAL_ASSETS_URL . 'css/espresso-ui-theme/jquery-ui-1.10.3.custom.min.css', |
|
51 | + EE_GLOBAL_ASSETS_URL.'css/espresso-ui-theme/jquery-ui-1.10.3.custom.min.css', |
|
52 | 52 | array(), |
53 | 53 | EVENT_ESPRESSO_VERSION |
54 | 54 | ); |
@@ -9,45 +9,45 @@ |
||
9 | 9 | */ |
10 | 10 | class EE_Datepicker_Input extends EE_Form_Input_Base |
11 | 11 | { |
12 | - /** |
|
13 | - * @param array $input_settings |
|
14 | - */ |
|
15 | - public function __construct($input_settings = array()) |
|
16 | - { |
|
17 | - $this->_set_display_strategy(new EE_Text_Input_Display_Strategy('datepicker')); |
|
18 | - $this->_set_normalization_strategy(new EE_Text_Normalization()); |
|
19 | - // we could do better for validation, but at least verify its plaintext |
|
20 | - $this->_add_validation_strategy( |
|
21 | - new EE_Plaintext_Validation_Strategy( |
|
22 | - isset($input_settings['validation_error_message']) |
|
23 | - ? $input_settings['validation_error_message'] |
|
24 | - : null |
|
25 | - ) |
|
26 | - ); |
|
27 | - parent::__construct($input_settings); |
|
28 | - $this->set_html_class($this->html_class() . ' datepicker'); |
|
29 | - // add some style and make it dance |
|
30 | - add_action('wp_enqueue_scripts', array('EE_Datepicker_Input', 'enqueue_styles_and_scripts')); |
|
31 | - add_action('admin_enqueue_scripts', array('EE_Datepicker_Input', 'enqueue_styles_and_scripts')); |
|
32 | - } |
|
12 | + /** |
|
13 | + * @param array $input_settings |
|
14 | + */ |
|
15 | + public function __construct($input_settings = array()) |
|
16 | + { |
|
17 | + $this->_set_display_strategy(new EE_Text_Input_Display_Strategy('datepicker')); |
|
18 | + $this->_set_normalization_strategy(new EE_Text_Normalization()); |
|
19 | + // we could do better for validation, but at least verify its plaintext |
|
20 | + $this->_add_validation_strategy( |
|
21 | + new EE_Plaintext_Validation_Strategy( |
|
22 | + isset($input_settings['validation_error_message']) |
|
23 | + ? $input_settings['validation_error_message'] |
|
24 | + : null |
|
25 | + ) |
|
26 | + ); |
|
27 | + parent::__construct($input_settings); |
|
28 | + $this->set_html_class($this->html_class() . ' datepicker'); |
|
29 | + // add some style and make it dance |
|
30 | + add_action('wp_enqueue_scripts', array('EE_Datepicker_Input', 'enqueue_styles_and_scripts')); |
|
31 | + add_action('admin_enqueue_scripts', array('EE_Datepicker_Input', 'enqueue_styles_and_scripts')); |
|
32 | + } |
|
33 | 33 | |
34 | 34 | |
35 | 35 | |
36 | - /** |
|
37 | - * enqueue_styles_and_scripts |
|
38 | - * |
|
39 | - * @access public |
|
40 | - * @return void |
|
41 | - */ |
|
42 | - public static function enqueue_styles_and_scripts() |
|
43 | - { |
|
44 | - // load css |
|
45 | - wp_register_style( |
|
46 | - 'espresso-ui-theme', |
|
47 | - EE_GLOBAL_ASSETS_URL . 'css/espresso-ui-theme/jquery-ui-1.10.3.custom.min.css', |
|
48 | - array(), |
|
49 | - EVENT_ESPRESSO_VERSION |
|
50 | - ); |
|
51 | - wp_enqueue_style('espresso-ui-theme'); |
|
52 | - } |
|
36 | + /** |
|
37 | + * enqueue_styles_and_scripts |
|
38 | + * |
|
39 | + * @access public |
|
40 | + * @return void |
|
41 | + */ |
|
42 | + public static function enqueue_styles_and_scripts() |
|
43 | + { |
|
44 | + // load css |
|
45 | + wp_register_style( |
|
46 | + 'espresso-ui-theme', |
|
47 | + EE_GLOBAL_ASSETS_URL . 'css/espresso-ui-theme/jquery-ui-1.10.3.custom.min.css', |
|
48 | + array(), |
|
49 | + EVENT_ESPRESSO_VERSION |
|
50 | + ); |
|
51 | + wp_enqueue_style('espresso-ui-theme'); |
|
52 | + } |
|
53 | 53 | } |
@@ -15,7 +15,7 @@ discard block |
||
15 | 15 | * @type bool $show_gravatar whether to show gravatar or not. |
16 | 16 | */ |
17 | 17 | |
18 | -$no_attendees_message = apply_filters( 'FHEE__loop-espresso_attendees-shortcode__template__no_attendees_message', __('No Attendees Yet', 'event_espresso' ) ); |
|
18 | +$no_attendees_message = apply_filters('FHEE__loop-espresso_attendees-shortcode__template__no_attendees_message', __('No Attendees Yet', 'event_espresso')); |
|
19 | 19 | |
20 | 20 | |
21 | 21 | ?> |
@@ -31,16 +31,16 @@ discard block |
||
31 | 31 | $show_gravatar, |
32 | 32 | ) |
33 | 33 | ); ?> |
34 | - <?php if ( $contacts ) : ?> |
|
34 | + <?php if ($contacts) : ?> |
|
35 | 35 | <ul class="event-attendees-list"> |
36 | - <?php foreach( $contacts as $contact ) : |
|
37 | - EEH_Template::get_template_part( 'content', 'espresso_event_attendees', array( |
|
36 | + <?php foreach ($contacts as $contact) : |
|
37 | + EEH_Template::get_template_part('content', 'espresso_event_attendees', array( |
|
38 | 38 | 'contact' => $contact, |
39 | 39 | 'event' => $event, |
40 | 40 | 'datetime' => $datetime, |
41 | 41 | 'ticket' => $ticket, |
42 | 42 | 'show_gravatar' => $show_gravatar |
43 | - ) ); |
|
43 | + )); |
|
44 | 44 | endforeach; ?> |
45 | 45 | </ul> |
46 | 46 | <?php else : ?> |
@@ -22,15 +22,15 @@ discard block |
||
22 | 22 | |
23 | 23 | <div class="event-attendees"> |
24 | 24 | <?php do_action_ref_array( |
25 | - 'AHEE__loop-espresso_event_attendees__before', |
|
26 | - array( |
|
27 | - $contacts, |
|
28 | - $event, |
|
29 | - $datetime, |
|
30 | - $ticket, |
|
31 | - $show_gravatar, |
|
32 | - ) |
|
33 | - ); ?> |
|
25 | + 'AHEE__loop-espresso_event_attendees__before', |
|
26 | + array( |
|
27 | + $contacts, |
|
28 | + $event, |
|
29 | + $datetime, |
|
30 | + $ticket, |
|
31 | + $show_gravatar, |
|
32 | + ) |
|
33 | + ); ?> |
|
34 | 34 | <?php if ( $contacts ) : ?> |
35 | 35 | <ul class="event-attendees-list"> |
36 | 36 | <?php foreach( $contacts as $contact ) : |
@@ -47,13 +47,13 @@ discard block |
||
47 | 47 | <p><?php echo esc_html($no_attendees_message); ?></p> |
48 | 48 | <?php endif; ?> |
49 | 49 | <?php do_action_ref_array( |
50 | - 'AHEE__loop-espresso_event_attendees__after', |
|
51 | - array( |
|
52 | - $contacts, |
|
53 | - $event, |
|
54 | - $datetime, |
|
55 | - $ticket, |
|
56 | - $show_gravatar, |
|
57 | - ) |
|
58 | - ); ?> |
|
50 | + 'AHEE__loop-espresso_event_attendees__after', |
|
51 | + array( |
|
52 | + $contacts, |
|
53 | + $event, |
|
54 | + $datetime, |
|
55 | + $ticket, |
|
56 | + $show_gravatar, |
|
57 | + ) |
|
58 | + ); ?> |
|
59 | 59 | </div> |
60 | 60 | \ No newline at end of file |
@@ -43,8 +43,11 @@ |
||
43 | 43 | ) ); |
44 | 44 | endforeach; ?> |
45 | 45 | </ul> |
46 | - <?php else : ?> |
|
47 | - <p><?php echo esc_html($no_attendees_message); ?></p> |
|
46 | + <?php else { |
|
47 | + : ?> |
|
48 | + <p><?php echo esc_html($no_attendees_message); |
|
49 | +} |
|
50 | +?></p> |
|
48 | 51 | <?php endif; ?> |
49 | 52 | <?php do_action_ref_array( |
50 | 53 | 'AHEE__loop-espresso_event_attendees__after', |
@@ -36,7 +36,7 @@ |
||
36 | 36 | $error_string = esc_html__('The following errors occurred:', 'event_espresso'); |
37 | 37 | foreach ($notices->getError() as $notice) { |
38 | 38 | if ($this->getThrowExceptions()) { |
39 | - $error_string .= '<br />' . $notice->message(); |
|
39 | + $error_string .= '<br />'.$notice->message(); |
|
40 | 40 | } else { |
41 | 41 | new AdminNotice($notice); |
42 | 42 | } |
@@ -13,42 +13,42 @@ |
||
13 | 13 | */ |
14 | 14 | class ConvertNoticesToAdminNotices extends NoticeConverter |
15 | 15 | { |
16 | - /** |
|
17 | - * Converts Notice objects into AdminNotice notifications |
|
18 | - * |
|
19 | - * @param NoticesContainerInterface $notices |
|
20 | - * @throws DomainException |
|
21 | - */ |
|
22 | - public function process(NoticesContainerInterface $notices) |
|
23 | - { |
|
24 | - if ($notices->hasAttention()) { |
|
25 | - foreach ($notices->getAttention() as $notice) { |
|
26 | - new AdminNotice($notice); |
|
27 | - } |
|
28 | - } |
|
29 | - if ($notices->hasError()) { |
|
30 | - $error_string = esc_html__('The following errors occurred:', 'event_espresso'); |
|
31 | - foreach ($notices->getError() as $notice) { |
|
32 | - if ($this->getThrowExceptions()) { |
|
33 | - $error_string .= '<br />' . $notice->message(); |
|
34 | - } else { |
|
35 | - new AdminNotice($notice); |
|
36 | - } |
|
37 | - } |
|
38 | - if ($this->getThrowExceptions()) { |
|
39 | - throw new DomainException($error_string); |
|
40 | - } |
|
41 | - } |
|
42 | - if ($notices->hasSuccess()) { |
|
43 | - foreach ($notices->getSuccess() as $notice) { |
|
44 | - new AdminNotice($notice); |
|
45 | - } |
|
46 | - } |
|
47 | - if ($notices->hasInformation()) { |
|
48 | - foreach ($notices->getInformation() as $notice) { |
|
49 | - new AdminNotice($notice); |
|
50 | - } |
|
51 | - } |
|
52 | - $this->clearNotices(); |
|
53 | - } |
|
16 | + /** |
|
17 | + * Converts Notice objects into AdminNotice notifications |
|
18 | + * |
|
19 | + * @param NoticesContainerInterface $notices |
|
20 | + * @throws DomainException |
|
21 | + */ |
|
22 | + public function process(NoticesContainerInterface $notices) |
|
23 | + { |
|
24 | + if ($notices->hasAttention()) { |
|
25 | + foreach ($notices->getAttention() as $notice) { |
|
26 | + new AdminNotice($notice); |
|
27 | + } |
|
28 | + } |
|
29 | + if ($notices->hasError()) { |
|
30 | + $error_string = esc_html__('The following errors occurred:', 'event_espresso'); |
|
31 | + foreach ($notices->getError() as $notice) { |
|
32 | + if ($this->getThrowExceptions()) { |
|
33 | + $error_string .= '<br />' . $notice->message(); |
|
34 | + } else { |
|
35 | + new AdminNotice($notice); |
|
36 | + } |
|
37 | + } |
|
38 | + if ($this->getThrowExceptions()) { |
|
39 | + throw new DomainException($error_string); |
|
40 | + } |
|
41 | + } |
|
42 | + if ($notices->hasSuccess()) { |
|
43 | + foreach ($notices->getSuccess() as $notice) { |
|
44 | + new AdminNotice($notice); |
|
45 | + } |
|
46 | + } |
|
47 | + if ($notices->hasInformation()) { |
|
48 | + foreach ($notices->getInformation() as $notice) { |
|
49 | + new AdminNotice($notice); |
|
50 | + } |
|
51 | + } |
|
52 | + $this->clearNotices(); |
|
53 | + } |
|
54 | 54 | } |
@@ -91,7 +91,7 @@ |
||
91 | 91 | public function __construct($slug, $description) |
92 | 92 | { |
93 | 93 | parent::__construct($slug, $description); |
94 | - if (! in_array($this->slug(), $this->validRequestTypes(), true)) { |
|
94 | + if ( ! in_array($this->slug(), $this->validRequestTypes(), true)) { |
|
95 | 95 | throw new InvalidArgumentException( |
96 | 96 | sprintf( |
97 | 97 | esc_html__( |
@@ -15,185 +15,185 @@ |
||
15 | 15 | */ |
16 | 16 | class RequestTypeContext extends Context |
17 | 17 | { |
18 | - /** |
|
19 | - * indicates that the current request involves some form of activation |
|
20 | - */ |
|
21 | - const ACTIVATION = 'activation-request'; |
|
22 | - |
|
23 | - /** |
|
24 | - * indicates that the current request is for the admin but is not being made via AJAX |
|
25 | - */ |
|
26 | - const ADMIN = 'non-ajax-admin-request'; |
|
27 | - |
|
28 | - /** |
|
29 | - * indicates that the current request is for the admin AND is being made via AJAX |
|
30 | - */ |
|
31 | - const AJAX_ADMIN = 'admin-ajax-request'; |
|
32 | - |
|
33 | - /** |
|
34 | - * indicates that the current request is for the frontend AND is being made via AJAX |
|
35 | - */ |
|
36 | - const AJAX_FRONT = 'frontend-ajax-request'; |
|
37 | - |
|
38 | - /** |
|
39 | - * indicates that the current request is for the WP Heartbeat |
|
40 | - */ |
|
41 | - const AJAX_HEARTBEAT = 'admin-ajax-heartbeat'; |
|
42 | - |
|
43 | - /** |
|
44 | - * indicates that the current request is being made via AJAX, but is NOT for EE |
|
45 | - */ |
|
46 | - const AJAX_OTHER = 'other-ajax-request'; |
|
47 | - |
|
48 | - /** |
|
49 | - * indicates that the current request is for the EE REST API |
|
50 | - */ |
|
51 | - const API = 'rest-api'; |
|
52 | - |
|
53 | - /** |
|
54 | - * indicates that the current request is from the command line |
|
55 | - */ |
|
56 | - const CLI = 'command-line'; |
|
57 | - |
|
58 | - /** |
|
59 | - * indicates that the current request is for a WP_Cron |
|
60 | - */ |
|
61 | - const CRON = 'wp-cron'; |
|
62 | - |
|
63 | - /** |
|
64 | - * indicates that the current request is for a feed (ie: RSS) |
|
65 | - */ |
|
66 | - const FEED = 'feed-request'; |
|
67 | - |
|
68 | - /** |
|
69 | - * indicates that the current request is for the frontend but is not being made via AJAX |
|
70 | - */ |
|
71 | - const FRONTEND = 'non-ajax-frontend-request'; |
|
72 | - |
|
73 | - /** |
|
74 | - * indicates that the current request is for content that is to be displayed within an iframe |
|
75 | - */ |
|
76 | - const IFRAME = 'iframe-request'; |
|
77 | - |
|
78 | - /** |
|
79 | - * indicates that the current request is for the EE GraphQL manager |
|
80 | - */ |
|
81 | - const GQL = 'graphql'; |
|
82 | - |
|
83 | - /** |
|
84 | - * indicates that the current request is for the WP REST API |
|
85 | - */ |
|
86 | - const WP_API = 'wp-rest-api'; |
|
87 | - |
|
88 | - /** |
|
89 | - * indicates that the current request is a loopback sent from WP core to test for errors |
|
90 | - */ |
|
91 | - const WP_SCRAPE = 'wordpress-scrape'; |
|
92 | - |
|
93 | - /** |
|
94 | - * @var boolean $is_activation |
|
95 | - */ |
|
96 | - private $is_activation = false; |
|
97 | - |
|
98 | - /** |
|
99 | - * @var boolean $is_unit_testing |
|
100 | - */ |
|
101 | - private $is_unit_testing = false; |
|
102 | - |
|
103 | - /** |
|
104 | - * @var array $valid_request_types |
|
105 | - */ |
|
106 | - private $valid_request_types = array(); |
|
107 | - |
|
108 | - |
|
109 | - /** |
|
110 | - * RequestTypeContext constructor. |
|
111 | - * |
|
112 | - * @param string $slug |
|
113 | - * @param string $description |
|
114 | - * @throws InvalidArgumentException |
|
115 | - */ |
|
116 | - public function __construct($slug, $description) |
|
117 | - { |
|
118 | - parent::__construct($slug, $description); |
|
119 | - if (! in_array($this->slug(), $this->validRequestTypes(), true)) { |
|
120 | - throw new InvalidArgumentException( |
|
121 | - sprintf( |
|
122 | - esc_html__( |
|
123 | - 'The RequestTypeContext slug must be one of the following values: %1$s %2$s', |
|
124 | - 'event_espresso' |
|
125 | - ), |
|
126 | - '<br />', |
|
127 | - var_export($this->validRequestTypes(), true) |
|
128 | - ) |
|
129 | - ); |
|
130 | - } |
|
131 | - } |
|
132 | - |
|
133 | - |
|
134 | - /** |
|
135 | - * @return array |
|
136 | - */ |
|
137 | - public function validRequestTypes() |
|
138 | - { |
|
139 | - if (empty($this->valid_request_types)) { |
|
140 | - $this->valid_request_types = apply_filters( |
|
141 | - 'FHEE__EventEspresso_core_domain_entities_contexts_RequestTypeContext__validRequestTypes', |
|
142 | - array( |
|
143 | - RequestTypeContext::ACTIVATION, |
|
144 | - RequestTypeContext::ADMIN, |
|
145 | - RequestTypeContext::AJAX_ADMIN, |
|
146 | - RequestTypeContext::AJAX_FRONT, |
|
147 | - RequestTypeContext::AJAX_HEARTBEAT, |
|
148 | - RequestTypeContext::AJAX_OTHER, |
|
149 | - RequestTypeContext::API, |
|
150 | - RequestTypeContext::CLI, |
|
151 | - RequestTypeContext::CRON, |
|
152 | - RequestTypeContext::FEED, |
|
153 | - RequestTypeContext::FRONTEND, |
|
154 | - RequestTypeContext::GQL, |
|
155 | - RequestTypeContext::IFRAME, |
|
156 | - RequestTypeContext::WP_API, |
|
157 | - RequestTypeContext::WP_SCRAPE, |
|
158 | - ) |
|
159 | - ); |
|
160 | - } |
|
161 | - return $this->valid_request_types; |
|
162 | - } |
|
163 | - |
|
164 | - |
|
165 | - /** |
|
166 | - * @return bool |
|
167 | - */ |
|
168 | - public function isActivation() |
|
169 | - { |
|
170 | - return $this->is_activation; |
|
171 | - } |
|
172 | - |
|
173 | - |
|
174 | - /** |
|
175 | - * @param bool $is_activation |
|
176 | - */ |
|
177 | - public function setIsActivation($is_activation = false) |
|
178 | - { |
|
179 | - $this->is_activation = filter_var($is_activation, FILTER_VALIDATE_BOOLEAN); |
|
180 | - } |
|
181 | - |
|
182 | - |
|
183 | - /** |
|
184 | - * @return bool |
|
185 | - */ |
|
186 | - public function isUnitTesting() |
|
187 | - { |
|
188 | - return $this->is_unit_testing; |
|
189 | - } |
|
190 | - |
|
191 | - |
|
192 | - /** |
|
193 | - * @param bool $is_unit_testing |
|
194 | - */ |
|
195 | - public function setIsUnitTesting($is_unit_testing = false) |
|
196 | - { |
|
197 | - $this->is_unit_testing = filter_var($is_unit_testing, FILTER_VALIDATE_BOOLEAN); |
|
198 | - } |
|
18 | + /** |
|
19 | + * indicates that the current request involves some form of activation |
|
20 | + */ |
|
21 | + const ACTIVATION = 'activation-request'; |
|
22 | + |
|
23 | + /** |
|
24 | + * indicates that the current request is for the admin but is not being made via AJAX |
|
25 | + */ |
|
26 | + const ADMIN = 'non-ajax-admin-request'; |
|
27 | + |
|
28 | + /** |
|
29 | + * indicates that the current request is for the admin AND is being made via AJAX |
|
30 | + */ |
|
31 | + const AJAX_ADMIN = 'admin-ajax-request'; |
|
32 | + |
|
33 | + /** |
|
34 | + * indicates that the current request is for the frontend AND is being made via AJAX |
|
35 | + */ |
|
36 | + const AJAX_FRONT = 'frontend-ajax-request'; |
|
37 | + |
|
38 | + /** |
|
39 | + * indicates that the current request is for the WP Heartbeat |
|
40 | + */ |
|
41 | + const AJAX_HEARTBEAT = 'admin-ajax-heartbeat'; |
|
42 | + |
|
43 | + /** |
|
44 | + * indicates that the current request is being made via AJAX, but is NOT for EE |
|
45 | + */ |
|
46 | + const AJAX_OTHER = 'other-ajax-request'; |
|
47 | + |
|
48 | + /** |
|
49 | + * indicates that the current request is for the EE REST API |
|
50 | + */ |
|
51 | + const API = 'rest-api'; |
|
52 | + |
|
53 | + /** |
|
54 | + * indicates that the current request is from the command line |
|
55 | + */ |
|
56 | + const CLI = 'command-line'; |
|
57 | + |
|
58 | + /** |
|
59 | + * indicates that the current request is for a WP_Cron |
|
60 | + */ |
|
61 | + const CRON = 'wp-cron'; |
|
62 | + |
|
63 | + /** |
|
64 | + * indicates that the current request is for a feed (ie: RSS) |
|
65 | + */ |
|
66 | + const FEED = 'feed-request'; |
|
67 | + |
|
68 | + /** |
|
69 | + * indicates that the current request is for the frontend but is not being made via AJAX |
|
70 | + */ |
|
71 | + const FRONTEND = 'non-ajax-frontend-request'; |
|
72 | + |
|
73 | + /** |
|
74 | + * indicates that the current request is for content that is to be displayed within an iframe |
|
75 | + */ |
|
76 | + const IFRAME = 'iframe-request'; |
|
77 | + |
|
78 | + /** |
|
79 | + * indicates that the current request is for the EE GraphQL manager |
|
80 | + */ |
|
81 | + const GQL = 'graphql'; |
|
82 | + |
|
83 | + /** |
|
84 | + * indicates that the current request is for the WP REST API |
|
85 | + */ |
|
86 | + const WP_API = 'wp-rest-api'; |
|
87 | + |
|
88 | + /** |
|
89 | + * indicates that the current request is a loopback sent from WP core to test for errors |
|
90 | + */ |
|
91 | + const WP_SCRAPE = 'wordpress-scrape'; |
|
92 | + |
|
93 | + /** |
|
94 | + * @var boolean $is_activation |
|
95 | + */ |
|
96 | + private $is_activation = false; |
|
97 | + |
|
98 | + /** |
|
99 | + * @var boolean $is_unit_testing |
|
100 | + */ |
|
101 | + private $is_unit_testing = false; |
|
102 | + |
|
103 | + /** |
|
104 | + * @var array $valid_request_types |
|
105 | + */ |
|
106 | + private $valid_request_types = array(); |
|
107 | + |
|
108 | + |
|
109 | + /** |
|
110 | + * RequestTypeContext constructor. |
|
111 | + * |
|
112 | + * @param string $slug |
|
113 | + * @param string $description |
|
114 | + * @throws InvalidArgumentException |
|
115 | + */ |
|
116 | + public function __construct($slug, $description) |
|
117 | + { |
|
118 | + parent::__construct($slug, $description); |
|
119 | + if (! in_array($this->slug(), $this->validRequestTypes(), true)) { |
|
120 | + throw new InvalidArgumentException( |
|
121 | + sprintf( |
|
122 | + esc_html__( |
|
123 | + 'The RequestTypeContext slug must be one of the following values: %1$s %2$s', |
|
124 | + 'event_espresso' |
|
125 | + ), |
|
126 | + '<br />', |
|
127 | + var_export($this->validRequestTypes(), true) |
|
128 | + ) |
|
129 | + ); |
|
130 | + } |
|
131 | + } |
|
132 | + |
|
133 | + |
|
134 | + /** |
|
135 | + * @return array |
|
136 | + */ |
|
137 | + public function validRequestTypes() |
|
138 | + { |
|
139 | + if (empty($this->valid_request_types)) { |
|
140 | + $this->valid_request_types = apply_filters( |
|
141 | + 'FHEE__EventEspresso_core_domain_entities_contexts_RequestTypeContext__validRequestTypes', |
|
142 | + array( |
|
143 | + RequestTypeContext::ACTIVATION, |
|
144 | + RequestTypeContext::ADMIN, |
|
145 | + RequestTypeContext::AJAX_ADMIN, |
|
146 | + RequestTypeContext::AJAX_FRONT, |
|
147 | + RequestTypeContext::AJAX_HEARTBEAT, |
|
148 | + RequestTypeContext::AJAX_OTHER, |
|
149 | + RequestTypeContext::API, |
|
150 | + RequestTypeContext::CLI, |
|
151 | + RequestTypeContext::CRON, |
|
152 | + RequestTypeContext::FEED, |
|
153 | + RequestTypeContext::FRONTEND, |
|
154 | + RequestTypeContext::GQL, |
|
155 | + RequestTypeContext::IFRAME, |
|
156 | + RequestTypeContext::WP_API, |
|
157 | + RequestTypeContext::WP_SCRAPE, |
|
158 | + ) |
|
159 | + ); |
|
160 | + } |
|
161 | + return $this->valid_request_types; |
|
162 | + } |
|
163 | + |
|
164 | + |
|
165 | + /** |
|
166 | + * @return bool |
|
167 | + */ |
|
168 | + public function isActivation() |
|
169 | + { |
|
170 | + return $this->is_activation; |
|
171 | + } |
|
172 | + |
|
173 | + |
|
174 | + /** |
|
175 | + * @param bool $is_activation |
|
176 | + */ |
|
177 | + public function setIsActivation($is_activation = false) |
|
178 | + { |
|
179 | + $this->is_activation = filter_var($is_activation, FILTER_VALIDATE_BOOLEAN); |
|
180 | + } |
|
181 | + |
|
182 | + |
|
183 | + /** |
|
184 | + * @return bool |
|
185 | + */ |
|
186 | + public function isUnitTesting() |
|
187 | + { |
|
188 | + return $this->is_unit_testing; |
|
189 | + } |
|
190 | + |
|
191 | + |
|
192 | + /** |
|
193 | + * @param bool $is_unit_testing |
|
194 | + */ |
|
195 | + public function setIsUnitTesting($is_unit_testing = false) |
|
196 | + { |
|
197 | + $this->is_unit_testing = filter_var($is_unit_testing, FILTER_VALIDATE_BOOLEAN); |
|
198 | + } |
|
199 | 199 | } |
@@ -51,7 +51,7 @@ |
||
51 | 51 | */ |
52 | 52 | public function wp_user_obj() |
53 | 53 | { |
54 | - if (! $this->_wp_user_obj) { |
|
54 | + if ( ! $this->_wp_user_obj) { |
|
55 | 55 | $this->_wp_user_obj = get_user_by('ID', $this->ID()); |
56 | 56 | } |
57 | 57 | return $this->_wp_user_obj; |
@@ -12,111 +12,111 @@ |
||
12 | 12 | */ |
13 | 13 | class EE_WP_User extends EE_Base_Class implements EEI_Admin_Links |
14 | 14 | { |
15 | - /** |
|
16 | - * @var WP_User |
|
17 | - */ |
|
18 | - protected $_wp_user_obj; |
|
19 | - |
|
20 | - |
|
21 | - /** |
|
22 | - * @param array $props_n_values |
|
23 | - * @return EE_WP_User|mixed |
|
24 | - * @throws EE_Error |
|
25 | - * @throws ReflectionException |
|
26 | - */ |
|
27 | - public static function new_instance($props_n_values = []) |
|
28 | - { |
|
29 | - $has_object = parent::_check_for_object($props_n_values, __CLASS__); |
|
30 | - return $has_object ?: new self($props_n_values); |
|
31 | - } |
|
32 | - |
|
33 | - |
|
34 | - /** |
|
35 | - * @param array $props_n_values |
|
36 | - * @return EE_WP_User |
|
37 | - * @throws EE_Error |
|
38 | - * @throws ReflectionException |
|
39 | - */ |
|
40 | - public static function new_instance_from_db($props_n_values = []) |
|
41 | - { |
|
42 | - return new self($props_n_values, true); |
|
43 | - } |
|
44 | - |
|
45 | - |
|
46 | - /** |
|
47 | - * Return a normal WP_User object (caches the object for future calls) |
|
48 | - * |
|
49 | - * @return WP_User |
|
50 | - * @throws EE_Error |
|
51 | - * @throws ReflectionException |
|
52 | - */ |
|
53 | - public function wp_user_obj() |
|
54 | - { |
|
55 | - if (! $this->_wp_user_obj) { |
|
56 | - $this->_wp_user_obj = get_user_by('ID', $this->ID()); |
|
57 | - } |
|
58 | - return $this->_wp_user_obj; |
|
59 | - } |
|
60 | - |
|
61 | - |
|
62 | - /** |
|
63 | - * Return the link to the admin details for the object. |
|
64 | - * |
|
65 | - * @return string |
|
66 | - * @throws EE_Error |
|
67 | - * @throws ReflectionException |
|
68 | - */ |
|
69 | - public function get_admin_details_link() |
|
70 | - { |
|
71 | - return $this->get_admin_edit_link(); |
|
72 | - } |
|
73 | - |
|
74 | - |
|
75 | - /** |
|
76 | - * Returns the link to the editor for the object. Sometimes this is the same as the details. |
|
77 | - * |
|
78 | - * @return string |
|
79 | - * @throws EE_Error |
|
80 | - * @throws ReflectionException |
|
81 | - */ |
|
82 | - public function get_admin_edit_link() |
|
83 | - { |
|
84 | - /** @var RequestInterface $request */ |
|
85 | - $request = LoaderFactory::getLoader()->getShared(RequestInterface::class); |
|
86 | - return esc_url( |
|
87 | - add_query_arg( |
|
88 | - 'wp_http_referer', |
|
89 | - urlencode( |
|
90 | - wp_unslash( |
|
91 | - $request->getServerParam('REQUEST_URI') |
|
92 | - ) |
|
93 | - ), |
|
94 | - get_edit_user_link($this->ID()) |
|
95 | - ) |
|
96 | - ); |
|
97 | - } |
|
98 | - |
|
99 | - |
|
100 | - /** |
|
101 | - * Returns the link to a settings page for the object. |
|
102 | - * |
|
103 | - * @return string |
|
104 | - * @throws EE_Error |
|
105 | - * @throws ReflectionException |
|
106 | - */ |
|
107 | - public function get_admin_settings_link() |
|
108 | - { |
|
109 | - return $this->get_admin_edit_link(); |
|
110 | - } |
|
111 | - |
|
112 | - |
|
113 | - /** |
|
114 | - * Returns the link to the "overview" for the object (typically the "list table" view). |
|
115 | - * |
|
116 | - * @return string |
|
117 | - */ |
|
118 | - public function get_admin_overview_link() |
|
119 | - { |
|
120 | - return admin_url('users.php'); |
|
121 | - } |
|
15 | + /** |
|
16 | + * @var WP_User |
|
17 | + */ |
|
18 | + protected $_wp_user_obj; |
|
19 | + |
|
20 | + |
|
21 | + /** |
|
22 | + * @param array $props_n_values |
|
23 | + * @return EE_WP_User|mixed |
|
24 | + * @throws EE_Error |
|
25 | + * @throws ReflectionException |
|
26 | + */ |
|
27 | + public static function new_instance($props_n_values = []) |
|
28 | + { |
|
29 | + $has_object = parent::_check_for_object($props_n_values, __CLASS__); |
|
30 | + return $has_object ?: new self($props_n_values); |
|
31 | + } |
|
32 | + |
|
33 | + |
|
34 | + /** |
|
35 | + * @param array $props_n_values |
|
36 | + * @return EE_WP_User |
|
37 | + * @throws EE_Error |
|
38 | + * @throws ReflectionException |
|
39 | + */ |
|
40 | + public static function new_instance_from_db($props_n_values = []) |
|
41 | + { |
|
42 | + return new self($props_n_values, true); |
|
43 | + } |
|
44 | + |
|
45 | + |
|
46 | + /** |
|
47 | + * Return a normal WP_User object (caches the object for future calls) |
|
48 | + * |
|
49 | + * @return WP_User |
|
50 | + * @throws EE_Error |
|
51 | + * @throws ReflectionException |
|
52 | + */ |
|
53 | + public function wp_user_obj() |
|
54 | + { |
|
55 | + if (! $this->_wp_user_obj) { |
|
56 | + $this->_wp_user_obj = get_user_by('ID', $this->ID()); |
|
57 | + } |
|
58 | + return $this->_wp_user_obj; |
|
59 | + } |
|
60 | + |
|
61 | + |
|
62 | + /** |
|
63 | + * Return the link to the admin details for the object. |
|
64 | + * |
|
65 | + * @return string |
|
66 | + * @throws EE_Error |
|
67 | + * @throws ReflectionException |
|
68 | + */ |
|
69 | + public function get_admin_details_link() |
|
70 | + { |
|
71 | + return $this->get_admin_edit_link(); |
|
72 | + } |
|
73 | + |
|
74 | + |
|
75 | + /** |
|
76 | + * Returns the link to the editor for the object. Sometimes this is the same as the details. |
|
77 | + * |
|
78 | + * @return string |
|
79 | + * @throws EE_Error |
|
80 | + * @throws ReflectionException |
|
81 | + */ |
|
82 | + public function get_admin_edit_link() |
|
83 | + { |
|
84 | + /** @var RequestInterface $request */ |
|
85 | + $request = LoaderFactory::getLoader()->getShared(RequestInterface::class); |
|
86 | + return esc_url( |
|
87 | + add_query_arg( |
|
88 | + 'wp_http_referer', |
|
89 | + urlencode( |
|
90 | + wp_unslash( |
|
91 | + $request->getServerParam('REQUEST_URI') |
|
92 | + ) |
|
93 | + ), |
|
94 | + get_edit_user_link($this->ID()) |
|
95 | + ) |
|
96 | + ); |
|
97 | + } |
|
98 | + |
|
99 | + |
|
100 | + /** |
|
101 | + * Returns the link to a settings page for the object. |
|
102 | + * |
|
103 | + * @return string |
|
104 | + * @throws EE_Error |
|
105 | + * @throws ReflectionException |
|
106 | + */ |
|
107 | + public function get_admin_settings_link() |
|
108 | + { |
|
109 | + return $this->get_admin_edit_link(); |
|
110 | + } |
|
111 | + |
|
112 | + |
|
113 | + /** |
|
114 | + * Returns the link to the "overview" for the object (typically the "list table" view). |
|
115 | + * |
|
116 | + * @return string |
|
117 | + */ |
|
118 | + public function get_admin_overview_link() |
|
119 | + { |
|
120 | + return admin_url('users.php'); |
|
121 | + } |
|
122 | 122 | } |
@@ -78,7 +78,7 @@ |
||
78 | 78 | public function preProductionVersionAdminNotice() |
79 | 79 | { |
80 | 80 | new PersistentAdminNotice( |
81 | - 'preProductionVersionAdminNotice_' . EVENT_ESPRESSO_VERSION, |
|
81 | + 'preProductionVersionAdminNotice_'.EVENT_ESPRESSO_VERSION, |
|
82 | 82 | $this->warningNotice() |
83 | 83 | ); |
84 | 84 | } |
@@ -18,91 +18,91 @@ |
||
18 | 18 | */ |
19 | 19 | class PreProductionVersionWarning extends Middleware |
20 | 20 | { |
21 | - /** |
|
22 | - * converts a Request to a Response |
|
23 | - * |
|
24 | - * @param RequestInterface $request |
|
25 | - * @param ResponseInterface $response |
|
26 | - * @return ResponseInterface |
|
27 | - */ |
|
28 | - public function handleRequest(RequestInterface $request, ResponseInterface $response) |
|
29 | - { |
|
30 | - $this->request = $request; |
|
31 | - $this->response = $response; |
|
32 | - $this->displayPreProductionVersionWarning(); |
|
33 | - $this->response = $this->processRequestStack($this->request, $this->response); |
|
34 | - return $this->response; |
|
35 | - } |
|
21 | + /** |
|
22 | + * converts a Request to a Response |
|
23 | + * |
|
24 | + * @param RequestInterface $request |
|
25 | + * @param ResponseInterface $response |
|
26 | + * @return ResponseInterface |
|
27 | + */ |
|
28 | + public function handleRequest(RequestInterface $request, ResponseInterface $response) |
|
29 | + { |
|
30 | + $this->request = $request; |
|
31 | + $this->response = $response; |
|
32 | + $this->displayPreProductionVersionWarning(); |
|
33 | + $this->response = $this->processRequestStack($this->request, $this->response); |
|
34 | + return $this->response; |
|
35 | + } |
|
36 | 36 | |
37 | 37 | |
38 | - /** |
|
39 | - * displays message on frontend of site notifying admin that EE has been temporarily placed into maintenance mode |
|
40 | - * |
|
41 | - * @return void |
|
42 | - */ |
|
43 | - public function displayPreProductionVersionWarning() |
|
44 | - { |
|
45 | - // skip AJAX requests |
|
46 | - if ($this->request->isAjax()) { |
|
47 | - return; |
|
48 | - } |
|
49 | - // skip stable releases |
|
50 | - if (substr(EVENT_ESPRESSO_VERSION, -5) !== '.beta') { |
|
51 | - return; |
|
52 | - } |
|
53 | - // site admin has authorized use of non-stable release candidate for production |
|
54 | - if (defined('ALLOW_NON_STABLE_RELEASE_ON_LIVE_SITE') && ALLOW_NON_STABLE_RELEASE_ON_LIVE_SITE) { |
|
55 | - return; |
|
56 | - } |
|
57 | - // post release candidate warning |
|
58 | - if ($this->request->isAdmin()) { |
|
59 | - add_action('admin_notices', array($this, 'preProductionVersionAdminNotice'), -999); |
|
60 | - } else { |
|
61 | - add_action('shutdown', array($this, 'preProductionVersionWarningNotice'), 10); |
|
62 | - } |
|
63 | - } |
|
38 | + /** |
|
39 | + * displays message on frontend of site notifying admin that EE has been temporarily placed into maintenance mode |
|
40 | + * |
|
41 | + * @return void |
|
42 | + */ |
|
43 | + public function displayPreProductionVersionWarning() |
|
44 | + { |
|
45 | + // skip AJAX requests |
|
46 | + if ($this->request->isAjax()) { |
|
47 | + return; |
|
48 | + } |
|
49 | + // skip stable releases |
|
50 | + if (substr(EVENT_ESPRESSO_VERSION, -5) !== '.beta') { |
|
51 | + return; |
|
52 | + } |
|
53 | + // site admin has authorized use of non-stable release candidate for production |
|
54 | + if (defined('ALLOW_NON_STABLE_RELEASE_ON_LIVE_SITE') && ALLOW_NON_STABLE_RELEASE_ON_LIVE_SITE) { |
|
55 | + return; |
|
56 | + } |
|
57 | + // post release candidate warning |
|
58 | + if ($this->request->isAdmin()) { |
|
59 | + add_action('admin_notices', array($this, 'preProductionVersionAdminNotice'), -999); |
|
60 | + } else { |
|
61 | + add_action('shutdown', array($this, 'preProductionVersionWarningNotice'), 10); |
|
62 | + } |
|
63 | + } |
|
64 | 64 | |
65 | 65 | |
66 | - /** |
|
67 | - * displays admin notice that current version of EE is not a stable release |
|
68 | - * |
|
69 | - * @return void |
|
70 | - * @throws InvalidDataTypeException |
|
71 | - */ |
|
72 | - public function preProductionVersionAdminNotice() |
|
73 | - { |
|
74 | - new PersistentAdminNotice( |
|
75 | - 'preProductionVersionAdminNotice_' . EVENT_ESPRESSO_VERSION, |
|
76 | - $this->warningNotice() |
|
77 | - ); |
|
78 | - } |
|
66 | + /** |
|
67 | + * displays admin notice that current version of EE is not a stable release |
|
68 | + * |
|
69 | + * @return void |
|
70 | + * @throws InvalidDataTypeException |
|
71 | + */ |
|
72 | + public function preProductionVersionAdminNotice() |
|
73 | + { |
|
74 | + new PersistentAdminNotice( |
|
75 | + 'preProductionVersionAdminNotice_' . EVENT_ESPRESSO_VERSION, |
|
76 | + $this->warningNotice() |
|
77 | + ); |
|
78 | + } |
|
79 | 79 | |
80 | 80 | |
81 | - /** |
|
82 | - * displays message on frontend of site notifying admin that current version of EE is not a stable release |
|
83 | - * |
|
84 | - * @return void |
|
85 | - */ |
|
86 | - public function preProductionVersionWarningNotice() |
|
87 | - { |
|
88 | - echo '<div id="ee-release-candidate-notice-dv" class="ee-really-important-notice-dv"><p>'; |
|
89 | - echo wp_kses($this->warningNotice(), AllowedTags::getAllowedTags()); |
|
90 | - echo '</p></div>'; |
|
91 | - } |
|
81 | + /** |
|
82 | + * displays message on frontend of site notifying admin that current version of EE is not a stable release |
|
83 | + * |
|
84 | + * @return void |
|
85 | + */ |
|
86 | + public function preProductionVersionWarningNotice() |
|
87 | + { |
|
88 | + echo '<div id="ee-release-candidate-notice-dv" class="ee-really-important-notice-dv"><p>'; |
|
89 | + echo wp_kses($this->warningNotice(), AllowedTags::getAllowedTags()); |
|
90 | + echo '</p></div>'; |
|
91 | + } |
|
92 | 92 | |
93 | 93 | |
94 | - /** |
|
95 | - * @return string |
|
96 | - */ |
|
97 | - private function warningNotice() |
|
98 | - { |
|
99 | - return sprintf( |
|
100 | - esc_html__( |
|
101 | - 'This version of Event Espresso is for testing and/or evaluation purposes only. It is %1$snot%2$s considered a stable release and should therefore %1$snot%2$s be activated on a live or production website.', |
|
102 | - 'event_espresso' |
|
103 | - ), |
|
104 | - '<strong>', |
|
105 | - '</strong>' |
|
106 | - ); |
|
107 | - } |
|
94 | + /** |
|
95 | + * @return string |
|
96 | + */ |
|
97 | + private function warningNotice() |
|
98 | + { |
|
99 | + return sprintf( |
|
100 | + esc_html__( |
|
101 | + 'This version of Event Espresso is for testing and/or evaluation purposes only. It is %1$snot%2$s considered a stable release and should therefore %1$snot%2$s be activated on a live or production website.', |
|
102 | + 'event_espresso' |
|
103 | + ), |
|
104 | + '<strong>', |
|
105 | + '</strong>' |
|
106 | + ); |
|
107 | + } |
|
108 | 108 | } |