<?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"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Dirty Motherfucking Blog &#187; javacsript</title>
	<atom:link href="http://dirty-motherfucker.org/blog/tag/javacsript/feed/" rel="self" type="application/rss+xml" />
	<link>http://dirty-motherfucker.org/blog</link>
	<description>All kinds of shit</description>
	<lastBuildDate>Wed, 09 May 2012 12:49:30 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.4-beta4-20750</generator>
		<item>
		<title>Flash Player version in AWStats &#8211; Revised</title>
		<link>http://dirty-motherfucker.org/blog/2008/11/20/flash-player-version-in-awstats-revised/</link>
		<comments>http://dirty-motherfucker.org/blog/2008/11/20/flash-player-version-in-awstats-revised/#comments</comments>
		<pubDate>Thu, 20 Nov 2008 10:46:43 +0000</pubDate>
		<dc:creator>gencha</dc:creator>
				<category><![CDATA[administration]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[awstats]]></category>
		<category><![CDATA[flash player]]></category>
		<category><![CDATA[javacsript]]></category>
		<category><![CDATA[wordpress]]></category>

		<guid isPermaLink="false">http://www.dirty-motherfucker.org/blog/?p=198</guid>
		<description><![CDATA[My first implementation of this idea may have been sufficient for general use. For inclusion in WordPress however it was problematic at best. Now that I have revised (and tested) it, I thought I&#8217;d share this updated WordPress plugin. In this version I put the JavaScript code inline. Although I&#8217;m not a big fan of [...]]]></description>
			<content:encoded><![CDATA[<p>My <a href="http://www.dirty-motherfucker.org/blog/2008/11/12/including-flash-player-version-in-awstats/">first implementation</a> of this idea may have been sufficient for general use. For inclusion in WordPress however it was problematic at best.<br />
Now that I have revised (and tested) it, I thought I&#8217;d share this updated WordPress plugin.</p>
<pre class="brush: php; title: ; notranslate">
&lt;?php
/*
Plugin Name: Flash version Detection
Plugin URI: http://www.dirty-motherfucker.org/
Description: Detects flash version
Version: 0.1
Author: gencha
Author URI: http://www.dirty-motherfucker.org
*/

$plugin_root = get_settings('siteurl') . '/wp-content/plugins/'.dirname(plugin_basename(__FILE__));

if( preg_match(&quot;/(\/\?feed=|\/feed)/i&quot;,$_SERVER['REQUEST_URI']) ) {
        // RSS Feeds
        // do nothing
} else {
        add_action('wp_head', 'add_head');
}

function add_head() {
	global $plugin_root;
	echo '
	&lt;!-- Flash player version detection --&gt;
	&lt;script src=&quot;' . $plugin_root . '/swfobject.js&quot; type=&quot;text/javascript&quot;&gt;&lt;/script&gt;
	&lt;script type=&quot;text/javascript&quot;&gt;
		window.onload = function() {
			var version = deconcept.SWFObjectUtil.getPlayerVersion();
			if( document.getElementById &amp;&amp; version[&quot;major&quot;]&gt; 0 ) {
				var flash_version = version[&quot;major&quot;] +&quot;.&quot;+ version[&quot;minor&quot;] +&quot;.&quot;+ version[&quot;rev&quot;];
				document.getElementById(&quot;flashversion&quot;).innerHTML = &quot;&lt;iframe src=\&quot;' . get_settings(&quot;siteurl&quot;) . '/flash_player_version.php?version=&quot; + flash_version + &quot;\&quot; style=\&quot;display: none;\&quot;&gt;&lt;/iframe&gt;&quot;;
			}
		}
	&lt;/script&gt;
	';
}
?&gt;
</pre>
<p>In this version I put the JavaScript code inline. Although I&#8217;m not a big fan of that, it&#8217;s reasonable in this case and I have all the code in one place. This made it easier to fix the second bug. Which was that the whole concept only worked on the main page. On other pages the browser couldn&#8217;t find the flash_version.php file. Which resulted in nasty 404 errors. Now I can simply put the blogs base path into the JavaScript code and everything is well.</p>
]]></content:encoded>
			<wfw:commentRss>http://dirty-motherfucker.org/blog/2008/11/20/flash-player-version-in-awstats-revised/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

