Completed
Branch back-compat-edtr-taxes (752e0e)
by
unknown
12:08 queued 09:43
created
core/services/request/LegacyRequestInterface.php 1 patch
Indentation   +87 added lines, -87 removed lines patch added patch discarded remove patch
@@ -12,125 +12,125 @@
 block discarded – undo
12 12
 interface LegacyRequestInterface
13 13
 {
14 14
 
15
-    /**
16
-     * @return array
17
-     */
18
-    public function get_params();
15
+	/**
16
+	 * @return array
17
+	 */
18
+	public function get_params();
19 19
 
20 20
 
21
-    /**
22
-     * @return array
23
-     */
24
-    public function post_params();
21
+	/**
22
+	 * @return array
23
+	 */
24
+	public function post_params();
25 25
 
26 26
 
27
-    /**
28
-     * @return array
29
-     */
30
-    public function cookie_params();
27
+	/**
28
+	 * @return array
29
+	 */
30
+	public function cookie_params();
31 31
 
32 32
 
33
-    /**
34
-     * @return array
35
-     */
36
-    public function server_params();
33
+	/**
34
+	 * @return array
35
+	 */
36
+	public function server_params();
37 37
 
38 38
 
39
-    /**
40
-     * returns sanitized contents of $_REQUEST
41
-     *
42
-     * @return array
43
-     */
44
-    public function params();
39
+	/**
40
+	 * returns sanitized contents of $_REQUEST
41
+	 *
42
+	 * @return array
43
+	 */
44
+	public function params();
45 45
 
46 46
 
47
-    /**
48
-     * @param      $key
49
-     * @param      $value
50
-     * @param bool $override_ee
51
-     * @return    void
52
-     */
53
-    public function set($key, $value, $override_ee = false);
47
+	/**
48
+	 * @param      $key
49
+	 * @param      $value
50
+	 * @param bool $override_ee
51
+	 * @return    void
52
+	 */
53
+	public function set($key, $value, $override_ee = false);
54 54
 
55 55
 
56
-    /**
57
-     * returns   the value for a request param if the given key exists
58
-     *
59
-     * @param       $key
60
-     * @param null  $default
61
-     * @return mixed
62
-     */
63
-    public function get($key, $default = null);
56
+	/**
57
+	 * returns   the value for a request param if the given key exists
58
+	 *
59
+	 * @param       $key
60
+	 * @param null  $default
61
+	 * @return mixed
62
+	 */
63
+	public function get($key, $default = null);
64 64
 
65 65
 
66
-    /**
67
-     * check if param exists
68
-     *
69
-     * @param       $key
70
-     * @return bool
71
-     */
72
-    public function is_set($key);
66
+	/**
67
+	 * check if param exists
68
+	 *
69
+	 * @param       $key
70
+	 * @return bool
71
+	 */
72
+	public function is_set($key);
73 73
 
74 74
 
75
-    /**
76
-     * remove param
77
-     *
78
-     * @param      $key
79
-     * @param bool $unset_from_global_too
80
-     */
81
-    public function un_set($key, $unset_from_global_too = false);
75
+	/**
76
+	 * remove param
77
+	 *
78
+	 * @param      $key
79
+	 * @param bool $unset_from_global_too
80
+	 */
81
+	public function un_set($key, $unset_from_global_too = false);
82 82
 
83 83
 
84
-    /**
85
-     * @return string
86
-     */
87
-    public function ip_address();
84
+	/**
85
+	 * @return string
86
+	 */
87
+	public function ip_address();
88 88
 
89 89
 
90
-    /**
91
-     * @return bool
92
-     */
93
-    public function isAdmin();
90
+	/**
91
+	 * @return bool
92
+	 */
93
+	public function isAdmin();
94 94
 
95 95
 
96
-    /**
97
-     * @return mixed
98
-     */
99
-    public function isAjax();
96
+	/**
97
+	 * @return mixed
98
+	 */
99
+	public function isAjax();
100 100
 
101 101
 
102
-    /**
103
-     * @return mixed
104
-     */
105
-    public function isFrontAjax();
102
+	/**
103
+	 * @return mixed
104
+	 */
105
+	public function isFrontAjax();
106 106
 
107 107
 
108
-    /**
109
-     * @return mixed|string
110
-     */
111
-    public function requestUri();
108
+	/**
109
+	 * @return mixed|string
110
+	 */
111
+	public function requestUri();
112 112
 
113 113
 
114
-    /**
115
-     * @return string
116
-     */
117
-    public function userAgent();
114
+	/**
115
+	 * @return string
116
+	 */
117
+	public function userAgent();
118 118
 
119 119
 
120
-    /**
121
-     * @param string $user_agent
122
-     */
123
-    public function setUserAgent($user_agent = '');
120
+	/**
121
+	 * @param string $user_agent
122
+	 */
123
+	public function setUserAgent($user_agent = '');
124 124
 
125 125
 
126
-    /**
127
-     * @return bool
128
-     */
129
-    public function isBot();
126
+	/**
127
+	 * @return bool
128
+	 */
129
+	public function isBot();
130 130
 
131 131
 
132
-    /**
133
-     * @param bool $is_bot
134
-     */
135
-    public function setIsBot($is_bot);
132
+	/**
133
+	 * @param bool $is_bot
134
+	 */
135
+	public function setIsBot($is_bot);
136 136
 }
Please login to merge, or discard this patch.
core/services/privacy/policy/PrivacyPolicyManager.php 1 patch
Indentation   +60 added lines, -60 removed lines patch added patch discarded remove patch
@@ -26,71 +26,71 @@
 block discarded – undo
26 26
 class PrivacyPolicyManager
27 27
 {
28 28
 
29
-    public function __construct()
30
-    {
31
-        add_action('current_screen', array($this, 'addPrivacyPolicy'), 9);
32
-    }
29
+	public function __construct()
30
+	{
31
+		add_action('current_screen', array($this, 'addPrivacyPolicy'), 9);
32
+	}
33 33
 
34 34
 
35
-    /**
36
-     * For all the registered `PrivacyPolicyInterface`s, add their privacy policy content
37
-     *
38
-     * @param WP_Screen $screen
39
-     * @throws InvalidClassException
40
-     * @throws InvalidDataTypeException
41
-     * @throws InvalidEntityException
42
-     * @throws InvalidFilePathException
43
-     * @throws InvalidIdentifierException
44
-     * @throws InvalidInterfaceException
45
-     */
46
-    public function addPrivacyPolicy(WP_Screen $screen)
47
-    {
48
-        /** @var RequestInterface $request */
49
-        $request = LoaderFactory::getLoader()->getShared(RequestInterface::class);
35
+	/**
36
+	 * For all the registered `PrivacyPolicyInterface`s, add their privacy policy content
37
+	 *
38
+	 * @param WP_Screen $screen
39
+	 * @throws InvalidClassException
40
+	 * @throws InvalidDataTypeException
41
+	 * @throws InvalidEntityException
42
+	 * @throws InvalidFilePathException
43
+	 * @throws InvalidIdentifierException
44
+	 * @throws InvalidInterfaceException
45
+	 */
46
+	public function addPrivacyPolicy(WP_Screen $screen)
47
+	{
48
+		/** @var RequestInterface $request */
49
+		$request = LoaderFactory::getLoader()->getShared(RequestInterface::class);
50 50
 
51
-        if ($screen->id === 'tools' && $request->requestParamIsSet('wp-privacy-policy-guide')) {
52
-            // load all the privacy policy stuff
53
-            // add post policy text
54
-            foreach ($this->loadPrivacyPolicyCollection() as $privacy_policy) {
55
-                wp_add_privacy_policy_content($privacy_policy->getName(), $privacy_policy->getContent());
56
-            }
57
-        }
58
-    }
51
+		if ($screen->id === 'tools' && $request->requestParamIsSet('wp-privacy-policy-guide')) {
52
+			// load all the privacy policy stuff
53
+			// add post policy text
54
+			foreach ($this->loadPrivacyPolicyCollection() as $privacy_policy) {
55
+				wp_add_privacy_policy_content($privacy_policy->getName(), $privacy_policy->getContent());
56
+			}
57
+		}
58
+	}
59 59
 
60 60
 
61
-    /**
62
-     * @return CollectionInterface|PrivacyPolicyInterface[]
63
-     * @throws InvalidIdentifierException
64
-     * @throws InvalidInterfaceException
65
-     * @throws InvalidFilePathException
66
-     * @throws InvalidEntityException
67
-     * @throws InvalidDataTypeException
68
-     * @throws InvalidClassException
69
-     */
70
-    protected function loadPrivacyPolicyCollection()
71
-    {
72
-        $loader = new CollectionLoader(
73
-            new CollectionDetails(
74
-                // collection name
75
-                'privacy_policies',
76
-                // collection interface
77
-                'EventEspresso\core\services\privacy\policy\PrivacyPolicyInterface',
78
-                // FQCNs for classes to add (all classes within that namespace will be loaded)
79
-                apply_filters(
80
-                    'FHEE__EventEspresso_core_services_privacy_policy_PrivacyPolicyManager__privacy_policies',
81
-                    array('EventEspresso\core\domain\services\admin\privacy\policy\PrivacyPolicy')
82
-                ),
83
-                // filepaths to classes to add
84
-                array(),
85
-                // file mask to use if parsing folder for files to add
86
-                '',
87
-                // what to use as identifier for collection entities
88
-                // using CLASS NAME prevents duplicates (works like a singleton)
89
-                CollectionDetails::ID_CLASS_NAME
90
-            )
91
-        );
92
-        return $loader->getCollection();
93
-    }
61
+	/**
62
+	 * @return CollectionInterface|PrivacyPolicyInterface[]
63
+	 * @throws InvalidIdentifierException
64
+	 * @throws InvalidInterfaceException
65
+	 * @throws InvalidFilePathException
66
+	 * @throws InvalidEntityException
67
+	 * @throws InvalidDataTypeException
68
+	 * @throws InvalidClassException
69
+	 */
70
+	protected function loadPrivacyPolicyCollection()
71
+	{
72
+		$loader = new CollectionLoader(
73
+			new CollectionDetails(
74
+				// collection name
75
+				'privacy_policies',
76
+				// collection interface
77
+				'EventEspresso\core\services\privacy\policy\PrivacyPolicyInterface',
78
+				// FQCNs for classes to add (all classes within that namespace will be loaded)
79
+				apply_filters(
80
+					'FHEE__EventEspresso_core_services_privacy_policy_PrivacyPolicyManager__privacy_policies',
81
+					array('EventEspresso\core\domain\services\admin\privacy\policy\PrivacyPolicy')
82
+				),
83
+				// filepaths to classes to add
84
+				array(),
85
+				// file mask to use if parsing folder for files to add
86
+				'',
87
+				// what to use as identifier for collection entities
88
+				// using CLASS NAME prevents duplicates (works like a singleton)
89
+				CollectionDetails::ID_CLASS_NAME
90
+			)
91
+		);
92
+		return $loader->getCollection();
93
+	}
94 94
 }
95 95
 // End of file PrivacyPolicyManager.php
96 96
 // Location: EventEspresso\core\domain\services\admin/PrivacyPolicyManager.php
Please login to merge, or discard this patch.
libraries/messages/data_class/EE_Messages_Preview_incoming_data.class.php 2 patches
Spacing   +65 added lines, -65 removed lines patch added patch discarded remove patch
@@ -106,72 +106,72 @@  discard block
 block discarded – undo
106 106
         // we'll actually use the generated line_item identifiers for our loop
107 107
         $dtts = $tkts = [];
