1000 Miles or Bust!

Take a Hike…

Cute SVN tricks

Best procedure for importing an existing project into a new svn repository

This is the best procedure I’ve seen for importing an existing project into SVN. We first create a new svn repository (I prefer to use FSFS instead of BDB). Then we make an empty new directory inside that repository and checkout the empty working copy into the project’s root directory. An “add *” will then add everything into the project, and then a long initial commit imports the project into the new svn repository’s directory.  The killer feature is that this turns your existing code into a working copy.

svnadmin create --fs-type=fsfs /home/username/repos/projectname
svn mkdir file:///home/username/repos/projectname/project-root-dir -m "Make a directory in the repository to correspond to /project-root-dir"
cd /project-root-dir
svn checkout file:////repos/projectname/oproject-root-dir .
svn add *
svn commit -m "Initial version of projectname"

Removing all the SVN subdirectories in one bash command line

SVN’s most kludgey feature is that it uses multiple .svn directories inside every subdirectory in your project.  This makes it quite difficult to remove a copy from version control by deleting all the .svn subdirectories, particularly in a  large and complex project.  Very uncool compared to say, mercurial, which sensibly puts all its files inside one .hg directory tree at the project’s root level.

So here is a unix command to remove all the .svn directories from version control:

rm -rf `find . -name .svn`

Use FSFS instead of Berkeley DB

Another somewhat kludgey feature of svn is that it uses an antiquated db to store its files. But if you specify a FSFS repository in your create command, you can create your repository using the FSFS filesystem. FSFS  has two killer features–your svn repo will be portable without doing a database dump, and it makes backups simpler and more reliable.

svnadmin create --fs-type=fsfs /home/username/repos/projectname

Useful reference links

Submit to Digg

August 20th, 2008 Posted by Tim | Hacking | no comments

WordPress 0.62 released (security patch)

WordPress Spreadsheet 0.62 is a security patch release that fixes several SQL-injection holes. All users are strongly advised to update their plugin. As usual, you can download a zip file containing wpSS v0.62 from the WordPress SpreadSheet website.

Changes in this release:

  • Security patch. Fixed several security (SQL-injection) vulnerabilities

Submit to Digg

April 24th, 2008 Posted by Tim | Hacking | no comments

Switch from Yahoo Calendar to Google Calendar

I finally got around to switching my calendar from Yahoo to Google this weekend. It was, to say the least, an arduous process, and so I’ve written up some tips on syncing a Yahoo calendar with a Google calendar and the rest of the world’s iCalendar standard. Officially, Yahoo claims it will eventually provide its calendars in iCalendar format, someday… so I just hacked it, today.

I’ve been disappointed in the glacial pace of Yahoo’s web tools development for some time now, but I have been using Yahoo calendar for several years and I didn’t want to lose my appointment history, what with random phone numbers and emails and etc recorded in the entries. But since I abandoned Microsoft Outlook for Thunderbird mail a couple of years ago, I’ve been unable to sync my desktop calendar with my online calendar. In fact, I had pretty much given up bothering to keep a desktop calendar, although I had played with Mozilla’s Sunbird and felt it had promise. Now that the Lightning calendar extension for Thunderbird has finally become relatively mature (0.8 is due out shortly), I had decided to it was time to keep a synchronized desktop calendar again.

The process was not without pitfalls however, especially since Yahoo calendar does not export standard iCalendar files. It exports in a marginally useful CSV format that broke both the auto-import function in Google calendar and broke the automated Yahoo CSV to iCalendar convertor I link to in the resources section below. While in Google Calendar I just had to delete the erroneous calendar, Lightning hung so badly when importing the converted iCalendar file that I had to kill the process manually and the go into my Thunderbird profile directory and rename the (sql-lite) SDB file that Lightning uses to store calendar entries, losing the (mercifully few) entries I had put in by hand. I’m still not sure if the failures were due to the sheer quantity of entries (since the CSV file represents repeating events as single events, there are many more entries than in iCalendar format), or if the problem lies in the failure of the Yahoo CSV exporter to put a valid timestamp in certain fields (again apparently for repeating events), or something else, like problems with how Yahoo exported some long lists of tasks I had in the description field. In short, I had to edit the CSV file with OpenOffice before it was acceptable to Google Calendar or Lightning to import.

