PHP Class Pressbooks\Metadata

ファイルを表示 Open project: pressbooks/pressbooks Class Usage Examples

Public Properties

Property Type Description
$currentVersion integer The value for option: pressbooks_metadata_version
$upgradeCheckboxes array We need to upgrade these for compatibility with custom_metdata().

Public Methods

Method Description
__construct ( )
changeDefaultBookCover ( ) Change default book cover from PNG to JPG
fixDoubleSlashBug ( ) Fix a double slash bug by reactivating theme with new settings.
getDeprecatedComparisonTable ( string $table, boolean $new_as_keys = false ) : array
getLicenseXml ( string $type, string $copyright_holder, string $src_url, string $title, $lang = '' ) : string Takes a known string from metadata, builds a url to hit an api which returns an xml response
getMetaPost ( ) : WP_Post | boolean Returns the latest "metadata" post. There should be only one per book.
getMetaPostMetadata ( ) : array Return metadata attached to the latest "metadata" post.
getMicrodataElements ( ) : string Returns an html blob of microdata elements based on what is set in 'Book Information'
getMidByKey ( integer $post_id, string $meta_key ) : integer | boolean Return a database ID for a given meta key.
getSeoMetaElements ( ) : string Returns an html blob of meta elements based on what is set in 'Book Information'
getWebLicenseHtml ( SimpleXMLElement $response ) : string Returns an HTML blob if given an XML object
makeThumbnailsForBookCover ( ) Generate thumbnails for a user uploaded cover
resetLandingPage ( ) Fix broken landing page
upgrade ( integer $version ) Upgrade metadata.
upgradeBook ( ) Upgrade book metadata.
upgradeBookInformation ( ) Upgrade book information.
upgradeCustomCss ( ) Upgrade Custom CSS types.
upgradeEcommerce ( ) Upgrade Ecommerce metadata

Method Details

__construct() public method

public __construct ( )

changeDefaultBookCover() public method

Change default book cover from PNG to JPG

fixDoubleSlashBug() public method

Fix a double slash bug by reactivating theme with new settings.
See also: Pressbooks\Pressbooks::registerThemeDirectories
public fixDoubleSlashBug ( )

getDeprecatedComparisonTable() public method

Deprecation:
public getDeprecatedComparisonTable ( string $table, boolean $new_as_keys = false ) : array
$table string
$new_as_keys boolean
return array

getLicenseXml() static public method

Takes a known string from metadata, builds a url to hit an api which returns an xml response
See also: https://api.creativecommons.org/docs/readme_15.html
static public getLicenseXml ( string $type, string $copyright_holder, string $src_url, string $title, $lang = '' ) : string
$type string license type
$copyright_holder string of the page
$src_url string of the page
$title string of the page
return string $xml response

getMetaPost() public method

Returns the latest "metadata" post. There should be only one per book.
public getMetaPost ( ) : WP_Post | boolean
return WP_Post | boolean

getMetaPostMetadata() public method

Return metadata attached to the latest "metadata" post.
public getMetaPostMetadata ( ) : array
return array

getMicrodataElements() static public method

Returns an html blob of microdata elements based on what is set in 'Book Information'
static public getMicrodataElements ( ) : string
return string

getMidByKey() public method

Return a database ID for a given meta key.
public getMidByKey ( integer $post_id, string $meta_key ) : integer | boolean
$post_id integer
$meta_key string
return integer | boolean

getSeoMetaElements() static public method

Returns an html blob of meta elements based on what is set in 'Book Information'
static public getSeoMetaElements ( ) : string
return string

getWebLicenseHtml() static public method

Returns an HTML blob if given an XML object
static public getWebLicenseHtml ( SimpleXMLElement $response ) : string
$response SimpleXMLElement
return string $html blob of copyright information

makeThumbnailsForBookCover() public method

Generate thumbnails for a user uploaded cover

resetLandingPage() public method

Fix broken landing page
public resetLandingPage ( )

upgrade() public method

Upgrade metadata.
public upgrade ( integer $version )
$version integer

upgradeBook() public method

Upgrade book metadata.
public upgradeBook ( )

upgradeBookInformation() public method

Upgrade book information.

upgradeCustomCss() public method

Upgrade Custom CSS types.
See also: Pressbooks\Activation::wpmuActivate
public upgradeCustomCss ( )

upgradeEcommerce() public method

Upgrade Ecommerce metadata
public upgradeEcommerce ( )

Property Details

$currentVersion static_oe public_oe property

The value for option: pressbooks_metadata_version
See also: upgrade()
static public int $currentVersion
return integer

$upgradeCheckboxes public_oe property

We need to upgrade these for compatibility with custom_metdata().
public array $upgradeCheckboxes
return array