Brief Review: DAISY Creation Software

What is DAISY?

DAISY, or Digital Accessible Information System), is basically a format for audio books. More than just mp3, there is also XML that adds features, such as allowing users to search, bookmark, and make notes. More information on Wikipedia. Continue reading “Brief Review: DAISY Creation Software”

Finding a WordPress Image Slider Carousel Plugin (Again)

UPDATE: Please consider not using a carousel at all: Death to the Website Carousel

I previously posted on this same topic not all that long ago, but that slider broke when we updated to the most recent WordPress (3.4) and since new plugins come out all the time, I thought I’d just find a new one. Continue reading “Finding a WordPress Image Slider Carousel Plugin (Again)”

Modifying WordPress Comments Form Fields: Beyond the CSS

I ended up playing around with the CSS some more too to make the form even smaller, but I was also asked to change the form fields and decided to put in some placeholders. While the WordPress documentation for comment_form is pretty good, the example doesn’t clearly tell you how to change form fields. It’s possible I find it less than intuitive because I’m not a programmer.

In my case, I wanted to change the title from “Leave a Reply” to “Leave a Comment”. I also wanted to change the form fields to have placeholder text and make the comments box smaller.

Changing it Once

If you only want to change it in the one file, you can specify the new values just above where you call comment_form().

Let’s start with changing the easy stuff. Much like the WordPress example, just make an array with whichever values you would like to change from the default, and call the comment_form function with your array, which in this example, the form header and comment field are changed.

//for long defaults, such as the comment_field, I suggest copy/pasting the default and then modifying it
$comments_args
= array(
‘title_reply’ => ‘Leave a Comment’,
‘comment_field’ => ‘<p><label for=”comment”>’ . _x( ‘Comment’, ‘noun’ ) . ‘</label><textarea id=”comment” name=”comment” placeholder=”Eggy approves!” cols=”45″ rows=”4″ aria-required=”true”></textarea></p>’
);
comment_form($comments_args);

Changing the other fields makes things a tad more complicated. For other fields, you need to specify another array, then apply your new values in the comments array.

