PHP Class Backend\Modules\Blog\Engine\Model

Afficher le fichier Open project: forkcms/forkcms Class Usage Examples

Méthodes publiques

Méthode Description
checkSettings ( ) : array Checks the settings and optionally returns an array with warnings
delete ( mixed $ids ) Deletes one or more items
deleteCategory ( integer $id ) Deletes a category
deleteCategoryAllowed ( integer $id ) : boolean Checks if it is allowed to delete the a category
deleteComments ( array $ids ) Deletes one or more comments
deleteSpamComments ( ) Delete all spam
exists ( integer $id ) : boolean Checks if an item exists
existsCategory ( integer $id ) : integer Checks if a category exists
existsComment ( integer $id ) : integer Checks if a comment exists
get ( integer $id ) : array Get all data for a given id
getAllCommentsForStatus ( string $status, integer $limit = 30, integer $offset ) : array Get the comments
getByTag ( integer $tagId ) : array Get all items by a given tag id
getCategories ( boolean $includeCount = false ) : array Get all categories
getCategory ( integer $id ) : array Get all data for a given id
getCategoryId ( string $title, string $language = null ) : integer Get a category id by title
getComment ( integer $id ) : array Get all data for a given id
getCommentStatusCount ( ) : array Get a count per comment
getComments ( array $ids ) : array Get multiple comments at once
getLatestComments ( string $status, integer $limit = 10 ) : array Get the latest comments for a given type
getMaximumId ( ) : integer Get the maximum id
getRevision ( integer $id, integer $revisionId ) : array Get all data for a given revision
getURL ( string $url, integer $id = null ) : string Retrieve the unique URL for an item
getURLForCategory ( string $url, integer $id = null ) : string Retrieve the unique URL for a category
insert ( array $item ) : integer Inserts an item into the database
insertCategory ( array $item, array $meta = null ) : integer Inserts a new category into the database
insertComment ( array $comment ) : integer Inserts a new comment (Taken from FrontendBlogModel)
insertCompletePost ( array $item, array $meta = [], array $tags = [], array $comments = [] ) : integer Inserts a complete post item based on some arrays of data
reCalculateCommentCount ( array $ids ) : boolean Recalculate the commentcount
update ( array $item ) : integer Update an existing item
updateCategory ( array $item, array $meta = null ) : integer Update an existing category
updateComment ( array $item ) : integer Update an existing comment
updateCommentStatuses ( array $ids, string $status ) Updates one or more comments' status
updateRevision ( $revision_id, $item ) Update a page revision without generating a new revision.

Method Details

checkSettings() public static méthode

Checks the settings and optionally returns an array with warnings
public static checkSettings ( ) : array
Résultat array

delete() public static méthode

Deletes one or more items
public static delete ( mixed $ids )
$ids mixed The ids to delete.

deleteCategory() public static méthode

Deletes a category
public static deleteCategory ( integer $id )
$id integer The id of the category to delete.

deleteCategoryAllowed() public static méthode

Checks if it is allowed to delete the a category
public static deleteCategoryAllowed ( integer $id ) : boolean
$id integer The id of the category.
Résultat boolean

deleteComments() public static méthode

Deletes one or more comments
public static deleteComments ( array $ids )
$ids array The id(s) of the items(s) to delete.

deleteSpamComments() public static méthode

Delete all spam
public static deleteSpamComments ( )

exists() public static méthode

Checks if an item exists
public static exists ( integer $id ) : boolean
$id integer The id of the item to check for existence.
Résultat boolean

existsCategory() public static méthode

Checks if a category exists
public static existsCategory ( integer $id ) : integer
$id integer The id of the category to check for existence.
Résultat integer

existsComment() public static méthode

Checks if a comment exists
public static existsComment ( integer $id ) : integer
$id integer The id of the item to check for existence.
Résultat integer

get() public static méthode

Get all data for a given id
public static get ( integer $id ) : array
$id integer The Id of the item to fetch?
Résultat array

getAllCommentsForStatus() public static méthode

Get the comments
public static getAllCommentsForStatus ( string $status, integer $limit = 30, integer $offset ) : array
$status string The type of comments to get.
$limit integer The maximum number of items to retrieve.
$offset integer The offset.
Résultat array

getByTag() public static méthode