But all the difficulties are not just with Yahoo. There are also some quirks as to how Google Provider imports and works with with calendar files, particularly in that Google Provider doesn’t cache the online calendar locally and hence won’t fetch your calendar if you aren’t online (e.g., in an airplane). A more robust solution is to use the Java-based GCAL daemon to cache the calendar locally, and then just point Lightning to the synchronized ics (iCalendar) file.

While some useful links to my internet research follow later in the Resources section, first I’ll give a step-by-step synopsis of what actually worked.


  1. First I downloaded and installed the Thunderbird add-on extensions Lightning and Google Provider. Then restart Thunderbird. [Alternately to using Google Provider (which requires you to be online to see your calendar), you may prefer to run the GCAL daemon to sync to a local version of the iCalendar file with Google (note: it’s a Java ap). Also, GCAL can also sync with other calendar programs like Apple’s iCal. So if all you are looking to do is convert your Yahoo calendar to iCalendar format or into Google Calendar, you obviously won’t need to do this step.]
  2. Next I went to my Yahoo pages and exported my Yahoo calendar as a CSV file. Specifically I chose Yahoo Calendar–> Options–> Import/Export–> Export to Outlook as a CSV file.
  3. I’ll save you the trial and error that happened next by suggesting that you now open up the CSV file in OpenOffice Calc or Excel. The first thing I did was condense the file by deleting the 25 years or so of future repeating events at the bottom of the CSV file. After browsing through the bottom, I discovered my important future events ended with a conference I have scheduled in late 2009, and I just went through and edited out extraneous repeating events between today (March 2008) and the last important event I had actually scheduled. However, I made sure to leave one copy of each repeating event I wanted to keep so that I could set up the repeating properly in Google once I completed the transfer (see the last step).
  4. Next, I turned on the Data-> Autofilters functionality of the spreadsheet programs and then used the filters to inspect the remaining data. By setting the filters appropriately, I was able to delete some of the other potentially troublesome fields (e.g. lengthy task lists in the description field) or copiously repeating entries for past activities. Alternately you could do this by writing a quick “delete row if cell value equal this value” macro–that was much quicker for deleting really numerous entries.
  5. After saving the CSV file, I imported it using the Google calendar CSV import feature. To do that, I first created a new Google calendar called named “Old Yahoo Calendar” (from experience, I can tell you it is wise not to risk corrupting an existing calendar). Then choose the little drop down arrow to the right of the word “Add” in the My Calendars sidebar, and import the edited CSV file, making sure to direct it into the new empty calendar.
  6. Inspect the calendar and see if the calendar import has worked appropriately. You may still need to do more data massaging of the CSV file…I did.
  7. Next, Thunderbird must be setup to show your Google calendars. To use Google Provider (simpler), just choose File–> Create–> Calendar–> On the Network –> Google Calendar. The location field should be XML address of your Google calendar. You can find that by clicking on the little down arrow by the name of your calendar (e.g. “Old Yahoo Calendar”) in the My Calendars sidebar of the Google interface, and then clicking on Calendar Settings in the popup menu. Right click on the XML icon next to the private address and choose copy link. Paste that link into the location field on the Thunderbird/lightning setup page and you are good to go. [Alternately, if you are using the GCAL daemon, you’ll need to choose File–> Create–> Calendar–> On the Network –> iCalendar (ICS) and specify the location of the GCAL ics file.]
  8. Last, you will need to edit any repeating calendar entries to convert them from single events. To do this, I chose to copy the events out of my “Old Yahoo Calendar” and into my main Google calendar from within Google’s interface rather than from within Lightning’s, largely because Google’s copy event function seemed to pickup my default Google calendar preference to send me a reminder email one day in advance of a new event while Lightning didn’t. After I made sure each birthday, regular weekly or monthly meeting, future multi-day conference, upcoming trip out of town, etc., was set to repeat and notify me automatically, I deleted the future entries out of my old Yahoo calendar and was done. The past entries I simply kept in my old Yahoo calendar for reference.


