Completed
Branch BUG-9871-email-validation (e62b1a)
by
unknown
350:41 queued 333:27
created
core/services/container/RecipeInterface.php 1 patch
Indentation   +79 added lines, -79 removed lines patch added patch discarded remove patch
@@ -2,7 +2,7 @@  discard block
 block discarded – undo
2 2
 namespace EventEspresso\core\services\container;
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
 
@@ -17,84 +17,84 @@  discard block
 block discarded – undo
17 17
 interface RecipeInterface
18 18
 {
19 19
 
20
-    /**
21
-     * @return string
22
-     */
23
-    public function identifier();
24
-
25
-    /**
26
-     * @return string
27
-     */
28
-    public function fqcn();
29
-
30
-    /**
31
-     * @return array
32
-     */
33
-    public function ingredients();
34
-
35
-    /**
36
-     * @return string
37
-     */
38
-    public function type();
39
-
40
-    /**
41
-     * @return array
42
-     */
43
-    public function filters();
44
-
45
-    /**
46
-     * @return array
47
-     */
48
-    public function paths();
49
-
50
-    /**
51
-     * @param  string $identifier Identifier for the entity class that the Recipe applies to
52
-     *                            Typically a Fully Qualified Class Name
53
-     */
54
-    public function setIdentifier($identifier);
55
-
56
-    /**
57
-     * Ensures incoming string is a valid Fully Qualified Class Name,
58
-     * except if this is the default wildcard Recipe ( * ),
59
-     * or it's NOT an actual FQCN because the Recipe is using filepaths
60
-     * for classes that are not PSR-4 compatible
61
-     * PLZ NOTE:
62
-     *  Recipe::setFqcn() has a check to see if Recipe::$paths is empty or not,
63
-     *  therefore you should always call Recipe::setPaths() before Recipe::setFqcn()
64
-     *
65
-     * @param string $fqcn
66
-     */
67
-    public function setFqcn($fqcn);
68
-
69
-    /**
70
-     * @param array $ingredients    an array of dependencies where keys are the aliases and values are the FQCNs
71
-     *                              example:
72
-     *                              array( 'ClassInterface' => 'Fully\Qualified\ClassName' )
73
-     */
74
-    public function setIngredients(array $ingredients);
75
-
76
-    /**
77
-     * @param string $type one of the class constants returned from CoffeeMaker::getTypes()
78
-     */
79
-    public function setType($type = CoffeeMaker::BREW_NEW);
80
-
81
-    /**
82
-     * @param array $filters    an array of filters where keys are the aliases and values are the FQCNs
83
-     *                          example:
84
-     *                          array( 'ClassInterface' => 'Fully\Qualified\ClassName' )
85
-     */
86
-    public function setFilters(array $filters);
87
-
88
-    /**
89
-     * Ensures incoming paths is a valid filepath, or array of valid filepaths,
90
-     * and merges them in with any existing filepaths
91
-     * PLZ NOTE:
92
-     *  Recipe::setFqcn() has a check to see if Recipe::$paths is empty or not,
93
-     *  therefore you should always call Recipe::setPaths() before Recipe::setFqcn()
94
-     *
95
-     * @param string|array $paths
96
-     */
97
-    public function setPaths($paths = array());
20
+	/**
21
+	 * @return string
22
+	 */
23
+	public function identifier();
24
+
25
+	/**
26
+	 * @return string
27
+	 */
28
+	public function fqcn();
29
+
30
+	/**
31
+	 * @return array
32
+	 */
33
+	public function ingredients();
34
+
35
+	/**
36
+	 * @return string
37
+	 */
38
+	public function type();
39
+
40
+	/**
41
+	 * @return array
42
+	 */
43
+	public function filters();
44
+
45
+	/**
46
+	 * @return array
47
+	 */
48
+	public function paths();
49
+
50
+	/**
51
+	 * @param  string $identifier Identifier for the entity class that the Recipe applies to
52
+	 *                            Typically a Fully Qualified Class Name
53
+	 */
54
+	public function setIdentifier($identifier);
55
+
56
+	/**
57
+	 * Ensures incoming string is a valid Fully Qualified Class Name,
58
+	 * except if this is the default wildcard Recipe ( * ),
59
+	 * or it's NOT an actual FQCN because the Recipe is using filepaths
60
+	 * for classes that are not PSR-4 compatible
61
+	 * PLZ NOTE:
62
+	 *  Recipe::setFqcn() has a check to see if Recipe::$paths is empty or not,
63
+	 *  therefore you should always call Recipe::setPaths() before Recipe::setFqcn()
64
+	 *
65
+	 * @param string $fqcn
66
+	 */
67
+	public function setFqcn($fqcn);
68
+
69
+	/**
70
+	 * @param array $ingredients    an array of dependencies where keys are the aliases and values are the FQCNs
71
+	 *                              example:
72
+	 *                              array( 'ClassInterface' => 'Fully\Qualified\ClassName' )
73
+	 */
74
+	public function setIngredients(array $ingredients);
75
+
76
+	/**
77
+	 * @param string $type one of the class constants returned from CoffeeMaker::getTypes()
78
+	 */
79
+	public function setType($type = CoffeeMaker::BREW_NEW);
80
+
81
+	/**
82
+	 * @param array $filters    an array of filters where keys are the aliases and values are the FQCNs
83
+	 *                          example:
84
+	 *                          array( 'ClassInterface' => 'Fully\Qualified\ClassName' )
85
+	 */
86
+	public function setFilters(array $filters);
87
+
88
+	/**
89
+	 * Ensures incoming paths is a valid filepath, or array of valid filepaths,
90
+	 * and merges them in with any existing filepaths
91
+	 * PLZ NOTE:
92
+	 *  Recipe::setFqcn() has a check to see if Recipe::$paths is empty or not,
93
+	 *  therefore you should always call Recipe::setPaths() before Recipe::setFqcn()
94
+	 *
95
+	 * @param string|array $paths
96
+	 */
97
+	public function setPaths($paths = array());
98 98
 
99 99
 }
100 100
 // End of file RecipeInterface.php
Please login to merge, or discard this patch.
core/domain/services/capabilities/CapCheck.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -38,7 +38,7 @@
 block discarded – undo
38 38
 
39 39
 
40 40
     /**
41
-     * @param string|array $capability - the capability to be checked, like: 'ee_edit_registrations',
41
+     * @param string $capability - the capability to be checked, like: 'ee_edit_registrations',
42 42
      *                                   or an array of capability strings
43 43
      * @param string       $context    - what the user is attempting to do, like: 'Edit Registration'
44 44
      * @param int          $ID         - (optional) ID for item where current_user_can is being called from
Please login to merge, or discard this patch.
Indentation   +66 added lines, -66 removed lines patch added patch discarded remove patch
@@ -4,7 +4,7 @@  discard block
 block discarded – undo
4 4
 use EventEspresso\core\exceptions\InvalidDataTypeException;
5 5
 
6 6
 if ( ! defined('EVENT_ESPRESSO_VERSION')) {
7
-    exit('No direct script access allowed');
7
+	exit('No direct script access allowed');
8 8
 }
9 9
 
10 10
 
@@ -20,71 +20,71 @@  discard block
 block discarded – undo
20 20
 class CapCheck implements CapCheckInterface
21 21
 {
22 22
 
23
-    /**
24
-     * @var string|array $capability
25
-     */
26
-    private $capability;
27
-
28
-    /**
29
-     * @var string $context
30
-     */
31
-    private $context;
32
-
33
-    /**
34
-     * @var int|string $ID
35
-     */
36
-    private $ID;
37
-
38
-
39
-
40
-    /**
41
-     * @param string|array $capability - the capability to be checked, like: 'ee_edit_registrations',
42
-     *                                   or an array of capability strings
43
-     * @param string       $context    - what the user is attempting to do, like: 'Edit Registration'
44
-     * @param int          $ID         - (optional) ID for item where current_user_can is being called from
45
-     */
46
-    public function __construct($capability, $context, $ID = 0)
47
-    {
48
-        if ( ! is_string($capability)) {
49
-            throw new InvalidDataTypeException('$capability', $capability, 'string');
50
-        }
51
-        if ( ! is_string($context)) {
52
-            throw new InvalidDataTypeException('$context', $context, 'string');
53
-        }
54
-        $this->capability = $capability;
55
-        $this->context = strtolower(str_replace(' ', '_', $context));
56
-        $this->ID = $ID;
57
-    }
58
-
59
-
60
-
61
-    /**
62
-     * @return string|array
63
-     */
64
-    public function capability()
65
-    {
66
-        return $this->capability;
67
-    }
68
-
69
-
70
-
71
-    /**
72
-     * @return string
73
-     */
74
-    public function context()
75
-    {
76
-        return $this->context;
77
-    }
78
-
79
-
80
-
81
-    /**
82
-     * @return int|string
83
-     */
84
-    public function ID()
85
-    {
86
-        return $this->ID;
87
-    }
23
+	/**
24
+	 * @var string|array $capability
25
+	 */
26
+	private $capability;
27
+
28
+	/**
29
+	 * @var string $context
30
+	 */
31
+	private $context;
32
+
33
+	/**
34
+	 * @var int|string $ID
35
+	 */
36
+	private $ID;
37
+
38
+
39
+
40
+	/**
41
+	 * @param string|array $capability - the capability to be checked, like: 'ee_edit_registrations',
42
+	 *                                   or an array of capability strings
43
+	 * @param string       $context    - what the user is attempting to do, like: 'Edit Registration'
44
+	 * @param int          $ID         - (optional) ID for item where current_user_can is being called from
45
+	 */
46
+	public function __construct($capability, $context, $ID = 0)
47
+	{
48
+		if ( ! is_string($capability)) {
49
+			throw new InvalidDataTypeException('$capability', $capability, 'string');
50
+		}
51
+		if ( ! is_string($context)) {
52
+			throw new InvalidDataTypeException('$context', $context, 'string');
53
+		}
54
+		$this->capability = $capability;
55
+		$this->context = strtolower(str_replace(' ', '_', $context));
56
+		$this->ID = $ID;
57
+	}
58
+
59
+
60
+
61
+	/**
62
+	 * @return string|array
63
+	 */
64
+	public function capability()
65
+	{
66
+		return $this->capability;
67
+	}
68
+
69
+
70
+
71
+	/**
72
+	 * @return string
73
+	 */
74
+	public function context()
75
+	{
76
+		return $this->context;
77
+	}
78
+
79
+
80
+
81
+	/**
82
+	 * @return int|string
83
+	 */
84
+	public function ID()
85
+	{
86
+		return $this->ID;
87
+	}
88 88
 
89 89
 
90 90
 }
Please login to merge, or discard this patch.
core/EE_Network_Config.core.php 1 patch
Spacing   +32 added lines, -32 removed lines patch added patch discarded remove patch
@@ -58,7 +58,7 @@  discard block
 block discarded – undo
58 58
 	 */
