PHP Класс Pressbooks\Catalog

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

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

Свойство Тип Описание
$currentVersion integer The value for option: pressbooks_catalog_version
$maxTagsGroup integer Maximum number allowed in tags_group column

Защищенные свойства (Protected)

Свойство Тип Описание
$dbColumns array Column structure of catalog_table
$dbLinkTable Catalog tables, set in constructor
$dbTable Catalog tables, set in constructor
$dbTagsTable Catalog tables, set in constructor
$profileMetaKeys array Profile keys, stored in user_meta table
$userId integer User ID to construct this object

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

Метод Описание
__construct ( integer $user_id )
addMenu ( ) WP Hook, Instantiate UI
delete ( boolean $for_real = false ) : integer | false Delete an entire catalog.
deleteBook ( integer $blog_id, boolean $for_real = false ) : integer | false Delete a book from a user catalog.
deleteCache ( ) Delete the cache(s)
deleteCacheByBookId ( integer $book_id ) Delete the cache(s) by Book ID
deleteLogo ( ) WP_Ajax hook for pb_delete_catalog_logo
deleteTag ( string $tag, integer $blog_id, integer $tag_group, boolean $for_real = false ) : integer | false Delete a tag.
deleteTags ( $blog_id, $tag_group ) : integer | false Delete all tags from a user catalog
formAddByUrl ( ) Add Book by URL
formSubmit ( ) Catch me
get ( ) : array Get an entire catalog.
getAggregate ( ) : array Get all data for an entire catalog, cached
getBook ( integer $blog_id ) : array Get a book from a user catalog.
getBookIds ( ) : array Get only blog IDs.
getByTagId ( integer $tag_group, integer $tag_id ) : array Get catalog by tag id
getProfile ( ) : array Get catalog profile.
getTags ( integer $tag_group, boolean $show_hidden_tags = true ) : array Get tags
getTagsByBook ( integer $blog_id, integer $tag_group ) : array Get all tags for a book
getUserId ( ) : integer Get User ID
isCurrentAction ( $action ) : boolean Two actions are possible in a generic WP_List_Table form. The first takes precedence.
isFormSubmission ( ) : boolean Check if a user submitted something to index.php?page=pb_catalog
loadTemplate ( integer $userId ) Find and load our catalog template.
purgeOrphanTags ( ) Find all IDs in dbTagsTable that have no matching ID in dbLinkTable and delete them.
save ( array $items ) Save an entire catalog.
saveBook ( $blog_id, array $item ) : integer | false Save a book to a user catalog.
saveProfile ( array $item ) Save catalog profile
saveTag ( string $tag, integer $blog_id, integer $tag_group ) : integer | false Save tag
stringToTags ( string $tags ) : array Return an array of tags from a comma delimited string
tagsToString ( array $tags ) : string Return a comma delimited string from an SQL array of tags, in alphabetical order.
thumbnailFromUserId ( integer $user_id, string $size ) : string Catalog image is stored in user's active Media Library.
upgrade ( integer $version ) Upgrade catalog.
uploadLogo ( string $meta_key )

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

Метод Описание
createOrUpdateTables ( ) DB Delta the initial Catalog tables.
formBulk ( $action ) Save bulk actions
formProfile ( ) Save catalog profile to database
formTags ( ) Save tags to database

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

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

public __construct ( integer $user_id )
$user_id integer (optional)

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

WP Hook, Instantiate UI
static public addMenu ( )

createOrUpdateTables() защищенный Метод

If you change this, then don't forget to also change $this->dbColumns
См. также: dbColumns
См. также: http://codex.wordpress.org/Creating_Tables_with_Plugins#Creating_or_Updating_the_Table
protected createOrUpdateTables ( )

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

Delete an entire catalog.
public delete ( boolean $for_real = false ) : integer | false
$for_real boolean (optional)
Результат integer | false

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

Delete a book from a user catalog.
public deleteBook ( integer $blog_id, boolean $for_real = false ) : integer | false
$blog_id integer
$for_real boolean (optional)
Результат integer | false

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

Delete the cache(s)
public deleteCache ( )

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

