RSS Feed
Dec 28

On PHP “Encryptions”

Posted on Sunday, December 28, 2008 in Coding

Alright, so I’ve gotten (relatively) a lot of attention for my post(s) (mainly this one) about “decrypting” PHP scripts that are engulfed in various combinations of gzinflate();, str_rot13();, and base64_decode();.

This post is mostly an attempt to enlighten those that come upon it to what these functions are and do, and probably more importantly, how to undo their secretive evil.
(more…)

Dec 22

Trackbacks Woes

Posted on Monday, December 22, 2008 in Coding

When I made the Feed Comments Number (awful name, I know) WP-Plugin, all sorts of sites picked up a link to my blog from “Newest WordPress Plugins” feeds, each of which creating a trackback comment. I didn’t want to turn trackbacks off, because I’d like to know when something like that happens (unless it gets insane and I get like hundreds of them for a post … which is highly unlikely), so I searched for a plugin to sort them out of the regular comments list. That turned up nothing that would work properly so I did it myself.
Now my theme will show the comments first, then a link showing how many trackback/pings are on that post that, when clicked, will display (un-hide) the list of trackback/pings.

For the interested, the code for the comments page (well, the important stuff) is shown below.

<ol> <?php foreach ($comments as $comment) : ?> <?php if(get_comment_type() == 'comment') { ?>                 <li class="<?php echo $oddcomment; ?> item" id="comment-<?php comment_ID() ?>">         <div class="commentmetadata">         <?php echo get_avatar( $comment, 48 ); ?>         <strong><?php comment_author_link() ?></strong><br />         <small><a href="#comment-<?php comment_ID() ?>" title=""><?php comment_date('l, F j') ?> <?php comment_time() ?></a>                                    </div>         <div class="comment-body"><?php comment_text() ?></div>         </li> <?php $oddcomment = ('alt' == $oddcomment) ? '' : 'alt'; } else {         $num_trackbacks++;         $trackbacks[] = $comment; } endforeach; /* end for each comment */ ?> </ol>         <?php if(isset($num_trackbacks) && $num_trackbacks > 0) { ?> <p class="aligncenter"><a href="javascript:void(0)" onclick=" var el=document.getElementById('trackbacks'); if(el.style.display=='block') {         el.style.display='none'; } else {         el.style.display='block'; } " id="showTrackbacks"><?php echo $num_trackbacks; ?> Trackbacks/Pings Not Shown.</a></p> <ol id="trackbacks"> <?php foreach($trackbacks as $comment) {         $oddcomment = ('alt' == $oddcomment) ? '' : 'alt'; ?>         <li class="<?php echo $oddcomment; ?> item" id="comment-<?php comment_ID() ?>">         <div class="commentmetadata">         <strong><?php comment_author_link() ?></strong><br />         <small><a href="#comment-<?php comment_ID() ?>" title=""><?php comment_date('l, F j') ?> <?php comment_time()         </div>         <div class="comment-body"><?php comment_text() ?></div>         </li> <?php } ?> </ol> <?php } ?>
Nov 29

WP Plugin: “Feed Comments Number”

Posted on Saturday, November 29, 2008 in Coding

So I made a WordPress plugin (by request) that adds an image to the bottom of each item in your RSS feed showing the number of comments on that post and links back to the comments section of that post. It’s a really un-creative name for the plugin, but that’s not really all that important. I want to say FeedBurner will add this type of thing if it can correctly parse your feed’s wfw:comments tag, but it’s never worked amazingly for me and not everyone wants / needs to use FeedBurner so I made this. I actually use it myself (and had done a similar type of thing in the past, but more manually). The reason you use an image to do this is because javascript isn’t allowed in RSS feeds, and many times feeds are cached so it would never update text in it unless the last-modified attribute was changed (which WordPress doesn’t do if there are new comments on it).

Right now it allows you to set the background color and the color of the text, as well as choose from two fonts that I included along with it. There’s also the option to upload your own .ttf font files to generate the text. There are plenty of places to find those, so that should allow for more customization (the above examples are with the Arial.ttf font). I’m planning on making it to where the text that’s shown when there are no comments is settable as well as the format of the way the comments are displayed.

Update (0.2): You can choose the text shown if there are no comments on that post in the plugin options as well as choose how to format the text to show the comment number on those that have comments. You can also optionally have the image link displayed in your feed excerpts as well.

the admin options page for the plugin

the admin options page for the plugin

the current admin options for the plugin

There have been 68 downloads since I posted it to WordPress’s plugin directory, which is somewhere in the neighborhood of 66 more than I had expected considering I really just made this for a friend. So if anyone has any feedback or suggestions, you are more than welcome to leave a comment here or on the appropriate WordPress forum for the plugin.