public function multisite_labels($value, $grouping) { if ('blog_id' === $grouping && is_numeric($value)) { $blog = $value && is_multisite() ? get_blog_details($value) : WP_Stream_Network::get_network_blog(); $value = $blog->blogname; } return $value; }
function column_default($item, $column_name) { switch ($column_name) { case 'date': $date_string = sprintf('<time datetime="%s" class="relative-time">%s</time>', $item->created, get_date_from_gmt($item->created, 'Y/m/d')); $out = $this->column_link($date_string, 'date', date('Y/m/d', strtotime($item->created))); $out .= '<br />'; $out .= get_date_from_gmt($item->created, 'h:i:s A'); break; case 'summary': $out = $item->summary; if ($item->object_id) { $out .= $this->column_link('<span class="dashicons dashicons-search stream-filter-object-id"></span>', array('object_id' => $item->object_id, 'context' => $item->context), null, __('View all records for this object', 'stream')); } $out .= $this->get_action_links($item); break; case 'author': require_once WP_STREAM_INC_DIR . 'class-wp-stream-author.php'; $author_meta = wp_stream_get_meta($item->ID, 'author_meta', true); $author = new WP_Stream_Author((int) $item->author, $author_meta); $out = sprintf('<a href="%s">%s <span>%s</span></a>%s%s%s', $author->get_records_page_url(), $author->get_avatar_img(80), $author->get_display_name(), $author->is_deleted() ? sprintf('<br /><small class="deleted">%s</small>', esc_html__('Deleted User', 'stream')) : '', $author->get_role() ? sprintf('<br /><small>%s</small>', $author->get_role()) : '', $author->get_agent() ? sprintf('<br /><small>%s</small>', WP_Stream_Author::get_agent_label($author->get_agent())) : ''); break; case 'connector': case 'context': case 'action': $out = $this->column_link($this->get_term_title($item->{$column_name}, $column_name), $column_name, $item->{$column_name}); break; case 'ip': $out = $this->column_link($item->{$column_name}, 'ip', $item->{$column_name}); break; case 'id': $out = absint($item->ID); break; case 'blog_id': $blog = $item->blog_id && is_multisite() ? get_blog_details($item->blog_id) : WP_Stream_Network::get_network_blog(); $out = sprintf('<a href="%s"><span>%s</span></a>', add_query_arg(array('blog_id' => $blog->blog_id), network_admin_url('admin.php?page=wp_stream')), esc_html($blog->blogname)); break; default: /** * Registers new Columns to be inserted into the table. The cell contents of this column is set * below with 'wp_stream_inster_column_default-' * * @param array $new_columns Array of new column titles to add */ $inserted_columns = apply_filters('wp_stream_register_column_defaults', $new_columns = array()); if (!empty($inserted_columns) && is_array($inserted_columns)) { foreach ($inserted_columns as $column_title) { /** * If column title inserted via wp_stream_register_column_defaults ($column_title) exists * among columns registered with get_columns ($column_name) and there is an action associated * with this column, do the action * * Also, note that the action name must include the $column_title registered * with wp_stream_register_column_defaults */ if ($column_title == $column_name && has_action('wp_stream_insert_column_default-' . $column_title)) { /** * This action allows for the addition of content under the specified column ($column_title) * * @param string $column_title Title of the column (set in wp_stream_register_column_defaults) * @param obj $item Contents of the row */ $out = do_action('wp_stream_insert_column_default-' . $column_title, $item); } else { $out = $column_name; } } } else { $out = $column_name; // xss ok } } echo $out; // xss ok }