Brewsterware

July 7, 2012

Updates for the wordpress affiliate link cloaker plugin

Filed under: PHP and MySQL,Wordpress — Joe Brewer @ 6:02 pm

It’s been nearly a year since my last post, and many months since the plugin last had any updates. This post outlines the new features in version 1.00.03:

Removing data from the redirect log

The way that the plugin works out how many redirects there are for each address is by logging each redirect and counting the redirects on the link and address pages. One of the things that I didnt account for in the previous version was how to delete or reset this data. Now, when you uncheck the option “count redirects” on the link page and save the options, the entries from the log are removed. Re enabling this option will effectively reset the counter.

Case sensitive keyword/phrase searching

This is a feature that had been requested a little while ago. It enables keyword/phrase searching to be set to case insensitive – this means that the keyword “television” will find and replace “Television” (and other combinations of upper/lower case) in blog posts.

Redirects graph

Under the “count redirects” option on the links page there is now an option to show a traffic graph. Once the check box has been checked and saved, the graph will show at the bottom of the page. This shows the redirects for the current month.

May 22, 2011

Region detect wordpress plugin

Filed under: PHP and MySQL,Wordpress — Joe Brewer @ 2:57 pm

Region detect is a plugin for WordPress that detects the country that the current visitor is browsing from. It can display the country to the user; something like:

Hello visitor from %%COUNTRYNAME%%

This is done by using the codes %%COUNTRYCOD E%% and %%COUNTRYNAM E%% in your posts (take out the spaces).

The plugin makes the two character ISO 3166-1 country code and country name available to other plugins – just declare the global variables $rdISO3166_1 and $rdCountryName.

(more…)

December 14, 2010

WordPress autoblogging plugin

Filed under: Caffinated Content,PHP and MySQL,Software,Wordpress — Joe Brewer @ 5:22 pm

So, further to my previous post I now have a fully functioning autoblogging plugin for wordpress based on all of requirements of using cron jobs and other bits.

It wasnt as easy as I initially thought it would be as I’ve had to pretty much touch every line of code in the software – I wonder if it would have been easier to write the plugin from scratch. Anyway if you want to try it out I am looking for beta testers for this software which I have named Expresso Content. Feel free to sign up and get this plugin for free – this offer wont last long.

%%COUNTRYCODE%% – %%COUNTRYNAME%%

August 22, 2010

strptime for windows

Filed under: PHP and MySQL — Joe Brewer @ 2:36 pm

I was searching for a windows implementation for the php function strptime, however the best help/advice that I could find was read the source code and write it yourself. Here is my implentation that I knocked up with date_parse_from_format so you can use it on version of php less than 5.3.0

<?php
if (!function_exists('date_parse_from_format')) {
	function date_parse_from_format($format, $date) {
		$returnArray = array('hour' => 0, 'minute' => 0, 'second' => 0,
			'month' => 0, 'day' => 0, 'year' => 0);

		$dateArray = array();

		// array of valid date codes with keys for the return array as the values
		$validDateTimeCode = array('Y' => 'year', 'y' => 'year',
			'm' => 'month', 'n' => 'month',
			'd' => 'day', 'j' => 'day',
			'H' => 'hour', 'G' => 'hour',
			'i' => 'minute', 's' => 'second');

		/* create an array of valid keys for the return array
		* in the order that they appear in $format
		*/
		for ($i = 0 ; $i &lt;= strlen($format) - 1 ; $i++) {
			$char = substr($format, $i, 1);

			if (array_key_exists($char, $validDateTimeCode)) {
				$dateArray[$validDateTimeCode[$char]] = '';
			}
		}

		// create array of reg ex things for each date part
		$regExArray = array('.' => '\.', // escape the period

		// parse d first so we dont mangle the reg ex
		// day
		'd' => '(\d{2})',

		// year
		'Y' => '(\d{4})',
		'y' => '(\d{2})',

		// month
		'm' => '(\d{2})',
		'n' => '(\d{1,2})',

		// day
		'j' => '(\d{1,2})',

		// hour
		'H' => '(\d{2})',
		'G' => '(\d{1,2})',

		// minutes
		'i' => '(\d{2})',

		// seconds
		's' => '(\d{2})');

		// create a full reg ex string to parse the date with
		$regEx = str_replace(array_keys($regExArray),
			array_values($regExArray),
			$format);

		// Parse the date
		preg_match("#$regEx#", $date, $matches);

		// some checks...
		if (!is_array($matches) ||
			$matches[0] != $date ||
			sizeof($dateArray) != (sizeof($matches) - 1)) {
			return $returnArray;
		}

		// an iterator for the $matches array
		$i = 1;

		foreach ($dateArray AS $key => $value) {
			$dateArray[$key] = $matches[$i++];

			if (array_key_exists($key, $returnArray)) {
				$returnArray[$key] = $dateArray[$key];
			}
		}

		return $returnArray;
	}
}

if (!function_exists('strptime')) {
	function strptime($format, $date) {
		$dateArray = array();

		$dateArray = date_parse_from_format($format, $date);

		if (is_array($dateArray)) {
			return mktime($dateArray['hour'],
				$dateArray['minute'],
				$dateArray['second'],
				$dateArray['month'],
				$dateArray['day'],
				$dateArray['year']);
		}
		
		return 0;
	}
}
?>

February 6, 2010

Tracker progress – part 1

Filed under: Evolution of a new tracker,Internet,PHP and MySQL — Joe Brewer @ 7:08 pm

So now I can create campaigns for offers, landing pages, offer rotations and landing page rotations.  I’ve only really tested sending traffic directly to offers, but I’ve only got one real report (and that is still not 100% finished).

Here is the report for anyone that is interested.

Older Posts »

Powered by WordPress