Completed
Branch FET-9795-new-interfaces (ea072c)
by
unknown
51:56 queued 35:16
created
core/services/container/CoffeeShop.php 3 patches
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -236,7 +236,7 @@  discard block
 block discarded – undo
236 236
      * Adds instructions on how to brew objects
237 237
      *
238 238
      * @param RecipeInterface $recipe
239
-     * @return mixed
239
+     * @return boolean
240 240
      */
241 241
     public function addRecipe(RecipeInterface $recipe)
242 242
     {
@@ -312,7 +312,7 @@  discard block
 block discarded – undo
312 312
     /**
313 313
      * Adds a service to one of the internal collections
314 314
      *
315
-     * @param        $identifier
315
+     * @param        string $identifier
316 316
      * @param array  $arguments
317 317
      * @param string $type
318 318
      * @return mixed
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -79,7 +79,7 @@  discard block
 block discarded – undo
79 79
         // array for storing class aliases
80 80
         $this->filters = array();
81 81
         // create collection for storing shared services
82
-        $this->carafe = new LooseCollection( '' );
82
+        $this->carafe = new LooseCollection('');
83 83
         // create collection for storing recipes that tell how to build services and entities
84 84
         $this->recipes = new Collection('EventEspresso\core\services\container\RecipeInterface');
85 85
         // create collection for storing closures for constructing new entities
@@ -302,7 +302,7 @@  discard block
 block discarded – undo
302 302
             return;
303 303
         }
304 304
         $identifier = $this->processIdentifier($identifier);
305
-        foreach ((array)$aliases as $alias) {
305
+        foreach ((array) $aliases as $alias) {
306 306
             $this->filters[$this->processIdentifier($alias)] = $identifier;
307 307
         }
308 308
     }
Please login to merge, or discard this patch.
Indentation   +497 added lines, -497 removed lines patch added patch discarded remove patch
@@ -13,7 +13,7 @@  discard block
 block discarded – undo
13 13
 use OutOfBoundsException;
14 14
 
15 15
 if ( ! defined('EVENT_ESPRESSO_VERSION')) {
16
-    exit('No direct script access allowed');
16
+	exit('No direct script access allowed');
17 17
 }
18 18
 
19 19
 
@@ -32,502 +32,502 @@  discard block
 block discarded – undo
32 32
 {
33 33
 
34 34
 
35
-    /**
36
-     * This was the best coffee related name I could think of to represent class name "aliases"
37
-     * So classes can be found via an alias identifier,
38
-     * that is revealed when it is run through... the filters... eh? get it?
39
-     *
40
-     * @var array $filters
41
-     */
42
-    private $filters = array();
43
-
44
-    /**
45
-     * These are the classes that will actually build the objects (to order of course)
46
-     *
47
-     * @var array $coffee_makers
48
-     */
49
-    private $coffee_makers = array();
50
-
51
-    /**
52
-     * where the instantiated "singleton" objects are stored
53
-     *
54
-     * @var CollectionInterface $carafe
55
-     */
56
-    private $carafe;
57
-
58
-    /**
59
-     * collection of Recipes that instruct us how to brew objects
60
-     *
61
-     * @var CollectionInterface $recipes
62
-     */
63
-    private $recipes;
64
-
65
-    /**
66
-     * collection of closures for brewing objects
67
-     *
68
-     * @var CollectionInterface $reservoir
69
-     */
70
-    private $reservoir;
71
-
72
-
73
-
74
-    /**
75
-     * CoffeeShop constructor
76
-     */
77
-    public function __construct()
78
-    {
79
-        // array for storing class aliases
80
-        $this->filters = array();
81
-        // create collection for storing shared services
82
-        $this->carafe = new LooseCollection( '' );
83
-        // create collection for storing recipes that tell how to build services and entities
84
-        $this->recipes = new Collection('EventEspresso\core\services\container\RecipeInterface');
85
-        // create collection for storing closures for constructing new entities
86
-        $this->reservoir = new Collection('Closure');
87
-        // create collection for storing the generators that build our services and entity closures
88
-        $this->coffee_makers = new Collection('EventEspresso\core\services\container\CoffeeMakerInterface');
89
-    }
90
-
91
-
92
-
93
-    /**
94
-     * Returns true if the container can return an entry for the given identifier.
95
-     * Returns false otherwise.
96
-     * `has($identifier)` returning true does not mean that `get($identifier)` will not throw an exception.
97
-     * It does however mean that `get($identifier)` will not throw a `ServiceNotFoundException`.
98
-     *
99
-     * @param string $identifier  Identifier of the entry to look for.
100
-     *                            Typically a Fully Qualified Class Name
101
-     * @return boolean
102
-     */
103
-    public function has($identifier)
104
-    {
105
-        $identifier = $this->filterIdentifier($identifier);
106
-        return $this->carafe->has($identifier);
107
-    }
108
-
109
-
110
-
111
-    /**
112
-     * finds a previously brewed (SHARED) service and returns it
113
-     *
114
-     * @param  string $identifier Identifier for the entity class to be constructed.
115
-     *                            Typically a Fully Qualified Class Name
116
-     * @return mixed
117
-     * @throws ServiceNotFoundException No service was found for this identifier.
118
-     */
119
-    public function get($identifier)
120
-    {
121
-        $identifier = $this->filterIdentifier($identifier);
122
-        if ($this->carafe->has($identifier)) {
123
-            return $this->carafe->get($identifier);
124
-        }
125
-        throw new ServiceNotFoundException($identifier);
126
-    }
127
-
128
-
129
-
130
-    /**
131
-     * returns an instance of the requested entity type using the supplied arguments.
132
-     * If a shared service is requested and an instance is already in the carafe, then it will be returned.
133
-     * If it is not already in the carafe, then the service will be constructed, added to the carafe, and returned
134
-     * If the request is for a new entity and a closure exists in the reservoir for creating it,
135
-     * then a new entity will be instantiated from the closure and returned.
136
-     * If a closure does not exist, then one will be built and added to the reservoir
137
-     * before instantiating the requested entity.
138
-     *
139
-     * @param  string $identifier Identifier for the entity class to be constructed.
140
-     *                            Typically a Fully Qualified Class Name
141
-     * @param array   $arguments  an array of arguments to be passed to the entity constructor
142
-     * @param string  $type
143
-     * @return mixed
144
-     * @throws ServiceNotFoundException No service was found for this identifier.
145
-     */
146
-    public function brew($identifier, $arguments = array(), $type = '')
147
-    {
148
-        // resolve any class aliases that may exist
149
-        $identifier = $this->filterIdentifier($identifier);
150
-        try {
151
-            // is a shared service being requested?
152
-            if (empty($type) || $type === CoffeeMaker::BREW_SHARED) {
153
-                // if a shared service was requested and an instance is in the carafe, then return it
154
-                return $this->get($identifier);
155
-            }
156
-        } catch (ServiceNotFoundException $e) {
157
-            // if not then we'll just catch the ServiceNotFoundException but not do anything just yet,
158
-            // and instead, attempt to build whatever was requested
159
-        }
160
-        $brewed = false;
161
-        // if the reservoir doesn't have a closure already for the requested identifier,
162
-        // then neither a shared service nor a closure for making entities has been built yet
163
-        if ( ! $this->reservoir->has($identifier)) {
164
-            // so let's brew something up and add it to the proper collection
165
-            $brewed = $this->makeCoffee($identifier, $arguments, $type);
166
-        }
167
-        // was the brewed item a callable factory function ?
168
-        if (is_callable($brewed)) {
169
-            // then instantiate a new entity from the cached closure
170
-            $entity = $brewed($arguments);
171
-        } else if ($brewed) {
172
-            // requested object was a shared entity, so attempt to get it from the carafe again
173
-            // because if it wasn't there before, then it should have just been brewed and added,
174
-            // but if it still isn't there, then this time
175
-            // the thrown ServiceNotFoundException will not be caught
176
-            $entity = $this->get($identifier);
177
-        } else {
178
-            // if identifier is for a non-shared entity,
179
-            // then either a cached closure already existed, or was just brewed
180
-            $closure = $this->reservoir->get($identifier);
181
-            $entity = $closure($arguments);
182
-        }
183
-        return $entity;
184
-    }
185
-
186
-
187
-
188
-    /**
189
-     * @param CoffeeMakerInterface $coffee_maker
190
-     * @param string               $type
191
-     * @return bool
192
-     */
193
-    public function addCoffeeMaker(CoffeeMakerInterface $coffee_maker, $type)
194
-    {
195
-        $type = CoffeeMaker::validateType($type);
196
-        return $this->coffee_makers->add($coffee_maker, $type);
197
-    }
198
-
199
-
200
-
201
-    /**
202
-     * @param string   $identifier
203
-     * @param callable $closure
204
-     * @return callable|null
205
-     */
206
-    public function addClosure($identifier, $closure)
207
-    {
208
-        if ( ! is_callable($closure)) {
209
-            throw new InvalidDataTypeException('$closure', $closure, 'Closure');
210
-        }
211
-        $identifier = $this->processIdentifier($identifier);
212
-        if ($this->reservoir->add($closure, $identifier)) {
213
-            return $closure;
214
-        }
215
-        return null;
216
-    }
217
-
218
-
219
-
220
-    /**
221
-     * @param string   $identifier
222
-     * @return boolean
223
-     */
224
-    public function removeClosure($identifier)
225
-    {
226
-        $identifier = $this->processIdentifier($identifier);
227
-        if ($this->reservoir->has($identifier)) {
228
-            $this->reservoir->remove($this->reservoir->get($identifier));
229
-            if ( ! $this->reservoir->has($identifier)) {
230
-                return true;
231
-            }
232
-        }
233
-        return false;
234
-    }
235
-
236
-
237
-
238
-    /**
239
-     * @param  string $identifier Identifier for the entity class that the service applies to
240
-     *                            Typically a Fully Qualified Class Name
241
-     * @param mixed  $service
242
-     * @return bool
243
-     */
244
-    public function addService($identifier, $service)
245
-    {
246
-        $identifier = $this->processIdentifier($identifier);
247
-        $service = $this->validateService($identifier, $service);
248
-        return $this->carafe->add($service, $identifier);
249
-    }
250
-
251
-
252
-
253
-    /**
254
-     * @param string $identifier
255
-     * @return boolean
256
-     */
257
-    public function removeService($identifier)
258
-    {
259
-        $identifier = $this->processIdentifier($identifier);
260
-        if ($this->carafe->has($identifier)) {
261
-            $this->carafe->remove($this->carafe->get($identifier));
262
-            if ( ! $this->carafe->has($identifier)) {
263
-                return true;
264
-            }
265
-        }
266
-        return false;
267
-    }
268
-
269
-
270
-
271
-    /**
272
-     * Adds instructions on how to brew objects
273
-     *
274
-     * @param RecipeInterface $recipe
275
-     * @return mixed
276
-     */
277
-    public function addRecipe(RecipeInterface $recipe)
278
-    {
279
-        $this->addAliases($recipe->identifier(), $recipe->filters());
280
-        $identifier = $this->processIdentifier($recipe->identifier());
281
-        return $this->recipes->add($recipe, $identifier);
282
-    }
283
-
284
-
285
-
286
-    /**
287
-     * @param string $identifier The Recipe's identifier
288
-     * @return boolean
289
-     */
290
-    public function removeRecipe($identifier)
291
-    {
292
-        $identifier = $this->processIdentifier($identifier);
293
-        if ($this->recipes->has($identifier)) {
294
-            $this->recipes->remove(
295
-                $this->recipes->get($identifier)
296
-            );
297
-            if ( ! $this->recipes->has($identifier)) {
298
-                return true;
299
-            }
300
-        }
301
-        return false;
302
-    }
303
-
304
-
305
-
306
-    /**
307
-     * Get instructions on how to brew objects
308
-     *
309
-     * @param  string $identifier Identifier for the entity class that the recipe applies to
310
-     *                            Typically a Fully Qualified Class Name
311
-     * @param string $type
312
-     * @return RecipeInterface
313
-     */
314
-    public function getRecipe($identifier, $type = '')
315
-    {
316
-        $identifier = $this->processIdentifier($identifier);
317
-        if ($this->recipes->has($identifier)) {
318
-            return $this->recipes->get($identifier);
319
-        }
320
-        $default_recipes = $this->getDefaultRecipes();
321
-        $matches = array();
322
-        foreach ($default_recipes as $wildcard => $default_recipe) {
323
-            // is the wildcard recipe prefix in the identifier ?
324
-            if (strpos($identifier, $wildcard) !== false) {
325
-                // track matches and use the number of wildcard characters matched for the key
326
-                $matches[strlen($wildcard)] = $default_recipe;
327
-            }
328
-        }
329
-        if (count($matches) > 0) {
330
-            // sort our recipes by the number of wildcard characters matched
331
-            ksort($matches);
332
-            // then grab the last recipe form the list, since it had the most matching characters
333
-            $match = array_pop($matches);
334
-            // since we are using a default recipe, we need to set it's identifier and fqcn
335
-            return $this->copyDefaultRecipe($match, $identifier, $type);
336
-        }
337
-        if ($this->recipes->has(Recipe::DEFAULT_ID)) {
338
-            // since we are using a default recipe, we need to set it's identifier and fqcn
339
-            return $this->copyDefaultRecipe($this->recipes->get(Recipe::DEFAULT_ID), $identifier, $type);
340
-        }
341
-        throw new OutOfBoundsException(
342
-            sprintf(
343
-                __('Could not brew coffee because no recipes were found for class "%1$s".', 'event_espresso'),
344
-                $identifier
345
-            )
346
-        );
347
-    }
348
-
349
-
350
-
351
-    /**
352
-     * adds class name aliases to list of filters
353
-     *
354
-     * @param  string $identifier Identifier for the entity class that the alias applies to
355
-     *                            Typically a Fully Qualified Class Name
356
-     * @param  array  $aliases
357
-     * @return void
358
-     * @throws InvalidIdentifierException
359
-     */
360
-    public function addAliases($identifier, $aliases)
361
-    {
362
-        if (empty($aliases)) {
363
-            return;
364
-        }
365
-        $identifier = $this->processIdentifier($identifier);
366
-        foreach ((array)$aliases as $alias) {
367
-            $this->filters[$this->processIdentifier($alias)] = $identifier;
368
-        }
369
-    }
370
-
371
-
372
-
373
-    /**
374
-     * Adds a service to one of the internal collections
375
-     *
376
-     * @param        $identifier
377
-     * @param array  $arguments
378
-     * @param string $type
379
-     * @return mixed
380
-     * @throws ServiceExistsException
381
-     */
382
-    private function makeCoffee($identifier, $arguments = array(), $type = '')
383
-    {
384
-        if ((empty($type) || $type === CoffeeMaker::BREW_SHARED) && $this->has($identifier)) {
385
-            throw new ServiceExistsException($identifier);
386
-        }
387
-        $identifier = $this->filterIdentifier($identifier);
388
-        $recipe = $this->getRecipe($identifier, $type);
389
-        $type = ! empty($type) ? $type : $recipe->type();
390
-        $coffee_maker = $this->getCoffeeMaker($type);
391
-        return $coffee_maker->brew($recipe, $arguments);
392
-    }
393
-
394
-
395
-
396
-    /**
397
-     * filters alias identifiers to find the real class name
398
-     *
399
-     * @param  string $identifier Identifier for the entity class that the filter applies to
400
-     *                            Typically a Fully Qualified Class Name
401
-     * @return string
402
-     * @throws InvalidIdentifierException
403
-     */
404
-    private function filterIdentifier($identifier)
405
-    {
406
-        $identifier = $this->processIdentifier($identifier);
407
-        return isset($this->filters[$identifier]) && ! empty($this->filters[$identifier])
408
-            ? $this->filters[$identifier]
409
-            : $identifier;
410
-    }
411
-
412
-
413
-
414
-    /**
415
-     * verifies and standardizes identifiers
416
-     *
417
-     * @param  string $identifier Identifier for the entity class
418
-     *                            Typically a Fully Qualified Class Name
419
-     * @return string
420
-     * @throws InvalidIdentifierException
421
-     */
422
-    private function processIdentifier($identifier)
423
-    {
424
-        if ( ! is_string($identifier)) {
425
-            throw new InvalidIdentifierException(
426
-                is_object($identifier) ? get_class($identifier) : gettype($identifier),
427
-                '\Fully\Qualified\ClassName'
428
-            );
429
-        }
430
-        return ltrim($identifier, '\\');
431
-    }
432
-
433
-
434
-
435
-    /**
436
-     * @param string $type
437
-     * @return CoffeeMakerInterface
438
-     * @throws InvalidDataTypeException
439
-     * @throws InvalidClassException
440
-     */
441
-    private function getCoffeeMaker($type)
442
-    {
443
-        if ( ! $this->coffee_makers->has($type)) {
444
-            throw new OutOfBoundsException(
445
-                __('The requested coffee maker is either missing or invalid.', 'event_espresso')
446
-            );
447
-        }
448
-        return $this->coffee_makers->get($type);
449
-    }
450
-
451
-
452
-
453
-    /**
454
-     * Retrieves all recipes that use a wildcard "*" in their identifier
455
-     * This allows recipes to be set up for handling
456
-     * legacy classes that do not support PSR-4 autoloading.
457
-     * for example:
458
-     * using "EEM_*" for a recipe identifier would target all legacy models like EEM_Attendee
459
-     *
460
-     * @return array
461
-     */
462
-    private function getDefaultRecipes()
463
-    {
464
-        $default_recipes = array();
465
-        $this->recipes->rewind();
466
-        while ($this->recipes->valid()) {
467
-            $identifier = $this->recipes->getInfo();
468
-            // does this recipe use a wildcard ? (but is NOT the global default)
469
-            if ($identifier !== Recipe::DEFAULT_ID && strpos($identifier, '*') !== false) {
470
-                // strip the wildcard and use identifier as key
471
-                $default_recipes[str_replace('*', '', $identifier)] = $this->recipes->current();
472
-            }
473
-            $this->recipes->next();
474
-        }
475
-        return $default_recipes;
476
-    }
477
-
478
-
479
-
480
-    /**
481
-     * clones a default recipe and then copies details
482
-     * from the incoming request to it so that it can be used
483
-     *
484
-     * @param RecipeInterface $default_recipe
485
-     * @param string          $identifier
486
-     * @param string          $type
487
-     * @return RecipeInterface
488
-     */
489
-    private function copyDefaultRecipe(RecipeInterface $default_recipe, $identifier, $type = '')
490
-    {
491
-        $recipe = clone($default_recipe);
492
-        if ( ! empty($type)) {
493
-            $recipe->setType($type);
494
-        }
495
-        // is this the base default recipe ?
496
-        if ($default_recipe->identifier() === Recipe::DEFAULT_ID) {
497
-            $recipe->setIdentifier($identifier);
498
-            $recipe->setFqcn($identifier);
499
-            return $recipe;
500
-        }
501
-        $recipe->setIdentifier($identifier);
502
-        foreach ($default_recipe->paths() as $path) {
503
-            $path = str_replace('*', $identifier, $path);
504
-            if (is_readable($path)) {
505
-                $recipe->setPaths($path);
506
-            }
507
-        }
508
-        $recipe->setFqcn($identifier);
509
-        return $recipe;
510
-    }
511
-
512
-
513
-
514
-    /**
515
-     * @param  string $identifier Identifier for the entity class that the service applies to
516
-     *                            Typically a Fully Qualified Class Name
517
-     * @param mixed  $service
518
-     * @return object
519
-     * @throws InvalidServiceException
520
-     */
521
-    private function validateService($identifier, $service)
522
-    {
523
-        if ( ! is_object($service)) {
524
-            throw new InvalidServiceException(
525
-                $identifier,
526
-                $service
527
-            );
528
-        }
529
-        return $service;
530
-    }
35
+	/**
36
+	 * This was the best coffee related name I could think of to represent class name "aliases"
37
+	 * So classes can be found via an alias identifier,
38
+	 * that is revealed when it is run through... the filters... eh? get it?
39
+	 *
40
+	 * @var array $filters
41
+	 */
42
+	private $filters = array();
43
+
44
+	/**
45
+	 * These are the classes that will actually build the objects (to order of course)
46
+	 *
47
+	 * @var array $coffee_makers
48
+	 */
49
+	private $coffee_makers = array();
50
+
51
+	/**
52
+	 * where the instantiated "singleton" objects are stored
53
+	 *
54
+	 * @var CollectionInterface $carafe
55
+	 */
56
+	private $carafe;
57
+
58
+	/**
59
+	 * collection of Recipes that instruct us how to brew objects
60
+	 *
61
+	 * @var CollectionInterface $recipes
62
+	 */
63
+	private $recipes;
64
+
65
+	/**
66
+	 * collection of closures for brewing objects
67
+	 *
68
+	 * @var CollectionInterface $reservoir
69
+	 */
70
+	private $reservoir;
71
+
72
+
73
+
74
+	/**
75
+	 * CoffeeShop constructor
76
+	 */
77
+	public function __construct()
78
+	{
79
+		// array for storing class aliases
80
+		$this->filters = array();
81
+		// create collection for storing shared services
82
+		$this->carafe = new LooseCollection( '' );
83
+		// create collection for storing recipes that tell how to build services and entities
84
+		$this->recipes = new Collection('EventEspresso\core\services\container\RecipeInterface');
85
+		// create collection for storing closures for constructing new entities
86
+		$this->reservoir = new Collection('Closure');
87
+		// create collection for storing the generators that build our services and entity closures
88
+		$this->coffee_makers = new Collection('EventEspresso\core\services\container\CoffeeMakerInterface');
89
+	}
90
+
91
+
92
+
93
+	/**
94
+	 * Returns true if the container can return an entry for the given identifier.
95
+	 * Returns false otherwise.
96
+	 * `has($identifier)` returning true does not mean that `get($identifier)` will not throw an exception.
97
+	 * It does however mean that `get($identifier)` will not throw a `ServiceNotFoundException`.
98
+	 *
99
+	 * @param string $identifier  Identifier of the entry to look for.
100
+	 *                            Typically a Fully Qualified Class Name
101
+	 * @return boolean
102
+	 */
103
+	public function has($identifier)
104
+	{
105
+		$identifier = $this->filterIdentifier($identifier);
106
+		return $this->carafe->has($identifier);
107
+	}
108
+
109
+
110
+
111
+	/**
112
+	 * finds a previously brewed (SHARED) service and returns it
113
+	 *
114
+	 * @param  string $identifier Identifier for the entity class to be constructed.
115
+	 *                            Typically a Fully Qualified Class Name
116
+	 * @return mixed
117
+	 * @throws ServiceNotFoundException No service was found for this identifier.
118
+	 */
119
+	public function get($identifier)
120
+	{
121
+		$identifier = $this->filterIdentifier($identifier);
122
+		if ($this->carafe->has($identifier)) {
123
+			return $this->carafe->get($identifier);
124
+		}
125
+		throw new ServiceNotFoundException($identifier);
126
+	}
127
+
128
+
129
+
130
+	/**
131
+	 * returns an instance of the requested entity type using the supplied arguments.
132
+	 * If a shared service is requested and an instance is already in the carafe, then it will be returned.
133
+	 * If it is not already in the carafe, then the service will be constructed, added to the carafe, and returned
134
+	 * If the request is for a new entity and a closure exists in the reservoir for creating it,
135
+	 * then a new entity will be instantiated from the closure and returned.
136
+	 * If a closure does not exist, then one will be built and added to the reservoir
137
+	 * before instantiating the requested entity.
138
+	 *
139
+	 * @param  string $identifier Identifier for the entity class to be constructed.
140
+	 *                            Typically a Fully Qualified Class Name
141
+	 * @param array   $arguments  an array of arguments to be passed to the entity constructor
142
+	 * @param string  $type
143
+	 * @return mixed
144
+	 * @throws ServiceNotFoundException No service was found for this identifier.
145
+	 */
146
+	public function brew($identifier, $arguments = array(), $type = '')
147
+	{
148
+		// resolve any class aliases that may exist
149
+		$identifier = $this->filterIdentifier($identifier);
150
+		try {
151
+			// is a shared service being requested?
152
+			if (empty($type) || $type === CoffeeMaker::BREW_SHARED) {
153
+				// if a shared service was requested and an instance is in the carafe, then return it
154
+				return $this->get($identifier);
155
+			}
156
+		} catch (ServiceNotFoundException $e) {
157
+			// if not then we'll just catch the ServiceNotFoundException but not do anything just yet,
158
+			// and instead, attempt to build whatever was requested
159
+		}
160
+		$brewed = false;
161
+		// if the reservoir doesn't have a closure already for the requested identifier,
162
+		// then neither a shared service nor a closure for making entities has been built yet
163
+		if ( ! $this->reservoir->has($identifier)) {
164
+			// so let's brew something up and add it to the proper collection
165
+			$brewed = $this->makeCoffee($identifier, $arguments, $type);
166
+		}
167
+		// was the brewed item a callable factory function ?
168
+		if (is_callable($brewed)) {
169
+			// then instantiate a new entity from the cached closure
170
+			$entity = $brewed($arguments);
171
+		} else if ($brewed) {
172
+			// requested object was a shared entity, so attempt to get it from the carafe again
173
+			// because if it wasn't there before, then it should have just been brewed and added,
174
+			// but if it still isn't there, then this time
175
+			// the thrown ServiceNotFoundException will not be caught
176
+			$entity = $this->get($identifier);
177
+		} else {
178
+			// if identifier is for a non-shared entity,
179
+			// then either a cached closure already existed, or was just brewed
180
+			$closure = $this->reservoir->get($identifier);
181
+			$entity = $closure($arguments);
182
+		}
183
+		return $entity;
184
+	}
185
+
186
+
187
+
188
+	/**
189
+	 * @param CoffeeMakerInterface $coffee_maker
190
+	 * @param string               $type
191
+	 * @return bool
192
+	 */
193
+	public function addCoffeeMaker(CoffeeMakerInterface $coffee_maker, $type)
194
+	{
195
+		$type = CoffeeMaker::validateType($type);
196
+		return $this->coffee_makers->add($coffee_maker, $type);
197
+	}
198
+
199
+
200
+
201
+	/**
202
+	 * @param string   $identifier
203
+	 * @param callable $closure
204
+	 * @return callable|null
205
+	 */
206
+	public function addClosure($identifier, $closure)
207
+	{
208
+		if ( ! is_callable($closure)) {
209
+			throw new InvalidDataTypeException('$closure', $closure, 'Closure');
210
+		}
211
+		$identifier = $this->processIdentifier($identifier);
212
+		if ($this->reservoir->add($closure, $identifier)) {
213
+			return $closure;
214
+		}
215
+		return null;
216
+	}
217
+
218
+
219
+
220
+	/**
221
+	 * @param string   $identifier
222
+	 * @return boolean
223
+	 */
224
+	public function removeClosure($identifier)
225
+	{
226
+		$identifier = $this->processIdentifier($identifier);
227
+		if ($this->reservoir->has($identifier)) {
228
+			$this->reservoir->remove($this->reservoir->get($identifier));
229
+			if ( ! $this->reservoir->has($identifier)) {
230
+				return true;
231
+			}
232
+		}
233
+		return false;
234
+	}
235
+
236
+
237
+
238
+	/**
239
+	 * @param  string $identifier Identifier for the entity class that the service applies to
240
+	 *                            Typically a Fully Qualified Class Name
241
+	 * @param mixed  $service
242
+	 * @return bool
243
+	 */
244
+	public function addService($identifier, $service)
245
+	{
246
+		$identifier = $this->processIdentifier($identifier);
247
+		$service = $this->validateService($identifier, $service);
248
+		return $this->carafe->add($service, $identifier);
249
+	}
250
+
251
+
252
+
253
+	/**
254
+	 * @param string $identifier
255
+	 * @return boolean
256
+	 */
257
+	public function removeService($identifier)
258
+	{
259
+		$identifier = $this->processIdentifier($identifier);
260
+		if ($this->carafe->has($identifier)) {
261
+			$this->carafe->remove($this->carafe->get($identifier));
262
+			if ( ! $this->carafe->has($identifier)) {
263
+				return true;
264
+			}
265
+		}
266
+		return false;
267
+	}
268
+
269
+
270
+
271
+	/**
272
+	 * Adds instructions on how to brew objects
273
+	 *
274
+	 * @param RecipeInterface $recipe
275
+	 * @return mixed
276
+	 */
277
+	public function addRecipe(RecipeInterface $recipe)
278
+	{
279
+		$this->addAliases($recipe->identifier(), $recipe->filters());
280
+		$identifier = $this->processIdentifier($recipe->identifier());
281
+		return $this->recipes->add($recipe, $identifier);
282
+	}
283
+
284
+
285
+
286
+	/**
287
+	 * @param string $identifier The Recipe's identifier
288
+	 * @return boolean
289
+	 */
290
+	public function removeRecipe($identifier)
291
+	{
292
+		$identifier = $this->processIdentifier($identifier);
293
+		if ($this->recipes->has($identifier)) {
294
+			$this->recipes->remove(
295
+				$this->recipes->get($identifier)
296
+			);
297
+			if ( ! $this->recipes->has($identifier)) {
298
+				return true;
299
+			}
300
+		}
301
+		return false;
302
+	}
303
+
304
+
305
+
306
+	/**
307
+	 * Get instructions on how to brew objects
308
+	 *
309
+	 * @param  string $identifier Identifier for the entity class that the recipe applies to
310
+	 *                            Typically a Fully Qualified Class Name
311
+	 * @param string $type
312
+	 * @return RecipeInterface
313
+	 */
314
+	public function getRecipe($identifier, $type = '')
315
+	{
316
+		$identifier = $this->processIdentifier($identifier);
317
+		if ($this->recipes->has($identifier)) {
318
+			return $this->recipes->get($identifier);
319
+		}
320
+		$default_recipes = $this->getDefaultRecipes();
321
+		$matches = array();
322
+		foreach ($default_recipes as $wildcard => $default_recipe) {
323
+			// is the wildcard recipe prefix in the identifier ?
324
+			if (strpos($identifier, $wildcard) !== false) {
325
+				// track matches and use the number of wildcard characters matched for the key
326
+				$matches[strlen($wildcard)] = $default_recipe;
327
+			}
328
+		}
329
+		if (count($matches) > 0) {
330
+			// sort our recipes by the number of wildcard characters matched
331
+			ksort($matches);
332
+			// then grab the last recipe form the list, since it had the most matching characters
333
+			$match = array_pop($matches);
334
+			// since we are using a default recipe, we need to set it's identifier and fqcn
335
+			return $this->copyDefaultRecipe($match, $identifier, $type);
336
+		}
337
+		if ($this->recipes->has(Recipe::DEFAULT_ID)) {
338
+			// since we are using a default recipe, we need to set it's identifier and fqcn
339
+			return $this->copyDefaultRecipe($this->recipes->get(Recipe::DEFAULT_ID), $identifier, $type);
340
+		}
341
+		throw new OutOfBoundsException(
342
+			sprintf(
343
+				__('Could not brew coffee because no recipes were found for class "%1$s".', 'event_espresso'),
344
+				$identifier
345
+			)
346
+		);
347
+	}
348
+
349
+
350
+
351
+	/**
352
+	 * adds class name aliases to list of filters
353
+	 *
354
+	 * @param  string $identifier Identifier for the entity class that the alias applies to
355
+	 *                            Typically a Fully Qualified Class Name
356
+	 * @param  array  $aliases
357
+	 * @return void
358
+	 * @throws InvalidIdentifierException
359
+	 */
360
+	public function addAliases($identifier, $aliases)
361
+	{
362
+		if (empty($aliases)) {
363
+			return;
364
+		}
365
+		$identifier = $this->processIdentifier($identifier);
366
+		foreach ((array)$aliases as $alias) {
367
+			$this->filters[$this->processIdentifier($alias)] = $identifier;
368
+		}
369
+	}
370
+
371
+
372
+
373
+	/**
374
+	 * Adds a service to one of the internal collections
375
+	 *
376
+	 * @param        $identifier
377
+	 * @param array  $arguments
378
+	 * @param string $type
379
+	 * @return mixed
380
+	 * @throws ServiceExistsException
381
+	 */
382
+	private function makeCoffee($identifier, $arguments = array(), $type = '')
383
+	{
384
+		if ((empty($type) || $type === CoffeeMaker::BREW_SHARED) && $this->has($identifier)) {
385
+			throw new ServiceExistsException($identifier);
386
+		}
387
+		$identifier = $this->filterIdentifier($identifier);
388
+		$recipe = $this->getRecipe($identifier, $type);
389
+		$type = ! empty($type) ? $type : $recipe->type();
390
+		$coffee_maker = $this->getCoffeeMaker($type);
391
+		return $coffee_maker->brew($recipe, $arguments);
392
+	}
393
+
394
+
395
+
396
+	/**
397
+	 * filters alias identifiers to find the real class name
398
+	 *
399
+	 * @param  string $identifier Identifier for the entity class that the filter applies to
400
+	 *                            Typically a Fully Qualified Class Name
401
+	 * @return string
402
+	 * @throws InvalidIdentifierException
403
+	 */
404
+	private function filterIdentifier($identifier)
405
+	{
406
+		$identifier = $this->processIdentifier($identifier);
407
+		return isset($this->filters[$identifier]) && ! empty($this->filters[$identifier])
408
+			? $this->filters[$identifier]
409
+			: $identifier;
410
+	}
411
+
412
+
413
+
414
+	/**
415
+	 * verifies and standardizes identifiers
416
+	 *
417
+	 * @param  string $identifier Identifier for the entity class
418
+	 *                            Typically a Fully Qualified Class Name
419
+	 * @return string
420
+	 * @throws InvalidIdentifierException
421
+	 */
422
+	private function processIdentifier($identifier)
423
+	{
424
+		if ( ! is_string($identifier)) {
425
+			throw new InvalidIdentifierException(
426
+				is_object($identifier) ? get_class($identifier) : gettype($identifier),
427
+				'\Fully\Qualified\ClassName'
428
+			);
429
+		}
430
+		return ltrim($identifier, '\\');
431
+	}
432
+
433
+
434
+
435
+	/**
436
+	 * @param string $type
437
+	 * @return CoffeeMakerInterface
438
+	 * @throws InvalidDataTypeException
439
+	 * @throws InvalidClassException
440
+	 */
441
+	private function getCoffeeMaker($type)
442
+	{
443
+		if ( ! $this->coffee_makers->has($type)) {
444
+			throw new OutOfBoundsException(
445
+				__('The requested coffee maker is either missing or invalid.', 'event_espresso')
446
+			);
447
+		}
448
+		return $this->coffee_makers->get($type);
449
+	}
450
+
451
+
452
+
453
+	/**
454
+	 * Retrieves all recipes that use a wildcard "*" in their identifier
455
+	 * This allows recipes to be set up for handling
456
+	 * legacy classes that do not support PSR-4 autoloading.
457
+	 * for example:
458
+	 * using "EEM_*" for a recipe identifier would target all legacy models like EEM_Attendee
459
+	 *
460
+	 * @return array
461
+	 */
462
+	private function getDefaultRecipes()
463
+	{
464
+		$default_recipes = array();
465
+		$this->recipes->rewind();
466
+		while ($this->recipes->valid()) {
467
+			$identifier = $this->recipes->getInfo();
468
+			// does this recipe use a wildcard ? (but is NOT the global default)
469
+			if ($identifier !== Recipe::DEFAULT_ID && strpos($identifier, '*') !== false) {
470
+				// strip the wildcard and use identifier as key
471
+				$default_recipes[str_replace('*', '', $identifier)] = $this->recipes->current();
472
+			}
473
+			$this->recipes->next();
474
+		}
475
+		return $default_recipes;
476
+	}
477
+
478
+
479
+
480
+	/**
481
+	 * clones a default recipe and then copies details
482
+	 * from the incoming request to it so that it can be used
483
+	 *
484
+	 * @param RecipeInterface $default_recipe
485
+	 * @param string          $identifier
486
+	 * @param string          $type
487
+	 * @return RecipeInterface
488
+	 */
489
+	private function copyDefaultRecipe(RecipeInterface $default_recipe, $identifier, $type = '')
490
+	{
491
+		$recipe = clone($default_recipe);
492
+		if ( ! empty($type)) {
493
+			$recipe->setType($type);
494
+		}
495
+		// is this the base default recipe ?
496
+		if ($default_recipe->identifier() === Recipe::DEFAULT_ID) {
497
+			$recipe->setIdentifier($identifier);
498
+			$recipe->setFqcn($identifier);
499
+			return $recipe;
500
+		}
501
+		$recipe->setIdentifier($identifier);
502
+		foreach ($default_recipe->paths() as $path) {
503
+			$path = str_replace('*', $identifier, $path);
504
+			if (is_readable($path)) {
505
+				$recipe->setPaths($path);
506
+			}
507
+		}
508
+		$recipe->setFqcn($identifier);
509
+		return $recipe;
510
+	}
511
+
512
+
513
+
514
+	/**
515
+	 * @param  string $identifier Identifier for the entity class that the service applies to
516
+	 *                            Typically a Fully Qualified Class Name
517
+	 * @param mixed  $service
518
+	 * @return object
519
+	 * @throws InvalidServiceException
520
+	 */
521
+	private function validateService($identifier, $service)
522
+	{
523
+		if ( ! is_object($service)) {
524
+			throw new InvalidServiceException(
525
+				$identifier,
526
+				$service
527
+			);
528
+		}
529
+		return $service;
530
+	}
531 531
 
532 532
 }
