Description: Display the most recent comments or trackbacks with your own formatting in the sidebar. Visit <a href="options-general.php?page=get-recent-comments.php">Options/Recent Comments</a> after activation of the plugin.
*/
if ( function_exists("is_plugin_page") && is_plugin_page() ) {
WordPress offers conversion of emoticons like :-) and :-P to graphics on display. At the moment WordPress is set to: <a href="options-writing.php"><?php if (get_settings('use_smilies')) echo 'convert to graphics'; else echo 'don\'t convert to graphics'; ?></a>.
<label><input type="radio" name="convert_smileys" value="1" <?php if (kjgrc_get_option("misc","convert_smileys") == 1) echo 'checked="checked"' ?>> do it like <?php echo $converter ?>.</label>
<br>
<label><input type="radio" name="convert_smileys" value="0" <?php if (kjgrc_get_option("misc","convert_smileys") == 0) echo 'checked="checked"' ?>> never convert emoticons to graphics (even if <?php echo $converter ?> does it elsewhere).</label>
</td>
</tr>
</table>
</fieldset>
<fieldset class="options">
<legend><?php _e('Cache') ?></legend>
If there are no new comments, the plugin fetches the output from the cache,
instead of querying the database. If you want the plugin to ask the database
every time, a web page is generated, you can disable this feature.
This is an <strong>optional</strong> image that will be displayed if no gravatar is found. Enter the full URL (with http://). If left empty, gravatar.com returns a transparent pixel.</td>
</tr>
<tr>
<th scope="row">Display gravatars up to this rating:</th>
<label><input type="radio" name="exclude_categories_reverse" value="1" <?php if (kjgrc_get_option("misc","exclude_cat_reverse") == 1) echo 'checked="checked"' ?>>Show only comments to articles of the following categories:</label>
<br>
<label><input type="radio" name="exclude_categories_reverse" value="0" <?php if (kjgrc_get_option("misc","exclude_cat_reverse") == 0) echo 'checked="checked"' ?>>Show no comments to articles of the following categories:</label>
<p>
<?php
if ($categories) {
foreach ($categories as $category) {
$checked = '';
if ($exclude_cat && in_array($category->cat_ID,$exclude_cat)) {
<input type="checkbox" name="grc_exclude_blog_owner2_checkbox" id="grc_exclude_blog_owner2_checkbox" <?php if (kjgrc_get_option("grc","exclude_blog_owner2") == 1) echo "checked=\"checked\""; ?>> Also consider usernames and e-mail addresses, to recognize blog authors</label>
</td>
</tr>
<tr>
<td colspan=2>
<label for="grc_show_trackbacks_checkbox">
<input type="checkbox" name="grc_show_trackbacks_checkbox" id="grc_show_trackbacks_checkbox" <?php if (kjgrc_get_option("grc","show_trackbacks") == 1) echo "checked=\"checked\""; ?>> Show Comments and Trackbacks/Pingbacks together</label>
</td>
</tr>
</tr>
<tr>
<td colspan=2>
<label for="grouped_by_post_checkbox">
<input type="checkbox" name="grouped_by_post_checkbox" id="grouped_by_post_checkbox" onclick="toggle_grouped_titles();" <?php if (kjgrc_get_option("grc","grouped_by_post") == 1) echo "checked=\"checked\""; ?>> Group comments by Posting</label>
<input type="checkbox" name="grc_limit_comments_per_post_checkbox" id="grc_limit_comments_per_post_checkbox" onclick="toggle_grouped_titles();" <?php if (kjgrc_get_option("grc","limit_comments_per_post") == 1) echo "checked=\"checked\""; ?>> Limit number of comments per post: <!-- aka de klein limit --></label> <input type="text" name="grc_comments_per_post" size=3 value="<?php echo kjgrc_get_option("grc","comments_per_post");?>"><br /><br />
<textarea name="grouped_by_post_a" cols="60" rows="2" id="grouped_by_post_a" style="width: 98%; font-size: 12px;" class="code"><?php echo stripslashes(htmlspecialchars(kjgrc_get_option("grc","grouped_by_post_a"))); ?></textarea><br /><span style="font-size: 10px;"><strong>Template for the post</strong>. It should start with <li> and end with <ul><span>
</td>
</tr>
<tr>
<td colspan=3 style="padding-left: 30px;"><textarea name="format" cols="60" rows="2" id="format" style="width: 98%; font-size: 12px;" class="code"><?php echo stripslashes(htmlspecialchars(kjgrc_get_option("grc","format"))); ?></textarea><br /><span style="font-size: 10px;"><strong>Template for the comments</strong>. If you want them as a list, It should start with <li> and end with </li><span></td>
<input type="submit" id="deletepost" name="reset_template" value="<?php _e('Reset template to default') ?> »" onclick="return confirm('You are about to reset your template for \'Recent Comments\'.\n \'Cancel\' to stop, \'OK\' to delete.')" />
<th width="33%" scope="row"><?php _e('Ignore trackbacks originating from this ip address:') ?></th>
<td><input name="ignore_ip" type="text" id="ignore_ip" value="<?php echo kjgrc_get_option("grt","ignore_ip"); ?>" size="16" /><br><span style='font-size: 10px;'>Insert the <a href="javascript:;" onmousedown="document.trackback_form.ignore_ip.value='<?php global $_SERVER; echo $_SERVER['SERVER_ADDR']; ?>';">address of your webserver</a> to filter pingbacks from your own posts</span></td>
</tr>
<tr valign="top">
<th width="33%" scope="row">Template:
<td> </td>
</tr>
<tr valign="top">
<td colspan="3">
<textarea name="format" cols="60" rows="2" id="format" style="width: 98%; font-size: 12px;" class="code"><?php echo stripslashes(htmlspecialchars(kjgrc_get_option("grt","format"))); ?></textarea><br /><span style="font-size: 10px;"><strong>Template for the trackbacks and pingbacks.</strong> Usually starts with <li> and ends with </li>.</span>
<input type="submit" id="deletepost" name="reset_template" value="<?php _e('Reset template to default') ?> »" onclick="return confirm('You are about to reset your template for \'Recent Trackbacks\'.\n \'Cancel\' to stop, \'OK\' to delete.')" />
The strongest feature of the plugin is that you can change the html layout in the admin interface, by filling in templates. In the templates you make use of macros, that are later replaced by the actual data.
<p><strong>3.1 Using the Macros</strong></p>
<table>
<tr><td valign="top" nowrap>%comment_excerpt</td><td>The text of the comment. It might get shorted to the number of characters you entered in <em>"Long comments are chopped off at..."</em></td></tr>
<tr><td valign="top" nowrap>%comment_link</td><td>The URL to the cited comment.</td></tr>
<tr><td valign="top" nowrap>%comment_author</td><td>The name, the commenter entered in the comment form. If she left the field empty, the name is "Anonymous".</td></tr>
<tr><td valign="top" nowrap>%comment_date</td><td>The date, when the comment was posted in the style you configured as <a href="options-general.php">default date format</a>.</td></tr>
<tr><td valign="top" nowrap>%comment_time</td><td>The time, when the comment was posted</td></tr>
<tr><td valign="top" nowrap>%time_since</td><td>Time since the comment was posted. For example: "9 hours 16 minutes".</td></tr>
<tr><td valign="top" nowrap>%comment_type</td><td>"Comment", "Trackback" or "Pingback".</td></tr>
<tr><td valign="top" nowrap>%gravatar</td><td>This macro becomes a complete image tag. If the comment author registered a gravatar with <a href="http://www.gravatar.com">gravatar.com</a>. Example:<br /><img src="http://www.gravatar.com/avatar.php?gravatar_id=1ebbd34d4e45cac&size=25&rating=X"/> </td></tr>
<tr><td valign="top" nowrap>%gravatar_url</td><td>This macro becomes only the URL to the gravatar. Example:<br />http://www.gravatar.com/avatar.php?gravatar_id=1ebbd34d4e45cac&size=25&rating=X</td></tr>
<tr><td valign="top" nowrap>%profile_picture</td><td>Becomes to URL of a profile picture. Use it like this: <img src="%profile_picture" width=16 height=16>. This only works after activation of <a href="http://geekgrl.net">Hannah Gray's</a> <a href="http://geekgrl.net/2007/01/02/profile-pics-plugin-release/">Profile Pics Plugin</a>.</td></tr>
<tr><td valign="top" nowrap>%userid</td><td>If the comment author is registered with your wordpress, and was logged in, when she wrote the comment this is replaced with the user id, she has in WordPress. The user id's are listed here: <a href="users.php">users.php</a>. You can do fancyful things with this macro. For example you may construct an image url, that points to pictures of all the authors of your blog: <img src="/images/user%userid.jpg"></td></tr>
<tr><td valign="top" nowrap>%author_url</td><td>The URL, the comment author left in the comment form, or if the comment is a trackback, the URL of the site that issued the trackback.</td></tr>
<tr><td valign="top" nowrap>%author_url_href</td><td>The same like %author_url but inside a href statement. If there is no URL, the whole macro is empty. Without a href="" statement the link looks like a link, but is inactive. Use it like this: <a %author_url_href title="%comment_date">comment_author</a></td></tr>
<tr><td valign="top" nowrap>%post_title</td><td>The title of the posting that was commented.</td></tr>
<tr><td valign="top" nowrap>%post_link</td><td>The URL of the posting that was commented.</td></tr>
<tr><td valign="top" nowrap>%post_date</td><td>The date when the commented posting was published.</td></tr>
<tr><td valign="top" nowrap>%post_counter</td><td>The number of comments this post has..</td></tr>
<tr><td valign="top" nowrap>%trackback_title</td><td>Only applicable in trackbacks: The title of the trackback. It might get shorted to the number of characters you entered in <em>"Long trackbacks are chopped off at..."</em></td></tr>
</table>
<p><strong>3.2 Group by comments</strong></p>
If you want to order the comments by their posting, you will have not one but
three templates. The middle one is just the same as in the normal order. The
first and the last template are used to generate headers for the grouped
comments. Usually you will show the %post_title in this header. This is the
<td class="top-ital"><span style="color:green">Start sequence.</span> Automatically provided when the plugin is used as widget. Otherwise you have to enter this by manually into the <a href="theme-editor.php">sidebar.php template</a>.</td>
</tr>
<tr>
<td class="top-example"><pre>
<span style="color:blue"><li>Post 1</li>
<ul>
</pre></span></td>
<td class="top-ital"><span style="color:blue">Template for the post. This is the header for a list of comments, that all belong to the same posting.</span></td>
</tr>
<tr>
<td class="top-example"><pre>
<span style="color:olive"><li>Comment1 to Post1</li>
<li>Comment2 to Post1</li>
</pre></span></td>
<td class="top-ital"><span style="color:olive">Template for the comments<br />It is repeated for every single comment</span></td>
</tr>
<tr class="top-example">
<td class="top-example"><pre>
<span style="color:red"></ul>
</li>
</pre></span></td>
<td class="top-ital"><span style="color:red">Template for the closing tags of the post template</span></td>
</tr>
<tr class="top-example">
<td class="top-example"><pre>
<span style="color:blue"><li>Post 2</li>
<ul>
</pre></span></td>
<td class="top-ital"><span style="color:blue">The next posting.</span></td>
</tr>
<tr class="top-example">
<td class="top-example"><pre>
<span style="color:olive"><li>Comment1 to Post2</li>
<li>Comment2 to Post2</li>
</pre></span></td>
<td class="top-ital"><span style="color:olive">The comments to the next posting</span></td>
</tr>
<tr class="top-example">
<td class="top-example"><pre>
<span style="color:red"></ul>
</li>
</pre></span></td>
<td class="top-ital"><span style="color:red">Again close the tags</span></td>
</tr>
<tr class="top-example">
<td class="top-example"><pre>
<span style="color:green"></ul>
</li>
</pre></span></td>
<td class="top-ital"><span style="color:green">End sequence.</span> Automatically provided when the plugin is used as widget. Otherwise you have to enter this by manually into the <a href="theme-editor.php">sidebar.php template</a>.</td>
</tr>
</table>
</div>
<p><strong>4. Miscellaneous</strong></p>
<ul>
<li>Don't worry if you screwed up the template, reset the template to default and try again.</li>
<li><em>"Wrap long words at..."</em> means: words, that exceed this length are split into fragments to prevent damage to the layout of your blog.</li>
<li>"<em>Ignore trackbacks originating from this ip address</em>" on the
configuration page for recent trackbacks is useful for filtering out pingbacks
that occur when you have a link to your own site in a post.</li>
<li>If you select to exclude comments made by blog authors (your own comments) from the list, then the comments which you made, when you were logged in, are ignored. If you also want to exclude comments you made, when you were not logged in, you can select to also consider the username and e-mail address.</li>
</ul>
<p><strong>5. Interoperation with other plugins</strong></p>
">Profile Pics Plugin</a> is present, you may use to macro <em>%profile_picture</em> to obtain an URL to the profile picture of the commentator (read in the macro section for a working example).</li>
<li>If <a href="http://fredfred.net/skriker/index.php/polyglot">malyfred's</a> <a href="http://fredfred.net/skriker/index.php/polyglot">Polyglot</a> Plugin is present, additional filters are applied to comments, titles, dates and times, which select the right language for the user.</li>
</ul>
</div>
<?php
}
function kjgrc_subpage_header ($kjgrc_selected_tab) {
"grc_grouped_by_post_a" => '<li><strong><a href="%post_link" title="%post_title was posted on %post_date">%post_title</a> (<a href="#" title="There are %post_counter comments to this posting">%post_counter</a>)</strong><ul>',
"grc_grouped_by_post_b" => '</ul></li>',
"grc_show_trackbacks" => 0,
"grc_comments_per_post" => 5,
"grc_limit_comments_per_post" => 0,
"grc_exclude_blog_owner" => 0,
"grc_exclude_blog_owner2" => 0,
"grt_max_comments" => 5,
"grt_chars_per_comment" => 120,
"grt_chars_per_word" => 30,
"grt_format" => "<li><a href=\"%comment_link\" title=\"Trackback to "%post_title": %comment_excerpt\">%comment_author</a>: %trackback_title</li>",
kjgrc_set_option('grc_grouped_by_post_a','<li><strong><a href="%post_link" title="%post_title was posted on %post_date">%post_title</a> (<a href="#" title="There are %post_counter comments to this posting">%post_counter</a>)</strong><ul>');