Completed
Branch FET/11183/improvements-to-pue-... (dfe6b8)
by
unknown
75:16 queued 60:57
created

EE_PUE::is_update_available()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 13
Code Lines 9

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 9
nc 1
nop 1
dl 0
loc 13
rs 9.4285
c 0
b 0
f 0
1
<?php
2
3
use EventEspresso\core\domain\services\pue\Stats;
4
use EventEspresso\core\interfaces\InterminableInterface;
5
use EventEspresso\core\services\licensing\LicenseService;
6
7
if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) {
8
	exit( 'No direct script access allowed' );
9
}
10
/**
11
 * ************************************************************************
12
 *       _____  ______          _____      __  __ ______
13
 *      |  __ \|  ____|   /\   |  __ \    |  \/  |  ____|
14
 *      | |__) | |__     /  \  | |  | |   | \  / | |__
15
 *      |  _  /|  __|   / /\ \ | |  | |   | |\/| |  __|
16
 *      | | \ \| |____ / ____ \| |__| |   | |  | | |____
17
 *      |_|  \_\______/_/    \_\_____/    |_|  |_|______|
18
 *
19
 * ************************************************************************
20
 *
21
 * This file contains all deprecated actions, filters, functions, and classes in EE.
22
 * DO NOT ADD NEW CODE TO THE TOP OF THIS FILE !!!
23
 * PLEASE ADD ALL NEW CODE TO THE BOTTOM OF THIS FILE !!!
24
 * IF YOU ADD CODE TO THIS FILE, WHY NOT TRY ADDING IT TO THE BOTTOM ?
25
 * THE WHITE ZONE IS FOR LOADING AND UNLOADING ONLY,
26
 * IF YOU HAVE TO LOAD OR UNLOAD, GO TO THE WHITE ZONE !!!
27
 *
28
 * @package     Event Espresso
29
 * @subpackage  helpers
30
 * @since       4.5.0
31
 */
32
/**
33
 * this function can be used to simplify generating a DIW notice for a deprecated action or filter
34
 *
35
 * @param string $deprecated_filter
36
 * @param string $replacement
37
 * @param string $replacement_location
38
 * @param string $version_deprecated
39
 * @param string $version_applies
40
 * @param string $action_or_filter
41
 */
42
function deprecated_espresso_action_or_filter_doing_it_wrong(
43
	$deprecated_filter,
44
	$replacement,
45
	$replacement_location,
46
	$version_deprecated,
47
	$version_applies,
48
	$action_or_filter = 'action'
49
) {
50
	$action_or_filter = $action_or_filter === 'action'
51
		? esc_html__( 'action', 'event_espresso' )
52
		: esc_html__( 'filter', 'event_espresso' );
53
	EE_Error::doing_it_wrong(
54
		$deprecated_filter,
55
		sprintf(
56
			__(
57
				'This %1$s is deprecated.  It *may* work as an attempt to build in backwards compatibility.  However, it is recommended to use the following new %1$s: %4$s"%2$s" found in "%3$s"',
58
				'event_espresso'
59
			),
60
			$action_or_filter,
61
			$replacement,
62
			$replacement_location,
63
			'<br />'
64
		),
65
		$version_deprecated,
66
		$version_applies
67
	);
68
}
69
/**
70
 * ee_deprecated__registration_checkout__button_text
71
 *
72
 * @param string       $submit_button_text
73
 * @param \EE_Checkout $checkout
74
 * @return string
75
 */
76
function ee_deprecated__registration_checkout__button_text( $submit_button_text, EE_Checkout $checkout ) {
77
	// list of old filters
78
	$deprecated_filters = array(
79
		'update_registration_details' => true,
80
		'process_payment' => true,
81
		'finalize_registration' => true,
82
		'and_proceed_to_payment' => true,
83
		'proceed_to' => true,
84
	);
85
	// loop thru and call doing_it_wrong() or remove any that aren't being used
86
	foreach ( $deprecated_filters as $deprecated_filter => $on ) {
87
		// was this filter called ?
88
		if ( has_action( 'FHEE__EED_Single_Page_Checkout__registration_checkout__button_text__' . $deprecated_filter )) {
89
			// only display doing_it_wrong() notice to Event Admins during non-AJAX requests
90
			if ( EE_Registry::instance()->CAP->current_user_can( 'ee_read_ee', 'hide_doing_it_wrong_for_deprecated_SPCO_filter' ) && ! defined( 'DOING_AJAX' ) ) {
91
				EE_Error::doing_it_wrong(
92
					'FHEE__EED_Single_Page_Checkout__registration_checkout__button_text__' . $deprecated_filter,
93
					sprintf(
94
						__( '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' ),
95
						'FHEE__EED_Single_Page_Checkout__registration_checkout__button_text__' . $deprecated_filter,
96
						'<br />',
97
						'FHEE__EE_SPCO_Reg_Step__set_submit_button_text___submit_button_text',
98
						'/modules/single_page_checkout/inc/EE_SPCO_Reg_Step.class.php'
99
					),
100
					'4.6.10'
101
				);
102
			}
103
		} else {
104
			unset( $deprecated_filters[ $deprecated_filter ] );
105
		}
106
	}
107
	if ( ! empty( $deprecated_filters )) {
108
109
		if ( $checkout->current_step->slug() == 'attendee_information' && $checkout->revisit && isset( $deprecated_filters[ 'update_registration_details' ] )) {
110
			$submit_button_text = apply_filters( 'FHEE__EED_Single_Page_Checkout__registration_checkout__button_text__update_registration_details', $submit_button_text );
111
		} else if ( $checkout->current_step->slug() == 'payment_options' && $checkout->revisit && isset( $deprecated_filters[ 'process_payment' ] ) ) {
112
			$submit_button_text = apply_filters( 'FHEE__EED_Single_Page_Checkout__registration_checkout__button_text__process_payment', $submit_button_text );
113 View Code Duplication
		} else if ( $checkout->next_step instanceof EE_SPCO_Reg_Step && $checkout->next_step->slug() == 'finalize_registration' && isset( $deprecated_filters[ 'finalize_registration' ] ) ) {
114
			$submit_button_text = apply_filters( 'FHEE__EED_Single_Page_Checkout__registration_checkout__button_text__finalize_registration', $submit_button_text );
115
		}
116
		if ( $checkout->next_step instanceof EE_SPCO_Reg_Step ) {
117
			if ( $checkout->payment_required() && $checkout->next_step->slug() == 'payment_options' && isset( $deprecated_filters[ 'and_proceed_to_payment' ] ) ) {
118
				$submit_button_text .= apply_filters( 'FHEE__EED_Single_Page_Checkout__registration_checkout__button_text__and_proceed_to_payment', $submit_button_text );
119
			}
120 View Code Duplication
			if ( $checkout->next_step->slug() != 'finalize_registration' && ! $checkout->revisit && isset( $deprecated_filters[ 'proceed_to' ] ) ) {
121
				$submit_button_text = apply_filters( 'FHEE__EED_Single_Page_Checkout__registration_checkout__button_text__proceed_to', $submit_button_text ) . $checkout->next_step->name();
122
			}
123
		}
124
125
	}
126
	return $submit_button_text;
127
128
}
129
add_filter( 'FHEE__EE_SPCO_Reg_Step__set_submit_button_text___submit_button_text', 'ee_deprecated__registration_checkout__button_text', 10, 2 );
130
131
132
133
134
/**
135
 * ee_deprecated_finalize_transaction
136
 *
137
 * @param \EE_Checkout $checkout
138
 * @param boolean $status_updates
139
 */
