RSScraping | Scraping RSS With PHP, DOM and XPath Magic

I wrote a post on some XPath magic for all you evil scrapers out there. Now I will show you how to scrape RSS feeds. I used to do it the RegExp way but now I decided to head over to XML parsing and DOM processing. Lazy enough I decided to look for an already made version and found a quite good one actually. Close to my needs but not exactly. I took it, used and abused the source (ended up changing almost completely), and achieved the one I needed. The good thing about the RSS Scraper using DOM XML + PHP is that it's way shorter and much more reliable than the RegExp version.
Read the rest of this entry »

The Complete eLib PHP Library — Free Of Charge

WARNING: Posted on APRIL 1ST! ;)

A bit of gloom and doom. God knows what life throws upon us. I was thinking yesterday ... what if anything happens and my super cool eLIB PHP Library remains unpublished. I want to publish it, didn't really feel like it but some recent events had me make up my mind.
Read the rest of this entry »

rel=canonical | Google Canonicals Wordpress Plugin

I think you are all up to date with the Canonical URL: Google, Yahoo, Live, the jointventure versus unintentional duplicate content ;) Learn more on Matt Cutt's blog.

It's a somehow cool thing but it fits best Wordpress Blogs where URLs can get into trouble every now and then. This is my second plugin related to Wordpress URLs after the Permalink Diet, which I will update these days with a bunch of new extra features based on this very plugin.
Read the rest of this entry »

DOMDocument ft. DOMXPath | Scraping Google Search Results

Scraping with RegExp is most of the times effective enough but, every now and then, you will need to make more advanced queries on the DOM to reach the elements you need or to have the DOM fix very peculiar HTML errors that just don't make sense in the mind of a HTML aware coders. I'm not saying it's not doable in RegExp but this approach might be actually easier for those who think RegExp is EVAL.
Read the rest of this entry »

Incoherency In Wordpress Custom Columns - Actions vs. Filters

Wordpress coding practices sometimes baffle me.

Custom Columns for posts / pages / users / categories are very important to me as a plugin developer who likes to hack into the Wordpress interface rather than creating his own menus in the wp-admin panel! But these days I noticed Wordpress 2.7.1 is broken in terms of custom_columns. Custom columns work for posts and pages but they don't for categories and users. You can add them but they are not even called in the row listings: user_row function and _cat_row function.
Read the rest of this entry »

Output Buffering | Complex Inline HTML | Wordpress Plugin Writers

I wanted a simple method to handle some output buffering when coding plugins. Let's take this situation. You want to alter the_content filter but you want to make the modifications inline.

To manage inline HTML in PHP you got two options: regular string ... impossible. HEREDOCs ... not good for complex PHP code. So you are left with regular ?>HTML + PHP<?php. But returning this as a variable is not trivial. You need to output buffer it by using ob_start(); ... HTML + PHP code ... $html = ob_get_contents(); ob_end_clean();. And this will allow you to wrap inside a variable any kind of complex HTML code thanks to super output buffering in PHP.
Read the rest of this entry »

Fuck YouTube … Google as collateral … AND Publishers Hardest

I keep getting this message on YouTube when looking at quite a bunch of music videos:

This video is not available in your country.

Read the rest of this entry »

“Missed Schedule” Future Posts | Scheduled M.I.A.s Wordpress Plugin

I use a cool piece of C++ software to handle a lot of blogs and publish directly into the databases. I published a bunch of future posts but noticed they won't publish and, when time comes to go live, they just turn Missed Schedule. This really pissed me off. Took a look at the Wordpress code and noticed future posts get assigned a cronjob [ wp_schedule_single_event($unix_time_stamp, 'publish_future_post', array($post_ID)) ] which is downright stupid! Why don't you just look at the database and publish all posts with future status and date in past.

Mist Schedule Posts Examples

Read the rest of this entry »

Revert C++ Projects And Solutions | VS2008 Back To VS2005

I gave VS2008 a try and was stupid enough to convert and not backup over 100 C++ projects from VS2005 to VS2008. All went well untill the dreaded message:

"Failed to create .NET framework propertygrid component."

WTF? I could no longer edit project properties thanks to this .NET error. I tried everything! I tried to repair and reinstall everything: .NET Framework + VS.
Read the rest of this entry »

Comment Timeline Reverser Wordpress Plugin | Newest 1st

I created my own Twitter kind of thing on the INFOBITS page but I needed the comments to flow backwards. I wanted first comment shown to be the latest and, obviously, Wordpress has no such option so I needed a plugin to do this. Of course I did not look for one already made. So I made my own.
Read the rest of this entry »