Exemplo n.º 1
0
function page_tail($translatable = false, $is_main = false)
{
    global $book;
    if ($book) {
        return;
    }
    $datefile = $_SERVER["SCRIPT_FILENAME"];
    $d = last_mod($datefile);
    echo "\n        <hr size=1>\n    ";
    if (!$is_main) {
        echo "\n            <center>\n            <a href=\"/\">" . tra("Return to BOINC main page") . "</a>\n            </center><p>\n        ";
    }
    echo "\n        <span class=note>\n        <font color=#888888>\n    ";
    if ($translatable) {
        echo sprintf(tra("This page is %stranslatable%s."), "<a href=\"trac/wiki/TranslateIntro\">", "</a>"), "<br>\n        ";
    }
    echo "\n        Last modified {$d}.<br>\n    ";
    copyright();
    echo "\n        </font>\n        </span>\n        </body>\n        </html>\n    ";
}
Exemplo n.º 2
0
function wpgc_render_form()
{
    ?>
	<?php 
    settings_fields('wpgc_plugin_options');
    ?>
	<?php 
    $options = get_option('wpgc_options');
    ?>
<script type="text/javascript">
    function toggleVisibility(hs,co) {
        var h = document.getElementById(hs);
        var c = document.getElementById(co);
        if(c.style.display == 'block') { 
          c.style.display = 'none';
	  h.innerHTML = '[+]';
        } else {
          c.style.display = 'block';
	  h.innerHTML = '[-]';
	}
    }
</script>
<div class="wrap">
	<table><tr><td><img src="<?php 
    echo WP_PLUGIN_URL;
    ?>
/wpgeocode/images/whatiswpgeocode.png" alt="WP Geocode" /></td>
	<td><h2>WP Geocode Options</h2></td></tr>
<?php 
    if (!$options['chk_donated']) {
        ?>
<tr><td>
<div style="text-align:left; " id='wpgc_donate'>
<form action="https://www.paypal.com/cgi-bin/webscr" method="post">
<input type="hidden" name="cmd" value="_s-xclick">
<input type="hidden" name="hosted_button_id" value="GDQD948MQ3G3G">
<input type="image" src="https://www.paypal.com/en_US/i/btn/btn_donate_SM.gif" border="0" name="submit" alt="PayPal - The safer, easier way to pay online!">
<img alt="" border="0" src="https://www.paypal.com/en_US/i/scr/pixel.gif" width="1" height="1">
</form>
</div>
</td><td>Like this plugin?  Please rate it highly and maybe even consider donating to help keep this plugin alive and free.</td></tr>
<?php 
    }
    ?>
</table>
<form method="post" action="options.php">
<?php 
    settings_fields('wpgc_plugin_options');
    ?>
<input name="wpn-update_settings" type="hidden" value="<?php 
    echo wp_create_nonce('wpn-update_setting');
    ?>
" />
<input name="wpgc_options[chk_donated]" id="chk_donated" type="checkbox" <?php 
    if ($options['chk_donated']) {
        echo 'checked="checked"';
    }
    ?>
 />
<label for="wpgc_options[chk_donated]">I have donated to help contribute for the development of this plugin.</label>
<br />
<h3>Usage</h3>
Available shortcodes <a id='hide_shortcodes' style='text-decoration:none;' href='#' onclick="javascript:toggleVisibility('hide_shortcodes','shortcodes');">[+]</a>
<p>
<div id='shortcodes' style='display: none'>
Use these shortcodes to incorporate reader geolocation data into your blog posts
<h4>Shortcodes</h4>
Use these shortcodes to incorporate reader geolocation data into your blog posts
<ul STYLE="list-style-type: square; list-style-position: inside">
<li> [wpgc_ip] - IP Address of the reader</li>
<li> [wpgc_city] - City of the reader
<li> [wpgc_postal_code] - Postal Code (zip) of the reader
<li> [wpgc_state_code] - Two letter State code of the reader
<li> [wpgc_country_name] - Country name of the reader
<li> [wpgc_country_code] - Two letter Country code of the reader
<li> [wpgc_country_flag] - Image of the flag for the reader's country
<li> [wpgc_latitude] - Latitude of the reader
<li> [wpgc_longitude] - Latitude of the reader
</ul>

<h4>Conditional Shortcodes - Only available in the body of the post</h4>
Use these shortcodes to display customized content in your blog posts to readers
<ul STYLE="list-style-type: square; list-style-position: inside">
<li> [wpgc_is_city_and_state city="Yardley" state_code="PA"]
<li> [wpgc_is_postal_code postal_code="90120"]
<li> [wpgc_is_postal_codes postal_code="90120,19067"]
<li> [wpgc_is_not_postal_code postal_codes="90120"]
<li> [wpgc_is_not_postal_codes postal_codes="90120,19067"]
<li> [wpgc_is_ip ip="xx.xx.xx.xx"]
<li> [wpgc_is_ips ip="xx.xx.xx.xx"]
<li> [wpgc_is_ips ips="xx.xx.xx.xx,aa.bb.cc.dd"]
<li> [wpgc_is_not_ip ip="xx.xx.xx.xx"]
<li> [wpgc_is_city city=""]
<li> [wpgc_is_not_cities" city="cityone,citytwo,citythree"]
<li> [wpgc_is_not_city" city=""]
<li> [wpgc_is_nearby"] - Uses the value you specify in the Nearby Range setting from the administrative panel
<li> [wpgc_is_not_nearby"]
<li> [wpgc_is_within miles="10"]
<li> [wpgc_is_within kilometers="12"]
<li> [wpgc_is_country_name country_name=""]
<li> [wpgc_is_country_code country_code=""]
<li> [wpgc_is_state_code state_code=""]
<li> [wpgc_is_not_country_name country_name=""]
<li> [wpgc_is_not_country_code country_code=""]
<li> [wpgc_is_not_country_codes country_codes=""]
<li> [wpgc_is_not_state_code state_code=""]
</ul>

<h4>Examples</h4>
<ul STYLE="list-style-type: square; list-style-position: inside">
<li> [wpgc_is_nearby] Hi Neighbor! [/wpgc_is_nearby] - Will display "Hi Neighbor!" to readers within a configurable distance from your home base.
<li> [wpgc_is_within miles=10] Stop on over, since you're in the area.[/wpgc_is_within] - Will display "Come on over!" in the post body if the user is viewing the post from within 10 miles.
<li> [wpgc_is_ip ip=123.123.123.123] I used to own this IP Address [/wpgc_is_ip] - Will display the message only if the user has that specific IP Address.
<li> [wpgc_is_city city="Yardley"] Hello Fellow Yardlian [/wpgc_is_city] - Will display the message only if the user has that specific IP Address.
</ul>
</div>
<br>
</div>
<h3>Options</h3>

			<table class="form-table">
				<tr>
					<th scope="row">Plugin Status</th>
					<td>
					      <input name="wpgc_options[chk_enable_plugin]" id="chk_enable_plugin" type="checkbox" <?php 
    if ($options['chk_enable_plugin']) {
        echo 'checked="checked"';
    }
    ?>
 />
					      <label for="chk_enable_plugin">Enable WP Geocode Plugin</label>

					</td>
				</tr>
				<tr>
					<th scope="row">Your Google Maps API Key</th>
					<td>
						<label><input size=40 name="wpgc_options[txt_gmaps_key]" value="<?php 
    echo $options['txt_gmaps_key'];
    ?>
">
						<span style="color:#666666;margin-left:2px;">This is used when displaying Google Maps.  See <a href=https://developers.google.com/maps/signup>https://developers.google.com/maps/signup</a> for more information.</span>
					</td>
				</tr>
				<tr>
					<th scope="row">Your Latitude</th>
					<td>
						<label><input size=40 name="wpgc_options[txt_home_latitude]" value="<?php 
    echo $options['txt_home_latitude'];
    ?>
">
						<span style="color:#666666;margin-left:2px;">This is used for calculating distance - used by the conditional shortcodes [wpgc_is_within]</span>
					</td>
				</tr>
				<tr>
					<th scope="row">Your Longitude</th>
					<td>
						<label><input size=40 name="wpgc_options[txt_home_longitude]" value="<?php 
    echo $options['txt_home_longitude'];
    ?>
">
						<span style="color:#666666;margin-left:2px;">This is used for calculating distance - used by the conditional shortcodes [wpgc_is_within]</span>
					</td>
				</tr>
				<tr>
					<th scope="row">Nearby Range</th>
					<td>
						<label><input size=10 name="wpgc_options[txt_nearby_range]" value="<?php 
    echo $options['txt_nearby_range'];
    ?>
">
						<span style="color:#666666;margin-left:2px;">In Miles or Kilometers (see unit setting) if less than this distance will be considered nearby.  Used by [wpgc_is_nearby]</span>
					</td>
				</tr>
				<tr>
					<th scope="row">Default Distance in Kilometers Phrase</th>
					<td>
						<label><input name="wpgc_options[txt_def_distance_kilometers]" value="<?php 
    echo $options['txt_def_distance_kilometers'];
    ?>
">
						<span style="color:#666666;margin-left:2px;">Use this phrase for distance in kilometers if we can't geolocate the reader (shortcode [wpg_city])</span><br />
					</td>
				</tr>
				<tr>
					<th scope="row">Default Distance in Miles Phrase</th>
					<td>
						<label><input name="wpgc_options[txt_def_distance_miles]" value="<?php 
    echo $options['txt_def_distance_miles'];
    ?>
">
						<span style="color:#666666;margin-left:2px;">Use this phrase for distance in miles if we can't geolocate the reader (shortcode [wpg_city])</span><br />
					</td>
				</tr>
				<tr>
					<th scope="row">Default City Phrase</th>
					<td>
						<label><input name="wpgc_options[txt_def_city]" value="<?php 
    echo $options['txt_def_city'];
    ?>
">
						<span style="color:#666666;margin-left:2px;">Use this word in the city context if we can't geolocate the reader (shortcode [wpg_city])</span><br />
					</td>
				</tr>
				<tr>
					<th scope="row">Default State Code Phrase</th>
					<td>
						<label><input name="wpgc_options[txt_def_state_code]" value="<?php 
    echo $options['txt_def_state'];
    ?>
">
						<span style="color:#666666;margin-left:2px;">Use this phrase for the state code if we can't geolocate the reader (shortcode [wpgc_state_code])</span><br />
					</td>
				</tr>
				<tr>
					<th scope="row">Default Postal Code Phrase</th>
					<td>
						<label><input name="wpgc_options[txt_def_postal_code]" value="<?php 
    echo $options['txt_def_postal'];
    ?>
">
						<span style="color:#666666;margin-left:2px;">Use this phrase for the postal code if we can't geolocate the reader (shortcode [wpgc_postal_code])</span><br />
					</td>
				</tr>
				<tr>
					<th scope="row">Default Country Name Phrase</th>
					<td>
						<label><input name="wpgc_options[txt_def_country_name]" value="<?php 
    echo $options['txt_def_country_name'];
    ?>
">
						<span style="color:#666666;margin-left:2px;">Use this word for the country name if we can't geolocate the reader (shortcode [wpgc_country])</span><br />
					</td>
				</tr>
				<tr>
					<th scope="row">Default Country Code Phrase</th>
					<td>
						<label><input name="wpgc_options[txt_def_country_code]" value="<?php 
    echo $options['txt_def_country_code'];
    ?>
">
						<span style="color:#666666;margin-left:2px;">Use this phrase for the country code if we can't geolocate the reader (shortcode [wpgc_country])</span><br />
					</td>
				</tr>
				<tr>
					<th scope="row">Default Latitude Phrase</th>
					<td>
						<label><input name="wpgc_options[txt_def_latitude]" value="<?php 
    echo $options['txt_def_latitude'];
    ?>
">
						<span style="color:#666666;margin-left:2px;">Use this word in the latitude context if we can't geolocate the reader (shortcode [wpgc_latitude"])</span><br />
					</td>
				</tr>
				<tr>
					<th scope="row">Default Longitude Phrase</th>
					<td>
						<label><input name="wpgc_options[txt_def_longitude]" value="<?php 
    echo $options['txt_def_longitude'];
    ?>
">
						<span style="color:#666666;margin-left:2px;">Use this word in the longitude context if we can't geolocate the reader (shortcode [wpgc_longitude])</span><br />
					</td>
				</tr>
				<tr>
					<th scope="row">Default IP Address Phrase</th>
					<td>
						<label><input name="wpgc_options[txt_def_ip]" value="<?php 
    echo $options['txt_def_ip'];
    ?>
">
						<span style="color:#666666;margin-left:2px;">Use this word in the ip address context if we can't geolocate the reader (shortcode [wpgc_ip address])</span><br />
					</td>
				</tr>
				<tr valign="top">
					<th scope="row">Content to be filtered</th>
					<td>
						<label><input name="wpgc_options[chk_post_content]" type="checkbox" value="1" <?php 
    checked('1', $options['chk_post_content']);
    ?>
 /> Blog Posts</label><br />
						<label><input name="wpgc_options[chk_post_title]" type="checkbox" value="1" <?php 
    checked('1', $options['chk_post_title']);
    ?>
 /> Post Title <em>(also filters recent posts sidebar widget)</em></label><br />
						<label><input name="wpgc_options[chk_comments]" type="checkbox" value="1" <?php 
    checked('1', $options['chk_comments']);
    ?>
 /> Comments <em>(filters comment author names too)</em></label><br />
					</td>
				</tr>
				<tr>
					<th scope="row">Filter Class</th>
					<td>
						<input name='wpgc_options[txt_filter_cls]' value="<?php 
    echo $options['txt_filter_cls'];
    ?>
">
						<span style="color:#666666;margin-left:2px;">Renders filtered content using this style/class id. eg: &lt;span class="yourclass"&gt;Your City&lt;/span&gt;</span>
					</td>
				</tr>
				<tr>
					<th scope="row">Date Format</th>
					<td>
						<select name='wpgc_options[sel_date_format]'>
							<option <?php 
    if ($options['sel_date_format'] == 'F j, Y, g:i a') {
        print "SELECTED";
    }
    ?>
 value='F j, Y, g:i a'><?php 
    print date('F j, Y, g:i a');
    ?>
</option>

							<option <?php 
    if ($options['sel_date_format'] == 'm/d/Y') {
        print "SELECTED";
    }
    ?>
 value='m/d/Y'><?php 
    print date('m/d/Y');
    ?>
</option>
							<option <?php 
    if ($options['sel_date_format'] == 'd/m/Y') {
        print "SELECTED";
    }
    ?>
 value='d/m/Y'><?php 
    print date('d/m/Y');
    ?>
</option>
							<option <?php 
    if ($options['sel_date_format'] == 'D M j H:m:s') {
        print "SELECTED";
    }
    ?>
 value='D M j H:m:s'><?php 
    print date('D M j H:m:s');
    ?>
</option>
						</select>
						<span style="color:#666666;margin-left:2px;">Format to render date in - used by [wpgc_database_date] Eg:'D, M d Y H:i:s' </span>
					</td>
				</tr>
				<tr valign="top">
					<th scope="row">Default Units</th>
					<td>
						<label><input name="wpgc_options[rdo_units]" type="radio" value="miles" <?php 
    checked('miles', $options['rdo_units']);
    ?>
 /> Miles </label><span style="color:#666666;">Use miles</span><br>
						<label><input name="wpgc_options[rdo_units]" type="radio" value="kilometers" <?php 
    checked('lower', $options['rdo_units']);
    ?>
 /> Kilometers </label><span style="color:#666666;">Use Kilometers</span><br>
					</td>
				</tr>
				<tr valign="top">
					<th scope="row">Case Conversion</th>
					<td>
						<label><input name="wpgc_options[rdo_case]" type="radio" value="upper" <?php 
    checked('upper', $options['rdo_case']);
    ?>
 /> UPPER CASE </label><span style="color:#666666;">- Converts filtered content to UPPER CASE geolocation tags</span><br />
						<label><input name="wpgc_options[rdo_case]" type="radio" value="lower" <?php 
    checked('lower', $options['rdo_case']);
    ?>
 /> lower </label><span style="color:#666666;">- Converts filtered content to lower case geolocation tags</span><br />
						<label><input name="wpgc_options[rdo_case]" type="radio" value="ucfirst" <?php 
    checked('ucfirst', $options['rdo_case']);
    ?>
 /> Upper case first letter</label><span style="color:#666666;">- Converts filtered content to upper case first letter</span><br />
						<label><input name="wpgc_options[rdo_case]" type="radio" value="off" <?php 
    checked('off', $options['rdo_case']);
    ?>
 /> off </label><span style="color:#666666;">- Will not convert the case of filtered content</span>
					</td>
				</tr>
				<tr><td colspan="2"><div style="margin-top:10px;"></div></td></tr>
				<tr valign="top" style="border-top:#dddddd 1px solid;">
					<th scope="row">Database Options</th>
					<td>
						<label><input name="wpgc_options[chk_default_options_db]" type="checkbox" value="1" <?php 
    checked('1', $options['chk_default_options_db']);
    ?>
 /> Restore defaults upon plugin deactivation/reactivation</label>
						<br /><span style="color:#666666;margin-left:2px;">Only check this if you want to reset plugin settings upon reactivation</span>
					</td>
				</tr>
			</table>
			<p class="submit">
			<input type="submit" class="button-primary" value="Save Changes" />
			</p>
		</form>
<h3>Database</h3>
This product includes GeoLite data created by MaxMind, available from http://www.maxmind.com/.
<p>
As IP and geolocation data change over time, you should consider updating this database.  To update this database, download the latest version of the database from <a href=http://geolite.maxmind.com/download/geoip/database/GeoLiteCity.dat.gz>this link</a> and place it in the WP Geocode Plugin database folder on your server.
<p>
Installation Instructions <a id='hide_installation' style='text-decoration:none;' href='#' onclick="javascript:toggleVisibility('hide_installation','installation');">[+]</a>
<p>
<div id='installation' style='display: none'>
<strong>Step 1</strong> - Download database from <a href=http://geolite.maxmind.com/download/geoip/database/GeoLiteCity.dat.gz>this link</a>.
<p>
If you are using the wget program to download the GeoLite file, please use the -N option to only download if the file has been updated:
<p>
<pre>wget -N -q http://geolite.maxmind.com/download/geoip/database/GeoLiteCity.dat.gz</pre>
<p>
<strong>Step 2</strong> - Install database. Once you have uploaded the database, you will want to uncompress it. To uncompress the binary format, you will need to unzip the file. For example, to uncompress the GeoIP City binary database on Linux or Unix, you could run:
<pre>$ tar xvfz GeoIP-133_20051201.tar.gz</pre>
<p>
Then you will need to install the .dat file into a data directory. For example, on Linux/Unix, you could run:
$ mv GeoIP-133_20051201/GeoIP-133_20051201.dat /usr/local/share/GeoIP/GeoIPCity.dat
<p>
To uncompress the CSV format, you can use any zip program, like WinZip for Windows, or unzip on Linux. Then you can load the CSV database into a SQL database.
<p>
Alternatively, I will install the plugin for you:
<form action="https://www.paypal.com/cgi-bin/webscr" method="post">
<input type="hidden" name="cmd" value="_s-xclick">
<input type="hidden" name="hosted_button_id" value="447NPQRYQ8XFS">
<table>
<tr><td><input type="hidden" name="on0" value="Plugin installed by Author">Plugin installed by Author</td></tr><tr><td><input type="text" name="os0" maxlength="60"></td></tr>
</table>
<input type="image" src="https://www.paypal.com/en_US/i/btn/btn_buynowCC_LG.gif" border="0" name="submit" alt="PayPal - The safer, easier way to pay online!">
<img alt="" border="0" src="https://www.paypal.com/en_US/i/scr/pixel.gif" width="1" height="1">
</form>

</div>
<table>
<tr>
<th width='20%'>Latest Available from MaxMind</th>
<th width='20%'>Installed Database</th>
<th width='35%'>Database Path</th>
<th width='15%'>Actions</th>
</tr>
<tr>
<?php 
    $lmoddate = last_mod("http://geolite.maxmind.com/download/geoip/database/GeoLiteCity.dat.gz");
    echo "<td>{$lmoddate}</td>";
    $database = WP_PLUGIN_DIR . '/wpgeocode/database/GeoLiteCity.dat';
    if (is_file($database)) {
        if ($options['chk_enable_plugin']) {
            $dbdate = date("D, M d Y H:i:s", @filemtime("{$database}"));
            $dbstate = '<td style="background-color:#99cc99; padding:4px;"><strong>MaxMind Database is installed and dated ' . $dbdate . ' </td>';
            $install = 'Update';
        } else {
            $dbstate = '<td style="background-color:#FFE991; padding:4px;"><strong>MaxMind Database is installed but this plugin is disabled. </td>';
            $install = 'Update';
        }
    } else {
        $dbstate = '<td style="background-color:#FFE991; padding:4px;"><strong>MaxMind Database not installed. </td>';
        $install = 'Install';
    }
    echo $dbstate;
    ?>

<td>
<?php 
    echo dirname(__FILE__) . "/database";
    ?>
</td>
<td>
<?php 
    echo $install . ' Now (Coming Soon)';
    ?>

</td>
</tr>
</table>
<p>
<?php 
}