Submit to Digg

March 9th, 2008 Posted by Tim | Hacking, Every last post | one comment

Floating a rounded corner box inside a WordPress post entry

How to apply div tags from within the WordPress RCE using the content filter in order to get a rounded corners, floated text box

The problems were:

  • that I and my client wanted to float a rounded corners pullquote box inside a WordPress post
  • but… the WordPress rich content editor TinyMCE strips out div tags and many other html tags, even when entered in the “code” view window
  • moreover… my client doesn’t want to type code and I would like the client to be able to write the post entirely by themselves

The solution for the client was to…

Submit to Digg

October 7th, 2007 Posted by Tim | Hacking, Every last post | one comment

WordPress Spreadsheet 0.61 released

WordPress Spreadsheet 0.61 is a maintenance release that fixes a bug when the plugin was run on WordPress installations that used custom permalinks. As usual, you can download a zip file containing wpSS v0.61 from the WordPress SpreadSheet website.

Changes in this release:

  • Bug fixes. Fixed bug caused by relative path addressing when used with WordPress permalinks.

Submit to Digg

August 4th, 2007 Posted by Tim | Hacking, Every last post | no comments

WordPress Spreadsheet (wpSS) version 0.6 released

WordPress Spreadsheet 0.6 is a new development release that offers numerous new features and bug fixes over the previous major version. As usual, you can download a zip file containing wpSS v0.6 from the WordPress SpreadSheet website.

Changes in this release:

  • Ranges. It is now possible to use the mouse to select a range of cells and perform most operation on cell ranges.
  • Cut, Copy and Paste. Ranges may be copied and pasted using the standard keys (ctrl-x, ctrl-c, and ctrl-v). Formulas in the ranges should automatically adjust.
  • Data Interchangeability. A range of cells may be copied to the clipboard and pasted into other spreadsheet programs, or the contents of the clipboard may be pasted into a cell and if it is a range of tab separated values it will paste the entire range into wpSS.
  • Increased AJAX Functionality. wpSS now accepts a wider variety of keyboard input, including pgUp, pgDown, ctrl-Home and ctrl-End for navigation within the spreadsheet. Ctrl-s saves the spreadsheet (when so permitted by the WordPress administrator).
  • Bug fixes. Several minor display bugs were fixed to standardize the height of the spreadsheet within a WordPress blog entry.

Please read the release notes for greater detail.

Submit to Digg

July 23rd, 2007 Posted by Tim | Hacking, Every last post | one comment

Deepest Sender can’t login–fix

Recently my server seems to have updated their modsecurity rules so that my blogging client for Firefox, Deepest Sender, didn’t work, returning a cryptic “TypeError: node has no properties” message. It took me one confusing hour to figure it all out, as naturally I was writing a post that fell into another modsecurity trap. But there was a relatively easy solution.

