PHP Класс Habari\Comments

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

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

Метод Описание
__get ( string $name ) : mixed Implements custom object properties
by_email ( string $email = '' ) : array selects all comments from a given email address
by_ip ( string $ip = '' ) : array selects all comments from a given IP address
by_name ( string $name = '' ) : array selects all comments from a given name
by_post_id ( integer $post_id ) : array Returns all comments for a supplied post ID
by_slug ( string $slug = '' ) : array select all comments for a given post slug
by_status ( integer $status ) : array select all comments of a given status
by_url ( string $url = '' ) : array select all comments from an author's URL
count_by_author ( integer $id, integer | string $status = 'approved' ) : integer returns the number of comments attached to posts by the specified author
count_by_email ( string $email = '', integer | string $status = 'approved' ) : integer returns the number of comments attributed ot the specified email
count_by_id ( integer $id, integer | string $status = 'approved' ) : integer returns the number of comments attached to the specified post
count_by_ip ( string $ip = '', integer | string $status = 'approved' ) : integer returns the number of comments from the specified IP address
count_by_name ( string $name = '', integer | string $status = 'approved' ) : integer returns the number of comments attributed to the specified name
count_by_slug ( string $slug = '', integer | string $status = 'approved' ) : integer returns the number of comments attached to the specified post
count_by_url ( string $url = '', integer | string $status = 'approved' ) : integer returns the number of comments attributed to the specified URL
count_total ( integer | string $status = 'approved', integer | string $type = 'comment' ) : integer returns the number of comments based on the specified status and type
delete ( ) function delete Deletes all comments in this object
delete_by_status ( integer | string $status ) delete all the comments and commentinfo for comments with this status
delete_these ( $comments ) : boolean Deletes comments from the database
filter ( Callable | array $filter ) : Comments Filter Comments using a callback function
get ( array $paramarray = [] ) : array function get Returns requested comments
moderate_these ( array | Comments $comments, integer | string $status = null ) : boolean Changes the status of comments
only ( string $field, mixed $index ) : array Returns all of the comments from the current Comments object having the specified index for the specified field $tb = $comments->only( 'trackbacks' )
search_to_get ( string $search_string ) : array Parses a search string for status, type, author, and tag keywords. Returns an associative array which can be passed to Comments::get(). If multiple authors, statuses, or types are specified, we assume an implicit OR such that (e.g.) any author that matches would be returned.

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

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

Implements custom object properties
public __get ( string $name ) : mixed
$name string Name of property to return
Результат mixed The requested field value

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

selects all comments from a given email address
public static by_email ( string $email = '' ) : array
$email string an email address
Результат array an array of Comment objects written by that email address

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

selects all comments from a given IP address
public static by_ip ( string $ip = '' ) : array
$ip string an IP address
Результат array an array of Comment objects written from the given IP

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

selects all comments from a given name
public static by_name ( string $name = '' ) : array
$name string a name
Результат array an array of Comment objects written by the given name

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

Returns all comments for a supplied post ID
public static by_post_id ( integer $post_id ) : array
$post_id integer The id of a post
Результат array an array of Comment objects for the given post

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

select all comments for a given post slug
public static by_slug ( string $slug = '' ) : array
$slug string a post slug
Результат array array an array of Comment objects for the given post

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

select all comments of a given status
public static by_status ( integer $status ) : array
$status integer a status value
Результат array an array of Comment objects with the same status

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

select all comments from an author's URL
public static by_url ( string $url = '' ) : array
$url string a URL
Результат array array an array of Comment objects with the same URL

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

returns the number of comments attached to posts by the specified author
public static count_by_author ( integer $id, integer | string $status = 'approved' ) : integer
$id integer a user ID
$status integer | string A comment status value, or false to not filter on status(default: 'approved')
Результат integer a count of the comments attached to the specified post

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

returns the number of comments attributed ot the specified email
public static count_by_email ( string $email = '', integer | string $status = 'approved' ) : integer
$email string an email address
$status integer | string A comment status value, or false to not filter on status (default: 'approved')
Результат integer a count of the comments from the specified email

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

returns the number of comments attached to the specified post
public static count_by_id ( integer $id, integer | string $status = 'approved' ) : integer
$id integer a post ID
$status integer | string A comment status value, or false to not filter on status(default: 'approved')
Результат integer a count of the comments attached to the specified post

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

returns the number of comments from the specified IP address
public static count_by_ip ( string $ip = '', integer | string $status = 'approved' ) : integer
$ip string an IP address
$status integer | string A comment status value, or false to not filter on status (default: 'approved')
Результат integer a count of the comments from the specified IP address

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

returns the number of comments attributed to the specified name
public static count_by_name ( string $name = '', integer | string $status = 'approved' ) : integer
$name string a commenter's name
$status integer | string A comment status value, or false to not filter on status (default: 'approved')
Результат integer a count of the comments from the specified name

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

returns the number of comments attached to the specified post
public static count_by_slug ( string $slug = '', integer | string $status = 'approved' ) : integer
$slug string a post slug
$status integer | string A comment status value, or false to not filter on status (default: 'approved')
Результат integer a count of the comments attached to the specified post

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

returns the number of comments attributed to the specified URL
public static count_by_url ( string $url = '', integer | string $status = 'approved' ) : integer
$url string a URL
$status integer | string a comment status value, or false to not filter on status (default: 'approved')
Результат integer a count of the comments from the specified URL

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

returns the number of comments based on the specified status and type
public static count_total ( integer | string $status = 'approved', integer | string $type = 'comment' ) : integer
$status integer | string A comment status value, or false to not filter on status (default: 'approved')
$type integer | string A comment type value, or false to not filter on type (default: 'comment')
Результат integer a count of the comments based on the specified status and type

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

function delete Deletes all comments in this object
public delete ( )

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

delete all the comments and commentinfo for comments with this status
public static delete_by_status ( integer | string $status )
$status integer | string a comment status ID or name

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

Deletes comments from the database
public static delete_these ( $comments ) : boolean
Результат boolean True on success, false on failure

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

Filter Comments using a callback function
public filter ( Callable | array $filter ) : Comments
$filter Callable | array A callback function that returns true if the item passed in should be kept
Результат Comments The filtered comments

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

function get Returns requested comments
public static get ( array $paramarray = [] ) : array
$paramarray array An associated array of parameters, or a querystring
Результат array An array of Comment objects, one for each query result $comments = comments::get( array ( "author" => "skippy" ) ); $comments = comments::get( array ( "slug" => "first-post", "status" => "1", "orderby" => "date ASC" ) );

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

Changes the status of comments
public static moderate_these ( array | Comments $comments, integer | string $status = null ) : boolean
$comments array | Comments Comments to be moderated
$status integer | string The new status for the provided array of comments, "unapproved" if not provided
Результат boolean True if all the comments were successfully changed

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

Returns all of the comments from the current Comments object having the specified index for the specified field $tb = $comments->only( 'trackbacks' )
public only ( string $field, mixed $index ) : array
$field string The field on the comment that is being filtered
$index mixed The value of the field that qualifies a comment
Результат array an array of Comment objects of the specified type

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

Parses a search string for status, type, author, and tag keywords. Returns an associative array which can be passed to Comments::get(). If multiple authors, statuses, or types are specified, we assume an implicit OR such that (e.g.) any author that matches would be returned.
public static search_to_get ( string $search_string ) : array
$search_string string The search string
Результат array An associative array which can be passed to Comments::get()