@@ -99,10 +99,10 @@ |
||
99 | 99 | if( $field_name == 'STA_ID' ){ |
100 | 100 | $state_name_field = \EEM_State::instance()->field_settings_for( 'STA_name' ); |
101 | 101 | $csv_row[ __( 'State', 'event_espresso' ) ] = $attendee_row[ $state_name_field->get_qualified_column() ]; |
102 | - }elseif( $field_name == 'CNT_ISO' ){ |
|
102 | + } elseif( $field_name == 'CNT_ISO' ){ |
|
103 | 103 | $country_name_field = \EEM_Country::instance()->field_settings_for( 'CNT_name' ); |
104 | 104 | $csv_row[ __( 'Country', 'event_espresso' ) ] = $attendee_row[ $country_name_field->get_qualified_column() ]; |
105 | - }else{ |
|
105 | + } else{ |
|
106 | 106 | $csv_row[ $field_obj->get_nicename() ] = $attendee_row[ $field_obj->get_qualified_column() ]; |
107 | 107 | } |
108 | 108 | } |
@@ -85,6 +85,11 @@ |
||
85 | 85 | public function count_units_to_process() { |
86 | 86 | return \EEM_Attendee::instance()->count( array( 'caps' => \EEM_Base::caps_read_admin )); |
87 | 87 | } |
88 | + |
|
89 | + /** |
|
90 | + * @param integer $offset |
|
91 | + * @param integer $limit |
|
92 | + */ |
|
88 | 93 | public function get_csv_data( $offset, $limit ) { |
89 | 94 | $attendee_rows = \EEM_Attendee::instance()->get_all_wpdb_results( |
90 | 95 | array( |
@@ -108,10 +108,10 @@ |
||
108 | 108 | } |
109 | 109 | } |
110 | 110 | $csv_data[] = apply_filters( |
111 | - 'FHEE___EventEspresso_core_libraries_batch_JobHandlers_AttendeesReport__get_csv_data__row', |
|
112 | - $csv_row, |
|
113 | - $attendee_row |
|
114 | - ); |
|
111 | + 'FHEE___EventEspresso_core_libraries_batch_JobHandlers_AttendeesReport__get_csv_data__row', |
|
112 | + $csv_row, |
|
113 | + $attendee_row |
|
114 | + ); |
|
115 | 115 | } |
116 | 116 | return $csv_data; |
117 | 117 | } |
@@ -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,84 +27,84 @@ 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 | - return \EEM_Attendee::instance()->count( array( 'caps' => \EEM_Base::caps_read_admin )); |
|
86 | + return \EEM_Attendee::instance()->count(array('caps' => \EEM_Base::caps_read_admin)); |
|
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 | 'caps' => \EEM_Base::caps_read_admin |
94 | 94 | ) |
95 | 95 | ); |
96 | 96 | $csv_data = array(); |
97 | - foreach( $attendee_rows as $attendee_row ){ |
|
97 | + foreach ($attendee_rows as $attendee_row) { |
|
98 | 98 | $csv_row = array(); |
99 | - foreach( \EEM_Attendee::instance()->field_settings() as $field_name => $field_obj ){ |
|
100 | - if( $field_name == 'STA_ID' ){ |
|
101 | - $state_name_field = \EEM_State::instance()->field_settings_for( 'STA_name' ); |
|
102 | - $csv_row[ __( 'State', 'event_espresso' ) ] = $attendee_row[ $state_name_field->get_qualified_column() ]; |
|
103 | - }elseif( $field_name == 'CNT_ISO' ){ |
|
104 | - $country_name_field = \EEM_Country::instance()->field_settings_for( 'CNT_name' ); |
|
105 | - $csv_row[ __( 'Country', 'event_espresso' ) ] = $attendee_row[ $country_name_field->get_qualified_column() ]; |
|
106 | - }else{ |
|
107 | - $csv_row[ $field_obj->get_nicename() ] = $attendee_row[ $field_obj->get_qualified_column() ]; |
|
99 | + foreach (\EEM_Attendee::instance()->field_settings() as $field_name => $field_obj) { |
|
100 | + if ($field_name == 'STA_ID') { |
|
101 | + $state_name_field = \EEM_State::instance()->field_settings_for('STA_name'); |
|
102 | + $csv_row[__('State', 'event_espresso')] = $attendee_row[$state_name_field->get_qualified_column()]; |
|
103 | + }elseif ($field_name == 'CNT_ISO') { |
|
104 | + $country_name_field = \EEM_Country::instance()->field_settings_for('CNT_name'); |
|
105 | + $csv_row[__('Country', 'event_espresso')] = $attendee_row[$country_name_field->get_qualified_column()]; |
|
106 | + } else { |
|
107 | + $csv_row[$field_obj->get_nicename()] = $attendee_row[$field_obj->get_qualified_column()]; |
|
108 | 108 | } |
109 | 109 | } |
110 | 110 | $csv_data[] = apply_filters( |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | -if (!defined('EVENT_ESPRESSO_VERSION') ) |
|
2 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) |
|
3 | 3 | exit('NO direct script access allowed'); |
4 | 4 | |
5 | 5 | /** |
@@ -46,22 +46,22 @@ discard block |
||
46 | 46 | * @return string the assembled html string containing the tabbed content for display. |
47 | 47 | * @throws \EE_Error |
48 | 48 | */ |
49 | - public static function display($tabs_contents, $tabs_names = array(), $small_tabs = true, $tabs_content = TRUE ) { |
|
49 | + public static function display($tabs_contents, $tabs_names = array(), $small_tabs = true, $tabs_content = TRUE) { |
|
50 | 50 | |
51 | 51 | //first check if $tabs_names is not empty then the count must match the count of $tabs_content otherwise we've got a problem houston |
52 | - if ( !empty( $tabs_names) && ( count( (array) $tabs_names) != count( (array) $tabs_content) ) ) { |
|
53 | - throw new EE_Error( __('The count for $tabs_names and $tabs_content does not match.', 'event_espresso') ); |
|
52 | + if ( ! empty($tabs_names) && (count((array) $tabs_names) != count((array) $tabs_content))) { |
|
53 | + throw new EE_Error(__('The count for $tabs_names and $tabs_content does not match.', 'event_espresso')); |
|
54 | 54 | } |
55 | 55 | |
56 | 56 | //make sure we've got incoming data setup properly |
57 | - $tabs = !empty( $tabs_names ) ? (array) $tabs_names : array_keys( (array) $tabs_contents ); |
|
58 | - $tabs_content = !empty( $tabs_names ) ? array_combine( (array) $tabs_names, (array) $tabs_content ) : $tabs_contents; |
|
57 | + $tabs = ! empty($tabs_names) ? (array) $tabs_names : array_keys((array) $tabs_contents); |
|
58 | + $tabs_content = ! empty($tabs_names) ? array_combine((array) $tabs_names, (array) $tabs_content) : $tabs_contents; |
|
59 | 59 | |
60 | - $all_tabs = '<h2 class="nav-tab-wrapper">' . "\n"; |
|
60 | + $all_tabs = '<h2 class="nav-tab-wrapper">'."\n"; |
|
61 | 61 | $all_tabs_content = ''; |
62 | 62 | |
63 | 63 | $index = 0; |
64 | - foreach ( $tabs as $tab ) { |
|
64 | + foreach ($tabs as $tab) { |
|
65 | 65 | $active = $index === 0 ? true : false; |
66 | 66 | $all_tabs .= self::tab($tab, $active); |
67 | 67 | $all_tabs_content .= self::tab_content($tab, $tabs_content[$tab], $active); |
@@ -78,7 +78,7 @@ discard block |
||
78 | 78 | |
79 | 79 | $tab_container_class = $small_tabs ? 'ee-nav-tabs ee-nav-tabs-small' : 'ee-nav-tabs'; |
80 | 80 | |
81 | - return '<div class="'. $tab_container_class . '">' . "\n\t" . $all_tabs . $all_tabs_content . "\n" . '</div>'; |
|
81 | + return '<div class="'.$tab_container_class.'">'."\n\t".$all_tabs.$all_tabs_content."\n".'</div>'; |
|
82 | 82 | } |
83 | 83 | |
84 | 84 | |
@@ -102,11 +102,11 @@ discard block |
||
102 | 102 | * @throws \EE_Error |
103 | 103 | */ |
104 | 104 | public static function display_admin_nav_tabs($nav_tabs = array()) { |
105 | - if ( empty($nav_tabs) ) |
|
106 | - throw new EE_Error( __('Nav Tabs cannot be generated because the tab array is missing', 'event_espresso' ) ); |
|
105 | + if (empty($nav_tabs)) |
|
106 | + throw new EE_Error(__('Nav Tabs cannot be generated because the tab array is missing', 'event_espresso')); |
|
107 | 107 | |
108 | - $all_tabs = '<h2 class="nav-tab-wrapper">' . "\n"; |
|
109 | - foreach ( $nav_tabs as $slug => $tab ) { |
|
108 | + $all_tabs = '<h2 class="nav-tab-wrapper">'."\n"; |
|
109 | + foreach ($nav_tabs as $slug => $tab) { |
|
110 | 110 | $all_tabs .= self::tab($slug, false, $tab['link_text'], $tab['url'], $tab['css_class']); |
111 | 111 | } |
112 | 112 | $all_tabs .= '</h2>'; |
@@ -122,13 +122,13 @@ discard block |
||
122 | 122 | * @param bool|string $css If string given then the generated tab will include that as the class. |
123 | 123 | * @return string html for tab |
124 | 124 | */ |
125 | - private static function tab($name, $active = false, $nice_name = FALSE, $url = FALSE, $css = FALSE ) { |
|
125 | + private static function tab($name, $active = false, $nice_name = FALSE, $url = FALSE, $css = FALSE) { |
|
126 | 126 | $name = str_replace(' ', '-', $name); |
127 | 127 | $class = $active ? 'nav-tab nav-tab-active' : 'nav-tab'; |
128 | - $class = $css ? $class . ' ' . $css : $class; |
|
129 | - $nice_name = $nice_name ? $nice_name : ucwords( preg_replace('/(-|_)/', ' ', $name) ); |
|
130 | - $url = $url ? $url : '#' . $name; |
|
131 | - $tab = '<a class="' . $class . '" rel="ee-tab-' . $name . '" href="' . $url . '">' . $nice_name . '</a>' . "\n\t"; |
|
128 | + $class = $css ? $class.' '.$css : $class; |
|
129 | + $nice_name = $nice_name ? $nice_name : ucwords(preg_replace('/(-|_)/', ' ', $name)); |
|
130 | + $url = $url ? $url : '#'.$name; |
|
131 | + $tab = '<a class="'.$class.'" rel="ee-tab-'.$name.'" href="'.$url.'">'.$nice_name.'</a>'."\n\t"; |
|
132 | 132 | return $tab; |
133 | 133 | } |
134 | 134 | |
@@ -144,9 +144,9 @@ discard block |
||
144 | 144 | */ |
145 | 145 | private static function tab_content($name, $tab_content, $active = false) { |
146 | 146 | $class = $active ? 'nav-tab-content' : 'nav-tab-content hidden'; |
147 | - $name = str_replace( ' ', '-', $name); |
|
148 | - $content = "\t" . '<div class="'. $class . '" id="ee-tab-' . $name . '">' . "\n"; |
|
149 | - $content .= "\t" . $tab_content . "\n"; |
|
147 | + $name = str_replace(' ', '-', $name); |
|
148 | + $content = "\t".'<div class="'.$class.'" id="ee-tab-'.$name.'">'."\n"; |
|
149 | + $content .= "\t".$tab_content."\n"; |
|
150 | 150 | $content .= '<div style="clear:both"></div></div>'; |
151 | 151 | return $content; |
152 | 152 | } |
@@ -172,9 +172,9 @@ discard block |
||
172 | 172 | * @param string $default You can include a string for the item that will receive the "item_display" class for the js. |
173 | 173 | * @return string a html snippet of of all the formatted link elements. |
174 | 174 | */ |
175 | - public static function tab_text_links( $item_array, $container_class = '', $sep = '|', $default = '' ) { |
|
176 | - $item_array = apply_filters( 'FHEE__EEH_Tabbed_Content__tab_text_links', $item_array, $container_class ); |
|
177 | - if ( !is_array($item_array) || empty( $item_array ) ) |
|
175 | + public static function tab_text_links($item_array, $container_class = '', $sep = '|', $default = '') { |
|
176 | + $item_array = apply_filters('FHEE__EEH_Tabbed_Content__tab_text_links', $item_array, $container_class); |
|
177 | + if ( ! is_array($item_array) || empty($item_array)) |
|
178 | 178 | return false; //get out we don't have even the basic thing we need! |
179 | 179 | |
180 | 180 | |
@@ -185,15 +185,15 @@ discard block |
||
185 | 185 | 'title' => esc_attr__('Link for Item', 'event_espresso'), |
186 | 186 | 'slug' => 'item_slug' |
187 | 187 | ); |
188 | - $container_class = !empty($container_class) ? 'ee-text-links ' . $container_class : 'ee-text-links'; |
|
189 | - $list = '<ul class="' . $container_class . '">'; |
|
188 | + $container_class = ! empty($container_class) ? 'ee-text-links '.$container_class : 'ee-text-links'; |
|
189 | + $list = '<ul class="'.$container_class.'">'; |
|
190 | 190 | |
191 | 191 | $ci = 1; |
192 | - foreach ( $item_array as $item ) { |
|
193 | - $item = wp_parse_args( $item, $defaults ); |
|
194 | - $item['class'] = !empty($default) && $default == $item['slug'] ? 'item_display ' . $item['class'] : $item['class']; |
|
192 | + foreach ($item_array as $item) { |
|
193 | + $item = wp_parse_args($item, $defaults); |
|
194 | + $item['class'] = ! empty($default) && $default == $item['slug'] ? 'item_display '.$item['class'] : $item['class']; |
|
195 | 195 | $list .= self::_text_link_item($item); |
196 | - if ( !empty($sep) && $ci != count($item_array) ) |
|
196 | + if ( ! empty($sep) && $ci != count($item_array)) |
|
197 | 197 | $list .= self::_text_link_item($sep); |
198 | 198 | $ci++; |
199 | 199 | } |
@@ -204,9 +204,9 @@ discard block |
||
204 | 204 | |
205 | 205 | |
206 | 206 | |
207 | - private static function _text_link_item( $item ) { |
|
207 | + private static function _text_link_item($item) { |
|
208 | 208 | //if this isn't an array then we're doing a separator |
209 | - if ( !is_array( $item ) ) { |
|
209 | + if ( ! is_array($item)) { |
|
210 | 210 | $label = $item; |
211 | 211 | $class = 'ee-text-link-sep'; |
212 | 212 | $href = ''; |
@@ -215,12 +215,12 @@ discard block |
||
215 | 215 | extract($item); |
216 | 216 | } |
217 | 217 | |
218 | - $class = $class != 'ee-text-link-sep' ? 'class="ee-text-link-li ' . $class . '"' : 'class="ee-text-link-sep"'; |
|
218 | + $class = $class != 'ee-text-link-sep' ? 'class="ee-text-link-li '.$class.'"' : 'class="ee-text-link-sep"'; |
|
219 | 219 | |
220 | - $content = '<li ' . $class . '>'; |
|
221 | - $content .= !empty($href) ? '<a class="ee-text-link" href="#' . $href . '" title="' . $title . '">' : ''; |
|
220 | + $content = '<li '.$class.'>'; |
|
221 | + $content .= ! empty($href) ? '<a class="ee-text-link" href="#'.$href.'" title="'.$title.'">' : ''; |
|
222 | 222 | $content .= $label; |
223 | - $content .= !empty($href) ? '</a>' : ''; |
|
223 | + $content .= ! empty($href) ? '</a>' : ''; |
|
224 | 224 | $content .= '</li>'; |
225 | 225 | return $content; |
226 | 226 | } |
@@ -1,6 +1,7 @@ discard block |
||
1 | 1 | <?php |
2 | -if (!defined('EVENT_ESPRESSO_VERSION') ) |
|
2 | +if (!defined('EVENT_ESPRESSO_VERSION') ) { |
|
3 | 3 | exit('NO direct script access allowed'); |
4 | +} |
|
4 | 5 | |
5 | 6 | /** |
6 | 7 | * Event Espresso |
@@ -102,8 +103,9 @@ discard block |
||
102 | 103 | * @throws \EE_Error |
103 | 104 | */ |
104 | 105 | public static function display_admin_nav_tabs($nav_tabs = array()) { |
105 | - if ( empty($nav_tabs) ) |
|
106 | - throw new EE_Error( __('Nav Tabs cannot be generated because the tab array is missing', 'event_espresso' ) ); |
|
106 | + if ( empty($nav_tabs) ) { |
|
107 | + throw new EE_Error( __('Nav Tabs cannot be generated because the tab array is missing', 'event_espresso' ) ); |
|
108 | + } |
|
107 | 109 | |
108 | 110 | $all_tabs = '<h2 class="nav-tab-wrapper">' . "\n"; |
109 | 111 | foreach ( $nav_tabs as $slug => $tab ) { |
@@ -174,8 +176,10 @@ discard block |
||
174 | 176 | */ |
175 | 177 | public static function tab_text_links( $item_array, $container_class = '', $sep = '|', $default = '' ) { |
176 | 178 | $item_array = apply_filters( 'FHEE__EEH_Tabbed_Content__tab_text_links', $item_array, $container_class ); |
177 | - if ( !is_array($item_array) || empty( $item_array ) ) |
|
178 | - return false; //get out we don't have even the basic thing we need! |
|
179 | + if ( !is_array($item_array) || empty( $item_array ) ) { |
|
180 | + return false; |
|
181 | + } |
|
182 | + //get out we don't have even the basic thing we need! |
|
179 | 183 | |
180 | 184 | |
181 | 185 | $defaults = array( |
@@ -193,8 +197,9 @@ discard block |
||
193 | 197 | $item = wp_parse_args( $item, $defaults ); |
194 | 198 | $item['class'] = !empty($default) && $default == $item['slug'] ? 'item_display ' . $item['class'] : $item['class']; |
195 | 199 | $list .= self::_text_link_item($item); |
196 | - if ( !empty($sep) && $ci != count($item_array) ) |
|
197 | - $list .= self::_text_link_item($sep); |
|
200 | + if ( !empty($sep) && $ci != count($item_array) ) { |
|
201 | + $list .= self::_text_link_item($sep); |
|
202 | + } |
|
198 | 203 | $ci++; |
199 | 204 | } |
200 | 205 |
@@ -34,37 +34,37 @@ |
||
34 | 34 | */ |
35 | 35 | class Post implements RequestMethod |
36 | 36 | { |
37 | - /** |
|
38 | - * URL to which requests are POSTed. |
|
39 | - * @const string |
|
40 | - */ |
|
41 | - const SITE_VERIFY_URL = 'https://www.google.com/recaptcha/api/siteverify'; |
|
37 | + /** |
|
38 | + * URL to which requests are POSTed. |
|
39 | + * @const string |
|
40 | + */ |
|
41 | + const SITE_VERIFY_URL = 'https://www.google.com/recaptcha/api/siteverify'; |
|
42 | 42 | |
43 | - /** |
|
44 | - * Submit the POST request with the specified parameters. |
|
45 | - * |
|
46 | - * @param RequestParameters $params Request parameters |
|
47 | - * @return string Body of the reCAPTCHA response |
|
48 | - */ |
|
49 | - public function submit(RequestParameters $params) |
|
50 | - { |
|
51 | - /** |
|
52 | - * PHP 5.6.0 changed the way you specify the peer name for SSL context options. |
|
53 | - * Using "CN_name" will still work, but it will raise deprecated errors. |
|
54 | - */ |
|
55 | - $peer_key = version_compare(PHP_VERSION, '5.6.0', '<') ? 'CN_name' : 'peer_name'; |
|
56 | - $options = array( |
|
57 | - 'http' => array( |
|
58 | - 'header' => "Content-type: application/x-www-form-urlencoded\r\n", |
|
59 | - 'method' => 'POST', |
|
60 | - 'content' => $params->toQueryString(), |
|
61 | - // Force the peer to validate (not needed in 5.6.0+, but still works |
|
62 | - 'verify_peer' => true, |
|
63 | - // Force the peer validation to use www.google.com |
|
64 | - $peer_key => 'www.google.com', |
|
65 | - ), |
|
66 | - ); |
|
67 | - $context = stream_context_create($options); |
|
68 | - return file_get_contents(self::SITE_VERIFY_URL, false, $context); |
|
69 | - } |
|
43 | + /** |
|
44 | + * Submit the POST request with the specified parameters. |
|
45 | + * |
|
46 | + * @param RequestParameters $params Request parameters |
|
47 | + * @return string Body of the reCAPTCHA response |
|
48 | + */ |
|
49 | + public function submit(RequestParameters $params) |
|
50 | + { |
|
51 | + /** |
|
52 | + * PHP 5.6.0 changed the way you specify the peer name for SSL context options. |
|
53 | + * Using "CN_name" will still work, but it will raise deprecated errors. |
|
54 | + */ |
|
55 | + $peer_key = version_compare(PHP_VERSION, '5.6.0', '<') ? 'CN_name' : 'peer_name'; |
|
56 | + $options = array( |
|
57 | + 'http' => array( |
|
58 | + 'header' => "Content-type: application/x-www-form-urlencoded\r\n", |
|
59 | + 'method' => 'POST', |
|
60 | + 'content' => $params->toQueryString(), |
|
61 | + // Force the peer to validate (not needed in 5.6.0+, but still works |
|
62 | + 'verify_peer' => true, |
|
63 | + // Force the peer validation to use www.google.com |
|
64 | + $peer_key => 'www.google.com', |
|
65 | + ), |
|
66 | + ); |
|
67 | + $context = stream_context_create($options); |
|
68 | + return file_get_contents(self::SITE_VERIFY_URL, false, $context); |
|
69 | + } |
|
70 | 70 | } |
@@ -5,42 +5,42 @@ |
||
5 | 5 | <table class="admin-primary-mbox-tbl"> |
6 | 6 | <thead> |
7 | 7 | <tr> |
8 | - <th class="jst-left"><?php esc_html_e( 'Event Name', 'event_espresso' );?></th> |
|
9 | - <th class="jst-left"><?php esc_html_e( 'REG ID', 'event_espresso' );?></th> |
|
10 | - <th class="jst-left"><?php esc_html_e( 'TXN ID', 'event_espresso' );?></th> |
|
11 | - <th class="jst-left"><?php esc_html_e( 'Reg Code', 'event_espresso' );?></th> |
|
12 | - <th class="jst-rght"><?php esc_html_e( 'Ticket Price', 'event_espresso' );?></th> |
|
8 | + <th class="jst-left"><?php esc_html_e('Event Name', 'event_espresso'); ?></th> |
|
9 | + <th class="jst-left"><?php esc_html_e('REG ID', 'event_espresso'); ?></th> |
|
10 | + <th class="jst-left"><?php esc_html_e('TXN ID', 'event_espresso'); ?></th> |
|
11 | + <th class="jst-left"><?php esc_html_e('Reg Code', 'event_espresso'); ?></th> |
|
12 | + <th class="jst-rght"><?php esc_html_e('Ticket Price', 'event_espresso'); ?></th> |
|
13 | 13 | </tr> |
14 | 14 | </thead> |
15 | 15 | <tbody> |
16 | - <?php foreach( $registrations as $registration ) : ?> |
|
16 | + <?php foreach ($registrations as $registration) : ?> |
|
17 | 17 | <tr> |
18 | 18 | <td class="jst-left"> |
19 | 19 | <?php |
20 | - $event_url = add_query_arg( array( 'action' => 'edit', 'post' => $registration->event_ID() ), admin_url( 'admin.php?page=espresso_events' )); |
|
21 | - echo EE_Registry::instance()->CAP->current_user_can( 'ee_edit_event', 'espresso_events_edit', $registration->event_ID() ) ? '<a href="'. $event_url .'" title="'. esc_attr__( 'Edit Event', 'event_espresso' ) .'">' . $registration->event_name() . '</a>' : $registration->event_name(); |
|
20 | + $event_url = add_query_arg(array('action' => 'edit', 'post' => $registration->event_ID()), admin_url('admin.php?page=espresso_events')); |
|
21 | + echo EE_Registry::instance()->CAP->current_user_can('ee_edit_event', 'espresso_events_edit', $registration->event_ID()) ? '<a href="'.$event_url.'" title="'.esc_attr__('Edit Event', 'event_espresso').'">'.$registration->event_name().'</a>' : $registration->event_name(); |
|
22 | 22 | ?> |
23 | 23 | </td> |
24 | 24 | <td class="jst-left"> |
25 | 25 | <?php |
26 | - $reg_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'view_registration', '_REG_ID'=>$registration->ID() ), REG_ADMIN_URL ); |
|
27 | - echo EE_Registry::instance()->CAP->current_user_can( 'ee_read_registration', 'espresso_registrations_view_registration', $registration->ID() ) ? ' |
|
28 | - <a href="'.$reg_url.'" title="' . esc_attr__( 'View Registration Details', 'event_espresso' ) . '">' . |
|
29 | - esc_html__( 'View Registration', 'event_espresso' ) . |
|
26 | + $reg_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'view_registration', '_REG_ID'=>$registration->ID()), REG_ADMIN_URL); |
|
27 | + echo EE_Registry::instance()->CAP->current_user_can('ee_read_registration', 'espresso_registrations_view_registration', $registration->ID()) ? ' |
|
28 | + <a href="'.$reg_url.'" title="'.esc_attr__('View Registration Details', 'event_espresso').'">'. |
|
29 | + esc_html__('View Registration', 'event_espresso'). |
|
30 | 30 | '</a>' : $registration->ID(); |
31 | 31 | ?> |
32 | 32 | </td> |
33 | 33 | <td class="jst-left"> |
34 | 34 | <?php |
35 | - $txn_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'view_transaction', 'TXN_ID'=>$registration->transaction_ID() ), TXN_ADMIN_URL ); |
|
36 | - echo EE_Registry::instance()->CAP->current_user_can( 'ee_read_transaction', 'espresso_transactions_view_transaction' ) ? ' |
|
37 | - <a href="'.$txn_url.'" title="' . esc_attr__( 'View Transaction Details', 'event_espresso' ) . '">' . |
|
38 | - sprintf( esc_html__('View Transaction %d', 'event_espresso'), $registration->transaction_ID() ) . |
|
35 | + $txn_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'view_transaction', 'TXN_ID'=>$registration->transaction_ID()), TXN_ADMIN_URL); |
|
36 | + echo EE_Registry::instance()->CAP->current_user_can('ee_read_transaction', 'espresso_transactions_view_transaction') ? ' |
|
37 | + <a href="'.$txn_url.'" title="'.esc_attr__('View Transaction Details', 'event_espresso').'">'. |
|
38 | + sprintf(esc_html__('View Transaction %d', 'event_espresso'), $registration->transaction_ID()). |
|
39 | 39 | '</a>' : $registration->transaction_ID(); |
40 | 40 | ?> |
41 | 41 | </td> |
42 | - <td class="jst-left"><?php echo $registration->reg_code();?></td> |
|
43 | - <td class="jst-rght"><?php echo EEH_Template::format_currency( $registration->final_price() );?></td> |
|
42 | + <td class="jst-left"><?php echo $registration->reg_code(); ?></td> |
|
43 | + <td class="jst-rght"><?php echo EEH_Template::format_currency($registration->final_price()); ?></td> |
|
44 | 44 | </tr> |
45 | 45 | <?php endforeach; ?> |
46 | 46 | </tbody> |
@@ -8,36 +8,36 @@ |
||
8 | 8 | * @subpackage Expression package is undefined on line 19, column 19 in Templates/Scripting/PHPClass.php. |
9 | 9 | * @author Mike Nelson |
10 | 10 | */ |
11 | -class EE_Max_Length_Validation_Strategy extends EE_Validation_Strategy_Base{ |
|
11 | +class EE_Max_Length_Validation_Strategy extends EE_Validation_Strategy_Base { |
|
12 | 12 | |
13 | 13 | protected $_max_length; |
14 | 14 | |
15 | - public function __construct( $validation_error_message = NULL, $max_length = EE_INF ) { |
|
15 | + public function __construct($validation_error_message = NULL, $max_length = EE_INF) { |
|
16 | 16 | $this->_max_length = $max_length; |
17 | - if( $validation_error_message === null ) { |
|
18 | - $validation_error_message = sprintf( __( 'Input is too long. Maximum number of characters is %1$s', 'event_espresso' ), $max_length ); |
|
17 | + if ($validation_error_message === null) { |
|
18 | + $validation_error_message = sprintf(__('Input is too long. Maximum number of characters is %1$s', 'event_espresso'), $max_length); |
|
19 | 19 | } |
20 | - parent::__construct( $validation_error_message ); |
|
20 | + parent::__construct($validation_error_message); |
|
21 | 21 | } |
22 | 22 | |
23 | 23 | /** |
24 | 24 | * @param $normalized_value |
25 | 25 | */ |
26 | 26 | public function validate($normalized_value) { |
27 | - if( $this->_max_length !== EE_INF && |
|
27 | + if ($this->_max_length !== EE_INF && |
|
28 | 28 | $normalized_value && |
29 | - is_string( $normalized_value ) && |
|
30 | - strlen( $normalized_value ) > $this->_max_length){ |
|
31 | - throw new EE_Validation_Error( $this->get_validation_error_message(), 'maxlength' ); |
|
29 | + is_string($normalized_value) && |
|
30 | + strlen($normalized_value) > $this->_max_length) { |
|
31 | + throw new EE_Validation_Error($this->get_validation_error_message(), 'maxlength'); |
|
32 | 32 | } |
33 | 33 | } |
34 | 34 | |
35 | 35 | /** |
36 | 36 | * @return array |
37 | 37 | */ |
38 | - function get_jquery_validation_rule_array(){ |
|
39 | - if( $this->_max_length !== EE_INF ) { |
|
40 | - return array( 'maxlength'=> $this->_max_length, 'messages' => array( 'maxlength' => $this->get_validation_error_message() ) ); |
|
38 | + function get_jquery_validation_rule_array() { |
|
39 | + if ($this->_max_length !== EE_INF) { |
|
40 | + return array('maxlength'=> $this->_max_length, 'messages' => array('maxlength' => $this->get_validation_error_message())); |
|
41 | 41 | } else { |
42 | 42 | return array(); |
43 | 43 | } |
@@ -21,26 +21,26 @@ |
||
21 | 21 | * @since $VID:$ |
22 | 22 | * |
23 | 23 | */ |
24 | -if (!defined('EVENT_ESPRESSO_VERSION')) { |
|
24 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
25 | 25 | exit('No direct script access allowed'); |
26 | 26 | } |
27 | 27 | |
28 | -class EEM_Extra_Join extends EEM_Base{ |
|
28 | +class EEM_Extra_Join extends EEM_Base { |
|
29 | 29 | // private instance of the Extra Join object |
30 | 30 | protected static $_instance = NULL; |
31 | 31 | |
32 | 32 | public function __construct($timezone = NULL) { |
33 | - $models_this_can_join = array_keys( EE_Registry::instance()->non_abstract_db_models ); |
|
33 | + $models_this_can_join = array_keys(EE_Registry::instance()->non_abstract_db_models); |
|
34 | 34 | $this->_tables = array( |
35 | - 'Extra_Join' => new EE_Primary_Table( 'esp_extra_join', 'EXJ_ID' ), |
|
35 | + 'Extra_Join' => new EE_Primary_Table('esp_extra_join', 'EXJ_ID'), |
|
36 | 36 | ); |
37 | 37 | $this->_fields = array( |
38 | 38 | 'Extra_Join' => array( |
39 | - 'EXJ_ID' => new EE_Primary_Key_Int_Field( 'EXJ_ID', __( 'Extra Join ID', 'event_espresso' ) ), |
|
40 | - 'EXJ_first_model_ID' => new EE_Foreign_Key_String_Field( 'EXJ_first_model_ID', __( 'First Model ID', 'event_espresso' ), true, 0, $models_this_can_join ), |
|
41 | - 'EXJ_first_model_name' => new EE_Any_Foreign_Model_Name_Field( 'EXJ_first_model_name', __( 'First Model Name', 'event_espresso'), true, '', $models_this_can_join ), |
|
42 | - 'EXJ_second_model_ID' => new EE_Foreign_Key_String_Field( 'EXJ_second_model_ID', __( 'Second Model ID', 'event_espresso' ), true, 0, $models_this_can_join ), |
|
43 | - 'EXJ_second_model_name' => new EE_Any_Foreign_Model_Name_Field( 'EXJ_second_model_name', __( 'Second Model Name', 'event_espresso'), true, '', $models_this_can_join ), |
|
39 | + 'EXJ_ID' => new EE_Primary_Key_Int_Field('EXJ_ID', __('Extra Join ID', 'event_espresso')), |
|
40 | + 'EXJ_first_model_ID' => new EE_Foreign_Key_String_Field('EXJ_first_model_ID', __('First Model ID', 'event_espresso'), true, 0, $models_this_can_join), |
|
41 | + 'EXJ_first_model_name' => new EE_Any_Foreign_Model_Name_Field('EXJ_first_model_name', __('First Model Name', 'event_espresso'), true, '', $models_this_can_join), |
|
42 | + 'EXJ_second_model_ID' => new EE_Foreign_Key_String_Field('EXJ_second_model_ID', __('Second Model ID', 'event_espresso'), true, 0, $models_this_can_join), |
|
43 | + 'EXJ_second_model_name' => new EE_Any_Foreign_Model_Name_Field('EXJ_second_model_name', __('Second Model Name', 'event_espresso'), true, '', $models_this_can_join), |
|
44 | 44 | |
45 | 45 | ) |
46 | 46 | ); |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -if (!defined('EVENT_ESPRESSO_VERSION')) { |
|
3 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
4 | 4 | exit('No direct script access allowed'); |
5 | 5 | } |
6 | 6 | |
@@ -14,7 +14,7 @@ discard block |
||
14 | 14 | * @author Brent Christensen |
15 | 15 | * |
16 | 16 | */ |
17 | -class EE_DMS_4_9_0_Answers_With_No_Registration extends EE_Data_Migration_Script_Stage{ |
|
17 | +class EE_DMS_4_9_0_Answers_With_No_Registration extends EE_Data_Migration_Script_Stage { |
|
18 | 18 | |
19 | 19 | |
20 | 20 | |
@@ -24,7 +24,7 @@ discard block |
||
24 | 24 | * @return EE_DMS_4_9_0_Answers_With_No_Registration |
25 | 25 | */ |
26 | 26 | public function __construct() { |
27 | - $this->_pretty_name = __( 'Answer Cleanup', 'event_espresso' ); |
|
27 | + $this->_pretty_name = __('Answer Cleanup', 'event_espresso'); |
|
28 | 28 | parent::__construct(); |
29 | 29 | } |
30 | 30 | |
@@ -48,9 +48,9 @@ discard block |
||
48 | 48 | protected function _migration_step($num_items_to_migrate = 50) { |
49 | 49 | global $wpdb; |
50 | 50 | $wpdb->delete( |
51 | - $wpdb->prefix . 'esp_answer', |
|
52 | - array( 'REG_ID' => 0 ), |
|
53 | - array( '%d' ) |
|
51 | + $wpdb->prefix.'esp_answer', |
|
52 | + array('REG_ID' => 0), |
|
53 | + array('%d') |
|
54 | 54 | ); |
55 | 55 | $this->set_completed(); |
56 | 56 | return 1; |
@@ -26,16 +26,16 @@ discard block |
||
26 | 26 | * |
27 | 27 | * ------------------------------------------------------------------------ |
28 | 28 | */ |
29 | -require_once ( EE_MODELS . 'EEM_Base.model.php' ); |
|
29 | +require_once (EE_MODELS.'EEM_Base.model.php'); |
|
30 | 30 | |
31 | 31 | class EEM_Extra_Meta extends EEM_Base { |
32 | 32 | |
33 | 33 | // private instance of the Attendee object |
34 | 34 | protected static $_instance = NULL; |
35 | 35 | |
36 | - protected function __construct( $timezone = NULL ) { |
|
37 | - $this->singular_item = __('Extra Meta','event_espresso'); |
|
38 | - $this->plural_item = __('Extra Metas','event_espresso'); |
|
36 | + protected function __construct($timezone = NULL) { |
|
37 | + $this->singular_item = __('Extra Meta', 'event_espresso'); |
|
38 | + $this->plural_item = __('Extra Metas', 'event_espresso'); |
|
39 | 39 | $this->_tables = array( |
40 | 40 | 'Extra_Meta'=> new EE_Primary_Table('esp_extra_meta', 'EXM_ID') |
41 | 41 | ); |
@@ -50,13 +50,13 @@ discard block |
||
50 | 50 | |
51 | 51 | )); |
52 | 52 | $this->_model_relations = array(); |
53 | - foreach($models_this_can_attach_to as $model){ |
|
53 | + foreach ($models_this_can_attach_to as $model) { |
|
54 | 54 | $this->_model_relations[$model] = new EE_Belongs_To_Any_Relation(); |
55 | 55 | } |
56 | - foreach( $this->cap_contexts_to_cap_action_map() as $cap_context => $action ) { |
|
57 | - $this->_cap_restriction_generators[ $cap_context ] = new EE_Restriction_Generator_Meta( 'EXM_key', 'EXM_value' ); |
|
56 | + foreach ($this->cap_contexts_to_cap_action_map() as $cap_context => $action) { |
|
57 | + $this->_cap_restriction_generators[$cap_context] = new EE_Restriction_Generator_Meta('EXM_key', 'EXM_value'); |
|
58 | 58 | } |
59 | - parent::__construct( $timezone ); |
|
59 | + parent::__construct($timezone); |
|
60 | 60 | } |
61 | 61 | |
62 | 62 |
@@ -1,4 +1,6 @@ |
||
1 | -<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed'); |
|
1 | +<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
2 | + exit('No direct script access allowed'); |
|
3 | +} |
|
2 | 4 | /** |
3 | 5 | * Event Espresso |
4 | 6 | * |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | -if ( !defined( 'EVENT_ESPRESSO_VERSION' ) ) { |
|
3 | - exit( 'No direct script access allowed' ); |
|
2 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
3 | + exit('No direct script access allowed'); |
|
4 | 4 | } |
5 | 5 | |
6 | 6 | /** |
@@ -14,7 +14,7 @@ discard block |
||
14 | 14 | * @author Mike Nelson |
15 | 15 | * |
16 | 16 | */ |
17 | -class EE_Restriction_Generator_Meta extends EE_Restriction_Generator_Base{ |
|
17 | +class EE_Restriction_Generator_Meta extends EE_Restriction_Generator_Base { |
|
18 | 18 | |
19 | 19 | /** |
20 | 20 | * |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | * @param string $key_field_name |
34 | 34 | * @param string $value_field_name |
35 | 35 | */ |
36 | - public function __construct( $key_field_name, $value_field_name ) { |
|
36 | + public function __construct($key_field_name, $value_field_name) { |
|
37 | 37 | $this->_key_field_name = $key_field_name; |
38 | 38 | $this->_value_field_name = $value_field_name; |
39 | 39 | } |
@@ -45,21 +45,21 @@ discard block |
||
45 | 45 | * @throws EE_Error |
46 | 46 | */ |
47 | 47 | protected function _generate_restrictions() { |
48 | - $whitelisted_meta_keys = apply_filters( 'FHEE__EE_Restriction_Generator_Meta___generate_restrictions__whitelisted_meta_keys', array() ); |
|
49 | - $blacklisted_meta_keys = apply_filters( 'FHEE__EE_Restriction_Generator_Meta___generate_restrictions__blacklisted_meta_keys', array() ); |
|
48 | + $whitelisted_meta_keys = apply_filters('FHEE__EE_Restriction_Generator_Meta___generate_restrictions__whitelisted_meta_keys', array()); |
|
49 | + $blacklisted_meta_keys = apply_filters('FHEE__EE_Restriction_Generator_Meta___generate_restrictions__blacklisted_meta_keys', array()); |
|
50 | 50 | $conditions = array( |
51 | - $this->_key_field_name => array( 'NOT_LIKE', "\\\\_%" ),//each slash is escaped because we are using double quotes, and |
|
51 | + $this->_key_field_name => array('NOT_LIKE', "\\\\_%"), //each slash is escaped because we are using double quotes, and |
|
52 | 52 | //stripslashes will be called on this because the models assume this is from user input |
53 | - $this->_value_field_name => array( 'NOT_REGEXP', '^[aOs]:[\d]:.*$') |
|
53 | + $this->_value_field_name => array('NOT_REGEXP', '^[aOs]:[\d]:.*$') |
|
54 | 54 | ); |
55 | - if( ! empty( $blacklisted_meta_keys ) ) { |
|
56 | - $conditions[ $this->_key_field_name . '*blacklisted' ] = array( 'NOT_IN', $blacklisted_meta_keys ); |
|
55 | + if ( ! empty($blacklisted_meta_keys)) { |
|
56 | + $conditions[$this->_key_field_name.'*blacklisted'] = array('NOT_IN', $blacklisted_meta_keys); |
|
57 | 57 | } |
58 | - if( ! empty( $whitelisted_meta_keys ) ) { |
|
58 | + if ( ! empty($whitelisted_meta_keys)) { |
|
59 | 59 | $conditions = array( |
60 | 60 | 'OR*whitelisted-or-normal' => array( |
61 | 61 | 'AND' => $conditions, |
62 | - $this->_key_field_name . '*whitelisted' => array( 'IN', $whitelisted_meta_keys ) |
|
62 | + $this->_key_field_name.'*whitelisted' => array('IN', $whitelisted_meta_keys) |
|
63 | 63 | ) |
64 | 64 | ); |
65 | 65 | } |
@@ -67,7 +67,7 @@ discard block |
||
67 | 67 | //only allow access to non-protected metas if they're an admin |
68 | 68 | EE_Restriction_Generator_Base::get_default_restrictions_cap() => new EE_Return_None_Where_Conditions(), |
69 | 69 | //don't allow access to protected metas to anyone. If they want that, don't apply caps to the query |
70 | - 'apply-to-all-queries-using-caps' => new EE_Default_Where_Conditions( $conditions ), |
|
70 | + 'apply-to-all-queries-using-caps' => new EE_Default_Where_Conditions($conditions), |
|
71 | 71 | ); |
72 | 72 | } |
73 | 73 | } |