Completed
Branch BUG-8698-ticket-sellouts (330ec2)
by
unknown
34:27 queued 16:21
created
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/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.
modules/ticket_selector/EED_Ticket_Selector.module.php 3 patches
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.
Doc Comments   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -540,7 +540,7 @@  discard block
 block discarded – undo
540 540
 	 *
541 541
 	 * @access        public
542 542
 	 * @access        public
543
-	 * @return        string
543
+	 * @return        false|null
544 544
 	 */
545 545
 	public static function cancel_ticket_selections() {
546 546
 		// check nonce
@@ -606,7 +606,7 @@  discard block
 block discarded – undo
606 606
 	 * 	process_ticket_selections
607 607
 	 *
608 608
 	 *	@access public
609
-	 * 	@return array|boolean
609
+	 * 	@return boolean|null
610 610
 	 */
611 611
 	public function process_ticket_selections() {
612 612
         do_action( 'EED_Ticket_Selector__process_ticket_selections__before' );
@@ -747,7 +747,7 @@  discard block
 block discarded – undo
747 747
 	 *    validate_post_data
748 748
 	 *
749 749
 	 * @access        private
750
-	 * @return        array  or FALSE
750
+	 * @return        string  or FALSE
751 751
 	 */
752 752
 	private static function _validate_post_data() {
753 753
 		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
Please login to merge, or discard this patch.
Spacing   +229 added lines, -229 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,15 +80,15 @@  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
-		EE_Config::register_route( 'cancel_ticket_selections', 'EED_Ticket_Selector', 'cancel_ticket_selections' );
86
-		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
+		EE_Config::register_route('cancel_ticket_selections', 'EED_Ticket_Selector', 'cancel_ticket_selections');
86
+		add_action('wp_loaded', array('EED_Ticket_Selector', 'set_definitions'), 2);
87 87
 		//add_action( 'AHEE_event_details_before_post', array( 'EED_Ticket_Selector', 'ticket_selector_form_open' ), 10, 1 );
88
-		add_action( 'AHEE_event_details_header_bottom', array( 'EED_Ticket_Selector', 'display_ticket_selector' ), 10, 1 );
88
+		add_action('AHEE_event_details_header_bottom', array('EED_Ticket_Selector', 'display_ticket_selector'), 10, 1);
89 89
 		//add_action( 'AHEE__ticket_selector_chart__template__after_ticket_selector', array( 'EED_Ticket_Selector', 'display_ticket_selector_submit' ), 10, 1 );
90 90
 		//add_action( 'AHEE_event_details_after_post', array( 'EED_Ticket_Selector', 'ticket_selector_form_close' ), 10 );
91
-		add_action( 'wp_enqueue_scripts', array( 'EED_Ticket_Selector', 'load_tckt_slctr_assets' ), 10 );
91
+		add_action('wp_enqueue_scripts', array('EED_Ticket_Selector', 'load_tckt_slctr_assets'), 10);
92 92
 	}
93 93
 
94 94
 
@@ -100,10 +100,10 @@  discard block
 block discarded – undo
100 100
 	 *  @return 	void
101 101
 	 */
102 102
 	public static function set_hooks_admin() {
103
-		add_action( 'wp_loaded', array( 'EED_Ticket_Selector', 'set_definitions' ), 2 );
103
+		add_action('wp_loaded', array('EED_Ticket_Selector', 'set_definitions'), 2);
104 104
 		//add button for iframe code to event editor.
105
-		add_filter( 'get_sample_permalink_html', array( 'EED_Ticket_Selector', 'iframe_code_button' ), 10, 4 );
106
-		add_action( 'admin_enqueue_scripts', array( 'EED_Ticket_Selector', 'load_tckt_slctr_assets_admin' ), 10 );
105
+		add_filter('get_sample_permalink_html', array('EED_Ticket_Selector', 'iframe_code_button'), 10, 4);
106
+		add_action('admin_enqueue_scripts', array('EED_Ticket_Selector', 'load_tckt_slctr_assets_admin'), 10);
107 107
 	}
108 108
 
109 109
 
@@ -115,15 +115,15 @@  discard block
 block discarded – undo
115 115
 	 *  @return 	void
116 116
 	 */
117 117
 	public static function set_definitions() {
118
-		define( 'TICKET_SELECTOR_ASSETS_URL', plugin_dir_url( __FILE__ ) . 'assets' . DS );
119
-		define( 'TICKET_SELECTOR_TEMPLATES_PATH', str_replace( '\\', DS, plugin_dir_path( __FILE__ )) . 'templates' . DS );
118
+		define('TICKET_SELECTOR_ASSETS_URL', plugin_dir_url(__FILE__).'assets'.DS);
119
+		define('TICKET_SELECTOR_TEMPLATES_PATH', str_replace('\\', DS, plugin_dir_path(__FILE__)).'templates'.DS);
120 120
 
121 121
 		//if config is not set, initialize
122 122
 		//If config is not set, set it.
123
-		if ( ! isset( EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector ) ) {
123
+		if ( ! isset(EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector)) {
124 124
 			EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector = new EE_Ticket_Selector_Config();
125 125
 		}
126
-		EE_Registry::$i18n_js_strings[ 'ts_embed_iframe_title' ] = __( 'Copy and Paste the following:', 'event_espresso' );
126
+		EE_Registry::$i18n_js_strings['ts_embed_iframe_title'] = __('Copy and Paste the following:', 'event_espresso');
127 127
 	}
128 128
 
129 129
 
@@ -134,7 +134,7 @@  discard block
 block discarded – undo
134 134
 	 * 	@param	object 			$WP
135 135
 	 * 	@return 	void
136 136
 	 */
137
-	public function run( $WP ) {}
137
+	public function run($WP) {}
138 138
 
139 139
 
140 140
 	/**
@@ -146,23 +146,23 @@  discard block
 block discarded – undo
146 146
 	public function ticket_selector_iframe() {
147 147
 		self::$_in_iframe = true;
148 148
 		/** @type EEM_Event $EEM_Event */
149
-		$EEM_Event = EE_Registry::instance()->load_model( 'Event' );
149
+		$EEM_Event = EE_Registry::instance()->load_model('Event');
150 150
 		$event = $EEM_Event->get_one_by_ID(
151
-			EE_Registry::instance()->REQ->get( 'event', 0 )
151
+			EE_Registry::instance()->REQ->get('event', 0)
152 152
 		);
153
-		EE_Registry::instance()->REQ->set_espresso_page( true );
154
-		$template_args['ticket_selector'] = EED_Ticket_Selector::display_ticket_selector( $event );
153
+		EE_Registry::instance()->REQ->set_espresso_page(true);
154
+		$template_args['ticket_selector'] = EED_Ticket_Selector::display_ticket_selector($event);
155 155
 		$template_args['css'] = apply_filters(
156 156
 			'FHEE__EED_Ticket_Selector__ticket_selector_iframe__css',
157 157
 			array(
158
-				TICKET_SELECTOR_ASSETS_URL . 'ticket_selector_embed.css?ver=' . EVENT_ESPRESSO_VERSION,
159
-				TICKET_SELECTOR_ASSETS_URL . 'ticket_selector.css?ver=' . EVENT_ESPRESSO_VERSION,
160
-				includes_url( 'css/dashicons.min.css?ver=' . $GLOBALS['wp_version'] ),
161
-				EE_GLOBAL_ASSETS_URL . 'css/espresso_default.css?ver=' . EVENT_ESPRESSO_VERSION
158
+				TICKET_SELECTOR_ASSETS_URL.'ticket_selector_embed.css?ver='.EVENT_ESPRESSO_VERSION,
159
+				TICKET_SELECTOR_ASSETS_URL.'ticket_selector.css?ver='.EVENT_ESPRESSO_VERSION,
160
+				includes_url('css/dashicons.min.css?ver='.$GLOBALS['wp_version']),
161
+				EE_GLOBAL_ASSETS_URL.'css/espresso_default.css?ver='.EVENT_ESPRESSO_VERSION
162 162
 			)
163 163
 		);
164
-		EE_Registry::$i18n_js_strings[ 'ticket_selector_iframe' ] = true;
165
-		EE_Registry::$i18n_js_strings[ 'EEDTicketSelectorMsg' ] = __( 'Please choose at least one ticket before continuing.', 'event_espresso' );
164
+		EE_Registry::$i18n_js_strings['ticket_selector_iframe'] = true;
165
+		EE_Registry::$i18n_js_strings['EEDTicketSelectorMsg'] = __('Please choose at least one ticket before continuing.', 'event_espresso');
166 166
 		$template_args['eei18n'] = apply_filters(
167 167
 			'FHEE__EED_Ticket_Selector__ticket_selector_iframe__eei18n_js_strings',
168 168
 			EE_Registry::localize_i18n_js_strings()
@@ -170,18 +170,18 @@  discard block
 block discarded – undo
170 170
 		$template_args['js'] = apply_filters(
171 171
 			'FHEE__EED_Ticket_Selector__ticket_selector_iframe__js',
172 172
 			array(
173
-				includes_url( 'js/jquery/jquery.js?ver=' . $GLOBALS['wp_version'] ),
174
-				EE_GLOBAL_ASSETS_URL . 'scripts/espresso_core.js?ver=' . EVENT_ESPRESSO_VERSION,
175
-				TICKET_SELECTOR_ASSETS_URL . 'ticket_selector_iframe_embed.js?ver=' . EVENT_ESPRESSO_VERSION
173
+				includes_url('js/jquery/jquery.js?ver='.$GLOBALS['wp_version']),
174
+				EE_GLOBAL_ASSETS_URL.'scripts/espresso_core.js?ver='.EVENT_ESPRESSO_VERSION,
175
+				TICKET_SELECTOR_ASSETS_URL.'ticket_selector_iframe_embed.js?ver='.EVENT_ESPRESSO_VERSION
176 176
 			)
177 177
 		);
178
-		$template_args[ 'notices' ] = EEH_Template::display_template(
179
-			EE_TEMPLATES . 'espresso-ajax-notices.template.php',
178
+		$template_args['notices'] = EEH_Template::display_template(
179
+			EE_TEMPLATES.'espresso-ajax-notices.template.php',
180 180
 			array(),
181 181
 			true
182 182
 		);
183 183
 		EEH_Template::display_template(
184
-			TICKET_SELECTOR_TEMPLATES_PATH . 'ticket_selector_chart_iframe.template.php',
184
+			TICKET_SELECTOR_TEMPLATES_PATH.'ticket_selector_chart_iframe.template.php',
185 185
 			$template_args
186 186
 		);
187 187
 		exit;
@@ -200,25 +200,25 @@  discard block
 block discarded – undo
200 200
 	 *
201 201
 	 * @return string The new html string for the permalink area.
202 202
 	 */
203
-	public static function iframe_code_button( $permalink_string, $id, $new_title, $new_slug ) {
203
+	public static function iframe_code_button($permalink_string, $id, $new_title, $new_slug) {
204 204
 		//make sure this is ONLY when editing and the event id has been set.
205
-		if ( ! empty( $id ) ) {
206
-			$post = get_post( $id );
205
+		if ( ! empty($id)) {
206
+			$post = get_post($id);
207 207
 			//if NOT event then let's get out.
208
-			if ( $post->post_type !== 'espresso_events' ) {
208
+			if ($post->post_type !== 'espresso_events') {
209 209
 				return $permalink_string;
210 210
 			}
211 211
 			$permalink_string .= '<a id="js-ticket-selector-embed-trigger" class="button button-small" href="#"  tabindex="-1">'
212
-			                     . __( 'Embed', 'event_espresso' )
212
+			                     . __('Embed', 'event_espresso')
213 213
 			                     . '</a> ';
214
-			$ticket_selector_url = add_query_arg( array( 'ticket_selector' => 'iframe', 'event' => $id ), site_url() );
214
+			$ticket_selector_url = add_query_arg(array('ticket_selector' => 'iframe', 'event' => $id), site_url());
215 215
 			$iframe_string = esc_html(
216
-				'<iframe src="' . $ticket_selector_url . '" width="100%" height="100%"></iframe>'
216
+				'<iframe src="'.$ticket_selector_url.'" width="100%" height="100%"></iframe>'
217 217
 			);
218 218
 			$permalink_string .= '
219 219
 <div id="js-ts-iframe" style="display:none">
220 220
 	<div style="width:100%; height: 500px;">
221
-		' . $iframe_string . '
221
+		' . $iframe_string.'
222 222
 	</div>
223 223
 </div>';
224 224
 		}
@@ -237,22 +237,22 @@  discard block
 block discarded – undo
237 237
 	 * @param 	mixed $event
238 238
 	 * @return 	bool
239 239
 	 */
240
-	protected static function set_event( $event = null ) {
241
-		if( $event === null ) {
240
+	protected static function set_event($event = null) {
241
+		if ($event === null) {
242 242
 			global $post;
243 243
 			$event = $post;
244 244
 		}
245
-		if ( $event instanceof EE_Event ) {
245
+		if ($event instanceof EE_Event) {
246 246
 			self::$_event = $event;
247
-		} else if ( $event instanceof WP_Post && isset( $event->EE_Event ) && $event->EE_Event instanceof EE_Event ) {
247
+		} else if ($event instanceof WP_Post && isset($event->EE_Event) && $event->EE_Event instanceof EE_Event) {
248 248
 			self::$_event = $event->EE_Event;
249
-		} else if ( $event instanceof WP_Post && $event->post_type == 'espresso_events' ) {
250
-			$event->EE_Event = EEM_Event::instance()->instantiate_class_from_post_object( $event );
249
+		} else if ($event instanceof WP_Post && $event->post_type == 'espresso_events') {
250
+			$event->EE_Event = EEM_Event::instance()->instantiate_class_from_post_object($event);
251 251
 			self::$_event = $event->EE_Event;
252 252
 		} else {
253
-			$user_msg = __( 'No Event object or an invalid Event object was supplied.', 'event_espresso' );
254
-			$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' );
255
-			EE_Error::add_error( $user_msg . '||' . $dev_msg, __FILE__, __FUNCTION__, __LINE__ );
253
+			$user_msg = __('No Event object or an invalid Event object was supplied.', 'event_espresso');
254
+			$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');
255
+			EE_Error::add_error($user_msg.'||'.$dev_msg, __FILE__, __FUNCTION__, __LINE__);
256 256
 			return false;
257 257
 		}
258 258
 		return true;
@@ -271,11 +271,11 @@  discard block
 block discarded – undo
271 271
 	 * @param 	bool 	$view_details
272 272
 	 * @return 	string
273 273
 	 */
274
-	public static function display_ticket_selector( $event = NULL, $view_details = FALSE ) {
274
+	public static function display_ticket_selector($event = NULL, $view_details = FALSE) {
275 275
 		// reset filter for displaying submit button
276
-		remove_filter( 'FHEE__EE_Ticket_Selector__display_ticket_selector_submit', '__return_true' );
276
+		remove_filter('FHEE__EE_Ticket_Selector__display_ticket_selector_submit', '__return_true');
277 277
 		// poke and prod incoming event till it tells us what it is
278
-		if ( ! EED_Ticket_Selector::set_event( $event )) {
278
+		if ( ! EED_Ticket_Selector::set_event($event)) {
279 279
 			return false;
280 280
 		}
281 281
 		$event_post = self::$_event instanceof EE_Event ? self::$_event->ID() : $event;
@@ -286,7 +286,7 @@  discard block
 block discarded – undo
286 286
 			&& (
287 287
 				! self::$_event->display_ticket_selector()
288 288
 				|| $view_details
289
-				|| post_password_required( $event_post )
289
+				|| post_password_required($event_post)
290 290
 				|| (
291 291
 					$_event_active_status != EE_Datetime::active
292 292
 					&& $_event_active_status != EE_Datetime::upcoming
@@ -304,68 +304,68 @@  discard block
 block discarded – undo
304 304
 		$template_args = array();
305 305
 		$template_args['event_status'] = $_event_active_status;
306 306
 
307
-		$template_args['date_format'] = apply_filters( 'FHEE__EED_Ticket_Selector__display_ticket_selector__date_format', get_option( 'date_format' ) );
308
-		$template_args['time_format'] = apply_filters( 'FHEE__EED_Ticket_Selector__display_ticket_selector__time_format', get_option( 'time_format' ) );
307
+		$template_args['date_format'] = apply_filters('FHEE__EED_Ticket_Selector__display_ticket_selector__date_format', get_option('date_format'));
308
+		$template_args['time_format'] = apply_filters('FHEE__EED_Ticket_Selector__display_ticket_selector__time_format', get_option('time_format'));
309 309
 
310 310
 		$template_args['EVT_ID'] = self::$_event->ID();
311 311
 		$template_args['event'] = self::$_event;
312 312
 
313 313
 		// is the event expired ?
314 314
 		$template_args['event_is_expired'] = self::$_event->is_expired();
315
-		if ( $template_args['event_is_expired'] ) {
316
-			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>';
315
+		if ($template_args['event_is_expired']) {
316
+			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>';
317 317
 		}
318 318
 
319 319
 		$ticket_query_args = array(
320
-			array( 'Datetime.EVT_ID' => self::$_event->ID() ),
321
-			'order_by' => array( 'TKT_order' => 'ASC', 'TKT_required' => 'DESC', 'TKT_start_date' => 'ASC', 'TKT_end_date' => 'ASC' , 'Datetime.DTT_EVT_start' => 'DESC' )
320
+			array('Datetime.EVT_ID' => self::$_event->ID()),
321
+			'order_by' => array('TKT_order' => 'ASC', 'TKT_required' => 'DESC', 'TKT_start_date' => 'ASC', 'TKT_end_date' => 'ASC', 'Datetime.DTT_EVT_start' => 'DESC')
322 322
 		);
323 323
 
324
-		if ( ! EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector->show_expired_tickets ) {
324
+		if ( ! EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector->show_expired_tickets) {
325 325
 			//use the correct applicable time query depending on what version of core is being run.
326
-			$current_time = method_exists( 'EEM_Datetime', 'current_time_for_query' ) ? time() : current_time('timestamp');
327
-			$ticket_query_args[0]['TKT_end_date'] = array( '>', $current_time );
326
+			$current_time = method_exists('EEM_Datetime', 'current_time_for_query') ? time() : current_time('timestamp');
327
+			$ticket_query_args[0]['TKT_end_date'] = array('>', $current_time);
328 328
 		}
329 329
 
330 330
 		// get all tickets for this event ordered by the datetime
331
-		$template_args['tickets'] = EEM_Ticket::instance()->get_all( $ticket_query_args );
331
+		$template_args['tickets'] = EEM_Ticket::instance()->get_all($ticket_query_args);
332 332
 
333
-		if ( count( $template_args['tickets'] ) < 1 ) {
334
-			return '<div class="ee-event-expired-notice"><span class="important-notice">' . __( 'We\'re sorry, but all ticket sales have ended.', 'event_espresso' ) . '</span></div>';
333
+		if (count($template_args['tickets']) < 1) {
334
+			return '<div class="ee-event-expired-notice"><span class="important-notice">'.__('We\'re sorry, but all ticket sales have ended.', 'event_espresso').'</span></div>';
335 335
 		}
336 336
 
337 337
 		// filter the maximum qty that can appear in the Ticket Selector qty dropdowns
338
-		$template_args['max_atndz'] = apply_filters('FHEE__EE_Ticket_Selector__display_ticket_selector__max_tickets', self::$_event->additional_limit() );
339
-		if ( $template_args['max_atndz'] < 1 ) {
340
-			$sales_closed_msg = __( 'We\'re sorry, but ticket sales have been closed at this time. Please check back again later.', 'event_espresso' );
341
-			if ( current_user_can( 'edit_post', self::$_event->ID() )) {
342
-				$sales_closed_msg .=  sprintf(
343
-					__( '%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' ),
338
+		$template_args['max_atndz'] = apply_filters('FHEE__EE_Ticket_Selector__display_ticket_selector__max_tickets', self::$_event->additional_limit());
339
+		if ($template_args['max_atndz'] < 1) {
340
+			$sales_closed_msg = __('We\'re sorry, but ticket sales have been closed at this time. Please check back again later.', 'event_espresso');
341
+			if (current_user_can('edit_post', self::$_event->ID())) {
342
+				$sales_closed_msg .= sprintf(
343
+					__('%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'),
344 344
 					'<div class="ee-attention" style="text-align: left;"><b>',
345 345
 					'</b><br />',
346
-					$link = '<span class="edit-link"><a class="post-edit-link" href="' . get_edit_post_link( self::$_event->ID() ) . '">',
346
+					$link = '<span class="edit-link"><a class="post-edit-link" href="'.get_edit_post_link(self::$_event->ID()).'">',
347 347
 					'</a></span></div>'
348 348
 				);
349 349
 			}
350
-			return '<p><span class="important-notice">' . $sales_closed_msg . '</span></p>';
350
+			return '<p><span class="important-notice">'.$sales_closed_msg.'</span></p>';
351 351
 		}
352 352
 
353
-		$templates['ticket_selector'] = TICKET_SELECTOR_TEMPLATES_PATH . 'ticket_selector_chart.template.php';
354
-		$templates['ticket_selector'] = apply_filters( 'FHEE__EE_Ticket_Selector__display_ticket_selector__template_path', $templates['ticket_selector'], self::$_event );
353
+		$templates['ticket_selector'] = TICKET_SELECTOR_TEMPLATES_PATH.'ticket_selector_chart.template.php';
354
+		$templates['ticket_selector'] = apply_filters('FHEE__EE_Ticket_Selector__display_ticket_selector__template_path', $templates['ticket_selector'], self::$_event);
355 355
 
356 356
 		// redirecting to another site for registration ??
357 357
 		$external_url = self::$_event->external_url() !== NULL || self::$_event->external_url() !== '' ? self::$_event->external_url() : FALSE;
358 358
 		// set up the form (but not for the admin)
359
-		$ticket_selector = ! is_admin() ? EED_Ticket_Selector::ticket_selector_form_open( self::$_event->ID(), $external_url ) : '';
359
+		$ticket_selector = ! is_admin() ? EED_Ticket_Selector::ticket_selector_form_open(self::$_event->ID(), $external_url) : '';
360 360
 		// if not redirecting to another site for registration
361
-		if ( ! $external_url ) {
361
+		if ( ! $external_url) {
362 362
 			// then display the ticket selector
363
-			$ticket_selector .= EEH_Template::locate_template( $templates['ticket_selector'], $template_args );
363
+			$ticket_selector .= EEH_Template::locate_template($templates['ticket_selector'], $template_args);
364 364
 		} else {
365 365
 			// if not we still need to trigger the display of the submit button
366
-			add_filter( 'FHEE__EE_Ticket_Selector__display_ticket_selector_submit', '__return_true' );
366
+			add_filter('FHEE__EE_Ticket_Selector__display_ticket_selector_submit', '__return_true');
367 367
 			//display notice to admin that registration is external
368
-			$ticket_selector .= ! is_admin() ? '' : __( 'Registration is at an external URL for this event.', 'event_espresso' );
368
+			$ticket_selector .= ! is_admin() ? '' : __('Registration is at an external URL for this event.', 'event_espresso');
369 369
 		}
370 370
 		// submit button and form close tag
371 371
 		$ticket_selector .= ! is_admin() ? EED_Ticket_Selector::display_ticket_selector_submit() : '';
@@ -385,25 +385,25 @@  discard block
 block discarded – undo
385 385
 	 * @param 		string $external_url
386 386
 	 * @return 		string
387 387
 	 */
388
-	public static function ticket_selector_form_open( $ID = 0, $external_url = '' ) {
388
+	public static function ticket_selector_form_open($ID = 0, $external_url = '') {
389 389
 		// if redirecting, we don't need any anything else
390
-		if ( $external_url ) {
391
-			$html = '<form method="GET" action="' . EEH_URL::refactor_url( $external_url ) . '">';
392
-			$query_args = EEH_URL::get_query_string( $external_url );
393
-			foreach ( $query_args as $query_arg => $value ) {
394
-				$html .= '<input type="hidden" name="' . $query_arg . '" value="' . $value . '">';
390
+		if ($external_url) {
391
+			$html = '<form method="GET" action="'.EEH_URL::refactor_url($external_url).'">';
392
+			$query_args = EEH_URL::get_query_string($external_url);
393
+			foreach ($query_args as $query_arg => $value) {
394
+				$html .= '<input type="hidden" name="'.$query_arg.'" value="'.$value.'">';
395 395
 			}
396 396
 			return $html;
397 397
 		}
398
-		$checkout_url = EEH_Event_View::event_link_url( $ID );
399
-		if ( ! $checkout_url ) {
400
-			EE_Error::add_error( __('The URL for the Event Details page could not be retrieved.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
398
+		$checkout_url = EEH_Event_View::event_link_url($ID);
399
+		if ( ! $checkout_url) {
400
+			EE_Error::add_error(__('The URL for the Event Details page could not be retrieved.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
401 401
 		}
402 402
 		$extra_params = self::$_in_iframe ? ' target="_blank"' : '';
403
-		$html = '<form method="POST" action="' . $checkout_url . '"' . $extra_params . '>';
404
-		$html .= wp_nonce_field( 	'process_ticket_selections', 'process_ticket_selections_nonce', TRUE, FALSE );
403
+		$html = '<form method="POST" action="'.$checkout_url.'"'.$extra_params.'>';
404
+		$html .= wp_nonce_field('process_ticket_selections', 'process_ticket_selections_nonce', TRUE, FALSE);
405 405
 		$html .= '<input type="hidden" name="ee" value="process_ticket_selections">';
406
-		$html = apply_filters( 'FHEE__EE_Ticket_Selector__ticket_selector_form_open__html', $html, self::$_event );
406
+		$html = apply_filters('FHEE__EE_Ticket_Selector__ticket_selector_form_open__html', $html, self::$_event);
407 407
 		return $html;
408 408
 	}
409 409
 
@@ -418,25 +418,25 @@  discard block
 block discarded – undo
418 418
 	 * 	@return		string
419 419
 	 */
420 420
 	public static function display_ticket_selector_submit() {
421
-		if ( ! is_admin() ) {
422
-			if ( apply_filters( 'FHEE__EE_Ticket_Selector__display_ticket_selector_submit', FALSE ) ) {
421
+		if ( ! is_admin()) {
422
+			if (apply_filters('FHEE__EE_Ticket_Selector__display_ticket_selector_submit', FALSE)) {
423 423
 				$btn_text = apply_filters(
424 424
 					'FHEE__EE_Ticket_Selector__display_ticket_selector_submit__btn_text',
425
-					__('Register Now', 'event_espresso' ),
425
+					__('Register Now', 'event_espresso'),
426 426
 					self::$_event
427 427
 				);
428 428
 				$external_url = self::$_event->external_url();
429
-				$html = '<input id="ticket-selector-submit-'. self::$_event->ID() .'-btn"';
429
+				$html = '<input id="ticket-selector-submit-'.self::$_event->ID().'-btn"';
430 430
 				$html .= ' class="ticket-selector-submit-btn ';
431
-				$html .= empty( $external_url ) ? 'ticket-selector-submit-ajax"' : '"';
432
-				$html .= ' type="submit" value="' . $btn_text . '" />';
433
-				$html .= apply_filters( 'FHEE__EE_Ticket_Selector__after_ticket_selector_submit', '', self::$_event );
431
+				$html .= empty($external_url) ? 'ticket-selector-submit-ajax"' : '"';
432
+				$html .= ' type="submit" value="'.$btn_text.'" />';
433
+				$html .= apply_filters('FHEE__EE_Ticket_Selector__after_ticket_selector_submit', '', self::$_event);
434 434
 				$html .= '<div class="clear"><br/></div></form>';
435 435
 				return $html;
436
-			} else if ( is_archive() ) {
437
-				return EED_Ticket_Selector::ticket_selector_form_close() . EED_Ticket_Selector::display_view_details_btn();
438
-			} else if ( EE_Registry::instance()->SSN->cart() instanceof EE_Cart ) {
439
-				if ( ! EE_Registry::instance()->SSN->cart()->all_ticket_quantity_count() ) {
436
+			} else if (is_archive()) {
437
+				return EED_Ticket_Selector::ticket_selector_form_close().EED_Ticket_Selector::display_view_details_btn();
438
+			} else if (EE_Registry::instance()->SSN->cart() instanceof EE_Cart) {
439
+				if ( ! EE_Registry::instance()->SSN->cart()->all_ticket_quantity_count()) {
440 440
 					return '';
441 441
 				}
442 442
 				return EED_Ticket_Selector::display_proceed_btn_when_tickets_in_cart();
@@ -464,12 +464,12 @@  discard block
 block discarded – undo
464 464
 		$html .= '">';
465 465
 		$html .= apply_filters(
466 466
 			'FHEE__EED_Ticket_Selector__proceed_to_registration_btn_txt',
467
-			__( 'Proceed to Registration', 'event_espresso' )
467
+			__('Proceed to Registration', 'event_espresso')
468 468
 		);
469 469
 		$html .= ' <span class="dashicons dashicons-arrow-right-alt2"></span>';
470 470
 		$html .= '</a>';
471 471
 		$html .= '<div class="clear"></div>';
472
-		$cancel_url = EEH_Event_View::event_link_url( self::$_event->ID() );
472
+		$cancel_url = EEH_Event_View::event_link_url(self::$_event->ID());
473 473
 		$cancel_url = add_query_arg(
474 474
 			array(
475 475
 				'ee'       => 'cancel_ticket_selections',
@@ -478,11 +478,11 @@  discard block
 block discarded – undo
478 478
 			),
479 479
 			$cancel_url
480 480
 		);
481
-		$cancel_url = wp_nonce_url( $cancel_url, 'cancel_ticket_selections', 'cancel_ticket_selections_nonce' );
482
-		$html .= '<a class="ticket-selector-submit-btn small-text" href="' . $cancel_url . '">';
481
+		$cancel_url = wp_nonce_url($cancel_url, 'cancel_ticket_selections', 'cancel_ticket_selections_nonce');
482
+		$html .= '<a class="ticket-selector-submit-btn small-text" href="'.$cancel_url.'">';
483 483
 		$html .= apply_filters(
484 484
 			'FHEE__EED_Ticket_Selector__cancel_ticket_selections_txt',
485
-			__( 'cancel ticket selection', 'event_espresso' )
485
+			__('cancel ticket selection', 'event_espresso')
486 486
 		);
487 487
 		$html .= '</a>';
488 488
 		$html .= '<div class="clear"><br/></div>';
@@ -515,8 +515,8 @@  discard block
 block discarded – undo
515 515
 	 * 	@return		string
516 516
 	 */
517 517
 	public static function display_view_details_btn() {
518
-		if ( ! self::$_event->get_permalink() ) {
519
-			EE_Error::add_error( __('The URL for the Event Details page could not be retrieved.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
518
+		if ( ! self::$_event->get_permalink()) {
519
+			EE_Error::add_error(__('The URL for the Event Details page could not be retrieved.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
520 520
 		}
521 521
 		$view_details_btn = '<form method="POST" action="';
522 522
 		$view_details_btn .= apply_filters(
@@ -525,9 +525,9 @@  discard block
 block discarded – undo
525 525
 			self::$_event
526 526
 		);
527 527
 		$view_details_btn .= '">';
528
-		$btn_text = apply_filters( 'FHEE__EE_Ticket_Selector__display_view_details_btn__btn_text', __( 'View Details', 'event_espresso' ), self::$_event );
529
-		$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 . '" />';
530
-		$view_details_btn .= apply_filters( 'FHEE__EE_Ticket_Selector__after_view_details_btn', '', self::$_event );
528
+		$btn_text = apply_filters('FHEE__EE_Ticket_Selector__display_view_details_btn__btn_text', __('View Details', 'event_espresso'), self::$_event);
529
+		$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.'" />';
530
+		$view_details_btn .= apply_filters('FHEE__EE_Ticket_Selector__after_view_details_btn', '', self::$_event);
531 531
 		$view_details_btn .= '<div class="clear"><br/></div>';
532 532
 		$view_details_btn .= '</form>';
533 533
 		return $view_details_btn;
@@ -544,19 +544,19 @@  discard block
 block discarded – undo
544 544
 	 */
545 545
 	public static function cancel_ticket_selections() {
546 546
 		// check nonce
547
-		if ( ! EED_Ticket_Selector::process_ticket_selector_nonce( 'cancel_ticket_selections_nonce' ) ) {
547
+		if ( ! EED_Ticket_Selector::process_ticket_selector_nonce('cancel_ticket_selections_nonce')) {
548 548
 			return false;
549 549
 		}
550
-		EE_Registry::instance()->SSN->clear_session(__CLASS__, __FUNCTION__ );
551
-		if ( EE_Registry::instance()->REQ->is_set( 'event_id' ) ) {
550
+		EE_Registry::instance()->SSN->clear_session(__CLASS__, __FUNCTION__);
551
+		if (EE_Registry::instance()->REQ->is_set('event_id')) {
552 552
 			wp_safe_redirect(
553 553
 				EEH_Event_View::event_link_url(
554
-					EE_Registry::instance()->REQ->get( 'event_id' )
554
+					EE_Registry::instance()->REQ->get('event_id')
555 555
 				)
556 556
 			);
557 557
 		} else {
558 558
 			wp_safe_redirect(
559
-				site_url( '/' . EE_Registry::instance()->CFG->core->event_cpt_slug . '/' )
559
+				site_url('/'.EE_Registry::instance()->CFG->core->event_cpt_slug.'/')
560 560
 			);
561 561
 		}
562 562
 		die();
@@ -571,15 +571,15 @@  discard block
 block discarded – undo
571 571
 	 * @param  string $nonce_name
572 572
 	 * @return bool
573 573
 	 */
574
-	public static function process_ticket_selector_nonce( $nonce_name ) {
574
+	public static function process_ticket_selector_nonce($nonce_name) {
575 575
 		if (
576 576
 			! is_admin()
577 577
 			&& (
578
-				! EE_Registry::instance()->REQ->is_set( $nonce_name )
578
+				! EE_Registry::instance()->REQ->is_set($nonce_name)
579 579
 				||
580 580
 				! wp_verify_nonce(
581
-					EE_Registry::instance()->REQ->get( $nonce_name ),
582
-					str_replace( '_nonce', '', $nonce_name )
581
+					EE_Registry::instance()->REQ->get($nonce_name),
582
+					str_replace('_nonce', '', $nonce_name)
583 583
 				)
584 584
 			)
585 585
 		) {
@@ -609,9 +609,9 @@  discard block
 block discarded – undo
609 609
 	 * 	@return array|boolean
610 610
 	 */
611 611
 	public function process_ticket_selections() {
612
-        do_action( 'EED_Ticket_Selector__process_ticket_selections__before' );
612
+        do_action('EED_Ticket_Selector__process_ticket_selections__before');
613 613
 		// check nonce
614
-		if ( ! EED_Ticket_Selector::process_ticket_selector_nonce( 'process_ticket_selections_nonce' ) ) {
614
+		if ( ! EED_Ticket_Selector::process_ticket_selector_nonce('process_ticket_selections_nonce')) {
615 615
 			return false;
616 616
 		}
617 617
 
@@ -621,109 +621,109 @@  discard block
 block discarded – undo
621 621
 		);
622 622
 		//we should really only have 1 registration in the works now (ie, no MER) so clear any previous items in the cart.
623 623
 		// When MER happens this will probably need to be tweaked, possibly wrapped in a conditional checking for some constant defined in MER etc.
624
-		EE_Registry::instance()->load_core( 'Session' );
624
+		EE_Registry::instance()->load_core('Session');
625 625
 		// unless otherwise requested, clear the session
626
-		if ( apply_filters( 'FHEE__EE_Ticket_Selector__process_ticket_selections__clear_session', TRUE )) {
627
-			EE_Registry::instance()->SSN->clear_session( __CLASS__, __FUNCTION__ );
626
+		if (apply_filters('FHEE__EE_Ticket_Selector__process_ticket_selections__clear_session', TRUE)) {
627
+			EE_Registry::instance()->SSN->clear_session(__CLASS__, __FUNCTION__);
628 628
 		}
629 629
 		//d( EE_Registry::instance()->SSN );
630 630
 
631
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
631
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
632 632
 		// do we have an event id?
633
-		if ( EE_Registry::instance()->REQ->is_set( 'tkt-slctr-event-id' ) ) {
633
+		if (EE_Registry::instance()->REQ->is_set('tkt-slctr-event-id')) {
634 634
 			// validate/sanitize data
635 635
 			$valid = self::_validate_post_data();
636 636
 			//check total tickets ordered vs max number of attendees that can register
637
-			if ( $valid['total_tickets'] > $valid['max_atndz'] ) {
637
+			if ($valid['total_tickets'] > $valid['max_atndz']) {
638 638
 
639 639
 				// ordering too many tickets !!!
640 640
 				$total_tickets_string = _n('You have attempted to purchase %s ticket.', 'You have attempted to purchase %s tickets.', $valid['total_tickets'], 'event_espresso');
641
-				$limit_error_1 = sprintf( $total_tickets_string, $valid['total_tickets'] );
641
+				$limit_error_1 = sprintf($total_tickets_string, $valid['total_tickets']);
642 642
 				// dev only message
643 643
 				$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');
644
-				$limit_error_2 = sprintf( $max_atndz_string, $valid['max_atndz'], $valid['max_atndz'] );
645
-				EE_Error::add_error( $limit_error_1 . '<br/>' . $limit_error_2, __FILE__, __FUNCTION__, __LINE__ );
644
+				$limit_error_2 = sprintf($max_atndz_string, $valid['max_atndz'], $valid['max_atndz']);
645
+				EE_Error::add_error($limit_error_1.'<br/>'.$limit_error_2, __FILE__, __FUNCTION__, __LINE__);
646 646
 			} else {
647 647
 
648 648
 				// all data appears to be valid
649 649
 				$tckts_slctd = false;
650 650
 				$tickets_added = 0;
651 651
 				// validate/sanitize data
652
-				$valid = apply_filters( 'FHEE__EED_Ticket_Selector__process_ticket_selections__valid_post_data', $valid );
653
-				if ( $valid[ 'total_tickets' ] >0 ) {
652
+				$valid = apply_filters('FHEE__EED_Ticket_Selector__process_ticket_selections__valid_post_data', $valid);
653
+				if ($valid['total_tickets'] > 0) {
654 654
 					// load cart
655
-					EE_Registry::instance()->load_core( 'Cart' );
655
+					EE_Registry::instance()->load_core('Cart');
656 656
 
657 657
 					// cycle thru the number of data rows sent from the event listing
658
-					for ( $x = 0; $x < $valid['rows']; $x++ ) {
658
+					for ($x = 0; $x < $valid['rows']; $x++) {
659 659
 						// does this row actually contain a ticket quantity?
660
-						if ( isset( $valid['qty'][$x] ) && $valid['qty'][$x] > 0 ) {
660
+						if (isset($valid['qty'][$x]) && $valid['qty'][$x] > 0) {
661 661
 							// YES we have a ticket quantity
662 662
 							$tckts_slctd = TRUE;
663 663
 							// d( $valid['ticket_obj'][$x] );
664
-							if ( $valid['ticket_obj'][$x] instanceof EE_Ticket ) {
664
+							if ($valid['ticket_obj'][$x] instanceof EE_Ticket) {
665 665
 								// then add ticket to cart
666
-								$tickets_added += self::_add_ticket_to_cart( $valid['ticket_obj'][$x], $valid['qty'][$x] );
666
+								$tickets_added += self::_add_ticket_to_cart($valid['ticket_obj'][$x], $valid['qty'][$x]);
667 667
 								//echo "\n\n " . __LINE__ . ") " . __METHOD__ . "() <br />";
668 668
 								//echo "\n . ticket_added: " . $ticket_added . '<br />';
669
-								if ( EE_Error::has_error() ) {
669
+								if (EE_Error::has_error()) {
670 670
 									break;
671 671
 								}
672 672
 							} else {
673 673
 								// nothing added to cart retrieved
674 674
 								EE_Error::add_error(
675
-									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/>' ),
675
+									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/>'),
676 676
 									__FILE__, __FUNCTION__, __LINE__
677 677
 								);
678 678
 							}
679 679
 						}
680 680
 					}
681 681
 				}
682
-				do_action( 'AHEE__EE_Ticket_Selector__process_ticket_selections__after_tickets_added_to_cart', EE_Registry::instance()->CART, $this );
682
+				do_action('AHEE__EE_Ticket_Selector__process_ticket_selections__after_tickets_added_to_cart', EE_Registry::instance()->CART, $this);
683 683
 				//d( EE_Registry::instance()->CART );
684 684
 				//die(); // <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< KILL REDIRECT HERE BEFORE CART UPDATE
685 685
 
686
-				if ( apply_filters( 'FHEE__EED_Ticket_Selector__process_ticket_selections__tckts_slctd', $tckts_slctd ) ) {
687
-					if ( apply_filters( 'FHEE__EED_Ticket_Selector__process_ticket_selections__success', $tickets_added ) ) {
688
-						do_action( 'FHEE__EE_Ticket_Selector__process_ticket_selections__before_redirecting_to_checkout', EE_Registry::instance()->CART, $this );
686
+				if (apply_filters('FHEE__EED_Ticket_Selector__process_ticket_selections__tckts_slctd', $tckts_slctd)) {
687
+					if (apply_filters('FHEE__EED_Ticket_Selector__process_ticket_selections__success', $tickets_added)) {
688
+						do_action('FHEE__EE_Ticket_Selector__process_ticket_selections__before_redirecting_to_checkout', EE_Registry::instance()->CART, $this);
689 689
 						EE_Registry::instance()->CART->recalculate_all_cart_totals();
690
-						EE_Registry::instance()->CART->save_cart( FALSE );
690
+						EE_Registry::instance()->CART->save_cart(FALSE);
691 691
 						EE_Registry::instance()->SSN->update();
692 692
 						//d( EE_Registry::instance()->CART );
693 693
 						//die(); // <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< OR HERE TO KILL REDIRECT AFTER CART UPDATE
694 694
 						// just return TRUE for registrations being made from admin
695
-						if ( is_admin() ) {
695
+						if (is_admin()) {
696 696
 							return TRUE;
697 697
 						}
698 698
 
699
-						EE_Error::get_notices( false, true );
700
-						wp_safe_redirect( apply_filters( 'FHEE__EE_Ticket_Selector__process_ticket_selections__success_redirect_url', EE_Registry::instance()->CFG->core->reg_page_url() ));
699
+						EE_Error::get_notices(false, true);
700
+						wp_safe_redirect(apply_filters('FHEE__EE_Ticket_Selector__process_ticket_selections__success_redirect_url', EE_Registry::instance()->CFG->core->reg_page_url()));
701 701
 						exit();
702 702
 
703 703
 					} else {
704
-						if ( ! EE_Error::has_error() ) {
704
+						if ( ! EE_Error::has_error()) {
705 705
 							// nothing added to cart
706
-							EE_Error::add_attention( __( 'No tickets were added for the event', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
706
+							EE_Error::add_attention(__('No tickets were added for the event', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
707 707
 						}
708 708
 					}
709 709
 
710 710
 				} else {
711 711
 					// no ticket quantities were selected
712
-					EE_Error::add_error( __( 'You need to select a ticket quantity before you can proceed.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
712
+					EE_Error::add_error(__('You need to select a ticket quantity before you can proceed.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
713 713
 				}
714 714
 			}
715 715
 			//die(); // <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< KILL BEFORE REDIRECT
716 716
 			// at this point, just return if registration is being made from admin
717
-			if ( is_admin() ) {
717
+			if (is_admin()) {
718 718
 				return FALSE;
719 719
 			}
720
-			if ( $valid['return_url'] ) {
721
-				EE_Error::get_notices( FALSE, TRUE );
722
-				wp_safe_redirect( $valid['return_url'] );
720
+			if ($valid['return_url']) {
721
+				EE_Error::get_notices(FALSE, TRUE);
722
+				wp_safe_redirect($valid['return_url']);
723 723
 				exit();
724
-			} elseif ( isset( $event_to_add['id'] )) {
725
-				EE_Error::get_notices( FALSE, TRUE );
726
-				wp_safe_redirect( get_permalink( $event_to_add['id'] ));
724
+			} elseif (isset($event_to_add['id'])) {
725
+				EE_Error::get_notices(FALSE, TRUE);
726
+				wp_safe_redirect(get_permalink($event_to_add['id']));
727 727
 				exit();
728 728
 			} else {
729 729
 				echo EE_Error::get_notices();
@@ -732,7 +732,7 @@  discard block
 block discarded – undo
732 732
 		} else {
733 733
 			// $_POST['tkt-slctr-event-id'] was not set ?!?!?!?
734 734
 			EE_Error::add_error(
735
-				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/>' ),
735
+				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/>'),
736 736
 				__FILE__, __FUNCTION__, __LINE__
737 737
 			);
738 738
 		}
@@ -750,18 +750,18 @@  discard block
 block discarded – undo
750 750
 	 * @return        array  or FALSE
751 751
 	 */
752 752
 	private static function _validate_post_data() {
753
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
753
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
754 754
 
755 755
 		// start with an empty array()
756 756
 		$valid_data = array();
757 757
 		//		d( $_POST );
758 758
 		//if event id is valid
759
-		$id = absint( EE_Registry::instance()->REQ->get( 'tkt-slctr-event-id' ));
760
-		if ( $id ) {
759
+		$id = absint(EE_Registry::instance()->REQ->get('tkt-slctr-event-id'));
760
+		if ($id) {
761 761
 			// grab valid id
762 762
 			$valid_data['id'] = $id;
763 763
 			// grab and sanitize return-url
764
-			$valid_data['return_url'] = esc_url_raw( EE_Registry::instance()->REQ->get( 'tkt-slctr-return-url-' . $id ));
764
+			$valid_data['return_url'] = esc_url_raw(EE_Registry::instance()->REQ->get('tkt-slctr-return-url-'.$id));
765 765
 			// array of other form names
766 766
 			$inputs_to_clean = array(
767 767
 				'event_id' => 'tkt-slctr-event-id',
@@ -774,22 +774,22 @@  discard block
 block discarded – undo
774 774
 			// let's track the total number of tickets ordered.'
775 775
 			$valid_data['total_tickets'] = 0;
776 776
 			// cycle through $inputs_to_clean array
777
-			foreach ( $inputs_to_clean as $what => $input_to_clean ) {
777
+			foreach ($inputs_to_clean as $what => $input_to_clean) {
778 778
 				// check for POST data
779
-				if ( EE_Registry::instance()->REQ->is_set( $input_to_clean . $id )) {
779
+				if (EE_Registry::instance()->REQ->is_set($input_to_clean.$id)) {
780 780
 					// grab value
781
-					$input_value = EE_Registry::instance()->REQ->get( $input_to_clean . $id );
781
+					$input_value = EE_Registry::instance()->REQ->get($input_to_clean.$id);
782 782
 					switch ($what) {
783 783
 
784 784
 						// integers
785 785
 						case 'event_id':
786
-							$valid_data[$what] = absint( $input_value );
786
+							$valid_data[$what] = absint($input_value);
787 787
 							// get event via the event id we put in the form
788
-							$valid_data['event'] = EE_Registry::instance()->load_model( 'Event' )->get_one_by_ID( $valid_data['event_id'] );
788
+							$valid_data['event'] = EE_Registry::instance()->load_model('Event')->get_one_by_ID($valid_data['event_id']);
789 789
 							break;
790 790
 						case 'rows':
791 791
 						case 'max_atndz':
792
-							$valid_data[$what] = absint( $input_value );
792
+							$valid_data[$what] = absint($input_value);
793 793
 							break;
794 794
 
795 795
 						// arrays of integers
@@ -797,27 +797,27 @@  discard block
 block discarded – undo
797 797
 							//							d( $input_value );
798 798
 							$row_qty = $input_value;
799 799
 							// if qty is coming from a radio button input, then we need to assemble an array of rows
800
-							if( ! is_array( $row_qty )) {
800
+							if ( ! is_array($row_qty)) {
801 801
 								// get number of rows
802
-								$rows = EE_Registry::instance()->REQ->is_set( 'tkt-slctr-rows-' . $id ) ? absint( EE_Registry::instance()->REQ->get( 'tkt-slctr-rows-' . $id )) : 1;
802
+								$rows = EE_Registry::instance()->REQ->is_set('tkt-slctr-rows-'.$id) ? absint(EE_Registry::instance()->REQ->get('tkt-slctr-rows-'.$id)) : 1;
803 803
 								//								d( $rows );
804 804
 								// explode ints by the dash
805
-								$row_qty = explode( '-', $row_qty );
806
-								$row = isset( $row_qty[0] ) ? ( absint( $row_qty[0] )) : 1;
807
-								$qty = isset( $row_qty[1] ) ? absint( $row_qty[1] ) : 0;
808
-								$row_qty = array( $row => $qty );
805
+								$row_qty = explode('-', $row_qty);
806
+								$row = isset($row_qty[0]) ? (absint($row_qty[0])) : 1;
807
+								$qty = isset($row_qty[1]) ? absint($row_qty[1]) : 0;
808
+								$row_qty = array($row => $qty);
809 809
 								//								 d( $row_qty );
810
-								for( $x = 1; $x <= $rows; $x++ ) {
811
-									if ( ! isset( $row_qty[$x] )) {
810
+								for ($x = 1; $x <= $rows; $x++) {
811
+									if ( ! isset($row_qty[$x])) {
812 812
 										$row_qty[$x] = 0;
813 813
 									}
814 814
 								}
815 815
 							}
816
-							ksort( $row_qty );
816
+							ksort($row_qty);
817 817
 							//							 d( $row_qty );
818 818
 							// cycle thru values
819
-							foreach ( $row_qty as $qty ) {
820
-								$qty = absint( $qty );
819
+							foreach ($row_qty as $qty) {
820
+								$qty = absint($qty);
821 821
 								// sanitize as integers
822 822
 								$valid_data[$what][] = $qty;
823 823
 								$valid_data['total_tickets'] += $qty;
@@ -828,19 +828,19 @@  discard block
 block discarded – undo
828 828
 						case 'ticket_id':
829 829
 							$value_array = array();
830 830
 							// cycle thru values
831
-							foreach ( $input_value as $key=>$value ) {
831
+							foreach ($input_value as $key=>$value) {
832 832
 								// allow only numbers, letters,  spaces, commas and dashes
833
-								$value_array[ $key ] = wp_strip_all_tags( $value );
833
+								$value_array[$key] = wp_strip_all_tags($value);
834 834
 								// get ticket via the ticket id we put in the form
835
-								$ticket_obj = EE_Registry::instance()->load_model( 'Ticket' )->get_one_by_ID( $value );
836
-								$valid_data['ticket_obj'][ $key ] = $ticket_obj;
835
+								$ticket_obj = EE_Registry::instance()->load_model('Ticket')->get_one_by_ID($value);
836
+								$valid_data['ticket_obj'][$key] = $ticket_obj;
837 837
 							}
838
-							$valid_data[ $what ] = $value_array;
838
+							$valid_data[$what] = $value_array;
839 839
 							break;
840 840
 
841 841
 						case 'return_url' :
842 842
 							// grab and sanitize return-url
843
-							$valid_data[$what] = esc_url_raw( $input_value );
843
+							$valid_data[$what] = esc_url_raw($input_value);
844 844
 							break;
845 845
 
846 846
 					} 	// end switch $what
@@ -848,7 +848,7 @@  discard block
 block discarded – undo
848 848
 			} 	// end foreach $inputs_to_clean
849 849
 
850 850
 		} else {
851
-			EE_Error::add_error( __('The event id provided was not valid.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
851
+			EE_Error::add_error(__('The event id provided was not valid.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
852 852
 			return FALSE;
853 853
 		}
854 854
 
@@ -866,12 +866,12 @@  discard block
 block discarded – undo
866 866
 	 * @param int       $qty
867 867
 	 * @return int quantity of tickets added
868 868
 	 */
869
-	private static function _add_ticket_to_cart( EE_Ticket $ticket = NULL, $qty = 1 ) {
870
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
869
+	private static function _add_ticket_to_cart(EE_Ticket $ticket = NULL, $qty = 1) {
870
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
871 871
 		// get the number of spaces left for this datetime ticket
872
-		$available_spaces = self::_ticket_datetime_availability( $ticket );
872
+		$available_spaces = self::_ticket_datetime_availability($ticket);
873 873
 		// compare available spaces against the number of tickets being purchased
874
-		if ( $available_spaces >= $qty ) {
874
+		if ($available_spaces >= $qty) {
875 875
 			// allow addons to prevent a ticket from being added to cart
876 876
 			if (
877 877
 				! apply_filters(
@@ -884,10 +884,10 @@  discard block
 block discarded – undo
884 884
 			) {
885 885
 				return 0;
886 886
 			}
887
-			$qty = apply_filters( 'FHEE__EE_Ticket_Selector___add_ticket_to_cart__ticket_qty', $qty, $ticket );
887
+			$qty = apply_filters('FHEE__EE_Ticket_Selector___add_ticket_to_cart__ticket_qty', $qty, $ticket);
888 888
 			// add event to cart
889
-			if( $qty && EE_Registry::instance()->CART->add_ticket_to_cart( $ticket, $qty )) {
890
-				self::_recalculate_ticket_datetime_availability( $ticket, $qty );
889
+			if ($qty && EE_Registry::instance()->CART->add_ticket_to_cart($ticket, $qty)) {
890
+				self::_recalculate_ticket_datetime_availability($ticket, $qty);
891 891
 				return $qty;
892 892
 			} else {
893 893
 				return 0;
@@ -895,9 +895,9 @@  discard block
 block discarded – undo
895 895
 		} else {
896 896
 			// tickets can not be purchased but let's find the exact number left
897 897
 			// for the last ticket selected PRIOR to subtracting tickets
898
-			$available_spaces = self::_ticket_datetime_availability( $ticket, true );
898
+			$available_spaces = self::_ticket_datetime_availability($ticket, true);
899 899
 			// greedy greedy greedy eh?
900
-			if ( $available_spaces > 0 ) {
900
+			if ($available_spaces > 0) {
901 901
 				if (
902 902
 					apply_filters(
903 903
 						'FHEE__EE_Ticket_Selector___add_ticket_to_cart__allow_display_availability_error',
@@ -907,7 +907,7 @@  discard block
 block discarded – undo
907 907
 						$available_spaces
908 908
 					)
909 909
 				) {
910
-					EED_Ticket_Selector::_display_availability_error( $available_spaces );
910
+					EED_Ticket_Selector::_display_availability_error($available_spaces);
911 911
 				}
912 912
 			} else {
913 913
 				EE_Error::add_error(
@@ -932,10 +932,10 @@  discard block
 block discarded – undo
932 932
 	 * @access    private
933 933
 	 * @param int $available_spaces
934 934
 	 */
935
-	private static function _display_availability_error( $available_spaces = 1 ) {
935
+	private static function _display_availability_error($available_spaces = 1) {
936 936
 		// add error messaging - we're using the _n function that will generate
937 937
 		// the appropriate singular or plural message based on the number of $available_spaces
938
-		if ( EE_Registry::instance()->CART->all_ticket_quantity_count() ) {
938
+		if (EE_Registry::instance()->CART->all_ticket_quantity_count()) {
939 939
 			$msg = sprintf(
940 940
 				_n(
941 941
 					'We\'re sorry, but there is only %1$s available space left for this event at this particular date and time. Please select a different number (or different combination) of tickets by cancelling the current selection and choosing again, or proceed to registration.',
@@ -958,7 +958,7 @@  discard block
 block discarded – undo
958 958
 				'<br />'
959 959
 			);
960 960
 		}
961
-		EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ );
961
+		EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
962 962
 	}
963 963
 
964 964
 
@@ -973,22 +973,22 @@  discard block
 block discarded – undo
973 973
 	 * @param 	bool         $get_original_ticket_spaces
974 974
 	 * @return 	int
975 975
 	 */
976
-	private static function _ticket_datetime_availability( EE_Ticket $ticket, $get_original_ticket_spaces = FALSE ) {
976
+	private static function _ticket_datetime_availability(EE_Ticket $ticket, $get_original_ticket_spaces = FALSE) {
977 977
 		// if the $_available_spaces array has not been set up yet...
978
-		if ( ! isset( self::$_available_spaces['tickets'][ $ticket->ID() ] )) {
979
-				self::_set_initial_ticket_datetime_availability( $ticket );
978
+		if ( ! isset(self::$_available_spaces['tickets'][$ticket->ID()])) {
979
+				self::_set_initial_ticket_datetime_availability($ticket);
980 980
 		}
981 981
 		$available_spaces = $ticket->qty() - $ticket->sold();
982
-		if ( isset( self::$_available_spaces['tickets'][ $ticket->ID() ] )) {
982
+		if (isset(self::$_available_spaces['tickets'][$ticket->ID()])) {
983 983
 			// loop thru tickets, which will ALSO include individual ticket records AND a total
984
-			foreach ( self::$_available_spaces['tickets'][ $ticket->ID() ] as $DTD_ID => $spaces  ) {
984
+			foreach (self::$_available_spaces['tickets'][$ticket->ID()] as $DTD_ID => $spaces) {
985 985
 				// if we want the original datetime availability BEFORE we started subtracting tickets ?
986
-				if ( $get_original_ticket_spaces ) {
986
+				if ($get_original_ticket_spaces) {
987 987
 					// then grab the available spaces from the "tickets" array and compare with the above to get the lowest number
988
-					$available_spaces = min( $available_spaces, self::$_available_spaces['tickets'][ $ticket->ID() ][ $DTD_ID ] );
988
+					$available_spaces = min($available_spaces, self::$_available_spaces['tickets'][$ticket->ID()][$DTD_ID]);
989 989
 				} else {
990 990
 					// we want the updated ticket availability as stored in the "datetimes" array
991
-					$available_spaces = min( $available_spaces, self::$_available_spaces['datetimes'][ $DTD_ID ] );
991
+					$available_spaces = min($available_spaces, self::$_available_spaces['datetimes'][$DTD_ID]);
992 992
 				}
993 993
 			}
994 994
 		}
@@ -1004,23 +1004,23 @@  discard block
 block discarded – undo
1004 1004
 	 * @param 	EE_Ticket $ticket
1005 1005
 	 * @return 	int
1006 1006
 	 */
1007
-	private static function _set_initial_ticket_datetime_availability( EE_Ticket $ticket ) {
1007
+	private static function _set_initial_ticket_datetime_availability(EE_Ticket $ticket) {
1008 1008
 		// first, get all of the datetimes that are available to this ticket
1009 1009
 		$datetimes = $ticket->get_many_related(
1010 1010
 			'Datetime',
1011
-			array( array( 'DTT_EVT_end' => array( '>=', EEM_Datetime::instance()->current_time_for_query( 'DTT_EVT_end' ) ) ), 'order_by' => array( 'DTT_EVT_start' => 'ASC' ))
1011
+			array(array('DTT_EVT_end' => array('>=', EEM_Datetime::instance()->current_time_for_query('DTT_EVT_end'))), 'order_by' => array('DTT_EVT_start' => 'ASC'))
1012 1012
 		);
1013
-		if ( ! empty( $datetimes )) {
1013
+		if ( ! empty($datetimes)) {
1014 1014
 			// now loop thru all of the datetimes
1015
-			foreach ( $datetimes as $datetime  ) {
1016
-				if ( $datetime instanceof EE_Datetime ) {
1015
+			foreach ($datetimes as $datetime) {
1016
+				if ($datetime instanceof EE_Datetime) {
1017 1017
 					// the number of spaces available for the datetime without considering individual ticket quantities
1018 1018
 					$spaces_remaining = $datetime->spaces_remaining();
1019 1019
 					// 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
1020
-					self::$_available_spaces['tickets'][ $ticket->ID() ][ $datetime->ID() ] = min(( $ticket->qty() - $ticket->sold() ), $spaces_remaining );
1020
+					self::$_available_spaces['tickets'][$ticket->ID()][$datetime->ID()] = min(($ticket->qty() - $ticket->sold()), $spaces_remaining);
1021 1021
 					// if the remaining spaces for this datetime is already set, then compare that against the datetime spaces remaining, and take the lowest number,
1022 1022
 					// else just take the datetime spaces remaining, and assign to the datetimes array
1023
-					self::$_available_spaces['datetimes'][ $datetime->ID() ] = isset( self::$_available_spaces['datetimes'][ $datetime->ID() ] ) ? min( self::$_available_spaces['datetimes'][ $datetime->ID() ], $spaces_remaining ) : $spaces_remaining;
1023
+					self::$_available_spaces['datetimes'][$datetime->ID()] = isset(self::$_available_spaces['datetimes'][$datetime->ID()]) ? min(self::$_available_spaces['datetimes'][$datetime->ID()], $spaces_remaining) : $spaces_remaining;
1024 1024
 				}
1025 1025
 			}
1026 1026
 		}
@@ -1036,12 +1036,12 @@  discard block
 block discarded – undo
1036 1036
 	 * @param 	int   $qty
1037 1037
 	 * @return 	int
1038 1038
 	 */
1039
-	private static function _recalculate_ticket_datetime_availability( EE_Ticket $ticket, $qty = 0 ) {
1040
-		if ( isset( self::$_available_spaces['tickets'][ $ticket->ID() ] )) {
1039
+	private static function _recalculate_ticket_datetime_availability(EE_Ticket $ticket, $qty = 0) {
1040
+		if (isset(self::$_available_spaces['tickets'][$ticket->ID()])) {
1041 1041
 			// loop thru tickets, which will ALSO include individual ticket records AND a total
1042
-			foreach ( self::$_available_spaces['tickets'][ $ticket->ID() ] as $DTD_ID => $spaces  ) {
1042
+			foreach (self::$_available_spaces['tickets'][$ticket->ID()] as $DTD_ID => $spaces) {
1043 1043
 				// subtract the qty of selected tickets from each datetime's available spaces this ticket has access to,
1044
-				self::$_available_spaces['datetimes'][ $DTD_ID ] = self::$_available_spaces['datetimes'][ $DTD_ID ] - $qty;
1044
+				self::$_available_spaces['datetimes'][$DTD_ID] = self::$_available_spaces['datetimes'][$DTD_ID] - $qty;
1045 1045
 			}
1046 1046
 		}
1047 1047
 	}
@@ -1058,8 +1058,8 @@  discard block
 block discarded – undo
1058 1058
 	*/
1059 1059
 	public static function load_tckt_slctr_assets() {
1060 1060
 		// add some style
1061
-		if ( apply_filters( 'FHEE__EED_Ticket_Selector__load_tckt_slctr_assets', FALSE ) ) {
1062
-			wp_register_style('ticket_selector', TICKET_SELECTOR_ASSETS_URL . 'ticket_selector.css');
1061
+		if (apply_filters('FHEE__EED_Ticket_Selector__load_tckt_slctr_assets', FALSE)) {
1062
+			wp_register_style('ticket_selector', TICKET_SELECTOR_ASSETS_URL.'ticket_selector.css');
1063 1063
 			wp_enqueue_style('ticket_selector');
1064 1064
 			// make it dance
1065 1065
 			//			wp_register_script('ticket_selector', TICKET_SELECTOR_ASSETS_URL . 'ticket_selector.js', array('espresso_core'), '', TRUE);
@@ -1073,9 +1073,9 @@  discard block
 block discarded – undo
1073 1073
 
1074 1074
 	public static function load_tckt_slctr_assets_admin() {
1075 1075
 		//iframe button js on admin event editor page
1076
-		if ( EE_Registry::instance()->REQ->get('page') == 'espresso_events' && EE_Registry::instance()->REQ->get('action') == 'edit' ) {
1077
-			wp_register_script( 'ticket_selector_embed', TICKET_SELECTOR_ASSETS_URL . 'ticket-selector-embed.js', array( 'ee-dialog' ), EVENT_ESPRESSO_VERSION, true );
1078
-			wp_enqueue_script( 'ticket_selector_embed' );
1076
+		if (EE_Registry::instance()->REQ->get('page') == 'espresso_events' && EE_Registry::instance()->REQ->get('action') == 'edit') {
1077
+			wp_register_script('ticket_selector_embed', TICKET_SELECTOR_ASSETS_URL.'ticket-selector-embed.js', array('ee-dialog'), EVENT_ESPRESSO_VERSION, true);
1078
+			wp_enqueue_script('ticket_selector_embed');
1079 1079
 		}
1080 1080
 	}
1081 1081
 
Please login to merge, or discard this patch.
admin_pages/registration_form/Registration_Form_Admin_Page.core.php 1 patch
Spacing   +127 added lines, -127 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if (!defined('EVENT_ESPRESSO_VERSION') )
2
+if ( ! defined('EVENT_ESPRESSO_VERSION'))
3 3
 	exit('NO direct script access allowed');
4 4
 
5 5
 /**
@@ -68,12 +68,12 @@  discard block
 block discarded – undo
68 68
 	 * 		@param bool $routing indicate whether we want to just load the object and handle routing or just load the object.
69 69
 	 * 		@access public
70 70
 	 */
71
-	public function __construct( $routing = TRUE ) {
72
-		require_once( EE_MODELS . 'EEM_Question.model.php' );
73
-		require_once( EE_MODELS . 'EEM_Question_Group.model.php' );
74
-		$this->_question_model=  EEM_Question::instance();
75
-		$this->_question_group_model=EEM_Question_Group::instance();
76
-		parent::__construct( $routing );
71
+	public function __construct($routing = TRUE) {
72
+		require_once(EE_MODELS.'EEM_Question.model.php');
73
+		require_once(EE_MODELS.'EEM_Question_Group.model.php');
74
+		$this->_question_model = EEM_Question::instance();
75
+		$this->_question_group_model = EEM_Question_Group::instance();
76
+		parent::__construct($routing);
77 77
 	}
78 78
 
79 79
 
@@ -109,7 +109,7 @@  discard block
 block discarded – undo
109 109
 	 *_set_page_routes
110 110
 	 */
111 111
 	protected function _set_page_routes() {
112
-		$qst_id = ! empty( $this->_req_data['QST_ID'] ) ? $this->_req_data['QST_ID'] : 0;
112
+		$qst_id = ! empty($this->_req_data['QST_ID']) ? $this->_req_data['QST_ID'] : 0;
113 113
 		$this->_page_routes = array(
114 114
 			'default' => array(
115 115
 				'func' => '_questions_overview_list_table',
@@ -130,7 +130,7 @@  discard block
 block discarded – undo
130 130
 
131 131
 			'update_question' => array(
132 132
 				'func' => '_insert_or_update_question',
133
-				'args' => array('new_question' => FALSE ),
133
+				'args' => array('new_question' => FALSE),
134 134
 				'capability' => 'ee_edit_question',
135 135
 				'obj_id' => $qst_id,
136 136
 				'noheader' => TRUE,
@@ -165,7 +165,7 @@  discard block
 block discarded – undo
165 165
 						'filename' => 'registration_form_questions_overview_views_bulk_actions_search'
166 166
 						)
167 167
 					),
168
-				'help_tour' => array( 'Registration_Form_Questions_Overview_Help_Tour'),
168
+				'help_tour' => array('Registration_Form_Questions_Overview_Help_Tour'),
169 169
 				'require_nonce' => FALSE,
170 170
 				'qtips' => array(
171 171
 					'EE_Registration_Form_Tips'
@@ -184,7 +184,7 @@  discard block
 block discarded – undo
184 184
 						'filename' => 'registration_form_question_groups'
185 185
 						),
186 186
 					),
187
-				'help_tour' => array( 'Registration_Form_Question_Groups_Help_Tour'),
187
+				'help_tour' => array('Registration_Form_Question_Groups_Help_Tour'),
188 188
 				'require_nonce' => FALSE
189 189
 				),
190 190
 
@@ -193,16 +193,16 @@  discard block
 block discarded – undo
193 193
 					'label' => esc_html__('Edit Question', 'event_espresso'),
194 194
 					'order' => 15,
195 195
 					'persistent' => FALSE,
196
-					'url' => isset($this->_req_data['question_id']) ? add_query_arg(array('question_id' => $this->_req_data['question_id'] ), $this->_current_page_view_url )  : $this->_admin_base_url
196
+					'url' => isset($this->_req_data['question_id']) ? add_query_arg(array('question_id' => $this->_req_data['question_id']), $this->_current_page_view_url) : $this->_admin_base_url
197 197
 					),
198
-				'metaboxes' => array_merge( $this->_default_espresso_metaboxes, array('_publish_post_box' ) ),
198
+				'metaboxes' => array_merge($this->_default_espresso_metaboxes, array('_publish_post_box')),
199 199
 				'help_tabs' => array(
200 200
 					'registration_form_edit_question_group_help_tab' => array(
201 201
 						'title' => esc_html__('Edit Question', 'event_espresso'),
202 202
 						'filename' => 'registration_form_edit_question'
203 203
 						),
204 204
 					),
205
-                'help_tour' => array( 'Registration_Form_Edit_Question_Help_Tour'),
205
+                'help_tour' => array('Registration_Form_Edit_Question_Help_Tour'),
206 206
 				'require_nonce' => FALSE
207 207
 				),
208 208
 			);
@@ -230,7 +230,7 @@  discard block
 block discarded – undo
230 230
 	//none of the below group are currently used for Event Categories
231 231
 	protected function _add_feature_pointers() {}
232 232
 	public function load_scripts_styles() {
233
-		wp_register_style( 'espresso_registration', REGISTRATION_FORM_ASSETS_URL . 'espresso_registration_form_admin.css', array(), EVENT_ESPRESSO_VERSION );
233
+		wp_register_style('espresso_registration', REGISTRATION_FORM_ASSETS_URL.'espresso_registration_form_admin.css', array(), EVENT_ESPRESSO_VERSION);
234 234
 		wp_enqueue_style('espresso_registration');
235 235
 	}
236 236
 	public function admin_init() {}
@@ -246,20 +246,20 @@  discard block
 block discarded – undo
246 246
 
247 247
 	public function load_scripts_styles_add_question() {
248 248
 		$this->load_scripts_styles_forms();
249
-		wp_register_script( 'espresso_registration_form_single', REGISTRATION_FORM_ASSETS_URL . 'espresso_registration_form_admin.js', array('jquery-ui-sortable'), EVENT_ESPRESSO_VERSION, TRUE );
250
-		wp_enqueue_script( 'espresso_registration_form_single' );
249
+		wp_register_script('espresso_registration_form_single', REGISTRATION_FORM_ASSETS_URL.'espresso_registration_form_admin.js', array('jquery-ui-sortable'), EVENT_ESPRESSO_VERSION, TRUE);
250
+		wp_enqueue_script('espresso_registration_form_single');
251 251
 	}
252 252
 	public function load_scripts_styles_edit_question() {
253 253
 		$this->load_scripts_styles_forms();
254
-		wp_register_script( 'espresso_registration_form_single', REGISTRATION_FORM_ASSETS_URL . 'espresso_registration_form_admin.js', array('jquery-ui-sortable'), EVENT_ESPRESSO_VERSION, TRUE );
255
-		wp_enqueue_script( 'espresso_registration_form_single' );
254
+		wp_register_script('espresso_registration_form_single', REGISTRATION_FORM_ASSETS_URL.'espresso_registration_form_admin.js', array('jquery-ui-sortable'), EVENT_ESPRESSO_VERSION, TRUE);
255
+		wp_enqueue_script('espresso_registration_form_single');
256 256
 	}
257 257
 
258 258
 
259 259
 
260 260
 
261 261
 	public function recaptcha_info_help_tab() {
262
-		$template = REGISTRATION_FORM_TEMPLATE_PATH . 'recaptcha_info_help_tab.template.php';
262
+		$template = REGISTRATION_FORM_TEMPLATE_PATH.'recaptcha_info_help_tab.template.php';
263 263
 		EEH_Template::display_template($template, array());
264 264
 	}
265 265
 
@@ -291,7 +291,7 @@  discard block
 block discarded – undo
291 291
 				)
292 292
 		);
293 293
 
294
-		if ( EE_Registry::instance()->CAP->current_user_can( 'ee_delete_questions', 'espresso_registration_form_trash_questions' ) ) {
294
+		if (EE_Registry::instance()->CAP->current_user_can('ee_delete_questions', 'espresso_registration_form_trash_questions')) {
295 295
 			$this->_views['trash'] = array(
296 296
 				'slug' => 'trash',
297 297
 				'label' => esc_html__('Trash', 'event_espresso'),
@@ -309,9 +309,9 @@  discard block
 block discarded – undo
309 309
 	 */
310 310
 	protected function _questions_groups_preview() {
311 311
 		$this->_admin_page_title = esc_html__('Question Groups (Preview)', 'event_espresso');
312
-		$this->_template_args['preview_img'] = '<img src="' . REGISTRATION_FORM_ASSETS_URL . 'caf_reg_form_preview.jpg" alt="' . esc_attr__( 'Preview Question Groups Overview List Table screenshot', 'event_espresso' ) . '" />';
313
-		$this->_template_args['preview_text'] = '<strong>'.esc_html__( 'Question Groups is a feature that is only available in the Caffeinated version of Event Espresso.  With the Question Groups feature you are able to: create new question groups, edit existing question groups, and also create and edit new questions and add them to question groups.', 'event_espresso' ).'</strong>';
314
-		$this->display_admin_caf_preview_page( 'question_groups_tab' );
312
+		$this->_template_args['preview_img'] = '<img src="'.REGISTRATION_FORM_ASSETS_URL.'caf_reg_form_preview.jpg" alt="'.esc_attr__('Preview Question Groups Overview List Table screenshot', 'event_espresso').'" />';
313
+		$this->_template_args['preview_text'] = '<strong>'.esc_html__('Question Groups is a feature that is only available in the Caffeinated version of Event Espresso.  With the Question Groups feature you are able to: create new question groups, edit existing question groups, and also create and edit new questions and add them to question groups.', 'event_espresso').'</strong>';
314
+		$this->display_admin_caf_preview_page('question_groups_tab');
315 315
 	}
316 316
 
317 317
 
@@ -322,58 +322,58 @@  discard block
 block discarded – undo
322 322
 	 * @param \EEM_Base $model
323 323
 	 * @return array where each key is the name of a model's field/db column, and each value is its value.
324 324
 	 */
325
-	protected function _set_column_values_for(EEM_Base $model){
326
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
327
-		$set_column_values=array();
325
+	protected function _set_column_values_for(EEM_Base $model) {
326
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
327
+		$set_column_values = array();
328 328
 
329 329
 		//some initial checks for proper values.
330 330
 		//if QST_admin_only, then no matter what QST_required is we disable.
331
-		if ( !empty( $this->_req_data['QST_admin_only'] ) ) {
331
+		if ( ! empty($this->_req_data['QST_admin_only'])) {
332 332
 			$this->_req_data['QST_required'] = 0;
333 333
 		}
334
-		foreach($model->field_settings() as $fieldName=>$settings){
334
+		foreach ($model->field_settings() as $fieldName=>$settings) {
335 335
 			// basically if QSG_identifier is empty or not set
336
-			if ( $fieldName === 'QSG_identifier' && ( isset( $this->_req_data['QSG_identifier'] ) && empty( $this->_req_data['QSG_identifier'] ) )) {
337
-				$QSG_name = isset( $this->_req_data['QSG_name'] ) ? $this->_req_data['QSG_name'] : '' ;
338
-				$set_column_values[$fieldName] = sanitize_title($QSG_name ) . '-' . uniqid( '', true );
336
+			if ($fieldName === 'QSG_identifier' && (isset($this->_req_data['QSG_identifier']) && empty($this->_req_data['QSG_identifier']))) {
337
+				$QSG_name = isset($this->_req_data['QSG_name']) ? $this->_req_data['QSG_name'] : '';
338
+				$set_column_values[$fieldName] = sanitize_title($QSG_name).'-'.uniqid('', true);
339 339
 //				dd($set_column_values);
340 340
 			}
341 341
 			//if the admin label is blank, use a slug version of the question text
342
-			else if ( $fieldName === 'QST_admin_label' && ( isset( $this->_req_data['QST_admin_label'] ) && empty( $this->_req_data['QST_admin_label'] )  )) {
343
-				$QST_text = isset( $this->_req_data['QST_display_text'] ) ? $this->_req_data['QST_display_text'] : '' ;
344
-				$set_column_values[$fieldName] = sanitize_title(wp_trim_words($QST_text,10));
342
+			else if ($fieldName === 'QST_admin_label' && (isset($this->_req_data['QST_admin_label']) && empty($this->_req_data['QST_admin_label']))) {
343
+				$QST_text = isset($this->_req_data['QST_display_text']) ? $this->_req_data['QST_display_text'] : '';
344
+				$set_column_values[$fieldName] = sanitize_title(wp_trim_words($QST_text, 10));
345 345
 			}
346 346
 
347 347
 
348
-			else if ( $fieldName === 'QST_admin_only' && ( !isset( $this->_req_data['QST_admin_only'] ) ) ) {
348
+			else if ($fieldName === 'QST_admin_only' && ( ! isset($this->_req_data['QST_admin_only']))) {
349 349
 				$set_column_values[$fieldName] = 0;
350 350
 			}
351 351
 
352
-			else if ( $fieldName === 'QST_max' ) {
352
+			else if ($fieldName === 'QST_max') {
353 353
 				$qst_system = EEM_Question::instance()->get_var(
354 354
 					array(
355 355
 						array(
356
-							'QST_ID' => isset( $this->_req_data[ 'QST_ID' ] ) ? $this->_req_data[ 'QST_ID' ] : 0
356
+							'QST_ID' => isset($this->_req_data['QST_ID']) ? $this->_req_data['QST_ID'] : 0
357 357
 						)
358 358
 					),
359 359
 					'QST_system' );
360
-				$max_max = EEM_Question::instance()->absolute_max_for_system_question( $qst_system );
361
-				if( empty( $this->_req_data[ 'QST_max' ] ) ||
362
-					 $this->_req_data[ 'QST_max' ] > $max_max ) {
363
-					$set_column_values[ $fieldName ] = $max_max;
360
+				$max_max = EEM_Question::instance()->absolute_max_for_system_question($qst_system);
361
+				if (empty($this->_req_data['QST_max']) ||
362
+					 $this->_req_data['QST_max'] > $max_max) {
363
+					$set_column_values[$fieldName] = $max_max;
364 364
 				}
365 365
 			}
366 366
 
367 367
 
368 368
 			//only add a property to the array if it's not null (otherwise the model should just use the default value)
369
-			if(
370
-				! isset( $set_column_values[ $fieldName ] ) &&
371
-				isset($this->_req_data[$fieldName] ) ){
372
-				$set_column_values[$fieldName]=$this->_req_data[$fieldName];
369
+			if (
370
+				! isset($set_column_values[$fieldName]) &&
371
+				isset($this->_req_data[$fieldName]) ) {
372
+				$set_column_values[$fieldName] = $this->_req_data[$fieldName];
373 373
 			}
374 374
 
375 375
 		}
376
-		return $set_column_values;//validation fo this data to be performed by the model before insertion.
376
+		return $set_column_values; //validation fo this data to be performed by the model before insertion.
377 377
 	}
378 378
 
379 379
 
@@ -392,39 +392,39 @@  discard block
 block discarded – undo
392 392
 	 * _edit_question
393 393
 	 */
394 394
 	protected function _edit_question() {
395
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
396
-		$ID=isset( $this->_req_data['QST_ID'] ) && ! empty( $this->_req_data['QST_ID'] ) ? absint( $this->_req_data['QST_ID'] ) : FALSE;
395
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
396
+		$ID = isset($this->_req_data['QST_ID']) && ! empty($this->_req_data['QST_ID']) ? absint($this->_req_data['QST_ID']) : FALSE;
397 397
 
398
-		switch( $this->_req_action ) {
398
+		switch ($this->_req_action) {
399 399
 			case 'add_question' :
400
-				$this->_admin_page_title = esc_html__( 'Add Question', 'event_espresso' );
400
+				$this->_admin_page_title = esc_html__('Add Question', 'event_espresso');
401 401
 				break;
402 402
 			case 'edit_question' :
403
-				$this->_admin_page_title = esc_html__( 'Edit Question', 'event_espresso' );
403
+				$this->_admin_page_title = esc_html__('Edit Question', 'event_espresso');
404 404
 				break;
405 405
 			default :
406
-				$this->_admin_page_title = ucwords( str_replace( '_', ' ', $this->_req_action ));
406
+				$this->_admin_page_title = ucwords(str_replace('_', ' ', $this->_req_action));
407 407
 		}
408 408
 
409 409
 		// add PRC_ID to title if editing
410
-		$this->_admin_page_title = $ID ? $this->_admin_page_title . ' # ' . $ID : $this->_admin_page_title;
411
-		if($ID){
412
-			$question=$this->_question_model->get_one_by_ID($ID);
413
-			$additional_hidden_fields=array('QST_ID'=>array('type'=>'hidden','value'=>$ID));
410
+		$this->_admin_page_title = $ID ? $this->_admin_page_title.' # '.$ID : $this->_admin_page_title;
411
+		if ($ID) {
412
+			$question = $this->_question_model->get_one_by_ID($ID);
413
+			$additional_hidden_fields = array('QST_ID'=>array('type'=>'hidden', 'value'=>$ID));
414 414
 			$this->_set_add_edit_form_tags('update_question', $additional_hidden_fields);
415
-		}else{
416
-			$question= EE_Question::new_instance();
415
+		} else {
416
+			$question = EE_Question::new_instance();
417 417
 			$question->set_order_to_latest();
418 418
 			$this->_set_add_edit_form_tags('insert_question');
419 419
 		}
420
-		$question_types = $question->has_answers() ?  $this->_question_model->question_types_in_same_category( $question->type() ) : $this->_question_model->allowed_question_types();
421
-		$this->_template_args['QST_ID']=$ID;
422
-		$this->_template_args['question']=$question;
423
-		$this->_template_args['question_types']= $question_types;
424
-		$this->_template_args['max_max'] = EEM_Question::instance()->absolute_max_for_system_question( $question->system_ID() );
420
+		$question_types = $question->has_answers() ? $this->_question_model->question_types_in_same_category($question->type()) : $this->_question_model->allowed_question_types();
421
+		$this->_template_args['QST_ID'] = $ID;
422
+		$this->_template_args['question'] = $question;
423
+		$this->_template_args['question_types'] = $question_types;
424
+		$this->_template_args['max_max'] = EEM_Question::instance()->absolute_max_for_system_question($question->system_ID());
425 425
 		$this->_template_args['question_type_descriptions'] = $this->_get_question_type_descriptions();
426
-		$this->_set_publish_post_box_vars( 'id', $ID );
427
-		$this->_template_args['admin_page_content'] = EEH_Template::display_template( REGISTRATION_FORM_TEMPLATE_PATH . 'questions_main_meta_box.template.php', $this->_template_args, TRUE );
426
+		$this->_set_publish_post_box_vars('id', $ID);
427
+		$this->_template_args['admin_page_content'] = EEH_Template::display_template(REGISTRATION_FORM_TEMPLATE_PATH.'questions_main_meta_box.template.php', $this->_template_args, TRUE);
428 428
 
429 429
 		// the details template wrapper
430 430
 		$this->display_admin_page_with_sidebar();
@@ -439,18 +439,18 @@  discard block
 block discarded – undo
439 439
 		EE_Registry::instance()->load_helper('HTML');
440 440
 		$descriptions = '';
441 441
 		$question_type_descriptions = EEM_Question::instance()->question_descriptions();
442
-		foreach ( $question_type_descriptions as $type => $question_type_description ) {
443
-			if ( $type == 'HTML_TEXTAREA' ) {
442
+		foreach ($question_type_descriptions as $type => $question_type_description) {
443
+			if ($type == 'HTML_TEXTAREA') {
444 444
 				$html = new EE_Simple_HTML_Validation_Strategy();
445 445
 				$question_type_description .= sprintf(
446
-					esc_html__( '%1$s(allowed tags: %2$s)', 'event_espresso' ),
446
+					esc_html__('%1$s(allowed tags: %2$s)', 'event_espresso'),
447 447
 					'<br/>',
448 448
 					$html->get_list_of_allowed_tags()
449 449
 				);
450 450
 			}
451 451
 			$descriptions .= EEH_HTML::p(
452 452
 				$question_type_description,
453
-				'question_type_description-' . $type,
453
+				'question_type_description-'.$type,
454 454
 				'question_type_description description',
455 455
 				'display:none;'
456 456
 			);
@@ -464,58 +464,58 @@  discard block
 block discarded – undo
464 464
 	 * @param bool|true $new_question
465 465
 	 * @throws \EE_Error
466 466
 	 */
467
-	protected function _insert_or_update_question( $new_question = TRUE) {
468
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
469
-		$set_column_values=$this->_set_column_values_for($this->_question_model);
470
-		if($new_question){
471
-			$ID=$this->_question_model->insert($set_column_values);
467
+	protected function _insert_or_update_question($new_question = TRUE) {
468
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
469
+		$set_column_values = $this->_set_column_values_for($this->_question_model);
470
+		if ($new_question) {
471
+			$ID = $this->_question_model->insert($set_column_values);
472 472
 			$success = $ID ? true : false;
473 473
 			$action_desc = 'added';
474
-		}else{
475
-			$ID=absint($this->_req_data['QST_ID']);
476
-			$pk=$this->_question_model->primary_key_name();
477
-			$wheres=array($pk=>$ID);
474
+		} else {
475
+			$ID = absint($this->_req_data['QST_ID']);
476
+			$pk = $this->_question_model->primary_key_name();
477
+			$wheres = array($pk=>$ID);
478 478
 			unset($set_column_values[$pk]);
479
-			$success= $this->_question_model->update($set_column_values,array($wheres));
480
-			$action_desc='updated';
479
+			$success = $this->_question_model->update($set_column_values, array($wheres));
480
+			$action_desc = 'updated';
481 481
 		}
482 482
 
483
-		if ($ID){
483
+		if ($ID) {
484 484
 			//save the related options
485 485
 			//trash removed options, save old ones
486 486
 			//get list of all options
487 487
 			/** @type EE_Question $question */
488
-			$question=$this->_question_model->get_one_by_ID($ID);
489
-			$options=$question->options();
490
-			if(! empty($options)){
491
-				foreach($options as $option_ID=>$option){
492
-					$option_req_index=$this->_get_option_req_data_index($option_ID);
493
-					if($option_req_index!==FALSE){
488
+			$question = $this->_question_model->get_one_by_ID($ID);
489
+			$options = $question->options();
490
+			if ( ! empty($options)) {
491
+				foreach ($options as $option_ID=>$option) {
492
+					$option_req_index = $this->_get_option_req_data_index($option_ID);
493
+					if ($option_req_index !== FALSE) {
494 494
 						$option->save($this->_req_data['question_options'][$option_req_index]);
495
-					}else{
495
+					} else {
496 496
 						//not found, remove it
497 497
 						$option->delete();
498 498
 					}
499 499
 				}
500 500
 			}
501 501
 			//save new related options
502
-			foreach($this->_req_data['question_options'] as $index=>$option_req_data){
503
-				if( empty($option_req_data['QSO_ID'] ) && (  ( isset( $option_req_data['QSO_value'] ) && $option_req_data['QSO_value'] !== '' ) || ! empty( $option_req_data['QSO_desc'] ) ) ) {//no ID! save it!
504
-					if( ! isset( $option_req_data['QSO_value'] ) || $option_req_data['QSO_value'] === ''  ){
505
-						$option_req_data['QSO_value']=$option_req_data['QSO_desc'];
502
+			foreach ($this->_req_data['question_options'] as $index=>$option_req_data) {
503
+				if (empty($option_req_data['QSO_ID']) && ((isset($option_req_data['QSO_value']) && $option_req_data['QSO_value'] !== '') || ! empty($option_req_data['QSO_desc']))) {//no ID! save it!
504
+					if ( ! isset($option_req_data['QSO_value']) || $option_req_data['QSO_value'] === '') {
505
+						$option_req_data['QSO_value'] = $option_req_data['QSO_desc'];
506 506
 					}
507
-					$new_option=EE_Question_Option::new_instance( array( 'QSO_value' => $option_req_data['QSO_value'], 'QSO_desc' => $option_req_data['QSO_desc'], 'QSO_order' => $option_req_data['QSO_order'], 'QST_ID' => $question->ID()));
507
+					$new_option = EE_Question_Option::new_instance(array('QSO_value' => $option_req_data['QSO_value'], 'QSO_desc' => $option_req_data['QSO_desc'], 'QSO_order' => $option_req_data['QSO_order'], 'QST_ID' => $question->ID()));
508 508
 					$new_option->save();
509 509
 				}
510 510
 			}
511 511
 		}
512
-		$query_args = array( 'action' => 'edit_question', 'QST_ID' => $ID );
513
-		if ( $success !== FALSE ) {
514
-			$msg = $new_question ? sprintf( esc_html__('The %s has been created', 'event_espresso'), $this->_question_model->item_name() ) : sprintf( esc_html__('The %s has been updated', 'event_espresso' ), $this->_question_model->item_name() );
515
-			EE_Error::add_success( $msg );
512
+		$query_args = array('action' => 'edit_question', 'QST_ID' => $ID);
513
+		if ($success !== FALSE) {
514
+			$msg = $new_question ? sprintf(esc_html__('The %s has been created', 'event_espresso'), $this->_question_model->item_name()) : sprintf(esc_html__('The %s has been updated', 'event_espresso'), $this->_question_model->item_name());
515
+			EE_Error::add_success($msg);
516 516
 		}
517 517
 
518
-		$this->_redirect_after_action( FALSE, '', $action_desc, $query_args, TRUE);
518
+		$this->_redirect_after_action(FALSE, '', $action_desc, $query_args, TRUE);
519 519
 	}
520 520
 
521 521
 
@@ -528,10 +528,10 @@  discard block
 block discarded – undo
528 528
 	 * @param int $ID of the question option to find
529 529
 	 * @return int index in question_options array if successful, FALSE if unsuccessful
530 530
 	 */
531
-	protected function _get_option_req_data_index($ID){
532
-		$req_data_for_question_options=$this->_req_data['question_options'];
533
-		foreach($req_data_for_question_options as $num=>$option_data){
534
-			if( array_key_exists('QSO_ID',$option_data) && (int)$option_data['QSO_ID'] === $ID ){
531
+	protected function _get_option_req_data_index($ID) {
532
+		$req_data_for_question_options = $this->_req_data['question_options'];
533
+		foreach ($req_data_for_question_options as $num=>$option_data) {
534
+			if (array_key_exists('QSO_ID', $option_data) && (int) $option_data['QSO_ID'] === $ID) {
535 535
 				return $num;
536 536
 			}
537 537
 		}
@@ -553,25 +553,25 @@  discard block
 block discarded – undo
553 553
 	 * @param int      $current_page
554 554
 	 * @return array lik EEM_Base::get_all's $query_params parameter
555 555
 	 */
556
-	protected function get_query_params($model, $per_page=10,$current_page=10){
556
+	protected function get_query_params($model, $per_page = 10, $current_page = 10) {
557 557
 		$query_params = array();
558
-		$offset=($current_page-1)*$per_page;
559
-		$query_params['limit']=array($offset,$per_page);
560
-		$order = ( isset( $this->_req_data['order'] ) && ! empty( $this->_req_data['order'] )) ? $this->_req_data['order'] : 'ASC';
558
+		$offset = ($current_page - 1) * $per_page;
559
+		$query_params['limit'] = array($offset, $per_page);
560
+		$order = (isset($this->_req_data['order']) && ! empty($this->_req_data['order'])) ? $this->_req_data['order'] : 'ASC';
561 561
 		$orderby_field = $model instanceof EEM_Question ? 'QST_ID' : 'QSG_order';
562 562
 		$field_to_order_by = empty($this->_req_data['orderby']) ? $orderby_field : $this->_req_data['orderby'];
563
-		$query_params['order_by']=array( $field_to_order_by => $order );
564
-		$search_string = array_key_exists('s',$this->_req_data) ? $this->_req_data['s'] : null;
565
-		if(! empty($search_string)){
566
-			if($model instanceof EEM_Question_Group){
567
-				$query_params[0]=array(
563
+		$query_params['order_by'] = array($field_to_order_by => $order);
564
+		$search_string = array_key_exists('s', $this->_req_data) ? $this->_req_data['s'] : null;
565
+		if ( ! empty($search_string)) {
566
+			if ($model instanceof EEM_Question_Group) {
567
+				$query_params[0] = array(
568 568
 					'OR'=>array(
569
-						'QSG_name'=>array('LIKE',"%$search_string%"),
570
-						'QSG_desc'=>array('LIKE',"%$search_string%"))
569
+						'QSG_name'=>array('LIKE', "%$search_string%"),
570
+						'QSG_desc'=>array('LIKE', "%$search_string%"))
571 571
 					);
572
-			}else{
573
-				$query_params[0]=array(
574
-					'QST_display_text'=>array('LIKE',"%$search_string%")
572
+			} else {
573
+				$query_params[0] = array(
574
+					'QST_display_text'=>array('LIKE', "%$search_string%")
575 575
 					);
576 576
 			}
577 577
 		}
@@ -619,13 +619,13 @@  discard block
 block discarded – undo
619 619
 	 * @param bool|false $count
620 620
 	 * @return \EE_Soft_Delete_Base_Class[]|int
621 621
 	 */
622
-	public function get_questions( $per_page=10, $current_page = 1, $count = FALSE ) {
622
+	public function get_questions($per_page = 10, $current_page = 1, $count = FALSE) {
623 623
 		$QST = EEM_Question::instance();
624 624
 		$query_params = $this->get_query_params($QST, $per_page, $current_page);
625
-		if ($count){
626
-			$where = isset( $query_params[0] ) ? array( $query_params[0] ) : array();
625
+		if ($count) {
626
+			$where = isset($query_params[0]) ? array($query_params[0]) : array();
627 627
 			$results = $QST->count($where);
628
-		}else{
628
+		} else {
629 629
 			$results = $QST->get_all($query_params);
630 630
 		}
631 631
 		return $results;
@@ -640,10 +640,10 @@  discard block
 block discarded – undo
640 640
 	 * @param bool|false $count
641 641
 	 * @return \EE_Soft_Delete_Base_Class[]|int
642 642
 	 */
643
-	public function get_trashed_questions( $per_page, $current_page = 1, $count = FALSE ) {
644
-		$query_params =$this->get_query_params( EEM_Question::instance(), $per_page, $current_page);
645
-		$where        = isset( $query_params[0] ) ? array($query_params[0]) : array();
646
-		$questions    =$count ? EEM_Question::instance()->count_deleted($where) : EEM_Question::instance()->get_all_deleted($query_params);
643
+	public function get_trashed_questions($per_page, $current_page = 1, $count = FALSE) {
644
+		$query_params = $this->get_query_params(EEM_Question::instance(), $per_page, $current_page);
645
+		$where        = isset($query_params[0]) ? array($query_params[0]) : array();
646
+		$questions    = $count ? EEM_Question::instance()->count_deleted($where) : EEM_Question::instance()->get_all_deleted($query_params);
647 647
 		return $questions;
648 648
 	}
649 649
 
@@ -655,12 +655,12 @@  discard block
 block discarded – undo
655 655
 	 * @param bool|false $count
656 656
 	 * @return \EE_Soft_Delete_Base_Class[]
657 657
 	 */
658
-	public function get_question_groups( $per_page, $current_page = 1, $count = FALSE ) {
658
+	public function get_question_groups($per_page, $current_page = 1, $count = FALSE) {
659 659
 		/** @type EEM_Question_Group $questionGroupModel */
660 660
 		$questionGroupModel = EEM_Question_Group::instance();
661 661
 		//note: this a subclass of EEM_Soft_Delete_Base, so this is actually only getting non-trashed items
662 662
 		return $questionGroupModel->get_all(
663
-			$this->get_query_params( $questionGroupModel, $per_page, $current_page )
663
+			$this->get_query_params($questionGroupModel, $per_page, $current_page)
664 664
 		);
665 665
 	}
666 666
 
Please login to merge, or discard this patch.
admin/extend/registration_form/Extend_Registration_Form_Admin_Page.core.php 2 patches
Indentation   +87 added lines, -87 removed lines patch added patch discarded remove patch
@@ -245,13 +245,13 @@  discard block
 block discarded – undo
245 245
 					'persistent' => FALSE
246 246
 					),
247 247
 				'metaboxes' => array_merge( $this->_default_espresso_metaboxes, array('_publish_post_box' ) ),
248
-                'help_tabs' => array(
248
+				'help_tabs' => array(
249 249
 					'registration_form_add_question_help_tab' => array(
250 250
 						'title' => esc_html__('Add Question', 'event_espresso'),
251 251
 						'filename' => 'registration_form_add_question'
252 252
 						),
253 253
 					),
254
-                'help_tour' => array( 'Registration_Form_Add_Question_Help_Tour'),
254
+				'help_tour' => array( 'Registration_Form_Add_Question_Help_Tour'),
255 255
 				'require_nonce' => FALSE
256 256
 				),
257 257
 
@@ -268,7 +268,7 @@  discard block
 block discarded – undo
268 268
 						'filename' => 'registration_form_add_question_group'
269 269
 						),
270 270
 					),
271
-                'help_tour' => array( 'Registration_Form_Add_Question_Group_Help_Tour'),
271
+				'help_tour' => array( 'Registration_Form_Add_Question_Group_Help_Tour'),
272 272
 				'require_nonce' => FALSE
273 273
 				),
274 274
 
@@ -286,7 +286,7 @@  discard block
 block discarded – undo
286 286
 						'filename' => 'registration_form_edit_question_group'
287 287
 						),
288 288
 					),
289
-                'help_tour' => array( 'Registration_Form_Edit_Question_Group_Help_Tour'),
289
+				'help_tour' => array( 'Registration_Form_Edit_Question_Group_Help_Tour'),
290 290
 				'require_nonce' => FALSE
291 291
 				),
292 292
 
@@ -305,7 +305,7 @@  discard block
 block discarded – undo
305 305
 						'filename' => 'registration_form_reg_form_settings'
306 306
 						),
307 307
 					),
308
-                'help_tour' => array( 'Registration_Form_Settings_Help_Tour'),
308
+				'help_tour' => array( 'Registration_Form_Settings_Help_Tour'),
309 309
 				'require_nonce' => FALSE
310 310
 				)
311 311
 
@@ -933,7 +933,7 @@  discard block
 block discarded – undo
933 933
 	 * @return EE_Form_Section_Proper
934 934
 	 */
935 935
 	protected function _email_validation_settings_form() {
936
-        return new EE_Form_Section_Proper(
936
+		return new EE_Form_Section_Proper(
937 937
 			array(
938 938
 				'name'            => 'email_validation_settings',
939 939
 				'html_id'         => 'email_validation_settings',
@@ -951,7 +951,7 @@  discard block
 block discarded – undo
951 951
 						),
952 952
 						array(
953 953
 							'html_label_text' => esc_html__( 'Email Validation Level', 'event_espresso' )
954
-							                     . EEH_Template::get_help_tab_link( 'email_validation_info' ),
954
+												 . EEH_Template::get_help_tab_link( 'email_validation_info' ),
955 955
 							'html_help_text'  => esc_html__( 'These levels range from basic validation ( ie: [email protected] ) to more advanced checks against international email addresses (ie: üñîçøðé@example.com ) with additional MX and A record checks to confirm the domain actually exists. More information on on each level can be found within the help section.', 'event_espresso'),
956 956
 							'default' => isset( EE_Registry::instance()->CFG->registration->email_validation_level )
957 957
 								? EE_Registry::instance()->CFG->registration->email_validation_level
@@ -973,8 +973,8 @@  discard block
 block discarded – undo
973 973
 	 * @return \EE_Registration_Config
974 974
 	 */
975 975
 	public function update_email_validation_settings_form( EE_Registration_Config $EE_Registration_Config ) {
976
-        $prev_email_validation_level = $EE_Registration_Config->email_validation_level;
977
-        try {
976
+		$prev_email_validation_level = $EE_Registration_Config->email_validation_level;
977
+		try {
978 978
 			$email_validation_settings_form = $this->_email_validation_settings_form();
979 979
 			// if not displaying a form, then check for form submission
980 980
 			if ( $email_validation_settings_form->was_submitted() ) {
@@ -985,38 +985,38 @@  discard block
 block discarded – undo
985 985
 					// grab validated data from form
986 986
 					$valid_data = $email_validation_settings_form->valid_data();
987 987
 					if ( isset( $valid_data['email_validation_level'] ) ) {
988
-					    $email_validation_level = $valid_data['email_validation_level'];
989
-                        // now if they want to use international email addresses
990
-                        if ( $email_validation_level === 'i18n' || $email_validation_level === 'i18n_dns' ) {
991
-                            // in case we need to reset their email validation level,
992
-                            // make sure that the previous value wasn't already set to one of the i18n options.
993
-                            if ( $prev_email_validation_level === 'i18n' || $prev_email_validation_level === 'i18n_dns' ) {
994
-                                // if so, then reset it back to "basic" since that is the only other option that,
995
-                                // despite offering poor validation, supports i18n email addresses
996
-                                $prev_email_validation_level = 'basic';
997
-                            }
998
-                            // confirm our i18n email validation will work on the server
999
-                            if ( ! $this->_verify_pcre_support($EE_Registration_Config, $email_validation_level)) {
1000
-                                // or reset email validation level to previous value
1001
-                                $email_validation_level = $prev_email_validation_level;
1002
-                            }
1003
-                        }
1004
-                        $EE_Registration_Config->email_validation_level = $email_validation_level;
1005
-                    } else {
988
+						$email_validation_level = $valid_data['email_validation_level'];
989
+						// now if they want to use international email addresses
990
+						if ( $email_validation_level === 'i18n' || $email_validation_level === 'i18n_dns' ) {
991
+							// in case we need to reset their email validation level,
992
+							// make sure that the previous value wasn't already set to one of the i18n options.
993
+							if ( $prev_email_validation_level === 'i18n' || $prev_email_validation_level === 'i18n_dns' ) {
994
+								// if so, then reset it back to "basic" since that is the only other option that,
995
+								// despite offering poor validation, supports i18n email addresses
996
+								$prev_email_validation_level = 'basic';
997
+							}
998
+							// confirm our i18n email validation will work on the server
999
+							if ( ! $this->_verify_pcre_support($EE_Registration_Config, $email_validation_level)) {
1000
+								// or reset email validation level to previous value
1001
+								$email_validation_level = $prev_email_validation_level;
1002
+							}
1003
+						}
1004
+						$EE_Registration_Config->email_validation_level = $email_validation_level;
1005
+					} else {
1006 1006
 						EE_Error::add_error(
1007 1007
 							esc_html__(
1008 1008
 								'Invalid or missing Email Validation settings. Please refresh the form and try again.',
1009 1009
 								'event_espresso'
1010 1010
 							),
1011
-                            __FILE__, __FUNCTION__, __LINE__
1012
-                        );
1011
+							__FILE__, __FUNCTION__, __LINE__
1012
+						);
1013 1013
 					}
1014 1014
 				} else {
1015 1015
 					if ( $email_validation_settings_form->submission_error_message() !== '' ) {
1016 1016
 						EE_Error::add_error(
1017 1017
 							$email_validation_settings_form->submission_error_message(),
1018
-                            __FILE__, __FUNCTION__, __LINE__
1019
-                        );
1018
+							__FILE__, __FUNCTION__, __LINE__
1019
+						);
1020 1020
 					}
1021 1021
 				}
1022 1022
 			}
@@ -1028,61 +1028,61 @@  discard block
 block discarded – undo
1028 1028
 
1029 1029
 
1030 1030
 
1031
-    /**
1032
-     * confirms that the server's PHP version has the PCRE module enabled,
1033
-     * and that the PCRE version works with our i18n email validation
1034
-     *
1035
-     * @param \EE_Registration_Config $EE_Registration_Config
1036
-     * @param string                  $email_validation_level
1037
-     * @return bool
1038
-     */
1039
-    private function _verify_pcre_support(EE_Registration_Config $EE_Registration_Config, $email_validation_level)
1040
-    {
1041
-        // first check that PCRE is enabled
1042
-        if ( ! defined('PREG_BAD_UTF8_ERROR')) {
1043
-            EE_Error::add_error(
1044
-                sprintf(
1045
-                    esc_html__(
1046
-                        'We\'re sorry, but it appears that your server\'s version of PHP was not compiled with PCRE unicode support.%1$sPlease contact your hosting company and ask them whether the PCRE compiled with your version of PHP on your server can be been built with the "--enable-unicode-properties" and "--enable-utf8" configuration switches to enable more complex regex expressions.%1$sIf they are unable, or unwilling to do so, then your server will not support international email addresses using UTF-8 unicode characters. This means you will either have to lower your email validation level to "Basic" or "WordPress Default", or switch to a hosting company that has/can enable PCRE unicode support on the server.',
1047
-                        'event_espresso'
1048
-                    ),
1049
-                    '<br />'
1050
-                ),
1051
-                __FILE__,
1052
-                __FUNCTION__,
1053
-                __LINE__
1054
-            );
1055
-            return false;
1056
-        } else {
1057
-            // PCRE support is enabled, but let's still
1058
-            // perform a test to see if the server will support it.
1059
-            // but first, save the updated validation level to the config,
1060
-            // so that the validation strategy picks it up.
1061
-            // this will get bumped back down if it doesn't work
1062
-            $EE_Registration_Config->email_validation_level = $email_validation_level;
1063
-            try {
1064
-                $email_validator = new EE_Email_Validation_Strategy();
1065
-                $i18n_email_address = apply_filters(
1066
-                    'FHEE__Extend_Registration_Form_Admin_Page__update_email_validation_settings_form__i18n_email_address',
1067
-                    'jägerjü[email protected]'
1068
-                );
1069
-                $email_validator->validate($i18n_email_address);
1070
-            } catch (Exception $e) {
1071
-                EE_Error::add_error(
1072
-                    sprintf(
1073
-                        esc_html__(
1074
-                            'We\'re sorry, but it appears that your server\'s configuration will not support the "International" or "International + DNS Check" email validation levels.%1$sTo correct this issue, please consult with your hosting company regarding your server\'s PCRE settings.%1$sIt is recommended that your PHP version be configured to use PCRE 8.10 or newer.%1$sMore information regarding PCRE versions and installation can be found here: %2$s',
1075
-                            'event_espresso'
1076
-                        ),
1077
-                        '<br />',
1078
-                        '<a href="http://php.net/manual/en/pcre.installation.php" target="_blank">http://php.net/manual/en/pcre.installation.php</a>'
1079
-                    ),
1080
-                    __FILE__, __FUNCTION__, __LINE__
1081
-                );
1082
-                return false;
1083
-            }
1084
-        }
1085
-        return true;
1086
-    }
1031
+	/**
1032
+	 * confirms that the server's PHP version has the PCRE module enabled,
1033
+	 * and that the PCRE version works with our i18n email validation
1034
+	 *
1035
+	 * @param \EE_Registration_Config $EE_Registration_Config
1036
+	 * @param string                  $email_validation_level
1037
+	 * @return bool
1038
+	 */
1039
+	private function _verify_pcre_support(EE_Registration_Config $EE_Registration_Config, $email_validation_level)
1040
+	{
1041
+		// first check that PCRE is enabled
1042
+		if ( ! defined('PREG_BAD_UTF8_ERROR')) {
1043
+			EE_Error::add_error(
1044
+				sprintf(
1045
+					esc_html__(
1046
+						'We\'re sorry, but it appears that your server\'s version of PHP was not compiled with PCRE unicode support.%1$sPlease contact your hosting company and ask them whether the PCRE compiled with your version of PHP on your server can be been built with the "--enable-unicode-properties" and "--enable-utf8" configuration switches to enable more complex regex expressions.%1$sIf they are unable, or unwilling to do so, then your server will not support international email addresses using UTF-8 unicode characters. This means you will either have to lower your email validation level to "Basic" or "WordPress Default", or switch to a hosting company that has/can enable PCRE unicode support on the server.',
1047
+						'event_espresso'
1048
+					),
1049
+					'<br />'
1050
+				),
1051
+				__FILE__,
1052
+				__FUNCTION__,
1053
+				__LINE__
1054
+			);
1055
+			return false;
1056
+		} else {
1057
+			// PCRE support is enabled, but let's still
1058
+			// perform a test to see if the server will support it.
1059
+			// but first, save the updated validation level to the config,
1060
+			// so that the validation strategy picks it up.
1061
+			// this will get bumped back down if it doesn't work
1062
+			$EE_Registration_Config->email_validation_level = $email_validation_level;
1063
+			try {
1064
+				$email_validator = new EE_Email_Validation_Strategy();
1065
+				$i18n_email_address = apply_filters(
1066
+					'FHEE__Extend_Registration_Form_Admin_Page__update_email_validation_settings_form__i18n_email_address',
1067
+					'jägerjü[email protected]'
1068
+				);
1069
+				$email_validator->validate($i18n_email_address);
1070
+			} catch (Exception $e) {
1071
+				EE_Error::add_error(
1072
+					sprintf(
1073
+						esc_html__(
1074
+							'We\'re sorry, but it appears that your server\'s configuration will not support the "International" or "International + DNS Check" email validation levels.%1$sTo correct this issue, please consult with your hosting company regarding your server\'s PCRE settings.%1$sIt is recommended that your PHP version be configured to use PCRE 8.10 or newer.%1$sMore information regarding PCRE versions and installation can be found here: %2$s',
1075
+							'event_espresso'
1076
+						),
1077
+						'<br />',
1078
+						'<a href="http://php.net/manual/en/pcre.installation.php" target="_blank">http://php.net/manual/en/pcre.installation.php</a>'
1079
+					),
1080
+					__FILE__, __FUNCTION__, __LINE__
1081
+				);
1082
+				return false;
1083
+			}
1084
+		}
1085
+		return true;
1086
+	}
1087 1087
 
1088 1088
 }
Please login to merge, or discard this patch.
Spacing   +187 added lines, -187 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if (!defined('EVENT_ESPRESSO_VERSION') ){
2
+if ( ! defined('EVENT_ESPRESSO_VERSION')) {
3 3
 	exit('NO direct script access allowed');
4 4
 }
5 5
 /**
@@ -36,13 +36,13 @@  discard block
 block discarded – undo
36 36
 	 * 		@param bool $routing indicate whether we want to just load the object and handle routing or just load the object.
37 37
 	 * 		@access public
38 38
 	 */
39
-	public function __construct( $routing = TRUE ) {
40
-		define( 'REGISTRATION_FORM_CAF_ADMIN', EE_CORE_CAF_ADMIN_EXTEND . 'registration_form' . DS );
41
-		define( 'REGISTRATION_FORM_CAF_ASSETS_PATH', REGISTRATION_FORM_CAF_ADMIN . 'assets' . DS );
42
-		define( 'REGISTRATION_FORM_CAF_ASSETS_URL', EE_CORE_CAF_ADMIN_EXTEND_URL . 'registration_form/assets/' );
43
-		define( 'REGISTRATION_FORM_CAF_TEMPLATE_PATH', REGISTRATION_FORM_CAF_ADMIN . 'templates' . DS );
44
-		define( 'REGISTRATION_FORM_CAF_TEMPLATE_URL', EE_CORE_CAF_ADMIN_EXTEND_URL . 'registration_form/templates/' );
45
-		parent::__construct( $routing );
39
+	public function __construct($routing = TRUE) {
40
+		define('REGISTRATION_FORM_CAF_ADMIN', EE_CORE_CAF_ADMIN_EXTEND.'registration_form'.DS);
41
+		define('REGISTRATION_FORM_CAF_ASSETS_PATH', REGISTRATION_FORM_CAF_ADMIN.'assets'.DS);
42
+		define('REGISTRATION_FORM_CAF_ASSETS_URL', EE_CORE_CAF_ADMIN_EXTEND_URL.'registration_form/assets/');
43
+		define('REGISTRATION_FORM_CAF_TEMPLATE_PATH', REGISTRATION_FORM_CAF_ADMIN.'templates'.DS);
44
+		define('REGISTRATION_FORM_CAF_TEMPLATE_URL', EE_CORE_CAF_ADMIN_EXTEND_URL.'registration_form/templates/');
45
+		parent::__construct($routing);
46 46
 	}
47 47
 
48 48
 
@@ -52,8 +52,8 @@  discard block
 block discarded – undo
52 52
 
53 53
 	protected function _extend_page_config() {
54 54
 		$this->_admin_base_path = REGISTRATION_FORM_CAF_ADMIN;
55
-		$qst_id = ! empty( $this->_req_data['QST_ID'] ) && ! is_array( $this->_req_data['QST_ID'] ) ? $this->_req_data['QST_ID'] : 0;
56
-		$qsg_id = ! empty( $this->_req_data['QSG_ID'] ) && ! is_array( $this->_req_data['QSG_ID'] ) ? $this->_req_data['QSG_ID'] : 0;
55
+		$qst_id = ! empty($this->_req_data['QST_ID']) && ! is_array($this->_req_data['QST_ID']) ? $this->_req_data['QST_ID'] : 0;
56
+		$qsg_id = ! empty($this->_req_data['QSG_ID']) && ! is_array($this->_req_data['QSG_ID']) ? $this->_req_data['QSG_ID'] : 0;
57 57
 
58 58
 		$new_page_routes = array(
59 59
 			'question_groups' => array(
@@ -86,7 +86,7 @@  discard block
 block discarded – undo
86 86
 				'func' => '_trash_or_restore_questions',
87 87
 				'capability' => 'ee_delete_question',
88 88
 				'obj_id' => $qst_id,
89
-				'args' => array( 'trash' => FALSE ),
89
+				'args' => array('trash' => FALSE),
90 90
 				'noheader' => TRUE
91 91
 				),
92 92
 
@@ -145,7 +145,7 @@  discard block
 block discarded – undo
145 145
 
146 146
 			'trash_question_group' => array(
147 147
 				'func' => '_trash_or_restore_question_groups',
148
-				'args' => array( 'trash' => TRUE ),
148
+				'args' => array('trash' => TRUE),
149 149
 				'capability' => 'ee_delete_question_group',
150 150
 				'obj_id' => $qsg_id,
151 151
 				'noheader' => TRUE
@@ -153,7 +153,7 @@  discard block
 block discarded – undo
153 153
 
154 154
 			'restore_question_group' => array(
155 155
 				'func' => '_trash_or_restore_question_groups',
156
-				'args' => array( 'trash' => FALSE ),
156
+				'args' => array('trash' => FALSE),
157 157
 				'capability' => 'ee_delete_question_group',
158 158
 				'obj_id' => $qsg_id,
159 159
 				'noheader' => TRUE
@@ -168,7 +168,7 @@  discard block
 block discarded – undo
168 168
 
169 169
 			'update_question_group' => array(
170 170
 				'func' => '_insert_or_update_question_group',
171
-				'args' => array('new_question_group' => FALSE ),
171
+				'args' => array('new_question_group' => FALSE),
172 172
 				'capability' => 'ee_edit_question_group',
173 173
 				'obj_id' => $qsg_id,
174 174
 				'noheader' => TRUE,
@@ -206,7 +206,7 @@  discard block
 block discarded – undo
206 206
 					'noheader' => TRUE
207 207
 				),
208 208
 			);
209
-		$this->_page_routes = array_merge( $this->_page_routes, $new_page_routes );
209
+		$this->_page_routes = array_merge($this->_page_routes, $new_page_routes);
210 210
 
211 211
 		$new_page_config = array(
212 212
 
@@ -230,7 +230,7 @@  discard block
 block discarded – undo
230 230
 						'filename' => 'registration_form_question_groups_views_bulk_actions_search'
231 231
 						),
232 232
 					),
233
-				'help_tour' => array( 'Registration_Form_Question_Groups_Help_Tour'),
233
+				'help_tour' => array('Registration_Form_Question_Groups_Help_Tour'),
234 234
 				'metaboxes' => $this->_default_espresso_metaboxes,
235 235
 				'require_nonce' => FALSE,
236 236
 				'qtips' => array(
@@ -244,14 +244,14 @@  discard block
 block discarded – undo
244 244
 					'order' => 5,
245 245
 					'persistent' => FALSE
246 246
 					),
247
-				'metaboxes' => array_merge( $this->_default_espresso_metaboxes, array('_publish_post_box' ) ),
247
+				'metaboxes' => array_merge($this->_default_espresso_metaboxes, array('_publish_post_box')),
248 248
                 'help_tabs' => array(
249 249
 					'registration_form_add_question_help_tab' => array(
250 250
 						'title' => esc_html__('Add Question', 'event_espresso'),
251 251
 						'filename' => 'registration_form_add_question'
252 252
 						),
253 253
 					),
254
-                'help_tour' => array( 'Registration_Form_Add_Question_Help_Tour'),
254
+                'help_tour' => array('Registration_Form_Add_Question_Help_Tour'),
255 255
 				'require_nonce' => FALSE
256 256
 				),
257 257
 
@@ -261,14 +261,14 @@  discard block
 block discarded – undo
261 261
 					'order' => 5,
262 262
 					'persistent' => FALSE
263 263
 					),
264
-				'metaboxes' => array_merge( $this->_default_espresso_metaboxes, array('_publish_post_box' ) ),
264
+				'metaboxes' => array_merge($this->_default_espresso_metaboxes, array('_publish_post_box')),
265 265
 				'help_tabs' => array(
266 266
 					'registration_form_add_question_group_help_tab' => array(
267 267
 						'title' => esc_html__('Add Question Group', 'event_espresso'),
268 268
 						'filename' => 'registration_form_add_question_group'
269 269
 						),
270 270
 					),
271
-                'help_tour' => array( 'Registration_Form_Add_Question_Group_Help_Tour'),
271
+                'help_tour' => array('Registration_Form_Add_Question_Group_Help_Tour'),
272 272
 				'require_nonce' => FALSE
273 273
 				),
274 274
 
@@ -277,16 +277,16 @@  discard block
 block discarded – undo
277 277
 					'label' => esc_html__('Edit Question Group', 'event_espresso'),
278 278
 					'order' => 5,
279 279
 					'persistent' => FALSE,
280
-					'url' => isset($this->_req_data['question_group_id']) ? add_query_arg(array('question_group_id' => $this->_req_data['question_group_id'] ), $this->_current_page_view_url )  : $this->_admin_base_url
280
+					'url' => isset($this->_req_data['question_group_id']) ? add_query_arg(array('question_group_id' => $this->_req_data['question_group_id']), $this->_current_page_view_url) : $this->_admin_base_url
281 281
 					),
282
-				'metaboxes' => array_merge( $this->_default_espresso_metaboxes, array('_publish_post_box' ) ),
282
+				'metaboxes' => array_merge($this->_default_espresso_metaboxes, array('_publish_post_box')),
283 283
 				'help_tabs' => array(
284 284
 					'registration_form_edit_question_group_help_tab' => array(
285 285
 						'title' => esc_html__('Edit Question Group', 'event_espresso'),
286 286
 						'filename' => 'registration_form_edit_question_group'
287 287
 						),
288 288
 					),
289
-                'help_tour' => array( 'Registration_Form_Edit_Question_Group_Help_Tour'),
289
+                'help_tour' => array('Registration_Form_Edit_Question_Group_Help_Tour'),
290 290
 				'require_nonce' => FALSE
291 291
 				),
292 292
 
@@ -298,19 +298,19 @@  discard block
 block discarded – undo
298 298
 				'labels' => array(
299 299
 					'publishbox' => esc_html__('Update Settings', 'event_espresso')
300 300
 					),
301
-				'metaboxes' => array_merge( $this->_default_espresso_metaboxes, array( '_publish_post_box' ) ),
301
+				'metaboxes' => array_merge($this->_default_espresso_metaboxes, array('_publish_post_box')),
302 302
 				'help_tabs' => array(
303 303
 					'registration_form_reg_form_settings_help_tab' => array(
304 304
 						'title' => esc_html__('Registration Form Settings', 'event_espresso'),
305 305
 						'filename' => 'registration_form_reg_form_settings'
306 306
 						),
307 307
 					),
308
-                'help_tour' => array( 'Registration_Form_Settings_Help_Tour'),
308
+                'help_tour' => array('Registration_Form_Settings_Help_Tour'),
309 309
 				'require_nonce' => FALSE
310 310
 				)
311 311
 
312 312
 			);
313
-		$this->_page_config = array_merge( $this->_page_config, $new_page_config );
313
+		$this->_page_config = array_merge($this->_page_config, $new_page_config);
314 314
 
315 315
 		//change the list table we're going to use so it's the NEW list table!
316 316
 		$this->_page_config['default']['list_table'] = 'Extend_Registration_Form_Questions_Admin_List_Table';
@@ -324,7 +324,7 @@  discard block
 block discarded – undo
324 324
 			'edit_question_group' => esc_html__('Edit Question Group', 'event_espresso'),
325 325
 			'delete_question_group' => esc_html__('Delete Question Group', 'event_espresso'),
326 326
 			);
327
-		$this->_labels['buttons'] = array_merge( $this->_labels['buttons'], $new_labels );
327
+		$this->_labels['buttons'] = array_merge($this->_labels['buttons'], $new_labels);
328 328
 
329 329
 	}
330 330
 
@@ -333,14 +333,14 @@  discard block
 block discarded – undo
333 333
 
334 334
 
335 335
 	protected function _ajax_hooks() {
336
-		add_action('wp_ajax_espresso_update_question_group_order', array( $this, 'update_question_group_order' ));
336
+		add_action('wp_ajax_espresso_update_question_group_order', array($this, 'update_question_group_order'));
337 337
 	}
338 338
 
339 339
 
340 340
 
341 341
 
342 342
 	public function load_scripts_styles_question_groups() {
343
-		wp_enqueue_script( 'espresso_ajax_table_sorting' );
343
+		wp_enqueue_script('espresso_ajax_table_sorting');
344 344
 	}
345 345
 
346 346
 
@@ -361,7 +361,7 @@  discard block
 block discarded – undo
361 361
 	 * @return void
362 362
 	 */
363 363
 	public function load_sortable_question_script() {
364
-		wp_register_script('ee-question-sortable', REGISTRATION_FORM_CAF_ASSETS_URL . 'ee_question_order.js', array('jquery-ui-sortable'), EVENT_ESPRESSO_VERSION, true);
364
+		wp_register_script('ee-question-sortable', REGISTRATION_FORM_CAF_ASSETS_URL.'ee_question_order.js', array('jquery-ui-sortable'), EVENT_ESPRESSO_VERSION, true);
365 365
 		wp_enqueue_script('ee-question-sortable');
366 366
 	}
367 367
 
@@ -380,7 +380,7 @@  discard block
 block discarded – undo
380 380
 				)
381 381
 		);
382 382
 
383
-		if ( EE_Registry::instance()->CAP->current_user_can('ee_delete_questions', 'espresso_registration_form_trash_questions' ) ) {
383
+		if (EE_Registry::instance()->CAP->current_user_can('ee_delete_questions', 'espresso_registration_form_trash_questions')) {
384 384
 			$this->_views['trash'] = array(
385 385
 				'slug' => 'trash',
386 386
 				'label' => esc_html__('Trash', 'event_espresso'),
@@ -410,7 +410,7 @@  discard block
 block discarded – undo
410 410
 				)
411 411
 		);
412 412
 
413
-		if ( EE_Registry::instance()->CAP->current_user_can( 'ee_delete_question_groups', 'espresso_registration_form_trash_question_groups' ) ) {
413
+		if (EE_Registry::instance()->CAP->current_user_can('ee_delete_question_groups', 'espresso_registration_form_trash_question_groups')) {
414 414
 			$this->_views['trash'] = array(
415 415
 				'slug' => 'trash',
416 416
 				'label' => esc_html__('Trash', 'event_espresso'),
@@ -446,24 +446,24 @@  discard block
 block discarded – undo
446 446
 
447 447
 
448 448
 
449
-	protected function _delete_question(){
450
-		$success = $this->_delete_items( $this->_question_model );
449
+	protected function _delete_question() {
450
+		$success = $this->_delete_items($this->_question_model);
451 451
 		$this->_redirect_after_action(
452 452
 			$success,
453
-			$this->_question_model->item_name( $success ),
453
+			$this->_question_model->item_name($success),
454 454
 			'deleted',
455
-			array( 'action' => 'default', 'status' => 'all' )
455
+			array('action' => 'default', 'status' => 'all')
456 456
 		);
457 457
 	}
458 458
 
459 459
 
460 460
 	protected function _delete_questions() {
461
-		$success = $this->_delete_items( $this->_question_model );
461
+		$success = $this->_delete_items($this->_question_model);
462 462
 		$this->_redirect_after_action(
463 463
 			$success,
464
-			$this->_question_model->item_name( $success ),
464
+			$this->_question_model->item_name($success),
465 465
 			'deleted permanently',
466
-			array( 'action' => 'default', 'status' => 'trash' )
466
+			array('action' => 'default', 'status' => 'trash')
467 467
 		);
468 468
 	}
469 469
 
@@ -474,26 +474,26 @@  discard block
 block discarded – undo
474 474
  * @param EEM_Soft_Delete_Base $model
475 475
  * @return int number of items deleted permanently
476 476
  */
477
-	private function _delete_items(EEM_Soft_Delete_Base $model){
477
+	private function _delete_items(EEM_Soft_Delete_Base $model) {
478 478
 		$success = 0;
479
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
480
-		if (!empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) {
479
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
480
+		if ( ! empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) {
481 481
 			// if array has more than one element than success message should be plural
482
-			$success = count( $this->_req_data['checkbox'] ) > 1 ? 2 : 1;
482
+			$success = count($this->_req_data['checkbox']) > 1 ? 2 : 1;
483 483
 			// cycle thru bulk action checkboxes
484
-			while (list( $ID, $value ) = each($this->_req_data['checkbox'])) {
485
-				if ( ! $this->_delete_item( $ID, $model ) ) {
484
+			while (list($ID, $value) = each($this->_req_data['checkbox'])) {
485
+				if ( ! $this->_delete_item($ID, $model)) {
486 486
 					$success = 0;
487 487
 				}
488 488
 			}
489 489
 
490
-		}elseif( !empty($this->_req_data['QSG_ID'])){
491
-			$success = $this->_delete_item( $this->_req_data['QSG_ID'], $model );
490
+		}elseif ( ! empty($this->_req_data['QSG_ID'])) {
491
+			$success = $this->_delete_item($this->_req_data['QSG_ID'], $model);
492 492
 
493
-		}elseif( !empty($this->_req_data['QST_ID'])){
494
-			$success = $this->_delete_item( $this->_req_data['QST_ID'], $model );
495
-		}else{
496
-			EE_Error::add_error( sprintf(esc_html__("No Questions or Question Groups were selected for deleting. This error usually shows when you've attempted to delete via bulk action but there were no selections.", "event_espresso")), __FILE__, __FUNCTION__, __LINE__ );
493
+		}elseif ( ! empty($this->_req_data['QST_ID'])) {
494
+			$success = $this->_delete_item($this->_req_data['QST_ID'], $model);
495
+		} else {
496
+			EE_Error::add_error(sprintf(esc_html__("No Questions or Question Groups were selected for deleting. This error usually shows when you've attempted to delete via bulk action but there were no selections.", "event_espresso")), __FILE__, __FUNCTION__, __LINE__);
497 497
 		}
498 498
 		return $success;
499 499
 	}
@@ -504,11 +504,11 @@  discard block
 block discarded – undo
504 504
 	 * @param EEM_Soft_Delete_Base $model
505 505
 	 * @return boolean
506 506
 	 */
507
-	protected function _delete_item( $id, $model ) {
508
-		if( $model instanceof EEM_Question ) {
509
-			EEM_Question_Option::instance()->delete_permanently( array( array( 'QST_ID' => absint( $id ) ) ) );
507
+	protected function _delete_item($id, $model) {
508
+		if ($model instanceof EEM_Question) {
509
+			EEM_Question_Option::instance()->delete_permanently(array(array('QST_ID' => absint($id))));
510 510
 		}
511
-		return $model->delete_permanently_by_ID( absint( $id ) );
511
+		return $model->delete_permanently_by_ID(absint($id));
512 512
 	}
513 513
 
514 514
 
@@ -520,41 +520,41 @@  discard block
 block discarded – undo
520 520
 
521 521
 
522 522
 
523
-	protected function _edit_question_group( $type = 'add' ) {
524
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
525
-		$ID=isset( $this->_req_data['QSG_ID'] ) && ! empty( $this->_req_data['QSG_ID'] ) ? absint( $this->_req_data['QSG_ID'] ) : FALSE;
523
+	protected function _edit_question_group($type = 'add') {
524
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
525
+		$ID = isset($this->_req_data['QSG_ID']) && ! empty($this->_req_data['QSG_ID']) ? absint($this->_req_data['QSG_ID']) : FALSE;
526 526
 
527
-		switch( $this->_req_action ) {
527
+		switch ($this->_req_action) {
528 528
 			case 'add_question_group' :
529
-				$this->_admin_page_title = esc_html__( 'Add Question Group', 'event_espresso' );
529
+				$this->_admin_page_title = esc_html__('Add Question Group', 'event_espresso');
530 530
 				break;
531 531
 			case 'edit_question_group' :
532
-				$this->_admin_page_title = esc_html__( 'Edit Question Group', 'event_espresso' );
532
+				$this->_admin_page_title = esc_html__('Edit Question Group', 'event_espresso');
533 533
 				break;
534 534
 			default :
535
-				$this->_admin_page_title = ucwords( str_replace( '_', ' ', $this->_req_action ));
535
+				$this->_admin_page_title = ucwords(str_replace('_', ' ', $this->_req_action));
536 536
 		}
537 537
 		// add ID to title if editing
538
-		$this->_admin_page_title = $ID ? $this->_admin_page_title . ' # ' . $ID : $this->_admin_page_title;
539
-		if($ID){
538
+		$this->_admin_page_title = $ID ? $this->_admin_page_title.' # '.$ID : $this->_admin_page_title;
539
+		if ($ID) {
540 540
 			/** @var EE_Question_Group $questionGroup */
541
-			$questionGroup=$this->_question_group_model->get_one_by_ID( $ID);
542
-			$additional_hidden_fields=array('QSG_ID'=>array('type'=>'hidden','value'=>$ID));
541
+			$questionGroup = $this->_question_group_model->get_one_by_ID($ID);
542
+			$additional_hidden_fields = array('QSG_ID'=>array('type'=>'hidden', 'value'=>$ID));
543 543
 			$this->_set_add_edit_form_tags('update_question_group', $additional_hidden_fields);
544
-		}else{
544
+		} else {
545 545
 			/** @var EE_Question_Group $questionGroup */
546 546
 			$questionGroup = EEM_Question_Group::instance()->create_default_object();
547 547
 			$questionGroup->set_order_to_latest();
548 548
 			$this->_set_add_edit_form_tags('insert_question_group');
549 549
 		}
550 550
 		$this->_template_args['values'] = $this->_yes_no_values;
551
-		$this->_template_args['all_questions']=$questionGroup->questions_in_and_not_in_group();
552
-		$this->_template_args['QSG_ID']=$ID ? $ID : TRUE;
553
-		$this->_template_args['question_group']=$questionGroup;
551
+		$this->_template_args['all_questions'] = $questionGroup->questions_in_and_not_in_group();
552
+		$this->_template_args['QSG_ID'] = $ID ? $ID : TRUE;
553
+		$this->_template_args['question_group'] = $questionGroup;
554 554
 
555
-		$redirect_URL = add_query_arg( array( 'action' => 'question_groups'), $this->_admin_base_url );
556
-		$this->_set_publish_post_box_vars( 'id', $ID, FALSE, $redirect_URL  );
557
-		$this->_template_args['admin_page_content'] = EEH_Template::display_template( REGISTRATION_FORM_CAF_TEMPLATE_PATH . 'question_groups_main_meta_box.template.php', $this->_template_args, TRUE );
555
+		$redirect_URL = add_query_arg(array('action' => 'question_groups'), $this->_admin_base_url);
556
+		$this->_set_publish_post_box_vars('id', $ID, FALSE, $redirect_URL);
557
+		$this->_template_args['admin_page_content'] = EEH_Template::display_template(REGISTRATION_FORM_CAF_TEMPLATE_PATH.'question_groups_main_meta_box.template.php', $this->_template_args, TRUE);
558 558
 
559 559
 		// the details template wrapper
560 560
 		$this->display_admin_page_with_sidebar();
@@ -565,7 +565,7 @@  discard block
 block discarded – undo
565 565
 
566 566
 	protected function _delete_question_groups() {
567 567
 		$success = $this->_delete_items($this->_question_group_model);
568
-		$this->_redirect_after_action( $success, $this->_question_group_model->item_name($success), 'deleted permanently', array( 'action'=>'question_groups', 'status'=>'trash' ));
568
+		$this->_redirect_after_action($success, $this->_question_group_model->item_name($success), 'deleted permanently', array('action'=>'question_groups', 'status'=>'trash'));
569 569
 	}
570 570
 
571 571
 
@@ -573,71 +573,71 @@  discard block
 block discarded – undo
573 573
 	/**
574 574
 	 * @param bool $new_question_group
575 575
 	 */
576
-	protected function _insert_or_update_question_group( $new_question_group = TRUE) {
577
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
578
-		$set_column_values=$this->_set_column_values_for($this->_question_group_model);
579
-		if ( $new_question_group ){
576
+	protected function _insert_or_update_question_group($new_question_group = TRUE) {
577
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
578
+		$set_column_values = $this->_set_column_values_for($this->_question_group_model);
579
+		if ($new_question_group) {
580 580
 			$QSG_ID = $this->_question_group_model->insert($set_column_values);
581 581
 			$success = $QSG_ID ? 1 : 0;
582 582
 		} else {
583 583
 			$QSG_ID = absint($this->_req_data['QSG_ID']);
584
-			unset( $set_column_values[ 'QSG_ID' ] );
585
-			$success= $this->_question_group_model->update( $set_column_values, array( array( 'QSG_ID' => $QSG_ID )));
584
+			unset($set_column_values['QSG_ID']);
585
+			$success = $this->_question_group_model->update($set_column_values, array(array('QSG_ID' => $QSG_ID)));
586 586
 		}
587
-		$phone_question_id = EEM_Question::instance()->get_Question_ID_from_system_string( EEM_Attendee::system_question_phone );
587
+		$phone_question_id = EEM_Question::instance()->get_Question_ID_from_system_string(EEM_Attendee::system_question_phone);
588 588
 		// update the existing related questions
589 589
 		// BUT FIRST...  delete the phone question from the Question_Group_Question if it is being added to this question group (therefore removed from the existing group)
590
-		if ( isset( $this->_req_data['questions'], $this->_req_data['questions'][ $phone_question_id ] )) {
590
+		if (isset($this->_req_data['questions'], $this->_req_data['questions'][$phone_question_id])) {
591 591
 			// delete where QST ID = system phone question ID and Question Group ID is NOT this group
592
-			EEM_Question_Group_Question::instance()->delete( array( array( 'QST_ID' => $phone_question_id, 'QSG_ID' => array( '!=', $QSG_ID ))));
592
+			EEM_Question_Group_Question::instance()->delete(array(array('QST_ID' => $phone_question_id, 'QSG_ID' => array('!=', $QSG_ID))));
593 593
 		}
594 594
 		/** @type EE_Question_Group $question_group */
595
-		$question_group=$this->_question_group_model->get_one_by_ID( $QSG_ID );
595
+		$question_group = $this->_question_group_model->get_one_by_ID($QSG_ID);
596 596
 		$questions = $question_group->questions();
597 597
 		// make sure system phone question is added to list of questions for this group
598
-		if ( ! isset( $questions[$phone_question_id ] )) {
599
-			$questions[ $phone_question_id ] = EEM_Question::instance()->get_one_by_ID( $phone_question_id );
598
+		if ( ! isset($questions[$phone_question_id])) {
599
+			$questions[$phone_question_id] = EEM_Question::instance()->get_one_by_ID($phone_question_id);
600 600
 		}
601 601
 
602
-		foreach( $questions as $question_ID => $question ){
602
+		foreach ($questions as $question_ID => $question) {
603 603
 			// first we always check for order.
604
-			if ( ! empty( $this->_req_data['question_orders'][ $question_ID ] ) ){
604
+			if ( ! empty($this->_req_data['question_orders'][$question_ID])) {
605 605
 				//update question order
606
-				$question_group->update_question_order( $question_ID, $this->_req_data['question_orders'][ $question_ID ] );
606
+				$question_group->update_question_order($question_ID, $this->_req_data['question_orders'][$question_ID]);
607 607
 			}
608 608
 
609 609
 			// then we always check if adding or removing.
610
-			if ( isset( $this->_req_data['questions'], $this->_req_data['questions'][ $question_ID ] )) {
611
-				$question_group->add_question( $question_ID );
610
+			if (isset($this->_req_data['questions'], $this->_req_data['questions'][$question_ID])) {
611
+				$question_group->add_question($question_ID);
612 612
 			} else {
613 613
 				// not found, remove it (but only if not a system question for the personal group with the exception of lname system question - we allow removal of it)
614 614
 				if (
615 615
 					in_array(
616 616
 						$question->system_ID(),
617
-						EEM_Question::instance()->required_system_questions_in_system_question_group( $question_group->system_group() )
617
+						EEM_Question::instance()->required_system_questions_in_system_question_group($question_group->system_group())
618 618
 					)
619 619
 				) {
620 620
 					continue;
621 621
 				} else {
622
-					$question_group->remove_question( $question_ID );
622
+					$question_group->remove_question($question_ID);
623 623
 				}
624 624
 			}
625 625
 		}
626 626
 		// save new related questions
627
-		if ( isset( $this->_req_data['questions'] )) {
628
-			foreach( $this->_req_data['questions'] as $QST_ID ){
629
-				$question_group->add_question( $QST_ID );
630
-				if ( isset( $this->_req_data['question_orders'][ $QST_ID ] )) {
631
-					$question_group->update_question_order( $QST_ID, $this->_req_data['question_orders'][ $QST_ID ] );
627
+		if (isset($this->_req_data['questions'])) {
628
+			foreach ($this->_req_data['questions'] as $QST_ID) {
629
+				$question_group->add_question($QST_ID);
630
+				if (isset($this->_req_data['question_orders'][$QST_ID])) {
631
+					$question_group->update_question_order($QST_ID, $this->_req_data['question_orders'][$QST_ID]);
632 632
 				}
633 633
 			}
634 634
 		}
635 635
 
636
-		if ( $success !== FALSE ) {
637
-			$msg = $new_question_group ? sprintf( esc_html__('The %s has been created', 'event_espresso'), $this->_question_group_model->item_name() ) : sprintf( esc_html__('The %s has been updated', 'event_espresso' ), $this->_question_group_model->item_name() );
638
-			EE_Error::add_success( $msg );
636
+		if ($success !== FALSE) {
637
+			$msg = $new_question_group ? sprintf(esc_html__('The %s has been created', 'event_espresso'), $this->_question_group_model->item_name()) : sprintf(esc_html__('The %s has been updated', 'event_espresso'), $this->_question_group_model->item_name());
638
+			EE_Error::add_success($msg);
639 639
 		}
640
-		$this->_redirect_after_action(FALSE, '', '', array('action'=>'edit_question_group','QSG_ID'=>$QSG_ID), TRUE);
640
+		$this->_redirect_after_action(FALSE, '', '', array('action'=>'edit_question_group', 'QSG_ID'=>$QSG_ID), TRUE);
641 641
 
642 642
 	}
643 643
 
@@ -645,20 +645,20 @@  discard block
 block discarded – undo
645 645
 	 * duplicates a question and all its question options and redirects to the new question.
646 646
 	 */
647 647
 	public function _duplicate_question() {
648
-		$question_ID = (int)$this->_req_data[ 'QST_ID' ];
649
-		$question = EEM_Question::instance()->get_one_by_ID( $question_ID );
650
-		if( $question instanceof EE_Question ) {
648
+		$question_ID = (int) $this->_req_data['QST_ID'];
649
+		$question = EEM_Question::instance()->get_one_by_ID($question_ID);
650
+		if ($question instanceof EE_Question) {
651 651
 			$new_question = $question->duplicate();
652
-			if( $new_question instanceof EE_Question ) {
653
-				$this->_redirect_after_action( true, esc_html__( 'Question', 'event_espresso' ), esc_html__( 'Duplicated', 'event_espresso' ), array('action'=>'edit_question', 'QST_ID' => $new_question->ID() ), TRUE);
652
+			if ($new_question instanceof EE_Question) {
653
+				$this->_redirect_after_action(true, esc_html__('Question', 'event_espresso'), esc_html__('Duplicated', 'event_espresso'), array('action'=>'edit_question', 'QST_ID' => $new_question->ID()), TRUE);
654 654
 			} else {
655 655
 				global $wpdb;
656
-				EE_Error::add_error( sprintf( esc_html__( 'Could not duplicate question with ID %1$d because: %2$s', 'event_espresso' ), $question_ID, $wpdb->last_error ), __FILE__, __FUNCTION__, __LINE__ );
657
-			$this->_redirect_after_action(false, '', '', array('action'=>'default'), false );
656
+				EE_Error::add_error(sprintf(esc_html__('Could not duplicate question with ID %1$d because: %2$s', 'event_espresso'), $question_ID, $wpdb->last_error), __FILE__, __FUNCTION__, __LINE__);
657
+			$this->_redirect_after_action(false, '', '', array('action'=>'default'), false);
658 658
 			}
659 659
 		} else {
660
-			EE_Error::add_error( sprintf( esc_html__( 'Could not duplicate question with ID %d because it didn\'t exist!', 'event_espresso' ), $question_ID ), __FILE__, __FUNCTION__, __LINE__ );
661
-			$this->_redirect_after_action( false, '', '', array( 'action' => 'default' ), false );
660
+			EE_Error::add_error(sprintf(esc_html__('Could not duplicate question with ID %d because it didn\'t exist!', 'event_espresso'), $question_ID), __FILE__, __FUNCTION__, __LINE__);
661
+			$this->_redirect_after_action(false, '', '', array('action' => 'default'), false);
662 662
 		}
663 663
 	}
664 664
 
@@ -667,8 +667,8 @@  discard block
 block discarded – undo
667 667
 	/**
668 668
 	 * @param bool $trash
669 669
 	 */
670
-	protected function _trash_or_restore_question_groups( $trash = TRUE) {
671
-		$this->_trash_or_restore_items( $this->_question_group_model, $trash );
670
+	protected function _trash_or_restore_question_groups($trash = TRUE) {
671
+		$this->_trash_or_restore_items($this->_question_group_model, $trash);
672 672
 	}
673 673
 
674 674
 
@@ -676,9 +676,9 @@  discard block
 block discarded – undo
676 676
 	/**
677 677
 	 *_trash_question
678 678
 	 */
679
-	protected function _trash_question(){
680
-		$success=$this->_question_model->delete_by_ID( (int)$this->_req_data['QST_ID'] );
681
-		$query_args=array('action'=>'default','status'=>'all');
679
+	protected function _trash_question() {
680
+		$success = $this->_question_model->delete_by_ID((int) $this->_req_data['QST_ID']);
681
+		$query_args = array('action'=>'default', 'status'=>'all');
682 682
 		$this->_redirect_after_action($success, $this->_question_model->item_name($success), 'trashed', $query_args);
683 683
 	}
684 684
 
@@ -687,8 +687,8 @@  discard block
 block discarded – undo
687 687
 	/**
688 688
 	 * @param bool $trash
689 689
 	 */
690
-	protected function _trash_or_restore_questions( $trash=TRUE){
691
-		$this->_trash_or_restore_items( $this->_question_model, $trash );
690
+	protected function _trash_or_restore_questions($trash = TRUE) {
691
+		$this->_trash_or_restore_items($this->_question_model, $trash);
692 692
 	}
693 693
 
694 694
 
@@ -700,21 +700,21 @@  discard block
 block discarded – undo
700 700
 *@param EEM_Soft_Delete_Base $model
701 701
 	 * @param boolean $trash whether to trash or restore
702 702
 	 */
703
-	private function _trash_or_restore_items( EEM_Soft_Delete_Base $model, $trash = TRUE ) {
703
+	private function _trash_or_restore_items(EEM_Soft_Delete_Base $model, $trash = TRUE) {
704 704
 
705
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
705
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
706 706
 
707 707
 		$success = 1;
708 708
 		//Checkboxes
709 709
 		//echo "trash $trash";
710 710
 		//var_dump($this->_req_data['checkbox']);die;
711
-		if ( isset( $this->_req_data['checkbox'] )) {
712
-			if ( ! empty( $this->_req_data['checkbox'] ) && is_array( $this->_req_data['checkbox'] )) {
711
+		if (isset($this->_req_data['checkbox'])) {
712
+			if ( ! empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) {
713 713
 				// if array has more than one element than success message should be plural
714
-				$success = count( $this->_req_data['checkbox'] ) > 1 ? 2 : 1;
714
+				$success = count($this->_req_data['checkbox']) > 1 ? 2 : 1;
715 715
 				// cycle thru bulk action checkboxes
716
-				while (list( $ID, $value ) = each($this->_req_data['checkbox'])) {
717
-					if ( ! $model->delete_or_restore_by_ID($trash,absint($ID))) {
716
+				while (list($ID, $value) = each($this->_req_data['checkbox'])) {
717
+					if ( ! $model->delete_or_restore_by_ID($trash, absint($ID))) {
718 718
 						$success = 0;
719 719
 					}
720 720
 				}
@@ -722,7 +722,7 @@  discard block
 block discarded – undo
722 722
 			} else {
723 723
 				// grab single id and delete
724 724
 				$ID = absint($this->_req_data['checkbox']);
725
-				if ( ! $model->delete_or_restore_by_ID($trash,$ID)) {
725
+				if ( ! $model->delete_or_restore_by_ID($trash, $ID)) {
726 726
 					$success = 0;
727 727
 				}
728 728
 			}
@@ -730,25 +730,25 @@  discard block
 block discarded – undo
730 730
 		} else {
731 731
 			// delete via trash link
732 732
 			// grab single id and delete
733
-			$ID = absint($this->_req_data[ $model->primary_key_name() ]);
734
-			if ( ! $model->delete_or_restore_by_ID($trash,$ID)) {
733
+			$ID = absint($this->_req_data[$model->primary_key_name()]);
734
+			if ( ! $model->delete_or_restore_by_ID($trash, $ID)) {
735 735
 				$success = 0;
736 736
 			}
737 737
 
738 738
 		}
739 739
 
740 740
 
741
-		$action = $model instanceof EEM_Question ? 'default' : 'question_groups';//strtolower( $model->item_name(2) );
741
+		$action = $model instanceof EEM_Question ? 'default' : 'question_groups'; //strtolower( $model->item_name(2) );
742 742
 		//echo "action :$action";
743 743
 		//$action = 'questions' ? 'default' : $action;
744
-		if($trash){
744
+		if ($trash) {
745 745
 			$action_desc = 'trashed';
746 746
 			$status = 'trash';
747
-		}else{
747
+		} else {
748 748
 			$action_desc = 'restored';
749 749
 			$status = 'all';
750 750
 		}
751
-		$this->_redirect_after_action( $success, $model->item_name($success), $action_desc, array( 'action' => $action, 'status'=>$status ) );
751
+		$this->_redirect_after_action($success, $model->item_name($success), $action_desc, array('action' => $action, 'status'=>$status));
752 752
 	}
753 753
 
754 754
 
@@ -759,16 +759,16 @@  discard block
 block discarded – undo
759 759
 	 * @param bool|false $count
760 760
 	 * @return \EE_Soft_Delete_Base_Class[]|int
761 761
 	 */
762
-	public function get_trashed_questions( $per_page, $current_page = 1, $count = FALSE ) {
762
+	public function get_trashed_questions($per_page, $current_page = 1, $count = FALSE) {
763 763
 		$query_params = $this->get_query_params(EEM_Question::instance(), $per_page, $current_page);
764 764
 
765
-		if( $count ){
765
+		if ($count) {
766 766
 			//note: this a subclass of EEM_Soft_Delete_Base, so this is actually only getting non-trashed items
767
-			$where = isset( $query_params[0] ) ? array( $query_params[0] ) : array();
768
-			$results=$this->_question_model->count_deleted($where);
769
-		}else{
767
+			$where = isset($query_params[0]) ? array($query_params[0]) : array();
768
+			$results = $this->_question_model->count_deleted($where);
769
+		} else {
770 770
 			//note: this a subclass of EEM_Soft_Delete_Base, so this is actually only getting non-trashed items
771
-			$results=$this->_question_model->get_all_deleted($query_params);
771
+			$results = $this->_question_model->get_all_deleted($query_params);
772 772
 		}
773 773
 		return $results;
774 774
 	}
@@ -781,13 +781,13 @@  discard block
 block discarded – undo
781 781
 	 * @param bool|false $count
782 782
 	 * @return \EE_Soft_Delete_Base_Class[]
783 783
 	 */
784
-	public function get_question_groups( $per_page, $current_page = 1, $count = FALSE ) {
785
-		$questionGroupModel=EEM_Question_Group::instance();
786
-		$query_params=$this->get_query_params($questionGroupModel,$per_page,$current_page);
787
-		if ($count){
788
-			$where = isset( $query_params[0] ) ? array( $query_params[0] ) : array();
784
+	public function get_question_groups($per_page, $current_page = 1, $count = FALSE) {
785
+		$questionGroupModel = EEM_Question_Group::instance();
786
+		$query_params = $this->get_query_params($questionGroupModel, $per_page, $current_page);
787
+		if ($count) {
788
+			$where = isset($query_params[0]) ? array($query_params[0]) : array();
789 789
 			$results = $questionGroupModel->count($where);
790
-		}else{
790
+		} else {
791 791
 			$results = $questionGroupModel->get_all($query_params);
792 792
 		}
793 793
 		return $results;
@@ -801,14 +801,14 @@  discard block
 block discarded – undo
801 801
 	 * @param bool $count
802 802
 	 * @return \EE_Soft_Delete_Base_Class[]|int
803 803
 	 */
804
-	public function get_trashed_question_groups( $per_page, $current_page = 1, $count = FALSE ) {
805
-		$questionGroupModel=EEM_Question_Group::instance();
806
-		$query_params=$this->get_query_params($questionGroupModel,$per_page,$current_page);
807
-		if($count){
808
-			$where = isset( $query_params[0] ) ? array($query_params[0]) : array();
804
+	public function get_trashed_question_groups($per_page, $current_page = 1, $count = FALSE) {
805
+		$questionGroupModel = EEM_Question_Group::instance();
806
+		$query_params = $this->get_query_params($questionGroupModel, $per_page, $current_page);
807
+		if ($count) {
808
+			$where = isset($query_params[0]) ? array($query_params[0]) : array();
809 809
 			$query_params['limit'] = NULL;
810 810
 			$results = $questionGroupModel->count_deleted($where);
811
-		}else{
811
+		} else {
812 812
 			$results = $questionGroupModel->get_all_deleted($query_params);
813 813
 		}
814 814
 		return $results;
@@ -821,32 +821,32 @@  discard block
 block discarded – undo
821 821
 	 */
822 822
 	public function update_question_group_order() {
823 823
 
824
-		$success = esc_html__( 'Question group order was updated successfully.', 'event_espresso' );
824
+		$success = esc_html__('Question group order was updated successfully.', 'event_espresso');
825 825
 
826 826
 		// grab our row IDs
827
-		$row_ids = isset( $this->_req_data['row_ids'] ) && ! empty( $this->_req_data['row_ids'] )
828
-			? explode( ',', rtrim( $this->_req_data['row_ids'], ',' ))
827
+		$row_ids = isset($this->_req_data['row_ids']) && ! empty($this->_req_data['row_ids'])
828
+			? explode(',', rtrim($this->_req_data['row_ids'], ','))
829 829
 			: array();
830 830
 
831
-		$perpage = !empty( $this->_req_data['perpage'] )
831
+		$perpage = ! empty($this->_req_data['perpage'])
832 832
 			? (int) $this->_req_data['perpage']
833 833
 			: NULL;
834
-		$curpage = !empty( $this->_req_data['curpage'] )
834
+		$curpage = ! empty($this->_req_data['curpage'])
835 835
 			? (int) $this->_req_data['curpage']
836 836
 			: NULL;
837 837
 
838
-		if ( ! empty( $row_ids ) ) {
838
+		if ( ! empty($row_ids)) {
839 839
 			//figure out where we start the row_id count at for the current page.
840
-			$qsgcount = empty( $curpage ) ? 0 : ($curpage - 1 ) * $perpage;
840
+			$qsgcount = empty($curpage) ? 0 : ($curpage - 1) * $perpage;
841 841
 
842
-			$row_count = count( $row_ids );
843
-			for( $i = 0; $i < $row_count; $i++ ) {
842
+			$row_count = count($row_ids);
843
+			for ($i = 0; $i < $row_count; $i++) {
844 844
 				//Update the questions when re-ordering
845 845
 				$updated = EEM_Question_Group::instance()->update(
846
-					array( 'QSG_order' => $qsgcount ),
847
-					array( array( 'QSG_ID' => $row_ids[ $i ] ) )
846
+					array('QSG_order' => $qsgcount),
847
+					array(array('QSG_ID' => $row_ids[$i]))
848 848
 				);
849
-				if ( $updated === false ) {
849
+				if ($updated === false) {
850 850
 					$success = false;
851 851
 				}
852 852
 				$qsgcount++;
@@ -856,10 +856,10 @@  discard block
 block discarded – undo
856 856
 		}
857 857
 
858 858
 		$errors = ! $success
859
-			? esc_html__( 'An error occurred. The question group order was not updated.', 'event_espresso' )
859
+			? esc_html__('An error occurred. The question group order was not updated.', 'event_espresso')
860 860
 			: false;
861 861
 
862
-		echo json_encode( array( 'return_data' => false, 'success' => $success, 'errors' => $errors ));
862
+		echo json_encode(array('return_data' => false, 'success' => $success, 'errors' => $errors));
863 863
 		die();
864 864
 
865 865
 	}
@@ -878,17 +878,17 @@  discard block
 block discarded – undo
878 878
 		$this->_template_args['values'] = $this->_yes_no_values;
879 879
 		add_action(
880 880
 			'AHEE__Extend_Registration_Form_Admin_Page___reg_form_settings_template',
881
-			array( $this, 'email_validation_settings_form' ),
881
+			array($this, 'email_validation_settings_form'),
882 882
 			2
883 883
 		);
884
-		$this->_template_args = (array)apply_filters(
884
+		$this->_template_args = (array) apply_filters(
885 885
 			'FHEE__Extend_Registration_Form_Admin_Page___reg_form_settings___template_args',
886 886
 			$this->_template_args
887 887
 		);
888
-		$this->_set_add_edit_form_tags( 'update_reg_form_settings' );
889
-		$this->_set_publish_post_box_vars( NULL, FALSE, FALSE, NULL, FALSE );
888
+		$this->_set_add_edit_form_tags('update_reg_form_settings');
889
+		$this->_set_publish_post_box_vars(NULL, FALSE, FALSE, NULL, FALSE);
890 890
 		$this->_template_args['admin_page_content'] = EEH_Template::display_template(
891
-			REGISTRATION_FORM_CAF_TEMPLATE_PATH . 'reg_form_settings.template.php',
891
+			REGISTRATION_FORM_CAF_TEMPLATE_PATH.'reg_form_settings.template.php',
892 892
 			$this->_template_args,
893 893
 			TRUE
894 894
 		);
@@ -909,7 +909,7 @@  discard block
 block discarded – undo
909 909
 			EE_Registry::instance()->CFG,
910 910
 			__FILE__, __FUNCTION__, __LINE__
911 911
 		);
912
-		$this->_redirect_after_action( $success, esc_html__('Registration Form Options', 'event_espresso'), 'updated', array( 'action' => 'view_reg_form_settings' ) );
912
+		$this->_redirect_after_action($success, esc_html__('Registration Form Options', 'event_espresso'), 'updated', array('action' => 'view_reg_form_settings'));
913 913
 	}
914 914
 
915 915
 
@@ -940,20 +940,20 @@  discard block
 block discarded – undo
940 940
 				'layout_strategy' => new EE_Admin_Two_Column_Layout(),
941 941
 				'subsections'     => array(
942 942
 					'email_validation_hdr'           => new EE_Form_Section_HTML(
943
-						EEH_HTML::h2( esc_html__( 'Email Validation Settings', 'event_espresso' ) )
943
+						EEH_HTML::h2(esc_html__('Email Validation Settings', 'event_espresso'))
944 944
 					),
945 945
 					'email_validation_level' => new EE_Select_Input(
946 946
 						array(
947
-							'basic'      => esc_html__( 'Basic', 'event_espresso' ),
948
-							'wp_default' => esc_html__( 'WordPress Default', 'event_espresso' ),
949
-							'i18n'       => esc_html__( 'International', 'event_espresso' ),
950
-							'i18n_dns'   => esc_html__( 'International + DNS Check', 'event_espresso' ),
947
+							'basic'      => esc_html__('Basic', 'event_espresso'),
948
+							'wp_default' => esc_html__('WordPress Default', 'event_espresso'),
949
+							'i18n'       => esc_html__('International', 'event_espresso'),
950
+							'i18n_dns'   => esc_html__('International + DNS Check', 'event_espresso'),
951 951
 						),
952 952
 						array(
953
-							'html_label_text' => esc_html__( 'Email Validation Level', 'event_espresso' )
954
-							                     . EEH_Template::get_help_tab_link( 'email_validation_info' ),
955
-							'html_help_text'  => esc_html__( 'These levels range from basic validation ( ie: [email protected] ) to more advanced checks against international email addresses (ie: üñîçøðé@example.com ) with additional MX and A record checks to confirm the domain actually exists. More information on on each level can be found within the help section.', 'event_espresso'),
956
-							'default' => isset( EE_Registry::instance()->CFG->registration->email_validation_level )
953
+							'html_label_text' => esc_html__('Email Validation Level', 'event_espresso')
954
+							                     . EEH_Template::get_help_tab_link('email_validation_info'),
955
+							'html_help_text'  => esc_html__('These levels range from basic validation ( ie: [email protected] ) to more advanced checks against international email addresses (ie: üñîçøðé@example.com ) with additional MX and A record checks to confirm the domain actually exists. More information on on each level can be found within the help section.', 'event_espresso'),
956
+							'default' => isset(EE_Registry::instance()->CFG->registration->email_validation_level)
957 957
 								? EE_Registry::instance()->CFG->registration->email_validation_level
958 958
 								: 'wp_default',
959 959
 							'required'        => false
@@ -972,25 +972,25 @@  discard block
 block discarded – undo
972 972
 	 * @param \EE_Registration_Config $EE_Registration_Config
973 973
 	 * @return \EE_Registration_Config
974 974
 	 */
975
-	public function update_email_validation_settings_form( EE_Registration_Config $EE_Registration_Config ) {
975
+	public function update_email_validation_settings_form(EE_Registration_Config $EE_Registration_Config) {
976 976
         $prev_email_validation_level = $EE_Registration_Config->email_validation_level;
977 977
         try {
978 978
 			$email_validation_settings_form = $this->_email_validation_settings_form();
979 979
 			// if not displaying a form, then check for form submission
980
-			if ( $email_validation_settings_form->was_submitted() ) {
980
+			if ($email_validation_settings_form->was_submitted()) {
981 981
 				// capture form data
982 982
 				$email_validation_settings_form->receive_form_submission();
983 983
 				// validate form data
984
-				if ( $email_validation_settings_form->is_valid() ) {
984
+				if ($email_validation_settings_form->is_valid()) {
985 985
 					// grab validated data from form
986 986
 					$valid_data = $email_validation_settings_form->valid_data();
987
-					if ( isset( $valid_data['email_validation_level'] ) ) {
987
+					if (isset($valid_data['email_validation_level'])) {
988 988
 					    $email_validation_level = $valid_data['email_validation_level'];
989 989
                         // now if they want to use international email addresses
990
-                        if ( $email_validation_level === 'i18n' || $email_validation_level === 'i18n_dns' ) {
990
+                        if ($email_validation_level === 'i18n' || $email_validation_level === 'i18n_dns') {
991 991
                             // in case we need to reset their email validation level,
992 992
                             // make sure that the previous value wasn't already set to one of the i18n options.
993
-                            if ( $prev_email_validation_level === 'i18n' || $prev_email_validation_level === 'i18n_dns' ) {
993
+                            if ($prev_email_validation_level === 'i18n' || $prev_email_validation_level === 'i18n_dns') {
994 994
                                 // if so, then reset it back to "basic" since that is the only other option that,
995 995
                                 // despite offering poor validation, supports i18n email addresses
996 996
                                 $prev_email_validation_level = 'basic';
@@ -1012,7 +1012,7 @@  discard block
 block discarded – undo
1012 1012
                         );
1013 1013
 					}
1014 1014
 				} else {
1015
-					if ( $email_validation_settings_form->submission_error_message() !== '' ) {
1015
+					if ($email_validation_settings_form->submission_error_message() !== '') {
1016 1016
 						EE_Error::add_error(
1017 1017
 							$email_validation_settings_form->submission_error_message(),
1018 1018
                             __FILE__, __FUNCTION__, __LINE__
@@ -1020,7 +1020,7 @@  discard block
 block discarded – undo
1020 1020
 					}
1021 1021
 				}
1022 1022
 			}
1023
-		} catch ( EE_Error $e ) {
1023
+		} catch (EE_Error $e) {
1024 1024
 			$e->get_error();
1025 1025
 		}
1026 1026
 		return $EE_Registration_Config;
Please login to merge, or discard this patch.
modules/ticket_selector/templates/ticket_selector_chart.template.php 2 patches
Indentation   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -96,9 +96,9 @@  discard block
 block discarded – undo
96 96
 		}
97 97
 
98 98
 		$ticket_details_css_id = apply_filters(
99
-            'FHEE__ticket_selector_chart_template__ticket_details_css_id',
100
-            "tckt-slctr-tkt-details-{$EVT_ID}-{$TKT_ID}"
101
-        );
99
+			'FHEE__ticket_selector_chart_template__ticket_details_css_id',
100
+			"tckt-slctr-tkt-details-{$EVT_ID}-{$TKT_ID}"
101
+		);
102 102
 	?>
103 103
 				<tr class="tckt-slctr-tbl-tr <?php echo $status_class . ' ' . espresso_get_object_css_class( $ticket ); ?>">
104 104
 		<?php
@@ -469,13 +469,13 @@  discard block
 block discarded – undo
469 469
 				<th scope="col" class="ee-ticket-selector-ticket-qty-th cntr">
470 470
 					<?php
471 471
 						/**
472
-						* Filters the text printed for the header of the quantity column in the ticket selector table
473
-						*
474
-						* @since 4.7.2
475
-						*
476
-						* @param string 'Qty*' The translatable text to display in the table header for the Quantity of tickets
477
-						* @param int $EVT_ID The Event ID
478
-						*/
472
+						 * Filters the text printed for the header of the quantity column in the ticket selector table
473
+						 *
474
+						 * @since 4.7.2
475
+						 *
476
+						 * @param string 'Qty*' The translatable text to display in the table header for the Quantity of tickets
477
+						 * @param int $EVT_ID The Event ID
478
+						 */
479 479
 						echo esc_html( apply_filters( 'FHEE__ticket_selector_chart_template__table_header_qty', __( 'Qty*', 'event_espresso' ), $EVT_ID ) );
480 480
 					?>
481 481
 				</th>
Please login to merge, or discard this patch.
Spacing   +145 added lines, -145 removed lines patch added patch discarded remove patch
@@ -8,28 +8,28 @@  discard block
 block discarded – undo
8 8
 
9 9
 $row = 1;
10 10
 $max = 1;
11
-$ticket_count = count( $tickets );
11
+$ticket_count = count($tickets);
12 12
 
13
-if ( ! $ticket_count ) {
13
+if ( ! $ticket_count) {
14 14
 	return;
15 15
 }
16 16
 
17 17
 $required_ticket_sold_out = FALSE;
18
-$template_settings = isset ( EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector ) ? EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector : new EE_Ticket_Selector_Config();
18
+$template_settings = isset (EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector) ? EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector : new EE_Ticket_Selector_Config();
19 19
 ob_start();
20 20
 
21
-foreach ( $tickets as $TKT_ID => $ticket ) {
22
-	if ( $ticket instanceof EE_Ticket ) {
23
-		$remaining = max( $ticket->remaining(), 0 );
21
+foreach ($tickets as $TKT_ID => $ticket) {
22
+	if ($ticket instanceof EE_Ticket) {
23
+		$remaining = max($ticket->remaining(), 0);
24 24
 		// max tickets or $max_atndz, whichever is smaller
25
-		$max = min( $ticket->max(), $max_atndz );;
25
+		$max = min($ticket->max(), $max_atndz); ;
26 26
 		// offer the number of $tickets_remaining or $max, whichever is smaller
27
-		$max = min( $remaining, $max );
27
+		$max = min($remaining, $max);
28 28
 		// and we also want to restrict the minimum number of tickets by the ticket min setting
29 29
 		$min = $ticket->min() > 0 ? $ticket->min() : 0;
30 30
 		// and if the ticket is required, then make sure that min qty is at least 1
31
-		$min = $ticket->required() ? max( $min, 1 ) : $min;
32
-		if ( ! $ticket->is_on_sale() || $remaining < $min ) {
31
+		$min = $ticket->required() ? max($min, 1) : $min;
32
+		if ( ! $ticket->is_on_sale() || $remaining < $min) {
33 33
 			// set flag if ticket is required (flag is set to start date so that future tickets are not blocked)
34 34
 			$required_ticket_sold_out = $ticket->required() && ! $remaining ? $ticket->start_date() : $required_ticket_sold_out;
35 35
 		}
@@ -37,41 +37,41 @@  discard block
 block discarded – undo
37 37
 		$ticket_price = $ticket->get_ticket_total_with_taxes();
38 38
 		$ticket_bundle = FALSE;
39 39
 		// for ticket bundles, set min and max qty the same
40
-		if ( $ticket->min() != 0 && $ticket->min() == $ticket->max() ) {
40
+		if ($ticket->min() != 0 && $ticket->min() == $ticket->max()) {
41 41
 			$ticket_price = $ticket_price * $ticket->min();
42 42
 			$ticket_bundle = TRUE;
43 43
 		}
44
-		$ticket_price = apply_filters( 'FHEE__ticket_selector_chart_template__ticket_price', $ticket_price, $ticket );
44
+		$ticket_price = apply_filters('FHEE__ticket_selector_chart_template__ticket_price', $ticket_price, $ticket);
45 45
 		$is_remaining = $remaining > 0 ? true : false;
46 46
 		// if a previous required ticket with the same sale start date is sold out, then mark this ticket as sold out as well.
47 47
 		// tickets that go on sale at a later date than the required ticket  will NOT be affected
48
-		$tkt_status = $required_ticket_sold_out !== FALSE && $required_ticket_sold_out === $ticket->start_date() ? EE_Ticket::sold_out : $ticket->ticket_status( false, $is_remaining );
48
+		$tkt_status = $required_ticket_sold_out !== FALSE && $required_ticket_sold_out === $ticket->start_date() ? EE_Ticket::sold_out : $ticket->ticket_status(false, $is_remaining);
49 49
 		$tkt_status = $event_status === EE_Datetime::sold_out ? EE_Ticket::sold_out : $tkt_status;
50 50
 		// check ticket status
51
-		switch ( $tkt_status ) {
51
+		switch ($tkt_status) {
52 52
 			// sold_out
53 53
 			case EE_Ticket::sold_out :
54
-				$ticket_status = '<span class="ticket-sales-sold-out">' . $ticket->ticket_status( TRUE, $is_remaining ) . '</span>';
54
+				$ticket_status = '<span class="ticket-sales-sold-out">'.$ticket->ticket_status(TRUE, $is_remaining).'</span>';
55 55
 				$status_class = 'ticket-sales-sold-out lt-grey-text';
56 56
 			break;
57 57
 			// expired
58 58
 			case EE_Ticket::expired :
59
-				$ticket_status = '<span class="ticket-sales-expired">' . $ticket->ticket_status( true, $is_remaining ) . '</span>';
59
+				$ticket_status = '<span class="ticket-sales-expired">'.$ticket->ticket_status(true, $is_remaining).'</span>';
60 60
 				$status_class = 'ticket-sales-expired lt-grey-text';
61 61
 			break;
62 62
 			// archived
63 63
 			case EE_Ticket::archived :
64
-				$ticket_status = '<span class="archived-ticket">' . $ticket->ticket_status( true, $is_remaining ) . '</span>';
64
+				$ticket_status = '<span class="archived-ticket">'.$ticket->ticket_status(true, $is_remaining).'</span>';
65 65
 				$status_class = 'archived-ticket hidden';
66 66
 			break;
67 67
 			// pending
68 68
 			case EE_Ticket::pending :
69
-				$ticket_status = '<span class="ticket-pending">' . $ticket->ticket_status( true, $is_remaining ) . '</span>';
69
+				$ticket_status = '<span class="ticket-pending">'.$ticket->ticket_status(true, $is_remaining).'</span>';
70 70
 				$status_class = 'ticket-pending';
71 71
 			break;
72 72
 			// onsale
73 73
 			case EE_Ticket::onsale :
74
-				$ticket_status = '<span class="ticket-on-sale">' . $ticket->ticket_status( true, $is_remaining ) . '</span>';
74
+				$ticket_status = '<span class="ticket-on-sale">'.$ticket->ticket_status(true, $is_remaining).'</span>';
75 75
 				$status_class = 'ticket-on-sale';
76 76
 			break;
77 77
 		}
@@ -86,7 +86,7 @@  discard block
 block discarded – undo
86 86
 		 *
87 87
 		 * @var string|bool
88 88
 		 */
89
-		if ( false !== ( $new_row_content = apply_filters( 'FHEE__ticket_selector_chart_template__do_ticket_entire_row', false, $ticket, $max, $min, $required_ticket_sold_out, $ticket_price, $ticket_bundle, $ticket_status, $status_class ) ) ) {
89
+		if (false !== ($new_row_content = apply_filters('FHEE__ticket_selector_chart_template__do_ticket_entire_row', false, $ticket, $max, $min, $required_ticket_sold_out, $ticket_price, $ticket_bundle, $ticket_status, $status_class))) {
90 90
 			echo $new_row_content;
91 91
 			continue;
92 92
 		}
@@ -96,7 +96,7 @@  discard block
 block discarded – undo
96 96
             "tckt-slctr-tkt-details-{$EVT_ID}-{$TKT_ID}"
97 97
         );
98 98
 	?>
99
-				<tr class="tckt-slctr-tbl-tr <?php echo $status_class . ' ' . espresso_get_object_css_class( $ticket ); ?>">
99
+				<tr class="tckt-slctr-tbl-tr <?php echo $status_class.' '.espresso_get_object_css_class($ticket); ?>">
100 100
 		<?php
101 101
 		/**
102 102
 		 * Allow plugins to hook in and abort the generation and display of the contents of this
@@ -108,24 +108,24 @@  discard block
 block discarded – undo
108 108
 		 *
109 109
 		 * @var string|bool
110 110
 		 */
111
-		if ( false !== ( $new_row_cells_content = apply_filters( 'FHEE__ticket_selector_chart_template__do_ticket_inside_row', false, $ticket, $max, $min, $required_ticket_sold_out, $ticket_price, $ticket_bundle, $ticket_status, $status_class ) ) ) {
111
+		if (false !== ($new_row_cells_content = apply_filters('FHEE__ticket_selector_chart_template__do_ticket_inside_row', false, $ticket, $max, $min, $required_ticket_sold_out, $ticket_price, $ticket_bundle, $ticket_status, $status_class))) {
112 112
 			echo $new_row_cells_content;
113 113
 			echo '</tr>';
114 114
 			continue;
115 115
 		}
116 116
 		?>
117 117
 					<td class="tckt-slctr-tbl-td-name">
118
-						<b><?php echo $ticket->get_pretty('TKT_name');?></b>
119
-						<?php if ( $template_settings->show_ticket_details ) : ?>
120
-							<a id="display-<?php echo $ticket_details_css_id; ?>" class="display-tckt-slctr-tkt-details display-the-hidden lt-grey-text smaller-text hide-if-no-js" rel="<?php echo $ticket_details_css_id; ?>" title="<?php echo esc_attr( apply_filters( 'FHEE__ticket_selector_chart_template__show_ticket_details_link_title', __( 'click to show additional ticket details', 'event_espresso' )) ); ?>">
121
-								<?php echo sprintf( __( 'show%1$sdetails%1$s+', 'event_espresso' ), '&nbsp;' ); ?>
118
+						<b><?php echo $ticket->get_pretty('TKT_name'); ?></b>
119
+						<?php if ($template_settings->show_ticket_details) : ?>
120
+							<a id="display-<?php echo $ticket_details_css_id; ?>" class="display-tckt-slctr-tkt-details display-the-hidden lt-grey-text smaller-text hide-if-no-js" rel="<?php echo $ticket_details_css_id; ?>" title="<?php echo esc_attr(apply_filters('FHEE__ticket_selector_chart_template__show_ticket_details_link_title', __('click to show additional ticket details', 'event_espresso'))); ?>">
121
+								<?php echo sprintf(__('show%1$sdetails%1$s+', 'event_espresso'), '&nbsp;'); ?>
122 122
 							</a>
123
-							<a id="hide-<?php echo $ticket_details_css_id; ?>" class="hide-tckt-slctr-tkt-details hide-the-displayed lt-grey-text smaller-text hide-if-no-js" rel="<?php echo $ticket_details_css_id; ?>" title="<?php echo esc_attr( apply_filters( 'FHEE__ticket_selector_chart_template__hide_ticket_details_link_title', __( 'click to hide additional ticket details', 'event_espresso' )) ); ?>" style="display:none;">
124
-								<?php echo sprintf( __( 'hide%1$sdetails%1$s-', 'event_espresso' ), '&nbsp;' ); ?>
123
+							<a id="hide-<?php echo $ticket_details_css_id; ?>" class="hide-tckt-slctr-tkt-details hide-the-displayed lt-grey-text smaller-text hide-if-no-js" rel="<?php echo $ticket_details_css_id; ?>" title="<?php echo esc_attr(apply_filters('FHEE__ticket_selector_chart_template__hide_ticket_details_link_title', __('click to hide additional ticket details', 'event_espresso'))); ?>" style="display:none;">
124
+								<?php echo sprintf(__('hide%1$sdetails%1$s-', 'event_espresso'), '&nbsp;'); ?>
125 125
 							</a>
126 126
 						<?php endif; //end show details check ?>
127
-					<?php if ( $ticket->required() ) { ?>
128
-						<p class="ticket-required-pg"><?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_required_message', __( 'This ticket is required and must be purchased.', 'event_espresso' )); ?></p>
127
+					<?php if ($ticket->required()) { ?>
128
+						<p class="ticket-required-pg"><?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_required_message', __('This ticket is required and must be purchased.', 'event_espresso')); ?></p>
129 129
 					<?php } ?>
130 130
 					<?php
131 131
 //	echo '<br/><b>$max_atndz : ' . $max_atndz . '</b>';
@@ -139,63 +139,63 @@  discard block
 block discarded – undo
139 139
 //	echo '<br/><b> $ticket->required() : ' .  $ticket->uses() . '</b>';
140 140
 					?>
141 141
 					</td>
142
-					<?php if ( apply_filters( 'FHEE__ticket_selector_chart_template__display_ticket_price_details', TRUE )) { ?>
143
-					<td class="tckt-slctr-tbl-td-price jst-rght"><?php echo EEH_Template::format_currency( $ticket_price ); ?>&nbsp;<span class="smaller-text no-bold"><?php
144
-						if ( $ticket_bundle ) {
145
-							echo apply_filters( 'FHEE__ticket_selector_chart_template__per_ticket_bundle_text', __( ' / bundle', 'event_espresso' ));
142
+					<?php if (apply_filters('FHEE__ticket_selector_chart_template__display_ticket_price_details', TRUE)) { ?>
143
+					<td class="tckt-slctr-tbl-td-price jst-rght"><?php echo EEH_Template::format_currency($ticket_price); ?>&nbsp;<span class="smaller-text no-bold"><?php
144
+						if ($ticket_bundle) {
145
+							echo apply_filters('FHEE__ticket_selector_chart_template__per_ticket_bundle_text', __(' / bundle', 'event_espresso'));
146 146
 						} else {
147
-							echo apply_filters( 'FHEE__ticket_selector_chart_template__per_ticket_text', __( '', 'event_espresso' ));
147
+							echo apply_filters('FHEE__ticket_selector_chart_template__per_ticket_text', __('', 'event_espresso'));
148 148
 						}?></span>&nbsp;</td>
149 149
 					<?php } ?>
150 150
 					<td class="tckt-slctr-tbl-td-qty cntr">
151 151
 					<?php
152 152
 					$hidden_input_qty = $max_atndz > 1 ? TRUE : FALSE;
153 153
 					// sold out or other status ?
154
-					if ( $tkt_status == EE_Ticket::sold_out || $remaining == 0 ) {
154
+					if ($tkt_status == EE_Ticket::sold_out || $remaining == 0) {
155 155
 					?>
156
-						<span class="sold-out"><?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_sold_out_msg', __( 'Sold&nbsp;Out', 'event_espresso' ));?></span>
156
+						<span class="sold-out"><?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_sold_out_msg', __('Sold&nbsp;Out', 'event_espresso')); ?></span>
157 157
 					<?php
158
-					} else if ( $tkt_status == EE_Ticket::expired || $tkt_status == EE_Ticket::archived ) {
158
+					} else if ($tkt_status == EE_Ticket::expired || $tkt_status == EE_Ticket::archived) {
159 159
 						echo $ticket_status;
160
-					} else if ( $tkt_status == EE_Ticket::pending ) {
160
+					} else if ($tkt_status == EE_Ticket::pending) {
161 161
 					?>
162 162
 					<div class="ticket-pending-pg">
163
-						<span class="ticket-pending"><?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_goes_on_sale_msg', __( 'Goes&nbsp;On&nbsp;Sale', 'event_espresso' )); ?></span><br/>
164
-						<span class="small-text"><?php echo $ticket->get_i18n_datetime( 'TKT_start_date', apply_filters( 'FHEE__EED_Ticket_Selector__display_goes_on_sale__date_format', $date_format ) ); ?></span>
163
+						<span class="ticket-pending"><?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_goes_on_sale_msg', __('Goes&nbsp;On&nbsp;Sale', 'event_espresso')); ?></span><br/>
164
+						<span class="small-text"><?php echo $ticket->get_i18n_datetime('TKT_start_date', apply_filters('FHEE__EED_Ticket_Selector__display_goes_on_sale__date_format', $date_format)); ?></span>
165 165
 					</div>
166 166
 					<?php
167 167
 					// min qty purchasable is less than tickets available
168
-					} else if ( $ticket->min() > $remaining ) {
168
+					} else if ($ticket->min() > $remaining) {
169 169
 					?>
170 170
 					<div class="archived-ticket-pg">
171
-						<span class="archived-ticket small-text"><?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_not_available_msg', __( 'Not Available', 'event_espresso' )); ?></span><br/>
171
+						<span class="archived-ticket small-text"><?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_not_available_msg', __('Not Available', 'event_espresso')); ?></span><br/>
172 172
 					</div>
173 173
 					<?php
174 174
 					// if only one attendee is allowed to register at a time
175
-					} else if ( $max_atndz  == 1 ) {
175
+					} else if ($max_atndz == 1) {
176 176
 						// display submit button since we have tickets available
177
-						add_filter( 'FHEE__EE_Ticket_Selector__display_ticket_selector_submit', '__return_true' );
177
+						add_filter('FHEE__EE_Ticket_Selector__display_ticket_selector_submit', '__return_true');
178 178
 				?>
179
-					<input type="radio" name="tkt-slctr-qty-<?php echo $EVT_ID; ?>" id="ticket-selector-tbl-qty-slct-<?php echo $EVT_ID . '-' . $row; ?>" class="ticket-selector-tbl-qty-slct" value="<?php echo $row . '-'; ?>1" <?php echo $row == 1 ? ' checked="checked"' : ''; ?>  title=""/>
179
+					<input type="radio" name="tkt-slctr-qty-<?php echo $EVT_ID; ?>" id="ticket-selector-tbl-qty-slct-<?php echo $EVT_ID.'-'.$row; ?>" class="ticket-selector-tbl-qty-slct" value="<?php echo $row.'-'; ?>1" <?php echo $row == 1 ? ' checked="checked"' : ''; ?>  title=""/>
180 180
 			<?php
181 181
 						$hidden_input_qty = FALSE;
182 182
 
183
-					} else if ( $max_atndz  == 0 ) {
184
-						echo '<span class="sold-out">' . apply_filters( 'FHEE__ticket_selector_chart_template__ticket_closed_msg', __( 'Closed', 'event_espresso' )) . '</span>';
185
-					} elseif ( $max > 0 ) {
183
+					} else if ($max_atndz == 0) {
184
+						echo '<span class="sold-out">'.apply_filters('FHEE__ticket_selector_chart_template__ticket_closed_msg', __('Closed', 'event_espresso')).'</span>';
185
+					} elseif ($max > 0) {
186 186
 						// display submit button since we have tickets available
187
-						add_filter( 'FHEE__EE_Ticket_Selector__display_ticket_selector_submit', '__return_true' );
187
+						add_filter('FHEE__EE_Ticket_Selector__display_ticket_selector_submit', '__return_true');
188 188
 
189 189
 				?>
190
-					<select name="tkt-slctr-qty-<?php echo $EVT_ID; ?>[]" id="ticket-selector-tbl-qty-slct-<?php echo $EVT_ID . '-' . $row; ?>" class="ticket-selector-tbl-qty-slct" title="">
190
+					<select name="tkt-slctr-qty-<?php echo $EVT_ID; ?>[]" id="ticket-selector-tbl-qty-slct-<?php echo $EVT_ID.'-'.$row; ?>" class="ticket-selector-tbl-qty-slct" title="">
191 191
 					<?php
192 192
 						// this ensures that non-required tickets with non-zero MIN QTYs don't HAVE to be purchased
193
-						if ( ! $ticket->required() && $min !== 0 ) {
193
+						if ( ! $ticket->required() && $min !== 0) {
194 194
 					?>
195 195
 						<option value="0">&nbsp;0&nbsp;</option>
196 196
 					<?php }
197 197
 						// offer ticket quantities from the min to the max
198
-						for ( $i = $min; $i <= $max; $i++) {
198
+						for ($i = $min; $i <= $max; $i++) {
199 199
 					?>
200 200
 						<option value="<?php echo $i; ?>">&nbsp;<?php echo $i; ?>&nbsp;</option>
201 201
 					<?php } ?>
@@ -205,7 +205,7 @@  discard block
 block discarded – undo
205 205
 
206 206
 					}
207 207
 					// depending on group reg we need to change the format for qty
208
-					if ( $hidden_input_qty ) {
208
+					if ($hidden_input_qty) {
209 209
 					?>
210 210
 					<input type="hidden" name="tkt-slctr-qty-<?php echo $EVT_ID; ?>[]" value="0" />
211 211
 					<?php
@@ -215,33 +215,33 @@  discard block
 block discarded – undo
215 215
 
216 216
 					</td>
217 217
 				</tr>
218
-				<?php if ( $template_settings->show_ticket_details ) : ?>
219
-					<tr class="tckt-slctr-tkt-details-tr <?php echo espresso_get_object_css_class( $ticket, '', 'details' );?>">
218
+				<?php if ($template_settings->show_ticket_details) : ?>
219
+					<tr class="tckt-slctr-tkt-details-tr <?php echo espresso_get_object_css_class($ticket, '', 'details'); ?>">
220 220
 						<td class="tckt-slctr-tkt-details-td" colspan="3" >
221 221
 							<div id="<?php echo $ticket_details_css_id; ?>-dv" class="tckt-slctr-tkt-details-dv" style="display: none;">
222 222
 
223 223
 								<section class="tckt-slctr-tkt-details-sctn">
224
-									<h3><?php _e( 'Details', 'event_espresso' ); ?></h3>
224
+									<h3><?php _e('Details', 'event_espresso'); ?></h3>
225 225
 									<p><?php echo $ticket->description(); ?></p>
226 226
 
227
-									<?php if ( $ticket_price != 0 && apply_filters( 'FHEE__ticket_selector_chart_template__display_ticket_price_details', TRUE )) { ?>
227
+									<?php if ($ticket_price != 0 && apply_filters('FHEE__ticket_selector_chart_template__display_ticket_price_details', TRUE)) { ?>
228 228
 									<section class="tckt-slctr-tkt-price-sctn">
229
-										<h5><?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_price_breakdown_heading', __( 'Price', 'event_espresso' )); ?></h5>
229
+										<h5><?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_price_breakdown_heading', __('Price', 'event_espresso')); ?></h5>
230 230
 										<div class="tckt-slctr-tkt-details-tbl-wrap-dv">
231 231
 											<table class="tckt-slctr-tkt-details-tbl">
232 232
 												<thead>
233 233
 													<tr>
234
-														<th class="ee-third-width"><span class="small-text"><?php _e( 'Name', 'event_espresso' ); ?></span></th>
235
-														<th class="jst-cntr"><span class="small-text"><?php _e( 'Description', 'event_espresso' ); ?></span></th>
236
-														<th class="ee-fourth-width jst-rght"><span class="small-text"><?php _e( 'Amount', 'event_espresso' ); ?></span></th>
234
+														<th class="ee-third-width"><span class="small-text"><?php _e('Name', 'event_espresso'); ?></span></th>
235
+														<th class="jst-cntr"><span class="small-text"><?php _e('Description', 'event_espresso'); ?></span></th>
236
+														<th class="ee-fourth-width jst-rght"><span class="small-text"><?php _e('Amount', 'event_espresso'); ?></span></th>
237 237
 													</tr>
238 238
 												</thead>
239 239
 												<tbody>
240
-										<?php if ( $ticket->base_price() instanceof EE_Price ) { ?>
240
+										<?php if ($ticket->base_price() instanceof EE_Price) { ?>
241 241
 													<tr>
242
-														<td data-th="<?php _e( 'Name', 'event_espresso' ); ?>" class="small-text"><b><?php echo $ticket->base_price()->name(); ?></b></td>
243
-														<td data-th="<?php _e( 'Description', 'event_espresso' ); ?>" class="small-text"><?php echo $ticket->base_price()->desc(); ?></td>
244
-														<td data-th="<?php _e( 'Amount', 'event_espresso' ); ?>" class="jst-rght small-text"><?php echo $ticket->base_price()->pretty_price(); ?></td>
242
+														<td data-th="<?php _e('Name', 'event_espresso'); ?>" class="small-text"><b><?php echo $ticket->base_price()->name(); ?></b></td>
243
+														<td data-th="<?php _e('Description', 'event_espresso'); ?>" class="small-text"><?php echo $ticket->base_price()->desc(); ?></td>
244
+														<td data-th="<?php _e('Amount', 'event_espresso'); ?>" class="jst-rght small-text"><?php echo $ticket->base_price()->pretty_price(); ?></td>
245 245
 													</tr>
246 246
 													<?php
247 247
 															$running_total = $ticket->base_price()->amount();
@@ -249,44 +249,44 @@  discard block
 block discarded – undo
249 249
 															$running_total = 0;
250 250
 														}
251 251
 														// now add price modifiers
252
-														foreach ( $ticket->price_modifiers() as $price_mod ) { ?>
252
+														foreach ($ticket->price_modifiers() as $price_mod) { ?>
253 253
 													<tr>
254
-														<td data-th="<?php _e( 'Name', 'event_espresso' ); ?>" class="jst-rght small-text"><?php echo $price_mod->name(); ?></td>
255
-													<?php if ( $price_mod->is_percent() ) { ?>
256
-														<td data-th="<?php _e( 'Description', 'event_espresso' ); ?>" class="small-text"><?php echo $price_mod->desc(); ?> <?php echo $price_mod->amount(); ?>%</td>
254
+														<td data-th="<?php _e('Name', 'event_espresso'); ?>" class="jst-rght small-text"><?php echo $price_mod->name(); ?></td>
255
+													<?php if ($price_mod->is_percent()) { ?>
256
+														<td data-th="<?php _e('Description', 'event_espresso'); ?>" class="small-text"><?php echo $price_mod->desc(); ?> <?php echo $price_mod->amount(); ?>%</td>
257 257
 														<?php
258
-															$new_sub_total = $running_total * ( $price_mod->amount() / 100 );
258
+															$new_sub_total = $running_total * ($price_mod->amount() / 100);
259 259
 															$new_sub_total = $price_mod->is_discount() ? $new_sub_total * -1 : $new_sub_total;
260 260
 														?>
261 261
 													<?php } else { ?>
262 262
 														<?php $new_sub_total = $price_mod->is_discount() ? $price_mod->amount() * -1 : $price_mod->amount(); ?>
263
-														<td data-th="<?php _e( 'Description', 'event_espresso' ); ?>" class="small-text"><?php echo $price_mod->desc(); ?></td>
263
+														<td data-th="<?php _e('Description', 'event_espresso'); ?>" class="small-text"><?php echo $price_mod->desc(); ?></td>
264 264
 														<?php $new_sub_total = $price_mod->is_discount() ? $price_mod->amount() * -1 : $price_mod->amount(); ?>
265 265
 													<?php } ?>
266
-														<td data-th="<?php _e( 'Amount', 'event_espresso' ); ?>" class="jst-rght small-text"><?php echo EEH_Template::format_currency( $new_sub_total ); ?></td>
266
+														<td data-th="<?php _e('Amount', 'event_espresso'); ?>" class="jst-rght small-text"><?php echo EEH_Template::format_currency($new_sub_total); ?></td>
267 267
 														<?php $running_total += $new_sub_total; ?>
268 268
 													</tr>
269 269
 												<?php } ?>
270
-												<?php if ( $ticket->taxable() ) { ?>
270
+												<?php if ($ticket->taxable()) { ?>
271 271
 													<?php //$ticket_subtotal =$ticket->get_ticket_subtotal(); ?>
272 272
 													<tr>
273
-														<td colspan="2" class="jst-rght small-text sbttl"><b><?php _e( 'subtotal', 'event_espresso' ); ?></b></td>
274
-														<td data-th="<?php _e( 'subtotal', 'event_espresso' ); ?>" class="jst-rght small-text"><b><?php echo  EEH_Template::format_currency( $running_total ); ?></b></td>
273
+														<td colspan="2" class="jst-rght small-text sbttl"><b><?php _e('subtotal', 'event_espresso'); ?></b></td>
274
+														<td data-th="<?php _e('subtotal', 'event_espresso'); ?>" class="jst-rght small-text"><b><?php echo  EEH_Template::format_currency($running_total); ?></b></td>
275 275
 													</tr>
276 276
 
277
-													<?php foreach ( $ticket->get_ticket_taxes_for_admin() as $tax ) { ?>
277
+													<?php foreach ($ticket->get_ticket_taxes_for_admin() as $tax) { ?>
278 278
 													<tr>
279
-														<td data-th="<?php _e( 'Name', 'event_espresso' ); ?>" class="jst-rght small-text"><?php echo $tax->name(); ?></td>
280
-														<td data-th="<?php _e( 'Description', 'event_espresso' ); ?>" class="jst-rght small-text"><?php echo $tax->amount(); ?>%</td>
281
-														<?php $tax_amount = $running_total * ( $tax->amount() / 100 ); ?>
282
-														<td data-th="<?php _e( 'Amount', 'event_espresso' ); ?>" class="jst-rght small-text"><?php echo EEH_Template::format_currency( $tax_amount ); ?></td>
279
+														<td data-th="<?php _e('Name', 'event_espresso'); ?>" class="jst-rght small-text"><?php echo $tax->name(); ?></td>
280
+														<td data-th="<?php _e('Description', 'event_espresso'); ?>" class="jst-rght small-text"><?php echo $tax->amount(); ?>%</td>
281
+														<?php $tax_amount = $running_total * ($tax->amount() / 100); ?>
282
+														<td data-th="<?php _e('Amount', 'event_espresso'); ?>" class="jst-rght small-text"><?php echo EEH_Template::format_currency($tax_amount); ?></td>
283 283
 														<?php $running_total += $tax_amount; ?>
284 284
 													</tr>
285 285
 													<?php } ?>
286 286
 												<?php } ?>
287 287
 													<tr>
288
-														<td colspan="2" class="jst-rght small-text ttl-lbl-td"><b><?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_total_price', __( 'Total', 'event_espresso' )); ?></b></td>
289
-														<td data-th="<?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_total_price', __( 'Total', 'event_espresso' )); ?>" class="jst-rght small-text"><b><?php echo EEH_Template::format_currency( $running_total ); ?></b></td>
288
+														<td colspan="2" class="jst-rght small-text ttl-lbl-td"><b><?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_total_price', __('Total', 'event_espresso')); ?></b></td>
289
+														<td data-th="<?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_total_price', __('Total', 'event_espresso')); ?>" class="jst-rght small-text"><b><?php echo EEH_Template::format_currency($running_total); ?></b></td>
290 290
 													</tr>
291 291
 												</tbody>
292 292
 											</table>
@@ -296,106 +296,106 @@  discard block
 block discarded – undo
296 296
 									<?php } ?>
297 297
 
298 298
 									<section class="tckt-slctr-tkt-sale-dates-sctn">
299
-										<h5><?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_sales_date_heading', __( 'Sale Dates', 'event_espresso' )); ?></h5>
300
-										<span class="drk-grey-text small-text no-bold"> - <?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_dates_available_message', __( 'The dates when this option is available for purchase.', 'event_espresso' )); ?></span><br/>
301
-										<span class="ticket-details-label-spn drk-grey-text"><?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_goes_on_sale', __( 'Goes On Sale:', 'event_espresso' )); ?></span><span class="dashicons dashicons-calendar"></span><?php echo $ticket->get_i18n_datetime( 'TKT_start_date', $date_format) . ' &nbsp; '; ?><span class="dashicons dashicons-clock"></span><?php echo $ticket->get_i18n_datetime( 'TKT_start_date',  $time_format ) ; ?><br/>
302
-										<span class="ticket-details-label-spn drk-grey-text"><?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_sales_end', __( 'Sales End:', 'event_espresso' )); ?></span><span class="dashicons dashicons-calendar"></span><?php echo $ticket->get_i18n_datetime( 'TKT_end_date', $date_format ) . ' &nbsp; '; ?><span class="dashicons dashicons-clock"></span><?php echo $ticket->get_i18n_datetime( 'TKT_end_date', $time_format ) ; ?><br/>
299
+										<h5><?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_sales_date_heading', __('Sale Dates', 'event_espresso')); ?></h5>
300
+										<span class="drk-grey-text small-text no-bold"> - <?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_dates_available_message', __('The dates when this option is available for purchase.', 'event_espresso')); ?></span><br/>
301
+										<span class="ticket-details-label-spn drk-grey-text"><?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_goes_on_sale', __('Goes On Sale:', 'event_espresso')); ?></span><span class="dashicons dashicons-calendar"></span><?php echo $ticket->get_i18n_datetime('TKT_start_date', $date_format).' &nbsp; '; ?><span class="dashicons dashicons-clock"></span><?php echo $ticket->get_i18n_datetime('TKT_start_date', $time_format); ?><br/>
302
+										<span class="ticket-details-label-spn drk-grey-text"><?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_sales_end', __('Sales End:', 'event_espresso')); ?></span><span class="dashicons dashicons-calendar"></span><?php echo $ticket->get_i18n_datetime('TKT_end_date', $date_format).' &nbsp; '; ?><span class="dashicons dashicons-clock"></span><?php echo $ticket->get_i18n_datetime('TKT_end_date', $time_format); ?><br/>
303 303
 									</section>
304 304
 									<br/>
305 305
 
306
-									<?php do_action( 'AHEE__ticket_selector_chart_template__after_ticket_date', $ticket ); ?>
306
+									<?php do_action('AHEE__ticket_selector_chart_template__after_ticket_date', $ticket); ?>
307 307
 
308
-									<?php if ( $ticket->min() && $ticket->max() ) { ?>
308
+									<?php if ($ticket->min() && $ticket->max()) { ?>
309 309
 									<section class="tckt-slctr-tkt-quantities-sctn">
310
-										<h5><?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_purchasable_quantities_heading', __( 'Purchasable Quantities', 'event_espresso' )); ?></h5>
311
-										<span class="drk-grey-text small-text no-bold"> - <?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_purchasable_quantities_message', __( 'The number of tickets that can be purchased per transaction (if available).', 'event_espresso' )); ?></span><br/>
312
-										<span class="ticket-details-label-spn drk-grey-text"><?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_purchasable_quantities_min_qty', __( 'Minimum Qty:', 'event_espresso' )); ?></span><?php echo $ticket->min() > 0 ? $ticket->min() : 0; ?>
313
-										<?php if ( $ticket->min() > $remaining ) { ?> &nbsp; <span class="important-notice small-text"><?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_purchasable_quantities_min_qty_message', __( 'The Minimum Quantity purchasable for this ticket exceeds the number of spaces remaining', 'event_espresso' )); ?></span><?php } ?><br/>
310
+										<h5><?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_purchasable_quantities_heading', __('Purchasable Quantities', 'event_espresso')); ?></h5>
311
+										<span class="drk-grey-text small-text no-bold"> - <?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_purchasable_quantities_message', __('The number of tickets that can be purchased per transaction (if available).', 'event_espresso')); ?></span><br/>
312
+										<span class="ticket-details-label-spn drk-grey-text"><?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_purchasable_quantities_min_qty', __('Minimum Qty:', 'event_espresso')); ?></span><?php echo $ticket->min() > 0 ? $ticket->min() : 0; ?>
313
+										<?php if ($ticket->min() > $remaining) { ?> &nbsp; <span class="important-notice small-text"><?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_purchasable_quantities_min_qty_message', __('The Minimum Quantity purchasable for this ticket exceeds the number of spaces remaining', 'event_espresso')); ?></span><?php } ?><br/>
314 314
 										<?php //$max = min( $max, $max_atndz );?>
315
-										<span class="ticket-details-label-spn drk-grey-text"><?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_purchasable_quantities_max_qty', __( 'Maximum Qty:', 'event_espresso' )); ?></span><?php echo $ticket->max() === EE_INF ? __( 'no limit', 'event_espresso' ) : max( $ticket->max(), 1 ); ?><br/>
315
+										<span class="ticket-details-label-spn drk-grey-text"><?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_purchasable_quantities_max_qty', __('Maximum Qty:', 'event_espresso')); ?></span><?php echo $ticket->max() === EE_INF ? __('no limit', 'event_espresso') : max($ticket->max(), 1); ?><br/>
316 316
 									</section>
317 317
 									<br/>
318 318
 									<?php } ?>
319 319
 
320
-									<?php if ( $ticket->uses() !== EE_INF && ( ! defined( 'EE_DECAF' ) || EE_DECAF !== TRUE )) { ?>
320
+									<?php if ($ticket->uses() !== EE_INF && ( ! defined('EE_DECAF') || EE_DECAF !== TRUE)) { ?>
321 321
 									<section class="tckt-slctr-tkt-uses-sctn">
322
-										<h5><?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_event_date_ticket_uses_heading', __( 'Event Date Ticket Uses', 'event_espresso' )); ?></h5>
322
+										<h5><?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_event_date_ticket_uses_heading', __('Event Date Ticket Uses', 'event_espresso')); ?></h5>
323 323
 										<span class="drk-grey-text small-text no-bold"> - <?php
324 324
 											echo apply_filters(
325 325
 												'FHEE__ticket_selector_chart_template__ticket_details_event_date_ticket_uses_message',
326 326
 												sprintf(
327
-													__( 'The number of separate event datetimes (see table below) that this ticket can be used to gain admittance to.%1$s%2$sAdmission is always one person per ticket.%3$s', 'event_espresso' ),
327
+													__('The number of separate event datetimes (see table below) that this ticket can be used to gain admittance to.%1$s%2$sAdmission is always one person per ticket.%3$s', 'event_espresso'),
328 328
 													'<br/>',
329 329
 													'<strong>',
330 330
 													'</strong>'
331 331
 												)
332 332
 											);
333 333
 											?></span><br/>
334
-										<span class="ticket-details-label-spn drk-grey-text"><?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_event_date_number_datetimes', __( '# Datetimes:', 'event_espresso' )); ?></span><?php  echo $ticket->uses();?><br/>
334
+										<span class="ticket-details-label-spn drk-grey-text"><?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_event_date_number_datetimes', __('# Datetimes:', 'event_espresso')); ?></span><?php  echo $ticket->uses(); ?><br/>
335 335
 									</section>
336 336
 									<?php } ?>
337 337
 
338 338
 									<?php
339
-									$datetimes = $ticket->datetimes_ordered( $event_is_expired, FALSE );
339
+									$datetimes = $ticket->datetimes_ordered($event_is_expired, FALSE);
340 340
 									$chart_column_width = $template_settings->show_ticket_sale_columns ? ' ee-fourth-width' : ' ee-half-width';
341
-									if ( ! empty( $datetimes )) { ?>
341
+									if ( ! empty($datetimes)) { ?>
342 342
 									<section class="tckt-slctr-tkt-datetimes-sctn">
343
-										<h5><?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_event_access_heading', __( 'Access', 'event_espresso' )); ?></h5>
344
-										<span class="drk-grey-text small-text no-bold"> - <?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_event_access_message', __( 'This option allows access to the following dates and times.', 'event_espresso' )); ?></span>
343
+										<h5><?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_event_access_heading', __('Access', 'event_espresso')); ?></h5>
344
+										<span class="drk-grey-text small-text no-bold"> - <?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_event_access_message', __('This option allows access to the following dates and times.', 'event_espresso')); ?></span>
345 345
 										<div class="tckt-slctr-tkt-details-tbl-wrap-dv">
346 346
 											<table class="tckt-slctr-tkt-details-tbl">
347 347
 												<thead>
348 348
 													<tr>
349 349
 														<th class="tckt-slctr-tkt-details-date-th">
350
-															<span class="dashicons dashicons-calendar"></span><span class="small-text"><?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_event_access_table_event_date', __( 'Date ', 'event_espresso' )); ?></span>
350
+															<span class="dashicons dashicons-calendar"></span><span class="small-text"><?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_event_access_table_event_date', __('Date ', 'event_espresso')); ?></span>
351 351
 														</th>
352 352
 														<th class="tckt-slctr-tkt-details-time-th <?php echo $chart_column_width; ?>">
353
-															<span class="dashicons dashicons-clock"></span><span class="small-text"><?php _e( 'Time ', 'event_espresso' ); ?></span>
353
+															<span class="dashicons dashicons-clock"></span><span class="small-text"><?php _e('Time ', 'event_espresso'); ?></span>
354 354
 														</th>
355
-														<?php if ( $template_settings->show_ticket_sale_columns ) : ?>
355
+														<?php if ($template_settings->show_ticket_sale_columns) : ?>
356 356
 															<th class="tckt-slctr-tkt-details-this-ticket-sold-th ee-fourth-width cntr">
357
-																<span class="smaller-text"><?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_event_access_table_this_ticket_sold', sprintf( __( 'Sold', 'event_espresso' ), '<br/>' )); ?></span>
357
+																<span class="smaller-text"><?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_event_access_table_this_ticket_sold', sprintf(__('Sold', 'event_espresso'), '<br/>')); ?></span>
358 358
 															</th>
359 359
 															<th class="tckt-slctr-tkt-details-this-ticket-left-th ee-fourth-width cntr">
360
-																<span class="smaller-text"><?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_event_access_table_this_ticket_left', sprintf( __( 'Remaining', 'event_espresso' ), '<br/>' )); ?></span>
360
+																<span class="smaller-text"><?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_event_access_table_this_ticket_left', sprintf(__('Remaining', 'event_espresso'), '<br/>')); ?></span>
361 361
 															</th>
362 362
 															<th class="tckt-slctr-tkt-details-total-tickets-sold-th ee-fourth-width cntr">
363
-																<span class="smaller-text"><?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_event_access_table_total_ticket_sold', sprintf( __( 'Total%sSold', 'event_espresso' ), '<br/>' )); ?></span>
363
+																<span class="smaller-text"><?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_event_access_table_total_ticket_sold', sprintf(__('Total%sSold', 'event_espresso'), '<br/>')); ?></span>
364 364
 															</th>
365 365
 															<th class="tckt-slctr-tkt-details-total-tickets-left-th ee-fourth-width cntr">
366
-																<span class="smaller-text"><?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_event_access_table_total_ticket_left', sprintf( __( 'Total Spaces%sLeft', 'event_espresso' ), '<br/>' )); ?></span>
366
+																<span class="smaller-text"><?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_event_access_table_total_ticket_left', sprintf(__('Total Spaces%sLeft', 'event_espresso'), '<br/>')); ?></span>
367 367
 															</th>
368 368
 														<?php endif; //end $template_settings->show_ticket_sale_columns conditional ?>
369 369
 													</tr>
370 370
 												</thead>
371 371
 												<tbody>
372 372
 											<?php
373
-												foreach ( $datetimes as $datetime ) {
374
-													if ( $datetime instanceof EE_Datetime ) {
373
+												foreach ($datetimes as $datetime) {
374
+													if ($datetime instanceof EE_Datetime) {
375 375
 											?>
376 376
 
377 377
 												<tr>
378
-													<td data-th="<?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_event_access_table_event_date', __( 'Event Date ', 'event_espresso' )); ?>" class="small-text">
378
+													<td data-th="<?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_event_access_table_event_date', __('Event Date ', 'event_espresso')); ?>" class="small-text">
379 379
 														<?php $datetime_name = $datetime->name(); ?>
380
-														<?php echo ! empty( $datetime_name ) ? '<b>' . $datetime_name . '</b><br/>' : ''; ?>
381
-														<?php echo $datetime->date_range( $date_format, __( ' to  ', 'event_espresso' )); ?>
380
+														<?php echo ! empty($datetime_name) ? '<b>'.$datetime_name.'</b><br/>' : ''; ?>
381
+														<?php echo $datetime->date_range($date_format, __(' to  ', 'event_espresso')); ?>
382 382
 													</td>
383
-													<td data-th="<?php _e( 'Time ', 'event_espresso' ); ?>" class="cntr small-text">
384
-														<?php echo $datetime->time_range( $time_format, __( ' to  ', 'event_espresso' )); ?>
383
+													<td data-th="<?php _e('Time ', 'event_espresso'); ?>" class="cntr small-text">
384
+														<?php echo $datetime->time_range($time_format, __(' to  ', 'event_espresso')); ?>
385 385
 													</td>
386
-													<?php if ( $template_settings->show_ticket_sale_columns ) : ?>
387
-														<td data-th="<?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_event_access_table_this_ticket_sold', __( 'Sold', 'event_espresso' )); ?>" class="cntr small-text">
386
+													<?php if ($template_settings->show_ticket_sale_columns) : ?>
387
+														<td data-th="<?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_event_access_table_this_ticket_sold', __('Sold', 'event_espresso')); ?>" class="cntr small-text">
388 388
 															<?php echo $ticket->sold(); ?>
389 389
 														</td>
390
-														<td data-th="<?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_event_access_table_this_ticket_left', __( 'Remaining', 'event_espresso' )); ?>" class="cntr small-text">
391
-															<?php echo $remaining === EE_INF ? '<span class="smaller-text">' .  __( 'unlimited ', 'event_espresso' ) . '</span>' : $remaining; ?>
390
+														<td data-th="<?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_event_access_table_this_ticket_left', __('Remaining', 'event_espresso')); ?>" class="cntr small-text">
391
+															<?php echo $remaining === EE_INF ? '<span class="smaller-text">'.__('unlimited ', 'event_espresso').'</span>' : $remaining; ?>
392 392
 														</td>
393
-														<td data-th="<?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_event_access_table_total_ticket_sold', __( 'Total Sold', 'event_espresso' )); ?>" class="cntr small-text">
393
+														<td data-th="<?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_event_access_table_total_ticket_sold', __('Total Sold', 'event_espresso')); ?>" class="cntr small-text">
394 394
 															<?php echo $datetime->sold(); ?>
395 395
 														</td>
396
-												<?php $tkts_left = $datetime->sold_out() ? '<span class="sold-out smaller-text">' . __( 'Sold&nbsp;Out', 'event_espresso' ) . '</span>' : $datetime->spaces_remaining(); ?>
397
-														<td data-th="<?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_event_access_table_total_ticket_left', __( 'Total Spaces Left', 'event_espresso' )); ?>" class="cntr small-text">
398
-															<?php echo $tkts_left === EE_INF ? '<span class="smaller-text">' .  __( 'unlimited ', 'event_espresso' ) . '</span>' : $tkts_left; ?>
396
+												<?php $tkts_left = $datetime->sold_out() ? '<span class="sold-out smaller-text">'.__('Sold&nbsp;Out', 'event_espresso').'</span>' : $datetime->spaces_remaining(); ?>
397
+														<td data-th="<?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_event_access_table_total_ticket_left', __('Total Spaces Left', 'event_espresso')); ?>" class="cntr small-text">
398
+															<?php echo $tkts_left === EE_INF ? '<span class="smaller-text">'.__('unlimited ', 'event_espresso').'</span>' : $tkts_left; ?>
399 399
 														</td>
400 400
 													<?php endif; //end $template_settings->show_ticket_sale_columns conditional ?>
401 401
 												</tr>
@@ -413,7 +413,7 @@  discard block
 block discarded – undo
413 413
 							</div>
414 414
 						</td>
415 415
 					</tr>
416
-				<?php endif;  //end template_settings->show_ticket_details check?>
416
+				<?php endif; //end template_settings->show_ticket_details check?>
417 417
 	<?php
418 418
 			$row++;
419 419
 		}
@@ -422,32 +422,32 @@  discard block
 block discarded – undo
422 422
 $ticket_row_html = ob_get_clean();
423 423
 // if there is only ONE ticket with a max qty of ONE, and it is free... then not much need for the ticket selector
424 424
 $hide_ticket_selector = $ticket_count == 1 && $max_atndz == 1 && $ticket->is_free() ? true : false;
425
-$hide_ticket_selector = apply_filters( 'FHEE__ticket_selector_chart_template__hide_ticket_selector', $hide_ticket_selector, $EVT_ID );
425
+$hide_ticket_selector = apply_filters('FHEE__ticket_selector_chart_template__hide_ticket_selector', $hide_ticket_selector, $EVT_ID);
426 426
 //EEH_Debug_Tools::printr( $ticket_count, '$ticket_count', __FILE__, __LINE__ );
427 427
 //EEH_Debug_Tools::printr( $max, '$max', __FILE__, __LINE__ );
428 428
 //EEH_Debug_Tools::printr( $hide_ticket_selector, '$hide_ticket_selector', __FILE__, __LINE__ );
429 429
 //EEH_Debug_Tools::printr( $table_style, '$table_style', __FILE__, __LINE__ );
430 430
 remove_filter(
431 431
 	'FHEE__EE_Ticket_Selector__after_ticket_selector_submit',
432
-	array( 'EED_Ticket_Selector', 'no_tkt_slctr_end_dv' )
432
+	array('EED_Ticket_Selector', 'no_tkt_slctr_end_dv')
433 433
 );
434 434
 remove_filter(
435 435
 	'FHEE__EE_Ticket_Selector__after_view_details_btn',
436
-	array( 'EED_Ticket_Selector', 'no_tkt_slctr_end_dv' )
436
+	array('EED_Ticket_Selector', 'no_tkt_slctr_end_dv')
437 437
 );
438
-if ( ! $hide_ticket_selector ) {
438
+if ( ! $hide_ticket_selector) {
439 439
 ?>
440 440
 <div id="tkt-slctr-tbl-wrap-dv-<?php echo $EVT_ID; ?>" class="tkt-slctr-tbl-wrap-dv">
441 441
 
442
-	<?php do_action( 'AHEE__ticket_selector_chart__template__before_ticket_selector', $event ); ?>
442
+	<?php do_action('AHEE__ticket_selector_chart__template__before_ticket_selector', $event); ?>
443 443
 
444 444
 	<table id="tkt-slctr-tbl-<?php echo $EVT_ID; ?>" class="tkt-slctr-tbl">
445 445
 		<thead>
446 446
 			<tr>
447 447
 				<th scope="col" class="ee-ticket-selector-ticket-details-th">
448
-					<?php echo esc_html( apply_filters( 'FHEE__ticket_selector_chart_template__table_header_available_tickets', '', $EVT_ID ) ); ?>
448
+					<?php echo esc_html(apply_filters('FHEE__ticket_selector_chart_template__table_header_available_tickets', '', $EVT_ID)); ?>
449 449
 				</th>
450
-				<?php if ( apply_filters( 'FHEE__ticket_selector_chart_template__display_ticket_price_details', TRUE )) { ?>
450
+				<?php if (apply_filters('FHEE__ticket_selector_chart_template__display_ticket_price_details', TRUE)) { ?>
451 451
 				<th scope="col" class="ee-ticket-selector-ticket-price-th cntr">
452 452
 					<?php
453 453
 						/**
@@ -458,7 +458,7 @@  discard block
 block discarded – undo
458 458
 						 * @param string 'Price' The translatable text to display in the table header for price
459 459
 						 * @param int $EVT_ID The Event ID
460 460
 						 */
461
-						echo esc_html( apply_filters( 'FHEE__ticket_selector_chart_template__table_header_price', __( 'Price', 'event_espresso' ), $EVT_ID ) );
461
+						echo esc_html(apply_filters('FHEE__ticket_selector_chart_template__table_header_price', __('Price', 'event_espresso'), $EVT_ID));
462 462
 					?>
463 463
 				</th>
464 464
 				<?php } ?>
@@ -472,24 +472,24 @@  discard block
 block discarded – undo
472 472
 						* @param string 'Qty*' The translatable text to display in the table header for the Quantity of tickets
473 473
 						* @param int $EVT_ID The Event ID
474 474
 						*/
475
-						echo esc_html( apply_filters( 'FHEE__ticket_selector_chart_template__table_header_qty', __( 'Qty*', 'event_espresso' ), $EVT_ID ) );
475
+						echo esc_html(apply_filters('FHEE__ticket_selector_chart_template__table_header_qty', __('Qty*', 'event_espresso'), $EVT_ID));
476 476
 					?>
477 477
 				</th>
478 478
 			</tr>
479 479
 		</thead>
480 480
 		<tbody>
481
-			<?php echo $ticket_row_html;?>
481
+			<?php echo $ticket_row_html; ?>
482 482
 		</tbody>
483 483
 	</table>
484 484
 
485 485
 	<input type="hidden" name="noheader" value="true" />
486
-	<input type="hidden" name="tkt-slctr-return-url-<?php echo $EVT_ID ?>" value="<?php echo EEH_URL::filter_input_server_url();?>" />
486
+	<input type="hidden" name="tkt-slctr-return-url-<?php echo $EVT_ID ?>" value="<?php echo EEH_URL::filter_input_server_url(); ?>" />
487 487
 	<input type="hidden" name="tkt-slctr-rows-<?php echo $EVT_ID; ?>" value="<?php echo $row - 1; ?>" />
488 488
 	<input type="hidden" name="tkt-slctr-max-atndz-<?php echo $EVT_ID; ?>" value="<?php echo $max_atndz; ?>" />
489 489
 	<input type="hidden" name="tkt-slctr-event-id" value="<?php echo $EVT_ID; ?>" />
490 490
 
491 491
 <?php
492
-	if ( $max_atndz > 0 && ! $hide_ticket_selector ) {
492
+	if ($max_atndz > 0 && ! $hide_ticket_selector) {
493 493
 		echo apply_filters(
494 494
 			'FHEE__ticket_selector_chart_template__maximum_tickets_purchased_footnote',
495 495
 			''
@@ -497,10 +497,10 @@  discard block
 block discarded – undo
497 497
 	}
498 498
 ?>
499 499
 
500
-	<?php do_action( 'AHEE__ticket_selector_chart__template__after_ticket_selector', $EVT_ID, $event ); ?>
500
+	<?php do_action('AHEE__ticket_selector_chart__template__after_ticket_selector', $EVT_ID, $event); ?>
501 501
 
502 502
 </div>
503
-<?php } else if ( isset( $TKT_ID ) ) { ?>
503
+<?php } else if (isset($TKT_ID)) { ?>
504 504
 <input type="hidden" name="tkt-slctr-qty-<?php echo $EVT_ID; ?>[]" value="1"/>
505 505
 <input type="hidden" name="tkt-slctr-ticket-id-<?php echo $EVT_ID; ?>[]" value="<?php echo $TKT_ID; ?>"/>
506 506
 <input type="hidden" name="noheader" value="true"/>
@@ -509,27 +509,27 @@  discard block
 block discarded – undo
509 509
 <input type="hidden" name="tkt-slctr-max-atndz-<?php echo $EVT_ID; ?>" value="<?php echo $max_atndz; ?>"/>
510 510
 <input type="hidden" name="tkt-slctr-event-id" value="<?php echo $EVT_ID; ?>"/>
511 511
 <?php
512
-	if ( $ticket instanceof EE_Ticket ) {
513
-		do_action( 'AHEE__ticket_selector_chart__template__before_ticket_selector', $event );
512
+	if ($ticket instanceof EE_Ticket) {
513
+		do_action('AHEE__ticket_selector_chart__template__before_ticket_selector', $event);
514 514
 		$ticket_description = $ticket->description();
515 515
 ?>
516 516
 <div id="no-tkt-slctr-ticket-dv-<?php echo $EVT_ID; ?>" class="no-tkt-slctr-ticket-dv">
517 517
 	<div class="no-tkt-slctr-ticket-content-dv">
518 518
 		<h5><?php echo $ticket->name(); ?></h5>
519
-		<?php if ( ! empty( $ticket_description ) ) { ?>
519
+		<?php if ( ! empty($ticket_description)) { ?>
520 520
 		<p><?php echo $ticket_description; ?></p>
521 521
 		<?php } ?>
522 522
 	</div>
523 523
 <?php
524 524
 		add_filter(
525 525
 			'FHEE__EE_Ticket_Selector__after_ticket_selector_submit',
526
-			array( 'EED_Ticket_Selector', 'no_tkt_slctr_end_dv' )
526
+			array('EED_Ticket_Selector', 'no_tkt_slctr_end_dv')
527 527
 		);
528 528
 		add_filter(
529 529
 			'FHEE__EE_Ticket_Selector__after_view_details_btn',
530
-			array( 'EED_Ticket_Selector', 'no_tkt_slctr_end_dv' )
530
+			array('EED_Ticket_Selector', 'no_tkt_slctr_end_dv')
531 531
 		);
532
-		do_action( 'AHEE__ticket_selector_chart__template__after_ticket_selector', $EVT_ID, $event );
532
+		do_action('AHEE__ticket_selector_chart__template__after_ticket_selector', $EVT_ID, $event);
533 533
 	}
534 534
 }
535 535
 ?>
Please login to merge, or discard this patch.
admin_pages/registrations/Registrations_Admin_Page.core.php 2 patches
Indentation   +64 added lines, -64 removed lines patch added patch discarded remove patch
@@ -163,9 +163,9 @@  discard block
 block discarded – undo
163 163
 
164 164
 	/**
165 165
 	 * 		grab url requests and route them
166
-	*		@access private
167
-	*		@return void
168
-	*/
166
+	 *		@access private
167
+	 *		@return void
168
+	 */
169 169
 	public function _set_page_routes() {
170 170
 
171 171
 		$this->_get_registration_status_array();
@@ -437,7 +437,7 @@  discard block
 block discarded – undo
437 437
 						'title' => __('Registrations Other', 'event_espresso'),
438 438
 						'filename' => 'registrations_overview_other'
439 439
 					)
440
-                ),
440
+				),
441 441
 				'help_tour' => array( 'Registration_Overview_Help_Tour' ),
442 442
 				'qtips' => array('Registration_List_Table_Tips'),
443 443
 				'list_table' => 'EE_Registrations_List_Table',
@@ -456,7 +456,7 @@  discard block
 block discarded – undo
456 456
 						: $this->_admin_base_url,
457 457
 					'persistent' => FALSE
458 458
 				),
459
-                'help_tabs' => array(
459
+				'help_tabs' => array(
460 460
 					'registrations_details_help_tab' => array(
461 461
 						'title' => __('Registration Details', 'event_espresso'),
462 462
 						'filename' => 'registrations_details'
@@ -520,7 +520,7 @@  discard block
 block discarded – undo
520 520
 					'order' => 20
521 521
 				),
522 522
 				'list_table' => 'EE_Attendee_Contact_List_Table',
523
-                'help_tabs' => array(
523
+				'help_tabs' => array(
524 524
 					'registrations_contact_list_help_tab' => array(
525 525
 						'title' => __('Registrations Contact List', 'event_espresso'),
526 526
 						'filename' => 'registrations_contact_list'
@@ -537,7 +537,7 @@  discard block
 block discarded – undo
537 537
 						'title' => __('Contact List Other', 'event_espresso'),
538 538
 						'filename' => 'registrations_contact_list_other'
539 539
 					)
540
-                ),
540
+				),
541 541
 				'help_tour' => array( 'Contact_List_Help_Tour' ),
542 542
 				'metaboxes' => array(),
543 543
 				'require_nonce' => FALSE
@@ -571,9 +571,9 @@  discard block
 block discarded – undo
571 571
 
572 572
 	/**
573 573
 	 * 		get list of registration statuses
574
-	*		@access private
575
-	*		@return void
576
-	*/
574
+	 *		@access private
575
+	 *		@return void
576
+	 */
577 577
 	private function _get_registration_status_array() {
578 578
 		self::$_reg_status = EEM_Registration::reg_status_array( array(), TRUE);
579 579
 	}
@@ -861,8 +861,8 @@  discard block
 block discarded – undo
861 861
 
862 862
 
863 863
 	 /**
864
-	 * @throws \EE_Error
865
-	 */
864
+	  * @throws \EE_Error
865
+	  */
866 866
 	protected function _registrations_overview_list_table() {
867 867
 		$this->_template_args['admin_page_header'] = '';
868 868
 		$EVT_ID = ! empty( $this->_req_data['event_id'] ) ? absint( $this->_req_data['event_id'] ) : 0;
@@ -922,7 +922,7 @@  discard block
 block discarded – undo
922 922
 			return TRUE;
923 923
 		}
924 924
 
925
-	    $REG = EEM_Registration::instance();
925
+		$REG = EEM_Registration::instance();
926 926
 
927 927
 		$REG_ID = ( ! empty( $this->_req_data['_REG_ID'] )) ? absint( $this->_req_data['_REG_ID'] ) : FALSE;
928 928
 
@@ -1146,9 +1146,9 @@  discard block
 block discarded – undo
1146 1146
 
1147 1147
 	/**
1148 1148
 	 * 		generates HTML for the View Registration Details Admin page
1149
-	*		@access protected
1150
-	*		@return void
1151
-	*/
1149
+	 *		@access protected
1150
+	 *		@return void
1151
+	 */
1152 1152
 	protected function _registration_details() {
1153 1153
 
1154 1154
 		$this->_template_args = array();
@@ -1414,10 +1414,10 @@  discard block
 block discarded – undo
1414 1414
 
1415 1415
 	/**
1416 1416
 	 * 		approve_registration
1417
-	*		@access protected
1418
-	*		@param bool $notify whether or not to notify the registrant about their approval.
1419
-	*		@return void
1420
-	*/
1417
+	 *		@access protected
1418
+	 *		@param bool $notify whether or not to notify the registrant about their approval.
1419
+	 *		@return void
1420
+	 */
1421 1421
 	protected function approve_registration( $notify = false ) {
1422 1422
 		$this->_reg_status_change_return( EEM_Registration::status_id_approved, $notify );
1423 1423
 	}
@@ -1427,10 +1427,10 @@  discard block
 block discarded – undo
1427 1427
 
1428 1428
 	/**
1429 1429
 	 * 		decline_registration
1430
-	*		@access protected
1431
-	*		@param bool $notify whether or not to notify the registrant about their approval.
1432
-	*		@return void
1433
-	*/
1430
+	 *		@access protected
1431
+	 *		@param bool $notify whether or not to notify the registrant about their approval.
1432
+	 *		@return void
1433
+	 */
1434 1434
 	protected function decline_registration( $notify = false ) {
1435 1435
 		$this->_reg_status_change_return( EEM_Registration::status_id_declined, $notify );
1436 1436
 	}
@@ -1440,10 +1440,10 @@  discard block
 block discarded – undo
1440 1440
 
1441 1441
 	/**
1442 1442
 	 * 		cancel_registration
1443
-	*		@access protected
1444
-	*		@param bool $notify whether or not to notify the registrant about their approval.
1445
-	*		@return void
1446
-	*/
1443
+	 *		@access protected
1444
+	 *		@param bool $notify whether or not to notify the registrant about their approval.
1445
+	 *		@return void
1446
+	 */
1447 1447
 	protected function cancel_registration( $notify = false ) {
1448 1448
 		$this->_reg_status_change_return( EEM_Registration::status_id_cancelled, $notify );
1449 1449
 	}
@@ -1454,10 +1454,10 @@  discard block
 block discarded – undo
1454 1454
 
1455 1455
 	/**
1456 1456
 	 * 		not_approve_registration
1457
-	*		@access protected
1458
-	*		@param bool $notify whether or not to notify the registrant about their approval.
1459
-	*		@return void
1460
-	*/
1457
+	 *		@access protected
1458
+	 *		@param bool $notify whether or not to notify the registrant about their approval.
1459
+	 *		@return void
1460
+	 */
1461 1461
 	protected function not_approve_registration( $notify = false ) {
1462 1462
 		$this->_reg_status_change_return( EEM_Registration::status_id_not_approved, $notify );
1463 1463
 	}
@@ -1466,10 +1466,10 @@  discard block
 block discarded – undo
1466 1466
 
1467 1467
 	/**
1468 1468
 	 * 		decline_registration
1469
-	*		@access protected
1470
-	*		@param bool $notify whether or not to notify the registrant about their approval.
1471
-	*		@return void
1472
-	*/
1469
+	 *		@access protected
1470
+	 *		@param bool $notify whether or not to notify the registrant about their approval.
1471
+	 *		@return void
1472
+	 */
1473 1473
 	protected function pending_registration( $notify = false ) {
1474 1474
 		$this->_reg_status_change_return( EEM_Registration::status_id_pending_payment, $notify );
1475 1475
 	}
@@ -1479,9 +1479,9 @@  discard block
 block discarded – undo
1479 1479
 
1480 1480
 	/**
1481 1481
 	 * 		generates HTML for the Registration main meta box
1482
-	*		@access public
1483
-	*		@return void
1484
-	*/
1482
+	 *		@access public
1483
+	 *		@return void
1484
+	 */
1485 1485
 	public function _reg_details_meta_box() {
1486 1486
 		EEH_Autoloader::register_line_item_display_autoloaders();
1487 1487
 		EEH_Autoloader::register_line_item_filter_autoloaders();
@@ -1518,7 +1518,7 @@  discard block
 block discarded – undo
1518 1518
 			: '';
1519 1519
 
1520 1520
 		$this->_template_args['resend_registration_button'] = $attendee instanceof EE_Attendee
1521
-		                                                      && EE_Registry::instance()->CAP->current_user_can(
1521
+															  && EE_Registry::instance()->CAP->current_user_can(
1522 1522
 			'ee_send_message',
1523 1523
 			'espresso_registrations_resend_registration'
1524 1524
 		)
@@ -1594,7 +1594,7 @@  discard block
 block discarded – undo
1594 1594
 	 *
1595 1595
 	 * @access public
1596 1596
 	 * @return void
1597
-	*/
1597
+	 */
1598 1598
 	public function _reg_questions_meta_box() {
1599 1599
 		//allow someone to override this method entirely
1600 1600
 		if( apply_filters( 'FHEE__Registrations_Admin_Page___reg_questions_meta_box__do_default', true, $this, $this->_registration ) ) {
@@ -1796,12 +1796,12 @@  discard block
 block discarded – undo
1796 1796
 
1797 1797
 	/**
1798 1798
 	 * 		generates HTML for the Registration main meta box
1799
-	*		@access public
1800
-	*		@return void
1801
-	*/
1799
+	 *		@access public
1800
+	 *		@return void
1801
+	 */
1802 1802
 	public function _reg_attendees_meta_box() {
1803 1803
 
1804
-	    $REG = EEM_Registration::instance();
1804
+		$REG = EEM_Registration::instance();
1805 1805
 		//get all other registrations on this transaction, and cache
1806 1806
 		//the attendees for them so we don't have to run another query using force_join
1807 1807
 		$registrations = $REG->get_all(array(
@@ -1853,9 +1853,9 @@  discard block
 block discarded – undo
1853 1853
 
1854 1854
 	/**
1855 1855
 	 * 		generates HTML for the Edit Registration side meta box
1856
-	*		@access public
1857
-	*		@return void
1858
-	*/
1856
+	 *		@access public
1857
+	 *		@return void
1858
+	 */
1859 1859
 	public function _reg_registrant_side_meta_box() {
1860 1860
 
1861 1861
 		/*@var $attendee EE_Attendee */
@@ -2236,9 +2236,9 @@  discard block
 block discarded – undo
2236 2236
 
2237 2237
 	/**
2238 2238
 	 * 		set_reg_event
2239
-	*		@access private
2240
-	*		@return boolean
2241
-	*/
2239
+	 *		@access private
2240
+	 *		@return boolean
2241
+	 */
2242 2242
 	private function _set_reg_event() {
2243 2243
 		if ( is_object( $this->_reg_event )) {
2244 2244
 			return TRUE;
@@ -2378,9 +2378,9 @@  discard block
 block discarded – undo
2378 2378
 
2379 2379
 	/**
2380 2380
 	 * 		generates HTML for the Attendee Contact List
2381
-	*		@access protected
2382
-	*		@return void
2383
-	*/
2381
+	 *		@access protected
2382
+	 *		@return void
2383
+	 */
2384 2384
 	protected function _attendee_contact_list_table() {
2385 2385
 		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
2386 2386
 		$this->_search_btn_label = __('Contacts', 'event_espresso');
@@ -2394,9 +2394,9 @@  discard block
 block discarded – undo
2394 2394
 	/**
2395 2395
 	 * 		get_attendees
2396 2396
 	 * 		@param bool $count whether to return count or data.
2397
-	*		@access public
2398
-	*		@return array
2399
-	*/
2397
+	 *		@access public
2398
+	 *		@return array
2399
+	 */
2400 2400
 	public function get_attendees( $per_page, $count = FALSE, $trash = FALSE ) {
2401 2401
 
2402 2402
 		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
@@ -2728,9 +2728,9 @@  discard block
 block discarded – undo
2728 2728
 
2729 2729
 	/**
2730 2730
 	 * 		_attendee_details
2731
-	*		@access protected
2732
-	*		@return void
2733
-	*/
2731
+	 *		@access protected
2732
+	 *		@return void
2733
+	 */
2734 2734
 	public function attendee_registrations_meta_box( $post ) {
2735 2735
 
2736 2736
 		$this->_template_args['attendee'] = $this->_cpt_model_obj;
@@ -2763,10 +2763,10 @@  discard block
 block discarded – undo
2763 2763
 
2764 2764
 	/**
2765 2765
 	 * 		_trash_or_restore_attendee
2766
-	*		@param boolean 		$trash - whether to move item to trash (TRUE) or restore it (FALSE)
2767
-	*		@access protected
2768
-	*		@return void
2769
-	*/
2766
+	 *		@param boolean 		$trash - whether to move item to trash (TRUE) or restore it (FALSE)
2767
+	 *		@access protected
2768
+	 *		@return void
2769
+	 */
2770 2770
 	protected function _trash_or_restore_attendees( $trash = TRUE ) {
2771 2771
 
2772 2772
 		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
Please login to merge, or discard this patch.
Spacing   +558 added lines, -558 removed lines patch added patch discarded remove patch
@@ -56,26 +56,26 @@  discard block
 block discarded – undo
56 56
 	 * @param bool $routing
57 57
 	 * @return Registrations_Admin_Page
58 58
 	 */
59
-	public function __construct( $routing = TRUE ) {
60
-		parent::__construct( $routing );
61
-		add_action( 'wp_loaded', array( $this, 'wp_loaded' ));
59
+	public function __construct($routing = TRUE) {
60
+		parent::__construct($routing);
61
+		add_action('wp_loaded', array($this, 'wp_loaded'));
62 62
 	}
63 63
 
64 64
 
65 65
 
66 66
 	public function wp_loaded() {
67 67
 		// when adding a new registration...
68
-		if ( isset( $this->_req_data[ 'action' ] ) && $this->_req_data[ 'action' ] == 'new_registration' ) {
68
+		if (isset($this->_req_data['action']) && $this->_req_data['action'] == 'new_registration') {
69 69
 			EE_System::do_not_cache();
70 70
 			if (
71
-				! isset( $this->_req_data[ 'processing_registration' ] )
72
-				|| absint( $this->_req_data[ 'processing_registration' ] ) !== 1
71
+				! isset($this->_req_data['processing_registration'])
72
+				|| absint($this->_req_data['processing_registration']) !== 1
73 73
 			) {
74 74
 				// and it's NOT the attendee information reg step
75 75
 				// force cookie expiration by setting time to last week
76
-				setcookie( 'ee_registration_added', 0, time() - WEEK_IN_SECONDS, '/' );
76
+				setcookie('ee_registration_added', 0, time() - WEEK_IN_SECONDS, '/');
77 77
 				// and update the global
78
-				$_COOKIE[ 'ee_registration_added' ] = 0;
78
+				$_COOKIE['ee_registration_added'] = 0;
79 79
 			}
80 80
 		}
81 81
 	}
@@ -109,16 +109,16 @@  discard block
 block discarded – undo
109 109
 				'trash' => 'post.php'
110 110
 			);
111 111
 
112
-		add_action('edit_form_after_title', array($this, 'after_title_form_fields'), 10 );
112
+		add_action('edit_form_after_title', array($this, 'after_title_form_fields'), 10);
113 113
 		//add filters so that the comment urls don't take users to a confusing 404 page
114
-		add_filter('get_comment_link', array( $this, 'clear_comment_link' ), 10, 3 );
114
+		add_filter('get_comment_link', array($this, 'clear_comment_link'), 10, 3);
115 115
 	}
116 116
 
117 117
 
118
-	public function clear_comment_link( $link, $comment, $args ) {
118
+	public function clear_comment_link($link, $comment, $args) {
119 119
 		//gotta make sure this only happens on this route
120
-		$post_type = get_post_type( $comment->comment_post_ID);
121
-		if ( $post_type == 'espresso_attendees' )
120
+		$post_type = get_post_type($comment->comment_post_ID);
121
+		if ($post_type == 'espresso_attendees')
122 122
 			return '#commentsdiv';
123 123
 		return $link;
124 124
 	}
@@ -126,7 +126,7 @@  discard block
 block discarded – undo
126 126
 
127 127
 	protected function _ajax_hooks() {
128 128
 		//todo: all hooks for registrations ajax goes in here
129
-		add_action( 'wp_ajax_toggle_checkin_status', array( $this, 'toggle_checkin_status' ));
129
+		add_action('wp_ajax_toggle_checkin_status', array($this, 'toggle_checkin_status'));
130 130
 	}
131 131
 
132 132
 
@@ -141,8 +141,8 @@  discard block
 block discarded – undo
141 141
 				'add-attendee' => __('Add Contact', 'event_espresso'),
142 142
 				'edit' => __('Edit Contact', 'event_espresso'),
143 143
 				'report'=>  __("Event Registrations CSV Report", "event_espresso"),
144
-				'report_all' => __( 'All Registrations CSV Report', 'event_espresso' ),
145
-				'contact_list_report' => __( 'Contact List Report', 'event_espresso' ),
144
+				'report_all' => __('All Registrations CSV Report', 'event_espresso'),
145
+				'contact_list_report' => __('Contact List Report', 'event_espresso'),
146 146
 				'contact_list_export'=>  __("Export Data", "event_espresso"),
147 147
 			),
148 148
 			'publishbox' => array(
@@ -170,9 +170,9 @@  discard block
 block discarded – undo
170 170
 
171 171
 		$this->_get_registration_status_array();
172 172
 
173
-		$reg_id = ! empty( $this->_req_data['_REG_ID'] ) && ! is_array( $this->_req_data['_REG_ID'] ) ? $this->_req_data['_REG_ID'] : 0;
174
-		$att_id = ! empty( $this->_req_data[ 'ATT_ID' ] ) && ! is_array( $this->_req_data['ATT_ID'] ) ? $this->_req_data['ATT_ID'] : 0;
175
-		$att_id = ! empty( $this->_req_data['post'] ) && ! is_array( $this->_req_data['post'] ) ? $this->_req_data['post'] : $att_id;
173
+		$reg_id = ! empty($this->_req_data['_REG_ID']) && ! is_array($this->_req_data['_REG_ID']) ? $this->_req_data['_REG_ID'] : 0;
174
+		$att_id = ! empty($this->_req_data['ATT_ID']) && ! is_array($this->_req_data['ATT_ID']) ? $this->_req_data['ATT_ID'] : 0;
175
+		$att_id = ! empty($this->_req_data['post']) && ! is_array($this->_req_data['post']) ? $this->_req_data['post'] : $att_id;
176 176
 
177 177
 		$this->_page_routes = array(
178 178
 
@@ -205,7 +205,7 @@  discard block
 block discarded – undo
205 205
 
206 206
 				'restore_registrations' => array(
207 207
 					'func' => '_trash_or_restore_registrations',
208
-					'args' => array( 'trash' => FALSE ),
208
+					'args' => array('trash' => FALSE),
209 209
 					'noheader' => TRUE,
210 210
 					'capability' => 'ee_delete_registrations'
211 211
 					),
@@ -438,7 +438,7 @@  discard block
 block discarded – undo
438 438
 						'filename' => 'registrations_overview_other'
439 439
 					)
440 440
                 ),
441
-				'help_tour' => array( 'Registration_Overview_Help_Tour' ),
441
+				'help_tour' => array('Registration_Overview_Help_Tour'),
442 442
 				'qtips' => array('Registration_List_Table_Tips'),
443 443
 				'list_table' => 'EE_Registrations_List_Table',
444 444
 				'require_nonce' => FALSE
@@ -450,7 +450,7 @@  discard block
 block discarded – undo
450 450
 					'order' => 15,
451 451
 					'url' => isset($this->_req_data['_REG_ID'])
452 452
 						? add_query_arg(
453
-							array('_REG_ID' => $this->_req_data['_REG_ID'] ),
453
+							array('_REG_ID' => $this->_req_data['_REG_ID']),
454 454
 							$this->_current_page_view_url
455 455
 						)
456 456
 						: $this->_admin_base_url,
@@ -474,8 +474,8 @@  discard block
 block discarded – undo
474 474
 						'filename' => 'registrations_details_registrant_details'
475 475
 					)
476 476
 				),
477
-				'help_tour' => array( 'Registration_Details_Help_Tour' ),
478
-				'metaboxes' => array_merge( $this->_default_espresso_metaboxes, array( '_registration_details_metaboxes' ) ),
477
+				'help_tour' => array('Registration_Details_Help_Tour'),
478
+				'metaboxes' => array_merge($this->_default_espresso_metaboxes, array('_registration_details_metaboxes')),
479 479
 				'require_nonce' => FALSE
480 480
 			),
481 481
 
@@ -499,7 +499,7 @@  discard block
 block discarded – undo
499 499
 					'order' => 15,
500 500
 					'persistent' => FALSE
501 501
 				),
502
-				'metaboxes' => array_merge( $this->_default_espresso_metaboxes, array('_publish_post_box', 'attendee_editor_metaboxes' ) ),
502
+				'metaboxes' => array_merge($this->_default_espresso_metaboxes, array('_publish_post_box', 'attendee_editor_metaboxes')),
503 503
 				'require_nonce' => FALSE
504 504
 			),
505 505
 
@@ -508,7 +508,7 @@  discard block
 block discarded – undo
508 508
 					'label' => __('Edit Contact', 'event_espresso'),
509 509
 					'order' => 15,
510 510
 					'persistent' => FALSE,
511
-					'url' => isset($this->_req_data['ATT_ID']) ? add_query_arg(array('ATT_ID' => $this->_req_data['ATT_ID'] ), $this->_current_page_view_url )  : $this->_admin_base_url
511
+					'url' => isset($this->_req_data['ATT_ID']) ? add_query_arg(array('ATT_ID' => $this->_req_data['ATT_ID']), $this->_current_page_view_url) : $this->_admin_base_url
512 512
 				),
513 513
 				'metaboxes' => array('attendee_editor_metaboxes'),
514 514
 				'require_nonce' => FALSE
@@ -538,7 +538,7 @@  discard block
 block discarded – undo
538 538
 						'filename' => 'registrations_contact_list_other'
539 539
 					)
540 540
                 ),
541
-				'help_tour' => array( 'Contact_List_Help_Tour' ),
541
+				'help_tour' => array('Contact_List_Help_Tour'),
542 542
 				'metaboxes' => array(),
543 543
 				'require_nonce' => FALSE
544 544
 			),
@@ -557,7 +557,7 @@  discard block
 block discarded – undo
557 557
 	protected function _add_screen_options() {}
558 558
 	protected function _add_feature_pointers() {}
559 559
 	public function admin_init() {
560
-		EE_Registry::$i18n_js_strings[ 'update_att_qstns' ] = __( 'click "Update Registration Questions" to save your changes', 'event_espresso' );
560
+		EE_Registry::$i18n_js_strings['update_att_qstns'] = __('click "Update Registration Questions" to save your changes', 'event_espresso');
561 561
 	}
562 562
 	public function admin_notices() {}
563 563
 	public function admin_footer_scripts() {}
@@ -575,7 +575,7 @@  discard block
 block discarded – undo
575 575
 	*		@return void
576 576
 	*/
577 577
 	private function _get_registration_status_array() {
578
-		self::$_reg_status = EEM_Registration::reg_status_array( array(), TRUE);
578
+		self::$_reg_status = EEM_Registration::reg_status_array(array(), TRUE);
579 579
 	}
580 580
 
581 581
 
@@ -598,11 +598,11 @@  discard block
 block discarded – undo
598 598
 	public function load_scripts_styles() {
599 599
 		//style
600 600
 		//wp_register_style('espresso_attendees', ATT_ASSETS_URL . 'espresso_attendees_admin.css', array(), EVENT_ESPRESSO_VERSION );
601
-		wp_register_style('espresso_reg', REG_ASSETS_URL . 'espresso_registrations_admin.css', array('ee-admin-css'), EVENT_ESPRESSO_VERSION );
601
+		wp_register_style('espresso_reg', REG_ASSETS_URL.'espresso_registrations_admin.css', array('ee-admin-css'), EVENT_ESPRESSO_VERSION);
602 602
 		wp_enqueue_style('espresso_reg');
603 603
 
604 604
 		//script
605
-		wp_register_script('espresso_reg', REG_ASSETS_URL . 'espresso_registrations_admin.js', array('jquery-ui-datepicker', 'jquery-ui-draggable', 'ee_admin_js'), EVENT_ESPRESSO_VERSION, TRUE);
605
+		wp_register_script('espresso_reg', REG_ASSETS_URL.'espresso_registrations_admin.js', array('jquery-ui-datepicker', 'jquery-ui-draggable', 'ee_admin_js'), EVENT_ESPRESSO_VERSION, TRUE);
606 606
 		wp_enqueue_script('espresso_reg');
607 607
 	}
608 608
 
@@ -611,9 +611,9 @@  discard block
 block discarded – undo
611 611
 	public function load_scripts_styles_edit_attendee() {
612 612
 		//stuff to only show up on our attendee edit details page.
613 613
 		$attendee_details_translations = array(
614
-			'att_publish_text' => sprintf( __('Created on: <b>%1$s</b>', 'event_espresso'), $this->_cpt_model_obj->get_datetime('ATT_created') )
614
+			'att_publish_text' => sprintf(__('Created on: <b>%1$s</b>', 'event_espresso'), $this->_cpt_model_obj->get_datetime('ATT_created'))
615 615
 			);
616
-		wp_localize_script( 'espresso_reg', 'ATTENDEE_DETAILS', $attendee_details_translations );
616
+		wp_localize_script('espresso_reg', 'ATTENDEE_DETAILS', $attendee_details_translations);
617 617
 		wp_enqueue_script('jquery-validate');
618 618
 	}
619 619
 
@@ -622,8 +622,8 @@  discard block
 block discarded – undo
622 622
 		//styles
623 623
 		wp_enqueue_style('espresso-ui-theme');
624 624
 		//scripts
625
-		$this->_get_reg_custom_questions_form( $this->_registration->ID() );
626
-		$this->_reg_custom_questions_form->wp_enqueue_scripts( true );
625
+		$this->_get_reg_custom_questions_form($this->_registration->ID());
626
+		$this->_reg_custom_questions_form->wp_enqueue_scripts(true);
627 627
 	}
628 628
 
629 629
 
@@ -633,7 +633,7 @@  discard block
 block discarded – undo
633 633
 
634 634
 	public function load_scripts_styles_contact_list() {
635 635
 		wp_deregister_style('espresso_reg');
636
-		wp_register_style('espresso_att', REG_ASSETS_URL . 'espresso_attendees_admin.css', array('ee-admin-css'), EVENT_ESPRESSO_VERSION );
636
+		wp_register_style('espresso_att', REG_ASSETS_URL.'espresso_attendees_admin.css', array('ee-admin-css'), EVENT_ESPRESSO_VERSION);
637 637
 		wp_enqueue_style('espresso_att');
638 638
 	}
639 639
 
@@ -642,9 +642,9 @@  discard block
 block discarded – undo
642 642
 
643 643
 
644 644
 	public function load_scripts_styles_new_registration() {
645
-		wp_register_script( 'ee-spco-for-admin', REG_ASSETS_URL . 'spco_for_admin.js', array('underscore', 'jquery'), EVENT_ESPRESSO_VERSION, TRUE );
645
+		wp_register_script('ee-spco-for-admin', REG_ASSETS_URL.'spco_for_admin.js', array('underscore', 'jquery'), EVENT_ESPRESSO_VERSION, TRUE);
646 646
 		wp_enqueue_script('ee-spco-for-admin');
647
-		add_filter('FHEE__EED_Ticket_Selector__load_tckt_slctr_assets', '__return_true' );
647
+		add_filter('FHEE__EED_Ticket_Selector__load_tckt_slctr_assets', '__return_true');
648 648
 		EE_Form_Section_Proper::wp_enqueue_scripts();
649 649
 		EED_Ticket_Selector::load_tckt_slctr_assets();
650 650
 		EE_Datepicker_Input::enqueue_styles_and_scripts();
@@ -671,7 +671,7 @@  discard block
 block discarded – undo
671 671
 		//for notification related bulk actions we need to make sure only active messengers have an option.
672 672
 		EED_Messages::set_autoloaders();
673 673
 		/** @type EE_Message_Resource_Manager $message_resource_manager */
674
-		$message_resource_manager = EE_Registry::instance()->load_lib( 'Message_Resource_Manager' );
674
+		$message_resource_manager = EE_Registry::instance()->load_lib('Message_Resource_Manager');
675 675
 		$active_mts = $message_resource_manager->list_of_active_message_types();
676 676
 		//key= bulk_action_slug, value= message type.
677 677
 		$match_array = array(
@@ -684,23 +684,23 @@  discard block
 block discarded – undo
684 684
 
685 685
 		/** setup reg status bulk actions **/
686 686
 		$def_reg_status_actions['approve_registration'] = __('Approve Registrations', 'event_espresso');
687
-		if ( in_array( $match_array['approve_registration'], $active_mts ) && EE_Registry::instance()->CAP->current_user_can( 'ee_send_message', 'batch_send_messages' ) ) {
687
+		if (in_array($match_array['approve_registration'], $active_mts) && EE_Registry::instance()->CAP->current_user_can('ee_send_message', 'batch_send_messages')) {
688 688
 			$def_reg_status_actions['approve_and_notify_registration'] = __('Approve and Notify Registrations', 'event_espresso');
689 689
 		}
690 690
 		$def_reg_status_actions['decline_registration'] = __('Decline Registrations', 'event_espresso');
691
-		if ( in_array( $match_array['decline_registration'], $active_mts ) && EE_Registry::instance()->CAP->current_user_can( 'ee_send_message', 'batch_send_messages' ) ) {
691
+		if (in_array($match_array['decline_registration'], $active_mts) && EE_Registry::instance()->CAP->current_user_can('ee_send_message', 'batch_send_messages')) {
692 692
 			$def_reg_status_actions['decline_and_notify_registration'] = __('Decline and Notify Registrations', 'event_espresso');
693 693
 		}
694 694
 		$def_reg_status_actions['pending_registration'] = __('Set Registrations to Pending Payment', 'event_espresso');
695
-		if ( in_array( $match_array['pending_registration'], $active_mts ) && EE_Registry::instance()->CAP->current_user_can( 'ee_send_message', 'batch_send_messages' ) ) {
695
+		if (in_array($match_array['pending_registration'], $active_mts) && EE_Registry::instance()->CAP->current_user_can('ee_send_message', 'batch_send_messages')) {
696 696
 			$def_reg_status_actions['pending_and_notify_registration'] = __('Set Registrations to Pending Payment and Notify', 'event_espresso');
697 697
 		}
698 698
 		$def_reg_status_actions['no_approve_registration'] = __('Set Registrations to Not Approved', 'event_espresso');
699
-		if ( in_array( $match_array['no_approve_registration'], $active_mts ) && EE_Registry::instance()->CAP->current_user_can( 'ee_send_message', 'batch_send_messages' ) ) {
699
+		if (in_array($match_array['no_approve_registration'], $active_mts) && EE_Registry::instance()->CAP->current_user_can('ee_send_message', 'batch_send_messages')) {
700 700
 			$def_reg_status_actions['no_approve_and_notify_registration'] = __('Set Registrations to Not Approved and Notify', 'event_espresso');
701 701
 		}
702 702
 		$def_reg_status_actions['cancel_registration'] = __('Cancel Registrations', 'event_espresso');
703
-		if ( in_array( $match_array['cancel_registration'], $active_mts ) && EE_Registry::instance()->CAP->current_user_can( 'ee_send_message', 'batch_send_messages' ) ) {
703
+		if (in_array($match_array['cancel_registration'], $active_mts) && EE_Registry::instance()->CAP->current_user_can('ee_send_message', 'batch_send_messages')) {
704 704
 			$def_reg_status_actions['cancel_and_notify_registration'] = __('Cancel Registrations and Notify', 'event_espresso');
705 705
 		}
706 706
 
@@ -709,29 +709,29 @@  discard block
 block discarded – undo
709 709
 				'slug' => 'all',
710 710
 				'label' => __('View All Registrations', 'event_espresso'),
711 711
 				'count' => 0,
712
-				'bulk_action' => array_merge( $def_reg_status_actions, array(
712
+				'bulk_action' => array_merge($def_reg_status_actions, array(
713 713
 					'trash_registrations' => __('Trash Registrations', 'event_espresso')
714
-					) )
714
+					))
715 715
 				),
716 716
 			'month' => array(
717 717
 				'slug' => 'month',
718 718
 				'label' => __('This Month', 'event_espresso'),
719 719
 				'count' => 0,
720
-				'bulk_action' => array_merge( $def_reg_status_actions, array(
720
+				'bulk_action' => array_merge($def_reg_status_actions, array(
721 721
 					'trash_registrations' => __('Trash Registrations', 'event_espresso')
722 722
 					))
723 723
 				),
724 724
 			'today' => array(
725 725
 				'slug' => 'today',
726
-				'label' => sprintf( __('Today - %s', 'event_espresso'), date('M d, Y', current_time('timestamp' ) ) ),
726
+				'label' => sprintf(__('Today - %s', 'event_espresso'), date('M d, Y', current_time('timestamp'))),
727 727
 				'count' => 0,
728
-				'bulk_action' => array_merge( $def_reg_status_actions,  array(
728
+				'bulk_action' => array_merge($def_reg_status_actions, array(
729 729
 					'trash_registrations' => __('Trash Registrations', 'event_espresso')
730 730
 					))
731 731
 				)
732 732
 			);
733 733
 
734
-		if ( EE_Registry::instance()->CAP->current_user_can( 'ee_delete_registrations', 'espresso_registrations_delete_registration' ) ) {
734
+		if (EE_Registry::instance()->CAP->current_user_can('ee_delete_registrations', 'espresso_registrations_delete_registration')) {
735 735
 			$this->_views['incomplete'] = array(
736 736
 				'slug' => 'incomplete',
737 737
 				'label' => __('Incomplete', 'event_espresso'),
@@ -767,7 +767,7 @@  discard block
 block discarded – undo
767 767
 				)
768 768
 			);
769 769
 
770
-		if ( EE_Registry::instance()->CAP->current_user_can( 'ee_delete_contacts', 'espresso_registrations_trash_attendees' ) ) {
770
+		if (EE_Registry::instance()->CAP->current_user_can('ee_delete_contacts', 'espresso_registrations_trash_attendees')) {
771 771
 			$this->_views['trash'] = array(
772 772
 				'slug' => 'trash',
773 773
 				'label' => __('Trash', 'event_espresso'),
@@ -806,18 +806,18 @@  discard block
 block discarded – undo
806 806
 				'desc' => __('View Transaction Invoice', 'event_espresso')
807 807
 				),
808 808
  			);
809
-		if ( EE_Registry::instance()->CAP->current_user_can( 'ee_send_message', 'espresso_registrations_resend_registration' ) ) {
809
+		if (EE_Registry::instance()->CAP->current_user_can('ee_send_message', 'espresso_registrations_resend_registration')) {
810 810
 			$fc_items['resend_registration'] = array(
811 811
 				'class' => 'dashicons dashicons-email-alt',
812 812
 				'desc' => __('Resend Registration Details', 'event_espresso')
813 813
 				);
814 814
 		} else {
815
-			$fc_items['blank'] = array( 'class' => 'blank', 'desc' => '' );
815
+			$fc_items['blank'] = array('class' => 'blank', 'desc' => '');
816 816
 		}
817 817
 
818
-		if ( EE_Registry::instance()->CAP->current_user_can( 'ee_read_global_messages', 'view_filtered_messages' ) ) {
819
-			$related_for_icon = EEH_MSG_Template::get_message_action_icon( 'see_notifications_for' );
820
-			if ( isset( $related_for_icon['css_class']) && isset( $related_for_icon['label'] ) ) {
818
+		if (EE_Registry::instance()->CAP->current_user_can('ee_read_global_messages', 'view_filtered_messages')) {
819
+			$related_for_icon = EEH_MSG_Template::get_message_action_icon('see_notifications_for');
820
+			if (isset($related_for_icon['css_class']) && isset($related_for_icon['label'])) {
821 821
 				$fc_items['view_related_messages'] = array(
822 822
 					'class' => $related_for_icon['css_class'],
823 823
 					'desc' => $related_for_icon['label'],
@@ -827,31 +827,31 @@  discard block
 block discarded – undo
827 827
 
828 828
 		$sc_items = array(
829 829
 			'approved_status' => array(
830
-				'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_approved,
831
-				'desc' => EEH_Template::pretty_status( EEM_Registration::status_id_approved, FALSE, 'sentence' )
830
+				'class' => 'ee-status-legend ee-status-legend-'.EEM_Registration::status_id_approved,
831
+				'desc' => EEH_Template::pretty_status(EEM_Registration::status_id_approved, FALSE, 'sentence')
832 832
 				),
833 833
 			'pending_status' => array(
834
-				'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_pending_payment,
835
-				'desc' => EEH_Template::pretty_status( EEM_Registration::status_id_pending_payment, FALSE, 'sentence' )
834
+				'class' => 'ee-status-legend ee-status-legend-'.EEM_Registration::status_id_pending_payment,
835
+				'desc' => EEH_Template::pretty_status(EEM_Registration::status_id_pending_payment, FALSE, 'sentence')
836 836
 				),
837 837
 			'incomplete_status' => array(
838
-				'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_incomplete,
839
-				'desc' => EEH_Template::pretty_status( EEM_Registration::status_id_incomplete, FALSE, 'sentence' )
838
+				'class' => 'ee-status-legend ee-status-legend-'.EEM_Registration::status_id_incomplete,
839
+				'desc' => EEH_Template::pretty_status(EEM_Registration::status_id_incomplete, FALSE, 'sentence')
840 840
 			),
841 841
 			'not_approved' => array(
842
-				'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_not_approved,
843
-				'desc' => EEH_Template::pretty_status( EEM_Registration::status_id_not_approved, FALSE, 'sentence' )
842
+				'class' => 'ee-status-legend ee-status-legend-'.EEM_Registration::status_id_not_approved,
843
+				'desc' => EEH_Template::pretty_status(EEM_Registration::status_id_not_approved, FALSE, 'sentence')
844 844
 				),
845 845
 			'declined_status' => array(
846
-				'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_declined,
847
-				'desc' => EEH_Template::pretty_status( EEM_Registration::status_id_declined, FALSE, 'sentence' )
846
+				'class' => 'ee-status-legend ee-status-legend-'.EEM_Registration::status_id_declined,
847
+				'desc' => EEH_Template::pretty_status(EEM_Registration::status_id_declined, FALSE, 'sentence')
848 848
 				),
849 849
 			'cancelled_status' => array(
850
-				'class' => 'ee-status-legend ee-status-legend-' . EEM_Registration::status_id_cancelled,
851
-				'desc' => EEH_Template::pretty_status( EEM_Registration::status_id_cancelled, FALSE, 'sentence' )
850
+				'class' => 'ee-status-legend ee-status-legend-'.EEM_Registration::status_id_cancelled,
851
+				'desc' => EEH_Template::pretty_status(EEM_Registration::status_id_cancelled, FALSE, 'sentence')
852 852
 				)
853 853
 			);
854
-		return array_merge( $fc_items, $sc_items );
854
+		return array_merge($fc_items, $sc_items);
855 855
 	}
856 856
 
857 857
 
@@ -865,9 +865,9 @@  discard block
 block discarded – undo
865 865
 	 */
866 866
 	protected function _registrations_overview_list_table() {
867 867
 		$this->_template_args['admin_page_header'] = '';
868
-		$EVT_ID = ! empty( $this->_req_data['event_id'] ) ? absint( $this->_req_data['event_id'] ) : 0;
869
-		if ( $EVT_ID ) {
870
-			if ( EE_Registry::instance()->CAP->current_user_can(
868
+		$EVT_ID = ! empty($this->_req_data['event_id']) ? absint($this->_req_data['event_id']) : 0;
869
+		if ($EVT_ID) {
870
+			if (EE_Registry::instance()->CAP->current_user_can(
871 871
 				'ee_edit_registrations',
872 872
 				'espresso_registrations_new_registration',
873 873
 				$EVT_ID
@@ -876,34 +876,34 @@  discard block
 block discarded – undo
876 876
 				$this->_admin_page_title .= $this->get_action_link_or_button(
877 877
 					'new_registration',
878 878
 					'add-registrant',
879
-					array( 'event_id' => $EVT_ID ),
879
+					array('event_id' => $EVT_ID),
880 880
 					'add-new-h2'
881 881
 				);
882 882
 			}
883
-			$event = EEM_Event::instance()->get_one_by_ID( $EVT_ID );
884
-			if ( $event instanceof EE_Event ) {
883
+			$event = EEM_Event::instance()->get_one_by_ID($EVT_ID);
884
+			if ($event instanceof EE_Event) {
885 885
 				$this->_template_args['admin_page_header'] = sprintf(
886
-					__( '%s Viewing registrations for the event: %s%s', 'event_espresso' ),
886
+					__('%s Viewing registrations for the event: %s%s', 'event_espresso'),
887 887
 					'<h3 style="line-height:1.5em;">',
888
-					'<br /><a href="' . EE_Admin_Page::add_query_args_and_nonce(
889
-						array( 'action' => 'edit', 'post' => $event->ID() ),
888
+					'<br /><a href="'.EE_Admin_Page::add_query_args_and_nonce(
889
+						array('action' => 'edit', 'post' => $event->ID()),
890 890
 						EVENTS_ADMIN_URL
891
-					) . '">&nbsp;' . $event->get( 'EVT_name' ) . '&nbsp;</a>&nbsp;',
891
+					).'">&nbsp;'.$event->get('EVT_name').'&nbsp;</a>&nbsp;',
892 892
 					'</h3>'
893 893
 				);
894 894
 			}
895
-			$DTT_ID = ! empty( $this->_req_data['datetime_id'] ) ? absint( $this->_req_data['datetime_id'] ) : 0;
896
-			$datetime = EEM_Datetime::instance()->get_one_by_ID( $DTT_ID );
897
-			if ( $datetime instanceof EE_Datetime && $this->_template_args['admin_page_header'] !== '' ) {
898
-				$this->_template_args['admin_page_header'] = substr( $this->_template_args['admin_page_header'], 0, -5 );
895
+			$DTT_ID = ! empty($this->_req_data['datetime_id']) ? absint($this->_req_data['datetime_id']) : 0;
896
+			$datetime = EEM_Datetime::instance()->get_one_by_ID($DTT_ID);
897
+			if ($datetime instanceof EE_Datetime && $this->_template_args['admin_page_header'] !== '') {
898
+				$this->_template_args['admin_page_header'] = substr($this->_template_args['admin_page_header'], 0, -5);
899 899
 				$this->_template_args['admin_page_header'] .= ' &nbsp;<span class="drk-grey-text">';
900 900
 				$this->_template_args['admin_page_header'] .= '<span class="dashicons dashicons-calendar"></span>';
901 901
 				$this->_template_args['admin_page_header'] .= $datetime->name();
902
-				$this->_template_args['admin_page_header'] .= ' ( ' . $datetime->start_date() . ' )';
902
+				$this->_template_args['admin_page_header'] .= ' ( '.$datetime->start_date().' )';
903 903
 				$this->_template_args['admin_page_header'] .= '</span></h3>';
904 904
 			}
905 905
 		}
906
-		$this->_template_args['after_list_table'] = $this->_display_legend( $this->_registration_legend_items() );
906
+		$this->_template_args['after_list_table'] = $this->_display_legend($this->_registration_legend_items());
907 907
 		$this->display_admin_list_table_page_with_no_sidebar();
908 908
 	}
909 909
 
@@ -918,19 +918,19 @@  discard block
 block discarded – undo
918 918
 	 */
919 919
 	private function _set_registration_object() {
920 920
 		//get out if we've already set the object
921
-		if ( is_object( $this->_registration )) {
921
+		if (is_object($this->_registration)) {
922 922
 			return TRUE;
923 923
 		}
924 924
 
925 925
 	    $REG = EEM_Registration::instance();
926 926
 
927
-		$REG_ID = ( ! empty( $this->_req_data['_REG_ID'] )) ? absint( $this->_req_data['_REG_ID'] ) : FALSE;
927
+		$REG_ID = ( ! empty($this->_req_data['_REG_ID'])) ? absint($this->_req_data['_REG_ID']) : FALSE;
928 928
 
929
-		if ( $this->_registration = $REG->get_one_by_ID( $REG_ID ))
929
+		if ($this->_registration = $REG->get_one_by_ID($REG_ID))
930 930
 			return TRUE;
931 931
 		else {
932
-			$error_msg = sprintf( __('An error occurred and the details for Registration ID #%s could not be retrieved.', 'event_espresso'), $REG_ID );
933
-			EE_Error::add_error( $error_msg, __FILE__, __FUNCTION__, __LINE__ );
932
+			$error_msg = sprintf(__('An error occurred and the details for Registration ID #%s could not be retrieved.', 'event_espresso'), $REG_ID);
933
+			EE_Error::add_error($error_msg, __FILE__, __FUNCTION__, __LINE__);
934 934
 			$this->_registration = NULL;
935 935
 			return FALSE;
936 936
 		}
@@ -948,25 +948,25 @@  discard block
 block discarded – undo
948 948
 	 * @throws \EE_Error
949 949
 	 * @return mixed (int|array)  int = count || array of registration objects
950 950
 	 */
951
-	public function get_registrations( $per_page = 10, $count = FALSE, $this_month = FALSE, $today = FALSE ) {
952
-		$EVT_ID = ! empty( $this->_req_data['event_id'] ) && $this->_req_data['event_id'] > 0 ? absint( $this->_req_data['event_id'] ) : FALSE;
953
-		$CAT_ID = ! empty( $this->_req_data['EVT_CAT'] ) && (int) $this->_req_data['EVT_CAT'] > 0? absint( $this->_req_data['EVT_CAT'] ) : FALSE;
954
-		$DTT_ID = isset( $this->_req_data['datetime_id'] ) ? absint( $this->_req_data['datetime_id'] ) : null;
955
-		$reg_status = ! empty( $this->_req_data['_reg_status'] ) ? sanitize_text_field( $this->_req_data['_reg_status'] ) : FALSE;
956
-		$month_range = ! empty( $this->_req_data['month_range'] ) ? sanitize_text_field( $this->_req_data['month_range'] ) : FALSE;//should be like 2013-april
957
-		$today_a = ! empty( $this->_req_data['status'] ) && $this->_req_data['status'] === 'today' ? TRUE : FALSE;
958
-		$this_month_a = ! empty( $this->_req_data['status'] ) && $this->_req_data['status'] === 'month' ? TRUE  : FALSE;
951
+	public function get_registrations($per_page = 10, $count = FALSE, $this_month = FALSE, $today = FALSE) {
952
+		$EVT_ID = ! empty($this->_req_data['event_id']) && $this->_req_data['event_id'] > 0 ? absint($this->_req_data['event_id']) : FALSE;
953
+		$CAT_ID = ! empty($this->_req_data['EVT_CAT']) && (int) $this->_req_data['EVT_CAT'] > 0 ? absint($this->_req_data['EVT_CAT']) : FALSE;
954
+		$DTT_ID = isset($this->_req_data['datetime_id']) ? absint($this->_req_data['datetime_id']) : null;
955
+		$reg_status = ! empty($this->_req_data['_reg_status']) ? sanitize_text_field($this->_req_data['_reg_status']) : FALSE;
956
+		$month_range = ! empty($this->_req_data['month_range']) ? sanitize_text_field($this->_req_data['month_range']) : FALSE; //should be like 2013-april
957
+		$today_a = ! empty($this->_req_data['status']) && $this->_req_data['status'] === 'today' ? TRUE : FALSE;
958
+		$this_month_a = ! empty($this->_req_data['status']) && $this->_req_data['status'] === 'month' ? TRUE : FALSE;
959 959
 		$start_date = FALSE;
960 960
 		$end_date = FALSE;
961 961
 		$_where = array();
962
-		$trash = ! empty( $this->_req_data['status'] ) && $this->_req_data['status'] === 'trash' ? TRUE : FALSE;
963
-		$incomplete = ! empty( $this->_req_data['status'] ) && $this->_req_data['status'] === 'incomplete' ? TRUE : FALSE;
962
+		$trash = ! empty($this->_req_data['status']) && $this->_req_data['status'] === 'trash' ? TRUE : FALSE;
963
+		$incomplete = ! empty($this->_req_data['status']) && $this->_req_data['status'] === 'incomplete' ? TRUE : FALSE;
964 964
 
965 965
 		//set orderby
966 966
 		$this->_req_data['orderby'] = ! empty($this->_req_data['orderby']) ? $this->_req_data['orderby'] : '';
967 967
 
968 968
 
969
-		switch ( $this->_req_data['orderby'] ) {
969
+		switch ($this->_req_data['orderby']) {
970 970
 			case '_REG_ID':
971 971
 				$orderby = 'REG_ID';
972 972
 				break;
@@ -986,30 +986,30 @@  discard block
 block discarded – undo
986 986
 				$orderby = 'REG_date';
987 987
 		}
988 988
 
989
-		$sort = ( isset( $this->_req_data['order'] ) && ! empty( $this->_req_data['order'] )) ? $this->_req_data['order'] : 'DESC';
990
-		$current_page = isset( $this->_req_data['paged'] ) && !empty( $this->_req_data['paged'] ) ? $this->_req_data['paged'] : 1;
991
-		$per_page = isset( $this->_req_data['perpage'] ) && !empty( $this->_req_data['perpage'] ) ? $this->_req_data['perpage'] : $per_page;
989
+		$sort = (isset($this->_req_data['order']) && ! empty($this->_req_data['order'])) ? $this->_req_data['order'] : 'DESC';
990
+		$current_page = isset($this->_req_data['paged']) && ! empty($this->_req_data['paged']) ? $this->_req_data['paged'] : 1;
991
+		$per_page = isset($this->_req_data['perpage']) && ! empty($this->_req_data['perpage']) ? $this->_req_data['perpage'] : $per_page;
992 992
 
993 993
 
994
-		$offset = ($current_page-1)*$per_page;
995
-		$limit = $count  ? NULL : array( $offset, $per_page );
994
+		$offset = ($current_page - 1) * $per_page;
995
+		$limit = $count ? NULL : array($offset, $per_page);
996 996
 
997
-		if($EVT_ID){
998
-			$_where['EVT_ID']=$EVT_ID;
997
+		if ($EVT_ID) {
998
+			$_where['EVT_ID'] = $EVT_ID;
999 999
 		}
1000
-		if($CAT_ID){
1000
+		if ($CAT_ID) {
1001 1001
 			$_where['Event.Term_Taxonomy.term_id'] = $CAT_ID;
1002 1002
 		}
1003 1003
 		//if DTT is included we filter by that datetime.
1004
-		if ( $DTT_ID ) {
1004
+		if ($DTT_ID) {
1005 1005
 			$_where['Ticket.Datetime.DTT_ID'] = $DTT_ID;
1006 1006
 		}
1007
-		if ( $incomplete ) {
1007
+		if ($incomplete) {
1008 1008
 			$_where['STS_ID'] = EEM_Registration::status_id_incomplete;
1009 1009
 		} else if ( ! $trash) {
1010
-			$_where['STS_ID'] = array( '!=', EEM_Registration::status_id_incomplete );
1010
+			$_where['STS_ID'] = array('!=', EEM_Registration::status_id_incomplete);
1011 1011
 		}
1012
-		if($reg_status){
1012
+		if ($reg_status) {
1013 1013
 			$_where['STS_ID'] = $reg_status;
1014 1014
 		}
1015 1015
 
@@ -1021,103 +1021,103 @@  discard block
 block discarded – undo
1021 1021
 		$time_start = ' 00:00:00';
1022 1022
 		$time_end = ' 23:59:59';
1023 1023
 
1024
-		if($today_a || $today ){
1024
+		if ($today_a || $today) {
1025 1025
 			$curdate = date('Y-m-d', current_time('timestamp'));
1026
-			$_where['REG_date']= array('BETWEEN',
1026
+			$_where['REG_date'] = array('BETWEEN',
1027 1027
 				array(
1028
-					EEM_Registration::instance()->convert_datetime_for_query( 'REG_date', $curdate . $time_start, 'Y-m-d H:i:s' ),
1029
-					EEM_Registration::instance()->convert_datetime_for_query( 'REG_date', $curdate . $time_end, 'Y-m-d H:i:s' ),
1028
+					EEM_Registration::instance()->convert_datetime_for_query('REG_date', $curdate.$time_start, 'Y-m-d H:i:s'),
1029
+					EEM_Registration::instance()->convert_datetime_for_query('REG_date', $curdate.$time_end, 'Y-m-d H:i:s'),
1030 1030
 			));
1031
-		}elseif($this_month_a || $this_month){
1031
+		}elseif ($this_month_a || $this_month) {
1032 1032
 			$this_month_r = date('m', current_time('timestamp'));
1033
-			$days_this_month = date( 't', current_time('timestamp') );
1034
-			$_where['REG_date']= array('BETWEEN',
1033
+			$days_this_month = date('t', current_time('timestamp'));
1034
+			$_where['REG_date'] = array('BETWEEN',
1035 1035
 				array(
1036
-					EEM_Registration::instance()->convert_datetime_for_query( 'REG_date', $this_year_r . '-' . $this_month_r . '-01' . ' ' . $time_start, 'Y-m-d H:i:s' ),
1037
-					EEM_Registration::instance()->convert_datetime_for_query( 'REG_date', $this_year_r . '-' . $this_month_r . '-' . $days_this_month . ' ' . $time_end, 'Y-m-d H:i:s' )
1036
+					EEM_Registration::instance()->convert_datetime_for_query('REG_date', $this_year_r.'-'.$this_month_r.'-01'.' '.$time_start, 'Y-m-d H:i:s'),
1037
+					EEM_Registration::instance()->convert_datetime_for_query('REG_date', $this_year_r.'-'.$this_month_r.'-'.$days_this_month.' '.$time_end, 'Y-m-d H:i:s')
1038 1038
 			));
1039
-		}elseif($month_range){
1039
+		}elseif ($month_range) {
1040 1040
 			$pieces = explode(' ', $this->_req_data['month_range'], 3);
1041
-			$month_r = !empty($pieces[0]) ? date('m', strtotime( $month_range ) ) : '';
1042
-			$year_r = !empty($pieces[1]) ? $pieces[1] : '';
1043
-			$days_in_month = date('t', strtotime($year_r .  '-' . $month_r . '-' . '01') );
1044
-			$_where['REG_date']= array('BETWEEN',
1045
-				array(  EEM_Registration::instance()->convert_datetime_for_query( 'REG_date', $year_r . '-' . $month_r . '-01 00:00:00', 'Y-m-d H:i:s'), EEM_Registration::instance()->convert_datetime_for_query( 'REG_date', $year_r . '-' . $month_r . '-' . $days_in_month .  ' 23:59:59', 'Y-m-d H:i:s' ) ) );
1046
-		}elseif($start_date && $end_date){
1041
+			$month_r = ! empty($pieces[0]) ? date('m', strtotime($month_range)) : '';
1042
+			$year_r = ! empty($pieces[1]) ? $pieces[1] : '';
1043
+			$days_in_month = date('t', strtotime($year_r.'-'.$month_r.'-'.'01'));
1044
+			$_where['REG_date'] = array('BETWEEN',
1045
+				array(EEM_Registration::instance()->convert_datetime_for_query('REG_date', $year_r.'-'.$month_r.'-01 00:00:00', 'Y-m-d H:i:s'), EEM_Registration::instance()->convert_datetime_for_query('REG_date', $year_r.'-'.$month_r.'-'.$days_in_month.' 23:59:59', 'Y-m-d H:i:s')));
1046
+		}elseif ($start_date && $end_date) {
1047 1047
 			throw new EE_Error("not yet supported");
1048
-		}elseif($start_date){
1048
+		}elseif ($start_date) {
1049 1049
 			throw new EE_Error("not yet supported");
1050
-		}elseif($end_date){
1050
+		}elseif ($end_date) {
1051 1051
 			throw new EE_Error("not yet supported");
1052 1052
 		}
1053 1053
 
1054
-		if ( ! empty( $this->_req_data['s'] ) ) {
1055
-			$sstr = '%' . $this->_req_data['s'] . '%';
1054
+		if ( ! empty($this->_req_data['s'])) {
1055
+			$sstr = '%'.$this->_req_data['s'].'%';
1056 1056
 			$_where['OR'] = array(
1057
-				'Event.EVT_name' => array( 'LIKE', $sstr),
1058
-				'Event.EVT_desc' => array( 'LIKE', $sstr ),
1059
-				'Event.EVT_short_desc' => array( 'LIKE' , $sstr ),
1060
-				'Attendee.ATT_full_name' => array( 'LIKE', $sstr ),
1061
-				'Attendee.ATT_fname' => array( 'LIKE', $sstr ),
1062
-				'Attendee.ATT_lname' => array( 'LIKE', $sstr ),
1063
-				'Attendee.ATT_short_bio' => array( 'LIKE', $sstr ),
1064
-				'Attendee.ATT_email' => array('LIKE', $sstr ),
1065
-				'Attendee.ATT_address' => array( 'LIKE', $sstr ),
1066
-				'Attendee.ATT_address2' => array( 'LIKE', $sstr ),
1067
-				'Attendee.ATT_city' => array( 'LIKE', $sstr ),
1068
-				'REG_final_price' => array( 'LIKE', $sstr ),
1069
-				'REG_code' => array( 'LIKE', $sstr ),
1070
-				'REG_count' => array( 'LIKE' , $sstr ),
1071
-				'REG_group_size' => array( 'LIKE' , $sstr ),
1072
-				'Ticket.TKT_name' => array( 'LIKE', $sstr ),
1073
-				'Ticket.TKT_description' => array( 'LIKE', $sstr ),
1074
-				'Transaction.Payment.PAY_txn_id_chq_nmbr' => array( 'LIKE', $sstr )
1057
+				'Event.EVT_name' => array('LIKE', $sstr),
1058
+				'Event.EVT_desc' => array('LIKE', $sstr),
1059
+				'Event.EVT_short_desc' => array('LIKE', $sstr),
1060
+				'Attendee.ATT_full_name' => array('LIKE', $sstr),
1061
+				'Attendee.ATT_fname' => array('LIKE', $sstr),
1062
+				'Attendee.ATT_lname' => array('LIKE', $sstr),
1063
+				'Attendee.ATT_short_bio' => array('LIKE', $sstr),
1064
+				'Attendee.ATT_email' => array('LIKE', $sstr),
1065
+				'Attendee.ATT_address' => array('LIKE', $sstr),
1066
+				'Attendee.ATT_address2' => array('LIKE', $sstr),
1067
+				'Attendee.ATT_city' => array('LIKE', $sstr),
1068
+				'REG_final_price' => array('LIKE', $sstr),
1069
+				'REG_code' => array('LIKE', $sstr),
1070
+				'REG_count' => array('LIKE', $sstr),
1071
+				'REG_group_size' => array('LIKE', $sstr),
1072
+				'Ticket.TKT_name' => array('LIKE', $sstr),
1073
+				'Ticket.TKT_description' => array('LIKE', $sstr),
1074
+				'Transaction.Payment.PAY_txn_id_chq_nmbr' => array('LIKE', $sstr)
1075 1075
 			);
1076 1076
 		}
1077 1077
 
1078 1078
 		//capability checks
1079
-		if ( ! EE_Registry::instance()->CAP->current_user_can('ee_read_others_registrations', 'get_registrations' ) ) {
1079
+		if ( ! EE_Registry::instance()->CAP->current_user_can('ee_read_others_registrations', 'get_registrations')) {
1080 1080
 			$_where['AND'] = array(
1081 1081
 				'Event.EVT_wp_user' => get_current_user_id()
1082 1082
 				);
1083 1083
 		}
1084 1084
 
1085
-		if( $count ){
1086
-			if ( $trash ) {
1087
-				return EEM_Registration::instance()->count_deleted( array( $_where ));
1088
-			} else if ( $incomplete ) {
1089
-				return EEM_Registration::instance()->count( array( $_where ));
1085
+		if ($count) {
1086
+			if ($trash) {
1087
+				return EEM_Registration::instance()->count_deleted(array($_where));
1088
+			} else if ($incomplete) {
1089
+				return EEM_Registration::instance()->count(array($_where));
1090 1090
 			} else {
1091
-				return EEM_Registration::instance()->count( array( $_where, 'default_where_conditions' => 'this_model_only' ));
1091
+				return EEM_Registration::instance()->count(array($_where, 'default_where_conditions' => 'this_model_only'));
1092 1092
 			}
1093 1093
 		} else {
1094 1094
 			//make sure we remove default where conditions cause all registrations matching query are returned
1095
-			$query_params = array( $_where, 'order_by' => array( $orderby => $sort ), 'default_where_conditions' => 'this_model_only' );
1096
-			if ( $per_page !== -1 ) {
1095
+			$query_params = array($_where, 'order_by' => array($orderby => $sort), 'default_where_conditions' => 'this_model_only');
1096
+			if ($per_page !== -1) {
1097 1097
 				$query_params['limit'] = $limit;
1098 1098
 			}
1099
-			$registrations =  $trash ? EEM_Registration::instance()->get_all_deleted($query_params) : EEM_Registration::instance()->get_all($query_params);
1099
+			$registrations = $trash ? EEM_Registration::instance()->get_all_deleted($query_params) : EEM_Registration::instance()->get_all($query_params);
1100 1100
 
1101
-			if ( $EVT_ID && isset( $registrations[0] ) && $registrations[0] instanceof EE_Registration &&  $registrations[0]->event_obj()) {
1101
+			if ($EVT_ID && isset($registrations[0]) && $registrations[0] instanceof EE_Registration && $registrations[0]->event_obj()) {
1102 1102
 				$first_registration = $registrations[0];
1103 1103
 				//EEH_Debug_Tools::printr( $registrations[0], '$registrations  <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' );
1104 1104
 				$event_name = $first_registration->event_obj()->name();
1105
-				$event_date = $first_registration->date_obj()->start_date_and_time('l F j, Y,', 'g:i:s a');// isset( $registrations[0]->DTT_EVT_start ) ? date( 'l F j, Y,    g:i:s a', $registrations[0]->DTT_EVT_start ) : '';
1105
+				$event_date = $first_registration->date_obj()->start_date_and_time('l F j, Y,', 'g:i:s a'); // isset( $registrations[0]->DTT_EVT_start ) ? date( 'l F j, Y,    g:i:s a', $registrations[0]->DTT_EVT_start ) : '';
1106 1106
 				// edit event link
1107
-				if ( $event_name != '' ) {
1108
-					$edit_event_url = self::add_query_args_and_nonce( array( 'action'=>'edit_event', 'EVT_ID'=>$EVT_ID ), EVENTS_ADMIN_URL );
1109
-					$edit_event_lnk = '<a href="'.$edit_event_url.'" title="' . esc_attr__( 'Edit ', 'event_espresso' ) . $event_name . '">' . __( 'Edit Event', 'event_espresso' ) . '</a>';
1110
-					$event_name .= ' <span class="admin-page-header-edit-lnk not-bold">' . $edit_event_lnk . '</span>' ;
1107
+				if ($event_name != '') {
1108
+					$edit_event_url = self::add_query_args_and_nonce(array('action'=>'edit_event', 'EVT_ID'=>$EVT_ID), EVENTS_ADMIN_URL);
1109
+					$edit_event_lnk = '<a href="'.$edit_event_url.'" title="'.esc_attr__('Edit ', 'event_espresso').$event_name.'">'.__('Edit Event', 'event_espresso').'</a>';
1110
+					$event_name .= ' <span class="admin-page-header-edit-lnk not-bold">'.$edit_event_lnk.'</span>';
1111 1111
 				}
1112 1112
 
1113
-				$back_2_reg_url = self::add_query_args_and_nonce( array( 'action'=>'default' ), REG_ADMIN_URL );
1114
-				$back_2_reg_lnk = '<a href="'.$back_2_reg_url.'" title="' . esc_attr__( 'click to return to viewing all registrations ', 'event_espresso' ) . '">&laquo; ' . __( 'Back to All Registrations', 'event_espresso' ) . '</a>';
1113
+				$back_2_reg_url = self::add_query_args_and_nonce(array('action'=>'default'), REG_ADMIN_URL);
1114
+				$back_2_reg_lnk = '<a href="'.$back_2_reg_url.'" title="'.esc_attr__('click to return to viewing all registrations ', 'event_espresso').'">&laquo; '.__('Back to All Registrations', 'event_espresso').'</a>';
1115 1115
 
1116 1116
 				$this->_template_args['before_admin_page_content'] = '
1117 1117
 			<div id="admin-page-header">
1118
-				<h1><span class="small-text not-bold">'.__( 'Event: ', 'event_espresso' ).'</span>'. $event_name .'</h1>
1119
-				<h3><span class="small-text not-bold">'.__( 'Date: ', 'event_espresso' ). '</span>'. $event_date .'</h3>
1120
-				<span class="admin-page-header-go-back-lnk not-bold">' . $back_2_reg_lnk . '</span>
1118
+				<h1><span class="small-text not-bold">'.__('Event: ', 'event_espresso').'</span>'.$event_name.'</h1>
1119
+				<h3><span class="small-text not-bold">'.__('Date: ', 'event_espresso').'</span>'.$event_date.'</h3>
1120
+				<span class="admin-page-header-go-back-lnk not-bold">' . $back_2_reg_lnk.'</span>
1121 1121
 			</div>
1122 1122
 			';
1123 1123
 
@@ -1155,7 +1155,7 @@  discard block
 block discarded – undo
1155 1155
 
1156 1156
 		$this->_set_registration_object();
1157 1157
 
1158
-		if ( is_object( $this->_registration )) {
1158
+		if (is_object($this->_registration)) {
1159 1159
 			$transaction = $this->_registration->transaction() ? $this->_registration->transaction() : EE_Transaction::new_instance();
1160 1160
 			$this->_session = $transaction->session_data();
1161 1161
 
@@ -1163,10 +1163,10 @@  discard block
 block discarded – undo
1163 1163
 
1164 1164
 
1165 1165
 			$this->_template_args['reg_nmbr']['value'] = $this->_registration->ID();
1166
-			$this->_template_args['reg_nmbr']['label'] = __( 'Registration Number', 'event_espresso' );
1166
+			$this->_template_args['reg_nmbr']['label'] = __('Registration Number', 'event_espresso');
1167 1167
 
1168
-			$this->_template_args['reg_datetime']['value'] =  $this->_registration->get_i18n_datetime( 'REG_date' );
1169
-			$this->_template_args['reg_datetime']['label'] = __( 'Date', 'event_espresso' );
1168
+			$this->_template_args['reg_datetime']['value'] = $this->_registration->get_i18n_datetime('REG_date');
1169
+			$this->_template_args['reg_datetime']['label'] = __('Date', 'event_espresso');
1170 1170
 
1171 1171
 			$this->_template_args['grand_total'] = $transaction->total();
1172 1172
 
@@ -1174,19 +1174,19 @@  discard block
 block discarded – undo
1174 1174
 			// link back to overview
1175 1175
 			$this->_template_args['reg_overview_url'] = REG_ADMIN_URL;
1176 1176
 			$this->_template_args['registration'] = $this->_registration;
1177
-			$this->_template_args['filtered_registrations_link'] = EE_Admin_Page::add_query_args_and_nonce( array( 'action' => 'default', 'event_id' => $event_id ), REG_ADMIN_URL );
1178
-			$this->_template_args['filtered_transactions_link'] = EE_Admin_Page::add_query_args_and_nonce( array( 'action' => 'default', 'EVT_ID' => $event_id, 'page' => 'espresso_transactions' ), admin_url( 'admin.php' ) );
1179
-			$this->_template_args['event_link'] = EE_Admin_Page::add_query_args_and_nonce( array( 'page' => 'espresso_events', 'action' => 'edit', 'post' => $event_id ), admin_url( 'admin.php' ) );
1177
+			$this->_template_args['filtered_registrations_link'] = EE_Admin_Page::add_query_args_and_nonce(array('action' => 'default', 'event_id' => $event_id), REG_ADMIN_URL);
1178
+			$this->_template_args['filtered_transactions_link'] = EE_Admin_Page::add_query_args_and_nonce(array('action' => 'default', 'EVT_ID' => $event_id, 'page' => 'espresso_transactions'), admin_url('admin.php'));
1179
+			$this->_template_args['event_link'] = EE_Admin_Page::add_query_args_and_nonce(array('page' => 'espresso_events', 'action' => 'edit', 'post' => $event_id), admin_url('admin.php'));
1180 1180
 
1181 1181
 			//next and previous links
1182
-			$next_reg = $this->_registration->next(null, array(), 'REG_ID' );
1183
-			$this->_template_args['next_registration'] = $next_reg ? $this->_next_link( EE_Admin_Page::add_query_args_and_nonce( array( 'action' => 'view_registration', '_REG_ID' => $next_reg['REG_ID'] ), REG_ADMIN_URL ), 'dashicons dashicons-arrow-right ee-icon-size-22' ) : '';
1184
-			$previous_reg = $this->_registration->previous( null, array(), 'REG_ID' );
1185
-			$this->_template_args['previous_registration'] = $previous_reg ? $this->_previous_link( EE_Admin_Page::add_query_args_and_nonce( array( 'action' => 'view_registration', '_REG_ID' => $previous_reg['REG_ID'] ), REG_ADMIN_URL ), 'dashicons dashicons-arrow-left ee-icon-size-22' ) : '';
1182
+			$next_reg = $this->_registration->next(null, array(), 'REG_ID');
1183
+			$this->_template_args['next_registration'] = $next_reg ? $this->_next_link(EE_Admin_Page::add_query_args_and_nonce(array('action' => 'view_registration', '_REG_ID' => $next_reg['REG_ID']), REG_ADMIN_URL), 'dashicons dashicons-arrow-right ee-icon-size-22') : '';
1184
+			$previous_reg = $this->_registration->previous(null, array(), 'REG_ID');
1185
+			$this->_template_args['previous_registration'] = $previous_reg ? $this->_previous_link(EE_Admin_Page::add_query_args_and_nonce(array('action' => 'view_registration', '_REG_ID' => $previous_reg['REG_ID']), REG_ADMIN_URL), 'dashicons dashicons-arrow-left ee-icon-size-22') : '';
1186 1186
 
1187 1187
 			// grab header
1188
-			$template_path = REG_TEMPLATE_PATH . 'reg_admin_details_header.template.php';
1189
-			$this->_template_args['admin_page_header'] = EEH_Template::display_template( $template_path, $this->_template_args, TRUE );
1188
+			$template_path = REG_TEMPLATE_PATH.'reg_admin_details_header.template.php';
1189
+			$this->_template_args['admin_page_header'] = EEH_Template::display_template($template_path, $this->_template_args, TRUE);
1190 1190
 
1191 1191
 		} else {
1192 1192
 
@@ -1205,17 +1205,17 @@  discard block
 block discarded – undo
1205 1205
 
1206 1206
 
1207 1207
 	protected function _registration_details_metaboxes() {
1208
-		do_action( 'AHEE__Registrations_Admin_Page___registration_details_metabox__start', $this );
1208
+		do_action('AHEE__Registrations_Admin_Page___registration_details_metabox__start', $this);
1209 1209
 		$this->_set_registration_object();
1210 1210
 		$attendee = $this->_registration instanceof EE_Registration ? $this->_registration->attendee() : null;
1211
-		add_meta_box( 'edit-reg-status-mbox', __( 'Registration Status', 'event_espresso' ), array( $this, 'set_reg_status_buttons_metabox' ), $this->wp_page_slug, 'normal', 'high' );
1212
-		add_meta_box( 'edit-reg-details-mbox', __( 'Registration Details', 'event_espresso' ), array( $this, '_reg_details_meta_box' ), $this->wp_page_slug, 'normal', 'high' );
1213
-		if ( $attendee instanceof EE_Attendee && EE_Registry::instance()->CAP->current_user_can('ee_edit_registration', 'edit-reg-questions-mbox' ) ) {
1214
-			add_meta_box( 'edit-reg-questions-mbox', __( 'Registration Form Answers', 'event_espresso' ), array( $this, '_reg_questions_meta_box' ), $this->wp_page_slug, 'normal', 'high' );
1211
+		add_meta_box('edit-reg-status-mbox', __('Registration Status', 'event_espresso'), array($this, 'set_reg_status_buttons_metabox'), $this->wp_page_slug, 'normal', 'high');
1212
+		add_meta_box('edit-reg-details-mbox', __('Registration Details', 'event_espresso'), array($this, '_reg_details_meta_box'), $this->wp_page_slug, 'normal', 'high');
1213
+		if ($attendee instanceof EE_Attendee && EE_Registry::instance()->CAP->current_user_can('ee_edit_registration', 'edit-reg-questions-mbox')) {
1214
+			add_meta_box('edit-reg-questions-mbox', __('Registration Form Answers', 'event_espresso'), array($this, '_reg_questions_meta_box'), $this->wp_page_slug, 'normal', 'high');
1215 1215
 		}
1216
-		add_meta_box( 'edit-reg-registrant-mbox', __( 'Contact Details', 'event_espresso' ), array( $this, '_reg_registrant_side_meta_box' ), $this->wp_page_slug, 'side', 'high' );
1217
-		if ( $this->_registration->group_size() > 1 ) {
1218
-			add_meta_box( 'edit-reg-attendees-mbox', __( 'Other Registrations in this Transaction', 'event_espresso' ), array( $this, '_reg_attendees_meta_box' ), $this->wp_page_slug, 'normal', 'high' );
1216
+		add_meta_box('edit-reg-registrant-mbox', __('Contact Details', 'event_espresso'), array($this, '_reg_registrant_side_meta_box'), $this->wp_page_slug, 'side', 'high');
1217
+		if ($this->_registration->group_size() > 1) {
1218
+			add_meta_box('edit-reg-attendees-mbox', __('Other Registrations in this Transaction', 'event_espresso'), array($this, '_reg_attendees_meta_box'), $this->wp_page_slug, 'normal', 'high');
1219 1219
 		}
1220 1220
 	}
1221 1221
 
@@ -1234,22 +1234,22 @@  discard block
 block discarded – undo
1234 1234
 		$is_complete = $this->_registration->transaction()->is_completed();
1235 1235
 		//let's get an array of all possible buttons that we can just reference
1236 1236
 		$status_buttons = $this->_get_reg_status_buttons();
1237
-		$template_args[ 'reg_status_value' ] = $this->_registration->pretty_status();
1238
-		$template_args[ 'reg_status_class' ] = 'status-' . $this->_registration->status_ID();
1237
+		$template_args['reg_status_value'] = $this->_registration->pretty_status();
1238
+		$template_args['reg_status_class'] = 'status-'.$this->_registration->status_ID();
1239 1239
 		$template_args['attendee'] = $this->_registration->attendee();
1240
-		$template = REG_TEMPLATE_PATH . 'reg_status_change_buttons.template.php';
1241
-		if ( $this->_set_registration_object() ) {
1240
+		$template = REG_TEMPLATE_PATH.'reg_status_change_buttons.template.php';
1241
+		if ($this->_set_registration_object()) {
1242 1242
 			$current_status = $this->_registration->status_ID();
1243
-			unset( $status_buttons[$current_status] );
1244
-			if ( $current_status != EEM_Registration::status_id_pending_payment && $is_complete ) {
1245
-				unset( $status_buttons[EEM_Registration::status_id_pending_payment] );
1243
+			unset($status_buttons[$current_status]);
1244
+			if ($current_status != EEM_Registration::status_id_pending_payment && $is_complete) {
1245
+				unset($status_buttons[EEM_Registration::status_id_pending_payment]);
1246 1246
 			}
1247
-			$template_args['status_buttons'] = implode( "\n", $status_buttons );
1247
+			$template_args['status_buttons'] = implode("\n", $status_buttons);
1248 1248
 		}
1249 1249
 		$template_args['form_url'] = REG_ADMIN_URL;
1250 1250
 		$template_args['REG_ID'] = $this->_registration->ID();
1251
-		$template_args['nonce'] = wp_nonce_field( 'change_reg_status_nonce',  'change_reg_status_nonce', FALSE, FALSE );
1252
-		EEH_Template::display_template( $template, $template_args );
1251
+		$template_args['nonce'] = wp_nonce_field('change_reg_status_nonce', 'change_reg_status_nonce', FALSE, FALSE);
1252
+		EEH_Template::display_template($template, $template_args);
1253 1253
 
1254 1254
 	}
1255 1255
 
@@ -1263,11 +1263,11 @@  discard block
 block discarded – undo
1263 1263
 	private function _get_reg_status_buttons() {
1264 1264
 
1265 1265
 		$buttons = array(
1266
-			EEM_Registration::status_id_approved => '<input type="submit" name="_reg_status_id" class="button-secondary ee-status-strip reg-status-' . EEM_Registration::status_id_approved . '" value="' . EEH_Template::pretty_status( EEM_Registration::status_id_approved, FALSE, 'sentence' ) . '">',
1267
-			EEM_Registration::status_id_pending_payment => '<input type="submit" name="_reg_status_id" class="button-secondary ee-status-strip reg-status-' . EEM_Registration::status_id_pending_payment . '" value="' . EEH_Template::pretty_status( EEM_Registration::status_id_pending_payment, FALSE, 'sentence' ) . '">',
1268
-			EEM_Registration::status_id_not_approved => '<input type="submit" name="_reg_status_id" class="button-secondary ee-status-strip reg-status-' . EEM_Registration::status_id_not_approved . '" value="' . EEH_Template::pretty_status( EEM_Registration::status_id_not_approved, FALSE, 'sentence' ) . '">',
1269
-			EEM_Registration::status_id_declined => '<input type="submit" name="_reg_status_id" class="button-secondary ee-status-strip reg-status-' . EEM_Registration::status_id_declined . '" value="' . EEH_Template::pretty_status( EEM_Registration::status_id_declined, FALSE, 'sentence' ) . '">',
1270
-			EEM_Registration::status_id_cancelled =>'<input type="submit" name="_reg_status_id" class="button-secondary ee-status-strip reg-status-' . EEM_Registration::status_id_cancelled . '" value="' . EEH_Template::pretty_status( EEM_Registration::status_id_cancelled, FALSE, 'sentence' ) . '">',
1266
+			EEM_Registration::status_id_approved => '<input type="submit" name="_reg_status_id" class="button-secondary ee-status-strip reg-status-'.EEM_Registration::status_id_approved.'" value="'.EEH_Template::pretty_status(EEM_Registration::status_id_approved, FALSE, 'sentence').'">',
1267
+			EEM_Registration::status_id_pending_payment => '<input type="submit" name="_reg_status_id" class="button-secondary ee-status-strip reg-status-'.EEM_Registration::status_id_pending_payment.'" value="'.EEH_Template::pretty_status(EEM_Registration::status_id_pending_payment, FALSE, 'sentence').'">',
1268
+			EEM_Registration::status_id_not_approved => '<input type="submit" name="_reg_status_id" class="button-secondary ee-status-strip reg-status-'.EEM_Registration::status_id_not_approved.'" value="'.EEH_Template::pretty_status(EEM_Registration::status_id_not_approved, FALSE, 'sentence').'">',
1269
+			EEM_Registration::status_id_declined => '<input type="submit" name="_reg_status_id" class="button-secondary ee-status-strip reg-status-'.EEM_Registration::status_id_declined.'" value="'.EEH_Template::pretty_status(EEM_Registration::status_id_declined, FALSE, 'sentence').'">',
1270
+			EEM_Registration::status_id_cancelled =>'<input type="submit" name="_reg_status_id" class="button-secondary ee-status-strip reg-status-'.EEM_Registration::status_id_cancelled.'" value="'.EEH_Template::pretty_status(EEM_Registration::status_id_cancelled, FALSE, 'sentence').'">',
1271 1271
 			);
1272 1272
 		return $buttons;
1273 1273
 	}
@@ -1281,13 +1281,13 @@  discard block
 block discarded – undo
1281 1281
 	 *
1282 1282
 	 * @return array  (array with reg_id(s) updated and whether update was successful.
1283 1283
 	 */
1284
-	protected function _set_registration_status_from_request( $status = false, $notify = false ) {
1285
-		$REG_ID = isset( $this->_req_data['_REG_ID'] ) ? (array) $this->_req_data['_REG_ID'] : array();
1284
+	protected function _set_registration_status_from_request($status = false, $notify = false) {
1285
+		$REG_ID = isset($this->_req_data['_REG_ID']) ? (array) $this->_req_data['_REG_ID'] : array();
1286 1286
 
1287
-		$success = $this->_set_registration_status( $REG_ID, $status );
1287
+		$success = $this->_set_registration_status($REG_ID, $status);
1288 1288
 
1289 1289
 		//notify?
1290
-		if ( $success && $notify && EE_Registry::instance()->CAP->current_user_can( 'ee_send_message', 'espresso_registrations_resend_registration' ) ) {
1290
+		if ($success && $notify && EE_Registry::instance()->CAP->current_user_can('ee_send_message', 'espresso_registrations_resend_registration')) {
1291 1291
 			$this->_process_resend_registration();
1292 1292
 		}
1293 1293
 
@@ -1305,19 +1305,19 @@  discard block
 block discarded – undo
1305 1305
 	 * @param bool $status
1306 1306
 	 * @return array (an array with 'success' key representing whether status change was successful, and 'REG_ID' as the array of updated registrations).
1307 1307
 	 */
1308
-	protected function _set_registration_status( $REG_ID, $status = false ) {
1308
+	protected function _set_registration_status($REG_ID, $status = false) {
1309 1309
 		$success = true;
1310 1310
 		// set default status if none is passed
1311 1311
 		$status = $status ? $status : EEM_Registration::status_id_pending_payment;
1312 1312
 
1313 1313
 		//typecast and sanitize reg_id
1314
-		$reg_ids = array_filter( (array) $REG_ID, 'absint' );
1314
+		$reg_ids = array_filter((array) $REG_ID, 'absint');
1315 1315
 
1316 1316
 		//loop through REG_ID's and change status
1317
-		foreach ( $reg_ids as $r_id ) {
1318
-			$registration = EEM_Registration::instance()->get_one_by_ID( $r_id );
1319
-			if ( $registration instanceof EE_Registration ) {
1320
-				$registration->set_status( $status );
1317
+		foreach ($reg_ids as $r_id) {
1318
+			$registration = EEM_Registration::instance()->get_one_by_ID($r_id);
1319
+			if ($registration instanceof EE_Registration) {
1320
+				$registration->set_status($status);
1321 1321
 				$result = $registration->save();
1322 1322
 
1323 1323
 				//verifying explicit fails because update *may* just return 0 for 0 rows affected
@@ -1329,7 +1329,7 @@  discard block
 block discarded – undo
1329 1329
 		$this->_req_data['_REG_ID'] = $reg_ids;
1330 1330
 
1331 1331
 		//return $success and processed registrations
1332
-		return array( 'REG_ID' => $reg_ids, 'success' => $success );
1332
+		return array('REG_ID' => $reg_ids, 'success' => $success);
1333 1333
 	}
1334 1334
 
1335 1335
 
@@ -1341,37 +1341,37 @@  discard block
 block discarded – undo
1341 1341
 	 * @param   bool    $notify indicates whether the _set_registration_status_from_request does notifications or not.
1342 1342
 	 * @return void
1343 1343
 	 */
1344
-	protected function _reg_status_change_return( $STS_ID, $notify = false ) {
1344
+	protected function _reg_status_change_return($STS_ID, $notify = false) {
1345 1345
 
1346
-		$result = ! empty( $STS_ID ) ? $this->_set_registration_status_from_request( $STS_ID, $notify ) : array( 'success' => false );
1346
+		$result = ! empty($STS_ID) ? $this->_set_registration_status_from_request($STS_ID, $notify) : array('success' => false);
1347 1347
 
1348 1348
 
1349
-		$success = isset( $result['success'] ) && $result['success'];
1349
+		$success = isset($result['success']) && $result['success'];
1350 1350
 
1351 1351
 		//setup success message
1352
-		if ( $success ) {
1353
-			$msg = is_array( $result['REG_ID'] ) && count( $result['REG_ID'] ) > 1  ? sprintf( __('Registration status has been set to %s', 'event_espresso'), EEH_Template::pretty_status($STS_ID, false, 'lower' ) ) :  sprintf( __('Registrations have been set to %s.', 'event_espresso'), EEH_Template::pretty_status($STS_ID, false, 'lower' ) ) ;
1354
-			EE_Error::add_success( $msg );
1352
+		if ($success) {
1353
+			$msg = is_array($result['REG_ID']) && count($result['REG_ID']) > 1 ? sprintf(__('Registration status has been set to %s', 'event_espresso'), EEH_Template::pretty_status($STS_ID, false, 'lower')) : sprintf(__('Registrations have been set to %s.', 'event_espresso'), EEH_Template::pretty_status($STS_ID, false, 'lower'));
1354
+			EE_Error::add_success($msg);
1355 1355
 		} else {
1356
-			EE_Error::add_error( __('Something went wrong, and the status was not changed', 'event_espresso' ), __FILE__, __LINE__, __FUNCTION__ );
1356
+			EE_Error::add_error(__('Something went wrong, and the status was not changed', 'event_espresso'), __FILE__, __LINE__, __FUNCTION__);
1357 1357
 		}
1358 1358
 
1359
-		$route = isset( $this->_req_data['return'] ) && $this->_req_data['return'] == 'view_registration' ? array( 'action' => 'view_registration', '_REG_ID' => $result['REG_ID'][0] ) : array( 'action' => 'default' );
1359
+		$route = isset($this->_req_data['return']) && $this->_req_data['return'] == 'view_registration' ? array('action' => 'view_registration', '_REG_ID' => $result['REG_ID'][0]) : array('action' => 'default');
1360 1360
 		//unset nonces
1361
-		foreach ( $this->_req_data as $ref => $value ) {
1362
-			if ( strpos( $ref, 'nonce' ) !== false ) {
1363
-				unset( $this->_req_data[$ref] );
1361
+		foreach ($this->_req_data as $ref => $value) {
1362
+			if (strpos($ref, 'nonce') !== false) {
1363
+				unset($this->_req_data[$ref]);
1364 1364
 				continue;
1365 1365
 			}
1366 1366
 
1367
-			$value = is_array( $value ) ? array_map( 'urlencode', $value ) : urlencode( $value );
1367
+			$value = is_array($value) ? array_map('urlencode', $value) : urlencode($value);
1368 1368
 			$this->_req_data[$ref] = $value;
1369 1369
 		}
1370 1370
 
1371 1371
 		//merge request vars so that the reloaded list table contains any existing filter query params
1372
-		$route = array_merge( $this->_req_data, $route );
1372
+		$route = array_merge($this->_req_data, $route);
1373 1373
 
1374
-		$this->_redirect_after_action( false, '', '', $route, true );
1374
+		$this->_redirect_after_action(false, '', '', $route, true);
1375 1375
 	}
1376 1376
 
1377 1377
 
@@ -1383,29 +1383,29 @@  discard block
 block discarded – undo
1383 1383
 	protected function _change_reg_status() {
1384 1384
 		$this->_req_data['return'] = 'view_registration';
1385 1385
 		//set notify based on whether the send notifications toggle is set or not
1386
-		$notify = ! empty( $this->_req_data['txn_reg_status_change']['send_notifications'] );
1387
-		$this->_req_data[ '_reg_status_id' ] = isset( $this->_req_data[ '_reg_status_id' ] ) ? $this->_req_data[ '_reg_status_id' ] : '';
1386
+		$notify = ! empty($this->_req_data['txn_reg_status_change']['send_notifications']);
1387
+		$this->_req_data['_reg_status_id'] = isset($this->_req_data['_reg_status_id']) ? $this->_req_data['_reg_status_id'] : '';
1388 1388
 
1389
-		switch ( $this->_req_data['_reg_status_id'] ) {
1390
-			case EEH_Template::pretty_status( EEM_Registration::status_id_approved, false, 'sentence' ) :
1391
-				$this->approve_registration( $notify );
1389
+		switch ($this->_req_data['_reg_status_id']) {
1390
+			case EEH_Template::pretty_status(EEM_Registration::status_id_approved, false, 'sentence') :
1391
+				$this->approve_registration($notify);
1392 1392
 				break;
1393
-			case EEH_Template::pretty_status( EEM_Registration::status_id_pending_payment, false, 'sentence' ) :
1394
-				$this->pending_registration( $notify );
1393
+			case EEH_Template::pretty_status(EEM_Registration::status_id_pending_payment, false, 'sentence') :
1394
+				$this->pending_registration($notify);
1395 1395
 				break;
1396
-			case EEH_Template::pretty_status( EEM_Registration::status_id_not_approved, false, 'sentence' ) :
1397
-				$this->not_approve_registration( $notify );
1396
+			case EEH_Template::pretty_status(EEM_Registration::status_id_not_approved, false, 'sentence') :
1397
+				$this->not_approve_registration($notify);
1398 1398
 				break;
1399
-			case EEH_Template::pretty_status( EEM_Registration::status_id_declined, false, 'sentence' ) :
1400
-				$this->decline_registration( $notify );
1399
+			case EEH_Template::pretty_status(EEM_Registration::status_id_declined, false, 'sentence') :
1400
+				$this->decline_registration($notify);
1401 1401
 				break;
1402
-			case EEH_Template::pretty_status( EEM_Registration::status_id_cancelled, false, 'sentence' ) :
1403
-				$this->cancel_registration( $notify );
1402
+			case EEH_Template::pretty_status(EEM_Registration::status_id_cancelled, false, 'sentence') :
1403
+				$this->cancel_registration($notify);
1404 1404
 				break;
1405 1405
 			default :
1406 1406
 				$result['success'] = false;
1407
-				unset( $this->_req_data['return'] );
1408
-				$this->_reg_status_change_return( '', false );
1407
+				unset($this->_req_data['return']);
1408
+				$this->_reg_status_change_return('', false);
1409 1409
 				break;
1410 1410
 		}
1411 1411
 	}
@@ -1418,8 +1418,8 @@  discard block
 block discarded – undo
1418 1418
 	*		@param bool $notify whether or not to notify the registrant about their approval.
1419 1419
 	*		@return void
1420 1420
 	*/
1421
-	protected function approve_registration( $notify = false ) {
1422
-		$this->_reg_status_change_return( EEM_Registration::status_id_approved, $notify );
1421
+	protected function approve_registration($notify = false) {
1422
+		$this->_reg_status_change_return(EEM_Registration::status_id_approved, $notify);
1423 1423
 	}
1424 1424
 
1425 1425
 
@@ -1431,8 +1431,8 @@  discard block
 block discarded – undo
1431 1431
 	*		@param bool $notify whether or not to notify the registrant about their approval.
1432 1432
 	*		@return void
1433 1433
 	*/
1434
-	protected function decline_registration( $notify = false ) {
1435
-		$this->_reg_status_change_return( EEM_Registration::status_id_declined, $notify );
1434
+	protected function decline_registration($notify = false) {
1435
+		$this->_reg_status_change_return(EEM_Registration::status_id_declined, $notify);
1436 1436
 	}
1437 1437
 
1438 1438
 
@@ -1444,8 +1444,8 @@  discard block
 block discarded – undo
1444 1444
 	*		@param bool $notify whether or not to notify the registrant about their approval.
1445 1445
 	*		@return void
1446 1446
 	*/
1447
-	protected function cancel_registration( $notify = false ) {
1448
-		$this->_reg_status_change_return( EEM_Registration::status_id_cancelled, $notify );
1447
+	protected function cancel_registration($notify = false) {
1448
+		$this->_reg_status_change_return(EEM_Registration::status_id_cancelled, $notify);
1449 1449
 	}
1450 1450
 
1451 1451
 
@@ -1458,8 +1458,8 @@  discard block
 block discarded – undo
1458 1458
 	*		@param bool $notify whether or not to notify the registrant about their approval.
1459 1459
 	*		@return void
1460 1460
 	*/
1461
-	protected function not_approve_registration( $notify = false ) {
1462
-		$this->_reg_status_change_return( EEM_Registration::status_id_not_approved, $notify );
1461
+	protected function not_approve_registration($notify = false) {
1462
+		$this->_reg_status_change_return(EEM_Registration::status_id_not_approved, $notify);
1463 1463
 	}
1464 1464
 
1465 1465
 
@@ -1470,8 +1470,8 @@  discard block
 block discarded – undo
1470 1470
 	*		@param bool $notify whether or not to notify the registrant about their approval.
1471 1471
 	*		@return void
1472 1472
 	*/
1473
-	protected function pending_registration( $notify = false ) {
1474
-		$this->_reg_status_change_return( EEM_Registration::status_id_pending_payment, $notify );
1473
+	protected function pending_registration($notify = false) {
1474
+		$this->_reg_status_change_return(EEM_Registration::status_id_pending_payment, $notify);
1475 1475
 	}
1476 1476
 
1477 1477
 
@@ -1485,19 +1485,19 @@  discard block
 block discarded – undo
1485 1485
 	public function _reg_details_meta_box() {
1486 1486
 		EEH_Autoloader::register_line_item_display_autoloaders();
1487 1487
 		EEH_Autoloader::register_line_item_filter_autoloaders();
1488
-		EE_Registry::instance()->load_helper( 'Line_Item' );
1488
+		EE_Registry::instance()->load_helper('Line_Item');
1489 1489
 		$transaction = $this->_registration->transaction() ? $this->_registration->transaction() : EE_Transaction::new_instance();
1490 1490
 		$this->_session = $transaction->session_data();
1491 1491
 
1492 1492
 		$filters = new EE_Line_Item_Filter_Collection();
1493
-		$filters->add( new EE_Single_Registration_Line_Item_Filter( $this->_registration ) );
1494
-		$filters->add( new EE_Non_Zero_Line_Item_Filter() );
1495
-		$line_item_filter_processor = new EE_Line_Item_Filter_Processor( $filters, $transaction->total_line_item() );
1493
+		$filters->add(new EE_Single_Registration_Line_Item_Filter($this->_registration));
1494
+		$filters->add(new EE_Non_Zero_Line_Item_Filter());
1495
+		$line_item_filter_processor = new EE_Line_Item_Filter_Processor($filters, $transaction->total_line_item());
1496 1496
 		$filtered_line_item_tree = $line_item_filter_processor->process();
1497 1497
 
1498 1498
 		$this->_template_args['REG_ID'] = $this->_registration->ID();
1499
-		$line_item_display = new EE_Line_Item_Display( 'reg_admin_table', 'EE_Admin_Table_Registration_Line_Item_Display_Strategy' );
1500
-		$this->_template_args['line_item_table'] = $line_item_display->display_line_item( $filtered_line_item_tree, array( 'EE_Registration' => $this->_registration ) );
1499
+		$line_item_display = new EE_Line_Item_Display('reg_admin_table', 'EE_Admin_Table_Registration_Line_Item_Display_Strategy');
1500
+		$this->_template_args['line_item_table'] = $line_item_display->display_line_item($filtered_line_item_tree, array('EE_Registration' => $this->_registration));
1501 1501
 
1502 1502
 
1503 1503
 		$attendee = $this->_registration->attendee();
@@ -1508,10 +1508,10 @@  discard block
 block discarded – undo
1508 1508
 		)
1509 1509
 			? EEH_Template::get_button_or_link(
1510 1510
 				EE_Admin_Page::add_query_args_and_nonce(
1511
-					array( 'action' => 'view_transaction', 'TXN_ID' => $transaction->ID() ),
1511
+					array('action' => 'view_transaction', 'TXN_ID' => $transaction->ID()),
1512 1512
 					TXN_ADMIN_URL
1513 1513
 				),
1514
-				esc_html__( ' View Transaction' ),
1514
+				esc_html__(' View Transaction'),
1515 1515
 				'button secondary-button right',
1516 1516
 				'dashicons dashicons-cart'
1517 1517
 			)
@@ -1531,59 +1531,59 @@  discard block
 block discarded – undo
1531 1531
 					),
1532 1532
 					REG_ADMIN_URL
1533 1533
 				),
1534
-				esc_html__( ' Resend Registration' ),
1534
+				esc_html__(' Resend Registration'),
1535 1535
 				'button secondary-button right',
1536 1536
 				'dashicons dashicons-email-alt'
1537 1537
 			)
1538 1538
 			: '';
1539 1539
 
1540 1540
 		$this->_template_args['currency_sign'] = EE_Registry::instance()->CFG->currency->sign;
1541
-		$payment = $transaction->get_first_related( 'Payment' );
1541
+		$payment = $transaction->get_first_related('Payment');
1542 1542
 		$payment = ! $payment instanceof EE_Payment ? EE_Payment::new_instance() : $payment;
1543
-		$payment_method = $payment->get_first_related( 'Payment_Method' );
1543
+		$payment_method = $payment->get_first_related('Payment_Method');
1544 1544
 		$payment_method = ! $payment_method instanceof EE_Payment_Method ? EE_Payment_Method::new_instance() : $payment_method;
1545
-		$reg_status_class = 'status-' . $this->_registration->status_ID();
1545
+		$reg_status_class = 'status-'.$this->_registration->status_ID();
1546 1546
 		$reg_details = array(
1547 1547
 			'payment_method' => $payment_method->name(),
1548 1548
 			'response_msg' => $payment->gateway_response(),
1549
-			'registration_id' => $this->_registration->get( 'REG_code' ),
1549
+			'registration_id' => $this->_registration->get('REG_code'),
1550 1550
 			'registration_session' => $this->_registration->session_ID(),
1551
-			'ip_address' => isset( $this->_session['ip_address'] ) ? $this->_session['ip_address'] : '',
1552
-			'user_agent' => isset( $this->_session['user_agent'] ) ? $this->_session['user_agent'] : '',
1551
+			'ip_address' => isset($this->_session['ip_address']) ? $this->_session['ip_address'] : '',
1552
+			'user_agent' => isset($this->_session['user_agent']) ? $this->_session['user_agent'] : '',
1553 1553
 			);
1554 1554
 
1555 1555
 
1556
-		if ( isset( $reg_details['registration_id'] )) {
1556
+		if (isset($reg_details['registration_id'])) {
1557 1557
 			$this->_template_args['reg_details']['registration_id']['value'] = $reg_details['registration_id'];
1558
-			$this->_template_args['reg_details']['registration_id']['label'] = __( 'Registration ID', 'event_espresso' );
1558
+			$this->_template_args['reg_details']['registration_id']['label'] = __('Registration ID', 'event_espresso');
1559 1559
 			$this->_template_args['reg_details']['registration_id']['class'] = 'regular-text';
1560 1560
 		}
1561 1561
 
1562
-		if ( isset( $reg_details['payment_method'] ) ) {
1562
+		if (isset($reg_details['payment_method'])) {
1563 1563
 			$this->_template_args['reg_details']['payment_method']['value'] = $reg_details['payment_method'];
1564
-			$this->_template_args['reg_details']['payment_method']['label'] = __( 'Most Recent Payment Method', 'event_espresso' );
1564
+			$this->_template_args['reg_details']['payment_method']['label'] = __('Most Recent Payment Method', 'event_espresso');
1565 1565
 			$this->_template_args['reg_details']['payment_method']['class'] = 'regular-text';
1566 1566
 			$this->_template_args['reg_details']['response_msg']['value'] = $reg_details['response_msg'];
1567
-			$this->_template_args['reg_details']['response_msg']['label'] = __( 'Payment method response', 'event_espresso' );
1567
+			$this->_template_args['reg_details']['response_msg']['label'] = __('Payment method response', 'event_espresso');
1568 1568
 			$this->_template_args['reg_details']['response_msg']['class'] = 'regular-text';
1569 1569
 		}
1570 1570
 
1571 1571
 		$this->_template_args['reg_details']['registration_session']['value'] = $reg_details['registration_session'];
1572
-		$this->_template_args['reg_details']['registration_session']['label'] = __( 'Registration Session', 'event_espresso' );
1572
+		$this->_template_args['reg_details']['registration_session']['label'] = __('Registration Session', 'event_espresso');
1573 1573
 		$this->_template_args['reg_details']['registration_session']['class'] = 'regular-text';
1574 1574
 
1575 1575
 		$this->_template_args['reg_details']['ip_address']['value'] = $reg_details['ip_address'];
1576
-		$this->_template_args['reg_details']['ip_address']['label'] = __( 'Registration placed from IP', 'event_espresso' );
1576
+		$this->_template_args['reg_details']['ip_address']['label'] = __('Registration placed from IP', 'event_espresso');
1577 1577
 		$this->_template_args['reg_details']['ip_address']['class'] = 'regular-text';
1578 1578
 
1579 1579
 		$this->_template_args['reg_details']['user_agent']['value'] = $reg_details['user_agent'];
1580
-		$this->_template_args['reg_details']['user_agent']['label'] = __( 'Registrant User Agent', 'event_espresso' );
1580
+		$this->_template_args['reg_details']['user_agent']['label'] = __('Registrant User Agent', 'event_espresso');
1581 1581
 		$this->_template_args['reg_details']['user_agent']['class'] = 'large-text';
1582 1582
 
1583
-		$this->_template_args['event_link'] = EE_Admin_Page::add_query_args_and_nonce( array( 'action' => 'default', 'event_id' => $this->_registration->event_ID()), REG_ADMIN_URL );
1583
+		$this->_template_args['event_link'] = EE_Admin_Page::add_query_args_and_nonce(array('action' => 'default', 'event_id' => $this->_registration->event_ID()), REG_ADMIN_URL);
1584 1584
 
1585
-		$template_path = REG_TEMPLATE_PATH . 'reg_admin_details_main_meta_box_reg_details.template.php';
1586
-		echo EEH_Template::display_template( $template_path, $this->_template_args, TRUE );
1585
+		$template_path = REG_TEMPLATE_PATH.'reg_admin_details_main_meta_box_reg_details.template.php';
1586
+		echo EEH_Template::display_template($template_path, $this->_template_args, TRUE);
1587 1587
 
1588 1588
 	}
1589 1589
 
@@ -1597,14 +1597,14 @@  discard block
 block discarded – undo
1597 1597
 	*/
1598 1598
 	public function _reg_questions_meta_box() {
1599 1599
 		//allow someone to override this method entirely
1600
-		if( apply_filters( 'FHEE__Registrations_Admin_Page___reg_questions_meta_box__do_default', true, $this, $this->_registration ) ) {
1601
-			$form = $this->_get_reg_custom_questions_form( $this->_registration->ID() );
1602
-			$this->_template_args[ 'att_questions' ] = count( $form->subforms() ) > 0 ? $form->get_html_and_js() : '';
1600
+		if (apply_filters('FHEE__Registrations_Admin_Page___reg_questions_meta_box__do_default', true, $this, $this->_registration)) {
1601
+			$form = $this->_get_reg_custom_questions_form($this->_registration->ID());
1602
+			$this->_template_args['att_questions'] = count($form->subforms()) > 0 ? $form->get_html_and_js() : '';
1603 1603
 			$this->_template_args['reg_questions_form_action'] = 'edit_registration';
1604 1604
 			$this->_template_args['REG_ID'] = $this->_registration->ID();
1605 1605
 
1606
-			$template_path = REG_TEMPLATE_PATH . 'reg_admin_details_main_meta_box_reg_questions.template.php';
1607
-			echo EEH_Template::display_template( $template_path, $this->_template_args, TRUE );
1606
+			$template_path = REG_TEMPLATE_PATH.'reg_admin_details_main_meta_box_reg_questions.template.php';
1607
+			echo EEH_Template::display_template($template_path, $this->_template_args, TRUE);
1608 1608
 		}
1609 1609
 	}
1610 1610
 
@@ -1618,12 +1618,12 @@  discard block
 block discarded – undo
1618 1618
 	 * @param        string $output
1619 1619
 	 * @return        string
1620 1620
 	 */
1621
-	public function form_before_question_group( $output ) {
1621
+	public function form_before_question_group($output) {
1622 1622
 		EE_Error::doing_it_wrong(
1623
-			__CLASS__ . '::' . __FUNCTION__,
1624
-			__( 'This method would have been protected but was used on a filter callback'
1623
+			__CLASS__.'::'.__FUNCTION__,
1624
+			__('This method would have been protected but was used on a filter callback'
1625 1625
 				. 'so needed to be public. Please discontinue usage as it will be removed soon.',
1626
-				'event_espresso' ),
1626
+				'event_espresso'),
1627 1627
 			'4.8.32.rc.000'
1628 1628
 		);
1629 1629
 		return '
@@ -1642,20 +1642,20 @@  discard block
 block discarded – undo
1642 1642
 	 * @param        string $output
1643 1643
 	 * @return        string
1644 1644
 	 */
1645
-	public function form_after_question_group( $output ) {
1645
+	public function form_after_question_group($output) {
1646 1646
 		EE_Error::doing_it_wrong(
1647
-			__CLASS__ . '::' . __FUNCTION__,
1648
-			__( 'This method would have been protected but was used on a filter callback'
1647
+			__CLASS__.'::'.__FUNCTION__,
1648
+			__('This method would have been protected but was used on a filter callback'
1649 1649
 				. 'so needed to be public. Please discontinue usage as it will be removed soon.',
1650
-				'event_espresso' ),
1650
+				'event_espresso'),
1651 1651
 			'4.8.32.rc.000'
1652 1652
 		);
1653 1653
 		return  '
1654 1654
 			<tr class="hide-if-no-js">
1655 1655
 				<th> </th>
1656 1656
 				<td class="reg-admin-edit-attendee-question-td">
1657
-					<a class="reg-admin-edit-attendee-question-lnk" href="#" title="' . esc_attr__( 'click to edit question', 'event_espresso' ) . '">
1658
-						<span class="reg-admin-edit-question-group-spn lt-grey-txt">' . __( 'edit the above question group', 'event_espresso' ) . '</span>
1657
+					<a class="reg-admin-edit-attendee-question-lnk" href="#" title="' . esc_attr__('click to edit question', 'event_espresso').'">
1658
+						<span class="reg-admin-edit-question-group-spn lt-grey-txt">' . __('edit the above question group', 'event_espresso').'</span>
1659 1659
 						<div class="dashicons dashicons-edit"></div>
1660 1660
 					</a>
1661 1661
 				</td>
@@ -1675,18 +1675,18 @@  discard block
 block discarded – undo
1675 1675
 	 * @param        string $label
1676 1676
 	 * @return        string
1677 1677
 	 */
1678
-	public function form_form_field_label_wrap( $label ) {
1678
+	public function form_form_field_label_wrap($label) {
1679 1679
 		EE_Error::doing_it_wrong(
1680
-			__CLASS__ . '::' . __FUNCTION__,
1681
-			__( 'This method would have been protected but was used on a filter callback'
1680
+			__CLASS__.'::'.__FUNCTION__,
1681
+			__('This method would have been protected but was used on a filter callback'
1682 1682
 				. 'so needed to be public. Please discontinue usage as it will be removed soon.',
1683
-				'event_espresso' ),
1683
+				'event_espresso'),
1684 1684
 			'4.8.32.rc.000'
1685 1685
 		);
1686 1686
 		return '
1687 1687
 			<tr>
1688 1688
 				<th>
1689
-					' . $label  . '
1689
+					' . $label.'
1690 1690
 				</th>';
1691 1691
 	}
1692 1692
 
@@ -1700,17 +1700,17 @@  discard block
 block discarded – undo
1700 1700
 	 * @param        string $input
1701 1701
 	 * @return        string
1702 1702
 	 */
1703
-	public function form_form_field_input__wrap( $input ) {
1703
+	public function form_form_field_input__wrap($input) {
1704 1704
 		EE_Error::doing_it_wrong(
1705
-			__CLASS__ . '::' . __FUNCTION__,
1706
-			__( 'This method would have been protected but was used on a filter callback'
1705
+			__CLASS__.'::'.__FUNCTION__,
1706
+			__('This method would have been protected but was used on a filter callback'
1707 1707
 				. 'so needed to be public. Please discontinue usage as it will be removed soon.',
1708
-				'event_espresso' ),
1708
+				'event_espresso'),
1709 1709
 			'4.8.32.rc.000'
1710 1710
 		);
1711 1711
 		return '
1712 1712
 				<td class="reg-admin-attendee-questions-input-td disabled-input">
1713
-					' . $input . '
1713
+					' . $input.'
1714 1714
 				</td>
1715 1715
 			</tr>';
1716 1716
 	}
@@ -1724,14 +1724,14 @@  discard block
 block discarded – undo
1724 1724
 	 * @return void
1725 1725
 	 */
1726 1726
 	protected function _update_attendee_registration_form() {
1727
-		do_action( 'AHEE__Registrations_Admin_Page___update_attendee_registration_form__start', $this );
1728
-		if( $_SERVER['REQUEST_METHOD'] == 'POST'){
1729
-			$REG_ID = isset( $this->_req_data['_REG_ID'] ) ? absint( $this->_req_data['_REG_ID'] ) : FALSE;
1730
-			$success = $this->_save_reg_custom_questions_form( $REG_ID );
1731
-			if( $success ) {
1727
+		do_action('AHEE__Registrations_Admin_Page___update_attendee_registration_form__start', $this);
1728
+		if ($_SERVER['REQUEST_METHOD'] == 'POST') {
1729
+			$REG_ID = isset($this->_req_data['_REG_ID']) ? absint($this->_req_data['_REG_ID']) : FALSE;
1730
+			$success = $this->_save_reg_custom_questions_form($REG_ID);
1731
+			if ($success) {
1732 1732
 				$what = __('Registration Form', 'event_espresso');
1733
-				$route = $REG_ID ? array( 'action' => 'view_registration', '_REG_ID' => $REG_ID ) : array( 'action' => 'default' );
1734
-				$this->_redirect_after_action( $success, $what, __('updated', 'event_espresso'), $route );
1733
+				$route = $REG_ID ? array('action' => 'view_registration', '_REG_ID' => $REG_ID) : array('action' => 'default');
1734
+				$this->_redirect_after_action($success, $what, __('updated', 'event_espresso'), $route);
1735 1735
 			}
1736 1736
 		}
1737 1737
 	}
@@ -1742,11 +1742,11 @@  discard block
 block discarded – undo
1742 1742
 	 * @param int $REG_ID
1743 1743
 	 * @return EE_Registration_Custom_Questions_Form
1744 1744
 	 */
1745
-	protected function _get_reg_custom_questions_form( $REG_ID ) {
1746
-		if( ! $this->_reg_custom_questions_form ) {
1747
-			require_once( REG_ADMIN . 'form_sections' . DS . 'EE_Registration_Custom_Questions_Form.form.php' );
1748
-			$this->_reg_custom_questions_form = new EE_Registration_Custom_Questions_Form( EEM_Registration::instance()->get_one_by_ID( $REG_ID ) );
1749
-			$this->_reg_custom_questions_form->_construct_finalize( null, null );
1745
+	protected function _get_reg_custom_questions_form($REG_ID) {
1746
+		if ( ! $this->_reg_custom_questions_form) {
1747
+			require_once(REG_ADMIN.'form_sections'.DS.'EE_Registration_Custom_Questions_Form.form.php');
1748
+			$this->_reg_custom_questions_form = new EE_Registration_Custom_Questions_Form(EEM_Registration::instance()->get_one_by_ID($REG_ID));
1749
+			$this->_reg_custom_questions_form->_construct_finalize(null, null);
1750 1750
 		}
1751 1751
 		return $this->_reg_custom_questions_form;
1752 1752
 	}
@@ -1759,17 +1759,17 @@  discard block
 block discarded – undo
1759 1759
 	 * @param bool $REG_ID
1760 1760
 	 * @return bool
1761 1761
 	 */
1762
-	private function _save_reg_custom_questions_form( $REG_ID = FALSE ) {
1762
+	private function _save_reg_custom_questions_form($REG_ID = FALSE) {
1763 1763
 
1764 1764
 		if ( ! $REG_ID) {
1765
-			EE_Error::add_error( __('An error occurred. No registration ID was received.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ );
1765
+			EE_Error::add_error(__('An error occurred. No registration ID was received.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
1766 1766
 		}
1767
-		$form = $this->_get_reg_custom_questions_form( $REG_ID );
1768
-		$form->receive_form_submission( $this->_req_data );
1767
+		$form = $this->_get_reg_custom_questions_form($REG_ID);
1768
+		$form->receive_form_submission($this->_req_data);
1769 1769
 		$success = false;
1770
-		if( $form->is_valid() ) {
1771
-			foreach( $form->subforms() as $question_group_id => $question_group_form ) {
1772
-				foreach( $question_group_form->inputs() as $question_id => $input ) {
1770
+		if ($form->is_valid()) {
1771
+			foreach ($form->subforms() as $question_group_id => $question_group_form) {
1772
+				foreach ($question_group_form->inputs() as $question_id => $input) {
1773 1773
 					$where_conditions = array(
1774 1774
 							'QST_ID' => $question_id,
1775 1775
 							'REG_ID' => $REG_ID
@@ -1777,19 +1777,19 @@  discard block
 block discarded – undo
1777 1777
 					$possibly_new_values = array(
1778 1778
 							'ANS_value' => $input->normalized_value()
1779 1779
 						);
1780
-					$answer = EEM_Answer::instance()->get_one( array( $where_conditions ) );
1781
-					if( $answer instanceof EE_Answer ) {
1782
-						$success = $answer->save( $possibly_new_values );
1780
+					$answer = EEM_Answer::instance()->get_one(array($where_conditions));
1781
+					if ($answer instanceof EE_Answer) {
1782
+						$success = $answer->save($possibly_new_values);
1783 1783
 					} else {
1784 1784
 						//insert it then
1785
-						$cols_n_vals = array_merge( $where_conditions, $possibly_new_values );
1786
-						$answer = EE_Answer::new_instance( $cols_n_vals );
1785
+						$cols_n_vals = array_merge($where_conditions, $possibly_new_values);
1786
+						$answer = EE_Answer::new_instance($cols_n_vals);
1787 1787
 						$success = $answer->save();
1788 1788
 					}
1789 1789
 				}
1790 1790
 			}
1791 1791
 		} else {
1792
-			EE_Error::add_error( $form->get_validation_error_string(), __FILE__, __FUNCTION__, __LINE__ );
1792
+			EE_Error::add_error($form->get_validation_error_string(), __FILE__, __FUNCTION__, __LINE__);
1793 1793
 		}
1794 1794
 		return $success;
1795 1795
 	}
@@ -1807,31 +1807,31 @@  discard block
 block discarded – undo
1807 1807
 		$registrations = $REG->get_all(array(
1808 1808
 			array(
1809 1809
 				'TXN_ID'=>$this->_registration->transaction_ID(),
1810
-				'REG_ID'=>array('!=',$this->_registration->ID())
1810
+				'REG_ID'=>array('!=', $this->_registration->ID())
1811 1811
 			),
1812 1812
 			'force_join'=>array('Attendee')));
1813 1813
 
1814 1814
 		$this->_template_args['attendees'] = array();
1815 1815
 		$this->_template_args['attendee_notice'] = '';
1816
-		if ( empty( $registrations)  || ( is_array($registrations) &&  ! EEH_Array::get_one_item_from_array($registrations) ) ) {
1817
-			EE_Error::add_error( __('There are no records attached to this registration. Something may have gone wrong with the registration', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ );
1816
+		if (empty($registrations) || (is_array($registrations) && ! EEH_Array::get_one_item_from_array($registrations))) {
1817
+			EE_Error::add_error(__('There are no records attached to this registration. Something may have gone wrong with the registration', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
1818 1818
 			$this->_template_args['attendee_notice'] = EE_Error::get_notices();
1819 1819
 		} else {
1820 1820
 
1821 1821
 			$att_nmbr = 1;
1822
-			foreach ( $registrations as $registration ) {
1822
+			foreach ($registrations as $registration) {
1823 1823
 				/* @var $registration EE_Registration */
1824 1824
 				$attendee = $registration->attendee() ? $registration->attendee() : EEM_Attendee::instance()->create_default_object();
1825
-				$this->_template_args['attendees'][ $att_nmbr ]['STS_ID'] = $registration->status_ID();
1826
-				$this->_template_args['attendees'][ $att_nmbr ]['fname'] = $attendee->fname();//( isset( $registration->ATT_fname ) & ! empty( $registration->ATT_fname ) ) ? $registration->ATT_fname : '';
1827
-				$this->_template_args['attendees'][ $att_nmbr ]['lname'] = $attendee->lname();//( isset( $registration->ATT_lname ) & ! empty( $registration->ATT_lname ) ) ? $registration->ATT_lname : '';
1828
-				$this->_template_args['attendees'][ $att_nmbr ]['email'] = $attendee->email();//( isset( $registration->ATT_email ) & ! empty( $registration->ATT_email ) ) ? $registration->ATT_email : '';
1829
-				$this->_template_args['attendees'][ $att_nmbr ]['final_price'] = $registration->final_price();//( isset( $registration->REG_final_price ) & ! empty( $registration->REG_final_price ) ) ? $registration->REG_final_price : '';
1825
+				$this->_template_args['attendees'][$att_nmbr]['STS_ID'] = $registration->status_ID();
1826
+				$this->_template_args['attendees'][$att_nmbr]['fname'] = $attendee->fname(); //( isset( $registration->ATT_fname ) & ! empty( $registration->ATT_fname ) ) ? $registration->ATT_fname : '';
1827
+				$this->_template_args['attendees'][$att_nmbr]['lname'] = $attendee->lname(); //( isset( $registration->ATT_lname ) & ! empty( $registration->ATT_lname ) ) ? $registration->ATT_lname : '';
1828
+				$this->_template_args['attendees'][$att_nmbr]['email'] = $attendee->email(); //( isset( $registration->ATT_email ) & ! empty( $registration->ATT_email ) ) ? $registration->ATT_email : '';
1829
+				$this->_template_args['attendees'][$att_nmbr]['final_price'] = $registration->final_price(); //( isset( $registration->REG_final_price ) & ! empty( $registration->REG_final_price ) ) ? $registration->REG_final_price : '';
1830 1830
 
1831
-				$this->_template_args['attendees'][ $att_nmbr ]['address'] = implode( ', ', $attendee->full_address_as_array() );
1831
+				$this->_template_args['attendees'][$att_nmbr]['address'] = implode(', ', $attendee->full_address_as_array());
1832 1832
 
1833
-				$this->_template_args['attendees'][ $att_nmbr ]['att_link'] = self::add_query_args_and_nonce( array( 'action'=>'edit_attendee', 'post'=>$attendee->ID() ), REG_ADMIN_URL );
1834
-				$this->_template_args['attendees'][ $att_nmbr ]['event_name'] = $registration->event_obj()->name();
1833
+				$this->_template_args['attendees'][$att_nmbr]['att_link'] = self::add_query_args_and_nonce(array('action'=>'edit_attendee', 'post'=>$attendee->ID()), REG_ADMIN_URL);
1834
+				$this->_template_args['attendees'][$att_nmbr]['event_name'] = $registration->event_obj()->name();
1835 1835
 
1836 1836
 				$att_nmbr++;
1837 1837
 			}
@@ -1841,8 +1841,8 @@  discard block
 block discarded – undo
1841 1841
 
1842 1842
 	//			$this->_template_args['registration_form_url'] = add_query_arg( array( 'action' => 'edit_registration', 'process' => 'attendees'  ), REG_ADMIN_URL );
1843 1843
 		}
1844
-		$template_path = REG_TEMPLATE_PATH . 'reg_admin_details_main_meta_box_attendees.template.php';
1845
-		echo EEH_Template::display_template( $template_path, $this->_template_args, TRUE );
1844
+		$template_path = REG_TEMPLATE_PATH.'reg_admin_details_main_meta_box_attendees.template.php';
1845
+		echo EEH_Template::display_template($template_path, $this->_template_args, TRUE);
1846 1846
 
1847 1847
 	}
1848 1848
 
@@ -1863,14 +1863,14 @@  discard block
 block discarded – undo
1863 1863
 		$attendee = $att_check instanceof EE_Attendee ? $att_check : EEM_Attendee::instance()->create_default_object();
1864 1864
 
1865 1865
 		//now let's determine if this is not the primary registration.  If it isn't then we set the primary_registration object for reference BUT ONLY if the Attendee object loaded is not the same as the primary registration object (that way we know if we need to show create button or not)
1866
-		if ( ! $this->_registration->is_primary_registrant() ) {
1866
+		if ( ! $this->_registration->is_primary_registrant()) {
1867 1867
 
1868 1868
 			$primary_registration = $this->_registration->get_primary_registration();
1869 1869
 			$primary_attendee = $primary_registration instanceof EE_Registration
1870 1870
 				? $primary_registration->attendee()
1871 1871
 				: null;
1872 1872
 
1873
-			if ( ! $primary_attendee instanceof EE_Attendee || $attendee->ID() !== $primary_attendee->ID() ) {
1873
+			if ( ! $primary_attendee instanceof EE_Attendee || $attendee->ID() !== $primary_attendee->ID()) {
1874 1874
 				//in here?  This means the displayed registration is not the primary registrant but ALREADY HAS its own custom attendee object so let's not worry about the primary reg.
1875 1875
 				$primary_registration = NULL;
1876 1876
 			}
@@ -1879,27 +1879,27 @@  discard block
 block discarded – undo
1879 1879
 		}
1880 1880
 
1881 1881
 		$this->_template_args['ATT_ID'] = $attendee->ID();
1882
-		$this->_template_args['fname'] = $attendee->fname();//$this->_registration->ATT_fname;
1883
-		$this->_template_args['lname'] = $attendee->lname();//$this->_registration->ATT_lname;
1884
-		$this->_template_args['email'] = $attendee->email();//$this->_registration->ATT_email;
1882
+		$this->_template_args['fname'] = $attendee->fname(); //$this->_registration->ATT_fname;
1883
+		$this->_template_args['lname'] = $attendee->lname(); //$this->_registration->ATT_lname;
1884
+		$this->_template_args['email'] = $attendee->email(); //$this->_registration->ATT_email;
1885 1885
 		$this->_template_args['phone'] = $attendee->phone();
1886 1886
 
1887
-		$this->_template_args[ 'formatted_address' ] = EEH_Address::format( $attendee );
1887
+		$this->_template_args['formatted_address'] = EEH_Address::format($attendee);
1888 1888
 
1889 1889
 
1890 1890
 		//edit link
1891
-		$this->_template_args['att_edit_link'] = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'edit_attendee', 'post'=>$attendee->ID() ), REG_ADMIN_URL );
1891
+		$this->_template_args['att_edit_link'] = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'edit_attendee', 'post'=>$attendee->ID()), REG_ADMIN_URL);
1892 1892
 		$this->_template_args['att_edit_label'] = __('View/Edit Contact', 'event_espresso');
1893 1893
 
1894 1894
 		//create link
1895
-		$this->_template_args['create_link'] = $primary_registration instanceof EE_Registration ? EE_Admin_Page::add_query_args_and_nonce( array( 'action' => 'duplicate_attendee',  '_REG_ID' => $this->_registration->ID() ), REG_ADMIN_URL ): '';
1895
+		$this->_template_args['create_link'] = $primary_registration instanceof EE_Registration ? EE_Admin_Page::add_query_args_and_nonce(array('action' => 'duplicate_attendee', '_REG_ID' => $this->_registration->ID()), REG_ADMIN_URL) : '';
1896 1896
 		$this->_template_args['create_label'] = __('Create Contact', 'event_espresso');
1897 1897
 
1898 1898
 		$this->_template_args['att_check'] = $att_check;
1899 1899
 
1900 1900
 
1901
-		$template_path = REG_TEMPLATE_PATH . 'reg_admin_details_side_meta_box_registrant.template.php';
1902
-		echo EEH_Template::display_template( $template_path, $this->_template_args, TRUE );
1901
+		$template_path = REG_TEMPLATE_PATH.'reg_admin_details_side_meta_box_registrant.template.php';
1902
+		echo EEH_Template::display_template($template_path, $this->_template_args, TRUE);
1903 1903
 	}
1904 1904
 
1905 1905
 
@@ -1912,7 +1912,7 @@  discard block
 block discarded – undo
1912 1912
 	 * @access protected
1913 1913
 	 * @return void
1914 1914
 	 */
1915
-	protected function _trash_or_restore_registrations( $trash = TRUE ) {
1915
+	protected function _trash_or_restore_registrations($trash = TRUE) {
1916 1916
 		$REGM = EEM_Registration::instance();
1917 1917
 
1918 1918
 		$success = 1;
@@ -1922,26 +1922,26 @@  discard block
 block discarded – undo
1922 1922
 		$dtts = array();
1923 1923
 
1924 1924
 		//if empty _REG_ID then get out because there's nothing to do
1925
-		if ( empty( $this->_req_data['_REG_ID'] ) ) {
1925
+		if (empty($this->_req_data['_REG_ID'])) {
1926 1926
 			$msg = $trash ? __('In order to trash registrations you must select which ones you wish to trash by clicking the checkboxes.', 'event_espresso') : __('In order to restore registrations you must select which ones you wish to restore by clicking the checkboxes.', 'event_espresso');
1927
-			EE_Error::add_error( $msg, __FILE__, __LINE__, __FUNCTION__ );
1928
-			$this->_redirect_after_action(FALSE, '', '', array(), TRUE );
1927
+			EE_Error::add_error($msg, __FILE__, __LINE__, __FUNCTION__);
1928
+			$this->_redirect_after_action(FALSE, '', '', array(), TRUE);
1929 1929
 		}
1930 1930
 
1931 1931
 		//Checkboxes
1932
-		if (!empty($this->_req_data['_REG_ID']) && is_array($this->_req_data['_REG_ID'])) {
1932
+		if ( ! empty($this->_req_data['_REG_ID']) && is_array($this->_req_data['_REG_ID'])) {
1933 1933
 			// if array has more than one element than success message should be plural
1934
-			$success = count( $this->_req_data['_REG_ID'] ) > 1 ? 2 : 1;
1934
+			$success = count($this->_req_data['_REG_ID']) > 1 ? 2 : 1;
1935 1935
 			// cycle thru checkboxes
1936
-			while (list( $ind, $REG_ID ) = each($this->_req_data['_REG_ID'])) {
1936
+			while (list($ind, $REG_ID) = each($this->_req_data['_REG_ID'])) {
1937 1937
 				/** @var EE_Registration $REG */
1938
-				$REG = $REGM->get_one_by_ID( $REG_ID);
1938
+				$REG = $REGM->get_one_by_ID($REG_ID);
1939 1939
 				$payment_count = $REG->get_first_related('Transaction')->count_related('Payment');
1940
-				if ( $payment_count > 0 ) {
1941
-					$name = $REG->attendee() instanceof EE_Attendee ? $REG->attendee()->full_name() : __( 'Unknown Attendee', 'event_espresso' );
1940
+				if ($payment_count > 0) {
1941
+					$name = $REG->attendee() instanceof EE_Attendee ? $REG->attendee()->full_name() : __('Unknown Attendee', 'event_espresso');
1942 1942
 					$error = 1;
1943 1943
 					$success = 0;
1944
-					EE_Error::add_error( sprintf( __('The registration for %s could not be trashed because it has payments attached to the related transaction.  If you wish to trash this registration you must first delete the payments on the related transaction.', 'event_espresso'), $name ), __FILE__, __FUNCTION__, __LINE__ );
1944
+					EE_Error::add_error(sprintf(__('The registration for %s could not be trashed because it has payments attached to the related transaction.  If you wish to trash this registration you must first delete the payments on the related transaction.', 'event_espresso'), $name), __FILE__, __FUNCTION__, __LINE__);
1945 1945
 					continue; //can't trash this registration because it has payments.
1946 1946
 				}
1947 1947
 				$ticket = $REG->get_first_related('Ticket');
@@ -1950,7 +1950,7 @@  discard block
 block discarded – undo
1950 1950
 				$dtts = array_merge($dtts, $dtt);
1951 1951
 
1952 1952
 				$updated = $trash ? $REG->delete() : $REG->restore();
1953
-				if ( !$updated ) {
1953
+				if ( ! $updated) {
1954 1954
 					$success = 0;
1955 1955
 				} else {
1956 1956
 					$success = 2;
@@ -1965,7 +1965,7 @@  discard block
 block discarded – undo
1965 1965
 			$tickets[$ticket->ID()] = $ticket;
1966 1966
 			$dtts = $ticket->get_many_related('Datetime');
1967 1967
 			$updated = $trash ? $REG->delete() : $REG->restore();
1968
-			if ( ! $updated ) {
1968
+			if ( ! $updated) {
1969 1969
 				$success = 0;
1970 1970
 			}
1971 1971
 
@@ -1975,10 +1975,10 @@  discard block
 block discarded – undo
1975 1975
 		EEM_Ticket::instance()->update_tickets_sold($tickets);
1976 1976
 		EEM_Datetime::instance()->update_sold($dtts);
1977 1977
 
1978
-		$what = $success > 1 ? __( 'Registrations', 'event_espresso' ) : __( 'Registration', 'event_espresso' );
1979
-		$action_desc = $trash ? __( 'moved to the trash', 'event_espresso' ) : __( 'restored', 'event_espresso' );
1978
+		$what = $success > 1 ? __('Registrations', 'event_espresso') : __('Registration', 'event_espresso');
1979
+		$action_desc = $trash ? __('moved to the trash', 'event_espresso') : __('restored', 'event_espresso');
1980 1980
 		$overwrite_msgs = $error ? TRUE : FALSE;
1981
-		$this->_redirect_after_action( $success, $what, $action_desc, array( 'action' => 'default' ), $overwrite_msgs );
1981
+		$this->_redirect_after_action($success, $what, $action_desc, array('action' => 'default'), $overwrite_msgs);
1982 1982
 	}
1983 1983
 
1984 1984
 
@@ -2002,16 +2002,16 @@  discard block
 block discarded – undo
2002 2002
 		$success = 1;
2003 2003
 
2004 2004
 		//Checkboxes
2005
-		if (!empty($this->_req_data['_REG_ID']) && is_array($this->_req_data['_REG_ID'])) {
2005
+		if ( ! empty($this->_req_data['_REG_ID']) && is_array($this->_req_data['_REG_ID'])) {
2006 2006
 			// if array has more than one element than success message should be plural
2007
-			$success = count( $this->_req_data['_REG_ID'] ) > 1 ? 2 : 1;
2007
+			$success = count($this->_req_data['_REG_ID']) > 1 ? 2 : 1;
2008 2008
 			// cycle thru checkboxes
2009
-			while (list( $ind, $REG_ID ) = each($this->_req_data['_REG_ID'])) {
2009
+			while (list($ind, $REG_ID) = each($this->_req_data['_REG_ID'])) {
2010 2010
 				$REG = $REG_MDL->get_one_by_ID($REG_ID);
2011
-				if ( ! $REG instanceof EE_Registration )
2011
+				if ( ! $REG instanceof EE_Registration)
2012 2012
 					continue;
2013 2013
 				$deleted = $this->_delete_registration($REG);
2014
-				if ( !$deleted ) {
2014
+				if ( ! $deleted) {
2015 2015
 					$success = 0;
2016 2016
 				}
2017 2017
 			}
@@ -2021,15 +2021,15 @@  discard block
 block discarded – undo
2021 2021
 			$REG_ID = $this->_req_data['_REG_ID'];
2022 2022
 			$REG = $REG_MDL->get_one_by_ID($REG_ID);
2023 2023
 			$deleted = $this->_delete_registration($REG);
2024
-			if ( ! $deleted ) {
2024
+			if ( ! $deleted) {
2025 2025
 				$success = 0;
2026 2026
 			}
2027 2027
 
2028 2028
 		}
2029 2029
 
2030
-		$what = $success > 1 ? __( 'Registrations', 'event_espresso' ) : __( 'Registration', 'event_espresso' );
2031
-		$action_desc = __( 'permanently deleted.', 'event_espresso' );
2032
-		$this->_redirect_after_action( $success, $what, $action_desc, array( 'action' => 'default' ), TRUE );
2030
+		$what = $success > 1 ? __('Registrations', 'event_espresso') : __('Registration', 'event_espresso');
2031
+		$action_desc = __('permanently deleted.', 'event_espresso');
2032
+		$this->_redirect_after_action($success, $what, $action_desc, array('action' => 'default'), TRUE);
2033 2033
 	}
2034 2034
 
2035 2035
 
@@ -2041,31 +2041,31 @@  discard block
 block discarded – undo
2041 2041
 	 * @param  EE_Registration $REG registration to be deleted permenantly
2042 2042
 	 * @return boolean              true = successful deletion, false = fail.
2043 2043
 	 */
2044
-	protected function _delete_registration( EE_Registration $REG ) {
2044
+	protected function _delete_registration(EE_Registration $REG) {
2045 2045
 		//first we start with the transaction... ultimately, we WILL not delete permanently if there are any related registrations on the transaction that are NOT trashed.
2046 2046
 		$TXN = $REG->get_first_related('Transaction');
2047 2047
 		$REGS = $TXN->get_many_related('Registration');
2048 2048
 
2049 2049
 		$all_trashed = TRUE;
2050
-		foreach ( $REGS as $registration ) {
2051
-			if ( ! $registration->get('REG_deleted') )
2050
+		foreach ($REGS as $registration) {
2051
+			if ( ! $registration->get('REG_deleted'))
2052 2052
 				$all_trashed = FALSE;
2053 2053
 		}
2054 2054
 
2055
-		if ( ! $all_trashed ) {
2056
-			EE_Error::add_error( __('Unable to permanently delete this registration. Before this registration can be permanently deleted, all registrations made in the same transaction must be trashed as well.  These registrations will be permanently deleted in the same action.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ );
2055
+		if ( ! $all_trashed) {
2056
+			EE_Error::add_error(__('Unable to permanently delete this registration. Before this registration can be permanently deleted, all registrations made in the same transaction must be trashed as well.  These registrations will be permanently deleted in the same action.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
2057 2057
 			return false;
2058 2058
 		}
2059 2059
 
2060 2060
 		//k made it here so that means we can delete all the related transactions and their answers (but let's do them separately from THIS one).
2061
-		foreach ( $REGS as $registration ) {
2061
+		foreach ($REGS as $registration) {
2062 2062
 
2063 2063
 			//delete related answers
2064 2064
 			$registration->delete_related_permanently('Answer');
2065 2065
 
2066 2066
 			//remove relationship to EE_Attendee (but we ALWAYS leave the contact record intact)
2067 2067
 			$attendee = $registration->get_first_related('Attendee');
2068
-			if ( $attendee instanceof EE_Attendee ) {
2068
+			if ($attendee instanceof EE_Attendee) {
2069 2069
 				$registration->_remove_relation_to($attendee, 'Attendee');
2070 2070
 			}
2071 2071
 
@@ -2075,7 +2075,7 @@  discard block
 block discarded – undo
2075 2075
 			//now delete permanently the checkins related to this registration.
2076 2076
 			$registration->delete_related_permanently('Checkin');
2077 2077
 
2078
-			if ( $registration->ID() === $REG->ID() )
2078
+			if ($registration->ID() === $REG->ID())
2079 2079
 				continue; //we don't want to delete permanently the existing registration just yet.
2080 2080
 
2081 2081
 			//remove relation to transaction for these registrations if NOT the existing registrations
@@ -2108,35 +2108,35 @@  discard block
 block discarded – undo
2108 2108
 	 * @return void
2109 2109
 	 */
2110 2110
 	public function new_registration() {
2111
-		if ( ! $this->_set_reg_event() ) {
2112
-			throw new EE_Error(__('Unable to continue with registering because there is no Event ID in the request', 'event_espresso') );
2111
+		if ( ! $this->_set_reg_event()) {
2112
+			throw new EE_Error(__('Unable to continue with registering because there is no Event ID in the request', 'event_espresso'));
2113 2113
 		}
2114
-		EE_Registry::instance()->REQ->set_espresso_page( TRUE );
2114
+		EE_Registry::instance()->REQ->set_espresso_page(TRUE);
2115 2115
 		// gotta start with a clean slate if we're not coming here via ajax
2116 2116
 		if (
2117
-			! defined('DOING_AJAX' )
2118
-			&& ( ! isset( $this->_req_data['processing_registration'] ) || isset( $this->_req_data['step_error'] ) )
2117
+			! defined('DOING_AJAX')
2118
+			&& ( ! isset($this->_req_data['processing_registration']) || isset($this->_req_data['step_error']))
2119 2119
 		) {
2120
-			EE_Registry::instance()->SSN->clear_session( __CLASS__, __FUNCTION__ );
2120
+			EE_Registry::instance()->SSN->clear_session(__CLASS__, __FUNCTION__);
2121 2121
 		}
2122 2122
 
2123
-		$this->_template_args['event_name'] = '' ;
2123
+		$this->_template_args['event_name'] = '';
2124 2124
 		// event name
2125
-		if ( $this->_reg_event ) {
2125
+		if ($this->_reg_event) {
2126 2126
 			$this->_template_args['event_name'] = $this->_reg_event->name();
2127
-			$edit_event_url = self::add_query_args_and_nonce( array( 'action'=>'edit', 'post'=>$this->_reg_event->ID() ), EVENTS_ADMIN_URL );
2128
-			$edit_event_lnk = '<a href="'.$edit_event_url.'" title="' . esc_attr__( 'Edit ', 'event_espresso' ) . $this->_reg_event->name() . '">' . __( 'Edit Event', 'event_espresso' ) . '</a>';
2129
-			$this->_template_args['event_name'] .= ' <span class="admin-page-header-edit-lnk not-bold">' . $edit_event_lnk . '</span>' ;
2127
+			$edit_event_url = self::add_query_args_and_nonce(array('action'=>'edit', 'post'=>$this->_reg_event->ID()), EVENTS_ADMIN_URL);
2128
+			$edit_event_lnk = '<a href="'.$edit_event_url.'" title="'.esc_attr__('Edit ', 'event_espresso').$this->_reg_event->name().'">'.__('Edit Event', 'event_espresso').'</a>';
2129
+			$this->_template_args['event_name'] .= ' <span class="admin-page-header-edit-lnk not-bold">'.$edit_event_lnk.'</span>';
2130 2130
 		}
2131 2131
 
2132 2132
 		$this->_template_args['step_content'] = $this->_get_registration_step_content();
2133 2133
 
2134
-		if ( defined('DOING_AJAX' ) ) {
2134
+		if (defined('DOING_AJAX')) {
2135 2135
 			$this->_return_json();
2136 2136
 		}
2137 2137
 		// grab header
2138
-		$template_path = REG_TEMPLATE_PATH . 'reg_admin_register_new_attendee.template.php';
2139
-		$this->_template_args['admin_page_content'] = EEH_Template::display_template( $template_path, $this->_template_args, TRUE );
2138
+		$template_path = REG_TEMPLATE_PATH.'reg_admin_register_new_attendee.template.php';
2139
+		$this->_template_args['admin_page_content'] = EEH_Template::display_template($template_path, $this->_template_args, TRUE);
2140 2140
 
2141 2141
 		//$this->_set_publish_post_box_vars( NULL, FALSE, FALSE, NULL, FALSE );
2142 2142
 		// the details template wrapper
@@ -2153,7 +2153,7 @@  discard block
 block discarded – undo
2153 2153
 	 * @return string html
2154 2154
 	 */
2155 2155
 	protected function _get_registration_step_content() {
2156
-		if ( isset( $_COOKIE[ 'ee_registration_added' ] ) && $_COOKIE[ 'ee_registration_added' ] ) {
2156
+		if (isset($_COOKIE['ee_registration_added']) && $_COOKIE['ee_registration_added']) {
2157 2157
 			$warning_msg = sprintf(
2158 2158
 				__(
2159 2159
 					'%2$sWARNING!!!%3$s%1$sPlease do not use the back button to return to this page for the purpose of adding another registration.%1$sThis can result in lost and/or corrupted data.%1$sIf you wish to add another registration, then please click the%1$s%7$s"Add Another New Registration to Event"%8$s button%1$son the Transaction details page, after you are redirected.%1$s%1$s%4$s redirecting in %5$s seconds %6$s',
@@ -2169,7 +2169,7 @@  discard block
 block discarded – undo
2169 2169
 				'</b>'
2170 2170
 			);
2171 2171
 			return '
2172
-	<div id="ee-add-reg-back-button-dv"><p>' . $warning_msg . '</p></div>
2172
+	<div id="ee-add-reg-back-button-dv"><p>' . $warning_msg.'</p></div>
2173 2173
 	<script >
2174 2174
 		// WHOAH !!! it appears that someone is using the back button from the Transaction admin page
2175 2175
 		// after just adding a new registration... we gotta try to put a stop to that !!!
@@ -2204,16 +2204,16 @@  discard block
 block discarded – undo
2204 2204
 		$cart = EE_Registry::instance()->SSN->cart();
2205 2205
 		$step = ! $cart instanceof EE_Cart ? 'ticket' : 'questions';
2206 2206
 
2207
-		switch ( $step ) {
2207
+		switch ($step) {
2208 2208
 			case 'ticket' :
2209 2209
 				$hidden_fields['processing_registration']['value'] = 1;
2210 2210
 				$template_args['title'] = __('Step One: Select the Ticket for this registration', 'event_espresso');
2211
-				$template_args['content'] = EED_Ticket_Selector::instance()->display_ticket_selector( $this->_reg_event );
2211
+				$template_args['content'] = EED_Ticket_Selector::instance()->display_ticket_selector($this->_reg_event);
2212 2212
 				$template_args['step_button_text'] = __('Add Tickets and Continue to Registrant Details', 'event_espresso');
2213 2213
 				$template_args['show_notification_toggle'] = FALSE;
2214 2214
 				break;
2215 2215
 			case 'questions' :
2216
-				$hidden_fields[ 'processing_registration' ][ 'value' ] = 2;
2216
+				$hidden_fields['processing_registration']['value'] = 2;
2217 2217
 				$template_args['title'] = __('Step Two: Add Registrant Details for this Registration', 'event_espresso');
2218 2218
 				//in theory we should be able to run EED_SPCO at this point because the cart should have been setup properly by the first process_reg_step run.
2219 2219
 				$template_args['content'] = EED_Single_Page_Checkout::registration_checkout_for_admin();
@@ -2222,10 +2222,10 @@  discard block
 block discarded – undo
2222 2222
 				break;
2223 2223
 		}
2224 2224
 
2225
-		$this->_set_add_edit_form_tags( 'process_reg_step', $hidden_fields ); //we come back to the process_registration_step route.
2225
+		$this->_set_add_edit_form_tags('process_reg_step', $hidden_fields); //we come back to the process_registration_step route.
2226 2226
 
2227 2227
 		return EEH_Template::display_template(
2228
-			REG_TEMPLATE_PATH . 'reg_admin_register_new_attendee_step_content.template.php', $template_args, TRUE
2228
+			REG_TEMPLATE_PATH.'reg_admin_register_new_attendee_step_content.template.php', $template_args, TRUE
2229 2229
 		);
2230 2230
 	}
2231 2231
 
@@ -2240,11 +2240,11 @@  discard block
 block discarded – undo
2240 2240
 	*		@return boolean
2241 2241
 	*/
2242 2242
 	private function _set_reg_event() {
2243
-		if ( is_object( $this->_reg_event )) {
2243
+		if (is_object($this->_reg_event)) {
2244 2244
 			return TRUE;
2245 2245
 		}
2246
-		$EVT_ID = ( ! empty( $this->_req_data['event_id'] )) ? absint( $this->_req_data['event_id'] ) : FALSE;
2247
-		if ( ! $EVT_ID ) {
2246
+		$EVT_ID = ( ! empty($this->_req_data['event_id'])) ? absint($this->_req_data['event_id']) : FALSE;
2247
+		if ( ! $EVT_ID) {
2248 2248
 			return FALSE;
2249 2249
 		}
2250 2250
 
@@ -2265,82 +2265,82 @@  discard block
 block discarded – undo
2265 2265
 	public function process_reg_step() {
2266 2266
 		EE_System::do_not_cache();
2267 2267
 		$this->_set_reg_event();
2268
-		EE_Registry::instance()->REQ->set_espresso_page( TRUE );
2268
+		EE_Registry::instance()->REQ->set_espresso_page(TRUE);
2269 2269
 
2270 2270
 		//what step are we on?
2271 2271
 		$cart = EE_Registry::instance()->SSN->cart();
2272 2272
 		$step = ! $cart instanceof EE_Cart ? 'ticket' : 'questions';
2273 2273
 
2274 2274
 		//if doing ajax then we need to verify the nonce
2275
-		if ( defined( 'DOING_AJAX' ) ) {
2276
-			$nonce = isset( $this->_req_data[$this->_req_nonce] ) ? sanitize_text_field( $this->_req_data[$this->_req_nonce] ) : '';
2277
-			$this->_verify_nonce( $nonce, $this->_req_nonce );
2275
+		if (defined('DOING_AJAX')) {
2276
+			$nonce = isset($this->_req_data[$this->_req_nonce]) ? sanitize_text_field($this->_req_data[$this->_req_nonce]) : '';
2277
+			$this->_verify_nonce($nonce, $this->_req_nonce);
2278 2278
 		}
2279 2279
 
2280
-		switch ( $step ) {
2280
+		switch ($step) {
2281 2281
 
2282 2282
 			case 'ticket' :
2283 2283
 				//process ticket selection
2284 2284
 				$success = EED_Ticket_Selector::instance()->process_ticket_selections();
2285
-				if ( $success ) {
2286
-					EE_Error::add_success( __('Tickets Selected. Now complete the registration.'), 'event_espresso');
2285
+				if ($success) {
2286
+					EE_Error::add_success(__('Tickets Selected. Now complete the registration.'), 'event_espresso');
2287 2287
 				} else {
2288 2288
 					$query_args['step_error'] = $this->_req_data['step_error'] = TRUE;
2289 2289
 				}
2290
-				if ( defined('DOING_AJAX') ) {
2290
+				if (defined('DOING_AJAX')) {
2291 2291
 					$this->new_registration(); //display next step
2292 2292
 				} else {
2293 2293
 					$query_args['action'] = 'new_registration';
2294 2294
 					$query_args['processing_registration'] = 1;
2295 2295
 					$query_args['event_id'] = $this->_reg_event->ID();
2296
-					$this->_redirect_after_action( FALSE, '', '', $query_args, TRUE );
2296
+					$this->_redirect_after_action(FALSE, '', '', $query_args, TRUE);
2297 2297
 				}
2298 2298
 				break;
2299 2299
 
2300 2300
 			case 'questions' :
2301
-				if( ! isset( $this->_req_data[ 'txn_reg_status_change' ], $this->_req_data[ 'txn_reg_status_change' ][ 'send_notifications' ] ) ) {
2302
-					add_filter( 'FHEE__EED_Messages___maybe_registration__deliver_notifications', '__return_false', 15 );
2301
+				if ( ! isset($this->_req_data['txn_reg_status_change'], $this->_req_data['txn_reg_status_change']['send_notifications'])) {
2302
+					add_filter('FHEE__EED_Messages___maybe_registration__deliver_notifications', '__return_false', 15);
2303 2303
 				}
2304 2304
 				//process registration
2305 2305
 				$transaction = EED_Single_Page_Checkout::instance()->process_registration_from_admin();
2306
-				if ( $cart instanceof EE_Cart ) {
2306
+				if ($cart instanceof EE_Cart) {
2307 2307
 					$grand_total = $cart->get_cart_grand_total();
2308
-					if ( $grand_total instanceof EE_Line_Item ) {
2308
+					if ($grand_total instanceof EE_Line_Item) {
2309 2309
 						$grand_total->save_this_and_descendants_to_txn();
2310 2310
 					}
2311 2311
 				}
2312
-				if ( ! $transaction instanceof EE_Transaction ) {
2312
+				if ( ! $transaction instanceof EE_Transaction) {
2313 2313
 					$query_args = array(
2314 2314
 						'action' => 'new_registration',
2315 2315
 						'processing_registration' => 2,
2316 2316
 						'event_id' => $this->_reg_event->ID()
2317 2317
 					);
2318 2318
 
2319
-					if ( defined('DOING_AJAX' )) {
2319
+					if (defined('DOING_AJAX')) {
2320 2320
 						//display registration form again because there are errors (maybe validation?)
2321 2321
 						$this->new_registration();
2322 2322
 						return;
2323 2323
 					} else {
2324
-						$this->_redirect_after_action( FALSE, '', '', $query_args, TRUE );
2324
+						$this->_redirect_after_action(FALSE, '', '', $query_args, TRUE);
2325 2325
 						return;
2326 2326
 					}
2327 2327
 				}
2328 2328
 				/** @type EE_Transaction_Payments $transaction_payments */
2329
-				$transaction_payments = EE_Registry::instance()->load_class( 'Transaction_Payments' );
2329
+				$transaction_payments = EE_Registry::instance()->load_class('Transaction_Payments');
2330 2330
 				// maybe update status, and make sure to save transaction if not done already
2331
-				if ( ! $transaction_payments->update_transaction_status_based_on_total_paid( $transaction )) {
2331
+				if ( ! $transaction_payments->update_transaction_status_based_on_total_paid($transaction)) {
2332 2332
 					$transaction->save();
2333 2333
 				}
2334
-				EE_Registry::instance()->SSN->clear_session( __CLASS__, __FUNCTION__ );
2334
+				EE_Registry::instance()->SSN->clear_session(__CLASS__, __FUNCTION__);
2335 2335
 				$this->_req_data = array();
2336 2336
 				$query_args = array(
2337 2337
 					'action'        => 'redirect_to_txn',
2338 2338
 					'TXN_ID'        => $transaction->ID(),
2339 2339
 					'EVT_ID'        => $this->_reg_event->ID(),
2340
-					'event_name'    => urlencode( $this->_reg_event->name() ),
2340
+					'event_name'    => urlencode($this->_reg_event->name()),
2341 2341
 					'redirect_from' => 'new_registration'
2342 2342
 				);
2343
-				$this->_redirect_after_action( false, '', '', $query_args, true );
2343
+				$this->_redirect_after_action(false, '', '', $query_args, true);
2344 2344
 				break;
2345 2345
 		}
2346 2346
 
@@ -2357,21 +2357,21 @@  discard block
 block discarded – undo
2357 2357
 	 */
2358 2358
 	public function redirect_to_txn() {
2359 2359
 		EE_System::do_not_cache();
2360
-		EE_Registry::instance()->SSN->clear_session( __CLASS__, __FUNCTION__ );
2360
+		EE_Registry::instance()->SSN->clear_session(__CLASS__, __FUNCTION__);
2361 2361
 		$query_args = array(
2362 2362
 			'action' => 'view_transaction',
2363
-			'TXN_ID' => isset( $this->_req_data['TXN_ID'] ) ? absint( $this->_req_data[ 'TXN_ID' ] )  : 0,
2363
+			'TXN_ID' => isset($this->_req_data['TXN_ID']) ? absint($this->_req_data['TXN_ID']) : 0,
2364 2364
 			'page'   => 'espresso_transactions'
2365 2365
 		);
2366
-		if ( isset( $this->_req_data[ 'EVT_ID' ], $this->_req_data[ 'redirect_from' ] ) ) {
2367
-			$query_args['EVT_ID'] = $this->_req_data[ 'EVT_ID' ];
2368
-			$query_args['event_name'] = urlencode( $this->_req_data[ 'event_name' ] );
2369
-			$query_args['redirect_from'] = $this->_req_data[ 'redirect_from' ];
2366
+		if (isset($this->_req_data['EVT_ID'], $this->_req_data['redirect_from'])) {
2367
+			$query_args['EVT_ID'] = $this->_req_data['EVT_ID'];
2368
+			$query_args['event_name'] = urlencode($this->_req_data['event_name']);
2369
+			$query_args['redirect_from'] = $this->_req_data['redirect_from'];
2370 2370
 		}
2371 2371
 		EE_Error::add_success(
2372
-			__( 'Registration Created.  Please review the transaction and add any payments as necessary', 'event_espresso' )
2372
+			__('Registration Created.  Please review the transaction and add any payments as necessary', 'event_espresso')
2373 2373
 		);
2374
-		$this->_redirect_after_action( false, '', '', $query_args, true );
2374
+		$this->_redirect_after_action(false, '', '', $query_args, true);
2375 2375
 	}
2376 2376
 
2377 2377
 
@@ -2382,7 +2382,7 @@  discard block
 block discarded – undo
2382 2382
 	*		@return void
2383 2383
 	*/
2384 2384
 	protected function _attendee_contact_list_table() {
2385
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
2385
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
2386 2386
 		$this->_search_btn_label = __('Contacts', 'event_espresso');
2387 2387
 		$this->display_admin_list_table_page_with_no_sidebar();
2388 2388
 	}
@@ -2397,10 +2397,10 @@  discard block
 block discarded – undo
2397 2397
 	*		@access public
2398 2398
 	*		@return array
2399 2399
 	*/
2400
-	public function get_attendees( $per_page, $count = FALSE, $trash = FALSE ) {
2400
+	public function get_attendees($per_page, $count = FALSE, $trash = FALSE) {
2401 2401
 
2402
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
2403
-		require_once( REG_ADMIN . 'EE_Attendee_Contact_List_Table.class.php' );
2402
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
2403
+		require_once(REG_ADMIN.'EE_Attendee_Contact_List_Table.class.php');
2404 2404
 		$ATT_MDL = EEM_Attendee::instance();
2405 2405
 
2406 2406
 		$this->_req_data['orderby'] = ! empty($this->_req_data['orderby']) ? $this->_req_data['orderby'] : '';
@@ -2428,47 +2428,47 @@  discard block
 block discarded – undo
2428 2428
 				$orderby = 'ATT_lname';
2429 2429
 		}
2430 2430
 
2431
-		$sort = ( isset( $this->_req_data['order'] ) && ! empty( $this->_req_data['order'] )) ? $this->_req_data['order'] : 'ASC';
2431
+		$sort = (isset($this->_req_data['order']) && ! empty($this->_req_data['order'])) ? $this->_req_data['order'] : 'ASC';
2432 2432
 
2433
-		$current_page = isset( $this->_req_data['paged'] ) && !empty( $this->_req_data['paged'] ) ? $this->_req_data['paged'] : 1;
2434
-		$per_page = isset( $per_page ) && !empty( $per_page ) ? $per_page : 10;
2435
-		$per_page = isset( $this->_req_data['perpage'] ) && !empty( $this->_req_data['perpage'] ) ? $this->_req_data['perpage'] : $per_page;
2433
+		$current_page = isset($this->_req_data['paged']) && ! empty($this->_req_data['paged']) ? $this->_req_data['paged'] : 1;
2434
+		$per_page = isset($per_page) && ! empty($per_page) ? $per_page : 10;
2435
+		$per_page = isset($this->_req_data['perpage']) && ! empty($this->_req_data['perpage']) ? $this->_req_data['perpage'] : $per_page;
2436 2436
 
2437 2437
 		$_where = array();
2438 2438
 
2439
-		if ( isset( $this->_req_data['s'] ) ) {
2440
-			$sstr = '%' . $this->_req_data['s'] . '%';
2439
+		if (isset($this->_req_data['s'])) {
2440
+			$sstr = '%'.$this->_req_data['s'].'%';
2441 2441
 			$_where['OR'] = array(
2442
-				'Registration.Event.EVT_name' => array( 'LIKE', $sstr),
2443
-				'Registration.Event.EVT_desc' => array( 'LIKE', $sstr ),
2444
-				'Registration.Event.EVT_short_desc' => array( 'LIKE' , $sstr ),
2445
-				'ATT_fname' => array( 'LIKE', $sstr ),
2446
-				'ATT_lname' => array( 'LIKE', $sstr ),
2447
-				'ATT_short_bio' => array( 'LIKE', $sstr ),
2448
-				'ATT_email' => array('LIKE', $sstr ),
2449
-				'ATT_address' => array( 'LIKE', $sstr ),
2450
-				'ATT_address2' => array( 'LIKE', $sstr ),
2451
-				'ATT_city' => array( 'LIKE', $sstr ),
2452
-				'Country.CNT_name' => array( 'LIKE', $sstr ),
2453
-				'State.STA_name' => array('LIKE', $sstr ),
2454
-				'ATT_phone' => array( 'LIKE', $sstr ),
2455
-				'Registration.REG_final_price' => array( 'LIKE', $sstr ),
2456
-				'Registration.REG_code' => array( 'LIKE', $sstr ),
2457
-				'Registration.REG_count' => array( 'LIKE' , $sstr ),
2458
-				'Registration.REG_group_size' => array( 'LIKE' , $sstr )
2442
+				'Registration.Event.EVT_name' => array('LIKE', $sstr),
2443
+				'Registration.Event.EVT_desc' => array('LIKE', $sstr),
2444
+				'Registration.Event.EVT_short_desc' => array('LIKE', $sstr),
2445
+				'ATT_fname' => array('LIKE', $sstr),
2446
+				'ATT_lname' => array('LIKE', $sstr),
2447
+				'ATT_short_bio' => array('LIKE', $sstr),
2448
+				'ATT_email' => array('LIKE', $sstr),
2449
+				'ATT_address' => array('LIKE', $sstr),
2450
+				'ATT_address2' => array('LIKE', $sstr),
2451
+				'ATT_city' => array('LIKE', $sstr),
2452
+				'Country.CNT_name' => array('LIKE', $sstr),
2453
+				'State.STA_name' => array('LIKE', $sstr),
2454
+				'ATT_phone' => array('LIKE', $sstr),
2455
+				'Registration.REG_final_price' => array('LIKE', $sstr),
2456
+				'Registration.REG_code' => array('LIKE', $sstr),
2457
+				'Registration.REG_count' => array('LIKE', $sstr),
2458
+				'Registration.REG_group_size' => array('LIKE', $sstr)
2459 2459
 				);
2460 2460
 		}
2461 2461
 
2462 2462
 
2463
-		$offset = ($current_page-1)*$per_page;
2464
-		$limit = $count ? NULL : array( $offset, $per_page );
2463
+		$offset = ($current_page - 1) * $per_page;
2464
+		$limit = $count ? NULL : array($offset, $per_page);
2465 2465
 
2466
-		if ( $trash ) {
2467
-			$_where['status'] = array( '!=', 'publish' );
2468
-			$all_attendees = $count ? $ATT_MDL->count( array($_where,'order_by'=>array($orderby=>$sort), 'limit'=>$limit)): $ATT_MDL->get_all( array($_where,'order_by'=>array($orderby=>$sort), 'limit'=>$limit));
2466
+		if ($trash) {
2467
+			$_where['status'] = array('!=', 'publish');
2468
+			$all_attendees = $count ? $ATT_MDL->count(array($_where, 'order_by'=>array($orderby=>$sort), 'limit'=>$limit)) : $ATT_MDL->get_all(array($_where, 'order_by'=>array($orderby=>$sort), 'limit'=>$limit));
2469 2469
 		} else {
2470
-			$_where['status'] = array( 'IN', array( 'publish' ) );
2471
-			$all_attendees = $count ? $ATT_MDL->count( array($_where, 'order_by'=>array($orderby=>$sort),'limit'=>$limit)) : $ATT_MDL->get_all( array($_where, 'order_by'=>array($orderby=>$sort), 'limit'=>$limit) );
2470
+			$_where['status'] = array('IN', array('publish'));
2471
+			$all_attendees = $count ? $ATT_MDL->count(array($_where, 'order_by'=>array($orderby=>$sort), 'limit'=>$limit)) : $ATT_MDL->get_all(array($_where, 'order_by'=>array($orderby=>$sort), 'limit'=>$limit));
2472 2472
 		}
2473 2473
 
2474 2474
 		return $all_attendees;
@@ -2485,10 +2485,10 @@  discard block
 block discarded – undo
2485 2485
 	 */
2486 2486
 	protected function _resend_registration() {
2487 2487
 		$this->_process_resend_registration();
2488
-		$query_args = isset($this->_req_data['redirect_to'] ) ? array('action' => $this->_req_data['redirect_to'], '_REG_ID' => $this->_req_data['_REG_ID'] ) : array(
2488
+		$query_args = isset($this->_req_data['redirect_to']) ? array('action' => $this->_req_data['redirect_to'], '_REG_ID' => $this->_req_data['_REG_ID']) : array(
2489 2489
 			'action' => 'default'
2490 2490
 		);
2491
-		$this->_redirect_after_action(FALSE, '', '', $query_args, TRUE );
2491
+		$this->_redirect_after_action(FALSE, '', '', $query_args, TRUE);
2492 2492
 	}
2493 2493
 
2494 2494
 
@@ -2496,26 +2496,26 @@  discard block
 block discarded – undo
2496 2496
 
2497 2497
 
2498 2498
 
2499
-	public function _registrations_report(){
2500
-		if( ! defined( 'EE_USE_OLD_CSV_REPORT_CLASS' ) ) {
2501
-			wp_redirect( EE_Admin_Page::add_query_args_and_nonce(
2499
+	public function _registrations_report() {
2500
+		if ( ! defined('EE_USE_OLD_CSV_REPORT_CLASS')) {
2501
+			wp_redirect(EE_Admin_Page::add_query_args_and_nonce(
2502 2502
 				array(
2503 2503
 					'page' => 'espresso_batch',
2504 2504
 					'batch' => 'file',
2505
-					'EVT_ID' => isset( $this->_req_data[ 'EVT_ID'] ) ? $this->_req_data[ 'EVT_ID' ] : NULL,
2506
-					'job_handler' => urlencode( 'EventEspressoBatchRequest\JobHandlers\RegistrationsReport' ),
2507
-					'return_url' => urlencode( $this->_req_data[ 'return_url' ] ),
2508
-				)) );
2505
+					'EVT_ID' => isset($this->_req_data['EVT_ID']) ? $this->_req_data['EVT_ID'] : NULL,
2506
+					'job_handler' => urlencode('EventEspressoBatchRequest\JobHandlers\RegistrationsReport'),
2507
+					'return_url' => urlencode($this->_req_data['return_url']),
2508
+				)));
2509 2509
 		} else {
2510 2510
 			$new_request_args = array(
2511 2511
 				'export' => 'report',
2512 2512
 				'action' => 'registrations_report_for_event',
2513
-				'EVT_ID' => isset( $this->_req_data[ 'EVT_ID'] ) ? $this->_req_data[ 'EVT_ID' ] : NULL,
2513
+				'EVT_ID' => isset($this->_req_data['EVT_ID']) ? $this->_req_data['EVT_ID'] : NULL,
2514 2514
 			);
2515 2515
 			$this->_req_data = array_merge($this->_req_data, $new_request_args);
2516 2516
 
2517
-			if ( is_readable(EE_CLASSES . 'EE_Export.class.php')) {
2518
-				require_once(EE_CLASSES . 'EE_Export.class.php');
2517
+			if (is_readable(EE_CLASSES.'EE_Export.class.php')) {
2518
+				require_once(EE_CLASSES.'EE_Export.class.php');
2519 2519
 				$EE_Export = EE_Export::instance($this->_req_data);
2520 2520
 				$EE_Export->export();
2521 2521
 			}
@@ -2524,26 +2524,26 @@  discard block
 block discarded – undo
2524 2524
 
2525 2525
 
2526 2526
 
2527
-	public function _contact_list_export(){
2528
-		if ( is_readable(EE_CLASSES . 'EE_Export.class.php')) {
2529
-			require_once(EE_CLASSES . 'EE_Export.class.php');
2527
+	public function _contact_list_export() {
2528
+		if (is_readable(EE_CLASSES.'EE_Export.class.php')) {
2529
+			require_once(EE_CLASSES.'EE_Export.class.php');
2530 2530
 			$EE_Export = EE_Export::instance($this->_req_data);
2531 2531
 			$EE_Export->export_attendees();
2532 2532
 		}
2533 2533
 	}
2534 2534
 
2535
-	public function _contact_list_report(){
2536
-		if( ! defined( 'EE_USE_OLD_CSV_REPORT_CLASS' ) ) {
2537
-			wp_redirect( EE_Admin_Page::add_query_args_and_nonce(
2535
+	public function _contact_list_report() {
2536
+		if ( ! defined('EE_USE_OLD_CSV_REPORT_CLASS')) {
2537
+			wp_redirect(EE_Admin_Page::add_query_args_and_nonce(
2538 2538
 				array(
2539 2539
 					'page' => 'espresso_batch',
2540 2540
 					'batch' => 'file',
2541
-					'job_handler' => urlencode( 'EventEspressoBatchRequest\JobHandlers\AttendeesReport' ),
2542
-					'return_url' => urlencode( $this->_req_data[ 'return_url' ] ),
2543
-				)) );
2541
+					'job_handler' => urlencode('EventEspressoBatchRequest\JobHandlers\AttendeesReport'),
2542
+					'return_url' => urlencode($this->_req_data['return_url']),
2543
+				)));
2544 2544
 		} else {
2545
-			if ( is_readable(EE_CLASSES . 'EE_Export.class.php')) {
2546
-				require_once(EE_CLASSES . 'EE_Export.class.php');
2545
+			if (is_readable(EE_CLASSES.'EE_Export.class.php')) {
2546
+				require_once(EE_CLASSES.'EE_Export.class.php');
2547 2547
 				$EE_Export = EE_Export::instance($this->_req_data);
2548 2548
 				$EE_Export->report_attendees();
2549 2549
 			}
@@ -2562,73 +2562,73 @@  discard block
 block discarded – undo
2562 2562
 	 * @return void
2563 2563
 	 */
2564 2564
 	protected function _duplicate_attendee() {
2565
-		$action = !empty( $this->_req_data['return'] ) ? $this->_req_data['return'] : 'default';
2565
+		$action = ! empty($this->_req_data['return']) ? $this->_req_data['return'] : 'default';
2566 2566
 		//verify we have necessary info
2567
-		if ( empty($this->_req_data['_REG_ID'] )  ) {
2568
-			EE_Error::add_error( __('Unable to create the contact for the registration because the required parameters are not present (_REG_ID )', 'event_espresso'),  __FILE__, __LINE__, __FUNCTION__ );
2569
-			$query_args = array( 'action' => $action );
2567
+		if (empty($this->_req_data['_REG_ID'])) {
2568
+			EE_Error::add_error(__('Unable to create the contact for the registration because the required parameters are not present (_REG_ID )', 'event_espresso'), __FILE__, __LINE__, __FUNCTION__);
2569
+			$query_args = array('action' => $action);
2570 2570
 			$this->_redirect_after_action('', '', '', $query_args, TRUE);
2571 2571
 		}
2572 2572
 
2573 2573
 		//okay necessary deets present... let's dupe the incoming attendee and attach to incoming registration.
2574
-		$registration = EEM_Registration::instance()->get_one_by_ID( $this->_req_data['_REG_ID'] );
2574
+		$registration = EEM_Registration::instance()->get_one_by_ID($this->_req_data['_REG_ID']);
2575 2575
 		$attendee = $registration->attendee();
2576 2576
 
2577 2577
 		//remove relation of existing attendee on registration
2578
-		$registration->_remove_relation_to($attendee, 'Attendee' );
2578
+		$registration->_remove_relation_to($attendee, 'Attendee');
2579 2579
 		//new attendee
2580 2580
 		$new_attendee = clone $attendee;
2581
-		$new_attendee->set( 'ATT_ID', 0 );
2581
+		$new_attendee->set('ATT_ID', 0);
2582 2582
 		$new_attendee->save();
2583 2583
 
2584 2584
 		//add new attendee to reg
2585
-		$registration->_add_relation_to( $new_attendee, 'Attendee');
2585
+		$registration->_add_relation_to($new_attendee, 'Attendee');
2586 2586
 
2587
-		EE_Error::add_success( __('New Contact record created.  Now make any edits you wish to make for this contact.', 'event_espresso') );
2587
+		EE_Error::add_success(__('New Contact record created.  Now make any edits you wish to make for this contact.', 'event_espresso'));
2588 2588
 
2589 2589
 		//redirect to edit page for attendee
2590
-		$query_args = array( 'post' => $new_attendee->ID(), 'action' => 'edit_attendee' );
2590
+		$query_args = array('post' => $new_attendee->ID(), 'action' => 'edit_attendee');
2591 2591
 
2592
-		$this->_redirect_after_action( '', '', '', $query_args, TRUE );
2592
+		$this->_redirect_after_action('', '', '', $query_args, TRUE);
2593 2593
 	}
2594 2594
 
2595 2595
 
2596 2596
 	//related to cpt routes
2597 2597
 	protected function _insert_update_cpt_item($post_id, $post) {
2598 2598
 		$success = true;
2599
-		$attendee = EEM_Attendee::instance()->get_one_by_ID( $post_id );
2599
+		$attendee = EEM_Attendee::instance()->get_one_by_ID($post_id);
2600 2600
 		//for attendee updates
2601
-		if ( $post->post_type = 'espresso_attendees' && !empty( $attendee ) ) {
2601
+		if ($post->post_type = 'espresso_attendees' && ! empty($attendee)) {
2602 2602
 			//note we should only be UPDATING attendees at this point.
2603 2603
 			$updated_fields = array(
2604 2604
 				'ATT_fname' => $this->_req_data['ATT_fname'],
2605 2605
 				'ATT_lname' => $this->_req_data['ATT_lname'],
2606
-				'ATT_full_name'=> $this->_req_data['ATT_fname'] . ' ' . $this->_req_data['ATT_lname'],
2606
+				'ATT_full_name'=> $this->_req_data['ATT_fname'].' '.$this->_req_data['ATT_lname'],
2607 2607
 				'ATT_address' => isset($this->_req_data['ATT_address']) ? $this->_req_data['ATT_address'] : '',
2608 2608
 				'ATT_address2' => isset($this->_req_data['ATT_address2']) ? $this->_req_data['ATT_address2'] : '',
2609
-				'ATT_city' => isset( $this->_req_data['ATT_city'] ) ? $this->_req_data['ATT_city'] : '',
2610
-				'STA_ID' => isset( $this->_req_data['STA_ID'] ) ? $this->_req_data['STA_ID'] : '',
2611
-				'CNT_ISO' => isset( $this->_req_data['CNT_ISO'] ) ? $this->_req_data['CNT_ISO'] : '',
2612
-				'ATT_zip' => isset( $this->_req_data['ATT_zip'] ) ? $this->_req_data['ATT_zip'] : '',
2613
-				'ATT_email' => isset( $this->_req_data['ATT_email'] ) ? $this->_req_data['ATT_email'] : '',
2614
-				'ATT_phone' => isset( $this->_req_data['ATT_phone'] ) ? $this->_req_data['ATT_phone'] : ''
2609
+				'ATT_city' => isset($this->_req_data['ATT_city']) ? $this->_req_data['ATT_city'] : '',
2610
+				'STA_ID' => isset($this->_req_data['STA_ID']) ? $this->_req_data['STA_ID'] : '',
2611
+				'CNT_ISO' => isset($this->_req_data['CNT_ISO']) ? $this->_req_data['CNT_ISO'] : '',
2612
+				'ATT_zip' => isset($this->_req_data['ATT_zip']) ? $this->_req_data['ATT_zip'] : '',
2613
+				'ATT_email' => isset($this->_req_data['ATT_email']) ? $this->_req_data['ATT_email'] : '',
2614
+				'ATT_phone' => isset($this->_req_data['ATT_phone']) ? $this->_req_data['ATT_phone'] : ''
2615 2615
 				);
2616
-			foreach ( $updated_fields as $field => $value ) {
2616
+			foreach ($updated_fields as $field => $value) {
2617 2617
 				$attendee->set($field, $value);
2618 2618
 			}
2619 2619
 
2620 2620
 			$success = $attendee->save();
2621 2621
 
2622
-			$attendee_update_callbacks = apply_filters( 'FHEE__Registrations_Admin_Page__insert_update_cpt_item__attendee_update', array() );
2623
-			foreach ( $attendee_update_callbacks as $a_callback ) {
2624
-				if ( FALSE === call_user_func_array( $a_callback, array($attendee, $this->_req_data ) ) ) {
2625
-					throw new EE_Error( sprintf( __('The %s callback given for the "FHEE__Registrations_Admin_Page__insert_update_cpt_item__attendee_update" filter is not a valid callback.  Please check the spelling.', 'event_espresso'), $a_callback ) );
2622
+			$attendee_update_callbacks = apply_filters('FHEE__Registrations_Admin_Page__insert_update_cpt_item__attendee_update', array());
2623
+			foreach ($attendee_update_callbacks as $a_callback) {
2624
+				if (FALSE === call_user_func_array($a_callback, array($attendee, $this->_req_data))) {
2625
+					throw new EE_Error(sprintf(__('The %s callback given for the "FHEE__Registrations_Admin_Page__insert_update_cpt_item__attendee_update" filter is not a valid callback.  Please check the spelling.', 'event_espresso'), $a_callback));
2626 2626
 				}
2627 2627
 			}
2628 2628
 		}
2629 2629
 
2630
-		if ( $success === FALSE )
2631
-			EE_Error::add_error(__('Something went wrong with updating the meta table data for the registration.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ );
2630
+		if ($success === FALSE)
2631
+			EE_Error::add_error(__('Something went wrong with updating the meta table data for the registration.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
2632 2632
 
2633 2633
 	}
2634 2634
 
@@ -2648,17 +2648,17 @@  discard block
 block discarded – undo
2648 2648
 		remove_meta_box('postexcerpt', __('Excerpt'), 'post_excerpt_meta_box', $this->_cpt_routes[$this->_req_action], 'normal', 'core');
2649 2649
 		remove_meta_box('commentstatusdiv', $this->_cpt_routes[$this->_req_action], 'normal', 'core');
2650 2650
 
2651
-		if ( post_type_supports( 'espresso_attendees', 'excerpt') ) {
2652
-			add_meta_box('postexcerpt', __('Short Biography', 'event_espresso'), 'post_excerpt_meta_box', $this->_cpt_routes[$this->_req_action], 'normal' );
2651
+		if (post_type_supports('espresso_attendees', 'excerpt')) {
2652
+			add_meta_box('postexcerpt', __('Short Biography', 'event_espresso'), 'post_excerpt_meta_box', $this->_cpt_routes[$this->_req_action], 'normal');
2653 2653
 		}
2654 2654
 
2655
-		if ( post_type_supports( 'espresso_attendees', 'comments') ) {
2655
+		if (post_type_supports('espresso_attendees', 'comments')) {
2656 2656
 			add_meta_box('commentsdiv', __('Notes on the Contact', 'event_espresso'), 'post_comment_meta_box', $this->_cpt_routes[$this->_req_action], 'normal', 'core');
2657 2657
 		}
2658 2658
 
2659
-		add_meta_box('attendee_contact_info', __('Contact Info', 'event_espresso'), array( $this, 'attendee_contact_info'), $this->_cpt_routes[$this->_req_action], 'side', 'core' );
2660
-		add_meta_box('attendee_details_address', __('Address Details', 'event_espresso'), array($this, 'attendee_address_details'), $this->_cpt_routes[$this->_req_action], 'normal', 'core' );
2661
-		add_meta_box('attendee_registrations', __('Registrations for this Contact', 'event_espresso'), array( $this, 'attendee_registrations_meta_box'), $this->_cpt_routes[$this->_req_action], 'normal', 'high');
2659
+		add_meta_box('attendee_contact_info', __('Contact Info', 'event_espresso'), array($this, 'attendee_contact_info'), $this->_cpt_routes[$this->_req_action], 'side', 'core');
2660
+		add_meta_box('attendee_details_address', __('Address Details', 'event_espresso'), array($this, 'attendee_address_details'), $this->_cpt_routes[$this->_req_action], 'normal', 'core');
2661
+		add_meta_box('attendee_registrations', __('Registrations for this Contact', 'event_espresso'), array($this, 'attendee_registrations_meta_box'), $this->_cpt_routes[$this->_req_action], 'normal', 'high');
2662 2662
 	}
2663 2663
 
2664 2664
 
@@ -2667,10 +2667,10 @@  discard block
 block discarded – undo
2667 2667
 	 * @param  WP_Post $post wp post object
2668 2668
 	 * @return string        attendee contact info ( and form )
2669 2669
 	 */
2670
-	public function attendee_contact_info( $post ) {
2670
+	public function attendee_contact_info($post) {
2671 2671
 		//get attendee object ( should already have it )
2672 2672
 		$this->_template_args['attendee'] = $this->_cpt_model_obj;
2673
-		$template = REG_TEMPLATE_PATH . 'attendee_contact_info_metabox_content.template.php';
2673
+		$template = REG_TEMPLATE_PATH.'attendee_contact_info_metabox_content.template.php';
2674 2674
 		EEH_Template::display_template($template, $this->_template_args);
2675 2675
 	}
2676 2676
 
@@ -2686,12 +2686,12 @@  discard block
 block discarded – undo
2686 2686
 		$this->_template_args['attendee'] = $this->_cpt_model_obj;
2687 2687
 		$this->_template_args['state_html'] = EEH_Form_Fields::generate_form_input(
2688 2688
 				new EE_Question_Form_Input(
2689
-				EE_Question::new_instance( array(
2689
+				EE_Question::new_instance(array(
2690 2690
 					'QST_ID' => 0,
2691 2691
 					'QST_display_text' => __('State/Province', 'event_espresso'),
2692 2692
 					'QST_system' => 'admin-state'
2693 2693
 					)),
2694
-				EE_Answer::new_instance( array(
2694
+				EE_Answer::new_instance(array(
2695 2695
 					'ANS_ID' => 0,
2696 2696
 					'ANS_value' => $this->_cpt_model_obj->state_ID()
2697 2697
 					)),
@@ -2704,12 +2704,12 @@  discard block
 block discarded – undo
2704 2704
 			));
2705 2705
 		$this->_template_args['country_html'] = EEH_Form_Fields::generate_form_input(
2706 2706
 				new EE_Question_Form_Input(
2707
-				EE_Question::new_instance( array(
2707
+				EE_Question::new_instance(array(
2708 2708
 					'QST_ID' => 0,
2709 2709
 					'QST_display_text' => __('Country', 'event_espresso'),
2710 2710
 					'QST_system' => 'admin-country'
2711 2711
 					)),
2712
-				EE_Answer::new_instance( array(
2712
+				EE_Answer::new_instance(array(
2713 2713
 					'ANS_ID' => 0,
2714 2714
 					'ANS_value' => $this->_cpt_model_obj->country_ID()
2715 2715
 					)),
@@ -2720,8 +2720,8 @@  discard block
 block discarded – undo
2720 2720
 					'append_qstn_id' => FALSE
2721 2721
 					)
2722 2722
 				));
2723
-		$template = REG_TEMPLATE_PATH . 'attendee_address_details_metabox_content.template.php';
2724
-		EEH_Template::display_template($template, $this->_template_args );
2723
+		$template = REG_TEMPLATE_PATH.'attendee_address_details_metabox_content.template.php';
2724
+		EEH_Template::display_template($template, $this->_template_args);
2725 2725
 
2726 2726
 	}
2727 2727
 
@@ -2731,11 +2731,11 @@  discard block
 block discarded – undo
2731 2731
 	*		@access protected
2732 2732
 	*		@return void
2733 2733
 	*/
2734
-	public function attendee_registrations_meta_box( $post ) {
2734
+	public function attendee_registrations_meta_box($post) {
2735 2735
 
2736 2736
 		$this->_template_args['attendee'] = $this->_cpt_model_obj;
2737 2737
 		$this->_template_args['registrations'] = $this->_cpt_model_obj->get_many_related('Registration');
2738
-		$template = REG_TEMPLATE_PATH . 'attendee_registrations_main_meta_box.template.php';
2738
+		$template = REG_TEMPLATE_PATH.'attendee_registrations_main_meta_box.template.php';
2739 2739
 		EEH_Template::display_template($template, $this->_template_args);
2740 2740
 
2741 2741
 	}
@@ -2749,8 +2749,8 @@  discard block
 block discarded – undo
2749 2749
 	 * @return string        html for new form.
2750 2750
 	 */
2751 2751
 	public function after_title_form_fields($post) {
2752
-		if ( $post->post_type == 'espresso_attendees' ) {
2753
-			$template = REG_TEMPLATE_PATH . 'attendee_details_after_title_form_fields.template.php';
2752
+		if ($post->post_type == 'espresso_attendees') {
2753
+			$template = REG_TEMPLATE_PATH.'attendee_details_after_title_form_fields.template.php';
2754 2754
 			$template_args['attendee'] = $this->_cpt_model_obj;
2755 2755
 			EEH_Template::display_template($template, $template_args);
2756 2756
 		}
@@ -2767,21 +2767,21 @@  discard block
 block discarded – undo
2767 2767
 	*		@access protected
2768 2768
 	*		@return void
2769 2769
 	*/
2770
-	protected function _trash_or_restore_attendees( $trash = TRUE ) {
2770
+	protected function _trash_or_restore_attendees($trash = TRUE) {
2771 2771
 
2772
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
2772
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
2773 2773
 
2774 2774
 		$ATT_MDL = EEM_Attendee::instance();
2775 2775
 
2776 2776
 		$success = 1;
2777 2777
 		//Checkboxes
2778
-		if (!empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) {
2778
+		if ( ! empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) {
2779 2779
 			// if array has more than one element than success message should be plural
2780
-			$success = count( $this->_req_data['checkbox'] ) > 1 ? 2 : 1;
2780
+			$success = count($this->_req_data['checkbox']) > 1 ? 2 : 1;
2781 2781
 			// cycle thru checkboxes
2782
-			while (list( $ATT_ID, $value ) = each($this->_req_data['checkbox'])) {
2783
-				$updated = $trash ? $ATT_MDL->update_by_ID(array( 'status' => 'trash' ), $ATT_ID) : $ATT_MDL->update_by_ID( array('status' => 'publish' ), $ATT_ID);
2784
-				if ( !$updated ) {
2782
+			while (list($ATT_ID, $value) = each($this->_req_data['checkbox'])) {
2783
+				$updated = $trash ? $ATT_MDL->update_by_ID(array('status' => 'trash'), $ATT_ID) : $ATT_MDL->update_by_ID(array('status' => 'publish'), $ATT_ID);
2784
+				if ( ! $updated) {
2785 2785
 					$success = 0;
2786 2786
 				}
2787 2787
 			}
@@ -2790,18 +2790,18 @@  discard block
 block discarded – undo
2790 2790
 			// grab single id and delete
2791 2791
 			$ATT_ID = absint($this->_req_data['ATT_ID']);
2792 2792
 			//get attendee
2793
-			$att = $ATT_MDL->get_one_by_ID( $ATT_ID );
2793
+			$att = $ATT_MDL->get_one_by_ID($ATT_ID);
2794 2794
 			$updated = $trash ? $att->set_status('trash') : $att->set_status('publish');
2795 2795
 			$updated = $att->save();
2796
-			if ( ! $updated ) {
2796
+			if ( ! $updated) {
2797 2797
 				$success = 0;
2798 2798
 			}
2799 2799
 
2800 2800
 		}
2801 2801
 
2802
-		$what = $success > 1 ? __( 'Contacts', 'event_espresso' ) : __( 'Contact', 'event_espresso' );
2803
-		$action_desc = $trash ? __( 'moved to the trash', 'event_espresso' ) : __( 'restored', 'event_espresso' );
2804
-		$this->_redirect_after_action( $success, $what, $action_desc, array( 'action' => 'contact_list' ) );
2802
+		$what = $success > 1 ? __('Contacts', 'event_espresso') : __('Contact', 'event_espresso');
2803
+		$action_desc = $trash ? __('moved to the trash', 'event_espresso') : __('restored', 'event_espresso');
2804
+		$this->_redirect_after_action($success, $what, $action_desc, array('action' => 'contact_list'));
2805 2805
 
2806 2806
 	}
2807 2807
 
Please login to merge, or discard this patch.
admin/new/pricing/templates/event_tickets_datetime_ticket_row.template.php 1 patch
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -3,7 +3,7 @@  discard block
 block discarded – undo
3 3
 	<td class="ee-tkt-order-field"><span class="ee-status-strip-td ee-status-strip<?php echo $tkt_status_class; ?>"></span><input type="hidden" name="<?php echo $edit_tickets_name; ?>[<?php echo $tkt_row; ?>][TKT_order]" class="edit-ticket-TKT_order" value ="<?php echo $TKT_order; ?>"></td>
4 4
 	<td><input maxlength="245" type="text" name="<?php echo $edit_tickets_name; ?>[<?php echo $tkt_row; ?>][TKT_name]" class="edit-ticket-TKT_name ee-large-text-inp" placeholder="Ticket Title" value="<?php echo $TKT_name; ?>"></td>
5 5
 	<td>
6
-		<?php if ( $disabled ) : ?>
6
+		<?php if ($disabled) : ?>
7 7
 			<input type="hidden" id="edit-ticket-TKT_start_date-<?php echo $tkt_row; ?>"  name="<?php echo $edit_tickets_name; ?>[<?php echo $tkt_row; ?>][TKT_start_date]" class="edit-ticket-TKT_start_date ee-text-inp" value="<?php echo $TKT_start_date; ?>" >
8 8
 			<input type="text" name="archived_ticket[TKT_start_date]" class="edit-ticket-TKT_start_date ee-text-inp" value="<?php echo $TKT_start_date; ?>" disabled>
9 9
 		<?php else : ?>
@@ -11,7 +11,7 @@  discard block
 block discarded – undo
11 11
 		<?php endif; ?>
12 12
 	</td>
13 13
 	<td>
14
-		<?php if ( $disabled ) : ?>
14
+		<?php if ($disabled) : ?>
15 15
 			<input type="hidden" id="edit-ticket-TKT_end_date-<?php echo $tkt_row; ?>"  name="<?php echo $edit_tickets_name; ?>[<?php echo $tkt_row; ?>][TKT_end_date]" class="edit-ticket-TKT_end_date ee-text-inp" value="<?php echo $TKT_end_date; ?>" >
16 16
 			<input type="text" name="archived_ticket[TKT_end_date]" class="edit-ticket-TKT_end_date ee-text-inp" value="<?php echo $TKT_end_date; ?>" disabled>
17 17
 		<?php else : ?>
@@ -19,7 +19,7 @@  discard block
 block discarded – undo
19 19
 		<?php endif; ?>
20 20
 	</td>
21 21
 	<td>
22
-		<?php if ( $disabled ) : ?>
22
+		<?php if ($disabled) : ?>
23 23
 			<input id="edit-ticket-TKT_base_price-<?php echo $tkt_row; ?>" type="hidden" name="<?php echo $edit_tickets_name; ?>[<?php echo $tkt_row; ?>][TKT_base_price]" class="edit-ticket-TKT_base_price ee-small-text-inp edit-price-PRC_amount ee-numeric" value="<?php echo $TKT_base_price; ?>">
24 24
 			<input type="text" name="archived_ticket[<?php echo $tkt_row; ?>][TKT_base_price]" class="edit-ticket-TKT_base_price ee-small-text-inp edit-price-PRC_amount ee-numeric" value="<?php echo $TKT_base_price; ?>" disabled>
25 25
 		<?php else : ?>
@@ -28,7 +28,7 @@  discard block
 block discarded – undo
28 28
 		<input type="hidden" id="edit-ticket-TKT_base_price_ID-<?php echo $tkt_row; ?>" name="<?php echo $edit_tickets_name; ?>[<?php echo $tkt_row; ?>][TKT_base_price_ID]" value="<?php echo $TKT_base_price_ID; ?>">
29 29
 	</td>
30 30
 	<td>
31
-		<?php if ( $disabled ) : ?>
31
+		<?php if ($disabled) : ?>
32 32
 			<input type="hidden" class="edit-ticket-TKT_qty ee-small-text-inp ee-numeric" name="<?php echo $edit_tickets_name; ?>[<?php echo $tkt_row; ?>][TKT_qty]" value="<?php echo $TKT_qty_for_input; ?>">
33 33
 			<input type="text" class="edit-ticket-TKT_qty ee-small-text-inp ee-numeric" name="archived_ticket[<?php echo $tkt_row; ?>][TKT_qty]" value="<?php echo $TKT_qty_for_input; ?>" disabled>
34 34
 		<?php else : ?>
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
 	</td>
38 38
 	<!--<td><span class="ticket-display-row-TKT_price"><?php echo $TKT_price; ?></span></td>-->
39 39
 	<td><span class="ticket-display-row-TKT_sold"><?php echo $TKT_sold; ?></span></td>
40
-	<?php if ( WP_DEBUG ) { ?>
40
+	<?php if (WP_DEBUG) { ?>
41 41
 	<td><span class="ticket-display-row-TKT_reserved"><?php echo $TKT_reserved; ?></span></td>
42 42
 	<?php } ?>
43 43
 	<td><span class="ticket-display-row-TKT_registrations"><?php echo $TKT_registrations; ?></span></td>
@@ -52,10 +52,10 @@  discard block
 block discarded – undo
52 52
 			<input type="hidden" name="<?php echo $edit_tickets_name; ?>[<?php echo $tkt_row; ?>][TKT_ID]" class="edit-ticket-TKT_ID" value="<?php echo $TKT_ID; ?>">
53 53
 			<input type="hidden" name="<?php echo $edit_tickets_name; ?>[<?php echo $tkt_row; ?>][TKT_row]" class="edit-ticket-TKT_row" value="<?php echo $tkt_row; ?>">
54 54
 
55
-			<!--<div class="total-price-container"><?php printf( esc_html__('Total Final Price: %s', 'event_espresso'), '<span class="ticket-price-amount">' . $TKT_price . '</span>'); ?> </div>-->
55
+			<!--<div class="total-price-container"><?php printf(esc_html__('Total Final Price: %s', 'event_espresso'), '<span class="ticket-price-amount">'.$TKT_price.'</span>'); ?> </div>-->
56 56
 			<textarea name="<?php echo $edit_tickets_name; ?>[<?php echo $tkt_row; ?>][TKT_description]" class="edit-ticket-TKT_description ee-full-textarea-inp" placeholder="Ticket Description"><?php echo $TKT_description; ?></textarea>
57 57
 
58
-			<?php do_action( 'AHEE__event_tickets_datetime_ticket_row_template_after_desc', $tkt_row, $TKT_ID ); ?>
58
+			<?php do_action('AHEE__event_tickets_datetime_ticket_row_template_after_desc', $tkt_row, $TKT_ID); ?>
59 59
 
60 60
 			<div class="basic-ticket-container">
61 61
 				<h4 class="tickets-heading"><?php esc_html_e('Ticket Details', 'event_espresso'); ?></h4>
@@ -71,7 +71,7 @@  discard block
 block discarded – undo
71 71
 					<tbody>
72 72
 						<tr>
73 73
 							<td>
74
-								<?php if ( $disabled ) : ?>
74
+								<?php if ($disabled) : ?>
75 75
 									<input type="hidden" class="edit-ticket-TKT_uses ee-small-text-inp ee-numeric" name="<?php echo $edit_tickets_name; ?>[<?php echo $tkt_row; ?>][TKT_uses]" value="<?php echo $TKT_uses; ?>">
76 76
 									<input type="text" class="edit-ticket-TKT_uses ee-small-text-inp ee-numeric" name="archived_ticket[<?php echo $tkt_row; ?>][TKT_uses]" value="<?php echo $TKT_uses; ?>" disabled>
77 77
 								<?php else : ?>
@@ -79,7 +79,7 @@  discard block
 block discarded – undo
79 79
 								<?php endif; ?>
80 80
 							</td>
81 81
 							<td>
82
-								<?php if ( $disabled ) : ?>
82
+								<?php if ($disabled) : ?>
83 83
 									<input type="hidden" class="edit-ticket-TKT_min ee-small-text-inp ee-numeric" name="<?php echo $edit_tickets_name; ?>[<?php echo $tkt_row; ?>][TKT_min]" value="<?php echo $TKT_min; ?>">
84 84
 									<input type="text" class="edit-ticket-TKT_min ee-small-text-inp ee-numeric" name="archived_ticket[<?php echo $tkt_row; ?>][TKT_min]" value="<?php echo $TKT_min; ?>" disabled>
85 85
 								<?php else: ?>
@@ -87,7 +87,7 @@  discard block
 block discarded – undo
87 87
 								<?php endif; ?>
88 88
 							</td>
89 89
 							<td>
90
-								<?php if ( $disabled ) : ?>
90
+								<?php if ($disabled) : ?>
91 91
 									<input type="hidden" class="edit-ticket-TKT_max ee-small-text-inp ee-numeric" name="<?php echo $edit_tickets_name; ?>[<?php echo $tkt_row; ?>][TKT_max]" value="<?php echo $TKT_max; ?>">
92 92
 									<input type="text" class="edit-ticket-TKT_max ee-small-text-inp ee-numeric" name="<?php echo $edit_tickets_name; ?>[<?php echo $tkt_row; ?>][TKT_max]" value="<?php echo $TKT_max; ?>" disabled>
93 93
 								<?php else : ?>
@@ -105,15 +105,15 @@  discard block
 block discarded – undo
105 105
 					<label for="edit-ticket-TKT_required"><?php esc_html_e('This ticket is required (will appear first in frontend ticket lists).', 'event_espresso'); ?></label>
106 106
 				</div>
107 107
 				<div class="ticket-is-taxable-container">
108
-					<?php if ( !empty($tax_rows) ) { ?>
109
-						<?php if ( $disabled ) : ?>
108
+					<?php if ( ! empty($tax_rows)) { ?>
109
+						<?php if ($disabled) : ?>
110 110
 							<?php
111
-								$tax_value = !empty( $TKT_taxable ) ? 1 : 0;
111
+								$tax_value = ! empty($TKT_taxable) ? 1 : 0;
112 112
 							?>
113
-							<input class="TKT-taxable-checkbox" type="hidden" name="<?php echo $edit_tickets_name;?>[<?php echo $tkt_row; ?>][TKT_taxable]" value="<?php echo $tax_value; ?>">
113
+							<input class="TKT-taxable-checkbox" type="hidden" name="<?php echo $edit_tickets_name; ?>[<?php echo $tkt_row; ?>][TKT_taxable]" value="<?php echo $tax_value; ?>">
114 114
 							<input class="TKT-taxable-checkbox" id="edit-ticket-TKT_taxable-<?php echo $tkt_row; ?>" type="checkbox" name="archived_ticket[<?php echo $tkt_row; ?>][TKT_taxable]" value="1"<?php echo $TKT_taxable; ?> disabled>
115 115
 						<?php else : ?>
116
-							<input class="TKT-taxable-checkbox" id="edit-ticket-TKT_taxable-<?php echo $tkt_row; ?>" type="checkbox" name="<?php echo $edit_tickets_name;?>[<?php echo $tkt_row; ?>][TKT_taxable]" value="1"<?php echo $TKT_taxable; ?>>
116
+							<input class="TKT-taxable-checkbox" id="edit-ticket-TKT_taxable-<?php echo $tkt_row; ?>" type="checkbox" name="<?php echo $edit_tickets_name; ?>[<?php echo $tkt_row; ?>][TKT_taxable]" value="1"<?php echo $TKT_taxable; ?>>
117 117
 						<?php endif; ?>
118 118
 						<label for="edit-ticket-TKT_taxable-<?php echo $tkt_row; ?>"> <?php esc_html_e('This ticket is taxable.', 'event_espresso'); ?>
119 119
 					<?php } //end tax_rows check ?>
@@ -170,10 +170,10 @@  discard block
 block discarded – undo
170 170
 				<?php echo $ticket_datetimes_list; ?>
171 171
 			</ul>
172 172
 
173
-			<?php do_action( 'AHEE__event_tickets_datetime_ticket_row_template__advanced_details_end', $tkt_row, $TKT_ID ); ?>
173
+			<?php do_action('AHEE__event_tickets_datetime_ticket_row_template__advanced_details_end', $tkt_row, $TKT_ID); ?>
174 174
 			<div class="ee-editor-footer-container">
175 175
 				<div class="ee-editor-id-container">
176
-					<span class="ee-item-id"><?php echo $TKT_ID ? sprintf( esc_html__( 'Ticket ID: %d', 'event_espresso' ), $TKT_ID ) : ''; ?></span>
176
+					<span class="ee-item-id"><?php echo $TKT_ID ? sprintf(esc_html__('Ticket ID: %d', 'event_espresso'), $TKT_ID) : ''; ?></span>
177 177
 				</div>
178 178
 				<div class="save-cancel-button-container">
179 179
 					<label for="edit-ticket-TKT_is_default_selector"><?php esc_html_e('use this new ticket as a default ticket for any new events', 'event_espresso'); ?></label>
Please login to merge, or discard this patch.
core/db_classes/EE_Ticket.class.php 1 patch
Spacing   +205 added lines, -205 removed lines patch added patch discarded remove patch
@@ -1,7 +1,7 @@  discard block
 block discarded – undo
1 1
 <?php use EventEspresso\core\exceptions\UnexpectedEntityException;
2 2
 
3
-if ( !defined( 'EVENT_ESPRESSO_VERSION' ) ) {
4
-	exit( 'No direct script access allowed' );
3
+if ( ! defined('EVENT_ESPRESSO_VERSION')) {
4
+	exit('No direct script access allowed');
5 5
 }
6 6
 /**
7 7
  * Event Espresso
@@ -68,9 +68,9 @@  discard block
 block discarded – undo
68 68
 	 *                             		    date_format and the second value is the time format
69 69
 	 * @return EE_Ticket
70 70
 	 */
71
-	public static function new_instance( $props_n_values = array(), $timezone = null, $date_formats = array() ) {
72
-		$has_object = parent::_check_for_object( $props_n_values, __CLASS__, $timezone, $date_formats );
73
-		return $has_object ? $has_object : new self( $props_n_values, false, $timezone, $date_formats );
71
+	public static function new_instance($props_n_values = array(), $timezone = null, $date_formats = array()) {
72
+		$has_object = parent::_check_for_object($props_n_values, __CLASS__, $timezone, $date_formats);
73
+		return $has_object ? $has_object : new self($props_n_values, false, $timezone, $date_formats);
74 74
 	}
75 75
 
76 76
 
@@ -81,8 +81,8 @@  discard block
 block discarded – undo
81 81
 	 *                          		the website will be used.
82 82
 	 * @return EE_Ticket
83 83
 	 */
84
-	public static function new_instance_from_db( $props_n_values = array(), $timezone = null ) {
85
-		return new self( $props_n_values, TRUE, $timezone );
84
+	public static function new_instance_from_db($props_n_values = array(), $timezone = null) {
85
+		return new self($props_n_values, TRUE, $timezone);
86 86
 	}
87 87
 
88 88
 
@@ -91,7 +91,7 @@  discard block
 block discarded – undo
91 91
 	 * @return bool
92 92
 	 */
93 93
 	public function parent() {
94
-		return $this->get( 'TKT_parent' );
94
+		return $this->get('TKT_parent');
95 95
 	}
96 96
 
97 97
 
@@ -101,13 +101,13 @@  discard block
 block discarded – undo
101 101
 	 * @param  int $DTT_ID the primary key for a particular datetime
102 102
 	 * @return boolean
103 103
 	 */
104
-	public function available( $DTT_ID = 0 ) {
104
+	public function available($DTT_ID = 0) {
105 105
 		// are we checking availability for a particular datetime ?
106
-		if ( $DTT_ID ) {
106
+		if ($DTT_ID) {
107 107
 			// get that datetime object
108
-			$datetime = $this->get_first_related( 'Datetime', array( array( 'DTT_ID' => $DTT_ID ) ) );
108
+			$datetime = $this->get_first_related('Datetime', array(array('DTT_ID' => $DTT_ID)));
109 109
 			// if  ticket sales for this datetime have exceeded the reg limit...
110
-			if ( $datetime instanceof EE_Datetime && $datetime->sold_out() ) {
110
+			if ($datetime instanceof EE_Datetime && $datetime->sold_out()) {
111 111
 				return FALSE;
112 112
 			}
113 113
 		}
@@ -123,22 +123,22 @@  discard block
 block discarded – undo
123 123
 	 * @param bool | null $remaining  if it is already known that tickets are available, then simply pass a bool to save further processing
124 124
 	 * @return mixed status int if the display string isn't requested
125 125
 	 */
126
-	public function ticket_status( $display = FALSE, $remaining = null ) {
127
-		$remaining = is_bool( $remaining ) ? $remaining : $this->is_remaining();
128
-		if ( ! $remaining ) {
129
-			return $display ? EEH_Template::pretty_status( EE_Ticket::sold_out, FALSE, 'sentence' ) : EE_Ticket::sold_out;
126
+	public function ticket_status($display = FALSE, $remaining = null) {
127
+		$remaining = is_bool($remaining) ? $remaining : $this->is_remaining();
128
+		if ( ! $remaining) {
129
+			return $display ? EEH_Template::pretty_status(EE_Ticket::sold_out, FALSE, 'sentence') : EE_Ticket::sold_out;
130 130
 		}
131
-		if ( $this->get( 'TKT_deleted' ) ) {
132
-			return $display ? EEH_Template::pretty_status( EE_Ticket::archived, FALSE, 'sentence' ) : EE_Ticket::archived;
131
+		if ($this->get('TKT_deleted')) {
132
+			return $display ? EEH_Template::pretty_status(EE_Ticket::archived, FALSE, 'sentence') : EE_Ticket::archived;
133 133
 		}
134
-		if ( $this->is_expired() ) {
135
-			return $display ? EEH_Template::pretty_status( EE_Ticket::expired, FALSE, 'sentence' ) : EE_Ticket::expired;
134
+		if ($this->is_expired()) {
135
+			return $display ? EEH_Template::pretty_status(EE_Ticket::expired, FALSE, 'sentence') : EE_Ticket::expired;
136 136
 		}
137
-		if ( $this->is_pending() ) {
138
-			return $display ? EEH_Template::pretty_status( EE_Ticket::pending, FALSE, 'sentence' ) : EE_Ticket::pending;
137
+		if ($this->is_pending()) {
138
+			return $display ? EEH_Template::pretty_status(EE_Ticket::pending, FALSE, 'sentence') : EE_Ticket::pending;
139 139
 		}
140
-		if ( $this->is_on_sale() ) {
141
-			return $display ? EEH_Template::pretty_status( EE_Ticket::onsale, FALSE, 'sentence' ) : EE_Ticket::onsale;
140
+		if ($this->is_on_sale()) {
141
+			return $display ? EEH_Template::pretty_status(EE_Ticket::onsale, FALSE, 'sentence') : EE_Ticket::onsale;
142 142
 		}
143 143
 		return '';
144 144
 	}
@@ -152,12 +152,12 @@  discard block
 block discarded – undo
152 152
 	 * @param  int $DTT_ID if an int above 0 is included here then we get a specific dtt.
153 153
 	 * @return boolean         true = tickets remaining, false not.
154 154
 	 */
155
-	public function is_remaining( $DTT_ID = 0 ) {
156
-		$num_remaining = $this->remaining( $DTT_ID );
157
-		if ( $num_remaining === 0 ) {
155
+	public function is_remaining($DTT_ID = 0) {
156
+		$num_remaining = $this->remaining($DTT_ID);
157
+		if ($num_remaining === 0) {
158 158
 			return FALSE;
159 159
 		}
160
-		if ( $num_remaining > 0 && $num_remaining < $this->min() ) {
160
+		if ($num_remaining > 0 && $num_remaining < $this->min()) {
161 161
 			return FALSE;
162 162
 		}
163 163
 		return TRUE;
@@ -172,8 +172,8 @@  discard block
 block discarded – undo
172 172
 	 *                     set to 0 for all related datetimes
173 173
 	 * @return int
174 174
 	 */
175
-	public function remaining( $DTT_ID = 0 ) {
176
-		return $this->real_quantity_on_ticket('saleable', $DTT_ID );
175
+	public function remaining($DTT_ID = 0) {
176
+		return $this->real_quantity_on_ticket('saleable', $DTT_ID);
177 177
 	}
178 178
 
179 179
 
@@ -183,7 +183,7 @@  discard block
 block discarded – undo
183 183
 	 * @return int
184 184
 	 */
185 185
 	function min() {
186
-		return $this->get( 'TKT_min' );
186
+		return $this->get('TKT_min');
187 187
 	}
188 188
 
189 189
 
@@ -193,7 +193,7 @@  discard block
 block discarded – undo
193 193
 	 * @return boolean
194 194
 	 */
195 195
 	public function is_expired() {
196
-		return ( $this->get_raw( 'TKT_end_date' ) < time() );
196
+		return ($this->get_raw('TKT_end_date') < time());
197 197
 	}
198 198
 
199 199
 
@@ -203,7 +203,7 @@  discard block
 block discarded – undo
203 203
 	 * @return boolean
204 204
 	 */
205 205
 	public function is_pending() {
206
-		return ( $this->get_raw( 'TKT_start_date' ) > time() );
206
+		return ($this->get_raw('TKT_start_date') > time());
207 207
 	}
208 208
 
209 209
 
@@ -213,7 +213,7 @@  discard block
 block discarded – undo
213 213
 	 * @return boolean
214 214
 	 */
215 215
 	public function is_on_sale() {
216
-		return ( $this->get_raw( 'TKT_start_date' ) < time() && $this->get_raw( 'TKT_end_date' ) > time() );
216
+		return ($this->get_raw('TKT_start_date') < time() && $this->get_raw('TKT_end_date') > time());
217 217
 	}
218 218
 
219 219
 
@@ -224,11 +224,11 @@  discard block
 block discarded – undo
224 224
 	 * @param string 	$conjunction - conjunction junction what's your function ? this string joins the start date with the end date ie: Jan 01 "to" Dec 31
225 225
 	 * @return array
226 226
 	 */
227
-	public function date_range( $dt_frmt = '', $conjunction = ' - ' ) {
228
-		$first_date = $this->first_datetime() instanceof EE_Datetime ? $this->first_datetime()->start_date( $dt_frmt ) : '';
229
-		$last_date = $this->last_datetime() instanceof EE_Datetime ? $this->last_datetime()->end_date( $dt_frmt ) : '';
227
+	public function date_range($dt_frmt = '', $conjunction = ' - ') {
228
+		$first_date = $this->first_datetime() instanceof EE_Datetime ? $this->first_datetime()->start_date($dt_frmt) : '';
229
+		$last_date = $this->last_datetime() instanceof EE_Datetime ? $this->last_datetime()->end_date($dt_frmt) : '';
230 230
 
231
-		return $first_date && $last_date ? $first_date . $conjunction  . $last_date : '';
231
+		return $first_date && $last_date ? $first_date.$conjunction.$last_date : '';
232 232
 	}
233 233
 
234 234
 
@@ -238,8 +238,8 @@  discard block
 block discarded – undo
238 238
 	 * @return EE_Datetime
239 239
 	 */
240 240
 	public function first_datetime() {
241
-		$datetimes = $this->datetimes( array( 'limit' => 1 ) );
242
-		return reset( $datetimes );
241
+		$datetimes = $this->datetimes(array('limit' => 1));
242
+		return reset($datetimes);
243 243
 	}
244 244
 
245 245
 
@@ -250,11 +250,11 @@  discard block
 block discarded – undo
250 250
 	 * @param array $query_params see EEM_Base::get_all()
251 251
 	 * @return EE_Datetime[]
252 252
 	 */
253
-	public function datetimes( $query_params = array() ) {
254
-		if ( ! isset( $query_params[ 'order_by' ] ) ) {
255
-			$query_params[ 'order_by' ][ 'DTT_order' ] = 'ASC';
253
+	public function datetimes($query_params = array()) {
254
+		if ( ! isset($query_params['order_by'])) {
255
+			$query_params['order_by']['DTT_order'] = 'ASC';
256 256
 		}
257
-		return $this->get_many_related( 'Datetime', $query_params );
257
+		return $this->get_many_related('Datetime', $query_params);
258 258
 	}
259 259
 
260 260
 
@@ -264,8 +264,8 @@  discard block
 block discarded – undo
264 264
 	 * @return EE_Datetime
265 265
 	 */
266 266
 	public function last_datetime() {
267
-		$datetimes = $this->datetimes( array( 'limit' => 1, 'order_by' => array( 'DTT_EVT_start' => 'DESC' ) ) );
268
-		return end( $datetimes );
267
+		$datetimes = $this->datetimes(array('limit' => 1, 'order_by' => array('DTT_EVT_start' => 'DESC')));
268
+		return end($datetimes);
269 269
 	}
270 270
 
271 271
 
@@ -279,22 +279,22 @@  discard block
 block discarded – undo
279 279
 	 * @param  int    $dtt_id [optional] include the dtt_id with $what = 'datetime'.
280 280
 	 * @return mixed (array|int)          how many tickets have sold
281 281
 	 */
282
-	public function tickets_sold( $what = 'ticket', $dtt_id = NULL ) {
282
+	public function tickets_sold($what = 'ticket', $dtt_id = NULL) {
283 283
 		$total = 0;
284 284
 		$tickets_sold = $this->_all_tickets_sold();
285
-		switch ( $what ) {
285
+		switch ($what) {
286 286
 			case 'ticket' :
287
-				return $tickets_sold[ 'ticket' ];
287
+				return $tickets_sold['ticket'];
288 288
 				break;
289 289
 			case 'datetime' :
290
-				if ( empty( $tickets_sold[ 'datetime' ] ) ) {
290
+				if (empty($tickets_sold['datetime'])) {
291 291
 					return $total;
292 292
 				}
293
-				if ( ! empty( $dtt_id ) && ! isset( $tickets_sold[ 'datetime' ][ $dtt_id ] ) ) {
294
-					EE_Error::add_error( __( "You've requested the amount of tickets sold for a given ticket and datetime, however there are no records for the datetime id you included.  Are you SURE that is a datetime related to this ticket?", "event_espresso" ), __FILE__, __FUNCTION__, __LINE__ );
293
+				if ( ! empty($dtt_id) && ! isset($tickets_sold['datetime'][$dtt_id])) {
294
+					EE_Error::add_error(__("You've requested the amount of tickets sold for a given ticket and datetime, however there are no records for the datetime id you included.  Are you SURE that is a datetime related to this ticket?", "event_espresso"), __FILE__, __FUNCTION__, __LINE__);
295 295
 					return $total;
296 296
 				}
297
-				return empty( $dtt_id ) ? $tickets_sold[ 'datetime' ] : $tickets_sold[ 'datetime' ][ $dtt_id ];
297
+				return empty($dtt_id) ? $tickets_sold['datetime'] : $tickets_sold['datetime'][$dtt_id];
298 298
 				break;
299 299
 			default:
300 300
 				return $total;
@@ -308,15 +308,15 @@  discard block
 block discarded – undo
308 308
 	 * @return EE_Ticket[]
309 309
 	 */
310 310
 	protected function _all_tickets_sold() {
311
-		$datetimes = $this->get_many_related( 'Datetime' );
311
+		$datetimes = $this->get_many_related('Datetime');
312 312
 		$tickets_sold = array();
313
-		if ( ! empty( $datetimes ) ) {
314
-			foreach ( $datetimes as $datetime ) {
315
-				$tickets_sold[ 'datetime' ][ $datetime->ID() ] = $datetime->get( 'DTT_sold' );
313
+		if ( ! empty($datetimes)) {
314
+			foreach ($datetimes as $datetime) {
315
+				$tickets_sold['datetime'][$datetime->ID()] = $datetime->get('DTT_sold');
316 316
 			}
317 317
 		}
318 318
 		//Tickets sold
319
-		$tickets_sold[ 'ticket' ] = $this->sold();
319
+		$tickets_sold['ticket'] = $this->sold();
320 320
 		return $tickets_sold;
321 321
 	}
322 322
 
@@ -329,9 +329,9 @@  discard block
 block discarded – undo
329 329
 	 * @param  bool $return_array whether to return as an array indexed by price id or just the object.
330 330
 	 * @return EE_Price
331 331
 	 */
332
-	public function base_price( $return_array = FALSE ) {
333
-		$_where = array( 'Price_Type.PBT_ID' => EEM_Price_Type::base_type_base_price );
334
-		return $return_array ? $this->get_many_related( 'Price', array( $_where ) ) : $this->get_first_related( 'Price', array( $_where ) );
332
+	public function base_price($return_array = FALSE) {
333
+		$_where = array('Price_Type.PBT_ID' => EEM_Price_Type::base_type_base_price);
334
+		return $return_array ? $this->get_many_related('Price', array($_where)) : $this->get_first_related('Price', array($_where));
335 335
 	}
336 336
 
337 337
 
@@ -343,8 +343,8 @@  discard block
 block discarded – undo
343 343
 	 * @return EE_Price[]
344 344
 	 */
345 345
 	public function price_modifiers() {
346
-		$query_params = array( 0 => array( 'Price_Type.PBT_ID' => array( 'NOT IN', array( EEM_Price_Type::base_type_base_price, EEM_Price_Type::base_type_tax ) ) ) );
347
-		return $this->prices( $query_params );
346
+		$query_params = array(0 => array('Price_Type.PBT_ID' => array('NOT IN', array(EEM_Price_Type::base_type_base_price, EEM_Price_Type::base_type_tax))));
347
+		return $this->prices($query_params);
348 348
 	}
349 349
 
350 350
 
@@ -354,8 +354,8 @@  discard block
 block discarded – undo
354 354
 	 * @param array $query_params like EEM_Base::get_all
355 355
 	 * @return EE_Price[]
356 356
 	 */
357
-	public function prices( $query_params = array() ) {
358
-		return $this->get_many_related( 'Price', $query_params );
357
+	public function prices($query_params = array()) {
358
+		return $this->get_many_related('Price', $query_params);
359 359
 	}
360 360
 
361 361
 
@@ -365,8 +365,8 @@  discard block
 block discarded – undo
365 365
 	 * @param array $query_params see EEM_Base::get_all()
366 366
 	 * @return EE_Datetime_Ticket
367 367
 	 */
368
-	public function datetime_tickets( $query_params = array() ) {
369
-		return $this->get_many_related( 'Datetime_Ticket', $query_params );
368
+	public function datetime_tickets($query_params = array()) {
369
+		return $this->get_many_related('Datetime_Ticket', $query_params);
370 370
 	}
371 371
 
372 372
 
@@ -377,8 +377,8 @@  discard block
 block discarded – undo
377 377
 	 * @param boolean $show_deleted
378 378
 	 * @return EE_Datetime[]
379 379
 	 */
380
-	public function datetimes_ordered( $show_expired = TRUE, $show_deleted = FALSE ) {
381
-		return EEM_Datetime::instance( $this->_timezone )->get_datetimes_for_ticket_ordered_by_DTT_order( $this->ID(), $show_expired, $show_deleted );
380
+	public function datetimes_ordered($show_expired = TRUE, $show_deleted = FALSE) {
381
+		return EEM_Datetime::instance($this->_timezone)->get_datetimes_for_ticket_ordered_by_DTT_order($this->ID(), $show_expired, $show_deleted);
382 382
 	}
383 383
 
384 384
 
@@ -388,7 +388,7 @@  discard block
 block discarded – undo
388 388
 	 * @return string
389 389
 	 */
390 390
 	function ID() {
391
-		return $this->get( 'TKT_ID' );
391
+		return $this->get('TKT_ID');
392 392
 	}
393 393
 
394 394
 
@@ -412,7 +412,7 @@  discard block
 block discarded – undo
412 412
 	 * @return EE_Ticket_Template
413 413
 	 */
414 414
 	public function template() {
415
-		return $this->get_first_related( 'Ticket_Template' );
415
+		return $this->get_first_related('Ticket_Template');
416 416
 	}
417 417
 
418 418
 
@@ -431,7 +431,7 @@  discard block
 block discarded – undo
431 431
 	 * @return bool
432 432
 	 */
433 433
 	public function ticket_price() {
434
-		return $this->get( 'TKT_price' );
434
+		return $this->get('TKT_price');
435 435
 	}
436 436
 
437 437
 
@@ -440,7 +440,7 @@  discard block
 block discarded – undo
440 440
 	 * @return mixed
441 441
 	 */
442 442
 	public function pretty_price() {
443
-		return $this->get_pretty( 'TKT_price' );
443
+		return $this->get_pretty('TKT_price');
444 444
 	}
445 445
 
446 446
 
@@ -459,17 +459,17 @@  discard block
 block discarded – undo
459 459
 	 * @param bool $no_cache
460 460
 	 * @return float
461 461
 	 */
462
-	public function get_ticket_total_with_taxes( $no_cache = FALSE ) {
463
-		if ( ! isset( $this->_ticket_total_with_taxes ) || $no_cache ) {
462
+	public function get_ticket_total_with_taxes($no_cache = FALSE) {
463
+		if ( ! isset($this->_ticket_total_with_taxes) || $no_cache) {
464 464
 			$this->_ticket_total_with_taxes = $this->get_ticket_subtotal() + $this->get_ticket_taxes_total_for_admin();
465 465
 		}
466
-		return (float)$this->_ticket_total_with_taxes;
466
+		return (float) $this->_ticket_total_with_taxes;
467 467
 	}
468 468
 
469 469
 
470 470
 
471 471
 	public function ensure_TKT_Price_correct() {
472
-		$this->set( 'TKT_price', EE_Taxes::get_subtotal_for_admin( $this ) );
472
+		$this->set('TKT_price', EE_Taxes::get_subtotal_for_admin($this));
473 473
 		$this->save();
474 474
 	}
475 475
 
@@ -479,7 +479,7 @@  discard block
 block discarded – undo
479 479
 	 * @return float
480 480
 	 */
481 481
 	public function get_ticket_subtotal() {
482
-		return EE_Taxes::get_subtotal_for_admin( $this );
482
+		return EE_Taxes::get_subtotal_for_admin($this);
483 483
 	}
484 484
 
485 485
 
@@ -489,7 +489,7 @@  discard block
 block discarded – undo
489 489
 	 * @return float
490 490
 	 */
491 491
 	public function get_ticket_taxes_total_for_admin() {
492
-		return EE_Taxes::get_total_taxes_for_admin( $this );
492
+		return EE_Taxes::get_total_taxes_for_admin($this);
493 493
 	}
494 494
 
495 495
 
@@ -499,8 +499,8 @@  discard block
 block discarded – undo
499 499
 	 * @param string $name
500 500
 	 * @return boolean
501 501
 	 */
502
-	function set_name( $name ) {
503
-		$this->set( 'TKT_name', $name );
502
+	function set_name($name) {
503
+		$this->set('TKT_name', $name);
504 504
 	}
505 505
 
506 506
 
@@ -510,7 +510,7 @@  discard block
 block discarded – undo
510 510
 	 * @return string
511 511
 	 */
512 512
 	function description() {
513
-		return $this->get( 'TKT_description' );
513
+		return $this->get('TKT_description');
514 514
 	}
515 515
 
516 516
 
@@ -520,8 +520,8 @@  discard block
 block discarded – undo
520 520
 	 * @param string $description
521 521
 	 * @return boolean
522 522
 	 */
523
-	function set_description( $description ) {
524
-		$this->set( 'TKT_description', $description );
523
+	function set_description($description) {
524
+		$this->set('TKT_description', $description);
525 525
 	}
526 526
 
527 527
 
@@ -532,8 +532,8 @@  discard block
 block discarded – undo
532 532
 	 * @param string $tm_frmt
533 533
 	 * @return string
534 534
 	 */
535
-	function start_date( $dt_frmt = '', $tm_frmt = '' ) {
536
-		return $this->_get_datetime( 'TKT_start_date', $dt_frmt, $tm_frmt );
535
+	function start_date($dt_frmt = '', $tm_frmt = '') {
536
+		return $this->_get_datetime('TKT_start_date', $dt_frmt, $tm_frmt);
537 537
 	}
538 538
 
539 539
 
@@ -543,8 +543,8 @@  discard block
 block discarded – undo
543 543
 	 * @param string $start_date
544 544
 	 * @return void
545 545
 	 */
546
-	function set_start_date( $start_date ) {
547
-		$this->_set_date_time( 'B', $start_date, 'TKT_start_date' );
546
+	function set_start_date($start_date) {
547
+		$this->_set_date_time('B', $start_date, 'TKT_start_date');
548 548
 	}
549 549
 
550 550
 
@@ -555,8 +555,8 @@  discard block
 block discarded – undo
555 555
 	 * @param string $tm_frmt
556 556
 	 * @return string
557 557
 	 */
558
-	function end_date( $dt_frmt = '', $tm_frmt = '' ) {
559
-		return $this->_get_datetime( 'TKT_end_date', $dt_frmt, $tm_frmt );
558
+	function end_date($dt_frmt = '', $tm_frmt = '') {
559
+		return $this->_get_datetime('TKT_end_date', $dt_frmt, $tm_frmt);
560 560
 	}
561 561
 
562 562
 
@@ -566,8 +566,8 @@  discard block
 block discarded – undo
566 566
 	 * @param string $end_date
567 567
 	 * @return void
568 568
 	 */
569
-	function set_end_date( $end_date ) {
570
-		$this->_set_date_time( 'B', $end_date, 'TKT_end_date' );
569
+	function set_end_date($end_date) {
570
+		$this->_set_date_time('B', $end_date, 'TKT_end_date');
571 571
 	}
572 572
 
573 573
 
@@ -579,8 +579,8 @@  discard block
 block discarded – undo
579 579
 	 *
580 580
 	 * @param string $time a string representation of the sell until time (ex 9am or 7:30pm)
581 581
 	 */
582
-	function set_end_time( $time ) {
583
-		$this->_set_time_for( $time, 'TKT_end_date' );
582
+	function set_end_time($time) {
583
+		$this->_set_time_for($time, 'TKT_end_date');
584 584
 	}
585 585
 
586 586
 
@@ -590,8 +590,8 @@  discard block
 block discarded – undo
590 590
 	 * @param int $min
591 591
 	 * @return boolean
592 592
 	 */
593
-	function set_min( $min ) {
594
-		$this->set( 'TKT_min', $min );
593
+	function set_min($min) {
594
+		$this->set('TKT_min', $min);
595 595
 	}
596 596
 
597 597
 
@@ -601,7 +601,7 @@  discard block
 block discarded – undo
601 601
 	 * @return int
602 602
 	 */
603 603
 	function max() {
604
-		return $this->get( 'TKT_max' );
604
+		return $this->get('TKT_max');
605 605
 	}
606 606
 
607 607
 
@@ -611,8 +611,8 @@  discard block
 block discarded – undo
611 611
 	 * @param int $max
612 612
 	 * @return boolean
613 613
 	 */
614
-	function set_max( $max ) {
615
-		$this->set( 'TKT_max', $max );
614
+	function set_max($max) {
615
+		$this->set('TKT_max', $max);
616 616
 	}
617 617
 
618 618
 
@@ -622,8 +622,8 @@  discard block
 block discarded – undo
622 622
 	 * @param float $price
623 623
 	 * @return boolean
624 624
 	 */
625
-	function set_price( $price ) {
626
-		$this->set( 'TKT_price', $price );
625
+	function set_price($price) {
626
+		$this->set('TKT_price', $price);
627 627
 	}
628 628
 
629 629
 
@@ -633,7 +633,7 @@  discard block
 block discarded – undo
633 633
 	 * @return int
634 634
 	 */
635 635
 	function sold() {
636
-		return $this->get_raw( 'TKT_sold' );
636
+		return $this->get_raw('TKT_sold');
637 637
 	}
638 638
 
639 639
 
@@ -643,10 +643,10 @@  discard block
 block discarded – undo
643 643
 	 * @param int $sold
644 644
 	 * @return boolean
645 645
 	 */
646
-	function set_sold( $sold ) {
646
+	function set_sold($sold) {
647 647
 		// sold can not go below zero
648
-		$sold = max( 0, $sold );
649
-		$this->set( 'TKT_sold', $sold );
648
+		$sold = max(0, $sold);
649
+		$this->set('TKT_sold', $sold);
650 650
 	}
651 651
 
652 652
 
@@ -656,13 +656,13 @@  discard block
 block discarded – undo
656 656
 	 * @param int $qty
657 657
 	 * @return boolean
658 658
 	 */
659
-	function increase_sold( $qty = 1 ) {
659
+	function increase_sold($qty = 1) {
660 660
 		$sold = $this->sold() + $qty;
661 661
 		// remove ticket reservation, but don't adjust datetime reservations,  because that will happen
662 662
 		// via \EE_Datetime::increase_sold() when \EE_Ticket::_increase_sold_for_datetimes() is called
663
-		$this->decrease_reserved( $qty, false );
664
-		$this->_increase_sold_for_datetimes( $qty );
665
-		return $this->set_sold( $sold );
663
+		$this->decrease_reserved($qty, false);
664
+		$this->_increase_sold_for_datetimes($qty);
665
+		return $this->set_sold($sold);
666 666
 	}
667 667
 
668 668
 
@@ -672,12 +672,12 @@  discard block
 block discarded – undo
672 672
 	 * @param int $qty
673 673
 	 * @return boolean
674 674
 	 */
675
-	protected function _increase_sold_for_datetimes( $qty = 1 ) {
675
+	protected function _increase_sold_for_datetimes($qty = 1) {
676 676
 		$datetimes = $this->datetimes();
677
-		if ( is_array( $datetimes ) ) {
678
-			foreach ( $datetimes as $datetime ) {
679
-				if ( $datetime instanceof EE_Datetime ) {
680
-					$datetime->increase_sold( $qty );
677
+		if (is_array($datetimes)) {
678
+			foreach ($datetimes as $datetime) {
679
+				if ($datetime instanceof EE_Datetime) {
680
+					$datetime->increase_sold($qty);
681 681
 					$datetime->save();
682 682
 				}
683 683
 			}
@@ -691,10 +691,10 @@  discard block
 block discarded – undo
691 691
 	 * @param int $qty
692 692
 	 * @return boolean
693 693
 	 */
694
-	function decrease_sold( $qty = 1 ) {
694
+	function decrease_sold($qty = 1) {
695 695
 		$sold = $this->sold() - $qty;
696
-		$this->_decrease_sold_for_datetimes( $qty );
697
-		return $this->set_sold( $sold );
696
+		$this->_decrease_sold_for_datetimes($qty);
697
+		return $this->set_sold($sold);
698 698
 	}
699 699
 
700 700
 
@@ -705,12 +705,12 @@  discard block
 block discarded – undo
705 705
 	* @param int $qty
706 706
 	* @return boolean
707 707
 	*/
708
-	protected function _decrease_sold_for_datetimes( $qty = 1 ) {
708
+	protected function _decrease_sold_for_datetimes($qty = 1) {
709 709
 		$datetimes = $this->datetimes();
710
-		if ( is_array( $datetimes ) ) {
711
-			foreach ( $datetimes as $datetime ) {
712
-				if ( $datetime instanceof EE_Datetime ) {
713
-					$datetime->decrease_sold( $qty );
710
+		if (is_array($datetimes)) {
711
+			foreach ($datetimes as $datetime) {
712
+				if ($datetime instanceof EE_Datetime) {
713
+					$datetime->decrease_sold($qty);
714 714
 					$datetime->save();
715 715
 				}
716 716
 			}
@@ -724,7 +724,7 @@  discard block
 block discarded – undo
724 724
 	 * @return int
725 725
 	 */
726 726
 	function reserved() {
727
-		return $this->get_raw( 'TKT_reserved' );
727
+		return $this->get_raw('TKT_reserved');
728 728
 	}
729 729
 
730 730
 
@@ -734,10 +734,10 @@  discard block
 block discarded – undo
734 734
 	 * @param int $reserved
735 735
 	 * @return boolean
736 736
 	 */
737
-	function set_reserved( $reserved ) {
737
+	function set_reserved($reserved) {
738 738
 		// reserved can not go below zero
739
-		$reserved = max( 0, intval( $reserved ) );
740
-		$this->set( 'TKT_reserved', $reserved );
739
+		$reserved = max(0, intval($reserved));
740
+		$this->set('TKT_reserved', $reserved);
741 741
 	}
742 742
 
743 743
 
@@ -747,11 +747,11 @@  discard block
 block discarded – undo
747 747
 	 * @param int $qty
748 748
 	 * @return boolean
749 749
 	 */
750
-	function increase_reserved( $qty = 1 ) {
751
-		$qty = absint( $qty );
750
+	function increase_reserved($qty = 1) {
751
+		$qty = absint($qty);
752 752
 		$reserved = $this->reserved() + $qty;
753
-		$this->_increase_reserved_for_datetimes( $qty );
754
-		return $this->set_reserved( $reserved );
753
+		$this->_increase_reserved_for_datetimes($qty);
754
+		return $this->set_reserved($reserved);
755 755
 	}
756 756
 
757 757
 
@@ -762,12 +762,12 @@  discard block
 block discarded – undo
762 762
 	 * @param int $qty
763 763
 	 * @return boolean
764 764
 	 */
765
-	protected function _increase_reserved_for_datetimes( $qty = 1 ) {
765
+	protected function _increase_reserved_for_datetimes($qty = 1) {
766 766
 		$datetimes = $this->datetimes();
767
-		if ( is_array( $datetimes ) ) {
768
-			foreach ( $datetimes as $datetime ) {
769
-				if ( $datetime instanceof EE_Datetime ) {
770
-					$datetime->increase_reserved( $qty );
767
+		if (is_array($datetimes)) {
768
+			foreach ($datetimes as $datetime) {
769
+				if ($datetime instanceof EE_Datetime) {
770
+					$datetime->increase_reserved($qty);
771 771
 					$datetime->save();
772 772
 				}
773 773
 			}
@@ -783,12 +783,12 @@  discard block
 block discarded – undo
783 783
 	 * @param bool $adjust_datetimes
784 784
 	 * @return bool
785 785
 	 */
786
-	function decrease_reserved( $qty = 1, $adjust_datetimes = true ) {
787
-		$reserved = $this->reserved() - absint( $qty );
788
-		if ( $adjust_datetimes ) {
789
-			$this->_decrease_reserved_for_datetimes( $qty );
786
+	function decrease_reserved($qty = 1, $adjust_datetimes = true) {
787
+		$reserved = $this->reserved() - absint($qty);
788
+		if ($adjust_datetimes) {
789
+			$this->_decrease_reserved_for_datetimes($qty);
790 790
 		}
791
-		return $this->set_reserved( $reserved );
791
+		return $this->set_reserved($reserved);
792 792
 	}
793 793
 
794 794
 
@@ -799,12 +799,12 @@  discard block
 block discarded – undo
799 799
 	 * @param int $qty
800 800
 	 * @return boolean
801 801
 	 */
802
-	protected function _decrease_reserved_for_datetimes( $qty = 1 ) {
802
+	protected function _decrease_reserved_for_datetimes($qty = 1) {
803 803
 		$datetimes = $this->datetimes();
804
-		if ( is_array( $datetimes ) ) {
805
-			foreach ( $datetimes as $datetime ) {
806
-				if ( $datetime instanceof EE_Datetime ) {
807
-					$datetime->decrease_reserved( $qty );
804
+		if (is_array($datetimes)) {
805
+			foreach ($datetimes as $datetime) {
806
+				if ($datetime instanceof EE_Datetime) {
807
+					$datetime->decrease_reserved($qty);
808 808
 					$datetime->save();
809 809
 				}
810 810
 			}
@@ -825,14 +825,14 @@  discard block
 block discarded – undo
825 825
 	 *
826 826
 	 * @return int
827 827
 	 */
828
-	function qty( $context = '' ) {
829
-		switch ( $context ) {
828
+	function qty($context = '') {
829
+		switch ($context) {
830 830
 			case 'reg_limit' :
831 831
 				return $this->real_quantity_on_ticket();
832 832
 			case 'saleable' :
833
-				return $this->real_quantity_on_ticket( 'saleable' );
833
+				return $this->real_quantity_on_ticket('saleable');
834 834
 			default:
835
-				return $this->get_raw( 'TKT_qty' );
835
+				return $this->get_raw('TKT_qty');
836 836
 		}
837 837
 	}
838 838
 
@@ -851,15 +851,15 @@  discard block
 block discarded – undo
851 851
 	 *
852 852
 	 * @return int
853 853
 	 */
854
-	function real_quantity_on_ticket( $context = 'reg_limit', $DTT_ID = 0 ) {
855
-		$raw = $this->get_raw( 'TKT_qty' );
854
+	function real_quantity_on_ticket($context = 'reg_limit', $DTT_ID = 0) {
855
+		$raw = $this->get_raw('TKT_qty');
856 856
 		// return immediately if it's zero
857
-		if ( $raw === 0 ) {
857
+		if ($raw === 0) {
858 858
 			return $raw;
859 859
 		}
860 860
 		//echo "\n\n<br />Ticket: " . $this->name() . '<br />';
861 861
 		// ensure qty doesn't exceed raw value for THIS ticket
862
-		$qty = min( EE_INF, $raw );
862
+		$qty = min(EE_INF, $raw);
863 863
 		//echo "\n . qty: " . $qty . '<br />';
864 864
 		// calculate this ticket's total sales and reservations
865 865
 		$sold_and_reserved_for_this_ticket = $this->sold() + $this->reserved();
@@ -868,23 +868,23 @@  discard block
 block discarded – undo
868 868
 		//echo "\n . sold_and_reserved_for_this_ticket: " . $sold_and_reserved_for_this_ticket . '<br />';
869 869
 		// first we need to calculate the maximum number of tickets available for the datetime
870 870
 		// do we want data for one datetime or all of them ?
871
-		$query_params = $DTT_ID ? array( array( 'DTT_ID' => $DTT_ID ) ) : array();
872
-		$datetimes = $this->datetimes( $query_params );
873
-		if ( is_array( $datetimes ) && ! empty( $datetimes ) ) {
874
-			foreach ( $datetimes as $datetime ) {
875
-				if ( $datetime instanceof EE_Datetime ) {
871
+		$query_params = $DTT_ID ? array(array('DTT_ID' => $DTT_ID)) : array();
872
+		$datetimes = $this->datetimes($query_params);
873
+		if (is_array($datetimes) && ! empty($datetimes)) {
874
+			foreach ($datetimes as $datetime) {
875
+				if ($datetime instanceof EE_Datetime) {
876 876
 					$datetime->refresh_from_db();
877 877
 					//echo "\n . . datetime name: " . $datetime->name() . '<br />';
878 878
 					//echo "\n . . datetime ID: " . $datetime->ID() . '<br />';
879 879
 					// initialize with no restrictions for each datetime
880 880
 					// but adjust datetime qty based on datetime reg limit
881
-					$datetime_qty = min( EE_INF, $datetime->reg_limit() );
881
+					$datetime_qty = min(EE_INF, $datetime->reg_limit());
882 882
 					//echo "\n . . . datetime reg_limit: " . $datetime->reg_limit() . '<br />';
883 883
 					//echo "\n . . . datetime_qty: " . $datetime_qty . '<br />';
884 884
 					// if we want the actual saleable amount, then we need to consider OTHER ticket sales
885 885
 					// and reservations for this datetime, that do NOT include sales and reservations
886 886
 					// for this ticket (so we add $this->sold() and $this->reserved() back in)
887
-					if ( $context == 'saleable' ) {
887
+					if ($context == 'saleable') {
888 888
 						$datetime_qty = max(
889 889
 							$datetime_qty - $datetime->sold_and_reserved() + $sold_and_reserved_for_this_ticket,
890 890
 							0
@@ -896,16 +896,16 @@  discard block
 block discarded – undo
896 896
 						$datetime_qty = ! $datetime->sold_out() ? $datetime_qty : 0;
897 897
 						//echo "\n . . . datetime_qty: " . $datetime_qty . '<br />';
898 898
 					}
899
-					$qty = min( $datetime_qty, $qty );
899
+					$qty = min($datetime_qty, $qty);
900 900
 					//echo "\n . . qty: " . $qty . '<br />';
901 901
 				}
902 902
 			}
903 903
 		}
904 904
 		// NOW that we know the  maximum number of tickets available for the datetime
905 905
 		// we can finally factor in the details for this specific ticket
906
-		if ( $qty > 0 && $context == 'saleable' ) {
906
+		if ($qty > 0 && $context == 'saleable') {
907 907
 			// and subtract the sales for THIS ticket
908
-			$qty = max( $qty - $sold_and_reserved_for_this_ticket, 0 );
908
+			$qty = max($qty - $sold_and_reserved_for_this_ticket, 0);
909 909
 			//echo "\n . qty: " . $qty . '<br />';
910 910
 		}
911 911
 		//echo "\nFINAL QTY: " . $qty . "<br /><br />";
@@ -921,14 +921,14 @@  discard block
 block discarded – undo
921 921
 	 * @return bool
922 922
 	 * @throws \EE_Error
923 923
 	 */
924
-	function set_qty( $qty ) {
924
+	function set_qty($qty) {
925 925
 		$datetimes = $this->datetimes();
926
-		foreach ( $datetimes as $datetime ) {
927
-			if ( $datetime instanceof EE_Datetime ) {
928
-				$qty = min( $qty, $datetime->reg_limit() );
926
+		foreach ($datetimes as $datetime) {
927
+			if ($datetime instanceof EE_Datetime) {
928
+				$qty = min($qty, $datetime->reg_limit());
929 929
 			}
930 930
 		}
931
-		$this->set( 'TKT_qty', $qty );
931
+		$this->set('TKT_qty', $qty);
932 932
 	}
933 933
 
934 934
 
@@ -938,7 +938,7 @@  discard block
 block discarded – undo
938 938
 	 * @return int
939 939
 	 */
940 940
 	function uses() {
941
-		return $this->get( 'TKT_uses' );
941
+		return $this->get('TKT_uses');
942 942
 	}
943 943
 
944 944
 
@@ -948,8 +948,8 @@  discard block
 block discarded – undo
948 948
 	 * @param int $uses
949 949
 	 * @return boolean
950 950
 	 */
951
-	function set_uses( $uses ) {
952
-		$this->set( 'TKT_uses', $uses );
951
+	function set_uses($uses) {
952
+		$this->set('TKT_uses', $uses);
953 953
 	}
954 954
 
955 955
 
@@ -959,7 +959,7 @@  discard block
 block discarded – undo
959 959
 	 * @return boolean
960 960
 	 */
961 961
 	public function required() {
962
-		return $this->get( 'TKT_required' );
962
+		return $this->get('TKT_required');
963 963
 	}
964 964
 
965 965
 
@@ -969,8 +969,8 @@  discard block
 block discarded – undo
969 969
 	 * @param boolean $required
970 970
 	 * @return boolean
971 971
 	 */
972
-	public function set_required( $required ) {
973
-		$this->set( 'TKT_required', $required );
972
+	public function set_required($required) {
973
+		$this->set('TKT_required', $required);
974 974
 	}
975 975
 
976 976
 
@@ -980,7 +980,7 @@  discard block
 block discarded – undo
980 980
 	 * @return boolean
981 981
 	 */
982 982
 	function taxable() {
983
-		return $this->get( 'TKT_taxable' );
983
+		return $this->get('TKT_taxable');
984 984
 	}
985 985
 
986 986
 
@@ -990,8 +990,8 @@  discard block
 block discarded – undo
990 990
 	 * @param boolean $taxable
991 991
 	 * @return boolean
992 992
 	 */
993
-	function set_taxable( $taxable ) {
994
-		$this->set( 'TKT_taxable', $taxable );
993
+	function set_taxable($taxable) {
994
+		$this->set('TKT_taxable', $taxable);
995 995
 	}
996 996
 
997 997
 
@@ -1001,7 +1001,7 @@  discard block
 block discarded – undo
1001 1001
 	 * @return boolean
1002 1002
 	 */
1003 1003
 	function is_default() {
1004
-		return $this->get( 'TKT_is_default' );
1004
+		return $this->get('TKT_is_default');
1005 1005
 	}
1006 1006
 
1007 1007
 
@@ -1011,8 +1011,8 @@  discard block
 block discarded – undo
1011 1011
 	 * @param boolean $is_default
1012 1012
 	 * @return boolean
1013 1013
 	 */
1014
-	function set_is_default( $is_default ) {
1015
-		$this->set( 'TKT_is_default', $is_default );
1014
+	function set_is_default($is_default) {
1015
+		$this->set('TKT_is_default', $is_default);
1016 1016
 	}
1017 1017
 
1018 1018
 
@@ -1022,7 +1022,7 @@  discard block
 block discarded – undo
1022 1022
 	 * @return int
1023 1023
 	 */
1024 1024
 	function order() {
1025
-		return $this->get( 'TKT_order' );
1025
+		return $this->get('TKT_order');
1026 1026
 	}
1027 1027
 
1028 1028
 
@@ -1032,8 +1032,8 @@  discard block
 block discarded – undo
1032 1032
 	 * @param int $order
1033 1033
 	 * @return boolean
1034 1034
 	 */
1035
-	function set_order( $order ) {
1036
-		$this->set( 'TKT_order', $order );
1035
+	function set_order($order) {
1036
+		$this->set('TKT_order', $order);
1037 1037
 	}
1038 1038
 
1039 1039
 
@@ -1043,7 +1043,7 @@  discard block
 block discarded – undo
1043 1043
 	 * @return int
1044 1044
 	 */
1045 1045
 	function row() {
1046
-		return $this->get( 'TKT_row' );
1046
+		return $this->get('TKT_row');
1047 1047
 	}
1048 1048
 
1049 1049
 
@@ -1053,8 +1053,8 @@  discard block
 block discarded – undo
1053 1053
 	 * @param int $row
1054 1054
 	 * @return boolean
1055 1055
 	 */
1056
-	function set_row( $row ) {
1057
-		$this->set( 'TKT_row', $row );
1056
+	function set_row($row) {
1057
+		$this->set('TKT_row', $row);
1058 1058
 	}
1059 1059
 
1060 1060
 
@@ -1064,7 +1064,7 @@  discard block
 block discarded – undo
1064 1064
 	 * @return boolean
1065 1065
 	 */
1066 1066
 	function deleted() {
1067
-		return $this->get( 'TKT_deleted' );
1067
+		return $this->get('TKT_deleted');
1068 1068
 	}
1069 1069
 
1070 1070
 
@@ -1074,8 +1074,8 @@  discard block
 block discarded – undo
1074 1074
 	 * @param boolean $deleted
1075 1075
 	 * @return boolean
1076 1076
 	 */
1077
-	function set_deleted( $deleted ) {
1078
-		$this->set( 'TKT_deleted', $deleted );
1077
+	function set_deleted($deleted) {
1078
+		$this->set('TKT_deleted', $deleted);
1079 1079
 	}
1080 1080
 
1081 1081
 
@@ -1085,7 +1085,7 @@  discard block
 block discarded – undo
1085 1085
 	 * @return int
1086 1086
 	 */
1087 1087
 	function parent_ID() {
1088
-		return $this->get( 'TKT_parent' );
1088
+		return $this->get('TKT_parent');
1089 1089
 	}
1090 1090
 
1091 1091
 
@@ -1095,8 +1095,8 @@  discard block
 block discarded – undo
1095 1095
 	 * @param int $parent
1096 1096
 	 * @return boolean
1097 1097
 	 */
1098
-	function set_parent_ID( $parent ) {
1099
-		$this->set( 'TKT_parent', $parent );
1098
+	function set_parent_ID($parent) {
1099
+		$this->set('TKT_parent', $parent);
1100 1100
 	}
1101 1101
 
1102 1102
 
@@ -1107,10 +1107,10 @@  discard block
 block discarded – undo
1107 1107
 	 */
1108 1108
 	function name_and_info() {
1109 1109
 		$times = array();
1110
-		foreach ( $this->datetimes() as $datetime ) {
1110
+		foreach ($this->datetimes() as $datetime) {
1111 1111
 			$times[] = $datetime->start_date_and_time();
1112 1112
 		}
1113
-		return $this->name() . " @ " . implode( ", ", $times ) . " for " . $this->pretty_price();
1113
+		return $this->name()." @ ".implode(", ", $times)." for ".$this->pretty_price();
1114 1114
 	}
1115 1115
 
1116 1116
 
@@ -1120,7 +1120,7 @@  discard block
 block discarded – undo
1120 1120
 	 * @return string
1121 1121
 	 */
1122 1122
 	function name() {
1123
-		return $this->get( 'TKT_name' );
1123
+		return $this->get('TKT_name');
1124 1124
 	}
1125 1125
 
1126 1126
 
@@ -1130,7 +1130,7 @@  discard block
 block discarded – undo
1130 1130
 	 * @return float
1131 1131
 	 */
1132 1132
 	function price() {
1133
-		return $this->get( 'TKT_price' );
1133
+		return $this->get('TKT_price');
1134 1134
 	}
1135 1135
 
1136 1136
 
@@ -1140,8 +1140,8 @@  discard block
 block discarded – undo
1140 1140
 	 * @param array $query_params like EEM_Base::get_all's
1141 1141
 	 * @return EE_Registration[]
1142 1142
 	 */
1143
-	public function registrations( $query_params = array() ) {
1144
-		return $this->get_many_related( 'Registration', $query_params );
1143
+	public function registrations($query_params = array()) {
1144
+		return $this->get_many_related('Registration', $query_params);
1145 1145
 	}
1146 1146
 
1147 1147
 
@@ -1152,8 +1152,8 @@  discard block
 block discarded – undo
1152 1152
 	 * @return int
1153 1153
 	 */
1154 1154
 	public function update_tickets_sold() {
1155
-		$count_regs_for_this_ticket = $this->count_registrations( array( array( 'STS_ID' => EEM_Registration::status_id_approved, 'REG_deleted' => 0 ) ) );
1156
-		$this->set_sold( $count_regs_for_this_ticket );
1155
+		$count_regs_for_this_ticket = $this->count_registrations(array(array('STS_ID' => EEM_Registration::status_id_approved, 'REG_deleted' => 0)));
1156
+		$this->set_sold($count_regs_for_this_ticket);
1157 1157
 		$this->save();
1158 1158
 		return $count_regs_for_this_ticket;
1159 1159
 	}
@@ -1165,7 +1165,7 @@  discard block
 block discarded – undo
1165 1165
 	 * @param array $query_params like EEM_Base::get_all's
1166 1166
 	 * @return int
1167 1167
 	 */
1168
-	public function count_registrations( $query_params = array() ) {
1168
+	public function count_registrations($query_params = array()) {
1169 1169
 		return $this->count_related('Registration', $query_params);
1170 1170
 	}
1171 1171
 
@@ -1190,23 +1190,23 @@  discard block
 block discarded – undo
1190 1190
 	public function get_related_event() {
1191 1191
 		//get one datetime to use for getting the event
1192 1192
 		$datetime = $this->first_datetime();
1193
-		if ( ! $datetime instanceof \EE_Datetime ) {
1193
+		if ( ! $datetime instanceof \EE_Datetime) {
1194 1194
 			throw new UnexpectedEntityException(
1195 1195
 				$datetime,
1196 1196
 				'EE_Datetime',
1197 1197
 				sprintf(
1198
-					__( "The ticket (%s) is not associated with any valid datetimes.", "event_espresso" ),
1198
+					__("The ticket (%s) is not associated with any valid datetimes.", "event_espresso"),
1199 1199
 					$datetime->name()
1200 1200
 				)
1201 1201
 			);
1202 1202
 		}
1203 1203
 		$event = $datetime->event();
1204
-		if ( ! $event instanceof \EE_Event ) {
1204
+		if ( ! $event instanceof \EE_Event) {
1205 1205
 			throw new UnexpectedEntityException(
1206 1206
 				$event,
1207 1207
 				'EE_Event',
1208 1208
 				sprintf(
1209
-					__( "The ticket (%s) is not associated with a valid event.", "event_espresso" ),
1209
+					__("The ticket (%s) is not associated with a valid event.", "event_espresso"),
1210 1210
 					$this->name()
1211 1211
 				)
1212 1212
 			);
Please login to merge, or discard this patch.