Recent Announcements

Getting Involved with the WordPress Community

End of October I found myself in Boston for Boston WordCamp 2013, as I wanted to get more involved in the WordPress community. As it turns out there are no boundaries for those interested in contributing to WordPress. Visit make.wordpress.org to find out how you can help out by tackling defects, supporting other users in the community and contributing to upcoming releases.

Even if you aren’t development minded there is ongoing activity around UI/UX Design, Documentation and other topics. No better day than today to help drive the future of WordPress.


WP Advertising Associate – Plugin Approved on WordPress.org

Great News!! The revised and renamed plugin WP Advertising Associate (previously titled WordPress Amazon Associate) has been approved for listing on the WordPress.org Directory Listing. Please update to the new plugin at your earliest convenience. You will need to deactivate and delete the existing WordPress Amazon Associate plugin however all settings will carry over to the new plugin and all existing code will remain functional.


WPAA – pending review for listing on WordPress.org

Hi Everyone:

I know it has been awhile since I’ve given any updates on the WPAA plugin. Last year I had several changes occur and to balance everything I had to stop support of the WordPress Amazon Associate plugin. I’m glad to announce that I have finally gotten things in order and as of yesterday I’ve re-submitted WPAA to WordPress.org for listing.

Due to operating agreement change with Amazon I’ve had to rename the plugin to WordPress Advertising Associate, however there may be a conflict with another plugin using this name.  Once the plugin is approved and I have final details on the name I’ll post the updated plugin here as well under WPAA > Downloads.

Thanks for the continued Support.


Current Thoughts & Musings

Programmatically overwritting the Database Connection of a Crystal Report File from Java

Recently I’ve had the “pleasure” of decommissioning existing applications in lieu of new systems coming online and as part of the process there was the need to Export Crystal Reports for Archival to ensure no loss of data. During this process the main stumbling block I experienced was how to overwrite the jndi DataSource defined in the report file so that I could execute the report from outside a web container.

The short answer to the question is that you need to overwrite the IConnectionInfo object for each Table used in the Crystal Report. For a first attempt I tried to simply iterate over each Table entry and update their ConnectionInfo.

DatabaseController dbController = clientDoc.getDatabaseController();
 
String connString = "jdbc:oracle:thin:@server:port:db";
 
PropertyBag bag = new PropertyBag();
bag.put("Connection URL", connString);
bag.put("Server Type", "JDBC (JNDI)");
bag.put("Database DLL", "crdb_jdbc.dll");
bag.put("Database Class Name", "oracle.jdbc.driver.OracleDriver");
 
for(Object table : dbController.getDatabase().getTables()) {
 
    ITable t = (ITable)table;
 
    // modifying t, bag is an existing instance of class PropertyBag
    t.getConnectionInfo().setAttributes(bag);        
    t.getConnectionInfo().setUserName("user");
    t.getConnectionInfo().setPassword("password");
 
}

However as it turns out when you modify the table connection information the Tables object is updated and the positioning of table objects is modified and as such during iteration not all Table connections are updated. To correct for this positioning change you can clone the Table objects and use a map to update the properties of the original table connections after updating the cloned Table ConnectionInfo.

DatabaseController dbController = clientDoc.getDatabaseController();
 
String connString = "jdbc:oracle:thin:@server:port:db";
 
PropertyBag bag = new PropertyBag();
bag.put("Connection URL", connString);
bag.put("Server Type", "JDBC (JNDI)");
bag.put("Database DLL", "crdb_jdbc.dll");
bag.put("Database Class Name", "oracle.jdbc.driver.OracleDriver");
 
Map<ITable, ITable> oldNewMap = new HashMap<ITable, ITable>();
 
for(Object table : dbController.getDatabase().getTables()) {
 
    ITable t = (ITable)((ITable)table).clone(true);
 
    // modifying t, bag is an existing instance of class PropertyBag
    t.getConnectionInfo().setAttributes(bag);        
    t.getConnectionInfo().setUserName("user");
    t.getConnectionInfo().setPassword("password");
 
    // WORKAROUND CODE
    oldNewMap.put((ITable)table, t);
}
 
