@@ -881,7 +881,7 @@ |
||
881 | 881 | |
882 | 882 | /** |
883 | 883 | * @deprecated 4.9.0 |
884 | - * @return array |
|
884 | + * @return EE_messenger[] |
|
885 | 885 | */ |
886 | 886 | public function get_installed_messengers() { |
887 | 887 | // EE_messages has been deprecated |
@@ -1047,7 +1047,7 @@ discard block |
||
1047 | 1047 | ); |
1048 | 1048 | do_action( |
1049 | 1049 | 'AHEE__EE_Capabilities__init_role_caps__complete', |
1050 | - $capabilities_map |
|
1050 | + $capabilities_map |
|
1051 | 1051 | ); |
1052 | 1052 | } |
1053 | 1053 | ); |
@@ -1067,9 +1067,9 @@ discard block |
||
1067 | 1067 | 'filter' |
1068 | 1068 | ); |
1069 | 1069 | return apply_filters( |
1070 | - 'FHEE_EE_Single_Page_Checkout__save_registration_items__find_existing_attendee', |
|
1071 | - $existing_attendee, $registration, $attendee_data |
|
1072 | - ); |
|
1070 | + 'FHEE_EE_Single_Page_Checkout__save_registration_items__find_existing_attendee', |
|
1071 | + $existing_attendee, $registration, $attendee_data |
|
1072 | + ); |
|
1073 | 1073 | }, |
1074 | 1074 | 10,3 |
1075 | 1075 | ); |
@@ -1082,88 +1082,88 @@ discard block |
||
1082 | 1082 | class EE_Event_List_Query extends WP_Query |
1083 | 1083 | { |
1084 | 1084 | |
1085 | - private $title; |
|
1086 | - |
|
1087 | - private $css_class; |
|
1088 | - |
|
1089 | - private $category_slug; |
|
1090 | - |
|
1091 | - /** |
|
1092 | - * EE_Event_List_Query constructor. |
|
1093 | - * |
|
1094 | - * @param array $args |
|
1095 | - */ |
|
1096 | - public function __construct($args = array()) |
|
1097 | - { |
|
1098 | - \EE_Error::doing_it_wrong( |
|
1099 | - __METHOD__, |
|
1100 | - __( |
|
1101 | - 'Usage is deprecated. Please use \EventEspresso\core\domain\services\wp_queries\EventListQuery instead.', |
|
1102 | - 'event_espresso' |
|
1103 | - ), |
|
1104 | - '4.9.27', |
|
1105 | - '5.0.0' |
|
1106 | - ); |
|
1107 | - $this->title = isset($args['title']) ? $args['title'] : ''; |
|
1108 | - $this->css_class = isset($args['css_class']) ? $args['css_class'] : ''; |
|
1109 | - $this->category_slug = isset($args['category_slug']) ? $args['category_slug'] : ''; |
|
1110 | - $limit = isset($args['limit']) && absint($args['limit']) ? $args['limit'] : 10; |
|
1111 | - // the current "page" we are viewing |
|
1112 | - $paged = max(1, get_query_var('paged')); |
|
1113 | - // Force these args |
|
1114 | - $args = array_merge( |
|
1115 | - $args, array( |
|
1116 | - 'post_type' => 'espresso_events', |
|
1117 | - 'posts_per_page' => $limit, |
|
1118 | - 'update_post_term_cache' => false, |
|
1119 | - 'update_post_meta_cache' => false, |
|
1120 | - 'paged' => $paged, |
|
1121 | - 'offset' => ($paged - 1) * $limit |
|
1122 | - ) |
|
1123 | - ); |
|
1124 | - // run the query |
|
1125 | - parent::__construct($args); |
|
1126 | - } |
|
1127 | - |
|
1128 | - |
|
1129 | - |
|
1130 | - /** |
|
1131 | - * event_list_title |
|
1132 | - * |
|
1133 | - * @param string $event_list_title |
|
1134 | - * @return string |
|
1135 | - */ |
|
1136 | - public function event_list_title($event_list_title = '') |
|
1137 | - { |
|
1138 | - if (! empty($this->title)) { |
|
1139 | - return $this->title; |
|
1140 | - } |
|
1141 | - return $event_list_title; |
|
1142 | - } |
|
1143 | - |
|
1144 | - |
|
1145 | - |
|
1146 | - /** |
|
1147 | - * event_list_css |
|
1148 | - * |
|
1149 | - * @param string $event_list_css |
|
1150 | - * @return string |
|
1151 | - */ |
|
1152 | - public function event_list_css($event_list_css = '') |
|
1153 | - { |
|
1154 | - $event_list_css .= ! empty($event_list_css) |
|
1155 | - ? ' ' |
|
1156 | - : ''; |
|
1157 | - $event_list_css .= ! empty($this->css_class) |
|
1158 | - ? $this->css_class |
|
1159 | - : ''; |
|
1160 | - $event_list_css .= ! empty($event_list_css) |
|
1161 | - ? ' ' |
|
1162 | - : ''; |
|
1163 | - $event_list_css .= ! empty($this->category_slug) |
|
1164 | - ? $this->category_slug |
|
1165 | - : ''; |
|
1166 | - return $event_list_css; |
|
1167 | - } |
|
1085 | + private $title; |
|
1086 | + |
|
1087 | + private $css_class; |
|
1088 | + |
|
1089 | + private $category_slug; |
|
1090 | + |
|
1091 | + /** |
|
1092 | + * EE_Event_List_Query constructor. |
|
1093 | + * |
|
1094 | + * @param array $args |
|
1095 | + */ |
|
1096 | + public function __construct($args = array()) |
|
1097 | + { |
|
1098 | + \EE_Error::doing_it_wrong( |
|
1099 | + __METHOD__, |
|
1100 | + __( |
|
1101 | + 'Usage is deprecated. Please use \EventEspresso\core\domain\services\wp_queries\EventListQuery instead.', |
|
1102 | + 'event_espresso' |
|
1103 | + ), |
|
1104 | + '4.9.27', |
|
1105 | + '5.0.0' |
|
1106 | + ); |
|
1107 | + $this->title = isset($args['title']) ? $args['title'] : ''; |
|
1108 | + $this->css_class = isset($args['css_class']) ? $args['css_class'] : ''; |
|
1109 | + $this->category_slug = isset($args['category_slug']) ? $args['category_slug'] : ''; |
|
1110 | + $limit = isset($args['limit']) && absint($args['limit']) ? $args['limit'] : 10; |
|
1111 | + // the current "page" we are viewing |
|
1112 | + $paged = max(1, get_query_var('paged')); |
|
1113 | + // Force these args |
|
1114 | + $args = array_merge( |
|
1115 | + $args, array( |
|
1116 | + 'post_type' => 'espresso_events', |
|
1117 | + 'posts_per_page' => $limit, |
|
1118 | + 'update_post_term_cache' => false, |
|
1119 | + 'update_post_meta_cache' => false, |
|
1120 | + 'paged' => $paged, |
|
1121 | + 'offset' => ($paged - 1) * $limit |
|
1122 | + ) |
|
1123 | + ); |
|
1124 | + // run the query |
|
1125 | + parent::__construct($args); |
|
1126 | + } |
|
1127 | + |
|
1128 | + |
|
1129 | + |
|
1130 | + /** |
|
1131 | + * event_list_title |
|
1132 | + * |
|
1133 | + * @param string $event_list_title |
|
1134 | + * @return string |
|
1135 | + */ |
|
1136 | + public function event_list_title($event_list_title = '') |
|
1137 | + { |
|
1138 | + if (! empty($this->title)) { |
|
1139 | + return $this->title; |
|
1140 | + } |
|
1141 | + return $event_list_title; |
|
1142 | + } |
|
1143 | + |
|
1144 | + |
|
1145 | + |
|
1146 | + /** |
|
1147 | + * event_list_css |
|
1148 | + * |
|
1149 | + * @param string $event_list_css |
|
1150 | + * @return string |
|
1151 | + */ |
|
1152 | + public function event_list_css($event_list_css = '') |
|
1153 | + { |
|
1154 | + $event_list_css .= ! empty($event_list_css) |
|
1155 | + ? ' ' |
|
1156 | + : ''; |
|
1157 | + $event_list_css .= ! empty($this->css_class) |
|
1158 | + ? $this->css_class |
|
1159 | + : ''; |
|
1160 | + $event_list_css .= ! empty($event_list_css) |
|
1161 | + ? ' ' |
|
1162 | + : ''; |
|
1163 | + $event_list_css .= ! empty($this->category_slug) |
|
1164 | + ? $this->category_slug |
|
1165 | + : ''; |
|
1166 | + return $event_list_css; |
|
1167 | + } |
|
1168 | 1168 | |
1169 | 1169 | } |
@@ -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 | * ************************************************************************ |
@@ -43,8 +43,8 @@ discard block |
||
43 | 43 | $action_or_filter = 'action' |
44 | 44 | ) { |
45 | 45 | $action_or_filter = $action_or_filter === 'action' |
46 | - ? esc_html__( 'action', 'event_espresso' ) |
|
47 | - : esc_html__( 'filter', 'event_espresso' ); |
|
46 | + ? esc_html__('action', 'event_espresso') |
|
47 | + : esc_html__('filter', 'event_espresso'); |
|
48 | 48 | EE_Error::doing_it_wrong( |
49 | 49 | $deprecated_filter, |
50 | 50 | sprintf( |
@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | * @param \EE_Checkout $checkout |
69 | 69 | * @return string |
70 | 70 | */ |
71 | -function ee_deprecated__registration_checkout__button_text( $submit_button_text, EE_Checkout $checkout ) { |
|
71 | +function ee_deprecated__registration_checkout__button_text($submit_button_text, EE_Checkout $checkout) { |
|
72 | 72 | // list of old filters |
73 | 73 | $deprecated_filters = array( |
74 | 74 | 'update_registration_details' => true, |
@@ -78,16 +78,16 @@ discard block |
||
78 | 78 | 'proceed_to' => true, |
79 | 79 | ); |
80 | 80 | // loop thru and call doing_it_wrong() or remove any that aren't being used |
81 | - foreach ( $deprecated_filters as $deprecated_filter => $on ) { |
|
81 | + foreach ($deprecated_filters as $deprecated_filter => $on) { |
|
82 | 82 | // was this filter called ? |
83 | - if ( has_action( 'FHEE__EED_Single_Page_Checkout__registration_checkout__button_text__' . $deprecated_filter )) { |
|
83 | + if (has_action('FHEE__EED_Single_Page_Checkout__registration_checkout__button_text__'.$deprecated_filter)) { |
|
84 | 84 | // only display doing_it_wrong() notice to Event Admins during non-AJAX requests |
85 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_read_ee', 'hide_doing_it_wrong_for_deprecated_SPCO_filter' ) && ! defined( 'DOING_AJAX' ) ) { |
|
85 | + if (EE_Registry::instance()->CAP->current_user_can('ee_read_ee', 'hide_doing_it_wrong_for_deprecated_SPCO_filter') && ! defined('DOING_AJAX')) { |
|
86 | 86 | EE_Error::doing_it_wrong( |
87 | - 'FHEE__EED_Single_Page_Checkout__registration_checkout__button_text__' . $deprecated_filter, |
|
87 | + 'FHEE__EED_Single_Page_Checkout__registration_checkout__button_text__'.$deprecated_filter, |
|
88 | 88 | sprintf( |
89 | - __( 'The %1$s filter is deprecated. It *may* work as an attempt to build in backwards compatibility. However, it is recommended to use the following new filter: %2$s"%3$s" found in "%4$s"', 'event_espresso' ), |
|
90 | - 'FHEE__EED_Single_Page_Checkout__registration_checkout__button_text__' . $deprecated_filter, |
|
89 | + __('The %1$s filter is deprecated. It *may* work as an attempt to build in backwards compatibility. However, it is recommended to use the following new filter: %2$s"%3$s" found in "%4$s"', 'event_espresso'), |
|
90 | + 'FHEE__EED_Single_Page_Checkout__registration_checkout__button_text__'.$deprecated_filter, |
|
91 | 91 | '<br />', |
92 | 92 | 'FHEE__EE_SPCO_Reg_Step__set_submit_button_text___submit_button_text', |
93 | 93 | '/modules/single_page_checkout/inc/EE_SPCO_Reg_Step.class.php' |
@@ -96,24 +96,24 @@ discard block |
||
96 | 96 | ); |
97 | 97 | } |
98 | 98 | } else { |
99 | - unset( $deprecated_filters[ $deprecated_filter ] ); |
|
99 | + unset($deprecated_filters[$deprecated_filter]); |
|
100 | 100 | } |
101 | 101 | } |
102 | - if ( ! empty( $deprecated_filters )) { |
|
103 | - |
|
104 | - if ( $checkout->current_step->slug() == 'attendee_information' && $checkout->revisit && isset( $deprecated_filters[ 'update_registration_details' ] )) { |
|
105 | - $submit_button_text = apply_filters( 'FHEE__EED_Single_Page_Checkout__registration_checkout__button_text__update_registration_details', $submit_button_text ); |
|
106 | - } else if ( $checkout->current_step->slug() == 'payment_options' && $checkout->revisit && isset( $deprecated_filters[ 'process_payment' ] ) ) { |
|
107 | - $submit_button_text = apply_filters( 'FHEE__EED_Single_Page_Checkout__registration_checkout__button_text__process_payment', $submit_button_text ); |
|
108 | - } else if ( $checkout->next_step instanceof EE_SPCO_Reg_Step && $checkout->next_step->slug() == 'finalize_registration' && isset( $deprecated_filters[ 'finalize_registration' ] ) ) { |
|
109 | - $submit_button_text = apply_filters( 'FHEE__EED_Single_Page_Checkout__registration_checkout__button_text__finalize_registration', $submit_button_text ); |
|
102 | + if ( ! empty($deprecated_filters)) { |
|
103 | + |
|
104 | + if ($checkout->current_step->slug() == 'attendee_information' && $checkout->revisit && isset($deprecated_filters['update_registration_details'])) { |
|
105 | + $submit_button_text = apply_filters('FHEE__EED_Single_Page_Checkout__registration_checkout__button_text__update_registration_details', $submit_button_text); |
|
106 | + } else if ($checkout->current_step->slug() == 'payment_options' && $checkout->revisit && isset($deprecated_filters['process_payment'])) { |
|
107 | + $submit_button_text = apply_filters('FHEE__EED_Single_Page_Checkout__registration_checkout__button_text__process_payment', $submit_button_text); |
|
108 | + } else if ($checkout->next_step instanceof EE_SPCO_Reg_Step && $checkout->next_step->slug() == 'finalize_registration' && isset($deprecated_filters['finalize_registration'])) { |
|
109 | + $submit_button_text = apply_filters('FHEE__EED_Single_Page_Checkout__registration_checkout__button_text__finalize_registration', $submit_button_text); |
|
110 | 110 | } |
111 | - if ( $checkout->next_step instanceof EE_SPCO_Reg_Step ) { |
|
112 | - if ( $checkout->payment_required() && $checkout->next_step->slug() == 'payment_options' && isset( $deprecated_filters[ 'and_proceed_to_payment' ] ) ) { |
|
113 | - $submit_button_text .= apply_filters( 'FHEE__EED_Single_Page_Checkout__registration_checkout__button_text__and_proceed_to_payment', $submit_button_text ); |
|
111 | + if ($checkout->next_step instanceof EE_SPCO_Reg_Step) { |
|
112 | + if ($checkout->payment_required() && $checkout->next_step->slug() == 'payment_options' && isset($deprecated_filters['and_proceed_to_payment'])) { |
|
113 | + $submit_button_text .= apply_filters('FHEE__EED_Single_Page_Checkout__registration_checkout__button_text__and_proceed_to_payment', $submit_button_text); |
|
114 | 114 | } |
115 | - if ( $checkout->next_step->slug() != 'finalize_registration' && ! $checkout->revisit && isset( $deprecated_filters[ 'proceed_to' ] ) ) { |
|
116 | - $submit_button_text = apply_filters( 'FHEE__EED_Single_Page_Checkout__registration_checkout__button_text__proceed_to', $submit_button_text ) . $checkout->next_step->name(); |
|
115 | + if ($checkout->next_step->slug() != 'finalize_registration' && ! $checkout->revisit && isset($deprecated_filters['proceed_to'])) { |
|
116 | + $submit_button_text = apply_filters('FHEE__EED_Single_Page_Checkout__registration_checkout__button_text__proceed_to', $submit_button_text).$checkout->next_step->name(); |
|
117 | 117 | } |
118 | 118 | } |
119 | 119 | |
@@ -121,7 +121,7 @@ discard block |
||
121 | 121 | return $submit_button_text; |
122 | 122 | |
123 | 123 | } |
124 | -add_filter( 'FHEE__EE_SPCO_Reg_Step__set_submit_button_text___submit_button_text', 'ee_deprecated__registration_checkout__button_text', 10, 2 ); |
|
124 | +add_filter('FHEE__EE_SPCO_Reg_Step__set_submit_button_text___submit_button_text', 'ee_deprecated__registration_checkout__button_text', 10, 2); |
|
125 | 125 | |
126 | 126 | |
127 | 127 | |
@@ -132,16 +132,16 @@ discard block |
||
132 | 132 | * @param \EE_Checkout $checkout |
133 | 133 | * @param boolean $status_updates |
134 | 134 | */ |
135 | -function ee_deprecated_finalize_transaction( EE_Checkout $checkout, $status_updates ) { |
|
135 | +function ee_deprecated_finalize_transaction(EE_Checkout $checkout, $status_updates) { |
|
136 | 136 | $action_ref = NULL; |
137 | - $action_ref = has_action( 'AHEE__EE_Transaction__finalize__new_transaction' ) ? 'AHEE__EE_Transaction__finalize__new_transaction' : $action_ref; |
|
138 | - $action_ref = has_action( 'AHEE__EE_Transaction__finalize__all_transaction' ) ? 'AHEE__EE_Transaction__finalize__all_transaction' : $action_ref; |
|
139 | - if ( $action_ref ) { |
|
137 | + $action_ref = has_action('AHEE__EE_Transaction__finalize__new_transaction') ? 'AHEE__EE_Transaction__finalize__new_transaction' : $action_ref; |
|
138 | + $action_ref = has_action('AHEE__EE_Transaction__finalize__all_transaction') ? 'AHEE__EE_Transaction__finalize__all_transaction' : $action_ref; |
|
139 | + if ($action_ref) { |
|
140 | 140 | |
141 | 141 | EE_Error::doing_it_wrong( |
142 | 142 | $action_ref, |
143 | 143 | sprintf( |
144 | - __( 'This action is deprecated. It *may* work as an attempt to build in backwards compatibility. However, it is recommended to use one of the following new actions: %1$s"%3$s" found in "%2$s" %1$s"%4$s" found in "%2$s" %1$s"%5$s" found in "%2$s" %1$s"%6$s" found in "%2$s"', 'event_espresso' ), |
|
144 | + __('This action is deprecated. It *may* work as an attempt to build in backwards compatibility. However, it is recommended to use one of the following new actions: %1$s"%3$s" found in "%2$s" %1$s"%4$s" found in "%2$s" %1$s"%5$s" found in "%2$s" %1$s"%6$s" found in "%2$s"', 'event_espresso'), |
|
145 | 145 | '<br />', |
146 | 146 | '/core/business/EE_Transaction_Processor.class.php', |
147 | 147 | 'AHEE__EE_Transaction_Processor__finalize', |
@@ -151,39 +151,39 @@ discard block |
||
151 | 151 | ), |
152 | 152 | '4.6.0' |
153 | 153 | ); |
154 | - switch ( $action_ref ) { |
|
154 | + switch ($action_ref) { |
|
155 | 155 | case 'AHEE__EE_Transaction__finalize__new_transaction' : |
156 | - do_action( 'AHEE__EE_Transaction__finalize__new_transaction', $checkout->transaction, $checkout->admin_request ); |
|
156 | + do_action('AHEE__EE_Transaction__finalize__new_transaction', $checkout->transaction, $checkout->admin_request); |
|
157 | 157 | break; |
158 | 158 | case 'AHEE__EE_Transaction__finalize__all_transaction' : |
159 | - do_action( 'AHEE__EE_Transaction__finalize__new_transaction', $checkout->transaction, array( 'new_reg' => ! $checkout->revisit, 'to_approved' => $status_updates ), $checkout->admin_request ); |
|
159 | + do_action('AHEE__EE_Transaction__finalize__new_transaction', $checkout->transaction, array('new_reg' => ! $checkout->revisit, 'to_approved' => $status_updates), $checkout->admin_request); |
|
160 | 160 | break; |
161 | 161 | } |
162 | 162 | } |
163 | 163 | } |
164 | -add_action( 'AHEE__EE_SPCO_Reg_Step_Finalize_Registration__process_reg_step__completed', 'ee_deprecated_finalize_transaction', 10, 2 ); |
|
164 | +add_action('AHEE__EE_SPCO_Reg_Step_Finalize_Registration__process_reg_step__completed', 'ee_deprecated_finalize_transaction', 10, 2); |
|
165 | 165 | /** |
166 | 166 | * ee_deprecated_finalize_registration |
167 | 167 | * |
168 | 168 | * @param EE_Registration $registration |
169 | 169 | */ |
170 | -function ee_deprecated_finalize_registration( EE_Registration $registration ) { |
|
171 | - $action_ref = has_action( 'AHEE__EE_Registration__finalize__update_and_new_reg' ) ? 'AHEE__EE_Registration__finalize__update_and_new_reg' : NULL; |
|
172 | - if ( $action_ref ) { |
|
170 | +function ee_deprecated_finalize_registration(EE_Registration $registration) { |
|
171 | + $action_ref = has_action('AHEE__EE_Registration__finalize__update_and_new_reg') ? 'AHEE__EE_Registration__finalize__update_and_new_reg' : NULL; |
|
172 | + if ($action_ref) { |
|
173 | 173 | EE_Error::doing_it_wrong( |
174 | 174 | $action_ref, |
175 | 175 | sprintf( |
176 | - __( 'This action is deprecated. It *may* work as an attempt to build in backwards compatibility. However, it is recommended to use the following new action: %1$s"%3$s" found in "%2$s"', 'event_espresso' ), |
|
176 | + __('This action is deprecated. It *may* work as an attempt to build in backwards compatibility. However, it is recommended to use the following new action: %1$s"%3$s" found in "%2$s"', 'event_espresso'), |
|
177 | 177 | '<br />', |
178 | 178 | '/core/business/EE_Registration_Processor.class.php', |
179 | 179 | 'AHEE__EE_Registration_Processor__trigger_registration_status_changed_hook' |
180 | 180 | ), |
181 | 181 | '4.6.0' |
182 | 182 | ); |
183 | - do_action( 'AHEE__EE_Registration__finalize__update_and_new_reg', $registration, ( is_admin() && ! ( defined( 'DOING_AJAX' ) && DOING_AJAX ))); |
|
183 | + do_action('AHEE__EE_Registration__finalize__update_and_new_reg', $registration, (is_admin() && ! (defined('DOING_AJAX') && DOING_AJAX))); |
|
184 | 184 | } |
185 | 185 | } |
186 | -add_action( 'AHEE__EE_Registration_Processor__trigger_registration_update_notifications', 'ee_deprecated_finalize_registration', 10, 1 ); |
|
186 | +add_action('AHEE__EE_Registration_Processor__trigger_registration_update_notifications', 'ee_deprecated_finalize_registration', 10, 1); |
|
187 | 187 | |
188 | 188 | |
189 | 189 | |
@@ -191,7 +191,7 @@ discard block |
||
191 | 191 | * Called after EED_Module::set_hooks() and EED_Module::set_admin_hooks() was called. |
192 | 192 | * Checks if any deprecated hooks were hooked-into and provide doing_it_wrong messages appropriately. |
193 | 193 | */ |
194 | -function ee_deprecated_hooks(){ |
|
194 | +function ee_deprecated_hooks() { |
|
195 | 195 | /** |
196 | 196 | * @var $hooks array where keys are hook names, and their values are array{ |
197 | 197 | * @type string $version when deprecated |
@@ -202,25 +202,25 @@ discard block |
||
202 | 202 | $hooks = array( |
203 | 203 | 'AHEE__EE_System___do_setup_validations' => array( |
204 | 204 | 'version' => '4.6.0', |
205 | - 'alternative' => __( 'Instead use "AHEE__EEH_Activation__validate_messages_system" which is called after validating messages (done on every new install, upgrade, reactivation, and downgrade)', 'event_espresso' ), |
|
205 | + 'alternative' => __('Instead use "AHEE__EEH_Activation__validate_messages_system" which is called after validating messages (done on every new install, upgrade, reactivation, and downgrade)', 'event_espresso'), |
|
206 | 206 | 'still_works' => FALSE |
207 | 207 | ) |
208 | 208 | ); |
209 | - foreach( $hooks as $name => $deprecation_info ){ |
|
210 | - if( has_action( $name ) ){ |
|
209 | + foreach ($hooks as $name => $deprecation_info) { |
|
210 | + if (has_action($name)) { |
|
211 | 211 | EE_Error::doing_it_wrong( |
212 | 212 | $name, |
213 | 213 | sprintf( |
214 | - __('This filter is deprecated. %1$s%2$s','event_espresso'), |
|
215 | - $deprecation_info[ 'still_works' ] ? __('It *may* work as an attempt to build in backwards compatibility.', 'event_espresso') : __( 'It has been completely removed.', 'event_espresso' ), |
|
216 | - isset( $deprecation_info[ 'alternative' ] ) ? $deprecation_info[ 'alternative' ] : __( 'Please read the current EE4 documentation further or contact Support.', 'event_espresso' ) |
|
214 | + __('This filter is deprecated. %1$s%2$s', 'event_espresso'), |
|
215 | + $deprecation_info['still_works'] ? __('It *may* work as an attempt to build in backwards compatibility.', 'event_espresso') : __('It has been completely removed.', 'event_espresso'), |
|
216 | + isset($deprecation_info['alternative']) ? $deprecation_info['alternative'] : __('Please read the current EE4 documentation further or contact Support.', 'event_espresso') |
|
217 | 217 | ), |
218 | - isset( $deprecation_info[ 'version' ] ) ? $deprecation_info[ 'version' ] : __( 'recently', 'event_espresso' ) |
|
218 | + isset($deprecation_info['version']) ? $deprecation_info['version'] : __('recently', 'event_espresso') |
|
219 | 219 | ); |
220 | 220 | } |
221 | 221 | } |
222 | 222 | } |
223 | -add_action( 'AHEE__EE_System__set_hooks_for_shortcodes_modules_and_addons', 'ee_deprecated_hooks' ); |
|
223 | +add_action('AHEE__EE_System__set_hooks_for_shortcodes_modules_and_addons', 'ee_deprecated_hooks'); |
|
224 | 224 | |
225 | 225 | |
226 | 226 | |
@@ -231,9 +231,9 @@ discard block |
||
231 | 231 | * @return boolean |
232 | 232 | */ |
233 | 233 | function ee_deprecated_using_old_registration_admin_custom_questions_form_hooks() { |
234 | - $in_use = has_filter( 'FHEE__Registrations_Admin_Page___update_attendee_registration_form__qstns' ) |
|
235 | - || has_action( 'AHEE__Registrations_Admin_Page___save_attendee_registration_form__after_reg_and_attendee_save' ); |
|
236 | - if( $in_use ) { |
|
234 | + $in_use = has_filter('FHEE__Registrations_Admin_Page___update_attendee_registration_form__qstns') |
|
235 | + || has_action('AHEE__Registrations_Admin_Page___save_attendee_registration_form__after_reg_and_attendee_save'); |
|
236 | + if ($in_use) { |
|
237 | 237 | $msg = __( |
238 | 238 | 'We detected you are using the filter FHEE__Registrations_Admin_Page___update_attendee_registration_form__qstns or AHEE__Registrations_Admin_Page___save_attendee_registration_form__after_reg_and_attendee_save.' |
239 | 239 | . 'Both of these have been deprecated and should not be used anymore. You should instead use FHEE__EE_Form_Section_Proper___construct__options_array to customize the contents of the form,' |
@@ -242,18 +242,18 @@ discard block |
||
242 | 242 | 'event_espresso' ) |
243 | 243 | ; |
244 | 244 | EE_Error::doing_it_wrong( |
245 | - __CLASS__ . '::' . __FUNCTION__, |
|
245 | + __CLASS__.'::'.__FUNCTION__, |
|
246 | 246 | $msg, |
247 | 247 | '4.8.32.rc.000' |
248 | 248 | ); |
249 | 249 | //it seems the doing_it_wrong messages get output during some hidden html tags, so add an error to make sure this gets noticed |
250 | - if ( is_admin() && ! defined( 'DOING_AJAX' ) ) { |
|
251 | - EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
250 | + if (is_admin() && ! defined('DOING_AJAX')) { |
|
251 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
252 | 252 | } |
253 | 253 | } |
254 | 254 | return $in_use; |
255 | 255 | } |
256 | -add_action( 'AHEE__Registrations_Admin_Page___registration_details_metabox__start', 'ee_deprecated_using_old_registration_admin_custom_questions_form_hooks' ); |
|
256 | +add_action('AHEE__Registrations_Admin_Page___registration_details_metabox__start', 'ee_deprecated_using_old_registration_admin_custom_questions_form_hooks'); |
|
257 | 257 | |
258 | 258 | /** |
259 | 259 | * @deprecated since 4.8.32.rc.000 because it has issues on https://events.codebasehq.com/projects/event-espresso/tickets/9165 |
@@ -262,34 +262,34 @@ discard block |
||
262 | 262 | * @param EE_Admin_Page $admin_page |
263 | 263 | * @return void |
264 | 264 | */ |
265 | -function ee_deprecated_update_attendee_registration_form_old( $admin_page ) { |
|
265 | +function ee_deprecated_update_attendee_registration_form_old($admin_page) { |
|
266 | 266 | //check if the old hooks are in use. If not, do the default |
267 | - if( ! ee_deprecated_using_old_registration_admin_custom_questions_form_hooks() |
|
268 | - || ! $admin_page instanceof EE_Admin_Page ) { |
|
267 | + if ( ! ee_deprecated_using_old_registration_admin_custom_questions_form_hooks() |
|
268 | + || ! $admin_page instanceof EE_Admin_Page) { |
|
269 | 269 | return; |
270 | 270 | } |
271 | 271 | $req_data = $admin_page->get_request_data(); |
272 | - $qstns = isset( $req_data['qstn'] ) ? $req_data['qstn'] : FALSE; |
|
273 | - $REG_ID = isset( $req_data['_REG_ID'] ) ? absint( $req_data['_REG_ID'] ) : FALSE; |
|
274 | - $qstns = apply_filters( 'FHEE__Registrations_Admin_Page___update_attendee_registration_form__qstns', $qstns ); |
|
275 | - if ( ! $REG_ID || ! $qstns ) { |
|
276 | - EE_Error::add_error( __('An error occurred. No registration ID and/or registration questions were received.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ ); |
|
272 | + $qstns = isset($req_data['qstn']) ? $req_data['qstn'] : FALSE; |
|
273 | + $REG_ID = isset($req_data['_REG_ID']) ? absint($req_data['_REG_ID']) : FALSE; |
|
274 | + $qstns = apply_filters('FHEE__Registrations_Admin_Page___update_attendee_registration_form__qstns', $qstns); |
|
275 | + if ( ! $REG_ID || ! $qstns) { |
|
276 | + EE_Error::add_error(__('An error occurred. No registration ID and/or registration questions were received.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
277 | 277 | } |
278 | 278 | $success = TRUE; |
279 | 279 | |
280 | 280 | // allow others to get in on this awesome fun :D |
281 | - do_action( 'AHEE__Registrations_Admin_Page___save_attendee_registration_form__after_reg_and_attendee_save', $REG_ID, $qstns ); |
|
281 | + do_action('AHEE__Registrations_Admin_Page___save_attendee_registration_form__after_reg_and_attendee_save', $REG_ID, $qstns); |
|
282 | 282 | // loop thru questions... FINALLY!!! |
283 | 283 | |
284 | - foreach ( $qstns as $QST_ID => $qstn ) { |
|
284 | + foreach ($qstns as $QST_ID => $qstn) { |
|
285 | 285 | //if $qstn isn't an array then it doesn't already have an answer, so let's create the answer |
286 | - if ( !is_array($qstn) ) { |
|
287 | - $success = $this->_save_new_answer( $REG_ID, $QST_ID, $qstn); |
|
286 | + if ( ! is_array($qstn)) { |
|
287 | + $success = $this->_save_new_answer($REG_ID, $QST_ID, $qstn); |
|
288 | 288 | continue; |
289 | 289 | } |
290 | 290 | |
291 | 291 | |
292 | - foreach ( $qstn as $ANS_ID => $ANS_value ) { |
|
292 | + foreach ($qstn as $ANS_ID => $ANS_value) { |
|
293 | 293 | //get answer |
294 | 294 | $query_params = array( |
295 | 295 | 0 => array( |
@@ -300,7 +300,7 @@ discard block |
||
300 | 300 | ); |
301 | 301 | $answer = EEM_Answer::instance()->get_one($query_params); |
302 | 302 | //this MAY be an array but NOT have an answer because its multi select. If so then we need to create the answer |
303 | - if ( ! $answer instanceof EE_Answer ) { |
|
303 | + if ( ! $answer instanceof EE_Answer) { |
|
304 | 304 | $set_values = array( |
305 | 305 | 'QST_ID' => $QST_ID, |
306 | 306 | 'REG_ID' => $REG_ID, |
@@ -315,11 +315,11 @@ discard block |
||
315 | 315 | } |
316 | 316 | } |
317 | 317 | $what = __('Registration Form', 'event_espresso'); |
318 | - $route = $REG_ID ? array( 'action' => 'view_registration', '_REG_ID' => $REG_ID ) : array( 'action' => 'default' ); |
|
319 | - $admin_page->redirect_after_action( $success, $what, __('updated', 'event_espresso'), $route ); |
|
318 | + $route = $REG_ID ? array('action' => 'view_registration', '_REG_ID' => $REG_ID) : array('action' => 'default'); |
|
319 | + $admin_page->redirect_after_action($success, $what, __('updated', 'event_espresso'), $route); |
|
320 | 320 | exit; |
321 | 321 | } |
322 | -add_action( 'AHEE__Registrations_Admin_Page___update_attendee_registration_form__start', 'ee_deprecated_update_attendee_registration_form_old', 10, 1 ); |
|
322 | +add_action('AHEE__Registrations_Admin_Page___update_attendee_registration_form__start', 'ee_deprecated_update_attendee_registration_form_old', 10, 1); |
|
323 | 323 | /** |
324 | 324 | * Render the registration admin page's custom questions area in the old fashion |
325 | 325 | * and firing the old hooks. When this method is removed, we can probably also |
@@ -332,31 +332,31 @@ discard block |
||
332 | 332 | * @return bool |
333 | 333 | * @throws \EE_Error |
334 | 334 | */ |
335 | -function ee_deprecated_reg_questions_meta_box_old( $do_default_action, $admin_page, $registration ) { |
|
335 | +function ee_deprecated_reg_questions_meta_box_old($do_default_action, $admin_page, $registration) { |
|
336 | 336 | //check if the old hooks are in use. If not, do the default |
337 | - if( ! ee_deprecated_using_old_registration_admin_custom_questions_form_hooks() |
|
338 | - || ! $admin_page instanceof EE_Admin_Page ) { |
|
337 | + if ( ! ee_deprecated_using_old_registration_admin_custom_questions_form_hooks() |
|
338 | + || ! $admin_page instanceof EE_Admin_Page) { |
|
339 | 339 | return $do_default_action; |
340 | 340 | } |
341 | - add_filter( 'FHEE__EEH_Form_Fields__generate_question_groups_html__before_question_group_questions', array( $admin_page, 'form_before_question_group' ), 10, 1 ); |
|
342 | - add_filter( 'FHEE__EEH_Form_Fields__generate_question_groups_html__after_question_group_questions', array( $admin_page, 'form_after_question_group' ), 10, 1 ); |
|
343 | - add_filter( 'FHEE__EEH_Form_Fields__label_html', array( $admin_page, 'form_form_field_label_wrap' ), 10, 1 ); |
|
344 | - add_filter( 'FHEE__EEH_Form_Fields__input_html', array( $admin_page, 'form_form_field_input__wrap' ), 10, 1 ); |
|
341 | + add_filter('FHEE__EEH_Form_Fields__generate_question_groups_html__before_question_group_questions', array($admin_page, 'form_before_question_group'), 10, 1); |
|
342 | + add_filter('FHEE__EEH_Form_Fields__generate_question_groups_html__after_question_group_questions', array($admin_page, 'form_after_question_group'), 10, 1); |
|
343 | + add_filter('FHEE__EEH_Form_Fields__label_html', array($admin_page, 'form_form_field_label_wrap'), 10, 1); |
|
344 | + add_filter('FHEE__EEH_Form_Fields__input_html', array($admin_page, 'form_form_field_input__wrap'), 10, 1); |
|
345 | 345 | |
346 | - $question_groups = EEM_Event::instance()->assemble_array_of_groups_questions_and_options( $registration, $registration->get('EVT_ID') ); |
|
346 | + $question_groups = EEM_Event::instance()->assemble_array_of_groups_questions_and_options($registration, $registration->get('EVT_ID')); |
|
347 | 347 | |
348 | - EE_Registry::instance()->load_helper( 'Form_Fields' ); |
|
348 | + EE_Registry::instance()->load_helper('Form_Fields'); |
|
349 | 349 | $template_args = array( |
350 | - 'att_questions' => EEH_Form_Fields::generate_question_groups_html( $question_groups ), |
|
350 | + 'att_questions' => EEH_Form_Fields::generate_question_groups_html($question_groups), |
|
351 | 351 | 'reg_questions_form_action' => 'edit_registration', |
352 | 352 | 'REG_ID' => $registration->ID() |
353 | 353 | ); |
354 | - $template_path = REG_TEMPLATE_PATH . 'reg_admin_details_main_meta_box_reg_questions.template.php'; |
|
355 | - echo EEH_Template::display_template( $template_path, $template_args, TRUE ); |
|
354 | + $template_path = REG_TEMPLATE_PATH.'reg_admin_details_main_meta_box_reg_questions.template.php'; |
|
355 | + echo EEH_Template::display_template($template_path, $template_args, TRUE); |
|
356 | 356 | //indicate that we should not do the default admin page code |
357 | 357 | return false; |
358 | 358 | } |
359 | -add_action( 'FHEE__Registrations_Admin_Page___reg_questions_meta_box__do_default', 'ee_deprecated_reg_questions_meta_box_old', 10, 3 ); |
|
359 | +add_action('FHEE__Registrations_Admin_Page___reg_questions_meta_box__do_default', 'ee_deprecated_reg_questions_meta_box_old', 10, 3); |
|
360 | 360 | |
361 | 361 | |
362 | 362 | |
@@ -397,9 +397,9 @@ discard block |
||
397 | 397 | '4.9.0' |
398 | 398 | ); |
399 | 399 | /** @var EE_Message_Resource_Manager $message_resource_manager */ |
400 | - $message_resource_manager = EE_Registry::instance()->load_lib( 'Message_Resource_Manager' ); |
|
401 | - $messenger = $message_resource_manager->get_messenger( $messenger_name ); |
|
402 | - $message_type = $message_resource_manager->get_message_type( $message_type_name ); |
|
400 | + $message_resource_manager = EE_Registry::instance()->load_lib('Message_Resource_Manager'); |
|
401 | + $messenger = $message_resource_manager->get_messenger($messenger_name); |
|
402 | + $message_type = $message_resource_manager->get_message_type($message_type_name); |
|
403 | 403 | return EE_Registry::instance()->load_lib( |
404 | 404 | 'Messages_Template_Defaults', |
405 | 405 | array( |
@@ -464,15 +464,15 @@ discard block |
||
464 | 464 | /** |
465 | 465 | * @param string $method |
466 | 466 | */ |
467 | - public function _class_is_deprecated( $method ) { |
|
467 | + public function _class_is_deprecated($method) { |
|
468 | 468 | EE_Error::doing_it_wrong( |
469 | - 'EE_messages::' . $method, |
|
470 | - __( 'EE_messages has been deprecated. Please use EE_Message_Resource_Manager instead.' ), |
|
469 | + 'EE_messages::'.$method, |
|
470 | + __('EE_messages has been deprecated. Please use EE_Message_Resource_Manager instead.'), |
|
471 | 471 | '4.9.0', |
472 | 472 | '4.10.0.p' |
473 | 473 | ); |
474 | 474 | // Please use EE_Message_Resource_Manager instead |
475 | - $this->_message_resource_manager = EE_Registry::instance()->load_lib( 'Message_Resource_Manager' ); |
|
475 | + $this->_message_resource_manager = EE_Registry::instance()->load_lib('Message_Resource_Manager'); |
|
476 | 476 | } |
477 | 477 | |
478 | 478 | |
@@ -482,10 +482,10 @@ discard block |
||
482 | 482 | * @param string $messenger_name |
483 | 483 | * @return boolean TRUE if it was PREVIOUSLY active, and FALSE if it was previously inactive |
484 | 484 | */ |
485 | - public function ensure_messenger_is_active( $messenger_name ) { |
|
485 | + public function ensure_messenger_is_active($messenger_name) { |
|
486 | 486 | // EE_messages has been deprecated |
487 | - $this->_class_is_deprecated( __FUNCTION__ ); |
|
488 | - return $this->_message_resource_manager->ensure_messenger_is_active( $messenger_name ); |
|
487 | + $this->_class_is_deprecated(__FUNCTION__); |
|
488 | + return $this->_message_resource_manager->ensure_messenger_is_active($messenger_name); |
|
489 | 489 | } |
490 | 490 | |
491 | 491 | |
@@ -497,10 +497,10 @@ discard block |
||
497 | 497 | * @return bool true if it got activated (or was active) and false if not. |
498 | 498 | * @throws \EE_Error |
499 | 499 | */ |
500 | - public function ensure_message_type_is_active( $message_type, $messenger ) { |
|
500 | + public function ensure_message_type_is_active($message_type, $messenger) { |
|
501 | 501 | // EE_messages has been deprecated |
502 | - $this->_class_is_deprecated( __FUNCTION__ ); |
|
503 | - return $this->_message_resource_manager->ensure_message_type_is_active( $message_type, $messenger ); |
|
502 | + $this->_class_is_deprecated(__FUNCTION__); |
|
503 | + return $this->_message_resource_manager->ensure_message_type_is_active($message_type, $messenger); |
|
504 | 504 | } |
505 | 505 | |
506 | 506 | |
@@ -513,10 +513,10 @@ discard block |
||
513 | 513 | * they are already setup.) |
514 | 514 | * @return boolean an array of generated templates or false if nothing generated/activated. |
515 | 515 | */ |
516 | - public function activate_messenger( $messenger_name, $mts_to_activate = array() ) { |
|
516 | + public function activate_messenger($messenger_name, $mts_to_activate = array()) { |
|
517 | 517 | // EE_messages has been deprecated |
518 | - $this->_class_is_deprecated( __FUNCTION__ ); |
|
519 | - return $this->_message_resource_manager->activate_messenger( $messenger_name, $mts_to_activate ); |
|
518 | + $this->_class_is_deprecated(__FUNCTION__); |
|
519 | + return $this->_message_resource_manager->activate_messenger($messenger_name, $mts_to_activate); |
|
520 | 520 | } |
521 | 521 | |
522 | 522 | |
@@ -528,10 +528,10 @@ discard block |
||
528 | 528 | * |
529 | 529 | * @return bool true is a generating messenger and can be sent OR FALSE meaning cannot send. |
530 | 530 | */ |
531 | - public function is_generating_messenger_and_active( EE_messenger $messenger, EE_message_type $message_type ) { |
|
531 | + public function is_generating_messenger_and_active(EE_messenger $messenger, EE_message_type $message_type) { |
|
532 | 532 | // EE_messages has been deprecated |
533 | - $this->_class_is_deprecated( __FUNCTION__ ); |
|
534 | - return $this->_message_resource_manager->is_generating_messenger_and_active( $messenger, $message_type ); |
|
533 | + $this->_class_is_deprecated(__FUNCTION__); |
|
534 | + return $this->_message_resource_manager->is_generating_messenger_and_active($messenger, $message_type); |
|
535 | 535 | } |
536 | 536 | |
537 | 537 | |
@@ -541,10 +541,10 @@ discard block |
||
541 | 541 | * @param string $messenger |
542 | 542 | * @return EE_messenger | null |
543 | 543 | */ |
544 | - public function get_messenger_if_active( $messenger ) { |
|
544 | + public function get_messenger_if_active($messenger) { |
|
545 | 545 | // EE_messages has been deprecated |
546 | - $this->_class_is_deprecated( __FUNCTION__ ); |
|
547 | - return $this->_message_resource_manager->get_active_messenger( $messenger ); |
|
546 | + $this->_class_is_deprecated(__FUNCTION__); |
|
547 | + return $this->_message_resource_manager->get_active_messenger($messenger); |
|
548 | 548 | } |
549 | 549 | |
550 | 550 | |
@@ -565,9 +565,9 @@ discard block |
||
565 | 565 | * 'message_type' => null |
566 | 566 | * ) |
567 | 567 | */ |
568 | - public function validate_for_use( EE_Message $message ) { |
|
568 | + public function validate_for_use(EE_Message $message) { |
|
569 | 569 | // EE_messages has been deprecated |
570 | - $this->_class_is_deprecated( __FUNCTION__ ); |
|
570 | + $this->_class_is_deprecated(__FUNCTION__); |
|
571 | 571 | return array( |
572 | 572 | 'messenger' => $message->messenger_object(), |
573 | 573 | 'message_type' => $message->message_type_object(), |
@@ -595,41 +595,41 @@ discard block |
||
595 | 595 | $send = true |
596 | 596 | ) { |
597 | 597 | // EE_messages has been deprecated |
598 | - $this->_class_is_deprecated( __FUNCTION__ ); |
|
598 | + $this->_class_is_deprecated(__FUNCTION__); |
|
599 | 599 | /** @type EE_Messages_Processor $processor */ |
600 | - $processor = EE_Registry::instance()->load_lib( 'Messages_Processor' ); |
|
600 | + $processor = EE_Registry::instance()->load_lib('Messages_Processor'); |
|
601 | 601 | $error = false; |
602 | 602 | //try to intelligently determine what method we'll call based on the incoming data. |
603 | 603 | //if generating and sending are different then generate and send immediately. |
604 | - if ( ! empty( $sending_messenger ) && $sending_messenger != $generating_messenger && $send ) { |
|
604 | + if ( ! empty($sending_messenger) && $sending_messenger != $generating_messenger && $send) { |
|
605 | 605 | //in the legacy system, when generating and sending were different, that means all the |
606 | 606 | //vars are already in the request object. So let's just use that. |
607 | 607 | try { |
608 | 608 | /** @type EE_Message_To_Generate_From_Request $mtg */ |
609 | - $mtg = EE_Registry::instance()->load_lib( 'Message_To_Generate_From_Request' ); |
|
610 | - $processor->generate_and_send_now( $mtg ); |
|
611 | - } catch ( EE_Error $e ) { |
|
609 | + $mtg = EE_Registry::instance()->load_lib('Message_To_Generate_From_Request'); |
|
610 | + $processor->generate_and_send_now($mtg); |
|
611 | + } catch (EE_Error $e) { |
|
612 | 612 | $error_msg = __( |
613 | 613 | 'Please note that a system message failed to send due to a technical issue.', |
614 | 614 | 'event_espresso' |
615 | 615 | ); |
616 | 616 | // add specific message for developers if WP_DEBUG in on |
617 | - $error_msg .= '||' . $e->getMessage(); |
|
618 | - EE_Error::add_error( $error_msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
617 | + $error_msg .= '||'.$e->getMessage(); |
|
618 | + EE_Error::add_error($error_msg, __FILE__, __FUNCTION__, __LINE__); |
|
619 | 619 | $error = true; |
620 | 620 | } |
621 | 621 | } else { |
622 | - $processor->generate_for_all_active_messengers( $type, $vars, $send ); |
|
622 | + $processor->generate_for_all_active_messengers($type, $vars, $send); |
|
623 | 623 | //let's find out if there were any errors and how many successfully were queued. |
624 | 624 | $count_errors = $processor->get_queue()->count_STS_in_queue( |
625 | - array( EEM_Message::status_failed, EEM_Message::status_debug_only ) |
|
625 | + array(EEM_Message::status_failed, EEM_Message::status_debug_only) |
|
626 | 626 | ); |
627 | - $count_queued = $processor->get_queue()->count_STS_in_queue( EEM_Message::status_incomplete ); |
|
628 | - $count_retry = $processor->get_queue()->count_STS_in_queue( EEM_Message::status_retry ); |
|
627 | + $count_queued = $processor->get_queue()->count_STS_in_queue(EEM_Message::status_incomplete); |
|
628 | + $count_retry = $processor->get_queue()->count_STS_in_queue(EEM_Message::status_retry); |
|
629 | 629 | $count_errors = $count_errors + $count_retry; |
630 | - if ( $count_errors > 0 ) { |
|
630 | + if ($count_errors > 0) { |
|
631 | 631 | $error = true; |
632 | - if ( $count_errors > 1 && $count_retry > 1 && $count_queued > 1 ) { |
|
632 | + if ($count_errors > 1 && $count_retry > 1 && $count_queued > 1) { |
|
633 | 633 | $message = sprintf( |
634 | 634 | __( |
635 | 635 | 'There were %d errors and %d messages successfully queued for generation and sending', |
@@ -638,7 +638,7 @@ discard block |
||
638 | 638 | $count_errors, |
639 | 639 | $count_queued |
640 | 640 | ); |
641 | - } elseif ( $count_errors > 1 && $count_queued === 1 ) { |
|
641 | + } elseif ($count_errors > 1 && $count_queued === 1) { |
|
642 | 642 | $message = sprintf( |
643 | 643 | __( |
644 | 644 | 'There were %d errors and %d message successfully queued for generation.', |
@@ -647,7 +647,7 @@ discard block |
||
647 | 647 | $count_errors, |
648 | 648 | $count_queued |
649 | 649 | ); |
650 | - } elseif ( $count_errors === 1 && $count_queued > 1 ) { |
|
650 | + } elseif ($count_errors === 1 && $count_queued > 1) { |
|
651 | 651 | $message = sprintf( |
652 | 652 | __( |
653 | 653 | 'There was %d error and %d messages successfully queued for generation.', |
@@ -665,9 +665,9 @@ discard block |
||
665 | 665 | $count_errors |
666 | 666 | ); |
667 | 667 | } |
668 | - EE_Error::add_error( $message, __FILE__, __FUNCTION__, __LINE__ ); |
|
668 | + EE_Error::add_error($message, __FILE__, __FUNCTION__, __LINE__); |
|
669 | 669 | } else { |
670 | - if ( $count_queued === 1 ) { |
|
670 | + if ($count_queued === 1) { |
|
671 | 671 | $message = sprintf( |
672 | 672 | __( |
673 | 673 | '%d message successfully queued for generation.', |
@@ -684,18 +684,18 @@ discard block |
||
684 | 684 | $count_queued |
685 | 685 | ); |
686 | 686 | } |
687 | - EE_Error::add_success( $message ); |
|
687 | + EE_Error::add_success($message); |
|
688 | 688 | } |
689 | 689 | } |
690 | 690 | //if no error then return the generated message(s). |
691 | - if ( ! $error && ! $send ) { |
|
692 | - $generated_queue = $processor->generate_queue( false ); |
|
691 | + if ( ! $error && ! $send) { |
|
692 | + $generated_queue = $processor->generate_queue(false); |
|
693 | 693 | //get message and return. |
694 | 694 | $generated_queue->get_message_repository()->rewind(); |
695 | 695 | $messages = array(); |
696 | - while ( $generated_queue->get_message_repository()->valid() ) { |
|
696 | + while ($generated_queue->get_message_repository()->valid()) { |
|
697 | 697 | $message = $generated_queue->get_message_repository()->current(); |
698 | - if ( $message instanceof EE_Message ) { |
|
698 | + if ($message instanceof EE_Message) { |
|
699 | 699 | //set properties that might be expected by add-ons (backward compat) |
700 | 700 | $message->content = $message->content(); |
701 | 701 | $message->template_pack = $message->get_template_pack(); |
@@ -720,10 +720,10 @@ discard block |
||
720 | 720 | * @param bool $send true we will do a test send using the messenger delivery, false we just do a regular preview |
721 | 721 | * @return string The body of the message. |
722 | 722 | */ |
723 | - public function preview_message( $type, $context, $messenger, $send = false ) { |
|
723 | + public function preview_message($type, $context, $messenger, $send = false) { |
|
724 | 724 | // EE_messages has been deprecated |
725 | - $this->_class_is_deprecated( __FUNCTION__ ); |
|
726 | - return EED_Messages::preview_message( $type, $context, $messenger, $send ); |
|
725 | + $this->_class_is_deprecated(__FUNCTION__); |
|
726 | + return EED_Messages::preview_message($type, $context, $messenger, $send); |
|
727 | 727 | } |
728 | 728 | |
729 | 729 | |
@@ -737,14 +737,14 @@ discard block |
||
737 | 737 | * |
738 | 738 | * @return bool success or fail. |
739 | 739 | */ |
740 | - public function send_message_with_messenger_only( $messenger, $message_type, $message ) { |
|
740 | + public function send_message_with_messenger_only($messenger, $message_type, $message) { |
|
741 | 741 | // EE_messages has been deprecated |
742 | - $this->_class_is_deprecated( __FUNCTION__ ); |
|
742 | + $this->_class_is_deprecated(__FUNCTION__); |
|
743 | 743 | //setup for sending to new method. |
744 | 744 | /** @type EE_Messages_Queue $queue */ |
745 | - $queue = EE_Registry::instance()->load_lib( 'Messages_Queue' ); |
|
745 | + $queue = EE_Registry::instance()->load_lib('Messages_Queue'); |
|
746 | 746 | //make sure we have a proper message object |
747 | - if ( ! $message instanceof EE_Message && is_object( $message ) && isset( $message->content ) ) { |
|
747 | + if ( ! $message instanceof EE_Message && is_object($message) && isset($message->content)) { |
|
748 | 748 | $msg = EE_Message_Factory::create( |
749 | 749 | array( |
750 | 750 | 'MSG_messenger' => $messenger, |
@@ -756,15 +756,15 @@ discard block |
||
756 | 756 | } else { |
757 | 757 | $msg = $message; |
758 | 758 | } |
759 | - if ( ! $msg instanceof EE_Message ) { |
|
759 | + if ( ! $msg instanceof EE_Message) { |
|
760 | 760 | return false; |
761 | 761 | } |
762 | 762 | //make sure any content in a content property (if not empty) is set on the MSG_content. |
763 | - if ( ! empty( $msg->content ) ) { |
|
764 | - $msg->set( 'MSG_content', $msg->content ); |
|
763 | + if ( ! empty($msg->content)) { |
|
764 | + $msg->set('MSG_content', $msg->content); |
|
765 | 765 | } |
766 | - $queue->add( $msg ); |
|
767 | - return EED_Messages::send_message_with_messenger_only( $messenger, $message_type, $queue ); |
|
766 | + $queue->add($msg); |
|
767 | + return EED_Messages::send_message_with_messenger_only($messenger, $message_type, $queue); |
|
768 | 768 | } |
769 | 769 | |
770 | 770 | |
@@ -778,11 +778,11 @@ discard block |
||
778 | 778 | * @return array|object if creation is successful then we return an array of info, otherwise an error_object is returned. |
779 | 779 | * @throws \EE_Error |
780 | 780 | */ |
781 | - public function create_new_templates( $messenger, $message_type, $GRP_ID = 0, $is_global = false ) { |
|
781 | + public function create_new_templates($messenger, $message_type, $GRP_ID = 0, $is_global = false) { |
|
782 | 782 | // EE_messages has been deprecated |
783 | - $this->_class_is_deprecated( __FUNCTION__ ); |
|
784 | - EE_Registry::instance()->load_helper( 'MSG_Template' ); |
|
785 | - return EEH_MSG_Template::create_new_templates( $messenger, $message_type, $GRP_ID, $is_global ); |
|
783 | + $this->_class_is_deprecated(__FUNCTION__); |
|
784 | + EE_Registry::instance()->load_helper('MSG_Template'); |
|
785 | + return EEH_MSG_Template::create_new_templates($messenger, $message_type, $GRP_ID, $is_global); |
|
786 | 786 | } |
787 | 787 | |
788 | 788 | |
@@ -793,11 +793,11 @@ discard block |
||
793 | 793 | * @param string $message_type_name name of EE_message_type |
794 | 794 | * @return array |
795 | 795 | */ |
796 | - public function get_fields( $messenger_name, $message_type_name ) { |
|
796 | + public function get_fields($messenger_name, $message_type_name) { |
|
797 | 797 | // EE_messages has been deprecated |
798 | - $this->_class_is_deprecated( __FUNCTION__ ); |
|
799 | - EE_Registry::instance()->load_helper( 'MSG_Template' ); |
|
800 | - return EEH_MSG_Template::get_fields( $messenger_name, $message_type_name ); |
|
798 | + $this->_class_is_deprecated(__FUNCTION__); |
|
799 | + EE_Registry::instance()->load_helper('MSG_Template'); |
|
800 | + return EEH_MSG_Template::get_fields($messenger_name, $message_type_name); |
|
801 | 801 | } |
802 | 802 | |
803 | 803 | |
@@ -811,13 +811,13 @@ discard block |
||
811 | 811 | * @return array multidimensional array of messenger and message_type objects |
812 | 812 | * (messengers index, and message_type index); |
813 | 813 | */ |
814 | - public function get_installed( $type = 'all', $skip_cache = false ) { |
|
814 | + public function get_installed($type = 'all', $skip_cache = false) { |
|
815 | 815 | // EE_messages has been deprecated |
816 | - $this->_class_is_deprecated( __FUNCTION__ ); |
|
817 | - if ( $skip_cache ) { |
|
816 | + $this->_class_is_deprecated(__FUNCTION__); |
|
817 | + if ($skip_cache) { |
|
818 | 818 | $this->_message_resource_manager->reset_active_messengers_and_message_types(); |
819 | 819 | } |
820 | - switch ( $type ) { |
|
820 | + switch ($type) { |
|
821 | 821 | case 'messengers' : |
822 | 822 | return array( |
823 | 823 | 'messenger' => $this->_message_resource_manager->installed_messengers(), |
@@ -846,7 +846,7 @@ discard block |
||
846 | 846 | */ |
847 | 847 | public function get_active_messengers() { |
848 | 848 | // EE_messages has been deprecated |
849 | - $this->_class_is_deprecated( __FUNCTION__ ); |
|
849 | + $this->_class_is_deprecated(__FUNCTION__); |
|
850 | 850 | return $this->_message_resource_manager->active_messengers(); |
851 | 851 | } |
852 | 852 | |
@@ -858,7 +858,7 @@ discard block |
||
858 | 858 | */ |
859 | 859 | public function get_active_message_types() { |
860 | 860 | // EE_messages has been deprecated |
861 | - $this->_class_is_deprecated( __FUNCTION__ ); |
|
861 | + $this->_class_is_deprecated(__FUNCTION__); |
|
862 | 862 | return $this->_message_resource_manager->list_of_active_message_types(); |
863 | 863 | } |
864 | 864 | |
@@ -870,7 +870,7 @@ discard block |
||
870 | 870 | */ |
871 | 871 | public function get_active_message_type_objects() { |
872 | 872 | // EE_messages has been deprecated |
873 | - $this->_class_is_deprecated( __FUNCTION__ ); |
|
873 | + $this->_class_is_deprecated(__FUNCTION__); |
|
874 | 874 | return $this->_message_resource_manager->get_active_message_type_objects(); |
875 | 875 | } |
876 | 876 | |
@@ -882,10 +882,10 @@ discard block |
||
882 | 882 | * @param string $messenger The messenger being checked |
883 | 883 | * @return EE_message_type[] (or empty array if none present) |
884 | 884 | */ |
885 | - public function get_active_message_types_per_messenger( $messenger ) { |
|
885 | + public function get_active_message_types_per_messenger($messenger) { |
|
886 | 886 | // EE_messages has been deprecated |
887 | - $this->_class_is_deprecated( __FUNCTION__ ); |
|
888 | - return $this->_message_resource_manager->get_active_message_types_for_messenger( $messenger ); |
|
887 | + $this->_class_is_deprecated(__FUNCTION__); |
|
888 | + return $this->_message_resource_manager->get_active_message_types_for_messenger($messenger); |
|
889 | 889 | } |
890 | 890 | |
891 | 891 | |
@@ -896,10 +896,10 @@ discard block |
||
896 | 896 | * @param string $message_type The string should correspond to a message type. |
897 | 897 | * @return EE_message_type|null |
898 | 898 | */ |
899 | - public function get_active_message_type( $messenger, $message_type ) { |
|
899 | + public function get_active_message_type($messenger, $message_type) { |
|
900 | 900 | // EE_messages has been deprecated |
901 | - $this->_class_is_deprecated( __FUNCTION__ ); |
|
902 | - return $this->_message_resource_manager->get_active_message_type_for_messenger( $messenger, $message_type ); |
|
901 | + $this->_class_is_deprecated(__FUNCTION__); |
|
902 | + return $this->_message_resource_manager->get_active_message_type_for_messenger($messenger, $message_type); |
|
903 | 903 | } |
904 | 904 | |
905 | 905 | |
@@ -910,7 +910,7 @@ discard block |
||
910 | 910 | */ |
911 | 911 | public function get_installed_message_types() { |
912 | 912 | // EE_messages has been deprecated |
913 | - $this->_class_is_deprecated( __FUNCTION__ ); |
|
913 | + $this->_class_is_deprecated(__FUNCTION__); |
|
914 | 914 | return $this->_message_resource_manager->installed_message_types(); |
915 | 915 | } |
916 | 916 | |
@@ -922,7 +922,7 @@ discard block |
||
922 | 922 | */ |
923 | 923 | public function get_installed_messengers() { |
924 | 924 | // EE_messages has been deprecated |
925 | - $this->_class_is_deprecated( __FUNCTION__ ); |
|
925 | + $this->_class_is_deprecated(__FUNCTION__); |
|
926 | 926 | return $this->_message_resource_manager->installed_messengers(); |
927 | 927 | } |
928 | 928 | |
@@ -933,10 +933,10 @@ discard block |
||
933 | 933 | * @param bool $slugs_only Whether to return an array of just slugs and labels (true) or all contexts indexed by message type. |
934 | 934 | * @return array |
935 | 935 | */ |
936 | - public function get_all_contexts( $slugs_only = true ) { |
|
936 | + public function get_all_contexts($slugs_only = true) { |
|
937 | 937 | // EE_messages has been deprecated |
938 | - $this->_class_is_deprecated( __FUNCTION__ ); |
|
939 | - return $this->_message_resource_manager->get_all_contexts( $slugs_only ); |
|
938 | + $this->_class_is_deprecated(__FUNCTION__); |
|
939 | + return $this->_message_resource_manager->get_all_contexts($slugs_only); |
|
940 | 940 | } |
941 | 941 | |
942 | 942 | |
@@ -995,7 +995,7 @@ discard block |
||
995 | 995 | add_filter( |
996 | 996 | 'FHEE__EventEspresso_modules_events_archive_EventsArchiveIframe__display__css', |
997 | 997 | function($event_list_iframe_css) { |
998 | - if ( ! has_filter( 'FHEE__EventsArchiveIframe__event_list_iframe__css' )) { |
|
998 | + if ( ! has_filter('FHEE__EventsArchiveIframe__event_list_iframe__css')) { |
|
999 | 999 | return $event_list_iframe_css; |
1000 | 1000 | } |
1001 | 1001 | deprecated_espresso_action_or_filter_doing_it_wrong( |
@@ -1015,7 +1015,7 @@ discard block |
||
1015 | 1015 | add_filter( |
1016 | 1016 | 'FHEE__EventEspresso_modules_events_archive_EventsArchiveIframe__display__js', |
1017 | 1017 | function($event_list_iframe_js) { |
1018 | - if ( ! has_filter( 'FHEE__EED_Ticket_Selector__ticket_selector_iframe__js' )) { |
|
1018 | + if ( ! has_filter('FHEE__EED_Ticket_Selector__ticket_selector_iframe__js')) { |
|
1019 | 1019 | return $event_list_iframe_js; |
1020 | 1020 | } |
1021 | 1021 | deprecated_espresso_action_or_filter_doing_it_wrong( |
@@ -1035,7 +1035,7 @@ discard block |
||
1035 | 1035 | add_action( |
1036 | 1036 | 'AHEE__EE_Capabilities__addCaps__complete', |
1037 | 1037 | function($capabilities_map) { |
1038 | - if ( ! has_action( 'AHEE__EE_Capabilities__init_role_caps__complete' )) { |
|
1038 | + if ( ! has_action('AHEE__EE_Capabilities__init_role_caps__complete')) { |
|
1039 | 1039 | return; |
1040 | 1040 | } |
1041 | 1041 | deprecated_espresso_action_or_filter_doing_it_wrong( |
@@ -1055,7 +1055,7 @@ discard block |
||
1055 | 1055 | add_filter( |
1056 | 1056 | 'FHEE_EventEspresso_core_services_commands_attendee_CreateAttendeeCommandHandler__findExistingAttendee__existing_attendee', |
1057 | 1057 | function($existing_attendee, $registration, $attendee_data) { |
1058 | - if ( ! has_filter( 'FHEE_EE_Single_Page_Checkout__save_registration_items__find_existing_attendee' )) { |
|
1058 | + if ( ! has_filter('FHEE_EE_Single_Page_Checkout__save_registration_items__find_existing_attendee')) { |
|
1059 | 1059 | return $existing_attendee; |
1060 | 1060 | } |
1061 | 1061 | deprecated_espresso_action_or_filter_doing_it_wrong( |
@@ -1071,7 +1071,7 @@ discard block |
||
1071 | 1071 | $existing_attendee, $registration, $attendee_data |
1072 | 1072 | ); |
1073 | 1073 | }, |
1074 | - 10,3 |
|
1074 | + 10, 3 |
|
1075 | 1075 | ); |
1076 | 1076 | |
1077 | 1077 | /** |
@@ -1135,7 +1135,7 @@ discard block |
||
1135 | 1135 | */ |
1136 | 1136 | public function event_list_title($event_list_title = '') |
1137 | 1137 | { |
1138 | - if (! empty($this->title)) { |
|
1138 | + if ( ! empty($this->title)) { |
|
1139 | 1139 | return $this->title; |
1140 | 1140 | } |
1141 | 1141 | return $event_list_title; |
@@ -31,29 +31,29 @@ discard block |
||
31 | 31 | <tbody> |
32 | 32 | <tr> |
33 | 33 | <td> |
34 | - <h2><?php printf( esc_html__( 'Hello, %s:', 'event_espresso' ), '[PRIMARY_REGISTRANT_FNAME] [PRIMARY_REGISTRANT_LNAME]' ); ?></h2> |
|
35 | - <p class="lead"><?php esc_html_e( "We'd like to remind you that you still owe money for the following transaction:", 'event_espresso' ); ?></p> |
|
36 | - <h3><?php esc_html_e( 'Payment Details:', 'event_espresso' ); ?></h3> |
|
34 | + <h2><?php printf(esc_html__('Hello, %s:', 'event_espresso'), '[PRIMARY_REGISTRANT_FNAME] [PRIMARY_REGISTRANT_LNAME]'); ?></h2> |
|
35 | + <p class="lead"><?php esc_html_e("We'd like to remind you that you still owe money for the following transaction:", 'event_espresso'); ?></p> |
|
36 | + <h3><?php esc_html_e('Payment Details:', 'event_espresso'); ?></h3> |
|
37 | 37 | <ul> |
38 | 38 | <li> |
39 | - <strong><?php esc_html_e( 'Payment Status:', 'event_espresso' ); ?></strong> [PAYMENT_STATUS] |
|
39 | + <strong><?php esc_html_e('Payment Status:', 'event_espresso'); ?></strong> [PAYMENT_STATUS] |
|
40 | 40 | </li> |
41 | 41 | <li> |
42 | - <strong><?php esc_html_e( 'Transaction ID:', 'event_espresso' ); ?></strong> [TXN_ID] |
|
42 | + <strong><?php esc_html_e('Transaction ID:', 'event_espresso'); ?></strong> [TXN_ID] |
|
43 | 43 | </li> |
44 | 44 | <li> |
45 | - <strong><?php esc_html_e( 'Total Cost:', 'event_espresso' ); ?></strong> [TOTAL_COST] |
|
45 | + <strong><?php esc_html_e('Total Cost:', 'event_espresso'); ?></strong> [TOTAL_COST] |
|
46 | 46 | </li> |
47 | 47 | <li> |
48 | - <strong><?php esc_html_e( 'Amount Due:', 'event_espresso' ); ?></strong> [TOTAL_OWING] |
|
48 | + <strong><?php esc_html_e('Amount Due:', 'event_espresso'); ?></strong> [TOTAL_OWING] |
|
49 | 49 | </li> |
50 | 50 | </ul> |
51 | 51 | <p class="callout"> |
52 | - <?php printf( esc_html__( 'Please %sretry your payment%s, or choose an alternate payment method to reserve your space.', 'event_espresso' ), '<a href="[PAYMENT_URL]">', '</a>' ); ?> |
|
52 | + <?php printf(esc_html__('Please %sretry your payment%s, or choose an alternate payment method to reserve your space.', 'event_espresso'), '<a href="[PAYMENT_URL]">', '</a>'); ?> |
|
53 | 53 | </p> |
54 | 54 | [EVENT_LIST] |
55 | 55 | <p class="callout"> |
56 | - <?php printf( esc_html__( 'Please %sretry your payment%s, or choose an alternate payment method to reserve your space.', 'event_espresso' ), '<a href="[PAYMENT_URL]">', '</a>' ); ?> |
|
56 | + <?php printf(esc_html__('Please %sretry your payment%s, or choose an alternate payment method to reserve your space.', 'event_espresso'), '<a href="[PAYMENT_URL]">', '</a>'); ?> |
|
57 | 57 | </p> |
58 | 58 | </td> |
59 | 59 | </tr> |
@@ -78,10 +78,10 @@ discard block |
||
78 | 78 | <tbody> |
79 | 79 | <tr> |
80 | 80 | <td> |
81 | - <h3><?php esc_html_e( 'Connect with Us:', 'event_espresso' ); ?></h3> |
|
82 | - <a class="soc-btn fb" href="[CO_FACEBOOK_URL]"><?php esc_html_e( 'Facebook', 'event_espresso' ); ?></a> |
|
83 | - <a class="soc-btn tw" href="[CO_TWITTER_URL]"><?php esc_html_e( 'Twitter', 'event_espresso' ); ?></a> |
|
84 | - <a class="soc-btn gp" href="[CO_GOOGLE_URL]"><?php esc_html_e( 'Google+', 'event_espresso' ); ?></a> |
|
81 | + <h3><?php esc_html_e('Connect with Us:', 'event_espresso'); ?></h3> |
|
82 | + <a class="soc-btn fb" href="[CO_FACEBOOK_URL]"><?php esc_html_e('Facebook', 'event_espresso'); ?></a> |
|
83 | + <a class="soc-btn tw" href="[CO_TWITTER_URL]"><?php esc_html_e('Twitter', 'event_espresso'); ?></a> |
|
84 | + <a class="soc-btn gp" href="[CO_GOOGLE_URL]"><?php esc_html_e('Google+', 'event_espresso'); ?></a> |
|
85 | 85 | </td> |
86 | 86 | </tr> |
87 | 87 | </tbody> |
@@ -91,9 +91,9 @@ discard block |
||
91 | 91 | <tbody> |
92 | 92 | <tr> |
93 | 93 | <td> |
94 | - <h3><?php esc_html_e( 'Contact Info:', 'event_espresso' ); ?></h3> |
|
95 | - <?php esc_html_e( 'Phone:', 'event_espresso' ); ?> <strong>[CO_PHONE]</strong> |
|
96 | - <?php esc_html_e( 'Email:', 'event_espresso' ); ?> |
|
94 | + <h3><?php esc_html_e('Contact Info:', 'event_espresso'); ?></h3> |
|
95 | + <?php esc_html_e('Phone:', 'event_espresso'); ?> <strong>[CO_PHONE]</strong> |
|
96 | + <?php esc_html_e('Email:', 'event_espresso'); ?> |
|
97 | 97 | <strong><a href="mailto:[CO_EMAIL]" target="_blank">[CO_EMAIL]</a></strong> |
98 | 98 | </td> |
99 | 99 | </tr> |
@@ -31,23 +31,23 @@ discard block |
||
31 | 31 | <tbody> |
32 | 32 | <tr> |
33 | 33 | <td> |
34 | - <h1><?php esc_html_e( 'Payment Reminder Notification', 'event_espresso' ); ?></h1> |
|
35 | - <?php esc_html_e( 'The following message was sent to the Primary Registrant of this transaction:', 'event_espresso' ); ?> |
|
36 | - <h3><?php esc_html_e( 'Payment Details:', 'event_espresso' ); ?></h3> |
|
34 | + <h1><?php esc_html_e('Payment Reminder Notification', 'event_espresso'); ?></h1> |
|
35 | + <?php esc_html_e('The following message was sent to the Primary Registrant of this transaction:', 'event_espresso'); ?> |
|
36 | + <h3><?php esc_html_e('Payment Details:', 'event_espresso'); ?></h3> |
|
37 | 37 | <ul> |
38 | 38 | <li> |
39 | - <strong><?php esc_html_e( 'Payment Status:', 'event_espresso' ); ?></strong> [PAYMENT_STATUS] |
|
39 | + <strong><?php esc_html_e('Payment Status:', 'event_espresso'); ?></strong> [PAYMENT_STATUS] |
|
40 | 40 | </li> |
41 | - <li><strong><?php esc_html_e( 'Transaction ID:', 'event_espresso' ); ?></strong> |
|
41 | + <li><strong><?php esc_html_e('Transaction ID:', 'event_espresso'); ?></strong> |
|
42 | 42 | <a href="[TRANSACTION_ADMIN_URL]">[TXN_ID]</a></li> |
43 | 43 | <li> |
44 | - <strong><?php esc_html_e( 'Payment Gateway:', 'event_espresso' ); ?></strong> [PAYMENT_GATEWAY] |
|
44 | + <strong><?php esc_html_e('Payment Gateway:', 'event_espresso'); ?></strong> [PAYMENT_GATEWAY] |
|
45 | 45 | </li> |
46 | 46 | <li> |
47 | - <strong><?php esc_html_e( 'Total Cost:', 'event_espresso' ); ?></strong> [TOTAL_COST] |
|
47 | + <strong><?php esc_html_e('Total Cost:', 'event_espresso'); ?></strong> [TOTAL_COST] |
|
48 | 48 | </li> |
49 | 49 | <li> |
50 | - <strong><?php esc_html_e( 'Amount Due:', 'event_espresso' ); ?></strong> [TOTAL_OWING] |
|
50 | + <strong><?php esc_html_e('Amount Due:', 'event_espresso'); ?></strong> [TOTAL_OWING] |
|
51 | 51 | </li> |
52 | 52 | </ul> |
53 | 53 | </td> |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | </table> |
57 | 57 | </div> |
58 | 58 | <div class="content"> |
59 | - <h2><?php esc_html_e( 'Registrant Details:', 'event_espresso' ); ?></h2> |
|
59 | + <h2><?php esc_html_e('Registrant Details:', 'event_espresso'); ?></h2> |
|
60 | 60 | <p class="callout"><strong>[PRIMARY_REGISTRANT_FNAME] [PRIMARY_REGISTRANT_LNAME]:</strong> |
61 | 61 | <a href="mailto:[PRIMARY_REGISTRANT_EMAIL]">[PRIMARY_REGISTRANT_EMAIL]</a></p> |
62 | 62 | </div> |
@@ -64,14 +64,14 @@ |
||
64 | 64 | //make sure we end up with a copy of the EE_Messages_Addressee object |
65 | 65 | $this->_recipient = $this->_data instanceof EE_Messages_Addressee ? $this->_data : null; |
66 | 66 | $this->_recipient = ! $this->_recipient instanceof EE_Messages_Addressee |
67 | - && is_array( $this->_data ) |
|
68 | - && isset( $this->_data['data'] ) |
|
69 | - && $this->_data['data'] instanceof EE_Messages_Addressee |
|
67 | + && is_array( $this->_data ) |
|
68 | + && isset( $this->_data['data'] ) |
|
69 | + && $this->_data['data'] instanceof EE_Messages_Addressee |
|
70 | 70 | ? $this->_data['data'] : |
71 | 71 | $this->_recipient; |
72 | 72 | $this->_recipient = ! $this->_recipient instanceof EE_Messages_Addressee |
73 | - && ! empty( $this->_extra_data['data'] ) |
|
74 | - && $this->_extra_data['data'] instanceof EE_Messages_Addressee |
|
73 | + && ! empty( $this->_extra_data['data'] ) |
|
74 | + && $this->_extra_data['data'] instanceof EE_Messages_Addressee |
|
75 | 75 | ? $this->_extra_data['data'] |
76 | 76 | : $this->_recipient; |
77 | 77 |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -if (!defined('EVENT_ESPRESSO_VERSION') ) |
|
3 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) |
|
4 | 4 | exit('NO direct script access allowed'); |
5 | 5 | |
6 | 6 | /** |
@@ -37,24 +37,24 @@ discard block |
||
37 | 37 | |
38 | 38 | |
39 | 39 | protected function _init_props() { |
40 | - $this->label = esc_html__( 'Recipient Details Shortcodes', 'event_espresso' ); |
|
41 | - $this->description = esc_html__( 'All shortcodes specific to recipient registration data', 'event_espresso' ); |
|
40 | + $this->label = esc_html__('Recipient Details Shortcodes', 'event_espresso'); |
|
41 | + $this->description = esc_html__('All shortcodes specific to recipient registration data', 'event_espresso'); |
|
42 | 42 | $this->_shortcodes = array( |
43 | - '[RECIPIENT_FNAME]' => esc_html__( 'Parses to the first name of the recipient for the message.', 'event_espresso' ), |
|
44 | - '[RECIPIENT_LNAME]' => esc_html__( 'Parses to the last name of the recipient for the message.', 'event_espresso' ), |
|
45 | - '[RECIPIENT_EMAIL]' => esc_html__( 'Parses to the email address of the recipient for the message.', 'event_espresso' ), |
|
46 | - '[RECIPIENT_REGISTRATION_ID]' => esc_html__( 'Parses to the registration ID of the recipient for the message.', 'event_espresso' ), |
|
47 | - '[RECIPIENT_REGISTRATION_CODE]' => esc_html__( 'Parses to the registration code of the recipient for the message.', 'event_espresso' ), |
|
48 | - '[RECIPIENT_EDIT_REGISTRATION_LINK]' => esc_html__( 'Parses to a link for frontend editing of the registration for the recipient.', 'event_espresso' ), |
|
49 | - '[RECIPIENT_PHONE_NUMBER]' => esc_html__( 'The Phone Number for the recipient of the message.', 'event_espresso' ), |
|
50 | - '[RECIPIENT_ADDRESS]' => esc_html__( 'The Address for the recipient of the message.', 'event_espresso' ), |
|
51 | - '[RECIPIENT_ADDRESS2]' => esc_html__( 'Whatever was in the address 2 field for the recipient of the message.', 'event_espresso' ), |
|
52 | - '[RECIPIENT_CITY]' => esc_html__( 'The city for the recipient of the message.', 'event_espresso' ), |
|
53 | - '[RECIPIENT_ZIP_PC]' => esc_html__( 'The ZIP (or Postal) Code for the recipient of the message.', 'event_espresso' ), |
|
54 | - '[RECIPIENT_ADDRESS_STATE]' => esc_html__( 'The state/province for the recipient of the message.', 'event_espresso' ), |
|
55 | - '[RECIPIENT_COUNTRY]' => esc_html__( 'The country for the recipient of the message.', 'event_espresso' ), |
|
56 | - '[RECIPIENT_ANSWER_*]' => esc_html__( 'This is a special dynamic shortcode. After the "*", add the exact text of an existing question, and if there is an answer for that question for this recipient, then it will be output in place of this shortcode.', 'event_espresso' ), |
|
57 | - '[RECIPIENT_TOTAL_AMOUNT_PAID]' => esc_html__( 'If a single registration related to the recipient is available, that is used to retrieve the total amount that has been paid for this recipient. Otherwise the value of 0 is printed.', 'event_espresso' ) |
|
43 | + '[RECIPIENT_FNAME]' => esc_html__('Parses to the first name of the recipient for the message.', 'event_espresso'), |
|
44 | + '[RECIPIENT_LNAME]' => esc_html__('Parses to the last name of the recipient for the message.', 'event_espresso'), |
|
45 | + '[RECIPIENT_EMAIL]' => esc_html__('Parses to the email address of the recipient for the message.', 'event_espresso'), |
|
46 | + '[RECIPIENT_REGISTRATION_ID]' => esc_html__('Parses to the registration ID of the recipient for the message.', 'event_espresso'), |
|
47 | + '[RECIPIENT_REGISTRATION_CODE]' => esc_html__('Parses to the registration code of the recipient for the message.', 'event_espresso'), |
|
48 | + '[RECIPIENT_EDIT_REGISTRATION_LINK]' => esc_html__('Parses to a link for frontend editing of the registration for the recipient.', 'event_espresso'), |
|
49 | + '[RECIPIENT_PHONE_NUMBER]' => esc_html__('The Phone Number for the recipient of the message.', 'event_espresso'), |
|
50 | + '[RECIPIENT_ADDRESS]' => esc_html__('The Address for the recipient of the message.', 'event_espresso'), |
|
51 | + '[RECIPIENT_ADDRESS2]' => esc_html__('Whatever was in the address 2 field for the recipient of the message.', 'event_espresso'), |
|
52 | + '[RECIPIENT_CITY]' => esc_html__('The city for the recipient of the message.', 'event_espresso'), |
|
53 | + '[RECIPIENT_ZIP_PC]' => esc_html__('The ZIP (or Postal) Code for the recipient of the message.', 'event_espresso'), |
|
54 | + '[RECIPIENT_ADDRESS_STATE]' => esc_html__('The state/province for the recipient of the message.', 'event_espresso'), |
|
55 | + '[RECIPIENT_COUNTRY]' => esc_html__('The country for the recipient of the message.', 'event_espresso'), |
|
56 | + '[RECIPIENT_ANSWER_*]' => esc_html__('This is a special dynamic shortcode. After the "*", add the exact text of an existing question, and if there is an answer for that question for this recipient, then it will be output in place of this shortcode.', 'event_espresso'), |
|
57 | + '[RECIPIENT_TOTAL_AMOUNT_PAID]' => esc_html__('If a single registration related to the recipient is available, that is used to retrieve the total amount that has been paid for this recipient. Otherwise the value of 0 is printed.', 'event_espresso') |
|
58 | 58 | ); |
59 | 59 | } |
60 | 60 | |
@@ -65,36 +65,35 @@ discard block |
||
65 | 65 | * @param string $shortcode the shortcode to be parsed. |
66 | 66 | * @return string parsed shortcode |
67 | 67 | */ |
68 | - protected function _parser( $shortcode ) { |
|
68 | + protected function _parser($shortcode) { |
|
69 | 69 | |
70 | 70 | //make sure we end up with a copy of the EE_Messages_Addressee object |
71 | 71 | $this->_recipient = $this->_data instanceof EE_Messages_Addressee ? $this->_data : null; |
72 | 72 | $this->_recipient = ! $this->_recipient instanceof EE_Messages_Addressee |
73 | - && is_array( $this->_data ) |
|
74 | - && isset( $this->_data['data'] ) |
|
73 | + && is_array($this->_data) |
|
74 | + && isset($this->_data['data']) |
|
75 | 75 | && $this->_data['data'] instanceof EE_Messages_Addressee |
76 | - ? $this->_data['data'] : |
|
77 | - $this->_recipient; |
|
76 | + ? $this->_data['data'] : $this->_recipient; |
|
78 | 77 | $this->_recipient = ! $this->_recipient instanceof EE_Messages_Addressee |
79 | - && ! empty( $this->_extra_data['data'] ) |
|
78 | + && ! empty($this->_extra_data['data']) |
|
80 | 79 | && $this->_extra_data['data'] instanceof EE_Messages_Addressee |
81 | 80 | ? $this->_extra_data['data'] |
82 | 81 | : $this->_recipient; |
83 | 82 | |
84 | - if ( ! $this->_recipient instanceof EE_Messages_Addressee ) { |
|
83 | + if ( ! $this->_recipient instanceof EE_Messages_Addressee) { |
|
85 | 84 | return ''; |
86 | 85 | } |
87 | 86 | |
88 | 87 | $attendee = $this->_recipient->att_obj; |
89 | - if ( ! $attendee instanceof EE_Attendee ) { |
|
88 | + if ( ! $attendee instanceof EE_Attendee) { |
|
90 | 89 | return ''; |
91 | 90 | } |
92 | 91 | |
93 | - $this->_registrations_for_recipient = isset( $this->_recipient->attendees[ $attendee->ID() ]['reg_objs'] ) |
|
94 | - ? $this->_recipient->attendees[ $attendee->ID() ]['reg_objs'] |
|
92 | + $this->_registrations_for_recipient = isset($this->_recipient->attendees[$attendee->ID()]['reg_objs']) |
|
93 | + ? $this->_recipient->attendees[$attendee->ID()]['reg_objs'] |
|
95 | 94 | : array(); |
96 | 95 | |
97 | - switch ( $shortcode ) { |
|
96 | + switch ($shortcode) { |
|
98 | 97 | case '[RECIPIENT_FNAME]' : |
99 | 98 | return $attendee->fname(); |
100 | 99 | break; |
@@ -108,21 +107,21 @@ discard block |
||
108 | 107 | break; |
109 | 108 | |
110 | 109 | case '[RECIPIENT_REGISTRATION_ID]' : |
111 | - if ( ! $this->_recipient->reg_obj instanceof EE_Registration ) { |
|
110 | + if ( ! $this->_recipient->reg_obj instanceof EE_Registration) { |
|
112 | 111 | return ''; |
113 | 112 | } |
114 | 113 | return $this->_get_reg_id(); |
115 | 114 | break; |
116 | 115 | |
117 | 116 | case '[RECIPIENT_REGISTRATION_CODE]' : |
118 | - if ( ! $this->_recipient->reg_obj instanceof EE_Registration ) { |
|
117 | + if ( ! $this->_recipient->reg_obj instanceof EE_Registration) { |
|
119 | 118 | return ''; |
120 | 119 | } |
121 | 120 | return $this->_get_reg_code(); |
122 | 121 | break; |
123 | 122 | |
124 | 123 | case '[RECIPIENT_EDIT_REGISTRATION_LINK]' : |
125 | - if ( ! $this->_recipient->reg_obj instanceof EE_Registration ) { |
|
124 | + if ( ! $this->_recipient->reg_obj instanceof EE_Registration) { |
|
126 | 125 | return ''; |
127 | 126 | } |
128 | 127 | return $this->_recipient->reg_obj->edit_attendee_information_url(); |
@@ -164,23 +163,23 @@ discard block |
||
164 | 163 | break; |
165 | 164 | } |
166 | 165 | |
167 | - if ( strpos( $shortcode, '[RECIPIENT_ANSWER_*' ) !== false ) { |
|
168 | - $shortcode = str_replace( '[RECIPIENT_ANSWER_*', '', $shortcode ); |
|
169 | - $shortcode = trim( str_replace( ']', '', $shortcode ) ); |
|
166 | + if (strpos($shortcode, '[RECIPIENT_ANSWER_*') !== false) { |
|
167 | + $shortcode = str_replace('[RECIPIENT_ANSWER_*', '', $shortcode); |
|
168 | + $shortcode = trim(str_replace(']', '', $shortcode)); |
|
170 | 169 | |
171 | 170 | |
172 | 171 | //now let's figure out what question has this text |
173 | - if ( empty( $this->_recipient->questions ) || ! $this->_recipient->reg_obj instanceof EE_Registration ) { |
|
172 | + if (empty($this->_recipient->questions) || ! $this->_recipient->reg_obj instanceof EE_Registration) { |
|
174 | 173 | return ''; |
175 | 174 | } |
176 | 175 | |
177 | - foreach ( $this->_recipient->questions as $ansid => $question ) { |
|
176 | + foreach ($this->_recipient->questions as $ansid => $question) { |
|
178 | 177 | if ( |
179 | 178 | $question instanceof EE_Question |
180 | - && trim( $question->display_text() ) == trim( $shortcode ) |
|
181 | - && isset( $this->_recipient->registrations[ $this->_recipient->reg_obj->ID() ]['ans_objs'][ $ansid ] ) |
|
179 | + && trim($question->display_text()) == trim($shortcode) |
|
180 | + && isset($this->_recipient->registrations[$this->_recipient->reg_obj->ID()]['ans_objs'][$ansid]) |
|
182 | 181 | ) { |
183 | - return $this->_recipient->registrations[ $this->_recipient->reg_obj->ID() ]['ans_objs'][ $ansid ]->get_pretty( 'ANS_value', 'no_wpautop' ); |
|
182 | + return $this->_recipient->registrations[$this->_recipient->reg_obj->ID()]['ans_objs'][$ansid]->get_pretty('ANS_value', 'no_wpautop'); |
|
184 | 183 | } |
185 | 184 | } |
186 | 185 | } |
@@ -211,53 +210,53 @@ discard block |
||
211 | 210 | protected function _get_reg_code() { |
212 | 211 | |
213 | 212 | //if only one related registration for the recipient then just return that reg code. |
214 | - if ( count( $this->_registrations_for_recipient ) <= 1 ) { |
|
213 | + if (count($this->_registrations_for_recipient) <= 1) { |
|
215 | 214 | return $this->_recipient->reg_obj->reg_code(); |
216 | 215 | } |
217 | 216 | |
218 | 217 | //k more than one registration so let's see if we can get specific to context |
219 | 218 | //are we parsing event_list? |
220 | - if ( $this->_data instanceof EE_Event ) { |
|
219 | + if ($this->_data instanceof EE_Event) { |
|
221 | 220 | $reg_code = array(); |
222 | 221 | //loop through registrations for recipient and see if there is a match for this event |
223 | - foreach ( $this->_registrations_for_recipient as $reg ) { |
|
224 | - if ( $reg instanceof EE_Registration && $reg->event_ID() == $this->_data->ID() ) { |
|
222 | + foreach ($this->_registrations_for_recipient as $reg) { |
|
223 | + if ($reg instanceof EE_Registration && $reg->event_ID() == $this->_data->ID()) { |
|
225 | 224 | $reg_code[] = $reg->reg_code(); |
226 | 225 | } |
227 | 226 | } |
228 | - return implode( ', ', $reg_code ); |
|
227 | + return implode(', ', $reg_code); |
|
229 | 228 | } |
230 | 229 | |
231 | 230 | //are we parsing ticket list? |
232 | - if ( $this->_data instanceof EE_Ticket ) { |
|
231 | + if ($this->_data instanceof EE_Ticket) { |
|
233 | 232 | $reg_code = array(); |
234 | 233 | //loop through each registration for recipient and see if there is a match for this ticket |
235 | - foreach ( $this->_registrations_for_recipient as $reg ) { |
|
236 | - if ( $reg instanceof EE_Registration && $reg->ticket_ID() == $this->_data->ID() ) { |
|
234 | + foreach ($this->_registrations_for_recipient as $reg) { |
|
235 | + if ($reg instanceof EE_Registration && $reg->ticket_ID() == $this->_data->ID()) { |
|
237 | 236 | $reg_code = $reg->reg_code(); |
238 | 237 | } |
239 | 238 | } |
240 | - return implode( ', ', $reg_code ); |
|
239 | + return implode(', ', $reg_code); |
|
241 | 240 | } |
242 | 241 | |
243 | 242 | //do we have a specific reg_obj? Let's use it |
244 | - if ( $this->_data instanceof EE_Messages_Addressee && $this->_data->reg_obj instanceof EE_Registration ) { |
|
243 | + if ($this->_data instanceof EE_Messages_Addressee && $this->_data->reg_obj instanceof EE_Registration) { |
|
245 | 244 | return $this->_data->reg_obj->reg_code(); |
246 | 245 | } |
247 | 246 | |
248 | 247 | //do we have a specific reg_obj? Let's use it |
249 | - if ( $this->_data instanceof EE_Messages_Addressee && $this->_data->reg_obj instanceof EE_Registration ) { |
|
248 | + if ($this->_data instanceof EE_Messages_Addressee && $this->_data->reg_obj instanceof EE_Registration) { |
|
250 | 249 | return $this->_data->reg_obj->reg_code(); |
251 | 250 | } |
252 | 251 | |
253 | 252 | //not able to determine the single reg code so let's return a comma delimited list of reg codes. |
254 | 253 | $reg_code = array(); |
255 | - foreach ( $this->_registrations_for_recipient as $reg ) { |
|
256 | - if ( $reg instanceof EE_Registration ) { |
|
254 | + foreach ($this->_registrations_for_recipient as $reg) { |
|
255 | + if ($reg instanceof EE_Registration) { |
|
257 | 256 | $reg_code[] = $reg->reg_code(); |
258 | 257 | } |
259 | 258 | } |
260 | - return implode( ', ', $reg_code ); |
|
259 | + return implode(', ', $reg_code); |
|
261 | 260 | } |
262 | 261 | |
263 | 262 | |
@@ -270,48 +269,48 @@ discard block |
||
270 | 269 | protected function _get_reg_id() { |
271 | 270 | |
272 | 271 | //if only one related registration for the recipient then just return that reg code. |
273 | - if ( count( $this->_registrations_for_recipient ) <= 1 ) { |
|
272 | + if (count($this->_registrations_for_recipient) <= 1) { |
|
274 | 273 | return $this->_recipient->reg_obj->ID(); |
275 | 274 | } |
276 | 275 | |
277 | 276 | //k more than one registration so let's see if we can get specific to context |
278 | 277 | //are we parsing event_list? |
279 | - if ( $this->_data instanceof EE_Event ) { |
|
278 | + if ($this->_data instanceof EE_Event) { |
|
280 | 279 | $registration_ids = array(); |
281 | 280 | //loop through registrations for recipient and see if there is a match for this event |
282 | - foreach ( $this->_registrations_for_recipient as $reg ) { |
|
283 | - if ( $reg instanceof EE_Registration && $reg->event_ID() == $this->_data->ID() ) { |
|
281 | + foreach ($this->_registrations_for_recipient as $reg) { |
|
282 | + if ($reg instanceof EE_Registration && $reg->event_ID() == $this->_data->ID()) { |
|
284 | 283 | $registration_ids[] = $reg->ID(); |
285 | 284 | } |
286 | 285 | } |
287 | - return implode( ', ', $registration_ids ); |
|
286 | + return implode(', ', $registration_ids); |
|
288 | 287 | } |
289 | 288 | |
290 | 289 | //are we parsing ticket list? |
291 | - if ( $this->_data instanceof EE_Ticket ) { |
|
290 | + if ($this->_data instanceof EE_Ticket) { |
|
292 | 291 | $registration_ids = array(); |
293 | 292 | //loop through each registration for recipient and see if there is a match for this ticket |
294 | - foreach ( $this->_registrations_for_recipient as $reg ) { |
|
295 | - if ( $reg instanceof EE_Registration && $reg->ticket_ID() == $this->_data->ID() ) { |
|
293 | + foreach ($this->_registrations_for_recipient as $reg) { |
|
294 | + if ($reg instanceof EE_Registration && $reg->ticket_ID() == $this->_data->ID()) { |
|
296 | 295 | $registration_ids = $reg->ID(); |
297 | 296 | } |
298 | 297 | } |
299 | - return implode( ', ', $registration_ids ); |
|
298 | + return implode(', ', $registration_ids); |
|
300 | 299 | } |
301 | 300 | |
302 | 301 | //do we have a specific reg_obj? Let's use it |
303 | - if ( $this->_data instanceof EE_Messages_Addressee && $this->_data->reg_obj instanceof EE_Registration ) { |
|
302 | + if ($this->_data instanceof EE_Messages_Addressee && $this->_data->reg_obj instanceof EE_Registration) { |
|
304 | 303 | return $this->_data->reg_obj->ID(); |
305 | 304 | } |
306 | 305 | |
307 | 306 | //not able to determine the single reg code so let's return a comma delimited list of reg codes. |
308 | 307 | $registration_ids = array(); |
309 | - foreach ( $this->_registrations_for_recipient as $reg ) { |
|
310 | - if ( $reg instanceof EE_Registration ) { |
|
308 | + foreach ($this->_registrations_for_recipient as $reg) { |
|
309 | + if ($reg instanceof EE_Registration) { |
|
311 | 310 | $registration_ids[] = $reg->ID(); |
312 | 311 | } |
313 | 312 | } |
314 | - return implode( ', ', $registration_ids ); |
|
313 | + return implode(', ', $registration_ids); |
|
315 | 314 | } |
316 | 315 | |
317 | 316 |
@@ -1,6 +1,7 @@ |
||
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 | 6 | /** |
6 | 7 | * Event Espresso |
@@ -41,7 +41,7 @@ |
||
41 | 41 | |
42 | 42 | /** |
43 | 43 | * EE_Attendee_Shortcodes constructor. |
44 | - */ |
|
44 | + */ |
|
45 | 45 | public function __construct() { |
46 | 46 | parent::__construct(); |
47 | 47 | } |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -if (!defined('EVENT_ESPRESSO_VERSION') ) |
|
3 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) |
|
4 | 4 | exit('NO direct script access allowed'); |
5 | 5 | |
6 | 6 | /** |
@@ -49,26 +49,26 @@ discard block |
||
49 | 49 | |
50 | 50 | |
51 | 51 | protected function _init_props() { |
52 | - $this->label = esc_html__( 'Attendee Shortcodes', 'event_espresso' ); |
|
53 | - $this->description = esc_html__( 'All shortcodes specific to attendee related data', 'event_espresso' ); |
|
52 | + $this->label = esc_html__('Attendee Shortcodes', 'event_espresso'); |
|
53 | + $this->description = esc_html__('All shortcodes specific to attendee related data', 'event_espresso'); |
|
54 | 54 | $this->_shortcodes = array( |
55 | - '[FNAME]' => esc_html__( 'First Name of an attendee.', 'event_espresso' ), |
|
56 | - '[LNAME]' => esc_html__( 'Last Name of an attendee.', 'event_espresso' ), |
|
57 | - '[ATTENDEE_EMAIL]' => esc_html__( 'Email address for the attendee.', 'event_espresso' ), |
|
58 | - '[EDIT_ATTENDEE_LINK]' => esc_html__( 'Edit Registration Link (typically you\'d only use this for messages going to event administrators)', 'event_espresso' ), |
|
59 | - '[REGISTRATION_ID]' => esc_html__( 'Unique Registration ID for the registration', 'event_espresso' ), |
|
60 | - '[REGISTRATION_CODE]' => esc_html__( 'Unique Registration Code for the registration', 'event_espresso' ), |
|
61 | - '[REGISTRATION_STATUS_ID]' => esc_html__( 'Parses to the registration status for the attendee', 'event_espresso' ), |
|
62 | - '[REGISTRATION_STATUS_LABEL]' => esc_html__( 'Parses to the status label for the registrant', 'event_espresso' ), |
|
63 | - '[REGISTRATION_TOTAL_AMOUNT_PAID]' => esc_html__( 'Parses to the total amount paid for this registration.', 'event_espresso' ), |
|
64 | - '[FRONTEND_EDIT_REG_LINK]' => esc_html__( 'Generates a link for the given registration to edit this registration details on the frontend.', 'event_espresso' ), |
|
65 | - '[PHONE_NUMBER]' => esc_html__( 'The Phone Number for the Registration.', 'event_espresso' ), |
|
66 | - '[ADDRESS]' => esc_html__( 'The Address for the Registration', 'event_espresso' ), |
|
67 | - '[ADDRESS2]' => esc_html__( 'Whatever was in the address 2 field for the registration.', 'event_espresso' ), |
|
68 | - '[CITY]' => esc_html__( 'The city for the registration.', 'event_espresso' ), |
|
69 | - '[ZIP_PC]' => esc_html__( 'The ZIP (or Postal) Code for the Registration.', 'event_espresso' ), |
|
70 | - '[ADDRESS_STATE]' => esc_html__( 'The state/province for the registration.', 'event_espresso' ), |
|
71 | - '[COUNTRY]' => esc_html__( 'The country for the registration.', 'event_espresso' ) |
|
55 | + '[FNAME]' => esc_html__('First Name of an attendee.', 'event_espresso'), |
|
56 | + '[LNAME]' => esc_html__('Last Name of an attendee.', 'event_espresso'), |
|
57 | + '[ATTENDEE_EMAIL]' => esc_html__('Email address for the attendee.', 'event_espresso'), |
|
58 | + '[EDIT_ATTENDEE_LINK]' => esc_html__('Edit Registration Link (typically you\'d only use this for messages going to event administrators)', 'event_espresso'), |
|
59 | + '[REGISTRATION_ID]' => esc_html__('Unique Registration ID for the registration', 'event_espresso'), |
|
60 | + '[REGISTRATION_CODE]' => esc_html__('Unique Registration Code for the registration', 'event_espresso'), |
|
61 | + '[REGISTRATION_STATUS_ID]' => esc_html__('Parses to the registration status for the attendee', 'event_espresso'), |
|
62 | + '[REGISTRATION_STATUS_LABEL]' => esc_html__('Parses to the status label for the registrant', 'event_espresso'), |
|
63 | + '[REGISTRATION_TOTAL_AMOUNT_PAID]' => esc_html__('Parses to the total amount paid for this registration.', 'event_espresso'), |
|
64 | + '[FRONTEND_EDIT_REG_LINK]' => esc_html__('Generates a link for the given registration to edit this registration details on the frontend.', 'event_espresso'), |
|
65 | + '[PHONE_NUMBER]' => esc_html__('The Phone Number for the Registration.', 'event_espresso'), |
|
66 | + '[ADDRESS]' => esc_html__('The Address for the Registration', 'event_espresso'), |
|
67 | + '[ADDRESS2]' => esc_html__('Whatever was in the address 2 field for the registration.', 'event_espresso'), |
|
68 | + '[CITY]' => esc_html__('The city for the registration.', 'event_espresso'), |
|
69 | + '[ZIP_PC]' => esc_html__('The ZIP (or Postal) Code for the Registration.', 'event_espresso'), |
|
70 | + '[ADDRESS_STATE]' => esc_html__('The state/province for the registration.', 'event_espresso'), |
|
71 | + '[COUNTRY]' => esc_html__('The country for the registration.', 'event_espresso') |
|
72 | 72 | ); |
73 | 73 | } |
74 | 74 | |
@@ -82,10 +82,10 @@ discard block |
||
82 | 82 | * @return string |
83 | 83 | * @throws \EE_Error |
84 | 84 | */ |
85 | - protected function _parser( $shortcode ) { |
|
85 | + protected function _parser($shortcode) { |
|
86 | 86 | |
87 | 87 | |
88 | - $this->_xtra = ! empty( $this->_extra_data ) && $this->_extra_data['data'] instanceof EE_Messages_Addressee |
|
88 | + $this->_xtra = ! empty($this->_extra_data) && $this->_extra_data['data'] instanceof EE_Messages_Addressee |
|
89 | 89 | ? $this->_extra_data['data'] |
90 | 90 | : null; |
91 | 91 | |
@@ -94,34 +94,34 @@ discard block |
||
94 | 94 | ? null |
95 | 95 | : $this->_data; |
96 | 96 | |
97 | - if ( ! $registration instanceof EE_Registration ) { |
|
97 | + if ( ! $registration instanceof EE_Registration) { |
|
98 | 98 | //let's attempt to get the txn_id for the error message. |
99 | - $txn_id = isset( $this->_xtra->txn ) && $this->_xtra->txn instanceof EE_Transaction |
|
99 | + $txn_id = isset($this->_xtra->txn) && $this->_xtra->txn instanceof EE_Transaction |
|
100 | 100 | ? $this->_xtra->txn->ID() |
101 | - : esc_html__( 'Unknown', 'event_espresso' ); |
|
102 | - $msg = esc_html__( 'There is no EE_Registration object in the data sent to the EE_Attendee Shortcode Parser for the messages system.', 'event_espresso' ); |
|
101 | + : esc_html__('Unknown', 'event_espresso'); |
|
102 | + $msg = esc_html__('There is no EE_Registration object in the data sent to the EE_Attendee Shortcode Parser for the messages system.', 'event_espresso'); |
|
103 | 103 | $dev_msg = sprintf( |
104 | - esc_html__( 'The transaction ID for this request is: %s', 'event_espresso' ), |
|
104 | + esc_html__('The transaction ID for this request is: %s', 'event_espresso'), |
|
105 | 105 | $txn_id |
106 | 106 | ); |
107 | - throw new EE_Error( "{$msg}||{$msg} {$dev_msg}" ); |
|
107 | + throw new EE_Error("{$msg}||{$msg} {$dev_msg}"); |
|
108 | 108 | } |
109 | 109 | |
110 | 110 | //attendee obj for this registration |
111 | - $attendee = isset( $this->_xtra->registrations[ $registration->ID() ]['att_obj'] ) |
|
112 | - ? $this->_xtra->registrations[ $registration->ID() ]['att_obj'] |
|
113 | - : null ; |
|
111 | + $attendee = isset($this->_xtra->registrations[$registration->ID()]['att_obj']) |
|
112 | + ? $this->_xtra->registrations[$registration->ID()]['att_obj'] |
|
113 | + : null; |
|
114 | 114 | |
115 | - if ( ! $attendee instanceof EE_Attendee ) { |
|
116 | - $msg = esc_html__( 'There is no EE_Attendee object in the data sent to the EE_Attendee_Shortcode parser for the messages system.', 'event_espresso' ); |
|
115 | + if ( ! $attendee instanceof EE_Attendee) { |
|
116 | + $msg = esc_html__('There is no EE_Attendee object in the data sent to the EE_Attendee_Shortcode parser for the messages system.', 'event_espresso'); |
|
117 | 117 | $dev_msg = sprintf( |
118 | - esc_html__( 'The registration ID for this request is: %s', 'event_espresso' ), |
|
118 | + esc_html__('The registration ID for this request is: %s', 'event_espresso'), |
|
119 | 119 | $registration->ID() |
120 | 120 | ); |
121 | - throw new EE_Error( "{$msg}||{$msg} {$dev_msg}" ); |
|
121 | + throw new EE_Error("{$msg}||{$msg} {$dev_msg}"); |
|
122 | 122 | } |
123 | 123 | |
124 | - switch ( $shortcode ) { |
|
124 | + switch ($shortcode) { |
|
125 | 125 | |
126 | 126 | case '[FNAME]' : |
127 | 127 | return $attendee->fname(); |
@@ -1,6 +1,7 @@ |
||
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 | 6 | /** |
6 | 7 | * Event Espresso |
@@ -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 | |
@@ -260,7 +260,7 @@ discard block |
||
260 | 260 | * @param array $addressee_data We're expecting an incoming array of data that will be used to fill the properties |
261 | 261 | * for the object. |
262 | 262 | */ |
263 | - public function __construct( $addressee_data ) { |
|
263 | + public function __construct($addressee_data) { |
|
264 | 264 | $this->_data = $addressee_data; |
265 | 265 | $this->_set_properties(); |
266 | 266 | } |
@@ -275,15 +275,15 @@ discard block |
||
275 | 275 | * @return void. |
276 | 276 | */ |
277 | 277 | protected function _set_properties() { |
278 | - foreach ( $this->_data as $prop => $value ) { |
|
279 | - if ( property_exists( $this, $prop ) ) { |
|
278 | + foreach ($this->_data as $prop => $value) { |
|
279 | + if (property_exists($this, $prop)) { |
|
280 | 280 | $this->{$prop} = $value; |
281 | 281 | } |
282 | 282 | } |
283 | 283 | //if user_id present we'll use this to set the fname and lname and admin_email. |
284 | - if ( ! empty( $this->user_id ) ) { |
|
284 | + if ( ! empty($this->user_id)) { |
|
285 | 285 | $this->user_id = (int) $this->user_id; |
286 | - $user = get_userdata( $this->user_id ); |
|
286 | + $user = get_userdata($this->user_id); |
|
287 | 287 | $this->fname = $user->user_firstname; |
288 | 288 | $this->lname = $user->user_lastname; |
289 | 289 | $this->admin_email = $user->user_email; |
@@ -23,8 +23,8 @@ discard block |
||
23 | 23 | * |
24 | 24 | * ------------------------------------------------------------------------ |
25 | 25 | */ |
26 | -require_once ( EE_MODELS . 'EEM_Base.model.php' ); |
|
27 | -require_once ( EE_CLASSES . 'EE_Checkin.class.php' ); |
|
26 | +require_once (EE_MODELS.'EEM_Base.model.php'); |
|
27 | +require_once (EE_CLASSES.'EE_Checkin.class.php'); |
|
28 | 28 | |
29 | 29 | class EEM_Checkin extends EEM_Base { |
30 | 30 | |
@@ -40,12 +40,12 @@ discard block |
||
40 | 40 | * @param string $timezone string representing the timezone we want to set for returned Date Time Strings (and any incoming timezone data that gets saved). Note this just sends the timezone info to the date time model field objects. Default is NULL (and will be assumed using the set timezone in the 'timezone_string' wp option) |
41 | 41 | * @return void |
42 | 42 | */ |
43 | - protected function __construct( $timezone = NULL ) { |
|
44 | - $this->singular_item = __('Check-In','event_espresso'); |
|
45 | - $this->plural_item = __('Check-Ins','event_espresso'); |
|
43 | + protected function __construct($timezone = NULL) { |
|
44 | + $this->singular_item = __('Check-In', 'event_espresso'); |
|
45 | + $this->plural_item = __('Check-Ins', 'event_espresso'); |
|
46 | 46 | |
47 | 47 | $this->_tables = array( |
48 | - 'Checkin'=>new EE_Primary_Table('esp_checkin','CHK_ID') |
|
48 | + 'Checkin'=>new EE_Primary_Table('esp_checkin', 'CHK_ID') |
|
49 | 49 | ); |
50 | 50 | $this->_fields = array( |
51 | 51 | 'Checkin'=> array( |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | 'REG_ID'=>new EE_Foreign_Key_Int_Field('REG_ID', 'Registration Id', false, 0, 'Registration'), |
54 | 54 | 'DTT_ID'=>new EE_Foreign_Key_Int_Field('DTT_ID', 'Datetime Id', false, 0, 'Datetime'), |
55 | 55 | 'CHK_in'=>new EE_Boolean_Field('CHK_in', 'Whether a person has checked in or checked out', false, true), |
56 | - 'CHK_timestamp'=>new EE_Datetime_Field('CHK_timestamp', __('When the row was modified','event_espresso'), false, EE_Datetime_Field::now, $timezone ) |
|
56 | + 'CHK_timestamp'=>new EE_Datetime_Field('CHK_timestamp', __('When the row was modified', 'event_espresso'), false, EE_Datetime_Field::now, $timezone) |
|
57 | 57 | ) |
58 | 58 | ); |
59 | 59 | $this->_model_relations = array( |
@@ -61,7 +61,7 @@ discard block |
||
61 | 61 | 'Datetime'=>new EE_Belongs_To_Relation() |
62 | 62 | ); |
63 | 63 | $this->_model_chain_to_wp_user = 'Registration.Event'; |
64 | - parent::__construct( $timezone ); |
|
64 | + parent::__construct($timezone); |
|
65 | 65 | |
66 | 66 | } |
67 | 67 |
@@ -1,4 +1,6 @@ |
||
1 | -<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed'); |
|
1 | +<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
2 | + exit('No direct script access allowed'); |
|
3 | +} |
|
2 | 4 | /** |
3 | 5 | * Event Espresso |
4 | 6 | * |
@@ -130,7 +130,7 @@ discard block |
||
130 | 130 | * |
131 | 131 | * @link http://codex.wordpress.org/Function_Reference/get_the_post_thumbnail |
132 | 132 | * @access protected |
133 | - * @param string|array $size (optional) Image size. Defaults to 'post-thumbnail' but can also be a 2-item array representing width and height in pixels (i.e. array(32,32) ). |
|
133 | + * @param string $size (optional) Image size. Defaults to 'post-thumbnail' but can also be a 2-item array representing width and height in pixels (i.e. array(32,32) ). |
|
134 | 134 | * @param string|array $attr Optional. Query string or array of attributes. |
135 | 135 | * @return string HTML image element |
136 | 136 | */ |
@@ -172,7 +172,7 @@ discard block |
||
172 | 172 | * This is a method for restoring this_obj using details from the given $revision_id |
173 | 173 | * |
174 | 174 | * @param int $revision_id ID of the revision we're getting data from |
175 | - * @param array $related_obj_names if included this will be used to restore for related obj |
|
175 | + * @param string[] $related_obj_names if included this will be used to restore for related obj |
|
176 | 176 | * if not included then we just do restore on the meta. |
177 | 177 | * We will accept an array of related_obj_names for restoration here. |
178 | 178 | * @param array $where_query You can optionally include an array of key=>value pairs |
@@ -226,7 +226,7 @@ discard block |
||
226 | 226 | * Wrapper for get_post_meta, http://codex.wordpress.org/Function_Reference/get_post_meta |
227 | 227 | * @param string $meta_key |
228 | 228 | * @param boolean $single |
229 | - * @return mixed <ul><li>If only $id is set it will return all meta values in an associative array.</li> |
|
229 | + * @return string|null <ul><li>If only $id is set it will return all meta values in an associative array.</li> |
|
230 | 230 | * <li>If $single is set to false, or left blank, the function returns an array containing all values of the specified key.</li> |
231 | 231 | * <li>If $single is set to true, the function returns the first value of the specified key (not in an array</li></ul> |
232 | 232 | */ |
@@ -254,8 +254,8 @@ discard block |
||
254 | 254 | |
255 | 255 | /** |
256 | 256 | * Wrapper for add_post_meta, http://codex.wordpress.org/Function_Reference/add_post_meta |
257 | - * @param mixed $meta_key |
|
258 | - * @param mixed $meta_value |
|
257 | + * @param string $meta_key |
|
258 | + * @param string $meta_value |
|
259 | 259 | * @param bool $unique . If postmeta for this $meta_key already exists, whether to add an additional item or not |
260 | 260 | * @return boolean Boolean true, except if the $unique argument was set to true and a custom field with the given key already exists, in which case false is returned. |
261 | 261 | */ |
@@ -271,7 +271,7 @@ discard block |
||
271 | 271 | /** |
272 | 272 | * Wrapper for delete_post_meta, http://codex.wordpress.org/Function_Reference/delete_post_meta |
273 | 273 | * |
274 | - * @param mixed $meta_key |
|
274 | + * @param string $meta_key |
|
275 | 275 | * @param mixed $meta_value |
276 | 276 | * @return boolean False for failure. True for success. |
277 | 277 | */ |
@@ -299,7 +299,7 @@ discard block |
||
299 | 299 | /** |
300 | 300 | * Gets all the term-taxonomies for this CPT |
301 | 301 | * @param array $query_params |
302 | - * @return EE_Term_Taxonomy |
|
302 | + * @return EE_Base_Class[] |
|
303 | 303 | */ |
304 | 304 | public function term_taxonomies( $query_params = array() ) { |
305 | 305 | return $this->get_many_related( 'Term_Taxonomy', $query_params ); |
@@ -36,9 +36,9 @@ discard block |
||
36 | 36 | */ |
37 | 37 | protected $_feature_image = array(); |
38 | 38 | |
39 | - /** |
|
40 | - * @var WP_Post the WP_Post that corresponds with this CPT model object |
|
41 | - */ |
|
39 | + /** |
|
40 | + * @var WP_Post the WP_Post that corresponds with this CPT model object |
|
41 | + */ |
|
42 | 42 | protected $_wp_post; |
43 | 43 | |
44 | 44 | |
@@ -46,75 +46,75 @@ discard block |
||
46 | 46 | |
47 | 47 | |
48 | 48 | |
49 | - /** |
|
50 | - * Returns the WP post associated with this CPT model object. If this CPT is saved, fetches it |
|
51 | - * from the DB. Otherwise, create an unsaved WP_POst object. Caches the post internally. |
|
52 | - * @return WP_Post |
|
53 | - */ |
|
54 | - public function wp_post(){ |
|
55 | - global $wpdb; |
|
56 | - if (! $this->_wp_post instanceof WP_Post) { |
|
57 | - if ($this->ID()) { |
|
58 | - $this->_wp_post = get_post($this->ID()); |
|
59 | - } else { |
|
60 | - $simulated_db_result = new stdClass(); |
|
61 | - foreach($this->get_model()->field_settings(true) as $field_name => $field_obj){ |
|
62 | - if ($this->get_model()->get_table_obj_by_alias($field_obj->get_table_alias())->get_table_name() === $wpdb->posts){ |
|
63 | - $column = $field_obj->get_table_column(); |
|
64 | - |
|
65 | - if($field_obj instanceof EE_Datetime_Field){ |
|
66 | - $value_on_model_obj = $this->get_DateTime_object($field_name); |
|
67 | - } elseif( $field_obj->is_db_only_field()){ |
|
68 | - $value_on_model_obj = $field_obj->get_default_value(); |
|
69 | - } else { |
|
70 | - $value_on_model_obj = $this->get_raw($field_name); |
|
71 | - } |
|
72 | - $simulated_db_result->{$column} = $field_obj->prepare_for_use_in_db($value_on_model_obj); |
|
73 | - } |
|
74 | - } |
|
75 | - $this->_wp_post = new WP_Post($simulated_db_result); |
|
76 | - } |
|
77 | - //and let's make retrieving the EE CPT object easy too |
|
78 | - $classname = get_class($this); |
|
79 | - if (! isset($this->_wp_post->{$classname})) { |
|
80 | - $this->_wp_post->{$classname} = $this; |
|
81 | - } |
|
82 | - } |
|
83 | - return $this->_wp_post; |
|
84 | - } |
|
85 | - |
|
86 | - /** |
|
87 | - * When fetching a new value for a post field that uses the global $post for rendering, |
|
88 | - * set the global $post temporarily to be this model object; and afterwards restore it |
|
89 | - * @param string $fieldname |
|
90 | - * @param bool $pretty |
|
91 | - * @param string $extra_cache_ref |
|
92 | - * @return mixed |
|
93 | - */ |
|
94 | - protected function _get_fresh_property($fieldname, $pretty = false, $extra_cache_ref = null) |
|
95 | - { |
|
96 | - global $post; |
|
97 | - |
|
98 | - if ( $pretty |
|
99 | - && ( |
|
100 | - ! ( |
|
101 | - $post instanceof WP_Post |
|
102 | - && $post->ID |
|
103 | - ) |
|
104 | - || (int)$post->ID !== $this->ID() |
|
105 | - ) |
|
106 | - && $this->get_model()->field_settings_for($fieldname) instanceof EE_Post_Content_Field ) { |
|
107 | - $old_post = $post; |
|
108 | - $post = $this->wp_post(); |
|
109 | - $return_value = parent::_get_fresh_property($fieldname, $pretty, $extra_cache_ref); |
|
110 | - $post = $old_post; |
|
111 | - } else { |
|
112 | - $return_value = parent::_get_fresh_property($fieldname, $pretty, $extra_cache_ref); |
|
113 | - } |
|
114 | - return $return_value; |
|
115 | - } |
|
116 | - |
|
117 | - /** |
|
49 | + /** |
|
50 | + * Returns the WP post associated with this CPT model object. If this CPT is saved, fetches it |
|
51 | + * from the DB. Otherwise, create an unsaved WP_POst object. Caches the post internally. |
|
52 | + * @return WP_Post |
|
53 | + */ |
|
54 | + public function wp_post(){ |
|
55 | + global $wpdb; |
|
56 | + if (! $this->_wp_post instanceof WP_Post) { |
|
57 | + if ($this->ID()) { |
|
58 | + $this->_wp_post = get_post($this->ID()); |
|
59 | + } else { |
|
60 | + $simulated_db_result = new stdClass(); |
|
61 | + foreach($this->get_model()->field_settings(true) as $field_name => $field_obj){ |
|
62 | + if ($this->get_model()->get_table_obj_by_alias($field_obj->get_table_alias())->get_table_name() === $wpdb->posts){ |
|
63 | + $column = $field_obj->get_table_column(); |
|
64 | + |
|
65 | + if($field_obj instanceof EE_Datetime_Field){ |
|
66 | + $value_on_model_obj = $this->get_DateTime_object($field_name); |
|
67 | + } elseif( $field_obj->is_db_only_field()){ |
|
68 | + $value_on_model_obj = $field_obj->get_default_value(); |
|
69 | + } else { |
|
70 | + $value_on_model_obj = $this->get_raw($field_name); |
|
71 | + } |
|
72 | + $simulated_db_result->{$column} = $field_obj->prepare_for_use_in_db($value_on_model_obj); |
|
73 | + } |
|
74 | + } |
|
75 | + $this->_wp_post = new WP_Post($simulated_db_result); |
|
76 | + } |
|
77 | + //and let's make retrieving the EE CPT object easy too |
|
78 | + $classname = get_class($this); |
|
79 | + if (! isset($this->_wp_post->{$classname})) { |
|
80 | + $this->_wp_post->{$classname} = $this; |
|
81 | + } |
|
82 | + } |
|
83 | + return $this->_wp_post; |
|
84 | + } |
|
85 | + |
|
86 | + /** |
|
87 | + * When fetching a new value for a post field that uses the global $post for rendering, |
|
88 | + * set the global $post temporarily to be this model object; and afterwards restore it |
|
89 | + * @param string $fieldname |
|
90 | + * @param bool $pretty |
|
91 | + * @param string $extra_cache_ref |
|
92 | + * @return mixed |
|
93 | + */ |
|
94 | + protected function _get_fresh_property($fieldname, $pretty = false, $extra_cache_ref = null) |
|
95 | + { |
|
96 | + global $post; |
|
97 | + |
|
98 | + if ( $pretty |
|
99 | + && ( |
|
100 | + ! ( |
|
101 | + $post instanceof WP_Post |
|
102 | + && $post->ID |
|
103 | + ) |
|
104 | + || (int)$post->ID !== $this->ID() |
|
105 | + ) |
|
106 | + && $this->get_model()->field_settings_for($fieldname) instanceof EE_Post_Content_Field ) { |
|
107 | + $old_post = $post; |
|
108 | + $post = $this->wp_post(); |
|
109 | + $return_value = parent::_get_fresh_property($fieldname, $pretty, $extra_cache_ref); |
|
110 | + $post = $old_post; |
|
111 | + } else { |
|
112 | + $return_value = parent::_get_fresh_property($fieldname, $pretty, $extra_cache_ref); |
|
113 | + } |
|
114 | + return $return_value; |
|
115 | + } |
|
116 | + |
|
117 | + /** |
|
118 | 118 | * Adds to the specified event category. If it category doesn't exist, creates it. |
119 | 119 | * @param string $category_name |
120 | 120 | * @param string $category_description optional |
@@ -399,14 +399,14 @@ discard block |
||
399 | 399 | |
400 | 400 | |
401 | 401 | |
402 | - /** |
|
403 | - * Don't serialize the WP Post. That's just duplicate data and we want to avoid recursion |
|
404 | - * @return array |
|
405 | - */ |
|
406 | - public function __sleep() |
|
407 | - { |
|
408 | - $properties_to_serialize = parent::__sleep(); |
|
409 | - $properties_to_serialize = array_diff( $properties_to_serialize, array('_wp_post')); |
|
410 | - return $properties_to_serialize; |
|
411 | - } |
|
402 | + /** |
|
403 | + * Don't serialize the WP Post. That's just duplicate data and we want to avoid recursion |
|
404 | + * @return array |
|
405 | + */ |
|
406 | + public function __sleep() |
|
407 | + { |
|
408 | + $properties_to_serialize = parent::__sleep(); |
|
409 | + $properties_to_serialize = array_diff( $properties_to_serialize, array('_wp_post')); |
|
410 | + return $properties_to_serialize; |
|
411 | + } |
|
412 | 412 | } |
@@ -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 | * Event Espresso |
@@ -51,20 +51,20 @@ discard block |
||
51 | 51 | * from the DB. Otherwise, create an unsaved WP_POst object. Caches the post internally. |
52 | 52 | * @return WP_Post |
53 | 53 | */ |
54 | - public function wp_post(){ |
|
54 | + public function wp_post() { |
|
55 | 55 | global $wpdb; |
56 | - if (! $this->_wp_post instanceof WP_Post) { |
|
56 | + if ( ! $this->_wp_post instanceof WP_Post) { |
|
57 | 57 | if ($this->ID()) { |
58 | 58 | $this->_wp_post = get_post($this->ID()); |
59 | 59 | } else { |
60 | 60 | $simulated_db_result = new stdClass(); |
61 | - foreach($this->get_model()->field_settings(true) as $field_name => $field_obj){ |
|
62 | - if ($this->get_model()->get_table_obj_by_alias($field_obj->get_table_alias())->get_table_name() === $wpdb->posts){ |
|
61 | + foreach ($this->get_model()->field_settings(true) as $field_name => $field_obj) { |
|
62 | + if ($this->get_model()->get_table_obj_by_alias($field_obj->get_table_alias())->get_table_name() === $wpdb->posts) { |
|
63 | 63 | $column = $field_obj->get_table_column(); |
64 | 64 | |
65 | - if($field_obj instanceof EE_Datetime_Field){ |
|
65 | + if ($field_obj instanceof EE_Datetime_Field) { |
|
66 | 66 | $value_on_model_obj = $this->get_DateTime_object($field_name); |
67 | - } elseif( $field_obj->is_db_only_field()){ |
|
67 | + } elseif ($field_obj->is_db_only_field()) { |
|
68 | 68 | $value_on_model_obj = $field_obj->get_default_value(); |
69 | 69 | } else { |
70 | 70 | $value_on_model_obj = $this->get_raw($field_name); |
@@ -76,7 +76,7 @@ discard block |
||
76 | 76 | } |
77 | 77 | //and let's make retrieving the EE CPT object easy too |
78 | 78 | $classname = get_class($this); |
79 | - if (! isset($this->_wp_post->{$classname})) { |
|
79 | + if ( ! isset($this->_wp_post->{$classname})) { |
|
80 | 80 | $this->_wp_post->{$classname} = $this; |
81 | 81 | } |
82 | 82 | } |
@@ -95,15 +95,15 @@ discard block |
||
95 | 95 | { |
96 | 96 | global $post; |
97 | 97 | |
98 | - if ( $pretty |
|
98 | + if ($pretty |
|
99 | 99 | && ( |
100 | 100 | ! ( |
101 | 101 | $post instanceof WP_Post |
102 | 102 | && $post->ID |
103 | 103 | ) |
104 | - || (int)$post->ID !== $this->ID() |
|
104 | + || (int) $post->ID !== $this->ID() |
|
105 | 105 | ) |
106 | - && $this->get_model()->field_settings_for($fieldname) instanceof EE_Post_Content_Field ) { |
|
106 | + && $this->get_model()->field_settings_for($fieldname) instanceof EE_Post_Content_Field) { |
|
107 | 107 | $old_post = $post; |
108 | 108 | $post = $this->wp_post(); |
109 | 109 | $return_value = parent::_get_fresh_property($fieldname, $pretty, $extra_cache_ref); |
@@ -121,8 +121,8 @@ discard block |
||
121 | 121 | * @param int $parent_term_taxonomy_id optional |
122 | 122 | * @return EE_Term_Taxonomy |
123 | 123 | */ |
124 | - function add_event_category( $category_name, $category_description = NULL, $parent_term_taxonomy_id = NULL ) { |
|
125 | - return $this->get_model()->add_event_category( $this, $category_name, $category_description, $parent_term_taxonomy_id ); |
|
124 | + function add_event_category($category_name, $category_description = NULL, $parent_term_taxonomy_id = NULL) { |
|
125 | + return $this->get_model()->add_event_category($this, $category_name, $category_description, $parent_term_taxonomy_id); |
|
126 | 126 | } |
127 | 127 | |
128 | 128 | |
@@ -132,8 +132,8 @@ discard block |
||
132 | 132 | * @param string $category_name |
133 | 133 | * @return bool |
134 | 134 | */ |
135 | - function remove_event_category( $category_name ) { |
|
136 | - return $this->get_model()->remove_event_category( $this, $category_name ); |
|
135 | + function remove_event_category($category_name) { |
|
136 | + return $this->get_model()->remove_event_category($this, $category_name); |
|
137 | 137 | } |
138 | 138 | |
139 | 139 | |
@@ -144,14 +144,14 @@ discard block |
||
144 | 144 | * @param EE_Term_Taxonomy $term_taxonomy |
145 | 145 | * @return EE_Base_Class the relation was removed from |
146 | 146 | */ |
147 | - function remove_relation_to_term_taxonomy( $term_taxonomy ) { |
|
148 | - if ( !$term_taxonomy ) { |
|
149 | - EE_Error::add_error( sprintf( __( "No Term_Taxonomy provided which to remove from model object of type %s and id %d", "event_espresso" ), get_class( $this ), $this->ID() ), __FILE__, __FUNCTION__, __LINE__ ); |
|
147 | + function remove_relation_to_term_taxonomy($term_taxonomy) { |
|
148 | + if ( ! $term_taxonomy) { |
|
149 | + EE_Error::add_error(sprintf(__("No Term_Taxonomy provided which to remove from model object of type %s and id %d", "event_espresso"), get_class($this), $this->ID()), __FILE__, __FUNCTION__, __LINE__); |
|
150 | 150 | return NULL; |
151 | 151 | } |
152 | - $term_taxonomy->set_count( $term_taxonomy->count() - 1 ); |
|
152 | + $term_taxonomy->set_count($term_taxonomy->count() - 1); |
|
153 | 153 | $term_taxonomy->save(); |
154 | - return $this->_remove_relation_to( $term_taxonomy, 'Term_Taxonomy' ); |
|
154 | + return $this->_remove_relation_to($term_taxonomy, 'Term_Taxonomy'); |
|
155 | 155 | } |
156 | 156 | |
157 | 157 | |
@@ -175,7 +175,7 @@ discard block |
||
175 | 175 | * @return int |
176 | 176 | */ |
177 | 177 | public function parent() { |
178 | - return $this->get( 'parent' ); |
|
178 | + return $this->get('parent'); |
|
179 | 179 | } |
180 | 180 | |
181 | 181 | |
@@ -185,7 +185,7 @@ discard block |
||
185 | 185 | * @return string |
186 | 186 | */ |
187 | 187 | public function status() { |
188 | - return $this->get( 'status' ); |
|
188 | + return $this->get('status'); |
|
189 | 189 | } |
190 | 190 | |
191 | 191 | |
@@ -193,8 +193,8 @@ discard block |
||
193 | 193 | /** |
194 | 194 | * @param string $status |
195 | 195 | */ |
196 | - public function set_status( $status ) { |
|
197 | - $this->set( 'status', $status ); |
|
196 | + public function set_status($status) { |
|
197 | + $this->set('status', $status); |
|
198 | 198 | } |
199 | 199 | |
200 | 200 | |
@@ -208,12 +208,12 @@ discard block |
||
208 | 208 | * @param string|array $attr Optional. Query string or array of attributes. |
209 | 209 | * @return string HTML image element |
210 | 210 | */ |
211 | - protected function _get_feature_image( $size, $attr ) { |
|
211 | + protected function _get_feature_image($size, $attr) { |
|
212 | 212 | //first let's see if we already have the _feature_image property set AND if it has a cached element on it FOR the given size |
213 | - $attr_key = is_array( $attr ) ? implode( '_', $attr ) : $attr; |
|
214 | - $cache_key = is_array( $size ) ? implode( '_', $size ) . $attr_key : $size . $attr_key; |
|
215 | - $this->_feature_image[ $cache_key ] = isset( $this->_feature_image[ $cache_key ] ) ? $this->_feature_image[ $cache_key ] : $this->get_model()->get_feature_image( $this->ID(), $size, $attr ); |
|
216 | - return $this->_feature_image[ $cache_key ]; |
|
213 | + $attr_key = is_array($attr) ? implode('_', $attr) : $attr; |
|
214 | + $cache_key = is_array($size) ? implode('_', $size).$attr_key : $size.$attr_key; |
|
215 | + $this->_feature_image[$cache_key] = isset($this->_feature_image[$cache_key]) ? $this->_feature_image[$cache_key] : $this->get_model()->get_feature_image($this->ID(), $size, $attr); |
|
216 | + return $this->_feature_image[$cache_key]; |
|
217 | 217 | } |
218 | 218 | |
219 | 219 | |
@@ -224,8 +224,8 @@ discard block |
||
224 | 224 | * @param string|array $attr |
225 | 225 | * @return string of html |
226 | 226 | */ |
227 | - public function feature_image( $size = 'thumbnail', $attr = '' ) { |
|
228 | - return $this->_get_feature_image( $size, $attr ); |
|
227 | + public function feature_image($size = 'thumbnail', $attr = '') { |
|
228 | + return $this->_get_feature_image($size, $attr); |
|
229 | 229 | } |
230 | 230 | |
231 | 231 | |
@@ -235,9 +235,9 @@ discard block |
||
235 | 235 | * @param string|array $size can either be a string: 'thumbnail', 'medium', 'large', 'full' OR 2-item array representing width and height in pixels eg. array(32,32). |
236 | 236 | * @return string|boolean the url of the image or false if not found |
237 | 237 | */ |
238 | - public function feature_image_url( $size = 'thumbnail' ) { |
|
239 | - $attachment = wp_get_attachment_image_src( get_post_thumbnail_id( $this->ID() ), $size ); |
|
240 | - return !empty( $attachment ) ? $attachment[ 0 ] : FALSE; |
|
238 | + public function feature_image_url($size = 'thumbnail') { |
|
239 | + $attachment = wp_get_attachment_image_src(get_post_thumbnail_id($this->ID()), $size); |
|
240 | + return ! empty($attachment) ? $attachment[0] : FALSE; |
|
241 | 241 | } |
242 | 242 | |
243 | 243 | |
@@ -259,36 +259,36 @@ discard block |
||
259 | 259 | * This array is INDEXED by RELATED OBJ NAME (so it corresponds with the obj_names sent); |
260 | 260 | * @return void |
261 | 261 | */ |
262 | - public function restore_revision( $revision_id, $related_obj_names = array(), $where_query = array() ) { |
|
262 | + public function restore_revision($revision_id, $related_obj_names = array(), $where_query = array()) { |
|
263 | 263 | //get revision object |
264 | - $revision_obj = $this->get_model()->get_one_by_ID( $revision_id ); |
|
265 | - if ( $revision_obj instanceof EE_CPT_Base ) { |
|
264 | + $revision_obj = $this->get_model()->get_one_by_ID($revision_id); |
|
265 | + if ($revision_obj instanceof EE_CPT_Base) { |
|
266 | 266 | //no related_obj_name so we assume we're saving a revision on this object. |
267 | - if ( empty( $related_obj_names ) ) { |
|
267 | + if (empty($related_obj_names)) { |
|
268 | 268 | $fields = $this->get_model()->get_meta_table_fields(); |
269 | - foreach ( $fields as $field ) { |
|
270 | - $this->set( $field, $revision_obj->get( $field ) ); |
|
269 | + foreach ($fields as $field) { |
|
270 | + $this->set($field, $revision_obj->get($field)); |
|
271 | 271 | } |
272 | 272 | $this->save(); |
273 | 273 | } |
274 | - $related_obj_names = (array)$related_obj_names; |
|
275 | - foreach ( $related_obj_names as $related_name ) { |
|
274 | + $related_obj_names = (array) $related_obj_names; |
|
275 | + foreach ($related_obj_names as $related_name) { |
|
276 | 276 | //related_obj_name so we're saving a revision on an object related to this object |
277 | 277 | //do we have $where_query params for this related object? If we do then we include that. |
278 | - $cols_n_values = isset( $where_query[ $related_name ] ) ? $where_query[ $related_name ] : array(); |
|
279 | - $where_params = !empty( $cols_n_values ) ? array( $cols_n_values ) : array(); |
|
280 | - $related_objs = $this->get_many_related( $related_name, $where_params ); |
|
281 | - $revision_related_objs = $revision_obj->get_many_related( $related_name, $where_params ); |
|
278 | + $cols_n_values = isset($where_query[$related_name]) ? $where_query[$related_name] : array(); |
|
279 | + $where_params = ! empty($cols_n_values) ? array($cols_n_values) : array(); |
|
280 | + $related_objs = $this->get_many_related($related_name, $where_params); |
|
281 | + $revision_related_objs = $revision_obj->get_many_related($related_name, $where_params); |
|
282 | 282 | //load helper |
283 | 283 | //remove related objs from this object that are not in revision |
284 | 284 | //array_diff *should* work cause I think objects are indexed by ID? |
285 | - $related_to_remove = EEH_Array::object_array_diff( $related_objs, $revision_related_objs ); |
|
286 | - foreach ( $related_to_remove as $rr ) { |
|
287 | - $this->_remove_relation_to( $rr, $related_name, $cols_n_values ); |
|
285 | + $related_to_remove = EEH_Array::object_array_diff($related_objs, $revision_related_objs); |
|
286 | + foreach ($related_to_remove as $rr) { |
|
287 | + $this->_remove_relation_to($rr, $related_name, $cols_n_values); |
|
288 | 288 | } |
289 | 289 | //add all related objs attached to revision to this object |
290 | - foreach ( $revision_related_objs as $r_obj ) { |
|
291 | - $this->_add_relation_to( $r_obj, $related_name, $cols_n_values ); |
|
290 | + foreach ($revision_related_objs as $r_obj) { |
|
291 | + $this->_add_relation_to($r_obj, $related_name, $cols_n_values); |
|
292 | 292 | } |
293 | 293 | } |
294 | 294 | } |
@@ -304,8 +304,8 @@ discard block |
||
304 | 304 | * <li>If $single is set to false, or left blank, the function returns an array containing all values of the specified key.</li> |
305 | 305 | * <li>If $single is set to true, the function returns the first value of the specified key (not in an array</li></ul> |
306 | 306 | */ |
307 | - public function get_post_meta( $meta_key = NULL, $single = FALSE ) { |
|
308 | - return get_post_meta( $this->ID(), $meta_key, $single ); |
|
307 | + public function get_post_meta($meta_key = NULL, $single = FALSE) { |
|
308 | + return get_post_meta($this->ID(), $meta_key, $single); |
|
309 | 309 | } |
310 | 310 | |
311 | 311 | |
@@ -317,11 +317,11 @@ discard block |
||
317 | 317 | * @param mixed $prev_value |
318 | 318 | * @return mixed Returns meta_id if the meta doesn't exist, otherwise returns true on success and false on failure. NOTE: If the meta_value passed to this function is the same as the value that is already in the database, this function returns false. |
319 | 319 | */ |
320 | - public function update_post_meta( $meta_key, $meta_value, $prev_value = NULL ) { |
|
321 | - if ( ! $this->ID() ) { |
|
320 | + public function update_post_meta($meta_key, $meta_value, $prev_value = NULL) { |
|
321 | + if ( ! $this->ID()) { |
|
322 | 322 | $this->save(); |
323 | 323 | } |
324 | - return update_post_meta( $this->ID(), $meta_key, $meta_value, $prev_value ); |
|
324 | + return update_post_meta($this->ID(), $meta_key, $meta_value, $prev_value); |
|
325 | 325 | } |
326 | 326 | |
327 | 327 | |
@@ -333,11 +333,11 @@ discard block |
||
333 | 333 | * @param bool $unique . If postmeta for this $meta_key already exists, whether to add an additional item or not |
334 | 334 | * @return boolean Boolean true, except if the $unique argument was set to true and a custom field with the given key already exists, in which case false is returned. |
335 | 335 | */ |
336 | - public function add_post_meta( $meta_key, $meta_value, $unique = FALSE ) { |
|
337 | - if ( $this->ID() ) { |
|
336 | + public function add_post_meta($meta_key, $meta_value, $unique = FALSE) { |
|
337 | + if ($this->ID()) { |
|
338 | 338 | $this->save(); |
339 | 339 | } |
340 | - return add_post_meta( $this->ID(), $meta_key, $meta_value, $unique ); |
|
340 | + return add_post_meta($this->ID(), $meta_key, $meta_value, $unique); |
|
341 | 341 | } |
342 | 342 | |
343 | 343 | |
@@ -349,13 +349,13 @@ discard block |
||
349 | 349 | * @param mixed $meta_value |
350 | 350 | * @return boolean False for failure. True for success. |
351 | 351 | */ |
352 | - public function delete_post_meta( $meta_key, $meta_value = '' ) { |
|
353 | - if ( ! $this->ID() ) { |
|
352 | + public function delete_post_meta($meta_key, $meta_value = '') { |
|
353 | + if ( ! $this->ID()) { |
|
354 | 354 | //there are obviously no postmetas for this if it's not saved |
355 | 355 | //so let's just report this as a success |
356 | 356 | return true; |
357 | 357 | } |
358 | - return delete_post_meta( $this->ID(), $meta_key, $meta_value ); |
|
358 | + return delete_post_meta($this->ID(), $meta_key, $meta_value); |
|
359 | 359 | } |
360 | 360 | |
361 | 361 | |
@@ -365,7 +365,7 @@ discard block |
||
365 | 365 | * @return string |
366 | 366 | */ |
367 | 367 | public function get_permalink() { |
368 | - return get_permalink( $this->ID() ); |
|
368 | + return get_permalink($this->ID()); |
|
369 | 369 | } |
370 | 370 | |
371 | 371 | |
@@ -375,8 +375,8 @@ discard block |
||
375 | 375 | * @param array $query_params |
376 | 376 | * @return EE_Term_Taxonomy |
377 | 377 | */ |
378 | - public function term_taxonomies( $query_params = array() ) { |
|
379 | - return $this->get_many_related( 'Term_Taxonomy', $query_params ); |
|
378 | + public function term_taxonomies($query_params = array()) { |
|
379 | + return $this->get_many_related('Term_Taxonomy', $query_params); |
|
380 | 380 | } |
381 | 381 | |
382 | 382 | |
@@ -406,7 +406,7 @@ discard block |
||
406 | 406 | public function __sleep() |
407 | 407 | { |
408 | 408 | $properties_to_serialize = parent::__sleep(); |
409 | - $properties_to_serialize = array_diff( $properties_to_serialize, array('_wp_post')); |
|
409 | + $properties_to_serialize = array_diff($properties_to_serialize, array('_wp_post')); |
|
410 | 410 | return $properties_to_serialize; |
411 | 411 | } |
412 | 412 | } |
@@ -2,7 +2,7 @@ |
||
2 | 2 | namespace EventEspresso\core\services\commands; |
3 | 3 | |
4 | 4 | if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
5 | - exit('No direct script access allowed'); |
|
5 | + exit('No direct script access allowed'); |
|
6 | 6 | } |
7 | 7 | |
8 | 8 |