Dark Mood V2 WordPress theme, editing wordpress files, encoding PHP

It may come as no surprise to some to find that freely available themes have got advertising embedded in them by default. It came as a surprise to me, mind you! I downloaded and installed the Dark Mood V2 wordpress theme by Ed Canape and found that in the footer file there was a PHP function that positioned some adverts. Not rocket science, but I wasn’t happy with the kind of ads that appeared. One was a pay per click affiliate program, one about Asian entertainment (ooer…) and one about Philipine paradises. However, what really ticked me off was the fact that the function had been encoded so as to make it hard to unpick it and remove said adverts.

Of all the encoding methods available to PHP programmers, possibly the best is from Zend. One of the most pointless is gencoder (although free). Luckily, it was gencoder that had been used on this occasion. The file looks like this:

encoded php

Now, as you can see there is no easy way to get into the code and remove the advertising links. However, there are two possibilities.

Firstly, you can create a CSS rule in your stylesheet which sets the footer ‘a’ display to be none:

footer a {
display:none;
}

All this does is remove any clickable links in the footer, but leaves the remaining text. This is at best a workaround, but can get you out of a fix if you are in a hurry.

The second thing to do is decode the file! Again, there are two ways to achieve this, but probably the simplest is to edit the ‘eval’ statement to read ‘print_r’ instead. If you then run the code in your browser you’ll see that it makes a bit of a mess visually, but you can still right click and ‘view source’. What you are looking for is at the bottom of the page:

if((isset($v) AND $v==0) OR (isset($t) AND $t==false)){die('This script is protected by <a style"color:cyan\" href="http://www.gencoder.sf.net\"><b><font color"#330099\">G-Encoder</font></b></a>');}echo "<div id"footer\">n";
echo " Powered by n";
echo " <a href="http://wordpress.org\">WordPress</a>n";
echo " and Design by Ivy's <a href="http://www.rubberstampguides.com/\">Rubber Stamp</a> n";
echo " Guiden";
echo " <p><a href="http://www.kirrhi.com/\">Pay Per Click Affiliate Program</a> | <a href="http://yeinjee.com/asianpop/tag/asian-entertainment/\">Asia Entertainment</a> | <a href="http://www.paradise-philippines.biz/\">Paradise Philippines</a></div>n";
echo "</div>n";
echo "n";
echo " <?php wp_footer(); ?>n";
echo "n";
echo "</body>n";
echo "</html>n";

Now you can see the code more clearly, and you can easily see what needs to happen. The last four lines are all you need… in fact, one of those can be deleted! What you really need is the call to the wordpress footer routines and to close the body tag and close the html. This is all that is necessary to complete the footer file in wordpress. Armed with this knowledge, go back and change the ‘print_r’ statement if you like, but better yet, just delete all of that guff. In it’s place simply add the following few lines of code. You can leave out the ‘div’ tags if they are not needed:

<div class="footer">
<?php wp_footer(); ?>
</div>
</body>
</html>

and that’s it. Save the file and you have got yourself an advert free footer space on your wordpress blog.

Thanks (as ever) to Alex Blanc for his timely and ultimately very simple solution to the problem, and no thanks whatsoever to the person who decided to a) put adverts in the footer, and b) encode them at all. I believe each person needs to have the right to choose whether to display adverts, and in this case I chose most strongly not to!

8 thoughts on “Dark Mood V2 WordPress theme, editing wordpress files, encoding PHP

  • 2 August, 2007 at 10:31 am
    Permalink

    hi ,

    but I wasn’t happy with the kind of ads that appeared. One was a pay per click affiliate program, one about Asian entertainment (ooer…) and one about Philipine paradises.

    here is my point of view: a blogger has the choice to use any theme out there. if they dislike themes with sponsored links, they simply don’t have to use it. but i will also release more free themes w/o sponsored links.

    -ed

  • 2 August, 2007 at 12:20 pm
    Permalink

    i don’t see anything wrong if the designer of the free template place sponsored links on his design because in the first place, its his work and he has the right to place those ads since he’s giving the template away for FREE. i saw other free templates that places their adsense on the template itself. so im not sure why people react on these templates with sponsored links or adsense account when they got those templates for FREE. i mean, the least we can do is let them place their links on the template. maybe its one of their ways to earn money. and yeah… in the first place, if you don’t want those sponsored links, then you can just purchase it. im sure purchasing the template will not include those sponsored links. now, after purchasing it and you still find the links, then you have all the right to complain.

  • 2 August, 2007 at 9:06 pm
    Permalink

    Ed – many thanks for taking the time to visit and add your thoughts to the post. I really do appreciate this as it demonstrates a commitment to what you do. I certainly respect that. I also look forward to seeing themes without the ads – your work is good, and I would be keen to use and ‘champion’ any themes giving you due credit.

    Frank – thanks for your comment and opinion. I guess my reaction is that if the theme is free it should be able to be customised and not locked down to prevent a user making changes to it. OK – there are obvious IP issues and licenses could be issued with themes to stipulate how it is to be used. If that is the case then a license file should be included within the download and possibly also be a comment in the code itself. Otherwise it simply isn’t going to stand up. GNU licenses, anyone? The last part of your post refers to the rights I have to complain. Are you seriously suggesting that I *don’t* have the right to complain on my own blog? You’d really take the fun out if things… 😉

  • 5 March, 2008 at 2:28 pm
    Permalink

    How to decode this php thing without eval?

  • 5 March, 2008 at 7:56 pm
    Permalink

    Do you really need to decode it? Can you not simply remove all of the encrypted text and replace it with the wordpress footer routine as detailed above? Try deleting everything in the footer file and copying this in its place:
    <div class="footer">

    </div>
    </body>
    </html>

    Obviously, if you don’t have a ‘footer’ class defined in your CSS then you may not need the first line here (or the closing ‘div’ tag on line 3, either). All you are doing then is calling the standard wordpress footer in your footer file. You should see nothing where before you were seeing links.

    I haven’t tried the theme file you made a link to, so am not sure exactly what is in that encoded block anyway. Let me know how you get on.

  • 26 June, 2008 at 6:43 pm
    Permalink

    thank you very useful although i removed the links but i still remain with the text unsolved

Leave a Reply

Your email address will not be published. Required fields are marked *

* Copy This Password *

* Type Or Paste Password Here *

3 × five =