Get all items by a given tag id
public static getByTag ( integer $tagId ) : array
$tagId integer The id of the tag.
Résultat array

getCategories() public static méthode

Get all categories
public static getCategories ( boolean $includeCount = false ) : array
$includeCount boolean Include the count?
Résultat array

getCategory() public static méthode

Get all data for a given id
public static getCategory ( integer $id ) : array
$id integer The id of the category to fetch.
Résultat array

getCategoryId() public static méthode

Get a category id by title
public static getCategoryId ( string $title, string $language = null ) : integer
$title string The title of the category.
$language string The language to use, if not provided we will use the working language.
Résultat integer

getComment() public static méthode

Get all data for a given id
public static getComment ( integer $id ) : array
$id integer The Id of the comment to fetch?
Résultat array

getCommentStatusCount() public static méthode

Get a count per comment
public static getCommentStatusCount ( ) : array
Résultat array

getComments() public static méthode

Get multiple comments at once
public static getComments ( array $ids ) : array
$ids array The id(s) of the comment(s).
Résultat array

getLatestComments() public static méthode

Get the latest comments for a given type
public static getLatestComments ( string $status, integer $limit = 10 ) : array
$status string The status for the comments to retrieve.
$limit integer The maximum number of items to retrieve.
Résultat array

getMaximumId() public static méthode

Get the maximum id
public static getMaximumId ( ) : integer
Résultat integer

getRevision() public static méthode

Get all data for a given revision
public static getRevision ( integer $id, integer $revisionId ) : array
$id integer The id of the item.
$revisionId integer The revision to get.
Résultat array

getURL() public static méthode

Retrieve the unique URL for an item
public static getURL ( string $url, integer $id = null ) : string
$url string The URL to base on.
$id integer The id of the item to ignore.
Résultat string

getURLForCategory() public static méthode

Retrieve the unique URL for a category
public static getURLForCategory ( string $url, integer $id = null ) : string
$url string The string whereon the URL will be based.
$id integer The id of the category to ignore.
Résultat string

insert() public static méthode

Inserts an item into the database
public static insert ( array $item ) : integer
$item array The data to insert.
Résultat integer

insertCategory() public static méthode

Inserts a new category into the database
public static insertCategory ( array $item, array $meta = null ) : integer
$item array The data for the category to insert.
$meta array The metadata for the category to insert.
Résultat integer

insertComment() public static méthode

Inserts a new comment (Taken from FrontendBlogModel)
public static insertComment ( array $comment ) : integer
$comment array The comment to add.
Résultat integer

insertCompletePost() public static méthode

This method's purpose is to be able to insert a post (possibly with all its metadata, tags, and comments) in one method call. As much data as possible has been made optional, to be able to do imports where only fractions of the data we need are known. The item array should have at least a 'title' and a 'text' property other properties are optional. The meta array has only optional properties. You can use these to override the defaults. The tags array is just a list of tagnames as string. The comments array is an array of arrays with comment properties. A comment should have at least 'author', 'email', and 'text' properties.
public static insertCompletePost ( array $item, array $meta = [], array $tags = [], array $comments = [] ) : integer
$item array The data to insert.
$meta array The metadata to insert.
$tags array The tags to connect to this post.
$comments array The comments attached to this post.
Résultat integer

reCalculateCommentCount() public static méthode

Recalculate the commentcount
public static reCalculateCommentCount ( array $ids ) : boolean
$ids array The id(s) of the post wherefore the commentcount should be recalculated.
Résultat boolean

update() public static méthode

Update an existing item
public static update ( array $item ) : integer
$item array The new data.
Résultat integer

updateCategory() public static méthode

Update an existing category
public static updateCategory ( array $item, array $meta = null ) : integer
$item array The new data.
$meta array The new meta-data.
Résultat integer

updateComment() public static méthode

Update an existing comment
public static updateComment ( array $item ) : integer
$item array The new data.
Résultat integer

updateCommentStatuses() public static méthode

Updates one or more comments' status
public static updateCommentStatuses ( array $ids, string $status )
$ids array The id(s) of the comment(s) to change the status for.
$status string The new status.

updateRevision() public static méthode

Needed to add an image to a page.
public static updateRevision ( $revision_id, $item )
$revision_id
$item