533 533
 // End of file CoffeeShop.php
Please login to merge, or discard this patch.
core/services/container/exceptions/ServiceNotFoundException.php 1 patch
Indentation   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -2,7 +2,7 @@  discard block
 block discarded – undo
2 2
 namespace EventEspresso\core\services\container\exceptions;
3 3
 
4 4
 if ( ! defined('EVENT_ESPRESSO_VERSION')) {
5
-    exit('No direct script access allowed');
5
+	exit('No direct script access allowed');
6 6
 }
7 7
 
8 8
 
@@ -18,28 +18,28 @@  discard block
 block discarded – undo
18 18
 class ServiceNotFoundException extends \RuntimeException
19 19
 {
20 20
 
21
-    /**
22
-     * ServiceNotFoundException constructor
23
-     *
24
-     * @param string     $service_name the name of the requested service
25
-     * @param string     $message
26
-     * @param int        $code
27
-     * @param \Exception $previous
28
-     */
29
-    public function __construct(
30
-        $service_name,
31
-        $message = '',
32
-        $code = 0,
33
-        \Exception $previous = null
34
-    ) {
35
-        if (empty($message)) {
36
-            $message = sprintf(
37
-                __('The requested service "%1$s" could not found be found in the CoffeeShop.', 'event_espresso'),
38
-                $service_name
39
-            );
40
-        }
41
-        parent::__construct($message, $code, $previous);
42
-    }
21
+	/**
22
+	 * ServiceNotFoundException constructor
23
+	 *
24
+	 * @param string     $service_name the name of the requested service
25
+	 * @param string     $message
26
+	 * @param int        $code
27
+	 * @param \Exception $previous
28
+	 */
29
+	public function __construct(
30
+		$service_name,
31
+		$message = '',
32
+		$code = 0,
33
+		\Exception $previous = null
34
+	) {
35
+		if (empty($message)) {
36
+			$message = sprintf(
37
+				__('The requested service "%1$s" could not found be found in the CoffeeShop.', 'event_espresso'),
38
+				$service_name
39
+			);
40
+		}
41
+		parent::__construct($message, $code, $previous);
42
+	}
43 43
 }
44 44
 // End of file ServiceNotFoundException.php
45 45
 // Location: /ServiceNotFoundException.php
46 46
\ No newline at end of file
Please login to merge, or discard this patch.
core/services/container/exceptions/ServiceExistsException.php 1 patch
Indentation   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -2,7 +2,7 @@  discard block
 block discarded – undo
2 2
 namespace EventEspresso\core\services\container\exceptions;
3 3
 
4 4
 if ( ! defined('EVENT_ESPRESSO_VERSION')) {
5
-    exit('No direct script access allowed');
5
+	exit('No direct script access allowed');
6 6
 }
7 7
 
8 8
 
@@ -19,28 +19,28 @@  discard block
 block discarded – undo
19 19
 {
20 20
 
21 21
 
22
-    /**
23
-     * ServiceExistsException constructor
24
-     *
25
-     * @param string     $service_name the name of the requested service
26
-     * @param string     $message
27
-     * @param int        $code
28
-     * @param \Exception $previous
29
-     */
30
-    public function __construct(
31
-        $service_name,
32
-        $message = '',
33
-        $code = 0,
34
-        \Exception $previous = null
35
-    ) {
36
-        if (empty($message)) {
37
-            $message = sprintf(
38
-                __('The "%1$s" service already exists in the CoffeeShop and can not be added again.', 'event_espresso'),
39
-                $service_name
40
-            );
41
-        }
42
-        parent::__construct($message, $code, $previous);
43
-    }
22
+	/**
23
+	 * ServiceExistsException constructor
24
+	 *
25
+	 * @param string     $service_name the name of the requested service
26
+	 * @param string     $message
27
+	 * @param int        $code
28
+	 * @param \Exception $previous
29
+	 */
30
+	public function __construct(
31
+		$service_name,
32
+		$message = '',
33
+		$code = 0,
34
+		\Exception $previous = null
35
+	) {
36
+		if (empty($message)) {
37
+			$message = sprintf(
38
+				__('The "%1$s" service already exists in the CoffeeShop and can not be added again.', 'event_espresso'),
39
+				$service_name
40
+			);
41
+		}
42
+		parent::__construct($message, $code, $previous);
43
+	}
44 44
 
45 45
 
46 46
 }
Please login to merge, or discard this patch.
core/services/container/exceptions/InvalidServiceException.php 1 patch
Indentation   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -2,7 +2,7 @@  discard block
 block discarded – undo
2 2
 namespace EventEspresso\core\services\container\exceptions;
3 3
 
4 4
 if ( ! defined('EVENT_ESPRESSO_VERSION')) {
5
-    exit('No direct script access allowed');
5
+	exit('No direct script access allowed');
6 6
 }
7 7
 
8 8
 
@@ -18,29 +18,29 @@  discard block
 block discarded – undo
18 18
 class InvalidServiceException extends \UnexpectedValueException
19 19
 {
20 20
 
21
-    /**
22
-     * InvalidServiceException constructor.
23
-     *
24
-     * @param string     $service_name the name of the requested service
25
-     * @param string     $actual       classname of what we got
26
-     * @param string     $message
27
-     * @param int        $code
28
-     * @param \Exception $previous
29
-     */
30
-    public function __construct($service_name, $actual, $message = '', $code = 0, \Exception $previous = null)
31
-    {
32
-        if (empty($message)) {
33
-            $message = sprintf(
34
-                __(
35
-                    'The "%1$s" service could not be retrieved from the CoffeeShop, but "%2$s" was received.',
36
-                    'event_espresso'
37
-                ),
38
-                $service_name,
39
-                print_r($actual, true)
40
-            );
41
-        }
42
-        parent::__construct($message, $code, $previous);
43
-    }
21
+	/**
22
+	 * InvalidServiceException constructor.
23
+	 *
24
+	 * @param string     $service_name the name of the requested service
25
+	 * @param string     $actual       classname of what we got
26
+	 * @param string     $message
27
+	 * @param int        $code
28
+	 * @param \Exception $previous
29
+	 */
30
+	public function __construct($service_name, $actual, $message = '', $code = 0, \Exception $previous = null)
31
+	{
32
+		if (empty($message)) {
33
+			$message = sprintf(
34
+				__(
35
+					'The "%1$s" service could not be retrieved from the CoffeeShop, but "%2$s" was received.',
36
+					'event_espresso'
37
+				),
38
+				$service_name,
39
+				print_r($actual, true)
40
+			);
41
+		}
42
+		parent::__construct($message, $code, $previous);
43
+	}
44 44
 
45 45
 }
46 46
 // End of file InvalidServiceException.php
Please login to merge, or discard this patch.
core/CPTs/EE_CPT_Strategy.core.php 1 patch
Spacing   +70 added lines, -70 removed lines patch added patch discarded remove patch
@@ -1,4 +1,4 @@  discard block
 block discarded – undo
1
-<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) {exit('No direct script access allowed');}
1
+<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) {exit('No direct script access allowed'); }
2 2
 /**
3 3
  * CPT_Strategy
4 4
  *
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
 	 */