140
function ee_deprecated_finalize_transaction( EE_Checkout $checkout, $status_updates ) {
141
	$action_ref = NULL;
142
	$action_ref = has_action( 'AHEE__EE_Transaction__finalize__new_transaction' ) ? 'AHEE__EE_Transaction__finalize__new_transaction' : $action_ref;
143
	$action_ref = has_action( 'AHEE__EE_Transaction__finalize__all_transaction' ) ? 'AHEE__EE_Transaction__finalize__all_transaction' : $action_ref;
144
	if ( $action_ref ) {
0 ignored issues
show
Bug Best Practice introduced by
The expression $action_ref of type string|null is loosely compared to true; this is ambiguous if the string can be empty. You might want to explicitly use !== null instead.

In PHP, under loose comparison (like ==, or !=, or switch conditions), values of different types might be equal.

For string values, the empty string '' is a special case, in particular the following results might be unexpected:

''   == false // true
''   == null  // true
'ab' == false // false
'ab' == null  // false

// It is often better to use strict comparison
'' === false // false
'' === null  // false
Loading history...
145
146
		EE_Error::doing_it_wrong(
147
			$action_ref,
148
			sprintf(
149
				__( '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' ),
150
				'<br />',
151
				'/core/business/EE_Transaction_Processor.class.php',
152
				'AHEE__EE_Transaction_Processor__finalize',
153
				'AHEE__EE_Transaction_Processor__manually_update_registration_statuses',
154
				'AHEE__EE_Transaction_Processor__toggle_registration_statuses_for_default_approved_events',
155
				'AHEE__EE_Transaction_Processor__toggle_registration_statuses_if_no_monies_owing'
156
			),
157
			'4.6.0'
158
		);
159
		switch ( $action_ref ) {
160
			case 'AHEE__EE_Transaction__finalize__new_transaction' :
161
				do_action( 'AHEE__EE_Transaction__finalize__new_transaction', $checkout->transaction, $checkout->admin_request );
162
				break;
163
			case 'AHEE__EE_Transaction__finalize__all_transaction' :
164
				do_action( 'AHEE__EE_Transaction__finalize__new_transaction', $checkout->transaction, array( 'new_reg' => ! $checkout->revisit, 'to_approved' => $status_updates ), $checkout->admin_request );
165
				break;
166
		}
167
	}
168
}
169
add_action( 'AHEE__EE_SPCO_Reg_Step_Finalize_Registration__process_reg_step__completed', 'ee_deprecated_finalize_transaction', 10, 2 );
170
/**
171
 * ee_deprecated_finalize_registration
172
 *
173
 * @param EE_Registration $registration
174
 */
175
function ee_deprecated_finalize_registration( EE_Registration $registration ) {
176
	$action_ref = has_action( 'AHEE__EE_Registration__finalize__update_and_new_reg' ) ? 'AHEE__EE_Registration__finalize__update_and_new_reg' : NULL;
177
	if ( $action_ref ) {
0 ignored issues
show
Bug Best Practice introduced by
The expression $action_ref of type string|null is loosely compared to true; this is ambiguous if the string can be empty. You might want to explicitly use !== null instead.

In PHP, under loose comparison (like ==, or !=, or switch conditions), values of different types might be equal.

For string values, the empty string '' is a special case, in particular the following results might be unexpected:

''   == false // true
''   == null  // true
'ab' == false // false
'ab' == null  // false

// It is often better to use strict comparison
'' === false // false
'' === null  // false
Loading history...
178
		EE_Error::doing_it_wrong(
179
			$action_ref,
180
			sprintf(
181
				__( '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' ),
182
				'<br />',
183
				'/core/business/EE_Registration_Processor.class.php',
184
				'AHEE__EE_Registration_Processor__trigger_registration_status_changed_hook'
185
			),
186
			'4.6.0'
187
		);
188
		do_action( 'AHEE__EE_Registration__finalize__update_and_new_reg', $registration, ( is_admin() && ! ( defined( 'DOING_AJAX' ) && DOING_AJAX )));
189
	}
190
}
191
add_action( 'AHEE__EE_Registration_Processor__trigger_registration_update_notifications', 'ee_deprecated_finalize_registration', 10, 1 );
192
193
194
195
/**
196
 * Called after EED_Module::set_hooks() and EED_Module::set_admin_hooks() was called.
197
 * Checks if any deprecated hooks were hooked-into and provide doing_it_wrong messages appropriately.
198
 */
199
function ee_deprecated_hooks(){
200
	/**
201
	 * @var $hooks array where keys are hook names, and their values are array{
202
	 *			@type string $version  when deprecated
203
	 *			@type string $alternative  saying what to use instead
204
	 *			@type boolean $still_works  whether or not the hook still works
205
	 *		}
206
	 */
207
	$hooks = array(
208
		'AHEE__EE_System___do_setup_validations' => array(
209
			'version' => '4.6.0',
210
			'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' ),
211
			'still_works' => FALSE
212
		)
213
	);
214
	foreach( $hooks as $name => $deprecation_info ){
215
		if( has_action( $name ) ){
216
			EE_Error::doing_it_wrong(
217
				$name,
218
				sprintf(
219
					__('This filter is deprecated. %1$s%2$s','event_espresso'),
220
					$deprecation_info[ 'still_works' ] ?  __('It *may* work as an attempt to build in backwards compatibility.', 'event_espresso') : __( 'It has been completely removed.', 'event_espresso' ),
221
					isset( $deprecation_info[ 'alternative' ] ) ? $deprecation_info[ 'alternative' ] : __( 'Please read the current EE4 documentation further or contact Support.', 'event_espresso' )
222
				),
223
				isset( $deprecation_info[ 'version' ] ) ? $deprecation_info[ 'version' ] : __( 'recently', 'event_espresso' )
224
			);
225
		}
226
	}
227
}
228
add_action( 'AHEE__EE_System__set_hooks_for_shortcodes_modules_and_addons', 'ee_deprecated_hooks' );
229
230
231
232
/**
233
 * Checks if the filters which were removed as part of https://events.codebasehq.com/projects/event-espresso/tickets/9165
234
 * are in use. If so, issues a doing_it_wrong AND an error (because the doing_it_wrong
235
 * messages were somehow hidden in the UI)
236
 * @return boolean
237
 */
