$table_name
$table_name : string
The table name
Implements the admin view of the actions.
This abstract class enhances WP_List_Table making it ready to use.
By extending this class we can focus on describing how our table looks like, which columns needs to be shown, filter, ordered by and more and forget about the details.
This class supports:
$table_name : string
The table name
$package : string
The package name.
$items_per_page : int
How many items do we render per page?
$search_by : array
Enables search in this table listing. If this array is empty it means the listing is not searchable.
$columns : array
Columns to show (name => label).
$row_actions : array
Actions (name => label).
The array of actions are key => value, where key is the method name (with the prefix rowaction<key>) and the value is the label and title.
$ID : string
The Primary key of our table
$sort_by : array
Enables sorting, it expects an array of columns (the column names are the values)
$filter_by : string
The default sort order
$status_counts : array
The status name => count combinations for this table's items. Used to display status filters.
$admin_notices : array
Notices to display when loading the table. Array of arrays of form array( 'class' => {updated|error}, 'message' => 'This is the notice text display.' ).
$table_header : string
Localised string displayed in the <h1> element above the able.
$bulk_actions : array
Bulk actions. The key of the array is the method name of the implementation.
Example: bulk_<key>(array $ids, string $sql_in).
See the comments in the parent class for further details
$store : \ActionScheduler_Store
The active data stores
$logger : \ActionScheduler_Logger
A logger to use for getting action logs to display
$runner : \ActionScheduler_QueueRunner
A ActionScheduler_QueueRunner runner instance (or child class)
$did_notification : bool
Flag variable to render our notifications, if any, once.
$time_periods : array
Array of seconds for common time periods, like week or month, alongside an internationalised string representation, i.e. "Day" or "Days"
prepare_items() : mixed
Prepares the data to feed WP_Table_List.
This has the core for selecting, sorting and filtering data. To keep the code simple its logic is split among many methods (get_itemsquery*).
Beside populating the items this function will also count all the records that matches the filtering criteria and will do fill the pagination variables.
column_cb(array $row) : mixed
Renders the checkbox for each row, this is the first column and it is named ID regardless of how the primary key is named (to keep the code simpler). The bulk actions will do the proper name transformation though using `$this->ID`.
array | $row | The row to render. |
__construct(\ActionScheduler_Store $store, \ActionScheduler_Logger $logger, \ActionScheduler_QueueRunner $runner) : mixed
Sets the current data store object into `store->action` and initialises the object.
\ActionScheduler_Store | $store | Store object. |
\ActionScheduler_Logger | $logger | Logger object. |
\ActionScheduler_QueueRunner | $runner | Runner object. |
set_items_per_page_option(mixed $status, string $option, int $value) : int
Handles setting the items_per_page option for this screen.
mixed | $status | Default false (to skip saving the current option). |
string | $option | Screen option name. |
int | $value | Screen option value. |
get_bulk_actions() : array
Reads `$this->bulk_actions` and returns an array that WP_List_Table understands. It also validates that the bulk method handler exists. It throws an exception because this is a library meant for developers and missing a bulk method is a development-time error.
Throws RuntimeException when the bulk action does not have a callback method.
None found |
process_bulk_action() : mixed
Checks if the current request has a bulk action. If that is the case it will validate and will execute the bulk method handler. Regardless if the action is valid or not it will redirect to the previous page removing the current arguments that makes this request a bulk action.
None found |
bulk_delete(int[] $ids, string $ids_sql) : void
Bulk delete.
Deletes actions based on their ID. This is the handler for the bulk delete. It assumes the data properly validated by the callee and it will delete the actions without any extra validation.
int[] | $ids | Action IDs. |
string | $ids_sql | Inherited and unused. |
None found |
prepare_column_headers() : mixed
Prepares the _column_headers property which is used by WP_Table_List at rendering.
It merges the columns and the sortable columns.
None found |
get_items_query_limit() : string
Get prepared LIMIT clause for items query
Prepared LIMIT clause for items query.
global |
wpdb $wpdb |
---|
get_items_offset() : int
Returns the number of items to offset/skip for this current view.
None found |
get_items_query_offset() : string
Get prepared OFFSET clause for items query
Prepared OFFSET clause for items query.
global |
wpdb $wpdb |
---|
get_items_query_order() : mixed
Prepares the ORDER BY sql statement. It uses `$this->sort_by` to know which columns are sortable. This requests validates the orderby $_GET parameter is a valid column and sortable. It will also use order (ASC|DESC) using DESC by default.
None found |
get_request_query_args_to_persist() : string[]
Querystring arguments to persist between form submissions.
since | 3.7.3 |
---|
get_request_orderby() : string
Return the sortable column specified for this request to order the results by, if any.
None found |
get_request_order() : string
Return the sortable column order specified for this request.
None found |
get_request_status() : string
Return the status filter for this request, if any.
None found |
get_request_search_query() : string
Return the search filter for this request, if any.
None found |
get_table_columns() : array
Process and return the columns name. This is meant for using with SQL, this means it always includes the primary key.
None found |
get_items_query_search() : string
Check if the current request is doing a "full text" search. If that is the case prepares the SQL to search texts using LIKE.
If the current request does not have any search or if this list table does not support that feature it will return an empty string.
None found |
get_items_query_filters() : mixed
Prepares the SQL to filter rows by the options defined at `$this->filter_by`. Before trusting any data sent by the user it validates that it is a valid option.
None found |
set_items(array $items) : mixed
Set the data for displaying. It will attempt to unserialize (There is a chance that some columns are serialized). This can be override in child classes for further data transformation.
array | $items | Items array. |
None found |
maybe_render_actions(array $row, string $column_name) : string
Only display row actions for pending actions.
This method renders the action menu, it reads the definition from the $row_actions property, and it checks that the row action method exists before rendering it.
array | $row | Row to render. |
string | $column_name | Current row. |
None found |
None found |
display_header() : mixed
Display the table heading and search query, if any
None found |
display_filter_by_status() : mixed
Prints the available statuses so the user can click to filter.
None found |
display_table() : mixed
Renders the table list, we override the original class to render the table inside a form and to render any needed HTML (like the search box). By doing so the callee of a function can simple forget about any extra HTML.
None found |
get_search_box_placeholder() : mixed
Get the text to display in the search box on the list table.
None found |
get_per_page_option_name() : string
Gets the screen per_page option name.
None found |
get_recurrence(\ActionScheduler_Action $action) : string
Returns the recurrence of an action or 'Non-repeating'. The output is human readable.
\ActionScheduler_Action | $action | Action object. |
None found |
get_log_entry_html(\ActionScheduler_LogEntry $log_entry, \DateTimezone $timezone) : string
Prints the logs entries inline. We do so to avoid loading Javascript and other hacks to show it in a modal.
\ActionScheduler_LogEntry | $log_entry | Log entry object. |
\DateTimezone | $timezone | Timestamp. |
None found |
get_schedule_display_string(\ActionScheduler_Schedule $schedule) : string
Get the scheduled date in a human friendly format.
\ActionScheduler_Schedule | $schedule | Action's schedule. |
None found |
row_action_cancel(int $action_id) : mixed
Implements the logic behind running an action. ActionScheduler_Abstract_ListTable validates the request and their parameters are valid.
int | $action_id | Action ID. |
None found |
row_action_run(int $action_id) : mixed
Implements the logic behind running an action. ActionScheduler_Abstract_ListTable validates the request and their parameters are valid.
int | $action_id | Action ID. |
None found |
None found |
process_row_action(int $action_id, string $row_action_type) : mixed
Implements the logic behind processing an action once an action link is clicked on the list table.
int | $action_id | Action ID. |
string | $row_action_type | The type of action to perform on the action. |
None found |
get_search_box_button_text() : mixed
Get the text to display in the search box on the list table.
None found |
human_interval(int $interval, int $periods_to_include = 2) : string
Convert an interval of seconds into a two part human friendly string.
The WordPress human_time_diff() function only calculates the time difference to one degree, meaning even if an action is 1 day and 11 hours away, it will display "1 day". This function goes one step further to display two degrees of accuracy.
Inspired by the Crontrol::interval() function by Edward Dale: https://wordpress.org/plugins/wp-crontrol/
int | $interval | A interval in seconds. |
int | $periods_to_include | Depth of time periods to include, e.g. for an interval of 70, and $periods_to_include of 2, both minutes and seconds would be included. With a value of 1, only minutes would be included. |
A human friendly string representation of the interval.
None found |