Posts Tagged ‘PHP’

Hiding an email address from spambots and spiders

Monday, June 8th, 2009

spider-webs

There is an army of spiders out there.  Some, like GoogleBot, you want scanning your site to be listed in their search engine. Many however have a devious purpose–to collect email addresses to add to spam email lists. If your email address is already out there, then there is no pulling it back in. The only way to eliminate spam is to create a different address and inform all your contacts that you have changed email addresses.

Ways to combat email spam:

  • A non-linked image
  • HTML entity encoding
  • Client-side obfuscation/abstraction (via JavaScript)
  • Server-side redirect
  • Contact form (no email address listed)

If your email address, is spelled out with any client viewable code, it is possible to obtain. Now that search engines can read PDF documents, including your email within a PDF as text may be suspect. I have not gone into great depth on any of them below but have provided a short description of each method with advantages and disadvantages listed. (more…)

Features and characteristics of a great 404 error page

Friday, May 23rd, 2008

No matter how carefully you design your site, visitors will always request a page that is missing, moved, or non-existent (especially if you experiment with your site structure frequently). This past week, I’ve been obsessed with HTTP 404 errors and working on creating a better 404 Not Found page. The default 404 page for WordPress offers the opportunity to search the blog, but you should go another step. Usability is one of (if not the) key trait of a great website. If thought has gone into even your 404 error page, then I’d guess that much thought has been put into your entire site. (more…)

Change media and images to full size in WordPress media gallery

Wednesday, May 21st, 2008

I’ve been familiarizing myself with WordPress 2.5’s new media gallery. If you’ve visited my blog before, you know I don’t upload many images, but I’m hoping to upload many images to my wife, Rachel Steely’s website. I was annoyed to find out that the default image posting size is medium (which is about 300px). On top of that, if you select full size, it doesn’t mean full size. It means your WordPress theme’s column width. So unless you are using Kubrick your media size will not be your column width. (more…)

Plain text link to HTML with a PHP function and regular expressions

Wednesday, May 7th, 2008

If you have ever wanted to turn a plain text link, http://www.smjdesign.com, into a "linked" HTML version, http://www.smjdesign.com, you can now. Pass the following function your entire text field and it will find all your links and return tagged HTML.

function replace_plain_text_link($plain_text) {
$url_html = preg_replace(
'/(?<!S)((http(s?):\/\/)|(www.))+([\w.1-9\&=#?\-~%;\/]+)/',
'<a href="http$3://$4$5">http$3://$4$5</a>', $plain_text);
return ($url_html);
}
echo replace_plain_text_link("hi this is dummy text before
http://www.smjdesign.com hi this is dummy text after")

(more...)


My Sites