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-alerts-list.php +62 -22 3.2.23.4.2 View file →
@@ -54,9 +54,9 @@
54 54 *
55 55 * @param array $query_vars Arguments for query to populate table.
56 56 * @return array
57 57 */
58 - function parse_request( $query_vars ) {
58 + public function parse_request( $query_vars ) {
59 59 $screen = get_current_screen();
60 60 if ( 'edit-wp_stream_alerts' === $screen->id && Alerts::POST_TYPE === $query_vars['post_type'] && empty( $query_vars['post_status'] ) ) {
61 61 $query_vars['post_status'] = array( 'wp_stream_enabled', 'wp_stream_disabled' );
62 62 }
@@ -70,9 +70,9 @@
70 70 *
71 71 * @param array $views View links HTML.
72 72 * @return array
73 73 */
74 - function manage_views( $views ) {
74 + public function manage_views( $views ) {
75 75
76 76 if ( array_key_exists( 'trash', $views ) ) {
77 77 $trash = $views['trash'];
78 78 unset( $views['trash'] );
@@ -89,9 +89,9 @@
89 89 *
90 90 * @param array $columns Column id -> title array.
91 91 * @return array
92 92 */
93 - function manage_columns( $columns ) {
93 + public function manage_columns( $columns ) {
94 94 $columns = array(
95 95 'cb' => $columns['cb'],
96 96 'alert_trigger' => __( 'Trigger', 'stream' ),
97 97 'alert_type' => __( 'Type', 'stream' ),
@@ -108,9 +108,9 @@
108 108 * @param string $column_name Column name to show data for.
109 109 * @param int $post_id The post being processed.
110 110 * @return mixed
111 111 */
112 - function column_data( $column_name, $post_id ) {
112 + public function column_data( $column_name, $post_id ) {
113 113
114 114 $alert = $this->plugin->alerts->get_alert( $post_id );
115 115 if ( ! $alert ) {
116 116 return;
@@ -116,12 +116,12 @@
116 116 return;
117 117 }
118 118
119 119 switch ( $column_name ) {
120 - case 'alert_trigger' :
120 + case 'alert_trigger':
121 121 $values = array();
122 122 foreach ( $this->plugin->alerts->alert_triggers as $trigger_type => $trigger_obj ) {
123 - $value = $trigger_obj->get_display_value( 'list_table', $alert );
123 + $value = $trigger_obj->get_display_value( 'list_table', $alert );
124 124 $values[] = '<span class="alert_trigger_value alert_trigger_' . esc_attr( $trigger_type ) . '">' . esc_html( $value ) . '</span>';
125 125 }
126 126 ?>
127 127 <div><?php echo wp_kses_post( join( '', $values ) ); ?></div>
@@ -151,9 +151,9 @@
151 151 <input type="hidden" name="wp_stream_trigger_action" value="<?php echo esc_attr( $trigger_action ); ?>" />
152 152 <?php
153 153 echo wp_kses_post( $this->custom_column_actions( $post_id ) );
154 154 break;
155 - case 'alert_type' :
155 + case 'alert_type':
156 156 $alert_type = $alert->alert_type;
157 157 if ( ! empty( $this->plugin->alerts->alert_types[ $alert_type ]->name ) ) {
158 158 $alert_name = $this->plugin->alerts->alert_types[ $alert_type ]->name;
159 159 } else {
@@ -187,10 +187,30 @@
187 187 ?>
188 188 <input type="hidden" name="wp_stream_ifttt_maker_key" value="<?php echo esc_attr( $alert->alert_meta['maker_key'] ); ?>" />
189 189 <?php
190 190 }
191 + if ( ! empty( $alert->alert_meta['slack_webhook'] ) ) {
192 + ?>
193 + <input type="hidden" name="wp_stream_slack_webhook" value="<?php echo esc_attr( $alert->alert_meta['slack_webhook'] ); ?>" />
194 + <?php
195 + }
196 + if ( ! empty( $alert->alert_meta['slack_channel'] ) ) {
197 + ?>
198 + <input type="hidden" name="wp_stream_slack_channel" value="<?php echo esc_attr( $alert->alert_meta['slack_channel'] ); ?>" />
199 + <?php
200 + }
201 + if ( ! empty( $alert->alert_meta['slack_username'] ) ) {
202 + ?>
203 + <input type="hidden" name="wp_stream_slack_username" value="<?php echo esc_attr( $alert->alert_meta['slack_username'] ); ?>" />
204 + <?php
205 + }
206 + if ( ! empty( $alert->alert_meta['slack_icon'] ) ) {
207 + ?>
208 + <input type="hidden" name="wp_stream_slack_icon" value="<?php echo esc_attr( $alert->alert_meta['slack_icon'] ); ?>" />
209 + <?php
210 + }
191 211 break;
192 - case 'alert_status' :
212 + case 'alert_status':
193 213 $post_status_object = get_post_status_object( get_post_status( $post_id ) );
194 214 if ( ! empty( $post_status_object ) ) {
195 215 echo esc_html( $post_status_object->label );
196 216 }
@@ -221,9 +241,9 @@
221 241 *
222 242 * @param array $actions List of inline edit actions available.
223 243 * @return array
224 244 */
225 - function suppress_quick_edit( $actions ) {
245 + public function suppress_quick_edit( $actions ) {
226 246 if ( Alerts::POST_TYPE !== get_post_type() ) {
227 247 return $actions;
228 248 }
229 249 unset( $actions['edit'] );
@@ -294,13 +314,14 @@
294 314 );
295 315 ?>
296 316 <legend class="inline-edit-legend"><?php esc_html_e( 'Edit', 'stream' ); ?></legend>
297 317 <?php
298 - foreach ( $box_type as $type ) : // @todo remove inline styles. ?>
318 + foreach ( $box_type as $type ) : // @todo remove inline styles.
319 + ?>
299 320 <fieldset class="inline-edit-col inline-edit-<?php echo esc_attr( Alerts::POST_TYPE ); ?>">
300 321 <?php
301 322 $function_name = 'display_' . $type . '_box';
302 - $the_post = get_post();
323 + $the_post = get_post();
303 324 call_user_func( array( $this->plugin->alerts, $function_name ), $the_post );
304 325 ?>
305 326 </fieldset>
306 327 <?php
@@ -317,11 +338,30 @@
317 338 $screen = get_current_screen();
318 339 if ( 'edit-wp_stream_alerts' !== $screen->id ) {
319 340 return;
320 341 }
321 - wp_register_script( 'wp-stream-alerts-list-js', $this->plugin->locations['url'] . 'ui/js/alerts-list.js', array( 'wp-stream-alerts', 'jquery' ) );
342 +
343 + $min = wp_stream_min_suffix();
344 +
345 + wp_register_script(
346 + 'wp-stream-alerts-list-js',
347 + $this->plugin->locations['url'] . 'ui/js/alerts-list.' . $min . 'js',
348 + array(
349 + 'wp-stream-alerts',
350 + 'jquery',
351 + ),
352 + $this->plugin->get_version(),
353 + false
354 + );
355 +
356 + wp_register_style(
357 + 'wp-stream-alerts-list-css',
358 + $this->plugin->locations['url'] . 'ui/css/alerts-list.' . $min . 'css',
359 + [],
360 + $this->plugin->get_version()
361 + );
362 +
322 363 wp_enqueue_script( 'wp-stream-alerts-list-js' );
323 - wp_register_style( 'wp-stream-alerts-list-css', $this->plugin->locations['url'] . 'ui/css/alerts-list.css' );
324 364 wp_enqueue_style( 'wp-stream-alerts-list-css' );
325 365 wp_enqueue_style( 'wp-stream-select2' );
326 366 }
327 367
@@ -332,14 +372,14 @@
332 372 * @param array $postarr Raw post data.
333 373 *
334 374 * @return array
335 375 */
336 - function save_alert_inline_edit( $data, $postarr ) {
376 + public function save_alert_inline_edit( $data, $postarr ) {
337 377 if ( did_action( 'customize_preview_init' ) || empty( $postarr['ID'] ) ) {
338 378 return $data;
339 379 }
340 380
341 - $post_id = $postarr['ID'];
381 + $post_id = $postarr['ID'];
342 382 $post_type = wp_stream_filter_input( INPUT_POST, 'post_type' );
343 383 if ( Alerts::POST_TYPE !== $post_type ) {
344 384 return $data;
345 385 }
@@ -351,17 +391,17 @@
351 391 if ( null === $nonce || ! wp_verify_nonce( $nonce, plugin_basename( __FILE__ ) ) ) {
352 392 return $data;
353 393 }
354 394
355 - $trigger_author = wp_stream_filter_input( INPUT_POST, 'wp_stream_trigger_author' );
356 - $trigger_connector_and_context = wp_stream_filter_input( INPUT_POST, 'wp_stream_trigger_connector_or_context' );
395 + $trigger_author = wp_stream_filter_input( INPUT_POST, 'wp_stream_trigger_author' );
396 + $trigger_connector_and_context = wp_stream_filter_input( INPUT_POST, 'wp_stream_trigger_connector_or_context' );
357 397 $trigger_connector_and_context_split = explode( '-', $trigger_connector_and_context );
358 - $trigger_connector = $trigger_connector_and_context_split[0];
359 - $trigger_context = $trigger_connector_and_context_split[1];
398 + $trigger_connector = $trigger_connector_and_context_split[0];
399 + $trigger_context = $trigger_connector_and_context_split[1];
360 400
361 - $trigger_action = wp_stream_filter_input( INPUT_POST, 'wp_stream_trigger_action' );
362 - $alert_type = wp_stream_filter_input( INPUT_POST, 'wp_stream_alert_type' );
363 - $alert_status = wp_stream_filter_input( INPUT_POST, 'wp_stream_alert_status' );
401 + $trigger_action = wp_stream_filter_input( INPUT_POST, 'wp_stream_trigger_action' );
402 + $alert_type = wp_stream_filter_input( INPUT_POST, 'wp_stream_alert_type' );
403 + $alert_status = wp_stream_filter_input( INPUT_POST, 'wp_stream_alert_status' );
364 404 $data['post_status'] = $alert_status;
365 405
366 406 update_post_meta( $post_id, 'alert_type', $alert_type );
367 407