PHP Class Airship\Cabin\Bridge\Blueprint\Blog

Blog posts, categories, series, tags.
Inheritance: extends BlueprintGear, use trait Common, use trait Orderable, use trait Slug, use trait Airship\Engine\Bolt\Cache
Afficher le fichier Open project: paragonie/airship Class Usage Examples

Protected Properties

Свойство Type Description
$cabin Cabin for this blog post (used as a default parameter)

Méthodes publiques

Méthode Description
categoryDescendsFrom ( integer $newParent, integer $categoryId ) : boolean Sanity check; don't allow a category to belong to one of its children.
createCategory ( array $post ) : boolean Create a new category
createPost ( array $post, boolean $publish = false ) : boolean Create (and, optionally, publish) a new blog post.
createSeries ( array $post ) : boolean Inserts a new series, and the subsequent items, in the database
createTag ( array $post ) : boolean Create a new tag
deleteCategory ( integer $categoryID, integer $moveChildrenTo ) : boolean Delete a category and move all related content
deleteComment ( integer $commentId ) : boolean Delete this comment and all of its revision history.
deletePost ( array $formData, array $blogPost = [] ) : boolean Delete a blog post
deleteSeries ( integer $seriesId ) : boolean Permanently remove a blog post series.
editTag ( integer $tagId, array $post ) : boolean Rename a tag
getAllSeries ( integer $offset, integer $limit ) : array Get all of the series (paginated)
getAllSeriesParents ( array $seriesIds, integer $depth ) : array Get all of the series that this series belongs to, recursively.
getBlogPostById ( integer $postId ) : array Get information about a blog post
getBlogPostLatestVersion ( integer $postId ) : array Get the latest version of a blog post
getBlogPostVersionByUniqueId ( string $uniqueID ) : array Get a specific blog post version, given a unique ID
getBlogPostVersions ( integer $postId ) : array
getCategoryInfo ( integer $categoryId ) : array Get a category
getCategoryParents ( integer $categoryId, integer $depth ) : array Get all of a category's parents
getCategoryTree ( integer $parent = null, string $col = 'children', array $seen = [], integer $depth ) : array Get a full category tree, recursively, from a given parent
getCommentById ( integer $commentId, boolean $includeReplyTo = true ) : array Get a blog comment
getNextVersionUniqueId ( integer $postId, integer $currentVersionId ) : string Get the next version's unique ID
getPrevVersionUniqueId ( integer $postId, integer $currentVersionId ) : string Get the previous version's unique ID
getSeries ( integer $seriesId ) : array Get a single series
getSeriesForAuthor ( integer $authorId, array $exclude = [] ) : array Get all of the series for a particular author
getSeriesForUser ( integer $userId, integer $offset, integer $limit ) : array Get all of the series for all of the authors the user owns
getSeriesItems ( integer $seriesId ) : array Get a single series
getSeriesTree ( integer $current = null, string $col = 'children', array $encountered = [], integer $depth ) : array Get a full series tree, recursively, from a given parent
getTagInfo ( integer $tagId ) : array Get data on a specific tag
getTags ( ) : array Get all of the tags in the database
getTagsForPost ( integer $postId ) : array Get a list of all selected blog posts
hideComment ( integer $commentId ) : boolean Make a comment invisible on blog posts.
listComments ( integer $offset, integer $limit = 20 ) : array List comments
listPosts ( boolean $showAll = false, integer $offset, integer $limit = 20 ) : array Get the most recent posts
listPostsForAuthor ( integer $authorId, array $exclude = [] ) : array Get all of the series for a particular author
listTags ( integer $offset, integer $limit, string $sort = 'name', boolean $desc = false ) : array List tags (paginated, sortable).
numComments ( mixed $published = null ) : integer Count the number of posts. trinary: NULL -> all posts TRUE -> all published posts FALSE -> all unpublished posts
numItemsInSeries ( integer $seriesId ) : integer Get the number of items in a given series.
numPosts ( mixed $published = null ) : integer Count the number of posts. trinary: NULL -> all posts TRUE -> all published posts FALSE -> all unpublished posts
numSeries ( ) : integer Count the number of series in the database
numSeriesForUser ( integer $userId ) : integer Count the number of series for a user
numTags ( ) : integer Count the number of tags
publishComment ( integer $commentId ) : boolean Publish an unapproved blog comment.
updateCategory ( integer $id, array $post ) : boolean Update a blog category
updateCategorySlug ( integer $id, array $post ) : boolean
updatePost ( array $post, array $old, boolean $publish = false ) : boolean Update a blog post
updateSeries ( integer $seriesId, array $oldItems, array $post ) : boolean Insert/delete/rearrange the contents of a series.

