@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | * @param array $options |
34 | 34 | * @return mixed |
35 | 35 | */ |
36 | - public function display_line_item( EE_Line_Item $line_item, $options = array() ) { |
|
36 | + public function display_line_item(EE_Line_Item $line_item, $options = array()) { |
|
37 | 37 | |
38 | 38 | $html = ''; |
39 | 39 | // set some default options and merge with incoming |
@@ -41,12 +41,12 @@ discard block |
||
41 | 41 | 'show_desc' => TRUE, |
42 | 42 | 'odd' => FALSE |
43 | 43 | ); |
44 | - $options = array_merge( $default_options, (array)$options ); |
|
45 | - switch( $line_item->type() ) { |
|
44 | + $options = array_merge($default_options, (array) $options); |
|
45 | + switch ($line_item->type()) { |
|
46 | 46 | |
47 | 47 | case EEM_Line_Item::type_total: |
48 | 48 | // loop thru children |
49 | - foreach( $line_item->children() as $child_line_item ) { |
|
49 | + foreach ($line_item->children() as $child_line_item) { |
|
50 | 50 | // recursively feed children back into this method |
51 | 51 | // $html .= $this->display_line_item( $child_line_item, $options ); |
52 | 52 | } |
@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | |
58 | 58 | case EEM_Line_Item::type_sub_total: |
59 | 59 | // loop thru children |
60 | - foreach( $line_item->children() as $child_line_item ) { |
|
60 | + foreach ($line_item->children() as $child_line_item) { |
|
61 | 61 | // recursively feed children back into this method |
62 | 62 | // $html .= $this->display_line_item( $child_line_item, $options ); |
63 | 63 | } |
@@ -67,7 +67,7 @@ discard block |
||
67 | 67 | |
68 | 68 | case EEM_Line_Item::type_tax_sub_total: |
69 | 69 | // loop thru children |
70 | - foreach( $line_item->children() as $child_line_item ) { |
|
70 | + foreach ($line_item->children() as $child_line_item) { |
|
71 | 71 | // recursively feed children back into this method |
72 | 72 | // $html .= $this->display_line_item( $child_line_item, $options ); |
73 | 73 | } |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | // item row |
80 | 80 | // $html .= $this->_item_row( $line_item, $options ); |
81 | 81 | // got any kids? |
82 | - foreach( $line_item->children() as $child_line_item ) { |
|
82 | + foreach ($line_item->children() as $child_line_item) { |
|
83 | 83 | // $this->display_line_item( $child_line_item, $options ); |
84 | 84 | } |
85 | 85 | break; |
@@ -18,7 +18,7 @@ discard block |
||
18 | 18 | * @param array $options |
19 | 19 | * @return mixed |
20 | 20 | */ |
21 | - public function display_line_item( EE_Line_Item $line_item, $options = array() ) { |
|
21 | + public function display_line_item(EE_Line_Item $line_item, $options = array()) { |
|
22 | 22 | |
23 | 23 | $html = ''; |
24 | 24 | // set some default options and merge with incoming |
@@ -26,58 +26,58 @@ discard block |
||
26 | 26 | 'show_desc' => TRUE, |
27 | 27 | 'odd' => FALSE |
28 | 28 | ); |
29 | - $options = array_merge( $default_options, (array)$options ); |
|
29 | + $options = array_merge($default_options, (array) $options); |
|
30 | 30 | |
31 | - switch( $line_item->type() ) { |
|
31 | + switch ($line_item->type()) { |
|
32 | 32 | |
33 | 33 | case EEM_Line_Item::type_total: |
34 | 34 | // loop thru children |
35 | - foreach( $line_item->children() as $child_line_item ) { |
|
35 | + foreach ($line_item->children() as $child_line_item) { |
|
36 | 36 | // recursively feed children back into this method |
37 | - $html .= $this->display_line_item( $child_line_item, $options ); |
|
37 | + $html .= $this->display_line_item($child_line_item, $options); |
|
38 | 38 | } |
39 | - $html .= $this->_separator_row( $options ); |
|
40 | - $html .= $this->_total_row( $line_item, __('Total', 'event_espresso'), $options ); |
|
39 | + $html .= $this->_separator_row($options); |
|
40 | + $html .= $this->_total_row($line_item, __('Total', 'event_espresso'), $options); |
|
41 | 41 | break; |
42 | 42 | |
43 | 43 | |
44 | 44 | case EEM_Line_Item::type_sub_total: |
45 | 45 | // loop thru children |
46 | - foreach( $line_item->children() as $child_line_item ) { |
|
46 | + foreach ($line_item->children() as $child_line_item) { |
|
47 | 47 | // recursively feed children back into this method |
48 | - $html .= $this->display_line_item( $child_line_item, $options ); |
|
48 | + $html .= $this->display_line_item($child_line_item, $options); |
|
49 | 49 | } |
50 | - $html .= $this->_total_row( $line_item, __('Sub-Total', 'event_espresso'), $options ); |
|
50 | + $html .= $this->_total_row($line_item, __('Sub-Total', 'event_espresso'), $options); |
|
51 | 51 | break; |
52 | 52 | |
53 | 53 | |
54 | 54 | case EEM_Line_Item::type_tax_sub_total: |
55 | 55 | // loop thru children |
56 | - foreach( $line_item->children() as $child_line_item ) { |
|
56 | + foreach ($line_item->children() as $child_line_item) { |
|
57 | 57 | // recursively feed children back into this method |
58 | - $html .= $this->display_line_item( $child_line_item, $options ); |
|
58 | + $html .= $this->display_line_item($child_line_item, $options); |
|
59 | 59 | } |
60 | - $html .= $this->_total_row( $line_item, __('Tax Total', 'event_espresso'), $options ); |
|
60 | + $html .= $this->_total_row($line_item, __('Tax Total', 'event_espresso'), $options); |
|
61 | 61 | break; |
62 | 62 | |
63 | 63 | |
64 | 64 | case EEM_Line_Item::type_line_item: |
65 | 65 | // item row |
66 | - $html .= $this->_item_row( $line_item, $options ); |
|
66 | + $html .= $this->_item_row($line_item, $options); |
|
67 | 67 | // got any kids? |
68 | - foreach( $line_item->children() as $child_line_item ) { |
|
69 | - $this->display_line_item( $child_line_item, $options ); |
|
68 | + foreach ($line_item->children() as $child_line_item) { |
|
69 | + $this->display_line_item($child_line_item, $options); |
|
70 | 70 | } |
71 | 71 | break; |
72 | 72 | |
73 | 73 | |
74 | 74 | case EEM_Line_Item::type_sub_line_item: |
75 | - $html .= $this->_sub_item_row( $line_item, $options ); |
|
75 | + $html .= $this->_sub_item_row($line_item, $options); |
|
76 | 76 | break; |
77 | 77 | |
78 | 78 | |
79 | 79 | case EEM_Line_Item::type_tax: |
80 | - $html .= $this->_tax_row( $line_item, $options ); |
|
80 | + $html .= $this->_tax_row($line_item, $options); |
|
81 | 81 | break; |
82 | 82 | |
83 | 83 | } |
@@ -94,21 +94,21 @@ discard block |
||
94 | 94 | * @param array $options |
95 | 95 | * @return mixed |
96 | 96 | */ |
97 | - private function _item_row( EE_Line_Item $line_item, $options = array() ) { |
|
97 | + private function _item_row(EE_Line_Item $line_item, $options = array()) { |
|
98 | 98 | // start of row |
99 | 99 | $row_class = $options['odd'] ? 'item odd' : 'item'; |
100 | - $html = EEH_HTML::tr( '', $row_class ); |
|
100 | + $html = EEH_HTML::tr('', $row_class); |
|
101 | 101 | // name td |
102 | - $html .= EEH_HTML::td( $line_item->name(), '', 'item_l' ); |
|
102 | + $html .= EEH_HTML::td($line_item->name(), '', 'item_l'); |
|
103 | 103 | // desc td |
104 | - $html .= $options['show_desc'] ? EEH_HTML::td( $line_item->desc(), '', 'item_l' ) : ''; |
|
104 | + $html .= $options['show_desc'] ? EEH_HTML::td($line_item->desc(), '', 'item_l') : ''; |
|
105 | 105 | // quantity td |
106 | - $html .= EEH_HTML::td( $line_item->quantity(), '', 'item_l' ); |
|
106 | + $html .= EEH_HTML::td($line_item->quantity(), '', 'item_l'); |
|
107 | 107 | // price td |
108 | - $html .= EEH_HTML::td( $line_item->unit_price_no_code(), '', 'item_c' ); |
|
108 | + $html .= EEH_HTML::td($line_item->unit_price_no_code(), '', 'item_c'); |
|
109 | 109 | // total td |
110 | - $total = $line_item->is_taxable() ? $line_item->total_no_code() . '*' : $line_item->total_no_code(); |
|
111 | - $html .= EEH_HTML::td( $total, '', 'item_r' ); |
|
110 | + $total = $line_item->is_taxable() ? $line_item->total_no_code().'*' : $line_item->total_no_code(); |
|
111 | + $html .= EEH_HTML::td($total, '', 'item_r'); |
|
112 | 112 | // end of row |
113 | 113 | $html .= EEH_HTML::trx(); |
114 | 114 | return $html; |
@@ -123,22 +123,22 @@ discard block |
||
123 | 123 | * @param array $options |
124 | 124 | * @return mixed |
125 | 125 | */ |
126 | - private function _sub_item_row( EE_Line_Item $line_item, $options = array() ) { |
|
126 | + private function _sub_item_row(EE_Line_Item $line_item, $options = array()) { |
|
127 | 127 | // start of row |
128 | - $html = EEH_HTML::tr( '', 'item sub-item-row' ); |
|
128 | + $html = EEH_HTML::tr('', 'item sub-item-row'); |
|
129 | 129 | // name td |
130 | - $html .= EEH_HTML::td( $line_item->name(), '', 'item_l sub-item' ); |
|
130 | + $html .= EEH_HTML::td($line_item->name(), '', 'item_l sub-item'); |
|
131 | 131 | // desc td |
132 | - $html .= $options['show_desc'] ? EEH_HTML::td( $line_item->desc(), '', 'item_l' ) : ''; |
|
133 | - $html .= EEH_HTML::td() . EEH_HTML::tdx(); |
|
132 | + $html .= $options['show_desc'] ? EEH_HTML::td($line_item->desc(), '', 'item_l') : ''; |
|
133 | + $html .= EEH_HTML::td().EEH_HTML::tdx(); |
|
134 | 134 | // discount/surcharge td |
135 | - if ( $line_item->is_percent() ) { |
|
136 | - $html .= EEH_HTML::td( $line_item->percent() . '%', '', 'item_c' ); |
|
135 | + if ($line_item->is_percent()) { |
|
136 | + $html .= EEH_HTML::td($line_item->percent().'%', '', 'item_c'); |
|
137 | 137 | } else { |
138 | - $html .= EEH_HTML::td( $line_item->unit_price_no_code(), '', 'item_c' ); |
|
138 | + $html .= EEH_HTML::td($line_item->unit_price_no_code(), '', 'item_c'); |
|
139 | 139 | } |
140 | 140 | // total td |
141 | - $html .= EEH_HTML::td( $line_item->total_no_code(), '', 'item_r' ); |
|
141 | + $html .= EEH_HTML::td($line_item->total_no_code(), '', 'item_r'); |
|
142 | 142 | // end of row |
143 | 143 | $html .= EEH_HTML::trx(); |
144 | 144 | return $html; |
@@ -153,17 +153,17 @@ discard block |
||
153 | 153 | * @param array $options |
154 | 154 | * @return mixed |
155 | 155 | */ |
156 | - private function _tax_row( EE_Line_Item $line_item, $options = array() ) { |
|
156 | + private function _tax_row(EE_Line_Item $line_item, $options = array()) { |
|
157 | 157 | // start of row |
158 | - $html = EEH_HTML::tr( '', 'item sub-item tax-total' ); |
|
158 | + $html = EEH_HTML::tr('', 'item sub-item tax-total'); |
|
159 | 159 | // name td |
160 | - $html .= EEH_HTML::td( $line_item->name(), '', 'item_l sub-item' ); |
|
160 | + $html .= EEH_HTML::td($line_item->name(), '', 'item_l sub-item'); |
|
161 | 161 | // desc td |
162 | - $html .= $options['show_desc'] ? EEH_HTML::td( $line_item->desc(), '', 'item_l' ) : ''; |
|
162 | + $html .= $options['show_desc'] ? EEH_HTML::td($line_item->desc(), '', 'item_l') : ''; |
|
163 | 163 | // percent td |
164 | - $html .= EEH_HTML::td( $line_item->percent() . '%', '', 'item_c', '', ' colspan="2"' ); |
|
164 | + $html .= EEH_HTML::td($line_item->percent().'%', '', 'item_c', '', ' colspan="2"'); |
|
165 | 165 | // total td |
166 | - $html .= EEH_HTML::td( $line_item->total_no_code(), '', 'item_r' ); |
|
166 | + $html .= EEH_HTML::td($line_item->total_no_code(), '', 'item_r'); |
|
167 | 167 | // end of row |
168 | 168 | $html .= EEH_HTML::trx(); |
169 | 169 | return $html; |
@@ -179,17 +179,17 @@ discard block |
||
179 | 179 | * @param array $options |
180 | 180 | * @return mixed |
181 | 181 | */ |
182 | - private function _total_row( EE_Line_Item $line_item, $text = '', $options = array() ) { |
|
182 | + private function _total_row(EE_Line_Item $line_item, $text = '', $options = array()) { |
|
183 | 183 | // colspan |
184 | 184 | $colspan = $options['show_desc'] ? ' colspan="2"' : ''; |
185 | 185 | // start of row |
186 | - $html = EEH_HTML::tr( '', '', 'total_tr odd' ); |
|
186 | + $html = EEH_HTML::tr('', '', 'total_tr odd'); |
|
187 | 187 | // empty td |
188 | - $html .= EEH_HTML::td( EEH_HTML::nbsp(), '', '', '', $colspan ); |
|
188 | + $html .= EEH_HTML::td(EEH_HTML::nbsp(), '', '', '', $colspan); |
|
189 | 189 | // total td |
190 | - $html .= EEH_HTML::td( $text, '', 'total_currency total', '', $colspan ); |
|
190 | + $html .= EEH_HTML::td($text, '', 'total_currency total', '', $colspan); |
|
191 | 191 | // total td |
192 | - $html .= EEH_HTML::td( $line_item->total_no_code(), '', 'total' ); |
|
192 | + $html .= EEH_HTML::td($line_item->total_no_code(), '', 'total'); |
|
193 | 193 | // end of row |
194 | 194 | $html .= EEH_HTML::trx(); |
195 | 195 | return $html; |
@@ -203,11 +203,11 @@ discard block |
||
203 | 203 | * @param array $options |
204 | 204 | * @return mixed |
205 | 205 | */ |
206 | - private function _separator_row( $options = array() ) { |
|
206 | + private function _separator_row($options = array()) { |
|
207 | 207 | // colspan |
208 | 208 | $colspan = $options['show_desc'] ? ' colspan="5"' : ' colspan="4"'; |
209 | 209 | // start of row |
210 | - $html = EEH_HTML::tr( EEH_HTML::td( '<hr>', '', '', '', $colspan )); |
|
210 | + $html = EEH_HTML::tr(EEH_HTML::td('<hr>', '', '', '', $colspan)); |
|
211 | 211 | // // separator td |
212 | 212 | // $html .= EEH_HTML::td( '<hr>', '', '', '', $colspan ); |
213 | 213 | // // end of row |
@@ -49,7 +49,7 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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() : __( '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() : __('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() . '<br />' : ''; |
|
198 | + $type_html = $line_item->OBJ_type() ? $line_item->OBJ_type().'<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 |
||
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 |
||
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 |
||
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 |
||
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; |
@@ -19,8 +19,8 @@ discard block |
||
19 | 19 | use EventEspressoBatchRequest\Helpers\JobParameters; |
20 | 20 | use EventEspressoBatchRequest\Helpers\JobStepResponse; |
21 | 21 | |
22 | -if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) { |
|
23 | - exit( 'No direct script access allowed' ); |
|
22 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
23 | + exit('No direct script access allowed'); |
|
24 | 24 | } |
25 | 25 | |
26 | 26 | |
@@ -35,35 +35,35 @@ discard block |
||
35 | 35 | * @throws BatchRequestException |
36 | 36 | * @return JobStepResponse |
37 | 37 | */ |
38 | - public function create_job( JobParameters $job_parameters ) { |
|
39 | - $event_id = intval( $job_parameters->request_datum( 'EVT_ID', '0' ) ); |
|
40 | - if( ! \EE_Capabilities::instance()->current_user_can( 'ee_read_registrations', 'generating_report' ) ) { |
|
38 | + public function create_job(JobParameters $job_parameters) { |
|
39 | + $event_id = intval($job_parameters->request_datum('EVT_ID', '0')); |
|
40 | + if ( ! \EE_Capabilities::instance()->current_user_can('ee_read_registrations', 'generating_report')) { |
|
41 | 41 | throw new BatchRequestException( |
42 | - __( 'You do not have permission to view registrations', 'event_espresso') |
|
42 | + __('You do not have permission to view registrations', 'event_espresso') |
|
43 | 43 | ); |
44 | 44 | } |
45 | 45 | $filepath = $this->create_file_from_job_with_name( |
46 | 46 | $job_parameters->job_id(), |
47 | - $this->get_filename_from_event( $event_id ) |
|
47 | + $this->get_filename_from_event($event_id) |
|
48 | 48 | ); |
49 | - $job_parameters->add_extra_data( 'filepath', $filepath ); |
|
50 | - $question_data_for_columns = $this->_get_questions_for_report( $event_id ); |
|
51 | - $job_parameters->add_extra_data( 'questions_data', $question_data_for_columns ); |
|
52 | - $job_parameters->set_job_size( $this->count_units_to_process( $event_id ) ); |
|
49 | + $job_parameters->add_extra_data('filepath', $filepath); |
|
50 | + $question_data_for_columns = $this->_get_questions_for_report($event_id); |
|
51 | + $job_parameters->add_extra_data('questions_data', $question_data_for_columns); |
|
52 | + $job_parameters->set_job_size($this->count_units_to_process($event_id)); |
|
53 | 53 | //we should also set the header columns |
54 | 54 | $csv_data_for_row = $this->get_csv_data_for( |
55 | 55 | $event_id, |
56 | 56 | 0, |
57 | 57 | 1, |
58 | - $job_parameters->extra_datum( 'questions_data' ) ); |
|
59 | - \EEH_Export::write_data_array_to_csv( $filepath, $csv_data_for_row, true ); |
|
58 | + $job_parameters->extra_datum('questions_data') ); |
|
59 | + \EEH_Export::write_data_array_to_csv($filepath, $csv_data_for_row, true); |
|
60 | 60 | //if we actually processed a row there, record it |
61 | - if( $job_parameters->job_size() ) { |
|
62 | - $job_parameters->mark_processed( 1 ); |
|
61 | + if ($job_parameters->job_size()) { |
|
62 | + $job_parameters->mark_processed(1); |
|
63 | 63 | } |
64 | 64 | return new JobStepResponse( |
65 | 65 | $job_parameters, |
66 | - __( 'Registrations report started successfully...', 'event_espresso' ) |
|
66 | + __('Registrations report started successfully...', 'event_espresso') |
|
67 | 67 | ); |
68 | 68 | } |
69 | 69 | |
@@ -74,16 +74,16 @@ discard block |
||
74 | 74 | * @param int $event_id |
75 | 75 | * @return string |
76 | 76 | */ |
77 | - protected function get_filename_from_event( $event_id ) { |
|
78 | - if( $event_id ){ |
|
79 | - $event_slug = \EEM_Event::instance()->get_var( array( array( 'EVT_ID' => $event_id ) ), 'EVT_slug' ); |
|
80 | - if( ! $event_slug ) { |
|
81 | - $event_slug = __( 'unknown', 'event_espresso' ); |
|
77 | + protected function get_filename_from_event($event_id) { |
|
78 | + if ($event_id) { |
|
79 | + $event_slug = \EEM_Event::instance()->get_var(array(array('EVT_ID' => $event_id)), 'EVT_slug'); |
|
80 | + if ( ! $event_slug) { |
|
81 | + $event_slug = __('unknown', 'event_espresso'); |
|
82 | 82 | } |
83 | - }else{ |
|
84 | - $event_slug = __( 'all', 'event_espresso' ); |
|
83 | + } else { |
|
84 | + $event_slug = __('all', 'event_espresso'); |
|
85 | 85 | } |
86 | - return sprintf( "registrations-for-%s.csv", $event_slug ); |
|
86 | + return sprintf("registrations-for-%s.csv", $event_slug); |
|
87 | 87 | } |
88 | 88 | |
89 | 89 | /** |
@@ -92,17 +92,17 @@ discard block |
||
92 | 92 | * @param int|null $event_id |
93 | 93 | * @return array of wpdb results for questions which are to be used for this report |
94 | 94 | */ |
95 | - protected function _get_questions_for_report( $event_id ) { |
|
95 | + protected function _get_questions_for_report($event_id) { |
|
96 | 96 | $question_query_params = array( |
97 | 97 | array( |
98 | - 'Answer.ANS_ID' => array( 'IS_NOT_NULL' ), |
|
98 | + 'Answer.ANS_ID' => array('IS_NOT_NULL'), |
|
99 | 99 | ), |
100 | - 'group_by' => array( 'QST_ID' ) |
|
100 | + 'group_by' => array('QST_ID') |
|
101 | 101 | ); |
102 | - if( $event_id ) { |
|
102 | + if ($event_id) { |
|
103 | 103 | $question_query_params[0]['Answer.Registration.EVT_ID'] = $event_id; |
104 | 104 | } |
105 | - return \EEM_Question::instance()->get_all_wpdb_results( $question_query_params ); |
|
105 | + return \EEM_Question::instance()->get_all_wpdb_results($question_query_params); |
|
106 | 106 | } |
107 | 107 | |
108 | 108 | |
@@ -115,27 +115,27 @@ discard block |
||
115 | 115 | * @return JobStepResponse |
116 | 116 | * @throws \EE_Error |
117 | 117 | */ |
118 | - public function continue_job( JobParameters $job_parameters, $batch_size = 50 ) { |
|
118 | + public function continue_job(JobParameters $job_parameters, $batch_size = 50) { |
|
119 | 119 | $csv_data = $this->get_csv_data_for( |
120 | - $job_parameters->request_datum( 'EVT_ID', '0'), |
|
120 | + $job_parameters->request_datum('EVT_ID', '0'), |
|
121 | 121 | $job_parameters->units_processed(), |
122 | 122 | $batch_size, |
123 | - $job_parameters->extra_datum( 'questions_data' ) ); |
|
124 | - \EEH_Export::write_data_array_to_csv( $job_parameters->extra_datum( 'filepath' ), $csv_data, false ); |
|
125 | - $units_processed = count( $csv_data ); |
|
126 | - $job_parameters->mark_processed( $units_processed ); |
|
123 | + $job_parameters->extra_datum('questions_data') ); |
|
124 | + \EEH_Export::write_data_array_to_csv($job_parameters->extra_datum('filepath'), $csv_data, false); |
|
125 | + $units_processed = count($csv_data); |
|
126 | + $job_parameters->mark_processed($units_processed); |
|
127 | 127 | $extra_response_data = array( |
128 | 128 | 'file_url' => '' |
129 | 129 | ); |
130 | - if( $units_processed < $batch_size ) { |
|
131 | - $job_parameters->set_status( JobParameters::status_complete ); |
|
132 | - $extra_response_data[ 'file_url' ] = $this->get_url_to_file( $job_parameters->extra_datum( 'filepath' ) ); |
|
130 | + if ($units_processed < $batch_size) { |
|
131 | + $job_parameters->set_status(JobParameters::status_complete); |
|
132 | + $extra_response_data['file_url'] = $this->get_url_to_file($job_parameters->extra_datum('filepath')); |
|
133 | 133 | } |
134 | 134 | return new JobStepResponse( |
135 | 135 | $job_parameters, |
136 | 136 | sprintf( |
137 | - __( 'Wrote %1$s rows to report CSV file...', 'event_espresso' ), |
|
138 | - count( $csv_data ) ), |
|
137 | + __('Wrote %1$s rows to report CSV file...', 'event_espresso'), |
|
138 | + count($csv_data) ), |
|
139 | 139 | $extra_response_data ); |
140 | 140 | } |
141 | 141 | |
@@ -148,7 +148,7 @@ discard block |
||
148 | 148 | * @return array top-level keys are numeric, next-level keys are column headers |
149 | 149 | * |
150 | 150 | */ |
151 | - function get_csv_data_for( $event_id, $offset, $limit, $questions_for_these_regs_rows ) { |
|
151 | + function get_csv_data_for($event_id, $offset, $limit, $questions_for_these_regs_rows) { |
|
152 | 152 | $reg_fields_to_include = array( |
153 | 153 | 'TXN_ID', |
154 | 154 | 'ATT_ID', |
@@ -179,165 +179,165 @@ discard block |
||
179 | 179 | array( |
180 | 180 | 'OR' => array( |
181 | 181 | //don't include registrations from failed or abandoned transactions... |
182 | - 'Transaction.STS_ID' => array( 'NOT IN', array( \EEM_Transaction::failed_status_code, \EEM_Transaction::abandoned_status_code ) ), |
|
182 | + 'Transaction.STS_ID' => array('NOT IN', array(\EEM_Transaction::failed_status_code, \EEM_Transaction::abandoned_status_code)), |
|
183 | 183 | //unless the registration is approved, in which case include it regardless of transaction status |
184 | 184 | 'STS_ID' => \EEM_Registration::status_id_approved |
185 | 185 | ), |
186 | - 'Ticket.TKT_deleted' => array( 'IN', array( true, false ) ) |
|
186 | + 'Ticket.TKT_deleted' => array('IN', array(true, false)) |
|
187 | 187 | ), |
188 | - 'order_by' => array('Transaction.TXN_ID'=>'asc','REG_count'=>'asc'), |
|
189 | - 'force_join' => array( 'Transaction', 'Ticket', 'Attendee' ), |
|
190 | - 'limit' => array( $offset, $limit ), |
|
188 | + 'order_by' => array('Transaction.TXN_ID'=>'asc', 'REG_count'=>'asc'), |
|
189 | + 'force_join' => array('Transaction', 'Ticket', 'Attendee'), |
|
190 | + 'limit' => array($offset, $limit), |
|
191 | 191 | ), |
192 | 192 | $event_id |
193 | 193 | ); |
194 | - if( $event_id ){ |
|
195 | - $query_params[0]['EVT_ID'] = $event_id; |
|
196 | - }else{ |
|
197 | - $query_params[ 'force_join' ][] = 'Event'; |
|
194 | + if ($event_id) { |
|
195 | + $query_params[0]['EVT_ID'] = $event_id; |
|
196 | + } else { |
|
197 | + $query_params['force_join'][] = 'Event'; |
|
198 | 198 | } |
199 | - $registration_rows = $reg_model->get_all_wpdb_results( $query_params ); |
|
199 | + $registration_rows = $reg_model->get_all_wpdb_results($query_params); |
|
200 | 200 | //get all questions which relate to someone in this group |
201 | 201 | $registration_ids = array(); |
202 | - foreach( $registration_rows as $reg_row ) { |
|
203 | - $registration_ids[] = intval( $reg_row[ 'Registration.REG_ID'] ); |
|
202 | + foreach ($registration_rows as $reg_row) { |
|
203 | + $registration_ids[] = intval($reg_row['Registration.REG_ID']); |
|
204 | 204 | } |
205 | 205 | |
206 | - foreach($registration_rows as $reg_row){ |
|
207 | - if ( is_array( $reg_row ) ) { |
|
206 | + foreach ($registration_rows as $reg_row) { |
|
207 | + if (is_array($reg_row)) { |
|
208 | 208 | $reg_csv_array = array(); |
209 | - if( ! $event_id ){ |
|
209 | + if ( ! $event_id) { |
|
210 | 210 | //get the event's name and Id |
211 | - $reg_csv_array[ __( 'Event', 'event_espresso' ) ] = sprintf( __( '%1$s (%2$s)', 'event_espresso' ), \EEH_Export::prepare_value_from_db_for_display( \EEM_Event::instance(), 'EVT_name', $reg_row[ 'Event_CPT.post_title'] ), $reg_row[ 'Event_CPT.ID' ] ); |
|
211 | + $reg_csv_array[__('Event', 'event_espresso')] = sprintf(__('%1$s (%2$s)', 'event_espresso'), \EEH_Export::prepare_value_from_db_for_display(\EEM_Event::instance(), 'EVT_name', $reg_row['Event_CPT.post_title']), $reg_row['Event_CPT.ID']); |
|
212 | 212 | } |
213 | - $is_primary_reg = $reg_row[ 'Registration.REG_count' ] == '1' ? true : false; |
|
213 | + $is_primary_reg = $reg_row['Registration.REG_count'] == '1' ? true : false; |
|
214 | 214 | /*@var $reg_row EE_Registration */ |
215 | - foreach($reg_fields_to_include as $field_name){ |
|
215 | + foreach ($reg_fields_to_include as $field_name) { |
|
216 | 216 | $field = $reg_model->field_settings_for($field_name); |
217 | - if($field_name == 'REG_final_price'){ |
|
218 | - $value = \EEH_Export::prepare_value_from_db_for_display( $reg_model, $field_name, $reg_row[ 'Registration.REG_final_price'], 'localized_float' ); |
|
219 | - }elseif( $field_name == 'REG_count' ){ |
|
220 | - $value = sprintf( __( '%s of %s', 'event_espresso' ), \EEH_Export::prepare_value_from_db_for_display( $reg_model, 'REG_count', $reg_row['Registration.REG_count'] ), \EEH_Export::prepare_value_from_db_for_display( $reg_model, 'REG_group_size', $reg_row['Registration.REG_group_size' ] ) ); |
|
221 | - }elseif( $field_name == 'REG_date' ) { |
|
222 | - $value = \EEH_Export::prepare_value_from_db_for_display( $reg_model, $field_name, $reg_row[ 'Registration.REG_date'], 'no_html' ); |
|
223 | - }else{ |
|
224 | - $value = \EEH_Export::prepare_value_from_db_for_display( $reg_model, $field_name, $reg_row[ $field->get_qualified_column() ] ); |
|
217 | + if ($field_name == 'REG_final_price') { |
|
218 | + $value = \EEH_Export::prepare_value_from_db_for_display($reg_model, $field_name, $reg_row['Registration.REG_final_price'], 'localized_float'); |
|
219 | + }elseif ($field_name == 'REG_count') { |
|
220 | + $value = sprintf(__('%s of %s', 'event_espresso'), \EEH_Export::prepare_value_from_db_for_display($reg_model, 'REG_count', $reg_row['Registration.REG_count']), \EEH_Export::prepare_value_from_db_for_display($reg_model, 'REG_group_size', $reg_row['Registration.REG_group_size'])); |
|
221 | + }elseif ($field_name == 'REG_date') { |
|
222 | + $value = \EEH_Export::prepare_value_from_db_for_display($reg_model, $field_name, $reg_row['Registration.REG_date'], 'no_html'); |
|
223 | + } else { |
|
224 | + $value = \EEH_Export::prepare_value_from_db_for_display($reg_model, $field_name, $reg_row[$field->get_qualified_column()]); |
|
225 | 225 | } |
226 | 226 | $reg_csv_array[\EEH_Export::get_column_name_for_field($field)] = $value; |
227 | - if($field_name == 'REG_final_price'){ |
|
227 | + if ($field_name == 'REG_final_price') { |
|
228 | 228 | //add a column named Currency after the final price |
229 | 229 | $reg_csv_array[__("Currency", "event_espresso")] = \EE_Config::instance()->currency->code; |
230 | 230 | } |
231 | 231 | } |
232 | 232 | //get pretty status |
233 | - $stati = \EEM_Status::instance()->localized_status( array( |
|
234 | - $reg_row[ 'Registration.STS_ID' ] => __( 'unknown', 'event_espresso' ), |
|
235 | - $reg_row[ 'Transaction.STS_ID' ] => __( 'unknown', 'event_espresso' ) ), |
|
233 | + $stati = \EEM_Status::instance()->localized_status(array( |
|
234 | + $reg_row['Registration.STS_ID'] => __('unknown', 'event_espresso'), |
|
235 | + $reg_row['Transaction.STS_ID'] => __('unknown', 'event_espresso') ), |
|
236 | 236 | FALSE, |
237 | - 'sentence' ); |
|
238 | - $reg_csv_array[__("Registration Status", 'event_espresso')] = $stati[ $reg_row[ 'Registration.STS_ID' ] ]; |
|
237 | + 'sentence'); |
|
238 | + $reg_csv_array[__("Registration Status", 'event_espresso')] = $stati[$reg_row['Registration.STS_ID']]; |
|
239 | 239 | //get pretty transaction status |
240 | - $reg_csv_array[__("Transaction Status", 'event_espresso')] = $stati[ $reg_row[ 'Transaction.STS_ID' ] ]; |
|
241 | - $reg_csv_array[ __( 'Transaction Amount Due', 'event_espresso' ) ] = $is_primary_reg ? \EEH_Export::prepare_value_from_db_for_display( \EEM_Transaction::instance(), 'TXN_total', $reg_row[ 'Transaction.TXN_total' ], 'localized_float' ) : '0.00'; |
|
242 | - $reg_csv_array[ __( 'Amount Paid', 'event_espresso' )] = $is_primary_reg ? \EEH_Export::prepare_value_from_db_for_display( \EEM_Transaction::instance(), 'TXN_paid', $reg_row[ 'Transaction.TXN_paid' ], 'localized_float' ) : '0.00'; |
|
240 | + $reg_csv_array[__("Transaction Status", 'event_espresso')] = $stati[$reg_row['Transaction.STS_ID']]; |
|
241 | + $reg_csv_array[__('Transaction Amount Due', 'event_espresso')] = $is_primary_reg ? \EEH_Export::prepare_value_from_db_for_display(\EEM_Transaction::instance(), 'TXN_total', $reg_row['Transaction.TXN_total'], 'localized_float') : '0.00'; |
|
242 | + $reg_csv_array[__('Amount Paid', 'event_espresso')] = $is_primary_reg ? \EEH_Export::prepare_value_from_db_for_display(\EEM_Transaction::instance(), 'TXN_paid', $reg_row['Transaction.TXN_paid'], 'localized_float') : '0.00'; |
|
243 | 243 | $payment_methods = array(); |
244 | 244 | $gateway_txn_ids_etc = array(); |
245 | 245 | $payment_times = array(); |
246 | - if( $is_primary_reg && $reg_row[ 'Transaction.TXN_ID' ] ){ |
|
246 | + if ($is_primary_reg && $reg_row['Transaction.TXN_ID']) { |
|
247 | 247 | $payments_info = \EEM_Payment::instance()->get_all_wpdb_results( |
248 | 248 | array( |
249 | 249 | array( |
250 | - 'TXN_ID' => $reg_row[ 'Transaction.TXN_ID' ], |
|
250 | + 'TXN_ID' => $reg_row['Transaction.TXN_ID'], |
|
251 | 251 | 'STS_ID' => \EEM_Payment::status_id_approved |
252 | 252 | ), |
253 | - 'force_join' => array( 'Payment_Method' ), |
|
253 | + 'force_join' => array('Payment_Method'), |
|
254 | 254 | |
255 | 255 | ), |
256 | 256 | ARRAY_A, |
257 | 257 | 'Payment_Method.PMD_admin_name as name, Payment.PAY_txn_id_chq_nmbr as gateway_txn_id, Payment.PAY_timestamp as payment_time' ); |
258 | 258 | |
259 | - foreach( $payments_info as $payment_method_and_gateway_txn_id ){ |
|
260 | - $payment_methods[] = isset( $payment_method_and_gateway_txn_id[ 'name' ] ) ? $payment_method_and_gateway_txn_id[ 'name' ] : __( 'Unknown', 'event_espresso' ); |
|
261 | - $gateway_txn_ids_etc[] = isset( $payment_method_and_gateway_txn_id[ 'gateway_txn_id' ] ) ? $payment_method_and_gateway_txn_id[ 'gateway_txn_id' ] : ''; |
|
262 | - $payment_times[] = isset( $payment_method_and_gateway_txn_id[ 'payment_time' ] ) ? $payment_method_and_gateway_txn_id[ 'payment_time' ] : ''; |
|
259 | + foreach ($payments_info as $payment_method_and_gateway_txn_id) { |
|
260 | + $payment_methods[] = isset($payment_method_and_gateway_txn_id['name']) ? $payment_method_and_gateway_txn_id['name'] : __('Unknown', 'event_espresso'); |
|
261 | + $gateway_txn_ids_etc[] = isset($payment_method_and_gateway_txn_id['gateway_txn_id']) ? $payment_method_and_gateway_txn_id['gateway_txn_id'] : ''; |
|
262 | + $payment_times[] = isset($payment_method_and_gateway_txn_id['payment_time']) ? $payment_method_and_gateway_txn_id['payment_time'] : ''; |
|
263 | 263 | } |
264 | 264 | |
265 | 265 | } |
266 | - $reg_csv_array[ __( 'Payment Date(s)', 'event_espresso' ) ] = implode( ',', $payment_times ); |
|
267 | - $reg_csv_array[ __( 'Payment Method(s)', 'event_espresso' ) ] = implode( ",", $payment_methods ); |
|
268 | - $reg_csv_array[ __( 'Gateway Transaction ID(s)', 'event_espresso' )] = implode( ',', $gateway_txn_ids_etc ); |
|
266 | + $reg_csv_array[__('Payment Date(s)', 'event_espresso')] = implode(',', $payment_times); |
|
267 | + $reg_csv_array[__('Payment Method(s)', 'event_espresso')] = implode(",", $payment_methods); |
|
268 | + $reg_csv_array[__('Gateway Transaction ID(s)', 'event_espresso')] = implode(',', $gateway_txn_ids_etc); |
|
269 | 269 | |
270 | 270 | //get whether or not the user has checked in |
271 | - $reg_csv_array[__("Check-Ins", "event_espresso")] = $reg_model->count_related( $reg_row[ 'Registration.REG_ID'] , 'Checkin' ); |
|
271 | + $reg_csv_array[__("Check-Ins", "event_espresso")] = $reg_model->count_related($reg_row['Registration.REG_ID'], 'Checkin'); |
|
272 | 272 | //get ticket of registration and its price |
273 | 273 | $ticket_model = \EE_Registry::instance()->load_model('Ticket'); |
274 | - if( $reg_row[ 'Ticket.TKT_ID'] ) { |
|
275 | - $ticket_name = \EEH_Export::prepare_value_from_db_for_display( $ticket_model, 'TKT_name', $reg_row[ 'Ticket.TKT_name' ] ); |
|
274 | + if ($reg_row['Ticket.TKT_ID']) { |
|
275 | + $ticket_name = \EEH_Export::prepare_value_from_db_for_display($ticket_model, 'TKT_name', $reg_row['Ticket.TKT_name']); |
|
276 | 276 | $datetimes_strings = array(); |
277 | - foreach( \EEM_Datetime::instance()->get_all_wpdb_results( array( array( 'Ticket.TKT_ID' => $reg_row[ 'Ticket.TKT_ID' ] ), 'order_by' => array( 'DTT_EVT_start' => 'ASC' ), 'default_where_conditions' => 'none' ) ) as $datetime){ |
|
278 | - $datetimes_strings[] = \EEH_Export::prepare_value_from_db_for_display( \EEM_Datetime::instance(), 'DTT_EVT_start', $datetime[ 'Datetime.DTT_EVT_start'] ); |
|
277 | + foreach (\EEM_Datetime::instance()->get_all_wpdb_results(array(array('Ticket.TKT_ID' => $reg_row['Ticket.TKT_ID']), 'order_by' => array('DTT_EVT_start' => 'ASC'), 'default_where_conditions' => 'none')) as $datetime) { |
|
278 | + $datetimes_strings[] = \EEH_Export::prepare_value_from_db_for_display(\EEM_Datetime::instance(), 'DTT_EVT_start', $datetime['Datetime.DTT_EVT_start']); |
|
279 | 279 | } |
280 | 280 | |
281 | 281 | } else { |
282 | - $ticket_name = __( 'Unknown', 'event_espresso' ); |
|
283 | - $datetimes_strings = array( __( 'Unknown', 'event_espresso' ) ); |
|
282 | + $ticket_name = __('Unknown', 'event_espresso'); |
|
283 | + $datetimes_strings = array(__('Unknown', 'event_espresso')); |
|
284 | 284 | } |
285 | 285 | $reg_csv_array[$ticket_model->field_settings_for('TKT_name')->get_nicename()] = $ticket_name; |
286 | 286 | $reg_csv_array[__("Datetimes of Ticket", "event_espresso")] = implode(", ", $datetimes_strings); |
287 | 287 | //get datetime(s) of registration |
288 | 288 | |
289 | 289 | //add attendee columns |
290 | - foreach($att_fields_to_include as $att_field_name){ |
|
290 | + foreach ($att_fields_to_include as $att_field_name) { |
|
291 | 291 | $field_obj = \EEM_Attendee::instance()->field_settings_for($att_field_name); |
292 | - if( $reg_row[ 'Attendee_CPT.ID' ]){ |
|
293 | - if($att_field_name == 'STA_ID'){ |
|
294 | - $value = \EEM_State::instance()->get_var( array( array( 'STA_ID' => $reg_row[ 'Attendee_Meta.STA_ID' ] ) ), 'STA_name' ); |
|
295 | - }elseif($att_field_name == 'CNT_ISO'){ |
|
296 | - $value = \EEM_Country::instance()->get_var( array( array( 'CNT_ISO' => $reg_row[ 'Attendee_Meta.CNT_ISO' ] ) ), 'CNT_name' ); |
|
297 | - }else{ |
|
298 | - $value = \EEH_Export::prepare_value_from_db_for_display( \EEM_Attendee::instance(), $att_field_name, $reg_row[ $field_obj->get_qualified_column() ] ); |
|
292 | + if ($reg_row['Attendee_CPT.ID']) { |
|
293 | + if ($att_field_name == 'STA_ID') { |
|
294 | + $value = \EEM_State::instance()->get_var(array(array('STA_ID' => $reg_row['Attendee_Meta.STA_ID'])), 'STA_name'); |
|
295 | + }elseif ($att_field_name == 'CNT_ISO') { |
|
296 | + $value = \EEM_Country::instance()->get_var(array(array('CNT_ISO' => $reg_row['Attendee_Meta.CNT_ISO'])), 'CNT_name'); |
|
297 | + } else { |
|
298 | + $value = \EEH_Export::prepare_value_from_db_for_display(\EEM_Attendee::instance(), $att_field_name, $reg_row[$field_obj->get_qualified_column()]); |
|
299 | 299 | } |
300 | - }else{ |
|
300 | + } else { |
|
301 | 301 | $value = ''; |
302 | 302 | } |
303 | 303 | |
304 | - $reg_csv_array[ \EEH_Export::get_column_name_for_field($field_obj) ] = $value; |
|
304 | + $reg_csv_array[\EEH_Export::get_column_name_for_field($field_obj)] = $value; |
|
305 | 305 | } |
306 | 306 | |
307 | 307 | //make sure each registration has the same questions in the same order |
308 | - foreach($questions_for_these_regs_rows as $question_row){ |
|
309 | - if( ! isset($reg_csv_array[$question_row[ 'Question.QST_admin_label']])){ |
|
310 | - $reg_csv_array[$question_row[ 'Question.QST_admin_label' ] ] = null; |
|
308 | + foreach ($questions_for_these_regs_rows as $question_row) { |
|
309 | + if ( ! isset($reg_csv_array[$question_row['Question.QST_admin_label']])) { |
|
310 | + $reg_csv_array[$question_row['Question.QST_admin_label']] = null; |
|
311 | 311 | } |
312 | 312 | } |
313 | 313 | $answers = \EEM_Answer::instance()->get_all_wpdb_results( |
314 | 314 | array( |
315 | - array( 'REG_ID' => $reg_row[ 'Registration.REG_ID' ] ), |
|
316 | - 'force_join' => array( 'Question' ) |
|
315 | + array('REG_ID' => $reg_row['Registration.REG_ID']), |
|
316 | + 'force_join' => array('Question') |
|
317 | 317 | ) |
318 | 318 | ); |
319 | 319 | //now fill out the questions THEY answered |
320 | - foreach( $answers as $answer_row ){ |
|
321 | - if( $answer_row[ 'Question.QST_ID' ] ){ |
|
320 | + foreach ($answers as $answer_row) { |
|
321 | + if ($answer_row['Question.QST_ID']) { |
|
322 | 322 | $question_label = \EEH_Export::prepare_value_from_db_for_display( |
323 | 323 | \EEM_Question::instance(), |
324 | 324 | 'QST_admin_label', |
325 | - $answer_row[ 'Question.QST_admin_label' ] |
|
325 | + $answer_row['Question.QST_admin_label'] |
|
326 | 326 | ); |
327 | 327 | } else { |
328 | - $question_label = sprintf( __( 'Question $s', 'event_espresso' ), $answer_row[ 'Answer.QST_ID' ] ); |
|
328 | + $question_label = sprintf(__('Question $s', 'event_espresso'), $answer_row['Answer.QST_ID']); |
|
329 | 329 | } |
330 | - if ( isset( $answer_row[ 'Question.QST_type' ] ) |
|
331 | - && $answer_row[ 'Question.QST_type' ] == \EEM_Question::QST_type_state |
|
330 | + if (isset($answer_row['Question.QST_type']) |
|
331 | + && $answer_row['Question.QST_type'] == \EEM_Question::QST_type_state |
|
332 | 332 | ) { |
333 | - $reg_csv_array[ $question_label ] = \EEM_State::instance()->get_state_name_by_ID( |
|
334 | - $answer_row[ 'Answer.ANS_value' ] |
|
333 | + $reg_csv_array[$question_label] = \EEM_State::instance()->get_state_name_by_ID( |
|
334 | + $answer_row['Answer.ANS_value'] |
|
335 | 335 | ); |
336 | 336 | } else { |
337 | - $reg_csv_array[ $question_label ] = \EEH_Export::prepare_value_from_db_for_display( |
|
337 | + $reg_csv_array[$question_label] = \EEH_Export::prepare_value_from_db_for_display( |
|
338 | 338 | \EEM_Answer::instance(), |
339 | 339 | 'ANS_value', |
340 | - $answer_row[ 'Answer.ANS_value' ] |
|
340 | + $answer_row['Answer.ANS_value'] |
|
341 | 341 | ); |
342 | 342 | } |
343 | 343 | } |
@@ -348,17 +348,17 @@ discard block |
||
348 | 348 | } |
349 | 349 | } |
350 | 350 | //if we couldn't export anything, we want to at least show the column headers |
351 | - if ( empty( $registrations_csv_ready_array ) ) { |
|
351 | + if (empty($registrations_csv_ready_array)) { |
|
352 | 352 | $reg_csv_array = array(); |
353 | 353 | $model_and_fields_to_include = array( |
354 | 354 | 'Registration' => $reg_fields_to_include, |
355 | 355 | 'Attendee' => $att_fields_to_include |
356 | 356 | ); |
357 | - foreach ( $model_and_fields_to_include as $model_name => $field_list ) { |
|
358 | - $model = \EE_Registry::instance()->load_model( $model_name ); |
|
359 | - foreach ( $field_list as $field_name ) { |
|
360 | - $field = $model->field_settings_for( $field_name ); |
|
361 | - $reg_csv_array[ \EEH_Export::get_column_name_for_field( $field ) ] = null; |
|
357 | + foreach ($model_and_fields_to_include as $model_name => $field_list) { |
|
358 | + $model = \EE_Registry::instance()->load_model($model_name); |
|
359 | + foreach ($field_list as $field_name) { |
|
360 | + $field = $model->field_settings_for($field_name); |
|
361 | + $reg_csv_array[\EEH_Export::get_column_name_for_field($field)] = null; |
|
362 | 362 | } |
363 | 363 | } |
364 | 364 | $registrations_csv_ready_array[] = $reg_csv_array; |
@@ -374,7 +374,7 @@ discard block |
||
374 | 374 | * @param int $event_id |
375 | 375 | * @return int |
376 | 376 | */ |
377 | - public function count_units_to_process( $event_id ) { |
|
377 | + public function count_units_to_process($event_id) { |
|
378 | 378 | //use the legacy filter |
379 | 379 | $query_params = apply_filters( |
380 | 380 | 'FHEE__EE_Export__report_registration_for_event', |
@@ -382,23 +382,23 @@ discard block |
||
382 | 382 | array( |
383 | 383 | 'OR' => array( |
384 | 384 | //don't include registrations from failed or abandoned transactions... |
385 | - 'Transaction.STS_ID' => array( 'NOT IN', array( \EEM_Transaction::failed_status_code, \EEM_Transaction::abandoned_status_code ) ), |
|
385 | + 'Transaction.STS_ID' => array('NOT IN', array(\EEM_Transaction::failed_status_code, \EEM_Transaction::abandoned_status_code)), |
|
386 | 386 | //unless the registration is approved, in which case include it regardless of transaction status |
387 | 387 | 'STS_ID' => \EEM_Registration::status_id_approved |
388 | 388 | ), |
389 | - 'Ticket.TKT_deleted' => array( 'IN', array( true, false ) ) |
|
389 | + 'Ticket.TKT_deleted' => array('IN', array(true, false)) |
|
390 | 390 | ), |
391 | - 'order_by' => array('Transaction.TXN_ID'=>'asc','REG_count'=>'asc'), |
|
392 | - 'force_join' => array( 'Transaction', 'Ticket', 'Attendee' ) |
|
391 | + 'order_by' => array('Transaction.TXN_ID'=>'asc', 'REG_count'=>'asc'), |
|
392 | + 'force_join' => array('Transaction', 'Ticket', 'Attendee') |
|
393 | 393 | ), |
394 | 394 | $event_id |
395 | 395 | ); |
396 | - if( $event_id ){ |
|
397 | - $query_params[0]['EVT_ID'] = $event_id; |
|
396 | + if ($event_id) { |
|
397 | + $query_params[0]['EVT_ID'] = $event_id; |
|
398 | 398 | } else { |
399 | - $query_params[ 'force_join' ][] = 'Event'; |
|
399 | + $query_params['force_join'][] = 'Event'; |
|
400 | 400 | } |
401 | - return \EEM_Registration::instance()->count( $query_params ); |
|
401 | + return \EEM_Registration::instance()->count($query_params); |
|
402 | 402 | } |
403 | 403 | |
404 | 404 | |
@@ -409,13 +409,13 @@ discard block |
||
409 | 409 | * @param JobParameters $job_parameters |
410 | 410 | * @return boolean |
411 | 411 | */ |
412 | - public function cleanup_job( JobParameters $job_parameters ){ |
|
412 | + public function cleanup_job(JobParameters $job_parameters) { |
|
413 | 413 | $this->_file_helper->delete( |
414 | - \EEH_File::remove_filename_from_filepath( $job_parameters->extra_datum( 'filepath' ) ), |
|
414 | + \EEH_File::remove_filename_from_filepath($job_parameters->extra_datum('filepath')), |
|
415 | 415 | true, |
416 | 416 | 'd' |
417 | 417 | ); |
418 | - return new JobStepResponse( $job_parameters, __( 'Cleaned up temporary file', 'event_espresso' ) ); |
|
418 | + return new JobStepResponse($job_parameters, __('Cleaned up temporary file', 'event_espresso')); |
|
419 | 419 | } |
420 | 420 | } |
421 | 421 |
@@ -18,7 +18,7 @@ discard block |
||
18 | 18 | use EventEspressoBatchRequest\Helpers\JobParameters; |
19 | 19 | use EventEspressoBatchRequest\Helpers\JobStepResponse; |
20 | 20 | |
21 | -if (!defined('EVENT_ESPRESSO_VERSION')) { |
|
21 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
22 | 22 | exit('No direct script access allowed'); |
23 | 23 | } |
24 | 24 | |
@@ -27,81 +27,81 @@ discard block |
||
27 | 27 | |
28 | 28 | |
29 | 29 | public function create_job(JobParameters $job_parameters) { |
30 | - if( ! \EE_Capabilities::instance()->current_user_can( 'ee_read_contacts', 'generating_report' ) ) { |
|
30 | + if ( ! \EE_Capabilities::instance()->current_user_can('ee_read_contacts', 'generating_report')) { |
|
31 | 31 | throw new BatchRequestException( |
32 | - __( 'You do not have permission to view contacts', 'event_espresso') |
|
32 | + __('You do not have permission to view contacts', 'event_espresso') |
|
33 | 33 | ); |
34 | 34 | } |
35 | 35 | $filepath = $this->create_file_from_job_with_name( |
36 | 36 | $job_parameters->job_id(), |
37 | 37 | __('contact-list-report.csv', 'event_espresso') |
38 | 38 | ); |
39 | - $job_parameters->add_extra_data( 'filepath', $filepath ); |
|
40 | - $job_parameters->set_job_size( $this->count_units_to_process() ); |
|
39 | + $job_parameters->add_extra_data('filepath', $filepath); |
|
40 | + $job_parameters->set_job_size($this->count_units_to_process()); |
|
41 | 41 | //we should also set the header columns |
42 | - $csv_data_for_row = $this->get_csv_data( 0, 1 ); |
|
43 | - \EEH_Export::write_data_array_to_csv( $filepath, $csv_data_for_row, true ); |
|
42 | + $csv_data_for_row = $this->get_csv_data(0, 1); |
|
43 | + \EEH_Export::write_data_array_to_csv($filepath, $csv_data_for_row, true); |
|
44 | 44 | //if we actually processed a row there, record it |
45 | - if( $job_parameters->job_size() ) { |
|
46 | - $job_parameters->mark_processed( 1 ); |
|
45 | + if ($job_parameters->job_size()) { |
|
46 | + $job_parameters->mark_processed(1); |
|
47 | 47 | } |
48 | 48 | return new JobStepResponse( |
49 | 49 | $job_parameters, |
50 | - __( 'Contacts report started successfully...', 'event_espresso' ) |
|
50 | + __('Contacts report started successfully...', 'event_espresso') |
|
51 | 51 | ); |
52 | 52 | } |
53 | 53 | |
54 | 54 | |
55 | 55 | public function continue_job(JobParameters $job_parameters, $batch_size = 50) { |
56 | - $csv_data = $this->get_csv_data( $job_parameters->units_processed(), $batch_size ); |
|
57 | - \EEH_Export::write_data_array_to_csv( $job_parameters->extra_datum( 'filepath' ), $csv_data, false ); |
|
58 | - $units_processed = count( $csv_data ); |
|
59 | - $job_parameters->mark_processed( $units_processed ); |
|
56 | + $csv_data = $this->get_csv_data($job_parameters->units_processed(), $batch_size); |
|
57 | + \EEH_Export::write_data_array_to_csv($job_parameters->extra_datum('filepath'), $csv_data, false); |
|
58 | + $units_processed = count($csv_data); |
|
59 | + $job_parameters->mark_processed($units_processed); |
|
60 | 60 | $extra_response_data = array( |
61 | 61 | 'file_url' => '' |
62 | 62 | ); |
63 | - if( $units_processed < $batch_size ) { |
|
64 | - $job_parameters->set_status( JobParameters::status_complete ); |
|
65 | - $extra_response_data[ 'file_url' ] = $this->get_url_to_file( $job_parameters->extra_datum( 'filepath' ) ); |
|
63 | + if ($units_processed < $batch_size) { |
|
64 | + $job_parameters->set_status(JobParameters::status_complete); |
|
65 | + $extra_response_data['file_url'] = $this->get_url_to_file($job_parameters->extra_datum('filepath')); |
|
66 | 66 | } |
67 | 67 | return new JobStepResponse( |
68 | 68 | $job_parameters, |
69 | 69 | sprintf( |
70 | - __( 'Wrote %1$s rows to report CSV file...', 'event_espresso' ), |
|
71 | - count( $csv_data ) ), |
|
70 | + __('Wrote %1$s rows to report CSV file...', 'event_espresso'), |
|
71 | + count($csv_data) ), |
|
72 | 72 | $extra_response_data ); |
73 | 73 | } |
74 | 74 | |
75 | 75 | |
76 | 76 | public function cleanup_job(JobParameters $job_parameters) { |
77 | 77 | $this->_file_helper->delete( |
78 | - \EEH_File::remove_filename_from_filepath( $job_parameters->extra_datum( 'filepath' ) ), |
|
78 | + \EEH_File::remove_filename_from_filepath($job_parameters->extra_datum('filepath')), |
|
79 | 79 | true, |
80 | 80 | 'd' |
81 | 81 | ); |
82 | - return new JobStepResponse( $job_parameters, __( 'Cleaned up temporary file', 'event_espresso' ) ); |
|
82 | + return new JobStepResponse($job_parameters, __('Cleaned up temporary file', 'event_espresso')); |
|
83 | 83 | } |
84 | 84 | |
85 | 85 | public function count_units_to_process() { |
86 | 86 | return \EEM_Attendee::instance()->count(); |
87 | 87 | } |
88 | - public function get_csv_data( $offset, $limit ) { |
|
88 | + public function get_csv_data($offset, $limit) { |
|
89 | 89 | $attendee_rows = \EEM_Attendee::instance()->get_all_wpdb_results( |
90 | 90 | array( |
91 | - 'limit' => array( $offset, $limit ), |
|
92 | - 'force_join' => array( 'State', 'Country' ) ) ); |
|
91 | + 'limit' => array($offset, $limit), |
|
92 | + 'force_join' => array('State', 'Country') ) ); |
|
93 | 93 | $csv_data = array(); |
94 | - foreach( $attendee_rows as $attendee_row ){ |
|
94 | + foreach ($attendee_rows as $attendee_row) { |
|
95 | 95 | $csv_row = array(); |
96 | - foreach( \EEM_Attendee::instance()->field_settings() as $field_name => $field_obj ){ |
|
97 | - if( $field_name == 'STA_ID' ){ |
|
98 | - $state_name_field = \EEM_State::instance()->field_settings_for( 'STA_name' ); |
|
99 | - $csv_row[ __( 'State', 'event_espresso' ) ] = $attendee_row[ $state_name_field->get_qualified_column() ]; |
|
100 | - }elseif( $field_name == 'CNT_ISO' ){ |
|
101 | - $country_name_field = \EEM_Country::instance()->field_settings_for( 'CNT_name' ); |
|
102 | - $csv_row[ __( 'Country', 'event_espresso' ) ] = $attendee_row[ $country_name_field->get_qualified_column() ]; |
|
103 | - }else{ |
|
104 | - $csv_row[ $field_obj->get_nicename() ] = $attendee_row[ $field_obj->get_qualified_column() ]; |
|
96 | + foreach (\EEM_Attendee::instance()->field_settings() as $field_name => $field_obj) { |
|
97 | + if ($field_name == 'STA_ID') { |
|
98 | + $state_name_field = \EEM_State::instance()->field_settings_for('STA_name'); |
|
99 | + $csv_row[__('State', 'event_espresso')] = $attendee_row[$state_name_field->get_qualified_column()]; |
|
100 | + }elseif ($field_name == 'CNT_ISO') { |
|
101 | + $country_name_field = \EEM_Country::instance()->field_settings_for('CNT_name'); |
|
102 | + $csv_row[__('Country', 'event_espresso')] = $attendee_row[$country_name_field->get_qualified_column()]; |
|
103 | + } else { |
|
104 | + $csv_row[$field_obj->get_nicename()] = $attendee_row[$field_obj->get_qualified_column()]; |
|
105 | 105 | } |
106 | 106 | } |
107 | 107 | $csv_data[] = $csv_row; |
@@ -14,7 +14,7 @@ discard block |
||
14 | 14 | * @since $VID:$ |
15 | 15 | * |
16 | 16 | */ |
17 | -abstract class EE_PMT_Base{ |
|
17 | +abstract class EE_PMT_Base { |
|
18 | 18 | |
19 | 19 | const onsite = 'on-site'; |
20 | 20 | const offsite = 'off-site'; |
@@ -95,33 +95,33 @@ discard block |
||
95 | 95 | * @return EE_PMT_Base |
96 | 96 | */ |
97 | 97 | function __construct($pm_instance = NULL) { |
98 | - if ( $pm_instance instanceof EE_Payment_Method ){ |
|
98 | + if ($pm_instance instanceof EE_Payment_Method) { |
|
99 | 99 | $this->set_instance($pm_instance); |
100 | 100 | } |
101 | 101 | $this->_set_file_folder(); |
102 | 102 | $this->_set_file_url(); |
103 | - if($this->_gateway){ |
|
104 | - $this->_gateway->set_payment_model( EEM_Payment::instance() ); |
|
105 | - $this->_gateway->set_payment_log( EEM_Change_Log::instance() ); |
|
106 | - $this->_gateway->set_template_helper( new EEH_Template() ); |
|
107 | - $this->_gateway->set_line_item_helper( new EEH_Line_Item() ); |
|
108 | - $this->_gateway->set_money_helper( new EEH_Money() ); |
|
103 | + if ($this->_gateway) { |
|
104 | + $this->_gateway->set_payment_model(EEM_Payment::instance()); |
|
105 | + $this->_gateway->set_payment_log(EEM_Change_Log::instance()); |
|
106 | + $this->_gateway->set_template_helper(new EEH_Template()); |
|
107 | + $this->_gateway->set_line_item_helper(new EEH_Line_Item()); |
|
108 | + $this->_gateway->set_money_helper(new EEH_Money()); |
|
109 | 109 | } |
110 | - if ( ! isset( $this->_has_billing_form ) ) { |
|
110 | + if ( ! isset($this->_has_billing_form)) { |
|
111 | 111 | // by default, On Site gateways have a billing form |
112 | - if ( $this->payment_occurs() == EE_PMT_Base::onsite ) { |
|
113 | - $this->set_has_billing_form( true ); |
|
112 | + if ($this->payment_occurs() == EE_PMT_Base::onsite) { |
|
113 | + $this->set_has_billing_form(true); |
|
114 | 114 | } else { |
115 | - $this->set_has_billing_form( false ); |
|
115 | + $this->set_has_billing_form(false); |
|
116 | 116 | } |
117 | 117 | } |
118 | 118 | |
119 | - if( ! $this->_pretty_name){ |
|
119 | + if ( ! $this->_pretty_name) { |
|
120 | 120 | throw new EE_Error(sprintf(__("You must set the pretty name for the Payment Method Type in the constructor (_pretty_name), and please make it internationalized", "event_espresso"))); |
121 | 121 | } |
122 | 122 | //if the child didn't specify a default button, use the credit card one |
123 | - if( $this->_default_button_url === NULL){ |
|
124 | - $this->_default_button_url = EE_PLUGIN_DIR_URL . 'payment_methods' . DS . 'pay-by-credit-card.png'; |
|
123 | + if ($this->_default_button_url === NULL) { |
|
124 | + $this->_default_button_url = EE_PLUGIN_DIR_URL.'payment_methods'.DS.'pay-by-credit-card.png'; |
|
125 | 125 | } |
126 | 126 | } |
127 | 127 | |
@@ -130,8 +130,8 @@ discard block |
||
130 | 130 | /** |
131 | 131 | * @param boolean $has_billing_form |
132 | 132 | */ |
133 | - public function set_has_billing_form( $has_billing_form ) { |
|
134 | - $this->_has_billing_form = filter_var( $has_billing_form, FILTER_VALIDATE_BOOLEAN ); |
|
133 | + public function set_has_billing_form($has_billing_form) { |
|
134 | + $this->_has_billing_form = filter_var($has_billing_form, FILTER_VALIDATE_BOOLEAN); |
|
135 | 135 | } |
136 | 136 | |
137 | 137 | |
@@ -139,10 +139,10 @@ discard block |
||
139 | 139 | /** |
140 | 140 | * sets the file_folder property |
141 | 141 | */ |
142 | - protected function _set_file_folder(){ |
|
142 | + protected function _set_file_folder() { |
|
143 | 143 | $reflector = new ReflectionClass(get_class($this)); |
144 | 144 | $fn = $reflector->getFileName(); |
145 | - $this->_file_folder = dirname($fn).DS; |
|
145 | + $this->_file_folder = dirname($fn).DS; |
|
146 | 146 | } |
147 | 147 | |
148 | 148 | |
@@ -150,10 +150,10 @@ discard block |
||
150 | 150 | /** |
151 | 151 | * sets the file URL with a trailing slash for this PMT |
152 | 152 | */ |
153 | - protected function _set_file_url(){ |
|
154 | - $plugins_dir_fixed = str_replace('\\',DS,WP_PLUGIN_DIR); |
|
155 | - $file_folder_fixed = str_replace('\\',DS,$this->file_folder()); |
|
156 | - $file_path = str_replace($plugins_dir_fixed,WP_PLUGIN_URL,$file_folder_fixed); |
|
153 | + protected function _set_file_url() { |
|
154 | + $plugins_dir_fixed = str_replace('\\', DS, WP_PLUGIN_DIR); |
|
155 | + $file_folder_fixed = str_replace('\\', DS, $this->file_folder()); |
|
156 | + $file_path = str_replace($plugins_dir_fixed, WP_PLUGIN_URL, $file_folder_fixed); |
|
157 | 157 | $this->_file_url = $file_path; |
158 | 158 | } |
159 | 159 | |
@@ -161,7 +161,7 @@ discard block |
||
161 | 161 | * Gets the default description on all payment methods of this type |
162 | 162 | * @return string |
163 | 163 | */ |
164 | - public function default_description(){ |
|
164 | + public function default_description() { |
|
165 | 165 | return $this->_default_description; |
166 | 166 | } |
167 | 167 | |
@@ -171,7 +171,7 @@ discard block |
||
171 | 171 | * Returns the folder containing the PMT child class, with a trailing slash |
172 | 172 | * @return string |
173 | 173 | */ |
174 | - public function file_folder(){ |
|
174 | + public function file_folder() { |
|
175 | 175 | return $this->_file_folder; |
176 | 176 | } |
177 | 177 | |
@@ -180,7 +180,7 @@ discard block |
||
180 | 180 | /** |
181 | 181 | * @return string |
182 | 182 | */ |
183 | - public function file_url(){ |
|
183 | + public function file_url() { |
|
184 | 184 | return $this->_file_url; |
185 | 185 | } |
186 | 186 | |
@@ -191,14 +191,14 @@ discard block |
||
191 | 191 | * Its important teh payment method instance is set before |
192 | 192 | * @param EE_Payment_Method $payment_method_instance |
193 | 193 | */ |
194 | - function set_instance($payment_method_instance){ |
|
194 | + function set_instance($payment_method_instance) { |
|
195 | 195 | $this->_pm_instance = $payment_method_instance; |
196 | 196 | //if they have already requested the settings form, make sure its |
197 | 197 | //data matches this model object |
198 | - if($this->_settings_form){ |
|
198 | + if ($this->_settings_form) { |
|
199 | 199 | $this->settings_form()->populate_model_obj($payment_method_instance); |
200 | 200 | } |
201 | - if($this->_gateway && $this->_gateway instanceof EE_Gateway){ |
|
201 | + if ($this->_gateway && $this->_gateway instanceof EE_Gateway) { |
|
202 | 202 | $this->_gateway->set_settings($payment_method_instance->settings_array()); |
203 | 203 | } |
204 | 204 | } |
@@ -209,14 +209,14 @@ discard block |
||
209 | 209 | * Gets teh form for displaying to admins where they setup the payment method |
210 | 210 | * @return EE_Payment_Method_Form |
211 | 211 | */ |
212 | - function settings_form(){ |
|
213 | - if( ! $this->_settings_form){ |
|
212 | + function settings_form() { |
|
213 | + if ( ! $this->_settings_form) { |
|
214 | 214 | $this->_settings_form = $this->generate_new_settings_form(); |
215 | - $this->_settings_form->set_payment_method_type( $this ); |
|
216 | - $this->_settings_form->_construct_finalize(NULL, NULL ); |
|
215 | + $this->_settings_form->set_payment_method_type($this); |
|
216 | + $this->_settings_form->_construct_finalize(NULL, NULL); |
|
217 | 217 | //if we have already assigned a model object to this pmt, make |
218 | 218 | //sure its reflected in teh form we just generated |
219 | - if($this->_pm_instance){ |
|
219 | + if ($this->_pm_instance) { |
|
220 | 220 | $this->_settings_form->populate_model_obj($this->_pm_instance); |
221 | 221 | } |
222 | 222 | } |
@@ -242,7 +242,7 @@ discard block |
||
242 | 242 | * this payment method type's settings form later in the request |
243 | 243 | * @param EE_Payment_Method_Form $form |
244 | 244 | */ |
245 | - public function set_settings_form($form){ |
|
245 | + public function set_settings_form($form) { |
|
246 | 246 | $this->_settings_form = $form; |
247 | 247 | } |
248 | 248 | |
@@ -265,10 +265,10 @@ discard block |
||
265 | 265 | * @param array $extra_args |
266 | 266 | * @return \EE_Billing_Attendee_Info_Form|\EE_Billing_Info_Form|null |
267 | 267 | */ |
268 | - public function billing_form( EE_Transaction $transaction = NULL, $extra_args = array() ){ |
|
268 | + public function billing_form(EE_Transaction $transaction = NULL, $extra_args = array()) { |
|
269 | 269 | // has billing form already been regenerated ? or overwrite cache? |
270 | - if ( ! $this->_billing_form instanceof EE_Billing_Info_Form || ! $this->_cache_billing_form ){ |
|
271 | - $this->_billing_form = $this->generate_new_billing_form( $transaction, $extra_args ); |
|
270 | + if ( ! $this->_billing_form instanceof EE_Billing_Info_Form || ! $this->_cache_billing_form) { |
|
271 | + $this->_billing_form = $this->generate_new_billing_form($transaction, $extra_args); |
|
272 | 272 | } |
273 | 273 | //if we know who the attendee is, and this is a billing form |
274 | 274 | //that uses attendee info, populate it |
@@ -277,8 +277,8 @@ discard block |
||
277 | 277 | $transaction instanceof EE_Transaction && |
278 | 278 | $transaction->primary_registration() instanceof EE_Registration && |
279 | 279 | $transaction->primary_registration()->attendee() instanceof EE_Attendee |
280 | - ){ |
|
281 | - $this->_billing_form->populate_from_attendee( $transaction->primary_registration()->attendee() ); |
|
280 | + ) { |
|
281 | + $this->_billing_form->populate_from_attendee($transaction->primary_registration()->attendee()); |
|
282 | 282 | } |
283 | 283 | return $this->_billing_form; |
284 | 284 | } |
@@ -289,7 +289,7 @@ discard block |
||
289 | 289 | * @param \EE_Transaction $transaction |
290 | 290 | * @return \EE_Billing_Info_Form |
291 | 291 | */ |
292 | - abstract function generate_new_billing_form( EE_Transaction $transaction = NULL ); |
|
292 | + abstract function generate_new_billing_form(EE_Transaction $transaction = NULL); |
|
293 | 293 | |
294 | 294 | |
295 | 295 | |
@@ -300,7 +300,7 @@ discard block |
||
300 | 300 | * @param \EE_Billing_Info_Form $billing_form |
301 | 301 | * @return \EE_Billing_Info_Form |
302 | 302 | */ |
303 | - public function apply_billing_form_debug_settings( EE_Billing_Info_Form $billing_form ) { |
|
303 | + public function apply_billing_form_debug_settings(EE_Billing_Info_Form $billing_form) { |
|
304 | 304 | return $billing_form; |
305 | 305 | } |
306 | 306 | |
@@ -311,7 +311,7 @@ discard block |
||
311 | 311 | * if you have form |
312 | 312 | * @param EE_Payment_Method $form |
313 | 313 | */ |
314 | - public function set_billing_form($form){ |
|
314 | + public function set_billing_form($form) { |
|
315 | 315 | $this->_billing_form = $form; |
316 | 316 | } |
317 | 317 | |
@@ -321,7 +321,7 @@ discard block |
||
321 | 321 | * Returns whether or not this payment method requires HTTPS to be used |
322 | 322 | * @return boolean |
323 | 323 | */ |
324 | - function requires_https(){ |
|
324 | + function requires_https() { |
|
325 | 325 | return $this->_requires_https; |
326 | 326 | } |
327 | 327 | |
@@ -339,9 +339,9 @@ discard block |
||
339 | 339 | * @return EE_Payment |
340 | 340 | * @throws EE_Error |
341 | 341 | */ |
342 | - function process_payment( EE_Transaction $transaction, $amount = null, $billing_info = null, $return_url = null,$fail_url = '', $method = 'CART', $by_admin = false ){ |
|
342 | + function process_payment(EE_Transaction $transaction, $amount = null, $billing_info = null, $return_url = null, $fail_url = '', $method = 'CART', $by_admin = false) { |
|
343 | 343 | // @todo: add surcharge for the payment method, if any |
344 | - if ( $this->_gateway ) { |
|
344 | + if ($this->_gateway) { |
|
345 | 345 | //there is a gateway, so we're going to make a payment object |
346 | 346 | //but wait! do they already have a payment in progress that we thought was failed? |
347 | 347 | $duplicate_properties = array( |
@@ -352,10 +352,10 @@ discard block |
||
352 | 352 | 'PAY_amount' => $amount !== null ? $amount : $transaction->remaining(), |
353 | 353 | 'PAY_gateway_response' => null, |
354 | 354 | ); |
355 | - $payment = EEM_Payment::instance()->get_one( array( $duplicate_properties )); |
|
355 | + $payment = EEM_Payment::instance()->get_one(array($duplicate_properties)); |
|
356 | 356 | //if we didn't already have a payment in progress for the same thing, |
357 | 357 | //then we actually want to make a new payment |
358 | - if ( ! $payment instanceof EE_Payment ){ |
|
358 | + if ( ! $payment instanceof EE_Payment) { |
|
359 | 359 | $payment = EE_Payment::new_instance( |
360 | 360 | array_merge( |
361 | 361 | $duplicate_properties, |
@@ -371,10 +371,10 @@ discard block |
||
371 | 371 | } |
372 | 372 | //make sure the payment has been saved to show we started it, and so it has an ID should the gateway try to log it |
373 | 373 | $payment->save(); |
374 | - $billing_values = $this->_get_billing_values_from_form( $billing_info ); |
|
374 | + $billing_values = $this->_get_billing_values_from_form($billing_info); |
|
375 | 375 | |
376 | 376 | // Offsite Gateway |
377 | - if( $this->_gateway instanceof EE_Offsite_Gateway ){ |
|
377 | + if ($this->_gateway instanceof EE_Offsite_Gateway) { |
|
378 | 378 | |
379 | 379 | $payment = $this->_gateway->set_redirection_info( |
380 | 380 | $payment, |
@@ -390,17 +390,17 @@ discard block |
||
390 | 390 | ); |
391 | 391 | $payment->save(); |
392 | 392 | // Onsite Gateway |
393 | - } elseif ( $this->_gateway instanceof EE_Onsite_Gateway ) { |
|
393 | + } elseif ($this->_gateway instanceof EE_Onsite_Gateway) { |
|
394 | 394 | |
395 | - $payment = $this->_gateway->do_direct_payment($payment,$billing_values); |
|
395 | + $payment = $this->_gateway->do_direct_payment($payment, $billing_values); |
|
396 | 396 | $payment->save(); |
397 | 397 | |
398 | 398 | } else { |
399 | 399 | throw new EE_Error( |
400 | 400 | sprintf( |
401 | - __('Gateway for payment method type "%s" is "%s", not a subclass of either EE_Offsite_Gateway or EE_Onsite_Gateway, or null (to indicate NO gateway)', 'event_espresso' ), |
|
401 | + __('Gateway for payment method type "%s" is "%s", not a subclass of either EE_Offsite_Gateway or EE_Onsite_Gateway, or null (to indicate NO gateway)', 'event_espresso'), |
|
402 | 402 | get_class($this), |
403 | - gettype( $this->_gateway ) |
|
403 | + gettype($this->_gateway) |
|
404 | 404 | ) |
405 | 405 | ); |
406 | 406 | } |
@@ -422,8 +422,8 @@ discard block |
||
422 | 422 | } |
423 | 423 | |
424 | 424 | // if there is billing info, clean it and save it now |
425 | - if( $billing_info instanceof EE_Billing_Attendee_Info_Form ){ |
|
426 | - $this->_save_billing_info_to_attendee( $billing_info, $transaction ); |
|
425 | + if ($billing_info instanceof EE_Billing_Attendee_Info_Form) { |
|
426 | + $this->_save_billing_info_to_attendee($billing_info, $transaction); |
|
427 | 427 | } |
428 | 428 | |
429 | 429 | return $payment; |
@@ -436,10 +436,10 @@ discard block |
||
436 | 436 | * @param EE_Billing_Info_Form $billing_form |
437 | 437 | * @return array |
438 | 438 | */ |
439 | - protected function _get_billing_values_from_form( $billing_form ){ |
|
440 | - if($billing_form instanceof EE_Form_Section_Proper ){ |
|
441 | - return $billing_form->input_pretty_values( true ); |
|
442 | - }else{ |
|
439 | + protected function _get_billing_values_from_form($billing_form) { |
|
440 | + if ($billing_form instanceof EE_Form_Section_Proper) { |
|
441 | + return $billing_form->input_pretty_values(true); |
|
442 | + } else { |
|
443 | 443 | return NULL; |
444 | 444 | } |
445 | 445 | } |
@@ -453,13 +453,13 @@ discard block |
||
453 | 453 | * @return EE_Payment |
454 | 454 | * @throws EE_Error |
455 | 455 | */ |
456 | - public function handle_ipn($req_data,$transaction){ |
|
456 | + public function handle_ipn($req_data, $transaction) { |
|
457 | 457 | $transaction = EEM_Transaction::instance()->ensure_is_obj($transaction); |
458 | - if( ! $this->_gateway instanceof EE_Offsite_Gateway){ |
|
459 | - throw new EE_Error(sprintf(__("Could not handle IPN because '%s' is not an offsite gateway", "event_espresso"), print_r( $this->_gateway, TRUE ))); |
|
458 | + if ( ! $this->_gateway instanceof EE_Offsite_Gateway) { |
|
459 | + throw new EE_Error(sprintf(__("Could not handle IPN because '%s' is not an offsite gateway", "event_espresso"), print_r($this->_gateway, TRUE))); |
|
460 | 460 | |
461 | 461 | } |
462 | - $payment = $this->_gateway->handle_payment_update( $req_data, $transaction ); |
|
462 | + $payment = $this->_gateway->handle_payment_update($req_data, $transaction); |
|
463 | 463 | return $payment; |
464 | 464 | } |
465 | 465 | |
@@ -472,22 +472,22 @@ discard block |
||
472 | 472 | * @param EE_Transaction $transaction |
473 | 473 | * @return boolean success |
474 | 474 | */ |
475 | - protected function _save_billing_info_to_attendee($billing_form, $transaction){ |
|
476 | - if( ! $transaction || ! $transaction instanceof EE_Transaction){ |
|
475 | + protected function _save_billing_info_to_attendee($billing_form, $transaction) { |
|
476 | + if ( ! $transaction || ! $transaction instanceof EE_Transaction) { |
|
477 | 477 | EE_Error::add_error(__("Cannot save billing info because no transaction was specified", "event_espresso"), __FILE__, __FUNCTION__, __LINE__); |
478 | 478 | return false; |
479 | 479 | } |
480 | 480 | $primary_reg = $transaction->primary_registration(); |
481 | - if( ! $primary_reg ){ |
|
481 | + if ( ! $primary_reg) { |
|
482 | 482 | EE_Error::add_error(__("Cannot save billing info because the transaction has no primary registration", "event_espresso"), __FILE__, __FUNCTION__, __LINE__); |
483 | 483 | return false; |
484 | 484 | } |
485 | 485 | $attendee = $primary_reg->attendee(); |
486 | - if( ! $attendee ){ |
|
486 | + if ( ! $attendee) { |
|
487 | 487 | EE_Error::add_error(__("Cannot save billing info because the transaction's primary registration has no attendee!", "event_espresso"), __FILE__, __FUNCTION__, __LINE__); |
488 | 488 | return false; |
489 | 489 | } |
490 | - return $attendee->save_and_clean_billing_info_for_payment_method($billing_form, $transaction->payment_method() ); |
|
490 | + return $attendee->save_and_clean_billing_info_for_payment_method($billing_form, $transaction->payment_method()); |
|
491 | 491 | |
492 | 492 | } |
493 | 493 | |
@@ -500,7 +500,7 @@ discard block |
||
500 | 500 | * @param array $req_data |
501 | 501 | * @return EE_Payment |
502 | 502 | */ |
503 | - protected function find_payment_for_ipn( EE_Transaction $transaction, $req_data = array() ){ |
|
503 | + protected function find_payment_for_ipn(EE_Transaction $transaction, $req_data = array()) { |
|
504 | 504 | return $transaction->last_payment(); |
505 | 505 | } |
506 | 506 | |
@@ -517,8 +517,8 @@ discard block |
||
517 | 517 | * and identifies the IPN as being for this payment method (not just fo ra payment method of this type) |
518 | 518 | * @throws EE_Error |
519 | 519 | */ |
520 | - public function handle_unclaimed_ipn( $req_data = array() ){ |
|
521 | - throw new EE_Error(sprintf(__("Payment Method '%s' cannot handle unclaimed IPNs", "event_espresso"), get_class($this) )); |
|
520 | + public function handle_unclaimed_ipn($req_data = array()) { |
|
521 | + throw new EE_Error(sprintf(__("Payment Method '%s' cannot handle unclaimed IPNs", "event_espresso"), get_class($this))); |
|
522 | 522 | } |
523 | 523 | |
524 | 524 | |
@@ -534,7 +534,7 @@ discard block |
||
534 | 534 | * @param EE_Transaction $transaction |
535 | 535 | * @return EE_Payment |
536 | 536 | */ |
537 | - public function finalize_payment_for($transaction){ |
|
537 | + public function finalize_payment_for($transaction) { |
|
538 | 538 | return $transaction->last_payment(); |
539 | 539 | } |
540 | 540 | |
@@ -544,10 +544,10 @@ discard block |
||
544 | 544 | * Whether or not this payment method's gateway supports sending refund requests |
545 | 545 | * @return boolean |
546 | 546 | */ |
547 | - public function supports_sending_refunds(){ |
|
548 | - if($this->_gateway && $this->_gateway instanceof EE_Gateway){ |
|
547 | + public function supports_sending_refunds() { |
|
548 | + if ($this->_gateway && $this->_gateway instanceof EE_Gateway) { |
|
549 | 549 | return $this->_gateway->supports_sending_refunds(); |
550 | - }else{ |
|
550 | + } else { |
|
551 | 551 | return false; |
552 | 552 | } |
553 | 553 | } |
@@ -561,14 +561,14 @@ discard block |
||
561 | 561 | * @throws EE_Error |
562 | 562 | * @return EE_Payment |
563 | 563 | */ |
564 | - public function process_refund( EE_Payment $payment, $refund_info = array()){ |
|
565 | - if ( $this->_gateway && $this->_gateway instanceof EE_Gateway ) { |
|
566 | - return $this->_gateway->do_direct_refund( $payment, $refund_info ); |
|
564 | + public function process_refund(EE_Payment $payment, $refund_info = array()) { |
|
565 | + if ($this->_gateway && $this->_gateway instanceof EE_Gateway) { |
|
566 | + return $this->_gateway->do_direct_refund($payment, $refund_info); |
|
567 | 567 | } else { |
568 | 568 | throw new EE_Error( |
569 | 569 | sprintf( |
570 | - __( 'Payment Method Type "%s" does not support sending refund requests', 'event_espresso' ), |
|
571 | - get_class( $this ) |
|
570 | + __('Payment Method Type "%s" does not support sending refund requests', 'event_espresso'), |
|
571 | + get_class($this) |
|
572 | 572 | ) |
573 | 573 | ); |
574 | 574 | } |
@@ -582,15 +582,15 @@ discard block |
||
582 | 582 | * @return string |
583 | 583 | * @throws EE_Error |
584 | 584 | */ |
585 | - public function payment_occurs(){ |
|
586 | - if( ! $this->_gateway){ |
|
585 | + public function payment_occurs() { |
|
586 | + if ( ! $this->_gateway) { |
|
587 | 587 | return EE_PMT_Base::offline; |
588 | - }elseif($this->_gateway instanceof EE_Onsite_Gateway){ |
|
588 | + }elseif ($this->_gateway instanceof EE_Onsite_Gateway) { |
|
589 | 589 | return EE_PMT_Base::onsite; |
590 | - }elseif($this->_gateway instanceof EE_Offsite_Gateway){ |
|
590 | + }elseif ($this->_gateway instanceof EE_Offsite_Gateway) { |
|
591 | 591 | return EE_PMT_Base::offsite; |
592 | - }else{ |
|
593 | - throw new EE_Error(sprintf(__("Payment method type '%s's gateway isn't an instance of EE_Onsite_Gateway, EE_Offsite_Gateway, or null. It must be one of those", "event_espresso"),get_class($this))); |
|
592 | + } else { |
|
593 | + throw new EE_Error(sprintf(__("Payment method type '%s's gateway isn't an instance of EE_Onsite_Gateway, EE_Offsite_Gateway, or null. It must be one of those", "event_espresso"), get_class($this))); |
|
594 | 594 | } |
595 | 595 | } |
596 | 596 | |
@@ -603,8 +603,8 @@ discard block |
||
603 | 603 | * @param EE_Payment $payment |
604 | 604 | * @return string |
605 | 605 | */ |
606 | - public function payment_overview_content(EE_Payment $payment){ |
|
607 | - return EEH_Template::display_template(EE_LIBRARIES.'payment_methods'.DS.'templates'.DS.'payment_details_content.template.php', array('payment_method'=>$this->_pm_instance,'payment'=>$payment) , true); |
|
606 | + public function payment_overview_content(EE_Payment $payment) { |
|
607 | + return EEH_Template::display_template(EE_LIBRARIES.'payment_methods'.DS.'templates'.DS.'payment_details_content.template.php', array('payment_method'=>$this->_pm_instance, 'payment'=>$payment), true); |
|
608 | 608 | } |
609 | 609 | |
610 | 610 | |
@@ -617,7 +617,7 @@ discard block |
||
617 | 617 | * @type array $template_args any arguments you want passed to the template file while rendering. |
618 | 618 | * Keys will be variable names and values with be their values. |
619 | 619 | */ |
620 | - public function help_tabs_config(){ |
|
620 | + public function help_tabs_config() { |
|
621 | 621 | return array(); |
622 | 622 | } |
623 | 623 | |
@@ -628,9 +628,9 @@ discard block |
||
628 | 628 | * the payment method's table's PMT_type column) |
629 | 629 | * @return string |
630 | 630 | */ |
631 | - public function system_name(){ |
|
631 | + public function system_name() { |
|
632 | 632 | $classname = get_class($this); |
633 | - return str_replace("EE_PMT_",'',$classname); |
|
633 | + return str_replace("EE_PMT_", '', $classname); |
|
634 | 634 | } |
635 | 635 | |
636 | 636 | |
@@ -639,7 +639,7 @@ discard block |
||
639 | 639 | * A pretty i18n version of the PMT name |
640 | 640 | * @return string |
641 | 641 | */ |
642 | - public function pretty_name(){ |
|
642 | + public function pretty_name() { |
|
643 | 643 | return $this->_pretty_name; |
644 | 644 | } |
645 | 645 | |
@@ -649,7 +649,7 @@ discard block |
||
649 | 649 | * Gets the default absolute URL to the payment method type's button |
650 | 650 | * @return string |
651 | 651 | */ |
652 | - public function default_button_url(){ |
|
652 | + public function default_button_url() { |
|
653 | 653 | return $this->_default_button_url; |
654 | 654 | } |
655 | 655 | |
@@ -659,7 +659,7 @@ discard block |
||
659 | 659 | * Gets the gateway used by this payment method (if any) |
660 | 660 | * @return EE_Gateway |
661 | 661 | */ |
662 | - public function get_gateway(){ |
|
662 | + public function get_gateway() { |
|
663 | 663 | return $this->_gateway; |
664 | 664 | } |
665 | 665 | |
@@ -668,8 +668,8 @@ discard block |
||
668 | 668 | /** |
669 | 669 | * @return string html for the link to a help tab |
670 | 670 | */ |
671 | - public function get_help_tab_link(){ |
|
672 | - return EEH_Template::get_help_tab_link( $this->get_help_tab_name() ); |
|
671 | + public function get_help_tab_link() { |
|
672 | + return EEH_Template::get_help_tab_link($this->get_help_tab_name()); |
|
673 | 673 | } |
674 | 674 | |
675 | 675 | |
@@ -678,8 +678,8 @@ discard block |
||
678 | 678 | * Returns the name of the help tab for this PMT |
679 | 679 | * @return string |
680 | 680 | */ |
681 | - public function get_help_tab_name(){ |
|
682 | - return 'ee_' . strtolower( $this->system_name() ) . '_help_tab'; |
|
681 | + public function get_help_tab_name() { |
|
682 | + return 'ee_'.strtolower($this->system_name()).'_help_tab'; |
|
683 | 683 | } |
684 | 684 | |
685 | 685 | /** |
@@ -687,8 +687,8 @@ discard block |
||
687 | 687 | * this PMT by an admin |
688 | 688 | * @return string |
689 | 689 | */ |
690 | - public function cap_name(){ |
|
691 | - return 'ee_payment_method_' . strtolower( $this->system_name() ); |
|
690 | + public function cap_name() { |
|
691 | + return 'ee_payment_method_'.strtolower($this->system_name()); |
|
692 | 692 | } |
693 | 693 | |
694 | 694 | /** |
@@ -700,9 +700,9 @@ discard block |
||
700 | 700 | * @param EE_Payment $payment |
701 | 701 | * @return void |
702 | 702 | */ |
703 | - public function update_txn_based_on_payment( $payment ){ |
|
704 | - if( $this->_gateway instanceof EE_Gateway ){ |
|
705 | - $this->_gateway->update_txn_based_on_payment( $payment ); |
|
703 | + public function update_txn_based_on_payment($payment) { |
|
704 | + if ($this->_gateway instanceof EE_Gateway) { |
|
705 | + $this->_gateway->update_txn_based_on_payment($payment); |
|
706 | 706 | } |
707 | 707 | } |
708 | 708 |
@@ -1,7 +1,7 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | //namespace EventEspresso\core\libraries\templates; |
3 | -if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) { |
|
4 | - exit( 'No direct script access allowed' ); |
|
3 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
4 | + exit('No direct script access allowed'); |
|
5 | 5 | } |
6 | 6 | |
7 | 7 | |
@@ -70,23 +70,23 @@ discard block |
||
70 | 70 | * @param string $template - name or path of template to be used by EEH_Template::locate_template() |
71 | 71 | * @param int $priority - order in which template parts should be applied |
72 | 72 | */ |
73 | - public function add_template_part( $name, $label, $template, $priority ) { |
|
73 | + public function add_template_part($name, $label, $template, $priority) { |
|
74 | 74 | // SplPriorityQueue doesn't play nice with multiple items having the same priority |
75 | 75 | // so if the incoming priority is already occupied, then let's increment it by one, |
76 | 76 | // and then pass everything back into this method and try again with the new priority |
77 | - if ( isset( $this->priorities[ $priority ] ) ) { |
|
77 | + if (isset($this->priorities[$priority])) { |
|
78 | 78 | $priority++; |
79 | - $this->add_template_part( $name, $label, $template, $priority ); |
|
79 | + $this->add_template_part($name, $label, $template, $priority); |
|
80 | 80 | return; |
81 | 81 | } |
82 | 82 | // kk now we can mark this priority as being occupied |
83 | - $this->priorities[ $priority ] = true; |
|
83 | + $this->priorities[$priority] = true; |
|
84 | 84 | // create the template part and add to the queue |
85 | 85 | $this->template_parts->insert( |
86 | - new EE_Template_Part( $name, $label, $template, $priority ), |
|
86 | + new EE_Template_Part($name, $label, $template, $priority), |
|
87 | 87 | $priority |
88 | 88 | ); |
89 | - if ( $name == 'event' ) { |
|
89 | + if ($name == 'event') { |
|
90 | 90 | $this->event_desc_priority = $priority; |
91 | 91 | } |
92 | 92 | } |
@@ -103,10 +103,10 @@ discard block |
||
103 | 103 | * @param string $content |
104 | 104 | * @return string |
105 | 105 | */ |
106 | - public function apply_template_part_filters( $content = '' ) { |
|
106 | + public function apply_template_part_filters($content = '') { |
|
107 | 107 | $this->template_parts->rewind(); |
108 | 108 | // loop through template parts and position content |
109 | - while ( $this->template_parts->valid() ) { |
|
109 | + while ($this->template_parts->valid()) { |
|
110 | 110 | $this->_position_template_part( |
111 | 111 | $content, |
112 | 112 | $this->template_parts->current()->template(), |
@@ -115,7 +115,7 @@ discard block |
||
115 | 115 | $this->template_parts->next(); |
116 | 116 | } |
117 | 117 | // now simply add our three strings of content together |
118 | - return $this->before_event_content . $this->event_content . $this->after_event_content; |
|
118 | + return $this->before_event_content.$this->event_content.$this->after_event_content; |
|
119 | 119 | } |
120 | 120 | |
121 | 121 | |
@@ -136,16 +136,16 @@ discard block |
||
136 | 136 | * @param int $priority |
137 | 137 | * @return string |
138 | 138 | */ |
139 | - protected function _position_template_part( $content, $template, $priority ) { |
|
139 | + protected function _position_template_part($content, $template, $priority) { |
|
140 | 140 | // Event Description content is the actual incoming content itself |
141 | - if ( $priority === $this->event_desc_priority ) { |
|
141 | + if ($priority === $this->event_desc_priority) { |
|
142 | 142 | $this->event_content = $content; |
143 | - } else if ( $priority < $this->event_desc_priority ) { |
|
143 | + } else if ($priority < $this->event_desc_priority) { |
|
144 | 144 | // everything BEFORE the Event Description |
145 | - $this->before_event_content .= EEH_Template::locate_template( $template ); |
|
146 | - } else if ( $priority > $this->event_desc_priority ) { |
|
145 | + $this->before_event_content .= EEH_Template::locate_template($template); |
|
146 | + } else if ($priority > $this->event_desc_priority) { |
|
147 | 147 | // everything AFTER the Event Description |
148 | - $this->after_event_content .= EEH_Template::locate_template( $template ); |
|
148 | + $this->after_event_content .= EEH_Template::locate_template($template); |
|
149 | 149 | } |
150 | 150 | } |
151 | 151 | |
@@ -170,15 +170,15 @@ discard block |
||
170 | 170 | $list_item_css_class = '', |
171 | 171 | $list_item_css_id_prefix = '' |
172 | 172 | ) { |
173 | - $event_archive_display_order = EEH_HTML::ul( $list_css_id, $list_css_class ); |
|
173 | + $event_archive_display_order = EEH_HTML::ul($list_css_id, $list_css_class); |
|
174 | 174 | $this->template_parts->rewind(); |
175 | 175 | // loop through template parts and add template content |
176 | - while ( $this->template_parts->valid() ) { |
|
176 | + while ($this->template_parts->valid()) { |
|
177 | 177 | $event_archive_display_order .= EEH_HTML::li( |
178 | - EEH_HTML::span( '', '', 'dashicons dashicons-arrow-up-alt2' ) . |
|
179 | - EEH_HTML::span( '', '', 'dashicons dashicons-arrow-down-alt2' ) . |
|
178 | + EEH_HTML::span('', '', 'dashicons dashicons-arrow-up-alt2'). |
|
179 | + EEH_HTML::span('', '', 'dashicons dashicons-arrow-down-alt2'). |
|
180 | 180 | $this->template_parts->current()->label(), |
181 | - $list_item_css_id_prefix . $this->template_parts->current()->name(), |
|
181 | + $list_item_css_id_prefix.$this->template_parts->current()->name(), |
|
182 | 182 | $list_item_css_class |
183 | 183 | ); |
184 | 184 | $this->template_parts->next(); |
@@ -198,10 +198,10 @@ discard block |
||
198 | 198 | * @return string |
199 | 199 | */ |
200 | 200 | public function display_template_parts() { |
201 | - if ( WP_DEBUG ) { |
|
201 | + if (WP_DEBUG) { |
|
202 | 202 | $this->template_parts->rewind(); |
203 | - while ( $this->template_parts->valid() ) { |
|
204 | - EEH_Debug_Tools::printr( $this->template_parts->current(), 'template_part', __FILE__, __LINE__ ); |
|
203 | + while ($this->template_parts->valid()) { |
|
204 | + EEH_Debug_Tools::printr($this->template_parts->current(), 'template_part', __FILE__, __LINE__); |
|
205 | 205 | $this->template_parts->next(); |
206 | 206 | } |
207 | 207 | } |
@@ -128,7 +128,7 @@ discard block |
||
128 | 128 | */ |
129 | 129 | public static function instance() { |
130 | 130 | // check if class object is instantiated, and instantiated properly |
131 | - if ( ! self::$_instance instanceof EE_Config ) { |
|
131 | + if ( ! self::$_instance instanceof EE_Config) { |
|
132 | 132 | self::$_instance = new self(); |
133 | 133 | } |
134 | 134 | return self::$_instance; |
@@ -145,22 +145,22 @@ discard block |
||
145 | 145 | * not be ready to instantiate EE_Config currently (eg if the site was put into maintenance mode) |
146 | 146 | * @return EE_Config |
147 | 147 | */ |
148 | - public static function reset( $hard_reset = FALSE, $reinstantiate = TRUE ){ |
|
149 | - if ( $hard_reset ) { |
|
148 | + public static function reset($hard_reset = FALSE, $reinstantiate = TRUE) { |
|
149 | + if ($hard_reset) { |
|
150 | 150 | self::$_instance->_config_option_names = array(); |
151 | 151 | self::$_instance->_initialize_config(); |
152 | 152 | self::$_instance->update_espresso_config(); |
153 | 153 | } |
154 | - if( self::$_instance instanceof EE_Config ){ |
|
154 | + if (self::$_instance instanceof EE_Config) { |
|
155 | 155 | self::$_instance->shutdown(); |
156 | 156 | } |
157 | 157 | self::$_instance = NULL; |
158 | 158 | //we don't need to reset the static properties imo because those should |
159 | 159 | //only change when a module is added or removed. Currently we don't |
160 | 160 | //support removing a module during a request when it previously existed |
161 | - if( $reinstantiate ){ |
|
161 | + if ($reinstantiate) { |
|
162 | 162 | return self::instance(); |
163 | - }else{ |
|
163 | + } else { |
|
164 | 164 | return NULL; |
165 | 165 | } |
166 | 166 | } |
@@ -174,8 +174,8 @@ discard block |
||
174 | 174 | * @return \EE_Config |
175 | 175 | */ |
176 | 176 | private function __construct() { |
177 | - do_action( 'AHEE__EE_Config__construct__begin',$this ); |
|
178 | - $this->_config_option_names = get_option( 'ee_config_option_names', array() ); |
|
177 | + do_action('AHEE__EE_Config__construct__begin', $this); |
|
178 | + $this->_config_option_names = get_option('ee_config_option_names', array()); |
|
179 | 179 | // setup empty config classes |
180 | 180 | $this->_initialize_config(); |
181 | 181 | // load existing EE site settings |
@@ -183,15 +183,15 @@ discard block |
||
183 | 183 | // confirm everything loaded correctly and set filtered defaults if not |
184 | 184 | $this->_verify_config(); |
185 | 185 | // register shortcodes and modules |
186 | - add_action( 'AHEE__EE_System__register_shortcodes_modules_and_widgets', array( $this, 'register_shortcodes_and_modules' ), 999 ); |
|
186 | + add_action('AHEE__EE_System__register_shortcodes_modules_and_widgets', array($this, 'register_shortcodes_and_modules'), 999); |
|
187 | 187 | // initialize shortcodes and modules |
188 | - add_action( 'AHEE__EE_System__core_loaded_and_ready', array( $this, 'initialize_shortcodes_and_modules' )); |
|
188 | + add_action('AHEE__EE_System__core_loaded_and_ready', array($this, 'initialize_shortcodes_and_modules')); |
|
189 | 189 | // register widgets |
190 | - add_action( 'widgets_init', array( $this, 'widgets_init' ), 10 ); |
|
190 | + add_action('widgets_init', array($this, 'widgets_init'), 10); |
|
191 | 191 | // shutdown |
192 | - add_action( 'shutdown', array( $this, 'shutdown' ), 10 ); |
|
192 | + add_action('shutdown', array($this, 'shutdown'), 10); |
|
193 | 193 | // construct__end hook |
194 | - do_action( 'AHEE__EE_Config__construct__end',$this ); |
|
194 | + do_action('AHEE__EE_Config__construct__end', $this); |
|
195 | 195 | // hardcoded hack |
196 | 196 | $this->template_settings->current_espresso_theme = 'Espresso_Arabica_2014'; |
197 | 197 | } |
@@ -204,7 +204,7 @@ discard block |
||
204 | 204 | * @return string current theme set. |
205 | 205 | */ |
206 | 206 | public static function get_current_theme() { |
207 | - return isset( self::$_instance->template_settings->current_espresso_theme ) ? self::$_instance->template_settings->current_espresso_theme : 'Espresso_Arabica_2014'; |
|
207 | + return isset(self::$_instance->template_settings->current_espresso_theme) ? self::$_instance->template_settings->current_espresso_theme : 'Espresso_Arabica_2014'; |
|
208 | 208 | } |
209 | 209 | |
210 | 210 | |
@@ -238,27 +238,27 @@ discard block |
||
238 | 238 | */ |
239 | 239 | private function _load_core_config() { |
240 | 240 | // load_core_config__start hook |
241 | - do_action( 'AHEE__EE_Config___load_core_config__start', $this ); |
|
241 | + do_action('AHEE__EE_Config___load_core_config__start', $this); |
|
242 | 242 | $espresso_config = $this->get_espresso_config(); |
243 | - foreach ( $espresso_config as $config => $settings ) { |
|
243 | + foreach ($espresso_config as $config => $settings) { |
|
244 | 244 | // load_core_config__start hook |
245 | - $settings = apply_filters( 'FHEE__EE_Config___load_core_config__config_settings', $settings, $config, $this ); |
|
246 | - if ( is_object( $settings ) && property_exists( $this, $config ) ) { |
|
247 | - $this->{$config} = apply_filters( 'FHEE__EE_Config___load_core_config__' . $config, $settings ); |
|
245 | + $settings = apply_filters('FHEE__EE_Config___load_core_config__config_settings', $settings, $config, $this); |
|
246 | + if (is_object($settings) && property_exists($this, $config)) { |
|
247 | + $this->{$config} = apply_filters('FHEE__EE_Config___load_core_config__'.$config, $settings); |
|
248 | 248 | //call configs populate method to ensure any defaults are set for empty values. |
249 | - if ( method_exists( $settings, 'populate' ) ) { |
|
249 | + if (method_exists($settings, 'populate')) { |
|
250 | 250 | $this->{$config}->populate(); |
251 | 251 | } |
252 | - if ( method_exists( $settings, 'do_hooks' ) ) { |
|
252 | + if (method_exists($settings, 'do_hooks')) { |
|
253 | 253 | $this->{$config}->do_hooks(); |
254 | 254 | } |
255 | 255 | } |
256 | 256 | } |
257 | - if ( apply_filters( 'FHEE__EE_Config___load_core_config__update_espresso_config', FALSE ) ) { |
|
257 | + if (apply_filters('FHEE__EE_Config___load_core_config__update_espresso_config', FALSE)) { |
|
258 | 258 | $this->update_espresso_config(); |
259 | 259 | } |
260 | 260 | // load_core_config__end hook |
261 | - do_action( 'AHEE__EE_Config___load_core_config__end', $this ); |
|
261 | + do_action('AHEE__EE_Config___load_core_config__end', $this); |
|
262 | 262 | } |
263 | 263 | |
264 | 264 | |
@@ -272,40 +272,40 @@ discard block |
||
272 | 272 | protected function _verify_config() { |
273 | 273 | |
274 | 274 | $this->core = $this->core instanceof EE_Core_Config |
275 | - ? $this->core : new EE_Core_Config(); |
|
276 | - $this->core = apply_filters( 'FHEE__EE_Config___initialize_config__core', $this->core ); |
|
275 | + ? $this->core : new EE_Core_Config(); |
|
276 | + $this->core = apply_filters('FHEE__EE_Config___initialize_config__core', $this->core); |
|
277 | 277 | |
278 | 278 | $this->organization = $this->organization instanceof EE_Organization_Config |
279 | - ? $this->organization : new EE_Organization_Config(); |
|
280 | - $this->organization = apply_filters( 'FHEE__EE_Config___initialize_config__organization', $this->organization ); |
|
279 | + ? $this->organization : new EE_Organization_Config(); |
|
280 | + $this->organization = apply_filters('FHEE__EE_Config___initialize_config__organization', $this->organization); |
|
281 | 281 | |
282 | 282 | $this->currency = $this->currency instanceof EE_Currency_Config |
283 | 283 | ? $this->currency : new EE_Currency_Config(); |
284 | - $this->currency = apply_filters( 'FHEE__EE_Config___initialize_config__currency', $this->currency ); |
|
284 | + $this->currency = apply_filters('FHEE__EE_Config___initialize_config__currency', $this->currency); |
|
285 | 285 | |
286 | 286 | $this->registration = $this->registration instanceof EE_Registration_Config |
287 | 287 | ? $this->registration : new EE_Registration_Config(); |
288 | - $this->registration = apply_filters( 'FHEE__EE_Config___initialize_config__registration', $this->registration ); |
|
288 | + $this->registration = apply_filters('FHEE__EE_Config___initialize_config__registration', $this->registration); |
|
289 | 289 | |
290 | 290 | $this->admin = $this->admin instanceof EE_Admin_Config |
291 | 291 | ? $this->admin : new EE_Admin_Config(); |
292 | - $this->admin = apply_filters( 'FHEE__EE_Config___initialize_config__admin', $this->admin ); |
|
292 | + $this->admin = apply_filters('FHEE__EE_Config___initialize_config__admin', $this->admin); |
|
293 | 293 | |
294 | 294 | $this->template_settings = $this->template_settings instanceof EE_Template_Config |
295 | 295 | ? $this->template_settings : new EE_Template_Config(); |
296 | - $this->template_settings = apply_filters( 'FHEE__EE_Config___initialize_config__template_settings', $this->template_settings ); |
|
296 | + $this->template_settings = apply_filters('FHEE__EE_Config___initialize_config__template_settings', $this->template_settings); |
|
297 | 297 | |
298 | 298 | $this->map_settings = $this->map_settings instanceof EE_Map_Config |
299 | 299 | ? $this->map_settings : new EE_Map_Config(); |
300 | - $this->map_settings = apply_filters( 'FHEE__EE_Config___initialize_config__map_settings', $this->map_settings ); |
|
300 | + $this->map_settings = apply_filters('FHEE__EE_Config___initialize_config__map_settings', $this->map_settings); |
|
301 | 301 | |
302 | 302 | $this->environment = $this->environment instanceof EE_Environment_Config |
303 | 303 | ? $this->environment : new EE_Environment_Config(); |
304 | - $this->environment = apply_filters( 'FHEE__EE_Config___initialize_config__environment', $this->environment ); |
|
304 | + $this->environment = apply_filters('FHEE__EE_Config___initialize_config__environment', $this->environment); |
|
305 | 305 | |
306 | 306 | $this->gateway = $this->gateway instanceof EE_Gateway_Config |
307 | 307 | ? $this->gateway : new EE_Gateway_Config(); |
308 | - $this->gateway = apply_filters( 'FHEE__EE_Config___initialize_config__gateway', $this->gateway ); |
|
308 | + $this->gateway = apply_filters('FHEE__EE_Config___initialize_config__gateway', $this->gateway); |
|
309 | 309 | |
310 | 310 | } |
311 | 311 | |
@@ -319,7 +319,7 @@ discard block |
||
319 | 319 | */ |
320 | 320 | public function get_espresso_config() { |
321 | 321 | // grab espresso configuration |
322 | - return apply_filters( 'FHEE__EE_Config__get_espresso_config__CFG', get_option( 'ee_config', array() )); |
|
322 | + return apply_filters('FHEE__EE_Config__get_espresso_config__CFG', get_option('ee_config', array())); |
|
323 | 323 | } |
324 | 324 | |
325 | 325 | |
@@ -332,12 +332,12 @@ discard block |
||
332 | 332 | * @param $old_value |
333 | 333 | * @param $value |
334 | 334 | */ |
335 | - public function double_check_config_comparison( $option = '', $old_value, $value ) { |
|
335 | + public function double_check_config_comparison($option = '', $old_value, $value) { |
|
336 | 336 | // make sure we're checking the ee config |
337 | - if ( $option == 'ee_config' ) { |
|
337 | + if ($option == 'ee_config') { |
|
338 | 338 | // run a loose comparison of the old value against the new value for type and properties, |
339 | 339 | // but NOT exact instance like WP update_option does |
340 | - if ( $value != $old_value ) { |
|
340 | + if ($value != $old_value) { |
|
341 | 341 | // if they are NOT the same, then remove the hook, |
342 | 342 | // which means the subsequent update results will be based solely on the update query results |
343 | 343 | // the reason we do this is because, as stated above, |
@@ -352,7 +352,7 @@ discard block |
||
352 | 352 | // the string it sees in the db looks the same as the new one it has been passed!!! |
353 | 353 | // This results in the query returning an "affected rows" value of ZERO, |
354 | 354 | // which gets returned immediately by WP update_option and looks like an error. |
355 | - remove_action( 'update_option', array( $this, 'check_config_updated' )); |
|
355 | + remove_action('update_option', array($this, 'check_config_updated')); |
|
356 | 356 | } |
357 | 357 | } |
358 | 358 | } |
@@ -367,11 +367,11 @@ discard block |
||
367 | 367 | */ |
368 | 368 | protected function _reset_espresso_addon_config() { |
369 | 369 | $this->_config_option_names = array(); |
370 | - foreach( $this->addons as $addon_name => $addon_config_obj ) { |
|
371 | - $addon_config_obj = maybe_unserialize( $addon_config_obj ); |
|
372 | - $config_class = get_class( $addon_config_obj ); |
|
373 | - if ( $addon_config_obj instanceof $config_class && ! $addon_config_obj instanceof __PHP_Incomplete_Class ) { |
|
374 | - $this->update_config( 'addons', $addon_name, $addon_config_obj, FALSE ); |
|
370 | + foreach ($this->addons as $addon_name => $addon_config_obj) { |
|
371 | + $addon_config_obj = maybe_unserialize($addon_config_obj); |
|
372 | + $config_class = get_class($addon_config_obj); |
|
373 | + if ($addon_config_obj instanceof $config_class && ! $addon_config_obj instanceof __PHP_Incomplete_Class) { |
|
374 | + $this->update_config('addons', $addon_name, $addon_config_obj, FALSE); |
|
375 | 375 | } |
376 | 376 | $this->addons->{$addon_name} = NULL; |
377 | 377 | } |
@@ -387,17 +387,17 @@ discard block |
||
387 | 387 | * @param bool $add_error |
388 | 388 | * @return bool |
389 | 389 | */ |
390 | - public function update_espresso_config( $add_success = FALSE, $add_error = TRUE ) { |
|
390 | + public function update_espresso_config($add_success = FALSE, $add_error = TRUE) { |
|
391 | 391 | // commented out the following re: https://events.codebasehq.com/projects/event-espresso/tickets/8197 |
392 | 392 | //$clone = clone( self::$_instance ); |
393 | 393 | //self::$_instance = NULL; |
394 | - do_action( 'AHEE__EE_Config__update_espresso_config__begin',$this ); |
|
394 | + do_action('AHEE__EE_Config__update_espresso_config__begin', $this); |
|
395 | 395 | $this->_reset_espresso_addon_config(); |
396 | 396 | // hook into update_option because that happens AFTER the ( $value === $old_value ) conditional |
397 | 397 | // but BEFORE the actual update occurs |
398 | - add_action( 'update_option', array( $this, 'double_check_config_comparison' ), 1, 3 ); |
|
398 | + add_action('update_option', array($this, 'double_check_config_comparison'), 1, 3); |
|
399 | 399 | // now update "ee_config" |
400 | - $saved = update_option( 'ee_config', $this ); |
|
400 | + $saved = update_option('ee_config', $this); |
|
401 | 401 | // if not saved... check if the hook we just added still exists; |
402 | 402 | // if it does, it means one of two things: |
403 | 403 | // that update_option bailed at the ( $value === $old_value ) conditional, |
@@ -408,25 +408,25 @@ discard block |
||
408 | 408 | // but just means no update occurred, so don't display an error to the user. |
409 | 409 | // BUT... if update_option returns FALSE, AND the hook is missing, |
410 | 410 | // then it means that something truly went wrong |
411 | - $saved = ! $saved ? has_action( 'update_option', array( $this, 'double_check_config_comparison' )) : $saved; |
|
411 | + $saved = ! $saved ? has_action('update_option', array($this, 'double_check_config_comparison')) : $saved; |
|
412 | 412 | // remove our action since we don't want it in the system anymore |
413 | - remove_action( 'update_option', array( $this, 'double_check_config_comparison' ), 1 ); |
|
414 | - do_action( 'AHEE__EE_Config__update_espresso_config__end', $this, $saved ); |
|
413 | + remove_action('update_option', array($this, 'double_check_config_comparison'), 1); |
|
414 | + do_action('AHEE__EE_Config__update_espresso_config__end', $this, $saved); |
|
415 | 415 | //self::$_instance = $clone; |
416 | 416 | //unset( $clone ); |
417 | 417 | // if config remains the same or was updated successfully |
418 | - if ( $saved ) { |
|
419 | - if ( $add_success ) { |
|
418 | + if ($saved) { |
|
419 | + if ($add_success) { |
|
420 | 420 | EE_Error::add_success( |
421 | - __( 'The Event Espresso Configuration Settings have been successfully updated.', 'event_espresso' ), |
|
421 | + __('The Event Espresso Configuration Settings have been successfully updated.', 'event_espresso'), |
|
422 | 422 | __FILE__, __FUNCTION__, __LINE__ |
423 | 423 | ); |
424 | 424 | } |
425 | 425 | return TRUE; |
426 | 426 | } else { |
427 | - if ( $add_error ) { |
|
427 | + if ($add_error) { |
|
428 | 428 | EE_Error::add_error( |
429 | - __( 'The Event Espresso Configuration Settings were not updated.', 'event_espresso' ), |
|
429 | + __('The Event Espresso Configuration Settings were not updated.', 'event_espresso'), |
|
430 | 430 | __FILE__, __FUNCTION__, __LINE__ |
431 | 431 | ); |
432 | 432 | } |
@@ -452,20 +452,20 @@ discard block |
||
452 | 452 | $name = '', |
453 | 453 | $config_class = '', |
454 | 454 | $config_obj = NULL, |
455 | - $tests_to_run = array( 1, 2, 3, 4, 5, 6, 7, 8 ), |
|
455 | + $tests_to_run = array(1, 2, 3, 4, 5, 6, 7, 8), |
|
456 | 456 | $display_errors = TRUE |
457 | 457 | ) { |
458 | 458 | try { |
459 | - foreach ( $tests_to_run as $test ) { |
|
460 | - switch ( $test ) { |
|
459 | + foreach ($tests_to_run as $test) { |
|
460 | + switch ($test) { |
|
461 | 461 | |
462 | 462 | // TEST #1 : check that section was set |
463 | 463 | case 1 : |
464 | - if ( empty( $section ) ) { |
|
465 | - if ( $display_errors ) { |
|
464 | + if (empty($section)) { |
|
465 | + if ($display_errors) { |
|
466 | 466 | throw new EE_Error( |
467 | 467 | sprintf( |
468 | - __( 'No configuration section has been provided while attempting to save "%s".', 'event_espresso' ), |
|
468 | + __('No configuration section has been provided while attempting to save "%s".', 'event_espresso'), |
|
469 | 469 | $config_class |
470 | 470 | ) |
471 | 471 | ); |
@@ -476,11 +476,11 @@ discard block |
||
476 | 476 | |
477 | 477 | // TEST #2 : check that settings section exists |
478 | 478 | case 2 : |
479 | - if ( ! isset( $this->{$section} ) ) { |
|
480 | - if ( $display_errors ) { |
|
479 | + if ( ! isset($this->{$section} )) { |
|
480 | + if ($display_errors) { |
|
481 | 481 | throw new EE_Error( |
482 | - sprintf( __( 'The "%s" configuration section does not exist.', 'event_espresso' ), |
|
483 | - $section ) |
|
482 | + sprintf(__('The "%s" configuration section does not exist.', 'event_espresso'), |
|
483 | + $section) |
|
484 | 484 | ); |
485 | 485 | } |
486 | 486 | return false; |
@@ -490,12 +490,12 @@ discard block |
||
490 | 490 | // TEST #3 : check that section is the proper format |
491 | 491 | case 3 : |
492 | 492 | if ( |
493 | - ! ( $this->{$section} instanceof EE_Config_Base || $this->{$section} instanceof stdClass ) |
|
493 | + ! ($this->{$section} instanceof EE_Config_Base || $this->{$section} instanceof stdClass) |
|
494 | 494 | ) { |
495 | - if ( $display_errors ) { |
|
495 | + if ($display_errors) { |
|
496 | 496 | throw new EE_Error( |
497 | 497 | sprintf( |
498 | - __( 'The "%s" configuration settings have not been formatted correctly.', 'event_espresso' ), |
|
498 | + __('The "%s" configuration settings have not been formatted correctly.', 'event_espresso'), |
|
499 | 499 | $section |
500 | 500 | ) |
501 | 501 | ); |
@@ -506,10 +506,10 @@ discard block |
||
506 | 506 | |
507 | 507 | // TEST #4 : check that config section name has been set |
508 | 508 | case 4 : |
509 | - if ( empty( $name ) ) { |
|
510 | - if ( $display_errors ) { |
|
509 | + if (empty($name)) { |
|
510 | + if ($display_errors) { |
|
511 | 511 | throw new EE_Error( |
512 | - __( 'No name has been provided for the specific configuration section.', 'event_espresso' ) |
|
512 | + __('No name has been provided for the specific configuration section.', 'event_espresso') |
|
513 | 513 | ); |
514 | 514 | } |
515 | 515 | return false; |
@@ -518,10 +518,10 @@ discard block |
||
518 | 518 | |
519 | 519 | // TEST #5 : check that a config class name has been set |
520 | 520 | case 5 : |
521 | - if ( empty( $config_class ) ) { |
|
522 | - if ( $display_errors ) { |
|
521 | + if (empty($config_class)) { |
|
522 | + if ($display_errors) { |
|
523 | 523 | throw new EE_Error( |
524 | - __( 'No class name has been provided for the specific configuration section.', 'event_espresso' ) |
|
524 | + __('No class name has been provided for the specific configuration section.', 'event_espresso') |
|
525 | 525 | ); |
526 | 526 | } |
527 | 527 | return false; |
@@ -530,11 +530,11 @@ discard block |
||
530 | 530 | |
531 | 531 | // TEST #6 : verify config class is accessible |
532 | 532 | case 6 : |
533 | - if ( ! class_exists( $config_class ) ) { |
|
534 | - if ( $display_errors ) { |
|
533 | + if ( ! class_exists($config_class)) { |
|
534 | + if ($display_errors) { |
|
535 | 535 | throw new EE_Error( |
536 | 536 | sprintf( |
537 | - __( 'The "%s" class does not exist. Please ensure that an autoloader has been set for it.', 'event_espresso' ), |
|
537 | + __('The "%s" class does not exist. Please ensure that an autoloader has been set for it.', 'event_espresso'), |
|
538 | 538 | $config_class |
539 | 539 | ) |
540 | 540 | ); |
@@ -545,11 +545,11 @@ discard block |
||
545 | 545 | |
546 | 546 | // TEST #7 : check that config has even been set |
547 | 547 | case 7 : |
548 | - if ( ! isset( $this->{$section}->{$name} ) ) { |
|
549 | - if ( $display_errors ) { |
|
548 | + if ( ! isset($this->{$section}->{$name} )) { |
|
549 | + if ($display_errors) { |
|
550 | 550 | throw new EE_Error( |
551 | 551 | sprintf( |
552 | - __( 'No configuration has been set for "%1$s->%2$s".', 'event_espresso' ), |
|
552 | + __('No configuration has been set for "%1$s->%2$s".', 'event_espresso'), |
|
553 | 553 | $section, |
554 | 554 | $name |
555 | 555 | ) |
@@ -558,17 +558,17 @@ discard block |
||
558 | 558 | return false; |
559 | 559 | } else { |
560 | 560 | // and make sure it's not serialized |
561 | - $this->{$section}->{$name} = maybe_unserialize( $this->{$section}->{$name} ); |
|
561 | + $this->{$section}->{$name} = maybe_unserialize($this->{$section}->{$name} ); |
|
562 | 562 | } |
563 | 563 | break; |
564 | 564 | |
565 | 565 | // TEST #8 : check that config is the requested type |
566 | 566 | case 8 : |
567 | - if ( ! $this->{$section}->{$name} instanceof $config_class ) { |
|
568 | - if ( $display_errors ) { |
|
567 | + if ( ! $this->{$section}->{$name} instanceof $config_class) { |
|
568 | + if ($display_errors) { |
|
569 | 569 | throw new EE_Error( |
570 | 570 | sprintf( |
571 | - __( 'The configuration for "%1$s->%2$s" is not of the "%3$s" class.', 'event_espresso' ), |
|
571 | + __('The configuration for "%1$s->%2$s" is not of the "%3$s" class.', 'event_espresso'), |
|
572 | 572 | $section, |
573 | 573 | $name, |
574 | 574 | $config_class |
@@ -581,12 +581,12 @@ discard block |
||
581 | 581 | |
582 | 582 | // TEST #9 : verify config object |
583 | 583 | case 9 : |
584 | - if ( ! $config_obj instanceof EE_Config_Base ) { |
|
585 | - if ( $display_errors ) { |
|
584 | + if ( ! $config_obj instanceof EE_Config_Base) { |
|
585 | + if ($display_errors) { |
|
586 | 586 | throw new EE_Error( |
587 | 587 | sprintf( |
588 | - __( 'The "%s" class is not an instance of EE_Config_Base.', 'event_espresso' ), |
|
589 | - print_r( $config_obj, true ) |
|
588 | + __('The "%s" class is not an instance of EE_Config_Base.', 'event_espresso'), |
|
589 | + print_r($config_obj, true) |
|
590 | 590 | ) |
591 | 591 | ); |
592 | 592 | } |
@@ -597,7 +597,7 @@ discard block |
||
597 | 597 | } |
598 | 598 | } |
599 | 599 | |
600 | - } catch( EE_Error $e ) { |
|
600 | + } catch (EE_Error $e) { |
|
601 | 601 | $e->get_error(); |
602 | 602 | } |
603 | 603 | // you have successfully run the gauntlet |
@@ -614,8 +614,8 @@ discard block |
||
614 | 614 | * @param string $name |
615 | 615 | * @return string |
616 | 616 | */ |
617 | - private function _generate_config_option_name( $section = '', $name = '' ) { |
|
618 | - return 'ee_config-' . strtolower( $section . '-' . str_replace( array( 'EE_', 'EED_' ), '', $name ) ); |
|
617 | + private function _generate_config_option_name($section = '', $name = '') { |
|
618 | + return 'ee_config-'.strtolower($section.'-'.str_replace(array('EE_', 'EED_'), '', $name)); |
|
619 | 619 | } |
620 | 620 | |
621 | 621 | |
@@ -629,10 +629,10 @@ discard block |
||
629 | 629 | * @param string $name |
630 | 630 | * @return string |
631 | 631 | */ |
632 | - private function _set_config_class( $config_class = '', $name = '' ) { |
|
633 | - return ! empty( $config_class ) |
|
632 | + private function _set_config_class($config_class = '', $name = '') { |
|
633 | + return ! empty($config_class) |
|
634 | 634 | ? $config_class |
635 | - : str_replace( ' ', '_', ucwords( str_replace( '_', ' ', $name ) ) ) . '_Config'; |
|
635 | + : str_replace(' ', '_', ucwords(str_replace('_', ' ', $name))).'_Config'; |
|
636 | 636 | } |
637 | 637 | |
638 | 638 | |
@@ -646,34 +646,34 @@ discard block |
||
646 | 646 | * @param EE_Config_Base $config_obj |
647 | 647 | * @return EE_Config_Base |
648 | 648 | */ |
649 | - public function set_config( $section = '', $name = '', $config_class = '', EE_Config_Base $config_obj = null ) { |
|
649 | + public function set_config($section = '', $name = '', $config_class = '', EE_Config_Base $config_obj = null) { |
|
650 | 650 | // ensure config class is set to something |
651 | - $config_class = $this->_set_config_class( $config_class, $name ); |
|
651 | + $config_class = $this->_set_config_class($config_class, $name); |
|
652 | 652 | // run tests 1-4, 6, and 7 to verify all config params are set and valid |
653 | - if ( ! $this->_verify_config_params( $section, $name, $config_class, null, array( 1, 2, 3, 4, 5, 6 ))) { |
|
653 | + if ( ! $this->_verify_config_params($section, $name, $config_class, null, array(1, 2, 3, 4, 5, 6))) { |
|
654 | 654 | return null; |
655 | 655 | } |
656 | - $config_option_name = $this->_generate_config_option_name( $section, $name ); |
|
656 | + $config_option_name = $this->_generate_config_option_name($section, $name); |
|
657 | 657 | // if the config option name hasn't been added yet to the list of option names we're tracking, then do so now |
658 | - if ( ! isset( $this->_config_option_names[ $config_option_name ] )) { |
|
659 | - $this->_config_option_names[ $config_option_name ] = $config_class; |
|
658 | + if ( ! isset($this->_config_option_names[$config_option_name])) { |
|
659 | + $this->_config_option_names[$config_option_name] = $config_class; |
|
660 | 660 | } |
661 | 661 | // verify the incoming config object but suppress errors |
662 | - if ( ! $this->_verify_config_params( $section, $name, $config_class, $config_obj, array( 9 ), false )) { |
|
662 | + if ( ! $this->_verify_config_params($section, $name, $config_class, $config_obj, array(9), false)) { |
|
663 | 663 | $config_obj = new $config_class(); |
664 | 664 | } |
665 | - if ( get_option( $config_option_name ) ) { |
|
666 | - update_option( $config_option_name, $config_obj ); |
|
665 | + if (get_option($config_option_name)) { |
|
666 | + update_option($config_option_name, $config_obj); |
|
667 | 667 | $this->{$section}->{$name} = $config_obj; |
668 | 668 | return $this->{$section}->{$name}; |
669 | 669 | } else { |
670 | 670 | // create a wp-option for this config |
671 | - if ( add_option( $config_option_name, $config_obj, '', 'no' )) { |
|
672 | - $this->{$section}->{$name} = maybe_unserialize( $config_obj ); |
|
671 | + if (add_option($config_option_name, $config_obj, '', 'no')) { |
|
672 | + $this->{$section}->{$name} = maybe_unserialize($config_obj); |
|
673 | 673 | return $this->{$section}->{$name}; |
674 | 674 | } else { |
675 | 675 | EE_Error::add_error( |
676 | - sprintf( __( 'The "%s" could not be saved to the database.', 'event_espresso' ), $config_class ), |
|
676 | + sprintf(__('The "%s" could not be saved to the database.', 'event_espresso'), $config_class), |
|
677 | 677 | __FILE__, __FUNCTION__, __LINE__ |
678 | 678 | ); |
679 | 679 | return null; |
@@ -694,37 +694,37 @@ discard block |
||
694 | 694 | * @param bool $throw_errors |
695 | 695 | * @return bool |
696 | 696 | */ |
697 | - public function update_config( $section = '', $name = '', $config_obj = '', $throw_errors = true ) { |
|
698 | - $config_obj = maybe_unserialize( $config_obj ); |
|
697 | + public function update_config($section = '', $name = '', $config_obj = '', $throw_errors = true) { |
|
698 | + $config_obj = maybe_unserialize($config_obj); |
|
699 | 699 | // get class name of the incoming object |
700 | - $config_class = get_class( $config_obj ); |
|
700 | + $config_class = get_class($config_obj); |
|
701 | 701 | // run tests 1-5 and 9 to verify config |
702 | - if ( ! $this->_verify_config_params( $section, $name, $config_class, $config_obj, array( 1, 2, 3, 4, 7, 9 ))) { |
|
702 | + if ( ! $this->_verify_config_params($section, $name, $config_class, $config_obj, array(1, 2, 3, 4, 7, 9))) { |
|
703 | 703 | return false; |
704 | 704 | } |
705 | - $config_option_name = $this->_generate_config_option_name( $section, $name ); |
|
705 | + $config_option_name = $this->_generate_config_option_name($section, $name); |
|
706 | 706 | // check if config object has been added to db by seeing if config option name is in $this->_config_option_names array |
707 | - if ( ! isset( $this->_config_option_names[ $config_option_name ] )) { |
|
707 | + if ( ! isset($this->_config_option_names[$config_option_name])) { |
|
708 | 708 | // save new config to db |
709 | - return $this->set_config( $section, $name, $config_class, $config_obj ); |
|
709 | + return $this->set_config($section, $name, $config_class, $config_obj); |
|
710 | 710 | } else { |
711 | 711 | // first check if the record already exists |
712 | - $existing_config = get_option( $config_option_name ); |
|
713 | - $config_obj = serialize( $config_obj ); |
|
712 | + $existing_config = get_option($config_option_name); |
|
713 | + $config_obj = serialize($config_obj); |
|
714 | 714 | // just return if db record is already up to date |
715 | - if ( $existing_config == $config_obj ) { |
|
715 | + if ($existing_config == $config_obj) { |
|
716 | 716 | $this->{$section}->{$name} = $config_obj; |
717 | 717 | return true; |
718 | - } else if ( update_option( $config_option_name, $config_obj )) { |
|
718 | + } else if (update_option($config_option_name, $config_obj)) { |
|
719 | 719 | // update wp-option for this config class |
720 | 720 | $this->{$section}->{$name} = $config_obj; |
721 | 721 | return true; |
722 | - } elseif ( $throw_errors ) { |
|
722 | + } elseif ($throw_errors) { |
|
723 | 723 | EE_Error::add_error( |
724 | 724 | sprintf( |
725 | - __( 'The "%1$s" object stored at"%2$s" was not successfully updated in the database.', 'event_espresso' ), |
|
725 | + __('The "%1$s" object stored at"%2$s" was not successfully updated in the database.', 'event_espresso'), |
|
726 | 726 | $config_class, |
727 | - 'EE_Config->' . $section . '->' . $name |
|
727 | + 'EE_Config->'.$section.'->'.$name |
|
728 | 728 | ), |
729 | 729 | __FILE__, __FUNCTION__, __LINE__ |
730 | 730 | ); |
@@ -744,34 +744,34 @@ discard block |
||
744 | 744 | * @param string $config_class |
745 | 745 | * @return mixed EE_Config_Base | NULL |
746 | 746 | */ |
747 | - public function get_config( $section = '', $name = '', $config_class = '' ) { |
|
747 | + public function get_config($section = '', $name = '', $config_class = '') { |
|
748 | 748 | // ensure config class is set to something |
749 | - $config_class = $this->_set_config_class( $config_class, $name ); |
|
749 | + $config_class = $this->_set_config_class($config_class, $name); |
|
750 | 750 | // run tests 1-4, 6 and 7 to verify that all params have been set |
751 | - if ( ! $this->_verify_config_params( $section, $name, $config_class, NULL, array( 1, 2, 3, 4, 5, 6 ))) { |
|
751 | + if ( ! $this->_verify_config_params($section, $name, $config_class, NULL, array(1, 2, 3, 4, 5, 6))) { |
|
752 | 752 | return NULL; |
753 | 753 | } |
754 | 754 | // now test if the requested config object exists, but suppress errors |
755 | - if ( $this->_verify_config_params( $section, $name, $config_class, NULL, array( 7, 8 ), FALSE )) { |
|
755 | + if ($this->_verify_config_params($section, $name, $config_class, NULL, array(7, 8), FALSE)) { |
|
756 | 756 | // config already exists, so pass it back |
757 | 757 | return $this->{$section}->{$name}; |
758 | 758 | } |
759 | 759 | // load config option from db if it exists |
760 | - $config_obj = $this->get_config_option( $this->_generate_config_option_name( $section, $name )); |
|
760 | + $config_obj = $this->get_config_option($this->_generate_config_option_name($section, $name)); |
|
761 | 761 | // verify the newly retrieved config object, but suppress errors |
762 | - if ( $this->_verify_config_params( $section, $name, $config_class, $config_obj, array( 9 ), FALSE )) { |
|
762 | + if ($this->_verify_config_params($section, $name, $config_class, $config_obj, array(9), FALSE)) { |
|
763 | 763 | // config is good, so set it and pass it back |
764 | 764 | $this->{$section}->{$name} = $config_obj; |
765 | 765 | return $this->{$section}->{$name}; |
766 | 766 | } |
767 | 767 | // oops! $config_obj is not already set and does not exist in the db, so create a new one |
768 | - $config_obj =$this->set_config( $section, $name, $config_class ); |
|
768 | + $config_obj = $this->set_config($section, $name, $config_class); |
|
769 | 769 | // verify the newly created config object |
770 | - if ( $this->_verify_config_params( $section, $name, $config_class, $config_obj, array( 9 ))) { |
|
770 | + if ($this->_verify_config_params($section, $name, $config_class, $config_obj, array(9))) { |
|
771 | 771 | return $this->{$section}->{$name}; |
772 | 772 | } else { |
773 | 773 | EE_Error::add_error( |
774 | - sprintf( __( 'The "%s" could not be retrieved from the database.', 'event_espresso' ), $config_class ), |
|
774 | + sprintf(__('The "%s" could not be retrieved from the database.', 'event_espresso'), $config_class), |
|
775 | 775 | __FILE__, __FUNCTION__, __LINE__ |
776 | 776 | ); |
777 | 777 | } |
@@ -786,9 +786,9 @@ discard block |
||
786 | 786 | * @param string $config_option_name |
787 | 787 | * @return mixed EE_Config_Base | FALSE |
788 | 788 | */ |
789 | - public function get_config_option( $config_option_name = '' ) { |
|
789 | + public function get_config_option($config_option_name = '') { |
|
790 | 790 | // retrieve the wp-option for this config class. |
791 | - return maybe_unserialize( get_option( $config_option_name )); |
|
791 | + return maybe_unserialize(get_option($config_option_name)); |
|
792 | 792 | } |
793 | 793 | |
794 | 794 | |
@@ -801,45 +801,45 @@ discard block |
||
801 | 801 | * @param $page_for_posts |
802 | 802 | * @return void |
803 | 803 | */ |
804 | - public function update_post_shortcodes( $page_for_posts = '' ) { |
|
804 | + public function update_post_shortcodes($page_for_posts = '') { |
|
805 | 805 | // make sure page_for_posts is set |
806 | - $page_for_posts = ! empty( $page_for_posts ) ? $page_for_posts : EE_Config::get_page_for_posts(); |
|
806 | + $page_for_posts = ! empty($page_for_posts) ? $page_for_posts : EE_Config::get_page_for_posts(); |
|
807 | 807 | // critical page shortcodes that we do NOT want added to the Posts page (blog) |
808 | 808 | $critical_shortcodes = $this->core->get_critical_pages_shortcodes_array(); |
809 | 809 | // allow others to mess stuff up :D |
810 | - do_action( 'AHEE__EE_Config__update_post_shortcodes', $this->core->post_shortcodes, $page_for_posts ); |
|
810 | + do_action('AHEE__EE_Config__update_post_shortcodes', $this->core->post_shortcodes, $page_for_posts); |
|
811 | 811 | // verify that post_shortcodes is set |
812 | - $this->core->post_shortcodes = isset( $this->core->post_shortcodes ) && is_array( $this->core->post_shortcodes ) ? $this->core->post_shortcodes : array(); |
|
812 | + $this->core->post_shortcodes = isset($this->core->post_shortcodes) && is_array($this->core->post_shortcodes) ? $this->core->post_shortcodes : array(); |
|
813 | 813 | // cycle thru post_shortcodes |
814 | - foreach( $this->core->post_shortcodes as $post_name => $shortcodes ){ |
|
814 | + foreach ($this->core->post_shortcodes as $post_name => $shortcodes) { |
|
815 | 815 | // are there any shortcodes to track ? |
816 | - if ( ! empty( $shortcodes )) { |
|
816 | + if ( ! empty($shortcodes)) { |
|
817 | 817 | // loop thru list of tracked shortcodes |
818 | - foreach( $shortcodes as $shortcode => $post_id ) { |
|
818 | + foreach ($shortcodes as $shortcode => $post_id) { |
|
819 | 819 | // if shortcode is for a critical page, BUT this is NOT the corresponding critical page for that shortcode |
820 | - if ( isset( $critical_shortcodes[ $post_id ] ) && $post_name == $page_for_posts ) { |
|
820 | + if (isset($critical_shortcodes[$post_id]) && $post_name == $page_for_posts) { |
|
821 | 821 | // then remove this shortcode, because we don't want critical page shortcodes like ESPRESSO_TXN_PAGE running on the "Posts Page" (blog) |
822 | - unset( $this->core->post_shortcodes[ $post_name ][ $shortcode ] ); |
|
822 | + unset($this->core->post_shortcodes[$post_name][$shortcode]); |
|
823 | 823 | } |
824 | 824 | // skip the posts page, because we want all shortcodes registered for it |
825 | - if ( $post_name == $page_for_posts ) { |
|
825 | + if ($post_name == $page_for_posts) { |
|
826 | 826 | continue; |
827 | 827 | } |
828 | 828 | // make sure post still exists |
829 | - $post = get_post( $post_id ); |
|
830 | - if ( $post ) { |
|
829 | + $post = get_post($post_id); |
|
830 | + if ($post) { |
|
831 | 831 | // check that the post name matches what we have saved |
832 | - if ( $post->post_name == $post_name ) { |
|
832 | + if ($post->post_name == $post_name) { |
|
833 | 833 | // if so, then break before hitting the unset below |
834 | 834 | continue; |
835 | 835 | } |
836 | 836 | } |
837 | 837 | // we don't like missing posts around here >:( |
838 | - unset( $this->core->post_shortcodes[ $post_name ] ); |
|
838 | + unset($this->core->post_shortcodes[$post_name]); |
|
839 | 839 | } |
840 | 840 | } else { |
841 | 841 | // you got no shortcodes to keep track of ! |
842 | - unset( $this->core->post_shortcodes[ $post_name ] ); |
|
842 | + unset($this->core->post_shortcodes[$post_name]); |
|
843 | 843 | } |
844 | 844 | } |
845 | 845 | //only show errors |
@@ -858,14 +858,14 @@ discard block |
||
858 | 858 | * @return string |
859 | 859 | */ |
860 | 860 | public static function get_page_for_posts() { |
861 | - $page_for_posts = get_option( 'page_for_posts' ); |
|
862 | - if ( ! $page_for_posts ) { |
|
861 | + $page_for_posts = get_option('page_for_posts'); |
|
862 | + if ( ! $page_for_posts) { |
|
863 | 863 | return 'posts'; |
864 | 864 | } |
865 | 865 | /** @type WPDB $wpdb */ |
866 | 866 | global $wpdb; |
867 | 867 | $SQL = "SELECT post_name from $wpdb->posts WHERE post_type='posts' OR post_type='page' AND post_status='publish' AND ID=%d"; |
868 | - return $wpdb->get_var( $wpdb->prepare( $SQL, $page_for_posts )); |
|
868 | + return $wpdb->get_var($wpdb->prepare($SQL, $page_for_posts)); |
|
869 | 869 | } |
870 | 870 | |
871 | 871 | |
@@ -882,7 +882,7 @@ discard block |
||
882 | 882 | */ |
883 | 883 | public function register_shortcodes_and_modules() { |
884 | 884 | // allow shortcodes to register with WP and to set hooks for the rest of the system |
885 | - EE_Registry::instance()->shortcodes =$this->_register_shortcodes(); |
|
885 | + EE_Registry::instance()->shortcodes = $this->_register_shortcodes(); |
|
886 | 886 | // allow modules to set hooks for the rest of the system |
887 | 887 | EE_Registry::instance()->modules = $this->_register_modules(); |
888 | 888 | } |
@@ -914,21 +914,21 @@ discard block |
||
914 | 914 | public function widgets_init() { |
915 | 915 | //only init widgets on admin pages when not in complete maintenance, and |
916 | 916 | //on frontend when not in any maintenance mode |
917 | - if (( is_admin() && EE_Maintenance_Mode::instance()->level() != EE_Maintenance_Mode::level_2_complete_maintenance) || ! EE_Maintenance_Mode::instance()->level() ) { |
|
917 | + if ((is_admin() && EE_Maintenance_Mode::instance()->level() != EE_Maintenance_Mode::level_2_complete_maintenance) || ! EE_Maintenance_Mode::instance()->level()) { |
|
918 | 918 | // grab list of installed widgets |
919 | - $widgets_to_register = glob( EE_WIDGETS . '*', GLOB_ONLYDIR ); |
|
919 | + $widgets_to_register = glob(EE_WIDGETS.'*', GLOB_ONLYDIR); |
|
920 | 920 | // filter list of modules to register |
921 | - $widgets_to_register = apply_filters( 'FHEE__EE_Config__register_widgets__widgets_to_register', $widgets_to_register ); |
|
921 | + $widgets_to_register = apply_filters('FHEE__EE_Config__register_widgets__widgets_to_register', $widgets_to_register); |
|
922 | 922 | |
923 | - if ( ! empty( $widgets_to_register ) ) { |
|
923 | + if ( ! empty($widgets_to_register)) { |
|
924 | 924 | // cycle thru widget folders |
925 | - foreach ( $widgets_to_register as $widget_path ) { |
|
925 | + foreach ($widgets_to_register as $widget_path) { |
|
926 | 926 | // add to list of installed widget modules |
927 | - EE_Config::register_ee_widget( $widget_path ); |
|
927 | + EE_Config::register_ee_widget($widget_path); |
|
928 | 928 | } |
929 | 929 | } |
930 | 930 | // filter list of installed modules |
931 | - EE_Registry::instance()->widgets = apply_filters( 'FHEE__EE_Config__register_widgets__installed_widgets', EE_Registry::instance()->widgets ); |
|
931 | + EE_Registry::instance()->widgets = apply_filters('FHEE__EE_Config__register_widgets__installed_widgets', EE_Registry::instance()->widgets); |
|
932 | 932 | } |
933 | 933 | } |
934 | 934 | |
@@ -941,54 +941,54 @@ discard block |
||
941 | 941 | * @param string $widget_path - full path up to and including widget folder |
942 | 942 | * @return void |
943 | 943 | */ |
944 | - public static function register_ee_widget( $widget_path = NULL ) { |
|
945 | - do_action( 'AHEE__EE_Config__register_widget__begin', $widget_path ); |
|
944 | + public static function register_ee_widget($widget_path = NULL) { |
|
945 | + do_action('AHEE__EE_Config__register_widget__begin', $widget_path); |
|
946 | 946 | $widget_ext = '.widget.php'; |
947 | 947 | // make all separators match |
948 | - $widget_path = rtrim( str_replace( '/\\', DS, $widget_path ), DS ); |
|
948 | + $widget_path = rtrim(str_replace('/\\', DS, $widget_path), DS); |
|
949 | 949 | // does the file path INCLUDE the actual file name as part of the path ? |
950 | - if ( strpos( $widget_path, $widget_ext ) !== FALSE ) { |
|
950 | + if (strpos($widget_path, $widget_ext) !== FALSE) { |
|
951 | 951 | // grab and shortcode file name from directory name and break apart at dots |
952 | - $file_name = explode( '.', basename( $widget_path )); |
|
952 | + $file_name = explode('.', basename($widget_path)); |
|
953 | 953 | // take first segment from file name pieces and remove class prefix if it exists |
954 | - $widget = strpos( $file_name[0], 'EEW_' ) === 0 ? substr( $file_name[0], 4 ) : $file_name[0]; |
|
954 | + $widget = strpos($file_name[0], 'EEW_') === 0 ? substr($file_name[0], 4) : $file_name[0]; |
|
955 | 955 | // sanitize shortcode directory name |
956 | - $widget = sanitize_key( $widget ); |
|
956 | + $widget = sanitize_key($widget); |
|
957 | 957 | // now we need to rebuild the shortcode path |
958 | - $widget_path = explode( DS, $widget_path ); |
|
958 | + $widget_path = explode(DS, $widget_path); |
|
959 | 959 | // remove last segment |
960 | - array_pop( $widget_path ); |
|
960 | + array_pop($widget_path); |
|
961 | 961 | // glue it back together |
962 | - $widget_path = implode( DS, $widget_path ); |
|
962 | + $widget_path = implode(DS, $widget_path); |
|
963 | 963 | } else { |
964 | 964 | // grab and sanitize widget directory name |
965 | - $widget = sanitize_key( basename( $widget_path )); |
|
965 | + $widget = sanitize_key(basename($widget_path)); |
|
966 | 966 | } |
967 | 967 | // create classname from widget directory name |
968 | - $widget = str_replace( ' ', '_', ucwords( str_replace( '_', ' ', $widget ))); |
|
968 | + $widget = str_replace(' ', '_', ucwords(str_replace('_', ' ', $widget))); |
|
969 | 969 | // add class prefix |
970 | - $widget_class = 'EEW_' . $widget; |
|
970 | + $widget_class = 'EEW_'.$widget; |
|
971 | 971 | // does the widget exist ? |
972 | - if ( ! is_readable( $widget_path . DS . $widget_class . $widget_ext )) { |
|
972 | + if ( ! is_readable($widget_path.DS.$widget_class.$widget_ext)) { |
|
973 | 973 | $msg = sprintf( |
974 | - __( 'The requested %s widget file could not be found or is not readable due to file permissions. Please ensure the following path is correct: %s', 'event_espresso' ), |
|
974 | + __('The requested %s widget file could not be found or is not readable due to file permissions. Please ensure the following path is correct: %s', 'event_espresso'), |
|
975 | 975 | $widget_class, |
976 | - $widget_path . DS . $widget_class . $widget_ext |
|
976 | + $widget_path.DS.$widget_class.$widget_ext |
|
977 | 977 | ); |
978 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
978 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
979 | 979 | return; |
980 | 980 | } |
981 | 981 | // load the widget class file |
982 | - require_once( $widget_path . DS . $widget_class . $widget_ext ); |
|
982 | + require_once($widget_path.DS.$widget_class.$widget_ext); |
|
983 | 983 | // verify that class exists |
984 | - if ( ! class_exists( $widget_class )) { |
|
985 | - $msg = sprintf( __( 'The requested %s widget class does not exist.', 'event_espresso' ), $widget_class ); |
|
986 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
984 | + if ( ! class_exists($widget_class)) { |
|
985 | + $msg = sprintf(__('The requested %s widget class does not exist.', 'event_espresso'), $widget_class); |
|
986 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
987 | 987 | return; |
988 | 988 | } |
989 | - register_widget( $widget_class ); |
|
989 | + register_widget($widget_class); |
|
990 | 990 | // add to array of registered widgets |
991 | - EE_Registry::instance()->widgets->{$widget_class} = $widget_path . DS . $widget_class . $widget_ext; |
|
991 | + EE_Registry::instance()->widgets->{$widget_class} = $widget_path.DS.$widget_class.$widget_ext; |
|
992 | 992 | } |
993 | 993 | |
994 | 994 | |
@@ -1001,18 +1001,18 @@ discard block |
||
1001 | 1001 | */ |
1002 | 1002 | private function _register_shortcodes() { |
1003 | 1003 | // grab list of installed shortcodes |
1004 | - $shortcodes_to_register = glob( EE_SHORTCODES . '*', GLOB_ONLYDIR ); |
|
1004 | + $shortcodes_to_register = glob(EE_SHORTCODES.'*', GLOB_ONLYDIR); |
|
1005 | 1005 | // filter list of modules to register |
1006 | - $shortcodes_to_register = apply_filters( 'FHEE__EE_Config__register_shortcodes__shortcodes_to_register', $shortcodes_to_register ); |
|
1007 | - if ( ! empty( $shortcodes_to_register ) ) { |
|
1006 | + $shortcodes_to_register = apply_filters('FHEE__EE_Config__register_shortcodes__shortcodes_to_register', $shortcodes_to_register); |
|
1007 | + if ( ! empty($shortcodes_to_register)) { |
|
1008 | 1008 | // cycle thru shortcode folders |
1009 | - foreach ( $shortcodes_to_register as $shortcode_path ) { |
|
1009 | + foreach ($shortcodes_to_register as $shortcode_path) { |
|
1010 | 1010 | // add to list of installed shortcode modules |
1011 | - EE_Config::register_shortcode( $shortcode_path ); |
|
1011 | + EE_Config::register_shortcode($shortcode_path); |
|
1012 | 1012 | } |
1013 | 1013 | } |
1014 | 1014 | // filter list of installed modules |
1015 | - return apply_filters( 'FHEE__EE_Config___register_shortcodes__installed_shortcodes', EE_Registry::instance()->shortcodes ); |
|
1015 | + return apply_filters('FHEE__EE_Config___register_shortcodes__installed_shortcodes', EE_Registry::instance()->shortcodes); |
|
1016 | 1016 | } |
1017 | 1017 | |
1018 | 1018 | |
@@ -1024,56 +1024,56 @@ discard block |
||
1024 | 1024 | * @param string $shortcode_path - full path up to and including shortcode folder |
1025 | 1025 | * @return bool |
1026 | 1026 | */ |
1027 | - public static function register_shortcode( $shortcode_path = NULL ) { |
|
1028 | - do_action( 'AHEE__EE_Config__register_shortcode__begin',$shortcode_path ); |
|
1027 | + public static function register_shortcode($shortcode_path = NULL) { |
|
1028 | + do_action('AHEE__EE_Config__register_shortcode__begin', $shortcode_path); |
|
1029 | 1029 | $shortcode_ext = '.shortcode.php'; |
1030 | 1030 | // make all separators match |
1031 | - $shortcode_path = str_replace( array( '\\', '/' ), DS, $shortcode_path ); |
|
1031 | + $shortcode_path = str_replace(array('\\', '/'), DS, $shortcode_path); |
|
1032 | 1032 | // does the file path INCLUDE the actual file name as part of the path ? |
1033 | - if ( strpos( $shortcode_path, $shortcode_ext ) !== FALSE ) { |
|
1033 | + if (strpos($shortcode_path, $shortcode_ext) !== FALSE) { |
|
1034 | 1034 | // grab shortcode file name from directory name and break apart at dots |
1035 | - $shortcode_file = explode( '.', basename( $shortcode_path )); |
|
1035 | + $shortcode_file = explode('.', basename($shortcode_path)); |
|
1036 | 1036 | // take first segment from file name pieces and remove class prefix if it exists |
1037 | - $shortcode = strpos( $shortcode_file[0], 'EES_' ) === 0 ? substr( $shortcode_file[0], 4 ) : $shortcode_file[0]; |
|
1037 | + $shortcode = strpos($shortcode_file[0], 'EES_') === 0 ? substr($shortcode_file[0], 4) : $shortcode_file[0]; |
|
1038 | 1038 | // sanitize shortcode directory name |
1039 | - $shortcode = sanitize_key( $shortcode ); |
|
1039 | + $shortcode = sanitize_key($shortcode); |
|
1040 | 1040 | // now we need to rebuild the shortcode path |
1041 | - $shortcode_path = explode( DS, $shortcode_path ); |
|
1041 | + $shortcode_path = explode(DS, $shortcode_path); |
|
1042 | 1042 | // remove last segment |
1043 | - array_pop( $shortcode_path ); |
|
1043 | + array_pop($shortcode_path); |
|
1044 | 1044 | // glue it back together |
1045 | - $shortcode_path = implode( DS, $shortcode_path ) . DS; |
|
1045 | + $shortcode_path = implode(DS, $shortcode_path).DS; |
|
1046 | 1046 | } else { |
1047 | 1047 | // we need to generate the filename based off of the folder name |
1048 | 1048 | // grab and sanitize shortcode directory name |
1049 | - $shortcode = sanitize_key( basename( $shortcode_path )); |
|
1050 | - $shortcode_path = rtrim( $shortcode_path, DS ) . DS; |
|
1049 | + $shortcode = sanitize_key(basename($shortcode_path)); |
|
1050 | + $shortcode_path = rtrim($shortcode_path, DS).DS; |
|
1051 | 1051 | } |
1052 | 1052 | // create classname from shortcode directory or file name |
1053 | - $shortcode = str_replace( ' ', '_', ucwords( str_replace( '_', ' ', $shortcode ))); |
|
1053 | + $shortcode = str_replace(' ', '_', ucwords(str_replace('_', ' ', $shortcode))); |
|
1054 | 1054 | // add class prefix |
1055 | - $shortcode_class = 'EES_' . $shortcode; |
|
1055 | + $shortcode_class = 'EES_'.$shortcode; |
|
1056 | 1056 | // does the shortcode exist ? |
1057 | - if ( ! is_readable( $shortcode_path . DS . $shortcode_class . $shortcode_ext )) { |
|
1057 | + if ( ! is_readable($shortcode_path.DS.$shortcode_class.$shortcode_ext)) { |
|
1058 | 1058 | $msg = sprintf( |
1059 | - __( 'The requested %s shortcode file could not be found or is not readable due to file permissions. It should be in %s', 'event_espresso' ), |
|
1059 | + __('The requested %s shortcode file could not be found or is not readable due to file permissions. It should be in %s', 'event_espresso'), |
|
1060 | 1060 | $shortcode_class, |
1061 | - $shortcode_path . DS . $shortcode_class . $shortcode_ext |
|
1061 | + $shortcode_path.DS.$shortcode_class.$shortcode_ext |
|
1062 | 1062 | ); |
1063 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1063 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1064 | 1064 | return FALSE; |
1065 | 1065 | } |
1066 | 1066 | // load the shortcode class file |
1067 | - require_once( $shortcode_path . $shortcode_class . $shortcode_ext ); |
|
1067 | + require_once($shortcode_path.$shortcode_class.$shortcode_ext); |
|
1068 | 1068 | // verify that class exists |
1069 | - if ( ! class_exists( $shortcode_class )) { |
|
1070 | - $msg = sprintf( __( 'The requested %s shortcode class does not exist.', 'event_espresso' ), $shortcode_class ); |
|
1071 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1069 | + if ( ! class_exists($shortcode_class)) { |
|
1070 | + $msg = sprintf(__('The requested %s shortcode class does not exist.', 'event_espresso'), $shortcode_class); |
|
1071 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1072 | 1072 | return FALSE; |
1073 | 1073 | } |
1074 | - $shortcode = strtoupper( $shortcode ); |
|
1074 | + $shortcode = strtoupper($shortcode); |
|
1075 | 1075 | // add to array of registered shortcodes |
1076 | - EE_Registry::instance()->shortcodes->{$shortcode} = $shortcode_path . $shortcode_class . $shortcode_ext; |
|
1076 | + EE_Registry::instance()->shortcodes->{$shortcode} = $shortcode_path.$shortcode_class.$shortcode_ext; |
|
1077 | 1077 | return TRUE; |
1078 | 1078 | } |
1079 | 1079 | |
@@ -1088,23 +1088,23 @@ discard block |
||
1088 | 1088 | */ |
1089 | 1089 | private function _register_modules() { |
1090 | 1090 | // grab list of installed modules |
1091 | - $modules_to_register = glob( EE_MODULES . '*', GLOB_ONLYDIR ); |
|
1091 | + $modules_to_register = glob(EE_MODULES.'*', GLOB_ONLYDIR); |
|
1092 | 1092 | // filter list of modules to register |
1093 | - $modules_to_register = apply_filters( 'FHEE__EE_Config__register_modules__modules_to_register', $modules_to_register ); |
|
1093 | + $modules_to_register = apply_filters('FHEE__EE_Config__register_modules__modules_to_register', $modules_to_register); |
|
1094 | 1094 | |
1095 | 1095 | |
1096 | - if ( ! empty( $modules_to_register ) ) { |
|
1096 | + if ( ! empty($modules_to_register)) { |
|
1097 | 1097 | // loop through folders |
1098 | - foreach ( $modules_to_register as $module_path ) { |
|
1098 | + foreach ($modules_to_register as $module_path) { |
|
1099 | 1099 | /**TEMPORARILY EXCLUDE gateways from modules for time being**/ |
1100 | - if ( $module_path != EE_MODULES . 'zzz-copy-this-module-template' && $module_path != EE_MODULES . 'gateways' ) { |
|
1100 | + if ($module_path != EE_MODULES.'zzz-copy-this-module-template' && $module_path != EE_MODULES.'gateways') { |
|
1101 | 1101 | // add to list of installed modules |
1102 | - EE_Config::register_module( $module_path ); |
|
1102 | + EE_Config::register_module($module_path); |
|
1103 | 1103 | } |
1104 | 1104 | } |
1105 | 1105 | } |
1106 | 1106 | // filter list of installed modules |
1107 | - return apply_filters( 'FHEE__EE_Config___register_modules__installed_modules', EE_Registry::instance()->modules ); |
|
1107 | + return apply_filters('FHEE__EE_Config___register_modules__installed_modules', EE_Registry::instance()->modules); |
|
1108 | 1108 | } |
1109 | 1109 | |
1110 | 1110 | |
@@ -1117,54 +1117,54 @@ discard block |
||
1117 | 1117 | * @param string $module_path - full path up to and including module folder |
1118 | 1118 | * @return bool |
1119 | 1119 | */ |
1120 | - public static function register_module( $module_path = NULL ) { |
|
1121 | - do_action( 'AHEE__EE_Config__register_module__begin', $module_path ); |
|
1120 | + public static function register_module($module_path = NULL) { |
|
1121 | + do_action('AHEE__EE_Config__register_module__begin', $module_path); |
|
1122 | 1122 | $module_ext = '.module.php'; |
1123 | 1123 | // make all separators match |
1124 | - $module_path = str_replace( array( '\\', '/' ), DS, $module_path ); |
|
1124 | + $module_path = str_replace(array('\\', '/'), DS, $module_path); |
|
1125 | 1125 | // does the file path INCLUDE the actual file name as part of the path ? |
1126 | - if ( strpos( $module_path, $module_ext ) !== FALSE ) { |
|
1126 | + if (strpos($module_path, $module_ext) !== FALSE) { |
|
1127 | 1127 | // grab and shortcode file name from directory name and break apart at dots |
1128 | - $module_file = explode( '.', basename( $module_path )); |
|
1128 | + $module_file = explode('.', basename($module_path)); |
|
1129 | 1129 | // now we need to rebuild the shortcode path |
1130 | - $module_path = explode( DS, $module_path ); |
|
1130 | + $module_path = explode(DS, $module_path); |
|
1131 | 1131 | // remove last segment |
1132 | - array_pop( $module_path ); |
|
1132 | + array_pop($module_path); |
|
1133 | 1133 | // glue it back together |
1134 | - $module_path = implode( DS, $module_path ) . DS; |
|
1134 | + $module_path = implode(DS, $module_path).DS; |
|
1135 | 1135 | // take first segment from file name pieces and sanitize it |
1136 | - $module = preg_replace( '/[^a-zA-Z0-9_\-]/', '', $module_file[0] ); |
|
1136 | + $module = preg_replace('/[^a-zA-Z0-9_\-]/', '', $module_file[0]); |
|
1137 | 1137 | // ensure class prefix is added |
1138 | - $module_class = strpos( $module, 'EED_' ) !== 0 ? 'EED_' . $module : $module; |
|
1138 | + $module_class = strpos($module, 'EED_') !== 0 ? 'EED_'.$module : $module; |
|
1139 | 1139 | } else { |
1140 | 1140 | // we need to generate the filename based off of the folder name |
1141 | 1141 | // grab and sanitize module name |
1142 | - $module = strtolower( basename( $module_path )); |
|
1143 | - $module = preg_replace( '/[^a-z0-9_\-]/', '', $module); |
|
1142 | + $module = strtolower(basename($module_path)); |
|
1143 | + $module = preg_replace('/[^a-z0-9_\-]/', '', $module); |
|
1144 | 1144 | // like trailingslashit() |
1145 | - $module_path = rtrim( $module_path, DS ) . DS; |
|
1145 | + $module_path = rtrim($module_path, DS).DS; |
|
1146 | 1146 | // create classname from module directory name |
1147 | - $module = str_replace( ' ', '_', ucwords( str_replace( '_', ' ', $module ))); |
|
1147 | + $module = str_replace(' ', '_', ucwords(str_replace('_', ' ', $module))); |
|
1148 | 1148 | // add class prefix |
1149 | - $module_class = 'EED_' . $module; |
|
1149 | + $module_class = 'EED_'.$module; |
|
1150 | 1150 | } |
1151 | 1151 | // does the module exist ? |
1152 | - if ( ! is_readable( $module_path . DS . $module_class . $module_ext )) { |
|
1153 | - $msg = sprintf( __( 'The requested %s module file could not be found or is not readable due to file permissions.', 'event_espresso' ), $module ); |
|
1154 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1152 | + if ( ! is_readable($module_path.DS.$module_class.$module_ext)) { |
|
1153 | + $msg = sprintf(__('The requested %s module file could not be found or is not readable due to file permissions.', 'event_espresso'), $module); |
|
1154 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1155 | 1155 | return FALSE; |
1156 | 1156 | } |
1157 | 1157 | // load the module class file |
1158 | - require_once( $module_path . $module_class . $module_ext ); |
|
1158 | + require_once($module_path.$module_class.$module_ext); |
|
1159 | 1159 | // verify that class exists |
1160 | - if ( ! class_exists( $module_class )) { |
|
1161 | - $msg = sprintf( __( 'The requested %s module class does not exist.', 'event_espresso' ), $module_class ); |
|
1162 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1160 | + if ( ! class_exists($module_class)) { |
|
1161 | + $msg = sprintf(__('The requested %s module class does not exist.', 'event_espresso'), $module_class); |
|
1162 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1163 | 1163 | return FALSE; |
1164 | 1164 | } |
1165 | 1165 | // add to array of registered modules |
1166 | - EE_Registry::instance()->modules->{$module_class} = $module_path . $module_class . $module_ext; |
|
1167 | - do_action( 'AHEE__EE_Config__register_module__complete', $module_class, EE_Registry::instance()->modules->{$module_class} ); |
|
1166 | + EE_Registry::instance()->modules->{$module_class} = $module_path.$module_class.$module_ext; |
|
1167 | + do_action('AHEE__EE_Config__register_module__complete', $module_class, EE_Registry::instance()->modules->{$module_class} ); |
|
1168 | 1168 | return TRUE; |
1169 | 1169 | } |
1170 | 1170 | |
@@ -1178,23 +1178,23 @@ discard block |
||
1178 | 1178 | */ |
1179 | 1179 | private function _initialize_shortcodes() { |
1180 | 1180 | // cycle thru shortcode folders |
1181 | - foreach ( EE_Registry::instance()->shortcodes as $shortcode => $shortcode_path ) { |
|
1181 | + foreach (EE_Registry::instance()->shortcodes as $shortcode => $shortcode_path) { |
|
1182 | 1182 | // add class prefix |
1183 | - $shortcode_class = 'EES_' . $shortcode; |
|
1183 | + $shortcode_class = 'EES_'.$shortcode; |
|
1184 | 1184 | // fire the shortcode class's set_hooks methods in case it needs to hook into other parts of the system |
1185 | 1185 | // which set hooks ? |
1186 | - if ( is_admin() ) { |
|
1186 | + if (is_admin()) { |
|
1187 | 1187 | // fire immediately |
1188 | - call_user_func( array( $shortcode_class, 'set_hooks_admin' )); |
|
1188 | + call_user_func(array($shortcode_class, 'set_hooks_admin')); |
|
1189 | 1189 | } else { |
1190 | 1190 | // delay until other systems are online |
1191 | - add_action( 'AHEE__EE_System__set_hooks_for_shortcodes_modules_and_addons', array( $shortcode_class,'set_hooks' )); |
|
1191 | + add_action('AHEE__EE_System__set_hooks_for_shortcodes_modules_and_addons', array($shortcode_class, 'set_hooks')); |
|
1192 | 1192 | // convert classname to UPPERCASE and create WP shortcode. |
1193 | - $shortcode_tag = strtoupper( $shortcode ); |
|
1193 | + $shortcode_tag = strtoupper($shortcode); |
|
1194 | 1194 | // but first check if the shortcode has already been added before assigning 'fallback_shortcode_processor' |
1195 | - if ( ! shortcode_exists( $shortcode_tag )) { |
|
1195 | + if ( ! shortcode_exists($shortcode_tag)) { |
|
1196 | 1196 | // NOTE: this shortcode declaration will get overridden if the shortcode is successfully detected in the post content in EE_Front_Controller->_initialize_shortcodes() |
1197 | - add_shortcode( $shortcode_tag, array( $shortcode_class, 'fallback_shortcode_processor' )); |
|
1197 | + add_shortcode($shortcode_tag, array($shortcode_class, 'fallback_shortcode_processor')); |
|
1198 | 1198 | } |
1199 | 1199 | } |
1200 | 1200 | } |
@@ -1211,15 +1211,15 @@ discard block |
||
1211 | 1211 | */ |
1212 | 1212 | private function _initialize_modules() { |
1213 | 1213 | // cycle thru shortcode folders |
1214 | - foreach ( EE_Registry::instance()->modules as $module_class => $module_path ) { |
|
1214 | + foreach (EE_Registry::instance()->modules as $module_class => $module_path) { |
|
1215 | 1215 | // fire the shortcode class's set_hooks methods in case it needs to hook into other parts of the system |
1216 | 1216 | // which set hooks ? |
1217 | - if ( is_admin() ) { |
|
1217 | + if (is_admin()) { |
|
1218 | 1218 | // fire immediately |
1219 | - call_user_func( array( $module_class, 'set_hooks_admin' )); |
|
1219 | + call_user_func(array($module_class, 'set_hooks_admin')); |
|
1220 | 1220 | } else { |
1221 | 1221 | // delay until other systems are online |
1222 | - add_action( 'AHEE__EE_System__set_hooks_for_shortcodes_modules_and_addons', array( $module_class,'set_hooks' )); |
|
1222 | + add_action('AHEE__EE_System__set_hooks_for_shortcodes_modules_and_addons', array($module_class, 'set_hooks')); |
|
1223 | 1223 | } |
1224 | 1224 | } |
1225 | 1225 | } |
@@ -1237,26 +1237,26 @@ discard block |
||
1237 | 1237 | * @param string $key - url param key indicating a route is being called |
1238 | 1238 | * @return bool |
1239 | 1239 | */ |
1240 | - public static function register_route( $route = NULL, $module = NULL, $method_name = NULL, $key = 'ee' ) { |
|
1241 | - do_action( 'AHEE__EE_Config__register_route__begin', $route, $module, $method_name ); |
|
1242 | - $module = str_replace( 'EED_', '', $module ); |
|
1243 | - $module_class = 'EED_' . $module; |
|
1244 | - if ( ! isset( EE_Registry::instance()->modules->{$module_class} )) { |
|
1245 | - $msg = sprintf( __( 'The module %s has not been registered.', 'event_espresso' ), $module ); |
|
1246 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1240 | + public static function register_route($route = NULL, $module = NULL, $method_name = NULL, $key = 'ee') { |
|
1241 | + do_action('AHEE__EE_Config__register_route__begin', $route, $module, $method_name); |
|
1242 | + $module = str_replace('EED_', '', $module); |
|
1243 | + $module_class = 'EED_'.$module; |
|
1244 | + if ( ! isset(EE_Registry::instance()->modules->{$module_class} )) { |
|
1245 | + $msg = sprintf(__('The module %s has not been registered.', 'event_espresso'), $module); |
|
1246 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1247 | 1247 | return FALSE; |
1248 | 1248 | } |
1249 | - if ( empty( $route )) { |
|
1250 | - $msg = sprintf( __( 'No route has been supplied.', 'event_espresso' ), $route ); |
|
1251 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1249 | + if (empty($route)) { |
|
1250 | + $msg = sprintf(__('No route has been supplied.', 'event_espresso'), $route); |
|
1251 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1252 | 1252 | return FALSE; |
1253 | 1253 | } |
1254 | - if ( ! method_exists ( 'EED_' . $module, $method_name )) { |
|
1255 | - $msg = sprintf( __( 'A valid class method for the %s route has not been supplied.', 'event_espresso' ), $route ); |
|
1256 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1254 | + if ( ! method_exists('EED_'.$module, $method_name)) { |
|
1255 | + $msg = sprintf(__('A valid class method for the %s route has not been supplied.', 'event_espresso'), $route); |
|
1256 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1257 | 1257 | return FALSE; |
1258 | 1258 | } |
1259 | - EE_Config::$_module_route_map[ $key ][ $route ] = array( 'EED_' . $module, $method_name ); |
|
1259 | + EE_Config::$_module_route_map[$key][$route] = array('EED_'.$module, $method_name); |
|
1260 | 1260 | return TRUE; |
1261 | 1261 | } |
1262 | 1262 | |
@@ -1270,11 +1270,11 @@ discard block |
||
1270 | 1270 | * @param string $key - url param key indicating a route is being called |
1271 | 1271 | * @return string |
1272 | 1272 | */ |
1273 | - public static function get_route( $route = NULL, $key = 'ee' ) { |
|
1274 | - do_action( 'AHEE__EE_Config__get_route__begin',$route ); |
|
1275 | - $route = apply_filters( 'FHEE__EE_Config__get_route',$route ); |
|
1276 | - if ( isset( EE_Config::$_module_route_map[ $key ][ $route ] )) { |
|
1277 | - return EE_Config::$_module_route_map[ $key ][ $route ]; |
|
1273 | + public static function get_route($route = NULL, $key = 'ee') { |
|
1274 | + do_action('AHEE__EE_Config__get_route__begin', $route); |
|
1275 | + $route = apply_filters('FHEE__EE_Config__get_route', $route); |
|
1276 | + if (isset(EE_Config::$_module_route_map[$key][$route])) { |
|
1277 | + return EE_Config::$_module_route_map[$key][$route]; |
|
1278 | 1278 | } |
1279 | 1279 | return NULL; |
1280 | 1280 | } |
@@ -1303,35 +1303,35 @@ discard block |
||
1303 | 1303 | * @param string $key - url param key indicating a route is being called |
1304 | 1304 | * @return bool |
1305 | 1305 | */ |
1306 | - public static function register_forward( $route = NULL, $status = 0, $forward = NULL, $key = 'ee' ) { |
|
1307 | - do_action( 'AHEE__EE_Config__register_forward',$route,$status,$forward ); |
|
1308 | - if ( ! isset( EE_Config::$_module_route_map[ $key ][ $route ] ) || empty( $route )) { |
|
1309 | - $msg = sprintf( __( 'The module route %s for this forward has not been registered.', 'event_espresso' ), $route ); |
|
1310 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1306 | + public static function register_forward($route = NULL, $status = 0, $forward = NULL, $key = 'ee') { |
|
1307 | + do_action('AHEE__EE_Config__register_forward', $route, $status, $forward); |
|
1308 | + if ( ! isset(EE_Config::$_module_route_map[$key][$route]) || empty($route)) { |
|
1309 | + $msg = sprintf(__('The module route %s for this forward has not been registered.', 'event_espresso'), $route); |
|
1310 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1311 | 1311 | return FALSE; |
1312 | 1312 | } |
1313 | - if ( empty( $forward )) { |
|
1314 | - $msg = sprintf( __( 'No forwarding route has been supplied.', 'event_espresso' ), $route ); |
|
1315 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1313 | + if (empty($forward)) { |
|
1314 | + $msg = sprintf(__('No forwarding route has been supplied.', 'event_espresso'), $route); |
|
1315 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1316 | 1316 | return FALSE; |
1317 | 1317 | } |
1318 | - if ( is_array( $forward )) { |
|
1319 | - if ( ! isset( $forward[1] )) { |
|
1320 | - $msg = sprintf( __( 'A class method for the %s forwarding route has not been supplied.', 'event_espresso' ), $route ); |
|
1321 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1318 | + if (is_array($forward)) { |
|
1319 | + if ( ! isset($forward[1])) { |
|
1320 | + $msg = sprintf(__('A class method for the %s forwarding route has not been supplied.', 'event_espresso'), $route); |
|
1321 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1322 | 1322 | return FALSE; |
1323 | 1323 | } |
1324 | - if ( ! method_exists( $forward[0], $forward[1] )) { |
|
1325 | - $msg = sprintf( __( 'The class method %s for the %s forwarding route is in invalid.', 'event_espresso' ), $forward[1], $route ); |
|
1326 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1324 | + if ( ! method_exists($forward[0], $forward[1])) { |
|
1325 | + $msg = sprintf(__('The class method %s for the %s forwarding route is in invalid.', 'event_espresso'), $forward[1], $route); |
|
1326 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1327 | 1327 | return FALSE; |
1328 | 1328 | } |
1329 | - } else if ( ! function_exists( $forward )) { |
|
1330 | - $msg = sprintf( __( 'The function %s for the %s forwarding route is in invalid.', 'event_espresso' ), $forward, $route ); |
|
1331 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1329 | + } else if ( ! function_exists($forward)) { |
|
1330 | + $msg = sprintf(__('The function %s for the %s forwarding route is in invalid.', 'event_espresso'), $forward, $route); |
|
1331 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1332 | 1332 | return FALSE; |
1333 | 1333 | } |
1334 | - EE_Config::$_module_forward_map[ $key ][ $route ][ absint( $status ) ] = $forward; |
|
1334 | + EE_Config::$_module_forward_map[$key][$route][absint($status)] = $forward; |
|
1335 | 1335 | return TRUE; |
1336 | 1336 | } |
1337 | 1337 | |
@@ -1346,10 +1346,10 @@ discard block |
||
1346 | 1346 | * @param string $key - url param key indicating a route is being called |
1347 | 1347 | * @return string |
1348 | 1348 | */ |
1349 | - public static function get_forward( $route = NULL, $status = 0, $key = 'ee' ) { |
|
1350 | - do_action( 'AHEE__EE_Config__get_forward__begin',$route,$status ); |
|
1351 | - if ( isset( EE_Config::$_module_forward_map[ $key ][ $route ][ $status ] )) { |
|
1352 | - return apply_filters( 'FHEE__EE_Config__get_forward', EE_Config::$_module_forward_map[ $key ][ $route ][ $status ], $route,$status ); |
|
1349 | + public static function get_forward($route = NULL, $status = 0, $key = 'ee') { |
|
1350 | + do_action('AHEE__EE_Config__get_forward__begin', $route, $status); |
|
1351 | + if (isset(EE_Config::$_module_forward_map[$key][$route][$status])) { |
|
1352 | + return apply_filters('FHEE__EE_Config__get_forward', EE_Config::$_module_forward_map[$key][$route][$status], $route, $status); |
|
1353 | 1353 | } |
1354 | 1354 | return NULL; |
1355 | 1355 | } |
@@ -1366,19 +1366,19 @@ discard block |
||
1366 | 1366 | * @param string $key - url param key indicating a route is being called |
1367 | 1367 | * @return bool |
1368 | 1368 | */ |
1369 | - public static function register_view( $route = NULL, $status = 0, $view = NULL, $key = 'ee' ) { |
|
1370 | - do_action( 'AHEE__EE_Config__register_view__begin',$route,$status,$view ); |
|
1371 | - if ( ! isset( EE_Config::$_module_route_map[ $key ][ $route ] ) || empty( $route )) { |
|
1372 | - $msg = sprintf( __( 'The module route %s for this view has not been registered.', 'event_espresso' ), $route ); |
|
1373 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1369 | + public static function register_view($route = NULL, $status = 0, $view = NULL, $key = 'ee') { |
|
1370 | + do_action('AHEE__EE_Config__register_view__begin', $route, $status, $view); |
|
1371 | + if ( ! isset(EE_Config::$_module_route_map[$key][$route]) || empty($route)) { |
|
1372 | + $msg = sprintf(__('The module route %s for this view has not been registered.', 'event_espresso'), $route); |
|
1373 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1374 | 1374 | return FALSE; |
1375 | 1375 | } |
1376 | - if ( ! is_readable( $view )) { |
|
1377 | - $msg = sprintf( __( 'The %s view file could not be found or is not readable due to file permissions.', 'event_espresso' ), $view ); |
|
1378 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1376 | + if ( ! is_readable($view)) { |
|
1377 | + $msg = sprintf(__('The %s view file could not be found or is not readable due to file permissions.', 'event_espresso'), $view); |
|
1378 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1379 | 1379 | return FALSE; |
1380 | 1380 | } |
1381 | - EE_Config::$_module_view_map[ $key ][ $route ][ absint( $status ) ] = $view; |
|
1381 | + EE_Config::$_module_view_map[$key][$route][absint($status)] = $view; |
|
1382 | 1382 | return TRUE; |
1383 | 1383 | } |
1384 | 1384 | |
@@ -1395,10 +1395,10 @@ discard block |
||
1395 | 1395 | * @param string $key - url param key indicating a route is being called |
1396 | 1396 | * @return string |
1397 | 1397 | */ |
1398 | - public static function get_view( $route = NULL, $status = 0, $key = 'ee' ) { |
|
1399 | - do_action( 'AHEE__EE_Config__get_view__begin',$route,$status ); |
|
1400 | - if ( isset( EE_Config::$_module_view_map[ $key ][ $route ][ $status ] )) { |
|
1401 | - return apply_filters( 'FHEE__EE_Config__get_view', EE_Config::$_module_view_map[ $key ][ $route ][ $status ], $route,$status ); |
|
1398 | + public static function get_view($route = NULL, $status = 0, $key = 'ee') { |
|
1399 | + do_action('AHEE__EE_Config__get_view__begin', $route, $status); |
|
1400 | + if (isset(EE_Config::$_module_view_map[$key][$route][$status])) { |
|
1401 | + return apply_filters('FHEE__EE_Config__get_view', EE_Config::$_module_view_map[$key][$route][$status], $route, $status); |
|
1402 | 1402 | } |
1403 | 1403 | return NULL; |
1404 | 1404 | } |
@@ -1406,7 +1406,7 @@ discard block |
||
1406 | 1406 | |
1407 | 1407 | |
1408 | 1408 | public function shutdown() { |
1409 | - update_option( 'ee_config_option_names', $this->_config_option_names ); |
|
1409 | + update_option('ee_config_option_names', $this->_config_option_names); |
|
1410 | 1410 | } |
1411 | 1411 | |
1412 | 1412 | |
@@ -1422,7 +1422,7 @@ discard block |
||
1422 | 1422 | * magic functions in use, except we'll allow them to magically set and get stuff... |
1423 | 1423 | * basically, they should just be well-defined stdClasses |
1424 | 1424 | */ |
1425 | -class EE_Config_Base{ |
|
1425 | +class EE_Config_Base { |
|
1426 | 1426 | |
1427 | 1427 | /** |
1428 | 1428 | * Utility function for escaping the value of a property and returning. |
@@ -1431,13 +1431,13 @@ discard block |
||
1431 | 1431 | * @return mixed if a detected type found return the escaped value, otherwise just the raw value is returned. |
1432 | 1432 | * @throws \EE_Error |
1433 | 1433 | */ |
1434 | - public function get_pretty( $property ) { |
|
1435 | - if ( ! property_exists( $this, $property ) ) { |
|
1436 | - throw new EE_Error( sprintf( __('%1$s::get_pretty() has been called with the property %2$s which does not exist on the %1$s config class.', 'event_espresso' ), get_class( $this ), $property ) ); |
|
1434 | + public function get_pretty($property) { |
|
1435 | + if ( ! property_exists($this, $property)) { |
|
1436 | + throw new EE_Error(sprintf(__('%1$s::get_pretty() has been called with the property %2$s which does not exist on the %1$s config class.', 'event_espresso'), get_class($this), $property)); |
|
1437 | 1437 | } |
1438 | 1438 | //just handling escaping of strings for now. |
1439 | - if ( is_string( $this->{$property} ) ) { |
|
1440 | - return stripslashes( $this->{$property} ); |
|
1439 | + if (is_string($this->{$property} )) { |
|
1440 | + return stripslashes($this->{$property} ); |
|
1441 | 1441 | } |
1442 | 1442 | return $this->{$property}; |
1443 | 1443 | } |
@@ -1446,19 +1446,19 @@ discard block |
||
1446 | 1446 | |
1447 | 1447 | public function populate() { |
1448 | 1448 | //grab defaults via a new instance of this class. |
1449 | - $class_name = get_class( $this ); |
|
1449 | + $class_name = get_class($this); |
|
1450 | 1450 | $defaults = new $class_name; |
1451 | 1451 | |
1452 | 1452 | //loop through the properties for this class and see if they are set. If they are NOT, then grab the |
1453 | 1453 | //default from our $defaults object. |
1454 | - foreach ( get_object_vars( $defaults ) as $property => $value ) { |
|
1455 | - if ( is_null( $this->{$property} ) ) { |
|
1454 | + foreach (get_object_vars($defaults) as $property => $value) { |
|
1455 | + if (is_null($this->{$property} )) { |
|
1456 | 1456 | $this->{$property} = $value; |
1457 | 1457 | } |
1458 | 1458 | } |
1459 | 1459 | |
1460 | 1460 | //cleanup |
1461 | - unset( $defaults ); |
|
1461 | + unset($defaults); |
|
1462 | 1462 | } |
1463 | 1463 | |
1464 | 1464 | |
@@ -1550,12 +1550,12 @@ discard block |
||
1550 | 1550 | */ |
1551 | 1551 | public function __construct() { |
1552 | 1552 | $current_network_main_site = is_multisite() ? get_current_site() : NULL; |
1553 | - $current_main_site_id = !empty( $current_network_main_site ) ? $current_network_main_site->blog_id : 1; |
|
1553 | + $current_main_site_id = ! empty($current_network_main_site) ? $current_network_main_site->blog_id : 1; |
|
1554 | 1554 | // set default organization settings |
1555 | 1555 | $this->current_blog_id = get_current_blog_id(); |
1556 | 1556 | $this->current_blog_id = $this->current_blog_id === NULL ? 1 : $this->current_blog_id; |
1557 | - $this->ee_ueip_optin = is_main_site() ? get_option( 'ee_ueip_optin', TRUE ) : get_blog_option( $current_main_site_id, 'ee_ueip_optin', TRUE ); |
|
1558 | - $this->ee_ueip_has_notified = is_main_site() ? get_option( 'ee_ueip_has_notified', FALSE ) : TRUE; |
|
1557 | + $this->ee_ueip_optin = is_main_site() ? get_option('ee_ueip_optin', TRUE) : get_blog_option($current_main_site_id, 'ee_ueip_optin', TRUE); |
|
1558 | + $this->ee_ueip_has_notified = is_main_site() ? get_option('ee_ueip_has_notified', FALSE) : TRUE; |
|
1559 | 1559 | $this->post_shortcodes = array(); |
1560 | 1560 | $this->module_route_map = array(); |
1561 | 1561 | $this->module_forward_map = array(); |
@@ -1574,7 +1574,7 @@ discard block |
||
1574 | 1574 | $this->event_cpt_slug = __('events', 'event_espresso'); |
1575 | 1575 | |
1576 | 1576 | //ueip constant check |
1577 | - if ( defined( 'EE_DISABLE_UXIP' ) && EE_DISABLE_UXIP ) { |
|
1577 | + if (defined('EE_DISABLE_UXIP') && EE_DISABLE_UXIP) { |
|
1578 | 1578 | $this->ee_ueip_optin = FALSE; |
1579 | 1579 | $this->ee_ueip_has_notified = TRUE; |
1580 | 1580 | } |
@@ -1614,8 +1614,8 @@ discard block |
||
1614 | 1614 | * @return string |
1615 | 1615 | */ |
1616 | 1616 | public function reg_page_url() { |
1617 | - if ( ! $this->reg_page_url ) { |
|
1618 | - $this->reg_page_url = get_permalink( $this->reg_page_id ) . '#checkout'; |
|
1617 | + if ( ! $this->reg_page_url) { |
|
1618 | + $this->reg_page_url = get_permalink($this->reg_page_id).'#checkout'; |
|
1619 | 1619 | } |
1620 | 1620 | return $this->reg_page_url; |
1621 | 1621 | } |
@@ -1628,12 +1628,12 @@ discard block |
||
1628 | 1628 | * @return string |
1629 | 1629 | */ |
1630 | 1630 | public function txn_page_url($query_args = array()) { |
1631 | - if ( ! $this->txn_page_url ) { |
|
1632 | - $this->txn_page_url = get_permalink( $this->txn_page_id ); |
|
1631 | + if ( ! $this->txn_page_url) { |
|
1632 | + $this->txn_page_url = get_permalink($this->txn_page_id); |
|
1633 | 1633 | } |
1634 | - if($query_args){ |
|
1635 | - return add_query_arg($query_args,$this->txn_page_url); |
|
1636 | - }else{ |
|
1634 | + if ($query_args) { |
|
1635 | + return add_query_arg($query_args, $this->txn_page_url); |
|
1636 | + } else { |
|
1637 | 1637 | return $this->txn_page_url; |
1638 | 1638 | } |
1639 | 1639 | } |
@@ -1645,12 +1645,12 @@ discard block |
||
1645 | 1645 | * @return string |
1646 | 1646 | */ |
1647 | 1647 | public function thank_you_page_url($query_args = array()) { |
1648 | - if ( ! $this->thank_you_page_url ) { |
|
1649 | - $this->thank_you_page_url = get_permalink( $this->thank_you_page_id ); |
|
1648 | + if ( ! $this->thank_you_page_url) { |
|
1649 | + $this->thank_you_page_url = get_permalink($this->thank_you_page_id); |
|
1650 | 1650 | } |
1651 | - if($query_args){ |
|
1652 | - return add_query_arg($query_args,$this->thank_you_page_url); |
|
1653 | - }else{ |
|
1651 | + if ($query_args) { |
|
1652 | + return add_query_arg($query_args, $this->thank_you_page_url); |
|
1653 | + } else { |
|
1654 | 1654 | return $this->thank_you_page_url; |
1655 | 1655 | } |
1656 | 1656 | } |
@@ -1661,8 +1661,8 @@ discard block |
||
1661 | 1661 | * @return string |
1662 | 1662 | */ |
1663 | 1663 | public function cancel_page_url() { |
1664 | - if ( ! $this->cancel_page_url ) { |
|
1665 | - $this->cancel_page_url = get_permalink( $this->cancel_page_id ); |
|
1664 | + if ( ! $this->cancel_page_url) { |
|
1665 | + $this->cancel_page_url = get_permalink($this->cancel_page_id); |
|
1666 | 1666 | } |
1667 | 1667 | return $this->cancel_page_url; |
1668 | 1668 | } |
@@ -1690,7 +1690,7 @@ discard block |
||
1690 | 1690 | //reset all url properties |
1691 | 1691 | $this->_reset_urls(); |
1692 | 1692 | //return what to save to db |
1693 | - return array_keys( get_object_vars( $this ) ); |
|
1693 | + return array_keys(get_object_vars($this)); |
|
1694 | 1694 | } |
1695 | 1695 | |
1696 | 1696 | } |
@@ -1922,38 +1922,38 @@ discard block |
||
1922 | 1922 | * @param null $CNT_ISO |
1923 | 1923 | * @return \EE_Currency_Config |
1924 | 1924 | */ |
1925 | - public function __construct( $CNT_ISO = NULL ) { |
|
1925 | + public function __construct($CNT_ISO = NULL) { |
|
1926 | 1926 | |
1927 | 1927 | // get country code from organization settings or use default |
1928 | - $ORG_CNT = isset( EE_Registry::instance()->CFG->organization ) && EE_Registry::instance()->CFG->organization instanceof EE_Organization_Config ? EE_Registry::instance()->CFG->organization->CNT_ISO : NULL; |
|
1928 | + $ORG_CNT = isset(EE_Registry::instance()->CFG->organization) && EE_Registry::instance()->CFG->organization instanceof EE_Organization_Config ? EE_Registry::instance()->CFG->organization->CNT_ISO : NULL; |
|
1929 | 1929 | // but override if requested |
1930 | - $CNT_ISO = ! empty( $CNT_ISO ) ? $CNT_ISO : $ORG_CNT; |
|
1930 | + $CNT_ISO = ! empty($CNT_ISO) ? $CNT_ISO : $ORG_CNT; |
|
1931 | 1931 | // so if that all went well, and we are not in M-Mode (cuz you can't query the db in M-Mode) and double-check the countries table exists |
1932 | - if ( ! empty( $CNT_ISO ) && EE_Maintenance_Mode::instance()->models_can_query() && EEH_Activation::table_exists( EE_Registry::instance()->load_model( 'Country' )->table() ) ) { |
|
1932 | + if ( ! empty($CNT_ISO) && EE_Maintenance_Mode::instance()->models_can_query() && EEH_Activation::table_exists(EE_Registry::instance()->load_model('Country')->table())) { |
|
1933 | 1933 | // retrieve the country settings from the db, just in case they have been customized |
1934 | - $country = EE_Registry::instance()->load_model( 'Country' )->get_one_by_ID( $CNT_ISO ); |
|
1935 | - if ( $country instanceof EE_Country ) { |
|
1936 | - $this->code = $country->currency_code(); // currency code: USD, CAD, EUR |
|
1937 | - $this->name = $country->currency_name_single(); // Dollar |
|
1938 | - $this->plural = $country->currency_name_plural(); // Dollars |
|
1939 | - $this->sign = $country->currency_sign(); // currency sign: $ |
|
1940 | - $this->sign_b4 = $country->currency_sign_before(); // currency sign before or after: $TRUE or FALSE$ |
|
1941 | - $this->dec_plc = $country->currency_decimal_places(); // decimal places: 2 = 0.00 3 = 0.000 |
|
1942 | - $this->dec_mrk = $country->currency_decimal_mark(); // decimal mark: (comma) ',' = 0,01 or (decimal) '.' = 0.01 |
|
1943 | - $this->thsnds = $country->currency_thousands_separator(); // thousands separator: (comma) ',' = 1,000 or (decimal) '.' = 1.000 |
|
1934 | + $country = EE_Registry::instance()->load_model('Country')->get_one_by_ID($CNT_ISO); |
|
1935 | + if ($country instanceof EE_Country) { |
|
1936 | + $this->code = $country->currency_code(); // currency code: USD, CAD, EUR |
|
1937 | + $this->name = $country->currency_name_single(); // Dollar |
|
1938 | + $this->plural = $country->currency_name_plural(); // Dollars |
|
1939 | + $this->sign = $country->currency_sign(); // currency sign: $ |
|
1940 | + $this->sign_b4 = $country->currency_sign_before(); // currency sign before or after: $TRUE or FALSE$ |
|
1941 | + $this->dec_plc = $country->currency_decimal_places(); // decimal places: 2 = 0.00 3 = 0.000 |
|
1942 | + $this->dec_mrk = $country->currency_decimal_mark(); // decimal mark: (comma) ',' = 0,01 or (decimal) '.' = 0.01 |
|
1943 | + $this->thsnds = $country->currency_thousands_separator(); // thousands separator: (comma) ',' = 1,000 or (decimal) '.' = 1.000 |
|
1944 | 1944 | } |
1945 | 1945 | } |
1946 | 1946 | // fallback to hardcoded defaults, in case the above failed |
1947 | - if ( empty( $this->code )) { |
|
1947 | + if (empty($this->code)) { |
|
1948 | 1948 | // set default currency settings |
1949 | - $this->code = 'USD'; // currency code: USD, CAD, EUR |
|
1950 | - $this->name = __( 'Dollar', 'event_espresso' ); // Dollar |
|
1951 | - $this->plural = __( 'Dollars', 'event_espresso' ); // Dollars |
|
1952 | - $this->sign = '$'; // currency sign: $ |
|
1953 | - $this->sign_b4 = TRUE; // currency sign before or after: $TRUE or FALSE$ |
|
1954 | - $this->dec_plc = 2; // decimal places: 2 = 0.00 3 = 0.000 |
|
1955 | - $this->dec_mrk = '.'; // decimal mark: (comma) ',' = 0,01 or (decimal) '.' = 0.01 |
|
1956 | - $this->thsnds = ','; // thousands separator: (comma) ',' = 1,000 or (decimal) '.' = 1.000 |
|
1949 | + $this->code = 'USD'; // currency code: USD, CAD, EUR |
|
1950 | + $this->name = __('Dollar', 'event_espresso'); // Dollar |
|
1951 | + $this->plural = __('Dollars', 'event_espresso'); // Dollars |
|
1952 | + $this->sign = '$'; // currency sign: $ |
|
1953 | + $this->sign_b4 = TRUE; // currency sign before or after: $TRUE or FALSE$ |
|
1954 | + $this->dec_plc = 2; // decimal places: 2 = 0.00 3 = 0.000 |
|
1955 | + $this->dec_mrk = '.'; // decimal mark: (comma) ',' = 0,01 or (decimal) '.' = 0.01 |
|
1956 | + $this->thsnds = ','; // thousands separator: (comma) ',' = 1,000 or (decimal) '.' = 1.000 |
|
1957 | 1957 | } |
1958 | 1958 | } |
1959 | 1959 | } |
@@ -2102,7 +2102,7 @@ discard block |
||
2102 | 2102 | * @since 4.8.8.rc.019 |
2103 | 2103 | */ |
2104 | 2104 | public function do_hooks() { |
2105 | - add_action( 'AHEE__EE_Config___load_core_config__end', array( $this, 'set_default_reg_status_on_EEM_Event' )); |
|
2105 | + add_action('AHEE__EE_Config___load_core_config__end', array($this, 'set_default_reg_status_on_EEM_Event')); |
|
2106 | 2106 | } |
2107 | 2107 | |
2108 | 2108 | |
@@ -2110,7 +2110,7 @@ discard block |
||
2110 | 2110 | * @return void |
2111 | 2111 | */ |
2112 | 2112 | public function set_default_reg_status_on_EEM_Event() { |
2113 | - EEM_Event::set_default_reg_status( $this->default_STS_ID ); |
|
2113 | + EEM_Event::set_default_reg_status($this->default_STS_ID); |
|
2114 | 2114 | } |
2115 | 2115 | |
2116 | 2116 | |
@@ -2215,10 +2215,10 @@ discard block |
||
2215 | 2215 | * @param bool $reset |
2216 | 2216 | * @return string |
2217 | 2217 | */ |
2218 | - public function log_file_name( $reset = FALSE ) { |
|
2219 | - if ( empty( $this->log_file_name ) || $reset ) { |
|
2220 | - $this->log_file_name = sanitize_key( 'espresso_log_' . md5( uniqid( '', TRUE ))) . '.txt'; |
|
2221 | - EE_Config::instance()->update_espresso_config( FALSE, FALSE ); |
|
2218 | + public function log_file_name($reset = FALSE) { |
|
2219 | + if (empty($this->log_file_name) || $reset) { |
|
2220 | + $this->log_file_name = sanitize_key('espresso_log_'.md5(uniqid('', TRUE))).'.txt'; |
|
2221 | + EE_Config::instance()->update_espresso_config(FALSE, FALSE); |
|
2222 | 2222 | } |
2223 | 2223 | return $this->log_file_name; |
2224 | 2224 | } |
@@ -2230,10 +2230,10 @@ discard block |
||
2230 | 2230 | * @param bool $reset |
2231 | 2231 | * @return string |
2232 | 2232 | */ |
2233 | - public function debug_file_name( $reset = FALSE ) { |
|
2234 | - if ( empty( $this->debug_file_name ) || $reset ) { |
|
2235 | - $this->debug_file_name = sanitize_key( 'espresso_debug_' . md5( uniqid( '', TRUE ))) . '.txt'; |
|
2236 | - EE_Config::instance()->update_espresso_config( FALSE, FALSE ); |
|
2233 | + public function debug_file_name($reset = FALSE) { |
|
2234 | + if (empty($this->debug_file_name) || $reset) { |
|
2235 | + $this->debug_file_name = sanitize_key('espresso_debug_'.md5(uniqid('', TRUE))).'.txt'; |
|
2236 | + EE_Config::instance()->update_espresso_config(FALSE, FALSE); |
|
2237 | 2237 | } |
2238 | 2238 | return $this->debug_file_name; |
2239 | 2239 | } |
@@ -2406,21 +2406,21 @@ discard block |
||
2406 | 2406 | // set default map settings |
2407 | 2407 | $this->use_google_maps = TRUE; |
2408 | 2408 | // for event details pages (reg page) |
2409 | - $this->event_details_map_width = 585; // ee_map_width_single |
|
2410 | - $this->event_details_map_height = 362; // ee_map_height_single |
|
2411 | - $this->event_details_map_zoom = 14; // ee_map_zoom_single |
|
2412 | - $this->event_details_display_nav = TRUE; // ee_map_nav_display_single |
|
2413 | - $this->event_details_nav_size = FALSE; // ee_map_nav_size_single |
|
2414 | - $this->event_details_control_type = 'default'; // ee_map_type_control_single |
|
2415 | - $this->event_details_map_align = 'center'; // ee_map_align_single |
|
2409 | + $this->event_details_map_width = 585; // ee_map_width_single |
|
2410 | + $this->event_details_map_height = 362; // ee_map_height_single |
|
2411 | + $this->event_details_map_zoom = 14; // ee_map_zoom_single |
|
2412 | + $this->event_details_display_nav = TRUE; // ee_map_nav_display_single |
|
2413 | + $this->event_details_nav_size = FALSE; // ee_map_nav_size_single |
|
2414 | + $this->event_details_control_type = 'default'; // ee_map_type_control_single |
|
2415 | + $this->event_details_map_align = 'center'; // ee_map_align_single |
|
2416 | 2416 | // for event list pages |
2417 | - $this->event_list_map_width = 300; // ee_map_width |
|
2418 | - $this->event_list_map_height = 185; // ee_map_height |
|
2419 | - $this->event_list_map_zoom = 12; // ee_map_zoom |
|
2420 | - $this->event_list_display_nav = FALSE; // ee_map_nav_display |
|
2421 | - $this->event_list_nav_size = TRUE; // ee_map_nav_size |
|
2422 | - $this->event_list_control_type = 'dropdown'; // ee_map_type_control |
|
2423 | - $this->event_list_map_align = 'center'; // ee_map_align |
|
2417 | + $this->event_list_map_width = 300; // ee_map_width |
|
2418 | + $this->event_list_map_height = 185; // ee_map_height |
|
2419 | + $this->event_list_map_zoom = 12; // ee_map_zoom |
|
2420 | + $this->event_list_display_nav = FALSE; // ee_map_nav_display |
|
2421 | + $this->event_list_nav_size = TRUE; // ee_map_nav_size |
|
2422 | + $this->event_list_control_type = 'dropdown'; // ee_map_type_control |
|
2423 | + $this->event_list_map_align = 'center'; // ee_map_align |
|
2424 | 2424 | } |
2425 | 2425 | |
2426 | 2426 | } |
@@ -2431,7 +2431,7 @@ discard block |
||
2431 | 2431 | /** |
2432 | 2432 | * stores Events_Archive settings |
2433 | 2433 | */ |
2434 | -class EE_Events_Archive_Config extends EE_Config_Base{ |
|
2434 | +class EE_Events_Archive_Config extends EE_Config_Base { |
|
2435 | 2435 | |
2436 | 2436 | public $display_status_banner; |
2437 | 2437 | public $display_description; |
@@ -2450,7 +2450,7 @@ discard block |
||
2450 | 2450 | /** |
2451 | 2451 | * class constructor |
2452 | 2452 | */ |
2453 | - public function __construct(){ |
|
2453 | + public function __construct() { |
|
2454 | 2454 | $this->display_status_banner = 0; |
2455 | 2455 | $this->display_description = 1; |
2456 | 2456 | $this->display_ticket_selector = 0; |
@@ -2470,7 +2470,7 @@ discard block |
||
2470 | 2470 | /** |
2471 | 2471 | * Stores Event_Single_Config settings |
2472 | 2472 | */ |
2473 | -class EE_Event_Single_Config extends EE_Config_Base{ |
|
2473 | +class EE_Event_Single_Config extends EE_Config_Base { |
|
2474 | 2474 | |
2475 | 2475 | public $display_status_banner_single; |
2476 | 2476 | public $display_venue; |
@@ -2499,7 +2499,7 @@ discard block |
||
2499 | 2499 | /** |
2500 | 2500 | * Stores Ticket_Selector_Config settings |
2501 | 2501 | */ |
2502 | -class EE_Ticket_Selector_Config extends EE_Config_Base{ |
|
2502 | +class EE_Ticket_Selector_Config extends EE_Config_Base { |
|
2503 | 2503 | public $show_ticket_sale_columns; |
2504 | 2504 | public $show_ticket_details; |
2505 | 2505 | public $show_expired_tickets; |
@@ -2553,7 +2553,7 @@ discard block |
||
2553 | 2553 | * @return void |
2554 | 2554 | */ |
2555 | 2555 | protected function _set_php_values() { |
2556 | - $this->php->max_input_vars = ini_get( 'max_input_vars' ); |
|
2556 | + $this->php->max_input_vars = ini_get('max_input_vars'); |
|
2557 | 2557 | $this->php->version = phpversion(); |
2558 | 2558 | } |
2559 | 2559 | |
@@ -2572,9 +2572,9 @@ discard block |
||
2572 | 2572 | * @type string $msg Any message to be displayed. |
2573 | 2573 | * } |
2574 | 2574 | */ |
2575 | - public function max_input_vars_limit_check( $input_count = 0 ) { |
|
2576 | - if ( ! empty( $this->php->max_input_vars ) && ( $input_count >= $this->php->max_input_vars ) && ( PHP_MAJOR_VERSION >= 5 && PHP_MINOR_VERSION >= 3 && PHP_RELEASE_VERSION >=9 ) ) { |
|
2577 | - return sprintf( __('The maximum number of inputs on this page has been exceeded. You cannot add anymore items (i.e. tickets, datetimes, custom fields) on this page because of your servers PHP "max_input_vars" setting.%1$sThere are %2$d inputs and the maximum amount currently allowed by your server is %3$d.', 'event_espresso'), '<br>', $input_count, $this->php->max_input_vars); |
|
2575 | + public function max_input_vars_limit_check($input_count = 0) { |
|
2576 | + if ( ! empty($this->php->max_input_vars) && ($input_count >= $this->php->max_input_vars) && (PHP_MAJOR_VERSION >= 5 && PHP_MINOR_VERSION >= 3 && PHP_RELEASE_VERSION >= 9)) { |
|
2577 | + return sprintf(__('The maximum number of inputs on this page has been exceeded. You cannot add anymore items (i.e. tickets, datetimes, custom fields) on this page because of your servers PHP "max_input_vars" setting.%1$sThere are %2$d inputs and the maximum amount currently allowed by your server is %3$d.', 'event_espresso'), '<br>', $input_count, $this->php->max_input_vars); |
|
2578 | 2578 | } else { |
2579 | 2579 | return ''; |
2580 | 2580 | } |
@@ -2609,7 +2609,7 @@ discard block |
||
2609 | 2609 | * stores payment gateway info |
2610 | 2610 | * @deprecated |
2611 | 2611 | */ |
2612 | -class EE_Gateway_Config extends EE_Config_Base{ |
|
2612 | +class EE_Gateway_Config extends EE_Config_Base { |
|
2613 | 2613 | |
2614 | 2614 | /** |
2615 | 2615 | * Array with keys that are payment gateways slugs, and values are arrays |
@@ -2631,9 +2631,9 @@ discard block |
||
2631 | 2631 | * class constructor |
2632 | 2632 | * @deprecated |
2633 | 2633 | */ |
2634 | - public function __construct(){ |
|
2634 | + public function __construct() { |
|
2635 | 2635 | $this->payment_settings = array(); |
2636 | - $this->active_gateways = array( 'Invoice' => FALSE ); |
|
2636 | + $this->active_gateways = array('Invoice' => FALSE); |
|
2637 | 2637 | } |
2638 | 2638 | } |
2639 | 2639 |
@@ -15,7 +15,7 @@ discard block |
||
15 | 15 | |
16 | 16 | |
17 | 17 | |
18 | -if ( ! function_exists( 'espresso_get_template_part' )) { |
|
18 | +if ( ! function_exists('espresso_get_template_part')) { |
|
19 | 19 | /** |
20 | 20 | * espresso_get_template_part |
21 | 21 | * basically a copy of the WordPress get_template_part() function but uses EEH_Template::locate_template() instead, and doesn't add base versions of files |
@@ -25,14 +25,14 @@ discard block |
||
25 | 25 | * @param string $name The name of the specialised template. |
26 | 26 | * @return string the html output for the formatted money value |
27 | 27 | */ |
28 | - function espresso_get_template_part( $slug = NULL, $name = NULL ) { |
|
29 | - EEH_Template::get_template_part( $slug, $name ); |
|
28 | + function espresso_get_template_part($slug = NULL, $name = NULL) { |
|
29 | + EEH_Template::get_template_part($slug, $name); |
|
30 | 30 | } |
31 | 31 | } |
32 | 32 | |
33 | 33 | |
34 | 34 | |
35 | -if ( ! function_exists( 'espresso_get_object_css_class' )) { |
|
35 | +if ( ! function_exists('espresso_get_object_css_class')) { |
|
36 | 36 | /** |
37 | 37 | * espresso_get_object_css_class - attempts to generate a css class based on the type of EE object passed |
38 | 38 | * |
@@ -42,8 +42,8 @@ discard block |
||
42 | 42 | * @param string $suffix added to the end of the generated class |
43 | 43 | * @return string |
44 | 44 | */ |
45 | - function espresso_get_object_css_class( $object = NULL, $prefix = '', $suffix = '' ) { |
|
46 | - return EEH_Template::get_object_css_class( $object, $prefix, $suffix ); |
|
45 | + function espresso_get_object_css_class($object = NULL, $prefix = '', $suffix = '') { |
|
46 | + return EEH_Template::get_object_css_class($object, $prefix, $suffix); |
|
47 | 47 | } |
48 | 48 | } |
49 | 49 | |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | * @return boolean |
71 | 71 | */ |
72 | 72 | public static function is_espresso_theme() { |
73 | - return wp_get_theme()->get( 'TextDomain' ) == 'event_espresso' ? TRUE : FALSE; |
|
73 | + return wp_get_theme()->get('TextDomain') == 'event_espresso' ? TRUE : FALSE; |
|
74 | 74 | } |
75 | 75 | |
76 | 76 | /** |
@@ -79,9 +79,9 @@ discard block |
||
79 | 79 | * @return void |
80 | 80 | */ |
81 | 81 | public static function load_espresso_theme_functions() { |
82 | - if ( ! defined( 'EE_THEME_FUNCTIONS_LOADED' )) { |
|
83 | - if ( is_readable( EE_PUBLIC . EE_Config::get_current_theme() . DS . 'functions.php' )) { |
|
84 | - require_once( EE_PUBLIC . EE_Config::get_current_theme() . DS . 'functions.php' ); |
|
82 | + if ( ! defined('EE_THEME_FUNCTIONS_LOADED')) { |
|
83 | + if (is_readable(EE_PUBLIC.EE_Config::get_current_theme().DS.'functions.php')) { |
|
84 | + require_once(EE_PUBLIC.EE_Config::get_current_theme().DS.'functions.php'); |
|
85 | 85 | } |
86 | 86 | } |
87 | 87 | } |
@@ -93,17 +93,17 @@ discard block |
||
93 | 93 | * @return array |
94 | 94 | */ |
95 | 95 | public static function get_espresso_themes() { |
96 | - if ( empty( EEH_Template::$_espresso_themes )) { |
|
97 | - $espresso_themes = glob( EE_PUBLIC . '*', GLOB_ONLYDIR ); |
|
98 | - if ( empty( $espresso_themes ) ) { |
|
96 | + if (empty(EEH_Template::$_espresso_themes)) { |
|
97 | + $espresso_themes = glob(EE_PUBLIC.'*', GLOB_ONLYDIR); |
|
98 | + if (empty($espresso_themes)) { |
|
99 | 99 | return array(); |
100 | 100 | } |
101 | - if (( $key = array_search( 'global_assets', $espresso_themes )) !== FALSE ) { |
|
102 | - unset( $espresso_themes[ $key ] ); |
|
101 | + if (($key = array_search('global_assets', $espresso_themes)) !== FALSE) { |
|
102 | + unset($espresso_themes[$key]); |
|
103 | 103 | } |
104 | 104 | EEH_Template::$_espresso_themes = array(); |
105 | - foreach ( $espresso_themes as $espresso_theme ) { |
|
106 | - EEH_Template::$_espresso_themes[ basename( $espresso_theme ) ] = $espresso_theme; |
|
105 | + foreach ($espresso_themes as $espresso_theme) { |
|
106 | + EEH_Template::$_espresso_themes[basename($espresso_theme)] = $espresso_theme; |
|
107 | 107 | } |
108 | 108 | } |
109 | 109 | return EEH_Template::$_espresso_themes; |
@@ -122,16 +122,16 @@ discard block |
||
122 | 122 | * @param bool $return_string |
123 | 123 | * @return string the html output for the formatted money value |
124 | 124 | */ |
125 | - public static function get_template_part( $slug = NULL, $name = NULL, $template_args = array(), $return_string = FALSE ) { |
|
126 | - do_action( "get_template_part_{$slug}-{$name}", $slug, $name ); |
|
125 | + public static function get_template_part($slug = NULL, $name = NULL, $template_args = array(), $return_string = FALSE) { |
|
126 | + do_action("get_template_part_{$slug}-{$name}", $slug, $name); |
|
127 | 127 | $templates = array(); |
128 | 128 | $name = (string) $name; |
129 | - if ( $name != '' ) { |
|
129 | + if ($name != '') { |
|
130 | 130 | $templates[] = "{$slug}-{$name}.php"; |
131 | 131 | } |
132 | 132 | // allow template parts to be turned off via something like: add_filter( 'FHEE__content_espresso_events_tickets_template__display_datetimes', '__return_false' ); |
133 | - if ( apply_filters( "FHEE__EEH_Template__get_template_part__display__{$slug}_{$name}", TRUE )) { |
|
134 | - EEH_Template::locate_template( $templates, $template_args, TRUE, $return_string ); |
|
133 | + if (apply_filters("FHEE__EEH_Template__get_template_part__display__{$slug}_{$name}", TRUE)) { |
|
134 | + EEH_Template::locate_template($templates, $template_args, TRUE, $return_string); |
|
135 | 135 | } |
136 | 136 | } |
137 | 137 | |
@@ -182,26 +182,26 @@ discard block |
||
182 | 182 | * Used in places where you don't actually load the template, you just want to know if there's a custom version of it. |
183 | 183 | * @return mixed |
184 | 184 | */ |
185 | - public static function locate_template( $templates = array(), $template_args = array(), $load = TRUE, $return_string = TRUE, $check_if_custom = FALSE ) { |
|
185 | + public static function locate_template($templates = array(), $template_args = array(), $load = TRUE, $return_string = TRUE, $check_if_custom = FALSE) { |
|
186 | 186 | // first use WP locate_template to check for template in the current theme folder |
187 | - $template_path = locate_template( $templates ); |
|
187 | + $template_path = locate_template($templates); |
|
188 | 188 | |
189 | - if ( $check_if_custom && !empty( $template_path ) ) |
|
189 | + if ($check_if_custom && ! empty($template_path)) |
|
190 | 190 | return TRUE; |
191 | 191 | |
192 | 192 | // not in the theme |
193 | - if ( empty( $template_path )) { |
|
193 | + if (empty($template_path)) { |
|
194 | 194 | // not even a template to look for ? |
195 | - if ( empty( $templates )) { |
|
195 | + if (empty($templates)) { |
|
196 | 196 | // get post_type |
197 | - $post_type = EE_Registry::instance()->REQ->get( 'post_type' ); |
|
197 | + $post_type = EE_Registry::instance()->REQ->get('post_type'); |
|
198 | 198 | // get array of EE Custom Post Types |
199 | 199 | $EE_CPTs = EE_Register_CPTs::get_CPTs(); |
200 | 200 | // build template name based on request |
201 | - if ( isset( $EE_CPTs[ $post_type ] )) { |
|
202 | - $archive_or_single = is_archive() ? 'archive' : ''; |
|
203 | - $archive_or_single = is_single() ? 'single' : $archive_or_single; |
|
204 | - $templates = $archive_or_single . '-' . $post_type . '.php'; |
|
201 | + if (isset($EE_CPTs[$post_type])) { |
|
202 | + $archive_or_single = is_archive() ? 'archive' : ''; |
|
203 | + $archive_or_single = is_single() ? 'single' : $archive_or_single; |
|
204 | + $templates = $archive_or_single.'-'.$post_type.'.php'; |
|
205 | 205 | } |
206 | 206 | } |
207 | 207 | // currently active EE template theme |
@@ -210,79 +210,79 @@ discard block |
||
210 | 210 | // array of paths to folders that may contain templates |
211 | 211 | $template_folder_paths = array( |
212 | 212 | // first check the /wp-content/uploads/espresso/templates/(current EE theme)/ folder for an EE theme template file |
213 | - EVENT_ESPRESSO_TEMPLATE_DIR . $current_theme, |
|
213 | + EVENT_ESPRESSO_TEMPLATE_DIR.$current_theme, |
|
214 | 214 | // then in the root of the /wp-content/uploads/espresso/templates/ folder |
215 | 215 | EVENT_ESPRESSO_TEMPLATE_DIR |
216 | 216 | ); |
217 | 217 | |
218 | 218 | //add core plugin folders for checking only if we're not $check_if_custom |
219 | - if ( ! $check_if_custom ) { |
|
219 | + if ( ! $check_if_custom) { |
|
220 | 220 | $core_paths = array( |
221 | 221 | // in the /wp-content/plugins/(EE4 folder)/public/(current EE theme)/ folder within the plugin |
222 | - EE_PUBLIC . $current_theme, |
|
222 | + EE_PUBLIC.$current_theme, |
|
223 | 223 | // in the /wp-content/plugins/(EE4 folder)/core/templates/(current EE theme)/ folder within the plugin |
224 | - EE_TEMPLATES . $current_theme, |
|
224 | + EE_TEMPLATES.$current_theme, |
|
225 | 225 | // or maybe relative from the plugin root: /wp-content/plugins/(EE4 folder)/ |
226 | 226 | EE_PLUGIN_DIR_PATH |
227 | 227 | ); |
228 | - $template_folder_paths = array_merge( $template_folder_paths, $core_paths ); |
|
228 | + $template_folder_paths = array_merge($template_folder_paths, $core_paths); |
|
229 | 229 | } |
230 | 230 | |
231 | 231 | // now filter that array |
232 | - $template_folder_paths = apply_filters( 'FHEE__EEH_Template__locate_template__template_folder_paths', $template_folder_paths ); |
|
233 | - $templates = is_array( $templates ) ? $templates : array( $templates ); |
|
234 | - $template_folder_paths = is_array( $template_folder_paths ) ? $template_folder_paths : array( $template_folder_paths ); |
|
232 | + $template_folder_paths = apply_filters('FHEE__EEH_Template__locate_template__template_folder_paths', $template_folder_paths); |
|
233 | + $templates = is_array($templates) ? $templates : array($templates); |
|
234 | + $template_folder_paths = is_array($template_folder_paths) ? $template_folder_paths : array($template_folder_paths); |
|
235 | 235 | // array to hold all possible template paths |
236 | 236 | $full_template_paths = array(); |
237 | 237 | |
238 | 238 | // loop through $templates |
239 | - foreach ( $templates as $template ) { |
|
239 | + foreach ($templates as $template) { |
|
240 | 240 | // normalize directory separators |
241 | - $template = EEH_File::standardise_directory_separators( $template ); |
|
242 | - $file_name = basename( $template ); |
|
243 | - $template_path_minus_file_name = substr( $template, 0, ( strlen( $file_name ) * -1 ) ); |
|
241 | + $template = EEH_File::standardise_directory_separators($template); |
|
242 | + $file_name = basename($template); |
|
243 | + $template_path_minus_file_name = substr($template, 0, (strlen($file_name) * -1)); |
|
244 | 244 | // while looping through all template folder paths |
245 | - foreach ( $template_folder_paths as $template_folder_path ) { |
|
245 | + foreach ($template_folder_paths as $template_folder_path) { |
|
246 | 246 | // normalize directory separators |
247 | - $template_folder_path = EEH_File::standardise_directory_separators( $template_folder_path ); |
|
247 | + $template_folder_path = EEH_File::standardise_directory_separators($template_folder_path); |
|
248 | 248 | // determine if any common base path exists between the two paths |
249 | 249 | $common_base_path = EEH_Template::_find_common_base_path( |
250 | - array( $template_folder_path, $template_path_minus_file_name ) |
|
250 | + array($template_folder_path, $template_path_minus_file_name) |
|
251 | 251 | ); |
252 | - if ( $common_base_path !== '' ) { |
|
252 | + if ($common_base_path !== '') { |
|
253 | 253 | // both paths have a common base, so just tack the filename onto our search path |
254 | - $resolved_path = EEH_File::end_with_directory_separator( $template_folder_path ) . $file_name; |
|
254 | + $resolved_path = EEH_File::end_with_directory_separator($template_folder_path).$file_name; |
|
255 | 255 | } else { |
256 | 256 | // no common base path, so let's just concatenate |
257 | - $resolved_path = EEH_File::end_with_directory_separator( $template_folder_path ) . $template; |
|
257 | + $resolved_path = EEH_File::end_with_directory_separator($template_folder_path).$template; |
|
258 | 258 | } |
259 | 259 | // build up our template locations array by adding our resolved paths |
260 | 260 | $full_template_paths[] = $resolved_path; |
261 | 261 | } |
262 | 262 | // if $template is an absolute path, then we'll tack it onto the start of our array so that it gets searched first |
263 | - array_unshift( $full_template_paths, $template ); |
|
263 | + array_unshift($full_template_paths, $template); |
|
264 | 264 | // path to the directory of the current theme: /wp-content/themes/(current WP theme)/ |
265 | - array_unshift( $full_template_paths, get_stylesheet_directory() . DS . $file_name ); |
|
265 | + array_unshift($full_template_paths, get_stylesheet_directory().DS.$file_name); |
|
266 | 266 | } |
267 | 267 | // filter final array of full template paths |
268 | - $full_template_paths = apply_filters( 'FHEE__EEH_Template__locate_template__full_template_paths', $full_template_paths, $file_name ); |
|
268 | + $full_template_paths = apply_filters('FHEE__EEH_Template__locate_template__full_template_paths', $full_template_paths, $file_name); |
|
269 | 269 | // now loop through our final array of template location paths and check each location |
270 | - foreach ( (array)$full_template_paths as $full_template_path ) { |
|
271 | - if ( is_readable( $full_template_path )) { |
|
272 | - $template_path = str_replace( array( '\\', '/' ), DIRECTORY_SEPARATOR, $full_template_path ); |
|
270 | + foreach ((array) $full_template_paths as $full_template_path) { |
|
271 | + if (is_readable($full_template_path)) { |
|
272 | + $template_path = str_replace(array('\\', '/'), DIRECTORY_SEPARATOR, $full_template_path); |
|
273 | 273 | break; |
274 | 274 | } |
275 | 275 | } |
276 | 276 | } |
277 | 277 | // if we got it and you want to see it... |
278 | - if ( $template_path && $load && ! $check_if_custom ) { |
|
279 | - if ( $return_string ) { |
|
280 | - return EEH_Template::display_template( $template_path, $template_args, TRUE ); |
|
278 | + if ($template_path && $load && ! $check_if_custom) { |
|
279 | + if ($return_string) { |
|
280 | + return EEH_Template::display_template($template_path, $template_args, TRUE); |
|
281 | 281 | } else { |
282 | - EEH_Template::display_template( $template_path, $template_args, FALSE ); |
|
282 | + EEH_Template::display_template($template_path, $template_args, FALSE); |
|
283 | 283 | } |
284 | 284 | } |
285 | - return $check_if_custom && ! empty( $template_path ) ? TRUE : $template_path; |
|
285 | + return $check_if_custom && ! empty($template_path) ? TRUE : $template_path; |
|
286 | 286 | } |
287 | 287 | |
288 | 288 | |
@@ -295,21 +295,21 @@ discard block |
||
295 | 295 | * @param array $paths |
296 | 296 | * @return string |
297 | 297 | */ |
298 | - protected static function _find_common_base_path( $paths ) { |
|
298 | + protected static function _find_common_base_path($paths) { |
|
299 | 299 | $last_offset = 0; |
300 | 300 | $common_base_path = ''; |
301 | - while ( ( $index = strpos( $paths[ 0 ], DS, $last_offset ) ) !== false ) { |
|
301 | + while (($index = strpos($paths[0], DS, $last_offset)) !== false) { |
|
302 | 302 | $dir_length = $index - $last_offset + 1; |
303 | - $directory = substr( $paths[ 0 ], $last_offset, $dir_length ); |
|
304 | - foreach ( $paths as $path ) { |
|
305 | - if ( substr( $path, $last_offset, $dir_length ) != $directory ) { |
|
303 | + $directory = substr($paths[0], $last_offset, $dir_length); |
|
304 | + foreach ($paths as $path) { |
|
305 | + if (substr($path, $last_offset, $dir_length) != $directory) { |
|
306 | 306 | return $common_base_path; |
307 | 307 | } |
308 | 308 | } |
309 | 309 | $common_base_path .= $directory; |
310 | 310 | $last_offset = $index + 1; |
311 | 311 | } |
312 | - return substr( $common_base_path, 0, -1 ); |
|
312 | + return substr($common_base_path, 0, -1); |
|
313 | 313 | } |
314 | 314 | |
315 | 315 | |
@@ -321,7 +321,7 @@ discard block |
||
321 | 321 | * @param boolean $return_string whether to send output immediately to screen, or capture and return as a string |
322 | 322 | * @return mixed string |
323 | 323 | */ |
324 | - public static function display_template( $template_path = FALSE, $template_args = array(), $return_string = FALSE ) { |
|
324 | + public static function display_template($template_path = FALSE, $template_args = array(), $return_string = FALSE) { |
|
325 | 325 | |
326 | 326 | /** |
327 | 327 | * These two filters are intended for last minute changes to templates being loaded and/or template arg |
@@ -332,26 +332,26 @@ discard block |
||
332 | 332 | * |
333 | 333 | * @since 4.6.0 |
334 | 334 | */ |
335 | - $template_path = apply_filters( 'FHEE__EEH_Template__display_template__template_path', $template_path ); |
|
336 | - $template_args = apply_filters( 'FHEE__EEH_Template__display_template__template_args', $template_args ); |
|
335 | + $template_path = apply_filters('FHEE__EEH_Template__display_template__template_path', $template_path); |
|
336 | + $template_args = apply_filters('FHEE__EEH_Template__display_template__template_args', $template_args); |
|
337 | 337 | |
338 | 338 | // you gimme nuttin - YOU GET NUTTIN !! |
339 | - if ( ! $template_path || ! is_readable( $template_path )) { |
|
339 | + if ( ! $template_path || ! is_readable($template_path)) { |
|
340 | 340 | return ''; |
341 | 341 | } |
342 | 342 | // if $template_args are not in an array, then make it so |
343 | - if ( ! is_array( $template_args ) && ! is_object( $template_args )) { |
|
344 | - $template_args = array( $template_args ); |
|
343 | + if ( ! is_array($template_args) && ! is_object($template_args)) { |
|
344 | + $template_args = array($template_args); |
|
345 | 345 | } |
346 | - extract( (array) $template_args); |
|
346 | + extract((array) $template_args); |
|
347 | 347 | |
348 | - if ( $return_string ) { |
|
348 | + if ($return_string) { |
|
349 | 349 | // because we want to return a string, we are going to capture the output |
350 | 350 | ob_start(); |
351 | - include( $template_path ); |
|
351 | + include($template_path); |
|
352 | 352 | return ob_get_clean(); |
353 | 353 | } else { |
354 | - include( $template_path ); |
|
354 | + include($template_path); |
|
355 | 355 | } |
356 | 356 | return ''; |
357 | 357 | } |
@@ -369,27 +369,27 @@ discard block |
||
369 | 369 | * @param string $suffix added to the end of the generated class |
370 | 370 | * @return string |
371 | 371 | */ |
372 | - public static function get_object_css_class( $object = NULL, $prefix = '', $suffix = '' ) { |
|
372 | + public static function get_object_css_class($object = NULL, $prefix = '', $suffix = '') { |
|
373 | 373 | // in the beginning... |
374 | - $prefix = ! empty( $prefix ) ? rtrim( $prefix, '-' ) . '-' : ''; |
|
374 | + $prefix = ! empty($prefix) ? rtrim($prefix, '-').'-' : ''; |
|
375 | 375 | // da muddle |
376 | 376 | $class = ''; |
377 | 377 | // the end |
378 | - $suffix = ! empty( $suffix ) ? '-' . ltrim( $suffix, '-' ) : ''; |
|
378 | + $suffix = ! empty($suffix) ? '-'.ltrim($suffix, '-') : ''; |
|
379 | 379 | // is the passed object an EE object ? |
380 | - if ( $object instanceof EE_Base_Class ) { |
|
380 | + if ($object instanceof EE_Base_Class) { |
|
381 | 381 | // grab the exact type of object |
382 | - $obj_class = get_class( $object ); |
|
382 | + $obj_class = get_class($object); |
|
383 | 383 | // depending on the type of object... |
384 | - switch ( $obj_class ) { |
|
384 | + switch ($obj_class) { |
|
385 | 385 | // no specifics just yet... |
386 | 386 | default : |
387 | - $class = strtolower( str_replace( '_', '-', $obj_class )); |
|
388 | - $class .= method_exists( $obj_class, 'name' ) ? '-' . sanitize_title( $object->name() ) : ''; |
|
387 | + $class = strtolower(str_replace('_', '-', $obj_class)); |
|
388 | + $class .= method_exists($obj_class, 'name') ? '-'.sanitize_title($object->name()) : ''; |
|
389 | 389 | |
390 | 390 | } |
391 | 391 | } |
392 | - return $prefix . $class . $suffix; |
|
392 | + return $prefix.$class.$suffix; |
|
393 | 393 | } |
394 | 394 | |
395 | 395 | |
@@ -405,50 +405,50 @@ discard block |
||
405 | 405 | * @param string $cur_code_span_class |
406 | 406 | * @return string the html output for the formatted money value |
407 | 407 | */ |
408 | - public static function format_currency( $amount = NULL, $return_raw = FALSE, $display_code = TRUE, $CNT_ISO = '', $cur_code_span_class = 'currency-code' ) { |
|
408 | + public static function format_currency($amount = NULL, $return_raw = FALSE, $display_code = TRUE, $CNT_ISO = '', $cur_code_span_class = 'currency-code') { |
|
409 | 409 | // ensure amount was received |
410 | - if ( is_null( $amount ) ) { |
|
411 | - $msg = __( 'In order to format currency, an amount needs to be passed.', 'event_espresso' ); |
|
412 | - EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
410 | + if (is_null($amount)) { |
|
411 | + $msg = __('In order to format currency, an amount needs to be passed.', 'event_espresso'); |
|
412 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
413 | 413 | return ''; |
414 | 414 | } |
415 | 415 | //ensure amount is float |
416 | 416 | $amount = (float) $amount; |
417 | 417 | // filter raw amount (allows 0.00 to be changed to "free" for example) |
418 | - $amount_formatted = apply_filters( 'FHEE__EEH_Template__format_currency__amount', $amount, $return_raw ); |
|
418 | + $amount_formatted = apply_filters('FHEE__EEH_Template__format_currency__amount', $amount, $return_raw); |
|
419 | 419 | // still a number or was amount converted to a string like "free" ? |
420 | - if ( is_float( $amount_formatted )) { |
|
420 | + if (is_float($amount_formatted)) { |
|
421 | 421 | // was a country ISO code passed ? if so generate currency config object for that country |
422 | - $mny = $CNT_ISO !== '' ? new EE_Currency_Config( $CNT_ISO ) : NULL; |
|
422 | + $mny = $CNT_ISO !== '' ? new EE_Currency_Config($CNT_ISO) : NULL; |
|
423 | 423 | // verify results |
424 | - if ( ! $mny instanceof EE_Currency_Config ) { |
|
424 | + if ( ! $mny instanceof EE_Currency_Config) { |
|
425 | 425 | // set default config country currency settings |
426 | 426 | $mny = EE_Registry::instance()->CFG->currency instanceof EE_Currency_Config ? EE_Registry::instance()->CFG->currency : new EE_Currency_Config(); |
427 | 427 | } |
428 | 428 | // format float |
429 | - $amount_formatted = number_format( $amount, $mny->dec_plc, $mny->dec_mrk, $mny->thsnds ); |
|
429 | + $amount_formatted = number_format($amount, $mny->dec_plc, $mny->dec_mrk, $mny->thsnds); |
|
430 | 430 | // add formatting ? |
431 | - if ( ! $return_raw ) { |
|
431 | + if ( ! $return_raw) { |
|
432 | 432 | // add currency sign |
433 | - if( $mny->sign_b4 ){ |
|
434 | - if( $amount >= 0 ){ |
|
435 | - $amount_formatted = $mny->sign . $amount_formatted; |
|
436 | - }else{ |
|
437 | - $amount_formatted = '-' . $mny->sign . str_replace( '-', '', $amount_formatted ); |
|
433 | + if ($mny->sign_b4) { |
|
434 | + if ($amount >= 0) { |
|
435 | + $amount_formatted = $mny->sign.$amount_formatted; |
|
436 | + } else { |
|
437 | + $amount_formatted = '-'.$mny->sign.str_replace('-', '', $amount_formatted); |
|
438 | 438 | } |
439 | 439 | |
440 | - }else{ |
|
441 | - $amount_formatted = $amount_formatted . $mny->sign; |
|
440 | + } else { |
|
441 | + $amount_formatted = $amount_formatted.$mny->sign; |
|
442 | 442 | } |
443 | 443 | |
444 | 444 | // add currency code ? |
445 | - $amount_formatted = $display_code ? $amount_formatted . ' <span class="' . $cur_code_span_class . '">(' . $mny->code . ')</span>' : $amount_formatted; |
|
445 | + $amount_formatted = $display_code ? $amount_formatted.' <span class="'.$cur_code_span_class.'">('.$mny->code.')</span>' : $amount_formatted; |
|
446 | 446 | } |
447 | 447 | // filter results |
448 | - $amount_formatted = apply_filters( 'FHEE__EEH_Template__format_currency__amount_formatted', $amount_formatted, $mny, $return_raw ); |
|
448 | + $amount_formatted = apply_filters('FHEE__EEH_Template__format_currency__amount_formatted', $amount_formatted, $mny, $return_raw); |
|
449 | 449 | } |
450 | 450 | // clean up vars |
451 | - unset( $mny ); |
|
451 | + unset($mny); |
|
452 | 452 | // return formatted currency amount |
453 | 453 | return $amount_formatted; |
454 | 454 | } |
@@ -463,11 +463,11 @@ discard block |
||
463 | 463 | * @param string $schema 'UPPER', 'lower', or 'Sentence' |
464 | 464 | * @return string The localized label for the status id. |
465 | 465 | */ |
466 | - public static function pretty_status( $status_id, $plural = FALSE, $schema = 'upper' ) { |
|
466 | + public static function pretty_status($status_id, $plural = FALSE, $schema = 'upper') { |
|
467 | 467 | /** @type EEM_Status $EEM_Status */ |
468 | - $EEM_Status = EE_Registry::instance()->load_model( 'Status' ); |
|
469 | - $status = $EEM_Status->localized_status( array( $status_id => __( 'unknown', 'event_espresso' )), $plural, $schema ); |
|
470 | - return $status[ $status_id ]; |
|
468 | + $EEM_Status = EE_Registry::instance()->load_model('Status'); |
|
469 | + $status = $EEM_Status->localized_status(array($status_id => __('unknown', 'event_espresso')), $plural, $schema); |
|
470 | + return $status[$status_id]; |
|
471 | 471 | } |
472 | 472 | |
473 | 473 | |
@@ -480,9 +480,9 @@ discard block |
||
480 | 480 | * @param string $icon |
481 | 481 | * @return string the html output for the button |
482 | 482 | */ |
483 | - public static function get_button_or_link( $url, $label, $class = 'button-primary', $icon = '' ) { |
|
484 | - $label = ! empty( $icon ) ? '<span class="' . $icon . '"></span>' . $label : $label; |
|
485 | - $button = '<a id="' . sanitize_title_with_dashes($label) . '" href="' . $url . '" class="' . $class . '">' . $label . '</a>'; |
|
483 | + public static function get_button_or_link($url, $label, $class = 'button-primary', $icon = '') { |
|
484 | + $label = ! empty($icon) ? '<span class="'.$icon.'"></span>'.$label : $label; |
|
485 | + $button = '<a id="'.sanitize_title_with_dashes($label).'" href="'.$url.'" class="'.$class.'">'.$label.'</a>'; |
|
486 | 486 | return $button; |
487 | 487 | } |
488 | 488 | |
@@ -499,21 +499,21 @@ discard block |
||
499 | 499 | * @param bool|string $help_text (optional) send help text you want to use for the link if default not to be used |
500 | 500 | * @return string generated link |
501 | 501 | */ |
502 | - public static function get_help_tab_link( $help_tab_id, $page = FALSE, $action = FALSE, $icon_style = FALSE, $help_text = FALSE ) { |
|
502 | + public static function get_help_tab_link($help_tab_id, $page = FALSE, $action = FALSE, $icon_style = FALSE, $help_text = FALSE) { |
|
503 | 503 | |
504 | - if ( ! $page ) |
|
505 | - $page = isset( $_REQUEST['page'] ) && ! empty( $_REQUEST['page'] ) ? sanitize_key( $_REQUEST['page'] ) : $page; |
|
504 | + if ( ! $page) |
|
505 | + $page = isset($_REQUEST['page']) && ! empty($_REQUEST['page']) ? sanitize_key($_REQUEST['page']) : $page; |
|
506 | 506 | |
507 | - if ( ! $action ) |
|
508 | - $action = isset( $_REQUEST['action'] ) && ! empty( $_REQUEST['action'] ) ? sanitize_key( $_REQUEST['action'] ) : $action; |
|
507 | + if ( ! $action) |
|
508 | + $action = isset($_REQUEST['action']) && ! empty($_REQUEST['action']) ? sanitize_key($_REQUEST['action']) : $action; |
|
509 | 509 | |
510 | 510 | $action = empty($action) ? 'default' : $action; |
511 | 511 | |
512 | 512 | |
513 | - $help_tab_lnk = $page . '-' . $action . '-' . $help_tab_id; |
|
514 | - $icon = !$icon_style ? ' dashicons-editor-help' : $icon_style; |
|
515 | - $help_text = !$help_text ? '' : $help_text; |
|
516 | - return '<a id="' . $help_tab_lnk . '" class="ee-clickable dashicons espresso-help-tab-lnk ee-icon-size-22' . $icon . '" title="' . esc_attr__('Click to open the \'Help\' tab for more information about this feature.', 'event_espresso') . '" > ' . $help_text . ' </a>'; |
|
513 | + $help_tab_lnk = $page.'-'.$action.'-'.$help_tab_id; |
|
514 | + $icon = ! $icon_style ? ' dashicons-editor-help' : $icon_style; |
|
515 | + $help_text = ! $help_text ? '' : $help_text; |
|
516 | + return '<a id="'.$help_tab_lnk.'" class="ee-clickable dashicons espresso-help-tab-lnk ee-icon-size-22'.$icon.'" title="'.esc_attr__('Click to open the \'Help\' tab for more information about this feature.', 'event_espresso').'" > '.$help_text.' </a>'; |
|
517 | 517 | } |
518 | 518 | |
519 | 519 | |
@@ -525,31 +525,31 @@ discard block |
||
525 | 525 | * @param EE_Help_Tour |
526 | 526 | * @return string html |
527 | 527 | */ |
528 | - public static function help_tour_stops_generator( EE_Help_Tour $tour ) { |
|
528 | + public static function help_tour_stops_generator(EE_Help_Tour $tour) { |
|
529 | 529 | $id = $tour->get_slug(); |
530 | 530 | $stops = $tour->get_stops(); |
531 | 531 | |
532 | - $content = '<ol style="display:none" id="' . $id . '">'; |
|
532 | + $content = '<ol style="display:none" id="'.$id.'">'; |
|
533 | 533 | |
534 | - foreach ( $stops as $stop ) { |
|
535 | - $data_id = !empty( $stop['id'] ) ? ' data-id="' . $stop['id'] . '"' : ''; |
|
536 | - $data_class = empty( $data_id ) && !empty( $stop['class'] ) ? ' data-class="' . $stop['class'] . '"' : ''; |
|
534 | + foreach ($stops as $stop) { |
|
535 | + $data_id = ! empty($stop['id']) ? ' data-id="'.$stop['id'].'"' : ''; |
|
536 | + $data_class = empty($data_id) && ! empty($stop['class']) ? ' data-class="'.$stop['class'].'"' : ''; |
|
537 | 537 | |
538 | 538 | //if container is set to modal then let's make sure we set the options accordingly |
539 | - if ( empty( $data_id ) && empty( $data_class ) ) { |
|
539 | + if (empty($data_id) && empty($data_class)) { |
|
540 | 540 | $stop['options']['modal'] = true; |
541 | 541 | $stop['options']['expose'] = true; |
542 | 542 | } |
543 | 543 | |
544 | - $custom_class = !empty( $stop['custom_class'] ) ? ' class="' . $stop['custom_class'] . '"' : ''; |
|
545 | - $button_text = !empty( $stop['button_text'] ) ? ' data-button="' . $stop['button_text'] . '"' : ''; |
|
544 | + $custom_class = ! empty($stop['custom_class']) ? ' class="'.$stop['custom_class'].'"' : ''; |
|
545 | + $button_text = ! empty($stop['button_text']) ? ' data-button="'.$stop['button_text'].'"' : ''; |
|
546 | 546 | $inner_content = isset($stop['content']) ? $stop['content'] : ''; |
547 | 547 | |
548 | 548 | //options |
549 | - if ( isset( $stop['options'] ) && is_array( $stop['options'] ) ) { |
|
549 | + if (isset($stop['options']) && is_array($stop['options'])) { |
|
550 | 550 | $options = ' data-options="'; |
551 | - foreach ( $stop['options'] as $option => $value ) { |
|
552 | - $options .= $option . ':' . $value . ';'; |
|
551 | + foreach ($stop['options'] as $option => $value) { |
|
552 | + $options .= $option.':'.$value.';'; |
|
553 | 553 | } |
554 | 554 | $options .= '"'; |
555 | 555 | } else { |
@@ -557,7 +557,7 @@ discard block |
||
557 | 557 | } |
558 | 558 | |
559 | 559 | //let's put all together |
560 | - $content .= '<li' . $data_id . $data_class . $custom_class . $button_text . $options . '>' . $inner_content . '</li>'; |
|
560 | + $content .= '<li'.$data_id.$data_class.$custom_class.$button_text.$options.'>'.$inner_content.'</li>'; |
|
561 | 561 | } |
562 | 562 | |
563 | 563 | $content .= '</ol>'; |
@@ -578,31 +578,31 @@ discard block |
||
578 | 578 | * @throws EE_Error |
579 | 579 | * @return string html structure for status. |
580 | 580 | */ |
581 | - public static function status_legend( $status_array, $active_status = '' ) { |
|
582 | - if ( !is_array( $status_array ) ) |
|
583 | - throw new EE_Error( __('The EEH_Template::status_legend helper required the incoming status_array argument to be an array!', 'event_espresso') ); |
|
581 | + public static function status_legend($status_array, $active_status = '') { |
|
582 | + if ( ! is_array($status_array)) |
|
583 | + throw new EE_Error(__('The EEH_Template::status_legend helper required the incoming status_array argument to be an array!', 'event_espresso')); |
|
584 | 584 | |
585 | 585 | $setup_array = array(); |
586 | - foreach ( $status_array as $item => $status ) { |
|
586 | + foreach ($status_array as $item => $status) { |
|
587 | 587 | $setup_array[$item] = array( |
588 | - 'class' => 'ee-status-legend ee-status-legend-' . $status, |
|
589 | - 'desc' => EEH_Template::pretty_status( $status, FALSE, 'sentence' ), |
|
588 | + 'class' => 'ee-status-legend ee-status-legend-'.$status, |
|
589 | + 'desc' => EEH_Template::pretty_status($status, FALSE, 'sentence'), |
|
590 | 590 | 'status' => $status |
591 | 591 | ); |
592 | 592 | } |
593 | 593 | |
594 | - $content = '<div class="ee-list-table-legend-container">' . "\n"; |
|
595 | - $content .= '<h3>' . __('Status Legend', 'event_espresso') . '</h3>' . "\n"; |
|
596 | - $content .= '<dl class="ee-list-table-legend">' . "\n\t"; |
|
597 | - foreach ( $setup_array as $item => $details ) { |
|
594 | + $content = '<div class="ee-list-table-legend-container">'."\n"; |
|
595 | + $content .= '<h3>'.__('Status Legend', 'event_espresso').'</h3>'."\n"; |
|
596 | + $content .= '<dl class="ee-list-table-legend">'."\n\t"; |
|
597 | + foreach ($setup_array as $item => $details) { |
|
598 | 598 | $active_class = $active_status == $details['status'] ? ' class="ee-is-active-status"' : ''; |
599 | - $content .= '<dt id="ee-legend-item-tooltip-' . $item . '"' . $active_class . '>' . "\n\t\t"; |
|
600 | - $content .= '<span class="' . $details['class'] . '"></span>' . "\n\t\t"; |
|
601 | - $content .= '<span class="ee-legend-description">' . $details['desc'] . '</span>' . "\n\t"; |
|
602 | - $content .= '</dt>' . "\n"; |
|
599 | + $content .= '<dt id="ee-legend-item-tooltip-'.$item.'"'.$active_class.'>'."\n\t\t"; |
|
600 | + $content .= '<span class="'.$details['class'].'"></span>'."\n\t\t"; |
|
601 | + $content .= '<span class="ee-legend-description">'.$details['desc'].'</span>'."\n\t"; |
|
602 | + $content .= '</dt>'."\n"; |
|
603 | 603 | } |
604 | - $content .= '</dl>' . "\n"; |
|
605 | - $content .= '</div>' . "\n"; |
|
604 | + $content .= '</dl>'."\n"; |
|
605 | + $content .= '</div>'."\n"; |
|
606 | 606 | return $content; |
607 | 607 | } |
608 | 608 | |
@@ -615,8 +615,8 @@ discard block |
||
615 | 615 | * @return string |
616 | 616 | */ |
617 | 617 | public static function layout_array_as_table($data) { |
618 | - if (is_object($data) || $data instanceof __PHP_Incomplete_Class ) { |
|
619 | - $data = (array)$data; |
|
618 | + if (is_object($data) || $data instanceof __PHP_Incomplete_Class) { |
|
619 | + $data = (array) $data; |
|
620 | 620 | } |
621 | 621 | ob_start(); |
622 | 622 | if (is_array($data)) { |
@@ -629,10 +629,10 @@ discard block |
||
629 | 629 | ?> |
630 | 630 | <tr> |
631 | 631 | <td> |
632 | - <?php echo $data_key;?> |
|
632 | + <?php echo $data_key; ?> |
|
633 | 633 | </td> |
634 | 634 | <td> |
635 | - <?php echo self::layout_array_as_table($data_values);?> |
|
635 | + <?php echo self::layout_array_as_table($data_values); ?> |
|
636 | 636 | </td> |
637 | 637 | </tr> |
638 | 638 | <?php |
@@ -646,7 +646,7 @@ discard block |
||
646 | 646 | <ul> |
647 | 647 | <?php |
648 | 648 | foreach ($data as $datum) { |
649 | - echo "<li>"; echo self::layout_array_as_table($datum);echo "</li>"; |
|
649 | + echo "<li>"; echo self::layout_array_as_table($datum); echo "</li>"; |
|
650 | 650 | }?> |
651 | 651 | </ul> |
652 | 652 | <?php |
@@ -676,8 +676,8 @@ discard block |
||
676 | 676 | * |
677 | 677 | * @return string |
678 | 678 | */ |
679 | - public static function paging_html( $total_items, $current, $per_page, $url, $show_num_field = TRUE, $paged_arg_name = 'paged', $items_label = array() ) { |
|
680 | - echo self::get_paging_html( $total_items, $current, $per_page, $url, $show_num_field, $paged_arg_name, $items_label ); |
|
679 | + public static function paging_html($total_items, $current, $per_page, $url, $show_num_field = TRUE, $paged_arg_name = 'paged', $items_label = array()) { |
|
680 | + echo self::get_paging_html($total_items, $current, $per_page, $url, $show_num_field, $paged_arg_name, $items_label); |
|
681 | 681 | } |
682 | 682 | |
683 | 683 | |
@@ -701,13 +701,13 @@ discard block |
||
701 | 701 | * ) |
702 | 702 | * @return string |
703 | 703 | */ |
704 | - public static function get_paging_html( $total_items, $current, $per_page, $url, $show_num_field = TRUE, $paged_arg_name = 'paged', $items_label = array() ) { |
|
704 | + public static function get_paging_html($total_items, $current, $per_page, $url, $show_num_field = TRUE, $paged_arg_name = 'paged', $items_label = array()) { |
|
705 | 705 | $page_links = array(); |
706 | 706 | $disable_first = $disable_last = ''; |
707 | 707 | $total_items = (int) $total_items; |
708 | 708 | $per_page = (int) $per_page; |
709 | 709 | $current = (int) $current; |
710 | - $paged_arg_name = empty( $paged_arg_name ) ? 'paged' : sanitize_key( $paged_arg_name ); |
|
710 | + $paged_arg_name = empty($paged_arg_name) ? 'paged' : sanitize_key($paged_arg_name); |
|
711 | 711 | |
712 | 712 | //filter items_label |
713 | 713 | $items_label = apply_filters( |
@@ -715,68 +715,68 @@ discard block |
||
715 | 715 | $items_label |
716 | 716 | ); |
717 | 717 | |
718 | - if ( empty( $items_label ) |
|
719 | - || ! is_array( $items_label ) |
|
720 | - || ! isset( $items_label['single'] ) |
|
721 | - || ! isset( $items_label['plural'] ) ) { |
|
718 | + if (empty($items_label) |
|
719 | + || ! is_array($items_label) |
|
720 | + || ! isset($items_label['single']) |
|
721 | + || ! isset($items_label['plural'])) { |
|
722 | 722 | $items_label = array( |
723 | - 'single' => __( '1 item', 'event_espresso' ), |
|
724 | - 'plural' => __( '%s items', 'event_espresso' ) |
|
723 | + 'single' => __('1 item', 'event_espresso'), |
|
724 | + 'plural' => __('%s items', 'event_espresso') |
|
725 | 725 | ); |
726 | 726 | } else { |
727 | 727 | $items_label = array( |
728 | - 'single' => '1 ' . esc_html( $items_label['single'] ), |
|
729 | - 'plural' => '%s ' . esc_html( $items_label['plural'] ) |
|
728 | + 'single' => '1 '.esc_html($items_label['single']), |
|
729 | + 'plural' => '%s '.esc_html($items_label['plural']) |
|
730 | 730 | ); |
731 | 731 | } |
732 | 732 | |
733 | - $total_pages = ceil( $total_items / $per_page ); |
|
733 | + $total_pages = ceil($total_items / $per_page); |
|
734 | 734 | |
735 | - if ( $total_pages <= 1 ) |
|
735 | + if ($total_pages <= 1) |
|
736 | 736 | return ''; |
737 | 737 | |
738 | - $item_label = $total_items > 1 ? sprintf( $items_label['plural'], $total_items ) : $items_label['single']; |
|
738 | + $item_label = $total_items > 1 ? sprintf($items_label['plural'], $total_items) : $items_label['single']; |
|
739 | 739 | |
740 | - $output = '<span class="displaying-num">' . $item_label . '</span>'; |
|
740 | + $output = '<span class="displaying-num">'.$item_label.'</span>'; |
|
741 | 741 | |
742 | - if ( $current === 1 ) { |
|
742 | + if ($current === 1) { |
|
743 | 743 | $disable_first = ' disabled'; |
744 | 744 | } |
745 | - if ( $current == $total_pages ) { |
|
745 | + if ($current == $total_pages) { |
|
746 | 746 | $disable_last = ' disabled'; |
747 | 747 | } |
748 | 748 | |
749 | - $page_links[] = sprintf( "<a class='%s' title='%s' href='%s'>%s</a>", |
|
750 | - 'first-page' . $disable_first, |
|
751 | - esc_attr__( 'Go to the first page' ), |
|
752 | - esc_url( remove_query_arg( $paged_arg_name, $url ) ), |
|
749 | + $page_links[] = sprintf("<a class='%s' title='%s' href='%s'>%s</a>", |
|
750 | + 'first-page'.$disable_first, |
|
751 | + esc_attr__('Go to the first page'), |
|
752 | + esc_url(remove_query_arg($paged_arg_name, $url)), |
|
753 | 753 | '«' |
754 | 754 | ); |
755 | 755 | |
756 | 756 | $page_links[] = sprintf( |
757 | 757 | '<a class="%s" title="%s" href="%s">%s</a>', |
758 | - 'prev-page' . $disable_first, |
|
759 | - esc_attr__( 'Go to the previous page' ), |
|
760 | - esc_url( add_query_arg( $paged_arg_name, max( 1, $current-1 ), $url ) ), |
|
758 | + 'prev-page'.$disable_first, |
|
759 | + esc_attr__('Go to the previous page'), |
|
760 | + esc_url(add_query_arg($paged_arg_name, max(1, $current - 1), $url)), |
|
761 | 761 | '‹' |
762 | 762 | ); |
763 | 763 | |
764 | - if ( ! $show_num_field ) { |
|
764 | + if ( ! $show_num_field) { |
|
765 | 765 | $html_current_page = $current; |
766 | 766 | } else { |
767 | - $html_current_page = sprintf( "<input class='current-page' title='%s' type='text' name=$paged_arg_name value='%s' size='%d' />", |
|
768 | - esc_attr__( 'Current page' ), |
|
767 | + $html_current_page = sprintf("<input class='current-page' title='%s' type='text' name=$paged_arg_name value='%s' size='%d' />", |
|
768 | + esc_attr__('Current page'), |
|
769 | 769 | $current, |
770 | - strlen( $total_pages ) |
|
770 | + strlen($total_pages) |
|
771 | 771 | ); |
772 | 772 | } |
773 | 773 | |
774 | 774 | $html_total_pages = sprintf( |
775 | 775 | '<span class="total-pages">%s</span>', |
776 | - number_format_i18n( $total_pages ) |
|
776 | + number_format_i18n($total_pages) |
|
777 | 777 | ); |
778 | 778 | $page_links[] = sprintf( |
779 | - _x( '%3$s%1$s of %2$s%4$s', 'paging' ), |
|
779 | + _x('%3$s%1$s of %2$s%4$s', 'paging'), |
|
780 | 780 | $html_current_page, |
781 | 781 | $html_total_pages, |
782 | 782 | '<span class="paging-input">', |
@@ -785,29 +785,29 @@ discard block |
||
785 | 785 | |
786 | 786 | $page_links[] = sprintf( |
787 | 787 | '<a class="%s" title="%s" href="%s">%s</a>', |
788 | - 'next-page' . $disable_last, |
|
789 | - esc_attr__( 'Go to the next page' ), |
|
790 | - esc_url( add_query_arg( $paged_arg_name, min( $total_pages, $current+1 ), $url ) ), |
|
788 | + 'next-page'.$disable_last, |
|
789 | + esc_attr__('Go to the next page'), |
|
790 | + esc_url(add_query_arg($paged_arg_name, min($total_pages, $current + 1), $url)), |
|
791 | 791 | '›' |
792 | 792 | ); |
793 | 793 | |
794 | 794 | $page_links[] = sprintf( |
795 | 795 | '<a class="%s" title="%s" href="%s">%s</a>', |
796 | - 'last-page' . $disable_last, |
|
797 | - esc_attr__( 'Go to the last page' ), |
|
798 | - esc_url( add_query_arg( $paged_arg_name, $total_pages, $url ) ), |
|
796 | + 'last-page'.$disable_last, |
|
797 | + esc_attr__('Go to the last page'), |
|
798 | + esc_url(add_query_arg($paged_arg_name, $total_pages, $url)), |
|
799 | 799 | '»' |
800 | 800 | ); |
801 | 801 | |
802 | - $output .= "\n" . '<span class="pagination-links">' . join( "\n", $page_links ) . '</span>'; |
|
802 | + $output .= "\n".'<span class="pagination-links">'.join("\n", $page_links).'</span>'; |
|
803 | 803 | // set page class |
804 | - if ( $total_pages ) { |
|
804 | + if ($total_pages) { |
|
805 | 805 | $page_class = $total_pages < 2 ? ' one-page' : ''; |
806 | 806 | } else { |
807 | 807 | $page_class = ' no-pages'; |
808 | 808 | } |
809 | 809 | |
810 | - return '<div class="tablenav"><div class="tablenav-pages' . $page_class . '">' . $output . '</div></div>'; |
|
810 | + return '<div class="tablenav"><div class="tablenav-pages'.$page_class.'">'.$output.'</div></div>'; |
|
811 | 811 | } |
812 | 812 | |
813 | 813 | |
@@ -823,7 +823,7 @@ discard block |
||
823 | 823 | //add_filter( 'FHEE__EEH_Template__format_currency__amount', 'convert_zero_to_free', 10, 2 ); |
824 | 824 | |
825 | 825 | |
826 | -if ( ! function_exists( 'espresso_pagination' ) ) { |
|
826 | +if ( ! function_exists('espresso_pagination')) { |
|
827 | 827 | /** |
828 | 828 | * espresso_pagination |
829 | 829 | * |
@@ -835,21 +835,21 @@ discard block |
||
835 | 835 | $big = 999999999; // need an unlikely integer |
836 | 836 | $pagination = paginate_links( |
837 | 837 | array( |
838 | - 'base' => str_replace( $big, '%#%', esc_url( get_pagenum_link( $big ) ) ), |
|
838 | + 'base' => str_replace($big, '%#%', esc_url(get_pagenum_link($big))), |
|
839 | 839 | 'format' => '?paged=%#%', |
840 | - 'current' => max( 1, get_query_var( 'paged' ) ), |
|
840 | + 'current' => max(1, get_query_var('paged')), |
|
841 | 841 | 'total' => $wp_query->max_num_pages, |
842 | 842 | 'show_all' => true, |
843 | 843 | 'end_size' => 10, |
844 | 844 | 'mid_size' => 6, |
845 | 845 | 'prev_next' => true, |
846 | - 'prev_text' => __( '‹ PREV', 'event_espresso' ), |
|
847 | - 'next_text' => __( 'NEXT ›', 'event_espresso' ), |
|
846 | + 'prev_text' => __('‹ PREV', 'event_espresso'), |
|
847 | + 'next_text' => __('NEXT ›', 'event_espresso'), |
|
848 | 848 | 'type' => 'plain', |
849 | 849 | 'add_args' => false, |
850 | 850 | 'add_fragment' => '' |
851 | 851 | ) |
852 | 852 | ); |
853 | - echo ! empty( $pagination ) ? '<div class="ee-pagination-dv clear">' . $pagination . '</div>' : ''; |
|
853 | + echo ! empty($pagination) ? '<div class="ee-pagination-dv clear">'.$pagination.'</div>' : ''; |
|
854 | 854 | } |
855 | 855 | } |
856 | 856 | \ No newline at end of file |