@@ -40,10 +40,10 @@ discard block |
||
40 | 40 | */ |
41 | 41 | public static function verify_is_array_of($variable_to_test, $name_of_variable, $class_name, $allow_null = 'allow_null') |
42 | 42 | { |
43 | - if (!WP_DEBUG) { |
|
43 | + if ( ! WP_DEBUG) { |
|
44 | 44 | return; |
45 | 45 | } |
46 | - self::verify_argument_is_one_of($allow_null, 'allow_null', array('allow_null','do_not_allow_null')); |
|
46 | + self::verify_argument_is_one_of($allow_null, 'allow_null', array('allow_null', 'do_not_allow_null')); |
|
47 | 47 | if ('allow_null' == $allow_null && is_null($variable_to_test)) { |
48 | 48 | return; |
49 | 49 | } |
@@ -66,7 +66,7 @@ discard block |
||
66 | 66 | */ |
67 | 67 | public static function verify_isnt_null($variable_to_test, $name_of_variable) |
68 | 68 | { |
69 | - if (!WP_DEBUG) { |
|
69 | + if ( ! WP_DEBUG) { |
|
70 | 70 | return; |
71 | 71 | } |
72 | 72 | if ($variable_to_test == null && $variable_to_test != 0 && $variable_to_test != false) { |
@@ -86,10 +86,10 @@ discard block |
||
86 | 86 | */ |
87 | 87 | public static function verify_is_true($expression_to_test, $expression_string_representation) |
88 | 88 | { |
89 | - if (!WP_DEBUG) { |
|
89 | + if ( ! WP_DEBUG) { |
|
90 | 90 | return; |
91 | 91 | } |
92 | - if (!$expression_to_test) { |
|
92 | + if ( ! $expression_to_test) { |
|
93 | 93 | $error[] = esc_html__('Template error.', 'event_espresso'); |
94 | 94 | $error[] = esc_html__("%s evaluated to false, but it must be true!", 'event_espresso'); |
95 | 95 | throw new EE_Error(sprintf(implode(",", $error), $expression_string_representation)); |
@@ -110,14 +110,14 @@ discard block |
||
110 | 110 | */ |
111 | 111 | public static function verify_instanceof($variable_to_test, $name_of_variable, $class_name, $allow_null = 'do_not_allow_null') |
112 | 112 | { |
113 | - if (!WP_DEBUG) { |
|
113 | + if ( ! WP_DEBUG) { |
|
114 | 114 | return; |
115 | 115 | } |
116 | - self::verify_argument_is_one_of($allow_null, 'allow_null', array('allow_null','do_not_allow_null')); |
|
116 | + self::verify_argument_is_one_of($allow_null, 'allow_null', array('allow_null', 'do_not_allow_null')); |
|
117 | 117 | if ($allow_null == 'allow_null' && is_null($variable_to_test)) { |
118 | 118 | return; |
119 | 119 | } |
120 | - if ($variable_to_test == null || ! ( $variable_to_test instanceof $class_name )) { |
|
120 | + if ($variable_to_test == null || ! ($variable_to_test instanceof $class_name)) { |
|
121 | 121 | $msg[] = esc_html__('Variable %s is not of the correct type.', 'event_espresso'); |
122 | 122 | $msg[] = esc_html__("It should be of type %s", 'event_espresso'); |
123 | 123 | throw new EE_Error(sprintf(implode(",", $msg), $name_of_variable, $name_of_variable, $class_name)); |
@@ -138,14 +138,14 @@ discard block |
||
138 | 138 | */ |
139 | 139 | public static function verify_is_array($variable_to_test, $variable_name, $allow_empty = 'allow_empty') |
140 | 140 | { |
141 | - if (!WP_DEBUG) { |
|
141 | + if ( ! WP_DEBUG) { |
|
142 | 142 | return; |
143 | 143 | } |
144 | - self::verify_argument_is_one_of($allow_empty, $variable_name, array('allow_empty','do_not_allow_empty')); |
|
144 | + self::verify_argument_is_one_of($allow_empty, $variable_name, array('allow_empty', 'do_not_allow_empty')); |
|
145 | 145 | if (empty($variable_to_test) && 'allow_empty' == $allow_empty) { |
146 | 146 | return; |
147 | 147 | } |
148 | - if (!is_array($variable_to_test)) { |
|
148 | + if ( ! is_array($variable_to_test)) { |
|
149 | 149 | $error[] = esc_html__('Variable %s should be an array, but it is not.', 'event_espresso'); |
150 | 150 | $error[] = esc_html__("Its value is, instead '%s'", 'event_espresso'); |
151 | 151 | throw new EE_Error(sprintf(implode(",", $error), $variable_name, $variable_name, $variable_to_test)); |
@@ -168,10 +168,10 @@ discard block |
||
168 | 168 | */ |
169 | 169 | public static function verify_argument_is_one_of($variable_to_test, $variable_name, $string_options) |
170 | 170 | { |
171 | - if (!WP_DEBUG) { |
|
171 | + if ( ! WP_DEBUG) { |
|
172 | 172 | return; |
173 | 173 | } |
174 | - if (!in_array($variable_to_test, $string_options)) { |
|
174 | + if ( ! in_array($variable_to_test, $string_options)) { |
|
175 | 175 | $msg[0] = esc_html__('Malconfigured template.', 'event_espresso'); |
176 | 176 | $msg[1] = esc_html__("Variable named '%s' was set to '%s'. It can only be one of '%s'", 'event_espresso'); |
177 | 177 | throw new EE_Error(sprintf(implode("||", $msg), $variable_name, $variable_to_test, implode("', '", $string_options))); |
@@ -24,152 +24,152 @@ |
||
24 | 24 | */ |
25 | 25 | class EEH_Template_Validator |
26 | 26 | { |
27 | - /** |
|
28 | - * Throws an EE_Error if $variabel_to_test isn't an array of objects of class $class_name |
|
29 | - * @param mixed $variable_to_test |
|
30 | - * @param string $name_of_variable helpful in throwing intelligent errors |
|
31 | - * @param string $class_name eg EE_Answer, EE_Transaction, etc. |
|
32 | - * @param string $allow_null one of 'allow_null', or 'do_not_allow_null' |
|
33 | - * @return void |
|
34 | - * @throws EE_Error (indirectly) |
|
35 | - */ |
|
36 | - public static function verify_is_array_of($variable_to_test, $name_of_variable, $class_name, $allow_null = 'allow_null') |
|
37 | - { |
|
38 | - if (!WP_DEBUG) { |
|
39 | - return; |
|
40 | - } |
|
41 | - self::verify_argument_is_one_of($allow_null, 'allow_null', array('allow_null','do_not_allow_null')); |
|
42 | - if ('allow_null' == $allow_null && is_null($variable_to_test)) { |
|
43 | - return; |
|
44 | - } |
|
45 | - self::verify_is_array($variable_to_test, $name_of_variable); |
|
46 | - foreach ($variable_to_test as $key => $array_element) { |
|
47 | - self::verify_instanceof($array_element, $key, $class_name); |
|
48 | - } |
|
49 | - } |
|
50 | - |
|
51 | - |
|
52 | - |
|
53 | - |
|
54 | - |
|
55 | - /** |
|
56 | - * throws an EE_Error if $variable_to_test is null |
|
57 | - * @param mixed $variable_to_test |
|
58 | - * @param string $name_of_variable helpful for throwing intelligent errors |
|
59 | - * @return void |
|
60 | - * @throws EE_Error |
|
61 | - */ |
|
62 | - public static function verify_isnt_null($variable_to_test, $name_of_variable) |
|
63 | - { |
|
64 | - if (!WP_DEBUG) { |
|
65 | - return; |
|
66 | - } |
|
67 | - if ($variable_to_test == null && $variable_to_test != 0 && $variable_to_test != false) { |
|
68 | - $error[] = esc_html__('Variable named %s is null.', 'event_espresso'); |
|
69 | - $error[] = esc_html__("Consider looking at the stack trace to see why it wasn't set.", 'event_espresso'); |
|
70 | - throw new EE_Error(sprintf(implode(",", $error), $name_of_variable, $name_of_variable)); |
|
71 | - } |
|
72 | - } |
|
73 | - |
|
74 | - /** |
|
75 | - * When WP_DEBUG is activted, throws an error if $expression_to_test is false. |
|
76 | - * @param boolean $expression_to_test |
|
77 | - * @param string $expression_string_representation a string representation of your expression |
|
78 | - * for example, if your expression were $var1==23, then this should be '$var1==23' |
|
79 | - * @return void |
|
80 | - * @throws EE_Error |
|
81 | - */ |
|
82 | - public static function verify_is_true($expression_to_test, $expression_string_representation) |
|
83 | - { |
|
84 | - if (!WP_DEBUG) { |
|
85 | - return; |
|
86 | - } |
|
87 | - if (!$expression_to_test) { |
|
88 | - $error[] = esc_html__('Template error.', 'event_espresso'); |
|
89 | - $error[] = esc_html__("%s evaluated to false, but it must be true!", 'event_espresso'); |
|
90 | - throw new EE_Error(sprintf(implode(",", $error), $expression_string_representation)); |
|
91 | - } |
|
92 | - } |
|
93 | - |
|
94 | - |
|
95 | - |
|
96 | - |
|
97 | - |
|
98 | - /** |
|
99 | - * For verifying that a variable is indeed an object of class $class_name |
|
100 | - * @param mixed $variable_to_test |
|
101 | - * @param string $name_of_variable helpful when throwing errors |
|
102 | - * @param string $class_name eg, EE_Answer, |
|
103 | - * @return void |
|
104 | - * @throws EE_Error |
|
105 | - */ |
|
106 | - public static function verify_instanceof($variable_to_test, $name_of_variable, $class_name, $allow_null = 'do_not_allow_null') |
|
107 | - { |
|
108 | - if (!WP_DEBUG) { |
|
109 | - return; |
|
110 | - } |
|
111 | - self::verify_argument_is_one_of($allow_null, 'allow_null', array('allow_null','do_not_allow_null')); |
|
112 | - if ($allow_null == 'allow_null' && is_null($variable_to_test)) { |
|
113 | - return; |
|
114 | - } |
|
115 | - if ($variable_to_test == null || ! ( $variable_to_test instanceof $class_name )) { |
|
116 | - $msg[] = esc_html__('Variable %s is not of the correct type.', 'event_espresso'); |
|
117 | - $msg[] = esc_html__("It should be of type %s", 'event_espresso'); |
|
118 | - throw new EE_Error(sprintf(implode(",", $msg), $name_of_variable, $name_of_variable, $class_name)); |
|
119 | - } |
|
120 | - } |
|
121 | - |
|
122 | - |
|
123 | - |
|
124 | - |
|
125 | - |
|
126 | - /** |
|
127 | - * For verifying that a variable is indeed an array, else throw an EE_Error |
|
128 | - * @param type $variable_to_test |
|
129 | - * @param type $variable_name |
|
130 | - * @param type $allow_empty one of 'allow_empty' or 'do_not_allow_empty' |
|
131 | - * @return void |
|
132 | - * @throws EE_Error |
|
133 | - */ |
|
134 | - public static function verify_is_array($variable_to_test, $variable_name, $allow_empty = 'allow_empty') |
|
135 | - { |
|
136 | - if (!WP_DEBUG) { |
|
137 | - return; |
|
138 | - } |
|
139 | - self::verify_argument_is_one_of($allow_empty, $variable_name, array('allow_empty','do_not_allow_empty')); |
|
140 | - if (empty($variable_to_test) && 'allow_empty' == $allow_empty) { |
|
141 | - return; |
|
142 | - } |
|
143 | - if (!is_array($variable_to_test)) { |
|
144 | - $error[] = esc_html__('Variable %s should be an array, but it is not.', 'event_espresso'); |
|
145 | - $error[] = esc_html__("Its value is, instead '%s'", 'event_espresso'); |
|
146 | - throw new EE_Error(sprintf(implode(",", $error), $variable_name, $variable_name, $variable_to_test)); |
|
147 | - } |
|
148 | - } |
|
149 | - |
|
150 | - |
|
151 | - |
|
152 | - |
|
153 | - |
|
154 | - |
|
155 | - |
|
156 | - /** |
|
157 | - * for verifying that a variable is one of the string optiosn supplied |
|
158 | - * @param mixed $variable_to_test |
|
159 | - * @param mixed $variable_name the name you've given the variable. Eg, '$foo'. THis helps in producing better error messages |
|
160 | - * @param array $string_options an array of acceptable values |
|
161 | - * @return void |
|
162 | - * @throws EE_Error |
|
163 | - */ |
|
164 | - public static function verify_argument_is_one_of($variable_to_test, $variable_name, $string_options) |
|
165 | - { |
|
166 | - if (!WP_DEBUG) { |
|
167 | - return; |
|
168 | - } |
|
169 | - if (!in_array($variable_to_test, $string_options)) { |
|
170 | - $msg[0] = esc_html__('Malconfigured template.', 'event_espresso'); |
|
171 | - $msg[1] = esc_html__("Variable named '%s' was set to '%s'. It can only be one of '%s'", 'event_espresso'); |
|
172 | - throw new EE_Error(sprintf(implode("||", $msg), $variable_name, $variable_to_test, implode("', '", $string_options))); |
|
173 | - } |
|
174 | - } |
|
27 | + /** |
|
28 | + * Throws an EE_Error if $variabel_to_test isn't an array of objects of class $class_name |
|
29 | + * @param mixed $variable_to_test |
|
30 | + * @param string $name_of_variable helpful in throwing intelligent errors |
|
31 | + * @param string $class_name eg EE_Answer, EE_Transaction, etc. |
|
32 | + * @param string $allow_null one of 'allow_null', or 'do_not_allow_null' |
|
33 | + * @return void |
|
34 | + * @throws EE_Error (indirectly) |
|
35 | + */ |
|
36 | + public static function verify_is_array_of($variable_to_test, $name_of_variable, $class_name, $allow_null = 'allow_null') |
|
37 | + { |
|
38 | + if (!WP_DEBUG) { |
|
39 | + return; |
|
40 | + } |
|
41 | + self::verify_argument_is_one_of($allow_null, 'allow_null', array('allow_null','do_not_allow_null')); |
|
42 | + if ('allow_null' == $allow_null && is_null($variable_to_test)) { |
|
43 | + return; |
|
44 | + } |
|
45 | + self::verify_is_array($variable_to_test, $name_of_variable); |
|
46 | + foreach ($variable_to_test as $key => $array_element) { |
|
47 | + self::verify_instanceof($array_element, $key, $class_name); |
|
48 | + } |
|
49 | + } |
|
50 | + |
|
51 | + |
|
52 | + |
|
53 | + |
|
54 | + |
|
55 | + /** |
|
56 | + * throws an EE_Error if $variable_to_test is null |
|
57 | + * @param mixed $variable_to_test |
|
58 | + * @param string $name_of_variable helpful for throwing intelligent errors |
|
59 | + * @return void |
|
60 | + * @throws EE_Error |
|
61 | + */ |
|
62 | + public static function verify_isnt_null($variable_to_test, $name_of_variable) |
|
63 | + { |
|
64 | + if (!WP_DEBUG) { |
|
65 | + return; |
|
66 | + } |
|
67 | + if ($variable_to_test == null && $variable_to_test != 0 && $variable_to_test != false) { |
|
68 | + $error[] = esc_html__('Variable named %s is null.', 'event_espresso'); |
|
69 | + $error[] = esc_html__("Consider looking at the stack trace to see why it wasn't set.", 'event_espresso'); |
|
70 | + throw new EE_Error(sprintf(implode(",", $error), $name_of_variable, $name_of_variable)); |
|
71 | + } |
|
72 | + } |
|
73 | + |
|
74 | + /** |
|
75 | + * When WP_DEBUG is activted, throws an error if $expression_to_test is false. |
|
76 | + * @param boolean $expression_to_test |
|
77 | + * @param string $expression_string_representation a string representation of your expression |
|
78 | + * for example, if your expression were $var1==23, then this should be '$var1==23' |
|
79 | + * @return void |
|
80 | + * @throws EE_Error |
|
81 | + */ |
|
82 | + public static function verify_is_true($expression_to_test, $expression_string_representation) |
|
83 | + { |
|
84 | + if (!WP_DEBUG) { |
|
85 | + return; |
|
86 | + } |
|
87 | + if (!$expression_to_test) { |
|
88 | + $error[] = esc_html__('Template error.', 'event_espresso'); |
|
89 | + $error[] = esc_html__("%s evaluated to false, but it must be true!", 'event_espresso'); |
|
90 | + throw new EE_Error(sprintf(implode(",", $error), $expression_string_representation)); |
|
91 | + } |
|
92 | + } |
|
93 | + |
|
94 | + |
|
95 | + |
|
96 | + |
|
97 | + |
|
98 | + /** |
|
99 | + * For verifying that a variable is indeed an object of class $class_name |
|
100 | + * @param mixed $variable_to_test |
|
101 | + * @param string $name_of_variable helpful when throwing errors |
|
102 | + * @param string $class_name eg, EE_Answer, |
|
103 | + * @return void |
|
104 | + * @throws EE_Error |
|
105 | + */ |
|
106 | + public static function verify_instanceof($variable_to_test, $name_of_variable, $class_name, $allow_null = 'do_not_allow_null') |
|
107 | + { |
|
108 | + if (!WP_DEBUG) { |
|
109 | + return; |
|
110 | + } |
|
111 | + self::verify_argument_is_one_of($allow_null, 'allow_null', array('allow_null','do_not_allow_null')); |
|
112 | + if ($allow_null == 'allow_null' && is_null($variable_to_test)) { |
|
113 | + return; |
|
114 | + } |
|
115 | + if ($variable_to_test == null || ! ( $variable_to_test instanceof $class_name )) { |
|
116 | + $msg[] = esc_html__('Variable %s is not of the correct type.', 'event_espresso'); |
|
117 | + $msg[] = esc_html__("It should be of type %s", 'event_espresso'); |
|
118 | + throw new EE_Error(sprintf(implode(",", $msg), $name_of_variable, $name_of_variable, $class_name)); |
|
119 | + } |
|
120 | + } |
|
121 | + |
|
122 | + |
|
123 | + |
|
124 | + |
|
125 | + |
|
126 | + /** |
|
127 | + * For verifying that a variable is indeed an array, else throw an EE_Error |
|
128 | + * @param type $variable_to_test |
|
129 | + * @param type $variable_name |
|
130 | + * @param type $allow_empty one of 'allow_empty' or 'do_not_allow_empty' |
|
131 | + * @return void |
|
132 | + * @throws EE_Error |
|
133 | + */ |
|
134 | + public static function verify_is_array($variable_to_test, $variable_name, $allow_empty = 'allow_empty') |
|
135 | + { |
|
136 | + if (!WP_DEBUG) { |
|
137 | + return; |
|
138 | + } |
|
139 | + self::verify_argument_is_one_of($allow_empty, $variable_name, array('allow_empty','do_not_allow_empty')); |
|
140 | + if (empty($variable_to_test) && 'allow_empty' == $allow_empty) { |
|
141 | + return; |
|
142 | + } |
|
143 | + if (!is_array($variable_to_test)) { |
|
144 | + $error[] = esc_html__('Variable %s should be an array, but it is not.', 'event_espresso'); |
|
145 | + $error[] = esc_html__("Its value is, instead '%s'", 'event_espresso'); |
|
146 | + throw new EE_Error(sprintf(implode(",", $error), $variable_name, $variable_name, $variable_to_test)); |
|
147 | + } |
|
148 | + } |
|
149 | + |
|
150 | + |
|
151 | + |
|
152 | + |
|
153 | + |
|
154 | + |
|
155 | + |
|
156 | + /** |
|
157 | + * for verifying that a variable is one of the string optiosn supplied |
|
158 | + * @param mixed $variable_to_test |
|
159 | + * @param mixed $variable_name the name you've given the variable. Eg, '$foo'. THis helps in producing better error messages |
|
160 | + * @param array $string_options an array of acceptable values |
|
161 | + * @return void |
|
162 | + * @throws EE_Error |
|
163 | + */ |
|
164 | + public static function verify_argument_is_one_of($variable_to_test, $variable_name, $string_options) |
|
165 | + { |
|
166 | + if (!WP_DEBUG) { |
|
167 | + return; |
|
168 | + } |
|
169 | + if (!in_array($variable_to_test, $string_options)) { |
|
170 | + $msg[0] = esc_html__('Malconfigured template.', 'event_espresso'); |
|
171 | + $msg[1] = esc_html__("Variable named '%s' was set to '%s'. It can only be one of '%s'", 'event_espresso'); |
|
172 | + throw new EE_Error(sprintf(implode("||", $msg), $variable_name, $variable_to_test, implode("', '", $string_options))); |
|
173 | + } |
|
174 | + } |
|
175 | 175 | } |
@@ -7,26 +7,26 @@ |
||
7 | 7 | |
8 | 8 | class InvalidStatusException extends InvalidArgumentException |
9 | 9 | { |
10 | - /** |
|
11 | - * InvalidStatusException constructor. |
|
12 | - * @param string $status the invalid status id that was supplied |
|
13 | - * @param string $domain the name of the domain, model, or class that the status belongs to |
|
14 | - * @param string $message custom message |
|
15 | - * @param int $code |
|
16 | - * @param Exception|null $previous |
|
17 | - */ |
|
18 | - public function __construct($status, $domain, $message = '', $code = 0, Exception $previous = null) |
|
19 | - { |
|
20 | - if (empty($message)) { |
|
21 | - $message = sprintf( |
|
22 | - esc_html__( |
|
23 | - '"%1$s" is not a valid %2$s status', |
|
24 | - 'event_espresso' |
|
25 | - ), |
|
26 | - $status, |
|
27 | - $domain |
|
28 | - ); |
|
29 | - } |
|
30 | - parent::__construct($message, $code, $previous); |
|
31 | - } |
|
10 | + /** |
|
11 | + * InvalidStatusException constructor. |
|
12 | + * @param string $status the invalid status id that was supplied |
|
13 | + * @param string $domain the name of the domain, model, or class that the status belongs to |
|
14 | + * @param string $message custom message |
|
15 | + * @param int $code |
|
16 | + * @param Exception|null $previous |
|
17 | + */ |
|
18 | + public function __construct($status, $domain, $message = '', $code = 0, Exception $previous = null) |
|
19 | + { |
|
20 | + if (empty($message)) { |
|
21 | + $message = sprintf( |
|
22 | + esc_html__( |
|
23 | + '"%1$s" is not a valid %2$s status', |
|
24 | + 'event_espresso' |
|
25 | + ), |
|
26 | + $status, |
|
27 | + $domain |
|
28 | + ); |
|
29 | + } |
|
30 | + parent::__construct($message, $code, $previous); |
|
31 | + } |
|
32 | 32 | } |
@@ -1,10 +1,10 @@ |
||
1 | 1 | <?php |
2 | 2 | |
3 | 3 | printf( |
4 | - esc_html__( |
|
5 | - 'PayPal Express (Express Checkout) is an off-site payment method for accepting payments via PayPal and is available to event organizers in many countries. A PayPal premier or business account is needed to accept payments. Need a PayPal account? Call 1-855-456-1338 or %1$sclick here to sign up for a merchant account%2$s.', |
|
6 | - 'event_espresso' |
|
7 | - ), |
|
8 | - '<a href="https://eventespresso.com/go/paypalexpress/" target="_blank">', |
|
9 | - '</a>' |
|
4 | + esc_html__( |
|
5 | + 'PayPal Express (Express Checkout) is an off-site payment method for accepting payments via PayPal and is available to event organizers in many countries. A PayPal premier or business account is needed to accept payments. Need a PayPal account? Call 1-855-456-1338 or %1$sclick here to sign up for a merchant account%2$s.', |
|
6 | + 'event_espresso' |
|
7 | + ), |
|
8 | + '<a href="https://eventespresso.com/go/paypalexpress/" target="_blank">', |
|
9 | + '</a>' |
|
10 | 10 | ); |
@@ -67,7 +67,7 @@ discard block |
||
67 | 67 | $paypal_calculates_taxes = $this->get_input_value('paypal_taxes'); |
68 | 68 | $paypal_requests_address_info = $this->get_input_value('shipping_details'); |
69 | 69 | if ( |
70 | - ( $paypal_calculates_shipping || $paypal_calculates_taxes ) && |
|
70 | + ($paypal_calculates_shipping || $paypal_calculates_taxes) && |
|
71 | 71 | $paypal_requests_address_info == EE_PMT_Paypal_Standard::shipping_info_none |
72 | 72 | ) { |
73 | 73 | // they want paypal to calculate taxes or shipping. They need to ask for |
@@ -80,8 +80,8 @@ discard block |
||
80 | 80 | sprintf( |
81 | 81 | esc_html__('Automatically set "%s" to "%s" because Paypal requires address info in order to calculate shipping or taxes.', 'event_espresso'), |
82 | 82 | strip_tags($shipping_details_input->html_label_text()), |
83 | - isset($shipping_details_input_options[ EE_PMT_Paypal_Standard::shipping_info_optional ]) |
|
84 | - ? $shipping_details_input_options[ EE_PMT_Paypal_Standard::shipping_info_optional ] |
|
83 | + isset($shipping_details_input_options[EE_PMT_Paypal_Standard::shipping_info_optional]) |
|
84 | + ? $shipping_details_input_options[EE_PMT_Paypal_Standard::shipping_info_optional] |
|
85 | 85 | : esc_html__('Unknown', 'event_espresso') |
86 | 86 | ), |
87 | 87 | __FILE__, |
@@ -13,78 +13,78 @@ |
||
13 | 13 | */ |
14 | 14 | class EE_Paypal_Standard_Form extends EE_Payment_Method_Form |
15 | 15 | { |
16 | - /** |
|
17 | - * @param EE_PMT_Paypal_Standard $payment_method_type |
|
18 | - */ |
|
19 | - public function __construct($payment_method_type) |
|
20 | - { |
|
21 | - parent::__construct( |
|
22 | - array( |
|
23 | - 'payment_method_type' => $payment_method_type, |
|
24 | - 'extra_meta_inputs' => array( |
|
25 | - 'paypal_id' => new EE_Text_Input(array( |
|
26 | - 'html_label_text' => sprintf(esc_html__("Paypal Email %s", 'event_espresso'), $payment_method_type->get_help_tab_link()), |
|
27 | - 'html_help_text' => esc_html__("Typically [email protected]", 'event_espresso'), |
|
28 | - 'required' => true |
|
29 | - )), |
|
30 | - 'image_url' => new EE_Admin_File_Uploader_Input(array( |
|
31 | - 'html_help_text' => esc_html__("Used for your business/personal logo on the PayPal page", 'event_espresso'), |
|
32 | - 'html_label_text' => esc_html__('Image URL', 'event_espresso') |
|
33 | - )), |
|
34 | - 'paypal_taxes' => new EE_Yes_No_Input(array( |
|
35 | - 'html_label_text' => sprintf(esc_html__('Paypal Calculates Taxes %s', 'event_espresso'), $payment_method_type->get_help_tab_link()), |
|
36 | - 'html_help_text' => esc_html__('Whether Paypal should add taxes to the order', 'event_espresso'), |
|
37 | - 'default' => false |
|
38 | - )), |
|
39 | - 'paypal_shipping' => new EE_Yes_No_Input(array( |
|
40 | - 'html_label_text' => sprintf(esc_html__('Paypal Calculates Shipping %s', 'event_espresso'), $payment_method_type->get_help_tab_link()), |
|
41 | - 'html_help_text' => esc_html__('Whether Paypal should add shipping surcharges', 'event_espresso'), |
|
42 | - 'default' => false |
|
43 | - )), |
|
44 | - 'shipping_details' => new EE_Select_Input(array( |
|
45 | - EE_PMT_Paypal_Standard::shipping_info_none => esc_html__("Do not prompt for an address", 'event_espresso'), |
|
46 | - EE_PMT_Paypal_Standard::shipping_info_optional => esc_html__("Prompt for an address, but do not require it", 'event_espresso'), |
|
47 | - EE_PMT_Paypal_Standard::shipping_info_required => esc_html__("Prompt for an address, and require it", 'event_espresso') |
|
48 | - )) |
|
49 | - ) |
|
50 | - ) |
|
51 | - ); |
|
52 | - } |
|
16 | + /** |
|
17 | + * @param EE_PMT_Paypal_Standard $payment_method_type |
|
18 | + */ |
|
19 | + public function __construct($payment_method_type) |
|
20 | + { |
|
21 | + parent::__construct( |
|
22 | + array( |
|
23 | + 'payment_method_type' => $payment_method_type, |
|
24 | + 'extra_meta_inputs' => array( |
|
25 | + 'paypal_id' => new EE_Text_Input(array( |
|
26 | + 'html_label_text' => sprintf(esc_html__("Paypal Email %s", 'event_espresso'), $payment_method_type->get_help_tab_link()), |
|
27 | + 'html_help_text' => esc_html__("Typically [email protected]", 'event_espresso'), |
|
28 | + 'required' => true |
|
29 | + )), |
|
30 | + 'image_url' => new EE_Admin_File_Uploader_Input(array( |
|
31 | + 'html_help_text' => esc_html__("Used for your business/personal logo on the PayPal page", 'event_espresso'), |
|
32 | + 'html_label_text' => esc_html__('Image URL', 'event_espresso') |
|
33 | + )), |
|
34 | + 'paypal_taxes' => new EE_Yes_No_Input(array( |
|
35 | + 'html_label_text' => sprintf(esc_html__('Paypal Calculates Taxes %s', 'event_espresso'), $payment_method_type->get_help_tab_link()), |
|
36 | + 'html_help_text' => esc_html__('Whether Paypal should add taxes to the order', 'event_espresso'), |
|
37 | + 'default' => false |
|
38 | + )), |
|
39 | + 'paypal_shipping' => new EE_Yes_No_Input(array( |
|
40 | + 'html_label_text' => sprintf(esc_html__('Paypal Calculates Shipping %s', 'event_espresso'), $payment_method_type->get_help_tab_link()), |
|
41 | + 'html_help_text' => esc_html__('Whether Paypal should add shipping surcharges', 'event_espresso'), |
|
42 | + 'default' => false |
|
43 | + )), |
|
44 | + 'shipping_details' => new EE_Select_Input(array( |
|
45 | + EE_PMT_Paypal_Standard::shipping_info_none => esc_html__("Do not prompt for an address", 'event_espresso'), |
|
46 | + EE_PMT_Paypal_Standard::shipping_info_optional => esc_html__("Prompt for an address, but do not require it", 'event_espresso'), |
|
47 | + EE_PMT_Paypal_Standard::shipping_info_required => esc_html__("Prompt for an address, and require it", 'event_espresso') |
|
48 | + )) |
|
49 | + ) |
|
50 | + ) |
|
51 | + ); |
|
52 | + } |
|
53 | 53 | |
54 | 54 | |
55 | 55 | |
56 | - /** |
|
57 | - * @param array $req_data |
|
58 | - * @throws EE_Error |
|
59 | - */ |
|
60 | - public function _normalize($req_data) |
|
61 | - { |
|
62 | - parent::_normalize($req_data); |
|
63 | - $paypal_calculates_shipping = $this->get_input_value('paypal_shipping'); |
|
64 | - $paypal_calculates_taxes = $this->get_input_value('paypal_taxes'); |
|
65 | - $paypal_requests_address_info = $this->get_input_value('shipping_details'); |
|
66 | - if ( |
|
67 | - ( $paypal_calculates_shipping || $paypal_calculates_taxes ) && |
|
68 | - $paypal_requests_address_info == EE_PMT_Paypal_Standard::shipping_info_none |
|
69 | - ) { |
|
70 | - // they want paypal to calculate taxes or shipping. They need to ask for |
|
71 | - // address info, otherwise paypal can't calculate taxes or shipping |
|
72 | - /** @type EE_Select_Input $shipping_details_input */ |
|
73 | - $shipping_details_input = $this->get_input('shipping_details'); |
|
74 | - $shipping_details_input->set_default(EE_PMT_Paypal_Standard::shipping_info_optional); |
|
75 | - $shipping_details_input_options = $shipping_details_input->options(); |
|
76 | - EE_Error::add_attention( |
|
77 | - sprintf( |
|
78 | - esc_html__('Automatically set "%s" to "%s" because Paypal requires address info in order to calculate shipping or taxes.', 'event_espresso'), |
|
79 | - strip_tags($shipping_details_input->html_label_text()), |
|
80 | - isset($shipping_details_input_options[ EE_PMT_Paypal_Standard::shipping_info_optional ]) |
|
81 | - ? $shipping_details_input_options[ EE_PMT_Paypal_Standard::shipping_info_optional ] |
|
82 | - : esc_html__('Unknown', 'event_espresso') |
|
83 | - ), |
|
84 | - __FILE__, |
|
85 | - __FUNCTION__, |
|
86 | - __LINE__ |
|
87 | - ); |
|
88 | - } |
|
89 | - } |
|
56 | + /** |
|
57 | + * @param array $req_data |
|
58 | + * @throws EE_Error |
|
59 | + */ |
|
60 | + public function _normalize($req_data) |
|
61 | + { |
|
62 | + parent::_normalize($req_data); |
|
63 | + $paypal_calculates_shipping = $this->get_input_value('paypal_shipping'); |
|
64 | + $paypal_calculates_taxes = $this->get_input_value('paypal_taxes'); |
|
65 | + $paypal_requests_address_info = $this->get_input_value('shipping_details'); |
|
66 | + if ( |
|
67 | + ( $paypal_calculates_shipping || $paypal_calculates_taxes ) && |
|
68 | + $paypal_requests_address_info == EE_PMT_Paypal_Standard::shipping_info_none |
|
69 | + ) { |
|
70 | + // they want paypal to calculate taxes or shipping. They need to ask for |
|
71 | + // address info, otherwise paypal can't calculate taxes or shipping |
|
72 | + /** @type EE_Select_Input $shipping_details_input */ |
|
73 | + $shipping_details_input = $this->get_input('shipping_details'); |
|
74 | + $shipping_details_input->set_default(EE_PMT_Paypal_Standard::shipping_info_optional); |
|
75 | + $shipping_details_input_options = $shipping_details_input->options(); |
|
76 | + EE_Error::add_attention( |
|
77 | + sprintf( |
|
78 | + esc_html__('Automatically set "%s" to "%s" because Paypal requires address info in order to calculate shipping or taxes.', 'event_espresso'), |
|
79 | + strip_tags($shipping_details_input->html_label_text()), |
|
80 | + isset($shipping_details_input_options[ EE_PMT_Paypal_Standard::shipping_info_optional ]) |
|
81 | + ? $shipping_details_input_options[ EE_PMT_Paypal_Standard::shipping_info_optional ] |
|
82 | + : esc_html__('Unknown', 'event_espresso') |
|
83 | + ), |
|
84 | + __FILE__, |
|
85 | + __FUNCTION__, |
|
86 | + __LINE__ |
|
87 | + ); |
|
88 | + } |
|
89 | + } |
|
90 | 90 | } |
@@ -84,7 +84,7 @@ |
||
84 | 84 | . esc_html__( |
85 | 85 | 'This lock-icon means that this registration cannot be trashed. Registrations that belong to a transaction that has payments cannot be trashed. If you wish to trash this registration then you must delete all payments attached to the related transaction first.', |
86 | 86 | 'event_espresso' |
87 | - ) . '</p>'; |
|
87 | + ).'</p>'; |
|
88 | 88 | } |
89 | 89 | |
90 | 90 |
@@ -15,16 +15,16 @@ discard block |
||
15 | 15 | */ |
16 | 16 | class Registration_List_Table_Tips extends EE_Qtip_Config |
17 | 17 | { |
18 | - protected function _set_tips_array() |
|
19 | - { |
|
20 | - $this->_qtipsa = array( |
|
21 | - 0 => array( |
|
22 | - 'content_id' => 'registration-trash-lock', |
|
23 | - 'target' => '.ee-lock-icon', |
|
24 | - 'content' => $this->_registration_trash_message(), |
|
25 | - ), |
|
26 | - /** removing status strips for now because they are triggered anywhere on the row. */ |
|
27 | - /**1 => array( |
|
18 | + protected function _set_tips_array() |
|
19 | + { |
|
20 | + $this->_qtipsa = array( |
|
21 | + 0 => array( |
|
22 | + 'content_id' => 'registration-trash-lock', |
|
23 | + 'target' => '.ee-lock-icon', |
|
24 | + 'content' => $this->_registration_trash_message(), |
|
25 | + ), |
|
26 | + /** removing status strips for now because they are triggered anywhere on the row. */ |
|
27 | + /**1 => array( |
|
28 | 28 | * 'content_id' => 'registration-status-' . RegStatus::APPROVED, |
29 | 29 | * 'target' => '.reg-status-' . RegStatus::APPROVED, |
30 | 30 | * 'content' => $this->_registration_status_legend(RegStatus::APPROVED), |
@@ -74,37 +74,37 @@ discard block |
||
74 | 74 | * ) |
75 | 75 | * ) |
76 | 76 | * )/**/ |
77 | - ); |
|
78 | - } |
|
77 | + ); |
|
78 | + } |
|
79 | 79 | |
80 | 80 | |
81 | - private function _registration_trash_message() |
|
82 | - { |
|
83 | - return '<p>' |
|
84 | - . esc_html__( |
|
85 | - 'This lock-icon means that this registration cannot be trashed. Registrations that belong to a transaction that has payments cannot be trashed. If you wish to trash this registration then you must delete all payments attached to the related transaction first.', |
|
86 | - 'event_espresso' |
|
87 | - ) . '</p>'; |
|
88 | - } |
|
81 | + private function _registration_trash_message() |
|
82 | + { |
|
83 | + return '<p>' |
|
84 | + . esc_html__( |
|
85 | + 'This lock-icon means that this registration cannot be trashed. Registrations that belong to a transaction that has payments cannot be trashed. If you wish to trash this registration then you must delete all payments attached to the related transaction first.', |
|
86 | + 'event_espresso' |
|
87 | + ) . '</p>'; |
|
88 | + } |
|
89 | 89 | |
90 | 90 | |
91 | - /** |
|
92 | - * output the relevant ee-status-legend with the designated status highlighted. |
|
93 | - * |
|
94 | - * @param EEM_Registration constant $status What status is set (by class) |
|
95 | - * @return string The status legend with the related status highlighted |
|
96 | - */ |
|
97 | - private function _registration_status_legend($status) |
|
98 | - { |
|
91 | + /** |
|
92 | + * output the relevant ee-status-legend with the designated status highlighted. |
|
93 | + * |
|
94 | + * @param EEM_Registration constant $status What status is set (by class) |
|
95 | + * @return string The status legend with the related status highlighted |
|
96 | + */ |
|
97 | + private function _registration_status_legend($status) |
|
98 | + { |
|
99 | 99 | |
100 | - $status_array = array( |
|
101 | - 'approved_status' => RegStatus::APPROVED, |
|
102 | - 'pending_status' => RegStatus::PENDING_PAYMENT, |
|
103 | - 'not_approved' => RegStatus::AWAITING_REVIEW, |
|
104 | - 'declined_status' => RegStatus::DECLINED, |
|
105 | - 'cancelled_status' => RegStatus::CANCELLED, |
|
106 | - ); |
|
100 | + $status_array = array( |
|
101 | + 'approved_status' => RegStatus::APPROVED, |
|
102 | + 'pending_status' => RegStatus::PENDING_PAYMENT, |
|
103 | + 'not_approved' => RegStatus::AWAITING_REVIEW, |
|
104 | + 'declined_status' => RegStatus::DECLINED, |
|
105 | + 'cancelled_status' => RegStatus::CANCELLED, |
|
106 | + ); |
|
107 | 107 | |
108 | - return EEH_Template::status_legend($status_array, $status); |
|
109 | - } |
|
108 | + return EEH_Template::status_legend($status_array, $status); |
|
109 | + } |
|
110 | 110 | } |
@@ -21,13 +21,13 @@ |
||
21 | 21 | * define some events related constants but only if not defined (need to check because unit tests |
22 | 22 | * may load) |
23 | 23 | */ |
24 | - if (! defined('EVENTS_PG_SLUG')) { |
|
24 | + if ( ! defined('EVENTS_PG_SLUG')) { |
|
25 | 25 | define('EVENTS_PG_SLUG', 'espresso_events'); |
26 | 26 | define('EVENTS_LABEL', esc_html__('Events', 'event_espresso')); |
27 | - define('EVENTS_ADMIN', EE_ADMIN_PAGES . 'events/'); |
|
28 | - define('EVENTS_ADMIN_URL', admin_url('admin.php?page=' . EVENTS_PG_SLUG)); |
|
29 | - define('EVENTS_TEMPLATE_PATH', EVENTS_ADMIN . 'templates/'); |
|
30 | - define('EVENTS_ASSETS_URL', EE_ADMIN_PAGES_URL . 'events/assets/'); |
|
27 | + define('EVENTS_ADMIN', EE_ADMIN_PAGES.'events/'); |
|
28 | + define('EVENTS_ADMIN_URL', admin_url('admin.php?page='.EVENTS_PG_SLUG)); |
|
29 | + define('EVENTS_TEMPLATE_PATH', EVENTS_ADMIN.'templates/'); |
|
30 | + define('EVENTS_ASSETS_URL', EE_ADMIN_PAGES_URL.'events/assets/'); |
|
31 | 31 | } |
32 | 32 | parent::__construct(); |
33 | 33 | } |
@@ -14,41 +14,41 @@ |
||
14 | 14 | */ |
15 | 15 | class Events_Admin_Page_Init extends EE_Admin_Page_CPT_Init |
16 | 16 | { |
17 | - public function __construct() |
|
18 | - { |
|
19 | - /** |
|
20 | - * define some events related constants but only if not defined (need to check because unit tests |
|
21 | - * may load) |
|
22 | - */ |
|
23 | - if (! defined('EVENTS_PG_SLUG')) { |
|
24 | - define('EVENTS_PG_SLUG', 'espresso_events'); |
|
25 | - define('EVENTS_LABEL', esc_html__('Events', 'event_espresso')); |
|
26 | - define('EVENTS_ADMIN', EE_ADMIN_PAGES . 'events/'); |
|
27 | - define('EVENTS_ADMIN_URL', admin_url('admin.php?page=' . EVENTS_PG_SLUG)); |
|
28 | - define('EVENTS_TEMPLATE_PATH', EVENTS_ADMIN . 'templates/'); |
|
29 | - define('EVENTS_ASSETS_URL', EE_ADMIN_PAGES_URL . 'events/assets/'); |
|
30 | - } |
|
31 | - parent::__construct(); |
|
32 | - } |
|
17 | + public function __construct() |
|
18 | + { |
|
19 | + /** |
|
20 | + * define some events related constants but only if not defined (need to check because unit tests |
|
21 | + * may load) |
|
22 | + */ |
|
23 | + if (! defined('EVENTS_PG_SLUG')) { |
|
24 | + define('EVENTS_PG_SLUG', 'espresso_events'); |
|
25 | + define('EVENTS_LABEL', esc_html__('Events', 'event_espresso')); |
|
26 | + define('EVENTS_ADMIN', EE_ADMIN_PAGES . 'events/'); |
|
27 | + define('EVENTS_ADMIN_URL', admin_url('admin.php?page=' . EVENTS_PG_SLUG)); |
|
28 | + define('EVENTS_TEMPLATE_PATH', EVENTS_ADMIN . 'templates/'); |
|
29 | + define('EVENTS_ASSETS_URL', EE_ADMIN_PAGES_URL . 'events/assets/'); |
|
30 | + } |
|
31 | + parent::__construct(); |
|
32 | + } |
|
33 | 33 | |
34 | 34 | |
35 | - protected function _set_init_properties() |
|
36 | - { |
|
37 | - $this->label = esc_html__('Event Espresso - Event Details', 'event_espresso'); |
|
38 | - } |
|
35 | + protected function _set_init_properties() |
|
36 | + { |
|
37 | + $this->label = esc_html__('Event Espresso - Event Details', 'event_espresso'); |
|
38 | + } |
|
39 | 39 | |
40 | 40 | |
41 | - public function getMenuProperties(): array |
|
42 | - { |
|
43 | - return [ |
|
44 | - 'menu_type' => AdminMenuItem::TYPE_MENU_SUB_ITEM, |
|
45 | - 'menu_group' => 'main', |
|
46 | - 'menu_order' => 10, |
|
47 | - 'show_on_menu' => AdminMenuItem::DISPLAY_BLOG_ONLY, |
|
48 | - 'parent_slug' => 'espresso_events', |
|
49 | - 'menu_slug' => 'espresso_events', |
|
50 | - 'menu_label' => esc_html__('Events', 'event_espresso'), |
|
51 | - 'capability' => 'ee_read_events', |
|
52 | - ]; |
|
53 | - } |
|
41 | + public function getMenuProperties(): array |
|
42 | + { |
|
43 | + return [ |
|
44 | + 'menu_type' => AdminMenuItem::TYPE_MENU_SUB_ITEM, |
|
45 | + 'menu_group' => 'main', |
|
46 | + 'menu_order' => 10, |
|
47 | + 'show_on_menu' => AdminMenuItem::DISPLAY_BLOG_ONLY, |
|
48 | + 'parent_slug' => 'espresso_events', |
|
49 | + 'menu_slug' => 'espresso_events', |
|
50 | + 'menu_label' => esc_html__('Events', 'event_espresso'), |
|
51 | + 'capability' => 'ee_read_events', |
|
52 | + ]; |
|
53 | + } |
|
54 | 54 | } |
@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | |
27 | 27 | // validate that the first element in the array is an EE_Attendee object. Note that the array may be indexed by REG_ID so we will just shift off the first element. |
28 | 28 | $ctc_chk = reset($data); |
29 | - if (! $ctc_chk instanceof EE_Attendee) { |
|
29 | + if ( ! $ctc_chk instanceof EE_Attendee) { |
|
30 | 30 | throw new EE_Error(esc_html__('The EE_Message_Contacts_incoming_data class expects an array of EE_Attendee objects.', 'event_espresso')); |
31 | 31 | } |
32 | 32 | |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | { |
44 | 44 | $attendee_ids = array_filter( |
45 | 45 | array_map( |
46 | - function ($attendee) { |
|
46 | + function($attendee) { |
|
47 | 47 | if ($attendee instanceof EE_Attendee) { |
48 | 48 | return $attendee->ID(); |
49 | 49 | } |
@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | $attendee_ids = (array) $attendee_ids; |
69 | 69 | $attendees = EEM_Attendee::instance()->get_all( |
70 | 70 | array( |
71 | - array( 'ATT_ID' => array( 'IN', $attendee_ids ) ) |
|
71 | + array('ATT_ID' => array('IN', $attendee_ids)) |
|
72 | 72 | ) |
73 | 73 | ); |
74 | 74 | return $attendees; |
@@ -98,7 +98,7 @@ discard block |
||
98 | 98 | $this->payment = null; |
99 | 99 | $this->billing = array(); |
100 | 100 | $this->reg_objs = array(); |
101 | - $this->attendees = $this->events = $this->tickets = $this->datetimes = $this->questions = $this->answer = $this->registrations = array(); |
|
101 | + $this->attendees = $this->events = $this->tickets = $this->datetimes = $this->questions = $this->answer = $this->registrations = array(); |
|
102 | 102 | $this->total_ticket_count = 0; |
103 | 103 | $this->primary_attendee_data = array( |
104 | 104 | 'registration_id' => 0, |
@@ -111,11 +111,11 @@ discard block |
||
111 | 111 | foreach ($this->_data as $contact) { |
112 | 112 | $id = $contact->ID(); |
113 | 113 | $reg = $contact->get_first_related('Registration'); |
114 | - $this->attendees[ $id ]['att_obj'] = $contact; |
|
115 | - $this->attendees[ $id ]['reg_objs'][ $reg->ID() ] = $reg; |
|
116 | - $this->attendees[ $id ]['attendee_email'] = $contact->email(); |
|
117 | - $this->attendees[ $id ]['tkt_objs'] = array(); |
|
118 | - $this->attendees[ $id ]['evt_objs'] = array(); |
|
114 | + $this->attendees[$id]['att_obj'] = $contact; |
|
115 | + $this->attendees[$id]['reg_objs'][$reg->ID()] = $reg; |
|
116 | + $this->attendees[$id]['attendee_email'] = $contact->email(); |
|
117 | + $this->attendees[$id]['tkt_objs'] = array(); |
|
118 | + $this->attendees[$id]['evt_objs'] = array(); |
|
119 | 119 | } |
120 | 120 | } |
121 | 121 | } |
@@ -11,109 +11,109 @@ |
||
11 | 11 | */ |
12 | 12 | class EE_Messages_Contacts_incoming_data extends EE_Messages_incoming_data |
13 | 13 | { |
14 | - /** |
|
15 | - * Constructor. |
|
16 | - * |
|
17 | - * @since 4.3.0 |
|
18 | - * @param EE_Attendee[] $data expecting an array of EE_Attendee objects. |
|
19 | - * @throws EE_Error |
|
20 | - * @access protected |
|
21 | - */ |
|
22 | - public function __construct($data = array()) |
|
23 | - { |
|
14 | + /** |
|
15 | + * Constructor. |
|
16 | + * |
|
17 | + * @since 4.3.0 |
|
18 | + * @param EE_Attendee[] $data expecting an array of EE_Attendee objects. |
|
19 | + * @throws EE_Error |
|
20 | + * @access protected |
|
21 | + */ |
|
22 | + public function __construct($data = array()) |
|
23 | + { |
|
24 | 24 | |
25 | - // validate that the first element in the array is an EE_Attendee object. Note that the array may be indexed by REG_ID so we will just shift off the first element. |
|
26 | - $ctc_chk = reset($data); |
|
27 | - if (! $ctc_chk instanceof EE_Attendee) { |
|
28 | - throw new EE_Error(esc_html__('The EE_Message_Contacts_incoming_data class expects an array of EE_Attendee objects.', 'event_espresso')); |
|
29 | - } |
|
25 | + // validate that the first element in the array is an EE_Attendee object. Note that the array may be indexed by REG_ID so we will just shift off the first element. |
|
26 | + $ctc_chk = reset($data); |
|
27 | + if (! $ctc_chk instanceof EE_Attendee) { |
|
28 | + throw new EE_Error(esc_html__('The EE_Message_Contacts_incoming_data class expects an array of EE_Attendee objects.', 'event_espresso')); |
|
29 | + } |
|
30 | 30 | |
31 | - parent::__construct($data); |
|
32 | - } |
|
31 | + parent::__construct($data); |
|
32 | + } |
|
33 | 33 | |
34 | 34 | |
35 | - /** |
|
36 | - * @see parent class for phpdocs. |
|
37 | - * @param array $attendees |
|
38 | - * @return array |
|
39 | - */ |
|
40 | - public static function convert_data_for_persistent_storage($attendees) |
|
41 | - { |
|
42 | - $attendee_ids = array_filter( |
|
43 | - array_map( |
|
44 | - function ($attendee) { |
|
45 | - if ($attendee instanceof EE_Attendee) { |
|
46 | - return $attendee->ID(); |
|
47 | - } |
|
48 | - return false; |
|
49 | - }, |
|
50 | - $attendees |
|
51 | - ) |
|
52 | - ); |
|
53 | - return $attendee_ids; |
|
54 | - } |
|
35 | + /** |
|
36 | + * @see parent class for phpdocs. |
|
37 | + * @param array $attendees |
|
38 | + * @return array |
|
39 | + */ |
|
40 | + public static function convert_data_for_persistent_storage($attendees) |
|
41 | + { |
|
42 | + $attendee_ids = array_filter( |
|
43 | + array_map( |
|
44 | + function ($attendee) { |
|
45 | + if ($attendee instanceof EE_Attendee) { |
|
46 | + return $attendee->ID(); |
|
47 | + } |
|
48 | + return false; |
|
49 | + }, |
|
50 | + $attendees |
|
51 | + ) |
|
52 | + ); |
|
53 | + return $attendee_ids; |
|
54 | + } |
|
55 | 55 | |
56 | 56 | |
57 | 57 | |
58 | 58 | |
59 | - /** |
|
60 | - * @see parent class for phpdocs |
|
61 | - * @param array $attendee_ids |
|
62 | - * @return EE_Attendee[] |
|
63 | - */ |
|
64 | - public static function convert_data_from_persistent_storage($attendee_ids) |
|
65 | - { |
|
66 | - $attendee_ids = (array) $attendee_ids; |
|
67 | - $attendees = EEM_Attendee::instance()->get_all( |
|
68 | - array( |
|
69 | - array( 'ATT_ID' => array( 'IN', $attendee_ids ) ) |
|
70 | - ) |
|
71 | - ); |
|
72 | - return $attendees; |
|
73 | - } |
|
59 | + /** |
|
60 | + * @see parent class for phpdocs |
|
61 | + * @param array $attendee_ids |
|
62 | + * @return EE_Attendee[] |
|
63 | + */ |
|
64 | + public static function convert_data_from_persistent_storage($attendee_ids) |
|
65 | + { |
|
66 | + $attendee_ids = (array) $attendee_ids; |
|
67 | + $attendees = EEM_Attendee::instance()->get_all( |
|
68 | + array( |
|
69 | + array( 'ATT_ID' => array( 'IN', $attendee_ids ) ) |
|
70 | + ) |
|
71 | + ); |
|
72 | + return $attendees; |
|
73 | + } |
|
74 | 74 | |
75 | 75 | |
76 | 76 | |
77 | 77 | |
78 | - /** |
|
79 | - * setup the data. |
|
80 | - * |
|
81 | - * Sets up the expected data object for the messages prep using incoming registration objects. |
|
82 | - * |
|
83 | - * @since 4.3.0 |
|
84 | - * |
|
85 | - * @return void |
|
86 | - * @access protected |
|
87 | - */ |
|
88 | - protected function _setup_data() |
|
89 | - { |
|
78 | + /** |
|
79 | + * setup the data. |
|
80 | + * |
|
81 | + * Sets up the expected data object for the messages prep using incoming registration objects. |
|
82 | + * |
|
83 | + * @since 4.3.0 |
|
84 | + * |
|
85 | + * @return void |
|
86 | + * @access protected |
|
87 | + */ |
|
88 | + protected function _setup_data() |
|
89 | + { |
|
90 | 90 | |
91 | - // we'll loop through each contact and setup the data needed. Note that many properties will just be set as empty because the contacts data handler is for a very specific set of data (i.e. just what's related to the contact). |
|
92 | - $this->txn = null; |
|
93 | - $this->taxes = null; |
|
94 | - $this->grand_total_price_object = ''; |
|
95 | - $this->user_id = $this->ip_address = $this->user_agent = $this->init_access = ''; |
|
96 | - $this->payment = null; |
|
97 | - $this->billing = array(); |
|
98 | - $this->reg_objs = array(); |
|
99 | - $this->attendees = $this->events = $this->tickets = $this->datetimes = $this->questions = $this->answer = $this->registrations = array(); |
|
100 | - $this->total_ticket_count = 0; |
|
101 | - $this->primary_attendee_data = array( |
|
102 | - 'registration_id' => 0, |
|
103 | - 'att_obj' => null, |
|
104 | - 'reg_obj' => null, |
|
105 | - 'primary_att_obj' => null, |
|
106 | - 'primary_reg_obj' => null |
|
107 | - ); |
|
91 | + // we'll loop through each contact and setup the data needed. Note that many properties will just be set as empty because the contacts data handler is for a very specific set of data (i.e. just what's related to the contact). |
|
92 | + $this->txn = null; |
|
93 | + $this->taxes = null; |
|
94 | + $this->grand_total_price_object = ''; |
|
95 | + $this->user_id = $this->ip_address = $this->user_agent = $this->init_access = ''; |
|
96 | + $this->payment = null; |
|
97 | + $this->billing = array(); |
|
98 | + $this->reg_objs = array(); |
|
99 | + $this->attendees = $this->events = $this->tickets = $this->datetimes = $this->questions = $this->answer = $this->registrations = array(); |
|
100 | + $this->total_ticket_count = 0; |
|
101 | + $this->primary_attendee_data = array( |
|
102 | + 'registration_id' => 0, |
|
103 | + 'att_obj' => null, |
|
104 | + 'reg_obj' => null, |
|
105 | + 'primary_att_obj' => null, |
|
106 | + 'primary_reg_obj' => null |
|
107 | + ); |
|
108 | 108 | |
109 | - foreach ($this->_data as $contact) { |
|
110 | - $id = $contact->ID(); |
|
111 | - $reg = $contact->get_first_related('Registration'); |
|
112 | - $this->attendees[ $id ]['att_obj'] = $contact; |
|
113 | - $this->attendees[ $id ]['reg_objs'][ $reg->ID() ] = $reg; |
|
114 | - $this->attendees[ $id ]['attendee_email'] = $contact->email(); |
|
115 | - $this->attendees[ $id ]['tkt_objs'] = array(); |
|
116 | - $this->attendees[ $id ]['evt_objs'] = array(); |
|
117 | - } |
|
118 | - } |
|
109 | + foreach ($this->_data as $contact) { |
|
110 | + $id = $contact->ID(); |
|
111 | + $reg = $contact->get_first_related('Registration'); |
|
112 | + $this->attendees[ $id ]['att_obj'] = $contact; |
|
113 | + $this->attendees[ $id ]['reg_objs'][ $reg->ID() ] = $reg; |
|
114 | + $this->attendees[ $id ]['attendee_email'] = $contact->email(); |
|
115 | + $this->attendees[ $id ]['tkt_objs'] = array(); |
|
116 | + $this->attendees[ $id ]['evt_objs'] = array(); |
|
117 | + } |
|
118 | + } |
|
119 | 119 | } |
@@ -15,49 +15,49 @@ |
||
15 | 15 | class EE_Payment_Reminder_message_type extends EE_Payment_Base_message_type |
16 | 16 | { |
17 | 17 | |
18 | - public function __construct() |
|
19 | - { |
|
20 | - |
|
21 | - // setup type details for reference |
|
22 | - $this->name = 'payment_reminder'; |
|
23 | - $this->description = esc_html__('This message type is used for all payment reminder messages. These are triggered when an offline gateway registration is completed or when manually triggered via event administrators via the transaction admin page(s).', 'event_espresso'); |
|
24 | - $this->label = array( |
|
25 | - 'singular' => esc_html__('payment reminder', 'event_espresso'), |
|
26 | - 'plural' => esc_html__('payment reminders', 'event_espresso') |
|
27 | - ); |
|
28 | - $this->_master_templates = array( |
|
29 | - 'email' => 'payment' |
|
30 | - ); |
|
31 | - |
|
32 | - parent::__construct(); |
|
33 | - } |
|
34 | - |
|
35 | - |
|
36 | - |
|
37 | - /** |
|
38 | - * _set_contexts |
|
39 | - * This sets up the contexts associated with the message_type |
|
40 | - * |
|
41 | - * @access protected |
|
42 | - * @return void |
|
43 | - */ |
|
44 | - protected function _set_contexts() |
|
45 | - { |
|
46 | - $this->_context_label = array( |
|
47 | - 'label' => esc_html__('recipient', 'event_espresso'), |
|
48 | - 'plural' => esc_html__('recipients', 'event_espresso'), |
|
49 | - 'description' => esc_html__('Recipient\'s are who will receive the template. You may want different payment details sent out depending on who the recipient is', 'event_espresso') |
|
50 | - ); |
|
51 | - |
|
52 | - $this->_contexts = array( |
|
53 | - 'admin' => array( |
|
54 | - 'label' => esc_html__('Event Admin', 'event_espresso'), |
|
55 | - 'description' => esc_html__('This template is what event administrators will receive on a successful payment', 'event_espresso') |
|
56 | - ), |
|
57 | - 'primary_attendee' => array( |
|
58 | - 'label' => esc_html__('Primary Registrant', 'event_espresso'), |
|
59 | - 'description' => esc_html__('This template is what the primary registrant (the person who made the main registration) will receive on successful payment', 'event_espresso') |
|
60 | - ) |
|
61 | - ); |
|
62 | - } |
|
18 | + public function __construct() |
|
19 | + { |
|
20 | + |
|
21 | + // setup type details for reference |
|
22 | + $this->name = 'payment_reminder'; |
|
23 | + $this->description = esc_html__('This message type is used for all payment reminder messages. These are triggered when an offline gateway registration is completed or when manually triggered via event administrators via the transaction admin page(s).', 'event_espresso'); |
|
24 | + $this->label = array( |
|
25 | + 'singular' => esc_html__('payment reminder', 'event_espresso'), |
|
26 | + 'plural' => esc_html__('payment reminders', 'event_espresso') |
|
27 | + ); |
|
28 | + $this->_master_templates = array( |
|
29 | + 'email' => 'payment' |
|
30 | + ); |
|
31 | + |
|
32 | + parent::__construct(); |
|
33 | + } |
|
34 | + |
|
35 | + |
|
36 | + |
|
37 | + /** |
|
38 | + * _set_contexts |
|
39 | + * This sets up the contexts associated with the message_type |
|
40 | + * |
|
41 | + * @access protected |
|
42 | + * @return void |
|
43 | + */ |
|
44 | + protected function _set_contexts() |
|
45 | + { |
|
46 | + $this->_context_label = array( |
|
47 | + 'label' => esc_html__('recipient', 'event_espresso'), |
|
48 | + 'plural' => esc_html__('recipients', 'event_espresso'), |
|
49 | + 'description' => esc_html__('Recipient\'s are who will receive the template. You may want different payment details sent out depending on who the recipient is', 'event_espresso') |
|
50 | + ); |
|
51 | + |
|
52 | + $this->_contexts = array( |
|
53 | + 'admin' => array( |
|
54 | + 'label' => esc_html__('Event Admin', 'event_espresso'), |
|
55 | + 'description' => esc_html__('This template is what event administrators will receive on a successful payment', 'event_espresso') |
|
56 | + ), |
|
57 | + 'primary_attendee' => array( |
|
58 | + 'label' => esc_html__('Primary Registrant', 'event_espresso'), |
|
59 | + 'description' => esc_html__('This template is what the primary registrant (the person who made the main registration) will receive on successful payment', 'event_espresso') |
|
60 | + ) |
|
61 | + ); |
|
62 | + } |
|
63 | 63 | } |
@@ -15,49 +15,49 @@ |
||
15 | 15 | class EE_Payment_Declined_message_type extends EE_Payment_Base_message_type |
16 | 16 | { |
17 | 17 | |
18 | - public function __construct() |
|
19 | - { |
|
20 | - |
|
21 | - // setup type details for reference |
|
22 | - $this->name = 'payment_declined'; |
|
23 | - $this->description = esc_html__('This message type is used for all declined payment notification messages that go out including any manual payments entered by an event administrator.', 'event_espresso'); |
|
24 | - $this->label = array( |
|
25 | - 'singular' => esc_html__('payment declined', 'event_espresso'), |
|
26 | - 'plural' => esc_html__('payments declined', 'event_espresso') |
|
27 | - ); |
|
28 | - |
|
29 | - $this->_master_templates = array( |
|
30 | - 'email' => 'payment' |
|
31 | - ); |
|
32 | - |
|
33 | - parent::__construct(); |
|
34 | - } |
|
35 | - |
|
36 | - |
|
37 | - /** |
|
38 | - * _set_contexts |
|
39 | - * This sets up the contexts associated with the message_type |
|
40 | - * |
|
41 | - * @access protected |
|
42 | - * @return void |
|
43 | - */ |
|
44 | - protected function _set_contexts() |
|
45 | - { |
|
46 | - $this->_context_label = array( |
|
47 | - 'label' => esc_html__('recipient', 'event_espresso'), |
|
48 | - 'plural' => esc_html__('recipients', 'event_espresso'), |
|
49 | - 'description' => esc_html__('Recipient\'s are who will receive the template. You may want different payment details sent out depending on who the recipient is', 'event_espresso') |
|
50 | - ); |
|
51 | - |
|
52 | - $this->_contexts = array( |
|
53 | - 'admin' => array( |
|
54 | - 'label' => esc_html__('Event Admin', 'event_espresso'), |
|
55 | - 'description' => esc_html__('This template is what event administrators will receive when payment is declined', 'event_espresso') |
|
56 | - ), |
|
57 | - 'primary_attendee' => array( |
|
58 | - 'label' => esc_html__('Primary Registrant', 'event_espresso'), |
|
59 | - 'description' => esc_html__('This template is what the primary registrant (the person who made the main registration) will receive when the payment is declined', 'event_espresso') |
|
60 | - ) |
|
61 | - ); |
|
62 | - } |
|
18 | + public function __construct() |
|
19 | + { |
|
20 | + |
|
21 | + // setup type details for reference |
|
22 | + $this->name = 'payment_declined'; |
|
23 | + $this->description = esc_html__('This message type is used for all declined payment notification messages that go out including any manual payments entered by an event administrator.', 'event_espresso'); |
|
24 | + $this->label = array( |
|
25 | + 'singular' => esc_html__('payment declined', 'event_espresso'), |
|
26 | + 'plural' => esc_html__('payments declined', 'event_espresso') |
|
27 | + ); |
|
28 | + |
|
29 | + $this->_master_templates = array( |
|
30 | + 'email' => 'payment' |
|
31 | + ); |
|
32 | + |
|
33 | + parent::__construct(); |
|
34 | + } |
|
35 | + |
|
36 | + |
|
37 | + /** |
|
38 | + * _set_contexts |
|
39 | + * This sets up the contexts associated with the message_type |
|
40 | + * |
|
41 | + * @access protected |
|
42 | + * @return void |
|
43 | + */ |
|
44 | + protected function _set_contexts() |
|
45 | + { |
|
46 | + $this->_context_label = array( |
|
47 | + 'label' => esc_html__('recipient', 'event_espresso'), |
|
48 | + 'plural' => esc_html__('recipients', 'event_espresso'), |
|
49 | + 'description' => esc_html__('Recipient\'s are who will receive the template. You may want different payment details sent out depending on who the recipient is', 'event_espresso') |
|
50 | + ); |
|
51 | + |
|
52 | + $this->_contexts = array( |
|
53 | + 'admin' => array( |
|
54 | + 'label' => esc_html__('Event Admin', 'event_espresso'), |
|
55 | + 'description' => esc_html__('This template is what event administrators will receive when payment is declined', 'event_espresso') |
|
56 | + ), |
|
57 | + 'primary_attendee' => array( |
|
58 | + 'label' => esc_html__('Primary Registrant', 'event_espresso'), |
|
59 | + 'description' => esc_html__('This template is what the primary registrant (the person who made the main registration) will receive when the payment is declined', 'event_espresso') |
|
60 | + ) |
|
61 | + ); |
|
62 | + } |
|
63 | 63 | } |