PHP Class Backend\Modules\Blog\Engine\Model

Datei anzeigen Open project: forkcms/forkcms Class Usage Examples

Public Methods

Method 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 method

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

delete() public static method

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

deleteCategory() public static method

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

deleteCategoryAllowed() public static method

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

deleteComments() public static method

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

deleteSpamComments() public static method

Delete all spam
public static deleteSpamComments ( )

exists() public static method

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

existsCategory() public static method

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

existsComment() public static method

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

get() public static method

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

getAllCommentsForStatus() public static method

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.
return array

getByTag() public static method

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

getCategories() public static method

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

getCategory() public static method

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

getCategoryId() public static method

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.
return integer

getComment() public static method

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

getCommentStatusCount() public static method

Get a count per comment
public static getCommentStatusCount ( ) : array
return array

getComments() public static method

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

getLatestComments() public static method

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.
return array

getMaximumId() public static method

Get the maximum id
public static getMaximumId ( ) : integer
return integer

getRevision() public static method

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.
return array

getURL() public static method

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.
return string

getURLForCategory() public static method

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.
return string

insert() public static method

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

insertCategory() public static method

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.
return integer

insertComment() public static method

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

insertCompletePost() public static method

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.
return integer

reCalculateCommentCount() public static method

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

update() public static method

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

updateCategory() public static method

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

updateComment() public static method

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

updateCommentStatuses() public static method

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 method

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