"A programmer's delight."

API Documentation

Plugin Function Reference

Many of these functions are dependent on being within a post/page. This page is only relevant to PHP developers / WordPress themers, for everyone else, automatic embedding and within admin. area customization will allow you to control the appearance of your site.

  • float — the weighted rating from 0 to 1
    myrp_api6_get_rating( $post_id = null, $editors = null, $users = true, $ratingcategory = null, $allow_zeros = null)

    Returns the rating as a weighted value from 0 to 1. If the post_id isn't specified, AND you're in the loop, you'll get the ratings for the current post. If any value is null, its value will be loaded from the settings. $editors and $users are boolean flags for whether to include the editor's rating and the user's rating, at least one must be true.

    Simple example usage:
    $rating = myrp_api6_get_rating() * 5;
    echo myrp_api_star_image($rating); // turn the rating in to stars

  • array — the non-editor, per-category ratings.
    myrp_api_ratings( $post_id = null )

    Returns the rating set for a given post. If the post_id isn't specified, AND you're in the loop, you'll get the ratings for the current post. If the rating is not set, the i18n'd string "Not Rated" will be returned.

  • array — the editor, non-average ratings.
    myrp_api_editor_ratings( $post_id = null )

    Returns the editor ratings set for a given post. If the post_id isn't specified, AND you're in the loop, you'll get the ratings for the current post. If the rating is not set, the i18n'd string "Not Rated" will be returned.

  • array — the custom fields, indexed key=>item.
    myrp_api_custom_fields( $post_id = null, $exclude = null, $include = null, $translate = true )

    Returns the custom fields for a given post, translated unless otherwise specified.

  • string — the data or nothing.
    myrp_api_ratings_table( $post_id = null, $return = false )

    Outputs an identical table to the autoembed functions for user ratings.

  • string — the data or nothing.
    myrp_api_editor_ratings_table( $post_id = null, $return = false )

    Outputs an identical table to the autoembed functions for editor's ratings.

  • string — the data or nothing.
    myrp_api_custom_fields_table( $post_id = null, $return = false )

    Outputs an identical table to the autoembed functions for custom fields.

  • string — the data or nothing.
    myrp_api_ratings_nontable( $post_id = null, $return = false )

    Outputs just the average rating with a label. Identical to the autoembed function for nontable embeds.

  • array — array(positive, negative) for the count
    myrp_api_positive_negative( $post_id = null )

    Returns an array of the positive/negative rating values.

  • string — the data or nothing.
    myrp_api_comments_ratings_table( $comment_id = null, $post_id = null, $return = false )

    Outputs an identical table to the autoembed functions for comment ratings, usually used in the comments loop.

  • string — the data or nothing.
    myrp_api_comments_ratings_table_vertical( $comment_id = null, $post_id = null, $return = false )

    Outputs an identical table to the autoembed functions for comment ratings, in vertical orientation, usually used in the comments loop.

  • string — the data or nothing.
    myrp_api_ratings_form_table( $post_id = null, $return = false )

    Outputs the form for ratings, should be included within the comments <form> tag.

  • string — the data or nothing.
    myrp_api_visit_site_url( $post_id = null, $return = false )

    Outputs the visit site link according to the parameters specified.

  • string — the data or nothing.
    myrp_api_visit_site_link( $post_id = null, $text = null, $image_set = null, $return = false )

    Outputs the visit site link according to the parameters specified.

  • string — the data or nothing.
    myrp_api_post_icon( $post_id = null, $return = false )

    Outputs the post icon for the given post according to the parameters specified.

  • string — the data or nothing.
    myrp_api_comparison_table( $category = null, $number = null, $visit_text = "Visit Text", $image_set = null, $custom_fields = null, $rating_categories = null, $return = false )

    Outputs the comparison table as given by the parameters or the settings in the admin area.

  • string — the data or nothing
    myrp_api_vertical_comparison_table($category=null, $number=null, $visit_text="Visit Site", $image_set=null, $custom_fields=null, $rating_categories=null, $return = false, $width=null)

    Outputs the vertical compparison table given by the parameters or the settings in the admin area.

  • string — the data or nothing.
    myrp_api_google_map( $post_id = null, $width = null, $height = null, $zoom_level = null, $map_type = null, $address_field = null, $return = false )

    Outputs the standard Google Map as given by the parameters or the settings in the admin area.

  • string — the data or nothing or the i18n string "Not Rated"
    myrp_api_star_image( $rating, $split_level = 2, $htmlname = null, $class = "star", $disabled = true, $big = false )

    Outputs a set of star images with the specified $rating value lit up.

  • int — the rating, returned.
    myrp_api_post_rating( $post_id = null )

    Returns the average of all ratings for that post.

  • string — the question
    myrp_api_helpfulness_question( $message=null, $comment_id=null, $return=false )

    Outputs the helpfulness question ("was this helpful") using the $message or the message specified in the autoembed config.

  • string — the URL
    myrp_api_helpfulness_yes( $comment_id = null )

    Returns the URL to the "yes" function.

  • string — the URL
    myrp_api_helpfulness_no( $comment_id = null )

    Returns the URL to the "no" helpfulness function.

  • string — the result
    myrp_api_helpfulness_outcome( $comment_id = null, $return = false )

    Returns the outcome string as it would have been autoembedded.

  • array — the votes, and score
    myrp_api_helpfulness_outcome_array( $comment_id = null )

    Returns the outcome data (yes votes, no votes and "score") for further processing.

  • array — the top posts ID and average rating
    myrp_api_get_top_posts($rating_category=null, $post_categories=null, $count=5)

    Returns the top posts in by rating category or in post categories (array). Maximum of count returned.

  • int — the average for a given comment field, across the whole site
    myrp_api_average_comment_field($field_id)

    Returns the average of a comment field (number fields only) across the whole site. Takes the field ID.

  • int — the average for a given comment field on a single post
    myrp_api_average_comment_field_by_post($field_id, $post_id)

    Returns the average of a comment field (number fields only) across a single post. Takes the field ID and post ID.

  • array — the ratings on a single post
    myrp_api_ratings_by_comment_id($comment_id=null)

    Returns per-category ratings for a given comment.

  • array — the number of ratings on a single post
    myrp_api_rating_count($post_id=null)

    Returns per-category ratings for a given comment.

  • int — the average rating of single post
    myrp_api_get_raw_average($post_id=null, $scale=5)

    Returns average rating for a given post, scaled. Note: averages don't count pass/fail fields

  • int — the average rating of single post
    myrp_api_get_raw_category_average($post_id=null, $scale=5, $category_id=1)

    Returns a numerical average for the post in a given rating category, with each field scaled to $scale.

  • string — the ranking of single post
    myrp_api_ranking_posts($post_id=null, $mode="average")

    Returns the post ranking graphic identical to the embed.

  • string — the form for comment fields
    myrp_api_comment_field_form_table($post_id=null, $return=false)

    Outputs the form for comment fields, should be included within the comments <form> tag..

  • string — the big map
    myrp_api_big_google_map_arrayposts($array_of_post_ids, $width=null, $height=null, $zoom=null, $mapType=null, $center=null, $return=false)

    Creates a Big Google Map with the $array_of_post_ids array rendered on it. Make sure each post has an associated address field.

  • string — the big map
    myrp_api_big_google_map_allposts($width=null, $height=null, $zoom=null, $mapType=null, $center=null, $posts_limit=null, $return=false)

    Creates a Big Google Map with the top $posts_limit posts (loaded from settings if null) rendered on it. Make sure each post has an associated address field.

  • string — the data table
    myrp_api_data_table($table_name, $post_id=null ,$return=false)

    Renders the data table if available with name (or slug) $table_name for post ID $post_id (if in the loop, $post_id will be loaded automatically).

MyReviewPlugin also includes a compatibility mode API layer for compatibility with themes developed for other review plugins including WP Review Site and WP Review Engine. Furthermore, every single function exposed by MyReviewPlugin can be used within themes, including hundreds of useful auxillary functions and more non-API layer accessor functions. If you need help, we're available 24/7 to help you implement your solution with MyReviewPlugin.