238
function ee_deprecated_using_old_registration_admin_custom_questions_form_hooks() {
239
	$in_use =  has_filter( 'FHEE__Registrations_Admin_Page___update_attendee_registration_form__qstns' )
240
			|| has_action( 'AHEE__Registrations_Admin_Page___save_attendee_registration_form__after_reg_and_attendee_save' );
241
	if( $in_use ) {
242
		$msg = __(
243
			'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.'
244
			. '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,'
245
			. 'use FHEE__EE_Form_Section_Proper__receive_form_submission__req_data to customize the submission data, or AHEE__EE_Form_Section_Proper__receive_form_submission__end '
246
			. 'to add other actions after a form submission has been received.',
247
			'event_espresso' )
248
		;
249
		EE_Error::doing_it_wrong(
250
			__CLASS__ . '::' . __FUNCTION__,
251
			$msg,
252
			'4.8.32.rc.000'
253
		);
254
		//it seems the doing_it_wrong messages get output during some hidden html tags, so add an error to make sure this gets noticed
255
		if ( is_admin() && ! defined( 'DOING_AJAX' ) ) {
256
			EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ );
257
		}
258
	}
259
	return $in_use;
260
}
261
add_action( 'AHEE__Registrations_Admin_Page___registration_details_metabox__start', 'ee_deprecated_using_old_registration_admin_custom_questions_form_hooks' );
262
263
/**
264
 * @deprecated since 4.8.32.rc.000 because it has issues on https://events.codebasehq.com/projects/event-espresso/tickets/9165
265
 * it is preferred to instead use _update_attendee_registration_form_new() which
266
 * also better handles form validation. Exits
267
 * @param EE_Admin_Page $admin_page
268
 * @return void
269
 */
