On PHP “Encryptions”
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…)
Trackbacks Woes
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 } ?>
WP Plugin: “Feed Comments Number”
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 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.
1,1,2,3,5,8,13
Mmm, I love me some Fibonacci numbers
(scratch that, Proofs class makes them suck)
So I’m officially 21 (as of Friday). Went out to Olive Garden with Brittany and her boyfriend. Let’s just say that, although their Birthday song rhymes, it makes no sense. I think the only thing that related to birthdays was them saying the word at the beginning to try and make it seem like it was a Birthday song.
DMV’s are closed on Fridays … >:( (which means my license is expired right now) and the place where you are supposed to be able to renew it online, straight up denied me without much of an explanation as to why.
I recently revamped the codebase at thespiffylife.com, moving to a more CMS-based approach as apposed to a ton of random php scripts all over the damned place. Once I finish the admin section and knock some kinks out I may make the code public. I’m not sure if anyone would use it… I know a LOT of people use the ComicPress addition to WordPress, which is nice and enables a buttload of plugins for you simply because it runs on top of WordPress but I felt that that is a bit overkill for just tossing up images with a title. I tend to be more of a do-it-yourself type of person. If there’s on tiny piece of something that bothers me, I usually end up redoing it all myself. Customizing things is fun too
.
Right now it runs on MySQL and PHP 5.1+. I’m considering making it work without the MySQL server, but I’m not sure how that would affect performance (whether or not it would be worth the effort, because it might turn out really effing slow to rummage through arrays, because right now a page will load uncached in under a tenth of a second). If I did that I’m sure more people would be interested because, although MySQL server’s are easy to come by, some people just don’t have access to them (or they prefer something else, which, I suppose could be included in my database class).
I finally got around to fixing our Facebook application, and will probably add some more features to it during the break. Their API is slightly confusing and, even though it’s got a lot of documentation, I find a lot of it is out of date for the new site design / API. Which makes it “fun” to try and mess with. Plus the fact that I forgot to remove people from the database when they deleted the app, that didn’t make things any easier either.
Thanksgiving is Thursday! No class for two days + turkey in my belly = WOOT
. That and the fact that next week is “dead week” makes me excited. Of course I do have two tests on Wednesday, one being Proofs, which sucks. But once that’s over it’ll be grrrreat.