<?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>... coding (the life) &#187; snippet</title>
	<atom:link href="http://www.marvinmarcelo.com/tag/snippet/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.marvinmarcelo.com</link>
	<description>Anything about programming, and a little about me.</description>
	<lastBuildDate>Mon, 09 Jan 2012 13:44:35 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Quickie Visitors Country WP Plugin</title>
		<link>http://www.marvinmarcelo.com/quickie-visitors-country-wp-plugin/</link>
		<comments>http://www.marvinmarcelo.com/quickie-visitors-country-wp-plugin/#comments</comments>
		<pubDate>Tue, 27 Oct 2009 02:14:54 +0000</pubDate>
		<dc:creator>Marvin</dc:creator>
				<category><![CDATA[job]]></category>
		<category><![CDATA[me stuff]]></category>
		<category><![CDATA[productivity]]></category>
		<category><![CDATA[work related]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[snippet]]></category>
		<category><![CDATA[wordpress]]></category>

		<guid isPermaLink="false">http://www.marvinmarcelo.com/?p=1382</guid>
		<description><![CDATA[This plugin is dependent on WP/GeoTrack by Johannes Lietz, this is NOT a stand-alone plugin, it won&#8217;t work if WP/GeoTrack is not installed anyway, so it&#8217;s safe. And don&#8217;t look for it in WP Plugins repo, you won&#8217;t find it &#8230; <a href="http://www.marvinmarcelo.com/quickie-visitors-country-wp-plugin/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>This plugin is dependent on <a title="Visit plugin site" href="http://dadabase.de/weblog/archives/2006/05/23/wordpress-geotrack-plugin">WP/GeoTrack</a> by <a title="Visit author homepage" href="http://dadabase.de/">Johannes Lietz</a>, this is NOT a stand-alone plugin, it won&#8217;t work if <a title="Visit plugin site" href="http://dadabase.de/weblog/archives/2006/05/23/wordpress-geotrack-plugin">WP/GeoTrack</a> is not installed anyway, so it&#8217;s safe.</p>
<p>And don&#8217;t look for it in <a href="http://wordpress.org/extend/plugins/">WP Plugins</a> repo, you won&#8217;t find it there <img src='http://www.marvinmarcelo.com/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' /> </p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">/*
Plugin Name: Top Visitors Flag
Plugin URI: http://www.marvinmarcelo.com/
Description: This plugin displays visitors on sidebar as widget dependent on &lt;a href=&quot;http://dadabase.de/weblog/archives/2006/05/23/wordpress-geotrack-plugin&quot;&gt;WP/GEO-Track plugin&lt;/a&gt;.
Author: Marvin Marcelo
Author URI: http://www.marvinmarcelo.com/
Version: 1.0.0
*/</span>
<span style="color: #000000; font-weight: bold;">function</span> tvf_get_topvisits<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
  <span style="color: #000000; font-weight: bold;">global</span> <span style="color: #000088;">$wpdb</span><span style="color: #339933;">,</span> <span style="color: #000088;">$table_prefix</span><span style="color: #339933;">;</span>
  <span style="color: #000088;">$sql</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;select count(*) as `rows` , `country` , `flagname` from `&quot;</span><span style="color: #339933;">.</span><span style="color: #000088;">$table_prefix</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;geotrack` group by `country` order by `rows` desc limit 0 , 12&quot;</span><span style="color: #339933;">;</span>
  <span style="color: #000088;">$flagstats</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$wpdb</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">get_results</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$sql</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
  <span style="color: #000088;">$html</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;&lt;li id='top-country-flags'&gt;&lt;h2&gt;Top Visiting Countries&lt;/h2&gt;&lt;div&gt;<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">/*  id string */</span>
  <span style="color: #b1b100;">foreach</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$flagstats</span> <span style="color: #b1b100;">as</span> <span style="color: #000088;">$cf</span><span style="color: #009900;">&#41;</span>
  <span style="color: #009900;">&#123;</span>
    <span style="color: #000088;">$cf</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">rows</span> <span style="color: #339933;">=</span> <span style="color: #990000;">number_format</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$cf</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">rows</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;&quot;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;,&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #000088;">$html</span> <span style="color: #339933;">.=</span> <span style="color: #0000ff;">&quot;&lt;img src=<span style="color: #000099; font-weight: bold;">\&quot;</span>&quot;</span><span style="color: #339933;">.</span> GEOTRACK_URL <span style="color: #339933;">.</span> <span style="color: #0000ff;">&quot;flags/&quot;</span> <span style="color: #339933;">.</span> <span style="color: #000088;">$cf</span><span style="color: #339933;">-/&gt;</span>flagname <span style="color: #339933;">.</span> <span style="color: #0000ff;">&quot;.png<span style="color: #000099; font-weight: bold;">\&quot;</span> alt=<span style="color: #000099; font-weight: bold;">\&quot;</span>Flag of <span style="color: #006699; font-weight: bold;">$cf-&gt;country</span> with <span style="color: #006699; font-weight: bold;">$cf-&gt;rows</span> visits<span style="color: #000099; font-weight: bold;">\&quot;</span> title=<span style="color: #000099; font-weight: bold;">\&quot;</span><span style="color: #006699; font-weight: bold;">$cf-&gt;country</span> with <span style="color: #006699; font-weight: bold;">$cf-&gt;rows</span> visits<span style="color: #000099; font-weight: bold;">\&quot;</span> /&gt;<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span>
  <span style="color: #000088;">$html</span> <span style="color: #339933;">.=</span> <span style="color: #0000ff;">&quot;&lt;/div&gt;&lt;/li&gt;&quot;</span><span style="color: #339933;">;</span>
  <span style="color: #b1b100;">echo</span> <span style="color: #000088;">$html</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">function</span> init_tvf_init<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
	register_sidebar_widget<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Top Visitors Flags&quot;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;tvf_get_topvisits&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #990000;">defined</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'GT_NOT_INSTALLED'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
  <span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">&quot;&lt;!-- You need <span style="color: #000099; font-weight: bold;">\&quot;</span>http://dadabase.de/weblog/archives/2006/05/23/wordpress-geotrack-plugin<span style="color: #000099; font-weight: bold;">\&quot;</span> installed first--&gt;&quot;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #b1b100;">else</span>
<span style="color: #009900;">&#123;</span>
  add_action<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;plugins_loaded&quot;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;init_tvf_init&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p>Also, you have to forgive the function, constants, and variables names, we all struggle for a better and sensible one <img src='http://www.marvinmarcelo.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  Happy coding!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.marvinmarcelo.com/quickie-visitors-country-wp-plugin/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