108 108
         foreach ($events as $id => $event) {
109
-            if (! $event instanceof EE_Event) {
109
+            if ( ! $event instanceof EE_Event) {
110 110
                 continue;
111 111
             }
112
-            $this->_events[ $id ]['ID']       = $id;
113
-            $this->_events[ $id ]['name']     = $event->get('EVT_name');
112
+            $this->_events[$id]['ID']       = $id;
113
+            $this->_events[$id]['name']     = $event->get('EVT_name');
114 114
             $datetime                         = $event->get_first_related('Datetime');
115 115
             $tickets                          = $datetime instanceof EE_Datetime ? $datetime->get_many_related(
116 116
                 'Ticket',
117 117
                 ['default_where_conditions' => 'none']
118 118
             ) : [];
119
-            $this->_events[ $id ]['event']    = $event;
120
-            $this->_events[ $id ]['reg_objs'] = [];
121
-            $this->_events[ $id ]['tkt_objs'] = $tickets;
122
-            $this->_events[ $id ]['dtt_objs'] = [];
119
+            $this->_events[$id]['event']    = $event;
120
+            $this->_events[$id]['reg_objs'] = [];
121
+            $this->_events[$id]['tkt_objs'] = $tickets;
122
+            $this->_events[$id]['dtt_objs'] = [];
123 123
 
124 124
             $dttcache = [];
125 125
             $tkts     = [];
126 126
             foreach ($tickets as $ticket) {
127
-                if (! $ticket instanceof EE_Ticket) {
127
+                if ( ! $ticket instanceof EE_Ticket) {
128 128
                     continue;
129 129
                 }
130 130
                 $reldatetime                       = $ticket->datetimes();
131
-                $tkts[ $ticket->ID() ]             = [];
132
-                $tkts[ $ticket->ID() ]['ticket']   = $ticket;
133
-                $tkts[ $ticket->ID() ]['dtt_objs'] = $reldatetime;
134
-                $tkts[ $ticket->ID() ]['att_objs'] = $attendees;
135
-                $tkts[ $ticket->ID() ]['count']    = count($attendees);
136
-                $tkts[ $ticket->ID() ]['EE_Event'] = $event;
131
+                $tkts[$ticket->ID()]             = [];
132
+                $tkts[$ticket->ID()]['ticket']   = $ticket;
133
+                $tkts[$ticket->ID()]['dtt_objs'] = $reldatetime;
134
+                $tkts[$ticket->ID()]['att_objs'] = $attendees;
135
+                $tkts[$ticket->ID()]['count']    = count($attendees);
136
+                $tkts[$ticket->ID()]['EE_Event'] = $event;
137 137
                 foreach ($reldatetime as $datetime) {
138
-                    if ($datetime instanceof EE_Datetime && ! isset($dtts[ $datetime->ID() ])) {
139
-                        $this->_events[ $id ]['dtt_objs'][ $datetime->ID() ] = $datetime;
140
-                        $dtts[ $datetime->ID() ]['datetime']                 = $datetime;
141
-                        $dtts[ $datetime->ID() ]['tkt_objs'][]               = $ticket;
142
-                        $dtts[ $datetime->ID() ]['evt_objs'][]               = $event;
143
-                        $dttcache[ $datetime->ID() ]                         = $datetime;
138
+                    if ($datetime instanceof EE_Datetime && ! isset($dtts[$datetime->ID()])) {
139
+                        $this->_events[$id]['dtt_objs'][$datetime->ID()] = $datetime;
140
+                        $dtts[$datetime->ID()]['datetime']                 = $datetime;
141
+                        $dtts[$datetime->ID()]['tkt_objs'][]               = $ticket;
142
+                        $dtts[$datetime->ID()]['evt_objs'][]               = $event;
143
+                        $dttcache[$datetime->ID()]                         = $datetime;
144 144
                     }
145 145
                 }
146 146
             }
147 147
 
148
-            $this->_events[ $id ]['total_attendees'] = count($attendees);
149
-            $this->_events[ $id ]['att_objs']        = $attendees;
148
+            $this->_events[$id]['total_attendees'] = count($attendees);
149
+            $this->_events[$id]['att_objs']        = $attendees;
150 150
 
151 151
             // let's also setup the dummy attendees property!
152 152
             foreach ($attendees as $att_key => $attendee) {
153
-                if (! $attendee instanceof EE_Attendee) {
153
+                if ( ! $attendee instanceof EE_Attendee) {
154 154
                     continue;
155 155
                 }
156
-                $this->_attendees[ $att_key ]['line_ref'][] =
157
-                    $id;  // so later it can be determined what events this attendee registered for!
158
-                $this->_attendees[ $att_key ]['evt_objs'][] = $event;
159
-                $this->_attendees[ $att_key ]['att_obj']    = $attendee;
156
+                $this->_attendees[$att_key]['line_ref'][] =
157
+                    $id; // so later it can be determined what events this attendee registered for!
158
+                $this->_attendees[$att_key]['evt_objs'][] = $event;
159
+                $this->_attendees[$att_key]['att_obj']    = $attendee;
160 160
                 // $this->_attendees[$att_key]['registration_id'] = 0;
161
-                $this->_attendees[ $att_key ]['attendee_email'] = $attendee->email();
162
-                $this->_attendees[ $att_key ]['tkt_objs']       = $tickets;
161
+                $this->_attendees[$att_key]['attendee_email'] = $attendee->email();
162
+                $this->_attendees[$att_key]['tkt_objs']       = $tickets;
163 163
                 if ($att_key == 999999991) {
164
-                    $this->_attendees[ $att_key ]['ans_objs'][999]  = $answers_n_questions['answers'][999];
165
-                    $this->_attendees[ $att_key ]['ans_objs'][1002] = $answers_n_questions['answers'][1002];
166
-                    $this->_attendees[ $att_key ]['ans_objs'][1005] = $answers_n_questions['answers'][1005];
164
+                    $this->_attendees[$att_key]['ans_objs'][999]  = $answers_n_questions['answers'][999];
165
+                    $this->_attendees[$att_key]['ans_objs'][1002] = $answers_n_questions['answers'][1002];
166
+                    $this->_attendees[$att_key]['ans_objs'][1005] = $answers_n_questions['answers'][1005];
167 167
                 } elseif ($att_key == 999999992) {
168
-                    $this->_attendees[ $att_key ]['ans_objs'][1000] = $answers_n_questions['answers'][1000];
169
-                    $this->_attendees[ $att_key ]['ans_objs'][1003] = $answers_n_questions['answers'][1003];
170
-                    $this->_attendees[ $att_key ]['ans_objs'][1006] = $answers_n_questions['answers'][1006];
168
+                    $this->_attendees[$att_key]['ans_objs'][1000] = $answers_n_questions['answers'][1000];
169
+                    $this->_attendees[$att_key]['ans_objs'][1003] = $answers_n_questions['answers'][1003];
170
+                    $this->_attendees[$att_key]['ans_objs'][1006] = $answers_n_questions['answers'][1006];
171 171
                 } elseif ($att_key == 999999993) {
172
-                    $this->_attendees[ $att_key ]['ans_objs'][1001] = $answers_n_questions['answers'][1001];
173
-                    $this->_attendees[ $att_key ]['ans_objs'][1004] = $answers_n_questions['answers'][1004];
174
-                    $this->_attendees[ $att_key ]['ans_objs'][1007] = $answers_n_questions['answers'][1007];
172
+                    $this->_attendees[$att_key]['ans_objs'][1001] = $answers_n_questions['answers'][1001];
173
+                    $this->_attendees[$att_key]['ans_objs'][1004] = $answers_n_questions['answers'][1004];
174
+                    $this->_attendees[$att_key]['ans_objs'][1007] = $answers_n_questions['answers'][1007];
175 175
                 }
176 176
             }
177 177
         }
@@ -272,7 +272,7 @@  discard block
 block discarded – undo
272 272
             /** @var $email string */
273 273
             /** @var $phone string */
274 274
             /** @var $attid string */
275
-            $attendees[ $attid ] = EE_Attendee::new_instance(
275
+            $attendees[$attid] = EE_Attendee::new_instance(
276 276
                 [
277 277
                     'ATT_fname'    => $fname,
278 278
                     'ATT_lname'    => $lname,
@@ -379,7 +379,7 @@  discard block
 block discarded – undo
379 379
         // first the questions
380 380
         foreach ($quests_array as $qst) {
381 381
             $qstobj                    = array_combine($qst_columns, $qst);
382
-            $qsts[ $qstobj['QST_ID'] ] = EE_Question::new_instance($qstobj);
382
+            $qsts[$qstobj['QST_ID']] = EE_Question::new_instance($qstobj);
383 383
         }
384 384
 
385 385
         // now the answers (and we'll setup our arrays)
@@ -387,8 +387,8 @@  discard block
 block discarded – undo
387 387
         foreach ($ans_array as $ans) {
388 388
             $ansobj                               = array_combine($ans_columns, $ans);
389 389
             $ansobj                               = EE_Answer::new_instance($ansobj);
390
-            $q_n_as['answers'][ $ansobj->ID() ]   = $ansobj;
391
-            $q_n_as['questions'][ $ansobj->ID() ] = $qsts[ $ansobj->get('QST_ID') ];
390
+            $q_n_as['answers'][$ansobj->ID()]   = $ansobj;
391
+            $q_n_as['questions'][$ansobj->ID()] = $qsts[$ansobj->get('QST_ID')];
392 392
         }
393 393
 
394 394
         return $q_n_as;
@@ -471,11 +471,11 @@  discard block
 block discarded – undo
471 471
             $regtxn = $this->txn->ID();
472 472
             $regcnt = 1;
473 473
             foreach ($attendee['line_ref'] as $evtid) {
474
-                foreach ($this->_events[ $evtid ]['tkt_objs'] as $ticket) {
475
-                    if (! $ticket instanceof EE_Ticket) {
474
+                foreach ($this->_events[$evtid]['tkt_objs'] as $ticket) {
475
+                    if ( ! $ticket instanceof EE_Ticket) {
476 476
                         continue;
477 477
                     }
478
-                    $reg_array                                            = [
478
+                    $reg_array = [
479 479
                         'EVT_ID'           => $evtid,
480 480
                         'ATT_ID'           => $regatt,
481 481
                         'TXN_ID'           => $regtxn,
@@ -484,18 +484,18 @@  discard block
 block discarded – undo
484 484
                         'REG_date'         => time(),
485 485
                         'REG_final_price'  => $ticket->get('TKT_price'),
486 486
                         'REG_session'      => 'dummy_session_id',
487
-                        'REG_code'         => $regid . '-dummy-generated-code',
488
-                        'REG_url_link'     => $regcnt . '-daafpapasdlfakasdfpqasdfasdf',
487
+                        'REG_code'         => $regid.'-dummy-generated-code',
488
+                        'REG_url_link'     => $regcnt.'-daafpapasdlfakasdfpqasdfasdf',
489 489
                         'REG_count'        => $regcnt,
490
-                        'REG_group_size'   => $this->_events[ $evtid ]['total_attendees'],
490
+                        'REG_group_size'   => $this->_events[$evtid]['total_attendees'],
491 491
                         'REG_att_is_going' => true,
492 492
                         'REG_ID'           => $regid,
493 493
                     ];
494 494
                     $REG_OBJ                                              = EE_Registration::new_instance($reg_array);
495
-                    $this->_attendees[ $key ]['reg_objs'][ $regid ]       = $REG_OBJ;
496
-                    $this->_events[ $evtid ]['reg_objs'][]                = $REG_OBJ;
495
+                    $this->_attendees[$key]['reg_objs'][$regid]       = $REG_OBJ;
496
+                    $this->_events[$evtid]['reg_objs'][]                = $REG_OBJ;
497 497
                     $this->reg_objs[]                                     = $REG_OBJ;
498
-                    $this->tickets[ $ticket->ID() ]['reg_objs'][ $regid ] = $REG_OBJ;
498
+                    $this->tickets[$ticket->ID()]['reg_objs'][$regid] = $REG_OBJ;
499 499
 
500 500
                     $regcnt++;
501 501
                     $regid++;
@@ -537,19 +537,19 @@  discard block
 block discarded – undo
537 537
         $event_line_items = EEH_Line_Item::get_pre_tax_subtotal($line_item_total)->children();
538 538
         $line_items       = [];
539 539
         foreach ($event_line_items as $line_item) {
540
-            if (! $line_item instanceof EE_Line_Item || $line_item->OBJ_type() !== 'Event') {
540
+            if ( ! $line_item instanceof EE_Line_Item || $line_item->OBJ_type() !== 'Event') {
541 541
                 continue;
542 542
             }
543 543
             $ticket_line_items = EEH_Line_Item::get_ticket_line_items($line_item);
544 544
             foreach ($ticket_line_items as $ticket_line_item) {
545
-                if (! $ticket_line_item instanceof EE_Line_Item) {
545
+                if ( ! $ticket_line_item instanceof EE_Line_Item) {
546 546
                     continue;
547 547
                 }
548
-                $this->tickets[ $ticket_line_item->OBJ_ID() ]['line_item']      = $ticket_line_item;
549
-                $this->tickets[ $ticket_line_item->OBJ_ID() ]['sub_line_items'] = $ticket_line_item->children();
550
-                $line_items[ $ticket_line_item->ID() ]['children']              = $ticket_line_item->children();
551
-                $line_items[ $ticket_line_item->ID() ]['EE_Ticket']             =
552
-                    $this->tickets[ $ticket_line_item->OBJ_ID() ]['ticket'];
548
+                $this->tickets[$ticket_line_item->OBJ_ID()]['line_item']      = $ticket_line_item;
549
+                $this->tickets[$ticket_line_item->OBJ_ID()]['sub_line_items'] = $ticket_line_item->children();
550
+                $line_items[$ticket_line_item->ID()]['children']              = $ticket_line_item->children();
551
+                $line_items[$ticket_line_item->ID()]['EE_Ticket']             =
552
+                    $this->tickets[$ticket_line_item->OBJ_ID()]['ticket'];
553 553
             }
554 554
         }
555 555
 
@@ -564,15 +564,15 @@  discard block
 block discarded – undo
564 564
 
565 565
         // add additional details for each registration
566 566
         foreach ($this->reg_objs as $reg) {
567
-            if (! $reg instanceof EE_Registration) {
567
+            if ( ! $reg instanceof EE_Registration) {
568 568
                 continue;
569 569
             }
570
-            $this->_registrations[ $reg->ID() ]['tkt_obj']  = $this->tickets[ $reg->get('TKT_ID') ]['ticket'];
571
-            $this->_registrations[ $reg->ID() ]['evt_obj']  = $this->_events[ $reg->get('EVT_ID') ]['event'];
572
-            $this->_registrations[ $reg->ID() ]['reg_obj']  = $reg;
573
-            $this->_registrations[ $reg->ID() ]['ans_objs'] = $this->_attendees[ $reg->get('ATT_ID') ]['ans_objs'];
574
-            $this->_registrations[ $reg->ID() ]['att_obj']  = $this->_attendees[ $reg->get('ATT_ID') ]['att_obj'];
575
-            $this->_registrations[ $reg->ID() ]['dtt_objs'] = $this->tickets[ $reg->get('TKT_ID') ]['dtt_objs'];
570
+            $this->_registrations[$reg->ID()]['tkt_obj']  = $this->tickets[$reg->get('TKT_ID')]['ticket'];
571
+            $this->_registrations[$reg->ID()]['evt_obj']  = $this->_events[$reg->get('EVT_ID')]['event'];
572
+            $this->_registrations[$reg->ID()]['reg_obj']  = $reg;
573
+            $this->_registrations[$reg->ID()]['ans_objs'] = $this->_attendees[$reg->get('ATT_ID')]['ans_objs'];
574
+            $this->_registrations[$reg->ID()]['att_obj']  = $this->_attendees[$reg->get('ATT_ID')]['att_obj'];
575
+            $this->_registrations[$reg->ID()]['dtt_objs'] = $this->tickets[$reg->get('TKT_ID')]['dtt_objs'];
576 576
         }
577 577
 
578 578
 
Please login to merge, or discard this patch.
Indentation   +599 added lines, -599 removed lines patch added patch discarded remove patch
@@ -21,603 +21,603 @@
 block discarded – undo
21 21
 class EE_Messages_Preview_incoming_data extends EE_Messages_incoming_data
22 22
 {
23 23
 
24
-    // some specific properties we need for this class
25
-    private $_events        = [];
26
-
27
-    private $_attendees     = [];
28
-
29
-    private $_registrations = [];
30
-
31
-
32
-    /**
33
-     * For the constructor of this special preview class.  We're either looking for an event id or empty data.  If we
34
-     * have an event id (or ids) then we'll use that as the source for the "dummy" data.  If the data is empty then
35
-     * we'll get the first three published events from the users database and use that as a source.
36
-     *
37
-     * @param array $data
38
-     * @throws EE_Error
39
-     * @throws EE_Error
40
-     * @throws ReflectionException
41
-     */
42
-    public function __construct($data = [])
43
-    {
44
-        $this->_data = isset($data['event_ids']) ? $data['event_ids'] : [];
45
-        $this->_setup_attendees_events();
46
-        parent::__construct($data);
47
-    }
48
-
49
-
50
-    /**
51
-     * Returns database safe representation of the data later used to when instantiating this object.
52
-     *
53
-     * @param array $data The incoming data to be prepped.
54
-     *
55
-     * @return array   The prepped data for db
56
-     */
57
-    public static function convert_data_for_persistent_storage($data)
58
-    {
59
-        return $data;
60
-    }
61
-
62
-
63
-    /**
64
-     * Data that has been stored in persistent storage that was prepped by _convert_data_for_persistent_storage
65
-     * can be sent into this method and converted back into the format used for instantiating with this data handler.
66
-     *
67
-     * @param array $data
68
-     *
69
-     * @return array
70
-     */
71
-    public static function convert_data_from_persistent_storage($data)
72
-    {
73
-        return $data;
74
-    }
75
-
76
-
77
-    /**
78
-     * This will just setup the _events property in the expected format.
79
-     *
80
-     * @throws EE_Error
81
-     * @throws ReflectionException
82
-     */
83
-    private function _setup_attendees_events()
84
-    {
85
-
86
-        // setup some attendee objects
87
-        $attendees = $this->_get_some_attendees();
88
-
89
-        // if empty $data we'll do a query to get some events from the server.
90
-        // otherwise we'll retrieve the event data for the given ids.
91
-        $events = $this->_get_some_events($this->_data);
92
-
93
-        $answers_n_questions = $this->_get_some_q_and_as();
94
-
95
-        if (count($events) < 1) {
96
-            throw new EE_Error(
97
-                esc_html__(
98
-                    'We can\'t generate a preview for you because there are no active events in your database',
99
-                    'event_espresso'
100
-                )
101
-            );
102
-        }
103
-
104
-
105
-        // now let's loop and set up the _events property.  At the same time we'll set up attendee properties.
106
-        // we'll actually use the generated line_item identifiers for our loop
107
-        $dtts = $tkts = [];
108
-        foreach ($events as $id => $event) {
109
-            if (! $event instanceof EE_Event) {
110
-                continue;
111
-            }
112
-            $this->_events[ $id ]['ID']       = $id;
113
-            $this->_events[ $id ]['name']     = $event->get('EVT_name');
114
-            $datetime                         = $event->get_first_related('Datetime');
115
-            $tickets                          = $datetime instanceof EE_Datetime ? $datetime->get_many_related(
116
-                'Ticket',
117
-                ['default_where_conditions' => 'none']
118
-            ) : [];
119
-            $this->_events[ $id ]['event']    = $event;
120
-            $this->_events[ $id ]['reg_objs'] = [];
121
-            $this->_events[ $id ]['tkt_objs'] = $tickets;
122
-            $this->_events[ $id ]['dtt_objs'] = [];
123
-
124
-            $dttcache = [];
125
-            $tkts     = [];
126
-            foreach ($tickets as $ticket) {
127
-                if (! $ticket instanceof EE_Ticket) {
128
-                    continue;
129
-                }
130
-                $reldatetime                       = $ticket->datetimes();
131
-                $tkts[ $ticket->ID() ]             = [];
132
-                $tkts[ $ticket->ID() ]['ticket']   = $ticket;
133
-                $tkts[ $ticket->ID() ]['dtt_objs'] = $reldatetime;
134
-                $tkts[ $ticket->ID() ]['att_objs'] = $attendees;
135
-                $tkts[ $ticket->ID() ]['count']    = count($attendees);
136
-                $tkts[ $ticket->ID() ]['EE_Event'] = $event;
137
-                foreach ($reldatetime as $datetime) {
138
-                    if ($datetime instanceof EE_Datetime && ! isset($dtts[ $datetime->ID() ])) {
139
-                        $this->_events[ $id ]['dtt_objs'][ $datetime->ID() ] = $datetime;
140
-                        $dtts[ $datetime->ID() ]['datetime']                 = $datetime;
141
-                        $dtts[ $datetime->ID() ]['tkt_objs'][]               = $ticket;
142
-                        $dtts[ $datetime->ID() ]['evt_objs'][]               = $event;
143
-                        $dttcache[ $datetime->ID() ]                         = $datetime;
144
-                    }
145
-                }
146
-            }
147
-
148
-            $this->_events[ $id ]['total_attendees'] = count($attendees);
149
-            $this->_events[ $id ]['att_objs']        = $attendees;
150
-
151
-            // let's also setup the dummy attendees property!
152
-            foreach ($attendees as $att_key => $attendee) {
153
-                if (! $attendee instanceof EE_Attendee) {
154
-                    continue;
155
-                }
156
-                $this->_attendees[ $att_key ]['line_ref'][] =
157
-                    $id;  // so later it can be determined what events this attendee registered for!
158
-                $this->_attendees[ $att_key ]['evt_objs'][] = $event;
159
-                $this->_attendees[ $att_key ]['att_obj']    = $attendee;
160
-                // $this->_attendees[$att_key]['registration_id'] = 0;
161
-                $this->_attendees[ $att_key ]['attendee_email'] = $attendee->email();
162
-                $this->_attendees[ $att_key ]['tkt_objs']       = $tickets;
163
-                if ($att_key == 999999991) {
164
-                    $this->_attendees[ $att_key ]['ans_objs'][999]  = $answers_n_questions['answers'][999];
165
-                    $this->_attendees[ $att_key ]['ans_objs'][1002] = $answers_n_questions['answers'][1002];
166
-                    $this->_attendees[ $att_key ]['ans_objs'][1005] = $answers_n_questions['answers'][1005];
167
-                } elseif ($att_key == 999999992) {
168
-                    $this->_attendees[ $att_key ]['ans_objs'][1000] = $answers_n_questions['answers'][1000];
169
-                    $this->_attendees[ $att_key ]['ans_objs'][1003] = $answers_n_questions['answers'][1003];
170
-                    $this->_attendees[ $att_key ]['ans_objs'][1006] = $answers_n_questions['answers'][1006];
171
-                } elseif ($att_key == 999999993) {
172
-                    $this->_attendees[ $att_key ]['ans_objs'][1001] = $answers_n_questions['answers'][1001];
173
-                    $this->_attendees[ $att_key ]['ans_objs'][1004] = $answers_n_questions['answers'][1004];
174
-                    $this->_attendees[ $att_key ]['ans_objs'][1007] = $answers_n_questions['answers'][1007];
175
-                }
176
-            }
177
-        }
178
-
179
-        $this->tickets            = $tkts;
180
-        $this->datetimes          = $dtts;
181
-        $this->answers            = $answers_n_questions['answers'];
182
-        $this->questions          = $answers_n_questions['questions'];
183
-        $this->total_ticket_count = count($tkts) * count($this->_attendees);
184
-    }
185
-
186
-
187
-    /**
188
-     * This just returns an array of dummy attendee objects that we'll use to attach to events for our preview data
189
-     *
190
-     * @access private
191
-     * @return array an array of attendee objects
192
-     * @throws EE_Error
193
-     * @throws EE_Error
194
-     */
195
-    private function _get_some_attendees()
196
-    {
197
-        // let's just setup a dummy array of various attendee details
198
-        $dummy_attendees = [
199
-            0 => [
200
-                'Luke',
201
-                'Skywalker',
202
-                '[email protected]',
203
-                '804 Bantha Dr.',
204
-                'Complex 8',
205
-                'Mos Eisley',
206
-                32,
207
-                'US',
208
-                'f0r3e',
209
-                '222-333-4763',
210
-                false,
211
-                '999999991',
212
-            ],
213
-            1 => [
214
-                'Princess',
215
-                'Leia',
216
-                '[email protected]',
217
-                '1456 Valley Way Boulevard',
218
-                'Suite 9',
219
-                'Alderaan',
220
-                15,
221
-                'US',
222
-                'c1h2c',
223
-                '78-123-111-1111',
224
-                false,
225
-                '999999992',
226
-            ],
227
-            2 => [
228
-                'Yoda',
229
-                'I Am',
230
-                '[email protected]',
231
-                '4th Tree',
232
-                '5th Knot',
233
-                'Marsh',
234
-                22,
235
-                'US',
236
-                'l18n',
237
-                '999-999-9999',
238
-                false,
239
-                '999999993',
240
-            ],
241
-        ];
242
-
243
-        // let's generate the attendee objects
244
-        $attendees = [];
245
-        $var_array = [
246
-            'fname',
247
-            'lname',
248
-            'email',
249
-            'address',
250
-            'address2',
251
-            'city',
252
-            'staid',
253
-            'cntry',
254
-            'zip',
255
-            'phone',
256
-            'deleted',
257
-            'attid',
258
-        ];
259
-
260
-        // EE_Registry::instance()->load_class( 'Attendee', array(), FALSE, false, TRUE );
261
-        foreach ($dummy_attendees as $dummy) {
262
-            $att = array_combine($var_array, $dummy);
263
-            extract($att);
264
-            /** @var $fname string */
265
-            /** @var $lname string */
266
-            /** @var $address string */
267
-            /** @var $address2 string */
268
-            /** @var $city string */
269
-            /** @var $staid string */
270
-            /** @var $cntry string */
271
-            /** @var $zip string */
272
-            /** @var $email string */
273
-            /** @var $phone string */
274
-            /** @var $attid string */
275
-            $attendees[ $attid ] = EE_Attendee::new_instance(
276
-                [
277
-                    'ATT_fname'    => $fname,
278
-                    'ATT_lname'    => $lname,
279
-                    'ATT_address'  => $address,
280
-                    'ATT_address2' => $address2,
281
-                    'ATT_city'     => $city,
282
-                    'STA_ID'       => $staid,
283
-                    'CNT_ISO'      => $cntry,
284
-                    'ATT_zip'      => $zip,
285
-                    'ATT_email'    => $email,
286
-                    'ATT_phone'    => $phone,
287
-                    'ATT_ID'       => $attid,
288
-                ]
289
-            );
290
-        }
291
-
292
-        return $attendees;
293
-    }
294
-
295
-
296
-    /**
297
-     * Return an array of dummy question objects indexed by answer id and dummy answer objects indexed by answer id.
298
-     * This will be used in our dummy data setup
299
-     *
300
-     * @return array
301
-     * @throws EE_Error
302
-     * @throws ReflectionException
303
-     */
304
-    private function _get_some_q_and_as()
305
-    {
306
-        $quests_array = [
307
-            0 => [
308
-                555,
309
-                esc_html__('What is your favorite planet?', 'event_espresso'),
310
-                0,
311
-            ],
312
-            1 => [
313
-                556,
314
-                esc_html__('What is your favorite food?', 'event_espresso'),
315
-                0,
316
-            ],
317
-            2 => [
318
-                557,
319
-                esc_html__('How many lightyears have you travelled', 'event_espresso'),
320
-                0,
321
-            ],
322
-        ];
323
-
324
-        $ans_array = [
325
-            0 => [
326
-                999,
327
-                555,
328
-                'Tattoine',
329
-            ],
330
-            1 => [
331
-                1000,
332
-                555,
333
-                'Alderaan',
334
-            ],
335
-            2 => [
336
-                1001,
337
-                555,
338
-                'Dantooine',
339
-            ],
340
-            3 => [
341
-                1002,
342
-                556,
343
-                'Fish Fingers',
344
-            ],
345
-            4 => [
346
-                1003,
347
-                556,
348
-                'Sushi',
349
-            ],
350
-            5 => [
351
-                1004,
352
-                556,
353
-                'Water',
354
-            ],
355
-            6 => [
356
-                1005,
357
-                557,
358
-                'A lot',
359
-            ],
360
-            7 => [
361
-                1006,
362
-                557,
363
-                "That's none of your business.",
364
-            ],
365
-            8 => [
366
-                1007,
367
-                557,
368
-                "People less travel me then.",
369
-            ],
370
-        ];
371
-
372
-        $qst_columns = ['QST_ID', 'QST_display_text', 'QST_system'];
373
-        $ans_columns = ['ANS_ID', 'QST_ID', 'ANS_value'];
374
-
375
-        // EE_Registry::instance()->load_class( 'Question', array(), FALSE, TRUE, TRUE );
376
-        // EE_Registry::instance()->load_class( 'Answer', array(), FALSE, TRUE, TRUE );
377
-
378
-        $qsts = [];
379
-        // first the questions
380
-        foreach ($quests_array as $qst) {
381
-            $qstobj                    = array_combine($qst_columns, $qst);
382
-            $qsts[ $qstobj['QST_ID'] ] = EE_Question::new_instance($qstobj);
383
-        }
384
-
385
-        // now the answers (and we'll setup our arrays)
386
-        $q_n_as = [];
387
-        foreach ($ans_array as $ans) {
388
-            $ansobj                               = array_combine($ans_columns, $ans);
389
-            $ansobj                               = EE_Answer::new_instance($ansobj);
390
-            $q_n_as['answers'][ $ansobj->ID() ]   = $ansobj;
391
-            $q_n_as['questions'][ $ansobj->ID() ] = $qsts[ $ansobj->get('QST_ID') ];
392
-        }
393
-
394
-        return $q_n_as;
395
-    }
396
-
397
-
398
-    /**
399
-     * Return an array of event objects from the database
400
-     *
401
-     * If event ids are not included then we'll just retrieve the first published event from the database.
402
-     *
403
-     * @param array $event_ids if set, this will be an array of event ids to obtain events for.
404
-     *
405
-     * @return array    An array of event objects from the db.
406
-     * @throws EE_Error
407
-     */
408
-    private function _get_some_events(array $event_ids = [])
409
-    {
410
-        /** @var RequestInterface $request */
411
-        $request = LoaderFactory::getLoader()->getShared(RequestInterface::class);
412
-        // if we have an evt_id then we want to make sure we use that for the preview
413
-        // (because a specific event template is being viewed);
414
-        $event_ids = $request->getRequestParam('evt_id', $event_ids, 'int', true);
415
-        $limit     = ! empty($event_ids)
416
-            ? null
417
-            : apply_filters('FHEE__EE_Messages_Preview_incoming_data___get_some_events__limit', '0,1');
418
-
419
-        $where = ! empty($event_ids)
420
-            ? [
421
-                'EVT_ID'                 => ['IN', $event_ids],
422
-                'Datetime.Ticket.TKT_ID' => ['>', 1],
423
-            ]
424
-            : ['Datetime.Ticket.TKT_ID' => ['>', 1]];
425
-
426
-        return EEM_Event::instance()->get_all([$where, 'limit' => $limit]);
427
-    }
428
-
429
-
430
-    /**
431
-     * @throws EE_Error
432
-     * @throws ReflectionException
433
-     */
434
-    protected function _setup_data()
435
-    {
436
-        // need to figure out the running total for test purposes so... we're going to create a temp cart and add the tickets to it!
437
-        if (EE_Registry::instance()->SSN instanceof EE_Session) {
438
-            EE_Registry::instance()->SSN->clear_session(__CLASS__, __FUNCTION__);
439
-            $session = EE_Registry::instance()->SSN;
440
-        } else {
441
-            $session = EE_Registry::instance()->load_core('Session');
442
-        }
443
-        $cart = EE_Cart::instance(null, $session);
444
-
445
-        // add tickets to cart
446
-        foreach ($this->tickets as $ticket) {
447
-            $cart->add_ticket_to_cart($ticket['ticket']);
448
-        }
449
-
450
-        // setup txn property
451
-        $this->txn = EE_Transaction::new_instance(
452
-            [
453
-                'TXN_timestamp'    => time(), // unix timestamp
454
-                'TXN_total'        => 0, // txn_total
455
-                'TXN_paid'         => 0, // txn_paid
456
-                'STS_ID'           => EEM_Transaction::incomplete_status_code, // sts_id
457
-                'TXN_session_data' => null, // dump of txn session object (we're just going to leave blank here)
458
-                'TXN_hash_salt'    => null, // hash salt blank as well
459
-                'TXN_ID'           => 999999,
460
-            ]
461
-        );
462
-
463
-
464
-        // setup reg_objects
465
-        // note we're setting up a reg object for each attendee in each event but ALSO adding to the reg_object array.
466
-        $this->reg_objs = [];
467
-        $regid          = 9999990;
468
-        foreach ($this->_attendees as $key => $attendee) {
469
-            // note we need to setup reg_objects for each event this attendee belongs to
470
-            $regatt = $attendee['att_obj'] instanceof EE_Attendee ? $attendee['att_obj']->ID() : null;
471
-            $regtxn = $this->txn->ID();
472
-            $regcnt = 1;
473
-            foreach ($attendee['line_ref'] as $evtid) {
474
-                foreach ($this->_events[ $evtid ]['tkt_objs'] as $ticket) {
475
-                    if (! $ticket instanceof EE_Ticket) {
476
-                        continue;
477
-                    }
478
-                    $reg_array                                            = [
479
-                        'EVT_ID'           => $evtid,
480
-                        'ATT_ID'           => $regatt,
481
-                        'TXN_ID'           => $regtxn,
482
-                        'TKT_ID'           => $ticket->ID(),
483
-                        'STS_ID'           => EEM_Registration::status_id_pending_payment,
484
-                        'REG_date'         => time(),
485
-                        'REG_final_price'  => $ticket->get('TKT_price'),
486
-                        'REG_session'      => 'dummy_session_id',
487
-                        'REG_code'         => $regid . '-dummy-generated-code',
488
-                        'REG_url_link'     => $regcnt . '-daafpapasdlfakasdfpqasdfasdf',
489
-                        'REG_count'        => $regcnt,
490
-                        'REG_group_size'   => $this->_events[ $evtid ]['total_attendees'],
491
-                        'REG_att_is_going' => true,
492
-                        'REG_ID'           => $regid,
493
-                    ];
494
-                    $REG_OBJ                                              = EE_Registration::new_instance($reg_array);
495
-                    $this->_attendees[ $key ]['reg_objs'][ $regid ]       = $REG_OBJ;
496
-                    $this->_events[ $evtid ]['reg_objs'][]                = $REG_OBJ;
497
-                    $this->reg_objs[]                                     = $REG_OBJ;
498
-                    $this->tickets[ $ticket->ID() ]['reg_objs'][ $regid ] = $REG_OBJ;
499
-
500
-                    $regcnt++;
501
-                    $regid++;
502
-                }
503
-            }
504
-        }
505
-
506
-
507
-        // setup line items!
508
-        $line_item_total = EEH_Line_Item::create_total_line_item($this->txn);
509
-
510
-        // add tickets
511
-        foreach ($this->tickets as $item) {
512
-            $qty    = $item['count'];
513
-            $ticket = $item['ticket'];
514
-            EEH_Line_Item::add_ticket_purchase($line_item_total, $ticket, $qty);
515
-        }
516
-
517
-        $shipping_line_item = EE_Line_Item::new_instance(
518
-            [
519
-                'LIN_name'       => esc_html__(
520
-                    'Shipping Surcharge',
521
-                    'event_espresso'
522
-                ),
523
-                'LIN_desc'       => esc_html__(
524
-                    'Sent via Millenium Falcon',
525
-                    'event_espresso'
526
-                ),
527
-                'LIN_unit_price' => 20,
528
-                'LIN_quantity'   => 1,
529
-                'LIN_is_taxable' => true,
530
-                'LIN_total'      => 20,
531
-                'LIN_type'       => EEM_Line_Item::type_line_item,
532
-            ]
533
-        );
534
-        EEH_Line_Item::add_item($line_item_total, $shipping_line_item);
535
-        $this->additional_line_items = [$shipping_line_item];
536
-
537
-        // now let's add taxes
538
-        EEH_Line_Item::apply_taxes($line_item_total);
539
-
540
-        // now we should be able to get the items we need from this object
541
-        $event_line_items = EEH_Line_Item::get_pre_tax_subtotal($line_item_total)->children();
542
-        $line_items       = [];
543
-        foreach ($event_line_items as $line_item) {
544
-            if (! $line_item instanceof EE_Line_Item || $line_item->OBJ_type() !== 'Event') {
545
-                continue;
546
-            }
547
-            $ticket_line_items = EEH_Line_Item::get_ticket_line_items($line_item);
548
-            foreach ($ticket_line_items as $ticket_line_item) {
549
-                if (! $ticket_line_item instanceof EE_Line_Item) {
550
-                    continue;
551
-                }
552
-                $this->tickets[ $ticket_line_item->OBJ_ID() ]['line_item']      = $ticket_line_item;
553
-                $this->tickets[ $ticket_line_item->OBJ_ID() ]['sub_line_items'] = $ticket_line_item->children();
554
-                $line_items[ $ticket_line_item->ID() ]['children']              = $ticket_line_item->children();
555
-                $line_items[ $ticket_line_item->ID() ]['EE_Ticket']             =
556
-                    $this->tickets[ $ticket_line_item->OBJ_ID() ]['ticket'];
557
-            }
558
-        }
559
-
560
-        $this->line_items_with_children = $line_items;
561
-        $this->tax_line_items           = $line_item_total->tax_descendants();
562
-
563
-        // add proper total to transaction object.
564
-        $grand_total                 = $line_item_total->recalculate_total_including_taxes();
565
-        $this->grand_total_line_item = $line_item_total;
566
-        $this->txn->set_total($grand_total);
567
-
568
-
569
-        // add additional details for each registration
570
-        foreach ($this->reg_objs as $reg) {
571
-            if (! $reg instanceof EE_Registration) {
572
-                continue;
573
-            }
574
-            $this->_registrations[ $reg->ID() ]['tkt_obj']  = $this->tickets[ $reg->get('TKT_ID') ]['ticket'];
575
-            $this->_registrations[ $reg->ID() ]['evt_obj']  = $this->_events[ $reg->get('EVT_ID') ]['event'];
576
-            $this->_registrations[ $reg->ID() ]['reg_obj']  = $reg;
577
-            $this->_registrations[ $reg->ID() ]['ans_objs'] = $this->_attendees[ $reg->get('ATT_ID') ]['ans_objs'];
578
-            $this->_registrations[ $reg->ID() ]['att_obj']  = $this->_attendees[ $reg->get('ATT_ID') ]['att_obj'];
579
-            $this->_registrations[ $reg->ID() ]['dtt_objs'] = $this->tickets[ $reg->get('TKT_ID') ]['dtt_objs'];
580
-        }
581
-
582
-
583
-        // events and attendees
584
-        $this->events        = $this->_events;
585
-        $this->attendees     = $this->_attendees;
586
-        $this->registrations = $this->_registrations;
587
-
588
-        $attendees_to_shift = $this->_attendees;
589
-
590
-        // setup primary attendee property
591
-        $this->primary_attendee_data = [
592
-            'fname' => $this->_attendees[999999991]['att_obj'] instanceof EE_Attendee
593
-                ? $this->_attendees[999999991]['att_obj']->fname()
594
-                : '',
595
-
596
-            'lname' => $this->_attendees[999999991]['att_obj'] instanceof EE_Attendee
597
-                ? $this->_attendees[999999991]['att_obj']->lname()
598
-                : '',
599
-
600
-            'email' => $this->_attendees[999999991]['att_obj'] instanceof EE_Attendee
601
-                ? $this->_attendees[999999991]['att_obj']->email()
602
-                : '',
603
-
604
-            'att_obj' => $this->_attendees[999999991]['att_obj'],
605
-
606
-            'reg_obj' => array_shift($attendees_to_shift[999999991]['reg_objs']),
607
-        ];
608
-
609
-        // reg_info property
610
-        // note this isn't referenced by any shortcode parsers so we'll ignore for now.
611
-        $this->reg_info = [];
612
-
613
-        // let's set a reg_obj for messengers expecting one.
614
-        $this->reg_obj = array_shift($this->_attendees[999999991]['reg_objs']);
615
-
616
-        // the below are just dummy items.
617
-        $this->user_id     = 1;
618
-        $this->ip_address  = '192.0.2.1';
619
-        $this->user_agent  = '';
620
-        $this->init_access = time();
621
-        $this->last_access = time();
622
-    }
24
+	// some specific properties we need for this class
25
+	private $_events        = [];
26
+
27
+	private $_attendees     = [];
28
+
29
+	private $_registrations = [];
30
+
31
+
32
+	/**
33
+	 * For the constructor of this special preview class.  We're either looking for an event id or empty data.  If we
34
+	 * have an event id (or ids) then we'll use that as the source for the "dummy" data.  If the data is empty then
35
+	 * we'll get the first three published events from the users database and use that as a source.
36
+	 *
37
+	 * @param array $data
38
+	 * @throws EE_Error
39
+	 * @throws EE_Error
40
+	 * @throws ReflectionException
41
+	 */
42
+	public function __construct($data = [])
43
+	{
44
+		$this->_data = isset($data['event_ids']) ? $data['event_ids'] : [];
45
+		$this->_setup_attendees_events();
46
+		parent::__construct($data);
47
+	}
48
+
49
+
50
+	/**
51
+	 * Returns database safe representation of the data later used to when instantiating this object.
52
+	 *
53
+	 * @param array $data The incoming data to be prepped.
54
+	 *
55
+	 * @return array   The prepped data for db
56
+	 */
57
+	public static function convert_data_for_persistent_storage($data)
58
+	{
59
+		return $data;
60
+	}
61
+
62
+
63
+	/**
64
+	 * Data that has been stored in persistent storage that was prepped by _convert_data_for_persistent_storage
65
+	 * can be sent into this method and converted back into the format used for instantiating with this data handler.
66
+	 *
67
+	 * @param array $data
68
+	 *
69
+	 * @return array
70
+	 */
71
+	public static function convert_data_from_persistent_storage($data)
72
+	{
73
+		return $data;
74
+	}
75
+
76
+
77
+	/**
78
+	 * This will just setup the _events property in the expected format.
79
+	 *
80
+	 * @throws EE_Error
81
+	 * @throws ReflectionException
82
+	 */
83
+	private function _setup_attendees_events()
84
+	{
85
+
86
+		// setup some attendee objects
87
+		$attendees = $this->_get_some_attendees();
88
+
89
+		// if empty $data we'll do a query to get some events from the server.
90
+		// otherwise we'll retrieve the event data for the given ids.
91
+		$events = $this->_get_some_events($this->_data);
92
+
93
+		$answers_n_questions = $this->_get_some_q_and_as();
94
+
95
+		if (count($events) < 1) {
96
+			throw new EE_Error(
97
+				esc_html__(
98
+					'We can\'t generate a preview for you because there are no active events in your database',
99
+					'event_espresso'
100
+				)
101
+			);
102
+		}
103
+
104
+
105
+		// now let's loop and set up the _events property.  At the same time we'll set up attendee properties.
106
+		// we'll actually use the generated line_item identifiers for our loop
107
+		$dtts = $tkts = [];
108
+		foreach ($events as $id => $event) {
109
+			if (! $event instanceof EE_Event) {
110
+				continue;
111
+			}
112
+			$this->_events[ $id ]['ID']       = $id;
113
+			$this->_events[ $id ]['name']     = $event->get('EVT_name');
114
+			$datetime                         = $event->get_first_related('Datetime');
115
+			$tickets                          = $datetime instanceof EE_Datetime ? $datetime->get_many_related(
116
+				'Ticket',
117
+				['default_where_conditions' => 'none']
118
+			) : [];
119
+			$this->_events[ $id ]['event']    = $event;
120
+			$this->_events[ $id ]['reg_objs'] = [];
121
+			$this->_events[ $id ]['tkt_objs'] = $tickets;
122
+			$this->_events[ $id ]['dtt_objs'] = [];
123
+
124
+			$dttcache = [];
125
+			$tkts     = [];
126
+			foreach ($tickets as $ticket) {
127
+				if (! $ticket instanceof EE_Ticket) {
128
+					continue;
129
+				}
130
+				$reldatetime                       = $ticket->datetimes();
131
+				$tkts[ $ticket->ID() ]             = [];
132
+				$tkts[ $ticket->ID() ]['ticket']   = $ticket;
133
+				$tkts[ $ticket->ID() ]['dtt_objs'] = $reldatetime;
134
+				$tkts[ $ticket->ID() ]['att_objs'] = $attendees;
135
+				$tkts[ $ticket->ID() ]['count']    = count($attendees);
136
+				$tkts[ $ticket->ID() ]['EE_Event'] = $event;
137
+				foreach ($reldatetime as $datetime) {
138
+					if ($datetime instanceof EE_Datetime && ! isset($dtts[ $datetime->ID() ])) {
139
+						$this->_events[ $id ]['dtt_objs'][ $datetime->ID() ] = $datetime;
140
+						$dtts[ $datetime->ID() ]['datetime']                 = $datetime;
141
+						$dtts[ $datetime->ID() ]['tkt_objs'][]               = $ticket;
142
+						$dtts[ $datetime->ID() ]['evt_objs'][]               = $event;
143
+						$dttcache[ $datetime->ID() ]                         = $datetime;
144
+					}
145
+				}
146
+			}
147
+
148
+			$this->_events[ $id ]['total_attendees'] = count($attendees);
149
+			$this->_events[ $id ]['att_objs']        = $attendees;
150
+
151
+			// let's also setup the dummy attendees property!
152
+			foreach ($attendees as $att_key => $attendee) {
153
+				if (! $attendee instanceof EE_Attendee) {
154
+					continue;
155
+				}
156
+				$this->_attendees[ $att_key ]['line_ref'][] =
157
+					$id;  // so later it can be determined what events this attendee registered for!
158
+				$this->_attendees[ $att_key ]['evt_objs'][] = $event;
159
+				$this->_attendees[ $att_key ]['att_obj']    = $attendee;
160
+				// $this->_attendees[$att_key]['registration_id'] = 0;
161
+				$this->_attendees[ $att_key ]['attendee_email'] = $attendee->email();
162
+				$this->_attendees[ $att_key ]['tkt_objs']       = $tickets;
163
+				if ($att_key == 999999991) {
164
+					$this->_attendees[ $att_key ]['ans_objs'][999]  = $answers_n_questions['answers'][999];
165
+					$this->_attendees[ $att_key ]['ans_objs'][1002] = $answers_n_questions['answers'][1002];
166
+					$this->_attendees[ $att_key ]['ans_objs'][1005] = $answers_n_questions['answers'][1005];
167
+				} elseif ($att_key == 999999992) {
168
+					$this->_attendees[ $att_key ]['ans_objs'][1000] = $answers_n_questions['answers'][1000];
169
+					$this->_attendees[ $att_key ]['ans_objs'][1003] = $answers_n_questions['answers'][1003];
170
+					$this->_attendees[ $att_key ]['ans_objs'][1006] = $answers_n_questions['answers'][1006];
171
+				} elseif ($att_key == 999999993) {
172
+					$this->_attendees[ $att_key ]['ans_objs'][1001] = $answers_n_questions['answers'][1001];
173
+					$this->_attendees[ $att_key ]['ans_objs'][1004] = $answers_n_questions['answers'][1004];
174
+					$this->_attendees[ $att_key ]['ans_objs'][1007] = $answers_n_questions['answers'][1007];
175
+				}
176
+			}
177
+		}
178
+
179
+		$this->tickets            = $tkts;
180
+		$this->datetimes          = $dtts;
181
+		$this->answers            = $answers_n_questions['answers'];
182
+		$this->questions          = $answers_n_questions['questions'];
183
+		$this->total_ticket_count = count($tkts) * count($this->_attendees);
184
+	}
185
+
186
+
187
+	/**
188
+	 * This just returns an array of dummy attendee objects that we'll use to attach to events for our preview data
189
+	 *
190
+	 * @access private
191
+	 * @return array an array of attendee objects
192
+	 * @throws EE_Error
193
+	 * @throws EE_Error
194
+	 */
195
+	private function _get_some_attendees()
196
+	{
197
+		// let's just setup a dummy array of various attendee details
198
+		$dummy_attendees = [
199
+			0 => [
200
+				'Luke',
201
+				'Skywalker',
202
+				'[email protected]',
203
+				'804 Bantha Dr.',
204
+				'Complex 8',
205
+				'Mos Eisley',
206
+				32,
207
+				'US',
208
+				'f0r3e',
209
+				'222-333-4763',
210
+				false,
211
+				'999999991',
212
+			],
213
+			1 => [
214
+				'Princess',
215
+				'Leia',
216
+				'[email protected]',
217
+				'1456 Valley Way Boulevard',
218
+				'Suite 9',
219
+				'Alderaan',
220
+				15,
221
+				'US',
222
+				'c1h2c',
223
+				'78-123-111-1111',
224
+				false,
225
+				'999999992',
226
+			],
227
+			2 => [
228
+				'Yoda',
229
+				'I Am',
230
+				'[email protected]',
231
+				'4th Tree',
232
+				'5th Knot',
233
+				'Marsh',
234
+				22,
235
+				'US',
236
+				'l18n',
237
+				'999-999-9999',
238
+				false,
239
+				'999999993',
240
+			],
241
+		];
242
+
243
+		// let's generate the attendee objects
244
+		$attendees = [];
245
+		$var_array = [
246
+			'fname',
247
+			'lname',
248
+			'email',
249
+			'address',
250
+			'address2',
251
+			'city',
252
+			'staid',
253
+			'cntry',
254
+			'zip',
255
+			'phone',
256
+			'deleted',
257
+			'attid',
258
+		];
259
+
260
+		// EE_Registry::instance()->load_class( 'Attendee', array(), FALSE, false, TRUE );
261
+		foreach ($dummy_attendees as $dummy) {
262
+			$att = array_combine($var_array, $dummy);
263
+			extract($att);
264
+			/** @var $fname string */
265
+			/** @var $lname string */
266
+			/** @var $address string */
267
+			/** @var $address2 string */
268
+			/** @var $city string */
269
+			/** @var $staid string */
270
+			/** @var $cntry string */
271
+			/** @var $zip string */
272
+			/** @var $email string */
273
+			/** @var $phone string */
274
+			/** @var $attid string */
275
+			$attendees[ $attid ] = EE_Attendee::new_instance(
276
+				[
277
+					'ATT_fname'    => $fname,
278
+					'ATT_lname'    => $lname,
279
+					'ATT_address'  => $address,
280
+					'ATT_address2' => $address2,
281
+					'ATT_city'     => $city,
282
+					'STA_ID'       => $staid,
283
+					'CNT_ISO'      => $cntry,
284
+					'ATT_zip'      => $zip,
285
+					'ATT_email'    => $email,
286
+					'ATT_phone'    => $phone,
287
+					'ATT_ID'       => $attid,
288
+				]
289
+			);
290
+		}
291
+
292
+		return $attendees;
293
+	}
294
+
295
+
296
+	/**
297
+	 * Return an array of dummy question objects indexed by answer id and dummy answer objects indexed by answer id.
298
+	 * This will be used in our dummy data setup
299
+	 *
300
+	 * @return array
301
+	 * @throws EE_Error
302
+	 * @throws ReflectionException
303
+	 */
304
+	private function _get_some_q_and_as()
305
+	{
306
+		$quests_array = [
307
+			0 => [
308
+				555,
309
+				esc_html__('What is your favorite planet?', 'event_espresso'),
310
+				0,
311
+			],
312
+			1 => [
313
+				556,
314
+				esc_html__('What is your favorite food?', 'event_espresso'),
315
+				0,
316
+			],
317
+			2 => [
318
+				557,
319
+				esc_html__('How many lightyears have you travelled', 'event_espresso'),
320
+				0,
321
+			],
322
+		];
323
+
324
+		$ans_array = [
325
+			0 => [
326
+				999,
327
+				555,
328
+				'Tattoine',
329
+			],
330
+			1 => [
331
+				1000,
332
+				555,
333
+				'Alderaan',
334
+			],
335
+			2 => [
336
+				1001,
337
+				555,
338
+				'Dantooine',
339
+			],
340
+			3 => [
341
+				1002,
342
+				556,
343
+				'Fish Fingers',
344
+			],
345
+			4 => [
346
+				1003,
347
+				556,
348
+				'Sushi',
349
+			],
350
+			5 => [
351
+				1004,
352
+				556,
353
+				'Water',
354
+			],
355
+			6 => [
356
+				1005,
357
+				557,
358
+				'A lot',
359
+			],
360
+			7 => [
361
+				1006,
362
+				557,
363
+				"That's none of your business.",
364
+			],
365
+			8 => [
366
+				1007,
367
+				557,
368
+				"People less travel me then.",
369
+			],
370
+		];
371
+
372
+		$qst_columns = ['QST_ID', 'QST_display_text', 'QST_system'];
373
+		$ans_columns = ['ANS_ID', 'QST_ID', 'ANS_value'];
374
+
375
+		// EE_Registry::instance()->load_class( 'Question', array(), FALSE, TRUE, TRUE );
376
+		// EE_Registry::instance()->load_class( 'Answer', array(), FALSE, TRUE, TRUE );
377
+
378
+		$qsts = [];
379
+		// first the questions
380
+		foreach ($quests_array as $qst) {
381
+			$qstobj                    = array_combine($qst_columns, $qst);
382
+			$qsts[ $qstobj['QST_ID'] ] = EE_Question::new_instance($qstobj);
383
+		}
384
+
385
+		// now the answers (and we'll setup our arrays)
386
+		$q_n_as = [];
387
+		foreach ($ans_array as $ans) {
388
+			$ansobj                               = array_combine($ans_columns, $ans);
389
+			$ansobj                               = EE_Answer::new_instance($ansobj);
390
+			$q_n_as['answers'][ $ansobj->ID() ]   = $ansobj;
391
+			$q_n_as['questions'][ $ansobj->ID() ] = $qsts[ $ansobj->get('QST_ID') ];
392
+		}
393
+
394
+		return $q_n_as;
395
+	}
396
+
397
+
398
+	/**
399
+	 * Return an array of event objects from the database
400
+	 *
401
+	 * If event ids are not included then we'll just retrieve the first published event from the database.
402
+	 *
403
+	 * @param array $event_ids if set, this will be an array of event ids to obtain events for.
404
+	 *
405
+	 * @return array    An array of event objects from the db.
406
+	 * @throws EE_Error
407
+	 */
408
+	private function _get_some_events(array $event_ids = [])
409
+	{
410
+		/** @var RequestInterface $request */
411
+		$request = LoaderFactory::getLoader()->getShared(RequestInterface::class);
412
+		// if we have an evt_id then we want to make sure we use that for the preview
413
+		// (because a specific event template is being viewed);
414
+		$event_ids = $request->getRequestParam('evt_id', $event_ids, 'int', true);
415
+		$limit     = ! empty($event_ids)
416
+			? null
417
+			: apply_filters('FHEE__EE_Messages_Preview_incoming_data___get_some_events__limit', '0,1');
418
+
419
+		$where = ! empty($event_ids)
420
+			? [
421
+				'EVT_ID'                 => ['IN', $event_ids],
422
+				'Datetime.Ticket.TKT_ID' => ['>', 1],
423
+			]
424
+			: ['Datetime.Ticket.TKT_ID' => ['>', 1]];
425
+
426
+		return EEM_Event::instance()->get_all([$where, 'limit' => $limit]);
427
+	}
428
+
429
+
430
+	/**
431
+	 * @throws EE_Error
432
+	 * @throws ReflectionException
433
+	 */
434
+	protected function _setup_data()
435
+	{
436
+		// need to figure out the running total for test purposes so... we're going to create a temp cart and add the tickets to it!
437
+		if (EE_Registry::instance()->SSN instanceof EE_Session) {
438
+			EE_Registry::instance()->SSN->clear_session(__CLASS__, __FUNCTION__);
439
+			$session = EE_Registry::instance()->SSN;
440
+		} else {
441
+			$session = EE_Registry::instance()->load_core('Session');
442
+		}
443
+		$cart = EE_Cart::instance(null, $session);
444
+
445
+		// add tickets to cart
446
+		foreach ($this->tickets as $ticket) {
447
+			$cart->add_ticket_to_cart($ticket['ticket']);
448
+		}
449
+
450
+		// setup txn property
451
+		$this->txn = EE_Transaction::new_instance(
452
+			[
453
+				'TXN_timestamp'    => time(), // unix timestamp
454
+				'TXN_total'        => 0, // txn_total
455
+				'TXN_paid'         => 0, // txn_paid
456
+				'STS_ID'           => EEM_Transaction::incomplete_status_code, // sts_id
457
+				'TXN_session_data' => null, // dump of txn session object (we're just going to leave blank here)
458
+				'TXN_hash_salt'    => null, // hash salt blank as well
459
+				'TXN_ID'           => 999999,
460
+			]
461
+		);
462
+
463
+
464
+		// setup reg_objects
465
+		// note we're setting up a reg object for each attendee in each event but ALSO adding to the reg_object array.
466
+		$this->reg_objs = [];
467
+		$regid          = 9999990;
468
+		foreach ($this->_attendees as $key => $attendee) {
469
+			// note we need to setup reg_objects for each event this attendee belongs to
470
+			$regatt = $attendee['att_obj'] instanceof EE_Attendee ? $attendee['att_obj']->ID() : null;
471
+			$regtxn = $this->txn->ID();
472
+			$regcnt = 1;
473
+			foreach ($attendee['line_ref'] as $evtid) {
474
+				foreach ($this->_events[ $evtid ]['tkt_objs'] as $ticket) {
475
+					if (! $ticket instanceof EE_Ticket) {
476
+						continue;
477
+					}
478
+					$reg_array                                            = [
479
+						'EVT_ID'           => $evtid,
480
+						'ATT_ID'           => $regatt,
481
+						'TXN_ID'           => $regtxn,
482
+						'TKT_ID'           => $ticket->ID(),
483
+						'STS_ID'           => EEM_Registration::status_id_pending_payment,
484
+						'REG_date'         => time(),
485
+						'REG_final_price'  => $ticket->get('TKT_price'),
486
+						'REG_session'      => 'dummy_session_id',
487
+						'REG_code'         => $regid . '-dummy-generated-code',
488
+						'REG_url_link'     => $regcnt . '-daafpapasdlfakasdfpqasdfasdf',
489
+						'REG_count'        => $regcnt,
490
+						'REG_group_size'   => $this->_events[ $evtid ]['total_attendees'],
491
+						'REG_att_is_going' => true,
492
+						'REG_ID'           => $regid,
493
+					];
494
+					$REG_OBJ                                              = EE_Registration::new_instance($reg_array);
495
+					$this->_attendees[ $key ]['reg_objs'][ $regid ]       = $REG_OBJ;
496
+					$this->_events[ $evtid ]['reg_objs'][]                = $REG_OBJ;
497
+					$this->reg_objs[]                                     = $REG_OBJ;
498
+					$this->tickets[ $ticket->ID() ]['reg_objs'][ $regid ] = $REG_OBJ;
499
+
500
+					$regcnt++;
501
+					$regid++;
502
+				}
503
+			}
504
+		}
505
+
506
+
507
+		// setup line items!
508
+		$line_item_total = EEH_Line_Item::create_total_line_item($this->txn);
509
+
510
+		// add tickets
511
+		foreach ($this->tickets as $item) {
512
+			$qty    = $item['count'];
513
+			$ticket = $item['ticket'];
514
+			EEH_Line_Item::add_ticket_purchase($line_item_total, $ticket, $qty);
515
+		}
516
+
517
+		$shipping_line_item = EE_Line_Item::new_instance(
518
+			[
519
+				'LIN_name'       => esc_html__(
520
+					'Shipping Surcharge',
521
+					'event_espresso'
522
+				),
523
+				'LIN_desc'       => esc_html__(
524
+					'Sent via Millenium Falcon',
525
+					'event_espresso'
526
+				),
527
+				'LIN_unit_price' => 20,
528
+				'LIN_quantity'   => 1,
529
+				'LIN_is_taxable' => true,
530
+				'LIN_total'      => 20,
531
+				'LIN_type'       => EEM_Line_Item::type_line_item,
532
+			]
533
+		);
534
+		EEH_Line_Item::add_item($line_item_total, $shipping_line_item);
535
+		$this->additional_line_items = [$shipping_line_item];
536
+
537
+		// now let's add taxes
538
+		EEH_Line_Item::apply_taxes($line_item_total);
539
+
540
+		// now we should be able to get the items we need from this object
541
+		$event_line_items = EEH_Line_Item::get_pre_tax_subtotal($line_item_total)->children();
542
+		$line_items       = [];
543
+		foreach ($event_line_items as $line_item) {
544
+			if (! $line_item instanceof EE_Line_Item || $line_item->OBJ_type() !== 'Event') {
545
+				continue;
546
+			}
547
+			$ticket_line_items = EEH_Line_Item::get_ticket_line_items($line_item);
548
+			foreach ($ticket_line_items as $ticket_line_item) {
549
+				if (! $ticket_line_item instanceof EE_Line_Item) {
550
+					continue;
551
+				}
552
+				$this->tickets[ $ticket_line_item->OBJ_ID() ]['line_item']      = $ticket_line_item;
553
+				$this->tickets[ $ticket_line_item->OBJ_ID() ]['sub_line_items'] = $ticket_line_item->children();
554
+				$line_items[ $ticket_line_item->ID() ]['children']              = $ticket_line_item->children();
555
+				$line_items[ $ticket_line_item->ID() ]['EE_Ticket']             =
556
+					$this->tickets[ $ticket_line_item->OBJ_ID() ]['ticket'];
557
+			}
558
+		}
559
+
560
+		$this->line_items_with_children = $line_items;
561
+		$this->tax_line_items           = $line_item_total->tax_descendants();
562
+
563
+		// add proper total to transaction object.
564
+		$grand_total                 = $line_item_total->recalculate_total_including_taxes();
565
+		$this->grand_total_line_item = $line_item_total;
566
+		$this->txn->set_total($grand_total);
567
+
568
+
569
+		// add additional details for each registration
570
+		foreach ($this->reg_objs as $reg) {
571
+			if (! $reg instanceof EE_Registration) {
572
+				continue;
573
+			}
574
+			$this->_registrations[ $reg->ID() ]['tkt_obj']  = $this->tickets[ $reg->get('TKT_ID') ]['ticket'];
575
+			$this->_registrations[ $reg->ID() ]['evt_obj']  = $this->_events[ $reg->get('EVT_ID') ]['event'];
576
+			$this->_registrations[ $reg->ID() ]['reg_obj']  = $reg;
577
+			$this->_registrations[ $reg->ID() ]['ans_objs'] = $this->_attendees[ $reg->get('ATT_ID') ]['ans_objs'];
578
+			$this->_registrations[ $reg->ID() ]['att_obj']  = $this->_attendees[ $reg->get('ATT_ID') ]['att_obj'];
579
+			$this->_registrations[ $reg->ID() ]['dtt_objs'] = $this->tickets[ $reg->get('TKT_ID') ]['dtt_objs'];
580
+		}
581
+
582
+
583
+		// events and attendees
584
+		$this->events        = $this->_events;
585
+		$this->attendees     = $this->_attendees;
586
+		$this->registrations = $this->_registrations;
587
+
588
+		$attendees_to_shift = $this->_attendees;
589
+
590
+		// setup primary attendee property
591
+		$this->primary_attendee_data = [
592
+			'fname' => $this->_attendees[999999991]['att_obj'] instanceof EE_Attendee
593
+				? $this->_attendees[999999991]['att_obj']->fname()
594
+				: '',
595
+
596
+			'lname' => $this->_attendees[999999991]['att_obj'] instanceof EE_Attendee
597
+				? $this->_attendees[999999991]['att_obj']->lname()
598
+				: '',
599
+
600
+			'email' => $this->_attendees[999999991]['att_obj'] instanceof EE_Attendee
601
+				? $this->_attendees[999999991]['att_obj']->email()
602
+				: '',
603
+
604
+			'att_obj' => $this->_attendees[999999991]['att_obj'],
605
+
606
+			'reg_obj' => array_shift($attendees_to_shift[999999991]['reg_objs']),
607
+		];
608
+
609
+		// reg_info property
610
+		// note this isn't referenced by any shortcode parsers so we'll ignore for now.
611
+		$this->reg_info = [];
612
+
613
+		// let's set a reg_obj for messengers expecting one.
614
+		$this->reg_obj = array_shift($this->_attendees[999999991]['reg_objs']);
615
+
616
+		// the below are just dummy items.
617
+		$this->user_id     = 1;
618
+		$this->ip_address  = '192.0.2.1';
619
+		$this->user_agent  = '';
620
+		$this->init_access = time();
621
+		$this->last_access = time();
622
+	}
623 623
 }
Please login to merge, or discard this patch.
core/libraries/payment_methods/EE_Offsite_Gateway.lib.php 1 patch
Indentation   +102 added lines, -102 removed lines patch added patch discarded remove patch
@@ -15,117 +15,117 @@
 block discarded – undo
15 15
 abstract class EE_Offsite_Gateway extends EE_Gateway
16 16
 {
17 17
 
18
-    /**
19
-     * whether or not the gateway uses an IPN
20
-     * that is sent in a separate request than the returning registrant.
21
-     * if false, then we need to process the payment results manually
22
-     * as soon as the registrant returns from the off-site gateway
23
-     *
24
-     * @type bool
25
-     */
26
-    protected $_uses_separate_IPN_request = false;
18
+	/**
19
+	 * whether or not the gateway uses an IPN
20
+	 * that is sent in a separate request than the returning registrant.
21
+	 * if false, then we need to process the payment results manually
22
+	 * as soon as the registrant returns from the off-site gateway
23
+	 *
24
+	 * @type bool
25
+	 */
26
+	protected $_uses_separate_IPN_request = false;
27 27
 
28 28
 
29
-    /**
30
-     * @return EE_Offsite_Gateway
31
-     */
32
-    public function __construct()
33
-    {
34
-        $this->_supports_receiving_refunds = true;
35
-        parent::__construct();
36
-    }
29
+	/**
30
+	 * @return EE_Offsite_Gateway
31
+	 */
32
+	public function __construct()
33
+	{
34
+		$this->_supports_receiving_refunds = true;
35
+		parent::__construct();
36
+	}
37 37
 
38 38
 
39
-    /**
40
-     * Adds information into the payment object's redirect_url and redirect_args so
41
-     * client code can use that payment to know where (and with what information)
42
-     * to redirect the user to in order to make the payment on the offsite gateway's website.
43
-     * Saving the payment from within this method is unnecessary,
44
-     * as it is the responsibility of client code to save it.
45
-     *
46
-     * @param EE_Payment $payment    to process
47
-     * @param array      $billing_info
48
-     * @param string     $return_url URL to send the user to after a successful payment on the payment provider's
49
-     *                               website
50
-     * @param string     $notify_url URL to send the instant payment notification
51
-     * @param string     $cancel_url URL to send the user to after a cancelled payment attempt on teh payment
52
-     *                               provider's website
53
-     * @return EE_Payment
54
-     */
55
-    abstract public function set_redirection_info(
56
-        $payment,
57
-        $billing_info = array(),
58
-        $return_url = null,
59
-        $notify_url = null,
60
-        $cancel_url = null
61
-    );
39
+	/**
40
+	 * Adds information into the payment object's redirect_url and redirect_args so
41
+	 * client code can use that payment to know where (and with what information)
42
+	 * to redirect the user to in order to make the payment on the offsite gateway's website.
43
+	 * Saving the payment from within this method is unnecessary,
44
+	 * as it is the responsibility of client code to save it.
45
+	 *
46
+	 * @param EE_Payment $payment    to process
47
+	 * @param array      $billing_info
48
+	 * @param string     $return_url URL to send the user to after a successful payment on the payment provider's
49
+	 *                               website
50
+	 * @param string     $notify_url URL to send the instant payment notification
51
+	 * @param string     $cancel_url URL to send the user to after a cancelled payment attempt on teh payment
52
+	 *                               provider's website
53
+	 * @return EE_Payment
54
+	 */
55
+	abstract public function set_redirection_info(
56
+		$payment,
57
+		$billing_info = array(),
58
+		$return_url = null,
59
+		$notify_url = null,
60
+		$cancel_url = null
61
+	);
62 62
 
63 63
 
64
-    /**
65
-     * Often used for IPNs. But applies the info in $update_info to the payment.
66
-     * What is $update_info? Often the contents of request, but not necessarily. Whatever
67
-     * the payment method passes in. Saving the payment from within this method is unnecessary,
68
-     * as it is the responsibility of client code to save it.
69
-     *
70
-     * @param array           $update_info of whatever
71
-     * @param EEI_Transaction $transaction
72
-     * @return EEI_Payment updated
73
-     */
74
-    abstract public function handle_payment_update($update_info, $transaction);
64
+	/**
65
+	 * Often used for IPNs. But applies the info in $update_info to the payment.
66
+	 * What is $update_info? Often the contents of request, but not necessarily. Whatever
67
+	 * the payment method passes in. Saving the payment from within this method is unnecessary,
68
+	 * as it is the responsibility of client code to save it.
69
+	 *
70
+	 * @param array           $update_info of whatever
71
+	 * @param EEI_Transaction $transaction
72
+	 * @return EEI_Payment updated
73
+	 */
74
+	abstract public function handle_payment_update($update_info, $transaction);
75 75
 
76 76
 
77
-    /**
78
-     * uses_separate_IPN_request
79
-     *
80
-     * return true or false for whether or not the gateway uses an IPN
81
-     * that is sent in a separate request than the returning registrant.
82
-     * if false, then we need to process the payment results manually
83
-     * as soon as the registrant returns from the off-site gateway
84
-     *
85
-     * @deprecated since version 4.8.39.rc.001 please use handle_IPN_in_this_request() instead
86
-     *
87
-     * @return bool
88
-     */
89
-    public function uses_separate_IPN_request()
90
-    {
91
-        return $this->_uses_separate_IPN_request;
92
-    }
77
+	/**
78
+	 * uses_separate_IPN_request
79
+	 *
80
+	 * return true or false for whether or not the gateway uses an IPN
81
+	 * that is sent in a separate request than the returning registrant.
82
+	 * if false, then we need to process the payment results manually
83
+	 * as soon as the registrant returns from the off-site gateway
84
+	 *
85
+	 * @deprecated since version 4.8.39.rc.001 please use handle_IPN_in_this_request() instead
86
+	 *
87
+	 * @return bool
88
+	 */
89
+	public function uses_separate_IPN_request()
90
+	{
91
+		return $this->_uses_separate_IPN_request;
92
+	}
93 93
 
94 94
 
95
-    /**
96
-     * set_uses_separate_IPN_request
97
-     *
98
-     * @access protected
99
-     * @param boolean $uses_separate_IPN_request
100
-     */
101
-    protected function set_uses_separate_IPN_request($uses_separate_IPN_request)
102
-    {
103
-        $this->_uses_separate_IPN_request = filter_var($uses_separate_IPN_request, FILTER_VALIDATE_BOOLEAN);
104
-    }
95
+	/**
96
+	 * set_uses_separate_IPN_request
97
+	 *
98
+	 * @access protected
99
+	 * @param boolean $uses_separate_IPN_request
100
+	 */
101
+	protected function set_uses_separate_IPN_request($uses_separate_IPN_request)
102
+	{
103
+		$this->_uses_separate_IPN_request = filter_var($uses_separate_IPN_request, FILTER_VALIDATE_BOOLEAN);
104
+	}
105 105
 
106
-    /**
107
-     * Allows gateway to dynamically decide whether or not to handle a payment update
108
-     * by overriding this method. By default, if this is a "true" IPN (meaning
109
-     * it's a separate request from when the user returns from the offsite gateway)
110
-     * and this gateway class is setup to handle IPNs in separate "true" IPNs, then
111
-     * this will return true, otherwise it will return false.
112
-     * If however, this is a request when the user is returning
113
-     * from an offsite gateway, and this gateway class is setup to process the payment
114
-     * data when the user returns, then this will return true.
115
-     *
116
-     * @param array   $request_data
117
-     * @param boolean $separate_IPN_request
118
-     * @return boolean
119
-     */
120
-    public function handle_IPN_in_this_request($request_data, $separate_IPN_request)
121
-    {
122
-        if ($separate_IPN_request) {
123
-            // payment data being sent in a request separate from the user
124
-            // it is this other request that will update the TXN and payment info
125
-            return $this->_uses_separate_IPN_request;
126
-        } else {
127
-            // it's a request where the user returned from an offsite gateway WITH the payment data
128
-            return ! $this->_uses_separate_IPN_request;
129
-        }
130
-    }
106
+	/**
107
+	 * Allows gateway to dynamically decide whether or not to handle a payment update
108
+	 * by overriding this method. By default, if this is a "true" IPN (meaning
109
+	 * it's a separate request from when the user returns from the offsite gateway)
110
+	 * and this gateway class is setup to handle IPNs in separate "true" IPNs, then
111
+	 * this will return true, otherwise it will return false.
112
+	 * If however, this is a request when the user is returning
113
+	 * from an offsite gateway, and this gateway class is setup to process the payment
114
+	 * data when the user returns, then this will return true.
115
+	 *
116
+	 * @param array   $request_data
117
+	 * @param boolean $separate_IPN_request
118
+	 * @return boolean
119
+	 */
120
+	public function handle_IPN_in_this_request($request_data, $separate_IPN_request)
121
+	{
122
+		if ($separate_IPN_request) {
123
+			// payment data being sent in a request separate from the user
124
+			// it is this other request that will update the TXN and payment info
125
+			return $this->_uses_separate_IPN_request;
126
+		} else {
127
+			// it's a request where the user returned from an offsite gateway WITH the payment data
128
+			return ! $this->_uses_separate_IPN_request;
129
+		}
130
+	}
131 131
 }
Please login to merge, or discard this patch.
core/libraries/form_sections/inputs/EE_Fixed_Hidden_Input.input.php 1 patch
Indentation   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -10,15 +10,15 @@
 block discarded – undo
10 10
 {
11 11
 
12 12
 
13
-    /**
14
-     * Fixed Inputs are inputs that do NOT accept user input
15
-     * therefore they will ALWAYS return the default value that was set upon their creation
16
-     * and NO normalization or sanitization will occur because the request value is being ignored
17
-     *
18
-     * @param array $req_data
19
-     * @return boolean whether or not there was an error
20
-     */
21
-    protected function _normalize($req_data)
22
-    {
23
-    }
13
+	/**
14
+	 * Fixed Inputs are inputs that do NOT accept user input
15
+	 * therefore they will ALWAYS return the default value that was set upon their creation
16
+	 * and NO normalization or sanitization will occur because the request value is being ignored
17
+	 *
18
+	 * @param array $req_data
19
+	 * @return boolean whether or not there was an error
20
+	 */
21
+	protected function _normalize($req_data)
22
+	{
23
+	}
24 24
 }
Please login to merge, or discard this patch.
core/request_stack/EE_Request.core.php 1 patch
Indentation   +355 added lines, -355 removed lines patch added patch discarded remove patch
@@ -18,359 +18,359 @@
 block discarded – undo
18 18
 class EE_Request implements LegacyRequestInterface, InterminableInterface
19 19
 {
20 20
 
21
-    /**
22
-     * @var RequestInterface $request
23
-     */
24
-    private $request;
25
-
26
-    /**
27
-     * whether current request is for the admin but NOT via AJAX
28
-     *
29
-     * @var boolean $admin
30
-     */
31
-    public $admin = false;
32
-
33
-    /**
34
-     * whether current request is via AJAX
35
-     *
36
-     * @var boolean $ajax
37
-     */
38
-    public $ajax = false;
39
-
40
-    /**
41
-     * whether current request is via AJAX from the frontend of the site
42
-     *
43
-     * @var boolean $front_ajax
44
-     */
45
-    public $front_ajax = false;
46
-
47
-
48
-    /**
49
-     * @deprecated 4.9.53
50
-     * @param array $get
51
-     * @param array $post
52
-     * @param array $cookie
53
-     * @param array $server
54
-     */
55
-    public function __construct(
56
-        array $get = array(),
57
-        array $post = array(),
58
-        array $cookie = array(),
59
-        array $server = array()
60
-    ) {
61
-    }
62
-
63
-
64
-    /**
65
-     * @return RequestInterface
66
-     * @throws InvalidArgumentException
67
-     * @throws InvalidInterfaceException
68
-     * @throws InvalidDataTypeException
69
-     */
70
-    private function request()
71
-    {
72
-        if ($this->request instanceof RequestInterface) {
73
-            return $this->request;
74
-        }
75
-        $loader = LoaderFactory::getLoader();
76
-        $this->request = $loader->getShared('EventEspresso\core\services\request\RequestInterface');
77
-        return $this->request;
78
-    }
79
-
80
-
81
-    /**
82
-     * @param RequestInterface $request
83
-     */
84
-    public function setRequest(RequestInterface $request)
85
-    {
86
-        $this->request = $request;
87
-    }
88
-
89
-
90
-    /**
91
-     * @deprecated 4.9.53
92
-     * @return array
93
-     * @throws InvalidArgumentException
94
-     * @throws InvalidDataTypeException
95
-     * @throws InvalidInterfaceException
96
-     */
97
-    public function get_params()
98
-    {
99
-        return $this->request()->getParams();
100
-    }
101
-
102
-
103
-    /**
104
-     * @deprecated 4.9.53
105
-     * @return array
106
-     * @throws InvalidArgumentException
107
-     * @throws InvalidDataTypeException
108
-     * @throws InvalidInterfaceException
109
-     */
110
-    public function post_params()
111
-    {
112
-        return $this->request()->postParams();
113
-    }
114
-
115
-
116
-    /**
117
-     * @deprecated 4.9.53
118
-     * @return array
119
-     * @throws InvalidArgumentException
120
-     * @throws InvalidDataTypeException
121
-     * @throws InvalidInterfaceException
122
-     */
123
-    public function cookie_params()
124
-    {
125
-        return $this->request()->cookieParams();
126
-    }
127
-
128
-
129
-    /**
130
-     * @deprecated 4.9.53
131
-     * @return array
132
-     * @throws InvalidArgumentException
133
-     * @throws InvalidDataTypeException
134
-     * @throws InvalidInterfaceException
135
-     */
136
-    public function server_params()
137
-    {
138
-        return $this->request()->serverParams();
139
-    }
140
-
141
-
142
-    /**
143
-     * returns sanitized contents of $_REQUEST
144
-     *
145
-     * @deprecated 4.9.53
146
-     * @return array
147
-     * @throws InvalidArgumentException
148
-     * @throws InvalidDataTypeException
149
-     * @throws InvalidInterfaceException
150
-     */
151
-    public function params()
152
-    {
153
-        return $this->request()->requestParams();
154
-    }
155
-
156
-
157
-    /**
158
-     * @deprecated 4.9.53
159
-     * @param      $key
160
-     * @param      $value
161
-     * @param bool $override_ee
162
-     * @return void
163
-     * @throws InvalidArgumentException
164
-     * @throws InvalidDataTypeException
165
-     * @throws InvalidInterfaceException
166
-     */
167
-    public function set($key, $value, $override_ee = false)
168
-    {
169
-        $this->request()->setRequestParam($key, $value, $override_ee);
170
-    }
171
-
172
-
173
-    /**
174
-     * returns   the value for a request param if the given key exists
175
-     *
176
-     * @deprecated 4.9.53
177
-     * @param      $key
178
-     * @param null $default
179
-     * @return mixed
180
-     * @throws InvalidArgumentException
181
-     * @throws InvalidDataTypeException
182
-     * @throws InvalidInterfaceException
183
-     */
184
-    public function get($key, $default = null)
185
-    {
186
-        return $this->request()->getRequestParam($key, $default);
187
-    }
188
-
189
-
190
-    /**
191
-     * check if param exists
192
-     *
193
-     * @deprecated 4.9.53
194
-     * @param $key
195
-     * @return bool
196
-     * @throws InvalidArgumentException
197
-     * @throws InvalidDataTypeException
198
-     * @throws InvalidInterfaceException
199
-     */
200
-    public function is_set($key)
201
-    {
202
-        return $this->request()->requestParamIsSet($key);
203
-    }
204
-
205
-
206
-    /**
207
-     * remove param
208
-     *
209
-     * @deprecated 4.9.53
210
-     * @param      $key
211
-     * @param bool $unset_from_global_too
212
-     * @throws InvalidArgumentException
213
-     * @throws InvalidDataTypeException
214
-     * @throws InvalidInterfaceException
215
-     */
216
-    public function un_set($key, $unset_from_global_too = false)
217
-    {
218
-        $this->request()->unSetRequestParam($key, $unset_from_global_too);
219
-    }
220
-
221
-
222
-    /**
223
-     * @deprecated 4.9.53
224
-     * @return string
225
-     * @throws InvalidArgumentException
226
-     * @throws InvalidDataTypeException
227
-     * @throws InvalidInterfaceException
228
-     */
229
-    public function ip_address()
230
-    {
231
-        return $this->request()->ipAddress();
232
-    }
233
-
234
-
235
-    /**
236
-     * @deprecated 4.9.53
237
-     * @return bool
238
-     * @throws InvalidArgumentException
239
-     * @throws InvalidDataTypeException
240
-     * @throws InvalidInterfaceException
241
-     */
242
-    public function isAdmin()
243
-    {
244
-        return $this->request()->isAdmin();
245
-    }
246
-
247
-
248
-    /**
249
-     * @deprecated 4.9.53
250
-     * @return mixed
251
-     * @throws InvalidArgumentException
252
-     * @throws InvalidDataTypeException
253
-     * @throws InvalidInterfaceException
254
-     */
255
-    public function isAjax()
256
-    {
257
-        return $this->request()->isAjax();
258
-    }
259
-
260
-
261
-    /**
262
-     * @deprecated 4.9.53
263
-     * @return mixed
264
-     * @throws InvalidArgumentException
265
-     * @throws InvalidDataTypeException
266
-     * @throws InvalidInterfaceException
267
-     */
268
-    public function isFrontAjax()
269
-    {
270
-        return $this->request()->isFrontAjax();
271
-    }
272
-
273
-
274
-    /**
275
-     * @deprecated 4.9.53
276
-     * @return mixed|string
277
-     * @throws InvalidArgumentException
278
-     * @throws InvalidDataTypeException
279
-     * @throws InvalidInterfaceException
280
-     */
281
-    public function requestUri()
282
-    {
283
-        return $this->request()->requestUri();
284
-    }
285
-
286
-
287
-    /**
288
-     * @deprecated 4.9.53
289
-     * @return string
290
-     * @throws InvalidArgumentException
291
-     * @throws InvalidDataTypeException
292
-     * @throws InvalidInterfaceException
293
-     */
294
-    public function userAgent()
295
-    {
296
-        return $this->request()->userAgent();
297
-    }
298
-
299
-
300
-    /**
301
-     * @deprecated 4.9.53
302
-     * @param string $user_agent
303
-     * @throws InvalidArgumentException
304
-     * @throws InvalidDataTypeException
305
-     * @throws InvalidInterfaceException
306
-     */
307
-    public function setUserAgent($user_agent = '')
308
-    {
309
-        $this->request()->setUserAgent($user_agent);
310
-    }
311
-
312
-
313
-    /**
314
-     * @deprecated 4.9.53
315
-     * @return bool
316
-     * @throws InvalidArgumentException
317
-     * @throws InvalidDataTypeException
318
-     * @throws InvalidInterfaceException
319
-     */
320
-    public function isBot()
321
-    {
322
-        return $this->request()->isBot();
323
-    }
324
-
325
-
326
-    /**
327
-     * @deprecated 4.9.53
328
-     * @param bool $is_bot
329
-     * @throws InvalidArgumentException
330
-     * @throws InvalidDataTypeException
331
-     * @throws InvalidInterfaceException
332
-     */
333
-    public function setIsBot($is_bot)
334
-    {
335
-        $this->request()->setIsBot($is_bot);
336
-    }
337
-
338
-
339
-    /**
340
-     * check if a request parameter exists whose key that matches the supplied wildcard pattern
341
-     * and return the value for the first match found
342
-     * wildcards can be either of the following:
343
-     *      ? to represent a single character of any type
344
-     *      * to represent one or more characters of any type
345
-     *
346
-     * @param string     $pattern
347
-     * @param null|mixed $default
348
-     * @return false|int
349
-     * @throws InvalidArgumentException
350
-     * @throws InvalidInterfaceException
351
-     * @throws InvalidDataTypeException
352
-     */
353
-    public function getMatch($pattern, $default = null)
354
-    {
355
-        return $this->request()->getMatch($pattern, $default);
356
-    }
357
-
358
-
359
-    /**
360
-     * check if a request parameter exists whose key matches the supplied wildcard pattern
361
-     * wildcards can be either of the following:
362
-     *      ? to represent a single character of any type
363
-     *      * to represent one or more characters of any type
364
-     * returns true if a match is found or false if not
365
-     *
366
-     * @param string $pattern
367
-     * @return false|int
368
-     * @throws InvalidArgumentException
369
-     * @throws InvalidInterfaceException
370
-     * @throws InvalidDataTypeException
371
-     */
372
-    public function matches($pattern)
373
-    {
374
-        return $this->request()->matches($pattern);
375
-    }
21
+	/**
22
+	 * @var RequestInterface $request
23
+	 */
24
+	private $request;
25
+
26
+	/**
27
+	 * whether current request is for the admin but NOT via AJAX
28
+	 *
29
+	 * @var boolean $admin
30
+	 */
31
+	public $admin = false;
32
+
33
+	/**
34
+	 * whether current request is via AJAX
35
+	 *
36
+	 * @var boolean $ajax
37
+	 */
38
+	public $ajax = false;
39
+
40
+	/**
41
+	 * whether current request is via AJAX from the frontend of the site
42
+	 *
43
+	 * @var boolean $front_ajax
44
+	 */
45
+	public $front_ajax = false;
46
+
47
+
48
+	/**
49
+	 * @deprecated 4.9.53
50
+	 * @param array $get
51
+	 * @param array $post
52
+	 * @param array $cookie
53
+	 * @param array $server
54
+	 */
55
+	public function __construct(
56
+		array $get = array(),
57
+		array $post = array(),
58
+		array $cookie = array(),
59
+		array $server = array()
60
+	) {
61
+	}
62
+
63
+
64
+	/**
65
+	 * @return RequestInterface
66
+	 * @throws InvalidArgumentException
67
+	 * @throws InvalidInterfaceException
68
+	 * @throws InvalidDataTypeException
69
+	 */
70
+	private function request()
71
+	{
72
+		if ($this->request instanceof RequestInterface) {
73
+			return $this->request;
74
+		}
75
+		$loader = LoaderFactory::getLoader();
76
+		$this->request = $loader->getShared('EventEspresso\core\services\request\RequestInterface');
77
+		return $this->request;
78
+	}
79
+
80
+
81
+	/**
82
+	 * @param RequestInterface $request
83
+	 */
84
+	public function setRequest(RequestInterface $request)
85
+	{
86
+		$this->request = $request;
87
+	}
88
+
89
+
90
+	/**
91
+	 * @deprecated 4.9.53
92
+	 * @return array
93
+	 * @throws InvalidArgumentException
94
+	 * @throws InvalidDataTypeException
95
+	 * @throws InvalidInterfaceException
96
+	 */
97
+	public function get_params()
98
+	{
99
+		return $this->request()->getParams();
100
+	}
101
+
102
+
103
+	/**
104
+	 * @deprecated 4.9.53
105
+	 * @return array
106
+	 * @throws InvalidArgumentException
107
+	 * @throws InvalidDataTypeException
108
+	 * @throws InvalidInterfaceException
109
+	 */
110
+	public function post_params()
111
+	{
112
+		return $this->request()->postParams();
113
+	}
114
+
115
+
116
+	/**
117
+	 * @deprecated 4.9.53
118
+	 * @return array
119
+	 * @throws InvalidArgumentException
120
+	 * @throws InvalidDataTypeException
121
+	 * @throws InvalidInterfaceException
122
+	 */
123
+	public function cookie_params()
124
+	{
125
+		return $this->request()->cookieParams();
126
+	}
127
+
128
+
129
+	/**
130
+	 * @deprecated 4.9.53
131
+	 * @return array
132
+	 * @throws InvalidArgumentException
133
+	 * @throws InvalidDataTypeException
134
+	 * @throws InvalidInterfaceException
135
+	 */
136
+	public function server_params()
137
+	{
138
+		return $this->request()->serverParams();
139
+	}
140
+
141
+
142
+	/**
143
+	 * returns sanitized contents of $_REQUEST
144
+	 *
145
+	 * @deprecated 4.9.53
146
+	 * @return array
147
+	 * @throws InvalidArgumentException
148
+	 * @throws InvalidDataTypeException
149
+	 * @throws InvalidInterfaceException
150
+	 */
151
+	public function params()
152
+	{
153
+		return $this->request()->requestParams();
154
+	}
155
+
156
+
157
+	/**
158
+	 * @deprecated 4.9.53
159
+	 * @param      $key
160
+	 * @param      $value
161
+	 * @param bool $override_ee
162
+	 * @return void
163
+	 * @throws InvalidArgumentException
164
+	 * @throws InvalidDataTypeException
165
+	 * @throws InvalidInterfaceException
166
+	 */
167
+	public function set($key, $value, $override_ee = false)
168
+	{
169
+		$this->request()->setRequestParam($key, $value, $override_ee);
170
+	}
171
+
172
+
173
+	/**
174
+	 * returns   the value for a request param if the given key exists
175
+	 *
176
+	 * @deprecated 4.9.53
177
+	 * @param      $key
178
+	 * @param null $default
179
+	 * @return mixed
180
+	 * @throws InvalidArgumentException
181
+	 * @throws InvalidDataTypeException
182
+	 * @throws InvalidInterfaceException
183
+	 */
184
+	public function get($key, $default = null)
185
+	{
186
+		return $this->request()->getRequestParam($key, $default);
187
+	}
188
+
189
+
190
+	/**
191
+	 * check if param exists
192
+	 *
193
+	 * @deprecated 4.9.53
194
+	 * @param $key
195
+	 * @return bool
196
+	 * @throws InvalidArgumentException
197
+	 * @throws InvalidDataTypeException
198
+	 * @throws InvalidInterfaceException
199
+	 */
200
+	public function is_set($key)
201
+	{
202
+		return $this->request()->requestParamIsSet($key);
203
+	}
204
+
205
+
206
+	/**
207
+	 * remove param
208
+	 *
209
+	 * @deprecated 4.9.53
210
+	 * @param      $key
211
+	 * @param bool $unset_from_global_too
212
+	 * @throws InvalidArgumentException
213
+	 * @throws InvalidDataTypeException
214
+	 * @throws InvalidInterfaceException
215
+	 */
216
+	public function un_set($key, $unset_from_global_too = false)
217
+	{
218
+		$this->request()->unSetRequestParam($key, $unset_from_global_too);
219
+	}
220
+
221
+
222
+	/**
223
+	 * @deprecated 4.9.53
224
+	 * @return string
225
+	 * @throws InvalidArgumentException
226
+	 * @throws InvalidDataTypeException
227
+	 * @throws InvalidInterfaceException
228
+	 */
229
+	public function ip_address()
230
+	{
231
+		return $this->request()->ipAddress();
232
+	}
233
+
234
+
235
+	/**
236
+	 * @deprecated 4.9.53
237
+	 * @return bool
238
+	 * @throws InvalidArgumentException
239
+	 * @throws InvalidDataTypeException
240
+	 * @throws InvalidInterfaceException
241
+	 */
242
+	public function isAdmin()
243
+	{
244
+		return $this->request()->isAdmin();
245
+	}
246
+
247
+
248
+	/**
249
+	 * @deprecated 4.9.53
250
+	 * @return mixed
251
+	 * @throws InvalidArgumentException
252
+	 * @throws InvalidDataTypeException
253
+	 * @throws InvalidInterfaceException
254
+	 */
255
+	public function isAjax()
256
+	{
257
+		return $this->request()->isAjax();
258
+	}
259
+
260
+
261
+	/**
262
+	 * @deprecated 4.9.53
263
+	 * @return mixed
264
+	 * @throws InvalidArgumentException
265
+	 * @throws InvalidDataTypeException
266
+	 * @throws InvalidInterfaceException
267
+	 */
268
+	public function isFrontAjax()
269
+	{
270
+		return $this->request()->isFrontAjax();
271
+	}
272
+
273
+
274
+	/**
275
+	 * @deprecated 4.9.53
276
+	 * @return mixed|string
277
+	 * @throws InvalidArgumentException
278
+	 * @throws InvalidDataTypeException
279
+	 * @throws InvalidInterfaceException
280
+	 */
281
+	public function requestUri()
282
+	{
283
+		return $this->request()->requestUri();
284
+	}
285
+
286
+
287
+	/**
288
+	 * @deprecated 4.9.53
289
+	 * @return string
290
+	 * @throws InvalidArgumentException
291
+	 * @throws InvalidDataTypeException
292
+	 * @throws InvalidInterfaceException
293
+	 */
294
+	public function userAgent()
295
+	{
296
+		return $this->request()->userAgent();
297
+	}
298
+
299
+
300
+	/**
301
+	 * @deprecated 4.9.53
302
+	 * @param string $user_agent
303
+	 * @throws InvalidArgumentException
304
+	 * @throws InvalidDataTypeException
305
+	 * @throws InvalidInterfaceException
306
+	 */
307
+	public function setUserAgent($user_agent = '')
308
+	{
309
+		$this->request()->setUserAgent($user_agent);
310
+	}
311
+
312
+
313
+	/**
314
+	 * @deprecated 4.9.53
315
+	 * @return bool
316
+	 * @throws InvalidArgumentException
317
+	 * @throws InvalidDataTypeException
318
+	 * @throws InvalidInterfaceException
319
+	 */
320
+	public function isBot()
321
+	{
322
+		return $this->request()->isBot();
323
+	}
324
+
325
+
326
+	/**
327
+	 * @deprecated 4.9.53
328
+	 * @param bool $is_bot
329
+	 * @throws InvalidArgumentException
330
+	 * @throws InvalidDataTypeException
331
+	 * @throws InvalidInterfaceException
332
+	 */
333
+	public function setIsBot($is_bot)
334
+	{
335
+		$this->request()->setIsBot($is_bot);
336
+	}
337
+
338
+
339
+	/**
340
+	 * check if a request parameter exists whose key that matches the supplied wildcard pattern
341
+	 * and return the value for the first match found
342
+	 * wildcards can be either of the following:
343
+	 *      ? to represent a single character of any type
344
+	 *      * to represent one or more characters of any type
345
+	 *
346
+	 * @param string     $pattern
347
+	 * @param null|mixed $default
348
+	 * @return false|int
349
+	 * @throws InvalidArgumentException
350
+	 * @throws InvalidInterfaceException
351
+	 * @throws InvalidDataTypeException
352
+	 */
353
+	public function getMatch($pattern, $default = null)
354
+	{
355
+		return $this->request()->getMatch($pattern, $default);
356
+	}
357
+
358
+
359
+	/**
360
+	 * check if a request parameter exists whose key matches the supplied wildcard pattern
361
+	 * wildcards can be either of the following:
362
+	 *      ? to represent a single character of any type
363
+	 *      * to represent one or more characters of any type
364
+	 * returns true if a match is found or false if not
365
+	 *
366
+	 * @param string $pattern
367
+	 * @return false|int
368
+	 * @throws InvalidArgumentException
369
+	 * @throws InvalidInterfaceException
370
+	 * @throws InvalidDataTypeException
371
+	 */
372
+	public function matches($pattern)
373
+	{
374
+		return $this->request()->matches($pattern);
375
+	}
376 376
 }
Please login to merge, or discard this patch.
core/espresso_definitions.php 2 patches
Indentation   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -7,16 +7,16 @@  discard block
 block discarded – undo
7 7
 define('EE_SUPPORT_EMAIL', '[email protected]');
8 8
 // used to be DIRECTORY_SEPARATOR, but that caused issues on windows
9 9
 if (! defined('DS')) {
10
-    define('DS', '/');
10
+	define('DS', '/');
11 11
 }
12 12
 if (! defined('PS')) {
13
-    define('PS', PATH_SEPARATOR);
13
+	define('PS', PATH_SEPARATOR);
14 14
 }
15 15
 if (! defined('SP')) {
16
-    define('SP', ' ');
16
+	define('SP', ' ');
17 17
 }
18 18
 if (! defined('EENL')) {
19
-    define('EENL', "\n");
19
+	define('EENL', "\n");
20 20
 }
21 21
 // define the plugin directory and URL
22 22
 define('EE_PLUGIN_BASENAME', plugin_basename(EVENT_ESPRESSO_MAIN_FILE));
@@ -70,7 +70,7 @@  discard block
 block discarded – undo
70 70
 define('EE_LANGUAGES_SAFE_DIR', EVENT_ESPRESSO_UPLOAD_DIR . 'languages/');
71 71
 // check for DOMPDF fonts in uploads
72 72
 if (file_exists(EVENT_ESPRESSO_UPLOAD_DIR . 'fonts/')) {
73
-    define('DOMPDF_FONT_DIR', EVENT_ESPRESSO_UPLOAD_DIR . 'fonts/');
73
+	define('DOMPDF_FONT_DIR', EVENT_ESPRESSO_UPLOAD_DIR . 'fonts/');
74 74
 }
75 75
 // just a handy constant occasionally needed for finding values representing infinity in the DB
76 76
 // you're better to use this than its straight value (currently -1) in case you ever
@@ -78,9 +78,9 @@  discard block
 block discarded – undo
78 78
 define('EE_INF_IN_DB', -1);
79 79
 define('EE_INF', INF > (float) PHP_INT_MAX ? INF : PHP_INT_MAX);
80 80
 if (! defined('EE_DEBUG')) {
81
-    define('EE_DEBUG', false);
81
+	define('EE_DEBUG', false);
82 82
 }
83 83
 // for older WP versions
84 84
 if (! defined('MONTH_IN_SECONDS')) {
85
-    define('MONTH_IN_SECONDS', DAY_IN_SECONDS * 30);
85
+	define('MONTH_IN_SECONDS', DAY_IN_SECONDS * 30);
86 86
 }
Please login to merge, or discard this patch.
Spacing   +45 added lines, -45 removed lines patch added patch discarded remove patch
@@ -6,81 +6,81 @@
 block discarded – undo
6 6
 define('EE_MIN_PHP_VER_RECOMMENDED', '5.6.32');
7 7
 define('EE_SUPPORT_EMAIL', '[email protected]');
8 8
 // used to be DIRECTORY_SEPARATOR, but that caused issues on windows
9
-if (! defined('DS')) {
9
+if ( ! defined('DS')) {
10 10
     define('DS', '/');
11 11
 }
12
-if (! defined('PS')) {
12
+if ( ! defined('PS')) {
13 13
     define('PS', PATH_SEPARATOR);
14 14
 }
15
-if (! defined('SP')) {
15
+if ( ! defined('SP')) {
16 16
     define('SP', ' ');
17 17
 }
18
-if (! defined('EENL')) {
18
+if ( ! defined('EENL')) {
19 19
     define('EENL', "\n");
20 20
 }
21 21
 // define the plugin directory and URL
22 22
 define('EE_PLUGIN_BASENAME', plugin_basename(EVENT_ESPRESSO_MAIN_FILE));
23
-define('EE_PLUGIN_DIR_PATH', dirname(EVENT_ESPRESSO_MAIN_FILE) . '/');
23
+define('EE_PLUGIN_DIR_PATH', dirname(EVENT_ESPRESSO_MAIN_FILE).'/');
24 24
 define('EE_PLUGIN_DIR_URL', plugin_dir_url(EVENT_ESPRESSO_MAIN_FILE));
25 25
 // main root folder paths
26
-define('EE_ADMIN_PAGES', EE_PLUGIN_DIR_PATH . 'admin_pages/');
27
-define('EE_CORE', EE_PLUGIN_DIR_PATH . 'core/');
28
-define('EE_MODULES', EE_PLUGIN_DIR_PATH . 'modules/');
29
-define('EE_PUBLIC', EE_PLUGIN_DIR_PATH . 'public/');
30
-define('EE_SHORTCODES', EE_PLUGIN_DIR_PATH . 'shortcodes/');
31
-define('EE_WIDGETS', EE_PLUGIN_DIR_PATH . 'widgets/');
32
-define('EE_PAYMENT_METHODS', EE_PLUGIN_DIR_PATH . 'payment_methods/');
33
-define('EE_CAFF_PATH', EE_PLUGIN_DIR_PATH . 'caffeinated/');
26
+define('EE_ADMIN_PAGES', EE_PLUGIN_DIR_PATH.'admin_pages/');
27
+define('EE_CORE', EE_PLUGIN_DIR_PATH.'core/');
28
+define('EE_MODULES', EE_PLUGIN_DIR_PATH.'modules/');
29
+define('EE_PUBLIC', EE_PLUGIN_DIR_PATH.'public/');
30
+define('EE_SHORTCODES', EE_PLUGIN_DIR_PATH.'shortcodes/');
31
+define('EE_WIDGETS', EE_PLUGIN_DIR_PATH.'widgets/');
32
+define('EE_PAYMENT_METHODS', EE_PLUGIN_DIR_PATH.'payment_methods/');
33
+define('EE_CAFF_PATH', EE_PLUGIN_DIR_PATH.'caffeinated/');
34 34
 // core system paths
35
-define('EE_ADMIN', EE_CORE . 'admin/');
36
-define('EE_CPTS', EE_CORE . 'CPTs/');
37
-define('EE_CLASSES', EE_CORE . 'db_classes/');
38
-define('EE_INTERFACES', EE_CORE . 'interfaces/');
39
-define('EE_BUSINESS', EE_CORE . 'business/');
40
-define('EE_MODELS', EE_CORE . 'db_models/');
41
-define('EE_HELPERS', EE_CORE . 'helpers/');
42
-define('EE_LIBRARIES', EE_CORE . 'libraries/');
43
-define('EE_TEMPLATES', EE_CORE . 'templates/');
44
-define('EE_THIRD_PARTY', EE_CORE . 'third_party_libs/');
45
-define('EE_GLOBAL_ASSETS', EE_TEMPLATES . 'global_assets/');
46
-define('EE_FORM_SECTIONS', EE_LIBRARIES . 'form_sections/');
35
+define('EE_ADMIN', EE_CORE.'admin/');
36
+define('EE_CPTS', EE_CORE.'CPTs/');
37
+define('EE_CLASSES', EE_CORE.'db_classes/');
38
+define('EE_INTERFACES', EE_CORE.'interfaces/');
39
+define('EE_BUSINESS', EE_CORE.'business/');
40
+define('EE_MODELS', EE_CORE.'db_models/');
41
+define('EE_HELPERS', EE_CORE.'helpers/');
42
+define('EE_LIBRARIES', EE_CORE.'libraries/');
43
+define('EE_TEMPLATES', EE_CORE.'templates/');
44
+define('EE_THIRD_PARTY', EE_CORE.'third_party_libs/');
45
+define('EE_GLOBAL_ASSETS', EE_TEMPLATES.'global_assets/');
46
+define('EE_FORM_SECTIONS', EE_LIBRARIES.'form_sections/');
47 47
 // gateways
48
-define('EE_GATEWAYS', EE_MODULES . 'gateways/');
49
-define('EE_GATEWAYS_URL', EE_PLUGIN_DIR_URL . 'modules/gateways/');
48
+define('EE_GATEWAYS', EE_MODULES.'gateways/');
49
+define('EE_GATEWAYS_URL', EE_PLUGIN_DIR_URL.'modules/gateways/');
50 50
 // asset URL paths
51
-define('EE_TEMPLATES_URL', EE_PLUGIN_DIR_URL . 'core/templates/');
52
-define('EE_GLOBAL_ASSETS_URL', EE_TEMPLATES_URL . 'global_assets/');
53
-define('EE_IMAGES_URL', EE_GLOBAL_ASSETS_URL . 'images/');
54
-define('EE_THIRD_PARTY_URL', EE_PLUGIN_DIR_URL . 'core/third_party_libs/');
55
-define('EE_HELPERS_ASSETS', EE_PLUGIN_DIR_URL . 'core/helpers/assets/');
56
-define('EE_LIBRARIES_URL', EE_PLUGIN_DIR_URL . 'core/libraries/');
51
+define('EE_TEMPLATES_URL', EE_PLUGIN_DIR_URL.'core/templates/');
52
+define('EE_GLOBAL_ASSETS_URL', EE_TEMPLATES_URL.'global_assets/');
53
+define('EE_IMAGES_URL', EE_GLOBAL_ASSETS_URL.'images/');
54
+define('EE_THIRD_PARTY_URL', EE_PLUGIN_DIR_URL.'core/third_party_libs/');
55
+define('EE_HELPERS_ASSETS', EE_PLUGIN_DIR_URL.'core/helpers/assets/');
56
+define('EE_LIBRARIES_URL', EE_PLUGIN_DIR_URL.'core/libraries/');
57 57
 // define upload paths
58 58
 $uploads = wp_upload_dir();
59 59
 // define the uploads directory and URL
60
-define('EVENT_ESPRESSO_UPLOAD_DIR', $uploads['basedir'] . '/espresso/');
61
-define('EVENT_ESPRESSO_UPLOAD_URL', $uploads['baseurl'] . '/espresso/');
60
+define('EVENT_ESPRESSO_UPLOAD_DIR', $uploads['basedir'].'/espresso/');
61
+define('EVENT_ESPRESSO_UPLOAD_URL', $uploads['baseurl'].'/espresso/');
62 62
 // define the templates directory and URL
63
-define('EVENT_ESPRESSO_TEMPLATE_DIR', $uploads['basedir'] . '/espresso/templates/');
64
-define('EVENT_ESPRESSO_TEMPLATE_URL', $uploads['baseurl'] . '/espresso/templates/');
63
+define('EVENT_ESPRESSO_TEMPLATE_DIR', $uploads['basedir'].'/espresso/templates/');
64
+define('EVENT_ESPRESSO_TEMPLATE_URL', $uploads['baseurl'].'/espresso/templates/');
65 65
 // define the gateway directory and URL
66
-define('EVENT_ESPRESSO_GATEWAY_DIR', $uploads['basedir'] . '/espresso/gateways/');
67
-define('EVENT_ESPRESSO_GATEWAY_URL', $uploads['baseurl'] . '/espresso/gateways/');
66
+define('EVENT_ESPRESSO_GATEWAY_DIR', $uploads['basedir'].'/espresso/gateways/');
67
+define('EVENT_ESPRESSO_GATEWAY_URL', $uploads['baseurl'].'/espresso/gateways/');
68 68
 // languages folder/path
69
-define('EE_LANGUAGES_SAFE_LOC', '../' . 'uploads/' . 'espresso/languages/');
70
-define('EE_LANGUAGES_SAFE_DIR', EVENT_ESPRESSO_UPLOAD_DIR . 'languages/');
69
+define('EE_LANGUAGES_SAFE_LOC', '../'.'uploads/'.'espresso/languages/');
70
+define('EE_LANGUAGES_SAFE_DIR', EVENT_ESPRESSO_UPLOAD_DIR.'languages/');
71 71
 // check for DOMPDF fonts in uploads
72
-if (file_exists(EVENT_ESPRESSO_UPLOAD_DIR . 'fonts/')) {
73
-    define('DOMPDF_FONT_DIR', EVENT_ESPRESSO_UPLOAD_DIR . 'fonts/');
72
+if (file_exists(EVENT_ESPRESSO_UPLOAD_DIR.'fonts/')) {
73
+    define('DOMPDF_FONT_DIR', EVENT_ESPRESSO_UPLOAD_DIR.'fonts/');
74 74
 }
75 75
 // just a handy constant occasionally needed for finding values representing infinity in the DB
76 76
 // you're better to use this than its straight value (currently -1) in case you ever
77 77
 // want to change its default value! or find when -1 means infinity
78 78
 define('EE_INF_IN_DB', -1);
79 79
 define('EE_INF', INF > (float) PHP_INT_MAX ? INF : PHP_INT_MAX);
80
-if (! defined('EE_DEBUG')) {
80
+if ( ! defined('EE_DEBUG')) {
81 81
     define('EE_DEBUG', false);
82 82
 }
83 83
 // for older WP versions
84
-if (! defined('MONTH_IN_SECONDS')) {
84
+if ( ! defined('MONTH_IN_SECONDS')) {
85 85
     define('MONTH_IN_SECONDS', DAY_IN_SECONDS * 30);
86 86
 }
Please login to merge, or discard this patch.
services/admin/registrations/list_table/page_header/EventFilterHeader.php 1 patch
Indentation   +54 added lines, -54 removed lines patch added patch discarded remove patch
@@ -24,62 +24,62 @@
 block discarded – undo
24 24
 class EventFilterHeader extends AdminPageHeaderDecorator
25 25
 {
26 26
 
27
-    /**
28
-     * @var EEM_Event $event_model
29
-     */
30
-    private $event_model;
27
+	/**
28
+	 * @var EEM_Event $event_model
29
+	 */
30
+	private $event_model;
31 31
 
32 32
 
33
-    /**
34
-     * EventFilterHeader constructor.
35
-     *
36
-     * @param RequestInterface $request
37
-     * @param EEM_Event        $event_model
38
-     */
39
-    public function __construct(RequestInterface $request, EEM_Event $event_model)
40
-    {
41
-        parent::__construct($request);
42
-        $this->event_model = $event_model;
43
-    }
33
+	/**
34
+	 * EventFilterHeader constructor.
35
+	 *
36
+	 * @param RequestInterface $request
37
+	 * @param EEM_Event        $event_model
38
+	 */
39
+	public function __construct(RequestInterface $request, EEM_Event $event_model)
40
+	{
41
+		parent::__construct($request);
42
+		$this->event_model = $event_model;
43
+	}
44 44
 
45 45
 
46
-    /**
47
-     * @param string $text
48
-     * @return string
49
-     * @throws EE_Error
50
-     * @throws InvalidDataTypeException
51
-     * @throws InvalidInterfaceException
52
-     * @throws InvalidArgumentException
53
-     * @throws ReflectionException
54
-     * @since 4.10.2.p
55
-     */
56
-    public function getHeaderText($text = '')
57
-    {
58
-        $EVT_ID = $this->request->getRequestParam('EVT_ID');
59
-        $EVT_ID = $this->request->getRequestParam('event_id', $EVT_ID, 'int');
60
-        if ($EVT_ID) {
61
-            $event = $this->event_model->get_one_by_ID($EVT_ID);
62
-            if ($event instanceof EE_Event) {
63
-                $text .= sprintf(
64
-                    /* translators: %s: <h3>  %s: <a href>Event Name</a>  %s: </h3> */
65
-                    // phpcs:ignore WordPress.WP.I18n.UnorderedPlaceholdersText
66
-                    esc_html__('%s Viewing registrations for the event: %s%s', 'event_espresso'),
67
-                    '<h3 style="line-height:1.5em;">',
68
-                    '&nbsp;<a href="'
69
-                    . EE_Admin_Page::add_query_args_and_nonce(
70
-                        array(
71
-                            'action' => 'edit',
72
-                            'post'   => $event->ID(),
73
-                        ),
74
-                        EVENTS_ADMIN_URL
75
-                    )
76
-                    . '">'
77
-                    . $event->get('EVT_name')
78
-                    . '</a>&nbsp;',
79
-                    '</h3>'
80
-                );
81
-            }
82
-        }
83
-        return $text;
84
-    }
46
+	/**
47
+	 * @param string $text
48
+	 * @return string
49
+	 * @throws EE_Error
50
+	 * @throws InvalidDataTypeException
51
+	 * @throws InvalidInterfaceException
52
+	 * @throws InvalidArgumentException
53
+	 * @throws ReflectionException
54
+	 * @since 4.10.2.p
55
+	 */
56
+	public function getHeaderText($text = '')
57
+	{
58
+		$EVT_ID = $this->request->getRequestParam('EVT_ID');
59
+		$EVT_ID = $this->request->getRequestParam('event_id', $EVT_ID, 'int');
60
+		if ($EVT_ID) {
61
+			$event = $this->event_model->get_one_by_ID($EVT_ID);
62
+			if ($event instanceof EE_Event) {
63
+				$text .= sprintf(
64
+					/* translators: %s: <h3>  %s: <a href>Event Name</a>  %s: </h3> */
65
+					// phpcs:ignore WordPress.WP.I18n.UnorderedPlaceholdersText
66
+					esc_html__('%s Viewing registrations for the event: %s%s', 'event_espresso'),
67
+					'<h3 style="line-height:1.5em;">',
68
+					'&nbsp;<a href="'
69
+					. EE_Admin_Page::add_query_args_and_nonce(
70
+						array(
71
+							'action' => 'edit',
72
+							'post'   => $event->ID(),
73
+						),
74
+						EVENTS_ADMIN_URL
75
+					)
76
+					. '">'
77
+					. $event->get('EVT_name')
78
+					. '</a>&nbsp;',
79
+					'</h3>'
80
+				);
81
+			}
82
+		}
83
+		return $text;
84
+	}
85 85
 }
Please login to merge, or discard this patch.
core/domain/services/pue/Stats.php 2 patches
Indentation   +204 added lines, -204 removed lines patch added patch discarded remove patch
@@ -22,86 +22,86 @@  discard block
 block discarded – undo
22 22
 class Stats
23 23
 {
24 24
 
25
-    const OPTIONS_KEY_EXPIRY_TIMESTAMP_FOR_SENDING_STATS = 'ee_uxip_stats_expiry';
26
-
27
-    /**
28
-     * @var Config
29
-     */
30
-    private $config;
31
-
32
-
33
-    /**
34
-     * @var StatsGatherer
35
-     */
36
-    private $stats_gatherer;
37
-
38
-
39
-    /**
40
-     * @var EE_Maintenance_Mode
41
-     */
42
-    private $maintenance_mode;
43
-
44
-    public function __construct(
45
-        Config $config,
46
-        EE_Maintenance_Mode $maintenance_mode,
47
-        StatsGatherer $stats_gatherer
48
-    ) {
49
-        $this->config = $config;
50
-        $this->maintenance_mode = $maintenance_mode;
51
-        $this->stats_gatherer = $stats_gatherer;
52
-        $this->setUxipNotices();
53
-    }
54
-
55
-
56
-    /**
57
-     * Displays uxip opt-in notice if necessary.
58
-     */
59
-    private function setUxipNotices()
60
-    {
61
-        if ($this->canDisplayNotices()) {
62
-            add_action('admin_notices', array($this, 'optinNotice'));
63
-            add_action('admin_enqueue_scripts', array($this, 'enqueueScripts'));
64
-            add_action('wp_ajax_espresso_data_optin', array($this, 'ajaxHandler'));
65
-        }
66
-    }
67
-
68
-
69
-    /**
70
-     * This returns the callback that PluginUpdateEngineChecker will use for getting any extra stats to send.
71
-     *
72
-     * @return Closure
73
-     */
74
-    public function statsCallback()
75
-    {
76
-        // returns a callback that can is used to retrieve the stats to send along to the pue server.
77
-        return function () {
78
-            // we only send stats one a week, so let's see if our stat timestamp has expired.
79
-            if (! $this->sendStats()) {
80
-                return array();
81
-            }
82
-            return $this->stats_gatherer->stats();
83
-        };
84
-    }
85
-
86
-
87
-    /**
88
-     * Return whether notices can be displayed or not
89
-     *
90
-     * @return bool
91
-     */
92
-    private function canDisplayNotices()
93
-    {
94
-        return ! $this->config->hasNotifiedForUxip()
95
-               && $this->maintenance_mode->level() !== EE_Maintenance_Mode::level_2_complete_maintenance;
96
-    }
97
-
98
-
99
-    /**
100
-     * Callback for the admin_notices hook that outputs the UXIP optin-in notice.
101
-     */
102
-    public function optinNotice()
103
-    {
104
-        ?>
25
+	const OPTIONS_KEY_EXPIRY_TIMESTAMP_FOR_SENDING_STATS = 'ee_uxip_stats_expiry';
26
+
27
+	/**
28
+	 * @var Config
29
+	 */
30
+	private $config;
31
+
32
+
33
+	/**
34
+	 * @var StatsGatherer
35
+	 */
36
+	private $stats_gatherer;
37
+
38
+
39
+	/**
40
+	 * @var EE_Maintenance_Mode
41
+	 */
42
+	private $maintenance_mode;
43
+
44
+	public function __construct(
45
+		Config $config,
46
+		EE_Maintenance_Mode $maintenance_mode,
47
+		StatsGatherer $stats_gatherer
48
+	) {
49
+		$this->config = $config;
50
+		$this->maintenance_mode = $maintenance_mode;
51
+		$this->stats_gatherer = $stats_gatherer;
52
+		$this->setUxipNotices();
53
+	}
54
+
55
+
56
+	/**
57
+	 * Displays uxip opt-in notice if necessary.
58
+	 */
59
+	private function setUxipNotices()
60
+	{
61
+		if ($this->canDisplayNotices()) {
62
+			add_action('admin_notices', array($this, 'optinNotice'));
63
+			add_action('admin_enqueue_scripts', array($this, 'enqueueScripts'));
64
+			add_action('wp_ajax_espresso_data_optin', array($this, 'ajaxHandler'));
65
+		}
66
+	}
67
+
68
+
69
+	/**
70
+	 * This returns the callback that PluginUpdateEngineChecker will use for getting any extra stats to send.
71
+	 *
72
+	 * @return Closure
73
+	 */
74
+	public function statsCallback()
75
+	{
76
+		// returns a callback that can is used to retrieve the stats to send along to the pue server.
77
+		return function () {
78
+			// we only send stats one a week, so let's see if our stat timestamp has expired.
79
+			if (! $this->sendStats()) {
80
+				return array();
81
+			}
82
+			return $this->stats_gatherer->stats();
83
+		};
84
+	}
85
+
86
+
87
+	/**
88
+	 * Return whether notices can be displayed or not
89
+	 *
90
+	 * @return bool
91
+	 */
92
+	private function canDisplayNotices()
93
+	{
94
+		return ! $this->config->hasNotifiedForUxip()
95
+			   && $this->maintenance_mode->level() !== EE_Maintenance_Mode::level_2_complete_maintenance;
96
+	}
97
+
98
+
99
+	/**
100
+	 * Callback for the admin_notices hook that outputs the UXIP optin-in notice.
101
+	 */
102
+	public function optinNotice()
103
+	{
104
+		?>
105 105
         <div class="updated data-collect-optin" id="espresso-data-collect-optin-container">
106 106
             <div id="data-collect-optin-options-container">
107 107
                 <span class="dashicons dashicons-admin-site"></span>
@@ -114,128 +114,128 @@  discard block
 block discarded – undo
114 114
             </div>
115 115
         </div>
116 116
         <?php
117
-    }
118
-
119
-
120
-    /**
121
-     * Retrieves the optin text (static so it can be used in multiple places as necessary).
122
-     *
123
-     * @param bool $extra
124
-     */
125
-    public static function optinText($extra = true)
126
-    {
127
-        if (! $extra) {
128
-            echo '<h2 class="ee-admin-settings-hdr" '
129
-                 . (! $extra ? 'id="UXIP_settings"' : '')
130
-                 . '>'
131
-                 . esc_html__('User eXperience Improvement Program (UXIP)', 'event_espresso')
132
-                 . EEH_Template::get_help_tab_link('organization_logo_info')
133
-                 . '</h2>';
134
-            printf(
135
-                esc_html__(
136
-                    '%1$sPlease help us make Event Espresso better and vote for your favorite features.%2$s The %3$sUser eXperience Improvement Program (UXIP)%4$s, has been created so when you use Event Espresso you are voting for the features and settings that are important to you. The UXIP helps us understand how you use our products and services, track problems and in what context. If you opt-out of the UXIP you essentially elect for us to disregard how you use Event Espresso as we build new features and make changes. Participation in the program is completely voluntary and it is disabled by default. The end results of the UXIP are software improvements to better meet your needs. The data we collect will never be sold, traded, or misused in any way. %5$sPlease see our %6$sPrivacy Policy%7$s for more information.',
137
-                    'event_espresso'
138
-                ),
139
-                '<p><em>',
140
-                '</em></p>',
141
-                '<a href="https://eventespresso.com/about/user-experience-improvement-program-uxip/" target="_blank">',
142
-                '</a>',
143
-                '<br><br>',
144
-                '<a href="https://eventespresso.com/about/privacy-policy/" target="_blank">',
145
-                '</a>'
146
-            );
147
-        } else {
148
-            $settings_url = EEH_URL::add_query_args_and_nonce(
149
-                array('action' => 'default'),
150
-                admin_url('admin.php?page=espresso_general_settings')
151
-            );
152
-            $settings_url .= '#UXIP_settings';
153
-            printf(
154
-                esc_html__(
155
-                    'The Event Espresso UXIP feature is not yet active on your site. For %1$smore info%2$s and to opt-in %3$sclick here%4$s.',
156
-                    'event_espresso'
157
-                ),
158
-                '<a href="https://eventespresso.com/about/user-experience-improvement-program-uxip/" target="_blank">',
159
-                '</a>',
160
-                '<a href="' . $settings_url . '" target="_blank">',
161
-                '</a>'
162
-            );
163
-        }
164
-    }
165
-
166
-
167
-    /**
168
-     * Callback for admin_enqueue_scripts that sets up the scripts and styles for the uxip notice
169
-     */
170
-    public function enqueueScripts()
171
-    {
172
-        wp_register_script(
173
-            'ee-data-optin-js',
174
-            EE_GLOBAL_ASSETS_URL . 'scripts/ee-data-optin.js',
175
-            array('jquery'),
176
-            EVENT_ESPRESSO_VERSION,
177
-            true
178
-        );
179
-        wp_register_style(
180
-            'ee-data-optin-css',
181
-            EE_GLOBAL_ASSETS_URL . 'css/ee-data-optin.css',
182
-            array(),
183
-            EVENT_ESPRESSO_VERSION
184
-        );
185
-
186
-        wp_enqueue_script('ee-data-optin-js');
187
-        wp_enqueue_style('ee-data-optin-css');
188
-    }
189
-
190
-
191
-    /**
192
-     * Callback for wp_ajax_espresso_data_optin that handles the ajax request
193
-     */
194
-    public function ajaxHandler()
195
-    {
196
-        /** @var RequestInterface $request */
197
-        $request = LoaderFactory::getLoader()->getShared(RequestInterface::class);
198
-        $nonce = $request->getRequestParam('nonce');
199
-        // verify nonce
200
-        if (! $nonce || ! wp_verify_nonce($nonce, 'ee-data-optin')) {
201
-            exit();
202
-        }
203
-
204
-        // update has notified option
205
-        $this->config->setHasNotifiedAboutUxip();
206
-        exit();
207
-    }
208
-
209
-
210
-    /**
211
-     * Used to determine whether additional stats are sent.
212
-     */
213
-    private function sendStats()
214
-    {
215
-        return $this->config->isOptedInForUxip()
216
-               && $this->maintenance_mode->level() !== EE_Maintenance_Mode::level_2_complete_maintenance
217
-               && $this->statSendTimestampExpired();
218
-    }
219
-
220
-
221
-    /**
222
-     * Returns true when the timestamp used to track whether stats get sent (currently a weekly interval) is expired.
223
-     * Returns false otherwise.
224
-     *
225
-     * @return bool
226
-     */
227
-    private function statSendTimestampExpired()
228
-    {
229
-        $current_expiry = get_option(self::OPTIONS_KEY_EXPIRY_TIMESTAMP_FOR_SENDING_STATS, null);
230
-        if ($current_expiry === null) {
231
-            add_option(self::OPTIONS_KEY_EXPIRY_TIMESTAMP_FOR_SENDING_STATS, time() + WEEK_IN_SECONDS, '', 'no');
232
-            return true;
233
-        }
234
-
235
-        if (time() > (int) $current_expiry) {
236
-            update_option(self::OPTIONS_KEY_EXPIRY_TIMESTAMP_FOR_SENDING_STATS, time() + WEEK_IN_SECONDS);
237
-            return true;
238
-        }
239
-        return false;
240
-    }
117
+	}
118
+
119
+
120
+	/**
121
+	 * Retrieves the optin text (static so it can be used in multiple places as necessary).
122
+	 *
123
+	 * @param bool $extra
124
+	 */
125
+	public static function optinText($extra = true)
126
+	{
127
+		if (! $extra) {
128
+			echo '<h2 class="ee-admin-settings-hdr" '
129
+				 . (! $extra ? 'id="UXIP_settings"' : '')
130
+				 . '>'
131
+				 . esc_html__('User eXperience Improvement Program (UXIP)', 'event_espresso')
132
+				 . EEH_Template::get_help_tab_link('organization_logo_info')
133
+				 . '</h2>';
134
+			printf(
135
+				esc_html__(
136
+					'%1$sPlease help us make Event Espresso better and vote for your favorite features.%2$s The %3$sUser eXperience Improvement Program (UXIP)%4$s, has been created so when you use Event Espresso you are voting for the features and settings that are important to you. The UXIP helps us understand how you use our products and services, track problems and in what context. If you opt-out of the UXIP you essentially elect for us to disregard how you use Event Espresso as we build new features and make changes. Participation in the program is completely voluntary and it is disabled by default. The end results of the UXIP are software improvements to better meet your needs. The data we collect will never be sold, traded, or misused in any way. %5$sPlease see our %6$sPrivacy Policy%7$s for more information.',
137
+					'event_espresso'
138
+				),
139
+				'<p><em>',
140
+				'</em></p>',
141
+				'<a href="https://eventespresso.com/about/user-experience-improvement-program-uxip/" target="_blank">',
142
+				'</a>',
143
+				'<br><br>',
144
+				'<a href="https://eventespresso.com/about/privacy-policy/" target="_blank">',
145
+				'</a>'
146
+			);
147
+		} else {
148
+			$settings_url = EEH_URL::add_query_args_and_nonce(
149
+				array('action' => 'default'),
150
+				admin_url('admin.php?page=espresso_general_settings')
151
+			);
152
+			$settings_url .= '#UXIP_settings';
153
+			printf(
154
+				esc_html__(
155
+					'The Event Espresso UXIP feature is not yet active on your site. For %1$smore info%2$s and to opt-in %3$sclick here%4$s.',
156
+					'event_espresso'
157
+				),
158
+				'<a href="https://eventespresso.com/about/user-experience-improvement-program-uxip/" target="_blank">',
159
+				'</a>',
160
+				'<a href="' . $settings_url . '" target="_blank">',
161
+				'</a>'
162
+			);
163
+		}
164
+	}
165
+
166
+
167
+	/**
168
+	 * Callback for admin_enqueue_scripts that sets up the scripts and styles for the uxip notice
169
+	 */
170
+	public function enqueueScripts()
171
+	{
172
+		wp_register_script(
173
+			'ee-data-optin-js',
174
+			EE_GLOBAL_ASSETS_URL . 'scripts/ee-data-optin.js',
175
+			array('jquery'),
176
+			EVENT_ESPRESSO_VERSION,
177
+			true
178
+		);
179
+		wp_register_style(
180
+			'ee-data-optin-css',
181
+			EE_GLOBAL_ASSETS_URL . 'css/ee-data-optin.css',
182
+			array(),
183
+			EVENT_ESPRESSO_VERSION
184
+		);
185
+
186
+		wp_enqueue_script('ee-data-optin-js');
187
+		wp_enqueue_style('ee-data-optin-css');
188
+	}
189
+
190
+
191
+	/**
192
+	 * Callback for wp_ajax_espresso_data_optin that handles the ajax request
193
+	 */
194
+	public function ajaxHandler()
195
+	{
196
+		/** @var RequestInterface $request */
197
+		$request = LoaderFactory::getLoader()->getShared(RequestInterface::class);
198
+		$nonce = $request->getRequestParam('nonce');
199
+		// verify nonce
200
+		if (! $nonce || ! wp_verify_nonce($nonce, 'ee-data-optin')) {
201
+			exit();
202
+		}
203
+
204
+		// update has notified option
205
+		$this->config->setHasNotifiedAboutUxip();
206
+		exit();
207
+	}
208
+
209
+
210
+	/**
211
+	 * Used to determine whether additional stats are sent.
212
+	 */
213
+	private function sendStats()
214
+	{
215
+		return $this->config->isOptedInForUxip()
216
+			   && $this->maintenance_mode->level() !== EE_Maintenance_Mode::level_2_complete_maintenance
217
+			   && $this->statSendTimestampExpired();
218
+	}
219
+
220
+
221
+	/**
222
+	 * Returns true when the timestamp used to track whether stats get sent (currently a weekly interval) is expired.
223
+	 * Returns false otherwise.
224
+	 *
225
+	 * @return bool
226
+	 */
227
+	private function statSendTimestampExpired()
228
+	{
229
+		$current_expiry = get_option(self::OPTIONS_KEY_EXPIRY_TIMESTAMP_FOR_SENDING_STATS, null);
230
+		if ($current_expiry === null) {
231
+			add_option(self::OPTIONS_KEY_EXPIRY_TIMESTAMP_FOR_SENDING_STATS, time() + WEEK_IN_SECONDS, '', 'no');
232
+			return true;
233
+		}
234
+
235
+		if (time() > (int) $current_expiry) {
236
+			update_option(self::OPTIONS_KEY_EXPIRY_TIMESTAMP_FOR_SENDING_STATS, time() + WEEK_IN_SECONDS);
237
+			return true;
238
+		}
239
+		return false;
240
+	}
241 241
 }
Please login to merge, or discard this patch.
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -74,9 +74,9 @@  discard block
 block discarded – undo
74 74
     public function statsCallback()
75 75
     {
76 76
         // returns a callback that can is used to retrieve the stats to send along to the pue server.
77
-        return function () {
77
+        return function() {
78 78
             // we only send stats one a week, so let's see if our stat timestamp has expired.
79
-            if (! $this->sendStats()) {
79
+            if ( ! $this->sendStats()) {
80 80
                 return array();
81 81
             }
82 82
             return $this->stats_gatherer->stats();
@@ -124,9 +124,9 @@  discard block
 block discarded – undo
124 124
      */
125 125
     public static function optinText($extra = true)
126 126
     {
127
-        if (! $extra) {
127
+        if ( ! $extra) {
128 128
             echo '<h2 class="ee-admin-settings-hdr" '
129
-                 . (! $extra ? 'id="UXIP_settings"' : '')
129
+                 . ( ! $extra ? 'id="UXIP_settings"' : '')
130 130
                  . '>'
131 131
                  . esc_html__('User eXperience Improvement Program (UXIP)', 'event_espresso')
132 132
                  . EEH_Template::get_help_tab_link('organization_logo_info')
@@ -157,7 +157,7 @@  discard block
 block discarded – undo
157 157
                 ),
158 158
                 '<a href="https://eventespresso.com/about/user-experience-improvement-program-uxip/" target="_blank">',
159 159
                 '</a>',
160
-                '<a href="' . $settings_url . '" target="_blank">',
160
+                '<a href="'.$settings_url.'" target="_blank">',
161 161
                 '</a>'
162 162
             );
163 163
         }
@@ -171,14 +171,14 @@  discard block
 block discarded – undo
171 171
     {
172 172
         wp_register_script(
173 173
             'ee-data-optin-js',
174
-            EE_GLOBAL_ASSETS_URL . 'scripts/ee-data-optin.js',
174
+            EE_GLOBAL_ASSETS_URL.'scripts/ee-data-optin.js',
175 175
             array('jquery'),
176 176
             EVENT_ESPRESSO_VERSION,
177 177
             true
178 178
         );
179 179
         wp_register_style(
180 180
             'ee-data-optin-css',
181
-            EE_GLOBAL_ASSETS_URL . 'css/ee-data-optin.css',
181
+            EE_GLOBAL_ASSETS_URL.'css/ee-data-optin.css',
182 182
             array(),
183 183
             EVENT_ESPRESSO_VERSION
184 184
         );
@@ -197,7 +197,7 @@  discard block
 block discarded – undo
197 197
         $request = LoaderFactory::getLoader()->getShared(RequestInterface::class);
198 198
         $nonce = $request->getRequestParam('nonce');
199 199
         // verify nonce
200
-        if (! $nonce || ! wp_verify_nonce($nonce, 'ee-data-optin')) {
200
+        if ( ! $nonce || ! wp_verify_nonce($nonce, 'ee-data-optin')) {
201 201
             exit();
202 202
         }
203 203
 
Please login to merge, or discard this patch.