WordPress Plugin: Open Files In New Tab or Window

WPPlugin-OpenFilesNewTab

On a recent WordPress project I had a requirement that any files be opened in a new tab or window. Now this can be easily accomplished by the users when they create the post or page by linking to the file and marking the checkbox “Open Link In A New Window/Tab”. But we all know users can’t be trusted so in order to “double check” them I wrote a WordPress plugin that will hunt the page for anchor tags that link to something with a file extension, and simply add “target=’_blank'” to them.

Basically all the plugin does is enqueue a jQuery script that does the work. I got the idea to use the jQuery .filter() method from @nickf and the regular expression (because I suck at them) from @már-Örlygsson.

jQuery Open Files In New Tab Or Window

Links and References

Fork On Github

WordPress Plugin Page

jQuery Script

Stackoverflow: Javascript regex for matching/extracting file extension

Stackoverflow: jQuery Selector Regular Expressions

Easy KnockoutJS Pagination with Data Tables

Atom

Data Tables makes it super easy to add pagination, searching, and sorting to tabular data bound with KnockoutJS

TL;DR: DataTables provides simple pagination, sorting, and searching capabilties to tabular data bound with KnockoutJS – DEMO

So I was working on a WordPress plugin that pulled data from a SQL Server database via ASP.Net Web API and was using KnockoutJS to make the binding super easy. This worked great and was surprisingly simple to accomplish. However some of the data that was coming back was over 1,000 rows. This obviously didn’t look great to the users and was not really practical nor usable.

So I started down the path of handling paging at the API level and passing the page as a parameter… Yada Yada Yada you’ve been there.

But then I found DataTables … an excellent table plugin for jQuery.

DataTables is a plug-in for the jQuery Javascript library. It is a highly flexible tool, based upon the foundations of progressive enhancement, and will add advanced interaction controls to any HTML table.

Hey I need that!

DataTables provides extremely simple pagination, searching, sorting and more functionality to any HTML table. So in order to get this to work you can use the declarative foreach feature of Knockout to build out your table with the JSON data coming back from your API.

Enough of the boring stuff, here’s the code.. And here’s the demo in action using JSON data from the Donor’s Choose API.

Bootstrap Styles for Gravity Forms WordPress Plugin

banner-772x250

TL;DR: WordPress Plugin to apply Bootstrap Styles to Gravity Forms

Everyone loves Gravity Forms and everyone loves Bootstrap. But they don’t look too good when combined. So I set out to find a nice way to combine the two. After some Googling around I came across Devin Walker’s gist to apply Bootstrap styles to Gravity Forms. After a few tweaks using that I decided to package it up in to a WordPress plugin.

bootstrap gravity form

To accomplish this I modified Devin’s CSS and then properly enqueue the style into the WordPress theme with the plugin. Pretty straightforward.

Usage

  1. Install and enable the plugin via Dashboard or download
  2. In Gravity Forms Settings, turn off “Output CSS”
  3. In Gravity Forms Settings, turn on “Output HTML5″
  4. Done! Have a beer.

Links

Download Plugin

Fork on Github

Have an issue? Report on Github

Hosted Elasticsearch

Hosted Elasticsearch

Hosted Elasticsearch provides you with the awesomeness that is Elasticsearch without the headaches of managing the server.

I’ve blogged about installing Elasticsearch and securing Elasticsearch. But what about hosted Elasticsearch? There are several great options out there if you don’t want to deal with managing a server, updates, security, and all the fun that comes along with running your own managed services.

Most of these provide fancy management interfaces, one click scaling, SSD options, and built in security.

Qbox.io

Qbox.io provides managed cloud hosting for Elasticsearch on dedicated clusters running on EC2, Rackspace, or Softlayer.

Qbox is a dedicated hosting solution for Elasticsearch that aims to be as simple and intuitive as possible for the application developer. Conceptually, what we provide is similar to any other cloud-hosted database. Through our dashboard, you can launch your own Elasticsearch “cluster”. A cluster is a collection of servers behaving as “nodes”, which can be added/removed on the fly for scale.

Securing elasticsearch can be a pain in your ass. Trust me. But Qbox handles all that for you with free SSL by default, IP whitelisting, and HTTP Basic authentication options. And Qbox works with Elasticsearch sister products Kibana and Logstash.

While there is no free pricing tier, they do give you $35 in credits to use upon signing up just to make sure the service fits your needs. For about $32/mo you can run a 512MB RAM and 20GB Disk server on Rackspace. They also offer SSD plans.

For what it’s worth, of this list of service providers, Qbox is the only one listed as an official Elasticsearch partner.

Found

Found allows you to build your own dedicated hosted Elasticsearch cluster in minutes. Found’s infrastructure runs on Amazon’s EC2 over several different regions with SSD options and fully configurable specifications. There’s also the option to add fault tolerance for spanning your cluster up to 3 data centers.

Found also does not provide a free tier, instead offering a 14 day free trial. However unlike Qbox, a credit card is not required to get started.

The cheapest plan runs at about $30/mo in a single data center with 256MB RAM and 2GB of storage. But Found only charges for what you actually use.

You only pay for reserved memory and disk, and usage is billed by the hour. This gives you the flexibility to create temporary test and development clusters – when you’re ready to move on, you simply delete them, hence you stop paying for them.

All communication runs over SSL and their clusters run in isolated containers giving you the options to create custom Access Control Lists which gives you fine control over who and what can access your cluster. Additionally, Found will keep a continuos backup of your indices on Amazon S3.

Lastly, they maintain a fantastic blog on all things Elasticsearch.

Bonsai

Bonsai is yet another option for hosted Elasticsearch that has similar features to the aforementioned services. It provides easy setup on super fast SSD machines that are replicated in triplicate and backed up daily. All plans include Multi-Zone replication, SSL, secure API access, continuous backups and monitoring.

The cheapest plan at Bonsai is $50/mo for 1GB RAM and 10GB of storage.

IndexDepot

IndexDepot out of Berlin, Germany has an inexpensive hosted Elasticsearch option to get started. For $15/mo a “Micro” instance includes 1 managed index, 10,000 documents, 1 GB storage with a free 30 day trial. Their infrastructure, like most of the others, runs on Amazon Web Services. They offer similar features to the other solution including access control, monitoring, backups, and more.

Facet Flow

Facet Flow is hosted Elasticsearch for Microsoft Azure. Facet flow has similar features as the above service providers although nowhere on their site do they explicitly address security – which I think is one of the more important aspects of choosing a hosted Elasticsearch provider.

One thing Facet Flow does offer that’s unlike all the other services listed is a “Sandbox” plan giving you free access to an index that can store 5,000 documents, 500MB of storage, 1 shard, and 0 replicas. Not something you’d run in production – but definitely an option to get started.

Searchly

Aside from Facet Flow’s sandbox plan, Searchly provides the cheapest option to get up and running. For $9/mo you can manage 3 indices with 100MB SSD storage, Access Control List, SSL, and complete API access. And they have a free plan where you can run 2 indices and 5MB of storage. Searchly runs on the US data centers of Amazon EC2.

FWIW – Searchly provides a pretty slick Elasticsearch plugin for WordPress.

Summary

There seems to be new hosted Elasticsearch options popping up all the time. If I’ve missed any, please let me know in the comments. But I think these are the front runners and all offer similar solutions and level of service. Your choice will likely depend on budget and available features.

If I had to choose for you at this point in time, I’d suggest Found or Qbox as they appear to be the clear leaders in the space.