// WORKAROUND CODE
for (Entry<ITable, ITable> e : oldNewMap.entrySet()) {
    dbController.setTableLocation(e.getKey(), e.getValue());
}

The Hidden Plugin Guidelines all WordPress Plugin Developers should know

Lately I’ve had some back and forth with the WordPress members that “oversee” the plugin repository. At the moment I am slightly annoyed at the way they go about “managing” the repository but I’ll leave that for another post.

After some back and forth I was finally able to get the Plugin Guidelines that they use for determining if a plugin is qualified for the repository. In the hopes that other plugin developers don’t go through what I experienced I’m including it below. These Guidelines are as-is and as-of August 10th, 2011 the date I received them.

1. Your plugin must be GPLv2 Compatible. GPLv3-only is not allowed because it is incompatible with the GPLv2 and with WordPress itself. A “GPLv2 or later” license is acceptable, as this gives users the freedom to choose the GPLv3 if they want.

2. If you don’t specify a GPLv2-compatible license, then what you check will be considered to explicitly be GPLv2 code. By committing code to our repository at all, you accept this condition.

3. No obfuscated code. We believe that obfuscated code violates the spirit, if not the letter, of the GPL license under which we operate. The GPLv2 specifically states “The source code for a work means the preferred form of the work for making modifications to it.” Intentionally obfuscated code is not the preferred form, and not allowed in the repository under any circumstances. However, note that some systems, like Paypal donation buttons, use encoded code as part of their normal operating mechanism. This is not considered to be “obfuscated” as this is simply how these types of systems operate and it is not a choice by the plugin author. These types of things are acceptable, but may result in the author being questioned about it for edge cases. If a non-encoded method for such services is available, use it.

4. Trialware is not allowed in the repository. It’s perfectly fine to attempt to upsell the user on other products and features, but a) not in an annoying manner and b) not by disabling functionality after some time period.

5. Serviceware plugins are defined as plugins that merely act as an interface to some external third party service (eg. a video hosting site). Serviceware plugins ARE allowed in the repository, as long as the code in the plugin meets all other conditions. These are allowed even for pay services, as long as the service itself is doing something of substance. Creation of a “service” which does nothing put to provide keys or licenses or anything similar for the plugin, while the plugin does all the actual work, is prohibited. Moving arbitrary code into the service so that it can appear to do some work is also prohibited. This will be handled on a case by case basis and our judgment on any given case is final.

6. No “phoning home” without user’s informed consent.

a. No unauthorized collection of user data. For example, sending the admin’s email address back to your own servers without permission of user is not allowed. Asking the user for an email address and collecting if they choose to submit it is fine. All actions taken in this respect MUST be of the user’s doing, not automatically done by the plugin.

b. All images and scripts shown should be part of the plugin. These should be loaded locally. If the plugin does require that data is loaded from an external site (such as blocklists) this should be made clear in the plugin admin.

c. In general, things like banner or text link advertising should not be anywhere in a plugin, including on its settings screen. Advertising on settings screens is generally ineffective anyway, as ideally users rarely visit these screens, and the advertising is low quality because the ad-systems cannot see the page content to determine good ads. So they’re best just left off entirely. Putting links back to your own site or to your social-network-system of choice is fine. Furthermore, if the plugin does include advertising from a third party service, it must default to completely disabled, in order to prevent tracking information from being collected from the user without their consent.

7. No sending executable code via third-party systems. Use of third-party systems is acceptable in a service-client type of model, but sending actual PHP or other executable code over the network is considered a security risk. Executing outside code like this is not allowed except for specific and very carefully considered cases (such as during upgrades, for example).

8. The plugin most not do anything illegal, or be morally offensive. That’s subjective, we know. Tough. If we don’t like it for any reason, it’s gone. This includes spam, for whatever definition of spam we want to use.

9. You have to actually use the subversion repository we give you in order for your plugin to show up on this site. The WordPress Plugins Directory is a hosting site, not a listing site.

10. The plugin must not embed external links on the public site (like a “powered by” link) without explicitly asking the user’s permission. Any such options in the plugin must default to not showing the credit/link.