270
function ee_deprecated_update_attendee_registration_form_old( $admin_page ) {
271
	//check if the old hooks are in use. If not, do the default
272
	if( ! ee_deprecated_using_old_registration_admin_custom_questions_form_hooks()
273
		|| ! $admin_page instanceof EE_Admin_Page ) {
274
		return;
275
	}
276
	$req_data = $admin_page->get_request_data();
277
	$qstns = isset( $req_data['qstn'] ) ? $req_data['qstn'] : FALSE;
278
	$REG_ID = isset( $req_data['_REG_ID'] ) ? absint( $req_data['_REG_ID'] ) : FALSE;
279
	$qstns = apply_filters( 'FHEE__Registrations_Admin_Page___update_attendee_registration_form__qstns', $qstns );
280
	if ( ! $REG_ID || ! $qstns ) {
281
		EE_Error::add_error( __('An error occurred. No registration ID and/or registration questions were received.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ );
282
	}
283
	$success = TRUE;
284
285
	// allow others to get in on this awesome fun   :D
286
	do_action( 'AHEE__Registrations_Admin_Page___save_attendee_registration_form__after_reg_and_attendee_save', $REG_ID, $qstns );
287
	// loop thru questions... FINALLY!!!
288
289
	foreach ( $qstns as $QST_ID => $qstn ) {
290
		//if $qstn isn't an array then it doesn't already have an answer, so let's create the answer
291
		if ( !is_array($qstn) ) {
292
			$success = $this->_save_new_answer( $REG_ID, $QST_ID, $qstn);
0 ignored issues
show
Bug introduced by
The variable $this does not exist. Did you forget to declare it?

This check marks access to variables or properties that have not been declared yet. While PHP has no explicit notion of declaring a variable, accessing it before a value is assigned to it is most likely a bug.

Loading history...
293
			continue;
294
		}
295
296
297
		foreach ( $qstn as $ANS_ID => $ANS_value ) {
298
			//get answer
299
			$query_params = array(
300
				0 => array(
301
					'ANS_ID' => $ANS_ID,
302
					'REG_ID' => $REG_ID,
303
					'QST_ID' => $QST_ID
304
					)
305
				);
306
			$answer = EEM_Answer::instance()->get_one($query_params);
307
			//this MAY be an array but NOT have an answer because its multi select.  If so then we need to create the answer
308
			if ( ! $answer instanceof EE_Answer ) {
309
				$set_values = array(
310
					'QST_ID' => $QST_ID,
311
					'REG_ID' => $REG_ID,
312
					'ANS_value' => $qstn
313
					);
314
				$success = EEM_Answer::instance()->insert($set_values);
315
				continue 2;
316
			}
317
318
			$answer->set('ANS_value', $ANS_value);
319
			$success = $answer->save();
320
		}
321
	}
322
	$what = __('Registration Form', 'event_espresso');
323
	$route = $REG_ID ? array( 'action' => 'view_registration', '_REG_ID' => $REG_ID ) : array( 'action' => 'default' );
324
	$admin_page->redirect_after_action( $success, $what, __('updated', 'event_espresso'), $route );
325
	exit;
326
}
327
add_action( 'AHEE__Registrations_Admin_Page___update_attendee_registration_form__start', 'ee_deprecated_update_attendee_registration_form_old', 10, 1 );
328
/**
329
 * Render the registration admin page's custom questions area in the old fashion
330
 * and firing the old hooks. When this method is removed, we can probably also
331
 * remove the deprecated methods form_before_question_group, form_after_question_group,
332
 * form_form_field_label_wrap and form_form_field_input__wrap in Registrations_Admin_Page
333
 *
334
 * @param boolean         $do_default_action
335
 * @param EE_Admin_Page   $admin_page
336
 * @param EE_Registration $registration
337
 * @return bool
338
 * @throws \EE_Error
339
 */
340
function ee_deprecated_reg_questions_meta_box_old( $do_default_action, $admin_page, $registration ) {
341
	//check if the old hooks are in use. If not, do the default
342
	if( ! ee_deprecated_using_old_registration_admin_custom_questions_form_hooks()
343
		|| ! $admin_page instanceof EE_Admin_Page ) {
344
		return $do_default_action;
345
	}
346
	add_filter( 'FHEE__EEH_Form_Fields__generate_question_groups_html__before_question_group_questions', array( $admin_page, 'form_before_question_group' ), 10, 1 );
347
	add_filter( 'FHEE__EEH_Form_Fields__generate_question_groups_html__after_question_group_questions', array( $admin_page, 'form_after_question_group' ), 10, 1 );
348
	add_filter( 'FHEE__EEH_Form_Fields__label_html', array( $admin_page, 'form_form_field_label_wrap' ), 10, 1 );
349
	add_filter( 'FHEE__EEH_Form_Fields__input_html', array( $admin_page, 'form_form_field_input__wrap' ), 10, 1 );
350
351
	$question_groups = EEM_Event::instance()->assemble_array_of_groups_questions_and_options( $registration, $registration->get('EVT_ID') );
0 ignored issues
show
Deprecated Code introduced by
The method EEM_Event::assemble_arra...questions_and_options() has been deprecated with message: as of 4.8.32.rc.001. Instead consider using EE_Registration_Custom_Questions_Form located in admin_pages/registrations/form_sections/EE_Registration_Custom_Questions_Form.form.php

This method has been deprecated. The supplier of the class has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the method will be removed from the class and what other method or class to use instead.

Loading history...
352
353
	EE_Registry::instance()->load_helper( 'Form_Fields' );
354
	$template_args = array(
355
		'att_questions' => EEH_Form_Fields::generate_question_groups_html( $question_groups ),
356
		'reg_questions_form_action' => 'edit_registration',
357
		'REG_ID' => $registration->ID()
358
	);
359
	$template_path = REG_TEMPLATE_PATH . 'reg_admin_details_main_meta_box_reg_questions.template.php';
360
	echo EEH_Template::display_template( $template_path, $template_args, TRUE );
361
	//indicate that we should not do the default admin page code
362
	return false;
363
}
364
add_action( 'FHEE__Registrations_Admin_Page___reg_questions_meta_box__do_default', 'ee_deprecated_reg_questions_meta_box_old', 10, 3 );
365
366
367
368
369
/**
370
 * Deprecated class for instantiating default templates.  This was deprecated because of a substantial change in the constructor
371
 * signature.
372
 *
373
 * @package    Event Espresso
374
 * @subpackage messages
375
 * @author     Darren Ethier
376
 * @since      4.1
377
 * @deprecated 4.9.0  Replaced by EE_Messages_Template_Defaults (note the plural s on Messages)
378
 */
379
class EE_Message_Template_Defaults extends EE_Base {
380
381
	/**
382
	 * EE_Message_Template_Defaults constructor.
383
	 *
384
	 * @param EE_messages $messages
385
	 * @param             $messenger_name
386
	 * @param             $message_type_name
387
	 * @param int         $GRP_ID
388
	 * @return EE_Messages_Template_Defaults
0 ignored issues
show
Comprehensibility Best Practice introduced by
Adding a @return annotation to constructors is generally not recommended as a constructor does not have a meaningful return value.

Adding a @return annotation to a constructor is not recommended, since a constructor does not have a meaningful return value.

Please refer to the PHP core documentation on constructors.

Loading history...
389
	 */
390
	public function __construct(
391
		EE_messages $messages,
392
		$messenger_name,
393
		$message_type_name,
394
		$GRP_ID = 0
395
	) {
396
		EE_Error::doing_it_wrong(
397
			__FUNCTION__,
398
			__(
399
				'The class EE_Message_Template_Defaults has been deprecated and replaced by EE_Messages_Template_Defaults.',
400
				'event_espresso'
401
			),
402
			'4.9.0'
403
		);
404
		/** @var EE_Message_Resource_Manager $message_resource_manager */
405
		$message_resource_manager = EE_Registry::instance()->load_lib( 'Message_Resource_Manager' );
406
		$messenger = $message_resource_manager->get_messenger( $messenger_name );
407
		$message_type = $message_resource_manager->get_message_type( $message_type_name );
408
		return EE_Registry::instance()->load_lib(
0 ignored issues
show
Bug introduced by
Constructors do not have meaningful return values, anything that is returned from here is discarded. Are you sure this is correct?
Loading history...
409
			'Messages_Template_Defaults',
410
			array(
411
				$GRP_ID,
412
				$messenger,
413
				$message_type,
414
			)
415
		);
416
	}
417
}
418
419
420
421
//end EE_Message_Template_Defaults class
422
423
424
425
426
/**
427
 * @deprecated     4.9.0
428
 * @package        Event Espresso
429
 * @subpackage     includes/core/messages
430
 * @author         Darren Ethier, Brent Christensen
431
 *
432
 * ------------------------------------------------------------------------
433
 */
434
class EE_messages {
435
436
	/** @type EE_messenger[] */
437
	protected $_active_messengers = array();
438
439
	/** @type array */
440
	protected $_active_message_types = array();
441
442
	/** @type EE_message_type[] */
443
	protected $_installed_message_types = array();
444
445
	/** @type EE_messenger */
446
	protected $_messenger;
447
448
	/** @type EE_message_type */
449
	protected $_message_type;
450
451
	/** @type array */
452
	protected $_contexts = array();
453
454
	/** @type EE_Message_Resource_Manager $_message_resource_manager */
455
	protected $_message_resource_manager;
456
457
458
459
	/**
460
	 * EE_messages constructor.
461
	 *
462
	 * @deprecated 4.9.0
463
	 */
464
	public function __construct() {
465
	}
466
467
468
469
	/**
470
	 * @param string $method
471
	 */
472 View Code Duplication
	public function _class_is_deprecated( $method ) {
473
		EE_Error::doing_it_wrong(
474
			'EE_messages::' . $method,
475
			__( 'EE_messages has been deprecated.  Please use EE_Message_Resource_Manager instead.' ),
476
			'4.9.0',
477
			'4.10.0.p'
478
		);
479
		// Please use EE_Message_Resource_Manager instead
480
		$this->_message_resource_manager = EE_Registry::instance()->load_lib( 'Message_Resource_Manager' );
481
	}
482
483
484
485
	/**
486
	 * @deprecated 4.9.0
487
	 * @param string $messenger_name
488
	 * @return boolean TRUE if it was PREVIOUSLY active, and FALSE if it was previously inactive
489
	 */
490
	public function ensure_messenger_is_active( $messenger_name ) {
491
		// EE_messages has been deprecated
492
		$this->_class_is_deprecated( __FUNCTION__ );
493
		return $this->_message_resource_manager->ensure_messenger_is_active( $messenger_name );
494
	}
495
496
497
498
	/**
499
	 * @deprecated 4.9.0
500
	 * @param string $message_type message type name
501
	 * @param        $messenger
502
	 * @return bool true if it got activated (or was active) and false if not.
503
	 * @throws \EE_Error
504
	 */
505
	public function ensure_message_type_is_active( $message_type, $messenger ) {
506
		// EE_messages has been deprecated
507
		$this->_class_is_deprecated( __FUNCTION__ );
508
		return $this->_message_resource_manager->ensure_message_type_is_active( $message_type, $messenger );
509
	}
510
511
512
513
	/**
514
	 * @deprecated 4.9.0
515
	 * @param string $messenger_name
516
	 * @param array  $mts_to_activate             (optional) An array of message types to activate with this messenger.  If
517
	 *                                            included we do NOT setup the default message types (assuming
518
	 *                                            they are already setup.)
519
	 * @return boolean an array of generated templates or false if nothing generated/activated.
520
	 */
521
	public function activate_messenger( $messenger_name, $mts_to_activate = array() ) {
522
		// EE_messages has been deprecated
523
		$this->_class_is_deprecated( __FUNCTION__ );
524
		return $this->_message_resource_manager->activate_messenger( $messenger_name, $mts_to_activate );
525
	}
526
527
528
529
	/**
530
	 * @deprecated 4.9.0
531
	 * @param EE_messenger    $messenger    messenger used in trigger
532
	 * @param EE_message_type $message_type message type used in trigger
533
	 *
534
	 * @return bool true is a generating messenger and can be sent OR FALSE meaning cannot send.
535
	 */
536
	public function is_generating_messenger_and_active( EE_messenger $messenger, EE_message_type $message_type ) {
537
		// EE_messages has been deprecated
538
		$this->_class_is_deprecated( __FUNCTION__ );
539
		return $this->_message_resource_manager->is_generating_messenger_and_active( $messenger, $message_type );
540
	}
541
542
543
544
	/**
545
	 * @deprecated 4.9.0
546
	 * @param string $messenger
547
	 * @return EE_messenger | null
548
	 */
549
	public function get_messenger_if_active( $messenger ) {
550
		// EE_messages has been deprecated
551
		$this->_class_is_deprecated( __FUNCTION__ );
552
		return $this->_message_resource_manager->get_active_messenger( $messenger );
553
	}
554
555
556
557
	/**
558
	 * @deprecated 4.9.0
559
	 * @param EE_Message $message
560
	 * @return array  An array with 'messenger' and 'message_type' as the index and the corresponding valid object if
561
	 *                  available.
562
	 *                  Eg. Valid Messenger and Message Type:
563
	 *                  array(
564
	 *                  'messenger' => new EE_Email_messenger(),
565
	 *                  'message_type' => new EE_Registration_Approved_message_type()
566
	 *                  )
567
	 *                  Valid Messenger and Invalid Message Type:
568
	 *                  array(
569
	 *                  'messenger' => new EE_Email_messenger(),
570
	 *                  'message_type' => null
571
	 *                  )
572
	 */
573
	public function validate_for_use( EE_Message $message ) {
574
		// EE_messages has been deprecated
575
		$this->_class_is_deprecated( __FUNCTION__ );
576
		return array(
577
			'messenger'    => $message->messenger_object(),
578
			'message_type' => $message->message_type_object(),
579
		);
580
	}
581
582
583
584
	/**
585
	 * @deprecated 4.9.0
586
	 * @param  string $type                 What type of message are we sending (corresponds to message types)
587
	 * @param  mixed  $vars                 Data being sent for parsing in the message
588
	 * @param  string $sending_messenger    if included then we ONLY use the specified messenger for delivery.  Otherwise we cycle through all active messengers.
589
	 * @param string  $generating_messenger if included then this messenger is used for generating the message templates (but not for sending).
590
	 * @param string  $context              If included then only a message type for a specific context will be generated.
591
	 * @param bool    $send                 Default TRUE.  If false, then this will just return the generated EE_messages objects which might be used by the trigger to setup a batch message (typically html messenger uses it).
592
	 * @return bool
593
	 */
594
	public function send_message(
595
		$type,
596
		$vars,
597
		$sending_messenger = '',
598
		$generating_messenger = '',
599
		$context = '',
600
		$send = true
601
	) {
602
		// EE_messages has been deprecated
603
		$this->_class_is_deprecated( __FUNCTION__ );
604
		/** @type EE_Messages_Processor $processor */
605
		$processor = EE_Registry::instance()->load_lib( 'Messages_Processor' );
606
		$error = false;
607
		//try to intelligently determine what method we'll call based on the incoming data.
608
		//if generating and sending are different then generate and send immediately.
609
		if ( ! empty( $sending_messenger ) && $sending_messenger != $generating_messenger && $send ) {
610
			//in the legacy system, when generating and sending were different, that means all the
611
			//vars are already in the request object.  So let's just use that.
612
			try {
613
				/** @type EE_Message_To_Generate_From_Request $mtg */
614
				$mtg = EE_Registry::instance()->load_lib( 'Message_To_Generate_From_Request' );
615
				$processor->generate_and_send_now( $mtg );
616
			} catch ( EE_Error $e ) {
617
				$error_msg = __(
618
					'Please note that a system message failed to send due to a technical issue.',
619
					'event_espresso'
620
				);
621
				// add specific message for developers if WP_DEBUG in on
622
				$error_msg .= '||' . $e->getMessage();
623
				EE_Error::add_error( $error_msg, __FILE__, __FUNCTION__, __LINE__ );
624
				$error = true;
625
			}
626
		} else {
627
			$processor->generate_for_all_active_messengers( $type, $vars, $send );
628
			//let's find out if there were any errors and how many successfully were queued.
629
			$count_errors = $processor->get_queue()->count_STS_in_queue(
630
				array( EEM_Message::status_failed, EEM_Message::status_debug_only )
631
			);
632
			$count_queued = $processor->get_queue()->count_STS_in_queue( EEM_Message::status_incomplete );
633
			$count_retry = $processor->get_queue()->count_STS_in_queue( EEM_Message::status_retry );
634
			$count_errors = $count_errors + $count_retry;
635
			if ( $count_errors > 0 ) {
636
				$error = true;
637
				if ( $count_errors > 1 && $count_retry > 1 && $count_queued > 1 ) {
638
					$message = sprintf(
639
						__(
640
							'There were %d errors and %d messages successfully queued for generation and sending',
641
							'event_espresso'
642
						),
643
						$count_errors,
644
						$count_queued
645
					);
646
				} elseif ( $count_errors > 1 && $count_queued === 1 ) {
647
					$message = sprintf(
648
						__(
649
							'There were %d errors and %d message successfully queued for generation.',
650
							'event_espresso'
651
						),
652
						$count_errors,
653
						$count_queued
654
					);
655
				} elseif ( $count_errors === 1 && $count_queued > 1 ) {
656
					$message = sprintf(
657
						__(
658
							'There was %d error and %d messages successfully queued for generation.',
659
							'event_espresso'
660
						),
661
						$count_errors,
662
						$count_queued
663
					);
664
				} else {
665
					$message = sprintf(
666
						__(
667
							'There was %d message that failed to be queued for generation.',
668
							'event_espresso'
669
						),
670
						$count_errors
671
					);
672
				}
673
				EE_Error::add_error( $message, __FILE__, __FUNCTION__, __LINE__ );
674
			} else {
675
				if ( $count_queued === 1 ) {
676
					$message = sprintf(
677
						__(
678
							'%d message successfully queued for generation.',
679
							'event_espresso'
680
						),
681
						$count_queued
682
					);
683
				} else {
684
					$message = sprintf(
685
						__(
686
							'%d messages were successfully queued for generation.',
687
							'event_espresso'
688
						),
689
						$count_queued
690
					);
691
				}
692
				EE_Error::add_success( $message );
693
			}
694
		}
695
		//if no error then return the generated message(s).
696
		if ( ! $error && ! $send ) {
697
			$generated_queue = $processor->generate_queue( false );
698
			//get message and return.
699
			$generated_queue->get_message_repository()->rewind();
700
			$messages = array();
701
			while ( $generated_queue->get_message_repository()->valid() ) {
702
				$message = $generated_queue->get_message_repository()->current();
703
				if ( $message instanceof EE_Message ) {
704
					//set properties that might be expected by add-ons (backward compat)
705
					$message->content = $message->content();
0 ignored issues
show
Deprecated Code introduced by
The property EE_Message::$content has been deprecated with message: 4.9.0 Added for backward compat with add-on's

This property has been deprecated. The supplier of the class has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the property will be removed from the class and what other property to use instead.

Loading history...
706
					$message->template_pack = $message->get_template_pack();
0 ignored issues
show
Deprecated Code introduced by
The property EE_Message::$template_pack has been deprecated with message: 4.9.0 Added for backward compat with add-on's

This property has been deprecated. The supplier of the class has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the property will be removed from the class and what other property to use instead.

Loading history...
707
					$message->template_variation = $message->get_template_pack_variation();
0 ignored issues
show
Deprecated Code introduced by
The property EE_Message::$template_variation has been deprecated with message: 4.9.0 Added for backward compat with add-on's

This property has been deprecated. The supplier of the class has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the property will be removed from the class and what other property to use instead.

Loading history...
708
					$messages[] = $message;
709
				}
710
				$generated_queue->get_message_repository()->next();
711
			}
712
			return $messages;
713
		}
714
		return $error ? false
715
			: true; //yeah backwards eh?  Really what we're returning is if there is a total success for all the messages or not.  We'll modify this once we get message recording in place.
716
	}
717
718
719
720
	/**
721
	 * @deprecated 4.9.0
722
	 * @param  string $type      This should correspond with a valid message type
723
	 * @param  string $context   This should correspond with a valid context for the message type
724
	 * @param  string $messenger This should correspond with a valid messenger.
725
	 * @param bool    $send      true we will do a test send using the messenger delivery, false we just do a regular preview
726
	 * @return string          The body of the message.
727
	 */
728
	public function preview_message( $type, $context, $messenger, $send = false ) {
729
		// EE_messages has been deprecated
730
		$this->_class_is_deprecated( __FUNCTION__ );
731
		return EED_Messages::preview_message( $type, $context, $messenger, $send );
732
	}
733
734
735
736
	/**
737
	 * @since      4.5.0
738
	 * @deprecated 4.9.0   Moved to EED_Messages Module
739
	 * @param string   $messenger    a string matching a valid active messenger in the system
740
	 * @param string   $message_type Although it seems contrary to the name of the method, a message type name is still required to send along the message type to the messenger because this is used for determining what specific variations might be loaded for the generated message.
741
	 * @param stdClass $message      a stdClass object in the format expected by the messenger.
742
	 *
743
	 * @return bool          success or fail.
744
	 */
745
	public function send_message_with_messenger_only( $messenger, $message_type, $message ) {
746
		// EE_messages has been deprecated
747
		$this->_class_is_deprecated( __FUNCTION__ );
748
		//setup for sending to new method.
749
		/** @type EE_Messages_Queue $queue */
750
		$queue = EE_Registry::instance()->load_lib( 'Messages_Queue' );
751
		//make sure we have a proper message object
752
		if ( ! $message instanceof EE_Message && is_object( $message ) && isset( $message->content ) ) {
753
			$msg = EE_Message_Factory::create(
754
				array(
755
					'MSG_messenger'    => $messenger,
756
					'MSG_message_type' => $message_type,
757
					'MSG_content'      => $message->content,
758
					'MSG_subject'      => $message->subject
759
				)
760
			);
761
		} else {
762
			$msg = $message;
763
		}
764
		if ( ! $msg instanceof EE_Message ) {
765
			return false;
766
		}
767
		//make sure any content in a content property (if not empty) is set on the MSG_content.
768
		if ( ! empty( $msg->content ) ) {
0 ignored issues
show
Deprecated Code introduced by
The property EE_Message::$content has been deprecated with message: 4.9.0 Added for backward compat with add-on's

This property has been deprecated. The supplier of the class has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the property will be removed from the class and what other property to use instead.

Loading history...
769
			$msg->set( 'MSG_content', $msg->content );
0 ignored issues
show
Deprecated Code introduced by
The property EE_Message::$content has been deprecated with message: 4.9.0 Added for backward compat with add-on's

This property has been deprecated. The supplier of the class has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the property will be removed from the class and what other property to use instead.

Loading history...
770
		}
771
		$queue->add( $msg );
772
		return EED_Messages::send_message_with_messenger_only( $messenger, $message_type, $queue );
773
	}
774
775
776
777
	/**
778
	 * @deprecated 4.9.0
779
	 * @param         $messenger
780
	 * @param  string $message_type message type that the templates are being created for
781
	 * @param int     $GRP_ID
782
	 * @param bool    $is_global
783
	 * @return array|object if creation is successful then we return an array of info, otherwise an error_object is returned.
784
	 * @throws \EE_Error
785
	 */
786
	public function create_new_templates( $messenger, $message_type, $GRP_ID = 0, $is_global = false ) {
787
		// EE_messages has been deprecated
788
		$this->_class_is_deprecated( __FUNCTION__ );
789
		EE_Registry::instance()->load_helper( 'MSG_Template' );
790
		return EEH_MSG_Template::create_new_templates( $messenger, $message_type, $GRP_ID, $is_global );
791
	}
792
793
794
795
	/**
796
	 * @deprecated 4.9.0
797
	 * @param  string $messenger_name    name of EE_messenger
798
	 * @param  string $message_type_name name of EE_message_type
799
	 * @return array
800
	 */
801
	public function get_fields( $messenger_name, $message_type_name ) {
802
		// EE_messages has been deprecated
803
		$this->_class_is_deprecated( __FUNCTION__ );
804
		EE_Registry::instance()->load_helper( 'MSG_Template' );
805
		return EEH_MSG_Template::get_fields( $messenger_name, $message_type_name );
806
	}
807
808
809
810
	/**
811
	 * @deprecated 4.9.0
812
	 * @access     public
813
	 * @param string $type                we can indicate just returning installed message types
814
	 *                                    or messengers (or both) via this parameter.
815
	 * @param bool   $skip_cache          if true then we skip the cache and retrieve via files.
816
	 * @return array                    multidimensional array of messenger and message_type objects
817
	 *                                    (messengers index, and message_type index);
818
	 */
819
	public function get_installed( $type = 'all', $skip_cache = false ) {
820
		// EE_messages has been deprecated
821
		$this->_class_is_deprecated( __FUNCTION__ );
822
		if ( $skip_cache ) {
823
			$this->_message_resource_manager->reset_active_messengers_and_message_types();
824
		}
825
		switch ( $type ) {
826
			case 'messengers' :
827
				return array(
828
					'messenger' => $this->_message_resource_manager->installed_messengers(),
829
				);
830
				break;
0 ignored issues
show
Unused Code introduced by
break is not strictly necessary here and could be removed.

The break statement is not necessary if it is preceded for example by a return statement:

switch ($x) {
    case 1:
        return 'foo';
        break; // This break is not necessary and can be left off.
}

If you would like to keep this construct to be consistent with other case statements, you can safely mark this issue as a false-positive.

Loading history...
831
			case 'message_types' :
832
				return array(
833
					'message_type' => $this->_message_resource_manager->installed_message_types(),
834
				);
835
				break;
0 ignored issues
show
Unused Code introduced by
break is not strictly necessary here and could be removed.

The break statement is not necessary if it is preceded for example by a return statement:

switch ($x) {
    case 1:
        return 'foo';
        break; // This break is not necessary and can be left off.
}

If you would like to keep this construct to be consistent with other case statements, you can safely mark this issue as a false-positive.

Loading history...
836
			case 'all' :
837
			default :
838
				return array(
839
					'messenger'    => $this->_message_resource_manager->installed_messengers(),
840
					'message_type' => $this->_message_resource_manager->installed_message_types(),
841
				);
842
				break;
0 ignored issues
show
Unused Code introduced by
break is not strictly necessary here and could be removed.

The break statement is not necessary if it is preceded for example by a return statement:

switch ($x) {
    case 1:
        return 'foo';
        break; // This break is not necessary and can be left off.
}

If you would like to keep this construct to be consistent with other case statements, you can safely mark this issue as a false-positive.

Loading history...
843
		}
844
	}
845
846
847
848
	/**
849
	 * @deprecated 4.9.0
850
	 * @return \EE_messenger[]
851
	 */
852
	public function get_active_messengers() {
853
		// EE_messages has been deprecated
854
		$this->_class_is_deprecated( __FUNCTION__ );
855
		return $this->_message_resource_manager->active_messengers();
856
	}
857
858
859
860
	/**
861
	 * @deprecated 4.9.0
862
	 * @return array array of message_type references (string)
863
	 */
864
	public function get_active_message_types() {
865
		// EE_messages has been deprecated
866
		$this->_class_is_deprecated( __FUNCTION__ );
867
		return $this->_message_resource_manager->list_of_active_message_types();
868
	}
869
870
871
872
	/**
873
	 * @deprecated 4.9.0
874
	 * @return EE_message_type[]
875
	 */
876
	public function get_active_message_type_objects() {
877
		// EE_messages has been deprecated
878
		$this->_class_is_deprecated( __FUNCTION__ );
879
		return $this->_message_resource_manager->get_active_message_type_objects();
880
	}
881
882
883
884
	/**
885
	 * @deprecated 4.9.0
886
	 * @since      4.5.0
887
	 * @param string $messenger The messenger being checked
888
	 * @return EE_message_type[]    (or empty array if none present)
889
	 */
890
	public function get_active_message_types_per_messenger( $messenger ) {
891
		// EE_messages has been deprecated
892
		$this->_class_is_deprecated( __FUNCTION__ );
893
		return $this->_message_resource_manager->get_active_message_types_for_messenger( $messenger );
894
	}
895
896
897
898
	/**
899
	 * @deprecated 4.9.0
900
	 * @param string $messenger    The string should correspond to the messenger (message types are
901
	 * @param string $message_type The string should correspond to a message type.
902
	 * @return EE_message_type|null
903
	 */
904
	public function get_active_message_type( $messenger, $message_type ) {
905
		// EE_messages has been deprecated
906
		$this->_class_is_deprecated( __FUNCTION__ );
907
		return $this->_message_resource_manager->get_active_message_type_for_messenger( $messenger, $message_type );
908
	}
909
910
911
912
	/**
913
	 * @deprecated 4.9.0
914
	 * @return array|\EE_message_type[]
915
	 */
916
	public function get_installed_message_types() {
917
		// EE_messages has been deprecated
918
		$this->_class_is_deprecated( __FUNCTION__ );
919
		return $this->_message_resource_manager->installed_message_types();
920
	}
921
922
923
924
	/**
925
	 * @deprecated 4.9.0
926
	 * @return array
927
	 */
928
	public function get_installed_messengers() {
929
		// EE_messages has been deprecated
930
		$this->_class_is_deprecated( __FUNCTION__ );
931
		return $this->_message_resource_manager->installed_messengers();
932
	}
933
934
935
936
	/**
937
	 * @deprecated 4.9.0
938
	 * @param   bool $slugs_only Whether to return an array of just slugs and labels (true) or all contexts indexed by message type.
939
	 * @return array
940
	 */
941
	public function get_all_contexts( $slugs_only = true ) {
942
		// EE_messages has been deprecated
943
		$this->_class_is_deprecated( __FUNCTION__ );
944
		return $this->_message_resource_manager->get_all_contexts( $slugs_only );
945
	}
946
947
948
949
}
950
//end EE_messages class
951
952
953
954
/**
955
 * Class EE_Address_Formatter
956
 *
957
 * @deprecated 4.9.0
958
 */
959
class EE_Address_Formatter extends \EventEspresso\core\services\address\formatters\AddressFormatter {}
960
961
962
963
/**
964
 * Class EE_MultiLine_Address_Formatter
965
 *
966
 * @deprecated 4.9.0
967
 */
968
class EE_MultiLine_Address_Formatter extends \EventEspresso\core\services\address\formatters\NullAddressFormatter {}
969
970
971
972
/**
973
 * Class EE_Inline_Address_Formatter
974
 *
975
 * @deprecated 4.9.0
976
 */
977
class EE_Inline_Address_Formatter extends \EventEspresso\core\services\address\formatters\InlineAddressFormatter {}
978
979
980
981
/**
982
 * Class EE_Null_Address_Formatter
983
 *
984
 * @deprecated 4.9.0
985
 */
986
class EE_Null_Address_Formatter extends \EventEspresso\core\services\address\formatters\NullAddressFormatter {}
987
988
989
990
/**
991
 * Class EE_Generic_Address
992
 *
993
 * @deprecated 4.9.0
994
 */
995
class EE_Generic_Address extends \EventEspresso\core\domain\entities\GenericAddress {}
996
997
998
999
1000
add_filter(
1001
	'FHEE__EventEspresso_modules_events_archive_EventsArchiveIframe__display__css',
1002 View Code Duplication
	function($event_list_iframe_css) {
1003
		if ( ! has_filter( 'FHEE__EventsArchiveIframe__event_list_iframe__css' )) {
1004
			return $event_list_iframe_css;
1005
		}
1006
		deprecated_espresso_action_or_filter_doing_it_wrong(
1007
			'FHEE__EventsArchiveIframe__event_list_iframe__css',
1008
			'FHEE__EventEspresso_modules_events_archive_EventsArchiveIframe__display__css',
1009
			'\EventEspresso\modules\events_archive\EventsArchiveIframe::display()',
1010
			'4.9.14',
1011
			'5.0.0',
1012
			'filter'
1013
		);
1014
		return apply_filters(
1015
			'FHEE__EventsArchiveIframe__event_list_iframe__css',
1016
			$event_list_iframe_css
1017
		);
1018
	}
1019
);
1020
add_filter(
1021
	'FHEE__EventEspresso_modules_events_archive_EventsArchiveIframe__display__js',
1022 View Code Duplication
	function($event_list_iframe_js) {
1023
		if ( ! has_filter( 'FHEE__EED_Ticket_Selector__ticket_selector_iframe__js' )) {
1024
			return $event_list_iframe_js;
1025
		}
1026
		deprecated_espresso_action_or_filter_doing_it_wrong(
1027
			'FHEE__EED_Ticket_Selector__ticket_selector_iframe__js',
1028
			'FHEE__EventEspresso_modules_events_archive_EventsArchiveIframe__display__js',
1029
			'\EventEspresso\modules\events_archive\EventsArchiveIframe::display()',
1030
			'4.9.14',
1031
			'5.0.0',
1032
			'filter'
1033
		);
1034
		return apply_filters(
1035
			'FHEE__EED_Ticket_Selector__ticket_selector_iframe__js',
1036
			$event_list_iframe_js
1037
		);
1038
	}
1039
);
1040
add_action(
1041
	'AHEE__EE_Capabilities__addCaps__complete',
1042
	function($capabilities_map) {
1043
		if ( ! has_action( 'AHEE__EE_Capabilities__init_role_caps__complete' )) {
1044
			return;
1045
		}
1046
		deprecated_espresso_action_or_filter_doing_it_wrong(
1047
			'AHEE__EE_Capabilities__init_role_caps__complete',
1048
			'AHEE__EE_Capabilities__addCaps__complete',
1049
			'\EE_Capabilities::addCaps()',
1050
			'4.9.42',
1051
			'5.0.0'
1052
		);
1053
		do_action(
1054
			'AHEE__EE_Capabilities__init_role_caps__complete',
1055
            $capabilities_map
1056
		);
1057
	}
1058
);
1059
1060
add_filter(
1061
	'FHEE_EventEspresso_core_services_commands_attendee_CreateAttendeeCommandHandler__findExistingAttendee__existing_attendee',
1062 View Code Duplication
	function($existing_attendee, $registration, $attendee_data) {
1063
		if ( ! has_filter( 'FHEE_EE_Single_Page_Checkout__save_registration_items__find_existing_attendee' )) {
1064
			return $existing_attendee;
1065
		}
1066
		deprecated_espresso_action_or_filter_doing_it_wrong(
1067
			'FHEE_EE_Single_Page_Checkout__save_registration_items__find_existing_attendee',
1068
			'FHEE_EventEspresso_core_services_commands_attendee_CreateAttendeeCommandHandler__findExistingAttendee__existing_attendee',
1069
			'\EventEspresso\core\services\commands\attendee\CreateAttendeeCommandHandler::findExistingAttendee()',
1070
			'4.9.34',
1071
			'5.0.0',
1072
			'filter'
1073
		);
1074
		return apply_filters(
1075
            'FHEE_EE_Single_Page_Checkout__save_registration_items__find_existing_attendee',
1076
            $existing_attendee, $registration, $attendee_data
1077
        );
1078
	},
1079
	10,3
1080
);
1081
1082
/**
1083
 * Class EE_Event_List_Query
1084
 *
1085
 * @deprecated 4.9.40
1086
 */
1087
class EE_Event_List_Query extends WP_Query
1088
{
1089
1090
    private $title;
1091
1092
    private $css_class;
1093
1094
    private $category_slug;
1095
1096
    /**
1097
     * EE_Event_List_Query constructor.
1098
     *
1099
     * @param array $args
1100
     */
1101
    public function __construct($args = array())
1102
    {
1103
        \EE_Error::doing_it_wrong(
1104
            __METHOD__,
1105
            __(
1106
                'Usage is deprecated. Please use \EventEspresso\core\domain\services\wp_queries\EventListQuery instead.',
1107
                'event_espresso'
1108
            ),
1109
            '4.9.27',
1110
            '5.0.0'
1111
        );
1112
        $this->title = isset($args['title']) ? $args['title'] : '';
1113
        $this->css_class = isset($args['css_class']) ? $args['css_class'] : '';
1114
        $this->category_slug = isset($args['category_slug']) ? $args['category_slug'] : '';
1115
        $limit = isset($args['limit']) && absint($args['limit']) ? $args['limit'] : 10;
1116
        // the current "page" we are viewing
1117
        $paged = max(1, get_query_var('paged'));
1118
        // Force these args
1119
        $args = array_merge(
1120
            $args, array(
1121
            'post_type'              => 'espresso_events',
1122
            'posts_per_page'         => $limit,
1123
            'update_post_term_cache' => false,
1124
            'update_post_meta_cache' => false,
1125
            'paged'                  => $paged,
1126
            'offset'                 => ($paged - 1) * $limit
1127
        )
1128
        );
1129
        // run the query
1130
        parent::__construct($args);
1131
    }
1132
1133
1134
1135
    /**
1136
     * event_list_title
1137
     *
1138
     * @param string $event_list_title
1139
     * @return string
1140
     */
1141
    public function event_list_title($event_list_title = '')
1142
    {
1143
        if (! empty($this->title)) {
1144
            return $this->title;
1145
        }
1146
        return $event_list_title;
1147
    }
1148
1149
1150
1151
    /**
1152
     * event_list_css
1153
     *
1154
     * @param string $event_list_css
1155
     * @return string
1156
     */
1157 View Code Duplication
    public function event_list_css($event_list_css = '')
1158
    {
1159
        $event_list_css .= ! empty($event_list_css)
1160
            ? ' '
1161
            : '';
1162
        $event_list_css .= ! empty($this->css_class)
1163
            ? $this->css_class
1164
            : '';
1165
        $event_list_css .= ! empty($event_list_css)
1166
            ? ' '
1167
            : '';
1168
        $event_list_css .= ! empty($this->category_slug)
1169
            ? $this->category_slug
1170
            : '';
1171
        return $event_list_css;
1172
    }
1173
1174
}
1175
1176
1177
/**
1178
 * EE_PUE
1179
 *
1180
 * @package        Event Espresso
1181
 * @subpackage     includes/core/
1182
 * @author         Darren Ethier
1183
 * @deprecated     $VID:$
1184
 */
1185
class EE_PUE implements InterminableInterface
1186
{
1187
1188
1189
    /**
1190
     *    class constructor
1191
     *
1192
     * @deprecated $VID:$
1193
     */
1194
    public function __construct()
1195
    {
1196
        EE_Error::doing_it_wrong(
1197
            __METHOD__,
1198
            sprintf(
1199
                esc_html__('%1$s has been replaced by %2$s.', 'event_espresso'),
1200
                __CLASS__,
1201
                'EventEspresso\core\services\licensing\LicenseServices'
1202
            ),
1203
            '$VID:$'
1204
        );
1205
    }
1206
1207
1208
    /**
1209
     * The purpose of this function is to display information about Event Espresso data collection
1210
     * and a optin selection for extra data collecting by users.
1211
     *
1212
     * @param bool $extra
1213
     * @return string html.
1214
     * @deprecated $VID:$
1215
     */
1216
    public static function espresso_data_collection_optin_text($extra = true)
1217
    {
1218
        EE_Error::doing_it_wrong(
1219
            __METHOD__,
1220
            sprintf(
1221
                esc_html__('%1$s has been replaced by %2$s.', 'event_espresso'),
1222
                __METHOD__,
1223
                'EventEspresso\core\domain\services\Stats::optinText'
1224
            ),
1225
            '$VID:$'
1226
        );
1227
        Stats::optinText($extra);
1228
    }
1229
1230
    /**
1231
     * This is a handy helper method for retrieving whether there is an update available for the given plugin.
1232
     *
1233
     * @param  string $basename Use the equivalent result from plugin_basename() for this param as WP uses that to
1234
     *                          identify plugins. Defaults to core update
1235
     * @return boolean           True if update available, false if not.
1236
     * @deprecated $VID:$
1237
     */
1238
    public static function is_update_available($basename = '')
1239
    {
1240
        EE_Error::doing_it_wrong(
1241
            __METHOD__,
1242
            sprintf(
1243
                esc_html__('%1$s has been replaced by %2$s.', 'event_espresso'),
1244
                __METHOD__,
1245
                'EventEspresso\core\services\licensing\LicenseService::isUpdateAvailable'
1246
            ),
1247
            '$VID:$'
1248
        );
1249
        return LicenseService::isUpdateAvailable($basename);
1250
    }
1251
}