PluginProbe
Stream – Activity Log & Audit Trail / 3.4.2
Stream – Activity Log & Audit Trail v3.4.2
4.4.0 4.3.0 4.2.2 4.2.1 trunk 2.0.1 2.0.2 2.0.3 2.0.4 2.0.5 3.0.0 3.0.1 3.0.2 3.0.3 3.0.4 3.0.5 3.0.6 3.0.7 3.1 3.1.1 3.10.0 3.2.0 3.2.1 3.2.2 3.2.3 All 50 releases
← All changes | classes/class-export.php +10 -43 trunk3.4.2 View file →
@@ -1,19 +1,10 @@
1 1 <?php
2 -/**
3 - * Loads & Manages exporter classes.
4 - *
5 - * @package WP_Stream
6 - */
7 -
8 2 namespace WP_Stream;
9 3
10 -/**
11 - * Class - Export
12 - */
13 4 class Export {
14 5 /**
15 - * Holds instance of plugin object
6 + * Hold Plugin class
16 7 *
17 8 * @var Plugin
18 9 */
19 10 public $plugin;
@@ -45,14 +36,8 @@
45 36 *
46 37 * @return void
47 38 */
48 39 public function render_download() {
49 - // Records are only viewable by users with the Stream view capability;
50 - // don't rely on the nonce alone for authorization.
51 - if ( ! current_user_can( $this->plugin->admin->view_cap ) ) {
52 - return;
53 - }
54 -
55 40 $nonce = wp_stream_filter_input( INPUT_GET, 'stream_record_actions_nonce' );
56 41 if ( ! wp_verify_nonce( $nonce, 'stream_record_actions_nonce' ) ) {
57 42 return;
58 43 }
@@ -87,16 +72,14 @@
87 72
88 73 /**
89 74 * Add Export options to record actions menu
90 75 *
91 - * @param array $action_menu_items Export types.
92 - *
93 76 * @return array
94 77 */
95 78 public function actions_menu_export_items( $action_menu_items ) {
96 79 foreach ( $this->get_exporters() as $exporter ) {
97 80 $action = 'export-' . $exporter->slug;
98 - /* translators: %s: an export format (e.g. "CSV") */
81 + // translators: Placeholder refers to an export format (e.g. "CSV")
99 82 $action_menu_items[ $action ] = sprintf( __( 'Export as %s', 'stream' ), $exporter->name );
100 83 }
101 84
102 85 return $action_menu_items;
@@ -115,10 +98,10 @@
115 98 $row_out = array();
116 99 foreach ( array_keys( $columns ) as $column_name ) {
117 100 switch ( $column_name ) {
118 101 case 'date':
119 - $created = gmdate( 'Y-m-d H:i:s', strtotime( $record->created ) );
120 - $row_out[ $column_name ] = get_date_from_gmt( $created, 'Y/m/d h:i:s A T' );
102 + $created = date( 'Y-m-d H:i:s', strtotime( $record->created ) );
103 + $row_out[ $column_name ] = get_date_from_gmt( $created, 'Y/m/d h:i:s A' );
121 104 break;
122 105
123 106 case 'summary':
124 107 $row_out[ $column_name ] = $record->summary;
@@ -123,17 +106,13 @@
123 106 case 'summary':
124 107 $row_out[ $column_name ] = $record->summary;
125 108 break;
126 109
127 - case 'user':
110 + case 'user_id':
128 111 $user = new Author( (int) $record->user_id, (array) $record->user_meta );
129 112 $row_out[ $column_name ] = $user->get_display_name();
130 113 break;
131 114
132 - case 'user_id':
133 - $row_out[ $column_name ] = $record->user_id;
134 - break;
135 -
136 115 case 'connector':
137 116 $row_out[ $column_name ] = $record->connector;
138 117 break;
139 118
@@ -140,12 +119,8 @@
140 119 case 'context':
141 120 $row_out[ $column_name ] = $record->context;
142 121 break;
143 122
144 - case 'object_id':
145 - $row_out[ $column_name ] = $record->object_id;
146 - break;
147 -
148 123 case 'action':
149 124 $row_out[ $column_name ] = $record->{$column_name};
150 125 break;
151 126
@@ -164,19 +139,13 @@
164 139
165 140 /**
166 141 * Increase pagination limit for CSV Output
167 142 *
143 + * @param int $records_per_page Old limit for records_per_page.
168 144 * @return int
169 145 */
170 - public function disable_paginate() {
171 -
172 - /**
173 - * Filter to change how many records are exported.
174 - * Increasing this too much could cause your export to time out.
175 - *
176 - * @return int The number of records to export.
177 - */
178 - return apply_filters( 'wp_stream_export_limit', 10000 );
146 + public function disable_paginate( $records_per_page ) {
147 + return 10000;
179 148 }
180 149
181 150 /**
182 151 * Expand columns for CSV Output
@@ -187,13 +156,11 @@
187 156 public function expand_columns( $columns ) {
188 157 $new_columns = array(
189 158 'date' => $columns['date'],
190 159 'summary' => $columns['summary'],
191 - 'user' => $columns['user_id'],
192 - 'user_id' => __( 'User ID', 'stream' ),
160 + 'user_id' => $columns['user_id'],
193 161 'connector' => __( 'Connector', 'stream' ),
194 162 'context' => $columns['context'],
195 - 'object_id' => __( 'Object ID', 'stream' ),
196 163 'action' => $columns['action'],
197 164 'ip' => $columns['ip'],
198 165 );
199 166
@@ -235,9 +202,9 @@
235 202 * @param array $classes An array of Exporter objects. In the format exporter_slug => Exporter_Class()
236 203 */
237 204 $this->exporters = apply_filters( 'wp_stream_exporters', $classes );
238 205
239 - // Ensure that all exporters extend Exporter.
206 + // Ensure that all exporters extend Exporter
240 207 foreach ( $this->exporters as $key => $exporter ) {
241 208 if ( ! $this->is_valid_exporter( $exporter ) ) {
242 209 unset( $this->exporters[ $key ] );
243 210 }