Completed
Branch dependabot/composer/dompdf/dom... (8a3296)
by
unknown
05:51 queued 15s
created
core/db_models/helpers/EE_Unique_Index.php 1 patch
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -6,5 +6,5 @@
 block discarded – undo
6 6
  */
7 7
 class EE_Unique_Index extends EE_Index
8 8
 {
9
-    // yep, actually the same as index right now
9
+	// yep, actually the same as index right now
10 10
 }
Please login to merge, or discard this patch.
core/db_models/helpers/EE_Primary_Key_Index.php 1 patch
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -6,5 +6,5 @@
 block discarded – undo
6 6
  */
7 7
 class EE_Primary_Key_Index extends EE_Unique_Index
8 8
 {
9
-    // yep, actually the same as unique index right now
9
+	// yep, actually the same as unique index right now
10 10
 }
Please login to merge, or discard this patch.
core/db_models/helpers/EE_Model_Query_Info_Carrier.php 2 patches
Indentation   +90 added lines, -90 removed lines patch added patch discarded remove patch
@@ -14,141 +14,141 @@  discard block
 block discarded – undo
14 14
    /**
15 15
     * @var string SQL for performing joins (Eg, "INNER JOIN blah ON blah=blah INNER JOIN FOO ON foo=foo...")
16 16
     */
17
-    private $_join_sql;
17
+	private $_join_sql;
18 18
    /**
19 19
     *
20 20
     * @var array stating all the models that have been included thus far,so we don't get duplicates.
21 21
     * Keys are the model relation chains to them from the queried model
22 22
     * (eg, "Registration.Transaction.Payment"), and valuesare model names (eg "Payment")
23 23
     */
24
-    private $_models_included;
24
+	private $_models_included;
25 25
    
26 26
    /**
27 27
     * After we've acquired all the data types, we can create this sql.
28 28
     * @var string
29 29
     */
30
-    private $_where_sql;
30
+	private $_where_sql;
31 31
    /**
32 32
     * Full join sql. Eg, in a select query, that's everything after the "FROM", and before the "WHERE", so it includes
33 33
     * the declaration of the main model's tables, and then appends all the joining sql to other models
34 34
     * @var string
35 35
     */
36
-    private $_main_join_sql;
36
+	private $_main_join_sql;
37 37
    
38 38
    
39
-    private $_limit_sql;
39
+	private $_limit_sql;
40 40
    
41
-    private $_order_by_sql;
41
+	private $_order_by_sql;
42 42
    
43
-    private $_having_sql;
43
+	private $_having_sql;
44 44
    
45
-    private $_group_by_sql;
45
+	private $_group_by_sql;
46 46
    
47
-    public function set_limit_sql($limit_sql)
48
-    {
49
-        $this->_limit_sql = $limit_sql;
50
-    }
47
+	public function set_limit_sql($limit_sql)
48
+	{
49
+		$this->_limit_sql = $limit_sql;
50
+	}
51 51
     
52
-    public function set_order_by_sql($order_by_sql)
53
-    {
54
-        $this->_order_by_sql = $order_by_sql;
55
-    }
56
-    public function set_group_by_sql($group_by_sql)
57
-    {
58
-        $this->_group_by_sql = $group_by_sql;
59
-    }
60
-    public function set_having_sql($having_sql)
61
-    {
62
-        $this->_having_sql = $having_sql;
63
-    }
64
-    public function get_limit_sql()
65
-    {
66
-        return $this->_limit_sql;
67
-    }
68
-    public function get_order_by_sql()
69
-    {
70
-        return $this->_order_by_sql;
71
-    }
72
-    public function get_group_by_sql()
73
-    {
74
-        return $this->_group_by_sql;
75
-    }
76
-    public function get_having_sql()
77
-    {
78
-        return $this->_having_sql;
79
-    }
52
+	public function set_order_by_sql($order_by_sql)
53
+	{
54
+		$this->_order_by_sql = $order_by_sql;
55
+	}
56
+	public function set_group_by_sql($group_by_sql)
57
+	{
58
+		$this->_group_by_sql = $group_by_sql;
59
+	}
60
+	public function set_having_sql($having_sql)
61
+	{
62
+		$this->_having_sql = $having_sql;
63
+	}
64
+	public function get_limit_sql()
65
+	{
66
+		return $this->_limit_sql;
67
+	}
68
+	public function get_order_by_sql()
69
+	{
70
+		return $this->_order_by_sql;
71
+	}
72
+	public function get_group_by_sql()
73
+	{
74
+		return $this->_group_by_sql;
75
+	}
76
+	public function get_having_sql()
77
+	{
78
+		return $this->_having_sql;
79
+	}
80 80
    /**
81 81
     *
82 82
     * @param type $model_included_name
83 83
     * @param type $join_sql
84 84
     * @param type $data_types
85 85
     */
86
-    public function __construct($model_included_name = array(), $join_sql = '')
87
-    {
88
-        $this->_models_included = $model_included_name;
89
-        $this->_join_sql = $join_sql;
90
-    }
86
+	public function __construct($model_included_name = array(), $join_sql = '')
87
+	{
88
+		$this->_models_included = $model_included_name;
89
+		$this->_join_sql = $join_sql;
90
+	}
91 91
    
92 92
    /**
93 93
     * Merges info from the other EEM_Related_Model_Info_Carrier into this one.
94 94
     * @param EE_Model_Query_Info_Carrier $other_model_query_info_carrier
95 95
     */
96
-    public function merge($other_model_query_info_carrier)
97
-    {
98
-        if ($other_model_query_info_carrier && ! $this->_have_already_included_one_of_these_models($other_model_query_info_carrier->get_model_names_included())) {
99
-            $model_included_on_other_join_sql_and_data_types_carrier =  $other_model_query_info_carrier->get_model_names_included();
100
-            $this->_models_included = array_merge($this->_models_included, $model_included_on_other_join_sql_and_data_types_carrier);
101
-            $this->_join_sql .= $other_model_query_info_carrier->_join_sql;
102
-        }
103
-        // otherwise don't merge our data.
104
-        // yes, this means that we must immediately merge any model data into our grand list
105
-        // as soon as we get some from ONE model, or else we could reject a EEM_Related_Model_Info_Carrier
106
-        // which is carrying info from two models WHERE one is already included but the other is NOT
107
-    }
96
+	public function merge($other_model_query_info_carrier)
97
+	{
98
+		if ($other_model_query_info_carrier && ! $this->_have_already_included_one_of_these_models($other_model_query_info_carrier->get_model_names_included())) {
99
+			$model_included_on_other_join_sql_and_data_types_carrier =  $other_model_query_info_carrier->get_model_names_included();
100
+			$this->_models_included = array_merge($this->_models_included, $model_included_on_other_join_sql_and_data_types_carrier);
101
+			$this->_join_sql .= $other_model_query_info_carrier->_join_sql;
102
+		}
103
+		// otherwise don't merge our data.
104
+		// yes, this means that we must immediately merge any model data into our grand list
105
+		// as soon as we get some from ONE model, or else we could reject a EEM_Related_Model_Info_Carrier
106
+		// which is carrying info from two models WHERE one is already included but the other is NOT
107
+	}
108 108
    /**
109 109
     * Checks whether or not we have already included all the models mentione din $model_names on the query info varrier
110 110
     * @param array $model_names just like EE_MOdel_QUery_Info_Carrier::_models_included: keys are model chain paths, values are the model names only
111 111
     * @return boolean
112 112
     */
113
-    protected function _have_already_included_one_of_these_models($model_names)
114
-    {
115
-        foreach ($this->_models_included as $model_relation_path => $model_included) {
116
-            if (array_key_exists($model_relation_path, $model_names)) {
117
-                return true;
118
-            }
119
-        }
120
-        return false;
121
-    }
113
+	protected function _have_already_included_one_of_these_models($model_names)
114
+	{
115
+		foreach ($this->_models_included as $model_relation_path => $model_included) {
116
+			if (array_key_exists($model_relation_path, $model_names)) {
117
+				return true;
118
+			}
119
+		}
120
+		return false;
121
+	}
122 122
    /**
123 123
     * Array keys are model names, values are "model relation paths". See EE_Model_Query_Info_Carrier::_models_included for details
124 124
     * @return array like EE_Model_Query_Info_Carrier::_models_included
125 125
     */
126
-    public function get_model_names_included()
127
-    {
128
-        return $this->_models_included;
129
-    }
126
+	public function get_model_names_included()
127
+	{
128
+		return $this->_models_included;
129
+	}
130 130
    /**
131 131
     * sets the $where_sql for later use from client code
132 132
     * @param string $where_sql
133 133
     */
134
-    public function set_where_sql($where_sql)
135
-    {
136
-        $this->_where_sql = $where_sql;
137
-    }
138
-    public function get_where_sql()
139
-    {
140
-        return $this->_where_sql;
141
-    }
134
+	public function set_where_sql($where_sql)
135
+	{
136
+		$this->_where_sql = $where_sql;
137
+	}
138
+	public function get_where_sql()
139
+	{
140
+		return $this->_where_sql;
141
+	}
142 142
 
143 143
    /**
144 144
     * Gets the SQL for joining the main model to other models involves in the query, which was set earlier on
145 145
     * the EE_Model_Query_info_Carrier by calling set_main_model_join_sql()
146 146
     * @return string
147 147
     */
148
-    public function get_main_model_join_sql()
149
-    {
150
-        return $this->_main_join_sql;
151
-    }
148
+	public function get_main_model_join_sql()
149
+	{
150
+		return $this->_main_join_sql;
151
+	}
152 152
 
153 153
 
154 154
    /**
@@ -158,12 +158,12 @@  discard block
 block discarded – undo
158 158
     * after the FROM and before the WHERE.)
159 159
     * @param string $join_sql
160 160
     */