Méthodes protégées

Méthode Description
makeBlogPostSlug ( string $title, string $year = '', string $month = '' ) : string Make a generic slug for most tables

Method Details

categoryDescendsFrom() public méthode

Returns TRUE if this check is violated.
public categoryDescendsFrom ( integer $newParent, integer $categoryId ) : boolean
$newParent integer
$categoryId integer
Résultat boolean

createCategory() public méthode

Create a new category
public createCategory ( array $post ) : boolean
$post array
Résultat boolean

createPost() public méthode

Create (and, optionally, publish) a new blog post.
public createPost ( array $post, boolean $publish = false ) : boolean
$post array
$publish boolean
Résultat boolean

createSeries() public méthode

Inserts a new series, and the subsequent items, in the database
public createSeries ( array $post ) : boolean
$post array
Résultat boolean

createTag() public méthode

Create a new tag
public createTag ( array $post ) : boolean
$post array
Résultat boolean

deleteCategory() public méthode

Delete a category and move all related content
public deleteCategory ( integer $categoryID, integer $moveChildrenTo ) : boolean
$categoryID integer
$moveChildrenTo integer
Résultat boolean

deleteComment() public méthode

Delete this comment and all of its revision history.
public deleteComment ( integer $commentId ) : boolean
$commentId integer
Résultat boolean

deletePost() public méthode

Delete a blog post
public deletePost ( array $formData, array $blogPost = [] ) : boolean
$formData array
$blogPost array
Résultat boolean

deleteSeries() public méthode

Permanently remove a blog post series.
public deleteSeries ( integer $seriesId ) : boolean
$seriesId integer
Résultat boolean

editTag() public méthode

Rename a tag
public editTag ( integer $tagId, array $post ) : boolean
$tagId integer
$post array
Résultat boolean

getAllSeries() public méthode

Get all of the series (paginated)
public getAllSeries ( integer $offset, integer $limit ) : array
$offset integer
$limit integer
Résultat array

getAllSeriesParents() public méthode

This is mostly used for generating the appropriate "prev/next" links on the View Blog Post page.
public getAllSeriesParents ( array $seriesIds, integer $depth ) : array
$seriesIds array
$depth integer
Résultat array

getBlogPostById() public méthode

Get information about a blog post
public getBlogPostById ( integer $postId ) : array
$postId integer
Résultat array

getBlogPostLatestVersion() public méthode

Get the latest version of a blog post
public getBlogPostLatestVersion ( integer $postId ) : array
$postId integer
Résultat array

getBlogPostVersionByUniqueId() public méthode

Get a specific blog post version, given a unique ID
public getBlogPostVersionByUniqueId ( string $uniqueID ) : array
$uniqueID string
Résultat array

getBlogPostVersions() public méthode

public getBlogPostVersions ( integer $postId ) : array
$postId integer
Résultat array

getCategoryInfo() public méthode

Get a category
public getCategoryInfo ( integer $categoryId ) : array
$categoryId integer
Résultat array

getCategoryParents() public méthode

Get all of a category's parents
public getCategoryParents ( integer $categoryId, integer $depth ) : array
$categoryId integer
$depth integer
Résultat array

getCategoryTree() public méthode

Get a full category tree, recursively, from a given parent
public getCategoryTree ( integer $parent = null, string $col = 'children', array $seen = [], integer $depth ) : array
$parent integer
$col string The "children" column name
$seen array
$depth integer How deep are we?
Résultat array

getCommentById() public méthode

Get a blog comment
public getCommentById ( integer $commentId, boolean $includeReplyTo = true ) : array
$commentId integer
$includeReplyTo boolean Also grab the parent comment?
Résultat array

getNextVersionUniqueId() public méthode

Get the next version's unique ID
public getNextVersionUniqueId ( integer $postId, integer $currentVersionId ) : string
$postId integer
$currentVersionId integer
Résultat string

getPrevVersionUniqueId() public méthode

Get the previous version's unique ID
public getPrevVersionUniqueId ( integer $postId, integer $currentVersionId ) : string
$postId integer
$currentVersionId integer
Résultat string

getSeries() public méthode

