Lewis' Blog Tales from the trenches of information technology


Navigating Coinbase’s customer support

A company with which I am involved recently reconfigured its Coinbase account. This was precipitated by a change in the Stripe API, where Stripe shifted away from Coinpayments.net to another exchange for handling cryptocurrencies.

So, while this company had a prior arm's length arrangement with Coinbase, it never actually had to deal with the entity directly...until recently.


Updating bash to patch Shellshock on discontinued CentOS 4.8

By now, this week's news of the Shellshock vulnerability has quieted to a bit of a rumble. What a mess, and to think that this exploit has been possible for such a long time...

What to do about old Linux distros, then? Yes, the rule of thumb is that if the distro is no longer widely supported, one should move off of it, or at least put it behind something more secure. But what if there is a single application which requires just that particular old distro, and will not play nicely with anything newer, and what if that particular app is proprietary, and no longer available?


WP-phptidy – a tool to clean up WordPress plugin and theme code

WP-phptidyWhat is it?

WP-phptidy is based on phptidy, by Magnus Rosenbaum. Eoin Gallagher made some adjustments to phptidy (2.9, circa November, 2009) so that it would better conform to the WordPress PHP Coding Standards, which are similar in most respects to at least one set of PEAR Coding Standards.

Silviu-Cristian Burc─â (aka scribu) kindly placed Eoin's work on github in January of 2012. As I have a natural aversion to social media and github's quasi-social media paradigm, I chose not to fork the project there, but rather to pull it and put it in my own Subversion repository, hosted on my server, and to make my changes freely available to others. Code contributions and patches are most welcome.

Where to download it

The latest build is available via anonymous FTP from my server. I presently do not allow access to my Subversion repository, and I have not yet added this project to my Mantis bugtracker (though I will be sure to update this support page if and when I do).


From the phptidy readme:

- PHP 5
    phptidy does not work on PHP 4, because some functions introduced in PHP 5
    are used, and there are also some differences in the tokens. But it should
    be not too difficult to port it to PHP 4.

    phptidy expects PHP in /usr/bin/php. If your PHP executable is in a
    different path, you will have to edit the first line of phptidy.php.

- PHP extension: Tokenizer


- diff
    The standard Unix diff utility or similar
    Default is to use colordiff.
    Only required if you want to use phptidy's "diff" command.

- PHP extension: mbstring
    Only required if you want to use the configration variable $encoding to
    check the encoding of your PHP files.

 phptidy should work on most operation systems where PHP works.

Operating system compatibility

Out of the box, WP-phptidy should run on any platform capable of running phptidy (see above). I am also taking steps to ensure compatibility with OS/2.

How to use it

Unzip the contents of the zip (single directory) wherever convenient. Running WP-phptidy with no arguments yields a brief syntax reference:

Usage: phptidy.php command [files|options]
  suffix   Write output into files with suffix .phptidy.php
  replace  Replace files and backup original as .phptidybak
  diff     Show diff between old and new source
  source   Show processed source code of affected files
  files    Show files that would be processed
  tokens   Show source file tokens
  help     Display this message
  -v       Verbose messages
If no files are supplied on command line, they will be read from the config file.
See README and source comments for more information.

I've included the original readme from phptidy as a more complete command reference, as well as the README.markdown from scribu's github submission, and my own readme and changelog. Between these references, a working understanding of the tool should be readily obtained.

My changes to the original WP-phptidy

So far, I've added/updated the following:

  • Updated phptidy to 2.11.
  • Added new function: fix_logical_space, which defaults to true. This adds a space after "!" in statements such as !isset, for example.

