@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | -if ( !defined( 'EVENT_ESPRESSO_VERSION' ) ) { |
|
3 | - exit( 'No direct script access allowed' ); |
|
2 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
3 | + exit('No direct script access allowed'); |
|
4 | 4 | } |
5 | 5 | |
6 | 6 | /** |
@@ -14,31 +14,31 @@ discard block |
||
14 | 14 | * @author Mike Nelson |
15 | 15 | * |
16 | 16 | */ |
17 | -class EE_Billing_Attendee_Info_Form extends EE_Billing_Info_Form{ |
|
17 | +class EE_Billing_Attendee_Info_Form extends EE_Billing_Info_Form { |
|
18 | 18 | |
19 | 19 | /** |
20 | 20 | * |
21 | 21 | * @param EE_Payment_Method $payment_method |
22 | 22 | * @param array $options_array @see EE_Form_Section_Proper::__construct() |
23 | 23 | */ |
24 | - public function __construct( EE_Payment_Method $payment_method, $options_array= array()){ |
|
24 | + public function __construct(EE_Payment_Method $payment_method, $options_array = array()) { |
|
25 | 25 | $options_array['subsections'] = array_merge( |
26 | 26 | array( |
27 | - 'first_name' => new EE_Text_Input( array( 'required'=>TRUE, 'html_class' => 'ee-billing-qstn ee-billing-qstn-fname', 'html_label_text' => __( 'First Name', 'event_espresso' ) ) ), |
|
28 | - 'last_name' => new EE_Text_Input( array( 'required'=>TRUE, 'html_class' => 'ee-billing-qstn ee-billing-qstn-lname', 'html_label_text' => __( 'Last Name', 'event_espresso' ) ) ), |
|
29 | - 'email' => new EE_Email_Input( array( 'required'=>TRUE, 'html_class' => 'ee-billing-qstn ee-billing-qstn-email', 'html_label_text' => __( 'Email', 'event_espresso' ) ) ), |
|
30 | - 'address' => new EE_Text_Input( array( 'html_label_text'=> __( 'Address', 'event_espresso'), 'required'=>TRUE, 'html_class' => 'ee-billing-qstn ee-billing-qstn-address' )), |
|
31 | - 'address2' => new EE_Text_Input( array( 'html_label_text'=> __( 'Address 2', 'event_espresso'), 'html_class' => 'ee-billing-qstn ee-billing-qstn-address2' )), |
|
32 | - 'city' => new EE_Text_Input( array( 'required'=>TRUE, 'html_class' => 'ee-billing-qstn ee-billing-qstn-city', 'html_label_text' => __( 'City', 'event_espresso' ) ) ), |
|
33 | - 'state' => apply_filters( 'FHEE__EE_Billing_Attendee_Info_Form__state_field', new EE_State_Select_Input( NULL, array( 'required'=>TRUE, 'html_class' => 'ee-billing-qstn ee-billing-qstn-state', 'html_label_text' => __( 'State', 'event_espresso' ) ) ) ), |
|
34 | - 'country' => apply_filters( 'FHEE__EE_Billing_Attendee_Info_Form__country_field', new EE_Country_Select_Input( NULL, array( 'required'=>TRUE, 'html_class' => 'ee-billing-qstn ee-billing-qstn-country', 'html_label_text' => __( 'Country', 'event_espresso' ) ) ) ), |
|
35 | - 'zip' => new EE_Text_Input( array( 'required'=>TRUE, 'html_class' => 'ee-billing-qstn ee-billing-qstn-zip', 'html_label_text' => __( 'Zip', 'event_espresso' ) ) ), |
|
36 | - 'phone' => new EE_Text_Input( array( 'html_class' => 'ee-billing-qstn ee-billing-qstn-phone', 'html_label_text' => __( 'Phone', 'event_espresso' ) )), |
|
27 | + 'first_name' => new EE_Text_Input(array('required'=>TRUE, 'html_class' => 'ee-billing-qstn ee-billing-qstn-fname', 'html_label_text' => __('First Name', 'event_espresso'))), |
|
28 | + 'last_name' => new EE_Text_Input(array('required'=>TRUE, 'html_class' => 'ee-billing-qstn ee-billing-qstn-lname', 'html_label_text' => __('Last Name', 'event_espresso'))), |
|
29 | + 'email' => new EE_Email_Input(array('required'=>TRUE, 'html_class' => 'ee-billing-qstn ee-billing-qstn-email', 'html_label_text' => __('Email', 'event_espresso'))), |
|
30 | + 'address' => new EE_Text_Input(array('html_label_text'=> __('Address', 'event_espresso'), 'required'=>TRUE, 'html_class' => 'ee-billing-qstn ee-billing-qstn-address')), |
|
31 | + 'address2' => new EE_Text_Input(array('html_label_text'=> __('Address 2', 'event_espresso'), 'html_class' => 'ee-billing-qstn ee-billing-qstn-address2')), |
|
32 | + 'city' => new EE_Text_Input(array('required'=>TRUE, 'html_class' => 'ee-billing-qstn ee-billing-qstn-city', 'html_label_text' => __('City', 'event_espresso'))), |
|
33 | + 'state' => apply_filters('FHEE__EE_Billing_Attendee_Info_Form__state_field', new EE_State_Select_Input(NULL, array('required'=>TRUE, 'html_class' => 'ee-billing-qstn ee-billing-qstn-state', 'html_label_text' => __('State', 'event_espresso')))), |
|
34 | + 'country' => apply_filters('FHEE__EE_Billing_Attendee_Info_Form__country_field', new EE_Country_Select_Input(NULL, array('required'=>TRUE, 'html_class' => 'ee-billing-qstn ee-billing-qstn-country', 'html_label_text' => __('Country', 'event_espresso')))), |
|
35 | + 'zip' => new EE_Text_Input(array('required'=>TRUE, 'html_class' => 'ee-billing-qstn ee-billing-qstn-zip', 'html_label_text' => __('Zip', 'event_espresso'))), |
|
36 | + 'phone' => new EE_Text_Input(array('html_class' => 'ee-billing-qstn ee-billing-qstn-phone', 'html_label_text' => __('Phone', 'event_espresso'))), |
|
37 | 37 | ), |
38 | - isset( $options_array['subsections'] ) ? $options_array['subsections'] : array() |
|
38 | + isset($options_array['subsections']) ? $options_array['subsections'] : array() |
|
39 | 39 | ); |
40 | 40 | |
41 | - parent::__construct( $payment_method, $options_array ); |
|
41 | + parent::__construct($payment_method, $options_array); |
|
42 | 42 | |
43 | 43 | } |
44 | 44 | |
@@ -46,11 +46,11 @@ discard block |
||
46 | 46 | * Sets the defaults for the billing form according to the attendee's details |
47 | 47 | * @param EE_Attendee $attendee |
48 | 48 | */ |
49 | - public function populate_from_attendee( $attendee ){ |
|
49 | + public function populate_from_attendee($attendee) { |
|
50 | 50 | $attendee = EEM_Attendee::instance()->ensure_is_obj($attendee); |
51 | 51 | /** @var $attendee EE_Attendee */ |
52 | 52 | $this->populate_defaults( |
53 | - apply_filters( 'FHEE__EE_Billing_Attendee_Info_Form__populate_from_attendee', |
|
53 | + apply_filters('FHEE__EE_Billing_Attendee_Info_Form__populate_from_attendee', |
|
54 | 54 | array( |
55 | 55 | 'first_name'=>$attendee->fname(), |
56 | 56 | 'last_name'=>$attendee->lname(), |
@@ -78,48 +78,48 @@ discard block |
||
78 | 78 | * @param \EE_Attendee $attendee - the attendee object to copy details to |
79 | 79 | * @return \EE_Attendee |
80 | 80 | */ |
81 | - public function copy_billing_form_data_to_attendee( EE_Attendee $attendee ){ |
|
81 | + public function copy_billing_form_data_to_attendee(EE_Attendee $attendee) { |
|
82 | 82 | // grab billing form data |
83 | 83 | $data = $this->valid_data(); |
84 | 84 | // copy first_name |
85 | - if ( ! empty( $data['first_name'] )) { |
|
86 | - $attendee->set_fname( $data['first_name'] ); |
|
85 | + if ( ! empty($data['first_name'])) { |
|
86 | + $attendee->set_fname($data['first_name']); |
|
87 | 87 | } |
88 | 88 | // copy last_name |
89 | - if ( ! empty( $data['last_name'] )) { |
|
90 | - $attendee->set_lname( $data['last_name'] ); |
|
89 | + if ( ! empty($data['last_name'])) { |
|
90 | + $attendee->set_lname($data['last_name']); |
|
91 | 91 | } |
92 | 92 | // copy email |
93 | - if ( ! empty( $data['email'] )) { |
|
94 | - $attendee->set_email( $data['email'] ); |
|
93 | + if ( ! empty($data['email'])) { |
|
94 | + $attendee->set_email($data['email']); |
|
95 | 95 | } |
96 | 96 | // copy address |
97 | - if ( ! empty( $data['address'] )) { |
|
98 | - $attendee->set_address( $data['address'] ); |
|
97 | + if ( ! empty($data['address'])) { |
|
98 | + $attendee->set_address($data['address']); |
|
99 | 99 | } |
100 | 100 | // copy address2 |
101 | - if ( ! empty( $data['address2'] )) { |
|
102 | - $attendee->set_address2( $data['address2'] ); |
|
101 | + if ( ! empty($data['address2'])) { |
|
102 | + $attendee->set_address2($data['address2']); |
|
103 | 103 | } |
104 | 104 | // copy city |
105 | - if ( ! empty( $data['city'] )) { |
|
106 | - $attendee->set_city( $data['city'] ); |
|
105 | + if ( ! empty($data['city'])) { |
|
106 | + $attendee->set_city($data['city']); |
|
107 | 107 | } |
108 | 108 | // copy state |
109 | - if ( ! empty( $data['state'] )) { |
|
110 | - $attendee->set_state( $data['state'] ); |
|
109 | + if ( ! empty($data['state'])) { |
|
110 | + $attendee->set_state($data['state']); |
|
111 | 111 | } |
112 | 112 | // copy country |
113 | - if ( ! empty( $data['country'] )) { |
|
114 | - $attendee->set_country( $data['country'] ); |
|
113 | + if ( ! empty($data['country'])) { |
|
114 | + $attendee->set_country($data['country']); |
|
115 | 115 | } |
116 | 116 | // copy zip |
117 | - if ( ! empty( $data['zip'] )) { |
|
118 | - $attendee->set_zip( $data['zip'] ); |
|
117 | + if ( ! empty($data['zip'])) { |
|
118 | + $attendee->set_zip($data['zip']); |
|
119 | 119 | } |
120 | 120 | // copy phone |
121 | - if ( ! empty( $data['phone'] )) { |
|
122 | - $attendee->set_phone( $data['phone'] ); |
|
121 | + if ( ! empty($data['phone'])) { |
|
122 | + $attendee->set_phone($data['phone']); |
|
123 | 123 | } |
124 | 124 | return $attendee; |
125 | 125 | } |
@@ -130,20 +130,20 @@ discard block |
||
130 | 130 | * uses info from the billing form to create a new attendee |
131 | 131 | * @return \EE_Attendee |
132 | 132 | */ |
133 | - public function create_attendee_from_billing_form_data(){ |
|
133 | + public function create_attendee_from_billing_form_data() { |
|
134 | 134 | // grab billing form data |
135 | 135 | $data = $this->valid_data(); |
136 | - return EE_Attendee::new_instance( array( |
|
137 | - 'ATT_fname' => ! empty( $data['first_name'] ) ? $data['first_name'] : '', |
|
138 | - 'ATT_lname' => ! empty( $data['last_name'] ) ? $data['last_name'] : '', |
|
139 | - 'ATT_email' => ! empty( $data['email'] ) ? $data['email'] : '', |
|
140 | - 'ATT_address' => ! empty( $data['address'] ) ? $data['address'] : '', |
|
141 | - 'ATT_address2' => ! empty( $data['address2'] ) ? $data['address2'] : '', |
|
142 | - 'ATT_city' => ! empty( $data['city'] ) ? $data['city'] : '', |
|
143 | - 'STA_ID' => ! empty( $data['state'] ) ? $data['state'] : '', |
|
144 | - 'CNT_ISO' => ! empty( $data['country'] ) ? $data['country'] : '', |
|
145 | - 'ATT_zip' => ! empty( $data['zip'] ) ? $data['zip'] : '', |
|
146 | - 'ATT_phone' => ! empty( $data['phone'] ) ? $data['phone'] : '', |
|
136 | + return EE_Attendee::new_instance(array( |
|
137 | + 'ATT_fname' => ! empty($data['first_name']) ? $data['first_name'] : '', |
|
138 | + 'ATT_lname' => ! empty($data['last_name']) ? $data['last_name'] : '', |
|
139 | + 'ATT_email' => ! empty($data['email']) ? $data['email'] : '', |
|
140 | + 'ATT_address' => ! empty($data['address']) ? $data['address'] : '', |
|
141 | + 'ATT_address2' => ! empty($data['address2']) ? $data['address2'] : '', |
|
142 | + 'ATT_city' => ! empty($data['city']) ? $data['city'] : '', |
|
143 | + 'STA_ID' => ! empty($data['state']) ? $data['state'] : '', |
|
144 | + 'CNT_ISO' => ! empty($data['country']) ? $data['country'] : '', |
|
145 | + 'ATT_zip' => ! empty($data['zip']) ? $data['zip'] : '', |
|
146 | + 'ATT_phone' => ! empty($data['phone']) ? $data['phone'] : '', |
|
147 | 147 | )); |
148 | 148 | } |
149 | 149 | } |
@@ -8,7 +8,7 @@ discard block |
||
8 | 8 | * @since 4.6 |
9 | 9 | * |
10 | 10 | */ |
11 | -class EE_Conditionally_Required_Validation_Strategy extends EE_Validation_Strategy_Base{ |
|
11 | +class EE_Conditionally_Required_Validation_Strategy extends EE_Validation_Strategy_Base { |
|
12 | 12 | |
13 | 13 | /** |
14 | 14 | * Array describing conditions necessary to make the input required. |
@@ -24,12 +24,12 @@ discard block |
||
24 | 24 | * @param string $validation_error_message |
25 | 25 | * @param array $requirement_conditions |
26 | 26 | */ |
27 | - public function __construct( $validation_error_message = null, $requirement_conditions = array() ) { |
|
28 | - if( ! $validation_error_message ){ |
|
27 | + public function __construct($validation_error_message = null, $requirement_conditions = array()) { |
|
28 | + if ( ! $validation_error_message) { |
|
29 | 29 | $validation_error_message = __("This field is required.", "event_espresso"); |
30 | 30 | } |
31 | - $this->set_requirement_conditions( $requirement_conditions ); |
|
32 | - parent::__construct( $validation_error_message ); |
|
31 | + $this->set_requirement_conditions($requirement_conditions); |
|
32 | + parent::__construct($validation_error_message); |
|
33 | 33 | } |
34 | 34 | |
35 | 35 | |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | * @throws \EE_Validation_Error |
45 | 45 | */ |
46 | 46 | public function validate($normalized_value) { |
47 | - if( |
|
47 | + if ( |
|
48 | 48 | ( |
49 | 49 | $normalized_value === '' |
50 | 50 | || $normalized_value === null |
@@ -52,8 +52,8 @@ discard block |
||
52 | 52 | ) |
53 | 53 | && $this->_input_is_required_server_side() |
54 | 54 | ) { |
55 | - throw new EE_Validation_Error( $this->get_validation_error_message(), 'required'); |
|
56 | - }else{ |
|
55 | + throw new EE_Validation_Error($this->get_validation_error_message(), 'required'); |
|
56 | + } else { |
|
57 | 57 | return true; |
58 | 58 | } |
59 | 59 | } |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | * @return array |
65 | 65 | * @throws \EE_Error |
66 | 66 | */ |
67 | - public function get_jquery_validation_rule_array(){ |
|
67 | + public function get_jquery_validation_rule_array() { |
|
68 | 68 | return array( |
69 | 69 | 'required'=> $this->_get_jquery_requirement_value(), |
70 | 70 | 'messages' => array( |
@@ -82,7 +82,7 @@ discard block |
||
82 | 82 | * |
83 | 83 | * @param array $requirement_conditions |
84 | 84 | */ |
85 | - public function set_requirement_conditions( $requirement_conditions ) { |
|
85 | + public function set_requirement_conditions($requirement_conditions) { |
|
86 | 86 | $this->requirement_conditions = (array) $requirement_conditions; |
87 | 87 | } |
88 | 88 | |
@@ -108,10 +108,10 @@ discard block |
||
108 | 108 | protected function _get_jquery_requirement_value() { |
109 | 109 | $requirement_value = ''; |
110 | 110 | $conditions = $this->get_requirement_conditions(); |
111 | - if( ! is_array( $conditions ) ){ |
|
111 | + if ( ! is_array($conditions)) { |
|
112 | 112 | EE_Error::throw_exception_if_debugging( |
113 | 113 | sprintf( |
114 | - __( 'Input requirement conditions must be an array. You provided %1$s', 'event_espresso' ), |
|
114 | + __('Input requirement conditions must be an array. You provided %1$s', 'event_espresso'), |
|
115 | 115 | $this->_input->name() |
116 | 116 | ), |
117 | 117 | __FILE__, |
@@ -120,10 +120,10 @@ discard block |
||
120 | 120 | ); |
121 | 121 | return true; |
122 | 122 | } |
123 | - if( count( $conditions ) > 1 ) { |
|
123 | + if (count($conditions) > 1) { |
|
124 | 124 | EE_Error::throw_exception_if_debugging( |
125 | 125 | sprintf( |
126 | - __( 'Required Validation Strategy does not yet support multiple conditions. You should add it! The related input is %1$s', 'event_espresso' ), |
|
126 | + __('Required Validation Strategy does not yet support multiple conditions. You should add it! The related input is %1$s', 'event_espresso'), |
|
127 | 127 | $this->_input->name() |
128 | 128 | ), |
129 | 129 | __FILE__, |
@@ -131,12 +131,12 @@ discard block |
||
131 | 131 | __LINE__ |
132 | 132 | ); |
133 | 133 | } |
134 | - foreach( $conditions as $input_path => $op_and_value ) { |
|
135 | - $input = $this->_input->find_section_from_path( $input_path ); |
|
136 | - if( ! $input instanceof EE_Form_Input_Base ) { |
|
134 | + foreach ($conditions as $input_path => $op_and_value) { |
|
135 | + $input = $this->_input->find_section_from_path($input_path); |
|
136 | + if ( ! $input instanceof EE_Form_Input_Base) { |
|
137 | 137 | EE_Error::throw_exception_if_debugging( |
138 | 138 | sprintf( |
139 | - __( 'Error encountered while setting requirement condition for input %1$s. The path %2$s does not correspond to a valid input'), |
|
139 | + __('Error encountered while setting requirement condition for input %1$s. The path %2$s does not correspond to a valid input'), |
|
140 | 140 | $this->_input->name(), |
141 | 141 | $input_path |
142 | 142 | ), |
@@ -146,14 +146,14 @@ discard block |
||
146 | 146 | ); |
147 | 147 | return false; |
148 | 148 | } |
149 | - list( $op, $value ) = $this->_validate_op_and_value( $op_and_value ); |
|
149 | + list($op, $value) = $this->_validate_op_and_value($op_and_value); |
|
150 | 150 | //ok now the jquery dependency expression depends on the input's display strategy. |
151 | - if( ! $input->get_display_strategy() instanceof EE_Select_Display_Strategy ) { |
|
151 | + if ( ! $input->get_display_strategy() instanceof EE_Select_Display_Strategy) { |
|
152 | 152 | EE_Error::throw_exception_if_debugging( |
153 | 153 | sprintf( |
154 | - __( 'Required Validation Strategy can only depend on another input which uses the EE_Select_Display_Strategy, but you specified a field "%1$s" that uses display strategy "%2$s". If you need others, please add support for it! The related input is %3$s', 'event_espresso' ), |
|
154 | + __('Required Validation Strategy can only depend on another input which uses the EE_Select_Display_Strategy, but you specified a field "%1$s" that uses display strategy "%2$s". If you need others, please add support for it! The related input is %3$s', 'event_espresso'), |
|
155 | 155 | $input->name(), |
156 | - get_class( $input->get_display_strategy() ), |
|
156 | + get_class($input->get_display_strategy()), |
|
157 | 157 | $this->_input->name() |
158 | 158 | ), |
159 | 159 | __FILE__, |
@@ -161,7 +161,7 @@ discard block |
||
161 | 161 | __LINE__ |
162 | 162 | ); |
163 | 163 | } |
164 | - $requirement_value = $input->html_id( true ) . ' option[value="' . $value . '"]:selected'; |
|
164 | + $requirement_value = $input->html_id(true).' option[value="'.$value.'"]:selected'; |
|
165 | 165 | } |
166 | 166 | return $requirement_value; |
167 | 167 | } |
@@ -179,12 +179,12 @@ discard block |
||
179 | 179 | protected function _input_is_required_server_side() { |
180 | 180 | $meets_all_requirements = true; |
181 | 181 | $conditions = $this->get_requirement_conditions(); |
182 | - foreach( $conditions as $input_path => $op_and_value ) { |
|
183 | - $input = $this->_input->find_section_from_path( $input_path ); |
|
184 | - if( ! $input instanceof EE_Form_Input_Base ) { |
|
182 | + foreach ($conditions as $input_path => $op_and_value) { |
|
183 | + $input = $this->_input->find_section_from_path($input_path); |
|
184 | + if ( ! $input instanceof EE_Form_Input_Base) { |
|
185 | 185 | EE_Error::throw_exception_if_debugging( |
186 | 186 | sprintf( |
187 | - __( 'Error encountered while setting requirement condition for input %1$s. The path %2$s does not correspond to a valid input'), |
|
187 | + __('Error encountered while setting requirement condition for input %1$s. The path %2$s does not correspond to a valid input'), |
|
188 | 188 | $this->_input->name(), |
189 | 189 | $input_path |
190 | 190 | ), |
@@ -194,13 +194,13 @@ discard block |
||
194 | 194 | ); |
195 | 195 | return false; |
196 | 196 | } |
197 | - list( $op, $value ) = $this->_validate_op_and_value( $op_and_value ); |
|
198 | - switch( $op ) { |
|
197 | + list($op, $value) = $this->_validate_op_and_value($op_and_value); |
|
198 | + switch ($op) { |
|
199 | 199 | case '=': |
200 | 200 | default: |
201 | 201 | $meets_all_requirements = $input->normalized_value() === $value; |
202 | 202 | } |
203 | - if( ! $meets_all_requirements ) { |
|
203 | + if ( ! $meets_all_requirements) { |
|
204 | 204 | break; |
205 | 205 | } |
206 | 206 | } |
@@ -217,11 +217,11 @@ discard block |
||
217 | 217 | * @return array |
218 | 218 | * @throws \EE_Error |
219 | 219 | */ |
220 | - protected function _validate_op_and_value( $op_and_value ) { |
|
221 | - if( ! isset( $op_and_value[ 0 ], $op_and_value[ 1 ] ) ) { |
|
220 | + protected function _validate_op_and_value($op_and_value) { |
|
221 | + if ( ! isset($op_and_value[0], $op_and_value[1])) { |
|
222 | 222 | EE_Error::throw_exception_if_debugging( |
223 | 223 | sprintf( |
224 | - __( 'Required Validation Strategy conditions array\'s value must be an array with two elements: an operator, and a value. It didn\'t. The related input is %1$s', 'event_espresso' ), |
|
224 | + __('Required Validation Strategy conditions array\'s value must be an array with two elements: an operator, and a value. It didn\'t. The related input is %1$s', 'event_espresso'), |
|
225 | 225 | $this->_input->name() |
226 | 226 | ), |
227 | 227 | __FILE__, |
@@ -229,12 +229,12 @@ discard block |
||
229 | 229 | __LINE__ |
230 | 230 | ); |
231 | 231 | } |
232 | - $operator = $op_and_value[ 0 ]; |
|
233 | - $value = (string) $op_and_value[ 1 ]; |
|
234 | - if( $operator !== '=' ) { |
|
232 | + $operator = $op_and_value[0]; |
|
233 | + $value = (string) $op_and_value[1]; |
|
234 | + if ($operator !== '=') { |
|
235 | 235 | EE_Error::throw_exception_if_debugging( |
236 | 236 | sprintf( |
237 | - __( 'Required Validation Strategy conditions can currently only use the equals operator. If you need others, please add support for it! The related input is %1$s', 'event_espresso' ), |
|
237 | + __('Required Validation Strategy conditions can currently only use the equals operator. If you need others, please add support for it! The related input is %1$s', 'event_espresso'), |
|
238 | 238 | $this->_input->name() |
239 | 239 | ), |
240 | 240 | __FILE__, |
@@ -242,7 +242,7 @@ discard block |
||
242 | 242 | __LINE__ |
243 | 243 | ); |
244 | 244 | } |
245 | - return array( $operator, $value ); |
|
245 | + return array($operator, $value); |
|
246 | 246 | |
247 | 247 | } |
248 | 248 | } |
@@ -53,7 +53,7 @@ |
||
53 | 53 | && $this->_input_is_required_server_side() |
54 | 54 | ) { |
55 | 55 | throw new EE_Validation_Error( $this->get_validation_error_message(), 'required'); |
56 | - }else{ |
|
56 | + } else{ |
|
57 | 57 | return true; |
58 | 58 | } |
59 | 59 | } |
@@ -33,7 +33,7 @@ |
||
33 | 33 | ! isset( $input_settings['include_whats_this_link'] ) |
34 | 34 | || ( |
35 | 35 | isset( $input_settings['include_whats_this_link'] ) |
36 | - && $input_settings['include_whats_this_link'] === true |
|
36 | + && $input_settings['include_whats_this_link'] === true |
|
37 | 37 | ) |
38 | 38 | ) { |
39 | 39 | $this->_html_label_text = sprintf( |
@@ -8,7 +8,7 @@ discard block |
||
8 | 8 | * @subpackage |
9 | 9 | * @author Mike Nelson |
10 | 10 | */ |
11 | -class EE_CVV_Input extends EE_Text_Input{ |
|
11 | +class EE_CVV_Input extends EE_Text_Input { |
|
12 | 12 | |
13 | 13 | /** |
14 | 14 | * @param array $input_settings { |
@@ -19,8 +19,8 @@ discard block |
||
19 | 19 | $this->set_sensitive_data_removal_strategy(new EE_CCV_Sensitive_Data_Removal()); |
20 | 20 | $this->_add_validation_strategy( |
21 | 21 | new EE_Text_Validation_Strategy( |
22 | - isset( $input_settings[ 'validation_error_message' ] ) |
|
23 | - ? $input_settings[ 'validation_error_message' ] |
|
22 | + isset($input_settings['validation_error_message']) |
|
23 | + ? $input_settings['validation_error_message'] |
|
24 | 24 | : __( |
25 | 25 | 'The CVV is either a 3 digit number on the back of your card, or 4 digit number on the front', |
26 | 26 | 'event_espresso' |
@@ -29,10 +29,10 @@ discard block |
||
29 | 29 | ) |
30 | 30 | ); |
31 | 31 | parent::__construct($input_settings); |
32 | - if( |
|
33 | - ! isset( $input_settings['include_whats_this_link'] ) |
|
32 | + if ( |
|
33 | + ! isset($input_settings['include_whats_this_link']) |
|
34 | 34 | || ( |
35 | - isset( $input_settings['include_whats_this_link'] ) |
|
35 | + isset($input_settings['include_whats_this_link']) |
|
36 | 36 | && $input_settings['include_whats_this_link'] === true |
37 | 37 | ) |
38 | 38 | ) { |
@@ -15,7 +15,7 @@ discard block |
||
15 | 15 | |
16 | 16 | |
17 | 17 | |
18 | -if ( ! function_exists( 'espresso_get_template_part' )) { |
|
18 | +if ( ! function_exists('espresso_get_template_part')) { |
|
19 | 19 | /** |
20 | 20 | * espresso_get_template_part |
21 | 21 | * basically a copy of the WordPress get_template_part() function but uses EEH_Template::locate_template() instead, and doesn't add base versions of files |
@@ -25,14 +25,14 @@ discard block |
||
25 | 25 | * @param string $name The name of the specialised template. |
26 | 26 | * @return string the html output for the formatted money value |
27 | 27 | */ |
28 | - function espresso_get_template_part( $slug = NULL, $name = NULL ) { |
|
29 | - EEH_Template::get_template_part( $slug, $name ); |
|
28 | + function espresso_get_template_part($slug = NULL, $name = NULL) { |
|
29 | + EEH_Template::get_template_part($slug, $name); |
|
30 | 30 | } |
31 | 31 | } |
32 | 32 | |
33 | 33 | |
34 | 34 | |
35 | -if ( ! function_exists( 'espresso_get_object_css_class' )) { |
|
35 | +if ( ! function_exists('espresso_get_object_css_class')) { |
|
36 | 36 | /** |
37 | 37 | * espresso_get_object_css_class - attempts to generate a css class based on the type of EE object passed |
38 | 38 | * |
@@ -42,8 +42,8 @@ discard block |
||
42 | 42 | * @param string $suffix added to the end of the generated class |
43 | 43 | * @return string |
44 | 44 | */ |
45 | - function espresso_get_object_css_class( $object = NULL, $prefix = '', $suffix = '' ) { |
|
46 | - return EEH_Template::get_object_css_class( $object, $prefix, $suffix ); |
|
45 | + function espresso_get_object_css_class($object = NULL, $prefix = '', $suffix = '') { |
|
46 | + return EEH_Template::get_object_css_class($object, $prefix, $suffix); |
|
47 | 47 | } |
48 | 48 | } |
49 | 49 | |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | * @return boolean |
71 | 71 | */ |
72 | 72 | public static function is_espresso_theme() { |
73 | - return wp_get_theme()->get( 'TextDomain' ) == 'event_espresso' ? TRUE : FALSE; |
|
73 | + return wp_get_theme()->get('TextDomain') == 'event_espresso' ? TRUE : FALSE; |
|
74 | 74 | } |
75 | 75 | |
76 | 76 | /** |
@@ -79,9 +79,9 @@ discard block |
||
79 | 79 | * @return void |
80 | 80 | */ |
81 | 81 | public static function load_espresso_theme_functions() { |
82 | - if ( ! defined( 'EE_THEME_FUNCTIONS_LOADED' )) { |
|
83 | - if ( is_readable( EE_PUBLIC . EE_Config::get_current_theme() . DS . 'functions.php' )) { |
|
84 | - require_once( EE_PUBLIC . EE_Config::get_current_theme() . DS . 'functions.php' ); |
|
82 | + if ( ! defined('EE_THEME_FUNCTIONS_LOADED')) { |
|
83 | + if (is_readable(EE_PUBLIC.EE_Config::get_current_theme().DS.'functions.php')) { |
|
84 | + require_once(EE_PUBLIC.EE_Config::get_current_theme().DS.'functions.php'); |
|
85 | 85 | } |
86 | 86 | } |
87 | 87 | } |
@@ -93,17 +93,17 @@ discard block |
||
93 | 93 | * @return array |
94 | 94 | */ |
95 | 95 | public static function get_espresso_themes() { |
96 | - if ( empty( EEH_Template::$_espresso_themes )) { |
|
97 | - $espresso_themes = glob( EE_PUBLIC . '*', GLOB_ONLYDIR ); |
|
98 | - if ( empty( $espresso_themes ) ) { |
|
96 | + if (empty(EEH_Template::$_espresso_themes)) { |
|
97 | + $espresso_themes = glob(EE_PUBLIC.'*', GLOB_ONLYDIR); |
|
98 | + if (empty($espresso_themes)) { |
|
99 | 99 | return array(); |
100 | 100 | } |
101 | - if (( $key = array_search( 'global_assets', $espresso_themes )) !== FALSE ) { |
|
102 | - unset( $espresso_themes[ $key ] ); |
|
101 | + if (($key = array_search('global_assets', $espresso_themes)) !== FALSE) { |
|
102 | + unset($espresso_themes[$key]); |
|
103 | 103 | } |
104 | 104 | EEH_Template::$_espresso_themes = array(); |
105 | - foreach ( $espresso_themes as $espresso_theme ) { |
|
106 | - EEH_Template::$_espresso_themes[ basename( $espresso_theme ) ] = $espresso_theme; |
|
105 | + foreach ($espresso_themes as $espresso_theme) { |
|
106 | + EEH_Template::$_espresso_themes[basename($espresso_theme)] = $espresso_theme; |
|
107 | 107 | } |
108 | 108 | } |
109 | 109 | return EEH_Template::$_espresso_themes; |
@@ -122,16 +122,16 @@ discard block |
||
122 | 122 | * @param bool $return_string |
123 | 123 | * @return string the html output for the formatted money value |
124 | 124 | */ |
125 | - public static function get_template_part( $slug = NULL, $name = NULL, $template_args = array(), $return_string = FALSE ) { |
|
126 | - do_action( "get_template_part_{$slug}-{$name}", $slug, $name ); |
|
125 | + public static function get_template_part($slug = NULL, $name = NULL, $template_args = array(), $return_string = FALSE) { |
|
126 | + do_action("get_template_part_{$slug}-{$name}", $slug, $name); |
|
127 | 127 | $templates = array(); |
128 | 128 | $name = (string) $name; |
129 | - if ( $name != '' ) { |
|
129 | + if ($name != '') { |
|
130 | 130 | $templates[] = "{$slug}-{$name}.php"; |
131 | 131 | } |
132 | 132 | // allow template parts to be turned off via something like: add_filter( 'FHEE__content_espresso_events_tickets_template__display_datetimes', '__return_false' ); |
133 | - if ( apply_filters( "FHEE__EEH_Template__get_template_part__display__{$slug}_{$name}", TRUE )) { |
|
134 | - EEH_Template::locate_template( $templates, $template_args, TRUE, $return_string ); |
|
133 | + if (apply_filters("FHEE__EEH_Template__get_template_part__display__{$slug}_{$name}", TRUE)) { |
|
134 | + EEH_Template::locate_template($templates, $template_args, TRUE, $return_string); |
|
135 | 135 | } |
136 | 136 | } |
137 | 137 | |
@@ -182,26 +182,26 @@ discard block |
||
182 | 182 | * Used in places where you don't actually load the template, you just want to know if there's a custom version of it. |
183 | 183 | * @return mixed |
184 | 184 | */ |
185 | - public static function locate_template( $templates = array(), $template_args = array(), $load = TRUE, $return_string = TRUE, $check_if_custom = FALSE ) { |
|
185 | + public static function locate_template($templates = array(), $template_args = array(), $load = TRUE, $return_string = TRUE, $check_if_custom = FALSE) { |
|
186 | 186 | // first use WP locate_template to check for template in the current theme folder |
187 | - $template_path = locate_template( $templates ); |
|
187 | + $template_path = locate_template($templates); |
|
188 | 188 | |
189 | - if ( $check_if_custom && !empty( $template_path ) ) |
|
189 | + if ($check_if_custom && ! empty($template_path)) |
|
190 | 190 | return TRUE; |
191 | 191 | |
192 | 192 | // not in the theme |
193 | - if ( empty( $template_path )) { |
|
193 | + if (empty($template_path)) { |
|
194 | 194 | // not even a template to look for ? |
195 | - if ( empty( $templates )) { |
|
195 | + if (empty($templates)) { |
|
196 | 196 | // get post_type |
197 | - $post_type = EE_Registry::instance()->REQ->get( 'post_type' ); |
|
197 | + $post_type = EE_Registry::instance()->REQ->get('post_type'); |
|
198 | 198 | // get array of EE Custom Post Types |
199 | 199 | $EE_CPTs = EE_Register_CPTs::get_CPTs(); |
200 | 200 | // build template name based on request |
201 | - if ( isset( $EE_CPTs[ $post_type ] )) { |
|
202 | - $archive_or_single = is_archive() ? 'archive' : ''; |
|
203 | - $archive_or_single = is_single() ? 'single' : $archive_or_single; |
|
204 | - $templates = $archive_or_single . '-' . $post_type . '.php'; |
|
201 | + if (isset($EE_CPTs[$post_type])) { |
|
202 | + $archive_or_single = is_archive() ? 'archive' : ''; |
|
203 | + $archive_or_single = is_single() ? 'single' : $archive_or_single; |
|
204 | + $templates = $archive_or_single.'-'.$post_type.'.php'; |
|
205 | 205 | } |
206 | 206 | } |
207 | 207 | // currently active EE template theme |
@@ -210,81 +210,81 @@ discard block |
||
210 | 210 | // array of paths to folders that may contain templates |
211 | 211 | $template_folder_paths = array( |
212 | 212 | // first check the /wp-content/uploads/espresso/templates/(current EE theme)/ folder for an EE theme template file |
213 | - EVENT_ESPRESSO_TEMPLATE_DIR . $current_theme, |
|
213 | + EVENT_ESPRESSO_TEMPLATE_DIR.$current_theme, |
|
214 | 214 | // then in the root of the /wp-content/uploads/espresso/templates/ folder |
215 | 215 | EVENT_ESPRESSO_TEMPLATE_DIR |
216 | 216 | ); |
217 | 217 | |
218 | 218 | //add core plugin folders for checking only if we're not $check_if_custom |
219 | - if ( ! $check_if_custom ) { |
|
219 | + if ( ! $check_if_custom) { |
|
220 | 220 | $core_paths = array( |
221 | 221 | // in the /wp-content/plugins/(EE4 folder)/public/(current EE theme)/ folder within the plugin |
222 | - EE_PUBLIC . $current_theme, |
|
222 | + EE_PUBLIC.$current_theme, |
|
223 | 223 | // in the /wp-content/plugins/(EE4 folder)/core/templates/(current EE theme)/ folder within the plugin |
224 | - EE_TEMPLATES . $current_theme, |
|
224 | + EE_TEMPLATES.$current_theme, |
|
225 | 225 | // or maybe relative from the plugin root: /wp-content/plugins/(EE4 folder)/ |
226 | 226 | EE_PLUGIN_DIR_PATH |
227 | 227 | ); |
228 | - $template_folder_paths = array_merge( $template_folder_paths, $core_paths ); |
|
228 | + $template_folder_paths = array_merge($template_folder_paths, $core_paths); |
|
229 | 229 | } |
230 | 230 | |
231 | 231 | // now filter that array |
232 | - $template_folder_paths = apply_filters( 'FHEE__EEH_Template__locate_template__template_folder_paths', $template_folder_paths ); |
|
233 | - $templates = is_array( $templates ) ? $templates : array( $templates ); |
|
234 | - $template_folder_paths = is_array( $template_folder_paths ) ? $template_folder_paths : array( $template_folder_paths ); |
|
232 | + $template_folder_paths = apply_filters('FHEE__EEH_Template__locate_template__template_folder_paths', $template_folder_paths); |
|
233 | + $templates = is_array($templates) ? $templates : array($templates); |
|
234 | + $template_folder_paths = is_array($template_folder_paths) ? $template_folder_paths : array($template_folder_paths); |
|
235 | 235 | // array to hold all possible template paths |
236 | 236 | $full_template_paths = array(); |
237 | 237 | |
238 | 238 | // loop through $templates |
239 | - foreach ( $templates as $template ) { |
|
239 | + foreach ($templates as $template) { |
|
240 | 240 | // normalize directory separators |
241 | - $template = EEH_File::standardise_directory_separators( $template ); |
|
242 | - $file_name = basename( $template ); |
|
243 | - $template_path_minus_file_name = substr( $template, 0, ( strlen( $file_name ) * -1 ) ); |
|
241 | + $template = EEH_File::standardise_directory_separators($template); |
|
242 | + $file_name = basename($template); |
|
243 | + $template_path_minus_file_name = substr($template, 0, (strlen($file_name) * -1)); |
|
244 | 244 | // while looping through all template folder paths |
245 | - foreach ( $template_folder_paths as $template_folder_path ) { |
|
245 | + foreach ($template_folder_paths as $template_folder_path) { |
|
246 | 246 | // normalize directory separators |
247 | - $template_folder_path = EEH_File::standardise_directory_separators( $template_folder_path ); |
|
247 | + $template_folder_path = EEH_File::standardise_directory_separators($template_folder_path); |
|
248 | 248 | // determine if any common base path exists between the two paths |
249 | 249 | $common_base_path = EEH_Template::_find_common_base_path( |
250 | - array( $template_folder_path, $template_path_minus_file_name ) |
|
250 | + array($template_folder_path, $template_path_minus_file_name) |
|
251 | 251 | ); |
252 | - if ( $common_base_path !== '' ) { |
|
252 | + if ($common_base_path !== '') { |
|
253 | 253 | // both paths have a common base, so just tack the filename onto our search path |
254 | - $resolved_path = EEH_File::end_with_directory_separator( $template_folder_path ) . $file_name; |
|
254 | + $resolved_path = EEH_File::end_with_directory_separator($template_folder_path).$file_name; |
|
255 | 255 | } else { |
256 | 256 | // no common base path, so let's just concatenate |
257 | - $resolved_path = EEH_File::end_with_directory_separator( $template_folder_path ) . $template; |
|
257 | + $resolved_path = EEH_File::end_with_directory_separator($template_folder_path).$template; |
|
258 | 258 | } |
259 | 259 | // build up our template locations array by adding our resolved paths |
260 | 260 | $full_template_paths[] = $resolved_path; |
261 | 261 | } |
262 | 262 | // if $template is an absolute path, then we'll tack it onto the start of our array so that it gets searched first |
263 | - array_unshift( $full_template_paths, $template ); |
|
263 | + array_unshift($full_template_paths, $template); |
|
264 | 264 | // path to the directory of the current theme: /wp-content/themes/(current WP theme)/ |
265 | - array_unshift( $full_template_paths, get_stylesheet_directory() . DS . $file_name ); |
|
265 | + array_unshift($full_template_paths, get_stylesheet_directory().DS.$file_name); |
|
266 | 266 | } |
267 | 267 | // filter final array of full template paths |
268 | - $full_template_paths = apply_filters( 'FHEE__EEH_Template__locate_template__full_template_paths', $full_template_paths, $file_name ); |
|
268 | + $full_template_paths = apply_filters('FHEE__EEH_Template__locate_template__full_template_paths', $full_template_paths, $file_name); |
|
269 | 269 | // now loop through our final array of template location paths and check each location |
270 | - foreach ( (array)$full_template_paths as $full_template_path ) { |
|
271 | - if ( is_readable( $full_template_path )) { |
|
272 | - $template_path = str_replace( array( '\\', '/' ), DIRECTORY_SEPARATOR, $full_template_path ); |
|
270 | + foreach ((array) $full_template_paths as $full_template_path) { |
|
271 | + if (is_readable($full_template_path)) { |
|
272 | + $template_path = str_replace(array('\\', '/'), DIRECTORY_SEPARATOR, $full_template_path); |
|
273 | 273 | // hook that can be used to display the full template path that will be used |
274 | - do_action( 'AHEE__EEH_Template__locate_template__full_template_path', $template_path ); |
|
274 | + do_action('AHEE__EEH_Template__locate_template__full_template_path', $template_path); |
|
275 | 275 | break; |
276 | 276 | } |
277 | 277 | } |
278 | 278 | } |
279 | 279 | // if we got it and you want to see it... |
280 | - if ( $template_path && $load && ! $check_if_custom ) { |
|
281 | - if ( $return_string ) { |
|
282 | - return EEH_Template::display_template( $template_path, $template_args, TRUE ); |
|
280 | + if ($template_path && $load && ! $check_if_custom) { |
|
281 | + if ($return_string) { |
|
282 | + return EEH_Template::display_template($template_path, $template_args, TRUE); |
|
283 | 283 | } else { |
284 | - EEH_Template::display_template( $template_path, $template_args, FALSE ); |
|
284 | + EEH_Template::display_template($template_path, $template_args, FALSE); |
|
285 | 285 | } |
286 | 286 | } |
287 | - return $check_if_custom && ! empty( $template_path ) ? TRUE : $template_path; |
|
287 | + return $check_if_custom && ! empty($template_path) ? TRUE : $template_path; |
|
288 | 288 | } |
289 | 289 | |
290 | 290 | |
@@ -297,21 +297,21 @@ discard block |
||
297 | 297 | * @param array $paths |
298 | 298 | * @return string |
299 | 299 | */ |
300 | - protected static function _find_common_base_path( $paths ) { |
|
300 | + protected static function _find_common_base_path($paths) { |
|
301 | 301 | $last_offset = 0; |
302 | 302 | $common_base_path = ''; |
303 | - while ( ( $index = strpos( $paths[ 0 ], DS, $last_offset ) ) !== false ) { |
|
303 | + while (($index = strpos($paths[0], DS, $last_offset)) !== false) { |
|
304 | 304 | $dir_length = $index - $last_offset + 1; |
305 | - $directory = substr( $paths[ 0 ], $last_offset, $dir_length ); |
|
306 | - foreach ( $paths as $path ) { |
|
307 | - if ( substr( $path, $last_offset, $dir_length ) != $directory ) { |
|
305 | + $directory = substr($paths[0], $last_offset, $dir_length); |
|
306 | + foreach ($paths as $path) { |
|
307 | + if (substr($path, $last_offset, $dir_length) != $directory) { |
|
308 | 308 | return $common_base_path; |
309 | 309 | } |
310 | 310 | } |
311 | 311 | $common_base_path .= $directory; |
312 | 312 | $last_offset = $index + 1; |
313 | 313 | } |
314 | - return substr( $common_base_path, 0, -1 ); |
|
314 | + return substr($common_base_path, 0, -1); |
|
315 | 315 | } |
316 | 316 | |
317 | 317 | |
@@ -323,7 +323,7 @@ discard block |
||
323 | 323 | * @param boolean $return_string whether to send output immediately to screen, or capture and return as a string |
324 | 324 | * @return mixed string |
325 | 325 | */ |
326 | - public static function display_template( $template_path = FALSE, $template_args = array(), $return_string = FALSE ) { |
|
326 | + public static function display_template($template_path = FALSE, $template_args = array(), $return_string = FALSE) { |
|
327 | 327 | |
328 | 328 | /** |
329 | 329 | * These two filters are intended for last minute changes to templates being loaded and/or template arg |
@@ -334,26 +334,26 @@ discard block |
||
334 | 334 | * |
335 | 335 | * @since 4.6.0 |
336 | 336 | */ |
337 | - $template_path = apply_filters( 'FHEE__EEH_Template__display_template__template_path', $template_path ); |
|
338 | - $template_args = apply_filters( 'FHEE__EEH_Template__display_template__template_args', $template_args ); |
|
337 | + $template_path = apply_filters('FHEE__EEH_Template__display_template__template_path', $template_path); |
|
338 | + $template_args = apply_filters('FHEE__EEH_Template__display_template__template_args', $template_args); |
|
339 | 339 | |
340 | 340 | // you gimme nuttin - YOU GET NUTTIN !! |
341 | - if ( ! $template_path || ! is_readable( $template_path )) { |
|
341 | + if ( ! $template_path || ! is_readable($template_path)) { |
|
342 | 342 | return ''; |
343 | 343 | } |
344 | 344 | // if $template_args are not in an array, then make it so |
345 | - if ( ! is_array( $template_args ) && ! is_object( $template_args )) { |
|
346 | - $template_args = array( $template_args ); |
|
345 | + if ( ! is_array($template_args) && ! is_object($template_args)) { |
|
346 | + $template_args = array($template_args); |
|
347 | 347 | } |
348 | - extract( (array) $template_args); |
|
348 | + extract((array) $template_args); |
|
349 | 349 | |
350 | - if ( $return_string ) { |
|
350 | + if ($return_string) { |
|
351 | 351 | // because we want to return a string, we are going to capture the output |
352 | 352 | ob_start(); |
353 | - include( $template_path ); |
|
353 | + include($template_path); |
|
354 | 354 | return ob_get_clean(); |
355 | 355 | } else { |
356 | - include( $template_path ); |
|
356 | + include($template_path); |
|
357 | 357 | } |
358 | 358 | return ''; |
359 | 359 | } |
@@ -371,27 +371,27 @@ discard block |
||
371 | 371 | * @param string $suffix added to the end of the generated class |
372 | 372 | * @return string |
373 | 373 | */ |
374 | - public static function get_object_css_class( $object = NULL, $prefix = '', $suffix = '' ) { |
|
374 | + public static function get_object_css_class($object = NULL, $prefix = '', $suffix = '') { |
|
375 | 375 | // in the beginning... |
376 | - $prefix = ! empty( $prefix ) ? rtrim( $prefix, '-' ) . '-' : ''; |
|
376 | + $prefix = ! empty($prefix) ? rtrim($prefix, '-').'-' : ''; |
|
377 | 377 | // da muddle |
378 | 378 | $class = ''; |
379 | 379 | // the end |
380 | - $suffix = ! empty( $suffix ) ? '-' . ltrim( $suffix, '-' ) : ''; |
|
380 | + $suffix = ! empty($suffix) ? '-'.ltrim($suffix, '-') : ''; |
|
381 | 381 | // is the passed object an EE object ? |
382 | - if ( $object instanceof EE_Base_Class ) { |
|
382 | + if ($object instanceof EE_Base_Class) { |
|
383 | 383 | // grab the exact type of object |
384 | - $obj_class = get_class( $object ); |
|
384 | + $obj_class = get_class($object); |
|
385 | 385 | // depending on the type of object... |
386 | - switch ( $obj_class ) { |
|
386 | + switch ($obj_class) { |
|
387 | 387 | // no specifics just yet... |
388 | 388 | default : |
389 | - $class = strtolower( str_replace( '_', '-', $obj_class )); |
|
390 | - $class .= method_exists( $obj_class, 'name' ) ? '-' . sanitize_title( $object->name() ) : ''; |
|
389 | + $class = strtolower(str_replace('_', '-', $obj_class)); |
|
390 | + $class .= method_exists($obj_class, 'name') ? '-'.sanitize_title($object->name()) : ''; |
|
391 | 391 | |
392 | 392 | } |
393 | 393 | } |
394 | - return $prefix . $class . $suffix; |
|
394 | + return $prefix.$class.$suffix; |
|
395 | 395 | } |
396 | 396 | |
397 | 397 | |
@@ -407,50 +407,50 @@ discard block |
||
407 | 407 | * @param string $cur_code_span_class |
408 | 408 | * @return string the html output for the formatted money value |
409 | 409 | */ |
410 | - public static function format_currency( $amount = NULL, $return_raw = FALSE, $display_code = TRUE, $CNT_ISO = '', $cur_code_span_class = 'currency-code' ) { |
|
410 | + public static function format_currency($amount = NULL, $return_raw = FALSE, $display_code = TRUE, $CNT_ISO = '', $cur_code_span_class = 'currency-code') { |
|
411 | 411 | // ensure amount was received |
412 | - if ( is_null( $amount ) ) { |
|
413 | - $msg = __( 'In order to format currency, an amount needs to be passed.', 'event_espresso' ); |
|
414 | - EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
412 | + if (is_null($amount)) { |
|
413 | + $msg = __('In order to format currency, an amount needs to be passed.', 'event_espresso'); |
|
414 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
415 | 415 | return ''; |
416 | 416 | } |
417 | 417 | //ensure amount is float |
418 | 418 | $amount = (float) $amount; |
419 | 419 | // filter raw amount (allows 0.00 to be changed to "free" for example) |
420 | - $amount_formatted = apply_filters( 'FHEE__EEH_Template__format_currency__amount', $amount, $return_raw ); |
|
420 | + $amount_formatted = apply_filters('FHEE__EEH_Template__format_currency__amount', $amount, $return_raw); |
|
421 | 421 | // still a number or was amount converted to a string like "free" ? |
422 | - if ( is_float( $amount_formatted )) { |
|
422 | + if (is_float($amount_formatted)) { |
|
423 | 423 | // was a country ISO code passed ? if so generate currency config object for that country |
424 | - $mny = $CNT_ISO !== '' ? new EE_Currency_Config( $CNT_ISO ) : NULL; |
|
424 | + $mny = $CNT_ISO !== '' ? new EE_Currency_Config($CNT_ISO) : NULL; |
|
425 | 425 | // verify results |
426 | - if ( ! $mny instanceof EE_Currency_Config ) { |
|
426 | + if ( ! $mny instanceof EE_Currency_Config) { |
|
427 | 427 | // set default config country currency settings |
428 | 428 | $mny = EE_Registry::instance()->CFG->currency instanceof EE_Currency_Config ? EE_Registry::instance()->CFG->currency : new EE_Currency_Config(); |
429 | 429 | } |
430 | 430 | // format float |
431 | - $amount_formatted = number_format( $amount, $mny->dec_plc, $mny->dec_mrk, $mny->thsnds ); |
|
431 | + $amount_formatted = number_format($amount, $mny->dec_plc, $mny->dec_mrk, $mny->thsnds); |
|
432 | 432 | // add formatting ? |
433 | - if ( ! $return_raw ) { |
|
433 | + if ( ! $return_raw) { |
|
434 | 434 | // add currency sign |
435 | - if( $mny->sign_b4 ){ |
|
436 | - if( $amount >= 0 ){ |
|
437 | - $amount_formatted = $mny->sign . $amount_formatted; |
|
438 | - }else{ |
|
439 | - $amount_formatted = '-' . $mny->sign . str_replace( '-', '', $amount_formatted ); |
|
435 | + if ($mny->sign_b4) { |
|
436 | + if ($amount >= 0) { |
|
437 | + $amount_formatted = $mny->sign.$amount_formatted; |
|
438 | + } else { |
|
439 | + $amount_formatted = '-'.$mny->sign.str_replace('-', '', $amount_formatted); |
|
440 | 440 | } |
441 | 441 | |
442 | - }else{ |
|
443 | - $amount_formatted = $amount_formatted . $mny->sign; |
|
442 | + } else { |
|
443 | + $amount_formatted = $amount_formatted.$mny->sign; |
|
444 | 444 | } |
445 | 445 | |
446 | 446 | // add currency code ? |
447 | - $amount_formatted = $display_code ? $amount_formatted . ' <span class="' . $cur_code_span_class . '">(' . $mny->code . ')</span>' : $amount_formatted; |
|
447 | + $amount_formatted = $display_code ? $amount_formatted.' <span class="'.$cur_code_span_class.'">('.$mny->code.')</span>' : $amount_formatted; |
|
448 | 448 | } |
449 | 449 | // filter results |
450 | - $amount_formatted = apply_filters( 'FHEE__EEH_Template__format_currency__amount_formatted', $amount_formatted, $mny, $return_raw ); |
|
450 | + $amount_formatted = apply_filters('FHEE__EEH_Template__format_currency__amount_formatted', $amount_formatted, $mny, $return_raw); |
|
451 | 451 | } |
452 | 452 | // clean up vars |
453 | - unset( $mny ); |
|
453 | + unset($mny); |
|
454 | 454 | // return formatted currency amount |
455 | 455 | return $amount_formatted; |
456 | 456 | } |
@@ -465,11 +465,11 @@ discard block |
||
465 | 465 | * @param string $schema 'UPPER', 'lower', or 'Sentence' |
466 | 466 | * @return string The localized label for the status id. |
467 | 467 | */ |
468 | - public static function pretty_status( $status_id, $plural = FALSE, $schema = 'upper' ) { |
|
468 | + public static function pretty_status($status_id, $plural = FALSE, $schema = 'upper') { |
|
469 | 469 | /** @type EEM_Status $EEM_Status */ |
470 | - $EEM_Status = EE_Registry::instance()->load_model( 'Status' ); |
|
471 | - $status = $EEM_Status->localized_status( array( $status_id => __( 'unknown', 'event_espresso' )), $plural, $schema ); |
|
472 | - return $status[ $status_id ]; |
|
470 | + $EEM_Status = EE_Registry::instance()->load_model('Status'); |
|
471 | + $status = $EEM_Status->localized_status(array($status_id => __('unknown', 'event_espresso')), $plural, $schema); |
|
472 | + return $status[$status_id]; |
|
473 | 473 | } |
474 | 474 | |
475 | 475 | |
@@ -482,9 +482,9 @@ discard block |
||
482 | 482 | * @param string $icon |
483 | 483 | * @return string the html output for the button |
484 | 484 | */ |
485 | - public static function get_button_or_link( $url, $label, $class = 'button-primary', $icon = '' ) { |
|
486 | - $label = ! empty( $icon ) ? '<span class="' . $icon . '"></span>' . $label : $label; |
|
487 | - $button = '<a id="' . sanitize_title_with_dashes($label) . '" href="' . $url . '" class="' . $class . '">' . $label . '</a>'; |
|
485 | + public static function get_button_or_link($url, $label, $class = 'button-primary', $icon = '') { |
|
486 | + $label = ! empty($icon) ? '<span class="'.$icon.'"></span>'.$label : $label; |
|
487 | + $button = '<a id="'.sanitize_title_with_dashes($label).'" href="'.$url.'" class="'.$class.'">'.$label.'</a>'; |
|
488 | 488 | return $button; |
489 | 489 | } |
490 | 490 | |
@@ -501,21 +501,21 @@ discard block |
||
501 | 501 | * @param bool|string $help_text (optional) send help text you want to use for the link if default not to be used |
502 | 502 | * @return string generated link |
503 | 503 | */ |
504 | - public static function get_help_tab_link( $help_tab_id, $page = FALSE, $action = FALSE, $icon_style = FALSE, $help_text = FALSE ) { |
|
504 | + public static function get_help_tab_link($help_tab_id, $page = FALSE, $action = FALSE, $icon_style = FALSE, $help_text = FALSE) { |
|
505 | 505 | |
506 | - if ( ! $page ) |
|
507 | - $page = isset( $_REQUEST['page'] ) && ! empty( $_REQUEST['page'] ) ? sanitize_key( $_REQUEST['page'] ) : $page; |
|
506 | + if ( ! $page) |
|
507 | + $page = isset($_REQUEST['page']) && ! empty($_REQUEST['page']) ? sanitize_key($_REQUEST['page']) : $page; |
|
508 | 508 | |
509 | - if ( ! $action ) |
|
510 | - $action = isset( $_REQUEST['action'] ) && ! empty( $_REQUEST['action'] ) ? sanitize_key( $_REQUEST['action'] ) : $action; |
|
509 | + if ( ! $action) |
|
510 | + $action = isset($_REQUEST['action']) && ! empty($_REQUEST['action']) ? sanitize_key($_REQUEST['action']) : $action; |
|
511 | 511 | |
512 | 512 | $action = empty($action) ? 'default' : $action; |
513 | 513 | |
514 | 514 | |
515 | - $help_tab_lnk = $page . '-' . $action . '-' . $help_tab_id; |
|
516 | - $icon = !$icon_style ? ' dashicons-editor-help' : $icon_style; |
|
517 | - $help_text = !$help_text ? '' : $help_text; |
|
518 | - return '<a id="' . $help_tab_lnk . '" class="ee-clickable dashicons espresso-help-tab-lnk ee-icon-size-22' . $icon . '" title="' . esc_attr__('Click to open the \'Help\' tab for more information about this feature.', 'event_espresso') . '" > ' . $help_text . ' </a>'; |
|
515 | + $help_tab_lnk = $page.'-'.$action.'-'.$help_tab_id; |
|
516 | + $icon = ! $icon_style ? ' dashicons-editor-help' : $icon_style; |
|
517 | + $help_text = ! $help_text ? '' : $help_text; |
|
518 | + return '<a id="'.$help_tab_lnk.'" class="ee-clickable dashicons espresso-help-tab-lnk ee-icon-size-22'.$icon.'" title="'.esc_attr__('Click to open the \'Help\' tab for more information about this feature.', 'event_espresso').'" > '.$help_text.' </a>'; |
|
519 | 519 | } |
520 | 520 | |
521 | 521 | |
@@ -527,31 +527,31 @@ discard block |
||
527 | 527 | * @param EE_Help_Tour |
528 | 528 | * @return string html |
529 | 529 | */ |
530 | - public static function help_tour_stops_generator( EE_Help_Tour $tour ) { |
|
530 | + public static function help_tour_stops_generator(EE_Help_Tour $tour) { |
|
531 | 531 | $id = $tour->get_slug(); |
532 | 532 | $stops = $tour->get_stops(); |
533 | 533 | |
534 | - $content = '<ol style="display:none" id="' . $id . '">'; |
|
534 | + $content = '<ol style="display:none" id="'.$id.'">'; |
|
535 | 535 | |
536 | - foreach ( $stops as $stop ) { |
|
537 | - $data_id = !empty( $stop['id'] ) ? ' data-id="' . $stop['id'] . '"' : ''; |
|
538 | - $data_class = empty( $data_id ) && !empty( $stop['class'] ) ? ' data-class="' . $stop['class'] . '"' : ''; |
|
536 | + foreach ($stops as $stop) { |
|
537 | + $data_id = ! empty($stop['id']) ? ' data-id="'.$stop['id'].'"' : ''; |
|
538 | + $data_class = empty($data_id) && ! empty($stop['class']) ? ' data-class="'.$stop['class'].'"' : ''; |
|
539 | 539 | |
540 | 540 | //if container is set to modal then let's make sure we set the options accordingly |
541 | - if ( empty( $data_id ) && empty( $data_class ) ) { |
|
541 | + if (empty($data_id) && empty($data_class)) { |
|
542 | 542 | $stop['options']['modal'] = true; |
543 | 543 | $stop['options']['expose'] = true; |
544 | 544 | } |
545 | 545 | |
546 | - $custom_class = !empty( $stop['custom_class'] ) ? ' class="' . $stop['custom_class'] . '"' : ''; |
|
547 | - $button_text = !empty( $stop['button_text'] ) ? ' data-button="' . $stop['button_text'] . '"' : ''; |
|
546 | + $custom_class = ! empty($stop['custom_class']) ? ' class="'.$stop['custom_class'].'"' : ''; |
|
547 | + $button_text = ! empty($stop['button_text']) ? ' data-button="'.$stop['button_text'].'"' : ''; |
|
548 | 548 | $inner_content = isset($stop['content']) ? $stop['content'] : ''; |
549 | 549 | |
550 | 550 | //options |
551 | - if ( isset( $stop['options'] ) && is_array( $stop['options'] ) ) { |
|
551 | + if (isset($stop['options']) && is_array($stop['options'])) { |
|
552 | 552 | $options = ' data-options="'; |
553 | - foreach ( $stop['options'] as $option => $value ) { |
|
554 | - $options .= $option . ':' . $value . ';'; |
|
553 | + foreach ($stop['options'] as $option => $value) { |
|
554 | + $options .= $option.':'.$value.';'; |
|
555 | 555 | } |
556 | 556 | $options .= '"'; |
557 | 557 | } else { |
@@ -559,7 +559,7 @@ discard block |
||
559 | 559 | } |
560 | 560 | |
561 | 561 | //let's put all together |
562 | - $content .= '<li' . $data_id . $data_class . $custom_class . $button_text . $options . '>' . $inner_content . '</li>'; |
|
562 | + $content .= '<li'.$data_id.$data_class.$custom_class.$button_text.$options.'>'.$inner_content.'</li>'; |
|
563 | 563 | } |
564 | 564 | |
565 | 565 | $content .= '</ol>'; |
@@ -580,31 +580,31 @@ discard block |
||
580 | 580 | * @throws EE_Error |
581 | 581 | * @return string html structure for status. |
582 | 582 | */ |
583 | - public static function status_legend( $status_array, $active_status = '' ) { |
|
584 | - if ( !is_array( $status_array ) ) |
|
585 | - throw new EE_Error( __('The EEH_Template::status_legend helper required the incoming status_array argument to be an array!', 'event_espresso') ); |
|
583 | + public static function status_legend($status_array, $active_status = '') { |
|
584 | + if ( ! is_array($status_array)) |
|
585 | + throw new EE_Error(__('The EEH_Template::status_legend helper required the incoming status_array argument to be an array!', 'event_espresso')); |
|
586 | 586 | |
587 | 587 | $setup_array = array(); |
588 | - foreach ( $status_array as $item => $status ) { |
|
588 | + foreach ($status_array as $item => $status) { |
|
589 | 589 | $setup_array[$item] = array( |
590 | - 'class' => 'ee-status-legend ee-status-legend-' . $status, |
|
591 | - 'desc' => EEH_Template::pretty_status( $status, FALSE, 'sentence' ), |
|
590 | + 'class' => 'ee-status-legend ee-status-legend-'.$status, |
|
591 | + 'desc' => EEH_Template::pretty_status($status, FALSE, 'sentence'), |
|
592 | 592 | 'status' => $status |
593 | 593 | ); |
594 | 594 | } |
595 | 595 | |
596 | - $content = '<div class="ee-list-table-legend-container">' . "\n"; |
|
597 | - $content .= '<h3>' . __('Status Legend', 'event_espresso') . '</h3>' . "\n"; |
|
598 | - $content .= '<dl class="ee-list-table-legend">' . "\n\t"; |
|
599 | - foreach ( $setup_array as $item => $details ) { |
|
596 | + $content = '<div class="ee-list-table-legend-container">'."\n"; |
|
597 | + $content .= '<h3>'.__('Status Legend', 'event_espresso').'</h3>'."\n"; |
|
598 | + $content .= '<dl class="ee-list-table-legend">'."\n\t"; |
|
599 | + foreach ($setup_array as $item => $details) { |
|
600 | 600 | $active_class = $active_status == $details['status'] ? ' class="ee-is-active-status"' : ''; |
601 | - $content .= '<dt id="ee-legend-item-tooltip-' . $item . '"' . $active_class . '>' . "\n\t\t"; |
|
602 | - $content .= '<span class="' . $details['class'] . '"></span>' . "\n\t\t"; |
|
603 | - $content .= '<span class="ee-legend-description">' . $details['desc'] . '</span>' . "\n\t"; |
|
604 | - $content .= '</dt>' . "\n"; |
|
601 | + $content .= '<dt id="ee-legend-item-tooltip-'.$item.'"'.$active_class.'>'."\n\t\t"; |
|
602 | + $content .= '<span class="'.$details['class'].'"></span>'."\n\t\t"; |
|
603 | + $content .= '<span class="ee-legend-description">'.$details['desc'].'</span>'."\n\t"; |
|
604 | + $content .= '</dt>'."\n"; |
|
605 | 605 | } |
606 | - $content .= '</dl>' . "\n"; |
|
607 | - $content .= '</div>' . "\n"; |
|
606 | + $content .= '</dl>'."\n"; |
|
607 | + $content .= '</div>'."\n"; |
|
608 | 608 | return $content; |
609 | 609 | } |
610 | 610 | |
@@ -617,8 +617,8 @@ discard block |
||
617 | 617 | * @return string |
618 | 618 | */ |
619 | 619 | public static function layout_array_as_table($data) { |
620 | - if (is_object($data) || $data instanceof __PHP_Incomplete_Class ) { |
|
621 | - $data = (array)$data; |
|
620 | + if (is_object($data) || $data instanceof __PHP_Incomplete_Class) { |
|
621 | + $data = (array) $data; |
|
622 | 622 | } |
623 | 623 | ob_start(); |
624 | 624 | if (is_array($data)) { |
@@ -631,10 +631,10 @@ discard block |
||
631 | 631 | ?> |
632 | 632 | <tr> |
633 | 633 | <td> |
634 | - <?php echo $data_key;?> |
|
634 | + <?php echo $data_key; ?> |
|
635 | 635 | </td> |
636 | 636 | <td> |
637 | - <?php echo self::layout_array_as_table($data_values);?> |
|
637 | + <?php echo self::layout_array_as_table($data_values); ?> |
|
638 | 638 | </td> |
639 | 639 | </tr> |
640 | 640 | <?php |
@@ -648,7 +648,7 @@ discard block |
||
648 | 648 | <ul> |
649 | 649 | <?php |
650 | 650 | foreach ($data as $datum) { |
651 | - echo "<li>"; echo self::layout_array_as_table($datum);echo "</li>"; |
|
651 | + echo "<li>"; echo self::layout_array_as_table($datum); echo "</li>"; |
|
652 | 652 | }?> |
653 | 653 | </ul> |
654 | 654 | <?php |
@@ -678,8 +678,8 @@ discard block |
||
678 | 678 | * |
679 | 679 | * @return string |
680 | 680 | */ |
681 | - public static function paging_html( $total_items, $current, $per_page, $url, $show_num_field = TRUE, $paged_arg_name = 'paged', $items_label = array() ) { |
|
682 | - echo self::get_paging_html( $total_items, $current, $per_page, $url, $show_num_field, $paged_arg_name, $items_label ); |
|
681 | + public static function paging_html($total_items, $current, $per_page, $url, $show_num_field = TRUE, $paged_arg_name = 'paged', $items_label = array()) { |
|
682 | + echo self::get_paging_html($total_items, $current, $per_page, $url, $show_num_field, $paged_arg_name, $items_label); |
|
683 | 683 | } |
684 | 684 | |
685 | 685 | |
@@ -703,13 +703,13 @@ discard block |
||
703 | 703 | * ) |
704 | 704 | * @return string |
705 | 705 | */ |
706 | - public static function get_paging_html( $total_items, $current, $per_page, $url, $show_num_field = TRUE, $paged_arg_name = 'paged', $items_label = array() ) { |
|
706 | + public static function get_paging_html($total_items, $current, $per_page, $url, $show_num_field = TRUE, $paged_arg_name = 'paged', $items_label = array()) { |
|
707 | 707 | $page_links = array(); |
708 | 708 | $disable_first = $disable_last = ''; |
709 | 709 | $total_items = (int) $total_items; |
710 | 710 | $per_page = (int) $per_page; |
711 | 711 | $current = (int) $current; |
712 | - $paged_arg_name = empty( $paged_arg_name ) ? 'paged' : sanitize_key( $paged_arg_name ); |
|
712 | + $paged_arg_name = empty($paged_arg_name) ? 'paged' : sanitize_key($paged_arg_name); |
|
713 | 713 | |
714 | 714 | //filter items_label |
715 | 715 | $items_label = apply_filters( |
@@ -717,68 +717,68 @@ discard block |
||
717 | 717 | $items_label |
718 | 718 | ); |
719 | 719 | |
720 | - if ( empty( $items_label ) |
|
721 | - || ! is_array( $items_label ) |
|
722 | - || ! isset( $items_label['single'] ) |
|
723 | - || ! isset( $items_label['plural'] ) ) { |
|
720 | + if (empty($items_label) |
|
721 | + || ! is_array($items_label) |
|
722 | + || ! isset($items_label['single']) |
|
723 | + || ! isset($items_label['plural'])) { |
|
724 | 724 | $items_label = array( |
725 | - 'single' => __( '1 item', 'event_espresso' ), |
|
726 | - 'plural' => __( '%s items', 'event_espresso' ) |
|
725 | + 'single' => __('1 item', 'event_espresso'), |
|
726 | + 'plural' => __('%s items', 'event_espresso') |
|
727 | 727 | ); |
728 | 728 | } else { |
729 | 729 | $items_label = array( |
730 | - 'single' => '1 ' . esc_html( $items_label['single'] ), |
|
731 | - 'plural' => '%s ' . esc_html( $items_label['plural'] ) |
|
730 | + 'single' => '1 '.esc_html($items_label['single']), |
|
731 | + 'plural' => '%s '.esc_html($items_label['plural']) |
|
732 | 732 | ); |
733 | 733 | } |
734 | 734 | |
735 | - $total_pages = ceil( $total_items / $per_page ); |
|
735 | + $total_pages = ceil($total_items / $per_page); |
|
736 | 736 | |
737 | - if ( $total_pages <= 1 ) |
|
737 | + if ($total_pages <= 1) |
|
738 | 738 | return ''; |
739 | 739 | |
740 | - $item_label = $total_items > 1 ? sprintf( $items_label['plural'], $total_items ) : $items_label['single']; |
|
740 | + $item_label = $total_items > 1 ? sprintf($items_label['plural'], $total_items) : $items_label['single']; |
|
741 | 741 | |
742 | - $output = '<span class="displaying-num">' . $item_label . '</span>'; |
|
742 | + $output = '<span class="displaying-num">'.$item_label.'</span>'; |
|
743 | 743 | |
744 | - if ( $current === 1 ) { |
|
744 | + if ($current === 1) { |
|
745 | 745 | $disable_first = ' disabled'; |
746 | 746 | } |
747 | - if ( $current == $total_pages ) { |
|
747 | + if ($current == $total_pages) { |
|
748 | 748 | $disable_last = ' disabled'; |
749 | 749 | } |
750 | 750 | |
751 | - $page_links[] = sprintf( "<a class='%s' title='%s' href='%s'>%s</a>", |
|
752 | - 'first-page' . $disable_first, |
|
753 | - esc_attr__( 'Go to the first page' ), |
|
754 | - esc_url( remove_query_arg( $paged_arg_name, $url ) ), |
|
751 | + $page_links[] = sprintf("<a class='%s' title='%s' href='%s'>%s</a>", |
|
752 | + 'first-page'.$disable_first, |
|
753 | + esc_attr__('Go to the first page'), |
|
754 | + esc_url(remove_query_arg($paged_arg_name, $url)), |
|
755 | 755 | '«' |
756 | 756 | ); |
757 | 757 | |
758 | 758 | $page_links[] = sprintf( |
759 | 759 | '<a class="%s" title="%s" href="%s">%s</a>', |
760 | - 'prev-page' . $disable_first, |
|
761 | - esc_attr__( 'Go to the previous page' ), |
|
762 | - esc_url( add_query_arg( $paged_arg_name, max( 1, $current-1 ), $url ) ), |
|
760 | + 'prev-page'.$disable_first, |
|
761 | + esc_attr__('Go to the previous page'), |
|
762 | + esc_url(add_query_arg($paged_arg_name, max(1, $current - 1), $url)), |
|
763 | 763 | '‹' |
764 | 764 | ); |
765 | 765 | |
766 | - if ( ! $show_num_field ) { |
|
766 | + if ( ! $show_num_field) { |
|
767 | 767 | $html_current_page = $current; |
768 | 768 | } else { |
769 | - $html_current_page = sprintf( "<input class='current-page' title='%s' type='text' name=$paged_arg_name value='%s' size='%d' />", |
|
770 | - esc_attr__( 'Current page' ), |
|
769 | + $html_current_page = sprintf("<input class='current-page' title='%s' type='text' name=$paged_arg_name value='%s' size='%d' />", |
|
770 | + esc_attr__('Current page'), |
|
771 | 771 | $current, |
772 | - strlen( $total_pages ) |
|
772 | + strlen($total_pages) |
|
773 | 773 | ); |
774 | 774 | } |
775 | 775 | |
776 | 776 | $html_total_pages = sprintf( |
777 | 777 | '<span class="total-pages">%s</span>', |
778 | - number_format_i18n( $total_pages ) |
|
778 | + number_format_i18n($total_pages) |
|
779 | 779 | ); |
780 | 780 | $page_links[] = sprintf( |
781 | - _x( '%3$s%1$s of %2$s%4$s', 'paging' ), |
|
781 | + _x('%3$s%1$s of %2$s%4$s', 'paging'), |
|
782 | 782 | $html_current_page, |
783 | 783 | $html_total_pages, |
784 | 784 | '<span class="paging-input">', |
@@ -787,29 +787,29 @@ discard block |
||
787 | 787 | |
788 | 788 | $page_links[] = sprintf( |
789 | 789 | '<a class="%s" title="%s" href="%s">%s</a>', |
790 | - 'next-page' . $disable_last, |
|
791 | - esc_attr__( 'Go to the next page' ), |
|
792 | - esc_url( add_query_arg( $paged_arg_name, min( $total_pages, $current+1 ), $url ) ), |
|
790 | + 'next-page'.$disable_last, |
|
791 | + esc_attr__('Go to the next page'), |
|
792 | + esc_url(add_query_arg($paged_arg_name, min($total_pages, $current + 1), $url)), |
|
793 | 793 | '›' |
794 | 794 | ); |
795 | 795 | |
796 | 796 | $page_links[] = sprintf( |
797 | 797 | '<a class="%s" title="%s" href="%s">%s</a>', |
798 | - 'last-page' . $disable_last, |
|
799 | - esc_attr__( 'Go to the last page' ), |
|
800 | - esc_url( add_query_arg( $paged_arg_name, $total_pages, $url ) ), |
|
798 | + 'last-page'.$disable_last, |
|
799 | + esc_attr__('Go to the last page'), |
|
800 | + esc_url(add_query_arg($paged_arg_name, $total_pages, $url)), |
|
801 | 801 | '»' |
802 | 802 | ); |
803 | 803 | |
804 | - $output .= "\n" . '<span class="pagination-links">' . join( "\n", $page_links ) . '</span>'; |
|
804 | + $output .= "\n".'<span class="pagination-links">'.join("\n", $page_links).'</span>'; |
|
805 | 805 | // set page class |
806 | - if ( $total_pages ) { |
|
806 | + if ($total_pages) { |
|
807 | 807 | $page_class = $total_pages < 2 ? ' one-page' : ''; |
808 | 808 | } else { |
809 | 809 | $page_class = ' no-pages'; |
810 | 810 | } |
811 | 811 | |
812 | - return '<div class="tablenav"><div class="tablenav-pages' . $page_class . '">' . $output . '</div></div>'; |
|
812 | + return '<div class="tablenav"><div class="tablenav-pages'.$page_class.'">'.$output.'</div></div>'; |
|
813 | 813 | } |
814 | 814 | |
815 | 815 | |
@@ -825,7 +825,7 @@ discard block |
||
825 | 825 | //add_filter( 'FHEE__EEH_Template__format_currency__amount', 'convert_zero_to_free', 10, 2 ); |
826 | 826 | |
827 | 827 | |
828 | -if ( ! function_exists( 'espresso_pagination' ) ) { |
|
828 | +if ( ! function_exists('espresso_pagination')) { |
|
829 | 829 | /** |
830 | 830 | * espresso_pagination |
831 | 831 | * |
@@ -837,21 +837,21 @@ discard block |
||
837 | 837 | $big = 999999999; // need an unlikely integer |
838 | 838 | $pagination = paginate_links( |
839 | 839 | array( |
840 | - 'base' => str_replace( $big, '%#%', esc_url( get_pagenum_link( $big ) ) ), |
|
840 | + 'base' => str_replace($big, '%#%', esc_url(get_pagenum_link($big))), |
|
841 | 841 | 'format' => '?paged=%#%', |
842 | - 'current' => max( 1, get_query_var( 'paged' ) ), |
|
842 | + 'current' => max(1, get_query_var('paged')), |
|
843 | 843 | 'total' => $wp_query->max_num_pages, |
844 | 844 | 'show_all' => true, |
845 | 845 | 'end_size' => 10, |
846 | 846 | 'mid_size' => 6, |
847 | 847 | 'prev_next' => true, |
848 | - 'prev_text' => __( '‹ PREV', 'event_espresso' ), |
|
849 | - 'next_text' => __( 'NEXT ›', 'event_espresso' ), |
|
848 | + 'prev_text' => __('‹ PREV', 'event_espresso'), |
|
849 | + 'next_text' => __('NEXT ›', 'event_espresso'), |
|
850 | 850 | 'type' => 'plain', |
851 | 851 | 'add_args' => false, |
852 | 852 | 'add_fragment' => '' |
853 | 853 | ) |
854 | 854 | ); |
855 | - echo ! empty( $pagination ) ? '<div class="ee-pagination-dv clear">' . $pagination . '</div>' : ''; |
|
855 | + echo ! empty($pagination) ? '<div class="ee-pagination-dv clear">'.$pagination.'</div>' : ''; |
|
856 | 856 | } |
857 | 857 | } |
858 | 858 | \ No newline at end of file |
@@ -151,7 +151,7 @@ discard block |
||
151 | 151 | * @throws \EE_Error |
152 | 152 | */ |
153 | 153 | public function column_TXN_ID( EE_Transaction $item ){ |
154 | - $view_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'view_transaction', 'TXN_ID'=>$item->ID() ), TXN_ADMIN_URL ); |
|
154 | + $view_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'view_transaction', 'TXN_ID'=>$item->ID() ), TXN_ADMIN_URL ); |
|
155 | 155 | $content = '<a href="' . $view_lnk_url . '" title="' . esc_attr__( 'Go to Transaction Details', 'event_espresso' ) . '">' . $item->ID() . '</a>'; |
156 | 156 | |
157 | 157 | //txn timestamp |
@@ -321,7 +321,7 @@ discard block |
||
321 | 321 | * @throws \EE_Error |
322 | 322 | */ |
323 | 323 | public function column_event_name( EE_Transaction $item ){ |
324 | - $actions = array(); |
|
324 | + $actions = array(); |
|
325 | 325 | $event = $item->primary_registration()->get_first_related('Event'); |
326 | 326 | if ( !empty( $event ) ) { |
327 | 327 | $edit_event_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'edit', 'post'=>$event->ID() ), EVENTS_ADMIN_URL ); |
@@ -350,18 +350,18 @@ discard block |
||
350 | 350 | */ |
351 | 351 | public function column_actions( EE_Transaction $item ){ |
352 | 352 | |
353 | - $registration = $item->primary_registration(); |
|
354 | - $attendee = $registration->attendee(); |
|
353 | + $registration = $item->primary_registration(); |
|
354 | + $attendee = $registration->attendee(); |
|
355 | 355 | |
356 | - //Build row actions |
|
356 | + //Build row actions |
|
357 | 357 | $view_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'view_transaction', 'TXN_ID'=>$item->ID() ), TXN_ADMIN_URL ); |
358 | 358 | $dl_invoice_lnk_url = $registration->invoice_url(); |
359 | 359 | $dl_receipt_lnk_url = $registration->receipt_url(); |
360 | 360 | $view_reg_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'view_registration', '_REG_ID'=>$registration->ID() ), REG_ADMIN_URL ); |
361 | 361 | $send_pay_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'send_payment_reminder', 'TXN_ID'=>$item->ID() ), TXN_ADMIN_URL ); |
362 | - $related_messages_link = EEH_MSG_Template::get_message_action_link( 'see_notifications_for', null, array( |
|
363 | - 'TXN_ID' => $item->ID() |
|
364 | - )); |
|
362 | + $related_messages_link = EEH_MSG_Template::get_message_action_link( 'see_notifications_for', null, array( |
|
363 | + 'TXN_ID' => $item->ID() |
|
364 | + )); |
|
365 | 365 | |
366 | 366 | //Build row actions |
367 | 367 | $view_lnk = ' |
@@ -434,7 +434,7 @@ discard block |
||
434 | 434 | } |
435 | 435 | |
436 | 436 | return $this->_action_string( $view_lnk . $dl_invoice_lnk . $dl_receipt_lnk . $view_reg_lnk . $send_pay_lnk . $view_related_messages_lnk, $item, 'ul', 'txn-overview-actions-ul' ); |
437 | - } |
|
437 | + } |
|
438 | 438 | |
439 | 439 | |
440 | 440 | } |
@@ -31,8 +31,8 @@ discard block |
||
31 | 31 | /** |
32 | 32 | * @param \Transactions_Admin_Page $admin_page |
33 | 33 | */ |
34 | - public function __construct( \Transactions_Admin_Page $admin_page ){ |
|
35 | - parent::__construct( $admin_page ); |
|
34 | + public function __construct(\Transactions_Admin_Page $admin_page) { |
|
35 | + parent::__construct($admin_page); |
|
36 | 36 | $this->_status = $this->_admin_page->get_transaction_status_array(); |
37 | 37 | } |
38 | 38 | |
@@ -42,9 +42,9 @@ discard block |
||
42 | 42 | *_setup_data |
43 | 43 | */ |
44 | 44 | protected function _setup_data() { |
45 | - $this->_data = $this->_admin_page->get_transactions( $this->_per_page ); |
|
46 | - $status = ! empty( $this->_req_data['status'] )? $this->_req_data['status'] : 'all'; |
|
47 | - $this->_all_data_count = $this->_admin_page->get_transactions( $this->_per_page, TRUE, $status ); |
|
45 | + $this->_data = $this->_admin_page->get_transactions($this->_per_page); |
|
46 | + $status = ! empty($this->_req_data['status']) ? $this->_req_data['status'] : 'all'; |
|
47 | + $this->_all_data_count = $this->_admin_page->get_transactions($this->_per_page, TRUE, $status); |
|
48 | 48 | } |
49 | 49 | |
50 | 50 | |
@@ -59,25 +59,25 @@ discard block |
||
59 | 59 | 'ajax' => TRUE, |
60 | 60 | 'screen' => $this->_admin_page->get_current_screen()->id |
61 | 61 | ); |
62 | - $ID_column_name = __( 'ID', 'event_espresso' ); |
|
62 | + $ID_column_name = __('ID', 'event_espresso'); |
|
63 | 63 | $ID_column_name .= ' : <span class="show-on-mobile-view-only" style="float:none">'; |
64 | - $ID_column_name .= __( 'Transaction Date', 'event_espresso' ); |
|
64 | + $ID_column_name .= __('Transaction Date', 'event_espresso'); |
|
65 | 65 | $ID_column_name .= '</span> '; |
66 | 66 | $this->_columns = array( |
67 | 67 | 'TXN_ID' => $ID_column_name, |
68 | - 'TXN_timestamp' => __( 'Transaction Date', 'event_espresso' ), |
|
69 | - 'TXN_total' => __( 'Total', 'event_espresso' ), |
|
70 | - 'TXN_paid' => __( 'Paid', 'event_espresso' ), |
|
71 | - 'ATT_fname' => __( 'Primary Registrant', 'event_espresso' ), |
|
72 | - 'event_name' => __( 'Event', 'event_espresso' ), |
|
73 | - 'actions' => __( 'Actions', 'event_espresso' ) |
|
68 | + 'TXN_timestamp' => __('Transaction Date', 'event_espresso'), |
|
69 | + 'TXN_total' => __('Total', 'event_espresso'), |
|
70 | + 'TXN_paid' => __('Paid', 'event_espresso'), |
|
71 | + 'ATT_fname' => __('Primary Registrant', 'event_espresso'), |
|
72 | + 'event_name' => __('Event', 'event_espresso'), |
|
73 | + 'actions' => __('Actions', 'event_espresso') |
|
74 | 74 | ); |
75 | 75 | |
76 | 76 | $this->_sortable_columns = array( |
77 | - 'TXN_ID' => array( 'TXN_ID' => FALSE ), |
|
78 | - 'event_name' => array( 'event_name'=> FALSE ), |
|
79 | - 'ATT_fname' => array( 'ATT_fname'=> FALSE ), |
|
80 | - 'TXN_timestamp' => array( 'TXN_timestamp'=> TRUE ) //true means its already sorted |
|
77 | + 'TXN_ID' => array('TXN_ID' => FALSE), |
|
78 | + 'event_name' => array('event_name'=> FALSE), |
|
79 | + 'ATT_fname' => array('ATT_fname'=> FALSE), |
|
80 | + 'TXN_timestamp' => array('TXN_timestamp'=> TRUE) //true means its already sorted |
|
81 | 81 | ); |
82 | 82 | |
83 | 83 | $this->_primary_column = 'TXN_ID'; |
@@ -95,11 +95,11 @@ discard block |
||
95 | 95 | * @return string |
96 | 96 | * @throws \EE_Error |
97 | 97 | */ |
98 | - protected function _get_row_class( $item ) { |
|
99 | - $class = parent::_get_row_class( $item ); |
|
98 | + protected function _get_row_class($item) { |
|
99 | + $class = parent::_get_row_class($item); |
|
100 | 100 | //add status class |
101 | - $class .= ' ee-status-strip txn-status-' . $item->status_ID(); |
|
102 | - if ( $this->_has_checkbox_column ) { |
|
101 | + $class .= ' ee-status-strip txn-status-'.$item->status_ID(); |
|
102 | + if ($this->_has_checkbox_column) { |
|
103 | 103 | $class .= ' has-checkbox-column'; |
104 | 104 | } |
105 | 105 | return $class; |
@@ -116,8 +116,8 @@ discard block |
||
116 | 116 | */ |
117 | 117 | protected function _get_table_filters() { |
118 | 118 | $filters = array(); |
119 | - $start_date = isset( $this->_req_data['txn-filter-start-date'] ) ? wp_strip_all_tags( $this->_req_data['txn-filter-start-date'] ) : date( 'm/d/Y', strtotime( '-10 year' )); |
|
120 | - $end_date = isset( $this->_req_data['txn-filter-end-date'] ) ? wp_strip_all_tags( $this->_req_data['txn-filter-end-date'] ) : date( 'm/d/Y' ); |
|
119 | + $start_date = isset($this->_req_data['txn-filter-start-date']) ? wp_strip_all_tags($this->_req_data['txn-filter-start-date']) : date('m/d/Y', strtotime('-10 year')); |
|
120 | + $end_date = isset($this->_req_data['txn-filter-end-date']) ? wp_strip_all_tags($this->_req_data['txn-filter-end-date']) : date('m/d/Y'); |
|
121 | 121 | ob_start(); |
122 | 122 | ?> |
123 | 123 | <label for="txn-filter-start-date">Display Transactions from </label> |
@@ -136,9 +136,9 @@ discard block |
||
136 | 136 | *_add_view_counts |
137 | 137 | */ |
138 | 138 | protected function _add_view_counts() { |
139 | - $this->_views['all']['count'] = $this->_admin_page->get_transactions( $this->_per_page, TRUE, 'all' ); |
|
140 | - $this->_views['abandoned']['count'] = $this->_admin_page->get_transactions( $this->_per_page, TRUE, 'abandoned' ); |
|
141 | - $this->_views['failed']['count'] = $this->_admin_page->get_transactions( $this->_per_page, TRUE, 'failed' ); |
|
139 | + $this->_views['all']['count'] = $this->_admin_page->get_transactions($this->_per_page, TRUE, 'all'); |
|
140 | + $this->_views['abandoned']['count'] = $this->_admin_page->get_transactions($this->_per_page, TRUE, 'abandoned'); |
|
141 | + $this->_views['failed']['count'] = $this->_admin_page->get_transactions($this->_per_page, TRUE, 'failed'); |
|
142 | 142 | } |
143 | 143 | |
144 | 144 | |
@@ -150,12 +150,12 @@ discard block |
||
150 | 150 | * @return string |
151 | 151 | * @throws \EE_Error |
152 | 152 | */ |
153 | - public function column_TXN_ID( EE_Transaction $item ){ |
|
154 | - $view_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'view_transaction', 'TXN_ID'=>$item->ID() ), TXN_ADMIN_URL ); |
|
155 | - $content = '<a href="' . $view_lnk_url . '" title="' . esc_attr__( 'Go to Transaction Details', 'event_espresso' ) . '">' . $item->ID() . '</a>'; |
|
153 | + public function column_TXN_ID(EE_Transaction $item) { |
|
154 | + $view_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'view_transaction', 'TXN_ID'=>$item->ID()), TXN_ADMIN_URL); |
|
155 | + $content = '<a href="'.$view_lnk_url.'" title="'.esc_attr__('Go to Transaction Details', 'event_espresso').'">'.$item->ID().'</a>'; |
|
156 | 156 | |
157 | 157 | //txn timestamp |
158 | - $content .= ' <span class="show-on-mobile-view-only">' . $this->_get_txn_timestamp( $item ) . '</span>'; |
|
158 | + $content .= ' <span class="show-on-mobile-view-only">'.$this->_get_txn_timestamp($item).'</span>'; |
|
159 | 159 | return $content; |
160 | 160 | } |
161 | 161 | |
@@ -166,18 +166,18 @@ discard block |
||
166 | 166 | * @return mixed|string|void |
167 | 167 | * @throws \EE_Error |
168 | 168 | */ |
169 | - protected function _get_txn_timestamp( EE_Transaction $item ) { |
|
169 | + protected function _get_txn_timestamp(EE_Transaction $item) { |
|
170 | 170 | //txn timestamp |
171 | 171 | // is TXN less than 2 hours old ? |
172 | 172 | if ( |
173 | - ( $item->failed() || $item->is_abandoned() ) |
|
173 | + ($item->failed() || $item->is_abandoned()) |
|
174 | 174 | && ( |
175 | - ( time() - EE_Registry::instance()->SSN->lifespan() ) < $item->datetime( false, true ) |
|
175 | + (time() - EE_Registry::instance()->SSN->lifespan()) < $item->datetime(false, true) |
|
176 | 176 | ) |
177 | 177 | ) { |
178 | - $timestamp = __( 'TXN in progress...', 'event_espresso' ); |
|
178 | + $timestamp = __('TXN in progress...', 'event_espresso'); |
|
179 | 179 | } else { |
180 | - $timestamp = $item->get_i18n_datetime( 'TXN_timestamp' ); |
|
180 | + $timestamp = $item->get_i18n_datetime('TXN_timestamp'); |
|
181 | 181 | } |
182 | 182 | return $timestamp; |
183 | 183 | } |
@@ -191,8 +191,8 @@ discard block |
||
191 | 191 | * @return string |
192 | 192 | * @throws \EE_Error |
193 | 193 | */ |
194 | - public function column_cb($item ){ |
|
195 | - return sprintf( '<input type="checkbox" name="%1$s[]" value="%2$s" />', $this->_wp_list_args['singular'], $item->ID()); |
|
194 | + public function column_cb($item) { |
|
195 | + return sprintf('<input type="checkbox" name="%1$s[]" value="%2$s" />', $this->_wp_list_args['singular'], $item->ID()); |
|
196 | 196 | } |
197 | 197 | |
198 | 198 | |
@@ -204,11 +204,11 @@ discard block |
||
204 | 204 | * @return string |
205 | 205 | * @throws \EE_Error |
206 | 206 | */ |
207 | - public function column_TXN_timestamp( EE_Transaction $item ){ |
|
208 | - $view_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'view_transaction', 'TXN_ID'=>$item->ID() ), TXN_ADMIN_URL ); |
|
209 | - $txn_date = '<a href="'.$view_lnk_url.'" title="' . esc_attr__( 'View Transaction Details for TXN #', 'event_espresso' ) . $item->ID() . '">' . $this->_get_txn_timestamp( $item ) . '</a>'; |
|
207 | + public function column_TXN_timestamp(EE_Transaction $item) { |
|
208 | + $view_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'view_transaction', 'TXN_ID'=>$item->ID()), TXN_ADMIN_URL); |
|
209 | + $txn_date = '<a href="'.$view_lnk_url.'" title="'.esc_attr__('View Transaction Details for TXN #', 'event_espresso').$item->ID().'">'.$this->_get_txn_timestamp($item).'</a>'; |
|
210 | 210 | //status |
211 | - $txn_date .= '<br><span class="ee-status-text-small">' . EEH_Template::pretty_status( $item->status_ID(), false, 'sentence' ) . '</span>'; |
|
211 | + $txn_date .= '<br><span class="ee-status-text-small">'.EEH_Template::pretty_status($item->status_ID(), false, 'sentence').'</span>'; |
|
212 | 212 | return $txn_date; |
213 | 213 | } |
214 | 214 | |
@@ -221,11 +221,11 @@ discard block |
||
221 | 221 | * @return string |
222 | 222 | * @throws \EE_Error |
223 | 223 | */ |
224 | - public function column_TXN_total( EE_Transaction $item ){ |
|
225 | - if ( $item->get('TXN_total') > 0 ) { |
|
226 | - return '<span class="txn-pad-rght">' . apply_filters( 'FHEE__EE_Admin_Transactions_List_Table__column_TXN_total__TXN_total', $item->get_pretty('TXN_total'), $item ) . '</span>'; |
|
224 | + public function column_TXN_total(EE_Transaction $item) { |
|
225 | + if ($item->get('TXN_total') > 0) { |
|
226 | + return '<span class="txn-pad-rght">'.apply_filters('FHEE__EE_Admin_Transactions_List_Table__column_TXN_total__TXN_total', $item->get_pretty('TXN_total'), $item).'</span>'; |
|
227 | 227 | } else { |
228 | - return '<span class="txn-overview-free-event-spn">' . __( 'free', 'event_espresso' ) . '</span>'; |
|
228 | + return '<span class="txn-overview-free-event-spn">'.__('free', 'event_espresso').'</span>'; |
|
229 | 229 | } |
230 | 230 | } |
231 | 231 | |
@@ -238,17 +238,17 @@ discard block |
||
238 | 238 | * @return mixed|string |
239 | 239 | * @throws \EE_Error |
240 | 240 | */ |
241 | - public function column_TXN_paid( EE_Transaction $item ){ |
|
241 | + public function column_TXN_paid(EE_Transaction $item) { |
|
242 | 242 | $transaction_total = $item->get('TXN_total'); |
243 | 243 | $transaction_paid = $item->get('TXN_paid'); |
244 | 244 | |
245 | - if ( \EEH_Money::compare_floats( $transaction_total, 0,'>' ) ) { |
|
245 | + if (\EEH_Money::compare_floats($transaction_total, 0, '>')) { |
|
246 | 246 | // monies owing |
247 | 247 | $span_class = 'txn-overview-part-payment-spn'; |
248 | - if ( \EEH_Money::compare_floats( $transaction_paid, $transaction_total, '>=' ) ) { |
|
248 | + if (\EEH_Money::compare_floats($transaction_paid, $transaction_total, '>=')) { |
|
249 | 249 | // paid in full |
250 | 250 | $span_class = 'txn-overview-full-payment-spn'; |
251 | - } elseif ( \EEH_Money::compare_floats( $transaction_paid, 0, '==' ) ) { |
|
251 | + } elseif (\EEH_Money::compare_floats($transaction_paid, 0, '==')) { |
|
252 | 252 | // no payments made |
253 | 253 | $span_class = 'txn-overview-no-payment-spn'; |
254 | 254 | } |
@@ -258,11 +258,11 @@ discard block |
||
258 | 258 | } |
259 | 259 | |
260 | 260 | $payment_method = $item->payment_method(); |
261 | - $payment_method_name = $payment_method instanceof EE_Payment_Method ? $payment_method->admin_name() : __( 'Unknown', 'event_espresso' ); |
|
261 | + $payment_method_name = $payment_method instanceof EE_Payment_Method ? $payment_method->admin_name() : __('Unknown', 'event_espresso'); |
|
262 | 262 | |
263 | - $content = '<span class="' . $span_class . ' txn-pad-rght">' . $transaction_paid !== 0 ? $item->get_pretty('TXN_paid') : $transaction_paid . '</span>'; |
|
264 | - if ( $transaction_paid > 0 ) { |
|
265 | - $content .= '<br><span class="ee-status-text-small">' . sprintf( __( '...via %s', 'event_espresso' ), $payment_method_name ) . '</span>'; |
|
263 | + $content = '<span class="'.$span_class.' txn-pad-rght">'.$transaction_paid !== 0 ? $item->get_pretty('TXN_paid') : $transaction_paid.'</span>'; |
|
264 | + if ($transaction_paid > 0) { |
|
265 | + $content .= '<br><span class="ee-status-text-small">'.sprintf(__('...via %s', 'event_espresso'), $payment_method_name).'</span>'; |
|
266 | 266 | } |
267 | 267 | return $content; |
268 | 268 | } |
@@ -276,13 +276,13 @@ discard block |
||
276 | 276 | * @return string|void |
277 | 277 | * @throws \EE_Error |
278 | 278 | */ |
279 | - public function column_ATT_fname( EE_Transaction $item ){ |
|
279 | + public function column_ATT_fname(EE_Transaction $item) { |
|
280 | 280 | $primary_reg = $item->primary_registration(); |
281 | 281 | $attendee = $primary_reg->get_first_related('Attendee'); |
282 | - if ( $attendee instanceof EE_Attendee ) { |
|
283 | - $edit_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'view_registration', '_REG_ID'=>$primary_reg->ID() ), REG_ADMIN_URL ); |
|
284 | - $content = EE_Registry::instance()->CAP->current_user_can( 'ee_read_registration', 'espresso_registrations_view_registration', $primary_reg->ID() ) ? '<a href="'.$edit_lnk_url.'" title="' . esc_attr__( 'View Registration Details', 'event_espresso' ) . '">' . $attendee->full_name() . '</a>' : $attendee->full_name(); |
|
285 | - $content .= '<br>' . $attendee->email(); |
|
282 | + if ($attendee instanceof EE_Attendee) { |
|
283 | + $edit_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'view_registration', '_REG_ID'=>$primary_reg->ID()), REG_ADMIN_URL); |
|
284 | + $content = EE_Registry::instance()->CAP->current_user_can('ee_read_registration', 'espresso_registrations_view_registration', $primary_reg->ID()) ? '<a href="'.$edit_lnk_url.'" title="'.esc_attr__('View Registration Details', 'event_espresso').'">'.$attendee->full_name().'</a>' : $attendee->full_name(); |
|
285 | + $content .= '<br>'.$attendee->email(); |
|
286 | 286 | return $content; |
287 | 287 | } |
288 | 288 | return $item->failed() || $item->is_abandoned() ? __('no contact record.', 'event_espresso') : __('No contact record, because the transaction was abandoned or the registration process failed.', 'event_espresso'); |
@@ -297,13 +297,13 @@ discard block |
||
297 | 297 | * @return string|void |
298 | 298 | * @throws \EE_Error |
299 | 299 | */ |
300 | - public function column_ATT_email( EE_Transaction $item ){ |
|
300 | + public function column_ATT_email(EE_Transaction $item) { |
|
301 | 301 | $attendee = $item->primary_registration()->get_first_related('Attendee'); |
302 | - if ( ! empty( $attendee ) ) { |
|
303 | - return '<a href="mailto:' . $attendee->get( 'ATT_email' ) . '">' . $attendee->get( 'ATT_email' ) . '</a>'; |
|
302 | + if ( ! empty($attendee)) { |
|
303 | + return '<a href="mailto:'.$attendee->get('ATT_email').'">'.$attendee->get('ATT_email').'</a>'; |
|
304 | 304 | } else { |
305 | 305 | return $item->failed() || $item->is_abandoned() |
306 | - ? __( 'no contact record.', 'event_espresso' ) |
|
306 | + ? __('no contact record.', 'event_espresso') |
|
307 | 307 | : __( |
308 | 308 | 'No contact record, because the transaction was abandoned or the registration process failed.', |
309 | 309 | 'event_espresso' |
@@ -320,20 +320,20 @@ discard block |
||
320 | 320 | * @return string|void |
321 | 321 | * @throws \EE_Error |
322 | 322 | */ |
323 | - public function column_event_name( EE_Transaction $item ){ |
|
323 | + public function column_event_name(EE_Transaction $item) { |
|
324 | 324 | $actions = array(); |
325 | 325 | $event = $item->primary_registration()->get_first_related('Event'); |
326 | - if ( !empty( $event ) ) { |
|
327 | - $edit_event_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'edit', 'post'=>$event->ID() ), EVENTS_ADMIN_URL ); |
|
326 | + if ( ! empty($event)) { |
|
327 | + $edit_event_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'edit', 'post'=>$event->ID()), EVENTS_ADMIN_URL); |
|
328 | 328 | $event_name = $event->get('EVT_name'); |
329 | 329 | |
330 | 330 | //filter this view by transactions for this event |
331 | - $txn_by_event_lnk = EE_Admin_Page::add_query_args_and_nonce( array( 'action' => 'default', 'EVT_ID' => $event->ID() ) ); |
|
332 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_edit_event', 'espresso_events_edit', $event->ID() ) ) { |
|
333 | - $actions['filter_by_event'] = '<a href="' . $txn_by_event_lnk . '" title="' . esc_attr__('Filter transactions by this event', 'event_espresso') . '">' . __('View Transactions for this event', 'event_espresso') . '</a>'; |
|
331 | + $txn_by_event_lnk = EE_Admin_Page::add_query_args_and_nonce(array('action' => 'default', 'EVT_ID' => $event->ID())); |
|
332 | + if (EE_Registry::instance()->CAP->current_user_can('ee_edit_event', 'espresso_events_edit', $event->ID())) { |
|
333 | + $actions['filter_by_event'] = '<a href="'.$txn_by_event_lnk.'" title="'.esc_attr__('Filter transactions by this event', 'event_espresso').'">'.__('View Transactions for this event', 'event_espresso').'</a>'; |
|
334 | 334 | } |
335 | 335 | |
336 | - return sprintf('%1$s %2$s', EE_Registry::instance()->CAP->current_user_can( 'ee_edit_event', 'espresso_events_edit', $event->ID() ) ? '<a href="' . $edit_event_url . '" title="' . sprintf( esc_attr__( 'Edit Event: %s', 'event_espresso' ), $event->get('EVT_name') ) .'">' . wp_trim_words( $event_name, 30, '...' ) . '</a>' : wp_trim_words( $event_name, 30, '...' ), $this->row_actions($actions) ); |
|
336 | + return sprintf('%1$s %2$s', EE_Registry::instance()->CAP->current_user_can('ee_edit_event', 'espresso_events_edit', $event->ID()) ? '<a href="'.$edit_event_url.'" title="'.sprintf(esc_attr__('Edit Event: %s', 'event_espresso'), $event->get('EVT_name')).'">'.wp_trim_words($event_name, 30, '...').'</a>' : wp_trim_words($event_name, 30, '...'), $this->row_actions($actions)); |
|
337 | 337 | } else { |
338 | 338 | return __('The event associated with this transaction via the primary registration cannot be retrieved.', 'event_espresso'); |
339 | 339 | } |
@@ -348,35 +348,35 @@ discard block |
||
348 | 348 | * @return string |
349 | 349 | * @throws \EE_Error |
350 | 350 | */ |
351 | - public function column_actions( EE_Transaction $item ){ |
|
351 | + public function column_actions(EE_Transaction $item) { |
|
352 | 352 | |
353 | 353 | $registration = $item->primary_registration(); |
354 | 354 | $attendee = $registration->attendee(); |
355 | 355 | |
356 | 356 | //Build row actions |
357 | - $view_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'view_transaction', 'TXN_ID'=>$item->ID() ), TXN_ADMIN_URL ); |
|
357 | + $view_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'view_transaction', 'TXN_ID'=>$item->ID()), TXN_ADMIN_URL); |
|
358 | 358 | $dl_invoice_lnk_url = $registration->invoice_url(); |
359 | 359 | $dl_receipt_lnk_url = $registration->receipt_url(); |
360 | - $view_reg_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'view_registration', '_REG_ID'=>$registration->ID() ), REG_ADMIN_URL ); |
|
361 | - $send_pay_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'send_payment_reminder', 'TXN_ID'=>$item->ID() ), TXN_ADMIN_URL ); |
|
362 | - $related_messages_link = EEH_MSG_Template::get_message_action_link( 'see_notifications_for', null, array( |
|
360 | + $view_reg_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'view_registration', '_REG_ID'=>$registration->ID()), REG_ADMIN_URL); |
|
361 | + $send_pay_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'send_payment_reminder', 'TXN_ID'=>$item->ID()), TXN_ADMIN_URL); |
|
362 | + $related_messages_link = EEH_MSG_Template::get_message_action_link('see_notifications_for', null, array( |
|
363 | 363 | 'TXN_ID' => $item->ID() |
364 | 364 | )); |
365 | 365 | |
366 | 366 | //Build row actions |
367 | 367 | $view_lnk = ' |
368 | 368 | <li> |
369 | - <a href="'.$view_lnk_url.'" title="' . esc_attr__( 'View Transaction Details', 'event_espresso' ) . '" class="tiny-text"> |
|
369 | + <a href="'.$view_lnk_url.'" title="'.esc_attr__('View Transaction Details', 'event_espresso').'" class="tiny-text"> |
|
370 | 370 | <span class="dashicons dashicons-cart"></span> |
371 | 371 | </a> |
372 | 372 | </li>'; |
373 | 373 | |
374 | 374 | $dl_invoice_lnk = ''; |
375 | 375 | //only show invoice link if message type is active. |
376 | - if ( $attendee instanceof EE_Attendee && EEH_MSG_Template::is_mt_active( 'invoice' ) ) { |
|
376 | + if ($attendee instanceof EE_Attendee && EEH_MSG_Template::is_mt_active('invoice')) { |
|
377 | 377 | $dl_invoice_lnk = ' |
378 | 378 | <li> |
379 | - <a title="' . esc_attr__( 'View Transaction Invoice', 'event_espresso' ) . '" target="_blank" href="'.$dl_invoice_lnk_url.'" class="tiny-text"> |
|
379 | + <a title="' . esc_attr__('View Transaction Invoice', 'event_espresso').'" target="_blank" href="'.$dl_invoice_lnk_url.'" class="tiny-text"> |
|
380 | 380 | <span class="dashicons dashicons-media-spreadsheet ee-icon-size-18"></span> |
381 | 381 | </a> |
382 | 382 | </li>'; |
@@ -384,17 +384,17 @@ discard block |
||
384 | 384 | |
385 | 385 | $dl_receipt_lnk = ''; |
386 | 386 | //only show receipt link if message type is active. |
387 | - if ( $attendee instanceof EE_Attendee && EEH_MSG_Template::is_mt_active( 'receipt' ) ) { |
|
387 | + if ($attendee instanceof EE_Attendee && EEH_MSG_Template::is_mt_active('receipt')) { |
|
388 | 388 | $dl_receipt_lnk = ' |
389 | 389 | <li> |
390 | - <a title="' . esc_attr__( 'View Transaction Receipt', 'event_espresso' ) . '" target="_blank" href="'.$dl_receipt_lnk_url.'" class="tiny-text"> |
|
390 | + <a title="' . esc_attr__('View Transaction Receipt', 'event_espresso').'" target="_blank" href="'.$dl_receipt_lnk_url.'" class="tiny-text"> |
|
391 | 391 | <span class="dashicons dashicons-media-default ee-icon-size-18"></span> |
392 | 392 | </a> |
393 | 393 | </li>'; |
394 | 394 | } |
395 | 395 | |
396 | 396 | //only show payment reminder link if the message type is active. |
397 | - if ( EEH_MSG_Template::is_mt_active( 'payment_reminder' ) ) { |
|
397 | + if (EEH_MSG_Template::is_mt_active('payment_reminder')) { |
|
398 | 398 | $send_pay_lnk = $attendee instanceof EE_Attendee |
399 | 399 | && EE_Registry::instance()->CAP->current_user_can( |
400 | 400 | 'ee_send_message', |
@@ -402,7 +402,7 @@ discard block |
||
402 | 402 | ) |
403 | 403 | ? ' |
404 | 404 | <li> |
405 | - <a href="'.$send_pay_lnk_url.'" title="' . esc_attr__( 'Send Payment Reminder', 'event_espresso' ) . '" class="tiny-text"> |
|
405 | + <a href="'.$send_pay_lnk_url.'" title="'.esc_attr__('Send Payment Reminder', 'event_espresso').'" class="tiny-text"> |
|
406 | 406 | <span class="dashicons dashicons-email-alt"></span> |
407 | 407 | </a> |
408 | 408 | </li>' |
@@ -422,18 +422,18 @@ discard block |
||
422 | 422 | ) |
423 | 423 | ? ' |
424 | 424 | <li> |
425 | - <a href="'.$view_reg_lnk_url.'" title="' . esc_attr__( 'View Registration Details', 'event_espresso' ) . '" class="tiny-text"> |
|
425 | + <a href="'.$view_reg_lnk_url.'" title="'.esc_attr__('View Registration Details', 'event_espresso').'" class="tiny-text"> |
|
426 | 426 | <span class="dashicons dashicons-clipboard"></span> |
427 | 427 | </a> |
428 | 428 | </li>' |
429 | 429 | : ''; |
430 | 430 | |
431 | 431 | $view_related_messages_lnk = ''; |
432 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_read_global_messages', 'view_filtered_messages' ) ) { |
|
433 | - $view_related_messages_lnk = '<li>' . $related_messages_link . '</li>'; |
|
432 | + if (EE_Registry::instance()->CAP->current_user_can('ee_read_global_messages', 'view_filtered_messages')) { |
|
433 | + $view_related_messages_lnk = '<li>'.$related_messages_link.'</li>'; |
|
434 | 434 | } |
435 | 435 | |
436 | - return $this->_action_string( $view_lnk . $dl_invoice_lnk . $dl_receipt_lnk . $view_reg_lnk . $send_pay_lnk . $view_related_messages_lnk, $item, 'ul', 'txn-overview-actions-ul' ); |
|
436 | + return $this->_action_string($view_lnk.$dl_invoice_lnk.$dl_receipt_lnk.$view_reg_lnk.$send_pay_lnk.$view_related_messages_lnk, $item, 'ul', 'txn-overview-actions-ul'); |
|
437 | 437 | } |
438 | 438 | |
439 | 439 |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | -if (!defined('EVENT_ESPRESSO_VERSION') ){ |
|
2 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
3 | 3 | exit('NO direct script access allowed'); |
4 | 4 | } |
5 | 5 | /** |
@@ -26,8 +26,8 @@ discard block |
||
26 | 26 | |
27 | 27 | |
28 | 28 | protected function _setup_data() { |
29 | - $this->_data = $this->_get_messages( $this->_per_page, $this->_view ); |
|
30 | - $this->_all_data_count = $this->_get_messages( $this->_per_page, $this->_view, true ); |
|
29 | + $this->_data = $this->_get_messages($this->_per_page, $this->_view); |
|
30 | + $this->_all_data_count = $this->_get_messages($this->_per_page, $this->_view, true); |
|
31 | 31 | } |
32 | 32 | |
33 | 33 | |
@@ -35,32 +35,32 @@ discard block |
||
35 | 35 | |
36 | 36 | protected function _set_properties() { |
37 | 37 | $this->_wp_list_args = array( |
38 | - 'singular' => __( 'Message', 'event_espresso' ), |
|
39 | - 'plural' => __( 'Messages', 'event_espresso' ), |
|
38 | + 'singular' => __('Message', 'event_espresso'), |
|
39 | + 'plural' => __('Messages', 'event_espresso'), |
|
40 | 40 | 'ajax' => true, |
41 | 41 | 'screen' => $this->get_admin_page()->get_current_screen()->id |
42 | 42 | ); |
43 | 43 | |
44 | 44 | $this->_columns = array( |
45 | 45 | 'cb' => '<input type="checkbox" />', |
46 | - 'to' => __( 'To', 'event_espresso' ), |
|
47 | - 'from' => __( 'From', 'event_espresso' ), |
|
48 | - 'messenger' => __( 'Messenger', 'event_espresso' ), |
|
49 | - 'message_type' => __( 'Message Type', 'event_espresso' ), |
|
50 | - 'context' => __( 'Context', 'event_espresso' ), |
|
51 | - 'modified' => __( 'Modified', 'event_espresso' ), |
|
52 | - 'action' => __( 'Actions', 'event_espresso' ), |
|
53 | - 'msg_id' => __( 'ID', 'event_espresso' ), |
|
46 | + 'to' => __('To', 'event_espresso'), |
|
47 | + 'from' => __('From', 'event_espresso'), |
|
48 | + 'messenger' => __('Messenger', 'event_espresso'), |
|
49 | + 'message_type' => __('Message Type', 'event_espresso'), |
|
50 | + 'context' => __('Context', 'event_espresso'), |
|
51 | + 'modified' => __('Modified', 'event_espresso'), |
|
52 | + 'action' => __('Actions', 'event_espresso'), |
|
53 | + 'msg_id' => __('ID', 'event_espresso'), |
|
54 | 54 | ); |
55 | 55 | |
56 | 56 | $this->_sortable_columns = array( |
57 | - 'modified' => array( 'MSG_modified' => true ), |
|
58 | - 'message_type' => array( 'MSG_message_type' => false ), |
|
59 | - 'messenger' => array( 'MSG_messenger' => false ), |
|
60 | - 'to' => array( 'MSG_to' => false ), |
|
61 | - 'from' => array( 'MSG_from' => false ), |
|
62 | - 'context' => array( 'MSG_context' => false ), |
|
63 | - 'msg_id' => array( 'MSG_ID', false ), |
|
57 | + 'modified' => array('MSG_modified' => true), |
|
58 | + 'message_type' => array('MSG_message_type' => false), |
|
59 | + 'messenger' => array('MSG_messenger' => false), |
|
60 | + 'to' => array('MSG_to' => false), |
|
61 | + 'from' => array('MSG_from' => false), |
|
62 | + 'context' => array('MSG_context' => false), |
|
63 | + 'msg_id' => array('MSG_ID', false), |
|
64 | 64 | ); |
65 | 65 | |
66 | 66 | $this->_primary_column = 'to'; |
@@ -78,11 +78,11 @@ discard block |
||
78 | 78 | * @param object $item the current item |
79 | 79 | * @return string |
80 | 80 | */ |
81 | - protected function _get_row_class( $item ) { |
|
82 | - $class = parent::_get_row_class( $item ); |
|
81 | + protected function _get_row_class($item) { |
|
82 | + $class = parent::_get_row_class($item); |
|
83 | 83 | //add status class |
84 | - $class .= ' ee-status-strip msg-status-' . $item->STS_ID(); |
|
85 | - if ( $this->_has_checkbox_column ) { |
|
84 | + $class .= ' ee-status-strip msg-status-'.$item->STS_ID(); |
|
85 | + if ($this->_has_checkbox_column) { |
|
86 | 86 | $class .= ' has-checkbox-column'; |
87 | 87 | } |
88 | 88 | return $class; |
@@ -101,7 +101,7 @@ discard block |
||
101 | 101 | */ |
102 | 102 | protected function _get_table_filters() { |
103 | 103 | $filters = array(); |
104 | - EE_Registry::instance()->load_helper( 'Form_Fields' ); |
|
104 | + EE_Registry::instance()->load_helper('Form_Fields'); |
|
105 | 105 | //setup messengers for selects |
106 | 106 | $m_values = $this->get_admin_page()->get_messengers_for_list_table(); |
107 | 107 | //lets do the same for message types |
@@ -110,88 +110,88 @@ discard block |
||
110 | 110 | $contexts = $this->get_admin_page()->get_contexts_for_message_types_for_list_table(); |
111 | 111 | $i = 1; |
112 | 112 | $labels = $c_values = array(); |
113 | - foreach ( $contexts as $context => $label ) { |
|
113 | + foreach ($contexts as $context => $label) { |
|
114 | 114 | //some message types may have the same label for a different context, so we're grouping these together so the end user |
115 | 115 | //doesn't get confused. |
116 | - if ( isset( $labels[ $label ] ) ) { |
|
117 | - $c_values[ $labels[ $label ] ]['id'] .= ',' . $context; |
|
116 | + if (isset($labels[$label])) { |
|
117 | + $c_values[$labels[$label]]['id'] .= ','.$context; |
|
118 | 118 | continue; |
119 | 119 | } |
120 | - $c_values[ $i ]['id'] = $context; |
|
121 | - $c_values[ $i ]['text'] = $label; |
|
122 | - $labels[ $label ] = $i; |
|
120 | + $c_values[$i]['id'] = $context; |
|
121 | + $c_values[$i]['text'] = $label; |
|
122 | + $labels[$label] = $i; |
|
123 | 123 | $i++; |
124 | 124 | } |
125 | 125 | |
126 | 126 | $msgr_default[0] = array( |
127 | 127 | 'id' => 'none_selected', |
128 | - 'text' => __( 'All Messengers', 'event_espresso' ) |
|
128 | + 'text' => __('All Messengers', 'event_espresso') |
|
129 | 129 | ); |
130 | 130 | |
131 | 131 | $mt_default[0] = array( |
132 | 132 | 'id' => 'none_selected', |
133 | - 'text' => __( 'All Message Types', 'event_espresso' ) |
|
133 | + 'text' => __('All Message Types', 'event_espresso') |
|
134 | 134 | ); |
135 | 135 | |
136 | 136 | $c_default[0] = array( |
137 | 137 | 'id' => 'none_selected', |
138 | - 'text' => __( 'All Contexts', 'event_espresso ' ) |
|
138 | + 'text' => __('All Contexts', 'event_espresso ') |
|
139 | 139 | ); |
140 | 140 | |
141 | - $msgr_filters = count( $m_values ) > 1 |
|
142 | - ? array_merge( $msgr_default, $m_values ) |
|
141 | + $msgr_filters = count($m_values) > 1 |
|
142 | + ? array_merge($msgr_default, $m_values) |
|
143 | 143 | : $m_values; |
144 | - $mt_filters = ! empty( $mt_values ) && count( $mt_values ) > 1 |
|
145 | - ? array_merge( $mt_default, $mt_values ) |
|
144 | + $mt_filters = ! empty($mt_values) && count($mt_values) > 1 |
|
145 | + ? array_merge($mt_default, $mt_values) |
|
146 | 146 | : (array) $mt_values; |
147 | - $c_filters = ! empty( $c_values ) && count( $c_values ) > 1 |
|
148 | - ? array_merge( $c_default, $c_values ) |
|
147 | + $c_filters = ! empty($c_values) && count($c_values) > 1 |
|
148 | + ? array_merge($c_default, $c_values) |
|
149 | 149 | : (array) $c_values; |
150 | 150 | |
151 | - if ( empty( $msgr_filters ) ) { |
|
151 | + if (empty($msgr_filters)) { |
|
152 | 152 | $msgr_filters[0] = array( |
153 | 153 | 'id' => 'none_selected', |
154 | - 'text' => __( 'No Messengers active', 'event_espresso' ) |
|
154 | + 'text' => __('No Messengers active', 'event_espresso') |
|
155 | 155 | ); |
156 | 156 | } |
157 | 157 | |
158 | - if ( empty( $mt_filters ) ) { |
|
158 | + if (empty($mt_filters)) { |
|
159 | 159 | $mt_filters[0] = array( |
160 | 160 | 'id' => 'none_selected', |
161 | - 'text' => __( 'No Message Types active', 'event_espresso' ) |
|
161 | + 'text' => __('No Message Types active', 'event_espresso') |
|
162 | 162 | ); |
163 | 163 | } |
164 | 164 | |
165 | - if ( empty( $c_filters ) ) { |
|
165 | + if (empty($c_filters)) { |
|
166 | 166 | $c_filters[0] = array( |
167 | 167 | 'id' => 'none_selected', |
168 | - 'text' => __( 'No Contexts (because no message types active)', 'event_espresso' ) |
|
168 | + 'text' => __('No Contexts (because no message types active)', 'event_espresso') |
|
169 | 169 | ); |
170 | 170 | } |
171 | 171 | |
172 | - if ( count ( $msgr_filters ) > 1 ) { |
|
172 | + if (count($msgr_filters) > 1) { |
|
173 | 173 | $filters[] = EEH_Form_Fields::select_input( |
174 | 174 | 'ee_messenger_filter_by', |
175 | - array_values( $msgr_filters ), |
|
176 | - isset( $this->_req_data['ee_messenger_filter_by'] ) |
|
177 | - ? sanitize_title( $this->_req_data['ee_messenger_filter_by'] ) |
|
175 | + array_values($msgr_filters), |
|
176 | + isset($this->_req_data['ee_messenger_filter_by']) |
|
177 | + ? sanitize_title($this->_req_data['ee_messenger_filter_by']) |
|
178 | 178 | : '' |
179 | 179 | ); |
180 | 180 | } |
181 | - if ( count( $mt_filters ) > 1 ) { |
|
181 | + if (count($mt_filters) > 1) { |
|
182 | 182 | $filters[] = EEH_Form_Fields::select_input( |
183 | 183 | 'ee_message_type_filter_by', |
184 | - array_values( $mt_filters ), |
|
185 | - isset( $this->_req_data['ee_message_type_filter_by'] ) ? sanitize_title( |
|
184 | + array_values($mt_filters), |
|
185 | + isset($this->_req_data['ee_message_type_filter_by']) ? sanitize_title( |
|
186 | 186 | $this->_req_data['ee_message_type_filter_by'] |
187 | 187 | ) : '' |
188 | 188 | ); |
189 | 189 | } |
190 | - if ( count( $c_filters ) > 1 ) { |
|
190 | + if (count($c_filters) > 1) { |
|
191 | 191 | $filters[] = EEH_Form_Fields::select_input( |
192 | 192 | 'ee_context_filter_by', |
193 | - array_values( $c_filters ), |
|
194 | - isset( $this->_req_data['ee_context_filter_by'] ) ? sanitize_text_field( |
|
193 | + array_values($c_filters), |
|
194 | + isset($this->_req_data['ee_context_filter_by']) ? sanitize_text_field( |
|
195 | 195 | $this->_req_data['ee_context_filter_by'] |
196 | 196 | ) : '' |
197 | 197 | ); |
@@ -202,8 +202,8 @@ discard block |
||
202 | 202 | |
203 | 203 | |
204 | 204 | protected function _add_view_counts() { |
205 | - foreach ( $this->_views as $view => $args ) { |
|
206 | - $this->_views[ $view ]['count'] = $this->_get_messages( $this->_per_page, $view, true, true ); |
|
205 | + foreach ($this->_views as $view => $args) { |
|
206 | + $this->_views[$view]['count'] = $this->_get_messages($this->_per_page, $view, true, true); |
|
207 | 207 | } |
208 | 208 | } |
209 | 209 | |
@@ -214,8 +214,8 @@ discard block |
||
214 | 214 | * @return string checkbox |
215 | 215 | * @throws \EE_Error |
216 | 216 | */ |
217 | - public function column_cb( $message ) { |
|
218 | - return sprintf( '<input type="checkbox" name="MSG_ID[%s]" value="1" />', $message->ID() ); |
|
217 | + public function column_cb($message) { |
|
218 | + return sprintf('<input type="checkbox" name="MSG_ID[%s]" value="1" />', $message->ID()); |
|
219 | 219 | } |
220 | 220 | |
221 | 221 | |
@@ -225,7 +225,7 @@ discard block |
||
225 | 225 | * @return string |
226 | 226 | * @throws \EE_Error |
227 | 227 | */ |
228 | - public function column_msg_id( EE_Message $message ) { |
|
228 | + public function column_msg_id(EE_Message $message) { |
|
229 | 229 | return $message->ID(); |
230 | 230 | } |
231 | 231 | |
@@ -236,8 +236,8 @@ discard block |
||
236 | 236 | * @return string The recipient of the message |
237 | 237 | * @throws \EE_Error |
238 | 238 | */ |
239 | - public function column_to( EE_Message $message ) { |
|
240 | - EE_Registry::instance()->load_helper( 'URL' ); |
|
239 | + public function column_to(EE_Message $message) { |
|
240 | + EE_Registry::instance()->load_helper('URL'); |
|
241 | 241 | $actions = array(); |
242 | 242 | $actions['delete'] = '<a href="' |
243 | 243 | . EEH_URL::add_query_args_and_nonce( |
@@ -246,10 +246,10 @@ discard block |
||
246 | 246 | 'action' => 'delete_ee_message', |
247 | 247 | 'MSG_ID' => $message->ID() |
248 | 248 | ), |
249 | - admin_url( 'admin.php' ) |
|
249 | + admin_url('admin.php') |
|
250 | 250 | ) |
251 | - . '">' . __( 'Delete', 'event_espresso' ) . '</a>'; |
|
252 | - return $message->to() . $this->row_actions( $actions ); |
|
251 | + . '">'.__('Delete', 'event_espresso').'</a>'; |
|
252 | + return $message->to().$this->row_actions($actions); |
|
253 | 253 | } |
254 | 254 | |
255 | 255 | |
@@ -257,7 +257,7 @@ discard block |
||
257 | 257 | * @param EE_Message $message |
258 | 258 | * @return string The sender of the message |
259 | 259 | */ |
260 | - public function column_from( EE_Message $message ) { |
|
260 | + public function column_from(EE_Message $message) { |
|
261 | 261 | return $message->from(); |
262 | 262 | } |
263 | 263 | |
@@ -267,8 +267,8 @@ discard block |
||
267 | 267 | * @param EE_Message $message |
268 | 268 | * @return string The messenger used to send the message. |
269 | 269 | */ |
270 | - public function column_messenger( EE_Message $message ) { |
|
271 | - return ucwords( $message->messenger_label() ); |
|
270 | + public function column_messenger(EE_Message $message) { |
|
271 | + return ucwords($message->messenger_label()); |
|
272 | 272 | } |
273 | 273 | |
274 | 274 | |
@@ -276,8 +276,8 @@ discard block |
||
276 | 276 | * @param EE_Message $message |
277 | 277 | * @return string The message type used to generate the message. |
278 | 278 | */ |
279 | - public function column_message_type( EE_Message $message ) { |
|
280 | - return ucwords( $message->message_type_label() ); |
|
279 | + public function column_message_type(EE_Message $message) { |
|
280 | + return ucwords($message->message_type_label()); |
|
281 | 281 | } |
282 | 282 | |
283 | 283 | |
@@ -285,7 +285,7 @@ discard block |
||
285 | 285 | * @param EE_Message $message |
286 | 286 | * @return string The context the message was generated for. |
287 | 287 | */ |
288 | - public function column_context( EE_Message $message ) { |
|
288 | + public function column_context(EE_Message $message) { |
|
289 | 289 | return $message->context_label(); |
290 | 290 | } |
291 | 291 | |
@@ -294,7 +294,7 @@ discard block |
||
294 | 294 | * @param EE_Message $message |
295 | 295 | * @return string The timestamp when this message was last modified. |
296 | 296 | */ |
297 | - public function column_modified( EE_Message $message ) { |
|
297 | + public function column_modified(EE_Message $message) { |
|
298 | 298 | return $message->modified(); |
299 | 299 | } |
300 | 300 | |
@@ -303,36 +303,36 @@ discard block |
||
303 | 303 | * @param EE_Message $message |
304 | 304 | * @return string Actions that can be done on the current message. |
305 | 305 | */ |
306 | - public function column_action( EE_Message $message ) { |
|
307 | - EE_Registry::instance()->load_helper( 'MSG_Template' ); |
|
306 | + public function column_action(EE_Message $message) { |
|
307 | + EE_Registry::instance()->load_helper('MSG_Template'); |
|
308 | 308 | $action_links = array( |
309 | - 'view' => EEH_MSG_Template::get_message_action_link( 'view', $message ), |
|
310 | - 'error' => EEH_MSG_Template::get_message_action_link( 'error', $message ), |
|
311 | - 'generate_now' => EEH_MSG_Template::get_message_action_link( 'generate_now', $message ), |
|
312 | - 'send_now' => EEH_MSG_Template::get_message_action_link( 'send_now', $message ), |
|
313 | - 'queue_for_resending' => EEH_MSG_Template::get_message_action_link( 'queue_for_resending', $message ), |
|
314 | - 'view_transaction' => EEH_MSG_Template::get_message_action_link( 'view_transaction', $message ), |
|
309 | + 'view' => EEH_MSG_Template::get_message_action_link('view', $message), |
|
310 | + 'error' => EEH_MSG_Template::get_message_action_link('error', $message), |
|
311 | + 'generate_now' => EEH_MSG_Template::get_message_action_link('generate_now', $message), |
|
312 | + 'send_now' => EEH_MSG_Template::get_message_action_link('send_now', $message), |
|
313 | + 'queue_for_resending' => EEH_MSG_Template::get_message_action_link('queue_for_resending', $message), |
|
314 | + 'view_transaction' => EEH_MSG_Template::get_message_action_link('view_transaction', $message), |
|
315 | 315 | ); |
316 | 316 | $content = ''; |
317 | - switch ( $message->STS_ID() ) { |
|
317 | + switch ($message->STS_ID()) { |
|
318 | 318 | case EEM_Message::status_sent : |
319 | - $content = $action_links['view'] . $action_links['queue_for_resending'] . $action_links['view_transaction']; |
|
319 | + $content = $action_links['view'].$action_links['queue_for_resending'].$action_links['view_transaction']; |
|
320 | 320 | break; |
321 | 321 | case EEM_Message::status_resend : |
322 | - $content = $action_links['view'] . $action_links['send_now'] . $action_links['view_transaction']; |
|
322 | + $content = $action_links['view'].$action_links['send_now'].$action_links['view_transaction']; |
|
323 | 323 | break; |
324 | 324 | case EEM_Message::status_retry : |
325 | - $content = $action_links['view'] . $action_links['send_now'] . $action_links['error'] . $action_links['view_transaction']; |
|
325 | + $content = $action_links['view'].$action_links['send_now'].$action_links['error'].$action_links['view_transaction']; |
|
326 | 326 | break; |
327 | 327 | case EEM_Message::status_failed : |
328 | 328 | case EEM_Message::status_debug_only : |
329 | - $content = $action_links['error'] . $action_links['view_transaction']; |
|
329 | + $content = $action_links['error'].$action_links['view_transaction']; |
|
330 | 330 | break; |
331 | 331 | case EEM_Message::status_idle : |
332 | - $content = $action_links['view'] . $action_links['send_now'] . $action_links['view_transaction']; |
|
332 | + $content = $action_links['view'].$action_links['send_now'].$action_links['view_transaction']; |
|
333 | 333 | break; |
334 | 334 | case EEM_Message::status_incomplete; |
335 | - $content = $action_links['generate_now'] . $action_links['view_transaction']; |
|
335 | + $content = $action_links['generate_now'].$action_links['view_transaction']; |
|
336 | 336 | break; |
337 | 337 | } |
338 | 338 | return $content; |
@@ -350,69 +350,69 @@ discard block |
||
350 | 350 | * @return int | EE_Message[] |
351 | 351 | * @throws \EE_Error |
352 | 352 | */ |
353 | - protected function _get_messages( $perpage = 10, $view = 'all', $count = false, $all = false ) { |
|
353 | + protected function _get_messages($perpage = 10, $view = 'all', $count = false, $all = false) { |
|
354 | 354 | |
355 | - $current_page = isset( $this->_req_data['paged'] ) && ! empty( $this->_req_data['paged'] ) |
|
355 | + $current_page = isset($this->_req_data['paged']) && ! empty($this->_req_data['paged']) |
|
356 | 356 | ? $this->_req_data['paged'] |
357 | 357 | : 1; |
358 | 358 | |
359 | - $per_page = isset( $this->_req_data['perpage'] ) && ! empty( $this->_req_data['perpage'] ) |
|
359 | + $per_page = isset($this->_req_data['perpage']) && ! empty($this->_req_data['perpage']) |
|
360 | 360 | ? $this->_req_data['perpage'] |
361 | 361 | : $perpage; |
362 | 362 | |
363 | - $offset = ( $current_page - 1 ) * $per_page; |
|
364 | - $limit = $all || $count ? null : array( $offset, $per_page ); |
|
363 | + $offset = ($current_page - 1) * $per_page; |
|
364 | + $limit = $all || $count ? null : array($offset, $per_page); |
|
365 | 365 | $query_params = array( |
366 | - 'order_by' => empty( $this->_req_data[ 'orderby' ] ) ? 'MSG_modified' : $this->_req_data[ 'orderby' ], |
|
367 | - 'order' => empty( $this->_req_data[ 'order' ] ) ? 'DESC' : $this->_req_data[ 'order' ], |
|
366 | + 'order_by' => empty($this->_req_data['orderby']) ? 'MSG_modified' : $this->_req_data['orderby'], |
|
367 | + 'order' => empty($this->_req_data['order']) ? 'DESC' : $this->_req_data['order'], |
|
368 | 368 | 'limit' => $limit, |
369 | 369 | ); |
370 | 370 | |
371 | 371 | /** |
372 | 372 | * Any filters coming in from other routes? |
373 | 373 | */ |
374 | - if ( isset( $this->_req_data['filterby'] ) ) { |
|
375 | - $query_params = array_merge( $query_params, EEM_Message::instance()->filter_by_query_params() ); |
|
376 | - if ( ! $count ) { |
|
374 | + if (isset($this->_req_data['filterby'])) { |
|
375 | + $query_params = array_merge($query_params, EEM_Message::instance()->filter_by_query_params()); |
|
376 | + if ( ! $count) { |
|
377 | 377 | $query_params['group_by'] = 'MSG_ID'; |
378 | 378 | } |
379 | 379 | } |
380 | 380 | |
381 | 381 | //view conditionals |
382 | - if ( $view !== 'all' && $count && $all ) { |
|
382 | + if ($view !== 'all' && $count && $all) { |
|
383 | 383 | $query_params[0]['AND*view_conditional'] = array( |
384 | - 'STS_ID' => strtoupper( $view ), |
|
384 | + 'STS_ID' => strtoupper($view), |
|
385 | 385 | ); |
386 | 386 | } |
387 | 387 | |
388 | - if ( ! $all && ! empty( $this->_req_data['status'] ) && $this->_req_data['status'] !== 'all' ) { |
|
388 | + if ( ! $all && ! empty($this->_req_data['status']) && $this->_req_data['status'] !== 'all') { |
|
389 | 389 | $query_params[0]['AND*view_conditional'] = array( |
390 | - 'STS_ID' => strtoupper( $this->_req_data['status'] ), |
|
390 | + 'STS_ID' => strtoupper($this->_req_data['status']), |
|
391 | 391 | ); |
392 | 392 | } |
393 | 393 | |
394 | - if ( ! $all && ! empty( $this->_req_data['s'] ) ) { |
|
395 | - $search_string = '%' . $this->_req_data['s'] . '%'; |
|
394 | + if ( ! $all && ! empty($this->_req_data['s'])) { |
|
395 | + $search_string = '%'.$this->_req_data['s'].'%'; |
|
396 | 396 | $query_params[0]['OR'] = array( |
397 | - 'MSG_to' => array( 'LIKE', $search_string ), |
|
398 | - 'MSG_from' => array( 'LIKE', $search_string ), |
|
399 | - 'MSG_subject' => array( 'LIKE', $search_string ), |
|
400 | - 'MSG_content' => array( 'LIKE', $search_string ), |
|
397 | + 'MSG_to' => array('LIKE', $search_string), |
|
398 | + 'MSG_from' => array('LIKE', $search_string), |
|
399 | + 'MSG_subject' => array('LIKE', $search_string), |
|
400 | + 'MSG_content' => array('LIKE', $search_string), |
|
401 | 401 | ); |
402 | 402 | } |
403 | 403 | |
404 | 404 | //account for debug only status. We don't show Messages with the EEM_Message::status_debug_only to clients when |
405 | 405 | //`WP_DEBUG` is false. |
406 | - if ( ! defined( 'WP_DEBUG' ) || ! WP_DEBUG ) { |
|
406 | + if ( ! defined('WP_DEBUG') || ! WP_DEBUG) { |
|
407 | 407 | $query_params[0]['AND*debug_only_conditional'] = array( |
408 | - 'STS_ID' => array( '!=', EEM_Message::status_debug_only ) |
|
408 | + 'STS_ID' => array('!=', EEM_Message::status_debug_only) |
|
409 | 409 | ); |
410 | 410 | } |
411 | 411 | |
412 | 412 | //account for filters |
413 | 413 | if ( |
414 | 414 | ! $all |
415 | - && isset( $this->_req_data['ee_messenger_filter_by'] ) |
|
415 | + && isset($this->_req_data['ee_messenger_filter_by']) |
|
416 | 416 | && $this->_req_data['ee_messenger_filter_by'] !== 'none_selected' |
417 | 417 | ) { |
418 | 418 | $query_params[0]['AND*messenger_filter'] = array( |
@@ -421,7 +421,7 @@ discard block |
||
421 | 421 | } |
422 | 422 | if ( |
423 | 423 | ! $all |
424 | - && ! empty( $this->_req_data['ee_message_type_filter_by'] ) |
|
424 | + && ! empty($this->_req_data['ee_message_type_filter_by']) |
|
425 | 425 | && $this->_req_data['ee_message_type_filter_by'] !== 'none_selected' |
426 | 426 | ) { |
427 | 427 | $query_params[0]['AND*message_type_filter'] = array( |
@@ -431,17 +431,17 @@ discard block |
||
431 | 431 | |
432 | 432 | if ( |
433 | 433 | ! $all |
434 | - && ! empty( $this->_req_data['ee_context_filter_by'] ) |
|
434 | + && ! empty($this->_req_data['ee_context_filter_by']) |
|
435 | 435 | && $this->_req_data['ee_context_filter_by'] !== 'none_selected' |
436 | 436 | ) { |
437 | 437 | $query_params[0]['AND*context_filter'] = array( |
438 | - 'MSG_context' => array( 'IN', explode( ',', $this->_req_data['ee_context_filter_by'] ) ) |
|
438 | + 'MSG_context' => array('IN', explode(',', $this->_req_data['ee_context_filter_by'])) |
|
439 | 439 | ); |
440 | 440 | } |
441 | 441 | |
442 | 442 | return $count |
443 | - ? EEM_Message::instance()->count( $query_params, null, true ) |
|
444 | - : EEM_Message::instance()->get_all( $query_params ); |
|
443 | + ? EEM_Message::instance()->count($query_params, null, true) |
|
444 | + : EEM_Message::instance()->get_all($query_params); |
|
445 | 445 | |
446 | 446 | } |
447 | 447 | } //end EE_Message_List_Table class |
448 | 448 | \ No newline at end of file |
@@ -101,7 +101,7 @@ discard block |
||
101 | 101 | * |
102 | 102 | * |
103 | 103 | * @throws EE_Error |
104 | - */ |
|
104 | + */ |
|
105 | 105 | protected function _load_message_resource_manager() { |
106 | 106 | $this->_message_resource_manager = EE_Registry::instance()->load_lib( 'Message_Resource_Manager' ); |
107 | 107 | } |
@@ -211,9 +211,9 @@ discard block |
||
211 | 211 | |
212 | 212 | /** |
213 | 213 | * an array for storing key => value pairs of request actions and their corresponding methods |
214 | - * @access protected |
|
215 | - * @return void |
|
216 | - */ |
|
214 | + * @access protected |
|
215 | + * @return void |
|
216 | + */ |
|
217 | 217 | protected function _set_page_routes() { |
218 | 218 | $grp_id = ! empty( $this->_req_data['GRP_ID'] ) && ! is_array( $this->_req_data['GRP_ID'] ) |
219 | 219 | ? $this->_req_data['GRP_ID'] |
@@ -517,8 +517,8 @@ discard block |
||
517 | 517 | protected function _add_screen_options_global_mtps() { |
518 | 518 | /** |
519 | 519 | * Note: the reason for the value swap here on $this->_admin_page_title is because $this->_per_page_screen_options |
520 | - * uses the $_admin_page_title property and we want different outputs in the different spots. |
|
521 | - */ |
|
520 | + * uses the $_admin_page_title property and we want different outputs in the different spots. |
|
521 | + */ |
|
522 | 522 | $page_title = $this->_admin_page_title; |
523 | 523 | $this->_admin_page_title = __('Global Message Templates', 'event_espresso'); |
524 | 524 | $this->_per_page_screen_option(); |
@@ -721,9 +721,9 @@ discard block |
||
721 | 721 | $common_bulk_actions = EE_Registry::instance()->CAP->current_user_can( 'ee_send_message', 'message_list_table_bulk_actions' ) |
722 | 722 | ? array( |
723 | 723 | 'generate_now' => __( 'Generate Now', 'event_espresso' ), |
724 | - 'generate_and_send_now' => __( 'Generate and Send Now', 'event_espresso' ), |
|
725 | - 'queue_for_resending' => __( 'Queue for Resending', 'event_espresso' ), |
|
726 | - 'send_now' => __( 'Send Now', 'event_espresso' ) |
|
724 | + 'generate_and_send_now' => __( 'Generate and Send Now', 'event_espresso' ), |
|
725 | + 'queue_for_resending' => __( 'Queue for Resending', 'event_espresso' ), |
|
726 | + 'send_now' => __( 'Send Now', 'event_espresso' ) |
|
727 | 727 | ) |
728 | 728 | : array(); |
729 | 729 | |
@@ -734,10 +734,10 @@ discard block |
||
734 | 734 | |
735 | 735 | $this->_views = array( |
736 | 736 | 'all' => array( |
737 | - 'slug' => 'all', |
|
738 | - 'label' => __( 'All', 'event_espresso' ), |
|
739 | - 'count' => 0, |
|
740 | - 'bulk_action' => array_merge( $common_bulk_actions, $delete_bulk_action ) |
|
737 | + 'slug' => 'all', |
|
738 | + 'label' => __( 'All', 'event_espresso' ), |
|
739 | + 'count' => 0, |
|
740 | + 'bulk_action' => array_merge( $common_bulk_actions, $delete_bulk_action ) |
|
741 | 741 | ) |
742 | 742 | ); |
743 | 743 | |
@@ -1127,9 +1127,9 @@ discard block |
||
1127 | 1127 | && in_array($extra_field, $v_fields) |
1128 | 1128 | && |
1129 | 1129 | ( |
1130 | - is_array($validators[$extra_field] ) |
|
1130 | + is_array($validators[$extra_field] ) |
|
1131 | 1131 | && isset( $validators[$extra_field]['msg'] ) |
1132 | - ) |
|
1132 | + ) |
|
1133 | 1133 | ? 'validate-error ' . $css_class |
1134 | 1134 | : $css_class; |
1135 | 1135 | |
@@ -1414,8 +1414,8 @@ discard block |
||
1414 | 1414 | $GRP_ID, |
1415 | 1415 | false, |
1416 | 1416 | add_query_arg( |
1417 | - array( 'action' => 'global_mtps' ), |
|
1418 | - $this->_admin_base_url |
|
1417 | + array( 'action' => 'global_mtps' ), |
|
1418 | + $this->_admin_base_url |
|
1419 | 1419 | ) |
1420 | 1420 | ); |
1421 | 1421 | |
@@ -1890,14 +1890,14 @@ discard block |
||
1890 | 1890 | |
1891 | 1891 | |
1892 | 1892 | /** |
1893 | - * This returns the shortcode selector skeleton for a given context and field. |
|
1894 | - * |
|
1895 | - * @since 4.9.rc.000 |
|
1896 | - * |
|
1893 | + * This returns the shortcode selector skeleton for a given context and field. |
|
1894 | + * |
|
1895 | + * @since 4.9.rc.000 |
|
1896 | + * |
|
1897 | 1897 | * @param string $field The name of the field retrieving shortcodes for. |
1898 | - * @param string $linked_input_id The css id of the input that the shortcodes get added to. |
|
1899 | - * @return string |
|
1900 | - */ |
|
1898 | + * @param string $linked_input_id The css id of the input that the shortcodes get added to. |
|
1899 | + * @return string |
|
1900 | + */ |
|
1901 | 1901 | protected function _get_shortcode_selector( $field, $linked_input_id ) { |
1902 | 1902 | $template_args = array( |
1903 | 1903 | 'shortcodes' => $this->_get_shortcodes( array( $field ), true ), |
@@ -2495,9 +2495,9 @@ discard block |
||
2495 | 2495 | |
2496 | 2496 | /** |
2497 | 2497 | * _learn_more_about_message_templates_link |
2498 | - * @access protected |
|
2499 | - * @return string |
|
2500 | - */ |
|
2498 | + * @access protected |
|
2499 | + * @return string |
|
2500 | + */ |
|
2501 | 2501 | protected function _learn_more_about_message_templates_link() { |
2502 | 2502 | return '<a class="hidden" style="margin:0 20px; cursor:pointer; font-size:12px;" >' . __('learn more about how message templates works', 'event_espresso') . '</a>'; |
2503 | 2503 | } |
@@ -3038,7 +3038,7 @@ discard block |
||
3038 | 3038 | /** @var EE_message_type $message_type */ |
3039 | 3039 | $message_type = $this->_message_resource_manager->get_message_type( $message_type_name ); |
3040 | 3040 | if ( $this->_message_resource_manager->is_message_type_active_for_messenger( $messenger_name, $message_type_name ) |
3041 | - && $message_type instanceof EE_message_type |
|
3041 | + && $message_type instanceof EE_message_type |
|
3042 | 3042 | ) { |
3043 | 3043 | $this->_template_args['data']['active_mts'][] = $message_type_name; |
3044 | 3044 | if ( $message_type->get_admin_settings_fields() ) { |
@@ -3374,10 +3374,10 @@ discard block |
||
3374 | 3374 | |
3375 | 3375 | /** |
3376 | 3376 | * This immediately generates any EE_Message ID's that are selected that are EEM_Message::status_incomplete |
3377 | - * However, this does not send immediately, it just queues for sending. |
|
3378 | - * |
|
3379 | - * @since 4.9.0 |
|
3380 | - */ |
|
3377 | + * However, this does not send immediately, it just queues for sending. |
|
3378 | + * |
|
3379 | + * @since 4.9.0 |
|
3380 | + */ |
|
3381 | 3381 | protected function _generate_now() { |
3382 | 3382 | $msg_ids = $this->_get_msg_ids_from_request(); |
3383 | 3383 | EED_Messages::generate_now( $msg_ids ); |
@@ -3388,11 +3388,11 @@ discard block |
||
3388 | 3388 | |
3389 | 3389 | /** |
3390 | 3390 | * This immediately generates AND sends any EE_Message's selected that are EEM_Message::status_incomplete or that are |
3391 | - * EEM_Message::status_resend or EEM_Message::status_idle |
|
3392 | - * |
|
3393 | - * @since 4.9.0 |
|
3394 | - * |
|
3395 | - */ |
|
3391 | + * EEM_Message::status_resend or EEM_Message::status_idle |
|
3392 | + * |
|
3393 | + * @since 4.9.0 |
|
3394 | + * |
|
3395 | + */ |
|
3396 | 3396 | protected function _generate_and_send_now() { |
3397 | 3397 | $this->_generate_now(); |
3398 | 3398 | $this->_send_now(); |
@@ -3405,9 +3405,9 @@ discard block |
||
3405 | 3405 | |
3406 | 3406 | /** |
3407 | 3407 | * This queues any EEM_Message::status_sent EE_Message ids in the request for resending. |
3408 | - * |
|
3409 | - * @since 4.9.0 |
|
3410 | - */ |
|
3408 | + * |
|
3409 | + * @since 4.9.0 |
|
3410 | + */ |
|
3411 | 3411 | protected function _queue_for_resending() { |
3412 | 3412 | $msg_ids = $this->_get_msg_ids_from_request(); |
3413 | 3413 | EED_Messages::queue_for_resending( $msg_ids ); |
@@ -3419,9 +3419,9 @@ discard block |
||
3419 | 3419 | |
3420 | 3420 | /** |
3421 | 3421 | * This sends immediately any EEM_Message::status_idle or EEM_Message::status_resend messages in the queue |
3422 | - * |
|
3423 | - * @since 4.9.0 |
|
3424 | - */ |
|
3422 | + * |
|
3423 | + * @since 4.9.0 |
|
3424 | + */ |
|
3425 | 3425 | protected function _send_now() { |
3426 | 3426 | $msg_ids = $this->_get_msg_ids_from_request(); |
3427 | 3427 | EED_Messages::send_now( $msg_ids ); |
@@ -3433,9 +3433,9 @@ discard block |
||
3433 | 3433 | |
3434 | 3434 | /** |
3435 | 3435 | * Deletes EE_messages for IDs in the request. |
3436 | - * |
|
3437 | - * @since 4.9.0 |
|
3438 | - */ |
|
3436 | + * |
|
3437 | + * @since 4.9.0 |
|
3438 | + */ |
|
3439 | 3439 | protected function _delete_ee_messages() { |
3440 | 3440 | $msg_ids = $this->_get_msg_ids_from_request(); |
3441 | 3441 | $deleted_count = 0; |
@@ -3464,9 +3464,9 @@ discard block |
||
3464 | 3464 | |
3465 | 3465 | /** |
3466 | 3466 | * This looks for 'MSG_ID' key in the request and returns an array of MSG_ID's if present. |
3467 | - * @since 4.9.0 |
|
3468 | - * @return array |
|
3469 | - */ |
|
3467 | + * @since 4.9.0 |
|
3468 | + * @return array |
|
3469 | + */ |
|
3470 | 3470 | protected function _get_msg_ids_from_request() { |
3471 | 3471 | if ( ! isset( $this->_req_data['MSG_ID'] ) ) { |
3472 | 3472 | return array(); |
@@ -1,5 +1,5 @@ discard block |
||
1 | -<?php if (!defined('EVENT_ESPRESSO_VERSION') ) |
|
2 | - {exit('NO direct script access allowed');} |
|
1 | +<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) |
|
2 | + {exit('NO direct script access allowed'); } |
|
3 | 3 | |
4 | 4 | /** |
5 | 5 | * |
@@ -72,10 +72,10 @@ discard block |
||
72 | 72 | /** |
73 | 73 | * @param bool $routing |
74 | 74 | */ |
75 | - public function __construct( $routing = true ) { |
|
75 | + public function __construct($routing = true) { |
|
76 | 76 | //make sure messages autoloader is running |
77 | 77 | EED_Messages::set_autoloaders(); |
78 | - parent::__construct( $routing ); |
|
78 | + parent::__construct($routing); |
|
79 | 79 | } |
80 | 80 | |
81 | 81 | |
@@ -89,7 +89,7 @@ discard block |
||
89 | 89 | |
90 | 90 | $this->_activate_state = isset($this->_req_data['activate_state']) ? (array) $this->_req_data['activate_state'] : array(); |
91 | 91 | |
92 | - $this->_active_messenger = isset( $this->_req_data['messenger'] ) ? $this->_req_data['messenger'] : null; |
|
92 | + $this->_active_messenger = isset($this->_req_data['messenger']) ? $this->_req_data['messenger'] : null; |
|
93 | 93 | $this->_load_message_resource_manager(); |
94 | 94 | } |
95 | 95 | |
@@ -103,7 +103,7 @@ discard block |
||
103 | 103 | * @throws EE_Error |
104 | 104 | */ |
105 | 105 | protected function _load_message_resource_manager() { |
106 | - $this->_message_resource_manager = EE_Registry::instance()->load_lib( 'Message_Resource_Manager' ); |
|
106 | + $this->_message_resource_manager = EE_Registry::instance()->load_lib('Message_Resource_Manager'); |
|
107 | 107 | } |
108 | 108 | |
109 | 109 | |
@@ -116,13 +116,13 @@ discard block |
||
116 | 116 | */ |
117 | 117 | public function get_messengers_for_list_table() { |
118 | 118 | $m_values = array(); |
119 | - $active_messengers = EEM_Message::instance()->get_all( array( 'group_by' => 'MSG_messenger' ) ); |
|
119 | + $active_messengers = EEM_Message::instance()->get_all(array('group_by' => 'MSG_messenger')); |
|
120 | 120 | //setup messengers for selects |
121 | 121 | $i = 1; |
122 | - foreach ( $active_messengers as $active_messenger ) { |
|
123 | - if ( $active_messenger instanceof EE_Message ) { |
|
124 | - $m_values[ $i ]['id'] = $active_messenger->messenger(); |
|
125 | - $m_values[ $i ]['text'] = ucwords( $active_messenger->messenger_label() ); |
|
122 | + foreach ($active_messengers as $active_messenger) { |
|
123 | + if ($active_messenger instanceof EE_Message) { |
|
124 | + $m_values[$i]['id'] = $active_messenger->messenger(); |
|
125 | + $m_values[$i]['text'] = ucwords($active_messenger->messenger_label()); |
|
126 | 126 | $i++; |
127 | 127 | } |
128 | 128 | } |
@@ -139,12 +139,12 @@ discard block |
||
139 | 139 | */ |
140 | 140 | public function get_message_types_for_list_table() { |
141 | 141 | $mt_values = array(); |
142 | - $active_messages = EEM_Message::instance()->get_all( array( 'group_by' => 'MSG_message_type' ) ); |
|
142 | + $active_messages = EEM_Message::instance()->get_all(array('group_by' => 'MSG_message_type')); |
|
143 | 143 | $i = 1; |
144 | - foreach ( $active_messages as $active_message ) { |
|
145 | - if ( $active_message instanceof EE_Message ) { |
|
146 | - $mt_values[ $i ]['id'] = $active_message->message_type(); |
|
147 | - $mt_values[ $i ]['text'] = ucwords( $active_message->message_type_label() ); |
|
144 | + foreach ($active_messages as $active_message) { |
|
145 | + if ($active_message instanceof EE_Message) { |
|
146 | + $mt_values[$i]['id'] = $active_message->message_type(); |
|
147 | + $mt_values[$i]['text'] = ucwords($active_message->message_type_label()); |
|
148 | 148 | $i++; |
149 | 149 | } |
150 | 150 | } |
@@ -161,14 +161,14 @@ discard block |
||
161 | 161 | */ |
162 | 162 | public function get_contexts_for_message_types_for_list_table() { |
163 | 163 | $contexts = array(); |
164 | - $active_message_contexts = EEM_Message::instance()->get_all( array( 'group_by' => 'MSG_context' ) ); |
|
165 | - foreach ( $active_message_contexts as $active_message ) { |
|
166 | - if ( $active_message instanceof EE_Message ) { |
|
164 | + $active_message_contexts = EEM_Message::instance()->get_all(array('group_by' => 'MSG_context')); |
|
165 | + foreach ($active_message_contexts as $active_message) { |
|
166 | + if ($active_message instanceof EE_Message) { |
|
167 | 167 | $message_type = $active_message->message_type_object(); |
168 | - if ( $message_type instanceof EE_message_type ) { |
|
168 | + if ($message_type instanceof EE_message_type) { |
|
169 | 169 | $message_type_contexts = $message_type->get_contexts(); |
170 | - foreach ( $message_type_contexts as $context => $context_details ) { |
|
171 | - $contexts[ $context ] = $context_details['label']; |
|
170 | + foreach ($message_type_contexts as $context => $context_details) { |
|
171 | + $contexts[$context] = $context_details['label']; |
|
172 | 172 | } |
173 | 173 | } |
174 | 174 | } |
@@ -179,11 +179,11 @@ discard block |
||
179 | 179 | |
180 | 180 | |
181 | 181 | protected function _ajax_hooks() { |
182 | - add_action('wp_ajax_activate_messenger', array($this, 'activate_messenger_toggle' ) ); |
|
183 | - add_action('wp_ajax_activate_mt', array( $this, 'activate_mt_toggle') ); |
|
184 | - add_action('wp_ajax_ee_msgs_save_settings', array( $this, 'save_settings') ); |
|
185 | - add_action('wp_ajax_ee_msgs_update_mt_form', array( $this, 'update_mt_form' ) ); |
|
186 | - add_action('wp_ajax_switch_template_pack', array( $this, 'switch_template_pack' ) ); |
|
182 | + add_action('wp_ajax_activate_messenger', array($this, 'activate_messenger_toggle')); |
|
183 | + add_action('wp_ajax_activate_mt', array($this, 'activate_mt_toggle')); |
|
184 | + add_action('wp_ajax_ee_msgs_save_settings', array($this, 'save_settings')); |
|
185 | + add_action('wp_ajax_ee_msgs_update_mt_form', array($this, 'update_mt_form')); |
|
186 | + add_action('wp_ajax_switch_template_pack', array($this, 'switch_template_pack')); |
|
187 | 187 | } |
188 | 188 | |
189 | 189 | |
@@ -215,13 +215,13 @@ discard block |
||
215 | 215 | * @return void |
216 | 216 | */ |
217 | 217 | protected function _set_page_routes() { |
218 | - $grp_id = ! empty( $this->_req_data['GRP_ID'] ) && ! is_array( $this->_req_data['GRP_ID'] ) |
|
218 | + $grp_id = ! empty($this->_req_data['GRP_ID']) && ! is_array($this->_req_data['GRP_ID']) |
|
219 | 219 | ? $this->_req_data['GRP_ID'] |
220 | 220 | : 0; |
221 | - $grp_id = empty( $grp_id ) && !empty( $this->_req_data['id'] ) |
|
221 | + $grp_id = empty($grp_id) && ! empty($this->_req_data['id']) |
|
222 | 222 | ? $this->_req_data['id'] |
223 | 223 | : $grp_id; |
224 | - $msg_id = ! empty( $this->_req_data['MSG_ID'] ) && ! is_array( $this->_req_data['MSG_ID'] ) |
|
224 | + $msg_id = ! empty($this->_req_data['MSG_ID']) && ! is_array($this->_req_data['MSG_ID']) |
|
225 | 225 | ? $this->_req_data['MSG_ID'] |
226 | 226 | : 0; |
227 | 227 | |
@@ -263,35 +263,35 @@ discard block |
||
263 | 263 | 'insert_message_template' => array( |
264 | 264 | 'func' => '_insert_or_update_message_template', |
265 | 265 | 'capability' => 'ee_edit_messages', |
266 | - 'args' => array( 'new_template' => true ), |
|
266 | + 'args' => array('new_template' => true), |
|
267 | 267 | 'noheader' => true |
268 | 268 | ), |
269 | 269 | 'update_message_template' => array( |
270 | 270 | 'func' => '_insert_or_update_message_template', |
271 | 271 | 'capability' => 'ee_edit_message', |
272 | 272 | 'obj_id' => $grp_id, |
273 | - 'args' => array( 'new_template' => false ), |
|
273 | + 'args' => array('new_template' => false), |
|
274 | 274 | 'noheader' => true |
275 | 275 | ), |
276 | 276 | 'trash_message_template' => array( |
277 | 277 | 'func' => '_trash_or_restore_message_template', |
278 | 278 | 'capability' => 'ee_delete_message', |
279 | 279 | 'obj_id' => $grp_id, |
280 | - 'args' => array( 'trash' => true, 'all' => true ), |
|
280 | + 'args' => array('trash' => true, 'all' => true), |
|
281 | 281 | 'noheader' => true |
282 | 282 | ), |
283 | 283 | 'trash_message_template_context' => array( |
284 | 284 | 'func' => '_trash_or_restore_message_template', |
285 | 285 | 'capability' => 'ee_delete_message', |
286 | 286 | 'obj_id' => $grp_id, |
287 | - 'args' => array( 'trash' => true ), |
|
287 | + 'args' => array('trash' => true), |
|
288 | 288 | 'noheader' => true |
289 | 289 | ), |
290 | 290 | 'restore_message_template' => array( |
291 | 291 | 'func' => '_trash_or_restore_message_template', |
292 | 292 | 'capability' => 'ee_delete_message', |
293 | 293 | 'obj_id' => $grp_id, |
294 | - 'args' => array( 'trash' => false, 'all' => true ), |
|
294 | + 'args' => array('trash' => false, 'all' => true), |
|
295 | 295 | 'noheader' => true |
296 | 296 | ), |
297 | 297 | 'restore_message_template_context' => array( |
@@ -405,7 +405,7 @@ discard block |
||
405 | 405 | 'filename' => 'messages_overview_other', |
406 | 406 | ), |
407 | 407 | ), |
408 | - 'help_tour' => array( 'Messages_Overview_Help_Tour' ), |
|
408 | + 'help_tour' => array('Messages_Overview_Help_Tour'), |
|
409 | 409 | 'require_nonce' => false |
410 | 410 | ), |
411 | 411 | 'custom_mtps' => array( |
@@ -440,7 +440,7 @@ discard block |
||
440 | 440 | ), |
441 | 441 | 'metaboxes' => array('_publish_post_box', '_register_edit_meta_boxes'), |
442 | 442 | 'has_metaboxes' => true, |
443 | - 'help_tour' => array( 'Message_Templates_Edit_Help_Tour' ), |
|
443 | + 'help_tour' => array('Message_Templates_Edit_Help_Tour'), |
|
444 | 444 | 'help_tabs' => array( |
445 | 445 | 'edit_message_template' => array( |
446 | 446 | 'title' => __('Message Template Editor', 'event_espresso'), |
@@ -496,7 +496,7 @@ discard block |
||
496 | 496 | 'filename' => 'messages_settings_messengers' |
497 | 497 | ), |
498 | 498 | ), |
499 | - 'help_tour' => array( 'Messages_Settings_Help_Tour' ), |
|
499 | + 'help_tour' => array('Messages_Settings_Help_Tour'), |
|
500 | 500 | 'require_nonce' => false |
501 | 501 | ) |
502 | 502 | ); |
@@ -529,7 +529,7 @@ discard block |
||
529 | 529 | |
530 | 530 | |
531 | 531 | protected function _add_screen_options_default() { |
532 | - $this->_admin_page_title = __( 'Message Activity', 'event_espresso' ); |
|
532 | + $this->_admin_page_title = __('Message Activity', 'event_espresso'); |
|
533 | 533 | $this->_per_page_screen_option(); |
534 | 534 | } |
535 | 535 | |
@@ -551,37 +551,37 @@ discard block |
||
551 | 551 | |
552 | 552 | |
553 | 553 | public function messages_help_tab() { |
554 | - EEH_Template::display_template( EE_MSG_TEMPLATE_PATH . 'ee_msg_messages_help_tab.template.php' ); |
|
554 | + EEH_Template::display_template(EE_MSG_TEMPLATE_PATH.'ee_msg_messages_help_tab.template.php'); |
|
555 | 555 | } |
556 | 556 | |
557 | 557 | |
558 | 558 | public function messengers_help_tab() { |
559 | - EEH_Template::display_template( EE_MSG_TEMPLATE_PATH . 'ee_msg_messenger_help_tab.template.php' ); |
|
559 | + EEH_Template::display_template(EE_MSG_TEMPLATE_PATH.'ee_msg_messenger_help_tab.template.php'); |
|
560 | 560 | } |
561 | 561 | |
562 | 562 | |
563 | 563 | public function message_types_help_tab() { |
564 | - EEH_Template::display_template( EE_MSG_TEMPLATE_PATH . 'ee_msg_message_type_help_tab.template.php' ); |
|
564 | + EEH_Template::display_template(EE_MSG_TEMPLATE_PATH.'ee_msg_message_type_help_tab.template.php'); |
|
565 | 565 | } |
566 | 566 | |
567 | 567 | |
568 | 568 | public function messages_overview_help_tab() { |
569 | - EEH_Template::display_template( EE_MSG_TEMPLATE_PATH . 'ee_msg_overview_help_tab.template.php' ); |
|
569 | + EEH_Template::display_template(EE_MSG_TEMPLATE_PATH.'ee_msg_overview_help_tab.template.php'); |
|
570 | 570 | } |
571 | 571 | |
572 | 572 | |
573 | 573 | public function message_templates_help_tab() { |
574 | - EEH_Template::display_template( EE_MSG_TEMPLATE_PATH . 'ee_msg_message_templates_help_tab.template.php' ); |
|
574 | + EEH_Template::display_template(EE_MSG_TEMPLATE_PATH.'ee_msg_message_templates_help_tab.template.php'); |
|
575 | 575 | } |
576 | 576 | |
577 | 577 | |
578 | 578 | public function edit_message_template_help_tab() { |
579 | - $args['img1'] = '<img src="' . EE_MSG_ASSETS_URL . 'images/editor.png' . '" alt="' . esc_attr__('Editor Title', 'event_espresso') . '" />'; |
|
580 | - $args['img2'] = '<img src="' . EE_MSG_ASSETS_URL . 'images/switch-context.png' . '" alt="' . esc_attr__('Context Switcher and Preview', 'event_espresso') . '" />'; |
|
581 | - $args['img3'] = '<img class="left" src="' . EE_MSG_ASSETS_URL . 'images/form-fields.png' . '" alt="' . esc_attr__('Message Template Form Fields', 'event_espresso') . '" />'; |
|
582 | - $args['img4'] = '<img class="right" src="' . EE_MSG_ASSETS_URL . 'images/shortcodes-metabox.png' . '" alt="' . esc_attr__('Shortcodes Metabox', 'event_espresso') . '" />'; |
|
583 | - $args['img5'] = '<img class="right" src="' . EE_MSG_ASSETS_URL . 'images/publish-meta-box.png' . '" alt="' . esc_attr__('Publish Metabox', 'event_espresso') . '" />'; |
|
584 | - EEH_Template::display_template( EE_MSG_TEMPLATE_PATH . 'ee_msg_messages_templates_editor_help_tab.template.php', $args); |
|
579 | + $args['img1'] = '<img src="'.EE_MSG_ASSETS_URL.'images/editor.png'.'" alt="'.esc_attr__('Editor Title', 'event_espresso').'" />'; |
|
580 | + $args['img2'] = '<img src="'.EE_MSG_ASSETS_URL.'images/switch-context.png'.'" alt="'.esc_attr__('Context Switcher and Preview', 'event_espresso').'" />'; |
|
581 | + $args['img3'] = '<img class="left" src="'.EE_MSG_ASSETS_URL.'images/form-fields.png'.'" alt="'.esc_attr__('Message Template Form Fields', 'event_espresso').'" />'; |
|
582 | + $args['img4'] = '<img class="right" src="'.EE_MSG_ASSETS_URL.'images/shortcodes-metabox.png'.'" alt="'.esc_attr__('Shortcodes Metabox', 'event_espresso').'" />'; |
|
583 | + $args['img5'] = '<img class="right" src="'.EE_MSG_ASSETS_URL.'images/publish-meta-box.png'.'" alt="'.esc_attr__('Publish Metabox', 'event_espresso').'" />'; |
|
584 | + EEH_Template::display_template(EE_MSG_TEMPLATE_PATH.'ee_msg_messages_templates_editor_help_tab.template.php', $args); |
|
585 | 585 | } |
586 | 586 | |
587 | 587 | |
@@ -589,22 +589,22 @@ discard block |
||
589 | 589 | public function message_template_shortcodes_help_tab() { |
590 | 590 | $this->_set_shortcodes(); |
591 | 591 | $args['shortcodes'] = $this->_shortcodes; |
592 | - EEH_Template::display_template( EE_MSG_TEMPLATE_PATH . 'ee_msg_messages_shortcodes_help_tab.template.php', $args ); |
|
592 | + EEH_Template::display_template(EE_MSG_TEMPLATE_PATH.'ee_msg_messages_shortcodes_help_tab.template.php', $args); |
|
593 | 593 | } |
594 | 594 | |
595 | 595 | |
596 | 596 | |
597 | 597 | public function preview_message_help_tab() { |
598 | - EEH_Template::display_template( EE_MSG_TEMPLATE_PATH . 'ee_msg_preview_help_tab.template.php' ); |
|
598 | + EEH_Template::display_template(EE_MSG_TEMPLATE_PATH.'ee_msg_preview_help_tab.template.php'); |
|
599 | 599 | } |
600 | 600 | |
601 | 601 | |
602 | 602 | public function settings_help_tab() { |
603 | - $args['img1'] = '<img class="inline-text" src="' . EE_MSG_ASSETS_URL . 'images/email-tab-active.png' . '" alt="' . esc_attr__('Active Email Tab', 'event_espresso') . '" />'; |
|
604 | - $args['img2'] = '<img class="inline-text" src="' . EE_MSG_ASSETS_URL . 'images/email-tab-inactive.png' . '" alt="' . esc_attr__('Inactive Email Tab', 'event_espresso') . '" />'; |
|
603 | + $args['img1'] = '<img class="inline-text" src="'.EE_MSG_ASSETS_URL.'images/email-tab-active.png'.'" alt="'.esc_attr__('Active Email Tab', 'event_espresso').'" />'; |
|
604 | + $args['img2'] = '<img class="inline-text" src="'.EE_MSG_ASSETS_URL.'images/email-tab-inactive.png'.'" alt="'.esc_attr__('Inactive Email Tab', 'event_espresso').'" />'; |
|
605 | 605 | $args['img3'] = '<div class="switch"><input id="ee-on-off-toggle-on" class="ee-on-off-toggle ee-toggle-round-flat" type="checkbox" checked="checked"><label for="ee-on-off-toggle-on"></label>'; |
606 | 606 | $args['img4'] = '<div class="switch"><input id="ee-on-off-toggle-on" class="ee-on-off-toggle ee-toggle-round-flat" type="checkbox"><label for="ee-on-off-toggle-on"></label>'; |
607 | - EEH_Template::display_template( EE_MSG_TEMPLATE_PATH . 'ee_msg_messages_settings_help_tab.template.php', $args); |
|
607 | + EEH_Template::display_template(EE_MSG_TEMPLATE_PATH.'ee_msg_messages_settings_help_tab.template.php', $args); |
|
608 | 608 | } |
609 | 609 | |
610 | 610 | |
@@ -612,31 +612,31 @@ discard block |
||
612 | 612 | |
613 | 613 | |
614 | 614 | public function load_scripts_styles() { |
615 | - wp_register_style('espresso_ee_msg', EE_MSG_ASSETS_URL . 'ee_message_admin.css', EVENT_ESPRESSO_VERSION ); |
|
615 | + wp_register_style('espresso_ee_msg', EE_MSG_ASSETS_URL.'ee_message_admin.css', EVENT_ESPRESSO_VERSION); |
|
616 | 616 | wp_enqueue_style('espresso_ee_msg'); |
617 | 617 | |
618 | - wp_register_script('ee-messages-settings', EE_MSG_ASSETS_URL . 'ee-messages-settings.js', array('jquery-ui-droppable', 'ee-serialize-full-array'), EVENT_ESPRESSO_VERSION, true ); |
|
619 | - wp_register_script( 'ee-msg-list-table-js', EE_MSG_ASSETS_URL. 'ee_message_admin_list_table.js', array( 'ee-dialog' ), EVENT_ESPRESSO_VERSION ); |
|
618 | + wp_register_script('ee-messages-settings', EE_MSG_ASSETS_URL.'ee-messages-settings.js', array('jquery-ui-droppable', 'ee-serialize-full-array'), EVENT_ESPRESSO_VERSION, true); |
|
619 | + wp_register_script('ee-msg-list-table-js', EE_MSG_ASSETS_URL.'ee_message_admin_list_table.js', array('ee-dialog'), EVENT_ESPRESSO_VERSION); |
|
620 | 620 | } |
621 | 621 | |
622 | 622 | |
623 | 623 | |
624 | 624 | public function load_scripts_styles_default() { |
625 | - wp_enqueue_script( 'ee-msg-list-table-js' ); |
|
625 | + wp_enqueue_script('ee-msg-list-table-js'); |
|
626 | 626 | } |
627 | 627 | |
628 | 628 | |
629 | 629 | |
630 | 630 | |
631 | 631 | |
632 | - public function wp_editor_css( $mce_css ) { |
|
632 | + public function wp_editor_css($mce_css) { |
|
633 | 633 | //if we're on the edit_message_template route |
634 | - if ( $this->_req_action == 'edit_message_template' && $this->_active_messenger instanceof EE_messenger ) { |
|
634 | + if ($this->_req_action == 'edit_message_template' && $this->_active_messenger instanceof EE_messenger) { |
|
635 | 635 | $message_type_name = $this->_active_message_type_name; |
636 | 636 | |
637 | 637 | //we're going to REPLACE the existing mce css |
638 | 638 | //we need to get the css file location from the active messenger |
639 | - $mce_css = $this->_active_messenger->get_variation($this->_template_pack, $message_type_name, true, 'wpeditor', $this->_variation ); |
|
639 | + $mce_css = $this->_active_messenger->get_variation($this->_template_pack, $message_type_name, true, 'wpeditor', $this->_variation); |
|
640 | 640 | } |
641 | 641 | |
642 | 642 | return $mce_css; |
@@ -654,15 +654,15 @@ discard block |
||
654 | 654 | $this->_message_template_group->messenger_obj()->label['singular'], |
655 | 655 | $this->_message_template_group->message_type_obj()->label['singular'] |
656 | 656 | ); |
657 | - EE_Registry::$i18n_js_strings['confirm_switch_template_pack'] = __('Switching the template pack for a messages template will reset the content for the template so the new layout is loaded. Any custom content in the existing template will be lost. Are you sure you wish to do this?', 'event_espresso' ); |
|
657 | + EE_Registry::$i18n_js_strings['confirm_switch_template_pack'] = __('Switching the template pack for a messages template will reset the content for the template so the new layout is loaded. Any custom content in the existing template will be lost. Are you sure you wish to do this?', 'event_espresso'); |
|
658 | 658 | |
659 | - wp_register_script('ee_msgs_edit_js', EE_MSG_ASSETS_URL . 'ee_message_editor.js', array('jquery'), EVENT_ESPRESSO_VERSION ); |
|
659 | + wp_register_script('ee_msgs_edit_js', EE_MSG_ASSETS_URL.'ee_message_editor.js', array('jquery'), EVENT_ESPRESSO_VERSION); |
|
660 | 660 | |
661 | 661 | wp_enqueue_script('ee_admin_js'); |
662 | 662 | wp_enqueue_script('ee_msgs_edit_js'); |
663 | 663 | |
664 | 664 | //add in special css for tiny_mce |
665 | - add_filter( 'mce_css', array( $this, 'wp_editor_css' ) ); |
|
665 | + add_filter('mce_css', array($this, 'wp_editor_css')); |
|
666 | 666 | } |
667 | 667 | |
668 | 668 | |
@@ -671,22 +671,22 @@ discard block |
||
671 | 671 | |
672 | 672 | $this->_set_message_template_group(); |
673 | 673 | |
674 | - if ( isset( $this->_req_data['messenger'] ) ) { |
|
675 | - $this->_active_messenger = $this->_message_resource_manager->get_active_messenger( $this->_req_data['messenger'] ); |
|
674 | + if (isset($this->_req_data['messenger'])) { |
|
675 | + $this->_active_messenger = $this->_message_resource_manager->get_active_messenger($this->_req_data['messenger']); |
|
676 | 676 | } |
677 | 677 | |
678 | - $message_type_name = isset( $this->_req_data['message_type'] ) ? $this->_req_data['message_type'] : ''; |
|
678 | + $message_type_name = isset($this->_req_data['message_type']) ? $this->_req_data['message_type'] : ''; |
|
679 | 679 | |
680 | 680 | |
681 | - wp_enqueue_style('espresso_preview_css', $this->_active_messenger->get_variation( $this->_template_pack, $message_type_name, true, 'preview', $this->_variation ) ); |
|
681 | + wp_enqueue_style('espresso_preview_css', $this->_active_messenger->get_variation($this->_template_pack, $message_type_name, true, 'preview', $this->_variation)); |
|
682 | 682 | } |
683 | 683 | |
684 | 684 | |
685 | 685 | |
686 | 686 | public function load_scripts_styles_settings() { |
687 | - wp_register_style( 'ee-message-settings', EE_MSG_ASSETS_URL . 'ee_message_settings.css', array(), EVENT_ESPRESSO_VERSION ); |
|
688 | - wp_enqueue_style( 'ee-text-links' ); |
|
689 | - wp_enqueue_style( 'ee-message-settings' ); |
|
687 | + wp_register_style('ee-message-settings', EE_MSG_ASSETS_URL.'ee_message_settings.css', array(), EVENT_ESPRESSO_VERSION); |
|
688 | + wp_enqueue_style('ee-text-links'); |
|
689 | + wp_enqueue_style('ee-message-settings'); |
|
690 | 690 | |
691 | 691 | wp_enqueue_script('ee-messages-settings'); |
692 | 692 | } |
@@ -716,40 +716,40 @@ discard block |
||
716 | 716 | * set views array for message queue list table |
717 | 717 | */ |
718 | 718 | public function _set_list_table_views_default() { |
719 | - EE_Registry::instance()->load_helper( 'Template' ); |
|
719 | + EE_Registry::instance()->load_helper('Template'); |
|
720 | 720 | |
721 | - $common_bulk_actions = EE_Registry::instance()->CAP->current_user_can( 'ee_send_message', 'message_list_table_bulk_actions' ) |
|
721 | + $common_bulk_actions = EE_Registry::instance()->CAP->current_user_can('ee_send_message', 'message_list_table_bulk_actions') |
|
722 | 722 | ? array( |
723 | - 'generate_now' => __( 'Generate Now', 'event_espresso' ), |
|
724 | - 'generate_and_send_now' => __( 'Generate and Send Now', 'event_espresso' ), |
|
725 | - 'queue_for_resending' => __( 'Queue for Resending', 'event_espresso' ), |
|
726 | - 'send_now' => __( 'Send Now', 'event_espresso' ) |
|
723 | + 'generate_now' => __('Generate Now', 'event_espresso'), |
|
724 | + 'generate_and_send_now' => __('Generate and Send Now', 'event_espresso'), |
|
725 | + 'queue_for_resending' => __('Queue for Resending', 'event_espresso'), |
|
726 | + 'send_now' => __('Send Now', 'event_espresso') |
|
727 | 727 | ) |
728 | 728 | : array(); |
729 | 729 | |
730 | - $delete_bulk_action = EE_Registry::instance()->CAP->current_user_can( 'ee_delete_messages', 'message_list_table_bulk_actions' ) |
|
731 | - ? array( 'delete_ee_messages' => __( 'Delete Messages', 'event_espresso' ) ) |
|
730 | + $delete_bulk_action = EE_Registry::instance()->CAP->current_user_can('ee_delete_messages', 'message_list_table_bulk_actions') |
|
731 | + ? array('delete_ee_messages' => __('Delete Messages', 'event_espresso')) |
|
732 | 732 | : array(); |
733 | 733 | |
734 | 734 | |
735 | 735 | $this->_views = array( |
736 | 736 | 'all' => array( |
737 | 737 | 'slug' => 'all', |
738 | - 'label' => __( 'All', 'event_espresso' ), |
|
738 | + 'label' => __('All', 'event_espresso'), |
|
739 | 739 | 'count' => 0, |
740 | - 'bulk_action' => array_merge( $common_bulk_actions, $delete_bulk_action ) |
|
740 | + 'bulk_action' => array_merge($common_bulk_actions, $delete_bulk_action) |
|
741 | 741 | ) |
742 | 742 | ); |
743 | 743 | |
744 | 744 | |
745 | - foreach ( EEM_Message::instance()->all_statuses() as $status ) { |
|
746 | - if ( $status === EEM_Message::status_debug_only && ( ! defined( 'WP_DEBUG' ) || ! WP_DEBUG ) ) { |
|
745 | + foreach (EEM_Message::instance()->all_statuses() as $status) { |
|
746 | + if ($status === EEM_Message::status_debug_only && ( ! defined('WP_DEBUG') || ! WP_DEBUG)) { |
|
747 | 747 | continue; |
748 | 748 | } |
749 | 749 | $status_bulk_actions = $common_bulk_actions; |
750 | 750 | //unset bulk actions not applying to status |
751 | - if ( ! empty( $status_bulk_actions ) ) { |
|
752 | - switch ( $status ) { |
|
751 | + if ( ! empty($status_bulk_actions)) { |
|
752 | + switch ($status) { |
|
753 | 753 | case EEM_Message::status_idle : |
754 | 754 | case EEM_Message::status_resend : |
755 | 755 | $status_bulk_actions['send_now'] = $common_bulk_actions['send_now']; |
@@ -761,21 +761,21 @@ discard block |
||
761 | 761 | break; |
762 | 762 | |
763 | 763 | case EEM_Message::status_incomplete : |
764 | - unset( $status_bulk_actions['queue_for_resending'], $status_bulk_actions['send_now'] ); |
|
764 | + unset($status_bulk_actions['queue_for_resending'], $status_bulk_actions['send_now']); |
|
765 | 765 | break; |
766 | 766 | |
767 | 767 | case EEM_Message::status_retry : |
768 | 768 | case EEM_Message::status_sent : |
769 | - unset( $status_bulk_actions['generate_now'], $status_bulk_actions['generate_and_send_now'] ); |
|
769 | + unset($status_bulk_actions['generate_now'], $status_bulk_actions['generate_and_send_now']); |
|
770 | 770 | break; |
771 | 771 | } |
772 | 772 | } |
773 | 773 | |
774 | - $this->_views[ strtolower( $status ) ] = array( |
|
775 | - 'slug' => strtolower( $status ), |
|
776 | - 'label' => EEH_Template::pretty_status( $status, false, 'sentence' ), |
|
774 | + $this->_views[strtolower($status)] = array( |
|
775 | + 'slug' => strtolower($status), |
|
776 | + 'label' => EEH_Template::pretty_status($status, false, 'sentence'), |
|
777 | 777 | 'count' => 0, |
778 | - 'bulk_action' => array_merge( $status_bulk_actions, $delete_bulk_action ) |
|
778 | + 'bulk_action' => array_merge($status_bulk_actions, $delete_bulk_action) |
|
779 | 779 | ); |
780 | 780 | } |
781 | 781 | } |
@@ -794,8 +794,8 @@ discard block |
||
794 | 794 | protected function _message_queue_list_table() { |
795 | 795 | $this->_search_btn_label = __('Message Activity', 'event_espresso'); |
796 | 796 | $this->_template_args['per_column'] = 6; |
797 | - $this->_template_args['after_list_table'] = $this->_display_legend( $this->_message_legend_items() ); |
|
798 | - $this->_template_args['before_list_table'] = '<h3>' . EEM_Message::instance()->get_pretty_label_for_results() . '</h3>'; |
|
797 | + $this->_template_args['after_list_table'] = $this->_display_legend($this->_message_legend_items()); |
|
798 | + $this->_template_args['before_list_table'] = '<h3>'.EEM_Message::instance()->get_pretty_label_for_results().'</h3>'; |
|
799 | 799 | $this->display_admin_list_table_page_with_no_sidebar(); |
800 | 800 | } |
801 | 801 | |
@@ -808,8 +808,8 @@ discard block |
||
808 | 808 | $action_css_classes = EEH_MSG_Template::get_message_action_icons(); |
809 | 809 | $action_items = array(); |
810 | 810 | |
811 | - foreach( $action_css_classes as $action_item => $action_details ) { |
|
812 | - if ( $action_item === 'see_notifications_for' ) { |
|
811 | + foreach ($action_css_classes as $action_item => $action_details) { |
|
812 | + if ($action_item === 'see_notifications_for') { |
|
813 | 813 | continue; |
814 | 814 | } |
815 | 815 | $action_items[$action_item] = array( |
@@ -821,37 +821,37 @@ discard block |
||
821 | 821 | /** @type array $status_items status legend setup*/ |
822 | 822 | $status_items = array( |
823 | 823 | 'sent_status' => array( |
824 | - 'class' => 'ee-status-legend ee-status-legend-' . EEM_Message::status_sent, |
|
825 | - 'desc' => EEH_Template::pretty_status( EEM_Message::status_sent, false, 'sentence' ) |
|
824 | + 'class' => 'ee-status-legend ee-status-legend-'.EEM_Message::status_sent, |
|
825 | + 'desc' => EEH_Template::pretty_status(EEM_Message::status_sent, false, 'sentence') |
|
826 | 826 | ), |
827 | 827 | 'idle_status' => array( |
828 | - 'class' => 'ee-status-legend ee-status-legend-' . EEM_Message::status_idle, |
|
829 | - 'desc' => EEH_Template::pretty_status( EEM_Message::status_idle, false, 'sentence' ) |
|
828 | + 'class' => 'ee-status-legend ee-status-legend-'.EEM_Message::status_idle, |
|
829 | + 'desc' => EEH_Template::pretty_status(EEM_Message::status_idle, false, 'sentence') |
|
830 | 830 | ), |
831 | 831 | 'failed_status' => array( |
832 | - 'class' => 'ee-status-legend ee-status-legend-' . EEM_Message::status_failed, |
|
833 | - 'desc' => EEH_Template::pretty_status( EEM_Message::status_failed, false, 'sentence' ) |
|
832 | + 'class' => 'ee-status-legend ee-status-legend-'.EEM_Message::status_failed, |
|
833 | + 'desc' => EEH_Template::pretty_status(EEM_Message::status_failed, false, 'sentence') |
|
834 | 834 | ), |
835 | 835 | 'resend_status' => array( |
836 | - 'class' => 'ee-status-legend ee-status-legend-' . EEM_Message::status_resend, |
|
837 | - 'desc' => EEH_Template::pretty_status( EEM_Message::status_resend, false, 'sentence' ) |
|
836 | + 'class' => 'ee-status-legend ee-status-legend-'.EEM_Message::status_resend, |
|
837 | + 'desc' => EEH_Template::pretty_status(EEM_Message::status_resend, false, 'sentence') |
|
838 | 838 | ), |
839 | 839 | 'incomplete_status' => array( |
840 | - 'class' => 'ee-status-legend ee-status-legend-' . EEM_Message::status_incomplete, |
|
841 | - 'desc' => EEH_Template::pretty_status( EEM_Message::status_incomplete, false, 'sentence' ) |
|
840 | + 'class' => 'ee-status-legend ee-status-legend-'.EEM_Message::status_incomplete, |
|
841 | + 'desc' => EEH_Template::pretty_status(EEM_Message::status_incomplete, false, 'sentence') |
|
842 | 842 | ), |
843 | 843 | 'retry_status' => array( |
844 | - 'class' => 'ee-status-legend ee-status-legend-' . EEM_Message::status_retry, |
|
845 | - 'desc' => EEH_Template::pretty_status( EEM_Message::status_retry, false, 'sentence' ) |
|
844 | + 'class' => 'ee-status-legend ee-status-legend-'.EEM_Message::status_retry, |
|
845 | + 'desc' => EEH_Template::pretty_status(EEM_Message::status_retry, false, 'sentence') |
|
846 | 846 | ) |
847 | 847 | ); |
848 | - if ( defined( 'WP_DEBUG' ) && WP_DEBUG ) { |
|
848 | + if (defined('WP_DEBUG') && WP_DEBUG) { |
|
849 | 849 | $status_items['debug_only_status'] = array( |
850 | - 'class' => 'ee-status-legend ee-status-legend-' . EEM_Message::status_debug_only, |
|
851 | - 'desc' => EEH_Template::pretty_status( EEM_Message::status_debug_only, false, 'sentence' ) |
|
850 | + 'class' => 'ee-status-legend ee-status-legend-'.EEM_Message::status_debug_only, |
|
851 | + 'desc' => EEH_Template::pretty_status(EEM_Message::status_debug_only, false, 'sentence') |
|
852 | 852 | ); |
853 | 853 | } |
854 | - return array_merge( $action_items, $status_items ); |
|
854 | + return array_merge($action_items, $status_items); |
|
855 | 855 | } |
856 | 856 | |
857 | 857 | |
@@ -861,9 +861,9 @@ discard block |
||
861 | 861 | |
862 | 862 | protected function _custom_mtps_preview() { |
863 | 863 | $this->_admin_page_title = __('Custom Message Templates (Preview)', 'event_espresso'); |
864 | - $this->_template_args['preview_img'] = '<img src="' . EE_MSG_ASSETS_URL . 'images/custom_mtps_preview.png" alt="' . esc_attr__('Preview Custom Message Templates screenshot', 'event_espresso' ) . '" />'; |
|
864 | + $this->_template_args['preview_img'] = '<img src="'.EE_MSG_ASSETS_URL.'images/custom_mtps_preview.png" alt="'.esc_attr__('Preview Custom Message Templates screenshot', 'event_espresso').'" />'; |
|
865 | 865 | $this->_template_args['preview_text'] = '<strong>'.__('Custom Message Templates is a feature that is only available in the caffeinated version of Event Espresso. With the Custom Message Templates feature, you are able to create custom templates and set them per event.', 'event_espresso').'</strong>'; |
866 | - $this->display_admin_caf_preview_page( 'custom_message_types', false ); |
|
866 | + $this->display_admin_caf_preview_page('custom_message_types', false); |
|
867 | 867 | } |
868 | 868 | |
869 | 869 | |
@@ -887,31 +887,31 @@ discard block |
||
887 | 887 | * |
888 | 888 | * @return array |
889 | 889 | */ |
890 | - public function get_message_templates( $perpage = 10, $type = 'in_use', $count = false, $all = false, $global = true ) { |
|
890 | + public function get_message_templates($perpage = 10, $type = 'in_use', $count = false, $all = false, $global = true) { |
|
891 | 891 | |
892 | 892 | $MTP = EEM_Message_Template_Group::instance(); |
893 | 893 | |
894 | 894 | $this->_req_data['orderby'] = empty($this->_req_data['orderby']) ? 'GRP_ID' : $this->_req_data['orderby']; |
895 | 895 | $orderby = $this->_req_data['orderby']; |
896 | 896 | |
897 | - $order = ( isset( $this->_req_data['order'] ) && ! empty( $this->_req_data['order'] ) ) ? $this->_req_data['order'] : 'ASC'; |
|
897 | + $order = (isset($this->_req_data['order']) && ! empty($this->_req_data['order'])) ? $this->_req_data['order'] : 'ASC'; |
|
898 | 898 | |
899 | - $current_page = isset( $this->_req_data['paged'] ) && !empty( $this->_req_data['paged'] ) ? $this->_req_data['paged'] : 1; |
|
900 | - $per_page = isset( $this->_req_data['perpage'] ) && !empty( $this->_req_data['perpage'] ) ? $this->_req_data['perpage'] : $perpage; |
|
899 | + $current_page = isset($this->_req_data['paged']) && ! empty($this->_req_data['paged']) ? $this->_req_data['paged'] : 1; |
|
900 | + $per_page = isset($this->_req_data['perpage']) && ! empty($this->_req_data['perpage']) ? $this->_req_data['perpage'] : $perpage; |
|
901 | 901 | |
902 | - $offset = ($current_page-1)*$per_page; |
|
903 | - $limit = $all ? null : array( $offset, $per_page ); |
|
902 | + $offset = ($current_page - 1) * $per_page; |
|
903 | + $limit = $all ? null : array($offset, $per_page); |
|
904 | 904 | |
905 | 905 | |
906 | 906 | //options will match what is in the _views array property |
907 | - switch( $type ) { |
|
907 | + switch ($type) { |
|
908 | 908 | |
909 | 909 | case 'in_use': |
910 | - $templates = $MTP->get_all_active_message_templates($orderby, $order, $limit, $count, $global, true ); |
|
910 | + $templates = $MTP->get_all_active_message_templates($orderby, $order, $limit, $count, $global, true); |
|
911 | 911 | break; |
912 | 912 | |
913 | 913 | default: |
914 | - $templates = $MTP->get_all_trashed_grouped_message_templates($orderby, $order, $limit, $count, $global ); |
|
914 | + $templates = $MTP->get_all_trashed_grouped_message_templates($orderby, $order, $limit, $count, $global); |
|
915 | 915 | |
916 | 916 | } |
917 | 917 | |
@@ -930,8 +930,8 @@ discard block |
||
930 | 930 | $installed_message_types = $this->_message_resource_manager->installed_message_types(); |
931 | 931 | $installed = array(); |
932 | 932 | |
933 | - foreach ( $installed_message_types as $message_type ) { |
|
934 | - $installed[ $message_type->name ] = $message_type; |
|
933 | + foreach ($installed_message_types as $message_type) { |
|
934 | + $installed[$message_type->name] = $message_type; |
|
935 | 935 | } |
936 | 936 | |
937 | 937 | return $installed; |
@@ -950,24 +950,24 @@ discard block |
||
950 | 950 | * |
951 | 951 | * @throws EE_error |
952 | 952 | */ |
953 | - protected function _add_message_template( $message_type = '', $messenger='', $GRP_ID = '' ) { |
|
953 | + protected function _add_message_template($message_type = '', $messenger = '', $GRP_ID = '') { |
|
954 | 954 | //set values override any request data |
955 | - $message_type = !empty( $message_type ) ? $message_type : ''; |
|
956 | - $message_type = empty( $message_type ) && !empty( $this->_req_data['message_type'] ) ? $this->_req_data['message_type'] : $message_type; |
|
955 | + $message_type = ! empty($message_type) ? $message_type : ''; |
|
956 | + $message_type = empty($message_type) && ! empty($this->_req_data['message_type']) ? $this->_req_data['message_type'] : $message_type; |
|
957 | 957 | |
958 | - $messenger = !empty( $messenger ) ? $messenger : ''; |
|
959 | - $messenger = empty( $messenger ) && !empty( $this->_req_data['messenger'] ) ? $this->_req_data['messenger'] : $messenger; |
|
958 | + $messenger = ! empty($messenger) ? $messenger : ''; |
|
959 | + $messenger = empty($messenger) && ! empty($this->_req_data['messenger']) ? $this->_req_data['messenger'] : $messenger; |
|
960 | 960 | |
961 | - $GRP_ID = !empty( $GRP_ID ) ? $GRP_ID : ''; |
|
962 | - $GRP_ID = empty( $GRP_ID ) && !empty( $this->_req_data['GRP_ID'] ) ? $this->_req_data['GRP_ID'] : $GRP_ID; |
|
961 | + $GRP_ID = ! empty($GRP_ID) ? $GRP_ID : ''; |
|
962 | + $GRP_ID = empty($GRP_ID) && ! empty($this->_req_data['GRP_ID']) ? $this->_req_data['GRP_ID'] : $GRP_ID; |
|
963 | 963 | |
964 | 964 | //we need messenger and message type. They should be coming from the event editor. If not here then return error |
965 | - if ( empty( $message_type ) || empty( $messenger ) ) |
|
966 | - {throw new EE_error(__('Sorry, but we can\'t create new templates because we\'re missing the messenger or message type', 'event_espresso'));} |
|
965 | + if (empty($message_type) || empty($messenger)) |
|
966 | + {throw new EE_error(__('Sorry, but we can\'t create new templates because we\'re missing the messenger or message type', 'event_espresso')); } |
|
967 | 967 | |
968 | 968 | //we need the GRP_ID for the template being used as the base for the new template |
969 | - if ( empty( $GRP_ID ) ) |
|
970 | - {throw new EE_Error( __('In order to create a custom message template the GRP_ID of the template being used as a base is needed', 'event_espresso' ) );} |
|
969 | + if (empty($GRP_ID)) |
|
970 | + {throw new EE_Error(__('In order to create a custom message template the GRP_ID of the template being used as a base is needed', 'event_espresso')); } |
|
971 | 971 | |
972 | 972 | //let's just make sure the template gets generated! |
973 | 973 | |
@@ -988,8 +988,8 @@ discard block |
||
988 | 988 | * @param int $GRP_ID GRP_ID for the related message template group this new template will be based |
989 | 989 | * off of. |
990 | 990 | */ |
991 | - public function add_message_template( $message_type, $messenger, $GRP_ID ) { |
|
992 | - $this->_add_message_template( $message_type, $messenger, $GRP_ID ); |
|
991 | + public function add_message_template($message_type, $messenger, $GRP_ID) { |
|
992 | + $this->_add_message_template($message_type, $messenger, $GRP_ID); |
|
993 | 993 | } |
994 | 994 | |
995 | 995 | |
@@ -1000,14 +1000,14 @@ discard block |
||
1000 | 1000 | * @return void |
1001 | 1001 | */ |
1002 | 1002 | protected function _edit_message_template() { |
1003 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, ''); |
|
1003 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
1004 | 1004 | $template_fields = ''; |
1005 | 1005 | $sidebar_fields = ''; |
1006 | 1006 | //we filter the tinyMCE settings to remove the validation since message templates by their nature will not have valid html in the templates. |
1007 | - add_filter( 'tiny_mce_before_init', array( $this, 'filter_tinymce_init'), 10, 2 ); |
|
1007 | + add_filter('tiny_mce_before_init', array($this, 'filter_tinymce_init'), 10, 2); |
|
1008 | 1008 | |
1009 | - $GRP_ID = isset( $this->_req_data['id'] ) && !empty( $this->_req_data['id'] ) |
|
1010 | - ? absint( $this->_req_data['id'] ) |
|
1009 | + $GRP_ID = isset($this->_req_data['id']) && ! empty($this->_req_data['id']) |
|
1010 | + ? absint($this->_req_data['id']) |
|
1011 | 1011 | : false; |
1012 | 1012 | |
1013 | 1013 | $this->_set_shortcodes(); //this also sets the _message_template property. |
@@ -1015,20 +1015,20 @@ discard block |
||
1015 | 1015 | $c_label = $message_template_group->context_label(); |
1016 | 1016 | $c_config = $message_template_group->contexts_config(); |
1017 | 1017 | |
1018 | - reset( $c_config ); |
|
1019 | - $context = isset( $this->_req_data['context']) && !empty($this->_req_data['context'] ) |
|
1018 | + reset($c_config); |
|
1019 | + $context = isset($this->_req_data['context']) && ! empty($this->_req_data['context']) |
|
1020 | 1020 | ? strtolower($this->_req_data['context']) |
1021 | 1021 | : key($c_config); |
1022 | 1022 | |
1023 | 1023 | |
1024 | - if ( empty($GRP_ID) ) { |
|
1024 | + if (empty($GRP_ID)) { |
|
1025 | 1025 | $action = 'insert_message_template'; |
1026 | 1026 | //$button_both = false; |
1027 | 1027 | //$button_text = array( __( 'Save','event_espresso') ); |
1028 | 1028 | //$button_actions = array('something_different'); |
1029 | 1029 | //$referrer = false; |
1030 | 1030 | $edit_message_template_form_url = add_query_arg( |
1031 | - array( 'action' => $action, 'noheader' => true ), |
|
1031 | + array('action' => $action, 'noheader' => true), |
|
1032 | 1032 | EE_MSG_ADMIN_URL |
1033 | 1033 | ); |
1034 | 1034 | } else { |
@@ -1038,7 +1038,7 @@ discard block |
||
1038 | 1038 | //$button_actions = array(); |
1039 | 1039 | //$referrer = $this->_admin_base_url; |
1040 | 1040 | $edit_message_template_form_url = add_query_arg( |
1041 | - array( 'action' => $action, 'noheader' => true ), |
|
1041 | + array('action' => $action, 'noheader' => true), |
|
1042 | 1042 | EE_MSG_ADMIN_URL |
1043 | 1043 | ); |
1044 | 1044 | } |
@@ -1052,14 +1052,14 @@ discard block |
||
1052 | 1052 | |
1053 | 1053 | //Do we have any validation errors? |
1054 | 1054 | $validators = $this->_get_transient(); |
1055 | - $v_fields = !empty($validators) ? array_keys($validators) : array(); |
|
1055 | + $v_fields = ! empty($validators) ? array_keys($validators) : array(); |
|
1056 | 1056 | |
1057 | 1057 | |
1058 | 1058 | //we need to assemble the title from Various details |
1059 | 1059 | $context_label = sprintf( |
1060 | 1060 | __('(%s %s)', 'event_espresso'), |
1061 | 1061 | $c_config[$context]['label'], |
1062 | - ucwords($c_label['label'] ) |
|
1062 | + ucwords($c_label['label']) |
|
1063 | 1063 | ); |
1064 | 1064 | |
1065 | 1065 | $title = sprintf( |
@@ -1080,7 +1080,7 @@ discard block |
||
1080 | 1080 | $message_template_group->message_type() |
1081 | 1081 | ); |
1082 | 1082 | |
1083 | - if ( !$template_field_structure ) { |
|
1083 | + if ( ! $template_field_structure) { |
|
1084 | 1084 | $template_field_structure = false; |
1085 | 1085 | $template_fields = __('There was an error in assembling the fields for this display (you should see an error message)', 'event_espresso'); |
1086 | 1086 | } |
@@ -1090,51 +1090,51 @@ discard block |
||
1090 | 1090 | |
1091 | 1091 | |
1092 | 1092 | //if we have the extra key.. then we need to remove the content index from the template_field_structure as it will get handled in the "extra" array. |
1093 | - if ( is_array($template_field_structure[$context]) && isset( $template_field_structure[$context]['extra']) ) { |
|
1094 | - foreach ( $template_field_structure[$context]['extra'] as $reference_field => $new_fields ) { |
|
1095 | - unset( $template_field_structure[$context][$reference_field] ); |
|
1093 | + if (is_array($template_field_structure[$context]) && isset($template_field_structure[$context]['extra'])) { |
|
1094 | + foreach ($template_field_structure[$context]['extra'] as $reference_field => $new_fields) { |
|
1095 | + unset($template_field_structure[$context][$reference_field]); |
|
1096 | 1096 | } |
1097 | 1097 | } |
1098 | 1098 | |
1099 | 1099 | //let's loop through the template_field_structure and actually assemble the input fields! |
1100 | - if ( !empty($template_field_structure) ) { |
|
1101 | - foreach ( $template_field_structure[$context] as $template_field => $field_setup_array ) { |
|
1100 | + if ( ! empty($template_field_structure)) { |
|
1101 | + foreach ($template_field_structure[$context] as $template_field => $field_setup_array) { |
|
1102 | 1102 | //if this is an 'extra' template field then we need to remove any existing fields that are keyed up in the extra array and reset them. |
1103 | - if ( $template_field == 'extra' ) { |
|
1103 | + if ($template_field == 'extra') { |
|
1104 | 1104 | $this->_template_args['is_extra_fields'] = true; |
1105 | - foreach ( $field_setup_array as $reference_field => $new_fields_array ) { |
|
1106 | - $message_template = $message_templates[ $context ][ $reference_field ]; |
|
1105 | + foreach ($field_setup_array as $reference_field => $new_fields_array) { |
|
1106 | + $message_template = $message_templates[$context][$reference_field]; |
|
1107 | 1107 | $content = $message_template instanceof EE_Message_Template |
1108 | - ? $message_template->get( 'MTP_content' ) |
|
1108 | + ? $message_template->get('MTP_content') |
|
1109 | 1109 | : ''; |
1110 | - foreach ( $new_fields_array as $extra_field => $extra_array ) { |
|
1110 | + foreach ($new_fields_array as $extra_field => $extra_array) { |
|
1111 | 1111 | //let's verify if we need this extra field via the shortcodes parameter. |
1112 | 1112 | $continue = false; |
1113 | - if ( isset( $extra_array['shortcodes_required'] ) ) { |
|
1114 | - foreach ( (array) $extra_array['shortcodes_required'] as $shortcode ) { |
|
1115 | - if ( !array_key_exists( $shortcode, $this->_shortcodes ) ) |
|
1116 | - {$continue = true;} |
|
1113 | + if (isset($extra_array['shortcodes_required'])) { |
|
1114 | + foreach ((array) $extra_array['shortcodes_required'] as $shortcode) { |
|
1115 | + if ( ! array_key_exists($shortcode, $this->_shortcodes)) |
|
1116 | + {$continue = true; } |
|
1117 | 1117 | } |
1118 | - if ( $continue ) {continue;} |
|
1118 | + if ($continue) {continue; } |
|
1119 | 1119 | } |
1120 | 1120 | |
1121 | - $field_id = $reference_field . '-' . $extra_field . '-content'; |
|
1121 | + $field_id = $reference_field.'-'.$extra_field.'-content'; |
|
1122 | 1122 | $template_form_fields[$field_id] = $extra_array; |
1123 | - $template_form_fields[$field_id]['name'] = 'MTP_template_fields[' . $reference_field . '][content][' . $extra_field . ']'; |
|
1124 | - $css_class = isset( $extra_array['css_class'] ) ? $extra_array['css_class'] : ''; |
|
1123 | + $template_form_fields[$field_id]['name'] = 'MTP_template_fields['.$reference_field.'][content]['.$extra_field.']'; |
|
1124 | + $css_class = isset($extra_array['css_class']) ? $extra_array['css_class'] : ''; |
|
1125 | 1125 | |
1126 | - $template_form_fields[$field_id]['css_class'] = ! empty( $v_fields ) |
|
1126 | + $template_form_fields[$field_id]['css_class'] = ! empty($v_fields) |
|
1127 | 1127 | && in_array($extra_field, $v_fields) |
1128 | 1128 | && |
1129 | 1129 | ( |
1130 | - is_array($validators[$extra_field] ) |
|
1131 | - && isset( $validators[$extra_field]['msg'] ) |
|
1130 | + is_array($validators[$extra_field]) |
|
1131 | + && isset($validators[$extra_field]['msg']) |
|
1132 | 1132 | ) |
1133 | - ? 'validate-error ' . $css_class |
|
1133 | + ? 'validate-error '.$css_class |
|
1134 | 1134 | : $css_class; |
1135 | 1135 | |
1136 | - $template_form_fields[$field_id]['value'] = !empty($message_templates) && isset($content[$extra_field]) |
|
1137 | - ? stripslashes( html_entity_decode( $content[$extra_field], ENT_QUOTES, "UTF-8") ) |
|
1136 | + $template_form_fields[$field_id]['value'] = ! empty($message_templates) && isset($content[$extra_field]) |
|
1137 | + ? stripslashes(html_entity_decode($content[$extra_field], ENT_QUOTES, "UTF-8")) |
|
1138 | 1138 | : ''; |
1139 | 1139 | |
1140 | 1140 | //do we have a validation error? if we do then let's use that value instead |
@@ -1150,32 +1150,32 @@ discard block |
||
1150 | 1150 | $field_id |
1151 | 1151 | ); |
1152 | 1152 | |
1153 | - if ( isset( $extra_array['input'] ) && $extra_array['input'] == 'wp_editor' ) { |
|
1153 | + if (isset($extra_array['input']) && $extra_array['input'] == 'wp_editor') { |
|
1154 | 1154 | //we want to decode the entities |
1155 | 1155 | $template_form_fields[$field_id]['value'] = stripslashes( |
1156 | - html_entity_decode( $template_form_fields[$field_id]['value'], ENT_QUOTES, "UTF-8") |
|
1156 | + html_entity_decode($template_form_fields[$field_id]['value'], ENT_QUOTES, "UTF-8") |
|
1157 | 1157 | ); |
1158 | 1158 | |
1159 | 1159 | }/**/ |
1160 | 1160 | } |
1161 | - $templatefield_MTP_id = $reference_field . '-MTP_ID'; |
|
1162 | - $templatefield_templatename_id = $reference_field . '-name'; |
|
1161 | + $templatefield_MTP_id = $reference_field.'-MTP_ID'; |
|
1162 | + $templatefield_templatename_id = $reference_field.'-name'; |
|
1163 | 1163 | |
1164 | 1164 | $template_form_fields[$templatefield_MTP_id] = array( |
1165 | - 'name' => 'MTP_template_fields[' . $reference_field . '][MTP_ID]', |
|
1165 | + 'name' => 'MTP_template_fields['.$reference_field.'][MTP_ID]', |
|
1166 | 1166 | 'label' => null, |
1167 | 1167 | 'input' => 'hidden', |
1168 | 1168 | 'type' => 'int', |
1169 | 1169 | 'required' => false, |
1170 | 1170 | 'validation' => false, |
1171 | - 'value' => !empty($message_templates) ? $message_template->ID() : '', |
|
1171 | + 'value' => ! empty($message_templates) ? $message_template->ID() : '', |
|
1172 | 1172 | 'css_class' => '', |
1173 | 1173 | 'format' => '%d', |
1174 | 1174 | 'db-col' => 'MTP_ID' |
1175 | 1175 | ); |
1176 | 1176 | |
1177 | 1177 | $template_form_fields[$templatefield_templatename_id] = array( |
1178 | - 'name' => 'MTP_template_fields[' . $reference_field . '][name]', |
|
1178 | + 'name' => 'MTP_template_fields['.$reference_field.'][name]', |
|
1179 | 1179 | 'label' => null, |
1180 | 1180 | 'input' => 'hidden', |
1181 | 1181 | 'type' => 'string', |
@@ -1189,14 +1189,14 @@ discard block |
||
1189 | 1189 | } |
1190 | 1190 | continue; //skip the next stuff, we got the necessary fields here for this dataset. |
1191 | 1191 | } else { |
1192 | - $field_id = $template_field . '-content'; |
|
1192 | + $field_id = $template_field.'-content'; |
|
1193 | 1193 | $template_form_fields[$field_id] = $field_setup_array; |
1194 | - $template_form_fields[$field_id]['name'] = 'MTP_template_fields[' . $template_field . '][content]'; |
|
1195 | - $message_template = isset( $message_templates[ $context ][ $template_field ] ) |
|
1196 | - ? $message_templates[ $context ][ $template_field ] |
|
1194 | + $template_form_fields[$field_id]['name'] = 'MTP_template_fields['.$template_field.'][content]'; |
|
1195 | + $message_template = isset($message_templates[$context][$template_field]) |
|
1196 | + ? $message_templates[$context][$template_field] |
|
1197 | 1197 | : null; |
1198 | - $template_form_fields[$field_id]['value'] = ! empty( $message_templates ) |
|
1199 | - && is_array( $message_templates[$context] ) |
|
1198 | + $template_form_fields[$field_id]['value'] = ! empty($message_templates) |
|
1199 | + && is_array($message_templates[$context]) |
|
1200 | 1200 | && $message_template instanceof EE_Message_Template |
1201 | 1201 | ? $message_template->get('MTP_content') |
1202 | 1202 | : ''; |
@@ -1209,10 +1209,10 @@ discard block |
||
1209 | 1209 | |
1210 | 1210 | $template_form_fields[$field_id]['db-col'] = 'MTP_content'; |
1211 | 1211 | $css_class = isset($field_setup_array['css_class']) ? $field_setup_array['css_class'] : ''; |
1212 | - $template_form_fields[$field_id]['css_class'] = ! empty( $v_fields ) |
|
1213 | - && in_array( $template_field, $v_fields ) |
|
1214 | - && isset( $validators[$template_field]['msg'] ) |
|
1215 | - ? 'validate-error ' . $css_class |
|
1212 | + $template_form_fields[$field_id]['css_class'] = ! empty($v_fields) |
|
1213 | + && in_array($template_field, $v_fields) |
|
1214 | + && isset($validators[$template_field]['msg']) |
|
1215 | + ? 'validate-error '.$css_class |
|
1216 | 1216 | : $css_class; |
1217 | 1217 | |
1218 | 1218 | //shortcode selector |
@@ -1223,12 +1223,12 @@ discard block |
||
1223 | 1223 | |
1224 | 1224 | //k took care of content field(s) now let's take care of others. |
1225 | 1225 | |
1226 | - $templatefield_MTP_id = $template_field . '-MTP_ID'; |
|
1227 | - $templatefield_field_templatename_id = $template_field . '-name'; |
|
1226 | + $templatefield_MTP_id = $template_field.'-MTP_ID'; |
|
1227 | + $templatefield_field_templatename_id = $template_field.'-name'; |
|
1228 | 1228 | |
1229 | 1229 | //foreach template field there are actually two form fields created |
1230 | 1230 | $template_form_fields[$templatefield_MTP_id] = array( |
1231 | - 'name' => 'MTP_template_fields[' . $template_field . '][MTP_ID]', |
|
1231 | + 'name' => 'MTP_template_fields['.$template_field.'][MTP_ID]', |
|
1232 | 1232 | 'label' => null, |
1233 | 1233 | 'input' => 'hidden', |
1234 | 1234 | 'type' => 'int', |
@@ -1241,7 +1241,7 @@ discard block |
||
1241 | 1241 | ); |
1242 | 1242 | |
1243 | 1243 | $template_form_fields[$templatefield_field_templatename_id] = array( |
1244 | - 'name' => 'MTP_template_fields[' . $template_field . '][name]', |
|
1244 | + 'name' => 'MTP_template_fields['.$template_field.'][name]', |
|
1245 | 1245 | 'label' => null, |
1246 | 1246 | 'input' => 'hidden', |
1247 | 1247 | 'type' => 'string', |
@@ -1385,13 +1385,13 @@ discard block |
||
1385 | 1385 | 'value' => $GRP_ID |
1386 | 1386 | ); |
1387 | 1387 | $sidebar_form_fields['ee-msg-evt-nonce'] = array( |
1388 | - 'name' => $action . '_nonce', |
|
1388 | + 'name' => $action.'_nonce', |
|
1389 | 1389 | 'input' => 'hidden', |
1390 | 1390 | 'type' => 'string', |
1391 | - 'value' => wp_create_nonce( $action . '_nonce') |
|
1391 | + 'value' => wp_create_nonce($action.'_nonce') |
|
1392 | 1392 | ); |
1393 | 1393 | |
1394 | - if ( isset($this->_req_data['template_switch']) && $this->_req_data['template_switch'] ) { |
|
1394 | + if (isset($this->_req_data['template_switch']) && $this->_req_data['template_switch']) { |
|
1395 | 1395 | $sidebar_form_fields['ee-msg-template-switch'] = array( |
1396 | 1396 | 'name' => 'template_switch', |
1397 | 1397 | 'input' => 'hidden', |
@@ -1401,8 +1401,8 @@ discard block |
||
1401 | 1401 | } |
1402 | 1402 | |
1403 | 1403 | |
1404 | - $template_fields = $this->_generate_admin_form_fields( $template_form_fields ); |
|
1405 | - $sidebar_fields = $this->_generate_admin_form_fields( $sidebar_form_fields ); |
|
1404 | + $template_fields = $this->_generate_admin_form_fields($template_form_fields); |
|
1405 | + $sidebar_fields = $this->_generate_admin_form_fields($sidebar_form_fields); |
|
1406 | 1406 | |
1407 | 1407 | |
1408 | 1408 | } //end if ( !empty($template_field_structure) ) |
@@ -1414,7 +1414,7 @@ discard block |
||
1414 | 1414 | $GRP_ID, |
1415 | 1415 | false, |
1416 | 1416 | add_query_arg( |
1417 | - array( 'action' => 'global_mtps' ), |
|
1417 | + array('action' => 'global_mtps'), |
|
1418 | 1418 | $this->_admin_base_url |
1419 | 1419 | ) |
1420 | 1420 | ); |
@@ -1430,7 +1430,7 @@ discard block |
||
1430 | 1430 | ), |
1431 | 1431 | $this->_admin_base_url |
1432 | 1432 | ); |
1433 | - $preview_button = '<a href="' . $preview_url . '" class="button-secondary messages-preview-button">' . __('Preview', 'event_espresso') . '</a>'; |
|
1433 | + $preview_button = '<a href="'.$preview_url.'" class="button-secondary messages-preview-button">'.__('Preview', 'event_espresso').'</a>'; |
|
1434 | 1434 | |
1435 | 1435 | |
1436 | 1436 | //setup context switcher |
@@ -1459,16 +1459,16 @@ discard block |
||
1459 | 1459 | |
1460 | 1460 | $this->_template_path = $this->_template_args['GRP_ID'] |
1461 | 1461 | ? EE_MSG_TEMPLATE_PATH . 'ee_msg_details_main_edit_meta_box.template.php' |
1462 | - : EE_MSG_TEMPLATE_PATH . 'ee_msg_details_main_add_meta_box.template.php'; |
|
1462 | + : EE_MSG_TEMPLATE_PATH.'ee_msg_details_main_add_meta_box.template.php'; |
|
1463 | 1463 | |
1464 | 1464 | //send along EE_Message_Template_Group object for further template use. |
1465 | 1465 | $this->_template_args['MTP'] = $message_template_group; |
1466 | 1466 | |
1467 | - $this->_template_args['admin_page_content'] = EEH_Template::display_template( $this->_template_path, $this->_template_args, true ); |
|
1467 | + $this->_template_args['admin_page_content'] = EEH_Template::display_template($this->_template_path, $this->_template_args, true); |
|
1468 | 1468 | |
1469 | 1469 | |
1470 | 1470 | //finally, let's set the admin_page title |
1471 | - $this->_admin_page_title = sprintf( __('Editing %s', 'event_espresso'), $title ); |
|
1471 | + $this->_admin_page_title = sprintf(__('Editing %s', 'event_espresso'), $title); |
|
1472 | 1472 | |
1473 | 1473 | |
1474 | 1474 | //we need to take care of setting the shortcodes property for use elsewhere. |
@@ -1481,7 +1481,7 @@ discard block |
||
1481 | 1481 | } |
1482 | 1482 | |
1483 | 1483 | |
1484 | - public function filter_tinymce_init( $mceInit, $editor_id ) { |
|
1484 | + public function filter_tinymce_init($mceInit, $editor_id) { |
|
1485 | 1485 | return $mceInit; |
1486 | 1486 | } |
1487 | 1487 | |
@@ -1492,7 +1492,7 @@ discard block |
||
1492 | 1492 | } |
1493 | 1493 | |
1494 | 1494 | public function _add_form_element_before() { |
1495 | - return '<form method="post" action="' . $this->_template_args["edit_message_template_form_url"] . '" id="ee-msg-edit-frm">'; |
|
1495 | + return '<form method="post" action="'.$this->_template_args["edit_message_template_form_url"].'" id="ee-msg-edit-frm">'; |
|
1496 | 1496 | } |
1497 | 1497 | |
1498 | 1498 | public function _add_form_element_after() { |
@@ -1509,25 +1509,25 @@ discard block |
||
1509 | 1509 | * |
1510 | 1510 | */ |
1511 | 1511 | public function switch_template_pack() { |
1512 | - $GRP_ID = ! empty( $this->_req_data['GRP_ID'] ) ? $this->_req_data['GRP_ID'] : 0; |
|
1513 | - $template_pack = ! empty( $this->_req_data['template_pack'] ) ? $this->_req_data['template_pack'] : ''; |
|
1512 | + $GRP_ID = ! empty($this->_req_data['GRP_ID']) ? $this->_req_data['GRP_ID'] : 0; |
|
1513 | + $template_pack = ! empty($this->_req_data['template_pack']) ? $this->_req_data['template_pack'] : ''; |
|
1514 | 1514 | |
1515 | 1515 | //verify we have needed values. |
1516 | - if ( empty( $GRP_ID ) || empty( $template_pack ) ) { |
|
1516 | + if (empty($GRP_ID) || empty($template_pack)) { |
|
1517 | 1517 | $this->_template_args['error'] = true; |
1518 | - EE_Error::add_error( __('The required date for switching templates is not available.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ ); |
|
1518 | + EE_Error::add_error(__('The required date for switching templates is not available.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
1519 | 1519 | } else { |
1520 | 1520 | //get template, set the new template_pack and then reset to default |
1521 | 1521 | /** @type EE_Message_Template_Group $message_template_group */ |
1522 | - $message_template_group = EEM_Message_Template_Group::instance()->get_one_by_ID( $GRP_ID ); |
|
1522 | + $message_template_group = EEM_Message_Template_Group::instance()->get_one_by_ID($GRP_ID); |
|
1523 | 1523 | |
1524 | - $message_template_group->set_template_pack_name( $template_pack ); |
|
1524 | + $message_template_group->set_template_pack_name($template_pack); |
|
1525 | 1525 | $this->_req_data['msgr'] = $message_template_group->messenger(); |
1526 | 1526 | $this->_req_data['mt'] = $message_template_group->message_type(); |
1527 | 1527 | |
1528 | 1528 | $query_args = $this->_reset_to_default_template(); |
1529 | 1529 | |
1530 | - if ( empty( $query_args['id'] ) ) { |
|
1530 | + if (empty($query_args['id'])) { |
|
1531 | 1531 | EE_Error::add_error( |
1532 | 1532 | __( |
1533 | 1533 | 'Something went wrong with switching the template pack. Please try again or contact EE support', |
@@ -1537,7 +1537,7 @@ discard block |
||
1537 | 1537 | ); |
1538 | 1538 | $this->_template_args['error'] = true; |
1539 | 1539 | } else { |
1540 | - $template_label =$message_template_group->get_template_pack()->label; |
|
1540 | + $template_label = $message_template_group->get_template_pack()->label; |
|
1541 | 1541 | $template_pack_labels = $message_template_group->messenger_obj()->get_supports_labels(); |
1542 | 1542 | EE_Error::add_success( |
1543 | 1543 | sprintf( |
@@ -1550,7 +1550,7 @@ discard block |
||
1550 | 1550 | ) |
1551 | 1551 | ); |
1552 | 1552 | //generate the redirect url for js. |
1553 | - $url = self::add_query_args_and_nonce( $query_args, $this->_admin_base_url ); |
|
1553 | + $url = self::add_query_args_and_nonce($query_args, $this->_admin_base_url); |
|
1554 | 1554 | $this->_template_args['data']['redirect_url'] = $url; |
1555 | 1555 | $this->_template_args['success'] = true; |
1556 | 1556 | } |
@@ -1572,9 +1572,9 @@ discard block |
||
1572 | 1572 | protected function _reset_to_default_template() { |
1573 | 1573 | |
1574 | 1574 | $templates = array(); |
1575 | - $GRP_ID = !empty( $this->_req_data['GRP_ID'] ) ? $this->_req_data['GRP_ID'] : 0; |
|
1575 | + $GRP_ID = ! empty($this->_req_data['GRP_ID']) ? $this->_req_data['GRP_ID'] : 0; |
|
1576 | 1576 | //we need to make sure we've got the info we need. |
1577 | - if ( ! isset( $this->_req_data['msgr'], $this->_req_data['mt'], $this->_req_data['GRP_ID'] ) ) { |
|
1577 | + if ( ! isset($this->_req_data['msgr'], $this->_req_data['mt'], $this->_req_data['GRP_ID'])) { |
|
1578 | 1578 | EE_Error::add_error( |
1579 | 1579 | __( |
1580 | 1580 | 'In order to reset the template to its default we require the messenger, message type, and message template GRP_ID to know what is being reset. At least one of these is missing.', |
@@ -1586,9 +1586,9 @@ discard block |
||
1586 | 1586 | |
1587 | 1587 | // all templates will be reset to whatever the defaults are |
1588 | 1588 | // for the global template matching the messenger and message type. |
1589 | - $success = !empty( $GRP_ID ) ? true : false; |
|
1589 | + $success = ! empty($GRP_ID) ? true : false; |
|
1590 | 1590 | |
1591 | - if ( $success ) { |
|
1591 | + if ($success) { |
|
1592 | 1592 | |
1593 | 1593 | //let's first determine if the incoming template is a global template, |
1594 | 1594 | // if it isn't then we need to get the global template matching messenger and message type. |
@@ -1596,9 +1596,9 @@ discard block |
||
1596 | 1596 | |
1597 | 1597 | |
1598 | 1598 | //note this is ONLY deleting the template fields (Message Template rows) NOT the message template group. |
1599 | - $success = $this->_delete_mtp_permanently( $GRP_ID, false ); |
|
1599 | + $success = $this->_delete_mtp_permanently($GRP_ID, false); |
|
1600 | 1600 | |
1601 | - if ( $success ) { |
|
1601 | + if ($success) { |
|
1602 | 1602 | // if successfully deleted, lets generate the new ones. |
1603 | 1603 | // Note. We set GLOBAL to true, because resets on ANY template |
1604 | 1604 | // will use the related global template defaults for regeneration. |
@@ -1616,32 +1616,32 @@ discard block |
||
1616 | 1616 | } |
1617 | 1617 | |
1618 | 1618 | //any error messages? |
1619 | - if ( !$success ) { |
|
1619 | + if ( ! $success) { |
|
1620 | 1620 | EE_Error::add_error( |
1621 | - __( 'Something went wrong with deleting existing templates. Unable to reset to default', 'event_espresso' ), |
|
1621 | + __('Something went wrong with deleting existing templates. Unable to reset to default', 'event_espresso'), |
|
1622 | 1622 | __FILE__, __FUNCTION__, __LINE__ |
1623 | 1623 | ); |
1624 | 1624 | } |
1625 | 1625 | |
1626 | 1626 | //all good, let's add a success message! |
1627 | - if ( $success && ! empty( $templates ) ) { |
|
1627 | + if ($success && ! empty($templates)) { |
|
1628 | 1628 | $templates = $templates[0]; //the info for the template we generated is the first element in the returned array. |
1629 | 1629 | EE_Error::overwrite_success(); |
1630 | - EE_Error::add_success( __('Templates have been reset to defaults.', 'event_espresso') ); |
|
1630 | + EE_Error::add_success(__('Templates have been reset to defaults.', 'event_espresso')); |
|
1631 | 1631 | } |
1632 | 1632 | |
1633 | 1633 | |
1634 | 1634 | $query_args = array( |
1635 | - 'id' => isset( $templates['GRP_ID'] ) ? $templates['GRP_ID'] : null, |
|
1636 | - 'context' => isset( $templates['MTP_context'] ) ? $templates['MTP_context'] : null, |
|
1637 | - 'action' => isset( $templates['GRP_ID'] ) ? 'edit_message_template' : 'global_mtps' |
|
1635 | + 'id' => isset($templates['GRP_ID']) ? $templates['GRP_ID'] : null, |
|
1636 | + 'context' => isset($templates['MTP_context']) ? $templates['MTP_context'] : null, |
|
1637 | + 'action' => isset($templates['GRP_ID']) ? 'edit_message_template' : 'global_mtps' |
|
1638 | 1638 | ); |
1639 | 1639 | |
1640 | 1640 | //if called via ajax then we return query args otherwise redirect |
1641 | - if ( defined('DOING_AJAX') && DOING_AJAX ) { |
|
1641 | + if (defined('DOING_AJAX') && DOING_AJAX) { |
|
1642 | 1642 | return $query_args; |
1643 | 1643 | } else { |
1644 | - $this->_redirect_after_action( false, '', '', $query_args, true ); |
|
1644 | + $this->_redirect_after_action(false, '', '', $query_args, true); |
|
1645 | 1645 | return null; |
1646 | 1646 | } |
1647 | 1647 | } |
@@ -1654,7 +1654,7 @@ discard block |
||
1654 | 1654 | * @param bool $send if TRUE then we are doing an actual TEST send with the results of the preview. |
1655 | 1655 | * @return string |
1656 | 1656 | */ |
1657 | - public function _preview_message( $send = false ) { |
|
1657 | + public function _preview_message($send = false) { |
|
1658 | 1658 | //first make sure we've got the necessary parameters |
1659 | 1659 | if ( |
1660 | 1660 | ! isset( |
@@ -1670,13 +1670,13 @@ discard block |
||
1670 | 1670 | ); |
1671 | 1671 | } |
1672 | 1672 | |
1673 | - EE_Registry::instance()->REQ->set( 'GRP_ID', $this->_req_data['GRP_ID'] ); |
|
1673 | + EE_Registry::instance()->REQ->set('GRP_ID', $this->_req_data['GRP_ID']); |
|
1674 | 1674 | |
1675 | 1675 | |
1676 | 1676 | //get the preview! |
1677 | - $preview = EED_Messages::preview_message( $this->_req_data['message_type'], $this->_req_data['context'], $this->_req_data['messenger'], $send ); |
|
1677 | + $preview = EED_Messages::preview_message($this->_req_data['message_type'], $this->_req_data['context'], $this->_req_data['messenger'], $send); |
|
1678 | 1678 | |
1679 | - if ( $send ) { |
|
1679 | + if ($send) { |
|
1680 | 1680 | return $preview; |
1681 | 1681 | } |
1682 | 1682 | |
@@ -1686,22 +1686,22 @@ discard block |
||
1686 | 1686 | 'context' => $this->_req_data['context'], |
1687 | 1687 | 'action' => 'edit_message_template' |
1688 | 1688 | ); |
1689 | - $go_back_url = parent::add_query_args_and_nonce( $query_args, $this->_admin_base_url ); |
|
1690 | - $preview_button = '<a href="' . $go_back_url . '" class="button-secondary messages-preview-go-back-button">' . __('Go Back to Edit', 'event_espresso') . '</a>'; |
|
1689 | + $go_back_url = parent::add_query_args_and_nonce($query_args, $this->_admin_base_url); |
|
1690 | + $preview_button = '<a href="'.$go_back_url.'" class="button-secondary messages-preview-go-back-button">'.__('Go Back to Edit', 'event_espresso').'</a>'; |
|
1691 | 1691 | $message_types = $this->get_installed_message_types(); |
1692 | - $active_messenger = $this->_message_resource_manager->get_active_messenger( $this->_req_data['messenger'] ); |
|
1692 | + $active_messenger = $this->_message_resource_manager->get_active_messenger($this->_req_data['messenger']); |
|
1693 | 1693 | $active_messenger_label = $active_messenger instanceof EE_messenger |
1694 | - ? ucwords( $active_messenger->label['singular'] ) |
|
1695 | - : esc_html__( 'Unknown Messenger', 'event_espresso' ); |
|
1694 | + ? ucwords($active_messenger->label['singular']) |
|
1695 | + : esc_html__('Unknown Messenger', 'event_espresso'); |
|
1696 | 1696 | //let's provide a helpful title for context |
1697 | 1697 | $preview_title = sprintf( |
1698 | - __( 'Viewing Preview for %s %s Message Template', 'event_espresso' ), |
|
1698 | + __('Viewing Preview for %s %s Message Template', 'event_espresso'), |
|
1699 | 1699 | $active_messenger_label, |
1700 | - ucwords( $message_types[ $this->_req_data[ 'message_type' ] ]->label[ 'singular' ] ) |
|
1700 | + ucwords($message_types[$this->_req_data['message_type']]->label['singular']) |
|
1701 | 1701 | ); |
1702 | 1702 | //setup display of preview. |
1703 | 1703 | $this->_admin_page_title = $preview_title; |
1704 | - $this->_template_args['admin_page_content'] = $preview_button . '<br />' .stripslashes($preview); |
|
1704 | + $this->_template_args['admin_page_content'] = $preview_button.'<br />'.stripslashes($preview); |
|
1705 | 1705 | $this->_template_args['data']['force_json'] = true; |
1706 | 1706 | return ''; |
1707 | 1707 | } |
@@ -1731,9 +1731,9 @@ discard block |
||
1731 | 1731 | * @return void |
1732 | 1732 | */ |
1733 | 1733 | protected function _register_edit_meta_boxes() { |
1734 | - add_meta_box( 'mtp_valid_shortcodes', __('Valid Shortcodes', 'event_espresso'), array( $this, 'shortcode_meta_box' ), $this->_current_screen->id, 'side', 'default' ); |
|
1735 | - add_meta_box( 'mtp_extra_actions', __('Extra Actions', 'event_espresso'), array( $this, 'extra_actions_meta_box' ), $this->_current_screen->id, 'side', 'high' ); |
|
1736 | - add_meta_box( 'mtp_templates', __('Template Styles', 'event_espresso'), array( $this, 'template_pack_meta_box' ), $this->_current_screen->id, 'side', 'high' ); |
|
1734 | + add_meta_box('mtp_valid_shortcodes', __('Valid Shortcodes', 'event_espresso'), array($this, 'shortcode_meta_box'), $this->_current_screen->id, 'side', 'default'); |
|
1735 | + add_meta_box('mtp_extra_actions', __('Extra Actions', 'event_espresso'), array($this, 'extra_actions_meta_box'), $this->_current_screen->id, 'side', 'high'); |
|
1736 | + add_meta_box('mtp_templates', __('Template Styles', 'event_espresso'), array($this, 'template_pack_meta_box'), $this->_current_screen->id, 'side', 'high'); |
|
1737 | 1737 | } |
1738 | 1738 | |
1739 | 1739 | |
@@ -1752,14 +1752,14 @@ discard block |
||
1752 | 1752 | |
1753 | 1753 | $tp_select_values = array(); |
1754 | 1754 | |
1755 | - foreach ( $tp_collection as $tp ) { |
|
1755 | + foreach ($tp_collection as $tp) { |
|
1756 | 1756 | //only include template packs that support this messenger and message type! |
1757 | 1757 | $supports = $tp->get_supports(); |
1758 | 1758 | if ( |
1759 | - ! isset( $supports[ $this->_message_template_group->messenger() ] ) |
|
1759 | + ! isset($supports[$this->_message_template_group->messenger()]) |
|
1760 | 1760 | || ! in_array( |
1761 | 1761 | $this->_message_template_group->message_type(), |
1762 | - $supports[ $this->_message_template_group->messenger() ] |
|
1762 | + $supports[$this->_message_template_group->messenger()] |
|
1763 | 1763 | ) |
1764 | 1764 | ) { |
1765 | 1765 | //not supported |
@@ -1773,7 +1773,7 @@ discard block |
||
1773 | 1773 | } |
1774 | 1774 | |
1775 | 1775 | //if empty $tp_select_values then we make sure default is set because EVERY message type should be supported by the default template pack. This still allows for the odd template pack to override. |
1776 | - if ( empty( $tp_select_values ) ) { |
|
1776 | + if (empty($tp_select_values)) { |
|
1777 | 1777 | $tp_select_values[] = array( |
1778 | 1778 | 'text' => __('Default', 'event_espresso'), |
1779 | 1779 | 'id' => 'default' |
@@ -1786,14 +1786,14 @@ discard block |
||
1786 | 1786 | $this->_message_template_group->message_type() |
1787 | 1787 | ); |
1788 | 1788 | $variations_select_values = array(); |
1789 | - foreach ( $variations as $variation => $label ) { |
|
1789 | + foreach ($variations as $variation => $label) { |
|
1790 | 1790 | $variations_select_values[] = array( |
1791 | 1791 | 'text' => $label, |
1792 | 1792 | 'id' => $variation |
1793 | 1793 | ); |
1794 | 1794 | } |
1795 | 1795 | |
1796 | - $template_pack_labels= $this->_message_template_group->messenger_obj()->get_supports_labels(); |
|
1796 | + $template_pack_labels = $this->_message_template_group->messenger_obj()->get_supports_labels(); |
|
1797 | 1797 | |
1798 | 1798 | $template_args['template_packs_selector'] = EEH_Form_Fields::select_input( |
1799 | 1799 | 'MTP_template_pack', |
@@ -1810,9 +1810,9 @@ discard block |
||
1810 | 1810 | $template_args['template_pack_description'] = $template_pack_labels->template_pack_description; |
1811 | 1811 | $template_args['template_variation_description'] = $template_pack_labels->template_variation_description; |
1812 | 1812 | |
1813 | - $template = EE_MSG_TEMPLATE_PATH . 'template_pack_and_variations_metabox.template.php'; |
|
1813 | + $template = EE_MSG_TEMPLATE_PATH.'template_pack_and_variations_metabox.template.php'; |
|
1814 | 1814 | |
1815 | - EEH_Template::display_template( $template, $template_args ); |
|
1815 | + EEH_Template::display_template($template, $template_args); |
|
1816 | 1816 | } |
1817 | 1817 | |
1818 | 1818 | |
@@ -1843,47 +1843,47 @@ discard block |
||
1843 | 1843 | //first we need to see if there are any fields |
1844 | 1844 | $fields = $this->_message_template_group->messenger_obj()->get_test_settings_fields(); |
1845 | 1845 | |
1846 | - if ( !empty( $fields ) ) { |
|
1846 | + if ( ! empty($fields)) { |
|
1847 | 1847 | //yup there be fields |
1848 | - foreach ( $fields as $field => $config ) { |
|
1849 | - $field_id = $this->_message_template_group->messenger() . '_' . $field; |
|
1848 | + foreach ($fields as $field => $config) { |
|
1849 | + $field_id = $this->_message_template_group->messenger().'_'.$field; |
|
1850 | 1850 | $existing = $this->_message_template_group->messenger_obj()->get_existing_test_settings(); |
1851 | - $default = isset( $config['default'] ) ? $config['default'] : ''; |
|
1852 | - $default = isset( $config['value'] ) ? $config['value'] : $default; |
|
1851 | + $default = isset($config['default']) ? $config['default'] : ''; |
|
1852 | + $default = isset($config['value']) ? $config['value'] : $default; |
|
1853 | 1853 | |
1854 | 1854 | //if type is hidden and the value is empty something may have gone wrong so let's correct with the defaults |
1855 | 1855 | $fix = $config['input'] == 'hidden' && isset($existing[$field]) && empty($existing[$field]) ? $default : ''; |
1856 | - $existing[$field] = isset( $existing[$field] ) && empty( $fix ) ? $existing[$field] : $fix; |
|
1856 | + $existing[$field] = isset($existing[$field]) && empty($fix) ? $existing[$field] : $fix; |
|
1857 | 1857 | |
1858 | 1858 | $template_form_fields[$field_id] = array( |
1859 | - 'name' => 'test_settings_fld[' . $field . ']', |
|
1859 | + 'name' => 'test_settings_fld['.$field.']', |
|
1860 | 1860 | 'label' => $config['label'], |
1861 | 1861 | 'input' => $config['input'], |
1862 | 1862 | 'type' => $config['type'], |
1863 | 1863 | 'required' => $config['required'], |
1864 | 1864 | 'validation' => $config['validation'], |
1865 | - 'value' => isset( $existing[$field] ) ? $existing[$field] : $default, |
|
1865 | + 'value' => isset($existing[$field]) ? $existing[$field] : $default, |
|
1866 | 1866 | 'css_class' => $config['css_class'], |
1867 | - 'options' => isset( $config['options'] ) ? $config['options'] : array(), |
|
1867 | + 'options' => isset($config['options']) ? $config['options'] : array(), |
|
1868 | 1868 | 'default' => $default, |
1869 | 1869 | 'format' => $config['format'] |
1870 | 1870 | ); |
1871 | 1871 | } |
1872 | 1872 | } |
1873 | 1873 | |
1874 | - $test_settings_fields = !empty( $template_form_fields) |
|
1875 | - ? $this->_generate_admin_form_fields( $template_form_fields, 'string', 'ee_tst_settings_flds' ) |
|
1874 | + $test_settings_fields = ! empty($template_form_fields) |
|
1875 | + ? $this->_generate_admin_form_fields($template_form_fields, 'string', 'ee_tst_settings_flds') |
|
1876 | 1876 | : ''; |
1877 | 1877 | |
1878 | 1878 | $test_settings_html = ''; |
1879 | 1879 | //print out $test_settings_fields |
1880 | - if ( !empty( $test_settings_fields ) ) { |
|
1880 | + if ( ! empty($test_settings_fields)) { |
|
1881 | 1881 | echo $test_settings_fields; |
1882 | - $test_settings_html = '<input type="submit" class="button-primary mtp-test-button alignright" name="test_button" value="' . __('Test Send', 'event_espresso') . '" /><div style="clear:both"></div>'; |
|
1882 | + $test_settings_html = '<input type="submit" class="button-primary mtp-test-button alignright" name="test_button" value="'.__('Test Send', 'event_espresso').'" /><div style="clear:both"></div>'; |
|
1883 | 1883 | } |
1884 | 1884 | |
1885 | 1885 | //and button |
1886 | - echo $test_settings_html . '<p>' . __('Need to reset this message type and start over?', 'event_espresso') . '</p>' . '<div class="publishing-action alignright resetbutton">' . $button . '</div><div style="clear:both"></div>'; |
|
1886 | + echo $test_settings_html.'<p>'.__('Need to reset this message type and start over?', 'event_espresso').'</p>'.'<div class="publishing-action alignright resetbutton">'.$button.'</div><div style="clear:both"></div>'; |
|
1887 | 1887 | } |
1888 | 1888 | |
1889 | 1889 | |
@@ -1898,13 +1898,13 @@ discard block |
||
1898 | 1898 | * @param string $linked_input_id The css id of the input that the shortcodes get added to. |
1899 | 1899 | * @return string |
1900 | 1900 | */ |
1901 | - protected function _get_shortcode_selector( $field, $linked_input_id ) { |
|
1901 | + protected function _get_shortcode_selector($field, $linked_input_id) { |
|
1902 | 1902 | $template_args = array( |
1903 | - 'shortcodes' => $this->_get_shortcodes( array( $field ), true ), |
|
1903 | + 'shortcodes' => $this->_get_shortcodes(array($field), true), |
|
1904 | 1904 | 'fieldname' => $field, |
1905 | 1905 | 'linked_input_id' => $linked_input_id |
1906 | 1906 | ); |
1907 | - return EEH_Template::display_template( EE_MSG_TEMPLATE_PATH . 'shortcode_selector_skeleton.template.php', $template_args, true ); |
|
1907 | + return EEH_Template::display_template(EE_MSG_TEMPLATE_PATH.'shortcode_selector_skeleton.template.php', $template_args, true); |
|
1908 | 1908 | } |
1909 | 1909 | |
1910 | 1910 | |
@@ -1919,13 +1919,13 @@ discard block |
||
1919 | 1919 | $shortcodes = $this->_get_shortcodes(array(), false); //just make sure shortcodes property is set |
1920 | 1920 | //$messenger = $this->_message_template_group->messenger_obj(); |
1921 | 1921 | //now let's set the content depending on the status of the shortcodes array |
1922 | - if ( empty( $shortcodes ) ) { |
|
1923 | - $content = '<p>' . __('There are no valid shortcodes available', 'event_espresso') . '</p>'; |
|
1922 | + if (empty($shortcodes)) { |
|
1923 | + $content = '<p>'.__('There are no valid shortcodes available', 'event_espresso').'</p>'; |
|
1924 | 1924 | echo $content; |
1925 | 1925 | } else { |
1926 | 1926 | //$alt = 0; |
1927 | 1927 | ?> |
1928 | - <div style="float:right; margin-top:10px"><?php echo $this->_get_help_tab_link('message_template_shortcodes'); ?></div><p class="small-text"><?php printf( __('You can view the shortcodes usable in your template by clicking the %s icon next to each field.', 'event_espresso' ), '<span class="dashicons dashicons-menu"></span>' ); ?></p> |
|
1928 | + <div style="float:right; margin-top:10px"><?php echo $this->_get_help_tab_link('message_template_shortcodes'); ?></div><p class="small-text"><?php printf(__('You can view the shortcodes usable in your template by clicking the %s icon next to each field.', 'event_espresso'), '<span class="dashicons dashicons-menu"></span>'); ?></p> |
|
1929 | 1929 | <?php |
1930 | 1930 | } |
1931 | 1931 | |
@@ -1942,7 +1942,7 @@ discard block |
||
1942 | 1942 | protected function _set_shortcodes() { |
1943 | 1943 | |
1944 | 1944 | //no need to run this if the property is already set |
1945 | - if ( !empty($this->_shortcodes ) ) {return;} |
|
1945 | + if ( ! empty($this->_shortcodes)) {return; } |
|
1946 | 1946 | |
1947 | 1947 | $this->_shortcodes = $this->_get_shortcodes(); |
1948 | 1948 | } |
@@ -1964,14 +1964,14 @@ discard block |
||
1964 | 1964 | * @return array Shortcodes indexed by fieldname and the an array of shortcode/label pairs OR if merged is true |
1965 | 1965 | * just an array of shortcode/label pairs. |
1966 | 1966 | */ |
1967 | - protected function _get_shortcodes( $fields = array(), $merged = true ) { |
|
1967 | + protected function _get_shortcodes($fields = array(), $merged = true) { |
|
1968 | 1968 | $this->_set_message_template_group(); |
1969 | 1969 | |
1970 | 1970 | //we need the messenger and message template to retrieve the valid shortcodes array. |
1971 | - $GRP_ID = isset( $this->_req_data['id'] ) && !empty( $this->_req_data['id'] ) ? absint( $this->_req_data['id'] ) : false; |
|
1972 | - $context = isset( $this->_req_data['context'] ) ? $this->_req_data['context'] : key( $this->_message_template_group->contexts_config() ); |
|
1971 | + $GRP_ID = isset($this->_req_data['id']) && ! empty($this->_req_data['id']) ? absint($this->_req_data['id']) : false; |
|
1972 | + $context = isset($this->_req_data['context']) ? $this->_req_data['context'] : key($this->_message_template_group->contexts_config()); |
|
1973 | 1973 | |
1974 | - return !empty($GRP_ID) ? $this->_message_template_group->get_shortcodes( $context, $fields, $merged ) : array(); |
|
1974 | + return ! empty($GRP_ID) ? $this->_message_template_group->get_shortcodes($context, $fields, $merged) : array(); |
|
1975 | 1975 | } |
1976 | 1976 | |
1977 | 1977 | |
@@ -1984,19 +1984,19 @@ discard block |
||
1984 | 1984 | */ |
1985 | 1985 | protected function _set_message_template_group() { |
1986 | 1986 | |
1987 | - if ( !empty( $this->_message_template_group ) ) |
|
1988 | - {return;} //get out if this is already set. |
|
1987 | + if ( ! empty($this->_message_template_group)) |
|
1988 | + {return; } //get out if this is already set. |
|
1989 | 1989 | |
1990 | - $GRP_ID = ! empty( $this->_req_data['GRP_ID'] ) ? absint( $this->_req_data['GRP_ID'] ) : false; |
|
1991 | - $GRP_ID = empty( $GRP_ID ) && ! empty( $this->_req_data['id'] ) ? $this->_req_data['id'] : $GRP_ID; |
|
1990 | + $GRP_ID = ! empty($this->_req_data['GRP_ID']) ? absint($this->_req_data['GRP_ID']) : false; |
|
1991 | + $GRP_ID = empty($GRP_ID) && ! empty($this->_req_data['id']) ? $this->_req_data['id'] : $GRP_ID; |
|
1992 | 1992 | |
1993 | 1993 | //let's get the message templates |
1994 | 1994 | $MTP = EEM_Message_Template_Group::instance(); |
1995 | 1995 | |
1996 | - if ( empty($GRP_ID) ) |
|
1997 | - {$this->_message_template_group = $MTP->create_default_object();} |
|
1996 | + if (empty($GRP_ID)) |
|
1997 | + {$this->_message_template_group = $MTP->create_default_object(); } |
|
1998 | 1998 | else |
1999 | - {$this->_message_template_group = $MTP->get_one_by_ID( $GRP_ID );} |
|
1999 | + {$this->_message_template_group = $MTP->get_one_by_ID($GRP_ID); } |
|
2000 | 2000 | |
2001 | 2001 | $this->_template_pack = $this->_message_template_group->get_template_pack(); |
2002 | 2002 | $this->_variation = $this->_message_template_group->get_template_pack_variation(); |
@@ -2015,7 +2015,7 @@ discard block |
||
2015 | 2015 | * @param array $args various things the context switcher needs. |
2016 | 2016 | * |
2017 | 2017 | */ |
2018 | - protected function _set_context_switcher( EE_Message_Template_Group $template_group_object, $args) { |
|
2018 | + protected function _set_context_switcher(EE_Message_Template_Group $template_group_object, $args) { |
|
2019 | 2019 | $context_details = $template_group_object->contexts_config(); |
2020 | 2020 | $context_label = $template_group_object->context_label(); |
2021 | 2021 | ob_start(); |
@@ -2023,20 +2023,20 @@ discard block |
||
2023 | 2023 | <div class="ee-msg-switcher-container"> |
2024 | 2024 | <form method="get" action="<?php echo EE_MSG_ADMIN_URL; ?>" id="ee-msg-context-switcher-frm"> |
2025 | 2025 | <?php |
2026 | - foreach ( $args as $name => $value ) { |
|
2027 | - if ( $name == 'context' || empty($value) || $name == 'extra' ) {continue;} |
|
2026 | + foreach ($args as $name => $value) { |
|
2027 | + if ($name == 'context' || empty($value) || $name == 'extra') {continue; } |
|
2028 | 2028 | ?> |
2029 | 2029 | <input type="hidden" name="<?php echo $name; ?>" value = "<?php echo $value; ?>" /> |
2030 | 2030 | <?php |
2031 | 2031 | } |
2032 | 2032 | //setup nonce_url |
2033 | - wp_nonce_field($args['action'] . '_nonce', $args['action'] . '_nonce', false); |
|
2033 | + wp_nonce_field($args['action'].'_nonce', $args['action'].'_nonce', false); |
|
2034 | 2034 | ?> |
2035 | 2035 | <select name="context"> |
2036 | 2036 | <?php |
2037 | 2037 | $context_templates = $template_group_object->context_templates(); |
2038 | - if ( is_array($context_templates) ) : |
|
2039 | - foreach ( $context_templates as $context => $template_fields ) : |
|
2038 | + if (is_array($context_templates)) : |
|
2039 | + foreach ($context_templates as $context => $template_fields) : |
|
2040 | 2040 | $checked = ($context == $args['context']) ? 'selected="selected"' : ''; |
2041 | 2041 | ?> |
2042 | 2042 | <option value="<?php echo $context; ?>" <?php echo $checked; ?>> |
@@ -2044,7 +2044,7 @@ discard block |
||
2044 | 2044 | </option> |
2045 | 2045 | <?php endforeach; endif; ?> |
2046 | 2046 | </select> |
2047 | - <?php $button_text = sprintf( __('Switch %s', 'event_espresso'), ucwords($context_label['label']) ); ?> |
|
2047 | + <?php $button_text = sprintf(__('Switch %s', 'event_espresso'), ucwords($context_label['label'])); ?> |
|
2048 | 2048 | <input id="submit-msg-context-switcher-sbmt" class="button-secondary" type="submit" value="<?php echo $button_text; ?>"> |
2049 | 2049 | </form> |
2050 | 2050 | <?php echo $args['extra']; ?> |
@@ -2071,8 +2071,8 @@ discard block |
||
2071 | 2071 | * @return array |
2072 | 2072 | */ |
2073 | 2073 | protected function _set_message_template_column_values($index) { |
2074 | - if ( is_array($this->_req_data['MTP_template_fields'][$index]['content'] ) ) { |
|
2075 | - foreach ( $this->_req_data['MTP_template_fields'][$index]['content'] as $field => $value ) { |
|
2074 | + if (is_array($this->_req_data['MTP_template_fields'][$index]['content'])) { |
|
2075 | + foreach ($this->_req_data['MTP_template_fields'][$index]['content'] as $field => $value) { |
|
2076 | 2076 | $this->_req_data['MTP_template_fields'][$index]['content'][$field] = $value; |
2077 | 2077 | } |
2078 | 2078 | } /*else { |
@@ -2081,22 +2081,22 @@ discard block |
||
2081 | 2081 | |
2082 | 2082 | |
2083 | 2083 | $set_column_values = array( |
2084 | - 'MTP_ID' => absint( $this->_req_data[ 'MTP_template_fields' ][ $index ][ 'MTP_ID' ] ), |
|
2085 | - 'GRP_ID' => absint( $this->_req_data[ 'GRP_ID' ] ), |
|
2086 | - 'MTP_user_id' => absint( $this->_req_data[ 'MTP_user_id' ] ), |
|
2087 | - 'MTP_messenger' => strtolower( $this->_req_data[ 'MTP_messenger' ] ), |
|
2088 | - 'MTP_message_type' => strtolower( $this->_req_data[ 'MTP_message_type' ] ), |
|
2089 | - 'MTP_template_field' => strtolower( $this->_req_data[ 'MTP_template_fields' ][ $index ][ 'name' ] ), |
|
2090 | - 'MTP_context' => strtolower( $this->_req_data[ 'MTP_context' ] ), |
|
2091 | - 'MTP_content' => $this->_req_data[ 'MTP_template_fields' ][ $index ][ 'content' ], |
|
2092 | - 'MTP_is_global' => isset( $this->_req_data[ 'MTP_is_global' ] ) |
|
2093 | - ? absint( $this->_req_data[ 'MTP_is_global' ] ) |
|
2084 | + 'MTP_ID' => absint($this->_req_data['MTP_template_fields'][$index]['MTP_ID']), |
|
2085 | + 'GRP_ID' => absint($this->_req_data['GRP_ID']), |
|
2086 | + 'MTP_user_id' => absint($this->_req_data['MTP_user_id']), |
|
2087 | + 'MTP_messenger' => strtolower($this->_req_data['MTP_messenger']), |
|
2088 | + 'MTP_message_type' => strtolower($this->_req_data['MTP_message_type']), |
|
2089 | + 'MTP_template_field' => strtolower($this->_req_data['MTP_template_fields'][$index]['name']), |
|
2090 | + 'MTP_context' => strtolower($this->_req_data['MTP_context']), |
|
2091 | + 'MTP_content' => $this->_req_data['MTP_template_fields'][$index]['content'], |
|
2092 | + 'MTP_is_global' => isset($this->_req_data['MTP_is_global']) |
|
2093 | + ? absint($this->_req_data['MTP_is_global']) |
|
2094 | 2094 | : 0, |
2095 | - 'MTP_is_override' => isset( $this->_req_data[ 'MTP_is_override' ] ) |
|
2096 | - ? absint( $this->_req_data[ 'MTP_is_override' ] ) |
|
2095 | + 'MTP_is_override' => isset($this->_req_data['MTP_is_override']) |
|
2096 | + ? absint($this->_req_data['MTP_is_override']) |
|
2097 | 2097 | : 0, |
2098 | - 'MTP_deleted' => absint( $this->_req_data[ 'MTP_deleted' ] ), |
|
2099 | - 'MTP_is_active' => absint( $this->_req_data[ 'MTP_is_active' ] ) |
|
2098 | + 'MTP_deleted' => absint($this->_req_data['MTP_deleted']), |
|
2099 | + 'MTP_is_active' => absint($this->_req_data['MTP_is_active']) |
|
2100 | 2100 | ); |
2101 | 2101 | |
2102 | 2102 | |
@@ -2108,36 +2108,36 @@ discard block |
||
2108 | 2108 | |
2109 | 2109 | |
2110 | 2110 | |
2111 | - protected function _insert_or_update_message_template($new = false ) { |
|
2111 | + protected function _insert_or_update_message_template($new = false) { |
|
2112 | 2112 | |
2113 | - do_action ( 'AHEE_log', __FILE__, __FUNCTION__, ''); |
|
2113 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
2114 | 2114 | $success = 0; |
2115 | 2115 | $override = false; |
2116 | 2116 | |
2117 | 2117 | //setup notices description |
2118 | - $messenger = ! empty( $this->_req_data['MTP_messenger'] ) |
|
2119 | - ? ucwords( str_replace( '_', ' ', $this->_req_data['MTP_messenger'] ) ) |
|
2118 | + $messenger = ! empty($this->_req_data['MTP_messenger']) |
|
2119 | + ? ucwords(str_replace('_', ' ', $this->_req_data['MTP_messenger'])) |
|
2120 | 2120 | : false; |
2121 | 2121 | |
2122 | - $message_type = ! empty( $this->_req_data['MTP_message_type'] ) |
|
2123 | - ? ucwords( str_replace( '_', ' ', $this->_req_data['MTP_message_type'] ) ) |
|
2122 | + $message_type = ! empty($this->_req_data['MTP_message_type']) |
|
2123 | + ? ucwords(str_replace('_', ' ', $this->_req_data['MTP_message_type'])) |
|
2124 | 2124 | : false; |
2125 | 2125 | |
2126 | - $context = ! empty( $this->_req_data['MTP_context'] ) |
|
2127 | - ? ucwords( str_replace( '_', ' ', $this->_req_data['MTP_context'] ) ) |
|
2126 | + $context = ! empty($this->_req_data['MTP_context']) |
|
2127 | + ? ucwords(str_replace('_', ' ', $this->_req_data['MTP_context'])) |
|
2128 | 2128 | : false; |
2129 | 2129 | |
2130 | - $item_desc = $messenger ? $messenger . ' ' . $message_type . ' ' . $context . ' ' : ''; |
|
2130 | + $item_desc = $messenger ? $messenger.' '.$message_type.' '.$context.' ' : ''; |
|
2131 | 2131 | $item_desc .= 'Message Template'; |
2132 | 2132 | $query_args = array(); |
2133 | 2133 | $edit_array = array(); |
2134 | 2134 | $action_desc = ''; |
2135 | 2135 | |
2136 | 2136 | //if this is "new" then we need to generate the default contexts for the selected messenger/message_type for user to edit. |
2137 | - if ( $new ) { |
|
2138 | - $GRP_ID = !empty( $this->_req_data['GRP_ID'] ) ? $this->_req_data['GRP_ID'] : 0; |
|
2139 | - if ( $edit_array = $this->_generate_new_templates($messenger, $message_type, $GRP_ID ) ) { |
|
2140 | - if ( empty($edit_array) ) { |
|
2137 | + if ($new) { |
|
2138 | + $GRP_ID = ! empty($this->_req_data['GRP_ID']) ? $this->_req_data['GRP_ID'] : 0; |
|
2139 | + if ($edit_array = $this->_generate_new_templates($messenger, $message_type, $GRP_ID)) { |
|
2140 | + if (empty($edit_array)) { |
|
2141 | 2141 | $success = 0; |
2142 | 2142 | } else { |
2143 | 2143 | $success = 1; |
@@ -2156,7 +2156,7 @@ discard block |
||
2156 | 2156 | |
2157 | 2157 | |
2158 | 2158 | //run update for each template field in displayed context |
2159 | - if ( !isset($this->_req_data['MTP_template_fields']) && empty($this->_req_data['MTP_template_fields'] ) ) { |
|
2159 | + if ( ! isset($this->_req_data['MTP_template_fields']) && empty($this->_req_data['MTP_template_fields'])) { |
|
2160 | 2160 | EE_Error::add_error( |
2161 | 2161 | __('There was a problem saving the template fields from the form because I didn\'t receive any actual template field data.', 'event_espresso'), |
2162 | 2162 | __FILE__, __FUNCTION__, __LINE__ |
@@ -2165,25 +2165,25 @@ discard block |
||
2165 | 2165 | |
2166 | 2166 | } else { |
2167 | 2167 | //first validate all fields! |
2168 | - $validates = $MTPG->validate($this->_req_data['MTP_template_fields'], $this->_req_data['MTP_context'], $this->_req_data['MTP_messenger'], $this->_req_data['MTP_message_type']); |
|
2168 | + $validates = $MTPG->validate($this->_req_data['MTP_template_fields'], $this->_req_data['MTP_context'], $this->_req_data['MTP_messenger'], $this->_req_data['MTP_message_type']); |
|
2169 | 2169 | |
2170 | 2170 | //if $validate returned error messages (i.e. is_array()) then we need to process them and setup an appropriate response. HMM, dang this isn't correct, $validates will ALWAYS be an array. WE need to make sure there is no actual error messages in validates. |
2171 | - if ( is_array($validates) && !empty($validates) ) { |
|
2171 | + if (is_array($validates) && ! empty($validates)) { |
|
2172 | 2172 | //add the transient so when the form loads we know which fields to highlight |
2173 | - $this->_add_transient( 'edit_message_template', $validates ); |
|
2173 | + $this->_add_transient('edit_message_template', $validates); |
|
2174 | 2174 | |
2175 | 2175 | $success = 0; |
2176 | 2176 | |
2177 | 2177 | //setup notices |
2178 | - foreach ( $validates as $field => $error ) { |
|
2179 | - if ( isset($error['msg'] ) ) { |
|
2180 | - EE_Error::add_error( $error['msg'], __FILE__, __FUNCTION__, __LINE__ ); |
|
2178 | + foreach ($validates as $field => $error) { |
|
2179 | + if (isset($error['msg'])) { |
|
2180 | + EE_Error::add_error($error['msg'], __FILE__, __FUNCTION__, __LINE__); |
|
2181 | 2181 | } |
2182 | 2182 | } |
2183 | 2183 | |
2184 | 2184 | } else { |
2185 | 2185 | $set_column_values = array(); |
2186 | - foreach ( $this->_req_data['MTP_template_fields'] as $template_field => $content ) { |
|
2186 | + foreach ($this->_req_data['MTP_template_fields'] as $template_field => $content) { |
|
2187 | 2187 | $set_column_values = $this->_set_message_template_column_values($template_field); |
2188 | 2188 | |
2189 | 2189 | $where_cols_n_values = array( |
@@ -2196,11 +2196,11 @@ discard block |
||
2196 | 2196 | 'MTP_context' => $set_column_values['MTP_context'], |
2197 | 2197 | 'MTP_content' => $set_column_values['MTP_content'] |
2198 | 2198 | ); |
2199 | - if ( $updated = $MTP->update( $message_template_fields, array( $where_cols_n_values ) ) ) { |
|
2200 | - if ( $updated === false ) { |
|
2199 | + if ($updated = $MTP->update($message_template_fields, array($where_cols_n_values))) { |
|
2200 | + if ($updated === false) { |
|
2201 | 2201 | EE_Error::add_error( |
2202 | 2202 | sprintf( |
2203 | - __( '%s field was NOT updated for some reason', 'event_espresso' ), |
|
2203 | + __('%s field was NOT updated for some reason', 'event_espresso'), |
|
2204 | 2204 | $template_field |
2205 | 2205 | ), |
2206 | 2206 | __FILE__, __FUNCTION__, __LINE__ |
@@ -2214,46 +2214,46 @@ discard block |
||
2214 | 2214 | |
2215 | 2215 | //we can use the last set_column_values for the MTPG update (because its the same for all of these specific MTPs) |
2216 | 2216 | $mtpg_fields = array( |
2217 | - 'MTP_user_id' => $set_column_values[ 'MTP_user_id' ], |
|
2218 | - 'MTP_messenger' => $set_column_values[ 'MTP_messenger' ], |
|
2219 | - 'MTP_message_type' => $set_column_values[ 'MTP_message_type' ], |
|
2220 | - 'MTP_is_global' => $set_column_values[ 'MTP_is_global' ], |
|
2221 | - 'MTP_is_override' => $set_column_values[ 'MTP_is_override' ], |
|
2222 | - 'MTP_deleted' => $set_column_values[ 'MTP_deleted' ], |
|
2223 | - 'MTP_is_active' => $set_column_values[ 'MTP_is_active' ], |
|
2224 | - 'MTP_name' => ! empty( $this->_req_data[ 'ee_msg_non_global_fields' ][ 'MTP_name' ] ) |
|
2225 | - ? $this->_req_data[ 'ee_msg_non_global_fields' ][ 'MTP_name' ] |
|
2217 | + 'MTP_user_id' => $set_column_values['MTP_user_id'], |
|
2218 | + 'MTP_messenger' => $set_column_values['MTP_messenger'], |
|
2219 | + 'MTP_message_type' => $set_column_values['MTP_message_type'], |
|
2220 | + 'MTP_is_global' => $set_column_values['MTP_is_global'], |
|
2221 | + 'MTP_is_override' => $set_column_values['MTP_is_override'], |
|
2222 | + 'MTP_deleted' => $set_column_values['MTP_deleted'], |
|
2223 | + 'MTP_is_active' => $set_column_values['MTP_is_active'], |
|
2224 | + 'MTP_name' => ! empty($this->_req_data['ee_msg_non_global_fields']['MTP_name']) |
|
2225 | + ? $this->_req_data['ee_msg_non_global_fields']['MTP_name'] |
|
2226 | 2226 | : '', |
2227 | - 'MTP_description' => ! empty( $this->_req_data[ 'ee_msg_non_global_fields' ][ 'MTP_description' ] ) |
|
2228 | - ? $this->_req_data[ 'ee_msg_non_global_fields' ][ 'MTP_description' ] |
|
2227 | + 'MTP_description' => ! empty($this->_req_data['ee_msg_non_global_fields']['MTP_description']) |
|
2228 | + ? $this->_req_data['ee_msg_non_global_fields']['MTP_description'] |
|
2229 | 2229 | : '' |
2230 | 2230 | ); |
2231 | 2231 | |
2232 | - $mtpg_where = array('GRP_ID' => $set_column_values['GRP_ID'] ); |
|
2233 | - $updated = $MTPG->update( $mtpg_fields, array($mtpg_where) ); |
|
2232 | + $mtpg_where = array('GRP_ID' => $set_column_values['GRP_ID']); |
|
2233 | + $updated = $MTPG->update($mtpg_fields, array($mtpg_where)); |
|
2234 | 2234 | |
2235 | - if ( $updated === false ) { |
|
2235 | + if ($updated === false) { |
|
2236 | 2236 | EE_Error::add_error( |
2237 | 2237 | sprintf( |
2238 | - __( 'The Message Template Group (%d) was NOT updated for some reason', 'event_espresso' ), |
|
2239 | - $set_column_values[ 'GRP_ID' ] |
|
2238 | + __('The Message Template Group (%d) was NOT updated for some reason', 'event_espresso'), |
|
2239 | + $set_column_values['GRP_ID'] |
|
2240 | 2240 | ), |
2241 | 2241 | __FILE__, __FUNCTION__, __LINE__ |
2242 | 2242 | ); |
2243 | 2243 | } else { |
2244 | 2244 | //k now we need to ensure the template_pack and template_variation fields are set. |
2245 | - $template_pack = ! empty( $this->_req_data['MTP_template_pack' ] ) |
|
2245 | + $template_pack = ! empty($this->_req_data['MTP_template_pack']) |
|
2246 | 2246 | ? $this->_req_data['MTP_template_pack'] |
2247 | 2247 | : 'default'; |
2248 | 2248 | |
2249 | - $template_variation = ! empty( $this->_req_data['MTP_template_variation'] ) |
|
2249 | + $template_variation = ! empty($this->_req_data['MTP_template_variation']) |
|
2250 | 2250 | ? $this->_req_data['MTP_template_variation'] |
2251 | 2251 | : 'default'; |
2252 | 2252 | |
2253 | - $mtpg_obj = $MTPG->get_one_by_ID( $set_column_values['GRP_ID'] ); |
|
2254 | - if ( $mtpg_obj instanceof EE_Message_Template_Group ) { |
|
2255 | - $mtpg_obj->set_template_pack_name( $template_pack ); |
|
2256 | - $mtpg_obj->set_template_pack_variation( $template_variation ); |
|
2253 | + $mtpg_obj = $MTPG->get_one_by_ID($set_column_values['GRP_ID']); |
|
2254 | + if ($mtpg_obj instanceof EE_Message_Template_Group) { |
|
2255 | + $mtpg_obj->set_template_pack_name($template_pack); |
|
2256 | + $mtpg_obj->set_template_pack_variation($template_variation); |
|
2257 | 2257 | } |
2258 | 2258 | $success = 1; |
2259 | 2259 | } |
@@ -2263,7 +2263,7 @@ discard block |
||
2263 | 2263 | } |
2264 | 2264 | |
2265 | 2265 | //we return things differently if doing ajax |
2266 | - if ( defined('DOING_AJAX') && DOING_AJAX ) { |
|
2266 | + if (defined('DOING_AJAX') && DOING_AJAX) { |
|
2267 | 2267 | $this->_template_args['success'] = $success; |
2268 | 2268 | $this->_template_args['error'] = ! $success ? true : false; |
2269 | 2269 | $this->_template_args['content'] = ''; |
@@ -2271,9 +2271,9 @@ discard block |
||
2271 | 2271 | 'grpID' => $edit_array['GRP_ID'], |
2272 | 2272 | 'templateName' => $edit_array['template_name'] |
2273 | 2273 | ); |
2274 | - if ( $success ) { |
|
2274 | + if ($success) { |
|
2275 | 2275 | EE_Error::overwrite_success(); |
2276 | - EE_Error::add_success( __('The new template has been created and automatically selected for this event. You can edit the new template by clicking the edit button. Note before this template is assigned to this event, the event must be saved.', 'event_espresso') ); |
|
2276 | + EE_Error::add_success(__('The new template has been created and automatically selected for this event. You can edit the new template by clicking the edit button. Note before this template is assigned to this event, the event must be saved.', 'event_espresso')); |
|
2277 | 2277 | } |
2278 | 2278 | |
2279 | 2279 | $this->_return_json(); |
@@ -2281,13 +2281,13 @@ discard block |
||
2281 | 2281 | |
2282 | 2282 | |
2283 | 2283 | //was a test send triggered? |
2284 | - if ( isset( $this->_req_data['test_button'] ) ) { |
|
2284 | + if (isset($this->_req_data['test_button'])) { |
|
2285 | 2285 | EE_Error::overwrite_success(); |
2286 | - $this->_do_test_send( $this->_req_data['MTP_context'], $this->_req_data['MTP_messenger'], $this->_req_data['MTP_message_type'] ); |
|
2286 | + $this->_do_test_send($this->_req_data['MTP_context'], $this->_req_data['MTP_messenger'], $this->_req_data['MTP_message_type']); |
|
2287 | 2287 | $override = true; |
2288 | 2288 | } |
2289 | 2289 | |
2290 | - if ( empty( $query_args ) ) { |
|
2290 | + if (empty($query_args)) { |
|
2291 | 2291 | $query_args = array( |
2292 | 2292 | 'id' => $this->_req_data['GRP_ID'], |
2293 | 2293 | 'context' => $this->_req_data['MTP_context'], |
@@ -2295,7 +2295,7 @@ discard block |
||
2295 | 2295 | ); |
2296 | 2296 | } |
2297 | 2297 | |
2298 | - $this->_redirect_after_action( $success, $item_desc, $action_desc, $query_args, $override ); |
|
2298 | + $this->_redirect_after_action($success, $item_desc, $action_desc, $query_args, $override); |
|
2299 | 2299 | } |
2300 | 2300 | |
2301 | 2301 | |
@@ -2309,28 +2309,28 @@ discard block |
||
2309 | 2309 | * @param string $message_type message type being tested |
2310 | 2310 | * |
2311 | 2311 | */ |
2312 | - protected function _do_test_send( $context, $messenger, $message_type ) { |
|
2312 | + protected function _do_test_send($context, $messenger, $message_type) { |
|
2313 | 2313 | //set things up for preview |
2314 | 2314 | $this->_req_data['messenger'] = $messenger; |
2315 | 2315 | $this->_req_data['message_type'] = $message_type; |
2316 | 2316 | $this->_req_data['context'] = $context; |
2317 | - $this->_req_data['GRP_ID'] = isset($this->_req_data['GRP_ID'] ) ? $this->_req_data['GRP_ID'] : ''; |
|
2318 | - $active_messenger = $this->_message_resource_manager->get_active_messenger( $messenger ); |
|
2317 | + $this->_req_data['GRP_ID'] = isset($this->_req_data['GRP_ID']) ? $this->_req_data['GRP_ID'] : ''; |
|
2318 | + $active_messenger = $this->_message_resource_manager->get_active_messenger($messenger); |
|
2319 | 2319 | |
2320 | 2320 | //let's save any existing fields that might be required by the messenger |
2321 | 2321 | if ( |
2322 | - isset( $this->_req_data['test_settings_fld'] ) |
|
2322 | + isset($this->_req_data['test_settings_fld']) |
|
2323 | 2323 | && $active_messenger instanceof EE_messenger |
2324 | 2324 | ) { |
2325 | - $active_messenger->set_existing_test_settings( $this->_req_data['test_settings_fld'] ); |
|
2325 | + $active_messenger->set_existing_test_settings($this->_req_data['test_settings_fld']); |
|
2326 | 2326 | } |
2327 | 2327 | |
2328 | 2328 | $success = $this->_preview_message(true); |
2329 | 2329 | |
2330 | - if ( $success ) { |
|
2331 | - EE_Error::add_success( __('Test message sent', 'event_espresso') ); |
|
2330 | + if ($success) { |
|
2331 | + EE_Error::add_success(__('Test message sent', 'event_espresso')); |
|
2332 | 2332 | } else { |
2333 | - EE_Error::add_error( __('The test message was not sent', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
2333 | + EE_Error::add_error(__('The test message was not sent', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
2334 | 2334 | } |
2335 | 2335 | } |
2336 | 2336 | |
@@ -2356,11 +2356,11 @@ discard block |
||
2356 | 2356 | protected function _generate_new_templates($messenger, $message_types, $GRP_ID = 0, $global = false) { |
2357 | 2357 | |
2358 | 2358 | //if no $message_types are given then that's okay... this may be a messenger that just adds shortcodes, so we just don't generate any templates. |
2359 | - if ( empty( $message_types ) ) { |
|
2359 | + if (empty($message_types)) { |
|
2360 | 2360 | return true; |
2361 | 2361 | } |
2362 | 2362 | |
2363 | - return EEH_MSG_Template::generate_new_templates( $messenger, $message_types, $GRP_ID, $global ); |
|
2363 | + return EEH_MSG_Template::generate_new_templates($messenger, $message_types, $GRP_ID, $global); |
|
2364 | 2364 | } |
2365 | 2365 | |
2366 | 2366 | |
@@ -2376,33 +2376,33 @@ discard block |
||
2376 | 2376 | * |
2377 | 2377 | * @return void |
2378 | 2378 | */ |
2379 | - protected function _trash_or_restore_message_template($trash = true, $all = false ) { |
|
2380 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
2379 | + protected function _trash_or_restore_message_template($trash = true, $all = false) { |
|
2380 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
2381 | 2381 | $MTP = EEM_Message_Template_Group::instance(); |
2382 | 2382 | |
2383 | 2383 | $success = 1; |
2384 | 2384 | |
2385 | 2385 | //incoming GRP_IDs |
2386 | - if ( $all ) { |
|
2386 | + if ($all) { |
|
2387 | 2387 | //Checkboxes |
2388 | - if ( !empty( $this->_req_data['checkbox'] ) && is_array($this->_req_data['checkbox'] ) ) { |
|
2388 | + if ( ! empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) { |
|
2389 | 2389 | //if array has more than one element then success message should be plural. |
2390 | 2390 | //todo: what about nonce? |
2391 | - $success = count( $this->_req_data['checkbox'] ) > 1 ? 2 : 1; |
|
2391 | + $success = count($this->_req_data['checkbox']) > 1 ? 2 : 1; |
|
2392 | 2392 | |
2393 | 2393 | //cycle through checkboxes |
2394 | - while ( list( $GRP_ID, $value ) = each ($this->_req_data['checkbox']) ) { |
|
2395 | - $trashed_or_restored = $trash ? $MTP->delete_by_ID( $GRP_ID ) : $MTP->restore_by_ID( $GRP_ID ); |
|
2396 | - if ( ! $trashed_or_restored ) { |
|
2394 | + while (list($GRP_ID, $value) = each($this->_req_data['checkbox'])) { |
|
2395 | + $trashed_or_restored = $trash ? $MTP->delete_by_ID($GRP_ID) : $MTP->restore_by_ID($GRP_ID); |
|
2396 | + if ( ! $trashed_or_restored) { |
|
2397 | 2397 | $success = 0; |
2398 | 2398 | } |
2399 | 2399 | } |
2400 | 2400 | } else { |
2401 | 2401 | //grab single GRP_ID and handle |
2402 | - $GRP_ID = isset( $this->_req_data['id'] ) ? absint($this->_req_data['id']) : 0; |
|
2403 | - if ( ! empty( $GRP_ID ) ) { |
|
2404 | - $trashed_or_restored = $trash ? $MTP->delete_by_ID( $GRP_ID ) : $MTP->restore_by_ID( $GRP_ID ); |
|
2405 | - if ( ! $trashed_or_restored ) { |
|
2402 | + $GRP_ID = isset($this->_req_data['id']) ? absint($this->_req_data['id']) : 0; |
|
2403 | + if ( ! empty($GRP_ID)) { |
|
2404 | + $trashed_or_restored = $trash ? $MTP->delete_by_ID($GRP_ID) : $MTP->restore_by_ID($GRP_ID); |
|
2405 | + if ( ! $trashed_or_restored) { |
|
2406 | 2406 | $success = 0; |
2407 | 2407 | } |
2408 | 2408 | } else { |
@@ -2414,13 +2414,13 @@ discard block |
||
2414 | 2414 | |
2415 | 2415 | $action_desc = $trash ? __('moved to the trash', 'event_espresso') : __('restored', 'event_espresso'); |
2416 | 2416 | |
2417 | - $action_desc = !empty( $this->_req_data['template_switch'] ) ? __('switched') : $action_desc; |
|
2417 | + $action_desc = ! empty($this->_req_data['template_switch']) ? __('switched') : $action_desc; |
|
2418 | 2418 | |
2419 | 2419 | $item_desc = $all ? _n('Message Template Group', 'Message Template Groups', $success, 'event_espresso') : _n('Message Template Context', 'Message Template Contexts', $success, 'event_espresso'); |
2420 | 2420 | |
2421 | - $item_desc = !empty( $this->_req_data['template_switch'] ) ? _n('template', 'templates', $success, 'event_espresso') : $item_desc; |
|
2421 | + $item_desc = ! empty($this->_req_data['template_switch']) ? _n('template', 'templates', $success, 'event_espresso') : $item_desc; |
|
2422 | 2422 | |
2423 | - $this->_redirect_after_action( $success, $item_desc, $action_desc, array() ); |
|
2423 | + $this->_redirect_after_action($success, $item_desc, $action_desc, array()); |
|
2424 | 2424 | |
2425 | 2425 | } |
2426 | 2426 | |
@@ -2436,24 +2436,24 @@ discard block |
||
2436 | 2436 | * @return void |
2437 | 2437 | */ |
2438 | 2438 | protected function _delete_message_template() { |
2439 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
2439 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
2440 | 2440 | |
2441 | 2441 | //checkboxes |
2442 | - if ( !empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'] ) ) { |
|
2442 | + if ( ! empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) { |
|
2443 | 2443 | //if array has more than one element then success message should be plural |
2444 | - $success = count( $this->_req_data['checkbox'] ) > 1 ? 2 : 1; |
|
2444 | + $success = count($this->_req_data['checkbox']) > 1 ? 2 : 1; |
|
2445 | 2445 | |
2446 | 2446 | //cycle through bulk action checkboxes |
2447 | - while ( list( $GRP_ID, $value ) = each($this->_req_data['checkbox'] ) ) { |
|
2448 | - $success = $this->_delete_mtp_permanently( $GRP_ID ); |
|
2447 | + while (list($GRP_ID, $value) = each($this->_req_data['checkbox'])) { |
|
2448 | + $success = $this->_delete_mtp_permanently($GRP_ID); |
|
2449 | 2449 | } |
2450 | 2450 | } else { |
2451 | 2451 | //grab single grp_id and delete |
2452 | - $GRP_ID = absint($this->_req_data['id'] ); |
|
2453 | - $success = $this->_delete_mtp_permanently( $GRP_ID ); |
|
2452 | + $GRP_ID = absint($this->_req_data['id']); |
|
2453 | + $success = $this->_delete_mtp_permanently($GRP_ID); |
|
2454 | 2454 | } |
2455 | 2455 | |
2456 | - $this->_redirect_after_action( $success, 'Message Templates', 'deleted', array() ); |
|
2456 | + $this->_redirect_after_action($success, 'Message Templates', 'deleted', array()); |
|
2457 | 2457 | |
2458 | 2458 | } |
2459 | 2459 | |
@@ -2468,20 +2468,20 @@ discard block |
||
2468 | 2468 | * |
2469 | 2469 | * @return bool boolean to indicate the success of the deletes or not. |
2470 | 2470 | */ |
2471 | - private function _delete_mtp_permanently( $GRP_ID, $include_group = true ) { |
|
2471 | + private function _delete_mtp_permanently($GRP_ID, $include_group = true) { |
|
2472 | 2472 | $success = 1; |
2473 | 2473 | $MTPG = EEM_Message_Template_Group::instance(); |
2474 | 2474 | //first let's GET this group |
2475 | - $MTG = $MTPG->get_one_by_ID( $GRP_ID ); |
|
2475 | + $MTG = $MTPG->get_one_by_ID($GRP_ID); |
|
2476 | 2476 | //then delete permanently all the related Message Templates |
2477 | - $deleted = $MTG->delete_related_permanently( 'Message_Template' ); |
|
2477 | + $deleted = $MTG->delete_related_permanently('Message_Template'); |
|
2478 | 2478 | |
2479 | - if ( $deleted === 0 ) |
|
2480 | - {$success = 0;} |
|
2479 | + if ($deleted === 0) |
|
2480 | + {$success = 0; } |
|
2481 | 2481 | |
2482 | 2482 | //now delete permanently this particular group |
2483 | 2483 | |
2484 | - if ( $include_group && ! $MTG->delete_permanently() ) { |
|
2484 | + if ($include_group && ! $MTG->delete_permanently()) { |
|
2485 | 2485 | $success = 0; |
2486 | 2486 | } |
2487 | 2487 | return $success; |
@@ -2499,7 +2499,7 @@ discard block |
||
2499 | 2499 | * @return string |
2500 | 2500 | */ |
2501 | 2501 | protected function _learn_more_about_message_templates_link() { |
2502 | - return '<a class="hidden" style="margin:0 20px; cursor:pointer; font-size:12px;" >' . __('learn more about how message templates works', 'event_espresso') . '</a>'; |
|
2502 | + return '<a class="hidden" style="margin:0 20px; cursor:pointer; font-size:12px;" >'.__('learn more about how message templates works', 'event_espresso').'</a>'; |
|
2503 | 2503 | } |
2504 | 2504 | |
2505 | 2505 | |
@@ -2517,10 +2517,10 @@ discard block |
||
2517 | 2517 | |
2518 | 2518 | $this->_set_m_mt_settings(); |
2519 | 2519 | |
2520 | - $selected_messenger = isset( $this->_req_data['selected_messenger'] ) ? $this->_req_data['selected_messenger'] : 'email'; |
|
2520 | + $selected_messenger = isset($this->_req_data['selected_messenger']) ? $this->_req_data['selected_messenger'] : 'email'; |
|
2521 | 2521 | |
2522 | 2522 | //let's setup the messenger tabs |
2523 | - $this->_template_args['admin_page_header'] = EEH_Tabbed_Content::tab_text_links( $this->_m_mt_settings['messenger_tabs'], 'messenger_links', '|', $selected_messenger ); |
|
2523 | + $this->_template_args['admin_page_header'] = EEH_Tabbed_Content::tab_text_links($this->_m_mt_settings['messenger_tabs'], 'messenger_links', '|', $selected_messenger); |
|
2524 | 2524 | $this->_template_args['before_admin_page_content'] = '<div class="ui-widget ui-helper-clearfix">'; |
2525 | 2525 | $this->_template_args['after_admin_page_content'] = '</div><!-- end .ui-widget -->'; |
2526 | 2526 | |
@@ -2539,7 +2539,7 @@ discard block |
||
2539 | 2539 | */ |
2540 | 2540 | protected function _set_m_mt_settings() { |
2541 | 2541 | //first if this is already set then lets get out no need to regenerate data. |
2542 | - if ( !empty($this->_m_mt_settings) ) { |
|
2542 | + if ( ! empty($this->_m_mt_settings)) { |
|
2543 | 2543 | return; |
2544 | 2544 | } |
2545 | 2545 | |
@@ -2554,10 +2554,10 @@ discard block |
||
2554 | 2554 | |
2555 | 2555 | //assemble the array for the _tab_text_links helper |
2556 | 2556 | |
2557 | - foreach ( $messengers as $messenger ) { |
|
2557 | + foreach ($messengers as $messenger) { |
|
2558 | 2558 | $this->_m_mt_settings['messenger_tabs'][$messenger->name] = array( |
2559 | 2559 | 'label' => ucwords($messenger->label['singular']), |
2560 | - 'class' => $this->_message_resource_manager->is_messenger_active( $messenger->name ) ? 'messenger-active' : '', |
|
2560 | + 'class' => $this->_message_resource_manager->is_messenger_active($messenger->name) ? 'messenger-active' : '', |
|
2561 | 2561 | 'href' => $messenger->name, |
2562 | 2562 | 'title' => __('Modify this Messenger', 'event_espresso'), |
2563 | 2563 | 'slug' => $messenger->name, |
@@ -2567,26 +2567,26 @@ discard block |
||
2567 | 2567 | |
2568 | 2568 | $message_types_for_messenger = $messenger->get_valid_message_types(); |
2569 | 2569 | |
2570 | - foreach ( $message_types as $message_type ) { |
|
2570 | + foreach ($message_types as $message_type) { |
|
2571 | 2571 | //first we need to verify that this message type is valid with this messenger. Cause if it isn't then it shouldn't show in either the inactive OR active metabox. |
2572 | - if ( ! in_array( $message_type->name, $message_types_for_messenger ) ) { |
|
2572 | + if ( ! in_array($message_type->name, $message_types_for_messenger)) { |
|
2573 | 2573 | continue; |
2574 | 2574 | } |
2575 | 2575 | |
2576 | - $a_or_i = $this->_message_resource_manager->is_message_type_active_for_messenger( $messenger->name, $message_type->name ) ? 'active' : 'inactive'; |
|
2576 | + $a_or_i = $this->_message_resource_manager->is_message_type_active_for_messenger($messenger->name, $message_type->name) ? 'active' : 'inactive'; |
|
2577 | 2577 | |
2578 | 2578 | $this->_m_mt_settings['message_type_tabs'][$messenger->name][$a_or_i][$message_type->name] = array( |
2579 | - 'label' => ucwords( $message_type->label[ 'singular' ] ), |
|
2580 | - 'class' => 'message-type-' . $a_or_i, |
|
2581 | - 'slug_id' => $message_type->name . '-messagetype-' . $messenger->name, |
|
2582 | - 'mt_nonce' => wp_create_nonce( $message_type->name . '_nonce' ), |
|
2583 | - 'href' => 'espresso_' . $message_type->name . '_message_type_settings', |
|
2579 | + 'label' => ucwords($message_type->label['singular']), |
|
2580 | + 'class' => 'message-type-'.$a_or_i, |
|
2581 | + 'slug_id' => $message_type->name.'-messagetype-'.$messenger->name, |
|
2582 | + 'mt_nonce' => wp_create_nonce($message_type->name.'_nonce'), |
|
2583 | + 'href' => 'espresso_'.$message_type->name.'_message_type_settings', |
|
2584 | 2584 | 'title' => $a_or_i == 'active' |
2585 | - ? __( 'Drag this message type to the Inactive window to deactivate', 'event_espresso' ) |
|
2586 | - : __( 'Drag this message type to the messenger to activate', 'event_espresso' ), |
|
2585 | + ? __('Drag this message type to the Inactive window to deactivate', 'event_espresso') |
|
2586 | + : __('Drag this message type to the messenger to activate', 'event_espresso'), |
|
2587 | 2587 | 'content' => $a_or_i == 'active' |
2588 | - ? $this->_message_type_settings_content( $message_type, $messenger, true ) |
|
2589 | - : $this->_message_type_settings_content( $message_type, $messenger ), |
|
2588 | + ? $this->_message_type_settings_content($message_type, $messenger, true) |
|
2589 | + : $this->_message_type_settings_content($message_type, $messenger), |
|
2590 | 2590 | 'slug' => $message_type->name, |
2591 | 2591 | 'active' => $a_or_i == 'active' ? true : false, |
2592 | 2592 | 'obj' => $message_type |
@@ -2605,34 +2605,34 @@ discard block |
||
2605 | 2605 | * |
2606 | 2606 | * @return string html output for the content |
2607 | 2607 | */ |
2608 | - protected function _message_type_settings_content( $message_type, $messenger, $active = false ) { |
|
2608 | + protected function _message_type_settings_content($message_type, $messenger, $active = false) { |
|
2609 | 2609 | //get message type fields |
2610 | 2610 | $fields = $message_type->get_admin_settings_fields(); |
2611 | - $settings_template_args['template_form_fields']= ''; |
|
2611 | + $settings_template_args['template_form_fields'] = ''; |
|
2612 | 2612 | |
2613 | - if ( !empty( $fields ) && $active ) { |
|
2613 | + if ( ! empty($fields) && $active) { |
|
2614 | 2614 | |
2615 | - $existing_settings = $message_type->get_existing_admin_settings( $messenger->name ); |
|
2615 | + $existing_settings = $message_type->get_existing_admin_settings($messenger->name); |
|
2616 | 2616 | |
2617 | - foreach( $fields as $fldname => $fldprops ) { |
|
2618 | - $field_id = $messenger->name . '-' . $message_type->name . '-' . $fldname; |
|
2617 | + foreach ($fields as $fldname => $fldprops) { |
|
2618 | + $field_id = $messenger->name.'-'.$message_type->name.'-'.$fldname; |
|
2619 | 2619 | $template_form_field[$field_id] = array( |
2620 | - 'name' => 'message_type_settings[' . $fldname . ']', |
|
2620 | + 'name' => 'message_type_settings['.$fldname.']', |
|
2621 | 2621 | 'label' => $fldprops['label'], |
2622 | 2622 | 'input' => $fldprops['field_type'], |
2623 | 2623 | 'type' => $fldprops['value_type'], |
2624 | 2624 | 'required' => $fldprops['required'], |
2625 | 2625 | 'validation' => $fldprops['validation'], |
2626 | - 'value' => isset( $existing_settings[$fldname]) ? $existing_settings[$fldname] : $fldprops['default'], |
|
2627 | - 'options' => isset( $fldprops['options'] ) ? $fldprops['options'] : array(), |
|
2628 | - 'default' => isset( $existing_settings[$fldname] ) ? $existing_settings[$fldname] : $fldprops['default'], |
|
2626 | + 'value' => isset($existing_settings[$fldname]) ? $existing_settings[$fldname] : $fldprops['default'], |
|
2627 | + 'options' => isset($fldprops['options']) ? $fldprops['options'] : array(), |
|
2628 | + 'default' => isset($existing_settings[$fldname]) ? $existing_settings[$fldname] : $fldprops['default'], |
|
2629 | 2629 | 'css_class' => 'no-drag', |
2630 | 2630 | 'format' => $fldprops['format'] |
2631 | 2631 | ); |
2632 | 2632 | } |
2633 | 2633 | |
2634 | 2634 | |
2635 | - $settings_template_args['template_form_fields'] = !empty($template_form_field) ? $this->_generate_admin_form_fields( $template_form_field, 'string', 'ee_mt_activate_form' ) : ''; |
|
2635 | + $settings_template_args['template_form_fields'] = ! empty($template_form_field) ? $this->_generate_admin_form_fields($template_form_field, 'string', 'ee_mt_activate_form') : ''; |
|
2636 | 2636 | } |
2637 | 2637 | |
2638 | 2638 | $settings_template_args['description'] = $message_type->description; |
@@ -2652,13 +2652,13 @@ discard block |
||
2652 | 2652 | ) |
2653 | 2653 | ); |
2654 | 2654 | |
2655 | - $settings_template_args['hidden_fields'] = $this->_generate_admin_form_fields( $settings_template_args['hidden_fields'], 'array' ); |
|
2656 | - $settings_template_args['show_form'] = empty( $settings_template_args['template_form_fields'] ) ? ' hidden' : ''; |
|
2655 | + $settings_template_args['hidden_fields'] = $this->_generate_admin_form_fields($settings_template_args['hidden_fields'], 'array'); |
|
2656 | + $settings_template_args['show_form'] = empty($settings_template_args['template_form_fields']) ? ' hidden' : ''; |
|
2657 | 2657 | |
2658 | 2658 | |
2659 | 2659 | |
2660 | - $template = EE_MSG_TEMPLATE_PATH . 'ee_msg_mt_settings_content.template.php'; |
|
2661 | - $content = EEH_Template::display_template( $template, $settings_template_args, true ); |
|
2660 | + $template = EE_MSG_TEMPLATE_PATH.'ee_msg_mt_settings_content.template.php'; |
|
2661 | + $content = EEH_Template::display_template($template, $settings_template_args, true); |
|
2662 | 2662 | return $content; |
2663 | 2663 | } |
2664 | 2664 | |
@@ -2675,27 +2675,27 @@ discard block |
||
2675 | 2675 | $m_boxes = $mt_boxes = array(); |
2676 | 2676 | $m_template_args = $mt_template_args = array(); |
2677 | 2677 | |
2678 | - $selected_messenger = isset( $this->_req_data['selected_messenger'] ) ? $this->_req_data['selected_messenger'] : 'email'; |
|
2678 | + $selected_messenger = isset($this->_req_data['selected_messenger']) ? $this->_req_data['selected_messenger'] : 'email'; |
|
2679 | 2679 | |
2680 | - if ( isset( $this->_m_mt_settings[ 'messenger_tabs' ] ) ) { |
|
2681 | - foreach ( $this->_m_mt_settings[ 'messenger_tabs' ] as $messenger => $tab_array ) { |
|
2682 | - $hide_on_message = $this->_message_resource_manager->is_messenger_active( $messenger ) ? '' : 'hidden'; |
|
2683 | - $hide_off_message = $this->_message_resource_manager->is_messenger_active( $messenger ) ? 'hidden' : ''; |
|
2680 | + if (isset($this->_m_mt_settings['messenger_tabs'])) { |
|
2681 | + foreach ($this->_m_mt_settings['messenger_tabs'] as $messenger => $tab_array) { |
|
2682 | + $hide_on_message = $this->_message_resource_manager->is_messenger_active($messenger) ? '' : 'hidden'; |
|
2683 | + $hide_off_message = $this->_message_resource_manager->is_messenger_active($messenger) ? 'hidden' : ''; |
|
2684 | 2684 | //messenger meta boxes |
2685 | 2685 | $active = $selected_messenger == $messenger ? true : false; |
2686 | - $active_mt_tabs = isset( $this->_m_mt_settings[ 'message_type_tabs' ][ $messenger ][ 'active' ] ) |
|
2687 | - ? $this->_m_mt_settings[ 'message_type_tabs' ][ $messenger ][ 'active' ] |
|
2686 | + $active_mt_tabs = isset($this->_m_mt_settings['message_type_tabs'][$messenger]['active']) |
|
2687 | + ? $this->_m_mt_settings['message_type_tabs'][$messenger]['active'] |
|
2688 | 2688 | : ''; |
2689 | - $m_boxes[ $messenger . '_a_box' ] = sprintf( |
|
2690 | - __( '%s Settings', 'event_espresso' ), |
|
2691 | - $tab_array[ 'label' ] |
|
2689 | + $m_boxes[$messenger.'_a_box'] = sprintf( |
|
2690 | + __('%s Settings', 'event_espresso'), |
|
2691 | + $tab_array['label'] |
|
2692 | 2692 | ); |
2693 | - $m_template_args[ $messenger . '_a_box' ] = array( |
|
2694 | - 'active_message_types' => ! empty( $active_mt_tabs ) ? $this->_get_mt_tabs( $active_mt_tabs ) : '', |
|
2695 | - 'inactive_message_types' => isset( $this->_m_mt_settings[ 'message_type_tabs' ][ $messenger ][ 'inactive' ] ) |
|
2696 | - ? $this->_get_mt_tabs( $this->_m_mt_settings[ 'message_type_tabs' ][ $messenger ][ 'inactive' ] ) |
|
2693 | + $m_template_args[$messenger.'_a_box'] = array( |
|
2694 | + 'active_message_types' => ! empty($active_mt_tabs) ? $this->_get_mt_tabs($active_mt_tabs) : '', |
|
2695 | + 'inactive_message_types' => isset($this->_m_mt_settings['message_type_tabs'][$messenger]['inactive']) |
|
2696 | + ? $this->_get_mt_tabs($this->_m_mt_settings['message_type_tabs'][$messenger]['inactive']) |
|
2697 | 2697 | : '', |
2698 | - 'content' => $this->_get_messenger_box_content( $tab_array[ 'obj' ] ), |
|
2698 | + 'content' => $this->_get_messenger_box_content($tab_array['obj']), |
|
2699 | 2699 | 'hidden' => $active ? '' : ' hidden', |
2700 | 2700 | 'hide_on_message' => $hide_on_message, |
2701 | 2701 | 'messenger' => $messenger, |
@@ -2704,11 +2704,11 @@ discard block |
||
2704 | 2704 | // message type meta boxes |
2705 | 2705 | // (which is really just the inactive container for each messenger |
2706 | 2706 | // showing inactive message types for that messenger) |
2707 | - $mt_boxes[ $messenger . '_i_box' ] = __( 'Inactive Message Types', 'event_espresso' ); |
|
2708 | - $mt_template_args[ $messenger . '_i_box' ] = array( |
|
2709 | - 'active_message_types' => ! empty( $active_mt_tabs ) ? $this->_get_mt_tabs( $active_mt_tabs ) : '', |
|
2710 | - 'inactive_message_types' => isset( $this->_m_mt_settings[ 'message_type_tabs' ][ $messenger ][ 'inactive' ] ) |
|
2711 | - ? $this->_get_mt_tabs( $this->_m_mt_settings[ 'message_type_tabs' ][ $messenger ][ 'inactive' ] ) |
|
2707 | + $mt_boxes[$messenger.'_i_box'] = __('Inactive Message Types', 'event_espresso'); |
|
2708 | + $mt_template_args[$messenger.'_i_box'] = array( |
|
2709 | + 'active_message_types' => ! empty($active_mt_tabs) ? $this->_get_mt_tabs($active_mt_tabs) : '', |
|
2710 | + 'inactive_message_types' => isset($this->_m_mt_settings['message_type_tabs'][$messenger]['inactive']) |
|
2711 | + ? $this->_get_mt_tabs($this->_m_mt_settings['message_type_tabs'][$messenger]['inactive']) |
|
2712 | 2712 | : '', |
2713 | 2713 | 'hidden' => $active ? '' : ' hidden', |
2714 | 2714 | 'hide_on_message' => $hide_on_message, |
@@ -2721,12 +2721,12 @@ discard block |
||
2721 | 2721 | |
2722 | 2722 | |
2723 | 2723 | //register messenger metaboxes |
2724 | - $m_template_path = EE_MSG_TEMPLATE_PATH . 'ee_msg_details_messenger_mt_meta_box.template.php'; |
|
2725 | - foreach ( $m_boxes as $box => $label ) { |
|
2726 | - $callback_args = array( 'template_path' => $m_template_path, 'template_args' => $m_template_args[$box] ); |
|
2727 | - $msgr = str_replace( '_a_box', '', $box ); |
|
2724 | + $m_template_path = EE_MSG_TEMPLATE_PATH.'ee_msg_details_messenger_mt_meta_box.template.php'; |
|
2725 | + foreach ($m_boxes as $box => $label) { |
|
2726 | + $callback_args = array('template_path' => $m_template_path, 'template_args' => $m_template_args[$box]); |
|
2727 | + $msgr = str_replace('_a_box', '', $box); |
|
2728 | 2728 | add_meta_box( |
2729 | - 'espresso_' . $msgr . '_settings', |
|
2729 | + 'espresso_'.$msgr.'_settings', |
|
2730 | 2730 | $label, |
2731 | 2731 | create_function( |
2732 | 2732 | '$post, $metabox', |
@@ -2740,14 +2740,14 @@ discard block |
||
2740 | 2740 | } |
2741 | 2741 | |
2742 | 2742 | //register message type metaboxes |
2743 | - $mt_template_path = EE_MSG_TEMPLATE_PATH . 'ee_msg_details_messenger_meta_box.template.php'; |
|
2744 | - foreach ( $mt_boxes as $box => $label ) { |
|
2743 | + $mt_template_path = EE_MSG_TEMPLATE_PATH.'ee_msg_details_messenger_meta_box.template.php'; |
|
2744 | + foreach ($mt_boxes as $box => $label) { |
|
2745 | 2745 | $callback_args = array( |
2746 | - 'template_path' => $mt_template_path, 'template_args' => $mt_template_args[ $box ] |
|
2746 | + 'template_path' => $mt_template_path, 'template_args' => $mt_template_args[$box] |
|
2747 | 2747 | ); |
2748 | - $mt = str_replace( '_i_box', '', $box ); |
|
2748 | + $mt = str_replace('_i_box', '', $box); |
|
2749 | 2749 | add_meta_box( |
2750 | - 'espresso_' . $mt . '_inactive_mts', |
|
2750 | + 'espresso_'.$mt.'_inactive_mts', |
|
2751 | 2751 | $label, |
2752 | 2752 | create_function( |
2753 | 2753 | '$post, $metabox', |
@@ -2770,13 +2770,13 @@ discard block |
||
2770 | 2770 | * |
2771 | 2771 | * @return string html formatted tabs |
2772 | 2772 | */ |
2773 | - protected function _get_mt_tabs( $tab_array ) { |
|
2773 | + protected function _get_mt_tabs($tab_array) { |
|
2774 | 2774 | $tab_array = (array) $tab_array; |
2775 | - $template = EE_MSG_TEMPLATE_PATH . 'ee_msg_details_mt_settings_tab_item.template.php'; |
|
2775 | + $template = EE_MSG_TEMPLATE_PATH.'ee_msg_details_mt_settings_tab_item.template.php'; |
|
2776 | 2776 | $tabs = ''; |
2777 | 2777 | |
2778 | - foreach ( $tab_array as $tab ) { |
|
2779 | - $tabs .= EEH_Template::display_template( $template, $tab, true ); |
|
2778 | + foreach ($tab_array as $tab) { |
|
2779 | + $tabs .= EEH_Template::display_template($template, $tab, true); |
|
2780 | 2780 | } |
2781 | 2781 | |
2782 | 2782 | return $tabs; |
@@ -2792,29 +2792,29 @@ discard block |
||
2792 | 2792 | * |
2793 | 2793 | * @return string html formatted content |
2794 | 2794 | */ |
2795 | - protected function _get_messenger_box_content( EE_messenger $messenger ) { |
|
2795 | + protected function _get_messenger_box_content(EE_messenger $messenger) { |
|
2796 | 2796 | |
2797 | 2797 | $fields = $messenger->get_admin_settings_fields(); |
2798 | 2798 | $settings_template_args['template_form_fields'] = ''; |
2799 | 2799 | |
2800 | 2800 | //is $messenger active? |
2801 | - $settings_template_args['active'] = $this->_message_resource_manager->is_messenger_active( $messenger->name ); |
|
2801 | + $settings_template_args['active'] = $this->_message_resource_manager->is_messenger_active($messenger->name); |
|
2802 | 2802 | |
2803 | 2803 | |
2804 | - if ( ! empty( $fields ) ) { |
|
2804 | + if ( ! empty($fields)) { |
|
2805 | 2805 | |
2806 | 2806 | $existing_settings = $messenger->get_existing_admin_settings(); |
2807 | 2807 | |
2808 | - foreach( $fields as $fldname => $fldprops ) { |
|
2809 | - $field_id = $messenger->name . '-' . $fldname; |
|
2808 | + foreach ($fields as $fldname => $fldprops) { |
|
2809 | + $field_id = $messenger->name.'-'.$fldname; |
|
2810 | 2810 | $template_form_field[$field_id] = array( |
2811 | - 'name' => 'messenger_settings[' . $field_id . ']', |
|
2811 | + 'name' => 'messenger_settings['.$field_id.']', |
|
2812 | 2812 | 'label' => $fldprops['label'], |
2813 | 2813 | 'input' => $fldprops['field_type'], |
2814 | 2814 | 'type' => $fldprops['value_type'], |
2815 | 2815 | 'required' => $fldprops['required'], |
2816 | 2816 | 'validation' => $fldprops['validation'], |
2817 | - 'value' => isset( $existing_settings[$field_id]) |
|
2817 | + 'value' => isset($existing_settings[$field_id]) |
|
2818 | 2818 | ? $existing_settings[$field_id] |
2819 | 2819 | : $fldprops['default'], |
2820 | 2820 | 'css_class' => '', |
@@ -2823,8 +2823,8 @@ discard block |
||
2823 | 2823 | } |
2824 | 2824 | |
2825 | 2825 | |
2826 | - $settings_template_args['template_form_fields'] = !empty($template_form_field) |
|
2827 | - ? $this->_generate_admin_form_fields( $template_form_field, 'string', 'ee_m_activate_form' ) |
|
2826 | + $settings_template_args['template_form_fields'] = ! empty($template_form_field) |
|
2827 | + ? $this->_generate_admin_form_fields($template_form_field, 'string', 'ee_m_activate_form') |
|
2828 | 2828 | : ''; |
2829 | 2829 | } |
2830 | 2830 | |
@@ -2841,39 +2841,39 @@ discard block |
||
2841 | 2841 | ); |
2842 | 2842 | |
2843 | 2843 | //make sure any active message types that are existing are included in the hidden fields |
2844 | - if ( isset( $this->_m_mt_settings['message_type_tabs'][$messenger->name]['active'] ) ) { |
|
2845 | - foreach ( $this->_m_mt_settings['message_type_tabs'][$messenger->name]['active'] as $mt => $values ) { |
|
2844 | + if (isset($this->_m_mt_settings['message_type_tabs'][$messenger->name]['active'])) { |
|
2845 | + foreach ($this->_m_mt_settings['message_type_tabs'][$messenger->name]['active'] as $mt => $values) { |
|
2846 | 2846 | $settings_template_args['hidden_fields']['messenger_settings[message_types]['.$mt.']'] = array( |
2847 | 2847 | 'type' => 'hidden', |
2848 | 2848 | 'value' => $mt |
2849 | 2849 | ); |
2850 | 2850 | } |
2851 | 2851 | } |
2852 | - $settings_template_args[ 'hidden_fields' ] = $this->_generate_admin_form_fields( |
|
2853 | - $settings_template_args[ 'hidden_fields' ], |
|
2852 | + $settings_template_args['hidden_fields'] = $this->_generate_admin_form_fields( |
|
2853 | + $settings_template_args['hidden_fields'], |
|
2854 | 2854 | 'array' |
2855 | 2855 | ); |
2856 | - $active = $this->_message_resource_manager->is_messenger_active( $messenger->name ); |
|
2856 | + $active = $this->_message_resource_manager->is_messenger_active($messenger->name); |
|
2857 | 2857 | |
2858 | 2858 | $settings_template_args['messenger'] = $messenger->name; |
2859 | 2859 | $settings_template_args['description'] = $messenger->description; |
2860 | 2860 | $settings_template_args['show_hide_edit_form'] = $active ? '' : ' hidden'; |
2861 | 2861 | |
2862 | 2862 | |
2863 | - $settings_template_args['show_hide_edit_form'] = $this->_message_resource_manager->is_messenger_active( $messenger->name ) |
|
2863 | + $settings_template_args['show_hide_edit_form'] = $this->_message_resource_manager->is_messenger_active($messenger->name) |
|
2864 | 2864 | ? $settings_template_args['show_hide_edit_form'] |
2865 | 2865 | : ' hidden'; |
2866 | 2866 | |
2867 | - $settings_template_args['show_hide_edit_form'] = empty( $settings_template_args['template_form_fields'] ) |
|
2867 | + $settings_template_args['show_hide_edit_form'] = empty($settings_template_args['template_form_fields']) |
|
2868 | 2868 | ? ' hidden' |
2869 | 2869 | : $settings_template_args['show_hide_edit_form']; |
2870 | 2870 | |
2871 | 2871 | |
2872 | 2872 | $settings_template_args['on_off_action'] = $active ? 'messenger-off' : 'messenger-on'; |
2873 | - $settings_template_args['nonce'] = wp_create_nonce('activate_' . $messenger->name . '_toggle_nonce'); |
|
2873 | + $settings_template_args['nonce'] = wp_create_nonce('activate_'.$messenger->name.'_toggle_nonce'); |
|
2874 | 2874 | $settings_template_args['on_off_status'] = $active ? true : false; |
2875 | - $template = EE_MSG_TEMPLATE_PATH . 'ee_msg_m_settings_content.template.php'; |
|
2876 | - $content = EEH_Template::display_template( $template, $settings_template_args, true); |
|
2875 | + $template = EE_MSG_TEMPLATE_PATH.'ee_msg_m_settings_content.template.php'; |
|
2876 | + $content = EEH_Template::display_template($template, $settings_template_args, true); |
|
2877 | 2877 | return $content; |
2878 | 2878 | } |
2879 | 2879 | |
@@ -2887,9 +2887,9 @@ discard block |
||
2887 | 2887 | $success = true; |
2888 | 2888 | $this->_prep_default_response_for_messenger_or_message_type_toggle(); |
2889 | 2889 | //let's check that we have required data |
2890 | - if ( !isset( $this->_req_data[ 'messenger' ] ) ) { |
|
2890 | + if ( ! isset($this->_req_data['messenger'])) { |
|
2891 | 2891 | EE_Error::add_error( |
2892 | - __( 'Messenger name needed to toggle activation. None given', 'event_espresso' ), |
|
2892 | + __('Messenger name needed to toggle activation. None given', 'event_espresso'), |
|
2893 | 2893 | __FILE__, |
2894 | 2894 | __FUNCTION__, |
2895 | 2895 | __LINE__ |
@@ -2898,14 +2898,14 @@ discard block |
||
2898 | 2898 | } |
2899 | 2899 | |
2900 | 2900 | //do a nonce check here since we're not arriving via a normal route |
2901 | - $nonce = isset($this->_req_data[ 'activate_nonce' ]) ? sanitize_text_field( $this->_req_data[ 'activate_nonce'] ) : ''; |
|
2902 | - $nonce_ref = 'activate_' . $this->_req_data['messenger'] . '_toggle_nonce'; |
|
2901 | + $nonce = isset($this->_req_data['activate_nonce']) ? sanitize_text_field($this->_req_data['activate_nonce']) : ''; |
|
2902 | + $nonce_ref = 'activate_'.$this->_req_data['messenger'].'_toggle_nonce'; |
|
2903 | 2903 | |
2904 | - $this->_verify_nonce( $nonce, $nonce_ref ); |
|
2904 | + $this->_verify_nonce($nonce, $nonce_ref); |
|
2905 | 2905 | |
2906 | 2906 | |
2907 | 2907 | |
2908 | - if ( !isset( $this->_req_data[ 'status' ])) { |
|
2908 | + if ( ! isset($this->_req_data['status'])) { |
|
2909 | 2909 | EE_Error::add_error( |
2910 | 2910 | __( |
2911 | 2911 | 'Messenger status needed to know whether activation or deactivation is happening. No status is given', |
@@ -2921,11 +2921,11 @@ discard block |
||
2921 | 2921 | //do check to verify we have a valid status. |
2922 | 2922 | $status = $this->_req_data['status']; |
2923 | 2923 | |
2924 | - if ( $status != 'off' && $status != 'on' ) { |
|
2924 | + if ($status != 'off' && $status != 'on') { |
|
2925 | 2925 | EE_Error::add_error( |
2926 | 2926 | sprintf( |
2927 | - __( 'The given status (%s) is not valid. Must be "off" or "on"', 'event_espresso' ), |
|
2928 | - $this->_req_data[ 'status' ] |
|
2927 | + __('The given status (%s) is not valid. Must be "off" or "on"', 'event_espresso'), |
|
2928 | + $this->_req_data['status'] |
|
2929 | 2929 | ), |
2930 | 2930 | __FILE__, |
2931 | 2931 | __FUNCTION__, |
@@ -2934,11 +2934,11 @@ discard block |
||
2934 | 2934 | $success = false; |
2935 | 2935 | } |
2936 | 2936 | |
2937 | - if ( $success ) { |
|
2937 | + if ($success) { |
|
2938 | 2938 | //made it here? Stop dawdling then!! |
2939 | 2939 | $success = $status == 'off' |
2940 | - ? $this->_deactivate_messenger( $this->_req_data['messenger'] ) |
|
2941 | - : $this->_activate_messenger( $this->_req_data['messenger'] ); |
|
2940 | + ? $this->_deactivate_messenger($this->_req_data['messenger']) |
|
2941 | + : $this->_activate_messenger($this->_req_data['messenger']); |
|
2942 | 2942 | } |
2943 | 2943 | |
2944 | 2944 | $this->_template_args['success'] = $success; |
@@ -2961,7 +2961,7 @@ discard block |
||
2961 | 2961 | $this->_prep_default_response_for_messenger_or_message_type_toggle(); |
2962 | 2962 | |
2963 | 2963 | //let's make sure we have the necessary data |
2964 | - if ( ! isset( $this->_req_data[ 'message_type' ] ) ) { |
|
2964 | + if ( ! isset($this->_req_data['message_type'])) { |
|
2965 | 2965 | EE_Error::add_error( |
2966 | 2966 | __('Message Type name needed to toggle activation. None given', 'event_espresso'), |
2967 | 2967 | __FILE__, __FUNCTION__, __LINE__ |
@@ -2969,7 +2969,7 @@ discard block |
||
2969 | 2969 | $success = false; |
2970 | 2970 | } |
2971 | 2971 | |
2972 | - if ( ! isset( $this->_req_data[ 'messenger' ] ) ) { |
|
2972 | + if ( ! isset($this->_req_data['messenger'])) { |
|
2973 | 2973 | EE_Error::add_error( |
2974 | 2974 | __('Messenger name needed to toggle activation. None given', 'event_espresso'), |
2975 | 2975 | __FILE__, __FUNCTION__, __LINE__ |
@@ -2977,7 +2977,7 @@ discard block |
||
2977 | 2977 | $success = false; |
2978 | 2978 | } |
2979 | 2979 | |
2980 | - if ( ! isset( $this->_req_data[ 'status' ])) { |
|
2980 | + if ( ! isset($this->_req_data['status'])) { |
|
2981 | 2981 | EE_Error::add_error( |
2982 | 2982 | __('Messenger status needed to know whether activation or deactivation is happening. No status is given', 'event_espresso'), |
2983 | 2983 | __FILE__, __FUNCTION__, __LINE__ |
@@ -2989,7 +2989,7 @@ discard block |
||
2989 | 2989 | //do check to verify we have a valid status. |
2990 | 2990 | $status = $this->_req_data['status']; |
2991 | 2991 | |
2992 | - if ( $status != 'activate' && $status != 'deactivate' ) { |
|
2992 | + if ($status != 'activate' && $status != 'deactivate') { |
|
2993 | 2993 | EE_Error::add_error( |
2994 | 2994 | sprintf( |
2995 | 2995 | __('The given status (%s) is not valid. Must be "active" or "inactive"', 'event_espresso'), |
@@ -3002,16 +3002,16 @@ discard block |
||
3002 | 3002 | |
3003 | 3003 | |
3004 | 3004 | //do a nonce check here since we're not arriving via a normal route |
3005 | - $nonce = isset( $this->_req_data['mt_nonce'] ) ? sanitize_text_field( $this->_req_data['mt_nonce'] ) : ''; |
|
3006 | - $nonce_ref = $this->_req_data['message_type'] . '_nonce'; |
|
3005 | + $nonce = isset($this->_req_data['mt_nonce']) ? sanitize_text_field($this->_req_data['mt_nonce']) : ''; |
|
3006 | + $nonce_ref = $this->_req_data['message_type'].'_nonce'; |
|
3007 | 3007 | |
3008 | - $this->_verify_nonce( $nonce, $nonce_ref ); |
|
3008 | + $this->_verify_nonce($nonce, $nonce_ref); |
|
3009 | 3009 | |
3010 | - if ( $success ) { |
|
3010 | + if ($success) { |
|
3011 | 3011 | //made it here? um, what are you waiting for then? |
3012 | 3012 | $success = $status == 'deactivate' |
3013 | - ? $this->_deactivate_message_type_for_messenger( $this->_req_data['messenger'], $this->_req_data['message_type'] ) |
|
3014 | - : $this->_activate_message_type_for_messenger( $this->_req_data['messenger'], $this->_req_data['message_type'] ); |
|
3013 | + ? $this->_deactivate_message_type_for_messenger($this->_req_data['messenger'], $this->_req_data['message_type']) |
|
3014 | + : $this->_activate_message_type_for_messenger($this->_req_data['messenger'], $this->_req_data['message_type']); |
|
3015 | 3015 | } |
3016 | 3016 | |
3017 | 3017 | $this->_template_args['success'] = $success; |
@@ -3025,30 +3025,30 @@ discard block |
||
3025 | 3025 | * @param string $messenger_name The name of the messenger being activated |
3026 | 3026 | * @return bool |
3027 | 3027 | */ |
3028 | - protected function _activate_messenger( $messenger_name ) { |
|
3028 | + protected function _activate_messenger($messenger_name) { |
|
3029 | 3029 | /** @var EE_messenger $active_messenger This will be present because it can't be toggled if it isn't*/ |
3030 | - $active_messenger = $this->_message_resource_manager->get_messenger( $messenger_name ); |
|
3030 | + $active_messenger = $this->_message_resource_manager->get_messenger($messenger_name); |
|
3031 | 3031 | $message_types_to_activate = $active_messenger instanceof EE_Messenger ? $active_messenger->get_default_message_types() : array(); |
3032 | 3032 | |
3033 | 3033 | //ensure is active |
3034 | - $this->_message_resource_manager->activate_messenger( $messenger_name, $message_types_to_activate ); |
|
3034 | + $this->_message_resource_manager->activate_messenger($messenger_name, $message_types_to_activate); |
|
3035 | 3035 | |
3036 | 3036 | //set response_data for reload |
3037 | - foreach( $message_types_to_activate as $message_type_name ) { |
|
3037 | + foreach ($message_types_to_activate as $message_type_name) { |
|
3038 | 3038 | /** @var EE_message_type $message_type */ |
3039 | - $message_type = $this->_message_resource_manager->get_message_type( $message_type_name ); |
|
3040 | - if ( $this->_message_resource_manager->is_message_type_active_for_messenger( $messenger_name, $message_type_name ) |
|
3039 | + $message_type = $this->_message_resource_manager->get_message_type($message_type_name); |
|
3040 | + if ($this->_message_resource_manager->is_message_type_active_for_messenger($messenger_name, $message_type_name) |
|
3041 | 3041 | && $message_type instanceof EE_message_type |
3042 | 3042 | ) { |
3043 | 3043 | $this->_template_args['data']['active_mts'][] = $message_type_name; |
3044 | - if ( $message_type->get_admin_settings_fields() ) { |
|
3044 | + if ($message_type->get_admin_settings_fields()) { |
|
3045 | 3045 | $this->_template_args['data']['mt_reload'][] = $message_type_name; |
3046 | 3046 | } |
3047 | 3047 | } |
3048 | 3048 | } |
3049 | 3049 | |
3050 | 3050 | //add success message for activating messenger |
3051 | - return $this->_setup_response_message_for_activating_messenger_with_message_types( $active_messenger ); |
|
3051 | + return $this->_setup_response_message_for_activating_messenger_with_message_types($active_messenger); |
|
3052 | 3052 | |
3053 | 3053 | } |
3054 | 3054 | |
@@ -3059,11 +3059,11 @@ discard block |
||
3059 | 3059 | * @param string $messenger_name The name of the messenger being activated |
3060 | 3060 | * @return bool |
3061 | 3061 | */ |
3062 | - protected function _deactivate_messenger( $messenger_name ) { |
|
3062 | + protected function _deactivate_messenger($messenger_name) { |
|
3063 | 3063 | /** @var EE_messenger $active_messenger This will be present because it can't be toggled if it isn't*/ |
3064 | - $active_messenger = $this->_message_resource_manager->get_messenger( $messenger_name ); |
|
3065 | - $this->_message_resource_manager->deactivate_messenger( $messenger_name ); |
|
3066 | - return $this->_setup_response_message_for_deactivating_messenger_with_message_types( $active_messenger ); |
|
3064 | + $active_messenger = $this->_message_resource_manager->get_messenger($messenger_name); |
|
3065 | + $this->_message_resource_manager->deactivate_messenger($messenger_name); |
|
3066 | + return $this->_setup_response_message_for_deactivating_messenger_with_message_types($active_messenger); |
|
3067 | 3067 | } |
3068 | 3068 | |
3069 | 3069 | |
@@ -3074,23 +3074,23 @@ discard block |
||
3074 | 3074 | * @param string $message_type_name The name of the message type being activated for the messenger |
3075 | 3075 | * @return bool |
3076 | 3076 | */ |
3077 | - protected function _activate_message_type_for_messenger( $messenger_name, $message_type_name ) { |
|
3077 | + protected function _activate_message_type_for_messenger($messenger_name, $message_type_name) { |
|
3078 | 3078 | /** @var EE_messenger $active_messenger This will be present because it can't be toggled if it isn't*/ |
3079 | - $active_messenger = $this->_message_resource_manager->get_messenger( $messenger_name ); |
|
3079 | + $active_messenger = $this->_message_resource_manager->get_messenger($messenger_name); |
|
3080 | 3080 | /** @var EE_message_type $message_type_to_activate This will be present because it can't be toggled if it isn't*/ |
3081 | - $message_type_to_activate = $this->_message_resource_manager->get_message_type( $message_type_name ); |
|
3081 | + $message_type_to_activate = $this->_message_resource_manager->get_message_type($message_type_name); |
|
3082 | 3082 | |
3083 | 3083 | //ensure is active |
3084 | - $this->_message_resource_manager->activate_messenger( $messenger_name, $message_type_name ); |
|
3084 | + $this->_message_resource_manager->activate_messenger($messenger_name, $message_type_name); |
|
3085 | 3085 | |
3086 | 3086 | //set response for load |
3087 | - if ( $this->_message_resource_manager->is_message_type_active_for_messenger( $messenger_name, $message_type_name ) ) { |
|
3087 | + if ($this->_message_resource_manager->is_message_type_active_for_messenger($messenger_name, $message_type_name)) { |
|
3088 | 3088 | $this->_template_args['data']['active_mts'][] = $message_type_name; |
3089 | - if ( $message_type_to_activate->get_admin_settings_fields() ) { |
|
3089 | + if ($message_type_to_activate->get_admin_settings_fields()) { |
|
3090 | 3090 | $this->_template_args['data']['mt_reload'][] = $message_type_name; |
3091 | 3091 | } |
3092 | 3092 | } |
3093 | - return $this->_setup_response_message_for_activating_messenger_with_message_types( $active_messenger, $message_type_to_activate ); |
|
3093 | + return $this->_setup_response_message_for_activating_messenger_with_message_types($active_messenger, $message_type_to_activate); |
|
3094 | 3094 | } |
3095 | 3095 | |
3096 | 3096 | |
@@ -3102,13 +3102,13 @@ discard block |
||
3102 | 3102 | * @param string $message_type_name The name of the message type being deactivated for the messenger |
3103 | 3103 | * @return bool |
3104 | 3104 | */ |
3105 | - protected function _deactivate_message_type_for_messenger( $messenger_name, $message_type_name ) { |
|
3105 | + protected function _deactivate_message_type_for_messenger($messenger_name, $message_type_name) { |
|
3106 | 3106 | /** @var EE_messenger $active_messenger This will be present because it can't be toggled if it isn't*/ |
3107 | - $active_messenger = $this->_message_resource_manager->get_messenger( $messenger_name ); |
|
3107 | + $active_messenger = $this->_message_resource_manager->get_messenger($messenger_name); |
|
3108 | 3108 | /** @var EE_message_type $message_type_to_activate This will be present because it can't be toggled if it isn't*/ |
3109 | - $message_type_to_deactivate = $this->_message_resource_manager->get_message_type( $message_type_name ); |
|
3110 | - $this->_message_resource_manager->deactivate_message_type_for_messenger( $message_type_name, $messenger_name ); |
|
3111 | - return $this->_setup_response_message_for_deactivating_messenger_with_message_types( $active_messenger, $message_type_to_deactivate ); |
|
3109 | + $message_type_to_deactivate = $this->_message_resource_manager->get_message_type($message_type_name); |
|
3110 | + $this->_message_resource_manager->deactivate_message_type_for_messenger($message_type_name, $messenger_name); |
|
3111 | + return $this->_setup_response_message_for_deactivating_messenger_with_message_types($active_messenger, $message_type_to_deactivate); |
|
3112 | 3112 | } |
3113 | 3113 | |
3114 | 3114 | |
@@ -3139,9 +3139,9 @@ discard block |
||
3139 | 3139 | EE_Message_Type $message_type = null |
3140 | 3140 | ) { |
3141 | 3141 | //if $messenger isn't a valid messenger object then get out. |
3142 | - if ( ! $messenger instanceof EE_Messenger ) { |
|
3142 | + if ( ! $messenger instanceof EE_Messenger) { |
|
3143 | 3143 | EE_Error::add_error( |
3144 | - __( 'The messenger being activated is not a valid messenger', 'event_espresso' ), |
|
3144 | + __('The messenger being activated is not a valid messenger', 'event_espresso'), |
|
3145 | 3145 | __FILE__, |
3146 | 3146 | __FUNCTION__, |
3147 | 3147 | __LINE__ |
@@ -3149,32 +3149,32 @@ discard block |
||
3149 | 3149 | return false; |
3150 | 3150 | } |
3151 | 3151 | //activated |
3152 | - if ( $this->_template_args['data']['active_mts'] ) { |
|
3152 | + if ($this->_template_args['data']['active_mts']) { |
|
3153 | 3153 | EE_Error::overwrite_success(); |
3154 | 3154 | //activated a message type with the messenger |
3155 | - if ( $message_type instanceof EE_message_type ) { |
|
3155 | + if ($message_type instanceof EE_message_type) { |
|
3156 | 3156 | EE_Error::add_success( |
3157 | 3157 | sprintf( |
3158 | 3158 | __('%s message type has been successfully activated with the %s messenger', 'event_espresso'), |
3159 | - ucwords( $message_type->label['singular'] ), |
|
3160 | - ucwords( $messenger->label['singular'] ) |
|
3159 | + ucwords($message_type->label['singular']), |
|
3160 | + ucwords($messenger->label['singular']) |
|
3161 | 3161 | ) |
3162 | 3162 | ); |
3163 | 3163 | |
3164 | 3164 | //if message type was invoice then let's make sure we activate the invoice payment method. |
3165 | - if ( $message_type->name == 'invoice' ) { |
|
3166 | - EE_Registry::instance()->load_lib( 'Payment_Method_Manager' ); |
|
3167 | - $pm = EE_Payment_Method_Manager::instance()->activate_a_payment_method_of_type( 'Invoice' ); |
|
3168 | - if ( $pm instanceof EE_Payment_Method ) { |
|
3169 | - EE_Error::add_attention( __('Activating the invoice message type also automatically activates the invoice payment method. If you do not wish the invoice payment method to be active, or to change its settings, visit the payment method admin page.', 'event_espresso' ) ); |
|
3165 | + if ($message_type->name == 'invoice') { |
|
3166 | + EE_Registry::instance()->load_lib('Payment_Method_Manager'); |
|
3167 | + $pm = EE_Payment_Method_Manager::instance()->activate_a_payment_method_of_type('Invoice'); |
|
3168 | + if ($pm instanceof EE_Payment_Method) { |
|
3169 | + EE_Error::add_attention(__('Activating the invoice message type also automatically activates the invoice payment method. If you do not wish the invoice payment method to be active, or to change its settings, visit the payment method admin page.', 'event_espresso')); |
|
3170 | 3170 | } |
3171 | 3171 | } |
3172 | 3172 | //just toggles the entire messenger |
3173 | 3173 | } else { |
3174 | 3174 | EE_Error::add_success( |
3175 | 3175 | sprintf( |
3176 | - __( '%s messenger has been successfully activated', 'event_espresso' ), |
|
3177 | - ucwords( $messenger->label[ 'singular' ] ) |
|
3176 | + __('%s messenger has been successfully activated', 'event_espresso'), |
|
3177 | + ucwords($messenger->label['singular']) |
|
3178 | 3178 | ) |
3179 | 3179 | ); |
3180 | 3180 | } |
@@ -3184,12 +3184,12 @@ discard block |
||
3184 | 3184 | //message types after the activation process. However its possible some messengers don't HAVE any default_message_types |
3185 | 3185 | //in which case we just give a success message for the messenger being successfully activated. |
3186 | 3186 | } else { |
3187 | - if ( ! $messenger->get_default_message_types() ) { |
|
3187 | + if ( ! $messenger->get_default_message_types()) { |
|
3188 | 3188 | //messenger doesn't have any default message types so still a success. |
3189 | 3189 | EE_Error::add_success( |
3190 | 3190 | sprintf( |
3191 | - __('%s messenger was successfully activated.', 'event_espresso' ), |
|
3192 | - ucwords( $messenger->label['singular'] ) |
|
3191 | + __('%s messenger was successfully activated.', 'event_espresso'), |
|
3192 | + ucwords($messenger->label['singular']) |
|
3193 | 3193 | ) |
3194 | 3194 | ); |
3195 | 3195 | return true; |
@@ -3197,13 +3197,13 @@ discard block |
||
3197 | 3197 | EE_Error::add_error( |
3198 | 3198 | $message_type instanceof EE_message_type |
3199 | 3199 | ? sprintf( |
3200 | - __( '%s message type was not successfully activated with the %s messenger', 'event_espresso' ), |
|
3201 | - ucwords( $message_type->label['singular'] ), |
|
3202 | - ucwords( $messenger->label['singular'] ) |
|
3200 | + __('%s message type was not successfully activated with the %s messenger', 'event_espresso'), |
|
3201 | + ucwords($message_type->label['singular']), |
|
3202 | + ucwords($messenger->label['singular']) |
|
3203 | 3203 | ) |
3204 | 3204 | : sprintf( |
3205 | - __( '%s messenger was not successfully activated', 'event_espresso' ), |
|
3206 | - ucwords( $messenger->label['singular'] ) |
|
3205 | + __('%s messenger was not successfully activated', 'event_espresso'), |
|
3206 | + ucwords($messenger->label['singular']) |
|
3207 | 3207 | ), |
3208 | 3208 | __FILE__, |
3209 | 3209 | __FUNCTION__, |
@@ -3231,9 +3231,9 @@ discard block |
||
3231 | 3231 | EE_Error::overwrite_success(); |
3232 | 3232 | |
3233 | 3233 | //if $messenger isn't a valid messenger object then get out. |
3234 | - if ( ! $messenger instanceof EE_Messenger ) { |
|
3234 | + if ( ! $messenger instanceof EE_Messenger) { |
|
3235 | 3235 | EE_Error::add_error( |
3236 | - __( 'The messenger being deactivated is not a valid messenger', 'event_espresso' ), |
|
3236 | + __('The messenger being deactivated is not a valid messenger', 'event_espresso'), |
|
3237 | 3237 | __FILE__, |
3238 | 3238 | __FUNCTION__, |
3239 | 3239 | __LINE__ |
@@ -3241,13 +3241,13 @@ discard block |
||
3241 | 3241 | return false; |
3242 | 3242 | } |
3243 | 3243 | |
3244 | - if ( $message_type instanceof EE_message_type ) { |
|
3244 | + if ($message_type instanceof EE_message_type) { |
|
3245 | 3245 | $message_type_name = $message_type->name; |
3246 | 3246 | EE_Error::add_success( |
3247 | 3247 | sprintf( |
3248 | 3248 | __('%s message type has been successfully deactivated for the %s messenger.', 'event_espresso'), |
3249 | - ucwords( $message_type->label['singular'] ), |
|
3250 | - ucwords ( $messenger->label['singular'] ) |
|
3249 | + ucwords($message_type->label['singular']), |
|
3250 | + ucwords($messenger->label['singular']) |
|
3251 | 3251 | ) |
3252 | 3252 | ); |
3253 | 3253 | } else { |
@@ -3255,20 +3255,20 @@ discard block |
||
3255 | 3255 | EE_Error::add_success( |
3256 | 3256 | sprintf( |
3257 | 3257 | __('%s messenger has been successfully deactivated.', 'event_espresso'), |
3258 | - ucwords( $messenger->label['singular'] ) |
|
3258 | + ucwords($messenger->label['singular']) |
|
3259 | 3259 | ) |
3260 | 3260 | ); |
3261 | 3261 | } |
3262 | 3262 | |
3263 | 3263 | //if messenger was html or message type was invoice then let's make sure we deactivate invoice payment method. |
3264 | - if ( $messenger->name == 'html' || $message_type_name == 'invoice') { |
|
3265 | - EE_Registry::instance()->load_lib( 'Payment_Method_Manager' ); |
|
3266 | - $count_updated = EE_Payment_Method_Manager::instance()->deactivate_payment_method( 'invoice' ); |
|
3267 | - if ( $count_updated > 0 ) { |
|
3264 | + if ($messenger->name == 'html' || $message_type_name == 'invoice') { |
|
3265 | + EE_Registry::instance()->load_lib('Payment_Method_Manager'); |
|
3266 | + $count_updated = EE_Payment_Method_Manager::instance()->deactivate_payment_method('invoice'); |
|
3267 | + if ($count_updated > 0) { |
|
3268 | 3268 | $msg = $message_type_name == 'invoice' |
3269 | - ? __('Deactivating the invoice message type also automatically deactivates the invoice payment method. In order for invoices to be generated the invoice message type must be active. If you completed this action by mistake, simply reactivate the invoice message type and then visit the payment methods admin page to reactivate the invoice payment method.', 'event_espresso' ) |
|
3270 | - : __('Deactivating the html messenger also automatically deactivates the invoice payment method. In order for invoices to be generated the html messenger must be be active. If you completed this action by mistake, simply reactivate the html messenger, then visit the payment methods admin page to reactivate the invoice payment method.', 'event_espresso' ); |
|
3271 | - EE_Error::add_attention( $msg ); |
|
3269 | + ? __('Deactivating the invoice message type also automatically deactivates the invoice payment method. In order for invoices to be generated the invoice message type must be active. If you completed this action by mistake, simply reactivate the invoice message type and then visit the payment methods admin page to reactivate the invoice payment method.', 'event_espresso') |
|
3270 | + : __('Deactivating the html messenger also automatically deactivates the invoice payment method. In order for invoices to be generated the html messenger must be be active. If you completed this action by mistake, simply reactivate the html messenger, then visit the payment methods admin page to reactivate the invoice payment method.', 'event_espresso'); |
|
3271 | + EE_Error::add_attention($msg); |
|
3272 | 3272 | } |
3273 | 3273 | } |
3274 | 3274 | return true; |
@@ -3279,17 +3279,17 @@ discard block |
||
3279 | 3279 | * handles updating a message type form on messenger activation IF the message type has settings fields. (via ajax) |
3280 | 3280 | */ |
3281 | 3281 | public function update_mt_form() { |
3282 | - if ( !isset( $this->_req_data['messenger'] ) || !isset( $this->_req_data['message_type'] ) ) { |
|
3283 | - EE_Error::add_error( __('Require message type or messenger to send an updated form'), __FILE__, __FUNCTION__, __LINE__ ); |
|
3282 | + if ( ! isset($this->_req_data['messenger']) || ! isset($this->_req_data['message_type'])) { |
|
3283 | + EE_Error::add_error(__('Require message type or messenger to send an updated form'), __FILE__, __FUNCTION__, __LINE__); |
|
3284 | 3284 | $this->_return_json(); |
3285 | 3285 | } |
3286 | 3286 | |
3287 | 3287 | $message_types = $this->get_installed_message_types(); |
3288 | 3288 | |
3289 | - $message_type = $message_types[ $this->_req_data['message_type'] ]; |
|
3290 | - $messenger = $this->_message_resource_manager->get_active_messenger( $this->_req_data['messenger'] ); |
|
3289 | + $message_type = $message_types[$this->_req_data['message_type']]; |
|
3290 | + $messenger = $this->_message_resource_manager->get_active_messenger($this->_req_data['messenger']); |
|
3291 | 3291 | |
3292 | - $content = $this->_message_type_settings_content ( $message_type, $messenger, true ); |
|
3292 | + $content = $this->_message_type_settings_content($message_type, $messenger, true); |
|
3293 | 3293 | $this->_template_args['success'] = true; |
3294 | 3294 | $this->_template_args['content'] = $content; |
3295 | 3295 | $this->_return_json(); |
@@ -3303,45 +3303,45 @@ discard block |
||
3303 | 3303 | * |
3304 | 3304 | */ |
3305 | 3305 | public function save_settings() { |
3306 | - if ( !isset( $this->_req_data['type'] ) ) { |
|
3307 | - EE_Error::add_error(__('Cannot save settings because type is unknown (messenger settings or messsage type settings?)', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ ); |
|
3306 | + if ( ! isset($this->_req_data['type'])) { |
|
3307 | + EE_Error::add_error(__('Cannot save settings because type is unknown (messenger settings or messsage type settings?)', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
3308 | 3308 | $this->_template_args['error'] = true; |
3309 | 3309 | $this->_return_json(); |
3310 | 3310 | } |
3311 | 3311 | |
3312 | 3312 | |
3313 | - if ( $this->_req_data['type'] == 'messenger' ) { |
|
3313 | + if ($this->_req_data['type'] == 'messenger') { |
|
3314 | 3314 | $settings = $this->_req_data['messenger_settings']; //this should be an array. |
3315 | 3315 | $messenger = $settings['messenger']; |
3316 | 3316 | //let's setup the settings data |
3317 | - foreach ( $settings as $key => $value ) { |
|
3318 | - switch ( $key ) { |
|
3317 | + foreach ($settings as $key => $value) { |
|
3318 | + switch ($key) { |
|
3319 | 3319 | case 'messenger' : |
3320 | - unset( $settings['messenger'] ); |
|
3320 | + unset($settings['messenger']); |
|
3321 | 3321 | break; |
3322 | 3322 | case 'message_types' : |
3323 | - unset( $settings['message_types'] ); |
|
3323 | + unset($settings['message_types']); |
|
3324 | 3324 | break; |
3325 | 3325 | default : |
3326 | 3326 | $settings[$key] = $value; |
3327 | 3327 | break; |
3328 | 3328 | } |
3329 | 3329 | } |
3330 | - $this->_message_resource_manager->add_settings_for_messenger( $messenger, $settings ); |
|
3330 | + $this->_message_resource_manager->add_settings_for_messenger($messenger, $settings); |
|
3331 | 3331 | } |
3332 | 3332 | |
3333 | - else if ( $this->_req_data['type'] == 'message_type' ) { |
|
3333 | + else if ($this->_req_data['type'] == 'message_type') { |
|
3334 | 3334 | $settings = $this->_req_data['message_type_settings']; |
3335 | 3335 | $messenger = $settings['messenger']; |
3336 | 3336 | $message_type = $settings['message_type']; |
3337 | 3337 | |
3338 | - foreach ( $settings as $key => $value ) { |
|
3339 | - switch ( $key ) { |
|
3338 | + foreach ($settings as $key => $value) { |
|
3339 | + switch ($key) { |
|
3340 | 3340 | case 'messenger' : |
3341 | - unset( $settings['messenger'] ); |
|
3341 | + unset($settings['messenger']); |
|
3342 | 3342 | break; |
3343 | 3343 | case 'message_type' : |
3344 | - unset( $settings['message_type'] ); |
|
3344 | + unset($settings['message_type']); |
|
3345 | 3345 | break; |
3346 | 3346 | default : |
3347 | 3347 | $settings[$key] = $value; |
@@ -3349,16 +3349,16 @@ discard block |
||
3349 | 3349 | } |
3350 | 3350 | } |
3351 | 3351 | |
3352 | - $this->_message_resource_manager->add_settings_for_message_type( $messenger, $message_type, $settings ); |
|
3352 | + $this->_message_resource_manager->add_settings_for_message_type($messenger, $message_type, $settings); |
|
3353 | 3353 | } |
3354 | 3354 | |
3355 | 3355 | //okay we should have the data all setup. Now we just update! |
3356 | 3356 | $success = $this->_message_resource_manager->update_active_messengers_option(); |
3357 | 3357 | |
3358 | - if ( $success ) { |
|
3359 | - EE_Error::add_success( __('Settings updated', 'event_espresso') ); |
|
3358 | + if ($success) { |
|
3359 | + EE_Error::add_success(__('Settings updated', 'event_espresso')); |
|
3360 | 3360 | } else { |
3361 | - EE_Error::add_error( __('Settings did not get updated', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ ); |
|
3361 | + EE_Error::add_error(__('Settings did not get updated', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
3362 | 3362 | } |
3363 | 3363 | |
3364 | 3364 | $this->_template_args['success'] = $success; |
@@ -3380,8 +3380,8 @@ discard block |
||
3380 | 3380 | */ |
3381 | 3381 | protected function _generate_now() { |
3382 | 3382 | $msg_ids = $this->_get_msg_ids_from_request(); |
3383 | - EED_Messages::generate_now( $msg_ids ); |
|
3384 | - $this->_redirect_after_action( false, '', '', array(), true ); |
|
3383 | + EED_Messages::generate_now($msg_ids); |
|
3384 | + $this->_redirect_after_action(false, '', '', array(), true); |
|
3385 | 3385 | } |
3386 | 3386 | |
3387 | 3387 | |
@@ -3396,7 +3396,7 @@ discard block |
||
3396 | 3396 | protected function _generate_and_send_now() { |
3397 | 3397 | $this->_generate_now(); |
3398 | 3398 | $this->_send_now(); |
3399 | - $this->_redirect_after_action( false, '', '', array(), true ); |
|
3399 | + $this->_redirect_after_action(false, '', '', array(), true); |
|
3400 | 3400 | } |
3401 | 3401 | |
3402 | 3402 | |
@@ -3410,8 +3410,8 @@ discard block |
||
3410 | 3410 | */ |
3411 | 3411 | protected function _queue_for_resending() { |
3412 | 3412 | $msg_ids = $this->_get_msg_ids_from_request(); |
3413 | - EED_Messages::queue_for_resending( $msg_ids ); |
|
3414 | - $this->_redirect_after_action( false, '', '', array(), true ); |
|
3413 | + EED_Messages::queue_for_resending($msg_ids); |
|
3414 | + $this->_redirect_after_action(false, '', '', array(), true); |
|
3415 | 3415 | } |
3416 | 3416 | |
3417 | 3417 | |
@@ -3424,8 +3424,8 @@ discard block |
||
3424 | 3424 | */ |
3425 | 3425 | protected function _send_now() { |
3426 | 3426 | $msg_ids = $this->_get_msg_ids_from_request(); |
3427 | - EED_Messages::send_now( $msg_ids ); |
|
3428 | - $this->_redirect_after_action( false, '', '', array(), true ); |
|
3427 | + EED_Messages::send_now($msg_ids); |
|
3428 | + $this->_redirect_after_action(false, '', '', array(), true); |
|
3429 | 3429 | } |
3430 | 3430 | |
3431 | 3431 | |
@@ -3439,23 +3439,23 @@ discard block |
||
3439 | 3439 | protected function _delete_ee_messages() { |
3440 | 3440 | $msg_ids = $this->_get_msg_ids_from_request(); |
3441 | 3441 | $deleted_count = 0; |
3442 | - foreach ( $msg_ids as $msg_id ) { |
|
3443 | - if ( EEM_Message::instance()->delete_by_ID( $msg_id ) ) { |
|
3442 | + foreach ($msg_ids as $msg_id) { |
|
3443 | + if (EEM_Message::instance()->delete_by_ID($msg_id)) { |
|
3444 | 3444 | $deleted_count++; |
3445 | 3445 | } |
3446 | 3446 | } |
3447 | - if ( $deleted_count ) { |
|
3447 | + if ($deleted_count) { |
|
3448 | 3448 | $this->_redirect_after_action( |
3449 | 3449 | true, |
3450 | - _n( 'message', 'messages', $deleted_count, 'event_espresso' ), |
|
3450 | + _n('message', 'messages', $deleted_count, 'event_espresso'), |
|
3451 | 3451 | __('deleted', 'event_espresso') |
3452 | 3452 | ); |
3453 | 3453 | } else { |
3454 | 3454 | EE_Error::add_error( |
3455 | - _n( 'The message was not deleted.', 'The messages were not deleted', count( $msg_ids ), 'event_espresso' ), |
|
3455 | + _n('The message was not deleted.', 'The messages were not deleted', count($msg_ids), 'event_espresso'), |
|
3456 | 3456 | __FILE__, __FUNCTION__, __LINE__ |
3457 | 3457 | ); |
3458 | - $this->_redirect_after_action( false, '', '', array(), true ); |
|
3458 | + $this->_redirect_after_action(false, '', '', array(), true); |
|
3459 | 3459 | } |
3460 | 3460 | } |
3461 | 3461 | |
@@ -3468,10 +3468,10 @@ discard block |
||
3468 | 3468 | * @return array |
3469 | 3469 | */ |
3470 | 3470 | protected function _get_msg_ids_from_request() { |
3471 | - if ( ! isset( $this->_req_data['MSG_ID'] ) ) { |
|
3471 | + if ( ! isset($this->_req_data['MSG_ID'])) { |
|
3472 | 3472 | return array(); |
3473 | 3473 | } |
3474 | - return is_array( $this->_req_data['MSG_ID'] ) ? array_keys( $this->_req_data['MSG_ID'] ) : array( $this->_req_data['MSG_ID'] ); |
|
3474 | + return is_array($this->_req_data['MSG_ID']) ? array_keys($this->_req_data['MSG_ID']) : array($this->_req_data['MSG_ID']); |
|
3475 | 3475 | } |
3476 | 3476 | |
3477 | 3477 |
@@ -27,12 +27,12 @@ discard block |
||
27 | 27 | * @param int | \EE_Event $event |
28 | 28 | * @return bool |
29 | 29 | */ |
30 | -function is_espresso_event( $event = NULL ) { |
|
31 | - if ( can_use_espresso_conditionals( __FUNCTION__ )) { |
|
30 | +function is_espresso_event($event = NULL) { |
|
31 | + if (can_use_espresso_conditionals(__FUNCTION__)) { |
|
32 | 32 | // extract EE_Event object from passed param regardless of what it is (within reason of course) |
33 | - $event = EEH_Event_View::get_event( $event ); |
|
33 | + $event = EEH_Event_View::get_event($event); |
|
34 | 34 | // do we have a valid event ? |
35 | - return $event instanceof EE_Event ? TRUE : FALSE; |
|
35 | + return $event instanceof EE_Event ? TRUE : FALSE; |
|
36 | 36 | } |
37 | 37 | return FALSE; |
38 | 38 | } |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | * @return bool |
45 | 45 | */ |
46 | 46 | function is_espresso_event_single() { |
47 | - if ( can_use_espresso_conditionals( __FUNCTION__ )) { |
|
47 | + if (can_use_espresso_conditionals(__FUNCTION__)) { |
|
48 | 48 | global $wp_query; |
49 | 49 | // return conditionals set by CPTs |
50 | 50 | return $wp_query instanceof WP_Query ? $wp_query->is_espresso_event_single : FALSE; |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | * @return bool |
60 | 60 | */ |
61 | 61 | function is_espresso_event_archive() { |
62 | - if ( can_use_espresso_conditionals( __FUNCTION__ )) { |
|
62 | + if (can_use_espresso_conditionals(__FUNCTION__)) { |
|
63 | 63 | global $wp_query; |
64 | 64 | return $wp_query instanceof WP_Query ? $wp_query->is_espresso_event_archive : FALSE; |
65 | 65 | } |
@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | * @return bool |
74 | 74 | */ |
75 | 75 | function is_espresso_event_taxonomy() { |
76 | - if ( can_use_espresso_conditionals( __FUNCTION__ )) { |
|
76 | + if (can_use_espresso_conditionals(__FUNCTION__)) { |
|
77 | 77 | global $wp_query; |
78 | 78 | return $wp_query instanceof WP_Query ? $wp_query->is_espresso_event_taxonomy : FALSE; |
79 | 79 | } |
@@ -87,10 +87,10 @@ discard block |
||
87 | 87 | * @param int | \EE_Venue $venue |
88 | 88 | * @return bool |
89 | 89 | */ |
90 | -function is_espresso_venue( $venue = NULL ) { |
|
91 | - if ( can_use_espresso_conditionals( __FUNCTION__ )) { |
|
90 | +function is_espresso_venue($venue = NULL) { |
|
91 | + if (can_use_espresso_conditionals(__FUNCTION__)) { |
|
92 | 92 | // extract EE_Venue object from passed param regardless of what it is (within reason of course) |
93 | - $venue = EEH_Venue_View::get_venue( $venue, FALSE ); |
|
93 | + $venue = EEH_Venue_View::get_venue($venue, FALSE); |
|
94 | 94 | // do we have a valid event ? |
95 | 95 | return $venue instanceof EE_Venue ? TRUE : FALSE; |
96 | 96 | } |
@@ -104,7 +104,7 @@ discard block |
||
104 | 104 | * @return bool |
105 | 105 | */ |
106 | 106 | function is_espresso_venue_single() { |
107 | - if ( can_use_espresso_conditionals( __FUNCTION__ )) { |
|
107 | + if (can_use_espresso_conditionals(__FUNCTION__)) { |
|
108 | 108 | global $wp_query; |
109 | 109 | return $wp_query instanceof WP_Query ? $wp_query->is_espresso_venue_single : FALSE; |
110 | 110 | } |
@@ -118,7 +118,7 @@ discard block |
||
118 | 118 | * @return bool |
119 | 119 | */ |
120 | 120 | function is_espresso_venue_archive() { |
121 | - if ( can_use_espresso_conditionals( __FUNCTION__ )) { |
|
121 | + if (can_use_espresso_conditionals(__FUNCTION__)) { |
|
122 | 122 | global $wp_query; |
123 | 123 | return $wp_query instanceof WP_Query ? $wp_query->is_espresso_venue_archive : FALSE; |
124 | 124 | } |
@@ -132,7 +132,7 @@ discard block |
||
132 | 132 | * @return bool |
133 | 133 | */ |
134 | 134 | function is_espresso_venue_taxonomy() { |
135 | - if ( can_use_espresso_conditionals( __FUNCTION__ )) { |
|
135 | + if (can_use_espresso_conditionals(__FUNCTION__)) { |
|
136 | 136 | global $wp_query; |
137 | 137 | return $wp_query instanceof WP_Query ? $wp_query->is_espresso_venue_taxonomy : FALSE; |
138 | 138 | } |
@@ -146,12 +146,12 @@ discard block |
||
146 | 146 | * @param $conditional_tag |
147 | 147 | * @return bool |
148 | 148 | */ |
149 | -function can_use_espresso_conditionals( $conditional_tag ) { |
|
150 | - if ( ! did_action( 'AHEE__EE_System__initialize' )) { |
|
149 | +function can_use_espresso_conditionals($conditional_tag) { |
|
150 | + if ( ! did_action('AHEE__EE_System__initialize')) { |
|
151 | 151 | EE_Error::doing_it_wrong( |
152 | 152 | __FUNCTION__, |
153 | 153 | sprintf( |
154 | - __( 'The "%s" conditional tag can not be used until after the "init" hook has run, but works best when used within a theme\'s template files.','event_espresso'), |
|
154 | + __('The "%s" conditional tag can not be used until after the "init" hook has run, but works best when used within a theme\'s template files.', 'event_espresso'), |
|
155 | 155 | $conditional_tag |
156 | 156 | ), |
157 | 157 | '4.4.0' |
@@ -166,13 +166,13 @@ discard block |
||
166 | 166 | |
167 | 167 | /*************************** Event Queries ***************************/ |
168 | 168 | |
169 | -if ( ! function_exists( 'espresso_get_events' )) { |
|
169 | +if ( ! function_exists('espresso_get_events')) { |
|
170 | 170 | /** |
171 | 171 | * espresso_get_events |
172 | 172 | * @param array $params |
173 | 173 | * @return array |
174 | 174 | */ |
175 | - function espresso_get_events( $params = array() ) { |
|
175 | + function espresso_get_events($params = array()) { |
|
176 | 176 | //set default params |
177 | 177 | $default_espresso_events_params = array( |
178 | 178 | 'limit' => 10, |
@@ -183,18 +183,18 @@ discard block |
||
183 | 183 | 'sort' => 'ASC' |
184 | 184 | ); |
185 | 185 | // allow the defaults to be filtered |
186 | - $default_espresso_events_params = apply_filters( 'espresso_get_events__default_espresso_events_params', $default_espresso_events_params ); |
|
186 | + $default_espresso_events_params = apply_filters('espresso_get_events__default_espresso_events_params', $default_espresso_events_params); |
|
187 | 187 | // grab params and merge with defaults, then extract |
188 | - $params = array_merge( $default_espresso_events_params, $params ); |
|
188 | + $params = array_merge($default_espresso_events_params, $params); |
|
189 | 189 | // run the query |
190 | - $events_query = new EE_Event_List_Query( $params ); |
|
190 | + $events_query = new EE_Event_List_Query($params); |
|
191 | 191 | // assign results to a variable so we can return it |
192 | 192 | $events = $events_query->have_posts() ? $events_query->posts : array(); |
193 | 193 | // but first reset the query and postdata |
194 | 194 | wp_reset_query(); |
195 | 195 | wp_reset_postdata(); |
196 | 196 | EED_Events_Archive::remove_all_events_archive_filters(); |
197 | - unset( $events_query ); |
|
197 | + unset($events_query); |
|
198 | 198 | return $events; |
199 | 199 | } |
200 | 200 | } |
@@ -208,32 +208,32 @@ discard block |
||
208 | 208 | * espresso_load_ticket_selector |
209 | 209 | */ |
210 | 210 | function espresso_load_ticket_selector() { |
211 | - EE_Registry::instance()->load_file( EE_MODULES . 'ticket_selector', 'EED_Ticket_Selector', 'module' ); |
|
211 | + EE_Registry::instance()->load_file(EE_MODULES.'ticket_selector', 'EED_Ticket_Selector', 'module'); |
|
212 | 212 | } |
213 | 213 | |
214 | -if ( ! function_exists( 'espresso_ticket_selector' )) { |
|
214 | +if ( ! function_exists('espresso_ticket_selector')) { |
|
215 | 215 | /** |
216 | 216 | * espresso_ticket_selector |
217 | 217 | * @param null $event |
218 | 218 | */ |
219 | - function espresso_ticket_selector( $event = NULL ) { |
|
220 | - if ( ! apply_filters( 'FHEE_disable_espresso_ticket_selector', FALSE ) ) { |
|
219 | + function espresso_ticket_selector($event = NULL) { |
|
220 | + if ( ! apply_filters('FHEE_disable_espresso_ticket_selector', FALSE)) { |
|
221 | 221 | espresso_load_ticket_selector(); |
222 | - echo EED_Ticket_Selector::display_ticket_selector( $event ); |
|
222 | + echo EED_Ticket_Selector::display_ticket_selector($event); |
|
223 | 223 | } |
224 | 224 | } |
225 | 225 | } |
226 | 226 | |
227 | 227 | |
228 | - if ( ! function_exists( 'espresso_view_details_btn' )) { |
|
228 | + if ( ! function_exists('espresso_view_details_btn')) { |
|
229 | 229 | /** |
230 | 230 | * espresso_view_details_btn |
231 | 231 | * @param null $event |
232 | 232 | */ |
233 | - function espresso_view_details_btn( $event = NULL ) { |
|
234 | - if ( ! apply_filters( 'FHEE_disable_espresso_view_details_btn', FALSE ) ) { |
|
233 | + function espresso_view_details_btn($event = NULL) { |
|
234 | + if ( ! apply_filters('FHEE_disable_espresso_view_details_btn', FALSE)) { |
|
235 | 235 | espresso_load_ticket_selector(); |
236 | - echo EED_Ticket_Selector::display_ticket_selector( $event, TRUE ); |
|
236 | + echo EED_Ticket_Selector::display_ticket_selector($event, TRUE); |
|
237 | 237 | } |
238 | 238 | } |
239 | 239 | } |
@@ -243,7 +243,7 @@ discard block |
||
243 | 243 | |
244 | 244 | /*************************** EEH_Event_View ***************************/ |
245 | 245 | |
246 | -if ( ! function_exists( 'espresso_load_event_list_assets' )) { |
|
246 | +if ( ! function_exists('espresso_load_event_list_assets')) { |
|
247 | 247 | /** |
248 | 248 | * espresso_load_event_list_assets |
249 | 249 | * ensures that event list styles and scripts are loaded |
@@ -252,13 +252,13 @@ discard block |
||
252 | 252 | */ |
253 | 253 | function espresso_load_event_list_assets() { |
254 | 254 | $event_list = EED_Events_Archive::instance(); |
255 | - add_action( 'AHEE__EE_System__initialize_last', array( $event_list, 'load_event_list_assets' ), 10 ); |
|
256 | - add_filter( 'FHEE_enable_default_espresso_css', '__return_true' ); |
|
255 | + add_action('AHEE__EE_System__initialize_last', array($event_list, 'load_event_list_assets'), 10); |
|
256 | + add_filter('FHEE_enable_default_espresso_css', '__return_true'); |
|
257 | 257 | } |
258 | 258 | } |
259 | 259 | |
260 | 260 | |
261 | -if ( ! function_exists( 'espresso_event_reg_button' )) { |
|
261 | +if ( ! function_exists('espresso_event_reg_button')) { |
|
262 | 262 | /** |
263 | 263 | * espresso_event_reg_button |
264 | 264 | * returns the "Register Now" button if event is active, |
@@ -270,9 +270,9 @@ discard block |
||
270 | 270 | * @param bool $EVT_ID |
271 | 271 | * @return string |
272 | 272 | */ |
273 | - function espresso_event_reg_button( $btn_text_if_active = NULL, $btn_text_if_inactive = FALSE, $EVT_ID = FALSE ) { |
|
274 | - $event_status = EEH_Event_View::event_active_status( $EVT_ID ); |
|
275 | - switch ( $event_status ) { |
|
273 | + function espresso_event_reg_button($btn_text_if_active = NULL, $btn_text_if_inactive = FALSE, $EVT_ID = FALSE) { |
|
274 | + $event_status = EEH_Event_View::event_active_status($EVT_ID); |
|
275 | + switch ($event_status) { |
|
276 | 276 | case EE_Datetime::sold_out : |
277 | 277 | $btn_text = __('Sold Out', 'event_espresso'); |
278 | 278 | $class = 'ee-pink'; |
@@ -288,10 +288,10 @@ discard block |
||
288 | 288 | case EE_Datetime::upcoming : |
289 | 289 | case EE_Datetime::active : |
290 | 290 | default : |
291 | - $btn_text =! empty( $btn_text_if_active ) ? $btn_text_if_active : __( 'Register Now', 'event_espresso' ); |
|
291 | + $btn_text = ! empty($btn_text_if_active) ? $btn_text_if_active : __('Register Now', 'event_espresso'); |
|
292 | 292 | $class = 'ee-green'; |
293 | 293 | } |
294 | - if ( $event_status < 1 && ! empty( $btn_text_if_inactive )) { |
|
294 | + if ($event_status < 1 && ! empty($btn_text_if_inactive)) { |
|
295 | 295 | $btn_text = $btn_text_if_inactive; |
296 | 296 | $class = 'ee-grey'; |
297 | 297 | } |
@@ -305,7 +305,7 @@ discard block |
||
305 | 305 | |
306 | 306 | |
307 | 307 | |
308 | -if ( ! function_exists( 'espresso_display_ticket_selector' )) { |
|
308 | +if ( ! function_exists('espresso_display_ticket_selector')) { |
|
309 | 309 | /** |
310 | 310 | * espresso_display_ticket_selector |
311 | 311 | * whether or not to display the Ticket Selector for an event |
@@ -313,14 +313,14 @@ discard block |
||
313 | 313 | * @param bool $EVT_ID |
314 | 314 | * @return boolean |
315 | 315 | */ |
316 | - function espresso_display_ticket_selector( $EVT_ID = FALSE ) { |
|
317 | - return EEH_Event_View::display_ticket_selector( $EVT_ID ); |
|
316 | + function espresso_display_ticket_selector($EVT_ID = FALSE) { |
|
317 | + return EEH_Event_View::display_ticket_selector($EVT_ID); |
|
318 | 318 | } |
319 | 319 | } |
320 | 320 | |
321 | 321 | |
322 | 322 | |
323 | -if ( ! function_exists( 'espresso_event_status_banner' )) { |
|
323 | +if ( ! function_exists('espresso_event_status_banner')) { |
|
324 | 324 | /** |
325 | 325 | * espresso_event_status |
326 | 326 | * returns a banner showing the event status if it is sold out, expired, or inactive |
@@ -328,13 +328,13 @@ discard block |
||
328 | 328 | * @param bool $EVT_ID |
329 | 329 | * @return string |
330 | 330 | */ |
331 | - function espresso_event_status_banner( $EVT_ID = FALSE ) { |
|
332 | - return EEH_Event_View::event_status( $EVT_ID ); |
|
331 | + function espresso_event_status_banner($EVT_ID = FALSE) { |
|
332 | + return EEH_Event_View::event_status($EVT_ID); |
|
333 | 333 | } |
334 | 334 | } |
335 | 335 | |
336 | 336 | |
337 | -if ( ! function_exists( 'espresso_event_status' )) { |
|
337 | +if ( ! function_exists('espresso_event_status')) { |
|
338 | 338 | /** |
339 | 339 | * espresso_event_status |
340 | 340 | * returns the event status if it is sold out, expired, or inactive |
@@ -343,17 +343,17 @@ discard block |
||
343 | 343 | * @param bool $echo |
344 | 344 | * @return string |
345 | 345 | */ |
346 | - function espresso_event_status( $EVT_ID = 0, $echo = TRUE ) { |
|
347 | - if ( $echo ) { |
|
348 | - echo EEH_Event_View::event_active_status( $EVT_ID ); |
|
346 | + function espresso_event_status($EVT_ID = 0, $echo = TRUE) { |
|
347 | + if ($echo) { |
|
348 | + echo EEH_Event_View::event_active_status($EVT_ID); |
|
349 | 349 | return ''; |
350 | 350 | } |
351 | - return EEH_Event_View::event_active_status( $EVT_ID ); |
|
351 | + return EEH_Event_View::event_active_status($EVT_ID); |
|
352 | 352 | } |
353 | 353 | } |
354 | 354 | |
355 | 355 | |
356 | -if ( ! function_exists( 'espresso_event_categories' )) { |
|
356 | +if ( ! function_exists('espresso_event_categories')) { |
|
357 | 357 | /** |
358 | 358 | * espresso_event_categories |
359 | 359 | * returns the terms associated with an event |
@@ -363,17 +363,17 @@ discard block |
||
363 | 363 | * @param bool $echo |
364 | 364 | * @return string |
365 | 365 | */ |
366 | - function espresso_event_categories( $EVT_ID = 0, $hide_uncategorized = TRUE, $echo = TRUE ) { |
|
367 | - if ( $echo ) { |
|
368 | - echo EEH_Event_View::event_categories( $EVT_ID, $hide_uncategorized ); |
|
366 | + function espresso_event_categories($EVT_ID = 0, $hide_uncategorized = TRUE, $echo = TRUE) { |
|
367 | + if ($echo) { |
|
368 | + echo EEH_Event_View::event_categories($EVT_ID, $hide_uncategorized); |
|
369 | 369 | return ''; |
370 | 370 | } |
371 | - return EEH_Event_View::event_categories( $EVT_ID, $hide_uncategorized ); |
|
371 | + return EEH_Event_View::event_categories($EVT_ID, $hide_uncategorized); |
|
372 | 372 | } |
373 | 373 | } |
374 | 374 | |
375 | 375 | |
376 | -if ( ! function_exists( 'espresso_event_tickets_available' )) { |
|
376 | +if ( ! function_exists('espresso_event_tickets_available')) { |
|
377 | 377 | /** |
378 | 378 | * espresso_event_tickets_available |
379 | 379 | * returns the ticket types available for purchase for an event |
@@ -383,26 +383,26 @@ discard block |
||
383 | 383 | * @param bool $format |
384 | 384 | * @return string |
385 | 385 | */ |
386 | - function espresso_event_tickets_available( $EVT_ID = 0, $echo = TRUE, $format = TRUE ) { |
|
387 | - $tickets = EEH_Event_View::event_tickets_available( $EVT_ID ); |
|
388 | - if ( is_array( $tickets ) && ! empty( $tickets )) { |
|
386 | + function espresso_event_tickets_available($EVT_ID = 0, $echo = TRUE, $format = TRUE) { |
|
387 | + $tickets = EEH_Event_View::event_tickets_available($EVT_ID); |
|
388 | + if (is_array($tickets) && ! empty($tickets)) { |
|
389 | 389 | // if formatting then $html will be a string, else it will be an array of ticket objects |
390 | - $html = $format ? '<ul id="ee-event-tickets-ul-' . $EVT_ID . '" class="ee-event-tickets-ul">' : array(); |
|
391 | - foreach ( $tickets as $ticket ) { |
|
392 | - if ( $ticket instanceof EE_Ticket ) { |
|
393 | - if ( $format ) { |
|
394 | - $html .= '<li id="ee-event-tickets-li-' . $ticket->ID() . '" class="ee-event-tickets-li">'; |
|
395 | - $html .= $ticket->name() . ' ' . EEH_Template::format_currency( $ticket->get_ticket_total_with_taxes() ); |
|
390 | + $html = $format ? '<ul id="ee-event-tickets-ul-'.$EVT_ID.'" class="ee-event-tickets-ul">' : array(); |
|
391 | + foreach ($tickets as $ticket) { |
|
392 | + if ($ticket instanceof EE_Ticket) { |
|
393 | + if ($format) { |
|
394 | + $html .= '<li id="ee-event-tickets-li-'.$ticket->ID().'" class="ee-event-tickets-li">'; |
|
395 | + $html .= $ticket->name().' '.EEH_Template::format_currency($ticket->get_ticket_total_with_taxes()); |
|
396 | 396 | $html .= '</li>'; |
397 | 397 | } else { |
398 | 398 | $html[] = $ticket; |
399 | 399 | } |
400 | 400 | } |
401 | 401 | } |
402 | - if ( $format ) { |
|
402 | + if ($format) { |
|
403 | 403 | $html .= '</ul>'; |
404 | 404 | } |
405 | - if ( $echo && ! $format ) { |
|
405 | + if ($echo && ! $format) { |
|
406 | 406 | echo $html; |
407 | 407 | return ''; |
408 | 408 | } |
@@ -412,7 +412,7 @@ discard block |
||
412 | 412 | } |
413 | 413 | } |
414 | 414 | |
415 | -if ( ! function_exists( 'espresso_event_date_obj' )) { |
|
415 | +if ( ! function_exists('espresso_event_date_obj')) { |
|
416 | 416 | /** |
417 | 417 | * espresso_event_date_obj |
418 | 418 | * returns the primary date object for an event |
@@ -420,13 +420,13 @@ discard block |
||
420 | 420 | * @param bool $EVT_ID |
421 | 421 | * @return object |
422 | 422 | */ |
423 | - function espresso_event_date_obj( $EVT_ID = FALSE ) { |
|
424 | - return EEH_Event_View::get_primary_date_obj( $EVT_ID ); |
|
423 | + function espresso_event_date_obj($EVT_ID = FALSE) { |
|
424 | + return EEH_Event_View::get_primary_date_obj($EVT_ID); |
|
425 | 425 | } |
426 | 426 | } |
427 | 427 | |
428 | 428 | |
429 | -if ( ! function_exists( 'espresso_event_date' )) { |
|
429 | +if ( ! function_exists('espresso_event_date')) { |
|
430 | 430 | /** |
431 | 431 | * espresso_event_date |
432 | 432 | * returns the primary date for an event |
@@ -437,22 +437,22 @@ discard block |
||
437 | 437 | * @param bool $echo |
438 | 438 | * @return string |
439 | 439 | */ |
440 | - function espresso_event_date( $date_format = '', $time_format = '', $EVT_ID = FALSE, $echo = TRUE ) { |
|
441 | - $date_format = ! empty( $date_format ) ? $date_format : get_option( 'date_format' ); |
|
442 | - $time_format = ! empty( $time_format ) ? $time_format : get_option( 'time_format' ); |
|
443 | - $date_format = apply_filters( 'FHEE__espresso_event_date__date_format', $date_format ); |
|
444 | - $time_format = apply_filters( 'FHEE__espresso_event_date__time_format', $time_format ); |
|
445 | - if($echo){ |
|
446 | - echo EEH_Event_View::the_event_date( $date_format, $time_format, $EVT_ID ); |
|
440 | + function espresso_event_date($date_format = '', $time_format = '', $EVT_ID = FALSE, $echo = TRUE) { |
|
441 | + $date_format = ! empty($date_format) ? $date_format : get_option('date_format'); |
|
442 | + $time_format = ! empty($time_format) ? $time_format : get_option('time_format'); |
|
443 | + $date_format = apply_filters('FHEE__espresso_event_date__date_format', $date_format); |
|
444 | + $time_format = apply_filters('FHEE__espresso_event_date__time_format', $time_format); |
|
445 | + if ($echo) { |
|
446 | + echo EEH_Event_View::the_event_date($date_format, $time_format, $EVT_ID); |
|
447 | 447 | return ''; |
448 | 448 | } |
449 | - return EEH_Event_View::the_event_date( $date_format, $time_format, $EVT_ID ); |
|
449 | + return EEH_Event_View::the_event_date($date_format, $time_format, $EVT_ID); |
|
450 | 450 | |
451 | 451 | } |
452 | 452 | } |
453 | 453 | |
454 | 454 | |
455 | -if ( ! function_exists( 'espresso_list_of_event_dates' )) { |
|
455 | +if ( ! function_exists('espresso_list_of_event_dates')) { |
|
456 | 456 | /** |
457 | 457 | * espresso_list_of_event_dates |
458 | 458 | * returns a unordered list of dates for an event |
@@ -467,40 +467,40 @@ discard block |
||
467 | 467 | * @param null $limit |
468 | 468 | * @return string |
469 | 469 | */ |
470 | - function espresso_list_of_event_dates( $EVT_ID = 0, $date_format = '', $time_format = '', $echo = TRUE, $show_expired = NULL, $format = TRUE, $add_breaks = TRUE, $limit = NULL ) { |
|
471 | - $date_format = ! empty( $date_format ) ? $date_format : get_option( 'date_format' ); |
|
472 | - $time_format = ! empty( $time_format ) ? $time_format : get_option( 'time_format' ); |
|
473 | - $date_format = apply_filters( 'FHEE__espresso_list_of_event_dates__date_format', $date_format ); |
|
474 | - $time_format = apply_filters( 'FHEE__espresso_list_of_event_dates__time_format', $time_format ); |
|
475 | - $datetimes = EEH_Event_View::get_all_date_obj( $EVT_ID, $show_expired, FALSE, $limit ); |
|
476 | - if ( ! $format ) { |
|
477 | - return apply_filters( 'FHEE__espresso_list_of_event_dates__datetimes', $datetimes ); |
|
470 | + function espresso_list_of_event_dates($EVT_ID = 0, $date_format = '', $time_format = '', $echo = TRUE, $show_expired = NULL, $format = TRUE, $add_breaks = TRUE, $limit = NULL) { |
|
471 | + $date_format = ! empty($date_format) ? $date_format : get_option('date_format'); |
|
472 | + $time_format = ! empty($time_format) ? $time_format : get_option('time_format'); |
|
473 | + $date_format = apply_filters('FHEE__espresso_list_of_event_dates__date_format', $date_format); |
|
474 | + $time_format = apply_filters('FHEE__espresso_list_of_event_dates__time_format', $time_format); |
|
475 | + $datetimes = EEH_Event_View::get_all_date_obj($EVT_ID, $show_expired, FALSE, $limit); |
|
476 | + if ( ! $format) { |
|
477 | + return apply_filters('FHEE__espresso_list_of_event_dates__datetimes', $datetimes); |
|
478 | 478 | } |
479 | 479 | //d( $datetimes ); |
480 | - if ( is_array( $datetimes ) && ! empty( $datetimes )) { |
|
480 | + if (is_array($datetimes) && ! empty($datetimes)) { |
|
481 | 481 | global $post; |
482 | - $html = $format ? '<ul id="ee-event-datetimes-ul-' . $post->ID . '" class="ee-event-datetimes-ul ee-clearfix">' : ''; |
|
483 | - foreach ( $datetimes as $datetime ) { |
|
484 | - if ( $datetime instanceof EE_Datetime ) { |
|
485 | - $html .= '<li id="ee-event-datetimes-li-' . $datetime->ID(); |
|
486 | - $html .= '" class="ee-event-datetimes-li ee-event-datetimes-li-' . $datetime->get_active_status() . '">'; |
|
482 | + $html = $format ? '<ul id="ee-event-datetimes-ul-'.$post->ID.'" class="ee-event-datetimes-ul ee-clearfix">' : ''; |
|
483 | + foreach ($datetimes as $datetime) { |
|
484 | + if ($datetime instanceof EE_Datetime) { |
|
485 | + $html .= '<li id="ee-event-datetimes-li-'.$datetime->ID(); |
|
486 | + $html .= '" class="ee-event-datetimes-li ee-event-datetimes-li-'.$datetime->get_active_status().'">'; |
|
487 | 487 | $datetime_name = $datetime->name(); |
488 | - $html .= ! empty( $datetime_name ) ? '<strong>' . $datetime_name . '</strong>' : ''; |
|
489 | - $html .= ! empty( $datetime_name ) && $add_breaks ? '<br />' : ''; |
|
490 | - $html .= '<span class="dashicons dashicons-calendar"></span>' . $datetime->date_range( $date_format ) . '<br/>'; |
|
491 | - $html .= '<span class="dashicons dashicons-clock"></span>' . $datetime->time_range( $time_format ); |
|
488 | + $html .= ! empty($datetime_name) ? '<strong>'.$datetime_name.'</strong>' : ''; |
|
489 | + $html .= ! empty($datetime_name) && $add_breaks ? '<br />' : ''; |
|
490 | + $html .= '<span class="dashicons dashicons-calendar"></span>'.$datetime->date_range($date_format).'<br/>'; |
|
491 | + $html .= '<span class="dashicons dashicons-clock"></span>'.$datetime->time_range($time_format); |
|
492 | 492 | $datetime_description = $datetime->description(); |
493 | - $html .= ! empty( $datetime_description ) && $add_breaks ? '<br />' : ''; |
|
494 | - $html .= ! empty( $datetime_description ) ? ' - ' . $datetime_description : ''; |
|
495 | - $html = apply_filters( 'FHEE__espresso_list_of_event_dates__datetime_html', $html, $datetime ); |
|
493 | + $html .= ! empty($datetime_description) && $add_breaks ? '<br />' : ''; |
|
494 | + $html .= ! empty($datetime_description) ? ' - '.$datetime_description : ''; |
|
495 | + $html = apply_filters('FHEE__espresso_list_of_event_dates__datetime_html', $html, $datetime); |
|
496 | 496 | $html .= '</li>'; |
497 | 497 | } |
498 | 498 | } |
499 | 499 | $html .= $format ? '</ul>' : ''; |
500 | 500 | } else { |
501 | - $html = $format ? '<p><span class="dashicons dashicons-marker pink-text"></span>' . __( 'There are no upcoming dates for this event.', 'event_espresso' ) . '</p><br/>' : ''; |
|
501 | + $html = $format ? '<p><span class="dashicons dashicons-marker pink-text"></span>'.__('There are no upcoming dates for this event.', 'event_espresso').'</p><br/>' : ''; |
|
502 | 502 | } |
503 | - if ( $echo ) { |
|
503 | + if ($echo) { |
|
504 | 504 | echo $html; |
505 | 505 | return ''; |
506 | 506 | } |
@@ -509,7 +509,7 @@ discard block |
||
509 | 509 | } |
510 | 510 | |
511 | 511 | |
512 | -if ( ! function_exists( 'espresso_event_end_date' )) { |
|
512 | +if ( ! function_exists('espresso_event_end_date')) { |
|
513 | 513 | /** |
514 | 514 | * espresso_event_end_date |
515 | 515 | * returns the last date for an event |
@@ -520,20 +520,20 @@ discard block |
||
520 | 520 | * @param bool $echo |
521 | 521 | * @return string |
522 | 522 | */ |
523 | - function espresso_event_end_date( $date_format = '', $time_format = '', $EVT_ID = FALSE, $echo = TRUE ) { |
|
524 | - $date_format = ! empty( $date_format ) ? $date_format : get_option( 'date_format' ); |
|
525 | - $time_format = ! empty( $time_format ) ? $time_format : get_option( 'time_format' ); |
|
526 | - $date_format = apply_filters( 'FHEE__espresso_event_end_date__date_format', $date_format ); |
|
527 | - $time_format = apply_filters( 'FHEE__espresso_event_end_date__time_format', $time_format ); |
|
528 | - if($echo){ |
|
529 | - echo EEH_Event_View::the_event_end_date( $date_format, $time_format, $EVT_ID ); |
|
523 | + function espresso_event_end_date($date_format = '', $time_format = '', $EVT_ID = FALSE, $echo = TRUE) { |
|
524 | + $date_format = ! empty($date_format) ? $date_format : get_option('date_format'); |
|
525 | + $time_format = ! empty($time_format) ? $time_format : get_option('time_format'); |
|
526 | + $date_format = apply_filters('FHEE__espresso_event_end_date__date_format', $date_format); |
|
527 | + $time_format = apply_filters('FHEE__espresso_event_end_date__time_format', $time_format); |
|
528 | + if ($echo) { |
|
529 | + echo EEH_Event_View::the_event_end_date($date_format, $time_format, $EVT_ID); |
|
530 | 530 | return ''; |
531 | 531 | } |
532 | - return EEH_Event_View::the_event_end_date( $date_format, $time_format, $EVT_ID ); |
|
532 | + return EEH_Event_View::the_event_end_date($date_format, $time_format, $EVT_ID); |
|
533 | 533 | } |
534 | 534 | } |
535 | 535 | |
536 | -if ( ! function_exists( 'espresso_event_date_range' )) { |
|
536 | +if ( ! function_exists('espresso_event_date_range')) { |
|
537 | 537 | /** |
538 | 538 | * espresso_event_date_range |
539 | 539 | * returns the first and last chronologically ordered dates for an event (if different) |
@@ -546,31 +546,31 @@ discard block |
||
546 | 546 | * @param bool $echo |
547 | 547 | * @return string |
548 | 548 | */ |
549 | - function espresso_event_date_range( $date_format = '', $time_format = '', $single_date_format = '', $single_time_format = '', $EVT_ID = FALSE, $echo = TRUE ) { |
|
549 | + function espresso_event_date_range($date_format = '', $time_format = '', $single_date_format = '', $single_time_format = '', $EVT_ID = FALSE, $echo = TRUE) { |
|
550 | 550 | // set and filter date and time formats when a range is returned |
551 | - $date_format = ! empty( $date_format ) ? $date_format : get_option( 'date_format' ); |
|
552 | - $date_format = apply_filters( 'FHEE__espresso_event_date_range__date_format', $date_format ); |
|
551 | + $date_format = ! empty($date_format) ? $date_format : get_option('date_format'); |
|
552 | + $date_format = apply_filters('FHEE__espresso_event_date_range__date_format', $date_format); |
|
553 | 553 | // get the start and end date with NO time portion |
554 | - $the_event_date = EEH_Event_View::the_earliest_event_date( $date_format, '', $EVT_ID ); |
|
555 | - $the_event_end_date = EEH_Event_View::the_latest_event_date( $date_format, '', $EVT_ID ); |
|
554 | + $the_event_date = EEH_Event_View::the_earliest_event_date($date_format, '', $EVT_ID); |
|
555 | + $the_event_end_date = EEH_Event_View::the_latest_event_date($date_format, '', $EVT_ID); |
|
556 | 556 | // now we can determine if date range spans more than one day |
557 | - if ( $the_event_date != $the_event_end_date ) { |
|
558 | - $time_format = ! empty( $time_format ) ? $time_format : get_option( 'time_format' ); |
|
559 | - $time_format = apply_filters( 'FHEE__espresso_event_date_range__time_format', $time_format ); |
|
557 | + if ($the_event_date != $the_event_end_date) { |
|
558 | + $time_format = ! empty($time_format) ? $time_format : get_option('time_format'); |
|
559 | + $time_format = apply_filters('FHEE__espresso_event_date_range__time_format', $time_format); |
|
560 | 560 | $html = sprintf( |
561 | - __( '%1$s - %2$s', 'event_espresso' ), |
|
562 | - EEH_Event_View::the_earliest_event_date( $date_format, $time_format, $EVT_ID ), |
|
563 | - EEH_Event_View::the_latest_event_date( $date_format, $time_format, $EVT_ID ) |
|
561 | + __('%1$s - %2$s', 'event_espresso'), |
|
562 | + EEH_Event_View::the_earliest_event_date($date_format, $time_format, $EVT_ID), |
|
563 | + EEH_Event_View::the_latest_event_date($date_format, $time_format, $EVT_ID) |
|
564 | 564 | ); |
565 | 565 | } else { |
566 | 566 | // set and filter date and time formats when only a single datetime is returned |
567 | - $single_date_format = ! empty( $single_date_format ) ? $single_date_format : get_option( 'date_format' ); |
|
568 | - $single_time_format = ! empty( $single_time_format ) ? $single_time_format : get_option( 'time_format' ); |
|
569 | - $single_date_format = apply_filters( 'FHEE__espresso_event_date_range__single_date_format', $single_date_format ); |
|
570 | - $single_time_format = apply_filters( 'FHEE__espresso_event_date_range__single_time_format', $single_time_format ); |
|
571 | - $html = EEH_Event_View::the_earliest_event_date( $single_date_format, $single_time_format, $EVT_ID ); |
|
567 | + $single_date_format = ! empty($single_date_format) ? $single_date_format : get_option('date_format'); |
|
568 | + $single_time_format = ! empty($single_time_format) ? $single_time_format : get_option('time_format'); |
|
569 | + $single_date_format = apply_filters('FHEE__espresso_event_date_range__single_date_format', $single_date_format); |
|
570 | + $single_time_format = apply_filters('FHEE__espresso_event_date_range__single_time_format', $single_time_format); |
|
571 | + $html = EEH_Event_View::the_earliest_event_date($single_date_format, $single_time_format, $EVT_ID); |
|
572 | 572 | } |
573 | - if ( $echo ) { |
|
573 | + if ($echo) { |
|
574 | 574 | echo $html; |
575 | 575 | return ''; |
576 | 576 | } |
@@ -579,7 +579,7 @@ discard block |
||
579 | 579 | } |
580 | 580 | |
581 | 581 | |
582 | -if ( ! function_exists( 'espresso_event_date_as_calendar_page' )) { |
|
582 | +if ( ! function_exists('espresso_event_date_as_calendar_page')) { |
|
583 | 583 | /** |
584 | 584 | * espresso_event_date_as_calendar_page |
585 | 585 | * returns the primary date for an event, stylized to appear as the page of a calendar |
@@ -587,15 +587,15 @@ discard block |
||
587 | 587 | * @param bool $EVT_ID |
588 | 588 | * @return string |
589 | 589 | */ |
590 | - function espresso_event_date_as_calendar_page( $EVT_ID = FALSE ) { |
|
591 | - EEH_Event_View::event_date_as_calendar_page( $EVT_ID ); |
|
590 | + function espresso_event_date_as_calendar_page($EVT_ID = FALSE) { |
|
591 | + EEH_Event_View::event_date_as_calendar_page($EVT_ID); |
|
592 | 592 | } |
593 | 593 | } |
594 | 594 | |
595 | 595 | |
596 | 596 | |
597 | 597 | |
598 | -if ( ! function_exists( 'espresso_event_link_url' )) { |
|
598 | +if ( ! function_exists('espresso_event_link_url')) { |
|
599 | 599 | /** |
600 | 600 | * espresso_event_link_url |
601 | 601 | * |
@@ -603,18 +603,18 @@ discard block |
||
603 | 603 | * @param bool $echo |
604 | 604 | * @return string |
605 | 605 | */ |
606 | - function espresso_event_link_url( $EVT_ID = 0, $echo = TRUE ) { |
|
607 | - if ( $echo ) { |
|
608 | - echo EEH_Event_View::event_link_url( $EVT_ID ); |
|
606 | + function espresso_event_link_url($EVT_ID = 0, $echo = TRUE) { |
|
607 | + if ($echo) { |
|
608 | + echo EEH_Event_View::event_link_url($EVT_ID); |
|
609 | 609 | return ''; |
610 | 610 | } |
611 | - return EEH_Event_View::event_link_url( $EVT_ID ); |
|
611 | + return EEH_Event_View::event_link_url($EVT_ID); |
|
612 | 612 | } |
613 | 613 | } |
614 | 614 | |
615 | 615 | |
616 | 616 | |
617 | -if ( ! function_exists( 'espresso_event_has_content_or_excerpt' )) { |
|
617 | +if ( ! function_exists('espresso_event_has_content_or_excerpt')) { |
|
618 | 618 | /** |
619 | 619 | * espresso_event_has_content_or_excerpt |
620 | 620 | * |
@@ -622,15 +622,15 @@ discard block |
||
622 | 622 | * @param bool $EVT_ID |
623 | 623 | * @return boolean |
624 | 624 | */ |
625 | - function espresso_event_has_content_or_excerpt( $EVT_ID = FALSE ) { |
|
626 | - return EEH_Event_View::event_has_content_or_excerpt( $EVT_ID ); |
|
625 | + function espresso_event_has_content_or_excerpt($EVT_ID = FALSE) { |
|
626 | + return EEH_Event_View::event_has_content_or_excerpt($EVT_ID); |
|
627 | 627 | } |
628 | 628 | } |
629 | 629 | |
630 | 630 | |
631 | 631 | |
632 | 632 | |
633 | -if ( ! function_exists( 'espresso_event_content_or_excerpt' )) { |
|
633 | +if ( ! function_exists('espresso_event_content_or_excerpt')) { |
|
634 | 634 | /** |
635 | 635 | * espresso_event_content_or_excerpt |
636 | 636 | * |
@@ -639,18 +639,18 @@ discard block |
||
639 | 639 | * @param bool $echo |
640 | 640 | * @return string |
641 | 641 | */ |
642 | - function espresso_event_content_or_excerpt( $num_words = 55, $more = NULL, $echo = TRUE ) { |
|
643 | - if ( $echo ) { |
|
644 | - echo EEH_Event_View::event_content_or_excerpt( $num_words, $more ); |
|
642 | + function espresso_event_content_or_excerpt($num_words = 55, $more = NULL, $echo = TRUE) { |
|
643 | + if ($echo) { |
|
644 | + echo EEH_Event_View::event_content_or_excerpt($num_words, $more); |
|
645 | 645 | return ''; |
646 | 646 | } |
647 | - return EEH_Event_View::event_content_or_excerpt( $num_words, $more ); |
|
647 | + return EEH_Event_View::event_content_or_excerpt($num_words, $more); |
|
648 | 648 | } |
649 | 649 | } |
650 | 650 | |
651 | 651 | |
652 | 652 | |
653 | -if ( ! function_exists( 'espresso_event_phone' )) { |
|
653 | +if ( ! function_exists('espresso_event_phone')) { |
|
654 | 654 | /** |
655 | 655 | * espresso_event_phone |
656 | 656 | * |
@@ -658,18 +658,18 @@ discard block |
||
658 | 658 | * @param bool $echo |
659 | 659 | * @return string |
660 | 660 | */ |
661 | - function espresso_event_phone( $EVT_ID = 0, $echo = TRUE ) { |
|
662 | - if ( $echo ) { |
|
663 | - echo EEH_Event_View::event_phone( $EVT_ID ); |
|
661 | + function espresso_event_phone($EVT_ID = 0, $echo = TRUE) { |
|
662 | + if ($echo) { |
|
663 | + echo EEH_Event_View::event_phone($EVT_ID); |
|
664 | 664 | return ''; |
665 | 665 | } |
666 | - return EEH_Event_View::event_phone( $EVT_ID ); |
|
666 | + return EEH_Event_View::event_phone($EVT_ID); |
|
667 | 667 | } |
668 | 668 | } |
669 | 669 | |
670 | 670 | |
671 | 671 | |
672 | -if ( ! function_exists( 'espresso_edit_event_link' )) { |
|
672 | +if ( ! function_exists('espresso_edit_event_link')) { |
|
673 | 673 | /** |
674 | 674 | * espresso_edit_event_link |
675 | 675 | * returns a link to edit an event |
@@ -678,39 +678,39 @@ discard block |
||
678 | 678 | * @param bool $echo |
679 | 679 | * @return string |
680 | 680 | */ |
681 | - function espresso_edit_event_link( $EVT_ID = 0, $echo = TRUE ) { |
|
682 | - if ( $echo ) { |
|
683 | - echo EEH_Event_View::edit_event_link( $EVT_ID ); |
|
681 | + function espresso_edit_event_link($EVT_ID = 0, $echo = TRUE) { |
|
682 | + if ($echo) { |
|
683 | + echo EEH_Event_View::edit_event_link($EVT_ID); |
|
684 | 684 | return ''; |
685 | 685 | } |
686 | - return EEH_Event_View::edit_event_link( $EVT_ID ); |
|
686 | + return EEH_Event_View::edit_event_link($EVT_ID); |
|
687 | 687 | } |
688 | 688 | } |
689 | 689 | |
690 | 690 | |
691 | -if ( ! function_exists( 'espresso_organization_name' )) { |
|
691 | +if ( ! function_exists('espresso_organization_name')) { |
|
692 | 692 | /** |
693 | 693 | * espresso_organization_name |
694 | 694 | * @param bool $echo |
695 | 695 | * @return string |
696 | 696 | */ |
697 | 697 | function espresso_organization_name($echo = TRUE) { |
698 | - if($echo){ |
|
699 | - echo EE_Registry::instance()->CFG->organization->get_pretty( 'name' ); |
|
698 | + if ($echo) { |
|
699 | + echo EE_Registry::instance()->CFG->organization->get_pretty('name'); |
|
700 | 700 | return ''; |
701 | 701 | } |
702 | - return EE_Registry::instance()->CFG->organization->get_pretty( 'name' ); |
|
702 | + return EE_Registry::instance()->CFG->organization->get_pretty('name'); |
|
703 | 703 | } |
704 | 704 | } |
705 | 705 | |
706 | -if ( ! function_exists( 'espresso_organization_address' )) { |
|
706 | +if ( ! function_exists('espresso_organization_address')) { |
|
707 | 707 | /** |
708 | 708 | * espresso_organization_address |
709 | 709 | * @param string $type |
710 | 710 | * @return string |
711 | 711 | */ |
712 | - function espresso_organization_address( $type = 'inline' ) { |
|
713 | - if ( EE_Registry::instance()->CFG->organization instanceof EE_Organization_Config ) { |
|
712 | + function espresso_organization_address($type = 'inline') { |
|
713 | + if (EE_Registry::instance()->CFG->organization instanceof EE_Organization_Config) { |
|
714 | 714 | $address = new EventEspresso\core\entities\GenericAddress( |
715 | 715 | EE_Registry::instance()->CFG->organization->address_1, |
716 | 716 | EE_Registry::instance()->CFG->organization->address_2, |
@@ -719,129 +719,129 @@ discard block |
||
719 | 719 | EE_Registry::instance()->CFG->organization->zip, |
720 | 720 | EE_Registry::instance()->CFG->organization->CNT_ISO |
721 | 721 | ); |
722 | - return EEH_Address::format( $address, $type ); |
|
722 | + return EEH_Address::format($address, $type); |
|
723 | 723 | } |
724 | 724 | return ''; |
725 | 725 | } |
726 | 726 | } |
727 | 727 | |
728 | -if ( ! function_exists( 'espresso_organization_email' )) { |
|
728 | +if ( ! function_exists('espresso_organization_email')) { |
|
729 | 729 | /** |
730 | 730 | * espresso_organization_email |
731 | 731 | * @param bool $echo |
732 | 732 | * @return string |
733 | 733 | */ |
734 | - function espresso_organization_email( $echo = TRUE ) { |
|
735 | - if($echo){ |
|
736 | - echo EE_Registry::instance()->CFG->organization->get_pretty( 'email' ); |
|
734 | + function espresso_organization_email($echo = TRUE) { |
|
735 | + if ($echo) { |
|
736 | + echo EE_Registry::instance()->CFG->organization->get_pretty('email'); |
|
737 | 737 | return ''; |
738 | 738 | } |
739 | - return EE_Registry::instance()->CFG->organization->get_pretty( 'email' ); |
|
739 | + return EE_Registry::instance()->CFG->organization->get_pretty('email'); |
|
740 | 740 | } |
741 | 741 | } |
742 | 742 | |
743 | -if ( ! function_exists( 'espresso_organization_logo_url' )) { |
|
743 | +if ( ! function_exists('espresso_organization_logo_url')) { |
|
744 | 744 | /** |
745 | 745 | * espresso_organization_logo_url |
746 | 746 | * @param bool $echo |
747 | 747 | * @return string |
748 | 748 | */ |
749 | - function espresso_organization_logo_url( $echo = TRUE ) { |
|
750 | - if($echo){ |
|
751 | - echo EE_Registry::instance()->CFG->organization->get_pretty( 'logo_url' ); |
|
749 | + function espresso_organization_logo_url($echo = TRUE) { |
|
750 | + if ($echo) { |
|
751 | + echo EE_Registry::instance()->CFG->organization->get_pretty('logo_url'); |
|
752 | 752 | return ''; |
753 | 753 | } |
754 | - return EE_Registry::instance()->CFG->organization->get_pretty( 'logo_url' ); |
|
754 | + return EE_Registry::instance()->CFG->organization->get_pretty('logo_url'); |
|
755 | 755 | } |
756 | 756 | } |
757 | 757 | |
758 | -if ( ! function_exists( 'espresso_organization_facebook' )) { |
|
758 | +if ( ! function_exists('espresso_organization_facebook')) { |
|
759 | 759 | /** |
760 | 760 | * espresso_organization_facebook |
761 | 761 | * @param bool $echo |
762 | 762 | * @return string |
763 | 763 | */ |
764 | - function espresso_organization_facebook( $echo = TRUE ) { |
|
765 | - if($echo){ |
|
766 | - echo EE_Registry::instance()->CFG->organization->get_pretty( 'facebook' ); |
|
764 | + function espresso_organization_facebook($echo = TRUE) { |
|
765 | + if ($echo) { |
|
766 | + echo EE_Registry::instance()->CFG->organization->get_pretty('facebook'); |
|
767 | 767 | return ''; |
768 | 768 | } |
769 | - return EE_Registry::instance()->CFG->organization->get_pretty( 'facebook' ); |
|
769 | + return EE_Registry::instance()->CFG->organization->get_pretty('facebook'); |
|
770 | 770 | } |
771 | 771 | } |
772 | 772 | |
773 | -if ( ! function_exists( 'espresso_organization_twitter' )) { |
|
773 | +if ( ! function_exists('espresso_organization_twitter')) { |
|
774 | 774 | /** |
775 | 775 | * espresso_organization_twitter |
776 | 776 | * @param bool $echo |
777 | 777 | * @return string |
778 | 778 | */ |
779 | - function espresso_organization_twitter( $echo = TRUE ) { |
|
780 | - if($echo){ |
|
781 | - echo EE_Registry::instance()->CFG->organization->get_pretty( 'twitter' ); |
|
779 | + function espresso_organization_twitter($echo = TRUE) { |
|
780 | + if ($echo) { |
|
781 | + echo EE_Registry::instance()->CFG->organization->get_pretty('twitter'); |
|
782 | 782 | return ''; |
783 | 783 | } |
784 | - return EE_Registry::instance()->CFG->organization->get_pretty( 'twitter' ); |
|
784 | + return EE_Registry::instance()->CFG->organization->get_pretty('twitter'); |
|
785 | 785 | } |
786 | 786 | } |
787 | 787 | |
788 | -if ( ! function_exists( 'espresso_organization_linkedin' )) { |
|
788 | +if ( ! function_exists('espresso_organization_linkedin')) { |
|
789 | 789 | /** |
790 | 790 | * espresso_organization_linkedin |
791 | 791 | * @param bool $echo |
792 | 792 | * @return string |
793 | 793 | */ |
794 | - function espresso_organization_linkedin( $echo = TRUE ) { |
|
795 | - if($echo){ |
|
796 | - echo EE_Registry::instance()->CFG->organization->get_pretty( 'linkedin' ); |
|
794 | + function espresso_organization_linkedin($echo = TRUE) { |
|
795 | + if ($echo) { |
|
796 | + echo EE_Registry::instance()->CFG->organization->get_pretty('linkedin'); |
|
797 | 797 | return ''; |
798 | 798 | } |
799 | - return EE_Registry::instance()->CFG->organization->get_pretty( 'linkedin' ); |
|
799 | + return EE_Registry::instance()->CFG->organization->get_pretty('linkedin'); |
|
800 | 800 | } |
801 | 801 | } |
802 | 802 | |
803 | -if ( ! function_exists( 'espresso_organization_pinterest' )) { |
|
803 | +if ( ! function_exists('espresso_organization_pinterest')) { |
|
804 | 804 | /** |
805 | 805 | * espresso_organization_pinterest |
806 | 806 | * @param bool $echo |
807 | 807 | * @return string |
808 | 808 | */ |
809 | - function espresso_organization_pinterest( $echo = TRUE ) { |
|
810 | - if($echo){ |
|
811 | - echo EE_Registry::instance()->CFG->organization->get_pretty( 'pinterest' ); |
|
809 | + function espresso_organization_pinterest($echo = TRUE) { |
|
810 | + if ($echo) { |
|
811 | + echo EE_Registry::instance()->CFG->organization->get_pretty('pinterest'); |
|
812 | 812 | return ''; |
813 | 813 | } |
814 | - return EE_Registry::instance()->CFG->organization->get_pretty( 'pinterest' ); |
|
814 | + return EE_Registry::instance()->CFG->organization->get_pretty('pinterest'); |
|
815 | 815 | } |
816 | 816 | } |
817 | 817 | |
818 | -if ( ! function_exists( 'espresso_organization_google' )) { |
|
818 | +if ( ! function_exists('espresso_organization_google')) { |
|
819 | 819 | /** |
820 | 820 | * espresso_organization_google |
821 | 821 | * @param bool $echo |
822 | 822 | * @return string |
823 | 823 | */ |
824 | - function espresso_organization_google( $echo = TRUE ) { |
|
825 | - if($echo){ |
|
826 | - echo EE_Registry::instance()->CFG->organization->get_pretty( 'google' ); |
|
824 | + function espresso_organization_google($echo = TRUE) { |
|
825 | + if ($echo) { |
|
826 | + echo EE_Registry::instance()->CFG->organization->get_pretty('google'); |
|
827 | 827 | return ''; |
828 | 828 | } |
829 | - return EE_Registry::instance()->CFG->organization->get_pretty( 'google' ); |
|
829 | + return EE_Registry::instance()->CFG->organization->get_pretty('google'); |
|
830 | 830 | } |
831 | 831 | } |
832 | 832 | |
833 | -if ( ! function_exists( 'espresso_organization_instagram' )) { |
|
833 | +if ( ! function_exists('espresso_organization_instagram')) { |
|
834 | 834 | /** |
835 | 835 | * espresso_organization_instagram |
836 | 836 | * @param bool $echo |
837 | 837 | * @return string |
838 | 838 | */ |
839 | - function espresso_organization_instagram( $echo = TRUE ) { |
|
840 | - if($echo){ |
|
841 | - echo EE_Registry::instance()->CFG->organization->get_pretty( 'instagram' ); |
|
839 | + function espresso_organization_instagram($echo = TRUE) { |
|
840 | + if ($echo) { |
|
841 | + echo EE_Registry::instance()->CFG->organization->get_pretty('instagram'); |
|
842 | 842 | return ''; |
843 | 843 | } |
844 | - return EE_Registry::instance()->CFG->organization->get_pretty( 'instagram' ); |
|
844 | + return EE_Registry::instance()->CFG->organization->get_pretty('instagram'); |
|
845 | 845 | } |
846 | 846 | } |
847 | 847 | |
@@ -851,7 +851,7 @@ discard block |
||
851 | 851 | |
852 | 852 | |
853 | 853 | |
854 | -if ( ! function_exists( 'espresso_event_venues' )) { |
|
854 | +if ( ! function_exists('espresso_event_venues')) { |
|
855 | 855 | /** |
856 | 856 | * espresso_event_venues |
857 | 857 | * |
@@ -865,7 +865,7 @@ discard block |
||
865 | 865 | |
866 | 866 | |
867 | 867 | |
868 | -if ( ! function_exists( 'espresso_venue_id' )) { |
|
868 | +if ( ! function_exists('espresso_venue_id')) { |
|
869 | 869 | /** |
870 | 870 | * espresso_venue_name |
871 | 871 | * |
@@ -873,15 +873,15 @@ discard block |
||
873 | 873 | * @param int $EVT_ID |
874 | 874 | * @return string |
875 | 875 | */ |
876 | - function espresso_venue_id( $EVT_ID = 0 ) { |
|
877 | - $venue = EEH_Venue_View::get_venue( $EVT_ID ); |
|
876 | + function espresso_venue_id($EVT_ID = 0) { |
|
877 | + $venue = EEH_Venue_View::get_venue($EVT_ID); |
|
878 | 878 | return $venue instanceof EE_Venue ? $venue->ID() : 0; |
879 | 879 | } |
880 | 880 | } |
881 | 881 | |
882 | 882 | |
883 | 883 | |
884 | -if ( ! function_exists( 'espresso_is_venue_private' ) ) { |
|
884 | +if ( ! function_exists('espresso_is_venue_private')) { |
|
885 | 885 | /** |
886 | 886 | * Return whether a venue is private or not. |
887 | 887 | * @see EEH_Venue_View::get_venue() for more info on expected return results. |
@@ -890,45 +890,45 @@ discard block |
||
890 | 890 | * |
891 | 891 | * @return bool | null |
892 | 892 | */ |
893 | - function espresso_is_venue_private( $VNU_ID = 0 ) { |
|
894 | - return EEH_Venue_View::is_venue_private( $VNU_ID ); |
|
893 | + function espresso_is_venue_private($VNU_ID = 0) { |
|
894 | + return EEH_Venue_View::is_venue_private($VNU_ID); |
|
895 | 895 | } |
896 | 896 | } |
897 | 897 | |
898 | 898 | |
899 | 899 | |
900 | -if ( ! function_exists( 'espresso_venue_is_password_protected' ) ) { |
|
900 | +if ( ! function_exists('espresso_venue_is_password_protected')) { |
|
901 | 901 | /** |
902 | 902 | * returns true or false if a venue is password protected or not |
903 | 903 | * |
904 | 904 | * @param int $VNU_ID optional, the venue id to check. |
905 | 905 | * @return string |
906 | 906 | */ |
907 | - function espresso_venue_is_password_protected( $VNU_ID = 0 ) { |
|
908 | - EE_Registry::instance()->load_helper( 'Venue_View' ); |
|
909 | - return EEH_Venue_View::is_venue_password_protected( $VNU_ID ); |
|
907 | + function espresso_venue_is_password_protected($VNU_ID = 0) { |
|
908 | + EE_Registry::instance()->load_helper('Venue_View'); |
|
909 | + return EEH_Venue_View::is_venue_password_protected($VNU_ID); |
|
910 | 910 | } |
911 | 911 | } |
912 | 912 | |
913 | 913 | |
914 | 914 | |
915 | -if ( ! function_exists( 'espresso_password_protected_venue_form' ) ) { |
|
915 | +if ( ! function_exists('espresso_password_protected_venue_form')) { |
|
916 | 916 | /** |
917 | 917 | * Returns a password form if venue is password protected. |
918 | 918 | * |
919 | 919 | * @param int $VNU_ID optional, the venue id to check. |
920 | 920 | * @return string |
921 | 921 | */ |
922 | - function espresso_password_protected_venue_form( $VNU_ID = 0 ) { |
|
923 | - EE_Registry::instance()->load_helper( 'Venue_View' ); |
|
924 | - return EEH_Venue_View::password_protected_venue_form( $VNU_ID ); |
|
922 | + function espresso_password_protected_venue_form($VNU_ID = 0) { |
|
923 | + EE_Registry::instance()->load_helper('Venue_View'); |
|
924 | + return EEH_Venue_View::password_protected_venue_form($VNU_ID); |
|
925 | 925 | } |
926 | 926 | } |
927 | 927 | |
928 | 928 | |
929 | 929 | |
930 | 930 | |
931 | -if ( ! function_exists( 'espresso_venue_name' )) { |
|
931 | +if ( ! function_exists('espresso_venue_name')) { |
|
932 | 932 | /** |
933 | 933 | * espresso_venue_name |
934 | 934 | * |
@@ -938,19 +938,19 @@ discard block |
||
938 | 938 | * @param bool $echo |
939 | 939 | * @return string |
940 | 940 | */ |
941 | - function espresso_venue_name( $VNU_ID = 0, $link_to = 'details', $echo = TRUE ) { |
|
942 | - if($echo){ |
|
943 | - echo EEH_Venue_View::venue_name( $link_to, $VNU_ID ); |
|
941 | + function espresso_venue_name($VNU_ID = 0, $link_to = 'details', $echo = TRUE) { |
|
942 | + if ($echo) { |
|
943 | + echo EEH_Venue_View::venue_name($link_to, $VNU_ID); |
|
944 | 944 | return ''; |
945 | 945 | } |
946 | - return EEH_Venue_View::venue_name( $link_to, $VNU_ID ); |
|
946 | + return EEH_Venue_View::venue_name($link_to, $VNU_ID); |
|
947 | 947 | } |
948 | 948 | } |
949 | 949 | |
950 | 950 | |
951 | 951 | |
952 | 952 | |
953 | -if ( ! function_exists( 'espresso_venue_link' )) { |
|
953 | +if ( ! function_exists('espresso_venue_link')) { |
|
954 | 954 | /** |
955 | 955 | * espresso_venue_link |
956 | 956 | * |
@@ -959,14 +959,14 @@ discard block |
||
959 | 959 | * @param string $text |
960 | 960 | * @return string |
961 | 961 | */ |
962 | - function espresso_venue_link( $VNU_ID = 0, $text = '' ) { |
|
963 | - return EEH_Venue_View::venue_details_link( $VNU_ID, $text ); |
|
962 | + function espresso_venue_link($VNU_ID = 0, $text = '') { |
|
963 | + return EEH_Venue_View::venue_details_link($VNU_ID, $text); |
|
964 | 964 | } |
965 | 965 | } |
966 | 966 | |
967 | 967 | |
968 | 968 | |
969 | -if ( ! function_exists( 'espresso_venue_description' )) { |
|
969 | +if ( ! function_exists('espresso_venue_description')) { |
|
970 | 970 | /** |
971 | 971 | * espresso_venue_description |
972 | 972 | * |
@@ -975,17 +975,17 @@ discard block |
||
975 | 975 | * @param bool $echo |
976 | 976 | * @return string |
977 | 977 | */ |
978 | - function espresso_venue_description( $VNU_ID = FALSE, $echo = TRUE ) { |
|
979 | - if($echo){ |
|
980 | - echo EEH_Venue_View::venue_description( $VNU_ID ); |
|
978 | + function espresso_venue_description($VNU_ID = FALSE, $echo = TRUE) { |
|
979 | + if ($echo) { |
|
980 | + echo EEH_Venue_View::venue_description($VNU_ID); |
|
981 | 981 | return ''; |
982 | 982 | } |
983 | - return EEH_Venue_View::venue_description( $VNU_ID ); |
|
983 | + return EEH_Venue_View::venue_description($VNU_ID); |
|
984 | 984 | } |
985 | 985 | } |
986 | 986 | |
987 | 987 | |
988 | -if ( ! function_exists( 'espresso_venue_excerpt' )) { |
|
988 | +if ( ! function_exists('espresso_venue_excerpt')) { |
|
989 | 989 | /** |
990 | 990 | * espresso_venue_excerpt |
991 | 991 | * |
@@ -994,18 +994,18 @@ discard block |
||
994 | 994 | * @param bool $echo |
995 | 995 | * @return string |
996 | 996 | */ |
997 | - function espresso_venue_excerpt( $VNU_ID = 0, $echo = TRUE ) { |
|
998 | - if ( $echo ) { |
|
999 | - echo EEH_Venue_View::venue_excerpt( $VNU_ID ); |
|
997 | + function espresso_venue_excerpt($VNU_ID = 0, $echo = TRUE) { |
|
998 | + if ($echo) { |
|
999 | + echo EEH_Venue_View::venue_excerpt($VNU_ID); |
|
1000 | 1000 | return ''; |
1001 | 1001 | } |
1002 | - return EEH_Venue_View::venue_excerpt( $VNU_ID ); |
|
1002 | + return EEH_Venue_View::venue_excerpt($VNU_ID); |
|
1003 | 1003 | } |
1004 | 1004 | } |
1005 | 1005 | |
1006 | 1006 | |
1007 | 1007 | |
1008 | -if ( ! function_exists( 'espresso_venue_categories' )) { |
|
1008 | +if ( ! function_exists('espresso_venue_categories')) { |
|
1009 | 1009 | /** |
1010 | 1010 | * espresso_venue_categories |
1011 | 1011 | * returns the terms associated with a venue |
@@ -1015,17 +1015,17 @@ discard block |
||
1015 | 1015 | * @param bool $echo |
1016 | 1016 | * @return string |
1017 | 1017 | */ |
1018 | - function espresso_venue_categories( $VNU_ID = 0, $hide_uncategorized = TRUE, $echo = TRUE ) { |
|
1019 | - if ( $echo ) { |
|
1020 | - echo EEH_Venue_View::venue_categories( $VNU_ID, $hide_uncategorized ); |
|
1018 | + function espresso_venue_categories($VNU_ID = 0, $hide_uncategorized = TRUE, $echo = TRUE) { |
|
1019 | + if ($echo) { |
|
1020 | + echo EEH_Venue_View::venue_categories($VNU_ID, $hide_uncategorized); |
|
1021 | 1021 | return ''; |
1022 | 1022 | } |
1023 | - return EEH_Venue_View::venue_categories( $VNU_ID, $hide_uncategorized ); |
|
1023 | + return EEH_Venue_View::venue_categories($VNU_ID, $hide_uncategorized); |
|
1024 | 1024 | } |
1025 | 1025 | } |
1026 | 1026 | |
1027 | 1027 | |
1028 | -if ( ! function_exists( 'espresso_venue_address' )) { |
|
1028 | +if ( ! function_exists('espresso_venue_address')) { |
|
1029 | 1029 | /** |
1030 | 1030 | * espresso_venue_address |
1031 | 1031 | * returns a formatted block of html for displaying a venue's address |
@@ -1035,17 +1035,17 @@ discard block |
||
1035 | 1035 | * @param bool $echo |
1036 | 1036 | * @return string |
1037 | 1037 | */ |
1038 | - function espresso_venue_address( $type = 'multiline', $VNU_ID = 0, $echo = TRUE ) { |
|
1039 | - if ( $echo ) { |
|
1040 | - echo EEH_Venue_View::venue_address( $type, $VNU_ID ); |
|
1038 | + function espresso_venue_address($type = 'multiline', $VNU_ID = 0, $echo = TRUE) { |
|
1039 | + if ($echo) { |
|
1040 | + echo EEH_Venue_View::venue_address($type, $VNU_ID); |
|
1041 | 1041 | return ''; |
1042 | 1042 | } |
1043 | - return EEH_Venue_View::venue_address( $type, $VNU_ID ); |
|
1043 | + return EEH_Venue_View::venue_address($type, $VNU_ID); |
|
1044 | 1044 | } |
1045 | 1045 | } |
1046 | 1046 | |
1047 | 1047 | |
1048 | -if ( ! function_exists( 'espresso_venue_raw_address' )) { |
|
1048 | +if ( ! function_exists('espresso_venue_raw_address')) { |
|
1049 | 1049 | /** |
1050 | 1050 | * espresso_venue_address |
1051 | 1051 | * returns an UN-formatted string containing a venue's address |
@@ -1055,17 +1055,17 @@ discard block |
||
1055 | 1055 | * @param bool $echo |
1056 | 1056 | * @return string |
1057 | 1057 | */ |
1058 | - function espresso_venue_raw_address( $type = 'multiline', $VNU_ID = 0, $echo = TRUE ) { |
|
1059 | - if ( $echo ) { |
|
1060 | - echo EEH_Venue_View::venue_address( $type, $VNU_ID, FALSE, FALSE ); |
|
1058 | + function espresso_venue_raw_address($type = 'multiline', $VNU_ID = 0, $echo = TRUE) { |
|
1059 | + if ($echo) { |
|
1060 | + echo EEH_Venue_View::venue_address($type, $VNU_ID, FALSE, FALSE); |
|
1061 | 1061 | return ''; |
1062 | 1062 | } |
1063 | - return EEH_Venue_View::venue_address( $type, $VNU_ID, FALSE, FALSE ); |
|
1063 | + return EEH_Venue_View::venue_address($type, $VNU_ID, FALSE, FALSE); |
|
1064 | 1064 | } |
1065 | 1065 | } |
1066 | 1066 | |
1067 | 1067 | |
1068 | -if ( ! function_exists( 'espresso_venue_has_address' )) { |
|
1068 | +if ( ! function_exists('espresso_venue_has_address')) { |
|
1069 | 1069 | /** |
1070 | 1070 | * espresso_venue_has_address |
1071 | 1071 | * returns TRUE or FALSE if a Venue has address information |
@@ -1073,13 +1073,13 @@ discard block |
||
1073 | 1073 | * @param int $VNU_ID |
1074 | 1074 | * @return bool |
1075 | 1075 | */ |
1076 | - function espresso_venue_has_address( $VNU_ID = 0 ) { |
|
1077 | - return EEH_Venue_View::venue_has_address( $VNU_ID ); |
|
1076 | + function espresso_venue_has_address($VNU_ID = 0) { |
|
1077 | + return EEH_Venue_View::venue_has_address($VNU_ID); |
|
1078 | 1078 | } |
1079 | 1079 | } |
1080 | 1080 | |
1081 | 1081 | |
1082 | -if ( ! function_exists( 'espresso_venue_gmap' )) { |
|
1082 | +if ( ! function_exists('espresso_venue_gmap')) { |
|
1083 | 1083 | /** |
1084 | 1084 | * espresso_venue_gmap |
1085 | 1085 | * returns a google map for the venue address |
@@ -1090,17 +1090,17 @@ discard block |
||
1090 | 1090 | * @param bool $echo |
1091 | 1091 | * @return string |
1092 | 1092 | */ |
1093 | - function espresso_venue_gmap( $VNU_ID = 0, $map_ID = FALSE, $gmap = array(), $echo = TRUE ) { |
|
1094 | - if ( $echo ) { |
|
1095 | - echo EEH_Venue_View::venue_gmap( $VNU_ID, $map_ID, $gmap ); |
|
1093 | + function espresso_venue_gmap($VNU_ID = 0, $map_ID = FALSE, $gmap = array(), $echo = TRUE) { |
|
1094 | + if ($echo) { |
|
1095 | + echo EEH_Venue_View::venue_gmap($VNU_ID, $map_ID, $gmap); |
|
1096 | 1096 | return ''; |
1097 | 1097 | } |
1098 | - return EEH_Venue_View::venue_gmap( $VNU_ID, $map_ID, $gmap ); |
|
1098 | + return EEH_Venue_View::venue_gmap($VNU_ID, $map_ID, $gmap); |
|
1099 | 1099 | } |
1100 | 1100 | } |
1101 | 1101 | |
1102 | 1102 | |
1103 | -if ( ! function_exists( 'espresso_venue_phone' )) { |
|
1103 | +if ( ! function_exists('espresso_venue_phone')) { |
|
1104 | 1104 | /** |
1105 | 1105 | * espresso_venue_phone |
1106 | 1106 | * |
@@ -1108,18 +1108,18 @@ discard block |
||
1108 | 1108 | * @param bool $echo |
1109 | 1109 | * @return string |
1110 | 1110 | */ |
1111 | - function espresso_venue_phone( $VNU_ID = 0, $echo = TRUE ) { |
|
1112 | - if ( $echo ) { |
|
1113 | - echo EEH_Venue_View::venue_phone( $VNU_ID ); |
|
1111 | + function espresso_venue_phone($VNU_ID = 0, $echo = TRUE) { |
|
1112 | + if ($echo) { |
|
1113 | + echo EEH_Venue_View::venue_phone($VNU_ID); |
|
1114 | 1114 | return ''; |
1115 | 1115 | } |
1116 | - return EEH_Venue_View::venue_phone( $VNU_ID ); |
|
1116 | + return EEH_Venue_View::venue_phone($VNU_ID); |
|
1117 | 1117 | } |
1118 | 1118 | } |
1119 | 1119 | |
1120 | 1120 | |
1121 | 1121 | |
1122 | -if ( ! function_exists( 'espresso_venue_website' )) { |
|
1122 | +if ( ! function_exists('espresso_venue_website')) { |
|
1123 | 1123 | /** |
1124 | 1124 | * espresso_venue_website |
1125 | 1125 | * |
@@ -1127,18 +1127,18 @@ discard block |
||
1127 | 1127 | * @param bool $echo |
1128 | 1128 | * @return string |
1129 | 1129 | */ |
1130 | - function espresso_venue_website( $VNU_ID = 0, $echo = TRUE ) { |
|
1131 | - if ( $echo ) { |
|
1132 | - echo EEH_Venue_View::venue_website_link( $VNU_ID ); |
|
1130 | + function espresso_venue_website($VNU_ID = 0, $echo = TRUE) { |
|
1131 | + if ($echo) { |
|
1132 | + echo EEH_Venue_View::venue_website_link($VNU_ID); |
|
1133 | 1133 | return ''; |
1134 | 1134 | } |
1135 | - return EEH_Venue_View::venue_website_link( $VNU_ID ); |
|
1135 | + return EEH_Venue_View::venue_website_link($VNU_ID); |
|
1136 | 1136 | } |
1137 | 1137 | } |
1138 | 1138 | |
1139 | 1139 | |
1140 | 1140 | |
1141 | -if ( ! function_exists( 'espresso_edit_venue_link' )) { |
|
1141 | +if ( ! function_exists('espresso_edit_venue_link')) { |
|
1142 | 1142 | /** |
1143 | 1143 | * espresso_edit_venue_link |
1144 | 1144 | * |
@@ -1146,12 +1146,12 @@ discard block |
||
1146 | 1146 | * @param bool $echo |
1147 | 1147 | * @return string |
1148 | 1148 | */ |
1149 | - function espresso_edit_venue_link( $VNU_ID = 0, $echo = TRUE ) { |
|
1150 | - if($echo){ |
|
1151 | - echo EEH_Venue_View::edit_venue_link( $VNU_ID ); |
|
1149 | + function espresso_edit_venue_link($VNU_ID = 0, $echo = TRUE) { |
|
1150 | + if ($echo) { |
|
1151 | + echo EEH_Venue_View::edit_venue_link($VNU_ID); |
|
1152 | 1152 | return ''; |
1153 | 1153 | } |
1154 | - return EEH_Venue_View::edit_venue_link( $VNU_ID ); |
|
1154 | + return EEH_Venue_View::edit_venue_link($VNU_ID); |
|
1155 | 1155 | } |
1156 | 1156 | } |
1157 | 1157 |
@@ -143,7 +143,7 @@ discard block |
||
143 | 143 | * can_use_espresso_conditionals |
144 | 144 | * tests whether the Espresso Conditional tags like is_espresso_event_single() can be called |
145 | 145 | * |
146 | - * @param $conditional_tag |
|
146 | + * @param string $conditional_tag |
|
147 | 147 | * @return bool |
148 | 148 | */ |
149 | 149 | function can_use_espresso_conditionals( $conditional_tag ) { |
@@ -214,7 +214,7 @@ discard block |
||
214 | 214 | if ( ! function_exists( 'espresso_ticket_selector' )) { |
215 | 215 | /** |
216 | 216 | * espresso_ticket_selector |
217 | - * @param null $event |
|
217 | + * @param EE_Base_Class|null $event |
|
218 | 218 | */ |
219 | 219 | function espresso_ticket_selector( $event = NULL ) { |
220 | 220 | if ( ! apply_filters( 'FHEE_disable_espresso_ticket_selector', FALSE ) ) { |
@@ -855,7 +855,7 @@ discard block |
||
855 | 855 | /** |
856 | 856 | * espresso_event_venues |
857 | 857 | * |
858 | - * @return array all venues related to an event |
|
858 | + * @return EE_Venue[] all venues related to an event |
|
859 | 859 | */ |
860 | 860 | function espresso_event_venues() { |
861 | 861 | return EEH_Venue_View::get_event_venues(); |
@@ -888,7 +888,7 @@ discard block |
||
888 | 888 | * |
889 | 889 | * @param int $VNU_ID optional, the venue id to check. |
890 | 890 | * |
891 | - * @return bool | null |
|
891 | + * @return null|boolean | null |
|
892 | 892 | */ |
893 | 893 | function espresso_is_venue_private( $VNU_ID = 0 ) { |
894 | 894 | return EEH_Venue_View::is_venue_private( $VNU_ID ); |
@@ -902,7 +902,7 @@ discard block |
||
902 | 902 | * returns true or false if a venue is password protected or not |
903 | 903 | * |
904 | 904 | * @param int $VNU_ID optional, the venue id to check. |
905 | - * @return string |
|
905 | + * @return boolean |
|
906 | 906 | */ |
907 | 907 | function espresso_venue_is_password_protected( $VNU_ID = 0 ) { |
908 | 908 | EE_Registry::instance()->load_helper( 'Venue_View' ); |
@@ -1,8 +1,8 @@ discard block |
||
1 | 1 | <?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
2 | 2 | exit('No direct script access allowed'); |
3 | 3 | } |
4 | -require_once( EE_MODELS . 'EEM_Soft_Delete_Base.model.php' ); |
|
5 | -require_once( EE_CLASSES . 'EE_Question.class.php' ); |
|
4 | +require_once(EE_MODELS.'EEM_Soft_Delete_Base.model.php'); |
|
5 | +require_once(EE_CLASSES.'EE_Question.class.php'); |
|
6 | 6 | |
7 | 7 | |
8 | 8 | |
@@ -101,52 +101,52 @@ discard block |
||
101 | 101 | * |
102 | 102 | * @param null $timezone |
103 | 103 | */ |
104 | - protected function __construct( $timezone = NULL ) { |
|
105 | - $this->singular_item = __('Question','event_espresso'); |
|
106 | - $this->plural_item = __('Questions','event_espresso'); |
|
107 | - $this->_allowed_question_types=apply_filters( |
|
104 | + protected function __construct($timezone = NULL) { |
|
105 | + $this->singular_item = __('Question', 'event_espresso'); |
|
106 | + $this->plural_item = __('Questions', 'event_espresso'); |
|
107 | + $this->_allowed_question_types = apply_filters( |
|
108 | 108 | 'FHEE__EEM_Question__construct__allowed_question_types', |
109 | 109 | array( |
110 | - EEM_Question::QST_type_text =>__('Text','event_espresso'), |
|
111 | - EEM_Question::QST_type_textarea =>__('Textarea','event_espresso'), |
|
112 | - EEM_Question::QST_type_checkbox =>__('Checkboxes','event_espresso'), |
|
113 | - EEM_Question::QST_type_radio =>__('Radio Buttons','event_espresso'), |
|
114 | - EEM_Question::QST_type_dropdown =>__('Dropdown','event_espresso'), |
|
115 | - EEM_Question::QST_type_state =>__('State/Province Dropdown','event_espresso'), |
|
116 | - EEM_Question::QST_type_country =>__('Country Dropdown','event_espresso'), |
|
117 | - EEM_Question::QST_type_date =>__('Date Picker','event_espresso'), |
|
118 | - EEM_Question::QST_type_html_textarea => __( 'HTML Textarea', 'event_espresso' ), |
|
119 | - EEM_Question::QST_type_email => __( 'Email', 'event_espresso' ), |
|
120 | - EEM_Question::QST_type_us_phone => __( 'USA - Format Phone', 'event_espresso' ), |
|
121 | - EEM_Question::QST_type_decimal => __( 'Number', 'event_espresso' ), |
|
122 | - EEM_Question::QST_type_int => __( 'Whole Number', 'event_espresso' ), |
|
123 | - EEM_Question::QST_type_url => __( 'URL', 'event_espresso' ), |
|
124 | - EEM_Question::QST_type_year => __( 'Year', 'event_espresso' ), |
|
125 | - EEM_Question::QST_type_multi_select => __( 'Multi Select', 'event_espresso' ) |
|
110 | + EEM_Question::QST_type_text =>__('Text', 'event_espresso'), |
|
111 | + EEM_Question::QST_type_textarea =>__('Textarea', 'event_espresso'), |
|
112 | + EEM_Question::QST_type_checkbox =>__('Checkboxes', 'event_espresso'), |
|
113 | + EEM_Question::QST_type_radio =>__('Radio Buttons', 'event_espresso'), |
|
114 | + EEM_Question::QST_type_dropdown =>__('Dropdown', 'event_espresso'), |
|
115 | + EEM_Question::QST_type_state =>__('State/Province Dropdown', 'event_espresso'), |
|
116 | + EEM_Question::QST_type_country =>__('Country Dropdown', 'event_espresso'), |
|
117 | + EEM_Question::QST_type_date =>__('Date Picker', 'event_espresso'), |
|
118 | + EEM_Question::QST_type_html_textarea => __('HTML Textarea', 'event_espresso'), |
|
119 | + EEM_Question::QST_type_email => __('Email', 'event_espresso'), |
|
120 | + EEM_Question::QST_type_us_phone => __('USA - Format Phone', 'event_espresso'), |
|
121 | + EEM_Question::QST_type_decimal => __('Number', 'event_espresso'), |
|
122 | + EEM_Question::QST_type_int => __('Whole Number', 'event_espresso'), |
|
123 | + EEM_Question::QST_type_url => __('URL', 'event_espresso'), |
|
124 | + EEM_Question::QST_type_year => __('Year', 'event_espresso'), |
|
125 | + EEM_Question::QST_type_multi_select => __('Multi Select', 'event_espresso') |
|
126 | 126 | ) |
127 | 127 | ); |
128 | 128 | $this->_question_descriptions = apply_filters( |
129 | 129 | 'FHEE__EEM_Question__construct__allowed_question_types', |
130 | 130 | array( |
131 | - EEM_Question::QST_type_text => __( 'A single line text input field', 'event_espresso' ), |
|
132 | - EEM_Question::QST_type_textarea => __( 'A multi line text input field', 'event_espresso' ), |
|
133 | - EEM_Question::QST_type_checkbox => __( 'Allows multiple preset options to be selected', 'event_espresso' ), |
|
134 | - EEM_Question::QST_type_radio => __( 'Allows a single preset option to be selected', 'event_espresso' ), |
|
135 | - EEM_Question::QST_type_dropdown => __( 'A dropdown that allows a single selection', 'event_espresso' ), |
|
136 | - EEM_Question::QST_type_state => __( 'A dropdown that lists states/provinces', 'event_espresso' ), |
|
137 | - EEM_Question::QST_type_country => __( 'A dropdown that lists countries', 'event_espresso' ), |
|
138 | - EEM_Question::QST_type_date => __( 'A popup calendar that allows date selections', 'event_espresso' ), |
|
139 | - EEM_Question::QST_type_html_textarea => __( 'A multi line text input field that allows HTML', 'event_espresso' ), |
|
140 | - EEM_Question::QST_type_email => __( 'A text field that must contain a valid Email address', 'event_espresso' ), |
|
141 | - EEM_Question::QST_type_us_phone => __( 'A text field that must contain a valid US phone number', 'event_espresso' ), |
|
142 | - EEM_Question::QST_type_decimal => __( 'A text field that allows number values with decimals', 'event_espresso' ), |
|
143 | - EEM_Question::QST_type_int => __( 'A text field that only allows whole numbers (no decimals)', 'event_espresso' ), |
|
144 | - EEM_Question::QST_type_url => __( 'A text field that must contain a valid URL', 'event_espresso' ), |
|
145 | - EEM_Question::QST_type_year => __( 'A dropdown that lists the last 100 years', 'event_espresso' ), |
|
146 | - EEM_Question::QST_type_multi_select => __( 'A dropdown that allows multiple selections', 'event_espresso' ) |
|
131 | + EEM_Question::QST_type_text => __('A single line text input field', 'event_espresso'), |
|
132 | + EEM_Question::QST_type_textarea => __('A multi line text input field', 'event_espresso'), |
|
133 | + EEM_Question::QST_type_checkbox => __('Allows multiple preset options to be selected', 'event_espresso'), |
|
134 | + EEM_Question::QST_type_radio => __('Allows a single preset option to be selected', 'event_espresso'), |
|
135 | + EEM_Question::QST_type_dropdown => __('A dropdown that allows a single selection', 'event_espresso'), |
|
136 | + EEM_Question::QST_type_state => __('A dropdown that lists states/provinces', 'event_espresso'), |
|
137 | + EEM_Question::QST_type_country => __('A dropdown that lists countries', 'event_espresso'), |
|
138 | + EEM_Question::QST_type_date => __('A popup calendar that allows date selections', 'event_espresso'), |
|
139 | + EEM_Question::QST_type_html_textarea => __('A multi line text input field that allows HTML', 'event_espresso'), |
|
140 | + EEM_Question::QST_type_email => __('A text field that must contain a valid Email address', 'event_espresso'), |
|
141 | + EEM_Question::QST_type_us_phone => __('A text field that must contain a valid US phone number', 'event_espresso'), |
|
142 | + EEM_Question::QST_type_decimal => __('A text field that allows number values with decimals', 'event_espresso'), |
|
143 | + EEM_Question::QST_type_int => __('A text field that only allows whole numbers (no decimals)', 'event_espresso'), |
|
144 | + EEM_Question::QST_type_url => __('A text field that must contain a valid URL', 'event_espresso'), |
|
145 | + EEM_Question::QST_type_year => __('A dropdown that lists the last 100 years', 'event_espresso'), |
|
146 | + EEM_Question::QST_type_multi_select => __('A dropdown that allows multiple selections', 'event_espresso') |
|
147 | 147 | ) |
148 | 148 | ); |
149 | - $this->_question_type_categories = (array)apply_filters( |
|
149 | + $this->_question_type_categories = (array) apply_filters( |
|
150 | 150 | 'FHEE__EEM_Question__construct__question_type_categories', |
151 | 151 | array( |
152 | 152 | 'text' => array( |
@@ -171,22 +171,22 @@ discard block |
||
171 | 171 | ); |
172 | 172 | |
173 | 173 | $this->_tables = array( |
174 | - 'Question'=>new EE_Primary_Table('esp_question','QST_ID') |
|
174 | + 'Question'=>new EE_Primary_Table('esp_question', 'QST_ID') |
|
175 | 175 | ); |
176 | 176 | $this->_fields = array( |
177 | 177 | 'Question'=>array( |
178 | - 'QST_ID'=>new EE_Primary_Key_Int_Field('QST_ID', __('Question ID','event_espresso')), |
|
179 | - 'QST_display_text'=>new EE_Full_HTML_Field('QST_display_text', __('Question Text','event_espresso'), true, ''), |
|
180 | - 'QST_admin_label'=>new EE_Plain_Text_Field('QST_admin_label', __('Question Label (admin-only)','event_espresso'), true, ''), |
|
181 | - 'QST_system'=>new EE_Plain_Text_Field('QST_system', __('Internal string ID for question','event_espresso'), false, '' ), |
|
182 | - 'QST_type'=>new EE_Enum_Text_Field('QST_type', __('Question Type','event_espresso'),false, 'TEXT',$this->_allowed_question_types), |
|
183 | - 'QST_required'=>new EE_Boolean_Field('QST_required', __('Required Question?','event_espresso'), false, false), |
|
184 | - 'QST_required_text'=>new EE_Simple_HTML_Field('QST_required_text', __('Text to Display if Not Provided','event_espresso'), true, ''), |
|
185 | - 'QST_order'=>new EE_Integer_Field('QST_order', __('Question Order','event_espresso'), false, 0), |
|
186 | - 'QST_admin_only'=>new EE_Boolean_Field('QST_admin_only', __('Admin-Only Question?','event_espresso'), false, false), |
|
187 | - 'QST_max' => new EE_Infinite_Integer_Field( 'QST_max', __( 'Max Size', 'event_espresso' ), false, EE_INF ), |
|
188 | - 'QST_wp_user'=>new EE_WP_User_Field('QST_wp_user', __('Question Creator ID','event_espresso'), false ), |
|
189 | - 'QST_deleted'=>new EE_Trashed_Flag_Field('QST_deleted', __('Flag Indicating question was deleted','event_espresso'), false, false) |
|
178 | + 'QST_ID'=>new EE_Primary_Key_Int_Field('QST_ID', __('Question ID', 'event_espresso')), |
|
179 | + 'QST_display_text'=>new EE_Full_HTML_Field('QST_display_text', __('Question Text', 'event_espresso'), true, ''), |
|
180 | + 'QST_admin_label'=>new EE_Plain_Text_Field('QST_admin_label', __('Question Label (admin-only)', 'event_espresso'), true, ''), |
|
181 | + 'QST_system'=>new EE_Plain_Text_Field('QST_system', __('Internal string ID for question', 'event_espresso'), false, ''), |
|
182 | + 'QST_type'=>new EE_Enum_Text_Field('QST_type', __('Question Type', 'event_espresso'), false, 'TEXT', $this->_allowed_question_types), |
|
183 | + 'QST_required'=>new EE_Boolean_Field('QST_required', __('Required Question?', 'event_espresso'), false, false), |
|
184 | + 'QST_required_text'=>new EE_Simple_HTML_Field('QST_required_text', __('Text to Display if Not Provided', 'event_espresso'), true, ''), |
|
185 | + 'QST_order'=>new EE_Integer_Field('QST_order', __('Question Order', 'event_espresso'), false, 0), |
|
186 | + 'QST_admin_only'=>new EE_Boolean_Field('QST_admin_only', __('Admin-Only Question?', 'event_espresso'), false, false), |
|
187 | + 'QST_max' => new EE_Infinite_Integer_Field('QST_max', __('Max Size', 'event_espresso'), false, EE_INF), |
|
188 | + 'QST_wp_user'=>new EE_WP_User_Field('QST_wp_user', __('Question Creator ID', 'event_espresso'), false), |
|
189 | + 'QST_deleted'=>new EE_Trashed_Flag_Field('QST_deleted', __('Flag Indicating question was deleted', 'event_espresso'), false, false) |
|
190 | 190 | ) |
191 | 191 | ); |
192 | 192 | $this->_model_relations = array( |
@@ -198,11 +198,11 @@ discard block |
||
198 | 198 | 'Question_Group_Question'=>new EE_Has_Many_Relation() |
199 | 199 | ); |
200 | 200 | //this model is generally available for reading |
201 | - $this->_cap_restriction_generators[ EEM_Base::caps_read ] = new EE_Restriction_Generator_Public(); |
|
202 | - $this->_cap_restriction_generators[ EEM_Base::caps_read_admin ] = new EE_Restriction_Generator_Reg_Form('QST_system'); |
|
203 | - $this->_cap_restriction_generators[ EEM_Base::caps_edit ] = new EE_Restriction_Generator_Reg_Form('QST_system'); |
|
204 | - $this->_cap_restriction_generators[ EEM_Base::caps_delete ] = new EE_Restriction_Generator_Reg_Form('QST_system'); |
|
205 | - parent::__construct( $timezone ); |
|
201 | + $this->_cap_restriction_generators[EEM_Base::caps_read] = new EE_Restriction_Generator_Public(); |
|
202 | + $this->_cap_restriction_generators[EEM_Base::caps_read_admin] = new EE_Restriction_Generator_Reg_Form('QST_system'); |
|
203 | + $this->_cap_restriction_generators[EEM_Base::caps_edit] = new EE_Restriction_Generator_Reg_Form('QST_system'); |
|
204 | + $this->_cap_restriction_generators[EEM_Base::caps_delete] = new EE_Restriction_Generator_Reg_Form('QST_system'); |
|
205 | + parent::__construct($timezone); |
|
206 | 206 | } |
207 | 207 | |
208 | 208 | /** |
@@ -210,7 +210,7 @@ discard block |
||
210 | 210 | * but they can be extended |
211 | 211 | * @return string[] |
212 | 212 | */ |
213 | - public function allowed_question_types(){ |
|
213 | + public function allowed_question_types() { |
|
214 | 214 | return $this->_allowed_question_types; |
215 | 215 | } |
216 | 216 | /** |
@@ -218,16 +218,16 @@ discard block |
||
218 | 218 | * @param string $question_type one of EEM_Question::allowed_question_types( |
219 | 219 | * @return string[] like EEM_Question::allowed_question_types() |
220 | 220 | */ |
221 | - public function question_types_in_same_category( $question_type ) { |
|
222 | - $question_types = array( $question_type ); |
|
223 | - foreach( $this->_question_type_categories as $category => $question_types_in_category ) { |
|
224 | - if( in_array( $question_type, $question_types_in_category ) ) { |
|
221 | + public function question_types_in_same_category($question_type) { |
|
222 | + $question_types = array($question_type); |
|
223 | + foreach ($this->_question_type_categories as $category => $question_types_in_category) { |
|
224 | + if (in_array($question_type, $question_types_in_category)) { |
|
225 | 225 | $question_types = $question_types_in_category; |
226 | 226 | break; |
227 | 227 | } |
228 | 228 | } |
229 | 229 | |
230 | - return array_intersect_key( $this->allowed_question_types(), array_flip( $question_types ) ); |
|
230 | + return array_intersect_key($this->allowed_question_types(), array_flip($question_types)); |
|
231 | 231 | } |
232 | 232 | |
233 | 233 | /** |
@@ -236,11 +236,11 @@ discard block |
||
236 | 236 | * @param string $category one of the top-level keys of EEM_Question::question_type_categories() |
237 | 237 | * @return boolean |
238 | 238 | */ |
239 | - public function question_type_is_in_category( $question_type, $category ) { |
|
240 | - if( ! isset( $this->_question_type_categories[ $category ] ) ) { |
|
239 | + public function question_type_is_in_category($question_type, $category) { |
|
240 | + if ( ! isset($this->_question_type_categories[$category])) { |
|
241 | 241 | return false; |
242 | 242 | } |
243 | - return in_array( $question_type, $this->_question_type_categories[ $category ] ); |
|
243 | + return in_array($question_type, $this->_question_type_categories[$category]); |
|
244 | 244 | } |
245 | 245 | |
246 | 246 | /** |
@@ -257,9 +257,9 @@ discard block |
||
257 | 257 | * @param string $system_question_group_id QSG_system |
258 | 258 | * @return array of system question names (QST_system) |
259 | 259 | */ |
260 | - public function allowed_system_questions_in_system_question_group( $system_question_group_id ) { |
|
260 | + public function allowed_system_questions_in_system_question_group($system_question_group_id) { |
|
261 | 261 | $question_system_ids = array(); |
262 | - switch( $system_question_group_id ) { |
|
262 | + switch ($system_question_group_id) { |
|
263 | 263 | case EEM_Question_Group::system_personal: |
264 | 264 | $question_system_ids = array( |
265 | 265 | EEM_Attendee::system_question_fname, |
@@ -280,7 +280,7 @@ discard block |
||
280 | 280 | ); |
281 | 281 | break; |
282 | 282 | } |
283 | - return apply_filters( 'FHEE__EEM_Question__system_questions_allowed_in_system_question_group__return', $question_system_ids, $system_question_group_id ); |
|
283 | + return apply_filters('FHEE__EEM_Question__system_questions_allowed_in_system_question_group__return', $question_system_ids, $system_question_group_id); |
|
284 | 284 | } |
285 | 285 | |
286 | 286 | /** |
@@ -289,11 +289,11 @@ discard block |
||
289 | 289 | * @param string $system_question_group_id QSG_system |
290 | 290 | * @return array of system question names (QST_system) |
291 | 291 | */ |
292 | - public function required_system_questions_in_system_question_group( $system_question_group_id ) { |
|
292 | + public function required_system_questions_in_system_question_group($system_question_group_id) { |
|
293 | 293 | $question_system_ids = null; |
294 | - switch( $system_question_group_id ) { |
|
294 | + switch ($system_question_group_id) { |
|
295 | 295 | case EEM_Question_Group::system_personal: |
296 | - $question_system_ids = array( |
|
296 | + $question_system_ids = array( |
|
297 | 297 | EEM_Attendee::system_question_fname, |
298 | 298 | EEM_Attendee::system_question_email, |
299 | 299 | ); |
@@ -301,7 +301,7 @@ discard block |
||
301 | 301 | default: |
302 | 302 | $question_system_ids = array(); |
303 | 303 | } |
304 | - return apply_filters( 'FHEE__EEM_Question__system_questions_required_in_system_question_group', $question_system_ids, $system_question_group_id ); |
|
304 | + return apply_filters('FHEE__EEM_Question__system_questions_required_in_system_question_group', $question_system_ids, $system_question_group_id); |
|
305 | 305 | } |
306 | 306 | |
307 | 307 | |
@@ -312,8 +312,8 @@ discard block |
||
312 | 312 | * @param $QST_system |
313 | 313 | * @return int of QST_ID for the question that corresponds to that QST_system |
314 | 314 | */ |
315 | - public function get_Question_ID_from_system_string( $QST_system ){ |
|
316 | - return $this->get_var( array( array( 'QST_system' => $QST_system ) ) ); |
|
315 | + public function get_Question_ID_from_system_string($QST_system) { |
|
316 | + return $this->get_var(array(array('QST_system' => $QST_system))); |
|
317 | 317 | } |
318 | 318 | |
319 | 319 | |
@@ -325,10 +325,10 @@ discard block |
||
325 | 325 | */ |
326 | 326 | public function get_latest_question_order() { |
327 | 327 | $columns_to_select = array( |
328 | - 'max_order' => array("MAX(QST_order)","%d") |
|
328 | + 'max_order' => array("MAX(QST_order)", "%d") |
|
329 | 329 | ); |
330 | - $max = $this->_get_all_wpdb_results( array(), ARRAY_A, $columns_to_select ); |
|
331 | - return isset( $max[0], $max[0]['max_order'] ) ? $max[0]['max_order'] : 0; |
|
330 | + $max = $this->_get_all_wpdb_results(array(), ARRAY_A, $columns_to_select); |
|
331 | + return isset($max[0], $max[0]['max_order']) ? $max[0]['max_order'] : 0; |
|
332 | 332 | } |
333 | 333 | |
334 | 334 | /** |
@@ -357,10 +357,10 @@ discard block |
||
357 | 357 | * @param string $system_question_value |
358 | 358 | * @return int|float |
359 | 359 | */ |
360 | - public function absolute_max_for_system_question( $system_question_value ) { |
|
360 | + public function absolute_max_for_system_question($system_question_value) { |
|
361 | 361 | $maxes = $this->system_question_maxes(); |
362 | - if( isset( $maxes[ $system_question_value ] ) ) { |
|
363 | - return $maxes[ $system_question_value ]; |
|
362 | + if (isset($maxes[$system_question_value])) { |
|
363 | + return $maxes[$system_question_value]; |
|
364 | 364 | } else { |
365 | 365 | return EE_INF; |
366 | 366 | } |