O3PO_EditorPages
in package
Table of Contents
Constants
- ENDPOINT_SLUG : mixed = 'editor'
- HANDLED_PAPERS_REFRESH_SECONDS : mixed = 43200
- Editor paper lists refresh every 12 hours, matching the default cited-by interval.
- HANDLED_PAPERS_TRANSIENT_PREFIX : mixed = 'o3po_editor_handled_papers_'
Properties
Methods
- add_editor_endpoint() : mixed
- Add the /editor/ endpoint for editor profile pages.
- add_fake_editor_post_to_query() : array<string|int, mixed>
- Add a fake page post so editor profiles use the active theme's page template.
- editor_profile_at_loop_start() : mixed
- Render the editor profile at the start of the page template loop.
- editor_profile_template() : string
- Use the active theme's page template for editor profiles.
- handle_editor_endpoint_request() : mixed
- Handle requests to the /editor/{uuid}/ endpoint.
- invalidate_editor_assignment_caches() : mixed
- Invalidate cached lists for the previous and current handling editors.
- invalidate_editor_papers_cache() : mixed
- Invalidate the cached paper list for one editor.
- invalidate_handled_papers_cache() : mixed
- Invalidate the cached paper list for a primary publication's handling editor.
- invalidate_handled_papers_cache_on_meta_change() : mixed
- Invalidate paper lists after handling-editor metadata changes.
- invalidate_handled_papers_on_status_transition() : mixed
- Invalidate an editor's cached paper list when publication status changes.
- remember_editor_uuid_before_meta_change() : mixed
- Remember the prior handling editor before post metadata is changed.
- remember_editor_uuid_before_update() : mixed
- Remember the previous editor before a post-meta update.
- capture_previous_editor_uuid() : mixed
- format_service_period() : string
- Format the editor's service years for display.
- get_editor_by_uuid() : array<string|int, mixed>|null
- Find an editor by UUID.
- get_handled_papers() : array<string|int, mixed>
- Get published papers handled by an editor, refreshing the transient periodically.
Constants
ENDPOINT_SLUG
public
mixed
ENDPOINT_SLUG
= 'editor'
HANDLED_PAPERS_REFRESH_SECONDS
Editor paper lists refresh every 12 hours, matching the default cited-by interval.
public
mixed
HANDLED_PAPERS_REFRESH_SECONDS
= 43200
HANDLED_PAPERS_TRANSIENT_PREFIX
public
mixed
HANDLED_PAPERS_TRANSIENT_PREFIX
= 'o3po_editor_handled_papers_'
Properties
$handling_editor_uuid_before_meta_change
private
static mixed
$handling_editor_uuid_before_meta_change
= array()
Methods
add_editor_endpoint()
Add the /editor/ endpoint for editor profile pages.
public
static add_editor_endpoint() : mixed
To be added to the 'init' action.
Tags
add_fake_editor_post_to_query()
Add a fake page post so editor profiles use the active theme's page template.
public
static add_fake_editor_post_to_query(array<string|int, mixed> $posts) : array<string|int, mixed>
To be added to the 'the_posts' filter.
Parameters
- $posts : array<string|int, mixed>
-
The posts returned by the query.
Tags
Return values
array<string|int, mixed> —Posts, including a fake page post for an editor profile.
editor_profile_at_loop_start()
Render the editor profile at the start of the page template loop.
public
static editor_profile_at_loop_start(WP_Query $wp_query) : mixed
To be added to the 'loop_start' action.
Parameters
- $wp_query : WP_Query
-
The current WordPress query.
Tags
editor_profile_template()
Use the active theme's page template for editor profiles.
public
static editor_profile_template(string $template) : string
To be added to the 'template_include' filter.
Parameters
- $template : string
-
The template that would otherwise be used.
Tags
Return values
string —The page template for editor profiles.
handle_editor_endpoint_request()
Handle requests to the /editor/{uuid}/ endpoint.
public
static handle_editor_endpoint_request(WP $wp) : mixed
To be added to the 'parse_request' action.
Parameters
- $wp : WP
-
The current WordPress environment.
Tags
invalidate_editor_assignment_caches()
Invalidate cached lists for the previous and current handling editors.
public
static invalidate_editor_assignment_caches(string $old_uuidv4, string $new_uuidv4) : mixed
Parameters
- $old_uuidv4 : string
-
The previous editor UUID.
- $new_uuidv4 : string
-
The current editor UUID.
Tags
invalidate_editor_papers_cache()
Invalidate the cached paper list for one editor.
public
static invalidate_editor_papers_cache(string $uuidv4) : mixed
Parameters
- $uuidv4 : string
-
The editor UUID.
Tags
invalidate_handled_papers_cache()
Invalidate the cached paper list for a primary publication's handling editor.
public
static invalidate_handled_papers_cache(int $post_id[, WP_Post|null $post = null ]) : mixed
To be added to the 'save_post', 'before_delete_post', and status-transition actions.
Parameters
- $post_id : int
-
The saved post ID.
- $post : WP_Post|null = null
-
The saved post, if provided by the action.
Tags
invalidate_handled_papers_cache_on_meta_change()
Invalidate paper lists after handling-editor metadata changes.
public
static invalidate_handled_papers_cache_on_meta_change(mixed $meta_id, int $post_id, string $meta_key, mixed $meta_value) : mixed
To be added to post-meta add, update, and delete actions.
Parameters
- $meta_id : mixed
-
The post-meta ID or IDs.
- $post_id : int
-
The post ID.
- $meta_key : string
-
The metadata key.
- $meta_value : mixed
-
The new or deleted metadata value.
Tags
invalidate_handled_papers_on_status_transition()
Invalidate an editor's cached paper list when publication status changes.
public
static invalidate_handled_papers_on_status_transition(string $new_status, string $old_status, WP_Post $post) : mixed
To be added to the 'transition_post_status' action.
Parameters
- $new_status : string
-
The new post status.
- $old_status : string
-
The old post status.
- $post : WP_Post
-
The post whose status changed.
Tags
remember_editor_uuid_before_meta_change()
Remember the prior handling editor before post metadata is changed.
public
static remember_editor_uuid_before_meta_change(mixed $check, int $post_id, string $meta_key, mixed $meta_value[, mixed $extra = null ]) : mixed
To be added to the add/update/delete post-meta filters.
Parameters
- $check : mixed
-
The short-circuit filter value.
- $post_id : int
-
The post ID.
- $meta_key : string
-
The metadata key.
- $meta_value : mixed
-
The metadata value being saved.
- $extra : mixed = null
-
Additional filter arguments.
Tags
Return values
mixed —The unchanged short-circuit filter value.
remember_editor_uuid_before_update()
Remember the previous editor before a post-meta update.
public
static remember_editor_uuid_before_update(mixed $check, int $post_id, string $meta_key, mixed $meta_value[, mixed $previous_value = null ]) : mixed
To be added to the 'update_post_metadata' filter.
Parameters
- $check : mixed
-
The short-circuit filter value.
- $post_id : int
-
The post ID.
- $meta_key : string
-
The metadata key.
- $meta_value : mixed
-
The metadata value being saved.
- $previous_value : mixed = null
-
Additional filter arguments.
Tags
Return values
mixed —The unchanged short-circuit filter value.
capture_previous_editor_uuid()
private
static capture_previous_editor_uuid(mixed $post_id, mixed $meta_key, mixed $meta_value, mixed $skip_unchanged) : mixed
Parameters
- $post_id : mixed
- $meta_key : mixed
- $meta_value : mixed
- $skip_unchanged : mixed
format_service_period()
Format the editor's service years for display.
private
static format_service_period(string $since_year, string $until_year, int $current_year) : string
Parameters
- $since_year : string
-
The first service year.
- $until_year : string
-
The last service year.
- $current_year : int
-
The current year.
Tags
Return values
string —The formatted service period.
get_editor_by_uuid()
Find an editor by UUID.
private
static get_editor_by_uuid(string $uuidv4) : array<string|int, mixed>|null
Parameters
- $uuidv4 : string
-
The editor UUID.
Tags
Return values
array<string|int, mixed>|null —Editor data or null if the UUID does not belong to an editor.
get_handled_papers()
Get published papers handled by an editor, refreshing the transient periodically.
private
static get_handled_papers(string $uuidv4) : array<string|int, mixed>
Parameters
- $uuidv4 : string
-
The editor UUID.
Tags
Return values
array<string|int, mixed> —List of published paper titles, citations, and permalinks.