Look for these enhancements which are on my roadmap:

  • Better detection of missing braces (curly brackets).
  • Space alignment for arrays, e.g.:


    $my_array = array(
    [tab]'foo'   => 'somevalue',
    [tab]'foo2'  => 'somevalue2',
    [tab]'foo3'  => 'somevalue3',
    [tab]'foo34' => 'somevalue3',


WP-phptidy is released under GPL v2, as is phptidy. A copy of the license is included in the distribution.


General Help

If you are using one of the Firefox/Thunderbird/SeaMonkey extensions, one of the WordPress extension projects, or some other open source port to which I've contributed, and you need help, you've come to the right place (I hope).

Either select one of the links below, or access the subject from the Help menu, above to reach the support page specific nto each project:

Mozilla Extensions & Enhancements

Abduction! (Save As Image) mod for SeaMonkey
BetterPrivacy Mod for SeaMonkey


WP Post to PDF Enhanced


Tagged as: Comments Off

WP Post to PDF Enhanced

This is a support page for my WordPress plugin, WP Post to PDF Enhanced, based on WP Post to PDF by Neerav Dobaria, which renders posts & pages as downloadable PDFs for archiving and/or printing.

The WordPress support page for the plugin is located here.

Please note: This page refers to the 1.0.x branch of the plugin, and not the current 1.1.x branch (released April, 2015). I will be updating this page with new screenshots and updated descriptions in the near future.


WP Post to PDF Enhanced is a PDF generator for WordPress posts and pages. Unlike many (most?) other plugins (such as PrintFriendly), WP Post to PDF Enhanced does not utilize any third party rendering to generate the PDF; that is to say, that it is not necessary to redirect the reader offsite to some unknown provider to convert the content. Instead, WP Post to PDF Enhanced relies on the TCPDF class to render the PDF. This makes WP Post to PDF Enhanced a completely self-contained PDF-generating plugin.

This incarnation of the plugin grew out of Neerav Dobaria's initial work, and my subsequent unofficial releases through version 2.4.0. In fact, version 1.0.0 of WP Post to PDF Enhanced is functionally equivalent to my unofficial release of WP Post to PDF 2.4.0.


WP Post to PDF Enhanced bears the GPLv2 license. Included works bear their own licenses.

The TCPDF class bears the GPLv3 (and above) license. There are also separate licenses included for the following:

Third party fonts:

This library may include third party font files released with different licenses.

All the PHP files on the fonts directory are subject to the general TCPDF license (GNU-LGPLv3), they do not contain any binary data but just a description of the general properties of a particular font. These files can be also generated on the fly using the font utilities and TCPDF methods.

All the original binary TTF font files have been renamed for compatibility with TCPDF and compressed using the gzcompress PHP function that uses the ZLIB data format (.z files).

The binary files (.z) that begins with the prefix "free" have been extracted from the GNU FreeFont collection (GNU-GPLv3). The binary files (.z) that begins with the prefix "pdfa" have been derived from the GNU FreeFont, so they are subject to the same license. For the details of Copyright, License and other information, please check the files inside the directory fonts/freefont-20120503 Link : http://www.gnu.org/software/freefont/

The binary files (.z) that begins with the prefix "dejavu" have been extracted from the DejaVu fonts 2.33 (Bitstream) collection. For the details of Copyright, License and other information, please check the files inside the directory fonts/dejavu-fonts-ttf-2.33 Link : http://dejavu-fonts.org

The binary files (.z) that begins with the prefix "ae" have been extracted from the Arabeyes.org collection (GNU-GPLv2). Link : http://projects.arabeyes.org/

These included licenses appear to be compatible - in terms of allowing bundling, at least - with the GPLv3 license which covers TCPDF (though as a disclaimer, I am not an attorney, and this does not and should not be construed as legal advice in the US or anywhere else).


If installing an official version, you may do so from the normal Plugins page in your WordPress site admin area, or download the package, extract it to /wp-content/plugins/, and activate it.


If upgrading from a prior release of WP Post to PDF Enhanced, no special considerations are required. I recommend upgrading through the WordPress Plugins page in your site admin area. Newer releases should be fully backward-compatible or will be able to migrate settings upon upgrading.

Migrating from the original WP Post to PDF

Presently, there is no automated way of migrating options from one plugin to the other.

If you have database access, before installing WP Post to PDF Enhanced, create a new row in the wp_options table. Assign a unique option_id value, set the option_name to 'wpptopdfenh', and copy the contents of the wpptopdf option_value field to the new wpptopdfenh option_value field. You may need to edit any path references referencing /wp-post-to-pdf to /wp-post-to-pdf-enhanced.

If you do not have database access, note all of the options you have set for WP Post to PDF before disabling/uninstalling it, so that you may re-enter them upon activating WP Post to PDF Enhanced.

Be sure to copy any custom images from the /wp-post-to-pdf paths to /wp-post-to-pdf-enhanced paths (e.g., wp-content/uploads/wp-post-to-pdf-logo.png -> wp-content/uploads/wp-post-to-pdf-enhanced-logo.png).

Finally, if you have used any manual placement tags for the PDF icon in your theme(s), you'll need to edit these manually, e.g.:

<?php if (function_exists("wpptopdf_display_icon")) echo wpptopdfenh_display_icon();?>

needs to be edited to read:

<?php if (function_exists("wpptopdfenh_display_icon")) echo wpptopdfenh_display_icon();?>

and so forth.


The Settings page is divided into three distinct groups:

  • Accessibility Options (include/exclude content types, posts, pages)
  • Presentation Options (PDF icon appearance)
  • PDF Formatting Options (output tuning)

Accessibility Options (include/exclude content types, posts, pages)

Accessibility Options

Allowed Custom Post Types Post, Page, Attachment, or any combination where you want to be able to generate PDFs.
Non Public Only Select this if you only want logged-in users to be able to generate PDFs.
Only on Single Select this if you only want individual articles (posts, pages, attachments) PDF-enabled; otherwise, PDFs may be generated from, say, a page of posts.
Exclude/Include Set the toggle for the list of posts/pages to specifically include or to specifically exclude (presently, there is no option for both a whitelist and a blacklist), then list the post/page IDs separated by commas.
Exclude/Include from Cache Set the toggle for the list of posts/pages to specifically include or to specifically exclude from cache 1 (presently, there is no option for both a whitelist and a blacklist), then list the post/page IDs separated by commas.

Presentation Options (PDF icon appearance)

Presentation Options

Icon Position

Before or After content, Both, Manual 2; Left, Right aligned.


PDF Download Link

This can be any HTML you'd like. For the default icon, just copy the provided text.

PDF Formatting Options (output tuning)

PDF Formatting Options

Other Plugins Select if you want (formatting) changes applied by other plugins to impact the rendering of the PDF.
Process Shortcodes Select if you want shortcodes processed in the rendering of the PDF.
Display Author Detail None, Username, Display Name, Nickname - sets the format (or visibility) of the author name in the PDF.
Display Post Category List Select if you want to include the post's/page's category list in the PDF.
Display Post Tag List Select if you want to include the post's/page's tag list in the PDF.
Display Post Date Select if you want to include the post's/page's date in the PDF.
Display Featured Image Select if you want to include the featured image in the header of the PDF.
Image Scaling Ratio Enter desired image scaling ratio (applies to all images; default is 1.25). Note that this decimal entry refers to the relative size of the web view (the antecedent) as compared to the PDF view (the consequent, which is always 1).
Header All Pages Select if you want the header information on all pages of the PDF (otherwise, this information will only appear on the first page of a multi-page PDF).
Header Logo Image Select if you want a logo image displayed in the header. Replace the default placeholder image with your own, per the displayed path.
Header Logo Image Factor This factor is applied to the header logo image to provide some buffer space around the image. Some experimenting may be required to get the factor just right to provide enough room around the image without abnormally expanding the overall header area (default: 14).
Custom CSS Enter your desired CSS in the text box to be applied to all PDFs (hint: Firefbug or Chris Pedrick's Web Developer Extension is your friend). Check the option to apply the CSS (unchecking the option will not remove your styles from the database, so toggling and editing should be fairly easy).
Header Font Select desired font for the header from the dropdown (default: Helvetica).
Header Font Size Enter the size in points of the header font (default: 10).
Footer Font Select desired font for the footer from the dropdown (default: Helvetica).
Footer Font Size Enter the size in points of the footer font (default: 10).
Content Font Select desired font for the content from the dropdown (default: Helvetica).
Content Font Size Enter the size in points of the content font (default: 10).

Included Fonts

Al Arabiya
Arial Unicode
Courier Bold
Courier Bold Italic
Courier Italic
DejaVu Sans
DejaVu Sans Bold
DejaVu Sans Bold Italic
DejaVu Sans Condensed
DejaVu Sans Condensed Bold
DejaVu Sans Condensed Bold Italic
DejaVu Sans Condensed Italic
DejaVu Sans Extra Light
DejaVu Sans Italic
DejaVu Sans Mono
DejaVu Sans Mono Bold
DejaVu Sans Mono Bold Italic
DejaVu Sans Mono Italic
DejaVu Serif
DejaVu Serif Bold
DejaVu Serif Bold Italic
DejaVu Serif Condensed
DejaVu Serif Condensed Bold
DejaVu Serif Condensed Bold Italic
DejaVu Serif Condensed Italic
DejaVu Serif Italic
Free Mono
Free Mono Bold
Free Mono Bold Italic
Free Mono Italic
Free Sans
Free Sans Bold
Free Sans Bold Italic
Free Sans Italic
Free Serif
Free Serif Bold
Free Serif Bold Italic
Free Serif Italic
Helvetica Bold
Helvetica Bold Italic
Helvetica Italic
Times Roman
Times Bold
Times Bold Italic
Times Italic


Shortcodes have been introduced with version 1.0.1. There are currently two shortcodes available (wrap these in []):

wpptopdfenh Use this within your content to generate the default PDF icon and associated link. Note that page/post exclusions do not apply to this shortcode, so even pages listed to be excluded from the "automatic" icon will display the shortcode-generated one.
wpptopdfenh_break This shortcode sets a manual page break within the PDF.

Presently, disabling the processing of shortcodes will render the manual page break shortcode unusable. Look for an enhancement to strip all but the above shortcodes when shortcode processing is disabled (see workaround, below).

Tips & Tricks

Adding Manual Page Breaks (without the shortcode)

If you'd like to add a manual page break to your PDF, but have processing of shortcodes disabled, simply edit the HTML source of your post or page, and place the following HTML tags where you'd like the break to occur:

<tcpdf method="AddPage"></tcpdf>

(Note that while self-closing tags are fine for XHTML, it is likely that your WordPress editor will simply strip the tag completely, so stick with the open and close tags, above.)

Unicode Fonts (necessary for non-English characters)

First, realize that Arial (as used in TCPDF) is not a unicode font. In fact, Arial is actually mapped to Helvietica, so if you select Arial, the actual core font you will get is Helvetica (selecting Helvetica renders exactly the same way). Next, Arial (here) is not a unicode font. Thus, if you have non-English characters, you'll need to select a unicode font in order to have them render as something other than "?" in the PDF. A good suggestion is one of the DejaVu variants.

Image Alignment

If you are finding that your images simply are not aligning as you have the img tags set, try setting the text alignment as you want the image to be aligned. For example, put a right-aligned image in a right-aligned paragraph. It's not a perfect workaround, but usually gets the job done. Expect a real fix for this in a future release.


Kudos to Neerav Dobaria for his excellent work on the original plugin. Without his contribution, I would have certainly had a much harder time getting off the ground. Likewise, without Nicola Asuni's amazing work on TCPDF, WP Post to PDF Enhanced would surely look and act differently than it does now. Finally, thanks to all of the users who have posted reviews and salient comments/questions at wordpress.org for their kind words - especially to me - and suggestions for improving the functionality of WP Post to PDF Enhanced.

I'd also like to thank the folliowing people (in no particular order) from the WordPress community for their time and helpful feedback, encouragement, and overall good humor:


...and a number of other people who should likely be mentioned... Thank you all very, very much.

Getting Support

Support may be requested either on the WordPress plugin support page or by registering for a login on this site and posting a comment to this post. I'm sorry to require registration if all you'd like to do is ask a question, but I find that it's the best way to curtail comment spam. I promise that I won't utilize your email address or other requested information for any purpose other than identifying you on this site, nor will I ever sell or otherwise knowingly disclose your information to any third party without a court order.

Giving Support

If you would like to contribute something monetarily, you have my thanks, and I will be sure to see that some portion of your donation gets to Nicola Asuni's TCPDF project. Also, please consider contacting me with some IT consulting issue or even about web hosting (Rosenthal & Rosenthal's hosting fees are quite reasonable, as are our domain registration fees). Alternatively, contribute something to Warpstock either directly or via an Amazon purchase, or consider giving to your local Humane Society or some legitimate organization which provides support for America's troops and/or veterans (or to such an organization for one of our allies). In truth, there is no amount which can ever repay those who fight - and who have fought - for Freedom.

To donate to me directly for WP Post to PDF Enhanced, please click the button below:


  1. Normally, PDF content is cached, so that once a PDF is generated - by any valid user - that same PDF is presented to a subsequent user, so long as the cache has not expired.
  2. Insert the following into your theme's functions.php:

    <?php if (function_exists("wpptopdfenh_display_icon")) echo wpptopdfenh_display_icon();?>


Abduction! (Save As Image) mod for SeaMonkey

This is the support page for my modified packages of Abduction! (the successor to Save As Image). These versions are simply modified to install and (hopefully) work under SeaMonkey. I'm afraid I can't provide much functional support, but if you find something which doesn't work, I'm happy to look at the latest official build from AMO and see about updating my meager modifications as time permits.


BetterPrivacy Mod for SeaMonkey

BetterPrivacyNettiCat has graciously granted me permission to modify (slightly) his BetterPrivacy extension to allow for installation and use under SeaMonkey. The current version (1.68.m, as of the date of this post) should install under SeaMonkey 2.0a1 and above.

For those not familiar with this extension, it goes beyond the built-in sanitizing functionality of Firefox and SeaMonkey to include clearing the Flash cookies, which may be stored for an otherwise indefinite period of time. For more on the actual feature set of BetterPrivacy, I would suggest reading the information available on the official home.