//required variables for changing the fields value
$commenter = wp_get_current_commenter();
$req = get_option( ‘require_name_email’ );
$aria_req = ( $req ? ” aria-required=’true'” : ” );

//name the array whatever you want; I strongly suggest copy/pasting the default then modifying it
$new_fields = array(
‘author’ => ‘<p>’ . ‘<label for=”author”>’ . __( ‘Name’ ) . ‘</label> ‘ . ( $req ? ‘<span>*</span>’ : ” ) .
‘<input id=”author” name=”author” type=”text” placeholder=”Eggy the Ram” value=”‘ . esc_attr( $commenter[‘comment_author’] ) . ‘” size=”30″‘ . $aria_req . ‘ /></p>’,
’email’ => ‘<p><label for=”email”>’ . __( ‘Email’ ) . ‘</label> ‘ . ( $req ? ‘<span>*</span>’ : ” ) .
‘<input id=”email” name=”email” type=”text” placeholder=”eggytheram@ryerson.ca” value=”‘ . esc_attr(  $commenter[‘comment_author_email’] ) . ‘” size=”30″‘ . $aria_req . ‘ /></p>’,
//in this case, we’re applying filters, so it changes all the values. If ‘url’ is not specified, then it gets removed.
);

$comments_args = array(
‘fields’ => apply_filters( ‘comment_form_default_fields’, $new_fields ),
‘title_reply’ => ‘Leave a Comment’,
‘comment_field’ => ‘<p><label for=”comment”>’ . _x( ‘Comment’, ‘noun’ ) . ‘</label><textarea id=”comment” name=”comment” placeholder=”Eggy approves!” cols=”45″ rows=”4″ aria-required=”true”></textarea></p>’
);
comment_form($comments_args);

For a full list of default values in comment_form(), take a look at the Codex Function Reference.

Changing the Defaults

To change the fields for all comment forms, meaning it will change the default values and will be applied whenever you call comment_form(), you can change the defaults using a filter in the functions.php file.

//name it whatever you want
function alter_comment_form($new_defaults) {

//required variables for changing the fields value
$commenter = wp_get_current_commenter();
$req = get_option( ‘require_name_email’ );
$aria_req = ( $req ? ” aria-required=’true'” : ” );

//name the array whatever you want
$new_fields = array(
‘author’ => ‘<p>’ . ‘<label for=”author”>’ . __( ‘Name’ ) . ‘</label> ‘ . ( $req ? ‘<span>*</span>’ : ” ) .
‘<input id=”author” name=”author” type=”text” placeholder=”Eggy the Ram” value=”‘ . esc_attr( $commenter[‘comment_author’] ) . ‘” size=”30″‘ . $aria_req . ‘ /></p>’,
’email’ => ‘<p><label for=”email”>’ . __( ‘Email’ ) . ‘</label> ‘ . ( $req ? ‘<span>*</span>’ : ” ) .
‘<input id=”email” name=”email” type=”text” placeholder=”eggytheram@ryerson.ca” value=”‘ . esc_attr(  $commenter[‘comment_author_email’] ) . ‘” size=”30″‘ . $aria_req . ‘ /></p>’,
//in this case, we’re applying filters, so it changes all the values. If ‘url’ is not specified, then it gets removed.
);

$new_defaults[‘fields’] = apply_filters(‘comment_form_default_fields’, $new_fields); //changing default fields to the new values in your array
$new_defaults[‘comment_field’] = ‘<p><label for=”comment”>’ . _x( ‘Comment’, ‘noun’ ) . ‘</label><textarea id=”comment” name=”comment” placeholder=”Eggy approves!” cols=”45″ rows=”4″ aria-required=”true”></textarea></p>’;

$new_defaults[‘title_reply’] = ‘Leave a Comment‘; //changes the form header text

return $new_defaults;
}

add_filter(‘comment_form_defaults’, ‘alter_comment_form‘); //basically tells it to replace the existing defaults with your new defaults value (where applicable)

If you only want to change the fields or if you want to do it separately from the comments_form_defaults (especially if only changing one field), then you can set new values in a similar way to the new defaults, say:

function alter_comment_form_fields($new_fields) {
    if(isset($fields[‘url’]))
unset($fields[‘url’]);
return $fields;
}
add_filter(‘comment_form_default_fields’, ‘alter_comment_form_fields‘); //make sure to use comment_form_default_fields

Note: In this case, since we’re using the add_filter for the fields (instead of apply), it will only change the values specified.

Since this example only changes the url field, I could’ve actually used the specific field filter (i.e. comment_form_field_url) instead. Near the bottom of the Codex Function Reference page is a list of filter hooks related to comment_form.

The Result

As I mentioned, I edited the CSS further since my last post on editing the TwentyEleven comment form, so now it’s even smaller. It’s now 124px shorter and 84px less wide than my last version for a total of 367px shorter (and 84px less wide).

WP Comments Form Edited version 2

I was also recently reading about adding ‘character’ or ‘personality’ to a website and thought having fun placeholder text would be one small way to do that. (Eggy the Ram is the university’s mascot.)

How Hard Can Finding a WordPress Plugin Be? Part 2: Custom CSS & Social Media Sharing

Sadly, this was also harder than I expected. Honestly, in this case, the only requirement I had was that it worked.

Custom CSS Plugin

I tested a lot of plugins (pretty much every one I could find), many of which didn’t work and were simply incompatible with the newest version of WordPress. Here are some that worked:

  • My Custom CSS – I liked that it colour codes and has line numbers, but it broke when I got over 700? lines. New classes that I added would be empty. I’m also not a fan of the fact that it just adds it at the top of the page instead of as an external file.
  • Custom CSS Manager – Pretty much exactly like My Custom CSS, but I haven’t broken it. Still unhappy that it doesn’t load an external file instead though.
  • Your Custom CSS – Simple, but seems to work just fine, even puts your code into an external file, which I like. Didn’t test it to 500+ lines though like I did with the previous ones.
  • Best Custom CSS – Works fine, can edit CSS files through built-in WP editor, only doing it that way isn’t very intuitive. It also presets CSS files instead of allowing you to set your own unfortunately.
  • Site Specific CSS – Turns out, most CSS plugins only work in a single site since they write to an external file and the plugin always calls the same external file. Since we’re running a Multi-Site install, I ended up with the site specific CSS plugin. It’s simple (all it does is load a CSS file you link to), but it works! Since it’s just a link, you have to edit the files externally or put it into your theme root folder (or plugin folder) to edit it in the built-in editor.

I rejected a couple of CSS plugins that seem to be no longer in development (such as WordPress.com Custom CSS) even if they (mostly) work and I used a combination of how recent there has been an update and whether developers responded to forums posts as a criteria.

Social Media (Twitter, Facebook) Sharing Plugins

On the upside, it was quite easy to find a social media sharing plugin that worked. I did have a couple of requirements for this:

  • Facebook and Twitter required
  • Share buttons (not sidebar widgets) at the bottom of each post (but not pages)
  • Have to be able to turn off the display of shares counters

I didn’t test a lot of them since I found a couple that work, and I was happy with one in particular. Here are the results:

  • Facebook, Twitter, Google Plus One Share Buttons – Works, but does not have as many options the other plugins. I also didn’t like the counters showing above instead of next to the buttons, which would be more compact.
  • Twitter, Facebook, Google Plus One Social Share – This one works great and has a lot of options including a floating box of the share buttons. The problem I had with this one is that you have more than one row of buttons, it goes beyond the div because of the display setting. I reported it, but didn’t feel like hacking it, so I went with the last one.
  • Really Simple Facebook Twitter Share Buttons – This one works great, plus it lets you reorder buttons, and set the width spacing. While the more-than-one-row behaviour isn’t ideal, it works. It also has a via username for twitter. It even comes with a shortcode and selective exclude method.

I’m open to suggestions on better plugins of either, especially CSS ones (for single and multi-site). Next might be form management, but if I can’t find a good free one, I might simply suggest paying for GravityForms (since it’s a one time payment).

UPDATE: Of course, then I finally find out about Jetpack almost all of which is free, including Custom CSS and Sharing. The only downside is that you need a wordpress.com account, and I am not connecting my personal account to work sites.

How Hard Can Finding a WordPress Carousel Plugin Be?

UPDATE: I posted a newer analysis in June 2012.

A lot harder than I thought, I can tell you that.

Requirements & Options

I did have a few requirements:

  • work in a sidebar
  • have manual image selection (i.e. not only through featured image on posts)
  • be able to set an external link for each image
  • some sort of navigation i.e. arrows or buttons
  • works with other necessary plugins for our site
  • 2D, not a fancy 3D one (though in the future a 3D one might be nice for special collections & archives)

Preferred options include:

  • buttons or numbers to skip directly to a specific image
  • left/right arrow navigation on hover
  • caption text at the bottom of image
  • variety of choices for animation
  • shortcode to easily add into widget

Results

I tested a lot of plugins (at least a dozen), many of which didn’t work. My guess is that many are dependent on its own version of jQuery and other js files that conflicted with the built-in WordPress one or incompatible with the newest WordPress in some other way.

  • JJ NextGen JQuery Slider looked promising, but because NextGen messes with user permissions, it was conflicting with the user management plugin I had installed. I’m wondering now if I disable that part of the plugin whether it will work.
  • DOP Slider works but isn’t ideal since there’s no captioning and the arrows weren’t showing up for me.
  • WP jQuery Text and Image Slider works but is also not ideal since it has no captioning and would need styling done so it doesn’t put it into a frame.
  • Nivo Slider for WordPress worked great. It would need a shortcode added (but that’s easy enough) and the buttons aren’t showing, which is obviously a bug, but we could probably fix it if we wanted them.

Many of the plugins are based on the jQuery Nivo Slider, which is free. Why not just use that? Well, we want our users to be able to add images themselves, and not rely on our team. The Nivo Slider developers offer a WordPress version, but it’s paid. It’s a fairly small amount though so I might recommend purchasing it instead of having to customize existing plugins, especially if it’s a one-time payment.

PDF2Wiki Conversion Comparison

So, some people may ask, why are you trying to convert PDF to Wiki? PDF is usually the last step in the process, so just use the original document. My response would naturally be, what if you don’t have the original document?

A Two-Step Process
Through my searching and reading on the topic, it seems there is no PDF2Wiki Converter. Every site that I have read explains converting the PDF to one of: DOC, RTF, HTML, XML first then to wiki format.

PDF2HTML
I tried a number of PDF to HTML programs, but none of them worked to my satisfaction. Most of them only converted simple formatting, such as bold and italics.  Adobe has an online conversion tool. It’s better than some of the others I’ve tried as it interprets lists and such. The resulting code is rather ugly and a lot of the code would need to be stripped before using a HTML to Wiki converter. See my previous post on HTML2Wiki for a couple of tools on tidying or stripping HTML code.

PDF2DOC
I found that a much better alternative was converting the PDF to a DOC/RTF file since it’s a lot simpler and some formatting might be lost, but you won’t have a lot of needless code that might mess up your wiki page. There are a lot of online tools that provide a PDF to DOC/RTF service, however, again, they only tend to do basic formatting.  Adobe Acrobat does a really good job, because it will change lists into formatted lists (instead of normal text).  The major downside of course is that Acrobat is a paid program though there is a 30-day trial.

Conclusion
I had a lot of problems in particular with PDF to HTML, so I thought PDF to DOC/RTF is simply. Honestly though, unless you have a PDF file which is really long and has a lot of simple formatting (bold, italics, etc.), if you cannot get your hands on Acrobat, then I suggest simply copy/paste (or alternatively save as a text file) and manually formatting it in the wiki’s editing box. Of course this depends on the wiki you’re using because ones that don’t have a toolbar to help you quickly format might be a bit of a pain. Someone please let me know if you have found a better method!

DOC2Wiki (Word2Wiki) Converters Comparison

So to continue on ways to convert existing documents to wiki code, next is formatted text documents, which is typically word DOC files, but may also be something like RTF files.

Most sites I found actually just instructed people to use a 2 step conversion. From Word to HTML and then to wiki code. While this may work, it’s much less efficient and I can imagine more things are lost in the process. Admittedly, the converters that I have found are all geared towards MediaWiki, so if you’re using a different wiki then these converters may not work so well. Nevertheless, MediaWiki provides a list of Word to Wiki converters the most basic of which does not seem to be specifically geared to MediaWiki.

OpenOffice Sun Wiki Publisher Plugin (MAC and Windows compatible, not sure about other platforms)
(the wiki converter is built-in, the publishing part of it is optional)
The downside of OpenOffice is that it does not always interpret word documents very well. Embedded images tend to turn into hex code (ex. ffd8ffe000104a46494600010201 etc.) and tables aren’t always interpreted correctly either. The one I tried turned into overlapping text. So, in part, the usefulness of the outputted wiki code will depend on how well OpenOffice has read the word DOC itself, but it should handle ODT and RTF just fine.

Word2MediaWikiPlus Macro (Windows Only)
Word is the better choice for documents that OpenOffice can’t seem to handle very well. There is also a Word2MediaWiki Macro which is easier to use, but does not convert tables or deal with images very well.

Special Characters
For the OpenOffice plugin, ‘special characters’ (used loosely here) sometimes turn into weird symbols or random special characters. As with the HTML converters from the last post, something like ’ (not straight apostrophe) gets changed into ‚Äô, or a bullet point (which isn’t recognized to be in a bulleted list) turns into ‚Ä¢.
The Word2MediaWikiPlus (W2MWP) converter is better at dealing with special characters. The macro will simply insert the character as is and at times put a nowiki tag around it, but regardless, it displays just fine.

Text Boxes
For some reason, the W2MWP plugin turns text boxes into a single cell table and then repeats the same text again as regular text (not inside a table). The OpenOffice plugin strips the text of formatting and leaves it as regular text in the wiki output.

Tables
When tables are interpreted correctly, I think the OpenOffice plugin does a better job overall. The W2MWP macro is better at keeping formatting, such as colours and border style (below right), but OpenOffice one seems to interpret things inside a table better, such as type of lists (below left). (It’s supposed to be a bulleted list, not a numbered list.)

Needs Good Original Document Formatting
In both cases, the usefulness of the wiki code will depend on how well the original document was formatted. For example, in one of the documents I tested, a number of the number and bullet lists were not formatted as such, but instead, numbers and bullets were just manually added. In both plugins, they were considered to be regular text with a ‘special’ character or number at the beginning of it.

Conclusion
Whether the Word2Wiki or the OpenOffice plugin is better depends on your priorities. OpenOffice seems to interpret lists and text boxes better, and doing a replace all for characters that weren’t interpreted properly is a pretty quick step. W2MWP is better at keeping formatting and interpreting all characters. So, if you like the way your document looks and you want to keep it that way, use the W2MWP macro.  The big downside of course is that it doesn’t work on MACs (which I’m using right now, yay for VMware).  Nevertheless, my conclusion is that the DOC2Wiki Converters are useful, but may not be the optimal solution depending on how much you’re willing to install and play around with. And if the document isn’t formatted like it should be, then manual wiki formatting might be the way to go.

HTML2Wiki Converter Comparison

So, for the past little while on and off, I’ve been looking for and playing around with HTML to Wiki Converters to see which one works best. Most of the ones I’ve found are online and most of them seem to be based on a Perl script created by David Iberri, who provides a web interface as well.

HTML2WIKI
David Iberri has provided a running web interface version for his script for a lot of different wiki dialects. However, I’ve only tested the MediaWiki version for the purposes of my project.  I really like the “Fetch from URL” feature which is not available on many others.

berliOS’ HTML2Wiki
Interestingly, I found what looks to be the exact same converter on another site, but it gives me slightly different results. (see below)

Seapine’s HTML to Wiki
The one is really good for basic things and even though it does not have a “Fetch from URL” feature, you can easily copy/paste.  However, this converter frequently broke for me when dealing with whole pages because it seemed to stop working when it faced something that it didn’t quite recognize.

Batch/Site HTML to MediaWiki converter
I have not actually tried this one, but I thought it might be a useful resource for later and for other people. This uses the same Perl script in combination with MediaWiki’s PHP importing scripts.

Comparison between HTML2Wiki and the berliOS version
General Text
Neither deals with ’ (the non-straight apostrophe) very well for some reason, and I’m guessing it will have problems with some other characters as well. Currently, both give a � in place. However, if it’s always the same character in your wiki document, it’s easy enough to do a replace all.

Tables
Both seem to handle tables quite well and one as well as the other, though sometimes the Iberri one seems to forget to put the first line of the table code on a new line, which of course, means the table fails to work.

Links
I would say that overall I like the berliOS version better for links because it can recognize anchor links, whereas the Iberri one will display text. For example (berliOS):

[#reserve Finding Articles on Course Reserve].

The Iberri one does a better job at “oh my god i don’t understand this” by simply stripping the HTML and leaving text. The berliOS one will try to interpret it and end up with odd things at times.  However, I think it’s pretty understandable that it doesn’t handle mouse over boxes very well especially when the original script to do that is CSS and not a part of the HTML tag. For example (berliOS):

You CAN find hundreds of thousands of articles through the UBC Library Web. more »
UBC Library subscribes to tens of thousands of magazines, journals and newspapers, in print and in full text online.
The UBC Library Catalogue DOES NOT list individual articles by topic. more »
To search for articles by topic, you need to start your search in an index or database. (Instructions follow.) Like the catalogues of most libraries in the world, UBC Library�s catalogue does not contain a listing for each article in each journal in its collection.
Search engines like Google DO NOT retrieve most academic articles. But… more »
”’Google Scholar (Beta)”’ has begun to reach some academic journals and online archives, but for now, Indexes and Databases are the most complete searchable lists of articles.
Most academic and publicly-funded researchers publish the results of their research in scholarly journals or in online archives, which search engines don�t reach. Most popular magazines do not provide their content for free on the Web.
Newspaper articles have a different search guide (right here).

Overall
So overall, I like the berliOS one better because it recognizes more elements, but it’s easier to screw things up with it. So I would say the Iberri one is easier to use since it generally just strips what it doesn’t understand.

Strip/Tidy HTML
On a related footnote-sort note, after converting to wiki code, if there is a lot of HTML code left that seems to be messing up the wiki page, you can try stripping or ‘tidying’ the HTML code. HTML Tidy tries to make the HTML conform to current HTML standards, but depending on how the page is done, it might start creating CSS which obviously wiki pages don’t understand, so the strip HTML function may work better.
Zubrag’s Strip HTML online tool
HTML Tidy