Alert: This function’s access is marked private. This means it is not intended for use by plugin or theme developers, only in other core functions. It is listed here for completeness.
Logs_List_Table::format_action_data( array $actions )
Format action log data
Parameters Parameters
- $actions
-
(Required) list of objects
Return Return
(array)
Source Source
File: src/core/admin/class-logs-list-table.php
private function format_action_data( $actions ) { $data = array(); $recipes_data = Automator()->get_recipes_data( false ); foreach ( $actions as $action ) { $st = esc_attr__( 'Error', 'uncanny-automator' ); if ( 1 === (int) $action->action_completed ) { /* translators: Action status */ $st = esc_attr_x( 'Completed', 'Action', 'uncanny-automator' ); } elseif ( 9 === (int) $action->action_completed ) { /* translators: Action status */ $st = esc_attr_x( 'Completed, do nothing', 'Action', 'uncanny-automator' ); } $action_code = $this->item_code( $recipes_data, absint( $action->automator_action_id ) ); /* translators: 1. Action ID */ $action_name = sprintf( esc_attr__( 'Action deleted: %1$s', 'uncanny-automator' ), $action->automator_action_id ); if ( $action_code ) { // get the action title $action_title = $action->action_title; // get the action completed sentence $action_sentence = $action->action_sentence; if ( empty( $action_title ) && ! defined( 'AUTOMATOR_PRO_FILE' ) ) { /* translators: 1. Trademarked term */ $action_name = sprintf( esc_attr__( '(Reactivate %1$s to view)', 'uncanny-automator' ), 'Uncanny Automator Pro' ); } else { if ( empty( $action_sentence ) ) { $action_name = '<div class="uap-logs-table__item-main-sentence">' . $action_title . '</div>'; } else { $action_name = '<div class="uap-logs-table__item-main-sentence">' . $this->format_human_readable_sentence( $action_sentence ) . '</div>'; $action_name .= '<div class="uap-logs-table__item-secondary-sentence">' . $action_title . '</div>'; } } } $action_date_completed = $action->action_date; $action_status = apply_filters( 'automator_action_log_status', $st, $action ); $error_message = $action->error_message; $recipe_link = get_edit_post_link( absint( $action->automator_recipe_id ) ); $recipe_name = '<a href="' . $recipe_link . '" class="uap-log-table__recipe-name">' . $action->recipe_title . '</a>'; if ( 1 === (int) $action->recipe_completed ) { /* translators: Action status */ $recipe_status = esc_attr_x( 'Completed', 'Action', 'uncanny-automator' ); } elseif ( 2 === (int) $action->recipe_completed ) { /* translators: Action status */ $recipe_status = esc_attr_x( 'Completed with errors', 'Action', 'uncanny-automator' ); } elseif ( 9 === (int) $action->recipe_completed ) { /* translators: Action status */ $recipe_status = esc_attr_x( 'Completed, do nothing', 'Action', 'uncanny-automator' ); } else { /* translators: Action status */ $recipe_status = esc_attr_x( 'In progress', 'Action', 'uncanny-automator' ); } $recipe_date_completed = ( 1 === absint( $action->recipe_completed ) || 2 === absint( $action->recipe_completed ) || 9 === absint( $action->recipe_completed ) ) ? $action->recipe_date_time : ''; $recipe_run_number = $action->recipe_run_number; $recipe_run_number = 'anonymous' === (string) Automator()->utilities->get_recipe_type( absint( $action->automator_recipe_id ) ) ? 'N/A' : $recipe_run_number; if ( ! is_null( $action->user_id ) ) { $user_link = get_edit_user_link( absint( $action->user_id ) ); $user_email_link = sprintf( '<a href="mailto:%1$s" title="%2$s">(%1$s)</a>', sanitize_email( $action->user_email ), esc_attr__( 'Send Email', 'uncanny-automator' ) ); $user_name = '<a href="' . $user_link . '">' . $action->display_name . '</a><br>' . $user_email_link; } else { /* translators: User type */ $user_name = esc_attr_x( 'Anonymous', 'User', 'uncanny-automator' ); } $data[] = array( 'action_title' => $action_name, 'action_date' => $action_date_completed, 'action_completed' => $action_status, 'error_message' => $error_message, 'recipe_title' => $recipe_name, 'recipe_completed' => $recipe_status, 'recipe_date_time' => $recipe_date_completed, 'recipe_run_number' => $recipe_run_number, 'display_name' => $user_name, ); } return $data; }
Expand full source code Collapse full source code View on Github