Get a single series
public getSeries ( integer $seriesId ) : array
$seriesId integer
Résultat array

getSeriesForAuthor() public méthode

Get all of the series for a particular author
public getSeriesForAuthor ( integer $authorId, array $exclude = [] ) : array
$authorId integer
$exclude array Series IDs to exclude
Résultat array

getSeriesForUser() public méthode

Get all of the series for all of the authors the user owns
public getSeriesForUser ( integer $userId, integer $offset, integer $limit ) : array
$userId integer
$offset integer
$limit integer
Résultat array

getSeriesItems() public méthode

Get a single series
public getSeriesItems ( integer $seriesId ) : array
$seriesId integer
Résultat array

getSeriesTree() public méthode

Get a full series tree, recursively, from a given parent
public getSeriesTree ( integer $current = null, string $col = 'children', array $encountered = [], integer $depth ) : array
$current integer
$col string The "children" column name
$encountered array Which IDs have we seen before?
$depth integer How deep are we?
Résultat array

getTagInfo() public méthode

Get data on a specific tag
public getTagInfo ( integer $tagId ) : array
$tagId integer
Résultat array

getTags() public méthode

Get all of the tags in the database
public getTags ( ) : array
Résultat array

getTagsForPost() public méthode

Get a list of all selected blog posts
public getTagsForPost ( integer $postId ) : array
$postId integer
Résultat array

hideComment() public méthode

Make a comment invisible on blog posts.
public hideComment ( integer $commentId ) : boolean
$commentId integer
Résultat boolean

listComments() public méthode

List comments
public listComments ( integer $offset, integer $limit = 20 ) : array
$offset integer
$limit integer
Résultat array

listPosts() public méthode

Get the most recent posts
public listPosts ( boolean $showAll = false, integer $offset, integer $limit = 20 ) : array
$showAll boolean
$offset integer
$limit integer
Résultat array

listPostsForAuthor() public méthode

Get all of the series for a particular author
public listPostsForAuthor ( integer $authorId, array $exclude = [] ) : array
$authorId integer
$exclude array Series IDs to exclude
Résultat array

listTags() public méthode

List tags (paginated, sortable).
public listTags ( integer $offset, integer $limit, string $sort = 'name', boolean $desc = false ) : array
$offset integer
$limit integer
$sort string
$desc boolean
Résultat array

makeBlogPostSlug() protected méthode

Make a generic slug for most tables
protected makeBlogPostSlug ( string $title, string $year = '', string $month = '' ) : string
$title string What are we basing the URL off of?
$year string
$month string
Résultat string

numComments() public méthode

Count the number of posts. trinary: NULL -> all posts TRUE -> all published posts FALSE -> all unpublished posts
public numComments ( mixed $published = null ) : integer
$published mixed
Résultat integer

numItemsInSeries() public méthode

Get the number of items in a given series.
public numItemsInSeries ( integer $seriesId ) : integer
$seriesId integer
Résultat integer

numPosts() public méthode

Count the number of posts. trinary: NULL -> all posts TRUE -> all published posts FALSE -> all unpublished posts
public numPosts ( mixed $published = null ) : integer
$published mixed
Résultat integer

numSeries() public méthode

Count the number of series in the database
public numSeries ( ) : integer
Résultat integer

numSeriesForUser() public méthode

Count the number of series for a user
public numSeriesForUser ( integer $userId ) : integer
$userId integer
Résultat integer

numTags() public méthode

Count the number of tags
public numTags ( ) : integer
Résultat integer

publishComment() public méthode

Publish an unapproved blog comment.
public publishComment ( integer $commentId ) : boolean
$commentId integer
Résultat boolean

updateCategory() public méthode

Update a blog category
public updateCategory ( integer $id, array $post ) : boolean
$id integer
$post array
Résultat boolean

updateCategorySlug() public méthode

public updateCategorySlug ( integer $id, array $post ) : boolean
$id integer
$post array
Résultat boolean

updatePost() public méthode

Update a blog post
public updatePost ( array $post, array $old, boolean $publish = false ) : boolean
$post array
$old array
$publish boolean
Résultat boolean

updateSeries() public méthode

Insert/delete/rearrange the contents of a series.
public updateSeries ( integer $seriesId, array $oldItems, array $post ) : boolean
$seriesId integer
$oldItems array
$post array
Résultat boolean

Property Details

$cabin protected_oe property

Cabin for this blog post (used as a default parameter)
protected $cabin