The most drastic would be to turn off the SecFilter setting in your .htaccess file completely, as some forums advise (bad idea–you open yourself up to lots of security issues if you turn off filtering for all the nasties your webhost’s sysadmins are trying to protect you against with modsecurity.

A better solution is to just turn SecFilterInheritance off for only the file xmlrpc.php. That’s much more selective, but it still leaves a security hole right where attackers expect it. And, as any analysis of raw access logs will tell you, there are plenty of scripted attacks on yourdomain.com/xmlrpc.php, yourdomain.com/wordpress/xmlrpc.php and so forth.

An even better solution to combine that with the Purloined Letter method. Hiding the publicly accessible xmlrpc.php by renaming it is much more secure.

First, copy xmlrpc.php to yourownrandomname.php within your WordPress directory. (Copying the xmlrpc.php file rather than just renaming it reduces the chances that some other plugin will fail obscurely.)

Second, use the .htaccess modification method to point to your (hopefully) unique filename. Since they don’t know the filename, the script-kiddies won’t know what file to attack. Modify (or create) an .htaccess file in the wordpress directory with the text editor of your choice and insert the following directive:

<Files yourownrandomname.php>
SecFilterInheritance Off

Third, change DeepestSender or WindowsLiveWriter, Performancing or whatever blog client you use to point to yourdomain.com/yourwordpressdirectory/yourownrandomname.php rather than xmlrpc.php.

The only downside that I can think of is that you should repeat step 1 whenever you upgrade WordPress (if the xmlrpc.php file has been changed–and it is a target for attacks, so it does).

If you also run into Error 403/404 problems when posting content or comments containing filtered phrases like “xmlrpc.php” or “href=’javascript:’” as I did on another post, you may have to also modify the .htaccess settings for wp-admin/post.php or even wp-comments-post.php. Unfortunately it isn’t as simple to give a unique name to post.php as you’d have to change the filename throughout many WordPress program files. A better bet is to install WordPress in a non-obviously named subdirectory (not wordpress or blog or blogs or WordPress or so on and so forth…), but even then a script could pick up the install directory from the http_referrer variable, so a purloined letter solution isn’t as helpful for preventing spam attacks trying to exploit WordPress’s posting engine. So if this is a frequent problem, you’ll have to think of another solution–or just turn on and off security right before you post or edit a post containing the forbidden phrases.



Submit to Digg

June 12th, 2007 Posted by Tim | Hacking, Every last post | 4 comments

Making javascript hrefs work in Drupal

I wanted to add a quick print button to a Drupal page I was modifying the other day, as I have done in the past for other ordinary HTML/CSS sites. The code, which at its simplest reads something like:

<a href="ja vascript:window.print(); return false;">Print this page</a>

simply could not be entered into the Drupal editor. The reason? Apparently Drupal was performing some kind of regexp filter on the hrefs to ‘correct’ non-fully-qualified local addresses, replacing ‘href=’ with href=’http://LocalDrupalDomain’. Eventually I figured out I could enclose matters in the code tags and get the address tag to work and by setting the input type to PHP.

But that was only one problem. I kept getting a weird Error 403/404 whenever I tried to post the entry. My webhost’s Apache modsecurity module on my webhost also seemed to have a rule forbidding any posting matching ‘href-equals-javascript-colon’ (and yes, I have to spell that out or break up the word with an extraneous space as I did in the code above in order to sneak this past the modsecurity censors.) No doubt that rule is intended to prevent spammers and other attackers from hijacking the form processor. Some of the Drupal solutions suggest writing the javascript href using a PHP echo or print command… now that’s an ugly, but viable workaround thanks to all the slashed prefixing of quotes within quotes.

This brings me to thinking about one of the problems I have with CMS software packages like Drupal (or even blog software like Wordpress) versus hard-coded HTML/CSS websites. In an effort to make some things–like managing a large site–more convenient they frequently make other things less convenient; in this case, it took me the better part of an hour to figure out why entering a simple javascript href tag kept failing. And is a CMS really any simpler anyway? Sometimes, whether in Wordpress or in Drupal, I just want a way to have exactly the HTML I type get posted onto the CMS.

But then that’s where security concerns can still turn around and bite you. I can’t blame WordPress, Drupal or even TinyMCE for overapplicable Apache rules that protect against spammers trying to abuse the html form posting functions. Only the command-line can save us from such follies–time to go in and edit the SQL entry by hand. Oh, it is just like the days when it was just an actual file and I could use vi, in the days before every page was generated on the fly by a dynamic database… except I have to use even more obscure programs.

(Or just temporarily modify the .htaccess for the posting engine for just one moment, while I sneak a post past modsecurity, and then close the security hole back up when I am done…if I remember. But that’s another story…)

Man, what a pain. And CMS’s are supposed to make our lives simpler?

Submit to Digg

June 12th, 2007 Posted by Tim | Hacking, Every last post | no comments

WordPress Spreadsheet 0.55 released

WordPress Spreadsheet 0.55 is an interim release that offers numerous new features and bug fixes over the previous major version. At this point, I would say I am about halfway to the increase in user interface functionality I want to accomplish in version 0.6. As usual, you can download a zip file containing wpSS v0.55 from the WordPress SpreadSheet website.

Changes in this interim release:

  • Cell Locking/Cell Protection. Cells may now be locked (protected) individually by any user by pressing ctrl-L with a cell selected. Autolocked columns and rows are not affected by pressing ctrl-L. Locked cells do save with the spreadsheet (if the user can save.)
  • The arrow keys and TAB keys now work as they normally would in a spreadsheet, that is: entering data and advancing to the next cell.
  • Added toolbars button to add a row at the bottom or add a column at right.
  • Added a toolbar button that makes for prettier number displays by modifying the cell’s formula to =FIXED(oldcellcontents).
  • Added nicer, graphical toolbar buttons using icons from famfamfam.com.
  • Continued to fix minor display bugs in various browsers. No progress on Netscape display issues, though it is working.
  • Fixed bug in editing spreadsheet admin page where after using the save/load/clear buttons, the spreadsheet would reload with auto_locking turned back on.

User interface items projected for wpSS version 0.6 that are still under development include:

  • Selecting ranges of cells with a mouse drag or shifted arrow keys.
  • Copying and pasting ranges of cells.
  • Relative range addresses should automatically adjust when pasted into their new cells.
  • Inserting a column or row at any point in the SS.
  • Deleting a row or column.

Submit to Digg

May 22nd, 2007 Posted by Tim | Hacking, Every last post | one comment

WordPress Spreadsheet 0.5 released

WordPress Spreadsheet 0.5 is an incremental improvement from the initial release version. The major revisions in this version include adding an spreadsheet editing page and a spreadsheet options page to the WordPress admin menus. Additionally, autolocking rows and columns has been implemented and the interactive display now has limited power for anyone other than the WordPress administrator. Some minor GUI display glitches have been fixed as well.

First, there is now a wpSpreadsheet editing subpanel the Write menu in the admin pages to facilitate editing spreadsheets, which was clunky at best in the previous version. The display=interactive option now does not have the option of clearing the spreadsheet or loading/saving any spreadsheet id #, as that was granting too much power to any user. Instead, a user’s interactive display of a spreadsheet is restricted to saving and reloading that particular spreadsheet id #. However, the WordPress administrator still has access to the clearing the spreadsheet and the spreadsheet id # button when display=interactive .

Second, from an “options menu” administration page you can access wpSS-specific options, such as auto-locking rows and columns to protect formulas you do not want others to change (beats editing the PHP code!). The eventual idea here is to be able to create use wpSS to create enduser-fillable, savable forms where the enduser can’t muck up the spreadsheet’s formulas… a feature which most online spreadsheets strangely seem to lack.

As usual, you can download a zip file containing wpSS v0.5 from the WordPress SpreadSheet website.

Most of the code changes in 0.5 focused on the PHP/Javascript code base that interacts with WordPress. In the next version I am planning to focus on the Javascript user interface for the spreadsheet, specifically:

  • providing a keystroke or menu option to lock or protect individual cells
  • inserting and deleting rows and columns
  • copying and pasting
  • nicely formatted numbers, hopefully no more of this bazillion decimal point stuff
  • in-place cell editing, not just in the formula bar
  • selecting multiple cells
  • maybe even some more (and standard) date functions, possibly even formatted

Note also that the syntax of the DATEFROM(year, month, day) function has been changed. Month now accepts numbers from 1 to 12 as you would expect, not the counter-intuitive Unix-ian 0 to 11 of wpSS v0.4. There are also some minor GUI improvements made to the Opera and IE6 spreadsheet display routines.


WordPress SpreadSheet Editing Page

WordPress SpreadSheet Options Page

Submit to Digg

May 9th, 2007 Posted by Tim | Hacking, Every last post | 3 comments

WordPress Spreadsheet v0.4 released

I have just released the initial public version (0.4) of WordPress SpreadSheet plugin. This AJAX/SQL/PHP-based spreadsheet provides bloggers with basic spreadsheet functionality from within WordPress. This interactive spreadsheet differs from other web 2.0 spreadsheet offerings in that it uses open-source code to store the spreadsheet data right into your WordPress SQL database rather than on a 3rd-party server. You can see an example of the spreadsheet in action in my 2007 hiking logs.

The spreadsheet plugin can be downloaded from the WordPress SpreadSheet plugin homepage.

Note that this version (0.4) still needs quite a bit of polish on the user interface, both from within WordPress and on the AJAX spreadsheet interface.

Submit to Digg

April 26th, 2007 Posted by Tim | Hacking, Every last post | no comments

Locked cells in the TrimPath AJAX spreadsheet

EDIT: I’ve now released the initial version of a WordPress spreadsheet plugin.

I’ve been working on a WordPress spreadsheet plugin to keep track of my miles hiked right from WordPress, and to allow users to rate the difficulty of each hike. Naturally I didn’t want to rewrite every bit of code. There are three open source AJAX projects which might suit my needs, WikiCalc, SimpleSpreadsheet and TrimPath spreadsheet (TrimPath later becomes NumSum).

All of these have drawbacks. Both SimpleSpreadsheet and WikiCalc are more complex than I need and somewhat unorthodox in their interfaces, while TrimPath has a primitive Excel-like interface. Although TrimPath’s user interface is much more polished in NumSum, unfortunately using NumSum in an iframe tag won’t work because I want to store data locally in the WordPress database, not on their server. Moreover, I’d like to present each user with their own column to rate the difficulty of a hike and omit the individual ratings given by other users. So I need code that I can tangle with and runs on my local server, which also eliminates Google spreadsheet, EditGrid, ZohoSpreadsheet and the like from serious consideration.

TrimPath spreadsheet has the serious fault, however, of not allowing me to lock cells. I don’t want anyone to be able change the length or description of a hike, or my own rating of how difficult it is, or the formulas which sum miles and average difficulty factors across users. So limiting the cells anyone can edit is a necessity.

To fix the Trimpath Spreadsheet js code to allow for locked cells, all that is needed is one line of code (and its closing bracket):

1) In spreadsheet_ui.js, find the CellEditDone function

