PHP Class WPKB\Rating\Admin

Show file Open project: ibericode/wp-knowledge-base

Protected Properties

Property Type Description
$rating Rater

Public Methods

Method Description
__construct ( Rater $rating ) Admin constructor.
add_hooks ( ) Add hooks
add_meta_box ( ) Adds a box to the main column on the Post and Page edit screens.
column_content ( $column_name, $post_id ) Output the rating percentage in the column
column_header ( $defaults ) : mixed Add our rating column
comments_column_content ( $column, $comment_ID )
comments_column_header ( $columns )
dashboard_widget ( ) Dashboard widget showing the 5 most recent ratings
listen ( ) : boolean
register_dashboard_widget ( ) Registers the dashboard widget
show_meta_box ( WP_Post $post )
sortable_columns ( $columns ) : mixed Add our rating column to the array of sortable columns
sortable_orderby ( $query ) Tell WordPress how to order our rating column

Protected Methods

Method Description
percent2Color ( $value, integer $brightness = 255, integer $max = 100, integer $min, string $thirdColorHex = '00' ) : string Returns a HEX color from a percentage (red to green)

Method Details

__construct() public method

Admin constructor.
public __construct ( Rater $rating )
$rating Rater

add_hooks() public method

Add hooks
public add_hooks ( )

add_meta_box() public method

Adds a box to the main column on the Post and Page edit screens.
public add_meta_box ( )

column_content() public method

Output the rating percentage in the column
public column_content ( $column_name, $post_id )
$column_name
$post_id

column_header() public method

Add our rating column
public column_header ( $defaults ) : mixed
$defaults
return mixed

comments_column_content() public method

public comments_column_content ( $column, $comment_ID )

comments_column_header() public method

public comments_column_header ( $columns )

dashboard_widget() public method

Dashboard widget showing the 5 most recent ratings
public dashboard_widget ( )

listen() public method

public listen ( ) : boolean
return boolean

percent2Color() protected method

Returns a HEX color from a percentage (red to green)
protected percent2Color ( $value, integer $brightness = 255, integer $max = 100, integer $min, string $thirdColorHex = '00' ) : string
$value
$brightness integer
$max integer
$min integer
$thirdColorHex string
return string

register_dashboard_widget() public method

Registers the dashboard widget

show_meta_box() public method

public show_meta_box ( WP_Post $post )
$post WP_Post

sortable_columns() public method

Add our rating column to the array of sortable columns
public sortable_columns ( $columns ) : mixed
$columns
return mixed

sortable_orderby() public method

Tell WordPress how to order our rating column
public sortable_orderby ( $query )
$query

Property Details

$rating protected property

protected Rater,WPKB\Rating $rating
return Rater