70 70
 	public static function instance() {
71 71
 		// check if class object is instantiated
72
-		if ( ! self::$_instance instanceof EE_CPT_Strategy ) {
72
+		if ( ! self::$_instance instanceof EE_CPT_Strategy) {
73 73
 			self::$_instance = new self();
74 74
 		}
75 75
 		return self::$_instance;
@@ -86,7 +86,7 @@  discard block
 block discarded – undo
86 86
 		$this->_CPTs = EE_Register_CPTs::get_CPTs();
87 87
 		$this->_CPT_endpoints = $this->_set_CPT_endpoints();
88 88
 		$this->_CPT_taxonomies = EE_Register_CPTs::get_taxonomies();
89
-		add_action( 'pre_get_posts', array( $this, 'pre_get_posts' ), 5 );
89
+		add_action('pre_get_posts', array($this, 'pre_get_posts'), 5);
90 90
 	}
91 91
 
92 92
 
@@ -120,9 +120,9 @@  discard block
 block discarded – undo
120 120
 	 */
121 121
 	private function _set_CPT_endpoints() {
122 122
 		$_CPT_endpoints = array();
123
-		if ( is_array( $this->_CPTs )) {
124
-			foreach ( $this->_CPTs as $CPT_type => $CPT ) {
125
-				$_CPT_endpoints [ $CPT['plural_slug'] ] = $CPT_type;
123
+		if (is_array($this->_CPTs)) {
124
+			foreach ($this->_CPTs as $CPT_type => $CPT) {
125
+				$_CPT_endpoints [$CPT['plural_slug']] = $CPT_type;
126 126
 			}
127 127
 		}
128 128
 		return $_CPT_endpoints;
@@ -140,21 +140,21 @@  discard block
 block discarded – undo
140 140
 	 * @param WP_Query $WP_Query
141 141
 	 * @return void
142 142
 	 */
143
-	public function pre_get_posts( $WP_Query ) {
143
+	public function pre_get_posts($WP_Query) {
144 144
 		// check that post-type is set
145
-		if ( ! $WP_Query instanceof WP_Query ) {
145
+		if ( ! $WP_Query instanceof WP_Query) {
146 146
 			return;
147 147
 		}
148 148
 		// add our conditionals
149
-		$this->_set_EE_tags_on_WP_Query( $WP_Query );
149
+		$this->_set_EE_tags_on_WP_Query($WP_Query);
150 150
 		// check for terms
151
-		$this->_set_post_type_for_terms( $WP_Query );
151
+		$this->_set_post_type_for_terms($WP_Query);
152 152
 		// make sure paging is always set
153
-		$this->_set_paging( $WP_Query );
153
+		$this->_set_paging($WP_Query);
154 154
 		// is a taxonomy set ?
155
-		$this->_set_CPT_taxonomies_on_WP_Query( $WP_Query );
155
+		$this->_set_CPT_taxonomies_on_WP_Query($WP_Query);
156 156
 		// loop thru post_types if set
157
-		$this->_process_WP_Query_post_types( $WP_Query );
157
+		$this->_process_WP_Query_post_types($WP_Query);
158 158
 	}
159 159
 
160 160
 
@@ -165,7 +165,7 @@  discard block
 block discarded – undo
165 165
 	 * @param WP_Query $WP_Query
166 166
 	 * @return void
167 167
 	 */
168
-	private function _set_EE_tags_on_WP_Query( WP_Query $WP_Query) {
168
+	private function _set_EE_tags_on_WP_Query(WP_Query $WP_Query) {
169 169
 		$WP_Query->is_espresso_event_single = FALSE;
170 170
 		$WP_Query->is_espresso_event_archive = FALSE;
171 171
 		$WP_Query->is_espresso_event_taxonomy = FALSE;
@@ -183,11 +183,11 @@  discard block
 block discarded – undo
183 183
 	 * @return void
184 184
 	 */
185 185
 	private function _set_CPT_terms() {
186
-		if ( empty( $this->_CPT_terms )) {
186
+		if (empty($this->_CPT_terms)) {
187 187
 			$terms = EEM_Term::instance()->get_all_CPT_post_tags();
188
-			foreach ( $terms as $term ) {
189
-				if ( $term instanceof EE_Term ) {
190
-					$this->_CPT_terms[ $term->slug() ] = $term;
188
+			foreach ($terms as $term) {
189
+				if ($term instanceof EE_Term) {
190
+					$this->_CPT_terms[$term->slug()] = $term;
191 191
 				}
192 192
 			}
193 193
 		}
@@ -202,24 +202,24 @@  discard block
 block discarded – undo
202 202
 	 * @param $WP_Query
203 203
 	 * @return void
204 204
 	 */
205
-	private function _set_post_type_for_terms( WP_Query $WP_Query ) {
205
+	private function _set_post_type_for_terms(WP_Query $WP_Query) {
206 206
 		// is a tag set ?
207
-		if ( isset( $WP_Query->query['tag'] )) {
207
+		if (isset($WP_Query->query['tag'])) {
208 208
 			// set post_tags
209 209
 			$this->_set_CPT_terms();
210 210
 			// is this tag archive term in the list of terms used by our CPTs ?
211
-			$term = isset ( $this->_CPT_terms[ $WP_Query->query['tag'] ] ) ? $this->_CPT_terms[ $WP_Query->query['tag'] ] : NULL;
211
+			$term = isset ($this->_CPT_terms[$WP_Query->query['tag']]) ? $this->_CPT_terms[$WP_Query->query['tag']] : NULL;
212 212
 			// verify the term
213
-			if ( $term instanceof EE_Term ) {
214
-				$term->post_type  = array_merge( array( 'post', 'page' ), (array)$term->post_type );
215
-				$term->post_type = apply_filters( 'FHEE__EE_CPT_Strategy___set_post_type_for_terms__term_post_type', $term->post_type, $term );
213
+			if ($term instanceof EE_Term) {
214
+				$term->post_type = array_merge(array('post', 'page'), (array) $term->post_type);
215
+				$term->post_type = apply_filters('FHEE__EE_CPT_Strategy___set_post_type_for_terms__term_post_type', $term->post_type, $term);
216 216
 				// if a post type is already set
217
-				if ( isset( $WP_Query->query_vars['post_type'] )) {
217
+				if (isset($WP_Query->query_vars['post_type'])) {
218 218
 						// add to existing array
219
-						$term->post_type = array_merge ( (array)$WP_Query->query_vars['post_type'], $term->post_type );
219
+						$term->post_type = array_merge((array) $WP_Query->query_vars['post_type'], $term->post_type);
220 220
 				}
221 221
 				// just set post_type to our CPT
222
-				$WP_Query->set( 'post_type', array_unique( $term->post_type ) );
222
+				$WP_Query->set('post_type', array_unique($term->post_type));
223 223
 			}
224 224
 		}
225 225
 	}
@@ -233,11 +233,11 @@  discard block
 block discarded – undo
233 233
 	 * @param WP_Query $WP_Query
234 234
 	 * @return void
235 235
 	 */
236
-	public function _set_paging( $WP_Query ) {
237
-		if ( $WP_Query->is_main_query() && apply_filters( 'FHEE__EE_CPT_Strategy___set_paging', TRUE )) {
236
+	public function _set_paging($WP_Query) {
237
+		if ($WP_Query->is_main_query() && apply_filters('FHEE__EE_CPT_Strategy___set_paging', TRUE)) {
238 238
 			$page = get_query_var('page') ? get_query_var('page') : NULL;
239 239
 			$paged = get_query_var('paged') ? get_query_var('paged') : $page;
240
-			$WP_Query->set( 'paged', $paged );
240
+			$WP_Query->set('paged', $paged);
241 241
 		}
242 242
 	}
243 243
 
@@ -247,28 +247,28 @@  discard block
 block discarded – undo
247 247
 	 * @access protected
248 248
 	 * @param \WP_Query $WP_Query
249 249
 	 */
250
-	protected function _set_CPT_taxonomies_on_WP_Query( WP_Query $WP_Query ) {
250
+	protected function _set_CPT_taxonomies_on_WP_Query(WP_Query $WP_Query) {
251 251
 		// is a taxonomy set ?
252
-		if ( $WP_Query->is_tax ) {
252
+		if ($WP_Query->is_tax) {
253 253
 			// loop thru our taxonomies
254
-			foreach ( $this->_CPT_taxonomies as $CPT_taxonomy => $CPT_taxonomy_details ) {
254
+			foreach ($this->_CPT_taxonomies as $CPT_taxonomy => $CPT_taxonomy_details) {
255 255
 				// check if one of our taxonomies is set as a query var
256
-				if ( isset( $WP_Query->query[ $CPT_taxonomy ] ) ) {
256
+				if (isset($WP_Query->query[$CPT_taxonomy])) {
257 257
 					// but which CPT does that correspond to??? hmmm... guess we gotta go looping
258
-					foreach ( $this->_CPTs as $post_type => $CPT ) {
258
+					foreach ($this->_CPTs as $post_type => $CPT) {
259 259
 						// verify our CPT has args, is public and has taxonomies set
260 260
 						if (
261
-							isset( $CPT['args'], $CPT['args']['public'] )
261
+							isset($CPT['args'], $CPT['args']['public'])
262 262
 							&& $CPT['args']['public']
263
-							&& ! empty( $CPT['args']['taxonomies'] )
264
-							&& in_array( $CPT_taxonomy, $CPT['args']['taxonomies'] )
263
+							&& ! empty($CPT['args']['taxonomies'])
264
+							&& in_array($CPT_taxonomy, $CPT['args']['taxonomies'])
265 265
 						) {
266 266
 							// if so, then add this CPT post_type to the current query's array of post_types'
267
-							$WP_Query->query_vars['post_type'] = isset( $WP_Query->query_vars['post_type'] )
267
+							$WP_Query->query_vars['post_type'] = isset($WP_Query->query_vars['post_type'])
268 268
 								? (array) $WP_Query->query_vars['post_type']
269 269
 								: array();
270 270
 							$WP_Query->query_vars['post_type'][] = $post_type;
271
-							switch ( $post_type ) {
271
+							switch ($post_type) {
272 272
 								case 'espresso_events' :
273 273
 									$WP_Query->is_espresso_event_taxonomy = true;
274 274
 									break;
@@ -277,7 +277,7 @@  discard block
 block discarded – undo
277 277
 									break;
278 278
 								default :
279 279
 									do_action(
280
-										'AHEE__EE_CPT_Strategy___set_CPT_taxonomies_on_WP_Query__for_' . $post_type . '_post_type',
280
+										'AHEE__EE_CPT_Strategy___set_CPT_taxonomies_on_WP_Query__for_'.$post_type.'_post_type',
281 281
 										$WP_Query,
282 282
 										$this
283 283
 									);
@@ -295,24 +295,24 @@  discard block
 block discarded – undo
295 295
 	 * @access public
296 296
 	 * @param \WP_Query $WP_Query
297 297
 	 */
298
-	protected function _process_WP_Query_post_types( WP_Query $WP_Query ) {
299
-		if ( isset( $WP_Query->query_vars['post_type'] ) ) {
298
+	protected function _process_WP_Query_post_types(WP_Query $WP_Query) {
299
+		if (isset($WP_Query->query_vars['post_type'])) {
300 300
 			// loop thru post_types as array
301
-			foreach ( (array) $WP_Query->query_vars['post_type'] as $post_type ) {
301
+			foreach ((array) $WP_Query->query_vars['post_type'] as $post_type) {
302 302
 				// is current query for an EE CPT ?
303
-				if ( isset( $this->_CPTs[ $post_type ] ) ) {
303
+				if (isset($this->_CPTs[$post_type])) {
304 304
 					// is EE on or off ?
305
-					if ( EE_Maintenance_Mode::instance()->level() ) {
305
+					if (EE_Maintenance_Mode::instance()->level()) {
306 306
 						// reroute CPT template view to maintenance_mode.template.php
307
-						if ( ! has_filter( 'template_include', array( 'EE_Maintenance_Mode', 'template_include' ) ) ) {
308
-							add_filter( 'template_include', array( 'EE_Maintenance_Mode', 'template_include' ), 99999 );
307
+						if ( ! has_filter('template_include', array('EE_Maintenance_Mode', 'template_include'))) {
308
+							add_filter('template_include', array('EE_Maintenance_Mode', 'template_include'), 99999);
309 309
 						}
310
-						if ( has_filter( 'the_content', array( EE_Maintenance_Mode::instance(), 'the_content' ) ) ) {
311
-							add_filter( 'the_content', array( $this, 'inject_EE_shortcode_placeholder' ), 1 );
310
+						if (has_filter('the_content', array(EE_Maintenance_Mode::instance(), 'the_content'))) {
311
+							add_filter('the_content', array($this, 'inject_EE_shortcode_placeholder'), 1);
312 312
 						}
313 313
 						return;
314 314
 					}
315
-					$this->_generate_CptQueryModifier( $WP_Query, $post_type );
315
+					$this->_generate_CptQueryModifier($WP_Query, $post_type);
316 316
 				}
317 317
 			}
318 318
 		}
@@ -324,10 +324,10 @@  discard block
 block discarded – undo
324 324
 	 * @param \WP_Query $WP_Query
325 325
 	 * @param string    $post_type
326 326
 	 */
327
-	protected function _generate_CptQueryModifier( WP_Query $WP_Query, $post_type ) {
327
+	protected function _generate_CptQueryModifier(WP_Query $WP_Query, $post_type) {
328 328
 		$this->query_modifier = new EventEspresso\Core\CPTs\CptQueryModifier(
329 329
 			$post_type,
330
-			$this->_CPTs[ $post_type ],
330
+			$this->_CPTs[$post_type],
331 331
 			$WP_Query,
332 332
 			EE_Registry::instance()->REQ
333 333
 		);
@@ -370,9 +370,9 @@  discard block
 block discarded – undo
370 370
 	 * @param  $SQL
371 371
 	 * @return string
372 372
 	 */
373
-	public function posts_fields( $SQL ) {
374
-		if ( $this->query_modifier instanceof EventEspresso\Core\CPTs\CptQueryModifier ) {
375
-			return $this->query_modifier->postsFields( $SQL );
373
+	public function posts_fields($SQL) {
374
+		if ($this->query_modifier instanceof EventEspresso\Core\CPTs\CptQueryModifier) {
375
+			return $this->query_modifier->postsFields($SQL);
376 376
 		}
377 377
 		return $SQL;
378 378
 	}
@@ -386,9 +386,9 @@  discard block
 block discarded – undo
386 386
 	 * @param  $SQL
387 387
 	 * @return string
388 388
 	 */
389
-	public function posts_join( $SQL ) {
390
-		if ( $this->query_modifier instanceof EventEspresso\Core\CPTs\CptQueryModifier ) {
391
-			return $this->query_modifier->postsJoin( $SQL );
389
+	public function posts_join($SQL) {
390
+		if ($this->query_modifier instanceof EventEspresso\Core\CPTs\CptQueryModifier) {
391
+			return $this->query_modifier->postsJoin($SQL);
392 392
 		}
393 393
 		return $SQL;
394 394
 	}
@@ -402,9 +402,9 @@  discard block
 block discarded – undo
402 402
 	 * @param  \WP_Post[] $posts
403 403
 	 * @return \WP_Post[]
404 404
 	 */
405
-	public function the_posts( $posts ) {
406
-		if ( $this->query_modifier instanceof EventEspresso\Core\CPTs\CptQueryModifier ) {
407
-			$this->query_modifier->thePosts( $posts );
405
+	public function the_posts($posts) {
406
+		if ($this->query_modifier instanceof EventEspresso\Core\CPTs\CptQueryModifier) {
407
+			$this->query_modifier->thePosts($posts);
408 408
 		}
409 409
 		return $posts;
410 410
 	}
@@ -419,9 +419,9 @@  discard block
 block discarded – undo
419 419
 	 * @param $ID
420 420
 	 * @return string
421 421
 	 */
422
-	public function get_edit_post_link( $url, $ID ) {
423
-		if ( $this->query_modifier instanceof EventEspresso\Core\CPTs\CptQueryModifier ) {
424
-			return $this->query_modifier->getEditPostLink( $url, $ID );
422
+	public function get_edit_post_link($url, $ID) {
423
+		if ($this->query_modifier instanceof EventEspresso\Core\CPTs\CptQueryModifier) {
424
+			return $this->query_modifier->getEditPostLink($url, $ID);
425 425
 		}
426 426
 		return '';
427 427
 	}
@@ -434,8 +434,8 @@  discard block
 block discarded – undo
434 434
 	 * @access public
435 435
 	 * @param null $WP_Query
436 436
 	 */
437
-	protected function _do_template_filters( $WP_Query = null ) {
438
-		if ( $this->query_modifier instanceof EventEspresso\Core\CPTs\CptQueryModifier ) {
437
+	protected function _do_template_filters($WP_Query = null) {
438
+		if ($this->query_modifier instanceof EventEspresso\Core\CPTs\CptQueryModifier) {
439 439
 			$this->query_modifier->addTemplateFilters();
440 440
 		}
441 441
 	}
@@ -449,9 +449,9 @@  discard block
 block discarded – undo
449 449
 	 * @param string $current_template Existing default template path derived for this page call.
450 450
 	 * @return string the path to the full template file.
451 451
 	 */
452
-	public function single_cpt_template( $current_template ) {
453
-		if ( $this->query_modifier instanceof EventEspresso\Core\CPTs\CptQueryModifier ) {
454
-			return $this->query_modifier->singleCptTemplate( $current_template );
452
+	public function single_cpt_template($current_template) {
453
+		if ($this->query_modifier instanceof EventEspresso\Core\CPTs\CptQueryModifier) {
454
+			return $this->query_modifier->singleCptTemplate($current_template);
455 455
 		}
456 456
 		return $current_template;
457 457
 	}
Please login to merge, or discard this patch.
templates/support_admin_details_shortcodes_event_listings.template.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -1,13 +1,13 @@
 block discarded – undo
1 1
 <div class="padding">
2 2
 	<p>
3
-        <?php esc_html_e('Displays a list of events based on a set of criteria on a WordPress page or post. Unless otherwise specified, events are sorted by start date.', 'event_espresso'); ?> <?php echo sprintf( esc_html__('For a full list of available shortcodes, please view the %sshortcode documentation%s on our website.', 'event_espresso'), '<a href="https://eventespresso.com/wiki/ee4-shortcodes-template-variables/">', '</a>' ); ?>
3
+        <?php esc_html_e('Displays a list of events based on a set of criteria on a WordPress page or post. Unless otherwise specified, events are sorted by start date.', 'event_espresso'); ?> <?php echo sprintf(esc_html__('For a full list of available shortcodes, please view the %sshortcode documentation%s on our website.', 'event_espresso'), '<a href="https://eventespresso.com/wiki/ee4-shortcodes-template-variables/">', '</a>'); ?>
4 4
     </p>
5 5
 		<ul>
6 6
 			<li><strong><?php esc_html_e('Show a list of all of your events', 'event_espresso'); ?></strong><br /> [ESPRESSO_EVENTS]</li>
7 7
 			<li><strong><?php esc_html_e('Set a custom title for the event list', 'event_espresso'); ?></strong><br /> [ESPRESSO_EVENTS title="My Super Event List"]</li>
8 8
 			<li><strong><?php esc_html_e('Limit (paginate) the number of events that are shown in the event list on a page or post', 'event_espresso'); ?></strong><br />[ESPRESSO_EVENTS limit=5]</li>
9 9
 			<li><strong><?php esc_html_e('Add a custom CSS class to each event post/article', 'event_espresso'); ?></strong><br /> [ESPRESSO_EVENTS css_class=my-custom-class]</li>
10
-			<li><strong><?php esc_html_e('Filter the event list by month and year', 'event_espresso'); ?></strong><br />[ESPRESSO_EVENTS month="<?php echo date( 'F Y' ); ?>"]</li>
10
+			<li><strong><?php esc_html_e('Filter the event list by month and year', 'event_espresso'); ?></strong><br />[ESPRESSO_EVENTS month="<?php echo date('F Y'); ?>"]</li>
11 11
 			<li><strong><?php esc_html_e('Show expired events in the event list', 'event_espresso'); ?></strong><br />[ESPRESSO_EVENTS show_expired=true]</li>
12 12
 			<li><strong><?php esc_html_e('Sorts the event list in ascending order', 'event_espresso'); ?></strong><br />[ESPRESSO_EVENTS sort=ASC]</li>
13 13
 			<li><strong><?php esc_html_e('Sorts the event list in descending order', 'event_espresso'); ?></strong><br />[ESPRESSO_EVENTS sort=DESC]</li>
Please login to merge, or discard this patch.
registration_form/templates/questions_main_meta_box.template.php 1 patch
Spacing   +54 added lines, -54 removed lines patch added patch discarded remove patch
@@ -21,7 +21,7 @@  discard block
 block discarded – undo
21 21
 		<tbody>
22 22
 			<tr>
23 23
 				<th>
24
-					<label for="QST_display_text"><?php echo $fields['QST_display_text']->get_nicename();?></label> <?php echo EEH_Template::get_help_tab_link('question_text_info');?>
24
+					<label for="QST_display_text"><?php echo $fields['QST_display_text']->get_nicename(); ?></label> <?php echo EEH_Template::get_help_tab_link('question_text_info'); ?>
25 25
 				</th>
26 26
 				<td>
27 27
 					<input type="text" class="regular-text" id="QST_display_text" name="QST_display_text" value="<?php $question->f('QST_display_text')?>"/>
@@ -31,23 +31,23 @@  discard block
 block discarded – undo
31 31
 
32 32
 			<tr>
33 33
 				<th>
34
-					<label for="QST_admin_label"><?php echo $fields['QST_admin_label']->get_nicename();?></label> <?php echo EEH_Template::get_help_tab_link('question_label_info');?>
34
+					<label for="QST_admin_label"><?php echo $fields['QST_admin_label']->get_nicename(); ?></label> <?php echo EEH_Template::get_help_tab_link('question_label_info'); ?>
35 35
 				</th>
36 36
 				<td>
37 37
 					<?php
38
-						$disabled = ! empty( $QST_system ) ? ' disabled="disabled"' : '';
39
-						$id =  ! empty( $QST_system ) ? '_disabled' : '';
38
+						$disabled = ! empty($QST_system) ? ' disabled="disabled"' : '';
39
+						$id = ! empty($QST_system) ? '_disabled' : '';
40 40
 					?>
41 41
 					<input type="text" class="regular-text" id="QST_admin_label<?php echo $id?>" name="QST_admin_label<?php echo $id?>" value="<?php $question->f('QST_admin_label')?>"<?php echo $disabled?>/>
42 42
 					<input class="QST_order" type="hidden" id="QST_order<?php echo $id; ?>" name = "QST_order<?php echo $id; ?>" value="<?php echo $question->get('QST_order'); ?>" />
43
-					<?php if ( ! empty( $QST_system )) { ?>
43
+					<?php if ( ! empty($QST_system)) { ?>
44 44
 						<input type="hidden"  id="QST_admin_label" name="QST_admin_label" value="<?php echo $question->admin_label()?>"/>
45 45
 					<?php } ?>
46 46
 					<br/>
47 47
 					<p class="description">
48
-					<?php if ( ! empty( $QST_system )) { ?>
48
+					<?php if ( ! empty($QST_system)) { ?>
49 49
 					<span class="description" style="color:#D54E21;">
50
-						<?php esc_html_e('System question! This field cannot be changed.','event_espresso')?>
50
+						<?php esc_html_e('System question! This field cannot be changed.', 'event_espresso')?>
51 51
 					</span>
52 52
 					<?php } ?>
53 53
 
@@ -57,21 +57,21 @@  discard block
 block discarded – undo
57 57
 
58 58
 			<tr>
59 59
 				<th>
60
-					<label for="QST_admin_only"><?php echo $fields['QST_admin_only']->get_nicename();?></label> <?php echo EEH_Template::get_help_tab_link('question_admin_only_info');?>
60
+					<label for="QST_admin_only"><?php echo $fields['QST_admin_only']->get_nicename(); ?></label> <?php echo EEH_Template::get_help_tab_link('question_admin_only_info'); ?>
61 61
 				</th>
62 62
 				<td>
63 63
 					<?php
64
-						$disabled = ! empty( $QST_system ) ? ' disabled="disabled"' : '';
65
-						$id =  ! empty( $QST_system ) ? '_disabled' : '';
64
+						$disabled = ! empty($QST_system) ? ' disabled="disabled"' : '';
65
+						$id = ! empty($QST_system) ? '_disabled' : '';
66 66
 						$admin_only = $question->get('QST_admin_only');
67
-						$checked = !empty( $admin_only ) ? ' checked="checked"' : '';
67
+						$checked = ! empty($admin_only) ? ' checked="checked"' : '';
68 68
 					?>
69 69
 					<input class="QST_admin_only" type="checkbox" id="QST_admin_only<?php echo $id; ?>" name = "QST_admin_only<?php echo $id; ?>" value="1"<?php echo $disabled; echo $checked; ?>/>
70 70
 					<br/>
71 71
 					<p class="description">
72
-					<?php if ( ! empty( $QST_system )) { ?>
72
+					<?php if ( ! empty($QST_system)) { ?>
73 73
 					<span class="description" style="color:#D54E21;">
74
-						<?php esc_html_e('System question! This field cannot be changed.','event_espresso')?>
74
+						<?php esc_html_e('System question! This field cannot be changed.', 'event_espresso')?>
75 75
 					</span>
76 76
 					<?php } ?>
77 77
 
@@ -81,21 +81,21 @@  discard block
 block discarded – undo
81 81
 
82 82
 			<tr>
83 83
 				<th>
84
-					<label for="QST_type"><?php echo $fields['QST_type']->get_nicename();?></label> <?php echo EEH_Template::get_help_tab_link('question_type_info');?>
84
+					<label for="QST_type"><?php echo $fields['QST_type']->get_nicename(); ?></label> <?php echo EEH_Template::get_help_tab_link('question_type_info'); ?>
85 85
 				</th>
86 86
 				<td>
87 87
 					<?php
88
-						$disabled = ! empty( $QST_system ) ? ' disabled="disabled"' : '';
89
-						$id =  ! empty( $QST_system ) ? '_disabled' : '';
90
-						echo EEH_Form_Fields::select_input( 'QST_type' . $id, $question_types, $question->type(), 'id="QST_type' . $id . '"' . $disabled );
91
-						if( ! empty( $QST_system ) ) { ?>
88
+						$disabled = ! empty($QST_system) ? ' disabled="disabled"' : '';
89
+						$id = ! empty($QST_system) ? '_disabled' : '';
90
+						echo EEH_Form_Fields::select_input('QST_type'.$id, $question_types, $question->type(), 'id="QST_type'.$id.'"'.$disabled);
91
+						if ( ! empty($QST_system)) { ?>
92 92
 							<input type="hidden"  id="QST_type" name="QST_type" value="<?php echo $question->type()?>"/>
93 93
 						<?php
94
-							$explanatory_text = esc_html__('System question! This field cannot be changed.','event_espresso');
95
-						}else{
96
-							$explanatory_text = esc_html__('Because there are currently answers for this question in the database, your options to change the question type have been limited to similar question-types.','event_espresso');
94
+							$explanatory_text = esc_html__('System question! This field cannot be changed.', 'event_espresso');
95
+						} else {
96
+							$explanatory_text = esc_html__('Because there are currently answers for this question in the database, your options to change the question type have been limited to similar question-types.', 'event_espresso');
97 97
 						}
98
-						if ( ! empty( $QST_system ) || $has_answers ) { ?>
98
+						if ( ! empty($QST_system) || $has_answers) { ?>
99 99
 							<p><span class="description" style="color:#D54E21;">
100 100
 								<?php echo $explanatory_text; ?>
101 101
 							</span></p>
@@ -108,22 +108,22 @@  discard block
 block discarded – undo
108 108
 			<tr id="text_input_question_options">
109 109
 				<th>
110 110
 					<label>
111
-						<?php esc_html_e( 'Maximum Allowed Response Size', 'event_espresso' );?>
111
+						<?php esc_html_e('Maximum Allowed Response Size', 'event_espresso'); ?>
112 112
 					</label>
113 113
 				</th>
114 114
 				<td>
115
-					<input id="QST_max" name="QST_max" type="number" <?php echo $max_max === EE_INF ? '' : "max='$max_max'";?> value="<?php $question->f( 'QST_max' );?>" min="1">
115
+					<input id="QST_max" name="QST_max" type="number" <?php echo $max_max === EE_INF ? '' : "max='$max_max'"; ?> value="<?php $question->f('QST_max'); ?>" min="1">
116 116
 					<p>
117 117
 						<span class="description">
118
-							<?php esc_html_e( 'Maximum number of characters allowed when answering this question', 'event_espresso' );?>
118
+							<?php esc_html_e('Maximum number of characters allowed when answering this question', 'event_espresso'); ?>
119 119
 						</span>
120 120
 					</p>
121
-					<?php if ( $QST_system ) { ?>
121
+					<?php if ($QST_system) { ?>
122 122
 					<p>
123 123
 						<span class="description" style="color:#D54E21;">
124 124
 							<?php printf(
125
-									esc_html__( 'System question! The maximum number of characters that can be used for this question is %1$s', 'event_espresso' ),
126
-									$max_max );?>
125
+									esc_html__('System question! The maximum number of characters that can be used for this question is %1$s', 'event_espresso'),
126
+									$max_max ); ?>
127 127
 						</span>
128 128
 					</p>
129 129
 					<?php } ?>
@@ -132,7 +132,7 @@  discard block
 block discarded – undo
132 132
 			<tr id="question_options">
133 133
 				<th>
134 134
 					<label>
135
-						<?php esc_html_e('Answer Options','event_espresso')?>
135
+						<?php esc_html_e('Answer Options', 'event_espresso')?>
136 136
 					</label>
137 137
 				</th>
138 138
 				<td>
@@ -141,10 +141,10 @@  discard block
 block discarded – undo
141 141
 						<thead>
142 142
 							<tr>
143 143
 								<th class="option-value-header">
144
-									<?php esc_html_e('Value','event_espresso')?>
144
+									<?php esc_html_e('Value', 'event_espresso')?>
145 145
 								</th>
146 146
 								<th class="option-desc-header">
147
-									<?php esc_html_e('Description (optional, only shown on registration form)','event_espresso')?>
147
+									<?php esc_html_e('Description (optional, only shown on registration form)', 'event_espresso')?>
148 148
 								</th>
149 149
 								<th>
150 150
 								</th>
@@ -167,17 +167,17 @@  discard block
 block discarded – undo
167 167
 							</tr>
168 168
 
169 169
 							<?php
170
-							$count=0;
170
+							$count = 0;
171 171
 							$question_options = $question->options();
172
-							if ( ! empty( $question_options )) {
173
-								foreach( $question_options as $option_id => $option ) {
174
-									$disabled =  $has_answers || $option->get('QSO_system') ? ' disabled="disabled"'  : '';
172
+							if ( ! empty($question_options)) {
173
+								foreach ($question_options as $option_id => $option) {
174
+									$disabled = $has_answers || $option->get('QSO_system') ? ' disabled="disabled"' : '';
175 175
 							?>
176 176
 								<tr class="question-option ee-options-sortable">
177 177
 									<td class="option-value-cell">
178 178
 										<input type="hidden" class="QSO_order" name="question_options[<?php echo $count; ?>][QSO_order]" value="<?php echo $count; ?>">
179 179
 										<input type="text" class="option-value regular-text" name="question_options[<?php echo $count?>][QSO_value]" value="<?php  $option->f('QSO_value')?>"<?php echo $disabled; ?>>
180
-										<?php if ( $has_answers ) : ?>
180
+										<?php if ($has_answers) : ?>
181 181
 											<input type="hidden" name="question_options[<?php echo $count; ?>][QSO_value]" value="<?php echo $option->f('QSO_value'); ?>" >
182 182
 										<?php endif; ?>
183 183
 									</td>
@@ -185,7 +185,7 @@  discard block
 block discarded – undo
185 185
 										<input type="text" class="option-desc regular-text" name="question_options[<?php echo $count?>][QSO_desc]" value="<?php $option->f('QSO_desc')?>">
186 186
 									</td>
187 187
 									<td>
188
-										<?php if ( ! $option->system() ) { ?>
188
+										<?php if ( ! $option->system()) { ?>
189 189
 											<span class="dashicons clickable dashicons-post-trash ee-icon-size-18 remove-option remove-item"></span>
190 190
 										<?php } ?>
191 191
 										<span class="dashicons dashicons-image-flip-vertical sortable-drag-handle ee-icon-size-18"></span>
@@ -224,13 +224,13 @@  discard block
 block discarded – undo
224 224
 					</table>
225 225
 
226 226
 					<a id="new-question-option" class="button" style="margin:0 0 1em 3px;">
227
-						<?php esc_html_e('Add Another Answer Option','event_espresso')?>
227
+						<?php esc_html_e('Add Another Answer Option', 'event_espresso')?>
228 228
 					</a><br/>
229 229
 
230 230
 					<p class="description">
231
-						<?php esc_html_e('Answer Options are the choices that you give people to select from for RADIO_BTN, CHECKBOX or DROPDOWN questions. The Value is a simple key that will be saved to the database and the description is optional. Note that values CANNOT contain any HTML, but descriptions can.','event_espresso')?>
231
+						<?php esc_html_e('Answer Options are the choices that you give people to select from for RADIO_BTN, CHECKBOX or DROPDOWN questions. The Value is a simple key that will be saved to the database and the description is optional. Note that values CANNOT contain any HTML, but descriptions can.', 'event_espresso')?>
232 232
 					</p>
233
-					<?php if ( $has_answers ) : ?>
233
+					<?php if ($has_answers) : ?>
234 234
 					<p class="description" style="color:#D54E21;">
235 235
 							<?php esc_html_e('Answer values that are uneditable are this way because there are registrations in the database that have answers for this question.  If you need to correct a mistake, or edit an existing option value, then trash the existing one and create a new option with the changes.  This will ensure that the existing registrations that chose the original answer will preserve that answer.', 'event_espresso'); ?>
236 236
 					</p>
@@ -241,32 +241,32 @@  discard block
 block discarded – undo
241 241
 
242 242
 			<tr>
243 243
 				<th>
244
-					<label for="QST_required"><?php echo $fields['QST_required']->get_nicename();?></label> <?php echo EEH_Template::get_help_tab_link('required_question_info');?>
244
+					<label for="QST_required"><?php echo $fields['QST_required']->get_nicename(); ?></label> <?php echo EEH_Template::get_help_tab_link('required_question_info'); ?>
245 245
 				</th>
246 246
 				<td>
247 247
 					<?php
248
-					$system_required = array( 'fname', 'email' );
249
-					$disabled = in_array( $QST_system, $system_required ) ? ' disabled="disabled"' : '';
248
+					$system_required = array('fname', 'email');
249
+					$disabled = in_array($QST_system, $system_required) ? ' disabled="disabled"' : '';
250 250
 					$required_on = $question->get('QST_admin_only');
251 251
 					$show_required_msg = $required_on ? '' : ' display:none;';
252
-					$disabled = $required_on || ! empty( $disabled ) ? ' disabled="disabled"' : '';
253
-					$id =  ! empty( $disabled ) && in_array( $QST_system, $system_required) ? '_disabled' : '';
254
-					$requiredOptions=array(
255
-						array( 'text'=> esc_html__( 'Optional', 'event_espresso' ), 'id'=>0 ),
256
-						array( 'text'=> esc_html__( 'Required', 'event_espresso' ), 'id'=>1 )
252
+					$disabled = $required_on || ! empty($disabled) ? ' disabled="disabled"' : '';
253
+					$id = ! empty($disabled) && in_array($QST_system, $system_required) ? '_disabled' : '';
254
+					$requiredOptions = array(
255
+						array('text'=> esc_html__('Optional', 'event_espresso'), 'id'=>0),
256
+						array('text'=> esc_html__('Required', 'event_espresso'), 'id'=>1)
257 257
 					);
258
-					echo EEH_Form_Fields::select_input('QST_required' . $id, $requiredOptions, $question->required(), 'id="QST_required' . $id . '"' . $disabled );
258
+					echo EEH_Form_Fields::select_input('QST_required'.$id, $requiredOptions, $question->required(), 'id="QST_required'.$id.'"'.$disabled);
259 259
 					?>
260 260
 						<p><span id="required_toggled_on" class="description" style="color:#D54E21;<?php echo $show_required_msg; ?>">
261
-						<?php esc_html_e('Required is set to optional, and this field is disabled, because the question is Admin-Only.','event_espresso')?>
261
+						<?php esc_html_e('Required is set to optional, and this field is disabled, because the question is Admin-Only.', 'event_espresso')?>
262 262
 						</span></p>
263 263
 						<p><span id="required_toggled_off" class="description" style="color:#D54E21; display: none;">
264
-							<?php esc_html_e('Required option field is no longer disabled because the question is not Admin-Only','event_espresso')?>
264
+							<?php esc_html_e('Required option field is no longer disabled because the question is not Admin-Only', 'event_espresso')?>
265 265
 						</span></p>
266
-					<?php if ( ! empty( $disabled ) && in_array( $QST_system, $system_required ) ) { ?>
266
+					<?php if ( ! empty($disabled) && in_array($QST_system, $system_required)) { ?>
267 267
 						<input type="hidden"  id="QST_required" name="QST_required" value="1"/>
268 268
 						<p><span class="description" style="color:#D54E21;">
269
-						<?php esc_html_e('System question! This field cannot be changed.','event_espresso')?>
269
+						<?php esc_html_e('System question! This field cannot be changed.', 'event_espresso')?>
270 270
 					</span></p>
271 271
 					<?php } ?>
272 272
 
@@ -275,7 +275,7 @@  discard block
 block discarded – undo
275 275
 
276 276
 			<tr>
277 277
 				<th>
278
-					<label for="QST_required_text"><?php esc_html_e('Required Text', 'event_espresso'); ?></label> <?php echo EEH_Template::get_help_tab_link('required_text_info');?>
278
+					<label for="QST_required_text"><?php esc_html_e('Required Text', 'event_espresso'); ?></label> <?php echo EEH_Template::get_help_tab_link('required_text_info'); ?>
279 279
 				</th>
280 280
 				<td>
281 281
 					<input type="text" maxlength="100" class="regular-text" id="QST_required_text" name="QST_required_text" value="<?php  $question->f('QST_required_text')?>"/>
Please login to merge, or discard this patch.
admin_pages/transactions/Transactions_Admin_Page.core.php 2 patches
Indentation   +59 added lines, -59 removed lines patch added patch discarded remove patch
@@ -106,9 +106,9 @@  discard block
 block discarded – undo
106 106
 
107 107
 	/**
108 108
 	 * 		grab url requests and route them
109
-	*		@access private
110
-	*		@return void
111
-	*/
109
+	 *		@access private
110
+	 *		@return void
111
+	 */
112 112
 	public function _set_page_routes() {
113 113
 
114 114
 		$this->_set_transaction_status_array();
@@ -263,10 +263,10 @@  discard block
 block discarded – undo
263 263
 	/**
264 264
 	 * _set_transaction_status_array
265 265
 	 * sets list of transaction statuses
266
-	*
266
+	 *
267 267
 	 * @access private
268
-	*	@return void
269
-	*/
268
+	 *	@return void
269
+	 */
270 270
 	private function _set_transaction_status_array() {
271 271
 		self::$_txn_status = EEM_Transaction::instance()->status_array(TRUE);
272 272
 	}
@@ -288,10 +288,10 @@  discard block
 block discarded – undo
288 288
 
289 289
 	/**
290 290
 	 * 	get list of payment statuses
291
-	*
291
+	 *
292 292
 	 * @access private
293
-	*	@return void
294
-	*/
293
+	 *	@return void
294
+	 */
295 295
 	private function _get_payment_status_array() {
296 296
 		self::$_pay_status = EEM_Payment::instance()->status_array(TRUE);
297 297
 		$this->_template_args['payment_status'] = self::$_pay_status;
@@ -399,18 +399,18 @@  discard block
 block discarded – undo
399 399
 		if ( is_object( $this->_transaction) )
400 400
 			return; //get out we've already set the object
401 401
 
402
-	    $TXN = EEM_Transaction::instance();
402
+		$TXN = EEM_Transaction::instance();
403 403
 
404
-	    $TXN_ID = ( ! empty( $this->_req_data['TXN_ID'] )) ? absint( $this->_req_data['TXN_ID'] ) : FALSE;
404
+		$TXN_ID = ( ! empty( $this->_req_data['TXN_ID'] )) ? absint( $this->_req_data['TXN_ID'] ) : FALSE;
405 405
 
406
-	    //get transaction object
407
-	    $this->_transaction = $TXN->get_one_by_ID($TXN_ID);
408
-	    $this->_session = !empty( $this->_transaction ) ? $this->_transaction->get('TXN_session_data') : NULL;
406
+		//get transaction object
407
+		$this->_transaction = $TXN->get_one_by_ID($TXN_ID);
408
+		$this->_session = !empty( $this->_transaction ) ? $this->_transaction->get('TXN_session_data') : NULL;
409 409
 
410 410
 	 	if ( empty( $this->_transaction ) ) {
411
-	    	$error_msg = esc_html__('An error occurred and the details for Transaction ID #', 'event_espresso') . $TXN_ID .  esc_html__(' could not be retrieved.', 'event_espresso');
411
+			$error_msg = esc_html__('An error occurred and the details for Transaction ID #', 'event_espresso') . $TXN_ID .  esc_html__(' could not be retrieved.', 'event_espresso');
412 412
 			EE_Error::add_error( $error_msg, __FILE__, __FUNCTION__, __LINE__ );
413
-	    }
413
+		}
414 414
 	}
415 415
 
416 416
 
@@ -525,12 +525,12 @@  discard block
 block discarded – undo
525 525
 
526 526
 
527 527
 	/**
528
-	* 	_transaction_details
528
+	 * 	_transaction_details
529 529
 	 * generates HTML for the View Transaction Details Admin page
530
-	*
530
+	 *
531 531
 	 * @access protected
532
-	*	@return void
533
-	*/
532
+	 *	@return void
533
+	 */
534 534
 	protected function _transaction_details() {
535 535
 		do_action( 'AHEE__Transactions_Admin_Page__transaction_details__start', $this->_transaction );
536 536
 
@@ -581,7 +581,7 @@  discard block
 block discarded – undo
581 581
 						'button secondary-button right',
582 582
 						'dashicons dashicons-email-alt'
583 583
 					)
584
-				    : '';
584
+					: '';
585 585
 		} else {
586 586
 			$this->_template_args['send_payment_reminder_button'] = '';
587 587
 		}
@@ -735,10 +735,10 @@  discard block
 block discarded – undo
735 735
 	/**
736 736
 	 * txn_details_meta_box
737 737
 	 * generates HTML for the Transaction main meta box
738
-	*
738
+	 *
739 739
 	 * @access public
740
-	*	@return void
741
-	*/
740
+	 *	@return void
741
+	 */
742 742
 	public function txn_details_meta_box() {
743 743
 
744 744
 		$this->_set_transaction_object();
@@ -1078,10 +1078,10 @@  discard block
 block discarded – undo
1078 1078
 	/**
1079 1079
 	 * txn_billing_info_side_meta_box
1080 1080
 	 * 	generates HTML for the Edit Transaction side meta box
1081
-	*
1081
+	 *
1082 1082
 	 * @access public
1083
-	*	@return void
1084
-	*/
1083
+	 *	@return void
1084
+	 */
1085 1085
 	public function txn_billing_info_side_meta_box() {
1086 1086
 
1087 1087
 		$this->_template_args['billing_form'] = $this->_transaction->billing_info();
@@ -1099,10 +1099,10 @@  discard block
 block discarded – undo
1099 1099
 	/**
1100 1100
 	 * apply_payments_or_refunds
1101 1101
 	 * 	registers a payment or refund made towards a transaction
1102
-	*
1102
+	 *
1103 1103
 	 * @access public
1104
-	*	@return void
1105
-	*/
1104
+	 *	@return void
1105
+	 */
1106 1106
 	public function apply_payments_or_refunds() {
1107 1107
 		$json_response_data = array( 'return_data' => FALSE );
1108 1108
 		$valid_data = $this->_validate_payment_request_data();
@@ -1256,9 +1256,9 @@  discard block
 block discarded – undo
1256 1256
 							'default' => '',
1257 1257
 							'required' => false,
1258 1258
 							'html_label_text' => esc_html__( 'Transaction or Cheque Number', 'event_espresso' ),
1259
-                                                        'validation_strategies' => array(
1260
-                                                            new EE_Max_Length_Validation_Strategy( esc_html__('Input too long', 'event_espresso'), 100 ),
1261
-                                                        )
1259
+														'validation_strategies' => array(
1260
+															new EE_Max_Length_Validation_Strategy( esc_html__('Input too long', 'event_espresso'), 100 ),
1261
+														)
1262 1262
 						)
1263 1263
 					),
1264 1264
 					'po_number' => new EE_Text_Input(
@@ -1266,9 +1266,9 @@  discard block
 block discarded – undo
1266 1266
 							'default' => '',
1267 1267
 							'required' => false,
1268 1268
 							'html_label_text' => esc_html__( 'Purchase Order Number', 'event_espresso' ),
1269
-                                                        'validation_strategies' => array(
1270
-                                                            new EE_Max_Length_Validation_Strategy( esc_html__('Input too long', 'event_espresso'), 100 ),
1271
-                                                        )
1269
+														'validation_strategies' => array(
1270
+															new EE_Max_Length_Validation_Strategy( esc_html__('Input too long', 'event_espresso'), 100 ),
1271
+														)
1272 1272
 						)
1273 1273
 					),
1274 1274
 					'accounting' => new EE_Text_Input(
@@ -1276,9 +1276,9 @@  discard block
 block discarded – undo
1276 1276
 							'default' => '',
1277 1277
 							'required' => false,
1278 1278
 							'html_label_text' => esc_html__( 'Extra Field for Accounting', 'event_espresso' ),
1279
-                                                        'validation_strategies' => array(
1280
-                                                            new EE_Max_Length_Validation_Strategy( esc_html__('Input too long', 'event_espresso'), 100 ),
1281
-                                                        )
1279
+														'validation_strategies' => array(
1280
+															new EE_Max_Length_Validation_Strategy( esc_html__('Input too long', 'event_espresso'), 100 ),
1281
+														)
1282 1282
 						)
1283 1283
 					),
1284 1284
 				)
@@ -1573,10 +1573,10 @@  discard block
 block discarded – undo
1573 1573
 	/**
1574 1574
 	 * delete_payment
1575 1575
 	 * 	delete a payment or refund made towards a transaction
1576
-	*
1576
+	 *
1577 1577
 	 * @access public
1578
-	*	@return void
1579
-	*/
1578
+	 *	@return void
1579
+	 */
1580 1580
 	public function delete_payment() {
1581 1581
 		$json_response_data = array( 'return_data' => FALSE );
1582 1582
 		$PAY_ID = isset( $this->_req_data['delete_txn_admin_payment'], $this->_req_data['delete_txn_admin_payment']['PAY_ID'] ) ? absint( $this->_req_data['delete_txn_admin_payment']['PAY_ID'] ) : 0;
@@ -1693,12 +1693,12 @@  discard block
 block discarded – undo
1693 1693
 	/**
1694 1694
 	 * _send_payment_reminder
1695 1695
 	 * 	generates HTML for the View Transaction Details Admin page
1696
-	*
1696
+	 *
1697 1697
 	 * @access protected
1698
-	*	@return void
1699
-	*/
1698
+	 *	@return void
1699
+	 */
1700 1700
 	protected function _send_payment_reminder() {
1701
-	    $TXN_ID = ( ! empty( $this->_req_data['TXN_ID'] )) ? absint( $this->_req_data['TXN_ID'] ) : FALSE;
1701
+		$TXN_ID = ( ! empty( $this->_req_data['TXN_ID'] )) ? absint( $this->_req_data['TXN_ID'] ) : FALSE;
1702 1702
 		$transaction = EEM_Transaction::instance()->get_one_by_ID( $TXN_ID );
1703 1703
 		$query_args = isset($this->_req_data['redirect_to'] ) ? array('action' => $this->_req_data['redirect_to'], 'TXN_ID' => $this->_req_data['TXN_ID'] ) : array();
1704 1704
 		do_action( 'AHEE__Transactions_Admin_Page___send_payment_reminder__process_admin_payment_reminder', $transaction );
@@ -1720,29 +1720,29 @@  discard block
 block discarded – undo
1720 1720
 
1721 1721
 		$TXN = EEM_Transaction::instance();
1722 1722
 
1723
-	    $start_date = isset( $this->_req_data['txn-filter-start-date'] ) ? wp_strip_all_tags( $this->_req_data['txn-filter-start-date'] ) : date( 'm/d/Y', strtotime( '-10 year' ));
1724
-	    $end_date = isset( $this->_req_data['txn-filter-end-date'] ) ? wp_strip_all_tags( $this->_req_data['txn-filter-end-date'] ) : date( 'm/d/Y' );
1723
+		$start_date = isset( $this->_req_data['txn-filter-start-date'] ) ? wp_strip_all_tags( $this->_req_data['txn-filter-start-date'] ) : date( 'm/d/Y', strtotime( '-10 year' ));
1724
+		$end_date = isset( $this->_req_data['txn-filter-end-date'] ) ? wp_strip_all_tags( $this->_req_data['txn-filter-end-date'] ) : date( 'm/d/Y' );
1725 1725
 
1726
-	    //make sure our timestamps start and end right at the boundaries for each day
1727
-	    $start_date = date( 'Y-m-d', strtotime( $start_date ) ) . ' 00:00:00';
1728
-	    $end_date = date( 'Y-m-d', strtotime( $end_date ) ) . ' 23:59:59';
1726
+		//make sure our timestamps start and end right at the boundaries for each day
1727
+		$start_date = date( 'Y-m-d', strtotime( $start_date ) ) . ' 00:00:00';
1728
+		$end_date = date( 'Y-m-d', strtotime( $end_date ) ) . ' 23:59:59';
1729 1729
 
1730 1730
 
1731
-	    //convert to timestamps
1732
-	    $start_date = strtotime( $start_date );
1733
-	    $end_date = strtotime( $end_date );
1731
+		//convert to timestamps
1732
+		$start_date = strtotime( $start_date );
1733
+		$end_date = strtotime( $end_date );
1734 1734
 
1735
-	    //makes sure start date is the lowest value and vice versa
1736
-	    $start_date = min( $start_date, $end_date );
1737
-	    $end_date = max( $start_date, $end_date );
1735
+		//makes sure start date is the lowest value and vice versa
1736
+		$start_date = min( $start_date, $end_date );
1737
+		$end_date = max( $start_date, $end_date );
1738 1738
 
1739
-	    //convert to correct format for query
1739
+		//convert to correct format for query
1740 1740
 	$start_date = EEM_Transaction::instance()->convert_datetime_for_query( 'TXN_timestamp', date( 'Y-m-d H:i:s', $start_date ), 'Y-m-d H:i:s' );
1741 1741
 	$end_date = EEM_Transaction::instance()->convert_datetime_for_query( 'TXN_timestamp', date( 'Y-m-d H:i:s', $end_date ), 'Y-m-d H:i:s' );
1742 1742
 
1743 1743
 
1744 1744
 
1745
-	    //set orderby
1745
+		//set orderby
1746 1746
 		$this->_req_data['orderby'] = ! empty($this->_req_data['orderby']) ? $this->_req_data['orderby'] : '';
1747 1747
 
1748 1748
 		switch ( $this->_req_data['orderby'] ) {
Please login to merge, or discard this patch.
Spacing   +418 added lines, -418 removed lines patch added patch discarded remove patch
@@ -56,8 +56,8 @@  discard block
 block discarded – undo
56 56
 	 * @param bool $routing
57 57
 	 * @return Transactions_Admin_Page
58 58
 	 */
59
-	public function __construct( $routing = TRUE ) {
60
-		parent::__construct( $routing );
59
+	public function __construct($routing = TRUE) {
60
+		parent::__construct($routing);
61 61
 	}
62 62
 
63 63
 
@@ -80,9 +80,9 @@  discard block
 block discarded – undo
80 80
 	 * @return void
81 81
 	 */
82 82
 	protected function _ajax_hooks() {
83
-		add_action('wp_ajax_espresso_apply_payment', array( $this, 'apply_payments_or_refunds'));
84
-		add_action('wp_ajax_espresso_apply_refund', array( $this, 'apply_payments_or_refunds'));
85
-		add_action('wp_ajax_espresso_delete_payment', array( $this, 'delete_payment'));
83
+		add_action('wp_ajax_espresso_apply_payment', array($this, 'apply_payments_or_refunds'));
84
+		add_action('wp_ajax_espresso_apply_refund', array($this, 'apply_payments_or_refunds'));
85
+		add_action('wp_ajax_espresso_delete_payment', array($this, 'delete_payment'));
86 86
 	}
87 87
 
88 88
 
@@ -97,7 +97,7 @@  discard block
 block discarded – undo
97 97
 			'buttons' => array(
98 98
 				'add' => esc_html__('Add New Transaction', 'event_espresso'),
99 99
 				'edit' => esc_html__('Edit Transaction', 'event_espresso'),
100
-				'delete' => esc_html__('Delete Transaction','event_espresso'),
100
+				'delete' => esc_html__('Delete Transaction', 'event_espresso'),
101 101
 			)
102 102
 		);
103 103
 	}
@@ -113,7 +113,7 @@  discard block
 block discarded – undo
113 113
 
114 114
 		$this->_set_transaction_status_array();
115 115
 
116
-		$txn_id = ! empty( $this->_req_data['TXN_ID'] ) && ! is_array( $this->_req_data['TXN_ID'] ) ? $this->_req_data['TXN_ID'] : 0;
116
+		$txn_id = ! empty($this->_req_data['TXN_ID']) && ! is_array($this->_req_data['TXN_ID']) ? $this->_req_data['TXN_ID'] : 0;
117 117
 
118 118
 		$this->_page_routes = array(
119 119
 
@@ -185,7 +185,7 @@  discard block
 block discarded – undo
185 185
 						'filename' => 'transactions_overview_views_filters_search'
186 186
 					),
187 187
 				),
188
-				'help_tour' => array( 'Transactions_Overview_Help_Tour' ),
188
+				'help_tour' => array('Transactions_Overview_Help_Tour'),
189 189
 				/**
190 190
 				 * commented out because currently we are not displaying tips for transaction list table status but this
191 191
 				 * may change in a later iteration so want to keep the code for then.
@@ -197,7 +197,7 @@  discard block
 block discarded – undo
197 197
 				'nav' => array(
198 198
 					'label' => esc_html__('View Transaction', 'event_espresso'),
199 199
 					'order' => 5,
200
-					'url' => isset($this->_req_data['TXN_ID']) ? add_query_arg(array('TXN_ID' => $this->_req_data['TXN_ID'] ), $this->_current_page_view_url )  : $this->_admin_base_url,
200
+					'url' => isset($this->_req_data['TXN_ID']) ? add_query_arg(array('TXN_ID' => $this->_req_data['TXN_ID']), $this->_current_page_view_url) : $this->_admin_base_url,
201 201
 					'persistent' => FALSE
202 202
 					),
203 203
 				'help_tabs' => array(
@@ -218,8 +218,8 @@  discard block
 block discarded – undo
218 218
 						'filename' => 'transactions_view_transaction_primary_registrant_billing_information'
219 219
 					),
220 220
 				),
221
-				'qtips' => array( 'Transaction_Details_Tips' ),
222
-				'help_tour' => array( 'Transaction_Details_Help_Tour' ),
221
+				'qtips' => array('Transaction_Details_Tips'),
222
+				'help_tour' => array('Transaction_Details_Help_Tour'),
223 223
 				'metaboxes' => array('_transaction_details_metaboxes'),
224 224
 
225 225
 				'require_nonce' => FALSE
@@ -237,23 +237,23 @@  discard block
 block discarded – undo
237 237
 		// IF a registration was JUST added via the admin...
238 238
 		if (
239 239
 		isset(
240
-			$this->_req_data[ 'redirect_from' ],
241
-			$this->_req_data[ 'EVT_ID' ],
242
-			$this->_req_data[ 'event_name' ]
240
+			$this->_req_data['redirect_from'],
241
+			$this->_req_data['EVT_ID'],
242
+			$this->_req_data['event_name']
243 243
 		)
244 244
 		) {
245 245
 			// then set a cookie so that we can block any attempts to use
246 246
 			// the back button as a way to enter another registration.
247
-			setcookie( 'ee_registration_added', $this->_req_data[ 'EVT_ID' ], time() + WEEK_IN_SECONDS, '/' );
247
+			setcookie('ee_registration_added', $this->_req_data['EVT_ID'], time() + WEEK_IN_SECONDS, '/');
248 248
 			// and update the global
249
-			$_COOKIE[ 'ee_registration_added' ] = $this->_req_data[ 'EVT_ID' ];
249
+			$_COOKIE['ee_registration_added'] = $this->_req_data['EVT_ID'];
250 250
 		}
251
-		EE_Registry::$i18n_js_strings[ 'invalid_server_response' ] = esc_html__( 'An error occurred! Your request may have been processed, but a valid response from the server was not received. Please refresh the page and try again.', 'event_espresso' );
252
-		EE_Registry::$i18n_js_strings[ 'error_occurred' ] = esc_html__( 'An error occurred! Please refresh the page and try again.', 'event_espresso' );
253
-		EE_Registry::$i18n_js_strings[ 'txn_status_array' ] = self::$_txn_status;
254
-		EE_Registry::$i18n_js_strings[ 'pay_status_array' ] = self::$_pay_status;
255
-		EE_Registry::$i18n_js_strings[ 'payments_total' ] = esc_html__( 'Payments Total', 'event_espresso' );
256
-		EE_Registry::$i18n_js_strings[ 'transaction_overpaid' ] = esc_html__( 'This transaction has been overpaid ! Payments Total', 'event_espresso' );
251
+		EE_Registry::$i18n_js_strings['invalid_server_response'] = esc_html__('An error occurred! Your request may have been processed, but a valid response from the server was not received. Please refresh the page and try again.', 'event_espresso');
252
+		EE_Registry::$i18n_js_strings['error_occurred'] = esc_html__('An error occurred! Please refresh the page and try again.', 'event_espresso');
253
+		EE_Registry::$i18n_js_strings['txn_status_array'] = self::$_txn_status;
254
+		EE_Registry::$i18n_js_strings['pay_status_array'] = self::$_pay_status;
255
+		EE_Registry::$i18n_js_strings['payments_total'] = esc_html__('Payments Total', 'event_espresso');
256
+		EE_Registry::$i18n_js_strings['transaction_overpaid'] = esc_html__('This transaction has been overpaid ! Payments Total', 'event_espresso');
257 257
 	}
258 258
 	public function admin_notices() {}
259 259
 	public function admin_footer_scripts() {}
@@ -320,14 +320,14 @@  discard block
 block discarded – undo
320 320
 	 */
321 321
 	public function load_scripts_styles() {
322 322
 		//enqueue style
323
-		wp_register_style( 'espresso_txn', TXN_ASSETS_URL . 'espresso_transactions_admin.css', array(), EVENT_ESPRESSO_VERSION );
323
+		wp_register_style('espresso_txn', TXN_ASSETS_URL.'espresso_transactions_admin.css', array(), EVENT_ESPRESSO_VERSION);
324 324
 		wp_enqueue_style('espresso_txn');
325 325
 
326 326
 		//scripts
327 327
 		add_filter('FHEE_load_accounting_js', '__return_true');
328 328
 
329 329
 		//scripts
330
-		wp_register_script('espresso_txn', TXN_ASSETS_URL . 'espresso_transactions_admin.js', array('ee_admin_js', 'ee-datepicker', 'jquery-ui-datepicker', 'jquery-ui-draggable', 'ee-dialog', 'ee-accounting', 'ee-serialize-full-array'), EVENT_ESPRESSO_VERSION, TRUE);
330
+		wp_register_script('espresso_txn', TXN_ASSETS_URL.'espresso_transactions_admin.js', array('ee_admin_js', 'ee-datepicker', 'jquery-ui-datepicker', 'jquery-ui-draggable', 'ee-dialog', 'ee-accounting', 'ee-serialize-full-array'), EVENT_ESPRESSO_VERSION, TRUE);
331 331
 		wp_enqueue_script('espresso_txn');
332 332
 
333 333
 	}
@@ -367,8 +367,8 @@  discard block
 block discarded – undo
367 367
 	 *	@return void
368 368
 	 */
369 369
 	protected function _set_list_table_views_default() {
370
-		$this->_views = array (
371
-			'all' => array (
370
+		$this->_views = array(
371
+			'all' => array(
372 372
 				'slug' 		=> 'all',
373 373
 				'label' 		=> esc_html__('View All Transactions', 'event_espresso'),
374 374
 				'count' 	=> 0
@@ -396,20 +396,20 @@  discard block
 block discarded – undo
396 396
 	 *	@return void
397 397
 	 */
398 398
 	private function _set_transaction_object() {
399
-		if ( is_object( $this->_transaction) )
399
+		if (is_object($this->_transaction))
400 400
 			return; //get out we've already set the object
401 401
 
402 402
 	    $TXN = EEM_Transaction::instance();
403 403
 
404
-	    $TXN_ID = ( ! empty( $this->_req_data['TXN_ID'] )) ? absint( $this->_req_data['TXN_ID'] ) : FALSE;
404
+	    $TXN_ID = ( ! empty($this->_req_data['TXN_ID'])) ? absint($this->_req_data['TXN_ID']) : FALSE;
405 405
 
406 406
 	    //get transaction object
407 407
 	    $this->_transaction = $TXN->get_one_by_ID($TXN_ID);
408
-	    $this->_session = !empty( $this->_transaction ) ? $this->_transaction->get('TXN_session_data') : NULL;
408
+	    $this->_session = ! empty($this->_transaction) ? $this->_transaction->get('TXN_session_data') : NULL;
409 409
 
410
-	 	if ( empty( $this->_transaction ) ) {
411
-	    	$error_msg = esc_html__('An error occurred and the details for Transaction ID #', 'event_espresso') . $TXN_ID .  esc_html__(' could not be retrieved.', 'event_espresso');
412
-			EE_Error::add_error( $error_msg, __FILE__, __FUNCTION__, __LINE__ );
410
+	 	if (empty($this->_transaction)) {
411
+	    	$error_msg = esc_html__('An error occurred and the details for Transaction ID #', 'event_espresso').$TXN_ID.esc_html__(' could not be retrieved.', 'event_espresso');
412
+			EE_Error::add_error($error_msg, __FILE__, __FUNCTION__, __LINE__);
413 413
 	    }
414 414
 	}
415 415
 
@@ -422,12 +422,12 @@  discard block
 block discarded – undo
422 422
 	 *	@return array
423 423
 	 */
424 424
 	protected function _transaction_legend_items() {
425
-		EE_Registry::instance()->load_helper( 'MSG_Template' );
425
+		EE_Registry::instance()->load_helper('MSG_Template');
426 426
 		$items = array();
427 427
 
428
-		if ( EE_Registry::instance()->CAP->current_user_can( 'ee_read_global_messages', 'view_filtered_messages' ) ) {
429
-			$related_for_icon = EEH_MSG_Template::get_message_action_icon( 'see_notifications_for' );
430
-			if ( isset( $related_for_icon['css_class']) && isset( $related_for_icon['label'] ) ) {
428
+		if (EE_Registry::instance()->CAP->current_user_can('ee_read_global_messages', 'view_filtered_messages')) {
429
+			$related_for_icon = EEH_MSG_Template::get_message_action_icon('see_notifications_for');
430
+			if (isset($related_for_icon['css_class']) && isset($related_for_icon['label'])) {
431 431
 				$items['view_related_messages'] = array(
432 432
 					'class' => $related_for_icon['css_class'],
433 433
 					'desc' => $related_for_icon['label'],
@@ -437,7 +437,7 @@  discard block
 block discarded – undo
437 437
 
438 438
 		$items = apply_filters(
439 439
 			'FHEE__Transactions_Admin_Page___transaction_legend_items__items',
440
-			array_merge( $items,
440
+			array_merge($items,
441 441
 				array(
442 442
 					'view_details' => array(
443 443
 						'class' => 'dashicons dashicons-cart',
@@ -449,7 +449,7 @@  discard block
 block discarded – undo
449 449
 					),
450 450
 					'view_receipt' => array(
451 451
 						'class' => 'dashicons dashicons-media-default',
452
-						'desc' => esc_html__('View Transaction Receipt', 'event_espresso' )
452
+						'desc' => esc_html__('View Transaction Receipt', 'event_espresso')
453 453
 					),
454 454
 					'view_registration' => array(
455 455
 						'class' => 'dashicons dashicons-clipboard',
@@ -459,8 +459,8 @@  discard block
 block discarded – undo
459 459
 			)
460 460
 		);
461 461
 
462
-		if ( EE_Registry::instance()->CAP->current_user_can( 'ee_send_message', 'espresso_transactions_send_payment_reminder' ) ) {
463
-			if ( EEH_MSG_Template::is_mt_active( 'payment_reminder' ) ) {
462
+		if (EE_Registry::instance()->CAP->current_user_can('ee_send_message', 'espresso_transactions_send_payment_reminder')) {
463
+			if (EEH_MSG_Template::is_mt_active('payment_reminder')) {
464 464
 				$items['send_payment_reminder'] = array(
465 465
 					'class' => 'dashicons dashicons-email-alt',
466 466
 					'desc' => esc_html__('Send Payment Reminder', 'event_espresso')
@@ -481,29 +481,29 @@  discard block
 block discarded – undo
481 481
 			'FHEE__Transactions_Admin_Page___transaction_legend_items__more_items',
482 482
 			array(
483 483
 				'overpaid'   => array(
484
-					'class' => 'ee-status-legend ee-status-legend-' . EEM_Transaction::overpaid_status_code,
485
-					'desc'  => EEH_Template::pretty_status( EEM_Transaction::overpaid_status_code, FALSE, 'sentence' )
484
+					'class' => 'ee-status-legend ee-status-legend-'.EEM_Transaction::overpaid_status_code,
485
+					'desc'  => EEH_Template::pretty_status(EEM_Transaction::overpaid_status_code, FALSE, 'sentence')
486 486
 				),
487 487
 				'complete'   => array(
488
-					'class' => 'ee-status-legend ee-status-legend-' . EEM_Transaction::complete_status_code,
489
-					'desc'  => EEH_Template::pretty_status( EEM_Transaction::complete_status_code, FALSE, 'sentence' )
488
+					'class' => 'ee-status-legend ee-status-legend-'.EEM_Transaction::complete_status_code,
489
+					'desc'  => EEH_Template::pretty_status(EEM_Transaction::complete_status_code, FALSE, 'sentence')
490 490
 				),
491 491
 				'incomplete' => array(
492
-					'class' => 'ee-status-legend ee-status-legend-' . EEM_Transaction::incomplete_status_code,
493
-					'desc'  => EEH_Template::pretty_status( EEM_Transaction::incomplete_status_code, FALSE, 'sentence' )
492
+					'class' => 'ee-status-legend ee-status-legend-'.EEM_Transaction::incomplete_status_code,
493
+					'desc'  => EEH_Template::pretty_status(EEM_Transaction::incomplete_status_code, FALSE, 'sentence')
494 494
 				),
495 495
 				'abandoned'  => array(
496
-					'class' => 'ee-status-legend ee-status-legend-' . EEM_Transaction::abandoned_status_code,
497
-					'desc'  => EEH_Template::pretty_status( EEM_Transaction::abandoned_status_code, FALSE, 'sentence' )
496
+					'class' => 'ee-status-legend ee-status-legend-'.EEM_Transaction::abandoned_status_code,
497
+					'desc'  => EEH_Template::pretty_status(EEM_Transaction::abandoned_status_code, FALSE, 'sentence')
498 498
 				),
499 499
 				'failed'     => array(
500
-					'class' => 'ee-status-legend ee-status-legend-' . EEM_Transaction::failed_status_code,
501
-					'desc'  => EEH_Template::pretty_status( EEM_Transaction::failed_status_code, FALSE, 'sentence' )
500
+					'class' => 'ee-status-legend ee-status-legend-'.EEM_Transaction::failed_status_code,
501
+					'desc'  => EEH_Template::pretty_status(EEM_Transaction::failed_status_code, FALSE, 'sentence')
502 502
 				)
503 503
 			)
504 504
 		);
505 505
 
506
-		return array_merge( $items, $more_items);
506
+		return array_merge($items, $more_items);
507 507
 	}
508 508
 
509 509
 
@@ -516,9 +516,9 @@  discard block
 block discarded – undo
516 516
 	 */
517 517
 	protected function _transactions_overview_list_table() {
518 518
 		$this->_admin_page_title = esc_html__('Transactions', 'event_espresso');
519
-		$event = isset($this->_req_data['EVT_ID']) ? EEM_Event::instance()->get_one_by_ID($this->_req_data['EVT_ID'] ) : NULL;
520
-		$this->_template_args['admin_page_header'] = $event instanceof EE_Event ? sprintf( esc_html__('%sViewing Transactions for the Event: %s%s', 'event_espresso'), '<h3>', '<a href="' . EE_Admin_Page::add_query_args_and_nonce(array('action' => 'edit', 'post' => $event->ID()), EVENTS_ADMIN_URL ) . '" title="' . esc_attr__('Click to Edit event', 'event_espresso') . '">' . $event->get('EVT_name') . '</a>', '</h3>' ) : '';
521
-		$this->_template_args['after_list_table'] = $this->_display_legend( $this->_transaction_legend_items() );
519
+		$event = isset($this->_req_data['EVT_ID']) ? EEM_Event::instance()->get_one_by_ID($this->_req_data['EVT_ID']) : NULL;
520
+		$this->_template_args['admin_page_header'] = $event instanceof EE_Event ? sprintf(esc_html__('%sViewing Transactions for the Event: %s%s', 'event_espresso'), '<h3>', '<a href="'.EE_Admin_Page::add_query_args_and_nonce(array('action' => 'edit', 'post' => $event->ID()), EVENTS_ADMIN_URL).'" title="'.esc_attr__('Click to Edit event', 'event_espresso').'">'.$event->get('EVT_name').'</a>', '</h3>') : '';
521
+		$this->_template_args['after_list_table'] = $this->_display_legend($this->_transaction_legend_items());
522 522
 		$this->display_admin_list_table_page_with_no_sidebar();
523 523
 	}
524 524
 
@@ -532,7 +532,7 @@  discard block
 block discarded – undo
532 532
 	*	@return void
533 533
 	*/
534 534
 	protected function _transaction_details() {
535
-		do_action( 'AHEE__Transactions_Admin_Page__transaction_details__start', $this->_transaction );
535
+		do_action('AHEE__Transactions_Admin_Page__transaction_details__start', $this->_transaction);
536 536
 
537 537
 		$this->_set_transaction_status_array();
538 538
 
@@ -545,14 +545,14 @@  discard block
 block discarded – undo
545 545
 		$attendee = $primary_registration instanceof EE_Registration ? $primary_registration->attendee() : NULL;
546 546
 
547 547
 		$this->_template_args['txn_nmbr']['value'] = $this->_transaction->ID();
548
-		$this->_template_args['txn_nmbr']['label'] = esc_html__( 'Transaction Number', 'event_espresso' );
548
+		$this->_template_args['txn_nmbr']['label'] = esc_html__('Transaction Number', 'event_espresso');
549 549
 
550 550
 		$this->_template_args['txn_datetime']['value'] = $this->_transaction->get_i18n_datetime('TXN_timestamp');
551
-		$this->_template_args['txn_datetime']['label'] = esc_html__( 'Date', 'event_espresso' );
551
+		$this->_template_args['txn_datetime']['label'] = esc_html__('Date', 'event_espresso');
552 552
 
553
-		$this->_template_args['txn_status']['value'] = self::$_txn_status[ $this->_transaction->get('STS_ID') ];
554
-		$this->_template_args['txn_status']['label'] = esc_html__( 'Transaction Status', 'event_espresso' );
555
-		$this->_template_args['txn_status']['class'] = 'status-' . $this->_transaction->get('STS_ID');
553
+		$this->_template_args['txn_status']['value'] = self::$_txn_status[$this->_transaction->get('STS_ID')];
554
+		$this->_template_args['txn_status']['label'] = esc_html__('Transaction Status', 'event_espresso');
555
+		$this->_template_args['txn_status']['class'] = 'status-'.$this->_transaction->get('STS_ID');
556 556
 
557 557
 		$this->_template_args['grand_total'] = $this->_transaction->get('TXN_total');
558 558
 		$this->_template_args['total_paid'] = $this->_transaction->get('TXN_paid');
@@ -565,7 +565,7 @@  discard block
 block discarded – undo
565 565
 			)
566 566
 		) {
567 567
 			$this->_template_args['send_payment_reminder_button'] =
568
-				EEH_MSG_Template::is_mt_active( 'payment_reminder' )
568
+				EEH_MSG_Template::is_mt_active('payment_reminder')
569 569
 				&& $this->_transaction->get('STS_ID') != EEM_Transaction::complete_status_code
570 570
 				&& $this->_transaction->get('STS_ID') != EEM_Transaction::overpaid_status_code
571 571
 					? EEH_Template::get_button_or_link(
@@ -587,40 +587,40 @@  discard block
 block discarded – undo
587 587
 		}
588 588
 
589 589
 		$amount_due = $this->_transaction->get('TXN_total') - $this->_transaction->get('TXN_paid');
590
-		$this->_template_args['amount_due'] = EEH_Template::format_currency( $amount_due, TRUE );
591
-		if ( EE_Registry::instance()->CFG->currency->sign_b4 ) {
592
-			$this->_template_args['amount_due'] = EE_Registry::instance()->CFG->currency->sign . $this->_template_args['amount_due'];
590
+		$this->_template_args['amount_due'] = EEH_Template::format_currency($amount_due, TRUE);
591
+		if (EE_Registry::instance()->CFG->currency->sign_b4) {
592
+			$this->_template_args['amount_due'] = EE_Registry::instance()->CFG->currency->sign.$this->_template_args['amount_due'];
593 593
 		} else {
594
-			$this->_template_args['amount_due'] = $this->_template_args['amount_due'] . EE_Registry::instance()->CFG->currency->sign;
594
+			$this->_template_args['amount_due'] = $this->_template_args['amount_due'].EE_Registry::instance()->CFG->currency->sign;
595 595
 		}
596
-		$this->_template_args['amount_due_class'] =  '';
596
+		$this->_template_args['amount_due_class'] = '';
597 597
 
598
-		if ( $this->_transaction->get('TXN_paid') == $this->_transaction->get('TXN_total') ) {
598
+		if ($this->_transaction->get('TXN_paid') == $this->_transaction->get('TXN_total')) {
599 599
 			// paid in full
600
-			$this->_template_args['amount_due'] =  FALSE;
601
-		} elseif ( $this->_transaction->get('TXN_paid') > $this->_transaction->get('TXN_total') ) {
600
+			$this->_template_args['amount_due'] = FALSE;
601
+		} elseif ($this->_transaction->get('TXN_paid') > $this->_transaction->get('TXN_total')) {
602 602
 			// overpaid
603
-			$this->_template_args['amount_due_class'] =  'txn-overview-no-payment-spn';
604
-		} elseif (( $this->_transaction->get('TXN_total') > 0 ) && ( $this->_transaction->get('TXN_paid') > 0 )) {
603
+			$this->_template_args['amount_due_class'] = 'txn-overview-no-payment-spn';
604
+		} elseif (($this->_transaction->get('TXN_total') > 0) && ($this->_transaction->get('TXN_paid') > 0)) {
605 605
 			// monies owing
606
-			$this->_template_args['amount_due_class'] =  'txn-overview-part-payment-spn';
607
-		} elseif (( $this->_transaction->get('TXN_total') > 0 ) && ( $this->_transaction->get('TXN_paid') == 0 )) {
606
+			$this->_template_args['amount_due_class'] = 'txn-overview-part-payment-spn';
607
+		} elseif (($this->_transaction->get('TXN_total') > 0) && ($this->_transaction->get('TXN_paid') == 0)) {
608 608
 			// no payments made yet
609
-			$this->_template_args['amount_due_class'] =  'txn-overview-no-payment-spn';
610
-		} elseif ( $this->_transaction->get('TXN_total') == 0 ) {
609
+			$this->_template_args['amount_due_class'] = 'txn-overview-no-payment-spn';
610
+		} elseif ($this->_transaction->get('TXN_total') == 0) {
611 611
 			// free event
612
-			$this->_template_args['amount_due'] =  FALSE;
612
+			$this->_template_args['amount_due'] = FALSE;
613 613
 		}
614 614
 
615 615
 		$payment_method = $this->_transaction->payment_method();
616 616
 
617 617
 		$this->_template_args['method_of_payment_name'] = $payment_method instanceof EE_Payment_Method
618 618
 			? $payment_method->admin_name()
619
-			: esc_html__( 'Unknown', 'event_espresso' );
619
+			: esc_html__('Unknown', 'event_espresso');
620 620
 
621 621
 		$this->_template_args['currency_sign'] = EE_Registry::instance()->CFG->currency->sign;
622 622
 		// link back to overview
623
-		$this->_template_args['txn_overview_url'] = ! empty ( $_SERVER['HTTP_REFERER'] )
623
+		$this->_template_args['txn_overview_url'] = ! empty ($_SERVER['HTTP_REFERER'])
624 624
 			? $_SERVER['HTTP_REFERER']
625 625
 			: TXN_ADMIN_URL;
626 626
 
@@ -628,13 +628,13 @@  discard block
 block discarded – undo
628 628
 		// next link
629 629
 		$next_txn = $this->_transaction->next(
630 630
 			null,
631
-			array( array( 'STS_ID' => array( '!=', EEM_Transaction::failed_status_code ) ) ),
631
+			array(array('STS_ID' => array('!=', EEM_Transaction::failed_status_code))),
632 632
 			'TXN_ID'
633 633
 		);
634 634
 		$this->_template_args['next_transaction'] = $next_txn
635 635
 			? $this->_next_link(
636 636
 				EE_Admin_Page::add_query_args_and_nonce(
637
-					array( 'action' => 'view_transaction', 'TXN_ID' => $next_txn['TXN_ID'] ),
637
+					array('action' => 'view_transaction', 'TXN_ID' => $next_txn['TXN_ID']),
638 638
 					TXN_ADMIN_URL
639 639
 				),
640 640
 				'dashicons dashicons-arrow-right ee-icon-size-22'
@@ -643,13 +643,13 @@  discard block
 block discarded – undo
643 643
 		// previous link
644 644
 		$previous_txn = $this->_transaction->previous(
645 645
 			null,
646
-			array( array( 'STS_ID' => array( '!=', EEM_Transaction::failed_status_code ) ) ),
646
+			array(array('STS_ID' => array('!=', EEM_Transaction::failed_status_code))),
647 647
 			'TXN_ID'
648 648
 		);
649 649
 		$this->_template_args['previous_transaction'] = $previous_txn
650 650
 			? $this->_previous_link(
651 651
 				EE_Admin_Page::add_query_args_and_nonce(
652
-					array( 'action' => 'view_transaction', 'TXN_ID' => $previous_txn['TXN_ID'] ),
652
+					array('action' => 'view_transaction', 'TXN_ID' => $previous_txn['TXN_ID']),
653 653
 					TXN_ADMIN_URL
654 654
 				),
655 655
 				'dashicons dashicons-arrow-left ee-icon-size-22'
@@ -659,16 +659,16 @@  discard block
 block discarded – undo
659 659
 		// were we just redirected here after adding a new registration ???
660 660
 		if (
661 661
 			isset(
662
-				$this->_req_data[ 'redirect_from' ],
663
-				$this->_req_data[ 'EVT_ID' ],
664
-				$this->_req_data[ 'event_name' ]
662
+				$this->_req_data['redirect_from'],
663
+				$this->_req_data['EVT_ID'],
664
+				$this->_req_data['event_name']
665 665
 			)
666 666
 		) {
667 667
 			if (
668 668
 				EE_Registry::instance()->CAP->current_user_can(
669 669
 					'ee_edit_registrations',
670 670
 					'espresso_registrations_new_registration',
671
-					$this->_req_data[ 'EVT_ID' ]
671
+					$this->_req_data['EVT_ID']
672 672
 				)
673 673
 			) {
674 674
 				$this->_admin_page_title .= '<a id="add-new-registration" class="add-new-h2 button-primary" href="';
@@ -678,25 +678,25 @@  discard block
 block discarded – undo
678 678
 						'action'   => 'new_registration',
679 679
 						'return'   => 'default',
680 680
 						'TXN_ID'   => $this->_transaction->ID(),
681
-						'event_id' => $this->_req_data[ 'EVT_ID' ],
681
+						'event_id' => $this->_req_data['EVT_ID'],
682 682
 					),
683 683
 					REG_ADMIN_URL
684 684
 				);
685 685
 				$this->_admin_page_title .= '">';
686 686
 
687 687
 				$this->_admin_page_title .= sprintf(
688
-					esc_html__('Add Another New Registration to Event: "%1$s" ?', 'event_espresso' ),
689
-					htmlentities( urldecode( $this->_req_data[ 'event_name' ] ), ENT_QUOTES, 'UTF-8' )
688
+					esc_html__('Add Another New Registration to Event: "%1$s" ?', 'event_espresso'),
689
+					htmlentities(urldecode($this->_req_data['event_name']), ENT_QUOTES, 'UTF-8')
690 690
 				);
691 691
 				$this->_admin_page_title .= '</a>';
692 692
 			}
693
-			EE_Registry::instance()->SSN->clear_session( __CLASS__, __FUNCTION__ );
693
+			EE_Registry::instance()->SSN->clear_session(__CLASS__, __FUNCTION__);
694 694
 		}
695 695
 		// grab messages at the last second
696 696
 		$this->_template_args['notices'] = EE_Error::get_notices();
697 697
 		// path to template
698
-		$template_path = TXN_TEMPLATE_PATH . 'txn_admin_details_header.template.php';
699
-		$this->_template_args['admin_page_header'] = EEH_Template::display_template( $template_path, $this->_template_args, TRUE );
698
+		$template_path = TXN_TEMPLATE_PATH.'txn_admin_details_header.template.php';
699
+		$this->_template_args['admin_page_header'] = EEH_Template::display_template($template_path, $this->_template_args, TRUE);
700 700
 
701 701
 		// the details template wrapper
702 702
 		$this->display_admin_page_with_sidebar();
@@ -715,18 +715,18 @@  discard block
 block discarded – undo
715 715
 
716 716
 		$this->_set_transaction_object();
717 717
 
718
-		add_meta_box( 'edit-txn-details-mbox', esc_html__( 'Transaction Details', 'event_espresso' ), array( $this, 'txn_details_meta_box' ), $this->_wp_page_slug, 'normal', 'high' );
718
+		add_meta_box('edit-txn-details-mbox', esc_html__('Transaction Details', 'event_espresso'), array($this, 'txn_details_meta_box'), $this->_wp_page_slug, 'normal', 'high');
719 719
 		add_meta_box(
720 720
 			'edit-txn-attendees-mbox',
721
-			esc_html__( 'Attendees Registered in this Transaction', 'event_espresso' ),
722
-			array( $this, 'txn_attendees_meta_box' ),
721
+			esc_html__('Attendees Registered in this Transaction', 'event_espresso'),
722
+			array($this, 'txn_attendees_meta_box'),
723 723
 			$this->_wp_page_slug,
724 724
 			'normal',
725 725
 			'high',
726
-			array( 'TXN_ID' => $this->_transaction->ID() )
726
+			array('TXN_ID' => $this->_transaction->ID())
727 727
 		);
728
-		add_meta_box( 'edit-txn-registrant-mbox', esc_html__( 'Primary Contact', 'event_espresso' ), array( $this, 'txn_registrant_side_meta_box' ), $this->_wp_page_slug, 'side', 'high' );
729
-		add_meta_box( 'edit-txn-billing-info-mbox', esc_html__( 'Billing Information', 'event_espresso' ), array( $this, 'txn_billing_info_side_meta_box' ), $this->_wp_page_slug, 'side', 'high' );
728
+		add_meta_box('edit-txn-registrant-mbox', esc_html__('Primary Contact', 'event_espresso'), array($this, 'txn_registrant_side_meta_box'), $this->_wp_page_slug, 'side', 'high');
729
+		add_meta_box('edit-txn-billing-info-mbox', esc_html__('Billing Information', 'event_espresso'), array($this, 'txn_billing_info_side_meta_box'), $this->_wp_page_slug, 'side', 'high');
730 730
 
731 731
 	}
732 732
 
@@ -747,15 +747,15 @@  discard block
 block discarded – undo
747 747
 
748 748
 		//get line table
749 749
 		EEH_Autoloader::register_line_item_display_autoloaders();
750
-		$Line_Item_Display = new EE_Line_Item_Display( 'admin_table', 'EE_Admin_Table_Line_Item_Display_Strategy' );
751
-		$this->_template_args['line_item_table'] = $Line_Item_Display->display_line_item( $this->_transaction->total_line_item() );
750
+		$Line_Item_Display = new EE_Line_Item_Display('admin_table', 'EE_Admin_Table_Line_Item_Display_Strategy');
751
+		$this->_template_args['line_item_table'] = $Line_Item_Display->display_line_item($this->_transaction->total_line_item());
752 752
 		$this->_template_args['REG_code'] = $this->_transaction->get_first_related('Registration')->get('REG_code');
753 753
 
754 754
 		// process taxes
755
-		$taxes = $this->_transaction->get_many_related( 'Line_Item', array( array( 'LIN_type' => EEM_Line_Item::type_tax )));
756
-		$this->_template_args['taxes'] = ! empty( $taxes ) ? $taxes : FALSE;
755
+		$taxes = $this->_transaction->get_many_related('Line_Item', array(array('LIN_type' => EEM_Line_Item::type_tax)));
756
+		$this->_template_args['taxes'] = ! empty($taxes) ? $taxes : FALSE;
757 757
 
758
-		$this->_template_args['grand_total'] = EEH_Template::format_currency($this->_transaction->get('TXN_total'), FALSE, FALSE );
758
+		$this->_template_args['grand_total'] = EEH_Template::format_currency($this->_transaction->get('TXN_total'), FALSE, FALSE);
759 759
 		$this->_template_args['grand_raw_total'] = $this->_transaction->get('TXN_total');
760 760
 		$this->_template_args['TXN_status'] = $this->_transaction->get('STS_ID');
761 761
 
@@ -763,63 +763,63 @@  discard block
 block discarded – undo
763 763
 
764 764
 		// process payment details
765 765
 		$payments = $this->_transaction->get_many_related('Payment');
766
-		if( ! empty(  $payments ) ) {
767
-			$this->_template_args[ 'payments' ] = $payments;
768
-			$this->_template_args[ 'existing_reg_payments' ] = $this->_get_registration_payment_IDs( $payments );
766
+		if ( ! empty($payments)) {
767
+			$this->_template_args['payments'] = $payments;
768
+			$this->_template_args['existing_reg_payments'] = $this->_get_registration_payment_IDs($payments);
769 769
 		} else {
770
-			$this->_template_args[ 'payments' ] = false;
771
-			$this->_template_args[ 'existing_reg_payments' ] = array();
770
+			$this->_template_args['payments'] = false;
771
+			$this->_template_args['existing_reg_payments'] = array();
772 772
 		}
773 773
 
774
-		$this->_template_args['edit_payment_url'] = add_query_arg( array( 'action' => 'edit_payment'  ), TXN_ADMIN_URL );
775
-		$this->_template_args['delete_payment_url'] = add_query_arg( array( 'action' => 'espresso_delete_payment' ), TXN_ADMIN_URL );
774
+		$this->_template_args['edit_payment_url'] = add_query_arg(array('action' => 'edit_payment'), TXN_ADMIN_URL);
775
+		$this->_template_args['delete_payment_url'] = add_query_arg(array('action' => 'espresso_delete_payment'), TXN_ADMIN_URL);
776 776
 
777
-		if ( isset( $txn_details['invoice_number'] )) {
777
+		if (isset($txn_details['invoice_number'])) {
778 778
 			$this->_template_args['txn_details']['invoice_number']['value'] = $this->_template_args['REG_code'];
779
-			$this->_template_args['txn_details']['invoice_number']['label'] = esc_html__( 'Invoice Number', 'event_espresso' );
779
+			$this->_template_args['txn_details']['invoice_number']['label'] = esc_html__('Invoice Number', 'event_espresso');
780 780
 		}
781 781
 
782 782
 		$this->_template_args['txn_details']['registration_session']['value'] = $this->_transaction->get_first_related('Registration')->get('REG_session');
783
-		$this->_template_args['txn_details']['registration_session']['label'] = esc_html__( 'Registration Session', 'event_espresso' );
783
+		$this->_template_args['txn_details']['registration_session']['label'] = esc_html__('Registration Session', 'event_espresso');
784 784
 
785
-		$this->_template_args['txn_details']['ip_address']['value'] = isset( $this->_session['ip_address'] ) ? $this->_session['ip_address'] : '';
786
-		$this->_template_args['txn_details']['ip_address']['label'] = esc_html__( 'Transaction placed from IP', 'event_espresso' );
785
+		$this->_template_args['txn_details']['ip_address']['value'] = isset($this->_session['ip_address']) ? $this->_session['ip_address'] : '';
786
+		$this->_template_args['txn_details']['ip_address']['label'] = esc_html__('Transaction placed from IP', 'event_espresso');
787 787
 
788
-		$this->_template_args['txn_details']['user_agent']['value'] = isset( $this->_session['user_agent'] ) ? $this->_session['user_agent'] : '';
789
-		$this->_template_args['txn_details']['user_agent']['label'] = esc_html__( 'Registrant User Agent', 'event_espresso' );
788
+		$this->_template_args['txn_details']['user_agent']['value'] = isset($this->_session['user_agent']) ? $this->_session['user_agent'] : '';
789
+		$this->_template_args['txn_details']['user_agent']['label'] = esc_html__('Registrant User Agent', 'event_espresso');
790 790
 
791 791
 		$reg_steps = '<ul>';
792
-		foreach ( $this->_transaction->reg_steps() as $reg_step => $reg_step_status ) {
793
-			if ( $reg_step_status === true ) {
794
-				$reg_steps .= '<li style="color:#70cc50">' . sprintf( esc_html__( '%1$s : Completed', 'event_espresso' ), ucwords( str_replace( '_', ' ', $reg_step ) ) ) . '</li>';
795
-			} else if ( is_numeric( $reg_step_status ) && $reg_step_status !== false ) {
796
-					$reg_steps .= '<li style="color:#2EA2CC">' . sprintf(
797
-							esc_html__( '%1$s : Initiated %2$s', 'event_espresso' ),
798
-							ucwords( str_replace( '_', ' ', $reg_step ) ),
799
-							gmdate( get_option( 'date_format' ) . ' ' . get_option( 'time_format' ), ( $reg_step_status + ( get_option( 'gmt_offset' ) * HOUR_IN_SECONDS ) ) )
800
-						) . '</li>';
792
+		foreach ($this->_transaction->reg_steps() as $reg_step => $reg_step_status) {
793
+			if ($reg_step_status === true) {
794
+				$reg_steps .= '<li style="color:#70cc50">'.sprintf(esc_html__('%1$s : Completed', 'event_espresso'), ucwords(str_replace('_', ' ', $reg_step))).'</li>';
795
+			} else if (is_numeric($reg_step_status) && $reg_step_status !== false) {
796
+					$reg_steps .= '<li style="color:#2EA2CC">'.sprintf(
797
+							esc_html__('%1$s : Initiated %2$s', 'event_espresso'),
798
+							ucwords(str_replace('_', ' ', $reg_step)),
799
+							gmdate(get_option('date_format').' '.get_option('time_format'), ($reg_step_status + (get_option('gmt_offset') * HOUR_IN_SECONDS)))
800
+						).'</li>';
801 801
 				} else {
802
-				$reg_steps .= '<li style="color:#E76700">' . sprintf( esc_html__( '%1$s : Never Initiated', 'event_espresso' ), ucwords( str_replace( '_', ' ', $reg_step ) ) ) . '</li>';
802
+				$reg_steps .= '<li style="color:#E76700">'.sprintf(esc_html__('%1$s : Never Initiated', 'event_espresso'), ucwords(str_replace('_', ' ', $reg_step))).'</li>';
803 803
 			}
804 804
 		}
805 805
 		$reg_steps .= '</ul>';
806 806
 		$this->_template_args['txn_details']['reg_steps']['value'] = $reg_steps;
807
-		$this->_template_args['txn_details']['reg_steps']['label'] = esc_html__( 'Registration Step Progress', 'event_espresso' );
807
+		$this->_template_args['txn_details']['reg_steps']['label'] = esc_html__('Registration Step Progress', 'event_espresso');
808 808
 
809 809
 
810 810
 		$this->_get_registrations_to_apply_payment_to();
811
-		$this->_get_payment_methods( $payments );
811
+		$this->_get_payment_methods($payments);
812 812
 		$this->_get_payment_status_array();
813 813
 		$this->_get_reg_status_selection(); //sets up the template args for the reg status array for the transaction.
814 814
 
815
-		$this->_template_args['transaction_form_url'] = add_query_arg( array( 'action' => 'edit_transaction', 'process' => 'transaction'  ), TXN_ADMIN_URL );
816
-		$this->_template_args['apply_payment_form_url'] = add_query_arg( array( 'page' => 'espresso_transactions', 'action' => 'espresso_apply_payment' ), WP_AJAX_URL );
817
-		$this->_template_args['delete_payment_form_url'] = add_query_arg( array( 'page' => 'espresso_transactions', 'action' => 'espresso_delete_payment' ), WP_AJAX_URL );
815
+		$this->_template_args['transaction_form_url'] = add_query_arg(array('action' => 'edit_transaction', 'process' => 'transaction'), TXN_ADMIN_URL);
816
+		$this->_template_args['apply_payment_form_url'] = add_query_arg(array('page' => 'espresso_transactions', 'action' => 'espresso_apply_payment'), WP_AJAX_URL);
817
+		$this->_template_args['delete_payment_form_url'] = add_query_arg(array('page' => 'espresso_transactions', 'action' => 'espresso_delete_payment'), WP_AJAX_URL);
818 818
 
819 819
 		// 'espresso_delete_payment_nonce'
820 820
 
821
-		$template_path = TXN_TEMPLATE_PATH . 'txn_admin_details_main_meta_box_txn_details.template.php';
822
-		echo EEH_Template::display_template( $template_path, $this->_template_args, TRUE );
821
+		$template_path = TXN_TEMPLATE_PATH.'txn_admin_details_main_meta_box_txn_details.template.php';
822
+		echo EEH_Template::display_template($template_path, $this->_template_args, TRUE);
823 823
 
824 824
 	}
825 825
 
@@ -834,27 +834,27 @@  discard block
 block discarded – undo
834 834
 	 * @param EE_Payment[] $payments
835 835
 	 * @return array
836 836
 	 */
837
-	protected function _get_registration_payment_IDs( $payments = array() ) {
837
+	protected function _get_registration_payment_IDs($payments = array()) {
838 838
 		$existing_reg_payments = array();
839 839
 		// get all reg payments for these payments
840
-		$reg_payments = EEM_Registration_Payment::instance()->get_all( array(
840
+		$reg_payments = EEM_Registration_Payment::instance()->get_all(array(
841 841
 			array(
842 842
 				'PAY_ID' => array(
843 843
 					'IN',
844
-					array_keys( $payments )
844
+					array_keys($payments)
845 845
 				)
846 846
 			)
847
-		) );
848
-		if ( ! empty( $reg_payments ) ) {
849
-			foreach ( $payments as $payment ) {
850
-				if ( ! $payment instanceof EE_Payment ) {
847
+		));
848
+		if ( ! empty($reg_payments)) {
849
+			foreach ($payments as $payment) {
850
+				if ( ! $payment instanceof EE_Payment) {
851 851
 					continue;
852
-				} else if ( ! isset( $existing_reg_payments[ $payment->ID() ] ) ) {
853
-					$existing_reg_payments[ $payment->ID() ] = array();
852
+				} else if ( ! isset($existing_reg_payments[$payment->ID()])) {
853
+					$existing_reg_payments[$payment->ID()] = array();
854 854
 				}
855
-				foreach ( $reg_payments as $reg_payment ) {
856
-					if ( $reg_payment instanceof EE_Registration_Payment && $reg_payment->payment_ID() === $payment->ID() ) {
857
-						$existing_reg_payments[ $payment->ID() ][ ] = $reg_payment->registration_ID();
855
+				foreach ($reg_payments as $reg_payment) {
856
+					if ($reg_payment instanceof EE_Registration_Payment && $reg_payment->payment_ID() === $payment->ID()) {
857
+						$existing_reg_payments[$payment->ID()][] = $reg_payment->registration_ID();
858 858
 					}
859 859
 				}
860 860
 			}
@@ -887,54 +887,54 @@  discard block
 block discarded – undo
887 887
 				)
888 888
 			)
889 889
 		);
890
-		$registrations_to_apply_payment_to = EEH_HTML::br() . EEH_HTML::div(
890
+		$registrations_to_apply_payment_to = EEH_HTML::br().EEH_HTML::div(
891 891
 			'', 'txn-admin-apply-payment-to-registrations-dv', '', 'clear: both; margin: 1.5em 0 0; display: none;'
892 892
 		);
893
-		$registrations_to_apply_payment_to .= EEH_HTML::br() . EEH_HTML::div( '', '', 'admin-primary-mbox-tbl-wrap' );
894
-		$registrations_to_apply_payment_to .= EEH_HTML::table( '', '', 'admin-primary-mbox-tbl' );
893
+		$registrations_to_apply_payment_to .= EEH_HTML::br().EEH_HTML::div('', '', 'admin-primary-mbox-tbl-wrap');
894
+		$registrations_to_apply_payment_to .= EEH_HTML::table('', '', 'admin-primary-mbox-tbl');
895 895
 		$registrations_to_apply_payment_to .= EEH_HTML::thead(
896 896
 			EEH_HTML::tr(
897
-				EEH_HTML::th( esc_html__( 'ID', 'event_espresso' ) ) .
898
-				EEH_HTML::th( esc_html__( 'Registrant', 'event_espresso' ) ) .
899
-				EEH_HTML::th( esc_html__( 'Ticket', 'event_espresso' ) ) .
900
-				EEH_HTML::th( esc_html__( 'Event', 'event_espresso' ) ) .
901
-				EEH_HTML::th( esc_html__( 'Paid', 'event_espresso' ), '', 'txn-admin-payment-paid-td jst-cntr' ) .
902
-				EEH_HTML::th( esc_html__( 'Owing', 'event_espresso' ), '', 'txn-admin-payment-owing-td jst-cntr' ) .
903
-				EEH_HTML::th( esc_html__( 'Apply', 'event_espresso' ), '', 'jst-cntr' )
897
+				EEH_HTML::th(esc_html__('ID', 'event_espresso')).
898
+				EEH_HTML::th(esc_html__('Registrant', 'event_espresso')).
899
+				EEH_HTML::th(esc_html__('Ticket', 'event_espresso')).
900
+				EEH_HTML::th(esc_html__('Event', 'event_espresso')).
901
+				EEH_HTML::th(esc_html__('Paid', 'event_espresso'), '', 'txn-admin-payment-paid-td jst-cntr').
902
+				EEH_HTML::th(esc_html__('Owing', 'event_espresso'), '', 'txn-admin-payment-owing-td jst-cntr').
903
+				EEH_HTML::th(esc_html__('Apply', 'event_espresso'), '', 'jst-cntr')
904 904
 			)
905 905
 		);
906 906
 		$registrations_to_apply_payment_to .= EEH_HTML::tbody();
907 907
 		// get registrations for TXN
908
-		$registrations = $this->_transaction->registrations( $query_params );
909
-		foreach ( $registrations as $registration ) {
910
-			if ( $registration instanceof EE_Registration ) {
908
+		$registrations = $this->_transaction->registrations($query_params);
909
+		foreach ($registrations as $registration) {
910
+			if ($registration instanceof EE_Registration) {
911 911
 				$attendee_name = $registration->attendee() instanceof EE_Attendee
912 912
 					? $registration->attendee()->full_name()
913
-					: esc_html__( 'Unknown Attendee', 'event_espresso' );
913
+					: esc_html__('Unknown Attendee', 'event_espresso');
914 914
 				$owing = $registration->final_price() - $registration->paid();
915 915
 				$taxable = $registration->ticket()->taxable()
916
-					? ' <span class="smaller-text lt-grey-text"> ' . esc_html__( '+ tax', 'event_espresso' ) . '</span>'
916
+					? ' <span class="smaller-text lt-grey-text"> '.esc_html__('+ tax', 'event_espresso').'</span>'
917 917
 					: '';
918
-				$checked = empty( $existing_reg_payments ) || in_array( $registration->ID(), $existing_reg_payments )
918
+				$checked = empty($existing_reg_payments) || in_array($registration->ID(), $existing_reg_payments)
919 919
 					? ' checked="checked"'
920 920
 					: '';
921 921
 				$disabled = $registration->final_price() > 0 ? '' : ' disabled';
922 922
 				$registrations_to_apply_payment_to .= EEH_HTML::tr(
923
-					EEH_HTML::td( $registration->ID() ) .
924
-					EEH_HTML::td( $attendee_name ) .
923
+					EEH_HTML::td($registration->ID()).
924
+					EEH_HTML::td($attendee_name).
925 925
 					EEH_HTML::td(
926
-						$registration->ticket()->name() . ' : ' . $registration->ticket()->pretty_price() . $taxable
927
-					) .
928
-					EEH_HTML::td( $registration->event_name() ) .
929
-					EEH_HTML::td( $registration->pretty_paid(), '', 'txn-admin-payment-paid-td jst-cntr' ) .
930
-					EEH_HTML::td( EEH_Template::format_currency( $owing ), '', 'txn-admin-payment-owing-td jst-cntr' ) .
926
+						$registration->ticket()->name().' : '.$registration->ticket()->pretty_price().$taxable
927
+					).
928
+					EEH_HTML::td($registration->event_name()).
929
+					EEH_HTML::td($registration->pretty_paid(), '', 'txn-admin-payment-paid-td jst-cntr').
930
+					EEH_HTML::td(EEH_Template::format_currency($owing), '', 'txn-admin-payment-owing-td jst-cntr').
931 931
 					EEH_HTML::td(
932
-						'<input type="checkbox" value="' . $registration->ID()
932
+						'<input type="checkbox" value="'.$registration->ID()
933 933
 						. '" name="txn_admin_payment[registrations]"'
934
-						. $checked . $disabled . '>',
934
+						. $checked.$disabled.'>',
935 935
 						'', 'jst-cntr'
936 936
 					),
937
-					'apply-payment-registration-row-' . $registration->ID()
937
+					'apply-payment-registration-row-'.$registration->ID()
938 938
 				);
939 939
 			}
940 940
 		}
@@ -949,7 +949,7 @@  discard block
 block discarded – undo
949 949
 			'', 'clear description'
950 950
 		);
951 951
 		$registrations_to_apply_payment_to .= EEH_HTML::divx();
952
-		$this->_template_args[ 'registrations_to_apply_payment_to' ] = $registrations_to_apply_payment_to;
952
+		$this->_template_args['registrations_to_apply_payment_to'] = $registrations_to_apply_payment_to;
953 953
 	}
954 954
 
955 955
 
@@ -966,9 +966,9 @@  discard block
 block discarded – undo
966 966
 		$statuses = EEM_Registration::reg_status_array(array(), TRUE);
967 967
 		//let's add a "don't change" option.
968 968
 		$status_array['NAN'] = esc_html__('Leave the Same', 'event_espresso');
969
-		$status_array = array_merge( $status_array, $statuses );
970
-		$this->_template_args['status_change_select'] = EEH_Form_Fields::select_input( 'txn_reg_status_change[reg_status]', $status_array, 'NAN', 'id="txn-admin-payment-reg-status-inp"', 'txn-reg-status-change-reg-status' );
971
-		$this->_template_args['delete_status_change_select'] = EEH_Form_Fields::select_input( 'delete_txn_reg_status_change[reg_status]', $status_array, 'NAN', 'delete-txn-admin-payment-reg-status-inp', 'delete-txn-reg-status-change-reg-status' );
969
+		$status_array = array_merge($status_array, $statuses);
970
+		$this->_template_args['status_change_select'] = EEH_Form_Fields::select_input('txn_reg_status_change[reg_status]', $status_array, 'NAN', 'id="txn-admin-payment-reg-status-inp"', 'txn-reg-status-change-reg-status');
971
+		$this->_template_args['delete_status_change_select'] = EEH_Form_Fields::select_input('delete_txn_reg_status_change[reg_status]', $status_array, 'NAN', 'delete-txn-admin-payment-reg-status-inp', 'delete-txn-reg-status-change-reg-status');
972 972
 
973 973
 	}
974 974
 
@@ -983,21 +983,21 @@  discard block
 block discarded – undo
983 983
 	 * @param EE_Payment[] to show on this page
984 984
 	 *	@return void
985 985
 	 */
986
-	private function _get_payment_methods( $payments = array() ) {
986
+	private function _get_payment_methods($payments = array()) {
987 987
 		$payment_methods_of_payments = array();
988
-		foreach( $payments as $payment ){
989
-			if( $payment instanceof EE_Payment ){
990
-				$payment_methods_of_payments[] = $payment->get( 'PMD_ID' );
988
+		foreach ($payments as $payment) {
989
+			if ($payment instanceof EE_Payment) {
990
+				$payment_methods_of_payments[] = $payment->get('PMD_ID');
991 991
 			}
992 992
 		}
993
-		if( $payment_methods_of_payments ){
994
-			$query_args = array( array( 'OR*payment_method_for_payment' => array(
995
-					'PMD_ID' => array( 'IN', $payment_methods_of_payments ),
996
-					'PMD_scope' => array( 'LIKE', '%' . EEM_Payment_Method::scope_admin . '%' ) ) ) );
997
-		}else{
998
-			$query_args = array( array( 'PMD_scope' => array( 'LIKE', '%' . EEM_Payment_Method::scope_admin . '%' ) ) );
993
+		if ($payment_methods_of_payments) {
994
+			$query_args = array(array('OR*payment_method_for_payment' => array(
995
+					'PMD_ID' => array('IN', $payment_methods_of_payments),
996
+					'PMD_scope' => array('LIKE', '%'.EEM_Payment_Method::scope_admin.'%') )));
997
+		} else {
998
+			$query_args = array(array('PMD_scope' => array('LIKE', '%'.EEM_Payment_Method::scope_admin.'%')));
999 999
 		}
1000
-		$this->_template_args['payment_methods'] = EEM_Payment_Method::instance()->get_all( $query_args );
1000
+		$this->_template_args['payment_methods'] = EEM_Payment_Method::instance()->get_all($query_args);
1001 1001
 	}
1002 1002
 
1003 1003
 
@@ -1011,17 +1011,17 @@  discard block
 block discarded – undo
1011 1011
 	 * @param array $metabox
1012 1012
 	 * @return void
1013 1013
 	 */
1014
-	public function txn_attendees_meta_box( $post, $metabox = array( 'args' => array() )) {
1014
+	public function txn_attendees_meta_box($post, $metabox = array('args' => array())) {
1015 1015
 
1016
-		extract( $metabox['args'] );
1016
+		extract($metabox['args']);
1017 1017
 		$this->_template_args['post'] = $post;
1018 1018
 		$this->_template_args['event_attendees'] = array();
1019 1019
 		// process items in cart
1020
-		$line_items = $this->_transaction->get_many_related('Line_Item', array( array( 'LIN_type' => 'line-item' ) ) );
1021
-		if ( ! empty( $line_items )) {
1022
-			foreach ( $line_items as $item ) {
1023
-				if ( $item instanceof EE_Line_Item ) {
1024
-					switch( $item->OBJ_type() ) {
1020
+		$line_items = $this->_transaction->get_many_related('Line_Item', array(array('LIN_type' => 'line-item')));
1021
+		if ( ! empty($line_items)) {
1022
+			foreach ($line_items as $item) {
1023
+				if ($item instanceof EE_Line_Item) {
1024
+					switch ($item->OBJ_type()) {
1025 1025
 
1026 1026
 						case 'Event' :
1027 1027
 							break;
@@ -1029,39 +1029,39 @@  discard block
 block discarded – undo
1029 1029
 						case 'Ticket' :
1030 1030
 							$ticket = $item->ticket();
1031 1031
 							//right now we're only handling tickets here.  Cause its expected that only tickets will have attendees right?
1032
-							if ( ! $ticket instanceof EE_Ticket ) {
1032
+							if ( ! $ticket instanceof EE_Ticket) {
1033 1033
 								continue;
1034 1034
 							}
1035 1035
 							try {
1036 1036
 								$event_name = $ticket->get_event_name();
1037
-							} catch ( Exception $e ) {
1038
-								EE_Error::add_error( $e->getMessage(), __FILE__, __FUNCTION__, __LINE__ );
1039
-								$event_name = esc_html__( 'Unknown Event', 'event_espresso' );
1037
+							} catch (Exception $e) {
1038
+								EE_Error::add_error($e->getMessage(), __FILE__, __FUNCTION__, __LINE__);
1039
+								$event_name = esc_html__('Unknown Event', 'event_espresso');
1040 1040
 							}
1041
-							$event_name .= ' - ' . $item->get( 'LIN_name' );
1042
-							$ticket_price = EEH_Template::format_currency( $item->get( 'LIN_unit_price' ) );
1041
+							$event_name .= ' - '.$item->get('LIN_name');
1042
+							$ticket_price = EEH_Template::format_currency($item->get('LIN_unit_price'));
1043 1043
 							// now get all of the registrations for this transaction that use this ticket
1044
-							$registrations = $ticket->get_many_related('Registration', array( array('TXN_ID' => $this->_transaction->ID() )));
1045
-							foreach( $registrations as $registration ) {
1046
-								if ( ! $registration instanceof EE_Registration ) {
1044
+							$registrations = $ticket->get_many_related('Registration', array(array('TXN_ID' => $this->_transaction->ID())));
1045
+							foreach ($registrations as $registration) {
1046
+								if ( ! $registration instanceof EE_Registration) {
1047 1047
 									continue;
1048 1048
 								}
1049
-								$this->_template_args['event_attendees'][$registration->ID()]['STS_ID'] 			= $registration->status_ID();
1050
-								$this->_template_args['event_attendees'][$registration->ID()]['att_num'] 			= $registration->count();
1051
-								$this->_template_args['event_attendees'][$registration->ID()]['event_ticket_name'] 	= $event_name;
1052
-								$this->_template_args['event_attendees'][$registration->ID()]['ticket_price'] 		= $ticket_price;
1049
+								$this->_template_args['event_attendees'][$registration->ID()]['STS_ID'] = $registration->status_ID();
1050
+								$this->_template_args['event_attendees'][$registration->ID()]['att_num'] = $registration->count();
1051
+								$this->_template_args['event_attendees'][$registration->ID()]['event_ticket_name'] = $event_name;
1052
+								$this->_template_args['event_attendees'][$registration->ID()]['ticket_price'] = $ticket_price;
1053 1053
 								// attendee info
1054 1054
 								$attendee = $registration->get_first_related('Attendee');
1055
-								if ( $attendee instanceof EE_Attendee ) {
1056
-									$this->_template_args['event_attendees'][$registration->ID()]['att_id'] 	= $attendee->ID();
1057
-									$this->_template_args['event_attendees'][$registration->ID()]['attendee'] 	= $attendee->full_name();
1058
-									$this->_template_args['event_attendees'][$registration->ID()]['email']		= '<a href="mailto:' . $attendee->email() . '?subject=' . $event_name . esc_html__(' Event', 'event_espresso') . '">' . $attendee->email() . '</a>';
1059
-									$this->_template_args['event_attendees'][$registration->ID()]['address'] 	= EEH_Address::format( $attendee, 'inline', false, false );
1055
+								if ($attendee instanceof EE_Attendee) {
1056
+									$this->_template_args['event_attendees'][$registration->ID()]['att_id'] = $attendee->ID();
1057
+									$this->_template_args['event_attendees'][$registration->ID()]['attendee'] = $attendee->full_name();
1058
+									$this->_template_args['event_attendees'][$registration->ID()]['email'] = '<a href="mailto:'.$attendee->email().'?subject='.$event_name.esc_html__(' Event', 'event_espresso').'">'.$attendee->email().'</a>';
1059
+									$this->_template_args['event_attendees'][$registration->ID()]['address'] = EEH_Address::format($attendee, 'inline', false, false);
1060 1060
 								} else {
1061 1061
 									$this->_template_args['event_attendees'][$registration->ID()]['att_id'] 	= '';
1062
-									$this->_template_args['event_attendees'][$registration->ID()]['attendee'] 	= '';
1062
+									$this->_template_args['event_attendees'][$registration->ID()]['attendee'] = '';
1063 1063
 									$this->_template_args['event_attendees'][$registration->ID()]['email'] 		= '';
1064
-									$this->_template_args['event_attendees'][$registration->ID()]['address'] 	= '';
1064
+									$this->_template_args['event_attendees'][$registration->ID()]['address'] = '';
1065 1065
 								}
1066 1066
 							}
1067 1067
 							break;
@@ -1070,12 +1070,12 @@  discard block
 block discarded – undo
1070 1070
 				}
1071 1071
 			}
1072 1072
 
1073
-			$this->_template_args['transaction_form_url'] = add_query_arg( array( 'action' => 'edit_transaction', 'process' => 'attendees'  ), TXN_ADMIN_URL );
1074
-			echo EEH_Template::display_template( TXN_TEMPLATE_PATH . 'txn_admin_details_main_meta_box_attendees.template.php', $this->_template_args, TRUE );
1073
+			$this->_template_args['transaction_form_url'] = add_query_arg(array('action' => 'edit_transaction', 'process' => 'attendees'), TXN_ADMIN_URL);
1074
+			echo EEH_Template::display_template(TXN_TEMPLATE_PATH.'txn_admin_details_main_meta_box_attendees.template.php', $this->_template_args, TRUE);
1075 1075
 
1076 1076
 		} else {
1077 1077
 			echo sprintf(
1078
-				esc_html__( '%1$sFor some reason, there are no attendees registered for this transaction. Likely the registration was abandoned in process.%2$s', 'event_espresso' ),
1078
+				esc_html__('%1$sFor some reason, there are no attendees registered for this transaction. Likely the registration was abandoned in process.%2$s', 'event_espresso'),
1079 1079
 				'<p class="important-notice">',
1080 1080
 				'</p>'
1081 1081
 			);
@@ -1094,19 +1094,19 @@  discard block
 block discarded – undo
1094 1094
 	 */
1095 1095
 	public function txn_registrant_side_meta_box() {
1096 1096
 		$primary_att = $this->_transaction->primary_registration() instanceof EE_Registration ? $this->_transaction->primary_registration()->get_first_related('Attendee') : null;
1097
-		if ( ! $primary_att instanceof EE_Attendee ) {
1097
+		if ( ! $primary_att instanceof EE_Attendee) {
1098 1098
 			$this->_template_args['no_attendee_message'] = esc_html__('There is no attached contact for this transaction.  The transaction either failed due to an error or was abandoned.', 'event_espresso');
1099 1099
 			$primary_att = EEM_Attendee::instance()->create_default_object();
1100 1100
 		}
1101
-		$this->_template_args['ATT_ID'] 						= $primary_att->ID();
1101
+		$this->_template_args['ATT_ID'] = $primary_att->ID();
1102 1102
 		$this->_template_args['prime_reg_fname']		= $primary_att->fname();
1103 1103
 		$this->_template_args['prime_reg_lname']		= $primary_att->lname();
1104
-		$this->_template_args['prime_reg_email'] 		= $primary_att->email();
1104
+		$this->_template_args['prime_reg_email'] = $primary_att->email();
1105 1105
 		$this->_template_args['prime_reg_phone'] 	= $primary_att->phone();
1106
-		$this->_template_args['edit_attendee_url'] 	= EE_Admin_Page::add_query_args_and_nonce( array( 'action' => 'edit_attendee', 'post' => $primary_att->ID()  ), REG_ADMIN_URL );
1106
+		$this->_template_args['edit_attendee_url'] = EE_Admin_Page::add_query_args_and_nonce(array('action' => 'edit_attendee', 'post' => $primary_att->ID()), REG_ADMIN_URL);
1107 1107
 		// get formatted address for registrant
1108
-		$this->_template_args[ 'formatted_address' ] = EEH_Address::format( $primary_att );
1109
-		echo EEH_Template::display_template( TXN_TEMPLATE_PATH . 'txn_admin_details_side_meta_box_registrant.template.php', $this->_template_args, TRUE );
1108
+		$this->_template_args['formatted_address'] = EEH_Address::format($primary_att);
1109
+		echo EEH_Template::display_template(TXN_TEMPLATE_PATH.'txn_admin_details_side_meta_box_registrant.template.php', $this->_template_args, TRUE);
1110 1110
 	}
1111 1111
 
1112 1112
 
@@ -1122,12 +1122,12 @@  discard block
 block discarded – undo
1122 1122
 
1123 1123
 		$this->_template_args['billing_form'] = $this->_transaction->billing_info();
1124 1124
 		$this->_template_args['billing_form_url'] = add_query_arg(
1125
-			array( 'action' => 'edit_transaction', 'process' => 'billing'  ),
1125
+			array('action' => 'edit_transaction', 'process' => 'billing'),
1126 1126
 			TXN_ADMIN_URL
1127 1127
 		);
1128 1128
 
1129
-		$template_path = TXN_TEMPLATE_PATH . 'txn_admin_details_side_meta_box_billing_info.template.php';
1130
-		echo EEH_Template::display_template( $template_path, $this->_template_args, TRUE );/**/
1129
+		$template_path = TXN_TEMPLATE_PATH.'txn_admin_details_side_meta_box_billing_info.template.php';
1130
+		echo EEH_Template::display_template($template_path, $this->_template_args, TRUE); /**/
1131 1131
 	}
1132 1132
 
1133 1133
 
@@ -1140,42 +1140,42 @@  discard block
 block discarded – undo
1140 1140
 	*	@return void
1141 1141
 	*/
1142 1142
 	public function apply_payments_or_refunds() {
1143
-		$json_response_data = array( 'return_data' => FALSE );
1143
+		$json_response_data = array('return_data' => FALSE);
1144 1144
 		$valid_data = $this->_validate_payment_request_data();
1145
-		if ( ! empty( $valid_data ) ) {
1146
-			$PAY_ID = $valid_data[ 'PAY_ID' ];
1145
+		if ( ! empty($valid_data)) {
1146
+			$PAY_ID = $valid_data['PAY_ID'];
1147 1147
 			//save  the new payment
1148
-			$payment = $this->_create_payment_from_request_data( $valid_data );
1148
+			$payment = $this->_create_payment_from_request_data($valid_data);
1149 1149
 			// get the TXN for this payment
1150 1150
 			$transaction = $payment->transaction();
1151 1151
 			// verify transaction
1152
-			if ( $transaction instanceof EE_Transaction ) {
1152
+			if ($transaction instanceof EE_Transaction) {
1153 1153
 				// calculate_total_payments_and_update_status
1154
-				$this->_process_transaction_payments( $transaction );
1155
-				$REG_IDs = $this->_get_REG_IDs_to_apply_payment_to( $payment );
1156
-				$this->_remove_existing_registration_payments( $payment, $PAY_ID );
1154
+				$this->_process_transaction_payments($transaction);
1155
+				$REG_IDs = $this->_get_REG_IDs_to_apply_payment_to($payment);
1156
+				$this->_remove_existing_registration_payments($payment, $PAY_ID);
1157 1157
 				// apply payment to registrations (if applicable)
1158
-				if ( ! empty( $REG_IDs ) ) {
1159
-					$this->_update_registration_payments( $transaction, $payment, $REG_IDs );
1158
+				if ( ! empty($REG_IDs)) {
1159
+					$this->_update_registration_payments($transaction, $payment, $REG_IDs);
1160 1160
 					$this->_maybe_send_notifications();
1161 1161
 					// now process status changes for the same registrations
1162
-					$this->_process_registration_status_change( $transaction, $REG_IDs );
1162
+					$this->_process_registration_status_change($transaction, $REG_IDs);
1163 1163
 				}
1164
-				$this->_maybe_send_notifications( $payment );
1164
+				$this->_maybe_send_notifications($payment);
1165 1165
 				//prepare to render page
1166
-				$json_response_data[ 'return_data' ] = $this->_build_payment_json_response( $payment, $REG_IDs );
1167
-				do_action( 'AHEE__Transactions_Admin_Page__apply_payments_or_refund__after_recording', $transaction, $payment );
1166
+				$json_response_data['return_data'] = $this->_build_payment_json_response($payment, $REG_IDs);
1167
+				do_action('AHEE__Transactions_Admin_Page__apply_payments_or_refund__after_recording', $transaction, $payment);
1168 1168
 			} else {
1169 1169
 				EE_Error::add_error(
1170
-					esc_html__( 'A valid Transaction for this payment could not be retrieved.', 'event_espresso' ),
1170
+					esc_html__('A valid Transaction for this payment could not be retrieved.', 'event_espresso'),
1171 1171
 					__FILE__, __FUNCTION__, __LINE__
1172 1172
 				);
1173 1173
 			}
1174 1174
 		} else {
1175
-			EE_Error::add_error( esc_html__( 'The payment form data could not be processed. Please try again.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
1175
+			EE_Error::add_error(esc_html__('The payment form data could not be processed. Please try again.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
1176 1176
 		}
1177 1177
 
1178
-		$notices = EE_Error::get_notices( false, false, false );
1178
+		$notices = EE_Error::get_notices(false, false, false);
1179 1179
 		$this->_template_args = array(
1180 1180
 			'data' => $json_response_data,
1181 1181
 			'error' => $notices['errors'],
@@ -1192,30 +1192,30 @@  discard block
 block discarded – undo
1192 1192
 	 * @return array
1193 1193
 	 */
1194 1194
 	protected function _validate_payment_request_data() {
1195
-		if ( ! isset( $this->_req_data[ 'txn_admin_payment' ] ) ) {
1195
+		if ( ! isset($this->_req_data['txn_admin_payment'])) {
1196 1196
 			return false;
1197 1197
 		}
1198 1198
 		$payment_form = $this->_generate_payment_form_section();
1199 1199
 		try {
1200
-			if ( $payment_form->was_submitted() ) {
1200
+			if ($payment_form->was_submitted()) {
1201 1201
 				$payment_form->receive_form_submission();
1202
-				if ( ! $payment_form->is_valid() ) {
1202
+				if ( ! $payment_form->is_valid()) {
1203 1203
 					$submission_error_messages = array();
1204
-					foreach ( $payment_form->get_validation_errors_accumulated() as $validation_error ) {
1205
-						if ( $validation_error instanceof EE_Validation_Error ) {
1204
+					foreach ($payment_form->get_validation_errors_accumulated() as $validation_error) {
1205
+						if ($validation_error instanceof EE_Validation_Error) {
1206 1206
 							$submission_error_messages[] = sprintf(
1207
-								_x( '%s : %s', 'Form Section Name : Form Validation Error', 'event_espresso' ),
1207
+								_x('%s : %s', 'Form Section Name : Form Validation Error', 'event_espresso'),
1208 1208
 								$validation_error->get_form_section()->html_label_text(),
1209 1209
 								$validation_error->getMessage()
1210 1210
 							);
1211 1211
 						}
1212 1212
 					}
1213
-					EE_Error::add_error( join( '<br />', $submission_error_messages ), __FILE__, __FUNCTION__, __LINE__ );
1213
+					EE_Error::add_error(join('<br />', $submission_error_messages), __FILE__, __FUNCTION__, __LINE__);
1214 1214
 					return array();
1215 1215
 				}
1216 1216
 			}
1217
-		} catch ( EE_Error $e ) {
1218
-			EE_Error::add_error( $e->getMessage(), __FILE__, __FUNCTION__, __LINE__ );
1217
+		} catch (EE_Error $e) {
1218
+			EE_Error::add_error($e->getMessage(), __FILE__, __FUNCTION__, __LINE__);
1219 1219
 			return array();
1220 1220
 		}
1221 1221
 		return $payment_form->valid_data();
@@ -1237,63 +1237,63 @@  discard block
 block discarded – undo
1237 1237
 						array(
1238 1238
 							'default' => 0,
1239 1239
 							'required' => false,
1240
-							'html_label_text' => esc_html__( 'Payment ID', 'event_espresso' ),
1241
-							'validation_strategies' => array( new EE_Int_Normalization() )
1240
+							'html_label_text' => esc_html__('Payment ID', 'event_espresso'),
1241
+							'validation_strategies' => array(new EE_Int_Normalization())
1242 1242
 						)
1243 1243
 					),
1244 1244
 					'TXN_ID' => new EE_Text_Input(
1245 1245
 						array(
1246 1246
 							'default' => 0,
1247 1247
 							'required' => true,
1248
-							'html_label_text' => esc_html__( 'Transaction ID', 'event_espresso' ),
1249
-							'validation_strategies' => array( new EE_Int_Normalization() )
1248
+							'html_label_text' => esc_html__('Transaction ID', 'event_espresso'),
1249
+							'validation_strategies' => array(new EE_Int_Normalization())
1250 1250
 						)
1251 1251
 					),
1252 1252
 					'type' => new EE_Text_Input(
1253 1253
 						array(
1254 1254
 							'default' => 1,
1255 1255
 							'required' => true,
1256
-							'html_label_text' => esc_html__( 'Payment or Refund', 'event_espresso' ),
1257
-							'validation_strategies' => array( new EE_Int_Normalization() )
1256
+							'html_label_text' => esc_html__('Payment or Refund', 'event_espresso'),
1257
+							'validation_strategies' => array(new EE_Int_Normalization())
1258 1258
 						)
1259 1259
 					),
1260 1260
 					'amount' => new EE_Text_Input(
1261 1261
 						array(
1262 1262
 							'default' => 0,
1263 1263
 							'required' => true,
1264
-							'html_label_text' => esc_html__( 'Payment amount', 'event_espresso' ),
1265
-							'validation_strategies' => array( new EE_Float_Normalization() )
1264
+							'html_label_text' => esc_html__('Payment amount', 'event_espresso'),
1265
+							'validation_strategies' => array(new EE_Float_Normalization())
1266 1266
 						)
1267 1267
 					),
1268 1268
 					'status' => new EE_Text_Input(
1269 1269
 						array(
1270 1270
 							'default' => EEM_Payment::status_id_approved,
1271 1271
 							'required' => true,
1272
-							'html_label_text' => esc_html__( 'Payment status', 'event_espresso' ),
1272
+							'html_label_text' => esc_html__('Payment status', 'event_espresso'),
1273 1273
 						)
1274 1274
 					),
1275 1275
 					'PMD_ID' => new EE_Text_Input(
1276 1276
 						array(
1277 1277
 							'default' => 2,
1278 1278
 							'required' => true,
1279
-							'html_label_text' => esc_html__( 'Payment Method', 'event_espresso' ),
1280
-							'validation_strategies' => array( new EE_Int_Normalization() )
1279
+							'html_label_text' => esc_html__('Payment Method', 'event_espresso'),
1280
+							'validation_strategies' => array(new EE_Int_Normalization())
1281 1281
 						)
1282 1282
 					),
1283 1283
 					'date' => new EE_Text_Input(
1284 1284
 						array(
1285 1285
 							'default' => time(),
1286 1286
 							'required' => true,
1287
-							'html_label_text' => esc_html__( 'Payment date', 'event_espresso' ),
1287
+							'html_label_text' => esc_html__('Payment date', 'event_espresso'),
1288 1288
 						)
1289 1289
 					),
1290 1290
 					'txn_id_chq_nmbr' => new EE_Text_Input(
1291 1291
 						array(
1292 1292
 							'default' => '',
1293 1293
 							'required' => false,
1294
-							'html_label_text' => esc_html__( 'Transaction or Cheque Number', 'event_espresso' ),
1294
+							'html_label_text' => esc_html__('Transaction or Cheque Number', 'event_espresso'),
1295 1295
                                                         'validation_strategies' => array(
1296
-                                                            new EE_Max_Length_Validation_Strategy( esc_html__('Input too long', 'event_espresso'), 100 ),
1296
+                                                            new EE_Max_Length_Validation_Strategy(esc_html__('Input too long', 'event_espresso'), 100),
1297 1297
                                                         )
1298 1298
 						)
1299 1299
 					),
@@ -1301,9 +1301,9 @@  discard block
 block discarded – undo
1301 1301
 						array(
1302 1302
 							'default' => '',
1303 1303
 							'required' => false,
1304
-							'html_label_text' => esc_html__( 'Purchase Order Number', 'event_espresso' ),
1304
+							'html_label_text' => esc_html__('Purchase Order Number', 'event_espresso'),
1305 1305
                                                         'validation_strategies' => array(
1306
-                                                            new EE_Max_Length_Validation_Strategy( esc_html__('Input too long', 'event_espresso'), 100 ),
1306
+                                                            new EE_Max_Length_Validation_Strategy(esc_html__('Input too long', 'event_espresso'), 100),
1307 1307
                                                         )
1308 1308
 						)
1309 1309
 					),
@@ -1311,9 +1311,9 @@  discard block
 block discarded – undo
1311 1311
 						array(
1312 1312
 							'default' => '',
1313 1313
 							'required' => false,
1314
-							'html_label_text' => esc_html__( 'Extra Field for Accounting', 'event_espresso' ),
1314
+							'html_label_text' => esc_html__('Extra Field for Accounting', 'event_espresso'),
1315 1315
                                                         'validation_strategies' => array(
1316
-                                                            new EE_Max_Length_Validation_Strategy( esc_html__('Input too long', 'event_espresso'), 100 ),
1316
+                                                            new EE_Max_Length_Validation_Strategy(esc_html__('Input too long', 'event_espresso'), 100),
1317 1317
                                                         )
1318 1318
 						)
1319 1319
 					),
@@ -1330,37 +1330,37 @@  discard block
 block discarded – undo
1330 1330
 	 * @param array $valid_data
1331 1331
 	 * @return EE_Payment
1332 1332
 	 */
1333
-	protected function _create_payment_from_request_data( $valid_data ) {
1334
-		$PAY_ID = $valid_data[ 'PAY_ID' ];
1333
+	protected function _create_payment_from_request_data($valid_data) {
1334
+		$PAY_ID = $valid_data['PAY_ID'];
1335 1335
 		// get payment amount
1336
-		$amount = $valid_data[ 'amount' ] ? abs( $valid_data[ 'amount' ] ) : 0;
1336
+		$amount = $valid_data['amount'] ? abs($valid_data['amount']) : 0;
1337 1337
 		// payments have a type value of 1 and refunds have a type value of -1
1338 1338
 		// so multiplying amount by type will give a positive value for payments, and negative values for refunds
1339
-		$amount = $valid_data[ 'type' ] < 0 ? $amount * -1 : $amount;
1339
+		$amount = $valid_data['type'] < 0 ? $amount * -1 : $amount;
1340 1340
 		// for some reason the date string coming in has extra spaces between the date and time.  This fixes that.
1341
-		$date = $valid_data['date'] ? preg_replace( '/\s+/', ' ', $valid_data['date'] ) : date( 'Y-m-d g:i a', current_time( 'timestamp' ) );
1341
+		$date = $valid_data['date'] ? preg_replace('/\s+/', ' ', $valid_data['date']) : date('Y-m-d g:i a', current_time('timestamp'));
1342 1342
 		$payment = EE_Payment::new_instance(
1343 1343
 			array(
1344
-				'TXN_ID' 								=> $valid_data[ 'TXN_ID' ],
1345
-				'STS_ID' 								=> $valid_data[ 'status' ],
1344
+				'TXN_ID' 								=> $valid_data['TXN_ID'],
1345
+				'STS_ID' 								=> $valid_data['status'],
1346 1346
 				'PAY_timestamp' 				=> $date,
1347 1347
 				'PAY_source'           			=> EEM_Payment_Method::scope_admin,
1348
-				'PMD_ID'               				=> $valid_data[ 'PMD_ID' ],
1348
+				'PMD_ID'               				=> $valid_data['PMD_ID'],
1349 1349
 				'PAY_amount'           			=> $amount,
1350
-				'PAY_txn_id_chq_nmbr'  	=> $valid_data[ 'txn_id_chq_nmbr' ],
1351
-				'PAY_po_number'        		=> $valid_data[ 'po_number' ],
1352
-				'PAY_extra_accntng'    		=> $valid_data[ 'accounting' ],
1350
+				'PAY_txn_id_chq_nmbr'  	=> $valid_data['txn_id_chq_nmbr'],
1351
+				'PAY_po_number'        		=> $valid_data['po_number'],
1352
+				'PAY_extra_accntng'    		=> $valid_data['accounting'],
1353 1353
 				'PAY_details'          				=> $valid_data,
1354 1354
 				'PAY_ID'               				=> $PAY_ID
1355 1355
 			),
1356 1356
 			'',
1357
-			array( 'Y-m-d', 'g:i a' )
1357
+			array('Y-m-d', 'g:i a')
1358 1358
 		);
1359 1359
 
1360
-		if ( ! $payment->save() ) {
1360
+		if ( ! $payment->save()) {
1361 1361
 			EE_Error::add_error(
1362 1362
 				sprintf(
1363
-					esc_html__( 'Payment %1$d has not been successfully saved to the database.', 'event_espresso' ),
1363
+					esc_html__('Payment %1$d has not been successfully saved to the database.', 'event_espresso'),
1364 1364
 					$payment->ID()
1365 1365
 				),
1366 1366
 				__FILE__, __FUNCTION__, __LINE__
@@ -1377,15 +1377,15 @@  discard block
 block discarded – undo
1377 1377
 	 * @param \EE_Transaction $transaction
1378 1378
 	 * @return array
1379 1379
 	 */
1380
-	protected function _process_transaction_payments( EE_Transaction $transaction ) {
1380
+	protected function _process_transaction_payments(EE_Transaction $transaction) {
1381 1381
 		/** @type EE_Transaction_Payments $transaction_payments */
1382
-		$transaction_payments = EE_Registry::instance()->load_class( 'Transaction_Payments' );
1382
+		$transaction_payments = EE_Registry::instance()->load_class('Transaction_Payments');
1383 1383
 		//update the transaction with this payment
1384
-		if ( $transaction_payments->calculate_total_payments_and_update_status( $transaction ) ) {
1385
-			EE_Error::add_success( esc_html__( 'The payment has been processed successfully.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
1384
+		if ($transaction_payments->calculate_total_payments_and_update_status($transaction)) {
1385
+			EE_Error::add_success(esc_html__('The payment has been processed successfully.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
1386 1386
 		} else {
1387 1387
 			EE_Error::add_error(
1388
-				esc_html__( 'The payment was processed successfully but the amount paid for the transaction was not updated.', 'event_espresso' )
1388
+				esc_html__('The payment was processed successfully but the amount paid for the transaction was not updated.', 'event_espresso')
1389 1389
 				, __FILE__, __FUNCTION__, __LINE__
1390 1390
 			);
1391 1391
 		}
@@ -1401,19 +1401,19 @@  discard block
 block discarded – undo
1401 1401
 	 * @param \EE_Payment $payment
1402 1402
 	 * @return array
1403 1403
 	 */
1404
-	protected function _get_REG_IDs_to_apply_payment_to( EE_Payment $payment ) {
1404
+	protected function _get_REG_IDs_to_apply_payment_to(EE_Payment $payment) {
1405 1405
 		$REG_IDs = array();
1406 1406
 		// grab array of IDs for specific registrations to apply changes to
1407
-		if ( isset( $this->_req_data[ 'txn_admin_payment' ][ 'registrations' ] ) ) {
1408
-			$REG_IDs = (array)$this->_req_data[ 'txn_admin_payment' ][ 'registrations' ];
1407
+		if (isset($this->_req_data['txn_admin_payment']['registrations'])) {
1408
+			$REG_IDs = (array) $this->_req_data['txn_admin_payment']['registrations'];
1409 1409
 		}
1410 1410
 		//nothing specified ? then get all reg IDs
1411
-		if ( empty( $REG_IDs ) ) {
1411
+		if (empty($REG_IDs)) {
1412 1412
 			$registrations = $payment->transaction()->registrations();
1413
-			$REG_IDs = ! empty( $registrations ) ? array_keys( $registrations ) : $this->_get_existing_reg_payment_REG_IDs( $payment );
1413
+			$REG_IDs = ! empty($registrations) ? array_keys($registrations) : $this->_get_existing_reg_payment_REG_IDs($payment);
1414 1414
 		}
1415 1415
 		// ensure that REG_IDs are integers and NOT strings
1416
-		return array_map( 'intval', $REG_IDs );
1416
+		return array_map('intval', $REG_IDs);
1417 1417
 	}
1418 1418
 
1419 1419
 
@@ -1430,7 +1430,7 @@  discard block
 block discarded – undo
1430 1430
 	/**
1431 1431
 	 * @param array $existing_reg_payment_REG_IDs
1432 1432
 	 */
1433
-	public function set_existing_reg_payment_REG_IDs( $existing_reg_payment_REG_IDs = null ) {
1433
+	public function set_existing_reg_payment_REG_IDs($existing_reg_payment_REG_IDs = null) {
1434 1434
 		$this->_existing_reg_payment_REG_IDs = $existing_reg_payment_REG_IDs;
1435 1435
 	}
1436 1436
 
@@ -1445,13 +1445,13 @@  discard block
 block discarded – undo
1445 1445
 	 * @param \EE_Payment $payment
1446 1446
 	 * @return array
1447 1447
 	 */
1448
-	protected function _get_existing_reg_payment_REG_IDs( EE_Payment $payment ) {
1449
-		if ( $this->existing_reg_payment_REG_IDs() === null ) {
1448
+	protected function _get_existing_reg_payment_REG_IDs(EE_Payment $payment) {
1449
+		if ($this->existing_reg_payment_REG_IDs() === null) {
1450 1450
 			// let's get any existing reg payment records for this payment
1451
-			$existing_reg_payment_REG_IDs = $payment->get_many_related( 'Registration' );
1451
+			$existing_reg_payment_REG_IDs = $payment->get_many_related('Registration');
1452 1452
 			// but we only want the REG IDs, so grab the array keys
1453
-			$existing_reg_payment_REG_IDs = ! empty( $existing_reg_payment_REG_IDs ) ? array_keys( $existing_reg_payment_REG_IDs ) : array();
1454
-			$this->set_existing_reg_payment_REG_IDs( $existing_reg_payment_REG_IDs );
1453
+			$existing_reg_payment_REG_IDs = ! empty($existing_reg_payment_REG_IDs) ? array_keys($existing_reg_payment_REG_IDs) : array();
1454
+			$this->set_existing_reg_payment_REG_IDs($existing_reg_payment_REG_IDs);
1455 1455
 		}
1456 1456
 		return $this->existing_reg_payment_REG_IDs();
1457 1457
 	}
@@ -1470,23 +1470,23 @@  discard block
 block discarded – undo
1470 1470
 	 * @param int         $PAY_ID
1471 1471
 	 * @return bool;
1472 1472
 	 */
1473
-	protected function _remove_existing_registration_payments( EE_Payment $payment, $PAY_ID = 0 ) {
1473
+	protected function _remove_existing_registration_payments(EE_Payment $payment, $PAY_ID = 0) {
1474 1474
 		// newly created payments will have nothing recorded for $PAY_ID
1475
-		if ( $PAY_ID == 0 ) {
1475
+		if ($PAY_ID == 0) {
1476 1476
 			return false;
1477 1477
 		}
1478
-		$existing_reg_payment_REG_IDs = $this->_get_existing_reg_payment_REG_IDs( $payment );
1479
-		if ( empty( $existing_reg_payment_REG_IDs )) {
1478
+		$existing_reg_payment_REG_IDs = $this->_get_existing_reg_payment_REG_IDs($payment);
1479
+		if (empty($existing_reg_payment_REG_IDs)) {
1480 1480
 			return false;
1481 1481
 		}
1482 1482
 		/** @type EE_Transaction_Payments $transaction_payments */
1483
-		$transaction_payments = EE_Registry::instance()->load_class( 'Transaction_Payments' );
1483
+		$transaction_payments = EE_Registry::instance()->load_class('Transaction_Payments');
1484 1484
 		return $transaction_payments->delete_registration_payments_and_update_registrations(
1485 1485
 			$payment,
1486 1486
 			array(
1487 1487
 				array(
1488 1488
 					'PAY_ID' => $payment->ID(),
1489
-					'REG_ID' => array( 'IN', $existing_reg_payment_REG_IDs ),
1489
+					'REG_ID' => array('IN', $existing_reg_payment_REG_IDs),
1490 1490
 				)
1491 1491
 			)
1492 1492
 		);
@@ -1505,25 +1505,25 @@  discard block
 block discarded – undo
1505 1505
 	 * @param array $REG_IDs
1506 1506
 	 * @return bool
1507 1507
 	 */
1508
-	protected function _update_registration_payments( EE_Transaction $transaction, EE_Payment $payment, $REG_IDs = array() ) {
1508
+	protected function _update_registration_payments(EE_Transaction $transaction, EE_Payment $payment, $REG_IDs = array()) {
1509 1509
 		// we can pass our own custom set of registrations to EE_Payment_Processor::process_registration_payments()
1510 1510
 		// so let's do that using our set of REG_IDs from the form
1511 1511
 		$registration_query_where_params = array(
1512
-			'REG_ID' => array( 'IN', $REG_IDs )
1512
+			'REG_ID' => array('IN', $REG_IDs)
1513 1513
 		);
1514 1514
 		// but add in some conditions regarding payment,
1515 1515
 		// so that we don't apply payments to registrations that are free or have already been paid for
1516 1516
 		// but ONLY if the payment is NOT a refund ( ie: the payment amount is not negative )
1517
-		if ( ! $payment->is_a_refund() ) {
1518
-			$registration_query_where_params[ 'REG_final_price' ]  = array( '!=', 0 );
1519
-			$registration_query_where_params[ 'REG_final_price*' ]  = array( '!=', 'REG_paid', true );
1517
+		if ( ! $payment->is_a_refund()) {
1518
+			$registration_query_where_params['REG_final_price'] = array('!=', 0);
1519
+			$registration_query_where_params['REG_final_price*'] = array('!=', 'REG_paid', true);
1520 1520
 		}
1521 1521
 		//EEH_Debug_Tools::printr( $registration_query_where_params, '$registration_query_where_params', __FILE__, __LINE__ );
1522
-		$registrations = $transaction->registrations( array( $registration_query_where_params ) );
1523
-		if ( ! empty( $registrations ) ) {
1522
+		$registrations = $transaction->registrations(array($registration_query_where_params));
1523
+		if ( ! empty($registrations)) {
1524 1524
 			/** @type EE_Payment_Processor $payment_processor */
1525
-			$payment_processor = EE_Registry::instance()->load_core( 'Payment_Processor' );
1526
-			$payment_processor->process_registration_payments( $transaction, $payment, $registrations );
1525
+			$payment_processor = EE_Registry::instance()->load_core('Payment_Processor');
1526
+			$payment_processor->process_registration_payments($transaction, $payment, $registrations);
1527 1527
 		}
1528 1528
 	}
1529 1529
 
@@ -1539,22 +1539,22 @@  discard block
 block discarded – undo
1539 1539
 	 * @param array $REG_IDs
1540 1540
 	 * @return bool
1541 1541
 	 */
1542
-	protected function _process_registration_status_change( EE_Transaction $transaction, $REG_IDs = array() ) {
1542
+	protected function _process_registration_status_change(EE_Transaction $transaction, $REG_IDs = array()) {
1543 1543
 		// first if there is no change in status then we get out.
1544 1544
 		if (
1545
-			! isset( $this->_req_data['txn_reg_status_change'], $this->_req_data[ 'txn_reg_status_change' ][ 'reg_status' ] )
1545
+			! isset($this->_req_data['txn_reg_status_change'], $this->_req_data['txn_reg_status_change']['reg_status'])
1546 1546
 			|| $this->_req_data['txn_reg_status_change']['reg_status'] == 'NAN'
1547 1547
 		) {
1548 1548
 			//no error message, no change requested, just nothing to do man.
1549 1549
 			return FALSE;
1550 1550
 		}
1551 1551
 		/** @type EE_Transaction_Processor $transaction_processor */
1552
-		$transaction_processor = EE_Registry::instance()->load_class( 'Transaction_Processor' );
1552
+		$transaction_processor = EE_Registry::instance()->load_class('Transaction_Processor');
1553 1553
 		// made it here dude?  Oh WOW.  K, let's take care of changing the statuses
1554 1554
 		return $transaction_processor->manually_update_registration_statuses(
1555 1555
 			$transaction,
1556
-			sanitize_text_field( $this->_req_data[ 'txn_reg_status_change' ][ 'reg_status' ] ),
1557
-			array( array( 'REG_ID' => array( 'IN', $REG_IDs ) ) )
1556
+			sanitize_text_field($this->_req_data['txn_reg_status_change']['reg_status']),
1557
+			array(array('REG_ID' => array('IN', $REG_IDs)))
1558 1558
 		);
1559 1559
 	}
1560 1560
 
@@ -1569,16 +1569,16 @@  discard block
 block discarded – undo
1569 1569
 	 * @param bool | null        $delete_txn_reg_status_change
1570 1570
 	 * @return array
1571 1571
 	 */
1572
-	protected function _build_payment_json_response( EE_Payment $payment, $REG_IDs = array(), $delete_txn_reg_status_change = null ) {
1572
+	protected function _build_payment_json_response(EE_Payment $payment, $REG_IDs = array(), $delete_txn_reg_status_change = null) {
1573 1573
 		// was the payment deleted ?
1574
-		if ( is_bool( $delete_txn_reg_status_change )) {
1574
+		if (is_bool($delete_txn_reg_status_change)) {
1575 1575
 			return array(
1576 1576
 				'PAY_ID' 				=> $payment->ID(),
1577 1577
 				'amount' 			=> $payment->amount(),
1578 1578
 				'total_paid' 			=> $payment->transaction()->paid(),
1579 1579
 				'txn_status' 			=> $payment->transaction()->status_ID(),
1580 1580
 				'pay_status' 		=> $payment->STS_ID(),
1581
-				'registrations' 	=> $this->_registration_payment_data_array( $REG_IDs ),
1581
+				'registrations' 	=> $this->_registration_payment_data_array($REG_IDs),
1582 1582
 				'delete_txn_reg_status_change' => $delete_txn_reg_status_change,
1583 1583
 			);
1584 1584
 		} else {
@@ -1590,16 +1590,16 @@  discard block
 block discarded – undo
1590 1590
 				'pay_status' 	=> $payment->STS_ID(),
1591 1591
 				'PAY_ID'           => $payment->ID(),
1592 1592
 				'STS_ID' 			=> $payment->STS_ID(),
1593
-				'status' 			=> self::$_pay_status[ $payment->STS_ID() ],
1594
-				'date' 				=> $payment->timestamp( 'Y-m-d', 'h:i a' ),
1595
-				'method' 		=> strtoupper( $payment->source() ),
1593
+				'status' 			=> self::$_pay_status[$payment->STS_ID()],
1594
+				'date' 				=> $payment->timestamp('Y-m-d', 'h:i a'),
1595
+				'method' 		=> strtoupper($payment->source()),
1596 1596
 				'PM_ID' 			=> $payment->payment_method() ? $payment->payment_method()->ID() : 1,
1597
-				'gateway' 		=> $payment->payment_method() ? $payment->payment_method()->admin_name() : esc_html__( "Unknown", 'event_espresso' ),
1597
+				'gateway' 		=> $payment->payment_method() ? $payment->payment_method()->admin_name() : esc_html__("Unknown", 'event_espresso'),
1598 1598
 				'gateway_response' 	=> $payment->gateway_response(),
1599 1599
 				'txn_id_chq_nmbr'  	=> $payment->txn_id_chq_nmbr(),
1600 1600
 				'po_number'        		=> $payment->po_number(),
1601 1601
 				'extra_accntng'    		=> $payment->extra_accntng(),
1602
-				'registrations'    			=> $this->_registration_payment_data_array( $REG_IDs ),
1602
+				'registrations'    			=> $this->_registration_payment_data_array($REG_IDs),
1603 1603
 			);
1604 1604
 		}
1605 1605
 	}
@@ -1614,39 +1614,39 @@  discard block
 block discarded – undo
1614 1614
 	*	@return void
1615 1615
 	*/
1616 1616
 	public function delete_payment() {
1617
-		$json_response_data = array( 'return_data' => FALSE );
1618
-		$PAY_ID = isset( $this->_req_data['delete_txn_admin_payment'], $this->_req_data['delete_txn_admin_payment']['PAY_ID'] ) ? absint( $this->_req_data['delete_txn_admin_payment']['PAY_ID'] ) : 0;
1619
-		if ( $PAY_ID ) {
1620
-			$delete_txn_reg_status_change = isset( $this->_req_data[ 'delete_txn_reg_status_change' ] ) ? $this->_req_data[ 'delete_txn_reg_status_change' ] : false;
1621
-			$payment = EEM_Payment::instance()->get_one_by_ID( $PAY_ID );
1622
-			if ( $payment instanceof EE_Payment ) {
1623
-				$REG_IDs = $this->_get_existing_reg_payment_REG_IDs( $payment );
1617
+		$json_response_data = array('return_data' => FALSE);
1618
+		$PAY_ID = isset($this->_req_data['delete_txn_admin_payment'], $this->_req_data['delete_txn_admin_payment']['PAY_ID']) ? absint($this->_req_data['delete_txn_admin_payment']['PAY_ID']) : 0;
1619
+		if ($PAY_ID) {
1620
+			$delete_txn_reg_status_change = isset($this->_req_data['delete_txn_reg_status_change']) ? $this->_req_data['delete_txn_reg_status_change'] : false;
1621
+			$payment = EEM_Payment::instance()->get_one_by_ID($PAY_ID);
1622
+			if ($payment instanceof EE_Payment) {
1623
+				$REG_IDs = $this->_get_existing_reg_payment_REG_IDs($payment);
1624 1624
 				/** @type EE_Transaction_Payments $transaction_payments */
1625
-				$transaction_payments = EE_Registry::instance()->load_class( 'Transaction_Payments' );
1626
-				if ( $transaction_payments->delete_payment_and_update_transaction( $payment )) {
1627
-					$json_response_data['return_data'] = $this->_build_payment_json_response( $payment, $REG_IDs, $delete_txn_reg_status_change );
1628
-					if ( $delete_txn_reg_status_change ) {
1625
+				$transaction_payments = EE_Registry::instance()->load_class('Transaction_Payments');
1626
+				if ($transaction_payments->delete_payment_and_update_transaction($payment)) {
1627
+					$json_response_data['return_data'] = $this->_build_payment_json_response($payment, $REG_IDs, $delete_txn_reg_status_change);
1628
+					if ($delete_txn_reg_status_change) {
1629 1629
 						$this->_req_data['txn_reg_status_change'] = $delete_txn_reg_status_change;
1630 1630
 						//MAKE sure we also add the delete_txn_req_status_change to the
1631 1631
 						//$_REQUEST global because that's how messages will be looking for it.
1632 1632
 						$_REQUEST['txn_reg_status_change'] = $delete_txn_reg_status_change;
1633 1633
 						$this->_maybe_send_notifications();
1634
-						$this->_process_registration_status_change( $payment->transaction(), $REG_IDs );
1634
+						$this->_process_registration_status_change($payment->transaction(), $REG_IDs);
1635 1635
 					}
1636 1636
 				}
1637 1637
 			} else {
1638 1638
 				EE_Error::add_error(
1639
-					esc_html__( 'Valid Payment data could not be retrieved from the database.', 'event_espresso' ),
1639
+					esc_html__('Valid Payment data could not be retrieved from the database.', 'event_espresso'),
1640 1640
 					__FILE__, __FUNCTION__, __LINE__
1641 1641
 				);
1642 1642
 			}
1643 1643
 		} else {
1644 1644
 			EE_Error::add_error(
1645
-				esc_html__( 'A valid Payment ID was not received, therefore payment form data could not be loaded.', 'event_espresso' ),
1645
+				esc_html__('A valid Payment ID was not received, therefore payment form data could not be loaded.', 'event_espresso'),
1646 1646
 				__FILE__, __FUNCTION__, __LINE__
1647 1647
 			);
1648 1648
 		}
1649
-		$notices = EE_Error::get_notices( false, false, false);
1649
+		$notices = EE_Error::get_notices(false, false, false);
1650 1650
 		$this->_template_args = array(
1651 1651
 			'data' => $json_response_data,
1652 1652
 			'success' => $notices['success'],
@@ -1666,16 +1666,16 @@  discard block
 block discarded – undo
1666 1666
 	 * @param array $REG_IDs
1667 1667
 	 * @return array
1668 1668
 	 */
1669
-	protected function _registration_payment_data_array( $REG_IDs ) {
1669
+	protected function _registration_payment_data_array($REG_IDs) {
1670 1670
 		$registration_payment_data = array();
1671 1671
 		//if non empty reg_ids lets get an array of registrations and update the values for the apply_payment/refund rows.
1672
-		if ( ! empty( $REG_IDs ) ) {
1673
-			$registrations = EEM_Registration::instance()->get_all( array( array( 'REG_ID' => array( 'IN', $REG_IDs ) ) ) );
1674
-			foreach ( $registrations as $registration ) {
1675
-				if ( $registration instanceof EE_Registration ) {
1676
-					$registration_payment_data[ $registration->ID() ] = array(
1672
+		if ( ! empty($REG_IDs)) {
1673
+			$registrations = EEM_Registration::instance()->get_all(array(array('REG_ID' => array('IN', $REG_IDs))));
1674
+			foreach ($registrations as $registration) {
1675
+				if ($registration instanceof EE_Registration) {
1676
+					$registration_payment_data[$registration->ID()] = array(
1677 1677
 						'paid' => $registration->pretty_paid(),
1678
-						'owing' => EEH_Template::format_currency( $registration->final_price() - $registration->paid() ),
1678
+						'owing' => EEH_Template::format_currency($registration->final_price() - $registration->paid()),
1679 1679
 					);
1680 1680
 				}
1681 1681
 			}
@@ -1695,30 +1695,30 @@  discard block
 block discarded – undo
1695 1695
 	 * @access protected
1696 1696
 	 * @param \EE_Payment | null $payment
1697 1697
 	 */
1698
-	protected function _maybe_send_notifications( $payment = null ) {
1699
-		switch ( $payment instanceof EE_Payment ) {
1698
+	protected function _maybe_send_notifications($payment = null) {
1699
+		switch ($payment instanceof EE_Payment) {
1700 1700
 			// payment notifications
1701 1701
 			case true :
1702 1702
 				if (
1703 1703
 					isset(
1704
-						$this->_req_data[ 'txn_payments' ],
1705
-						$this->_req_data[ 'txn_payments' ][ 'send_notifications' ]
1704
+						$this->_req_data['txn_payments'],
1705
+						$this->_req_data['txn_payments']['send_notifications']
1706 1706
 					) &&
1707
-					filter_var( $this->_req_data[ 'txn_payments' ][ 'send_notifications' ], FILTER_VALIDATE_BOOLEAN )
1707
+					filter_var($this->_req_data['txn_payments']['send_notifications'], FILTER_VALIDATE_BOOLEAN)
1708 1708
 				) {
1709
-					$this->_process_payment_notification( $payment );
1709
+					$this->_process_payment_notification($payment);
1710 1710
 				}
1711 1711
 				break;
1712 1712
 			// registration notifications
1713 1713
 			case false :
1714 1714
 				if (
1715 1715
 					isset(
1716
-						$this->_req_data[ 'txn_reg_status_change' ],
1717
-						$this->_req_data[ 'txn_reg_status_change' ][ 'send_notifications' ]
1716
+						$this->_req_data['txn_reg_status_change'],
1717
+						$this->_req_data['txn_reg_status_change']['send_notifications']
1718 1718
 					) &&
1719
-					filter_var( $this->_req_data[ 'txn_reg_status_change' ][ 'send_notifications' ], FILTER_VALIDATE_BOOLEAN )
1719
+					filter_var($this->_req_data['txn_reg_status_change']['send_notifications'], FILTER_VALIDATE_BOOLEAN)
1720 1720
 				) {
1721
-					add_filter( 'FHEE__EED_Messages___maybe_registration__deliver_notifications', '__return_true' );
1721
+					add_filter('FHEE__EED_Messages___maybe_registration__deliver_notifications', '__return_true');
1722 1722
 				}
1723 1723
 				break;
1724 1724
 		}
@@ -1734,11 +1734,11 @@  discard block
 block discarded – undo
1734 1734
 	*	@return void
1735 1735
 	*/
1736 1736
 	protected function _send_payment_reminder() {
1737
-	    $TXN_ID = ( ! empty( $this->_req_data['TXN_ID'] )) ? absint( $this->_req_data['TXN_ID'] ) : FALSE;
1738
-		$transaction = EEM_Transaction::instance()->get_one_by_ID( $TXN_ID );
1739
-		$query_args = isset($this->_req_data['redirect_to'] ) ? array('action' => $this->_req_data['redirect_to'], 'TXN_ID' => $this->_req_data['TXN_ID'] ) : array();
1740
-		do_action( 'AHEE__Transactions_Admin_Page___send_payment_reminder__process_admin_payment_reminder', $transaction );
1741
-		$this->_redirect_after_action( FALSE, esc_html__('payment reminder', 'event_espresso'), esc_html__('sent', 'event_espresso'), $query_args, TRUE );
1737
+	    $TXN_ID = ( ! empty($this->_req_data['TXN_ID'])) ? absint($this->_req_data['TXN_ID']) : FALSE;
1738
+		$transaction = EEM_Transaction::instance()->get_one_by_ID($TXN_ID);
1739
+		$query_args = isset($this->_req_data['redirect_to']) ? array('action' => $this->_req_data['redirect_to'], 'TXN_ID' => $this->_req_data['TXN_ID']) : array();
1740
+		do_action('AHEE__Transactions_Admin_Page___send_payment_reminder__process_admin_payment_reminder', $transaction);
1741
+		$this->_redirect_after_action(FALSE, esc_html__('payment reminder', 'event_espresso'), esc_html__('sent', 'event_espresso'), $query_args, TRUE);
1742 1742
 	}
1743 1743
 
1744 1744
 
@@ -1752,36 +1752,36 @@  discard block
 block discarded – undo
1752 1752
 	 * @param string   $view
1753 1753
 	 * @return mixed int = count || array of transaction objects
1754 1754
 	 */
1755
-	public function get_transactions( $perpage, $count = FALSE, $view = '' ) {
1755
+	public function get_transactions($perpage, $count = FALSE, $view = '') {
1756 1756
 
1757 1757
 		$TXN = EEM_Transaction::instance();
1758 1758
 
1759
-	    $start_date = isset( $this->_req_data['txn-filter-start-date'] ) ? wp_strip_all_tags( $this->_req_data['txn-filter-start-date'] ) : date( 'm/d/Y', strtotime( '-10 year' ));
1760
-	    $end_date = isset( $this->_req_data['txn-filter-end-date'] ) ? wp_strip_all_tags( $this->_req_data['txn-filter-end-date'] ) : date( 'm/d/Y' );
1759
+	    $start_date = isset($this->_req_data['txn-filter-start-date']) ? wp_strip_all_tags($this->_req_data['txn-filter-start-date']) : date('m/d/Y', strtotime('-10 year'));
1760
+	    $end_date = isset($this->_req_data['txn-filter-end-date']) ? wp_strip_all_tags($this->_req_data['txn-filter-end-date']) : date('m/d/Y');
1761 1761
 
1762 1762
 	    //make sure our timestamps start and end right at the boundaries for each day
1763
-	    $start_date = date( 'Y-m-d', strtotime( $start_date ) ) . ' 00:00:00';
1764
-	    $end_date = date( 'Y-m-d', strtotime( $end_date ) ) . ' 23:59:59';
1763
+	    $start_date = date('Y-m-d', strtotime($start_date)).' 00:00:00';
1764
+	    $end_date = date('Y-m-d', strtotime($end_date)).' 23:59:59';
1765 1765
 
1766 1766
 
1767 1767
 	    //convert to timestamps
1768
-	    $start_date = strtotime( $start_date );
1769
-	    $end_date = strtotime( $end_date );
1768
+	    $start_date = strtotime($start_date);
1769
+	    $end_date = strtotime($end_date);
1770 1770
 
1771 1771
 	    //makes sure start date is the lowest value and vice versa
1772
-	    $start_date = min( $start_date, $end_date );
1773
-	    $end_date = max( $start_date, $end_date );
1772
+	    $start_date = min($start_date, $end_date);
1773
+	    $end_date = max($start_date, $end_date);
1774 1774
 
1775 1775
 	    //convert to correct format for query
1776
-	$start_date = EEM_Transaction::instance()->convert_datetime_for_query( 'TXN_timestamp', date( 'Y-m-d H:i:s', $start_date ), 'Y-m-d H:i:s' );
1777
-	$end_date = EEM_Transaction::instance()->convert_datetime_for_query( 'TXN_timestamp', date( 'Y-m-d H:i:s', $end_date ), 'Y-m-d H:i:s' );
1776
+	$start_date = EEM_Transaction::instance()->convert_datetime_for_query('TXN_timestamp', date('Y-m-d H:i:s', $start_date), 'Y-m-d H:i:s');
1777
+	$end_date = EEM_Transaction::instance()->convert_datetime_for_query('TXN_timestamp', date('Y-m-d H:i:s', $end_date), 'Y-m-d H:i:s');
1778 1778
 
1779 1779
 
1780 1780
 
1781 1781
 	    //set orderby
1782 1782
 		$this->_req_data['orderby'] = ! empty($this->_req_data['orderby']) ? $this->_req_data['orderby'] : '';
1783 1783
 
1784
-		switch ( $this->_req_data['orderby'] ) {
1784
+		switch ($this->_req_data['orderby']) {
1785 1785
 			case 'TXN_ID':
1786 1786
 				$orderby = 'TXN_ID';
1787 1787
 				break;
@@ -1795,66 +1795,66 @@  discard block
 block discarded – undo
1795 1795
 				$orderby = 'TXN_timestamp';
1796 1796
 		}
1797 1797
 
1798
-		$sort = ( isset( $this->_req_data['order'] ) && ! empty( $this->_req_data['order'] )) ? $this->_req_data['order'] : 'DESC';
1799
-		$current_page = isset( $this->_req_data['paged'] ) && !empty( $this->_req_data['paged'] ) ? $this->_req_data['paged'] : 1;
1800
-		$per_page = isset( $perpage ) && !empty( $perpage ) ? $perpage : 10;
1801
-		$per_page = isset( $this->_req_data['perpage'] ) && !empty( $this->_req_data['perpage'] ) ? $this->_req_data['perpage'] : $per_page;
1798
+		$sort = (isset($this->_req_data['order']) && ! empty($this->_req_data['order'])) ? $this->_req_data['order'] : 'DESC';
1799
+		$current_page = isset($this->_req_data['paged']) && ! empty($this->_req_data['paged']) ? $this->_req_data['paged'] : 1;
1800
+		$per_page = isset($perpage) && ! empty($perpage) ? $perpage : 10;
1801
+		$per_page = isset($this->_req_data['perpage']) && ! empty($this->_req_data['perpage']) ? $this->_req_data['perpage'] : $per_page;
1802 1802
 
1803
-		$offset = ($current_page-1)*$per_page;
1804
-		$limit = array( $offset, $per_page );
1803
+		$offset = ($current_page - 1) * $per_page;
1804
+		$limit = array($offset, $per_page);
1805 1805
 
1806 1806
 		$_where = array(
1807
-			'TXN_timestamp' => array('BETWEEN', array($start_date, $end_date) ),
1807
+			'TXN_timestamp' => array('BETWEEN', array($start_date, $end_date)),
1808 1808
 			'Registration.REG_count' => 1
1809 1809
 		);
1810 1810
 
1811
-		if ( isset( $this->_req_data['EVT_ID'] ) ) {
1811
+		if (isset($this->_req_data['EVT_ID'])) {
1812 1812
 			$_where['Registration.EVT_ID'] = $this->_req_data['EVT_ID'];
1813 1813
 		}
1814 1814
 
1815
-		if ( isset( $this->_req_data['s'] ) ) {
1816
-			$search_string = '%' . $this->_req_data['s'] . '%';
1815
+		if (isset($this->_req_data['s'])) {
1816
+			$search_string = '%'.$this->_req_data['s'].'%';
1817 1817
 			$_where['OR'] = array(
1818
-				'Registration.Event.EVT_name' => array( 'LIKE', $search_string ),
1819
-				'Registration.Event.EVT_desc' => array( 'LIKE', $search_string ),
1820
-				'Registration.Event.EVT_short_desc' => array( 'LIKE' , $search_string ),
1821
-				'Registration.Attendee.ATT_full_name' => array( 'LIKE', $search_string ),
1822
-				'Registration.Attendee.ATT_fname' => array( 'LIKE', $search_string ),
1823
-				'Registration.Attendee.ATT_lname' => array( 'LIKE', $search_string ),
1824
-				'Registration.Attendee.ATT_short_bio' => array( 'LIKE', $search_string ),
1825
-				'Registration.Attendee.ATT_email' => array('LIKE', $search_string ),
1826
-				'Registration.Attendee.ATT_address' => array( 'LIKE', $search_string ),
1827
-				'Registration.Attendee.ATT_address2' => array( 'LIKE', $search_string ),
1828
-				'Registration.Attendee.ATT_city' => array( 'LIKE', $search_string ),
1829
-				'Registration.REG_final_price' => array( 'LIKE', $search_string ),
1830
-				'Registration.REG_code' => array( 'LIKE', $search_string ),
1831
-				'Registration.REG_count' => array( 'LIKE' , $search_string ),
1832
-				'Registration.REG_group_size' => array( 'LIKE' , $search_string ),
1833
-				'Registration.Ticket.TKT_name' => array( 'LIKE', $search_string ),
1834
-				'Registration.Ticket.TKT_description' => array( 'LIKE', $search_string ),
1835
-				'Payment.PAY_source' => array('LIKE', $search_string ),
1836
-				'Payment.Payment_Method.PMD_name' => array('LIKE', $search_string ),
1837
-				'TXN_session_data' => array( 'LIKE', $search_string ),
1838
-				'Payment.PAY_txn_id_chq_nmbr' => array( 'LIKE', $search_string )
1818
+				'Registration.Event.EVT_name' => array('LIKE', $search_string),
1819
+				'Registration.Event.EVT_desc' => array('LIKE', $search_string),
1820
+				'Registration.Event.EVT_short_desc' => array('LIKE', $search_string),
1821
+				'Registration.Attendee.ATT_full_name' => array('LIKE', $search_string),
1822
+				'Registration.Attendee.ATT_fname' => array('LIKE', $search_string),
1823
+				'Registration.Attendee.ATT_lname' => array('LIKE', $search_string),
1824
+				'Registration.Attendee.ATT_short_bio' => array('LIKE', $search_string),
1825
+				'Registration.Attendee.ATT_email' => array('LIKE', $search_string),
1826
+				'Registration.Attendee.ATT_address' => array('LIKE', $search_string),
1827
+				'Registration.Attendee.ATT_address2' => array('LIKE', $search_string),
1828
+				'Registration.Attendee.ATT_city' => array('LIKE', $search_string),
1829
+				'Registration.REG_final_price' => array('LIKE', $search_string),
1830
+				'Registration.REG_code' => array('LIKE', $search_string),
1831
+				'Registration.REG_count' => array('LIKE', $search_string),
1832
+				'Registration.REG_group_size' => array('LIKE', $search_string),
1833
+				'Registration.Ticket.TKT_name' => array('LIKE', $search_string),
1834
+				'Registration.Ticket.TKT_description' => array('LIKE', $search_string),
1835
+				'Payment.PAY_source' => array('LIKE', $search_string),
1836
+				'Payment.Payment_Method.PMD_name' => array('LIKE', $search_string),
1837
+				'TXN_session_data' => array('LIKE', $search_string),
1838
+				'Payment.PAY_txn_id_chq_nmbr' => array('LIKE', $search_string)
1839 1839
 				);
1840 1840
 		}
1841 1841
 
1842 1842
 		//failed transactions
1843
-		$failed = ( ! empty( $this->_req_data['status'] ) && $this->_req_data['status'] == 'failed' && ! $count ) || ( $count && $view == 'failed' ) ? TRUE: FALSE;
1844
-		$abandoned = ( ! empty( $this->_req_data['status'] ) && $this->_req_data['status'] == 'abandoned' && ! $count ) || ( $count && $view == 'abandoned' ) ? TRUE: FALSE;
1843
+		$failed = ( ! empty($this->_req_data['status']) && $this->_req_data['status'] == 'failed' && ! $count) || ($count && $view == 'failed') ? TRUE : FALSE;
1844
+		$abandoned = ( ! empty($this->_req_data['status']) && $this->_req_data['status'] == 'abandoned' && ! $count) || ($count && $view == 'abandoned') ? TRUE : FALSE;
1845 1845
 
1846
-		if ( $failed ) {
1847
-			$_where[ 'STS_ID' ] = EEM_Transaction::failed_status_code;
1848
-		} else if ( $abandoned ) {
1846
+		if ($failed) {
1847
+			$_where['STS_ID'] = EEM_Transaction::failed_status_code;
1848
+		} else if ($abandoned) {
1849 1849
 				$_where['STS_ID'] = EEM_Transaction::abandoned_status_code;
1850 1850
 		} else {
1851
-				$_where['STS_ID'] = array( '!=', EEM_Transaction::failed_status_code );
1852
-				$_where['STS_ID*'] = array( '!=', EEM_Transaction::abandoned_status_code );
1851
+				$_where['STS_ID'] = array('!=', EEM_Transaction::failed_status_code);
1852
+				$_where['STS_ID*'] = array('!=', EEM_Transaction::abandoned_status_code);
1853 1853
 		}
1854 1854
 
1855
-		$query_params = array( $_where, 'order_by' => array( $orderby => $sort ), 'limit' => $limit );
1855
+		$query_params = array($_where, 'order_by' => array($orderby => $sort), 'limit' => $limit);
1856 1856
 
1857
-		$transactions = $count ? $TXN->count( array($_where), 'TXN_ID', TRUE ) : $TXN->get_all($query_params);
1857
+		$transactions = $count ? $TXN->count(array($_where), 'TXN_ID', TRUE) : $TXN->get_all($query_params);
1858 1858
 
1859 1859
 
1860 1860
 		return $transactions;
Please login to merge, or discard this patch.
general_settings/templates/your_organization_settings.template.php 1 patch
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -1,7 +1,7 @@  discard block
 block discarded – undo
1 1
 <div class="padding">
2 2
 	<?php
3 3
 		//we'll only show site-license keys if this is main_site() (which works for both multi-site and single-site wp installations)
4
-		if ( is_main_site() ) { ?>
4
+		if (is_main_site()) { ?>
5 5
 		<h2 class="ee-admin-settings-hdr" style="width:300px;">
6 6
 			<?php _e('Your Event Espresso License Key', 'event_espresso'); ?>
7 7
 		</h2>
@@ -11,13 +11,13 @@  discard block
 block discarded – undo
11 11
 				<tr <?php echo isset($_REQUEST['license_key']) && $_REQUEST['license_key'] == true ? 'class="yellow_alert"' : '' ?>>
12 12
 					<th>
13 13
 						<label for="site_license_key">
14
-							<?php _e('Support License Key', 'event_espresso'); ?> <?php echo EEH_Template::get_help_tab_link('site_license_key_info');?>
14
+							<?php _e('Support License Key', 'event_espresso'); ?> <?php echo EEH_Template::get_help_tab_link('site_license_key_info'); ?>
15 15
 						</label>
16 16
 					</th>
17 17
 					<td>
18 18
 						<input name="site_license_key" id="site_license_key" size="10" class="regular-text" type="text" value="<?php echo $site_license_key; ?>" /><?php echo $site_license_key_verified; ?><br/>
19 19
 						<p class="description">
20
-							<?php printf( __('Adding a valid Support License Key will enable automatic update notifications and backend updates for Event Espresso Core and any installed add-ons. If this is a Development or Test site, %sDO NOT%s enter your Support License Key.', 'event_espresso'), '<strong>', '</strong>' ); ?>
20
+							<?php printf(__('Adding a valid Support License Key will enable automatic update notifications and backend updates for Event Espresso Core and any installed add-ons. If this is a Development or Test site, %sDO NOT%s enter your Support License Key.', 'event_espresso'), '<strong>', '</strong>'); ?>
21 21
 						</p>
22 22
 					</td>
23 23
 				</tr>
@@ -30,7 +30,7 @@  discard block
 block discarded – undo
30 30
 
31 31
 
32 32
 	<h2 id="contact_info_h4" class="ee-admin-settings-hdr">
33
-		<?php _e('Contact Information', 'event_espresso'); ?> <?php echo EEH_Template::get_help_tab_link('contact_info_info');?>
33
+		<?php _e('Contact Information', 'event_espresso'); ?> <?php echo EEH_Template::get_help_tab_link('contact_info_info'); ?>
34 34
 	</h2>
35 35
 
36 36
 	<table class="form-table">
@@ -78,8 +78,8 @@  discard block
 block discarded – undo
78 78
 					<input id="organization_city" class="regular-text" type="text" name="organization_city" value="<?php echo $organization_city; ?>" />
79 79
 				</td>
80 80
 			</tr>
81
-			<?php echo EEH_Form_Fields::generate_form_input( $states ); ?>
82
-			<?php echo EEH_Form_Fields::generate_form_input( $countries ); ?>
81
+			<?php echo EEH_Form_Fields::generate_form_input($states); ?>
82
+			<?php echo EEH_Form_Fields::generate_form_input($countries); ?>
83 83
 			<tr>
84 84
 				<th>
85 85
 					<label for="organization_zip">
@@ -99,7 +99,7 @@  discard block
 block discarded – undo
99 99
 				<td>
100 100
 					<input class="regular-text" type="text" name="organization_email" value="<?php echo $organization_email; ?>" />
101 101
 					<p class="description">
102
-						<?php echo sprintf( esc_html__('This is where notifications go to when you use the %1$s and %2$s shortcodes in the message templates.', 'event_espresso'), '<code>[CO_FORMATTED_EMAIL]</code>', '<code>[CO_EMAIL]</code>' ); ?>
102
+						<?php echo sprintf(esc_html__('This is where notifications go to when you use the %1$s and %2$s shortcodes in the message templates.', 'event_espresso'), '<code>[CO_FORMATTED_EMAIL]</code>', '<code>[CO_EMAIL]</code>'); ?>
103 103
 					</p>
104 104
 				</td>
105 105
 			</tr>
@@ -133,7 +133,7 @@  discard block
 block discarded – undo
133 133
 	</table>
134 134
 
135 135
 	<h2 class="ee-admin-settings-hdr">
136
-		<?php _e('Company Logo', 'event_espresso'); ?> <?php echo EEH_Template::get_help_tab_link('organization_logo_info');?>
136
+		<?php _e('Company Logo', 'event_espresso'); ?> <?php echo EEH_Template::get_help_tab_link('organization_logo_info'); ?>
137 137
 	</h2>
138 138
 
139 139
 	<table class="form-table">
@@ -161,7 +161,7 @@  discard block
 block discarded – undo
161 161
 				</th>
162 162
 				<td>
163 163
 					<?php
164
-					if ( $organization_logo_url ) {
164
+					if ($organization_logo_url) {
165 165
 						?>
166 166
 						<p id="default-logo-thumb">
167 167
 							<img id="current-image-thumb" src="<?php echo $organization_logo_url ?>" alt="" /><br />
@@ -179,7 +179,7 @@  discard block
 block discarded – undo
179 179
 	<br/><br/>
180 180
 
181 181
 	<h2 class="ee-admin-settings-hdr">
182
-		<?php _e('Social Links', 'event_espresso'); ?> <?php echo EEH_Template::get_help_tab_link('social_links_info');?>
182
+		<?php _e('Social Links', 'event_espresso'); ?> <?php echo EEH_Template::get_help_tab_link('social_links_info'); ?>
183 183
 	</h2>
184 184
 	<p class="description"><?php _e('Enter any links to social accounts for your organization here', 'event_espresso'); ?></p>
185 185
 
@@ -256,9 +256,9 @@  discard block
 block discarded – undo
256 256
 	<br/><br/>
257 257
 
258 258
 
259
-	<?php if ( is_main_site() ) : ?>
259
+	<?php if (is_main_site()) : ?>
260 260
 		<p>
261
-			<?php echo  EE_PUE::espresso_data_collection_optin_text( FALSE ); ?>
261
+			<?php echo  EE_PUE::espresso_data_collection_optin_text(FALSE); ?>
262 262
 		</p>
263 263
 
264 264
 		<table class="form-table">
@@ -272,11 +272,11 @@  discard block
 block discarded – undo
272 272
 					</th>
273 273
 					<td>
274 274
 						<?php
275
-							$values=array(
276
-								array('id'=>'yes','text'=> __('Yes! I want to help improve Event Espresso!','event_espresso')),
277
-								array('id'=>'no','text'=> __('Not at this time. Maybe later.','event_espresso'))
275
+							$values = array(
276
+								array('id'=>'yes', 'text'=> __('Yes! I want to help improve Event Espresso!', 'event_espresso')),
277
+								array('id'=>'no', 'text'=> __('Not at this time. Maybe later.', 'event_espresso'))
278 278
 							);
279
-							echo EEH_Form_Fields::select_input('ueip_optin', $values, !empty($ee_ueip_optin) ? $ee_ueip_optin : 'yes');
279
+							echo EEH_Form_Fields::select_input('ueip_optin', $values, ! empty($ee_ueip_optin) ? $ee_ueip_optin : 'yes');
280 280
 						?>
281 281
 					</td>
282 282
 				</tr>
Please login to merge, or discard this patch.