2) Locate the conditional in the line which reads:

if (td != null) {

3) After that line insert

//only update if the previous cell is not locked
if (td.className.indexOf("locked") < 0) {

4) Add closing bracket } just before the bracket that closes the conditional in step 2.

5) Basically, this just nests the routine for updating the cell contents from the values in the input formula bar inside a conditional determing whether the cell is locked.

6) To make it work, edit the html of the table to mark some cells locked using <td class=”locked”>cell contents</td>. (Note that this is not user friendly, but since I’m building the html table via PHP pulls from the WordPress database, who cares.)

Next, add the class “locked” to the CSS file with a different background color in order to visually indicate that some cells are locked (say with a different background color). Add this CSS class to the Trimpath stylesheets (spreadsheet.css, spreadsheet_grey.css and spreadsheet_pastel.css):

.locked { background-color: orange; }

(Note that if this style is just added to “spreadsheet.css” this next hack may not work, though the color of the cells in the stable will still stay locked.)

Finally, it is desireable to get the input bar to indicate whether the cells are locked by inserting the phrase (cell locked) into the input formula field before the cell contents. And it would also be useful to attach the CSS class to this field so it can display a locked cell’s contents in the “locked” background color just as it does in the spreadsheet body. Insert the following code:

// identify a locked cell in formula bar and by changing color via CSS class "locked"
if (td.className.indexOf("locked") == -1 &&
inputFormula.className.indexOf("locked") == 0)
//kludgey: removes "locked" only if the first class
inputFormula.className = inputFormula.className.substring(6,inputFormula.className.length);
if (td.className.indexOf("locked") >= 0) {
v = "(Cell locked) " + v;
if (inputFormula.className.indexOf("locked") < 0)
inputFormula.className = "locked " + inputFormula.className;

between these lines in the CellEdit function in spreadsheet_ui.js

if (v == null || v.length <= 0) v = td.innerHTML;
inputFormula.value = v;

Submit to Digg

February 18th, 2007 Posted by Tim | Hacking, Every last post | one comment

Customizing the TinyMCE buttons in Wordpress 2.1

The TinyMCE editor in Wordpress 2.1 was driving me a little bonkers, what with its tendency to change your html willy-nilly and its limited toolbar buttons. Of course, one can get the advanced toolbars to show up by pressing alt-shift-v (in Windows Firefox), but I wanted all those buttons on the advanced toolbar there from the start. You can also use this knowledge to customize the toolbars in any way you like using any button available on the TinyMCE control reference page.

And why does WP’s TinyMCE refuse allow you to type in a <div> tag, even in the “code” tab? It replaces the <div> tag with a <p> tag? What’s that about?

Here are the fixes.

  1. Edit the file /path-to-wordpress/wp-includes/js/tinymce/tiny_mce_config.php
  2. To get the advanced toolbar functions by default, change line 34 ($mce_buttons_2=...) to read
    $mce_buttons_2 = apply_filters('mce_buttons_2', array('formatselect', 'underline', 'justifyfull', 'fontselect', 'separator', 'pastetext', 'pasteword', 'separator', 'removeformat', 'cleanup', 'separator', 'charmap', 'separator', 'undo', 'redo'));
  3. To partly solve the no <div> tag problem, change line 24
    $valid_elements = ‘p/-div[*],-strong/-b[*],-em/-i[*],-font[*],-ul[*],-ol[*],-li[*],*[*]’;
    to read:
    $valid_elements = ‘-strong/-b[*],-em/-i[*],-font[*],-ul[*],-ol[*],-li[*],*[*]’;
  4. Now it would be much nicer if the “code” window actually allowed you to edit the raw html source, but this workaround doesn’t quite do that.
  5. Of course, this file will be overwritten during an upgrade, so don’t forget to keep a backup copy of your edited file around when you upgrade Wordpress!







Submit to Digg

February 12th, 2007 Posted by Tim | Hacking, Every last post | 9 comments

The Trivial Phrase Plugin (v. 0.1)

I recently wrote my first plugin for WordPress, The Trivial Phrase 0.1 plugin.

I wanted a way to make it easy to update the actual number of miles I have hiked this year. Before I just simply had it hardcoded in the sidebar, and was forced to edit the sidebar.php file every time I wanted to update the number.

So I wrote a very simple plugin that allowed me to update the miles I have hiked from inside the wordpress admin write menu. Then, because I am a geek, I generalized it to the notion of updating any trivial phrase. Moreover, one can change the prompt for the phrase and even the name of the “trivial phrase” submenu in the plugin.

It’s still pretty stupid though. I think a big improvement would be to allow you to have an an array of trivial phrases, and then call for each one using trivialphrase_print(x). When I get around to that, I’ll probably release it publicly. I can’t be the only one who needs an easy way of updating random silly stuff on a wordpress blog.

The Trivial Phrase Plugin source code (trivialphrase_0.1.zip)

Submit to Digg

February 11th, 2007 Posted by Tim | Hacking, Every last post | no comments