59 59
 	public static function instance() {
60 60
 		// check if class object is instantiated, and instantiated properly
61
-		if ( self::$_instance === NULL  or ! is_object( self::$_instance ) or ! ( self::$_instance instanceof EE_Network_Config )) {
61
+		if (self::$_instance === NULL or ! is_object(self::$_instance) or ! (self::$_instance instanceof EE_Network_Config)) {
62 62
 			self::$_instance = new self();
63 63
 		}
64 64
 		return self::$_instance;
@@ -73,15 +73,15 @@  discard block
 block discarded – undo
73 73
 	 *  @access 	private
74 74
 	 */
75 75
 	private function __construct() {
76
-		do_action( 'AHEE__EE_Network_Config__construct__begin',$this );
76
+		do_action('AHEE__EE_Network_Config__construct__begin', $this);
77 77
 		//set defaults
78
-		$this->core = apply_filters( 'FHEE__EE_Network_Config___construct__core', new EE_Network_Core_Config() );
78
+		$this->core = apply_filters('FHEE__EE_Network_Config___construct__core', new EE_Network_Core_Config());
79 79
 		$this->addons = array();
80 80
 
81 81
 		$this->_load_config();
82 82
 
83 83
 		// construct__end hook
84
-		do_action( 'AHEE__EE_Network_Config__construct__end',$this );
84
+		do_action('AHEE__EE_Network_Config__construct__end', $this);
85 85
 	}
86 86
 
87 87
 
@@ -94,25 +94,25 @@  discard block
 block discarded – undo
94 94
 	 */
95 95
 	private function _load_config() {
96 96
 		//load network config start hook
97
-		do_action( 'AHEE__EE_Network_Config___load_config__start', $this );
97
+		do_action('AHEE__EE_Network_Config___load_config__start', $this);
98 98
 		$config = $this->get_config();
99
-		foreach ( $config as $config_prop => $settings ) {
100
-			if ( is_object( $settings ) && property_exists( $this, $config_prop ) ) {
101
-				$this->{$config_prop} = apply_filters( 'FHEE__EE_Network_Config___load_config__config_settings', $settings, $config_prop, $this );
102
-				if ( method_exists( $settings, 'populate' ) ) {
99
+		foreach ($config as $config_prop => $settings) {
100
+			if (is_object($settings) && property_exists($this, $config_prop)) {
101
+				$this->{$config_prop} = apply_filters('FHEE__EE_Network_Config___load_config__config_settings', $settings, $config_prop, $this);
102
+				if (method_exists($settings, 'populate')) {
103 103
 					$this->{$config_prop}->populate();
104 104
 				}
105
-				if ( method_exists( $settings, 'do_hooks' ) ) {
105
+				if (method_exists($settings, 'do_hooks')) {
106 106
 					$this->{$config_prop}->do_hooks();
107 107
 				}
108 108
 			}
109 109
 		}
110
-		if ( apply_filters( 'FHEE__EE_Network_Config___load_config__update_network_config', false ) ) {
110
+		if (apply_filters('FHEE__EE_Network_Config___load_config__update_network_config', false)) {
111 111
 			$this->update_config();
112 112
 		}
113 113
 
114 114
 		//load network config end hook
115
-		do_action( 'AHEE__EE_Network_Config___load_config__end', $this );
115
+		do_action('AHEE__EE_Network_Config___load_config__end', $this);
116 116
 	}
117 117
 
118 118
 
@@ -126,8 +126,8 @@  discard block
 block discarded – undo
126 126
 	 */
127 127
 	public function get_config() {
128 128
 		// grab network configuration
129
-		$CFG = get_site_option( 'ee_network_config', array() );
130
-		$CFG = apply_filters( 'FHEE__EE_Network_Config__get_config__CFG', $CFG );
129
+		$CFG = get_site_option('ee_network_config', array());
130
+		$CFG = apply_filters('FHEE__EE_Network_Config__get_config__CFG', $CFG);
131 131
 		return $CFG;
132 132
 	}
133 133
 
@@ -141,39 +141,39 @@  discard block
 block discarded – undo
141 141
 	 * @param bool $add_error
142 142
 	 * @return bool success
143 143
 	 */
144
-	public function update_config( $add_success = FALSE, $add_error = TRUE ) {
145
-		do_action( 'AHEE__EE_Network_Config__update_config__begin',$this );
144
+	public function update_config($add_success = FALSE, $add_error = TRUE) {
145
+		do_action('AHEE__EE_Network_Config__update_config__begin', $this);
146 146
 
147 147
 		//need to bust cache for comparing original if this is a multisite install
148
-		if ( is_multisite() ) {
148
+		if (is_multisite()) {
149 149
 			global $current_site;
150
-			$cache_key = $current_site->id . ':ee_network_config';
151
-			wp_cache_delete( $cache_key, 'site-options' );
150
+			$cache_key = $current_site->id.':ee_network_config';
151
+			wp_cache_delete($cache_key, 'site-options');
152 152
 		}
153 153
 
154 154
 		//we have to compare existing saved config with config in memory because if there is no difference that means
155 155
 		//that the method executed fine but there just was no update.  WordPress doesn't distinguish between false because
156 156
 		//there were 0 records updated because of no change vs false because some error produced problems with the update.
157
-		$original = get_site_option( 'ee_network_config' );
157
+		$original = get_site_option('ee_network_config');
158 158
 
159
-		if ( $original == $this ) {
159
+		if ($original == $this) {
160 160
 			return true;
161 161
 		}
162 162
 		// update
163
-		$saved = update_site_option( 'ee_network_config', $this );
163
+		$saved = update_site_option('ee_network_config', $this);
164 164
 
165
-		do_action( 'AHEE__EE_Network_Config__update_config__end', $this, $saved );
165
+		do_action('AHEE__EE_Network_Config__update_config__end', $this, $saved);
166 166
 		// if config remains the same or was updated successfully
167
-		if ( $saved ) {
168
-			if ( $add_success ) {
169
-				$msg = is_multisite() ? __( 'The Event Espresso Network Configuration Settings have been successfully updated.', 'event_espresso' ) : __( 'Extra Event Espresso Configuration settings were successfully updated.', 'event_espresso' );
170
-				EE_Error::add_success( $msg );
167
+		if ($saved) {
168
+			if ($add_success) {
169
+				$msg = is_multisite() ? __('The Event Espresso Network Configuration Settings have been successfully updated.', 'event_espresso') : __('Extra Event Espresso Configuration settings were successfully updated.', 'event_espresso');
170
+				EE_Error::add_success($msg);
171 171
 			}
172 172
 			return true;
173 173
 		} else {
174
-			if ( $add_error ) {
175
-				$msg = is_multisite() ? __( 'The Event Espresso Network Configuration Settings were not updated.', 'event_espresso' ) : __( 'Extra Event Espresso Network Configuration settings were not updated.', 'event_espresso' );
176
-				EE_Error::add_error( $msg , __FILE__, __FUNCTION__, __LINE__ );
174
+			if ($add_error) {
175
+				$msg = is_multisite() ? __('The Event Espresso Network Configuration Settings were not updated.', 'event_espresso') : __('Extra Event Espresso Network Configuration settings were not updated.', 'event_espresso');
176
+				EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
177 177
 			}
178 178
 			return false;
179 179
 		}
@@ -187,9 +187,9 @@  discard block
 block discarded – undo
187 187
 	 *  @return 	array
188 188
 	 */
189 189
 	public function __sleep() {
190
-		return apply_filters( 'FHEE__EE_Network_Config__sleep',array(
190
+		return apply_filters('FHEE__EE_Network_Config__sleep', array(
191 191
 			'core',
192
-		) );
192
+		));
193 193
 	}
194 194
 
195 195
 } //end EE_Network_Config.
Please login to merge, or discard this patch.
core/domain/services/capabilities/PublicCapabilities.php 1 patch
Indentation   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -20,13 +20,13 @@
 block discarded – undo
20 20
 {
21 21
 
22 22
 
23
-    /**
24
-     * @return string
25
-     */
26
-    public function capability()
27
-    {
28
-        return '';
29
-    }
23
+	/**
24
+	 * @return string
25
+	 */
26
+	public function capability()
27
+	{
28
+		return '';
29
+	}
30 30
 
31 31
 
32 32
 }
Please login to merge, or discard this patch.
core/domain/services/capabilities/CapCheckInterface.php 1 patch
Indentation   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -13,20 +13,20 @@
 block discarded – undo
13 13
 interface CapCheckInterface
14 14
 {
15 15
 
16
-    /**
17
-     * @return string
18
-     */
19
-    public function capability();
16
+	/**
17
+	 * @return string
18
+	 */
19
+	public function capability();
20 20
 
21
-    /**
22
-     * @return string
23
-     */
24
-    public function context();
21
+	/**
22
+	 * @return string
23
+	 */
24
+	public function context();
25 25
 
26
-    /**
27
-     * @return int|string
28
-     */
29
-    public function ID();
26
+	/**
27
+	 * @return int|string
28
+	 */
29
+	public function ID();
30 30
 
31 31
 }
32 32
 // End of file CapCheckInterface.php
Please login to merge, or discard this patch.
core/services/commands/registration/CreateRegistrationCommand.php 1 patch
Indentation   +137 added lines, -137 removed lines patch added patch discarded remove patch
@@ -8,7 +8,7 @@  discard block
 block discarded – undo
8 8
 use EventEspresso\core\services\commands\CommandRequiresCapCheckInterface;
9 9
 
10 10
 if ( ! defined('EVENT_ESPRESSO_VERSION')) {
11
-    exit('No direct script access allowed');
11
+	exit('No direct script access allowed');
12 12
 }
13 13
 
14 14
 
@@ -24,142 +24,142 @@  discard block
 block discarded – undo
24 24
 class CreateRegistrationCommand extends Command implements CommandRequiresCapCheckInterface
25 25
 {
26 26
 
27
-    /**
28
-     * @var \EE_Transaction $transaction
29
-     */
30
-    private $transaction;
31
-
32
-    /**
33
-     * @var \EE_Ticket $ticket
34
-     */
35
-    private $ticket;
36
-
37
-    /**
38
-     * @var \EE_Line_Item $ticket_line_item
39
-     */
40
-    private $ticket_line_item;
41
-
42
-    /**
43
-     * @var int $reg_count
44
-     */
45
-    private $reg_count = 1;
46
-
47
-    /**
48
-     * @var int $reg_group_size
49
-     */
50
-    private $reg_group_size = 0;
51
-
52
-    /**
53
-     * @var \EE_Registration $registration
54
-     */
55
-    protected $registration;
56
-
57
-
58
-
59
-    /**
60
-     * CreateRegistrationCommand constructor.
61
-     *
62
-     * @param \EE_Transaction $transaction
63
-     * @param \EE_Line_Item   $ticket_line_item
64
-     * @param int             $reg_count
65
-     * @param int             $reg_group_size
66
-     */
67
-    public function __construct(
68
-        \EE_Transaction $transaction,
69
-        \EE_Line_Item $ticket_line_item,
70
-        $reg_count = 1,
71
-        $reg_group_size = 0
72
-    ) {
73
-        // grab the related ticket object for this line_item
74
-        $this->ticket = $ticket_line_item->ticket();
75
-        if ( ! $this->ticket instanceof \EE_Ticket) {
76
-            throw new InvalidEntityException(
77
-                is_object($this->ticket) ? get_class($this->ticket) : gettype($this->ticket),
78
-                'EE_Ticket',
79
-                sprintf(
80
-                    __("Line item %s did not contain a valid ticket", "event_espresso"),
81
-                    $ticket_line_item->ID()
82
-                )
83
-            );
84
-        }
85
-        $this->transaction = $transaction;
86
-        $this->ticket_line_item = $ticket_line_item;
87
-        $this->reg_count = absint($reg_count);
88
-        $this->reg_group_size = absint($reg_group_size);
89
-    }
90
-
91
-
92
-
93
-    /**
94
-     * @return \EventEspresso\core\domain\services\capabilities\CapCheckInterface
95
-     */
96
-    public function getCapCheck()
97
-    {
98
-        if ( ! $this->cap_check instanceof CapCheckInterface) {
99
-            return new CapCheck('ee_edit_registrations', 'create_new_registration');
100
-        }
101
-        return $this->cap_check;
102
-    }
103
-
104
-
105
-
106
-    /**
107
-     * @return \EE_Transaction
108
-     */
109
-    public function transaction()
110
-    {
111
-        return $this->transaction;
112
-    }
113
-
114
-
115
-
116
-    /**
117
-     * @return \EE_Ticket
118
-     */
119
-    public function ticket()
120
-    {
121
-        return $this->ticket;
122
-    }
123
-
124
-
125
-
126
-    /**
127
-     * @return \EE_Line_Item
128
-     */
129
-    public function ticketLineItem()
130
-    {
131
-        return $this->ticket_line_item;
132
-    }
133
-
134
-
135
-
136
-    /**
137
-     * @return int
138
-     */
139
-    public function regCount()
140
-    {
141
-        return $this->reg_count;
142
-    }
143
-
144
-
145
-
146
-    /**
147
-     * @return int
148
-     */
149
-    public function regGroupSize()
150
-    {
151
-        return $this->reg_group_size;
152
-    }
153
-
154
-
155
-
156
-    /**
157
-     * @return \EE_Registration
158
-     */
159
-    public function registration()
160
-    {
161
-        return $this->registration;
162
-    }
27
+	/**
28
+	 * @var \EE_Transaction $transaction
29
+	 */
30
+	private $transaction;
31
+
32
+	/**
33
+	 * @var \EE_Ticket $ticket
34
+	 */
35
+	private $ticket;
36
+
37
+	/**
38
+	 * @var \EE_Line_Item $ticket_line_item
39
+	 */
40
+	private $ticket_line_item;
41
+
42
+	/**
43
+	 * @var int $reg_count
44
+	 */
45
+	private $reg_count = 1;
46
+
47
+	/**
48
+	 * @var int $reg_group_size
49
+	 */
50
+	private $reg_group_size = 0;
51
+
52
+	/**
53
+	 * @var \EE_Registration $registration
54
+	 */
55
+	protected $registration;
56
+
57
+
58
+
59
+	/**
60
+	 * CreateRegistrationCommand constructor.
61
+	 *
62
+	 * @param \EE_Transaction $transaction
63
+	 * @param \EE_Line_Item   $ticket_line_item
64
+	 * @param int             $reg_count
65
+	 * @param int             $reg_group_size
66
+	 */
67
+	public function __construct(
68
+		\EE_Transaction $transaction,
69
+		\EE_Line_Item $ticket_line_item,
70
+		$reg_count = 1,
71
+		$reg_group_size = 0
72
+	) {
73
+		// grab the related ticket object for this line_item
74
+		$this->ticket = $ticket_line_item->ticket();
75
+		if ( ! $this->ticket instanceof \EE_Ticket) {
76
+			throw new InvalidEntityException(
77
+				is_object($this->ticket) ? get_class($this->ticket) : gettype($this->ticket),
78
+				'EE_Ticket',
79
+				sprintf(
80
+					__("Line item %s did not contain a valid ticket", "event_espresso"),
81
+					$ticket_line_item->ID()
82
+				)
83
+			);
84
+		}
85
+		$this->transaction = $transaction;
86
+		$this->ticket_line_item = $ticket_line_item;
87
+		$this->reg_count = absint($reg_count);
88
+		$this->reg_group_size = absint($reg_group_size);
89
+	}
90
+
91
+
92
+
93
+	/**
94
+	 * @return \EventEspresso\core\domain\services\capabilities\CapCheckInterface
95
+	 */
96
+	public function getCapCheck()
97
+	{
98
+		if ( ! $this->cap_check instanceof CapCheckInterface) {
99
+			return new CapCheck('ee_edit_registrations', 'create_new_registration');
100
+		}
101
+		return $this->cap_check;
102
+	}
103
+
104
+
105
+
106
+	/**
107
+	 * @return \EE_Transaction
108
+	 */
109
+	public function transaction()
110
+	{
111
+		return $this->transaction;
112
+	}
113
+
114
+
115
+
116
+	/**
117
+	 * @return \EE_Ticket
118
+	 */
119
+	public function ticket()
120
+	{
121
+		return $this->ticket;
122
+	}
123
+
124
+
125
+
126
+	/**
127
+	 * @return \EE_Line_Item
128
+	 */
129
+	public function ticketLineItem()
130
+	{
131
+		return $this->ticket_line_item;
132
+	}
133
+
134
+
135
+
136
+	/**
137
+	 * @return int
138
+	 */
139
+	public function regCount()
140
+	{
141
+		return $this->reg_count;
142
+	}
143
+
144
+
145
+
146
+	/**
147
+	 * @return int
148
+	 */
149
+	public function regGroupSize()
150
+	{
151
+		return $this->reg_group_size;
152
+	}
153
+
154
+
155
+
156
+	/**
157
+	 * @return \EE_Registration
158
+	 */
159
+	public function registration()
160
+	{
161
+		return $this->registration;
162
+	}
163 163
 
164 164
 
165 165
 
Please login to merge, or discard this patch.
modules/ticket_selector/EED_Ticket_Selector.module.php 3 patches
Doc Comments   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -486,7 +486,7 @@  discard block
 block discarded – undo
486 486
 	 * 	process_ticket_selections
487 487
 	 *
488 488
 	 *	@access public
489
-	 * 	@return array|boolean
489
+	 * 	@return boolean|null
490 490
 	 */
491 491
 	public function process_ticket_selections() {
492 492
         do_action( 'EED_Ticket_Selector__process_ticket_selections__before' );
@@ -631,7 +631,7 @@  discard block
 block discarded – undo
631 631
 	 *    validate_post_data
632 632
 	 *
633 633
 	 * @access        private
634
-	 * @return        array  or FALSE
634
+	 * @return        string  or FALSE
635 635
 	 */
636 636
 	private static function _validate_post_data() {
637 637
 		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
@@ -748,7 +748,7 @@  discard block
 block discarded – undo
748 748
 	 * @access   private
749 749
 	 * @param EE_Ticket $ticket
750 750
 	 * @param int       $qty
751
-	 * @return TRUE on success, FALSE on fail
751
+	 * @return boolean on success, FALSE on fail
752 752
 	 */
753 753
 	private static function _add_ticket_to_cart( EE_Ticket $ticket = NULL, $qty = 1 ) {
754 754
 		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
Please login to merge, or discard this patch.
Indentation   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -35,11 +35,11 @@  discard block
 block discarded – undo
35 35
 	protected static $_event = NULL;
36 36
 
37 37
 	/**
38
-	* array of datetimes and the spaces available for them
39
-	*
40
-	* @access private
41
-	* @var array
42
-	*/
38
+	 * array of datetimes and the spaces available for them
39
+	 *
40
+	 * @access private
41
+	 * @var array
42
+	 */
43 43
 	private static $_available_spaces = array();
44 44
 
45 45
 
@@ -208,8 +208,8 @@  discard block
 block discarded – undo
208 208
 				return $permalink_string;
209 209
 			}
210 210
 			$permalink_string .= '<a id="js-ticket-selector-embed-trigger" class="button button-small" href="#"  tabindex="-1">'
211
-			                     . __( 'Embed', 'event_espresso' )
212
-			                     . '</a> ';
211
+								 . __( 'Embed', 'event_espresso' )
212
+								 . '</a> ';
213 213
 			$ticket_selector_url = add_query_arg( array( 'ticket_selector' => 'iframe', 'event' => $id ), site_url() );
214 214
 			$iframe_string = esc_html(
215 215
 				'<iframe src="' . $ticket_selector_url . '" width="100%" height="100%"></iframe>'
@@ -489,7 +489,7 @@  discard block
 block discarded – undo
489 489
 	 * 	@return array|boolean
490 490
 	 */
491 491
 	public function process_ticket_selections() {
492
-        do_action( 'EED_Ticket_Selector__process_ticket_selections__before' );
492
+		do_action( 'EED_Ticket_Selector__process_ticket_selections__before' );
493 493
 		// check nonce
494 494
 		if ( ! is_admin() && ( ! EE_Registry::instance()->REQ->is_set( 'process_ticket_selections_nonce' ) || ! wp_verify_nonce( EE_Registry::instance()->REQ->get( 'process_ticket_selections_nonce' ), 'process_ticket_selections' ))) {
495 495
 			EE_Error::add_error(
@@ -883,11 +883,11 @@  discard block
 block discarded – undo
883 883
 
884 884
 
885 885
 	/**
886
-	* 	load js
887
-	*
888
-	* 	@access 		public
889
-	* 	@return 		void
890
-	*/
886
+	 * 	load js
887
+	 *
888
+	 * 	@access 		public
889
+	 * 	@return 		void
890
+	 */
891 891
 	public static function load_tckt_slctr_assets() {
892 892
 		// add some style
893 893
 		if ( apply_filters( 'FHEE__EED_Ticket_Selector__load_tckt_slctr_assets', FALSE ) ) {
Please login to merge, or discard this patch.
Spacing   +207 added lines, -207 removed lines patch added patch discarded remove patch
@@ -57,15 +57,15 @@  discard block
 block discarded – undo
57 57
 	 * @return EED_Ticket_Selector
58 58
 	 */
59 59
 	public static function instance() {
60
-		return parent::get_instance( __CLASS__ );
60
+		return parent::get_instance(__CLASS__);
61 61
 	}
62 62
 
63 63
 
64 64
 
65
-	protected function set_config(){
66
-		$this->set_config_section( 'template_settings' );
67
-		$this->set_config_class( 'EE_Ticket_Selector_Config' );
68
-		$this->set_config_name( 'EED_Ticket_Selector' );
65
+	protected function set_config() {
66
+		$this->set_config_section('template_settings');
67
+		$this->set_config_class('EE_Ticket_Selector_Config');
68
+		$this->set_config_name('EED_Ticket_Selector');
69 69
 	}
70 70
 
71 71
 
@@ -80,14 +80,14 @@  discard block
 block discarded – undo
80 80
 	 */
81 81
 	public static function set_hooks() {
82 82
 		// routing
83
-		EE_Config::register_route( 'iframe', 'EED_Ticket_Selector', 'ticket_selector_iframe', 'ticket_selector' );
84
-		EE_Config::register_route( 'process_ticket_selections', 'EED_Ticket_Selector', 'process_ticket_selections' );
85
-		add_action( 'wp_loaded', array( 'EED_Ticket_Selector', 'set_definitions' ), 2 );
83
+		EE_Config::register_route('iframe', 'EED_Ticket_Selector', 'ticket_selector_iframe', 'ticket_selector');
84
+		EE_Config::register_route('process_ticket_selections', 'EED_Ticket_Selector', 'process_ticket_selections');
85
+		add_action('wp_loaded', array('EED_Ticket_Selector', 'set_definitions'), 2);
86 86
 		//add_action( 'AHEE_event_details_before_post', array( 'EED_Ticket_Selector', 'ticket_selector_form_open' ), 10, 1 );
87
-		add_action( 'AHEE_event_details_header_bottom', array( 'EED_Ticket_Selector', 'display_ticket_selector' ), 10, 1 );
87
+		add_action('AHEE_event_details_header_bottom', array('EED_Ticket_Selector', 'display_ticket_selector'), 10, 1);
88 88
 		//add_action( 'AHEE__ticket_selector_chart__template__after_ticket_selector', array( 'EED_Ticket_Selector', 'display_ticket_selector_submit' ), 10, 1 );
89 89
 		//add_action( 'AHEE_event_details_after_post', array( 'EED_Ticket_Selector', 'ticket_selector_form_close' ), 10 );
90
-		add_action( 'wp_enqueue_scripts', array( 'EED_Ticket_Selector', 'load_tckt_slctr_assets' ), 10 );
90
+		add_action('wp_enqueue_scripts', array('EED_Ticket_Selector', 'load_tckt_slctr_assets'), 10);
91 91
 	}
92 92
 
93 93
 
@@ -99,10 +99,10 @@  discard block
 block discarded – undo
99 99
 	 *  @return 	void
100 100
 	 */
101 101
 	public static function set_hooks_admin() {
102
-		add_action( 'wp_loaded', array( 'EED_Ticket_Selector', 'set_definitions' ), 2 );
102
+		add_action('wp_loaded', array('EED_Ticket_Selector', 'set_definitions'), 2);
103 103
 		//add button for iframe code to event editor.
104
-		add_filter( 'get_sample_permalink_html', array( 'EED_Ticket_Selector', 'iframe_code_button' ), 10, 4 );
105
-		add_action( 'admin_enqueue_scripts', array( 'EED_Ticket_Selector', 'load_tckt_slctr_assets_admin' ), 10 );
104
+		add_filter('get_sample_permalink_html', array('EED_Ticket_Selector', 'iframe_code_button'), 10, 4);
105
+		add_action('admin_enqueue_scripts', array('EED_Ticket_Selector', 'load_tckt_slctr_assets_admin'), 10);
106 106
 	}
107 107
 
108 108
 
@@ -114,15 +114,15 @@  discard block
 block discarded – undo
114 114
 	 *  @return 	void
115 115
 	 */
116 116
 	public static function set_definitions() {
117
-		define( 'TICKET_SELECTOR_ASSETS_URL', plugin_dir_url( __FILE__ ) . 'assets' . DS );
118
-		define( 'TICKET_SELECTOR_TEMPLATES_PATH', str_replace( '\\', DS, plugin_dir_path( __FILE__ )) . 'templates' . DS );
117
+		define('TICKET_SELECTOR_ASSETS_URL', plugin_dir_url(__FILE__).'assets'.DS);
118
+		define('TICKET_SELECTOR_TEMPLATES_PATH', str_replace('\\', DS, plugin_dir_path(__FILE__)).'templates'.DS);
119 119
 
120 120
 		//if config is not set, initialize
121 121
 		//If config is not set, set it.
122
-		if ( ! isset( EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector ) ) {
122
+		if ( ! isset(EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector)) {
123 123
 			EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector = new EE_Ticket_Selector_Config();
124 124
 		}
125
-		EE_Registry::$i18n_js_strings[ 'ts_embed_iframe_title' ] = __( 'Copy and Paste the following:', 'event_espresso' );
125
+		EE_Registry::$i18n_js_strings['ts_embed_iframe_title'] = __('Copy and Paste the following:', 'event_espresso');
126 126
 	}
127 127
 
128 128
 
@@ -133,7 +133,7 @@  discard block
 block discarded – undo
133 133
 	 * 	@param	object 			$WP
134 134
 	 * 	@return 	void
135 135
 	 */
136
-	public function run( $WP ) {}
136
+	public function run($WP) {}
137 137
 
138 138
 
139 139
 	/**
@@ -145,23 +145,23 @@  discard block
 block discarded – undo
145 145
 	public function ticket_selector_iframe() {
146 146
 		self::$_in_iframe = true;
147 147
 		/** @type EEM_Event $EEM_Event */
148
-		$EEM_Event = EE_Registry::instance()->load_model( 'Event' );
148
+		$EEM_Event = EE_Registry::instance()->load_model('Event');
149 149
 		$event = $EEM_Event->get_one_by_ID(
150
-			EE_Registry::instance()->REQ->get( 'event', 0 )
150
+			EE_Registry::instance()->REQ->get('event', 0)
151 151
 		);
152
-		EE_Registry::instance()->REQ->set_espresso_page( true );
153
-		$template_args['ticket_selector'] = EED_Ticket_Selector::display_ticket_selector( $event );
152
+		EE_Registry::instance()->REQ->set_espresso_page(true);
153
+		$template_args['ticket_selector'] = EED_Ticket_Selector::display_ticket_selector($event);
154 154
 		$template_args['css'] = apply_filters(
155 155
 			'FHEE__EED_Ticket_Selector__ticket_selector_iframe__css',
156 156
 			array(
157
-				TICKET_SELECTOR_ASSETS_URL . 'ticket_selector_embed.css?ver=' . EVENT_ESPRESSO_VERSION,
158
-				TICKET_SELECTOR_ASSETS_URL . 'ticket_selector.css?ver=' . EVENT_ESPRESSO_VERSION,
159
-				includes_url( 'css/dashicons.min.css?ver=' . $GLOBALS['wp_version'] ),
160
-				EE_GLOBAL_ASSETS_URL . 'css/espresso_default.css?ver=' . EVENT_ESPRESSO_VERSION
157
+				TICKET_SELECTOR_ASSETS_URL.'ticket_selector_embed.css?ver='.EVENT_ESPRESSO_VERSION,
158
+				TICKET_SELECTOR_ASSETS_URL.'ticket_selector.css?ver='.EVENT_ESPRESSO_VERSION,
159
+				includes_url('css/dashicons.min.css?ver='.$GLOBALS['wp_version']),
160
+				EE_GLOBAL_ASSETS_URL.'css/espresso_default.css?ver='.EVENT_ESPRESSO_VERSION
161 161
 			)
162 162
 		);
163
-		EE_Registry::$i18n_js_strings[ 'ticket_selector_iframe' ] = true;
164
-		EE_Registry::$i18n_js_strings[ 'EEDTicketSelectorMsg' ] = __( 'Please choose at least one ticket before continuing.', 'event_espresso' );
163
+		EE_Registry::$i18n_js_strings['ticket_selector_iframe'] = true;
164
+		EE_Registry::$i18n_js_strings['EEDTicketSelectorMsg'] = __('Please choose at least one ticket before continuing.', 'event_espresso');
165 165
 		$template_args['eei18n'] = apply_filters(
166 166
 			'FHEE__EED_Ticket_Selector__ticket_selector_iframe__eei18n_js_strings',
167 167
 			EE_Registry::localize_i18n_js_strings()
@@ -169,18 +169,18 @@  discard block
 block discarded – undo
169 169
 		$template_args['js'] = apply_filters(
170 170
 			'FHEE__EED_Ticket_Selector__ticket_selector_iframe__js',
171 171
 			array(
172
-				includes_url( 'js/jquery/jquery.js?ver=' . $GLOBALS['wp_version'] ),
173
-				EE_GLOBAL_ASSETS_URL . 'scripts/espresso_core.js?ver=' . EVENT_ESPRESSO_VERSION,
174
-				TICKET_SELECTOR_ASSETS_URL . 'ticket_selector_iframe_embed.js?ver=' . EVENT_ESPRESSO_VERSION
172
+				includes_url('js/jquery/jquery.js?ver='.$GLOBALS['wp_version']),
173
+				EE_GLOBAL_ASSETS_URL.'scripts/espresso_core.js?ver='.EVENT_ESPRESSO_VERSION,
174
+				TICKET_SELECTOR_ASSETS_URL.'ticket_selector_iframe_embed.js?ver='.EVENT_ESPRESSO_VERSION
175 175
 			)
176 176
 		);
177
-		$template_args[ 'notices' ] = EEH_Template::display_template(
178
-			EE_TEMPLATES . 'espresso-ajax-notices.template.php',
177
+		$template_args['notices'] = EEH_Template::display_template(
178
+			EE_TEMPLATES.'espresso-ajax-notices.template.php',
179 179
 			array(),
180 180
 			true
181 181
 		);
182 182
 		EEH_Template::display_template(
183
-			TICKET_SELECTOR_TEMPLATES_PATH . 'ticket_selector_chart_iframe.template.php',
183
+			TICKET_SELECTOR_TEMPLATES_PATH.'ticket_selector_chart_iframe.template.php',
184 184
 			$template_args
185 185
 		);
186 186
 		exit;
@@ -199,25 +199,25 @@  discard block
 block discarded – undo
199 199
 	 *
200 200
 	 * @return string The new html string for the permalink area.
201 201
 	 */
202
-	public static function iframe_code_button( $permalink_string, $id, $new_title, $new_slug ) {
202
+	public static function iframe_code_button($permalink_string, $id, $new_title, $new_slug) {
203 203
 		//make sure this is ONLY when editing and the event id has been set.
204
-		if ( ! empty( $id ) ) {
205
-			$post = get_post( $id );
204
+		if ( ! empty($id)) {
205
+			$post = get_post($id);
206 206
 			//if NOT event then let's get out.
207
-			if ( $post->post_type !== 'espresso_events' ) {
207
+			if ($post->post_type !== 'espresso_events') {
208 208
 				return $permalink_string;
209 209
 			}
210 210
 			$permalink_string .= '<a id="js-ticket-selector-embed-trigger" class="button button-small" href="#"  tabindex="-1">'
211
-			                     . __( 'Embed', 'event_espresso' )
211
+			                     . __('Embed', 'event_espresso')
212 212
 			                     . '</a> ';
213
-			$ticket_selector_url = add_query_arg( array( 'ticket_selector' => 'iframe', 'event' => $id ), site_url() );
213
+			$ticket_selector_url = add_query_arg(array('ticket_selector' => 'iframe', 'event' => $id), site_url());
214 214
 			$iframe_string = esc_html(
215
-				'<iframe src="' . $ticket_selector_url . '" width="100%" height="100%"></iframe>'
215
+				'<iframe src="'.$ticket_selector_url.'" width="100%" height="100%"></iframe>'
216 216
 			);
217 217
 			$permalink_string .= '
218 218
 <div id="js-ts-iframe" style="display:none">
219 219
 	<div style="width:100%; height: 500px;">
220
-		' . $iframe_string . '
220
+		' . $iframe_string.'
221 221
 	</div>
222 222
 </div>';
223 223
 		}
@@ -236,22 +236,22 @@  discard block
 block discarded – undo
236 236
 	 * @param 	mixed $event
237 237
 	 * @return 	bool
238 238
 	 */
239
-	protected static function set_event( $event = null ) {
240
-		if( $event === null ) {
239
+	protected static function set_event($event = null) {
240
+		if ($event === null) {
241 241
 			global $post;
242 242
 			$event = $post;
243 243
 		}
244
-		if ( $event instanceof EE_Event ) {
244
+		if ($event instanceof EE_Event) {
245 245
 			self::$_event = $event;
246
-		} else if ( $event instanceof WP_Post && isset( $event->EE_Event ) && $event->EE_Event instanceof EE_Event ) {
246
+		} else if ($event instanceof WP_Post && isset($event->EE_Event) && $event->EE_Event instanceof EE_Event) {
247 247
 			self::$_event = $event->EE_Event;
248
-		} else if ( $event instanceof WP_Post && $event->post_type == 'espresso_events' ) {
249
-			$event->EE_Event = EEM_Event::instance()->instantiate_class_from_post_object( $event );
248
+		} else if ($event instanceof WP_Post && $event->post_type == 'espresso_events') {
249
+			$event->EE_Event = EEM_Event::instance()->instantiate_class_from_post_object($event);
250 250
 			self::$_event = $event->EE_Event;
251 251
 		} else {
252
-			$user_msg = __( 'No Event object or an invalid Event object was supplied.', 'event_espresso' );
253
-			$dev_msg = $user_msg . __( 'In order to generate a ticket selector, please ensure you are passing either an EE_Event object or a WP_Post object of the post type "espresso_event" to the EE_Ticket_Selector class constructor.', 'event_espresso' );
254
-			EE_Error::add_error( $user_msg . '||' . $dev_msg, __FILE__, __FUNCTION__, __LINE__ );
252
+			$user_msg = __('No Event object or an invalid Event object was supplied.', 'event_espresso');
253
+			$dev_msg = $user_msg.__('In order to generate a ticket selector, please ensure you are passing either an EE_Event object or a WP_Post object of the post type "espresso_event" to the EE_Ticket_Selector class constructor.', 'event_espresso');
254
+			EE_Error::add_error($user_msg.'||'.$dev_msg, __FILE__, __FUNCTION__, __LINE__);
255 255
 			return false;
256 256
 		}
257 257
 		return true;
@@ -270,11 +270,11 @@  discard block
 block discarded – undo
270 270
 	 * @param 	bool 	$view_details
271 271
 	 * @return 	string
272 272
 	 */
273
-	public static function display_ticket_selector( $event = NULL, $view_details = FALSE ) {
273
+	public static function display_ticket_selector($event = NULL, $view_details = FALSE) {
274 274
 		// reset filter for displaying submit button
275
-		remove_filter( 'FHEE__EE_Ticket_Selector__display_ticket_selector_submit', '__return_true' );
275
+		remove_filter('FHEE__EE_Ticket_Selector__display_ticket_selector_submit', '__return_true');
276 276
 		// poke and prod incoming event till it tells us what it is
277
-		if ( ! EED_Ticket_Selector::set_event( $event )) {
277
+		if ( ! EED_Ticket_Selector::set_event($event)) {
278 278
 			return false;
279 279
 		}
280 280
 		$event_post = self::$_event instanceof EE_Event ? self::$_event->ID() : $event;
@@ -285,7 +285,7 @@  discard block
 block discarded – undo
285 285
 			&& (
286 286
 				! self::$_event->display_ticket_selector()
287 287
 				|| $view_details
288
-				|| post_password_required( $event_post )
288
+				|| post_password_required($event_post)
289 289
 				|| (
290 290
 					$_event_active_status != EE_Datetime::active
291 291
 					&& $_event_active_status != EE_Datetime::upcoming
@@ -303,68 +303,68 @@  discard block
 block discarded – undo
303 303
 		$template_args = array();
304 304
 		$template_args['event_status'] = $_event_active_status;
305 305
 
306
-		$template_args['date_format'] = apply_filters( 'FHEE__EED_Ticket_Selector__display_ticket_selector__date_format', get_option( 'date_format' ) );
307
-		$template_args['time_format'] = apply_filters( 'FHEE__EED_Ticket_Selector__display_ticket_selector__time_format', get_option( 'time_format' ) );
306
+		$template_args['date_format'] = apply_filters('FHEE__EED_Ticket_Selector__display_ticket_selector__date_format', get_option('date_format'));
307
+		$template_args['time_format'] = apply_filters('FHEE__EED_Ticket_Selector__display_ticket_selector__time_format', get_option('time_format'));
308 308
 
309 309
 		$template_args['EVT_ID'] = self::$_event->ID();
310 310
 		$template_args['event'] = self::$_event;
311 311
 
312 312
 		// is the event expired ?
313 313
 		$template_args['event_is_expired'] = self::$_event->is_expired();
314
-		if ( $template_args['event_is_expired'] ) {
315
-			return '<div class="ee-event-expired-notice"><span class="important-notice">' . __( 'We\'re sorry, but all tickets sales have ended because the event is expired.', 'event_espresso' ) . '</span></div>';
314
+		if ($template_args['event_is_expired']) {
315
+			return '<div class="ee-event-expired-notice"><span class="important-notice">'.__('We\'re sorry, but all tickets sales have ended because the event is expired.', 'event_espresso').'</span></div>';
316 316
 		}
317 317
 
318 318
 		$ticket_query_args = array(
319
-			array( 'Datetime.EVT_ID' => self::$_event->ID() ),
320
-			'order_by' => array( 'TKT_order' => 'ASC', 'TKT_required' => 'DESC', 'TKT_start_date' => 'ASC', 'TKT_end_date' => 'ASC' , 'Datetime.DTT_EVT_start' => 'DESC' )
319
+			array('Datetime.EVT_ID' => self::$_event->ID()),
320
+			'order_by' => array('TKT_order' => 'ASC', 'TKT_required' => 'DESC', 'TKT_start_date' => 'ASC', 'TKT_end_date' => 'ASC', 'Datetime.DTT_EVT_start' => 'DESC')
321 321
 		);
322 322
 
323
-		if ( ! EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector->show_expired_tickets ) {
323
+		if ( ! EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector->show_expired_tickets) {
324 324
 			//use the correct applicable time query depending on what version of core is being run.
325
-			$current_time = method_exists( 'EEM_Datetime', 'current_time_for_query' ) ? time() : current_time('timestamp');
326
-			$ticket_query_args[0]['TKT_end_date'] = array( '>', $current_time );
325
+			$current_time = method_exists('EEM_Datetime', 'current_time_for_query') ? time() : current_time('timestamp');
326
+			$ticket_query_args[0]['TKT_end_date'] = array('>', $current_time);
327 327
 		}
328 328
 
329 329
 		// get all tickets for this event ordered by the datetime
330
-		$template_args['tickets'] = EEM_Ticket::instance()->get_all( $ticket_query_args );
330
+		$template_args['tickets'] = EEM_Ticket::instance()->get_all($ticket_query_args);
331 331
 
332
-		if ( count( $template_args['tickets'] ) < 1 ) {
333
-			return '<div class="ee-event-expired-notice"><span class="important-notice">' . __( 'We\'re sorry, but all ticket sales have ended.', 'event_espresso' ) . '</span></div>';
332
+		if (count($template_args['tickets']) < 1) {
333
+			return '<div class="ee-event-expired-notice"><span class="important-notice">'.__('We\'re sorry, but all ticket sales have ended.', 'event_espresso').'</span></div>';
334 334
 		}
335 335
 
336 336
 		// filter the maximum qty that can appear in the Ticket Selector qty dropdowns
337
-		$template_args['max_atndz'] = apply_filters('FHEE__EE_Ticket_Selector__display_ticket_selector__max_tickets', self::$_event->additional_limit() );
338
-		if ( $template_args['max_atndz'] < 1 ) {
339
-			$sales_closed_msg = __( 'We\'re sorry, but ticket sales have been closed at this time. Please check back again later.', 'event_espresso' );
340
-			if ( current_user_can( 'edit_post', self::$_event->ID() )) {
341
-				$sales_closed_msg .=  sprintf(
342
-					__( '%sNote to Event Admin:%sThe "Maximum number of tickets allowed per order for this event" in the Event Registration Options has been set to "0". This effectively turns off ticket sales. %s(click to edit this event)%s', 'event_espresso' ),
337
+		$template_args['max_atndz'] = apply_filters('FHEE__EE_Ticket_Selector__display_ticket_selector__max_tickets', self::$_event->additional_limit());
338
+		if ($template_args['max_atndz'] < 1) {
339
+			$sales_closed_msg = __('We\'re sorry, but ticket sales have been closed at this time. Please check back again later.', 'event_espresso');
340
+			if (current_user_can('edit_post', self::$_event->ID())) {
341
+				$sales_closed_msg .= sprintf(
342
+					__('%sNote to Event Admin:%sThe "Maximum number of tickets allowed per order for this event" in the Event Registration Options has been set to "0". This effectively turns off ticket sales. %s(click to edit this event)%s', 'event_espresso'),
343 343
 					'<div class="ee-attention" style="text-align: left;"><b>',
344 344
 					'</b><br />',
345
-					$link = '<span class="edit-link"><a class="post-edit-link" href="' . get_edit_post_link( self::$_event->ID() ) . '">',
345
+					$link = '<span class="edit-link"><a class="post-edit-link" href="'.get_edit_post_link(self::$_event->ID()).'">',
346 346
 					'</a></span></div>'
347 347
 				);
348 348
 			}
349
-			return '<p><span class="important-notice">' . $sales_closed_msg . '</span></p>';
349
+			return '<p><span class="important-notice">'.$sales_closed_msg.'</span></p>';
350 350
 		}
351 351
 
352
-		$templates['ticket_selector'] = TICKET_SELECTOR_TEMPLATES_PATH . 'ticket_selector_chart.template.php';
353
-		$templates['ticket_selector'] = apply_filters( 'FHEE__EE_Ticket_Selector__display_ticket_selector__template_path', $templates['ticket_selector'], self::$_event );
352
+		$templates['ticket_selector'] = TICKET_SELECTOR_TEMPLATES_PATH.'ticket_selector_chart.template.php';
353
+		$templates['ticket_selector'] = apply_filters('FHEE__EE_Ticket_Selector__display_ticket_selector__template_path', $templates['ticket_selector'], self::$_event);
354 354
 
355 355
 		// redirecting to another site for registration ??
356 356
 		$external_url = self::$_event->external_url() !== NULL || self::$_event->external_url() !== '' ? self::$_event->external_url() : FALSE;
357 357
 		// set up the form (but not for the admin)
358
-		$ticket_selector = ! is_admin() ? EED_Ticket_Selector::ticket_selector_form_open( self::$_event->ID(), $external_url ) : '';
358
+		$ticket_selector = ! is_admin() ? EED_Ticket_Selector::ticket_selector_form_open(self::$_event->ID(), $external_url) : '';
359 359
 		// if not redirecting to another site for registration
360
-		if ( ! $external_url ) {
360
+		if ( ! $external_url) {
361 361
 			// then display the ticket selector
362
-			$ticket_selector .= EEH_Template::locate_template( $templates['ticket_selector'], $template_args );
362
+			$ticket_selector .= EEH_Template::locate_template($templates['ticket_selector'], $template_args);
363 363
 		} else {
364 364
 			// if not we still need to trigger the display of the submit button
365
-			add_filter( 'FHEE__EE_Ticket_Selector__display_ticket_selector_submit', '__return_true' );
365
+			add_filter('FHEE__EE_Ticket_Selector__display_ticket_selector_submit', '__return_true');
366 366
 			//display notice to admin that registration is external
367
-			$ticket_selector .= ! is_admin() ? '' : __( 'Registration is at an external URL for this event.', 'event_espresso' );
367
+			$ticket_selector .= ! is_admin() ? '' : __('Registration is at an external URL for this event.', 'event_espresso');
368 368
 		}
369 369
 		// submit button and form close tag
370 370
 		$ticket_selector .= ! is_admin() ? EED_Ticket_Selector::display_ticket_selector_submit() : '';
@@ -384,25 +384,25 @@  discard block
 block discarded – undo
384 384
 	 * @param 		string $external_url
385 385
 	 * @return 		string
386 386
 	 */
387
-	public static function ticket_selector_form_open( $ID = 0, $external_url = '' ) {
387
+	public static function ticket_selector_form_open($ID = 0, $external_url = '') {
388 388
 		// if redirecting, we don't need any anything else
389
-		if ( $external_url ) {
390
-			$html = '<form method="GET" action="' . EEH_URL::refactor_url( $external_url ) . '">';
391
-			$query_args = EEH_URL::get_query_string( $external_url );
392
-			foreach ( $query_args as $query_arg => $value ) {
393
-				$html .= '<input type="hidden" name="' . $query_arg . '" value="' . $value . '">';
389
+		if ($external_url) {
390
+			$html = '<form method="GET" action="'.EEH_URL::refactor_url($external_url).'">';
391
+			$query_args = EEH_URL::get_query_string($external_url);
392
+			foreach ($query_args as $query_arg => $value) {
393
+				$html .= '<input type="hidden" name="'.$query_arg.'" value="'.$value.'">';
394 394
 			}
395 395
 			return $html;
396 396
 		}
397
-		$checkout_url = EEH_Event_View::event_link_url( $ID );
398
-		if ( ! $checkout_url ) {
399
-			EE_Error::add_error( __('The URL for the Event Details page could not be retrieved.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
397
+		$checkout_url = EEH_Event_View::event_link_url($ID);
398
+		if ( ! $checkout_url) {
399
+			EE_Error::add_error(__('The URL for the Event Details page could not be retrieved.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
400 400
 		}
401 401
 		$extra_params = self::$_in_iframe ? ' target="_blank"' : '';
402
-		$html = '<form method="POST" action="' . $checkout_url . '"' . $extra_params . '>';
403
-		$html .= wp_nonce_field( 	'process_ticket_selections', 'process_ticket_selections_nonce', TRUE, FALSE );
402
+		$html = '<form method="POST" action="'.$checkout_url.'"'.$extra_params.'>';
403
+		$html .= wp_nonce_field('process_ticket_selections', 'process_ticket_selections_nonce', TRUE, FALSE);
404 404
 		$html .= '<input type="hidden" name="ee" value="process_ticket_selections">';
405
-		$html = apply_filters( 'FHEE__EE_Ticket_Selector__ticket_selector_form_open__html', $html, self::$_event );
405
+		$html = apply_filters('FHEE__EE_Ticket_Selector__ticket_selector_form_open__html', $html, self::$_event);
406 406
 		return $html;
407 407
 	}
408 408
 
@@ -417,23 +417,23 @@  discard block
 block discarded – undo
417 417
 	 * 	@return		string
418 418
 	 */
419 419
 	public static function display_ticket_selector_submit() {
420
-		if ( ! is_admin() ) {
421
-			if ( apply_filters( 'FHEE__EE_Ticket_Selector__display_ticket_selector_submit', FALSE ) ) {
420
+		if ( ! is_admin()) {
421
+			if (apply_filters('FHEE__EE_Ticket_Selector__display_ticket_selector_submit', FALSE)) {
422 422
 				$btn_text = apply_filters(
423 423
 					'FHEE__EE_Ticket_Selector__display_ticket_selector_submit__btn_text',
424
-					__('Register Now', 'event_espresso' ),
424
+					__('Register Now', 'event_espresso'),
425 425
 					self::$_event
426 426
 				);
427 427
 				$external_url = self::$_event->external_url();
428
-				$html = '<input id="ticket-selector-submit-'. self::$_event->ID() .'-btn"';
428
+				$html = '<input id="ticket-selector-submit-'.self::$_event->ID().'-btn"';
429 429
 				$html .= ' class="ticket-selector-submit-btn ';
430
-				$html .= empty( $external_url ) ? 'ticket-selector-submit-ajax"' : '"';
431
-				$html .= ' type="submit" value="' . $btn_text . '" />';
432
-				$html .= apply_filters( 'FHEE__EE_Ticket_Selector__after_ticket_selector_submit', '', self::$_event );
430
+				$html .= empty($external_url) ? 'ticket-selector-submit-ajax"' : '"';
431
+				$html .= ' type="submit" value="'.$btn_text.'" />';
432
+				$html .= apply_filters('FHEE__EE_Ticket_Selector__after_ticket_selector_submit', '', self::$_event);
433 433
 				$html .= '<div class="clear"><br/></div></form>';
434 434
 				return $html;
435
-			} else if ( is_archive() ) {
436
-				return EED_Ticket_Selector::ticket_selector_form_close() . EED_Ticket_Selector::display_view_details_btn();
435
+			} else if (is_archive()) {
436
+				return EED_Ticket_Selector::ticket_selector_form_close().EED_Ticket_Selector::display_view_details_btn();
437 437
 			}
438 438
 		}
439 439
 		return '';
@@ -465,13 +465,13 @@  discard block
 block discarded – undo
465 465
 	 * 	@return		string
466 466
 	 */
467 467
 	public static function display_view_details_btn() {
468
-		if ( ! self::$_event->get_permalink() ) {
469
-			EE_Error::add_error( __('The URL for the Event Details page could not be retrieved.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
468
+		if ( ! self::$_event->get_permalink()) {
469
+			EE_Error::add_error(__('The URL for the Event Details page could not be retrieved.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
470 470
 		}
471
-		$view_details_btn = '<form method="POST" action="' . self::$_event->get_permalink() . '">';
472
-		$btn_text = apply_filters( 'FHEE__EE_Ticket_Selector__display_view_details_btn__btn_text', __( 'View Details', 'event_espresso' ), self::$_event );
473
-		$view_details_btn .= '<input id="ticket-selector-submit-'. self::$_event->ID() .'-btn" class="ticket-selector-submit-btn view-details-btn" type="submit" value="' . $btn_text . '" />';
474
-		$view_details_btn .= apply_filters( 'FHEE__EE_Ticket_Selector__after_view_details_btn', '', self::$_event );
471
+		$view_details_btn = '<form method="POST" action="'.self::$_event->get_permalink().'">';
472
+		$btn_text = apply_filters('FHEE__EE_Ticket_Selector__display_view_details_btn__btn_text', __('View Details', 'event_espresso'), self::$_event);
473
+		$view_details_btn .= '<input id="ticket-selector-submit-'.self::$_event->ID().'-btn" class="ticket-selector-submit-btn view-details-btn" type="submit" value="'.$btn_text.'" />';
474
+		$view_details_btn .= apply_filters('FHEE__EE_Ticket_Selector__after_view_details_btn', '', self::$_event);
475 475
 		$view_details_btn .= '<div class="clear"><br/></div>';
476 476
 		$view_details_btn .= '</form>';
477 477
 		return $view_details_btn;
@@ -489,11 +489,11 @@  discard block
 block discarded – undo
489 489
 	 * 	@return array|boolean
490 490
 	 */
491 491
 	public function process_ticket_selections() {
492
-        do_action( 'EED_Ticket_Selector__process_ticket_selections__before' );
492
+        do_action('EED_Ticket_Selector__process_ticket_selections__before');
493 493
 		// check nonce
494
-		if ( ! is_admin() && ( ! EE_Registry::instance()->REQ->is_set( 'process_ticket_selections_nonce' ) || ! wp_verify_nonce( EE_Registry::instance()->REQ->get( 'process_ticket_selections_nonce' ), 'process_ticket_selections' ))) {
494
+		if ( ! is_admin() && ( ! EE_Registry::instance()->REQ->is_set('process_ticket_selections_nonce') || ! wp_verify_nonce(EE_Registry::instance()->REQ->get('process_ticket_selections_nonce'), 'process_ticket_selections'))) {
495 495
 			EE_Error::add_error(
496
-				sprintf( __( 'We\'re sorry but your request failed to pass a security check.%sPlease click the back button on your browser and try again.', 'event_espresso' ), '<br/>' ),
496
+				sprintf(__('We\'re sorry but your request failed to pass a security check.%sPlease click the back button on your browser and try again.', 'event_espresso'), '<br/>'),
497 497
 				__FILE__, __FUNCTION__, __LINE__
498 498
 			);
499 499
 			return FALSE;
@@ -507,16 +507,16 @@  discard block
 block discarded – undo
507 507
 
508 508
 		//we should really only have 1 registration in the works now (ie, no MER) so clear any previous items in the cart.
509 509
 		// When MER happens this will probably need to be tweaked, possibly wrapped in a conditional checking for some constant defined in MER etc.
510
-		EE_Registry::instance()->load_core( 'Session' );
510
+		EE_Registry::instance()->load_core('Session');
511 511
 		// unless otherwise requested, clear the session
512
-		if ( apply_filters( 'FHEE__EE_Ticket_Selector__process_ticket_selections__clear_session', TRUE )) {
513
-			EE_Registry::instance()->SSN->clear_session( __CLASS__, __FUNCTION__ );
512
+		if (apply_filters('FHEE__EE_Ticket_Selector__process_ticket_selections__clear_session', TRUE)) {
513
+			EE_Registry::instance()->SSN->clear_session(__CLASS__, __FUNCTION__);
514 514
 		}
515 515
 		//d( EE_Registry::instance()->SSN );
516 516
 
517
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
517
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
518 518
 		// do we have an event id?
519
-		if ( EE_Registry::instance()->REQ->is_set( 'tkt-slctr-event-id' ) ) {
519
+		if (EE_Registry::instance()->REQ->is_set('tkt-slctr-event-id')) {
520 520
 			// validate/sanitize data
521 521
 			$valid = self::_validate_post_data();
522 522
 
@@ -526,41 +526,41 @@  discard block
 block discarded – undo
526 526
 			//EEH_Debug_Tools::printr( $valid[ 'max_atndz' ], 'max_atndz', __FILE__, __LINE__ );
527 527
 
528 528
 			//check total tickets ordered vs max number of attendees that can register
529
-			if ( $valid['total_tickets'] > $valid['max_atndz'] ) {
529
+			if ($valid['total_tickets'] > $valid['max_atndz']) {
530 530
 
531 531
 				// ordering too many tickets !!!
532 532
 				$total_tickets_string = _n('You have attempted to purchase %s ticket.', 'You have attempted to purchase %s tickets.', $valid['total_tickets'], 'event_espresso');
533
-				$limit_error_1 = sprintf( $total_tickets_string, $valid['total_tickets'] );
533
+				$limit_error_1 = sprintf($total_tickets_string, $valid['total_tickets']);
534 534
 				// dev only message
535 535
 				$max_atndz_string = _n('The registration limit for this event is %s ticket per registration, therefore the total number of tickets you may purchase at a time can not exceed %s.', 'The registration limit for this event is %s tickets per registration, therefore the total number of tickets you may purchase at a time can not exceed %s.', $valid['max_atndz'], 'event_espresso');
536
-				$limit_error_2 = sprintf( $max_atndz_string, $valid['max_atndz'], $valid['max_atndz'] );
537
-				EE_Error::add_error( $limit_error_1 . '<br/>' . $limit_error_2, __FILE__, __FUNCTION__, __LINE__ );
536
+				$limit_error_2 = sprintf($max_atndz_string, $valid['max_atndz'], $valid['max_atndz']);
537
+				EE_Error::add_error($limit_error_1.'<br/>'.$limit_error_2, __FILE__, __FUNCTION__, __LINE__);
538 538
 			} else {
539 539
 
540 540
 				// all data appears to be valid
541 541
 				$tckts_slctd = FALSE;
542 542
 				$success = TRUE;
543 543
 				// load cart
544
-				EE_Registry::instance()->load_core( 'Cart' );
544
+				EE_Registry::instance()->load_core('Cart');
545 545
 
546 546
 				// cycle thru the number of data rows sent from the event listing
547
-				for ( $x = 0; $x < $valid['rows']; $x++ ) {
547
+				for ($x = 0; $x < $valid['rows']; $x++) {
548 548
 					// does this row actually contain a ticket quantity?
549
-					if ( isset( $valid['qty'][$x] ) && $valid['qty'][$x] > 0 ) {
549
+					if (isset($valid['qty'][$x]) && $valid['qty'][$x] > 0) {
550 550
 						// YES we have a ticket quantity
551 551
 						$tckts_slctd = TRUE;
552 552
 						//						d( $valid['ticket_obj'][$x] );
553
-						if ( $valid['ticket_obj'][$x] instanceof EE_Ticket ) {
553
+						if ($valid['ticket_obj'][$x] instanceof EE_Ticket) {
554 554
 							// then add ticket to cart
555
-							$ticket_added = self::_add_ticket_to_cart( $valid['ticket_obj'][$x], $valid['qty'][$x] );
555
+							$ticket_added = self::_add_ticket_to_cart($valid['ticket_obj'][$x], $valid['qty'][$x]);
556 556
 							$success = ! $ticket_added ? FALSE : $success;
557
-							if ( EE_Error::has_error() ) {
557
+							if (EE_Error::has_error()) {
558 558
 								break;
559 559
 							}
560 560
 						} else {
561 561
 							// nothing added to cart retrieved
562 562
 							EE_Error::add_error(
563
-								sprintf( __( 'A valid ticket could not be retrieved for the event.%sPlease click the back button on your browser and try again.', 'event_espresso' ), '<br/>' ),
563
+								sprintf(__('A valid ticket could not be retrieved for the event.%sPlease click the back button on your browser and try again.', 'event_espresso'), '<br/>'),
564 564
 								__FILE__, __FUNCTION__, __LINE__
565 565
 							);
566 566
 						}
@@ -569,45 +569,45 @@  discard block
 block discarded – undo
569 569
 				//d( EE_Registry::instance()->CART );
570 570
 				//die(); // <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< KILL REDIRECT HERE BEFORE CART UPDATE
571 571
 
572
-				if ( $tckts_slctd ) {
573
-					if ( $success ) {
574
-						do_action( 'FHEE__EE_Ticket_Selector__process_ticket_selections__before_redirecting_to_checkout', EE_Registry::instance()->CART, $this );
572
+				if ($tckts_slctd) {
573
+					if ($success) {
574
+						do_action('FHEE__EE_Ticket_Selector__process_ticket_selections__before_redirecting_to_checkout', EE_Registry::instance()->CART, $this);
575 575
 						EE_Registry::instance()->CART->recalculate_all_cart_totals();
576
-						EE_Registry::instance()->CART->save_cart( FALSE );
576
+						EE_Registry::instance()->CART->save_cart(FALSE);
577 577
 						EE_Registry::instance()->SSN->update();
578 578
 						//d( EE_Registry::instance()->CART );
579 579
 						//die(); // <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< OR HERE TO KILL REDIRECT AFTER CART UPDATE
580 580
 						// just return TRUE for registrations being made from admin
581
-						if ( is_admin() ) {
581
+						if (is_admin()) {
582 582
 							return TRUE;
583 583
 						}
584
-						wp_safe_redirect( apply_filters( 'FHEE__EE_Ticket_Selector__process_ticket_selections__success_redirect_url', EE_Registry::instance()->CFG->core->reg_page_url() ));
584
+						wp_safe_redirect(apply_filters('FHEE__EE_Ticket_Selector__process_ticket_selections__success_redirect_url', EE_Registry::instance()->CFG->core->reg_page_url()));
585 585
 						exit();
586 586
 
587 587
 					} else {
588
-						if ( ! EE_Error::has_error() ) {
588
+						if ( ! EE_Error::has_error()) {
589 589
 							// nothing added to cart
590
-							EE_Error::add_attention( __( 'No tickets were added for the event', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
590
+							EE_Error::add_attention(__('No tickets were added for the event', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
591 591
 						}
592 592
 					}
593 593
 
594 594
 				} else {
595 595
 					// no ticket quantities were selected
596
-					EE_Error::add_error( __( 'You need to select a ticket quantity before you can proceed.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
596
+					EE_Error::add_error(__('You need to select a ticket quantity before you can proceed.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
597 597
 				}
598 598
 			}
599 599
 			//die(); // <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< KILL BEFORE REDIRECT
600 600
 			// at this point, just return if registration is being made from admin
601
-			if ( is_admin() ) {
601
+			if (is_admin()) {
602 602
 				return FALSE;
603 603
 			}
604
-			if ( $valid['return_url'] ) {
605
-				EE_Error::get_notices( FALSE, TRUE );
606
-				wp_safe_redirect( $valid['return_url'] );
604
+			if ($valid['return_url']) {
605
+				EE_Error::get_notices(FALSE, TRUE);
606
+				wp_safe_redirect($valid['return_url']);
607 607
 				exit();
608
-			} elseif ( isset( $event_to_add['id'] )) {
609
-				EE_Error::get_notices( FALSE, TRUE );
610
-				wp_safe_redirect( get_permalink( $event_to_add['id'] ));
608
+			} elseif (isset($event_to_add['id'])) {
609
+				EE_Error::get_notices(FALSE, TRUE);
610
+				wp_safe_redirect(get_permalink($event_to_add['id']));
611 611
 				exit();
612 612
 			} else {
613 613
 				echo EE_Error::get_notices();
@@ -616,7 +616,7 @@  discard block
 block discarded – undo
616 616
 		} else {
617 617
 			// $_POST['tkt-slctr-event-id'] was not set ?!?!?!?
618 618
 			EE_Error::add_error(
619
-				sprintf( __( 'An event id was not provided or was not received.%sPlease click the back button on your browser and try again.', 'event_espresso' ), '<br/>' ),
619
+				sprintf(__('An event id was not provided or was not received.%sPlease click the back button on your browser and try again.', 'event_espresso'), '<br/>'),
620 620
 				__FILE__, __FUNCTION__, __LINE__
621 621
 			);
622 622
 		}
@@ -634,18 +634,18 @@  discard block
 block discarded – undo
634 634
 	 * @return        array  or FALSE
635 635
 	 */
636 636
 	private static function _validate_post_data() {
637
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
637
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
638 638
 
639 639
 		// start with an empty array()
640 640
 		$valid_data = array();
641 641
 		//		d( $_POST );
642 642
 		//if event id is valid
643
-		$id = absint( EE_Registry::instance()->REQ->get( 'tkt-slctr-event-id' ));
644
-		if ( $id ) {
643
+		$id = absint(EE_Registry::instance()->REQ->get('tkt-slctr-event-id'));
644
+		if ($id) {
645 645
 			// grab valid id
646 646
 			$valid_data['id'] = $id;
647 647
 			// grab and sanitize return-url
648
-			$valid_data['return_url'] = esc_url_raw( EE_Registry::instance()->REQ->get( 'tkt-slctr-return-url-' . $id ));
648
+			$valid_data['return_url'] = esc_url_raw(EE_Registry::instance()->REQ->get('tkt-slctr-return-url-'.$id));
649 649
 			// array of other form names
650 650
 			$inputs_to_clean = array(
651 651
 				'event_id' => 'tkt-slctr-event-id',
@@ -658,22 +658,22 @@  discard block
 block discarded – undo
658 658
 			// let's track the total number of tickets ordered.'
659 659
 			$valid_data['total_tickets'] = 0;
660 660
 			// cycle through $inputs_to_clean array
661
-			foreach ( $inputs_to_clean as $what => $input_to_clean ) {
661
+			foreach ($inputs_to_clean as $what => $input_to_clean) {
662 662
 				// check for POST data
663
-				if ( EE_Registry::instance()->REQ->is_set( $input_to_clean . $id )) {
663
+				if (EE_Registry::instance()->REQ->is_set($input_to_clean.$id)) {
664 664
 					// grab value
665
-					$input_value = EE_Registry::instance()->REQ->get( $input_to_clean . $id );
665
+					$input_value = EE_Registry::instance()->REQ->get($input_to_clean.$id);
666 666
 					switch ($what) {
667 667
 
668 668
 						// integers
669 669
 						case 'event_id':
670
-							$valid_data[$what] = absint( $input_value );
670
+							$valid_data[$what] = absint($input_value);
671 671
 							// get event via the event id we put in the form
672
-							$valid_data['event'] = EE_Registry::instance()->load_model( 'Event' )->get_one_by_ID( $valid_data['event_id'] );
672
+							$valid_data['event'] = EE_Registry::instance()->load_model('Event')->get_one_by_ID($valid_data['event_id']);
673 673
 							break;
674 674
 						case 'rows':
675 675
 						case 'max_atndz':
676
-							$valid_data[$what] = absint( $input_value );
676
+							$valid_data[$what] = absint($input_value);
677 677
 							break;
678 678
 
679 679
 						// arrays of integers
@@ -681,27 +681,27 @@  discard block
 block discarded – undo
681 681
 							//							d( $input_value );
682 682
 							$row_qty = $input_value;
683 683
 							// if qty is coming from a radio button input, then we need to assemble an array of rows
684
-							if( ! is_array( $row_qty )) {
684
+							if ( ! is_array($row_qty)) {
685 685
 								// get number of rows
686
-								$rows = EE_Registry::instance()->REQ->is_set( 'tkt-slctr-rows-' . $id ) ? absint( EE_Registry::instance()->REQ->get( 'tkt-slctr-rows-' . $id )) : 1;
686
+								$rows = EE_Registry::instance()->REQ->is_set('tkt-slctr-rows-'.$id) ? absint(EE_Registry::instance()->REQ->get('tkt-slctr-rows-'.$id)) : 1;
687 687
 								//								d( $rows );
688 688
 								// explode ints by the dash
689
-								$row_qty = explode( '-', $row_qty );
690
-								$row = isset( $row_qty[0] ) ? ( absint( $row_qty[0] )) : 1;
691
-								$qty = isset( $row_qty[1] ) ? absint( $row_qty[1] ) : 0;
692
-								$row_qty = array( $row => $qty );
689
+								$row_qty = explode('-', $row_qty);
690
+								$row = isset($row_qty[0]) ? (absint($row_qty[0])) : 1;
691
+								$qty = isset($row_qty[1]) ? absint($row_qty[1]) : 0;
692
+								$row_qty = array($row => $qty);
693 693
 								//								 d( $row_qty );
694
-								for( $x = 1; $x <= $rows; $x++ ) {
695
-									if ( ! isset( $row_qty[$x] )) {
694
+								for ($x = 1; $x <= $rows; $x++) {
695
+									if ( ! isset($row_qty[$x])) {
696 696
 										$row_qty[$x] = 0;
697 697
 									}
698 698
 								}
699 699
 							}
700
-							ksort( $row_qty );
700
+							ksort($row_qty);
701 701
 							//							 d( $row_qty );
702 702
 							// cycle thru values
703
-							foreach ( $row_qty as $qty ) {
704
-								$qty = absint( $qty );
703
+							foreach ($row_qty as $qty) {
704
+								$qty = absint($qty);
705 705
 								// sanitize as integers
706 706
 								$valid_data[$what][] = $qty;
707 707
 								$valid_data['total_tickets'] += $qty;
@@ -712,19 +712,19 @@  discard block
 block discarded – undo
712 712
 						case 'ticket_id':
713 713
 							$value_array = array();
714 714
 							// cycle thru values
715
-							foreach ( $input_value as $key=>$value ) {
715
+							foreach ($input_value as $key=>$value) {
716 716
 								// allow only numbers, letters,  spaces, commas and dashes
717
-								$value_array[ $key ] = wp_strip_all_tags( $value );
717
+								$value_array[$key] = wp_strip_all_tags($value);
718 718
 								// get ticket via the ticket id we put in the form
719
-								$ticket_obj = EE_Registry::instance()->load_model( 'Ticket' )->get_one_by_ID( $value );
720
-								$valid_data['ticket_obj'][ $key ] = $ticket_obj;
719
+								$ticket_obj = EE_Registry::instance()->load_model('Ticket')->get_one_by_ID($value);
720
+								$valid_data['ticket_obj'][$key] = $ticket_obj;
721 721
 							}
722
-							$valid_data[ $what ] = $value_array;
722
+							$valid_data[$what] = $value_array;
723 723
 							break;
724 724
 
725 725
 						case 'return_url' :
726 726
 							// grab and sanitize return-url
727
-							$valid_data[$what] = esc_url_raw( $input_value );
727
+							$valid_data[$what] = esc_url_raw($input_value);
728 728
 							break;
729 729
 
730 730
 					} 	// end switch $what
@@ -732,7 +732,7 @@  discard block
 block discarded – undo
732 732
 			} 	// end foreach $inputs_to_clean
733 733
 
734 734
 		} else {
735
-			EE_Error::add_error( __('The event id provided was not valid.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
735
+			EE_Error::add_error(__('The event id provided was not valid.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
736 736
 			return FALSE;
737 737
 		}
738 738
 
@@ -750,28 +750,28 @@  discard block
 block discarded – undo
750 750
 	 * @param int       $qty
751 751
 	 * @return TRUE on success, FALSE on fail
752 752
 	 */
753
-	private static function _add_ticket_to_cart( EE_Ticket $ticket = NULL, $qty = 1 ) {
754
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
753
+	private static function _add_ticket_to_cart(EE_Ticket $ticket = NULL, $qty = 1) {
754
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
755 755
 		// get the number of spaces left for this datetime ticket
756
-		$available_spaces = self::_ticket_datetime_availability( $ticket );
756
+		$available_spaces = self::_ticket_datetime_availability($ticket);
757 757
 		// compare available spaces against the number of tickets being purchased
758
-		if ( $available_spaces >= $qty ) {
758
+		if ($available_spaces >= $qty) {
759 759
 			// allow addons to prevent a ticket from being added to cart
760
-			if ( ! apply_filters( 'FHEE__EE_Ticket_Selector___add_ticket_to_cart__allow_add_to_cart', true, $ticket, $qty, $available_spaces ) ) {
760
+			if ( ! apply_filters('FHEE__EE_Ticket_Selector___add_ticket_to_cart__allow_add_to_cart', true, $ticket, $qty, $available_spaces)) {
761 761
 				return false;
762 762
 			}
763 763
 			// add event to cart
764
-			if( EE_Registry::instance()->CART->add_ticket_to_cart( $ticket, $qty )) {
765
-				self::_recalculate_ticket_datetime_availability( $ticket, $qty );
764
+			if (EE_Registry::instance()->CART->add_ticket_to_cart($ticket, $qty)) {
765
+				self::_recalculate_ticket_datetime_availability($ticket, $qty);
766 766
 				return true;
767 767
 			} else {
768 768
 				return false;
769 769
 			}
770 770
 		} else {
771 771
 			// tickets can not be purchased but let's find the exact number left for the last ticket selected PRIOR to subtracting tickets
772
-			$available_spaces = self::_ticket_datetime_availability( $ticket, true );
772
+			$available_spaces = self::_ticket_datetime_availability($ticket, true);
773 773
 			// greedy greedy greedy eh?
774
-			if ( $available_spaces > 0 ) {
774
+			if ($available_spaces > 0) {
775 775
 				// add error messaging - we're using the _n function that will generate the appropriate singular or plural message based on the number of $available_spaces
776 776
 				EE_Error::add_error(
777 777
 					sprintf(
@@ -787,7 +787,7 @@  discard block
 block discarded – undo
787 787
 					__FILE__, __FUNCTION__, __LINE__
788 788
 				);
789 789
 			} else {
790
-				EE_Error::add_error( __('We\'re sorry, but there are no available spaces left for this event at this particular date and time.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ );
790
+				EE_Error::add_error(__('We\'re sorry, but there are no available spaces left for this event at this particular date and time.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
791 791
 			}
792 792
 			return false;
793 793
 		}
@@ -805,22 +805,22 @@  discard block
 block discarded – undo
805 805
 	 * @param 	bool         $get_original_ticket_spaces
806 806
 	 * @return 	int
807 807
 	 */
808
-	private static function _ticket_datetime_availability( EE_Ticket $ticket, $get_original_ticket_spaces = FALSE ) {
808
+	private static function _ticket_datetime_availability(EE_Ticket $ticket, $get_original_ticket_spaces = FALSE) {
809 809
 		// if the $_available_spaces array has not been set up yet...
810
-		if ( ! isset( self::$_available_spaces['tickets'][ $ticket->ID() ] )) {
811
-				self::_set_initial_ticket_datetime_availability( $ticket );
810
+		if ( ! isset(self::$_available_spaces['tickets'][$ticket->ID()])) {
811
+				self::_set_initial_ticket_datetime_availability($ticket);
812 812
 		}
813 813
 		$available_spaces = $ticket->qty() - $ticket->sold();
814
-		if ( isset( self::$_available_spaces['tickets'][ $ticket->ID() ] )) {
814
+		if (isset(self::$_available_spaces['tickets'][$ticket->ID()])) {
815 815
 			// loop thru tickets, which will ALSO include individual ticket records AND a total
816
-			foreach ( self::$_available_spaces['tickets'][ $ticket->ID() ] as $DTD_ID => $spaces  ) {
816
+			foreach (self::$_available_spaces['tickets'][$ticket->ID()] as $DTD_ID => $spaces) {
817 817
 				// if we want the original datetime availability BEFORE we started subtracting tickets ?
818
-				if ( $get_original_ticket_spaces ) {
818
+				if ($get_original_ticket_spaces) {
819 819
 					// then grab the available spaces from the "tickets" array and compare with the above to get the lowest number
820
-					$available_spaces = min( $available_spaces, self::$_available_spaces['tickets'][ $ticket->ID() ][ $DTD_ID ] );
820
+					$available_spaces = min($available_spaces, self::$_available_spaces['tickets'][$ticket->ID()][$DTD_ID]);
821 821
 				} else {
822 822
 					// we want the updated ticket availability as stored in the "datetimes" array
823
-					$available_spaces = min( $available_spaces, self::$_available_spaces['datetimes'][ $DTD_ID ] );
823
+					$available_spaces = min($available_spaces, self::$_available_spaces['datetimes'][$DTD_ID]);
824 824
 				}
825 825
 			}
826 826
 		}
@@ -836,23 +836,23 @@  discard block
 block discarded – undo
836 836
 	 * @param 	EE_Ticket $ticket
837 837
 	 * @return 	int
838 838
 	 */
839
-	private static function _set_initial_ticket_datetime_availability( EE_Ticket $ticket ) {
839
+	private static function _set_initial_ticket_datetime_availability(EE_Ticket $ticket) {
840 840
 		// first, get all of the datetimes that are available to this ticket
841 841
 		$datetimes = $ticket->get_many_related(
842 842
 			'Datetime',
843
-			array( array( 'DTT_EVT_end' => array( '>=', EEM_Datetime::instance()->current_time_for_query( 'DTT_EVT_end' ) ) ), 'order_by' => array( 'DTT_EVT_start' => 'ASC' ))
843
+			array(array('DTT_EVT_end' => array('>=', EEM_Datetime::instance()->current_time_for_query('DTT_EVT_end'))), 'order_by' => array('DTT_EVT_start' => 'ASC'))
844 844
 		);
845
-		if ( ! empty( $datetimes )) {
845
+		if ( ! empty($datetimes)) {
846 846
 			// now loop thru all of the datetimes
847
-			foreach ( $datetimes as $datetime  ) {
848
-				if ( $datetime instanceof EE_Datetime ) {
847
+			foreach ($datetimes as $datetime) {
848
+				if ($datetime instanceof EE_Datetime) {
849 849
 					// the number of spaces available for the datetime without considering individual ticket quantities
850 850
 					$spaces_remaining = $datetime->spaces_remaining();
851 851
 					// save the total available spaces ( the lesser of the ticket qty minus the number of tickets sold or the datetime spaces remaining) to this ticket using the datetime ID as the key
852
-					self::$_available_spaces['tickets'][ $ticket->ID() ][ $datetime->ID() ] = min(( $ticket->qty() - $ticket->sold() ), $spaces_remaining );
852
+					self::$_available_spaces['tickets'][$ticket->ID()][$datetime->ID()] = min(($ticket->qty() - $ticket->sold()), $spaces_remaining);
853 853
 					// if the remaining spaces for this datetime is already set, then compare that against the datetime spaces remaining, and take the lowest number,
854 854
 					// else just take the datetime spaces remaining, and assign to the datetimes array
855
-					self::$_available_spaces['datetimes'][ $datetime->ID() ] = isset( self::$_available_spaces['datetimes'][ $datetime->ID() ] ) ? min( self::$_available_spaces['datetimes'][ $datetime->ID() ], $spaces_remaining ) : $spaces_remaining;
855
+					self::$_available_spaces['datetimes'][$datetime->ID()] = isset(self::$_available_spaces['datetimes'][$datetime->ID()]) ? min(self::$_available_spaces['datetimes'][$datetime->ID()], $spaces_remaining) : $spaces_remaining;
856 856
 				}
857 857
 			}
858 858
 		}
@@ -868,12 +868,12 @@  discard block
 block discarded – undo
868 868
 	 * @param 	int   $qty
869 869
 	 * @return 	int
870 870
 	 */
871
-	private static function _recalculate_ticket_datetime_availability( EE_Ticket $ticket, $qty = 0 ) {
872
-		if ( isset( self::$_available_spaces['tickets'][ $ticket->ID() ] )) {
871
+	private static function _recalculate_ticket_datetime_availability(EE_Ticket $ticket, $qty = 0) {
872
+		if (isset(self::$_available_spaces['tickets'][$ticket->ID()])) {
873 873
 			// loop thru tickets, which will ALSO include individual ticket records AND a total
874
-			foreach ( self::$_available_spaces['tickets'][ $ticket->ID() ] as $DTD_ID => $spaces  ) {
874
+			foreach (self::$_available_spaces['tickets'][$ticket->ID()] as $DTD_ID => $spaces) {
875 875
 				// subtract the qty of selected tickets from each datetime's available spaces this ticket has access to,
876
-				self::$_available_spaces['datetimes'][ $DTD_ID ] = self::$_available_spaces['datetimes'][ $DTD_ID ] - $qty;
876
+				self::$_available_spaces['datetimes'][$DTD_ID] = self::$_available_spaces['datetimes'][$DTD_ID] - $qty;
877 877
 			}
878 878
 		}
879 879
 	}
@@ -890,8 +890,8 @@  discard block
 block discarded – undo
890 890
 	*/
891 891
 	public static function load_tckt_slctr_assets() {
892 892
 		// add some style
893
-		if ( apply_filters( 'FHEE__EED_Ticket_Selector__load_tckt_slctr_assets', FALSE ) ) {
894
-			wp_register_style('ticket_selector', TICKET_SELECTOR_ASSETS_URL . 'ticket_selector.css');
893
+		if (apply_filters('FHEE__EED_Ticket_Selector__load_tckt_slctr_assets', FALSE)) {
894
+			wp_register_style('ticket_selector', TICKET_SELECTOR_ASSETS_URL.'ticket_selector.css');
895 895
 			wp_enqueue_style('ticket_selector');
896 896
 			// make it dance
897 897
 			//			wp_register_script('ticket_selector', TICKET_SELECTOR_ASSETS_URL . 'ticket_selector.js', array('espresso_core'), '', TRUE);
@@ -905,9 +905,9 @@  discard block
 block discarded – undo
905 905
 
906 906
 	public static function load_tckt_slctr_assets_admin() {
907 907
 		//iframe button js on admin event editor page
908
-		if ( EE_Registry::instance()->REQ->get('page') == 'espresso_events' && EE_Registry::instance()->REQ->get('action') == 'edit' ) {
909
-			wp_register_script( 'ticket_selector_embed', TICKET_SELECTOR_ASSETS_URL . 'ticket-selector-embed.js', array( 'ee-dialog' ), EVENT_ESPRESSO_VERSION, true );
910
-			wp_enqueue_script( 'ticket_selector_embed' );
908
+		if (EE_Registry::instance()->REQ->get('page') == 'espresso_events' && EE_Registry::instance()->REQ->get('action') == 'edit') {
909
+			wp_register_script('ticket_selector_embed', TICKET_SELECTOR_ASSETS_URL.'ticket-selector-embed.js', array('ee-dialog'), EVENT_ESPRESSO_VERSION, true);
910
+			wp_enqueue_script('ticket_selector_embed');
911 911
 		}
912 912
 	}
913 913
 
Please login to merge, or discard this patch.
espresso.php 1 patch
Spacing   +93 added lines, -93 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1
-<?php if ( ! defined( 'ABSPATH' ) ) {
2
-	exit( 'No direct script access allowed' );
1
+<?php if ( ! defined('ABSPATH')) {
2
+	exit('No direct script access allowed');
3 3
 }
4 4
 /*
5 5
   Plugin Name:		Event Espresso
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
  *
42 42
  */
43 43
 
44
-if ( function_exists( 'espresso_version' ) ) {
44
+if (function_exists('espresso_version')) {
45 45
 
46 46
 	/**
47 47
 	 *    espresso_duplicate_plugin_error
@@ -50,12 +50,12 @@  discard block
 block discarded – undo
50 50
 	function espresso_duplicate_plugin_error() {
51 51
 		?>
52 52
 		<div class="error">
53
-			<p><?php _e( 'Can not run multiple versions of Event Espresso! One version has been automatically deactivated. Please verify that you have the correct version you want still active.', 'event_espresso' ); ?></p>
53
+			<p><?php _e('Can not run multiple versions of Event Espresso! One version has been automatically deactivated. Please verify that you have the correct version you want still active.', 'event_espresso'); ?></p>
54 54
 		</div>
55 55
 		<?php
56
-		espresso_deactivate_plugin( plugin_basename( __FILE__ ) );
56
+		espresso_deactivate_plugin(plugin_basename(__FILE__));
57 57
 	}
58
-	add_action( 'admin_notices', 'espresso_duplicate_plugin_error', 1 );
58
+	add_action('admin_notices', 'espresso_duplicate_plugin_error', 1);
59 59
 
60 60
 } else {
61 61
 
@@ -66,103 +66,103 @@  discard block
 block discarded – undo
66 66
 	 * @return string
67 67
 	 */
68 68
 	function espresso_version() {
69
-		return apply_filters( 'FHEE__espresso__espresso_version', '4.9.8.rc.002' );
69
+		return apply_filters('FHEE__espresso__espresso_version', '4.9.8.rc.002');
70 70
 	}
71 71
 
72 72
 	// define versions
73
-	define( 'EVENT_ESPRESSO_VERSION', espresso_version() );
74
-	define( 'EE_MIN_WP_VER_REQUIRED', '4.1' );
75
-	define( 'EE_MIN_WP_VER_RECOMMENDED', '4.4.2' );
76
-	define( 'EE_MIN_PHP_VER_REQUIRED', '5.3.0' );
77
-	define( 'EE_MIN_PHP_VER_RECOMMENDED', '5.4.44' );
78
-	define( 'EVENT_ESPRESSO_POWERED_BY', 'Event Espresso - ' . EVENT_ESPRESSO_VERSION );
79
-	define( 'EVENT_ESPRESSO_MAIN_FILE', __FILE__ );
73
+	define('EVENT_ESPRESSO_VERSION', espresso_version());
74
+	define('EE_MIN_WP_VER_REQUIRED', '4.1');
75
+	define('EE_MIN_WP_VER_RECOMMENDED', '4.4.2');
76
+	define('EE_MIN_PHP_VER_REQUIRED', '5.3.0');
77
+	define('EE_MIN_PHP_VER_RECOMMENDED', '5.4.44');
78
+	define('EVENT_ESPRESSO_POWERED_BY', 'Event Espresso - '.EVENT_ESPRESSO_VERSION);
79
+	define('EVENT_ESPRESSO_MAIN_FILE', __FILE__);
80 80
 	//used to be DIRECTORY_SEPARATOR, but that caused issues on windows
81
-	if ( ! defined( 'DS' ) ) {
82
-		define( 'DS', '/' );
81
+	if ( ! defined('DS')) {
82
+		define('DS', '/');
83 83
 	}
84
-	if ( ! defined( 'PS' ) ) {
85
-		define( 'PS', PATH_SEPARATOR );
84
+	if ( ! defined('PS')) {
85
+		define('PS', PATH_SEPARATOR);
86 86
 	}
87
-	if ( ! defined( 'SP' ) ) {
88
-		define( 'SP', ' ' );
87
+	if ( ! defined('SP')) {
88
+		define('SP', ' ');
89 89
 	}
90
-	if ( ! defined( 'EENL' ) ) {
91
-		define( 'EENL', "\n" );
90
+	if ( ! defined('EENL')) {
91
+		define('EENL', "\n");
92 92
 	}
93
-	define( 'EE_SUPPORT_EMAIL', '[email protected]' );
93
+	define('EE_SUPPORT_EMAIL', '[email protected]');
94 94
 	// define the plugin directory and URL
95
-	define( 'EE_PLUGIN_BASENAME', plugin_basename( EVENT_ESPRESSO_MAIN_FILE ) );
96
-	define( 'EE_PLUGIN_DIR_PATH', plugin_dir_path( EVENT_ESPRESSO_MAIN_FILE ) );
97
-	define( 'EE_PLUGIN_DIR_URL', plugin_dir_url( EVENT_ESPRESSO_MAIN_FILE ) );
95
+	define('EE_PLUGIN_BASENAME', plugin_basename(EVENT_ESPRESSO_MAIN_FILE));
96
+	define('EE_PLUGIN_DIR_PATH', plugin_dir_path(EVENT_ESPRESSO_MAIN_FILE));
97
+	define('EE_PLUGIN_DIR_URL', plugin_dir_url(EVENT_ESPRESSO_MAIN_FILE));
98 98
 	// main root folder paths
99
-	define( 'EE_ADMIN_PAGES', EE_PLUGIN_DIR_PATH . 'admin_pages' . DS );
100
-	define( 'EE_CORE', EE_PLUGIN_DIR_PATH . 'core' . DS );
101
-	define( 'EE_MODULES', EE_PLUGIN_DIR_PATH . 'modules' . DS );
102
-	define( 'EE_PUBLIC', EE_PLUGIN_DIR_PATH . 'public' . DS );
103
-	define( 'EE_SHORTCODES', EE_PLUGIN_DIR_PATH . 'shortcodes' . DS );
104
-	define( 'EE_WIDGETS', EE_PLUGIN_DIR_PATH . 'widgets' . DS );
105
-	define( 'EE_PAYMENT_METHODS', EE_PLUGIN_DIR_PATH . 'payment_methods' . DS );
106
-	define( 'EE_CAFF_PATH', EE_PLUGIN_DIR_PATH . 'caffeinated' . DS );
99
+	define('EE_ADMIN_PAGES', EE_PLUGIN_DIR_PATH.'admin_pages'.DS);
100
+	define('EE_CORE', EE_PLUGIN_DIR_PATH.'core'.DS);
101
+	define('EE_MODULES', EE_PLUGIN_DIR_PATH.'modules'.DS);
102
+	define('EE_PUBLIC', EE_PLUGIN_DIR_PATH.'public'.DS);
103
+	define('EE_SHORTCODES', EE_PLUGIN_DIR_PATH.'shortcodes'.DS);
104
+	define('EE_WIDGETS', EE_PLUGIN_DIR_PATH.'widgets'.DS);
105
+	define('EE_PAYMENT_METHODS', EE_PLUGIN_DIR_PATH.'payment_methods'.DS);
106
+	define('EE_CAFF_PATH', EE_PLUGIN_DIR_PATH.'caffeinated'.DS);
107 107
 	// core system paths
108
-	define( 'EE_ADMIN', EE_CORE . 'admin' . DS );
109
-	define( 'EE_CPTS', EE_CORE . 'CPTs' . DS );
110
-	define( 'EE_CLASSES', EE_CORE . 'db_classes' . DS );
111
-	define( 'EE_INTERFACES', EE_CORE . 'interfaces' . DS );
112
-	define( 'EE_BUSINESS', EE_CORE . 'business' . DS );
113
-	define( 'EE_MODELS', EE_CORE . 'db_models' . DS );
114
-	define( 'EE_HELPERS', EE_CORE . 'helpers' . DS );
115
-	define( 'EE_LIBRARIES', EE_CORE . 'libraries' . DS );
116
-	define( 'EE_TEMPLATES', EE_CORE . 'templates' . DS );
117
-	define( 'EE_THIRD_PARTY', EE_CORE . 'third_party_libs' . DS );
118
-	define( 'EE_GLOBAL_ASSETS', EE_TEMPLATES . 'global_assets' . DS );
119
-	define( 'EE_FORM_SECTIONS', EE_LIBRARIES . 'form_sections' . DS );
108
+	define('EE_ADMIN', EE_CORE.'admin'.DS);
109
+	define('EE_CPTS', EE_CORE.'CPTs'.DS);
110
+	define('EE_CLASSES', EE_CORE.'db_classes'.DS);
111
+	define('EE_INTERFACES', EE_CORE.'interfaces'.DS);
112
+	define('EE_BUSINESS', EE_CORE.'business'.DS);
113
+	define('EE_MODELS', EE_CORE.'db_models'.DS);
114
+	define('EE_HELPERS', EE_CORE.'helpers'.DS);
115
+	define('EE_LIBRARIES', EE_CORE.'libraries'.DS);
116
+	define('EE_TEMPLATES', EE_CORE.'templates'.DS);
117
+	define('EE_THIRD_PARTY', EE_CORE.'third_party_libs'.DS);
118
+	define('EE_GLOBAL_ASSETS', EE_TEMPLATES.'global_assets'.DS);
119
+	define('EE_FORM_SECTIONS', EE_LIBRARIES.'form_sections'.DS);
120 120
 	// gateways
121
-	define( 'EE_GATEWAYS', EE_MODULES . 'gateways' . DS );
122
-	define( 'EE_GATEWAYS_URL', EE_PLUGIN_DIR_URL . 'modules' . DS . 'gateways' . DS );
121
+	define('EE_GATEWAYS', EE_MODULES.'gateways'.DS);
122
+	define('EE_GATEWAYS_URL', EE_PLUGIN_DIR_URL.'modules'.DS.'gateways'.DS);
123 123
 	// asset URL paths
124
-	define( 'EE_TEMPLATES_URL', EE_PLUGIN_DIR_URL . 'core' . DS . 'templates' . DS );
125
-	define( 'EE_GLOBAL_ASSETS_URL', EE_TEMPLATES_URL . 'global_assets' . DS );
126
-	define( 'EE_IMAGES_URL', EE_GLOBAL_ASSETS_URL . 'images' . DS );
127
-	define( 'EE_THIRD_PARTY_URL', EE_PLUGIN_DIR_URL . 'core' . DS . 'third_party_libs' . DS );
128
-	define( 'EE_HELPERS_ASSETS', EE_PLUGIN_DIR_URL . 'core/helpers/assets/' );
129
-	define( 'EE_LIBRARIES_URL', EE_PLUGIN_DIR_URL . 'core/libraries/' );
124
+	define('EE_TEMPLATES_URL', EE_PLUGIN_DIR_URL.'core'.DS.'templates'.DS);
125
+	define('EE_GLOBAL_ASSETS_URL', EE_TEMPLATES_URL.'global_assets'.DS);
126
+	define('EE_IMAGES_URL', EE_GLOBAL_ASSETS_URL.'images'.DS);
127
+	define('EE_THIRD_PARTY_URL', EE_PLUGIN_DIR_URL.'core'.DS.'third_party_libs'.DS);
128
+	define('EE_HELPERS_ASSETS', EE_PLUGIN_DIR_URL.'core/helpers/assets/');
129
+	define('EE_LIBRARIES_URL', EE_PLUGIN_DIR_URL.'core/libraries/');
130 130
 	// define upload paths
131 131
 	$uploads = wp_upload_dir();
132 132
 	// define the uploads directory and URL
133
-	define( 'EVENT_ESPRESSO_UPLOAD_DIR', $uploads[ 'basedir' ] . DS . 'espresso' . DS );
134
-	define( 'EVENT_ESPRESSO_UPLOAD_URL', $uploads[ 'baseurl' ] . DS . 'espresso' . DS );
133
+	define('EVENT_ESPRESSO_UPLOAD_DIR', $uploads['basedir'].DS.'espresso'.DS);
134
+	define('EVENT_ESPRESSO_UPLOAD_URL', $uploads['baseurl'].DS.'espresso'.DS);
135 135
 	// define the templates directory and URL
136
-	define( 'EVENT_ESPRESSO_TEMPLATE_DIR', $uploads[ 'basedir' ] . DS . 'espresso' . DS . 'templates' . DS );
137
-	define( 'EVENT_ESPRESSO_TEMPLATE_URL', $uploads[ 'baseurl' ] . DS . 'espresso' . DS . 'templates' . DS );
136
+	define('EVENT_ESPRESSO_TEMPLATE_DIR', $uploads['basedir'].DS.'espresso'.DS.'templates'.DS);
137
+	define('EVENT_ESPRESSO_TEMPLATE_URL', $uploads['baseurl'].DS.'espresso'.DS.'templates'.DS);
138 138
 	// define the gateway directory and URL
139
-	define( 'EVENT_ESPRESSO_GATEWAY_DIR', $uploads[ 'basedir' ] . DS . 'espresso' . DS . 'gateways' . DS );
140
-	define( 'EVENT_ESPRESSO_GATEWAY_URL', $uploads[ 'baseurl' ] . DS . 'espresso' . DS . 'gateways' . DS );
139
+	define('EVENT_ESPRESSO_GATEWAY_DIR', $uploads['basedir'].DS.'espresso'.DS.'gateways'.DS);
140
+	define('EVENT_ESPRESSO_GATEWAY_URL', $uploads['baseurl'].DS.'espresso'.DS.'gateways'.DS);
141 141
 	// languages folder/path
142
-	define( 'EE_LANGUAGES_SAFE_LOC', '..' . DS . 'uploads' . DS . 'espresso' . DS . 'languages' . DS );
143
-	define( 'EE_LANGUAGES_SAFE_DIR', EVENT_ESPRESSO_UPLOAD_DIR . 'languages' . DS );
142
+	define('EE_LANGUAGES_SAFE_LOC', '..'.DS.'uploads'.DS.'espresso'.DS.'languages'.DS);
143
+	define('EE_LANGUAGES_SAFE_DIR', EVENT_ESPRESSO_UPLOAD_DIR.'languages'.DS);
144 144
 	//check for dompdf fonts in uploads
145
-	if ( file_exists( EVENT_ESPRESSO_UPLOAD_DIR . 'fonts' . DS ) ) {
146
-		define( 'DOMPDF_FONT_DIR', EVENT_ESPRESSO_UPLOAD_DIR . 'fonts' . DS );
145
+	if (file_exists(EVENT_ESPRESSO_UPLOAD_DIR.'fonts'.DS)) {
146
+		define('DOMPDF_FONT_DIR', EVENT_ESPRESSO_UPLOAD_DIR.'fonts'.DS);
147 147
 	}
148 148
 	//ajax constants
149
-	define( 'EE_FRONT_AJAX', isset( $_REQUEST[ 'ee_front_ajax' ] ) || isset( $_REQUEST[ 'data' ][ 'ee_front_ajax' ] ) ? true : false );
150
-	define( 'EE_ADMIN_AJAX', isset( $_REQUEST[ 'ee_admin_ajax' ] ) || isset( $_REQUEST[ 'data' ][ 'ee_admin_ajax' ] ) ? true : false );
149
+	define('EE_FRONT_AJAX', isset($_REQUEST['ee_front_ajax']) || isset($_REQUEST['data']['ee_front_ajax']) ? true : false);
150
+	define('EE_ADMIN_AJAX', isset($_REQUEST['ee_admin_ajax']) || isset($_REQUEST['data']['ee_admin_ajax']) ? true : false);
151 151
 	//just a handy constant occasionally needed for finding values representing infinity in the DB
152 152
 	//you're better to use this than its straight value (currently -1) in case you ever
153 153
 	//want to change its default value! or find when -1 means infinity
154
-	define( 'EE_INF_IN_DB', -1 );
155
-	define( 'EE_INF', INF > (float)PHP_INT_MAX ? INF : PHP_INT_MAX );
156
-	define( 'EE_DEBUG', false );
154
+	define('EE_INF_IN_DB', -1);
155
+	define('EE_INF', INF > (float) PHP_INT_MAX ? INF : PHP_INT_MAX);
156
+	define('EE_DEBUG', false);
157 157
 
158 158
 	/**
159 159
 	 *    espresso_plugin_activation
160 160
 	 *    adds a wp-option to indicate that EE has been activated via the WP admin plugins page
161 161
 	 */
162 162
 	function espresso_plugin_activation() {
163
-		update_option( 'ee_espresso_activation', true );
163
+		update_option('ee_espresso_activation', true);
164 164
 	}
165
-	register_activation_hook( EVENT_ESPRESSO_MAIN_FILE, 'espresso_plugin_activation' );
165
+	register_activation_hook(EVENT_ESPRESSO_MAIN_FILE, 'espresso_plugin_activation');
166 166
 
167 167
 
168 168
 
@@ -176,7 +176,7 @@  discard block
 block discarded – undo
176 176
 		//	}
177 177
 		//
178 178
 	}
179
-	register_deactivation_hook( EVENT_ESPRESSO_MAIN_FILE, 'espresso_plugin_deactivation' );
179
+	register_deactivation_hook(EVENT_ESPRESSO_MAIN_FILE, 'espresso_plugin_deactivation');
180 180
 
181 181
 
182 182
 
@@ -186,15 +186,15 @@  discard block
 block discarded – undo
186 186
 	 */
187 187
 	function espresso_load_error_handling() {
188 188
 		// load debugging tools
189
-		if ( WP_DEBUG === true && is_readable( EE_HELPERS . 'EEH_Debug_Tools.helper.php' ) ) {
190
-			require_once( EE_HELPERS . 'EEH_Debug_Tools.helper.php' );
189
+		if (WP_DEBUG === true && is_readable(EE_HELPERS.'EEH_Debug_Tools.helper.php')) {
190
+			require_once(EE_HELPERS.'EEH_Debug_Tools.helper.php');
191 191
 			EEH_Debug_Tools::instance();
192 192
 		}
193 193
 		// load error handling
194
-		if ( is_readable( EE_CORE . 'EE_Error.core.php' ) ) {
195
-			require_once( EE_CORE . 'EE_Error.core.php' );
194
+		if (is_readable(EE_CORE.'EE_Error.core.php')) {
195
+			require_once(EE_CORE.'EE_Error.core.php');
196 196
 		} else {
197
-			wp_die( __( 'The EE_Error core class could not be loaded.', 'event_espresso' ) );
197
+			wp_die(__('The EE_Error core class could not be loaded.', 'event_espresso'));
198 198
 		}
199 199
 	}
200 200
 
@@ -208,25 +208,25 @@  discard block
 block discarded – undo
208 208
 	 * @param    string $full_path_to_file
209 209
 	 * @throws    EE_Error
210 210
 	 */
211
-	function espresso_load_required( $classname, $full_path_to_file ) {
211
+	function espresso_load_required($classname, $full_path_to_file) {
212 212
 		static $error_handling_loaded = false;
213
-		if ( ! $error_handling_loaded ) {
213
+		if ( ! $error_handling_loaded) {
214 214
 			espresso_load_error_handling();
215 215
 			$error_handling_loaded = true;
216 216
 		}
217
-		if ( is_readable( $full_path_to_file ) ) {
218
-			require_once( $full_path_to_file );
217
+		if (is_readable($full_path_to_file)) {
218
+			require_once($full_path_to_file);
219 219
 		} else {
220
-			throw new EE_Error ( sprintf(
221
-				__( 'The %s class file could not be located or is not readable due to file permissions.', 'event_espresso' ),
220
+			throw new EE_Error(sprintf(
221
+				__('The %s class file could not be located or is not readable due to file permissions.', 'event_espresso'),
222 222
 				$classname
223
-			) );
223
+			));
224 224
 		}
225 225
 	}
226 226
 
227
-	espresso_load_required( 'EEH_Base', EE_CORE . 'helpers' . DS . 'EEH_Base.helper.php' );
228
-	espresso_load_required( 'EEH_File', EE_CORE . 'helpers' . DS . 'EEH_File.helper.php' );
229
-	espresso_load_required( 'EE_Bootstrap', EE_CORE . 'EE_Bootstrap.core.php' );
227
+	espresso_load_required('EEH_Base', EE_CORE.'helpers'.DS.'EEH_Base.helper.php');
228
+	espresso_load_required('EEH_File', EE_CORE.'helpers'.DS.'EEH_File.helper.php');
229
+	espresso_load_required('EE_Bootstrap', EE_CORE.'EE_Bootstrap.core.php');
230 230
 	new EE_Bootstrap();
231 231
 
232 232
 
@@ -235,7 +235,7 @@  discard block
 block discarded – undo
235 235
 
236 236
 
237 237
 
238
-if ( ! function_exists( 'espresso_deactivate_plugin' ) ) {
238
+if ( ! function_exists('espresso_deactivate_plugin')) {
239 239
 	/**
240 240
 	*    deactivate_plugin
241 241
 	* usage:  espresso_deactivate_plugin( plugin_basename( __FILE__ ));
@@ -244,11 +244,11 @@  discard block
 block discarded – undo
244 244
 	* @param string $plugin_basename - the results of plugin_basename( __FILE__ ) for the plugin's main file
245 245
 	* @return    void
246 246
 	*/
247
-	function espresso_deactivate_plugin( $plugin_basename = '' ) {
248
-		if ( ! function_exists( 'deactivate_plugins' ) ) {
249
-			require_once( ABSPATH . 'wp-admin/includes/plugin.php' );
247
+	function espresso_deactivate_plugin($plugin_basename = '') {
248
+		if ( ! function_exists('deactivate_plugins')) {
249
+			require_once(ABSPATH.'wp-admin/includes/plugin.php');
250 250
 		}
251
-		unset( $_GET[ 'activate' ], $_REQUEST[ 'activate' ] );
252
-		deactivate_plugins( $plugin_basename );
251
+		unset($_GET['activate'], $_REQUEST['activate']);
252
+		deactivate_plugins($plugin_basename);
253 253
 	}
254 254
 }
Please login to merge, or discard this patch.
modules/bot_trap/EED_Bot_Trap.module.php 2 patches
Indentation   +57 added lines, -57 removed lines patch added patch discarded remove patch
@@ -30,11 +30,11 @@  discard block
 block discarded – undo
30 30
 	 *  @return 	void
31 31
 	 */
32 32
 	public static function set_hooks() {
33
-        if (
33
+		if (
34 34
 			apply_filters( 'FHEE__EED_Bot_Trap__set_hooks__use_bot_trap', true ) &&
35 35
 			\EE_Registry::instance()->CFG->registration->use_bot_trap
36 36
 		) {
37
-            \EED_Bot_Trap::set_trap();
37
+			\EED_Bot_Trap::set_trap();
38 38
 			// redirect bots to bogus success page
39 39
 			\EE_Config::register_route( 'ticket_selection_received', 'EED_Bot_Trap', 'display_bot_trap_success' );
40 40
 		}
@@ -49,18 +49,18 @@  discard block
 block discarded – undo
49 49
 	 *  @return 	void
50 50
 	 */
51 51
 	public static function set_trap() {
52
-        define('EE_BOT_TRAP_BASE_URL', plugin_dir_url(__FILE__) . DS);
53
-        add_action(
54
-            'AHEE__ticket_selector_chart__template__after_ticket_selector',
55
-            array('EED_Bot_Trap', 'generate_bot_trap'),
56
-            10, 2
57
-        );
58
-        add_action(
59
-            'EED_Ticket_Selector__process_ticket_selections__before',
60
-            array('EED_Bot_Trap', 'process_bot_trap'),
61
-            1, 2
62
-        );
63
-    }
52
+		define('EE_BOT_TRAP_BASE_URL', plugin_dir_url(__FILE__) . DS);
53
+		add_action(
54
+			'AHEE__ticket_selector_chart__template__after_ticket_selector',
55
+			array('EED_Bot_Trap', 'generate_bot_trap'),
56
+			10, 2
57
+		);
58
+		add_action(
59
+			'EED_Ticket_Selector__process_ticket_selections__before',
60
+			array('EED_Bot_Trap', 'process_bot_trap'),
61
+			1, 2
62
+		);
63
+	}
64 64
 
65 65
 
66 66
 
@@ -71,15 +71,15 @@  discard block
 block discarded – undo
71 71
 	 *  @return 	void
72 72
 	 */
73 73
 	public static function set_hooks_admin() {
74
-        if (
75
-            defined('DOING_AJAX')
76
-            && DOING_AJAX
77
-            && apply_filters('FHEE__EED_Bot_Trap__set_hooks__use_bot_trap', true)
78
-            && \EE_Registry::instance()->CFG->registration->use_bot_trap
79
-        ) {
80
-            \EED_Bot_Trap::set_trap();
81
-        }
82
-        add_action(
74
+		if (
75
+			defined('DOING_AJAX')
76
+			&& DOING_AJAX
77
+			&& apply_filters('FHEE__EED_Bot_Trap__set_hooks__use_bot_trap', true)
78
+			&& \EE_Registry::instance()->CFG->registration->use_bot_trap
79
+		) {
80
+			\EED_Bot_Trap::set_trap();
81
+		}
82
+		add_action(
83 83
 			'AHEE__Extend_Registration_Form_Admin_Page___reg_form_settings_template',
84 84
 			array( 'EED_Bot_Trap', 'bot_trap_settings_form' ),
85 85
 			10
@@ -129,23 +129,23 @@  discard block
 block discarded – undo
129 129
 
130 130
 
131 131
 	/**
132
-     * process_bot_trap
133
-     *
134
-     * @param array|string $triggered_trap_callback Callback that will be executed for handling the
135
-     *                                              response if the bot trap is triggered.
136
-     *                                              It should receive one argument: a boolean indicating
137
-     *                                              whether the trap was triggered by suspicious timing or not.
132
+	 * process_bot_trap
133
+	 *
134
+	 * @param array|string $triggered_trap_callback Callback that will be executed for handling the
135
+	 *                                              response if the bot trap is triggered.
136
+	 *                                              It should receive one argument: a boolean indicating
137
+	 *                                              whether the trap was triggered by suspicious timing or not.
138 138
 	 */
139 139
 	public static function process_bot_trap( $triggered_trap_callback = array() ) {
140
-        // what's your email address Mr. Bot ?
140
+		// what's your email address Mr. Bot ?
141 141
 		$empty_trap = isset( $_REQUEST[ 'tkt-slctr-request-processor-email' ] )
142
-                      && $_REQUEST[ 'tkt-slctr-request-processor-email' ] === ''
143
-            ? true
144
-            : false;
142
+					  && $_REQUEST[ 'tkt-slctr-request-processor-email' ] === ''
143
+			? true
144
+			: false;
145 145
 		// get encrypted timestamp for when the form was originally displayed
146 146
 		$bot_trap_timestamp = isset( $_REQUEST[ 'tkt-slctr-request-processor-token' ] )
147
-            ? sanitize_text_field( $_REQUEST[ 'tkt-slctr-request-processor-token' ] )
148
-            : '';
147
+			? sanitize_text_field( $_REQUEST[ 'tkt-slctr-request-processor-token' ] )
148
+			: '';
149 149
 		// decrypt and convert to absolute  integer
150 150
 		if ( EE_Registry::instance()->CFG->registration->use_encryption ) {
151 151
 			EE_Registry::instance()->load_core( 'EE_Encryption' );
@@ -155,17 +155,17 @@  discard block
 block discarded – undo
155 155
 		}
156 156
 		// ticket form submitted too impossibly fast ( after now ) or more than an hour later ???
157 157
 		$suspicious_timing = $bot_trap_timestamp > time() || $bot_trap_timestamp < ( time() - HOUR_IN_SECONDS )
158
-            ? true
159
-            : false;
158
+			? true
159
+			: false;
160 160
 		// are we human ?
161 161
 		if ( $empty_trap && ! $suspicious_timing ) {
162
-		    do_action('AHEE__EED_Bot_Trap__process_bot_trap__trap_not_triggered');
162
+			do_action('AHEE__EED_Bot_Trap__process_bot_trap__trap_not_triggered');
163 163
 			return;
164 164
 		}
165 165
 		// check the given callback is valid first before executing
166 166
 		if ( ! is_callable($triggered_trap_callback ) ) {
167 167
 			// invalid callback so lets just sub in our default.
168
-            $triggered_trap_callback = array( 'EED_Bot_Trap', 'triggered_trap_response' );
168
+			$triggered_trap_callback = array( 'EED_Bot_Trap', 'triggered_trap_response' );
169 169
 		}
170 170
 		call_user_func_array($triggered_trap_callback, array( $suspicious_timing ) );
171 171
 	}
@@ -191,21 +191,21 @@  discard block
 block discarded – undo
191 191
 			);
192 192
 		}
193 193
 		$redirect_url = apply_filters('FHEE__EED_Bot_Trap__process_bot_trap__redirect_url', $redirect_url);
194
-        // if AJAX, return the redirect URL
195
-        if (defined('DOING_AJAX') && DOING_AJAX) {
196
-            echo json_encode(
197
-                array_merge(
198
-                    \EE_Error::get_notices(false),
199
-                    array(
200
-                       'redirect_url' => $redirect_url
201
-                    )
202
-                )
203
-            );
204
-            exit();
205
-        }
206
-        wp_safe_redirect($redirect_url);
207
-        exit();
208
-    }
194
+		// if AJAX, return the redirect URL
195
+		if (defined('DOING_AJAX') && DOING_AJAX) {
196
+			echo json_encode(
197
+				array_merge(
198
+					\EE_Error::get_notices(false),
199
+					array(
200
+					   'redirect_url' => $redirect_url
201
+					)
202
+				)
203
+			);
204
+			exit();
205
+		}
206
+		wp_safe_redirect($redirect_url);
207
+		exit();
208
+	}
209 209
 
210 210
 
211 211
 
@@ -236,9 +236,9 @@  discard block
 block discarded – undo
236 236
 	 * @return    void
237 237
 	 */
238 238
 	public static function bot_trap_settings_form() {
239
-        EED_Bot_Trap::_bot_trap_settings_form()->enqueue_js();
240
-        echo EED_Bot_Trap::_bot_trap_settings_form()->get_html();
241
-    }
239
+		EED_Bot_Trap::_bot_trap_settings_form()->enqueue_js();
240
+		echo EED_Bot_Trap::_bot_trap_settings_form()->get_html();
241
+	}
242 242
 
243 243
 
244 244
 
Please login to merge, or discard this patch.
Spacing   +51 added lines, -51 removed lines patch added patch discarded remove patch
@@ -18,7 +18,7 @@  discard block
 block discarded – undo
18 18
 	 * @return EED_Bot_Trap
19 19
 	 */
20 20
 	public static function instance() {
21
-		return parent::get_instance( __CLASS__ );
21
+		return parent::get_instance(__CLASS__);
22 22
 	}
23 23
 
24 24
 
@@ -31,12 +31,12 @@  discard block
 block discarded – undo
31 31
 	 */
32 32
 	public static function set_hooks() {
33 33
         if (
34
-			apply_filters( 'FHEE__EED_Bot_Trap__set_hooks__use_bot_trap', true ) &&
34
+			apply_filters('FHEE__EED_Bot_Trap__set_hooks__use_bot_trap', true) &&
35 35
 			\EE_Registry::instance()->CFG->registration->use_bot_trap
36 36
 		) {
37 37
             \EED_Bot_Trap::set_trap();
38 38
 			// redirect bots to bogus success page
39
-			\EE_Config::register_route( 'ticket_selection_received', 'EED_Bot_Trap', 'display_bot_trap_success' );
39
+			\EE_Config::register_route('ticket_selection_received', 'EED_Bot_Trap', 'display_bot_trap_success');
40 40
 		}
41 41
 	}
42 42
 
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
 	 *  @return 	void
50 50
 	 */
51 51
 	public static function set_trap() {
52
-        define('EE_BOT_TRAP_BASE_URL', plugin_dir_url(__FILE__) . DS);
52
+        define('EE_BOT_TRAP_BASE_URL', plugin_dir_url(__FILE__).DS);
53 53
         add_action(
54 54
             'AHEE__ticket_selector_chart__template__after_ticket_selector',
55 55
             array('EED_Bot_Trap', 'generate_bot_trap'),
@@ -81,12 +81,12 @@  discard block
 block discarded – undo
81 81
         }
82 82
         add_action(
83 83
 			'AHEE__Extend_Registration_Form_Admin_Page___reg_form_settings_template',
84
-			array( 'EED_Bot_Trap', 'bot_trap_settings_form' ),
84
+			array('EED_Bot_Trap', 'bot_trap_settings_form'),
85 85
 			10
86 86
 		);
87 87
 		add_filter(
88 88
 			'FHEE__Extend_Registration_Form_Admin_Page___update_reg_form_settings__CFG_registration',
89
-			array( 'EED_Bot_Trap', 'update_bot_trap_settings_form' ),
89
+			array('EED_Bot_Trap', 'update_bot_trap_settings_form'),
90 90
 			10, 1
91 91
 		);
92 92
 	}
@@ -100,7 +100,7 @@  discard block
 block discarded – undo
100 100
 	 * @param    WP $WP
101 101
 	 * @return    void
102 102
 	 */
103
-	public function run( $WP ) {}
103
+	public function run($WP) {}
104 104
 
105 105
 
106 106
 
@@ -111,14 +111,14 @@  discard block
 block discarded – undo
111 111
 	 * @return    void
112 112
 	 */
113 113
 	public static function generate_bot_trap() {
114
-		$do_not_enter = esc_html__( 'please do not enter anything in this input', 'event_espresso' );
114
+		$do_not_enter = esc_html__('please do not enter anything in this input', 'event_espresso');
115 115
 		$html = '<div id="tkt-slctr-request-processor-dv" style="float:left; margin-left:-999em;">';
116
-		$html .= '<label for="tkt-slctr-request-processor-email">' . $do_not_enter  . '</label>';
116
+		$html .= '<label for="tkt-slctr-request-processor-email">'.$do_not_enter.'</label>';
117 117
 		$html .= '<input type="email" name="tkt-slctr-request-processor-email" value=""/>';
118 118
 		$html .= '<input type="hidden" name="tkt-slctr-request-processor-token" value="';
119
-		if ( EE_Registry::instance()->CFG->registration->use_encryption ) {
120
-			EE_Registry::instance()->load_core( 'EE_Encryption' );
121
-			$html .= EE_Encryption::instance()->encrypt( time() );
119
+		if (EE_Registry::instance()->CFG->registration->use_encryption) {
120
+			EE_Registry::instance()->load_core('EE_Encryption');
121
+			$html .= EE_Encryption::instance()->encrypt(time());
122 122
 		} else {
123 123
 			$html .= time();
124 124
 		}
@@ -136,38 +136,38 @@  discard block
 block discarded – undo
136 136
      *                                              It should receive one argument: a boolean indicating
137 137
      *                                              whether the trap was triggered by suspicious timing or not.
138 138
 	 */
139
-	public static function process_bot_trap( $triggered_trap_callback = array() ) {
139
+	public static function process_bot_trap($triggered_trap_callback = array()) {
140 140
         // what's your email address Mr. Bot ?
141
-		$empty_trap = isset( $_REQUEST[ 'tkt-slctr-request-processor-email' ] )
142
-                      && $_REQUEST[ 'tkt-slctr-request-processor-email' ] === ''
141
+		$empty_trap = isset($_REQUEST['tkt-slctr-request-processor-email'])
142
+                      && $_REQUEST['tkt-slctr-request-processor-email'] === ''
143 143
             ? true
144 144
             : false;
145 145
 		// get encrypted timestamp for when the form was originally displayed
146
-		$bot_trap_timestamp = isset( $_REQUEST[ 'tkt-slctr-request-processor-token' ] )
147
-            ? sanitize_text_field( $_REQUEST[ 'tkt-slctr-request-processor-token' ] )
146
+		$bot_trap_timestamp = isset($_REQUEST['tkt-slctr-request-processor-token'])
147
+            ? sanitize_text_field($_REQUEST['tkt-slctr-request-processor-token'])
148 148
             : '';
149 149
 		// decrypt and convert to absolute  integer
150
-		if ( EE_Registry::instance()->CFG->registration->use_encryption ) {
151
-			EE_Registry::instance()->load_core( 'EE_Encryption' );
152
-			$bot_trap_timestamp = absint( EE_Encryption::instance()->decrypt( $bot_trap_timestamp ) );
150
+		if (EE_Registry::instance()->CFG->registration->use_encryption) {
151
+			EE_Registry::instance()->load_core('EE_Encryption');
152
+			$bot_trap_timestamp = absint(EE_Encryption::instance()->decrypt($bot_trap_timestamp));
153 153
 		} else {
154
-			$bot_trap_timestamp = absint( $bot_trap_timestamp );
154
+			$bot_trap_timestamp = absint($bot_trap_timestamp);
155 155
 		}
156 156
 		// ticket form submitted too impossibly fast ( after now ) or more than an hour later ???
157
-		$suspicious_timing = $bot_trap_timestamp > time() || $bot_trap_timestamp < ( time() - HOUR_IN_SECONDS )
157
+		$suspicious_timing = $bot_trap_timestamp > time() || $bot_trap_timestamp < (time() - HOUR_IN_SECONDS)
158 158
             ? true
159 159
             : false;
160 160
 		// are we human ?
161
-		if ( $empty_trap && ! $suspicious_timing ) {
161
+		if ($empty_trap && ! $suspicious_timing) {
162 162
 		    do_action('AHEE__EED_Bot_Trap__process_bot_trap__trap_not_triggered');
163 163
 			return;
164 164
 		}
165 165
 		// check the given callback is valid first before executing
166
-		if ( ! is_callable($triggered_trap_callback ) ) {
166
+		if ( ! is_callable($triggered_trap_callback)) {
167 167
 			// invalid callback so lets just sub in our default.
168
-            $triggered_trap_callback = array( 'EED_Bot_Trap', 'triggered_trap_response' );
168
+            $triggered_trap_callback = array('EED_Bot_Trap', 'triggered_trap_response');
169 169
 		}
170
-		call_user_func_array($triggered_trap_callback, array( $suspicious_timing ) );
170
+		call_user_func_array($triggered_trap_callback, array($suspicious_timing));
171 171
 	}
172 172
 
173 173
 
@@ -178,15 +178,15 @@  discard block
 block discarded – undo
178 178
 	 *
179 179
 	 * @param bool  $suspicious_timing  If true, then the bot trap was triggered due to the suspicious timing test.
180 180
 	 */
181
-	public static function triggered_trap_response( $suspicious_timing ) {
181
+	public static function triggered_trap_response($suspicious_timing) {
182 182
 		// UH OH...
183 183
 		$redirect_url = add_query_arg(
184
-			array( 'ee' => 'ticket_selection_received' ),
184
+			array('ee' => 'ticket_selection_received'),
185 185
 			EE_Registry::instance()->CFG->core->reg_page_url()
186 186
 		);
187
-		if ( $suspicious_timing ) {
187
+		if ($suspicious_timing) {
188 188
 			$redirect_url = add_query_arg(
189
-				array( 'ee-notice' => urlencode( esc_html__( 'We\'re sorry, but your ticket selections could not be processed due to a server timing error. Please hit the back button on your browser and try again.', 'event_espresso' ) ) ),
189
+				array('ee-notice' => urlencode(esc_html__('We\'re sorry, but your ticket selections could not be processed due to a server timing error. Please hit the back button on your browser and try again.', 'event_espresso'))),
190 190
 				$redirect_url
191 191
 			);
192 192
 		}
@@ -217,10 +217,10 @@  discard block
 block discarded – undo
217 217
 	 * @return    void
218 218
 	 */
219 219
 	public static function display_bot_trap_success() {
220
-		add_filter( 'FHEE__EED_Single_Page_Checkout__run', '__return_false' );
221
-		$bot_notice = esc_html__( 'Thank you so much. Your ticket selections have been received for consideration.', 'event_espresso' );
222
-		$bot_notice = isset( $_REQUEST[ 'ee-notice' ] ) && $_REQUEST[ 'ee-notice' ] !== '' ? sanitize_text_field( stripslashes( $_REQUEST[ 'ee-notice' ] ) ) : $bot_notice;
223
-		EE_Registry::instance()->REQ->add_output( EEH_HTML::div( $bot_notice, '', 'ee-attention' ) );
220
+		add_filter('FHEE__EED_Single_Page_Checkout__run', '__return_false');
221
+		$bot_notice = esc_html__('Thank you so much. Your ticket selections have been received for consideration.', 'event_espresso');
222
+		$bot_notice = isset($_REQUEST['ee-notice']) && $_REQUEST['ee-notice'] !== '' ? sanitize_text_field(stripslashes($_REQUEST['ee-notice'])) : $bot_notice;
223
+		EE_Registry::instance()->REQ->add_output(EEH_HTML::div($bot_notice, '', 'ee-attention'));
224 224
 	}
225 225
 
226 226
 
@@ -255,20 +255,20 @@  discard block
 block discarded – undo
255 255
 				'html_id'         			=> 'bot_trap_settings',
256 256
 				'layout_strategy' 	=> new EE_Admin_Two_Column_Layout(),
257 257
 				'subsections'     		=> array(
258
-					'bot_trap_hdr' 		=> new EE_Form_Section_HTML( EEH_HTML::h2( esc_html__( 'Bot Trap Settings', 'event_espresso' ) ) ),
258
+					'bot_trap_hdr' 		=> new EE_Form_Section_HTML(EEH_HTML::h2(esc_html__('Bot Trap Settings', 'event_espresso'))),
259 259
 					'use_bot_trap' 		=> new EE_Yes_No_Input(
260 260
 						array(
261
-							'html_label_text' 	=> esc_html__( 'Enable Bot Trap', 'event_espresso' ),
262
-							'html_help_text' 		=>  esc_html__( 'The Event Espresso Bot Trap will insert a fake input into your Ticket Selector forms that is hidden from regular site visitors, but visible to spam bots. Because the input asks for an email address, it is irresistible to spam bots who will of course enter text into it. Since regular site visitors can not see this input, any value detected during form submission means a bot has been detected, which will then be blocked from submitting the form.', 'event_espresso' ),
263
-							'default'        			=> isset( EE_Registry::instance()->CFG->registration->use_bot_trap ) ? EE_Registry::instance()->CFG->registration->use_bot_trap : true,
261
+							'html_label_text' 	=> esc_html__('Enable Bot Trap', 'event_espresso'),
262
+							'html_help_text' 		=>  esc_html__('The Event Espresso Bot Trap will insert a fake input into your Ticket Selector forms that is hidden from regular site visitors, but visible to spam bots. Because the input asks for an email address, it is irresistible to spam bots who will of course enter text into it. Since regular site visitors can not see this input, any value detected during form submission means a bot has been detected, which will then be blocked from submitting the form.', 'event_espresso'),
263
+							'default'        			=> isset(EE_Registry::instance()->CFG->registration->use_bot_trap) ? EE_Registry::instance()->CFG->registration->use_bot_trap : true,
264 264
 							'required'        		=> false
265 265
 						)
266 266
 					),
267 267
 					'use_encryption' 		=> new EE_Yes_No_Input(
268 268
 						array(
269
-							'html_label_text' 	=> esc_html__( 'Encrypt Bot Trap Data', 'event_espresso' ),
270
-							'html_help_text' 		=>  esc_html__( 'One way to detect spam bots is by looking at how long it takes them to submit a form. They are often inhumanly fast, or will submit forms hours, days, or even weeks after the form was first scraped off the web. The Event Espresso Bot Trap will send a timestamp with the Ticket Selector form when it is submitted. By default, this timestamp is encrypted so that the spam bots can not change it, but encryption may cause issues on some servers due to configuration "conflicts". If you continuously get caught in the bot trap, then try setting this option to "No". This may increase the number of spam submissions you receive, but increases server compatibility.', 'event_espresso' ),
271
-							'default'        			=> isset( EE_Registry::instance()->CFG->registration->use_encryption ) ? EE_Registry::instance()->CFG->registration->use_encryption : true,
269
+							'html_label_text' 	=> esc_html__('Encrypt Bot Trap Data', 'event_espresso'),
270
+							'html_help_text' 		=>  esc_html__('One way to detect spam bots is by looking at how long it takes them to submit a form. They are often inhumanly fast, or will submit forms hours, days, or even weeks after the form was first scraped off the web. The Event Espresso Bot Trap will send a timestamp with the Ticket Selector form when it is submitted. By default, this timestamp is encrypted so that the spam bots can not change it, but encryption may cause issues on some servers due to configuration "conflicts". If you continuously get caught in the bot trap, then try setting this option to "No". This may increase the number of spam submissions you receive, but increases server compatibility.', 'event_espresso'),
271
+							'default'        			=> isset(EE_Registry::instance()->CFG->registration->use_encryption) ? EE_Registry::instance()->CFG->registration->use_encryption : true,
272 272
 							'required'        		=> false
273 273
 						)
274 274
 					),
@@ -286,30 +286,30 @@  discard block
 block discarded – undo
286 286
 	 * @param \EE_Registration_Config $EE_Registration_Config
287 287
 	 * @return \EE_Registration_Config
288 288
 	 */
289
-	public static function update_bot_trap_settings_form( EE_Registration_Config $EE_Registration_Config ) {
289
+	public static function update_bot_trap_settings_form(EE_Registration_Config $EE_Registration_Config) {
290 290
 		try {
291 291
 			$bot_trap_settings_form = EED_Bot_Trap::_bot_trap_settings_form();
292 292
 			// if not displaying a form, then check for form submission
293
-			if ( $bot_trap_settings_form->was_submitted() ) {
293
+			if ($bot_trap_settings_form->was_submitted()) {
294 294
 				// capture form data
295 295
 				$bot_trap_settings_form->receive_form_submission();
296 296
 				// validate form data
297
-				if ( $bot_trap_settings_form->is_valid() ) {
297
+				if ($bot_trap_settings_form->is_valid()) {
298 298
 					// grab validated data from form
299 299
 					$valid_data = $bot_trap_settings_form->valid_data();
300
-					if ( isset( $valid_data[ 'use_bot_trap' ], $valid_data[ 'use_encryption' ] ) ) {
301
-						$EE_Registration_Config->use_bot_trap = $valid_data[ 'use_bot_trap' ];
302
-						$EE_Registration_Config->use_encryption = $valid_data[ 'use_encryption' ];
300
+					if (isset($valid_data['use_bot_trap'], $valid_data['use_encryption'])) {
301
+						$EE_Registration_Config->use_bot_trap = $valid_data['use_bot_trap'];
302
+						$EE_Registration_Config->use_encryption = $valid_data['use_encryption'];
303 303
 					} else {
304
-						EE_Error::add_error( esc_html__( 'Invalid or missing Bot Trap settings. Please refresh the form and try again.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
304
+						EE_Error::add_error(esc_html__('Invalid or missing Bot Trap settings. Please refresh the form and try again.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
305 305
 					}
306 306
 				} else {
307
-					if ( $bot_trap_settings_form->submission_error_message() != '' ) {
308
-						EE_Error::add_error( $bot_trap_settings_form->submission_error_message(), __FILE__, __FUNCTION__, __LINE__ );
307
+					if ($bot_trap_settings_form->submission_error_message() != '') {
308
+						EE_Error::add_error($bot_trap_settings_form->submission_error_message(), __FILE__, __FUNCTION__, __LINE__);
309 309
 					}
310 310
 				}
311 311
 			}
312
-		} catch ( EE_Error $e ) {
312
+		} catch (EE_Error $e) {
313 313
 			$e->get_error();
314 314
 		}
315 315
 		return $EE_Registration_Config;
Please login to merge, or discard this patch.