PHP implementation for jQuery plugin