$journal_config
$journal_config : array
Array holding the configuration of the journal.
The functionality related to individual journals.*
$doi_suffix_template : \O3PO_ShortcodeTemplate
The shortcode template used to construct DOIs.
handle_volumes_endpoint_request(\WP_Query $wp_query) : \Modified
Handle the requests to the /volume/ endpoint.
We want to display an overview of the available volumes as well as sub-pages with lists for each volume. Here we set up appropriate queries to do that.
We then want that Wordpress and the theme take care of turning these queries into actual pages without the need for further intervention from ours side to the extent possible in order to (i) make this plugin as theme independent as possible and (ii) have the volume page rendered with the global theme the users have chosen for their website.
Unfortunately we run into several complications:
For the lists of publications in a given volume it is straight forward to generate the query and a navigation can be nicely added just above the list by hooking into 'loop_start' (see below).
For the overview page of all volumes we can add the navigation in the same way, but we don't want to display any entries. We thus set up an empty query and force the usage of the 'page' template (see the function volume_endpoint_template() below). Without any posts to show, however, even the 'page' template does not execute 'loop_start' and (depending on the theme) can fall back to the 'content-none' template. To prevent this we have to add a fake "empty" post. We do this during the 'the_posts' action in add_fake_empty_post_to_volume_overview_page() (see below).
The true long-term solution to the problem we are solving here could be taxonomies.
To be added to the 'parse_request' action.
\WP_Query | $wp_query | Query to act on. |
WP_Query object.
volume_endpoint_template(string $template) : string
Force the usage of the page template on the volume overview page
Checks for the presence of a query var ending in '_add_fake_post' to determine when to change the template.
To be added to the 'template_include' action.
string | $template | The template that would be used. |
Template that should be used.
add_fake_post_to_volume_overview_page(array $posts) : array
Add a fake "empty" post to make 'loop_start' fire on the volume overview page
For queries that do not return any posts, the loop is never run. As we initiate an empty query for the top level volume endpoint that is supposed to serve the volume overview page, we must add at least a fake "empty" post to the $posts in order to allow us to inject content into the standard page template of the current theme.
To be added to the 'the_posts' action.
array | $posts | Array of posts that would be returned if we do not intervene. |
Array of posts that are returned if we do intervene.
compress_entries_in_volume_view(\WP_Query $wp_query)
Inject java script to compress the entries in the volume listings
Inject some java script to change how the entries of individual publications are displayed in the list of a volume.
To be added to the 'loop_end' filter.
\WP_Query | $wp_query | The current Wordpress query. |
get_post_type_highest_pages_info(integer $post_id_to_exclude, array $post_types)
Returns information about the post with the highest page number.
We have an aricle/fake page number that counts up 1,2,3,... This function determines the highes such number among all posts of the given publication types as well as the publication date of that post. Only published and future posts (i.e. such scheduled for publication) apart from the excluded post are taken into account.
integer | $post_id_to_exclude | Id of a post to exclude in the calculation |
array | $post_types | Array of post types to take into account. |
pages_still_free_info(integer $post_id_to_exclude, integer $pages, array $post_types)
Determines whether a given page number is still free.
We have an aricle/fake page number that counts up 1,2,3,... This function determines whether $pages is still free, in the sense that no post with a type in $post_types other than that with id $post_id already has page number $pages.
integer | $post_id_to_exclude | Id of a post to exclude. |
integer | $pages | Page number to be checked for whether it is still free or not. |
array | $post_types | Post types to take into account. |
doi_suffix_still_free(string $doi_suffix, array $post_types)
Determines whether a given page number is still free.
This function can be used to check whether a given $doi_suffix is sitll free or already taken by a registered post type.
string | $doi_suffix | Doi suffix to be checked. |
array | $post_types | Post types to take into accoun. |
get_count_of_volume(integer $vol_num, string $publication_type)
Get number of posts of the given type in the given volume.
If $vol_num is empty, the total number over all volumes is returned.
integer | $vol_num | Volume number to count or all volumes if empty. |
string | $publication_type | Publication type to count. |
specify_settings(\O3PO_Settings $settings)
Specifies class specific settings sections and fields.
To be called during during O3PO_Settings::configure().
\O3PO_Settings | $settings | Settings object. |
construct_doi_suffix(string $date_published, string|integer $volume, string|integer $pages) : string
Construct the doi suffix for publications.
Returns the doi suffix according to the template specified in settings.
string | $date_published | A date in ISO_8601 format. |
string|integer | $volume | The volume for which to construct the DOI. |
string|integer | $pages | The page/article number for which to construct the DOI. |
The doi suffix constructed according to the template of this publication type.