\O3PO_Arxiv

Encapsulates the interface with the external service arXiv.

Provides methods to interface with arXiv.

Summary

Methods
Properties
Constants
fetch_meta_data_from_abstract_page()
download_pdf()
download_source()
get_arxiv_upload_date()
is_cc_by_license_url()
No public properties found
No constants found
No protected methods found
No protected properties found
N/A
No private methods found
No private properties found
N/A

Methods

fetch_meta_data_from_abstract_page()

fetch_meta_data_from_abstract_page(string  $arxiv_url_abs_prefix, string  $eprint, integer  $timeout = 10, boolean  $check_license = True) : array

Fetch meta-data from the abstract page of an eprint on the arXiv.

Extracts the abstract, number_authors, author_first_names, author_last_names and title. As there is no way to tell, whether the first name is the given or surname we cannot deduce the given names and surnames and instead return first and last names.

Parameters

string $arxiv_url_abs_prefix

The url prefix under which arXiv abstracts can be found.

string $eprint

The eprint for which to fetch the meta-data.

integer $timeout

An optional timeout.

boolean $check_license

Whether to fetch and check the license.

Returns

array —

An array containing the extracted meta-data.

download_pdf()

download_pdf(\O3PO_Environment  $environment, string  $arxiv_url_pdf_prefix, string  $eprint, string  $file_name_without_extension, integer  $post_id) : mixed

Download the source of an eprint from the arXiv.

Uses the provided $evironment to download the pdf of an eprint from the arXiv.

Parameters

\O3PO_Environment $environment

The environment to use for downloading

string $arxiv_url_pdf_prefix

The url prefix under which arXiv pdfs can be found.

string $eprint

The eprint whose source is to be downloaded

string $file_name_without_extension

The desired filename without extension of the local file after the download.

integer $post_id

Id of the post to which to attach the download.

Returns

mixed —

Returns a map with information on the downloaded file. See O3PO_Environment for more details.

download_source()

download_source(\O3PO_Environment  $environment, string  $arxiv_url_source_prefix, string  $eprint, string  $file_name_without_extension, integer  $post_id) : mixed

Download the source of an eprint from the arXiv.

The arXiv returns either a tar.gz file in case the authors' submission consisted of multiple files, or a single uncompressed tex file. The returned mime type is accessible via the 'mime_type' key in the returned results.

Parameters

\O3PO_Environment $environment

The environment to use for downloading

string $arxiv_url_source_prefix

The url prefix under which arXiv source can be found.

string $eprint

The eprint whose source is to be downloaded

string $file_name_without_extension

The desired filename without extension of the local file after the download.

integer $post_id

Id of the post to which to attach the download.

Returns

mixed —

Returns a map with information on the downloaded file. See O3PO_Environment for more details.

get_arxiv_upload_date()

get_arxiv_upload_date(string  $arxiv_url_abs_prefix, string  $eprint, integer  $timeout = 10) : integer|\WP_Error

Get the date at which a eprint was uploaded to the arXiv.

Parameters

string $arxiv_url_abs_prefix

The url prefix under which arXiv abstracts can be found.

string $eprint

The eprint for which to get the upload date.

integer $timeout

An optional timeout.

Returns

integer|\WP_Error —

The upload date

is_cc_by_license_url()

is_cc_by_license_url(string  $url) : boolean

Check whether a url is a CC-BY license url

Parameters

string $url

Url to check

Returns

boolean —

True if it is a CC-BY license