<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	>

<channel>
	<title>Aneko Studios</title>
	<atom:link href="http://anekostudios.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://anekostudios.com</link>
	<description>What One Designer Learns, She Passes On To Others.</description>
	<pubDate>Sat, 19 Apr 2008 17:31:52 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.5</generator>
	<language>en</language>
			<item>
		<title>Back on Track</title>
		<link>http://anekostudios.com/2008/04/19/back-on-track/</link>
		<comments>http://anekostudios.com/2008/04/19/back-on-track/#comments</comments>
		<pubDate>Sat, 19 Apr 2008 17:31:52 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://anekostudios.com/?p=117</guid>
		<description><![CDATA[Halle-freakin&#8217;-lujah.
Okay, I know the theme is still your default &#8220;Kubrick&#8221;, and my categories are gone (due to a REALLY stupid mistake on my part), but it&#8217;s back.  Posts, comments - it&#8217;s all good.  
But hey, it&#8217;s Saturday, and I have stuff to plant.  So I&#8217;m taking a break for a bit.
]]></description>
			<content:encoded><![CDATA[<p>Halle-freakin&#8217;-lujah.</p>
<p>Okay, I know the theme is still your default &#8220;Kubrick&#8221;, and my categories are gone (due to a REALLY stupid mistake on my part), but it&#8217;s back.  Posts, comments - it&#8217;s all good.  </p>
<p>But hey, it&#8217;s Saturday, and I have stuff to plant.  So I&#8217;m taking a break for a bit.</p>
]]></content:encoded>
			<wfw:commentRss>http://anekostudios.com/2008/04/19/back-on-track/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Oh this is awesome.</title>
		<link>http://anekostudios.com/2008/04/07/oh-this-is-awesome/</link>
		<comments>http://anekostudios.com/2008/04/07/oh-this-is-awesome/#comments</comments>
		<pubDate>Mon, 07 Apr 2008 14:31:25 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<guid isPermaLink="false">http://anekostudios.com/2008/04/07/oh-this-is-awesome/</guid>
		<description><![CDATA[
]]></description>
			<content:encoded><![CDATA[<p><object width="425" height="355"><param name="movie" value="http://www.youtube.com/v/a0qMe7Z3EYg&#038;hl=en"></param><param name="wmode" value="transparent"></param><embed src="http://www.youtube.com/v/a0qMe7Z3EYg&#038;hl=en" type="application/x-shockwave-flash" wmode="transparent" width="425" height="355"></embed></object></p>
]]></content:encoded>
			<wfw:commentRss>http://anekostudios.com/2008/04/07/oh-this-is-awesome/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Orange Crush</title>
		<link>http://anekostudios.com/2008/03/28/orange-crush/</link>
		<comments>http://anekostudios.com/2008/03/28/orange-crush/#comments</comments>
		<pubDate>Fri, 28 Mar 2008 20:22:54 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<guid isPermaLink="false">http://anekostudios.com/2008/03/28/orange-crush/</guid>
		<description><![CDATA[Well, I know it&#8217;s the eve of the 2.5 release - I believe we&#8217;re on RC2 right now.  According to the wp-testers and wp-hackers lists, it&#8217;s pretty close to being the next official release.  However.  Due to popular demand (of which I am astounded) I&#8217;ve finally upgraded the Orange Crush theme for [...]]]></description>
			<content:encoded><![CDATA[<p>Well, I know it&#8217;s the eve of the 2.5 release - I believe we&#8217;re on RC2 right now.  According to the wp-testers and wp-hackers lists, it&#8217;s pretty close to being the next official release.  However.  Due to popular demand (of which I am <em>astounded</em>) I&#8217;ve finally upgraded the Orange Crush theme for 2.3.x.  Notes are in the &#8220;readme&#8221; file in the download.  </p>
<p>Now, I know someone reported a &#8220;Stack Overflow&#8221; error when it comes to the theme, but to be honest I cannot replicate it for the life of me.  I&#8217;ve had several experts look at my code (it&#8217;s stemming from the functions.php file) and no one can find anything in that file that would cause such an error.  Believe me when I say I&#8217;ve tried to replicate it, and cannot. <span id="more-115"></span> I have had one complaint about it, and the person who complained did work with me to try and figure it out, but the only solution I could come up with for him was to delete certain sections of the functions.php file - these sections would pretty much disable the stylesheet switcher.</p>
<p>If anyone else wants to try and give it a shot, please feel free to do so and let me know your findings.  But for now - since I&#8217;ve only heard one complaint, I&#8217;m not going to mark it as something huge and I&#8217;m letting it go.</p>
<p>I&#8217;ve also fixed the reported bug of the &#8220;jumping sidebar&#8221; - at least on everything I have to test on.  So if anyone comes across this issue still, please let me know.</p>
<p>I&#8217;m off now - I&#8217;m going to try and get it working in 2.5.x - even though tere&#8217;s no official release yet.  Might as well, eh? <img src='http://anekostudios.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
<p><a href="http://www.anekostudios.com/downloads/orange_crush_23x.zip">Download Orange Crush for 2.3.x here.</a></p>
<p><em>NOTE: initial testing of this version on WordPress 2.5 shows that it works fine.  I&#8217;m having no problems - so if it remains this way, then I think this version will work without a need for upgrading when 2.5 is officially released.  As always, if someone installs it, and there <strong>is</strong> an issue, please let me know.</em></p>
]]></content:encoded>
			<wfw:commentRss>http://anekostudios.com/2008/03/28/orange-crush/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Part 4: Neat Little Snippets of Code That Are Useful for WordPress</title>
		<link>http://anekostudios.com/2008/03/13/part-4-neat-little-snippets-of-code-that-are-useful-for-wordpress/</link>
		<comments>http://anekostudios.com/2008/03/13/part-4-neat-little-snippets-of-code-that-are-useful-for-wordpress/#comments</comments>
		<pubDate>Thu, 13 Mar 2008 13:03:21 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<guid isPermaLink="false">http://anekostudios.com/2008/03/13/part-4-neat-little-snippets-of-code-that-are-useful-for-wordpress/</guid>
		<description><![CDATA[Okay, so here we move on to Part 4 of my &#8220;taking too long to add to this&#8221; series  
I had a client this week who is an author.  He does some work on practice lists, and wanted a spot to gather his writing together.  The thing that he wanted was something [...]]]></description>
			<content:encoded><![CDATA[<p>Okay, so here we move on to Part 4 of my &#8220;taking too long to add to this&#8221; series <img src='http://anekostudios.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>I had a client this week who is an author.  He does some work on practice lists, and wanted a spot to gather his writing together.  The thing that he wanted was something that would count the words within his posts - since many of his lists require practice pieces to be under a certain word limit (or they just want to know how many words there are).  </p>
<p>I found a few plugins, but when I went to test them, the word count was always off.  One of my test posts was 301 words long, yet the different plugins would vary anywhere form 320 to 350 words.  There were different reasons for this, and to me, it wasn&#8217;t worth troubleshooting 200 or so lines of code in the plugin to figure out why.</p>
<p>So I wrote my own function instead: and it took all of 10 lines (if you count the commented sections, and the two lines it took to create the function).<br />
<span id="more-114"></span><br />
So, here we go.  My &#8220;Count words in the posts&#8221; function.  I&#8217;m not a plugin author, and I&#8217;m sure this could be put into a plugin, but it&#8217;s such a tiny piece of code that it&#8217;s just a lot cleaner to stick it in your functions.php file. </p>
<p><code><br />
function bb_word_count() {<br />
$pc = get_the_content();<br />
//strip all HTML tags<br />
$spc = strip_tags($pc);<br />
// strip all multiple spaces<br />
$spcns = str_replace('  ',' ',$spc);<br />
// now count the words in the string<br />
$count = str_word_count($spcns);<br />
echo "$count words";<br />
}<br />
</code></p>
<p>As you can see, it&#8217;s really simple.  I wouldn&#8217;t be surprised if it could be done with an even cleaner method to reduce the size.  but the actual working lines of code span only 5 lines!  The first is to grab the content within your post, the second takes a look at it and strips *all* tags (images, blockquotes, paragraph tags - all the unecessary formattng - this is <em>all about the word count</em>).</p>
<p>The third line the makes sure extra whitespace is stripped.  I have a habit of putting in two spaces after a period - I still do it after all of these years, and any of you who&#8217;ve taken a typing class know exactly why I do it.  The addition of the extra space tends to throw the count off - so this third line takes *any* double spaces and converts them to a single space.</p>
<p>The fourth line then simply counts what&#8217;s left - which is the words.  The fifth line echoes out the number.  Bam, done - and accurate every time.</p>
<p>To further add to what I did, my client wanted to acknowledge where he got his ideas for his practice, and he wanted to place a little section within each post that would describe the purpose of the assignment, and a link back to where he got it.  However, the problem was that if he did place this within the content, then my function would count that too.  </p>
<p>But this is why I love WordPress so much.  <img src='http://anekostudios.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>My function counts what&#8217;s within the_content(); - and WordPress has a nifty little thing called &#8220;custom fields&#8221; that you can add and manipulate as you see fit.  So what I did was create a custom field (called &#8220;info&#8221;), and in that field, he just put in the information he wanted.  Then, in the template file (in his case, single.php), I put this in right above the call to the_content():</p>
<p><code><br />
&lt;?php<br />
        $key="info";<br />
        echo get_post_meta($post->ID, $key, true);<br />
        } ?><br />
</code></p>
<p>What this does is look for my custom field (with the key of &#8220;info&#8221;), and it grabs the post ID of the page you&#8217;re on.  Then the custom info that&#8217;s attached to that post gets put above the post content, to inform the end user of this special information <em>and </em>my count function <em>only counts the actual content</em> - not the custom info.</p>
<p>This is a new site for my client, and he&#8217;s given me permisson to link to it for the purposes of this article - but right now there&#8217;s no real content there (the site was just put up yesterday) - but I&#8217;ll post the link here, because by the time anyone really wants to see it in action, he&#8217;ll have some stuff up where you can see how it looks.</p>
<p>So here you go&#8230;<a href="http://www.andrewjwells.com">Andrew J. Wells</a> (But remember, this stuff is set to be seen on a single post page - so you need to click on one of the posts to see it in action!)</p>
]]></content:encoded>
			<wfw:commentRss>http://anekostudios.com/2008/03/13/part-4-neat-little-snippets-of-code-that-are-useful-for-wordpress/feed/</wfw:commentRss>
		</item>
		<item>
		<title>A small break&#8230;</title>
		<link>http://anekostudios.com/2008/02/02/a-small-break/</link>
		<comments>http://anekostudios.com/2008/02/02/a-small-break/#comments</comments>
		<pubDate>Sat, 02 Feb 2008 16:56:26 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<guid isPermaLink="false">http://anekostudios.com/2008/02/02/a-small-break/</guid>
		<description><![CDATA[Yes, I do have another &#8220;neat little snippets of code&#8221; addition to my series there - but it&#8217;s still in the works.  I keep getting more and more snippets, so I&#8217;m thinking this is going to be a long-running series.  So to wait only for those entries&#8230;well&#8230;I&#8217;d never be able to post anything [...]]]></description>
			<content:encoded><![CDATA[<p>Yes, I do have another &#8220;neat little snippets of code&#8221; addition to my series there - but it&#8217;s still in the works.  I keep getting more and more snippets, so I&#8217;m thinking this is going to be a long-running series.  So to wait only for those entries&#8230;well&#8230;I&#8217;d never be able to post anything else!</p>
<p>So, I&#8217;m pausing a moment and adding this.  </p>
<p>A year ago, today, <a href="http://anekostudios.com/2007/02/04/testing-testing-1-2-3/">I started a little experiment</a>.  I am happy to report that I have yet to receive a single email from either of those addresses - spam or otherwise.  Well&#8230;unless you could &#8220;test&#8221; emails I&#8217;ve sent to myself to ensure they were still working.  Which they are.</p>
<p>But today, one of the <a href="http://www.wise-women.org/">email lists I&#8217;m on</a> had an interesting discussion about spam.  Someone made a comment that they believed &#8220;scraping&#8221; of email addresses from websites don&#8217;t happen anymore (for the most part) - that it&#8217;s a dying practice that&#8217;s almost extinct.  If this is true, then it renders my experiment a bit pointless.</p>
<p>So, that being said, I&#8217;m adding to my experiment.  Welcome my new email address:</p>
<p><a href="mailto:askingforit@anekostudios.com">askingforit@anekostudios.com</a></p>
<p>Look at that.  Right there, wide out in the open.  With this one, I am <strong>asking</strong> to get spam.  Hit me with your best shot.  Let&#8217;s see how long it takes - if it takes any time at all.  Who knows?  Maybe they&#8217;re right - if they are, it&#8217;s <em>excellent</em> news!</p>
]]></content:encoded>
			<wfw:commentRss>http://anekostudios.com/2008/02/02/a-small-break/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Part 3: Neat Little Snippets of Code That Are Useful for WordPress</title>
		<link>http://anekostudios.com/2007/12/17/part-3-neat-little-snippets-of-code-that-are-useful-for-wordpress/</link>
		<comments>http://anekostudios.com/2007/12/17/part-3-neat-little-snippets-of-code-that-are-useful-for-wordpress/#comments</comments>
		<pubDate>Mon, 17 Dec 2007 21:55:40 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<guid isPermaLink="false">http://anekostudios.com/2007/12/17/part-3-neat-little-snippets-of-code-that-are-useful-for-wordpress/</guid>
		<description><![CDATA[The Content Scraper (for sites that have no feed).
::now holding my ears to shut out the yelps::
Okay, okay - calm down.  Here&#8217;s the thing.  I debated long and hard about putting this here.  I truly did.  People hate content scrapers, and yes - for the most part - the ones that [...]]]></description>
			<content:encoded><![CDATA[<p>The Content Scraper (for sites that have no feed).</p>
<p>::now holding my ears to shut out the yelps::</p>
<p>Okay, okay - calm down.  Here&#8217;s the thing.  I debated long and hard about putting this here.  I truly did.  People <em>hate</em> content scrapers, and yes - for the most part - the ones that use it for horrid purposes are evil bastards.  But being in the Christmas spirit that I always get in at this time of year, I&#8217;m going to try and believe that people are good for the most part - and although I know this might become abused here and there&#8230;well at least I can take slight solace in the fact that this one, at the very least, will cache the content on the spammers server, so your bandwidth isn&#8217;t too huge.</p>
<p>I still have trepidation about this one - so seriously, if it <em>does</em> become an issue, and I get a lot of people who really don&#8217;t want this one here, I <em>will</em> remove it.  This one was a toughie to consider sharing, but I&#8217;m hoping that people use it for the greater good.  I&#8217;ve seen a lot of requests for this kind of stuff on the forums - people who would like to &#8220;scrape&#8221; the content on their own site that they have in one place and stick it on another one they own so they don&#8217;t have to write the same thing twice in two different places - and honestly, that&#8217;s what this was developed for.</p>
<p><span id="more-110"></span><br />
How this came about was that I had a client who is a local non-profit organization for the little city I live in.  Their site is meant for newcomers to the area, and is meant to provide new people with information about the town and what goes on.  They wanted to have a page where certain official city stuff was posted, but they also wanted that information to appear on their site so it&#8217;s all located in one central place.  However, they didn&#8217;t want to have to force the people who ran the city&#8217;s websites to have to log into their site and update it as well (and HA!  Like they would anyway).  They also didn&#8217;t want to ruin the city&#8217;s bandwidth, nor steal anything.  The idea was to give a snippet of information that would link to the rest of the articles on the original site.  Oh yes, and the BIG issue I was facing: none of the town websites had an RSS feed.  You can do this a LOT easier if you have an RSS feed to work from, but in my case, I did not - this one is how to get and format the content yourself, even when there&#8217;s no feed to eat from.</p>
<p>I will warn you now - this code works very well.  However, it can be a bear to get around.  Someday, I might - MIGHT - make it into a customizable plugin (it is a half-assed plugin now, but you have to mess with it - no admin panel), but I&#8217;m still unsure as to whether or not I&#8217;ll actually release it like that to the public because of the serious nature of what it could possibly do.  But it is useful, so be warned - there&#8217;s some wading to do on this one. </p>
<p>The<em> great</em> thing about this one is this: most times, when people scrape content, they don&#8217;t give a crap.  They just scrape, and every time the original author&#8217;s page loads on the scraper&#8217;s site, it loads the page on the original author&#8217;s site, thus increasing the bandwidth for the original author, while the scraper feels nothing.  Bad for the original author - good for the spammer (until he gets caught).  </p>
<p>This script has a nicety.  What happens is, you create a folder on your server - I prefer to keep this folder outside of the actual public_html area, but that&#8217;s me - and&#8230;how can I explain this in plain terms?  Okay, it&#8217;s sort of like on a &#8220;timer&#8221; of sorts.  This one is set for 24 hours - but if you know the content you&#8217;re scraping is going to be updated once a month (rather than once a day), you can change it to monthly, weekly - yearly - whatever you want.  The &#8220;timer&#8221; starts when the script is first called - usually when you go to test it to make sure it works.  What it does is, it&#8217;ll &#8220;Scrape&#8221; the site, and cache the contents in the folder you&#8217;ve specified.  From then on, for the next 24 hours (or week, month, year - whatever you&#8217;ve set the &#8220;timer&#8221; to) it will scrape that cache folder - NOT the original site in question.  When the time runs out, it&#8217;ll scrape the site again, cache the content, and it all goes over and over again.</p>
<p>So basically, you&#8217;re giving the original site *one* hit, and not increasing their bandwidth by any huge margin. </p>
<p>But PLEASE PLEASE <strong>PLEASE</strong> if you use this, PLEASE use it legitimately.  Use it to cross-reference your own sites, or &#8220;scrape&#8221; only sites that give you permission to do so.  And DO NOT pass the content off as your own (unless it truly is - in the &#8220;cross-referencing your own sites&#8221; variable) - be kind and make it a simple snippet/excerpt and then provide a link to the REAL author&#8217;s site.  I beg of you all to not abuse this - truly this was a hard decision for me to make, and if I do become aware of abuse issues, I will not hesitate to remove it immediately.</p>
<p>(I know, I can&#8217;t say that enough&#8230;truly I can&#8217;t!)</p>
<p>Okay, so this is based on <a href="http://www.troywolf.com/articles/php/class_http/">Troy Wolf&#8217;s Screen Scraping Class</a>.  As stated before, if RSS feeds are available, there&#8217;s better methods than this.  (You probably could get this to work with a feed as well - I haven&#8217;t tried that yet - but if you could, that would be much better!)  But if you don&#8217;t have feed access, then you simply use this script.  I won&#8217;t go into the script itself, and - as with the last part of this series - I will provide you with a link.  I&#8217;ll just overview certain key points here.  </p>
<p>Really, the only part you need to worry about is at the bottom.   I&#8217;ve already commented out some of it, but I&#8217;m going to elaborate a bit.  </p>
<ol>
<li><strong>function Site1() {</strong> this is the function name that you place on the Page template file, where you want the content to show.  For example, after you put in all the variables you need to change, then open up your page.php, archive.php, sidebar,php - wherever you want this to show up - and put in &#8220;&lt;?php site1(); ?>&#8221; and there you go.  It&#8217;ll appear. </li>
<li><strong>$h->dir = &#8220;FOLDER HERE&#8221;;</strong> You need to create a folder on your server (as I said, I prefer mine to be cached *outside* the public area of the site - above &#8220;public_html&#8221; or &#8220;www&#8221; - because the older needs to be CHMOD&#8217;d to 777 to work.  Where it says &#8220;FOLDER HERE&#8221;, you put the <em>server path</em> to the folder you&#8217;ve created for caching the files.  In other words &#8220;http://sitename/folderhere&#8221; ain&#8217;t gonna cut it (especially if the folder is housed outside of the public area).</li>
<li><strong>$c = &#8220;URL HERE&#8221;;</strong> URL HERE should be the URL of the original author of the content you&#8217;re taking.  Don&#8217;t be an ass - give credit where it&#8217;s due. (plus, if you don&#8217;t, some of the code won&#8217;t work right anyway - so just do it.)</li>
<li><strong>$url = &#8220;FULL URL HERE&#8221;;</strong> FULL URL HERE is asking for the full path to the page you&#8217;re scraping content from.   You must have the right URL to the very page you need - so it knows where to look.</li>
<li><strong>if (!$h->fetch($url, 86400)) {</strong> This is where you set the time limit on how long to cache the page before visiting the site again to scrape fresh stuff.  &#8220;86400&#8243; is what you&#8217;re looking to replace - that is the equivalent to 1 day (60 seconds (1 minute) x 60 minutes (1 hour) x 24 hours (1 day) - 86400 seconds.)  So if you&#8217;re looking for, say, 1 week, you&#8217;d replace the &#8220;86400&#8243; with &#8220;604800&#8243;.  1 month - or rather, 30 days: 2592000.
<p>If you cache the page (meaning, load up <em>your</em> page - it&#8217;ll immediately cache it) and you see &#8220;Whoops! We had a problem loading this content.  Please try refreshing the page.&#8221;, then try refreshing the page.  Sometimes it works.  Sometimes, you have to go into the folder and delete the cached page, then reload.  I have one site where I have to take away the caching altogether for it to work (set &#8220;86400&#8243; to &#8220;0&#8243;).</li>
<li><strong>$matches = http::table_into_array($h->body, &#8220;ITEM 1&#8243;, 1, &#8220;ITEM 2&#8243;);</strong> This is the biggie.  ITEM 1 and ITEM 2 are the spots where you need ot enter the code for what surrounds the stuff you want to take.  If you want it *all*, then &lt;body>, &lt;/body> will get everything between the body tags.  If you want to get really specific, then look for classes or certain tags with ID&#8217;s that you can use to identify exactly what you want.</li>
</ol>
<p>And that&#8217;s pretty much it.  Oh yes, I *should* note that there&#8217;s nothing in this script that will delete cached pages.  They don&#8217;t get overwritten either.  So every now and then, you&#8217;ll have to go in and clear out the folder, or it&#8217;ll grow to be HUGE.</p>
<p>So, after reading all that, basically you just <a href="http://www.anekostudios.com/downloads/content-grab.txt">download the file</a>, open it in a text editor and make the necessary changes, upload to your plugins folder, activate and insert the function name where you want it to appear (as stated in step 1 above).  You can have more than one site appear on a page, as well - just copy the entire function, rename it and edit it for the second site. </p>
<p>Up next: Really Cool Profile Pages</p>
]]></content:encoded>
			<wfw:commentRss>http://anekostudios.com/2007/12/17/part-3-neat-little-snippets-of-code-that-are-useful-for-wordpress/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Part 2: Neat Little Snippets of Code That Are Useful for WordPress</title>
		<link>http://anekostudios.com/2007/12/03/part-2-neat-little-snippets-of-code-that-are-useful-for-wordpress/</link>
		<comments>http://anekostudios.com/2007/12/03/part-2-neat-little-snippets-of-code-that-are-useful-for-wordpress/#comments</comments>
		<pubDate>Mon, 03 Dec 2007 18:15:38 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<guid isPermaLink="false">http://anekostudios.com/2007/12/03/part-2-neat-little-snippets-of-code-that-are-useful-for-wordpress/</guid>
		<description><![CDATA[Ahhhhh&#8230;. ye olde &#8220;Send to a Friend&#8221;.  One of my recent clients really wanted this sucker for every single post on their site - all you needed to do was put in your email address, your friend&#8217;s email address, maybe write a little personal note and send it on it&#8217;s merry way.
The problem with [...]]]></description>
			<content:encoded><![CDATA[<p>Ahhhhh&#8230;. ye olde &#8220;Send to a Friend&#8221;.  One of my recent clients really wanted this sucker for every single post on their site - all you needed to do was put in your email address, your friend&#8217;s email address, maybe write a little personal note and send it on it&#8217;s merry way.</p>
<p>The problem with &#8220;Send to a Friend&#8221; scripts is the abuse factor.  Basically, you&#8217;re leaving your server wide open for some POS to some along and use your server as a mass spam machine.  They can send to as many people as they want, and when the crap hits the fan, <em>you</em> are the one that gets blamed for it all, and <em>you</em> are the one who pays the price.</p>
<p>God, I hate spammers.</p>
<p><span id="more-109"></span><br />
Well, the way around this issue is basically to check the end user&#8217;s input.  So what I did was basically convert my own <a href="http://www.anekostudios.com/scripts/">simple form</a> into a send to friend script.  It was surprisingly easy.  I&#8217;ve never made my own form use only one single file, though - so that part was hard for me - but once I had it down, I&#8217;ve had all kinds of other uses for this easy idea.</p>
<p>But anyway, so here we go.  You need a form with five fields - names, to, from and personal message.  You need to check the end user&#8217;s input.  Frankly, because the form is basically meant only to send a link to the post in question, then there&#8217;s no need to allow anything but text and numbers in the &#8220;message&#8221; field.  The script handles the rest.  Being so strict about this is a bit more safe for you, because people can only enter in correct information.  There is a chance that some spammer could use the form to send out spam, but with the heavy restrictions, the most they can do is send your post to a single user as a spam attempt.  Not very user-friendly for the spammer!</p>
<p>A side note, although I only made the script for use in WordPress, I cannot imagine you wouldn&#8217;t be able to use it in something else.  So if you want to take it to Joomla, Movable Type - whatever, it shouldn&#8217;t be too hard to convert it.</p>
<p>In the code, you may note a small input box there, right before the &#8220;send&#8221; button, called &#8220;surprise&#8221;.  Now, I <em>detest</em> captchas.  They&#8217;re javascript-based (usually) and easy to get around, and on top of that (whether javascript-based or not) they are pretty inaccessible to users.  Plus, they&#8217;re just downright annoying.  I can&#8217;t stand them.  They&#8217;re seriously a pet-peeve of mine, like &#8220;no right click&#8221; scripts, and background music that you can&#8217;t shut off.  Just thinking about them irritates me - like chewing aluminum foil, or running your fingernails down a chalkboard.  Ugh.</p>
<p>So the &#8220;surprise&#8221; is this: it prevents automated spambots from filling in your form, while a real person would get through just fine.  How?  Although it&#8217;s a regular text field that can accept input, you render it invisible with CSS.  (For those that have CSS disabled or are using a screen-reader, there&#8217;s a label notification that, if you are a real person, you should NEVER fill in this field.)  An automated spammer wouldn&#8217;t notice (or care) about this notification, and will try to fill it with input.  The script detects this, and if any input is placed in that field, the form will not send.  Simple, but brilliant (and I have the <a href="http://www.womendesignersgroup.com">WDG List</a> to thank for that little nugget of code!)</p>
<p>So, now on to the script itself.  What you need to do is basically check the input - just like any other form you would use.  I&#8217;m a little more strict on this than I am anywhere else I&#8217;d use a form, simply because of the massive abuse-factor (and we do want to keep this in check), so I get down and dirty with specifics.  </p>
<p>The name field will accept only English characters (sorry guys - I haven&#8217;t figured out the whole Spanish/Japanese/Russian/Swedish/etc character thing for the regex yet.  If I knew how to do that, I&#8217;d be adding that capability as well, but you&#8217;re stuck with plain ol&#8217; English for now.  But if anyone would like to assist me with that type of translation, I&#8217;d love to hear from you!) - that&#8217;s my only limitation.  It&#8217;ll allow capital and lowercase letters, apostrophes, hyphens and spaces.  So you can enter in &#8220;Shelly&#8221;, but if you&#8217;re Irish, &#8220;Shelly O&#8217;Brien&#8221; will work too.  If you hung onto your maiden name when you got married *and* you&#8217;re Irish, &#8220;Shelly Smith-O&#8217;Brien&#8221; will also be accepted.</p>
<p>Email is your regular &#8220;check for proper email formatting&#8221; check (and yes, &#8220;co.uk&#8221; will work as well as &#8220;.com&#8221; at the end).  Then the message is checked for any scripting attempts.  For the record, if anyone <em>does</em> try to insert a script, <strong>my</strong> script will recognize the attempt.  It will still allow the message to go through, but all actual script running is disabled.  It&#8217;ll just pass it through as straight text.  I haven&#8217;t quite gotten it down pat yet as to where, if it detects an XSS attempt, it&#8217;ll just return an error, but at least it cleans it up so it&#8217;s text-only and no harm is done (and if you&#8217;re the recipient, you&#8217;ll see what was attempted, so hopefully the recipient will send it back to you so you can see what they tried to do with the script - it may help a little bit with things to see what they were trying to do - but I do know that&#8217;s a bit annoying in the end).  That&#8217;s another thing I need to work on with this.</p>
<p>Anyway.  So that&#8217;s pretty much it.  Although I&#8217;d normally plunk in all the code here within my post, for such a small thing it *is* a lot of code, so I thought I&#8217;d be nice and make it easier to read for you.  Instead, I&#8217;m providing a links for you to use: <a href="http://www.anekostudios.com/downloads/send_to_friend.txt">you can go straight to the code and copy/paste it into a text editor</a> (no, I haven&#8217;t turned it into a plugin yet - I&#8217;m not THAT good) and be sure you follow the instructions at the top so you know where to put it.</p>
<p>Up Next: &#8220;<a href="http://anekostudios.com/2007/12/17/part-3-neat-little-snippets-of-code-that-are-useful-for-wordpress/#more-110">Content Scraper</a>&#8220;</p>
]]></content:encoded>
			<wfw:commentRss>http://anekostudios.com/2007/12/03/part-2-neat-little-snippets-of-code-that-are-useful-for-wordpress/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Part 1: Neat Little Snippets of Code That Are Useful for WordPress</title>
		<link>http://anekostudios.com/2007/11/13/part-1-neat-little-snippets-of-code-that-are-useful-for-wordpress/</link>
		<comments>http://anekostudios.com/2007/11/13/part-1-neat-little-snippets-of-code-that-are-useful-for-wordpress/#comments</comments>
		<pubDate>Tue, 13 Nov 2007 15:35:03 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<guid isPermaLink="false">http://anekostudios.com/2007/11/13/part-1-neat-little-snippets-of-code-that-are-useful-for-wordpress/</guid>
		<description><![CDATA[So, as an introduction, I&#8217;m going to tell you that there will be no real rhyme or reason to this series.  Over the past few weeks, I&#8217;ve had several paying clients (and one pro-bono, who really pushed my limits) who have forced me to learn new things, and pull out some creative thinking.  [...]]]></description>
			<content:encoded><![CDATA[<p>So, as an introduction, I&#8217;m going to tell you that there will be no real rhyme or reason to this series.  Over the past few weeks, I&#8217;ve had several paying clients (and one pro-bono, who <em>really</em> pushed my limits) who have forced me to learn new things, and pull out some creative thinking.  As I said in <a href="http://anekostudios.com/2007/10/24/so-many-tutorials-so-little-time/">this post</a>, I&#8217;m not a programmer, I just know enough to get around.  So I&#8217;m <em>absolutely positive</em> some of these could be written in some other cleaner way - I just don&#8217;t know how.  So by all means, if you know of a better way to accomplish these things,  share it.  </p>
<p>So, our first trick will be something basic, something simple.  Blockquotes.<br />
<span id="more-108"></span></p>
<p>People like to use the style of a big background image of quotes when designing a layout for blockquotes.  It&#8217;s a very nice method, and makes it obvious as to what you are reading.  However, it&#8217;s hard to get the quotes all around the blockquote without extra markup.  <a href="http://www.alistapart.com/articles/avoidedgecases/">Some sites just open with</a> <a href="http://www.themainbrace.com/blog/blockquote/">the left-side quotes and never close.</a>  Some sites use the method of the quotes smooshed together in the upper left-hand corner.  <a href="http://www.tjkdesign.com/articles/using_real_images_for_quotes_in_blockquotes.asp">Some sites get them at the beginning and the end</a>, <a href="http://www.mandarindesign.com/2005/07/blockquotes-with-image-quotes.html">but they rely on a background image for the upper left-hand corner in the blockquote area,</a> and the closing &lt;p> <a href="http://www.designmeme.com/articles/csscurlyquotes/">tag to put the finishing touch in the bottom right-hand corner.</a>  <a href="http://24ways.org/2005/swooshy-curly-quotes-without-images">Some even do it without images.</a></p>
<p>One of the sites I was working on this past week needed the blockquote images before and after the quote.  I didn&#8217;t want to rely on using the &lt;p> tags, because what if the blockquote was a long one, and span two, or even three paragraphs? Then you&#8217;d have the opening at the beginning, and one at the end of each paragraph.  Butt ugly.  You could add a class to the last one, though and it would work.</p>
<p>But the dealbreaker was that this client was using WordPress MU, and was getting ready to start a community portal where many people would be using this theme I was designing.  You couldn&#8217;t count on the end user to put in the class at the last paragraph.  Hell, half the time they&#8217;re lost without the WYSIWYG editor (PITA that the thing is).  So I needed something that used the KISS principle - let them write a blockquote and have the formatting just appear - without the end user having to do anything other than use the &lt;blockquote> tag.</p>
<p>In comes the idea for the code.  I liked <a href="http://simonwillison.net/2003/May/21/stylingBlockquotes/">this method</a> the best - it seemed sensible to me (i wanted to replace the &lt;div> tags with &lt;span>tags, though - personal preference).  But, as said before, I didn&#8217;t want the end user to have to enter in any extra markup themselves, because it was unreliable.  So how to do it?  </p>
<p>I thought&#8230;<em>&#8220;what if there was a way to search the_content() for the closing &lt;blockquote> tag, and replace it with my own?&#8221;</em></p>
<p>By God, you can.  Thanks to a post I saw by <a href="http://www.solo-technology.com/blog">HandySolo</a> <a href="http://wordpress.org/support">on the forums</a>, you can interject your own stuff into the_content(), then return it to its normal state of being.   So I took it a step further - could I do a search and replace?</p>
<p>Well, yes, Shelly, you can.  Here&#8217;s what it looks like:</p>
<p><code><br />
&lt;?php<br />
// fix blockquote display<br />
function fix_bquote ($content) {<br />
    $bquote = "&lt;/blockquote>";<br />
    $rep_bquote = "&lt;span class=\"bquote\">&lt;/span>&lt;/blockquote>";<br />
    $content = str_replace($bquote, $rep_bquote, $content);<br />
    return ($content);<br />
}<br />
add_filter('the_content', 'fix_bquote');<br />
?><br />
</code></p>
<p>What this does is, it&#8217;ll pull out the_content() and search for the closing &lt;/blockquote> tag, then replace it with the addition of a &lt;span> tag, assigned a particular class.  So instead of <code>&lt;/blockquote></code>, you see <code>&lt;span class="bquote">&lt;/span>&lt;/blockquote></code>.  Then you simply assign that class a background image (the closing &#8220;) and set it&#8217;s background in the stylesheet, like so:</p>
<p><code><br />
span.bquote {<br />
display:block;<br />
text-align:right;<br />
background:url("images/end-bquote.gif") no-repeat right bottom;<br />
}<br />
</code></p>
<p>It&#8217;s pretty cool, and very nice so you don&#8217;t have to hand-code this in every single time to get it to work right.  It just *does* it for you.</p>
<p><strong>Up Next: <a href="http://anekostudios.com/2007/12/03/part-2-neat-little-snippets-of-code-that-are-useful-for-wordpress/">Send to a Friend</a></strong></p>
]]></content:encoded>
			<wfw:commentRss>http://anekostudios.com/2007/11/13/part-1-neat-little-snippets-of-code-that-are-useful-for-wordpress/feed/</wfw:commentRss>
		</item>
		<item>
		<title>So many tutorials, so little time&#8230;</title>
		<link>http://anekostudios.com/2007/10/24/so-many-tutorials-so-little-time/</link>
		<comments>http://anekostudios.com/2007/10/24/so-many-tutorials-so-little-time/#comments</comments>
		<pubDate>Wed, 24 Oct 2007 23:11:20 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<guid isPermaLink="false">http://anekostudios.com/2007/10/24/so-many-tutorials-so-little-time/</guid>
		<description><![CDATA[I have had the most interesting week last week.  Actually, the last couple of weeks.  I was presented with a challenge, and I took it on, full force.  
I take &#8220;pro-bono&#8221; clients on every year.  My max is three, in all honesty, and I actually do have criteria that someone has [...]]]></description>
			<content:encoded><![CDATA[<p>I have had the most <em>interesting</em> week last week.  Actually, the last couple of weeks.  I was presented with a challenge, and I took it on, full force.  </p>
<p>I take &#8220;pro-bono&#8221; clients on every year.  My max is three, in all honesty, and I actually do have criteria that someone has to meet for me to do this.  A couple of these requirements: they have to be willing to be put on the back-burner for paying clients (so I can&#8217;t be bound by &#8220;gotta have it done by&#8230;&#8221; dates), they have to be willing to let me &#8220;play&#8221; (you know, have a bit o&#8217; creative freedom)&#8230;and the final one - they have to be able to let me stretch my limits, whether I&#8217;m successful or not.  So a pro-bono client has got to be pretty flexible, and really not have too many &#8220;gotta haves&#8221; - more like &#8220;wanna haves&#8221;&#8230;and the more outrageous and seemingly impossible, the better.<br />
<span id="more-107"></span></p>
<p>Well, this last one was a *doozy*.  (What am I saying&#8230;<em>was</em>?  I&#8217;m still working on things!)  I tell ya, I have hacked and played and coded my brains out to get some of this stuff to work.  It&#8217;s been soooo much fun.  </p>
<p>And now, I want to share it with you <img src='http://anekostudios.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>So I&#8217;m getting ready to do a little &#8220;series&#8221; of &#8220;Neat Little Snippets of Code That Are Useful for WordPress&#8221; to share with you all, most of which I developed while trying to get <strong>this</strong> site to run.  (No, not <a href="http://www.anekostudios.com">this site</a>, but the site I&#8217;m talking about.) </p>
<p>Now, <strong>please</strong> keep in mind that programming is not my strong suit.  So some of this code is flat-out ugly as hell.  I&#8217;m sure better programmers than I will take a look at some of this and say &#8220;Why does she make things so hard on herself?&#8221; (and the answer would be &#8220;Because I don&#8217;t know any better.&#8221;) But the fact is, these work, and they&#8217;re nice little things that should be filed away for future reference.  So please - by all means - if you see something here and you think you can write it better, by God, let me know!</p>
<p>I&#8217;ve also found a myriad of interesting and neat little plugins along the way.  I&#8217;ll be mentioning those throughout my little series too.  So it&#8217;s Coming Soon to a Browser Near You!  So watch for it <img src='http://anekostudios.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /></p>
]]></content:encoded>
			<wfw:commentRss>http://anekostudios.com/2007/10/24/so-many-tutorials-so-little-time/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Further updates</title>
		<link>http://anekostudios.com/2007/09/24/further-updates/</link>
		<comments>http://anekostudios.com/2007/09/24/further-updates/#comments</comments>
		<pubDate>Mon, 24 Sep 2007 14:38:19 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<guid isPermaLink="false">http://anekostudios.com/2007/09/24/further-updates/</guid>
		<description><![CDATA[So yeah, I found a few issues with the new theme design.  Most notably is my idiotic mistake of forgetting to pull my stylesheets to run my example code and putting it into this theme.  Whoops.  So now I look like a dork, because all of my examples don&#8217;t function.  I [...]]]></description>
			<content:encoded><![CDATA[<p>So yeah, I found a few issues with the new theme design.  Most notably is my idiotic mistake of forgetting to pull my stylesheets to run my example code and putting it into this theme.  Whoops.  So now I look like a dork, because all of my examples don&#8217;t function.  I swear, people - they do.  I just forgot to bring in the stylesheets that make them work when I put up this new theme.  I&#8217;ll be doing that in a little bit so everything functions again!</p>
<p>In other news, a &#8220;bug&#8221; has bitten me.  Over the last year (since i&#8217;ve released the &#8220;orange Crush&#8221; theme) I&#8217;ve had some serious fun customizing WordPress and creating unique designs for all kinds of clients.  I&#8217;m also working on my business site&#8217;s new design (man, I hope to get that up soon!) but I&#8217;ve learned all kinds of cool tricks and neat things that make me want to do a new theme to release.</p>
<p><span id="more-104"></span><br />
I know I&#8217;ve been saying one is coming soon, but I&#8217;m one of these &#8220;perfectionist&#8221; types.  I have about seven of them that I&#8217;ve started, but at some point I&#8217;ve abandoned because I get stuck and can&#8217;t proceed on it, or I think of something else that would be awesome, but it doesn&#8217;t fit with what I&#8217;m working on.  I guess I need to just stick with one and finish it up so I can stop teasing people with the prospect of one.</p>
<p>Plus, the newest release of WordPress (2.3) is being released today, so now I have to go through and make sure everything still works with that one!</p>
<p>Furthermore, the &#8220;cool stuff&#8221; I&#8217;ve been learning&#8230; well needless to say, I&#8217;ve been dabbling in plugins.  I&#8217;ve created a few - none of which are release-ready, but they certainly show a lot of promise.  I am, by no means, an expert PHP coder.  I&#8217;m okay, and I can get some things accomplished (I can get some really cool things accomplished if I really put my mind to it), but I know I&#8217;m messy.  But one of the more interesting things I&#8217;ve done is a custom query that will output posts by meta tag into a newsletter format.  There&#8217;s still some kinks with it, but man, was it fun to figure out.  Once I do figure it out, I think I may try to clean it up and release it as a newlsetter-type plugin.</p>
<p>Anyway, that&#8217;s all I can think of right now&#8230;if anyone has any &#8220;theme requests&#8221; though, pass &#8216;em along.  My creative juices are flowing, and I love a good challenge!</p>
]]></content:encoded>
			<wfw:commentRss>http://anekostudios.com/2007/09/24/further-updates/feed/</wfw:commentRss>
		</item>
	</channel>
</rss>