Delete the cache(s) by Book ID
public deleteCacheByBookId ( integer $book_id )
$book_id integer

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

IMPORTANT: The 'for_real' option is extremely destructive. Do not use unless you know what you are doing.
public deleteTag ( string $tag, integer $blog_id, integer $tag_group, boolean $for_real = false ) : integer | false
$tag string
$blog_id integer
$tag_group integer
$for_real boolean (optional)
Результат integer | false

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

Note: Doesn't actually delete a tag, just removes the association in dbLinkTable
public deleteTags ( $blog_id, $tag_group ) : integer | false
$blog_id
$tag_group
Результат integer | false

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

Add Book by URL
static public formAddByUrl ( )

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

Save bulk actions
protected static formBulk ( $action )
$action

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

Save catalog profile to database
protected static formProfile ( )

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

Catch me
static public formSubmit ( )

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

Save tags to database
protected static formTags ( )

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

Get an entire catalog.
public get ( ) : array
Результат array

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

Get all data for an entire catalog, cached
public getAggregate ( ) : array
Результат array

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

Get a book from a user catalog.
public getBook ( integer $blog_id ) : array
$blog_id integer
Результат array

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

Get only blog IDs.
public getBookIds ( ) : array
Результат array

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

Get catalog by tag id
public getByTagId ( integer $tag_group, integer $tag_id ) : array
$tag_group integer
$tag_id integer
Результат array

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

Get catalog profile.
public getProfile ( ) : array
Результат array

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

Get tags
public getTags ( integer $tag_group, boolean $show_hidden_tags = true ) : array
$tag_group integer
$show_hidden_tags boolean (optional)
Результат array

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

Get all tags for a book
public getTagsByBook ( integer $blog_id, integer $tag_group ) : array
$blog_id integer
$tag_group integer
Результат array

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

Get User ID
public getUserId ( ) : integer
Результат integer

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

Two actions are possible in a generic WP_List_Table form. The first takes precedence.
См. также: WP_List_Table::current_action
static public isCurrentAction ( $action ) : boolean
$action
Результат boolean

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

Check if a user submitted something to index.php?page=pb_catalog
static public isFormSubmission ( ) : boolean
Результат boolean

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

Find and load our catalog template.
static public loadTemplate ( integer $userId )
$userId integer

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

Find all IDs in dbTagsTable that have no matching ID in dbLinkTable and delete them.
public purgeOrphanTags ( )

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

Save an entire catalog.
public save ( array $items )
$items array

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

Save a book to a user catalog.
public saveBook ( $blog_id, array $item ) : integer | false
$blog_id
$item array
Результат integer | false

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

Save catalog profile
public saveProfile ( array $item )
$item array

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

Save tag
public saveTag ( string $tag, integer $blog_id, integer $tag_group ) : integer | false
$tag string
$blog_id integer
$tag_group integer
Результат integer | false

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

Return an array of tags from a comma delimited string
static public stringToTags ( string $tags ) : array
$tags string
Результат array

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

Return a comma delimited string from an SQL array of tags, in alphabetical order.
static public tagsToString ( array $tags ) : string
$tags array
Результат string

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

Catalog image is stored in user's active Media Library.
static public thumbnailFromUserId ( integer $user_id, string $size ) : string
$user_id integer
$size string
Результат string

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

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

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

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

The value for option: pressbooks_catalog_version
См. также: install()
static public int $currentVersion
Результат integer

$dbColumns защищенное свойство

Column structure of catalog_table
protected array $dbColumns
Результат array

$dbLinkTable защищенное свойство

Catalog tables, set in constructor
protected $dbLinkTable

$dbTable защищенное свойство

Catalog tables, set in constructor
protected $dbTable

$dbTagsTable защищенное свойство

Catalog tables, set in constructor
protected $dbTagsTable

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

Maximum number allowed in tags_group column
static public int $maxTagsGroup
Результат integer

$profileMetaKeys защищенное свойство

Profile keys, stored in user_meta table
protected array $profileMetaKeys
Результат array

$userId защищенное свойство

User ID to construct this object
protected int $userId
Результат integer