Quick way to determine if php is running at the command line

Many times it is necessary to determine if the php script is running on the command prompt. Recently I wrote a php shell script which could also be run from a browser and needed to decide in the code if to output a '\n' or a ‘html break’ after a text line.

The following simple function returns a true if the script is run from a command prompt and false otherwise.
(more…)

Read More

Filter your wordpress content by location

Today I’ve released my first WordPress plugin, Country Filter. The Country Filter plugin allows you to control the visibility of WordPress elements depending on the users country of origin. You can hide or show certain elements of a page or some sections of a post from users browsing from a particular country. For example you could have a ‘donate’ button that displays only if the user is browsing from France, India or UK.

Plugin download and installation instructions can be found here.

Read More

Accessing WordPress plugins remotely

With a plethora of wordpress plugins available for every conceivable purpose, there is a huge amount of data that is stored on a typical wordpress installation. We could easily use that data across domains or display them using widgets on the desktop. Take for example the WP-UserOnline plugin that displays how many users are currently online on your blog. We could easily write a proxy to grab that information from the plugin and use it in a Yahoo Widget or in a AIR application on the desktop, so you can see the number of users online without having to visit your site. Or you could use the information on some other site.
(more…)

Read More