161
-    public function set_main_model_join_sql($join_sql)
162
-    {
163
-        $this->_main_join_sql = $join_sql;
164
-    }
165
-    public function get_full_join_sql()
166
-    {
167
-        return $this->_main_join_sql . $this->_join_sql;
168
-    }
161
+	public function set_main_model_join_sql($join_sql)
162
+	{
163
+		$this->_main_join_sql = $join_sql;
164
+	}
165
+	public function get_full_join_sql()
166
+	{
167
+		return $this->_main_join_sql . $this->_join_sql;
168
+	}
169 169
 }
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -96,7 +96,7 @@  discard block
 block discarded – undo
96 96
     public function merge($other_model_query_info_carrier)
97 97
     {
98 98
         if ($other_model_query_info_carrier && ! $this->_have_already_included_one_of_these_models($other_model_query_info_carrier->get_model_names_included())) {
99
-            $model_included_on_other_join_sql_and_data_types_carrier =  $other_model_query_info_carrier->get_model_names_included();
99
+            $model_included_on_other_join_sql_and_data_types_carrier = $other_model_query_info_carrier->get_model_names_included();
100 100
             $this->_models_included = array_merge($this->_models_included, $model_included_on_other_join_sql_and_data_types_carrier);
101 101
             $this->_join_sql .= $other_model_query_info_carrier->_join_sql;
102 102
         }
@@ -164,6 +164,6 @@  discard block
 block discarded – undo
164 164
     }
165 165
     public function get_full_join_sql()
166 166
     {
167
-        return $this->_main_join_sql . $this->_join_sql;
167
+        return $this->_main_join_sql.$this->_join_sql;
168 168
     }
169 169
 }
Please login to merge, or discard this patch.
core/EE_Cart.core.php 2 patches
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -65,14 +65,14 @@  discard block
 block discarded – undo
65 65
             self::$_instance = new self($grand_total, $session);
66 66
         }
67 67
         // or maybe retrieve an existing one ?
