If you’ve spent some time poking around in the code for either WordPress or bbPress, you may have come across comments that mention “BackPress”. You may have wondered what this BackPress thing was, well, wonder no more.
In the last few days, I’ve put together a quick site to try to help introduce people to the BackPress project. From the site:
BackPress is a PHP library of core functionality for web applications. It grew out of the immensely popular WordPress project, and is also the core of the bbPress and GlotPress sister-projects.
So effectively, BackPress takes all of the best core functionality (on a code level) from WordPress and bbPress, and makes it available to you and your next PHP-based web application/project. By using BackPress in your projects, you are then able to use most of the code you’ve come to rely on while working on WordPress-based projects, such as $wpdb, trailingslashit(), make_clickable(), __(), wp_remote_fopen() and more. The site includes some details on how to use BackPress in your project, and has the beginnings of a collection of documentation covering the main parts of the code library.
I’m personally really excited about this because I think BackPress has huge potential as a library for other folks and other projects. It allows them to benefit from the lessons learned through years (and thousands of “man-hours” worth of development) on the WordPress and bbPress projects. I’m using it as the core of my HTFS project (not released yet), and I know that some other projects are starting to use it as well. As a developer who has spent a lot of time in “WordPress land”, it makes life so much easier to be able to continue using a lot of the design patterns and techniques that I’ve become accustomed to.
Check it out, and please let me know what else we could get on the site, what needs more documentation etc!
Getting started with LDAP can be quite daunting. In the space of a weekend, I took myself on a bit of a crash course to learn about LDAP so that I could work on a project that needed LDAP to access an address book. Here are some of the things I learned along the way:
Read the rest of this post…
If you’re anything like me, you write a lot of lists. I use lists for pretty much everything — note taking, planning my day, managing projects, shopping, organization, etc etc etc. I have lists of lists. It’s a bit out of control. Over the years, I’ve coalesced on a simple, basic format, where I write things using indented (tabbed) lists of plain text (in TextMate). I kept finding myself converting some of these lists to HTML, so I’ve written something up that will take a plain text list and reformat it as HTML, given a simple set of formatting rules.
That project is available for download now, under the name ListML. Check it out, I use it all the time, so will probably continue developing it. At the moment it’s just a simple script that you drop into a directory, then drop other TXT files in there to view them as HTML. We’ll see where it ends up. If you’ve got any suggestions or find any bugs, feel free to post them as a comment here and I’ll fix things up. I already have some ideas on new features:
- Ability to load external files (from URL)
- List files in the current directory if none specified
- Cut out the parsing engine properly to make it more portable
- Make the HTML view (optionally) into a lightweight editor as well
- Quick UI for grabbing the HTML snippet of just the list (sans CSS/extras)
A few weeks ago, I tweeted that I was writing a PHP library for shortening/lengthening URLs using some of the common/popular services. I said it was going to be called Slinky, and that it’d support a bunch of different services. Well, it’s now available for download and I think it’s pretty cool, even if I do say so myself
Please grab a copy, try it out and let me know what you think. It hasn’t actually been used for anything useful yet, so I’m also interested to hear what you’re using it for!
If you’re coding in PHP and checking variables to see if they have a strlen() == 0, or isset() or a variety of other possibilities, you might consider using empty() instead. It’s quite versatile and is nice because it doesn’t trigger any warnings or notices if you use it on a variable which hasn’t been set yet. Here are some examples to show you what it will match against:
<?php
$zero_string = '0';
$zero_int = 0;
$false = false;
$empty_string = '';
$array = array();
$obj = new stdClass();
echo empty( $zero_string ) ? "'0' = empty\n" : '';
echo empty( $zero_int ) ? "0 = empty\n" : '';
echo empty( $false ) ? "false = empty\n" : '';
echo empty( $empty_string ) ? "'' = empty\n" : '';
echo empty( $array ) ? "array() = empty\n" : '';
echo empty( $obj ) ? "stdClass() = empty\n" : '';
echo empty( $foo ) ? "foo is empty (and the variable was never set)\n" : '';
Over the past few weeks, I have been working on a new importer for people who use LiveJournal, but would like to switch over to WordPress. With LiveJournal laying off a bunch of employees, it seemed like some people might prefer to move to a platform where they had a bit more control over their own content, rather than relying on another company to handle it for them. I decided that my measure of success would be that it needed to be capable of importing Guav’s entire journal — comments and all, without error.
As it turns out, it’s been quite a project. LiveJournal’s API is, shall we say, “challenging” to work with, and the sheer size of Guav’s journal (over 3,700 posts and nearly 200,000 comments) meant that I kept running into time, memory and database limits that would crash the importer. After a lot of back and forth with Guav though, I’m happy to present the new importer (find it under Tools > Import > LiveJournal), sporting the following features:
- Just enter your LiveJournal username and password and you’re ready to go
- Via the API, it connects directly to LiveJournal and imports all of your posts,
- Posts marked as “Friends Only” are assigned a password within WordPress,
- Posts marked as “Private (you only)” are marked as Private within WordPress, which means that only authors on your new blog can read them,
- lj-cut tags are converted to the WordPress equivalent, the <! — more — > tag,
- lj-user tags are converted to normal links, and have class=”lj-user” attached to them to make it easier to style them if you like,
- Tags are imported properly,
- If you closed the comments on a post in LiveJournal, then they’ll be closed in WordPress as well,
- Lots of the “meta” information related to posts is also imported using WordPress’ Custom Fields feature. You could then use these values to reproduce some of LiveJournal’s functionality within your new theme if you like. The fields imported are:
- If your post contains adult content (lj_adult_content),
- Your current co-ordinates and location (lj_current_coords and lj_current_location),
- Your current mood (lj_current_mood),
- Current music (lj_current_music),
- Your userpic keyword (lj_picture_keyword)
- Next up, all of your comments are also imported,
- Threading is preserved, so replies to other comments show up successfully (provided you enable that feature in WordPress),
- The “subject” of each comment is included as the first line of the comment itself, because WordPress doesn’t have a comment title/subject value,
- LiveJournal users get links back to their LiveJournals,
- Your own comments are linked to your WordPress account, and are linked back to your new WordPress blog,
- Anonymous users are labeled as “Anonymous”,
- “Screened” comments on LiveJournal are imported as “Unapproved” within WordPress, so you can decide what to do with them
So there you have it, a brand new, shiny LiveJournal importer. This should be bundled with the 2.8 release of WordPress (it’s available right now on WordPress.com), and will be available for everyone. As I mentioned, it’s been tested with one single, very large blog (and a few smaller test ones), but if you find anything wrong with it, please file a bug on the WordPress Trac!
Huge thanks again to Guav for helping with the testing of this thing (maybe now he can migrate over to WordPress as well)!
Don’t know if this has dawned on anyone else yet…
PHP was the new Perl, written for the web
Ruby (+ Rails) is the new PHP, written for web 2.0
I guess that means I’d better get on the bandwagon and figure it out!
As soon as I posted details of my new Atom API library to the SixApart ProNet mailing list, I got an email from their Manager of Platform Technology, and then another one from Anil Dash, both with hopes that I could include LiveJournal support.
I’m now in touch with one of their people who’s handling the actual implementation of their APIs, so hopefully I’ll be able to work out what’s going on and add LJ support to the code library soon. At the moment, my WSSE authentication is failing on the second request to their API, even though it’s working on the first one… curious.
I’ve finally packaged up and released the PHP Atom API code I wrote as part of webpad. You can download it now and go crazy.