<?xml version="1.0" encoding="UTF-8"?><?xml-stylesheet href="https://brooke.codes/wp-content/plugins/pretty-rss-feeds/xslt/pretty-feed.xsl" type="text/xsl" media="screen" ?><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"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>php &#8211; &lt;Brooke&gt; &lt;Codes&gt;</title>
	<atom:link href="https://brooke.codes/category/php/feed/" rel="self" type="application/rss+xml" />
	<link>https://brooke.codes</link>
	<description>The Tech Blog of Brooke. </description>
	<lastBuildDate>Tue, 02 Dec 2025 21:39:40 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.9.4</generator>
	<item>
		<title>Quick Tip: Stop Forum Spam</title>
		<link>https://brooke.codes/2025/12/02/quick-tip-stop-forum-spam/</link>
		
		<dc:creator><![CDATA[Brooke.]]></dc:creator>
		<pubDate>Tue, 02 Dec 2025 21:38:00 +0000</pubDate>
				<category><![CDATA[Geeky]]></category>
		<category><![CDATA[php]]></category>
		<guid isPermaLink="false">https://brooke.codes/?p=1769</guid>

					<description><![CDATA[<img width="150" height="150" src="https://brooke.codes/wp-content/uploads/2025/12/sfs-150x150-png.avif" class="attachment-thumbnail size-thumbnail not-transparent wp-post-image" alt="Sfs" decoding="async" data-has-transparency="false" data-dominant-color="dedee4" style="--dominant-color: #dedee4;" />Akismet is a great tool for fighting spam, however due to licensing and call limits I was looking to decrease the number of calls to Akismet. In my search for alternatives I stumbled upon Stop Forum Spam. For a free project, I have been impressed with their accuracy. While primary focused on, well forums, they [&#8230;]]]></description>
										<content:encoded><![CDATA[<img width="150" height="150" src="https://brooke.codes/wp-content/uploads/2025/12/sfs-150x150-png.avif" class="attachment-thumbnail size-thumbnail not-transparent wp-post-image" alt="Sfs" decoding="async" data-has-transparency="false" data-dominant-color="dedee4" style="--dominant-color: #dedee4;" />
<p class="wp-block-paragraph"><a href="https://akismet.com/">Akismet</a> is a great tool for fighting spam, however due to licensing and call limits I was looking to decrease the number of calls to Akismet. In my search for alternatives I stumbled upon <a href="https://www.stopforumspam.com/">Stop Forum Spam</a>. For a free project, I have been impressed with their accuracy. While primary focused on, well forums, they have an API. </p>



<p class="wp-block-paragraph">Other alternatives exist but for now I have been happy with the combination of Aksimet and Stop Form Spam combined with judicial word and IP blocks when needed. </p>



<span id="more-1769"></span>



<h2 class="wp-block-heading">Spam Strategy </h2>



<p class="wp-block-paragraph">While my exact spam strategy is somewhat depending on the content type. I often use a PHP library for Akismet  in combination with a word block and/or IP block list.</p>



<p class="wp-block-paragraph">For my most recent project the strategy looked like this:</p>



<ul class="wp-block-list">
<li>First check the input against an IP list. While IP blocks are a cat and mouse game, I use it to block known spammers. I&#8217;m talking about IPs that have made more than five known spam attempts in the last fourteen days get blocked for two weeks.</li>



<li>Next, check the content against a known word block list. Again this is the low hanging fruit for the crypto and link spammers who often uses the same words or phrases in their spam. </li>



<li>Once content passes both of those, the data is checked against the Stop Forum Spam database.</li>



<li>Finally, if that passes, then check the content with Akismet.</li>
</ul>



<p class="wp-block-paragraph">I found this catches about 98% of spam. All entries require manual approval, but catching spam means less moderation. </p>



<h2 class="wp-block-heading">PHP Example code</h2>



<p class="wp-block-paragraph">Here is an example using the <a href="https://www.stopforumspam.com/usage">Stop Forum Spam API</a> with <a href="https://symfony.com/doc/current/http_client.html">Symfony HTTP Client</a>. A similar method should be possible with any Request package.  For Akismet I&#8217;m using the <a href="https://github.com/omines/akismet">Omines Akismet Package</a> as I can use the same Request package.</p>



<p class="wp-block-paragraph">One quirk of the API is that the blocklists sets the <code>frequency</code> field to 255, and the <code>lastseen</code> date to the current time (UTC). I am being somewhat conservative here and checking if the <code>lastseen</code> is within the last hour.</p>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: php; title: ; notranslate">
/**
     * Check IP / email / username against Stop ForumSpam database
     *
     * @param string | null $ip IP address to check
     * @param string | null $email Email to check
     * @param string | null $username Username to check
     * @param int $threshold Confidence threshold(0 - 100, default: 75)
     * @param bool $checkTor include TOR exit nodes in spam detection(default: false)
     * @param bool $checkBlacklist include blacklisted entries(default: true)
     * @return bool | string false if clean, or string with reason if spam detected(&#039;confidence&#039; | &#039;tor&#039; | &#039;blacklist&#039;) {
     */
    private static function stopForumSpamLookup($ip = null, $email = null, $username = null, $threshold = 75, $checkTor = true, $checkBlacklist = true)
    {
        $client = HttpClient::create();

        $params = &#x5B;&#039;json&#039; =&gt; &#039;1&#039;, &#039;confidence&#039; =&gt; &#039;1&#039;];

        if ($checkTor) {
            $params&#x5B;&#039;badtorexit&#039;] = &#039;1&#039;;
        }
        if ($checkBlacklist) {
            $params&#x5B;&#039;nobaduser&#039;] = &#039;0&#039;;
        }

        if ($ip) {
            $params&#x5B;&#039;ip&#039;] = $ip;
        }
        if ($email) {
            $params&#x5B;&#039;email&#039;] = $email;
        }
        if ($username) {
            $params&#x5B;&#039;username&#039;] = $username;
        }

        try {
            $response = $client-&gt;request(&#039;GET&#039;, &#039;http://api.stopforumspam.org/api&#039;, &#x5B;
                &#039;query&#039; =&gt; $params
            ]);

            $data = json_decode($response-&gt;getContent(), true);

            if (!isset($data&#x5B;&#039;success&#039;]) || $data&#x5B;&#039;success&#039;] != 1) {
                return false;
            }

            foreach (&#x5B;&#039;ip&#039;, &#039;email&#039;, &#039;username&#039;] as $field) {
                if (isset($data&#x5B;$field]) &amp;&amp; $data&#x5B;$field]&#x5B;&#039;appears&#039;] == 1) {
                    if ($checkBlacklist &amp;&amp; isset($data&#x5B;$field]&#x5B;&#039;frequency&#039;]) &amp;&amp; $data&#x5B;$field]&#x5B;&#039;frequency&#039;] == 255 &amp;&amp; isset($data&#x5B;$field]&#x5B;&#039;lastseen&#039;])) {
                        $lastSeen = strtotime($data&#x5B;$field]&#x5B;&#039;lastseen&#039;]);
                        $hourAgo = time() - 3600;
                        if ($lastSeen &gt;= $hourAgo) {
                            return &#039;sfs_blacklist&#039;;
                        }
                    }

                    if ($checkTor &amp;&amp; $field === &#039;ip&#039; &amp;&amp; isset($data&#x5B;$field]&#x5B;&#039;torexit&#039;]) &amp;&amp; $data&#x5B;$field]&#x5B;&#039;torexit&#039;] == 1) {
                        return &#039;sfs_tor&#039;;
                    }

                    if (isset($data&#x5B;$field]&#x5B;&#039;confidence&#039;]) &amp;&amp; $data&#x5B;$field]&#x5B;&#039;confidence&#039;] &gt;= $threshold) {
                        return &#039;sfs_confidence&#039;;
                    }
                }
            }

            return false;
        } catch (Exception $e) {
            return false;
        }
    }
</pre></div>


<p class="wp-block-paragraph"></p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Changing the World S3 image generator</title>
		<link>https://brooke.codes/2013/07/03/changing-the-world-s3-image-generator/</link>
		
		<dc:creator><![CDATA[Brooke.]]></dc:creator>
		<pubDate>Wed, 03 Jul 2013 22:17:47 +0000</pubDate>
				<category><![CDATA[Life]]></category>
		<category><![CDATA[php]]></category>
		<guid isPermaLink="false">https://brooke.codes/?p=340</guid>

					<description><![CDATA[Today on my personal blog I wrote a blog post about how I&#8217;m going to change the world.&#160; At the bottom of the post it contains this image: Which when clicked links to http://changetheworld.broo.ke (offline). Today I wanted to talk a bit about how that sub-domain image generator works, because frankly I think it&#8217;s pretty [&#8230;]]]></description>
										<content:encoded><![CDATA[
<p class="wp-block-paragraph">Today on my personal blog I wrote a<a href="https://brooke.blog/archive/im-going-to-change-the-world/"> blog post </a>about how I&#8217;m going to change the world.&nbsp; At the bottom of the post it contains this image:</p>



<p class="wp-block-paragraph">Which when clicked links to http://changetheworld.broo.ke (<em>offline</em>).</p>



<p class="wp-block-paragraph">Today I wanted to talk a bit about how that sub-domain image generator works, because frankly I think it&#8217;s pretty cool.</p>



<p class="wp-block-paragraph">All the images are being stored on Amazon S3 storage meaning that image display should be faster and better than my local host. I&#8217;m also using a resize script to generate image sizes based on the users need.</p>



<p class="wp-block-paragraph">So basically it works like this:</p>



<ul class="wp-block-list">
<li>The user types in the image size they would like and hits submit</li>



<li>We check to see if the size is within a given range (between 100 and 1000 and divisible by 10) and if so we proceed</li>



<li>Next, we check if the image is already on the server, If so we grab it, if not we create it.</li>



<li>If the image is created it is done using an image resize script then uploaded to amazon S3</li>



<li>We display a link to the new image and a link to it in the read-only text box.</li>
</ul>



<p class="wp-block-paragraph">Check it out and let me know what you think.</p>



<p class="wp-block-paragraph">If anyone has any comments or&nbsp; would like the code please <a href="https://broo.ke">contact me</a> or leave a comment below</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Simple Portfolio Widget</title>
		<link>https://brooke.codes/2012/06/18/simple-portfolio-widget/</link>
		
		<dc:creator><![CDATA[Brooke.]]></dc:creator>
		<pubDate>Tue, 19 Jun 2012 01:58:12 +0000</pubDate>
				<category><![CDATA[php]]></category>
		<category><![CDATA[WordPress]]></category>
		<guid isPermaLink="false">https://brooke.codes/?p=280</guid>

					<description><![CDATA[Hi, I just wrote a simple portfolio widget and thought I would share. This code uses Justin Tadlock&#8217;s get_the_image plugin and custom widget code to display the featured image based on tag or post type. Just drop this into your functions.php or create a plugin to see it in action Let me know your thoughts [&#8230;]]]></description>
										<content:encoded><![CDATA[
<blockquote class="wp-block-quote is-style-info-notice is-layout-flow wp-block-quote-is-layout-flow">
<p class="wp-block-paragraph"><strong>Note: </strong>This post refers to code and a project from <em>many</em> years ago 😱. The content was edited in March of 2025 to remove dead links, improve clarity, or fix formatting, but no other edits were made. Enjoy this time capsule into the past.</p>
</blockquote>



<p class="wp-block-paragraph">Hi, I just wrote a simple portfolio widget and thought I would share. This code uses <a href="https://justintadlock.com/">Justin Tadlock&#8217;s </a><a href="https://wordpress.org/plugins/get-the-image/">get_the_image</a> plugin and custom widget code to display the featured image based on tag or post type.</p>



<span id="more-280"></span>



<p class="wp-block-paragraph">Just drop this into your functions.php or create a plugin to see it in action</p>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: php; title: ; notranslate">
if ( function_exists( &#039;add_image_size&#039; ) ) {
add_image_size( &#039;sidebar-thumb&#039;, 75,75,true   );

}
class PortfolioWidget extends WP_Widget
{
function PortfolioWidget()
{
$widget_ops = array(&#039;classname&#039; =&gt; &#039;PortfolioWidget&#039;, &#039;description&#039; =&gt; &#039;Displays a list of thumbnails for portfolio pieces in the sidebar&#039; );
$this-&gt;WP_Widget(&#039;PortfolioWidget&#039;, &#039;Portfolio Thumbnails&#039;, $widget_ops);
}

function form($instance)
{
$instance = wp_parse_args( (array) $instance, array( &#039;title&#039; =&gt; &#039;&#039;,&#039;tags&#039; =&gt; &#039;&#039;, &#039;post_type&#039; =&gt; &#039;&#039; ) );

$title = $instance&#x5B;&#039;title&#039;];
$tags = $instance&#x5B;&#039;tags&#039;];
$post_type = $instance&#x5B;&#039;post_type&#039;];
?&gt;

&lt;p&gt;&lt;label for=&quot;&lt;?php echo $this-&gt;get_field_id(&#039;title&#039;); ?&gt;&quot;&gt;Title: &lt;input id=&quot;&lt;?php echo $this-&gt;get_field_id(&#039;title&#039;); ?&gt;&quot; name=&quot;&lt;?php echo $this-&gt;get_field_name(&#039;title&#039;); ?&gt;&quot; type=&quot;text&quot; value=&quot;&lt;?php echo attribute_escape($title); ?&gt;&quot; /&gt;&lt;/label&gt;&lt;/p&gt;
&lt;p&gt;&lt;label for=&quot;&lt;?php echo $this-&gt;get_field_id(&#039;tags&#039;); ?&gt;&quot;&gt;Tags: &lt;input id=&quot;&lt;?php echo $this-&gt;get_field_id(&#039;tags&#039;); ?&gt;&quot; name=&quot;&lt;?php echo $this-&gt;get_field_name(&#039;tags&#039;); ?&gt;&quot; type=&quot;text&quot; value=&quot;&lt;?php echo attribute_escape($tags); ?&gt;&quot; /&gt;&lt;/label&gt;&lt;/p&gt;
&lt;p&gt;&lt;label for=&quot;&lt;?php echo $this-&gt;get_field_id(&#039;post_type&#039;); ?&gt;&quot;&gt;Post Types: &lt;input id=&quot;&lt;?php echo $this-&gt;get_field_id(&#039;post_type&#039;); ?&gt;&quot; name=&quot;&lt;?php echo $this-&gt;get_field_name(&#039;post_type&#039;); ?&gt;&quot; type=&quot;text&quot; value=&quot;&lt;?php echo attribute_escape($post_type); ?&gt;&quot; /&gt;&lt;/label&gt;&lt;/p&gt;
&lt;?php
}

function update($new_instance, $old_instance)

{
$instance = $old_instance;
$instance&#x5B;&#039;title&#039;] = $new_instance&#x5B;&#039;title&#039;];
$instance&#x5B;&#039;tags&#039;] =  $new_instance&#x5B;&#039;tags&#039;];
$instance&#x5B;&#039;post_type&#039;] = $new_instance&#x5B;&#039;post_type&#039;];

return $instance;
}

function widget($args, $instance)
{
extract($args, EXTR_SKIP);

echo $before_widget;
$title = empty($instance&#x5B;&#039;title&#039;]) ? &#039;&#039; : apply_filters(&#039;widget_title&#039;, $instance&#x5B;&#039;title&#039;]);
$tags = empty($instance&#x5B;&#039;tags&#039;]) ? &#039;&#039; : wp_parse_id_list($instance&#x5B;&#039;tags&#039;]);
$post_type = empty($instance&#x5B;&#039;post_type&#039;]) ? &#039;&#039; : preg_split( &#039;/&#x5B;s,]+/&#039;,strtolower($instance&#x5B;&#039;post_type&#039;]));

if (!empty($title))
echo $before_title . $title . $after_title;

$query = new WP_Query( array( &#039;post_type&#039; =&gt; $post_type, &#039;tag_id&#039; =&gt; $tags  ) );
while ( $query-&gt;have_posts() ) : $query-&gt;the_post();
echo get_the_image( array( &#039;meta_key&#039; =&gt; &#039;Thumbnail&#039;,&#039;size&#039; =&gt; &#039;sidebar-thumb&#039;) );
endwhile;
wp_reset_postdata();
echo $after_widget;
}

}
</pre></div>


<p class="wp-block-paragraph">Let me know your thoughts or if you have any questions. If there is a large intrest I may post a complete write up and example with images.</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Simple SOPA Blackout Plugin</title>
		<link>https://brooke.codes/2012/01/14/simple-sopa-blackout-plugin/</link>
					<comments>https://brooke.codes/2012/01/14/simple-sopa-blackout-plugin/#comments</comments>
		
		<dc:creator><![CDATA[Brooke.]]></dc:creator>
		<pubDate>Sat, 14 Jan 2012 08:01:16 +0000</pubDate>
				<category><![CDATA[php]]></category>
		<category><![CDATA[WordPress]]></category>
		<category><![CDATA[wp-plugins]]></category>
		<guid isPermaLink="false">https://brooke.codes/?p=271</guid>

					<description><![CDATA[I just wrote a simple plugin to blackout your site on January 18th for the SOPA Blackout day. Check it out on the project page.]]></description>
										<content:encoded><![CDATA[
<blockquote class="wp-block-quote is-style-info-notice is-layout-flow wp-block-quote-is-layout-flow">
<p class="wp-block-paragraph"><strong>Note: </strong>This post refers to code and a project from <em>many</em> years ago <img src="https://s.w.org/images/core/emoji/17.0.2/72x72/1f631.png" alt="😱" class="wp-smiley" style="height: 1em; max-height: 1em;" />. The content was edited in March of 2025 to remove dead links, improve clarity, or fix formatting, but no other edits were made. Enjoy this time capsule into the past.</p>
</blockquote>



<p class="wp-block-paragraph">I just wrote a simple plugin to blackout your site on January 18th for the SOPA Blackout day. Check it out on the <a href="https://brooke.codes/past-projects/sopa/" data-type="page" data-id="262">project page. </a></p>
]]></content:encoded>
					
					<wfw:commentRss>https://brooke.codes/2012/01/14/simple-sopa-blackout-plugin/feed/</wfw:commentRss>
			<slash:comments>2</slash:comments>
		
		
			</item>
		<item>
		<title>Random Greeting in PHP</title>
		<link>https://brooke.codes/2011/08/30/random-greeting-in-php/</link>
					<comments>https://brooke.codes/2011/08/30/random-greeting-in-php/#comments</comments>
		
		<dc:creator><![CDATA[Brooke.]]></dc:creator>
		<pubDate>Tue, 30 Aug 2011 22:54:46 +0000</pubDate>
				<category><![CDATA[php]]></category>
		<guid isPermaLink="false">https://brooke.codes/?p=214</guid>

					<description><![CDATA[I was searching for a php&#160; list of greetings but couldn’t find one so I made my own. Thought this may be helpful to someone else looking for a list. Here is how to show a random greeting in php. Much like the flickr welcome page. Hope it’s helpful to someone. If you have an [&#8230;]]]></description>
										<content:encoded><![CDATA[
<blockquote class="wp-block-quote is-style-info-notice is-layout-flow wp-block-quote-is-layout-flow">
<p class="wp-block-paragraph"><strong>Note: </strong>This post refers to code and a project from <em>many</em> years ago 😱. The content was edited in March of 2025 to remove dead links, improve clarity, or fix formatting, but no other edits were made. Enjoy this time capsule into the past.</p>
</blockquote>



<p class="wp-block-paragraph">I was searching for a php&nbsp; list of greetings but couldn’t find one so I made my own. Thought this may be helpful to someone else looking for a list. Here is how to show a random greeting in php. Much like the <a href="https://brooke.codes/wp-content/uploads/2011/08/flickr_welcome.png">flickr welcome page</a>.</p>



<span id="more-214"></span>


<pre class="brush: php; title: ; notranslate">

//random array function you can use or write your own
function randomArrayVar($array)
{
if (!is_array($array)){
return $array;
}
return $array&#x5B;array_rand($array)];
}

//list of grettings as arary

$greeting= array(
&amp;quot;aloha&amp;quot;=&amp;gt;&amp;quot;Aloha&amp;quot;,
&amp;quot;ahoy&amp;quot;=&amp;gt;&amp;quot;Ahoy&amp;quot;,
&amp;quot;bonjour&amp;quot;=&amp;gt;&amp;quot;Bonjour&amp;quot;,
&amp;quot;gday&amp;quot;=&amp;gt;&amp;quot;G&#039;day&amp;quot;,
&amp;quot;hello&amp;quot;=&amp;gt;&amp;quot;Hello&amp;quot;,
&amp;quot;hey&amp;quot;=&amp;gt;&amp;quot;Hey&amp;quot;,
&amp;quot;hi&amp;quot;=&amp;gt;&amp;quot;Hi&amp;quot;,
&amp;quot;hola&amp;quot;=&amp;gt;&amp;quot;Hola&amp;quot;,
&amp;quot;howdy&amp;quot;=&amp;gt;&amp;quot;Howdy&amp;quot;,
&amp;quot;rawr&amp;quot;=&amp;gt;&amp;quot;Rawr&amp;quot;,
&amp;quot;salutations&amp;quot;=&amp;gt;&amp;quot;Salutations&amp;quot;,
&amp;quot;sup&amp;quot;=&amp;gt;&amp;quot;Sup&amp;quot;,
&amp;quot;whatsup&amp;quot;=&amp;gt;&amp;quot;What&#039;s up&amp;quot;,
&amp;quot;yo&amp;quot;=&amp;gt;&amp;quot;Yo&amp;quot;);

//echo greeting
echo (randomArrayVar($greeting));

</pre>



<p class="wp-block-paragraph">Hope it’s helpful to someone. If you have an additions please leave them in the comments below.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://brooke.codes/2011/08/30/random-greeting-in-php/feed/</wfw:commentRss>
			<slash:comments>2</slash:comments>
		
		
			</item>
		<item>
		<title>MobileESP for WP 1.2 Updated</title>
		<link>https://brooke.codes/2011/08/09/mobileesp-for-wp-1-2-updated/</link>
					<comments>https://brooke.codes/2011/08/09/mobileesp-for-wp-1-2-updated/#comments</comments>
		
		<dc:creator><![CDATA[Brooke.]]></dc:creator>
		<pubDate>Tue, 09 Aug 2011 08:06:46 +0000</pubDate>
				<category><![CDATA[php]]></category>
		<category><![CDATA[wp-plugins]]></category>
		<guid isPermaLink="false">https://brooke.codes/?p=210</guid>

					<description><![CDATA[[UPDATE] this plugin has been updated to 1.2.1 to add support for removing the cookie. See the comments of this post for more info. I just wanted to write a quick post to let you know that MobileESP for WordPress version 1.2 has been released. This release contains the latest version of the MobileESP library [&#8230;]]]></description>
										<content:encoded><![CDATA[
<blockquote class="wp-block-quote is-style-info-notice is-layout-flow wp-block-quote-is-layout-flow">
<p class="wp-block-paragraph"><strong>Note: </strong>This post refers to code and a project from <em>many</em> years ago <img src="https://s.w.org/images/core/emoji/17.0.2/72x72/1f631.png" alt="😱" class="wp-smiley" style="height: 1em; max-height: 1em;" />. The content was edited in March of 2025 to remove dead links, improve clarity, or fix formatting, but no other edits were made. Enjoy this time capsule into the past.</p>
</blockquote>



<blockquote class="wp-block-quote is-style-note-notice is-layout-flow wp-block-quote-is-layout-flow">
<p class="wp-block-paragraph"><strong>[UPDATE]</strong> this plugin has been updated to 1.2.1 to add support for removing the cookie. See the comments of this post for more info.</p>
</blockquote>



<p class="wp-block-paragraph">I just wanted to write a quick post to let you know that<a href="https://brooke.codes/past-projects/mobileesp4wp/" data-type="page" data-id="148"> MobileESP for WordPress</a> version 1.2 has been released. This release contains the latest version of the MobileESP library as well as a bugfix for the full site url link bug which was requiring clicking on the link twice.  Get the latest version from the <a href="https://wordpress.org/plugins/mobileesp-for-wordpress/">WordPress.org Plugin repo</a> or update the plugin from your dashboard.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://brooke.codes/2011/08/09/mobileesp-for-wp-1-2-updated/feed/</wfw:commentRss>
			<slash:comments>13</slash:comments>
		
		
			</item>
		<item>
		<title>April Fools Plugin: Cornify for WordPress Released</title>
		<link>https://brooke.codes/2011/04/03/cornify-for-wordpress/</link>
		
		<dc:creator><![CDATA[Brooke.]]></dc:creator>
		<pubDate>Sun, 03 Apr 2011 21:09:56 +0000</pubDate>
				<category><![CDATA[php]]></category>
		<category><![CDATA[wp-plugins]]></category>
		<category><![CDATA[april fools]]></category>
		<category><![CDATA[plugin]]></category>
		<category><![CDATA[rainbows]]></category>
		<category><![CDATA[unicorns]]></category>
		<guid isPermaLink="false">https://brooke.codes/?p=191</guid>

					<description><![CDATA[In case you missed it I decided to do a small April Fools prank this year. I came across cornify.com and liked the way it worked. I thought it would be funny to have the unicorns pop up if the user was inactive on the site for longer than a few seconds. So I got [&#8230;]]]></description>
										<content:encoded><![CDATA[
<blockquote class="wp-block-quote is-style-info-notice is-layout-flow wp-block-quote-is-layout-flow">
<p class="wp-block-paragraph"><strong>Note: </strong>This post refers to code and a project from <em>many</em> years ago <img src="https://s.w.org/images/core/emoji/17.0.2/72x72/1f631.png" alt="😱" class="wp-smiley" style="height: 1em; max-height: 1em;" />. The content was edited in March of 2025 to remove dead links, improve clarity, or fix formatting, but no other edits were made. Enjoy this time capsule into the past.</p>
</blockquote>



<p class="wp-block-paragraph">In case you missed it I decided to do a small April Fools prank this year. I came across cornify.com and liked the way it worked. I thought it would be funny to have the unicorns pop up if the user was inactive on the site for longer than a few seconds. So I got to hacking the script and came up with a simple plugin <a href="https://wordpress.org/plugins/cornify-for-wordpress/">Cornify for WordPress</a>. This is a simple WordPress plugin for the self hosted WordPress blog that will show unicorns to the inactive user. There isn&#8217;t a control panel but if you read the readme you do have a few options for modifying the script.</p>



<p class="wp-block-paragraph">Without further ado here is a screenshot:</p>



<figure class="wp-block-image aligncenter"><a href="https://brooke.codes/wp-content/uploads/2011/04/cornify.png"><img fetchpriority="high" decoding="async" width="800" height="434" src="https://brooke.codes/wp-content/uploads/2011/04/cornify.png" alt="" class="wp-image-193" title="cornify" srcset="https://brooke.codes/wp-content/uploads/2011/04/cornify.png 800w, https://brooke.codes/wp-content/uploads/2011/04/cornify-300x163.png 300w, https://brooke.codes/wp-content/uploads/2011/04/cornify-768x417.png 768w" sizes="(max-width: 800px) 100vw, 800px" /></a></figure>



<p class="wp-block-paragraph"></p>



<h3 class="wp-block-heading"><a href="https://wordpress.org/plugins/cornify-for-wordpress/">Get the plugin today!</a></h3>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>MobileESP for WP Updated</title>
		<link>https://brooke.codes/2011/04/02/mobileesp-for-wp-updated/</link>
		
		<dc:creator><![CDATA[Brooke.]]></dc:creator>
		<pubDate>Sat, 02 Apr 2011 19:35:05 +0000</pubDate>
				<category><![CDATA[php]]></category>
		<category><![CDATA[wp-plugins]]></category>
		<category><![CDATA[mobileesp]]></category>
		<category><![CDATA[plugins]]></category>
		<category><![CDATA[update]]></category>
		<category><![CDATA[wordpress]]></category>
		<guid isPermaLink="false">https://brooke.codes/?p=178</guid>

					<description><![CDATA[I just released version 1.1 of MobileESP for WordPress this should fix any problems people were having with iPhone and Android devices not forwarding correctly. I also updated the MobileESP class and minified the source which made it half the size. As always, if you have any problems please report them in the forums tagging [&#8230;]]]></description>
										<content:encoded><![CDATA[
<blockquote class="wp-block-quote is-style-info-notice is-layout-flow wp-block-quote-is-layout-flow">
<p class="wp-block-paragraph"><strong>Note: </strong>This post refers to code and a project from <em>many</em> years ago <img src="https://s.w.org/images/core/emoji/17.0.2/72x72/1f631.png" alt="😱" class="wp-smiley" style="height: 1em; max-height: 1em;" />. The content was edited in March of 2025 to remove dead links, improve clarity, or fix formatting, but no other edits were made. Enjoy this time capsule into the past.</p>
</blockquote>



<p class="wp-block-paragraph">I just released version 1.1 of <a href="https://wordpress.org/plugins/mobileesp-for-wordpress/">MobileESP for WordPress</a> this should fix any <a href="https://wordpress.org/support/topic/plugin-mobileesp-for-wordpress-not-redirecting-with-wp-3/">problems </a>people were having with iPhone and Android devices not forwarding correctly. I also updated the MobileESP class and minified the source which made it half the size.</p>



<p class="wp-block-paragraph">As always, if you have any problems please report them in the forums tagging them with at least &#8216;mobileesp-for-wordpress&#8217;</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>WPBook 2.0.10 BETA release</title>
		<link>https://brooke.codes/2010/10/10/wpbook-2-0-10-beta-release/</link>
					<comments>https://brooke.codes/2010/10/10/wpbook-2-0-10-beta-release/#comments</comments>
		
		<dc:creator><![CDATA[Brooke.]]></dc:creator>
		<pubDate>Sun, 10 Oct 2010 22:54:44 +0000</pubDate>
				<category><![CDATA[php]]></category>
		<category><![CDATA[wp-plugins]]></category>
		<category><![CDATA[WPBook]]></category>
		<guid isPermaLink="false">https://brooke.codes/?p=105</guid>

					<description><![CDATA[UPDATE 12/11/10: As John noted in the comments below the most recent beta can be found at the WPBook download page at WordPress. Get the latest copy of 2.0.10 here: https://wordpress.org/plugins/wpbook/download/ Today I am uploading a new beta version of WPBook. This version needs some testing before being forked into core so if you download [&#8230;]]]></description>
										<content:encoded><![CDATA[
<blockquote class="wp-block-quote is-style-info-notice is-layout-flow wp-block-quote-is-layout-flow">
<p class="wp-block-paragraph"><strong>Note: </strong>This post refers to code and a project from <em>many</em> years ago <img src="https://s.w.org/images/core/emoji/17.0.2/72x72/1f631.png" alt="😱" class="wp-smiley" style="height: 1em; max-height: 1em;" />. The content was edited in March of 2025 to remove dead links, improve clarity, or fix formatting, but no other edits were made. Enjoy this time capsule into the past.</p>
</blockquote>



<blockquote class="wp-block-quote is-style-note-notice is-layout-flow wp-block-quote-is-layout-flow">
<p class="wp-block-paragraph"><strong>UPDATE 12/11/10: </strong>As John noted in the comments below the most recent beta can be found at the WPBook download page at WordPress. Get the latest copy of 2.0.10 here: <a href="https://wordpress.org/plugins/wpbook/download/">https://wordpress.org/plugins/wpbook/download/</a></p>
</blockquote>



<p class="wp-block-paragraph">Today I am uploading a new beta version of WPBook. This version needs some testing before being forked into core so if you download it and have any problems let me know.</p>



<h3 class="wp-block-heading">You can download the version here</h3>



<h3 class="wp-block-heading"><strong>New in this Features version:</strong></h3>



<p class="wp-block-paragraph"><strong>Facebook Avatars</strong> &#8211; if you have the gravtar setting on and the visiter leaves a comment from Facebook (or leaves their Facebook profile url in the url field) you&#8217;ll see their Facebook Profile picture instead of their default gravtar. This is true for both your parent blog (outside of Facebook) and the app view (inside of Facebook)</p>



<p class="wp-block-paragraph"><strong>New Admin Layout &#8211;</strong> The WP-Dashboard admin page has been completely redesigned and organized into three categories: required, Streaming and Facebook App View. The &#8220;advanced settings&#8221; have been removed and integrated into the appropriate place in the settings. Tooltips have also been removed. Hopefully this layout is easier to use. Thanks to <a href="https://wordpress.org/plugins/yourls-wordpress-to-twitter/">Ozh&#8217;s YOURLS: WordPress to Twitter</a> for the inspiration and some of the code that powers the admin interface and the <a href="https://en.wikipedia.org/wiki/Tango_Desktop_Project">Tango Project</a> for the expand/collapse icons.</p>



<h3 class="wp-block-heading"><strong>Bug Fixes:</strong></h3>



<p class="wp-block-paragraph">The default of &#8220;post to facebook&#8221; is now set to true</p>



<p class="wp-block-paragraph">The link in set_permissons=true now links to WPbook.net instead of the old instructions folder in your install.</p>



<h3 class="wp-block-heading">Other Notes:</h3>



<p class="wp-block-paragraph">Folder Cleanup, the client and cron file includes have been moved to there own &#8220;include&#8221; folder</p>



<p class="wp-block-paragraph">The Facebook&nbsp; Tab view has been moved to it&#8217;s own folder inside the wpbook/theme folder</p>



<p class="wp-block-paragraph">Please let me know any feedback you may have on this build.<strong><br><br></strong></p>
]]></content:encoded>
					
					<wfw:commentRss>https://brooke.codes/2010/10/10/wpbook-2-0-10-beta-release/feed/</wfw:commentRss>
			<slash:comments>1</slash:comments>
		
		
			</item>
		<item>
		<title>YOURL&#8217;s WordPress Plugin Update for 3.0</title>
		<link>https://brooke.codes/2010/05/10/yourls-wordpress-plugin-update-for-3-0/</link>
					<comments>https://brooke.codes/2010/05/10/yourls-wordpress-plugin-update-for-3-0/#comments</comments>
		
		<dc:creator><![CDATA[Brooke.]]></dc:creator>
		<pubDate>Tue, 11 May 2010 07:54:29 +0000</pubDate>
				<category><![CDATA[php]]></category>
		<category><![CDATA[wp-plugins]]></category>
		<guid isPermaLink="false">https://brooke.codes/?p=72</guid>

					<description><![CDATA[UPDATE: Thanks to Ozh&#8217;s Comments I have updated the post below. It sounds like the plugin will be updated for WP 3.0. However, it will then stop working with WP 2.9 and below. I am leaving this page up for those of you who wish to use an older version of WP but would still [&#8230;]]]></description>
										<content:encoded><![CDATA[
<blockquote class="wp-block-quote is-style-info-notice is-layout-flow wp-block-quote-is-layout-flow">
<p class="wp-block-paragraph"><strong>Note: </strong>This post refers to code and a project from <em>many</em> years ago <img src="https://s.w.org/images/core/emoji/17.0.2/72x72/1f631.png" alt="😱" class="wp-smiley" style="height: 1em; max-height: 1em;" />. The content was edited in March of 2025 to remove dead links, improve clarity, or fix formatting, but no other edits were made. Enjoy this time capsule into the past.</p>
</blockquote>



<blockquote class="wp-block-quote is-style-note-notice is-layout-flow wp-block-quote-is-layout-flow">
<p class="wp-block-paragraph"><em><strong>UPDATE:</strong> Thanks to Ozh&#8217;s Comments I have updated the post below. It sounds like the plugin will be updated for WP 3.0. However, it will then stop working with WP 2.9 and below. I am leaving this page up for those of you who wish to use an older version of WP but would still recommend updating to a newer release when one becomes available. </em></p>
</blockquote>



<p class="wp-block-paragraph">I&#8217;ve been using <a href="https://yourls.org/">YOURLS </a>to host my own shortlink site for quite some time. I recently found the <a href="https://wordpress.org/plugins/yourls-wordpress-to-twitter/">YOURL&#8217;s WordPress to Twitter Plugin</a>. This plugin is great however the, <code>get_shortlink</code> function added to WP 3.0 as well as the latest version of<a href="https://wordpress.org/plugins/stats/"> WordPress.com Stats</a> plugin caused some small usability issues. Such as the &#8220;Get Shortlink&#8221; button showing up twice.</p>



<p class="wp-block-paragraph">My solution? Make it so when you click on the &#8220;Get Shortlink&#8221; button it gets the YOURLS shorlink instead of the wp.me one. This required the following changes that I&#8217;m hoping <a href="https://planetozh.com">OZH </a>will adopt or modify.</p>



<span id="more-72"></span>



<p class="wp-block-paragraph">Remove the following from <code>inc/options.php</code> (Lines 427-428)</p>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: jscript; title: ; notranslate">
$(&#039;#edit-slug-box&#039;).append(&#039;&lt;span id=&quot;&lt;span class=&quot;&gt;yourls-shorturl-button&lt;/span&gt;&quot;&gt;&lt;a onclick=&quot;prompt(&#039;Short URL:&#039;, &#039;&lt;?php echo $shorturl; ?&gt;&#039;); return false;&quot; href=&quot;#&quot;&gt;Get Short URL&lt;/a&gt;&#039;);
$(&#039;#yourls-shorturl-button a&#039;).css(&#039;border-color&#039;,&#039;#bbf&#039;);
</pre></div>


<p class="wp-block-paragraph">Next add the following functions to either <code>inc/core.php or plugin.php</code></p>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: php; title: ; notranslate">
//the following two functions are from WordPress.com Stats Plugin by Andy Skelton Thanks Andy
//shortlink url for WP &lt;= 2.9
function wp_ozh_yourls_get_shortlink_html($html) {
$url = wp_ozh_yourls_geturl($id);
$html .= &#039;&lt;input id=&quot;YOURLS-shorturl&quot; type=&quot;hidden&quot; value=&quot;&#039; . $url . &#039;&quot; /&gt;&lt;a onclick=&quot;prompt(&#039;URL:&#039;, jQuery(&#039;#YOURLS-shorturl&#039;).val()); return false;&quot; href=&quot;#&quot;&gt;&#039; . __(&#039;Get Shortlink&#039;) . &#039;&lt;/a&gt;&#039;;
return $html;
}
</pre></div>


<p class="wp-block-paragraph">The final step is to modify the <code>plugin.php</code> file to change the renamed wpme functions and update for WP 3.0</p>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: plain; title: ; notranslate">
// WP 2.9/3.0 &amp;amp; wp.me play nice together
add_action(&#039;plugins_loaded&#039;, &#039;wp_ozh_yourls_wpme&#039; );
function wp_ozh_yourls_wpme() {
if( ! function_exists(&#039;wp_get_shortlink&#039;) ) {
// Remove these only for WP &amp;lt; 3.0.
remove_action(&#039;wp_head&#039;, &#039;wpme_shortlink_wp_head&#039;);
remove_action(&#039;wp&#039;, &#039;wpme_shortlink_header&#039;);
//Add shortlink URL html
add_filter( &#039;get_sample_permalink_html&#039;, &#039;wp_ozh_yourls_get_shortlink_html&#039;);
} else {
// Add a shortlink handler for WP &gt;= 3.0.
add_filter( &#039;get_shortlink&#039;, &#039;wp_ozh_yourls_raw_url&#039;);
}
}
</pre></div>


<p class="wp-block-paragraph">That should do the trick and be backwards compatible!</p>
]]></content:encoded>
					
					<wfw:commentRss>https://brooke.codes/2010/05/10/yourls-wordpress-plugin-update-for-3-0/feed/</wfw:commentRss>
			<slash:comments>3</slash:comments>
		
		
			</item>
	</channel>
</rss>
