: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in
* Generate row actions div
* @param array $actions The list of actions
* @param bool $always_visible Whether the actions should be always visible
protected function row_actions( $actions, $always_visible = false ) {
$action_count = count( $actions );
$out = '<div class="' . ( $always_visible ? 'row-actions visible' : 'row-actions' ) . '">';
foreach ( $actions as $action => $link ) {
( $i === $action_count ) ? $sep = '' : $sep = ' | ';
$out .= "<span class='$action'>$link$sep</span>";
$out .= '<button type="button" class="toggle-row"><span class="screen-reader-text">' . __( 'Show more details' ) . '</span></button>';
* Display a monthly dropdown for filtering items
* @global WP_Locale $wp_locale
* @param string $post_type
protected function months_dropdown( $post_type ) {
global $wpdb, $wp_locale;
* Filters whether to remove the 'Months' drop-down from the post list table.
* @param bool $disable Whether to disable the drop-down. Default false.
* @param string $post_type The post type.
if ( apply_filters( 'disable_months_dropdown', false, $post_type ) ) {
$extra_checks = "AND post_status != 'auto-draft'";
if ( ! isset( $_GET['post_status'] ) || 'trash' !== $_GET['post_status'] ) {
$extra_checks .= " AND post_status != 'trash'";
} elseif ( isset( $_GET['post_status'] ) ) {
$extra_checks = $wpdb->prepare( ' AND post_status = %s', $_GET['post_status'] );
$months = $wpdb->get_results(
SELECT DISTINCT YEAR( post_date ) AS year, MONTH( post_date ) AS month
* Filters the 'Months' drop-down results.
* @param object $months The months drop-down query results.
* @param string $post_type The post type.
$months = apply_filters( 'months_dropdown_results', $months, $post_type );
$month_count = count( $months );
if ( ! $month_count || ( 1 === $month_count && 0 === $months[0]->month ) ) {
$m = isset( $_GET['m'] ) ? (int) $_GET['m'] : 0;
<label for="filter-by-date" class="screen-reader-text"><?php _e( 'Filter by date' ); ?></label>
<select name="m" id="filter-by-date">
<option<?php selected( $m, 0 ); ?> value="0"><?php _e( 'All dates' ); ?></option>
foreach ( $months as $arc_row ) {
if ( 0 === $arc_row->year ) {
$month = zeroise( $arc_row->month, 2 );
"<option %s value='%s'>%s</option>\n",
selected( $m, $year . $month, false ),
esc_attr( $arc_row->year . $month ),
/* translators: 1: month name, 2: 4-digit year */
sprintf( __( '%1$s %2$d' ), $wp_locale->get_month( $month ), $year )
* Display a view switcher
* @param string $current_mode
protected function view_switcher( $current_mode ) {
<input type="hidden" name="mode" value="<?php echo esc_attr( $current_mode ); ?>" />
<div class="view-switch">
foreach ( $this->modes as $mode => $title ) {
$classes = [ 'view-' . $mode ];
if ( $current_mode === $mode ) {
"<a href='%s' class='%s' id='view-switch-$mode'><span class='screen-reader-text'>%s</span></a>\n",
esc_url( add_query_arg( 'mode', $mode ) ),
implode( ' ', $classes ),
* Display a comment count bubble
* @param int $post_id The post ID.
* @param int $pending_comments Number of pending comments.
protected function comments_bubble( $post_id, $pending_comments ) {
$approved_comments = get_comments_number();
$approved_comments_number = number_format_i18n( $approved_comments );
$pending_comments_number = number_format_i18n( $pending_comments );
$approved_only_phrase = sprintf( _n( '%s comment', '%s comments', $approved_comments ), $approved_comments_number );
$approved_phrase = sprintf( _n( '%s approved comment', '%s approved comments', $approved_comments ), $approved_comments_number );
$pending_phrase = sprintf( _n( '%s pending comment', '%s pending comments', $pending_comments ), $pending_comments_number );
if ( ! $approved_comments && ! $pending_comments ) {
'<span aria-hidden="true">—</span><span class="screen-reader-text">%s</span>',
// Approved comments have different display depending on some conditions.
} elseif ( $approved_comments ) {
'<a href="%s" class="post-com-count post-com-count-approved"><span class="comment-count-approved" aria-hidden="true">%s</span><span class="screen-reader-text">%s</span></a>',
'comment_status' => 'approved',
admin_url( 'edit-comments.php' )
$approved_comments_number,
$pending_comments ? $approved_phrase : $approved_only_phrase
'<span class="post-com-count post-com-count-no-comments"><span class="comment-count comment-count-no-comments" aria-hidden="true">%s</span><span class="screen-reader-text">%s</span></span>',
$approved_comments_number,
$pending_comments ? __( 'No approved comments' ) : __( 'No comments' )
if ( $pending_comments ) {
'<a href="%s" class="post-com-count post-com-count-pending"><span class="comment-count-pending" aria-hidden="true">%s</span><span class="screen-reader-text">%s</span></a>',
'comment_status' => 'moderated',
admin_url( 'edit-comments.php' )
$pending_comments_number,
'<span class="post-com-count post-com-count-pending post-com-count-no-pending"><span class="comment-count comment-count-no-pending" aria-hidden="true">%s</span><span class="screen-reader-text">%s</span></span>',
$pending_comments_number,
$approved_comments ? __( 'No pending comments' ) : __( 'No comments' )
* Get the current page number
public function get_pagenum() {
$pagenum = isset( $_REQUEST['paged'] ) ? absint( $_REQUEST['paged'] ) : 0;
if ( isset( $this->_pagination_args['total_pages'] ) && $pagenum > $this->_pagination_args['total_pages'] ) {
$pagenum = $this->_pagination_args['total_pages'];
return max( 1, $pagenum );
* Get number of items to display on a single page
protected function get_items_per_page( $option, $default = 20 ) {
$per_page = (int) get_user_option( $option );
if ( empty( $per_page ) || $per_page < 1 ) {
* Filters the number of items to be displayed on each page of the list table.
* The dynamic hook name, $option, refers to the `per_page` option depending
* on the type of list table in use. Possible values include: 'edit_comments_per_page',
* 'sites_network_per_page', 'site_themes_network_per_page', 'themes_network_per_page',
* 'users_network_per_page', 'edit_post_per_page', 'edit_page_per_page',
* 'edit_{$post_type}_per_page', etc.
* @param int $per_page Number of items to be displayed. Default 20.
return (int) apply_filters( "{$option}", $per_page );
* Display the pagination.
protected function pagination( $which ) {
if ( empty( $this->_pagination_args ) ) {
$total_items = $this->_pagination_args['total_items'];
$total_pages = $this->_pagination_args['total_pages'];
$infinite_scroll = false;
if ( isset( $this->_pagination_args['infinite_scroll'] ) ) {
$infinite_scroll = $this->_pagination_args['infinite_scroll'];
if ( 'top' === $which && $total_pages > 1 ) {
$this->screen->render_screen_reader_content( 'heading_pagination' );
$output = '<span class="displaying-num">' . sprintf( _n( '%s item', '%s items', $total_items ), number_format_i18n( $total_items ) ) . '</span>';
$current = $this->get_pagenum();
if ( ! function_exists( 'wp_removable_query_args' ) ) {
require_once Popup_Maker::$DIR . 'includes/compatibility/function-wp_removable_query_args.php';
$removable_query_args = wp_removable_query_args();
$current_url = set_url_scheme( 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'] );
$current_url = remove_query_arg( $removable_query_args, $current_url );
$total_pages_before = '<span class="paging-input">';
$total_pages_after = '</span></span>';
$disable_first = $disable_last = $disable_prev = $disable_next = false;
if ( $current === $total_pages ) {
if ( $current === $total_pages - 1 ) {
$page_links[] = '<span class="tablenav-pages-navspan" aria-hidden="true">«</span>';
"<a class='first-page' href='%s'><span class='screen-reader-text'>%s</span><span aria-hidden='true'>%s</span></a>",
esc_url( remove_query_arg( 'paged', $current_url ) ),
$page_links[] = '<span class="tablenav-pages-navspan" aria-hidden="true">‹</span>';
"<a class='prev-page' href='%s'><span class='screen-reader-text'>%s</span><span aria-hidden='true'>%s</span></a>",
esc_url( add_query_arg( 'paged', max( 1, $current - 1 ), $current_url ) ),
if ( 'bottom' === $which ) {
$html_current_page = $current;
$total_pages_before = '<span class="screen-reader-text">' . __( 'Current Page' ) . '</span><span id="table-paging" class="paging-input"><span class="tablenav-paging-text">';
$html_current_page = sprintf(
"%s<input class='current-page' id='current-page-selector' type='text' name='paged' value='%s' size='%d' aria-describedby='table-paging' /><span class='tablenav-paging-text'>",
'<label for="current-page-selector" class="screen-reader-text">' . __( 'Current Page' ) . '</label>',
$html_total_pages = sprintf( "<span class='total-pages'>%s</span>", number_format_i18n( $total_pages ) );
$page_links[] = $total_pages_before . sprintf( _x( '%1$s of %2$s', 'paging' ), $html_current_page, $html_total_pages ) . $total_pages_after;
$page_links[] = '<span class="tablenav-pages-navspan" aria-hidden="true">›</span>';
"<a class='next-page' href='%s'><span class='screen-reader-text'>%s</span><span aria-hidden='true'>%s</span></a>",
esc_url( add_query_arg( 'paged', min( $total_pages, $current + 1 ), $current_url ) ),
$page_links[] = '<span class="tablenav-pages-navspan" aria-hidden="true">»</span>';
"<a class='last-page' href='%s'><span class='screen-reader-text'>%s</span><span aria-hidden='true'>%s</span></a>",
esc_url( add_query_arg( 'paged', $total_pages, $current_url ) ),
$pagination_links_class = 'pagination-links';
if ( ! empty( $infinite_scroll ) ) {
$pagination_links_class .= ' hide-if-js';
$output .= "\n<span class='$pagination_links_class'>" . join( "\n", $page_links ) . '</span>';
$page_class = $total_pages < 2 ? ' one-page' : '';
$page_class = ' no-pages';
$this->_pagination = "<div class='tablenav-pages{$page_class}'>$output</div>";
* Get a list of columns. The format is:
* 'internal-name' => 'Title'
public function get_columns() {
die( 'function PUM_ListTable::get_columns() must be over-ridden in a sub-class.' );
* Get a list of sortable columns. The format is:
* 'internal-name' => 'orderby'
* 'internal-name' => array( 'orderby', true )
* The second format will make the initial sorting order be descending
protected function get_sortable_columns() {
* Gets the name of the default primary column.
* @return string Name of the default primary column, in this case, an empty string.
protected function get_default_primary_column_name() {
$columns = $this->get_columns();
if ( empty( $columns ) ) {
// We need a primary defined so responsive views show something,
// so let's fall back to the first non-checkbox column.
foreach ( $columns as $col => $column_name ) {
* Public wrapper for PUM_ListTable::get_default_primary_column_name().
* @return string Name of the default primary column.
public function get_primary_column() {
return $this->get_primary_column_name();
* Gets the name of the primary column.
* @return string The name of the primary column.
protected function get_primary_column_name() {
$columns = get_column_headers( $this->screen );
$default = $this->get_default_primary_column_name();
// If the primary column doesn't exist fall back to the
// first non-checkbox column.
if ( ! isset( $columns[ $default ] ) ) {
$default = self::get_default_primary_column_name();
* Filters the name of the primary column for the current list table.
* @param string $default Column name default for the specific list table, e.g. 'name'.
* @param string $context Screen ID for specific list table, e.g. 'plugins'.
$column = apply_filters( 'list_table_primary_column', $default, $this->screen->id );
if ( empty( $column ) || ! isset( $columns[ $column ] ) ) {