68
-        if (! self::$_instance instanceof EE_Cart) {
68
+        if ( ! self::$_instance instanceof EE_Cart) {
69 69
             // try getting the cart out of the session
70 70
             $saved_cart = $session instanceof EE_Session ? $session->cart() : null;
71 71
             self::$_instance = $saved_cart instanceof EE_Cart ? $saved_cart : new self($grand_total, $session);
72 72
             unset($saved_cart);
73 73
         }
74 74
         // verify that cart is ok and grand total line item exists
75
-        if (! self::$_instance instanceof EE_Cart || ! self::$_instance->_grand_total instanceof EE_Line_Item) {
75
+        if ( ! self::$_instance instanceof EE_Cart || ! self::$_instance->_grand_total instanceof EE_Line_Item) {
76 76
             self::$_instance = new self($grand_total, $session);
77 77
         }
78 78
         self::$_instance->get_grand_total();
@@ -124,7 +124,7 @@  discard block
 block discarded – undo
124 124
      */
125 125
     public function session()
126 126
     {
127
-        if (! $this->_session instanceof EE_Session) {
127
+        if ( ! $this->_session instanceof EE_Session) {
128 128
             $this->set_session();
129 129
         }
130 130
         return $this->_session;
@@ -392,7 +392,7 @@  discard block
 block discarded – undo
392 392
 
393 393
     public function __wakeup()
394 394
     {
395
-        if (! $this->_grand_total instanceof EE_Line_Item && absint($this->_grand_total) !== 0) {
395
+        if ( ! $this->_grand_total instanceof EE_Line_Item && absint($this->_grand_total) !== 0) {
396 396
             // $this->_grand_total is actually just an ID, so use it to get the object from the db
397 397
             $this->_grand_total = EEM_Line_Item::instance()->get_one_by_ID($this->_grand_total);
398 398
         }
Please login to merge, or discard this patch.
Indentation   +410 added lines, -410 removed lines patch added patch discarded remove patch
@@ -16,414 +16,414 @@
 block discarded – undo
16 16
  */
17 17
 class EE_Cart implements ResettableInterface
18 18
 {
19
-    /**
20
-     * instance of the EE_Cart object
21
-     *
22
-     * @access    private
23
-     * @var EE_Cart $_instance
24
-     */
25
-    private static $_instance;
26
-
27
-    /**
28
-     * instance of the EE_Session object
29
-     *
30
-     * @access    protected
31
-     * @var EE_Session $_session
32
-     */
33
-    protected $_session;
34
-
35
-    /**
36
-     * The total Line item which comprises all the children line-item subtotals,
37
-     * which in turn each have their line items.
38
-     * Typically, the line item structure will look like:
39
-     * grand total
40
-     * -tickets-sub-total
41
-     * --ticket1
42
-     * --ticket2
43
-     * --...
44
-     * -taxes-sub-total
45
-     * --tax1
46
-     * --tax2
47
-     *
48
-     * @var EE_Line_Item
49
-     */
50
-    private $_grand_total;
51
-
52
-
53
-    /**
54
-     * @singleton method used to instantiate class object
55
-     * @access    public
56
-     * @param EE_Line_Item $grand_total
57
-     * @param EE_Session   $session
58
-     * @return EE_Cart
59
-     * @throws EE_Error
60
-     * @throws ReflectionException
61
-     */
62
-    public static function instance(EE_Line_Item $grand_total = null, EE_Session $session = null)
63
-    {
64
-        if ($grand_total instanceof EE_Line_Item && $grand_total->is_total()) {
65
-            self::$_instance = new self($grand_total, $session);
66
-        }
67
-        // or maybe retrieve an existing one ?
68
-        if (! self::$_instance instanceof EE_Cart) {
69
-            // try getting the cart out of the session
70
-            $saved_cart = $session instanceof EE_Session ? $session->cart() : null;
71
-            self::$_instance = $saved_cart instanceof EE_Cart ? $saved_cart : new self($grand_total, $session);
72
-            unset($saved_cart);
73
-        }
74
-        // verify that cart is ok and grand total line item exists
75
-        if (! self::$_instance instanceof EE_Cart || ! self::$_instance->_grand_total instanceof EE_Line_Item) {
76
-            self::$_instance = new self($grand_total, $session);
77
-        }
78
-        self::$_instance->get_grand_total();
79
-        // once everything is all said and done, save the cart to the EE_Session
80
-        add_action('shutdown', array(self::$_instance, 'save_cart'), 90);
81
-        return self::$_instance;
82
-    }
83
-
84
-
85
-    /**
86
-     * private constructor to prevent direct creation
87
-     *
88
-     * @Constructor
89
-     * @access private
90
-     * @param EE_Line_Item $grand_total
91
-     * @param EE_Session   $session
92
-     */
93
-    private function __construct(EE_Line_Item $grand_total = null, EE_Session $session = null)
94
-    {
95
-        do_action('AHEE_log', __FILE__, __FUNCTION__, '');
96
-        $this->set_session($session);
97
-        if ($grand_total instanceof EE_Line_Item && $grand_total->is_total()) {
98
-            $this->set_grand_total_line_item($grand_total);
99
-        }
100
-    }
101
-
102
-
103
-    /**
104
-     * Resets the cart completely (whereas empty_cart
105
-     *
106
-     * @param EE_Line_Item $grand_total
107
-     * @param EE_Session   $session
108
-     * @return EE_Cart
109
-     * @throws EE_Error
110
-     * @throws ReflectionException
111
-     */
112
-    public static function reset(EE_Line_Item $grand_total = null, EE_Session $session = null)
113
-    {
114
-        remove_action('shutdown', array(self::$_instance, 'save_cart'), 90);
115
-        if ($session instanceof EE_Session) {
116
-            $session->reset_cart();
117
-        }
118
-        self::$_instance = null;
119
-        return self::instance($grand_total, $session);
120
-    }
121
-
122
-
123
-    /**
124
-     * @return EE_Session
125
-     */
126
-    public function session()
127
-    {
128
-        if (! $this->_session instanceof EE_Session) {
129
-            $this->set_session();
130
-        }
131
-        return $this->_session;
132
-    }
133
-
134
-
135
-    /**
136
-     * @param EE_Session $session
137
-     */
138
-    public function set_session(EE_Session $session = null)
139
-    {
140
-        $this->_session = $session instanceof EE_Session ? $session : EE_Registry::instance()->load_core('Session');
141
-    }
142
-
143
-
144
-    /**
145
-     * Sets the cart to match the line item. Especially handy for loading an old cart where you
146
-     *  know the grand total line item on it
147
-     *
148
-     * @param EE_Line_Item $line_item
149
-     */
150
-    public function set_grand_total_line_item(EE_Line_Item $line_item)
151
-    {
152
-        $this->_grand_total = $line_item;
153
-    }
154
-
155
-
156
-    /**
157
-     * get_cart_from_reg_url_link
158
-     *
159
-     * @access public
160
-     * @param EE_Transaction $transaction
161
-     * @param EE_Session     $session
162
-     * @return EE_Cart
163
-     * @throws EE_Error
164
-     * @throws ReflectionException
165
-     */
166
-    public static function get_cart_from_txn(EE_Transaction $transaction, EE_Session $session = null)
167
-    {
168
-        $grand_total = $transaction->total_line_item();
169
-        $grand_total->get_items();
170
-        $grand_total->tax_descendants();
171
-        return EE_Cart::instance($grand_total, $session);
172
-    }
173
-
174
-
175
-    /**
176
-     * Creates the total line item, and ensures it has its 'tickets' and 'taxes' sub-items
177
-     *
178
-     * @return EE_Line_Item
179
-     * @throws EE_Error
180
-     * @throws ReflectionException
181
-     */
182
-    private function _create_grand_total()
183
-    {
184
-        $this->_grand_total = EEH_Line_Item::create_total_line_item();
185
-        return $this->_grand_total;
186
-    }
187
-
188
-
189
-    /**
190
-     * Gets all the line items of object type Ticket
191
-     *
192
-     * @access public
193
-     * @return EE_Line_Item[]
194
-     * @throws EE_Error
195
-     * @throws ReflectionException
196
-     */
197
-    public function get_tickets(): array
198
-    {
199
-        if ($this->_grand_total === null) {
200
-            return array();
201
-        }
202
-        return EEH_Line_Item::get_ticket_line_items($this->_grand_total);
203
-    }
204
-
205
-
206
-    /**
207
-     * returns the total quantity of tickets in the cart
208
-     *
209
-     * @access public
210
-     * @return int
211
-     * @throws EE_Error
212
-     * @throws ReflectionException
213
-     */
214
-    public function all_ticket_quantity_count(): int
215
-    {
216
-        $tickets = $this->get_tickets();
217
-        if (empty($tickets)) {
218
-            return 0;
219
-        }
220
-        $count = 0;
221
-        foreach ($tickets as $ticket) {
222
-            $count += $ticket->quantity();
223
-        }
224
-        return $count;
225
-    }
226
-
227
-
228
-    /**
229
-     * Gets all the tax line items
230
-     *
231
-     * @return EE_Line_Item[]
232
-     * @throws EE_Error
233
-     * @throws ReflectionException
234
-     */
235
-    public function get_taxes()
236
-    {
237
-        return EEH_Line_Item::get_taxes_subtotal($this->_grand_total)->children();
238
-    }
239
-
240
-
241
-    /**
242
-     * Gets the total line item (which is a parent of all other line items) on this cart
243
-     *
244
-     * @return EE_Line_Item
245
-     * @throws EE_Error
246
-     * @throws ReflectionException
247
-     */
248
-    public function get_grand_total()
249
-    {
250
-        return $this->_grand_total instanceof EE_Line_Item ? $this->_grand_total : $this->_create_grand_total();
251
-    }
252
-
253
-
254
-    /**
255
-     * @process items for adding to cart
256
-     * @access  public
257
-     * @param EE_Ticket $ticket
258
-     * @param int       $qty
259
-     * @return bool TRUE on success, FALSE on fail
260
-     * @throws EE_Error
261
-     * @throws ReflectionException
262
-     */
263
-    public function add_ticket_to_cart(EE_Ticket $ticket, $qty = 1)
264
-    {
265
-        EEH_Line_Item::add_ticket_purchase($this->get_grand_total(), $ticket, $qty, false);
266
-        return $this->save_cart();
267
-    }
268
-
269
-
270
-    /**
271
-     * get_cart_total_before_tax
272
-     *
273
-     * @access public
274
-     * @return float
275
-     * @throws EE_Error
276
-     * @throws ReflectionException
277
-     */
278
-    public function get_cart_total_before_tax()
279
-    {
280
-        return $this->get_grand_total()->recalculate_pre_tax_total();
281
-    }
282
-
283
-
284
-    /**
285
-     * gets the total amount of tax paid for items in this cart
286
-     *
287
-     * @access public
288
-     * @return float
289
-     * @throws EE_Error
290
-     * @throws ReflectionException
291
-     */
292
-    public function get_applied_taxes()
293
-    {
294
-        return EEH_Line_Item::ensure_taxes_applied($this->_grand_total);
295
-    }
296
-
297
-
298
-    /**
299
-     * Gets the total amount to be paid for the items in the cart, including taxes and other modifiers
300
-     *
301
-     * @access public
302
-     * @return float
303
-     * @throws EE_Error
304
-     * @throws ReflectionException
305
-     */
306
-    public function get_cart_grand_total()
307
-    {
308
-        EEH_Line_Item::ensure_taxes_applied($this->_grand_total);
309
-        return $this->get_grand_total()->total();
310
-    }
311
-
312
-
313
-    /**
314
-     * Gets the total amount to be paid for the items in the cart, including taxes and other modifiers
315
-     *
316
-     * @access public
317
-     * @return float
318
-     * @throws EE_Error
319
-     * @throws ReflectionException
320
-     */
321
-    public function recalculate_all_cart_totals()
322
-    {
323
-        $pre_tax_total = $this->get_cart_total_before_tax();
324
-        $taxes_total = EEH_Line_Item::ensure_taxes_applied($this->_grand_total);
325
-        $this->_grand_total->set_total($pre_tax_total + $taxes_total);
326
-        $this->_grand_total->save_this_and_descendants_to_txn();
327
-        return $this->get_grand_total()->total();
328
-    }
329
-
330
-
331
-    /**
332
-     * deletes an item from the cart
333
-     *
334
-     * @access public
335
-     * @param array|bool|string $line_item_codes
336
-     * @return int on success, FALSE on fail
337
-     * @throws EE_Error
338
-     * @throws ReflectionException
339
-     */
340
-    public function delete_items($line_item_codes = false)
341
-    {
342
-        do_action('AHEE_log', __FILE__, __FUNCTION__, '');
343
-        return EEH_Line_Item::delete_items($this->get_grand_total(), $line_item_codes);
344
-    }
345
-
346
-
347
-    /**
348
-     * @remove ALL items from cart and zero ALL totals
349
-     * @access public
350
-     * @return bool
351
-     * @throws EE_Error
352
-     * @throws ReflectionException
353
-     */
354
-    public function empty_cart()
355
-    {
356
-        do_action('AHEE_log', __FILE__, __FUNCTION__, '');
357
-        $this->_grand_total = $this->_create_grand_total();
358
-        return $this->save_cart(true);
359
-    }
360
-
361
-
362
-    /**
363
-     * @remove ALL items from cart and delete total as well
364
-     * @access public
365
-     * @return bool
366
-     * @throws EE_Error
367
-     * @throws ReflectionException
368
-     */
369
-    public function delete_cart()
370
-    {
371
-        if ($this->_grand_total instanceof EE_Line_Item) {
372
-            $deleted = EEH_Line_Item::delete_all_child_items($this->_grand_total);
373
-            if ($deleted) {
374
-                $deleted += $this->_grand_total->delete();
375
-                $this->_grand_total = null;
376
-                return true;
377
-            }
378
-        }
379
-        return false;
380
-    }
381
-
382
-
383
-    /**
384
-     * @save   cart to session
385
-     * @access public
386
-     * @param bool $apply_taxes
387
-     * @return bool TRUE on success, FALSE on fail
388
-     * @throws EE_Error
389
-     * @throws ReflectionException
390
-     */
391
-    public function save_cart($apply_taxes = true)
392
-    {
393
-        if ($apply_taxes && $this->_grand_total instanceof EE_Line_Item) {
394
-            EEH_Line_Item::ensure_taxes_applied($this->_grand_total);
395
-            // make sure we don't cache the transaction because it can get stale
396
-            if (
397
-                $this->_grand_total->get_one_from_cache('Transaction') instanceof EE_Transaction
398
-                && $this->_grand_total->get_one_from_cache('Transaction')->ID()
399
-            ) {
400
-                $this->_grand_total->clear_cache('Transaction', null, true);
401
-            }
402
-        }
403
-        if ($this->session() instanceof EE_Session) {
404
-            return $this->session()->set_cart($this);
405
-        }
406
-        return false;
407
-    }
408
-
409
-
410
-    public function __wakeup()
411
-    {
412
-        if (! $this->_grand_total instanceof EE_Line_Item && absint($this->_grand_total) !== 0) {
413
-            // $this->_grand_total is actually just an ID, so use it to get the object from the db
414
-            $this->_grand_total = EEM_Line_Item::instance()->get_one_by_ID($this->_grand_total);
415
-        }
416
-    }
417
-
418
-
419
-    /**
420
-     * @return array
421
-     */
422
-    public function __sleep()
423
-    {
424
-        if ($this->_grand_total instanceof EE_Line_Item && $this->_grand_total->ID()) {
425
-            $this->_grand_total = $this->_grand_total->ID();
426
-        }
427
-        return array('_grand_total');
428
-    }
19
+	/**
20
+	 * instance of the EE_Cart object
21
+	 *
22
+	 * @access    private
23
+	 * @var EE_Cart $_instance
24
+	 */
25
+	private static $_instance;
26
+
27
+	/**
28
+	 * instance of the EE_Session object
29
+	 *
30
+	 * @access    protected
31
+	 * @var EE_Session $_session
32
+	 */
33
+	protected $_session;
34
+
35
+	/**
36
+	 * The total Line item which comprises all the children line-item subtotals,
37
+	 * which in turn each have their line items.
38
+	 * Typically, the line item structure will look like:
39
+	 * grand total
40
+	 * -tickets-sub-total
41
+	 * --ticket1
42
+	 * --ticket2
43
+	 * --...
44
+	 * -taxes-sub-total
45
+	 * --tax1
46
+	 * --tax2
47
+	 *
48
+	 * @var EE_Line_Item
49
+	 */
50
+	private $_grand_total;
51
+
52
+
53
+	/**
54
+	 * @singleton method used to instantiate class object
55
+	 * @access    public
56
+	 * @param EE_Line_Item $grand_total
57
+	 * @param EE_Session   $session
58
+	 * @return EE_Cart
59
+	 * @throws EE_Error
60
+	 * @throws ReflectionException
61
+	 */
62
+	public static function instance(EE_Line_Item $grand_total = null, EE_Session $session = null)
63
+	{
64
+		if ($grand_total instanceof EE_Line_Item && $grand_total->is_total()) {
65
+			self::$_instance = new self($grand_total, $session);
66
+		}
67
+		// or maybe retrieve an existing one ?
68
+		if (! self::$_instance instanceof EE_Cart) {
69
+			// try getting the cart out of the session
70
+			$saved_cart = $session instanceof EE_Session ? $session->cart() : null;
71
+			self::$_instance = $saved_cart instanceof EE_Cart ? $saved_cart : new self($grand_total, $session);
72
+			unset($saved_cart);
73
+		}
74
+		// verify that cart is ok and grand total line item exists
75
+		if (! self::$_instance instanceof EE_Cart || ! self::$_instance->_grand_total instanceof EE_Line_Item) {
76
+			self::$_instance = new self($grand_total, $session);
77
+		}
78
+		self::$_instance->get_grand_total();
79
+		// once everything is all said and done, save the cart to the EE_Session
80
+		add_action('shutdown', array(self::$_instance, 'save_cart'), 90);
81
+		return self::$_instance;
82
+	}
83
+
84
+
85
+	/**
86
+	 * private constructor to prevent direct creation
87
+	 *
88
+	 * @Constructor
89
+	 * @access private
90
+	 * @param EE_Line_Item $grand_total
91
+	 * @param EE_Session   $session
92
+	 */
93
+	private function __construct(EE_Line_Item $grand_total = null, EE_Session $session = null)
94
+	{
95
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
96
+		$this->set_session($session);
97
+		if ($grand_total instanceof EE_Line_Item && $grand_total->is_total()) {
98
+			$this->set_grand_total_line_item($grand_total);
99
+		}
100
+	}
101
+
102
+
103
+	/**
104
+	 * Resets the cart completely (whereas empty_cart
105
+	 *
106
+	 * @param EE_Line_Item $grand_total
107
+	 * @param EE_Session   $session
108
+	 * @return EE_Cart
109
+	 * @throws EE_Error
110
+	 * @throws ReflectionException
111
+	 */
112
+	public static function reset(EE_Line_Item $grand_total = null, EE_Session $session = null)
113
+	{
114
+		remove_action('shutdown', array(self::$_instance, 'save_cart'), 90);
115
+		if ($session instanceof EE_Session) {
116
+			$session->reset_cart();
117
+		}
118
+		self::$_instance = null;
119
+		return self::instance($grand_total, $session);
120
+	}
121
+
122
+
123
+	/**
124
+	 * @return EE_Session
125
+	 */
126
+	public function session()
127
+	{
128
+		if (! $this->_session instanceof EE_Session) {
129
+			$this->set_session();
130
+		}
131
+		return $this->_session;
132
+	}
133
+
134
+
135
+	/**
136
+	 * @param EE_Session $session
137
+	 */
138
+	public function set_session(EE_Session $session = null)
139
+	{
140
+		$this->_session = $session instanceof EE_Session ? $session : EE_Registry::instance()->load_core('Session');
141
+	}
142
+
143
+
144
+	/**
145
+	 * Sets the cart to match the line item. Especially handy for loading an old cart where you
146
+	 *  know the grand total line item on it
147
+	 *
148
+	 * @param EE_Line_Item $line_item
149
+	 */
150
+	public function set_grand_total_line_item(EE_Line_Item $line_item)
151
+	{
152
+		$this->_grand_total = $line_item;
153
+	}
154
+
155
+
156
+	/**
157
+	 * get_cart_from_reg_url_link
158
+	 *
159
+	 * @access public
160
+	 * @param EE_Transaction $transaction
161
+	 * @param EE_Session     $session
162
+	 * @return EE_Cart
163
+	 * @throws EE_Error
164
+	 * @throws ReflectionException
165
+	 */
166
+	public static function get_cart_from_txn(EE_Transaction $transaction, EE_Session $session = null)
167
+	{
168
+		$grand_total = $transaction->total_line_item();
169
+		$grand_total->get_items();
170
+		$grand_total->tax_descendants();
171
+		return EE_Cart::instance($grand_total, $session);
172
+	}
173
+
174
+
175
+	/**
176
+	 * Creates the total line item, and ensures it has its 'tickets' and 'taxes' sub-items
177
+	 *
178
+	 * @return EE_Line_Item
179
+	 * @throws EE_Error
180
+	 * @throws ReflectionException
181
+	 */
182
+	private function _create_grand_total()
183
+	{
184
+		$this->_grand_total = EEH_Line_Item::create_total_line_item();
185
+		return $this->_grand_total;
186
+	}
187
+
188
+
189
+	/**
190
+	 * Gets all the line items of object type Ticket
191
+	 *
192
+	 * @access public
193
+	 * @return EE_Line_Item[]
194
+	 * @throws EE_Error
195
+	 * @throws ReflectionException
196
+	 */
197
+	public function get_tickets(): array
198
+	{
199
+		if ($this->_grand_total === null) {
200
+			return array();
201
+		}
202
+		return EEH_Line_Item::get_ticket_line_items($this->_grand_total);
203
+	}
204
+
205
+
206
+	/**
207
+	 * returns the total quantity of tickets in the cart
208
+	 *
209
+	 * @access public
210
+	 * @return int
211
+	 * @throws EE_Error
212
+	 * @throws ReflectionException
213
+	 */
214
+	public function all_ticket_quantity_count(): int
215
+	{
216
+		$tickets = $this->get_tickets();
217
+		if (empty($tickets)) {
218
+			return 0;
219
+		}
220
+		$count = 0;
221
+		foreach ($tickets as $ticket) {
222
+			$count += $ticket->quantity();
223
+		}
224
+		return $count;
225
+	}
226
+
227
+
228
+	/**
229
+	 * Gets all the tax line items
230
+	 *
231
+	 * @return EE_Line_Item[]
232
+	 * @throws EE_Error
233
+	 * @throws ReflectionException
234
+	 */
235
+	public function get_taxes()
236
+	{
237
+		return EEH_Line_Item::get_taxes_subtotal($this->_grand_total)->children();
238
+	}
239
+
240
+
241
+	/**
242
+	 * Gets the total line item (which is a parent of all other line items) on this cart
243
+	 *
244
+	 * @return EE_Line_Item
245
+	 * @throws EE_Error
246
+	 * @throws ReflectionException
247
+	 */
248
+	public function get_grand_total()
249
+	{
250
+		return $this->_grand_total instanceof EE_Line_Item ? $this->_grand_total : $this->_create_grand_total();
251
+	}
252
+
253
+
254
+	/**
255
+	 * @process items for adding to cart
256
+	 * @access  public
257
+	 * @param EE_Ticket $ticket
258
+	 * @param int       $qty
259
+	 * @return bool TRUE on success, FALSE on fail
260
+	 * @throws EE_Error
261
+	 * @throws ReflectionException
262
+	 */
263
+	public function add_ticket_to_cart(EE_Ticket $ticket, $qty = 1)
264
+	{
265
+		EEH_Line_Item::add_ticket_purchase($this->get_grand_total(), $ticket, $qty, false);
266
+		return $this->save_cart();
267
+	}
268
+
269
+
270
+	/**
271
+	 * get_cart_total_before_tax
272
+	 *
273
+	 * @access public
274
+	 * @return float
275
+	 * @throws EE_Error
276
+	 * @throws ReflectionException
277
+	 */
278
+	public function get_cart_total_before_tax()
279
+	{
280
+		return $this->get_grand_total()->recalculate_pre_tax_total();
281
+	}
282
+
283
+
284
+	/**
285
+	 * gets the total amount of tax paid for items in this cart
286
+	 *
287
+	 * @access public
288
+	 * @return float
289
+	 * @throws EE_Error
290
+	 * @throws ReflectionException
291
+	 */
292
+	public function get_applied_taxes()
293
+	{
294
+		return EEH_Line_Item::ensure_taxes_applied($this->_grand_total);
295
+	}
296
+
297
+
298
+	/**
299
+	 * Gets the total amount to be paid for the items in the cart, including taxes and other modifiers
300
+	 *
301
+	 * @access public
302
+	 * @return float
303
+	 * @throws EE_Error
304
+	 * @throws ReflectionException
305
+	 */
306
+	public function get_cart_grand_total()
307
+	{
308
+		EEH_Line_Item::ensure_taxes_applied($this->_grand_total);
309
+		return $this->get_grand_total()->total();
310
+	}
311
+
312
+
313
+	/**
314
+	 * Gets the total amount to be paid for the items in the cart, including taxes and other modifiers
315
+	 *
316
+	 * @access public
317
+	 * @return float
318
+	 * @throws EE_Error
319
+	 * @throws ReflectionException
320
+	 */
321
+	public function recalculate_all_cart_totals()
322
+	{
323
+		$pre_tax_total = $this->get_cart_total_before_tax();
324
+		$taxes_total = EEH_Line_Item::ensure_taxes_applied($this->_grand_total);
325
+		$this->_grand_total->set_total($pre_tax_total + $taxes_total);
326
+		$this->_grand_total->save_this_and_descendants_to_txn();
327
+		return $this->get_grand_total()->total();
328
+	}
329
+
330
+
331
+	/**
332
+	 * deletes an item from the cart
333
+	 *
334
+	 * @access public
335
+	 * @param array|bool|string $line_item_codes
336
+	 * @return int on success, FALSE on fail
337
+	 * @throws EE_Error
338
+	 * @throws ReflectionException
339
+	 */
340
+	public function delete_items($line_item_codes = false)
341
+	{
342
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
343
+		return EEH_Line_Item::delete_items($this->get_grand_total(), $line_item_codes);
344
+	}
345
+
346
+
347
+	/**
348
+	 * @remove ALL items from cart and zero ALL totals
349
+	 * @access public
350
+	 * @return bool
351
+	 * @throws EE_Error
352
+	 * @throws ReflectionException
353
+	 */
354
+	public function empty_cart()
355
+	{
356
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
357
+		$this->_grand_total = $this->_create_grand_total();
358
+		return $this->save_cart(true);
359
+	}
360
+
361
+
362
+	/**
363
+	 * @remove ALL items from cart and delete total as well
364
+	 * @access public
365
+	 * @return bool
366
+	 * @throws EE_Error
367
+	 * @throws ReflectionException
368
+	 */
369
+	public function delete_cart()
370
+	{
371
+		if ($this->_grand_total instanceof EE_Line_Item) {
372
+			$deleted = EEH_Line_Item::delete_all_child_items($this->_grand_total);
373
+			if ($deleted) {
374
+				$deleted += $this->_grand_total->delete();
375
+				$this->_grand_total = null;
376
+				return true;
377
+			}
378
+		}
379
+		return false;
380
+	}
381
+
382
+
383
+	/**
384
+	 * @save   cart to session
385
+	 * @access public
386
+	 * @param bool $apply_taxes
387
+	 * @return bool TRUE on success, FALSE on fail
388
+	 * @throws EE_Error
389
+	 * @throws ReflectionException
390
+	 */
391
+	public function save_cart($apply_taxes = true)
392
+	{
393
+		if ($apply_taxes && $this->_grand_total instanceof EE_Line_Item) {
394
+			EEH_Line_Item::ensure_taxes_applied($this->_grand_total);
395
+			// make sure we don't cache the transaction because it can get stale
396
+			if (
397
+				$this->_grand_total->get_one_from_cache('Transaction') instanceof EE_Transaction
398
+				&& $this->_grand_total->get_one_from_cache('Transaction')->ID()
399
+			) {
400
+				$this->_grand_total->clear_cache('Transaction', null, true);
401
+			}
402
+		}
403
+		if ($this->session() instanceof EE_Session) {
404
+			return $this->session()->set_cart($this);
405
+		}
406
+		return false;
407
+	}
408
+
409
+
410
+	public function __wakeup()
411
+	{
412
+		if (! $this->_grand_total instanceof EE_Line_Item && absint($this->_grand_total) !== 0) {
413
+			// $this->_grand_total is actually just an ID, so use it to get the object from the db
414
+			$this->_grand_total = EEM_Line_Item::instance()->get_one_by_ID($this->_grand_total);
415
+		}
416
+	}
417
+
418
+
419
+	/**
420
+	 * @return array
421
+	 */
422
+	public function __sleep()
423
+	{
424
+		if ($this->_grand_total instanceof EE_Line_Item && $this->_grand_total->ID()) {
425
+			$this->_grand_total = $this->_grand_total->ID();
426
+		}
427
+		return array('_grand_total');
428
+	}
429 429
 }
Please login to merge, or discard this patch.
core/helpers/EEH_Formatter.helper.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -46,7 +46,7 @@  discard block
 block discarded – undo
46 46
             return htmlspecialchars($string);
47 47
         } else {
48 48
             if ($translate === false) {
49
-                return self::ee_tep_parse_input_field_data($string, array( '"' => '"' ));
49
+                return self::ee_tep_parse_input_field_data($string, array('"' => '"'));
50 50
             } else {
51 51
                 return self::ee_tep_parse_input_field_data($string, $translate);
52 52
             }
@@ -84,7 +84,7 @@  discard block
 block discarded – undo
84 84
                 return false;
85 85
             }
86 86
         } else {
87
-            if (( $value !== '' ) && ( strtolower($value) !== 'null' ) && ( strlen(trim($value)) > 0 )) {
87
+            if (($value !== '') && (strtolower($value) !== 'null') && (strlen(trim($value)) > 0)) {
88 88
                 return true;
89 89
             } else {
90 90
                 return false;
Please login to merge, or discard this patch.
Indentation   +92 added lines, -92 removed lines patch added patch discarded remove patch
@@ -10,108 +10,108 @@
 block discarded – undo
10 10
  */
11 11
 class EEH_Formatter
12 12
 {
13
-    /**
14
-     * _admin_format_content
15
-     * Text formatting function for wp_editor.
16
-     * This should fix all of the formatting issues of text output from the database.
17
-     *
18
-     * @static
19
-     * @access public
20
-     * @param  string $content content to format
21
-     * @return string          formatted content
22
-     */
23
-    public static function admin_format_content($content = '')
24
-    {
25
-        return wpautop(stripslashes_deep(html_entity_decode($content, ENT_QUOTES, "UTF-8")));
26
-    }
13
+	/**
14
+	 * _admin_format_content
15
+	 * Text formatting function for wp_editor.
16
+	 * This should fix all of the formatting issues of text output from the database.
17
+	 *
18
+	 * @static
19
+	 * @access public
20
+	 * @param  string $content content to format
21
+	 * @return string          formatted content
22
+	 */
23
+	public static function admin_format_content($content = '')
24
+	{
25
+		return wpautop(stripslashes_deep(html_entity_decode($content, ENT_QUOTES, "UTF-8")));
26
+	}
27 27
 
28 28
 
29 29
 
30
-    /**
31
-     * ee_tep_output_string
32
-     * todo: we need a description for this.
33
-     *
34
-     * @static
35
-     * @access public
36
-     * @param  string  $string    string to handle
37
-     * @param  boolean $translate //todo what is this for?
38
-     * @param  boolean $protected true then we run htmlspecialchars and return
39
-     * @return string
40
-     */
41
-    public static function ee_tep_output_string($string, $translate = false, $protected = false)
42
-    {
43
-        if ($protected === true) {
44
-            return htmlspecialchars($string);
45
-        } else {
46
-            if ($translate === false) {
47
-                return self::ee_tep_parse_input_field_data($string, array( '"' => '"' ));
48
-            } else {
49
-                return self::ee_tep_parse_input_field_data($string, $translate);
50
-            }
51
-        }
52
-    }
30
+	/**
31
+	 * ee_tep_output_string
32
+	 * todo: we need a description for this.
33
+	 *
34
+	 * @static
35
+	 * @access public
36
+	 * @param  string  $string    string to handle
37
+	 * @param  boolean $translate //todo what is this for?
38
+	 * @param  boolean $protected true then we run htmlspecialchars and return
39
+	 * @return string
40
+	 */
41
+	public static function ee_tep_output_string($string, $translate = false, $protected = false)
42
+	{
43
+		if ($protected === true) {
44
+			return htmlspecialchars($string);
45
+		} else {
46
+			if ($translate === false) {
47
+				return self::ee_tep_parse_input_field_data($string, array( '"' => '"' ));
48
+			} else {
49
+				return self::ee_tep_parse_input_field_data($string, $translate);
50
+			}
51
+		}
52
+	}
53 53
 
54 54
 
55 55
 
56
-    /**
57
-     * ee_tep_parse_input_field_data
58
-     *
59
-     * @param  string $data string to be "translated"
60
-     * @param         array ] $parse array in the form array( 'from' => 'to', ... )
61
-     * @return string
62
-     */
63
-    public static function ee_tep_parse_input_field_data($data, $parse)
64
-    {
65
-        return strtr(trim($data), $parse);
66
-    }
56
+	/**
57
+	 * ee_tep_parse_input_field_data
58
+	 *
59
+	 * @param  string $data string to be "translated"
60
+	 * @param         array ] $parse array in the form array( 'from' => 'to', ... )
61
+	 * @return string
62
+	 */
63
+	public static function ee_tep_parse_input_field_data($data, $parse)
64
+	{
65
+		return strtr(trim($data), $parse);
66
+	}
67 67
 
68 68
 
69 69
 
70
-    /**
71
-     * [ee_tep_not_null description]
72
-     *
73
-     * @param  string | array $value [description]
74
-     * @return bool       [description]
75
-     */
76
-    public static function ee_tep_not_null($value)
77
-    {
78
-        if (is_array($value)) {
79
-            if (count($value) > 0) {
80
-                return true;
81
-            } else {
82
-                return false;
83
-            }
84
-        } else {
85
-            if (( $value !== '' ) && ( strtolower($value) !== 'null' ) && ( strlen(trim($value)) > 0 )) {
86
-                return true;
87
-            } else {
88
-                return false;
89
-            }
90
-        }
91
-    }
70
+	/**
71
+	 * [ee_tep_not_null description]
72
+	 *
73
+	 * @param  string | array $value [description]
74
+	 * @return bool       [description]
75
+	 */
76
+	public static function ee_tep_not_null($value)
77
+	{
78
+		if (is_array($value)) {
79
+			if (count($value) > 0) {
80
+				return true;
81
+			} else {
82
+				return false;
83
+			}
84
+		} else {
85
+			if (( $value !== '' ) && ( strtolower($value) !== 'null' ) && ( strlen(trim($value)) > 0 )) {
86
+				return true;
87
+			} else {
88
+				return false;
89
+			}
90
+		}
91
+	}
92 92
 
93 93
 
94 94
 
95
-    /**
96
-     * Formats a date
97
-     *
98
-     * @param string $date
99
-     * @param string $format - format for the date
100
-     * @deprecated 4.6.12  Note, a search revealed this was not used anywhere in core or in our
101
-     *                       addons at time of writing this.  So just deprecated in case of third party use.
102
-     * @return string
103
-     * @deprecated v4.6.21
104
-     */
105
-    public static function event_date_display($date, $format = '')
106
-    {
107
-        EE_Error::doing_it_wrong(
108
-            __METHOD__,
109
-            esc_html__(
110
-                'This method is deprecated as of EE 4.6.12.  Currently it does not reformat as with prior behaviour but just returns the incoming string.  Please use the EE_Datetime helpers for Datetime on the event to display as desired.',
111
-                'event_espresso'
112
-            ),
113
-            '4.6.21'
114
-        );
115
-        return $date;
116
-    }
95
+	/**
96
+	 * Formats a date
97
+	 *
98
+	 * @param string $date
99
+	 * @param string $format - format for the date
100
+	 * @deprecated 4.6.12  Note, a search revealed this was not used anywhere in core or in our
101
+	 *                       addons at time of writing this.  So just deprecated in case of third party use.
102
+	 * @return string
103
+	 * @deprecated v4.6.21
104
+	 */
105
+	public static function event_date_display($date, $format = '')
106
+	{
107
+		EE_Error::doing_it_wrong(
108
+			__METHOD__,
109
+			esc_html__(
110
+				'This method is deprecated as of EE 4.6.12.  Currently it does not reformat as with prior behaviour but just returns the incoming string.  Please use the EE_Datetime helpers for Datetime on the event to display as desired.',
111
+				'event_espresso'
112
+			),
113
+			'4.6.21'
114
+		);
115
+		return $date;
116
+	}
117 117
 }
Please login to merge, or discard this patch.
Paypal_Standard/templates/paypal_standard_intro.template.php 1 patch
Indentation   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -3,13 +3,13 @@
 block discarded – undo
3 3
 // if this is decaf, which is put on WordPress.org, we need to inform users that
4 4
 // we just put an affiliate link there. See https://developer.wordpress.org/plugins/wordpress-org/detailed-plugin-guidelines/ section 12
5 5
 if (apply_filters('FHEE__ee_show_affiliate_links', true)) {
6
-    $closing_tag .= esc_html__(' (affiliate link)', 'event_espresso');
6
+	$closing_tag .= esc_html__(' (affiliate link)', 'event_espresso');
7 7
 }
8 8
 printf(
9
-    esc_html__(
10
-        'PayPal Standard (PayPal Payments Standard) is an off-site payment method and is available to event organizers in many countries. A PayPal premier or business account is needed to accept payments. Need a PayPal account? Call 1-855-456-1338 or %1$sclick here to sign up for a merchant account%2$s.',
11
-        'event_espresso'
12
-    ),
13
-    '<a href="https://eventespresso.com/go/paypalstandard/" target="_blank">',
14
-    $closing_tag
9
+	esc_html__(
10
+		'PayPal Standard (PayPal Payments Standard) is an off-site payment method and is available to event organizers in many countries. A PayPal premier or business account is needed to accept payments. Need a PayPal account? Call 1-855-456-1338 or %1$sclick here to sign up for a merchant account%2$s.',
11
+		'event_espresso'
12
+	),
13
+	'<a href="https://eventespresso.com/go/paypalstandard/" target="_blank">',
14
+	$closing_tag
15 15
 );
Please login to merge, or discard this patch.
admin/extend/support/templates/support_admin_details_faq.template.php 1 patch
Indentation   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -4,14 +4,14 @@
 block discarded – undo
4 4
     <h4><?php esc_html_e('New to Event Espresso?', 'event_espresso'); ?></h4>
5 5
 
6 6
     <p><?php
7
-        printf(
8
-            esc_html__(
9
-                'Check out the %1$squick start guide for Event Espresso 4%2$s. It has recommendations, tips, and tutorials so you can get your project started %3$squicker%4$s.',
10
-                'event_espresso'
11
-            ),
12
-            '<a href="https://eventespresso.com/wiki/welcome-to-event-espresso/#event-espresso-4" target="_blank">',
13
-            '</a>',
14
-            '<em>',
15
-            '</em>'
16
-        ); ?></p>
7
+		printf(
8
+			esc_html__(
9
+				'Check out the %1$squick start guide for Event Espresso 4%2$s. It has recommendations, tips, and tutorials so you can get your project started %3$squicker%4$s.',
10
+				'event_espresso'
11
+			),
12
+			'<a href="https://eventespresso.com/wiki/welcome-to-event-espresso/#event-espresso-4" target="_blank">',
13
+			'</a>',
14
+			'<em>',
15
+			'</em>'
16
+		); ?></p>
17 17
 </div>
18 18
\ No newline at end of file
Please login to merge, or discard this patch.
message_type/newsletter/EE_Messages_Email_Newsletter_Validator.class.php 2 patches
Indentation   +65 added lines, -65 removed lines patch added patch discarded remove patch
@@ -11,72 +11,72 @@
 block discarded – undo
11 11
  */
12 12
 class EE_Messages_Email_Newsletter_Validator extends EE_Messages_Validator
13 13
 {
14
-    /**
15
-     * EE_Messages_Email_Newsletter_Validator constructor.
16
-     *
17
-     * @param array $fields
18
-     * @param string $context
19
-     * @throws EE_Error
20
-     * @throws ReflectionException
21
-     */
22
-    public function __construct(array $fields, $context)
23
-    {
24
-        $this->_m_name = 'email';
25
-        $this->_mt_name = 'newsletter';
14
+	/**
15
+	 * EE_Messages_Email_Newsletter_Validator constructor.
16
+	 *
17
+	 * @param array $fields
18
+	 * @param string $context
19
+	 * @throws EE_Error
20
+	 * @throws ReflectionException
21
+	 */
22
+	public function __construct(array $fields, $context)
23
+	{
24
+		$this->_m_name = 'email';
25
+		$this->_mt_name = 'newsletter';
26 26
 
27
-        parent::__construct($fields, $context);
28
-    }
27
+		parent::__construct($fields, $context);
28
+	}
29 29
 
30
-    /**
31
-     * custom validator (restricting what was originally set by the messenger)
32
-     */
33
-    protected function _modify_validator()
34
-    {
35
-        if ($this->_context === 'attendee') {
36
-            $this->_valid_shortcodes_modifier[ $this->_context ]['from'] = array(
37
-                'recipient_details',
38
-                'email',
39
-                'organization',
40
-            );
41
-        }
30
+	/**
31
+	 * custom validator (restricting what was originally set by the messenger)
32
+	 */
33
+	protected function _modify_validator()
34
+	{
35
+		if ($this->_context === 'attendee') {
36
+			$this->_valid_shortcodes_modifier[ $this->_context ]['from'] = array(
37
+				'recipient_details',
38
+				'email',
39
+				'organization',
40
+			);
41
+		}
42 42
 
43
-        // excluded shortcodes
44
-        $fields = array('to', 'from', 'subject', 'content', 'newsletter_content');
45
-        foreach ($fields as $field) {
46
-            $this->_specific_shortcode_excludes[ $field ] = array(
47
-                '[RECIPIENT_REGISTRATION_CODE]',
48
-                '[EVENT_AUTHOR_FORMATTED_EMAIL]',
49
-                '[EVENT_AUTHOR_EMAIL]',
50
-            );
51
-        }
52
-        $add_excludes = array(
53
-            '[RECIPIENT_FNAME]',
54
-            '[RECIPIENT_LNAME]',
55
-            '[RECIPIENT_EMAIL]',
56
-            '[COMPANY]',
57
-            '[CO_ADD1]',
58
-            '[CO_ADD2]',
59
-            '[CO_CITY]',
60
-            '[CO_STATE]',
61
-            '[CO_ZIP]',
62
-            '[CO_LOGO]',
63
-            '[CO_PHONE]',
64
-            '[CO_LOGO_URL]',
65
-            '[CO_FACEBOOK_URL]',
66
-            '[CO_TWITTER_URL]',
67
-            '[CO_PINTEREST_URL]',
68
-            '[CO_GOOGLE_URL]',
69
-            '[CO_LINKEDIN_URL]',
70
-            '[CO_INSTAGRAM_URL]',
71
-        );
72
-        $this->_specific_shortcode_excludes['from'] =
73
-            array_merge(
74
-                $this->_specific_shortcode_excludes['from'],
75
-                $add_excludes
76
-            );
77
-        $this->_specific_shortcode_excludes['content'] = array_merge(
78
-            $this->_specific_shortcode_excludes['content'],
79
-            array('[DISPLAY_PDF_URL]', '[DISPLAY_PDF_BUTTON]')
80
-        );
81
-    }
43
+		// excluded shortcodes
44
+		$fields = array('to', 'from', 'subject', 'content', 'newsletter_content');
45
+		foreach ($fields as $field) {
46
+			$this->_specific_shortcode_excludes[ $field ] = array(
47
+				'[RECIPIENT_REGISTRATION_CODE]',
48
+				'[EVENT_AUTHOR_FORMATTED_EMAIL]',
49
+				'[EVENT_AUTHOR_EMAIL]',
50
+			);
51
+		}
52
+		$add_excludes = array(
53
+			'[RECIPIENT_FNAME]',
54
+			'[RECIPIENT_LNAME]',
55
+			'[RECIPIENT_EMAIL]',
56
+			'[COMPANY]',
57
+			'[CO_ADD1]',
58
+			'[CO_ADD2]',
59
+			'[CO_CITY]',
60
+			'[CO_STATE]',
61
+			'[CO_ZIP]',
62
+			'[CO_LOGO]',
63
+			'[CO_PHONE]',
64
+			'[CO_LOGO_URL]',
65
+			'[CO_FACEBOOK_URL]',
66
+			'[CO_TWITTER_URL]',
67
+			'[CO_PINTEREST_URL]',
68
+			'[CO_GOOGLE_URL]',
69
+			'[CO_LINKEDIN_URL]',
70
+			'[CO_INSTAGRAM_URL]',
71
+		);
72
+		$this->_specific_shortcode_excludes['from'] =
73
+			array_merge(
74
+				$this->_specific_shortcode_excludes['from'],
75
+				$add_excludes
76
+			);
77
+		$this->_specific_shortcode_excludes['content'] = array_merge(
78
+			$this->_specific_shortcode_excludes['content'],
79
+			array('[DISPLAY_PDF_URL]', '[DISPLAY_PDF_BUTTON]')
80
+		);
81
+	}
82 82
 }
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
     protected function _modify_validator()
34 34
     {
35 35
         if ($this->_context === 'attendee') {
36
-            $this->_valid_shortcodes_modifier[ $this->_context ]['from'] = array(
36
+            $this->_valid_shortcodes_modifier[$this->_context]['from'] = array(
37 37
                 'recipient_details',
38 38
                 'email',
39 39
                 'organization',
@@ -43,7 +43,7 @@  discard block
 block discarded – undo
43 43
         // excluded shortcodes
44 44
         $fields = array('to', 'from', 'subject', 'content', 'newsletter_content');
45 45
         foreach ($fields as $field) {
46
-            $this->_specific_shortcode_excludes[ $field ] = array(
46
+            $this->_specific_shortcode_excludes[$field] = array(
47 47
                 '[RECIPIENT_REGISTRATION_CODE]',
48 48
                 '[EVENT_AUTHOR_FORMATTED_EMAIL]',
49 49
                 '[EVENT_AUTHOR_EMAIL]',
Please login to merge, or discard this patch.
messages/message_type/newsletter/EE_Newsletter_message_type.class.php 2 patches
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -114,11 +114,11 @@  discard block
 block discarded – undo
114 114
 
115 115
         foreach ($this->_valid_shortcodes as $context => $shortcodes) {
116 116
             foreach ($shortcodes as $key => $shortcode) {
117
-                if (! in_array($shortcode, $included_shortcodes, true)) {
118
-                    unset($this->_valid_shortcodes[ $context ][ $key ]);
117
+                if ( ! in_array($shortcode, $included_shortcodes, true)) {
118
+                    unset($this->_valid_shortcodes[$context][$key]);
119 119
                 }
120 120
             }
121
-            $this->_valid_shortcodes[ $context ][] = 'newsletter';
121
+            $this->_valid_shortcodes[$context][] = 'newsletter';
122 122
         }
123 123
     }
124 124
 
@@ -148,23 +148,23 @@  discard block
 block discarded – undo
148 148
                 ? $details['att_obj']
149 149
                 : null;
150 150
 
151
-            if (! $attendee instanceof EE_Attendee) {
151
+            if ( ! $attendee instanceof EE_Attendee) {
152 152
                 continue;
153 153
             }
154 154
 
155 155
             // set $aee from attendee object
156 156
             $aee['att_obj'] = $attendee;
157
-            $aee['reg_objs'] = isset($this->_data->attendees[ $attendee->ID() ]['reg_objs'])
158
-                ? $this->_data->attendees[ $attendee->ID() ]['reg_objs']
157
+            $aee['reg_objs'] = isset($this->_data->attendees[$attendee->ID()]['reg_objs'])
158
+                ? $this->_data->attendees[$attendee->ID()]['reg_objs']
159 159
                 : array();
160 160
             $aee['attendee_email'] = $attendee->email();
161
-            $aee['tkt_objs'] = isset($this->_data->attendees[ $attendee->ID() ]['tkt_objs'])
162
-                ? $this->_data->attendees[ $attendee->ID() ]['tkt_objs']
161
+            $aee['tkt_objs'] = isset($this->_data->attendees[$attendee->ID()]['tkt_objs'])
162
+                ? $this->_data->attendees[$attendee->ID()]['tkt_objs']
163 163
                 : array();
164 164
 
165
-            if (isset($this->_data->attendees[ $attendee->ID() ]['evt_objs'])) {
166
-                $aee['evt_objs'] = $this->_data->attendees[ $attendee->ID() ]['evt_objs'];
167
-                $aee['events'] = $this->_data->attendees[ $attendee->ID() ]['evt_objs'];
165
+            if (isset($this->_data->attendees[$attendee->ID()]['evt_objs'])) {
166
+                $aee['evt_objs'] = $this->_data->attendees[$attendee->ID()]['evt_objs'];
167
+                $aee['events'] = $this->_data->attendees[$attendee->ID()]['evt_objs'];
168 168
             } else {
169 169
                 $aee['evt_objs'] = $aee['events'] = array();
170 170
             }
@@ -199,8 +199,8 @@  discard block
 block discarded – undo
199 199
         $excluded_fields = array(
200 200
             'email' => array('cc')
201 201
         );
202
-        return isset($excluded_fields[ $messenger_name ])
203
-            ? $excluded_fields[ $messenger_name ]
202
+        return isset($excluded_fields[$messenger_name])
203
+            ? $excluded_fields[$messenger_name]
204 204
             : parent::excludedFieldsForMessenger($messenger_name);
205 205
     }
206 206
 }
Please login to merge, or discard this patch.
Indentation   +190 added lines, -190 removed lines patch added patch discarded remove patch
@@ -12,194 +12,194 @@
 block discarded – undo
12 12
  */
13 13
 class EE_Newsletter_message_type extends EE_message_type
14 14
 {
15
-    public function __construct()
16
-    {
17
-        $this->name = 'newsletter';
18
-        $this->description = esc_html__(
19
-            'Batch message type messages are triggered manually by the admin for sending notifications to a selected group of recipients. This should only be used for more general notification type messages that contain information specific for the recipients. For "newsletter" type messages we recommend using an email list service like MailChimp, because sending non-related mail-outs to contacts increases the risk of your site domain getting added to spam lists, which will prevent messages getting to users.',
20
-            'event_espresso'
21
-        );
22
-        $this->label = array(
23
-            'singular' => esc_html__('batch', 'event_espresso'),
24
-            'plural'   => esc_html__('batches', 'event_espresso'),
25
-        );
26
-        $this->_master_templates = array(
27
-            'email' => 'registration',
28
-        );
29
-
30
-        parent::__construct();
31
-    }
32
-
33
-
34
-    /**
35
-     * Sets admin_registered_pages property
36
-     */
37
-    protected function _set_admin_pages()
38
-    {
39
-        $this->admin_registered_pages = array(); // no admin pages to register this with.
40
-    }
41
-
42
-
43
-    /**
44
-     * Sets property related to data handler.
45
-     */
46
-    protected function _set_data_handler()
47
-    {
48
-        $this->_data_handler = 'Registrations';
49
-        $this->_single_message = $this->_data instanceof EE_Registration;
50
-    }
51
-
52
-
53
-    /**
54
-     * Returns the data for the given context for this message type.
55
-     * @param string          $context
56
-     * @param EE_Registration $registration
57
-     * @param int             $id
58
-     * @return array|mixed
59
-     */
60
-    protected function _get_data_for_context($context, EE_Registration $registration, $id)
61
-    {
62
-        // newsletter message type data handler is 'Registrations' and it expects an array of EE_Registration objects.
63
-        return array($registration);
64
-    }
65
-
66
-
67
-    /**
68
-     * Sets the admin settings fields property for this message type.
69
-     */
70
-    protected function _set_admin_settings_fields()
71
-    {
72
-        $this->_admin_settings_fields = array();
73
-    }
74
-
75
-
76
-    /**
77
-     * Sets the contexts for this message type.
78
-     */
79
-    protected function _set_contexts()
80
-    {
81
-        $this->_context_label = array(
82
-            'label'       => esc_html__('recipient', 'event_espresso'),
83
-            'plural'      => esc_html__('recipients', 'event_espresso'),
84
-            'description' => esc_html__('Recipient\'s are who will receive the message.', 'event_espresso'),
85
-        );
86
-
87
-        $this->_contexts = array(
88
-            'attendee' => array(
89
-                'label'       => esc_html__('Registrant', 'event_espresso'),
90
-                'description' => esc_html__('This template goes to selected registrants.', 'event_espresso'),
91
-            ),
92
-        );
93
-    }
94
-
95
-
96
-    /**
97
-     * used to set the valid shortcodes.
98
-     * For the newsletter message type we only have two valid shortcode libraries in use, recipient details and
99
-     * organization.  That's it!
100
-     *
101
-     * @since   4.3.0
102
-     * @return  void
103
-     */
104
-    protected function _set_valid_shortcodes()
105
-    {
106
-        parent::_set_valid_shortcodes();
107
-
108
-        $included_shortcodes = array(
109
-            'recipient_details',
110
-            'organization',
111
-            'newsletter',
112
-        );
113
-
114
-        foreach ($this->_valid_shortcodes as $context => $shortcodes) {
115
-            foreach ($shortcodes as $key => $shortcode) {
116
-                if (! in_array($shortcode, $included_shortcodes, true)) {
117
-                    unset($this->_valid_shortcodes[ $context ][ $key ]);
118
-                }
119
-            }
120
-            $this->_valid_shortcodes[ $context ][] = 'newsletter';
121
-        }
122
-    }
123
-
124
-
125
-    /**
126
-     * Override default _attendee_addressees in EE_message_type because we want to loop through the registrations
127
-     * for EE_message_type.
128
-     *
129
-     * @return array
130
-     * @throws EE_Error
131
-     * @throws InvalidArgumentException
132
-     * @throws ReflectionException
133
-     * @throws \EventEspresso\core\exceptions\InvalidDataTypeException
134
-     * @throws \EventEspresso\core\exceptions\InvalidInterfaceException
135
-     */
136
-    protected function _attendee_addressees()
137
-    {
138
-        $addressee = array();
139
-
140
-        // looping through registrations
141
-        foreach ($this->_data->registrations as $reg_id => $details) {
142
-            // set $attendee array to blank on each loop
143
-            $aee = array();
144
-
145
-            // need to get the attendee from this registration.
146
-            $attendee = isset($details['att_obj']) && $details['att_obj'] instanceof EE_Attendee
147
-                ? $details['att_obj']
148
-                : null;
149
-
150
-            if (! $attendee instanceof EE_Attendee) {
151
-                continue;
152
-            }
153
-
154
-            // set $aee from attendee object
155
-            $aee['att_obj'] = $attendee;
156
-            $aee['reg_objs'] = isset($this->_data->attendees[ $attendee->ID() ]['reg_objs'])
157
-                ? $this->_data->attendees[ $attendee->ID() ]['reg_objs']
158
-                : array();
159
-            $aee['attendee_email'] = $attendee->email();
160
-            $aee['tkt_objs'] = isset($this->_data->attendees[ $attendee->ID() ]['tkt_objs'])
161
-                ? $this->_data->attendees[ $attendee->ID() ]['tkt_objs']
162
-                : array();
163
-
164
-            if (isset($this->_data->attendees[ $attendee->ID() ]['evt_objs'])) {
165
-                $aee['evt_objs'] = $this->_data->attendees[ $attendee->ID() ]['evt_objs'];
166
-                $aee['events'] = $this->_data->attendees[ $attendee->ID() ]['evt_objs'];
167
-            } else {
168
-                $aee['evt_objs'] = $aee['events'] = array();
169
-            }
170
-
171
-            $aee['reg_obj'] = isset($details['reg_obj'])
172
-                ? $details['reg_obj']
173
-                : null;
174
-            $aee['attendees'] = $this->_data->attendees;
175
-
176
-            // merge in the primary attendee data
177
-            $aee = array_merge($this->_default_addressee_data, $aee);
178
-
179
-            // make sure txn is set
180
-            if (empty($aee['txn']) && $aee['reg_obj'] instanceof EE_Registration) {
181
-                $aee['txn'] = $aee['reg_obj']->transaction();
182
-            }
183
-
184
-            $addressee[] = new EE_Messages_Addressee($aee);
185
-        }
186
-        return $addressee;
187
-    }
188
-
189
-    /**
190
-     * Allows a message type to specifically exclude template fields for the provided messenger.
191
-     * Filtered so this can be programmatically altered as well.
192
-     *
193
-     * @param string $messenger_name name of messenger
194
-     * @return array
195
-     */
196
-    public function excludedFieldsForMessenger($messenger_name)
197
-    {
198
-        $excluded_fields = array(
199
-            'email' => array('cc')
200
-        );
201
-        return isset($excluded_fields[ $messenger_name ])
202
-            ? $excluded_fields[ $messenger_name ]
203
-            : parent::excludedFieldsForMessenger($messenger_name);
204
-    }
15
+	public function __construct()
16
+	{
17
+		$this->name = 'newsletter';
18
+		$this->description = esc_html__(
19
+			'Batch message type messages are triggered manually by the admin for sending notifications to a selected group of recipients. This should only be used for more general notification type messages that contain information specific for the recipients. For "newsletter" type messages we recommend using an email list service like MailChimp, because sending non-related mail-outs to contacts increases the risk of your site domain getting added to spam lists, which will prevent messages getting to users.',
20
+			'event_espresso'
21
+		);
22
+		$this->label = array(
23
+			'singular' => esc_html__('batch', 'event_espresso'),
24
+			'plural'   => esc_html__('batches', 'event_espresso'),
25
+		);
26
+		$this->_master_templates = array(
27
+			'email' => 'registration',
28
+		);
29
+
30
+		parent::__construct();
31
+	}
32
+
33
+
34
+	/**
35
+	 * Sets admin_registered_pages property
36
+	 */
37
+	protected function _set_admin_pages()
38
+	{
39
+		$this->admin_registered_pages = array(); // no admin pages to register this with.
40
+	}
41
+
42
+
43
+	/**
44
+	 * Sets property related to data handler.
45
+	 */
46
+	protected function _set_data_handler()
47
+	{
48
+		$this->_data_handler = 'Registrations';
49
+		$this->_single_message = $this->_data instanceof EE_Registration;
50
+	}
51
+
52
+
53
+	/**
54
+	 * Returns the data for the given context for this message type.
55
+	 * @param string          $context
56
+	 * @param EE_Registration $registration
57
+	 * @param int             $id
58
+	 * @return array|mixed
59
+	 */
60
+	protected function _get_data_for_context($context, EE_Registration $registration, $id)
61
+	{
62
+		// newsletter message type data handler is 'Registrations' and it expects an array of EE_Registration objects.
63
+		return array($registration);
64
+	}
65
+
66
+
67
+	/**
68
+	 * Sets the admin settings fields property for this message type.
69
+	 */
70
+	protected function _set_admin_settings_fields()
71
+	{
72
+		$this->_admin_settings_fields = array();
73
+	}
74
+
75
+
76
+	/**
77
+	 * Sets the contexts for this message type.
78
+	 */
79
+	protected function _set_contexts()
80
+	{
81
+		$this->_context_label = array(
82
+			'label'       => esc_html__('recipient', 'event_espresso'),
83
+			'plural'      => esc_html__('recipients', 'event_espresso'),
84
+			'description' => esc_html__('Recipient\'s are who will receive the message.', 'event_espresso'),
85
+		);
86
+
87
+		$this->_contexts = array(
88
+			'attendee' => array(
89
+				'label'       => esc_html__('Registrant', 'event_espresso'),
90
+				'description' => esc_html__('This template goes to selected registrants.', 'event_espresso'),
91
+			),
92
+		);
93
+	}
94
+
95
+
96
+	/**
97
+	 * used to set the valid shortcodes.
98
+	 * For the newsletter message type we only have two valid shortcode libraries in use, recipient details and
99
+	 * organization.  That's it!
100
+	 *
101
+	 * @since   4.3.0
102
+	 * @return  void
103
+	 */
104
+	protected function _set_valid_shortcodes()
105
+	{
106
+		parent::_set_valid_shortcodes();
107
+
108
+		$included_shortcodes = array(
109
+			'recipient_details',
110
+			'organization',
111
+			'newsletter',
112
+		);
113
+
114
+		foreach ($this->_valid_shortcodes as $context => $shortcodes) {
115
+			foreach ($shortcodes as $key => $shortcode) {
116
+				if (! in_array($shortcode, $included_shortcodes, true)) {
117
+					unset($this->_valid_shortcodes[ $context ][ $key ]);
118
+				}
119
+			}
120
+			$this->_valid_shortcodes[ $context ][] = 'newsletter';
121
+		}
122
+	}
123
+
124
+
125
+	/**
126
+	 * Override default _attendee_addressees in EE_message_type because we want to loop through the registrations
127
+	 * for EE_message_type.
128
+	 *
129
+	 * @return array
130
+	 * @throws EE_Error
131
+	 * @throws InvalidArgumentException
132
+	 * @throws ReflectionException
133
+	 * @throws \EventEspresso\core\exceptions\InvalidDataTypeException
134
+	 * @throws \EventEspresso\core\exceptions\InvalidInterfaceException
135
+	 */
136
+	protected function _attendee_addressees()
137
+	{
138
+		$addressee = array();
139
+
140
+		// looping through registrations
141
+		foreach ($this->_data->registrations as $reg_id => $details) {
142
+			// set $attendee array to blank on each loop
143
+			$aee = array();
144
+
145
+			// need to get the attendee from this registration.
146
+			$attendee = isset($details['att_obj']) && $details['att_obj'] instanceof EE_Attendee
147
+				? $details['att_obj']
148
+				: null;
149
+
150
+			if (! $attendee instanceof EE_Attendee) {
151
+				continue;
152
+			}
153
+
154
+			// set $aee from attendee object
155
+			$aee['att_obj'] = $attendee;
156
+			$aee['reg_objs'] = isset($this->_data->attendees[ $attendee->ID() ]['reg_objs'])
157
+				? $this->_data->attendees[ $attendee->ID() ]['reg_objs']
158
+				: array();
159
+			$aee['attendee_email'] = $attendee->email();
160
+			$aee['tkt_objs'] = isset($this->_data->attendees[ $attendee->ID() ]['tkt_objs'])
161
+				? $this->_data->attendees[ $attendee->ID() ]['tkt_objs']
162
+				: array();
163
+
164
+			if (isset($this->_data->attendees[ $attendee->ID() ]['evt_objs'])) {
165
+				$aee['evt_objs'] = $this->_data->attendees[ $attendee->ID() ]['evt_objs'];
166
+				$aee['events'] = $this->_data->attendees[ $attendee->ID() ]['evt_objs'];
167
+			} else {
168
+				$aee['evt_objs'] = $aee['events'] = array();
169
+			}
170
+
171
+			$aee['reg_obj'] = isset($details['reg_obj'])
172
+				? $details['reg_obj']
173
+				: null;
174
+			$aee['attendees'] = $this->_data->attendees;
175
+
176
+			// merge in the primary attendee data
177
+			$aee = array_merge($this->_default_addressee_data, $aee);
178
+
179
+			// make sure txn is set
180
+			if (empty($aee['txn']) && $aee['reg_obj'] instanceof EE_Registration) {
181
+				$aee['txn'] = $aee['reg_obj']->transaction();
182
+			}
183
+
184
+			$addressee[] = new EE_Messages_Addressee($aee);
185
+		}
186
+		return $addressee;
187
+	}
188
+
189
+	/**
190
+	 * Allows a message type to specifically exclude template fields for the provided messenger.
191
+	 * Filtered so this can be programmatically altered as well.
192
+	 *
193
+	 * @param string $messenger_name name of messenger
194
+	 * @return array
195
+	 */
196
+	public function excludedFieldsForMessenger($messenger_name)
197
+	{
198
+		$excluded_fields = array(
199
+			'email' => array('cc')
200
+		);
201
+		return isset($excluded_fields[ $messenger_name ])
202
+			? $excluded_fields[ $messenger_name ]
203
+			: parent::excludedFieldsForMessenger($messenger_name);
204
+	}
205 205
 }
Please login to merge, or discard this patch.