11. Plugin should not hijack the blog admin. It is fine to include an Upgrade prompt on the plugin admin page but not throughout the blog. It is acceptable to embed a widget on the dashboard but this should be the same size as others and be dismissable. It’s fine to put an error message at the top of the admin for special cases, but it should be linked to a way to fix the error and it should be infrequent. Any form of “nagging” is absolutely prohibited.

12. The plugin page in the directory should include no more than 12 tags. No sponsored links are permitted there. Using the names of other plugins as tags should be carefully considered.

13. Frequent commits can be seen as gaming the Recently Updated lists. Try to limit commits to prevent this. All commits should include a commit message describing the content of the commit, in reasonable detail. Frequent blank commit messages makes it hard for other developers and users to follow what is changing in the plugin. Blank commit messages may also be cause for rejection of the commit.

14. All code changes to a plugin that has a Stable Tag of “trunk” must result in the version number being upgraded. For the trunk and tags method, trunk can be continually updated without version number changes, while tags should generally not be updated ever past the initial tagging.

15. A complete plugin must be available at the time of submission. It would be appreciated if this is linked to in the plugin description.

16. We reserve the right to alter this list in the future. We reserve the right to arbitrarily disable or remove any plugin for any reason whatsoever. Basically, this is our repository, and we will attempt to maintain a standard of conduct and code quality. We may not always succeed, but that is our goal, and we will do whatever we feel is necessary in furtherance of that goal.

In my opinion there are some questionable items in the list, myself I fell afoul of #6 as I wanted to have actual statistics on usage of my plugin, which is something that WordPress itself does so still not sure why it is present in the guidelines for a no-no with plugins.


How to Correctly include jQuery in your WordPress Plugin

One of the most frustrating items I’ve come across recently is that alot of WordPress plugins include their own version of jQuery or similar JavaScript library. Please Stop!!!!

What you may not realize is that WordPress comes bundled with the jQuery library and to boot they provide a simple method to not only include it in your website but to ensure that it only gets included once. Please familiarize yourself with the wp_enqueue_script function as it will make your plugins cleaner and help to mitigate conflicts with other plugins and templates.

To include jQuery, Scriptaculous, or similar libraries is a simple 2 step process.

  1. Register a method for the init hook
    This is necessary as the wp_enqueue_script should be called upon the init stage of WordPress execution.
    add_action('init', 'plugin_init');
  2. Enqueue the jQuery library
    function plugin_init() {
        wp_enqueue_script('jquery');
    }

There you have it you have now included jQuery into the website that uses your plugin.


Rendering IE 8 in IE 7 compatibility mode

Unfortunately Microsoft over the years has left us disappointed year after year with their web browser Internet Explorer. Yes, I know we all have had frustration with the little quirks that all browsers have but Internet Explorer has been the bane of the web developer. IE 8 like previous incarnations appears at first to be step up until you look closely and notice the issues with its animation rendering capability.

Anyhow enough rambling, Recently I came across a nifty little meta tag that IE 8 supports that tells it to render the page content as IE 7 would. Quickly and easily removing any quirks introduced to your website that are IE 8 specific. Now instead of 2 or 3 version of IE that you need to support you are back down to simply IE 7 or if you are one of the unfortunate ones, IE 6 as well.

<meta content="IE=EmulateIE7" http-equiv="X-UA-Compatible">

Enjoy, and here is to hoping that for IE 9 they do a full rewrite of this web browser known as Internet Explorer


Testing if JavaScript method Exists

When developing within a large web application it may be needed to check if a JavaScript function/object exists prior to being calling. The benefits to checking if the method exists are:

  1. No JavaScript errors are Generated.
  2. if needed you can dynamically load and initialize your method or object

In most cases you won’t need to test for a function but in the rare cases that you find yourself not sure of what has been loaded into the DOM (Document Object Model) you can check by simply calling window.methodName. By wrapping it in a if statement it will let you know if the method exists.

if( window.methodname ) {
  // method exists
} else {
  // method does not exist
  function methodName() {
 
  }
}