Plugin Directory

Changeset 665820


Ignore:
Timestamp:
02/10/2013 05:52:10 AM (13 years ago)
Author:
FoxyTechnology
Message:

version 1.3

Location:
rich-reviews
Files:
5 added
3 edited

Legend:

Unmodified
Added
Removed
  • rich-reviews/trunk/readme.txt

    r662960 r665820  
    55Requires at least: 3.4
    66Tested up to: 3.5
    7 Stable tag: 1.2
     7Stable tag: 1.3
    88License: GPLv2 or later
    99License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    1313== Description ==
    1414
    15 Rich Reviews empowers you to easily capture user reviews and display them on your wordpress page or post and in Google Search Results as a Google Rich Snippet.
     15Rich Reviews empowers you to easily capture user reviews for your business, website, or individual products/pages and display them on your Wordpress page or post and in Google Search Results as a Google Rich Snippet.
    1616
    1717With Google Places, Google Plus and Google Local emphasizing the importance of Testimonials.  Reviews are becoming integral for the success of any product or service online.
    1818
    19 <h4>Rich Snippet Features:</h4>
     19<h4>Rich Reviews Features:</h4>
    2020
     21* Three types of reviews: per-page/per-post, category, or global reviews allow you to customize to your needs. Whether you want users to review products, categories, or your entire website - Rich Reviews gives you the control.
    2122* Moderated submissions, allowing you to choose which reviews are added to your site.
    2223* Built completely around shortcodes, allowing you to include any of the three key features on any page, post, sidebar, footer, or widget on your site.
     
    38391. You can download and install the Rich Reviews plugin through the built-in Wordpress plugin installer. Alternately, download the zip file and upload the '/rich-reviews/' folder to your '../wp-content/plugins/' folder.
    39402. Activate the plugin through the 'Plugins' menu in WordPress
    40 3. Use the shortcodes [RICH_REVIEWS_FORM], [RICH_REVIEWS_SHOW], [RICH_REVIEWS_SHOW_ALL], and [RICH_REVIEWS_SNIPPET] as described in the Rich Reviews settings page within a page, a post, or a widget area.
     413. View the instructions page in your the Wordpress backend to see detailed explanations and examples of how and where to use the shortcodes which enable reviews to be shown, submitted, or averaged.
    41424. Periodically check the Rich Reviews menu in the Wordpress control panel to see if there are any pending reviews which need to be approved (or deleted).
    4243
    4344== Screenshots ==
    4445
    45 1. Show some or all of the reviews that you have approved to be shown on your site.
    46 2. A simple review submission form can be placed anywhere on your site, and will not be displayed publicly until YOU give it the okay. An admin menu lets you choose which reviews are real and which are spam.
    47 3. A simple shortcode allows you to post an aggregate review score on any page, which means that Google will display a star-rating whenever your page comes up in a search.
    48 
     461. Show any number of reviews for your whole site, for a specific page or post, or for any custom category. Display these reviews in any post, page, sidebar, or widget!
     472. A simple shortcode allows you to post an aggregate review score on any page, which means that Google will display a star-rating whenever your page comes up in a search.
     483. A simple and clean review submission form can be placed anywhere on your site, and will not bog down your site.
     494. Admin menus allow you to approve the submitted reviews, so YOU control what reviews are real, and which reviews are unwarranted (or even spam). You can also view every review you have already approved, and choose to push it back to a "pending" status, or even delete it.
     505. Detailed explanations and examples ensure that you will never be confused as to how to use the plugin!
    4951
    5052== Changelog ==
     53
     54= 1.3 =
     55* Added the much-requested feature of per-page/per-product reviews, as well as adding optional review categories to go along with it
     56* Revamped the backend instructions page to be more pretty and to be much more informative, and to give detailed examples and explanations for each shortcode
     57* Cleaned up the CSS pretty much everywhere
     58* The stars in ratings are now orange/yellow when reviews are displayed
    5159
    5260= 1.2 =
     
    6573== Upgrade Notice ==
    6674
     75= 1.3 =
     76This adds the MUCH requested feature of having per-page/per-product reviews, as well as adding optional categories for further customization! The instructions page has also been overhauled to provide useful, relevant explanations and examples for each of the shortcodes.
     77
    6778= 1.2 =
    6879This version is essential, as it fixes a bug where the MySQL database was not created unless the plugin had been installed at version 1.0
  • rich-reviews/trunk/rich-reviews.css

    r661474 r665820  
    111111.rr_small_input {
    112112    width: 250px;
    113     height: 1.1em;
    114113    margin-bottom: 9px;
    115114}
     
    135134    margin-bottom: 5%;
    136135    line-height: 1em !important;
     136    color: #ffaf00;
    137137}
    138138.rr_review_name {
     
    161161    font-size: 150%;
    162162}
     163
     164.rr_shortcode_container {
     165    background-color: #e0e0e0;
     166    color: #000000;
     167    padding: 20px;
     168    border-radius: 15px;
     169    margin-bottom: 10px;
     170}
     171.rr_shortcode_name {
     172    font-weight: 900;
     173    font-size: 130%;
     174    padding-bottom: 2px;
     175}
     176.rr_shortcode_description {
     177    margin-left: 2%;
     178}
     179.rr_shortcode_option_container {
     180    margin-left: 3%;
     181    margin-top: 5px;
     182}
     183.rr_shortcode_option_name {
     184    font-size: 110%;
     185    font-style: italic;
     186    font-weight: 600;
     187}
     188.rr_shortcode_option_text {
     189    margin-left: 2%;
     190}
     191.rr_admin_sidebar {
     192    float: right;
     193    width: 40%;
     194    min-width: 300px;
     195    background-color: #3d3017;
     196    color: #dadada;
     197    border-radius: 5px;
     198    padding: 10px; /*  top right bottom left */
     199    font-size: 90%;
     200    margin: 7px;
     201}
     202.rr_admin_sidebar_title {
     203    font-size: 130%;
     204    font-weight: 900;
     205    margin-bottom: 4px;
     206    color: white;
     207}
     208.rr_admin_sidebar_text {
     209    margin-bottom: 4px;
     210}
     211ul.rr_admin_sidebar_list {
     212    padding: 0px 0px 0px 20px; /*  top right bottom left */
     213    margin: 0px;
     214    list-style-type: square;
     215    font-family: Consolas, Monaco, monospace;
     216}
     217li.rr_admin_sidebar_list_item {
     218    padding: 0px;
     219    margin: 0px;
     220}
     221table.rr_admin_review_table {
     222    width: 90%;
     223    min-width: 700px;
     224    background-color: #e4e4e4;
     225    border-radius: 7px;
     226}
     227tr.rr_admin_review_container {
     228    background-color: #f1f1f1;
     229}
     230
     231td.rr_admin_review_actions_container {
     232    width: 13%;
     233    max-width: 91px;
     234    font-size: 80%;
     235    vertical-align: text-top;
     236}
     237td.rr_admin_review_info_container {
     238    width: 25%;
     239    vertical-align: text-top;
     240    padding: 0px;
     241}
     242td.rr_admin_review_content_container {
     243    width: 60%;
     244    vertical-align: text-top;
     245    padding: 0px;
     246}
     247
     248.rr_admin_review_action {
     249   
     250}
     251.rr_admin_review_stars {
     252    color: #ffaf00;
     253}
  • rich-reviews/trunk/rich-reviews.php

    r662963 r665820  
    44Plugin URI: http://www.foxytechnology.com/rich-reviews-wordpress-plugin/
    55Description: Rich Reviews empowers you to easily capture user reviews and display them on your wordpress page or post and in Google Search Results as a Google Rich Snippet.
    6 Version: 1.2
     6Version: 1.3
    77Author: Foxy Technology
    88Author URI: http://www.foxytechnology.com
     
    4949        global $wpdb;
    5050        $tableSearch = $wpdb->get_var("SHOW TABLES LIKE '$this->sqltable'");
    51         if ($tableSearch != $this->sqltable) { // ...then this is the first installation
     51        if ($tableSearch != $this->sqltable) {
    5252            $this->fp_update_database();
    5353        }
     
    7474        add_submenu_page(
    7575            'rich_reviews_settings_main', // ID of menu with which to register this submenu
    76             'Rich Reviews - Settings', //text to display in browser when selected
     76            'Rich Reviews - Instructions', //text to display in browser when selected
    7777            'Instructions', // the text for this item
    7878            'administrator', // which type of users can see this menu
     
    8181        );
    8282        add_submenu_page(
    83             'rich_reviews_settings_main', // ID of menu with which to register this submenu
    84             'Rich Reviews - Pending Reviews', //text to display in browser when selected
    85             'Pending Reviews' . $pendingReviewsText, // the text for this item
    86             'administrator', // which type of users can see this menu
    87             'fp_admin_pending_reviews_page', // unique ID (the slug) for this menu item
    88             array(&$this, 'fp_render_pending_reviews_page') // callback function
     83            'rich_reviews_settings_main',
     84            'Rich Reviews - Pending Reviews',
     85            'Pending Reviews' . $pendingReviewsText,
     86            'administrator',
     87            'fp_admin_pending_reviews_page',
     88            array(&$this, 'fp_render_pending_reviews_page')
    8989        );
    9090        add_submenu_page(
    91             'rich_reviews_settings_main', // ID of menu with which to register this submenu
    92             'Rich Reviews - Approved Reviews', //text to display in browser when selected
    93             'Approved Reviews', // the text for this item
    94             'administrator', // which type of users can see this menu
    95             'fp_admin_reviews_page', // unique ID (the slug) for this menu item
    96             array(&$this, 'fp_render_all_reviews_page') // callback function
     91            'rich_reviews_settings_main',
     92            'Rich Reviews - Approved Reviews',
     93            'Approved Reviews',
     94            'administrator',
     95            'fp_admin_approved_reviews_page',
     96            array(&$this, 'fp_render_approved_reviews_page')
    9797        );
    9898    }
     
    109109            $current_version = '1.0';
    110110        }
    111        
    112111        if ($current_version == '1.0') {
    113112            $wpdb->query("ALTER TABLE $this->sqltable CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci");
    114113        }
    115        
     114        if ($current_version < '1.3') {
     115            $this->fp_update_database();
     116            add_action('admin_notices', array(&$this, 'fp_admin_notices'));
     117        }
    116118        if (($newest_version != $current_version) || ($newest_version == '1.0')) {
    117119            update_option($this->fp_admin_options, array('version' => $newest_version));
    118120        }
     121    }
     122   
     123    function fp_admin_notices() {
     124        $options = get_option($this->fp_admin_options);
     125        $current_version = $options['version'];
     126        if ($current_version == '1.3') {
     127            echo '
     128                <div class="updated">
     129                    <span style="float: left; margin-right: 5px; margin-top: 2px;"><img src="' . plugin_dir_url( __FILE__ ) . 'fox_logo_32x32.png" /></span><p>Thank you for installing Rich Reviews version 1.3!</p>
     130                    <p>If you are a new or old user of Rich Reviews, <b style="font-size: 130%">it is highly recommended that you check out the <a href="admin.php?page=rich_reviews_settings_main">instructions page</a></b>. For new users, this will tell you how to use our plugin. For past users, this will give you important information as to how the plugin has changed from previous versions (which is quite a bit!).</p>
     131                    <p>We are very excited, and hope that you enjoy using this plugin as much as we enjoy writing it. If you have any questions, issues, or feature requests, please post them in our <a href="http://wordpress.org/extend/plugins/rich-reviews/">Wordpress support forum</a>. Enjoy!</p>
     132                </div>';
     133        }
     134       
    119135    }
    120136   
     
    136152   
    137153    function fp_add_plugin_settings_link($links) {
    138         $settings_link = '<a href="options-general.php?page=rich_reviews_settings_main">Settings</a>';
     154        $settings_link = '<a href="admin.php?page=rich_reviews_settings_main">Settings</a>';
    139155        array_unshift($links, $settings_link);
    140156        return $links;
     
    154170                 review_status tinyint(1) DEFAULT '0',
    155171                 reviewer_ip varchar(15) DEFAULT NULL,
     172                 post_id int(11) DEFAULT '0',
     173                 review_category varchar(100) DEFAULT 'none',
    156174                PRIMARY KEY (id)
    157175                )
     
    163181    function fp_render_settings_main_page() {
    164182        $output = '';
    165         $output .= '<div class="wrap"><h2><img src="' . plugin_dir_url( __FILE__ ) . 'fox_logo_32x32.png" /> Rich Reviews</h2></div>';
    166         $output .= '<p>Thank you for using Rich Reviews by <a href="http://www.foxytechnology.com">Foxy Technology</a>!</p>
    167                     <p>This plugin is built around shortcodes.
    168                     <br /><b>[RICH_REVIEWS_FORM]</b> will display a form with which your users may submit reviews. These reviews are not accepted automatically, rather the reviews will be sent to this page as a "Pending Review" to await your approval. You will know you have reviews pending because the menu page will have a number next to it.
    169                     <br /><b>[RICH_REVIEWS_SHOW]</b> will show the first three reviews which were submitted to your website. This is meant to be displayed in a horizontal layout.
    170                     <br /><b>[RICH_REVIEWS_SHOW_ALL]</b> will show EVERY review which has been approved. It is recommended that you display this in its own dedicated page, as it will likely take a large amount of room.
    171                     <br /><b>[RICH_REVIEWS_SNIPPET]</b> will display text such as "Overall rating: 4.3 out of 5 based on 10 reviews" in such a way as to show up in a google search, using <a href="http://support.google.com/webmasters/bin/answer.py?hl=en&answer=99170">Google Rich Snippets</a>. This is a separate shortcode so that the rating (and hence the rich snippets) can be placed on many pages, even if the reviews are not also displayed on that page.<br /></p>
    172                     <p>The other two settings pages will allow you view the reviews that have been posted.
    173                     <br /><b>"Pending Reviews"</b> shows any pending reviews which are awaiting your approval or rejection (if there are any, this will show up as a number next to this menu. For example, if you have 2 pending reviews, the menu name in the sidebar will be "Rich Reviews (2)".
    174                     <br /><b>"Approved Reviews"</b> shows all the reviews which you have approved. In this way you can change the status of previously-approved reviews to be either a pending review again, or to delete them entirely.';
     183        $output .= '<div class="wrap">
     184            <h2><img src="' . plugin_dir_url( __FILE__ ) . 'fox_logo_32x32.png" /> Rich Reviews</h2>
     185            </div>
     186            <p>
     187            Thank you for using Rich Reviews by <a href="http://www.foxytechnology.com">Foxy Technology</a>!
     188            </p>
     189           
     190            <span class="rr_admin_sidebar">
     191            <div class="rr_admin_sidebar_title">Shortcode Cheat Sheet</div>
     192            <div class="rr_admin_sidebar_text">Make sure you read the detailed descriptions of how these work below, in <span style="font-weight: 600;">Shortcode Usage</span>!</div>
     193            <ul class="rr_admin_sidebar_list">
     194            <li class="rr_admin_sidebar_list_item">[RICH_REVIEWS_SHOW]</li>
     195            <li class="rr_admin_sidebar_list_item">[RICH_REVIEWS_SHOW num="9"]</li>
     196            <li class="rr_admin_sidebar_list_item">[RICH_REVIEWS_SHOW num="all"]</li>
     197            <li class="rr_admin_sidebar_list_item">[RICH_REVIEWS_SHOW category="foo"]</li>
     198            <li class="rr_admin_sidebar_list_item" style="margin: 0px 0px 4px 0px;">[RICH_REVIEWS_SHOW category="page" num="5"]</li>
     199            <li class="rr_admin_sidebar_list_item">[RICH_REVIEWS_FORM]</li>
     200            <li class="rr_admin_sidebar_list_item" style="margin: 0px 0px 4px 0px;">[RICH_REVIEWS_FORM category="foo"]</li>
     201            <li class="rr_admin_sidebar_list_item">[RICH_REVIEWS_SNIPPET]</li>
     202            <li class="rr_admin_sidebar_list_item">[RICH_REVIEWS_SNIPPET category="foo"]</li>
     203            </ul>
     204            </span>';
     205        $output .= '<p>
     206            This plugin is based around shortcodes. We think that this is the best way to go, as then YOU control where reviews, forms, and snippets are shown - pages, posts, widgets... wherever!
     207            </p>
     208            <p>
     209            There has been a major overhaul in functionality for this plugin! So if you are a past user, make sure you review the following - if you are a new user - welcome! If you require any assistance, have any questions, have any feature requests, or find any bugs, please post them in the <a href="http://wordpress.org/support/plugin/rich-reviews">Wordpress support forum for this plugin</a>!
     210            </p>
     211            <p style="font-size: 70%">
     212            A note about backwards compatibility: If you have been using this plugin since before version 1.3 (when per-page reviews were implemented) then the reviews which were already submitted will have a default category of "none", and will not be attached to any particular page or post. They will still show up in the global reviews, however. Also, I have taken great pains to ensure that all the "old" shortcodes will work in exactly the same way - so even though [RICH_REVIEWS_SHOW_ALL] is now outdated, I have retained its functionality so that your site won\'t break!
     213            </p>
     214            <p style="font-size: 120%">
     215            Please take a moment to <a href="http://wordpress.org/extend/plugins/rich-reviews/">rate and/or review</a> this plugin, and tell people about it - we love hearing feedback, and depend on you to spread the word!
     216            </p>';
     217        $output .= '<p>
     218            Some terminology so that\'s we are all on the same page (no pun intended):
     219            <ul style="margin-top: -0.75em;">
     220            <li>A <b>global review</b> is a review which applies or belongs to the entire Wordpress site, regardless of the current page or post. You might use global reviews if your users are submitting reviews for a business or entire website.</li>
     221            <li>A <b>per-page review</b> is a review which applies to some specific page or post. You might use per-page reviews if, for example, your Wordpress site has various products with a dedicated page or post for each one. Note that reviews users submit will <i>always</i> record the post from which they were submitted, even if you will end up using global reviews! This is to simplify things, so that we don\'t have a bunch of different, confusing shortcodes.</li>
     222            </ul>
     223            </p>
     224            <hr />
     225            <h2>Shortcode Usage</h2>
     226            <div class="rr_shortcode_container">
     227                <div class="rr_shortcode_name">[RICH_REVIEWS_SHOW]</div>
     228                <div class="rr_shortcode_description">
     229                    This is the main shortcode for this plugin. By default (if no options are given), it will show the first three global reviews which have been approved. Note that this shortcode on its own will NOT display an average/overall score nor any rich snippet markup. See the "snippet" shortcode for that. Here is the shortcode with all possible options, along with their defaults: [RICH_REVIEWS_SHOW category="none" num="3"]. We will now show some examples of using these options.
     230                </div>
     231                <div class="rr_shortcode_option_container">
     232                    <div class="rr_shortcode_option_name">[RICH_REVIEWS_SHOW num="8"]</div>
     233                    <div class="rr_shortcode_option_text">
     234                        This will show the first eight approved global reviews. Any integer greater than or equal to one may be used, and note that (given enough room) reviews are displayed in blocks of three.
     235                    </div>
     236                </div>
     237                <div class="rr_shortcode_option_container">
     238                    <div class="rr_shortcode_option_name">[RICH_REVIEWS_SHOW num="all"]</div>
     239                    <div class="rr_shortcode_option_text">
     240                        This will show EVERY approved global review which has been posted to your site. This is the only non-integer value which works as the value for the "num" option.
     241                    </div>
     242                </div>';
     243        $output .= '<div class="rr_shortcode_option_container">
     244                    <div class="rr_shortcode_option_name">[RICH_REVIEWS_SHOW category="page"]</div>
     245                    <div class="rr_shortcode_option_text">
     246                        This will show the first three approved reviews for the page or post on which this shortcode appears. You can also use category="post" and achieve the same results (because sometimes you just can\'t remember if you\'re supposed to say post or page! :-) )
     247                    </div>
     248                </div>
     249                <div class="rr_shortcode_option_container">
     250                    <div class="rr_shortcode_option_name">[RICH_REVIEWS_SHOW category="foo"]</div>
     251                    <div class="rr_shortcode_option_text">
     252                        This will show the first three approved reviews which have the category "foo" (you might also use categories of "games" or "iPhone" or "bears" (although everyone knows that the best kind of bear is grizzly) ). The categories here are determined by the categories you specify when presenting the review form to your users.
     253                    </div>
     254                </div>
     255                <div class="rr_shortcode_option_container">
     256                    <div class="rr_shortcode_option_name">[RICH_REVIEWS_SHOW category="bar" num="6"]</div>
     257                    <div class="rr_shortcode_option_text">
     258                        This will show the first six approved reviews which have the category "bar". Again, you may use any category, and if you specify that category="page" then the first six approved reviews for that particular page/post will be displayed.
     259                    </div>
     260                </div>
     261            </div>';
     262        $output .= '<div class="rr_shortcode_container">
     263                <div class="rr_shortcode_name">[RICH_REVIEWS_FORM]</div>
     264                <div class="rr_shortcode_description">
     265                    This shortcode will insert the form which your users fill out to submit their reviews to you. Note that javascript must be enabled (on both your site and on the user\'s computer) in order for this to work. There is one option, shown here with its default: [RICH_REVIEWS_FORM category="none"]. You do NOT need to specify a category of "page" if you want to use per-page reviews. By default, ALL reviews that users submit will record the page or post from which they were submitted.
     266                </div>
     267                <div class="rr_shortcode_option_container">
     268                    <div class="rr_shortcode_option_name">[RICH_REVIEWS_FORM category="foo"]</div>
     269                    <div class="rr_shortcode_option_text">
     270                        This will create a form for users to submit reviews under the category of "foo". Users will not notice a difference, and the form itself does not change based on the category. Again note that if you wish to have per-page reviews, you do NOT need to specify a category of "page" as you do with the review showing shortcode.
     271                    </div>
     272                </div>
     273            </div>';
     274        $output .= '<div class="rr_shortcode_container">
     275                <div class="rr_shortcode_name">[RICH_REVIEWS_SNIPPET]</div>
     276                <div class="rr_shortcode_description">
     277                    This shortcode will insert an aggregate (average) score based on all approved reviews. By default, this aggregate score is based on the global reviews (as you might guess, the shortcode with its one option and corresponding default is [RICH_REVIEWS_SNIPPET category="none"]). More importantly for webmasters and those concerned with SEO is that this shortcode tags the aggregate score with Rich Snippet markup so that Google (and other search engines) will see the average score on that page, and display stars next to that page when it shows up in search results.<br />
     278                    This is given as a seperate shortcode, rather than integrated into the "show" shortcode, so that you may place this in, say, your footer and be able to have Rich Snippets on every page and post, without also having reviews taking up space.<br />
     279                    You can test your page <a href="http://www.google.com/webmasters/tools/richsnippets">here</a>. Note that Google is vague with exactly how exactly they give search results. It might take some time for the stars to show up next to your page, and it might only show up with specific search terms. The best thing you can do is make sure that the Rich Snippets tool, above, recognizes the star rating on your page, and be patient. We are constantly working to make sure we keep up with Google to ensure these ratings are displayed.
     280                </div>
     281                <div class="rr_shortcode_option_container">
     282                    <div class="rr_shortcode_option_name">[RICH_REVIEWS_FORM category="foo"]</div>
     283                    <div class="rr_shortcode_option_text">
     284                        This will display the aggregate (average) score, along with the Rich Snippet markup, for all approved reviews with the category "foo".
     285                    </div>
     286                </div>
     287                <div class="rr_shortcode_option_container">
     288                    <div class="rr_shortcode_option_name">[RICH_REVIEWS_FORM category="page"]</div>
     289                    <div class="rr_shortcode_option_text">
     290                        This will display the aggregate (average) score, along with the Rich Snippet markup, for all approved reviews for the current page/post (again, you may equivalently use category="post").
     291                    </div>
     292                </div>
     293            </div>
     294';
    175295        echo $output;
    176296    }
     
    211331                    review_text as `reviewtext`,
    212332                    review_status as `reviewstatus`,
    213                     reviewer_ip as `reviewerip` FROM $this->sqltable WHERE review_status=\"0\"";
     333                    reviewer_ip as `reviewerip`,
     334                    post_id as `postid`,
     335                    review_category as `reviewcategory` FROM $this->sqltable WHERE review_status=\"0\"";
    214336            $pendingReviews = $wpdb->get_results($sql, ARRAY_A);
    215337           
    216338            $output .= '<form method="post" action="">
    217                   <input type="hidden" name="submitted" value="Y" />
    218                   <table><tbody><tr><th></th>
    219                   <th style="text-align: left">Reviewer</th>
    220                   <th style="text-align: left">Review Content</th></tr>';
     339                    <input type="hidden" name="submitted" value="Y" />
     340                   
     341                    <div class="rr_admin_review_table">
     342                    <table class="rr_admin_review_table">
     343                        <tr class="rr_admin_review_container">
     344                            <td colspan="3"><input name="submitButton" type="submit" value="Submit Changes" /></td>
     345                        </tr>
     346                        <tr class="rr_admin_review_container">
     347                            <td class="rr_admin_review_actions_container"></td>
     348                            <td class="rr_admin_review_info_container"><b>Reviewer</b></td>
     349                            <td class="rr_admin_review_content_container"><b>Review Content</b></td>
     350                        </tr>';
    221351            foreach($pendingReviews as $result) {
    222352                $output .= $this->fp_display_admin_review($result);
    223353            }
    224             $output .= '<tr><td></td><td colspan="2"><input name="submitButton" type="submit" value="Submit Changes" /></td></tr></tbody></table></form>';
     354            $output .= '<tr class="rr_admin_review_container">
     355                        <td colspan="3"><input name="submitButton" type="submit" value="Submit Changes" /></td>
     356                    </tr>
     357                    </table>
     358                    </form>';
    225359        }
    226360        echo $output;
    227361    }
    228362   
    229     function fp_render_all_reviews_page() {
     363    function fp_render_approved_reviews_page() {
    230364        global $wpdb;
    231365        $output = '';
     
    262396                    review_text as `reviewtext`,
    263397                    review_status as `reviewstatus`,
    264                     reviewer_ip as `reviewerip` FROM $this->sqltable WHERE review_status=\"1\"";
     398                    reviewer_ip as `reviewerip`,
     399                    post_id as `postid`,
     400                    review_category as `reviewcategory` FROM $this->sqltable WHERE review_status=\"1\"";
    265401            $approvedReviews = $wpdb->get_results($sql, ARRAY_A);
    266402            $output .= '<form method="post" action="">
    267                         <input type="hidden" name="submitted" value="Y" />
    268                         <table><tbody><tr><th></th>
    269                         <th style="text-align: left">Reviewer</th>
    270                         <th style="text-align: left">Review Content</th></tr>';
    271             foreach ($approvedReviews as $result) {
    272                 $output .= $this->fp_display_admin_review($result, 'approve');
    273             }
    274             $output .= '<tr><td></td><td colspan="2"><input name="submitButton" type="submit" value="Submit Changes" /></td></tr></tbody></table></form>';
     403                    <input type="hidden" name="submitted" value="Y" />
     404                   
     405                    <div class="rr_admin_review_table">
     406                    <table class="rr_admin_review_table">
     407                        <tr class="rr_admin_review_container">
     408                            <td colspan="3"><input name="submitButton" type="submit" value="Submit Changes" /></td>
     409                        </tr>
     410                        <tr class="rr_admin_review_container">
     411                            <td class="rr_admin_review_actions_container"></td>
     412                            <td class="rr_admin_review_info_container"><b>Reviewer</b></td>
     413                            <td class="rr_admin_review_content_container"><b>Review Content</b></td>
     414                        </tr>';
     415            foreach($approvedReviews as $result) {
     416                $output .= $this->fp_display_admin_review($result, $result['reviewstatus']);
     417            }
     418            $output .= '<tr class="rr_admin_review_container">
     419                        <td colspan="3"><input name="submitButton" type="submit" value="Submit Changes" /></td>
     420                    </tr>
     421                    </table>
     422                    </form>';
    275423        }
    276424        echo $output;
     
    300448    }
    301449   
    302     function fp_shortcode_reviews_form() {
     450    function fp_star_rating_input() {
     451        $output = '
     452            <span onmouseover="this.style.cursor=\'default\';">
     453              <span id="s1" onclick="starSelection(this.id);"onmouseout="outStar(this.id);"onmouseover="overStar(this.id);">&#9734</span>
     454              <span id="s2" onclick="starSelection(this.id);"onmouseout="outStar(this.id);"onmouseover="overStar(this.id);">&#9734</span>
     455              <span id="s3" onclick="starSelection(this.id);"onmouseout="outStar(this.id);"onmouseover="overStar(this.id);">&#9734</span>
     456              <span id="s4" onclick="starSelection(this.id);"onmouseout="outStar(this.id);"onmouseover="overStar(this.id);">&#9734</span>
     457              <span id="s5" onclick="starSelection(this.id);"onmouseout="outStar(this.id);"onmouseover="overStar(this.id);">&#9734</span>
     458            </span>';
     459        return $output;
     460    }
     461   
     462    function fp_shortcode_reviews_form($atts) {
    303463        global $wpdb;
    304464        global $post;
     465        extract(shortcode_atts(
     466            array(
     467                'category' => 'none',
     468            )
     469        ,$atts));
    305470        $output = '';
    306471        $rName  = '';
     
    312477            if ($_POST['submitted'] == 'Y') {
    313478                $rDateTime = date('Y-m-d H:i:s');
    314                 $rName =   $this->fp_sanitize($_POST['rName']);
    315                 $rEmail =  $this->fp_sanitize($_POST['rEmail']);
    316                 $rTitle =  $this->fp_sanitize($_POST['rTitle']);
    317                 $rRating = $this->fp_sanitize($_POST['rRating']);
    318                 $rText =   $this->fp_sanitize($_POST['rText']);
    319                 $rStatus = 0;
    320                 $rIP = $_SERVER['REMOTE_ADDR'];
     479                $rName     = $this->fp_sanitize($_POST['rName']);
     480                $rEmail    = $this->fp_sanitize($_POST['rEmail']);
     481                $rTitle    = $this->fp_sanitize($_POST['rTitle']);
     482                $rRating   = $this->fp_sanitize($_POST['rRating']);
     483                $rText     = $this->fp_sanitize($_POST['rText']);
     484                $rStatus   = 0;
     485                $rIP       = $_SERVER['REMOTE_ADDR'];
     486                $rPostID   = $post->ID;
     487                $rCategory = $this->fp_sanitize($category);
    321488               
    322489                $newdata = array(
     
    328495                        'review_text'     => $rText,
    329496                        'review_status'   => $rStatus,
    330                         'reviewer_ip'     => $rIP
     497                        'reviewer_ip'     => $rIP,
     498                        'post_id'         => $rPostID,
     499                        'review_category' => $rCategory
    331500                );
    332501                $validData = true;
     
    389558    }
    390559   
    391     function fp_star_rating_input() {
    392         $output = '
    393             <span onmouseover="this.style.cursor=\'default\';">
    394               <span id="s1" onclick="starSelection(this.id);"onmouseout="outStar(this.id);"onmouseover="overStar(this.id);">&#9734</span>
    395               <span id="s2" onclick="starSelection(this.id);"onmouseout="outStar(this.id);"onmouseover="overStar(this.id);">&#9734</span>
    396               <span id="s3" onclick="starSelection(this.id);"onmouseout="outStar(this.id);"onmouseover="overStar(this.id);">&#9734</span>
    397               <span id="s4" onclick="starSelection(this.id);"onmouseout="outStar(this.id);"onmouseover="overStar(this.id);">&#9734</span>
    398               <span id="s5" onclick="starSelection(this.id);"onmouseout="outStar(this.id);"onmouseover="overStar(this.id);">&#9734</span>
    399             </span>';
    400         return $output;
    401     }
    402    
    403     function fp_shortcode_reviews_show() {
    404         global $wpdb;
     560    function fp_shortcode_reviews_show($atts) {
     561        global $wpdb;
     562        global $post;
    405563        $output = '';
    406         $approvedReviewsCount = $wpdb->get_var("SELECT COUNT(*) FROM $this->sqltable WHERE review_status=\"1\"");
     564        extract(shortcode_atts(
     565            array(
     566                'category' => 'none',
     567                'num' => '3',
     568            )
     569        ,$atts));
     570        if ($category == 'none') {
     571            $whereStatement = "WHERE review_status=\"1\"";
     572        } else if(($category == 'post') || ($category == 'page')) {
     573            $whereStatement = "WHERE (review_status=\"1\" and post_id=\"$post->ID\")";
     574        } else {
     575            $whereStatement = "WHERE (review_status=\"1\" and review_category=\"$category\")";
     576        }
     577        if ($num == 'all') {
     578            $limitStatement = "";
     579        } else {
     580            $num = intval($num);
     581            if($num < 1) {
     582                $num = 1;
     583            }
     584            $limitStatement = "LIMIT $num";
     585        }
     586        $approvedReviewsCount = $wpdb->get_var("SELECT COUNT(*) FROM $this->sqltable " . $whereStatement);
    407587        if($approvedReviewsCount != 0){
    408588            $sql = "SELECT id as `idid`,
     
    414594                    review_text as `reviewtext`,
    415595                    review_status as `reviewstatus`,
    416                     reviewer_ip as `reviewerip` FROM $this->sqltable WHERE review_status=\"1\" LIMIT 3";
     596                    reviewer_ip as `reviewerip` FROM $this->sqltable " . $whereStatement . " " . $limitStatement;
    417597            $results = $wpdb->get_results($sql, ARRAY_A);
     598            $ii = 0;
    418599            $output .= '<div class="testimonial_group">';
    419600            foreach($results as $result) {
    420601                $output .= $this->fp_display_review($result);
     602                $ii += 1;
     603                if (($ii % 3) == 0) {
     604                    $output .= '</div><div class="clear"></div><div class="testimonial_group">';
     605                }
    421606            }
    422607            $output .= '</div><div class="clear"></div>';
    423608        }
    424        
    425609        return $output;
    426610    }
     
    455639    }
    456640   
    457     function fp_shortcode_reviews_snippets() {
    458         global $wpdb;
    459         $approvedReviewsCount = $wpdb->get_var("SELECT COUNT(*) FROM $this->sqltable WHERE review_status=\"1\"");
     641    function fp_shortcode_reviews_snippets($atts) {
     642        global $wpdb;
     643        global $post;
     644        $output = '';
     645        extract(shortcode_atts(
     646            array(
     647                'category' => 'none',
     648            )
     649        ,$atts));
     650        if ($category == 'none') {
     651            $whereStatement = "WHERE review_status=\"1\"";
     652        } else if(($category == 'post') || ($category == 'page')) {
     653            $whereStatement = "WHERE (review_status=\"1\" and post_id=\"$post->ID\")";
     654        } else {
     655            $whereStatement = "WHERE (review_status=\"1\" and review_category=\"$category\")";
     656        }
     657       
     658        $approvedReviewsCount = $wpdb->get_var("SELECT COUNT(*) FROM $this->sqltable " . $whereStatement);
    460659        $averageRating = 0;
    461660        if ($approvedReviewsCount != 0) {
    462             $averageRating = $wpdb->get_var("SELECT AVG(review_rating) FROM $this->sqltable WHERE review_status=\"1\"");
     661            $averageRating = $wpdb->get_var("SELECT AVG(review_rating) FROM $this->sqltable " . $whereStatement);
    463662            $averageRating = floor(10*floatval($averageRating))/10;
    464663        }
    465664
    466         $output = '<div class="hreview-aggregate">Overall rating: <span class="rating">' . $averageRating . '</span> out of 5 based on <span class="count">' . $approvedReviewsCount . '</span> reviews</div>';
     665        $output = '<div class="hreview-aggregate">Overall rating: <span class="rating">' . $averageRating . '</span> out of 5 based on <span class="votes">' . $approvedReviewsCount . '</span> reviews</div>';
    467666        return $output;
    468667    }
     
    478677        $rStatus    = $review['reviewstatus'];
    479678        $rIP        = $review['reviewerip'];
     679        $rPostID    = $review['postid'];
     680        $rCategory  = $review['reviewcategory'];
    480681        $rRating = '';
    481682        for ($i=1; $i<=$rRatingVal; $i++) {
     
    499700                break;
    500701        }
    501         $output = '<tr class="rr_admin_review"><td class="rr_action">
    502                    <input class="radio" type="radio" name="updateStatus_' . $rID . '" value="approve"' . $approveChecked . '/> Approve<br />
    503                    <input class="radio" type="radio" name="updateStatus_' . $rID . '" value="limbo"' . $limboChecked . '/> Pending<br />
    504                    <input class="radio" type="radio" name="updateStatus_' . $rID . '" value="delete"' . $deleteChecked . '/> Delete</td>
    505                    <td class="rr_reviewer"><b>' . $rName . '</b><br />' . $rEmail . '<br />' . $rIP . '<br /></td>
    506                    <td class="rr_review_content"><span class="rr_title">' . $rTitle . '</span><br />' . $rRating . '<br /><div class="rr_review_text">' . $rText . '</div></tr>';
     702        $output = '';
     703        $output .= '<tr class="rr_admin_review_container">
     704                <td class="rr_admin_review_actions_container">
     705                    <div class="rr_admin_review_action"><input class="radio" type="radio" name="updateStatus_' . $rID . '" value="approve"' . $approveChecked . '/> Approve</div>
     706                    <div class="rr_admin_review_action"><input class="radio" type="radio" name="updateStatus_' . $rID . '" value="limbo"' . $limboChecked . '/> Pending</div>
     707                    <div class="rr_admin_review_action"><input class="radio" type="radio" name="updateStatus_' . $rID . '" value="delete"' . $deleteChecked . '/> Delete</div>
     708                </td>
     709                <td class="rr_admin_review_info_container">
     710                    <div class="rr_reviewer">' . $rName . '</div>
     711                    <div>' . $rEmail . '</div>
     712                    <div>' . $rIP . '</div>
     713                    <div>Category: ' . $rCategory . '</div>
     714                    <div>Page/Post ID: ' . $rPostID . '</div>
     715                </td>
     716                <td class="rr_admin_review_content_container">
     717                    <div class="rr_title">' . $rTitle . '</div>
     718                    <div class="rr_admin_review_stars">' . $rRating . '</div>
     719                    <div class="rr_review_text">' . $rText . '</div>
     720                </td>
     721            </tr>';
    507722        return $output;
    508723    }
     
    520735        $rRating = '';
    521736        for ($i=1; $i<=$rRatingVal; $i++) {
    522             $rRating .= '&#9733'; // black star
     737            $rRating .= '&#9733'; // orange star
    523738        }
    524739        for ($i=$rRatingVal+1; $i<=5; $i++) {
Note: See TracChangeset for help on using the changeset viewer.