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.
Warning: Array to string conversion in /home/customer/www/docs.automatorplugin.com/public_html/wp-content/themes/wporg-developer/inc/template-tags.php on line 825
Warning: foreach() argument must be of type array|object, string given in /home/customer/www/docs.automatorplugin.com/public_html/wp-content/themes/wporg-developer/inc/template-tags.php on line 830
Warning: Array to string conversion in /home/customer/www/docs.automatorplugin.com/public_html/wp-content/themes/wporg-developer/inc/template-tags.php on line 825
Logs_List_Table::format_recipe_data( array $recipes )
Format recipes log data
Contents
Warning: foreach() argument must be of type array|object, string given in /home/customer/www/docs.automatorplugin.com/public_html/wp-content/themes/wporg-developer/inc/template-tags.php on line 830
Warning: Array to string conversion in /home/customer/www/docs.automatorplugin.com/public_html/wp-content/themes/wporg-developer/inc/template-tags.php on line 825
Parameters Parameters
- $recipes
(Required) list of objects
Return Return
(array)
Source Source
File: src/core/admin/class-logs-list-table.php
private function format_recipe_data( $recipes ) { $data = array(); foreach ( $recipes as $recipe ) { if ( isset( $recipe->automator_recipe_id ) ) { $recipe_link = get_edit_post_link( absint( $recipe->automator_recipe_id ) ); $recipe_id = $recipe->automator_recipe_id; } else { $recipe_link = '#'; $recipe_id = 0; } $recipe_name = ! empty( $recipe->recipe_title ) ? $recipe->recipe_title : sprintf( esc_attr__( 'ID: %1$s (no title)', 'uncanny-automator' ), $recipe_id ); if ( '#' !== $recipe_link ) { $recipe_name = '<a href="' . $recipe_link . '" class="uap-log-table__recipe-name">' . $recipe_name . '</a>'; } if ( empty( $recipe->display_name ) ) { /* translators: User type */ $user_name = esc_attr_x( 'Anonymous', 'User', 'uncanny-automator' ); } else { $user_link = get_edit_user_link( absint( $recipe->user_id ) ); $user_name = '<a href="' . $user_link . '">' . $recipe->display_name . '</a> <br>' . $recipe->user_email; } if ( 1 === (int) $recipe->recipe_completed ) { /* translators: Recipe status */ $recipe_status = esc_attr_x( 'Completed', 'Recipe', 'uncanny-automator' ); } elseif ( 2 === (int) $recipe->recipe_completed ) { /* translators: Recipe status */ $recipe_status = esc_attr_x( 'Completed with errors', 'Recipe', 'uncanny-automator' ); } elseif ( 9 === (int) $recipe->recipe_completed ) { /* translators: Recipe status */ $recipe_status = esc_attr_x( 'Completed - do nothing', 'Recipe', 'uncanny-automator' ); } else { /* translators: Recipe status */ $recipe_status = esc_attr_x( 'In progress', 'Recipe', 'uncanny-automator' ); } $recipe_date_completed = ( 1 === absint( $recipe->recipe_completed ) || 2 === absint( $recipe->recipe_completed ) || 9 === absint( $recipe->recipe_completed ) ) ? $recipe->recipe_date_time : ''; $current_type = Automator()->utilities->get_recipe_type( $recipe_id ); $run_number = 'anonymous' === $current_type ? 'N/A' : $recipe->run_number; /* translators: Recipe type. Logged-in recipes are triggered only by logged-in users */ $recipe_type_name = esc_attr_x( 'Logged-in', 'Recipe', 'uncanny-automator' ); if ( ! empty( $current_type ) ) { if ( 'user' === $current_type ) { /* translators: Recipe type. Logged-in recipes are triggered only by logged-in users */ $recipe_type_name = esc_attr_x( 'Logged-in', 'Recipe', 'uncanny-automator' ); } elseif ( 'anonymous' === $current_type ) { /* translators: Recipe type. Anonymous recipes can be triggered by logged-in or anonymous users. Anonymous recipes can create new users or modify existing users. */ $recipe_type_name = esc_attr_x( 'Anonymous', 'Recipe', 'uncanny-automator' ); } } $run_number_log = 'anonymous' === $current_type ? 1 : $run_number; $url = sprintf( '%s?post_type=%s&page=%s&recipe_id=%d&run_number=%d&user_id=%d&minimal=1', admin_url( 'edit.php' ), 'uo-recipe', 'uncanny-automator-recipe-activity-details', $recipe_id, $run_number_log, absint( $recipe->user_id ) ); $actions = array( 'view' => sprintf( '<a href="%s" data-lity class="button button-secondary">%s</a>', $url, esc_attr__( 'Details', 'uncanny-automator' ) ), //Removed: 'rerun' => sprintf( '<a href="%s" onclick="javascript: return confirm(\"%s\")">%s</a>', '#', esc_attr__( 'Are you sure you want to re-run this recipe?', 'uncanny-automator' ), esc_attr__( 'Re-run', 'uncanny-automator' ) ), ); $data[] = array( 'recipe_type' => $recipe_type_name, 'recipe_title' => $recipe_name, 'recipe_date_time' => $recipe_date_completed, 'display_name' => $user_name, 'recipe_completed' => $recipe_status, 'run_number' => $run_number, 'actions' => join( ' | ', $actions ), // Added. ); } return $data; }
Expand full source code Collapse full source code View on Github