PHP Класс Pressbooks\Book

Показать файл Открыть проект Примеры использования класса

Открытые свойства

Свойство Тип Описание
$fixDupeSlugs array This can happen if a post is 'draft', 'pending', or 'auto-draft'

Открытые методы

Метод Описание
__construct ( )
consolidatePost ( integer $pid, WP_Post $post ) : boolean Ensures this chapter/part/front matter has a "menu_order" when it is saved
deleteBookObjectCache ( ) Delete the Book Object cache(s)
deletePost ( integer $pid ) : boolean Put a Part/Chapter/Front Matter/Back Matter in the trash
get ( string $what = 'next' ) : string Fetch next, previous or first post
getBookContents ( ) : array Returns an array representing the entire structure of a book, in correct order, with a maximum amount of fields. Data is raw and must be post-processed.
getBookInformation ( $id = '' ) : array Returns book information in a useful, string only, format. Data is converted to HTML.
getBookStructure ( string $id = '' ) : array Returns an array representing the entire structure of a book, in correct order, with a minimum amount of fields. Data is raw and must be post-processed.
getFirst ( ) : string Select the very first post in a book. May be a chapter or a front matter post
getSubsections ( $id ) : array | false Returns an array of subsections in front matter, back matter, or chapters.
isBook ( ) : boolean Check if the current blog_id is considered a "book"
tagSubsections ( string $content, $id ) : string Returns chapter, front or back matter content with section ID and classes added.
updateBackMatter ( ) WP_Ajax hook. Updates the menu_order field associated with a back matter post after reordering it
updateChapter ( ) WP_Ajax hook. Updates the menu_order field associated with a chapter post after reordering it and update its associated part, if necessary
updateExportOptions ( ) WP_Ajax hook. Updates a post's "export" setting (export post into book or not)
updateFrontMatter ( ) WP_Ajax hook. Updates the menu_order field associated with a front matter post after reordering it
updateGlobalPrivacyOptions ( ) WP_Ajax hook. Updates a post's privacy setting (whether the post is published or privately published)
updatePrivacyOptions ( ) WP_Ajax hook. Updates a post's privacy setting (whether the post is published or privately published)
updateShowTitleOptions ( ) WP_Ajax hook. Updates a post's "show title" setting (show title in exports or not)

Защищенные методы

Метод Описание
fixSlug ( string $old_post_name ) : string Fix empty slugs and Fix duplicate slugs.

Описание методов

__construct() публичный Метод

public __construct ( )

consolidatePost() статический публичный Метод

Ensures this chapter/part/front matter has a "menu_order" when it is saved
static public consolidatePost ( integer $pid, WP_Post $post ) : boolean
$pid integer Post ID
$post WP_Post Post
Результат boolean

deleteBookObjectCache() статический публичный Метод

Delete the Book Object cache(s)
static public deleteBookObjectCache ( )

deletePost() статический публичный Метод

Put a Part/Chapter/Front Matter/Back Matter in the trash
static public deletePost ( integer $pid ) : boolean
$pid integer
Результат boolean

fixSlug() защищенный статический Метод

This can happen if a post is 'draft', 'pending', or 'auto-draft'
protected static fixSlug ( string $old_post_name ) : string
$old_post_name string
Результат string

get() статический публичный Метод

Fetch next, previous or first post
static public get ( string $what = 'next' ) : string
$what string prev, next or first
Результат string URL of requested post

getBookContents() статический публичный Метод

Returns an array representing the entire structure of a book, in correct order, with a maximum amount of fields. Data is raw and must be post-processed.
См. также: bottom of this file for more info
static public getBookContents ( ) : array
Результат array

getBookInformation() статический публичный Метод

Returns book information in a useful, string only, format. Data is converted to HTML.
static public getBookInformation ( $id = '' ) : array
Результат array

getBookStructure() статический публичный Метод

Returns an array representing the entire structure of a book, in correct order, with a minimum amount of fields. Data is raw and must be post-processed.
См. также: bottom of this file for more info
static public getBookStructure ( string $id = '' ) : array
$id string
Результат array

getFirst() статический публичный Метод

Select the very first post in a book. May be a chapter or a front matter post
static public getFirst ( ) : string
Результат string permalink of the first post

getSubsections() статический публичный Метод

Returns an array of subsections in front matter, back matter, or chapters.
static public getSubsections ( $id ) : array | false
$id
Результат array | false

isBook() статический публичный Метод

Check if the current blog_id is considered a "book"
static public isBook ( ) : boolean
Результат boolean

tagSubsections() статический публичный Метод

Returns chapter, front or back matter content with section ID and classes added.
static public tagSubsections ( string $content, $id ) : string
$content string
Результат string

updateBackMatter() статический публичный Метод

WP_Ajax hook. Updates the menu_order field associated with a back matter post after reordering it
static public updateBackMatter ( )

updateChapter() статический публичный Метод

WP_Ajax hook. Updates the menu_order field associated with a chapter post after reordering it and update its associated part, if necessary
static public updateChapter ( )

updateExportOptions() статический публичный Метод

WP_Ajax hook. Updates a post's "export" setting (export post into book or not)
static public updateExportOptions ( )

updateFrontMatter() статический публичный Метод

WP_Ajax hook. Updates the menu_order field associated with a front matter post after reordering it
static public updateFrontMatter ( )

updateGlobalPrivacyOptions() статический публичный Метод

WP_Ajax hook. Updates a post's privacy setting (whether the post is published or privately published)
static public updateGlobalPrivacyOptions ( )

updatePrivacyOptions() статический публичный Метод

WP_Ajax hook. Updates a post's privacy setting (whether the post is published or privately published)
static public updatePrivacyOptions ( )

updateShowTitleOptions() статический публичный Метод

WP_Ajax hook. Updates a post's "show title" setting (show title in exports or not)
static public updateShowTitleOptions ( )

Описание свойств

$fixDupeSlugs статическое публичное свойство

This can happen if a post is 'draft', 'pending', or 'auto-draft'
См. также: wp_unique_post_slug()
static public array $fixDupeSlugs
Результат array