Completed
Branch BUG-9680-compress-dompdf-files... (43e183)
by
unknown
577:38 queued 559:24
created
EE_Admin_Table_Registration_Line_Item_Display_Strategy.strategy.php 1 patch
Spacing   +42 added lines, -42 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
  *
11 11
  */
12 12
 
13
-class EE_Admin_Table_Registration_Line_Item_Display_Strategy extends EE_Admin_Table_Line_Item_Display_Strategy  {
13
+class EE_Admin_Table_Registration_Line_Item_Display_Strategy extends EE_Admin_Table_Line_Item_Display_Strategy {
14 14
 
15 15
 	/**
16 16
 	 * Table header for display.
@@ -18,14 +18,14 @@  discard block
 block discarded – undo
18 18
 	 * @param array $options
19 19
 	 * @return string
20 20
 	 */
21
-	protected function _table_header( $options ) {
22
-		$html = EEH_HTML::table( '','', $options['table_css_class'] );
21
+	protected function _table_header($options) {
22
+		$html = EEH_HTML::table('', '', $options['table_css_class']);
23 23
 		$html .= EEH_HTML::thead();
24 24
 		$html .= EEH_HTML::tr();
25
-		$html .= EEH_HTML::th( __( 'Name', 'event_espresso' ), '', 'jst-left' );
26
-		$html .= EEH_HTML::th( __( 'Type', 'event_espresso'), '', 'jst-left' );
27
-		$html .= EEH_HTML::th( __( 'Date(s)', 'event_espresso' ), '', 'jst-left' );
28
-		$html .= EEH_HTML::th( __( 'Amount', 'event_espresso' ), '', 'jst-cntr' );
25
+		$html .= EEH_HTML::th(__('Name', 'event_espresso'), '', 'jst-left');
26
+		$html .= EEH_HTML::th(__('Type', 'event_espresso'), '', 'jst-left');
27
+		$html .= EEH_HTML::th(__('Date(s)', 'event_espresso'), '', 'jst-left');
28
+		$html .= EEH_HTML::th(__('Amount', 'event_espresso'), '', 'jst-cntr');
29 29
 		$html .= EEH_HTML::tbody();
30 30
 		return $html;
31 31
 	}
@@ -41,12 +41,12 @@  discard block
 block discarded – undo
41 41
 	 * @param array        $options
42 42
 	 * @return mixed
43 43
 	 */
44
-	protected function _item_row( EE_Line_Item $line_item, $options = array() ) {
44
+	protected function _item_row(EE_Line_Item $line_item, $options = array()) {
45 45
 		$line_item_related_object = $line_item->get_object();
46 46
 		$parent_line_item_related_object = $line_item->parent() instanceof EE_Line_Item ? $line_item->parent()->get_object() : null;
47 47
 		// start of row
48 48
 		$row_class = $options['odd'] ? 'item odd' : 'item';
49
-		$html = EEH_HTML::tr( '', '', $row_class );
49
+		$html = EEH_HTML::tr('', '', $row_class);
50 50
 
51 51
 
52 52
 		//Name Column
@@ -54,48 +54,48 @@  discard block
 block discarded – undo
54 54
 
55 55
 		//related object scope.
56 56
 		$parent_related_object_name = $parent_line_item_related_object instanceof EEI_Line_Item_Object ? $parent_line_item_related_object->name() : '';
57
-		$parent_related_object_name = empty( $parent_related_object_name ) && $line_item->parent() instanceof EE_Line_Item ? $line_item->parent()->name() : $parent_related_object_name;
57
+		$parent_related_object_name = empty($parent_related_object_name) && $line_item->parent() instanceof EE_Line_Item ? $line_item->parent()->name() : $parent_related_object_name;
58 58
 		$parent_related_object_link = $parent_line_item_related_object instanceof EEI_Admin_Links ? $parent_line_item_related_object->get_admin_details_link() : '';
59 59
 
60 60
 
61 61
 		$name_html = $line_item_related_object instanceof EEI_Line_Item_Object ? $line_item_related_object->name() : $line_item->name();
62
-		$name_html = $name_link ? '<a href="' . $name_link . '">' . $name_html . '</a>' : $name_html;
62
+		$name_html = $name_link ? '<a href="'.$name_link.'">'.$name_html.'</a>' : $name_html;
63 63
 		$name_html .= $line_item->is_taxable() ? ' *' : '';
64 64
 		//maybe preface with icon?
65
-		$name_html = $line_item_related_object instanceof EEI_Has_Icon ? $line_item_related_object->get_icon() . $name_html : $name_html;
66
-		$name_html = '<span class="ee-line-item-name linked">' . $name_html . '</span><br>';
67
-		$name_html .=  sprintf(
68
-			_x( '%1$sfor the %2$s: %3$s%4$s', 'eg. "for the Event: My Cool Event"', 'event_espresso'),
65
+		$name_html = $line_item_related_object instanceof EEI_Has_Icon ? $line_item_related_object->get_icon().$name_html : $name_html;
66
+		$name_html = '<span class="ee-line-item-name linked">'.$name_html.'</span><br>';
67
+		$name_html .= sprintf(
68
+			_x('%1$sfor the %2$s: %3$s%4$s', 'eg. "for the Event: My Cool Event"', 'event_espresso'),
69 69
 			'<span class="ee-line-item-related-parent-object">',
70
-			$line_item->parent() instanceof EE_Line_Item ? $line_item->parent()->OBJ_type_i18n() : __( 'Item:', 'event_espresso' ),
71
-			$parent_related_object_link ? '<a href="' . $parent_related_object_link . '">' . $parent_related_object_name . '</a>' : $parent_related_object_name,
70
+			$line_item->parent() instanceof EE_Line_Item ? $line_item->parent()->OBJ_type_i18n() : __('Item:', 'event_espresso'),
71
+			$parent_related_object_link ? '<a href="'.$parent_related_object_link.'">'.$parent_related_object_name.'</a>' : $parent_related_object_name,
72 72
 			'</span>'
73 73
 		);
74
-		$html .= EEH_HTML::td( $name_html, '', 'jst-left' );
74
+		$html .= EEH_HTML::td($name_html, '', 'jst-left');
75 75
 
76 76
 		//Type Column
77
-		$type_html = $line_item->OBJ_type() ? $line_item->OBJ_type_i18n() . '<br />' : '';
77
+		$type_html = $line_item->OBJ_type() ? $line_item->OBJ_type_i18n().'<br />' : '';
78 78
 		$code = $line_item_related_object instanceof EEI_Has_Code ? $line_item_related_object->code() : '';
79
-		$type_html .= ! empty( $code ) ? '<span class="ee-line-item-id">' . sprintf( __( 'Code: %s', 'event_espresso' ), $code ) . '</span>' : '';
80
-		$html .= EEH_HTML::td( $type_html, '', 'jst-left' );
79
+		$type_html .= ! empty($code) ? '<span class="ee-line-item-id">'.sprintf(__('Code: %s', 'event_espresso'), $code).'</span>' : '';
80
+		$html .= EEH_HTML::td($type_html, '', 'jst-left');
81 81
 
82 82
 		//Date column
83 83
 		$datetime_content = '';
84
-		if ( $line_item_related_object instanceof EE_Ticket ) {
84
+		if ($line_item_related_object instanceof EE_Ticket) {
85 85
 			$datetimes = $line_item_related_object->datetimes();
86
-			foreach ( $datetimes as $datetime ) {
87
-				if ( $datetime instanceof EE_Datetime ) {
88
-					$datetime_content .= $datetime->get_dtt_display_name() . '<br>';
86
+			foreach ($datetimes as $datetime) {
87
+				if ($datetime instanceof EE_Datetime) {
88
+					$datetime_content .= $datetime->get_dtt_display_name().'<br>';
89 89
 				}
90 90
 			}
91 91
 		}
92
-		$html .= EEH_HTML::td( $datetime_content, '', 'jst-left' );
92
+		$html .= EEH_HTML::td($datetime_content, '', 'jst-left');
93 93
 
94 94
 		//Amount Column
95
-		if ( $line_item->is_percent() ) {
96
-			$html .= EEH_HTML::td( $line_item->percent() . '%', '', 'jst-rght' );
95
+		if ($line_item->is_percent()) {
96
+			$html .= EEH_HTML::td($line_item->percent().'%', '', 'jst-rght');
97 97
 		} else {
98
-			$html .= EEH_HTML::td( $line_item->unit_price_no_code(), '', 'jst-rght' );
98
+			$html .= EEH_HTML::td($line_item->unit_price_no_code(), '', 'jst-rght');
99 99
 		}
100 100
 
101 101
 
@@ -113,13 +113,13 @@  discard block
 block discarded – undo
113 113
 	 * @param array        $options
114 114
 	 * @return mixed
115 115
 	 */
116
-	protected function _tax_row( EE_Line_Item $line_item, $options = array() ) {
116
+	protected function _tax_row(EE_Line_Item $line_item, $options = array()) {
117 117
 		// start of row
118
-		$html = EEH_HTML::tr( '', 'admin-primary-mbox-taxes-tr' );
118
+		$html = EEH_HTML::tr('', 'admin-primary-mbox-taxes-tr');
119 119
 		// name th
120
-		$html .= EEH_HTML::th(  $line_item->name() . '(' . $line_item->get_pretty( 'LIN_percent' ) . '%)', '',  'jst-rght', '', ' colspan="3"' );
120
+		$html .= EEH_HTML::th($line_item->name().'('.$line_item->get_pretty('LIN_percent').'%)', '', 'jst-rght', '', ' colspan="3"');
121 121
 		// total th
122
-		$html .= EEH_HTML::th( EEH_Template::format_currency( $line_item->total(), false, false ), '', 'jst-rght' );
122
+		$html .= EEH_HTML::th(EEH_Template::format_currency($line_item->total(), false, false), '', 'jst-rght');
123 123
 		// end of row
124 124
 		$html .= EEH_HTML::trx();
125 125
 		return $html;
@@ -136,9 +136,9 @@  discard block
 block discarded – undo
136 136
 	 * @param array        $options
137 137
 	 * @return mixed
138 138
 	 */
139
-	protected function _total_row( EE_Line_Item $line_item, $options = array() ) {
139
+	protected function _total_row(EE_Line_Item $line_item, $options = array()) {
140 140
 
141
-		$registration = isset( $options['EE_Registration'] ) ? $options['EE_Registration'] : null;
141
+		$registration = isset($options['EE_Registration']) ? $options['EE_Registration'] : null;
142 142
 		$registration_total = $registration instanceof EE_Registration ? $registration->pretty_final_price() : 0;
143 143
 		//if no valid registration object then we're not going to show the approximate text.
144 144
 		$total_match = $registration instanceof EE_Registration ? $registration->final_price() == $line_item->total() : true;
@@ -146,26 +146,26 @@  discard block
 block discarded – undo
146 146
 
147 147
 
148 148
 		// start of row
149
-		$html = EEH_HTML::tr( '', '', 'admin-primary-mbox-total-tr' );
149
+		$html = EEH_HTML::tr('', '', 'admin-primary-mbox-total-tr');
150 150
 		// Total th label
151
-		if ( $total_match ) {
152
-			$total_label = sprintf( __( 'This registration\'s total %s:', 'event_espresso' ), '(' . EE_Registry::instance()->CFG->currency->code . ')' );
151
+		if ($total_match) {
152
+			$total_label = sprintf(__('This registration\'s total %s:', 'event_espresso'), '('.EE_Registry::instance()->CFG->currency->code.')');
153 153
 		} else {
154
-			$total_label = sprintf( __( 'This registration\'s approximate total %s', 'event_espresso' ), '(' . EE_Registry::instance()->CFG->currency->code . ')' );
154
+			$total_label = sprintf(__('This registration\'s approximate total %s', 'event_espresso'), '('.EE_Registry::instance()->CFG->currency->code.')');
155 155
 			$total_label .= '<br>';
156 156
 			$total_label .= '<p class="ee-footnote-text">'
157 157
 			                . sprintf(
158
-				                __( 'The registrations\' share of the transaction total is approximate because it might not be possible to evenly divide the transaction total among each registration, and so some registrations may need to pay a penny more than others.  This registration\'s final share is actually %1$s%2$s%3$s.', 'event_espresso' ),
158
+				                __('The registrations\' share of the transaction total is approximate because it might not be possible to evenly divide the transaction total among each registration, and so some registrations may need to pay a penny more than others.  This registration\'s final share is actually %1$s%2$s%3$s.', 'event_espresso'),
159 159
 				                '<strong>',
160 160
 				                $registration_total,
161 161
 				                '</strong>'
162 162
 			                )
163 163
 			                . '</p>';
164 164
 		}
165
-		$html .= EEH_HTML::th( $total_label, '',  'jst-rght',  '',  ' colspan="3"' );
165
+		$html .= EEH_HTML::th($total_label, '', 'jst-rght', '', ' colspan="3"');
166 166
 		// total th
167 167
 
168
-		$html .= EEH_HTML::th( EEH_Template::format_currency( $line_item->total(), false, false ), '',  'jst-rght' );
168
+		$html .= EEH_HTML::th(EEH_Template::format_currency($line_item->total(), false, false), '', 'jst-rght');
169 169
 		// end of row
170 170
 		$html .= EEH_HTML::trx();
171 171
 		return $html;
Please login to merge, or discard this patch.
libraries/line_item_display/EE_SPCO_Line_Item_Display_Strategy.strategy.php 1 patch
Spacing   +118 added lines, -118 removed lines patch added patch discarded remove patch
@@ -69,101 +69,101 @@  discard block
 block discarded – undo
69 69
 	 * @param array        $options
70 70
 	 * @return mixed
71 71
 	 */
72
-	public function display_line_item( EE_Line_Item $line_item, $options = array() ) {
72
+	public function display_line_item(EE_Line_Item $line_item, $options = array()) {
73 73
 
74 74
 		$html = '';
75 75
 		// set some default options and merge with incoming
76 76
 		$default_options = array(
77
-			'show_desc' => true,  // 	true 		false
77
+			'show_desc' => true, // 	true 		false
78 78
 			'odd' => false
79 79
 		);
80
-		$options = array_merge( $default_options, (array)$options );
80
+		$options = array_merge($default_options, (array) $options);
81 81
 
82
-		switch( $line_item->type() ) {
82
+		switch ($line_item->type()) {
83 83
 
84 84
 			case EEM_Line_Item::type_line_item:
85 85
 				$this->_show_taxes = $line_item->is_taxable() ? true : $this->_show_taxes;
86
-				if ( $line_item->OBJ_type() == 'Ticket' ) {
86
+				if ($line_item->OBJ_type() == 'Ticket') {
87 87
 					// item row
88
-					$html .= $this->_ticket_row( $line_item, $options );
88
+					$html .= $this->_ticket_row($line_item, $options);
89 89
 					// got any kids?
90
-					foreach ( $line_item->children() as $child_line_item ) {
91
-						$this->display_line_item( $child_line_item, $options );
90
+					foreach ($line_item->children() as $child_line_item) {
91
+						$this->display_line_item($child_line_item, $options);
92 92
 					}
93 93
 				} else {
94 94
 					// item row
95
-					$html .= $this->_item_row( $line_item, $options );
95
+					$html .= $this->_item_row($line_item, $options);
96 96
 					// got any kids?
97
-					foreach ( $line_item->children() as $child_line_item ) {
98
-						$this->display_line_item( $child_line_item, $options );
97
+					foreach ($line_item->children() as $child_line_item) {
98
+						$this->display_line_item($child_line_item, $options);
99 99
 					}
100 100
 				}
101 101
 				break;
102 102
 
103 103
 			case EEM_Line_Item::type_sub_line_item:
104
-				$html .= $this->_sub_item_row( $line_item, $options );
104
+				$html .= $this->_sub_item_row($line_item, $options);
105 105
 				break;
106 106
 
107 107
 			case EEM_Line_Item::type_sub_total:
108 108
 				static $sub_total = 0;
109 109
 				$event_sub_total = 0;
110
-				$text = __( 'Sub-Total', 'event_espresso' );
111
-				if ( $line_item->OBJ_type() == 'Event' ) {
112
-					$options[ 'event_id' ] = $event_id = $line_item->OBJ_ID();
113
-					if ( ! isset( $this->_events[ $options[ 'event_id' ] ] ) ) {
114
-						$event = EEM_Event::instance()->get_one_by_ID( $options[ 'event_id' ] );
115
-						if ( $event instanceof EE_Event ) {
116
-							if ( $event->default_registration_status() == EEM_Registration::status_id_not_approved ) {
110
+				$text = __('Sub-Total', 'event_espresso');
111
+				if ($line_item->OBJ_type() == 'Event') {
112
+					$options['event_id'] = $event_id = $line_item->OBJ_ID();
113
+					if ( ! isset($this->_events[$options['event_id']])) {
114
+						$event = EEM_Event::instance()->get_one_by_ID($options['event_id']);
115
+						if ($event instanceof EE_Event) {
116
+							if ($event->default_registration_status() == EEM_Registration::status_id_not_approved) {
117 117
 								return '';
118 118
 							}
119 119
 						}
120
-						$this->_events[ $options[ 'event_id' ] ] = 0;
121
-						$html .= $this->_event_row( $line_item );
122
-						$text = __( 'Event Sub-Total', 'event_espresso' );
120
+						$this->_events[$options['event_id']] = 0;
121
+						$html .= $this->_event_row($line_item);
122
+						$text = __('Event Sub-Total', 'event_espresso');
123 123
 					}
124 124
 				}
125 125
 				$child_line_items = $line_item->children();
126 126
 				// loop thru children
127
-				foreach( $child_line_items as $child_line_item ) {
127
+				foreach ($child_line_items as $child_line_item) {
128 128
 					// recursively feed children back into this method
129
-					$html .= $this->display_line_item( $child_line_item, $options );
129
+					$html .= $this->display_line_item($child_line_item, $options);
130 130
 				}
131
-				$event_sub_total += isset( $options[ 'event_id' ] ) ? $this->_events[ $options[ 'event_id' ] ] : 0;
131
+				$event_sub_total += isset($options['event_id']) ? $this->_events[$options['event_id']] : 0;
132 132
 				$sub_total += $event_sub_total;
133 133
 				if (
134 134
 					(
135 135
 						// event subtotals
136 136
 						$line_item->code() != 'pre-tax-subtotal' &&
137
-						count( $child_line_items ) > 1
137
+						count($child_line_items) > 1
138 138
 					)
139 139
 					||
140 140
 					(
141 141
 						// pre-tax subtotals
142 142
 						$line_item->code() == 'pre-tax-subtotal' &&
143
-						count( $this->_events ) > 1
143
+						count($this->_events) > 1
144 144
 					)
145 145
 				) {
146 146
 					$options['sub_total'] = $line_item->OBJ_type() == 'Event' ? $event_sub_total : $sub_total;
147
-					$html .= $this->_sub_total_row( $line_item, $text, $options );
147
+					$html .= $this->_sub_total_row($line_item, $text, $options);
148 148
 				}
149 149
 				break;
150 150
 
151 151
 			case EEM_Line_Item::type_tax:
152
-				if ( $this->_show_taxes ) {
153
-					$this->_taxes_html .= $this->_tax_row( $line_item, $options );
152
+				if ($this->_show_taxes) {
153
+					$this->_taxes_html .= $this->_tax_row($line_item, $options);
154 154
 				}
155 155
 				break;
156 156
 
157 157
 			case EEM_Line_Item::type_tax_sub_total:
158
-				if ( $this->_show_taxes ) {
158
+				if ($this->_show_taxes) {
159 159
 					$child_line_items = $line_item->children();
160 160
 					// loop thru children
161
-					foreach( $child_line_items as $child_line_item ) {
161
+					foreach ($child_line_items as $child_line_item) {
162 162
 						// recursively feed children back into this method
163
-						$html .= $this->display_line_item( $child_line_item, $options );
163
+						$html .= $this->display_line_item($child_line_item, $options);
164 164
 					}
165
-					if ( count( $child_line_items ) > 1 ) {
166
-						$this->_taxes_html .= $this->_total_tax_row( $line_item, __( 'Tax Total', 'event_espresso' ) );
165
+					if (count($child_line_items) > 1) {
166
+						$this->_taxes_html .= $this->_total_tax_row($line_item, __('Tax Total', 'event_espresso'));
167 167
 					}
168 168
 				}
169 169
 				break;
@@ -172,25 +172,25 @@  discard block
 block discarded – undo
172 172
 				// get all child line items
173 173
 				$children = $line_item->children();
174 174
 				// loop thru all non-tax child line items
175
-				foreach( $children as $child_line_item ) {
176
-					if ( $child_line_item->type() != EEM_Line_Item::type_tax_sub_total ) {
175
+				foreach ($children as $child_line_item) {
176
+					if ($child_line_item->type() != EEM_Line_Item::type_tax_sub_total) {
177 177
 						// recursively feed children back into this method
178
-						$html .= $this->display_line_item( $child_line_item, $options );
178
+						$html .= $this->display_line_item($child_line_item, $options);
179 179
 					}
180 180
 				}
181 181
 
182 182
 				// now loop thru  tax child line items
183
-				foreach( $children as $child_line_item ) {
184
-					if ( $child_line_item->type() == EEM_Line_Item::type_tax_sub_total ) {
183
+				foreach ($children as $child_line_item) {
184
+					if ($child_line_item->type() == EEM_Line_Item::type_tax_sub_total) {
185 185
 						// recursively feed children back into this method
186
-						$html .= $this->display_line_item( $child_line_item, $options );
186
+						$html .= $this->display_line_item($child_line_item, $options);
187 187
 					}
188 188
 				}
189 189
 				$html .= $this->_taxes_html;
190
-				$html .= $this->_total_row( $line_item, __('Total', 'event_espresso') );
190
+				$html .= $this->_total_row($line_item, __('Total', 'event_espresso'));
191 191
 
192 192
 
193
-				$html .= $this->_payments_and_amount_owing_rows( $line_item, $options );
193
+				$html .= $this->_payments_and_amount_owing_rows($line_item, $options);
194 194
 				break;
195 195
 
196 196
 		}
@@ -205,11 +205,11 @@  discard block
 block discarded – undo
205 205
 	 * @param EE_Line_Item $line_item
206 206
 	 * @return mixed
207 207
 	 */
208
-	private function _event_row( EE_Line_Item $line_item ) {
208
+	private function _event_row(EE_Line_Item $line_item) {
209 209
 		// start of row
210
-		$html = EEH_HTML::tr( '', 'event-cart-total-row', 'total_tr odd' );
210
+		$html = EEH_HTML::tr('', 'event-cart-total-row', 'total_tr odd');
211 211
 		// event name td
212
-		$html .= EEH_HTML::td( EEH_HTML::strong( $line_item->name() ), '', 'event-header', '', ' colspan="4"' );
212
+		$html .= EEH_HTML::td(EEH_HTML::strong($line_item->name()), '', 'event-header', '', ' colspan="4"');
213 213
 		// end of row
214 214
 		$html .= EEH_HTML::trx();
215 215
 		return $html;
@@ -224,10 +224,10 @@  discard block
 block discarded – undo
224 224
 	 * @param array        $options
225 225
 	 * @return mixed
226 226
 	 */
227
-	private function _ticket_row( EE_Line_Item $line_item, $options = array() ) {
227
+	private function _ticket_row(EE_Line_Item $line_item, $options = array()) {
228 228
 		// start of row
229 229
 		$row_class = $options['odd'] ? 'item odd' : 'item';
230
-		$html = EEH_HTML::tr( '', '', $row_class );
230
+		$html = EEH_HTML::tr('', '', $row_class);
231 231
 		// name && desc
232 232
 		$name_and_desc = apply_filters(
233 233
 			'FHEE__EE_SPCO_Line_Item_Display_Strategy__item_row__name',
@@ -236,23 +236,23 @@  discard block
 block discarded – undo
236 236
 		);
237 237
 		$name_and_desc .= apply_filters(
238 238
 			'FHEE__EE_SPCO_Line_Item_Display_Strategy__item_row__desc',
239
-			( $options['show_desc'] ? '<span class="line-item-desc-spn smaller-text">: ' . $line_item->desc() . '</span>' : '' ),
239
+			($options['show_desc'] ? '<span class="line-item-desc-spn smaller-text">: '.$line_item->desc().'</span>' : ''),
240 240
 			$line_item,
241 241
 			$options
242 242
 		);
243 243
 		$name_and_desc .= $line_item->is_taxable() ? ' * ' : '';
244 244
 		// name td
245
-		$html .= EEH_HTML::td( /*__FUNCTION__ .*/ $name_and_desc, '',  'item_l' );
245
+		$html .= EEH_HTML::td( /*__FUNCTION__ .*/ $name_and_desc, '', 'item_l' );
246 246
 		// price td
247
-		$html .= EEH_HTML::td( $line_item->unit_price_no_code(), '',  'item_c jst-rght' );
247
+		$html .= EEH_HTML::td($line_item->unit_price_no_code(), '', 'item_c jst-rght');
248 248
 		// quantity td
249
-		$html .= EEH_HTML::td( $line_item->quantity(), '', 'item_l jst-rght' );
249
+		$html .= EEH_HTML::td($line_item->quantity(), '', 'item_l jst-rght');
250 250
 		$this->_total_items += $line_item->quantity();
251 251
 		// determine total for line item
252 252
 		$total = $line_item->total();
253
-		$this->_events[ $options[ 'event_id' ] ] += $total;
253
+		$this->_events[$options['event_id']] += $total;
254 254
 		// total td
255
-		$html .= EEH_HTML::td( EEH_Template::format_currency( $total, false, false ), '',  'item_r jst-rght' );
255
+		$html .= EEH_HTML::td(EEH_Template::format_currency($total, false, false), '', 'item_r jst-rght');
256 256
 		// end of row
257 257
 		$html .= EEH_HTML::trx();
258 258
 		return $html;
@@ -267,41 +267,41 @@  discard block
 block discarded – undo
267 267
 	 * @param array        $options
268 268
 	 * @return mixed
269 269
 	 */
270
-	private function _item_row( EE_Line_Item $line_item, $options = array() ) {
270
+	private function _item_row(EE_Line_Item $line_item, $options = array()) {
271 271
 		// start of row
272 272
 		$row_class = $options['odd'] ? 'item odd' : 'item';
273
-		$html = EEH_HTML::tr( '', '', $row_class );
274
-		$obj_name = $line_item->OBJ_type() ? $line_item->OBJ_type_i18n() . ': ' : '';
273
+		$html = EEH_HTML::tr('', '', $row_class);
274
+		$obj_name = $line_item->OBJ_type() ? $line_item->OBJ_type_i18n().': ' : '';
275 275
 		// name && desc
276 276
 		$name_and_desc = apply_filters(
277 277
 			'FHEE__EE_SPCO_Line_Item_Display_Strategy__item_row__name',
278
-			 $obj_name . $line_item->name(),
278
+			 $obj_name.$line_item->name(),
279 279
 			$line_item
280 280
 		);
281 281
 		$name_and_desc .= apply_filters(
282 282
 			'FHEE__EE_SPCO_Line_Item_Display_Strategy__item_row__desc',
283
-			( $options['show_desc'] ? '<span class="line-item-desc-spn smaller-text">: ' . $line_item->desc() . '</span>' : '' ),
283
+			($options['show_desc'] ? '<span class="line-item-desc-spn smaller-text">: '.$line_item->desc().'</span>' : ''),
284 284
 			$line_item,
285 285
 			$options
286 286
 		);
287 287
 		$name_and_desc .= $line_item->is_taxable() ? ' * ' : '';
288 288
 		// name td
289
-		$html .= EEH_HTML::td( $name_and_desc, '',  'item_l' );
289
+		$html .= EEH_HTML::td($name_and_desc, '', 'item_l');
290 290
 		// price td
291
-		if ( $line_item->is_percent() ) {
292
-			$html .= EEH_HTML::td( $line_item->percent() . '%', '', 'item_c jst-rght' );
291
+		if ($line_item->is_percent()) {
292
+			$html .= EEH_HTML::td($line_item->percent().'%', '', 'item_c jst-rght');
293 293
 		} else {
294
-			$html .= EEH_HTML::td( $line_item->unit_price_no_code(), '', 'item_c jst-rght' );
294
+			$html .= EEH_HTML::td($line_item->unit_price_no_code(), '', 'item_c jst-rght');
295 295
 		}
296 296
 		// quantity td
297
-		$html .= EEH_HTML::td( $line_item->quantity(), '', 'item_l jst-rght' );
297
+		$html .= EEH_HTML::td($line_item->quantity(), '', 'item_l jst-rght');
298 298
 		//$total = $line_item->total() * $line_item->quantity();
299 299
 		$total = $line_item->total();
300
-		if( isset( $options[ 'event_id' ] ) && isset( $this->_events[ $options[ 'event_id' ] ] ) ) {
301
-			$this->_events[ $options[ 'event_id' ] ] += $total;
300
+		if (isset($options['event_id']) && isset($this->_events[$options['event_id']])) {
301
+			$this->_events[$options['event_id']] += $total;
302 302
 		}
303 303
 		// total td
304
-		$html .= EEH_HTML::td( EEH_Template::format_currency( $total, false, false ), '',  'item_r jst-rght' );
304
+		$html .= EEH_HTML::td(EEH_Template::format_currency($total, false, false), '', 'item_r jst-rght');
305 305
 		// end of row
306 306
 		$html .= EEH_HTML::trx();
307 307
 		return $html;
@@ -316,22 +316,22 @@  discard block
 block discarded – undo
316 316
 	 * @param array        $options
317 317
 	 * @return mixed
318 318
 	 */
319
-	private function _sub_item_row( EE_Line_Item $line_item, $options = array() ) {
319
+	private function _sub_item_row(EE_Line_Item $line_item, $options = array()) {
320 320
 		// start of row
321
-		$html = EEH_HTML::tr( '', 'item sub-item-row' );
321
+		$html = EEH_HTML::tr('', 'item sub-item-row');
322 322
 		// name && desc
323 323
 		$name_and_desc = $line_item->name();
324
-		$name_and_desc .= $options['show_desc'] ? '<span class="line-sub-item-desc-spn smaller-text">: ' . $line_item->desc() . '</span>' : '';
324
+		$name_and_desc .= $options['show_desc'] ? '<span class="line-sub-item-desc-spn smaller-text">: '.$line_item->desc().'</span>' : '';
325 325
 		// name td
326
-		$html .= EEH_HTML::td( /*__FUNCTION__ .*/ $name_and_desc, '',  'item_l sub-item' );
326
+		$html .= EEH_HTML::td( /*__FUNCTION__ .*/ $name_and_desc, '', 'item_l sub-item' );
327 327
 		// discount/surcharge td
328
-		if ( $line_item->is_percent() ) {
329
-			$html .= EEH_HTML::td( $line_item->percent() . '%', '',  'item_c' );
328
+		if ($line_item->is_percent()) {
329
+			$html .= EEH_HTML::td($line_item->percent().'%', '', 'item_c');
330 330
 		} else {
331
-			$html .= EEH_HTML::td( $line_item->unit_price_no_code(), '',  'item_c jst-rght' );
331
+			$html .= EEH_HTML::td($line_item->unit_price_no_code(), '', 'item_c jst-rght');
332 332
 		}
333 333
 		// total td
334
-		$html .= EEH_HTML::td( EEH_Template::format_currency( $line_item->total(), false, false ), '',  'item_r jst-rght' );
334
+		$html .= EEH_HTML::td(EEH_Template::format_currency($line_item->total(), false, false), '', 'item_r jst-rght');
335 335
 		// end of row
336 336
 		$html .= EEH_HTML::trx();
337 337
 		return $html;
@@ -346,21 +346,21 @@  discard block
 block discarded – undo
346 346
 	 * @param array        $options
347 347
 	 * @return mixed
348 348
 	 */
349
-	private function _tax_row( EE_Line_Item $line_item, $options = array() ) {
349
+	private function _tax_row(EE_Line_Item $line_item, $options = array()) {
350 350
 		// start of row
351
-		$html = EEH_HTML::tr( '', 'item sub-item tax-total' );
351
+		$html = EEH_HTML::tr('', 'item sub-item tax-total');
352 352
 		// name && desc
353 353
 		$name_and_desc = $line_item->name();
354
-		$name_and_desc .= '<span class="smaller-text lt-grey-text" style="margin:0 0 0 2em;">' . __( ' * taxable items', 'event_espresso' ) . '</span>';
355
-		$name_and_desc .= $options[ 'show_desc' ] ? '<br/>' . $line_item->desc() : '';
354
+		$name_and_desc .= '<span class="smaller-text lt-grey-text" style="margin:0 0 0 2em;">'.__(' * taxable items', 'event_espresso').'</span>';
355
+		$name_and_desc .= $options['show_desc'] ? '<br/>'.$line_item->desc() : '';
356 356
 		// name td
357
-		$html .= EEH_HTML::td( /*__FUNCTION__ .*/ $name_and_desc, '',  'item_l sub-item' );
357
+		$html .= EEH_HTML::td( /*__FUNCTION__ .*/ $name_and_desc, '', 'item_l sub-item' );
358 358
 		// percent td
359
-		$html .= EEH_HTML::td( $line_item->percent() . '%', '',  ' jst-rght', '' );
359
+		$html .= EEH_HTML::td($line_item->percent().'%', '', ' jst-rght', '');
360 360
 		// empty td (price)
361
-		$html .= EEH_HTML::td( EEH_HTML::nbsp() );
361
+		$html .= EEH_HTML::td(EEH_HTML::nbsp());
362 362
 		// total td
363
-		$html .= EEH_HTML::td( EEH_Template::format_currency( $line_item->total(), false, false ), '',  'item_r jst-rght' );
363
+		$html .= EEH_HTML::td(EEH_Template::format_currency($line_item->total(), false, false), '', 'item_r jst-rght');
364 364
 		// end of row
365 365
 		$html .= EEH_HTML::trx();
366 366
 		return $html;
@@ -375,17 +375,17 @@  discard block
 block discarded – undo
375 375
 	 * @param string $text
376 376
 	 * @return mixed
377 377
 	 */
378
-	private function _total_tax_row( EE_Line_Item $line_item, $text = '' ) {
378
+	private function _total_tax_row(EE_Line_Item $line_item, $text = '') {
379 379
 		$html = '';
380
-		if ( $line_item->total() ) {
380
+		if ($line_item->total()) {
381 381
 			// start of row
382
-			$html = EEH_HTML::tr( '', '', 'total_tr odd' );
382
+			$html = EEH_HTML::tr('', '', 'total_tr odd');
383 383
 			// total td
384
-			$html .= EEH_HTML::td( $text, '', 'total_currency total jst-rght', '', ' colspan="2"' );
384
+			$html .= EEH_HTML::td($text, '', 'total_currency total jst-rght', '', ' colspan="2"');
385 385
 			// empty td (price)
386
-			$html .= EEH_HTML::td( EEH_HTML::nbsp() );
386
+			$html .= EEH_HTML::td(EEH_HTML::nbsp());
387 387
 			// total td
388
-			$html .= EEH_HTML::td( EEH_Template::format_currency( $line_item->total(), false, false ), '', 'total jst-rght' );
388
+			$html .= EEH_HTML::td(EEH_Template::format_currency($line_item->total(), false, false), '', 'total jst-rght');
389 389
 			// end of row
390 390
 			$html .= EEH_HTML::trx();
391 391
 		}
@@ -402,15 +402,15 @@  discard block
 block discarded – undo
402 402
 	 * @param array        $options
403 403
 	 * @return mixed
404 404
 	 */
405
-	private function _sub_total_row( EE_Line_Item $line_item, $text = '', $options = array() ) {
405
+	private function _sub_total_row(EE_Line_Item $line_item, $text = '', $options = array()) {
406 406
 		$html = '';
407
-		if ( $line_item->total() ) {
407
+		if ($line_item->total()) {
408 408
 			// start of row
409
-			$html = EEH_HTML::tr( '', '', 'total_tr odd' );
409
+			$html = EEH_HTML::tr('', '', 'total_tr odd');
410 410
 			// total td
411
-			$html .= EEH_HTML::td( $text, '', 'total_currency total jst-rght', '', ' colspan="3"' );
411
+			$html .= EEH_HTML::td($text, '', 'total_currency total jst-rght', '', ' colspan="3"');
412 412
 			// total td
413
-			$html .= EEH_HTML::td( EEH_Template::format_currency( $options[ 'sub_total' ], false, false ), '', 'total jst-rght' );
413
+			$html .= EEH_HTML::td(EEH_Template::format_currency($options['sub_total'], false, false), '', 'total jst-rght');
414 414
 			// end of row
415 415
 			$html .= EEH_HTML::trx();
416 416
 		}
@@ -427,13 +427,13 @@  discard block
 block discarded – undo
427 427
 	 * @param string       $text
428 428
 	 * @return mixed
429 429
 	 */
430
-	private function _total_row( EE_Line_Item $line_item, $text = '' ) {
430
+	private function _total_row(EE_Line_Item $line_item, $text = '') {
431 431
 		// start of row
432
-		$html = EEH_HTML::tr( '', '', 'spco-grand-total total_tr odd' );
432
+		$html = EEH_HTML::tr('', '', 'spco-grand-total total_tr odd');
433 433
 		// total td
434
-		$html .= EEH_HTML::td( $text, '',  'total_currency total jst-rght',  '',  ' colspan="3"' );
434
+		$html .= EEH_HTML::td($text, '', 'total_currency total jst-rght', '', ' colspan="3"');
435 435
 		// total td
436
-		$html .= EEH_HTML::td( EEH_Template::format_currency( $line_item->total(), false, false ), '',  'total jst-rght' );
436
+		$html .= EEH_HTML::td(EEH_Template::format_currency($line_item->total(), false, false), '', 'total jst-rght');
437 437
 		// end of row
438 438
 		$html .= EEH_HTML::trx();
439 439
 		return $html;
@@ -448,30 +448,30 @@  discard block
 block discarded – undo
448 448
 	 * @param array        $options
449 449
 	 * @return mixed
450 450
 	 */
451
-	private function _payments_and_amount_owing_rows( EE_Line_Item $line_item, $options = array() ) {
451
+	private function _payments_and_amount_owing_rows(EE_Line_Item $line_item, $options = array()) {
452 452
 		$html = '';
453 453
 		$owing = $line_item->total();
454
-		$transaction = EEM_Transaction::instance()->get_one_by_ID( $line_item->TXN_ID() );
455
-		if ( $transaction instanceof EE_Transaction ) {
454
+		$transaction = EEM_Transaction::instance()->get_one_by_ID($line_item->TXN_ID());
455
+		if ($transaction instanceof EE_Transaction) {
456 456
 			$registration_payments = array();
457
-			$registrations = ! empty( $options['registrations'] )
458
-				? $options[ 'registrations' ]
457
+			$registrations = ! empty($options['registrations'])
458
+				? $options['registrations']
459 459
 				: $transaction->registrations();
460
-			foreach ( $registrations as $registration ) {
461
-				if ( $registration instanceof EE_Registration && $registration->owes_monies_and_can_pay() ) {
460
+			foreach ($registrations as $registration) {
461
+				if ($registration instanceof EE_Registration && $registration->owes_monies_and_can_pay()) {
462 462
 					$registration_payments = $registration_payments + $registration->registration_payments();
463 463
 				}
464 464
 			}
465
-			if ( ! empty( $registration_payments )) {
466
-				foreach ( $registration_payments as $registration_payment ) {
467
-					if ( $registration_payment instanceof EE_Registration_Payment ) {
465
+			if ( ! empty($registration_payments)) {
466
+				foreach ($registration_payments as $registration_payment) {
467
+					if ($registration_payment instanceof EE_Registration_Payment) {
468 468
 						$owing = $owing - $registration_payment->amount();
469 469
 						$payment = $registration_payment->payment();
470
-						if ( $payment instanceof EE_Payment ) {
470
+						if ($payment instanceof EE_Payment) {
471 471
 							$payment_desc = sprintf(
472
-								__( 'Payment%1$s Received: %2$s', 'event_espresso' ),
472
+								__('Payment%1$s Received: %2$s', 'event_espresso'),
473 473
 								$payment->txn_id_chq_nmbr() != ''
474
-									? ' <span class="small-text">(#' . $payment->txn_id_chq_nmbr() . ')</span> '
474
+									? ' <span class="small-text">(#'.$payment->txn_id_chq_nmbr().')</span> '
475 475
 									: '',
476 476
 								$payment->timestamp()
477 477
 							);
@@ -479,12 +479,12 @@  discard block
 block discarded – undo
479 479
 							$payment_desc = '';
480 480
 						}
481 481
 						// start of row
482
-						$html .= EEH_HTML::tr( '', '', 'total_tr odd' );
482
+						$html .= EEH_HTML::tr('', '', 'total_tr odd');
483 483
 						// payment desc
484
-						$html .= EEH_HTML::td( $payment_desc, '', '', '', ' colspan="3"' );
484
+						$html .= EEH_HTML::td($payment_desc, '', '', '', ' colspan="3"');
485 485
 						// total td
486 486
 						$html .= EEH_HTML::td(
487
-							EEH_Template::format_currency( $registration_payment->amount(), false, false ),
487
+							EEH_Template::format_currency($registration_payment->amount(), false, false),
488 488
 							'',
489 489
 							'total jst-rght'
490 490
 						);
@@ -492,17 +492,17 @@  discard block
 block discarded – undo
492 492
 						$html .= EEH_HTML::trx();
493 493
 					}
494 494
 				}
495
-				if ( $line_item->total() ) {
495
+				if ($line_item->total()) {
496 496
 					// start of row
497
-					$html .= EEH_HTML::tr( '', '', 'total_tr odd' );
497
+					$html .= EEH_HTML::tr('', '', 'total_tr odd');
498 498
 					// total td
499 499
 					$html .= EEH_HTML::td(
500 500
 						__('Amount Owing', 'event_espresso'),
501
-						'',  'total_currency total jst-rght',  '',  ' colspan="3"'
501
+						'', 'total_currency total jst-rght', '', ' colspan="3"'
502 502
 					);
503 503
 					// total td
504 504
 					$html .= EEH_HTML::td(
505
-						EEH_Template::format_currency( $owing, false, false ), '',  'total jst-rght'
505
+						EEH_Template::format_currency($owing, false, false), '', 'total jst-rght'
506 506
 					);
507 507
 					// end of row
508 508
 					$html .= EEH_HTML::trx();
Please login to merge, or discard this patch.
line_item_display/EE_Admin_Table_Line_Item_Display_Strategy.strategy.php 1 patch
Spacing   +57 added lines, -57 removed lines patch added patch discarded remove patch
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
 	 * @param array        $options
50 50
 	 * @return mixed
51 51
 	 */
52
-	public function display_line_item( EE_Line_Item $line_item, $options = array() ) {
52
+	public function display_line_item(EE_Line_Item $line_item, $options = array()) {
53 53
 
54 54
 		$html = '';
55 55
 		// set some default options and merge with incoming
@@ -60,40 +60,40 @@  discard block
 block discarded – undo
60 60
 			'taxes_tr_css_class' => 'admin-primary-mbox-taxes-tr',
61 61
 			'total_tr_css_class' => 'admin-primary-mbox-total-tr'
62 62
 		);
63
-		$options = array_merge( $default_options, (array)$options );
63
+		$options = array_merge($default_options, (array) $options);
64 64
 
65
-		switch( $line_item->type() ) {
65
+		switch ($line_item->type()) {
66 66
 
67 67
 			case EEM_Line_Item::type_line_item:
68 68
 				// item row
69
-				$html .= $this->_item_row( $line_item, $options );
69
+				$html .= $this->_item_row($line_item, $options);
70 70
 				break;
71 71
 
72 72
 			case EEM_Line_Item::type_sub_line_item:
73
-				$html .= $this->_sub_item_row( $line_item, $options );
73
+				$html .= $this->_sub_item_row($line_item, $options);
74 74
 				break;
75 75
 
76 76
 			case EEM_Line_Item::type_sub_total:
77 77
 				//loop through children
78 78
 				$child_line_items = $line_item->children();
79 79
 				//loop through children
80
-				foreach ( $child_line_items as $child_line_item ) {
80
+				foreach ($child_line_items as $child_line_item) {
81 81
 					//recursively feed children back into this method
82
-					$html .= $this->display_line_item( $child_line_item, $options );
82
+					$html .= $this->display_line_item($child_line_item, $options);
83 83
 				}
84
-				$html .= $this->_sub_total_row( $line_item, $options );
84
+				$html .= $this->_sub_total_row($line_item, $options);
85 85
 				break;
86 86
 
87 87
 			case EEM_Line_Item::type_tax:
88
-				if ( $this->_show_taxes ) {
89
-					$this->_taxes_html .= $this->_tax_row( $line_item, $options );
88
+				if ($this->_show_taxes) {
89
+					$this->_taxes_html .= $this->_tax_row($line_item, $options);
90 90
 				}
91 91
 				break;
92 92
 
93 93
 			case EEM_Line_Item::type_tax_sub_total:
94
-				foreach( $line_item->children() as $child_line_item ) {
95
-					if ( $child_line_item->type() == EEM_Line_Item::type_tax ) {
96
-						$this->display_line_item( $child_line_item, $options );
94
+				foreach ($line_item->children() as $child_line_item) {
95
+					if ($child_line_item->type() == EEM_Line_Item::type_tax) {
96
+						$this->display_line_item($child_line_item, $options);
97 97
 					}
98 98
 				}
99 99
 				break;
@@ -105,14 +105,14 @@  discard block
 block discarded – undo
105 105
 				$children = $line_item->children();
106 106
 
107 107
 				// loop thru all non-tax child line items
108
-				foreach( $children as $child_line_item ) {
109
-						$html .= $this->display_line_item( $child_line_item, $options );
108
+				foreach ($children as $child_line_item) {
109
+						$html .= $this->display_line_item($child_line_item, $options);
110 110
 				}
111 111
 
112 112
 				$html .= $this->_taxes_html;
113
-				$html .= $this->_total_row( $line_item, $options );
114
-				if ( $options['use_table_wrapper'] ) {
115
-					$html = $this->_table_header( $options ) . $html . $this->_table_footer( $options );
113
+				$html .= $this->_total_row($line_item, $options);
114
+				if ($options['use_table_wrapper']) {
115
+					$html = $this->_table_header($options).$html.$this->_table_footer($options);
116 116
 				}
117 117
 				break;
118 118
 
@@ -129,15 +129,15 @@  discard block
 block discarded – undo
129 129
 	 * @param array $options
130 130
 	 * @return string
131 131
 	 */
132
-	protected function _table_header( $options ) {
133
-		$html = EEH_HTML::table( '','', $options['table_css_class'] );
132
+	protected function _table_header($options) {
133
+		$html = EEH_HTML::table('', '', $options['table_css_class']);
134 134
 		$html .= EEH_HTML::thead();
135 135
 		$html .= EEH_HTML::tr();
136
-		$html .= EEH_HTML::th( __( 'Name', 'event_espresso' ), '', 'jst-left' );
137
-		$html .= EEH_HTML::th( __( 'Type', 'event_espresso'), '', 'jst-left' );
138
-		$html .= EEH_HTML::th( __( 'Amount', 'event_espresso' ), '', 'jst-cntr' );
139
-		$html .= EEH_HTML::th( __( 'Qty', 'event_espresso' ), '', 'jst-cntr' );
140
-		$html .= EEH_HTML::th( __( 'Line Total', 'event_espresso'), '', 'jst-cntr' );
136
+		$html .= EEH_HTML::th(__('Name', 'event_espresso'), '', 'jst-left');
137
+		$html .= EEH_HTML::th(__('Type', 'event_espresso'), '', 'jst-left');
138
+		$html .= EEH_HTML::th(__('Amount', 'event_espresso'), '', 'jst-cntr');
139
+		$html .= EEH_HTML::th(__('Qty', 'event_espresso'), '', 'jst-cntr');
140
+		$html .= EEH_HTML::th(__('Line Total', 'event_espresso'), '', 'jst-cntr');
141 141
 		$html .= EEH_HTML::tbody();
142 142
 		return $html;
143 143
 	}
@@ -149,8 +149,8 @@  discard block
 block discarded – undo
149 149
 	 * @param array $options array of options for the table.
150 150
 	 * @return string
151 151
 	 */
152
-	protected function _table_footer( $options ) {
153
-		return EEH_HTML::tbodyx() .  EEH_HTML::tablex();
152
+	protected function _table_footer($options) {
153
+		return EEH_HTML::tbodyx().EEH_HTML::tablex();
154 154
 	}
155 155
 
156 156
 
@@ -162,12 +162,12 @@  discard block
 block discarded – undo
162 162
 	 * @param array        $options
163 163
 	 * @return mixed
164 164
 	 */
165
-	protected function _item_row( EE_Line_Item $line_item, $options = array() ) {
165
+	protected function _item_row(EE_Line_Item $line_item, $options = array()) {
166 166
 		$line_item_related_object = $line_item->get_object();
167 167
 		$parent_line_item_related_object = $line_item->parent() instanceof EE_Line_Item ? $line_item->parent()->get_object() : null;
168 168
 		// start of row
169 169
 		$row_class = $options['odd'] ? 'item odd' : 'item';
170
-		$html = EEH_HTML::tr( '', '', $row_class );
170
+		$html = EEH_HTML::tr('', '', $row_class);
171 171
 
172 172
 
173 173
 		//Name Column
@@ -175,44 +175,44 @@  discard block
 block discarded – undo
175 175
 
176 176
 		//related object scope.
177 177
 		$parent_related_object_name = $parent_line_item_related_object instanceof EEI_Line_Item_Object ? $parent_line_item_related_object->name() : '';
178
-		$parent_related_object_name = empty( $parent_related_object_name ) && $line_item->parent() instanceof EE_Line_Item ? $line_item->parent()->name() : $parent_related_object_name;
178
+		$parent_related_object_name = empty($parent_related_object_name) && $line_item->parent() instanceof EE_Line_Item ? $line_item->parent()->name() : $parent_related_object_name;
179 179
 		$parent_related_object_link = $parent_line_item_related_object instanceof EEI_Admin_Links ? $parent_line_item_related_object->get_admin_details_link() : '';
180 180
 
181 181
 
182 182
 		$name_html = $line_item_related_object instanceof EEI_Line_Item_Object ? $line_item_related_object->name() : $line_item->name();
183
-		$name_html = $name_link ? '<a href="' . $name_link . '">' . $name_html . '</a>' : $name_html;
183
+		$name_html = $name_link ? '<a href="'.$name_link.'">'.$name_html.'</a>' : $name_html;
184 184
 		$name_html .= $line_item->is_taxable() ? ' *' : '';
185 185
 		//maybe preface with icon?
186
-		$name_html = $line_item_related_object instanceof EEI_Has_Icon ? $line_item_related_object->get_icon() . $name_html : $name_html;
187
-		$name_html = '<span class="ee-line-item-name linked">' . $name_html . '</span><br>';
188
-		$name_html .=  sprintf(
189
-			_x( '%1$sfor the %2$s: %3$s%4$s', 'eg. "for the Event: My Cool Event"', 'event_espresso'),
186
+		$name_html = $line_item_related_object instanceof EEI_Has_Icon ? $line_item_related_object->get_icon().$name_html : $name_html;
187
+		$name_html = '<span class="ee-line-item-name linked">'.$name_html.'</span><br>';
188
+		$name_html .= sprintf(
189
+			_x('%1$sfor the %2$s: %3$s%4$s', 'eg. "for the Event: My Cool Event"', 'event_espresso'),
190 190
 			'<span class="ee-line-item-related-parent-object">',
191
-			$line_item->parent() instanceof EE_Line_Item ? $line_item->parent()->OBJ_type_i18n() : __( 'Item:', 'event_espresso' ),
192
-			$parent_related_object_link ? '<a href="' . $parent_related_object_link . '">' . $parent_related_object_name . '</a>' : $parent_related_object_name,
191
+			$line_item->parent() instanceof EE_Line_Item ? $line_item->parent()->OBJ_type_i18n() : __('Item:', 'event_espresso'),
192
+			$parent_related_object_link ? '<a href="'.$parent_related_object_link.'">'.$parent_related_object_name.'</a>' : $parent_related_object_name,
193 193
 			'</span>'
194 194
 		);
195
-		$html .= EEH_HTML::td( $name_html, '', 'jst-left' );
195
+		$html .= EEH_HTML::td($name_html, '', 'jst-left');
196 196
 
197 197
 		//Type Column
198
-		$type_html = $line_item->OBJ_type() ? $line_item->OBJ_type_i18n() . '<br />' : '';
198
+		$type_html = $line_item->OBJ_type() ? $line_item->OBJ_type_i18n().'<br />' : '';
199 199
 		$code = $line_item_related_object instanceof EEI_Has_Code ? $line_item_related_object->code() : '';
200
-		$type_html .= ! empty( $code ) ? '<span class="ee-line-item-id">' . sprintf( __( 'Code: %s', 'event_espresso' ), $code ) . '</span>' : '';
201
-		$html .= EEH_HTML::td( $type_html, '', 'jst-left' );
200
+		$type_html .= ! empty($code) ? '<span class="ee-line-item-id">'.sprintf(__('Code: %s', 'event_espresso'), $code).'</span>' : '';
201
+		$html .= EEH_HTML::td($type_html, '', 'jst-left');
202 202
 
203 203
 
204 204
 		//Amount Column
205
-		if ( $line_item->is_percent() ) {
206
-			$html .= EEH_HTML::td( $line_item->percent() . '%', '', 'jst-rght' );
205
+		if ($line_item->is_percent()) {
206
+			$html .= EEH_HTML::td($line_item->percent().'%', '', 'jst-rght');
207 207
 		} else {
208
-			$html .= EEH_HTML::td( $line_item->unit_price_no_code(), '', 'jst-rght' );
208
+			$html .= EEH_HTML::td($line_item->unit_price_no_code(), '', 'jst-rght');
209 209
 		}
210 210
 
211 211
 		//QTY column
212
-		$html .= EEH_HTML::td( $line_item->quantity(), '', 'jst-rght' );
212
+		$html .= EEH_HTML::td($line_item->quantity(), '', 'jst-rght');
213 213
 
214 214
 		//total column
215
-		$html .= EEH_HTML::td( EEH_Template::format_currency( $line_item->total(), false, false ), '', 'jst-rght' );
215
+		$html .= EEH_HTML::td(EEH_Template::format_currency($line_item->total(), false, false), '', 'jst-rght');
216 216
 
217 217
 		//finish things off and return
218 218
 		$html .= EEH_HTML::trx();
@@ -228,7 +228,7 @@  discard block
 block discarded – undo
228 228
 	 * @param array        $options
229 229
 	 * @return mixed
230 230
 	 */
231
-	protected function _sub_item_row( EE_Line_Item $line_item, $options = array() ) {
231
+	protected function _sub_item_row(EE_Line_Item $line_item, $options = array()) {
232 232
 		//for now we're not showing sub-items
233 233
 		return '';
234 234
 	}
@@ -242,13 +242,13 @@  discard block
 block discarded – undo
242 242
 	 * @param array        $options
243 243
 	 * @return mixed
244 244
 	 */
245
-	protected function _tax_row( EE_Line_Item $line_item, $options = array() ) {
245
+	protected function _tax_row(EE_Line_Item $line_item, $options = array()) {
246 246
 		// start of row
247
-		$html = EEH_HTML::tr( '', 'admin-primary-mbox-taxes-tr' );
247
+		$html = EEH_HTML::tr('', 'admin-primary-mbox-taxes-tr');
248 248
 		// name th
249
-		$html .= EEH_HTML::th(  $line_item->name() . '(' . $line_item->get_pretty( 'LIN_percent' ) . '%)', '',  'jst-rght', '', ' colspan="4"' );
249
+		$html .= EEH_HTML::th($line_item->name().'('.$line_item->get_pretty('LIN_percent').'%)', '', 'jst-rght', '', ' colspan="4"');
250 250
 		// total th
251
-		$html .= EEH_HTML::th( EEH_Template::format_currency( $line_item->total(), false, false ), '', 'jst-rght' );
251
+		$html .= EEH_HTML::th(EEH_Template::format_currency($line_item->total(), false, false), '', 'jst-rght');
252 252
 		// end of row
253 253
 		$html .= EEH_HTML::trx();
254 254
 		return $html;
@@ -265,7 +265,7 @@  discard block
 block discarded – undo
265 265
 	 * @param array        $options
266 266
 	 * @return mixed
267 267
 	 */
268
-	protected function _sub_total_row( EE_Line_Item $line_item, $text = '', $options = array() ) {
268
+	protected function _sub_total_row(EE_Line_Item $line_item, $text = '', $options = array()) {
269 269
 		//currently not showing subtotal row
270 270
 		return '';
271 271
 	}
@@ -279,15 +279,15 @@  discard block
 block discarded – undo
279 279
 	 * @param array        $options
280 280
 	 * @return mixed
281 281
 	 */
282
-	protected function _total_row( EE_Line_Item $line_item, $options = array() ) {
282
+	protected function _total_row(EE_Line_Item $line_item, $options = array()) {
283 283
 		// start of row
284
-		$html = EEH_HTML::tr( '', '', 'admin-primary-mbox-total-tr' );
284
+		$html = EEH_HTML::tr('', '', 'admin-primary-mbox-total-tr');
285 285
 		// Total th label
286
-		$total_label = sprintf( __( 'Transaction Total %s', 'event_espresso' ),  '(' . EE_Registry::instance()->CFG->currency->code . ')' );
287
-		$html .= EEH_HTML::th( $total_label, '',  'jst-rght',  '',  ' colspan="4"' );
286
+		$total_label = sprintf(__('Transaction Total %s', 'event_espresso'), '('.EE_Registry::instance()->CFG->currency->code.')');
287
+		$html .= EEH_HTML::th($total_label, '', 'jst-rght', '', ' colspan="4"');
288 288
 		// total th
289 289
 
290
-		$html .= EEH_HTML::th( EEH_Template::format_currency( $line_item->total(), false, false ), '',  'jst-rght' );
290
+		$html .= EEH_HTML::th(EEH_Template::format_currency($line_item->total(), false, false), '', 'jst-rght');
291 291
 		// end of row
292 292
 		$html .= EEH_HTML::trx();
293 293
 		return $html;
Please login to merge, or discard this patch.
core/db_classes/EE_Payment.class.php 1 patch
Spacing   +103 added lines, -103 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1
-<?php if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) {
2
-	exit( 'No direct script access allowed' );
1
+<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) {
2
+	exit('No direct script access allowed');
3 3
 }
4 4
 
5 5
 /**
@@ -20,9 +20,9 @@  discard block
 block discarded – undo
20 20
 	 * @return EE_Payment
21 21
 	 * @throws \EE_Error
22 22
 	 */
23
-	public static function new_instance( $props_n_values = array(), $timezone = null, $date_formats = array() ) {
24
-		$has_object = parent::_check_for_object( $props_n_values, __CLASS__, $timezone, $date_formats );
25
-		return $has_object ? $has_object : new self( $props_n_values, false, $timezone, $date_formats );
23
+	public static function new_instance($props_n_values = array(), $timezone = null, $date_formats = array()) {
24
+		$has_object = parent::_check_for_object($props_n_values, __CLASS__, $timezone, $date_formats);
25
+		return $has_object ? $has_object : new self($props_n_values, false, $timezone, $date_formats);
26 26
 	}
27 27
 
28 28
 
@@ -34,8 +34,8 @@  discard block
 block discarded – undo
34 34
 	 * @return EE_Payment
35 35
 	 * @throws \EE_Error
36 36
 	 */
37
-	public static function new_instance_from_db( $props_n_values = array(), $timezone = null ) {
38
-		return new self( $props_n_values, true, $timezone );
37
+	public static function new_instance_from_db($props_n_values = array(), $timezone = null) {
38
+		return new self($props_n_values, true, $timezone);
39 39
 	}
40 40
 
41 41
 
@@ -47,8 +47,8 @@  discard block
 block discarded – undo
47 47
 	 * @param int $TXN_ID
48 48
 	 * @throws \EE_Error
49 49
 	 */
50
-	public function set_transaction_id( $TXN_ID = 0 ) {
51
-		$this->set( 'TXN_ID', $TXN_ID );
50
+	public function set_transaction_id($TXN_ID = 0) {
51
+		$this->set('TXN_ID', $TXN_ID);
52 52
 	}
53 53
 
54 54
 
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
 	 * @throws \EE_Error
61 61
 	 */
62 62
 	public function transaction() {
63
-		return $this->get_first_related( 'Transaction' );
63
+		return $this->get_first_related('Transaction');
64 64
 	}
65 65
 
66 66
 
@@ -72,8 +72,8 @@  discard block
 block discarded – undo
72 72
 	 * @param string $STS_ID
73 73
 	 * @throws \EE_Error
74 74
 	 */
75
-	public function set_status( $STS_ID = '' ) {
76
-		$this->set( 'STS_ID', $STS_ID );
75
+	public function set_status($STS_ID = '') {
76
+		$this->set('STS_ID', $STS_ID);
77 77
 	}
78 78
 
79 79
 
@@ -85,8 +85,8 @@  discard block
 block discarded – undo
85 85
 	 * @param int $timestamp
86 86
 	 * @throws \EE_Error
87 87
 	 */
88
-	public function set_timestamp( $timestamp = 0 ) {
89
-		$this->set( 'PAY_timestamp', $timestamp );
88
+	public function set_timestamp($timestamp = 0) {
89
+		$this->set('PAY_timestamp', $timestamp);
90 90
 	}
91 91
 
92 92
 
@@ -98,8 +98,8 @@  discard block
 block discarded – undo
98 98
 	 * @param string $PAY_source
99 99
 	 * @throws \EE_Error
100 100
 	 */
101
-	public function set_source( $PAY_source = '' ) {
102
-		$this->set( 'PAY_source', $PAY_source );
101
+	public function set_source($PAY_source = '') {
102
+		$this->set('PAY_source', $PAY_source);
103 103
 	}
104 104
 
105 105
 
@@ -111,8 +111,8 @@  discard block
 block discarded – undo
111 111
 	 * @param float $amount
112 112
 	 * @throws \EE_Error
113 113
 	 */
114
-	public function set_amount( $amount = 0.00 ) {
115
-		$this->set( 'PAY_amount', (float)$amount );
114
+	public function set_amount($amount = 0.00) {
115
+		$this->set('PAY_amount', (float) $amount);
116 116
 	}
117 117
 
118 118
 
@@ -124,8 +124,8 @@  discard block
 block discarded – undo
124 124
 	 * @param string $gateway_response
125 125
 	 * @throws \EE_Error
126 126
 	 */
127
-	public function set_gateway_response( $gateway_response = '' ) {
128
-		$this->set( 'PAY_gateway_response', $gateway_response );
127
+	public function set_gateway_response($gateway_response = '') {
128
+		$this->set('PAY_gateway_response', $gateway_response);
129 129
 	}
130 130
 
131 131
 
@@ -148,7 +148,7 @@  discard block
 block discarded – undo
148 148
 			),
149 149
 			'4.6.0'
150 150
 		);
151
-		return $this->payment_method() ? $this->payment_method()->name() : __( 'Unknown', 'event_espresso' );
151
+		return $this->payment_method() ? $this->payment_method()->name() : __('Unknown', 'event_espresso');
152 152
 	}
153 153
 
154 154
 
@@ -160,8 +160,8 @@  discard block
 block discarded – undo
160 160
 	 * @param string $txn_id_chq_nmbr
161 161
 	 * @throws \EE_Error
162 162
 	 */
163
-	public function set_txn_id_chq_nmbr( $txn_id_chq_nmbr = '' ) {
164
-		$this->set( 'PAY_txn_id_chq_nmbr', $txn_id_chq_nmbr );
163
+	public function set_txn_id_chq_nmbr($txn_id_chq_nmbr = '') {
164
+		$this->set('PAY_txn_id_chq_nmbr', $txn_id_chq_nmbr);
165 165
 	}
166 166
 
167 167
 
@@ -173,8 +173,8 @@  discard block
 block discarded – undo
173 173
 	 * @param string $po_number
174 174
 	 * @throws \EE_Error
175 175
 	 */
176
-	public function set_po_number( $po_number = '' ) {
177
-		$this->set( 'PAY_po_number', $po_number );
176
+	public function set_po_number($po_number = '') {
177
+		$this->set('PAY_po_number', $po_number);
178 178
 	}
179 179
 
180 180
 
@@ -186,8 +186,8 @@  discard block
 block discarded – undo
186 186
 	 * @param string $extra_accntng
187 187
 	 * @throws \EE_Error
188 188
 	 */
189
-	public function set_extra_accntng( $extra_accntng = '' ) {
190
-		$this->set( 'PAY_extra_accntng', $extra_accntng );
189
+	public function set_extra_accntng($extra_accntng = '') {
190
+		$this->set('PAY_extra_accntng', $extra_accntng);
191 191
 	}
192 192
 
193 193
 
@@ -199,11 +199,11 @@  discard block
 block discarded – undo
199 199
 	 * @param bool $via_admin
200 200
 	 * @throws \EE_Error
201 201
 	 */
202
-	public function set_payment_made_via_admin( $via_admin = false ) {
203
-		if ( $via_admin ) {
204
-			$this->set( 'PAY_source', EEM_Payment_Method::scope_admin );
202
+	public function set_payment_made_via_admin($via_admin = false) {
203
+		if ($via_admin) {
204
+			$this->set('PAY_source', EEM_Payment_Method::scope_admin);
205 205
 		} else {
206
-			$this->set( 'PAY_source', EEM_Payment_Method::scope_cart );
206
+			$this->set('PAY_source', EEM_Payment_Method::scope_cart);
207 207
 		}
208 208
 	}
209 209
 
@@ -216,13 +216,13 @@  discard block
 block discarded – undo
216 216
 	 * @param string|array $details
217 217
 	 * @throws \EE_Error
218 218
 	 */
219
-	public function set_details( $details = '' ) {
220
-		if ( is_array( $details ) ) {
221
-			array_walk_recursive( $details, array( $this, '_strip_all_tags_within_array' ) );
219
+	public function set_details($details = '') {
220
+		if (is_array($details)) {
221
+			array_walk_recursive($details, array($this, '_strip_all_tags_within_array'));
222 222
 		} else {
223
-			$details = wp_strip_all_tags( $details );
223
+			$details = wp_strip_all_tags($details);
224 224
 		}
225
-		$this->set( 'PAY_details', $details );
225
+		$this->set('PAY_details', $details);
226 226
 	}
227 227
 
228 228
 
@@ -233,8 +233,8 @@  discard block
 block discarded – undo
233 233
 	 * @param string $redirect_url
234 234
 	 * @throws \EE_Error
235 235
 	 */
236
-	public function set_redirect_url( $redirect_url ) {
237
-		$this->set( 'PAY_redirect_url', $redirect_url );
236
+	public function set_redirect_url($redirect_url) {
237
+		$this->set('PAY_redirect_url', $redirect_url);
238 238
 	}
239 239
 
240 240
 
@@ -245,8 +245,8 @@  discard block
 block discarded – undo
245 245
 	 * @param array $redirect_args
246 246
 	 * @throws \EE_Error
247 247
 	 */
248
-	public function set_redirect_args( $redirect_args ) {
249
-		$this->set( 'PAY_redirect_args', $redirect_args );
248
+	public function set_redirect_args($redirect_args) {
249
+		$this->set('PAY_redirect_args', $redirect_args);
250 250
 	}
251 251
 
252 252
 
@@ -258,7 +258,7 @@  discard block
 block discarded – undo
258 258
 	 * @throws \EE_Error
259 259
 	 */
260 260
 	public function TXN_ID() {
261
-		return $this->get( 'TXN_ID' );
261
+		return $this->get('TXN_ID');
262 262
 	}
263 263
 
264 264
 
@@ -270,7 +270,7 @@  discard block
 block discarded – undo
270 270
 	 * @throws \EE_Error
271 271
 	 */
272 272
 	public function status() {
273
-		return $this->get( 'STS_ID' );
273
+		return $this->get('STS_ID');
274 274
 	}
275 275
 
276 276
 
@@ -282,7 +282,7 @@  discard block
 block discarded – undo
282 282
 	 * @throws \EE_Error
283 283
 	 */
284 284
 	public function STS_ID() {
285
-		return $this->get( 'STS_ID' );
285
+		return $this->get('STS_ID');
286 286
 	}
287 287
 
288 288
 
@@ -296,8 +296,8 @@  discard block
 block discarded – undo
296 296
 	 * @return string
297 297
 	 * @throws \EE_Error
298 298
 	 */
299
-	public function timestamp( $dt_frmt = '', $tm_frmt = '' ) {
300
-		return $this->get_i18n_datetime( 'PAY_timestamp', trim( $dt_frmt . ' ' . $tm_frmt) );
299
+	public function timestamp($dt_frmt = '', $tm_frmt = '') {
300
+		return $this->get_i18n_datetime('PAY_timestamp', trim($dt_frmt.' '.$tm_frmt));
301 301
 	}
302 302
 
303 303
 
@@ -309,7 +309,7 @@  discard block
 block discarded – undo
309 309
 	 * @throws \EE_Error
310 310
 	 */
311 311
 	public function source() {
312
-		return $this->get( 'PAY_source' );
312
+		return $this->get('PAY_source');
313 313
 	}
314 314
 
315 315
 
@@ -322,7 +322,7 @@  discard block
 block discarded – undo
322 322
 	 * @throws \EE_Error
323 323
 	 */
324 324
 	public function amount() {
325
-		return (float)$this->get( 'PAY_amount' );
325
+		return (float) $this->get('PAY_amount');
326 326
 	}
327 327
 
328 328
 
@@ -332,7 +332,7 @@  discard block
 block discarded – undo
332 332
 	 * @throws \EE_Error
333 333
 	 */
334 334
 	public function amount_no_code() {
335
-		return $this->get_pretty( 'PAY_amount', 'no_currency_code' );
335
+		return $this->get_pretty('PAY_amount', 'no_currency_code');
336 336
 	}
337 337
 
338 338
 
@@ -344,7 +344,7 @@  discard block
 block discarded – undo
344 344
 	 * @throws \EE_Error
345 345
 	 */
346 346
 	public function gateway_response() {
347
-		return $this->get( 'PAY_gateway_response' );
347
+		return $this->get('PAY_gateway_response');
348 348
 	}
349 349
 
350 350
 
@@ -356,7 +356,7 @@  discard block
 block discarded – undo
356 356
 	 * @throws \EE_Error
357 357
 	 */
358 358
 	public function txn_id_chq_nmbr() {
359
-		return $this->get( 'PAY_txn_id_chq_nmbr' );
359
+		return $this->get('PAY_txn_id_chq_nmbr');
360 360
 	}
361 361
 
362 362
 
@@ -368,7 +368,7 @@  discard block
 block discarded – undo
368 368
 	 * @throws \EE_Error
369 369
 	 */
370 370
 	public function po_number() {
371
-		return $this->get( 'PAY_po_number' );
371
+		return $this->get('PAY_po_number');
372 372
 	}
373 373
 
374 374
 
@@ -380,7 +380,7 @@  discard block
 block discarded – undo
380 380
 	 * @throws \EE_Error
381 381
 	 */
382 382
 	public function extra_accntng() {
383
-		return $this->get( 'PAY_extra_accntng' );
383
+		return $this->get('PAY_extra_accntng');
384 384
 	}
385 385
 
386 386
 
@@ -392,7 +392,7 @@  discard block
 block discarded – undo
392 392
 	 * @throws \EE_Error
393 393
 	 */
394 394
 	public function payment_made_via_admin() {
395
-		return ( $this->get( 'PAY_source' ) === EEM_Payment_Method::scope_admin );
395
+		return ($this->get('PAY_source') === EEM_Payment_Method::scope_admin);
396 396
 	}
397 397
 
398 398
 
@@ -404,7 +404,7 @@  discard block
 block discarded – undo
404 404
 	 * @throws \EE_Error
405 405
 	 */
406 406
 	public function details() {
407
-		return $this->get( 'PAY_details' );
407
+		return $this->get('PAY_details');
408 408
 	}
409 409
 
410 410
 
@@ -416,7 +416,7 @@  discard block
 block discarded – undo
416 416
 	 * @throws \EE_Error
417 417
 	 */
418 418
 	public function redirect_url() {
419
-		return $this->get( 'PAY_redirect_url' );
419
+		return $this->get('PAY_redirect_url');
420 420
 	}
421 421
 
422 422
 
@@ -428,7 +428,7 @@  discard block
 block discarded – undo
428 428
 	 * @throws \EE_Error
429 429
 	 */
430 430
 	public function redirect_args() {
431
-		return $this->get( 'PAY_redirect_args' );
431
+		return $this->get('PAY_redirect_args');
432 432
 	}
433 433
 
434 434
 
@@ -440,8 +440,8 @@  discard block
 block discarded – undo
440 440
 	 * @return void
441 441
 	 * @throws \EE_Error
442 442
 	 */
443
-	public function e_pretty_status( $show_icons = false ) {
444
-		echo $this->pretty_status( $show_icons );
443
+	public function e_pretty_status($show_icons = false) {
444
+		echo $this->pretty_status($show_icons);
445 445
 	}
446 446
 
447 447
 
@@ -453,14 +453,14 @@  discard block
 block discarded – undo
453 453
 	 * @return string
454 454
 	 * @throws \EE_Error
455 455
 	 */
456
-	public function pretty_status( $show_icons = false ) {
456
+	public function pretty_status($show_icons = false) {
457 457
 		$status = EEM_Status::instance()->localized_status(
458
-			array( $this->STS_ID() => __( 'unknown', 'event_espresso' ) ),
458
+			array($this->STS_ID() => __('unknown', 'event_espresso')),
459 459
 			false,
460 460
 			'sentence'
461 461
 		);
462 462
 		$icon = '';
463
-		switch ( $this->STS_ID() ) {
463
+		switch ($this->STS_ID()) {
464 464
 			case EEM_Payment::status_id_approved:
465 465
 				$icon = $show_icons
466 466
 					? '<span class="dashicons dashicons-yes ee-icon-size-24 green-text"></span>'
@@ -482,7 +482,7 @@  discard block
 block discarded – undo
482 482
 					: '';
483 483
 				break;
484 484
 		}
485
-		return $icon . $status[ $this->STS_ID() ];
485
+		return $icon.$status[$this->STS_ID()];
486 486
 	}
487 487
 
488 488
 
@@ -494,7 +494,7 @@  discard block
 block discarded – undo
494 494
 	 * @throws \EE_Error
495 495
 	 */
496 496
 	public function is_approved() {
497
-		return $this->status_is( EEM_Payment::status_id_approved );
497
+		return $this->status_is(EEM_Payment::status_id_approved);
498 498
 	}
499 499
 
500 500
 
@@ -508,7 +508,7 @@  discard block
 block discarded – undo
508 508
 	 * @return boolean whether the status of this payment equals the status id
509 509
 	 * @throws \EE_Error
510 510
 	 */
511
-	protected function status_is( $STS_ID ) {
511
+	protected function status_is($STS_ID) {
512 512
 		return $STS_ID === $this->STS_ID() ? true : false;
513 513
 	}
514 514
 
@@ -521,7 +521,7 @@  discard block
 block discarded – undo
521 521
 	 * @throws \EE_Error
522 522
 	 */
523 523
 	public function is_pending() {
524
-		return $this->status_is( EEM_Payment::status_id_pending );
524
+		return $this->status_is(EEM_Payment::status_id_pending);
525 525
 	}
526 526
 
527 527
 
@@ -533,7 +533,7 @@  discard block
 block discarded – undo
533 533
 	 * @throws \EE_Error
534 534
 	 */
535 535
 	public function is_cancelled() {
536
-		return $this->status_is( EEM_Payment::status_id_cancelled );
536
+		return $this->status_is(EEM_Payment::status_id_cancelled);
537 537
 	}
538 538
 
539 539
 
@@ -545,7 +545,7 @@  discard block
 block discarded – undo
545 545
 	 * @throws \EE_Error
546 546
 	 */
547 547
 	public function is_declined() {
548
-		return $this->status_is( EEM_Payment::status_id_declined );
548
+		return $this->status_is(EEM_Payment::status_id_declined);
549 549
 	}
550 550
 
551 551
 
@@ -557,7 +557,7 @@  discard block
 block discarded – undo
557 557
 	 * @throws \EE_Error
558 558
 	 */
559 559
 	public function is_failed() {
560
-		return $this->status_is( EEM_Payment::status_id_failed );
560
+		return $this->status_is(EEM_Payment::status_id_failed);
561 561
 	}
562 562
 
563 563
 
@@ -581,7 +581,7 @@  discard block
 block discarded – undo
581 581
 	 * @throws \EE_Error
582 582
 	 */
583 583
 	public function status_obj() {
584
-		return $this->get_first_related( 'Status' );
584
+		return $this->get_first_related('Status');
585 585
 	}
586 586
 
587 587
 
@@ -593,8 +593,8 @@  discard block
 block discarded – undo
593 593
 	 * @return EE_Extra_Meta
594 594
 	 * @throws \EE_Error
595 595
 	 */
596
-	public function extra_meta( $query_params = array() ) {
597
-		return $this->get_many_related( 'Extra_Meta', $query_params );
596
+	public function extra_meta($query_params = array()) {
597
+		return $this->get_many_related('Extra_Meta', $query_params);
598 598
 	}
599 599
 
600 600
 
@@ -608,7 +608,7 @@  discard block
 block discarded – undo
608 608
 	 * @throws \EE_Error
609 609
 	 */
610 610
 	public function payment_method() {
611
-		return $this->get_first_related( 'Payment_Method' );
611
+		return $this->get_first_related('Payment_Method');
612 612
 	}
613 613
 
614 614
 
@@ -626,18 +626,18 @@  discard block
 block discarded – undo
626 626
 	 * @return string html
627 627
 	 * @throws \EE_Error
628 628
 	 */
629
-	public function redirect_form( $inside_form_html = null ) {
629
+	public function redirect_form($inside_form_html = null) {
630 630
 		$redirect_url = $this->redirect_url();
631
-		if ( ! empty( $redirect_url ) ) {
631
+		if ( ! empty($redirect_url)) {
632 632
 			// what ? no inner form content?
633
-			if ( $inside_form_html === null ) {
633
+			if ($inside_form_html === null) {
634 634
 				$inside_form_html = EEH_HTML::p(
635 635
 					sprintf(
636 636
 						__(
637 637
 							'If you are not automatically redirected to the payment website within 10 seconds... %1$s %2$s Click Here %3$s',
638 638
 							'event_espresso'
639 639
 						),
640
-						EEH_HTML::br( 2 ),
640
+						EEH_HTML::br(2),
641 641
 						'<input type="submit" value="',
642 642
 						'">'
643 643
 					),
@@ -653,22 +653,22 @@  discard block
 block discarded – undo
653 653
 			);
654 654
 			//if it's a GET request, we need to remove all the GET params in the querystring
655 655
 			//and put them into the form instead
656
-			if ( $method === 'GET' ) {
657
-				$querystring = parse_url( $redirect_url, PHP_URL_QUERY );
656
+			if ($method === 'GET') {
657
+				$querystring = parse_url($redirect_url, PHP_URL_QUERY);
658 658
 				$get_params = null;
659
-				parse_str( $querystring, $get_params );
660
-				$inside_form_html .= $this->_args_as_inputs( $get_params );
661
-				$redirect_url = str_replace( '?' . $querystring, '', $redirect_url );
659
+				parse_str($querystring, $get_params);
660
+				$inside_form_html .= $this->_args_as_inputs($get_params);
661
+				$redirect_url = str_replace('?'.$querystring, '', $redirect_url);
662 662
 			}
663
-			$form = EEH_HTML::nl( 1 )
663
+			$form = EEH_HTML::nl(1)
664 664
 			        . '<form method="'
665 665
 			        . $method
666 666
 			        . '" name="gateway_form" action="'
667 667
 			        . $redirect_url
668 668
 			        . '">';
669
-			$form .= EEH_HTML::nl( 1 ) . $this->redirect_args_as_inputs();
669
+			$form .= EEH_HTML::nl(1).$this->redirect_args_as_inputs();
670 670
 			$form .= $inside_form_html;
671
-			$form .= EEH_HTML::nl( -1 ) . '</form>' . EEH_HTML::nl( -1 );
671
+			$form .= EEH_HTML::nl( -1 ).'</form>'.EEH_HTML::nl( -1 );
672 672
 			return $form;
673 673
 		} else {
674 674
 			return null;
@@ -685,7 +685,7 @@  discard block
 block discarded – undo
685 685
 	 * @throws \EE_Error
686 686
 	 */
687 687
 	public function redirect_args_as_inputs() {
688
-		return $this->_args_as_inputs( $this->redirect_args() );
688
+		return $this->_args_as_inputs($this->redirect_args());
689 689
 	}
690 690
 
691 691
 
@@ -697,15 +697,15 @@  discard block
 block discarded – undo
697 697
 	 * @param array $args key-value pairs
698 698
 	 * @return string
699 699
 	 */
700
-	protected function _args_as_inputs( $args ) {
700
+	protected function _args_as_inputs($args) {
701 701
 		$html = '';
702
-		if ( $args !== null && is_array( $args ) ) {
703
-			foreach ( $args as $name => $value ) {
704
-				$html .= EEH_HTML::nl( 0 )
702
+		if ($args !== null && is_array($args)) {
703
+			foreach ($args as $name => $value) {
704
+				$html .= EEH_HTML::nl(0)
705 705
 				         . '<input type="hidden" name="'
706 706
 				         . $name
707 707
 				         . '" value="'
708
-				         . esc_attr( $value )
708
+				         . esc_attr($value)
709 709
 				         . '"/>';
710 710
 			}
711 711
 		}
@@ -734,14 +734,14 @@  discard block
 block discarded – undo
734 734
 	 * @access private
735 735
 	 * @param mixed $item
736 736
 	 */
737
-	private function _strip_all_tags_within_array( &$item ) {
738
-		if ( is_object( $item ) ) {
739
-			$item = (array)$item;
737
+	private function _strip_all_tags_within_array(&$item) {
738
+		if (is_object($item)) {
739
+			$item = (array) $item;
740 740
 		}
741
-		if ( is_array( $item ) ) {
742
-			array_walk_recursive( $item, array( $this, '_strip_all_tags_within_array' ) );
741
+		if (is_array($item)) {
742
+			array_walk_recursive($item, array($this, '_strip_all_tags_within_array'));
743 743
 		} else {
744
-			$item = wp_strip_all_tags( $item );
744
+			$item = wp_strip_all_tags($item);
745 745
 		}
746 746
 	}
747 747
 
@@ -758,7 +758,7 @@  discard block
 block discarded – undo
758 758
 		$original_status = EEH_Array::is_set(
759 759
 			$this->_props_n_values_provided_in_constructor,
760 760
 			'STS_ID',
761
-			$this->get_model()->field_settings_for( 'STS_ID' )->get_default_value()
761
+			$this->get_model()->field_settings_for('STS_ID')->get_default_value()
762 762
 		);
763 763
 		$current_status = $this->status();
764 764
 		if (
@@ -784,11 +784,11 @@  discard block
 block discarded – undo
784 784
 	 * @return mixed
785 785
 	 * @throws \EE_Error
786 786
 	 */
787
-	public function get_pretty( $field_name, $extra_cache_ref = null ) {
788
-		if ( $field_name === 'PAY_gateway' ) {
789
-			return $this->payment_method() ? $this->payment_method()->name() : __( 'Unknown', 'event_espresso' );
787
+	public function get_pretty($field_name, $extra_cache_ref = null) {
788
+		if ($field_name === 'PAY_gateway') {
789
+			return $this->payment_method() ? $this->payment_method()->name() : __('Unknown', 'event_espresso');
790 790
 		}
791
-		return $this->_get_cached_property( $field_name, true, $extra_cache_ref );
791
+		return $this->_get_cached_property($field_name, true, $extra_cache_ref);
792 792
 	}
793 793
 
794 794
 
@@ -800,8 +800,8 @@  discard block
 block discarded – undo
800 800
 	 * @return EE_Registration_Payment[]
801 801
 	 * @throws \EE_Error
802 802
 	 */
803
-	public function registration_payments( $query_params = array() ) {
804
-		return $this->get_many_related( 'Registration_Payment', $query_params );
803
+	public function registration_payments($query_params = array()) {
804
+		return $this->get_many_related('Registration_Payment', $query_params);
805 805
 	}
806 806
 
807 807
 
Please login to merge, or discard this patch.
core/db_classes/EE_Line_Item.class.php 1 patch
Indentation   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -218,24 +218,24 @@
 block discarded – undo
218 218
 	 * @return string
219 219
 	 */
220 220
 	function OBJ_type_i18n() {
221
-	    $obj_type = $this->OBJ_type();
222
-        switch ($obj_type) {
223
-            case 'Event':
224
-                $obj_type = __('Event', 'event_espresso');
225
-                break;
226
-            case 'Price':
227
-                $obj_type = __('Price', 'event_espresso');
228
-                break;
229
-            case 'Promotion':
230
-                $obj_type = __('Promotion', 'event_espresso');
231
-                break;
232
-            case 'Ticket':
233
-                $obj_type = __('Ticket', 'event_espresso');
234
-                break;
235
-            case 'Transaction':
236
-                $obj_type = __('Transaction', 'event_espresso');
237
-                break;
238
-        }
221
+		$obj_type = $this->OBJ_type();
222
+		switch ($obj_type) {
223
+			case 'Event':
224
+				$obj_type = __('Event', 'event_espresso');
225
+				break;
226
+			case 'Price':
227
+				$obj_type = __('Price', 'event_espresso');
228
+				break;
229
+			case 'Promotion':
230
+				$obj_type = __('Promotion', 'event_espresso');
231
+				break;
232
+			case 'Ticket':
233
+				$obj_type = __('Ticket', 'event_espresso');
234
+				break;
235
+			case 'Transaction':
236
+				$obj_type = __('Transaction', 'event_espresso');
237
+				break;
238
+		}
239 239
 		return apply_filters('FHEE__EE_Line_Item__OBJ_type_i18n', $obj_type, $this);
240 240
 	}
241 241
 
Please login to merge, or discard this patch.
admin/extend/registration_form/Extend_Registration_Form_Admin_Page.core.php 1 patch
Spacing   +185 added lines, -185 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,18 +972,18 @@  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
 		try {
977 977
 			$email_validation_settings_form = $this->_email_validation_settings_form();
978 978
 			// if not displaying a form, then check for form submission
979
-			if ( $email_validation_settings_form->was_submitted() ) {
979
+			if ($email_validation_settings_form->was_submitted()) {
980 980
 				// capture form data
981 981
 				$email_validation_settings_form->receive_form_submission();
982 982
 				// validate form data
983
-				if ( $email_validation_settings_form->is_valid() ) {
983
+				if ($email_validation_settings_form->is_valid()) {
984 984
 					// grab validated data from form
985 985
 					$valid_data = $email_validation_settings_form->valid_data();
986
-					if ( isset( $valid_data['email_validation_level'] ) ) {
986
+					if (isset($valid_data['email_validation_level'])) {
987 987
 						$EE_Registration_Config->email_validation_level = $valid_data['email_validation_level'];
988 988
 					} else {
989 989
 						EE_Error::add_error(
@@ -997,7 +997,7 @@  discard block
 block discarded – undo
997 997
 						);
998 998
 					}
999 999
 				} else {
1000
-					if ( $email_validation_settings_form->submission_error_message() !== '' ) {
1000
+					if ($email_validation_settings_form->submission_error_message() !== '') {
1001 1001
 						EE_Error::add_error(
1002 1002
 							$email_validation_settings_form->submission_error_message(),
1003 1003
 							__FILE__,
@@ -1007,7 +1007,7 @@  discard block
 block discarded – undo
1007 1007
 					}
1008 1008
 				}
1009 1009
 			}
1010
-		} catch ( EE_Error $e ) {
1010
+		} catch (EE_Error $e) {
1011 1011
 			$e->get_error();
1012 1012
 		}
1013 1013
 		return $EE_Registration_Config;
Please login to merge, or discard this patch.
admin/extend/transactions/Extend_Transactions_Admin_Page.core.php 1 patch
Spacing   +43 added lines, -43 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
 /**
@@ -42,11 +42,11 @@  discard block
 block discarded – undo
42 42
 	 * @param bool $routing
43 43
 	 * @return \Extend_Transactions_Admin_Page
44 44
 	 */
45
-	public function __construct( $routing = TRUE ) {
46
-		parent::__construct( $routing );
47
-		define( 'TXN_CAF_TEMPLATE_PATH', EE_CORE_CAF_ADMIN_EXTEND . 'transactions/templates/');
48
-		define( 'TXN_CAF_ASSETS', EE_CORE_CAF_ADMIN_EXTEND . 'transactions/assets/');
49
-		define( 'TXN_CAF_ASSETS_URL', EE_CORE_CAF_ADMIN_EXTEND_URL . 'transactions/assets/');
45
+	public function __construct($routing = TRUE) {
46
+		parent::__construct($routing);
47
+		define('TXN_CAF_TEMPLATE_PATH', EE_CORE_CAF_ADMIN_EXTEND.'transactions/templates/');
48
+		define('TXN_CAF_ASSETS', EE_CORE_CAF_ADMIN_EXTEND.'transactions/assets/');
49
+		define('TXN_CAF_ASSETS_URL', EE_CORE_CAF_ADMIN_EXTEND_URL.'transactions/assets/');
50 50
 	}
51 51
 
52 52
 
@@ -58,7 +58,7 @@  discard block
 block discarded – undo
58 58
 	 * @return void
59 59
 	 */
60 60
 	protected function _extend_page_config() {
61
-		$this->_admin_base_path = EE_CORE_CAF_ADMIN_EXTEND . 'transactions';
61
+		$this->_admin_base_path = EE_CORE_CAF_ADMIN_EXTEND.'transactions';
62 62
 
63 63
 		$new_page_routes = array(
64 64
 			'reports' => array(
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
 			)
68 68
 		);
69 69
 
70
-		$this->_page_routes = array_merge( $this->_page_routes, $new_page_routes );
70
+		$this->_page_routes = array_merge($this->_page_routes, $new_page_routes);
71 71
 
72 72
 		$new_page_config = array(
73 73
 			'reports' => array(
@@ -85,7 +85,7 @@  discard block
 block discarded – undo
85 85
 				'require_nonce' => FALSE
86 86
 			)
87 87
 		);
88
-		$this->_page_config = array_merge( $this->_page_config, $new_page_config );
88
+		$this->_page_config = array_merge($this->_page_config, $new_page_config);
89 89
 	}
90 90
 
91 91
 
@@ -97,8 +97,8 @@  discard block
 block discarded – undo
97 97
 	 * @return void
98 98
 	 */
99 99
 	public function load_scripts_styles_reports() {
100
-		wp_register_script( 'ee-txn-reports-js', TXN_CAF_ASSETS_URL . 'ee-transaction-admin-reports.js', array( 'google-charts' ), EVENT_ESPRESSO_VERSION, true );
101
-		wp_enqueue_script( 'ee-txn-reports-js' );
100
+		wp_register_script('ee-txn-reports-js', TXN_CAF_ASSETS_URL.'ee-transaction-admin-reports.js', array('google-charts'), EVENT_ESPRESSO_VERSION, true);
101
+		wp_enqueue_script('ee-txn-reports-js');
102 102
 		$this->_transaction_reports_js_setup();
103 103
 		EE_Registry::$i18n_js_strings['currency_format'] = EEH_Money::get_format_for_google_charts();
104 104
 	}
@@ -125,9 +125,9 @@  discard block
 block discarded – undo
125 125
 	* @return void
126 126
 	*/
127 127
 	protected function _transaction_reports() {
128
-		$template_path = EE_ADMIN_TEMPLATE . 'admin_reports.template.php';
128
+		$template_path = EE_ADMIN_TEMPLATE.'admin_reports.template.php';
129 129
 		$this->_admin_page_title = __('Transactions', 'event_espresso');
130
-		$this->_template_args['admin_page_content'] = EEH_Template::display_template( $template_path, $this->_reports_template_data, TRUE );
130
+		$this->_template_args['admin_page_content'] = EEH_Template::display_template($template_path, $this->_reports_template_data, TRUE);
131 131
 
132 132
 		// the final template wrapper
133 133
 		$this->display_admin_page_with_no_sidebar();
@@ -142,42 +142,42 @@  discard block
 block discarded – undo
142 142
 	 * @param string $period The period (acceptable by PHP Datetime constructor) for which the report is generated.
143 143
 	 * @return string
144 144
 	 */
145
-	private function _revenue_per_day_report( $period = '-1 month' ) {
145
+	private function _revenue_per_day_report($period = '-1 month') {
146 146
 
147 147
 		$report_ID = 'txn-admin-revenue-per-day-report-dv';
148 148
 
149 149
 		$TXN = EEM_Transaction::instance();
150 150
 
151
-		$results = $TXN->get_revenue_per_day_report( $period );
151
+		$results = $TXN->get_revenue_per_day_report($period);
152 152
 		$results = (array) $results;
153 153
 		$revenue = array();
154 154
 		$subtitle = '';
155 155
 
156
-		if ( $results ) {
157
-			$revenue[] = array( __( 'Date (only shows dates that have a revenue greater than 1)', 'event_espresso' ), __( 'Total Revenue', 'event_espresso' ) );
158
-			foreach ( $results as $result ) {
159
-				if ( $result->revenue > 1 ) {
160
-					$revenue[] = array( $result->txnDate, (float) $result->revenue );
156
+		if ($results) {
157
+			$revenue[] = array(__('Date (only shows dates that have a revenue greater than 1)', 'event_espresso'), __('Total Revenue', 'event_espresso'));
158
+			foreach ($results as $result) {
159
+				if ($result->revenue > 1) {
160
+					$revenue[] = array($result->txnDate, (float) $result->revenue);
161 161
 				}
162 162
 			}
163 163
 
164 164
 			//setup the date range.
165
-			$beginning_date = new DateTime( 'now' . $period, new DateTimeZone( EEH_DTT_Helper::get_timezone() ) );
166
-			$ending_date = new DateTime( 'now', new DateTimeZone( EEH_DTT_Helper::get_timezone() ) );
167
-			$subtitle = sprintf( _x( 'For the period: %s to %s', 'Used to give date range', 'event_espresso' ), $beginning_date->format( 'Y-m-d' ), $ending_date->format( 'Y-m-d' ) );
165
+			$beginning_date = new DateTime('now'.$period, new DateTimeZone(EEH_DTT_Helper::get_timezone()));
166
+			$ending_date = new DateTime('now', new DateTimeZone(EEH_DTT_Helper::get_timezone()));
167
+			$subtitle = sprintf(_x('For the period: %s to %s', 'Used to give date range', 'event_espresso'), $beginning_date->format('Y-m-d'), $ending_date->format('Y-m-d'));
168 168
 		}
169 169
 
170
-		$report_title = esc_html__( 'Total Revenue per Day', 'event_espresso' );
170
+		$report_title = esc_html__('Total Revenue per Day', 'event_espresso');
171 171
 
172 172
 		$report_params = array(
173 173
 			'title' 		=> $report_title,
174 174
 			'subtitle' => $subtitle,
175 175
 			'id' 			=> $report_ID,
176 176
 			'revenue' => $revenue,
177
-			'noResults' => empty( $revenue ),
178
-			'noTxnMsg'	=> sprintf( __( '%sThere are currently no transaction records in the last month for this report.%s', 'event_espresso' ), '<h2>' . $report_title . '</h2><p>', '</p>' )
177
+			'noResults' => empty($revenue),
178
+			'noTxnMsg'	=> sprintf(__('%sThere are currently no transaction records in the last month for this report.%s', 'event_espresso'), '<h2>'.$report_title.'</h2><p>', '</p>')
179 179
 		);
180
-		wp_localize_script( 'ee-txn-reports-js', 'txnRevPerDay', $report_params );
180
+		wp_localize_script('ee-txn-reports-js', 'txnRevPerDay', $report_params);
181 181
 
182 182
 		return $report_ID;
183 183
 	}
@@ -191,43 +191,43 @@  discard block
 block discarded – undo
191 191
 	 * @param string $period  The period (acceptable by PHP Datetime constructor) for which the report is generated.
192 192
 	 * @return int
193 193
 	 */
194
-	private function _revenue_per_event_report( $period = '-1 month' ) {
194
+	private function _revenue_per_event_report($period = '-1 month') {
195 195
 
196 196
 		$report_ID = 'txn-admin-revenue-per-event-report-dv';
197 197
 
198 198
 		$TXN = EEM_Transaction::instance();
199
-		$results = $TXN->get_revenue_per_event_report( $period );
199
+		$results = $TXN->get_revenue_per_event_report($period);
200 200
 		$results = (array) $results;
201 201
 		$revenue = array();
202 202
 		$subtitle = '';
203 203
 
204
-		if ( $results ) {
205
-			$revenue[] = array( __( 'Event (only events that have a revenue greater than 1 are shown)', 'event_espresso' ), __( 'Total Revenue', 'event_espresso' ) );
206
-			foreach ( $results as $result ) {
207
-				if ( $result->revenue > 1 ) {
208
-					$event_name = stripslashes( html_entity_decode( $result->event_name, ENT_QUOTES, 'UTF-8' ) );
209
-					$event_name = wp_trim_words( $event_name, 5, '...' );
210
-					$revenue[]  = array( $event_name, (float) $result->revenue );
204
+		if ($results) {
205
+			$revenue[] = array(__('Event (only events that have a revenue greater than 1 are shown)', 'event_espresso'), __('Total Revenue', 'event_espresso'));
206
+			foreach ($results as $result) {
207
+				if ($result->revenue > 1) {
208
+					$event_name = stripslashes(html_entity_decode($result->event_name, ENT_QUOTES, 'UTF-8'));
209
+					$event_name = wp_trim_words($event_name, 5, '...');
210
+					$revenue[]  = array($event_name, (float) $result->revenue);
211 211
 				}
212 212
 			}
213 213
 
214 214
 			//setup the date range.
215
-			$beginning_date = new DateTime( 'now' . $period, new DateTimeZone( EEH_DTT_Helper::get_timezone() ) );
216
-			$ending_date = new DateTime( 'now', new DateTimeZone( EEH_DTT_Helper::get_timezone() ) );
217
-			$subtitle = sprintf( _x( 'For the period: %s to %s', 'Used to give date range', 'event_espresso' ), $beginning_date->format( 'Y-m-d' ), $ending_date->format( 'Y-m-d' ) );
215
+			$beginning_date = new DateTime('now'.$period, new DateTimeZone(EEH_DTT_Helper::get_timezone()));
216
+			$ending_date = new DateTime('now', new DateTimeZone(EEH_DTT_Helper::get_timezone()));
217
+			$subtitle = sprintf(_x('For the period: %s to %s', 'Used to give date range', 'event_espresso'), $beginning_date->format('Y-m-d'), $ending_date->format('Y-m-d'));
218 218
 		}
219 219
 
220
-		$report_title = esc_html__( 'Total Revenue per Event', 'event_espresso' );
220
+		$report_title = esc_html__('Total Revenue per Event', 'event_espresso');
221 221
 
222 222
 		$report_params = array(
223 223
 			'title' 		=> $report_title,
224 224
 			'subtitle' => $subtitle,
225 225
 			'id' 			=> $report_ID,
226 226
 			'revenue' => $revenue,
227
-			'noResults' => empty( $revenue ),
228
-			'noTxnMsg'	=> sprintf( __( '%sThere are currently no transaction records in the last month for this report.%s', 'event_espresso' ), '<h2>' . $report_title . '</h2><p>', '</p>' )
227
+			'noResults' => empty($revenue),
228
+			'noTxnMsg'	=> sprintf(__('%sThere are currently no transaction records in the last month for this report.%s', 'event_espresso'), '<h2>'.$report_title.'</h2><p>', '</p>')
229 229
 		);
230
-		wp_localize_script( 'ee-txn-reports-js', 'txnRevPerEvent', $report_params );
230
+		wp_localize_script('ee-txn-reports-js', 'txnRevPerEvent', $report_params);
231 231
 
232 232
 		return $report_ID;
233 233
 	}
Please login to merge, or discard this patch.
caffeinated/admin/new/pricing/Pricing_Admin_Page.core.php 1 patch
Spacing   +190 added lines, -190 removed lines patch added patch discarded remove patch
@@ -31,8 +31,8 @@  discard block
 block discarded – undo
31 31
 	 * @param bool $routing
32 32
 	 * @return Pricing_Admin_Page
33 33
 	 */
34
-	public function __construct( $routing = TRUE ) {
35
-		parent::__construct( $routing );
34
+	public function __construct($routing = TRUE) {
35
+		parent::__construct($routing);
36 36
 	}
37 37
 
38 38
 
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
 
50 50
 
51 51
 	protected function _ajax_hooks() {
52
-		add_action('wp_ajax_espresso_update_prices_order', array( $this, 'update_price_order' ));
52
+		add_action('wp_ajax_espresso_update_prices_order', array($this, 'update_price_order'));
53 53
 	}
54 54
 
55 55
 
@@ -82,8 +82,8 @@  discard block
 block discarded – undo
82 82
 	*		@return void
83 83
 	*/
84 84
 	protected function _set_page_routes() {
85
-		$prc_id = ! empty( $this->_req_data['PRC_ID'] ) && ! is_array( $this->_req_data['PRC_ID'] ) ? $this->_req_data['PRC_ID'] : 0;
86
-		$prt_id =  ! empty( $this->_req_data['PRT_ID'] ) && ! is_array( $this->_req_data['PRT_ID'] ) ? $this->_req_data['PRT_ID'] : 0;
85
+		$prc_id = ! empty($this->_req_data['PRC_ID']) && ! is_array($this->_req_data['PRC_ID']) ? $this->_req_data['PRC_ID'] : 0;
86
+		$prt_id = ! empty($this->_req_data['PRT_ID']) && ! is_array($this->_req_data['PRT_ID']) ? $this->_req_data['PRT_ID'] : 0;
87 87
 		$this->_page_routes = array(
88 88
 			'default' => array(
89 89
 					'func' => '_price_overview_list_table',
@@ -91,38 +91,38 @@  discard block
 block discarded – undo
91 91
 				),
92 92
 			'add_new_price'	=> array(
93 93
 					'func' => '_edit_price_details',
94
-					'args' => array( 'new_price' => TRUE ),
94
+					'args' => array('new_price' => TRUE),
95 95
 					'capability' => 'ee_edit_default_prices'
96 96
 				),
97 97
 			'edit_price'	=> array(
98 98
 					'func' => '_edit_price_details',
99
-					'args' => array( 'new_price' => FALSE ),
99
+					'args' => array('new_price' => FALSE),
100 100
 					'capability' => 'ee_edit_default_price',
101 101
 					'obj_id' => $prc_id
102 102
 				),
103 103
 			'insert_price'	=> array(
104 104
 					'func' => '_insert_or_update_price',
105
-					'args' => array( 'new_price' => TRUE ),
105
+					'args' => array('new_price' => TRUE),
106 106
 					'noheader' => TRUE,
107 107
 					'capability' => 'ee_edit_default_prices',
108 108
 				),
109 109
 			'update_price'	=> array(
110 110
 					'func' => '_insert_or_update_price',
111
-					'args' => array( 'new_price' => FALSE ),
111
+					'args' => array('new_price' => FALSE),
112 112
 					'noheader' => TRUE,
113 113
 					'capability' => 'ee_edit_default_price',
114 114
 					'obj_id' => $prc_id
115 115
 				),
116 116
 			'trash_price'	=> array(
117 117
 					'func' => '_trash_or_restore_price',
118
-					'args' => array( 'trash' => TRUE ),
118
+					'args' => array('trash' => TRUE),
119 119
 					'noheader' => TRUE,
120 120
 					'capability' => 'ee_delete_default_price',
121 121
 					'obj_id' => $prc_id
122 122
 				),
123 123
 			'restore_price'	=> array(
124 124
 					'func' => '_trash_or_restore_price',
125
-					'args' => array( 'trash' => FALSE ),
125
+					'args' => array('trash' => FALSE),
126 126
 					'noheader' => TRUE,
127 127
 					'capability' => 'ee_delete_default_price',
128 128
 					'obj_id' => $prc_id
@@ -154,27 +154,27 @@  discard block
 block discarded – undo
154 154
 				),
155 155
 			'insert_price_type'	=> array(
156 156
 					'func' => '_insert_or_update_price_type',
157
-					'args' => array( 'new_price_type' => TRUE ),
157
+					'args' => array('new_price_type' => TRUE),
158 158
 					'noheader' => TRUE,
159 159
 					'capability' => 'ee_edit_default_price_types'
160 160
 				),
161 161
 			'update_price_type' => array(
162 162
 					'func' => '_insert_or_update_price_type',
163
-					'args' => array( 'new_price_type' => FALSE ),
163
+					'args' => array('new_price_type' => FALSE),
164 164
 					'noheader' => TRUE,
165 165
 					'capability' => 'ee_edit_default_price_type',
166 166
 					'obj_id' => $prt_id
167 167
 				),
168 168
 			'trash_price_type'	=> array(
169 169
 					'func' => '_trash_or_restore_price_type',
170
-					'args' => array( 'trash' => TRUE ),
170
+					'args' => array('trash' => TRUE),
171 171
 					'noheader' => TRUE,
172 172
 					'capability' => 'ee_delete_default_price_type',
173 173
 					'obj_id' => $prt_id
174 174
 				),
175 175
 			'restore_price_type'	=> array(
176 176
 					'func' => '_trash_or_restore_price_type',
177
-					'args' => array( 'trash' => FALSE ),
177
+					'args' => array('trash' => FALSE),
178 178
 					'noheader' => TRUE,
179 179
 					'capability' => 'ee_delete_default_price_type',
180 180
 					'obj_id' => $prt_id
@@ -214,7 +214,7 @@  discard block
 block discarded – undo
214 214
 							'filename' => 'pricing_default_pricing_views_bulk_actions_search'
215 215
 							)
216 216
 						),
217
-					'help_tour' => array( 'Pricing_Default_Prices_Help_Tour'),
217
+					'help_tour' => array('Pricing_Default_Prices_Help_Tour'),
218 218
 					'require_nonce' => FALSE
219 219
 				),
220 220
 			'add_new_price' => array(
@@ -230,24 +230,24 @@  discard block
 block discarded – undo
230 230
 							)
231 231
 						),
232 232
                     'help_tour' => array('Pricing_Add_New_Default_Price_Help_Tour'),
233
-					'metaboxes' => array( '_publish_post_box', '_espresso_news_post_box', '_price_details_meta_boxes' ),
233
+					'metaboxes' => array('_publish_post_box', '_espresso_news_post_box', '_price_details_meta_boxes'),
234 234
 					'require_nonce' => FALSE
235 235
 				),
236 236
 			'edit_price' => array(
237 237
 					'nav' => array(
238 238
 							'label' => __('Edit Default Price', 'event_espresso'),
239 239
 							'order' => 20,
240
-							'url' => isset($this->_req_data['id']) ? add_query_arg(array('id' => $this->_req_data['id'] ), $this->_current_page_view_url )  : $this->_admin_base_url,
240
+							'url' => isset($this->_req_data['id']) ? add_query_arg(array('id' => $this->_req_data['id']), $this->_current_page_view_url) : $this->_admin_base_url,
241 241
 							'persistent' => FALSE
242 242
 						),
243
-					'metaboxes' => array( '_publish_post_box', '_espresso_news_post_box', '_price_details_meta_boxes' ),
243
+					'metaboxes' => array('_publish_post_box', '_espresso_news_post_box', '_price_details_meta_boxes'),
244 244
                     'help_tabs' => array(
245 245
 						'edit_default_price_help_tab' => array(
246 246
 							'title' => __('Edit Default Price', 'event_espresso'),
247 247
 							'filename' => 'pricing_edit_default_price'
248 248
 							)
249 249
 						),
250
-					'help_tour' => array( 'Pricing_Edit_Default_Price_Help_Tour' ),
250
+					'help_tour' => array('Pricing_Edit_Default_Price_Help_Tour'),
251 251
 					'require_nonce' => FALSE
252 252
 				),
253 253
 			'price_types' => array(
@@ -270,7 +270,7 @@  discard block
 block discarded – undo
270 270
 							'filename' => 'pricing_price_types_views_bulk_actions_search'
271 271
 							),
272 272
 						),
273
-					'help_tour' => array( 'Pricing_Price_Types_Default_Help_Tour' ),
273
+					'help_tour' => array('Pricing_Price_Types_Default_Help_Tour'),
274 274
 					'metaboxes' => array('_espresso_news_post_box', '_espresso_links_post_box'),
275 275
 					'require_nonce' => FALSE
276 276
 				),
@@ -286,8 +286,8 @@  discard block
 block discarded – undo
286 286
 							'filename' => 'pricing_add_new_price_type'
287 287
 							)
288 288
 						),
289
-                    'help_tour' => array( 'Pricing_Add_New_Price_Type_Help_Tour' ),
290
-					'metaboxes' => array( '_publish_post_box', '_espresso_news_post_box', '_price_type_details_meta_boxes' ),
289
+                    'help_tour' => array('Pricing_Add_New_Price_Type_Help_Tour'),
290
+					'metaboxes' => array('_publish_post_box', '_espresso_news_post_box', '_price_type_details_meta_boxes'),
291 291
 					'require_nonce' => FALSE
292 292
 				),
293 293
 			'edit_price_type' => array(
@@ -302,8 +302,8 @@  discard block
 block discarded – undo
302 302
 							'filename' => 'pricing_edit_price_type'
303 303
 							)
304 304
 						),
305
-                    'help_tour' => array( 'Pricing_Edit_Price_Type_Help_Tour' ),
306
-					'metaboxes' => array( '_publish_post_box', '_espresso_news_post_box', '_price_type_details_meta_boxes' ),
305
+                    'help_tour' => array('Pricing_Edit_Price_Type_Help_Tour'),
306
+					'metaboxes' => array('_publish_post_box', '_espresso_news_post_box', '_price_type_details_meta_boxes'),
307 307
 
308 308
 					'require_nonce' => FALSE
309 309
 				)
@@ -340,7 +340,7 @@  discard block
 block discarded – undo
340 340
 	public function load_scripts_styles() {
341 341
 		//styles
342 342
 		wp_enqueue_style('espresso-ui-theme');
343
-		wp_register_style( 'espresso_PRICING', PRICING_ASSETS_URL . 'espresso_pricing_admin.css', array(), EVENT_ESPRESSO_VERSION );
343
+		wp_register_style('espresso_PRICING', PRICING_ASSETS_URL.'espresso_pricing_admin.css', array(), EVENT_ESPRESSO_VERSION);
344 344
 		wp_enqueue_style('espresso_PRICING');
345 345
 
346 346
 		//scripts
@@ -350,8 +350,8 @@  discard block
 block discarded – undo
350 350
 		//wp_enqueue_script('jquery-ui-dialog');
351 351
 		//wp_enqueue_script('jquery-ui-draggable');
352 352
 		//wp_enqueue_script('jquery-ui-datepicker');
353
-		wp_register_script( 'espresso_PRICING', PRICING_ASSETS_URL . 'espresso_pricing_admin.js', array('jquery'), EVENT_ESPRESSO_VERSION, TRUE );
354
-		wp_enqueue_script( 'espresso_PRICING' );
353
+		wp_register_script('espresso_PRICING', PRICING_ASSETS_URL.'espresso_pricing_admin.js', array('jquery'), EVENT_ESPRESSO_VERSION, TRUE);
354
+		wp_enqueue_script('espresso_PRICING');
355 355
 	}
356 356
 
357 357
 
@@ -359,7 +359,7 @@  discard block
 block discarded – undo
359 359
 
360 360
 
361 361
 	public function load_scripts_styles_default() {
362
-		wp_enqueue_script( 'espresso_ajax_table_sorting' );
362
+		wp_enqueue_script('espresso_ajax_table_sorting');
363 363
 	}
364 364
 
365 365
 
@@ -387,7 +387,7 @@  discard block
 block discarded – undo
387 387
 				)
388 388
 		);
389 389
 
390
-		if ( EE_Registry::instance()->CAP->current_user_can( 'ee_delete_default_prices', 'pricing_trash_price' ) ) {
390
+		if (EE_Registry::instance()->CAP->current_user_can('ee_delete_default_prices', 'pricing_trash_price')) {
391 391
 			$this->_views['trashed'] = array(
392 392
 					'slug' => 'trashed',
393 393
 					'label' => __('Trash', 'event_espresso'),
@@ -417,7 +417,7 @@  discard block
 block discarded – undo
417 417
 				)
418 418
 		);
419 419
 
420
-		if ( EE_Registry::instance()->CAP->current_user_can( 'ee_delete_default_price_types', 'pricing_trash_price_type' ) ) {
420
+		if (EE_Registry::instance()->CAP->current_user_can('ee_delete_default_price_types', 'pricing_trash_price_type')) {
421 421
 			 $this->_views['trashed'] = array(
422 422
 					'slug' => 'trashed',
423 423
 					'label' => __('Trash', 'event_espresso'),
@@ -456,18 +456,18 @@  discard block
 block discarded – undo
456 456
 	* 	@param  boolean $trashed   whether the current view is of the trash can - eww yuck!
457 457
 	* 	@return mixed (int|array)  int = count || array of price objects
458 458
 	*/
459
-	public function get_prices_overview_data( $per_page = 10, $count = FALSE, $trashed = FALSE ) {
459
+	public function get_prices_overview_data($per_page = 10, $count = FALSE, $trashed = FALSE) {
460 460
 
461
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
461
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
462 462
 		// start with an empty array
463 463
 		$event_pricing = array();
464 464
 
465
-		require_once( PRICING_ADMIN . 'Prices_List_Table.class.php' );
466
-		require_once(EE_MODELS . 'EEM_Price.model.php');
465
+		require_once(PRICING_ADMIN.'Prices_List_Table.class.php');
466
+		require_once(EE_MODELS.'EEM_Price.model.php');
467 467
 		//$PRC = EEM_Price::instance();
468 468
 
469 469
 		$this->_req_data['orderby'] = empty($this->_req_data['orderby']) ? '' : $this->_req_data['orderby'];
470
-		$order = ( isset( $this->_req_data['order'] ) && ! empty( $this->_req_data['order'] )) ? $this->_req_data['order'] : 'ASC';
470
+		$order = (isset($this->_req_data['order']) && ! empty($this->_req_data['order'])) ? $this->_req_data['order'] : 'ASC';
471 471
 
472 472
 		switch ($this->_req_data['orderby']) {
473 473
 			case 'name':
@@ -480,27 +480,27 @@  discard block
 block discarded – undo
480 480
 				$orderby = array('PRC_amount'=>$order);
481 481
 				break;
482 482
 			default:
483
-				$orderby = array( 'PRC_order'=>$order, 'Price_Type.PRT_order'=>$order, 'PRC_ID'=>$order);
483
+				$orderby = array('PRC_order'=>$order, 'Price_Type.PRT_order'=>$order, 'PRC_ID'=>$order);
484 484
 		}
485 485
 
486
-		$current_page = isset( $this->_req_data['paged'] ) && !empty( $this->_req_data['paged'] ) ? $this->_req_data['paged'] : 1;
487
-		$per_page = isset( $this->_req_data['perpage'] ) && !empty( $this->_req_data['perpage'] ) ? $this->_req_data['perpage'] : $per_page;
486
+		$current_page = isset($this->_req_data['paged']) && ! empty($this->_req_data['paged']) ? $this->_req_data['paged'] : 1;
487
+		$per_page = isset($this->_req_data['perpage']) && ! empty($this->_req_data['perpage']) ? $this->_req_data['perpage'] : $per_page;
488 488
 
489 489
 		$_where = array(
490 490
 				'PRC_is_default' => 1,
491 491
 				'PRC_deleted' => $trashed
492 492
 				);
493 493
 
494
-		$offset = ($current_page-1)*$per_page;
495
-		$limit = array( $offset, $per_page );
494
+		$offset = ($current_page - 1) * $per_page;
495
+		$limit = array($offset, $per_page);
496 496
 
497
-		if ( isset( $this->_req_data['s'] ) ) {
498
-			$sstr = '%' . $this->_req_data['s'] . '%';
497
+		if (isset($this->_req_data['s'])) {
498
+			$sstr = '%'.$this->_req_data['s'].'%';
499 499
 			$_where['OR'] = array(
500
-				'PRC_name' => array('LIKE',$sstr ),
501
-				'PRC_desc' => array('LIKE',$sstr ),
502
-				'PRC_amount' => array( 'LIKE',$sstr ),
503
-				'Price_Type.PRT_name' => array( 'LIKE', $sstr )
500
+				'PRC_name' => array('LIKE', $sstr),
501
+				'PRC_desc' => array('LIKE', $sstr),
502
+				'PRC_amount' => array('LIKE', $sstr),
503
+				'Price_Type.PRT_name' => array('LIKE', $sstr)
504 504
 				);
505 505
 		}
506 506
 
@@ -511,9 +511,9 @@  discard block
 block discarded – undo
511 511
 			'group_by'=>'PRC_ID'
512 512
 			);
513 513
 
514
-		if($count){
515
-			return $trashed ? EEM_Price::instance()->count( array( $_where ) ) : EEM_Price::instance()->count_deleted_and_undeleted(array($_where));
516
-		}else{
514
+		if ($count) {
515
+			return $trashed ? EEM_Price::instance()->count(array($_where)) : EEM_Price::instance()->count_deleted_and_undeleted(array($_where));
516
+		} else {
517 517
 			return EEM_Price::instance()->get_all_deleted_and_undeleted($query_params);
518 518
 		}
519 519
 	}
@@ -529,49 +529,49 @@  discard block
 block discarded – undo
529 529
 	*		@return void
530 530
 	*/
531 531
 	protected function _edit_price_details() {
532
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
532
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
533 533
 		// grab price ID
534
-		$PRC_ID = isset( $this->_req_data['id'] ) && ! empty( $this->_req_data['id'] ) ? absint( $this->_req_data['id'] ) : FALSE;
534
+		$PRC_ID = isset($this->_req_data['id']) && ! empty($this->_req_data['id']) ? absint($this->_req_data['id']) : FALSE;
535 535
 		// change page title based on request action
536
-		switch( $this->_req_action ) {
536
+		switch ($this->_req_action) {
537 537
 			case 'add_new_price' :
538
-				$this->_admin_page_title = esc_html__( 'Add New Price', 'event_espresso' );
538
+				$this->_admin_page_title = esc_html__('Add New Price', 'event_espresso');
539 539
 				break;
540 540
 			case 'edit_price' :
541
-				$this->_admin_page_title = esc_html__( 'Edit Price', 'event_espresso' );
541
+				$this->_admin_page_title = esc_html__('Edit Price', 'event_espresso');
542 542
 				break;
543 543
 			default :
544
-				$this->_admin_page_title = ucwords( str_replace( '_', ' ', $this->_req_action ));
544
+				$this->_admin_page_title = ucwords(str_replace('_', ' ', $this->_req_action));
545 545
 		}
546 546
 		// add PRC_ID to title if editing
547
-		$this->_admin_page_title = $PRC_ID ? $this->_admin_page_title . ' # ' . $PRC_ID : $this->_admin_page_title;
547
+		$this->_admin_page_title = $PRC_ID ? $this->_admin_page_title.' # '.$PRC_ID : $this->_admin_page_title;
548 548
 
549 549
 		// get prices
550
-		require_once(EE_MODELS . 'EEM_Price.model.php');
550
+		require_once(EE_MODELS.'EEM_Price.model.php');
551 551
 		$PRC = EEM_Price::instance();
552 552
 
553
-		if ( $PRC_ID ) {
554
-			$price = $PRC->get_one_by_ID( $PRC_ID );
553
+		if ($PRC_ID) {
554
+			$price = $PRC->get_one_by_ID($PRC_ID);
555 555
 			$additional_hidden_fields = array(
556
-					'PRC_ID' => array( 'type' => 'hidden', 'value' => $PRC_ID )
556
+					'PRC_ID' => array('type' => 'hidden', 'value' => $PRC_ID)
557 557
 				);
558
-			$this->_set_add_edit_form_tags( 'update_price', $additional_hidden_fields );
558
+			$this->_set_add_edit_form_tags('update_price', $additional_hidden_fields);
559 559
 		} else {
560 560
 			$price = $PRC->get_new_price();
561
-			$this->_set_add_edit_form_tags( 'insert_price' );
561
+			$this->_set_add_edit_form_tags('insert_price');
562 562
 		}
563 563
 
564 564
 		$this->_template_args['PRC_ID'] = $PRC_ID;
565 565
 		$this->_template_args['price'] = $price;
566 566
 
567 567
 		// get price types
568
-		require_once(EE_MODELS . 'EEM_Price_Type.model.php');
568
+		require_once(EE_MODELS.'EEM_Price_Type.model.php');
569 569
 		$PRT = EEM_Price_Type::instance();
570
-		$price_types = $PRT->get_all( array( array('PBT_ID' => array('!=', 1 ) ) ) );
570
+		$price_types = $PRT->get_all(array(array('PBT_ID' => array('!=', 1))));
571 571
 		$price_type_names = array();
572 572
 		if (empty($price_types)) {
573
-			$msg = __( 'You have no price types defined. Please add a price type before adding a price.', 'event_espresso' );
574
-			EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ );
573
+			$msg = __('You have no price types defined. Please add a price type before adding a price.', 'event_espresso');
574
+			EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
575 575
 			exit();
576 576
 		} else {
577 577
 			foreach ($price_types as $type) {
@@ -584,7 +584,7 @@  discard block
 block discarded – undo
584 584
 		$this->_template_args['price_types'] = $price_type_names;
585 585
 		$this->_template_args['learn_more_about_pricing_link'] = $this->_learn_more_about_pricing_link();
586 586
 
587
-		$this->_set_publish_post_box_vars( 'id', $PRC_ID );
587
+		$this->_set_publish_post_box_vars('id', $PRC_ID);
588 588
 		// the details template wrapper
589 589
 		$this->display_admin_page_with_sidebar();
590 590
 	}
@@ -600,7 +600,7 @@  discard block
 block discarded – undo
600 600
 	*		@return void
601 601
 	*/
602 602
 	protected function _price_details_meta_boxes() {
603
-		add_meta_box( 'edit-price-details-mbox', __( 'Default Price Details', 'event_espresso' ), array( $this, '_edit_price_details_meta_box' ), $this->wp_page_slug, 'normal', 'high' );
603
+		add_meta_box('edit-price-details-mbox', __('Default Price Details', 'event_espresso'), array($this, '_edit_price_details_meta_box'), $this->wp_page_slug, 'normal', 'high');
604 604
 	}
605 605
 
606 606
 
@@ -614,7 +614,7 @@  discard block
 block discarded – undo
614 614
 	*		@return void
615 615
 	*/
616 616
 	public function _edit_price_details_meta_box() {
617
-		echo EEH_Template::display_template( PRICING_TEMPLATE_PATH . 'pricing_details_main_meta_box.template.php', $this->_template_args, TRUE );
617
+		echo EEH_Template::display_template(PRICING_TEMPLATE_PATH.'pricing_details_main_meta_box.template.php', $this->_template_args, TRUE);
618 618
 	}
619 619
 
620 620
 
@@ -628,7 +628,7 @@  discard block
 block discarded – undo
628 628
 	*/
629 629
 	protected function set_price_column_values() {
630 630
 
631
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
631
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
632 632
 
633 633
 		$set_column_values = array(
634 634
 				'PRT_ID' => absint($this->_req_data['PRT_ID']),
@@ -656,12 +656,12 @@  discard block
 block discarded – undo
656 656
 	*		@access protected
657 657
 	*		@return void
658 658
 	*/
659
-	protected function _insert_or_update_price( $insert = FALSE ) {
659
+	protected function _insert_or_update_price($insert = FALSE) {
660 660
 
661 661
 		//echo '<h3>'. __CLASS__ . '->' . __FUNCTION__ . ' <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span></h3>';
662
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
662
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
663 663
 
664
-		require_once(EE_MODELS . 'EEM_Price.model.php');
664
+		require_once(EE_MODELS.'EEM_Price.model.php');
665 665
 		$PRC = EEM_Price::instance();
666 666
 
667 667
 		// why be so pessimistic ???  : (
@@ -669,14 +669,14 @@  discard block
 block discarded – undo
669 669
 
670 670
 		$set_column_values = $this->set_price_column_values();
671 671
 		// is this a new Price ?
672
-		if ( $insert ) {
672
+		if ($insert) {
673 673
 			// run the insert
674
-			if ( $PRC_ID = $PRC->insert( $set_column_values )) {
674
+			if ($PRC_ID = $PRC->insert($set_column_values)) {
675 675
 				//make sure this new price modifier is attached to the ticket but ONLY if it is not a tax type
676 676
 				$PR = EEM_price::instance()->get_one_by_ID($PRC_ID);
677
-				if ( $PR->type_obj()->base_type() !== EEM_Price_Type::base_type_tax ) {
677
+				if ($PR->type_obj()->base_type() !== EEM_Price_Type::base_type_tax) {
678 678
 					$ticket = EEM_Ticket::instance()->get_one_by_ID(1);
679
-					$ticket->_add_relation_to( $PR, 'Price' );
679
+					$ticket->_add_relation_to($PR, 'Price');
680 680
 					$ticket->save();
681 681
 				}
682 682
 				$success = 1;
@@ -686,29 +686,29 @@  discard block
 block discarded – undo
686 686
 			}
687 687
 			$action_desc = 'created';
688 688
 		} else {
689
-			$PRC_ID = absint( $this->_req_data['PRC_ID'] );
689
+			$PRC_ID = absint($this->_req_data['PRC_ID']);
690 690
 			// run the update
691
-			$where_cols_n_values = array( 'PRC_ID' => $PRC_ID );
692
-			if ( $PRC->update( $set_column_values, array($where_cols_n_values))) {
691
+			$where_cols_n_values = array('PRC_ID' => $PRC_ID);
692
+			if ($PRC->update($set_column_values, array($where_cols_n_values))) {
693 693
 				$success = 1;
694 694
 			}
695 695
 
696 696
 			$PR = EEM_Price::instance()->get_one_by_ID($PRC_ID);
697
-			if ( $PR->type_obj()->base_type() !== EEM_Price_Type::base_type_tax ) {
697
+			if ($PR->type_obj()->base_type() !== EEM_Price_Type::base_type_tax) {
698 698
 
699 699
 				//if this is $PRC_ID == 1, then we need to update the default ticket attached to this price so the TKT_price value is updated.
700
-				if ( $PRC_ID === 1 ) {
700
+				if ($PRC_ID === 1) {
701 701
 					$ticket = $PR->get_first_related('Ticket');
702
-					if ( $ticket ) {
703
-						$ticket->set('TKT_price', $PR->get('PRC_amount') );
704
-						$ticket->set('TKT_name', $PR->get('PRC_name') );
702
+					if ($ticket) {
703
+						$ticket->set('TKT_price', $PR->get('PRC_amount'));
704
+						$ticket->set('TKT_name', $PR->get('PRC_name'));
705 705
 						$ticket->set('TKT_description', $PR->get('PRC_desc'));
706 706
 						$ticket->save();
707 707
 					}
708 708
 				} else {
709 709
 					//we make sure this price is attached to base ticket. but ONLY if its not a tax ticket type.
710 710
 					$ticket = EEM_Ticket::instance()->get_one_by_ID(1);
711
-					$ticket->_add_relation_to( $PRC_ID, 'Price' );
711
+					$ticket->_add_relation_to($PRC_ID, 'Price');
712 712
 					$ticket->save();
713 713
 				}
714 714
 			}
@@ -716,9 +716,9 @@  discard block
 block discarded – undo
716 716
 			$action_desc = 'updated';
717 717
 		}
718 718
 
719
-		$query_args = array( 'action' => 'edit_price', 'id' => $PRC_ID );
719
+		$query_args = array('action' => 'edit_price', 'id' => $PRC_ID);
720 720
 
721
-		$this->_redirect_after_action( $success, 'Prices', $action_desc, $query_args );
721
+		$this->_redirect_after_action($success, 'Prices', $action_desc, $query_args);
722 722
 
723 723
 	}
724 724
 
@@ -732,12 +732,12 @@  discard block
 block discarded – undo
732 732
 	*		@access protected
733 733
 	*		@return void
734 734
 	*/
735
-	protected function _trash_or_restore_price( $trash = TRUE ) {
735
+	protected function _trash_or_restore_price($trash = TRUE) {
736 736
 
737 737
 		//echo '<h3>'. __CLASS__ . '->' . __FUNCTION__ . ' <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span></h3>';
738
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
738
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
739 739
 
740
-		require_once(EE_MODELS . 'EEM_Price.model.php');
740
+		require_once(EE_MODELS.'EEM_Price.model.php');
741 741
 		$PRC = EEM_Price::instance();
742 742
 
743 743
 		$success = 1;
@@ -746,18 +746,18 @@  discard block
 block discarded – undo
746 746
 		//get base ticket for updating
747 747
 		$ticket = EEM_Ticket::instance()->get_one_by_ID(1);
748 748
 		//Checkboxes
749
-		if (!empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) {
749
+		if ( ! empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) {
750 750
 			// if array has more than one element than success message should be plural
751
-			$success = count( $this->_req_data['checkbox'] ) > 1 ? 2 : 1;
751
+			$success = count($this->_req_data['checkbox']) > 1 ? 2 : 1;
752 752
 			// cycle thru checkboxes
753
-			while (list( $PRC_ID, $value ) = each($this->_req_data['checkbox'])) {
754
-				if ( ! $PRC->update_by_ID(array('PRC_deleted' => $PRC_deleted), absint($PRC_ID) ) ) {
753
+			while (list($PRC_ID, $value) = each($this->_req_data['checkbox'])) {
754
+				if ( ! $PRC->update_by_ID(array('PRC_deleted' => $PRC_deleted), absint($PRC_ID))) {
755 755
 					$success = 0;
756 756
 				} else {
757 757
 					$PR = EEM_Price::instance()->get_one_by_ID($PRC_ID);
758
-					if ( $PR->type_obj()->base_type() !== EEM_Price_Type::base_type_tax ) {
758
+					if ($PR->type_obj()->base_type() !== EEM_Price_Type::base_type_tax) {
759 759
 						//if trashing then remove relations to base default ticket.  If restoring then add back to base default ticket
760
-						if ( $PRC_deleted ) {
760
+						if ($PRC_deleted) {
761 761
 							$ticket->_remove_relation_to($PRC_ID, 'Price');
762 762
 						} else {
763 763
 							$ticket->_add_relation_to($PRC_ID, 'Price');
@@ -769,14 +769,14 @@  discard block
 block discarded – undo
769 769
 
770 770
 		} else {
771 771
 			// grab single id and delete
772
-			$PRC_ID = isset( $this->_req_data['id'] ) ? absint($this->_req_data['id']) : 0;
773
-			if ( empty( $PRC_ID ) || ! $PRC->update_by_ID(array('PRC_deleted' => $PRC_deleted), $PRC_ID) ) {
772
+			$PRC_ID = isset($this->_req_data['id']) ? absint($this->_req_data['id']) : 0;
773
+			if (empty($PRC_ID) || ! $PRC->update_by_ID(array('PRC_deleted' => $PRC_deleted), $PRC_ID)) {
774 774
 				$success = 0;
775 775
 			} else {
776 776
 				$PR = EEM_Price::instance()->get_one_by_ID($PRC_ID);
777
-				if ( $PR->type_obj()->base_type() !== EEM_Price_Type::base_type_tax ) {
777
+				if ($PR->type_obj()->base_type() !== EEM_Price_Type::base_type_tax) {
778 778
 					//if trashing then remove relations to base default ticket.  If restoring then add back to base default ticket
779
-					if ( $PRC_deleted ) {
779
+					if ($PRC_deleted) {
780 780
 						$ticket->_remove_relation_to($PRC_ID, 'Price');
781 781
 					} else {
782 782
 						$ticket->_add_relation_to($PRC_ID, 'Price');
@@ -790,17 +790,17 @@  discard block
 block discarded – undo
790 790
 			'action' => 'default'
791 791
 			);
792 792
 
793
-		if ( $success ) {
794
-			if ( $trash ) {
793
+		if ($success) {
794
+			if ($trash) {
795 795
 				$msg = $success == 2 ? __('The Prices have been trashed.', 'event_espresso') : __('The Price has been trashed.', 'event_espresso');
796 796
 			} else {
797 797
 				$msg = $success == 2 ? __('The Prices have been restored.', 'event_espresso') : __('The Price has been restored.', 'event_espresso');
798 798
 			}
799 799
 
800
-			EE_Error::add_success( $msg );
800
+			EE_Error::add_success($msg);
801 801
 		}
802 802
 
803
-		$this->_redirect_after_action( FALSE, '', '', $query_args, TRUE );
803
+		$this->_redirect_after_action(FALSE, '', '', $query_args, TRUE);
804 804
 
805 805
 	}
806 806
 
@@ -817,19 +817,19 @@  discard block
 block discarded – undo
817 817
 	protected function _delete_price() {
818 818
 
819 819
 		//echo '<h3>'. __CLASS__ . '->' . __FUNCTION__ . ' <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span></h3>';
820
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
820
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
821 821
 
822
-		require_once(EE_MODELS . 'EEM_Price.model.php');
822
+		require_once(EE_MODELS.'EEM_Price.model.php');
823 823
 		$PRC = EEM_Price::instance();
824 824
 
825 825
 		$success = 1;
826 826
 		//Checkboxes
827
-		if (!empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) {
827
+		if ( ! empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) {
828 828
 			// if array has more than one element than success message should be plural
829
-			$success = count( $this->_req_data['checkbox'] ) > 1 ? 2 : 1;
829
+			$success = count($this->_req_data['checkbox']) > 1 ? 2 : 1;
830 830
 			// cycle thru bulk action checkboxes
831
-			while (list( $PRC_ID, $value ) = each($this->_req_data['checkbox'])) {
832
-				if (!$PRC->delete_permanently_by_ID(absint($PRC_ID))) {
831
+			while (list($PRC_ID, $value) = each($this->_req_data['checkbox'])) {
832
+				if ( ! $PRC->delete_permanently_by_ID(absint($PRC_ID))) {
833 833
 					$success = 0;
834 834
 				}
835 835
 			}
@@ -843,7 +843,7 @@  discard block
 block discarded – undo
843 843
 
844 844
 		}
845 845
 
846
-		$this->_redirect_after_action( $success, 'Prices', 'deleted', array() );
846
+		$this->_redirect_after_action($success, 'Prices', 'deleted', array());
847 847
 
848 848
 	}
849 849
 
@@ -851,16 +851,16 @@  discard block
 block discarded – undo
851 851
 
852 852
 
853 853
 	public function update_price_order() {
854
-		$success = __( 'Price order was updated successfully.', 'event_espresso' );
854
+		$success = __('Price order was updated successfully.', 'event_espresso');
855 855
 
856 856
 		// grab our row IDs
857
-		$row_ids = isset( $this->_req_data['row_ids'] ) && ! empty( $this->_req_data['row_ids'] ) ? explode( ',', rtrim( $this->_req_data['row_ids'], ',' )) : FALSE;
857
+		$row_ids = isset($this->_req_data['row_ids']) && ! empty($this->_req_data['row_ids']) ? explode(',', rtrim($this->_req_data['row_ids'], ',')) : FALSE;
858 858
 
859
-		if ( is_array( $row_ids )) {
860
-			for ( $i = 0; $i < count( $row_ids ); $i++ ) {
859
+		if (is_array($row_ids)) {
860
+			for ($i = 0; $i < count($row_ids); $i++) {
861 861
 				//Update the prices when re-ordering
862 862
 				$id = absint($row_ids[$i]);
863
-				if ( EEM_Price::instance()->update ( array( 'PRC_order' => $i+1 ), array(array( 'PRC_ID' => $id ) )) === FALSE ) {
863
+				if (EEM_Price::instance()->update(array('PRC_order' => $i + 1), array(array('PRC_ID' => $id))) === FALSE) {
864 864
 					$success = FALSE;
865 865
 				}
866 866
 			}
@@ -868,9 +868,9 @@  discard block
 block discarded – undo
868 868
 			$success = FALSE;
869 869
 		}
870 870
 
871
-		$errors = ! $success ? __( 'An error occurred. The price order was not updated.', 'event_espresso' ) : FALSE;
871
+		$errors = ! $success ? __('An error occurred. The price order was not updated.', 'event_espresso') : FALSE;
872 872
 
873
-		echo json_encode( array( 'return_data' => FALSE, 'success' => $success, 'errors' => $errors ));
873
+		echo json_encode(array('return_data' => FALSE, 'success' => $success, 'errors' => $errors));
874 874
 		die();
875 875
 	}
876 876
 
@@ -913,46 +913,46 @@  discard block
 block discarded – undo
913 913
 	* 	@param  boolean $trashed   whether the current view is of the trash can - eww yuck!
914 914
 	* 	@return mixed (int|array)  int = count || array of price objects
915 915
 	*/
916
-	public function get_price_types_overview_data( $per_page = 10, $count = FALSE, $trashed = FALSE ) {
916
+	public function get_price_types_overview_data($per_page = 10, $count = FALSE, $trashed = FALSE) {
917 917
 
918
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
918
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
919 919
 		// start with an empty array
920 920
 
921
-		require_once( PRICING_ADMIN . 'Price_Types_List_Table.class.php' );
922
-		require_once( EE_MODELS . 'EEM_Price_Type.model.php' );
921
+		require_once(PRICING_ADMIN.'Price_Types_List_Table.class.php');
922
+		require_once(EE_MODELS.'EEM_Price_Type.model.php');
923 923
 
924 924
 		$this->_req_data['orderby'] = empty($this->_req_data['orderby']) ? '' : $this->_req_data['orderby'];
925
-		$order = ( isset( $this->_req_data['order'] ) && ! empty( $this->_req_data['order'] )) ? $this->_req_data['order'] : 'ASC';
925
+		$order = (isset($this->_req_data['order']) && ! empty($this->_req_data['order'])) ? $this->_req_data['order'] : 'ASC';
926 926
 		switch ($this->_req_data['orderby']) {
927 927
 			case 'name':
928
-				$orderby = array( 'PRT_name' => $order);
928
+				$orderby = array('PRT_name' => $order);
929 929
 				break;
930 930
 			default:
931
-				$orderby = array( 'PRT_order' => $order);
931
+				$orderby = array('PRT_order' => $order);
932 932
 		}
933 933
 
934 934
 
935
-		$current_page = isset( $this->_req_data['paged'] ) && !empty( $this->_req_data['paged'] ) ? $this->_req_data['paged'] : 1;
936
-		$per_page = isset( $this->_req_data['perpage'] ) && !empty( $this->_req_data['perpage'] ) ? $this->_req_data['perpage'] : $per_page;
935
+		$current_page = isset($this->_req_data['paged']) && ! empty($this->_req_data['paged']) ? $this->_req_data['paged'] : 1;
936
+		$per_page = isset($this->_req_data['perpage']) && ! empty($this->_req_data['perpage']) ? $this->_req_data['perpage'] : $per_page;
937 937
 
938
-		$offset = ($current_page-1)*$per_page;
939
-		$limit = array( $offset, $per_page );
938
+		$offset = ($current_page - 1) * $per_page;
939
+		$limit = array($offset, $per_page);
940 940
 
941
-		$_where = array('PRT_deleted'=>$trashed, 'PBT_ID' => array('!=', 1 ) );
941
+		$_where = array('PRT_deleted'=>$trashed, 'PBT_ID' => array('!=', 1));
942 942
 
943
-		if ( isset( $this->_req_data['s'] ) ) {
944
-			$sstr = '%' . $this->_req_data['s'] . '%';
943
+		if (isset($this->_req_data['s'])) {
944
+			$sstr = '%'.$this->_req_data['s'].'%';
945 945
 			$_where['OR'] = array(
946
-				'PRT_name' => array( 'LIKE', $sstr )
946
+				'PRT_name' => array('LIKE', $sstr)
947 947
 				);
948 948
 		}
949 949
 		$query_params = array(
950 950
 			$_where,
951 951
 			'order_by'=>$orderby,
952 952
 			'limit'=>$limit);
953
-		if($count){
953
+		if ($count) {
954 954
 			return EEM_Price_Type::instance()->count_deleted_and_undeleted($query_params);
955
-		}else{
955
+		} else {
956 956
 			return EEM_Price_Type::instance()->get_all_deleted_and_undeleted($query_params);
957 957
 		}
958 958
 
@@ -972,34 +972,34 @@  discard block
 block discarded – undo
972 972
 	*/
973 973
 	protected function _edit_price_type_details() {
974 974
 
975
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
975
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
976 976
 
977 977
 
978 978
 		// grab price type ID
979
-		$PRT_ID = isset( $this->_req_data['id'] ) && ! empty( $this->_req_data['id'] ) ? absint( $this->_req_data['id'] ) : FALSE;
979
+		$PRT_ID = isset($this->_req_data['id']) && ! empty($this->_req_data['id']) ? absint($this->_req_data['id']) : FALSE;
980 980
 		// change page title based on request action
981
-		switch( $this->_req_action ) {
981
+		switch ($this->_req_action) {
982 982
 			case 'add_new_price_type' :
983
-				$this->_admin_page_title = esc_html__( 'Add New Price Type', 'event_espresso' );
983
+				$this->_admin_page_title = esc_html__('Add New Price Type', 'event_espresso');
984 984
 				break;
985 985
 			case 'edit_price_type' :
986
-				$this->_admin_page_title = esc_html__( 'Edit Price Type', 'event_espresso' );
986
+				$this->_admin_page_title = esc_html__('Edit Price Type', 'event_espresso');
987 987
 				break;
988 988
 			default :
989
-				$this->_admin_page_title = ucwords( str_replace( '_', ' ', $this->_req_action ));
989
+				$this->_admin_page_title = ucwords(str_replace('_', ' ', $this->_req_action));
990 990
 		}
991 991
 		// add PRT_ID to title if editing
992
-		$this->_admin_page_title = $PRT_ID ? $this->_admin_page_title . ' # ' . $PRT_ID : $this->_admin_page_title;
992
+		$this->_admin_page_title = $PRT_ID ? $this->_admin_page_title.' # '.$PRT_ID : $this->_admin_page_title;
993 993
 
994 994
 //		require_once(EE_MODELS . 'EEM_Price_Type.model.php');
995 995
 
996
-		if ( $PRT_ID ) {
997
-			$price_type = EEM_Price_Type::instance()->get_one_by_ID( $PRT_ID );
998
-			$additional_hidden_fields = array( 'PRT_ID' => array( 'type' => 'hidden', 'value' => $PRT_ID ));
999
-			$this->_set_add_edit_form_tags( 'update_price_type', $additional_hidden_fields );
996
+		if ($PRT_ID) {
997
+			$price_type = EEM_Price_Type::instance()->get_one_by_ID($PRT_ID);
998
+			$additional_hidden_fields = array('PRT_ID' => array('type' => 'hidden', 'value' => $PRT_ID));
999
+			$this->_set_add_edit_form_tags('update_price_type', $additional_hidden_fields);
1000 1000
 		} else {
1001 1001
 			$price_type = EEM_Price_Type::instance()->get_new_price_type();
1002
-			$this->_set_add_edit_form_tags( 'insert_price_type' );
1002
+			$this->_set_add_edit_form_tags('insert_price_type');
1003 1003
 		}
1004 1004
 
1005 1005
 		$this->_template_args['PRT_ID'] = $PRT_ID;
@@ -1008,19 +1008,19 @@  discard block
 block discarded – undo
1008 1008
 
1009 1009
 		$base_types = EEM_Price_Type::instance()->get_base_types();
1010 1010
 		$select_values = array();
1011
-		foreach ( $base_types as $ref => $text ) {
1012
-			if ( $ref == EEM_Price_Type::base_type_base_price ) {
1011
+		foreach ($base_types as $ref => $text) {
1012
+			if ($ref == EEM_Price_Type::base_type_base_price) {
1013 1013
 				//do not allow creation of base_type_base_prices because that's a system only base type.
1014 1014
 				continue;
1015 1015
 			}
1016
-			$values[] = array( 'id' => $ref, 'text' => $text );
1016
+			$values[] = array('id' => $ref, 'text' => $text);
1017 1017
 		}
1018 1018
 
1019 1019
 
1020 1020
 		$this->_template_args['base_type_select'] = EEH_Form_Fields::select_input('base_type', $values, $price_type->base_type(), 'id="price-type-base-type-slct"');
1021 1021
 		$this->_template_args['learn_more_about_pricing_link'] = $this->_learn_more_about_pricing_link();
1022
-		$redirect_URL = add_query_arg( array( 'action' => 'price_types'), $this->_admin_base_url );
1023
-		$this->_set_publish_post_box_vars( 'id', $PRT_ID, FALSE, $redirect_URL );
1022
+		$redirect_URL = add_query_arg(array('action' => 'price_types'), $this->_admin_base_url);
1023
+		$this->_set_publish_post_box_vars('id', $PRT_ID, FALSE, $redirect_URL);
1024 1024
 		// the details template wrapper
1025 1025
 		$this->display_admin_page_with_sidebar();
1026 1026
 
@@ -1037,7 +1037,7 @@  discard block
 block discarded – undo
1037 1037
 	*		@return void
1038 1038
 	*/
1039 1039
 	protected function _price_type_details_meta_boxes() {
1040
-		add_meta_box( 'edit-price-details-mbox', __( 'Price Type Details', 'event_espresso' ), array( $this, '_edit_price_type_details_meta_box' ), $this->wp_page_slug, 'normal', 'high' );
1040
+		add_meta_box('edit-price-details-mbox', __('Price Type Details', 'event_espresso'), array($this, '_edit_price_type_details_meta_box'), $this->wp_page_slug, 'normal', 'high');
1041 1041
 	}
1042 1042
 
1043 1043
 
@@ -1050,7 +1050,7 @@  discard block
 block discarded – undo
1050 1050
 	*		@return void
1051 1051
 	*/
1052 1052
 	public function _edit_price_type_details_meta_box() {
1053
-		echo EEH_Template::display_template( PRICING_TEMPLATE_PATH . 'pricing_type_details_main_meta_box.template.php', $this->_template_args, TRUE );
1053
+		echo EEH_Template::display_template(PRICING_TEMPLATE_PATH.'pricing_type_details_main_meta_box.template.php', $this->_template_args, TRUE);
1054 1054
 	}
1055 1055
 
1056 1056
 
@@ -1063,9 +1063,9 @@  discard block
 block discarded – undo
1063 1063
 	*/
1064 1064
 	protected function set_price_type_column_values() {
1065 1065
 
1066
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
1066
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
1067 1067
 
1068
-		$base_type = !empty( $this->_req_data['base_type'] ) ? $this->_req_data['base_type'] : EEM_Price_Type::base_type_base_price;
1068
+		$base_type = ! empty($this->_req_data['base_type']) ? $this->_req_data['base_type'] : EEM_Price_Type::base_type_base_price;
1069 1069
 
1070 1070
 		switch ($base_type) {
1071 1071
 
@@ -1112,12 +1112,12 @@  discard block
 block discarded – undo
1112 1112
 	*		@access protected
1113 1113
 	*		@return void
1114 1114
 	*/
1115
-	protected function _insert_or_update_price_type( $new_price_type = FALSE ) {
1115
+	protected function _insert_or_update_price_type($new_price_type = FALSE) {
1116 1116
 
1117 1117
 //		echo '<h3>'. __CLASS__ . '->' . __FUNCTION__ . ' <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span></h3>';
1118
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
1118
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
1119 1119
 
1120
-		require_once(EE_MODELS . 'EEM_Price_Type.model.php');
1120
+		require_once(EE_MODELS.'EEM_Price_Type.model.php');
1121 1121
 		$PRT = EEM_Price_Type::instance();
1122 1122
 
1123 1123
 		// why be so pessimistic ???  : (
@@ -1125,24 +1125,24 @@  discard block
 block discarded – undo
1125 1125
 
1126 1126
 		$set_column_values = $this->set_price_type_column_values();
1127 1127
 		// is this a new Price ?
1128
-		if ( $new_price_type ) {
1128
+		if ($new_price_type) {
1129 1129
 			// run the insert
1130
-			if ( $PRT_ID = $PRT->insert( $set_column_values )) {
1130
+			if ($PRT_ID = $PRT->insert($set_column_values)) {
1131 1131
 				$success = 1;
1132 1132
 			}
1133 1133
 			$action_desc = 'created';
1134 1134
 		} else {
1135 1135
 			$PRT_ID = absint($this->_req_data['PRT_ID']);
1136 1136
 			// run the update
1137
-			$where_cols_n_values = array('PRT_ID' => $PRT_ID );
1138
-			if ( $PRT->update( $set_column_values, array( $where_cols_n_values ))) {
1137
+			$where_cols_n_values = array('PRT_ID' => $PRT_ID);
1138
+			if ($PRT->update($set_column_values, array($where_cols_n_values))) {
1139 1139
 				$success = 1;
1140 1140
 			}
1141 1141
 			$action_desc = 'updated';
1142 1142
 		}
1143 1143
 
1144
-		$query_args = array( 'action'=> 'edit_price_type', 'id' => $PRT_ID );
1145
-		$this->_redirect_after_action( $success, 'Price Type', $action_desc, $query_args );
1144
+		$query_args = array('action'=> 'edit_price_type', 'id' => $PRT_ID);
1145
+		$this->_redirect_after_action($success, 'Price Type', $action_desc, $query_args);
1146 1146
 
1147 1147
 	}
1148 1148
 
@@ -1156,49 +1156,49 @@  discard block
 block discarded – undo
1156 1156
 	*		@access protected
1157 1157
 	*		@return void
1158 1158
 	*/
1159
-	protected function _trash_or_restore_price_type( $trash = TRUE ) {
1159
+	protected function _trash_or_restore_price_type($trash = TRUE) {
1160 1160
 
1161 1161
 		//echo '<h3>'. __CLASS__ . '->' . __FUNCTION__ . ' <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span></h3>';
1162
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
1162
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
1163 1163
 
1164
-		require_once(EE_MODELS . 'EEM_Price_Type.model.php');
1164
+		require_once(EE_MODELS.'EEM_Price_Type.model.php');
1165 1165
 		$PRT = EEM_Price_Type::instance();
1166 1166
 
1167 1167
 		$success = 1;
1168 1168
 		$PRT_deleted = $trash ? TRUE : FALSE;
1169 1169
 		//Checkboxes
1170
-		if (!empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) {
1170
+		if ( ! empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) {
1171 1171
 			// if array has more than one element than success message should be plural
1172
-			$success = count( $this->_req_data['checkbox'] ) > 1 ? 2 : 1;
1173
-			$what = count( $this->_req_data['checkbox'] ) > 1 ? 'Price Types' : 'Price Type';
1172
+			$success = count($this->_req_data['checkbox']) > 1 ? 2 : 1;
1173
+			$what = count($this->_req_data['checkbox']) > 1 ? 'Price Types' : 'Price Type';
1174 1174
 			// cycle thru checkboxes
1175
-			while (list( $PRT_ID, $value ) = each($this->_req_data['checkbox'])) {
1176
-				if ( ! $PRT->update_by_ID(array('PRT_deleted' => $PRT_deleted), $PRT_ID ) ) {
1175
+			while (list($PRT_ID, $value) = each($this->_req_data['checkbox'])) {
1176
+				if ( ! $PRT->update_by_ID(array('PRT_deleted' => $PRT_deleted), $PRT_ID)) {
1177 1177
 					$success = 0;
1178 1178
 				}
1179 1179
 			}
1180 1180
 
1181 1181
 		} else {
1182 1182
 			// grab single id and delete
1183
-			$PRT_ID = isset( $this->_req_data['id'] ) ? absint($this->_req_data['id']) : 0;
1184
-			if ( empty( $PRT_ID ) || ! $PRT->update_by_ID(array('PRT_deleted' => $PRT_deleted), $PRT_ID )) {
1183
+			$PRT_ID = isset($this->_req_data['id']) ? absint($this->_req_data['id']) : 0;
1184
+			if (empty($PRT_ID) || ! $PRT->update_by_ID(array('PRT_deleted' => $PRT_deleted), $PRT_ID)) {
1185 1185
 				$success = 0;
1186 1186
 			}
1187 1187
 			$what = 'Price Type';
1188 1188
 
1189 1189
 		}
1190 1190
 
1191
-		$query_args = array( 'action' => 'price_types' );
1192
-		if ( $success ) {
1193
-			if ( $trash ) {
1191
+		$query_args = array('action' => 'price_types');
1192
+		if ($success) {
1193
+			if ($trash) {
1194 1194
 				$msg = $success > 1 ? __('The Price Types have been trashed.', 'event_espresso') : __('The Price Type has been trashed.', 'event_espresso');
1195 1195
 			} else {
1196 1196
 				$msg = $success > 1 ? __('The Price Types have been restored.', 'event_espresso') : __('The Price Type has been restored.', 'event_espresso');
1197 1197
 			}
1198
-			EE_Error::add_success( $msg );
1198
+			EE_Error::add_success($msg);
1199 1199
 		}
1200 1200
 
1201
-		$this->_redirect_after_action( FALSE, '', '', $query_args, TRUE );
1201
+		$this->_redirect_after_action(FALSE, '', '', $query_args, TRUE);
1202 1202
 
1203 1203
 	}
1204 1204
 
@@ -1215,19 +1215,19 @@  discard block
 block discarded – undo
1215 1215
 	protected function _delete_price_type() {
1216 1216
 
1217 1217
 		//echo '<h3>'. __CLASS__ . '->' . __FUNCTION__ . ' <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span></h3>';
1218
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
1218
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
1219 1219
 
1220 1220
 		$PRT = EEM_Price_Type::instance();
1221 1221
 
1222 1222
 		$success = 1;
1223 1223
 		//Checkboxes
1224
-		if (!empty($this->_req_data['checkbox'])) {
1224
+		if ( ! empty($this->_req_data['checkbox'])) {
1225 1225
 			// if array has more than one element than success message should be plural
1226
-			$success = count( $this->_req_data['checkbox'] ) > 1 ? 2 : 1;
1226
+			$success = count($this->_req_data['checkbox']) > 1 ? 2 : 1;
1227 1227
 			$what = $PRT->item_name($success);
1228 1228
 			// cycle thru bulk action checkboxes
1229
-			while (list( $PRT_ID, $value ) = each($this->_req_data['checkbox'])) {
1230
-				if (!$PRT->delete_permanently_by_ID($PRT_ID) ) {
1229
+			while (list($PRT_ID, $value) = each($this->_req_data['checkbox'])) {
1230
+				if ( ! $PRT->delete_permanently_by_ID($PRT_ID)) {
1231 1231
 					$success = 0;
1232 1232
 				}
1233 1233
 			}
@@ -1235,8 +1235,8 @@  discard block
 block discarded – undo
1235 1235
 		}
1236 1236
 
1237 1237
 
1238
-		$query_args = array( 'action'=> 'price_types' );
1239
-		$this->_redirect_after_action( $success, $what, 'deleted', $query_args );
1238
+		$query_args = array('action'=> 'price_types');
1239
+		$this->_redirect_after_action($success, $what, 'deleted', $query_args);
1240 1240
 
1241 1241
 	}
1242 1242
 
@@ -1252,7 +1252,7 @@  discard block
 block discarded – undo
1252 1252
 	*		@return string
1253 1253
 	*/
1254 1254
 	protected function _learn_more_about_pricing_link() {
1255
-		return '<a class="hidden" style="margin:0 20px; cursor:pointer; font-size:12px;" >' . __('learn more about how pricing works', 'event_espresso') . '</a>';
1255
+		return '<a class="hidden" style="margin:0 20px; cursor:pointer; font-size:12px;" >'.__('learn more about how pricing works', 'event_espresso').'</a>';
1256 1256
 	}
1257 1257
 
1258 1258
 
Please login to merge, or discard this patch.
pricing/templates/event_tickets_datetime_attached_tickets_row.template.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -51,7 +51,7 @@
 block discarded – undo
51 51
 				</table>
52 52
 				<div class="ee-editor-footer-container">
53 53
 					<div class="ee-editor-id-container">
54
-						<span class="ee-item-id"><?php echo $DTT_ID ? sprintf( esc_html__( 'Datetime ID: %d', 'event_espresso' ), $DTT_ID ) : ''; ?></span>
54
+						<span class="ee-item-id"><?php echo $DTT_ID ? sprintf(esc_html__('Datetime ID: %d', 'event_espresso'), $DTT_ID) : ''; ?></span>
55 55
 					</div>
56 56
 					<div class="save-cancel-button-container">
57 57
 						<button data-context="short-ticket" data-datetime-row="<?php echo $dtt_row; ?>" class="button-primary ee-create-button">
Please login to merge, or discard this patch.