Easy Adsense and Easy Adsense Redux are very powerful WordPress plugins. However, there have been some concerns raised on some forums regarding the default settings, what they’re used for and how the revenue sharing works. Why do the defaults need to be both compressed and encrypted, is there something to hide?
Irrespective of the rightness or wrongness of those concerns, replacing the supplied defaults with your own is straightforward, although it does take a few steps and requires some PHP knowledge.
This is the process that worked for me. It requires an amount of PHP knowledge, the ability to use certain applications including phpMyAdmin, and a WordPress admin’ account. By reading any further on this page you acknowledge that you are a grown up* and that you accept full responsibility for your actions and, if you follow any of the steps on this page, you undertake this at your own risk.
* the mature kind, not the kind that buys hot coffee and then complains** when you spill it on yourself and get scalded
** via litigation, that it’s the fault of someone else, anyone will do as long as you don’t have to accept any responsibility
Attachments / Examples
The files referenced / linked to in this article have been converted to simple text files and so will display (in a separate window) but not run on this site. To use them save them to your PC, remove the .txt extension and put them all onto a web-server. For convenience they’re packaged here in a single zip file.
The contents of the file defaults.php are easily seen using the PHP code found in the file easy-adsenser.php
unserialize(gzuncompress(base64_decode(str_replace( “\r\n”, “”,$str)))) ;
as the basis:
This will print the defaults on the screen, copy and paste this into a file – use View/Source in your browser, this gives a cleaner display and shows HTML comments.
A little reformatting of the above file – i.e. adding returns at line ends, and trimming head & tail – gives:
This is a processed format suitable only for display. To re-encode it must be reformatted, however, it’s easier to edit it first. It is in the format of a set of key / value pairings of an array that is constructed and then used throughout the plugin:
[key 1] => value 1
[key 2] => value 2
The purpose of some of the keys is reasonably obvious from the Easy Adsense Settings page under WordPress:
ezText the displayed defaults shown in the Lead-in, Mid, and Lead-out text blocks (Adsense for content – ad unit)
ezWidget the displayed defaults shown in the Adsense Widget text block (Adsense for content – ad unit)
ezLU the displayed defaults shown in the Adsense Link-Units text block (Adsense for content – link unit)
ezSearch the displayed defaults shown in the Google Search text block (Adsense for search)
These are useful for showing the information required, however, Google gives you that anyway. What is not at all obvious is the purpose of the defaults for all the discrete sizes of ad blocks, e.g.:
At some point I may waste a day and trawl through the code to figure this out, but not today. For now I suggest you replace all of the above (obvious and not) with either your own Adsense settings, or an HMTL comment, or a mixture of both.
The remaining keys are of 2 types: those for Clickbank (all those starting with ‘cb’) and those for support. NB: Clickbank has been removed from the Redux version. If you are using the full version I suggest you delete the contents of all Clickbank items, replacing them with a space.
all instances of <!– with html_comment_start
all instances of –> with html_comment_end
all instances of < (less-than signs) with <
all instances of > (greater-than signs) with >
all instances of html_comment_start with <!–
all instances of html_comment_end with –>
all instances of ” (double apostrophe) with "
all instances of ‘ (single apostrophe) with \’
We now convert the key / value pairings to a format suitable for PHP, ie:
‘key 1′ => ‘value 1′,
‘key 2′ => ‘value 2′
Note the absence of a comma after the last pairing. Add the following as a header:
$defaults_arr = array (
and the following as a footer:
Time to encode this ready for use. To do this we have to reverse the decoding process using
The following encoding script expects the result of the above editing to be in a file named defaults_new_decoded.php
This will output the new encoded string onto the screen – it will look like garbage. Copy all of it and pasted the result into a new file, defaults_new.php. Edit this file, adding the following as a header:
$str = ‘
and the following as a footer:
The original defaults.php file makes this look tidier by inserting carriage-return / line-feed after 77 characters per line, this is optional and doesn’t affect the result.
To check your work simply unpack your new defaults file using the same method, the script below uses the file defaults_new.php as input rather than defaults.php.
This will have the same formatting as when we unpacked the original file – use View/Source in your browser, this gives a cleaner display and shows HTML comments.
Rename defaults_new.php to defaults.php and load this onto your site under the easy-adsenser plugin directory. Almost done, 1 crucial step left.
Remove Old Settings
If you’ve already loaded & run Easy Adsense on your site you’ll need to deactivate it then use phpMyAdmin (should be part of your CPANEL) to delete the settings from your database. NB: using the WordPress admin account take note of any settings for Easy Adsense you have put in already so you can put it back the same way.
In the table wp_options, look for any row that starts with: ezAdsense, there will be one for each theme that has been configured. Delete this row.
Activate the plugin, check the result using the Easy Adsense settings page via the WordPress admin.
- If you want a completely empty Easy Adsense defaults file with no settings in it at all just download the file from defaults_new.php and rename it defaults.php.
- If you want a defaults.php file with your own adsense settings then, because only you have these settings, you’ll need to follow the steps in this entire article.
- If you want the full set of files I used to develop & test a new defaults.php file just download the single zip file.
- If you want a rebundled Easy Adsense with the blank defaults.php, I don’t have it. To create it, take the Easy Adsense zip file from WordPress plugins and update it, overwriting defaults.php with the blank defaults file (see the first summary point).
NB: If you’ve already loaded & activated Easy Adsense then you have to manually remove the defaults from your database, simply loading a new defaults file won’t overwrite them. See the section “Remove Old Settings” (above).
Contact me if you have any questions or spot any obvious flaws.